query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
2f4149f025b5cc319cec9753d76dfe8c
connect each node bidirectional
[ { "docid": "35dcdb569cd2d809203e3b163e902a96", "score": "0.0", "text": "def add_edge(source:, target:, weight:)\n connect_graph(source, target, weight) # directional graph\n connect_graph(target, source, weight) # non directed graph (inserts the other edge too)\n end", "title": "" } ]
[ { "docid": "8232ab8888334f94806b8d492926327e", "score": "0.7961947", "text": "def connect_nodes_bidirectionally(node1, node2)\n structure[node1][:incoming] << node2\n structure[node1][:outgoing] << node2\n\n structure[node2][:incoming] << node1\n structure[node2][:outgoing] << node1\n\n nil\n end", "title": "" }, { "docid": "1a779e084deaca1bf551e6e17c07c730", "score": "0.7669927", "text": "def connect_all_nodes\n\t\[email protected] do |row|\n\t\t\trow.each do |node|\n\t\t\tconnect_above(node)\n\t\t\tconnect_below(node)\n\t\t\tconnect_left(node)\n\t\t\tconnect_right(node)\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "8a1810bffe9e4572db6ea8b154aba899", "score": "0.7567446", "text": "def connect_over(node); end", "title": "" }, { "docid": "ede67db416d5a6641e5ce2b4fb29182a", "score": "0.7332164", "text": "def connect_to(node1,node2)\n # assuming node1 and node2 are part of this graph\n node1.outgoing << node2\n node2.incoming << node1\n end", "title": "" }, { "docid": "8586a3da7450fd8da9355f91f61bd57a", "score": "0.722553", "text": "def connect_nodes(first, second)\n @nodes_by_id[first].add_neighbor(@nodes_by_id[second])\n @nodes_by_id[second].add_neighbor(@nodes_by_id[first])\n end", "title": "" }, { "docid": "3fbfd7f4f9dc29101e16407a5130e38c", "score": "0.72211623", "text": "def connect(node1, node2)\n node1.point_to(node2)\n node2.point_to(node1)\n end", "title": "" }, { "docid": "068626bcc7a74a37ab2bb9c741dcc132", "score": "0.7102794", "text": "def connect(node1, node2)\n\t\tif node1.class == Node\n\t\t\tnode1.add_adjacent(node2)\n\t\t\tnode2.add_adjacent(node1)\n\t\tend\n\tend", "title": "" }, { "docid": "20a1093a9697b4fb09f285032a2b67d9", "score": "0.67624635", "text": "def connect(x, y)\n x.connect_to(y)\n end", "title": "" }, { "docid": "1ee5cf00bdcc3c198ec836f6e4a7e8b7", "score": "0.6580831", "text": "def connect \n self.students.each do |s|\n self.timeslots.each do |t|\n if not connected? s, t\n self.add_edge(s, t, DUMMY_EDGE_WEIGHT)\n @dummy_edges.add([s,t])\n end\n end\n end\n end", "title": "" }, { "docid": "d80a3199be1fa02b38aaa09a2ff842fb", "score": "0.6562546", "text": "def connect(node)\n @connected.push(node) unless connected?(node)\n node.connect(self) unless node.connected?(self)\n end", "title": "" }, { "docid": "94c26e9abbc9a1ef9150b74438f4dfdc", "score": "0.6536995", "text": "def link_nodes(n1,n2)\n # TODO Check that n1, n2 already in list of nodes\n if n1.link_to n2\n @edge_count += 1\n end\n #ds_union n1.id, n2.id\n @disjoint.union(n1.id,n2.id)\n end", "title": "" }, { "docid": "777df86f0acfa948c445e23b301b1cb6", "score": "0.6505737", "text": "def connect(&block); end", "title": "" }, { "docid": "777df86f0acfa948c445e23b301b1cb6", "score": "0.6505737", "text": "def connect(&block); end", "title": "" }, { "docid": "777df86f0acfa948c445e23b301b1cb6", "score": "0.6505737", "text": "def connect(&block); end", "title": "" }, { "docid": "777df86f0acfa948c445e23b301b1cb6", "score": "0.6505737", "text": "def connect(&block); end", "title": "" }, { "docid": "df5e1794e6a8a1753df0d6868a7c2cbb", "score": "0.64412427", "text": "def connect(root)\n return unless root\n\n on_level = [root]\n until on_level.empty?\n next_level = []\n on_level.each_with_index do |node, index|\n node.next = on_level[index + 1]\n next_level << node.left if node.left\n next_level << node.right if node.right\n end\n\n on_level = next_level\n end\n\n root\nend", "title": "" }, { "docid": "7df3d041a752efae1862862d2e3c2586", "score": "0.6356047", "text": "def node_join(a,b)\n a.next_node = b\n b.prev_node = a\n end", "title": "" }, { "docid": "41e72c07b8bc639c351f43bc5b9dbb3d", "score": "0.63464415", "text": "def adjacent_nodes\n @links.dup\n end", "title": "" }, { "docid": "ba545bdce297fdf38a6fa503372c6b1c", "score": "0.63338405", "text": "def generate_child_connections(node)\n l = node.layer\n # For each child node...\n loop_over_nodes(l + 1) do |i|\n child = layer_n_nodes(l + 1)[i]\n # Generate a random connection weight between -1 and 1\n weight = rand * 2 - 1\n Connection.create(parent_id: node.id,\n child_id: child.id,\n weight: weight.round(3))\n end\n end", "title": "" }, { "docid": "e304e05bb1bf8bc6901e28e95befd600", "score": "0.633329", "text": "def connect a, b, value=nil\n # TODO: are self loops okay?\n # TODO: this doesn't allow parallel edges?\n \n self << a\n self << b\n \n edge = Edge.new(a, b, value)\n \n # initialize edge list for nodes a and b\n @edges[a] ||= []\n @edges[b] ||= []\n \n # check if this edges already exists\n @edges[a] << edge unless @edges[a].include? edge\n @edges[b] << edge unless @edges[b].include? edge\n \n uncache\n end", "title": "" }, { "docid": "38df878d543071c28bcc99f0734c7a0e", "score": "0.627102", "text": "def connect_right(node)\n\t\tright_node = @nodes[node.y][node.x + 1] unless node.x + 1 == @nodes[0].size\n\t\tnode.add_adjacent(right_node)\n\tend", "title": "" }, { "docid": "2fc6eac7d19c2ace6183b9a025245cf2", "score": "0.6252703", "text": "def add_connections node_names\n @connections = @connections.union node_names\n end", "title": "" }, { "docid": "a7076831e5dbf899d93dade69dfb3fc6", "score": "0.623822", "text": "def adjacent_nodes\n @links.dup\n end", "title": "" }, { "docid": "e4b2c8e9201bd6b2a173d4372b13a4b6", "score": "0.6237258", "text": "def connect(path)\n @edges = path\n self\n end", "title": "" }, { "docid": "bb12cf8185112fa05f70d803b66e9e9a", "score": "0.6230838", "text": "def connect(other, edge_attributes = {})\n e = Edge.new edge_attributes\n e << self << other\n # self.edges << e\n # other.edges << e unless self === other\n e\n end", "title": "" }, { "docid": "4ca9dd514ca26e347e9eb7f7f6ed3e5e", "score": "0.6220108", "text": "def links\n l=self.nodes().find_all {|n| n.parent_node}\n l.map {|n|\n \n Network::Link.new({\n :source_node=>n,\n :target_node=>n.parent_node,\n :link_value=>1\n })}\n end", "title": "" }, { "docid": "040cfece6b0a28a43dd53296db03f317", "score": "0.6210217", "text": "def fill_connections\n nodes.reload.each do |node|\n unless node.layer >= num_layers - 1\n generate_child_connections(node)\n end\n end\n end", "title": "" }, { "docid": "cbd017f7762329011780e346a5b3869d", "score": "0.61914366", "text": "def connect!\n connections.each &:connect!\n self\n end", "title": "" }, { "docid": "b5f632fc2b07ce80a74feb907c19a41f", "score": "0.61754185", "text": "def connect_to(vertex_names)\n connection = @end_node.path(vertex_names)\n if connection == NO_PATH\n return connection \n end\n connect(connection)\n end", "title": "" }, { "docid": "6c8321ec9f8e157544576b290090ac12", "score": "0.61620396", "text": "def connect(node_count)\n\t\tfor v1 in 0..node_count - 1\n\t\t\tneighbors = stations(v1)\n\t\t\tneighbors.each do |v2|\n\t\t\t\tneighbors1 = stations(v1)\n\t\t\t\tneighbors2 = stations(v2)\n\t\t\t\tif v1 != v2\n\t\t\t\t\[email protected](v1, v2, 1)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# Add this to run TSP style algorithms\n\t\t# @grid.add(@start, @goal, 1)\n\tend", "title": "" }, { "docid": "c7769402aefce73ec4d9065403ee8046", "score": "0.6158023", "text": "def connect_flights(flights)\n queue = [@root]\n @nodes = []\n while !queue.empty? do\n node = queue.shift\n @nodes << node\n flights.select { |f| node.flight.to_city == f.from_city && node.flight.arrives <= f.departs && !node.has_visited?(f.to_city) }.each do |flight|\n next_node = Node.new(flight)\n next_node.previous = node\n node.connections << next_node\n queue << next_node\n end\n end\n end", "title": "" }, { "docid": "873687a1694414ffe5c474891c53de3d", "score": "0.6146177", "text": "def connect_to(other)\n if other.row == self.row - 1\n self.northNeighbor = other\n other.southNeighbor = self\n # self.neighbors[:north] = other\n # other.neighbors[:south] = self\n elsif other.row == self.row + 1\n self.southNeighbor = other\n other.northNeighbor = self\n # self.neighbors[:south] = other\n # other.neighbors[:north] = self\n elsif other.col == self.col + 1\n self.eastNeighbor = other\n other.westNeighbor = self\n # self.neighbors[:east] = other\n # other.neighbors[:west] = self\n elsif other.col == self.col - 1\n self.westNeighbor = other\n other.eastNeighbor = self\n # self.neighbors[:west] = other\n # other.neighbors[:east] = self\n end\n self.save\n other.save\n # Josh.lifesaver\n end", "title": "" }, { "docid": "589dd88b2f9f030446cbb430b59c19bc", "score": "0.61414015", "text": "def connect_left(node)\n\t\tleft_node = @nodes[node.y][node.x - 1] unless node.x == 0\n\t\tnode.add_adjacent(left_node)\n\tend", "title": "" }, { "docid": "f0312c3ab4beb452ebded9947ef63755", "score": "0.6134841", "text": "def connect_via(edge)\n if edge.to == self && ! slots.in.include?(edge.label)\n slots.in.add(edge.label)\n end\n\n if edge.from == self && ! slots.out.include?(edge.label)\n slots.out.add(edge.label)\n end\n\n super\n end", "title": "" }, { "docid": "fdfa05fd1cf6d7e50542ba1fb0531dc9", "score": "0.612535", "text": "def connect_to_node!(other_node, relation)\n @connections << ::Rbt::QueryTree::Connection.new(self, other_node, relation)\n end", "title": "" }, { "docid": "f3699833ed0bcbc4511e7144c4d63153", "score": "0.6116371", "text": "def connect_below(node)\n\t\tbelow_node = @nodes[node.y + 1][node.x] unless node.y + 1 == @nodes.size\n\t\tnode.add_adjacent(below_node)\n\tend", "title": "" }, { "docid": "2e406f559b77d02bbe8f9b7ffb8aeb09", "score": "0.61036783", "text": "def connect(room)\n \n temp=Set.new([room])\n \n #Nil arr = false\n if !@@adjToRoom[self.number-1]\n @@adjToRoom[self.number-1]=temp\n #Add connectivity to reciprocal list \n connectBiDirectional(self,room)\n else \n @@adjToRoom[self.number-1].add(room) \n connectBiDirectional(self,room)\n end \n end", "title": "" }, { "docid": "7712102a2c29e8d8c0ab66c5a14d856f", "score": "0.61016613", "text": "def direct_connect!\n models = @model.each_child.to_a\n children_list = []\n new_internal_couplings = Hash.new { |h, k| h[k] = [] }\n\n i = 0\n while i < models.size\n model = models[i]\n if model.coupled?\n # get internal couplings between atomics that we can reuse as-is in the root model\n model.each_internal_coupling do |src, dst|\n if src.host.atomic? && dst.host.atomic?\n new_internal_couplings[src] << dst\n end\n end\n model.each_child { |c| models << c }\n else\n children_list << model\n end\n i += 1\n end\n\n cm = @model\n cm.each_child.each { |c| cm.remove_child(c) }\n children_list.each { |c| cm << c }\n\n find_direct_couplings(cm) do |src, dst|\n new_internal_couplings[src] << dst\n end\n\n internal_couplings = cm.instance_variable_get(:@internal_couplings).clear\n internal_couplings.merge!(new_internal_couplings)\n end", "title": "" }, { "docid": "ef9dabf216bb7ca452f0ac5f82eeec76", "score": "0.6101517", "text": "def connect(src, dst, length = 1)\n\t\tself.push( src ) unless self.include?( src )\n\t\tself.push( dst ) unless self.include?( dst )\n\t\[email protected] Edge.new(src, dst, length)\n\tend", "title": "" }, { "docid": "d7f0b6552e506ff82f45b6b6a3365743", "score": "0.6090883", "text": "def show_connections\n stroke(0, 150)\n stroke_weight(2)\n nodes[0..nodes.size - 2].each_with_index do |pi, i|\n nodes[i + 1..nodes.size - 1].each do |pj|\n line(pi.x, pi.y, pj.x, pj.y)\n end\n end\n end", "title": "" }, { "docid": "fa38ac899d649cf3ac586be58b9fda53", "score": "0.60722715", "text": "def link_(a, nodes, b)\n if nodes.empty?\n if a.nil?\n @first = b\n else\n a.instance_variable_set(:@next, b)\n end\n if b.nil?\n @last = a\n else\n b.instance_variable_set(:@prev, a)\n end\n else\n # connect `a' and `b'\n first = nodes.first\n if a.nil?\n @first = first\n else\n a.instance_variable_set(:@next, first)\n end\n last = nodes.last\n if b.nil?\n @last = last\n else\n b.instance_variable_set(:@prev, last)\n end\n\n # connect `nodes'\n if nodes.length == 1\n node = nodes[0]\n node.instance_variable_set(:@prev, a)\n node.instance_variable_set(:@next, b)\n else\n first.instance_variable_set(:@next, nodes[ 1])\n first.instance_variable_set(:@prev, a)\n last. instance_variable_set(:@prev, nodes[-2])\n last. instance_variable_set(:@next, b)\n (1...nodes.length-1).each do |i|\n n = nodes[i]\n n.instance_variable_set(:@prev, nodes[i-1])\n n.instance_variable_set(:@next, nodes[i+1])\n end\n end\n end\n end", "title": "" }, { "docid": "de8831fbf74a7b939e7b2866ad42bbaa", "score": "0.6057242", "text": "def connect_to(other)\n if other.row == self.row - 1\n self.neighbors[:north] = other\n other.neighbors[:south] = self\n elsif other.row == self.row + 1\n self.neighbors[:south] = other\n other.neighbors[:north] = self\n elsif other.col == self.col + 1\n self.neighbors[:east] = other\n other.neighbors[:west] = self\n elsif other.col == self.col - 1\n self.neighbors[:west] = other\n other.neighbors[:east] = self\n end\n end", "title": "" }, { "docid": "7295a2249c7e33dc7f256659d03930be", "score": "0.60572374", "text": "def link(root_x, root_y)\n root_x.sibling = root_y.child\n root_y.child = root_x\n root_y.rank += 1\n end", "title": "" }, { "docid": "104598181aea7601b18da2a6ca8ac5fb", "score": "0.604701", "text": "def generate_parent_connections(node)\n l = node.layer\n # For each parent node...\n loop_over_nodes(l - 1) do |i|\n parent = layer_n_nodes(l - 1)[i]\n # Generate a random connection weight between -1 and 1\n weight = rand * 2 - 1\n Connection.create(parent_id: parent.id,\n child_id: node.id,\n weight: weight.round(3))\n end\n end", "title": "" }, { "docid": "c7f946e93db2ca82b7700adc0df6ddc1", "score": "0.6043542", "text": "def connect!(&block); end", "title": "" }, { "docid": "749729651c225581e8ba20102ee5fed2", "score": "0.60420114", "text": "def link(x, y)\n x.child = insert_list(y, x.child)\n x.rank += 1\n end", "title": "" }, { "docid": "385e8c538a0f11c76b216c708c1850b0", "score": "0.60411924", "text": "def make_link(from, to)\n @nodes[from] << to\n @inverse_nodes[to] << from\n end", "title": "" }, { "docid": "1007e3c65ec7e03ffce6a65db71f37b0", "score": "0.60206944", "text": "def in_connect(other)\n\t\tif other.respond_to? :each\n\t\t\tbegin\n\t\t\t\tother.each { |x| self << x }\n\t\t\trescue StopIteration\n\t\t\tend\n\t\t\tclose\n\t\telsif other.respond_to? :to_trans\n\t\t\tother.to_trans.out_connect(self)\n\t\tend\n\tend", "title": "" }, { "docid": "e1bef419105f314885a1f74d0f96f4c0", "score": "0.60126776", "text": "def addConnection node\n\t\t@connections[node.name] = [1,node]\n\tend", "title": "" }, { "docid": "0f25f63a10875ef14fde3c5b792e0cf7", "score": "0.6007904", "text": "def connect_to(other)\n edges = [ \"#{id} -> #{other.id}\" ]\n\n # Connect last (inner-most) child node with invisible edge so the graph is well aligned.\n # It ensures each node is drawn on a separate \"level\" and the graph is \"flat\". Without\n # it clusters would end up at the same row as the following node.\n if @children.any?\n edges << \"#{self.last_child.id} -> #{other.id} [style=invis]\"\n end\n\n edges\n end", "title": "" }, { "docid": "46623851c4911fc7c110c2244f535a3a", "score": "0.6002355", "text": "def link_nx\n return if @ignore_nx_link\n @pre_nx.each {|i, *args| nx_add(*yield(i, *args)) }\n @pre_nx = nil\n end", "title": "" }, { "docid": "82fc0fd4d969d214127e89119330a4d2", "score": "0.5999413", "text": "def nodes\n left_nodes + [self] + right_nodes\n end", "title": "" }, { "docid": "2a8894f9f87985e52a8e20c730416237", "score": "0.5996806", "text": "def connect(*) end", "title": "" }, { "docid": "ab2ff797a9a2d4fc7ad071b5939ab3f9", "score": "0.5995011", "text": "def setup_links(nodes)\n super\n @attributes['links'].keys.each do |name|\n spawn(\"ip link set #{name} master br0\")\n end\n end", "title": "" }, { "docid": "cea096d60881f1b558ea216cdac8c564", "score": "0.59737015", "text": "def connect_all_vertices\n while number_of_orphans > 0\n vertex_orphan = orphans.shuffle.first\n while vertex_orphan == (random_vertex = rand(order)); end\n\n add_edge vertex_orphan, random_vertex\n end\n end", "title": "" }, { "docid": "cd2f1303bf93985db8ffbb3675d19010", "score": "0.59709346", "text": "def connection \n m = @table.vertices.map do |element|\n element= posible_moves(element)\n end \n end", "title": "" }, { "docid": "113289d3842fcaa1046111768485a0f5", "score": "0.59577", "text": "def arrange_nodes(nodes); end", "title": "" }, { "docid": "d7da647e6b478e7503308ea34ec62a58", "score": "0.5957633", "text": "def each_node_with_connections(order)\n edges.at_order(order).sources.each do |node|\n yield(node)\n end\n end", "title": "" }, { "docid": "d141ba47fae576e9b6b541835515f1ec", "score": "0.59542584", "text": "def connect(population_index1, population_index2)\n if population_index1 == population_index2\n return\n end\n add_edge(population_index1, population_index2)\n add_edge(population_index2, population_index1)\n reset_topological_metrics\n end", "title": "" }, { "docid": "954fb6fa1f55e0bb6176a6a3defa64f0", "score": "0.59533894", "text": "def connect(node, levels = [], current_level = 0)\n return unless node\n\n if levels[current_level]\n node.next = levels[current_level]\n end\n\n levels[current_level] = node\n\n connect(node.right, levels, current_level + 1)\n connect(node.left, levels, current_level + 1)\n\n node\nend", "title": "" }, { "docid": "ffa34ac3f7e6b1a09273e5bb9a243185", "score": "0.59362", "text": "def add from, to\n @nodes << from unless @nodes.include?(from)\n @nodes << to unless @nodes.include?(to)\n @follow_links[from] ||= []\n @follow_links[from] << to\n @back_links[to] ||= []\n @back_links[to] << from\n end", "title": "" }, { "docid": "f79d43c35103527878597f2fc49fa621", "score": "0.59300745", "text": "def connect(from, to, type, label = T.unsafe(nil)); end", "title": "" }, { "docid": "2926858198c9c40314d375c564d98295", "score": "0.59272844", "text": "def connect(from:, to:, weight: 0.5)\n c = Connection.new(from, to, weight)\n from.join(c)\n # Also add them to the network\n connections << c\n end", "title": "" }, { "docid": "4c634bd9048b53fce408a982978853d7", "score": "0.5923095", "text": "def initialize_edges\n @town_names.each do |name|\n @town_connections[name].each do |neighbor_name|\n @graph[name].connect @graph[neighbor_name]\n end\n end\n end", "title": "" }, { "docid": "4c34aa948c47eee2b8a3166af24da2f4", "score": "0.5919391", "text": "def connect_nevada_with_other(cities)\n cities[0].connect cities[1]\n end", "title": "" }, { "docid": "dfd2990e64a2949038e64602609e8dec", "score": "0.5914787", "text": "def connect_nodes_if_complete(node)\n return if node.nil?\n\n if node.left\n node.left.next = node.right\n end\n \n if node.right\n node.right.next = node.next.nil? ? nil : node.next.left\n end\n\n connect_nodes_if_complete(node.left) \n connect_nodes_if_complete(node.right)\nend", "title": "" }, { "docid": "7c43a9bef03aa76b7b112d0d7a332daf", "score": "0.5910108", "text": "def connect(from_thing, to_thing, label, properties = {})\n from = fetch_or_create_node(from_thing)\n to = fetch_or_create_node(to_thing)\n\n from.connect_to(to, label, properties)\n end", "title": "" }, { "docid": "3c373457c4c7ccb6f3ff7eb72d92af85", "score": "0.58886874", "text": "def connect_setup\n\t\t\t\tzk.mkdir_p @base_path\n\t\t\t\t@node_path = zk.create \"#{@base_path}/#{NODE_PREFIX}\", @last_known_address, :sequence => true, :ephemeral => true\n\t\t\t\t@nodes = zk.children @base_path, :watch => true\n\t\t\tend", "title": "" }, { "docid": "2b4b38d9e578d5529f82f0dda310fd58", "score": "0.5876375", "text": "def make_connection(v1, v2)\n raise \"already connected\" if is_connected?(v1, v2)\n # Connect the two using the vertex method \"connect\"\n edge = v1.connect(v2)\n # Add to edge catalog\n @edges << edge\n edge\n end", "title": "" }, { "docid": "4f34db36c662281e392869ca7451d6fd", "score": "0.58657444", "text": "def advance_n_nodes()\nend", "title": "" }, { "docid": "a1d92bbc4f8e26fa4be4b4e389cf1015", "score": "0.58650196", "text": "def each_node\n\t\tnode = @head\n\t\twhile !node.nil?\n\t\t\tyield node\n\t\t\tnode = node.link_to\n\t\tend\n\tend", "title": "" }, { "docid": "dc1c96c846afb2e151f5b80e583d68ad", "score": "0.5861131", "text": "def connect(other_node, relationship_properties = nil)\n rel = @storage.create_relationship_to(other_node, @dir)\n rel.attributes = relationship_properties if relationship_properties\n rel\n end", "title": "" }, { "docid": "210a13b8601762e11485873bca0a1690", "score": "0.58557785", "text": "def forward_pass(sorted_nodes)\n sorted_nodes.each(&:forward)\nend", "title": "" }, { "docid": "a1fa34c15a7853f7cb391827f0410181", "score": "0.5855311", "text": "def add_connection_edge node1_id, edge_label_id, node2_id, color\n\t\t\tline1_id = create_unique_id\n\t\t\tline2_id = create_unique_id\n\n\t\t\tadd_connection line1_id, node1_id, edge_label_id\n\t\t\tadd_connection line2_id, edge_label_id, node2_id\n\t\t\tadd_connection_appearance line1_id, color\n\t\t\tadd_connection_appearance line2_id, color\n\t\tend", "title": "" }, { "docid": "0aa95c41d749f378f6338c60fa1f4f95", "score": "0.5845302", "text": "def rebindNodesLinksById()\n @nodeList.each{|node|\n node.rebindLinksById(self) ;\n }\n @linkList.each{|link|\n link.rebindNodesById(self) ;\n }\n self ;\n end", "title": "" }, { "docid": "c9d9b12027a894a3dd7029697973bfb0", "score": "0.5845289", "text": "def connect(a, b, weight = 0.5)\n c = Connection.new(a, b, weight)\n a.join(c)\n # Also add them to the network\n connections << c\n end", "title": "" }, { "docid": "d8c8325ba7ba91330faf8a07f3d8d7a6", "score": "0.5843956", "text": "def addLinks()\n @relations.each_pair do |src, trgs|\n trgs.each { |trg|\n @graph.add_edges( @nodes_map[trg], @nodes_map[src] )\n }\n end\n end", "title": "" }, { "docid": "05abc009c50ff979e4f776e6d3c2d408", "score": "0.58351684", "text": "def connect(output, input)\n valid?(output, input)\n\n @connections[output.guid] ||= []\n @connections[output.guid] << input.guid unless connected?(output, input)\n notifications.trigger(\"graph.node.connect\", {\n input: input.guid,\n output: output.guid\n })\n end", "title": "" }, { "docid": "520e6de95ddf1a341e9b3e7d41b95b15", "score": "0.583382", "text": "def connections\n followers & following\n end", "title": "" }, { "docid": "871d6e3bcd5a67c5e0142ebf8c333307", "score": "0.5827575", "text": "def connect options\n left_opts = options.shift\n right_opts= options.shift\n\n add_connection( @left, @right, left_opts )\n add_connection( @left, @right, right_opts )\n end", "title": "" }, { "docid": "8e9e1e431c0bfa8a62e3e7cbc0a73766", "score": "0.5812664", "text": "def connect_midas_with_other(cities)\n cities[5].connect cities[3]\n cities[5].connect cities[6]\n end", "title": "" }, { "docid": "e9f857c528b202d732194d0fd9d93022", "score": "0.58114946", "text": "def setup\n Netgen.log_info(\"netgen: setting up nodes\")\n @nodes.values.each(&:setup)\n Netgen.log_info(\"netgen: creating links\")\n @nodes.values.each do |node|\n node.setup_links(@nodes)\n end\n end", "title": "" }, { "docid": "43a57aab8b105cbcee53400a87ef29e4", "score": "0.5800755", "text": "def add_nodes(t)\n new_nodes = []\n t.times do\n n = Node.new\n #ds_init(n)\n @disjoint.add(n.id)\n @nodelist[n.id] = n\n @nodelist_a << n\n new_nodes << n\n \n end\n new_nodes\n end", "title": "" }, { "docid": "0d2877f9ce5222ccd80a53d73be81eab", "score": "0.5799585", "text": "def create_graph(arr)\n nodes = []\n (0...arr.size).each do |i|\n node = Node.new(i)\n nodes.push(node)\n end\n nodes.each_with_index do |node,i|\n arr[i].each {|val| node.connections.push(nodes[val])} \n end\n nodes\nend", "title": "" }, { "docid": "0d2877f9ce5222ccd80a53d73be81eab", "score": "0.5799585", "text": "def create_graph(arr)\n nodes = []\n (0...arr.size).each do |i|\n node = Node.new(i)\n nodes.push(node)\n end\n nodes.each_with_index do |node,i|\n arr[i].each {|val| node.connections.push(nodes[val])} \n end\n nodes\nend", "title": "" }, { "docid": "092ca21d07d56f1ab45aa1ec5629a793", "score": "0.5799575", "text": "def test_auto_simple_cross\n a = Node.create!\n b = Node.create!\n c = Node.create!\n e = Default.connect(a,b)\n e2 = Default.connect(b,c)\n indirect = Default.find_link(a,c)\n assert !indirect.nil?\n assert !indirect.direct?\n assert_equal 1, indirect.count\n assert_equal a, indirect.ancestor\n assert_equal c, indirect.descendant \n end", "title": "" }, { "docid": "f730819e4b3ac4866dae64f29185b62f", "score": "0.5797859", "text": "def adjacent_nodes_and_self\n adjacent_nodes.push(self)\n end", "title": "" }, { "docid": "a957f276fc2314e699b5816a36ef6534", "score": "0.5794679", "text": "def link_to other_node\n @links << other_node\n end", "title": "" }, { "docid": "bec5eae93149454f37d0cb9ef78f64fa", "score": "0.5787507", "text": "def expand_on_endpoints\n nodes_at_the_beginning = (@game_map.connections_to @nodes.first) - @nodes\n nodes_at_the_end = (@game_map.connections_to @nodes.last) - @nodes\n\n\n nodes_at_the_beginning.map { |n| self.class.new([n] + @nodes, @game_map) } +\\\n nodes_at_the_end.map { |n| self.class.new(@nodes + [n], @game_map) }\n end", "title": "" }, { "docid": "aaade5be26b0d4384234d2103e850401", "score": "0.5780293", "text": "def update_nodes\n i = 0\n\n @ary.each do |node|\n i += 1\n\n if @ary[i].nil?\n node.set_next_node(nil)\n else\n node.set_next_node(@ary[i].value) \n end\n\n end\n end", "title": "" }, { "docid": "8bf5d129fdb43f239c000f6d71bf37a4", "score": "0.5771185", "text": "def createConnections items\n\t\tavgConnection = nil\n\t\titems = items.uniq\n\t\titems.each do |item|\n\t\t\tif !nodeExists(item)\n\t\t\t\tnewNode(item)\n\t\t\tend\n\t\tend\n\n\t\titems.combination(2) do |pair|\n\t\t\t# exstablish a connection if none\n\t\t\t# assuming a connection is there increment the strength\n\t\t\t# if needed set the strongest connection variable\n\t\t\tif @nodes[pair[0]].isConnected(pair[1])\n\t\t\t\tincrement = @nodes[pair[0]].getConnectionStr(pair[1]) + 1\n\t\t\t\tif increment > @strongestConnection\n\t\t\t\t\t@strongestConnection = increment\n\t\t\t\tend\n\t\t\t\t@nodes[pair[0]].changeConnectionStr(pair[1],increment)\n\t\t\telse\n\t\t\t\t@nodes[pair[0]].addConnection(pair[1])\n\t\t\tend\n\n\t\t\tif @nodes[pair[1]].isConnected(pair[0])\n\t\t\t\tincrement = @nodes[pair[1]].getConnectionStr(pair[0]) + 1\n\t\t\t\tif increment > @strongestConnection\n\t\t\t\t\t@strongestConnection = increment\n\t\t\t\tend\n\t\t\t\t@nodes[pair[1]].changeConnectionStr(pair[0],increment)\n\t\t\telse\n\t\t\t\t@nodes[pair[1]].addConnection(pair[0])\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "cedda27b907ab3c2a28eb0c0159d6e5f", "score": "0.5770968", "text": "def test_manual_connect_lonely_edge\n a = Node.create!\n b = Node.create!\n e = Default.connect!(a,b)\n e2 = Default.find_edge(a,b)\n assert e2.direct?\n assert_equal 1, e2.count\n assert_equal e,e2\n assert_equal e2.ancestor, a\n assert_equal e2.descendant, b\n end", "title": "" }, { "docid": "4c1ee4278da9583385f262985ba614f2", "score": "0.5770126", "text": "def link_nodes(child, parent)\n # link the child's siblings\n child.left.right = child.right\n child.right.left = child.left\n\n child.parent = parent\n \n # if parent doesn't have children, make new child its only child\n if parent.child.nil?\n parent.child = child.right = child.left = child\n else # otherwise insert new child into parent's children list\n current_child = parent.child\n child.left = current_child\n child.right = current_child.right\n current_child.right.left = child\n current_child.right = child\n end\n parent.degree += 1\n child.marked = false\n end", "title": "" }, { "docid": "aff78ed90194c4a50556df95b2be6ee9", "score": "0.5769756", "text": "def set_up_edges_directed(parsed, vertices)\n parsed['routes'].each do |route|\n ports = route['ports'] # array with 2 metro codes\n distance = route['distance']\n code_1 = ports[0].to_sym\n code_2 = ports[1].to_sym\n\n # create directed edge from port 1 to port 2\n to_port_2 = Edge.new(vertices[code_2], distance)\n\n # add edge to the vertex corresponding to code_1\n vertices[code_1].add_destination(to_port_2)\n end\n end", "title": "" }, { "docid": "1ec92c14987797ba833a8b6605bbff18", "score": "0.5767216", "text": "def connections\n @incoming + @outgoing\n end", "title": "" }, { "docid": "1a7e79a5899150d08157cb2cf1c8f55b", "score": "0.57617974", "text": "def connect(node, type = node.class.root_class)\n rtype = org.neo4j.graphdb.DynamicRelationshipType.withName(type.to_s)\n @_java_node.createRelationshipTo(node._java_node, rtype)\n nil\n end", "title": "" }, { "docid": "269099a0443d0e95a916aa9a5cd0da55", "score": "0.57486904", "text": "def merge_nodes\n # Map original column name to a set of merged names\n column_map = Hash.new { |h, k| h[k] = Set.new }\n pairs = bidirectional_relationships\n pairs.each do |pair|\n merged = column_map[pair.first]\n merged.merge(pair)\n merged.merge(column_map[pair.last])\n column_map[pair.last] = merged\n end\n\n # Materialize the merged groups into actual nodes in the graph\n seen = Set.new\n column_map.values.each do |group|\n group = group.to_a.sort\n next if seen.include?(group)\n seen << group\n\n descendants = Set.new\n parents = Set.new\n group.each do |member|\n descendants += @graph.adjacent_vertices(member)\n parents += get_incoming_relationships(member).map(&:c1)\n end\n\n descendants -= group\n parents -= group\n merged_name = @relationship_manager.merge_nodes(group)\n\n @graph.add_vertex(merged_name)\n @merged_columns += group\n\n # Update links in/out\n descendants.each do |descendant|\n rel = @relationship_manager.make_merged_relationship(group, descendant)\n add_relationship(rel)\n end\n parents.each do |parent|\n rel = @relationship_manager.make_merged_relationship(parent, group)\n add_relationship(rel)\n end\n end\n\n pairs.flatten.uniq.each do |node|\n @graph.remove_vertex(node)\n end\n end", "title": "" }, { "docid": "905aebbc22bcbb75b3aab460bec0e18e", "score": "0.5739825", "text": "def each_connection\n syn = self.first_post_synapse\n while syn\n yield syn\n syn = syn.next_post_synapse\n end\n end", "title": "" }, { "docid": "5aead0e55687031bf01c3586c0992eaa", "score": "0.5737819", "text": "def connect_all\n @connect_strategy.connect(self)\n end", "title": "" }, { "docid": "fb3b1652b69930440710e401711a4e21", "score": "0.57295513", "text": "def << (othernode) \n return othernode.edge(self, true) \n end", "title": "" }, { "docid": "3202d075ac8d1a012d2d53055809fbdb", "score": "0.5727777", "text": "def tree_connect(share)\n connected_tree = if smb2 || smb3\n smb2_tree_connect(share)\n else\n smb1_tree_connect(share)\n end\n @tree_connects << connected_tree\n connected_tree\n end", "title": "" } ]
c3ea417ed801c95f5dac7427899508dd
Same as Azure::Armrest::ResourceServicelist but returns all resources for all resource groups. Normally this is capped at 1000 results, but you may specify the :all option to get everything.
[ { "docid": "9a524b9d91ec71e09efd1fed677beebe", "score": "0.7100854", "text": "def list_all(options = {})\n url = build_url(nil, options)\n response = rest_get(url)\n\n if options[:all]\n get_all_results(response)\n else\n Azure::Armrest::ArmrestCollection.create_from_response(response, Azure::Armrest::Resource)\n end\n end", "title": "" } ]
[ { "docid": "5a4080142d45680c32c6745e636233b9", "score": "0.7505827", "text": "def list(resource_group, options = {})\n url = build_url(resource_group, options)\n response = rest_get(url)\n\n if options[:all]\n get_all_results(response)\n else\n Azure::Armrest::ArmrestCollection.create_from_response(response, Azure::Armrest::Resource)\n end\n end", "title": "" }, { "docid": "312f8b038a4b9b0ec9228e59ff50de5e", "score": "0.749495", "text": "def list(options = {})\n url = build_url\n url << \"&$top=#{options[:top]}\" if options[:top]\n url << \"&$filter=#{options[:filter]}\" if options[:filter]\n\n response = rest_get(url)\n Azure::Armrest::ArmrestCollection.create_from_response(response, Azure::Armrest::ResourceGroup)\n end", "title": "" }, { "docid": "41c91366de3d98c3d6ea267555a29e53", "score": "0.7180622", "text": "def resourcegroups\n result = @http.get('/resourcegroups')\n result[1]\n end", "title": "" }, { "docid": "d9685c37f58d7dbd7aec62964af748b5", "score": "0.70665616", "text": "def list_all\n arr = []\n thr = []\n\n subscriptions.each do |sub|\n sub_id = sub['subscriptionId']\n resource_groups(sub_id).each do |group|\n @api_version = '2014-06-01'\n url = build_url(sub_id, group['name'])\n\n thr << Thread.new{\n res = JSON.parse(rest_get(url))['value'].first\n arr << res if res\n }\n end\n end\n\n thr.each{ |t| t.join }\n\n arr\n end", "title": "" }, { "docid": "93e5d599513ecab7b32d7c631a06e033", "score": "0.7062015", "text": "def resource_groups\n refs = references(:resource_groups)\n\n return [] if refs.blank?\n\n refs = refs.map { |x| File.basename(x) }.uniq\n\n @resource_groups ||= if refs.size > record_limit\n set = Set.new(refs)\n collect_inventory(:resource_groups) { @rgs.list(:all => true) }.select do |resource_group|\n set.include?(File.basename(resource_group.id.downcase))\n end\n else\n collect_inventory_targeted(:resource_groups) do\n filter_my_region_parallel_map(refs) do |ref|\n safe_targeted_request { @rgs.get(ref) }\n end\n end\n end\n rescue ::Azure::Armrest::Exception => err\n _log.error(\"Error Class=#{err.class.name}, Message=#{err.message}\")\n []\n end", "title": "" }, { "docid": "8fc03a82fe35b059721b6d5b75c08d5d", "score": "0.70535725", "text": "def list(group = @resource_group)\n set_default_subscription\n\n if group\n @api_version = '2014-06-01'\n url = build_url(@subscription_id, group)\n JSON.parse(rest_get(url))['value'].first\n else\n arr = []\n thr = []\n\n resource_groups.each do |group|\n @api_version = '2014-06-01' # Must be set after resource_groups call\n url = build_url(@subscription_id, group['name'])\n\n thr << Thread.new{\n res = JSON.parse(rest_get(url))['value'].first\n arr << res if res\n }\n end\n\n thr.each{ |t| t.join }\n\n arr\n end\n end", "title": "" }, { "docid": "e46caccdc09bb47d75098826a5e1b2b0", "score": "0.7032124", "text": "def resource_groups\n @client.resource_groups.list\n end", "title": "" }, { "docid": "4e079514b3228b972fd07b128339d4d6", "score": "0.69836414", "text": "def index\n @resource_groups = ResourceGroup.all\n end", "title": "" }, { "docid": "c1787e713d1932b495f41760d214e873", "score": "0.6561361", "text": "def resource_groups\n return @resource_groups unless @resource_groups.nil?\n\n refs = references(:resource_groups) || []\n @resource_groups = refs.map { |ems_ref| resource_group(ems_ref) }.compact\n end", "title": "" }, { "docid": "c28fc0203615b78e9a0c56d21009d403", "score": "0.64908844", "text": "def all\n describe(resource_uri)\n end", "title": "" }, { "docid": "4e981419dc995192abe58dab08b0f796", "score": "0.6445122", "text": "def resource_all(stack)\n all_result_pages(nil, :body,\n \"ListStackResourcesResponse\", \"ListStackResourcesResult\",\n \"StackResourceSummaries\", \"member\") do |options|\n request(\n :method => :post,\n :path => \"/\",\n :form => options.merge(\n Smash.new(\n \"Action\" => \"ListStackResources\",\n \"StackName\" => stack.id,\n )\n ),\n )\n end.map do |res|\n Stack::Resource.new(\n stack,\n :id => res[\"PhysicalResourceId\"],\n :name => res[\"LogicalResourceId\"],\n :logical_id => res[\"LogicalResourceId\"],\n :type => res[\"ResourceType\"],\n :state => res[\"ResourceStatus\"].downcase.to_sym,\n :status => res[\"ResourceStatus\"],\n :updated => res[\"LastUpdatedTimestamp\"],\n ).valid_state\n end\n end", "title": "" }, { "docid": "eb13094ce022d3cba62bf4e55188a97a", "score": "0.643028", "text": "def get_resource_group_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourceApi.get_resource_group_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/resource/Groups'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceGroupResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"ResourceApi.get_resource_group_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourceApi#get_resource_group_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "c5e2787e9579dee3f3608eefce5650a7", "score": "0.6387905", "text": "def all\n setup_request \"#{@@resource_url}s\"\n end", "title": "" }, { "docid": "80b2c28a21985e927662159441196810", "score": "0.6296003", "text": "def crud_get_all(resource_name, service_name, api_options = {})\n api_options = get_defaults(api_options)\n get '/'+resource_name do\n service = settings.send(service_name)\n\n sanitize_params(params)\n # Check query validity\n return 400 unless service.valid_query?(params)\n\n # Return Regions on Query\n JSON.fast_generate service.get_all_by_query(params)\n end\n end", "title": "" }, { "docid": "0dfa10578d7080af53691c237856e23f", "score": "0.61382335", "text": "def all_resources\n @run_context && @run_context.resource_collection.all_resources\n end", "title": "" }, { "docid": "ccded4301ad11eb00e5c507bc977d408", "score": "0.61290467", "text": "def resource_all(stack)\n result = request(\n :method => :get,\n :path => \"/stacks/#{stack.name}/#{stack.id}/resources\",\n :expects => 200\n )\n result.fetch(:body, :resources, []).map do |resource|\n Stack::Resource.new(\n stack,\n :id => resource[:physical_resource_id],\n :name => resource[:resource_name],\n :type => resource[:resource_type],\n :logical_id => resource[:logical_resource_id],\n :state => resource[:resource_status].downcase.to_sym,\n :status => resource[:resource_status],\n :status_reason => resource[:resource_status_reason],\n :updated => Time.parse(resource[:updated_time])\n ).valid_state\n end\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.6061751", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.6061751", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.6061751", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.6061751", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.6061751", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.6061751", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.6061751", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.6061751", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.6061751", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.6061751", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "6a52580ff6cbfe9e7253a1a6968c8f67", "score": "0.6061005", "text": "def list_resources\n resources = []\n addr = create_address(:sliceID => @@sliceID, :domain => @@domain)\n resource_prefix = \"#{addr.generate_address}/\"\n nodes = list_nodes(@@domain)\n nodes.each{|node|\n next if !node.include?(resource_prefix)\n node.slice!(resource_prefix)\n resources << node if !node.empty?\n }\n resources\n end", "title": "" }, { "docid": "3009b971f07ce032bc0a7870dd1bbcb4", "score": "0.60538095", "text": "def resource_all(stack)\n raise NotImplementedError\n end", "title": "" }, { "docid": "c36802528d30af4f684ba75984b4a95c", "score": "0.6052409", "text": "def resources\n nodeset = query_root_node(\"gdacs:resources/gdacs:resource\", @@NAMESPACES)\n @items = []\n if !nodeset.nil?\n nodeset.each do |item|\n item_obj = SemanticCrawler::Gdacs::Resource.new(item)\n @items << item_obj\n end\n end\n @items\n end", "title": "" }, { "docid": "62a45886735144f07a00f97d72427f36", "score": "0.60383564", "text": "def index\n @service_groups = ServiceGroup.all\n end", "title": "" }, { "docid": "9a088ba004e8ae920e887f0fe240f430", "score": "0.6010909", "text": "def all\n @service.all\n end", "title": "" }, { "docid": "a85264ba96d8d387fa275da0bc55f432", "score": "0.59618753", "text": "def index\n @api_v1_resources = Api::V1::Resource.all\n end", "title": "" }, { "docid": "0e72ebdf1b73c2d09023823e8ceb2113", "score": "0.59617317", "text": "def list(abs_url = nil)\n @ro_resource_mixin.list(abs_url)\n end", "title": "" }, { "docid": "47f4d7c515780c9ee041f6420fd1ba18", "score": "0.5906322", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::ResourceListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"Resources.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.resources.each do |plumbing_item|\n g.yield Plumbing::convert_resource_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "title": "" }, { "docid": "cf2419a4597a540a5d8f5ae20a00ead7", "score": "0.5899711", "text": "def resource_list\n self.resources\n end", "title": "" }, { "docid": "033ae4e1b0794bef80d7a613a4232e5c", "score": "0.5877511", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::PeeringGroupResourceListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"PeeringGroupResources.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.peering_group_resources.each do |plumbing_item|\n g.yield Plumbing::convert_peering_group_resource_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "title": "" }, { "docid": "3804c72dc327602d5ba4293c9ea310c1", "score": "0.58767474", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::AccountResourceListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"AccountResources.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.account_resources.each do |plumbing_item|\n g.yield Plumbing::convert_account_resource_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "title": "" }, { "docid": "27a9f26f7b8306f6b0adbeb50028e90c", "score": "0.587347", "text": "def all\n data = service.list_flags.to_h[:items] || []\n load(data)\n end", "title": "" }, { "docid": "605e2e951e8d57b34abe1793bd331681", "score": "0.5855623", "text": "def resource_all(stack)\n request(\n :path => \"global/deployments/#{stack.name}/resources\"\n ).fetch('body', 'resources', []).map do |resource|\n Stack::Resource.new(stack,\n :id => resource[:id],\n :type => resource[:type],\n :name => resource[:name],\n :logical_id => resource[:name],\n :created => Time.parse(resource[:insertTime]),\n :updated => resource[:updateTime] ? Time.parse(resource[:updateTime]) : nil,\n :state => :create_complete,\n :status => 'OK',\n :status_reason => resource.fetch(:warnings, []).map{|w| w[:message]}.join(' ')\n ).valid_state\n end\n end", "title": "" }, { "docid": "cb8aa16905310d8afb267d2caf71a52d", "score": "0.585239", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n return @peering_group_resources.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "title": "" }, { "docid": "b4d31af56212fb51442b2255b9c88103", "score": "0.58391", "text": "def all(params = {})\n response = http_get(resource_url, params)\n format_object(response, TYPE)\n end", "title": "" }, { "docid": "825ebe0f4be267caaa88da12b42ba0ca", "score": "0.58264965", "text": "def all\n results_from(response)\n end", "title": "" }, { "docid": "6898bcbfa5e824c7609c1da62e2aba46", "score": "0.5825164", "text": "def get_all(which=:groups, options={})\n resp = self.class.get(\"/#{which}\", { :query => options })\n check_errors resp\n rebuild_xml_array!(resp.parsed_response['Response'], 'Entries', 'Entry')\n res = resp.parsed_response['Response']['Entries']\n if which == :contacts\n res.each { |c| rebuild_groups! c }\n end\n res\n end", "title": "" }, { "docid": "d4fe6f7b833101d0a28bc6f7bb4f66ea", "score": "0.57911545", "text": "def all\n api_get(path)\n end", "title": "" }, { "docid": "d10d1675a0b7a1afb488c560e0645797", "score": "0.57866156", "text": "def all(options = {})\n #assert_kind_of 'options', options, Hash\n query = { :name => nil }.merge!(options).merge!(:id => nil)\n result = mqlread([ query ], :cursor => !options[:limit]) \n Basuco::Collection.new(result.map { |r| Basuco::Resource.new(r) })\n end", "title": "" }, { "docid": "7a79ace5200cf6743a55737141a76d43", "score": "0.5780853", "text": "def all(options = {})\n data = service.list_monitored_resource_descriptors(options).body[\"resourceDescriptors\"] || []\n load(data)\n end", "title": "" }, { "docid": "57bc2c30335db46d47e0f329f0573740", "score": "0.57704705", "text": "def index\n @resource_group_machines = ResourceGroupMachine.all\n end", "title": "" }, { "docid": "f3c265fbd549758a31185cff773b2e4f", "score": "0.5770411", "text": "def get_all\n raise UnsupportedOperation\n end", "title": "" }, { "docid": "708a57c5ef74ad9f600e9b69e0a6183e", "score": "0.57430816", "text": "def list(resource_type,limit=0,params={})\n path = '/api/' + resource_type.to_s\n params.merge!({limit: limit.to_s})\n response = http_get(path,params)\n hydrate_list(resource_type, response['objects'])\n end", "title": "" }, { "docid": "356861a05140e29bd2a08502447293f7", "score": "0.5706491", "text": "def list_resources(options)\n #debug \"options = \" + options.inspect\n body, format = parse_body(options)\n params = body[:options]\n #debug \"Body & Format = \", opts.inspect + \", \" + format.inspect\n\n debug 'ListResources: Options: ', params.inspect\n\n only_available = params[:only_available]\n slice_urn = params[:slice_urn]\n\n authorizer = options[:req].session[:authorizer]\n # debug \"!!!authorizer = \" + authorizer.inspect\n\n debug \"!!!USER = \" + authorizer.user.inspect\n debug \"!!!ACCOUNT = \" + authorizer.account.inspect\n # debug \"!!!ACCOUNT_URN = \" + authorizer.account[:urn]\n # debug \"!!!ACCOUNT = \" + authorizer.user.accounts.first.inspect\n\n if slice_urn\n @return_struct[:code][:geni_code] = 4 # Bad Version\n @return_struct[:output] = \"Geni version 3 no longer supports arguement 'geni_slice_urn' for list resources method, please use describe instead.\"\n @return_struct[:value] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n else\n resources = @am_manager.find_all_samant_leases(nil, $acceptable_lease_states, authorizer)\n comps = @am_manager.find_all_samant_components_for_account(nil, authorizer)\n # child nodes should not be included in listresources\n comps.delete_if {|c| ((c.nil?)||(c.to_uri.to_s.include?\"/leased\"))}\n if only_available\n debug \"only_available selected\"\n # TODO maybe delete also interfaces and locations as well\n comps.delete_if {|c| (c.kind_of?SAMANT::Uxv) && c.hasResourceStatus && (c.hasResourceStatus.to_uri == SAMANT::BOOKED.to_uri) }\n end\n resources.concat(comps)\n #debug \"the resources: \" + resources.inspect\n # TODO uncomment to obtain rspeck, commented out because it's very time-wasting\n #used_for_side_effect = OMF::SFA::AM::Rest::ResourceHandler.rspecker(resources, :Offering) # -> creates the advertisement rspec file inside /ready4translation (less detailed, sfa enabled)\n start = Time.now\n debug \"START CREATING JSON\"\n res = OMF::SFA::AM::Rest::ResourceHandler.omn_response_json(resources, options) # -> returns the json formatted results (more detailed, omn enriched)\n debug \"END CREATING JSON. total time = \" + (Time.now-start).to_s\n end\n\n @return_struct[:code][:geni_code] = 0\n @return_struct[:value] = res\n @return_struct[:output] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n rescue OMF::SFA::AM::InsufficientPrivilegesException => e\n @return_struct[:code][:geni_code] = 3\n @return_struct[:output] = e.to_s\n @return_struct[:value] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n end", "title": "" }, { "docid": "d56a28fd75851702612f235336ed5fef", "score": "0.56743693", "text": "def get_resources()\n data, _status_code, _headers = get_resources_with_http_info()\n return data\n end", "title": "" }, { "docid": "4940478bc51f2ff924203a43510bc806", "score": "0.56711435", "text": "def find_all_resources options\n policy_scope(resource_class)\n end", "title": "" }, { "docid": "54809741d6c929f39a61dcb12d130b0c", "score": "0.5669376", "text": "def groups(options = {})\n params = { :limit => 200 }.update(options)\n response = get(PATH['groups_full'], params)\n parse_groups response_body(response)\n end", "title": "" }, { "docid": "e8d595b377264d012367ef2e7eac9653", "score": "0.5656581", "text": "def list_resources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcesApi.list_resources ...'\n end\n # resource path\n local_var_path = '/resource_set'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<String>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['protection_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourcesApi#list_resources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "64dc617921fb6ddf5876bcc6a90e91e1", "score": "0.5655264", "text": "def index\n self.resources = resource_class.all.paginate(per_page: 15, page: (params[:page] || 1).to_i)\n end", "title": "" }, { "docid": "0d1102cfd5f8e8129a2d5181640c9532", "score": "0.5651971", "text": "def list_resources(opts = {})\n data, _status_code, _headers = list_resources_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "44d61c128b705c913b0afebd7e96344c", "score": "0.56390166", "text": "def list_datasets all: nil, filter: nil, max: nil, token: nil\n # The list operation is considered idempotent\n execute backoff: true do\n service.list_datasets @project, all: all, filter: filter, max_results: max, page_token: token\n end\n end", "title": "" }, { "docid": "ef690d5bde0584c43a4a85a6ddc72829", "score": "0.56192654", "text": "def all\n list = []\n page = 1\n fetch_all = true\n\n if @query.has_key?(:page)\n page = @query[:page]\n fetch_all = false\n end\n \n while true\n response = RestClient.get(@type.Resource, @query)\n data = response['data'] \n if !data.nil? && data.any?\n data.each {|item| list << @type.from_json(item)}\n \n if !fetch_all\n break\n else\n @query.merge!(page: page += 1)\n end\n else\n break\n end\n end\n\n return list\n end", "title": "" }, { "docid": "d6193aef29ac47b3cede522625681caf", "score": "0.56160414", "text": "def list(resource,limit=0,params={})\n uri = '/api/' + resource.to_s\n params.merge!({limit: limit.to_s})\n http_get(uri,params)\n end", "title": "" }, { "docid": "c990a84a1ba762ce31af5e02acb2a0c8", "score": "0.56140345", "text": "def all(params = {})\n @resource_requester.all(\n {\n space_id: @space_id\n },\n params\n )\n end", "title": "" }, { "docid": "98cb78cfa1ef5f7e6b1bc807df1e0744", "score": "0.56108004", "text": "def resources\n @resources ||= @response[@resource_field].to_a\n end", "title": "" }, { "docid": "eaa29e492c76b911cf986f3f5f75dc96", "score": "0.55930346", "text": "def list_resources 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_resources_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Config::V1::ListResourcesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "ec5d3b39a307d90545367e95d2293877", "score": "0.5591296", "text": "def collection\n resource_class.all\n end", "title": "" }, { "docid": "0c3d3acf0d3a0333f7f04f27d03bd866", "score": "0.5588764", "text": "def promise_all\n _class_fetch_states[:all] = 'i'\n _promise_get(\"#{resource_base_uri}.json?timestamp=#{`Date.now() + Math.random()`}\").then do |response|\n collection = _convert_array_to_collection(response.json[self.to_s.underscore.pluralize])\n _class_fetch_states[:all] = 'f'\n _notify_class_observers\n warn_message = \"#{self.to_s}.all has been called. This may potentially load a lot of data and cause memory and performance problems.\"\n `console.warn(warn_message)`\n collection\n end.fail do |response|\n error_message = \"#{self.to_s}.all failed to fetch records!\"\n `console.error(error_message)`\n response\n end\n end", "title": "" }, { "docid": "71b2a0a8785c0024e121d850a8336954", "score": "0.5584011", "text": "def all_resources(set = Set.new)\n set << self\n self.each_resource { |r| r.all_resources(set) }\n set\n end", "title": "" }, { "docid": "65e5ea3e8e0d8c7e310ae0b7e76126ff", "score": "0.55771977", "text": "def list\n puts local_resources.map { |name, resource| name }.join(\" \")\n end", "title": "" }, { "docid": "df0615b5b05090c7e9ab03d3d644fc67", "score": "0.5570925", "text": "def get_all_datasets_and_resources(base_url)\n return handle_request(URI.encode(base_url + '/current_package_list_with_ressources'))\n end", "title": "" }, { "docid": "a88431d1482c2b5aa6c8407be53b797f", "score": "0.55643165", "text": "def all(params = {})\n query = params.map { |key, value| \"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}\" }.join(\"&\")\n query = \"?\" + query unless query.empty?\n code, data = @session.get(collection_path + '.json' + query)\n data.collect { |data|\n key = @resource.name.to_s.split('::').last.downcase\n @resource.new(data[key].merge(:session => @session, :prefix => @prefix))\n }\n end", "title": "" }, { "docid": "317b7634b50478a8d0eeca0ee44d9f57", "score": "0.5556182", "text": "def get_all(klass = nil, search_params = {})\n replies = get_all_bundles(klass, search_params)\n return nil unless replies\n resources = []\n\t\treplies.each do |reply|\n resources.push(reply.entry.collect{ |singleEntry| singleEntry.resource })\n end\n resources.compact!\n resources.flatten(1)\n\tend", "title": "" }, { "docid": "287f9d580f1a2822bbc1366a0e13d47f", "score": "0.55503637", "text": "def aggregated_list request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/aggregated/routers\"\n\n query_string_params = {}\n query_string_params[\"filter\"] = request_pb.filter.to_s if request_pb.filter && request_pb.filter != \"\"\n query_string_params[\"includeAllScopes\"] = request_pb.include_all_scopes.to_s if request_pb.include_all_scopes && request_pb.include_all_scopes != false\n query_string_params[\"maxResults\"] = request_pb.max_results.to_s if request_pb.max_results && request_pb.max_results != 0\n query_string_params[\"orderBy\"] = request_pb.order_by.to_s if request_pb.order_by && request_pb.order_by != \"\"\n query_string_params[\"pageToken\"] = request_pb.page_token.to_s if request_pb.page_token && request_pb.page_token != \"\"\n query_string_params[\"returnPartialSuccess\"] = request_pb.return_partial_success.to_s if request_pb.return_partial_success && request_pb.return_partial_success != false\n\n response = @client_stub.make_get_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::RouterAggregatedList.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "title": "" }, { "docid": "d55642e96ef662fc8de5079944eb738f", "score": "0.5546442", "text": "def get_all(options = {})\n custom_params = options[:dc] ? use_named_parameter('dc', options[:dc]) : nil\n ret = send_get_request(@conn, ['/v1/catalog/services'], options, custom_params)\n OpenStruct.new JSON.parse(ret.body)\n end", "title": "" }, { "docid": "5829b22d6f3a2aa06cfc7492d1db6034", "score": "0.5544319", "text": "def index\n unless params[:resource_group_id].blank?\n @resource_group = ResourceGroup.find(params[:resource_group_id])\n @resources = @resource_group.resources.includes(:resource_group, :users).order(\"resource_groups.name, resources.name\").paginate(:page => params[:page], :per_page => current_user.preferred_items_per_page)\n else\n # TODO FIXME for some reason the includes below stopped working when :permission_types is included\n # 'PGError: ERROR: column permission_types.activated does not exist' but not sure why it thinks it should exist at this point\n @resources = Resource.includes(:resource_group, :users).order(\"resource_groups.name, resources.name\").paginate(:page => params[:page], :per_page => current_user.preferred_items_per_page)\n end\n @resource_groups = ResourceGroup.order('name').all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @resources }\n end\n end", "title": "" }, { "docid": "72cf2597848d9f04cb07c0f2b2ecc87c", "score": "0.5539678", "text": "def all(client, space_id, environment_id = nil, parameters = {}, organization_id = nil)\n ResourceRequester.new(client, self).all(\n { space_id: space_id, environment_id: environment_id, organization_id: organization_id }, parameters\n )\n end", "title": "" }, { "docid": "e14a87dc38004940eff1be8b67066213", "score": "0.55337083", "text": "def get_nested_resource_objects\n end", "title": "" }, { "docid": "bbe59ee2163a817bfe0bbfe968c05857", "score": "0.5530036", "text": "def resource_groups(subscription_id = @subscription_id)\n url = url_with_api_version(@base_url, 'subscriptions', subscription_id, 'resourcegroups')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end", "title": "" }, { "docid": "039f63b61dfa2f336af7a9756102337c", "score": "0.5528832", "text": "def list(resource_group_name)\n OOLog.info(\"Getting vnets from Resource Group '#{resource_group_name}' ...\")\n start_time = Time.now.to_i\n begin\n response = @network_client.virtual_networks(resource_group: resource_group_name)\n rescue MsRestAzure::AzureOperationError => e\n OOLog.fatal(\"Error getting all vnets for resource group. Exception: #{e.body}\")\n rescue => ex\n OOLog.fatal(\"Error getting all vnets for resource group. Exception: #{ex.message}\")\n end\n end_time = Time.now.to_i\n duration = end_time - start_time\n OOLog.info(\"operation took #{duration} seconds\")\n response\n end", "title": "" }, { "docid": "9f9b687639d22e5c05ba1cb058c1f8c5", "score": "0.55286944", "text": "def get_all options=nil\n url = [\"/v1/catalog/services\"]\n url += check_acl_token\n url << use_named_parameter('dc', options[:dc]) if options and options[:dc]\n begin\n ret = @conn.get concat_url url\n rescue Faraday::ClientError\n raise Diplomat::PathNotFound\n end\n\n return OpenStruct.new JSON.parse(ret.body)\n end", "title": "" }, { "docid": "246caf0118c6f836bf0f0421c66f187f", "score": "0.5523096", "text": "def test_list_available_resources\n puts \"## list_available_resources (retrieveable SF objects) ##\"\n resp = Salesforce::Rest::AsfRest.xlist_available_resources()\n\n resp.each {|key, val| pp key + ' => ' + val.to_s}\n assert !resp.nil?\n end", "title": "" }, { "docid": "4a1ab8591ca5a08df4772a8a98b6fbaf", "score": "0.55147976", "text": "def type\n Resource::ALL\n end", "title": "" }, { "docid": "272251f5795a618911491b0f9f1539fd", "score": "0.5509957", "text": "def get_all_route(resource_name, representer)\n list_representer = Class.new(Grape::Roar::Decorator) do\n include ::Roar::JSON\n collection :entries, extend: representer, as: :data\n end\n\n desc \"Returns all #{resource_name}\"\n get do\n present find_instances, with: list_representer\n end\n end", "title": "" }, { "docid": "f896dadfa65e8632774bbadd88d48dd6", "score": "0.55012155", "text": "def resources\n collection = Miasma::Models::Orchestration::Stack::Resources.new(self)\n collection.define_singleton_method(:perform_population) do\n valid = stack.sparkleish_template.fetch(:resources, {}).keys\n stack.custom[:resources].find_all { |r| valid.include?(r[:name]) }.map do |attrs|\n Miasma::Models::Orchestration::Stack::Resource.new(stack, attrs).valid_state\n end\n end\n collection\n end", "title": "" }, { "docid": "e35e292833e5b6c38bb712359f9a504c", "score": "0.5500186", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n return @resources.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "title": "" }, { "docid": "59615670be2728027eb1cde33be6f7ed", "score": "0.54924953", "text": "def index\n @request_groups = RequestGroup.all\n end", "title": "" }, { "docid": "a87430f5a8bb707ba59ed12998d72adb", "score": "0.5492315", "text": "def all\n response = RestClient::Request.execute({\n url: \"https://#{connection.path}/apiv1/Get\",\n method: :get,\n verify_ssl: false,\n headers: { params: { typeName: geotab_reference_name, credentials: connection.credentials, search: formatted_conditions }}\n })\n\n body = MultiJson.load(response.body).to_ostruct_recursive\n\n if MultiJson.load(response.body).has_key?(\"error\")\n if body.error.errors.first.message.start_with?(\"Incorrect MyGeotab login credentials\")\n raise IncorrectCredentialsError, body.error.errors.first.message\n else\n raise ApiError, body.error.errors.first.message\n end\n else\n attributes = body.result\n results = []\n\n if attributes && attributes.any?\n attributes.each do |result|\n results.push(new(result, connection))\n end\n end\n\n reset\n\n results\n end\n end", "title": "" }, { "docid": "b48441439b8671418dff39081a8ad555", "score": "0.5488521", "text": "def all_clients\n resp = get CLIENT_API_PATH\n result = process_response(resp)\n return [] if result.empty? # In case response is {}\n result.each.map { |c| Resources::Client.new(c) }\n end", "title": "" }, { "docid": "68541cb8a00e4bd56d4efb859e8089ce", "score": "0.54866016", "text": "def resources\n ([self] + parent_groups).reverse.inject({}) do |memo, group|\n begin\n memo.merge(group.poise_spec_helpers[:resources] || {})\n rescue NoMethodError\n memo\n end\n end\n end", "title": "" }, { "docid": "9e3ca40a4b7af614080d430a9775e1ef", "score": "0.54787564", "text": "def all(filters = {})\n f = {\n datacenter: datacenter,\n cluster: cluster,\n network: network,\n resource_pool: resource_pool,\n folder: folder,\n recursive: recursive\n }.merge(filters)\n\n load service.list_virtual_machines(f)\n end", "title": "" }, { "docid": "4b2faede3367a26ea3a7c95ba9f11d21", "score": "0.5469027", "text": "def list(project_id, options)\n @_client.get(resource_root(project_id), options)\n end", "title": "" }, { "docid": "f4fa2baba150b5f3f5ce7332fd11d588", "score": "0.54597783", "text": "def get_all_with_http_info(object_type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GroupsApi.get_all ...'\n end\n # verify the required parameter 'object_type' is set\n if @api_client.config.client_side_validation && object_type.nil?\n fail ArgumentError, \"Missing the required parameter 'object_type' when calling GroupsApi.get_all\"\n end\n # resource path\n local_var_path = '/crm/v3/properties/{objectType}/groups'.sub('{' + 'objectType' + '}', CGI.escape(object_type.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CollectionResponsePropertyGroupNoPaging'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth2']\n\n new_options = opts.merge(\n :operation => :\"GroupsApi.get_all\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GroupsApi#get_all\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "38d4fd1f23dab3cb472f2dd6e3f5a051", "score": "0.54571456", "text": "def all\n response = RestClient.get(@all_url, params)\n parsed = JSON.parse(response)\n \n parsed['results']['result']\n end", "title": "" }, { "docid": "7a2e68d53849def833b064bbced70cab", "score": "0.54565114", "text": "def get_all_resources(klasses = nil)\n replies = get_all_replies(klasses)\n return nil unless replies\n resources = []\n replies.each do |reply|\n resources.push(reply.resource.entry.collect{ |singleEntry| singleEntry.resource })\n end\n resources.compact!\n resources.flatten(1)\n end", "title": "" }, { "docid": "e52407452328d438d5a2bd93a2b7bd52", "score": "0.54560316", "text": "def resources\n @resources.values\n end", "title": "" }, { "docid": "0fe89b740bda6b893ff6ab99cdb43ed1", "score": "0.5453023", "text": "def group_all(options={})\n result = request(\n :method => :get,\n :path => '/groups',\n :expects => 200\n )\n result.fetch(:body, 'groups', []).map do |lb|\n Group.new(\n self,\n :id => lb[:id],\n :name => lb.get(:state, :name),\n :current_size => lb.get(:state, 'activeCapacity'),\n :desired_size => lb.get(:state, 'desiredCapacity')\n ).valid_state\n end\n end", "title": "" }, { "docid": "46520ea3a5550063b144c223d15c79ca", "score": "0.545295", "text": "def GetGroups params = {}\n\n params = params.merge(path: 'groups.json')\n APICall(params)\n\n end", "title": "" }, { "docid": "1d7a564a6e6419b771921722050bad80", "score": "0.5449135", "text": "def all(options = {})\n out = xml_run build_command('services', options.merge(:get => XML_COMMANDS_GET))\n convert_output(out.fetch(:stream, {}).fetch(:service_list, {}).fetch(:service, []), :service)\n end", "title": "" }, { "docid": "1f7704e6969a9cff17377129dd302fc5", "score": "0.54484755", "text": "def get_resources(opts = {})\n data, _status_code, _headers = get_resources_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "8b088187e5faadf3ce30d74f140b550f", "score": "0.5444516", "text": "def getAllResources(domain = \"*\")\n where_clause = \"\"\n if domain != \"*\" then\n where_clause = \"WHERE testbeds.name='#{domain}'\"\n end\n qs = <<ALLRESOURCES_QS\nSELECT nodes.hrn\n FROM nodes\n LEFT JOIN locations ON nodes.location_id = locations.id\n LEFT JOIN testbeds ON locations.testbed_id = testbeds.id\n#{where_clause};\nALLRESOURCES_QS\n\n resources = Set.new\n runQuery(qs) { |name|\n resources.add(name)\n }\n return resources\n end", "title": "" }, { "docid": "dca67ec782a446807178c722e4f935fa", "score": "0.5431021", "text": "def get_all(account_key, next_page=nil)\n args = ZAPIArgs.new\n\n if next_page\n args.uri = next_page\n else\n args.uri = Resource_Endpoints::GET_SUBSCRIPTIONS.gsub('{account-key}', ERB::Util.url_encode(account_key))\n args.query_string = ZAPIArgs.new\n args.query_string.pageSize = 10\n end\n\n puts \"========== GET SUBSCRIPTIONS ============\"\n\n response = nil\n begin\n @z_client.get(args) do |resp|\n ap resp\n if resp.httpStatusCode.to_i == 200 && resp.success\n response = resp\n end\n end\n rescue ArgumentError => e\n puts e.message\n rescue RuntimeError => e\n puts e.message\n end\n\n response\n end", "title": "" }, { "docid": "37547c676524d82e5c9a0bdab28e3e8f", "score": "0.5430378", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n return @account_resources.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "title": "" }, { "docid": "a83541db8a52d689cdf0738638252d0a", "score": "0.5426818", "text": "def index\n @resources = Group.search(params[:search]).where(id: current_user.admin_groups).order(\"#{sort_column} #{sort_direction}\").paginate(per_page: 11, page: params[:page])\n authorize @resources\n end", "title": "" } ]
e6a5c405767c84fb13e4175ca2f252c3
GET /admin/news_types GET /admin/news_types.json
[ { "docid": "700f3899208017f7373d34e0d0e5f5e8", "score": "0.6312674", "text": "def index\n if params[:field].present? && params[:keyword].present?\n @news_types = NewsType.all.where([\"#{params[:field]} like ?\", \"%#{params[:keyword]}%\"]).page(params[:page]).per(params[:per])\n else\n @news_types = NewsType.all.page(params[:page]).per(params[:per])\n end\n end", "title": "" } ]
[ { "docid": "4267aebd88dc666edcda416ccf9f5f38", "score": "0.72701234", "text": "def index\n @type_news = TypeNews.all\n end", "title": "" }, { "docid": "d192451b72d64a8211ddee0188ee2d45", "score": "0.6796354", "text": "def index\n @admin_article_types = Admin::ArticleType.all\n end", "title": "" }, { "docid": "c6006328690467090d008be0fdca44c5", "score": "0.66395646", "text": "def index\n @types = Type.all\n json_response(@types)\n end", "title": "" }, { "docid": "b10c76874e1b595dd50c7a973202cb8f", "score": "0.65822566", "text": "def index\n @types = Type.order(:name).all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types }\n end\n end", "title": "" }, { "docid": "1b77431c6d1997cf5f09ac97fbe60589", "score": "0.6580984", "text": "def types\n @types = Tournament.tournament_types.keys.to_a\n respond_to do |format|\n format.json { render json: @types }\n end\n end", "title": "" }, { "docid": "5e44e9fe9370cb1e8b5c287cd43fde64", "score": "0.6450176", "text": "def index\n @publication_types = PublicationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publication_types }\n end\n end", "title": "" }, { "docid": "d3103b9cfdec51c7b9ed75b18e8a4aa0", "score": "0.6418652", "text": "def types\n doc = @http.get(\"templates/types?\")\n return doc\n end", "title": "" }, { "docid": "730ecc4017007c409d15c45f4ef4b1e6", "score": "0.641836", "text": "def index\n @admin_news = Admin::News.all\n end", "title": "" }, { "docid": "8661172024d49c2d278505547f123706", "score": "0.64127356", "text": "def set_type_news\n @type_news = TypeNews.find(params[:id])\n end", "title": "" }, { "docid": "a0dce3ac5ebd1ca4bfb09f1f3f332f6d", "score": "0.64046365", "text": "def types!\n mashup(self.class.get(\"/\", :query => method_params('aj.types.getList'))).types['type']\n end", "title": "" }, { "docid": "66c276b4d298554e3fbc980ff777be04", "score": "0.63847053", "text": "def index\n @types = Type.all\n end", "title": "" }, { "docid": "66c276b4d298554e3fbc980ff777be04", "score": "0.63847053", "text": "def index\n @types = Type.all\n end", "title": "" }, { "docid": "66c276b4d298554e3fbc980ff777be04", "score": "0.63847053", "text": "def index\n @types = Type.all\n end", "title": "" }, { "docid": "66c276b4d298554e3fbc980ff777be04", "score": "0.63847053", "text": "def index\n @types = Type.all\n end", "title": "" }, { "docid": "66c276b4d298554e3fbc980ff777be04", "score": "0.63847053", "text": "def index\n @types = Type.all\n end", "title": "" }, { "docid": "c2cb16d85710ccd0eab643928fb308aa", "score": "0.63833535", "text": "def index\n @newstypes = Newstype.all\n end", "title": "" }, { "docid": "5febf004a41e7dd58f89534eed0a70a9", "score": "0.63762516", "text": "def index\n \t@document_types = DocumentType.all\n \trespond_to do |format|\n format.json { render json: @document_types, status: :ok }\n end\n end", "title": "" }, { "docid": "a6766a3a965e30fbec57c69b0528a505", "score": "0.63657254", "text": "def index\n @article_types = ArticleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @article_types }\n end\n end", "title": "" }, { "docid": "341982657361bebf9d59165f89b68eb1", "score": "0.6338013", "text": "def getResourcesType\n type = [Announcement, Discussion, DiscussionSolution, Exam, ExamSolution, Homework, HomeworkSolution, LectureNotes, OnlineResource, Other]\n dic = {:type => type}\n respond_to do |format|\n format.json {render json: dic}\n end\n end", "title": "" }, { "docid": "2f295c2395d353c23a132acf74bab6d2", "score": "0.63359433", "text": "def index\n @m = \"/types\"\n @types = Type.all\n @type = Type.new\n end", "title": "" }, { "docid": "9ae9a4b8ea4f9abb8281c80ba4762064", "score": "0.63296753", "text": "def types\n types = JSON.parse(connection.get(\"/Contact/Types\").body )\n end", "title": "" }, { "docid": "bf3b6ecd0b3993451a86b5a915ff531e", "score": "0.6325729", "text": "def types\n contact_note = JSON.parse(connection.get(\"/ContactNote/Types\").body )\n end", "title": "" }, { "docid": "0330966a9f6d94e44e750be41bb2fce5", "score": "0.6317596", "text": "def index\n @admin_template_types = TemplateType.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_template_type_types }\n end\n end", "title": "" }, { "docid": "5365ef182aa23d52014aa7514866ed13", "score": "0.62736595", "text": "def index\n @doc_types = DocType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @doc_types }\n end\n end", "title": "" }, { "docid": "2654a15e1e55224e7c602215159a61f5", "score": "0.62719375", "text": "def index\n @admin_template_categories = TemplateCategory.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_template_category_types }\n end\n end", "title": "" }, { "docid": "2793e774c1c05d9c4e1ef84bc742ca8d", "score": "0.62647665", "text": "def index\n if params[:type_id].nil? or params[:type_id].empty?\n @sites = Site.all # path: /types\n else\n @sites = Type.find(params[:type_id]).sites # path: /types/id/sites\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "977e249ac7488eca414b7106143cbbe0", "score": "0.6263719", "text": "def set_news_type\n @news_type = NewsType.find(params[:id])\n end", "title": "" }, { "docid": "b25627406f432237b99c39b626f7dc02", "score": "0.6243015", "text": "def types\n get(\"/project/types\")[\"types\"]\n end", "title": "" }, { "docid": "d947451b6543b7525351a2623592851c", "score": "0.622636", "text": "def list_types(params={})\n execute(method: :get, url: \"#{base_path}/types\", params: params)\n end", "title": "" }, { "docid": "a1996a88d2d31a38d7f8ac90c1e9ac46", "score": "0.6216344", "text": "def index\n @admin_site_types = SiteType.all\n end", "title": "" }, { "docid": "4823e729373e4e49963ca01b23062fc1", "score": "0.6215428", "text": "def show\n @m = \"/types\"\n end", "title": "" }, { "docid": "20456795403c5e7a21193c140d05d723", "score": "0.6206073", "text": "def show\n @admin_news = Admin::News.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_news }\n end\n end", "title": "" }, { "docid": "e47880424866ed1d0ca6d619ce9b0474", "score": "0.62057734", "text": "def index\n @user_types = UserType.all\n render json: @user_types\n end", "title": "" }, { "docid": "e09a21899f3aa9a1edb1e4161708c81e", "score": "0.62036914", "text": "def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @types }\n end\n end", "title": "" }, { "docid": "f0a5ba91aaa0f3bd5d49bd60475482d6", "score": "0.6185191", "text": "def types\n @types ||= @api_info.fetch(\"types\")\n end", "title": "" }, { "docid": "d83c08f38d3e155a8797fdcb78c561cb", "score": "0.61797893", "text": "def types\n if !@api_key.nil? and @api_key.api_type == \"muni\"\n params[:c] = \"forager\"\n end\n\n if params[:c].blank?\n cat_mask = array_to_mask([\"forager\",\"freegan\"],Type::Categories)\n else\n cat_mask = array_to_mask(params[:c].split(/,/),Type::Categories)\n end\n\n cfilter = \"(category_mask & #{cat_mask})>0 AND NOT pending\"\n\n @types = Type\n .where(cfilter)\n .collect { |t| { :name => t.full_name, :id => t.id } }\n .sort{ |x, y| x[:name] <=> y[:name] }\n\n log_api_request(\"api/locations/types\", @types.length)\n\n respond_to do |format|\n format.json { render json: @types }\n end\n end", "title": "" }, { "docid": "8fe1da8c5c971e86104e987a85920809", "score": "0.61795175", "text": "def show\n @types = @user.types\n end", "title": "" }, { "docid": "9412c98cfb540af2bddf80d20b2dc4fe", "score": "0.61711836", "text": "def index\n @activity_types = ActivityType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @activity_types }\n end\n end", "title": "" }, { "docid": "85e19b4fdd5be0192877b6e186f9149a", "score": "0.61604637", "text": "def index\n @notification_types = NotificationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notification_types }\n end\n end", "title": "" }, { "docid": "bf82f4b48c223e2e49bce49b60f74cdd", "score": "0.615041", "text": "def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_types }\n end\n end", "title": "" }, { "docid": "94af276da1aa41ba9ef2a7eeb1553cf9", "score": "0.6146461", "text": "def get_admin_material_types\n material_types = get_material_types\n respond_to do |format|\n format.json { render json: material_types}\n end\n end", "title": "" }, { "docid": "50059cc6a8f59e288bc3a7b80d7ea5c6", "score": "0.6137414", "text": "def index\n @type_activities = TypeActivity.all\n render json: @type_activities\n end", "title": "" }, { "docid": "0d14c07940c2abaef2f6845086e3914f", "score": "0.6136466", "text": "def new\n @admin_news = Admin::News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_news }\n end\n end", "title": "" }, { "docid": "e72eeda7317179344966892aabd89f47", "score": "0.61321855", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @types }\n end\n end", "title": "" }, { "docid": "cdd64ab7e0d0e65c1b28d9fd80bcf1e1", "score": "0.6123514", "text": "def index\n @venue_types = VenueType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venue_types }\n end\n end", "title": "" }, { "docid": "4440b05019be9a805e8f820e40f4fbc2", "score": "0.61161387", "text": "def types\n data = {\n 'sale_agent_role' => SaleAgent::ROLE_TYPES,\n 'transaction_type' => Entry::TYPES_TRANSACTION,\n 'author_role' => EntryAuthor::TYPES_ROLES,\n 'artist_role' => EntryArtist::TYPES_ROLES,\n 'currency' => Sale::CURRENCY_TYPES,\n 'sold' => Sale::SOLD_TYPES,\n 'material' => EntryMaterial::MATERIAL_TYPES,\n 'alt_size' => Entry::ALT_SIZE_TYPES,\n 'acquisition_method' => Provenance::ACQUISITION_METHOD_TYPES\n }\n render json: data\n end", "title": "" }, { "docid": "a115aa316a8f36b250914536ab989919", "score": "0.61029834", "text": "def index\n @publication_types = PublicationType.all\n end", "title": "" }, { "docid": "3decc909f2a8043b111c08dd3376fe04", "score": "0.6086599", "text": "def index\n @course_types = CourseType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @course_types } \n end\n end", "title": "" }, { "docid": "7155f1bc054175d42c73af636b86dff7", "score": "0.60859936", "text": "def index\n @usertypes = UserType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usertypes }\n end\n end", "title": "" }, { "docid": "ccd4bc6f6628260172fbd93d870ea696", "score": "0.60808194", "text": "def index\n authorize! :index, Type, :message => 'Acceso denegado.'\n @types = @university.types\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types }\n format.js\n end\n end", "title": "" }, { "docid": "7982413f6951cad57ed39441c10f2cef", "score": "0.6076101", "text": "def article_type\n if !params[:article_type].blank?\n @news_article = NewsArticle.new\n @news_article.send('article_type=', params[:article_type])\n @news_article_timestamp = separate_date_time(Time.now)\n get_statuses(@news_article)\n render :partial => 'form'\n end \n end", "title": "" }, { "docid": "4292336d37ff954caecf56be03842ac7", "score": "0.6073306", "text": "def types\n\t\ttypes = []\n\t\t@api[\"types\"].each do |i|\n\t\t\ttypes.push(i[\"type\"][\"name\"].capitalize)\n\t\tend\n\t\treturn types\n\tend", "title": "" }, { "docid": "f4269d2e7b0664435af9ec7230248cd0", "score": "0.6073181", "text": "def index\n if params[:type].blank?\n @feeds = Feed.where(\"is_article is null or is_article=0\").where(\"category is null\").order(\"created_at desc\").paginate(:page => params[:page], :per_page => 10)\n else\n @feeds = Feed.where(\"is_article=1\").order(\"created_at desc\").paginate(:page => params[:page], :per_page => 10)\n end\n respond_to do |format|\n format.html\n format.json{\n if params[:type].present?\n render :json=> @feeds.as_json(:is_article=>true)\n else\n render :json => @feeds.as_json\n end\n }\n end\n end", "title": "" }, { "docid": "23bb30c31a94535560d977b586e1c0bd", "score": "0.6070919", "text": "def index\n @admin_site_type_admins = TypeAdmin.all\n end", "title": "" }, { "docid": "86ab328c07114ad26bbd5bfa59178881", "score": "0.60693973", "text": "def request_types\n {\n \"Article\": \"Articles\",\n \"Loan\": \"Books\"\n }\n end", "title": "" }, { "docid": "8d6a5923518bf8d32975e7130ac6c36a", "score": "0.60673773", "text": "def index\n if params[:system]\n @news_type = true\n else\n @news_type = false\n end\n @news = News.where('system = ?', @news_type).order(\"created_at DESC\").limit(5)\n end", "title": "" }, { "docid": "80116c34a45ce3a25726eb83aa5de2d8", "score": "0.6046257", "text": "def index\n @insured_types = InsuredType.all\n @title = \"Types of Insured Patients\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @insured_types }\n end\n end", "title": "" }, { "docid": "c55f04ec2a5efe06216ffc41d243a635", "score": "0.60389256", "text": "def index\n @title = 'User Types Management'\n @breadcrumb = 'Users Types'\n @user_types = UserType.all\n end", "title": "" }, { "docid": "665f13e445a83a51719b59a58aa44b8b", "score": "0.60381746", "text": "def index\n @story_types = StoryType.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @story_types }\n end\n end", "title": "" }, { "docid": "d346315d45cc22a13d3164b58a1681f4", "score": "0.60381645", "text": "def index\n if MnAuthorizers::NotificationTypeAuthorizer.readable_by?(current_user)\n @types = MetaNotification::NotificationType.all\n render :json => @types, status: 200 and return\n end\n render :json => \"You are not authorize to complete this action.\", status: 422\n end", "title": "" }, { "docid": "de8939c7202f3ac2e224e4e33d44efb5", "score": "0.6036943", "text": "def index\n @manage_news = ManageNews.all\n end", "title": "" }, { "docid": "cf817412360716a94d8e6e68de0a2285", "score": "0.60326976", "text": "def index\n @event_types = EventType.all\n @event_types = EventType.paginate(:per_page => 15, :page => params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_types }\n end\n end", "title": "" }, { "docid": "7125d659821be0f56225f131fd24ce9b", "score": "0.6029258", "text": "def index\n @log_types = LogType.all\n\n render json: @log_types\n end", "title": "" }, { "docid": "f2d847a96f32ffc562a0f4cf7301038c", "score": "0.6026856", "text": "def index\n @usertypes = Usertype.all\n\n render json: @usertypes\n end", "title": "" }, { "docid": "36256e0971e616f7636ed0c5afa8ec64", "score": "0.60237134", "text": "def index\n @talklinktypes = Talklinktype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talklinktypes }\n end\n end", "title": "" }, { "docid": "5ed5a097e04893ed95eab9c47c8e4683", "score": "0.60201573", "text": "def index\n @item_types = ItemType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @item_types }\n end\n end", "title": "" }, { "docid": "4af840025bfdfaac6c34a28cf184db07", "score": "0.6016648", "text": "def list\n\n @document_types = DocumentType.find(:all, :order => 'name')\n end", "title": "" }, { "docid": "e2ac3597ffff54bded968b765550a933", "score": "0.6014", "text": "def retrieve_entity_types()\n start.uri('/api/entity/type')\n .get()\n .go()\n end", "title": "" }, { "docid": "bb3cc782129b3bc7964b07ec7a6dbafe", "score": "0.6013534", "text": "def index\n @newsfeed = Newsfeed.new\n @newsfeeds = Newsfeed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @news }\n end\n end", "title": "" }, { "docid": "542411bbb5f75c07454bae3a052b07b3", "score": "0.60110795", "text": "def index\n screen_name(\"Admin-Indice-Tipos-OT\")\n @ot_types = OtType.order(\"name ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ot_types }\n end\n end", "title": "" }, { "docid": "2c58862d241f076a562e953847aefd0e", "score": "0.59992373", "text": "def index\n @office_types = OfficeType.all\n @title = \"Types of Offices\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @office_types }\n end\n end", "title": "" }, { "docid": "b315d29631443246b323dbb4eecbbd43", "score": "0.5997656", "text": "def index\n @statute_types = StatuteType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @statute_types }\n end\n end", "title": "" }, { "docid": "113317308f42f4c79ecc341dfdbf031c", "score": "0.5994878", "text": "def index\n @auth_config_types = AuthConfigType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @auth_config_types }\n end\n end", "title": "" }, { "docid": "0e3b94111161d197a24c4354d02116fe", "score": "0.5992923", "text": "def index\n @type_publications = TypePublication.all\n end", "title": "" }, { "docid": "e90350001b4a4ff6b1040dfa03e4570a", "score": "0.5985065", "text": "def index\n @reagent_types = ReagentType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reagent_types }\n end\n end", "title": "" }, { "docid": "4ac69a457cfe27ea1b9ea630b7062b50", "score": "0.59790266", "text": "def index\n @room_sub_types = RoomSubType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @room_sub_types }\n end\n end", "title": "" }, { "docid": "bda4abf61fc190e2a3bd15807f35ec9d", "score": "0.59738886", "text": "def fee_types\n @client.make_request :get, settings_path('fee-types')\n end", "title": "" }, { "docid": "d442fa40ad65be308e3e86291de15315", "score": "0.5973763", "text": "def index\n @item_types = ItemType.all\n\n render json: @item_types\n end", "title": "" }, { "docid": "aacdc198e890baa7298f5988704fe06b", "score": "0.5969335", "text": "def index\n @sate_types = SateType.all\n end", "title": "" }, { "docid": "e33d5b86842e911c8b471e0efb31b3bc", "score": "0.59682614", "text": "def index\n @blog_types = BlogType.all\n end", "title": "" }, { "docid": "aa60f2980cf3de449211e987baf48ba1", "score": "0.5963826", "text": "def index\n @agendaitemtype_eventtypes = AgendaitemtypeEventtype.order(:agendaitemtype_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @agendaitemtype_eventtypes }\n end\n end", "title": "" }, { "docid": "3cdf312dd5d45f675ea1280e23d75dd3", "score": "0.595837", "text": "def index\n @types = Type.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types }\n format.csv { render csv: @types }\n end\n end", "title": "" }, { "docid": "d0ea09ae90b9391cf7a97bd5369933ad", "score": "0.5957858", "text": "def index\n @type_sections = TypeSection.all\n end", "title": "" }, { "docid": "99fd88e3b52d5a95d7229a91dbf38f3a", "score": "0.59577894", "text": "def list_role_type_names\n role_type_names = RoleType.all.map(&:name)\n \n respond_to do |format|\n format.html {render :layout => false, :json => role_type_names}\n format.json {render :layout => false, :json => role_type_names}\n end\n end", "title": "" }, { "docid": "25ff6b3c415347613fae92c1d6729633", "score": "0.59488285", "text": "def index\n @publishable_types = Publinator::PublishableType.all\n render \"publinator/manage/index\"\n end", "title": "" }, { "docid": "77c2307e58aa18e2f18bb863f46a82f5", "score": "0.59478885", "text": "def index\n @admin_template_authors = TemplateAuthor.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_template_author_types }\n end\n end", "title": "" }, { "docid": "f52dad2e436bb8380431600ba3bd8b07", "score": "0.5947195", "text": "def index\n @notes = current_company.notes.where(:notable_type => params[:type])\n respond_to do |format|\n format.xml{render :xml => @notes}\n format.json{render :json => @notes}\n end\n end", "title": "" }, { "docid": "6d47d67e87af7b1927a2f7df84f53e85", "score": "0.5942122", "text": "def index\n @resource_types = ResourceType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end", "title": "" }, { "docid": "a79d36c8bbc64eb7a1c671d83e1c6160", "score": "0.5939183", "text": "def index\n @accident_types = AccidentType.without_status :deleted, :archived\n @title = \"Accident Types\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accident_types }\n end\n end", "title": "" }, { "docid": "7b5365f472fcdad9e553ba81a9c2cd02", "score": "0.5938254", "text": "def index\n @membership_types = MembershipType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @membership_types }\n end\n end", "title": "" }, { "docid": "1ed4c573eb135493dd20102c624a2ce6", "score": "0.59324604", "text": "def index\n @admin_template_sources = TemplateSource.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_template_source_types }\n end\n end", "title": "" }, { "docid": "ca100e24a18be28262b4f18efb1eba3d", "score": "0.5930772", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @customer_types }\n end\n end", "title": "" }, { "docid": "9c731c602aa2cd0ec378d6f816e1d727", "score": "0.593058", "text": "def index\n @type_documents = TypeDocument.all\n end", "title": "" }, { "docid": "37d1b741261a78af8de36ed27b3e2057", "score": "0.5925136", "text": "def index\n @activities_types = ActivitiesType.all\n end", "title": "" }, { "docid": "33a420f4a2a30981a171735fa9a490dc", "score": "0.5924817", "text": "def index\n @schedtypes = Schedtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schedtypes }\n end\n end", "title": "" }, { "docid": "43d655f6afe7fafba077dacf32043249", "score": "0.5924538", "text": "def list(type)\n data = case type\n when :posts\n Ruhoh::DB.update(:posts)\n Ruhoh::DB.posts['dictionary']\n when :drafts\n Ruhoh::DB.update(:posts)\n drafts = Ruhoh::DB.posts['drafts']\n h = {}\n drafts.each {|id| h[id] = Ruhoh::DB.posts['dictionary'][id]}\n h\n when :pages\n Ruhoh::DB.update(:pages)\n Ruhoh::DB.pages\n end \n\n if @options.verbose\n Ruhoh::Friend.say {\n data.each_value do |p|\n cyan(\"- #{p['id']}\")\n plain(\" title: #{p['title']}\") \n plain(\" url: #{p['url']}\")\n end\n }\n else\n Ruhoh::Friend.say {\n data.each_value do |p|\n cyan(\"- #{p['id']}\")\n end\n }\n end\n end", "title": "" }, { "docid": "408df9b7edb153046be16cfddd3e46de", "score": "0.5922146", "text": "def index\n @list_types = ListType.all\n end", "title": "" }, { "docid": "49b697bd652b21187c9dd939ba11c87a", "score": "0.5921789", "text": "def show\n @article_type = ArticleType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article_type }\n end\n end", "title": "" }, { "docid": "8d2974f7090a51efcd15e5e5ee09443f", "score": "0.59200454", "text": "def spot_types\n render json: SpotType.pluck(:name)\n end", "title": "" }, { "docid": "b65e4bd6973238aee156a21b7a059da7", "score": "0.5914804", "text": "def index\n @post_types = PostType.all\n\n respond_with\n end", "title": "" } ]
ffa720536104fcf822428373d4298357
generate all valid strings of parenthesis given n number of pairs
[ { "docid": "81249a90c0c60179c3afa81f85257314", "score": "0.8050546", "text": "def make_valid_parens(n)\n valids = [\"()\"]\n return \"\" if n == 0\n x = 1\n while x < n\n new_arr = []\n valids.each do |str|\n new_arr << \"(#{str})\"\n end\n valids.each do |str|\n new_arr << \"()#{str}\"\n end\n valids.each do |str|\n new_arr << \"#{str}()\"\n end\n new_arr = new_arr.uniq\n valids = new_arr\n x += 1\n end\n return valids.uniq\nend", "title": "" } ]
[ { "docid": "817b74f6f4144ff1a56c94df7776d67c", "score": "0.75795376", "text": "def generate_parentheses(n)\n if n <= 1\n return [\"()\"]\n end\n ret = []\n generate_parentheses(n - 1).each do |pair|\n ret << pair + \"()\"\n ret << \"(\" + pair + \")\"\n ret << \"()\" + pair\n end\n ret.uniq\nend", "title": "" }, { "docid": "13f38cef56e90c9cf8ca18ed238859d7", "score": "0.7431559", "text": "def generate_parenthesis max_pairs\n parens_helper result=[], '', max_pairs, 0, 0\n result\nend", "title": "" }, { "docid": "d8cff02d57a0d4a4e662bd5f6e040988", "score": "0.7017943", "text": "def parens(n)\n result = []\n generate_parens(n, n, '', result)\n result\nend", "title": "" }, { "docid": "bf999ab26b26aa09d9fd62b84577cc64", "score": "0.67992383", "text": "def parens(pair_count)\n results = []\n parens_rec({left: pair_count, right: pair_count}, \"\", results)\n results\nend", "title": "" }, { "docid": "6a33b8e86ca013d2c6830da7f7af740e", "score": "0.6796405", "text": "def n_paranthesis_string(n)\n paranthesis_string = ''\n n.times{ paranthesis_string << '(' }\n n.times{ paranthesis_string << ')' }\n paranthesis_string\nend", "title": "" }, { "docid": "915c48436ea160681a62c28a690e7c90", "score": "0.67217785", "text": "def generateParensString(n)\n if n > 0\n result = _generateParensString(n, \"\", [], 0, 0)\n print \"input of #{n}: \" + result.to_s + \"\\n\"\n end\nend", "title": "" }, { "docid": "9b6863c91f54382678bf64b7600155b1", "score": "0.6220561", "text": "def generate(s, left, right)\n if left == 0 && right == 0\n puts s\n return\n end\n\n if left > 0\n generate(s + \"(\", left - 1, right)\n end\n\n if right > left\n generate(s + \")\", left, right - 1)\n end\nend", "title": "" }, { "docid": "aa7a1a4cf518532366fe65e139ee23d0", "score": "0.6044582", "text": "def generate_pairs(names)\n return [[names]] if names.length < 3\n\n pairs = []\n names.combination(2).each do |pair|\n others = generate_pairs(names - pair)\n others.each do |rest|\n pairs << ([pair] + rest)\n end\n end\n return pairs\nend", "title": "" }, { "docid": "dd2958ec3ad1ba640f5323d3b66f0a93", "score": "0.6006591", "text": "def generate_shape(n)\n str = \"\"\n n.times { str += \"+\" }\n str = str.split(\"\").push(\"\\n\").join\n result = str * n\n result[0...-1]\nend", "title": "" }, { "docid": "8baae58ea01010814de073de00494466", "score": "0.5951384", "text": "def generate_shape(n)\n (0...n).map { \"+\" * n }.join(\"\\n\")\nend", "title": "" }, { "docid": "3c655fbbe81264db43dd7188eb2ff38a", "score": "0.5880784", "text": "def convert_to_parens(result)\n str = ''\n\n result.each do |nums|\n nums.each do |num|\n if num == -1\n str << ')'\n else\n str << '('\n end\n end\n end\n str\nend", "title": "" }, { "docid": "6da5540b36b11ef908fae9d5a4d35b08", "score": "0.58636445", "text": "def generateParenthesis(a)\n return [] if a == 0\n # Open paranthesis op\n op = 0\n # Close paranthesiss cp\n cp = 0\n generator(a, \"\", op, cp, [])\nend", "title": "" }, { "docid": "3ff2a6ccfa87d27999c0710209f584f9", "score": "0.57765454", "text": "def gram(str, n = 3)\n if n < 2: raise \"n argument should be greater or equal 2\" end\n prev = \"$\" + str[0..n-2]\n result = [prev]\n str = str[n-1..-1]\n # if n < str.length we have no string left\n if str: str << \"$\" else str = \"$\" end\n str.each_char do |c|\n # Drop first char and append c\n prev = prev[1..-1] + c\n result << prev\n end\n return result\nend", "title": "" }, { "docid": "5376ad8f8c99156e24e7047fbea8bc50", "score": "0.5768989", "text": "def alt_pairs(str)\nend", "title": "" }, { "docid": "30b6cd595e0f8ab9dd1548956b5ccbb5", "score": "0.5699313", "text": "def build_character_pairs\n \" #@raw \".chars\n .each_cons(2)\n .map(&:join)\n end", "title": "" }, { "docid": "00a7a5cd5dd5f53f236a7b1e67f23429", "score": "0.5669497", "text": "def generate_shape(n)\n (Array.new(n) { |_i| ('+' * n) }).join(\"\\n\")\nend", "title": "" }, { "docid": "095df936628333f229f2abad0d6ae7b9", "score": "0.56549746", "text": "def build_string(n)\n str = \"\"\n \n str << \"0203\"\n \n n.times{str << \"000300606008030040200\"}\n \n str << \"0203\"\n \n (1..n).each do |c|\n str << \"00003\"\n \n (c..n).each do\n str << \"00030600800804060181181211\"\n end\n \n str << \"1218161161211\"\n end\n \n str = str.gsub(/\\s+/, \"\")\nend", "title": "" }, { "docid": "39199f5e5372f30a55ae255b74d758ec", "score": "0.562071", "text": "def every_possible_pairing_of_word(arr)\n arr.combination(2)\nend", "title": "" }, { "docid": "a8c7f290488da488df82cc17632319bf", "score": "0.56195664", "text": "def floyd_triangle2(n)\n return \"\" if n <= 0\n \n out = \"\"\n last = 0\n\n (1..n).each do |i|\n (1..i).each do |j|\n last += 1\n out << last.to_s\n out << \" \" if i > j\n end\n out << \"\\n\"\n end\n out\nend", "title": "" }, { "docid": "b4cf37fd3cf4912a388c5df5860e3bb5", "score": "0.5612055", "text": "def solve( n = 30 )\n # Solving this with combinatorics quickly turned into a major headache.\n # Instead, tackle it inductively by considering how the total changes as\n # as each new day's trinary string is added one by one. By keeping track\n # of certain characteristics for a string of length m, we can then make\n # simple statements about how those characteristics changes when we in-\n # crease the string's length to m + 1.\n #\n # Given some (valid, \"prize\") string S to which we will prepend either L,\n # O, or A, we know the result will also be valid provided:\n #\n # o We prepend O\n # o We prepend L AND S doesn't contain L already\n # o We prepend A AND S doesn't already start with AA\n #\n # This gives us an idea of what characteristics might be helpful to record\n # for each n:\n #\n # U = count of prize S containing L\n # V = count of prize S starting with A\n # W = count of prize S starting with AA\n # X = count of U ∩ V (contains L and starts with A)\n # Y = count of U ∩ W (contains L and starts with AA)\n # Z = count of prize S\n #\n # Now we can formulate functions to take U, V, W, ... to U', V', W', etc.\n # as n increases. That is, given U_n, V_n, W_n, etc., how do we compute\n # U_(n+1), V_(n+1), W_(n+1), ...?\n #\n # Given U valid strings containing L, we know they'll remain valid after\n # we prepend O, so U' will be at least O. We also know that we can do the\n # same for A, as long as we skip S that start with AA, so we need to in-\n # crease U' by an additional U - Y. Similarly, we know we can create Z - U\n # new L strings by prepending it to existing prizes strings. So, U' will\n # be given by U' = U + (U - Y) + (Z - U) = U - Y + Z.\n #\n # To compute V', note that we will have added A to all strings except the\n # ones starting with AA, but the ones that had started with A shouldn't be\n # counted (since they will now start with AA). V' = Z - V - W.\n #\n # W' is simply the count of valid strings previously starting with A,\n # since those are the only ones that could conceivably now begin with AA.\n # W' = V. Similarly, Y' = X.\n #\n # X' must necessarily be less than U (since not all L strings will start\n # with A), and in fact, we must subtract members that had been counted,\n # since they will have had A prepended and now start with AA. Similarly,\n # we shouldn't count the Y strings toward X' either, since they will not\n # start with A now. X' = U - X - Y.\n #\n # With the first five quantities defined in terms of the previous values,\n # we can now derive a formula for the total number of valid prize strings.\n # For every valid string of length m, there will be corresponding strings\n # of length m + 1 such that:\n #\n # o it is identical except for a new leading L, except for strings that\n # already contain L (Z - U new items),\n # o it is identical except for a new leading O (Z new items), or\n # o it is identical except for a new leading A, except for strings that\n # already started with AA (Z - W new items)\n #\n # Therefore, Z' = Z - U + Z + Z - W = 3Z - U - W.\n u, v, w, x, y, z = 1, 1, 0, 0, 0, 3\n \n (n - 1).times do\n u, v, w, x, y, z = u - y + z, z - v - w, v, u - x - y, x, 3*z - u - w\n end\n\n z\n end", "title": "" }, { "docid": "ba1c4e7232eee099b3d11eae1e19a38e", "score": "0.56117857", "text": "def generate_frogs_pole(n, left, right)\n Array.new.tap do |pole|\n n.times { pole.push left }\n pole.push '_'\n n.times { pole.push right }\n end\nend", "title": "" }, { "docid": "042a8ce009da995618abaca85d976a00", "score": "0.56033427", "text": "def matching_parens(code)\r\n pairs = []\r\n depth = 0\r\n depth_position = {}\r\n string.chars.each_with_index do |char, position|\r\n if char == \"(\"\r\n depth_position[depth] = position\r\n depth += 1\r\n elsif char == \")\"\r\n pairs << [depth_position[depth], position]\r\n depth -= 1\r\n end\r\n end\r\n pairs\r\nend", "title": "" }, { "docid": "4381ff5c36b0c7f915c1b07cc72cd070", "score": "0.5601052", "text": "def ngram(str, n)\n str.chars.each_cons(n).to_a.map &:join\n end", "title": "" }, { "docid": "7fca68b841ad2577b6b02a9c6200b59e", "score": "0.5596321", "text": "def match_parens(str, n)\n hash = Hash.new\n un_matched_parens = []\n str.chars.each_with_index do |char, idx|\n if char == '('\n hash[idx] = nil\n un_matched_parens.push(idx)\n elsif char == ')'\n hash[un_matched_parens.pop] = idx\n end\n end\n hash[n]\nend", "title": "" }, { "docid": "e603179e8a0d2b78a602ce5b78602e10", "score": "0.5568056", "text": "def MultipleBrackets(str)\n\t#step 1 iterate through string and extract brackets\n\t#step 2 check if there are no brackets then 1 \n\t#step 3 par and br have to complement each other so the total has to be 0 \n\t#step 4 count up the pairs total and output \n\tbrackets = str.scan(/[\\(\\)\\[\\]]/).to_a\n\treturn 1 if brackets.empty?\n\tpar = 0\n\tbr = 0\n\tbrackets.each do |x|\n\t\tpar += 1 if x == '('\n\t\tpar -= 1 if x == ')'\n\t\tbr += 1 if x == '['\n\t\tbr -= 1 if x == ']'\n\t\treturn 0 if par < 0 || br < 0\n\tend\n\treturn \"1 #{brackets.count / 2}\"\n\t \nend", "title": "" }, { "docid": "950e19e987297d1e1c2f8c996e1e7895", "score": "0.55607826", "text": "def balanced_parens(string)\n parens = []\n string.chars.each do |char|\n if char == \"(\"\n parens << \"(\"\n elsif char == \")\"\n parens << \")\"\n end\n end\n parens.length.even? if !parens.empty?\nend", "title": "" }, { "docid": "c58dc5c740c8b43bea3cb20bc8570fb2", "score": "0.55577767", "text": "def combinationThree(num, start, final) \n # check the first \"if\" statement.\n if num > (final - start + 1)\n []\n # check the second statement, and \n # return a list a single number string.\n elsif num == 1\n (start.to_s..final.to_s).to_a\n # if the combination number equals to (end - start),\n # then return a single string of numbers as a list.\n elsif num == (final - start + 1)\n line = start.to_s\n while start < final\n start += 1\n line << (\" \" + start.to_s)\n end\n [line]\n # make a for loop to call every sub combination function, and then,\n # if the sub-function return a actually list, add the frist element\n # into each string, such as:\n # list = combination(1, 2, 3); <-- return {\"2\", \"3\"};\n # for loop add each string \"1 \";\n # so it will return {\"1 2\", \"1 3\"};\n # if the string.length == 0, then it won't add additional number. \n else\n line_set = [];\n for i in ((start + 1)..final)\n for line in combinationThree(num - 1, i, final)\n if line.length > 0\n line.insert(0, (i - 1).to_s + \" \")\n line_set << line\n end\n end\n end\n line_set\n end\nend", "title": "" }, { "docid": "da68411e77707a423113dce5d84b0b96", "score": "0.5530089", "text": "def tr_many(input, nth, from_str, to_str)\n new_input = tr_nth(input, nth, from_str, to_str)\n\n return new_input if new_input.count(from_str) <= 3\n\n tr_many(new_input, nth, from_str, to_str)\nend", "title": "" }, { "docid": "a96c05b776598c173736b53d61fb6083", "score": "0.5510034", "text": "def main()\n s = \"()()()(((\"\n n = neededToCloseAll(s)\n p(n)\nend", "title": "" }, { "docid": "0ac58cf3805c8d087ae03f6c96716b74", "score": "0.5506977", "text": "def gen_many (two_chars,n)\r\n\tn.times { puts name_gen(two_chars) }\r\nend", "title": "" }, { "docid": "789ebc9b05ef32438604800a861c078c", "score": "0.5500475", "text": "def form_parentheses(left, right, temp, result)\n # Cover the base case; If both left and right counts have reached 0\n # push the formed string into the results\n if left == 0 && right == 0\n result << temp\n end\n\n # The left should be handled first since you can't start a balanced string of\n # parentheses with a closing parentheses.\n # As long as there is a left count, add a left\n if left > 0\n # Add the left here\n temp += '('\n # Make a recursive call but decrement the left count since one was just added\n # to the temp string. Leave the right count unaltered and pass in the altered\n # temp string\n form_parentheses(left - 1, right, temp, result)\n # If the parentheses that was just appended is not removed,\n # when the if statement below this runs, it'll be using an altered version\n # of the temp var with an extra '('\n temp[-1] = ''\n end\n\n # This if statement makes sure that a right is added whenever there are still\n # matches to be made. Comparing the right to the left, instead of 0, will make sure\n # that rights are only added if a left has already been placed.\n if right > left\n # Add the right to the temp here\n temp += ')'\n # Make a recursive call with a decremented right count and the new temp\n form_parentheses(left, right - 1, temp, result)\n end\n\n # NOTE: Alternatively, each if statement could be condensed to one line each:\n # Left: form_parentheses(left - 1, right, temp + '(', result)\n # Right: form_parentheses(left, right - 1, temp + ')', result)\n # I left the longer versions here because I think it's easier to talk through\n # the steps.\n\n # All cases have been covered and the result array has been filled so return it\n result\nend", "title": "" }, { "docid": "2208469dbf1d863c9c82ee9c3009d8b7", "score": "0.54963917", "text": "def MultipleBrackets(str)\n str = str.split(\"\")\n answer = []\n if str.count(\"(\") == str.count(\")\") && str.count(\"[\") == str.count(\"]\")\n answer << 1\n pairs = (str.count(\"(\") + str.count(\"[\")) / 2\n answer << pairs\n end\n answer.join(\" \")\nend", "title": "" }, { "docid": "41a607d55d19cd35b4ff98ececc7ae38", "score": "0.5490689", "text": "def tower_builder(n)\n Array.new(n) {|i| ' ' * (n - i - 1) + '*' * (i * 2 + 1) + ' ' * (n - i - 1)}\nend", "title": "" }, { "docid": "ee0f258646cbffb516073756b8c8df03", "score": "0.548144", "text": "def triple_trouble(one, two, three)\n product = \"\"\n i = 0\n begin \n product << one[i]\n product << two[i]\n product << three[i]\n i += 1\n end until i == three.length\n product\nend", "title": "" }, { "docid": "4c9520972f0e9e55e164b81eea34115d", "score": "0.5475678", "text": "def process_parens(carr)\n nl = 0\n nests = {}\n nests[0] = []\n carr.each do |k|\n if k == \"(\"\n nests[nl] << nl + 1\n nl += 1\n nests[nl] = [] if !nests.has_key?(nl)\n elsif k == \")\"\n nests[nl] << \";\"\n nl -= 1\n else\n nests[nl] << k\n end\n end\n return nests\n end", "title": "" }, { "docid": "20a5d3df35090aba93f4eeafcc85baa5", "score": "0.5469762", "text": "def triple_trouble(x, y, z)\n [x, y, z].map(&:chars).transpose.join\nend", "title": "" }, { "docid": "d1a6abbfd97718b3c6fd89f8381d3f3e", "score": "0.5465946", "text": "def get_combinations(ph_no_char_array)\n start = (MIN - 1)\n combinations = []\n (start..(ph_no_char_array.length - 1)).each do |i|\n first_word = ph_no_char_array[0..i]\n second_word = ph_no_char_array[(i + 1)..(ph_no_char_array.length - 1)]\n combinations << [first_word] if first_word.length == MAX\n combinations << [first_word, second_word] if first_word.length >= MIN && second_word.length >= MIN\n # Checking if second part's length is more then 6\n if second_word.length >= (MIN * 2)\n ((i + MIN)..(ph_no_char_array.length - 1)).each do |j|\n second_word = ph_no_char_array[(i+1)..j]\n third_word = ph_no_char_array[(j+1)..(ph_no_char_array.length - 1)]\n combinations << [first_word, second_word, third_word] if first_word.length >= MIN && second_word.length >= MIN && third_word.length >= MIN\n end\n end\n end\n combinations\n end", "title": "" }, { "docid": "f9f67d83a1fab86803ca99dd26c1d7cf", "score": "0.54588085", "text": "def pythag_triples(n)\n i = 2\n count = 0\n triples = []\n\n while\n for j in (1..i) \n if (i - j) % 2 == 1 and lowest_common_multiple(i, j) == i * j\n a = i ** 2 - j ** 2\n b = 2 * i * j\n c = i ** 2 + j ** 2\n triples << \"#{a},#{b},#{c}\"\n count += 1\n if count == n then return triples end\n end\n end\n i += 1\n end\nend", "title": "" }, { "docid": "2562aa6d3503e00dd6a58877a46abc57", "score": "0.54418254", "text": "def steps(n)\n str = \"\"\n i = 1\n while i<=n do\n j = 1\n while j<=i do\n str = str + \"#\"\n j += 1\n end\n if str.length != n \n k = str.length + 1\n while k<=n do\n str = str + ' '\n k += 1\n end\n end\n puts str\n i += 1\n str = \"\"\n end\nend", "title": "" }, { "docid": "650c0a8278ae9b48202e9840195b0011", "score": "0.5437878", "text": "def valid_parens(str)\n brackets = []\n open_brackets = ['(', '[', '{']\n close_brackets = [')', ']', '}']\n pairs = Hash[open_brackets.zip close_brackets]\n\n str.chars.each do |char|\n if open_brackets.include? char\n brackets << char\n elsif close_brackets.include? char\n open_bracket = brackets.pop\n return false unless pairs[open_bracket] == char\n end\n end\n\n true\nend", "title": "" }, { "docid": "4953ca2bccda82bbcbe90a7e043b3ae5", "score": "0.5436793", "text": "def solution(pairs)\n # TODO: complete\n pairs.map{|a,b| \"#{a} = #{b}\"}.join(',')\nend", "title": "" }, { "docid": "8cd3bc6d6c26232b16435f2711f15478", "score": "0.54191524", "text": "def buddy(start, nd)\n (start..nd).each do |n|\n t = s(n)\n next if t < n\n return \"(#{n} #{t-1})\" if s(t-1) == n+1\n end\n\n \"Nothing\"\nend", "title": "" }, { "docid": "56cb1438b6e065437c16651f3c82a2b1", "score": "0.5411534", "text": "def generate_shape(n)\n (\"#{\"+\" * n}\\n\" * n).chop\nend", "title": "" }, { "docid": "a770f30458cd9c6ad743357542fabbbd", "score": "0.5408279", "text": "def combinations(number)\n\tstring = \"\"\n\tnumber.times do\n\t\tstring += [*\"a\"..\"z\",*\"A\"..\"Z\"].sample\n\tend\n\n\treturn string\nend", "title": "" }, { "docid": "cf09f8eea7a7df8eabd202b1cb24c7ff", "score": "0.5397246", "text": "def pattern(n)\n (1..n).map{|x| n.downto(x).map(&:to_s).join}.join(\"\\n\")\nend", "title": "" }, { "docid": "98cbcee4f955722155d8e5044b75d105", "score": "0.53943247", "text": "def print_pairs(arrays)\n\n arrays.each_with_index do |v, i|\n index = i += 1\n len = arrays.length - index\n right_hand_space = []\n pairs = []\n len.times { |n| right_hand_space << arrays[index + n] }\n\n right_hand_space.each { |n|\n if v < n\n pair = \"(#{v},#{n})\"\n pairs << pair\n end\n }\n\n p pairs.join(\" \")\n\n\n end\n\nend", "title": "" }, { "docid": "2b37c6179e092c0d840f02df24521448", "score": "0.5392601", "text": "def staircase(n)\n (0..n-1).each do |i|\n (0..n-1).each do |j|\n # p n-1-i\n # p j\n if (j < n-1-i)\n print \" \"\n else\n print \"#\"\n end\n end\n print \"\\n\"\n end\nend", "title": "" }, { "docid": "b2a40cf6ca4dc1e9f06d5a2af5a83860", "score": "0.53854823", "text": "def longest_valid(parens)\n stk = []\n i = 0\n max = -1\n count = 0\n while i < parens.length\n while i < parens.length and parens[i] == '('\n stk.push(parens[i])\n i += 1\n end\n count = 0\n while i < parens.length and parens[i] == ')'\n stk.pop\n count += 2\n i += 1\n end\n max = count if count > max\n end\n max\nend", "title": "" }, { "docid": "0049103cff4c36a4747b1f1764d3573d", "score": "0.5379336", "text": "def strunc(s, n)\n if s.length <= n\n s\n else\n s.gsub(/^(.{,#{n - 3}}).*$/, '\\1...')\n end\nend", "title": "" }, { "docid": "d4089b234d99d08219d6570420ee6848", "score": "0.5377772", "text": "def valid_pairs?(str)\n open_stack = []\n str.each_char do |char|\n open_stack << char if char == '('\n next unless char == ')'\n return false if open_stack.empty?\n\n open_stack.pop\n end\n\n true\nend", "title": "" }, { "docid": "4d76e36727d86923e6eb067de873ff7e", "score": "0.5372419", "text": "def s(v, p, acc, t)\n if t.length == 0\n if p > 0\n # nothing!\n return []\n else\n # valid string...\n return [[acc, v]]\n end\n elsif t[0] == '('\n # you take it ...\n izq = s(v, p + 1, \"#{acc}#{t[0]}\", t[1..-1])\n # ... or you leave it\n der = s(v + 1, p, acc, t[1..-1])\n return izq.concat der\n elsif t[0] == ')'\n # can you take it?...\n izq = []\n if p > 0\n izq = s(v, p - 1, \"#{acc}#{t[0]}\", t[1..-1])\n end\n # ... or you just leave it\n der = s(v + 1, p, acc, t[1..-1])\n return izq.concat der\n end\n # ... just take it\n return s(v + 1, p, \"#{acc}#{t[0]}\", t[1..-1])\n\nend", "title": "" }, { "docid": "c3b8a990de9e3da1a0fa33eb1cddd740", "score": "0.5370921", "text": "def make_triangle(n)\n n + 1\n n.times {|x| puts \"#{' ' * (4-x)} #{\"O \" * x}\"}\nend", "title": "" }, { "docid": "2fea1f76c7d25cb4c48b0033296fa4b6", "score": "0.53705794", "text": "def print_combinations(str)\n return if !str || str.length == 0 # nil or empty\n\n str_length = str.length\n char_count = 1 # minimum output string length\n while char_count <= str_length # from minimum to maximum output length\n # print all combinations with char_count number of characters\n print_current(0, char_count, str, str_length, \"\")\n # puts \"#{char_count} complete\"\n char_count += 1\n end\n return\nend", "title": "" }, { "docid": "3adda2d688258c88037869337aab0246", "score": "0.5362472", "text": "def findDuplicateParenthesis( expn, size)\n stk = []\n i = 0\n while (i < size)\n ch = expn[i]\n if (ch == ')')\n count = 0\n while (stk.length != 0 && stk.last != '('.ord)\n stk.pop()\n count += 1\n end\n if (count <= 1)\n return true\n end\n else\n stk.push(ch)\n end\n i += 1\n end\n return false\nend", "title": "" }, { "docid": "79631cf5ef552f7191803da99473bb9e", "score": "0.53600764", "text": "def valid_parenth(string)\n string.tr!('^()', '')\n n = (string.length / 2)\n\n n.times do\n string.slice!(\"()\")\n end\n \n string.length > 0 ? false : true\nend", "title": "" }, { "docid": "25214e0169358dd5bd385b8acb189dc0", "score": "0.53594285", "text": "def create_lines(n)\n upper_part = (n - 1) / 2\n empty = ' '\n starlines = []\n\n upper_part.times do |row|\n spaces = (n - 3 - (row * 2)) / 2\n starlines << \"*#{empty * spaces}*#{empty * spaces}*\"\n end\n\n starlines\nend", "title": "" }, { "docid": "9bd35e9d778642a06f41f4ce6c46e0a3", "score": "0.53506094", "text": "def staircase(n)\n j = n - 1\n res = \"\"\n n.times do |i|\n res += (\" \" * j) + (\"#\" * (i+1)) + \"\\n\"\n j -= 1\n end\n\n res\nend", "title": "" }, { "docid": "69e6a8ab9cd995917eba3f2a52177ce9", "score": "0.53503275", "text": "def possible_combinations\n with_3_digit = @phone_number[0..2]\n with_4_digit = @phone_number[0..3]\n with_6_digit = @phone_number[6..9]\n with_7_digit = @phone_number[7..9]\n [\n [@phone_number],\n [@phone_number[0..4], @phone_number[5..9]],\n [with_4_digit, @phone_number[4..9]],\n [@phone_number[0..5], with_6_digit],\n [with_3_digit, @phone_number[3..5], with_6_digit],\n [with_3_digit, @phone_number[3..6], with_7_digit],\n [with_4_digit, @phone_number[4..6], with_7_digit],\n [with_3_digit, @phone_number[3..9]],\n [@phone_number[0..6], with_7_digit]\n ]\n end", "title": "" }, { "docid": "4a082a4eb74b9694c31ddfaf560bd5c9", "score": "0.533823", "text": "def pattern(n)\n s = []\n for i in 1..n\n s << \"#{i}\" * i\n end\n return s.join(\"\\n\")\nend", "title": "" }, { "docid": "80547b8e11f5b1dc839890f85a891ad7", "score": "0.53356576", "text": "def ngrams(n, string)\n string.split(' ').each_cons(n).to_a\n end", "title": "" }, { "docid": "168d9537594f7c8bdaf47b2f85d7b83a", "score": "0.5334879", "text": "def combinations(string)\n combine(string, \"\", 0)\nend", "title": "" }, { "docid": "62ca6d44d52e1fe487c84ce8af8893e5", "score": "0.53341955", "text": "def parse_ngrams(n, string)\n string.split(' ').each_cons(n).to_a\nend", "title": "" }, { "docid": "d893bce9f7decd4d294b4c8e764e9d4b", "score": "0.53215474", "text": "def replacement_patterns_of(prime_str)\n replaced_indexes = (0...prime_str.length).to_a.\n group_by { |idx| prime_str[idx].to_i }.values.\n select { |g| g.length >= 2 }\n\n replaced_indexes.flat_map { |g|\n (2..g.length).flat_map { |i| g.combination(i).to_a }\n }.map { |idxes|\n idxes.reduce(prime_str.dup) {|mem, idx| mem[idx] = 'x'; mem }.to_sym\n }\nend", "title": "" }, { "docid": "9edbcef3b5319fee5e90841dd711bcb6", "score": "0.53044724", "text": "def tower_builder_x(n)\n (1..n).map do |lvl|\n space = ' ' * (n - lvl)\n stars = '*' * (lvl * 2 - 1)\n space + stars + space\n end\nend", "title": "" }, { "docid": "8a87052833f8d139e1894ba6b06fc95e", "score": "0.5301321", "text": "def repetitive_pairs?\n return false if @number.length % 2 == 1\n\n groups, valid = [], true\n\n groups = @number.chars.each_slice(2).map(&:join)\n groups.each_with_index do |pair, i|\n if valid && (i < groups.length-1)\n valid = (pair == groups[i+1])\n end\n end\n valid\n end", "title": "" }, { "docid": "97d58632a50367834176937dc2cb3937", "score": "0.52955985", "text": "def triple_trouble(one, two, three)\n one.chars.zip(two.chars).zip(three.chars).flatten.join\nend", "title": "" }, { "docid": "2c6460873370b0d7a9555628cac16f7f", "score": "0.52946824", "text": "def find_parens_recurse(to_open, to_close = 0, state = '')\n if to_open == 0 && to_close == 0\n @solution_array << state\n end\n\n if to_open > 0\n find_parens_recurse(to_open - 1, to_close + 1, state + '(')\n end\n\n if to_close > 0\n find_parens_recurse(to_open, to_close - 1, state + ')')\n end\n end", "title": "" }, { "docid": "61c86217b3392d7e68110bb92eb47419", "score": "0.5282169", "text": "def n_values(n)\n s = 'values('\n (1..n).each { |i| s += \"$#{i}, \" }\n s[0..-3] + ')'\nend", "title": "" }, { "docid": "21b90499a06c710b44f89d86d2add7b5", "score": "0.5279545", "text": "def balancer(str)\n parenthesis = []\n index = 0\n \n str.each_char do |char|\n if char == '('\n parenthesis << false\n elsif char == ')'\n return false if parenthesis.empty?\n parenthesis[index] = !parenthesis[index]\n index += 1\n end\n end\n \n parenthesis.all?\nend", "title": "" }, { "docid": "9fad258235714fe7883da8daed33255d", "score": "0.52774537", "text": "def generate_chains(pairs_array)\n\t\tn = pairs_array.size();\n\t\tused_indexes = n.times.map{{}};\n\t\tcurr_indexes = [ 0 ] * n;\n\t\tchains = [];\n\n\t\tfor i in 0..n-1 do\n\t\t\twhile curr_indexes[i] < pairs_array[i].size do \n\t\t\t\tif used_indexes[i][curr_indexes[i]] != nil\n\t\t\t\t\tcurr_indexes[i] += 1;\n\t\t\t\t\tnext;\n\t\t\t\tend\n\t\t\t\tused_indexes[i][curr_indexes[i]] = 1;\n\t\t\t\t# start chain creation\n\t\t\t\tchild_pairs = n.times.map{[]};\n\n\t\t\t\trec = pairs_array[i][curr_indexes[i]][2] != nil;\n\n\t\t\t\tchild_pairs[i] = (pairs_array[i][curr_indexes[i]][2]) if pairs_array[i][curr_indexes[i]][2] != nil\n\t\t\t\tchain = \n\t\t\t\t[i,\n\t\t\t\t\t[\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tpairs_array[i][curr_indexes[i]][0],\n\t\t\t\t\t\t\tpairs_array[i][curr_indexes[i]][1]\n\t\t\t\t\t\t]\n\t\t\t\t\t]\n\t\t\t\t];\n\t\t\t\tk = i + 1;\n\t\t\t\ttid = pairs_array[i][curr_indexes[i]][1];\n\t\t\t\twhile k != n do\n\t\t\t\t\tnexus = pairs_array[k].drop(curr_indexes[k]).index{|x| x[0] == tid}\n\t\t\t\t\tif (nexus == nil) then\n\t\t\t\t\t\tbreak;\n\t\t\t\t\telse\n\t\t\t\t\t\tnexus += curr_indexes[k];\n\t\t\t\t\t\tbreak if used_indexes[k][nexus] != nil\n\t\t\t\t\t\tused_indexes[k][nexus] = 1;\n\t\t\t\t\t\t\n\t\t\t\t\t\tchild_pairs[k] = (pairs_array[k][nexus][2]) if pairs_array[k][nexus][2] != nil\n\n\t\t\t\t\t\tchain[1].push([pairs_array[k][nexus][0],pairs_array[k][nexus][1]]);\n\t\t\t\t\t\ttid = pairs_array[k][nexus][1];\n\t\t\t\t\t\tk += 1;\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tchain.push(generate_chains(child_pairs)) if rec\n\t\t\t\tchains.push(chain);\n\n\t\t\t\tcurr_indexes[i] += 1;\n\t\t\tend\n\t\tend\n\n\t\t# sort\n\t\tchains.bubble_sort! do |x,y|\n\t\t\t# TODO add intersection here! Add convertation to line!\n\t\t\tx_range = x[0]..(x[0] + x[1].size)\n\t\t\ty_range = y[0]..(y[0] + y[1].size)\n\n\n\t\t\tstr_inter = x_range & y_range;\n\n\t\t\tx_min = 0;\n\t\t\ty_min = 0;\n\n\t\t\tx_by_lines = x[1].map{|i| i[0]} + [x[1].last[1]]\n\t\t\ty_by_lines = y[1].map{|i| i[0]} + [y[1].last[1]]\n\n\t\t\tif str_inter != nil\n\t\t\t\tx_range = str_inter;\n\t\t\t\ty_range = str_inter;\n\t\t\tend\n\t\t\t\n\t\t\tx_range.each{ |i| x_min = [x_min, x_by_lines[i - x[0]]].max }\n\t\t\ty_range.each{ |i| y_min = [y_min, y_by_lines[i - y[0]]].max }\n\t\t\tx_min <=> y_min;\n\t\tend\n\n\t\treturn chains;\n\tend", "title": "" }, { "docid": "d2a58bf63cf3ebff13cd11e7393100b9", "score": "0.5268679", "text": "def make_permutations num_heads\n tupcalc = \"\"\n for i in 0..num_heads\n tupcalc += \" list_of[#{i}].each { |list#{i}| \\n\"\n end\n tupcalc += \" tuple = Tuple.new \\n\"\n for i in 0..num_heads\n tupcalc += \" tuple.facts << list#{i}\\n\"\n end\n tupcalc += \" handle tuple\\n\"\n for i in 0..num_heads\n tupcalc += \" }\\n\"\n end\n return tupcalc\n end", "title": "" }, { "docid": "e95b76246af025a1ef1561652e64c47b", "score": "0.52664", "text": "def genpents\n s = []\n a, b, c, d, sign = 0, 1, 0, 2, 1\n\n begin\n s << a\n a += b\n b += c\n c += (sign * d)\n d += 1\n sign = -sign\n end until self < a \n\n s\n end", "title": "" }, { "docid": "41b3542828a23989fb967f8b2bc2ea0d", "score": "0.52621746", "text": "def valid_parentheses(string)\n # not really necessary for the challenge, but not necessarily hurting things\n # either I guess\n return false unless valid_input? string\n\n # the previous character doesnt change the validity of parentheses and can be\n # omitted entirely\n prev_char = ''\n open = 0\n\n # the run time is going to scale with the size of the string so it's not that\n # helpful to remove the alphanumeric characters\n # use #chars instead of #split to grab all the characters\n remove_alphanumeric(string).split('').each do |char|\n # open? / close? are unecessary functions that just clutter things\n if open?(char)\n open += 1\n # as above remove references to previous character\n elsif close?(char) && (prev_char.empty? || open <= 0)\n return false\n elsif close?(char)\n open -= 1\n end\n\n # this added a ton of lines for no reason :/\n prev_char = char\n end\n\n open == 0\nend", "title": "" }, { "docid": "075670057dfca25e7e427a3053090934", "score": "0.5256571", "text": "def pandig_string()\r\n\t# We have 10! combinations possible\r\n\tproc_adder = Proc.new{ |add, condition, tmp, num, index|\r\n\t\tnext unless([add].flatten == [add].flatten.uniq)\r\n\t\tnext unless(num - [add].flatten == num)\r\n\t\tnext unless(condition)\r\n\t\tto_add = num.clone\r\n\t\t[index].flatten.each_with_index{ |i, ii| \r\n\t\t\tto_add[i] = [add].flatten[ii]\r\n\t\t}\r\n\t\ttmp << to_add\r\n\t}\r\n\r\n\t# The returner\r\n\tthe_nums = []\r\n\r\n\t# x4x5x6 % 5 ==> x6 == {0, 5}\r\n\tthe_nums << [nil, nil, nil, nil, nil, 0, nil, nil, nil, nil]\r\n\tthe_nums << [nil, nil, nil, nil, nil, 5, nil, nil, nil, nil]\r\n\r\n\t# All special runs are over -- next can be systemized\r\n\tcheks = [\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# ADD DIGITS:\r\n\t\t\t\t[ 9, Proc.new{ |a, n| a % 2 == 0 }, 3],\t# 4: x2x3x4 % 2 ==> x4 % 2\r\n\t\t\t\t[98, Proc.new{ |a, n| (a[0] + n[3] + a[1]) % 3 == 0 }, [2, 4]],\t# 3, 5: x3x4x5 % 3 ==> x3+x4+x5 % 3\r\n\t\t\t\t[ 9, Proc.new { |a, n| (n[4]*10 + n[5] - 2*a) % 7 == 0 }, 6],\t# 7: x5x6x7 % 7 == > x5x6 - 2*x7 % 7\r\n\t\t\t\t[ 9, Proc.new { |a, n| \"#{n[5]}#{n[6]}#{a}\".to_i % 11 == 0 }, 7],\t# 8: x6x7x8 % 11\r\n\t\t\t\t[ 9, Proc.new { |a, n| \"#{n[6]}#{n[7]}#{a}\".to_i % 13 == 0 }, 8],\t# 9: x7x8x9 % 13\r\n\t\t\t\t[ 9, Proc.new { |a, n| \"#{n[7]}#{n[8]}#{a}\".to_i % 17 == 0 }, 9],\t# 10: x8x9x10 % 17\r\n\t\t\t\t[ 9, Proc.new { |a, n| true }, 0], \t# 1: x1 can be any\r\n\t\t\t\t[ 9, Proc.new { |a, n| true }, 1]\t# 2: x2 can be any\r\n\t\t\t]\r\n\r\n\tcheks.each{ |max_num, the_proc, the_index| \r\n\t\ttmp = []\r\n\t\tthe_nums.each{ |num|\r\n\t\t\t(0..max_num).each{ |add|\r\n\t\t\t\tto_add = add\r\n\t\t\t\tif(max_num.to_s.size > 1)\r\n\t\t\t\t\tto_add = '0'*(max_num.to_s.size - add.to_s.size) + add.to_s\r\n\t\t\t\t\tto_add = to_add.split('').map{ |a| a.to_i }\r\n\t\t\t\tend\r\n\t\t\t\tproc_adder.call(to_add, the_proc.call(to_add, num), tmp, num, the_index)\r\n\t\t\t}\r\n\t\t}\r\n\t\tthe_nums = tmp\r\n\t}\r\n\r\n\tthe_nums.each{ |num| puts num.join(',') }\r\n\t\r\n#\tputs '________________'\r\n\treturner = the_nums.map{ |row| row.join('').to_i }\r\n\treturn returner.inject(0){ |sum, num| sum + num.to_i }\r\nend", "title": "" }, { "docid": "49208b4d08715b82ad653af1dba83917", "score": "0.5252073", "text": "def wielkaliczba(n)\n\tstr = n.to_s\n\tindex = 1\n\tfor index in 1..5\n\t\tline = \"\"\n\n\t\tfor i in 0..n-1\n\t\t\tline << strFrag(str[i],index) \n\t\t\t\n\t\tend\n\t\tputs line\n\tend\nend", "title": "" }, { "docid": "f3ab0402a7df0cd3c338585872495284", "score": "0.5250705", "text": "def staircase(n)\n n = n\n (1..n).each do |i|\n s = ''\n (n - 1).downto(0) do |j|\n s += i <= j ? ' ' : '#'\n end\n puts s\n end\nend", "title": "" }, { "docid": "d07adb86dcb728dacdbaa6e91a57625f", "score": "0.5250279", "text": "def substrings_of(n)\n chars.each_cons n\n end", "title": "" }, { "docid": "5723e43762f33805ca41f0fa619d0ba1", "score": "0.5248023", "text": "def all_word_pairs(str)\n words = str.split(\" \")\n result = []\n\n outer_loop = 0\n while outer_loop < words.length\n inner_loop = outer_loop + 1 ## Alternative to the edge case check\n while inner_loop < words.length\n result << [words[inner_loop], words[outer_loop]] # Could do unless inner_loop == outer_loop and change line 10 to inner_loop = outer_loop\n inner_loop += 1\n end\n outer_loop += 1\n end\n result\nend", "title": "" }, { "docid": "40bef147bade5d0bbc84d3647dd874a4", "score": "0.52475905", "text": "def generate_all_possibilities\n a = ['red ', 'yellow ', 'green ', 'blue ', 'orange ','purple ']\n @list = a.repeated_permutation(4).map(&:join)\n @list = @list.map do |phrase|\n phrase.split(' ')\n end\n puts \"\\n\\n possibilities list is #{@list.length} long\\n\\n\"\n end", "title": "" }, { "docid": "061941414fe3da9531200216cfca1c51", "score": "0.5247351", "text": "def create_set\n s = []\n 1.upto(6) { |w| 1.upto(6) { |x| 1.upto(6) { |y| 1.upto(6) { |z| s.push(\"#{w}#{x}#{y}#{z}\") } } } }\n s\n end", "title": "" }, { "docid": "a9379d0524f2f55a80c09f6d36aac0f9", "score": "0.52452725", "text": "def triangle(n, upper_or_lower, left_or_right)\n if upper_or_lower == 'upper'\n str = '*' * n\n target_size = 0\n elsif upper_or_lower == 'lower'\n str = ''\n target_size = n\n end\n \n until str.size == target_size\n str << '*' if upper_or_lower == 'lower'\n puts str.ljust(n) if left_or_right == 'left'\n puts str.rjust(n) if left_or_right == 'right'\n str.chop! if upper_or_lower == 'upper'\n end\nend", "title": "" }, { "docid": "dce21f4e6ad50d869dc8737fa8ea1a24", "score": "0.5242292", "text": "def pair(names)\r\n\tarray = []\r\n\t#Creates an empty array to hold objects later called\r\n\tarray_paired_names = names.shuffle.each_slice(2)\r\n\t#Shuffles the names to create random picks, \r\n\t#takes the results and slices out 2, \r\n\t#puts them in an array of (2)\r\n\t#creating the pairs\r\n\r\n\tarray_paired_names.each do |pair|\r\n\t\t#interates over each element in the array of names\r\n\t\tif pair.length == 2\r\n\t\t\tarray << pair\r\n\t\t\t#if the number of names is 2, print the pair\r\n\t\telse\r\n\t\t\t(array.last << pair).flatten!\r\n\t\t\t#if there is a remainder, pushes the last array(of one)\r\n\t\t\t#into the last returned pair, .flatten! changes it to part of the string\r\n\t\tend\r\n\tend\r\n\tarray\r\n\t\r\nend", "title": "" }, { "docid": "24584985d605aeff23e85cf963cbefe3", "score": "0.524035", "text": "def combination(str)\n result = [\"\"]\n do_combination(str, result)\nend", "title": "" }, { "docid": "29409e47d6b4e14746c1513957d50afc", "score": "0.5238526", "text": "def gen_str strLen\n\tsortedAlphabet = @alphabet.sort\n resultStrs = [ ] \n testStrings = [ ]\n testStrings[0] = [] \n testStrings[0].push \"\"\n 1.upto(strLen.to_i) { |x|\n testStrings[x] = []\n testStrings[x-1].each { |s|\n sortedAlphabet.each { |c|\n testStrings[x].push s+c\n }\n }\n }\n testStrings.flatten.each { |s|\n resultStrs.push s if accept? s\n }\n result = \"\"\n resultStrs.each { |x| result.concat '\"'+x+'\" ' }\n result\n end", "title": "" }, { "docid": "29409e47d6b4e14746c1513957d50afc", "score": "0.5238526", "text": "def gen_str strLen\n\tsortedAlphabet = @alphabet.sort\n resultStrs = [ ] \n testStrings = [ ]\n testStrings[0] = [] \n testStrings[0].push \"\"\n 1.upto(strLen.to_i) { |x|\n testStrings[x] = []\n testStrings[x-1].each { |s|\n sortedAlphabet.each { |c|\n testStrings[x].push s+c\n }\n }\n }\n testStrings.flatten.each { |s|\n resultStrs.push s if accept? s\n }\n result = \"\"\n resultStrs.each { |x| result.concat '\"'+x+'\" ' }\n result\n end", "title": "" }, { "docid": "3be7214ea7b60d534161664eb3c59b2c", "score": "0.52262115", "text": "def group_in(n = 0)\n self.scan(/.{#{n}}|.+/).join(\" \")\n end", "title": "" }, { "docid": "3cfb490e8d22e6311ba5d9426aaf21f0", "score": "0.5218207", "text": "def stair_case(n)\n (1..n).each do |i|\n puts \" \"*(n-i) + \"#\"*i\n end\nend", "title": "" }, { "docid": "e6b2ab011987956549eaefcd7f27d67e", "score": "0.5217036", "text": "def rna_to_protein(rna, pairs)\n result = \"\"\n rna.chars.each_slice(3) do |el|\n codon = el.join\n pairs.find do |rna, amino|\n break if (rna == codon && amino == \"Stop\")\n result << amino if rna == codon\n end\n end\n result\nend", "title": "" }, { "docid": "a5bd309c4cee9ce69a46fd683ea6dd5f", "score": "0.52092755", "text": "def triple_trouble(one, two, three)\n index = 0\n answer = String.new\n one.length.times do\n answer += (one[index]+two[index]+three[index])\n index+=1\n end\n answer\nend", "title": "" }, { "docid": "3bc9454816f0bfa5afc74c8c42d8a4f9", "score": "0.5209061", "text": "def triangle2(n)\r\n first_line = '*'\r\n (n-1).times do\r\n first_line.prepend(' ')\r\n end\r\n lines = ''\r\n lines += first_line\r\n i = 1\r\n loop do\r\n first_line[-1-i] = '*'\r\n lines << \"\\n#{first_line}\"\r\n i += 1\r\n break if i == n \r\n end\r\n puts lines\r\nend", "title": "" }, { "docid": "84c33fa93b0b87cf94f1efd0168899f0", "score": "0.5208337", "text": "def pair_digraphs(str)\n str = normalize str\n i = 0\n while i < str.size - 1\n str.insert(i, ' ') if (i + 1) % 3 == 0\n i += 1\n end\n #str.each_byte { |b| str.insert(str.index(b.chr), ' ') if str.index(b.chr) % 3 == 0 }\n str\n end", "title": "" }, { "docid": "3f1e5fbe67a2385597de191f2e6d6cdf", "score": "0.5207374", "text": "def nested(s)\n # will need the length to be even to make a pair\n if s.length.odd?\n return false\n elsif s == ''\n return true\n elsif (s[0] != \"(\" || s[-1] != \")\")\n return false\n else \n # move one pair inward at a time\n return nested(s[1..-2])\n end\nend", "title": "" }, { "docid": "8af0d40c1088cd8b108be82a04435d8d", "score": "0.52063143", "text": "def solution(list)\n res = \"\"\n i = 0\n while i < list.length\n range_end = return_range_end(list, i)\n res += range_end > i ? \"#{list[i]}-#{list[range_end]},\" : \"#{list[i]},\"\n i = range_end + 1\n end\n res.slice(0..-2)\nend", "title": "" }, { "docid": "1076db11f9d68ccf23ea6fabe2fdbfb1", "score": "0.5205423", "text": "def kolakoski(n)\r\n queue = [2]\r\n seq = \"122\" # start with 122 \r\n lastLenOne = false\r\n \r\n while seq.length < n.to_i\r\n blockLen = queue.shift\r\n last = seq[-1]\r\n \r\n opp = last == \"1\" ? \"2\" : \"1\"\r\n \r\n if blockLen == 1\r\n seq << opp\r\n queue.push(opp.to_i)\r\n lastLenOne = true\r\n elsif blockLen == 2 && seq[-2] != last && !lastLenOne\r\n seq << last\r\n queue.push(last.to_i)\r\n lastLenOne = false\r\n else\r\n seq << opp << opp\r\n queue.push(opp.to_i)\r\n queue.push(opp.to_i)\r\n lastLenOne = false\r\n end\r\n end\r\n \r\n if seq.length > n.to_i\r\n seq = seq[0...n.to_i] # remove excess symbols\r\n end\r\n \r\n return seq\r\nend", "title": "" }, { "docid": "fcae4306add054b150a0625bc0e7ca02", "score": "0.5205271", "text": "def build_2_letter_combos\n @build_2_letter_combos ||= build_alphabet.map {|a| build_alphabet.map {|b| \"#{a}#{b}\"}}.flatten[0..29]\nend", "title": "" }, { "docid": "e80bc90d4d079599e0bde14117e12c9d", "score": "0.5203167", "text": "def newman_conway(num)\n raise ArgumentError if num == 0\n return \"1\" if num == 1\n return \"1 1\" if num == 2\n\n sequence = [0, 1, 1]\n\n answer = \"1 1\"\n\n (3..num).each do |n|\n p_last = sequence[n - 1]\n sequence << (sequence[p_last] + sequence[n - p_last])\n answer += \" #{sequence[n]}\"\n end\n return answer\nend", "title": "" }, { "docid": "d33110fa8c637bf5197f9fb570b035b7", "score": "0.51910424", "text": "def get_combination(str , prefix)\n tokens = str.split ; result = \"\"\n return str if tokens.size == 1\n 0.upto(tokens.size-2) do |i|\n result += \"##{prefix}(#{tokens[i..i+1].join(' ')}) \"\n end\n result\n end", "title": "" }, { "docid": "89f33c7418c105bb58551a97c4e087d9", "score": "0.5191031", "text": "def state_permutations(state)\n curfloor = state[0].to_i\n curpairs = []\n i = 1\n while i < state.length\n curpairs += state[i..i+1].chars.map(&:to_i)\n end\nend", "title": "" }, { "docid": "a42bc309b3978317527cf6ef054dbf5a", "score": "0.5188879", "text": "def remove_pairs(string)\n return true if string.size == 0\n open_index = string.index('()')\n return false if open_index.nil?\n string.slice!(open_index, 2)\n string\n balanced?(string)\nend", "title": "" }, { "docid": "bfa4d77a9c872db38395d3563bf04edb", "score": "0.51860476", "text": "def simplify(bb, ab)\n i=1\n opr=[]\n count=0\n ptr=1\n iend=ab.length()\n while i < iend\n #print \"\\n #{i} \\t #{ab[i]}\"\n if ab[i] == '('\n j = extract2(i+1, ab)\n gg = ab[i,j[0]-i]\n print \"\\n gg \\t #{gg}\"\n pas = gg.split(/\\W([><+-^\\*\\,\\.\\s]*)/)\n pas = pas.reject { |c| c.empty? }\n pas = pas.reject { |c| c==\" \"}\n #pas = squash(pas)\n opr.push(pas)\n i=j[0]\n count=count+pas.length\n ptr=ptr + j[1]\n elsif ab[i] == ' '\n i=i+1\n next\n elsif ab[i] == ')'\n i=i+1\n next\n else\n #pas = squash(bb[0][count])\n pas=bb[0][count]\n opr.push(pas)\n i=i+bb[0][count].length\n count=count+1\n end\n print \"\\n printing opr #{i} \\t\"\n #print opr\n end\n opr=squash2(opr)\n return opr\nend", "title": "" } ]
296a0da3a5ec064f64efcafdf0a1615f
Write a method that returns a boolean indicating whether a string has repeating letters. Capital letters count as repeats of lowercase ones, e.g., repeating_letters?("Aa") => true
[ { "docid": "78970ab5ab9e0b836e01002336bccd89", "score": "0.82091814", "text": "def repeating_letters?(str)\r\n # your code goes here\r\n str = str.downcase.split(\"\")\r\n temp = \"\"\r\n i = 0\r\n while i < str.length\r\n if temp.include?(str[i])\r\n return true\r\n else\r\n temp << str[i]\r\n end\r\n i += 1\r\n end\r\n false\r\nend", "title": "" } ]
[ { "docid": "80ba39a181b8975b262532138b063bbf", "score": "0.8943327", "text": "def repeating_letters?(str)\n str.downcase.chars.uniq.length != str.length\nend", "title": "" }, { "docid": "0be06fbdec6fca604d8a39c1c2af0401", "score": "0.8876545", "text": "def repeating_letters?(str)\n # your code goes here\n str.downcase.chars.uniq.length != str.downcase.chars.length\nend", "title": "" }, { "docid": "088a213263b016d65d60c7428219fe3c", "score": "0.8870797", "text": "def repeating_letters?(str)\n # your code goes here\n str.downcase.chars.uniq.length != str.downcase.chars.length\n\n end", "title": "" }, { "docid": "d84f5e9cd98bdd3e70ffe1526e548374", "score": "0.87463254", "text": "def repeating_letters?(str)\n # your code goes here\n str.each_char do |ch|\n if str.downcase.count(ch) > 1\n return true\n end\n end\n false\nend", "title": "" }, { "docid": "aef8cb013870b45b156a3a93a46350c7", "score": "0.8554358", "text": "def repeating_letters?(str)\n str = str.downcase\n i = 0\n while i < str.length - 1\n return true if str[i] == str[i + 1]\n i += 1\n end\n false\nend", "title": "" }, { "docid": "beed61eb2f3177bf64af3ba7aa750396", "score": "0.8481204", "text": "def repeating_letters?(str)\n # your code goes here\n # new_str = str.downcase\n # hash = Hash.new(0)\n\n # new_str.each_char do |char|\n # hash[char] += 1\n # end\n\n # hash.each do |k,v|\n # if v > 1\n # return true\n # end\n # end\n # false\n\n str.downcase.chars.uniq.length != str.length\nend", "title": "" }, { "docid": "3927476b0d2ab775c8340a3440914576", "score": "0.8415831", "text": "def repeating_letters?(str)\n i = 0\n while i < str.length - 1\n return true if str[i].downcase == str[i + 1].downcase\n i += 1\n end\n false\nend", "title": "" }, { "docid": "38eab1c7cce70a0fb80e31bde2b86059", "score": "0.83206564", "text": "def repeating_letters?(str)\n dStr = str.downcase.chars\n checkStr = \"\"\n\n dStr.each do |char|\n if checkStr.index(char) != nil\n return true\n else\n checkStr += char\n end\n end\n false\nend", "title": "" }, { "docid": "1f020d5379c77b7e4236e54c934f2148", "score": "0.8054649", "text": "def repeating_letters?(str)\n index = 0\nnew_str = str.split(\"\").sort.join.downcase\n\nwhile index < str.length\n if new_str[index] == new_str[index + 1]\n return true\n end\n index += 1\nend\nfalse\n\nend", "title": "" }, { "docid": "6baa7f5a59a0a7156a43176e3c55e578", "score": "0.73442096", "text": "def duplicates?(word)\n\t\t# Go through the range a-z counting if each letter is only in the word string 0 or 1 times\n\t\t(START_LETTER..END_LETTER).all? { |letter| word.count(letter) <= 1 } # will automatically return true or false\n\tend", "title": "" }, { "docid": "0afa0c250cb84fa3e35e8378e64f7a61", "score": "0.7271429", "text": "def panagram3?(string)\n string.downcase.scan(/[a-z]/).uniq.size == 26\nend", "title": "" }, { "docid": "3157667158ed00b8581e83141e124905", "score": "0.7266092", "text": "def unique_letters(str)\n # store a key/value pair of each letter in a word where\n # key = letter and value = nil or 0 or 1\n letter_count = {}\n has_unique_letters = true\n\n # iterate through each letter of a word\n str.chars.each do |letter|\n # check if the count of the letter has already been incremented\n # if no, add 1\n # if yes, return false\n if letter_count[letter].nil? || (letter_count[letter]).zero?\n letter_count[letter] = 1\n else\n has_unique_letters = false\n end\n end\n\n # return status of a\n has_unique_letters\n end", "title": "" }, { "docid": "6af6c5641c4fb0578d222ad4d951937a", "score": "0.72015977", "text": "def double_letter_count(string)\n repeating_letters = 0\n string.each_char.with_index do |char, i|\n if string[i] == string[i + 1]\n repeating_letters += 1\n end\n end\n return repeating_letters\nend", "title": "" }, { "docid": "32cd47cd1b09e44321b2be7d362c5f51", "score": "0.71925545", "text": "def all_letters_uniq?\n @my_word.chars.each do |letter|\n return false if (@my_word.count letter) > 1\n end\n true\nend", "title": "" }, { "docid": "946e55d13701eca7a04f62fee145d001", "score": "0.71814245", "text": "def panagram?(string)\n string.downcase.scan(/[a-z]/).uniq.size == 26\nend", "title": "" }, { "docid": "aca058733c9134a759d4836c63c7db3c", "score": "0.718018", "text": "def panagram?(string)\n return false if string.length < 26\n\n letters = string.downcase.gsub(/[^a-z]/, '')\n letters.chars.uniq.count >= 26\nend", "title": "" }, { "docid": "3eb286d60faa86c3e383fe88d2c07777", "score": "0.7115457", "text": "def is_unique str\n uniqueness = true\n str.each_char do |char| \n if str.downcase.count(char.downcase) > 1\n uniqueness = false\n break\n end \n end\n uniqueness \nend", "title": "" }, { "docid": "652fccc8bc44f576f328e8618dec6878", "score": "0.70597386", "text": "def repeat_with_gap?\n letters = split('')\n letters.each.with_index do |letter, i|\n next_with_gap = letters[i + 2]\n return true if letter == next_with_gap\n end\n\n false\n end", "title": "" }, { "docid": "da1ea019f91b5fd59b25c4e08c08d6bc", "score": "0.70087284", "text": "def is_unique?(str)\n letters = {}\n\n str.chars.each do |char|\n return false if letters[char]\n letters[char] = true\n end\n\n true\nend", "title": "" }, { "docid": "fad550d893ba35ec9e12f7e089530751", "score": "0.6998661", "text": "def unique(string)\n letter_count = {}\n\n # Iterate through the string, if we have not seen the letter_count\n # place it in the hash, if we have seen it return false\n string.split('').each do |char|\n if letter_count[char]\n return false\n else\n letter_count[char] = true\n end\n end\n\n # If we get to this point there are no duplicates, return true\n true\nend", "title": "" }, { "docid": "bc91222be78a674ccac648d828f20f99", "score": "0.6987996", "text": "def uniq_chars?(str)\n str.count(str) == 1 ? true : false\nend", "title": "" }, { "docid": "4d671dd6d7773dcf5c7987a8b03bcde6", "score": "0.6961005", "text": "def isRepeated? subString, str\n\n if str.length % subString.length != 0 then return false end\n\n n = subString.length\n max_repetitions = str.length / n\n (0...max_repetitions).each do |i|\n if str[n*i, n] != subString then return false end\n end\n return true\nend", "title": "" }, { "docid": "bd93f07d977ba8fc6526331db040314c", "score": "0.69280857", "text": "def duplicate_count(text)\n ('a'..'z').count { |c| text.downcase.count(c) > 1 }\nend", "title": "" }, { "docid": "c5820711d2c3644cdadd4622723131f2", "score": "0.6926865", "text": "def all_letters? str\r\n str[/[a-zA-z]+/] == str\r\nend", "title": "" }, { "docid": "ba2478cdf2f99d9ee65bc75f3063d523", "score": "0.69168055", "text": "def is_letter?(letter)\r\n (Alphabet.include? letter.downcase) && (letter.length == 1)\r\n end", "title": "" }, { "docid": "0569a17d07c6fcee857e17b644deefcc", "score": "0.68552524", "text": "def first_non_repeating_letter(s)\n s.chars.find{|char| s.downcase.count(char.downcase) <= 1} || ''\nend", "title": "" }, { "docid": "298a83e9514ba8644dfdccfa2094a394", "score": "0.6852703", "text": "def duplicate_count(text)\n text = text.downcase\n // ('a'..'z').count { |c| text.downcase.count(c) > 1 }\n return text.chars.uniq.count { |char| text.count(char) > 1 }\nend", "title": "" }, { "docid": "3deab58077f6804a618b74552e65945b", "score": "0.6843042", "text": "def check_repeated_char(str)\n\tprev = str[0]\n for i in 1..str.length\n \tif prev == str[i]\n \t\treturn true\n \telse\n \t\tprev = str[i]\n \tend\n end\n\n return false\nend", "title": "" }, { "docid": "4b8fb8fd631cc864854a3e4b24b202ab", "score": "0.679992", "text": "def repetitionEncryption(letter)\n pattern = /(\\w+)[\\d\\W]+\\1\\b/i\n return letter.scan(pattern).size\nend", "title": "" }, { "docid": "9617fdf0ee709df91eaa1df8ec4e4d12", "score": "0.6781872", "text": "def non_unique_letters(string)\n alpha = ('a'..'z').to_a\n our_new_letters = []\n counters = Hash.new(0)\n arr = string.downcase.split(\"\").select {|letter| string.count(letter) > 1}\n arr.each do |c|\n counters[c] += 1\n our_new_letters << c if counters[c] <= 1\n end\n our_new_letters.select {|x| alpha.include?(x)}\nend", "title": "" }, { "docid": "0002ed3ae91493e64a7fb898c753e0ec", "score": "0.67569524", "text": "def panagram2?(string)\n ('a'..'z').all? { |letter| string.downcase.include?(letter) }\nend", "title": "" }, { "docid": "3a6cea3318174068363377461835a9c2", "score": "0.67334837", "text": "def string_has_all_letters(str)\n result = {}\n str.each_char do |c|\n return true if result.length == 26\n if c == \" \"\n next\n elsif !result.include?(c)\n result[c] = c\n end\n end\n result.length == 26 ? true : false\nend", "title": "" }, { "docid": "830772986d77de244e1f2e90e311a468", "score": "0.6711661", "text": "def double_letter_count(string)\r\n repeats = 0\r\n oldChar = ''\r\n string.each_char do |char|\r\n if oldChar == char\r\n repeats += 1\r\n end\r\n oldChar = char\r\n end\r\n return repeats\r\nend", "title": "" }, { "docid": "6a6accf84acb168c63c43f792887a627", "score": "0.67070526", "text": "def panagram?(string)\n return false if string.gsub(/[^a-zA-Z]/, '').length < 26\n seen = string.split(\"\").reduce([]) do |seen, char|\n char = char.downcase\n seen.push(char) if !seen.include?(char) && char =~ /[a-z]/\n seen()\n end\n !(seen.length < 26)\nend", "title": "" }, { "docid": "630a05aca1e06233ab63b77602b026f5", "score": "0.67045516", "text": "def isUniqueChars(str)\n\tstats = Hash.new(0)\n\tstr.split('').each do |char|\n\t\tstats[char] += 1\n\t\treturn false if stats[char] > 1\n\tend\n\treturn true\nend", "title": "" }, { "docid": "1ff7e387f41e5982a1295cae74414f54", "score": "0.6700011", "text": "def first_non_repeating_letter(str)\n str.chars.each { |char| return char if str.downcase.count(char.downcase) == 1 }\n ''\nend", "title": "" }, { "docid": "16869467253362f94c8a64613a807d13", "score": "0.6694675", "text": "def first_non_repeating_letter(str)\n return '' if str.empty? || str.chars.uniq.size <= str.size/2\n str.chars.each { |e| return e if str.downcase.count(e.downcase) == 1 }\nend", "title": "" }, { "docid": "5702958fae2569f11e70f15a3da6fee0", "score": "0.6691661", "text": "def repeated_substring_pattern(s)\n return false if !s\n (s + s)[1...-1].include?(s)\nend", "title": "" }, { "docid": "827280e40210902fb017cae5e7c6167d", "score": "0.6687638", "text": "def repeating_pair?(text)\n text.match(/(\\w{2})\\w*\\1/) ? true : false\nend", "title": "" }, { "docid": "5cb6cf28456d66be0431121b70cc4ba4", "score": "0.66823834", "text": "def pangram?(s)\n y = s.downcase.split(//).sort.uniq\n y.keep_if { |i| i =~ /[a-z]/ }\n y.length == 26 ? true : false\nend", "title": "" }, { "docid": "13c174c8d847dd58c691c108bd814534", "score": "0.66789985", "text": "def unique_char_cheater?(string)\n return false if string.split(\"\").uniq.size != string.size\n true\nend", "title": "" }, { "docid": "dd50e2f613eb4099761fbf34fe5f1b90", "score": "0.66580504", "text": "def is_unique(string)\n chars = Hash.new(0)\n\n string.each_char do |ch|\n chars[ch] += 1\n \n if chars[ch] > 1\n return false\n end\n end\n\n true\nend", "title": "" }, { "docid": "7921da777507550d9e74d28ce1bd29d2", "score": "0.66342807", "text": "def include?(word, letters)\n word.upcase.chars.all? { |letter| word.count(letter) <= letters.count(letter) }\n end", "title": "" }, { "docid": "edae3149f4bfa08f9ff093a853ed17f3", "score": "0.6631702", "text": "def num_repeats(string)\r\n idx_str = 0\r\n idx2 = idx_str+1\r\n counter = 0\r\n repeated_letter = \"\"\r\n while idx_str < string.length\r\n if !repeated_letter.include? string[idx_str]\r\n while idx2 < string.length\r\n if string[idx_str] == string[idx2]\r\n repeated_letter += string[idx_str]\r\n counter +=1\r\n break\r\n end\r\n idx2 +=1\r\n end\r\n end\r\n idx_str += 1\r\n idx2 = idx_str+1\r\n end\r\n return counter\r\nend", "title": "" }, { "docid": "662f6974c38ec8400b5e314c05584f58", "score": "0.6630684", "text": "def uniq_chars?(str)\n if str.chars.uniq.length == str.chars.length\n return true\n else \n return false\n end\nend", "title": "" }, { "docid": "c7f943a0e0111ed3082d01775edff42b", "score": "0.66292703", "text": "def panagram?(string)\n alphabet_arr = ('a'..'z').to_a\n \n alphabet_arr.each do |element|\n return false if string.downcase.include?(element) == false\n end\n\n true\nend", "title": "" }, { "docid": "c91e87720520b62626c60820a81be87a", "score": "0.66243917", "text": "def is_isogram(string)\n string.downcase.each_char { |char| return false if string.downcase.count(char) > 1 }\n true\nend", "title": "" }, { "docid": "89118251db53e0ca34d8741d28a12f16", "score": "0.661658", "text": "def anagrams?\n same_length? && same_letters?\n end", "title": "" }, { "docid": "0172e5a4f7a76fa9da64f560cb1661fd", "score": "0.66163456", "text": "def is_unique?(str)\n str = str.chars.sort\n str.each_with_index do |letter, idx|\n next if idx == str.length\n return false if str[idx] == str[idx++1]\n end \n true\nend", "title": "" }, { "docid": "7a3b46593881e1ffa3ca8caba6120a87", "score": "0.6604939", "text": "def not_repeat_year?(year) \n str = year.to_s\n str.each_char do |ele| \n if str.count(ele) > 1\n return false\n end\n end\n true\nend", "title": "" }, { "docid": "bca112a04a23d3a6fbe5a79fd1491798", "score": "0.6601497", "text": "def non_unique_letters(string)\n uniq_letters = string.chars.uniq\n uniq_letters.select { |ch| string.count(ch) > 1 }\nend", "title": "" }, { "docid": "b1617bf095b1ee459f879981b45f63a3", "score": "0.6598801", "text": "def unique_chars_2(string)\n\n if Set.new(string.split('')).length == string.length\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "cfaeaf0ce68135ae4fe298d4d260b352", "score": "0.6577136", "text": "def no_repeat?(year)\n chars_seen = []\n\n years.to_s.each_char do |char|\n return false if chars_seen.include?(char)\n chars_seen << char\n end\n\n return true \nend", "title": "" }, { "docid": "470190051df22979e4ff80cc8ff79334", "score": "0.65756273", "text": "def first_non_repeating_letter(str)\n non_repeats = str.chars.reject do |chr|\n str.downcase.count(chr.downcase) > 1\n end\n non_repeats.empty? ? \"\" : non_repeats.first\nend", "title": "" }, { "docid": "c42d9d3df4c01d713b68e4475320a1bd", "score": "0.6545023", "text": "def non_repeating(str)\n str.chars.find { |char| str.count(char) == 1 }\nend", "title": "" }, { "docid": "63b5d8eb6a8e36d940ec16c2526fb34a", "score": "0.6541729", "text": "def has_duplicate(str)\n\tset = Set.new\n\tstr.chars do |char|\n\t\treturn true if set.include? char\n\t\tset << char\n\tend\n\tfalse\nend", "title": "" }, { "docid": "79582383d71be1b8c1d1b9a2d840ed64", "score": "0.6538499", "text": "def step_through_with(s)i\n # It doesn't solve the kata because it returns true even if same chars are met in diffrent part of the word. Like \"ThaT\"\n s.chars.count == s.chars.uniq.count\nend", "title": "" }, { "docid": "d2520215dd64ab1733a2ab6ed0a31df1", "score": "0.65342396", "text": "def digits_repeat?(number)\n !(number.to_s.chars.eql? number.to_s.chars.uniq)\nend", "title": "" }, { "docid": "5dca6fefc24e4d71f5b7b5b3a7547b70", "score": "0.6526733", "text": "def anagram?(string)\n length_matches(string) && character_count_matches(string)\n end", "title": "" }, { "docid": "93cc7c8c364ef56887b72893bcc4eddd", "score": "0.6516897", "text": "def g_happy(str)\n i = 0\n count = 0\n str.size.times do |letter|\n if str[letter] == \"g\"\n if str[letter] != str[i + 1]\n if str[letter] != str[i - 1]\n return false\n end\n end\n else\n count += 1\n end\n i += 1\n end\n if count == str.size\n return false\n else\n return true\n end\nend", "title": "" }, { "docid": "93cc7c8c364ef56887b72893bcc4eddd", "score": "0.6516897", "text": "def g_happy(str)\n i = 0\n count = 0\n str.size.times do |letter|\n if str[letter] == \"g\"\n if str[letter] != str[i + 1]\n if str[letter] != str[i - 1]\n return false\n end\n end\n else\n count += 1\n end\n i += 1\n end\n if count == str.size\n return false\n else\n return true\n end\nend", "title": "" }, { "docid": "b99bb999d3bb8a6b022cee0f9d58e353", "score": "0.6512608", "text": "def no_repeat?(string)\n n = string.length\n for i in 0..n-1\n for j in 0..n-1\n if (i != j) && (string[i] == string[j]) then\n return false\n end\n end\n end\n return true\nend", "title": "" }, { "docid": "084fb176e21f09d90fb70cd64fff24ed", "score": "0.65056103", "text": "def uses_available_letters?(input, letters_in_hand)\n input_array = input.upcase.split(//)\n input_array.each do |letter|\n if input_array.count(letter) > letters_in_hand.count(letter) \n return false\n end\n end\n return true\nend", "title": "" }, { "docid": "055c0832613dc347abed4b33b9616459", "score": "0.64981264", "text": "def repeated_substring(str)\n 0.upto(str.size / 2) do |end_idx|\n slice = str[0..end_idx]\n repeat_nums = str.size / slice.size\n return true if slice * repeat_nums == str\n end\n false\nend", "title": "" }, { "docid": "9f22cc27286ae2782b0a6f323b4a1244", "score": "0.64901835", "text": "def non_unique_letters(string)\n letters = string.chars.uniq\n letters.select {|letter| string.count(letter) > 1 }\nend", "title": "" }, { "docid": "469b33eab2aeb6db31d2058af36a9fc2", "score": "0.64850384", "text": "def digits_repeat?(number)\n number.to_s.chars.any? { |s| number.to_s.count(s) > 1 }\nend", "title": "" }, { "docid": "07f6ca24a0c92bbbc287ac84fc6fa599", "score": "0.6482029", "text": "def is_isogram(string)\n return false if string.class != String\n string = string.downcase\n used_letters = []\n string.split(\"\").each do |e|\n if used_letters.include?(e)\n return false\n else\n used_letters << e\n end\n end\n return true\nend", "title": "" }, { "docid": "8d7957d0bbc21f85b0d5936ce02e0748", "score": "0.64783406", "text": "def str_chars_unique? str\n checker = {}\n str.codepoints.each do |c|\n if checker[c] == nil\n checker[c] = true\n else\n return false\n end\n end\n return true\nend", "title": "" }, { "docid": "80df9ad074025241e1015276468d273d", "score": "0.6468264", "text": "def panagram?(string)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n string = string.gsub(/[^A-Za-z]/, \"\")\n string.each_char do |chr|\n alphabet.gsub!(chr, \"\")\n end\n alphabet == \"\"\nend", "title": "" }, { "docid": "3714398d16f8f4272e9fea4b727e209a", "score": "0.64657", "text": "def is_unique(string)\n return false if string.length > 128\n characters = Hash.new\n \n string.each_char do | char | \n return false if characters.has_key? char\n characters[char] = true\n end\n \n return true \nend", "title": "" }, { "docid": "2337fa9410e86926b249d0cbc4e44551", "score": "0.6453999", "text": "def alphabetical?(str)\r\n ('A'..'Z').to_a.include? str.upcase\r\nend", "title": "" }, { "docid": "0f6bf4032d5427bcc3ae5b2f32ed2151", "score": "0.64489233", "text": "def all_letters(str)\r\n # Use 'str[/[a-zA-Z]*/] == str' to let all_letters\r\n # yield true for the empty string\r\n str[/[a-zA-Z]+/] == str\r\nend", "title": "" }, { "docid": "e454a594cb8059cf7df7fadecfa1c8c1", "score": "0.6448659", "text": "def is_good?(letter)\n @letters.include?(letter)\n end", "title": "" }, { "docid": "e1d808ca97388e7aca43d9bcde185379", "score": "0.64471203", "text": "def non_unique_letters(string)\nend", "title": "" }, { "docid": "c908446f4e27d6bd103d4db6b3c09162", "score": "0.6444394", "text": "def is_isogram(string)\n string.length == string.downcase.chars.uniq.length ? true : false\nend", "title": "" }, { "docid": "d181f18d1aeba58b9828cf9944223801", "score": "0.6434938", "text": "def num_repeats(string)\n\trepeats = 0\n\tletters = []\n\n\tcurrentCount = 0\n\tcurrentLetter = \"\"\n\n\ti = 0\n\twhile i < string.length\n\tcurrentLetter = string[i]\n\n\tj = 0\n\twhile j < string.length\n\n\t\tif string[j] == currentLetter\n\t\t\tcurrentCount += 1\n\t\tend\n\t\tj += 1\n\tend\n\n\tif currentCount > 1\n\t\tif letters.include? (currentLetter)\n\t\telse\n\t\t\trepeats += 1\n\t\t\tletters.push(currentLetter)\n\t\tend\n\tend\n\n\tcurrentCount = 0\n\ti += 1\nend\n\nputs \"Repeat Count: #{repeats} \\nRepeated Letters: #{letters}\"\nreturn repeats\n\n\nend", "title": "" }, { "docid": "b09909d87d3cf1a5ab9a8f2fe28cd918", "score": "0.6433211", "text": "def all_unique_chars(str)\n seen = {}\n str.chars.each do |char|\n return false if seen[char]\n seen[char] = true\n end\n true\nend", "title": "" }, { "docid": "314ed91da5c14e04b5fe3ef6ad222574", "score": "0.64272505", "text": "def same_letters?\n (@first.downcase.gsub(/[^a-z0-9\\s]/i, '').split(\"\") - @second.downcase.gsub(/[^a-z0-9\\s]/i, '').split(\"\")).empty?\n end", "title": "" }, { "docid": "bad9a2befcec7bd317337825e27712ee", "score": "0.6416586", "text": "def duplicate_count(str)\n str.downcase.each_char.find_all { |c| str.downcase.count(c) > 1 }.uniq.size\nend", "title": "" }, { "docid": "7abaebbf0cd965063a59d812d1a5401b", "score": "0.6413256", "text": "def is_unique?(string)\n char_hash = {}\n \n string.each_char do |char|\n if char_hash[char]\n return false\n else\n char_hash[char] = true\n end\n end\n \n return true\nend", "title": "" }, { "docid": "317345785f8dc9f8923ede3e6561a1ac", "score": "0.640714", "text": "def pangram?(str)\n letters = \"abcdefghijklmnopqrstuvwxyz\".split(\"\")\n\n str.downcase!\n\n letters.all? { |letter|\n str.include? (letter)\n }\nend", "title": "" }, { "docid": "1ae7852d5860a493bffa424dc45d6a4e", "score": "0.63931346", "text": "def matches_letters?( letters )\n\t\t\treturn true if letters.size < 2\n\t\t\n\t\t\tcounts = Hash.new(0)\n\t\t\tletters.each { |l| counts[l] += 1 }\n\t\t\tcounts = counts.values.sort.reverse\n\t\t\n\t\t\tpips = @dice.uniq\n\t\t\tcounts.each do |c|\n\t\t\t\treturn false unless match = pips.find { |p| count(p) >= c }\n\t\t\t\tpips.delete(match)\n\t\t\tend\n\t\t\n\t\t\ttrue\n\t\tend", "title": "" }, { "docid": "29da97b44dba717efdabadb3489a7cdd", "score": "0.6392117", "text": "def first_non_repeating_letter(string)\n letter_group = letters.split('').group_by{ |x| x.downcase }\n uniqs = letter_group.reject{ |letter, arr| arr.count > 1 }.keys\n for x in 0..uniqs.length\n\n end\n\n\n\n # letters = string.split('')\n # letter_group = letters.group_by{ |x| x.downcase }\n # p letter_group\n # uniqs = letter_group.reject{ |letter, arr| arr.count > 1 }.keys\n # p uniqs\n # '' + uniqs[0].to_s\nend", "title": "" }, { "docid": "0b60435bc5e4599dcd23e4d6c21c9e09", "score": "0.639188", "text": "def uniq_chars?(s)\n checked = {}\n s.each_char do |char|\n return false if checked[char]\n checked[char] = true\n end\n true\nend", "title": "" }, { "docid": "139e1ea6bea8823ad8fc221a4dc2596b", "score": "0.6385272", "text": "def acceptable_serial( str )\n # no more than two repeating characters\n return true\n end", "title": "" }, { "docid": "2751cd5439cdcdb7fe1164be265e40e1", "score": "0.6381022", "text": "def num_repeats(string)\n found_letters = []\n idx1 = 0\n while idx1 < string.length\n idx2 = idx1 + 1\n while idx2 < string.length\n if string[idx1] == string[idx2] && !found_letters.include?(string[idx1])\n found_letters.push(string[idx1])\n end\n idx2 += 1\n end\n idx1 += 1\n end \n return found_letters.length\nend", "title": "" }, { "docid": "737be6e2494f7bb151c4c04e0133efe4", "score": "0.6380027", "text": "def find_first_non_repeated_letter(str)\n ary = str.split(\"\")\n ary.detect { |e| ary.count(e) == 1 }\nend", "title": "" }, { "docid": "b95ee601927ae25556b9a105147e06c9", "score": "0.63778096", "text": "def all_characters_uniq?(string)\n characters = string.chars #['a', 'b', 'c', 'a']\n return true if characters.length == 0\n\n comparsion = [characters.pop]\n\n for i in 0..characters.length\n if comparsion.include?(characters[i])\n return false\n end\n end\n\n return true\nend", "title": "" }, { "docid": "caca75d01158901916a45032c7bfd93c", "score": "0.63760847", "text": "def StringScramble(str1,str2)\n\n a_str1 = str1.split(\"\")\n a_str2 = str2.split(\"\")\n count = 0 \n \n a_str2.each do |letter|\n if a_str1.include?(letter)\n count += 1\n end\n end\n \n return count == a_str2.length ? true : false\n \nend", "title": "" }, { "docid": "4eaf13ad821c07759a15548d615a0765", "score": "0.63704723", "text": "def starts_and_ends_with_same_letter?(word)\nend", "title": "" }, { "docid": "4efe664d34e8c145fbe348aa8299382a", "score": "0.6367791", "text": "def letter_match?(letter)\n if @secret.include?(letter)\n return true; end\n return false\n end", "title": "" }, { "docid": "a2acf29a1ce5196656a7e49839fef85f", "score": "0.63642204", "text": "def palindrome_permutation?(string)\n char_array = string.split('')\n hash = {}\n \n char_array.each do |char|\n if hash[char]\n hash[char] += 1\n else\n hash[char] = 1\n end\n end\n\n values = hash.values\n amount_of_single_letters = 0\n\n values.each do |num|\n if num % 2 == 1\n amount_of_single_letters += 1\n end\n end\n\n if amount_of_single_letters <= 1\n return true\n else \n return false\n end\n \nend", "title": "" }, { "docid": "f2bc28c1ddc706e5838aed1c7632ce0c", "score": "0.635714", "text": "def repeats?(year)\n x = []\n year.to_s.each_char do |a|\n return false if x.include?(a)\n x << a\n end\n return true\nend", "title": "" }, { "docid": "dee6b3b39d3233840ae9df3d1d45e610", "score": "0.6345975", "text": "def non_repeating_character(str)\n str.each_char do |char|\n return char if str.count(char) == 1\n end\nend", "title": "" }, { "docid": "bda1b27d4903e682e1e88976640f1898", "score": "0.63454527", "text": "def first_non_repeating_letter(string)\n result = ''\n letter_count = Hash.new(0)\n string.chars.each do |letter|\n letter_count[letter.to_sym] += 1\n end\n letter_count.select do |letter, count|\n result = letter if count == 1\n break if result.size == 1\n end\n result.to_s\nend", "title": "" }, { "docid": "474e10521dc8a700297be612407fed92", "score": "0.63426065", "text": "def first_non_repeat_char(string)\n raise ArgumentError, 'Parameter must be a string' unless string.is_a? String\n\n char_array = string.upcase.chars\n unique = char_array.select { |char| char_array.count(char) == 1 }\n unique.first\nend", "title": "" }, { "docid": "5aee9ffad6e97ac774523e62ea9e8602", "score": "0.63417953", "text": "def repeating?\n symbols[0] == symbols[1]\n end", "title": "" }, { "docid": "30f4e3cdc523d41c76558d11bae64fb7", "score": "0.6338519", "text": "def is_isogram(string)\n string.downcase.chars.uniq == string.downcase.chars\nend", "title": "" }, { "docid": "2b6efb85ce721405ba317b2cf9955906", "score": "0.6335627", "text": "def count_letters(string)\n i = 0\n \n length = string.length\n count = 1\n \n summary_string = \"\"\n \n while i < length\n if string[i] == string[i+1]\n count += 1\n else\n summary_string << \"#{string[i]}#{count}\"\n count = 1\n end\n i += 1\n end\n \n if summary_string.length < length\n return summary_string\n else\n return string\n end\nend", "title": "" }, { "docid": "adc5d82001b8b6d273cc75f1a070b7fa", "score": "0.63241804", "text": "def unique_d?(string)\n\n # assums all characters are letters\n alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']\n count = 0\n\n # O(N)\n while count < string.length\n character = string[count]\n\n # O(1) because alphabet is a constant size\n return false if !alphabet.include?(character)\n\n # O(1) because alphabet is a constant size\n alphabet.delete(character)\n\n count += 1\n end\n\n return true\nend", "title": "" } ]
506dc734bebeead74b000ef454f237e9
Get Offensive Animation ID for Normal Attacks
[ { "docid": "4cac815a662b00b547a99b90d1aa0d00", "score": "0.638782", "text": "def animation1_id\n weapon = $data_weapons[@weapon_id]\n return weapon != nil ? weapon.animation1_id : 0\n end", "title": "" } ]
[ { "docid": "da090c29e803b14aa67084bcf4ad1507", "score": "0.6918191", "text": "def animation1_id\n return $data_enemies[@enemy_id].animation1_id\n end", "title": "" }, { "docid": "da090c29e803b14aa67084bcf4ad1507", "score": "0.6918191", "text": "def animation1_id\n return $data_enemies[@enemy_id].animation1_id\n end", "title": "" }, { "docid": "ae59e39614f065c5460530dd433c67c9", "score": "0.6853242", "text": "def animation1_id(w=0)\n return $data_enemies[@enemy_id].animation1_id\n end", "title": "" }, { "docid": "f4db9675bdfd9fc2358095bdf5fd3eba", "score": "0.67362934", "text": "def death_animation_id\n return GTBS.get_death_anim_enemy(@enemy_id)\n end", "title": "" }, { "docid": "ca5d9fa22153280c0c4287aeea2b6591", "score": "0.67350703", "text": "def atk_animation_id\n if two_swords_style\n return weapons[0].animation_id if weapons[0] != nil\n return weapons[1] == nil ? 1 : 0\n else\n return weapons[0] == nil ? 1 : weapons[0].animation_id\n end\n end", "title": "" }, { "docid": "81b1e43fd8a4560914fd8e66edeab920", "score": "0.67038417", "text": "def animation2_id(w=0)\n return $data_enemies[@enemy_id].animation2_id\n end", "title": "" }, { "docid": "4591e9983403dfaae665f79312115b36", "score": "0.6702142", "text": "def atk_animation_id2\n if two_swords_style\n return weapons[1] == nil ? 0 : weapons[1].animation_id\n else\n return 0\n end\n end", "title": "" }, { "docid": "4314f3cff58e54483cf27ef820d3ffe1", "score": "0.6678183", "text": "def animation2_id\n return $data_enemies[@enemy_id].animation2_id\n end", "title": "" }, { "docid": "4314f3cff58e54483cf27ef820d3ffe1", "score": "0.6678183", "text": "def animation2_id\n return $data_enemies[@enemy_id].animation2_id\n end", "title": "" }, { "docid": "546691446c858334257b8b3a772cdd9e", "score": "0.6618148", "text": "def atk_animation_id2\n return 0\n end", "title": "" }, { "docid": "eedf53dd7488cc792fdf417d15378591", "score": "0.6562931", "text": "def atk_animation_id1\n return 0\n end", "title": "" }, { "docid": "e72b2086963379182c3025d8ce605a90", "score": "0.64040655", "text": "def action_effect(object)\n # if damage dealt\n if @battler.hpdamage > 0 || @battler.spdamage > 0\n # set attacked counter\n self.attacked = $BlizzABS.pixel\n end\n # set attacked enemy animation ID if ANIMATIONS is turned on\n @animation_id = object.animation2_id if BlizzABS::Config::ANIMATIONS\n end", "title": "" }, { "docid": "6827f1ab33115083e50ff9a78f5cefb2", "score": "0.63824385", "text": "def animation2_id\n weapon = $data_weapons[@weapon_id]\n return weapon != nil ? weapon.animation2_id : Unarmed_Animation\n end", "title": "" }, { "docid": "420c435f2c9ee6ec10f82c605b51ff13", "score": "0.6360496", "text": "def animation\n if @item.is_a?(RPG::Armor)\n return $data_skills[@tool_invoke].animation_id if @tool_invoke > 0\n return 0\n end\n return @item.animation_id\n end", "title": "" }, { "docid": "b4e08b4ad120878e4c4c4b6110e67019", "score": "0.6285644", "text": "def death_animation_id\n return GTBS.get_death_anim_actor(@actor_id)\n end", "title": "" }, { "docid": "7e4cd8d93a993e1140caae5aa1842d68", "score": "0.61751944", "text": "def animation2_id\n weapon = $data_weapons[@weapon_id]\n return weapon != nil ? weapon.animation2_id : 0\n end", "title": "" }, { "docid": "7e4cd8d93a993e1140caae5aa1842d68", "score": "0.61751944", "text": "def animation2_id\n weapon = $data_weapons[@weapon_id]\n return weapon != nil ? weapon.animation2_id : 0\n end", "title": "" }, { "docid": "dac4e0429082f3d4b15cfca8742f8794", "score": "0.61743164", "text": "def attack_effect(attacker)\n default_attack_effect(attacker)\n self.animation_id = attacker.animation2_id\n unless self.damage == \"Miss\"\n attacker.sp += Aps.gain_up(self.damage)\n end\n end", "title": "" }, { "docid": "4c3fee9a4273f7c97b3859964a24f8a8", "score": "0.6132251", "text": "def animation1_id(w=0)\n weapon = $data_weapons[@weapon_id[w]]\n return weapon != nil ? weapon.animation1_id : 0\n end", "title": "" }, { "docid": "0eaa8c66e381253444d87a6f23d21bf8", "score": "0.60719955", "text": "def animation2_id(w=0)\n weapon = $data_weapons[@weapon_id[w]]\n return weapon != nil ? weapon.animation2_id : 4\n end", "title": "" }, { "docid": "a799397c286df0b6e81b2c193d71c914", "score": "0.574152", "text": "def attack\r\n\t\tattack_rating = @effective_attack + rand(1..20)\r\n\t\tdamage_rating = rand(1..@effective_damage)\r\n\t\tstatus = nil\r\n\t\tif nil != @current_enemy\r\n\t\t\tdamage = @current_enemy.defend(attack_rating, damage_rating, @attack_type, status)\r\n\t\t\tif damage.is_a?(Integer)\r\n\t\t\t\treturn @user_id.mention() + \" attacked #{@current_enemy.name} and dealt #{damage} damage!\"\r\n\t\t\telsif damage.is_a?(String)\r\n\t\t\t\treturn damage\r\n\t\t\tend\r\n\t\telse\r\n\t\t\treturn @user_id.mention() + \" attacked the air!\"\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "f370332d85ebdd469957889e02097132", "score": "0.5714146", "text": "def display_attack_animation(targets)\n if @active_battler.is_a?(Game_Enemy)\n Sound.play_enemy_attack\n wait(15, true)\n else\n aid1 = @active_battler.atk_animation_id\n aid2 = @active_battler.atk_animation_id2\n display_normal_animation(targets, aid1, false)\n display_normal_animation(targets, aid2, true)\n end\n wait_for_animation\n end", "title": "" }, { "docid": "2587fc41d5a15afc7fbb0aba549026b0", "score": "0.570915", "text": "def id_key\n 'animation_2_instructions'\n end", "title": "" }, { "docid": "ec0f83b8f727e575176487600df883d1", "score": "0.56739986", "text": "def sin_attack_bonus\n 1.0\n end", "title": "" }, { "docid": "6b6a7fd88f5bc4c11cbf544c43198944", "score": "0.5666382", "text": "def state_animation_id\r\n # If no states are added\r\n if @states.size == 0\r\n return 0\r\n end\r\n # Return state animation ID with maximum rating\r\n return $data_states[@states[0]].animation_id\r\n end", "title": "" }, { "docid": "774db6f0ddaa95a56aa5a8031d240e0e", "score": "0.5661074", "text": "def state_animation_id\n # If no states are added\n if @states.size == 0\n return 0\n end\n # Return state animation ID with maximum rating\n return $data_states[@states[0]].animation_id\n end", "title": "" }, { "docid": "774db6f0ddaa95a56aa5a8031d240e0e", "score": "0.5661074", "text": "def state_animation_id\n # If no states are added\n if @states.size == 0\n return 0\n end\n # Return state animation ID with maximum rating\n return $data_states[@states[0]].animation_id\n end", "title": "" }, { "docid": "774db6f0ddaa95a56aa5a8031d240e0e", "score": "0.5661074", "text": "def state_animation_id\n # If no states are added\n if @states.size == 0\n return 0\n end\n # Return state animation ID with maximum rating\n return $data_states[@states[0]].animation_id\n end", "title": "" }, { "docid": "589d4fa70936bd38de5c98c827f66e05", "score": "0.56424755", "text": "def get_action_anime_data(spell, battler)\n data = GTBS.get_anime_animation_data(spell.id).clone\n \n #get primary animations\n anim = []\n id = spell.animation_id\n if id == -1\n anim << battler.atk_animation_id1\n anim << battler.atk_animation_id2\n else\n anim << id\n end\n # Replaces regular animation data if special is assigned. \n #anim = anim_dat if anim_dat != nil \n return data, anim\n end", "title": "" }, { "docid": "de52444b3f1837687930c699881df377", "score": "0.5596237", "text": "def base_atk\n return $data_enemies[@enemy_id].atk\n end", "title": "" }, { "docid": "de52444b3f1837687930c699881df377", "score": "0.5596237", "text": "def base_atk\n return $data_enemies[@enemy_id].atk\n end", "title": "" }, { "docid": "b20e1205a86116e79e4176abafa61abb", "score": "0.5574657", "text": "def attack_fencing_parameter\n favorite_weapon_bonus = extract_bonus_from_stats_modifier_dsl_definition(\"Atak\", collection_of_stats_modifiers(\"weapon_name\"))\n favorite_weapon_group_bonus = extract_bonus_from_stats_modifier_dsl_definition(\"Atak\", collection_of_stats_modifiers(\"weapon_group_name\"))\n\n favorite_weapon_bonus.to_i + favorite_weapon_group_bonus.to_i + character.statistics.raw_fencing_when_attacking + fencing_master_modifier\n end", "title": "" }, { "docid": "c5e1b8952f30dbb16de00b05c32c6ac1", "score": "0.5571531", "text": "def sin_attack_bonus; 1.0; end", "title": "" }, { "docid": "173fe1cd35a1c2822ac986d26fb257c3", "score": "0.5549292", "text": "def use_attack\n # sets everything up for attack sprites\n setup_sprites('_atk')\n # set frame penalty\n set_action(self.is_a?(Map_Actor) ? 0.8 : 1.6)\n # set animation ID if ANIMATIONS is turned on\n @animation_id = battler.animation1_id if BlizzABS::Config::ANIMATIONS\n # execute attack process and return result\n return (BlizzABS.attack_process(self))\n end", "title": "" }, { "docid": "173fe1cd35a1c2822ac986d26fb257c3", "score": "0.5549292", "text": "def use_attack\n # sets everything up for attack sprites\n setup_sprites('_atk')\n # set frame penalty\n set_action(self.is_a?(Map_Actor) ? 0.8 : 1.6)\n # set animation ID if ANIMATIONS is turned on\n @animation_id = battler.animation1_id if BlizzABS::Config::ANIMATIONS\n # execute attack process and return result\n return (BlizzABS.attack_process(self))\n end", "title": "" }, { "docid": "5beb868e407e66018771ab3413ec8d27", "score": "0.5487306", "text": "def base_atk(w=0)\n return $data_enemies[@enemy_id].atk\n end", "title": "" }, { "docid": "4e0748b2ae20b2336bc5c18c89b92f45", "score": "0.5480347", "text": "def anim_guard_id\n states.each do |state|\n return state.anim_guard if state && state.anim_guard > 0\n end\n return 0\n end", "title": "" }, { "docid": "4e0748b2ae20b2336bc5c18c89b92f45", "score": "0.5480347", "text": "def anim_guard_id\n states.each do |state|\n return state.anim_guard if state && state.anim_guard > 0\n end\n return 0\n end", "title": "" }, { "docid": "a6103fe5fa4a48ef46dbb313c357117b", "score": "0.5454047", "text": "def setup_charge_attack_sprites\n # spriteset name add-on\n @current_sprite = BlizzABS::SPRAttack + BlizzABS::SPRCharge +\n self.battler.weapon_id.to_s\n # return frame animation data\n return BlizzABS::Weapons.charge_frames(self.battler.weapon_id)\n end", "title": "" }, { "docid": "06f7abdee008204b9c8a13292354e129", "score": "0.54489154", "text": "def escaped\n if $game_party.monsters_escaped[enemy_id] == nil\n $game_party.monsters_escaped[enemy_id] = 0 \n end\n return $game_party.monsters_escaped[enemy_id]\n end", "title": "" }, { "docid": "06f7abdee008204b9c8a13292354e129", "score": "0.54489154", "text": "def escaped\n if $game_party.monsters_escaped[enemy_id] == nil\n $game_party.monsters_escaped[enemy_id] = 0 \n end\n return $game_party.monsters_escaped[enemy_id]\n end", "title": "" }, { "docid": "13d5027db170602c5d2b977737f12105", "score": "0.54362434", "text": "def attack_enemy\n sort_possible_attacks.first\n end", "title": "" }, { "docid": "b45ead9dc0d930fd2c13948b904e7dff", "score": "0.54341215", "text": "def hit\n malus_hit = has2w ? CPanel::TWHIT : 0\n party_bonus(ex_attr_hit, :hit) - malus_hit\n end", "title": "" }, { "docid": "8424673211d4cd57a56eaf5c33fedc16", "score": "0.54331356", "text": "def setup_charge_attack_sprites\n return BlizzABS::Enemies.charge_frames(self.battler_id)\n end", "title": "" }, { "docid": "256e4a77e8434a7b7040398d0f49efff", "score": "0.54132456", "text": "def identifyAnimacy\n \tif(@semanticClass != \"PERSON\")\n \t @animacy = 'inanimate'\n \telse\n \t @animacy = 'animate' \n \tend \n end", "title": "" }, { "docid": "52279f96af9dfa790164d6dfb511a31c", "score": "0.5409439", "text": "def enemies_slain(enemy_id)\r\n @enemy_slain[enemy_id].to_i\r\n end", "title": "" }, { "docid": "920d7e8fb878efd7e3957391c7f84f26", "score": "0.54072636", "text": "def sin_kill_bonus \n return ENEMY_KILL_MALUS * -1\n end", "title": "" }, { "docid": "d344e8c42e1766f8a967d896515f1b46", "score": "0.5397431", "text": "def frame_hash\n GTBS::EXTRA_ENEMY_FRAMES[self.enemy_id]\n end", "title": "" }, { "docid": "b4e2fe2f1d932d11d5418845d7c9d0c1", "score": "0.5380776", "text": "def spirit_attack\n attack_bonus = calc_spirit_attack\n attack_bonus > 0 ? (attack_bonus * spi).to_i : 0\n end", "title": "" }, { "docid": "d825fe786c4a14e7b4a82a4c20d994f0", "score": "0.5360073", "text": "def atk\n n = battle_effect.atk\n return (n * atk_modifier).to_i if n\n return (atk_basis * atk_modifier).floor\n end", "title": "" }, { "docid": "9a49e29448b8cf371a750f05e6c33fcb", "score": "0.53353465", "text": "def attack_effect(attacker)\n h87sinergia_eff(attacker)\n return if $game_party.sinergy_active?\n $game_party.add_sinergy(sin_evade_bonus) if @evaded\n $game_party.add_sinergy(attacker.sin_kill_bonus) if dead?\n end", "title": "" }, { "docid": "d6b648fccbe7902a9383f7e022883daf", "score": "0.5328832", "text": "def setup_attack_sprites\n # set normal weapon sprite\n @weapon_sprite = BlizzABS::SPRWeapon\n # return frame animation data\n return BlizzABS::Enemies.frames(self.battler_id)\n end", "title": "" }, { "docid": "fcf92ecc24bd87d759bc3f79d71503fd", "score": "0.53256285", "text": "def enemy_bestiary_now\n new_enemy_info = []\n for info in @enemy_info\n enemy = $data_enemies[info[0]]\n next if enemy.name == '' or Never_Show.include?(enemy.id) or info[1] == 0\n new_enemy_info << enemy.id\n end\n return new_enemy_info.size\n end", "title": "" }, { "docid": "037846d497d7a306130f0772dea5d290", "score": "0.52943337", "text": "def attack_effect(attacker)\n h87sinergia_eff(attacker)\n return if $game_party.sinergy_active?\n $game_party.sinergic_state += sin_evade_bonus if @evaded\n $game_party.sinergic_state += attacker.sin_kill_bonus if dead?\n end", "title": "" }, { "docid": "cea8a4bd0e28e295aea10589cc3487d1", "score": "0.528264", "text": "def sin_kill_bonus\n ENEMY_KILL_MALUS * -1\n end", "title": "" }, { "docid": "dc34954f9915f4c1c652188a43859a3e", "score": "0.5252858", "text": "def attack_penalty\n return 0\n end", "title": "" }, { "docid": "12b2319dd98f5d9955551a880721b34f", "score": "0.5249557", "text": "def attack_attribute\n return nil if @attack_attr.nil?\n $data_system.weapon_attributes.select { |attr| attr.id == attack_attr }.first\n end", "title": "" }, { "docid": "e849a8626239ed0cd22ae6fd8e91683b", "score": "0.52430934", "text": "def dice_make_attack_damage_value( attacker )\n dnd = IEX::DND_DAMAGE\n damage = 0\n damage += (attacker.atk - dnd::STAT_SUBTRACT) / dnd::STAT_DIVISION\n def_amt = (self.def - dnd::STAT_SUBTRACT) / dnd::STAT_DIVISION\n critical_mult = dnd::CRITICAL_MULT\n if attacker.actor?\n for eq in attacker.equips\n next if eq == nil\n critical_mult = eq.iex_dnd_critical_mod if eq.iex_dnd_critical_mod != nil\n dis = eq.iex_dnd_dice_values\n damage += eq.atk\n next if dis.empty?\n for com in dis\n next if com == nil\n damage += calculate_dice_value(com[0], com[1]) \n end \n end \n else\n dis = attacker.enemy.iex_dnd_dice_values\n critical_mult = attacker.enemy.iex_dnd_critical_mod if attacker.enemy.iex_dnd_critical_mod != nil\n unless dis.empty?\n for com in dis\n next if com == nil\n damage += calculate_dice_value(com[0], com[1]) \n end \n end \n end\n damage -= def_amt\n damage = 0 if damage < 0 # if negative, make 0 \n if damage == 0 # if damage is 0,\n damage = rand(2) # half of the time, 1 dmg\n elsif damage > 0 # a positive number?\n @critical = (rand(100) < attacker.cri) # critical hit?\n @critical = false if prevent_critical # criticals prevented?\n damage *= critical_mult if @critical # critical adjustment\n damage = damage.to_i \n end\n damage *= elements_max_rate(attacker.element_set) # elemental adjustment\n damage /= 100\n damage = apply_variance(damage, IEX::DND_DAMAGE::STAT_VARIANCE) # variance\n damage = apply_guard(damage) # guard adjustment\n @hp_damage = damage # damage HP\n end", "title": "" }, { "docid": "9437aef21e150e5726185d2600a87511", "score": "0.52393496", "text": "def attack_happens(opponent) end", "title": "" }, { "docid": "28f9b93231cb04300dbc2d9d03924d41", "score": "0.5226651", "text": "def attack_effect(attacker,w=0)\n # Clear critical flag\n self.critical = false\n # First hit detection\n hit_result = (rand(60) < (attacker.hit(w)*3 -self.eva/2))\n # If hit occurs\n total_damage = 0\n if hit_result == true\n for i in 0..attacker.hit_num\n # Calculate basic damage\n #atk = [attacker.atk - self.pdef / 2, 0].max\n #self.damage = atk * (20 + attacker.str) / 20\n if attacker.is_a?(Game_Enemy)\n attack=(attacker.atk(w)*4+attacker.str)-self.dex\n self.damage=(attacker.level*attacker.level*attack)/512\n else\n #STEP 0.Calculate weapon level\n weapon_type = $data_weapons[attacker.weapon_id(-1)[w]].element_set\n t_level = attacker.w_level[weapon_type[0]]\n t_level *= (2+t_level)/3\n #STEP 1.\n vigor2=[(attacker.str*2),255].min\n attack=[(attacker.atk(w)+vigor2)-(self.dex/2),1].max\n gaunt=offer=false\n attacker.armor4_id(-1).each{|id|\n next if id==0\n gaunt = true if $data_armors[id].guard_element_set.include?(RPG::SPEC_ACCESSORIES[0])\n offer = true if $data_armors[id].guard_element_set.include?(RPG::SPEC_ACCESSORIES[1])\n }\n attack+=attacker.atk(w)*3/4 if gaunt #Gauntlet\n self.damage=attacker.atk(w)+((t_level*t_level*attack)/256)*3/2\n self.damage/=2 if offer #Offering\n wep_check=attacker.weapon_id(-1)\n wep_num = 0\n for i in attacker.weapon_id(-1)\n wep_num+=1 if wep_check[i]!=0\n end\n self.damage*=3/4 if (wep_num<=1) and attacker.armor4_id(-1).include?(3) #GenjiGlove\n #STEP 2. Atlas Armlet/Hero Ring\n extra = 0\n extra += self.damage/4 if attacker.armor4_id(0) != 0 && ($data_armors[attacker.armor4_id(0)].guard_element_set.include?(RPG::SPEC_ACCESSORIES[2]))\n extra += self.damage/4 if attacker.armor4_id(1) != 0 && ($data_armors[attacker.armor4_id(1)].guard_element_set.include?(RPG::SPEC_ACCESSORIES[2]))\n self.damage += extra\n #ASDTsutarja2525\n end\n \n self.damage *= (6.0 - (attacker.level/attacker.maxlevel*1.0))/6\n \n self.damage*= [2.0/(attacker.hit_num+1),1].min\n a = (30*(attacker.maxlevel-attacker.level)/attacker.maxlevel)\n self.damage = (self.damage*((70+a)/100.0)).floor#(self.damage*attacker.level / 64.0).floor #if skill.atk_f > 0\n \n self.damage = Integer(self.damage)\n # Element correction\n self.damage *= elements_correct(attacker.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Critical correction\n if rand(100) < 4 * (attacker.dex / self.dex)+(attacker.level - self.level)\n self.damage *= 2\n self.critical = true\n end\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n # Positions corrections\n if self.is_a?(Game_Actor)\n self.damage *= Wep::Positions_types[self.position][:defender_physic_damage_mod]\n end\n \n # Positions corrections\n if attacker.is_a?(Game_Actor)\n self.damage *= Wep::Positions_types[self.position][:attacker_physic_damage_mod]\n end\n \n #STEP 5. Damage Mult#1\n mult=0\n mult+=2 if attacker.states.include?(RPG::SPEC_STATES[4])\n #mult+=1 if user.states.include?(20)\n n = rand(32)\n mult+=2 if n==1\n self.damage *= (2+mult)/2\n \n end\n self.damage /= [attacker.hit_num/3,1].max\n #STEP 6. Damage modification\n # Dispersion\n if self.damage.abs > 0\n n = rand(31) + 224\n self.damage = (self.damage*n / 256) + 1\n self.damage = (self.damage*(255-self.pdef)/256)+1\n #14: Protect\n self.damage = (self.damage*170/256)+1 if self.states.include?(RPG::SPEC_STATES[0])\n end\n #Step 7.\n \n #self.damage *= 3/2 if self.states.include?(xx) #Attacked from behind <-it needs pincers and those stuff to work!!\n #STEP 8. Petrify damage\n self.damage = 0 if self.states.include?(RPG::SPEC_STATES[5]) #Petrify status\n # Second hit detection\n # eva = 8 * self.agi / attacker.dex + self.eva\n # hit = attacker.hit*1.5 - eva\n # hit = self.cant_evade? ? 100 : hit\n # hit_result = (rand(100) < hit)\n blockValue = [[(255 - self.eva*2)+1,1].max,255].min\n r = rand(99)\n hit_result = (attacker.hit(w) * blockValue / 256 ) > r\n \n #TODO: Attack \"from behind\" support\n hit_result = true if self.restriction == 4\n hit_result = true if attacker.hit(w)==255\n \n if self.states.include?(RPG::SPEC_STATES[7])\n hit_result = false \n remove_states_shock\n end\n \n hit_result = false if self.states.include?(RPG::SPEC_STATES[6]) #Clear\n hit_result = true if attacker.element_set.include?(RPG::SKILL_TAGS[1]) #Unblockable\n hit_result = false if attacker.element_set.include?(RPG::SKILL_TAGS[0]) and self.state_ranks[1]==6 #Deathblow\n total_damage +=self.damage\n attacker.w_raise_exp(0) if hit_result\n end\n end\n self.damage = total_damage\n # If hit occurs\n if hit_result == true\n # State Removed by Shock\n remove_states_shock\n # Substract damage from HP\n self.damage = self.damage.floor\n self.damage = [self.damage, 9999].min\n self.hp -= self.damage\n # State change\n @state_changed = false\n states_plus(attacker.plus_state_set)\n states_minus(attacker.minus_state_set)\n # When missing\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n # Clear critical flag\n self.critical = false\n end\n # End Method\n return true\n end", "title": "" }, { "docid": "528d2a4018e6b0226a3039bff8b378b7", "score": "0.5213976", "text": "def ats\n n = battle_effect.ats\n return (n * ats_modifier).to_i if n\n return (ats_basis * ats_modifier).floor\n end", "title": "" }, { "docid": "7bf4326254b32dca93c5b76a153b601c", "score": "0.5213543", "text": "def start_anim\n case @type\n when 0\n @animation_id = GTBS::MISS_ANIMATION #Animation ID of MISS!.. for spells that miss\n when 1\n @animation_id = GTBS::SUMMON_ANIMATION #Animation ID of SPAWN.. for summons (RAISE)\n else\n @animation_id = @anim_id\n end\n @sprite.update #unless @sprite.nil?\n @played = true\n end", "title": "" }, { "docid": "a51a32900f1a8a2aa3ae451ce7f5210a", "score": "0.5209532", "text": "def get_enemy_of(player_id)\n if !(player_white_id == player_id)\n return player_white_id\n else\n return player_black_id\n end\n end", "title": "" }, { "docid": "5531226d548bfdef0f38e3c9ca865041", "score": "0.5207869", "text": "def attack_effect(attacker)\r\n # Clear critical flag\r\n self.critical = false\r\n # First hit detection\r\n hit_result = (rand(100) < attacker.hit)\r\n # If hit occurs\r\n if hit_result == true\r\n # Calculate basic damage\r\n atk = [attacker.atk - self.pdef / 2, 0].max\r\n self.damage = atk * (20 + attacker.str) / 20\r\n # Element correction\r\n self.damage *= elements_correct(attacker.element_set)\r\n self.damage /= 100\r\n # If damage value is strictly positive\r\n if self.damage > 0\r\n # Critical correction\r\n if rand(100) < 4 * attacker.dex / self.agi\r\n self.damage *= 2\r\n self.critical = true\r\n end\r\n # Guard correction\r\n if self.guarding?\r\n self.damage /= 2\r\n end\r\n end\r\n # Dispersion\r\n if self.damage.abs > 0\r\n amp = [self.damage.abs * 15 / 100, 1].max\r\n self.damage += rand(amp+1) + rand(amp+1) - amp\r\n end\r\n # Second hit detection\r\n eva = 8 * self.agi / attacker.dex + self.eva\r\n hit = self.damage < 0 ? 100 : 100 - eva\r\n hit = self.cant_evade? ? 100 : hit\r\n hit_result = (rand(100) < hit)\r\n end\r\n # If hit occurs\r\n if hit_result == true\r\n # State Removed by Shock\r\n remove_states_shock\r\n # Substract damage from HP\r\n self.hp -= self.damage\r\n # State change\r\n @state_changed = false\r\n states_plus(attacker.plus_state_set)\r\n states_minus(attacker.minus_state_set)\r\n # When missing\r\n else\r\n # Set damage to \"Miss\"\r\n self.damage = \"Miss\"\r\n # Clear critical flag\r\n self.critical = false\r\n end\r\n # End Method\r\n return true\r\n end", "title": "" }, { "docid": "e0c644b565d8e2b06e0d4b8ea4e03601", "score": "0.5198889", "text": "def damage\n rand(@attack_range)\n end", "title": "" }, { "docid": "e0c644b565d8e2b06e0d4b8ea4e03601", "score": "0.5198889", "text": "def damage\n rand(@attack_range)\n end", "title": "" }, { "docid": "3c351c7bdc36efb256c3d430048e6b42", "score": "0.5198296", "text": "def attack_effect(attacker)\n # Clear critical flag\n self.critical = false\n # First hit detection\n hit_result = (rand(100) < attacker.hit)\n # If hit occurs\n if hit_result == true\n # Calculate basic damage\n atk = [attacker.atk - self.pdef / 2, 0].max\n self.damage = atk * (20 + attacker.str) / 20\n # Element correction\n self.damage *= elements_correct(attacker.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Critical correction\n if rand(100) < 4 * attacker.dex / self.agi\n self.damage *= 2\n self.critical = true\n end\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if self.damage.abs > 0\n amp = [self.damage.abs * 15 / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / attacker.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n end\n # If hit occurs\n if hit_result == true\n # State Removed by Shock\n remove_states_shock\n # Substract damage from HP\n self.hp -= self.damage\n # State change\n @state_changed = false\n states_plus(attacker.plus_state_set)\n states_minus(attacker.minus_state_set)\n # When missing\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n # Clear critical flag\n self.critical = false\n end\n # End Method\n return true\n end", "title": "" }, { "docid": "3c351c7bdc36efb256c3d430048e6b42", "score": "0.5198296", "text": "def attack_effect(attacker)\n # Clear critical flag\n self.critical = false\n # First hit detection\n hit_result = (rand(100) < attacker.hit)\n # If hit occurs\n if hit_result == true\n # Calculate basic damage\n atk = [attacker.atk - self.pdef / 2, 0].max\n self.damage = atk * (20 + attacker.str) / 20\n # Element correction\n self.damage *= elements_correct(attacker.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Critical correction\n if rand(100) < 4 * attacker.dex / self.agi\n self.damage *= 2\n self.critical = true\n end\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if self.damage.abs > 0\n amp = [self.damage.abs * 15 / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / attacker.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n end\n # If hit occurs\n if hit_result == true\n # State Removed by Shock\n remove_states_shock\n # Substract damage from HP\n self.hp -= self.damage\n # State change\n @state_changed = false\n states_plus(attacker.plus_state_set)\n states_minus(attacker.minus_state_set)\n # When missing\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n # Clear critical flag\n self.critical = false\n end\n # End Method\n return true\n end", "title": "" }, { "docid": "9670feb1b769d0f07939e00a8f01ad90", "score": "0.5198094", "text": "def attack(player) \n player.get_hit\n end", "title": "" }, { "docid": "f4fdd27470187c0ad4cc440bcda74b1a", "score": "0.519541", "text": "def defeated\n if $game_party.monsters_defeated[enemy_id] == nil\n $game_party.monsters_defeated[enemy_id] = 0 \n end\n return $game_party.monsters_defeated[enemy_id]\n end", "title": "" }, { "docid": "f4fdd27470187c0ad4cc440bcda74b1a", "score": "0.519541", "text": "def defeated\n if $game_party.monsters_defeated[enemy_id] == nil\n $game_party.monsters_defeated[enemy_id] = 0 \n end\n return $game_party.monsters_defeated[enemy_id]\n end", "title": "" }, { "docid": "778191c66f2da5040d85ba72d21db53b", "score": "0.51952076", "text": "def attack_penalty\n # get weapon penalty\n penalty = BlizzABS::Enemies.penalty(@battler.id)\n # limit is sum of all animation frames if using action sprites\n limit = (action_sprites? ? BlizzABS::Enemies.frames(@battler.id).sum : 0)\n # limit penalty\n return (penalty < limit ? limit : penalty)\n end", "title": "" }, { "docid": "93ac13f5d0ddd8b65d20dcc99f8a08f2", "score": "0.51872283", "text": "def enhanced_weapon_id(wep_id = weapons[0].id)\n return wep_id\n end", "title": "" }, { "docid": "97f532a8676e373dda6bac3811b2c061", "score": "0.51810145", "text": "def set_attack_action(battler)\n battler.animation_1 = battler.animation1_id\n battler.animation_2 = battler.animation2_id\n for target in battler.target_battlers\n target.attack_effect(battler)\n end\n battler.action_done = true\n end", "title": "" }, { "docid": "0d0d848b60f01da309cadefcc654590d", "score": "0.5161824", "text": "def hide_found(enemy)\n @bonus = $data_enemies[enemy].completion_bonus\n @enemies_total -= 1 if !@enemies_hidden.include?(enemy)\n @enemies_found -= 1 if @enemies_revealed.include?(enemy) && !@enemies_hidden.include?(enemy)\n @completion_bonus -= @bonus if @enemies_revealed.include?(enemy) && !@enemies_hidden.include?(enemy)\n end", "title": "" }, { "docid": "cb51edac989a570528c0323bb9a479c2", "score": "0.5156022", "text": "def mdmg; (magic_damage_rate * 100).to_i - 100; end", "title": "" }, { "docid": "f1810b43f85525c41ddb394b74c9298d", "score": "0.51488", "text": "def atk;party_bonus(ex_attr_atk, :atk) + party_gift(:atk) + spirit_attack;end", "title": "" }, { "docid": "c8ea2ecd2f717bc36d3241de4d6f701c", "score": "0.51371574", "text": "def make_attack_damage_value(attacker)\n h87sinergia_madv(attacker)\n check_sinergic_damage(attacker, attacker.element_set)\n end", "title": "" }, { "docid": "9b1748561da374920024c9194d98398f", "score": "0.5130321", "text": "def atk_offset\n return ((@current_sprite[0, 4] == '_atk' && @direction == 2 &&\n @s_count < 12) ? BlizzABS::Config::ENEMY_SPRITE_Y_OFFSET : 0)\n end", "title": "" }, { "docid": "9b1748561da374920024c9194d98398f", "score": "0.5130321", "text": "def atk_offset\n return ((@current_sprite[0, 4] == '_atk' && @direction == 2 &&\n @s_count < 12) ? BlizzABS::Config::ENEMY_SPRITE_Y_OFFSET : 0)\n end", "title": "" }, { "docid": "eebcff11acd7d37f9c9e3a75a18ccc4f", "score": "0.51207507", "text": "def random_target_enemy_hp0\r\n return random_target_enemy(true)\r\n end", "title": "" }, { "docid": "c31615387abddf3c9b2d80ccc3ed4b62", "score": "0.5108914", "text": "def damage_mod; 0; end", "title": "" }, { "docid": "5be1cf3032505c322194767c40896cfe", "score": "0.5108727", "text": "def defensive_diag_offense_counter_attack(board)\n if @turn3 < 1\n @turn3 += 1\n if board[1] == \"1\"\n return 1\n elsif board[3] == \"3\"\n return 3\n elsif board[5] == \"5\"\n return 5\n elsif board[7] == \"7\"\n return 7\n else \n return nil\n end\n else\n return nil\n end\n end", "title": "" }, { "docid": "cfd771a3c276860b8c0602fc85feed90", "score": "0.51055074", "text": "def dmg\n n = set_enemy_parameter('dmg').nil? ? super : set_enemy_parameter('dmg').nil?\n return n.to_i\n end", "title": "" }, { "docid": "fc13c2f762b89e068633f0662cd24f94", "score": "0.51037043", "text": "def base_atk\n n = 0\n for item in weapons.compact do n += item.atk end\n n = Unarmed_Attack if weapons.empty?\n return n.to_i\n end", "title": "" }, { "docid": "01b18d17c62650d5667704748abfe32a", "score": "0.5103186", "text": "def counter_skills_id\n [data_battler.counter_skill]\n end", "title": "" }, { "docid": "01b18d17c62650d5667704748abfe32a", "score": "0.5103186", "text": "def counter_skills_id\n [data_battler.counter_skill]\n end", "title": "" }, { "docid": "4e9f3cb7dac1c6e11128247733937533", "score": "0.5095504", "text": "def random_target_enemy_hp0\n return random_target_enemy(true)\n end", "title": "" }, { "docid": "4e9f3cb7dac1c6e11128247733937533", "score": "0.5095504", "text": "def random_target_enemy_hp0\n return random_target_enemy(true)\n end", "title": "" }, { "docid": "8d27dcdd0fb8abb6379d74502e9a5656", "score": "0.5094053", "text": "def impacted(away_from, attack_dmg)\n # if blocking?\n # @current_hp = attack_dmg <=2 ? @current_hp : @current_hp - (attack_dmg/2).floor\n # angle = Gosu.angle(away_from[0], away_from[1], @hb.x, @hb.y)\n # @recoil_speed_x = Gosu.offset_x(angle, @recoil_magnitude)\n # @recoil_speed_y = Gosu.offset_y(angle, @recoil_magnitude)\n # @event_tiks = @current_hp > 0 ? 16 : 18\n # @inv_frames = 16\n # end\n $WINDOW.kb_locked = true\n $WINDOW.interface.update\n @invis_frames = 20\n if attacking?\n @sword = nil\n end\n super\n puts \"PLAYER'S HP = #{@current_hp}\"\n end", "title": "" }, { "docid": "5ecbb61e1a2d9e798852640e3ff5754c", "score": "0.50934523", "text": "def state_anim\n states.each do |state|\n return state.state_anim if state.state_anim > 0\n end\n return 0\n end", "title": "" }, { "docid": "5ecbb61e1a2d9e798852640e3ff5754c", "score": "0.50934523", "text": "def state_anim\n states.each do |state|\n return state.state_anim if state.state_anim > 0\n end\n return 0\n end", "title": "" }, { "docid": "0cf07384adb5f398244e4ba55a2bb032", "score": "0.5088576", "text": "def phase_main_anim\n\n # Face at target of attack - CUT\n # if @active_battler.target != nil && @active_battler.target.is_enemy?\n # @active_battler.ev.direction = 10 - @active_battler.target.ev.direction\n # #@active_battler.ev.turn_toward_event(@active_battler.target.ev.id) \n # end\n\n @attack_results.each{ |result|\n\n # Target face attacker\n #result.target.ev.turn_toward_event(@active_battler.ev.id)\n # if @active_battler.is_enemy?\n # result.target.ev.direction = 10 - @active_battler.ev.direction\n # end\n\n if @attack_round.anim\n if @attack_round.anim.include?(\"spark\")\n # Show the hit animation\n x = result.target.ev.screen_x\n y = result.target.ev.screen_y - 32\n add_spark(@attack_round.anim.split(\"=>\")[1],x,y)\n end\n end\n\n }\n\n \t# Onto the next\n \t@phase = :main_transform\n\n end", "title": "" }, { "docid": "18e50ad5f22034e7e51941cbc757586d", "score": "0.5086311", "text": "def ai_attack_or_defend(side, offensiveness = 3)\n if rand(offensiveness) == 0\n other_side = other_side(side)\n nb = [random_nb_from_hand(@ai_score[other_side]), 4 - @ai_score[side]].min\n \"#{other_side}#{nb}\"\n else\n side\n end\nend", "title": "" }, { "docid": "821a3d2173e892fffba68ac970dba24b", "score": "0.5083268", "text": "def animation(id)\n #print \"Affichage de l'animation #{message[1]}\"\n end", "title": "" }, { "docid": "4fb78c0ac8027d18e7a95bd3ae04302e", "score": "0.5083074", "text": "def determine_target_damage(skill)\n if skill.for_all?\n damage = 0\n $game_party.actors.each {|act|\n act.store_state\n act.skill_effect(self, skill)\n if (Engine == :XP && act.damage.is_a?(String)) ||\n (Engine == :VX && act.hp_damage.is_?(String))\n damage += 0\n else\n damage += Engine == :XP ? act.damage : act.hp_damage\n end\n act.restore_state\n }\n return damage\n else\n damages = []\n $game_party.actors.each {|act|\n act.store_state\n act.skill_effect(self, skill)\n damage = Engine == :XP ? act.damage : act.hp_damage\n act.restore_state\n damages.push(damage.is_a?(String) ? 0 : damage)\n }\n return damages\n end\n end", "title": "" }, { "docid": "cb46919724b3c5b394c9cc4109b4d1b8", "score": "0.50807506", "text": "def base_atk\n return get_modifiers_weapon(:atk) if @weapon != nil\n return base_str * 2\n end", "title": "" }, { "docid": "74529501d53d4d997f1197c4be58b63b", "score": "0.5077056", "text": "def battler_hue\n return 0\n end", "title": "" }, { "docid": "74529501d53d4d997f1197c4be58b63b", "score": "0.5077056", "text": "def battler_hue\n return 0\n end", "title": "" } ]
0a687c0717a21d0fe348a3be666d627d
Pseudopreordered array of nodes. Children will always follow parents, but the ordering of nodes within a rank depends on their order in the array that gets passed in
[ { "docid": "7dfb25f5a49019e8ddcee0cc32793f9e", "score": "0.0", "text": "def sort_by_structure(nodes)\n arranged = nodes.is_a?(Hash) ? nodes : arrange_nodes(nodes.sort_by{|n| n.structure || '0'})\n arranged.inject([]) do |sorted_nodes, pair|\n node, children = pair\n sorted_nodes << node\n sorted_nodes += sort_by_structure(children) unless children.blank?\n sorted_nodes\n end\n end", "title": "" } ]
[ { "docid": "c07cb8c765bf10a84fef5f02845b99cf", "score": "0.65265447", "text": "def parent_nodes(n)\n ans = []\n for_each_link do |i,j|\n ans << i if j == n\n end\n ans\n end", "title": "" }, { "docid": "113289d3842fcaa1046111768485a0f5", "score": "0.6196381", "text": "def arrange_nodes(nodes); end", "title": "" }, { "docid": "2c3bfdc537fe1a73eeeae0116c682598", "score": "0.6176964", "text": "def sift_up_nodes(child_index)\n @array[child_index], @array[@parent_index] = @array[@parent_index], @array[child_index]\n @sifted_indexes << [@parent_index, child_index]\nend", "title": "" }, { "docid": "8c209e71c7e50573afb81d586e0b27e4", "score": "0.6049867", "text": "def postorder\n nodes_array = []\n postorder_helper(@root, nodes_array)\n return nodes_array\n end", "title": "" }, { "docid": "d1e5cdc04902d38c5cbcd569f6812326", "score": "0.5985076", "text": "def preorder\n nodes_array = []\n preorder_helper(@root, nodes_array)\n return nodes_array\n end", "title": "" }, { "docid": "67a73f6f52b9061271d3639774720e3f", "score": "0.598376", "text": "def tsort_each_child(n, &b) @neighbors_list[n].each(&b) end", "title": "" }, { "docid": "4cdc11a07899be2e4fff0af0d7415123", "score": "0.5975619", "text": "def pre_order(node)\n return [] if node.nil?\n results = []\n results << node.weight\n i = 0\n while i < node.children.length\n results.concat pre_order(node.children[i])\n i += 1\n end\n return results\nend", "title": "" }, { "docid": "1dbe9c3211c8f1c8371bcdfa173e6984", "score": "0.5963274", "text": "def children\n nodes_array = []\n\n 3.times do |row|\n 3.times do |col|\n pos = [row, col]\n next unless @board.empty?(pos)\n child_node = make_child(pos)\n nodes_array << child_node\n end\n end\n\n nodes_array\n end", "title": "" }, { "docid": "eaefd30dd28a66bde137c26e42528e09", "score": "0.59232396", "text": "def make_tree(arr)\n # randomize the order of the input to avoid situations where the height of the tree will be close to its number of elements\n arr.shuffle! \n root = Node.new arr[-1]\n arr.pop\n arr.each {|num| root.insert(num)}\n root\nend", "title": "" }, { "docid": "0017763765f8c84e455f608d3942f282", "score": "0.5893763", "text": "def children\n childs = []\n return childs if @n.zero?\n\n j = value\n childs << j - ((j & -j) >> 1)\n childs << j + ((j & -j) >> 1)\n childs.map do |j|\n n = @n - 1\n # j = m * 2**(n-1) <=>\n m = j / (2 ** n)\n # m = 2 * k - 1 <=> k = (m + 1) / 2 [m uneven => (m + 1) / 2 is int]\n k = (m + 1) / 2\n NaturalOrder.new(n, k)\n end\n end", "title": "" }, { "docid": "32eec6b3e1b2ce58edf8b70a21a18a07", "score": "0.58153725", "text": "def document_order( array_of_nodes )\n new_arry = []\n array_of_nodes.each { |node|\n node_idx = [] \n np = node.node_type == :attribute ? node.element : node\n while np.parent and np.parent.node_type == :element\n node_idx << np.parent.index( np )\n np = np.parent\n end\n new_arry << [ node_idx.reverse, node ]\n }\n #puts \"new_arry = #{new_arry.inspect}\"\n new_arry.sort{ |s1, s2| s1[0] <=> s2[0] }.collect{ |s| s[1] }\n end", "title": "" }, { "docid": "e97d0b8d109dbc499971e14f60607b10", "score": "0.5791353", "text": "def postorder\n arr = []\n post_order(@root, arr)\n return arr\n end", "title": "" }, { "docid": "e19d4673d6881385e5367e7a9707a1d4", "score": "0.5790414", "text": "def link_nodes(n)\n list_array = []\n parent = Queue.new\n child = Queue.new\n\n parent.enq(n)\n list_a = LinkedList.new\n while !parent.empty?\n # same as pop\n temp = parent.deq\n list_a.append_after(temp)\n child.enq(temp.left)\n child.enq(temp.right)\n if !parent.empty?\n tempQ = parent\n parent = child\n child = tempq\n else\n list_array << list_a\n list_a = LinkedList.new\n end\n end\n return list_array\nend", "title": "" }, { "docid": "62e1541dd39ccc4eeddf7a47d8a1e1ce", "score": "0.57605577", "text": "def preorder(array_of_values = [], pointer = root)\n return array_of_values if pointer.nil?\n\n array_of_values << pointer.data\n preorder(array_of_values, pointer.left_child)\n preorder(array_of_values, pointer.right_child)\n end", "title": "" }, { "docid": "8392ba73c910060feaad39477f0eefbd", "score": "0.5758784", "text": "def children\n new_arr = []\n (0..2).each do |i|\n (0..2).each do |j|\n pos = [i,j]\n if @board.empty?(pos)\n new_board = @board.dup\n new_board[pos] = @next_mover_mark\n new_node = TicTacToeNode.new(new_board, @new_mark, pos)\n new_arr << new_node\n end\n end\n end\n new_arr\n end", "title": "" }, { "docid": "972e9e6b3619449285ca17c726836f17", "score": "0.5755158", "text": "def orderArrayChildren(arrayChildren) \t\r\n for i in (arrayChildren.length-1).downto(1)\r\n \tfor j in [email protected]\r\n \t\tif @orderArray[j] == arrayChildren[i].name[3..arrayChildren[i].name.length]\r\n \t\t\tindex1 = j\r\n \t\telsif @orderArray[j] == arrayChildren[i-1].name[3..arrayChildren[i].name.length]\r\n \t\t\tindex2 = j\r\n \t\tend \r\n \tend\r\n \tif index1<index2\r\n \t\tt = arrayChildren[i-1]\r\n \t\tarrayChildren[i-1] = arrayChildren[i]\r\n \t\tarrayChildren[i] = t\r\n \tend\r\n end\r\n return arrayChildren\r\n end", "title": "" }, { "docid": "55085946e9c809c08d2ad327eb7c1519", "score": "0.5752293", "text": "def install_order(arr)\n vertices = []\n max_id = 0\n arr.flatten.each {|val| max_id = val if val > max_id}\n (1..max_id).each {|i| vertices << Vertex.new(i)}\n arr.each do |tup|\n Edge.new(vertices[tup[1]-1], vertices[tup[0]-1])\n end\n\n sorted = topological_sort(vertices)\n order = []\n sorted.each {|v| order << v.value}\n order\nend", "title": "" }, { "docid": "22d139c86bb52977c38f769a973d6016", "score": "0.5732902", "text": "def shuffle\n @shuffled_order ||= @children.shuffle\n running_idx = @shuffled_order.find_index { |node| node.status.running? }.to_i\n\n @shuffled_order[running_idx..]\n end", "title": "" }, { "docid": "222f0e403e0c6a91750884bb932a328e", "score": "0.57307625", "text": "def build_ranked_tree(model)\n # inflate the node id to test id wrap around edge cases\n ENV[\"NODES\"].to_i.times { model.create!.destroy } if ENV[\"NODES\"]\n\n n1 = model.create!(:rank => 0)\n n2 = model.create!(:rank => 1)\n n3 = model.create!(:rank => 3, :parent => n1)\n n4 = model.create!(:rank => 0, :parent => n2)\n n5 = model.create!(:rank => 0, :parent => n1)\n n6 = model.create!(:rank => 1, :parent => n2)\n\n puts \"create: #{n1.id}..#{n6.id}\" if ENV[\"NODES\"]\n [n1, n2, n3, n4, n5, n6]\n end", "title": "" }, { "docid": "1cf6953335343d13065db14b326c16ae", "score": "0.5706754", "text": "def children\n new_arr = []\n\n # Every empty node do: make a dupe board w/ `next mover mark` in the\n # pos. Alternate `next_mover_mark`, and set `prev_move_pos` to the pos\n # marked.\n @board.rows.each_with_index do |row, y|\n row.each_with_index do |e, x|\n pos = [x, y]\n if @board.empty?(pos)\n new_board = @board.dup\n new_board[pos] = @next_mover_mark\n\n new_mover_mark = self.inverse_mark(new_mover_mark)\n\n new_arr << TicTacToeNode.new(new_board, new_mover_mark, pos)\n end\n end\n end\n\n new_arr\n end", "title": "" }, { "docid": "bc1af2151e88ad4ea90a96a1fbdc28fd", "score": "0.5705508", "text": "def children_fast\n childs = []\n return childs if @n == 0\n\n childs << NaturalOrder.new(@n - 1, @k * 2 - 1)\n childs << NaturalOrder.new(@n - 1, @k * 2)\n end", "title": "" }, { "docid": "a357cdfbfedd2fd7b37589074709d03e", "score": "0.57033235", "text": "def create_child_nodes(array, entrants)\n # Of a given round (array), create next round (new_array)\n # with the entrants provided\n new_array = array.each_with_object([]) do |given_node, new_array|\n left_node = Node.create(parent_id: given_node.id)\n right_node = Node.create(parent_id: given_node.id)\n new_array << left_node\n new_array << right_node\n end\n\n ### BASE CASE\n # If the latest round includes as many or more nodes as there are entrants\n if new_array.length >= entrants.length\n # .each over them to fill them with the shuffled entrants\n shuffled_entrants = entrants.shuffle\n new_array.each do |node|\n node.update(name: shuffled_entrants[0][\"name\"])\n node.update(team_id: shuffled_entrants.shift()[\"id\"])\n end\n else\n # Recursively create next round of Nodes\n create_child_nodes(new_array, entrants)\n end\n end", "title": "" }, { "docid": "3149b56487c55fefc8e56f780412bf0c", "score": "0.5690943", "text": "def postorder\n array = []\n if root.nil?\n return array\n else\n root.postorder(array)\n return array\n end\n end", "title": "" }, { "docid": "795309e8eab9572203655dd938fc5e51", "score": "0.5690927", "text": "def children\n \n arr = []\n \n [0, 1, 2].product([0, 1, 2]).each do |pos|\n if @board.empty?(pos)\n new_board = @board.dup\n new_board[pos] = @next_mover_mark\n \n next_mark = @next_mover_mark == :x ? :o : :x\n \n arr << TicTacToeNode.new(new_board, next_mark, pos)\n end\n end\n \n arr\n \n end", "title": "" }, { "docid": "1173a2caa7a8475848ba75f483e028cb", "score": "0.5662283", "text": "def topological_sort\n\t\t@explored_nodes = Array.new(vertices.count, false)\n\t\t@current_label = vertices.count\n\t\t@topological_order = Array.new(vertices.count, nil)\n\t\tvertices.count.times do |label|\n\t\t\tdfs_topological_order(label) unless @explored_nodes[label-1]\n\t\tend\n\t\ttopological_order\n\tend", "title": "" }, { "docid": "63e3747fa87e29870863152562e19ba4", "score": "0.56504726", "text": "def children\n arr = []\n mark = :x\n\n if @next_mover_mark == :x\n mark = :o\n end\n (0..2).each do |i|\n (0..2).each do |j|\n\n current_board = @board.dup\n if current_board.rows[i][j].nil?\n\n current_board.rows[i][j] = @next_mover_mark\n new_node = TicTacToeNode.new(current_board, mark, [i,j])\n arr << new_node\n end\n end\n end\n arr\n end", "title": "" }, { "docid": "e89f76d6c561da81b4bd25ab299a7ce5", "score": "0.56290585", "text": "def rerank_children\n c = children.order(:rank)\n n = c.length\n transaction do\n c.each_with_index do |node, k|\n node.rank = (k + 1) / Float(n + 1) # We use k+1 because the index is 0-based.\n node.save!\n end\n end\n end", "title": "" }, { "docid": "b4db79cf8d9021c713265934c7e4d992", "score": "0.56148064", "text": "def pre_order_traversal(tree_node = @root, arr = [])\n end", "title": "" }, { "docid": "8c0ad7d98eec152b53026592d6761848", "score": "0.5609705", "text": "def sequence nodes, normalize = true\n return [] if nodes.blank?\n\n sorted_nodes = nodes.sort_by { |node| node.arranged_at || 0 }\n\n sorted_nodes = normalize(sorted_nodes) if normalize\n\n sorted_nodes\n end", "title": "" }, { "docid": "a7c85eceb9990e66d34bdf88fc5812e0", "score": "0.55971515", "text": "def postorder\n arr = []\n current = @root\n\n postorder_helper(arr, current)\n end", "title": "" }, { "docid": "0af0eb690c2fd4f5eee97a3cbdcc88d1", "score": "0.55882186", "text": "def preorder\n ret = Array.new\n preorderHelper @root, ret\n return ret\n end", "title": "" }, { "docid": "0af0eb690c2fd4f5eee97a3cbdcc88d1", "score": "0.55882186", "text": "def preorder\n ret = Array.new\n preorderHelper @root, ret\n return ret\n end", "title": "" }, { "docid": "97829e5a558e6fe93e6ae42564c75645", "score": "0.55831826", "text": "def children\n arr = []\n [0, 1, 2].product([0, 1, 2]).each do |pos|\n if board.empty?(pos)\n c_board = board.dup\n c_board[pos] = next_mover_mark\n # debugger\n new_mark = (next_mover_mark == :x ? :o : :x)\n # debugger\n arr << TicTacToeNode.new(c_board, new_mark, pos)\n # debugger \n end\n end\n arr\n end", "title": "" }, { "docid": "73e4626c5733d68cadd291c2c3e5c0b8", "score": "0.55809504", "text": "def arrayForPrint(node,array,flag,parent)\r\n index = 0\r\n node.children.each do |child|\r\n \tif (child.name =~ /^seq(\\d+).*/)\r\n \t\tindex = child.name[3..3+($1.to_s.length-1)].to_i\r\n \t\tif array[index] == nil\r\n \t\t\tarray[index] = \" \" + child.to_s\r\n \t\tend \r\n \tend\r\n end \r\n if flag\r\n \tif (node != node.falseSiblings)\r\n \t\tnodeT = deepestFakeNode(node.falseSiblings) \r\n \t\tarray = arrayForPrint(nodeT,array,false,node.parent)\r\n \tend \r\n \tif node.parent == nil\r\n \t\treturn array\r\n \telse\r\n \t\treturn arrayForPrint(node.parent,array,true,nil)\r\n \tend\r\n else\r\n \tif node.parent == parent\r\n \t\treturn array\r\n \telse\r\n \t\treturn arrayForPrint(node.parent,array,false,parent)\r\n \tend\r\n end\r\n end", "title": "" }, { "docid": "c73a41fc85cb8bed3e34968c7b98051a", "score": "0.5577489", "text": "def children\n array = []\n (0..2).each do |row|\n (0..2).each do |col|\n pos = [row, col]\n if @board.empty?(pos)\n new_board = @board.dup\n new_board[pos] = next_mover_mark\n next_mark = ((next_mover_mark == :x) ? :o : :x)\n array << TicTacToeNode.new(new_board, next_mark, pos) \n end\n end\n end\n array\n end", "title": "" }, { "docid": "0c95a9488d66ae07d017b5eef1e04656", "score": "0.5564445", "text": "def postorder\n array = []\n root_node = @root\n return bst_postorder(root_node, array)\n end", "title": "" }, { "docid": "1dc204b05859ff87cd1f51ecc35140ab", "score": "0.5563072", "text": "def children\n children_array = []\n\n 3.times do |row_number|\n 3.times do |column_number|\n new_pos = [row_number, column_number]\n\n if @board.empty?(new_pos)\n new_board = @board.dup\n new_board.[]=(new_pos, @next_mover_mark)\n new_child = TicTacToeNode.new(new_board, next_mark, new_pos)\n children_array << new_child\n end\n end\n end\n\n children_array\n end", "title": "" }, { "docid": "5e7adea6b0590218d3f9f6b15324123d", "score": "0.55619425", "text": "def postorder\n array = []\n postorder_helper(@root, array)\n return array\n end", "title": "" }, { "docid": "24255ad9e06dc9aa5c398a474269e9a2", "score": "0.5561675", "text": "def postorder\n nodes = []\n if @root\n add_nodes_postorder(root, nodes)\n end\n return nodes\n end", "title": "" }, { "docid": "5f69a9aa336e91014c4ae6b1a615b34f", "score": "0.55487144", "text": "def parent\n j = value\n j = (j - (j & -j)) | ((j & -j) << 1)\n n = @n + 1\n # j = m * 2**n <=>\n m = j / (2 ** n)\n # m = 2 * k - 1 <=> k = (m + 1) / 2 [m uneven => (m + 1) / 2 is int]\n k = (m + 1) / 2\n NaturalOrder.new(n, k)\n end", "title": "" }, { "docid": "2c908e305cd4566c686c28646b6d10df", "score": "0.55406785", "text": "def nodes\n @nodes ||= Array.new\n end", "title": "" }, { "docid": "1f34c3a9af15d39409c2450c0fb90e97", "score": "0.5538267", "text": "def install_order(arr)\n list_el = []\n graph = []\n top = []\n arr.each do |el|\n list_el.push(el[0]) unless list_el.include?(el[0])\n graph.push(Edge.new(Vertex.new(el[1]), Vertex.new(el[0])))\n end\n\n sorted = []\n (1..list_el.max).each do |idx|\n sorted.push(idx) unless list_el.include?(idx)\n end\n\n graph.each do |task|\n if task.from_vertex.in_edges.empty?\n top.push(task.from_vertex)\n end\n end\n\n until top.empty?\n current = top.shift\n sorted << current.value unless sorted.include?(current.value)\n current.out_edges.each do |edge|\n edge.to_vertex.in_edges.delete(edge)\n if edge.to_vertex.in_edges.empty?\n top.push(edge.to_vertex)\n end\n end\n end\n sorted\nend", "title": "" }, { "docid": "38eed73ac5869aaf3f981f113ec4b23e", "score": "0.55349183", "text": "def children\n arr = []\n (0..2).each do |row|\n (0..2).each do |col|\n position = [row, col]\n if board[position].nil?\n new_board = board.dup\n new_board[position] = next_mover_mark\n # prev_move_pos = new_board[row][col]\n if next_mover_mark == :x\n next_mover_mark = :o \n else\n next_mover_mark = :x\n end\n arr << TicTacToeNode.new(new_board, next_mover_mark, position)\n end\n end\n end\n arr\n end", "title": "" }, { "docid": "9161c12cc69a3a9e56e7df2bcf8f16c1", "score": "0.55252326", "text": "def postorder\n #Left, Right, Current\n new_array = Array.new()\n postorder_helper(@root, new_array)\n end", "title": "" }, { "docid": "fa8ddc23f26c2e76e698a01b208ab603", "score": "0.5523898", "text": "def build_tree(array)\n n = array.size\n parent = Node.new(array[n/2])\n array.delete_at(n/2)\n until array.size == 0\n n = array.size\n child = Node.new(array[n/2])\n array.delete_at(n/2)\n parent.child_assign(child)\n end\n parent\nend", "title": "" }, { "docid": "113095f2eefd7cf146021bb92bd72623", "score": "0.5521715", "text": "def siblings_by_position\n siblings.ascending(:position)\n end", "title": "" }, { "docid": "29279bf13d21a50b0b80142306334df1", "score": "0.55125135", "text": "def postorder\n node_array = []\n if !@root\n return node_array\n end\n current = @root\n\n node_array = traverse_postorder(node_array, current)\n\n return node_array\n end", "title": "" }, { "docid": "dadc4955839580674bc10f041e3b3e6b", "score": "0.55116814", "text": "def children\n kids = []\n (0..2).each do |y|\n (0..2).each do |x|\n if @board.empty?([x,y])\n kids << [x,y]\n \n end\n end\n end\n \n #We need to put th mark on the board\n #we need to have prev_pos\n #make a new board\n new_arr = [] \n kids.each do |kid|\n new_board = @board.dup\n new_board[kid] = @next_mover_mark\n other_mark = self.switch_mark\n new_arr << TicTacToeNode.new(new_board, other_mark, kid)\n \n end\n new_arr\n end", "title": "" }, { "docid": "2711ca89267c01f8fd98df104538de96", "score": "0.5505791", "text": "def build_tree(array)\n array = array.sort.uniq\n define_node(array)\n end", "title": "" }, { "docid": "51490d90c3d041d6bffef11c2495c789", "score": "0.55023956", "text": "def preorder\n arr = []\n pre_order(@root, arr)\n return arr\n end", "title": "" }, { "docid": "d9cdddf15e90c84bec4ec7e2a330875b", "score": "0.550219", "text": "def postorder\n array = []\n return array if @root == nil\n current = @root\n return postorder_helper(current, array)\n end", "title": "" }, { "docid": "4a24e8b08529a5b8fc36a1d90c3186b5", "score": "0.549458", "text": "def children\n result_array = []\n 3.times do |row|\n 3.times do |col|\n if @board.empty?([row, col])\n next_possible_board = @board.dup\n next_possible_board[[row,col]] = @next_mover_mark\n next_mark = :x\n next_mark = :o if @next_mover_mark == :x\n prev_move_pos = [row, col]\n result_array << TicTacToeNode.new(next_possible_board, next_mark, prev_move_pos)\n end\n end\n end\n result_array\n end", "title": "" }, { "docid": "3c2c38d5ae59726e69e2a4dce3a2043f", "score": "0.5489346", "text": "def postorder\n array = []\n return array if @root.nil?\n postorder_helper(array, @root)\n return array\n end", "title": "" }, { "docid": "18b0488ccb7f2ef6526f05c5dd13424d", "score": "0.5488415", "text": "def postorder\n return [] if @root.nil?\n traverse_postorder(@root)\n return @nodes\n end", "title": "" }, { "docid": "0146c2c2e7868d1eb583ccca56c09ace", "score": "0.5486179", "text": "def pre_order(node = @root, array = [])\n return if node == nil\n array << node.value\n pre_order(node.left, array)\n pre_order(node.right, array)\n return array\n end", "title": "" }, { "docid": "fb6693882e01cfd39172eee33fc11bae", "score": "0.5482794", "text": "def children\n array = []\n @board.rows.each_with_index do |row, i|\n row.each_with_index do |pos, i2|\n\n if pos == nil && @next_mover_mark == :o\n board_dup = @board.dup\n pos = [i,i2]\n board_dup[pos] = :o\n array << TicTacToeNode.new(board_dup, :x, [i,i2])\n\n elsif pos == nil && @next_mover_mark == :x\n board_dup = @board.dup\n pos = [i, i2]\n board_dup[pos] = :x\n array << TicTacToeNode.new(board_dup, :o, [i,i2])\n end\n end\n end\n array\n end", "title": "" }, { "docid": "cb3bd4aa07fd53f3f05e8801dc165ce3", "score": "0.54826665", "text": "def install_order(arr)\n #search for nodes with no dependencies\n #first, search for max_id\n max = arr.flatten.max\n solutions = []\n (1..max).to_a.each do |num|\n solutions.push(num) unless arr.flatten.include?(num)\n end\n #make the graph\n found = []\n vertices_arr = []\n arr.each do |dependency|\n new_el = []\n if found.find_index{|el| el.value == dependency[0]}\n new_el.push(found[found.find_index{|el| el.value == dependency[0]}])\n else\n new_vertex = Vertex.new(dependency[0])\n found.push(new_vertex)\n new_el.push(new_vertex)\n end\n if found.find_index{|el| el.value == dependency[1]}\n new_el.push(found[found.find_index{|el| el.value == dependency[1]}])\n else\n new_vertex = Vertex.new(dependency[1])\n found.push(new_vertex)\n new_el.push(new_vertex)\n end\n vertices_arr.push(new_el)\n end\n vertices_arr.each do |vertices|\n new_edge = Edge.new(vertices[1],vertices[0])\n end\n ans = topological_sort(found)\n sol = []\n ans.each do |vertex|\n sol << vertex.value\n end\n sol.concat(solutions)\nend", "title": "" }, { "docid": "e2b82237c93ee401cabb9aec420b0010", "score": "0.54765815", "text": "def children\n child_arr = []\n 0.upto(2) do |row|\n 0.upto(2) do |col|\n pos = [row, col]\n if board.empty?(pos)\n new_board = board.dup\n\n if next_mover_mark == :x\n mark = :o\n new_board[pos] = :x\n else\n mark = :x\n new_board[pos] = :o\n end\n child_arr << TicTacToeNode.new(new_board, mark, pos)\n end\n end\n end\n child_arr\n end", "title": "" }, { "docid": "5093ec29b227fbea0f644aba4ebb39e4", "score": "0.5472591", "text": "def postorder\n if @root == nil\n return []\n end\n \n current = @root\n getPostOrder(current)\n return @inOrderArray\n end", "title": "" }, { "docid": "0b452fff8f78aa05b529d158b6c01bbe", "score": "0.5472484", "text": "def preorder\n #Current, Left, Right\n new_array = Array.new()\n preorder_helper(@root, new_array)\n end", "title": "" }, { "docid": "e95a06d777e7081a3c60a661c0a1349c", "score": "0.5470757", "text": "def make_tree_sorted(arr)\n # deal with (base) cases where we've put in an empty list (the children created from such lists will be nil, ie, there won't be any children.)\n return nil if arr.length == 0\n \n m = arr.length / 2\n this_node = Node.new arr[m]\n # return the node itself if the input array is just one number (because it's the last child of whatever node recursively called it into existence.)\n return this_node if arr.length == 1\n \n this_node.left = make_tree_sorted(arr[0...m])\n this_node.right = make_tree_sorted(arr[m+1..-1])\n # return the root node, from which we can begin searches\n this_node\nend", "title": "" }, { "docid": "39934270e6cc32af4843652e13a3cbb3", "score": "0.5470208", "text": "def preorder\n nodes = []\n if @root\n add_nodes_preorder(root, nodes)\n end\n return nodes\n end", "title": "" }, { "docid": "bdb918849aa378a18e29abcbd0a675b9", "score": "0.54694545", "text": "def preorder_traversal\n list = [@name]\n list << @children.map { |child| child.preorder_traversal }\n end", "title": "" }, { "docid": "85224cce958538236e28586cd20e02f8", "score": "0.5468407", "text": "def heapify!(array)\n array.each_index do |current|\n\n # Swaps the current node with its parent if it's smaller than its parent\n while heapify_up?(array, current)\n swap!(array, current, parent(current))\n\n # Continues to swap up until it can't or at the root node\n current = parent(current)\n end\n end\nend", "title": "" }, { "docid": "77a93f6f1271e117288354fc083709ee", "score": "0.5465554", "text": "def pre_order(node = @root, array = [])\n return [node.value] unless node.children\n\n array.push(node.value)\n\n if node.left\n node.left.children ? pre_order(node.left, array) : array.push(node.left.value)\n end\n\n if node.right\n node.right.children ? pre_order(node.right, array) : array.push(node.right.value)\n end\n\n array\n end", "title": "" }, { "docid": "8afed5218d65aa2596d78e3669f9326d", "score": "0.546413", "text": "def build_tree(data_array)\n #children = n * 2 + 1 and + 2\n node_array = []\n \n # Convert all data into Nodes\n data_array.each do |element|\n to_add = Node.new\n to_add.value = element\n node_array += Array(to_add)\n end\n \n temp_array = node_array.dup\n sorted_array = []\n \n # Extract the smallest node and push it into sorted_array\n # The tree will be sorted by default\n while(temp_array.length != 0)\n min_val = 999_999_999\n min_index = -1\n \n # Find the smallest node\n temp_array.each_with_index do |node, index|\n if(node.value < min_val)\n min_val = node.value\n min_index = index\n end\n end\n \n # Remove it and push it into sorted_array\n sorted_array += Array(temp_array[min_index])\n temp_array.delete_at(min_index)\n end\n \n node_array = sorted_array\n \n # Link the nodes together\n node_array.each_with_index do |node, index|\n for i in (1..2) do\n if(node_array[index * 2 + i] != nil)\n node.left = node_array[index * 2 + i] if(i == 1)\n node.right = node_array[index * 2 + i] if(i == 2)\n node_array[index * 2 + i].parent = node\n end\n end\n end\n \n return node_array[0]\n #return node_array\nend", "title": "" }, { "docid": "85b2b2cfcedfde376cb8e620c311038d", "score": "0.5461841", "text": "def postorder\n return @nodes if !@root\n postorder_helper(@root)\n return @nodes\n end", "title": "" }, { "docid": "2ca84043691c2e32747e4bbb2e2765ee", "score": "0.5459753", "text": "def preorder\n array = []\n return preorder_helper(array, @root)\n end", "title": "" }, { "docid": "87c329f1fbdd6336903cbe7d3026372b", "score": "0.5458388", "text": "def children\n node_arr=[]\n # debugger\n # [email protected]\n @board.rows.each.with_index do |row,i|\n row.each.with_index do |ele,j|\n\n # if @board.empty?([i,j]) \n if @board.empty?([i,j]) \n [email protected]\n # marker=\n dup_board[[i,j]]=@next_mover_mark # this is why\n new_mover_mark=@next_mover_mark ==:x ? :o : :x\n\n new_prev_move_pos=[i,j]\n # node=self.class.new(dup_board,new_mover_mark,new_prev_move_pos)\n\n node_arr << self.class.new(dup_board,new_mover_mark,new_prev_move_pos)\n end\n end\n #Board.new(rows)\n\n end\n # p node_arr\nnode_arr\nend", "title": "" }, { "docid": "ef5cbae8fd0ce412d6e66202bcf75ddf", "score": "0.5455609", "text": "def insert_nodes(arr)\n\t\tarr.each do |value|\n\t\t\tnode = Node.new(value)\n\t\t\ttmp = @root\n\n\t\t\t# Travel across the Tree until the correct level and available spot is found for the element.\n\t\t\twhile (node.value < tmp.value && tmp.l_child != nil) || (node.value > tmp.value && tmp.r_child != nil)\n\t\t\t\tif node.value < tmp.value\n\t\t\t\t\ttmp = tmp.l_child\n\t\t\t\telse\n\t\t\t\t\ttmp = tmp.r_child\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Once in the correct BinaryTree level set the correct child and parent relationship.\n\t\t\tif node.value < tmp.value\n\t\t\t\tnode.parent = tmp\n\t\t\t\ttmp.l_child = node\n\n\t\t\telse\n\t\t\t\tnode.parent = tmp\n\t\t\t\ttmp.r_child = node\n\t\t\tend\n\t\tend\n\t\tp arr\n\tend", "title": "" }, { "docid": "2ef6f39b0bf0c0a3d45d8977eaf1f1f8", "score": "0.54477024", "text": "def array_to_nodes(arr)\n root = nil\n return root if arr.nil? || arr.empty?\n\n arr.each do |node_value|\n \n end\n\n root\n end", "title": "" }, { "docid": "569d64cc474b18125ea9f154a849dd32", "score": "0.5445545", "text": "def level_order(array_of_values = [], queue = [], pointer = root)\n return if pointer.nil?\n\n queue << pointer\n until queue.empty?\n pointer = queue.shift\n array_of_values << pointer.data\n queue << pointer.left_child unless pointer.left_child.nil?\n queue << pointer.right_child unless pointer.right_child.nil?\n end\n array_of_values\n end", "title": "" }, { "docid": "2ae749b030d366783db9af1982337400", "score": "0.5441743", "text": "def install_order(arr)\n max = 0\n arr.each { |tuple| max = tuple[0] if tuple[0] > max }\n\n vertices = (1..max).map { |package_id| Vertex.new(package_id) }\n arr.each { |tuple| Edge.new(vertices[tuple[1] - 1], vertices[tuple[0] - 1]) }\n\n topological_sort(vertices).map(&:value)\nend", "title": "" }, { "docid": "a59af3070285d261a5bb16ac2fad8d62", "score": "0.54386926", "text": "def children\n children_arr = []\n (0...3).each do |row|\n (0...3).each do |col|\n pos = [row,col]\n if self.board.empty?(pos)\n new_board = self.board.dup\n new_board[pos] = next_mover_mark \n next_mark = self.next_mover_mark == :x ? :o : :x\n children_arr << self.class.new(new_board, next_mark ,pos)\n end\n end\n end\n children_arr\n end", "title": "" }, { "docid": "48b51e4a948d9de982a6407c1c2366b4", "score": "0.54377705", "text": "def preorder\n array = []\n root_node = @root\n return bst_preorder(root_node, array)\n end", "title": "" }, { "docid": "1236a7ea3f739c00742b79a2ac672177", "score": "0.5433584", "text": "def children\n nodes = []\n (0..2).each do |row_idx|\n (0..2).each do |col_idx|\n if @board.empty?([row_idx, col_idx])\n duped_board = @board.dup\n duped_board[[row_idx, col_idx]] = next_mover_mark\n nodes << TicTacToeNode.new(duped_board, @current_mark, [row_idx, col_idx])\n end\n end\n end\n nodes\n end", "title": "" }, { "docid": "34b85ab92f693def49355925505084b8", "score": "0.54313886", "text": "def children\n result = []\n (0..2).each do |row_idx|\n (0..2).each do |col_idx|\n duped = @board.dup\n unless duped[[row_idx, col_idx]]\n duped[[row_idx, col_idx]] = @next_mover_mark\n result << TicTacToeNode.new(duped, @current_mark, [row_idx, col_idx])\n end\n end\n end\n\n result\n end", "title": "" }, { "docid": "b5d8634c0833f0817edbfb9fcd508cd5", "score": "0.5424776", "text": "def children\n children_arr = []\n @board.rows.each_with_index do |row, row_idx|\n row.each_with_index do |col, col_idx|\n\n pos = [row_idx, col_idx]\n next unless @board.empty?(pos)\n new_board = @board.dup\n new_board[pos] = @next_mover_mark\n new_node = TicTacToeNode.new(new_board, swap_mark, pos)\n children_arr << new_node\n end\n end\n children_arr\n end", "title": "" }, { "docid": "1b7232b1087d477813ae7a7205047458", "score": "0.54245245", "text": "def sorted_triples(array)\nend", "title": "" }, { "docid": "9a63bd9b9b100c45c94cdba312034a2d", "score": "0.5424272", "text": "def sorted_nids\n\n nodes.keys\n .inject([]) { |a, nid|\n l = nid.split('_').length\n (a[l] ||= []) << nid\n a }\n .compact\n .collect(&:sort)\n .flatten(1)\n end", "title": "" }, { "docid": "c19f527fa1ed38cfb2d7cf9dfb6fed43", "score": "0.5423665", "text": "def build_tree(array)\n btsArray = []\n \n array.each_with_index do |e, index|\n if index == 0\n btsArray.push(node = Node.new(e))\n else\n parentNode = compare(btsArray[0], e)\n btsArray.push(node = Node.new(e, parentNode))\n puts parentNode.class\n puts \"Value being pushed is #{e}\"\n if parentNode.class != nil\n if parentNode.value > e\n parentNode.left_child = btsArray[btsArray.length - 1]\n elsif parentNode.value < e\n parentNode.right_child = btsArray[btsArray.length - 1]\n #puts \"This is the set: #{btsArray[btsArray.length - 1].value}\"\n end\n end\n end\n end\n \n return btsArray\n #array[array.length/2]\nend", "title": "" }, { "docid": "f6916e5269ac2a1083143c3ea9d480df", "score": "0.54208225", "text": "def children\n children_arr = []\n (0...3).each do |i|\n (0...3).each do |j|\n if @board.empty?([i, j])\n new_board = @board.dup\n new_board[[i,j]] = @next_mover_mark\n children_arr << TicTacToeNode.new(new_board, @next_mover_mark == :x ? :o : :x, [i, j] )\n end\n end\n end\n children_arr\n end", "title": "" }, { "docid": "24fb424dbc7803a9eb1d00c9743ea3e4", "score": "0.541819", "text": "def children\n arr = []\n\n (0..2).each do |rows|\n (0..2).each do |cols|\n indices = [rows,cols]\n\n next unless board.empty?(indices)\n\n new_board = board.dup\n new_board[indices] = self.next_mover_mark\n next_mover_mark = (self.next_mover_mark == :x ? :o : :x)\n\n children << TicTacToeNode.new(new_board, next_mover_mark, pos)\n end\n end\n\n arr\n end", "title": "" }, { "docid": "16a0bad6a0e40af5c56ca642002839af", "score": "0.54138404", "text": "def nodes(arr)\n\tlength = arr.count\n\n\tif length > 3\n\t\troot = (length/2)\n\t\tp arr[root]\n\t\tp \"+++++++++\"\n\t\tp arr.slice(0, (root))\n\t\tp arr.slice(root+1, (length - root))\n\t\tp \"++++++++++++\"\n\t\tnodes(arr.slice(0, (root)))\n\t\tnodes(arr.slice(root+1, (length - root)))\n\telse\n\t\troot = length/2\n\n\t\tif length == 1 || length == 2\n\t\t\tp \"root => #{arr[0]}\"\n\t\t\tp \"right => #{arr[1]}\" rescue \"\"\n\t\telse\n\t\t\tp \"root => #{arr[1]}\"\n\t\t\tp \"left => #{arr.first}\"\n\t\t\tp \"right => #{arr.last}\"\n\t\tend\n\t\tp \"--------\"\n\tend\nend", "title": "" }, { "docid": "8778ac5ed83248249a2dc07980c6be54", "score": "0.54048926", "text": "def children\n children_array = []\n board.rows.each_with_index do |row,idx|\n row.each_with_index do |el, idx2|\n if el.nil?\n new_board = board.dup\n new_board.rows[idx][idx2] = next_mover_mark\n children_array << TicTacToeNode.new(new_board, swap(next_mover_mark), [idx,idx2])\n end\n end\n end\n children_array\n end", "title": "" }, { "docid": "1dfeed95931fcbde597930e0189310dd", "score": "0.54026973", "text": "def children\n children_arr = []\n\n (0...3).each do |row|\n (0...3).each do |col|\n pos = [row, col]\n if board.empty?(pos)\n node = TicTacToeNode.new(@board.dup, next_mover_mark == :o ? :x : :o, pos)\n children_arr << node\n end\n end\n end\n\n children_arr\n end", "title": "" }, { "docid": "3bc5be95eab7ea170895bfb751e11664", "score": "0.5400875", "text": "def preorder\n return @nodes if !@root\n preorder_helper(@root)\n return @nodes\n end", "title": "" }, { "docid": "b0e03eded735b69fec9480684dcb0078", "score": "0.5398515", "text": "def children\n arr = []\n board.rows.each.with_index do |row, i|\n row.each.with_index do |col, j|\n position = [i, j]\n if board[position].nil?\n copy = board.dup\n copy[position] = next_mover_mark\n prev_move_pos = position\n if next_mover_mark == :x\n next_mover_mark = :o\n else\n next_mover_mark = :x\n end\n arr << TicTacToeNode.new(copy, next_mover_mark, prev_move_pos)\n \n end\n end\n end\n arr\n end", "title": "" }, { "docid": "ffa036c494a0ca80c080fcf93d3e69f8", "score": "0.5396033", "text": "def children\n kids = Array.new()\n\n (0..2).each do |row_idx|\n (0..2).each do |col_idx|\n pos = [row_idx, col_idx]\n\n # can't move here unless it's free\n next unless @board.empty?(pos)\n\n new_board = @board.dup\n new_board[pos] = self.next_mover_mark\n next_mover_mark = (self.next_mover_mark == :x ? :o : :x)\n\n kids << TicTacToeNode.new(new_board, next_mover_mark, pos)\n end\n end\n\n kids\n end", "title": "" }, { "docid": "f73088d0f1bc144f26261251982efb7d", "score": "0.53947204", "text": "def postorder\n # This method returns an array of all the elements in a postorder fashion (left, right, root).\n postorder_array = []\n\n postorder_helper(@root, postorder_array)\n end", "title": "" }, { "docid": "779156dc5e4b39545acaa916454ae3f4", "score": "0.539317", "text": "def children\n children_array = []\n\n (0..2).each do |row|\n (0..2).each do |col|\n pos = [row, col]\n next unless @board.empty?(pos)\n\n duped_board = board.dup\n duped_board[pos] = self.next_mover_mark\n next_mover_mark = (self.next_mover_mark == :x ? :o : :x)\n\n children_array << TicTacToeNode.new(duped_board, next_mover_mark, pos)\n end\n end\n\n children_array\n\n end", "title": "" }, { "docid": "625145b5a13d2db6b4c8843c71aafb4b", "score": "0.53894216", "text": "def preorder\n arr = []\n current = @root\n\n preorder_helper(arr, current)\n end", "title": "" }, { "docid": "23d46d6f29d4386fd88f3f95baaff961", "score": "0.53883463", "text": "def children\n children_array = []\n empty_positions = get_empty_positions\n\n empty_positions.each do |pos|\n next_turn_board = @board.dup\n next_turn_board[pos] = @next_mover_mark\n\n new_node = TicTacToeNode.new(next_turn_board,\n opposite_mark(@next_mover_mark), pos)\n children_array << new_node\n end\n\n children_array\n end", "title": "" }, { "docid": "1b3d16febfbbbb98c29ffbc53d0e8472", "score": "0.53810173", "text": "def postorder(array_of_values = [], pointer = root)\n return array_of_values if pointer.nil?\n\n postorder(array_of_values, pointer.left_child)\n postorder(array_of_values, pointer.right_child)\n array_of_values << pointer.data\n end", "title": "" }, { "docid": "92e135539d9553f12c198b72d24734e0", "score": "0.53786856", "text": "def install_order(arr)\n hash = Hash.new { |h, k| h[k] = [-1, []]}\n max_id = -1\n arr.each do |package|\n max_id = package[0] if package[0] > max_id\n if hash[package[0]][0] != -1\n hash[package[0]][1] << package[1]\n else\n vertex = Vertex.new(package[0])\n hash[package[0]][0] = vertex\n hash[package[0]][1] << package[1]\n end\n end\n (1..max_id).each do |el|\n if hash[el][0] == -1\n hash[el][0] = Vertex.new(el)\n end\n end\n hash.each do |k, v|\n v[1].each do |dependency|\n to_vertex = v[0]\n from_vertex = hash[dependency][0]\n Edge.new(from_vertex, to_vertex)\n end\n end\n vertices = hash.values.map {|value| value[0]}\n order = topological_sort(vertices)\n result = order.map{|vertex| vertex.value}\n result\nend", "title": "" }, { "docid": "7ce1a6e5e707a417d6009700b60cc1be", "score": "0.5377332", "text": "def preorder\n return [] if @root.nil?\n traverse_preorder(@root)\n return @nodes\n end", "title": "" }, { "docid": "6c0f40aad335ed25d514a67bf19be4c1", "score": "0.53768396", "text": "def postorder\n ret = Array.new\n postorderHelper @root, ret\n return ret\n end", "title": "" }, { "docid": "6c0f40aad335ed25d514a67bf19be4c1", "score": "0.53768396", "text": "def postorder\n ret = Array.new\n postorderHelper @root, ret\n return ret\n end", "title": "" }, { "docid": "90d8e63f8234526d4b8dcfbfbe8a7f5a", "score": "0.53732395", "text": "def children\n children_arr = []\n if next_mover_mark == :x\n next_mover_mark = :o\n else\n next_mover_mark = :x\n end\n\n @board.rows.flatten(1).each_with_index do |ele, idx|\n new_board = @board.dup\n \n if ele.nil?\n new_board[[(idx / 3),(idx % 3)]] = self.next_mover_mark\n children_arr << TicTacToeNode.new(new_board, next_mover_mark, [(idx / 3),(idx % 3)])\n end\n end\n children_arr\n end", "title": "" }, { "docid": "91956469fc9c3fafd5651dbc438b4665", "score": "0.5373083", "text": "def children\n kids = []\n # if @board.empty?\n # positions = [\n # [0, 0], [0, 1], [0, 2], \n # [1, 0], [1, 1], [1, 2],\n # [2, 0], [2, 1], [2, 2]\n # ]\n # kids = positions\n # end\n # kids\n\n (0..2).each do |row_idx|\n (0..2).each do |col_idx|\n pos = [row_idx, col_idx]\n if @board[pos].nil?\n clone = @board.dup\n clone[pos] = self.next_mover_mark\n next_mover_mark = (self.next_mover_mark == :x ? :o : :x)\n\n kids << TicTacToeNode.new(clone, next_mover_mark, pos)\n end\n end \n end\n kids\n end", "title": "" }, { "docid": "ca6c56ff14a5f260828332ae296e2336", "score": "0.5372447", "text": "def post_order(node = @root, array = [])\n return [node.value] unless node.children\n\n if node.left\n node.left.children ? post_order(node.left, array) : array.push(node.left.value)\n end\n\n if node.right\n node.right.children ? post_order(node.right, array) : array.push(node.right.value)\n end\n\n array.push(node.value)\n\n array\n end", "title": "" } ]
3c39bb2a14ee7897bab73a6bf679e4b0
MySQL supports GROUP BY WITH ROLLUP (but not CUBE)
[ { "docid": "fc46aee5ba18a390e10d9b7e0fea18b7", "score": "0.47107163", "text": "def supports_group_rollup?\n true\n end", "title": "" } ]
[ { "docid": "03d8c6b995876226d79baabf45cb928c", "score": "0.63915116", "text": "def rollup(after_rollup = nil)\n unless @groups.empty? then #zgroups\n k_first = nil\n @groups.each_key do |k| #zgroups\n k_first = k if k_first.nil? # remove duplicate calculete with this\n \n @groups[k].each_value do |e| # e is QueryResult\n e.rollup(after_rollup) \n add_values_by(e.values) if k == k_first \n end if @groups.has_key?(k)\n end\n end\n after_rollup.call(self) if after_rollup.class <= Proc\n # puts \"#{@name}.#{@index}\"\n end", "title": "" }, { "docid": "fcf13c89e9fe7e16cde06e84580b6a31", "score": "0.56481874", "text": "def grand_total( source_set, val_cols )\n result_set = Array.new( val_cols, 0 )\n unless source_set.nil? then\n source_set.each do |src|\n (-val_cols..-1).each{ |i| result_set[ i ] += src[ i ] }\n end\n end\n result_set\n end", "title": "" }, { "docid": "121c888a715c8dd27afc6e664a57efa6", "score": "0.55789834", "text": "def sub_totals( source_set, key_cols, val_cols )\n if source_set.empty? then\n []\n else\n result_set = [ source_set[ 0 ][ 0, key_cols ] + Array.new( val_cols, 0 )]\n last_ptr = 0\n source_set.each do |src|\n if src[ 0, key_cols ] == result_set[ last_ptr ][ 0, key_cols ]\n (-val_cols..-1).each{ |i| result_set[ last_ptr ][ i ] += src[ i ] }\n else\n result_set << src[ 0, key_cols ] + src[ -val_cols, val_cols ]\n last_ptr += 1\n end\n end\n result_set\n end\n end", "title": "" }, { "docid": "82480cf7a61c36912bea7e939591018b", "score": "0.5312921", "text": "def summarize(options = {}) \n summary = Summary.new\n \n yield(summary) if block_given?\n \n rows = []\n column_names = []\n groups.each do |value, group|\n row = []\n summary.columns.each do |column|\n row << column.last.call(value, group)\n end\n rows << row\n end\n column_names = summary.columns.collect(&:first)\n \n Table.new(:data => rows, :column_names => column_names)\n end", "title": "" }, { "docid": "9929e8a77629c4c562cca3bef3eb37dd", "score": "0.5281792", "text": "def aggregate\n collection.group(options[:fields], selector, { :count => 0 }, AGGREGATE_REDUCE, true)\n end", "title": "" }, { "docid": "2e2236dfdb5cb9ad0b955a67b879a987", "score": "0.5230959", "text": "def aggregate(klass = nil)\n @klass = klass if klass\n @klass.collection.group(@options[:fields], @selector, { :count => 0 }, AGGREGATE_REDUCE)\n end", "title": "" }, { "docid": "f7459189e773a9135d8d859ca0f0ccd0", "score": "0.51933", "text": "def aggregate\n klass.collection.group(\n :key => field_list,\n :cond => selector,\n :initial => { :count => 0 },\n :reduce => Javascript.aggregate\n )\n end", "title": "" }, { "docid": "a59c21ac5277b7852156fd47ff382070", "score": "0.518921", "text": "def js_for_grouping_formatters\n <<EOS\n // --- Grouping formatters\n function avgTotalsFormatter(totals, columnDef) {\n var val = totals.avg && totals.avg[columnDef.field];\n if (val != null) {\n return \"avg: \" + Math.round(val);\n }\n return \"\";\n }\n\n function sumTotalsFormatter(totals, columnDef) {\n var val = totals.sum && totals.sum[columnDef.field];\n if (val != null) {\n return \"total: \" + ((Math.round(parseFloat(val)*100)/100));\n }\n return \"\";\n }\n\n function maxTotalsFormatter(totals, columnDef) {\n var val = totals.max && totals.max[columnDef.field];\n if (val != null) {\n return \"max: \" + ((Math.round(parseFloat(val)*100)/100));\n }\n return \"\";\n }\n\n function minTotalsFormatter(totals, columnDef) {\n var val = totals.min && totals.min[columnDef.field];\n if (val != null) {\n return \"min: \" + ((Math.round(parseFloat(val)*100)/100));\n }\n return \"\";\n }\n\n function cntTotalsFormatter(totals, columnDef) {\n var val = totals.group.count; // && totals.cnt[columnDef.field];\n if (val != null) {\n return \"count: \" + ((Math.round(parseFloat(val)*100)/100));\n }\n return \"null\";\n }\nEOS\n end", "title": "" }, { "docid": "e4ccdac14f2768215b644bc8635789ac", "score": "0.51542586", "text": "def aggregate dimension, measures = []\n result = []\n index = {}\n response.rows.each{|row|\n label = row[:labels].detect{|label| label[:name] == dimension}\n values = row[:values].collect{|v|\n next unless measures.include? v[:measure]\n v.delete :fmt_value\n v\n }.compact\n\n if i = index[label]\n for j in 0..result[i][:values].count-1\n result[i][:values][j][:value] = result[i][:values][j][:value].to_f + values[j][:value].to_f\n end\n else\n index[label] = result.count\n result << {\n rownum: result.count + 1,\n labels: [label],\n values: values\n }\n end\n }\n result\n end", "title": "" }, { "docid": "7bf4660c634dcec48d977718607bb33b", "score": "0.50910485", "text": "def merge_stats( curr_set, base_set, key_cols, val_cols )\n result_set = []\n zeros_set = Array.new( val_cols, 0 ).freeze\n curr_ptr = 0\n base_ptr = 0\n done = ( curr_set.blank? || curr_ptr > curr_set.size || base_ptr.blank? || base_ptr > base_set.size )\n # loop and return result\n until done\n case curr_set[ curr_ptr ][ 0, key_cols ] <=> base_set[ base_ptr ][ 0, key_cols ]\n when -1 # curr before base\n result_set << ( curr_set[ curr_ptr ][ 0, key_cols ] + curr_set[ curr_ptr ][ -val_cols, val_cols ] + zeros_set )\n curr_ptr += 1\n done = ( curr_ptr >= curr_set.size )\n when 0 # curr same as base\n result_set << ( curr_set[ curr_ptr ][ 0, key_cols ] + curr_set[ curr_ptr ][ -val_cols, val_cols ] + base_set[ base_ptr ][ -val_cols, val_cols ])\n curr_ptr += 1\n base_ptr += 1\n done = ( curr_ptr >= curr_set.size || base_ptr >= base_set.size )\n when +1 # base before curr\n result_set << ( base_set[ base_ptr ][ 0, key_cols ] + zeros_set + base_set[ base_ptr ][ -val_cols, val_cols ])\n base_ptr += 1\n done = ( base_ptr >= base_set.size )\n else\n raise 'curr_set <=> base_set result is nil'\n end\n end\n # now add rest from curr_set - if any\n while curr_set && curr_ptr < curr_set.size\n result_set << ( curr_set[ curr_ptr ][ 0, key_cols ] + curr_set[ curr_ptr ][ -val_cols, val_cols ] + zeros_set )\n curr_ptr += 1\n end\n # now add rest from base_set - if any\n while base_set && base_ptr < base_set.size\n result_set << ( base_set[ base_ptr ][ 0, key_cols ] + zeros_set + base_set[ base_ptr ][ -val_cols, val_cols ])\n base_ptr += 1\n end\n return result_set\n end", "title": "" }, { "docid": "09fff56b4309ca213d9bae0bc8449047", "score": "0.5066493", "text": "def add_union_options!(sql, options)#:nodoc:\n sql << \" GROUP BY #{options[:group]} \" if options[:group]\n\n if options[:order] || options[:limit]\n scope = scope(:find)\n add_order!(sql, options[:order], scope)\n add_limit!(sql, options, scope)\n end\n sql\n end", "title": "" }, { "docid": "8cb5fc62f1258d556ff155b23393ac57", "score": "0.5039031", "text": "def groups!\n groups_with_subtotal + groups_without_subtotal\n end", "title": "" }, { "docid": "851f2c4b8b6c32c4b4f9b56bba0659bc", "score": "0.5026706", "text": "def sql_select\n sql = \"SUM(#{self.column}) AS #{self.sql_alias}\"\n\n if self.grouping.any?\n sql << \", \" << self.grouping.join(', ')\n end\n\n sql\n end", "title": "" }, { "docid": "a825b28924bd1086ac0cbf35f0430be8", "score": "0.50191325", "text": "def group(*args)\n rows = connection.execute <<-SQL\n SELECT * FROM #{table}\n GROUP BY #{args.join(', ')};\n SQL\n rows_to_array(rows)\n end", "title": "" }, { "docid": "66bec29fdfd19686ab6d6e6e22d3adb0", "score": "0.49795726", "text": "def select_group_sql(sql)\n sql << \" GROUP BY #{expression_list(@opts[:group])}\" if @opts[:group]\n end", "title": "" }, { "docid": "ba19987496cdad43173c87cff34277f9", "score": "0.49050862", "text": "def summarize(summarize_with = TABLE_DEE, &block)\n if summarize_merge?(summarize_with)\n summarize_merge(summarize_with, &block)\n else\n summarize_split(summarize_with, &block)\n end\n end", "title": "" }, { "docid": "efa22b5566fb8d9d680c0b2f3b7d7561", "score": "0.48976454", "text": "def summarise_by_ifrs filtered_values\n\t #used in reportDASHService\n \tfiltered_values.select(\"ifrstag, sum(amount)\").group(:ifrstag)\n \tend", "title": "" }, { "docid": "3c0bec3972b6ceb716a0c256f2fd1daf", "score": "0.48782375", "text": "def over_alls( source_set, key_col, val_cols )\n result_set = Hash.new{ Array.new( val_cols, 0 )}\n source_set.each do |src|\n r = result_set[ src[ key_col ]]\n (-val_cols..-1).each do |i|\n r[ i ] += src[ i ]\n end\n result_set[ src[ key_col ]] = r\n end\n result_set\n end", "title": "" }, { "docid": "d8b2141003a511f00597e79fc40d16df", "score": "0.48575827", "text": "def column_values_aggregate dimension_aggr_index = 0\n\n result = []\n index = {}\n\n rows.each{|row|\n label = row[:labels][dimension_aggr_index]\n\n if i = index[label]\n for j in 0..result[i][:values].count-1\n result[i][:values][j] += row[:values][j][:value].to_f\n end\n else\n index[label] = result.count\n result << {\n rownum: result.count + 1,\n label: label,\n values: row[:values].collect{|v| v[:value].to_f }\n }\n end\n }\n\n result\n end", "title": "" }, { "docid": "02ce4715b04d49a58e558ec9a15ba4e0", "score": "0.4854593", "text": "def cumulate(raw)\n raw.each_with_object([0]) { |v, a| a << a.last + v }\nend", "title": "" }, { "docid": "3ac330550d1119b0d5c49cca975c654c", "score": "0.48461288", "text": "def sql_group_by\n if self.grouping.any?\n self.grouping.join(', ')\n else\n ''\n end\n end", "title": "" }, { "docid": "9d586b2dfa6cf6d7e35a2787c6f8a536", "score": "0.48399547", "text": "def to_group_sql\n case\n when is_many?, ThinkingSphinx.use_group_by_shortcut?\n nil\n else\n @columns.collect { |column|\n column_with_prefix(column)\n }\n end\n end", "title": "" }, { "docid": "f4cce8e82f7ef2ffd42445e2ff451da5", "score": "0.48297182", "text": "def subtotal_queries\n groups_with_subtotal.flat_map { |g| send(g).map { |s| :\"#{g}_#{s}\" } }\n end", "title": "" }, { "docid": "9d45667b972c0d75f9f60a81e295b2b1", "score": "0.48136556", "text": "def reducer\n %Q{\n function(key, values) {\n var agg = { count: 0, max: null, min: null, sum: 0 };\n values.forEach(function(val) {\n if (val.max !== null) {\n if (agg.max == null || val.max > agg.max) agg.max = val.max;\n if (agg.min == null || val.max < agg.min) agg.min = val.max;\n agg.sum += val.sum;\n }\n agg.count += val.count;\n });\n return agg;\n }}\n end", "title": "" }, { "docid": "205f0e3e57e0e800cc01145ff9689969", "score": "0.48050958", "text": "def supports_group_rollup?\n true\n end", "title": "" }, { "docid": "daacb36a05e68351dc5e5961c2f07647", "score": "0.48046252", "text": "def compute_rollups(timestamps, values, interval=nil)\n # both lists need to be in order, but the time/value relationship is not important\n timestamps.sort!\n values.sort!\n\n rollup = {\n :min => values[0],\n :max => values[-1],\n :range => values[-1] - values[0],\n :sum => values.reduce(:+),\n :count => values.count,\n :first_ts => timestamps[0],\n :last_ts => timestamps[-1],\n :elapsed => timestamps[-1] - timestamps[0],\n :interval => interval,\n }\n\n # http://en.wikipedia.org/wiki/Percentiles\n # median is just p50\n last = values.count - 1\n [1, 5, 10, 25, 50, 75, 90, 95, 99].each do |percentile|\n rank = (rollup[:count] * (percentile / 100.0) + 0.5).round\n rollup[\"p#{percentile}\".to_sym] = values[rank]\n end\n\n # compute the variance & standard deviation\n stddev, variance, average = stddev(values)\n rollup[:stddev] = stddev\n rollup[:variance] = variance\n rollup[:average] = average\n\n # period standard deviation (quality)\n if timestamps.count > 1\n # convert the timestamps to a list of intervals\n last_ts = timestamps.shift\n intervals = []\n timestamps.each do |ts|\n intervals << ts - last_ts\n last_ts = ts\n end\n\n stddev, variance, average = stddev(intervals)\n rollup[:period] = average\n rollup[:jitter] = stddev\n end\n\n rollup\n end", "title": "" }, { "docid": "1000d25a0841cf1d5c890616dcfca1f8", "score": "0.48030937", "text": "def to_group_sql\n case\n when is_many?, is_string?, ThinkingSphinx.use_group_by_shortcut?\n nil\n else\n @columns.collect { |column|\n column_with_prefix(column)\n }\n end\n end", "title": "" }, { "docid": "9243d99d7d956752c92fd1015536a1d4", "score": "0.48023134", "text": "def aggregation(result, doc, conds, key2realkey = nil)\n if key2realkey.nil?\n key2realkey = {}\n doc.each_key do |key|\n key2realkey[\"$\" + key] = key\n end\n end\n if conds.class == Hash\n conds.each do |k, c|\n case k.to_s\n when \"$sum\" then\n result = sum(result, doc, c, key2realkey)\n when \"$max\" then\n result = comp(result, doc, c, key2realkey, \"max\")\n when \"$min\" then\n result = comp(result, doc, c, key2realkey, \"min\")\n else\n @logger.warn(\"Unsupported Aggregation !!\")\n end\n end\n return result\n else\n return real_value(doc, key2realkey[conds])\n end\n end", "title": "" }, { "docid": "dd6047275a2ef30c88a5181adc870cf9", "score": "0.478963", "text": "def aggregate\n {}.tap do |counts|\n group.each_pair { |key, value| counts[key] = value.size }\n end\n end", "title": "" }, { "docid": "1d989a3623070b3b98d9a6538853e9a6", "score": "0.4788539", "text": "def compute_grouped_list( summary_array, group_key_sym )\n key_values_list = summary_array.collect{ |element| element[ group_key_sym ] }.uniq.sort\n # For :year only, we use a fixed step of 1 \"category\" each:\n if ( group_key_sym == :year )\n key_values_list = (key_values_list.first .. key_values_list.last).collect{ |year| year }\n end\n\n result_list = key_values_list.collect{ |group_key_value|\n invoice_group = summary_array.find_all{ |el| el[ group_key_sym ] == group_key_value }\n total = 0\n invoice_group.each{ |el| total = total + el[:summary_hash][:grand_total] }\n currency_name = nil\n\n description = invoice_group.collect{ |el|\n currency_name = el[:summary_hash][:currency_name] unless currency_name \n \"<tr><td><i>#{el[:name]}:</i></td><td align='right'>#{sprintf('%.2f', el[:summary_hash][:grand_total].to_f)} #{currency_name}</td></tr>\"\n }.join('')\n\n {\n group_key_sym => group_key_value,\n :amount => total,\n :description => \"<table align='center' width='95%'>#{description}<tr><td><hr/></td><td><hr/></td></tr><tr><td></td><td align='right'><b>#{sprintf('%.2f', total)}</b> #{currency_name}</td></tr></table>\"\n }\n }\n end", "title": "" }, { "docid": "fb9e3ce4292429b7815625ec4ca2c9b2", "score": "0.47579616", "text": "def update_aggregates(session, feed, time_step, time)\n batch = session.batch do |b|\n prev_span = nil\n AGGREGATION_BUCKETS.each do |span|\n span_in_seconds = span * 60\n\n # The end of the previous slice for this aggregation bucket. All buckets\n # are aligned on the start of Unix epoch time.\n slice_ending_at = time_floor(time, span_in_seconds)\n\n select = session.prepare %[select val from data_aggregate_#{span} where fid=? and slice=?]\n existing = session.execute(select, arguments: [feed, slice_ending_at])\n\n # if no roll-up has been calculated, do it now\n if existing.rows.size === 0\n args = {\n fid: feed,\n # a slice is a collection of data points up to the end time\n slice: slice_ending_at,\n # We could set TTL to the same as the Feed storage\n # length (7 day, 1 year, etc.) if we want to support ranged queries.\n ttl: (7 * 24 * 60 * 60)\n }\n\n # the beginning of the previous slice\n slice_start = slice_ending_at - span_in_seconds\n\n if prev_span\n # gather from previous aggregation\n gather = session.prepare %[select val, loc, val_count, sum, max, min, avg\n from data_aggregate_#{prev_span}\n where fid = :fid AND slice >= :slice_start AND slice <= :slice_end]\n\n results = session.execute(gather, arguments: {fid: feed, slice_start: slice_start, slice_end: slice_ending_at})\n\n r_count = results.rows.size\n prev_span = span\n next if r_count === 0\n\n last_val = nil\n last_loc = nil\n\n # calculate\n sum = 0\n count = 0\n max = -Float::INFINITY\n min = Float::INFINITY\n\n results.rows.each do |row|\n sum += row['sum']\n count += row['val_count']\n min = min < row['min'] ? min : row['min']\n max = max > row['max'] ? max : row['max']\n last_val = row['val']\n last_loc = row['loc']\n end\n avg = sum / count\n\n else\n # select all data received in the slice\n gather = session.prepare %[select val, loc from data where fid = :fid AND id > minTimeuuid(:slice_start) AND id < maxTimeuuid(:slice_end)]\n results = session.execute(gather, arguments: {fid: feed, slice_start: slice_start, slice_end: slice_ending_at})\n\n r_count = results.rows.size\n prev_span = span\n next if r_count === 0\n\n last_val = nil\n last_loc = nil\n sum = 0\n count = 0\n max = -Float::INFINITY\n min = Float::INFINITY\n\n results.rows.each do |row|\n sum += row['val']\n count += 1\n min = min < row['val'] ? min : row['val']\n max = max > row['val'] ? max : row['val']\n last_val = row['val']\n last_loc = row['loc']\n end\n avg = sum / (count * 1.0)\n end\n\n args[:val] = last_val\n args[:loc] = last_loc\n args[:sum] = sum\n args[:avg] = avg\n args[:val_count] = count\n args[:min] = min\n args[:max] = max\n\n puts \" INSERT FOR %4im AGGREGATION FROM %s TO %s\" % [span, slice_start, slice_ending_at]\n insert = session.prepare %[INSERT INTO data_aggregate_#{span} (fid, val, loc, val_count, sum, min, max, avg, slice)\n VALUES (:fid, :val, :loc, :val_count, :sum, :min, :max, :avg, :slice) USING TTL :ttl]\n b.add insert, arguments: args\n end\n end\n end\n\n return 0 if batch.statements.size === 0\n\n session.execute batch, consistency: :all\n\n return batch.statements.size\nend", "title": "" }, { "docid": "2b2ec672ad184783da4ce79313cb070c", "score": "0.47570774", "text": "def summarize(sum, options = {})\n options[:field] = sum\n calculate(\"SUM(#{sum})\", options)\n end", "title": "" }, { "docid": "68d5c8a7ce1538b84bc6ccaa262eb314", "score": "0.47306097", "text": "def group_by\n end", "title": "" }, { "docid": "28089ee6e480fbf2abaa1c6089737846", "score": "0.47296792", "text": "def unshift_total_count(list)\n list.unshift(list.transpose.map(&:sum))\n end", "title": "" }, { "docid": "78ab5fa372a0d667e595ecd717e5f445", "score": "0.47253954", "text": "def group_by(*columns)\n @sql += \" GROUP BY #{columns.join(', ')}\"\n\n self\n end", "title": "" }, { "docid": "62c5429a0b8449e5d39ce6b92eb58905", "score": "0.47190192", "text": "def get_multi_col_query(query, o={})\n col_scores = get_cs_score(query, o[:cs_type], o)\n info \"[get_multi_col_query] col_scores = #{col_scores.inspect}\"\n result = $fields.group_by{|e|e.split('_')[0]}.map do |col,fields|\n sub_query = get_prm_query(query, o.merge(:prm_fields=>fields,:cs_type=>nil))\n \"#{col_scores[col]} #combine(#{sub_query}) \"\n end\n return \"#wsum(#{result.join(\"\\n\")})\"\n end", "title": "" }, { "docid": "66e8f4d18253eae45b09f9c9979ba208", "score": "0.4683351", "text": "def supports_group_rollup?\n false\n end", "title": "" }, { "docid": "419df078f5f15e032b76af0106ddaecb", "score": "0.4668153", "text": "def unordered_group_by\n inject Hash.new do |grouped, element|\n (grouped[yield(element)] ||= []) << element\n grouped\n end\n end", "title": "" }, { "docid": "02e6ef7262eb55c91d550cc556a7ce48", "score": "0.46502113", "text": "def aggregate_dataset\n options_overlap(COUNT_FROM_SELF_OPTS) ? from_self : unordered\n end", "title": "" }, { "docid": "02e6ef7262eb55c91d550cc556a7ce48", "score": "0.46502113", "text": "def aggregate_dataset\n options_overlap(COUNT_FROM_SELF_OPTS) ? from_self : unordered\n end", "title": "" }, { "docid": "73289d3a732ae3beb03c1a5e435c804f", "score": "0.46467978", "text": "def reduce\n retable = []\n units = table.select{ |u| u.is_a?(Unit) }\n types = units.map{ |u| [u.type, u.prefix] }.uniq\n group = units.group_by{ |u| [u.type, u.prefix] }\n types.each do |(type, prefix)|\n units = group[[type,prefix]]\n power = 0; units.each{ |u| power += u.power }\n retable << Unit.new(type, power, prefix) unless power == 0\n end\n @table = [value, *retable]\n self\n end", "title": "" }, { "docid": "6f368dc91bce41228d6354f182fcfd6d", "score": "0.4642393", "text": "def summary_test_results\n test_groups_query = self.test_groups\n .joins(test_group_results: { test_run: :grouping })\n .group('test_groups.id', 'groupings.id')\n .select('test_groups.id AS test_groups_id',\n 'MAX(test_group_results.created_at) AS test_group_results_created_at')\n .where.not('test_runs.submission_id': nil)\n .to_sql\n\n self.test_groups\n .joins(test_group_results: [:test_results, { test_run: { grouping: :group } }])\n .joins(\"INNER JOIN (#{test_groups_query}) sub \\\n ON test_groups.id = sub.test_groups_id\n AND test_group_results_test_groups.created_at = sub.test_group_results_created_at\")\n .select('test_groups.name',\n 'test_groups_id',\n 'groups.group_name',\n 'test_results.name as test_result_name',\n 'test_results.status',\n 'test_results.marks_earned',\n 'test_results.marks_total',\n :output, :extra_info, :error_type)\n end", "title": "" }, { "docid": "9466fe499daaa525224747b6490c70f9", "score": "0.46420705", "text": "def group_times\n \[email protected]([\n \t\t{ :$group=> {\n \t\t\t\t:_id=> { :age=> \"$group\", :gender=> \"$gender\" },\n \t\trunners: { :$sum=> 1 },\n fastest_time: { :$min=> \"$secs\" }\n }\n }\n ])\n end", "title": "" }, { "docid": "e8e8c0cd1ec4d6e853ceb4eb53bcb01d", "score": "0.4633519", "text": "def summarize\n @result[:value] /= @count\n\n result_class(:numeric).new(@result, @aggregate_format, @action)\n end", "title": "" }, { "docid": "fd9805b9b47319fd297c31fb54b9f805", "score": "0.46227804", "text": "def compute_contest_rollups\n cur_results = Set.new\n cats = flights.collect { |f| f.category }\n cats.uniq.each do |cat|\n cur_results.add find_or_create_c_result(cat)\n end\n # all cur_results are now either present or added to c_results\n c_results.each do |c_result|\n if (cur_results.include?(c_result))\n c_result.compute_category_totals_and_rankings\n else\n # flights for this category no longer present\n c_results.delete(c_result)\n end\n end\n save\n c_results\n end", "title": "" }, { "docid": "8cc0cdade2d083e5f8a2d3429637000a", "score": "0.46193537", "text": "def generate_daily_metric_rollup_results(options = {})\n unless conditions.nil?\n conditions.preprocess_options = {:vim_performance_daily_adhoc => (time_profile && time_profile.rollup_daily_metrics)}\n end\n\n results = Metric::Helper.find_for_interval_name('daily', time_profile || tz, db_class)\n .where(where_clause)\n .where(options[:where_clause])\n .where(:timestamp => performance_report_time_range)\n .includes(get_include_for_find)\n .references(db_class.includes_to_references(get_include))\n .limit(options[:limit])\n results = Rbac.filtered(results, :class => db,\n :filter => conditions,\n :userid => options[:userid],\n :miq_group_id => options[:miq_group_id])\n Metric::Helper.remove_duplicate_timestamps(results)\n end", "title": "" }, { "docid": "267dcdc1b71f9d9450e959e8bf463e1a", "score": "0.4616444", "text": "def group_total_row(group, subgroup = nil)\n query = subgroup ? \"#{group}_#{subgroup}\" : group.to_s\n subgroup_name = subgroup ? subgroup : 'Group total'\n query_row(group, subgroup_name, query, 'Total')\n end", "title": "" }, { "docid": "761397274f42fe14a6d41419dd4c95e6", "score": "0.4610617", "text": "def get_aggregates\n JobAggregates.from_redis(\n JobAggregates.attribute_names.reduce({}) { |hash, field| \n hash.tap { hash[field] = @redis.hgetall(\"github_job_counters_#{field}\") }\n }\n )\n end", "title": "" }, { "docid": "7583ff8b695f64087e2a9e7fc690b79e", "score": "0.45995563", "text": "def aggregations\n {}\n end", "title": "" }, { "docid": "e9257ab7e2115a9933cdb83ddb4faf10", "score": "0.45951346", "text": "def roll_up_stats_callback\n overall_total_results = @stats.stats[:total]\n BusinessUnit.all.each do |bu|\n bu_results = @stats.stats[bu.id]\n directorate_results = @stats.stats[bu.directorate.id]\n business_group_results = @stats.stats[bu.business_group.id]\n bu_results.each do |key, value|\n directorate_results [key] += value\n business_group_results[key] += value\n overall_total_results [key] += value\n end\n end\n end", "title": "" }, { "docid": "4d644ebacb0f45c248d5e660006cafa8", "score": "0.45893025", "text": "def count_records_in_measure_groups\n pipeline = build_query\n\n pipeline << {'$group' => {\n \"_id\" => \"$value.measure_id\", # we don't really need this, but Mongo requires that we group\n QME::QualityReport::POPULATION => {\"$sum\" => \"$value.#{QME::QualityReport::POPULATION}\"},\n QME::QualityReport::DENOMINATOR => {\"$sum\" => \"$value.#{QME::QualityReport::DENOMINATOR}\"},\n QME::QualityReport::NUMERATOR => {\"$sum\" => \"$value.#{QME::QualityReport::NUMERATOR}\"},\n QME::QualityReport::ANTINUMERATOR => {\"$sum\" => \"$value.#{QME::QualityReport::ANTINUMERATOR}\"},\n QME::QualityReport::EXCLUSIONS => {\"$sum\" => \"$value.#{QME::QualityReport::EXCLUSIONS}\"},\n QME::QualityReport::EXCEPTIONS => {\"$sum\" => \"$value.#{QME::QualityReport::EXCEPTIONS}\"},\n QME::QualityReport::MSRPOPL => {\"$sum\" => \"$value.#{QME::QualityReport::MSRPOPL}\"},\n QME::QualityReport::MSRPOPLEX => {\"$sum\" => \"$value.#{QME::QualityReport::MSRPOPLEX}\"},\n QME::QualityReport::CONSIDERED => {\"$sum\" => 1}\n }}\n\n aggregate = get_db.command(:aggregate => 'patient_cache', :pipeline => pipeline)\n aggregate_document = aggregate.documents[0]\n if !aggregate.successful?\n raise RuntimeError, \"Aggregation Failed\"\n elsif aggregate_document['result'].size !=1\n aggregate_document['result'] =[{\"defaults\" => true,\n QME::QualityReport::POPULATION => 0,\n QME::QualityReport::DENOMINATOR => 0,\n QME::QualityReport::NUMERATOR =>0,\n QME::QualityReport::ANTINUMERATOR => 0,\n QME::QualityReport::EXCLUSIONS => 0,\n QME::QualityReport::EXCEPTIONS => 0,\n QME::QualityReport::MSRPOPL => 0,\n QME::QualityReport::MSRPOPLEX => 0,\n QME::QualityReport::CONSIDERED => 0}]\n end\n\n nqf_id = @measure_def.nqf_id || @measure_def['id']\n result = QME::QualityReportResult.new\n result.population_ids=@measure_def.population_ids\n\n\n if @measure_def.continuous_variable\n aggregated_value = calculate_cv_aggregation\n result[QME::QualityReport::OBSERVATION] = aggregated_value\n end\n\n agg_result = aggregate_document['result'].first\n agg_result.reject! {|k, v| k == '_id'} # get rid of the group id the Mongo forced us to use\n # result['exclusions'] += get_db['patient_cache'].find(base_query.merge({'value.manual_exclusion'=>true})).count\n agg_result.merge!(execution_time: (Time.now.to_i - @parameter_values['start_time'].to_i)) if @parameter_values['start_time']\n agg_result.each_pair do |k,v|\n result[k]=v\n end\n result.supplemental_data = self.calculate_supplemental_data_elements\n result\n\n end", "title": "" }, { "docid": "68dce5a64fcfd5a8103c2bd99241309b", "score": "0.45768178", "text": "def ungrouped_scores\n @ungrouped_scores ||=\n sourced_weighted_scores.each_with_object({}) do |(_source_name, scorecard), memo|\n h = scorecard.each do |(candidate, score)|\n memo[candidate] ||= 0.0\n memo[candidate] += score\n end\n end\n end", "title": "" }, { "docid": "51aae205fafe5d4b138c95bd28fb30cf", "score": "0.45765042", "text": "def reduce\n retable = []\n units = table.select{ |u| Unit === u }\n types = units.map{ |u| u.class }.uniq\n group = units.group_by{ |b| b.class }\n types.each do |type|\n units = group[type]\n power = 0; units.each{ |u| power += u.power }\n retable << type.new(1, power) unless power == 0\n end\n @table = [value, *retable]\n self\n end", "title": "" }, { "docid": "b9bd29656eb01f05c58ae292746bda52", "score": "0.45695552", "text": "def test_aggregates_serialization_deserialization\n skip('UDFs are only available in C* after 2.2') if CCM.cassandra_version < '2.2.0'\n \n assert @cluster.keyspace('simplex').has_function?('state_group_and_sum', map(int, int), int)\n assert @cluster.keyspace('simplex').has_function?('percent_stars', map(int, int))\n \n # Create the UDA\n @session.execute('CREATE OR REPLACE AGGREGATE group_and_sum(int)\n SFUNC state_group_and_sum\n STYPE map<int, int>\n FINALFUNC percent_stars\n INITCOND {}'\n )\n \n # Create the table\n @session.execute('CREATE TABLE reviews (item_id uuid, time timeuuid, star_rating int,\n PRIMARY KEY (item_id, time)) WITH CLUSTERING ORDER BY (time DESC)')\n \n # Insert data\n insert = @session.prepare('INSERT INTO reviews (item_id, time, star_rating) VALUES (?, ?, ?)')\n item_id = Cassandra::Uuid.new('0979dea5-5a65-446d-bad6-27d04d5dd8a5')\n generator = Cassandra::Uuid::Generator.new\n @session.execute(insert, arguments: [item_id, generator.now, 5])\n @session.execute(insert, arguments: [item_id, generator.now, 4])\n @session.execute(insert, arguments: [item_id, generator.now, 4])\n @session.execute(insert, arguments: [item_id, generator.now, 3])\n @session.execute(insert, arguments: [item_id, generator.now, 3])\n @session.execute(insert, arguments: [item_id, generator.now, 4])\n @session.execute(insert, arguments: [item_id, generator.now, 2])\n @session.execute(insert, arguments: [item_id, generator.now, 5])\n @session.execute(insert, arguments: [item_id, generator.now, 4])\n @session.execute(insert, arguments: [item_id, generator.now, 5])\n \n # Verify UDA\n results = @session.execute('SELECT group_and_sum(star_rating) FROM reviews WHERE item_id=0979dea5-5a65-446d-bad6-27d04d5dd8a5')\n expected = {2 => 10, 3 => 20, 4 => 40, 5 => 30}\n assert_equal expected, results.first['simplex.group_and_sum(star_rating)']\n end", "title": "" }, { "docid": "0d242de2e9c1947c3fc787280ae55201", "score": "0.45694384", "text": "def transform_aggregate(key, aggregate, result)\n result.each_with_object({}) do |(keys, value), object|\n with_zipped = build_keys(key, keys)\n with_zipped.append(aggregate)\n hash = with_zipped.reverse.inject(value) { |a, n| { n => a } }\n object.deep_merge!(hash)\n end\n end", "title": "" }, { "docid": "4a2b1960108950d87bf529ce19d4ceab", "score": "0.4569418", "text": "def group_data_by(frequency, override_prune = false)\n validate_aggregation(frequency)\n \n aggregated_data = Hash.new\n frequency_method = frequency.to_s+\"_s\"\n \n self.data.keys.each do |date_string|\n #puts \"#{date_string}: #{self.at date_string}\"\n date = Date.parse date_string\n aggregated_data[date.send(frequency_method)] ||= AggregatingArray.new unless self.at(date_string).nil?\n aggregated_data[date.send(frequency_method)].push self.at(date_string) unless self.at(date_string).nil?\n end\n #puts frequency\n #puts self.frequency\n #puts override_prune\n # Prune out any incomplete aggregated groups (except days, since it's complicated to match month to day count)\n #can probably take out this override pruning nonsense since this function doesn't work anyway and should be some kind of interpolation\n \n freq = self.frequency.to_s\n \n aggregated_data.delete_if {|key,value| value.count != 6} if frequency == :semi and freq == \"month\"\n aggregated_data.delete_if {|key,value| value.count != 3} if (frequency == :quarter and freq == \"month\") and override_prune == false\n aggregated_data.delete_if {|key,value| value.count != 12} if frequency == :year and freq == \"month\"\n aggregated_data.delete_if {|key,value| value.count != 4} if frequency == :year and freq == \"quarter\"\n aggregated_data.delete_if {|key,value| value.count != 2} if frequency == :semi and freq == \"quarter\" \n aggregated_data.delete_if {|key,value| value.count != 2} if frequency == :year and freq == \"semi\"\n aggregated_data.delete_if {|key,value| value.count != Date.parse(key).days_in_month} if frequency == :month and freq == \"day\"\n #puts key+\" \"+value.count.to_s + \" \" + Date.parse(key).days_in_month.to_s;\n #month check for days is more complicated because need to check for number of days in each month\n\n \n \n return aggregated_data\n end", "title": "" }, { "docid": "b96b9335ae91a02f70ea07a706cdc4e6", "score": "0.45682588", "text": "def group_by\n self.inject(Hash.new { |h, k| h[k] = [] }) { |h, v| h[yield v] << v ; h }\n end", "title": "" }, { "docid": "91e33ee319e5929b32403ee5359a3b77", "score": "0.4561505", "text": "def aggregate_buckets(buckets, the_model)\n #$logger.debug \"got #{buckets.size} buckets : #{\"\\n\" + buckets.join(\"\\n\")}\"\n\n # we probably got a bit too much data now, aggregate\n result = []\n aggregation_factor = (buckets.size / the_model[:desired_bucket_count]).floor\n #$logger.debug \"aggregating by factor #{aggregation_factor}\"\n result << buckets.shift\n count = 1\n while buckets.size > 0 do\n if count >= aggregation_factor\n result << buckets.shift\n count = 1\n else\n # gonna merge this entry with the previous one\n moriturus = buckets.shift[1]\n previous_record = result.last[1]\n\n # TODO it might be a good idea to merge the timestamps as well\n\n # the count values can be summed up\n previous_record.success_count += moriturus.success_count\n previous_record.failure_count += moriturus.failure_count\n\n # the response time values need to averaged\n # TODO we need to handle the other response time values (min, max, stddev)\n if (previous_record.response_time_micros_avg || moriturus.response_time_micros_avg)\n previous_record.response_time_micros_avg ||= 0\n moriturus.response_time_micros_avg ||= 0\n new_response_time = (previous_record.response_time_micros_avg + moriturus.response_time_micros_avg)\n if (previous_record.response_time_micros_avg != 0 && moriturus.response_time_micros_avg != 0)\n new_response_time /= 2\n #$logger.debug(\"merging response time between #{previous_record.log_ts} and #{moriturus.log_ts}: #{previous_record.response_time_micros_avg} + #{moriturus.response_time_micros_avg} = #{new_response_time}\")\n end\n previous_record.response_time_micros_avg = new_response_time\n end\n count += 1\n end\n end\n\n aggregated_bucket_size = the_model[:bucket_size_secs] * aggregation_factor\n result.each do |bucket|\n record = bucket[1]\n # normalize the counts to requests per minute\n record.success_count /= (aggregated_bucket_size / 60)\n record.failure_count /= (aggregated_bucket_size / 60)\n end\n\n result\n end", "title": "" }, { "docid": "7ddc5dd04321cc6581b1889b3ee2c4f9", "score": "0.45562184", "text": "def grouping_hash; end", "title": "" }, { "docid": "c9b4a0f8fa7ab346936b2b0ab3215d73", "score": "0.4551959", "text": "def prune_check_result_aggregations\n @logger.info(\"pruning check result aggregations\")\n @redis.smembers(\"aggregates\") do |checks|\n checks.each do |check_name|\n @redis.smembers(\"aggregates:#{check_name}\") do |aggregates|\n if aggregates.size > 20\n aggregates.sort!\n aggregates.take(aggregates.size - 20).each do |check_issued|\n @redis.srem(\"aggregates:#{check_name}\", check_issued) do\n result_set = \"#{check_name}:#{check_issued}\"\n @redis.del(\"aggregate:#{result_set}\") do\n @redis.del(\"aggregation:#{result_set}\") do\n @logger.debug(\"pruned aggregation\", {\n :check => {\n :name => check_name,\n :issued => check_issued\n }\n })\n end\n end\n end\n end\n end\n end\n end\n end\n end", "title": "" }, { "docid": "5acdcb2be3adae0682955c2e27d559c5", "score": "0.45517424", "text": "def grouped_duplicates(collection); end", "title": "" }, { "docid": "57bbc1f74143cbd4417bcc34f9388d8d", "score": "0.45470148", "text": "def query_group_by_options(query=nil)\n query ||= @query\n [[\"\", \"\"]] + query.groupable_columns.map { |c| [query.column_label_for(c), c.to_s] }\n end", "title": "" }, { "docid": "986c9dd27418763237acca5bd044e6ee", "score": "0.45381135", "text": "def group(groups, agg_hash = {})\n data_hash = {}\n \n agg_columns = []\n agg_hash.each do |key, columns|\n Data.array(columns).each do |col| # column name\n agg_columns << col\n end\n end\n agg_columns = agg_columns.uniq.compact\n \n @data.each do |row|\n row_key = Data.array(groups).map { |rk| row[rk] }\n data_hash[row_key] ||= {:cells => {}, :data => {}, :count => 0}\n focus = data_hash[row_key]\n focus[:data] = clean_data(row)\n \n agg_columns.each do |col|\n focus[:cells][col] ||= []\n focus[:cells][col] << row[col]\n end\n focus[:count] += 1\n end\n \n new_data = []\n new_keys = []\n \n data_hash.each do |row_key, data|\n new_row = data[:data]\n agg_hash.each do |key, columns|\n Data.array(columns).each do |col| # column name\n newcol = ''\n if key.is_a?(Array) && key[1].is_a?(Proc)\n newcol = key[0].to_s + '_' + col.to_s\n new_row[newcol] = key[1].call(data[:cells][col])\n else \n newcol = key.to_s + '_' + col.to_s\n case key\n when :average\n sum = data[:cells][col].inject { |sum, a| sum + a }\n new_row[newcol] = (sum / data[:count]) \n when :count\n new_row[newcol] = data[:count] \n else \n new_row[newcol] = data[:cells][col].inject { |sum, a| sum + a }\n end\n end\n new_keys << newcol\n end\n end\n new_data << Item.ensure(new_row)\n end\n \n @data = new_data\n new_keys.compact\n end", "title": "" }, { "docid": "7369fe7f4693cc824471ac28987ff974", "score": "0.45304567", "text": "def selects_user_names_and_amounts_of_all_pledges_grouped_by_name_then_orders_them_by_the_amount_and_users_name\nsql = <<-SQL\nSELECT users.name, SUM(pledges.amount)\nFROM pledges \nINNER JOIN users\non pledges.user_id = users.id\nGROUP BY users.name\nORDER BY SUM(pledges.amount);\nSQL\nend", "title": "" }, { "docid": "7e3c7cc37169028ce517d74bce327cdb", "score": "0.45288354", "text": "def aggregate_results\n total_info = 0\n total_warnings = 0\n total_errors = 0\n @results[:by_measure].each_pair do |k, v|\n total_info += v[:measure_info]\n total_warnings += v[:measure_warnings]\n total_errors += v[:measure_errors]\n end\n @results[:total_info] = total_info\n @results[:total_warnings] = total_warnings\n @results[:total_errors] = total_errors\n end", "title": "" }, { "docid": "2b21c37d848fd71b2a292a8a12190088", "score": "0.45227066", "text": "def summarize(summary, val, ignore_tags)\n\n # Accumulate counts by data type\n if not summary.has_key?(COUNT_TAG)\n summary[COUNT_TAG] = {}\n end\n counts = summary[COUNT_TAG]\n\n vtype = get_type(val)\n inc_count(counts, vtype, val)\n\n # Handle composite types (hash, \n if vtype == \"BSON::OrderedHash\"\n # Maintain summary stats on hash sizes\n val.each do |k, v|\n if ignore_tags.has_key?(k)\n next\n end\n if not summary.has_key?(k)\n summary[k] = {}\n end\n summarize(summary[k], v, ignore_tags)\n end\n elsif vtype == \"Array\"\n # Maintain summary stats on array sizes\n\n if not summary.has_key?(ELEMENTS_TAG)\n summary[ELEMENTS_TAG] = {}\n end\n val.each do |v|\n summarize(summary[ELEMENTS_TAG], v, ignore_tags)\n end\n end\nend", "title": "" }, { "docid": "8a6532dc18f0932536694f90709eb464", "score": "0.45146158", "text": "def selects_user_names_and_amounts_of_all_pledges_grouped_by_name_then_orders_them_by_the_amount\n\"SELECT users.name, SUM(pledges.amount) FROM users JOIN pledges ON users.id = pledges.user_id GROUP BY users.name ORDER BY SUM(pledges.amount);\"\nend", "title": "" }, { "docid": "d9e13cdae1a881d90cba67ef76ad4429", "score": "0.45123821", "text": "def pivots; end", "title": "" }, { "docid": "9319509ee824864987866d96cc326cec", "score": "0.45121148", "text": "def group_by_all_columns\n cn = self.column_names\n group { cn.map { |col| __send__(col) } }\n end", "title": "" }, { "docid": "1057340c4513daea9f27e1530f9a704e", "score": "0.45093626", "text": "def roll_up_stats_callback\n overall_total_results = @stats.stats[:total]\n BusinessUnit.all.each do |bu|\n bu_results = @stats.stats[bu.id]\n directorate_results = @stats.stats[bu.directorate.id]\n business_group_results = @stats.stats[bu.business_group.id]\n bu_results.each do |key, value|\n directorate_results[key] += value\n business_group_results[key] += value\n overall_total_results[key] += value\n end\n end\n end", "title": "" }, { "docid": "8aa36851f927b7af9aa4bdc67feabcea", "score": "0.4504827", "text": "def group to_group\n\tgrouped = {}\n\tto_group.each { |current| \n\t\tkey, value = current.first\n\t\tgrouped[key] = grouped[key] + value rescue grouped[key] = value\n\t}\n\tgrouped = grouped.map { |key, value| {key=>value} }\n\treturn grouped\nend", "title": "" }, { "docid": "0a09077a2228d81967fb2ef8bbbd8060", "score": "0.4497375", "text": "def grouping; end", "title": "" }, { "docid": "0a09077a2228d81967fb2ef8bbbd8060", "score": "0.4497375", "text": "def grouping; end", "title": "" }, { "docid": "544621e79f69fb2edfe2e5196b3502c6", "score": "0.4488596", "text": "def grouped_collection\n @grouped_collection ||= collection.sort_by{|s| s.shift.ordinal}.uniq{|s| [s.date, s.shift_group_id, s.shift.county_id]}\n end", "title": "" }, { "docid": "6748c0ab532bb96cf39573eb685138ab", "score": "0.4484096", "text": "def grouped\n @grouped ||= ranks.group_by { |x| x }.map { |k, v| v.length }.sort.reverse\n end", "title": "" }, { "docid": "96087af1ad9340780c292ac37911fb7a", "score": "0.44798335", "text": "def aggregate_dataset\n (options_overlap(Sequel::Dataset::COUNT_FROM_SELF_OPTS) && !options_overlap([:limit])) ? unordered.from_self : super\n end", "title": "" }, { "docid": "d0661d20b2443f43fc6f99e641f293fc", "score": "0.4473154", "text": "def group_by_expr\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 101 )\n return_value = GroupByExprReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n group_by_expr_start_index = @input.index\n\n root_0 = nil\n rollup_cube_clause677 = nil\n grouping_sets_clause678 = nil\n grouping_expression_list679 = 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 # at line 642:2: ( rollup_cube_clause | grouping_sets_clause | grouping_expression_list )\n alt_173 = 3\n alt_173 = @dfa173.predict( @input )\n case alt_173\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 642:4: rollup_cube_clause\n @state.following.push( TOKENS_FOLLOWING_rollup_cube_clause_IN_group_by_expr_4017 )\n rollup_cube_clause677 = rollup_cube_clause\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, rollup_cube_clause677.tree )\n end\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 643:4: grouping_sets_clause\n @state.following.push( TOKENS_FOLLOWING_grouping_sets_clause_IN_group_by_expr_4022 )\n grouping_sets_clause678 = grouping_sets_clause\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, grouping_sets_clause678.tree )\n end\n\n when 3\n root_0 = @adaptor.create_flat_list\n\n\n # at line 644:4: grouping_expression_list\n @state.following.push( TOKENS_FOLLOWING_grouping_expression_list_IN_group_by_expr_4027 )\n grouping_expression_list679 = grouping_expression_list\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, grouping_expression_list679.tree )\n end\n\n end# - - - - - - - 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__, 101 )\n memoize( __method__, group_by_expr_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "8fef5f4be7d7c06ae2f2bb6c5fd1c04a", "score": "0.44678295", "text": "def aggregation(groups)\n raise NotImplementedError\n end", "title": "" }, { "docid": "63d0e133b487e9d9d1a8ef3a2277339c", "score": "0.4466353", "text": "def collapse_values(values)\n values.each_with_object(Hash.new { |h,k| h[k] = 0 }) { |v,h|\n h[v.resource] += v.amount\n }.map { |k,v| Value.new(k,v) }\nend", "title": "" }, { "docid": "cf935989fd5397454aa6e76f02a8342c", "score": "0.4460894", "text": "def pivot; end", "title": "" }, { "docid": "fe2098011fcfcb10d82cc3f7aa8e9064", "score": "0.44598922", "text": "def aggregate\n UserBalance.all.order(:created_at).group_by do |ub|\n [ub.payer_id, ub.user_id]\n end\n end", "title": "" }, { "docid": "b05ca22447e1270f1b51b1e6cfcea779", "score": "0.4454374", "text": "def aggregate name, o, collector\n collector << \"#{name}(\"\n if o.distinct\n collector << \"DISTINCT \"\n end\n collector = inject_join(o.expressions, collector, \", \") << \")\"\n if o.alias\n collector << \" AS \"\n visit o.alias, collector\n else\n collector\n end\n end", "title": "" }, { "docid": "0250ed0ad1c456f062d2503b1dfe0005", "score": "0.44523752", "text": "def aggregate_results(results)\n if @aggregate\n @aggregate.call(results)\n else\n default_aggregate(results)\n end\n end", "title": "" }, { "docid": "f335ca4b9b819eec745b8c5c95a33f60", "score": "0.44482374", "text": "def selects_user_names_and_amounts_of_all_pledges_grouped_by_name_then_orders_them_by_the_summed_amount\n \"SELECT users.name, SUM(pledges.amount)\n FROM users\n JOIN pledges\n ON pledges.user_id = users.id\n GROUP BY name\n ORDER BY SUM(pledges.amount)\"\nend", "title": "" }, { "docid": "9f39d120ae743495fc5a38b6d3e480d8", "score": "0.44458658", "text": "def score_sql\n 'SUM(score) AS score'\n end", "title": "" }, { "docid": "65d120bd10792a13086c8fc2dfd88561", "score": "0.44419503", "text": "def aggregation_summary_sql(options = {})\n create_aggregation_statements(options)\n return @summary_sql_statement\n end", "title": "" }, { "docid": "8eaa11281738f980447c753ae3a4be45", "score": "0.44284832", "text": "def render_subtotals(group_header, _group_data = nil, ancestors = nil)\n html = ''\n path = ancestors.nil? ? [] : ancestors.dup\n path << group_header\n\n is_first_subtotal = true\n\n @subtotal_calculations[path].each_with_index do |group, index|\n next if group.empty?\n \n html << \"<tr class='subtotal index_#{index} #{'first' if is_first_subtotal}'>\"\n @columns.each do |col|\n value = group[col.name] ? group[col.name].values[0] : nil\n html << col.render_cell(value)\n end\n html << '</tr>'\n\n is_first_subtotal = false\n end\n html\n end", "title": "" }, { "docid": "25403442265a9fc880f0b512d217d3cf", "score": "0.44212192", "text": "def summarize(values)\n result_hash = {}\n values.each { |value|\n value_hash = Hash[value.chars.group_by { |c| c }.map { |k, v| [k, v.size] }]\n result_hash.merge!(value_hash) { |k, v1, v2| v1+v2 }\n }\n Hash[result_hash.sort]\n end", "title": "" }, { "docid": "2e8a42dd252434c7c2cea732538c8100", "score": "0.44167677", "text": "def merge(old, new)\n old.update(new) do |key, oldv, newv|\n if (oldv['type'] == 'counter') and (newv['type'] == 'counter')\n %w{sum count sumsqrt}.each{ |i| newv[i] += oldv[i] }\n newv['min'] = min oldv['min'], newv['min']\n newv['max'] = max oldv['max'], newv['max']\n newv\n else newv end\n end\nend", "title": "" }, { "docid": "9b9726f970d7fe21e19f98b6de4179b5", "score": "0.43997225", "text": "def union(group)\n end", "title": "" }, { "docid": "42b3313d19cdaa97a4aaf12b15479b8a", "score": "0.43910673", "text": "def selects_user_names_and_amounts_of_all_pledges_grouped_by_name_then_orders_them_by_the_amount_and_users_name\n\"SELECT users.name, SUM(pledges.amount)\nFROM users\nINNER JOIN pledges ON users.id = pledges.user_id\nGROUP BY users.name ORDER BY SUM(pledges.amount), users.name\"\nend", "title": "" }, { "docid": "8f15ee2e9c41ddb5bfb8fa9a9e72ecaf", "score": "0.43876123", "text": "def grouping_sets_expr\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 105 )\n return_value = GroupingSetsExprReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n grouping_sets_expr_start_index = @input.index\n\n root_0 = nil\n rollup_cube_clause693 = nil\n grouping_expression_list694 = 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 # at line 656:2: ( rollup_cube_clause | grouping_expression_list )\n alt_176 = 2\n alt_176 = @dfa176.predict( @input )\n case alt_176\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 656:4: rollup_cube_clause\n @state.following.push( TOKENS_FOLLOWING_rollup_cube_clause_IN_grouping_sets_expr_4098 )\n rollup_cube_clause693 = rollup_cube_clause\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, rollup_cube_clause693.tree )\n end\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 656:25: grouping_expression_list\n @state.following.push( TOKENS_FOLLOWING_grouping_expression_list_IN_grouping_sets_expr_4102 )\n grouping_expression_list694 = grouping_expression_list\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, grouping_expression_list694.tree )\n end\n\n end# - - - - - - - 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__, 105 )\n memoize( __method__, grouping_sets_expr_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "027f336f33559f4adc198d92a3dd645c", "score": "0.4386179", "text": "def by_group\n selected_groups&.each_with_object({}) do |group, hash|\n summary = summarize_over_group_members(group)\n hash[group] = summary.merge(group_members[group])\n end\n end", "title": "" }, { "docid": "2785a1d513e5851834a550b9c5f25f8d", "score": "0.4379557", "text": "def optimize_summarize_per\n operation.summarize_per.optimize\n end", "title": "" }, { "docid": "a746b7a7e5218b6c61ec3944b1c3385b", "score": "0.43782902", "text": "def aggregates\n Rails.cache.fetch(\"aggregates_#{interval}\", expires_in: CACHE_TIME) {\n ActiveRecord::Base.connection.exec_query(\"\n select\n stddev(sum_downvotes) as stddev,\n sum(sum_downvotes) as sum,\n avg(sum_downvotes) as avg,\n avg(n_comments) as n_comments,\n count(*) as n_commenters\n from (\n select\n sum(downvotes) as sum_downvotes,\n count(*) as n_comments\n from comments join users on comments.user_id = users.id\n where (comments.created_at >= '#{period}')\n GROUP BY comments.user_id\n ) sums;\n \").first.symbolize_keys!\n }\n end", "title": "" }, { "docid": "3136cb4e93f015e5bc31b2c543942696", "score": "0.4377347", "text": "def summarize_counts(tag, group_counts)\n tag = 'all' if @aggregate == :all\n @counts[tag] ||= {}\n \n @mutex.synchronize {\n group_counts.each do |group_key, count|\n @counts[tag][group_key] ||= {}\n countup(@counts[tag][group_key], count)\n end\n\n # total_count = group_counts.map {|group_key, count| count[:count] }.inject(:+)\n # @counts[tag]['__total_count'] = sum(@counts[tag]['__total_count'], total_count)\n }\n end", "title": "" }, { "docid": "597ac459f7b239150e89c45a2ded5cf6", "score": "0.43768433", "text": "def reduce_candidate_groups_to_relevant_candidate_groups\n \n grouped_stories = db.select_all( 'SELECT candidate_groups.id, GROUP_CONCAT( story2_id ) AS story_ids, \n candidate_groups.language_id, candidate_groups.story_count\n FROM candidate_groups \n INNER JOIN related_candidates ON ( related_candidates.story1_id = candidate_groups.id )\n GROUP BY candidate_groups.id' )\n \n @final_groups = []\n \n # Ruby Processing is Used\n # bm = Benchmark.measure {\n # grouped_stories.each{ |h| h.merge!( 'story_count' => h['story_count'].to_i, 'story_ids' => h['story_ids'].split(',') ) }\n # heap = Containers::Heap.new( grouped_stories ){ |x, y| ( x['story_count'] <=> y['story_count'] ) == 1 }\n # while( group = heap.pop ) # Maximum story_count\n # @final_groups << group\n # heap.clear # Remove all elements\n # grouped_stories.each{ |x|\n # if x == group || group['story_ids'].include?( x['id'] )\n # x['delete'] = true\n # next\n # end\n # story_ids = x['story_ids'] - group['story_ids']\n # x.merge!( 'story_ids' => story_ids, 'story_count' => story_ids.size )\n # heap.push( x ) if story_ids.size > 1\n # }\n # grouped_stories.delete_if{ |x| x['delete'] || x['story_count'] < 2 }\n # end\n # }\n #\n # logger.info(\"Heap Based Group Selection Performance: Found #{@final_groups.size} Groups\\n\" + Benchmark::Tms::CAPTION + (bm).to_s)\n #\n bm = Benchmark.measure {\n grouped_stories.each{ |h| h.merge!( 'story_count' => h['story_count'].to_i, 'story_ids' => h['story_ids'].split(',') ) }\n grouped_stories = grouped_stories.sort_by{ |x| -x['story_count'] }\n group_ids = Hash.new # Group that has been freezed\n story_ids = Hash.new # Stories that has been assigned a group\n grouped_stories.each{ |group|\n next if story_ids[ group['id'] ]\n group['story_ids'].delete_if{ |x| story_ids[x] }\n if group['story_ids'].size > 1\n group_ids[ group['id'] ] = group\n group['story_ids'].each{ |x| story_ids[x] = group['id'] }\n @final_groups << group\n end\n }\n group_ids.clear\n story_ids.clear\n grouped_stories.clear\n }\n \n logger.info(\"Greedy Heuristic Performance: Found #{@final_groups.size} Groups\\n\" + Benchmark::Tms::CAPTION + (bm).to_s)\n \n return if @final_groups.empty?\n \n #\n # Removing Overlapping and Redundant Groups\n #\n final_group_ids = @final_groups.collect{ |x| x['id'] }\n all_group_ids = db.select_values('SELECT id FROM candidate_groups')\n redundant_group_ids = all_group_ids - final_group_ids\n all_group_ids.clear\n final_group_ids.clear\n offset = 0\n while redundant_group_ids[ offset ]\n db.execute( 'DELETE FROM candidate_groups WHERE id IN (' + redundant_group_ids[ offset, 100 ].join(',') + ')')\n offset += 100\n end\n #db.execute( 'DELETE FROM candidate_groups WHERE id NOT IN (' + @final_groups.collect{ |x| x['id'] }.join(',') + ')')\n \n end", "title": "" }, { "docid": "10dcbe0efae6195157bd6da52b621e26", "score": "0.4370719", "text": "def grouping_array_or_grouping_element(o, collector); end", "title": "" } ]
afc8fc0ee9d7254dc76f2fd0cea8da9a
next few insance methods, pushes new pets into pets hash
[ { "docid": "9b7c65617a352d606f8a298433df32bd", "score": "0.5790715", "text": "def buy_fish(name)\n @pets[:fishes] << Fish.new(name)\n end", "title": "" } ]
[ { "docid": "ae8f53555f78b3af24a8957d6ea69ded", "score": "0.7064096", "text": "def add_pet_to_stock(pet_shop_hash, new_pet)\n pet_shop_hash[:pets] << new_pet\nend", "title": "" }, { "docid": "36fef1003270a486ed62e567bdd5611a", "score": "0.6945831", "text": "def buy_dog(name)\n#know sabout its dogs\n pets[:dogs] << Dog.new(name)\n end", "title": "" }, { "docid": "544827ce95f32219dd45d907722616bf", "score": "0.69395393", "text": "def add_pet_to_stock(shop_hash, new_pet_hash)\n shop_hash[:pets].push(new_pet_hash)\nend", "title": "" }, { "docid": "77a5746ed5178ce0c8ef1923c7103b57", "score": "0.68893045", "text": "def add_pet_to_stock(shop, pet)\n shop[:pets] << pet\nend", "title": "" }, { "docid": "ca4c9e229a328c2f1416bae43e3b1777", "score": "0.68701273", "text": "def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets] << new_pet\nend", "title": "" }, { "docid": "b98c39ff639f5499760cc485f955552e", "score": "0.6834341", "text": "def add_pet_to_stock(pet_shop_hash, new_pet_hash)\n\tpet_shop_hash[:pets].push(new_pet_hash)\nend", "title": "" }, { "docid": "f32aaf2d1043ea86f59621e6a77152af", "score": "0.6828164", "text": "def add_pet_to_stock(shop, new_pet)\n shop[:pets] << new_pet\nend", "title": "" }, { "docid": "d4bba1bdaf07d2e75d332a6abf696bb0", "score": "0.68207985", "text": "def add_pet_to_stock(shop, new_pet)\n shop[:pets] << new_pet\nend", "title": "" }, { "docid": "9b46e6acacb793a9f79136e13597f617", "score": "0.677571", "text": "def add_pet_to_stock(shop,new_animal)\n shop[:pets] << new_animal\nend", "title": "" }, { "docid": "7cf836db19ce70c6f18d986dbd46a024", "score": "0.6745465", "text": "def buy_fish(name)\n pets[:fishes] << Fish.new(name)\nend", "title": "" }, { "docid": "38470c2c7c6b292a562886e5a7e4c454", "score": "0.67196435", "text": "def add_pet_to_stock(pet_shop, pet)\n pet_shop[:pets].push(pet)\nend", "title": "" }, { "docid": "7317d98bdcacd5f05a3d2ed2cf1f57b0", "score": "0.6673108", "text": "def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\nend", "title": "" }, { "docid": "7317d98bdcacd5f05a3d2ed2cf1f57b0", "score": "0.6673108", "text": "def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\nend", "title": "" }, { "docid": "7317d98bdcacd5f05a3d2ed2cf1f57b0", "score": "0.6673108", "text": "def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\nend", "title": "" }, { "docid": "7317d98bdcacd5f05a3d2ed2cf1f57b0", "score": "0.6673108", "text": "def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\nend", "title": "" }, { "docid": "7317d98bdcacd5f05a3d2ed2cf1f57b0", "score": "0.6673108", "text": "def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\nend", "title": "" }, { "docid": "4f82ffddf66aaf1e7965f947012ca2c9", "score": "0.6659574", "text": "def add_pet_to_stock (pet_shop, new_pet)\nreturn pet_shop[:pets].push (new_pet)\nend", "title": "" }, { "docid": "c1556050e4bea7efb53a5b5d09bb667a", "score": "0.6653962", "text": "def add_pet_to_stock(shop_name, new_pet)\n shop_name[:pets] << new_pet\nend", "title": "" }, { "docid": "7c931e21f46af0e1dd8274d601ab7f4f", "score": "0.66172695", "text": "def add_pet_to_stock(shop, new_pet)\n shop[:pets].push(new_pet)\nend", "title": "" }, { "docid": "db67f174433bc66e37f2318117180ea5", "score": "0.65984046", "text": "def initialize\n @planets = {}\n end", "title": "" }, { "docid": "b5d02d47294638905633e93ecaccbe3f", "score": "0.65792686", "text": "def add_pet_to_stock(petshop,new_pet)\n petshop[:pets].push(new_pet)\n return petshop\n end", "title": "" }, { "docid": "d4639e5f964c74ba08d0242ddc2c4732", "score": "0.65475833", "text": "def add_pet_to_stock(pet_shop, new_pet)\n num_of_pets = pet_shop[:pets].length\n if num_of_pets < 7\n pet_shop[:pets] << {\n name: \"Seventh One\",\n pet_type: :elephant,\n breed: \"Big eared one\",\n price: 500\n }\n end\nend", "title": "" }, { "docid": "815ee894dd1e040f4a74dea9de80cbfa", "score": "0.65319353", "text": "def add_pet_to_stock( pet_shop, new_pet )\n\n return pet_shop[:pets].push( new_pet )\n\nend", "title": "" }, { "docid": "c8042d1cb327865df67e541f25bd38d2", "score": "0.6472342", "text": "def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\n return pet_shop[:pets].count()\nend", "title": "" }, { "docid": "217dd8c896068005178cbefc9af6ca0e", "score": "0.6466449", "text": "def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets] << new_pet\n return pet_shop[:pets].length\nend", "title": "" }, { "docid": "00bc8f52982eaf812e74495c246aff87", "score": "0.6451094", "text": "def add_pet_to_stock (shop, new_pet)\n @pet_shop[:pets] << @new_pet\n def stock_count(shop)\n return @pet_shop [:pets].count\n end\nend", "title": "" }, { "docid": "643203bf4d56e9d2be0c6288f3862f00", "score": "0.64485145", "text": "def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\n return pet_shop[:pets].length\nend", "title": "" }, { "docid": "ebd04593364929b6542dceddb7bd58ff", "score": "0.64312905", "text": "def add_pet_to_stock(pet_shop, new_pet)\n pet_shop [:pets].push (new_pet)\nend", "title": "" }, { "docid": "542df28687e20559ccf396b9a015078a", "score": "0.64148474", "text": "def add_pet_to_stock (pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\n pet_to_be_added = stock_count(pet_shop)\n #return pet_shop.count\nend", "title": "" }, { "docid": "4c1a6e361a91411f830b7aeec0f7a49b", "score": "0.6405058", "text": "def add_pet_to_stock(shop, new_pet)\n return shop[:pets].push(new_pet)\nend", "title": "" }, { "docid": "f5dbc857023c611d24a7343a12ebde9a", "score": "0.6388128", "text": "def sell_pets\n pets.each do |species, pet_array| #enumerate through pets hash...\n pet_array.each do |pet_object| #then enumerate through pet_array within pets hash...\n #binding.pry\n pet_object.mood = \"nervous\" #set each pet_object's mood to \"nervous\"\n end\n end #end loop\n self.pets.clear #and reset Owner instance .pets to an empty array, that is returned\n end", "title": "" }, { "docid": "c1c62ab472714eed9f5718cfb949b658", "score": "0.6384692", "text": "def buy_fish(name)\n#knows about its fishes\n pets[:fishes] << Fish.new(name)\n end", "title": "" }, { "docid": "69cdb498724d3410600f7a053971cb33", "score": "0.63268965", "text": "def buy_fish(name)\n new_fish = Fish.new(name)\n self.pets[:fishes] << new_fish \n end", "title": "" }, { "docid": "91067b4fcb4a80f62a4ac985f0fbb64f", "score": "0.63218045", "text": "def sell_pets\n self.pets[:dogs].each do |dog|\n dog.mood = \"nervous\"\n end\n self.pets[:cats].each do |cat|\n cat.mood = \"nervous\"\n end\n self.pets[:fishes].each do |fish|\n fish.mood = \"nervous\"\n end\n self.pets[:fishes] = []\n self.pets[:dogs] = []\n self.pets[:cats] = []\n end", "title": "" }, { "docid": "7ab513627b72088d159052d5be58e7d8", "score": "0.631888", "text": "def buy_dog(name)\n pets[:dogs] << Dog.new(name)\n end", "title": "" }, { "docid": "f0e4c66ecea4fdb0e1ec3f1b5cb82dbe", "score": "0.62979275", "text": "def add_pet_to_stock(count, new_pet)\n count[:pets].push(new_pet)\n return count[:pets].length\nend", "title": "" }, { "docid": "b08a4825074b94427cf4e39a163ed5f6", "score": "0.6236585", "text": "def pets_owned (x)\n @pets.push (x)\n end", "title": "" }, { "docid": "3fc93e8be789f162617be81f6d620a62", "score": "0.6206625", "text": "def initialize(species)\n @species = species\n#is initialized with a pets attribute as a hash with 3 keys\n @pets = {:fishes => [], :dogs => [], :cats => []}\n #keeps track of the owners that have been created\n @@owners << self\n end", "title": "" }, { "docid": "fbc889af86d8c5663b86d43c839d8cf6", "score": "0.6180617", "text": "def add_pet(pet)\n @pets[pet.name.to_sym] = pet\n end", "title": "" }, { "docid": "69c2cee552b5af6e494b101c4e2795e5", "score": "0.6153386", "text": "def buy_cat(cat_name)\n cat = Cat.new(cat_name)\n self.pets[:cats] << cat\n\n end", "title": "" }, { "docid": "50ec7dfc95e4a3616ee7c094ee5d402b", "score": "0.6131744", "text": "def add_pet_to_owner(owner, pet_to_add)\n owner[:pets].push(pet_to_add)\nend", "title": "" }, { "docid": "708340257fb5e68f86222d5f94d86a5c", "score": "0.6037875", "text": "def buy_cat(name)\n #knows about its cats\n pets[:cats] << Cat.new(name)\n end", "title": "" }, { "docid": "27e5a67a4384eea4d96ba6e83d86ead7", "score": "0.603176", "text": "def add_pet_to_customer(customer, new_pet_hash)\n customer[:pets] << (new_pet_hash)\nend", "title": "" }, { "docid": "9cb31ca89fc5ce14163eb07966cfc4bd", "score": "0.59876966", "text": "def add_pet_to_stock(pet_shop,new_customer)\n pet_shop[:pets]<<new_customer\n return\nend", "title": "" }, { "docid": "a2183c76fea6496293fbf0503468df53", "score": "0.59795994", "text": "def pets #stores all of the owners pets\n @pets #expect(owner.pets).to eq({:fishes => [], :dogs => [], :cats => []})\n end", "title": "" }, { "docid": "dac76316ad87e814653bccdcd7488a29", "score": "0.59719366", "text": "def buy_dog(name)\n dog = Dog.new(name)\n @pets[:dogs] << dog\n end", "title": "" }, { "docid": "fbdab5c20cd337aadf1476d60c14e92b", "score": "0.5967258", "text": "def buy_pet(pet)\n self.pets.push(pet)\n pet.owner = self\n end", "title": "" }, { "docid": "aecfebd48cc63adb59651072d683502f", "score": "0.5964625", "text": "def sell_pets\n all_pets = []\n all_pets << self.cats \n all_pets << self.dogs \n all_pets.flatten.map do |each_pet|\n each_pet.mood = \"nervous\"\n each_pet.owner = nil\n end\n end", "title": "" }, { "docid": "e0a0b00f47cfed84ee3be3ac1ac8286a", "score": "0.59415925", "text": "def sell_pets\n pets.each {|kind, moods|\n moods.each {|pets| pets.mood=(\"nervous\")}\n moods.clear\n }\n end", "title": "" }, { "docid": "14573c50824f0a437a43bb45551e6b0a", "score": "0.59391266", "text": "def add_pet_to_customer(customer_hash, new_pet)\n return customer_hash[:pets] << new_pet\nend", "title": "" }, { "docid": "7cbf67fdd8cd480e8d1f40bc4b1a7c29", "score": "0.5931237", "text": "def initialize(species)\n @species = species\n @@all << self\n @pets = {fishes: [], dogs: [], cats: []}\n end", "title": "" }, { "docid": "a9e25ea3fdc21e4f1e4bcefe394b2578", "score": "0.5923781", "text": "def buy_cat(name)\n pets[:cats] << Cat.new(name)\n end", "title": "" }, { "docid": "7b18e541992917cdaebe26517fcfa82a", "score": "0.5906389", "text": "def sell_pets #Owner can sell all its pets, which make them nervous\n # fido = Dog.new(\"Fido\")\n # tabby = Cat.new(\"Tabby\")\n # nemo = Fish.new(\"Nemo\")\n # [fido, tabby, nemo].each {|o| o.mood = \"happy\" }\n # owner.pets = {\n # :dogs => [fido, Dog.new(\"Daisy\")],\n # :fishes => [nemo],\n # :cats => [Cat.new(\"Mittens\"), tabby]\n # }\n # owner.sell_pets\n # owner.pets.each {|type, pets| expect(pets.empty?).to eq(true) }\n # [fido, tabby, nemo].each { |o| expect(o.mood).to eq(\"nervous\") }\n pets.each do |type, animals|\n animals.each do |animal|\n animal.mood = \"nervous\"\n end\n animals.clear\n end\n end", "title": "" }, { "docid": "29ff1a4f65f763079ae111d5074d7d31", "score": "0.5886841", "text": "def buy_dog(dog_name)\n dog = Dog.new(dog_name)\n self.pets[:dogs] << dog\n end", "title": "" }, { "docid": "1d083c95056f6b8d7e88342b9ccf6b4e", "score": "0.5885854", "text": "def add_item(hash,item)\n hash[:inventory].push(item)\nend", "title": "" }, { "docid": "1bb51f49c0451cbfbab025c8a04b5ed8", "score": "0.5879488", "text": "def sell_pets\n pets.each do |type, all_type|\n all_type.each do |pet|\n pet.mood = \"nervous\"\n end\n end\n pets.clear\n end", "title": "" }, { "docid": "0cab48b66a172b93ea33d239d8934b90", "score": "0.58765256", "text": "def initialize(species)\n @species = species\n @pets = {fishes: [], cats: [], dogs: []}\n @name = name\n @@all << self \n end", "title": "" }, { "docid": "1b8622e20e546c03579e656c20920008", "score": "0.58483744", "text": "def initialize(species)\n @pets={\n :fishes => [],\n :dogs => [],\n :cats => []\n }\n @species = species\n @@owners << self\n end", "title": "" }, { "docid": "f49479fcc9f66de79f9fa3bc81427950", "score": "0.5830758", "text": "def buy_fish(name)\n pets[:fishes] << Fish.new(name)\n end", "title": "" }, { "docid": "0232db92c324c3a5fb15a920cd09e784", "score": "0.5816016", "text": "def sell_pets\n pets = dogs + cats\n\n pets.each do |pet|\n pet.mood = \"nervous\"\n pet.owner = nil\n end\n end", "title": "" }, { "docid": "6174259a730e63e1e1a7ae868d5a03e8", "score": "0.58159024", "text": "def initialize(name)\n @pets = {fishes: [], cats: [], dogs: []}\n @@owners << self\n @species = \"human\" \n end", "title": "" }, { "docid": "990cd3f43b9170cd6224a3e37b013dfb", "score": "0.5745691", "text": "def give_pet_up_to_shelter(animal_name, animal_instance_name, shelter_instance_name)\n @number_of_pets = @number_of_pets - 1\n @pets.delete(animal_name)\n shelter_instance_name.animals[animal_name] = animal_instance_name\n end", "title": "" }, { "docid": "19674209563588269d2319cb95a08bc2", "score": "0.57415617", "text": "def add_planets(planets)\n planets.each do |planet|\n @planets.push(planet)\n end\n end", "title": "" }, { "docid": "996fcf7990fbe3e25f33513a9269b5a7", "score": "0.573509", "text": "def add_pet_to_customer(customer,new_pet)\n customer[:pets] << new_pet\n return\nend", "title": "" }, { "docid": "280236e46bc7c112decca431fe85ba3b", "score": "0.57329553", "text": "def initialize(species) #Automatically executes the code in the method body\n @species = species #Requires Owner to define the pets' species\n @name = name #Requires Owner to define the pet's name\n @@all << self #Adds new instance of Owner to the collection @@all = []\n @pets = {:fishes => [], :dogs => [], :cats => []} #Stores all of the owner's pets\n end", "title": "" }, { "docid": "9c506c0fec0ceff50ddd84b8ea4a1b7c", "score": "0.5721042", "text": "def add_planets\n get_list_of_planets.each {|planet| Planet.new(planet)} \n end", "title": "" }, { "docid": "67e6bccedeb280723ad3261bb424a5fb", "score": "0.5718983", "text": "def add_knight(name, quest, favorite_color, hash)\n hash = {\n :name => name, \n :quest => quest, \n :favorite_color => favorite_color\n }\n # knights are an array...so push a hash into an array??\n adventure_hash[:knights] << hash\n adventure_hash # doesn't work without returning this\nend", "title": "" }, { "docid": "8aba0f08f35dcf4117cbb690471e4727", "score": "0.5713897", "text": "def buy_cat(name)\n cat = Cat.new(name)\n @pets[:cats] << cat\n end", "title": "" }, { "docid": "0a43262f7094425f48af173468954e81", "score": "0.57124037", "text": "def adopt_pet_from_shelter(animal_name, animal_instance_name, shelter_instance_name)\n @number_of_pets = @number_of_pets + 1\n @pets[animal_name] = animal_instance_name\n shelter_instance_name.animals.delete(animal_name)\n end", "title": "" }, { "docid": "42e3b64619c6f6cdb4cb116b682dcf9f", "score": "0.57107717", "text": "def add_pet_to_customer(customer, new_pet)\n customer[:pets].push(new_pet)\n customer[:pets].count\nend", "title": "" }, { "docid": "9fa0de8591558d7bcefff248661a4d37", "score": "0.57009774", "text": "def add_pet(pet)\n\t\t@pets_list << pet\n\tend", "title": "" }, { "docid": "cc6799ae5c2c20804a99f9f9b23e3c28", "score": "0.57007176", "text": "def add_pet_to_customer(customer, new_pet)\n \n customer[:pets] << new_pet\n\nend", "title": "" }, { "docid": "bbdc20410f75215a7f95ebccbd0f51d8", "score": "0.56955445", "text": "def add new_planet\n @planets << new_planet\n end", "title": "" }, { "docid": "6bad60cb60be80e1d16dd319f06c05d2", "score": "0.56801367", "text": "def initialize(animal_name, age, gender, species)\n @animal_name = animal_name\n @age = age\n @gender = gender\n @species = species\n @toys = []\n @pets = {}\n\n end", "title": "" }, { "docid": "1fd5d83d6dda871f38a49b74da3e9407", "score": "0.56771916", "text": "def add_pet_to_customer(customer, new_pet)\ncustomer[:pets].push(new_pet)\nend", "title": "" }, { "docid": "d8ff642ade2cdd75e71c3a5d4d30510e", "score": "0.5670231", "text": "def add_pet_to_customer(customer, new_pet)\n customer[:pets] << new_pet\nend", "title": "" }, { "docid": "8b30ffcd8cc93d06325dc9308693ad3e", "score": "0.5659131", "text": "def sell_pet_to_customer(pet_shop, pet_to_sell, customer)\n for pet_for_sale in pet_shop[:pets]\n if pet_for_sale[:name] == pet_to_sell\n customer[:pets].push(pet_to_sell)\n pet_shop[:admin][:pets_sold] += 1\n customer[:cash] -= pet_to_sell[:price]\n pet_shop[:admin][:total_cash] += pet_to_sell[:price]\n end\n end\nend", "title": "" }, { "docid": "f9fd82e48acedc91f406bd8d1540778a", "score": "0.5654159", "text": "def sell_pets\n all_animals = self.pets.values\n\n all_animals.each do |species|\n species.each {|pet| pet.mood = \"nervous\"}\n species.clear\n end\n end", "title": "" }, { "docid": "f8bc8e895d130537e0eed90dbc902a1e", "score": "0.5650043", "text": "def buy_fish(name)\n fish = Fish.new(name)\n @pets[:fishes] << fish\n end", "title": "" }, { "docid": "f8bc8e895d130537e0eed90dbc902a1e", "score": "0.5650043", "text": "def buy_fish(name)\n fish = Fish.new(name)\n @pets[:fishes] << fish\n end", "title": "" }, { "docid": "52acaaf4563d59dbcefb338a0e0327eb", "score": "0.56422734", "text": "def sell_pets\n @pets.each do |type, pet| \n pet.each { |animal| animal.mood = \"nervous\"}\n end\n @pets.clear\n end", "title": "" }, { "docid": "fc6ade5ec80023cde40f8aa5391c68b5", "score": "0.56379426", "text": "def walk_dogs #walks the dogs which makes the dogs' moods happy\n # dog = Dog.new(\"Daisy\")\n # owner.pets[:dogs] << dog\n # owner.walk_dogs\n # expect(dog.mood).to eq(\"happy\")\n pets[:dogs].each do |dog|\n dog.mood = \"happy\"\n end\n end", "title": "" }, { "docid": "0973fb2fd884f4879fe43a984243220f", "score": "0.5612283", "text": "def adopt_pet(animal)\n @pets_list.push(animal)\n end", "title": "" }, { "docid": "b63b84ad3162fc5c7ec9c2711cf20e13", "score": "0.56080955", "text": "def set_recipes(fridge)\r\n # put recipes you want to puts manumally\r\n recipe_ingredients = {\"Teriyaki\" =>[\"chicken\",\"sugar\",\"mirin\",\"soy sauce\"],\r\n \"Curry rice\" => [\"rice\",\"curry mix\",\"potato\",\"onion\",\"beef\",\"carrot\"],\r\n \"Oyakodon\" => [\"chicken\",\"sugar\",\"mirin\",\"soy sauce\",\"rice\",\"egg\",\"onion\"],\r\n \"Takoyaki\" => [\"flour\",\"octopus\",\"ginger\",\"dashi\"],\r\n \"Nikujyaga\" => [\"beef\",\"sugar\",\"mirin\",\"soy sauce\",\"carrot\",\"onion\",\"potato\"],\r\n \"Octopus Sashimi\" => [\"octopus\",\"soy sauce\"],\r\n \"Miso soup\" => [\"miso\",\"dashi\"]}\r\n\r\n # set recipes_array to make new instence of Recipe\r\n recipes_array = {\"Teriyaki\" => [\"http://natashaskitchen.com/2015/12/11/easy-teriyaki-chicken/\",15],\r\n \"Curry rice\" => [\"http://www.japanesecooking101.com/curry-and-rice-recipe/\",40],\r\n \"Oyakodon\" => [\"http://www.justonecookbook.com/oyakodon/\",30],\r\n \"Takoyaki\" => [\"http://www.justonecookbook.com/takoyaki-recipe/\",20],\r\n \"Nikujyaga\" => [\"http://www.justonecookbook.com/nikujaga/\",30],\r\n \"Octopus Sashimi\" => [\"http://www.makesushi.com/sashimi/\",5],\r\n \"Miso soup\" =>[ \"http://steamykitchen.com/106-simple-10-minute-miso-soup.html\",5]}\r\n\r\n # make new instance and put to fridge.recipes\r\n recipes_array.each do |key,value|\r\n new_recipe = Recipe.new(key,value[0],value[1])\r\n new_recipe.ingredients = recipe_ingredients[\"#{key}\"]\r\n fridge.recipes << new_recipe\r\nend # recipes_array each end\r\nend", "title": "" }, { "docid": "7035e9498d215e53df7fb95ab1beb9dd", "score": "0.56015104", "text": "def newPunters\n # @punters : {('name', [cash, last_bid]), (...), (...)}\n @punters = Hash.new\n openShop\n end", "title": "" }, { "docid": "3c16d21dff71a1d64cec1254a711314c", "score": "0.5586253", "text": "def add_to_inventory(category, product, quantity, price, refid)\n @inventory = {\n category => [\n product: product,\n quantity: quantity,\n price: price,\n refid: refid\n ]\n}\nend", "title": "" }, { "docid": "39d67d1ff7999ecc6927e22dd89ba940", "score": "0.55799264", "text": "def add_vit(amt, loc)\n if loc == \"\"\n self.vit += amt\n self.hp = self.vit * 10\n elsif loc == \"job\" || loc == \"eqp\"\n self[\"vit_\" + loc] += amt\n self[\"hp_\" + loc] = self[\"vit_\" + loc] * 10\n end\n\n self.save\n end", "title": "" }, { "docid": "07c51573c0ab535775860abf859317aa", "score": "0.557899", "text": "def add_pet_to_customer(customer, new_pet)\n customer[:pets].push(new_pet)\nend", "title": "" }, { "docid": "07c51573c0ab535775860abf859317aa", "score": "0.557899", "text": "def add_pet_to_customer(customer, new_pet)\n customer[:pets].push(new_pet)\nend", "title": "" }, { "docid": "07c51573c0ab535775860abf859317aa", "score": "0.557899", "text": "def add_pet_to_customer(customer, new_pet)\n customer[:pets].push(new_pet)\nend", "title": "" }, { "docid": "1720389dc5158ae389ecf8faf0440c97", "score": "0.5573414", "text": "def sell_pet_to_customer(petshop,name,customer)\n for pet in petshop[:pets]\n if pet[:name] == name\n customers[:pets].push(pet)\n petshop[:admin][:pets_sold].push(pet)\n sold[:admin][:total_cash] += amount\n end\n end\n return nil\nend", "title": "" }, { "docid": "d0df53f6c1263455416816ad6318e128", "score": "0.55733263", "text": "def increase_pets_sold(pet_shop_hash, new_pets)\n\tcurrent_number_pets = pet_shop_hash[:admin][:pets_sold]\n\tupdated_total_pets = current_number_pets + new_pets\n\tpet_shop_hash[:admin][:pets_sold] = updated_total_pets\nend", "title": "" }, { "docid": "bbc55c94792c3c35558a5c4a0b72e6d2", "score": "0.5551091", "text": "def initialize(verse)\n @the_verse = verse\n @planets = {}\n end", "title": "" }, { "docid": "e4dd094151c90c751bf5d16e1beddf5b", "score": "0.5549093", "text": "def add_item(grocery_hash, grocery, quantity)\n grocery_hash [grocery] = quantity \nend", "title": "" }, { "docid": "7843f8f1f13b2f633bfb02ca6b059bc8", "score": "0.5548305", "text": "def prepare_pet(pet_api)\n pet_id = random_id\n category = Petstore::Category.new('id' => 20002, 'name' => 'category test')\n tag = Petstore::Tag.new('id' => 30002, 'name' => 'tag test')\n pet = Petstore::Pet.new('id' => pet_id, 'name' => \"RUBY UNIT TESTING\", 'photo_urls' => 'photo url',\n 'category' => category, 'tags' => [tag], 'status' => 'pending')\n pet_api.add_pet(pet)\n pet_id\nend", "title": "" }, { "docid": "462aa6afb6c8c129aa5c16dfb9eef91d", "score": "0.55459815", "text": "def new_game_for players\r\n players.each do |player|\r\n player[:state] = 'normal'\r\n\tplayer[:cards] = []\r\n\tplayer[:points] = 0\r\n\tplayer[:bet] = 0\r\n end\r\nend", "title": "" }, { "docid": "792ab33d42c263e5daee6690389caac6", "score": "0.55437696", "text": "def pets\n pets = self.dogs + self.cats\n end", "title": "" }, { "docid": "ca41a112fd4aecaf0d4667ff90af778d", "score": "0.5542131", "text": "def play_with_cats\n#makes each of the cat's moods happy when played with\n pets[:cats].each do |cat|\n cat.mood = \"happy\"\n end\n end", "title": "" }, { "docid": "ab265a3a5f510e68b79077687f36f01a", "score": "0.5534694", "text": "def buy_cat(name) # expect(owner.pets[:cats].count).to eq(0)\n new_cat = Cat.new(name) # owner.buy_cat(\"Crookshanks\")\n self.pets[:cats] << new_cat # owner.pets[:cats].each { |cat| expect(cat).to be_a(Cat) }\n new_cat # expect(owner.pets[:cats].count).to eq(1)\n # = knows about its cats; Owner knows all about its pets - Owner sets name of pet, the pet can\\'t change its name\n # owner.buy_cat(\"Crookshanks\")\n # expect(owner.pets[:cats][0].name).to eq(\"Crookshanks\")\n end", "title": "" }, { "docid": "c4cf93ae817fe76ec77dfb2d4ae8651e", "score": "0.55250233", "text": "def add_pet_to_customer(supplied_customer, new_pet)\n supplied_customer[:pets].push(new_pet)\nend", "title": "" } ]
8b4cd4d68c8c425fc05838a10392c041
DELETE /drivers/1 DELETE /drivers/1.json
[ { "docid": "1716e4ef0eac0cbf9db756105ebeb601", "score": "0.7263908", "text": "def destroy\n @driver.destroy\n respond_to do |format|\n format.html { redirect_to drivers_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "3cba4dc681ce82781af183cb20a0eca2", "score": "0.73493415", "text": "def destroy\n @driver = Driver.find(params[:id])\n @driver.destroy\n\n respond_to do |format|\n format.html { redirect_to drivers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f641239c2b49e3c4379be13c04f37f59", "score": "0.7249377", "text": "def destroy\n # Logic to delete a record\n @driver = Driver.find(params[:id])\n @driver.destroy\n\n respond_to do |format|\n format.html { redirect_to drivers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "621c399d835bbee2434ef3669b690c03", "score": "0.71935797", "text": "def destroy\n\t\t\t\trespond_with Driver.destroy(params[:id])\n end", "title": "" }, { "docid": "e19193df13c8f4dfece23cda9e14dfb1", "score": "0.7066158", "text": "def destroy\n @driver.destroy\n respond_to do |format|\n format.html { redirect_to drivers_url, notice: 'Driver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e19193df13c8f4dfece23cda9e14dfb1", "score": "0.7066158", "text": "def destroy\n @driver.destroy\n respond_to do |format|\n format.html { redirect_to drivers_url, notice: 'Driver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e19193df13c8f4dfece23cda9e14dfb1", "score": "0.7066158", "text": "def destroy\n @driver.destroy\n respond_to do |format|\n format.html { redirect_to drivers_url, notice: 'Driver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "689d5a07a403c4b765ba178e4aff08a3", "score": "0.69354254", "text": "def delete\n client.delete(\"/#{id}\")\n end", "title": "" }, { "docid": "d7d3c63b7953786567365eebd7e48340", "score": "0.68821996", "text": "def delete(options={})\n connection.delete(\"/\", @name)\n end", "title": "" }, { "docid": "6307483d5ffb74ca7098f45835f52ee1", "score": "0.68435067", "text": "def destroy\n @driver.destroy\n respond_to do |format|\n format.html { redirect_to enterprise_drivers_path(current_user), notice: 'Driver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "579a2de57c19db0b52df4c183a450ac9", "score": "0.68009776", "text": "def destroy\n @driver_record = DriverRecord.find(params[:id])\n @driver_record.destroy\n\n respond_to do |format|\n format.html { redirect_to driver_records_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7c5941b5475e62d8acfc52dd27830143", "score": "0.66981745", "text": "def destroy\n @driverslist.destroy\n respond_to do |format|\n format.html { redirect_to driverslists_url, notice: 'Driverslist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b34f70be0e5715c285c8be66f6fb32c5", "score": "0.6650849", "text": "def destroy\n @ride_driver.destroy\n respond_to do |format|\n format.html { redirect_to @root }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7a5eea7c7a07ce3e7f95fa50802d596e", "score": "0.6633451", "text": "def delete path\n make_request(path, \"delete\", {})\n end", "title": "" }, { "docid": "9410f5d5c06a5d4acee3b61e4f080658", "score": "0.66115105", "text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "title": "" }, { "docid": "9410f5d5c06a5d4acee3b61e4f080658", "score": "0.66115105", "text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "title": "" }, { "docid": "9410f5d5c06a5d4acee3b61e4f080658", "score": "0.66115105", "text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "title": "" }, { "docid": "9410f5d5c06a5d4acee3b61e4f080658", "score": "0.66115105", "text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "title": "" }, { "docid": "59eb9d1fec3a5d513ff6aed6b0ddc0b1", "score": "0.6602681", "text": "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "title": "" }, { "docid": "179ff0053e8f4f967cb3d92206094cf0", "score": "0.65830946", "text": "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "title": "" }, { "docid": "d2f2b7e27bbbe134661361074c399275", "score": "0.6578888", "text": "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "title": "" }, { "docid": "cf7886d0735e25c75ccb26db2ce3fda2", "score": "0.6563318", "text": "def delete(vendor_id)\n @client.delete(\"/#{@model}/#{vendor_id}\")\n end", "title": "" }, { "docid": "d1f0a8e8c97a0438790f1ddeeecaca29", "score": "0.6556748", "text": "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "title": "" }, { "docid": "3633e737644dae5f5d8d49f3248f7a12", "score": "0.6542222", "text": "def delete\n api(\"Delete\")\n end", "title": "" }, { "docid": "522e787502895f0a05c9b2c6ca4e5ced", "score": "0.65400845", "text": "def delete\n request(:delete)\n end", "title": "" }, { "docid": "c69c73a69d0f04db604e378ef5db191a", "score": "0.65312624", "text": "def destroy\n @drivers_licesnse.destroy\n respond_to do |format|\n format.html { redirect_to drivers_licesnses_url, notice: 'Drivers licesnse was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "33b888c8f2b033bb54789de80c57d692", "score": "0.6513617", "text": "def delete\n client.delete(url)\n @deleted = true\nend", "title": "" }, { "docid": "b246ffb86d7f0e110b8b7f377e09c64b", "score": "0.6506391", "text": "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "title": "" }, { "docid": "b121d4449b00e5e93cdc0d141d06bcba", "score": "0.6502778", "text": "def destroy\n @trip_driver = TripDriver.find(params[:id])\n @trip_driver.destroy\n\n respond_to do |format|\n format.html { redirect_to trip_drivers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4c1c164b581dbae14285797e584e8fb7", "score": "0.6491623", "text": "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "title": "" }, { "docid": "0985ca8fdcda6622118b70768bc657e7", "score": "0.64820737", "text": "def destroy\n @references_vehicle_driver.destroy\n respond_to do |format|\n format.html { redirect_to references_vehicle_drivers_url, notice: 'References vehicle driver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ce1e7cf90aa82857889c1b10e9f7d91a", "score": "0.64626956", "text": "def destroy\n @client.delete( name )\n end", "title": "" }, { "docid": "fb622696b3cadaef2a0d459cf3572785", "score": "0.64614874", "text": "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "title": "" }, { "docid": "ba67ebd85114998e01be10599c8943ca", "score": "0.64588916", "text": "def delete(path)\n RestClient.delete request_base+path\n end", "title": "" }, { "docid": "95900eeb6730c084ae9c9e5a80d9d8ce", "score": "0.6455442", "text": "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "title": "" }, { "docid": "40bf1f2987e62deb3d87435d29e1a69e", "score": "0.64538735", "text": "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "title": "" }, { "docid": "12649d62912dc561d03cb528b51fe007", "score": "0.64533687", "text": "def delete\n api_client.delete(url)\n end", "title": "" }, { "docid": "c5a5c7b0eb437b2c3172008b2b99bc03", "score": "0.64492714", "text": "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "b3d5cc7be98c38ed2845836ab57352e3", "score": "0.64227074", "text": "def destroy\n @client.delete(@name)\n end", "title": "" }, { "docid": "f8a59d7b89a929f0138bba666a8d5483", "score": "0.64007324", "text": "def delete(name)\n\n end", "title": "" }, { "docid": "44433b2fd31cb7ba9fc3049e93f62902", "score": "0.63890237", "text": "def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end", "title": "" }, { "docid": "ee8080891886a4f50035e02f47e137fe", "score": "0.6387678", "text": "def delete(path)\n request(:delete, path)\n end", "title": "" }, { "docid": "b4d048dcfd4a37fc70d37907c8515974", "score": "0.638747", "text": "def delete(url, headers={})\n RestClient.delete url, headers\n end", "title": "" }, { "docid": "f8e153955e08e6e164f9d2a06935120b", "score": "0.6380854", "text": "def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end", "title": "" }, { "docid": "376afb7872ca26558919139da66b44df", "score": "0.6378582", "text": "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "title": "" }, { "docid": "3bbe532f009f1a184b0c02732cbe4aaf", "score": "0.6373833", "text": "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "title": "" }, { "docid": "c7022b827d18ed08bc9e8808b9cc4216", "score": "0.6373626", "text": "def destroy\n @driver_log.destroy\n respond_to do |format|\n format.html { redirect_to driver_logs_url, notice: 'Driver log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "765dafb23987e21dc2b36836aab41321", "score": "0.63715565", "text": "def destroy\n chef_rest_v1.delete(\"clients/#{@name}\")\n end", "title": "" }, { "docid": "f9349c38f080d59f3ac232e39210f5f7", "score": "0.6359608", "text": "def delete(path, params={}, options={})\n request(:delete, api_path(path), params, options)\n end", "title": "" }, { "docid": "a3001b23415993e687b7fbcf6856f0fe", "score": "0.6353975", "text": "def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "title": "" }, { "docid": "642b4bd4b513d285f22799eb616d786c", "score": "0.63511443", "text": "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "title": "" }, { "docid": "60879d20f65a6fe0891637d21c7685c9", "score": "0.63503945", "text": "def delete(path)\n with_remote do |http|\n http.delete(path)\n end\n end", "title": "" }, { "docid": "b39a03413d606391c52e7c71e957a049", "score": "0.63446116", "text": "def delete\n render json: Company.delete(params[\"id\"])\n end", "title": "" }, { "docid": "7070e4dc3849fac5852c0271c9b6d7cc", "score": "0.63423", "text": "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "title": "" }, { "docid": "34264605c47edda6ffe32df87c7a7266", "score": "0.6340932", "text": "def delete\n delete_from_server single_url\n end", "title": "" }, { "docid": "b98c7e45e7d0ec90ef4e0c8f52735448", "score": "0.6333992", "text": "def destroy\n @driver_division.destroy\n respond_to do |format|\n format.html { redirect_to driver_divisions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a1f3c7d499f21a82d9c4a4b92e299a60", "score": "0.6331003", "text": "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "title": "" }, { "docid": "59d237dccc551135c510c4514c3b3830", "score": "0.6321706", "text": "def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end", "title": "" }, { "docid": "6efe5135639b5727ed1d30baa81443e6", "score": "0.6321148", "text": "def destroy\n @device.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad0c36135de0490ca71e281a94cd49f9", "score": "0.63157207", "text": "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "title": "" }, { "docid": "63b995ee539d37a0219171db7ef60dcd", "score": "0.63154215", "text": "def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b2834e6124c920737809b7669107f8b2", "score": "0.63110816", "text": "def delete(path, params={})\n request(:delete, path, params)\n end", "title": "" }, { "docid": "b2834e6124c920737809b7669107f8b2", "score": "0.63110816", "text": "def delete(path, params={})\n request(:delete, path, params)\n end", "title": "" }, { "docid": "b2834e6124c920737809b7669107f8b2", "score": "0.63110816", "text": "def delete(path, params={})\n request(:delete, path, params)\n end", "title": "" }, { "docid": "b2834e6124c920737809b7669107f8b2", "score": "0.63110816", "text": "def delete(path, params={})\n request(:delete, path, params)\n end", "title": "" }, { "docid": "b2834e6124c920737809b7669107f8b2", "score": "0.63110816", "text": "def delete(path, params={})\n request(:delete, path, params)\n end", "title": "" }, { "docid": "b2834e6124c920737809b7669107f8b2", "score": "0.63110816", "text": "def delete(path, params={})\n request(:delete, path, params)\n end", "title": "" }, { "docid": "b2834e6124c920737809b7669107f8b2", "score": "0.63110816", "text": "def delete(path, params={})\n request(:delete, path, params)\n end", "title": "" }, { "docid": "60ca57561b2d7de5952ffb6042c9cb13", "score": "0.63102967", "text": "def destroy\n @major.destroy\n respond_to do |format|\n format.html { redirect_to majors_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fa3c20a90ea1419af2232f845e460f8c", "score": "0.6303483", "text": "def delete!\n request! :delete\n end", "title": "" }, { "docid": "f09c807e4788fe9c7833b6d786838584", "score": "0.63029426", "text": "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "52c788639c9330c93455c89b62d51618", "score": "0.62901247", "text": "def destroy\n @driver_license_type = DriverLicenseType.find(params[:id])\n @driver_license_type.destroy\n\n respond_to do |format|\n format.html { redirect_to driver_license_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "11ea59e4ce1803e67b3352fd2eaf9a0d", "score": "0.6284491", "text": "def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "title": "" }, { "docid": "fda6f52e173bcf81a9a691ee315cdec2", "score": "0.6283448", "text": "def delete(path, params={})\n request(:delete, path, params)\n end", "title": "" }, { "docid": "ca9b0816f5a698713ee13aa934bab154", "score": "0.6280951", "text": "def destroy\n @beacon_transmitter.destroy\n respond_to do |format|\n format.html { redirect_to beacon_transmitters_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dc7978b571fa1af94fbce826dcf38dc1", "score": "0.62740767", "text": "def destroy; delete end", "title": "" }, { "docid": "ab6c02a020307f090def9f2bd8dfb758", "score": "0.6268329", "text": "def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end", "title": "" }, { "docid": "ab6c02a020307f090def9f2bd8dfb758", "score": "0.6268329", "text": "def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end", "title": "" }, { "docid": "5855e69b527cb896f7b2bc4e8e46ab1f", "score": "0.62670183", "text": "def destroy\n @major = Major.find(params[:id])\n @major.destroy\n\n respond_to do |format|\n format.html { redirect_to majors_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ef2c0c142f43571ee1b97a992b2bb3ae", "score": "0.6265776", "text": "def delete(path)\n request 'DELETE', path\n end", "title": "" }, { "docid": "121d3dde1170ddcc7ce3f4272c13ea90", "score": "0.6265554", "text": "def delete(path, params = {})\n request(:delete, path, params)\n end", "title": "" }, { "docid": "121d3dde1170ddcc7ce3f4272c13ea90", "score": "0.6265554", "text": "def delete(path, params = {})\n request(:delete, path, params)\n end", "title": "" }, { "docid": "121d3dde1170ddcc7ce3f4272c13ea90", "score": "0.6265554", "text": "def delete(path, params = {})\n request(:delete, path, params)\n end", "title": "" }, { "docid": "240d1666f8572b7b02d242b521aa1135", "score": "0.6257289", "text": "def delete\n start { |connection| connection.request http :Delete }\n end", "title": "" }, { "docid": "556a16495e6b6c3836b03e068a58bffa", "score": "0.62495565", "text": "def delete(params = {})\n Client.current.delete(resource_url, params)\n end", "title": "" }, { "docid": "e5835edc6b3b920f9d11de2b14b08908", "score": "0.6239131", "text": "def delete(path, **options)\n execute :delete, path, options\n end", "title": "" }, { "docid": "1fd7dc0e91f151ed3e5049a52c30472f", "score": "0.6237726", "text": "def delete\n \n end", "title": "" }, { "docid": "c6798424d46577fa4ffac5eda4ecc0c6", "score": "0.6237266", "text": "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "title": "" }, { "docid": "ca47d5e938df99eb744c55c8a8b7a3df", "score": "0.6236211", "text": "def delete(*args)\n request(:delete, *args)\n end", "title": "" }, { "docid": "89268a6ec13a5a681962b227c3d9fb42", "score": "0.6235957", "text": "def delete\n\n end", "title": "" }, { "docid": "8bed04fff37989cb61aa54e10c5146c6", "score": "0.6230075", "text": "def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end", "title": "" }, { "docid": "4a20af206eaedc3440e9e6a7801b2fcb", "score": "0.62295336", "text": "def delete(path, params)\n request(:delete, path, {})\n end", "title": "" }, { "docid": "a0176ee8742a2380e0f00bb1453e004b", "score": "0.62292844", "text": "def delete(path, params = {})\n request(:delete, path, params)\n end", "title": "" }, { "docid": "a0176ee8742a2380e0f00bb1453e004b", "score": "0.62292844", "text": "def delete(path, params = {})\n request(:delete, path, params)\n end", "title": "" }, { "docid": "10be14cc1b8adf939dadf081e0d87676", "score": "0.6228864", "text": "def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "8a765b877cf004b4b0178fb92cd7ffe6", "score": "0.62276095", "text": "def destroy\n @device = Device.find(params[:id])\n @device.destroy\n\n respond_to do |format|\n format.html { redirect_to devices_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "6bb5b9e2ce5ab901a05a1d618f90ad4d", "score": "0.6222177", "text": "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "title": "" }, { "docid": "6bb5b9e2ce5ab901a05a1d618f90ad4d", "score": "0.6222177", "text": "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "title": "" }, { "docid": "0745159c67076f6ff0011e8f585d1c9d", "score": "0.6221494", "text": "def destroy\n @client = Client.find(params[:id])\n Client.transaction do\n FileUtils.rm Dir[\"#{Rails.root}/public/files/logo_files/\"[email protected]_s]\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client was successfully deleted.' }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "ad2e1c1a3e26e96d03f653a488512ca0", "score": "0.62146384", "text": "def destroy\n @device = Device.find(params[:id])\n @device.destroy\n\n respond_to do |format|\n format.html { redirect_to devices_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad2e1c1a3e26e96d03f653a488512ca0", "score": "0.62146384", "text": "def destroy\n @device = Device.find(params[:id])\n @device.destroy\n\n respond_to do |format|\n format.html { redirect_to devices_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
01348a22509ee7ec6812087b174b353b
Uploads text to use as evidence for a dispute challenge.
[ { "docid": "e0a194ea0166fae75e169d12999f5bd6", "score": "0.56163585", "text": "def create_dispute_evidence_text(dispute_id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/disputes/{dispute_id}/evidence-text',\n 'default')\n .template_param(new_parameter(dispute_id, key: 'dispute_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "title": "" } ]
[ { "docid": "0d171d9096d42fcf040852ad221801ff", "score": "0.643318", "text": "def save_text_passage(text)\n Tempfile.open(\"text_passage\") do |f|\n f.write(text)\n f.rewind\n file.attach(io: f,\n filename: \"#{name}.txt\",\n content_type: \"text/plain\")\n end\n end", "title": "" }, { "docid": "8811227f1e263332aca76dd00eaf14d5", "score": "0.610959", "text": "def text_params\n params.require(:text).permit(:title, :content, :audio_id, :user_id, :lang, :phase1, :phase2, :phase3)\n end", "title": "" }, { "docid": "7956ab870295d0e236667acba9a16ccd", "score": "0.60965717", "text": "def add_text_track attributes\n perform_post(\"/videos/#{get_id}/texttracks\", attributes)\n end", "title": "" }, { "docid": "fc94493f63e0956e666193753c8a25e5", "score": "0.5951758", "text": "def text_params\n params.require(:text).permit(:title, :content, :youtube_code, :slideshare_url)\n end", "title": "" }, { "docid": "0943912e84f8b717cee24c96820bddde", "score": "0.5925863", "text": "def subjective_analysis(text)\n RestClient.post \"http://api.datumbox.com/1.0/SubjectivityAnalysis.json\", :api_key => @api_key, :text => text\n end", "title": "" }, { "docid": "0482c3d2fb8bd621188e9adc60611877", "score": "0.58828723", "text": "def put_text\n\t\tuser = get_user_by_token\n\t\treturn if user.nil?\n\t\t\t\n\t\tvid = Video.find(params[:video_id])\n\t\tsecond = Time.now.getutc - vid.start_record_timestamp\n\n\t\tparams.store(\"user_id\", user[\"id\"])\n\t\tparams.store(\"active\", \"true\")\n\t\tparams.store(\"content_type\", \"text\")\n\t\tparams.store(\"second\", second)\n\t\t\n\t\tlocalParams = [\"video_id\", \"second\", \"content\"]\n \t\tresult = set_new \"Post\", localParams\n\t\t\n\t\trender result;\n\n\tend", "title": "" }, { "docid": "44df7e2598802fd9a8a7452f31752372", "score": "0.58713526", "text": "def submit_phrase dialogue_id, phrase, prompt, content_type, file_name\n params = {\n \"dialogue_id\" => dialogue_id,\n \"prompt\" => prompt,\n \"format\" => @format\n }\n do_post \"SubmitPhrase.ashx\", params, phrase, content_type, file_name\n end", "title": "" }, { "docid": "f42e364d7ad6b5fb05c54f7be58ed0b6", "score": "0.58326536", "text": "def text_params\n params.require(:text).permit(:teacher, :univ, :user_id, :textinfo_id, :lecture_name, :textbook_name, :price, :comment, :file, :status)\n end", "title": "" }, { "docid": "6ed0c694fa8f8c9e044a44df98d2960a", "score": "0.5747687", "text": "def analyze(text)\n return nil if text.to_s.strip.empty?\n post_data = self._build_post_data()\n post_data << [\"text\", text]\n _do_request(post_data, self._build_request_headers)\n end", "title": "" }, { "docid": "36bc65e310081b9b861f57e8efe2d953", "score": "0.5700813", "text": "def text_params\n params.require(:text).permit(:name, :text, :artist_id)\n end", "title": "" }, { "docid": "914ccc65b2e9c9987a5d9d5d650f8043", "score": "0.56838006", "text": "def answer_text_params\n params.require(:answer_text).permit(:atext)\n end", "title": "" }, { "docid": "8dcc30d97f44fd0556c3e581b6afbc52", "score": "0.56723934", "text": "def create\n result = Dee['text.poster'].create(\n user: current_user,\n params: text_params,\n )\n @text = result.text\n\n respond_to do |format|\n if result.ok?\n format.html { redirect_to @text, notice: 'Text was successfully created.' }\n format.json { render action: 'show', status: :created, location: @text }\n else\n format.html { render action: 'new' }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "57c1cfdae5b916922738b5ae04754ade", "score": "0.5659288", "text": "def text_params\n params.require(:database).permit(:text)\n end", "title": "" }, { "docid": "53cab943c4440095e703d69e444e6bb8", "score": "0.5658112", "text": "def create(options)\n response = post(\"/videos/#{video_id}/texttracks\", options)\n upload_file(response.link, options[:file]) if options[:file]\n response\n end", "title": "" }, { "docid": "1c93f57cfea56bb571a9710b7d6189af", "score": "0.5618035", "text": "def create_speech_file( text, voice='en_us_salli', speed = \"Prosody-Rate=100\", sentencebreak = \"Sentence-Break=400\", paragraphbreak = \"Paragraph-Break=650\")\n HTTParty.post(\"#{BASE_URL}/speechfiles\", {:body=>get_speech_file_params( text, voice, speed,sentencebreak,paragraphbreak)})\n end", "title": "" }, { "docid": "e4c8f62dea0aae144ce34b968ce6c268", "score": "0.5614649", "text": "def upload file_name, text_content\n local_file = Tempfile.new \"language-test-file\"\n File.write local_file.path, text_content\n @bucket.create_file local_file.path, file_name\n @uploaded << file_name\n ensure\n local_file.close\n local_file.unlink\n end", "title": "" }, { "docid": "a8f84bd4ca55399aecc05cf0088b417d", "score": "0.5611645", "text": "def text_params\n params.require(:text).permit(:title, :content, :user_id)\n end", "title": "" }, { "docid": "e14c2e087589030317907f6a7ab55e1d", "score": "0.56047267", "text": "def track_phrase_params\n params.require(:track_phrase).permit(:text)\n end", "title": "" }, { "docid": "af35bc7ba9e63b837decf12bf6ebd55b", "score": "0.55659115", "text": "def set_text\n @text = @exam = Text.find(params[:id])\n end", "title": "" }, { "docid": "eb698589dab51758d0091e3f81f09bcb", "score": "0.55491066", "text": "def create_speech_file_with_marks( text, voice='en_us_salli',speed = \"Prosody-Rate=100\", sentencebreak = \"Sentence-Break=400\", paragraphbreak = \"Paragraph-Break=650\" )\n HTTParty.post(\"#{BASE_URL}/speechfileswithmarks\", {:body=>get_speech_file_params( text, voice ,speed,sentencebreak, paragraphbreak)})\n end", "title": "" }, { "docid": "e68543bd9019f7f7c61d8899e848f859", "score": "0.5537859", "text": "def attach_passage_file(artifact, params)\n if artifact.file.image?\n save_image_passage(artifact, params[:crop])\n elsif artifact.file.text? || artifact.file.content_type == \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\" ||\n artifact.file.content_type == \"application/vnd.oasis.opendocument.text\"\n save_text_passage(params[:text])\n else\n save_video_audio_passage(artifact, params[:start], params[:duration])\n end\n end", "title": "" }, { "docid": "eac349604525a894a26d68b1f6e5f38a", "score": "0.5534079", "text": "def guess_params\n params.permit(\n :text\n )\n end", "title": "" }, { "docid": "46b2010d982539d9f94a3c024bd7d10a", "score": "0.55305845", "text": "def text_params\n params.require(:text).permit(:text)\n end", "title": "" }, { "docid": "6051030d8b49bf51e136e85944bce8e5", "score": "0.5516535", "text": "def waiver_text_params\n params.require(:waiver_text).permit(:file, :waiver_type)\n end", "title": "" }, { "docid": "fac152c3eabd76c35c813c238405bdc8", "score": "0.5516248", "text": "def hart_science_experiment_params\n params.require(:hart_science_experiment).permit(:text, :url)\n end", "title": "" }, { "docid": "1499cfdb75a666ca4b87a5b46c1106ac", "score": "0.55129", "text": "def upload_text_assets(pages, access)\n asset_store.save_full_text(self, access)\n pages.each do |page|\n asset_store.save_page_text(self, page.page_number, page.text, access)\n end\n end", "title": "" }, { "docid": "db5cbfe4b2d83d043a0da4a7f40c750d", "score": "0.55099463", "text": "def text_params\n params.require(:text).permit(:post, :id)\n end", "title": "" }, { "docid": "5efbf9cdbe519597e354df28399330e3", "score": "0.5506696", "text": "def create\n \n @audio = Audio.find(params[:text][:audio_id])\n audio_title= File.basename(\"#{@audio.title}\")\n @text = Text.new\n @text.title = params[:text][:title]\n @text.user_id = params[:text][:user_id]\n @text.audio_id = params[:text][:audio_id]\n @text.lang = params[:text][:lang]\n @text.phase1 = params[:text][:phase1]\n @text.phase2 = params[:text][:phase2]\n @text.phase3 = params[:text][:phase3]\n project_id = \"set-ambition\"\n storage_path = \"gs://speech-set/uploads/audio/title/#{@audio.id}/#{audio_title}\"\n require \"google/cloud/speech\"\n if @text.lang == 'korea'\n speech = Google::Cloud::Speech.new project: project_id\n audio = speech.audio storage_path, encoding: :linear16,\n sample_rate: 16000,\n language: \"ko-KR\"\n \n \n else \n speech = Google::Cloud::Speech.new project: project_id\n audio = speech.audio storage_path, encoding: :linear16,\n sample_rate: 16000,\n language: \"en-US\"\n end\n \n if @audio.title.size/2**10 < 500 # 파일사이즈 500KB보다 작으면 동기화\n results = audio.recognize max_alternatives: 15,\n phrases: [@text.phase1,@text.phase2,@text.phase3]\n else # 파일사이즈 500KB보다 크면 동기화\n \n operation = audio.process max_alternatives: 15,\n phrases: [@text.phase1,@text.phase2,@text.phase3]\n puts \"Operation started\"\n operation.wait_until_done!\n results = operation.results\n end\n @text.content = \"\"\n if @text.phase1 == \"\"\n @text.phase1 = \"안건\"\n end\n if @text.phase2 == \"\"\n @text.phase2 = \"결정\"\n end\n if @text.phase3 == \"\"\n @text.phase3 = \"주제\"\n end\n \n results.each do |result|\n if result.transcript.include?(@text.phase1) || result.transcript.include?(@text.phase2) || result.transcript.include?(@text.phase3)\n @text.content= @text.content + result.transcript\n next\n end \n result.alternatives.each_with_index do |alternative, index|\n \n if alternative.transcript.include?(@text.phase1) || alternative.transcript.include?(@text.phase2) || alternative.transcript.include?(@text.phase3)\n result = alternative\n break\n else\n end\n end\n @text.content= @text.content + result.transcript\n end\n \n respond_to do |format|\n if @text.save\n format.html { redirect_to @text }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39f7b402551e181d5100492d3810fe21", "score": "0.5505671", "text": "def upload\n started = Time.now\n ['english_audio', 'english_video',\n 'bengali_audio','bengali_video'].each do | content |\n self.send content\n end\n dur = (Time.now - started).to_i # .strftime '%H:%M:%S'\n puts \" Finished in #{dur} seconds\"\n end", "title": "" }, { "docid": "78110ea6e340bb0c6dd778eb24884345", "score": "0.5503293", "text": "def text_params\n params.require(:text).permit(:title, :body, :description, :collection_id)\n end", "title": "" }, { "docid": "fc10e0cbae3c297b1e9491f565eff280", "score": "0.54959846", "text": "def text_answer_params\n params.require(:text_answer).permit(:title, :body)\n end", "title": "" }, { "docid": "0cf761a557c1584887708bd21262ac98", "score": "0.5493629", "text": "def sentiment_analysis(text)\n RestClient.post \"http://api.datumbox.com/1.0/SentimentAnalysis.json\", :api_key => @api_key, :text => text\n end", "title": "" }, { "docid": "50201fb2c61bc86db04dd304acb44e92", "score": "0.54818094", "text": "def text_params\n params.require(:text).permit(:title, :body)\n end", "title": "" }, { "docid": "59c581fc8de1315e98f729a7fd423f66", "score": "0.5480033", "text": "def subjective_textual_params\n params.require(:subjective_textual).permit(:lesson, :statement, :answer)\n end", "title": "" }, { "docid": "73fbdfea31031916285f993c77e56c3d", "score": "0.5444549", "text": "def answer_params\n params.require(:answer).permit(:text)\n end", "title": "" }, { "docid": "73fbdfea31031916285f993c77e56c3d", "score": "0.5444549", "text": "def answer_params\n params.require(:answer).permit(:text)\n end", "title": "" }, { "docid": "73fbdfea31031916285f993c77e56c3d", "score": "0.5444549", "text": "def answer_params\n params.require(:answer).permit(:text)\n end", "title": "" }, { "docid": "1db16af428bdfd9bdad09f0e77036da3", "score": "0.541797", "text": "def answer_params\n params[:answer].permit(:text)\n end", "title": "" }, { "docid": "1fbe93cf6a11ea45f1335835334bc8fe", "score": "0.54144084", "text": "def create_audio_file(text)\n @speech = Speech.new(text)\n @speech.save(@file_path) # invokes espeak + lame\n end", "title": "" }, { "docid": "702f9ad0f9b81e58618718ae261236e0", "score": "0.5407381", "text": "def create\n @exercise_text = ExerciseText.new(params[:exercise_text])\n\n respond_to do |format|\n if @exercise_text.save\n format.html { redirect_to @exercise_text, notice: 'Exercise text was successfully created.' }\n format.json { render json: @exercise_text, status: :created, location: @exercise_text }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_text.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5017422716b924f1aa58ae40b0012a39", "score": "0.5403206", "text": "def save_participatory_text_meta(form)\n document = ParticipatoryText.find_or_initialize_by(component: form.current_component)\n document.update!(title: form.title, description: form.description)\n end", "title": "" }, { "docid": "3f7e5ce274afe3773e9d160662b5c32d", "score": "0.5388882", "text": "def submission_params\n params.require(:submission).permit(:title, :notecard, \n :vocab_english_1,:vocab_english_2,:vocab_english_3, :vocab_english_4,:vocab_english_5,:vocab_ger_1,:vocab_ger_2,:vocab_ger_3,:vocab_ger_4,:vocab_ger_5, \n :name, :audio, :grade, :assignment_id, :user_id)\n end", "title": "" }, { "docid": "6bb607855b0590cf17977a84eef80155", "score": "0.5386333", "text": "def upload params\n Storage.delete get_session_keys\n words = params['file'][:tempfile].readlines\n words_sorted_by_length = Anagram.sort_by_word_length words\n words_sorted_by_length.each_pair do |word_length, words|\n data_to_store = Anagram.create_anagram_hash words\n Storage.write get_key_for_word_length(word_length), data_to_store\n end\n @session[:uploaded] = true\n end", "title": "" }, { "docid": "86a9a1c11198f5746f6f13d5a600776a", "score": "0.5383712", "text": "def upload_video(client, presentation)\n slides = presentation['slides']\n term = presentation['term']\n definition = presentation['definition']\n video = client.video_upload(\n File.open(presentation['video']),\n :title => \"#{term} - definition\",\n :description => definition,\n :keywords => [term, 'definition'])\n presentation['youtube_video'] = video\n presentation['youtube_id'] = video.unique_id.to_s\n video\nend", "title": "" }, { "docid": "82428bbb9401b940cb532a08a6c26961", "score": "0.5374409", "text": "def post(text, options={})\n expect! text => String\n expect! options => { :object => [nil, Quest] }\n\n Deferred.linkedin(:add_share, self.class.message(text, options[:object]), oauth_hash)\n end", "title": "" }, { "docid": "8506f3aba99306a3ca4c277d8ef07ea0", "score": "0.5341806", "text": "def create\n VoiceTranscription.create!(:content => params[\"TranscriptionText\"])\n render :nothing => true\n end", "title": "" }, { "docid": "381e332d84a328142c38b747cfc16287", "score": "0.53397", "text": "def sentence_params\n params.permit(:content)\n end", "title": "" }, { "docid": "ab42775a02c15e4e48923875970fb487", "score": "0.53384006", "text": "def evidence_params\n params.require(:evidence).permit(:description, :avatar)\n end", "title": "" }, { "docid": "e8f4b03fbdb31fd009f31050d1c53190", "score": "0.5333173", "text": "def command_evidence(peer, session, message)\n\n # get the file size\n size = message.slice!(0..3).unpack('I').first\n\n # send the evidence to the db\n begin\n # store the evidence in the db\n EvidenceManager.instance.store_evidence session, size, message\n\n # remember the statistics for input evidence\n StatsManager.instance.add ev_input: 1, ev_input_size: size\n\n # remember how many evidence were transferred in this session\n session[:count] += 1\n session[:sync_stat].update(size)\n\n total = session[:total] > 0 ? session[:total] : 'unknown'\n trace :info, \"[#{peer}][#{session[:cookie]}] Evidence saved (#{size} bytes) - #{session[:count]} of #{total}\"\n rescue Exception => e\n trace :warn, \"[#{peer}][#{session[:cookie]}] Evidence NOT saved: #{e.message}\"\n return [PROTO_NO].pack('I')\n end\n\n return [PROTO_OK].pack('I') + [0].pack('I')\n end", "title": "" }, { "docid": "957007f155d2ca200308bd40410469f8", "score": "0.5332697", "text": "def edit_text_track track_id, attributes\n perform_patch(\"/videos/#{get_id}/texttrack/#{track_id}\", attributes)\n end", "title": "" }, { "docid": "66db00997a2dca6ffd7674e3eb4ed9c2", "score": "0.5328818", "text": "def upload_nem12\r\n\r\n end", "title": "" }, { "docid": "083d6413ce28bec987888344539f5904", "score": "0.53285885", "text": "def adult_content_detection(text)\n RestClient.post \"http://api.datumbox.com/1.0/AdultContentDetection.json\", :api_key => @api_key, :text => text\n end", "title": "" }, { "docid": "90c780b021128613c6259a539b0f63e2", "score": "0.53246784", "text": "def evidence_params\n params.require(:evidence).permit(:review_id, :image_url, :code, :title, :user_id)\n end", "title": "" }, { "docid": "ea82a61738b7d3bc4e02ec31fa9f16b3", "score": "0.5315377", "text": "def submission_params\n params.permit(:title, :url, :text)\n end", "title": "" }, { "docid": "01a0268bc3b36c3aacebba7391cc80bd", "score": "0.5313287", "text": "def share_sample_text\n dropbox_folder = \"~/Dropbox/text_source\"\n FileUtils.mkdir_p(dropbox_folder) unless File.directory?(dropbox_folder)\n sample_path = path + \"/#{id}_sample.md\"\n create_sample_text unless File.exist?(sample_path)\n system(\"cp #{sample_path} #{dropbox_folder}/\")\n end", "title": "" }, { "docid": "1c7e047249b49006216c58dc2f07b853", "score": "0.5308411", "text": "def text_params\n params.require(:text).permit(:title,:html)\n end", "title": "" }, { "docid": "1b17e453ea687340eccf22d312b213b6", "score": "0.52970076", "text": "def write text, options\n Upload.new(NamedBuffer.new(options[:name], text), options[:to], check_string(text, options[:to]))\n end", "title": "" }, { "docid": "ab7f22dd989a3e5cad048244aa322f60", "score": "0.528579", "text": "def sentence_params\n params.require(:sentence).permit(:text)\n end", "title": "" }, { "docid": "8ad307a744f8878e5f6be6bbaab270c4", "score": "0.52853024", "text": "def handle_text(name, attrs)\n \tsql << \"INSERT INTO articles text VALUES (#{@content})\"\n \tlogger.debug \"Added TEXT to DB\"\n end", "title": "" }, { "docid": "9beb0fe9eaad82645795babd2732daf7", "score": "0.5276513", "text": "def evidence_params\n params.require(:evidence).permit(:title, :description, :number, :file_path, :file_date, :task_id, :evidence_type_id)\n end", "title": "" }, { "docid": "89bf0d7ae09fc769501408c81e28c33f", "score": "0.5275736", "text": "def answer_params\n params.require(:answer).permit(:text, :trainee)\n end", "title": "" }, { "docid": "a8d88c2dca8931e9e5c9c5d0713d87d2", "score": "0.5273078", "text": "def create_from_text\n # check that current user has a local identity\n if current_user.local_identity\n # create the brusefile\n @file = create_file(text_params[\"content\"])\n\n # insert our file on the users local identity\n if current_user.local_identity.bruse_files << @file\n # send response that everything is ok!\n render status: :created\n else\n render status: :internal_server_error\n end\n else\n # no file! not working!\n @file = nil\n render status :not_acceptable\n end\n end", "title": "" }, { "docid": "ae6d4c8f614705a01b72a53aa2798d06", "score": "0.5272662", "text": "def raw_text\n raw_text = File.read(file_name)\n #raw_text = File.read(\"tmp/insert_sexual_lines.txt\")\n #raw_text = File.read(\"tmp/insert_internals_hash.txt\")\n end", "title": "" }, { "docid": "42ace6ede92d93ad37ae9ed25726c091", "score": "0.52528954", "text": "def post_text(text)\n post_message({ :text => text }) if text\n end", "title": "" }, { "docid": "688d99c8efcc46148559bc2e0c04116e", "score": "0.5243519", "text": "def submission_params\n params.require(:submission).permit(:content, :name, :file, :user_id, :contest_id)\n end", "title": "" }, { "docid": "1e11905b42e60205ae04d40575683fab", "score": "0.52430063", "text": "def challenge_params\n params.require(:challenge).permit(:content, :photo, :movie)\n end", "title": "" }, { "docid": "6d6f134986542bf3c076e8eca7e600d6", "score": "0.52419883", "text": "def text_document_params\n params.require(:text_document).permit(:identifierhash, :identifieryaml, :content)\n end", "title": "" }, { "docid": "e87d8bbc063ed1642d0deeda99f28f81", "score": "0.5239594", "text": "def text_track track_id\n perfrom_get(\"/videos/#{get_id}/texttracks/#{track_id}\")\n end", "title": "" }, { "docid": "ac161e791b1dbb1156ce51a8dd4e735e", "score": "0.52272326", "text": "def exercise_params\n params.permit(:title, :text, :file_upload, :batch_id, :category_id)\n end", "title": "" }, { "docid": "bddd6ca2410926df7b539764f90d1aec", "score": "0.5222446", "text": "def content_text_params\n params.require(:content_text).permit(:lesson_id, :name, :content)\n end", "title": "" }, { "docid": "6e143072d6a4ca03bd1f9a252e5ff673", "score": "0.5222199", "text": "def external_song_text_params\n params.require(:external_song_text).permit(:short_desc, :text, :url, :song_id)\n end", "title": "" }, { "docid": "e06eff5f01a704ee028ea212889f8acc", "score": "0.5220341", "text": "def speak_post(format, text, opts = {})\n data, _status_code, _headers = speak_post_with_http_info(format, text, opts)\n data\n end", "title": "" }, { "docid": "7a288d12199e2511c979351fafa8440f", "score": "0.5218969", "text": "def edit\n @text_file = TextFile.find(params[:id])\n user_key = get_phrase_for_encryption @text_file\n if !user_key\n flash.now[:danger] = 'Cannot edit file. Your voice did not match your passphrase, try again.'\n redirect_to user_files_path and return\n else\n @decrypted_title = `lib/assets/python/dec.py '#{@text_file.title}' #{user_key}`\n @decrypted_text = `lib/assets/python/dec.py '#{@text_file.text}' #{user_key}`\n\n puts 'showing title: ' + @decrypted_text\n end\n end", "title": "" }, { "docid": "fbfa0e5758683f51eaf2bcd6e7020c91", "score": "0.52167153", "text": "def insert_text(text, index)\n @context.operations << Operation.new(\n :type => Operation::DOCUMENT_INSERT, \n :blip_id => @id, \n :wavelet_id => @wavelet_id, \n :wave_id => @wave_id,\n :index => index, \n :property => text\n )\n @content = @content ? @content[0, index] + text + @content[index, @content.length - index] : text\n end", "title": "" }, { "docid": "212929d6b298900c074f4a9bd9bac9cf", "score": "0.52146643", "text": "def upload(yaml_path)\n upload_phrases(all_phrases(yaml_path))\n end", "title": "" }, { "docid": "7e6df59e6664233fe17cd53b5d27348e", "score": "0.52140355", "text": "def learn\n\t\tp = Phrase.create({\n\t\t\t:phrase => params[:phrase],\n\t\t\t:label => params[:label],\n\t\t\t:voice => params[:voice]\n\t\t})\n\t\tredirect_to '/'\n\tend", "title": "" }, { "docid": "ba75f25a6404c8a4c32f3cd08d0dd5d2", "score": "0.521334", "text": "def text_attachment_params\n\t\t\t\t\t\tparams.require(:text_attachment).permit(:file)\n\t\t\t\t\tend", "title": "" }, { "docid": "a20924f51da362cab37aa28f0d4e8aa4", "score": "0.5207795", "text": "def save_upload\n @content = Content.find(params[:id])\n case @content.type when \"Assessment\"\n @content.update_attributes(params[:assessment])\n when \"Chapter\"\n @content.update_attributes(params[:chapter])\n when \"Topic\"\n @content.update_attributes(params[:Topic])\n when \"SubTopic\"\n @content.update_attributes(params[:SubTopic])\n when \"AssessmentHomeWork\"\n @content.update_attributes(params[:AssessmentHomeWork])\n else\n @content.update_attributes(params[\":\"[email protected]])\n end\n @message = params[:message][:message]\n # assessment creation for first time i.e create and publish now options\n if @content.type.eql?(\"Assessment\") and @content.test_configurations.size !=0 and @content.test_configurations.first.status == 20\n logger.info \"=========================works\"\n @content.test_configurations.first.subject = params[:message][:subject]\n @content.test_configurations.first.publish_and_send_message\n else\n @content.update_attribute(:status,6)\n end\n if @content.type == \"Assessment\" or @content.type == \"AssessmentHomeWork\"\n user = @content.asset.user\n else\n user = @content.assets.first.user\n end\n #Content.send_message_to_est(user,current_user,@content)\n Content.send_message_to_teacher(user,current_user,@content,@message)\n redirect_to contents_path\n end", "title": "" }, { "docid": "412653e6fdfe27aa5c2418f2e094a63c", "score": "0.5203572", "text": "def create\n @answer_text = AnswerText.new(answer_text_params)\n\n respond_to do |format|\n if @answer_text.save\n format.html { redirect_to @answer_text, notice: 'Answer text was successfully created.' }\n format.json { render :show, status: :created, location: @answer_text }\n else\n format.html { render :new }\n format.json { render json: @answer_text.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7c435462f72f496d39387a6a2dff8ee6", "score": "0.5200226", "text": "def add_text(text); end", "title": "" }, { "docid": "7c435462f72f496d39387a6a2dff8ee6", "score": "0.5200226", "text": "def add_text(text); end", "title": "" }, { "docid": "7c435462f72f496d39387a6a2dff8ee6", "score": "0.5200226", "text": "def add_text(text); end", "title": "" }, { "docid": "d58bf4081bb5da59a8a0152915dfc96a", "score": "0.51970714", "text": "def create\n @waiver_text = WaiverText.new(waiver_text_params)\n\n respond_to do |format|\n if @waiver_text.save\n format.html { redirect_to waiver_texts_path, notice: 'Waiver text was successfully created.' }\n format.json { render :show, status: :created, location: @waiver_text }\n else\n format.html { render :new }\n format.json { render json: @waiver_text.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4ef8b8fd39d91da5142a88898c7df1ec", "score": "0.51863104", "text": "def twitter_sentiment_analysis(text)\n RestClient.post \"http://api.datumbox.com/1.0/TwitterSentimentAnalysis.json\", :api_key => @api_key, :text => text\n end", "title": "" }, { "docid": "f853f95eeb0ba0603a8d2da6ba07078b", "score": "0.5184644", "text": "def upload_text\n texts = params[:text]\n str_arr = texts.split(LINE_FEED_SYMBOL) unless texts.nil?\n @result = []\n has_err = false\n unless str_arr.empty?\n str_arr.each do |str|\n array_current_text = str.split(TAB_SYMBOL) unless str.nil?\n if array_current_text.length == 2\n text_obj = ClipTextInput.new(title1: array_current_text[0],\n content: array_current_text[1])\n result_title = if text_obj.valid_regex?(text_obj.title1, ClipTextInput::ACCEPTED_CHARS) &&\n text_obj.count_char(text_obj.title1, ClipTextInput::TITLE_SIZE) == true\n CORRECT_SYMBOL\n else\n error_content = ''\n if (over_max = text_obj.count_char(text_obj.title1, ClipTextInput::TITLE_SIZE)) != true\n error_content += over_max.to_s + '文字オーバー'\n end\n unless text_obj.valid_regex?(text_obj.title1, ClipTextInput::ACCEPTED_CHARS)\n error_content += ',' if error_content.length > 0\n error_content += '不可記号'\n end\n error_content\n end\n result_content = if text_obj.valid_regex?(text_obj.content, ClipTextInput::ACCEPTED_CHARS) &&\n text_obj.count_char(text_obj.content, ClipTextInput::CONTENT_SIZE) == true\n CORRECT_SYMBOL\n else\n error_content = ''\n if (over_max = text_obj.count_char(text_obj.title1, ClipTextInput::TITLE_SIZE)) != true\n error_content += over_max.to_s + '文字オーバー'\n end\n unless text_obj.valid_regex?(text_obj.title1, ClipTextInput::ACCEPTED_CHARS)\n error_content += ',' if error_content.length > 0\n error_content += '不可記号'\n end\n error_content\n end\n text_obj.resultTitle1 = result_title\n text_obj.resultContent = result_content\n @result.push(text_obj)\n else\n has_err = true\n end\n end\n end\n respond_to do |format|\n if has_err\n format.json { render json: { has_err: true, message: 'タブ区切りのテキストを入力してください' } }\n end\n format.json { render json: @result }\n end\n end", "title": "" }, { "docid": "90042a5dbc3d1a8aee495bd7c39d2518", "score": "0.5179899", "text": "def spam_detection(text)\n RestClient.post \"http://api.datumbox.com/1.0/SpamDetection.json\", :api_key => @api_key, :text => text\n end", "title": "" }, { "docid": "7a75886caa5891f35e601516d41b1fa1", "score": "0.51789457", "text": "def deposit_submission_documentation(text)\n # the text should be written to @dir_aip/metadata/submissionDocumentation/readme.txt\n # according to https://www.archivematica.org/en/docs/archivematica-1.4/user-manual/transfer/transfer/#create-submission\n target_dir = File.join(@dir_aip, \"metadata\", \"submissionDocumentation\")\n target_file = File.join(target_dir, \"readme.txt\")\n FileUtils.mkdir_p(target_dir)\n File.open(target_file, \"w\") do |output|\n output.write text\n end\n end", "title": "" }, { "docid": "ffb56494cd060c85426ba7aaa786a146", "score": "0.5178232", "text": "def create_return_english_objectivity_multipart_form text\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/objectivity\"\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"APIMATIC 2.0\",\r\n \"accept\" => \"application/json\",\r\n \"X-Mashape-Key\" => @x_mashape_key\r\n }\r\n\r\n # prepare parameters\r\n parameters = {\r\n \"text\" => text\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.post query_url, headers:headers, parameters:parameters\r\n\r\n #Error handling using HTTP status codes\r\n if !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "title": "" }, { "docid": "7bfe9e67c750dc9ad8bfa859df92e9a1", "score": "0.51761097", "text": "def post_params\n params.require(:post).permit(:text)\n end", "title": "" }, { "docid": "42369db947a0ac07bd6a10a66aa0dc84", "score": "0.5170754", "text": "def volun_text_params\n params.require(:volun_text).permit(:title, :body)\n end", "title": "" }, { "docid": "843cb3abb845ce1d8bac750696a72733", "score": "0.51672965", "text": "def question_params\n params.require(:question).permit(:text)\n end", "title": "" }, { "docid": "843cb3abb845ce1d8bac750696a72733", "score": "0.51672965", "text": "def question_params\n params.require(:question).permit(:text)\n end", "title": "" }, { "docid": "dc73308a4a604176f5d7a65a99038534", "score": "0.516586", "text": "def answer_new(text, postid, userid)\n db = connect_to_db()\n db.execute(\"INSERT INTO Answer (Text, Userid, Postid) VALUES (?,?,?)\", text, userid, postid)\n end", "title": "" }, { "docid": "ef29addc6f926d217fdce9919e133997", "score": "0.5164685", "text": "def update_text(id, data)\n put \"texts/#{id}\", data\n end", "title": "" }, { "docid": "26d39bcf1bfd799b16acc5efc05609fd", "score": "0.51592445", "text": "def text_question_params\n params.require(:text_question).permit(:title, :body)\n end", "title": "" }, { "docid": "8f68ff15100ae7673de9245f92e51c0e", "score": "0.51576865", "text": "def set_params\n params.require(:challenge).permit(:title, :description, :user_id)\n end", "title": "" }, { "docid": "c0b68ede1c273eb5fc210025106a4bcd", "score": "0.51552755", "text": "def add_text(src, text)\n not_implemented\n end", "title": "" }, { "docid": "c0b68ede1c273eb5fc210025106a4bcd", "score": "0.51552755", "text": "def add_text(src, text)\n not_implemented\n end", "title": "" }, { "docid": "96ac2566118ed20ad37816835c88ece1", "score": "0.5153892", "text": "def mad_lib_params\n params.permit(:text)\n end", "title": "" }, { "docid": "fea7ee0059750528308980ff664dae7b", "score": "0.51531243", "text": "def body_text_params\n params.require(:body_text).permit(:content, :paper_id, :sequence)\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "5ce90b0bd0e20701e1a33e2ea561906c", "score": "0.0", "text": "def user_params\n params.require(:user).permit(\n :name,\n :email,\n :password,\n :avatar,\n :password_confirmation,\n :search,\n roles_attributes: %i[permission id]\n )\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": "" } ]
f26f3442eb6af3f1781172748843557a
get index in internal list of current player
[ { "docid": "70c6bf1abfead92d563fbafe8b28bcce", "score": "0.84717065", "text": "def list_index_of(player)\n (@list.index(player)+1) % @list.count\n end", "title": "" } ]
[ { "docid": "541de2d18eb53e1088f088f08e5e025c", "score": "0.71985954", "text": "def player_last_index(index = 0)\n temp_id = self.last_registered_player_id\n if temp_id == -1 || temp_id == nil\n #if no one is signed up\n return nil\n elsif index > self.roster_count - 1\n #if trying to find a nonexistent index\n return nil\n else\n count = 0\n while count < index\n next_id = Player.find(temp_id).prev_player_id\n if next_id == -1\n break\n end\n temp_id = next_id\n count += 1\n end\n return Player.find(temp_id)\n end\n end", "title": "" }, { "docid": "b6ed38087ea3e7263ed8d978d4dec820", "score": "0.7145078", "text": "def next_player_index(current_index)\n (current_index + 1) % num_players\n end", "title": "" }, { "docid": "5b7bc61bd584ae4a2b433bf233aeb4e6", "score": "0.71122307", "text": "def player_relative_to(player, index)\n current = players.index(player)\n players.fetch((current + index) % players.size)\n end", "title": "" }, { "docid": "604722e2d76c8d8edfa111422ce47a51", "score": "0.68651843", "text": "def player_ix_beforethis(num_players, ix_player)\n ix_res = ix_player - 1\n if ix_res < 0\n ix_res = num_players - 1\n end\n return ix_res\n end", "title": "" }, { "docid": "38de2237613499fa419cc0a11f59011b", "score": "0.68484956", "text": "def player_index\n\t\t\[email protected]_index do |row|\n\t\t\t\t@grid[row].each_index do |col|\n\t\t\t\t\tif @grid[row][col].respond_to?(:resident) && Person === @grid[row][col].resident\n\t\t\t\t\t\treturn [row, col]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tnil\n\t\tend", "title": "" }, { "docid": "0d16a783771f6609818d9c58ce9bae04", "score": "0.6816863", "text": "def player_ix_afterthis(num_players, ix_player)\n ix_res = ix_player + 1\n if ix_res >= num_players\n ix_res = 0\n end\n return ix_res\n end", "title": "" }, { "docid": "81634aebcfc077c89fae1a73e602f45f", "score": "0.67961484", "text": "def current_player\n @players.first\n end", "title": "" }, { "docid": "dc6cf41aed0b84ab1b26379c1ddc02f9", "score": "0.67835367", "text": "def getPlayer(playerIndex)\n\t\treturn @players[playerIndex]\n\tend", "title": "" }, { "docid": "c6afb72a49e27521adcd0b628eb00717", "score": "0.6780241", "text": "def current_player\n @players[@turn%2]\n end", "title": "" }, { "docid": "ccacd7391edd19614e6ada78c9c35444", "score": "0.67776877", "text": "def next\n index = @@list.index(self)\n if (!index)\n raise \"ERROR: Can't find given player\"\n end\n\n return index + 1 < @@list.length ? @@list[index + 1] : @@list[0]\n end", "title": "" }, { "docid": "6e81d0ff789e19f289572b389adecc73", "score": "0.6760368", "text": "def increment_player_idx\n @current_player_idx = (@current_player_idx + 1) % 2\n end", "title": "" }, { "docid": "ae71f4e5479d299201c92103dc3ccd55", "score": "0.67573124", "text": "def get_curr_player \n current_player = @player_arr.first()\n return current_player\n end", "title": "" }, { "docid": "bb24a303475e9c3596d906af0ec39bdd", "score": "0.6745101", "text": "def current_player\n @players.first\n end", "title": "" }, { "docid": "46e153b9c738ad7fe4c8f85a6fcefb66", "score": "0.67440075", "text": "def current_player\n @players.first\n end", "title": "" }, { "docid": "96775272ae227acb8fd005ec43163db7", "score": "0.67381334", "text": "def player_position(name)\n @players_info[name][0]\n end", "title": "" }, { "docid": "aa6d279edb4e0ce92f724a1818266f4a", "score": "0.672079", "text": "def index\r\n return $game_party.actors.index(self)\r\n end", "title": "" }, { "docid": "17b97cd977253c239e95d30e2d1882c2", "score": "0.67162365", "text": "def current_player\n players.first\n end", "title": "" }, { "docid": "4da973f0512136e4fe95d745803e4ae7", "score": "0.66597384", "text": "def current\n self.players[self.current_turn]\n end", "title": "" }, { "docid": "df2cc3b89a6a666f8edd5b66e347385f", "score": "0.6652286", "text": "def find_playlist_by_name name\n @playlists.each do |playlist|\n return playlist.index if name == playlist.name\n end\n end", "title": "" }, { "docid": "5e3c240feb28f892a7ddbee1d001bd26", "score": "0.6551058", "text": "def input_to_index(player_input)\n return player_input.to_i - 1\nend", "title": "" }, { "docid": "cec4d80f759bb1311ae9273c8bfbe1f6", "score": "0.6513365", "text": "def party_index\n $game_party.all_members.index(self)\n end", "title": "" }, { "docid": "458ebd6c6db2b7d6eb6e5ce9347edd64", "score": "0.6504487", "text": "def player_position(player)\n\t\[email protected]?(player) ? @seats.index(player) : false\n\tend", "title": "" }, { "docid": "a7752658403391a27b6ebe9ae1447a0e", "score": "0.6397335", "text": "def current_player\n @players.each do |name, letter|\n if letter == whose_turn\n return name\n end\n end\n end", "title": "" }, { "docid": "9872e4e668ffaaee930afb8d3d41841c", "score": "0.6388886", "text": "def get(index)\n @list[index] || -1\n end", "title": "" }, { "docid": "80762244c924dd6070ee9e895ac54d3c", "score": "0.6367979", "text": "def player_input_to_index(user_input)\n user_input.to_i - 1\nend", "title": "" }, { "docid": "186b0476d11125f40598535205e885ef", "score": "0.63662297", "text": "def position_result\n hurdle_match.rank.index(self) + 1\n end", "title": "" }, { "docid": "c443d85d765039d88eb48454f5c200eb", "score": "0.6340209", "text": "def next_player\n @current_player_index += 1\n @current_player_index %= 2\n end", "title": "" }, { "docid": "74c03bd727653450c4580111fd0f4331", "score": "0.6286705", "text": "def index_of( item )\n max = self.get_length\n counter = 1\n while( counter <= max )\n if( get(counter) == item)\n return counter\n end\n counter = counter + 1\n end\n return nil\n end", "title": "" }, { "docid": "e3578d34a112ac13e5a9c72af42c0472", "score": "0.6271938", "text": "def current_turn()\n @players[@turn]\n end", "title": "" }, { "docid": "1ff88bbd96a30b1c63fdf8eef6fffae0", "score": "0.6261531", "text": "def position\n\t\t\treturn 0 if self.button == self.acting_seat\n\t\t\tspots = 1\n\t\t\tcurrent_spot = self.acting_seat - 1\n\t\t\tself.number_of_players_in_hand.size.times do\n\t\t\t\tcurrent_spot = @state_hash['state']['players'].size - 1 if current_spot < 0\n\t\t\t\treturn spots if current_spot == self.acting_seat\n\t\t\t\tspots += 1 if still_in_hand?(@state_hash['state']['players'][current_spot]['id'])\n\t\t\t\tcurrent_spot -= 1\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "1ff88bbd96a30b1c63fdf8eef6fffae0", "score": "0.6261531", "text": "def position\n\t\t\treturn 0 if self.button == self.acting_seat\n\t\t\tspots = 1\n\t\t\tcurrent_spot = self.acting_seat - 1\n\t\t\tself.number_of_players_in_hand.size.times do\n\t\t\t\tcurrent_spot = @state_hash['state']['players'].size - 1 if current_spot < 0\n\t\t\t\treturn spots if current_spot == self.acting_seat\n\t\t\t\tspots += 1 if still_in_hand?(@state_hash['state']['players'][current_spot]['id'])\n\t\t\t\tcurrent_spot -= 1\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "2e1ac3c0a2c142cdc9e346fd4c8fccb8", "score": "0.6253256", "text": "def ranking\n Player.order('rating DESC').select(:id).map(&:id).index(self.id) + 1\n end", "title": "" }, { "docid": "8bc813533b3fc3e27d8be1a59c065150", "score": "0.625115", "text": "def current_idx\n return @idx >= 0 ? @idx : nil\n end", "title": "" }, { "docid": "d6d62bdde886cd480c54c16eb0e1a4ab", "score": "0.62499696", "text": "def to_player_number(symbol)\n PLAYER_SYMBOLS.index(symbol) + 1\n end", "title": "" }, { "docid": "ffef2574f7316ed7ffdbef3097ea50a3", "score": "0.62280244", "text": "def check_current_player\n @current_player += 1\n @current_player = 0 if @current_player == @players.length\n puts \"Player is now #{@players[@current_player]}\"\n @current_player\n end", "title": "" }, { "docid": "9d7f7251820d26cb249ca40e4a9ec420", "score": "0.6211074", "text": "def input_to_index(player_move)\n input = player_move.to_i\n final_move = input - 1\nend", "title": "" }, { "docid": "9cbd206964dab829590c27ec94f8865c", "score": "0.62035996", "text": "def get_next_index(current_index, direction, num_players)\n\t\tif direction == true\n\t\t\tif current_index == num_players - 1\n\t\t\t\t0\n\t\t\telse\n\t\t\t\tcurrent_index += 1\n\t\t\tend\n\t\telse\n\t\t\tif current_index == 0\n\t\t\t\tnum_players - 1\n\t\t\telse\n\t\t\t\tcurrent_index -= 1\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "bc5bd1eff6f34e57de5f7644d019a9a0", "score": "0.6165553", "text": "def pokemon_index(method_name, *args)\n index = $game_variables[Yuki::Var::Party_Menu_Sel].to_i\n index = party.send(method_name, *args) if index < 0\n return index\n end", "title": "" }, { "docid": "6c01739a5f36583fe4e00bbd4813deef", "score": "0.6154802", "text": "def get_item(index)\r\n @list[index]\r\n end", "title": "" }, { "docid": "dbb274d3d2bffdfcc7f05ae589b925d1", "score": "0.6149548", "text": "def initialize\n @currentPlayerIndex = -1;\n\n\n end", "title": "" }, { "docid": "18e307dfce1c143854c504a10200bf0b", "score": "0.61464155", "text": "def play_order_index\n @ole.PlayOrderIndex\n end", "title": "" }, { "docid": "90346156f859001b703f1268cb4f8981", "score": "0.6143019", "text": "def my_index(arg)\n self.each_with_index do |ele,idx|\n if ele == arg\n return idx\n end\n end\n return nil\n end", "title": "" }, { "docid": "1d9c39b6e3ae66e53de2f0ad755c4401", "score": "0.61227095", "text": "def ranking\n Player.order('rating DESC').select(:id).map(&:id).index(id) + 1\n end", "title": "" }, { "docid": "38acef99982a59e33fff2692c930ce81", "score": "0.6122111", "text": "def current_list\n @lists[@list_index - 1]\n end", "title": "" }, { "docid": "275ab324ff36e4174099fd981b913a6c", "score": "0.6098171", "text": "def switch_players\n @current_player_index += 1\n @current_player_index = 0 if @current_player_index >= @num_players\n @players[@current_player_index]\n end", "title": "" }, { "docid": "ddcf1f776eb91cd51db3d14498edf689", "score": "0.6093152", "text": "def current_value\n @list[@current_index]\n end", "title": "" }, { "docid": "ddcf1f776eb91cd51db3d14498edf689", "score": "0.6093152", "text": "def current_value\n @list[@current_index]\n end", "title": "" }, { "docid": "38e5f20ccf728fe6b90c2ad385d25e7f", "score": "0.60895044", "text": "def acting_player\n return parent.state.current_player unless parent.nil?\n -1\n end", "title": "" }, { "docid": "bc9a022c98489b0fd32c5060b622347a", "score": "0.6088237", "text": "def player_position\n @ole.PlayerPosition\n end", "title": "" }, { "docid": "6b9155a03d13c5f48e853f82c25fc99b", "score": "0.60846597", "text": "def next_player\n\t\tvar = -1\n\t\tvar = 1 if self.flowing_right\n\t\tplayers_remaining = self.players_remaining\n\t\tlast_turn = self.turns.last\n\t\tplayers_remaining[(players_remaining.index(last_turn.player) + var) % players_remaining.size]\n\tend", "title": "" }, { "docid": "f0ec0ccea2d820fe24a6c8159ddfc9f1", "score": "0.6078065", "text": "def index\n history = File.open(@current)\n line = history.readline.rstrip\n line =~ /(\\d+)$/ # get the index\n $1.to_i\n end", "title": "" }, { "docid": "8340fb10f80a101d4538b9827d99149f", "score": "0.6062512", "text": "def get_position (item)\r\n position = 0\r\n self.items.each_with_index {|val, index|\r\n if (val.get_name == item.get_name)\r\n position = index\r\n end\r\n }\r\n return position\r\n end", "title": "" }, { "docid": "1d9c58d4b56e6995171febcee5e1873d", "score": "0.6050928", "text": "def position\n teachable.media.where(sort: sort).order(:id).pluck(:id).index(id) + 1\n end", "title": "" }, { "docid": "fca4f2ffc660bdc29ea57ca67ea8d43f", "score": "0.6046626", "text": "def next_player\n if @switch.next != nil\n @current_player = @switch.next\n else\n @current_player = @switch.first\n end\n # @current_player = @lives.each.next\n # @current_player = @lives.map.with_index {|(name,lives),index| index += 1 } #should be equal to the next key value pair in the hash\nend", "title": "" }, { "docid": "727c4c3a182775afe692514ae93474a3", "score": "0.6041722", "text": "def number( gm )\n num = nil\n gm.players.each_with_index{|pl, i| num = i if (pl == self) }\n (num + 1) if num.is_a? Integer\n end", "title": "" }, { "docid": "33707e9596bedf5153013f443c79f801", "score": "0.60399216", "text": "def current_player\n x_count = self.board.cells.count {|token| token == \"X\"}\n o_count = self.board.cells.count {|token| token == \"O\"}\n if (x_count + o_count).even?\n player_1\n elsif (x_count + o_count).odd?\n player_2\n end\n end", "title": "" }, { "docid": "add46aaf49dfb0c335f7052deba3922c", "score": "0.60314363", "text": "def check_winner\n count = 0\n index = -1\n 0.upto(3) {|i|\n if @playing[i] \n if @score[i] == 0 and @started[i]\n @playing[i] = false\n @players.delete_if { |p| p.id == i} \n else\n count += 1\n index = i\n end\n end \n }\n @winner = index if count < 2 \n return count < 2 ? index : -1\n end", "title": "" }, { "docid": "c303d4cdb779d01a93a5893913af1ff7", "score": "0.60087705", "text": "def get_index(i)\n\t\tif (!@head || @size < i+1)then return false end\n\t\tcurrent = this.head\n\t\tcount = 0\n\t\twhile (count < i) #go to the index\n\t\t\tcurrent = current.get_next()\n\t\t\tcount+=1\n\t\tend\n\t\treturn current.get_item()\n\tend", "title": "" }, { "docid": "2dc0f309003bb604123c9291d28c2f03", "score": "0.6004902", "text": "def select_position\n @players = @game.players\n end", "title": "" }, { "docid": "4c16bff6656f9a457e879885cdb222cc", "score": "0.60006243", "text": "def next_player\n current_player == 1 ? 2 : 1\n end", "title": "" }, { "docid": "e0d332ed14d37cf934ff5edcfd132cf6", "score": "0.59850365", "text": "def index(list, item, &block)\r\n\t\ti = bisect_left(list, item, &block)\r\n\t\treturn list[i] == item ? i : nil\r\n\tend", "title": "" }, { "docid": "0410a756b084984e0c32ec3fcc2e1aa4", "score": "0.5962498", "text": "def player\n return $BlizzABS.actors[0]\n end", "title": "" }, { "docid": "db4de882d742115c0caa4b0593a90e06", "score": "0.59592575", "text": "def index\r\n @index ||= 0\r\n end", "title": "" }, { "docid": "477d1137782518850452f87bba802c87", "score": "0.5939875", "text": "def current_player(board)\n return [\"X\", \"O\"][turn_count(board) % 2]\nend", "title": "" }, { "docid": "68487e380352f71bfe8fdd29cb9e5091", "score": "0.5939528", "text": "def get_rank(player, index)\n player.deck.rank_of_card_at(index)\n end", "title": "" }, { "docid": "a3249e627af4bfc7a356bb27a595ed9d", "score": "0.5937443", "text": "def getidx( layer )\n if ( index = @list.index( layer ) )\n index\n else\n @list.push( layer )\n @list.length-1\n end\n end", "title": "" }, { "docid": "5587909c866afdf8b2a325a6fc2ff120", "score": "0.5935587", "text": "def index\n @players = @game.players\n end", "title": "" }, { "docid": "5587909c866afdf8b2a325a6fc2ff120", "score": "0.5935587", "text": "def index\n @players = @game.players\n end", "title": "" }, { "docid": "a91e84818b91de023df7c51aaaaffaea", "score": "0.5927956", "text": "def index\n $game_party.positions.index(@actor_id)\n end", "title": "" }, { "docid": "4a36048a722dc06ac65956ff509dd755", "score": "0.59234065", "text": "def player(player_name)\n players.find{|player| player.name == player_name}\n end", "title": "" }, { "docid": "4fd8972b5dd4d7af299208cd8ff98808", "score": "0.5921346", "text": "def get_next_player(player)\n \tresult = player\n \tif (not self.players.nil?) and (not self.players.empty?)\n \t\tif self.players.first == player\n \t\t\tresult = self.players.last\n \t\telse\n \t\t\tresult = self.players.first\n \t\tend\n \tend\n send_update\n \treturn result\n end", "title": "" }, { "docid": "1f0d8c28bcf4bbe0151313b6c1fece01", "score": "0.59208554", "text": "def screen_z\n return @member_index + 1\nend", "title": "" }, { "docid": "b24deb568534736bd337166e40cdd51f", "score": "0.59199727", "text": "def index_of_card(id)\n cards.find_index(find_card(id))\n end", "title": "" }, { "docid": "6a88744ed49531c122c59d5c23b325dc", "score": "0.5917566", "text": "def screen_z\n # ??????????? Z ?????????\n if self.index != nil\n return self.index\n else\n return 0\n end\nend", "title": "" }, { "docid": "76fc6d2b6a16426efb206a1a977e4492", "score": "0.5898087", "text": "def suit_index\n return nil unless self.suit\n SUITS.index(self.suit.downcase)\n end", "title": "" }, { "docid": "6a94337f9759574afe58c36b1694b64a", "score": "0.5892026", "text": "def current_data\r\n index >= 0 ? @list[index] : nil\r\n end", "title": "" }, { "docid": "5b55dc154d5b1721183369cbfb3289b1", "score": "0.5882906", "text": "def serialize_to_board_json\n @game.players.index(self)\n end", "title": "" }, { "docid": "1c5db9c0d8c3378f6ece8fc75a24fa75", "score": "0.58753616", "text": "def player1\n @players.first\n end", "title": "" }, { "docid": "247ae505c93a4ad70f16359c6b9ec546", "score": "0.58740675", "text": "def view_position\n @player.position\n end", "title": "" }, { "docid": "3ac8ff557ff02336b5b50e8496c243e3", "score": "0.5872917", "text": "def find_winner\n\t\t@counter = 0\n\t\[email protected] do |player|\n\t\t\tif player.points > @winning\n\t\t\t\t@winner = @counter + 1\n\t\t\tend\n\t\t\t@counter += 1\n\t\tend\n\t\treturn @winner\n\tend", "title": "" }, { "docid": "616be6bc5c09eb04c01245f001651828", "score": "0.58727044", "text": "def current_player\n if board.turn_count.odd?\n player_2\n elsif board.turn_count.even?\n player_1\n end\n end", "title": "" }, { "docid": "e37dd8af1c63ae8beb404a0db134ab82", "score": "0.5872513", "text": "def previous_player\n players.last\n end", "title": "" }, { "docid": "2880f2014b5630991bc5561b1ae954b0", "score": "0.58708495", "text": "def determine_starting_player\n @current_player_index = rand(0..num_players - 1)\n puts \"Looks like #{@players[@current_player_index].name} will be going first!\"\n @players[@current_player_index]\n end", "title": "" }, { "docid": "05200112dddd33d91925b0da88f687fa", "score": "0.5865031", "text": "def winners(i)\n\t\t@winners[i]\n\tend", "title": "" }, { "docid": "4b6e89344842c1b72d3144d7ba52407e", "score": "0.58600396", "text": "def current_player\n if @board.turn_count.even?\n @player_1\n else\n @player_2\n end\n end", "title": "" }, { "docid": "9bac4e8806c2ed1e50e26058178bc048", "score": "0.5859283", "text": "def get_item(list_item_idx)\n @list[list_item_idx]\n end", "title": "" }, { "docid": "d9dc5f0014925262d390bdf4d80ae232", "score": "0.58568203", "text": "def get_next_player(start)\n for i in 1..10\n to_check = (start + i)%10 + 10\n if self.players.where(:location => to_check).length == 1\n player = self.players.where(:location => to_check)[0]\n if player.in_hand\n return player.location\n end\n end\n end\n return -10\n end", "title": "" }, { "docid": "27a1820ba83085830286c2797c5fba9d", "score": "0.5852993", "text": "def getCurrentPlayer() # : Player\n @currentPlayer\n end", "title": "" }, { "docid": "c775d187b5946f67a5701f42ebf4f952", "score": "0.585189", "text": "def subgame(index)\n self.board_state[index]\n end", "title": "" }, { "docid": "a2249536003d172b50469cd41d61e692", "score": "0.5849219", "text": "def index\n @players = Player.order(:id)\n end", "title": "" }, { "docid": "917763b47e30eb933ccce4045ce8f18e", "score": "0.5846423", "text": "def current_symbol\n if current_player < 1 || current_player > 2\n raise \"Impossible value for current_player #{current_player}\"\n end\n return PLAYER_SYMBOLS[current_player - 1]\n end", "title": "" }, { "docid": "29ff72fd61e075a7e452faf0fec7acef", "score": "0.58418065", "text": "def get index\n @letters[index]\n end", "title": "" }, { "docid": "91174705b2dc3ddd66eca77605838d00", "score": "0.5840711", "text": "def last_position\n self.players.maximum(:position)\n end", "title": "" }, { "docid": "2b17da0f9895d811c4e23dbfaa77188b", "score": "0.5840296", "text": "def current_player\n @board.turn_count % 2 == 0 ? @player_1 : @player_2\n end", "title": "" }, { "docid": "2b17da0f9895d811c4e23dbfaa77188b", "score": "0.5840296", "text": "def current_player\n @board.turn_count % 2 == 0 ? @player_1 : @player_2\n end", "title": "" }, { "docid": "2b17da0f9895d811c4e23dbfaa77188b", "score": "0.5840296", "text": "def current_player\n @board.turn_count % 2 == 0 ? @player_1 : @player_2\n end", "title": "" }, { "docid": "2b17da0f9895d811c4e23dbfaa77188b", "score": "0.5840296", "text": "def current_player\n @board.turn_count % 2 == 0 ? @player_1 : @player_2\n end", "title": "" }, { "docid": "0c8941b71f454692e576f4eee7ec4ba3", "score": "0.5835957", "text": "def player\n\t\t@current_player\n\tend", "title": "" }, { "docid": "6a5467f2462cb00d96fa406bb49701a8", "score": "0.58352196", "text": "def next_player\n return self.player_1_id if board.next_player == :player_1\n self.player_2_id\n end", "title": "" }, { "docid": "ea3e365735bc99d6358bf0d689ffb048", "score": "0.582913", "text": "def index_of_11\n cards.index { |card| card[:points] == 11 }\n end", "title": "" } ]
9a3abe62965d7b70ee364a1444edd51d
Test if the submission has been denied. (moderation flag is false)
[ { "docid": "e88be9c7d117c1d838ddbc9dfc342d00", "score": "0.81352735", "text": "def is_denied?\n (moderation_flag == false) ? true : false\n end", "title": "" } ]
[ { "docid": "8b131b547d93115ff3ba172c7162c30e", "score": "0.7926395", "text": "def is_denied?\n return false if moderation_flag || moderation_flag == nil\n true\n end", "title": "" }, { "docid": "0c139f1cd878c164f3816036d044e693", "score": "0.7004931", "text": "def deny()\n if update_attributes({:level => Membership::LEVELS[:denied]})\n true\n else\n reload\n false\n end\n end", "title": "" }, { "docid": "099bdc5ea5f303a26b6c45dd81ace173", "score": "0.6978068", "text": "def is_denied?\n level == Membership::LEVELS[:denied]\n end", "title": "" }, { "docid": "58426e9286cbba74212febe0bed6e55a", "score": "0.69043285", "text": "def not_approved?\n self.moderation_status != 'approved'\n end", "title": "" }, { "docid": "008a33ad30828735a743887c0d5e2bdd", "score": "0.6894192", "text": "def denied?\n return (self.status == STATUS_DENIED)\n end", "title": "" }, { "docid": "7753abfa3b9af42e0f0d175d60e172ac", "score": "0.6808161", "text": "def can_submit\n redirect_to problem_path(@problem) and return if @no_new_submission\n if current_user.sk.submissions.where(:problem => @problem, :status => [:draft, :waiting]).count > 0\n redirect_to problem_path(@problem) and return\n end\n end", "title": "" }, { "docid": "67a3520ab6d9bf97ed218cae1d30d0fb", "score": "0.67658633", "text": "def should_mail_submission_message? # -> email rejection message\n self.authorized == false && (self.message_sent == false && !self.message.blank?)\n end", "title": "" }, { "docid": "5b1e04451d94b4cddf81b37eda19e7f1", "score": "0.6765255", "text": "def denied\n end", "title": "" }, { "docid": "67dc3b52a51dac2000645a7a89730315", "score": "0.673371", "text": "def cannot_edit(_t)\n !session[:is_administrator] && !_t.approver_id.blank?\n end", "title": "" }, { "docid": "60642c2e477f5bc989a0675f41724b19", "score": "0.6724774", "text": "def disallow_teaching_staff_force_submit_assessment_submissions\n cannot :force_submit_assessment_submission, Course::Assessment\n end", "title": "" }, { "docid": "c28bcb40489cf1fe52a4ef94cd407036", "score": "0.67001545", "text": "def check_requester(submission_id)\n if(!Submission.find(submission_id).submitted_by_user?(current_user.id) && !current_user.is_admin?)\n unauthorized_request\n end\n end", "title": "" }, { "docid": "94b4e9e6c19875bbe73abe3af4dfbd25", "score": "0.6673306", "text": "def no_request?\n if self.submission\n return false\n else\n return true\n end\n end", "title": "" }, { "docid": "19c97a283bc32448832979f69ff42b96", "score": "0.6650024", "text": "def denied\n return @denied\n end", "title": "" }, { "docid": "40de7c8643ffba50ded240f859c46f62", "score": "0.6576817", "text": "def disallow_teaching_staff_publish_assessment_submission_grades\n cannot :publish_grades, Course::Assessment\n end", "title": "" }, { "docid": "42b8757d935599527060f36adfd3309b", "score": "0.65750736", "text": "def charge_privileges_denied?\n parse_fixed_boolean 0\n end", "title": "" }, { "docid": "7506e8d269bb22b48bc478a16ba72098", "score": "0.65627086", "text": "def forbidden?\n @forbidden\n end", "title": "" }, { "docid": "ac898e821257f86ae2a744bc864afa78", "score": "0.6549942", "text": "def cannot_edit(_offer)\n !session[:is_administrator] && _offer.unbilled_balance <= 0\n end", "title": "" }, { "docid": "b4c267d6d3d1e923fb6a5e110ccf2241", "score": "0.6532283", "text": "def is_approved?\n moderation_flag ? true : false\n end", "title": "" }, { "docid": "b4c267d6d3d1e923fb6a5e110ccf2241", "score": "0.6532283", "text": "def is_approved?\n moderation_flag ? true : false\n end", "title": "" }, { "docid": "84d81a48118cab27d1d4a164494ef420", "score": "0.65199345", "text": "def cannot_edit_state?\n self.unpublished_pending_approval? && !first_time_publishing? && !act_of_fixing_issue?\n end", "title": "" }, { "docid": "3ebf27caa49c895cebb50402ecb2cc84", "score": "0.6519675", "text": "def is_pending?\n moderation_flag.nil?\n end", "title": "" }, { "docid": "3ebf27caa49c895cebb50402ecb2cc84", "score": "0.6519675", "text": "def is_pending?\n moderation_flag.nil?\n end", "title": "" }, { "docid": "54fc5fe5010acac28f3103b2d4f28775", "score": "0.6510924", "text": "def approve?\n user && user.able_to?(:moderate_any_forum, record.forum)\n end", "title": "" }, { "docid": "c06fbc4f6c63b3de09c94e4894e4ebc0", "score": "0.6504252", "text": "def review_locked?\n (self.review_type.name == \"Final\" && \n (!(self.design.audit.skip? || self.design.audit.auditor_complete?) ||\n !self.design.work_assignments_complete?))\n end", "title": "" }, { "docid": "0635c2e52b35509f1eee0cf8d35611c2", "score": "0.643122", "text": "def locked?\n submitted?\n end", "title": "" }, { "docid": "87de0261d6a19f790d2d09a0942d1aef", "score": "0.6429801", "text": "def deny\n self.granted = -1\n restaurant = Restaurant.find(self.restaurant_id)\n restaurant.mark_collaborative\n end", "title": "" }, { "docid": "691654a6634560f88f0606cf957fff59", "score": "0.6425079", "text": "def locked?\n approved? or rejected?\n end", "title": "" }, { "docid": "4518cca2b7790b7eeed1fe532bdb50f5", "score": "0.64159197", "text": "def editable_check(_traversal_env)\n Result::DENY\n end", "title": "" }, { "docid": "b1eb402177efe16fd42b0a49ce52c445", "score": "0.6409904", "text": "def allow_user_submit(user)\n current? and !expired_for_user(user)\n end", "title": "" }, { "docid": "b1eb402177efe16fd42b0a49ce52c445", "score": "0.6409904", "text": "def allow_user_submit(user)\n current? and !expired_for_user(user)\n end", "title": "" }, { "docid": "b1eb402177efe16fd42b0a49ce52c445", "score": "0.6409904", "text": "def allow_user_submit(user)\n current? and !expired_for_user(user)\n end", "title": "" }, { "docid": "d97dd1deeb31e0e3fd1f88997e48c105", "score": "0.6396213", "text": "def is_denied?\n (self.denied_feeds.count > 0)\n end", "title": "" }, { "docid": "211e7c95838eae0670b23e17268786d3", "score": "0.6391944", "text": "def action_allowed?\n if %w[edit update list_submissions].include? params[:action]\n current_user_has_admin_privileges? || current_user_teaching_staff_of_assignment?(params[:id])\n else\n current_user_has_ta_privileges?\n end\n end", "title": "" }, { "docid": "f5e61554e26377ec18fc88bc9447a0a6", "score": "0.6372982", "text": "def valid_edit_check(_traversal_env)\n Result::DENY\n end", "title": "" }, { "docid": "40f1c7b5d13a16dc59754556e0d5f291", "score": "0.6333899", "text": "def priviledged?\n @priviledged\n end", "title": "" }, { "docid": "d55279d2062970d2225332894097c1a0", "score": "0.63333964", "text": "def pending?\n !hashed_password && !reviewer?\n end", "title": "" }, { "docid": "21466ad6e28546539d04e40e76131106", "score": "0.63304895", "text": "def action_allowed?(action_name)\n # TODO: this does some unnecessary work\n compute_allow_and_deny(action_name).then do\n\n deny = @__deny_fields == true || (@__deny_fields && @__deny_fields.size > 0)\n\n clear_allow_and_deny\n\n !deny\n end\n end", "title": "" }, { "docid": "dd18e3df857995c071157f9ccef238be", "score": "0.6322772", "text": "def has_access\n if [email protected]_organized_by_or_admin(current_user.sk) && @contestproblem.at_most(:not_started_yet)\n render 'errors/access_refused' and return\n end\n end", "title": "" }, { "docid": "1874e535dea719b0d176a350cf51afc9", "score": "0.63064915", "text": "def can_be_rejected?\n self.applied?\n end", "title": "" }, { "docid": "b6fba8777069aaec15b69de37637fa6f", "score": "0.6301036", "text": "def deny(reason)\n user = self.adult_sponsor\n if self.destroy && reason.is_a?(Hash)\n user.group = nil\n user.save\n GroupMailer.send_denied_notice(user, self, reason['email_text']).deliver\n true\n else\n false\n end\n end", "title": "" }, { "docid": "7b07fd2375954bdd1466092578401210", "score": "0.6293686", "text": "def awaiting_dean_approval?\n awarded? && !dean_approved?\n end", "title": "" }, { "docid": "dd6f7732e55269e16c663cb9d4171477", "score": "0.62838155", "text": "def permitted?; end", "title": "" }, { "docid": "db7fcc868fef39c078b2688337d4bcec", "score": "0.6268098", "text": "def can_update_draft\n redirect_to problem_path(@problem) if @no_new_submission\n end", "title": "" }, { "docid": "e81d2b9cd4d5a5afe4a6c887b9db2cff", "score": "0.62608844", "text": "def can_see_submissions\n redirect_to root_path if !(params.has_key?:what)\n @what = params[:what].to_i\n redirect_to root_path if (@what != 0 and @what != 1)\n if @what == 0 # See correct submissions (need to have solved problem or to be admin)\n redirect_to root_path if !current_user.sk.admin? and !current_user.sk.pb_solved?(@problem)\n else # (@what == 1) # See incorrect submissions (need to be admin or corrector)\n redirect_to root_path if !current_user.sk.admin? and !current_user.sk.corrector?\n end\n end", "title": "" }, { "docid": "46fb4e9c699bec2904ad1a974589d010", "score": "0.6253153", "text": "def modifiable?\n !(self.complete? || self.ready_to_post?)\n end", "title": "" }, { "docid": "cb80152489991bae8e2ad05a49c5b66d", "score": "0.62299377", "text": "def correct_user\n if @submission.user != current_user.sk && !current_user.sk.admin && (!current_user.sk.corrector || !current_user.sk.pb_solved?(@problem))\n render 'errors/access_refused' and return\n end\n end", "title": "" }, { "docid": "1e19e3b04f212ec9d711550cffd0f071", "score": "0.6204733", "text": "def cannot?(user, project)\n !can?(user, :reader, project)\n end", "title": "" }, { "docid": "ea6fffa15180edbde038eb6810bac489", "score": "0.6199879", "text": "def can_revoke_review_request\n if rule.review_requestor_id.nil?\n errors.add(:base, 'Control is not currently under review')\n elsif !(user.id == rule.review_requestor_id || project_permissions == 'admin')\n errors.add(:base, 'Only the requestor or an admin can revoke a review request')\n end\n end", "title": "" }, { "docid": "8971d810ffc1028672c92c982d9ad999", "score": "0.6199009", "text": "def denied\n ContactMailer.denied\n end", "title": "" }, { "docid": "90c90807aeb854ed7fbcf17a3477db10", "score": "0.61747986", "text": "def mark_as_denied\n request = MentorshipRequest.find(params[:mentorship_request])\n request.status = 'Denied'\n request.save!\n\n flash[:success] = 'Request Successfully Denied'\n redirect_to mentorship_requests_path\n end", "title": "" }, { "docid": "3650fa15df96f658b72de6ce4c96630a", "score": "0.6168734", "text": "def allows_reward?\n false\n end", "title": "" }, { "docid": "b2f2d40b245d4ffde6c271a01d509a03", "score": "0.6168072", "text": "def deletable_by?(user)\n return false unless self.inviter == user\n !self.is_valid? || (self.is_valid? &&\n accepted_students.size == 1 &&\n self.assignment.group_assignment? &&\n !assignment.past_collection_date?(self.section))\n end", "title": "" }, { "docid": "564d57322c43b6fcf8e6299164a1dfcf", "score": "0.61671746", "text": "def can_be_seen_by(user, no_new_submission)\n return true if user.admin?\n return false if user.rating < 200\n if self.virtualtest_id == 0 # Not in a virtualtest: prerequisites should be completed\n return false if no_new_submission and self.submissions.where(\"user_id = ? AND status != ?\", user.id, Submission.statuses[:draft]).count == 0\n self.chapters.each do |c|\n return false if !user.chap_solved?(c)\n end\n else # In a virtualtest: the user should have finished the test\n return false if user.test_status(self.virtualtest) != \"finished\"\n end\n return true\n end", "title": "" }, { "docid": "b4522767d78e962e5ea87d8bfc299a75", "score": "0.6165331", "text": "def deny\n self.status = 'denied'\n save\n end", "title": "" }, { "docid": "8017d1da256bdec4e3139ab0b8c028ef", "score": "0.6150255", "text": "def disallow_teaching_staff_delete_assessment_submissions\n cannot :delete_all_submissions, Course::Assessment\n end", "title": "" }, { "docid": "a0a6644d324ba9ab4cb2c3563178ae8d", "score": "0.6146496", "text": "def refuse\n @presentation.refuse!\n redirect_to admin_submissions_path((@presentation.poster ? :poster : :contributed) => 1), notice: 'The presentation has been unaccepted.'\n end", "title": "" }, { "docid": "657f20fa48af5b52e781225f72b3cc8e", "score": "0.61385137", "text": "def notify_status_denied(user, redemption)\n @reward = redemption.reward\n @denier = redemption.denier\n notify_redeemer_status_change(user, redemption, t(\"rewards.redemption_was_denied\", reward_title: redemption.reward.title))\n end", "title": "" }, { "docid": "bdd3975967cf7d2e634d3184805aa241", "score": "0.6136218", "text": "def action_allowed?\n return true if ['Instructor', 'Teaching Assistant', 'Administrator', 'Super-Administrator'].include? current_role_name\n @teams = TeamsUser.where(user_id: current_user.try(:id))\n @teams.each do |team|\n return true if Team.where(id: team.team_id).first.parent_id == sample_submission_params[:id].to_i\n end\n false\n end", "title": "" }, { "docid": "135338561bf97bb85b10c27251e68bc9", "score": "0.6133274", "text": "def admited?\n return true unless admited_on.nil?\n end", "title": "" }, { "docid": "666229331e2e9d6a84743336569d0403", "score": "0.60893303", "text": "def protects?(thing)\n false\n end", "title": "" }, { "docid": "03dba47a38d8ff680fa736c0643901c2", "score": "0.60792774", "text": "def may_not_be_user_required\n\t\tcurrent_user.may_not_be_user?(@user) || access_denied(\n\t\t\t\"You may not be this user to do this\", user_path(current_user))\n\tend", "title": "" }, { "docid": "aa4ab4cb4b1c9083018cd0d3a30adda1", "score": "0.60617703", "text": "def can_be_replied_to?\n !locked?\n end", "title": "" }, { "docid": "4c3b8a8acdd4b65d5355501d946a268c", "score": "0.605904", "text": "def permitted_to_publish?\n @pcp_subject.user_is_owner_or_deputy?( current_user, @pcp_subject.current_step.acting_group_index )\n end", "title": "" }, { "docid": "a37490c8c5823cad11193f409b073f5b", "score": "0.6056625", "text": "def must_be_moderator_or_poster\n login_required_as_moderator_or_researcher(@post.researcher, post_path(@post))\n end", "title": "" }, { "docid": "0dc07aa91a86b279ae7ec0a06d1a3c78", "score": "0.60520923", "text": "def allow_access\n !@current_user.nil?\n end", "title": "" }, { "docid": "20ccb5cf541d0e40b4e34d78fc527c09", "score": "0.6043642", "text": "def status_restricted?\n (prospect || exstudent || student) &&\n !(prospect && exstudent && student)\n end", "title": "" }, { "docid": "1e0a8202a78776c78fd199d6d043bb3b", "score": "0.6035653", "text": "def available?\n new_record? || (submissions.none? && !grant.published?)\n end", "title": "" }, { "docid": "3952f70d52e6e7c1ed136ba5f3e3de9b", "score": "0.6023088", "text": "def allow_mode_switching?\n submissions.count == 0 || autograded?\n end", "title": "" }, { "docid": "920c26464ddf2f860badfdaaa896c80e", "score": "0.60163575", "text": "def unmoderated\n where :awaiting_moderation => true\n end", "title": "" }, { "docid": "59872af30c7d5f763fe178879791981c", "score": "0.6011788", "text": "def can_uncorrect_submission\n # Submission must be correct to be marked as wrong\n redirect_to problem_path(@problem, :sub => @submission) unless @submission.correct?\n unless current_user.sk.root?\n # Corrector should have accepted the solution a few minutes ago\n eleven_minutes_ago = DateTime.now - 11.minutes\n if Solvedproblem.where(:user => @submission.user, :problem => @problem).first.correction_time < eleven_minutes_ago or @submission.corrections.where(:user => current_user.sk).where(\"created_at > ?\", eleven_minutes_ago).count == 0\n flash[:danger] = \"Vous ne pouvez plus marquer cette solution comme erronée.\"\n redirect_to problem_path(@problem, :sub => @submission)\n end\n end\n end", "title": "" }, { "docid": "8489b3006943551c333fa8e752bffc72", "score": "0.6007912", "text": "def validate_access\n if @user_logged_in != @answer.user\n render status: :forbidden\n end\n end", "title": "" }, { "docid": "93880e9b00e074f195a89699e5747c71", "score": "0.6005576", "text": "def access_denied\n end", "title": "" }, { "docid": "e26250d7ee32791034b2eb9a1071da0f", "score": "0.6001091", "text": "def blocked?\n !actor.likes?(activity_object)\n end", "title": "" }, { "docid": "406c8754da8bd58127998bb36e45d699", "score": "0.60005784", "text": "def reject!\n return false if self.approved == true\n self.destroy\n end", "title": "" }, { "docid": "b40e8f039435afe9832cfb4e51f5fbb6", "score": "0.599919", "text": "def last_request_update_allowed?\n !session[:sudo]\n end", "title": "" }, { "docid": "a2d98229a19d1a6e91f6c1dac547f015", "score": "0.59955955", "text": "def at_submission_limit?\n if assessment.max_submissions == -1\n false\n else\n count = assessment.submissions.where(course_user_datum: course_user_datum).count\n count >= assessment.max_submissions\n end\n end", "title": "" }, { "docid": "81f2acba8f93c7d2949efd7f553c52c1", "score": "0.5994729", "text": "def credit_unlimited?\n #if prepaid?\n # raise \"Prepaid users do not have credit\"\n credit == -1\n end", "title": "" }, { "docid": "95a011de28a6c92efd72f9695bb8a1df", "score": "0.59929127", "text": "def check_permissions\n unless can_edit? @post\n flash.now[:warning] = \"You can't edit that post.\"\n redirect_to :action => 'show'\n return false\n end\n end", "title": "" }, { "docid": "94ba1d9ea005542e6f2da1e8f2aecdca", "score": "0.5985109", "text": "def check_permissions\n unless can_edit? @post\n flash[:warning] = \"You can't edit that post.\"\n redirect_to :action => 'show'\n return false\n end\n end", "title": "" }, { "docid": "1f6c75a94fcac5f1063a208f839ef2f4", "score": "0.5981215", "text": "def check_enabled\n User.current = nil\n parse_request\n unless @api_key.present? and @api_key == Setting.mail_handler_api_key\n render :text => 'Access denied. Redmine API is disabled or key is invalid.', :status => 403\n false\n end\n end", "title": "" }, { "docid": "1d5df40c8b6528dea3fc35ebc0dd2028", "score": "0.59810203", "text": "def feedback_can_be_given?\n !has_feedback? && !feedback_skipped?\n end", "title": "" }, { "docid": "f19d6d007a1a139913970a2442e01368", "score": "0.5980086", "text": "def submitted?\n self.status.to_i > status_enum['unsubmitted']\n end", "title": "" }, { "docid": "7e0f79d940049617ee0e754996466a84", "score": "0.59784645", "text": "def prevent_edit\n !can_edit?\n end", "title": "" }, { "docid": "38944eef7c2fd19dc787488d35f8aa71", "score": "0.5978463", "text": "def can_student_submit?(student)\n released_for_student?(student) && !deadline_passed_for?(student)\n end", "title": "" }, { "docid": "63eb281fd3d47533829430ec5e842719", "score": "0.5975936", "text": "def imperfect_return_resubmission?\n return false unless previously_transmitted_submission.present?\n \n previously_transmitted_submission.efile_submission_transitions.collect(&:efile_errors).flatten.any? { |error| [\"SEIC-F1040-501-02\", \"R0000-504-02\"].include? error.code }\n end", "title": "" }, { "docid": "7564249a095375c825f0a0625d32459e", "score": "0.5975182", "text": "def author\n if @submission.user != current_user.sk\n render 'errors/access_refused' and return\n end\n end", "title": "" }, { "docid": "6c7b3b923ca4879fc775f3e9b6519243", "score": "0.5974316", "text": "def rejected?\n approval_state.present? ? approval_state == 'rejected' : approval.try(:rejected?)\n end", "title": "" }, { "docid": "c4042c24628330cd2c30cee00e30c5b9", "score": "0.59734243", "text": "def action_allowed?\n current_user_has_student_privileges?\n end", "title": "" }, { "docid": "34dc0d855d44866159b8004e1d53ae49", "score": "0.59708565", "text": "def deny\n @issue = Issue.find(params[:id])\n @issue.resolved = 0\n old_submitter = @issue.submitter_id\n @issue.submitter_id = nil\n project = Project.find(@issue.project_id)\n if @issue.save\n flash[:warning] = \"The Solution was Rejected\"\n UserMailer.resolution_denied(@issue, old_submitter).deliver\n redirect_to project_issue_path(project.slug,@issue.id)\n else\n flash[:error] = \"Error in Saving. Please retry.\"\n redirect_to project_issue_path(project.slug,@issue.id)\n end\n end", "title": "" }, { "docid": "d1a49d3b8a7db123778e99a79e9e3530", "score": "0.59708357", "text": "def hide_warnings?(work)\n current_user.is_a?(User) && current_user.preference && current_user.preference.hide_warnings? && !current_user.is_author_of?(work)\n end", "title": "" }, { "docid": "966a6708ca47a18cce05092ff5dc354b", "score": "0.5967862", "text": "def is_draft\n unless @submission.draft?\n redirect_to @problem\n end\n end", "title": "" }, { "docid": "017dddb085578cc0d2b9fe2665b80a34", "score": "0.59621763", "text": "def approved?\n !pending\n end", "title": "" }, { "docid": "c0c5f03376d3024744dc2ac5262de182", "score": "0.5958308", "text": "def reject(*)\n super.tap do\n __debug_sim('USER must make change(s) to complete the submission.')\n end\n end", "title": "" }, { "docid": "e8d5d742d43d191e02ba76752655cbb3", "score": "0.5956506", "text": "def restrict_access\n head :unauthorized and return false unless current_user\n end", "title": "" }, { "docid": "08f9501ad22bc70106e88c178a4ef077", "score": "0.59548277", "text": "def authorized_to_modify_task?\n current_user.site_admin? || can_view_all_manuscript_managers_for_journal? || can_view_manuscript_manager_for_paper? ||\n allowed_manuscript_information_task? || metadata_task_collaborator? || allowed_reviewer_task? || task_participant?\n end", "title": "" }, { "docid": "31a747685fb5165d94e43687168f82ee", "score": "0.59528375", "text": "def access_denied\n\n end", "title": "" }, { "docid": "ef24ce402afe2d3e0483b811928ff208", "score": "0.5952295", "text": "def rejected?\n self.status == STATUS_REJECTED\n end", "title": "" }, { "docid": "10d8d0f01c16ad282aa091262095f95e", "score": "0.5940751", "text": "def is_deny?\n type == :D\n end", "title": "" }, { "docid": "aca1f7fcf75353b0c7e07d0844ffb207", "score": "0.59385", "text": "def not_author_response\n if author_respondent?\n errors[:author] << 'cannot answer their own poll'\n end\n end", "title": "" }, { "docid": "3250bcb4291097d94241973ff26120d1", "score": "0.5932245", "text": "def deny(boolean, message = nil)\n _wrap_assertion do\n assert_block(build_message(message, \"Failed refutation, no message given.\")) { not boolean }\n end\n end", "title": "" } ]
558045e779d7ac7ffb415c701e9c951b
As Neofiles treats files as immutables, this method updates only auxiliary fields: description, no_wm etc. Returns nothing.
[ { "docid": "1b692d8bcb8a89022a37c8ffb45d296d", "score": "0.7986624", "text": "def file_update\n file, data = find_file_and_data\n file.update data.slice(:description, :no_wm)\n render plain: '', layout: false\n end", "title": "" } ]
[ { "docid": "e035bcb9ea8587c98a92078ee7b2e0fd", "score": "0.6351894", "text": "def update_metadata(_, _)\n interpret_visibility # Note: this modifies the contents of attributes!\n update_visibility(attributes[:visibility]) if attributes.key?(:visibility)\n # generic_file.visibility = attributes[:visibility] if attributes.key?(:visibility)\n generic_file.attributes = attributes\n generic_file.date_modified = DateTime.now\n remove_from_feature_works if generic_file.visibility_changed? && !generic_file.public?\n save_and_record_committer do\n if Sufia.config.respond_to?(:after_update_metadata)\n Sufia.config.after_update_metadata.call(generic_file, user)\n end\n end\n end", "title": "" }, { "docid": "5bf99c2223f0e6222df8c317b8a785b2", "score": "0.623183", "text": "def update_metadata\n # @todo db - refactor to use an update\n metadata = files_doc\n metadata[:length] = @file_position\n metadata[:md5] = @local_md5\n @files.save(metadata)\n end", "title": "" }, { "docid": "e89d84abef63ffcfea46bbaeb8ca82db", "score": "0.60826147", "text": "def update_metadata\n @generic_file.attributes = @generic_file.sanitize_attributes(params[:generic_file])\n @generic_file.visibility = params[:visibility]\n @generic_file.date_modified = DateTime.now\n end", "title": "" }, { "docid": "1cf555ddc3595183cb7c794e818d742a", "score": "0.5947777", "text": "def modify\n self.copied_not_modified = false\n self.notified = false\n self.save\n end", "title": "" }, { "docid": "fd84d429455928fad100c03bc1f7e501", "score": "0.5831955", "text": "def internal_file_attributes=(_arg0); end", "title": "" }, { "docid": "e278ec44760fc0560d13263767ab188a", "score": "0.5815249", "text": "def metadata_only_update\n if @resp[:state] == 'done'\n # don't reopen for metadata changes and just update status\n # because metadata is only updated to public on publishing or if the version is unpublished and public won't see changes.\n @copy.update(state: 'finished',\n error_info: \"Warning: metadata wasn't updated because the last version was published, \" \\\n \"versioning of metadata-only changes isn't allowed in zenodo and the public should \" \\\n 'only see published metadata changes.')\n return\n end\n @deposit.update_metadata(dataset_type: @dataset_type, doi: @copy.software_doi)\n @copy.update(state: 'finished', error_info: nil)\n end", "title": "" }, { "docid": "8537909b2a23bbc22d272fff8c90ca51", "score": "0.5781715", "text": "def with_files\n update_files || replace_files || !object\n end", "title": "" }, { "docid": "7f05f6c8d828bfc0a95b3f89a4672536", "score": "0.5769514", "text": "def update_metadata\n\n if params[:visibility] == \"discoverable\"\n @generic_file.discover_groups = ['public']\n @generic_file.read_groups = ['registered']\n\n # todo: this needs to be true for all by default\n # @generic_file.edit_groups = ['registered']\n\n #remove the visibility since \"discoverable\" is not a valid setting according to hydra-access-controls\n params.delete :visibility\n end\n\n actor.update_metadata(params[:generic_file], params[:visibility])\n\n end", "title": "" }, { "docid": "2d495739087d2c40f2e57cda6f0e3b7e", "score": "0.5761879", "text": "def update_file\n update_file_on_disk\n end", "title": "" }, { "docid": "2d495739087d2c40f2e57cda6f0e3b7e", "score": "0.5761879", "text": "def update_file\n update_file_on_disk\n end", "title": "" }, { "docid": "973d3443fe101a0599f5f434f7fefcfd", "score": "0.5721605", "text": "def update_metadata(metsfile)\n\n @doc = Nokogiri::XML(File.read(metsfile))\n bitstreams = @doc.css('file')\n\n @provenance = <<-EOF.gsub(/^\\s+/, '')\n MIT Libraries updated OCW and media links to https; change made by\n Andromeda Yelton ([email protected]) on %{date}\n No. of bitstreams updated: %{count}\n EOF\n\n @count = 0\n bitstreams.each do |bitstream|\n checksum = bitstream.attribute('CHECKSUM')\n bitstreampath = File.split(metsfile)[0]\n new_checksum, file_size = get_new_metadata(bitstreampath, bitstream)\n\n # You have to force both checksums to String, or else the equality test\n # will fail due to their different object types, even though the\n # representations look the same. If they differ, update the MODS and\n # PREMIS records.\n if checksum.to_s != new_checksum.to_s\n digest_node, size_node, original_name = get_premis_components(checksum)\n bitstream['CHECKSUM'] = digest_node.content = new_checksum.to_s\n bitstream['SIZE'] = size_node.content = file_size\n append_provenance(original_name, new_checksum, file_size)\n @count += 1\n end\n end\n\n date = Time.now.utc.strftime('%Y-%m-%d %H:%M:%S (UTC)')\n @provenance = @provenance % {:date => date, :count => @count}\n set_item_id(metsfile)\n File.write(metsfile, @doc.to_xml)\n end", "title": "" }, { "docid": "b69ca772599e8008fee94300c6774a2e", "score": "0.5709934", "text": "def update_file_meta_data\n if file.present? && file_changed?\n self.filename = read_attribute(:file)\n self.content_type = file.file.content_type unless file.file.content_type.blank?\n self.file_size = file.file.size unless file.file.size.blank?\n end\n end", "title": "" }, { "docid": "b69ca772599e8008fee94300c6774a2e", "score": "0.5709934", "text": "def update_file_meta_data\n if file.present? && file_changed?\n self.filename = read_attribute(:file)\n self.content_type = file.file.content_type unless file.file.content_type.blank?\n self.file_size = file.file.size unless file.file.size.blank?\n end\n end", "title": "" }, { "docid": "8142ead1de465d5052967fef553665a0", "score": "0.5671336", "text": "def update_contents!(new_contents)\n if is_binary\n File.binwrite(filename, new_contents)\n else\n File.write(filename, new_contents)\n end\n end", "title": "" }, { "docid": "d1642c40ded7f7f5f9812df4e45f4cc5", "score": "0.5635257", "text": "def add_update_item_attributes\n changes = MGutz::FileChanges.new\n\n items.each do |item|\n # do not include assets or xml files in sitemap\n if item[:content_filename]\n ext = File.extname(route_path(item))\n item[:is_hidden] = true if item[:content_filename] =~ /assets\\// || ext == '.xml'\n end\n\n if item[:kind] == \"article\"\n # filename might contain the created_at date\n item[:created_at] ||= derive_created_at(item)\n # sometimes nanoc3 stores created_at as Date instead of String causing a bunch of issues\n item[:created_at] = item[:created_at].to_s if item[:created_at].is_a?(Date)\n\n # sets updated_at based on content change date not file time\n change = changes.status(item[:content_filename], item[:created_at], item.raw_content)\n item[:updated_at] = change[:updated_at].to_s\n end\n end\nend", "title": "" }, { "docid": "65028df5986b4501d3cba3cc3ca2cbf4", "score": "0.5632765", "text": "def updated_resource_file(blank_all_tags = false, size = nil)\n begin\n if size\n preview = media_file.get_preview(size)\n path = ::File.join(Media::File::DOWNLOAD_STORAGE_DIR, media_file.filename)\n ::File.open(path, 'wb') do |f|\n #f << Base64.decode64(preview.base64)\n f.write(Base64.decode64(preview.base64))\n end\n else\n source_filename = media_file.file_storage_location\n FileUtils.cp( source_filename, Media::File::DOWNLOAD_STORAGE_DIR )\n path = ::File.join(Media::File::DOWNLOAD_STORAGE_DIR, ::File.basename(source_filename))\n end\n # remember we want to handle the following:\n # include all madek tags in file\n # remove all (ok, as many as we can) tags from the file.\n cleaner_tags = (blank_all_tags ? \"-All= \" : \"-IPTC:All= \") + \"-XMP-madek:All= -IFD0:Artist= -IFD0:Copyright= -IFD0:Software= \" # because we do want to remove IPTC tags, regardless\n tags = cleaner_tags + (blank_all_tags ? \"\" : to_metadata_tags)\n \n resout = `#{EXIFTOOL_PATH} #{tags} \"#{path}\"`\n FileUtils.rm(\"#{path}_original\") if resout.include?(\"1 image files updated\") # Exiftool backs up the original before editing. We don't need the backup.\n return path.to_s\n rescue \n # \"No such file or directory\" ?\n logger.error \"copy failed with #{$!}\"\n return nil\n end\n end", "title": "" }, { "docid": "c007b06f1f7f06bede315c1e5a8edcb9", "score": "0.5632342", "text": "def update!(**args)\n @content = args[:content] if args.key?(:content)\n @file = args[:file] if args.key?(:file)\n @path = args[:path] if args.key?(:path)\n @permissions = args[:permissions] if args.key?(:permissions)\n @state = args[:state] if args.key?(:state)\n end", "title": "" }, { "docid": "ea311037e0ef7fa67284b2e6e66f0b48", "score": "0.5579155", "text": "def update_file_data\n @files.each { |f| f['name'] = f['filename'] }\n end", "title": "" }, { "docid": "3c34ec1a4a4cb794af9ca10b7bf1d75d", "score": "0.5571607", "text": "def modifyfile\n @modified = Time.now\n end", "title": "" }, { "docid": "67b770a4c28e307f2be2d77fb6e10097", "score": "0.55630493", "text": "def update_file params\n raise NotImplementedError\n end", "title": "" }, { "docid": "351a04e8a150ceb91f2df11f8796b6f1", "score": "0.5555743", "text": "def update_remote_file_content_without_validation\n update_remote_file_content(content: applied_remote_file_content, path: path)\n end", "title": "" }, { "docid": "8f438111b9483fe95389f6138ecbc6ed", "score": "0.5534128", "text": "def update_code_review_file\n end", "title": "" }, { "docid": "03a781513eaa6ecf5935b67acb994dee", "score": "0.5526612", "text": "def set_description\n \t\tif self.description.blank? && self.is_file?\n \t\t\tself.description = self.filename\t\n\t\tend\t\n\tend", "title": "" }, { "docid": "6c5c028265827f87390fb6978f969a71", "score": "0.5516509", "text": "def update_details\n\t\tdescription = utf_sanitizer(self.get_description_file)\n\t\tself.title = self.cran_value_regex(\"Title\",description)\n\t\tself.publication = self.get_publication_date(description)\n\t\tself.description = self.cran_value_regex(\"Description\",description)\n\t\tself.authors = self.cran_value_regex(\"Author\",description)\n\t\tself.maintainers = self.cran_value_regex(\"Maintainer\",description)\n\t\tself.updated_at = Time.now\t\n\t\tself.save\n\tend", "title": "" }, { "docid": "177ce0e276c30389a7fc269281f12653", "score": "0.5511466", "text": "def update!(**args)\n @description = args[:description] unless args[:description].nil?\n end", "title": "" }, { "docid": "bf339b86513587232d68af87fd27ef08", "score": "0.5503928", "text": "def update_file_metadata( data = asset_store.read_original(self) )\n update_attributes!( :file_size => data.bytesize, :file_hash => Digest::SHA1.hexdigest( data ) )\n end", "title": "" }, { "docid": "1e3819a326b2d2930edbb5703fbf728d", "score": "0.5496182", "text": "def update!(**args)\n @app_properties = args[:app_properties] if args.key?(:app_properties)\n @capabilities = args[:capabilities] if args.key?(:capabilities)\n @content_hints = args[:content_hints] if args.key?(:content_hints)\n @content_restrictions = args[:content_restrictions] if args.key?(:content_restrictions)\n @copy_requires_writer_permission = args[:copy_requires_writer_permission] if args.key?(:copy_requires_writer_permission)\n @created_time = args[:created_time] if args.key?(:created_time)\n @description = args[:description] if args.key?(:description)\n @drive_id = args[:drive_id] if args.key?(:drive_id)\n @explicitly_trashed = args[:explicitly_trashed] if args.key?(:explicitly_trashed)\n @export_links = args[:export_links] if args.key?(:export_links)\n @file_extension = args[:file_extension] if args.key?(:file_extension)\n @folder_color_rgb = args[:folder_color_rgb] if args.key?(:folder_color_rgb)\n @full_file_extension = args[:full_file_extension] if args.key?(:full_file_extension)\n @has_augmented_permissions = args[:has_augmented_permissions] if args.key?(:has_augmented_permissions)\n @has_thumbnail = args[:has_thumbnail] if args.key?(:has_thumbnail)\n @head_revision_id = args[:head_revision_id] if args.key?(:head_revision_id)\n @icon_link = args[:icon_link] if args.key?(:icon_link)\n @id = args[:id] if args.key?(:id)\n @image_media_metadata = args[:image_media_metadata] if args.key?(:image_media_metadata)\n @is_app_authorized = args[:is_app_authorized] if args.key?(:is_app_authorized)\n @kind = args[:kind] if args.key?(:kind)\n @label_info = args[:label_info] if args.key?(:label_info)\n @last_modifying_user = args[:last_modifying_user] if args.key?(:last_modifying_user)\n @link_share_metadata = args[:link_share_metadata] if args.key?(:link_share_metadata)\n @md5_checksum = args[:md5_checksum] if args.key?(:md5_checksum)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n @modified_by_me = args[:modified_by_me] if args.key?(:modified_by_me)\n @modified_by_me_time = args[:modified_by_me_time] if args.key?(:modified_by_me_time)\n @modified_time = args[:modified_time] if args.key?(:modified_time)\n @name = args[:name] if args.key?(:name)\n @original_filename = args[:original_filename] if args.key?(:original_filename)\n @owned_by_me = args[:owned_by_me] if args.key?(:owned_by_me)\n @owners = args[:owners] if args.key?(:owners)\n @parents = args[:parents] if args.key?(:parents)\n @permission_ids = args[:permission_ids] if args.key?(:permission_ids)\n @permissions = args[:permissions] if args.key?(:permissions)\n @properties = args[:properties] if args.key?(:properties)\n @quota_bytes_used = args[:quota_bytes_used] if args.key?(:quota_bytes_used)\n @resource_key = args[:resource_key] if args.key?(:resource_key)\n @sha1_checksum = args[:sha1_checksum] if args.key?(:sha1_checksum)\n @sha256_checksum = args[:sha256_checksum] if args.key?(:sha256_checksum)\n @shared = args[:shared] if args.key?(:shared)\n @shared_with_me_time = args[:shared_with_me_time] if args.key?(:shared_with_me_time)\n @sharing_user = args[:sharing_user] if args.key?(:sharing_user)\n @shortcut_details = args[:shortcut_details] if args.key?(:shortcut_details)\n @size = args[:size] if args.key?(:size)\n @spaces = args[:spaces] if args.key?(:spaces)\n @starred = args[:starred] if args.key?(:starred)\n @team_drive_id = args[:team_drive_id] if args.key?(:team_drive_id)\n @thumbnail_link = args[:thumbnail_link] if args.key?(:thumbnail_link)\n @thumbnail_version = args[:thumbnail_version] if args.key?(:thumbnail_version)\n @trashed = args[:trashed] if args.key?(:trashed)\n @trashed_time = args[:trashed_time] if args.key?(:trashed_time)\n @trashing_user = args[:trashing_user] if args.key?(:trashing_user)\n @version = args[:version] if args.key?(:version)\n @video_media_metadata = args[:video_media_metadata] if args.key?(:video_media_metadata)\n @viewed_by_me = args[:viewed_by_me] if args.key?(:viewed_by_me)\n @viewed_by_me_time = args[:viewed_by_me_time] if args.key?(:viewed_by_me_time)\n @viewers_can_copy_content = args[:viewers_can_copy_content] if args.key?(:viewers_can_copy_content)\n @web_content_link = args[:web_content_link] if args.key?(:web_content_link)\n @web_view_link = args[:web_view_link] if args.key?(:web_view_link)\n @writers_can_share = args[:writers_can_share] if args.key?(:writers_can_share)\n end", "title": "" }, { "docid": "9bff8df7c79fcaa84ede505d25c0f96b", "score": "0.5471639", "text": "def update_metadata\n file_attributes = ::FileSetEditForm.model_attributes(attributes)\n actor.update_metadata(file_attributes)\n end", "title": "" }, { "docid": "9bff8df7c79fcaa84ede505d25c0f96b", "score": "0.5471639", "text": "def update_metadata\n file_attributes = ::FileSetEditForm.model_attributes(attributes)\n actor.update_metadata(file_attributes)\n end", "title": "" }, { "docid": "9bff8df7c79fcaa84ede505d25c0f96b", "score": "0.5471639", "text": "def update_metadata\n file_attributes = ::FileSetEditForm.model_attributes(attributes)\n actor.update_metadata(file_attributes)\n end", "title": "" }, { "docid": "e14a9626aae53a125a3e021622bf919b", "score": "0.54674226", "text": "def update!(**args)\n @description = args[:description] unless args[:description].nil?\n @items = args[:items] unless args[:items].nil?\n @kind = args[:kind] unless args[:kind].nil?\n end", "title": "" }, { "docid": "34c6bc6fbd89920a0ca56873f1137b00", "score": "0.54619783", "text": "def modify_file_data(data, allow_blank = true)\n if (new_file_data = parse_file_data(data, allow_blank)).present?\n @emma_file_record = nil # Force regeneration.\n @emma_file_data = emma_file_data.merge(new_file_data)\n self[:file_data] = @emma_file_data.to_json\n end\n self[:file_data]\n end", "title": "" }, { "docid": "7123aa4f7fc8b65060728ca6c7530bb1", "score": "0.54544187", "text": "def update!(**args)\n @content = args[:content] if args.key?(:content)\n @file_format = args[:file_format] if args.key?(:file_format)\n end", "title": "" }, { "docid": "fc1d2aacafa46dd0d167ce5ef9672201", "score": "0.5435099", "text": "def not_modified!; end", "title": "" }, { "docid": "4b566c7c725ba9998f721b0e61df44e7", "score": "0.5431254", "text": "def edit_all files\n hashes = files.map(&:props)\n\n # find which tag fields are common among the files\n keys = hashes.flat_map { |hash| hash.keys }.uniq\n common = keys.select { |key| hashes.map { |hash| hash[key] }.uniq.compact.size <= 1 }\n leftover = AudioFile::WRITE_KEYS - common\n\n new_str = edit_tmp_yaml do |temp|\n # print common tags\n ck = common.map do |key|\n [key, hashes.map { |hash| hash[key] }.uniq.compact[0]]\n end.to_h\n temp.puts YAML.dump(ck)\n\n # print other tags in comments\n leftover.each do |key|\n temp.puts \"##{key}:\"\n end\n temp.puts\n\n files.each do |file|\n temp.puts \"# #{file.name}\"\n end\n end\n\n # save changes\n props = YAML.load(new_str)\n files.each do |file|\n file.props = props\n end\nend", "title": "" }, { "docid": "0f0fc9a1928cc3a9493027ba0db98fed", "score": "0.5425923", "text": "def update\n # new_contents = erase_blank(@document.file_contents.to_s)\n # puts \"document.file_contents is : #{@document.file_contents}\"\n # puts \"document.file_contents.to_s is : #{@document.file_contents.to_s}\"\n # puts \"new_contents is : #{new_contents}\"\n # if @document.update(:file_contents => new_contents)\n\n puts \"yo! update called:)\"\n # if @document.update(:original_file => params[:new_content])\n # redirect_to document_path(@document)\n # else\n # puts \"OH NOOOOOOOO!!!\"\n # end\n end", "title": "" }, { "docid": "581fed8937b2b0ae0a142eb10a2d9819", "score": "0.5422884", "text": "def modified=(_); end", "title": "" }, { "docid": "89e59ef239d16c38d7a2b3ae9ff23b7b", "score": "0.5422107", "text": "def update_internal\n # Does nothing\n end", "title": "" }, { "docid": "9884d68143bf37e5742899a036981543", "score": "0.541537", "text": "def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @contents = args[:contents] if args.key?(:contents)\n @create_time = args[:create_time] if args.key?(:create_time)\n @description = args[:description] if args.key?(:description)\n @filename = args[:filename] if args.key?(:filename)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @labels = args[:labels] if args.key?(:labels)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n @name = args[:name] if args.key?(:name)\n @revision_create_time = args[:revision_create_time] if args.key?(:revision_create_time)\n @revision_id = args[:revision_id] if args.key?(:revision_id)\n @revision_update_time = args[:revision_update_time] if args.key?(:revision_update_time)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n @source_uri = args[:source_uri] if args.key?(:source_uri)\n end", "title": "" }, { "docid": "58d3bf7924f3081ca811ff32e5458cd9", "score": "0.5410586", "text": "def internal_file_attributes; end", "title": "" }, { "docid": "8f8bff4ea6aec8f09a12be2ab798097d", "score": "0.5389655", "text": "def update!(**args)\n @files = args[:files] if args.key?(:files)\n end", "title": "" }, { "docid": "8f8bff4ea6aec8f09a12be2ab798097d", "score": "0.5389655", "text": "def update!(**args)\n @files = args[:files] if args.key?(:files)\n end", "title": "" }, { "docid": "d09bc2f0dc5f7c465a722022e06ce060", "score": "0.53765523", "text": "def save_if_not_modified\n self.merge(@layout.edit(@record_id, @mods, {:modification_id => @mod_id})[0]) if @mods.size > 0\n @mods.clear\n end", "title": "" }, { "docid": "d09bc2f0dc5f7c465a722022e06ce060", "score": "0.53765523", "text": "def save_if_not_modified\n self.merge(@layout.edit(@record_id, @mods, {:modification_id => @mod_id})[0]) if @mods.size > 0\n @mods.clear\n end", "title": "" }, { "docid": "f7d285b17babbf645ed76ab67810b30c", "score": "0.5373696", "text": "def update!(**args)\n @description = args[:description] if args.key?(:description)\n end", "title": "" }, { "docid": "7e8ee8b91c275540ab22b82104e77727", "score": "0.5372949", "text": "def update!(**args)\n @description = args[:description] if args.key?(:description)\n end", "title": "" }, { "docid": "823442541dfdf9174330457bea5932fe", "score": "0.53722316", "text": "def update_metadata\n file_attributes = edit_form_class.model_attributes(params[:generic_file])\n actor.update_metadata(file_attributes, params[:visibility])\n end", "title": "" }, { "docid": "6cf3e5bf155295bc387dbca53beb9cff", "score": "0.5356847", "text": "def update!(fn=path, remove_tag1=true)\n Mp3Info.open(fn) do |mp3|\n tag = mp3.tag2\n VALID.each do |key|\n if self.send(key)\n if tag.respond_to?(\"#{key}=\")\n tag.send(\"#{key}=\", self.send(key))\n else\n tag[VALID_HASH_KEYS[key]] = self.send(key)\n end\n end\n end\n mp3.removetag1 if mp3.hastag1?\n end\n self\n end", "title": "" }, { "docid": "1b0176ddd9145bb26d88567ba6d12b3c", "score": "0.535157", "text": "def update\n authorize @zenodomaterial\n @zenodomaterial.vfile = false #file is not a mandatory field here \n respond_to do |format|\n if @zenodomaterial.update(zenodomaterial_params) \n @zenodomaterial.create_activity(:update, owner: current_user) if @zenodomaterial.log_update_activity?\n \n service = ZenodoApi::MyZenodoApi.new(@@root_url, get_zenodo_token)\n my_deposition_id = @zenodomaterial.zenodolatestid\n \n array_depid_burl = service.update_empty_material_zenodo(my_deposition_id) \n #puts array_depid_burl[0]\n #puts \"this is the id update empty gives us back\" \n service.update_material_info_zenodo(my_deposition_id, @zenodomaterial.title, @zenodomaterial.short_description,@zenodomaterial.bauthors,@zenodomaterial.bcontributors,@zenodomaterial.zenodotype,@zenodomaterial.keywords,@zenodomaterial.publicationdate,@zenodomaterial.zenodolicense,@zenodomaterial.zenodolanguage,@zenodomaterial.publicationtype,@zenodomaterial.imagetype) \n doi_link = service.update_publish_zenodo(my_deposition_id)\n puts doi_link[0], doi_link[1], \"should be the same as creation's doi and link here\"\n \n @zenodomaterial.save\n \n format.html { redirect_to @zenodomaterial, notice: 'Zenodo material was successfully updated.' }\n format.json { render :show, status: :ok, location: @zenodomaterial }\n else\n format.html { render :edit }\n format.json { render json: @zenodomaterial.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "62262ba01616f5c24bd2593612f494f0", "score": "0.5330442", "text": "def update(contents)\n\n\t\t\t\t\t\t\t\t\n\n\n\tend", "title": "" }, { "docid": "0cce3d16d8a3e105cbb2481a40b243d4", "score": "0.5325397", "text": "def dirty!\n file = select_file\n self.class.dirty_file! file\n end", "title": "" }, { "docid": "54718fa9cb71032ca005f9073c19a86a", "score": "0.53161144", "text": "def update!(**args)\n @files = args[:files] if args.key?(:files)\n @container = args[:container] if args.key?(:container)\n @source_references = args[:source_references] if args.key?(:source_references)\n end", "title": "" }, { "docid": "0d5cdfef4ea1c911330adc09cfd6debb", "score": "0.52948165", "text": "def apply_saved_metadata(fs, curation_concern)\n uf = ::Hyrax::UploadedFile.find_by(browse_everything_url: fs.import_url)\n\n if uf&.pcdm_use == ::FileSet::PRIMARY\n fs.pcdm_use = ::FileSet::PRIMARY\n fs.title = curation_concern.title\n else\n fs.pcdm_use = ::FileSet::SUPPLEMENTAL\n fs.title = Array.wrap(uf&.title)\n fs.description = Array.wrap(uf&.description)\n fs.file_type = uf&.file_type\n end\n end", "title": "" }, { "docid": "b07f7e81f1db06359cff2ede846d1fd5", "score": "0.5290376", "text": "def update!(**args)\n @description = args[:description] unless args[:description].nil?\n @extra_description = args[:extra_description] unless args[:extra_description].nil?\n @url = args[:url] unless args[:url].nil?\n end", "title": "" }, { "docid": "dbabf9a904d03715d3daf7c875f75fcb", "score": "0.52896917", "text": "def external_file_attributes=(_arg0); end", "title": "" }, { "docid": "068628c09c485c3ab163bbbd2b25a655", "score": "0.52894753", "text": "def valid_update_attributes\n {\"test_file_text\" => \"this is some new text\"}\n end", "title": "" }, { "docid": "4350c4a2023a60e3f000361f8db61b18", "score": "0.5288724", "text": "def update()\n Ini.write_to_file(@path, @inihash, @comment)\n end", "title": "" }, { "docid": "1075b10fb3cbcbba901540da6d5fbd04", "score": "0.52831584", "text": "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @creator = args[:creator] if args.key?(:creator)\n @filename = args[:filename] if args.key?(:filename)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n @name = args[:name] if args.key?(:name)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end", "title": "" }, { "docid": "dfe77639dc2a636086364732dce0ca61", "score": "0.52830565", "text": "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end", "title": "" }, { "docid": "bb0e5e439397167e24c28ea19ee14b28", "score": "0.5281892", "text": "def not_modified?; end", "title": "" }, { "docid": "dd77e58d12ff6a6ce5c2cf4bf8d57b93", "score": "0.52709347", "text": "def file_modified; end", "title": "" }, { "docid": "d900e7e1d663e7fe6761b233e966f48f", "score": "0.52613103", "text": "def modified?; end", "title": "" }, { "docid": "bdc9b9b546aa12efe751e9d2ed17476e", "score": "0.5259313", "text": "def update!(**args)\n @content_url = args[:content_url] if args.key?(:content_url)\n @description = args[:description] if args.key?(:description)\n @icon = args[:icon] if args.key?(:icon)\n @large_image = args[:large_image] if args.key?(:large_image)\n @name = args[:name] if args.key?(:name)\n end", "title": "" }, { "docid": "bdc9b9b546aa12efe751e9d2ed17476e", "score": "0.5259313", "text": "def update!(**args)\n @content_url = args[:content_url] if args.key?(:content_url)\n @description = args[:description] if args.key?(:description)\n @icon = args[:icon] if args.key?(:icon)\n @large_image = args[:large_image] if args.key?(:large_image)\n @name = args[:name] if args.key?(:name)\n end", "title": "" }, { "docid": "bdc9b9b546aa12efe751e9d2ed17476e", "score": "0.5259313", "text": "def update!(**args)\n @content_url = args[:content_url] if args.key?(:content_url)\n @description = args[:description] if args.key?(:description)\n @icon = args[:icon] if args.key?(:icon)\n @large_image = args[:large_image] if args.key?(:large_image)\n @name = args[:name] if args.key?(:name)\n end", "title": "" }, { "docid": "bdc9b9b546aa12efe751e9d2ed17476e", "score": "0.5259313", "text": "def update!(**args)\n @content_url = args[:content_url] if args.key?(:content_url)\n @description = args[:description] if args.key?(:description)\n @icon = args[:icon] if args.key?(:icon)\n @large_image = args[:large_image] if args.key?(:large_image)\n @name = args[:name] if args.key?(:name)\n end", "title": "" }, { "docid": "7e3042462a2deea7f93e2a08069b0e85", "score": "0.5253767", "text": "def modified_files\n @modified_files ||= Overcommit::GitRepo.modified_files(staged: true)\n end", "title": "" }, { "docid": "96a7977be6aa7b92f6b719ee2345ba6e", "score": "0.5253636", "text": "def update\n\t\t\t@exist_before = @exist_now\n\t\t\t@exist_now = filename.exist?\n\n\t\t\tbegin\n\t\t\t\t@mod_time_before = @mod_time_now\n\t\t\t\t@mod_time_now = filename.mtime\n\t\t\trescue\n\t\t\t\t@mod_time_now = @mod_time_before = 0\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "b365f4ad46c5bddecc81b4370ebf07ee", "score": "0.5245559", "text": "def update_metadata\n Bioportal::Ontology.find_each do |bio_ontology|\n if onto_ontology = Ontology.where(repository_id: repository.id, basepath: bio_ontology.acronym).first\n onto_ontology.update_attributes \\\n description: bio_ontology.description,\n name: bio_ontology.name,\n category_ids: Ontohub.map_categories_to_ids(bio_ontology.categories.split \"\\n\")\n end\n end\n end", "title": "" }, { "docid": "4d3df63a3d96b850216a24ac227c92ba", "score": "0.52421033", "text": "def update!(**args)\n @content = args[:content] unless args[:content].nil?\n @object_type = args[:object_type] unless args[:object_type].nil?\n @original_content = args[:original_content] unless args[:original_content].nil?\n end", "title": "" }, { "docid": "fa028a2457935ecffee9218a1667891f", "score": "0.52343327", "text": "def requires_modified_files?\n false\n end", "title": "" }, { "docid": "a2a78fd049ec33551a040cfd70baabed", "score": "0.52332217", "text": "def copy_files\n super\n\n touch @update_filename\n end", "title": "" }, { "docid": "25c842602897aff862df9f1c002c5686", "score": "0.52254254", "text": "def index\n @utility_files = UtilityFile.all\n @utility_files.each do |file|\n file.description += '- *NO ENCONTRADO*' unless Pathname.new(file.filepath).exist?\n end\n end", "title": "" }, { "docid": "276b87cb7c56f430dfa852bd30714de9", "score": "0.52232903", "text": "def update!(**args)\n @kind = args[:kind] unless args[:kind].nil?\n @notes_export = args[:notes_export] unless args[:notes_export].nil?\n end", "title": "" }, { "docid": "a867dadb40ae0c4b8416d057fc1a9441", "score": "0.52217346", "text": "def file_modified\n end", "title": "" }, { "docid": "635c0684eff73f598dbbbe9e24b2074f", "score": "0.52208984", "text": "def modified!\n @modified = true\n end", "title": "" }, { "docid": "059e67436b7c2bb6e8c4fd1961019b0b", "score": "0.5218157", "text": "def update!(**args)\n @description = args[:description] unless args[:description].nil?\n @image = args[:image] unless args[:image].nil?\n @url = args[:url] unless args[:url].nil?\n end", "title": "" }, { "docid": "bdcab0c5889fcd18a4084ded80f72d8d", "score": "0.52155435", "text": "def apply_saved_metadata(fs, curation_concern)\n uf = ::Hyrax::UploadedFile.where(browse_everything_url: fs.import_url).first\n if uf.pcdm_use == ::FileSet::PRIMARY\n fs.pcdm_use = ::FileSet::PRIMARY\n fs.title = curation_concern.title\n else\n fs.pcdm_use = ::FileSet::SUPPLEMENTAL\n fs.title = Array.wrap(uf.title)\n fs.description = Array.wrap(uf.description)\n fs.file_type = uf.file_type\n end\n fs.save\n end", "title": "" }, { "docid": "b2474c47ae5d1239b9cdbc46fea4ebbf", "score": "0.5210527", "text": "def setCurrentFileModified\n if (!@CurrentOpenedFileModified)\n ensureUndoableOperation('Flag current project as modified') do\n atomicOperation(Controller::UAO_SetFileModified.new(self))\n end\n end\n end", "title": "" }, { "docid": "6ae407b84f8b2d7b8c39d268776fd041", "score": "0.52030885", "text": "def update!(**args)\n @file_set = args[:file_set] if args.key?(:file_set)\n end", "title": "" }, { "docid": "6ae407b84f8b2d7b8c39d268776fd041", "score": "0.52030885", "text": "def update!(**args)\n @file_set = args[:file_set] if args.key?(:file_set)\n end", "title": "" }, { "docid": "cea9572babd7504555de1cfaa6675719", "score": "0.52025765", "text": "def update!(**args)\n @content = args[:content] if args.key?(:content)\n @kind = args[:kind] if args.key?(:kind)\n @uploader_name = args[:uploader_name] if args.key?(:uploader_name)\n end", "title": "" }, { "docid": "29c299c7b126c391580ab89ba32340f6", "score": "0.5201999", "text": "def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n @digest = args[:digest] if args.key?(:digest)\n @is_executable = args[:is_executable] if args.key?(:is_executable)\n @node_properties = args[:node_properties] if args.key?(:node_properties)\n @path = args[:path] if args.key?(:path)\n end", "title": "" }, { "docid": "110ef8e316432becdfaeb44ec5ce7b91", "score": "0.519902", "text": "def update!(**args)\n @access_type = args[:access_type] if args.key?(:access_type)\n @debug_info = args[:debug_info] if args.key?(:debug_info)\n @document_id = args[:document_id] if args.key?(:document_id)\n @drive_document_metadata = args[:drive_document_metadata] if args.key?(:drive_document_metadata)\n @generic_url = args[:generic_url] if args.key?(:generic_url)\n @justification = args[:justification] if args.key?(:justification)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n @provenance = args[:provenance] if args.key?(:provenance)\n @reason = args[:reason] if args.key?(:reason)\n @snippet = args[:snippet] if args.key?(:snippet)\n @thumbnail_url = args[:thumbnail_url] if args.key?(:thumbnail_url)\n @title = args[:title] if args.key?(:title)\n @type = args[:type] if args.key?(:type)\n @url = args[:url] if args.key?(:url)\n end", "title": "" }, { "docid": "42f6970df96dff51e1bc68aef8e1425e", "score": "0.51978713", "text": "def update!(**args)\n @block_inheritance = args[:block_inheritance] if args.key?(:block_inheritance)\n @description = args[:description] if args.key?(:description)\n @etag = args[:etag] if args.key?(:etag)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @org_unit_id = args[:org_unit_id] if args.key?(:org_unit_id)\n @org_unit_path = args[:org_unit_path] if args.key?(:org_unit_path)\n @parent_org_unit_id = args[:parent_org_unit_id] if args.key?(:parent_org_unit_id)\n @parent_org_unit_path = args[:parent_org_unit_path] if args.key?(:parent_org_unit_path)\n end", "title": "" }, { "docid": "c484c7fcf59694091251b7085147426c", "score": "0.5195794", "text": "def update\n replace_entry \"xl/workbook.xml\", workbook.serialize(:save_with => 0)\n\n replace_entry \"xl/sharedStrings.xml\", sharedstrings.serialize(:save_with => 0)\n\n @worksheets.each_with_index do |worksheet, index|\n replace_entry worksheet, worksheets_xml[index].serialize(:save_with => 0) if worksheets_xml[index] \n end\n\n @charts.each_with_index do |chart, index|\n replace_entry chart, charts_xml[index].serialize(:save_with => 0) if charts_xml[index] \n end\n\n @drawings.each_with_index do |drawing, index|\n replace_entry drawing, drawings_xml[index].serialize(:save_with => 0) if drawings_xml[index] \n end \n\n @comments.each_with_index do |comment, index|\n replace_entry comment, comments_xml[index].serialize(:save_with => 0) if comments_xml[index] \n end \n end", "title": "" }, { "docid": "da5884498494b1f7e81e73bcabd684c2", "score": "0.51930535", "text": "def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @contents = args[:contents] if args.key?(:contents)\n @create_time = args[:create_time] if args.key?(:create_time)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @labels = args[:labels] if args.key?(:labels)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n @name = args[:name] if args.key?(:name)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "title": "" }, { "docid": "8871679320b91eb0d77a83ea28f3edc6", "score": "0.5184525", "text": "def update_file(params)\n self.processed = false\n self.attributes = params\n set_upload_attributes\n save!\n Document.delay.finalize_and_cleanup(id)\n end", "title": "" }, { "docid": "a97813c5b9dd68290ff0b4d00ece101f", "score": "0.51832634", "text": "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @description = args[:description] if args.key?(:description)\n @etag = args[:etag] if args.key?(:etag)\n @file_shares = args[:file_shares] if args.key?(:file_shares)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @networks = args[:networks] if args.key?(:networks)\n @state = args[:state] if args.key?(:state)\n @status_message = args[:status_message] if args.key?(:status_message)\n @tier = args[:tier] if args.key?(:tier)\n end", "title": "" }, { "docid": "c172454e5c23a8b8de528335b7982ccb", "score": "0.51764446", "text": "def update!(**args)\n @content = args[:content] unless args[:content].nil?\n @name = args[:name] unless args[:name].nil?\n end", "title": "" }, { "docid": "2574d8bce222f9eda509f1de3a398eeb", "score": "0.51746505", "text": "def update_metadata\n=begin\n if params[:generic_file][:lcsh_subject].present? and params[:generic_file][:other_subject].present?\n params[:generic_file][:other_subject] += params[:generic_file][:lcsh_subject]\n params[:generic_file].delete(:lcsh_subject)\n end\n=end\n\n params[:generic_file][:lcsh_subject].each_with_index do |s, index|\n #s.gsub!(/^[^(]+\\(/, '')\n if s.present?\n params[:generic_file][:lcsh_subject][index] = s.split('(').last\n params[:generic_file][:lcsh_subject][index].gsub!(/\\)$/, '')\n end\n end\n\n params[:generic_file][:homosaurus_subject].each do |s|\n s.gsub!(/^[^(]+\\(/, '')\n #s = s.split('(').last\n s.gsub!(/\\)$/, '')\n end\n\n params[:generic_file][:based_near].each do |s|\n s.gsub!(/^[^(]+\\(/, '')\n #s = s.split('(').last\n s.gsub!(/\\)$/, '')\n end\n\n if params[:generic_file][:other_subject].present?\n params[:generic_file][:other_subject].collect!{|x| x.strip || x }\n params[:generic_file][:other_subject].reject!{ |x| x.blank? }\n end\n\n if params[:generic_file][:lcsh_subject].present? and !params[:generic_file][:other_subject].nil?\n params[:generic_file][:other_subject] += params[:generic_file][:lcsh_subject]\n params[:generic_file].delete(:lcsh_subject)\n end\n\n if params[:generic_file][:homosaurus_subject].present? and !params[:generic_file][:other_subject].nil?\n params[:generic_file][:other_subject] += params[:generic_file][:homosaurus_subject]\n params[:generic_file].delete(:homosaurus_subject)\n end\n\n if params[:generic_file][:homosaurus_subject].present? and params[:generic_file][:lcsh_subject].present? and params[:generic_file][:other_subject].nil?\n params[:generic_file][:lcsh_subject] += params[:generic_file][:homosaurus_subject]\n params[:generic_file].delete(:homosaurus_subject)\n end\n\n if params[:generic_file][:title].present?\n params[:generic_file][:title] = [params[:generic_file][:title]]\n end\n\n if params[:generic_file][:creator].present?\n params[:generic_file][:creator].collect!{|x| x.strip || x }\n params[:generic_file][:creator].reject!{ |x| x.blank? }\n end\n\n if params[:generic_file][:contributor].present?\n params[:generic_file][:contributor].collect!{|x| x.strip || x }\n params[:generic_file][:contributor].reject!{ |x| x.blank? }\n end\n\n file_attributes = edit_form_class.model_attributes(params[:generic_file])\n #actor.update_metadata(file_attributes, params[:visibility])\n @generic_file.attributes = file_attributes\n @generic_file.visibility = params[:visibility]\n @generic_file.date_modified = DateTime.now\n end", "title": "" }, { "docid": "39daf6601ba9c324bf7a7ccd0a748178", "score": "0.517092", "text": "def update\n\t\t# should be updating params\n\t\t# @file.sanitize\n\t\tt = Fyle.new(file_params)\n\t\tRails.logger.info \"little t before #{t.inspect}\"\n\t\tt.sanitize\n\t\tRails.logger.info \"little t after #{t.inspect}\"\n\t\t# only re-divine content type if the URL has changed\n\t\tif (@file.URL != file_params[:URL]) or @file.type_negotiation.blank?\n\t\t\t# TODO communicate show result to user\n\t\t\tsupport = @file.divine_type\n\t\t\tRails.logger.info \"FilesController.update support: #{support}\"\n\t\t\tparams[:fyle][:type_negotiation] = @file.type_negotiation\n\t\tend\n\t\tparams[:fyle][:strip_start] = t.strip_start\n\t\tparams[:fyle][:strip_end] = t.strip_end\n\t\tRails.logger.info \"FilesController.update #{@file.inspect}\"\n\t\tRails.logger.info \"waahaa #{file_params}\"\n respond_to do |format|\n if @file.update(file_params)\n format.html { redirect_to @file, notice: 'Text file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "33016dad9eecc97692662bc0c43fd37a", "score": "0.5170675", "text": "def update!(**args)\n @write_metadata = args[:write_metadata] if args.key?(:write_metadata)\n end", "title": "" }, { "docid": "33016dad9eecc97692662bc0c43fd37a", "score": "0.5170675", "text": "def update!(**args)\n @write_metadata = args[:write_metadata] if args.key?(:write_metadata)\n end", "title": "" }, { "docid": "94519090fe7c09938d6ed32a486e93bf", "score": "0.51677483", "text": "def update!(**args)\n @creation_time = args[:creation_time] if args.key?(:creation_time)\n @description = args[:description] if args.key?(:description)\n @name = args[:name] if args.key?(:name)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n @state = args[:state] if args.key?(:state)\n end", "title": "" }, { "docid": "24edc9cc1f64584946811fcc8d64431b", "score": "0.5162073", "text": "def overwrite\n if @ok\n params_with_standard_keys('edit')\n @redirect = false\n @image.enter_edit_mode current_user.id\n @image.title = params[:title]\n @image.description = params[:description]\n @image.tags = params[:tags]\n @image.media = File.open @image.current_editing_image\n @image.save_tags = true\n if [email protected]\n @errors = convert_media_element_error_messages(@image.errors)\n else\n MediaElementsSlide.where(:media_element_id => @image.id).each do |mes|\n mes.alignment = 0\n mes.save\n end\n end\n else\n @redirect = true\n end\n render 'media_elements/info_form_in_editor/save'\n end", "title": "" }, { "docid": "7ecdffc89a0a93834c657d9176f77f04", "score": "0.51488256", "text": "def test_modify\n copy_datafiles\n devel = make_repo(\"development\", { :descr => \"New description\" })\n current_values = devel.retrieve\n\n assert_equal(\"development\", devel[:name])\n assert_equal('Fedora Core $releasever - Development Tree', current_values[devel.property(:descr)])\n assert_equal('New description', devel.property(:descr).should)\n assert_apply(devel)\n\n inifile = Puppet::Type.type(:yumrepo).read\n assert_equal('New description', inifile['development']['name'])\n assert_equal('Fedora Core $releasever - $basearch - Base', inifile['base']['name'])\n assert_equal(\"foo\\n bar\\n baz\", inifile['base']['exclude'])\n assert_equal(['base', 'development', 'main'], all_sections(inifile))\n end", "title": "" }, { "docid": "0f985618b7010a111048bd8ac1d1d7c0", "score": "0.51469195", "text": "def update!(**args)\n @content = args[:content] if args.key?(:content)\n @kind = args[:kind] if args.key?(:kind)\n @locale = args[:locale] if args.key?(:locale)\n @uploader_name = args[:uploader_name] if args.key?(:uploader_name)\n end", "title": "" }, { "docid": "7fe3db440b675578be31612aacafdeb4", "score": "0.51436", "text": "def update_contents(*args); end", "title": "" }, { "docid": "ac1b7f9c1ce4151999c99e0b645101d2", "score": "0.51424885", "text": "def update_content()\n # Read again the content\n new_content = self.backend.read()\n new_hash = self.class.parse_configuration(new_content)\n \n content_updated = false\n \n # For each stanza (Hash.each, not StanzaParsedFile.each)... nil values\n # are also considered\n self.target_hash.each { |stanza_key, stanza|\n # If stanza is nil, the stanza must be deleted\n if stanza.nil?\n new_content = self.class.delete_stanza(stanza_key, new_content)\n content_updated = true\n next\n end\n \n # if stanza is not currently present, add it\n if not new_hash[stanza_key]\n new_hash[stanza_key] = stanza\n new_hash[stanza_key].is_modified = true\n else\n # Update modified values\n new_hash[stanza_key].merge(stanza)\n end\n \n if new_hash[stanza_key].modified?\n new_content = self.class.update_stanza(stanza_key, new_hash[stanza_key].to_s, new_content)\n content_updated = true\n end\n }\n \n # Write it to disk\n if content_updated\n @target_content = new_content\n end\n \n content_updated\n end", "title": "" } ]
6933b77ae4d5f9d862e91cc1462060a3
walking over arrays and symbolizing all nested elements
[ { "docid": "74ba4b55486add3e417a88773cf888c4", "score": "0.0", "text": "def array(ary, &block)\n ary.map { |v| _recurse_(v, &block) }\n end", "title": "" } ]
[ { "docid": "6938a04f58e70c7cb16b6fe4f0ab1f83", "score": "0.6912671", "text": "def nested(array)\n\tarray.map! { |i| \n\t\tif i.is_a?(Integer)\n\t\t\ti + 5 \n\t\telsif i.is_a?(Array)\n\t\t\ti.map! { |x| x + 5}\n\t\tend\n\t\t}\t\n\tp array\nend", "title": "" }, { "docid": "ef606975972471145a8bbb74be5c4115", "score": "0.67369837", "text": "def recurse_over_array(array)\n array.map do |a|\n if a.is_a? Hash\n self.class.new(a, :recurse_over_arrays => true, :mutate_input_hash => true)\n elsif a.is_a? Array\n recurse_over_array a\n else\n a\n end\n end\n end", "title": "" }, { "docid": "ef606975972471145a8bbb74be5c4115", "score": "0.67369837", "text": "def recurse_over_array(array)\n array.map do |a|\n if a.is_a? Hash\n self.class.new(a, :recurse_over_arrays => true, :mutate_input_hash => true)\n elsif a.is_a? Array\n recurse_over_array a\n else\n a\n end\n end\n end", "title": "" }, { "docid": "44e65cfe63f6bddd8a5e51dd2d9beac2", "score": "0.66683024", "text": "def my_flatten\n return self if self.flatten == self\n new_arr = []\n self.each do |ele|\n if ele.kind_of?(Array)\n ele.length.times{new_arr << ele.shift}\n else\n new_arr << ele\n end\n end\n new_arr.my_flatten\nend", "title": "" }, { "docid": "b5654229ade09ca9d1455484d0575723", "score": "0.66467845", "text": "def nested_arrays(arr)\n arr.each do |element|\n if element.is_a? String\n p element + \"ly\"\n else\n nested_arrays(element)\n end \n end\nend", "title": "" }, { "docid": "bd89a70245b59a69be4db47fb3551e1d", "score": "0.6602109", "text": "def flatten_iterative arr\n results = []\n queue = []\n\n # top level iteratio is O(n)\n arr.each do |el|\n if el.class == Array\n queue.push el\n else\n results.push el\n end\n\n # this while loop varies in time complexity depending on how deep a nested array goes\n while queue.length > 0\n nested_arr = queue.first\n if nested_arr.first.class == Array\n queue.unshift nested_arr.shift\n next\n elsif nested_arr.length == 0\n queue.shift\n else\n results.push nested_arr.shift\n end\n end\n end\n return results\nend", "title": "" }, { "docid": "7c33974405646545535c9d3e9eabedd7", "score": "0.6583329", "text": "def flatten(arr)\n return arr if arr.count == 0\n answer = []\n (arr.count).times do |counter|\n if arr[counter].respond_to? :each # Duck typing preferred in Ruby?\n inner_array = flatten(arr[counter])\n (inner_array.count).times do |counter_inner|\n answer << inner_array[counter_inner]\n end\n else\n answer << arr[counter]\n end\n end\n answer\nend", "title": "" }, { "docid": "146093fd66a3db52dd4a50b4cc168e19", "score": "0.65349203", "text": "def inner_array_ly(inner)\n\tinner.map! { |value|\n \tif value.kind_of?(Array)\n \t\tinner_array_ly(value)\n \telse\n\t\t\tvalue.to_s + \"ly\"\n \t}\n end", "title": "" }, { "docid": "b5f66a7b3b3c280c1195907b41d105d8", "score": "0.6491531", "text": "def flatten!\n modified = false\n memo = nil\n i = 0\n\n while i < self.length do\n sub_array = self.at i\n if sub_array.respond_to? :to_ary then\n sub_array = sub_array.to_ary\n memo = Array.new if memo.nil?\n i += help_flatten i, sub_array, memo\n modified = true\n end\n i += 1\n end\n\n return nil unless modified\n return self\n end", "title": "" }, { "docid": "a3b720d45af386b60c12347fa6b29bd3", "score": "0.6434369", "text": "def my_controlled_flatten(level = nil) # 3 times \n return self if level < 1 \n flattend_result = [] \n\n self.each do |elm|\n if elm.is_a?(Array)\n flattend_result += elm.my_controlled_flatten(level - 1)\n else \n flattend_result << elm \n end\n end\n\n flattend_result\n end", "title": "" }, { "docid": "3571ba1fc9cbea9a02ddae40999428d0", "score": "0.6432664", "text": "def flattener(arr, result = [])\n arr.each do |element|\n if element.instance_of?(Array)\n flattener(element, result)\n else\n result << element\n end\n end\n result\nend", "title": "" }, { "docid": "75eac57480882cd81d8234f25d61d486", "score": "0.6379187", "text": "def two_d_translate(arr)\n\n arr.each do |subArr|\n subArr.each do |ele1|\n puts ele1\n \n end \n end\n\nend", "title": "" }, { "docid": "cece336a8f0bfd212752e32b6dde5b34", "score": "0.6376699", "text": "def my_flatten\n each_with_object([]) do |el, flattened|\n flattened.push *(el.is_a?(Array) ? el.my_flatten : el)\n end\n\n end", "title": "" }, { "docid": "e8cf010d99c63c109d9bdb934c70232a", "score": "0.6373426", "text": "def my_flatten\n results = []\n self.my_each do |ele|\n if ele.is_a?(Array)\n results += ele.my_flatten\n else\n results += [ele]\n end\n end\n return results\n end", "title": "" }, { "docid": "a0d8cfa20bcd5f7205e54650804a2205", "score": "0.6316532", "text": "def flatten(array)\nend", "title": "" }, { "docid": "d4bc0cbeaab82bcb52b52c0e4e0c3449", "score": "0.6310763", "text": "def my_flatten\n results = []\n (0..self.length-1).each do |i|\n if self[i].class == Array\n results += self[i].my_flatten\n else\n results << self[i]\n end\n end\n results\n end", "title": "" }, { "docid": "a7ae80b42bc2f8666ced8dbf22f6263a", "score": "0.62808305", "text": "def my_flatten\n flattened = []\n\n self.my_each do |el|\n if el.is_a?(Array)\n flattened += el.my_flatten\n else\n flattened << el\n end\n end\n\n flattened\n end", "title": "" }, { "docid": "305ca785110436d650ffc689b8ec5614", "score": "0.62727237", "text": "def my_flatten(arr)\n res = []\n arr.each do |el|\n if el.is_a?(Array)\n res.concat(my_flatten(el))\n else\n res.push(el)\n end\n p res\n end\n\n res\nend", "title": "" }, { "docid": "26669e5691b0d751c55c0b845f55fb3d", "score": "0.625686", "text": "def flatten(array)\n\nend", "title": "" }, { "docid": "5bdb26348800a18a750d9d4467e5cd9d", "score": "0.62374055", "text": "def flatten!; end", "title": "" }, { "docid": "7976ad66774e653fc9dae1ff45adf5a2", "score": "0.62303394", "text": "def buy_fruit(nested_arr)\n\n\tnested_arr.map {|fruit, num| [fruit] * num }.flatten!\n\nend", "title": "" }, { "docid": "c0a1866e3c320836f1c07adaca07cef1", "score": "0.6161837", "text": "def my_flatten\n flattened = []\n self.each do |ele|\n if !ele.is_a?(Array)\n flattened << ele\n else\n flattened += ele.my_flatten\n end\n end\n\n flattened \n end", "title": "" }, { "docid": "1ad7d8cf16b4fdb764476a29108301ac", "score": "0.61515623", "text": "def buy_fruit(nested_arr)\n output = []\n nested_arr.each do |array|\n array[1].times { output << array[0] }\n end \n output\nend", "title": "" }, { "docid": "7c7331fffa6badf6298bb6b7679ccc70", "score": "0.6146199", "text": "def my_flatten\n new_arr = []\n self.my_each { |e| e.is_a?(Array) ? new_arr += e.my_flatten : new_arr << e }\n new_arr\n end", "title": "" }, { "docid": "49ca8eb140a14b74dd6ff4a062da0d7f", "score": "0.61385185", "text": "def flatten_deeper(array)\n array.collect { |element| element.respond_to?(:flatten) ? element.flatten : element }.flatten\n end", "title": "" }, { "docid": "49ca8eb140a14b74dd6ff4a062da0d7f", "score": "0.61385185", "text": "def flatten_deeper(array)\n array.collect { |element| element.respond_to?(:flatten) ? element.flatten : element }.flatten\n end", "title": "" }, { "docid": "ea740f38eaf0f51ac85ab5f5bb5ef71c", "score": "0.61366725", "text": "def my_flatten\n arr = []\n self.each do |var|\n unless var.class == Array\n arr << var\n else\n arr += var.my_flatten\n end\n end\n arr\nend", "title": "" }, { "docid": "850afd6105f9eef1b629c950c74c6884", "score": "0.6117783", "text": "def deep_dup(arr)\n arr.map do |ele|\n if ele.is_a?(Array)\n deep_dup(ele)\n else\n ele\n end\n end\nend", "title": "" }, { "docid": "8b2d75392df42902c26dadfcc20c0612", "score": "0.609525", "text": "def my_flatten\n flattened = []\n\n my_each do |el|\n if el.is_a?(Array)\n flattened.concat(el.my_flatten)\n else\n flattened << el\n end\n end\n\n flattened\n end", "title": "" }, { "docid": "e838c1a4fdfc2b9ec686a1a233042315", "score": "0.6078917", "text": "def flattenonce\n result = []\n self.each do |subarray|\n result += subarray\n end\n return result\n end", "title": "" }, { "docid": "e20acb292b191806270361c5697d7a9a", "score": "0.60701185", "text": "def flatten_vertically(arrs); end", "title": "" }, { "docid": "5b330396a8c875d562d013f1366d52a3", "score": "0.6069434", "text": "def visit_Array(o, parent)\n o.map { |v| can_visit?(v) ? visit(v, parent) : v }.flatten\n end", "title": "" }, { "docid": "5b330396a8c875d562d013f1366d52a3", "score": "0.6069434", "text": "def visit_Array(o, parent)\n o.map { |v| can_visit?(v) ? visit(v, parent) : v }.flatten\n end", "title": "" }, { "docid": "e0e573227e15c2da5f8afcd93360115e", "score": "0.6068278", "text": "def flatten!(depth=nil)\n modified = false\n ar = []\n idx = 0\n len = size\n while idx < len\n e = self[idx]\n if e.is_a?(Array) && (depth.nil? || depth > 0)\n ar += e.flatten(depth.nil? ? nil : depth - 1)\n modified = true\n else\n ar << e\n end\n idx += 1\n end\n if modified\n self.replace(ar)\n else\n nil\n end\n end", "title": "" }, { "docid": "334a705abc58dba3b145d5dce5200909", "score": "0.6066473", "text": "def asciitree(an_array, level=0)\n an_array.each do |a|\n if Array == a.class\n if Array == a.first.class\n prefix = (\"|-- \"*level) + \"|-- v\"\n (level+1).times { prefix.gsub!('|-- |', '| |') }\n puts prefix\n end\n asciitree(a, level+1)\n else\n prefix = \"|-- \"*level\n level.times { prefix.gsub!('|-- |', '| |') }\n puts prefix + a.to_s\n end\n end\nend", "title": "" }, { "docid": "3df389ac031e23ccb13d2adbfdc72952", "score": "0.60662454", "text": "def flatten(array)\n\n @new_array = []\n \n array.each do |element|\n unless element.is_a? Array\n @new_array << element\n else\n element.each do |element_zoom| \n @new_array << element_zoom\n end\n end\n end\n @new_array\n\nend", "title": "" }, { "docid": "9179f0fea9ca3a547ef965c760567079", "score": "0.6065619", "text": "def home\n\n initial_array = [[1,2,[3,4,[5,6]]],7]\n @result_array = recursive_flatten_array(initial_array)\n end", "title": "" }, { "docid": "0e44c7009af1a9b7e74ba30281caf739", "score": "0.60652375", "text": "def rec_flatten(arr)\n result = []\n # debugger\n return arr if arr.empty?\n arr.each do |el|\n if el.is_a?(Array)\n result += rec_flatten(el)\n else\n result << el\n end\n end\n result\n end", "title": "" }, { "docid": "83101936faf98011bec9f86cea1e877c", "score": "0.60426253", "text": "def flatten!\n `var flatten=function(ary){for(var i=0,l=ary.length,result=[];i<l;++i){if(ary[i].m$class()==c$Array){result=result.concat(ary[i].m$flatten());}else{result.push(ary[i]);};};return result;}`\n `for(var i=0,l=this.length,result=[];i<l;++i){if(this[i].m$class()==c$Array){result=result.concat(flatten(this[i]));}else{result.push(this[i]);};}`\n return `l==result.length?nil:this._replace(result)`\n end", "title": "" }, { "docid": "54ff722f8a9dc9b8b1e686c625218572", "score": "0.60416025", "text": "def flatten(array, result = []) # flatten nested arrays\n array.each do |element|\n if element.kind_of?(Array)\n flatten(element, result)\n else\n result << element\n end\n end \n result\nend", "title": "" }, { "docid": "d5566b181ef146c8cd55b96c092637ed", "score": "0.60223025", "text": "def flatten(arr)\n\treturn \n\tflatten(arr[0]) + flatten(arr[0 + 1])\nend", "title": "" }, { "docid": "0b9b4f389ed1fc99174ff2d09c42d299", "score": "0.6014669", "text": "def my_flatten\n flat = []\n\n self.each do |x|\n if x.class != Array\n flat << x\n else\n sub_array = x.my_flatten\n flat.concat(sub_array)\n end\n end\n\n flat\n end", "title": "" }, { "docid": "b7a40bf54d5cba1be9731f1e39b350ad", "score": "0.60133827", "text": "def my_flatten\n return self if none? { |el| el.is_a?(Array) }\n res = []\n\n each do |el|\n res += el.is_a?(Array) ? el.my_flatten : [el]\n end\n\n res\n end", "title": "" }, { "docid": "5da919db316efec8d8d1c7584c089de7", "score": "0.60118425", "text": "def deep_dup(arr)\n arr.map do |el|\n if el.is_a? Array\n deep_dup(el)\n else\n el\n end\n end\nend", "title": "" }, { "docid": "7f67cf0378a34a216ffc9aa32b7915b5", "score": "0.6001609", "text": "def flatten_out(a)\n a.each {|x|\n a = Array.new\n if x.class!=Array\n a << e\n else\n a << flatten-out(x)\n end\n }\n\n end", "title": "" }, { "docid": "33588fc29bf785f9de0b3f5dd2331792", "score": "0.599796", "text": "def deep_dup(arr)\n arr.map do |ele| \n if ele.is_a?(Array)\n deep_dup(ele)\n else \n ele\n end\n end\nend", "title": "" }, { "docid": "a820d46230bcce65e586838a4e77e21d", "score": "0.5992823", "text": "def flatten(array, result = []) # defining result here is the KEY\n array.each do |element|\n if element.is_a? Array #.is_a? same with .kind_of?\n flatten(element, result)\n else\n result << element\n end\n end\n result\nend", "title": "" }, { "docid": "8c5361a8f3e81f57f08820bd44b62b1d", "score": "0.5970597", "text": "def my_flatten\n self.reduce([]) do |accum, el|\n if el.is_a? Array\n accum += el.my_flatten\n else\n accum << el\n end\n end\n end", "title": "" }, { "docid": "9f24e4c351ff77babd5ff55425e7f242", "score": "0.5959832", "text": "def flatten(array)\n result = []\n array.each do |item|\n if item.is_a?(Array)\n flatten(item).each do |e|\n result << e\n end \n else\n result << item\n end \n end\n result\nend", "title": "" }, { "docid": "3be8257358e347f43aabebd55131dfb9", "score": "0.59590024", "text": "def flatten_array(array)\n flat = []\n array.each do |element|\n if element.kind_of?(Array)\n flat += flatten_array(element)\n else\n flat << element\n end\n end\n flat\nend", "title": "" }, { "docid": "81564af3152d1bad467054a8804168e7", "score": "0.59559673", "text": "def recurse_flatten(arr)\n accumulator = []\n # output_array.concat(check_sub_array(el))\n if arr.kind_of?(Array)\n arr.each do |arr|\n accumulator.concat(recurse_flatten(arr))\n end\n else\n accumulator.concat([arr])\n end\n\n return accumulator\n end", "title": "" }, { "docid": "14de4c99e0879e4b8436a7fcda093fe8", "score": "0.5947173", "text": "def flatten_once(ary)\n a = []; ary.each{|e| e.kind_of?(Array) ? a += e : a << e }; a\n end", "title": "" }, { "docid": "4cfd15aa8fb3525526fb423c6a5b1710", "score": "0.5943731", "text": "def recurs_to_a(array)\n if array.is_a?(Array)\n array.map do | l |\n if l.is_a?(Sass::Script::Value::Map)\n # if map, recurse to hash\n l = recurs_to_h(l)\n elsif l.is_a?(Sass::Script::Value::List)\n # if list, recurse to array\n l = recurs_to_a(l)\n elsif l.is_a?(Sass::Script::Value::Bool)\n # convert to bool\n l = l.to_bool\n elsif l.is_a?(Sass::Script::Value::Number)\n # if it's a unitless number, convert to ruby val\n if l.unitless?\n l = l.value\n # else convert to string\n else\n l = u(l)\n end\n elsif l.is_a?(Sass::Script::Value::Color)\n # get hex/rgba value for color\n l = l.inspect\n else\n # convert to string\n l = u(l)\n end\n l\n end\n else\n recurs_to_a(array.to_a)\n end\n end", "title": "" }, { "docid": "0b0aa3fd1aaa078b6c0b0f0ef59e77ed", "score": "0.59399307", "text": "def flatten(arr, result = [])\n arr.each do |nested|\n if nested.is_a?(Array)\n flatten(nested, result)\n else\n result << nested\n end\n end\n \n result\nend", "title": "" }, { "docid": "8bd0a5e9545c4b7a0c38efd8c4efbc13", "score": "0.59361285", "text": "def recurs_to_a(array)\n if array.is_a?(Array)\n array.map do | l |\n case l\n when Sass::Script::Value::Map\n # If map, recurse to hash\n l = recurs_to_h(l)\n when Sass::Script::Value::List\n # If list, recurse to array\n l = recurs_to_a(l)\n when Sass::Script::Value::Bool\n # Convert to bool\n l = l.to_bool\n when Sass::Script::Value::Number\n # If it's a unitless number, convert to ruby val, else convert to string\n l.unitless? ? l = l.value : l = u(l)\n when Sass::Script::Value::Color\n # Get hex/rgba value for color\n l = l.inspect\n else\n # Convert to string\n l = u(l)\n end\n l\n end\n else\n recurs_to_a(array.to_a)\n end\n end", "title": "" }, { "docid": "9039b7f63c54cc6261209de50d79cbe4", "score": "0.59219813", "text": "def recurse_over_array(array)\n array.each_with_index do |a, i|\n if a.is_a?(Hash)\n array[i] = Child.new(\n a,\n recurse_over_arrays: true,\n mutate_input_hash: true,\n preserve_original_keys: @preserve_original_keys\n )\n elsif a.is_a?(Array)\n array[i] = recurse_over_array(a)\n end\n end\n array\n end", "title": "" }, { "docid": "69c12ef0395dd74c707e4c61125d85d7", "score": "0.5914407", "text": "def flatten(arr)\n i = 0\n while i < arr.length\n\n if arr[i].class == Array\n current = arr[i]\n arr.delete_at(i)\n flatten(current).each do |el|\n arr.insert(i, el)\n i += 1\n end\n next\n end\n\n i += 1\n end\n\n arr\nend", "title": "" }, { "docid": "557664da6efd3e83b9974a6b3e4547b5", "score": "0.5913218", "text": "def deep_dup(arr)\n arr.map { |el| el.is_a?(Array) ? deep_dup(el) : el } \nend", "title": "" }, { "docid": "fe9437b3eac615b406756f9856945a42", "score": "0.591319", "text": "def visit_array(node); end", "title": "" }, { "docid": "c8f0c7a206d434cc3c10f26114f9aa6c", "score": "0.5908237", "text": "def flatten_deeper(array)\n array.collect do\n |element| (element.respond_to?(:flatten) && !element.is_a?(Hash)) ? element.flatten : element\n end.flatten\n end", "title": "" }, { "docid": "5e64129948dc9051594be37c7f04bcf6", "score": "0.58969605", "text": "def flatten_array(ary, new_ary)\n \n ary.each do |a| \n if a.is_a? Array \n flatten_array(a, new_ary)\n else\n new_ary.push a\n end \n end\n new_ary\nend", "title": "" }, { "docid": "cca00144d6bf519c1a7dbe0e45a16715", "score": "0.588561", "text": "def process_array(builder, arry)\n arry.each do |value|\n if value.is_a?(Hash)\n process_hash(builder, value)\n elsif value.is_a?(Array)\n\n process_array(builder, value)\n else\n builder.__send__(value)\n end\n end\nend", "title": "" }, { "docid": "0894e829b28557d0c5d0fbb6221dc452", "score": "0.5881285", "text": "def flatten_deeper(array)\n array.collect { |element| element.respond_to?(:flatten) ? element.flatten : element }.flatten\n end", "title": "" }, { "docid": "a76f703c9f5b6f1df794ef5f24885da9", "score": "0.587818", "text": "def flatten\n `for(var i=0,l=this.length,result=[];i<l;++i){if(this[i].m$class()==c$Array){result=result.concat(this[i].m$flatten());}else{result.push(this[i]);};}`\n return `result`\n end", "title": "" }, { "docid": "23dbc63c19f65fd24b430575ea8a6822", "score": "0.58781785", "text": "def flatten(array)\n new_array = Array.new\n array.each do |elem|\n if elem.kind_of?(Array)\n elem.each do |array_elem|\n new_array.push(array_elem)\n end\n else\n new_array.push(elem)\n end\n end\n new_array\nend", "title": "" }, { "docid": "57249d5017ab9a46ff837934ab7db7bc", "score": "0.58776855", "text": "def flatten(arr, flatten_arr=[])\n # Looping through all the elements of the given array \n arr.each do |elem|\n # If the element is an array, the function calls itself recursevly and flattens the sub-array\n if elem.class == Array\n flatten(elem,flatten_arr)\n # If the element is integer, we push it to the flatten array \n else\n flatten_arr.push(elem)\n end \n end \n # Returning the flattened array\n flatten_arr\n end", "title": "" }, { "docid": "b2c4882d133e898271b772a4fe5de12a", "score": "0.5874083", "text": "def two_d_translate(arr)\n # Create an empty array\n new_arr = []\n\n # 1st Level: Looking at each element (these are also arrays)\n arr.each do |subArray|\n ele = subArray[0]\t# always the string of the array\n num = subArray[1]\t# alway the number of the array\n\n # Shovels the ele into the empty array by the num\n num.times { new_arr << ele }\n end\n\n return new_arr\nend", "title": "" }, { "docid": "07d96513675443fc3a99d31139ea153a", "score": "0.5871234", "text": "def flatten(arr, result = [])\n arr.each do |el|\n # check if the element is itself an array\n # (meaning the array is not flatten yet)\n if el.is_a?(Array)\n # if yes, call the function again on this specific array\n # saving the result (if it exist) as the second argument\n flatten(el, result)\n else\n # if no, this specific array is flatten,\n # so we can put the element in result\n result << el\n end\n end\n\n result\nend", "title": "" }, { "docid": "2db52fe832130c2e74327abd9c668ca2", "score": "0.58554155", "text": "def flatten two_d_array, new_array=[]\n two_d_array.each {|thing|\n if thing.is_a? Array\n flatten(thing, new_array)\n else\n new_array << thing\n end\n }\n return new_array\nend", "title": "" }, { "docid": "9c94e369f414f35fb0b6e75af31b896f", "score": "0.5852031", "text": "def flatten_a_o_a(aoa)\n result = []\n aoa_i = 0\n while aoa_i < aoa.length do\n inner_i = 0\n while inner_i < aoa[aoa_i].length do\n result << aoa[aoa_i][inner_i]\n inner_i += 1\n end\n aoa_i += 1\n end\n result\nend", "title": "" }, { "docid": "24a5317eadeb32664e9fb2beba4e59df", "score": "0.5848666", "text": "def flatten level=nil\n #STDERR.puts \"FLATTEN: #{self.inspect}\"\n n = []\n l = level\n each do |e|\n l\n n\n if e.is_a?(Array)\n # FIXME: the \"e.flatten(l-1)\" was mis-parsed without the whitespace.\n if l\n e = e.flatten(l - 1) if l > 1\n else\n e = e.flatten\n end\n n.concat(e)\n else\n n << e\n end\n end\n n\n end", "title": "" }, { "docid": "219f065866ccbe6193c223f333121077", "score": "0.5840269", "text": "def buy_fruit(array)\n nested_list = array.map { |subarray| [subarray[0]] * subarray[1] }\n nested_list.flatten\nend", "title": "" }, { "docid": "1630a03c86cbc82eefe3ee703ba2a76d", "score": "0.58399445", "text": "def recursive_flatten(array, results = [])\n array.each do |element|\n if element.class == Array\n recursive_flatten(element, results)\n else\n results << element\n end\n end\n results\n end", "title": "" }, { "docid": "d65052a9075b10ac76339a67339522e2", "score": "0.58333117", "text": "def my_flatten_inorder!\n idx = 0\n while idx < length\n if at(idx).respond_to? :to_ary\n # If current element isn't flat, replace it with its own flattened sub-\n # elements.\n elm = delete_at idx\n insert idx, *(elm.to_ary)\n else\n idx += 1\n end\n end\n self\n end", "title": "" }, { "docid": "eeae8c5a74d3c17989bfd5bd399a6f31", "score": "0.5833118", "text": "def two_d_translate(arr)\n\tcount = 0\n \tarry = []\n arr.each do |subarray|\n count = subarray[1]\n subarray.each do |elem|\n while count > 0\n arry << subarray[0]\n count -= 1\n end\n end\n end\n return arry\nend", "title": "" }, { "docid": "5d561d7a353347af2c02aade488012b6", "score": "0.5832983", "text": "def flatten\n\n\t\[email protected]\n\tend", "title": "" }, { "docid": "74353beef9ded501f577545f67c71523", "score": "0.58131593", "text": "def unflatten(array)\n out = {}\n array.each do |k,v|\n path = [k.split(\"[\").first] + k.scan(/\\[(.*?)\\]/).flatten\n c = out\n\n set = proc { |v,weak| } # Do nothing for the first level\n\n path.each do |i|\n case i\n when \"\" # Array\n set.([], true)\n set = proc do |v,weak|\n c << v\n c = c.last\n end\n else # Hash\n set.({}, true)\n set = proc do |v,weak|\n c[i] ||= v\n c[i] = v if !weak\n c = c[i]\n end\n end\n end\n set.(v, false)\n\n end\n out\n end", "title": "" }, { "docid": "9fc9788b9e26c4a0faa65124ae37a2f0", "score": "0.58131313", "text": "def deep_dup(arr)\n result = []\n arr.each do |ele|\n if ele.is_a?(Array)\n result << deep_dup(ele)\n else\n result << ele\n end\n end\n result\nend", "title": "" }, { "docid": "2979801b2f942726bdf616c80ded55b9", "score": "0.58107203", "text": "def flatten\n array = self\n while array.class.eql?(Array) && array[0].class.eql?(Array)\n array = array[0]\n end\n\n array\n end", "title": "" }, { "docid": "65fd0d64ec17f774f0cf93f593ba001f", "score": "0.5808355", "text": "def my_flatten(arr, level = -1)\n arr = arr.dup\n \n loop do\n break if level.zero?\n level -= 1\n \n res = []\n flag = true\n \n arr.each do |val|\n if val.is_a?(Array)\n res += val\n flag = flag && val.all? { |sub_val| !sub_val.is_a?(Array) }\n else\n res << val\n end\n end\n \n arr = res\n break if flag\n end\n \n arr\nend", "title": "" }, { "docid": "9612009cfe8779c40d81a41885bda1bd", "score": "0.58038974", "text": "def unnest(any_array)\n Arel::Nodes::NamedFunction.new(\"unnest\", [any_array])\n end", "title": "" }, { "docid": "175a8d6a31112968bc05023c9ec213c5", "score": "0.57990104", "text": "def double_array(array)\n\t[array*2].flatten\nend", "title": "" }, { "docid": "e18bd3dee0324bfabc708d1c5fc741af", "score": "0.57989293", "text": "def flat_map; end", "title": "" }, { "docid": "d6687564f7e1c0bb3a79ee1774f39b18", "score": "0.57948065", "text": "def flatten(array, result = [])\n array.each do |element|\n if element.kind_of?(Array)\n flatten(element, result)\n else\n result << element\n end\n end \n result\nend", "title": "" }, { "docid": "26eed582391edc3975d7405545f1f95d", "score": "0.57837933", "text": "def make_array_flat(arr, new_arr=[])\n\n # Loop continues if Array found\n # Loop will find integers and push them to new array\n arr.each do |a|\n if a.is_a? Array\n make_array_flat(a, new_arr)\n else\n new_arr << a\n end\n end\n\n new_arr\nend", "title": "" }, { "docid": "a7af32e16a202768bc2e97d39a7325be", "score": "0.5783739", "text": "def flatten(arr, result = [])\n arr.each do |ele|\n if ele.class == Array\n flatten(ele, result)\n else\n result << ele\n end\n end\n result\nend", "title": "" }, { "docid": "071435e6c8e5f10edfae7a873177d2e1", "score": "0.577424", "text": "def recursively_symbolize_keys!\n self.symbolize_keys!\n self.values.each do |v|\n if v.is_a? Hash\n v.recursively_symbolize_keys!\n elsif v.is_a? Array\n #v.recursively_symbolize_keys!\n end\n end\n self\n end", "title": "" }, { "docid": "13ae16fba96ebddbadcef1cda9b953ba", "score": "0.5768735", "text": "def flatten\n\n\t\tr = []\n\n\t\[email protected] do |key, values|\n\n\t\t\tif values.empty?\n\n\t\t\t\tr << key << []\n\t\t\telse\n\n\t\t\t\tvalues.each do |value|\n\n\t\t\t\t\tr << key << value\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tr\n\tend", "title": "" }, { "docid": "346a9c96c2781bfdf1f6bd9cd3ffede7", "score": "0.57683045", "text": "def using_flatten (arrays)\n arrays.flatten\nend", "title": "" }, { "docid": "a48750337a3efe9dc28a6d85bd808ebf", "score": "0.57656676", "text": "def flattenor(array, result = [])\n\tarray.each do |element|\n\t\tif element.kind_of? Array\n\t\t\tflattenor(element, result)\n\t\telse\n\t\t\tresult << element\n\t\tend\n\tend\n\tresult\n\nend", "title": "" }, { "docid": "daacd9cb83c8cedfc44fe6f4e9497732", "score": "0.5764933", "text": "def deep_dup(array)\n array.map { |elm| elm.is_a?(Array) ? deep_dup(elm) : elm }\nend", "title": "" }, { "docid": "fdc3058f266d16c084921a3a7d9c6a40", "score": "0.57649124", "text": "def deep_dup(arr)\n arr.map { |ele| ele.is_a?(Array) ? deep_dup(ele) : ele }\nend", "title": "" }, { "docid": "fdc3058f266d16c084921a3a7d9c6a40", "score": "0.57649124", "text": "def deep_dup(arr)\n arr.map { |ele| ele.is_a?(Array) ? deep_dup(ele) : ele }\nend", "title": "" }, { "docid": "8207c3ac16bc03b8061b32846277d31a", "score": "0.575873", "text": "def deep_dup(arr)\n arr.map{|el| el.is_a?(Array) ? deep_dup(el) : el}\nend", "title": "" }, { "docid": "5969a9539ad7ada03b8f32f25f34fa12", "score": "0.5758651", "text": "def deep_dup(array)\n flat = []\n return [array] unless array.is_a?(Array)\n array.each do |ele|\n flat += deep_dup(ele)\n end\n flat\nend", "title": "" }, { "docid": "923c3de3cb24fbd3bab2a57f9796ab55", "score": "0.5757657", "text": "def flatten(array)\n answer = Array.new\n array.each { |arr| arr.is_a?(Array) ? arr.each { |obj| answer << obj } : answer << arr }\n answer\nend", "title": "" }, { "docid": "9c3037e5f97ef3948e64b06131b02ecc", "score": "0.575585", "text": "def my_controlled_flatten(n)\n controlled_flat = []\n\n n.times do\n self.each do |x|\n if x.class != Array\n controlled_flat << x\n else\n x.each { |y| controlled_flat << y }\n end\n end\n end\n\n controlled_flat\n end", "title": "" }, { "docid": "335b25b4af2358b979e4c839eabf4e66", "score": "0.57514423", "text": "def flatten(level=-1)\n case level\n when 0 then each\n else\n Enumerator.new do |yielder|\n each do |x|\n if x.is_a? Enumerable\n x.flatten(level-1).each do |nested_element|\n yielder << nested_element\n end\n else\n yielder << x\n end\n end\n end\n end\n end", "title": "" }, { "docid": "b6547270e1901833b799e6067faca1cf", "score": "0.5751117", "text": "def flatten!\n end", "title": "" }, { "docid": "be0353952f313a8bfcbc877647975f49", "score": "0.57491267", "text": "def deep_dup(arr)\n arr.map {|ele| ele.is_a?(Array) ? deep_dup(ele) : ele }\nend", "title": "" }, { "docid": "47c41f28863b31c6ef332f104a3ac0d6", "score": "0.5738685", "text": "def two_d_translate(arr)\n new_arr = []\n\n arr.each do |subArray|\n ele = subArray[0]\n num = subArray[1]\n\n num.times { new_arr << ele }\n end\n\n return new_arr\n\nend", "title": "" } ]
080ab857b20bc0d8d86d8eddb829e3d7
Allows API access to certain methods skips here should be paired with calls in allow_api_access
[ { "docid": "a8d59fed9a81bf37385bccb4bb4db64f", "score": "0.62077004", "text": "def api_actions\n [:import, :only_in_council, :only_in_lpi, :error_records]\n end", "title": "" } ]
[ { "docid": "b2c825dd84b56fbbf329fb43652eec60", "score": "0.7819572", "text": "def api_only!; end", "title": "" }, { "docid": "10718d42cac5d82a7c1d9e2550ce2f06", "score": "0.7629115", "text": "def api_only; end", "title": "" }, { "docid": "10718d42cac5d82a7c1d9e2550ce2f06", "score": "0.7629115", "text": "def api_only; end", "title": "" }, { "docid": "cd05f5e13dd3380857a873fabe2df116", "score": "0.7031258", "text": "def check_allow_api\n if @current_user.present? && (Confline.get_value('Allow_API', @current_user.get_correct_owner_id_for_api).to_i != 1) &&\n (!(@current_user.is_reseller? && Confline.get_value('Allow_API').to_i == 1))\n send_xml_data(MorApi.return_error('API Requests are disabled'), params[:test].to_i) && (return false)\n end\n end", "title": "" }, { "docid": "1f8164a7cd40d36c49ca2baf0ac9ac0b", "score": "0.6986566", "text": "def check_allow_api\n if Confline.get_value(\"Allow_API\").to_i != 1\n send_xml_data(MorApi.return_error('API Requests are disabled'), params[:test].to_i)\n end\n end", "title": "" }, { "docid": "093d12c638e21c4b1602e4e16fe1a625", "score": "0.6963929", "text": "def api_only=(_); end", "title": "" }, { "docid": "fa463a07608b65c354e22e2e097235d1", "score": "0.672606", "text": "def restrict_api\n authenticate_or_request_with_http_token do |token, options|\n ApiKey.exists?(access_token: token)\n end\n end", "title": "" }, { "docid": "0c3b28294b0d27e9e02c03deb92de5f6", "score": "0.67191", "text": "def hidden_apis; end", "title": "" }, { "docid": "f844ff3860c10d86b52936b6601e7bc1", "score": "0.6704318", "text": "def access_control\n api_key = request.headers['X-Api-Key']\n access_ok = Api.find_by key: api_key\n\n unless access_ok\n head status: :forbidden\n false\n end\n end", "title": "" }, { "docid": "107fcb8a28d82e35e71a606658da5e14", "score": "0.66433096", "text": "def api_only=(_arg0); end", "title": "" }, { "docid": "f85ebd5ea0f3e56fd5089dc2ff803677", "score": "0.66350067", "text": "def restrict_access\n puts \"[INFO][Application] Checking for API key\"\n authorized = ApiKey.exists?(access_key: api_key_from_header)\n puts \"[INFO][Application] Access authorized? #{authorized}\"\n error! :unauthenticated if !authorized\n end", "title": "" }, { "docid": "bd91307bac0f507f0e68d1ee894ae721", "score": "0.6610778", "text": "def can_use_api?\n api_enabled\n end", "title": "" }, { "docid": "e454f6c12f687b6b3f37733443bc866a", "score": "0.65994316", "text": "def restrict_access\n unless ApiKey.exists?(access_token: params[:access_token])\n render json: { error: 'API-key invalid, access denied' }, status: :unauthorized\n end\n end", "title": "" }, { "docid": "dea7b19c1d9e65347a87e842a3f60d77", "score": "0.65984374", "text": "def skip_authorization\n end", "title": "" }, { "docid": "4d35007eeab386dc76a233719a352926", "score": "0.6486284", "text": "def restrict_access\n\t\tauthenticate_or_request_with_http_token do |token, option|\n\t\t\tApiKey.exists?(access_token: token)\n\t\tend\n\tend", "title": "" }, { "docid": "76d10887f0d8d6670e7b92daa0400757", "score": "0.6452416", "text": "def restrict_access\r\n\r\n\t\t\t\tif params[:access_token]\r\n\t\t\t\t\tapi_key = ApiKey.find_by_access_token(params[:access_token])\r\n\t\t\t\t\thead :unauthorized unless api_key\r\n\t\t\t\telse\r\n\t\t\t\t\tauthenticate_or_request_with_http_token do |token, options|\r\n\t\t\t\t\t\tApiKey.exists?(access_token: token)\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend", "title": "" }, { "docid": "f4259cc6757c7228827c19fac35bc0d2", "score": "0.6441234", "text": "def api\n end", "title": "" }, { "docid": "944903cc481c5f23d40944f213753d24", "score": "0.64263785", "text": "def restrict_access\n \tauthenticate_or_request_with_http_token do |token, options|\n \t\tApiKey.exists?(access_token: token)\n \tend\n end", "title": "" }, { "docid": "ce82aa88da5980a110a1fb454992e4f0", "score": "0.64049906", "text": "def assert_method_not_allowed\n assert_status 405\n end", "title": "" }, { "docid": "b59005d21a3721a8732c1a7f46cf5c46", "score": "0.638453", "text": "def api_accessible?\n raise \"This method has to be provided by the social identity provider instance!\"\n end", "title": "" }, { "docid": "067a63346e46abc0e3cb11bd7a3b26d0", "score": "0.63752323", "text": "def is_api?\n false\n end", "title": "" }, { "docid": "f629478d27e5c18ff5df2b7b63e9ece0", "score": "0.6367269", "text": "def api_behavior; end", "title": "" }, { "docid": "778478fe5232defc2b8f7255828c3424", "score": "0.63661236", "text": "def api_methods\n self.methods(false)\n end", "title": "" }, { "docid": "778478fe5232defc2b8f7255828c3424", "score": "0.63661236", "text": "def api_methods\n self.methods(false)\n end", "title": "" }, { "docid": "d3da8d3eeb832a104c6567279301c18d", "score": "0.6362372", "text": "def restrict_access\n \t\t\t# Use when passing token in via params\n \t\t\t\n \t\t\tapi_key = ApiKey.find_by_access_token(params[:access_token])\n \t\t\thead :unauthorized unless api_key and api_key.expires_at > Time.current()\n\n \t\t\t# Use when passing token in via header\n\n \t\t\t#authenticate_or_request_with_http_token do |token, options|\n \t\t\t#\tApiKey.exists?(access_token: token)\n \t\t\t#end\n\n \t\tend", "title": "" }, { "docid": "fc2eb846aa9031e6894f618b4c9cd94d", "score": "0.6349706", "text": "def method_not_allowed(verbs)\n verbs = verbs.sub('GET', 'HEAD, GET')\n super\n end", "title": "" }, { "docid": "918252c21d35c8644302a293af820b2f", "score": "0.6334755", "text": "def allowed_login_methods\n request(:get, client_api_latest, '/login')\n end", "title": "" }, { "docid": "ea8224319b28998cef38a55480d86cb0", "score": "0.6333236", "text": "def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n api_token = ApiToken.find_by(token: token)\n @api_consumer = api_token.api_consumer if api_token\n end\n\n !!@api_consumer\n end", "title": "" }, { "docid": "7443834fbb0c5f80afd4cd2e9933580e", "score": "0.632154", "text": "def restrict_access\n authenticate_or_request_with_http_token do |token,option|\n ApiKey.exists?(access_token: token)\n end\n end", "title": "" }, { "docid": "4e071298d986db493ad85f6998a606b3", "score": "0.6316507", "text": "def handles *actions\n actions = API_ACTIONS.dup if actions.any? {|a| a == :all }\n\n whitelisted = actions.map(&:to_sym) & API_ACTIONS\n\n if (unhandled = actions - whitelisted).present?\n logger.warn \"Daylight::APIController isn't handling unwhitelisted actions\"\n logger.warn \"\\tspecified in #{self.name}#handles: #{unhandled.join(',')}\"\n end\n\n public(*whitelisted) if whitelisted.present?\n end", "title": "" }, { "docid": "4e071298d986db493ad85f6998a606b3", "score": "0.6316507", "text": "def handles *actions\n actions = API_ACTIONS.dup if actions.any? {|a| a == :all }\n\n whitelisted = actions.map(&:to_sym) & API_ACTIONS\n\n if (unhandled = actions - whitelisted).present?\n logger.warn \"Daylight::APIController isn't handling unwhitelisted actions\"\n logger.warn \"\\tspecified in #{self.name}#handles: #{unhandled.join(',')}\"\n end\n\n public(*whitelisted) if whitelisted.present?\n end", "title": "" }, { "docid": "1b84321568ec0a612acc58a0078d1bd8", "score": "0.63080037", "text": "def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n if ApiKey.exists?(auth_token: token)\n if ApiKey.find_by_auth_token(token) \n return true\n else\n return false\n end\n end\n end\n end", "title": "" }, { "docid": "68003bab6a789190774674e09982fadc", "score": "0.6305063", "text": "def api_caller\n end", "title": "" }, { "docid": "04aec1f8fd77c3ddd74aacfc105bda73", "score": "0.63001496", "text": "def method_missing(method, *args, &block)\n if @api.respond_to?(method)\n if args.empty?\n @api.send(method)\n else\n @api.send(method, args)\n end\n else\n super\n end\n end", "title": "" }, { "docid": "2602278f6664684135523b4bb6cb55de", "score": "0.6287971", "text": "def pre_dispatch_hook\n if service.extra[:mobile]\n mobile_auth_check\n elsif service.extra[:internal]\n internal_api_key_check\n elsif !service.auth_required\n return\n else\n halt 403 # protect by default\n end\n end", "title": "" }, { "docid": "46f3c8dae89d6f2e426f58c7789ce89c", "score": "0.62728477", "text": "def require_admin_or_api_request\n return true if api_request?\n if User.current.admin?\n true\n elsif User.current.logged?\n render_error(:status => 406)\n else\n deny_access\n end\n end", "title": "" }, { "docid": "9674c960f4ce7028040d8463f4cfcf5c", "score": "0.6270287", "text": "def call_api_safe(service_type, method, params, id, version, timeout = DEFAULT_API_CALL_TIMEOUT, **args)\n unless getAvailableApiList['result'][0].include? method\n log.error \"Method '#{method}' is not available now! waiting...\"\n begin\n wait_event(timeout: timeout) { |res| res[0]['names'].include? method }\n rescue EventTimeoutError => e\n raise APINotAvailable.new, \"Method '#{method}' is not available now!\"\n end\n log.info \"Method '#{method}' has become available.\"\n end\n @raw_api_manager.call_api(service_type, method, params, id, version)\n end", "title": "" }, { "docid": "b1dcaba8bc59e2032ccf05cc3bb82bc3", "score": "0.6260737", "text": "def method_not_allowed!(msg = \"Method Not Allowed\")\n api_error!(code: 405, messages: msg)\n end", "title": "" }, { "docid": "7e18b13968c9acbfbdede84a9cc44f59", "score": "0.624244", "text": "def forbidden!\n render_api_error!('403 Forbidden', 403)\n end", "title": "" }, { "docid": "f228e1a10c33eac20232e719951b0a96", "score": "0.62404156", "text": "def restrict_access\n authenticate_or_request_with_http_token do |token,options|\n ApiKey.exists?(access_token: token)\n end\n end", "title": "" }, { "docid": "e3f13a0b28a62b52021ed675d69eea55", "score": "0.62363946", "text": "def require_api_login\n unless current_api_user\n head :forbidden\n end\n end", "title": "" }, { "docid": "a40837382f9bb24c5c3828940a95b251", "score": "0.62310386", "text": "def can_use_api?\n perms.include? Perm.use_api\n end", "title": "" }, { "docid": "8234dc1e37c5367642a60846bf8aa93f", "score": "0.62284076", "text": "def user_api\n end", "title": "" }, { "docid": "2cd8c4aae1668652f7df4dce37a200ff", "score": "0.6219202", "text": "def api_permitted?(method_id, ip_address, record_hit = true)\n api_record_hit(method_id, ip_address) if record_hit\n api_limit = @api_limits.detect {|limit| limit.method_id == method_id } \n\n if has_one_of_parameters?(params, %w(api_key apiKey)) && api_bypass_key?\n return true\n else\n if api_hits = ApiHits.first(:conditions => { :method_id => method_id, :ip_address => ip_address, :day => get_apid, :hour => get_apih })\n api_ch = api_hits.count\n api_cd = ApiHits.sum(:count, :conditions => { :method_id => method_id, :ip_address => ip_address, :day => get_apid })\n else api_ch, api_cd = 0, 0 end\n\n return true if api_ch <= api_limit.hour && api_cd <= api_limit.day\n\n override, override_hour, override_day = false, api_limit.hour, api_limit.day\n override, override_hour, override_day = api_key_has_override?(method_id) if has_one_of_parameters?(params, %w(api_key apiKey))\n if override\n if api_ch <= override_hour\n if api_cd <= override_day\n return true\n else logger.info \"OVERRIDE API Rate Limit [DAY:#{override_day}] Exceeded for Method [#{method_id}] [#{ip_address}].\" end\n else logger.info \"OVERRIDE API Rate Limit [HOUR:#{override_hour}] Exceeded for Method [#{method_id}] [#{ip_address}].\" end\n if (api_ch * ApiLimit::STATUS_HTTP_MULTIPLE) > override_hour || (api_cd * ApiLimit::STATUS_HTTP_MULTIPLE) > override_day\n @api_http_reject = true\n end\n else\n logger.info \"STANDARD API Rate Limit [DAY] Exceeded for Method [#{method_id}] [#{ip_address}].\" if api_ch > api_limit.hour\n logger.info \"STANDARD API Rate Limit [HOUR] Exceeded for Method [#{method_id}] [#{ip_address}].\" if api_cd > api_limit.day\n if (api_ch * ApiLimit::STATUS_HTTP_MULTIPLE) > api_limit.hour || (api_cd * ApiLimit::STATUS_HTTP_MULTIPLE) > api_limit.day\n @api_http_reject = true\n end\n end\n end\n return false\n end", "title": "" }, { "docid": "5729168b20c54549cc67477e7edd3cb9", "score": "0.62167305", "text": "def optional_api_authorization\n got_auth = authenticate(:auth_api, :api_authentication, scope: CartoDB.extract_subdomain(request))\n Carto::AuthenticationManager.validate_session(warden, request, current_user) if got_auth\n rescue Carto::ExpiredSessionError => e\n not_authorized(e)\n end", "title": "" }, { "docid": "6130b6a23a021e8cd9b61c66de69fb5d", "score": "0.6216401", "text": "def method_not_allowed\n status 405\n \"method not allowed\"\n end", "title": "" }, { "docid": "c56f40425a62aac888627926678647d8", "score": "0.6195489", "text": "def method_missing(method_name, *)\n authorize?(method_name)\n end", "title": "" }, { "docid": "a1e77eeab4330604987ceda5cb05ffa6", "score": "0.61867166", "text": "def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n ApiKey.exists?(access_token: token)\n end\n end", "title": "" }, { "docid": "a1e77eeab4330604987ceda5cb05ffa6", "score": "0.61867166", "text": "def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n ApiKey.exists?(access_token: token)\n end\n end", "title": "" }, { "docid": "f7ecb066f21e51ec0d75e21cbf50e5c6", "score": "0.61664355", "text": "def non_authenticable_methods\n non_authenticable_devise_methods || non_authenticable_api_methods\n end", "title": "" }, { "docid": "5c47abbd3200f8ba97604211a6f25394", "score": "0.6157122", "text": "def include_apis; end", "title": "" }, { "docid": "91f27afa12531cdc95825e7d49785cd9", "score": "0.6151148", "text": "def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n ApiKey.exists?(access_token: token)\n end\n end", "title": "" }, { "docid": "91f27afa12531cdc95825e7d49785cd9", "score": "0.6151148", "text": "def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n ApiKey.exists?(access_token: token)\n end\n end", "title": "" }, { "docid": "f349050c85148a78be7716013252d8a0", "score": "0.6147363", "text": "def api_authentication\n verify_api_access_token || render_api_unauthorized\n end", "title": "" }, { "docid": "e223b6498b42a8245c5e113225590b5b", "score": "0.6138869", "text": "def api; end", "title": "" }, { "docid": "d7ef08610e9de0160281383a0ca2fe1a", "score": "0.6119571", "text": "def ensure_logged_in_via_api\n return render(status: :forbidden, text: \"Not allowed\") unless current_api_user\n end", "title": "" }, { "docid": "84011b5fa7df1917c72d3f0c4ac70d85", "score": "0.6115144", "text": "def allowed_methods\n request service_path: producer_path + '/allowedMethods/v1'\n end", "title": "" }, { "docid": "0ae204aa8f89013a2cb20bf544a523ea", "score": "0.61137825", "text": "def api_methods(arg = nil)\n self.class.ancestors.first&.api_methods(arg)\n end", "title": "" }, { "docid": "310d7ee9e089845d909f1688bad2d6c4", "score": "0.6100691", "text": "def hidden_apis=(_arg0); end", "title": "" }, { "docid": "7a724fdf7d586190fe365aaa453928dd", "score": "0.6078569", "text": "def restrict_access \n authenticate_or_request_with_http_token do |token, options|\n ApiKey.exists?(access_token: token)\n end\n end", "title": "" }, { "docid": "5dd260b62b454edaa0c2ab4182fd4d95", "score": "0.60784245", "text": "def authenticate_api!\n set_case\n return true if @case&.public? || current_user\n\n render json: { reason: 'Unauthorized!' },\n status: :unauthorized\n end", "title": "" }, { "docid": "b3aa214c994ed1cb988706b3883791e4", "score": "0.60782635", "text": "def deny_access!\n #raise Acl9::AccessDenied\n end", "title": "" }, { "docid": "e67792ccdce8a92c7c940206e8aa7db4", "score": "0.6064924", "text": "def get_api(params={})\n get(\"/\", params) #, params.update(:noauth => true))\n end", "title": "" }, { "docid": "b123abec718500367810e09c7e27c4ce", "score": "0.6056423", "text": "def restrict_access\n api_key = APIKey.find_by_access_token(params[:access_token])\n if !api_key\n respond_to do |format|\n format.json { render :json => {:error => \"Access Denied\", :description => \"API Key not found/supplied\"} }\n end\n else\n api_key\n end\n end", "title": "" }, { "docid": "93880e9b00e074f195a89699e5747c71", "score": "0.60557634", "text": "def access_denied\n end", "title": "" }, { "docid": "b7426b10c483e86c52ac27f627ae2f8e", "score": "0.6041855", "text": "def api_is_enabled?\n !self.api_key.empty?\n end", "title": "" }, { "docid": "b7426b10c483e86c52ac27f627ae2f8e", "score": "0.6041855", "text": "def api_is_enabled?\n !self.api_key.empty?\n end", "title": "" }, { "docid": "6db88df3d04595197520e52e9c46deb1", "score": "0.6040381", "text": "def private_request?; end", "title": "" }, { "docid": "af02b3f5e266e1addbeea9be4fedec0a", "score": "0.60313696", "text": "def can_skip_auth\n self.class.can_skip_auth(params[:action].to_sym)\n end", "title": "" }, { "docid": "a9f033ee487ef5d45890448abff0e2db", "score": "0.60226727", "text": "def deny_access!\n raise Acl9::AccessDenied\n end", "title": "" }, { "docid": "79379fb4fe3fdfb180a8da7fde286c4e", "score": "0.60126555", "text": "def api2; end", "title": "" }, { "docid": "e0be720d3972bc8f0129bbba81f36216", "score": "0.6009025", "text": "def initialize_methods_restriction\n list_of_methods_to_guard.each do |method_name|\n if self.instance_methods.include?(method_name)\n send(:alias_method, \"za_#{method_name}\", method_name)\n define_method \"#{method_name}\" do |*args|\n _temp_i = \"Restricted method call to #{self.class.name}#{method_name}..\"\n puts _temp_i\n Rails.logger.debug(_temp_i)\n send(\"za_#{method_name}\", *args) if zero_authorized_checker(method_name)\n end\n else\n _temp_i = \"[WARNING] ZeroAuthorization: Method '#{method_name}' unavailable in #{self.name} for restriction application.\"\n puts _temp_i\n Rails.logger.debug(_temp_i)\n end\n end\n end", "title": "" }, { "docid": "9e3b5338e4dc6f73e52870d9bb19ac46", "score": "0.600538", "text": "def require_zz_api\n unless zz_api_call?\n msg = \"You must call the api via the api path with zz_api\"\n flash.now[:error] = msg\n head :status => 401\n return false\n end\n return true\n end", "title": "" }, { "docid": "2f95ab6eacd2081241fa4202fd8d2254", "score": "0.60030544", "text": "def verify_api\n\n # Skip the test if developer settings are activated\n if Setting.first.developermode?\n logger.info \"Developer settings activated, bypassing API check\"\n else\n logger.info \"Testing backend...\"\n host = Setting.first.apiserver\n port = Setting.first.apiport\n\n begin\n Socket.tcp(host, port, connect_timeout: 2) {}\n rescue StandardError\n redirect_to error_api_not_found_path\n end\n\n end #devmode\n\n end", "title": "" }, { "docid": "fa0b5be5c9eb5c6cff27adf535d26fab", "score": "0.59976244", "text": "def disable_api!\n self.update_attribute(:api_key, \"\")\n end", "title": "" }, { "docid": "9ee165fcc21bcd7c06f42f11fc44a411", "score": "0.59892505", "text": "def require_login!\n return true if current_api_user.api_key.present?\n render json: { errors: [ { detail: 'Access Denied' } ] }, status: 401\n end", "title": "" }, { "docid": "40294e34981827fe8781f82707fa1b36", "score": "0.59843314", "text": "def api\n\t\t@api\n\tend", "title": "" }, { "docid": "8d2b449cc52f298e5c78f1c566027be5", "score": "0.597153", "text": "def respond_to_missing?(method_name, include_private = false)\n METHODS_ALLOWED.include?(method_name.to_s) || super\n end", "title": "" }, { "docid": "955d908346c5f39af001793db9801fea", "score": "0.594295", "text": "def method_missing(method_sym, *arguments, &block)\n raise HTTP405MethodNotAllowed, 'Method not provided on controller.'\n end", "title": "" }, { "docid": "cce5674c5e2a46e0c453730c251e7094", "score": "0.5939337", "text": "def deny_access!\n head 401\n end", "title": "" }, { "docid": "6d9a4ea9d5b4abd1101b4b99e0e2cc50", "score": "0.5937067", "text": "def supports_api\n license = License.get\n\n if license and not license.supports_api?\n errors.add :license, \" - this product does not support API access\"\n end\n end", "title": "" }, { "docid": "b8e7d829c7c9664828b4ea32e1df371a", "score": "0.5936714", "text": "def method_missing(method_name, *args)\n flag_name = method_name[0..-2]\n\n return super unless method_name.to_s.end_with?('?')\n\n api.enabled?(flag_name)\n end", "title": "" }, { "docid": "ba287e3c1d3732f0a5cea600e217092a", "score": "0.5936087", "text": "def method_not_allowed(method)\n [405, {}, [\"Method not allowed: #{method}\"]]\n end", "title": "" }, { "docid": "a5b8e345b56656bbd2d72e62c2f5e12b", "score": "0.59307253", "text": "def restrict_access\n api_key = APIKey.find_by(access_token: params[:access_token])\n render plain: \"You aren't authorized, buster!\", status: 401 unless api_key\n end", "title": "" }, { "docid": "583bc820d049d6f1c5753f7de9d9549a", "score": "0.5927353", "text": "def restrict_access \n @user_api_key = ApiKey.find_by(key: params[:access_token])\n if @user_api_key.nil?\n render json: {errors: [{status: '401', detail: I18n.t('api.msgs.no_key', url: new_user_session_url) }]}\n return false\n end\n end", "title": "" }, { "docid": "84eda95feb7020bfd9ded33c35b132e0", "score": "0.5926829", "text": "def actually_call_api\n #puts \"called API\"\n end", "title": "" }, { "docid": "59b39e2ec6b4a3a4e056fa44d6820eb7", "score": "0.592576", "text": "def skip_if_api_down\n unless @data_repo_client.api_available?\n puts '-- skipping due to TDR API being unavailable --' ; skip\n end\n end", "title": "" }, { "docid": "6f1b598b520263069fe9697e6fbefada", "score": "0.59257126", "text": "def authenticate_api_call(api_key, api_secret)\n # Unauthorized API call.\n false\n end", "title": "" }, { "docid": "67614a863621829e652ec11baebc758d", "score": "0.59190655", "text": "def mark_application_extension_api_only\n @application_extension_api_only = true\n end", "title": "" }, { "docid": "91886f60cdf031c21e564a946ff9668c", "score": "0.59175366", "text": "def authorize!\n check_methods = methods.select do |method_name|\n method_name.to_s.start_with?('check_')\n end\n\n check_methods.each do |check_method|\n send(check_method)\n end\n end", "title": "" }, { "docid": "4c8cb18a49bec82365c77267025818b9", "score": "0.59166265", "text": "def allowed_methods\n [\"GET\", \"OPTIONS\", \"DELETE\"]\n end", "title": "" }, { "docid": "681401d09400b8f5f122f8af571fa71b", "score": "0.5908538", "text": "def method_missing(method_name, *args, &block)\n return super unless method_name[-1] == '!'\n\n authorize method_name[0..-2], *args\n end", "title": "" }, { "docid": "bacfb8ccb0014e187a1cd557a6fc3159", "score": "0.5907533", "text": "def test_api_read_not_found\n # Try first with no auth, as it should requure it\n get :api_read, :id => 0\n assert_response :unauthorized\n\n # Login, and try again\n basic_authorization(users(:public_user).display_name, \"test\")\n get :api_read, :id => 0\n assert_response :not_found\n\n # Now try a trace which did exist but has been deleted\n basic_authorization(users(:public_user).display_name, \"test\")\n get :api_read, :id => 5\n assert_response :not_found\n end", "title": "" }, { "docid": "f5f39431373d4fc700c8f06ee0128e91", "score": "0.59074545", "text": "def check_api_request\n halt 400, error_response(ERROR_INVALID_REQUEST_METHOD) unless request.get?\n halt 404, error_response(ERROR_INVALID_REQUEST_PATH) unless ALLOWED_PATHS.include?(request.path)\n end", "title": "" }, { "docid": "a22c53e4dae6b73f35387a4fcf934c32", "score": "0.590661", "text": "def allowed_request_methods=(_arg0); end", "title": "" }, { "docid": "179104720b7ac75093d757483f45bcc6", "score": "0.5905352", "text": "def api(*methods)\n lambda do |input|\n validate_api(input, methods)\n end\n end", "title": "" }, { "docid": "65c33810822e9797fda7ad5dab112862", "score": "0.58895886", "text": "def role_symbols\n [:access, :api_whitelist]\n end", "title": "" }, { "docid": "2ea691817e883a5b04e21005144b591c", "score": "0.5885521", "text": "def authenticate_api\n \t@application = find_application\n \traise UNAUTHORIZED_ACCESS if @application.blank?\n end", "title": "" }, { "docid": "fe2b72025945ba1cacf9f177d5bc3517", "score": "0.58806473", "text": "def show\n authorize @api_client\n end", "title": "" }, { "docid": "8ba3c1c2d6bdda2b4455bbd93cec2e17", "score": "0.58686286", "text": "def describe_external_service_api(object:, api_name:, **kwargs, &blk)\n action_class = kwargs[:action_class] || \"ExternalServices::ApiActions::#{api_name.to_s.camelize}\".constantize\n methods = %i[create update destroy]\n methods -= [kwargs[:except]].flatten if kwargs[:except]\n methods &= [kwargs[:only]].flatten if kwargs[:only]\n\n describe action_class.to_s do\n before :all do\n Disabler.enable_external_services\n Disabler.disable_external_services except: [api_name]\n end\n\n after :all do\n Disabler.enable_external_services\n end\n\n before do\n @api_object = case object\n when Symbol\n send(object)\n else\n instance_exec(&object)\n end\n @action_class = action_class\n @id_key = kwargs[:id_key].try(:to_s) || \"#{api_name.to_s.underscore}_id\"\n @methods = kwargs[:methods] || { create: :post, update: :put, destroy: :delete }\n\n perform_unprocessed_actions\n end\n\n if :create.in? methods\n it 'creates action on create' do\n expect_api_action_on_create\n end\n end\n\n if :update.in? methods\n it 'creates action on update' do\n @api_object.send(\"#{@id_key}=\", SecureRandom.hex)\n @api_object.save\n\n expect_api_action_on_update(@api_object)\n end\n end\n\n if :destroy.in? methods\n it 'creates action on delete' do\n @api_object.send(\"#{@id_key}=\", SecureRandom.hex)\n @api_object.save\n\n @api_object.reload.descendants.each(&:delete) if @api_object.respond_to?(:descendants)\n @api_object.destroy\n expect_api_action_on_destroy(@api_object)\n end\n end\n\n if kwargs[:descendants_identifier_check]\n it 'create actions for all descendants on identifier change' do\n @api_object.update! identifier: \"#{@api_object.identifier}1\"\n\n @api_object.descendants.each do |c|\n expect_api_action_on_update(c)\n end\n end\n end\n\n instance_exec(&blk) if block_given?\n end\n\n # rubocop:enable Metrics/MethodLength, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity\n end", "title": "" } ]
6df703852b627ba043d7c64ba09a8ab2
Determine whether this test should be skipped, given a list of unsupported features.
[ { "docid": "9095416796e85d1a7f74079d75edc151", "score": "0.68356925", "text": "def skip_test?(client, features_to_skip = test_file.features_to_skip)\n return true if pre_defined_skip?\n\n if @skip\n @skip.collect { |s| s['skip'] }.any? do |skip|\n contains_features_to_skip?(features_to_skip, skip) ||\n skip_version?(client, skip)\n end\n end\n end", "title": "" } ]
[ { "docid": "52dfeb8caae8161e047129dc136e0aba", "score": "0.7344223", "text": "def skip_unless_supported(tests)\n pattern = tests[:platform]\n agent_only = tests[:agent_only] | false\n if agent_only && agent.nil?\n msg = \"Skipping all tests; '#{tests[:resource_name]}' \"\\\n '(or test file) is not supported agentlessly'\n banner = '#' * msg.length\n raise_skip_exception(\"\\n#{banner}\\n#{msg}\\n#{banner}\\n\", self)\n end\n return false if pattern.nil? || platform.match(tests[:platform])\n msg = \"Skipping all tests; '#{tests[:resource_name]}' \"\\\n '(or test file) is not supported on this node'\n banner = '#' * msg.length\n raise_skip_exception(\"\\n#{banner}\\n#{msg}\\n#{banner}\\n\", self)\n end", "title": "" }, { "docid": "603ea25c0c0e6f0786791ce38dfd2121", "score": "0.711986", "text": "def not_supported(*features)\n features.each do |feature|\n self.send(:class_variable_get, :@@features)[feature] = false\n end\n end", "title": "" }, { "docid": "2a3d2e9ebb768a6118b854040cdf180b", "score": "0.68733305", "text": "def skip_unless_supported(tests, id=nil)\n return false if agent_supports_test_private?(tests, id)\n\n if id\n tests[:skipped] ||= []\n tests[:skipped] << tests[id][:desc]\n else\n msg = \"Tests in '#{File.basename(path)}' \"\\\n 'are unsupported on this node.'\n banner = '#' * msg.length\n raise_skip_exception(\"\\n#{banner}\\n#{msg}\\n#{banner}\\n\", self)\n end\n true\nend", "title": "" }, { "docid": "3cbc8e2706c28dcf21bc1f70d832b93a", "score": "0.68056303", "text": "def not_supporting(*features)\n features.each do |feature|\n class_variable_get(:@@features)[feature] = false\n end\n end", "title": "" }, { "docid": "1c1299499f0be15df989efa33ac64342", "score": "0.62860215", "text": "def skipped?\n !@test_case.search('./skipped').empty?\n end", "title": "" }, { "docid": "1c1299499f0be15df989efa33ac64342", "score": "0.62860215", "text": "def skipped?\n !@test_case.search('./skipped').empty?\n end", "title": "" }, { "docid": "d17f06f36d3f4fdb3466f4ff85cbb89e", "score": "0.62180614", "text": "def fail_if_unavailable\n all_available = node[\"powershell_features_cache\"][\"enabled\"] +\n node[\"powershell_features_cache\"][\"disabled\"] +\n node[\"powershell_features_cache\"][\"removed\"]\n\n # the difference of desired features to install to all features is what's not available\n unavailable = (new_resource.feature_name - all_available)\n raise \"The Windows feature#{\"s\" if unavailable.count > 1} #{unavailable.join(\",\")} #{unavailable.count > 1 ? \"are\" : \"is\"} not available on this version of Windows. Run 'Get-WindowsFeature' to see the list of available feature names.\" unless unavailable.empty?\n end", "title": "" }, { "docid": "ca296b75729718c4e123fa9e34f0a138", "score": "0.62001103", "text": "def ignore_defense?\n has_feature? :ignore_defense\n end", "title": "" }, { "docid": "8958f32cbda9ec0e285adcec996685f4", "score": "0.6195245", "text": "def skip_if(*engs, suffix: '', bt: caller)\n engs.each do |eng|\n skip_msg = case eng\n when :linux then \"Skipped if Linux#{suffix}\" if Puma::IS_LINUX\n when :darwin then \"Skipped if darwin#{suffix}\" if Puma::IS_OSX\n when :jruby then \"Skipped if JRuby#{suffix}\" if Puma::IS_JRUBY\n when :truffleruby then \"Skipped if TruffleRuby#{suffix}\" if TRUFFLE\n when :windows then \"Skipped if Windows#{suffix}\" if Puma::IS_WINDOWS\n when :ci then \"Skipped if ENV['CI']#{suffix}\" if ENV['CI']\n when :no_bundler then \"Skipped w/o Bundler#{suffix}\" if !defined?(Bundler)\n when :ssl then \"Skipped if SSL is supported\" if Puma::HAS_SSL\n when :fork then \"Skipped if Kernel.fork exists\" if HAS_FORK\n when :unix then \"Skipped if UNIXSocket exists\" if Puma::HAS_UNIX_SOCKET\n when :aunix then \"Skipped if abstract UNIXSocket\" if Puma.abstract_unix_socket?\n when :rack3 then \"Skipped if Rack 3.x\" if Rack.release >= '3'\n else false\n end\n skip skip_msg, bt if skip_msg\n end\n end", "title": "" }, { "docid": "57d0cff646c3acc5c87672b86a6f9c4c", "score": "0.6159278", "text": "def feature_disabled?(feature)\n !feature_enabled?(feature)\n end", "title": "" }, { "docid": "19280e1836cd3d70c30ed59df480c2d9", "score": "0.61115193", "text": "def features?(what)\n Itsf::Backend.features?(what) && !disabled_features.include?(what)\n end", "title": "" }, { "docid": "1c6313eac4beb675fdec9532ee5d70b3", "score": "0.6087374", "text": "def supports_not(feature, reason: nil)\n define_supports_feature_methods(feature, :is_supported => false, :reason => reason)\n end", "title": "" }, { "docid": "c023b4ec37f1d41e40c332421f8ec9ae", "score": "0.6013829", "text": "def skipped\n all_tests.select(&:skipped?)\n end", "title": "" }, { "docid": "6f10df14677f6a91833ceef03cdd320f", "score": "0.5970826", "text": "def skip_unless_proxy_agent(tests)\n msg = \"Skipping all tests; '#{tests[:resource_name]}' \"\\\n '(or test file) is not supported without a proxy agent'\n banner = '#' * msg.length\n raise_skip_exception(\"\\n#{banner}\\n#{msg}\\n#{banner}\\n\", self) unless proxy_agent\n end", "title": "" }, { "docid": "6a3fd3e86af6c4847c5e829c35a18eff", "score": "0.5951538", "text": "def failing(selected_tests = select_tests)\n selected_tests.select(&:failing?)\n end", "title": "" }, { "docid": "a577f8d617e180a524fbb8772a9799e9", "score": "0.59345484", "text": "def disabled?( feature )\n not plan.has_feature?( feature )\n end", "title": "" }, { "docid": "34a118de5b44183d9dd9e9ef00e0d741", "score": "0.5886153", "text": "def check_valid_feature_data(features)\n features.values.each do |value|\n unless [true, false].include?(value)\n raise ArgumentError, \"#{value} is not allowed value in config, use true/false\"\n end\n end\n end", "title": "" }, { "docid": "57938d9684489714e40931e6ebd5099c", "score": "0.5868299", "text": "def platform_supports_test(tests, id)\n # Prefer specific test key over the all tests key\n os = tests[id][:operating_system] || tests[:operating_system]\n plat = tests[id][:platform] || tests[:platform]\n if os && !operating_system.match(os)\n logger.error(\"\\n#{tests[id][:desc]} :: #{id} :: SKIP\")\n logger.error(\"Operating system does not match testcase os regexp: /#{os}/\")\n elsif plat && !platform.match(plat)\n logger.error(\"\\n#{tests[id][:desc]} :: #{id} :: SKIP\")\n logger.error(\"Platform type does not match testcase platform regexp: /#{plat}/\")\n else\n unless agent.nil?\n platform\n end\n\n return true\n end\n tests[:skipped] ||= []\n tests[:skipped] << tests[id][:desc]\n false\n end", "title": "" }, { "docid": "1279d2ee8cb8ceda0da59d78d63463e8", "score": "0.58646053", "text": "def tests_pass?\n raise NotImplementedError\n end", "title": "" }, { "docid": "1279d2ee8cb8ceda0da59d78d63463e8", "score": "0.58646053", "text": "def tests_pass?\n raise NotImplementedError\n end", "title": "" }, { "docid": "4e58e70ff7111fbae67493877b9ef307", "score": "0.585171", "text": "def unsupported_reason(feature)\n feature = feature.to_sym\n supports?(feature) unless unsupported.key?(feature)\n unsupported[feature]\n end", "title": "" }, { "docid": "5a553474e140b671430b57e317c66509", "score": "0.58279335", "text": "def skipped?\n return false if @feature == 'miq_request_reload' && role_allows_feature?\n super\n end", "title": "" }, { "docid": "df82c5cff655d72f7a6ffa35eab78913", "score": "0.57916", "text": "def non_required_features(_opts = {})\n result = run_command(apkanalyzer_command, __method__)\n result ? result.to_a : nil\n end", "title": "" }, { "docid": "6a88a653aef616e5fa9d0086089d61a1", "score": "0.5780443", "text": "def unsupported(opts={})\n before :_remove_action_, opts\n end", "title": "" }, { "docid": "ffc0737a78a7f474a6617a21ef8bc1ea", "score": "0.577568", "text": "def skip?\n false\n end", "title": "" }, { "docid": "96b38cae8813979287337c55f1e6cee1", "score": "0.5751626", "text": "def feature_set_fabricpath_excluded?\n if validate_property_excluded?('fabricpath', 'feature_install')\n assert_raises(Cisco::UnsupportedError) do\n FabricpathGlobal.fabricpath_feature_set(:enabled)\n end\n return true\n end\n false\n end", "title": "" }, { "docid": "f5fd9628247631f9dec907cc82134b5d", "score": "0.5740772", "text": "def disable_init_tests?\n @args.key?(\"disable_unit_tests\")\n end", "title": "" }, { "docid": "145945b12df6538d87a8e8bde340c8ee", "score": "0.57309157", "text": "def print_warning_about_not_enabled_cmdline_args\n puts(format(@test_runner_disabled_replay, opt: @not_supported)) unless \\\n @configurator.project_config_hash[:test_runner_cmdline_args]\n end", "title": "" }, { "docid": "13c4319fc5a60aa479dc15322a2b223d", "score": "0.5723109", "text": "def unskipped?\n !skipped?\n end", "title": "" }, { "docid": "238655f87e86f21a993cc5d6c94f6aaf", "score": "0.5720017", "text": "def skipped?\n self.failure and Skip === self.failure\n end", "title": "" }, { "docid": "eeaa881180749874e473642a34b19876", "score": "0.5717647", "text": "def should_skip\n false\n end", "title": "" }, { "docid": "9a9d5426e80f9936c7bf0458115d452d", "score": "0.5706464", "text": "def unsupported_reason(feature)\n feature = feature.to_sym\n supports?(feature) unless unsupported.key?(feature)\n unsupported[feature]\n end", "title": "" }, { "docid": "cc6d0ee0774f7f14d030e471126b80c4", "score": "0.5692769", "text": "def skipped?\n !!@_skip_processing\n end", "title": "" }, { "docid": "811cd6be485f34908456f0b7302ea892", "score": "0.5685854", "text": "def features(*list)\n return if @locals[:guser] && vip?\n list.each do |f|\n next unless settings.toggles.get(\"stop:#{f}\", 'no') == 'yes'\n raise WTS::UserError, \"E177: This feature \\\"#{f}\\\" is temporarily disabled, sorry\"\n end\nend", "title": "" }, { "docid": "9c3fa9012c336ca454fc178adfe7667f", "score": "0.56664413", "text": "def check_features\n case params[:action]\n when \"index\"\n current_features.include?('overtime_plan_list') ? true : invalid_features\n when \"update_status\"\n current_features.include?('overtime_status_update') ? true : invalid_features\n when \"overtime_report_table\"\n current_features.include?('overtime_recap') ? true : invalid_features\n when \"index_done\"\n current_features.include?('overtime_index') ? true : invalid_features\n # when \"show\"\n # current_features.include?('overtime_detail') ? true : invalid_features\n # when \"new\"\n # current_features.include?('overtime_new') ? true : invalid_features\n # when \"edit\"\n # current_features.include?('overtime_edit') ? true : invalid_features\n # when \"destroy\"\n # current_features.include?('overtime_delete') ? true : invalid_features\n end\n # return true\n end", "title": "" }, { "docid": "5f30f325223a62b10273110f15f5c2ce", "score": "0.5660313", "text": "def skip_only(metadata)\n return if context_matches?(metadata[:only])\n\n metadata[:skip] = 'Test is not compatible with this environment or pipeline'\n end", "title": "" }, { "docid": "bf9f852e06e6e714b974f7b13b08b594", "score": "0.5651055", "text": "def check_features\n case params[:action]\n when \"index\"\n current_features.include?('payroll_index') ? true : invalid_features\n when \"edit\"\n current_features.include?('payroll_edit') ? true : invalid_features\n when \"create\"\n current_features.include?('payroll_edit') ? true : invalid_features\n when \"create_premium\"\n current_features.include?('payroll_edit') ? true : invalid_features\n when \"update_premium\"\n current_features.include?('payroll_edit') ? true : invalid_features\n when \"update_ptkp\"\n current_features.include?('payroll_edit') ? true : invalid_features\n when \"delete_premium\"\n current_features.include?('payroll_edit') ? true : invalid_features\n end\n # return true\n end", "title": "" }, { "docid": "0fe5c7368d6ef61da87aac01de05795f", "score": "0.5649975", "text": "def skip_unless(eng, bt: caller)\n skip_msg = case eng\n when :linux then \"Skip unless Linux\" unless Puma::IS_LINUX\n when :darwin then \"Skip unless darwin\" unless Puma::IS_OSX\n when :jruby then \"Skip unless JRuby\" unless Puma::IS_JRUBY\n when :windows then \"Skip unless Windows\" unless Puma::IS_WINDOWS\n when :mri then \"Skip unless MRI\" unless Puma::IS_MRI\n when :ssl then \"Skip unless SSL is supported\" unless Puma::HAS_SSL\n when :fork then MSG_FORK unless HAS_FORK\n when :unix then MSG_UNIX unless Puma::HAS_UNIX_SOCKET\n when :aunix then MSG_AUNIX unless Puma.abstract_unix_socket?\n when :rack3 then \"Skipped unless Rack >= 3.x\" unless ::Rack.release >= '3'\n else false\n end\n skip skip_msg, bt if skip_msg\n end", "title": "" }, { "docid": "d2a78a0c771e8311edd98e97390dcaf9", "score": "0.56478584", "text": "def skipped?\n skipped\n end", "title": "" }, { "docid": "0f6bc822b7447fc4ff766faabcfd16ca", "score": "0.564708", "text": "def can_dummy?(*names)\n @test_dummy ||= { }\n \n names.flatten.reject do |name|\n @test_dummy.key?(name)\n end.empty?\n end", "title": "" }, { "docid": "019b47b200113c5f1a8a320dd41113db", "score": "0.5642975", "text": "def skip_step?\n return aborted? || in_skipped_conditional?\n end", "title": "" }, { "docid": "9f2600c1ce04897b8a572100134ee3cc", "score": "0.56383556", "text": "def need_feature(collection, name)\n before :each do\n f = api.features[collection.to_sym]\n unless f && f.include?(name.to_sym)\n skip \"#{collection} for #{api.driver} doesn't support #{name}\"\n end\n end\n end", "title": "" }, { "docid": "3d44b2f9c2b3beafcda713d8c52bfe8a", "score": "0.56344646", "text": "def skip?\n return (@current_action.kind == 0 and @current_action.basic > 0)\n end", "title": "" }, { "docid": "f6fdbb6030c7f2a9423b94e35fe25c16", "score": "0.563356", "text": "def disable_ui_tests?\n @args.key?(\"disable_ui_tests\")\n end", "title": "" }, { "docid": "b9a22797dc9b97ac0ac383472c447b8c", "score": "0.56256163", "text": "def any_test_failed?(test_results); end", "title": "" }, { "docid": "9de869a56d2b0ca85df67f8773aa027f", "score": "0.5611295", "text": "def shouldSkipStep(step)\n value = ENV[step].to_s\n\n # We should skip if the value isn't the empty string, or if it's set to something other than YES\n not value.empty? and value != 'YES'\n end", "title": "" }, { "docid": "30cf3f27aca2e004986bd909e8543be6", "score": "0.55893797", "text": "def check_features\n case params[:action]\n when \"index\"\n current_features.include?('promotion_index') ? true : invalid_features \n end\n # return true\n end", "title": "" }, { "docid": "6dda06e3239ed7a1d3e30f3a99401b88", "score": "0.55737936", "text": "def skipped?\n @skipped || false\n end", "title": "" }, { "docid": "d558b65c2f8ed7ce319324c0dc1ddb6f", "score": "0.5569517", "text": "def skippable?\n !required\n end", "title": "" }, { "docid": "68b08433316b7bffc2b0b69b71109fff", "score": "0.55658036", "text": "def on_os_under_test\n on_supported_os.reject do |os, facts|\n (only_test_os() && !only_test_os.include?(os)) ||\n (exclude_test_os() && exclude_test_os.include?(os))\n end\nend", "title": "" }, { "docid": "5426f61a3a238ac95df661724e248c67", "score": "0.5553949", "text": "def redundant_feature?(feature_name)\n feature_name == 'enumerator' ||\n (target_ruby_version >= 2.1 && feature_name == 'thread') ||\n (target_ruby_version >= 2.2 && RUBY_22_LOADED_FEATURES.include?(feature_name)) ||\n (target_ruby_version >= 2.5 && feature_name == 'pp' && !need_to_require_pp?) ||\n (target_ruby_version >= 2.7 && feature_name == 'ruby2_keywords') ||\n (target_ruby_version >= 3.1 && feature_name == 'fiber') ||\n (target_ruby_version >= 3.2 && feature_name == 'set')\n end", "title": "" }, { "docid": "1982b1f18f3335c7296f417ad20d1584", "score": "0.5549571", "text": "def not_supported?(operand)\n case operand\n when OrOperation\n true\n when InclusionComparison\n if operand.negated?\n true\n end\n else\n false\n end\n end", "title": "" }, { "docid": "9fe9a90633703ea61b4851449d9fffc6", "score": "0.55459046", "text": "def skip?(options, *contexts)\n options ||= {}\n contexts = Array(contexts).flatten\n skips = Array(options[:skip])\n skips = [skips] if skips.blank? || !skips.first.is_a?(Array)\n\n skips.flatten.present? &&\n skips.any? { |skip| skip == contexts.take(skip.size) }\n end", "title": "" }, { "docid": "790ec43afce269a8363e5afa31ec55f7", "score": "0.55450106", "text": "def skipped?\n skipped\n end", "title": "" }, { "docid": "c0d00f4e93a8d914afd71d187e1fe80f", "score": "0.55443764", "text": "def skipped?\n status == 'SKIP'\n end", "title": "" }, { "docid": "dbadab35b5dd05288c67c88c55d81b95", "score": "0.5529233", "text": "def skip?\n !source_path.to_s.match(/Staircases/)\n end", "title": "" }, { "docid": "a64a5f5fc289ccdf2661a80f2fdd8f9a", "score": "0.5524412", "text": "def check_features\n case params[:action]\n when \"index\"\n current_features.include?('thr_index') ? true : invalid_features\n when \"new\"\n current_features.include?('thr_new') ? true : invalid_features\n when \"edit\"\n current_features.include?('thr_edit') ? true : invalid_features\n when \"destroy\"\n current_features.include?('thr_delete') ? true : invalid_features\n when \"show\"\n current_features.include?('thr_detail') ? true : invalid_features\n # when \"export\"\n # current_features.include?('thr_export') ? true : invalid_features\n end\n # return true\n end", "title": "" }, { "docid": "7c575cbae1a31dbd3b6faa9637337124", "score": "0.5520876", "text": "def skip_check_present?\n test == RUBY_ENGINE_CHECK or test == RUBY_PLATFORM_CHECK\n end", "title": "" }, { "docid": "f138e89f9e9487f99f9ae503a08ca4b3", "score": "0.55144995", "text": "def skip_or_run_quarantined_tests(metadata_keys, filter_keys)\n included_filters = filters_other_than_quarantine(filter_keys)\n\n if filter_keys.include?(:quarantine)\n skip(\"Only running tests tagged with :quarantine and any of #{included_filters}\") unless quarantine_and_optional_other_tag?(metadata_keys, included_filters)\n else\n skip('In quarantine') if metadata_keys.include?(:quarantine)\n end\nend", "title": "" }, { "docid": "75cb6c35ed14dc9ae09e3a764f35ead7", "score": "0.55141973", "text": "def any_class_feature?(features)\n !features.select { |f| class_feature?(f) }.empty?\n end", "title": "" }, { "docid": "eac23d4e3e0c6f0263c8579536082f8d", "score": "0.5503906", "text": "def has_features?\n return ! features.nil?\n end", "title": "" }, { "docid": "f2567d51977f0526ad08dda5ad137c0d", "score": "0.5502335", "text": "def any_target?(tested_target)\n target?(tested_target) || fail_target?(tested_target)\n end", "title": "" }, { "docid": "f2567d51977f0526ad08dda5ad137c0d", "score": "0.5502335", "text": "def any_target?(tested_target)\n target?(tested_target) || fail_target?(tested_target)\n end", "title": "" }, { "docid": "f2567d51977f0526ad08dda5ad137c0d", "score": "0.5502335", "text": "def any_target?(tested_target)\n target?(tested_target) || fail_target?(tested_target)\n end", "title": "" }, { "docid": "c624acc01bf32ad0b1ce8f7e586bdc8f", "score": "0.5494595", "text": "def unsupported\n \n end", "title": "" }, { "docid": "0f2aba365d3f3e11228c1adfeed6ec8d", "score": "0.54905665", "text": "def skip_if_nv_overlay_rejected(agent)\n logger.info('Check for nv overlay support')\n cmd = 'feature nv overlay'\n out = test_set(agent, cmd, ignore_errors: true)\n return unless out[/NVE Feature NOT supported/]\n\n # Failure message taken from 6001\n msg = 'NVE Feature NOT supported on this Platform'\n banner = '#' * msg.length\n raise_skip_exception(\"\\n#{banner}\\n#{msg}\\n#{banner}\\n\", self) if\n out.match(msg)\n end", "title": "" }, { "docid": "c4051563393a2325f378a59ed9402e3d", "score": "0.5489607", "text": "def failing_tests\n return self.product_tests.select do |test|\n !test.passing?\n end\n end", "title": "" }, { "docid": "549a74f1c3c75005384ec0a1c3ad4aa2", "score": "0.5480179", "text": "def feature_spec_truthy_condition?\n false\n end", "title": "" }, { "docid": "3da6542357897a8034b76fcdebd46198", "score": "0.54749554", "text": "def test?\n test_run.present? || unable_to_send?\n end", "title": "" }, { "docid": "862c43588ffe8454770eff2db98e844d", "score": "0.54731244", "text": "def wants_to_see(feature)\n features.keys.include?(feature)\n end", "title": "" }, { "docid": "ee8f52350dc813659a5410963d92b828", "score": "0.5472037", "text": "def fail_if_no_examples; end", "title": "" }, { "docid": "860725edc3de47b1acaeaa7f34bd71d8", "score": "0.54688466", "text": "def skipped?\n @skipped\n end", "title": "" }, { "docid": "c0ea28bd2a2e53961e8d241d53a612d1", "score": "0.54673874", "text": "def attempted(selected_tests = select_tests)\n selected_tests.select(&:attempted?)\n end", "title": "" }, { "docid": "845f9ff0a6eac56b60ded1bb212893e7", "score": "0.54661363", "text": "def can_skip?\n return false, [] unless travis_pr?\n\n modified_checks = []\n puts \"Comparing #{ENV['TRAVIS_PULL_REQUEST_SHA']} with #{ENV['TRAVIS_BRANCH']}\"\n git_output = `git diff --name-only #{ENV['TRAVIS_BRANCH']}...#{ENV['TRAVIS_PULL_REQUEST_SHA']}`\n puts \"Git diff: \\n#{git_output}\"\n git_output.each_line do |filename|\n filename.strip!\n puts filename\n if filename.start_with? 'checks.d'\n check_name = File.basename(filename, '.py')\n elsif filename.start_with?('tests/checks/integration', 'tests/checks/mock')\n # 5 is test_\n check_name = File.basename(filename, '.py').slice(5, 100)\n elsif filename.start_with?('tests/checks/fixtures', 'conf.d')\n next\n else\n return false, []\n end\n modified_checks << check_name unless modified_checks.include? check_name\n end\n [true, translate_to_travis(modified_checks)]\nend", "title": "" }, { "docid": "dce53cf08fb58d0af03f01da9571d3c0", "score": "0.546582", "text": "def installUninstalledFeatures(container, skipList)\n \n features = container.getUninstalledFeatures\n puts skipList.length()\n #puts features.length\n #puts features\n # Install all features except fabric ones \n skipped = Array.new\n features.each_with_index do | line, index |\n \n skip=false\n if line.rindex(\"]\") != nil\n f = \"#{line}\"[(\"#{line}\".rindex(\"]\") +2)..\"#{line}\".length].split(\"\\s\")[0]\n \n skipList.each do |item|\n if f.include? item\n # puts \" ** Skipping\"\n skipped.push(f)\n skip = true\n end\n end\n if skip == false\n container.installFeature(\"#{f}\")\n #puts \"installing \" + \"#{f}\"\n end\n \n end\n end\n \n #puts container.getUninstalledFeatures().length\n puts \"Skipped #{skipped.length}: \"\n pp skipped\n \n end", "title": "" }, { "docid": "06ee8f855402974faac0778aa47e2b77", "score": "0.546267", "text": "def disable(*features)\n @disabled_features.concat features.flatten\n end", "title": "" }, { "docid": "d17a0201ba0938286add6a035926133a", "score": "0.5453115", "text": "def example_is_unsuitable?(tokenstream)\n if tokenstream.label_index==0\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "abdf9e444047faa97d0c2b31dbcb8b98", "score": "0.5449966", "text": "def skips_a\n tests.select(&:skipped?).map { |e| skip_h(e) }\n end", "title": "" }, { "docid": "331a5549daa72292fa36b1ca7823e31a", "score": "0.54491097", "text": "def test_disabled?\n ENV['NO_TEST'] == '1'\nend", "title": "" }, { "docid": "7adf92c3205ed574162c2855b867b32b", "score": "0.5441101", "text": "def enabled?(feature)\n raise NotImplementedError\n end", "title": "" }, { "docid": "924ee42119b393d7daf78d10a8dcd044", "score": "0.5437865", "text": "def disabled_features\n []\n end", "title": "" }, { "docid": "4bec1f4b89508fabacf39ca1f905b079", "score": "0.54369444", "text": "def needs?(feature)\n needs.include?(feature)\n end", "title": "" }, { "docid": "3269002afd27230945227bab5b8fb9ae", "score": "0.5436003", "text": "def skipped?\n raise NotImplementedError, \"subclass responsibility\"\n end", "title": "" }, { "docid": "d4dd3d8eea8e6025ed834658e52acf48", "score": "0.5434154", "text": "def irrelevant_scenario_to_create_next_task?\n case_review.appeal.is_a?(LegacyAppeal) ||\n !case_review.is_a?(JudgeCaseReview) ||\n case_review.task.parent.is_a?(QualityReviewTask) ||\n case_review.task.parent.is_a?(BvaDispatchTask)\n end", "title": "" }, { "docid": "41fa064e0a8523107ae5bc51496fd734", "score": "0.54333097", "text": "def test_skipped\n assert(line('--skip--').skipped_slide?)\n assert(line('# Examples --skip--').skipped_slide?)\n assert(line('## Examples --skip--').skipped_slide?)\n assert(line('--skip-- ').skipped_slide?)\n assert(line('# Examples --skip-- ').skipped_slide?)\n assert(line('## Examples --skip-- ').skipped_slide?)\n\n assert(!line('-- skip--').skipped_slide?)\n assert(!line('--skip --').skipped_slide?)\n assert(!line('-- skip --').skipped_slide?)\n assert(!line('-skip--').skipped_slide?)\n assert(!line('--skip-').skipped_slide?)\n end", "title": "" }, { "docid": "8f4d4d1e861cb168ba44da5ee4baede3", "score": "0.5429575", "text": "def should_test_event_be_ignored?(test_specification, event)\n return false unless event[\"test\"] == \"1\"\n test_specification.skip_test_identifiers.include?(event[\"className\"])\n end", "title": "" }, { "docid": "8f4d4d1e861cb168ba44da5ee4baede3", "score": "0.5429575", "text": "def should_test_event_be_ignored?(test_specification, event)\n return false unless event[\"test\"] == \"1\"\n test_specification.skip_test_identifiers.include?(event[\"className\"])\n end", "title": "" }, { "docid": "18756354795b5def202274cfe29cd190", "score": "0.5427787", "text": "def unattempted(selected_tests = select_tests)\n selected_tests.select(&:unattempted?)\n end", "title": "" }, { "docid": "8fd02b92cdd832963f93319c21c0df57", "score": "0.5416472", "text": "def has_feature?(*feature_names, match: :all?)\n features = get_var!(\"features\", single_match: :force)\n feature_names.map(&:to_s).send(match) do |feature_name|\n features.include? feature_name\n end\n end", "title": "" }, { "docid": "414255e8d8e199b89a8871f777e0ecb2", "score": "0.5412908", "text": "def skip?\n @skip == true\n end", "title": "" }, { "docid": "d145e25c3460daa0bb704b6786248065", "score": "0.5409896", "text": "def skip\n 'skip spec until we find good way to implement it'.should.not.be.nil\n end", "title": "" }, { "docid": "1c4fca5d150c04d0c790cf7c04fc83ad", "score": "0.5407947", "text": "def check_features\n current_features = ENV[\"FEATURES\"].split(\",\")\n\n @features = ALL_FEATURES.reduce({}) do |result, feature|\n result[feature] = current_features.include?(feature)\n result\n end\n end", "title": "" }, { "docid": "52dfd217c5832176041f20391ed209dc", "score": "0.5406215", "text": "def missing_tests_for(name, node: nil, platform: nil)\n select_tests(name, node: node, platform: platform).any? { |test| !test.executed? }\n end", "title": "" }, { "docid": "4ece6e53dfa2078daf37ae2b0d50cae0", "score": "0.5401508", "text": "def skipped?\n @skipped\n end", "title": "" }, { "docid": "4ece6e53dfa2078daf37ae2b0d50cae0", "score": "0.5401508", "text": "def skipped?\n @skipped\n end", "title": "" }, { "docid": "211ca017114e5f5f95be7fe4251f8c2a", "score": "0.5399859", "text": "def excluded?\n return false if archived?\n return false unless experiment.preconditions.any?\n return preconditions.values.include?(false)\n end", "title": "" }, { "docid": "9b608c68d4c14b0a37aa7ec4ff015a47", "score": "0.53970975", "text": "def check_features\n case params[:action]\n when \"index\"\n current_features.include?('sp_index') ? true : invalid_features\n when \"show\"\n current_features.include?('sp_detail') ? true : invalid_features\n when \"new\"\n current_features.include?('sp_new') ? true : invalid_features\n when \"edit\"\n current_features.include?('sp_edit') ? true : invalid_features\n when \"delete_multiple\"\n current_features.include?('delete_sp') ? true : invalid_features\n when \"export\"\n current_features.include?('sp_export') ? true : invalid_features\n\n end\n # return true\n end", "title": "" }, { "docid": "202e1fd8dc1f07aedae03139a98f7865", "score": "0.53970915", "text": "def skipped?\n defined?(@skip) and @skip\n end", "title": "" }, { "docid": "202e1fd8dc1f07aedae03139a98f7865", "score": "0.53970915", "text": "def skipped?\n defined?(@skip) and @skip\n end", "title": "" }, { "docid": "bad3e87eae3288a1b2d5d2278f4cbe13", "score": "0.53948635", "text": "def feature_excluded?(file)\n @sources.file_excluded?(file)\n end", "title": "" } ]
30fe3ab1250abeb6de03fbe185a5c152
GET /containers/1 GET /containers/1.json
[ { "docid": "edd84ba48df570405d529323bc4ee83c", "score": "0.0", "text": "def show\n @container = Container.find(params[:id])\n user_session[:current_container][email protected]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @container }\n format.xml { render xml: @container }\n format.csv {\n [email protected] {|x| ClavisItem.find(x['item_id']).barcode if !x['item_id'].nil?}\n send_data csv_data.join(\"\\n\"), type: Mime::CSV, disposition: \"attachment; filename=container_#{@container.label}.csv\"\n }\n end\n end", "title": "" } ]
[ { "docid": "9ad0c2ce4f1dea0d1243e3c6fab942c3", "score": "0.7074826", "text": "def index\n @containers = Container.all\n end", "title": "" }, { "docid": "fbf5ae28f0495375aece4560c8830851", "score": "0.6794176", "text": "def index\n user_session[:current_container]=nil\n if params[:label].blank?\n @containers = Container.list(params[:filter])\n else\n @container = Container.find_by_label(params[:label])\n render action: 'show' and return\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @containers }\n end\n end", "title": "" }, { "docid": "159275fec5b843b747f27877eef3bcc7", "score": "0.67128915", "text": "def create\n response = post_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers.json\"), params[:container].to_json, (sesh :current_token))\n json_respond response.body \n\n end", "title": "" }, { "docid": "90872b2c61b890ec4db4d604bd40b4a3", "score": "0.6569482", "text": "def containers\n TestLab::Container.all\n end", "title": "" }, { "docid": "3713d9e02dfcd3d54d0738a1b77b1f62", "score": "0.65160394", "text": "def create\n response = post_request(URI.parse(\"http://\"+Storage.find(cookies[:donabe_ip]).data+\"/\"+Storage.find(cookies[:current_tenant]).data+\"/containers.json\"), params[:container].to_json, Storage.find(cookies[:current_token]).data)\n json_respond response.body \n\n end", "title": "" }, { "docid": "d9d08efb6fab28d0e24011dbf84d740f", "score": "0.6500382", "text": "def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n filters: { id: container_ids }.to_json\n ).map(&:json)\n end", "title": "" }, { "docid": "aed626b8fafb9da4883b982db5ece9b6", "score": "0.6481558", "text": "def index_containers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContainersApi.index_containers ...'\n end\n # resource path\n local_var_path = '/containers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort_by'] = @api_client.build_collection_param(opts[:'sort_by'], :pipe) if !opts[:'sort_by'].nil?\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n query_params[:'quota_total_size'] = opts[:'quota_total_size'] if !opts[:'quota_total_size'].nil?\n query_params[:'quota_on_cache'] = opts[:'quota_on_cache'] if !opts[:'quota_on_cache'].nil?\n query_params[:'stat_total_files'] = opts[:'stat_total_files'] if !opts[:'stat_total_files'].nil?\n query_params[:'stat_total_size'] = opts[:'stat_total_size'] if !opts[:'stat_total_size'].nil?\n query_params[:'stat_size_on_cache'] = opts[:'stat_size_on_cache'] if !opts[:'stat_size_on_cache'].nil?\n query_params[:'guest_right'] = opts[:'guest_right'] if !opts[:'guest_right'].nil?\n query_params[:'last_update'] = opts[:'last_update'] if !opts[:'last_update'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ContainerCollection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContainersApi#index_containers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "840a5535f69d6addf46d9b0c4594fa38", "score": "0.64789015", "text": "def containers(key = nil, options = {})\n key ||= properties.key1\n\n query = \"comp=list\"\n options.each { |okey, ovalue| query += \"&#{okey}=#{[ovalue].flatten.join(',')}\" }\n\n response = blob_response(key, query)\n\n doc = Nokogiri::XML(response.body)\n\n results = doc.xpath('//Containers/Container').collect do |element|\n Container.new(Hash.from_xml(element.to_s)['Container'])\n end\n\n results.concat(next_marker_results(doc, :containers, key, options))\n end", "title": "" }, { "docid": "c07c38919c71e52af0b5261714c2724f", "score": "0.64031994", "text": "def list # rubocop:disable Metrics/AbcSize\n if @options[:container]\n containerview = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n containerview = containerview.contents(@options[:container])\n if containerview.code == '201' || containerview.code == '200'\n containerview.body\n elsif containerview.code == '204'\n print 'the container is empty'\n else\n @util.response_handler(containerview)\n end\n else\n newcontainer = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n newcontainer = newcontainer.list\n @util.response_handler(newcontainer)\n newcontainer.body if newcontainer.code == '200'\n puts 'there are no containers' if newcontainer.code == '204'\n end \n end", "title": "" }, { "docid": "ebf32f11631e7fe00cffba2b2b5a540f", "score": "0.63865006", "text": "def show\n @container_stack = ContainerStack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @container_stack }\n end\n end", "title": "" }, { "docid": "fcb02d2f9e0e7878ec629fa338df48c2", "score": "0.6310694", "text": "def list_containers(options={})\n query = { }\n if options\n query['prefix'] = options[:prefix] if options[:prefix]\n query['marker'] = options[:marker] if options[:marker]\n query['maxresults'] = options[:max_results].to_s if options[:max_results]\n query['include'] = 'metadata' if options[:metadata] == true\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n end\n\n uri = containers_uri(query)\n response = call(:get, uri)\n\n Serialization.container_enumeration_results_from_xml(response.body)\n end", "title": "" }, { "docid": "11e8bd82840a9ac04a8406f756befe37", "score": "0.62399095", "text": "def container(container_id)\n if container_id\n container = ::Docker::Container.send(:new, @dockerd, container_id)\n # return the container json if we can retrieve it.\n begin\n # check the container exists by querying its json\n container.json\n container\n # if the container doesn't exist we get an Excon 404\n rescue Excon::Errors::NotFound\n nil\n end\n else\n nil\n end\n end", "title": "" }, { "docid": "c94092aa144b6b840c36b00d774ad2c2", "score": "0.618074", "text": "def index_containers(opts = {})\n data, _status_code, _headers = index_containers_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "edbc8841a9528c1f2c75c078c9b70f38", "score": "0.6119726", "text": "def read_containers\n []\n end", "title": "" }, { "docid": "3b0da675e855864f03af78a1d743bb79", "score": "0.60469884", "text": "def get_container(container_name)\n container = Docker::Container.all().find do |container|\n container.json['Name'] == \"/#{container_name}\"\n end\n\n if container.nil?\n Kernel.abort(\"Error: Docker container '#{container_name}' does not appear to be running. Please use 'docker logs -f #{container_name}' to investigate any start-up failures.\")\n # This return statement is required as we mock the Kernel.abort call in unit testing.\n return\n end\n\n container\nend", "title": "" }, { "docid": "05499079e401652f411c7db1191450ea", "score": "0.6031098", "text": "def get_containers\n assert_not_nil @rdigg.info.get_containers\n end", "title": "" }, { "docid": "6cf1c9972aa04fce152abcc3eca2a673", "score": "0.6013742", "text": "def container\n @container ||= Docker::Container.get(@name)\n rescue Docker::Error::NotFoundError\n @container = nil\n end", "title": "" }, { "docid": "4475407a52819308083add9d3970450d", "score": "0.6007393", "text": "def get_container\n container_id_key = params.keys.find_all { |key| key =~ /\\w+_id/ }.last\n container_class = eval(container_id_key.humanize.titleize.delete(' '))\n @container = container_class.find_by_id(params[container_id_key])\n redirect_with_error 'Invalid project id' unless @container\n end", "title": "" }, { "docid": "7aef4e665aa0a216cc9d1d369cb362c5", "score": "0.5995201", "text": "def get_container(container_name = \"lightstructures\")\n containers = $azure_blob_service.list_containers()\n return containers.detect { |c| c.name == container_name } # Must be better ways?!\nend", "title": "" }, { "docid": "51dda6d7412f75e4599758a90c8c9ef8", "score": "0.5950516", "text": "def show\n @level_container = LevelContainer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @level_container }\n end\n end", "title": "" }, { "docid": "9574a911c91a250516a6743962a6df9d", "score": "0.59365", "text": "def show\n @container_navigation = ContainerNavigation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @container_navigation }\n end\n end", "title": "" }, { "docid": "fbeb5eb072a2f02ffdc1906382494833", "score": "0.5922143", "text": "def running_containers\n containers = ::Docker::Container.all(all: true, filters: { status: [\"running\"] }.to_json)\n return containers\n end", "title": "" }, { "docid": "fdf053d8b9eaa9f4adfd9b01b5f82247", "score": "0.59125537", "text": "def containers_ids\n containers(:response_format => :id_array)\n end", "title": "" }, { "docid": "99f0b9838cd798ee8524a25faba5da33", "score": "0.587999", "text": "def get_container_properties(name, options={})\n # Query\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n # Call\n response = call(:get, container_uri(name, query), nil, {}, options)\n\n # result\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container\n end", "title": "" }, { "docid": "7aa000ed4ff7135a02de7d16fce709ab", "score": "0.5879031", "text": "def get_container_instance(container)\n Docker::Container.all(all: true).each do |cont|\n return cont if cont.id == container\n end\n end", "title": "" }, { "docid": "be719e79037f310b016841c1f13679f1", "score": "0.58584887", "text": "def container\n return nil if container_type.blank? || container_id.blank?\n container_type.constantize.where(id: container_id).first\n end", "title": "" }, { "docid": "ca614494fd8666ffbb49d4abafcf5b89", "score": "0.5852599", "text": "def index\n @containers_pages = @page.containers_pages\n end", "title": "" }, { "docid": "043dd23f669dd19ac2715531a5f4ca85", "score": "0.5847821", "text": "def get_container_properties(name, options={})\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n response = call(:get, container_uri(name, query))\n\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container\n end", "title": "" }, { "docid": "3642d55f13e150ed7c81e27b7a44dc00", "score": "0.5846766", "text": "def get # replace this with the call that I use in my class that follows redirects\n @debug and $stderr.puts \"getting container\"\n @debug and $stderr.puts self.uri, {accept: \"text/turtle\"}, self.client.username, self.client.password\n response = LDP::HTTPUtils.get(self.uri, {accept: \"text/turtle\"}, self.client.username, self.client.password)\n etag = Digest::SHA2.hexdigest `date` \n headers = {ETag: \"#{etag}\", accept: 'text/turtle', content_type: 'text/turtle'}\n\n response = LDP::HTTPUtils.get(self.uri, headers, self.client.username, self.client.password)\n\n if response\n return response\n else\n @debug and $stderr.puts \"FAILED to find this container #{self.uri.to_s}\" # do something more useful, one day\n return false\n end\n end", "title": "" }, { "docid": "bf03c98d1398e217c9cff1fa5066948c", "score": "0.58311975", "text": "def show_container_with_http_info(container_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContainersApi.show_container ...'\n end\n # verify the required parameter 'container_id' is set\n if @api_client.config.client_side_validation && container_id.nil?\n fail ArgumentError, \"Missing the required parameter 'container_id' when calling ContainersApi.show_container\"\n end\n # resource path\n local_var_path = '/containers/{container_id}'.sub('{' + 'container_id' + '}', CGI.escape(container_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Container' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContainersApi#show_container\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "717ac27d8083b0f9e4f7d1dbcf76131c", "score": "0.58248836", "text": "def index\n status = get_health_status( )\n response = make_response( status )\n #render json: response, :status => response.is_healthy? ? 200 : 500\n render json: response, :status => 200 # dont want to continuously restart the container\n end", "title": "" }, { "docid": "a1582b362389e407e3400a765319933a", "score": "0.58172673", "text": "def index\n if @container\n @container_contents = @container.container_contents\n else\n @container_contents = ContainerContent.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @container_contents }\n end\n end", "title": "" }, { "docid": "d4dbde0127dc41478dec45fedab0da4c", "score": "0.5810613", "text": "def inspect(container_s)\n containers = container_s\n containers = [containers] unless container_s.is_a?(Array)\n return [] if containers.empty?\n out = run!('inspect', containers)\n result = JSON.parse(out).map { |c| Container.new(c, session:self)}\n if container_s.is_a?(Array)\n result\n else\n result.first\n end\n end", "title": "" }, { "docid": "cff411c3afbced53ab4a1fd3b2f78083", "score": "0.58079505", "text": "def id\n container.id\n end", "title": "" }, { "docid": "46d9eed136c41572f916687ad53025bb", "score": "0.5786551", "text": "def index\n @serverhascontainers = Serverhascontainer.all\n end", "title": "" }, { "docid": "ffdd6dc9f11625589b16b5f64a67cc9d", "score": "0.5778673", "text": "def show\n @container = Container.get!(params[:id])\n @dropbox = Dropbox.new(@container)\n @upload_url = upload_container_url(@container.id)\n if Ixtlan::Guard.check(self, :containers, :edit, nil) || @container.public?\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @container }\n end\n else\n redirect_to container_url(Container.root.id)\n end\n end", "title": "" }, { "docid": "065f8a72fb7b37e1578d31cd03e9f54f", "score": "0.5774182", "text": "def get_container_metadata(name, options={})\n # Query\n query = { 'comp' => 'metadata' }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n # Call\n response = call(:get, container_uri(name, query), nil, {}, options)\n\n # result\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container\n end", "title": "" }, { "docid": "9f4fc5961d4df2454e3de03fafb24b96", "score": "0.5770003", "text": "def destroy\n @container = Container.find(params[:id])\n @container.destroy\n\n respond_to do |format|\n format.html { redirect_to containers_url, notice: 'Container was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "74931edff419e1f938a0a663417d8967", "score": "0.57666767", "text": "def containers\n containers_exited(days_old: 1)\n containers_running(days_old: 1)\n end", "title": "" }, { "docid": "2f243d755541f7a565784fe847cc2ffd", "score": "0.5736111", "text": "def container\n @container ||= Container.new(spec[:containers].first)\n end", "title": "" }, { "docid": "457d51f5cfe857780f5e7a377ff44f8d", "score": "0.5735027", "text": "def get_container_metadata(name, options={})\n query = { 'comp' => 'metadata'}\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n response = call(:get, container_uri(name, query))\n\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container\n end", "title": "" }, { "docid": "502b9eef6f730c2504de361066ef8719", "score": "0.5720252", "text": "def set_container\n @container = Container.find(params[:id])\n end", "title": "" }, { "docid": "502b9eef6f730c2504de361066ef8719", "score": "0.5720252", "text": "def set_container\n @container = Container.find(params[:id])\n end", "title": "" }, { "docid": "1f9c44a9f12d7913fa6ef1744a32450d", "score": "0.5685757", "text": "def index\n @declaration_containers = @declaration.declaration_containers.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @declaration_containers }\n end\n end", "title": "" }, { "docid": "29ca6c0567fb45685cbf133729112b81", "score": "0.5684041", "text": "def info\n container.info\n end", "title": "" }, { "docid": "51b53985f93bf05f32da08f5e25d05c0", "score": "0.5679018", "text": "def create\n response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers/\"+params[:containerID].to_s+\"/deploy.json\"), (sesh :current_token))\n json_respond response.body\n end", "title": "" }, { "docid": "d1a4f3755b6c1e58d3d566f089a6ad68", "score": "0.5674141", "text": "def container\n namespace + '_container'\n end", "title": "" }, { "docid": "91e0aeb5502bd3d4d8450d7ada401317", "score": "0.56648797", "text": "def metadata\n log \"retrieving container metadata from #{container_path}\"\n response = storage_client.head(container_path)\n custom = {}\n response.each_capitalized_name { |name|\n custom[name] = response[name] if name[/\\AX-Container-Meta-/]\n }\n {\n :objects => response[\"X-Container-Object-Count\"].to_i,\n :bytes => response[\"X-Container-Bytes-Used\"].to_i,\n :custom => custom,\n }\n end", "title": "" }, { "docid": "6955cd0df7ded68d46aab2959ee4e7af", "score": "0.5650905", "text": "def new\n @container_stack = ContainerStack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @container_stack }\n end\n end", "title": "" }, { "docid": "8bde1903cdc2e8ef5387bbbccab008ca", "score": "0.565049", "text": "def create params = {}, body = {}\n @connection.request(method: :post, path: build_path(\"/containers/create\", params), headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "title": "" }, { "docid": "3bccd96233219a85875097d03f5b84db", "score": "0.56472456", "text": "def create\n begin\n #get the server chosen container_params[:server_id]\n @currentServer = Server.where(id: container_params[:server_id])\n Docker.url = 'tcp://' + @currentServer[0].ip + \":\" + @currentServer[0].port\n\n #create the container in docker\n if container_params[:exposed_port].blank?\n @con = Docker::Container.create(\n 'name' => container_params[:name],\n 'Image' => container_params[:image]\n ) \n else \n @con = Docker::Container.create(\n 'name' => container_params[:name],\n 'Image' => container_params[:image],\n 'ExposedPorts' => { container_params[:exposed_port]+'/tcp' => {} },\n 'HostConfig' => {\n 'PortBindings' => {\n container_params[:exposed_port]+'/tcp' => [{ 'HostPort' => container_params[:host_port] }]\n }\n }\n )\n end\n\n #adds the container into the database\n @container = Container.new(:name => container_params[:name], :image => container_params[:image], :command => container_params[:command], :exposed_port => container_params[:exposed_port], \n :host_port => container_params[:host_port], :dockercontainer_id => @con.id, :status => 'Created')\n\n Docker.url = ''\n\n respond_to do |format|\n if @container.save\n Serverhascontainer.new(:server_id => @currentServer[0].id, :container_id => @container.id).save\n format.html { redirect_to root_path, notice: 'Container was successfully created.' }\n format.json { render :show, status: :created, location: @container }\n else\n format.html { render :new }\n format.json { render json: @container.errors, status: :unprocessable_entity }\n end\n end\n\n rescue Docker::Error::ClientError => e\n respond_to do |format| \n format.html { redirect_to root_path, notice: \"Oops: #{e.message}\" }\n end\n\n rescue Docker::Error::NotFoundError => e\n respond_to do |format| \n format.html { redirect_to root_path, notice: \"Oops: #{e.message}\" }\n end\n\n rescue Docker::Error::ConflictError => e\n respond_to do |format| \n format.html { redirect_to root_path, notice: \"Oops: #{e.message}\" }\n end\n\n end\n end", "title": "" }, { "docid": "fb2c288e30083cc4db6f7ed0d6961855", "score": "0.5642961", "text": "def container_id\n if !params[:container_id].nil?\n return params[:container_id]\n else\n return params[:id]\n end\n end", "title": "" }, { "docid": "7ce66dfd4859136ef14ec8745e025f24", "score": "0.56262577", "text": "def find_container\n if action_name.in? ['create', 'update']\n cid = params[:container_id]\n else\n cid = params[:id]\n params[:id] = params[:download_id]\n alid = params[:activity_log_id]\n altype = params[:activity_log_type]\n end\n @container = NfsStore::Browse.open_container id: cid, user: current_user\n @retrieval_type = params[:retrieval_type]\n\n @activity_log = ActivityLog.open_activity_log altype, alid, current_user if alid.present? && altype.present?\n\n case @retrieval_type\n when 'stored_file'\n @download = @container.stored_files.find_by(id: params[:download_id])\n when 'archived_file'\n @download = @container.archived_files.find_by(id: params[:download_id])\n else\n raise FphsException, 'Incorrect retrieval_type set'\n end\n\n @container.parent_item = @activity_log\n @master = @container.master\n @master.current_user ||= current_user\n # object_instance.container = @container\n @container\n end", "title": "" }, { "docid": "b9da4cf50315c6d579e271ecedde5abc", "score": "0.5621091", "text": "def create_container(collection, container = nil)\n active_container = container\n if active_container.nil?\n active_container = {\n \"metadata\": [\n {\n \"key\": \"dc.title\",\n \"language\": \"en_US\",\n \"value\": \"Empty Container Document\"\n },\n {\n \"key\": \"dc.contributor.author\",\n \"language\": \"en_US\",\n \"value\": \"Data Services, Bobst Library\"\n }\n ]\n }\n end\n cmd = `curl -X POST -H \"Content-Type: application/json\" -H \"Accept: application/json\" -H \"rest-dspace-token: #{@token}\" -d '#{JSON.generate(active_container)}' #{ENV[\"FDA_REST_ENDPOINT\"]}/collections/#{collection}/items --insecure -s`\n return JSON.parse(cmd)\n end", "title": "" }, { "docid": "3a8dd7ba03a22a71bb98ce6b251d92d4", "score": "0.5619961", "text": "def get_docker_container(environment, container_name)\n container_id = \"#{environment.get_compose_project_name}_#{container_name}\"\n container = get_container(container_id)\n until container.json['NetworkSettings']['Ports']\n container = get_container(container_id)\n end\n container\nend", "title": "" }, { "docid": "eb8670a31d051dc2bc37b0496afca0b0", "score": "0.56008124", "text": "def get_containers\n content = YAML::load(File.read(docker_compose_file))\n content.has_key?('version') ? content['services'].keys : content.keys\n end", "title": "" }, { "docid": "dda2081443c1cf9cbeefc649f9bc981b", "score": "0.5557623", "text": "def containers\n return @containers\n end", "title": "" }, { "docid": "14e4f7c9a2203ec9b9a2cc46fe2848f3", "score": "0.5553981", "text": "def show\n @receipt_container = ReceiptContainer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @receipt_container }\n end\n end", "title": "" }, { "docid": "61d35bcca9b264f07a0eb81536e0e7e0", "score": "0.5548074", "text": "def get_container(container_name)\n assert_not_nil @rdigg.info.get_container(\"technology\")\n end", "title": "" }, { "docid": "7f8a09545f2fd1cb771b98dfa90f8b44", "score": "0.55324674", "text": "def index\n @docker_instances = DockerInstance.all\n @docker_instance = DockerInstance.new\n end", "title": "" }, { "docid": "ce3471b3a6201943e9e32e27f82b38b1", "score": "0.5519807", "text": "def containers=(value)\n @containers = value\n end", "title": "" }, { "docid": "f297cb34183bd078f830ada2406d4f7b", "score": "0.5507635", "text": "def get(container_name, file_name)\n validate_path_elements(container_name, file_name)\n\n File.from_response(\n file_name,\n client.request_raw_response(\n method: :get,\n path: \"#{container_name}/#{file_name}\",\n expected: 200,\n )\n )\n end", "title": "" }, { "docid": "7cb1a4db7e1443960e067afd4aa53419", "score": "0.549973", "text": "def container_properties(name, key = nil)\n key ||= properties.key1\n\n response = blob_response(key, \"restype=container\", name)\n\n ContainerProperty.new(response.headers)\n end", "title": "" }, { "docid": "22dce10cf7193b77da83cb2c679cba72", "score": "0.54957247", "text": "def container_id\n @container_info[\"Id\"]\n end", "title": "" }, { "docid": "f77c39b3fc47167b2fcd485651b18c76", "score": "0.54885495", "text": "def objects(container = @default_container,\n path: nil, limit: nil, gt: nil, lt: nil)\n path = path[1..-1] if path && path[0] == ?/\n p = { path: path, limit: limit, marker: gt, end_marker: lt\n }.delete_if {|k,v| v.nil? }\n j,h = api_openstack(:get, container, p)\n Hash[j.map {|o| [ o['name'], {\n :hash => o['hash'],\n :lastmod => Time.parse(o['last_modified']),\n :size => o['bytes'].to_i,\n :type => o['content_type'],\n :contuse => h['x-container-bytes-used'],\n :contoct => h['x-container-object-coun'],\n :storpol => h['x-storage-policy'],\n } ] } ]\n end", "title": "" }, { "docid": "05c555f82c335a23cae802fae594033d", "score": "0.5480187", "text": "def get_containers\n init_folder unless @init # have I been initialized?\n return @containers \n end", "title": "" }, { "docid": "f988f7fb69a851a952466c8470cc9715", "score": "0.5469937", "text": "def container\n cache or raise RuntimeError, \"no container known.\"\n end", "title": "" }, { "docid": "425606bd3942c810b90574e26c5aa127", "score": "0.5466567", "text": "def destroy\n @container = Container.find(params[:id])\n @container.destroy\n\n respond_to do |format|\n format.html { redirect_to(containers_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a95b9cbadc6a5abba7b3f5202da369e1", "score": "0.54449356", "text": "def get_container_id(image=@ws_image, hosts=@hosts)\n hosts.each do |host|\n Docker.url = \"tcp://#{host}:#{@docker_port}/\"\n containers = Docker::Container.all(all: true, filters: { ancestor: [image],status:['running'] }.to_json)\n return containers.first unless containers.empty?\n end\n fail('Could not found a webserver running')\n end", "title": "" }, { "docid": "a6e420ddcb6b197be0eedbb75e3c5132", "score": "0.5434943", "text": "def index\n if (params[:user])\n @containers = User.find_by_login(params[:user]).containers\n else\n if (current_user.nil?)\n redirect_to :controller => :users, :action => :login\n return\n else\n @containers = current_user.containers\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :layout => false }\n end\n end", "title": "" }, { "docid": "2b48c928c5b2750ad9e06850e17ccbc8", "score": "0.5433085", "text": "def container_params\n params.require(:container).permit(:name, :image, :command, :exposed_port, :host_port, :server_id)\n end", "title": "" }, { "docid": "794ce31577be9554903ac1c2f4f737c9", "score": "0.5428436", "text": "def read_pods\n kubeclient = build_kube_client!\n\n kubeclient.get_pods(namespace: actual_namespace).as_json\n rescue Kubeclient::ResourceNotFoundError\n []\n end", "title": "" }, { "docid": "5218693390c9780bec66ac9c8b797a80", "score": "0.5422364", "text": "def show\n @container_content = ContainerContent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @container_content }\n end\n end", "title": "" }, { "docid": "30bfac5071364ccfe78b8d755bdf9730", "score": "0.5417368", "text": "def all\n containers = service.list_containers\n data = []\n containers.each do |container|\n c = parse_storage_object(container)\n c[:acl] = 'unknown'\n data << c\n end\n load(data)\n end", "title": "" }, { "docid": "93068dc431c6b0bedca256d98810cde5", "score": "0.54103607", "text": "def show\n @containers_pages = @page.containers_pages \n end", "title": "" }, { "docid": "4e7b11717dad0b32d0dec8fe111b74de", "score": "0.5406298", "text": "def add_container(params = {})\n now = Time.now.strftime(\"%Y-%m-%dT%H:%M:%S\")\n now = now.gsub(':', '--')\n\n @slug = params.fetch(:slug, now)\n \n containers = self.get_containers\n containers.each do |c|\n return c if c.uri.to_s.match(/\\/#{@slug}\\/?$/) # check if it already exists\n end\n \n # headers = {accept: 'text/turtle', content_type: 'text/turtle', \"Slug\" => @slug, \"Link\" => '<http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"'}\n \n payload = \"\"\"@prefix ldp: <http://www.w3.org/ns/ldp#> . \n <> a ldp:Container, ldp:BasicContainer .\"\"\"\n etag = Digest::SHA2.hexdigest payload \n headers = {ETag: \"#{etag}\", accept: 'text/turtle', content_type: 'text/turtle', \"Slug\" => @slug, \"Link\" => '<http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"'}\n \n \n response = LDP::HTTPUtils::post(self.uri, headers, payload, self.client.username, self.client.password)\n if response\n newuri = response.headers[:location] \n newcont = self._add_container({:uri => newuri,\n :client => self.client,\n :parent => self,\n :top => self.toplevel_container,\n :init => true})\n unless newcont\n abort \"PROBLEM - cannot add new container with id #{newuri}. BAILING just to be safe\"\n end\n return newcont\n else\n abort \"PROBLEM - cannot create container into #{self.uri}. BAILING just to be safe\"\n end\n \n end", "title": "" }, { "docid": "09d268c6bd81b7b7abfe9471dc67538f", "score": "0.54026693", "text": "def list # rubocop:disable Metrics/AbcSize\n authcookie = ComputeBase.new\n authcookie = authcookie.authenticate(id_domain, user, passwd, restendpoint)\n url = restendpoint + @function + container\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port) # Creates a http object\n http.use_ssl = true # When using https\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field 'accept', 'application/oracle-compute-v3+json' if action == 'details'\n request.add_field 'accept', 'application/oracle-compute-v3+directory+json' if action == 'list'\n request.add_field 'Cookie', authcookie\n http.request(request)\n end", "title": "" }, { "docid": "a90265d40c5de523af5582a09f0326c6", "score": "0.5398727", "text": "def search(prefix)\n log \"retrieving container listing from #{container_path} items starting with #{prefix}\"\n list(prefix: prefix)\n end", "title": "" }, { "docid": "e50433af4045fb98432278b26963af80", "score": "0.53938794", "text": "def container_uri(name, query={})\n return name if name.kind_of? ::URI\n query = { 'restype' => 'container'}.merge(query)\n generate_uri(name, query)\n end", "title": "" }, { "docid": "aee277d45219923f25c70414cfc9983b", "score": "0.539265", "text": "def containers\n obj = parse_object(1)\n return nil unless obj && obj.m_Container && obj.m_Container.array?\n obj.m_Container.value.map do |e|\n {:name => e.first.value, :preload_index => e.second.preloadIndex.value, :path_id => e.second.asset.m_PathID.value}\n end\n end", "title": "" }, { "docid": "e316730782c1db9b876063bd2730f3de", "score": "0.53902763", "text": "def get_containers_by(params)\n @containers.values.select do |container|\n (params.to_a - container.attributes.to_a).empty?\n end\n end", "title": "" }, { "docid": "993ab196568c59b59c8d087c06a0222a", "score": "0.53874916", "text": "def index\n nova_ip = nil\n quantum_ip = nil\n # Read X-Auth-Token from message header and extract nova/quantum IPs\n if request.headers[\"X-Auth-Token\"] != \"\"\n token = request.headers[\"X-Auth-Token\"]\n begin\n services = Donabe::KEYSTONE.get_endpoints(token)\n services[\"endpoints\"].each do |endpoint|\n if endpoint[\"name\"] == \"nova\"\n nova_ip = endpoint[\"internalURL\"]\n elsif endpoint[\"name\"] == \"quantum\"\n quantum_ip = endpoint[\"internalURL\"]\n end\n end\n # Check if these nodes are active using given nova/quantum IPs\n checkNodes(DeployedContainer.where(:tenant_id => params[:tenant_id]),nova_ip,quantum_ip,token)\n\n @deployed_containers = DeployedContainer.where(:tenant_id => params[:tenant_id])\n logger.info \"Deployed Containers:\"\n logger.info @deployed_containers.to_s()\n rescue\n # Donabe no longer holds its own cookies\n # This rescue solution is deprecated\n # token = Storage.find(cookies[:current_token]).data\n # nova_ip = Storage.find(cookies[:nova_ip]).data\n # quantum_ip = Storage.find(cookies[:quantum_ip]).data\n\n logger.info \"Incorrect/Expired Token Received From Curvature:\"\n logger.info token\n \n # Respond with HTTP 401 Unauthorized\n render status: :unauthorized\n end\n else\n # Respond with HTTP 401 Unauthorized\n render status: :unauthorized\n end\n end", "title": "" }, { "docid": "4057b4258f4d15fb56b9d9090f895a7f", "score": "0.53804517", "text": "def containers_from_solr\n containers(:response_format => :load_from_solr)\n end", "title": "" }, { "docid": "fbc20b6b5fc5224cbaf09065c9b27e7c", "score": "0.53789115", "text": "def show\n @konfig = Konfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konfig }\n end\n end", "title": "" }, { "docid": "3f4d71682dc58dc6032e6c149ecbfb1a", "score": "0.5369353", "text": "def check_container(name)\n begin\n container=CF.container(name)\n container.make_public unless container.cdn_enabled?\n puts container.cdn_url if container.cdn_enabled?\n count=container.count\n rescue CloudFiles::Exception::NoSuchContainer\n container=CF.create_container(name)\n container.make_public\n count=container.count\n rescue CloudFiles::Exception::InvalidResponse\n\tSTDERR.puts \"FAIL: Invalid response container\"\n exit\n end\n return count\nend", "title": "" }, { "docid": "68e08dc52c47d7bda0433d6ac9fc0dd2", "score": "0.5353244", "text": "def handle_create(event)\n @bus.request 'containers', 'created', event: event.json, container: container_info(event.id)\n end", "title": "" }, { "docid": "60528cd7ab53148df76a39e37b8f70e9", "score": "0.5340771", "text": "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "title": "" }, { "docid": "7222bd05ed87f89f1b30418ee50038fb", "score": "0.53275836", "text": "def container\n @container ||= find_or_create_container\n end", "title": "" }, { "docid": "72d19a7ab67533ece1d56cb5a7c89e47", "score": "0.53242326", "text": "def read_container_id\n @id = ContainerStateFiles.read_container_id(store_address)\n cid = @id\n # SystemDebug.debug(SystemDebug.containers, 'read container from file ', @container_id)\n if @id == -1 || @id.nil? # && set_state != :nocontainer\n info = container_api.inspect_container_by_name(@container_name) # docker_info\n info = info[0] if info.is_a?(Array)\n if info.key?(:RepoTags)\n #No container by that name and it will return images by that name WTF\n @id = -1\n else\n @id = info[:Id] if info.key?(:Id)\n end\n end\n save_state unless cid == @id\n @id\n rescue EnginesException\n clear_cid unless cid == -1\n @id = -1\n end", "title": "" }, { "docid": "144398410542c45a10d9fe48aaade12e", "score": "0.5311731", "text": "def containers_for_image(img = docker_image)\n `docker ps -aq -f ancestor=#{img}`.split(\"\\n\")\n end", "title": "" }, { "docid": "30d0bea89cb7a54c7182d26310781577", "score": "0.5310323", "text": "def new\n @container = Container.new\n \n respond_to do |format|\n format.html { render :action => :edit }\n format.xml { render :action => :edit, :xml => @container }\n end\n end", "title": "" }, { "docid": "b6e2d3ff236287206980da98ad5dd203", "score": "0.5306893", "text": "def container_names\n (@pod.dig(:spec, :containers) + self.class.init_containers(@pod)).map { |c| c.fetch(:name) }.uniq\n end", "title": "" }, { "docid": "d83f18b3d7d5c8cd8de27a4417969daa", "score": "0.5304391", "text": "def id\n container_info.ids[0] if container_info.entries.length == 1\n end", "title": "" }, { "docid": "d2d2e774dc691059eeddfaf193ffb4ee", "score": "0.5299248", "text": "def container_params\n params.require(:container).permit(:name, :container_name, :image)\n end", "title": "" }, { "docid": "83c9c6ef254361d0f7d56b1ff5791ec8", "score": "0.52987164", "text": "def show_container(container_id, opts = {})\n data, _status_code, _headers = show_container_with_http_info(container_id, opts)\n data\n end", "title": "" }, { "docid": "154cdd62c449e3546d03eecd89fcc917", "score": "0.5298485", "text": "def container_id\n return @container_id\n end", "title": "" }, { "docid": "85d92960429e6f46efb67cf3e3930ba2", "score": "0.5292447", "text": "def show\n @console_pool = ConsolePool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @console_pool }\n end\n end", "title": "" }, { "docid": "2a1bd3cd8c35ca4fbf9ea3be81a2ebd0", "score": "0.5277423", "text": "def handle_start(event)\n @bus.request 'containers', 'started', event: event.json, container: container_info(event.id)\n end", "title": "" }, { "docid": "38c376c29e42bc5c5c022fe28e0c96b0", "score": "0.5261104", "text": "def get_container_acl(name, options={})\n # Query\n query = { 'comp' => 'acl' }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n \n # Call\n response = call(:get, container_uri(name, query), nil, {}, options)\n\n # Result\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n\n signed_identifiers = nil\n signed_identifiers = Serialization.signed_identifiers_from_xml(response.body) if response.body != nil && response.body.length > 0\n\n return container, signed_identifiers\n end", "title": "" }, { "docid": "551d1d151c147d68fb6c5e0b5a6b1bc5", "score": "0.52571154", "text": "def container\n options.fetch(:container)\n end", "title": "" }, { "docid": "9b96e3a7886e80ea92951ffe8dce3d8e", "score": "0.52458936", "text": "def index\n response = HTTParty.get('http://okta-api:8080/pets/v1/cats', {headers: {\"X-Token\"=> session[:oktastate][:credentials][:token]}})\n if response.code == 200\n @cats = JSON.parse(response.body)\n else\n @cats = []\n end\n end", "title": "" } ]
747e3bdd1c705580c008674d0ce15922
Public: Creates a child class of Yacl::Define::Cli::Parser block an optional block will be evaluated in the context of the created class. The child class is created once, and the block is evaluated once. Further class to this method will result in returning the already defined class.
[ { "docid": "c116ac74122358d7ff09174e463ff3c1", "score": "0.78133017", "text": "def parser( &block )\n nested_class( 'Parser', Yacl::Define::Cli::Parser, &block )\n end", "title": "" } ]
[ { "docid": "f4a9d5d8f60ebe7b05c3b27c85a9cab5", "score": "0.65774", "text": "def initialize block_parser\n @block_parser = block_parser\nend", "title": "" }, { "docid": "6bc76d7de175355dd155d7df3e2d0a58", "score": "0.5960093", "text": "def initialize(name, parser, &block)\n @name = name\n @parser = parser\n @modules = []\n @wrapped_functions = []\n @wrapped_classes = []\n @wrapped_structs = []\n\n block.call(self) if block\n end", "title": "" }, { "docid": "a856d986a860beec5e53919eb4b3d564", "score": "0.59382117", "text": "def subclass( & block )\n \n return frame_definer.subclass( & block )\n\n end", "title": "" }, { "docid": "036654a7f0bef59490212aedb035c872", "score": "0.5898355", "text": "def klass\n @klass ||= Class.new(Parslet::Parser)\n end", "title": "" }, { "docid": "909d193c57e213c34f4ba96f9fbc0bae", "score": "0.5896756", "text": "def define &block\n new block\n end", "title": "" }, { "docid": "885d8c9f6d5f9dfa855ebdf042768092", "score": "0.58588094", "text": "def child(fields = {})\n ch = self.class.new(self, fields)\n\n if !block_given?\n ch\n else\n yield ch\n end\n end", "title": "" }, { "docid": "8e32c3780959064a7e7070a124bef733", "score": "0.5849967", "text": "def _klass_new(*args, &block)\n inst = super()\n inst._set_self(_self)\n inst._struct_class = _struct_class\n if args.first.is_a?(::Hash)\n inst._load(args.first)\n end\n if block\n inst.build!(&block)\n end\n inst\n end", "title": "" }, { "docid": "e399d057aca5ccbeb2cfdb053a1aa450", "score": "0.5833851", "text": "def inherit_type(klass, &block)\n Class.new(klass) do\n class_eval(&block) if block_given?\n end\n end", "title": "" }, { "docid": "bfe509fcae46e851b8df5878e7657243", "score": "0.58116716", "text": "def define(&block)\n @definition ||= DSL.new(\n processor_type: self, parent: superclass.definition, **config, &block\n )\n self\n end", "title": "" }, { "docid": "77fe6668887ae0e6f3272c8931e0faee", "score": "0.5801311", "text": "def parse!\n raise NotImplementedError, \"this class is intended to be a top class, not a useful parser\"\n end", "title": "" }, { "docid": "b9a745ef7734f8667179b27107b2d622", "score": "0.57567275", "text": "def method_missing(method_name, *args, &block)\n name = args.shift\n add_to_hash(name, options: [method_name] + args)\n\n new_parser = self.class.new\n add_to_hash(name, content: new_parser.instance_exec(&block)) if block\n add_to_hash(name, content: new_parser.hash)\n new_parser\n end", "title": "" }, { "docid": "641666cdc7444f6ecee9d606dea4660f", "score": "0.57427907", "text": "def new\n\t\t@block = Block.new\n\tend", "title": "" }, { "docid": "173e449a5361498817ffdb0a3dd1b9ed", "score": "0.5689784", "text": "def child(fields = {})\n ch = self.class.child_class.new(self, fields)\n\n if !block_given?\n ch\n else\n yield ch\n end\n end", "title": "" }, { "docid": "7fef465c68ce40a94b6eb1bb666776b8", "score": "0.5682292", "text": "def parse(node, *args, &block)\n new(*args) do |instance|\n processors.each do |name, processor|\n processor.call(instance, node)\n end\n \n if block_given?\n case block.arity\n when 1 then block.call(instance)\n else instance.instance_eval(&block)\n end\n end\n end\n end", "title": "" }, { "docid": "68511fe43b37fbe119daf0018737a26d", "score": "0.56652725", "text": "def call\n klass = Class.new(parent)\n\n klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def self.name\n #{name.inspect}\n end\n\n def self.inspect\n name\n end\n\n def self.to_str\n name\n end\n\n def self.to_s\n name\n end\n RUBY\n\n yield(klass) if block_given?\n\n klass\n end", "title": "" }, { "docid": "b776ecd0c3415afdb1deca43665901ab", "score": "0.5627137", "text": "def parser\n @parser ||= parser_klass.new(job_folder)\n end", "title": "" }, { "docid": "7e257c923cf9241c3662f5b1b8f284ba", "score": "0.5596377", "text": "def newmetaparam(name, options = {}, &block)\n # TODO: raise exception or support?\n nil\n end", "title": "" }, { "docid": "de4a61fc0eec1974438d9d605591d687", "score": "0.5568207", "text": "def subclass( & block )\n \n add_hook_context( :subclass )\n action( & block ) if block_given?\n \n return self\n\n end", "title": "" }, { "docid": "8d41b87d171348d6218d11267ff8afa0", "score": "0.5565862", "text": "def initialize(name, &block)\n @name = name\n @modules = []\n @writer_mode = :multiple\n @requesting_console = false\n @force_rebuild = false\n\n @options = {\n :include_paths => [],\n :library_paths => [],\n :libraries => [],\n :cxxflags => [],\n :ldflags => [],\n :include_source_files => [],\n :includes => []\n }\n\n @node = nil\n\n parse_command_line\n\n if requesting_console?\n block.call(self) if block\n start_console\n elsif block\n build_working_dir(&block)\n block.call(self)\n build\n write\n compile\n end\n end", "title": "" }, { "docid": "7c493d385818d1c21c7bcad796b190c9", "score": "0.55039644", "text": "def custom_class_allowed?(parser_name); end", "title": "" }, { "docid": "fa878c84e9a82a43a0f75d3f9eab2fd7", "score": "0.5494526", "text": "def initialize(&block)\n instance_eval(&block) if block_given?\n end", "title": "" }, { "docid": "e060b3d790e718011a38247798b793d2", "score": "0.549186", "text": "def create_class\n attributes = content['attributes']\n mod.const_set class_name, Class.new(parent_class) {\n attr_accessor(*attributes)\n # include Concerns::Extendable\n }\n end", "title": "" }, { "docid": "fc1af201460d58447d67dab5b269bae5", "score": "0.54792327", "text": "def parsed_model(&block)\n parsed_model_class.class_eval(&block)\n end", "title": "" }, { "docid": "9643449807e8751487a15bd318bebcac", "score": "0.54548925", "text": "def derive! &block\n Derived.new self, &block\n end", "title": "" }, { "docid": "0e60226615b2b70513f0619eadca5e5b", "score": "0.54472315", "text": "def parser\n @parser ||= Parser.new(self)\n end", "title": "" }, { "docid": "0e60226615b2b70513f0619eadca5e5b", "score": "0.54472315", "text": "def parser\n @parser ||= Parser.new(self)\n end", "title": "" }, { "docid": "cee5edf27e87fb7580252b0e2fea5440", "score": "0.54427356", "text": "def initialize(&block)\n instance_eval(&block) if block_given?\n end", "title": "" }, { "docid": "45602131285cd549c029c22e19770118", "score": "0.54343045", "text": "def construct( &block )\n self.instance_eval(&block)\n @options\n end", "title": "" }, { "docid": "2f17724c7a59205cf19efc028eb9a580", "score": "0.54030657", "text": "def class!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 17 )\n\n type = CLASS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 151:9: 'class'\n match( \"class\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 17 )\n\n end", "title": "" }, { "docid": "0a0375e63405ef13e92064c9a1f24278", "score": "0.540196", "text": "def pluggable_parser; end", "title": "" }, { "docid": "baf0030954ec4b32dfa9a248e073d1c1", "score": "0.5401113", "text": "def initialize parser\n @parser = parser\n end", "title": "" }, { "docid": "4b78a55832a5409bcdc26eac7d57de3f", "score": "0.54000425", "text": "def block_class() Block; end", "title": "" }, { "docid": "94bfaaa51fb15161438f3b36c5cb239b", "score": "0.5397486", "text": "def initialize(&block)\n instance_exec(&block) if block_given?\n end", "title": "" }, { "docid": "dee263abfa3a582f8a75b732c36429bf", "score": "0.5395498", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "dee263abfa3a582f8a75b732c36429bf", "score": "0.5395498", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "dee263abfa3a582f8a75b732c36429bf", "score": "0.5395498", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "dee263abfa3a582f8a75b732c36429bf", "score": "0.5395498", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "1e0cfc2873e5ff08c469c17183fb13e1", "score": "0.53894055", "text": "def method_missing(meth, *args, &block)\n if args.length == 0\n code = Block.new(meth.to_s , self )\n if block_given?\n add_block code\n code.instance_eval(&block)\n end\n return code\n else\n super\n end\n end", "title": "" }, { "docid": "f94007c161b0f7859a971c39a168b52d", "score": "0.53738934", "text": "def class!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 29 )\n\n type = CLASS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 331:9: 'class'\n match( \"class\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 29 )\n\n end", "title": "" }, { "docid": "48d59cd2f3a96dc211bab8300d6dcb35", "score": "0.53731894", "text": "def new_block_el(*args); end", "title": "" }, { "docid": "21e700193bb1c19bef3024bce47aec95", "score": "0.5373128", "text": "def class!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n type = CLASS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 358:8: 'class'\n match( \"class\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n end", "title": "" }, { "docid": "954518163d5b78249192a40f1839109f", "score": "0.53626484", "text": "def new_command_runner(*args, &block)\n SimpleCommander::Runner.instance_variable_set :\"@singleton\", SimpleCommander::Runner.new(args)\n program :name, 'test'\n program :version, '1.2.3'\n program :description, 'something'\n create_test_command\n yield if block\n SimpleCommander::Runner.instance\nend", "title": "" }, { "docid": "814005e997725eaa0c3ab14e3c251625", "score": "0.5338817", "text": "def initialize(*)\n super\n yield self if block_given?\n end", "title": "" }, { "docid": "aafd9e4737d106bf99e3fd613ccef081", "score": "0.53362244", "text": "def configure_parser; end", "title": "" }, { "docid": "1a34b5d8cd7b1b9dc874e77d4a911305", "score": "0.53334063", "text": "def initialize(parent, expr, type, name=nil)\n\t\tsuper()\n\t\t@type = type\n\t\t@vartab = { }\n\t\t@functab = { }\n\t\t@parentblock = parent\n\t\tif @type == Whileblock\n\t\t\t@expr = expr #holds either the condition, for 'while', or the parameter list, for 'func'\n\t\telsif @type == Funcblock\n\t\t\tif expr::id == 'name' #one argument\n\t\t\t\t@expr = expr\n\t\t\telse\n\t\t\t\t@expr = $i::stmt_eval expr\n\t\t\tend\n\t\tend\n\t\t@name = name #for a function\n\tend", "title": "" }, { "docid": "1214eb182103e1262fae76ff801c8ff8", "score": "0.5321237", "text": "def initialize (&block)\n instance_exec(&block)\n end", "title": "" }, { "docid": "44b916a9bede0d43ecdcdc148f9a99c0", "score": "0.5318911", "text": "def initialize(command_line)\n parse(command_line)\n end", "title": "" }, { "docid": "c575b5869f8d5788329c76cb88b542d2", "score": "0.5318641", "text": "def initialize(name,&ruby_block)\n # Checks and sets the name.\n @name = name.to_sym\n # Sets the block for instantiating a task.\n @ruby_block = ruby_block\n # Sets the instantiation procedure if named.\n return if @name.empty?\n obj = self\n HDLRuby::High.space_reg(@name) do |*args|\n obj.instantiate(*args)\n end\n end", "title": "" }, { "docid": "64628a05ba9c6c1fa2c1e5c611890b4a", "score": "0.53163123", "text": "def new(*args,&block)\n Base.new(*args,&block)\n end", "title": "" }, { "docid": "49b2e453f601dd8fbbf39f011f9b38de", "score": "0.5312274", "text": "def new(*args, &block)\n\t\tif $Auto_wrapper then\n\t\treturn $Auto_wrapper.wrap(auto_wrapper_old_new(*args, &block))\n\t\telse\n\t\treturn auto_wrapper_old_new(*args, &block)\n\t\tend\n\tend", "title": "" }, { "docid": "b38e7f2ab6da608a298664e6881bae72", "score": "0.53091526", "text": "def create_class_override(method_name, &block)\n internal_create_override method_name, :class, &block \n end", "title": "" }, { "docid": "849a3a4e5f17316ea046ab28fc0f66ff", "score": "0.5304799", "text": "def block_def_node\n if @ast == nil\n if block == nil\n return nil\n end\n\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::Builder.from_parser_ast(source))\n end\n\n # Ensure `return` is there\n @ast.accept(Translator::LastStatementReturnsVisitor.new)\n\n return @ast\n end", "title": "" }, { "docid": "6c466a3b09765552778fdf219d6fbd45", "score": "0.53000844", "text": "def parser\n dsl.parser\n end", "title": "" }, { "docid": "01bd123120c4ef420a146f9b8eac8094", "score": "0.52951425", "text": "def compile_to_ruby_source_as parser_class_name\r\n result = \"class #{parser_class_name} < Dhaka::CompiledParser\\n\\n\"\r\n result << \" self.grammar = #{grammar.name}\\n\\n\"\r\n result << \" start_with #{start_state.id}\\n\\n\"\r\n states.each do |state|\r\n result << \"#{state.compile_to_ruby_source}\\n\\n\"\r\n end\r\n result << \"end\"\r\n result\r\n end", "title": "" }, { "docid": "8daed15ce7c1c5bbc413a5996d58c083", "score": "0.52925", "text": "def create_class(name, parent: Object, &block)\n klass = Class.new(parent, &block)\n @managed.const_set(name, klass)\n klass\n end", "title": "" }, { "docid": "2205ef95b4484212b2c61f7ad3d88108", "score": "0.5285729", "text": "def class_def!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 90 )\n\n type = CLASS_DEF\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 211:13: 'class'\n match( \"class\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 90 )\n\n end", "title": "" }, { "docid": "76a56a98db55af0ae1cb14b08b507b5f", "score": "0.52845967", "text": "def singleton_class(&block)\n\t\tif block_given?\n\t\t(class << self; self; end).class_eval(&block)\n\t\tself\n\t\telse\n\t\t(class << self; self; end)\n\t\tend\n\tend", "title": "" }, { "docid": "3e31d97e2b65f48ec7dab61b3d5f130f", "score": "0.52841663", "text": "def initialize(name, depth = nil, overflow = nil, &ruby_block)\n @name = name.to_sym\n @body = ruby_block\n @depth = depth ? depth.to_i : nil\n @overflow = overflow ? overflow.to_proc : nil\n end", "title": "" }, { "docid": "a5bb85cc5544c50491b2a682aa057488", "score": "0.52793086", "text": "def parser\n @parser ||= Parser.new(self)\n end", "title": "" }, { "docid": "5236114167a68869e47bc4c91880b944", "score": "0.527038", "text": "def initialize(parent, full_name, priority, source_root, middleware_stack, middleware_lookup,\n tool_class = nil)\n @parent = parent\n @settings = Settings.new(parent: parent&.settings)\n @full_name = full_name.dup.freeze\n @priority = priority\n @source_root = source_root\n @built_middleware = middleware_stack.build(middleware_lookup)\n @subtool_middleware_stack = middleware_stack.dup\n\n @acceptors = {}\n @mixins = {}\n @templates = {}\n @completions = {}\n\n @precreated_class = tool_class\n\n reset_definition\n end", "title": "" }, { "docid": "1353bc5ea214a3b776e7aea507f8ecb1", "score": "0.52588016", "text": "def method_missing(name,*args,&block)\n self.class.send :define_method,\"parse_#{name}\" do |node,contents|\n block.call node,contents\n end\n end", "title": "" }, { "docid": "590b883479d8b9473db9228b7e638092", "score": "0.5257983", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "590b883479d8b9473db9228b7e638092", "score": "0.5257983", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "590b883479d8b9473db9228b7e638092", "score": "0.5257983", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "590b883479d8b9473db9228b7e638092", "score": "0.5257983", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "df858b3e83906b5c9ec72d21e260b049", "score": "0.52562463", "text": "def compile_parser(base, grammar_or_parser, opts={})\r\n compile(Class.new(base), grammar_or_parser, opts)\r\n end", "title": "" }, { "docid": "f15c71d34df67c26f8c817e9ac3c0d29", "score": "0.5238793", "text": "def build_parser( descriptor, file = nil )\n return RCC::Scanner::Interpreter::Parser.new( @parser_plan, open_source(descriptor, file) )\n end", "title": "" }, { "docid": "f15c71d34df67c26f8c817e9ac3c0d29", "score": "0.5238793", "text": "def build_parser( descriptor, file = nil )\n return RCC::Scanner::Interpreter::Parser.new( @parser_plan, open_source(descriptor, file) )\n end", "title": "" }, { "docid": "267b98399b5e8f62f0f53d39a2c47ac3", "score": "0.5237442", "text": "def get_parsable\n @block ||= Block.new\n end", "title": "" }, { "docid": "8334efbbac1cd4d06fb9d6f0846bd233", "score": "0.52355766", "text": "def create_parser(command_name)\n OptionParser.new do |parser|\n parser.banner = \"Usage: ./project.rb #{command_name} [options]\"\n parser\n end\nend", "title": "" }, { "docid": "1f1718482a9673175a8a8a87f41fcf36", "score": "0.5228128", "text": "def new_anon_class(parent, name=\"\", &proc)\n klass = Class.new(parent) \n mc = klass.instance_eval{ class << self ; self ; end }\n mc.send(:define_method, :to_s) {name}\n klass.class_eval(&proc) if proc\n klass\nend", "title": "" }, { "docid": "150508511333f89509800e0dca868a69", "score": "0.5224803", "text": "def parser\n Parser.new(self, :mode=>mode)\n end", "title": "" }, { "docid": "0cd78f84afdb01cf633c62619bf97b11", "score": "0.5214624", "text": "def build(&ruby_block)\n # Use local variable for accessing the attribute since they will\n # be hidden when opening the sytem.\n name = @name\n stages = @stages\n namespace = @namespace\n this = self\n mk_ev = @mk_ev\n mk_rst = @mk_rst\n scope = HDLRuby::High.cur_system.scope\n\n return_value = nil\n\n # Enters the current system\n HDLRuby::High.cur_system.open do\n sub do\n HDLRuby::High.space_push(namespace)\n # Execute the instantiation block\n return_value =HDLRuby::High.top_user.instance_exec(&ruby_block)\n HDLRuby::High.space_pop\n\n # Create the pipeline code.\n \n # Declare and register the pipeline registers generators.\n prs = []\n stages.each do |st|\n st.each do |rn|\n r = PipeSignal.new(name.to_s+\"::\"+rn.to_s,scope)\n prs << r\n namespace.add_method(rn) { r }\n end\n end\n\n # Build the pipeline structure.\n return_value = par(mk_ev.call) do\n hif(mk_rst.call == 0) do\n # No reset, pipeline handling.\n stages.each do |st|\n # Generate the code for the stage.\n HDLRuby::High.space_push(namespace)\n HDLRuby::High.top_user.instance_exec(&st.code)\n HDLRuby::High.space_pop\n end\n end\n helse do\n prs.each { |r| r <= 0 }\n end\n end\n end\n end\n\n return return_value\n end", "title": "" }, { "docid": "ff48bf08783ac3798e8a8544d9cea523", "score": "0.52103347", "text": "def child( &block )\n return unless child?\n raise ArgumentError, \"A block must be supplied\" if block.nil?\n\n if block.arity > 0\n block.call(self)\n else\n block.call\n end\n end", "title": "" }, { "docid": "6d6b384c2abdeed0819a30e7c3a8885b", "score": "0.5205037", "text": "def generate_parser( parser_plan, ast_class_lookup, output_directory )\n fill_template(\"tree_based_parser.rb\", STDOUT, parser_plan) do |macro_name, formatter|\n case macro_name\n when \"PRODUCTIONS\"\n generate_productions( parser_plan, ast_class_lookup, formatter )\n\n when \"STATES\"\n generate_states( parser_plan, formatter )\n \n when \"REDUCE_PROCESSING\"\n if ast_class_lookup.nil? then\n formatter.comment_block %[Build the production Node.]\n formatter << %[produced_node = Node.new( production.node_type )]\n \n formatter.comment_block %[If the user has defined a processor for this production, call it and save the result in the Node.]\n formatter << %[if method_defined?(production.production_processor_name) then]\n formatter << %[ produced_node.value = send( production.production_processor_name, *nodes )]\n formatter << %[elsif method_defined?(production.processor_name) then]\n formatter << %[ produced_node.value = send( production.processor_name, production.enslot_nodes(nodes) )]\n formatter << %[end]\n else\n formatter.comment_block %[Build the production Node.]\n formatter << %[ast_class = production.ast_class]\n formatter << %[ast_class = Local.const_get(production.ast_class.name) if defined? Local and Local.class == Module and Local.const_defined?(production.ast_class.name)]\n formatter << %[]\n formatter << %[produced_node = ast_class.new( production.enslot_nodes(nodes) )]\n\n formatter.comment_block %[If the user has defined a processor for this ASN, call it.]\n formatter << %[if method_defined?(production.processor_name) then]\n formatter << %[ send( production.processor_name, produced_node )]\n formatter << %[end]\n end\n \n else\n formatter << macro_name\n end\n end\n end", "title": "" }, { "docid": "b9c303b1765796d72a6f543a504366ea", "score": "0.5204443", "text": "def parse\n _build_document\n _close_open_block_commands\n @document\n end", "title": "" }, { "docid": "d88882d998a5cf538c49893e5b8a6033", "score": "0.520361", "text": "def initialize(*args)\n if self.class == BlockCommand\n raise TypeError, 'BlockCommand.new should not be called directly'\n end\n super\n end", "title": "" }, { "docid": "798501b3a4c046dd169732d9f22880cc", "score": "0.5202332", "text": "def new!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 31 )\n\n type = NEW\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 334:7: 'new'\n match( \"new\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 31 )\n\n end", "title": "" }, { "docid": "bae2ad71006fc4571d3c13be9f46a719", "score": "0.51997", "text": "def nested_class( name, parent, &block )\n unless const_defined?( name ) then\n klass = Class.new( parent )\n klass.class_eval( &block ) if block_given?\n const_set( name , klass )\n end\n return const_get( name )\n end", "title": "" }, { "docid": "ddc970e9a09bf5ce746384793583b641", "score": "0.51944435", "text": "def new!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 62 )\n\n type = NEW\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 183:7: 'new'\n match( \"new\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 62 )\n\n end", "title": "" }, { "docid": "36e151803cbef6e609893d8236b855b1", "score": "0.51902485", "text": "def initialize(&block)\n configure(&block) if block_given?\n end", "title": "" }, { "docid": "f56e1e124318bc3b5a0971b1947fec88", "score": "0.5189933", "text": "def newcommand(options, &block)\n raise \"No name given in command\" unless options.include?(:name)\n\n command = options[:name]\n\n SLAF::Commands.module_eval {\n define_method(\"#{command}_command\", &block)\n }\n\n SLAF::command_options || SLAF.command_options = {}\n\n if options.include?(:allow_arguments)\n SLAF::command_options[command] = options[:allow_arguments]\n else\n SLAF::command_options[command] = false\n end\nend", "title": "" }, { "docid": "41d9b6640e7070eae6486eca7dddcbdf", "score": "0.51882327", "text": "def initialize name = :rdoc # :yield: self\n defaults\n\n check_names name\n\n @name = name\n\n yield self if block_given?\n\n define\n end", "title": "" }, { "docid": "374b6624dc1fc3712708d503205ddc9f", "score": "0.5183389", "text": "def make_parser\n @oparse ||= OptionParser.new \n @oparse.banner = \"Usage: #{File.basename $0} [options]\"\n\n @oparse.on(\"-h\", \"--help\", \"Show this message\") do\n bail(@oparse)\n end\n\n @oparse.on(\"-v\", \"--version\", \"Show version and exit\") do\n @stdout.puts(\"Ruby BlackBag version #{Rbkb::VERSION}\")\n self.exit(0)\n end\n\n return @oparse\n end", "title": "" }, { "docid": "23ab9d31120d7446534f687d326f6b43", "score": "0.51753414", "text": "def build(*arguments, &block)\n build_class(*arguments, &block).new(*arguments, &block)\n end", "title": "" }, { "docid": "8c935a14ff9c69c59360e1be3177b982", "score": "0.51717454", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "8c935a14ff9c69c59360e1be3177b982", "score": "0.51717454", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "8b3160036910fa2354b15b9c9124f477", "score": "0.51715785", "text": "def initialize(param={})\n @argv ||= param.delete(:argv) || ARGV\n @stdout ||= param.delete(:stdout) || STDOUT\n @stderr ||= param.delete(:stderr) || STDERR\n @stdin ||= param.delete(:stdin) || STDIN\n @opts ||= param.delete(:opts) || {}\n @parser_got_range=nil\n yield self if block_given?\n make_parser()\n end", "title": "" }, { "docid": "f273322fcd97db9f7427899271a622dc", "score": "0.5143246", "text": "def initialize(&block)\n @rules = []\n DSL.new(self).execute(&block) unless block.nil?\n end", "title": "" }, { "docid": "c65c64cdf90fc8d8c874de45923c6069", "score": "0.51431966", "text": "def process\n classname = statement[0].source\n superclass = parse_superclass(statement[1])\n # did we get a superclass worth parsing?\n if superclass\n # get the class\n klass = create_class(classname, superclass)\n # get the members\n members = extract_parameters(statement[1])\n # create all the members\n create_attributes(klass, members)\n end\n end", "title": "" }, { "docid": "306183dfb8e56af1f5ce30a86f80d761", "score": "0.51377875", "text": "def initialize(description, &block)\n @description = description && \"\"\n\n # initialize this instance\n self.instance_eval &block\n end", "title": "" }, { "docid": "a4a2e91d1c7112666e48c24628dc2c40", "score": "0.51339906", "text": "def initialize\n yield( self ) if block_given? # allow setup with code block\n end", "title": "" }, { "docid": "e77dba4424082da22f54548d62bb8df4", "score": "0.5129021", "text": "def initialize\n @option_parser = OptionParser.new do |opt|\n opt.banner = banner\n opt.summary_indent = Shebang::Config[:indent]\n\n # Process each help topic\n help_topics.each do |title, text|\n opt.separator \"#{Shebang::Config[:heading]}#{\n Shebang::Config[:indent]}#{text}\" % title\n end\n\n opt.separator \"#{Shebang::Config[:heading]}\" % 'Options'\n\n # Add all the options\n options.each do |option|\n opt.on(*option.option_parser) do |value|\n option.value = value\n\n # Run a method?\n if !option.options[:method].nil? \\\n and respond_to?(option.options[:method])\n # Pass the value to the method?\n if self.class.instance_method(option.options[:method]).arity != 0\n send(option.options[:method], value)\n else\n send(option.options[:method])\n end\n end\n end\n end\n end\n end", "title": "" }, { "docid": "a7f7b9bee1567baa6de37030f5801114", "score": "0.5122038", "text": "def update(&block)\n self.class.new(rules, commands, &block)\n end", "title": "" }, { "docid": "a21108ef88f039e56db97dea546564f5", "score": "0.5120501", "text": "def di(name, &block)\n rc = ::Dizzy::DSL::RuleContext.new\n rc.instance_exec(&block)\n\n di_define_method(name, rc.init_proc, rc.wire_proc)\n end", "title": "" }, { "docid": "9613907be06f6e603d477552357cf58f", "score": "0.5116858", "text": "def initialize(&block)\n @required_options = []\n instance_exec &block\n end", "title": "" }, { "docid": "ae0d44c5f0543bded75a6c81db7ddf64", "score": "0.5114107", "text": "def parser\n @parser ||= Sawtooth::Parser.new(:rules => self.rules)\n end", "title": "" }, { "docid": "8b847da266abbaf12f5dc245121997f8", "score": "0.51087946", "text": "def parsing(parser)\n yield\n resolve parser\n self\n end", "title": "" }, { "docid": "b267b450864114674ae89b2c9c321140", "score": "0.5104599", "text": "def context(name=nil, parent=self, &block)\n c = Class.new(parent)\n c.send(:include, Kintama::Context)\n c.name = name.to_s if name\n c.definition = find_definition(&block)\n c.class_eval(&block) if block\n c\n end", "title": "" }, { "docid": "306c71d9935d48b61cd27c1a2c1260a2", "score": "0.5104044", "text": "def create_block(g, mod)\n pos(g)\n\n state = g.state\n state.scope.nest_scope self\n\n args = make_arguments(mod)\n\n blk = new_generator g, @name, args\n\n blk.push_state self\n\n blk.state.push_super state.super\n blk.state.push_eval state.eval\n\n blk.definition_line(@line)\n\n blk.state.push_name blk.name\n\n pos(blk)\n\n blk.state.push_block\n blk.push_modifiers\n blk.break = nil\n blk.next = nil\n blk.redo = blk.new_label\n blk.redo.set!\n\n # order matters quite a lot here\n args.bytecode(blk)\n\n recv = receiver_pattern(mod)\n if recv.binds?\n blk.push_self\n recv.deconstruct(blk, mod)\n end\n\n args.deconstruct_patterns(blk, mod)\n\n mod.compile(blk, @body)\n\n blk.pop_modifiers\n blk.state.pop_block\n\n blk.ret\n blk.close\n blk.pop_state\n\n blk.splat_index = args.splat_index\n blk.local_count = local_count\n blk.local_names = local_names\n\n g.create_block blk\n end", "title": "" } ]
230933533142c3edd8f28bd8578d3b6f
region The "signature_file" accessors
[ { "docid": "9a343595a5404fd433cdf84a7a2aa3ce", "score": "0.6735983", "text": "def signature_file=(content_raw)\n _set_signature_file(content_raw)\n end", "title": "" } ]
[ { "docid": "58154047e23cbe686dd1fea45c7a1a9b", "score": "0.76589847", "text": "def stored_signature; end", "title": "" }, { "docid": "781335ee1597596882e69216c4215bf5", "score": "0.72519076", "text": "def signature_key; end", "title": "" }, { "docid": "75397bcf1d312042e4de15118af1d8e0", "score": "0.7058535", "text": "def header_signature; end", "title": "" }, { "docid": "a42c60df409490576e1948e4924a4ac1", "score": "0.7021341", "text": "def signature\n @signature ||= set_signature(nil)\n end", "title": "" }, { "docid": "29e5e13b5ca4c88728dee0654d6b29ad", "score": "0.6821089", "text": "def signature_valid?; end", "title": "" }, { "docid": "8db6bd065c812d36029e843c7edd89d4", "score": "0.6665067", "text": "def signature\n @signature || ''\n end", "title": "" }, { "docid": "58d3bf7924f3081ca811ff32e5458cd9", "score": "0.66548634", "text": "def internal_file_attributes; end", "title": "" }, { "docid": "d3a1f543bef1334a5b90361770539b67", "score": "0.6618575", "text": "def signatures_at(filename, line, column); end", "title": "" }, { "docid": "12f59e14399a6cf3d9a9b2843315f1d9", "score": "0.6559847", "text": "def header_signature=(_arg0); end", "title": "" }, { "docid": "c816090e20b6c4226b7a95e8aa39b5e3", "score": "0.65394855", "text": "def signature\n memoized_info[:signature]\n end", "title": "" }, { "docid": "eb44ef06254ffd7829f30f2a32a0b4fb", "score": "0.651829", "text": "def signature_fields\n parsed {\n @signature_fields\n }\n end", "title": "" }, { "docid": "f11e8a63d066924ef9e8b1dab06a334a", "score": "0.65131146", "text": "def signature_key=(_arg0); end", "title": "" }, { "docid": "da1db1463d8d833780370888e4afcd12", "score": "0.6493934", "text": "def update_signature!; end", "title": "" }, { "docid": "da1db1463d8d833780370888e4afcd12", "score": "0.6493934", "text": "def update_signature!; end", "title": "" }, { "docid": "7c329e123cd0321c6944c0e884ffca51", "score": "0.64908814", "text": "def s3_upload_signature\n\t signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), YOUR_SECRET_KEY, s3_upload_policy_document)).gsub(\"\\n\",\"\")\n\t end", "title": "" }, { "docid": "61fe33065e40b37a9a958c7181a0fcc0", "score": "0.64527214", "text": "def upload_signature\n @upload_signature ||=\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::SHA1.new,\n options[:secret_access_key],\n self.policy_document\n )\n ).gsub(/\\n/, '')\n end", "title": "" }, { "docid": "335e3385c364dce4a64e0e1d8845f7a8", "score": "0.6410363", "text": "def signature\n @signature ||= Base64.encode64(digest).gsub(\"\\n\", '')\n end", "title": "" }, { "docid": "b2f5428d6ea8ec432c7c6868e7fd883a", "score": "0.6394757", "text": "def text_representation\n self.signed_request[:signature].to_s\n end", "title": "" }, { "docid": "b2f5428d6ea8ec432c7c6868e7fd883a", "score": "0.6394757", "text": "def text_representation\n self.signed_request[:signature].to_s\n end", "title": "" }, { "docid": "726537ac1ffc5aa41822d01124a75280", "score": "0.6370727", "text": "def signatures\n attributes.fetch(:signatures)\n end", "title": "" }, { "docid": "f4db774153cf30ba033fa694b8b36e94", "score": "0.636303", "text": "def set_signature\n @signature = Signature.find(params[:id])\n end", "title": "" }, { "docid": "3e4a30b83612812b9fa6b748d5a5ca2b", "score": "0.6353133", "text": "def signature=(v)\n @signature = v\n end", "title": "" }, { "docid": "2941056aa85c7c81616ae0d4f62e6231", "score": "0.6350515", "text": "def previous_signature?; end", "title": "" }, { "docid": "e78556c0520e92fc05cb29e9316e68ad", "score": "0.633704", "text": "def get_signature(signature_id)\n request :get, \"/v3/signatures/#{signature_id}.json\"\n end", "title": "" }, { "docid": "98b3b5a2d828ea35a4db342a5759b55f", "score": "0.6301711", "text": "def file\n @file\n end", "title": "" }, { "docid": "7926671ba01877177ba2d2b843e3cac9", "score": "0.6286362", "text": "def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), Figaro.env.aws_secret_access_key, s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end", "title": "" }, { "docid": "1855270ffde3fd794a94927b70c799ed", "score": "0.627799", "text": "def signature_1 \n @signature1 ||= read_certificate(\"certificate1\")\n end", "title": "" }, { "docid": "018715d1738cf9483c52d421c35cd051", "score": "0.62745106", "text": "def metadata_file; end", "title": "" }, { "docid": "018715d1738cf9483c52d421c35cd051", "score": "0.62745106", "text": "def metadata_file; end", "title": "" }, { "docid": "259a109dac4558923f8834e35b5a673d", "score": "0.6256416", "text": "def signature\n registration_data_raw.byteslice(\n (KEY_HANDLE_OFFSET + key_handle_length + certificate_length)..-1\n )\n end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6253854", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6253854", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6253854", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6253854", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6253854", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6253854", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6253854", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6253854", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6253854", "text": "def signature; end", "title": "" }, { "docid": "fa3be901933a4df227e1dd1bab04c649", "score": "0.6253854", "text": "def signature; end", "title": "" }, { "docid": "ce60d602d5f3b4916718b4bbe25067b0", "score": "0.62526643", "text": "def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), CONFIG['secret_access_key'], s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end", "title": "" }, { "docid": "62a5bbc372c6d99e04a0491f7f3d22c1", "score": "0.6231597", "text": "def signer\n end", "title": "" }, { "docid": "5fb419f37dc996f313c504c40d14f50e", "score": "0.6228293", "text": "def file_hash\n return @file_hash\n end", "title": "" }, { "docid": "b6a11223c903563074a2d1e42a6de482", "score": "0.6227053", "text": "def set_signature\n @signature = Signature.find(params[:id])\n end", "title": "" }, { "docid": "b6a11223c903563074a2d1e42a6de482", "score": "0.6227053", "text": "def set_signature\n @signature = Signature.find(params[:id])\n end", "title": "" }, { "docid": "93c6b39e86ae06b11c67806e11e09429", "score": "0.6198097", "text": "def file_attributes\n {}\n end", "title": "" }, { "docid": "93c6b39e86ae06b11c67806e11e09429", "score": "0.6198097", "text": "def file_attributes\n {}\n end", "title": "" }, { "docid": "5e08ba940e783ce1cbbb1a5888ce3913", "score": "0.61876017", "text": "def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), SITE['s3_access_key'], s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end", "title": "" }, { "docid": "7f76bc242cc83cbe8077f20b50dad21d", "score": "0.6169195", "text": "def signature\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest.new('sha1'),\n ENV['S3_SECRET_ACCESS_KEY'],\n policy_document\n )\n ).gsub(/\\n/, '')\n end", "title": "" }, { "docid": "1296eead8ccab93d31cc49c961ea7187", "score": "0.61371684", "text": "def fetch_signature(params)\n sig = params.fetch(\"sig\", nil) || params.fetch(\"s\", nil)\n sig && sig.first\n end", "title": "" }, { "docid": "1296eead8ccab93d31cc49c961ea7187", "score": "0.61371684", "text": "def fetch_signature(params)\n sig = params.fetch(\"sig\", nil) || params.fetch(\"s\", nil)\n sig && sig.first\n end", "title": "" }, { "docid": "32a845618acbe01a6be2af207e979294", "score": "0.6131212", "text": "def signing_key; end", "title": "" }, { "docid": "c34b106a3b2db2d201fcf584df460f1c", "score": "0.61215115", "text": "def file_path; end", "title": "" }, { "docid": "b9abd50c3965cb2ad56de953e6175592", "score": "0.611931", "text": "def signatures\n parsed {\n @signatures \n }\n end", "title": "" }, { "docid": "f9f51dae6b5c3de222c1509ef0695bf9", "score": "0.61073947", "text": "def file\n @file\n end", "title": "" }, { "docid": "f9f51dae6b5c3de222c1509ef0695bf9", "score": "0.61073947", "text": "def file\n @file\n end", "title": "" }, { "docid": "f9f51dae6b5c3de222c1509ef0695bf9", "score": "0.61073947", "text": "def file\n @file\n end", "title": "" }, { "docid": "f9f51dae6b5c3de222c1509ef0695bf9", "score": "0.61073947", "text": "def file\n @file\n end", "title": "" }, { "docid": "5f3af3e2ac926bced98770099ddbf85a", "score": "0.61062425", "text": "def signature_changed?; end", "title": "" }, { "docid": "5f3af3e2ac926bced98770099ddbf85a", "score": "0.61062425", "text": "def signature_changed?; end", "title": "" }, { "docid": "e5cc065fd8e84c7a79a71bf2e19c948a", "score": "0.6089964", "text": "def active_signature\n attributes.fetch(:activeSignature)\n end", "title": "" }, { "docid": "305e2cc5b4fff81a3e0fed99ec78c010", "score": "0.60875344", "text": "def check_for_signature\n if signature_file_name_changed?\n sign if signature.present?\n end\n true\n end", "title": "" }, { "docid": "ad158dae6260fbff60c141e754a55948", "score": "0.60807484", "text": "def signing_input; end", "title": "" }, { "docid": "ad158dae6260fbff60c141e754a55948", "score": "0.60807484", "text": "def signing_input; end", "title": "" }, { "docid": "e4c066cb4f907a4978e4bb8512f1ff1f", "score": "0.60579956", "text": "def s3_upload_signature\n Base64.encode64(OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n @current_shard.amazon_setting.secret_access_key,\n s3_upload_policy_document)\n ).gsub(/\\n|\\r/, \"\")\n end", "title": "" }, { "docid": "e32bee471b278ef6e105f026a7904e7a", "score": "0.60468143", "text": "def file\n @file\n end", "title": "" }, { "docid": "d8672841bfa5ba3764884ec214bdf22a", "score": "0.60452473", "text": "def file_path\n end", "title": "" }, { "docid": "f0da35e6376afabc51854fa11985c57a", "score": "0.60435313", "text": "def external_file_attributes; end", "title": "" }, { "docid": "e3a52a810da249c530f0ca44ddeea252", "score": "0.60348", "text": "def pdf_to_sign\n _get_pdf_to_sign\n end", "title": "" }, { "docid": "ce18315391cef135ab0f3c4ee49b541d", "score": "0.60343015", "text": "def verify_signature(result); end", "title": "" }, { "docid": "7595dcd3c4c5e97025786586bc0b3888", "score": "0.60244787", "text": "def file_field; end", "title": "" }, { "docid": "319eecfbee69c1e96ef3d49517b59165", "score": "0.602346", "text": "def process_signing\n if sign_file?\n @appearance = @stamper.getSignatureAppearance().to_java(Java::ComLowagieTextPdf::PdfSignatureAppearance)\n @appearance.setCrypto(@private_key, @cert_chain, nil, Java::ComLowagieTextPdf::PdfSignatureAppearance::WINCER_SIGNED)\n end\n end", "title": "" }, { "docid": "64161b2a44f67905470b91ccca0e84d8", "score": "0.60194325", "text": "def ssh_signature_type; end", "title": "" }, { "docid": "64161b2a44f67905470b91ccca0e84d8", "score": "0.60194325", "text": "def ssh_signature_type; end", "title": "" }, { "docid": "64161b2a44f67905470b91ccca0e84d8", "score": "0.60194325", "text": "def ssh_signature_type; end", "title": "" }, { "docid": "c32ac8774757ba9460d134804604a6b5", "score": "0.59985447", "text": "def verify_signatures?; end", "title": "" }, { "docid": "70e4fb4d86aeac662f817c6bb6f4abc1", "score": "0.5990774", "text": "def pp_signature headers\n headers['Autorizacion']\n end", "title": "" }, { "docid": "774feccfb62442e1c07c8c8df8816d6a", "score": "0.59538573", "text": "def build_signature_buffer(result); end", "title": "" }, { "docid": "774feccfb62442e1c07c8c8df8816d6a", "score": "0.59538573", "text": "def build_signature_buffer(result); end", "title": "" }, { "docid": "217a38e89c3c07be517f4bbf8b48e527", "score": "0.5948195", "text": "def signature\n Base64.encode64(digest_with_key(string_to_sign)).strip\n end", "title": "" }, { "docid": "d3c8b3a2e3e1385a31f5ba3eebbcbfe2", "score": "0.592738", "text": "def signature\n EPDQ::ShaCalculator.new(full_parameters, EPDQ.sha_in, EPDQ.sha_type).signature\n end", "title": "" }, { "docid": "49df955802ac5c28d6da1ba8c25e9d8d", "score": "0.5926596", "text": "def file; end", "title": "" }, { "docid": "49df955802ac5c28d6da1ba8c25e9d8d", "score": "0.5926596", "text": "def file; end", "title": "" }, { "docid": "49df955802ac5c28d6da1ba8c25e9d8d", "score": "0.5926596", "text": "def file; end", "title": "" }, { "docid": "49df955802ac5c28d6da1ba8c25e9d8d", "score": "0.5926596", "text": "def file; end", "title": "" }, { "docid": "49df955802ac5c28d6da1ba8c25e9d8d", "score": "0.5926596", "text": "def file; end", "title": "" }, { "docid": "49df955802ac5c28d6da1ba8c25e9d8d", "score": "0.5926596", "text": "def file; end", "title": "" }, { "docid": "49df955802ac5c28d6da1ba8c25e9d8d", "score": "0.5926596", "text": "def file; end", "title": "" }, { "docid": "49df955802ac5c28d6da1ba8c25e9d8d", "score": "0.5926596", "text": "def file; end", "title": "" }, { "docid": "49df955802ac5c28d6da1ba8c25e9d8d", "score": "0.5926596", "text": "def file; end", "title": "" }, { "docid": "49df955802ac5c28d6da1ba8c25e9d8d", "score": "0.5926596", "text": "def file; end", "title": "" }, { "docid": "49df955802ac5c28d6da1ba8c25e9d8d", "score": "0.5926596", "text": "def file; end", "title": "" }, { "docid": "5d13d870ef430f75ea630fe3d37445d3", "score": "0.5915301", "text": "def file_details\n return @file_details\n end", "title": "" }, { "docid": "213a6a4617a37ddc94eb51ba3b12c012", "score": "0.59151", "text": "def signature_params\n params.require(:signature).permit(:sign)\n end", "title": "" }, { "docid": "c93a8b2922a6bd008b35d8abf79ee168", "score": "0.59136724", "text": "def gem_signature(gem_full_name); end", "title": "" }, { "docid": "7e56f9d383d6deae61a464fadaebf250", "score": "0.5908648", "text": "def sign_key; end", "title": "" }, { "docid": "288fbe1526e96263ccd5044c09b5b67e", "score": "0.5902866", "text": "def check_signature\n signature == \"ElfFile\\x00\"\n end", "title": "" }, { "docid": "8579ad906fea87b93eb99f810bcc53cd", "score": "0.5893665", "text": "def s3_upload_signature\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n ENV[\"AWS_SECRET_ACCESS_KEY\"],\n s3_upload_policy_document\n )\n ).gsub(/\\n/, '')\n end", "title": "" }, { "docid": "ba35c21c816364db8e029cf45dedc00b", "score": "0.58871317", "text": "def file_sha256\n Digest::SHA256.file(self).hexdigest\n end", "title": "" }, { "docid": "6132a492b7792e1e3a1b2822622265f5", "score": "0.5880317", "text": "def verify(file)\n # Read YAML file and comment\n data = YAML.load(File.open(file + SIGEXT))\n raise KeyfileError, \"Invalid file #{file + SIGEXT} content\" unless data && data.is_a?(Hash)\n\n puts \"Signature in file: #{file + SIGEXT}\" if @options[:verbose]\n clearsg = !File.file?(file)\n\n # Hash data\n start = Time.now\n sha = if clearsg\n raise VerificationError, \"File #{file} does not exist, no signed data\" if data[:data].nil?\n Digest::SHA512.new\n else\n puts \"⚠ Warning: clear sign data found but ignored\" if data.has_key?(:data)\n Digest::SHA512.file(file)\n end\n sha << \"\\0x00\" + data[:comment] unless data[:comment].nil?\n sha << \"\\0x00\" + data[:datetime].to_s\n sha << \"\\0x00\" + data[:data] if clearsg\n\n # Control data\n ctn = Enc.decode(data[:signature])\n pub = Ed25519::VerifyKey.new Enc.decode_key(data[:verifykey])\n puts \"Signed with key: #{abbrev_key(data[:verifykey])}\" if @options[:verbose]\n t = get_trusted_keys.include?(data[:verifykey]) ? \"with trusted key\" :\n \"but the verify key is ✖ not trusted\\n (#{data[:verifykey]})\"\n pub.verify(ctn, sha.digest) || raise(VerificationError, \"BAD signature\")\n if clearsg\n $stderr.puts \"✔ Good signature #{t}\\n signed on #{Time.at(data[:datetime])}\"\n $stdout.print data[:data]\n $stderr.puts \"Comment: #{data[:comment]}\\n\" unless data[:comment].nil?\n else\n puts \"✔ Good signature #{t}\\n signed on #{Time.at(data[:datetime])}\"\n puts \"(⏲ #{'%.2f' % ((Time.now - start) * 1000)} ms)\" if @options[:verbose]\n puts \"Comment: #{data[:comment]}\\n\" unless data[:comment].nil?\n end\nend", "title": "" } ]
9b5888143523f867fb053a546aa6819e
Take the users response and save it to the assignment Hope that it doesnt fail . . .
[ { "docid": "bde2a9b01826de605e1ae84ced558861", "score": "0.6033012", "text": "def grade\n @assignment = Assignment.find(params[:id])\n @user = @assignment.user\n @assignment.update_attributes(:response => params[:response])\n @assignment.save\n @assignment.grade\n if @assignment.save\n flash[:notice] = \"Your response has been saved\"\n redirect_to(:action => 'feedback', :id => @assignment.id , :user_id => @user.id)\n else\n puts @assignment.save\n puts \"could not save\"\n render(user_assignment_path(@user, @assignment) , :html => {:method => :get})\n end\n end", "title": "" } ]
[ { "docid": "ccddfdb51df57bc47e924ac4502ed214", "score": "0.61829054", "text": "def store(response); end", "title": "" }, { "docid": "ccddfdb51df57bc47e924ac4502ed214", "score": "0.61829054", "text": "def store(response); end", "title": "" }, { "docid": "8900b81c7cff6320b99ae441c93a59e0", "score": "0.61524737", "text": "def save\n Rails.logger.debug \"Call to users.save\"\n if self.valid? #Validate if the User object is valid\n @password_hash = Password.create(@password)\n Rails.logger.debug \"The user is valid!, hashed password: \" + @password_hash\n #Create a raw user object\n user_req = { 'givenName'=> self.first_name,\n 'familyName'=> self.last_name,\n 'gender'=> self.gender,\n 'nationality' => self.nationality,\n 'yearOfBirth' => self.yob,\n 'password' => self.password,\n 'contactNumber' => self.contact_number,\n 'accountVerified' => self.account_verified ==1 ? true : false,\n 'trackingOff' => self.tracking_off == 1 ? true : false,\n 'optOutDataCollection' => self.opt_out_data_collection = 1 ? true : false,\n 'institutionId' => self.institution_id,\n 'email' => self.email,\n 'photos' => []\n }\n reqUrl = \"/api/signUp\" #Set the request url\n rest_response = MwHttpRequest.http_post_request_unauth(reqUrl,user_req) #Make the POST call to the server with the required parameters\n #rest_response = MwHttpRequest.http_post_request(reqUrl,user_req,'[email protected]','test123')\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" || rest_response.code == \"201\" || rest_response.code == \"202\" #Validate if the response from the server is satisfactory\n user_resp = User.rest_to_user(rest_response.body) #Turn the response object to a Poll object\n return true, user_resp #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n else\n Rails.logger.debug self.errors.full_messages\n return false, self.errors.full_messages #Return invalid object error\n end\n end", "title": "" }, { "docid": "8aa3b366b9a577f5b82425745766b125", "score": "0.61453974", "text": "def assign!(user)\n assign(user)\n save!\n end", "title": "" }, { "docid": "f5739f045967b246038d98648be2a7d5", "score": "0.60512143", "text": "def set_user_response\n @user_response = UserResponse.find(params[:id])\n end", "title": "" }, { "docid": "f5739f045967b246038d98648be2a7d5", "score": "0.60512143", "text": "def set_user_response\n @user_response = UserResponse.find(params[:id])\n end", "title": "" }, { "docid": "33c8688b7fe0f3c73402094779577645", "score": "0.6042705", "text": "def update\n @response = Response.find(params[:id])\n submitter_id = current_user.submitting_id(@response.evaluation.submission)\n\n if ((!current_user.instructor?(@course)) && (current_user.id != @response.evaluation.user_id) && (submitter_id != @response.evaluation.submission.user_id))\n raise CanCan::AccessDenied.new(\"Not authorized!\")\n end\n\n @URL = course_assignment_path(@course, @assignment)\n\n if (current_user.instructor?(@course))\n @URL = course_assignment_submission_path(@course, @assignment, @response.evaluation.submission) + '?instructor=true'\n elsif (submitter_id == @response.evaluation.submission.user_id) and params[:response]\n @response.student_response = params[:response][:student_response]\n end\n\n respond_to do |format|\n if @response.update_attributes(params[:response])\n format.html { redirect_to @URL, notice: \"#{@response.errors.full_messages.join(' ')}\"}\n format.json { render json: @response}\n else\n format.html { redirect_to @URL, notice: \"#{@response.errors.full_messages.join(' ')}\"}\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63069152f93b61e623cc1780f6795be8", "score": "0.6034886", "text": "def user_assign\n\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in user assign method\"\n begin\n @supplier=\"supplier assign\"\n supplier=RestClient.get $api_service+'/suppliers'\n @suppliers=JSON.parse supplier\n user=RestClient.get $api_service+'/users/'+params[:format]\n @user=JSON.parse user\n if @user[\"supplier_id\"].present?\n @supplier_id=@user[\"supplier_id\"].split(\",\")\n else\n @supplier_id=@user[\"supplier_id\"].to_a\n end\n rescue => e\n Rails.logger.custom_log.error { \"#{e} user_controller user_assign method\" }\n end\n add_breadcrumb \"Users\", :users_path \n add_breadcrumb \"User Assign\" \n end", "title": "" }, { "docid": "646a4c92a7970a31ad745da484d250a9", "score": "0.60168666", "text": "def update\n puts \"params \" + params[:id]\n @assignment = Assignment.find(params[:id])\n @user = @assignment.user\n @assignment.update_attributes(:response => params[:assignment][:response])\n @assignment.grade\n if @assignment.save\n flash[:notice] = \"Your response has been saved\"\n redirect_to(:action => 'show', :id => @assignment.id , :user_id => @user.id)\n else\n puts @assignment.save\n puts \"could not save\"\n render(user_assignment_path(@user, @assignment) , :html => {:method => :get})\n end\n end", "title": "" }, { "docid": "cb71041f79308ff056c2dfe88a7ed98b", "score": "0.59795237", "text": "def respond \n saved = false\n resp = params[:resp]\n auth_token = params[:auth_token]\n rsvp = Rsvp.find(params[:id])\n\n if auth_token == rsvp.auth_token\n rsvp.resp = resp \n if rsvp.save \n saved = true\n end\n end\n \n if saved \n notc = \"Your response was successfully saved\"\n else\n notc = \"There was a problem updating your response from the link. Please try logging in to respond\"\n end\n \n respond_to do |format|\n format.html { redirect_to('/games/' + rsvp.game_id.to_s, :notice => notc) }\n end\n \n end", "title": "" }, { "docid": "b802cf3ba70e2a499137b8302e89186c", "score": "0.5870675", "text": "def user_response\n @respond = params[:client_reply]\n req_id = Response.find_by(:id => Response.where(:id => params[:id]).ids).request_id\n review_req=Request.find_by(:id => req_id).review_user_id\n review_user1=ReviewUser.where(:id=>review_req)\n response=Response.find_by(:id => Response.where(:id => params[:id]).ids)\n @feedback = response.feedback\n @date = response.created_at.strftime(\"%d %B %Y\")\n field_name=review_user1.pluck(:name).join(\" \")\n field_email=review_user1.pluck(:email).join(\" \")\n field_phone=review_user1.pluck(:phone_no).join(\" \")\n if ((field_name != nil) && (field_name.match(/\\A[^@\\s]+@[^@\\s]+\\z/)!=nil))\n email_user = field_name\n elsif field_name.match(/^(\\+\\d{1,3}[-]?)?\\d{10}$/ )!=nil\n phone_user = review_user1.pluck(:country_code).join(\"\").concat(field_name)\n end \n if ((field_email != nil) && (field_email.match(/\\A[^@\\s]+@[^@\\s]+\\z/)!=nil))\n email_user = field_email\n elsif field_email.match(/^(\\+\\d{1,3}[-]?)?\\d{10}$/ )!=nil\n phone_user = review_user1.pluck(:country_code).join(\"\").concat(field_email)\n end\n if ((field_phone != nil) && (field_email.match(/\\A[^@\\s]+@[^@\\s]+\\z/)!=nil))\n email_user = field_phone\n elsif field_phone.match(/^(\\+\\d{1,3}[-]?)?\\d{10}$/ )!=nil\n phone_user = review_user1.pluck(:country_code).join(\"\").concat(field_phone)\n end\n if email_user != nil\n @respond = params[:client_reply]\n email = email_user\n data = JSON.parse({\n \"personalizations\": [\n {\n \"to\": [\n {\n \"email\": \"#{email}\"\n }\n ],\n \"subject\": \"Response to your review\"\n }\n ],\n \"from\": {\n \"email\": \"[email protected]\"\n },\n \"content\": [\n {\n \"type\": \"text/plain\",\n \"value\": \"Dear Reviewer,\n Your Review Dated:#{@date} has been responded\n Text of your review: #{@feedback} \n Respond is: #{@respond}\"\n }\n ]\n }.to_json)\n sg = SendGrid::API.new(api_key: \"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\",host: 'https://api.sendgrid.com')\n response = sg.client.mail._(\"send\").post(request_body: data)\n user_id = current_user.id\n ClientResponse.create(:client_reply => params[:client_reply], :response_id => params[:id], :user_id => user_id)\n flash[:notice] = 'Successfully Sent Respond'\n end\n if phone_user != nil\n begin\n phone_no=phone_user\n client = Twilio::REST::Client.new ENV[\"TWILIO_ACC_SID\"], ENV[\"TWILIO_AUTH_TOKEN\"]\n response = client.messages.create(\n from: ENV[\"TWILIO_NO\"],\n to: phone_no,\n body: \"Dear Reviewer,\n Your Review Dated:#{@date} has been responded\n Text of your review: #{@feedback} \n Respond is: #{@respond}\" \n ) \n user_id = current_user.id\n\n ClientResponse.create(:client_reply => params[:client_reply], :response_id => params[:id], :user_id => user_id)\n flash[:notice] = 'Successfully Sent Respond'\n rescue Twilio::REST::RequestError => e\n end\n end\n redirect_to home_index_path\n end", "title": "" }, { "docid": "1463d6a540dfe34e9d2dab9efc9f532b", "score": "0.5867427", "text": "def response_params\n params.require(:response).permit(:title, :content, :user_id, :assignment_id, :user_name)\n end", "title": "" }, { "docid": "847d37526a4adb0aaabeba10964a990e", "score": "0.58453864", "text": "def create_assignment\n data = get_new_assigned_users\n exp_date = get_task_expiry_date\n \n assigned_users = data[:assigned_users]\n assigned_users.each do |u|\n at = {\n user_id: u[:user_id],\n evaluation_task_id: self.id,\n assigned_by: @options[\"assigned_by\"],\n assigned_at: Time.now.to_formatted_s(:db)\n }\n u[:list].each do |vd|\n new_at = EvaluationAssignedTask.new(at)\n new_at.voice_log_id = vd[:voice_log_id]\n new_at.record_count = vd[:record_count]\n new_at.total_duration = vd[:total_duration]\n new_at.expiry_at = exp_date\n new_at.flag = \"N\"\n new_at.save!\n end\n end\n end", "title": "" }, { "docid": "96184752cd898ddac07a14c5a112e091", "score": "0.5818335", "text": "def create\n @response = current_participant.init_response(response_params)\n #\n\n respond_to do |format|\n if @response.save\n # eval_results = current_participant.evaluate #@itembank.evaluate(current_participant.responses,[1,1,1])\n eval_results = current_participant.evaluate\n if eval_results[:done] == true\n format.html { redirect_to participant_path(current_participant), notice: 'Vragenlijst is afgerond!' }\n format.json { render :show, status: :finished, location: current_participant }\n else\n format.html { redirect_to new_response_path({item_id:eval_results[:next_item].id, eval_results:eval_results}) }\n format.json { render :show, status: :created, location: @response }\n end\n else\n @item = @response.item\n format.html { render :new }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "19be0547a6322de84cdb67b41424464e", "score": "0.57955074", "text": "def save!\n response = save\n\n unless response\n raise MontageAPIError, \"There was an error saving your data\"\n end\n\n response\n end", "title": "" }, { "docid": "b0c452c3fff43f873bed3258c6419023", "score": "0.57697666", "text": "def save(results); \n @results = results; \n end", "title": "" }, { "docid": "ce2cdeaeff48a93c12481e92c3696981", "score": "0.5768157", "text": "def respond\n @assignment = Assignment.find_by_id(params[:id])\n @user = @assignment.user\n @question = @assignment.question\n puts \"user #{@user} question #{@question} assignment #{@assignment}\"\n end", "title": "" }, { "docid": "11146c39cf4736181feba228d0cbecdd", "score": "0.57547295", "text": "def create\n @uuid = UUIDTools::UUID.random_create.to_s\n @results = params[:response]\n @responses = params[:response].values.collect do |response|\n r = Response.new(response)\n r.uuid = @uuid\n r\n end\n if @responses.all?(&:valid?)\n @responses.each(&:save!)\n else\n redirect_to responses_path, :notice => \"Oops! Something bad happened.\"\n end\n end", "title": "" }, { "docid": "4a87f1c60ef4626b534b40a5653b6115", "score": "0.5752962", "text": "def create\n @response_set = current_user.response_sets.create\n params[:response_set].each do |question, answer|\n unless(question == \"survey_id\" || question == \"responded\")\n response = @response_set.responses.build(question_id: question, answer_id: answer)\n response.save(validate: false)\n end\n end\n\n redirect_to home_show_path\n # redirect_to response_set_path(@response_set)\n end", "title": "" }, { "docid": "eed190bb38f0b28a7ab37323a7a54866", "score": "0.5734712", "text": "def create\n # @survey = Survey.find(params[:id])\n\n input_user = (current_user || helpers.anonymous_user)\n \n @response = Response.new(survey_id: @survey.id, entry: response_params[:entry], user_id: input_user.id)\n if @response.save\n flash[:notice] = \"Thank you for your input!\"\n redirect_to @survey\n else\n flash[:error] = \"Couldn't add input: #{@response.errors.messages}\"\n redirect_back(fallback_location: root_path)\n end\n end", "title": "" }, { "docid": "60246c436b52435444132fc727310c11", "score": "0.57285553", "text": "def create\n params[:response].each do |question, answer|\n current_user.responses.create :question_id => question, :answer_id => answer[:answer_id], :content => answer[:content],\n :user_id => current_user.id\n end\n\n if current_user.save\n flash[:info] = \"Your survey has been submitted successfully!\"\n redirect_to take_survey_path(Survey.find(params[:survey_id]))\n else\n flash.now[:error] = \"There were problems with your survey submission.\"\n render :edit\n end\n authorize! :create, :survey\n end", "title": "" }, { "docid": "db4cf7ce3d1627ad29861225497ec663", "score": "0.5725348", "text": "def update\n @assignment = Assignment.find(params[:id])\n a = params[:users][0].to_i\n unless a==0\n @assignment.assign_to = a\n end\n respond_to do |format|\n if @assignment.update_attributes(params[:assignment])\n format.html { redirect_to assignments_path, :notice => 'Assignment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @assignment.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bd3a0597e1e48b8965cc9b342e012b52", "score": "0.57204753", "text": "def store_response\n save_key = get_save_key(@current_form, @current_question)\n @session[save_key] = @response\n end", "title": "" }, { "docid": "c818b8b8a1fd50c5ab93ec47f27f91dc", "score": "0.5719038", "text": "def create\n \n @response = Response.new(params[:response])\n @response.login_id = @login.id # need to manually set this here\n\n if @response.save\n # send email\n begin\n RsvpMailer.deliver_responded(@response) \n rescue\n #don't do anything if emailing them fails ...\n logger.error(\"couldn't email guest #{@response.login.name} with email #{@response.email}\")\n end\n \n begin \n RsvpMailer.deliver_responded_notify(@response)\n rescue\n #don't give them an error if can't send to us b/c it's still saved\n logger.error(\"couldn't email [email protected]!\")\n end\n \n flash[:notice] = 'Response was successfully created.'\n redirect_to responses_thanks_url(:id => @login.response.id)\n else\n render :action => \"new\", :layout => 'layouts/responses'\n end\n end", "title": "" }, { "docid": "fe2d6ccf08881137583b94bfec68b392", "score": "0.5706934", "text": "def save\n response = Intercom.post(\"users\", to_hash)\n self.update_from_api_response(response)\n end", "title": "" }, { "docid": "eabc4cf2c079e10cb9544154b5083ece", "score": "0.57067174", "text": "def grade_users(arr_of_discussing_user_ids, arr_of_user_ids_AL1, arr_of_user_ids_AL2)\n @url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/assignments\"\n puts \"@url is #{@url}\"\n\n @getResponse = HTTParty.get(@url, :headers => $header)\n puts(\" GET to get assignments in course has Response.code #{@getResponse.code} and getResponse is #{@getResponse}\")\n\n assignments_data = @getResponse.parsed_response\n assignment_AL1_id = nil\n assignment_AL2_id = nil\n\n assignments_data.each do |assignments_info|\n if assignments_info[\"name\"] == \"1: aktiv lyssnare / active listener\"\n assignment_AL1_id = assignments_info[\"id\"]\n elsif assignments_info[\"name\"] == \"2: aktiv lyssnare / active listener\"\n assignment_AL2_id = assignments_info[\"id\"]\n end\n end\n\n arr_of_user_ids_AL1.each { |id|\n\t\tif arr_of_discussing_user_ids.include?(id) && !has_student_been_graded(assignment_AL1_id, id)\n\t\t\t@url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/assignments/#{assignment_AL1_id}/submissions/#{id}\"\n puts \"@url is #{@url}\"\n\n @payload={'submission': {\n 'posted_grade': 'pass'}\n }\n puts(\"@payload is #{@payload}\")\n\n @putResponse = HTTParty.put(@url, :body => @payload.to_json, :headers => $header )\n puts(\" PUT to grade assignment for user has Response.code #{@putResponse.code} and postResponse is #{@putResponse}\")\n\t\telsif !arr_of_discussing_user_ids.include?(id) && !has_student_been_graded(assignment_AL1_id, id)\n\t\t\t@url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/assignments/#{assignment_AL1_id}/submissions/#{id}\"\n puts \"@url is #{@url}\"\n\n @payload={'submission': {\n 'posted_grade': 'fail'}\n }\n puts(\"@payload is #{@payload}\")\n\n @putResponse = HTTParty.put(@url, :body => @payload.to_json, :headers => $header )\n puts(\" PUT to grade assignment for user has Response.code #{@putResponse.code} and postResponse is #{@putResponse}\")\n\t\tend\n\t}\n\t\n\tarr_of_user_ids_AL2.each { |id|\n\t\tif arr_of_discussing_user_ids.include?(id) && !has_student_been_graded(assignment_AL2_id, id)\n\t\t\t@url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/assignments/#{assignment_AL2_id}/submissions/#{id}\"\n puts \"@url is #{@url}\"\n\n @payload={'submission': {\n 'posted_grade': 'pass'}\n }\n puts(\"@payload is #{@payload}\")\n\n @putResponse = HTTParty.put(@url, :body => @payload.to_json, :headers => $header )\n puts(\" PUT to grade assignment for user has Response.code #{@putResponse.code} and postResponse is #{@putResponse}\")\n\t\telsif !arr_of_discussing_user_ids.include?(id) && !has_student_been_graded(assignment_AL2_id, id)\n\t\t\t@url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/assignments/#{assignment_AL2_id}/submissions/#{id}\"\n puts \"@url is #{@url}\"\n\n @payload={'submission': {\n 'posted_grade': 'fail'}\n }\n puts(\"@payload is #{@payload}\")\n\n @putResponse = HTTParty.put(@url, :body => @payload.to_json, :headers => $header )\n puts(\" PUT to grade assignment for user has Response.code #{@putResponse.code} and postResponse is #{@putResponse}\")\n\t\tend\n\t}\nend", "title": "" }, { "docid": "92bf2073af86dabc23d2c84d558910d6", "score": "0.57018614", "text": "def create\n link_back\n @assignment = Assignment.new(user_id: params[:user_id], request_id: params[:request_id])\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to session.delete(:return_to), notice: 'User was assigned to request.' }\n else\n format.html { redirect_to session.delete(:return_to), notice: 'User was not assigned to request.' }\n end\n end\n end", "title": "" }, { "docid": "4e281a182aa80483e8e03a4ef1c31f43", "score": "0.56987053", "text": "def assign_points\n if self.response == \"Yes\"\n self.points = 1\n elsif self.response == \"No\"\n self.points = 0\n end\n self.save\n end", "title": "" }, { "docid": "1f7b5b5bcede2ff26d721c0d2e020f38", "score": "0.5696272", "text": "def response_params\n params.require(:assignment).permit(:user_id, :request_id)\n end", "title": "" }, { "docid": "bfad16c04e7ff5115f38795462c8b45a", "score": "0.5683858", "text": "def update\n return unless check_update_reponses?\n return unless valid_response_by_admin?\n\n if @response.update(response_params)\n if current_user.admin?\n handler_notice(\"Resposta avaliada com sucesso.\", task_responses_path(@response.task_id))\n else\n handler_notice(\"Resposta salva com sucesso.\", responses_board_path(current_user.id))\n end\n else\n handler_notice_error(\"Erro ao atualizar resposta.\", response_path(@response))\n end\n end", "title": "" }, { "docid": "7d902b140f95397a6d7abb5347739ad1", "score": "0.5668046", "text": "def create\n @user_response = UserResponse.new(user_response_params)\n if @user_response.valid?\n flash[:notice] = \"Yes! Those are the correct answers.\"\n end\n render :new\n end", "title": "" }, { "docid": "f0d36063d6ba2f3800a8ebcd4b4d06e7", "score": "0.56603366", "text": "def save(user) \n Rails.logger.debug \"Call to election.save\"\n if self.valid? #Validate if the Election object is valid\n Rails.logger.debug \"The election is valid!\"\n #Create a raw election object\n election_req = { 'title'=>self.title,\n 'start'=> Util.date_to_epoch(self.start_date), #Turn the start_date to epoch\n 'end'=> Util.date_to_epoch(self.end_date), #Turn the end_date to epoch\n 'startVoting'=> Util.date_to_epoch(self.start_voting_date), #Turn the start_voting_date to epoch,\n 'endVoting'=> Util.date_to_epoch(self.end_voting_date), #Turn the end_voting_date to epoch,\n 'institutionId' =>self.institution_id,\n 'introduction' =>self.introduction,\n 'process' =>self.process\n }\n reqUrl = \"/api/election/\" #Set the request url\n rest_response = MwHttpRequest.http_post_request(reqUrl,election_req,user['email'],user['password']) #Make the POST call to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" || rest_response.code == \"201\" || rest_response.code == \"202\" #Validate if the response from the server is satisfactory\n election = Election.rest_to_election(rest_response.body) #Turn the response object to a Election object\n return true, election #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n else\n Rails.logger.debug self.errors.full_messages\n return false, self.errors.full_messages #Return invalid object error\n end\n end", "title": "" }, { "docid": "4dfd0ae73ec682e1f00e5d94a4365775", "score": "0.56568855", "text": "def user_assign(value)\n forget_value(\"user\")\n assign value,\"user\"\n end", "title": "" }, { "docid": "4dfd0ae73ec682e1f00e5d94a4365775", "score": "0.56568855", "text": "def user_assign(value)\n forget_value(\"user\")\n assign value,\"user\"\n end", "title": "" }, { "docid": "c33f560224fa54b8cc5bb925f1437d2a", "score": "0.5656412", "text": "def save_and_send_mails(learners_for_course_adding,learners_valid_for_signup,current_user,assessment_id)\n @final_signup_learners = Array.new #Creates a global hash to store filtered learners for sending signup mail.\n final_course_added_learners = Array.new\n @total_final_course_added_learners = Array.new\n @already_assigned = Array.new\n @admin = Array.new\n @other_org = Array.new\n @assessment = Assessment.find(assessment_id)\n unless learners_valid_for_signup.nil? or learners_valid_for_signup.blank? then\n learners_valid_for_signup.each { |learner|\n if valid_assign(@assessment.id,current_user)\n @user = User.find_by_email(learner.email)\n # final_signup_learners << learner.email\n case\n when (@user.user_id == current_user.id or @user.id == current_user.id) then # whether the learner is for current admin or not or whether admin is assigning himself as learner\n @learner = Learner.find_by_assessment_id_and_user_id_and_type_of_test_taker(assessment_id,@user.id,\"learner\")\n if @learner.nil? then # whether the learner is already present or not\n if valid_assign(@assessment.id,current_user)\n if @assessment.assessment_rules.nil? or @assessment.assessment_rules.blank?\n store_learner_details(@assessment,current_user,@user,\"\",\"learner\")\n else\n store_learner_details_using_rules(@assessment,current_user,@user,\"\",\"learner\")\n end\n fill_signup_course_added_array(@user)\n end\n elsif [email protected]? and @learner.active == \"no\" then # if learner is existing in learners table with active status \"no\" then just change the status to \"yes\"No need to add new record for him again\n @learner.update_attribute(:active,\"yes\")\n fill_signup_course_added_array(@learner.user)\n increase_assessment_columns_while_assigning(@assessment,@learner)\n end\n end\n end\n }\n end\n \n #dont write final_course_added_learners= total_final_course_added_learners = learners_for_course_adding. This doesnt work.. they make use of same address and mem space.\n # so x=y=3, here if u make any changes on x they reflect on y also.\n final_course_added_learners = learners_for_course_adding\n # total_final_course_added_learners.replace(final_course_added_learners)\n final_course_added_learners.each { |learner|\n @user = User.find_by_email(learner.email)\n\n @learner = Learner.find_by_assessment_id_and_user_id_and_type_of_test_taker(assessment_id,@user.id,\"learner\")\n if @learner.nil? then # whether the learner is already present or not\n if valid_assign(@assessment.id,current_user)\n if @assessment.assessment_rules.nil? or @assessment.assessment_rules.blank?\n store_learner_details(@assessment,current_user,@user,\"\",\"learner\")\n else\n store_learner_details_using_rules(@assessment,current_user,@user,\"\",\"learner\")\n end\n fill_signup_course_added_array(@user)\n end\n elsif [email protected]? and @learner.active == \"no\" then # if learner is existing in learners table with active status \"no\" then just change the status to \"yes\"No need to add new record for him again\n @learner.update_attribute(:active,\"yes\")\n fill_signup_course_added_array(@learner.user)\n increase_assessment_columns_while_assigning(@assessment,@learner)\n end\n }\n \n test_added_count = send_test_added_mails(@total_final_course_added_learners,@assessment,current_user)\n signup_count = send_signup_mails(@final_signup_learners,@assessment,current_user)\n return (signup_count + test_added_count)\n end", "title": "" }, { "docid": "d3ae15f38c3a56b5594df0c8cfe08ff0", "score": "0.56418276", "text": "def create\n @response = Response.new(response_params)\n @user = current_user\n respond_to do |format|\n if @response.save\n format.html { redirect_to presentation_path(@response.assignment.presentation.id), notice: 'Response was successfully created.' }\n format.json { render :show, status: :created, location: @response }\n else\n format.html { render :new }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e47a8b2b01f3b8fce4d6053cda5d1fe", "score": "0.5641496", "text": "def save_info (user_email, user_name)\n user = User.new(user_email, user_name)\n user.save\n pp user\n puts \"User is successfully added. \\nContinue?(Y/N) \\n\"\n \n prompt = gets.chomp\n get_info(prompt)\nend", "title": "" }, { "docid": "c9d6427a9863a8e9462093eea57741ca", "score": "0.56228846", "text": "def add_users\n params[:users] ||= {}\n params[:trial] = params[:trial].present?\n params[:users].reject!{|key,data| data[:email].blank? || data[:name].blank?}\n params[:upload_method] ||= \"manual\"\n @errors = {}\n @functional_areas = Vger::Resources::FunctionalArea.active.all.to_a\n assessment_factor_norms = @assessment.job_assessment_factor_norms.all.to_a\n functional_assessment_traits = @assessment.functional_assessment_traits.all.to_a\n add_users_allow = assessment_factor_norms.size >= 1 || functional_assessment_traits.size >= 1\n if request.put?\n users = {}\n if params[:users].empty?\n flash[:error] = \"Please add at least 1 Assessment Taker to send the assessment. You may also select 'Add Assessment Takers Later' to save the assessment and return to the Assessment Listings.\"\n render :action => :add_users and return\n end\n\n params[:users].each do |key,user_data|\n @errors[key] ||= []\n if @assessment.set_applicant_id && !(/^[0-9]{8}$/.match(user_data[:applicant_id]).present?)\n @errors[key] << \"Applicant ID is invalid.\"\n end\n user = Vger::Resources::User.where(\n :query_options => { \n :email => user_data[:email]\n }\n ).first\n user_data[:role] = Vger::Resources::Role::RoleName::CANDIDATE\n if user\n user_data[:id] = user.id\n users[user.id] = user_data\n attributes = user_data.dup\n attributes.delete(:applicant_id)\n attributes.each { |attribute,value| attributes.delete(attribute) unless user.send(attribute).blank? }\n Vger::Resources::User.save_existing(user.id, attributes)\n else\n attributes = user_data.dup\n attributes.delete(:applicant_id)\n user = Vger::Resources::User.find_or_create(attributes)\n if user.error_messages.present?\n @errors[key] |= user.error_messages\n else\n user_data[:id] = user.id\n users[user.id] = user_data\n end\n end\n if @errors[key].blank?\n user_assessment = @assessment.user_assessments.where(\n query_options: {\n assessment_id: @assessment.id,\n user_id: user.id\n },\n methods: ['attempted_within_cooling_off_period']\n ).all[0]\n if user_assessment && user_assessment.attempted_within_cooling_off_period\n @errors[key] << \"Test is already sent to the candidates within the cooling off period of #{@company.cooling_off_period} months.\"\n end\n end\n end\n\n unless @errors.values.flatten.empty?\n #flash[:error] = \"Errors in provided data: <br/>\".html_safe\n flash[:error] = @errors.map.with_index do |(user_name, user_errors), index|\n if user_errors.present?\n [\"#{user_errors.join(\"<br/>\")}\"]\n end\n end.compact.uniq.join(\"<br/>\").html_safe\n render :action => :add_users and return\n end\n get_templates\n params[:send_test_to_users] = true\n params[:users] = users\n if @company.subscription_mgmt\n get_packages\n end\n render :action => :send_test_to_users\n else\n if !add_users_allow\n flash[:error] = \"You need to select traits before sending an assessment. Please select traits from below.\"\n redirect_to competencies_url\n end\n end\n end", "title": "" }, { "docid": "b7216a4060ed5da283645e95a7f26f13", "score": "0.56175023", "text": "def save_people_continue\n @exam.grease_doc.retrieve #get data from google and set any missing ids\n @exam = Exam.find(@exam.id) #refresh object\n @exam.grease_doc.send #send data back to object to update ids or other bad data\n render :partial => \"success\"\n end", "title": "" }, { "docid": "c083a80650e72d1dc3539eecb37e2685", "score": "0.561489", "text": "def assign\n respond_to do |format|\n if @task.update_attributes(status: 'assigned')\n format.html { redirect_to tasks_url, notice: 'User assigned the task successfully.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "138955d7abe861b6bcfbe4be40022148", "score": "0.56068534", "text": "def collect_save\n staff_id = current_user.id\n \n respond_to do |format|\n unless params[:assignment_ids].nil? or params[:user_ids].nil?\n Grade.assign_students_and_assignments_to_staff(@school.id,params[:assignment_ids],params[:user_ids],staff_id)\n format.html {redirect_to :back}\n else\n format.html {redirect_to :back, notice: 'You must select at least one student and one assignment.'}\n end\n end\n end", "title": "" }, { "docid": "e9cd38fd5e5995ad43502be0653f4588", "score": "0.5605726", "text": "def create\n if assignment_params[:assignables].present? && assignment_params[:users].present?\n assignables = assignment_params[:assignables].map do |assignable|\n if assignable.last['assignable_type'] == 'Brand'\n Brand.find(assignable.last['assignable_id'])\n else\n Program.find(assignable.last['assignable_id'])\n end\n end\n users = assignment_params[:users].map do |user|\n User.find(user.last['user_id'])\n end\n\n users.each do |user|\n assignables.each do |assignable|\n user.assign(assignable)\n end\n end\n\n assignable_names = assignables.map do |assignable|\n assignable.name\n end.to_sentence\n user_emails = users.map do |user|\n user.email\n end.to_sentence\n\n return redirect_to user_management_url, notice: \"Assigned #{assignable_names} to #{user_emails}\"\n else\n @assignment = Assignment.new(assignment_params)\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @assignment }\n else\n format.html { render action: 'new' }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "title": "" }, { "docid": "08159adc9ccff1167b06a555afdb2b97", "score": "0.5601264", "text": "def create\n @submission = Submission.new(submission_params)\n\n if @submission.valid?\n\n # Get the info for this specific user using the email as the hash key\n userInfo = $userInfos[@submission.email]\n \n # Info on assignment is stored in the following format:\n # { \"assignmentId\" : \"Assignment Display Name\", ... }\n assignmentIdToName = JSON.parse(File.read(::Rails.root.join(\"config\", \"assignmentInfo.json\")))\n\n\n ######### \n # We're using the google_drive gem. The API is here: http://gimite.net/doc/google-drive-ruby/\n ########\n \n # You can also use OAuth. See document of GoogleDrive.login_with_oauth for details.\n session = GoogleDrive.login(ENV['GOOGLE_DRIVE_EMAIL'], ENV['GOOGLE_DRIVE_PASSWORD'])\n doc = session.spreadsheet_by_key(userInfo[\"documentKey\"])\n ws = doc.worksheets[0]\n \n # Assuming the worksheet has the following columns, populate it.\n # Student Name | Student Email | Coach | Assignment | Submission URL | Date Submitted | Feedback \n firstEmptyRow = ws.num_rows() + 1\n ws[firstEmptyRow, 1] = userInfo[\"name\"] \n ws[firstEmptyRow, 2] = @submission.email\n ws[firstEmptyRow, 3] = userInfo[\"coach\"] \n ws[firstEmptyRow, 4] = assignmentIdToName[params[:assignment_id]]\n ws[firstEmptyRow, 5] = @submission.url\n ws[firstEmptyRow, 6] = Time.now\n ws.save() \n \n render action: 'create'\n else\n render action: 'new'\n end\n\n end", "title": "" }, { "docid": "305ed610cce882ad8e6a20bd52d49ba3", "score": "0.55992365", "text": "def assign\n \n end", "title": "" }, { "docid": "c721e479ae455e76b260c4684f838a7d", "score": "0.5586591", "text": "def surveys_insert_response(question, response, tag)\n response_entry = Response.new \n response_entry.question_id = question[:database_record].id\n response_entry.callerid = callerid\n response_entry.guid = tag\n response_entry.response = response\n response_entry.save\n end", "title": "" }, { "docid": "eb31a8891acecccaabdee3b0bc5de80a", "score": "0.55857575", "text": "def save_and_send_mails(learners_for_course_adding,learners_valid_for_signup,current_user,course_id)\n @final_signup_learners = Array.new #Creates a global hash to store filtered learners for sending signup mail.\n final_course_added_learners = Array.new\n @total_final_course_added_learners = Array.new\n @already_assigned = Array.new\n @admin = Array.new\n @other_org = Array.new\n @course = Course.find(course_id)\n unless learners_valid_for_signup.nil? or learners_valid_for_signup.blank? then\n learners_valid_for_signup.each { |learner|\n if valid_assign(@course.id,current_user)\n @user = User.find_by_email(learner.email)\n # final_signup_learners << learner.email\n case\n when (@user.user_id == current_user.id or @user.id == current_user.id) then # whether the learner is for current admin or not or whether admin is assigning himself as learner\n @learner = Learner.find_by_course_id_and_user_id_and_type_of_test_taker(course_id,@user.id,\"learner\")\n if @learner.nil? then # whether the learner is already present or not\n if (if current_user.typeofuser == \"individual buyer\" or current_user.typeofuser == \"corporate buyer\" then valid_assign(@course.id,current_user) else true end)\n store_learner_details(@course,current_user,@user,\"\")\n fill_signup_course_added_array(@user)\n end\n elsif [email protected]? and @learner.active == \"no\" then # if learner is existing in learners table with active status \"no\" then just change the status to \"yes\"No need to add new record for him again\n @learner.update_attribute(:active,\"yes\")\n fill_signup_course_added_array(@learner.user)\n increase_course_columns_while_assigning(@course,@learner)\n end\n end\n end\n }\n end\n\n #dont write final_course_added_learners= total_final_course_added_learners = learners_for_course_adding. This doesnt work.. they make use of same address and mem space.\n # so x=y=3, here if u make any changes on x they reflect on y also.\n \n final_course_added_learners = learners_for_course_adding\n # total_final_course_added_learners.replace(final_course_added_learners)\n final_course_added_learners.each { |learner|\n @user = User.find_by_email(learner.email)\n \n @learner = Learner.find_by_course_id_and_user_id_and_type_of_test_taker(course_id,@user.id,\"learner\")\n if @learner.nil? then # whether the learner is already present or not\n if (if current_user.typeofuser == \"individual buyer\" or current_user.typeofuser == \"corporate buyer\" then valid_assign(@course.id,current_user) else true end)\n store_learner_details(@course,current_user,@user,\"\")\n fill_signup_course_added_array(@user)\n end\n elsif [email protected]? and @learner.active == \"no\" then # if learner is existing in learners table with active status \"no\" then just change the status to \"yes\"No need to add new record for him again\n @learner.update_attribute(:active,\"yes\")\n fill_signup_course_added_array(@learner.user)\n increase_course_columns_while_assigning(@course,@learner)\n end\n }\n signup_count = send_signup_mails(@final_signup_learners,course_id,current_user)\n course_added_count = send_course_added_mails(@total_final_course_added_learners,course_id,current_user)\n return (signup_count + course_added_count)\n end", "title": "" }, { "docid": "8df80ce174ca42515cd99b459f17edce", "score": "0.5564691", "text": "def build_and_save_imported_result(registrant_hash, user)\n registrant = find_existing_registrant(registrant_hash)\n registrant.gender = if registrant_hash[:gender] == \"m\"\n \"Male\"\n else\n \"Female\"\n end\n registrant.user = user\n registrant.status = \"base_details\"\n registrant.save!\n set_events_sign_ups(registrant, registrant_hash[:events])\n set_events_best_times(registrant, registrant_hash[:events])\n set_events_choices(registrant, registrant_hash[:events])\n end", "title": "" }, { "docid": "76d7c73f5074a7bdb2a1d62cebdc72fb", "score": "0.55596256", "text": "def save_and_send_mails(learners_for_package_adding,current_user,package_obj)\n assigned_count = 0\n unless learners_for_package_adding.nil? or learners_for_package_adding.blank? then\n ass_course = package_obj.assessment_courses[0]\n learners_for_package_adding.each { |learner|\n if valid_assign(package_obj.id,current_user)\n user_obj = UsersController.new\n if ass_course.assessment_id.nil?\n course_obj = CoursesController.new\n @learner_obj = Learner.find_by_course_id_and_user_id_and_type_of_test_taker_and_package_id(ass_course.course.id,learner.id,\"learner\",package_obj.id)\n if @learner_obj.nil? then\n course_obj.store_learner_details(ass_course.course,current_user,learner,package_obj.id)\n user_obj.package_send_activation_mail(learner,'signup_package_learner_notification',current_user.tenant,current_user)\n assigned_count = assigned_count + 1\n elsif !@learner_obj.nil? and @learner_obj.active == \"no\" then\n @learner_obj.update_attribute(:active,\"yes\")\n increase_course_columns_while_assigning(ass_course.course,@learner_obj)\n user_obj.package_send_activation_mail(learner,'signup_package_learner_notification',current_user.tenant,current_user)\n assigned_count = assigned_count + 1\n end \n elsif ass_course.course_id.nil?\n assessment_obj = AssessmentsController.new\n @learner_obj = Learner.find_by_assessment_id_and_user_id_and_type_of_test_taker_and_package_id(ass_course.assessment.id,learner.id,\"learner\",package_obj.id)\n if @learner_obj.nil? then\n assessment_obj.store_learner_details(ass_course.assessment,current_user,learner,package_obj.id,\"learner\")\n user_obj.package_send_activation_mail(learner,'signup_package_learner_notification',current_user.tenant,current_user)\n assigned_count = assigned_count + 1\n elsif !@learner_obj.nil? and @learner_obj.active == \"no\" then\n @learner_obj.update_attribute(:active,\"yes\")\n increase_assessment_columns_while_assigning(ass_course.assessment,@learner_obj)\n user_obj.package_send_activation_mail(learner,'signup_package_learner_notification',current_user.tenant,current_user)\n assigned_count = assigned_count + 1\n end\n end\n end\n }\n end\n return assigned_count\n end", "title": "" }, { "docid": "cfdabbbcc2583a824d215d18143187de", "score": "0.55502796", "text": "def save\n CONNECTION.execute(\"UPDATE responders SET e_mail = '#{@e_mail}', age_id = #{@age_id} WHERE id = #{@id};\")\n end", "title": "" }, { "docid": "706b586961802c238a9838c7419a7214", "score": "0.5531436", "text": "def user_feedback\n @response = ApplicationRecord::Response.find(params[:id])\n @response.update(feedback: params[:response][:feedback])\n redirect_to feedback_response_path\n end", "title": "" }, { "docid": "6a523d78d1dd59ddbb24b329835f32c3", "score": "0.5528014", "text": "def save_response(response)\n if response && response.multiple_entities? && response.collection.size > 1\n paths = response.entities.collect {|e| e['metadata']['path'][1..-1] } rescue []\n blob = Marshal.dump paths\n $settings.save_profile_blob 'last_response', blob\n end\nend", "title": "" }, { "docid": "0ed3a6208704458f7c7aa642c224eeec", "score": "0.552717", "text": "def set_response\n @response = @student.responses.find(params[:id])\n end", "title": "" }, { "docid": "38bd5e3f80f90eb91f43bd482e21f991", "score": "0.55271643", "text": "def create\n\n response = params[:quick_poll_response]\n response[:user_id] = current_user.id\n response[:value] = params[:value] # i have no fucking idea what's going on here and it's too fucking late to think about it\n\n @quick_poll_response = QuickPollResponse.new(response)\n\n if @quick_poll_response.save\n logger.info \"save succeeded\"\n else\n logger.info \"save failed\"\n end\n\n redirect_to \"/\"\n end", "title": "" }, { "docid": "045d55c1a35c3d76d18c2a3cb694e834", "score": "0.5521889", "text": "def response=(response)\n self.response_success = response.success?\n self.response_authorization = response.authorization\n self.response_message = response.message\n \n #self.id\n #self.order_id\n #self.amount\n #self.action\n \n self.trxn_status = response.params[\"ewaytrxnstatus\"]\n self.trxn_number = response.params[\"ewaytrxnnumber\"]\n self.trxn_reference = response.params[\"ewaytrxnreference\"]\n self.trxn_option_1 = response.params[\"ewaytrxnoption1\"]\n self.trxn_option_2 = response.params[\"ewaytrxnoption2\"]\n self.trxn_option_3 = response.params[\"ewaytrxnoption3\"]\n self.auth_code = response.params[\"ewayauthcode\"]\n self.return_amount = response.params[\"ewayreturnamount\"]\n self.trxn_error = response.params[\"ewaytrxnerror\"]\n \n self.params = response.params\n rescue ActiveMerchant::ActiveMerchantError => e\n self.trxn_status = false\n self.auth_code = nil \n self.trxn_error = e.message\n \n self.params = {}\n end", "title": "" }, { "docid": "26ad6645b887c064eabd0c31ea48ca91", "score": "0.55166125", "text": "def update\n respond_to do |format|\n if @user_response.update(user_response_params)\n format.html { redirect_to new_user_response_path(question_id: @user_response.next_question.id) }\n format.json { render :show, status: :ok, location: @user_response }\n else\n format.html { render :edit }\n format.json { render json: @user_response.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8c32fd6414ad3c8f81f11b6f765df43a", "score": "0.5511675", "text": "def save_and_activate_package_learners\n if !params[:user][:email].nil? and !params[:user][:email].blank?\n @tenant = Tenant.find_by_custom_url(request.subdomain)\n admin_user = @tenant.user\n group = Group.find_by_user_id_and_group_name(admin_user.id,'Coupons')\n if User.find_by_email(params[:user][:email]).nil?\n\n #the below gets executed for DC books . control comes from /views/coupons/first_time_activation.html where learner fills many details like name,phonenumber,dateofbirth etc\n if !session[:user].nil?\n @user = User.new()\n @user.login = session[:user][:login]\n @user.email = params[:user][:email].strip()\n @user.typeofuser = \"learner\"\n @user.address = session[:user][:address]\n @user.date_of_birth = session[:user][:date_of_birth]\n @user.mob_number = session[:user][:mob_number]\n @user.designation = session[:user][:designation]\n @user.alternate_email = params[:user][:alternate_email]\n @user.student_course = session[:user][:student_course]\n @user.student_course_year = session[:user][:student_course_year]\n @user.student_college = session[:user][:student_college]\n @user.student_college_city = session[:user][:student_college_city]\n @user.user_id = admin_user.id\n @user.tenant_id = @tenant.id\n @user.group_id = group.id\n @user.save\n else\n\n if !params[:user][:login].nil? and !params[:user][:login].blank?\n @user = User.new()\n @user.login = params[:user][:login]\n @user.email = params[:user][:email].strip()\n @user.typeofuser = \"learner\"\n # @user.alternate_email = params[:user][:alternate_email]\n @user.user_id = admin_user.id\n @user.tenant_id = @tenant.id\n @user.group_id = group.id\n @user.save\n else\n flash[:enter_details] = \"Enter details\"\n redirect_to(\"/coupons/package_signup/#{params[:id]}\")\n end\n end\n unless @user.nil?\n coupon = Coupon.find(params[:id])\n #assign the first test/course to the learner\n assign_first_course_or_assessment_for_coupon(coupon,@user,admin_user)\n package_send_activation_mail(@user,'signup_package_learner_notification',@user.tenant,@user.tenant.user)\n flash[:email_notice] = \"Email was sent.\"\n redirect_to(\"/coupons/package_signup_confirmation/#{@user.id}\")\n end\n else\n flash[:enter_details] = \"Email already exists\"\n redirect_to(\"/coupons/package_signup/#{params[:id]}\")\n end\n else\n flash[:enter_details] = \"Enter details\"\n redirect_to(\"/coupons/package_signup/#{params[:id]}\")\n end\n end", "title": "" }, { "docid": "c1ef559437fdb51b5f4d4429ab1a8a3c", "score": "0.55092967", "text": "def data_assignment\n Locallect.create(user_id: self.id)\n Explorer.create(user_id: self.id)\n end", "title": "" }, { "docid": "d374df42d302859153bea53776804541", "score": "0.55088854", "text": "def save!\n response = HTTParty.put(\"#{users_base_path}/#{id}\", timeout:, headers:, body: to_json)\n get_body_from(response)\n end", "title": "" }, { "docid": "819c246a695d8dd139a9a564166d4767", "score": "0.5506215", "text": "def assign\n @license_set = LicenseSet.find(params[:id])\n success = false\n\n if params[:commit]==\"Update\" # In case the CR/IA is attempting to revoke licenses to students\n # Don't even bother to validate. Just update\n users = params[:license_set] ? User.where(id: params[:license_set][:user_ids]) : [] # If there are no user_ids in the params, then revoke the licenses for all students by setting license = 0\n all_users_of_this_license_set = @license_set.user_ids\n user_ids_int = params[:license_set].present? ? params[:license_set][:user_ids].collect { |id_int| id_int.to_i } : []\n revoked_users = all_users_of_this_license_set - user_ids_int\n @license_set.update_attribute :users, users\n if users == []\n all_users_of_this_license_set.each do |user_id|\n User.find(user_id).update_attribute(:last_content_purchased,Time.now)\n end\n else\n revoked_users.each do |user_id|\n User.find(user_id).update_attribute(:last_content_purchased,Time.now)\n end\n end\n success = true\n else # IA/CR is attempting to assign licenses to new students\n message = \"Please select at least one student\"\n if params[:license_set] # If users are there in the params list\n users = User.where(id: params[:license_set][:user_ids])\n if @license_set.available >= (users.map(&:id)-@license_set.user_ids).size #Availablilty of licenses is greater than the new users who want licenses\n @license_set.users+=users # This also covers the case where the student is already there in the system because the duplicate will not be allowed by rails by default.\n success = true\n else\n message = \"Lesser no. of licenses are available than requested\"\n end\n message = \"All the licenses are consumed\" if @license_set.available==0\n end\n end\n @license_set.reevaluate_license_set\n if success\n respond_to do |format|\n format.js { render \"list_all_students\" }\n end\n else\n respond_to do |format|\n format.js { render :js => \"$('<div>#{message}</div>').dialog({buttons : {\n Ok: function() {$(this).dialog('close');}}})\" }\n end\n end\n\n end", "title": "" }, { "docid": "881d9fcbd6d707d4ecee51661dada079", "score": "0.5488101", "text": "def process_result res\n call = res[-1]\n\n check = check_call call\n\n if check and not @results.include? call\n @results << call\n\n if include_user_input? call[3] and not hash? call[3][1]\n confidence = CONFIDENCE[:high]\n else\n confidence = CONFIDENCE[:med]\n end\n \n warn :result => res, \n :warning_type => \"Mass Assignment\", \n :message => \"Unprotected mass assignment\",\n :line => call.line,\n :code => call, \n :confidence => confidence\n end\n\n res\n end", "title": "" }, { "docid": "a7696b2b0aaaa6c2a3c076a3c8896755", "score": "0.5484579", "text": "def on_behalf_set(response)\n lita_user = find_user response.match_data['user']\n return response.reply t('error.no_user', name: lita_user.name) if lita_user.nil?\n stored_password = fetch_password lita_user\n if stored_password.eql? response.match_data['password']\n return set response, lita_user\n end\n return response.reply t('error.password_nil', action: 'set', name: lita_user.name) if stored_password.nil?\n response.reply t('error.password_mistmatch', action: 'set', name: lita_user.name)\n end", "title": "" }, { "docid": "b4c1662c92102d48c7c16706c5029837", "score": "0.54844", "text": "def create\n @response = current_user.responses.build(response_params)\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render :show, status: :created, location: @response }\n else\n format.html { render :new }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "53539904b3b14a91f7b2cebb0607aa2c", "score": "0.5484197", "text": "def swap_user\n begin\n id1 = params[:id1].to_i\n id2 = params[:id2].to_i\n Assignment.swap_user(id1, id2)\n result = {}\n result[:uri1] = assignments_url + '/' + params[:id1]\n result[:uri2] = assignments_url + '/' + params[:id2]\n generate_response(result,{}, 200)\n rescue ActiveRecord::RecordNotFound, ArgumentError => e\n generate_exception_response(e.message, 422)\n rescue ActiveRecord::StatementInvalid, Exception => e\n generate_exception_response(e.message, 500)\n end\n end", "title": "" }, { "docid": "58199e2a633c3205eba827d77ecdf359", "score": "0.5481788", "text": "def save_result_and_return(request, response)\n ## Parse the data\n parsed_data = MultiJson.load(response.body)\n ## Save the last result as the super class Result\n @last_result = Wit::REST::Result.new(parsed_data, request.method, request.path, request.body)\n ## Return it\n return @last_result\n end", "title": "" }, { "docid": "977c7ea8bf7fc9fcea1f6ca149d5aff9", "score": "0.54810923", "text": "def save!\n if self.save\n true\n elsif response_errors.present?\n raise Her::Errors::ResponseError.for(status_code), \"Remote validation of #{self.class.name} failed with a #{status_code}: #{full_error_messages}\"\n elsif errors.present?\n raise Her::Errors::RecordInvalid, \"Local validation of #{self.class.name} failed: #{errors.full_messages}\"\n else\n raise 'unreachable'\n end\n end", "title": "" }, { "docid": "9f27fe4a2aae7ec0d3c36e8ee13e7a7e", "score": "0.54716057", "text": "def create\n if validate_user_for_course\n previous_answer = Response.find_by(:user_id => current_user.id, :course_id => params[:course])\n if previous_answer\n json_response = eval(previous_answer.response)\n json_response.each do |question,answer|\n prev_aggregated_response_row=AggregatedResponse.find_by(:answer => answer,:question => question, :course_id => params[:course])\n if prev_aggregated_response_row\n prev_aggregated_response_row.update_attributes!(:count => (prev_aggregated_response_row.count-1))\n end\n end\n end\n Response.find_or_initialize_by(:user_id => current_user.id, :course_id => params[:course]).update_attributes!(:response => response_params)\n response_params.each do |question,answer|\n aggregated_response_row=AggregatedResponse.find_by(:answer => answer,:question => question, :course_id => params[:course])\n if aggregated_response_row\n aggregated_response_row.update_attributes!(:count => (aggregated_response_row.count+1))\n else\n new_aggregated_response_row = AggregatedResponse.new(:answer => answer,:question => question, :course_id => params[:course], :count=>1)\n new_aggregated_response_row.save\n end\n end\n end\n end", "title": "" }, { "docid": "d51d10467c47d39e203312282a3fd582", "score": "0.5470735", "text": "def save_paperwork\n # if we aren't an admin or paperwork admin we shouldn't be here\n record_not_found and return if !admin? and !paperwork_admin?\n\n params['participant_registration'].each do |id,data|\n pr = ParticipantRegistration.find(id)\n pr.medical_liability = data['medical_liability']\n pr.background_check = data['background_check']\n pr.nazsafe = data['nazsafe']\n pr.save\n end\n\n flash[:notice] = 'Paperwork Information saved successfully.'\n\n respond_to do |format|\n format.html {\n redirect_to(paperwork_participant_registrations_url)\n }\n end\n end", "title": "" }, { "docid": "59872a62e374e67a39a067281de20e33", "score": "0.54672605", "text": "def save\n\t\t\t\trun_callbacks :save do\n\t\t\t\t\tflag = false\n\t\t\t\t\tif changed? && is_valid? && set_id\n\t\t\t\t\t\t@previously_changed = changes\n\t\t\t\t\t\t# Get the first user that is not taken\n\t\t\t\t\t\tflag = client.set_users(dirty_params_hash)\n\t\t\t\t\t\t@changed_attributes.clear if flag\n\t\t\t\t\tend\n\t\t\t\t\tflag\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "f8ff613114f3810ba4ac066195f7b47c", "score": "0.54665804", "text": "def add_to_list\n if (if current_user.typeofuser == \"admin\" then valid_assign(params[:course_id]) else true end)\n obj_user = User.find_by_email(params[:email])\n if obj_user.nil? then\n @user = User.new\n @user.login = params[:login]\n @user.email = params[:email].strip()\n @user.typeofuser = \"learner\"\n @user.user_id = current_user.id\n @user.tenant_id = current_user.tenant_id\n @user.save!\n else\n @learner_already_exists = 0\n end\n else\n if current_user.typeofuser == \"admin\" then\n @learner_limit_exceeds = 1\n end\n end\n end", "title": "" }, { "docid": "bdfb6dc87f28a47f47f8a1a6d0cadc34", "score": "0.54658824", "text": "def save_import\n if params[:commit]==\"Cancel\"\n redirect_to import_department_users_path(@department) and return\n end\n @users=params[:users_to_import].collect{|i| params[:user][i]}\n failures = []\n @users.each do |u|\n if @user = User.where(login: u[:login]).first\n if @user.departments.include? @department #if user is already in this department\n #don't modify any data, as this is probably a mistake\n failures << {user:u, reason: \"User already exists in this department!\"}\n else\n @user.role = u[:role]\n #add user to new department\n @user.departments << @department unless @user.departments.include?(@department)\n @user.save\n end\n else\n @user = User.new(u)\n @user.auth_type = @appconfig.login_options[0] if @appconfig.login_options.size == 1\n @user.set_random_password\n @user.departments << @department unless @user.departments.include?(@department)\n if @user.save\n @user.password_reset_instructions!(Proc.new {|n| UserMailer.delay.new_user_password_instructions_csv(n, current_department)}) if @user.auth_type=='built-in'\n else\n failures << {user:u, reason: \"Check all fields to make sure they\\'re ok\"}\n end\n end\n end\n if failures.empty?\n flash[:notice] = \"All users successfully added.\"\n redirect_to department_users_path(@department)\n else\n @users=failures.collect{|e| User.new(e[:user])}\n flash[:notice] = \"The users below failed for the following reasons:<br />\"\n failures.each{|e| flash[:notice]+=\"#{e[:user][:login]}: #{e[:reason]}<br />\"}\n render action: 'verify_import'\n end\n end", "title": "" }, { "docid": "5b9113f2af642025afc3491c4cfe4055", "score": "0.54657584", "text": "def create\n @duty = Duty.new(params[:duty])\n @duty.assigned_user = current_user\n respond_to do |format|\n if @duty.save\n @duty.user_ids.each do |user_id|\n @user1 = User.find(user_id)\n DutyAssignment.assignment_email(@user1, @duty.assigned_user, @duty).deliver\n end\n format.html { redirect_to @duty, notice: 'Duty was successfully created.' }\n format.json { render json: @duty, status: :created, location: @duty }\n else\n #@duty.user_id = current_user.id\n @assigner_select = User.order('last_name ASC').collect{|s| [(s.first_name + \" \" + s.last_name), s.id]}\n format.html { render action: \"new\" }\n format.json { render json: @duty.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "87cbfd144d165c43b9b00524827ab7da", "score": "0.54652643", "text": "def set_response(request)\n\n message = request.message.body\n # parse user input for ques & ans\n splitted_qa_from_message = message.split(': ')[1]\n splitted_message = splitted_qa_from_message.split(',')\n #split it into ques & ans\n question = splitted_message[0]\n answer = splitted_message[1]\n #save into redis\n #redis.set(\"mykey\", \"hello world\")\n redis_res = redis.set(question, answer)\n #respond back\n if redis_res\n res_message = \"saved to redis\"\n else\n res_message = \"failed to save to redis\"\n end\n request.reply_with_mention(res_message)\n end", "title": "" }, { "docid": "77ea35095bc616e3733aa75e62a64362", "score": "0.5459981", "text": "def handmade_response(sheet_id, question_id, user_id)\n r = Response.new()\n r.survey_sheet_id = sheet_id\n r.question_id = question_id\n r.user_id = user_id\n return r\n end", "title": "" }, { "docid": "9f14024eb2612100bdb055739cc6effe", "score": "0.5456492", "text": "def respond!(accept)\n self.responded = true\n self.accepted = accept\n self.save!\n\n if accept\n availability.sign_up!(student)\n end\n end", "title": "" }, { "docid": "3f6d51c374d2e954d7b9333764dff906", "score": "0.54559696", "text": "def assign_to(user)\n user = User.find(user) unless user.is_a?(User)\n options = {:user => user, :submission => self}\n \n if ['annotation', 'exam'].include?(self.exercise.review_mode) && self.annotatable?\n review = AnnotationAssessment.new(options)\n else\n review = Review.new(options)\n end\n \n review.save\n\n return review\n end", "title": "" }, { "docid": "f15ea45a380b34faaa6aa99fb8985880", "score": "0.5454202", "text": "def create_response\n #Once the response is submitted, depending on whether Score exists,\n # create or update the record\n\n response_params = params[:response]\n if response_params.blank?\n flash[:error] = \"Could not save response. Please try again\"\n redirect_to continue_survey_path and return\n end\n #Create a response if new or update the existing record\n survey_id = response_params[:survey_id]\n question_id = Question.id_by_sequence(params[:question_id])\n @response = Response.find_by_survey_id_and_question_id(survey_id, question_id)\n\n if @response.blank?\n @response = Response.new\n end\n\n if @response.update_attributes(response_params)\n #TODO: Redirect to next page. Issue with sequence.\n #Find if the question is the last of the questions. If it is, then go to close survey, else go\n #go to next question\n next_sequence = Question.next_secuence( params[:question_id] )\n redirect_to questions_path(survey_id, next_sequence ) and return\n\n #redirect_to questions_path(survey_id, question_id) and return\n else\n flash[:error] = \"Error in saving the Response. Please try again.\"\n redirect_to questions_path(survey_id, question_id) and return\n end\nend", "title": "" }, { "docid": "89fb473db9c316cdf35946fc0dfb4b7a", "score": "0.54537517", "text": "def rjs_add_individual_learner\n if (if current_user.typeofuser == \"admin\" then valid_assign(params[:id],current_user) else true end)\n obj_user = User.find_by_email(params[:email])\n if obj_user.nil? then\n @user = User.new\n @user.login = params[:login]\n @user.email = params[:email].strip()\n @user.typeofuser = \"learner\"\n @user.user_id = current_user.id\n @user.tenant_id = current_user.tenant_id\n @user.group_id = params[:group_id]\n @user.save!\n @i = params[:i]\n else\n @learner_already_exists = \"Learner already exists\"\n end\n else\n if current_user.typeofuser == \"admin\" then\n @learner_limit_exceeds = \"You cannot assign more leaners\"\n end\n end\n end", "title": "" }, { "docid": "f0d5bdeda4e65838239864bf91df4224", "score": "0.5453306", "text": "def save(user)\n Rails.logger.debug \"Call to position.save\"\n if self.valid? #Validate if the Position object is valid\n Rails.logger.debug \"The position is valid!\"\n #Create a raw position object\n position_req = { 'name'=>self.name,\n 'description'=> self.description,\n 'electionId'=> self.election_id\n }\n reqUrl = \"/api/position/\" #Set the request url\n rest_response = MwHttpRequest.http_post_request(reqUrl,position_req,user['email'],user['password']) #Make the POST call to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" || rest_response.code == \"201\" || rest_response.code == \"202\" #Validate if the response from the server is satisfactory\n position = Position.rest_to_position(rest_response.body) #Turn the response object to a Position object\n return true, position #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n else\n Rails.logger.debug self.errors.full_messages\n return false, self.errors.full_messages #Return invalid object error\n end\n end", "title": "" }, { "docid": "e78fedbee24aaa95b3eac624270d2776", "score": "0.5444504", "text": "def user_response\n @feedback = Feedback.where(\"id = ? and user_id = ? and user_status = ? and completed = ?\",params[:feed_id],params[:send_id], \"pending\", true).first\n render json: {errors: [\"Feedback not found.\"]}, status: :not_found and return if @feedback.nil?\n @contacted_user = User.where(\"id = ?\", params[\"contacted_user_id\"]).first\n render json: {errors: [\"User not found.\"]}, status: :not_found and return if @contacted_user.nil?\n\n begin\n if params[\"response\"] == \"1\"\n #sending mail with parameters user feedback and the admin user(manager or customer_admin)\n UserMailer.customer_accepted_email_to_share_details(@feedback,@contacted_user,params[:timezone] || \"UTC\").deliver\n status = \"accepted\"\n elsif params[\"response\"] == \"0\"\n status = \"rejected\"\n else\n render json: {errors: [\"Invalid response\"]}, status: :unprocessable_entity and return\n end\n if(@feedback.update_column(\"user_status\", status))\n render json: {response: status }, status: :ok\n else\n render json: {errors: @feedback.errors.full_messages}, status: :unprocessable_entity\n end\n rescue => e\n render json: {errors: e}, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "98120dfe23c71fea1a9a069a5dab2294", "score": "0.5443969", "text": "def inform_decision_response\n\t\t@data[:project_name] = @task.project.title\n\t\t@data[:decision_status] = @user_task.response_status.humanize\n\t\t@data[:decision_owner] = @user_task.user.try(:full_name)\n @data[:recipient_names] = recipient_names\n\t\t@data[:decision_comment] = @user_task.try(:response_message)\n\t\t@data[:decision_title] = @task.title\n\t\t@data[:previous_task_name] = @task.previous_task_title\n\t\t@template_name = APOSTLE_MAIL_TEMPLATE_SLUG[:decision_status_notification]\n\t\ttrigger_user_specific_emails\t\n\tend", "title": "" }, { "docid": "ee2563dd0a6c5bbf84de0009b180a774", "score": "0.54350716", "text": "def store_learner_details(assessment,current_user,user,package_id,type_of_test_taker)\n learner = Learner.new\n learner.assessment_id = assessment.id\n learner.score_min = assessment.pass_score\n learner.user_id = user.id\n learner.admin_id = current_user.id\n learner.tenant_id = assessment.tenant_id\n learner.group_id = user.group_id\n learner.lesson_location = \"0\"\n learner.type_of_test_taker = type_of_test_taker\n qb_list,question_list = create_question_list(assessment)\n # fill suspend data with * initially\n answer_list = Array.new(question_list.split(',').length)\n answer_list.collect! {|x| x = '' }\n learner.suspend_data = answer_list.join('|')\n # fill question status details column with \"\" initially\n question_status_list = Array.new(question_list.split(',').length)\n question_status_list.collect! {|x| x = '' }\n learner.question_status_details = question_status_list.join(',')\n learner.score_max = assessment.no_of_questions * assessment.correct_ans_points\n learner.total_time = ((assessment.duration_hour * 3600)+(assessment.duration_min * 60))\n learner.entry = qb_list\n learner.question_status_details = \"\"\n unless package_id.nil? and package_id.blank?\n learner.package_id = package_id\n end\n learner.save\n @i = 1\n create_test_details_for_user(learner.id,user.id,current_user.tenant_id,question_list,assessment) \n increase_assessment_columns_while_assigning(assessment,learner)\n return learner\n end", "title": "" }, { "docid": "820aed01f11863dadb7286ee793899c9", "score": "0.5434216", "text": "def store_result(result); end", "title": "" }, { "docid": "602d86da1626aace9af117ac568bf431", "score": "0.5433226", "text": "def do_gather_user_tokens\n # Only do this if gather_user_tokens is truthy\n return unless gather_user_tokens == '1'\n tid_emails = lime_survey.lime_tokens.pluck :tid, :email\n return unless tid_emails\n tid_emails = tid_emails - user_assignments.map{|ua|[ua.lime_token_tid, ua.user.email]}\n User.where(:email=>tid_emails.map{|tid, email|email}).each do |user|\n ua = user_assignments.build\n ua.user_id = user.id\n ua.lime_token_tid = tid_emails.find{|tid, email|user.email == email}.first\n ua.save!\n end\n end", "title": "" }, { "docid": "cbfd983d380ff0bdc4dbe3e030e4f028", "score": "0.5422173", "text": "def create\n @assignment = Assignment.new(params[:assignment])\n @assignment.assign_to = params[:users][0].to_i\n @assignment.user_id=current_user.id\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to assignments_path, :notice => 'Assignment was successfully created.' }\n format.json { render :json => @assignment, :status => :created, :location => @assignment }\n else\n format.html { render :action => \"index\" }\n format.json { render :json => @assignment.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e6ad63892b9c9670bf5aad89f9c4a86e", "score": "0.5419043", "text": "def try_to_assign_user\n # Step 1: Try to see if there was a previous donation from the same email/bank reference\n if @donation.donor_id.blank?\n donation = search_for_similar_assigned_donation\n @donation.donor_id = donation.donor_id if donation\n end\n\n # Step 2: If that didn't work and we have a bank reference, check if there's a user with a paymentid field that matches\n if @donation.donor_id.blank? && [email protected]_reference.blank?\n # Step 2.1: Divide the bank reference into words and search for them independently. For example \"12345 John Smith\" >> ['12345', 'John', 'Smith']\n search_string = @donation.bank_reference.split(\" \").map{|string| \"paymentid LIKE '%#{Mysql2::Client.escape(string)}%'\"}.join(\" OR \")\n users = Donor.where(search_string)\n # Step 2.2: Only accept as valid those users whose complete bank reference matches. For example, accept \"John Smith\" or \"12345 John\". But not \"John Johansen\".\n users.select!{|u| @donation.bank_reference.include?(u.paymentid)}\n if users.size == 1\n @donation.donor_id = users.first.id\n elsif users.size > 1\n return :multiple_users_found\n end\n end\n\n # Step 3: If that didn't work and we have en email, try to find an existing user via email\n if @donation.donor_id.blank? && [email protected]?\n user = Donor.find_by_any_email(@donation.email).first\n if user\n @donation.donor_id = user.id\n end\n end\n\n # Step 4: If we have not had luck yet, create a new user\n if @donation.donor_id.blank? && [email protected]?\n user = Donor.new(user_email: @donation.email, first_name: @first_name, last_name: @last_name)\n user.role = \"single_supporter\"\n user.save\n @donation.donor_id = user.id\n end\n\n # Step 5: store a boolean value to facilitate searching\n if @donation.donor_id.blank?\n @donation.user_assigned = false\n return :no_user_found\n else\n @donation.user_assigned = true\n @donation.save\n return :user_assigned\n end\n end", "title": "" }, { "docid": "b4cb0addcfe80308ace381db0dcd36d7", "score": "0.54157084", "text": "def save(user)\n Rails.logger.debug \"Call to ticket.save\"\n if self.valid? #Validate if the Ticket object is valid\n Rails.logger.debug \"The ticket is valid!\"\n #Create a raw ticket object\n ticket_req = { 'name'=>self.name,\n 'logo'=> self.acronym,\n 'photos' => [],\n 'information'=> self.information,\n 'colour' => self.color,\n 'candidateNames' => [],\n 'electionId'=> self.election_id,\n 'numberOfSupporters' =>self.number_of_supporters\n }\n reqUrl = \"/api/ticket/\" #Set the request url\n rest_response = MwHttpRequest.http_post_request(reqUrl,ticket_req,user['email'],user['password']) #Make the POST call to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" || rest_response.code == \"201\" || rest_response.code == \"202\" #Validate if the response from the server is satisfactory\n ticket = Ticket.rest_to_ticket(rest_response.body) #Turn the response object to a Ticket object\n return true, ticket #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n else\n Rails.logger.debug self.errors.full_messages\n return false, self.errors.full_messages #Return invalid object error\n end\n end", "title": "" }, { "docid": "3675f62084c334df2f25d1d3070f51b7", "score": "0.5413465", "text": "def save_user_answer(id,user)\n\t\t# filename=user_answer_filename(id,user)\n\t\t# File.open(filename,\"w\") do |f|\n\t\t# \tf << @answers[id][user].inspect\n\t\t# end\n\t\tok=false\n\t\tif mongoid? :QuestionForm\n\t\t\tif (question_form=Session.mngr.question_form?)\n\t\t\t\tif (current_user_answers=question_form.user_answers.select {|e| e.login ==user}.last)\n\t\t\t\t\t @answers[id][user]=(current_user_answers.question_answers).merge(@answers[id][user])\n\t\t\t\t\tcurrent_user_answers.update_attributes({question_answers: @answers[id][user]})\n\t\t\t\telse\n\t\t\t\t\tquestion_form.user_answers.create({login: user,question_answers: @answers[id][user]})\n\t\t\t\tend\n\t\t\t\tok=true\n\t\t\tend\n\t\tend\n\t\treturn ok\n\tend", "title": "" }, { "docid": "ec537d5ebfab4b967885feeeccf90a10", "score": "0.5393166", "text": "def await\n self.access = :pending\n self.save\n end", "title": "" }, { "docid": "905806f5a959de0da7494841923b5c72", "score": "0.53924406", "text": "def task_approver_response\n\t\tget_task_details\n\t\t@template_name = APOSTLE_MAIL_TEMPLATE_SLUG[:task_reviewed]\n\t\t@data[:task_response] = @user_task.response_status.humanize\n\t\t@data[:task_comment] = @user_task.response_message\n\t\ttrigger_user_specific_emails\n\tend", "title": "" }, { "docid": "9fb0ce51a3aeb4f65389d143c3c77be8", "score": "0.53910226", "text": "def save\r\n if @setter\r\n @setter.submit\r\n else\r\n raise NotSavableError, \"This record cannot be saved (Probably because it does not support Mod Requests).\"\r\n end\r\n end", "title": "" }, { "docid": "248431fe5505bf312832a720403e8c36", "score": "0.538909", "text": "def save(results)\n @results = results\n end", "title": "" }, { "docid": "380586d242991fc6f81bc0a32a7e2356", "score": "0.53888804", "text": "def president_assign()\n\t# If Maki did not save target, remove target from game\n\tif $current_president.assign_target.nil?\n\t\n\t\tmessage = $president_name + ' assigned homework to nobody!'\n\t\t\n\telse\n\t\n\t\tif !$current_maki.nil?\n\t\t\n\t\t\tif $current_president.assign_target == $current_maki.help_target\n\t\t\t\tmessage = $president_name + ' assigned homework to **' + $mafia_players_ordered[$current_president.assign_target - 1].name + '**, but Maki was there to help!'\n\t\t\telse\n\t\t\t\tremove_player($current_president.assign_target - 1)\n\t\t\t\tmessage = $president_name + ' assigned homework to ' + $mafia_players_ordered[$current_president.assign_target - 1].name + \"**. They will work on it for the rest of the game!\\nMaki was too busy helping \" + $mafia_players_ordered[$current_maki.help_target - 1].name + '** tonight!'\n\t\t\tend\n\t\t\t\n\t\telse\n\t\t\tmessage = $president_name + ' assigned homework to **' + $mafia_players_ordered[$current_president.assign_target - 1].name + '**. They will work on it for the rest of the game!'\n\t\t\tremove_player($current_president.assign_target - 1)\n\t\tend\n\t\t\n\tend\n\t\n\treturn message\n\t\nend", "title": "" }, { "docid": "2cc180b132269ae181b02b63e6b7eb2a", "score": "0.538865", "text": "def assign\n assignment_id = params[:id]\n reviewers = ReviewBid.assignment_reviewers(assignment_id)\n topics = SignUpTopic.where(assignment_id: assignment_id).ids\n bidding_data = ReviewBid.assignment_bidding_data(assignment_id,reviewers)\n matched_topics = reviewer_topic_matching(bidding_data,topics,assignment_id)\n ReviewBid.assign_matched_topics(assignment_id,reviewers,matched_topics)\n redirect_to :back\n end", "title": "" }, { "docid": "2b236f843a2278cfd274f292e17b068b", "score": "0.53876483", "text": "def post_execute\n save({'answer' => @datastore['answer']})\n end", "title": "" }, { "docid": "2b236f843a2278cfd274f292e17b068b", "score": "0.53876483", "text": "def post_execute\n save({'answer' => @datastore['answer']})\n end", "title": "" }, { "docid": "2b236f843a2278cfd274f292e17b068b", "score": "0.53876483", "text": "def post_execute\n save({'answer' => @datastore['answer']})\n end", "title": "" }, { "docid": "2b236f843a2278cfd274f292e17b068b", "score": "0.53876483", "text": "def post_execute\n save({'answer' => @datastore['answer']})\n end", "title": "" }, { "docid": "8f64c29fb4c00ed5e451f0a653a6dbf1", "score": "0.5384303", "text": "def create\n\n # get parameters\n email = params[:reviewer_assignment][:email]\n submission_id = params[:reviewer_assignment][:submission_id]\n # attempt to find user by email\n user = User.find_by email: email\n if user == nil\n respond_to do |format|\n format.html { redirect_to Submission.find(submission_id), alert: \"User not found!\"}\n format.json { head :ok }\n end\n return\n end\n\n # remove invalid email param\n params[:reviewer_assignment].delete :email\n\n # create new ARA\n @reviewer_assignment = ReviewerAssignment.new(reviewer_assignment_params)\n # set newly found user id \n @reviewer_assignment.user_id = user.id\n\n respond_to do |format|\n if @reviewer_assignment.save\n format.html { redirect_to Submission.find(submission_id), notice: 'Reviewer was successfully assigned.' }\n else\n format.html { render :new }\n format.json { render json: @reviewer_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f04dd253d1ea11e100baa39ca9fa9071", "score": "0.5381427", "text": "def assign_user\n item = Item.find(params[:id])\n @event = item.event\n\n item.user_id = params[:user_id]\n if item.save\n\n # write to history\n hist = History.new(:item_id => item.id, :user_id => item.user_id)\n hist.assign_item(item.name, item.user.name)\n @event.histories << hist\n\n respond_to do |format|\n format.html {\n flash[:notice] = t(:items_assign_usr_succ)\n redirect_to(:controller => :events, :action => :show, :id => @event.key) }\n format.js {\n render :text => 'true' }\n end\n\n else\n respond_to do |format|\n format.html {\n flash[:error] = t(:items_assign_usr_err1)\n render(:controller => :events, :action => :show, :id => @event.key) }\n format.js {\n render :text => 'false' }\n end\n end\n end", "title": "" }, { "docid": "99c20791c96f989f80232fbdee336398", "score": "0.53808916", "text": "def assign\n navigate\n on Permissions do |add|\n # See the roles method defined below...\n roles.each do |inst_var, role|\n get(inst_var).each do |username|\n unless add.user_row(username).present? && add.assigned_role(username).include?(role)\n add.user_name.set username\n add.role.select role\n add.add\n add.user_row(username).wait_until_present\n end\n end\n end\n add.save\n # TODO: Add some logic here to use in case the user is already added to the list (so use add_roles)\n end\n end", "title": "" } ]
27358a79d80a90cd4721e110aacdc23b
Returns answers that haven't been put into the game yet
[ { "docid": "980c562c39d97995af980e7b3552c8b4", "score": "0.7179262", "text": "def available_answers\n answers - answers_in_game\n end", "title": "" } ]
[ { "docid": "4da21a82a490c4890aa1288963d866fc", "score": "0.7100722", "text": "def missing_answers\n @missing_answers ||= visible_questionings.select{ |qing| qing.required? && answer_for_qing(qing).nil? }\n end", "title": "" }, { "docid": "38240117d5cac36b272ae5a69f2f67e0", "score": "0.68376887", "text": "def unanswered_nc_questions\n self.nc_questions.where(\"target_date <= ?\" , DateTime.now).select{ |x| x.answers.blank?}\n end", "title": "" }, { "docid": "d8a1351d51454ecc15b973f99346e66d", "score": "0.6784871", "text": "def ungraded_answers(submission)\n submission.answers.select(&:submitted?)\n end", "title": "" }, { "docid": "a4dda47873675cf16343ac89d7751302", "score": "0.67699", "text": "def unanswered_questionnaires\n (Questionnaire.by_language_published(I18n.default_locale).all - answered_questionnaires) rescue []\n end", "title": "" }, { "docid": "94068b958e739a1bc44d4baeda71ac44", "score": "0.6614069", "text": "def played?\n !self.answers.empty?\n end", "title": "" }, { "docid": "8cd81de487f595117349a1e04ab6d32e", "score": "0.6570919", "text": "def answers\n all_answers.map(&:to_answer).uniq\n end", "title": "" }, { "docid": "fddb66122fc1557e7c545932b5f47772", "score": "0.6550954", "text": "def missing_answers\n unique_code_data = self.dataset.data_items.unique_code_data(self.code)\n unique_values = self.answers.unique_values\n if unique_code_data.present?\n return (unique_code_data - unique_values).delete_if{|x| x.nil?}\n else\n return nil\n end\n end", "title": "" }, { "docid": "49b8c6d91e49c6914f51165668775220", "score": "0.6545566", "text": "def unlocked_quests; quests.select{|quest| quest.unlocked?}; end", "title": "" }, { "docid": "5cd51732cbd4cc913965fcae36ff9668", "score": "0.6500813", "text": "def all_correct?\n @failed_winners.empty?\n end", "title": "" }, { "docid": "6002ef149e868fcc0af0ee8b5f609970", "score": "0.6420731", "text": "def has_answer?\n not answer.empty?\n end", "title": "" }, { "docid": "ee85377e72ecf8c260d00110cbb33f46", "score": "0.63882154", "text": "def allAnswered(results)\n done = true\n results.each do |result|\n done = false if result == false\n end\n return done\n end", "title": "" }, { "docid": "a8b89a4645d7fb45f017c018baccc0c5", "score": "0.6378689", "text": "def correct_questions\n self.winning_games.map do |game|\n game.question\n end\n end", "title": "" }, { "docid": "808e288cdeece18ff376a92edec5020b", "score": "0.6373643", "text": "def available_questions\n questions - questions_in_game\n end", "title": "" }, { "docid": "b2bff39b9254f282b8d03b55c2b0946f", "score": "0.63210297", "text": "def no_reportable_questions?\n !self.questions.any?(&:adequate_responses?) \n end", "title": "" }, { "docid": "f8ef2b4c2d7988c6cb5b5dea69936fe2", "score": "0.63044566", "text": "def questions_in_game\n rounds.collect(&:question)\n end", "title": "" }, { "docid": "4e9e73da7449aff42f1ad990ba6f9a5a", "score": "0.6297855", "text": "def get_unplayed_games()\n return Game.where(\"winner is ?\", nil).order(:created_at)\n end", "title": "" }, { "docid": "134cc37a11e87d754edfb2c2be414f4d", "score": "0.6283514", "text": "def blank?\n answers.all?(&:blank?)\n end", "title": "" }, { "docid": "6b38fb030dc95774eee2918d1523e2d9", "score": "0.6264456", "text": "def uncompleted_polls\n res = Poll.find_by_sql([<<-SQL, id])\n SELECT polls.*\n FROM polls\n JOIN questions ON questions.poll_id = polls.id\n JOIN answer_choices ON answer_choices.question_id = questions.id\n LEFT OUTER JOIN (\n SELECT *\n FROM responses\n WHERE responses.user_id = ?\n ) AS responses ON responses.answer_choice_id = answer_choices.id\n GROUP BY polls.id\n HAVING COUNT(DISTINCT questions.id) != COUNT(responses.id)\n SQL\n res.pluck(:title)\n end", "title": "" }, { "docid": "3897f9ab6a8d0e1eac99fc0fe0243426", "score": "0.62302923", "text": "def answers_in_game\n players.collect(&:player_cards).flatten.map(&:answer)\n end", "title": "" }, { "docid": "e6dd8b92df84742e2b326a1ea02a0203", "score": "0.6225989", "text": "def not_correctly_answered(submission)\n where.not(id: submission.answers.where(correct: true).select(:question_id))\n end", "title": "" }, { "docid": "b136c98c23c287240e5e62c24fcbb174", "score": "0.62258196", "text": "def not_answered(submission)\n where.not(id: submission.answers.select(:question_id))\n end", "title": "" }, { "docid": "f126d69afd58b21f1fda2aff2466a73d", "score": "0.619281", "text": "def unanswered_questions(user)\n return related_questions_except(user)\n end", "title": "" }, { "docid": "aa15a594ad332b1d32251f1a6e6d58c7", "score": "0.61604106", "text": "def has_answers?\n answer_count > 0\n end", "title": "" }, { "docid": "22a6c7af3e2b6e7f6e78dba39bc4f934", "score": "0.6157043", "text": "def empty?\n self.to_a.all? {|v| !@game_parms.valid_played_sym.include?(v)}\n end", "title": "" }, { "docid": "bac341eaab714b2c7683c890996556cb", "score": "0.6152192", "text": "def surveys_not_taken\n Survey.all - surveys_taken_by_user\n end", "title": "" }, { "docid": "bac341eaab714b2c7683c890996556cb", "score": "0.6152192", "text": "def surveys_not_taken\n Survey.all - surveys_taken_by_user\n end", "title": "" }, { "docid": "4bbbeb16057ef98ce5d780b60f3e27c9", "score": "0.61469954", "text": "def answers\n pseudo_graph_pattern.all_answers.map(&:to_answer).uniq\n end", "title": "" }, { "docid": "70d96c9417b9c5bafedc1f9a782e7dc1", "score": "0.6134433", "text": "def player_non_submitted_poems\n self.non_submitted_poems.select do |poem|\n Round.find(poem.round_id).creator_id != self.id\n end\n end", "title": "" }, { "docid": "537f3018db4887e6f7f225845a9e2b5b", "score": "0.61260724", "text": "def puzzles_available\n available = puzzles.select do |puzzle|\n puzzle.available == true\n end\n end", "title": "" }, { "docid": "5fbc4b8e0bd3c6bad849390b65593460", "score": "0.61252254", "text": "def not_researched!\n @card_conditions << \"answers.id is null\"\n end", "title": "" }, { "docid": "ac3b8aaacad0ee1ae2f0d1ad422d83d2", "score": "0.6118858", "text": "def get_non_pruned\n @qq.select { |q| !pruned?(q) }\n end", "title": "" }, { "docid": "4d42b9442440e8dc38f7d497c705c6e1", "score": "0.6104423", "text": "def players_not_done\n load_variables\n # player_moves\n all_bets_this_round = []\n @player.each do |player|\n all_bets_this_round.push(player.latest_bet_this_round.to_i)\n end\n \n players_not_done = []\n @player.each do |player|\n if player.folded == false && (player.latest_bet_this_round.to_i < all_bets_this_round.max || player.latest_bet_this_round == nil)\n players_not_done.push(player.player_number)\n end\n end\n \n players_not_done\n end", "title": "" }, { "docid": "6c994e5e9bbba9f719c5b72e8bd28ffc", "score": "0.6104414", "text": "def guess(playboard)\n guess_made = playboard.board[ (playboard.guesses_made - 1) ][:guess]\n answer_hash = playboard.board[ (playboard.guesses_made - 1) ]\n answer_hash.delete(:guess)\n @solutions.delete_if do |possible_solution|\n possible_solution unless test_result(guess_made, possible_solution) == answer_hash\n end\n puts \"here are the solutions\"\n puts @solutions\n return @solutions.sample\n end", "title": "" }, { "docid": "80c179c59271521f2bc31edcba1e9a6d", "score": "0.6080243", "text": "def losing_players\n players.select { |player| player.hit_points <= 0 }\n end", "title": "" }, { "docid": "7ec7a3e249d82681252e4346cf270286", "score": "0.60687166", "text": "def answer\n\t uncorrect\n\t choices.select {|c| c.correct}[0]\n end", "title": "" }, { "docid": "11621155e630c137d23cff54824a2358", "score": "0.6066763", "text": "def check_for_non_profile_questions\n sample_opportunity = Opportunity.find(@sample_opportunity_id)\n profile = Opportunity::Profile.current\n @extra_question_ids = sample_opportunity.questions.map(&:form_field_id) - profile.questions.map(&:form_field_id)\n\n automatch_missing_questions = []\n Opportunity::Automatch.not_archived.find_each do |opportunity|\n extra_question_ids.each do |question_id|\n if opportunity.questions.where(form_field_id: question_id).blank?\n automatch_missing_questions << opportunity.id\n end\n end\n end\n # automatch_missing_questions.count\n\n apply_missing_questions = []\n Opportunity::Apply.not_archived.find_each do |opportunity|\n extra_question_ids.each do |question_id|\n if opportunity.questions.where(form_field_id: question_id).blank?\n apply_missing_questions << opportunity.id\n end\n end\n end\n # apply_missing_questions.count\n puts \"Extra Questions Count: #{@extra_question_ids.count}\"\n puts \"Missing Auto-Match Questions: #{automatch_missing_questions.count}\"\n puts \"Missing Apply-To Questions: #{apply_missing_questions.count}\"\n end", "title": "" }, { "docid": "fa1cdd97602913afaabb19fc9fc46f25", "score": "0.60610193", "text": "def incomplete_tests\n return self.product_tests.select do |test|\n test.reported_results.nil?\n end\n end", "title": "" }, { "docid": "090dbef2ce2513d011d710eddaf6002f", "score": "0.60591555", "text": "def quiz\n med_box = cards.where(priority: 1)\n low_box = cards.where(priority: 0)\n high_box = cards.where(priority: 2)\n boxes = [ low_box, med_box, high_box ]\n\n box = boxes.find { |b| b.size != 0 } \n\n box\n end", "title": "" }, { "docid": "f0c65ba7709cd3ff2afb3edc13beb724", "score": "0.6047767", "text": "def answers_available?\n self.game.answers_available\n end", "title": "" }, { "docid": "f0c65ba7709cd3ff2afb3edc13beb724", "score": "0.6047767", "text": "def answers_available?\n self.game.answers_available\n end", "title": "" }, { "docid": "8f687ef90796bba95cfcb523f1f98bf4", "score": "0.60409474", "text": "def active_quests\n quests.select{|quest| quest.unlocked? && !quest.completed?}\n end", "title": "" }, { "docid": "a0157840fb8907e70c3fcb63b7c5e131", "score": "0.6040249", "text": "def questions_with_no_text\n self.questions.select{|x| x.text_translations[self.default_language] == nil}\n end", "title": "" }, { "docid": "4f45e413faeb49f0406ac64a8eb8bed2", "score": "0.60295105", "text": "def tie_game\n @acceptable_choices[0].empty? &&\n @acceptable_choices[1].empty? &&\n @acceptable_choices[2].empty?\n end", "title": "" }, { "docid": "54f38f1a0274b7dbdf3bd2a9d5a954b2", "score": "0.6028649", "text": "def has_quests?\r\n quest_count > 0\r\n end", "title": "" }, { "docid": "071ba8ee49838f80049b636ed875fbcd", "score": "0.60223114", "text": "def canAnswer(guessPlayerI,guessG)\n \n returnMe = nil\n @answerArray = Array.new #new array filled with answers to disprove opponents guess\n \n n = @MyCards.length\n n.times{ |i|\n if @MyCards[i] == guessG.weapon || #checks to see if match\n @MyCards[i] == guessG.person ||\n @MyCards[i] == guessG.place\n @answerArray << @MyCards[i]\n end\n }\n if @answerArray == nil\n puts(\"Player #{@indexCurr} cannot answer\")\n else if @answerArray.length >= 1\n returnMe = @answerArray[0] #always returns first answer found\n end\n end\n\n returnMe\n \n end", "title": "" }, { "docid": "55841ea5e5eea4fd3bafe13c2a8383f2", "score": "0.60115516", "text": "def completed_quests; quests.select{|quest| quest.completed?}; end", "title": "" }, { "docid": "d81507f7232133752eee9f024f60b9c2", "score": "0.5996278", "text": "def winner_not_set\n select { |g| g.winner.nil? }\n end", "title": "" }, { "docid": "7aab048e1d7554fb0ebb8a094a2cab54", "score": "0.5995052", "text": "def get_valid_answers_for_response(response)\n answers = Answer.where(response_id: response.id)\n valid_answer = answers.select { |answer| (answer.question.type == 'Criterion') && !answer.answer.nil? }\n valid_answer.empty? ? nil : valid_answer\n end", "title": "" }, { "docid": "5973829e024ad2418bdcd04ce2e7f553", "score": "0.5984888", "text": "def not_completed\n stories.reject(&:completed?)\n end", "title": "" }, { "docid": "0897f13923a702b6005b3bb44c724f4c", "score": "0.59796894", "text": "def lost?\n incorrect_guesses.size > LIVES\n end", "title": "" }, { "docid": "6f5ddd38e2b5be82de13027f8dc2e6de", "score": "0.5976411", "text": "def check_if_unanswered\n\t\t@new_question_ids.each do |id|\n\t\t\tif only_one_participant?(@discourse_client.topic(id)) || question_unresolved?(@discourse_client.topic(id))\n\t\t\t\t@question_ids_to_post_in_asana << id\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "ece87027089c6f06dc22a54bfab07ba0", "score": "0.59722924", "text": "def hadNoHands\n \[email protected]?\n end", "title": "" }, { "docid": "8f17d5d9a6d3414db09dd35ec309e392", "score": "0.5946829", "text": "def eligible_players\n\t\t\treturn @players.select {|player| !player.has_lost}\n\t\tend", "title": "" }, { "docid": "4e658ca1fc380169dfcceb572f7a4a94", "score": "0.59388316", "text": "def not_correctly_answered(submission)\n where.not(id: correctly_answered_question_ids(submission))\n end", "title": "" }, { "docid": "bb195b8df917c8b7eb33188da4b742d2", "score": "0.59350044", "text": "def get_attempted_answers\n Answer.where(\"student_id = ? and served_quiz_id = ?\",self.user_id, self.served_quiz_id)\n end", "title": "" }, { "docid": "0ab994d5fa0b42e5ddca06a719916c17", "score": "0.59307885", "text": "def canAnswer(guessPlayerI,guessG)\n print(\"Player #{guessPlayerI} asked you about Suggestion: #{guessG.person.value} in the #{guessG.place.value} with the #{guessG.weapon.value}\")\n returnMe = nil\n @answerArray = Array.new(0) #will contain an answer if there is one or many\n n = @MyCards.length\n n.times{ |i|\n if @MyCards[i].value == guessG.weapon.value ||\n @MyCards[i].value == guessG.person.value ||\n @MyCards[i].value == guessG.place.value\n @answerArray << @MyCards[i]\n end\n }\n if @answerArray.length == 0\n puts(\", but you couldn't answer\")\n else if @answerArray.length > 1\n puts(\". Which do you show?\")\n n = @answerArray.length\n n.times{ |i|\n puts(\"#{i}: #{@answerArray[i].value}\")\n }\n puts(\"Which do you pick?\")\n while returnMe == nil\n check = gets\n if(!check.match(/^(\\d)+$/)) #this checks if user typed in a number\n puts(\"invalid answer! pick again\")\n else\n n = check.to_i #only converts to integer after it knows number was typed\n if n > @answerArray.length-1\n puts(\"invalid number! pick again\")\n else\n returnMe = @answerArray[n] #simply returns the answer user picked\n puts(\"#{@answerArray[n].value}, you showed it\")\n end\n\n end\n end\n else\n puts(\", you only have one card, #{@answerArray[0].value} showed it to them\")\n returnMe = @answerArray[0] #only have one answer does not give user option because there is none\n\n end\n end\n\n returnMe\n end", "title": "" }, { "docid": "3179413893d3e6a461dec95cd209c41f", "score": "0.5929296", "text": "def no_responses\n if self.id\n #this will be a problem if two people are editing the survey at the same time and do a survey preview - highly unlikely though.\n self.response_sets.where('test_data = ?',true).each {|r| r.destroy}\n end\n if !template && response_sets.count>0\n errors.add(:base,\"Reponses have already been collected for this survey, therefore it cannot be modified. Please create a new survey instead.\")\n return false\n end\n end", "title": "" }, { "docid": "c53f3427564f78f1e4ac8969f1869e6f", "score": "0.5919146", "text": "def valid_questions\n questions.select { |question| question.valid_for_quiz?(self.id) }.uniq\n end", "title": "" }, { "docid": "8141aefa1094294246a78761bbed321e", "score": "0.59144086", "text": "def without_answers \n if session[:topic_filter] == \"On\" and session[:user_id]\n @questions = User.find(session[:user_id]).topics.map { |t| t.questions.approved.with_no_answer.recent }.flatten.uniq\n else\n #else display all\n @questions = Question.approved.with_no_answer.recent\n end\n render(:action => \"index\")\n end", "title": "" }, { "docid": "3d1f1cfb795679635503120ed022ace9", "score": "0.59111387", "text": "def reportable_questions\n self.questions.find_all{|q| q.adequate_responses?}\n end", "title": "" }, { "docid": "7605d24a34409a510a85768cf4043837", "score": "0.590339", "text": "def with_no_code_answers\n where(:has_code_answers => false).to_a\n end", "title": "" }, { "docid": "904ff18783e69e17031b64ba62180060", "score": "0.5901447", "text": "def unanswered\n return add_params(UNANSWERED)\n end", "title": "" }, { "docid": "3f6fa78e7df05302eeaa2f92b16b5ae7", "score": "0.5900602", "text": "def score (answers)\n []\n end", "title": "" }, { "docid": "7d373d35081b7a0f060db8507b6a4426", "score": "0.5898293", "text": "def handle_no_set\n \twhile find_set.empty? && !@is_end\n \t\tif @top_card<81\n \t\t\tadd3\n \t\t\tputs \"\\nNo sets on hand, add three cards\"\n \t\telse\n \t\t\tputs \"No sets on hand, no cards in deck, game is cleared\"\n \t\t\tputs \"=============Game Over=============\\n\\n\"\n \t\t\t@is_end=true\n \t\t\t@end_time=Time.now()\n \t\t\tshow_stat\n \t\t\tsave_game_result\n \t\tend\n \tend\n end", "title": "" }, { "docid": "db5cb108020e6009f43b5b8ed67bab97", "score": "0.5895119", "text": "def penalty_correct_answers\n @penalty_correct_answers ||= penalty_answers.select{|uq| uq.correct? }\n end", "title": "" }, { "docid": "633b28042bf69c3b5d2b49fedd4c53c7", "score": "0.58944947", "text": "def validate_no_results\n for s in standings(true)\n for race in s.races(true)\n if !race.results(true).empty?\n errors.add('results', 'Cannot destroy event with results')\n return false \n end\n end\n end\n true\n end", "title": "" }, { "docid": "2d59f911f0323602fe697bbc47d74a83", "score": "0.58832574", "text": "def answers\n @answers ||= generate_answers\n end", "title": "" }, { "docid": "2d59f911f0323602fe697bbc47d74a83", "score": "0.58832574", "text": "def answers\n @answers ||= generate_answers\n end", "title": "" }, { "docid": "d533280d62d64db0ce00b7b7491b949f", "score": "0.5882175", "text": "def first_answer_suspicious\n self.game.more_suspect_answer_is(:answer1)\n end", "title": "" }, { "docid": "1a2e26fc259f75b31b2c741d61db115a", "score": "0.58811504", "text": "def rounds_with_non_submitted_poem\n self.all_active_rounds.select do |round|\n !self.poems.find_by(:round_id => round.id).submitted?\n end\n end", "title": "" }, { "docid": "3a6d02456e4b276db2da816f1c883934", "score": "0.5873779", "text": "def answers\n @answers ||= {}\n end", "title": "" }, { "docid": "0fa3f613036819bb0b96fa9dfa40c14a", "score": "0.5861733", "text": "def not_taken\n yetto = self.user_quizzes.select {|user_quiz| user_quiz.status == \"Completed\" || \"In Progress\"}\n #yetto_ids = yetto.map { |x| x.user_id}\n #yetto_users = yetto_ids.map { |x| User.find(x)} \n \n #User.find_by_organization_id(@current_org.id).all - yetto_users\n\n end", "title": "" }, { "docid": "107c912c7bc3fc91d495a7ca5a913215", "score": "0.5857728", "text": "def play\n gameOver = false #controls the while loop\n curr = 0\n \n @playersInGame = @playerArray.dup #need seperate array of players still in game because once player is removed can still give answers\n \n while(!gameOver)\n puts(\"Current turn: #{curr}\")\n if(@playerArray.length == 1) #edge case if human typed play against zero players\n puts(\"you tried playing a game with only one person. Shame on you!\")\n break\n end\n\n currGuess = @playersInGame[curr].getGuess #gets the current guess from the player whose turn it is\n\n if currGuess.isAccusation() #checks if accusation\n puts(\"Player #{curr}: Accusation: #{currGuess.person.value} in #{currGuess.place.value} with the #{currGuess.weapon.value}\")\n if(currGuess.person.value == @answerArray[0].value &&\n currGuess.place.value == @answerArray[1].value &&\n currGuess.weapon.value == @answerArray[2].value) #alll three must be right to win\n\n puts(\"Player #{curr} won the game!!\")\n gameOver = true\n else\n @playersInGame.delete_at(curr) #remove player from game\n puts(\"Player #{curr} made a bad accusation and was removed from the game.\")\n\n if @playersInGame.length == 1 #removed one too many players\n puts(\"Game is over! Only One player remaining.\")\n gameOver = true\n end\n end\n \n else #only makes it here if its a suggestion\n puts(\"Player #{curr}: Suggestion: #{currGuess.person.value} in #{currGuess.place.value} with the #{currGuess.weapon.value}\")\n \n #rest is needed to go through all other players and check if they can give an answer\n #note that its mod of the player array NOT playersInGame array because even though player removed from game can still answer\n guessCurr = (curr + 1) % @playerArray.length \n answer = nil\n while(guessCurr != curr && answer.nil?) #continues on until answer found or back to player whos turn it is\n puts(\"Asking player #{guessCurr}.\")\n answer = @playerArray[guessCurr].canAnswer(curr,currGuess)\n if answer.nil?\n guessCurr = (guessCurr + 1) % @playerArray.length #mod player array because even when removed from game can still make guesses\n end\n end\n\n if !answer.nil?\n puts(\"Player #{guessCurr} answered.\")\n @playersInGame[curr].receiveInfo(guessCurr,answer)\n else\n puts(\"No one could answer.\")\n @playersInGame[curr].receiveInfo(-1,nil)\n end\n end\n curr = (curr + 1) % @playersInGame.length #mod playersIngame because only have to go through the remaining players\n end\n\n end", "title": "" }, { "docid": "69f03f48b874573e12b13660237adf86", "score": "0.58551705", "text": "def incorrect_guesses\n guesses.select(&:valid?)\n .reject { |guess| is_correct_guess?(guess) }\n .collect(&:attempt)\n end", "title": "" }, { "docid": "322db0be6de5bbfdb24c0f55f6d0856e", "score": "0.5843237", "text": "def prune_unreached_questions(qo_to_ignore)\n qo = select{|o| o.index_in_round > o.round.max_qo_index} - qo_to_ignore\n if qo.length > 0\n puts \"Destroying #{ qo.length } QuestionOccurrence records that were never reached in their round\"\n qo.each{|o| o.destroy}\n end\n end", "title": "" }, { "docid": "3b052af6b952e480ce834d1c68e9786e", "score": "0.58424026", "text": "def missing_answers_for_group(grouping)\n cop_answers.not_covered_by_group(grouping)\n end", "title": "" }, { "docid": "19111d8b7e9d9f8d4f55c65264d26e17", "score": "0.58412546", "text": "def not_answered (lo_id)\n get_not_visited_los.map(&:id).include?(lo_id)\n end", "title": "" }, { "docid": "e34fbc3a6e6cdcb793384d5a3c1daa0f", "score": "0.5833807", "text": "def gen_wrong_answers(correct)\r\n \r\n wrong = []\r\n for i in 0..2\r\n flag = 1\r\n wr = 0\r\n while flag == 1\r\n wr = rand(correct-5..correct+5)\r\n if wr > 0 && wr != correct && !wrong.include?(wr)\r\n flag = 0\r\n end\r\n end\r\n wrong.push(wr)\r\n end\r\n\r\n return wrong\r\nend", "title": "" }, { "docid": "9b21527baa75e3a174501de99cc3e899", "score": "0.582433", "text": "def still_to_play\n return self.game_players.where.not(\n id: self.current_hand.hand_players.where.not(bid: nil).select(:game_player_id)\n )\n end", "title": "" }, { "docid": "c04af0e377490e33ebc2ceec6422c0fa", "score": "0.58195716", "text": "def surveys_user_has_not_taken\n @pub_surveys = Survey.select('id').where(status: 'published')\n @pub_survey_ids = Array.new\n\n @pub_surveys.each do |u|\n @pub_survey_ids.push (u.id)\n end\n \n @user_taken_surveys = UserSurvey.where(user_id: current_login)\n @user_taken_survey_ids = Array.new\n\n @user_taken_surveys.each do |u|\n @user_taken_survey_ids.push (u.survey_id)\n end\n\n @untaken_pub_surveys_ids = Array.new\n\n @pub_survey_ids.each do |u|\n if @user_taken_survey_ids.index(u)\n puts \"it exists\"\n else\n @untaken_pub_surveys_ids.push (u)\n end\n end\n\n @untaken_pub_surveys = Survey.where(\"id IN (?)\", @untaken_pub_surveys_ids)\n end", "title": "" }, { "docid": "2d21a2fe26e6f9c0b1d95a63c62faf35", "score": "0.5816906", "text": "def unanswered_artifacts\n self.artifact_answers.where(\"audit_compliances.is_answered=false\")\n end", "title": "" }, { "docid": "2301481bbc3aeddcdbf874f2090d277d", "score": "0.58134353", "text": "def losing_players\n @players.select { |player| player.hp <= 0 }\n end", "title": "" }, { "docid": "8c428aaf34e11235f7ab8575e1e6c714", "score": "0.5800057", "text": "def lost?\n self.incorrect_guesses.size >= @guess_limit\n end", "title": "" }, { "docid": "429715c6f13ce7124832201abc318e40", "score": "0.5789391", "text": "def find_a_set\n puts ''\n cards = pick_a_set\n if a_set? cards\n @board.reject! { |c| cards.include?(c) }\n three_more unless @draw_pile.length.zero?\n up_score\n else\n try_again\n end\n end", "title": "" }, { "docid": "fc8bd2a4357a868a770ae7ad656e2016", "score": "0.578883", "text": "def scorers\r\n guesses.select { |g| g.score > 0 }\r\n end", "title": "" }, { "docid": "dc9e7635fa0ac948b9e80d36a185071f", "score": "0.5782452", "text": "def won?\n (@word_characters - @guesses).empty?\n end", "title": "" }, { "docid": "06ef3f9093aaad95d4dec16007293b0b", "score": "0.5781711", "text": "def results_naive\n\t\tans_hash = {}\n\t\tanswers = self.answer_choices\n\t\tanswers.each do |answer|\n\t\t\tans_hash[answer.text] = answer.responses.count\n\t\tend\n\t\tans_hash\n\n\tend", "title": "" }, { "docid": "bd52f6da2f8cdccfd25eaab1a212ecf6", "score": "0.5781185", "text": "def one_week_wonders(songs)\n\tsongs.uniq.select do |song|\n\t\tno_repeats?(song, songs)\n\tend \nend", "title": "" }, { "docid": "86c9361192275d27c849eec1e615e0af", "score": "0.57786417", "text": "def get_valid_answers_for(input)\n db_value = get(input)\n !db_value ?\n nil :\n db_value.select { |_, v| v >= Arthur::REPLY_COUNT_TRESHOLD }.keys\n end", "title": "" }, { "docid": "28e2f2d2abd305db131a5e3aa739ac42", "score": "0.57764435", "text": "def show\n @choosen_questions = @questionaire.questions\n @possible_questions = Question.where.not(id: @choosen_questions)\n \n end", "title": "" }, { "docid": "51f37aa2000aedcaf3f6ad8f6b078ef3", "score": "0.5764366", "text": "def not_tied_to_any_judge\n where(hearings: { disposition: \"held\", judge_id: nil })\n end", "title": "" }, { "docid": "5cd636da3f94192b27ba7c2a114586fd", "score": "0.57622415", "text": "def query(opponent)\n wanted = wanted_card\n puts \"#@name: Do you have a #{wanted}?\"\n received = opponent.answer(wanted)\n @opponents_hand[:known_to_have].delete(wanted)\n if received.empty?\n @game.deal(self, 1)\n # by my next turn, opponent will have been dealt a card\n # so I cannot know what he does not have.\n @opponents_hand[:known_not_to_have] = []\n false\n else\n take_cards(received)\n @opponents_hand[:known_not_to_have].push(wanted).uniq!\n true\n end\n end", "title": "" }, { "docid": "4ce11e16990ca7125c81f74e8f953134", "score": "0.5755786", "text": "def incomplete(selected_tests = select_tests)\n selected_tests.select(&:crashed?)\n end", "title": "" }, { "docid": "18756354795b5def202274cfe29cd190", "score": "0.5754812", "text": "def unattempted(selected_tests = select_tests)\n selected_tests.select(&:unattempted?)\n end", "title": "" }, { "docid": "b440047aeb2f6aae845b82eb40360b94", "score": "0.5754703", "text": "def games_not_downloaded\n downloadable_games_in_index - games_on_system\n end", "title": "" }, { "docid": "1a2efaff63823da553b9d0a36d75bc55", "score": "0.57509375", "text": "def available_quests\n ret = Quest.nin(_id: self.completed_quests + self.accepted_quests)\n ret.any_of({:parent_id.in => self.completed_quests}, {parent_id: nil})\n end", "title": "" }, { "docid": "8ddc624df01efb57f8901e1b3e6a737d", "score": "0.57484233", "text": "def answers?\n !options[:answers].nil?\n end", "title": "" }, { "docid": "a41a4f14b0eb5fb8a09240651f01e8d8", "score": "0.57362294", "text": "def empty?; return @results.empty?; end", "title": "" }, { "docid": "a41a4f14b0eb5fb8a09240651f01e8d8", "score": "0.57362294", "text": "def empty?; return @results.empty?; end", "title": "" }, { "docid": "fe78650ad26873b96bb0f243c0fdff7b", "score": "0.5733529", "text": "def non_h(hypothesis)\n result = []\n $all_hypothesis.each { |it| \n result << it if it != hypothesis\n }\n result\nend", "title": "" } ]
27630e7aa07c769e2e12f311d88ca023
method to swap players
[ { "docid": "02709b1cc4c232fe6ce8b214170931af", "score": "0.8568772", "text": "def swap_players\n if @current_player == @all_players.first\n @current_player = @all_players.last\n else\n @current_player = @all_players.first\n end\n end", "title": "" } ]
[ { "docid": "f9aeb14f79ee80d488a0cf4d574a8418", "score": "0.83973795", "text": "def switch_players\n if @current_player == @player1\n @current_player = @player2\n else\n @current_player = @player1\n end\n end", "title": "" }, { "docid": "120ef50d647bff57de9e84e627afa0ac", "score": "0.8389236", "text": "def swap_players\n @current == @playerX ? @current = @playerO : @current = @playerX\n end", "title": "" }, { "docid": "934a2a1fb057a94cbfaffdddf18d54b0", "score": "0.8374373", "text": "def switch_players\n if @current_player == @player1\n @current_player = @player2\n else\n @current_player = @player1\n end\n end", "title": "" }, { "docid": "7bdd0bd037a743b8079e6cf4ebd6a3c0", "score": "0.834105", "text": "def switch_players\n if @current_player == @player_one\n @current_player = @player_two\n else\n @current_player = @player_one\n end\n end", "title": "" }, { "docid": "5c93746f36a90dbd97fcda7a77053604", "score": "0.81476897", "text": "def switch_players\n @current_player = @current_player == @player1 ? @player2 : @player1\n end", "title": "" }, { "docid": "891f296ede7971abf2356c2bc680be78", "score": "0.80097425", "text": "def switch_player\n if @current_player == @players[0]\n @current_player = @players[1]\n else\n @current_player = @players[0]\n end\n end", "title": "" }, { "docid": "d7389e46c53250046751905681c2a4cb", "score": "0.7926738", "text": "def switch_players\n # if @current_player == player1\n # @current_player = player2\n # @defending_player = player1\n # else\n # @current_player = player1\n # @defending_player = player2\n # end\n @current_player, @defending_player = @defending_player, @current_player\n end", "title": "" }, { "docid": "efc7d7bb09b676de590a78c100cf17a4", "score": "0.792574", "text": "def switch_players\n if @current_player == @player_1.name\n @current_player = @player_2.name\n @current_color = @player_2.color\n elsif @current_player == @player_2.name\n @current_player = @player_1.name\n @current_color = @player_1.color\n end\n end", "title": "" }, { "docid": "d3e7886ebd1009c0d5044c76791a8fa8", "score": "0.7906733", "text": "def change_players\n temp = self.current_player\n self.current_player = self.other_player\n self.other_player = temp\n end", "title": "" }, { "docid": "eb0107b3e74aef8631468a63d4aa1dbb", "score": "0.7870895", "text": "def switch_player\n if @current_player == @player1\n @current_player = @player2\n else\n @current_player = @player1\n end\n end", "title": "" }, { "docid": "5b971e994094c18f42df30e1664754e1", "score": "0.7834145", "text": "def switch_player\n current_index = PLAYERS.index(@cur_player)\n @cur_player = PLAYERS[1-current_index]\n end", "title": "" }, { "docid": "b45831993d817203aaeff29f0ea6df77", "score": "0.77663195", "text": "def switch_player_position\n @players.each {|player| player.switch_player_position}\n player_switch = players[0]\n players.shift\n players.push(player_switch)\n end", "title": "" }, { "docid": "dc8378e17ee9c737487542b73215ce24", "score": "0.7753182", "text": "def switch_players\n if players.length == 0\n return\n end\n @current_player_index = (@current_player_index + 1) % players.length\n @current_player = players[@current_player_index]\n end", "title": "" }, { "docid": "8066c63f713334b40f49e03f21404d06", "score": "0.772442", "text": "def switch_current_player\n if current_player == @p1\n @current_player = @p2\n @other_player = @p1\n else \n @current_player = @p1\n @other_player = @p2\n end\n end", "title": "" }, { "docid": "577acc19cd68c629f2220acb529f5c0b", "score": "0.7678193", "text": "def switch_player\n @current_player = @current_player == @player_1 ? @player_2 : @player_1\n end", "title": "" }, { "docid": "457b3622bc49b19b47b786f633973a8c", "score": "0.7671088", "text": "def switch_players\n\t\t@player = @player == 'X' ? 'O' : 'X'\n\tend", "title": "" }, { "docid": "4f3f3ca2af437dd7af04800fde9f360b", "score": "0.76557386", "text": "def switch_player\r\n\t\t@current_player = (@current_player == @player1 ? @player2 : @player1)\r\n\tend", "title": "" }, { "docid": "241be50c20b57ea0b10e27322ecd7560", "score": "0.76389456", "text": "def change_player\n\t\tif @current_player == @player1\n @current_player = @player2\n else @current_player = @player1\n end\n end", "title": "" }, { "docid": "2b66574522c83dc525d8874df0f0c288", "score": "0.75771224", "text": "def switch_player\n if @player == PIECE[:x]\n @player = PIECE[:o]\n else\n @player = PIECE[:x]\n end\n end", "title": "" }, { "docid": "3c8f3860e1441a86f57c767ee280ba47", "score": "0.75048923", "text": "def switch_player\n # debugger\n self.current_player = current_player == player1 ? player2 : player1\n end", "title": "" }, { "docid": "83b9a16f0260ac0501759d8318a3ebec", "score": "0.7439683", "text": "def switch_cur_player\n if @current_player == @player1 then @current_player = @player2 else @current_player = @player1 end\n end", "title": "" }, { "docid": "75db7ca89bc0201fffe0a6d72f42e1a7", "score": "0.7309097", "text": "def swap_positions_example\n league = leagues[0]\n date = dates[1]\n player1 = league.current_team.players[4].index\n player2 = league.current_team.players[10].index\n players = {}\n players[player1] = 'Bench'\n players[player2] = 'SS'\n swap_positions(league, date, players)\n end", "title": "" }, { "docid": "303434a97cb0848474c867e9ad41163a", "score": "0.72943896", "text": "def switch_player\n player == 1 ? @player = 2 : @player = 1\n end", "title": "" }, { "docid": "3f99d987d18b9be5120d328355799d24", "score": "0.7219364", "text": "def change_current_player\n if (@current_player == @player1)\n @current_player = @player2\n else\n @current_player = @player1\n end\n end", "title": "" }, { "docid": "bbb96a4fce85d068e6fbff498e170ea4", "score": "0.7192417", "text": "def switch_current_player\n @current_player = @current_player == @player1 ? @player2 : @player1\n end", "title": "" }, { "docid": "b1361ab800f2c96a4337c57267f97078", "score": "0.71856326", "text": "def turn_current_player\n if @current_player == @player1\n @current_player = @player2\n else\n @current_player = @player1\n end\n end", "title": "" }, { "docid": "688ef68eb055c507ac10e15af01d7906", "score": "0.71147597", "text": "def change_players!\n current_player = session[:current_player]\n return session[:current_player] = :player_1 unless current_player\n if current_player == :player_1\n session[:current_player] = :player_2\n else\n current_player = :player_1\n end\n end", "title": "" }, { "docid": "a6ebf5028801abadcb7737523ce6d95e", "score": "0.71100724", "text": "def playerSwitch \n\n\tif $player == 'X'\n\t\t$player = 'O'\n\telse \n\t\t$player = 'X'\n\tend\nend", "title": "" }, { "docid": "a36395ec8407e24e5a28f1ee3f4445fe", "score": "0.7093226", "text": "def switch_player(*_args)\n @player_index += 1\n @player_index = @player_index % @players.size\n end", "title": "" }, { "docid": "a7fe22a39e128550a8da687cf1863a01", "score": "0.70659196", "text": "def switch_player\n if @current_player == 0\n @current_player = 1\n else\n @current_player = 0\n end\n end", "title": "" }, { "docid": "2141e3ca82b5551b041b3350b602c33d", "score": "0.7045447", "text": "def swap_turn!\n\n end", "title": "" }, { "docid": "791d2787e3480fb57063e652049cf2ed", "score": "0.70426655", "text": "def switch_player\n\t\tif @player == \"b\"\n\t\t\t@player = \"w\"\n\t\telsif @player == \"w\"\n\t\t\t@player = \"b\"\n\t\telse\n\t\t\t@player = [\"b\", \"w\"][rand(2)]\n\t\tend\n\n\tend", "title": "" }, { "docid": "fdf814125eb64e1c3b9450123dfed01d", "score": "0.6998326", "text": "def changePlayer\n if @currentPlayer == @player\n @currentPlayer = @computer\n computersMove\n else\n @currentPlayer = @player\n playerTurn\n end\n end", "title": "" }, { "docid": "99b4a046e8caac02a3685557543d0582", "score": "0.69377345", "text": "def swap_turn\n @turn = if @turn == X_PLAYER\n O_PLAYER\n else\n X_PLAYER\n end\n end", "title": "" }, { "docid": "3c266dd86b2a6e6e2bc9481338a95b98", "score": "0.69160175", "text": "def switch_player\n self.current_player = current_player == COURT_VALUE[1] ? 2 : 1\n end", "title": "" }, { "docid": "4eb289b04724d613a26935fcb1c992fe", "score": "0.6847975", "text": "def switch_turn\n @current_player = @players.rotate!.first\n end", "title": "" }, { "docid": "76c5e33d9af2b7a32ebdd061dc8e752b", "score": "0.6809448", "text": "def switch_player()\n if @current_turn == \"o\"\n @current_turn = \"x\"\n elsif @current_turn == \"x\"\n @current_turn = \"o\"\n end\n end", "title": "" }, { "docid": "4200cd818bdef889b5397d76f3aabbcc", "score": "0.67996997", "text": "def switch_player(id)\n return if $game_player.id == id\n pre_switch_processing(id)\n perform_switch(id)\n refresh\n end", "title": "" }, { "docid": "01781fb82ad28056a3643e9260249068", "score": "0.67989534", "text": "def switch_player\n @current_player = (@current_player == 'X' ? 'O' : 'X')\n end", "title": "" }, { "docid": "90f5cd52ed7c2fbdcc9bd49db7384352", "score": "0.67513806", "text": "def switch_player(turn)\n turn = turn == @player1 ? @player2 : @player1\n end", "title": "" }, { "docid": "2f24d13dd20458abe1e42737228389e4", "score": "0.67453927", "text": "def revive\n @players.each &:revive\n proceed\n end", "title": "" }, { "docid": "d8f61e26a447d3e60c0b8899d99ccdfd", "score": "0.6728892", "text": "def player_setup(players) \t\n \t@player_1.name = players[0] \t\n \t@player_2.name = players[1]\n end", "title": "" }, { "docid": "cdbffa029dbdf4bf3fb8c6fa4e08fdd8", "score": "0.67272323", "text": "def switch_player_turn\n if @p_turn == \"2\"\n @p_turn = \"1\"\n\n elsif @p_turn == \"1\"\n @p_turn = \"2\"\n end\n end", "title": "" }, { "docid": "e35a7917a71dfa989417d83769379332", "score": "0.6688218", "text": "def switch_player_roles\n\t\t@codebreaker, @codemaker = @codemaker, @codebreaker\n\tend", "title": "" }, { "docid": "dc7a30349bc66c2140a7968baee955f2", "score": "0.66860056", "text": "def swith_player\n # If in ternary\n @current_player = @current_player == @player_x ? @player_o : @player_x\n end", "title": "" }, { "docid": "6f31c912dd74b3601336d5071b5b7d71", "score": "0.66702276", "text": "def next_player\n if @current_player == :player_2\n @current_player = :player_1 \n else\n @current_player = :player_2\n end\n end", "title": "" }, { "docid": "e70c6e35fe71ff95f709c755aeeb9bff", "score": "0.66697466", "text": "def set_players\n if @round % 2 == 1 # X is current if odd-numbered round\n @player = @p1\n @pt_current = @p1_type\n @pt_next = @p2_type\n @m_current = \"X\"\n @m_next = \"O\"\n else # otherwise O is current\n @player = @p2\n @pt_current = @p2_type\n @pt_next = @p1_type\n @m_current = \"O\"\n @m_next = \"X\"\n end\n end", "title": "" }, { "docid": "e39944b3bb9c8fb09d01bce359bb9201", "score": "0.6651432", "text": "def cycle_players(current_player)\n player1 = \"X\"\n player2 = \"O\"\n if @current_player == player1\n @current_player = player2\n else\n @current_player = player1\n end\n return @current_player\nend", "title": "" }, { "docid": "93342a046aa3eab9a95281d81e990a35", "score": "0.6636569", "text": "def alternate_player(current_player)\n case current_player\n when 'Player' then current_player = 'Computer'\n when 'Computer' then current_player = 'Player'\n end\n\n current_player\nend", "title": "" }, { "docid": "8f5e6289af164ae9c2b2d3d3a235dccb", "score": "0.663435", "text": "def restart\n @player_one.position_on_board = [[\"A1\",\"A2\",\"A3\"],[\"B1\",\"B2\",\"B3\"],[\"C1\",\"C2\",\"C3\"],[\"A1\",\"B1\",\"C1\"],[\"A2\",\"B2\",\"C2\"],[\"A3\",\"B3\",\"C3\"],[\"A1\",\"B2\",\"C3\"],[\"A3\",\"B2\",\"C1\"]]\n @player_two.position_on_board = [[\"A1\",\"A2\",\"A3\"],[\"B1\",\"B2\",\"B3\"],[\"C1\",\"C2\",\"C3\"],[\"A1\",\"B1\",\"C1\"],[\"A2\",\"B2\",\"C2\"],[\"A3\",\"B3\",\"C3\"],[\"A1\",\"B2\",\"C3\"],[\"A3\",\"B2\",\"C1\"]]\n @player_one.is_winner = false\n @player_two.is_winner = false\n end", "title": "" }, { "docid": "32eefeaa9ac4f2e13e6ffa35614e2821", "score": "0.6630221", "text": "def setNextPlayer\n\t$next_player == \"P1\" ? $next_player = \"P2\" : $next_player = \"P1\"\nend", "title": "" }, { "docid": "d30632eba9ae082dfd1f306cd49a2721", "score": "0.661968", "text": "def advance_player!(player)\n @board1 = @board1.insert(@die.roll + @board1.index(@players[0]), @board1.delete_at(@board1.index(@players[0])))\n @board2 = @board2.insert(@die.roll + @board2.index(@players[1]), @board2.delete_at(@board2.index(@players[1])))\n end", "title": "" }, { "docid": "c9b2c80ac7791e7b1d0cac22b9f90a48", "score": "0.66170794", "text": "def two_players\r\n game.board.reset!\r\n puts \"---- Human X vs Human O ----\\n\\n\"\r\n\r\n game.player_1 = Human.new(\"X\")\r\n game.player_2 = Human.new(\"O\")\r\n\r\n game.play\r\n end", "title": "" }, { "docid": "8bf0cdd018430d0023578058971ecf34", "score": "0.6607973", "text": "def switch_pokemon(first, second)\n @actors[first], @actors[second] = @actors[second], @actors[first]\n @actors.compact!\n end", "title": "" }, { "docid": "0ccf2fee63ed86d7af7a397e8355d3f6", "score": "0.6607676", "text": "def swap(a, b)\n tmp = @cards[a]\n @cards[a] = @cards[b]\n @cards[b] = tmp\n end", "title": "" }, { "docid": "b05ccc793d6a5840e6c6a1e4e0ecba29", "score": "0.6605362", "text": "def choose_player \n if ($active_player == $first_player) \n $active_player = $second_player\n $active_symbol = \"X\"\n else \n $active_player = $first_player\n $active_symbol = \"O\"\n end\n end", "title": "" }, { "docid": "006a5ef0bcb221802392011727c9bbc4", "score": "0.6601844", "text": "def swap_card_player(player_sym, lblcard_onhand, lblcard_new)\r\n @cards_player_todisp[player_sym].each do |cardgfx|\r\n #find card to be changed\r\n if cardgfx.lbl == lblcard_onhand\r\n # card found in the hand of player (e.g. 7 of briscola), change it with the lblcard_new\r\n cardgfx.change_image( @gfx_res.get_card_image_of(lblcard_new), lblcard_new )\r\n break\r\n end\r\n end\r\n end", "title": "" }, { "docid": "36df42d880b937808b6a523a253a51ce", "score": "0.65975285", "text": "def next_player\n if @board.current_player == @player_one\n @board.current_player, @board.other_player = @player_two, @player_one\n else\n @board.current_player, @board.other_player = @player_one, @player_two\n end\n \n @board.current_player \n end", "title": "" }, { "docid": "024d0148bce4e2ea80b26b1d2af4b10f", "score": "0.6582273", "text": "def changeTurn()\r\n if(@turn == @players[0])\r\n @turn = @players[1]\r\n else\r\n @turn = @players[0]\r\n end\r\n end", "title": "" }, { "docid": "f63beae968d199af69bb7091260d6a6e", "score": "0.6571511", "text": "def newTurn\n puts \"P1: #{@p1.lives}/3 vs #{@p2.lives}/3\"\n puts \"-------NEW TURN-------\"\n @currPlayer == @p1 ? @currPlayer = @p2 : @currPlayer = @p1\n end", "title": "" }, { "docid": "bec824365ffd2251cae521c1755f5577", "score": "0.6564638", "text": "def switch_players\n\t\tif @current_color == :white\n\t\t\t@current_color = :black\n\t\telse \n\t\t\t@current_color = :white\n\t\tend\n\tend", "title": "" }, { "docid": "c10c3b9b20eb2f401d57eca73ecf1e3e", "score": "0.65595496", "text": "def switch_turn\n if @current_turn == @p1\n @current_turn = @p2\n elsif @current_turn == @p2\n @current_turn = @p1\n end \n end", "title": "" }, { "docid": "b5ecbb79ef77b1ec81988895a4cbab04", "score": "0.65396047", "text": "def other_player(p) @players[[email protected](p)] end", "title": "" }, { "docid": "1fd64ddb4b60499c504f0e821050816e", "score": "0.65301585", "text": "def swap!(a, b)\n @cards[a], @cards[b] = @cards[b], @cards[a]\n @cards\n end", "title": "" }, { "docid": "dc506bc39e4c04ce2d550aedf0085383", "score": "0.652656", "text": "def switch_user\n if @current_user == @players[0]\n @current_user = @players[1]\n elsif @current_user == @players[1]\n @current_user = @players[0]\n end\n end", "title": "" }, { "docid": "121cbad098242d105c3002249fa1429d", "score": "0.65182537", "text": "def change_current_player\n if self.current_player == \"player_x\"\n self.current_player = :player_o\n else\n self.current_player = :player_x\n end\n end", "title": "" }, { "docid": "e41dd65e5ed1938f518b47cea2f512d8", "score": "0.6493717", "text": "def set_players(name1, name2)\n\t\t\t@player1 = Player.new(name1, 1)\n\t\t\t@player2 = Player.new(name2, 2)\n\t\t\t@current_player = @player1\n\t\tend", "title": "" }, { "docid": "b560230406450e27e3bf36473403c84f", "score": "0.6463607", "text": "def adjust_players\n print \"winner rank is #{winner.rank}, loser_rank is #{loser.rank}\"\n if winner.rank > loser.rank\n temp = winner.rank\n winner.update(rank: loser.rank)\n loser.update(rank: temp)\n end\n end", "title": "" }, { "docid": "11af1ee3f1bc09a2dbe5ddc047245269", "score": "0.6459017", "text": "def downcase_players\n\t\tself.p1.downcase!\n\t\tself.p2.downcase!\n\tend", "title": "" }, { "docid": "ef2b32010c0189f4ed95723384fdf4e8", "score": "0.64416796", "text": "def next_player\n @active_player, @nonactive_player = @nonactive_player, @active_player\n\n end", "title": "" }, { "docid": "91ab0caa590661f29cf9bc6e8d9cc331", "score": "0.64137185", "text": "def swap(x, y); end", "title": "" }, { "docid": "91ab0caa590661f29cf9bc6e8d9cc331", "score": "0.64137185", "text": "def swap(x, y); end", "title": "" }, { "docid": "b705cf6f048e331f786cadb96263a254", "score": "0.63954735", "text": "def downcase_players\n self.p1.downcase!\n self.p2.downcase!\n end", "title": "" }, { "docid": "52859844c3694e6dca406cf4f91d7783", "score": "0.6392687", "text": "def advance_player!(player)\n end", "title": "" }, { "docid": "84d6e62e5bc8ce6e6d9232551cf63068", "score": "0.63911265", "text": "def change_active_player\n @active_player = if @active_player == 'Player1'\n 'Player2'\n else\n 'Player1'\n end\n end", "title": "" }, { "docid": "294d739d1fe76af1084a14876909006c", "score": "0.63892996", "text": "def swap\n\t\t\tfirst = pop\n\t\t\tsecond = pop\n\t\t\tpush first\n\t\t\tpush second\n\t\tend", "title": "" }, { "docid": "1c7c3419a313271bbe2b29187d1c4843", "score": "0.6383235", "text": "def advance_player!(player)\n \n\n player\n end", "title": "" }, { "docid": "792fcb88f5afbd70b20ccd92d0c53796", "score": "0.6374932", "text": "def set_turn_order(player1, player2)\n\t\t\tplayers = [player1, player2]\n\t\t\tplayers.sort! { |one, two| one.roll_dice <=> two.roll_dice }.reverse!\n\t\tend", "title": "" }, { "docid": "03472700590a828d10578049fb66d268", "score": "0.63643163", "text": "def turn\n if @player1.turn\n @player1.turn = false\n @player2.turn = true\n @player1\n elsif @player2.turn\n @player2.turn = false\n @player1.turn = true\n @player2\n end\n end", "title": "" }, { "docid": "78f8e460a16813cfffe9cea827b10668", "score": "0.63602144", "text": "def setplayer2\r\n\t\t@player2 = \"X\"\r\n\tend", "title": "" }, { "docid": "19a03fe92b18302fead051d34489af91", "score": "0.6358184", "text": "def next_player!\n @players.rotate!\n end", "title": "" }, { "docid": "80012685b7478880706ffb8759005d3e", "score": "0.63484246", "text": "def advance_player(player)\n end", "title": "" }, { "docid": "5ff6abba65a534a2dc0017e934abc7f4", "score": "0.6333224", "text": "def update_player\n @season.switch_team(@player, params[:team_name])\n @season.reload\n redirect_to players_season_path(@season),\n notice: \"Switched #{@player.name} to #{params[:team_name]} team for Season #{@season.name}\"\n end", "title": "" }, { "docid": "cc80677844269629c1118e45b960b3fb", "score": "0.6333211", "text": "def next_player!\n @players.rotate!\n end", "title": "" }, { "docid": "8af310da55198844050a670730c34134", "score": "0.63316894", "text": "def advance_player!(player)\n @track1 = @track1.insert(@die.roll + @track1.index(@players[0]), @track1.delete_at(@track1.index(@players[0])))\n @track2 = @track2.insert(@die.roll + @track2.index(@players[1]), @track2.delete_at(@track2.index(@players[1])))\n end", "title": "" }, { "docid": "8af310da55198844050a670730c34134", "score": "0.63316894", "text": "def advance_player!(player)\n @track1 = @track1.insert(@die.roll + @track1.index(@players[0]), @track1.delete_at(@track1.index(@players[0])))\n @track2 = @track2.insert(@die.roll + @track2.index(@players[1]), @track2.delete_at(@track2.index(@players[1])))\n end", "title": "" }, { "docid": "41737d5be0b25ba9700e86434c086e17", "score": "0.6313117", "text": "def pre_switch_processing(player_id)\n $game_player.update_location\n end", "title": "" }, { "docid": "fc9ffdbdf3946ab265cccb80e2ce6696", "score": "0.63036186", "text": "def test_switch_player\n\t\tgame = Game.new(Board.new())\n\t\tassert_equal(game.player2, game.switch_player())\n\tend", "title": "" }, { "docid": "ae3aee0ac00016b4de9ae16ce4ec1c1b", "score": "0.628935", "text": "def choose_player(other_players)\n # DO NOT IMPLEMENT\n end", "title": "" }, { "docid": "cb9d3d2c35e38ce6f340da92d6918a13", "score": "0.62838644", "text": "def deuce_again\n points[PLAYER_1] = 3\n points[PLAYER_2] = 3\n end", "title": "" }, { "docid": "268f4edb08d2722c4cf795c29f9b65d8", "score": "0.62641215", "text": "def transfer_player\n $game_temp.player_transferring = false\n if $game_map.map_id != $game_temp.player_new_map_id\n $game_map.setup($game_temp.player_new_map_id)\n else # Dynamic Footprints\n fp = @spriteset.footprints\n md = @spriteset.fp_tilemap.map_data\n end\n $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)\n case $game_temp.player_new_direction\n when 2\n $game_player.turn_down\n when 4\n $game_player.turn_left\n when 6\n $game_player.turn_right\n when 8\n $game_player.turn_up\n end\n $game_player.straighten\n $game_map.update\n @spriteset.dispose\n @spriteset = Spriteset_Map.new\n if fp != nil or md != nil # Dynamic Footprints\n @spriteset.footprints = fp\n @spriteset.fp_tilemap.map_data = md\n end\n if $game_temp.transition_processing\n $game_temp.transition_processing = false\n Graphics.transition(20)\n end\n $game_map.autoplay\n Graphics.frame_reset\n Input.update\n end", "title": "" }, { "docid": "7907b0d835d8d40e7ba285dbfbd763d1", "score": "0.6263475", "text": "def undo_win player\n pairs.each do |pair|\n pair.undo_win player\n end\n end", "title": "" }, { "docid": "c08e28e4a424f0fede7c71626aa73b45", "score": "0.6249954", "text": "def update_switch_pokemon\n @pokemon = @party[@party_index]\n @index = 0 if @pokemon.egg?\n $game_system.se_play($data_system.decision_se)\n update_pokemon\n end", "title": "" }, { "docid": "8a500100c2a81353e5df5eeb10ae864c", "score": "0.62408876", "text": "def next_player!\n self.players.rotate!\n end", "title": "" }, { "docid": "55770340d3ee3d6c79d5f2fa0ec2eb33", "score": "0.6228628", "text": "def main\n @actual_player = @player1 if (@actual_player == \"\")\n\n turn\n end", "title": "" }, { "docid": "7abbe65e31c5e1cb577a450669244fcd", "score": "0.62253886", "text": "def pair_players\n if self.number_of_players % 2 == 0\n number_of_teams = self.number_of_players / 2\n teams = Array(1..number_of_teams)\n players = self.get_players\n\n while players.count > 0 do\n team_mates = players.sample 2\n team = teams.sample\n teams.delete team\n team_mates.each do |mate|\n part = Participation.get_for(mate, self)\n part.team = team\n part.save\n players.delete mate\n end\n end\n end\n end", "title": "" }, { "docid": "412f542f2aca3c70366555773dde6743", "score": "0.6200266", "text": "def switch(player)\n unless taken == true\n @mark = player.value\n @board[@player_choice - 1].value = @mark\n puts \"#{player.name} occupe maintenant la case #{@player_choice} !\"\n else\n play(player)\n end\n end", "title": "" }, { "docid": "b9094c6270c10819489d273dd0fd1a2a", "score": "0.6197415", "text": "def switchTurn()\n\t\tputs \"\"\n\t\tputs \"-----------\"\n\t\tputs \"The last player to play was: \"\n\t\tputs @name\n\t\tputs \"-----------\"\n\t\tputs \"\"\n\t\tcurrentTurn() #todo: pass the current player name into the currentTurn function and update the currentTurn variable\n\tend", "title": "" }, { "docid": "fc6c3b6e37c8dd803b209aa9ca127680", "score": "0.61952937", "text": "def animated_swap(sprite_left, sprite_right)\n end", "title": "" }, { "docid": "aa6e21420bb3e584588396c4bb8b16b4", "score": "0.6181497", "text": "def switch_turns\n @current_turn = opponent_of(current_turn)\n end", "title": "" } ]
0b7a5c7d40e1cfff0319abba878589d6
Adds a specified amount to the corresponding row of the passed skill
[ { "docid": "319f92ec91fc2eecceed22c64b611c1e", "score": "0.70873755", "text": "def add_experience(skill, amount)\n eventual = self[SKILLS[skill].last] + amount\n update_exp(skill, eventual)\n end", "title": "" } ]
[ { "docid": "2639d3ddec9b3b25b9c028df35fb4e0f", "score": "0.65511817", "text": "def increase_quantity(i)\n self.update_columns(quantity: quantity + i)\n end", "title": "" }, { "docid": "e3240bb71c1aec813df033a6e082059b", "score": "0.6484114", "text": "def add_quantity(added_amount)\n new_quantity = @quantity + added_amount\n CONNECTION.execute(\"UPDATE products SET quantity = #{new_quantity} WHERE id = #{@id};\")\n end", "title": "" }, { "docid": "e3074e08dceb27bb0ca24042d0cd6118", "score": "0.6386453", "text": "def amount(row); end", "title": "" }, { "docid": "e8d800a09217e2c95ce5e94c75dcaa88", "score": "0.62528706", "text": "def add_skill_exp(skill, exp)\n return if not skills.include?(skill)\n if skill_exp_invs.blank? or skill_exp_invs.find_by_owner_id(skill.id).blank?\n skill_exp = SkillExpInv.new\n skill_exp.mob_id = id\n skill_exp.owner_id = skill.id\n skill_exp.level = 1\n skill_exp.exp = exp\n skill_exp.save\n else\n skill_exp = skill_exp_invs.find_by_owner_id(skill.id)\n skill_exp.exp += exp\n skill_exp.save\n end\n end", "title": "" }, { "docid": "afce64515f2ef4ffe5c897fec325ffcc", "score": "0.60920906", "text": "def +(increase) new_from_sum(sum + increase) end", "title": "" }, { "docid": "c0bad82d877710650f00d396fb9cb5a8", "score": "0.60615003", "text": "def add_credit(transaction)\n if transaction.type == 'Expense'\n @credit -= transaction.quantity.to_f\n else\n @credit += transaction.quantity.to_f\n end\n self.update()\n\n end", "title": "" }, { "docid": "f8f1c91a372d151f787fecb40de164b1", "score": "0.60549814", "text": "def update_quantity(to_add)\n DATABASE.execute(\"UPDATE shoes SET location_stock = #{@location_stock + to_add} WHERE id = #{@id};\").first\n\n @location_stock += to_add\n\n end", "title": "" }, { "docid": "506abe92568fdc6af74669b9efbb3b83", "score": "0.60455906", "text": "def pay(amount)\n @earnings += amount\n end", "title": "" }, { "docid": "916de50d4ec52b293eb797c7718b59a5", "score": "0.5989196", "text": "def addToQuantity(quant, index)\n \titem = @inventory_arr[index]\n \titem.quantity = Integer(item.quantity) + Integer(quant)\n end", "title": "" }, { "docid": "556f32c47c1b4f875b7ec3e80a7ba2dd", "score": "0.59860307", "text": "def add_interest\n @balance += calc_interest\n end", "title": "" }, { "docid": "f346b83205ab6a2997c0f470d509abe2", "score": "0.5985026", "text": "def add_bonus_quantity(purchase, quantity, source)\n\n update_entry_for(purchase, :create) do |entry|\n bonus = entry.components.bonus\n if bonus\n bonus.quantity = bonus.quantity + quantity\n bonus.total = bonus.price * bonus.quantity\n value = bonus.total\n else\n point = purchase.price_points.where(:mode => 'single', :current => true).first\n price = point.price\n value = price * quantity\n\n entry.components.build(\n :price => price,\n :quantity => quantity,\n :total => value,\n :kind => 'bonus'\n )\n end\n\n adjust_item('bonus', entry, quantity, -value, source)\n end\n end", "title": "" }, { "docid": "f3d30ce7f11ae282cca44a5b97654894", "score": "0.5978419", "text": "def add_quantity_to_existing_item(item, quantity)\n @relationship = shopping_carts.find_by_item_id(item.id)\n @relationship.quantity += Integer(quantity)\n @relationship.save\n end", "title": "" }, { "docid": "5be4c524e697a8733dae5b1f4c12fb00", "score": "0.5969296", "text": "def add_hp(amount, member)\n $game_party.actors[member].hp += amount\n end", "title": "" }, { "docid": "62edb612083ecd16719e384efff0bb30", "score": "0.5959126", "text": "def add_gold_credit(amount = 1)\n self.gold_credit += amount\n end", "title": "" }, { "docid": "fded57eb13f72f624cd98d46cc93aca9", "score": "0.5949608", "text": "def add_item(item,amount=1)\n @adaptee.add_mission(item)\n amount # So eclipse won't yell at me\n end", "title": "" }, { "docid": "13c2e1ded13d984a62c678807ad0c74e", "score": "0.59471166", "text": "def add_player_winnings(amount)\n self.player_winnings += amount\n end", "title": "" }, { "docid": "5729db7c5dea5dc4eff544578cdffcd9", "score": "0.5908046", "text": "def add(amount, item)\n\n unless amount > 0\n raise Exceptions::NotEnoughError\n \"Value must be greater than 0\"\n end\n if Thing.exists?(:name => item)\n # find it in the database\n the_item = Thing.find_by(name: item)\n the_item.amount += amount\n the_item.save\n else\n @bag[item] = amount\n Thing.create(:name => item, :amount => amount)\n end\n end", "title": "" }, { "docid": "8eed4761e7fe38d3b95813960287c484", "score": "0.59075546", "text": "def bonus_for_strike\n @records.reduce(:+)\n end", "title": "" }, { "docid": "51859180567d07d7cef6e5452e843839", "score": "0.5894594", "text": "def skill_up(skill, value, game)\n\t\tif rand(100.0) >= value\n\t\t\t@skills[skill] += 0.1\n\t\t\tgame.insert_text(\"Your #{skill} skill has increased to #{@skills[skill]}!\")\n\t\telse\n\t\t\t# no increase\n\t\tend\n\tend", "title": "" }, { "docid": "ededd5c3753e69baa1592f0bbc93e1a4", "score": "0.58940566", "text": "def add_int(amount, member)\n $game_party.actors[member].int += amount\n end", "title": "" }, { "docid": "32406d72945a2f5a222d903b6db84fb6", "score": "0.589209", "text": "def add_transaction(amount)\n @tally += amount\n @num_transactions += 1\n @average_transaction_cost = @tally / @num_transactions\n end", "title": "" }, { "docid": "7183e331b306a612e2e5b96dc89aec71", "score": "0.58808166", "text": "def gain_experience(additional_points)\n self.experience = experience + additional_points\n end", "title": "" }, { "docid": "3d5e31cdcad2a13a637c73f854514f1c", "score": "0.5875493", "text": "def add_to_score(num)\n\t\tH.score += num\n\tend", "title": "" }, { "docid": "c2b98b452e2b726b0ebaa69b976d3526", "score": "0.586917", "text": "def add_skill(skill)\r\n Skill.create(id: opportunity_id, skill: skill)\r\n end", "title": "" }, { "docid": "30e8cf5c40f9221447cad6e9c31de5e5", "score": "0.5865031", "text": "def add(amount)\n @money += amount\n transactions << \"[#{date_str(Date.today)}]added:#{amount}\"\n end", "title": "" }, { "docid": "5ed043f58ab135ad732efa973d6ba7ce", "score": "0.58455515", "text": "def pay_interest\n @amount += 10\n end", "title": "" }, { "docid": "4fed68990401fc16367958825c69476d", "score": "0.5841236", "text": "def add_wine(wine_id, quantity)\n if quantity < 1\n quantity = 1\n end\n current_item = line_items.find_by(wine_id: wine_id)\n if current_item\n current_item.quantity += quantity\n else\n current_item = line_items.build(wine_id: wine_id)\n current_item.quantity = quantity\n end\n current_item\n end", "title": "" }, { "docid": "6c1db04cd9b9b76c228f494ebe12ba80", "score": "0.58394057", "text": "def give_raise(amount)\n @salary += amount\n end", "title": "" }, { "docid": "959ddc6321e7aa673cc05164d39f2ec0", "score": "0.58357954", "text": "def update_quantity(q, i)\n line_item = self.line_items.find_by(item_id: i.id)\n line_item.quantity += q\n line_item.save\n end", "title": "" }, { "docid": "9b27b7a1c223ddf6502b3c90e4334592", "score": "0.5826764", "text": "def add_bonus_stat(stat, amount)\n return if stat == nil || amount == nil\n @added_stats[stat] += amount\n end", "title": "" }, { "docid": "040a4d26c5af5293ec620187771a7d35", "score": "0.5819136", "text": "def add_row( array, index )\n offset = index * 3\n array[offset] + array[offset + 1] + array[offset + 2]\nend", "title": "" }, { "docid": "784f53c554d6cbf37ed8d7e02ff173c4", "score": "0.58162737", "text": "def add_quantity(q)\n self.quantity+=q\n self.save\n end", "title": "" }, { "docid": "14514502c2049d35838ac44157b7718f", "score": "0.58101034", "text": "def add(row)\n return 0 unless @sample.add? row\n @sampled_ids.add row['id'] if row['id']\n dependencies_for(row).collect { |dep|\n 1 if @pending_dependencies.add?(dep)\n }.compact.sum\n end", "title": "" }, { "docid": "04ec6e6ea30a681141ed5fa8266a8191", "score": "0.5803827", "text": "def add_experience amount\n\t\tif amount.integer?\n\t\t\texp = amount + @loose\n\t\t\t@loose = 0\n\t\t\t@experience += amount\n\t\t\twhile exp >= Experience::xp_required_per_bp(self.level())\n\t\t\t\t\texp -= Experience::xp_required_per_bp(self.level())\n\t\t\t\t\t@build += 1\n\t\t\tend\n\t\t\t@loose = exp\n\t\tend\n\tend", "title": "" }, { "docid": "75a88881c973c828ea0c9e4b9c93f56f", "score": "0.5797142", "text": "def adjustSkillList(mod); @skillList += mod; end", "title": "" }, { "docid": "506dcb0ebe4bab76142d0536e171bd6d", "score": "0.5794311", "text": "def add_tip!(amount)\n self.tip_earned += amount\n self.save!\n end", "title": "" }, { "docid": "8213eb15a598cd914776bfb7deb7e845", "score": "0.57892084", "text": "def gain_experience(exp)\n self.experience += exp\n save\n end", "title": "" }, { "docid": "ec871e73e273087648c88c2067f1c675", "score": "0.5782239", "text": "def add_item(item, amount = 1)\n found = entry(item)\n if found\n found.second += amount\n else\n @items.push(C[item, amount])\n end\n end", "title": "" }, { "docid": "c7d2e8940ea58e9f5f422b94c4e8dabc", "score": "0.57774895", "text": "def add_turn_skill(skill)\n @turn_skills[skill.id] = skill.turn_delay\n end", "title": "" }, { "docid": "a417f1b022badb072fb56f6ce2aec2a6", "score": "0.5771121", "text": "def add_cash(amount)\n return @wallet += amount\n end", "title": "" }, { "docid": "e8b5c9676672de48b6ff42c26e70dcde", "score": "0.5763203", "text": "def give_proofreading_reward \n s = self.student \n n = s.reward_gredits + 3 \n s.update_attribute :reward_gredits, n\n end", "title": "" }, { "docid": "f1e347fd92b8cd53920d2d1e07b7c115", "score": "0.5756621", "text": "def add_to_sum_row(value, column)\n return unless @sum_row_patterns\n @sum_row_patterns.each do |pattern|\n if pattern =~ /^\\(?c\\d+[=~+.]/\n header_column = evaluate(pattern, \"\")\n else\n header_column = pattern\n end\n\n if header_column == column\n @sum_row[header_column] ||= 0\n @sum_row[header_column] += value\n end\n end\n end", "title": "" }, { "docid": "0e51d41d2be82dd5d7bb106e39768c74", "score": "0.57553947", "text": "def update_quantity(quantity, item)\n item_id = item.to_i\n line_item = line_items.find_by(item_id: item_id)\n line_item.quantity += quantity\n # Inventory can never be negative\n line_item.quantity = 0 if line_item.quantity.negative?\n line_item.save\n end", "title": "" }, { "docid": "1f348380c2a20d00b2e1fb2faf96e96c", "score": "0.5754993", "text": "def add_money(value, quantity)\n @money_map[value] += quantity\n end", "title": "" }, { "docid": "0e51d41d2be82dd5d7bb106e39768c74", "score": "0.5754238", "text": "def update_quantity(quantity, item)\n item_id = item.to_i\n line_item = line_items.find_by(item_id: item_id)\n line_item.quantity += quantity\n # Inventory can never be negative\n line_item.quantity = 0 if line_item.quantity.negative?\n line_item.save\n end", "title": "" }, { "docid": "d1ab10d7abfe9ab9bf3c894e21e267c9", "score": "0.5750622", "text": "def add_experience\n @years_experience += 1\n end", "title": "" }, { "docid": "b3c3aa8eaf2455bad79be3787c713dfb", "score": "0.57467246", "text": "def add_qty(num)\r\n @qty_ordered += num\r\n @qty_total += num\r\n end", "title": "" }, { "docid": "8efeb74d979823be2b85e2bb1d83fe25", "score": "0.5742463", "text": "def skill_rating( skill )\n @skill_rating = 0\n\n self.ratings.each do |rating|\n if skill == rating.skill\n @skill_rating = @skill_rating + rating.value\n end\n end\n\n @skill_rating\n end", "title": "" }, { "docid": "fed7ff59c0cb818b1dae38ec152fe345", "score": "0.5717136", "text": "def add_bet_to_hand(hand, amount)\n hand.add_bet_amount(amount)\n @total_bets = @total_bets + amount\n @money = @money - amount\n end", "title": "" }, { "docid": "797cd5f25fe36cd5a7d7001133af73f1", "score": "0.5717016", "text": "def add_wage_to_total!(wage)\n self.total_wage += wage\n end", "title": "" }, { "docid": "3e80f5ae68dadd139cf50da6590baa7c", "score": "0.5710435", "text": "def reward\n business.add_to_balance(amount)\n end", "title": "" }, { "docid": "c386f2e35a2e7f503fc7ab2c745d5769", "score": "0.5701332", "text": "def update_quantity_line_item\n @line_item.assign_attributes(quantity: @line_item.quantity + @quantity)\n end", "title": "" }, { "docid": "586e0b07be3907b501b3fd0d740ae2df", "score": "0.5692556", "text": "def add_enemies_score\n @score += 75\n end", "title": "" }, { "docid": "53ba5156debddf6c1cdea560bbce4c71", "score": "0.56912243", "text": "def add_dex(amount, member)\n $game_party.actors[member].dex += amount\n end", "title": "" }, { "docid": "a0d1013c2024191d774bcea6b7fe685b", "score": "0.56877387", "text": "def increase_amount!(category, amount)\n amount = amount.to_d\n column_name = \"#{category}_cents\"\n original_cents = self[column_name]\n\n unit = if category.in?(%w(payment receipt))\n 1_000_000\n else\n 100\n end\n\n if original_cents.blank?\n update!(column_name => amount * unit)\n else\n update!(column_name => original_cents + amount * unit)\n end\n end", "title": "" }, { "docid": "01cde68870aeebb32771a97ca69d1380", "score": "0.56777674", "text": "def add_totaled_row csv, line_item, total\n if should_be_totaled?(line_item)\n row = [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", total, \"\"]\n csv << row\n else\n row = []\n csv << row\n end\n end", "title": "" }, { "docid": "fe42cbde16fd58ee9738c697b856cef6", "score": "0.56728876", "text": "def alter_credits(amount)\r\n self.credits=self.credits+amount\r\n end", "title": "" }, { "docid": "04967a0b517f6526112a848c164cf0e2", "score": "0.56687325", "text": "def add_item(item, amount=1)\n \n end", "title": "" }, { "docid": "9d67f7f8033ef501f079ca634928b746", "score": "0.5665612", "text": "def increase_report_amount\n report = Report.find(self.report_id)\n report.update_column(:total_amount, report.total_amount + self.amount)\n report.save\n end", "title": "" }, { "docid": "45eae03f8be2c1dc061ecbc22eff815d", "score": "0.566039", "text": "def add_money(amount)\n\t\t@money += amount\n\t\treturn @money\n\tend", "title": "" }, { "docid": "16afb69004561407f48bd74e5cbaa983", "score": "0.5658512", "text": "def affect(stats)\n stats.total_xp += bonus[:total_xp]\n end", "title": "" }, { "docid": "16afb69004561407f48bd74e5cbaa983", "score": "0.5658512", "text": "def affect(stats)\n stats.total_xp += bonus[:total_xp]\n end", "title": "" }, { "docid": "16afb69004561407f48bd74e5cbaa983", "score": "0.5658512", "text": "def affect(stats)\n stats.total_xp += bonus[:total_xp]\n end", "title": "" }, { "docid": "8564aa8a320eb299fca20b0b60862685", "score": "0.5656961", "text": "def adjust_gold_by(amount)\n set_gold(@gold + amount)\n end", "title": "" }, { "docid": "96aa7505c68ebe7e2af79f1b81fb8396", "score": "0.56492823", "text": "def add_profit(cents)\n @profit_cents ||= 0\n @profit_cents += cents\n end", "title": "" }, { "docid": "8a4f22b89a076edc6867809e956b5a72", "score": "0.5648413", "text": "def add_item(item,original_list,quantity)\n\toriginal_list[item] += quantity\nend", "title": "" }, { "docid": "ffd04b21243a9021bdf2a5b455534b97", "score": "0.5643416", "text": "def add_row(row)\n throw \"Do not use\"\n end", "title": "" }, { "docid": "8b95493331400aa4fd52564793666a1a", "score": "0.56409323", "text": "def add_row(*row)\n @rows << row\n end", "title": "" }, { "docid": "0542bb992aa8e6baa409f4bcc2d0b17f", "score": "0.56397337", "text": "def add_money(amount)\n @money = @money + amount.floor\n end", "title": "" }, { "docid": "0f74c7397db5b43bcf98c1d7488c1044", "score": "0.5615873", "text": "def suma_matriz(bonus, round)\n (round..10).each do |columns|\n @score_table[columns] ||= []\n 3.times do |x|\n if x.zero?\n score = @score_table[columns][x + 2].to_i\n @score_table[columns][x + 2] = bonus + score\n end\n end\n end\n end", "title": "" }, { "docid": "7f77589b145cebe995a55b94c5fbe835", "score": "0.561506", "text": "def add_cash(num)\n self.cash += num\n save!\n end", "title": "" }, { "docid": "ddc8c2deb9126787a6c17faedd3557fd", "score": "0.56134135", "text": "def add_row_to_sales_records(row)\n processor = get_processor(row)\n processor.add_sales_record(row)\n end", "title": "" }, { "docid": "7ec85fdfc42a19cc039f19df246a89d3", "score": "0.56084913", "text": "def add_score(score)\n @total_score += score\n end", "title": "" }, { "docid": "36ca81b8d13a103e11d3483dc3db2c55", "score": "0.5606206", "text": "def add_row(row)\n @rows << row\n end", "title": "" }, { "docid": "36ca81b8d13a103e11d3483dc3db2c55", "score": "0.5606206", "text": "def add_row(row)\n @rows << row\n end", "title": "" }, { "docid": "07c75268f4be73cb873d9429d662eafb", "score": "0.5602643", "text": "def add_step_skill(skill)\n @step_skills[skill.id] = skill.step_delay\n end", "title": "" }, { "docid": "b772a12b434450fcb74815e90580d03d", "score": "0.559659", "text": "def add_gold(gold_found)\n @gold += gold_found\n end", "title": "" }, { "docid": "47a52fda50dd57d037861db15b839e7c", "score": "0.5594373", "text": "def add_in_table(mult = 1.0, round = 1, checkable = true)\n @added = true\n adjusted_qty(mult, round, checkable)\n end", "title": "" }, { "docid": "47a52fda50dd57d037861db15b839e7c", "score": "0.5594373", "text": "def add_in_table(mult = 1.0, round = 1, checkable = true)\n @added = true\n adjusted_qty(mult, round, checkable)\n end", "title": "" }, { "docid": "c1dfbabcf8f22856dbcab9ba0e4f2912", "score": "0.5583784", "text": "def generate_new_quantity(quantity)\n @quantity_generated += quantity\n @current_quantity += quantity\n end", "title": "" }, { "docid": "f17422194dbd9914d0ae672e0b1f2abd", "score": "0.5577102", "text": "def add_transaction(amount)\n @transactions << amount\n end", "title": "" }, { "docid": "e5c6c659b0f29f0c0d698b4a35c65dbf", "score": "0.5574969", "text": "def add(row)\n row.row_number = (@rows[relative_map[@lead_rows]].row_number || 0) + 1\n\n @rows.rotate!\n @rows[relative_map[@lead_rows]].copy row\n\n update_by_groups if has_by_groups?\n end", "title": "" }, { "docid": "23ca8b26a58dd0756615ab3062fcb717", "score": "0.557269", "text": "def add_item(title, amount, quantity = 1)\n self.total += amount * quantity\n quantity.times do\n items << title\n end\n self.last_transaction = amount * quantity\n end", "title": "" }, { "docid": "c2c1ba8ed891ebd3588dcc0a5ed82e19", "score": "0.5571564", "text": "def update_quantity(item_hash, quantity_to_add)\n item_hash[\"quantity\"] += quantity_to_add\n return item_hash\nend", "title": "" }, { "docid": "8026feba4f76e79a23be29f85ce92f90", "score": "0.5569916", "text": "def add_item(order_qty)\r\n return @qty += order_qty\r\n end", "title": "" }, { "docid": "3e3e7cda4208335a8f3ea5a36d6c97c0", "score": "0.55685985", "text": "def update_points(recipe)\n recipe.rewarded_points += 50\n end", "title": "" }, { "docid": "8d59139d7d55e9142dd5009b311379a3", "score": "0.5563455", "text": "def add_cash(value, quantity)\n\t @cash[value] += quantity if quantity > 0\n\t end", "title": "" }, { "docid": "754f0cabc7b5f5dfbc524279fe2d4408", "score": "0.556316", "text": "def update_credits(amount)\n @credits += amount\n end", "title": "" }, { "docid": "84e426c0b1d01de88d53db89d37095e7", "score": "0.55614334", "text": "def add_score\r\n @score += 1\r\n end", "title": "" }, { "docid": "1c6c5430ec7e96d79666d275ccc8225a", "score": "0.55611134", "text": "def add_rows(array_or_num); end", "title": "" }, { "docid": "d4877d2fa0fbd9a4348484239d92de99", "score": "0.5558666", "text": "def set_bonus_quantity(purchase, quantity, source)\n for_purchase(purchase, :add_bonus_quantity, false, quantity, source)\n end", "title": "" }, { "docid": "ea3fb0f6bb392a0a6db5914f2abaf657", "score": "0.5549385", "text": "def add_sp(amount, member)\n $game_party.actors[member].sp += amount\n end", "title": "" }, { "docid": "04cf019044a39c1c70c8680195367657", "score": "0.5546278", "text": "def add_apples_score\n @score += 50\n @lives += 1 if @lives < 3\n end", "title": "" }, { "docid": "5a6cb5e20f069c509583ea5761b5a126", "score": "0.5543429", "text": "def add_temporary_attack_to_minion(amount)\n target = choose_bonus_minion attacK: amount, health: 0\n if target\n target.temporary_attack += amount\n end\n end", "title": "" }, { "docid": "2c6ded7e0559d055be9427fdf042c280", "score": "0.5542946", "text": "def add_or_remove_cash(arg_person, sum)\n arg_person[:admin][:total_cash] += sum\nend", "title": "" }, { "docid": "b7b344ea5de138ddccf232632fa8d95a", "score": "0.5541596", "text": "def add\n skills = Skill.find_all_by_name(params[:skill][:name].downcase)\n if skills.length == 1\n skill = skills.first\n elsif skills.length == 0\n skill = Skill.new params[:skill]\n end\n user = session[:user]\n begin\n user.metrics << skill\n unless user.save\n flash[:notice] = \"Error adding skill\"\n end\n rescue\n flash[:notice] = \"Skill already selected\"\n end\n redirect_to :action => :define\n end", "title": "" }, { "docid": "9713d0d0412eed1b0c8fa154b8dd496e", "score": "0.55386984", "text": "def win(amount)\n @chips += amount\n end", "title": "" }, { "docid": "6d901227d615416fc87e358fbdf091c0", "score": "0.5537741", "text": "def increase_coins(amt = 0)\n increment!(:coins, amt)\n end", "title": "" }, { "docid": "e156f1b787963e3fc615f7948dd2dbd1", "score": "0.5533603", "text": "def add_experience_effect_transaction(effect)\n ActiveRecord::Base.transaction(:requires_new => true) do\n self.lock!\n amount = effect[:bonus]\n self.exp_bonus_effects = (self.exp_bonus_effects || 0.0) + amount\n self.save!\n end\n end", "title": "" }, { "docid": "6867f41ee1ea445f2471bb2d2805cebc", "score": "0.5530896", "text": "def add_sku(sku, amount)\n @inventory[sku] = amount\n end", "title": "" } ]
1f5c166d4332bf0413bdfa3d2b946ef6
Question EXCEL Export Methods Calculates the total span of columns for a design detail
[ { "docid": "b7b3af9a586c71b2cd98ac6ba5990b68", "score": "0.0", "text": "def getQuestionColSpanByArm(arm_id,q_name)\n return getQuestionEXCELLabelsByArm(arm_id,q_name).size()\n end", "title": "" } ]
[ { "docid": "f2172fbd6fb5a32857a6785a58a2b8a6", "score": "0.6696586", "text": "def getTotalDesignDetailsEXCELSpan(reportset)\n dd_ncols = 0\n for ddidx in 0..getNumDesignDetailsItems() - 1\n if showDesignDetails(ddidx)\n # For each dd to show - get the total number columns to support the export of this dd\n dd_ncols = dd_ncols + getDesignDetailsEXCELSpan(ddidx,reportset)\n end\n end\n return dd_ncols\n end", "title": "" }, { "docid": "d7b949aca6dc96a6753ce0c0a8985bbb", "score": "0.6555586", "text": "def getTotalCols()\n # Publication items are lumped into one column\n n_cols = 1\n # Design Details ------------------------------------------\n n_cols = n_cols + getNumDesignDetailsCols()\n # Arms ------------------------------------------\n n_cols = n_cols + getNumArmsCols()\n # Arms Details ------------------------------------------\n n_cols = n_cols + getNumArmDetailsCols()\n # Baseline Characteristics ------------------------------------------\n n_cols = n_cols + getNumBaselineCols()\n # Outcome Timepoints ------------------------------------------\n n_cols = n_cols + getNumOutcomeTimepointsCols()\n # Outcome Measures ------------------------------------------\n n_cols = n_cols + getNumOutcomeMeasuresCols()\n # Outcome Results ------------------------------------------\n n_cols = n_cols + getNumOutcomesCols()\n # Outcome Details ------------------------------------------\n n_cols = n_cols + getNumOutcomeDetailsCols()\n # Adverse Events ------------------------------------------\n n_cols = n_cols + getNumAdverseEventsCols()\n # Quality Dimensions ------------------------------------------\n n_cols = n_cols + getNumQualityDimCols()\n # Overall quality column ----------------------------------\n n_cols = n_cols + 1\n return n_cols\n end", "title": "" }, { "docid": "72e133361a5fdde6630dd80eff5f28c9", "score": "0.63203794", "text": "def content_cols\n total = 0\n #@chash.each_pair { |i, c| \n #@chash.each_with_index { |c, i| \n #next if c.hidden\n each_column {|c,i|\n w = c.width\n # if you use prepare_format then use w+2 due to separator symbol\n total += w + 1\n }\n return total\n end", "title": "" }, { "docid": "888bceb3f488ccbea712fdbf7d5567d1", "score": "0.6306152", "text": "def total_columns\n @sheet.row(0).length\n end", "title": "" }, { "docid": "5592ac9114a3ca1ebc62740d42db9331", "score": "0.62957424", "text": "def getDesignDetailsEXCELSpan(dd_name)\n col_span = 0\n for sidx in 0..size() - 1\n study_colspan = @studies[sidx].getDesignDetailColSpan(dd_name)\n if study_colspan > col_span\n col_span = study_colspan\n end\n end\n return col_span\n end", "title": "" }, { "docid": "d66f8c3b82bd7b351f93d31a15bc5cfc", "score": "0.6281908", "text": "def content_cols\n total = 0\n #@chash.each_pair { |i, c|\n #@chash.each_with_index { |c, i|\n #next if c.hidden\n each_column {|c,i|\n w = c.width\n # if you use prepare_format then use w+2 due to separator symbol\n total += w + 1\n }\n return total\n end", "title": "" }, { "docid": "7deff0bd4fcf1299b9f2081e964aa70e", "score": "0.6275331", "text": "def writeDetail(sheet,columnsIndexs,data,startRow,mergeColumn)\n\t\tcolumnsIndex = Array.new()\n\t\tsummaryColumns = Hash.new\n\t\tvalueSummaries = Hash.new\n\t\t# filter column wich is sumarry and wich only format dollar\n\t\tcolumnsIndexs.each do |index|\n\t\t\tif index.include? \"$\"\n\t\t\t\ttmp_string = String.new(index)\n\n\t\t\t\tif index.include? \"+\"\n\t\t\t\t\t tmp_string.sub!('$', '')\t\n\t\t\t\t\t\n\t\t\t\t\tcolumnsIndex << tmp_string.sub!('+', '')\t\t\n\t\t\t\t\tsummaryColumns[tmp_string]= tmp_string.sub!('+', '')\t\n\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\tcolumnsIndex << tmp_string.sub!('$', '')\t\n\n\t\t\t\tend\n\n\t\t\telsif index.include? \"+\"\n\t\t\t\t\n\t\t\t\ttmp_string = String.new(index)\n\t\t\t\tcolumnsIndex << tmp_string.sub!('+', '')\t\t\n\t\t\t\tsummaryColumns[tmp_string]= tmp_string.sub!('+', '')\t\n\t\t\n\n\t\t\telse\n\n\t\t\t\n\t\t\t\tcolumnsIndex << index\n\t\t\tend\n\t\t\t\n\t\tend\n\n\t\tformat = Spreadsheet::Format.new :border=> :thin , :border_color => :xls_color_8 , :vertical_align => :center \n\t\tformatCurrency = Spreadsheet::Format.new :border=> :thin , :border_color => :xls_color_8 , :vertical_align => :center, :number_format => '$#,###.00_);[Red]($#,###.00)' \n\t\ti=0\n\t\t# loop data detail\n\t\tdata.each do |d|\t\t\n\t\t\t\n\t\t\ti = i+1;\t\n\t\t\tindexColumnFormat=1\n\t\t\ts = Array.new()\n\t\t\ts << ''\n\t\t\t# LOOP TO GET DATA FROM COLUMN INDEX\n\t\t\tcolumnsIndex.each do |index|\n\t\t\t\ts << d[index]\n\t\t\tend\n\n\n\t\t\tsummaryColumns.each do |index,value|\n\n\n\t\t\t\tif valueSummaries[index].nil?\n\t\t\t\t\tvalueSummaries[index] = 0\n\t\t\t\tend\n\t\t\t\tif d[index].nil? \n\t\t\t\t\t\td[index] =0\n\t\t\t\tend\n\n\t\t\t\tvalueSummaries[index] = d[index] + valueSummaries[index]\n\t\t\t\t\n\t\t\tend\n\n\t\t\t# WRITE DATA TO EXCEL\n\t\t\t\n\t\t\tsheet.insert_row(startRow+i-1, s)\n\t\t\t# SET FORMAT AFTER INSERT ROW\n\n\t\t\tcolumnsIndexs.each do |indexCol|\n\t\t\t\t# set format money\n\n\t\t\t\tif indexCol.include? \"$\"\n\t\t\t\t\tsheet.row(startRow+i-1).set_format(indexColumnFormat, formatCurrency)\n\t\t\t\telse\n\t\t\t\t\n\t\t\t\t\tsheet.row(startRow+i-1).set_format(indexColumnFormat, format)\n\t\t\t\tend\n\t\t\t\t\n\n\t\t\t\tindexColumnFormat=indexColumnFormat+1\n\t\t\tend\n\n\t\t\tsheet.row(startRow+i-1).height = 15\n\t\tend\t\n\t\t# merge row in excel\n\t\tif mergeColumn.kind_of?(Array) && mergeColumn.length >0\n\t\t\tmergeRow(sheet,startRow,columnsIndex,data,mergeColumn)\n\t\tend\n\n\t\tif !valueSummaries.nil?\n\t\t\tsumarryFooter(sheet,columnsIndex,columnsIndexs,valueSummaries,(startRow+i) )\n\n\t\tend\n\n\t\treturn startRow+i \n\n\tend", "title": "" }, { "docid": "967933cae9766d50c980ee0cd8641ae5", "score": "0.61617494", "text": "def header_cells_count; end", "title": "" }, { "docid": "bc6b0b7753db7471c829e1682c5e57d7", "score": "0.610861", "text": "def sheet_calc_pr; end", "title": "" }, { "docid": "17c5a4172cd38c3a977d3a55cae92ab6", "score": "0.6007727", "text": "def grid_columns\n width = layout_width - margin_left_pdf - margin_right_pdf\n (width / cell_size_pdf.to_f).floor\n end", "title": "" }, { "docid": "c442ddaaa02797ce91912481fbd881a0", "score": "0.58804864", "text": "def calc_sheet_offsets #:nodoc:\n offset = @datasize\n\n # Add the length of the COUNTRY record\n offset += 8\n\n # Add the length of the SST and associated CONTINUEs\n offset += calculate_shared_string_sizes\n\n # Add the length of the EXTSST record.\n offset += calculate_extsst_size(@shared_string_table.str_unique)\n\n # Add the length of the SUPBOOK, EXTERNSHEET and NAME records\n offset += calculate_extern_sizes\n\n # Add the length of the MSODRAWINGGROUP records including an extra 4 bytes\n # for any CONTINUE headers. See add_mso_drawing_group_continue().\n mso_size = @mso_size\n mso_size += 4 * Integer((mso_size -1) / Float(@limit))\n offset += mso_size\n\n @worksheets.each do |sheet|\n offset += BOF + sheet.name.bytesize\n end\n\n offset += EOF\n @worksheets.each do |sheet|\n sheet.offset = offset\n sheet.close\n offset += sheet.datasize\n end\n\n @biffsize = offset\n end", "title": "" }, { "docid": "d7351a8bf443941fffadbee042e92425", "score": "0.58583415", "text": "def size\n @document.sheets.get.inject(0) do |result, sheet|\n range = sheet.used_range \n result += range.rows.get.size * range.columns.get.size\n end\n end", "title": "" }, { "docid": "c438f056627aac4f886a5bb53dd0c545", "score": "0.5733869", "text": "def export_report\n \tbook = Spreadsheet::Workbook.new\n\t\tsheet = book.create_worksheet\n\t\t\n\t\tformat = Spreadsheet::Format.new :weight => :bold\n\t\t\n\t\tselected_measures = @current_user.selected_measures\n\t\t\n\t\tstart_date = Time.at(@period_start).strftime(\"%D\")\n end_date = Time.at(@effective_date).strftime(\"%D\")\n \n\t\t# table headers\n\t\tsheet.row(0).push 'NQF ID', 'Sub ID', 'Name', 'Subtitle', 'Numerator', 'Denominator', 'Exclusions', 'Percentage', 'Aggregate'\n\t\tsheet.row(0).default_format = format\n\t\tr = 1\n\t\t\n\t\tselected_provider = @selected_provider || Provider.where(:npi => params[:npi]).first\n\t\tproviders_for_filter = (selected_provider)? selected_provider._id.to_s : @providers.map{|pv| pv._id.to_s}\n\t\t\n\t\t# populate rows\n\t\tselected_measures.each do |measure|\n\t\t\tsubs_iterator(measure['subs']) do |sub_id|\n\t\t\t\tinfo = measure_info(measure['id'], sub_id)\n\n\t\t\t\tif selected_provider != nil\n\t\t\t\t\tquery = {:measure_id => measure['id'], :sub_id => sub_id, :effective_date => @effective_date, 'filters.providers' => [selected_provider._id.to_s] }\n\t\t\t\telse\n\t\t\t\t\tquery = {:measure_id => measure['id'], :sub_id => sub_id, :effective_date => @effective_date, 'filters.providers' => {'$all' => providers_for_filter}, 'filters.providers' => {'$size' => providers_for_filter.count} }\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tcache = MONGO_DB['query_cache'].find(query).first\n\t\t\t\tpercent = percentage(cache['NUMER'].to_f, cache['DENOM'].to_f)\n\t\t\t\tfull_percent = percentage(cache['full_numer'].to_f, cache['full_denom'].to_f)\n\t\t\t\tsheet.row(r).push info[:nqf_id], sub_id, info[:name], info[:subtitle], cache['NUMER'], cache['DENOM'], cache['DENEX'] , percent, full_percent \n\t\t\t\tr = r + 1;\n\t\t\tend\n\t\tend\n\t\n\t\ttoday = Time.now.strftime(\"%D\")\n\t\tif @selected_provider\n\t\t\tfilename = \"measure-report-\" + \"#{@selected_provider.npi}-\" + \"#{today}\" + \".xls\"\t\n\t\telse\t\n\t\t\tfilename = \"measure-report-\" + \"#{today}\" + \".xls\"\n\t\tend\n\t\tdata = StringIO.new '';\n\t\tbook.write data;\n\t\tsend_data(data.string, {\n\t\t :disposition => 'attachment',\n\t\t :encoding => 'utf8',\n\t\t :stream => false,\n\t\t :type => 'application/excel',\n\t\t :filename => filename\n\t\t})\n end", "title": "" }, { "docid": "44ae906e8fc4b738e57e62737a43d930", "score": "0.57231915", "text": "def get_number_of_columns\n sheet ||=self.sps_get_sheet\n colCount=sheet.root.elements['entry[1]/gs:colCount'].text\n \treturn colCount.to_i\n end", "title": "" }, { "docid": "1bcffae55004a62cd2248dd6aac92320", "score": "0.5719266", "text": "def calculate_extern_sizes\n ext_refs = @parser.get_ext_sheets\n ext_ref_count = ext_refs.keys.size\n length = 0\n index = 0\n\n @worksheets.each do |worksheet|\n\n rowmin = worksheet.title_rowmin\n colmin = worksheet.title_colmin\n filter = worksheet.filter_count\n key = \"#{index}:#{index}\"\n index += 1\n\n # Add area NAME records\n #\n if !worksheet.print_rowmin.nil? && worksheet.print_rowmin != 0\n if ext_ref[key].nil?\n ext_refs[key] = ext_ref_count\n ext_ref_count += 1\n end\n length += 31\n end\n\n # Add title NAME records\n #\n if rowmin and colmin\n if ext_ref[key].nil?\n ext_refs[key] = ext_ref_count\n ext_ref_count += 1\n end\n\n length += 46\n elsif rowmin or colmin\n if ext_ref[key].nil?\n ext_refs[key] = ext_ref_count\n ext_ref_count += 1\n end\n length += 31\n else\n # TODO, may need this later.\n end\n\n # Add Autofilter NAME records\n #\n if filter != 0\n if ext_refs[key].nil?\n ext_refs[key] = ext_ref_count\n ext_ref_count += 1\n end\n length += 31\n end\n end\n\n # Update the ref counts.\n @ext_ref_count = ext_ref_count\n @ext_refs = ext_refs\n\n # If there are no external refs then we don't write, SUPBOOK, EXTERNSHEET\n # and NAME. Therefore the length is 0.\n\n return length = 0 if ext_ref_count == 0\n\n # The SUPBOOK record is 8 bytes\n length += 8\n\n # The EXTERNSHEET record is 6 bytes + 6 bytes for each external ref\n length += 6 * (1 + ext_ref_count)\n\n return length\n end", "title": "" }, { "docid": "eda04c5001187977b5fe13218fd032dd", "score": "0.5717977", "text": "def nColumns()\n\tend", "title": "" }, { "docid": "ef41d75f9683576b57183ef663fa729a", "score": "0.57129854", "text": "def num_columns\n (width+1)/column_width\n end", "title": "" }, { "docid": "4daab4533ec2c5d9df27185cd06a30ea", "score": "0.5697051", "text": "def total_cells()\n\t\t\twidth * height\t\t\t\t\n\t\tend", "title": "" }, { "docid": "2a455cbe45ca99175c48be4a1c50e4cb", "score": "0.56581724", "text": "def calculate_extern_sizes # :nodoc:\n ext_refs = @parser.get_ext_sheets\n length = 0\n index = 0\n\n unless defined_names.empty?\n index = 0\n key = \"#{index}:#{index}\"\n\n add_ext_refs(ext_refs, key) unless ext_refs.has_key?(key)\n end\n\n defined_names.each do |defined_name|\n length += 19 + defined_name[:name].bytesize + defined_name[:formula].bytesize\n end\n\n @worksheets.each do |worksheet|\n key = \"#{index}:#{index}\"\n index += 1\n\n # Add area NAME records\n #\n if worksheet.print_range.row_min\n add_ext_refs(ext_refs, key) unless ext_refs[key]\n length += 31\n end\n\n # Add title NAME records\n #\n if worksheet.title_range.row_min && worksheet.title_range.col_min\n add_ext_refs(ext_refs, key) unless ext_refs[key]\n length += 46\n elsif worksheet.title_range.row_min || worksheet.title_range.col_min\n add_ext_refs(ext_refs, key) unless ext_refs[key]\n length += 31\n else\n # TODO, may need this later.\n end\n\n # Add Autofilter NAME records\n #\n unless worksheet.filter_count == 0\n add_ext_refs(ext_refs, key) unless ext_refs[key]\n length += 31\n end\n end\n\n # Update the ref counts.\n ext_ref_count = ext_refs.keys.size\n @ext_refs = ext_refs\n\n # If there are no external refs then we don't write, SUPBOOK, EXTERNSHEET\n # and NAME. Therefore the length is 0.\n\n return length = 0 if ext_ref_count == 0\n\n # The SUPBOOK record is 8 bytes\n length += 8\n\n # The EXTERNSHEET record is 6 bytes + 6 bytes for each external ref\n length += 6 * (1 + ext_ref_count)\n\n length\n end", "title": "" }, { "docid": "d65ab8a0b678d0775f256fc3cc74e362", "score": "0.56508654", "text": "def num_columns\n 20\n end", "title": "" }, { "docid": "53ba4490c2bb5568fcc56b2e4ab6328c", "score": "0.5650346", "text": "def col_count\n col_last - col_first + 1\n end", "title": "" }, { "docid": "da5343e9a2acd1dd9205846a8012af03", "score": "0.56439066", "text": "def column_span\n @automation_element.get_current_pattern(System::Windows::Automation::TableItemPattern.pattern).current.column_span.to_i\n end", "title": "" }, { "docid": "19aab7beb79397835f1aada4ca32cc49", "score": "0.56403637", "text": "def calculate_columns!\n span_count = columns_span_count\n columns_count = children.size\n\n all_margins_width = margin_size * (span_count - 1)\n column_width = (100.00 - all_margins_width) / span_count\n\n children.each_with_index do |col, i|\n is_last_column = i == (columns_count - 1)\n col.set_column_styles(column_width, margin_size, is_last_column)\n end\n end", "title": "" }, { "docid": "6ebd1788615575463a62930416283afe", "score": "0.5620363", "text": "def gstr_advance_receipt_line_count\n\tcolumns = 5\n\tcolumns+=1 if@gstr_advance_receipt.get_discount>0\n\tcolumns+=2 if@gstr_advance_receipt.has_tax_lines? \t\n\tcolumns\n\tend", "title": "" }, { "docid": "ce6901c0e116ad45d2ed945d5760f02f", "score": "0.5591926", "text": "def value_colspan\n @value_colspan ||= @report.items.map { |item| item[:value] }.map(&:count).max\n end", "title": "" }, { "docid": "296343d6ef9c9a2d0d318a5b3cc11351", "score": "0.55900973", "text": "def column_count\n @automation_element.get_current_pattern(System::Windows::Automation::GridPattern.pattern).current.column_count.to_i\n end", "title": "" }, { "docid": "fe19f2490f012f094d62be243eefc201", "score": "0.5561243", "text": "def data_description_sheet\n @book.worksheet(WBF[:columns_sheet])\n end", "title": "" }, { "docid": "e0b9348c8e323f8d1b1abb6078a89aab", "score": "0.5557685", "text": "def column_count; end", "title": "" }, { "docid": "e0b9348c8e323f8d1b1abb6078a89aab", "score": "0.5557685", "text": "def column_count; end", "title": "" }, { "docid": "e0b9348c8e323f8d1b1abb6078a89aab", "score": "0.5557685", "text": "def column_count; end", "title": "" }, { "docid": "04cdb16fe10fcb54169ef793df837bd1", "score": "0.5555314", "text": "def cells_per_column limit\n add RowFilter.cells_per_column(limit)\n end", "title": "" }, { "docid": "5a93255796d51ee03c8f4d4f4cbdd472", "score": "0.5554747", "text": "def write_guts\n # find the maximum outline_level in rows and columns\n row_outline_level = 0\n col_outline_level = 0\n if(row = @worksheet.rows.select{|x| x!=nil}.max{|a,b| a.outline_level <=> b.outline_level})\n row_outline_level = row.outline_level\n end\n if(col = @worksheet.columns.select{|x| x!=nil}.max{|a,b| a.outline_level <=> b.outline_level})\n col_outline_level = col.outline_level\n end\n # set data\n data = [\n 0, # Width of the area to display row outlines (left of the sheet), in pixel\n 0, # Height of the area to display column outlines (above the sheet), in pixel\n row_outline_level+1, # Number of visible row outline levels (used row levels+1; or 0,if not used)\n col_outline_level+1 # Number of visible column outline levels (used column levels+1; or 0,if not used)\n ]\n # write record\n write_op opcode(:guts), data.pack('v4')\n end", "title": "" }, { "docid": "a5fd3c73d81fde67708b686760e26f5a", "score": "0.5547524", "text": "def excel_max_col_size\n 0xFF\n end", "title": "" }, { "docid": "7dc915dbc91c2e08c6665bab0550e61d", "score": "0.55472004", "text": "def contract_price_matrix\n @workbook.add_worksheet(name: 'Contract Price Matrix') do |sheet|\n header_row_style = sheet.styles.add_style sz: 12, b: true, alignment: { wrap_text: true, horizontal: :center, vertical: :center }, border: { style: :thin, color: '00000000' }\n standard_column_style = sheet.styles.add_style sz: 12, alignment: { horizontal: :left, vertical: :center }, border: { style: :thin, color: '00000000' }\n standard_style = sheet.styles.add_style sz: 12, format_code: '£#,##0.00', border: { style: :thin, color: '00000000' }, alignment: { wrap_text: true, vertical: :center }\n total_style = sheet.styles.add_style sz: 12, format_code: '£#,##0.00', border: { style: :thin, color: '00000000' }, alignment: { wrap_text: true, vertical: :center }\n year_total_style = sheet.styles.add_style sz: 12, format_code: '£#,##0.00', border: { style: :thin, color: '00000000' }, alignment: { wrap_text: true, vertical: :center }\n variance_style = sheet.styles.add_style sz: 12, format_code: '£#,##0.00', border: { style: :thin, color: '00000000' }, alignment: { wrap_text: true, vertical: :center }\n\n sheet.add_row\n sheet.add_row ['Table 1. Baseline service costs for year 1']\n new_row = ['Service Reference', 'Service Name', 'Total']\n @active_procurement_buildings.each.with_index do |_k, idx|\n new_row << 'Building ' + (idx + 1).to_s\n end\n sheet.add_row new_row, style: header_row_style\n\n building_name_row = ['', '', '']\n @active_procurement_buildings.each { |building| building_name_row << sanitize_string_for_excel(building.building_name) }\n sheet.add_row building_name_row, style: header_row_style\n\n sorted_building_keys = @data.keys\n sumsum = 0\n sum_building = {}\n sum_building_cafm = {}\n sum_building_helpdesk = {}\n sum_building_variance = {}\n sum_building_tupe = {}\n sum_building_manage = {}\n sum_building_corporate = {}\n sum_building_profit = {}\n sum_building_mobilisation = {}\n sorted_building_keys.each do |k|\n sum_building[k] = 0\n sum_building_cafm[k] = 0\n sum_building_helpdesk[k] = 0\n sum_building_variance[k] = 0\n sum_building_tupe[k] = 0\n sum_building_manage[k] = 0\n sum_building_corporate[k] = 0\n sum_building_profit[k] = 0\n sum_building_mobilisation[k] = 0\n end\n\n @data.keys.collect { |k| @data[k].keys }\n .flatten.uniq\n .sort_by { |code| [code[0..code.index('.') - 1], code[code.index('.') + 1..-1].to_i] }.each do |s|\n new_row = [s, @rate_card_data[:Prices][@supplier_name.to_sym][s.to_sym][:'Service Name']]\n\n new_row2 = []\n sum = 0\n\n # this logic is to fix issue that the excel service prices were not aligned to the correct\n # building column, so insert nil into cell if no service data to align.\n\n sorted_building_keys.each do |k|\n new_row2 << nil if @data[k][s].nil?\n\n # If there's no service data for this service in this building, just move on\n\n next unless @data[k][s]\n\n new_row2 << @data[k][s][:subtotal1]\n sum += @data[k][s][:subtotal1]\n sum_building[k] += @data[k][s][:subtotal1]\n\n sum_building_cafm[k] += @data[k][s][:cafm]\n sum_building_helpdesk[k] += @data[k][s][:helpdesk]\n sum_building_variance[k] += @data[k][s][:variance]\n sum_building_tupe[k] += @data[k][s][:tupe]\n sum_building_manage[k] += @data[k][s][:manage]\n sum_building_corporate[k] += @data[k][s][:corporate]\n sum_building_profit[k] += @data[k][s][:profit]\n sum_building_mobilisation[k] += @data[k][s][:mobilisation]\n end\n\n sumsum += sum\n new_row = (new_row << sum << new_row2).flatten\n sheet.add_row new_row, style: standard_style\n end\n\n new_row = ['Planned Deliverables sub total', nil, sumsum]\n sorted_building_keys.each do |k|\n new_row << sum_building[k]\n end\n sheet.add_row new_row, style: standard_style\n\n sheet.add_row\n\n add_computed_row sheet, sorted_building_keys, 'CAFM', sum_building_cafm\n\n add_computed_row sheet, sorted_building_keys, 'Helpdesk', sum_building_helpdesk\n\n add_summation_row sheet, sorted_building_keys, 'Year 1 Deliverables sub total', 4\n sheet.add_row\n\n add_computed_row sheet, sorted_building_keys, 'London Location Variance', sum_building_variance\n\n add_summation_row sheet, sorted_building_keys, 'Year 1 Deliverables total', 3\n sheet.add_row\n\n add_computed_row sheet, sorted_building_keys, 'Mobilisation', sum_building_mobilisation\n\n add_computed_row sheet, sorted_building_keys, 'TUPE Risk Premium', sum_building_tupe\n\n add_summation_row sheet, sorted_building_keys, 'Total Charges excluding Overhead and Profit', 4\n sheet.add_row\n\n add_computed_row sheet, sorted_building_keys, 'Management Overhead', sum_building_manage\n\n add_computed_row sheet, sorted_building_keys, 'Corporate Overhead', sum_building_corporate\n\n add_summation_row sheet, sorted_building_keys, 'Total Charges excluding Profit', 4\n\n add_computed_row sheet, sorted_building_keys, 'Profit', sum_building_profit\n\n cell_refs = add_summation_row sheet, sorted_building_keys, 'Total Charges year 1', 2\n\n sheet.add_row\n sheet.add_row ['Table 2. Subsequent Years Total Charges']\n max_years =\n sorted_building_keys.collect { |k| @data[k].first[1][:contract_length_years] }.max\n\n if max_years > 1\n new_row = []\n sumsum = 0\n sorted_building_keys.each do |k|\n sum = @data[k].sum { |s| s[1][:subyearstotal] }\n new_row << sum\n sumsum += sum\n end\n\n (2..max_years).each do |i|\n new_row2 = [\"Year #{i}\", nil, sumsum]\n sheet.add_row new_row2, style: [standard_column_style, standard_column_style, standard_style]\n end\n end\n\n sheet.add_row\n add_summation_row sheet, sorted_building_keys, 'Total Charge (total contract cost)', max_years + 3, true\n sheet.add_row\n sheet.add_row ['Table 3. Total charges per month']\n new_row2 = ['Year 1 Monthly cost', nil, \"= #{cell_refs.first} / 12\"]\n sheet.add_row new_row2, style: [standard_column_style, standard_column_style, standard_style]\n\n if max_years > 1\n new_row = new_row.map { |x| x / 12 }\n (2..max_years).each do |i|\n new_row2 = [\"Year #{i} Monthly cost\", nil, sumsum / 12]\n sheet.add_row new_row2, style: [standard_column_style, standard_column_style, standard_style]\n end\n end\n\n service_count = @data.keys.collect { |k| @data[k].keys }.flatten.uniq.count\n # Service costs\n sheet[\"A#{service_count + 5}:C#{service_count + 5}\"].each { |c| c.style = total_style }\n sheet[\"A4:B#{service_count + 5}\"].each { |c| c.style = standard_column_style }\n sheet[\"A#{service_count + 7}:C#{service_count + 8}\"].each { |c| c.style = variance_style }\n sheet[\"A#{service_count + 9}:C#{service_count + 9}\"].each { |c| c.style = total_style }\n sheet[\"A#{service_count + 7}:B#{service_count + 9}\"].each { |c| c.style = standard_column_style }\n sheet[\"A#{service_count + 11}:C#{service_count + 11}\"].each { |c| c.style = variance_style }\n sheet[\"A#{service_count + 12}:C#{service_count + 12}\"].each { |c| c.style = total_style }\n sheet[\"A#{service_count + 11}:B#{service_count + 12}\"].each { |c| c.style = standard_column_style }\n sheet[\"A#{service_count + 14}:C#{service_count + 15}\"].each { |c| c.style = variance_style }\n sheet[\"A#{service_count + 16}:C#{service_count + 16}\"].each { |c| c.style = total_style }\n sheet[\"A#{service_count + 14}:B#{service_count + 16}\"].each { |c| c.style = standard_column_style }\n # Year 1 charges\n sheet[\"A#{service_count + 18}:C#{service_count + 19}\"].each { |c| c.style = variance_style }\n sheet[\"A#{service_count + 20}:C#{service_count + 20}\"].each { |c| c.style = total_style }\n sheet[\"A#{service_count + 21}:C#{service_count + 21}\"].each { |c| c.style = variance_style }\n sheet[\"A#{service_count + 22}:C#{service_count + 22}\"].each { |c| c.style = year_total_style }\n sheet[\"A#{service_count + 18}:B#{service_count + 22}\"].each { |c| c.style = standard_column_style }\n end\n end", "title": "" }, { "docid": "f6f448aade6889961cfc1a2835a700cf", "score": "0.5544885", "text": "def effective_col_visits\n @col_visits + @active_rowspans.first\n end", "title": "" }, { "docid": "4f77c27bfcd71fb13584385092ea403e", "score": "0.5544491", "text": "def colum\n\t\t@ncol\n\tend", "title": "" }, { "docid": "d579d2354db526f3aee95baaaa909645", "score": "0.5540319", "text": "def density\n (self.cell_count / column_count.to_f).round\n end", "title": "" }, { "docid": "aff233615221bd3d05496f3c2c35bd83", "score": "0.5531312", "text": "def column_count\n locate\n @cells.length\n end", "title": "" }, { "docid": "e80261c0f6099c945bcce9216b0a5643", "score": "0.5520231", "text": "def boundsheet_size\n name.size + 10\n end", "title": "" }, { "docid": "eefae250596a3e2310b511d936ee1bc0", "score": "0.5506715", "text": "def columns\n cell_items.size\n end", "title": "" }, { "docid": "eefae250596a3e2310b511d936ee1bc0", "score": "0.5506715", "text": "def columns\n cell_items.size\n end", "title": "" }, { "docid": "5036b77bd30b07b13542d1f141f2d9db", "score": "0.54912686", "text": "def cols; end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.5486554", "text": "def columns; end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.5486554", "text": "def columns; end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.5486554", "text": "def columns; end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.5486554", "text": "def columns; end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.5486554", "text": "def columns; end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.5486554", "text": "def columns; end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.5486554", "text": "def columns; end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.5486554", "text": "def columns; end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.5486554", "text": "def columns; end", "title": "" }, { "docid": "b39b1e0bc66ec90433e398244ee69740", "score": "0.5456158", "text": "def pages_per_sheet\n return @pages_per_sheet\n end", "title": "" }, { "docid": "b39b1e0bc66ec90433e398244ee69740", "score": "0.5456158", "text": "def pages_per_sheet\n return @pages_per_sheet\n end", "title": "" }, { "docid": "eacbc71fa6748dea3d4c503102a91681", "score": "0.54521596", "text": "def sheet_pr; end", "title": "" }, { "docid": "094a6406cb307fe451df43ffae5be20a", "score": "0.54494536", "text": "def sheet_format_pr; end", "title": "" }, { "docid": "186620ffc0bc9247607855b5d2b43cd9", "score": "0.5446391", "text": "def calc_total\r\n \ttotal = edit_exports_total\r\n \ttotal_pts_array = total.values\r\n \tindex = 1\r\n \ttotal_pts = 0\r\n \twhile index < total_pts_array.length\r\n total_pts += total_pts_array[index].to_i\r\n index += 1\r\n \tend\r\n \ttotal_pts\r\n end", "title": "" }, { "docid": "84caeabfe1963a62c4fb139370ca2fb4", "score": "0.5422695", "text": "def total_cells_without_bombs() \n\t\t\ttotal_cells() - total_bombs()\n\t\tend", "title": "" }, { "docid": "ad95f6894a0fd13b4d0782cf5a017e68", "score": "0.5420891", "text": "def kit_fill_metrics\n if can?(:>=, \"2\")\n headers['Content-Type'] = \"application/vnd.ms-excel\"\n headers['Content-Disposition'] = \"attachment; filename=Kit Fill Metrics Report.xls\"\n headers['Cache-Control'] = ''\n\n require 'writeexcel'\n workbook = WriteExcel.new(Rails.public_path+\"/excel/Kit Fill Metrics Report.xls\")\n worksheet = workbook.add_worksheet(\"kit_fill_metrics\")\n\n format = workbook.add_format(:border => 1,:valign => 'vcenter',\n :align => 'center')\n column_header_format = workbook.add_format(:border => 1,:valign => 'vcenter',\n :align => 'center')\n border = workbook.add_format(:border => 1)\n header = workbook.add_format\n\n ##Setting Format\n\n format.set_bold\n column_header_format.set_bold\n border.set_bottom(1)\n header.set_bold\n header.set_header('Big')\n\n ## Setting Columns and Headers\n worksheet.set_column(0, 0, 20)\n worksheet.set_column(0, 1, 20)\n worksheet.set_column(0, 2, 20)\n worksheet.set_column(0, 3, 20)\n worksheet.set_column('B:B', 35)\n worksheet.set_column('G:G', 35)\n worksheet.set_column('H:H', 30)\n worksheet.set_column('I:I', 30)\n worksheet.merge_range('A1:I2',\"Kit Fill Metrics Report\",format)\n worksheet.merge_range('A3:D4',\"Detail Metrics Report\",format)\n worksheet.merge_range('G3:I4',\"User Wise metrics\",format)\n\n ## Calculating row and column values Writing into Column Headers for Overall Detail metrics data.\n @row_value = 4\n @col_value = 0\n worksheet.write(@row_value, 0,\"Ship Date\",column_header_format)\n worksheet.write(@row_value, 1,\"User Name\",column_header_format)\n worksheet.write(@row_value, 2,\"Cups Filled\",column_header_format)\n worksheet.write(@row_value, 3,\"Kits Completed\", column_header_format)\n\n if ((params[\"kit_fill_metrics_begin_date\"]) == \"\") || ((params[\"kit_fill_metrics_end_date\"] == \"\"))\n worksheet.merge_range('A1:I2',\"Please Select Proper Date Range\",format)\n else\n ## Query for overall kit metrics user_wise + date_wise\n @kit_metrics = Kitting::KitOrderFulfillment.find_by_sql([\"SELECT TO_CHAR(KITTING_KIT_ORDER_FULFILLMENTS.UPDATED_AT, 'MM-DD-YYYY') AS completion_date,KITTING_KIT_ORDER_FULFILLMENTS.USER_NAME,\n SUM(KIT_FILLING_DETAILS.TURN_COUNT) AS Cups_Filled, COUNT(DISTINCT KITTING_KIT_ORDER_FULFILLMENTS.KIT_NUMBER) AS kits_completed\n FROM KITTING_KIT_ORDER_FULFILLMENTS\n INNER JOIN KIT_FILLING_DETAILS\n ON KITTING_KIT_ORDER_FULFILLMENTS.KIT_FILLING_ID = KIT_FILLING_DETAILS.KIT_FILLING_ID\n WHERE KITTING_KIT_ORDER_FULFILLMENTS.CUST_NO = ?\n AND KITTING_KIT_ORDER_FULFILLMENTS.UPDATED_AT BETWEEN ? AND ?\n GROUP BY TO_CHAR(KITTING_KIT_ORDER_FULFILLMENTS.UPDATED_AT, 'MM-DD-YYYY'),\n KITTING_KIT_ORDER_FULFILLMENTS.USER_NAME\n ORDER BY TO_DATE(TO_CHAR(KITTING_KIT_ORDER_FULFILLMENTS.UPDATED_AT, 'MM-DD-YYYY'), 'MM-DD-YYYY')\",\n current_customer.cust_no,\n Date.strptime(params[\"kit_fill_metrics_begin_date\"].to_s,\"%m%d%Y\").midnight, Date.strptime(params[\"kit_fill_metrics_end_date\"].to_s,\"%m%d%Y\").midnight + 1.day\n ])\n ## Writing actual kit metrics values in corresponding rows and columns.\n @kit_metrics.each_with_index do |kit_metric|\n @row_value = @row_value + 1\n worksheet.write(@row_value,0,kit_metric.completion_date,border)\n worksheet.write(@row_value,1,kit_metric.user_name,border)\n worksheet.write(@row_value,2,kit_metric.cups_filled,border)\n worksheet.write(@row_value,3,kit_metric.kits_completed,border)\n end\n\n ## Calculating row and column values Writing into Column Headers User-Wise metrics.\n @user_col_value = 6\n @user_row_value = 4\n worksheet.write(@user_row_value, 6,\"User Name\",column_header_format)\n worksheet.write(@user_row_value, 7,\"Total Cups Filled\",column_header_format)\n worksheet.write(@user_row_value, 8,\"Total Kits Completed\",column_header_format)\n\n ## Data for user wise metrics\n if @kit_metrics.length > 0\n @user_metrics_array = @kit_metrics.group_by(&:user_name).flatten\n\n ## Writing actual user wise metrics values in corresponding rows and columns.\n @user_cups_total = 0\n @user_kits_total = 0\n @user_metrics_array.each_with_index do |user_metric,user_metric_index|\n if user_metric_index%2 == 1\n @user_cups_total += user_metric.sum(&:cups_filled)\n @user_kits_total += user_metric.sum(&:kits_completed)\n @user_row_value = @user_row_value + 1\n worksheet.write(@user_row_value,6,user_metric.map(&:user_name).uniq,border)\n worksheet.write(@user_row_value,7,user_metric.sum(&:cups_filled),border)\n worksheet.write(@user_row_value,8,user_metric.sum(&:kits_completed),border)\n end\n end\n @user_row_value = @user_row_value + 1\n worksheet.write(@user_row_value, 6,\"Total\",column_header_format)\n worksheet.write(@user_row_value, 7,@user_cups_total,border)\n worksheet.write(@user_row_value, 8,@user_kits_total,border)\n end\n\n ## Calculating row and column values Writing into Column Headers for Date-Wise metrics.\n @date_row_value = @user_row_value + 3\n @date_headers_value = @user_row_value + 4\n @date_col_value = 6\n worksheet.merge_range(\"G#{@date_row_value}:I#{@date_row_value + 1}\", \"Date Wise metrics\",format)\n worksheet.write(@date_headers_value, 6,\"Ship Date\",column_header_format)\n worksheet.write(@date_headers_value, 7,\"Total Cups Filled\",column_header_format)\n worksheet.write(@date_headers_value, 8,\"Total Kits Completed\",column_header_format)\n @date_row_value = @date_row_value + 1\n\n ## Data for Date wise metrics\n if @kit_metrics.length > 0\n @date_metrics_array = @kit_metrics.group_by(&:completion_date).flatten\n\n ## Writing actual user wise metrics values in corresponding rows and columns.\n @date_wise_cups_total = 0\n @date_wise_kits_total = 0\n @date_metrics_array.each_with_index do |date_metric,date_metric_index|\n if date_metric_index%2 == 1\n @date_wise_cups_total += date_metric.sum(&:cups_filled)\n @date_wise_kits_total += date_metric.sum(&:kits_completed)\n @date_row_value = @date_row_value + 1\n worksheet.write(@date_row_value,6,date_metric.map(&:completion_date).uniq,border)\n worksheet.write(@date_row_value,7,date_metric.sum(&:cups_filled),border)\n worksheet.write(@date_row_value,8,date_metric.sum(&:kits_completed),border)\n end\n end\n @date_row_value = @date_row_value + 1\n worksheet.write(@date_row_value, 6,\"Total\",column_header_format)\n worksheet.write(@date_row_value, 7,@date_wise_cups_total,border)\n worksheet.write(@date_row_value, 8,@date_wise_kits_total,border)\n end\n workbook.close\n send_file Rails.public_path+\"/excel/Kit Fill Metrics Report.xls\",\n :disposition => \"attachment\"\n end\n end\n end", "title": "" }, { "docid": "db0c356eba4705d3d55c1c1c7f6fce8a", "score": "0.5420881", "text": "def column_limit_reached?\n column_width_calculator.total(:width_xl) >= 12\n end", "title": "" }, { "docid": "12261572c1c5a8cede450b550ca9d205", "score": "0.54195774", "text": "def column_size; end", "title": "" }, { "docid": "40eab38c5fd852d07ae7392e00ef3713", "score": "0.5413205", "text": "def add_rows(sheet)\n\n idx = 5\n sheet.add_row\n sheet.add_row\n sheet.add_row ['1. Revenue Vehicles - Percent of revenue vehicles that have met or exceeded their useful life benchmark'] + ['']*5\n sheet.merge_cells \"A#{idx-2}:F#{idx-2}\"\n sheet.add_row subheader_row\n\n FtaVehicleType.active.each do |fta_vehicle_type|\n ntd_performance_measure = @ntd_report.ntd_performance_measures.where(is_group_measure: @is_group_report).find_by(fta_asset_category: FtaAssetCategory.find_by(name: 'Revenue Vehicles'), asset_level: \"#{fta_vehicle_type.code} - #{fta_vehicle_type.name}\")\n\n puts ntd_performance_measure.inspect\n\n sheet.add_row [\"#{fta_vehicle_type.code} - #{fta_vehicle_type.name}\", ntd_performance_measure.try(:pcnt_goal), ntd_performance_measure.try(:pcnt_performance), \"=C#{idx}-B#{idx}\", ntd_performance_measure.try(:future_pcnt_goal), ntd_performance_measure ? nil : 'N/A']\n idx += 1\n end\n\n idx += 3\n sheet.add_row\n sheet.add_row ['2. Service Vehicles - Percent of service vehicles that have met or exceeded their useful life benchmark'] + ['']*5\n sheet.merge_cells \"A#{idx-2}:F#{idx-2}\"\n sheet.add_row subheader_row\n FtaSupportVehicleType.active.each do |fta_vehicle_type|\n ntd_performance_measure = @ntd_report.ntd_performance_measures.where(is_group_measure: @is_group_report).find_by(fta_asset_category: FtaAssetCategory.find_by(name: 'Equipment'), asset_level: fta_vehicle_type.name)\n\n sheet.add_row [fta_vehicle_type.name, ntd_performance_measure.try(:pcnt_goal), ntd_performance_measure.try(:pcnt_performance), \"=C#{idx}-B#{idx}\", ntd_performance_measure.try(:future_pcnt_goal), ntd_performance_measure ? nil : 'N/A']\n idx += 1\n end\n\n idx += 3\n fta_asset_category = FtaAssetCategory.find_by(name: 'Facilities')\n sheet.add_row\n sheet.add_row ['3. Facility - Percent of facilities rated 3 or below on the condition scale'] + ['']*5\n sheet.merge_cells \"A#{idx-2}:F#{idx-2}\"\n sheet.add_row subheader_row\n FtaAssetClass.where(fta_asset_category: fta_asset_category).active.each do |fta_class|\n ntd_performance_measure = @ntd_report.ntd_performance_measures.where(is_group_measure: @is_group_report).find_by(fta_asset_category: fta_asset_category, asset_level: fta_class.name)\n\n sheet.add_row [fta_class.name, ntd_performance_measure.try(:pcnt_goal), ntd_performance_measure.try(:pcnt_performance), \"=C#{idx}-B#{idx}\", ntd_performance_measure.try(:future_pcnt_goal), ntd_performance_measure ? nil : 'N/A']\n idx += 1\n end\n\n idx += 3\n sheet.add_row\n sheet.add_row ['4. Infrastructure - Percent of track segments with performance restrictions'] + ['']*5\n sheet.merge_cells \"A#{idx-2}:F#{idx-2}\"\n sheet.add_row subheader_row\n FtaModeType.active.each do |fta_mode_type|\n ntd_performance_measure = @ntd_report.ntd_performance_measures.where(is_group_measure: @is_group_report).find_by(fta_asset_category: FtaAssetCategory.find_by(name: 'Infrastructure'), asset_level: fta_mode_type.to_s)\n\n sheet.add_row [fta_mode_type.to_s, ntd_performance_measure.try(:pcnt_goal), ntd_performance_measure.try(:pcnt_performance), \"=C#{idx}-B#{idx}\", ntd_performance_measure.try(:future_pcnt_goal), ntd_performance_measure ? nil : 'N/A']\n idx += 1\n end\n\n end", "title": "" }, { "docid": "f5e2b3aa50b09066731d3e5b040ecee7", "score": "0.54004747", "text": "def ncols\r\n @df.keys.length\r\n end", "title": "" }, { "docid": "85dea654f409a14dbe75fe82cc2f3751", "score": "0.53819597", "text": "def header_cells; end", "title": "" }, { "docid": "85dea654f409a14dbe75fe82cc2f3751", "score": "0.53819597", "text": "def header_cells; end", "title": "" }, { "docid": "df02a5a768766bc90929defe64b8a179", "score": "0.53814244", "text": "def single_sided_sheet_count\n return @single_sided_sheet_count\n end", "title": "" }, { "docid": "03c4f4597094dd3b9688bc9e6abf9e97", "score": "0.53789085", "text": "def profitability_total_cost_summary(user_id, view, farm_id, year, start_date, stop_date, task_stage)\n \n move_down 20\n\n \n rowcount = 0\n\n table profitability_total_cost_summary_rows(user_id, view, farm_id, year, start_date, stop_date, task_stage), :row_colors => [ \"FFFFFF\"], :cell_style => {:border_width => 0, :size => 7, :text_color => \"346842\" } do \n row(0).font_style = :bold\n \n row(rowcount).size = 8\n columns(0).width = 100\n columns(0).font_style = :bold\n columns(1..5).width = 70\n columns(0).align = :left\n columns(1..5).align = :right\n \n \n self.header = false\n rowcount += 1\n end\n \n\n end", "title": "" }, { "docid": "609e6e1cc45d2271f3ae41e26c62a996", "score": "0.53770065", "text": "def columns_info\n return @columns if defined? @columns\n\n @columns = []\n data_description_sheet.each(1) do |row|\n @columns << row.take(9).collect { |c| c.to_s.squish } unless row[0].blank?\n end\n @columns\n end", "title": "" }, { "docid": "da6e30364b78e0446f099a356e1e4b51", "score": "0.53622985", "text": "def column_count\r\n end", "title": "" }, { "docid": "da6e30364b78e0446f099a356e1e4b51", "score": "0.53622985", "text": "def column_count\r\n end", "title": "" }, { "docid": "d2739c451656e70be0b41f46dff2a9fe", "score": "0.53622794", "text": "def columns\n if defined? @columns\n @columns\n else\n 150\n end\n end", "title": "" }, { "docid": "a21e76fb3820b287ab8fd4cce22484d9", "score": "0.53616035", "text": "def total_width\n if empty?\n 0\n else\n @page_data.inject(@page_data.length-1) do |sum, column|\n sum + column.column_width\n end\n end\n end", "title": "" }, { "docid": "9ed9ccc8ac0758906be93bc0a6f53301", "score": "0.53463703", "text": "def max_columns;\n (params.size / max_lines.to_f).ceil;\n end", "title": "" }, { "docid": "83f53099712ffd99307ec29df27cfca8", "score": "0.5344964", "text": "def columns_per_multicolumn_index\n 31\n end", "title": "" }, { "docid": "3658f94cfb8546b8dd65007f4c16f290", "score": "0.53382725", "text": "def num_cols\n reload() if !@cells\n return @cells.keys.map(){ |_, c| c }.max || 0\n end", "title": "" }, { "docid": "41f02eee691eab04876b398988c551d1", "score": "0.5337032", "text": "def total_sheets_needed\n if (net_area/sheet_size) < 1\n return 1\n else\n self.sheets_needed = (net_area/sheet_size)\n end\n end", "title": "" }, { "docid": "27eb5e5ba56c15b65cf5fbfcaaeec84a", "score": "0.53270036", "text": "def export_report format_type='table'\n puts '--'*30\n puts 'Report Summary'\n puts '--'*30\n \n @report_list.each { |test_case| puts test_case.join(\"\\t\\t\")}\n \n \n book = Spreadsheet::Workbook.new\n sheet1 = book.create_worksheet :name=> 'Report Summary'\n \n sheet1.column(0).width = 50 # column width of case_name \n\n \n sheet1.row(0).push \n \n @report_list.each_with_index do |test_case, idx|\n if format_type == 'table'\n export_table_format(test_case, sheet1, idx)\n else\n export_xml_csv_format(test_case, sheet1, idx)\n end\n end\n book.write(@output_pathname)\n end", "title": "" }, { "docid": "75fbb7046d7c1a5dc2d2a7e75c464316", "score": "0.53260005", "text": "def ncols\r\n Backend.active.ncols(@m)\r\n end", "title": "" }, { "docid": "280a3d5f9fd0d5bdf6f4e258780e2dbf", "score": "0.53250456", "text": "def export_sheet\n bold = Spreadsheet::Format.new weight: :bold, vertical_align: :middle\n center = Spreadsheet::Format.new horizontal_align: :centre, vertical_align: :middle\n center_bold = Spreadsheet::Format.new horizontal_align: :centre,\n vertical_align: :centre,\n weight: :bold\n border = Spreadsheet::Format.new border: :thin, vertical_align: :middle\n\n route_book = Spreadsheet::Workbook.new\n route_sheet = route_book.create_worksheet name: self.name\n\n route_sheet.default_format = Spreadsheet::Format.new(vertical_align: :middle)\n route_sheet.pagesetup[:orientation] = :landscape\n\n route_sheet.column(0).width = 5\n route_sheet.column(1).width = 35\n (2..5).each { |inx| route_sheet.column(inx).width = 10 }\n #route_sheet.column(6).width = 1\n route_sheet.column(6).width = 45\n\n\n 8.times { |inx| route_sheet.row(0).update_format(inx, weight: :bold) }\n\n route_sheet[0, 0] = self.name\n route_sheet[0, 2] = 'Numer rejestracyjny pojazdu'\n route_sheet[0, 6] = 'Data'\n\n route_sheet.row(0).height = 20\n route_sheet.merge_cells(0, 2, 0, 5)\n route_sheet.merge_cells(0, 0, 0, 1)\n\n route_sheet.row(1).height = 12\n route_sheet.merge_cells(1, 2, 1, 5)\n route_sheet.merge_cells(1, 0, 1, 1)\n\n\n route_sheet[2, 0] = 'Lp.'\n route_sheet[2, 1] = 'Lokalizacja'\n route_sheet[2, 2] = 'Rodzaj asortymentu'\n #route_sheet[2, 6] = \"Typ pojemnika\"\n route_sheet[2, 6] = 'Uwagi'\n route_sheet.merge_cells(2, 2, 2, 5)\n 8.times { |inx| route_sheet.row(2).update_format(inx, weight: :bold, horizontal_align: :centre) }\n\n\n route_sheet[3, 2] = 'SzB.'\n route_sheet[3, 3] = 'SzK.'\n route_sheet[3, 4] = 'Tw.'\n route_sheet[3, 5] = 'Mak.'\n\n (2..5).each { |inx| route_sheet.row(3).update_format(inx, weight: :bold, horizontal_align: :centre) }\n route_sheet.merge_cells(2, 0, 3, 0)\n route_sheet.merge_cells(2, 1, 3, 1)\n route_sheet.merge_cells(2, 6, 3, 6)\n #route_sheet.merge_cells(2, 7, 3, 7)\n\n route_sheet.row(2).height = 16\n route_sheet.row(3).height = 16\n\n cont_inx = 1\n row_inx = 4\n self.containers.each do |container|\n route_sheet[row_inx, 0] = cont_inx\n street = container.street\n if container.description.present?\n street += \" (#{container.description})\"\n end\n route_sheet[row_inx, 1] = street\n route_sheet[row_inx, 2] = container.clear_glass_containers\n route_sheet[row_inx, 3] = container.colorful_glass_containers\n route_sheet[row_inx, 4] = container.plastic_containers\n route_sheet[row_inx, 5] = container.maculature_containers\n # route_sheet[row_inx, 6] = container.container_type\n route_sheet[row_inx, 6] = container.details\n\n route_sheet.row(row_inx).update_format(0, horizontal_align: :centre)\n (2..5).each {|inx| route_sheet.row(row_inx).update_format(inx, vertical_align: :middle) }\n route_sheet.row(row_inx).update_format(6, horizontal_align: :centre)\n route_sheet.row(row_inx).height = 18\n cont_inx += 1\n row_inx += 1\n end\n\n route_sheet[row_inx, 1] = 'Legenda:'\n route_sheet[row_inx, 2] = 'P - połowa, F - full, C - ćwiartka'\n route_sheet.merge_cells(row_inx, 2, row_inx, 6)\n 8.times { |inx| route_sheet.row(row_inx).update_format(inx, weight: :bold, horizontal_align: :centre) }\n route_sheet.row(row_inx).height = 20\n row_inx += 1\n\n 0.upto(row_inx).each do |row_inx|\n (0..6).each do |col_inx|\n route_sheet.row(row_inx).update_format(col_inx, border: :thin)\n end\n end\n route_book\n end", "title": "" }, { "docid": "e94374098d47e13b101e289e1ed89f43", "score": "0.5321073", "text": "def endCol; @col + @width - 1; end", "title": "" }, { "docid": "aae8c979afbc350777d04b9627effd74", "score": "0.5321035", "text": "def density\n cc = self.column_count\n cc = self.parent.column_count if cc == 0\n (self.number_of_unmasked_cells / cc.to_f).round\n end", "title": "" }, { "docid": "3be1938077af78e0a9c6ee854d81fa31", "score": "0.53115773", "text": "def sheet; end", "title": "" }, { "docid": "1b0cb4eb7e4fac9cd34dc2fffc25e06d", "score": "0.5306589", "text": "def calculate_column_width col\n ret = @cw[col] || 2\n ctr = 0\n @list.each_with_index { |r, i| \n #next if i < @toprow # this is also a possibility, it checks visible rows\n break if ctr > 10\n ctr += 1\n next if r == :separator\n c = r[col]\n x = c.to_s.length\n ret = x if x > ret\n }\n ret\n end", "title": "" }, { "docid": "c75fe1d316d6eff3cc05f87e4ec3cea2", "score": "0.5303373", "text": "def num_cols\n reload() if !@cells\n return @cells.keys.map(){ |r, c| c }.max || 0\n end", "title": "" }, { "docid": "86b1de664cc39229dc3dc7a189f3215b", "score": "0.5299585", "text": "def double_sided_sheet_count\n return @double_sided_sheet_count\n end", "title": "" }, { "docid": "44b74bf8e343ac145f7413fff29200ff", "score": "0.52993864", "text": "def do_total(ws,m,iRow,iCol,bDoAverage=false,bDbg=false)\n\n\t\tif (bDbg)\n\t\t\tp \"mois #{m}\"\n\t\t\tp \"est un trimestre\" if ( q = (m+1).modulo(3) ) === 0\n\t\t\tp \"est un semestre\" if ( q = (m+1).modulo(6) ) === 0\n\t\t\tp \"est une année\" if ( q = (m+1).modulo(12) ) === 0\n\t\t\tp \"Row #{iRow}, Col #{iCol}\"\n\t\tend\n\t\t\n\t\tif ( q = (m+1).modulo(3) ) === 0 #trimestre\n\t\t\tif (false === bDoAverage)\n\t\t\t\tself.xl_total(ws,iRow, iCol,iCol-3,iRow,iCol-1,iRow)\n\t\t\telse\n\t\t\t\tws.Cells(iRow, iCol).Formula = \"=si(3-NB.SI(#{(iCol-3).alph}#{iRow}:#{(iCol-1).alph}#{iRow};0)=0;0;(#{(iCol-3).alph}#{iRow}+#{(iCol-2).alph}#{iRow}+#{(iCol-1).alph}#{iRow}) / (3-NB.SI(#{(iCol-3).alph}#{iRow}:#{(iCol-1).alph}#{iRow};0)))\"\n\t\t\t#ws.Columns('D:I').Interior.Color = 6\n\t\t\tend\n\t\t\tws.Cells(iRow,iCol).NumberFormat = ws.Cells(iRow,iCol-1).NumberFormat unless ws.Cells(iRow,iCol-1).NumberFormat.length == 0\n\t\t\tiCol+=1\n\t\tend\n\t\tif ( q = (m+1).modulo(6) ) === 0 #semestre\n\t\t\tif (false === bDoAverage)\n\t\t\t\tws.Cells(iRow, iCol).Formula = \"=#{(iCol-5).alph}#{iRow}+#{(iCol-1).alph}#{iRow}\"\n\t\t\telse\n\t\t\t\tws.Cells(iRow, iCol).Formula = \"=si(#{(iCol-5).alph}#{iRow}+#{(iCol-1).alph}#{iRow}=0;0;si(#{(iCol-5).alph}#{iRow}=0;#{(iCol-1).alph}#{iRow};si(#{(iCol-1).alph}#{iRow}=0;#{(iCol-5).alph}#{iRow};(#{(iCol-5).alph}#{iRow}+#{(iCol-1).alph}#{iRow})/2)))\"\n\t\t\tend\n\t\t\t#precaution\n\t\t\tws.Cells(iRow,iCol).NumberFormat = ws.Cells(iRow,iCol-1).NumberFormat unless ws.Cells(iRow,iCol-1).NumberFormat.length == 0\n\t\t\tiCol+=1\n\t\tend\n\t\tif ( q = (m+1).modulo(12) ) === 0 #année\n\t\t\tif (false === bDoAverage)\n\t\t\t\tws.Cells(iRow, iCol).Formula = \"=#{(iCol-10).alph}#{iRow}+#{(iCol-1).alph}#{iRow}\"\n\t\t\telse\n\t\t\t\tws.Cells(iRow, iCol).Formula = \"=si(#{(iCol-10).alph}#{iRow}+#{(iCol-1).alph}#{iRow}=0;0;si(#{(iCol-10).alph}#{iRow}=0;#{(iCol-1).alph}#{iRow};si(#{(iCol-1).alph}#{iRow}=0;#{(iCol-10).alph}#{iRow};(#{(iCol-10).alph}#{iRow}+#{(iCol-1).alph}#{iRow})/2)))\"\n\t\t\tend\n\t\t\t#ap ws.Cells(iRow,iCol-1).NumberFormat\n\t\t\t#precaution\n\t\t\tws.Cells(iRow,iCol).NumberFormat = ws.Cells(iRow,iCol-1).NumberFormat unless ws.Cells(iRow,iCol-1).NumberFormat.length == 0\n\t\t\tiCol+=1\n\t\tend\t\n\t\treturn iCol\n\tend", "title": "" }, { "docid": "8015d624b9b527e858a5dd5aee8bc7a4", "score": "0.52986145", "text": "def columns\n table_cells.size\n end", "title": "" }, { "docid": "12cc16f6bc30f0bf2777e296cfe32622", "score": "0.52895474", "text": "def number_of_sales\n end", "title": "" }, { "docid": "7393662f3d66459e984409656dca0734", "score": "0.52881634", "text": "def add_rows(sheet)\n idx = 2\n sheet.add_row subheader_row\n\n ## Rolling Stock Section\n section_number = 1 \n section_name = 'Rolling Stock - Percent of revenue vehicles that have met or exceeded their useful life benchmark'\n FtaVehicleType.active.each do |fta_vehicle_type|\n ntd_performance_measure = @ntd_report.ntd_performance_measures.where(is_group_measure: @is_group_report).find_by(fta_asset_category: FtaAssetCategory.find_by(name: 'Revenue Vehicles'), asset_level: \"#{fta_vehicle_type.code} - #{fta_vehicle_type.name}\")\n\n puts ntd_performance_measure.inspect\n\n na = ntd_performance_measure ? \"No\" : 'Yes'\n pcnt_goal = (na == \"No\") ? ntd_performance_measure.try(:pcnt_goal) : \"N/A\"\n #pcnt_goal = (na == \"No\") ? 5000 : \"N/A\"\n difference = (na == \"No\") ? \"=E#{idx}-D#{idx}\" : nil \n\n sheet.add_row [section_number, section_name, \"#{fta_vehicle_type.code} - #{fta_vehicle_type.name}\", pcnt_goal, ntd_performance_measure.try(:pcnt_performance), difference, ntd_performance_measure.try(:future_pcnt_goal), na]\n idx += 1\n end\n\n ## Equipment Section\n section_number = 2\n section_name = 'Equipment - Percent of service vehicles that have met or exceeded their useful life benchmark'\n FtaSupportVehicleType.active.each do |fta_vehicle_type|\n ntd_performance_measure = @ntd_report.ntd_performance_measures.where(is_group_measure: @is_group_report).find_by(fta_asset_category: FtaAssetCategory.find_by(name: 'Equipment'), asset_level: fta_vehicle_type.name)\n\n na = ntd_performance_measure ? \"No\" : 'Yes'\n pcnt_goal = (na == \"No\") ? ntd_performance_measure.try(:pcnt_goal) : \"N/A\"\n difference = (na == \"No\") ? \"=E#{idx}-D#{idx}\" : nil \n\n sheet.add_row [section_number, section_name, fta_vehicle_type.name, pcnt_goal, ntd_performance_measure.try(:pcnt_performance), difference, ntd_performance_measure.try(:future_pcnt_goal), na]\n idx += 1\n end\n\n ## Facilities Section\n section_number = 3\n fta_asset_category = FtaAssetCategory.find_by(name: 'Facilities')\n section_name = 'Facility - Percent of facilities rated below 3 on the condition scale'\n groups = [\n {\n name: 'Passenger / Parking Facilities', \n codes: ['passenger_facility', 'parking_facility']\n },\n {\n name: 'Administrative / Maintenance Facilities', \n codes: ['admin_facility', 'maintenance_facility']\n }\n ]\n groups.each do |group| \n pcnt_goal_sum = nil\n pcnt_performance_sum = nil\n future_pcnt_goal_sum = nil\n na = \"Yes\" \n count = 0\n FtaAssetClass.where(fta_asset_category: fta_asset_category, code: group[:codes]).active.each do |fta_class|\n asset_level = \"#{fta_class.code} - #{fta_class.name}\"\n ntd_performance_measure = @ntd_report.ntd_performance_measures.where(is_group_measure: @is_group_report).find_by(fta_asset_category: fta_asset_category, asset_level: asset_level)\n if ntd_performance_measure\n pcnt_goal_sum = pcnt_goal_sum.to_f + ntd_performance_measure.try(:pcnt_goal).to_f\n pcnt_performance_sum = pcnt_performance_sum.to_f + ntd_performance_measure.try(:pcnt_performance).to_f\n future_pcnt_goal_sum = future_pcnt_goal_sum.to_f + ntd_performance_measure.try(:future_pcnt_goal).to_f\n na = \"No\"\n count += 1\n\n end\n end\n\n pcnt_goal = (na == \"No\") ? safe_avg(pcnt_goal_sum, count) : \"N/A\"\n difference = (na == \"No\") ? \"=E#{idx}-D#{idx}\" : nil \n\n sheet.add_row [section_number, section_name, group[:name], pcnt_goal, safe_avg(pcnt_performance_sum, count), difference, safe_avg(future_pcnt_goal_sum, count), na]\n idx += 1\n end\n\n ## Infrastructure Section\n section_number = 4\n section_name = \"Infrastructure - Percent of track segments with performance restrictions\"\n FtaModeType.active.each do |fta_mode_type|\n ntd_performance_measure = @ntd_report.ntd_performance_measures.where(is_group_measure: @is_group_report).find_by(fta_asset_category: FtaAssetCategory.find_by(name: 'Infrastructure'), asset_level: fta_mode_type.to_s)\n\n na = ntd_performance_measure ? \"No\" : 'Yes'\n pcnt_goal = (na == \"No\") ? ntd_performance_measure.try(:pcnt_goal) : \"N/A\"\n difference = (na == \"No\") ? \"=E#{idx}-D#{idx}\" : nil \n\n sheet.add_row [section_number, section_name, fta_mode_type.to_s, pcnt_goal, ntd_performance_measure.try(:pcnt_performance), difference, ntd_performance_measure.try(:future_pcnt_goal), na]\n idx += 1\n end\n\n end", "title": "" }, { "docid": "525af68308badb4f32347e568105f7ef", "score": "0.5283963", "text": "def calculate\n\n # First run the numbers - simple for report types that can be\n # column-width-grouped by the database, tricky for things such as\n # \"UK tax year\".\n\n if ( @frequency_data[ :manual_columns ] )\n @column_ranges.each_with_index do | range |\n run_sums_for_range( range, range.min )\n end\n else\n run_sums_for_range( @range )\n end\n\n # Now set up a few things based on the result of report calculation.\n #\n # If zero-total rows are being omitted, the Section engine will end\n # up reporting incorrect values for start-of-group/section, should\n # that start-of-<x> task lie in a row that has a zero total and will\n # thus be omitted. We must take steps to fix that. It's easy enough\n # since rows only exist at this point if their total is non-zero\n # anyway, so we just iterate over existing rows to get the non-zero\n # task list.\n #\n # We can use the same loop to work out the task statistics while we\n # are here - the total task duration, the remaining time based on\n # committed hours and the potential remaining based on not committed\n # hours as well.\n\n non_zero_tasks = []\n @total_duration = BigDecimal.new( 0 );\n @total_actual_remaining = BigDecimal.new( 0 );\n @total_potential_remaining = BigDecimal.new( 0 );\n\n each_row do | row, task |\n non_zero_tasks << task\n\n @total_duration += task.duration\n\n unless task.duration.zero?\n task_actual_remaining = task.duration - ( row.try( :committed ) || 0 )\n task_potential_remaining = task.duration - ( row.try( :total ) || 0 )\n\n @total_actual_remaining += task_actual_remaining\n @total_potential_remaining += task_potential_remaining\n end\n end\n\n if ( @exclude_zero_rows )\n reassess_start_flags_using( non_zero_tasks ) # TrackRecordSections::SectionsMixin\n end\n\n # Cache the non-zero column date based keys to speed up column\n # iterators. If hiding zero columns, only columns defined in the\n # 'column_totals' hash should be used, so iterate via its set of\n # keys; else iterate over all available column keys.\n #\n # Can't just use e.g. \"@column_keys.keys.sort\" to try and get at an\n # ordered set of non-zero column keys, as the keys don't sort quite\n # how we expect (e.g. [\"2013\",\"30\"] comes before [\"2013\",\"4\"], with\n # effects similarly variable for all the different, unpredictable\n # column keys that FREQUENCY can produce).\n\n @relevant_column_keys = if @exclude_zero_cols\n @column_keys.select do | key |\n @column_totals.has_key?( key )\n end\n else\n @column_keys\n end\n\n # A similar thing happens for zero columns in user-based reports.\n # The \"@user_totals\" hash comes in via the inheritance from the\n # CalculatorWithUsers class.\n\n if ( @exclude_zero_cols )\n @filtered_users = User.where( :id => @user_totals.keys ) unless @users.count.zero?\n else\n @filtered_users = @users.dup\n end\n\n # Finally, collapse all internal relations to the actual lists of\n # objects. Downstream report clients are many and varied and will\n # iterate over this data in all sorts of ways; benchmarking shows\n # that leaving these as relations in perpetuity results in\n # significantly worse performance (e.g. one example heavy test\n # case reduced request time from around 1600ms to 1350ms).\n\n @tasks = @tasks.try( :all ) if ( @tasks.is_a? ActiveRecord::Relation )\n @users = @users.try( :all ) if ( @users.is_a? ActiveRecord::Relation )\n @filtered_tasks = @filtered_tasks.try( :all ) if ( @filtered_tasks.is_a? ActiveRecord::Relation )\n @filtered_users = @filtered_users.try( :all ) if ( @filtered_users.is_a? ActiveRecord::Relation )\n end", "title": "" }, { "docid": "fcf13c89e9fe7e16cde06e84580b6a31", "score": "0.5283718", "text": "def grand_total( source_set, val_cols )\n result_set = Array.new( val_cols, 0 )\n unless source_set.nil? then\n source_set.each do |src|\n (-val_cols..-1).each{ |i| result_set[ i ] += src[ i ] }\n end\n end\n result_set\n end", "title": "" }, { "docid": "0f3c8492d86c021ea6a1a7ae552aa2bd", "score": "0.52822626", "text": "def add_columns(sheet)\n ###### MODIFY THIS SECTION ###############\n # add columns\n #add_column(sheet, column_index, name, col_style, data_validation={})\n\n\n ######### END MODIFY THIS SECTION ##############\n end", "title": "" }, { "docid": "aa4f297811c837d397d5482d52541636", "score": "0.52797586", "text": "def generate_empty_score_file\r\n out_excel = Axlsx::Package.new\r\n wb = out_excel.workbook\r\n \r\n wb.add_worksheet name: \"使用说明\", state: :hidden do |sheet|\r\n\r\n end\r\n\r\n # list sheet\r\n grade_number = 0\r\n wb.add_worksheet name: \"grade_list\", state: :hidden do |sheet|\r\n #grade \r\n Common::Grade::List.each{|k,v|\r\n sheet.add_row [v]\r\n }\r\n grade_number = Common::Grade::List.size\r\n end\r\n\r\n # list sheet\r\n classroom_number = 0\r\n wb.add_worksheet name: \"classroom_list\", state: :hidden do |sheet|\r\n #classroom \r\n Common::Klass::List.each{|k,v|\r\n sheet.add_row [v]\r\n }\r\n classroom_number = Common::Klass::List.size\r\n end\r\n\r\n # list sheet\r\n wb.add_worksheet name: \"sex_list\", state: :hidden do |sheet|\r\n #grade \r\n Common::Locale::SexList.each{|k,v|\r\n sheet.add_row [v]\r\n }\r\n end\r\n\r\n # area sheet\r\n province_list = []\r\n province_cell = nil\r\n city_list = []\r\n city_cell = nil\r\n district_list = []\r\n district_last = nil\r\n #wb.add_worksheet name: \"area_list\" , state: :hidden do |sheet|\r\n wb.add_worksheet name: \"area_list\", state: :hidden do |sheet|\r\n File.open(Rails.root.to_s + \"/public/area.txt\", \"r\") do |f|\r\n f.each_line do |line|\r\n arr = line.split(\" \")\r\n province_list << arr[0]\r\n city_list << arr[1]\r\n district_list << arr[2]\r\n end\r\n end\r\n sheet.add_row province_list.uniq!\r\n province_cell = sheet.rows.last.cells.last\r\n sheet.add_row city_list.uniq!\r\n city_cell = sheet.rows.last.cells.last\r\n arr = district_list.uniq!\r\n arr.each{|item|\r\n sheet.add_row [item]\r\n }\r\n district_last=sheet.rows.last\r\n end\r\n\r\n unlocked = wb.styles.add_style :locked => false\r\n title_cell = wb.styles.add_style :bg_color => \"CBCBCB\", \r\n :fg_color => \"000000\", \r\n :sz => 14, \r\n :alignment => { :horizontal=> :center },\r\n :border => Axlsx::STYLE_THIN_BORDER#{ :style => :thick, :color =>\"000000\", :edges => [:left, :top, :right, :bottom] }\r\n info_cell = wb.styles.add_style :fg_color => \"000000\", \r\n :sz => 14, \r\n :alignment => { :horizontal=> :center },\r\n :border => Axlsx::STYLE_THIN_BORDER\r\n data_cell = wb.styles.add_style :sz => 14, \r\n :alignment => { :horizontal=> :right }, \r\n :format_code =>\"0.00\"\r\n\r\n wb.add_worksheet(:name => Common::Locale::i18n('scores.excel.score_title')) do |sheet|\r\n sheet.sheet_protection.password = 'forbidden_by_k12ke'\r\n\r\n # row 1\r\n # location input field\r\n location_row_arr = [\r\n Common::Locale::i18n('dict.province'),\r\n province,\r\n Common::Locale::i18n('dict.city'),\r\n city,\r\n Common::Locale::i18n('dict.district'),\r\n district,\r\n Common::Locale::i18n('dict.tenant'),\r\n school\r\n ]\r\n\r\n # row 2\r\n # hidden field\r\n hidden_title_row_arr = [\r\n \"grade\",\r\n \"classroom\",\r\n \"head_teacher\",\r\n \"subject_teacher\",\r\n \"name\",\r\n \"pupil_number\",\r\n \"sex\",\r\n tenant_uid # 隐藏tenant uid在表格中, version1.0,没什么用先埋下\r\n ]\r\n\r\n # row 3\r\n # qizpoint order\r\n order_row_arr = [\r\n \"\",\r\n \"\",\r\n \"\",\r\n \"\",\r\n \"\",\r\n \"\",\r\n \"\",\r\n Common::Locale::i18n('quizs.order')\r\n ]\r\n\r\n # row 4\r\n # title\r\n title_row_arr = [\r\n Common::Locale::i18n('dict.grade'),\r\n Common::Locale::i18n('dict.classroom'),\r\n Common::Locale::i18n('dict.head_teacher'),\r\n Common::Locale::i18n('dict.subject_teacher'),\r\n Common::Locale::i18n('dict.name'),\r\n Common::Locale::i18n('dict.pupil_number'),\r\n Common::Locale::i18n('dict.sex'),\r\n \"#{Common::Locale::i18n('quizs.full_score')}(#{self.score})\"\r\n ]\r\n\r\n # row 4\r\n # every qizpoint score \r\n score_row_arr = title_row_arr.deep_dup\r\n score_row_arr.pop()\r\n score_row_arr.push(self.score)\r\n\r\n quizs = self.bank_quiz_qizs.sort{|a,b| Common::Paper::quiz_order(a.order,b.order) }\r\n qiz_order = 0\r\n quizs.each{|qiz|\r\n qzps = qiz.bank_qizpoint_qzps.sort{|a,b| Common::Paper::quiz_order(a.order,b.order) }\r\n #全部从1开始升序排知识点,旧排序注释(1/2)\r\n qzp_count = qzps.size\r\n qzps.each_with_index{|qzp, qzp_index|\r\n hidden_title_row_arr.push(qzp._id)\r\n #全部从1开始升序排知识点,旧排序注释(2/2)\r\n #(qzp_count > 1) ? order_row_arr.push(qzp.order.sub(/0*$/, '')) : order_row_arr.push(qiz.order)\r\n qiz_order += 1\r\n #(qzp_count > 1) ? order_row_arr.push(qzp.order.sub(/0*$/, '') + \"-#{qiz_order}\") : order_row_arr.push(qiz.order + \"-#{qiz_order}\")\r\n order_row_arr.push(qiz_order)\r\n title_row_arr.push(qzp.score)\r\n }\r\n }\r\n\r\n #sheet.add_row location_row_arr, :style => [title_cell, title_cell, title_cell,unlocked,title_cell,unlocked,title_cell,unlocked]\r\n sheet.add_row location_row_arr, :style => [title_cell, info_cell, title_cell,info_cell,title_cell,info_cell,title_cell,info_cell]\r\n # sheet.add_data_validation(\"B1\",{\r\n # :type => :list,\r\n # :formula1 => \"areaList!A1:#{province_cell.r}\",\r\n # :showDropDown => false,\r\n # :showInputMessage => true,\r\n # :promptTitle => Common::Locale::i18n('dict.province'),\r\n # :prompt => \"\"\r\n # })\r\n # sheet.add_data_validation(\"D1\",{\r\n # :type => :list,\r\n # :formula1 => \"areaList!A2:#{city_cell.r}\",\r\n # :showDropDown => false,\r\n # :showInputMessage => true,\r\n # :promptTitle => Common::Locale::i18n('dict.city'),\r\n # :prompt => \"\"\r\n # })\r\n # sheet.add_data_validation(\"F1\",{\r\n # :type => :list,\r\n # :formula1 => \"areaList!A3:#{district_last.cells[0].r}\",\r\n # :showDropDown => false,\r\n # :showInputMessage => true,\r\n # :promptTitle => Common::Locale::i18n('dict.district'),\r\n # :prompt => \"\"\r\n # })\r\n\r\n sheet.add_row hidden_title_row_arr\r\n sheet.column_info.each{|col|\r\n col.width = nil\r\n }\r\n sheet.add_row order_row_arr, :style => title_cell\r\n sheet.add_row title_row_arr, :style => title_cell\r\n sheet.rows[1].hidden = true\r\n\r\n cols_count = title_row_arr.size\r\n empty_row = [] \r\n cols_count.times.each{|index|\r\n empty_row.push(\"\")\r\n }\r\n\r\n Common::Score::Constants::AllowScoreNumber.times.each{|line|\r\n sheet.add_row empty_row, :style => unlocked\r\n sheet.add_data_validation(\"A#{line+5}\",{\r\n :type => :list,\r\n :formula1 => \"gradeList!A1:A#{grade_number}\",\r\n :showDropDown => false,\r\n :showInputMessage => true,\r\n :promptTitle => Common::Locale::i18n('dict.grade'),\r\n :prompt => \"\"\r\n })\r\n sheet.add_data_validation(\"B#{line+5}\",{\r\n :type => :list,\r\n :formula1 => \"classroomList!A1:A#{classroom_number}\",\r\n :showDropDown => false,\r\n :showInputMessage => true,\r\n :promptTitle => Common::Locale::i18n('dict.classroom'),\r\n :prompt => \"\"\r\n })\r\n sheet.add_data_validation(\"G#{line+5}\",{\r\n :type => :list,\r\n :formula1 => \"sexList!A1:A3\",\r\n :showDropDown => false,\r\n :showInputMessage => true,\r\n :promptTitle => Common::Locale::i18n('dict.sex'),\r\n :prompt => \"\"\r\n })\r\n cells= sheet.rows.last.cells[8..cols_count].map{|cell| {:key=> cell.r, :value=> title_row_arr[cell.index].to_s}}\r\n cells.each{|cell|\r\n sheet.add_data_validation(cell[:key],{\r\n :type => :whole, \r\n :operator => :between, \r\n :formula1 => '0', \r\n :formula2 => cell[:value], \r\n :showErrorMessage => true, \r\n :errorTitle => Common::Locale::i18n(\"scores.messages.error.wrong_input\"), \r\n :error => Common::Locale::i18n(\"scores.messages.info.correct_score\", :min => 0, :max =>cell[:value]), \r\n :errorStyle => :information, \r\n :showInputMessage => true, \r\n :promptTitle => Common::Locale::i18n(\"scores.messages.warn.score\"), \r\n :prompt => Common::Locale::i18n(\"scores.messages.info.correct_score\", :min => 0, :max =>cell[:value])\r\n })\r\n }\r\n #sheet.rows.last.cells[0..7].each{|col| col.style = info_cell }\r\n #sheet.rows.last.cells[8..cols_count].each{|col| col.style = data_cell }\r\n }\r\n\r\n end\r\n\r\n file_path = Rails.root.to_s + \"/tmp/#{self._id.to_s}_empty.xlsx\"\r\n out_excel.serialize(file_path)\r\n\r\n # score_file = Common::PaperFile.create_empty_result_list file_path\r\n Common::PaperFile.create_empty_result_list({:orig_file_id => orig_file_id, :file_path => file_path})\r\n\r\n # self.update(score_file_id: score_file.id)\r\n File.delete(file_path)\r\n end", "title": "" }, { "docid": "15bacfd9382a269a61f34de07d9cbc36", "score": "0.5276694", "text": "def __find_table_max_width__(pdf) \n max_width = PDF::Writer::OHash.new(-1)\n\n # Find the maximum cell widths based on the data and the headings.\n # Passing through the data multiple times is unavoidable as we must\n # do some analysis first.\n @data.each do |row|\n @cols.each do |name, column|\n w = pdf.text_width(row[name].to_s, @font_size)\n w *= PDF::SimpleTable::WIDTH_FACTOR\n\n max_width[name] = w if w > max_width[name]\n end\n end\n\n @cols.each do |name, column|\n title = column.heading.title if column.heading\n title ||= column.name\n w = pdf.text_width(title, @heading_font_size)\n w *= PDF::SimpleTable::WIDTH_FACTOR \n max_width[name] = w if w > max_width[name]\n end\n max_width \n end", "title": "" }, { "docid": "b3a3519fd348c3159c573f35e1f8127e", "score": "0.52723235", "text": "def cols\n return 1 + horizontal_codelist.size\n end", "title": "" }, { "docid": "5e6c62628b40a69f85a20d253b37b58a", "score": "0.52693456", "text": "def estimate_column_widths tablewidth, columns\n colwidths = {}\n min_column_width = (tablewidth/columns.length) -1\n $log.debug(\"min: #{min_column_width}, #{tablewidth}\")\n @content.each_with_index do |row, cix|\n break if cix >= 20\n row.each_index do |ix|\n col = row[ix]\n colwidths[ix] ||= 0\n colwidths[ix] = [colwidths[ix], col.length].max\n end\n end\n total = 0\n colwidths.each_pair do |k,v|\n name = columns[k.to_i]\n colwidths[name] = v\n total += v\n end\n colwidths[\"__TOTAL__\"] = total\n column_widths = colwidths\n @max_data_widths = column_widths.dup\n\n columns.each_with_index do | col, i|\n if @datatypes[i].match(/(real|int)/) != nil\n wid = column_widths[i]\n # cw = [column_widths[i], [8,min_column_width].min].max\n $log.debug(\"XXX #{wid}. #{columns[i].length}\")\n cw = [wid, columns[i].length].max\n $log.debug(\"int #{col} #{column_widths[i]}, #{cw}\")\n elsif @datatypes[i].match(/(date)/) != nil\n cw = [column_widths[i], [12,min_column_width].min].max\n #cw = [12,min_column_width].min\n $log.debug(\"date #{col} #{column_widths[i]}, #{cw}\")\n else\n cw = [column_widths[i], min_column_width].max\n if column_widths[i] <= col.length and col.length <= min_column_width\n cw = col.length\n end\n $log.debug(\"else #{col} #{column_widths[i]}, #{col.length} #{cw}\")\n end\n column_widths[i] = cw\n total += cw\n end\n column_widths[\"__TOTAL__\"] = total\n $log.debug(\"Estimated col widths: #{column_widths.inspect}\")\n @column_widths = column_widths\n return column_widths\n end", "title": "" }, { "docid": "e3074e08dceb27bb0ca24042d0cd6118", "score": "0.52687526", "text": "def amount(row); end", "title": "" }, { "docid": "68477e2c0fb6fa71a2302a7c6648572f", "score": "0.5268049", "text": "def export_interviews_per_date\n start_date = Date.today - 25\n output = \"#{RAILS_ROOT}/tmp/interviews_#{start_date.day}_#{start_date.month}.xls\"\n Spreadsheet.client_encoding = 'UTF-8'\n book = Spreadsheet::Workbook.new\n\n # Dump interview data for next 5 days into the excel\n end_date = Date.today + 5\n start_date.upto(end_date) do |date|\n # Find interview corresponding to that date and continue with next date\n # if interviews are not available for that particular day. \n interviews = Interview.find(:all, :conditions => [ \"interview_date = '#{date}' \"])\n next if interviews.nil? || interviews.size == 0\n\n # Sorted interviews by respective requirement\n interviews.uniq_by { |r| r.req_match.requirement_id }\n interviews = interviews.sort { |x, y| x.req_match.requirement_id <=> y.req_match.requirement_id }\n\n # Creates the sheet with the date_month\n sheet = book.create_worksheet :name => \"Interview_#{date.day}_#{date.month}\"\n (0..9).each do |r|\n sheet.column(r).width = 20 \n end\n # Formatting the excel file\n blue = Spreadsheet::Format.new :size => 10, :weight => :bold\n sheet.row(0).default_format = blue\n sheet.row(0).outline_level = 1\n # Alok: TBD \n sheet.row(0).push('Candidate name', 'Requirement name', 'Contact number', 'Email-id', 'Resume owner', 'Interview date', 'Interview time', 'Interview mode', 'Panel name')\n\n # Filling interview data into the row\n row = 1\n interviews.each do |r|\n row += 1;\n resume = r.req_match.resume\n resume_owner = \"\"\n resume_owner_type = \"\"\n unless resume.referral_type == \"DIRECT\"\n if resume.referral_id != 0\n resume_owner = get_referral_name(resume.referral_type, resume.referral_id).name\n resume_owner += \"(\" + resume.referral_type.titleize + \")\"\n end\n end\n\n sheet.row(row).push( resume.name, r.req_match.requirement.name, resume.phone, resume.email, resume_owner, r.interview_date, r.interview_time.strftime('%T'), r.itype, r.employee.name)\n end\n end\n book.write output\n send_file(output)\n end", "title": "" }, { "docid": "e522dda4884e74f3e064d93e35f0613b", "score": "0.5265216", "text": "def header_cell_values; end", "title": "" }, { "docid": "8b33c17628811d9d2a190ba7fab63a0d", "score": "0.52593255", "text": "def requested_cols\n 1\n end", "title": "" }, { "docid": "d6e203924af4b0deebce9ee66650ee02", "score": "0.5256042", "text": "def column_deltas; end", "title": "" }, { "docid": "f64afab6742353fb4cd7b0ac986e8b9e", "score": "0.5255352", "text": "def height\n cells.height\n end", "title": "" } ]
3f3ac4168bfbe739851af97110db654d
Perform hash on some integer
[ { "docid": "f5e2de18084a23cc2860ac67d776f5df", "score": "0.7178767", "text": "def calculate_hash(val)\n return ((val ** 2000) * ((val + 2) ** 21) - ((val + 5) ** 3))\n end", "title": "" } ]
[ { "docid": "915e95cecb173cd28ac11a5599fd5173", "score": "0.7649625", "text": "def hash(n)\n Digest::SHA1.hexdigest(n.to_s).to_i(16).modulo(@l)\n end", "title": "" }, { "docid": "bc580928dbeb530f6de51550b1f1ea76", "score": "0.7625239", "text": "def hash\n num = @high << 64\n num |= @low\n num.hash\n end", "title": "" }, { "docid": "eb61a0401ec363265b9ed7c0cec6a111", "score": "0.7605971", "text": "def hash_val(num)\r\n num % 65_536\r\n end", "title": "" }, { "docid": "63df8c155b38c99e05b4ebae77b8f774", "score": "0.75803536", "text": "def hash(num)\n MurmurHash3::V32.int64_hash(num)\n end", "title": "" }, { "docid": "d92160aeadd517d31f1d5dbff4fc6ff4", "score": "0.7457265", "text": "def hash() super ^ number.hash; end", "title": "" }, { "docid": "d92160aeadd517d31f1d5dbff4fc6ff4", "score": "0.7457265", "text": "def hash() super ^ number.hash; end", "title": "" }, { "docid": "b78a8c3fbbda0dc6b3ed59f810316f24", "score": "0.7440182", "text": "def hash(*) end", "title": "" }, { "docid": "b5914a585ba19a2c0f3fa1a7a3097438", "score": "0.73179233", "text": "def hashfun(key)\n hv = 0\n key.to_s.each_char do |x|\n hv += x.ord\n hv *= 2\n end\n hv *= hv+3\n hv /= @storage.size\n # make sure we're smaller than m\n hv %= @storage.size\n return hv\n end", "title": "" }, { "docid": "69a9eb2e2353c88799859edcad3ee8a0", "score": "0.72831", "text": "def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end", "title": "" }, { "docid": "76bae4e708d6438223c6d05d0887eca4", "score": "0.7252257", "text": "def hash\n 1\n end", "title": "" }, { "docid": "55481f97eb0ef93fcebc191faf81107c", "score": "0.7235649", "text": "def hash\n h = 5381\n h = h * 33 + self.length\n each do |c|\n h = h * 33 + c.hash\n end\n h\n end", "title": "" }, { "docid": "15ab111544bfee6d598c82c6a202f376", "score": "0.72280407", "text": "def hashfunc; end", "title": "" }, { "docid": "0bd6409ab88cc7a1cf8d8019779997e4", "score": "0.72186476", "text": "def hash(plain_integer)\n working_array = build_working_array(plain_integer)\n working_array = swap(working_array)\n working_array = scatter(working_array)\n return completed_string(working_array)\n end", "title": "" }, { "docid": "ed884f4fd8b1e05145252beef8eff152", "score": "0.7199099", "text": "def hash_function(num)\n num > 0 ? (num / SIZE) + 1 : 0\nend", "title": "" }, { "docid": "220705d043f4b1e059725ea56b0c79f4", "score": "0.71911716", "text": "def generate_hash\n return self.to_i % 0x3fffffff\n end", "title": "" }, { "docid": "ef2345005f7157329f039c3936b42e07", "score": "0.7120009", "text": "def hash(key, buckets)\n hash = 5381\n\n key.each_byte do |i|\n hash = ((hash << 5) + hash) + i\n end\n\n return hash % buckets\n end", "title": "" }, { "docid": "a30d0436e65ea417acde925ec116bd81", "score": "0.7117702", "text": "def hash\n \"#{r}#{g}#{b}\".to_i\n end", "title": "" }, { "docid": "9992d4ca4462dac401e907402bcee279", "score": "0.7110355", "text": "def hash(key)\n total = 0\n prime_number = 31\n\n min_length = [key.length - 1, 100].min\n (0..min_length).each do |index|\n position = key[index].ord - 96\n total = (total * prime_number + position) % @key_map.length\n end\n total\n end", "title": "" }, { "docid": "0efc33cf18bcedff4c20f96e9d5d65c5", "score": "0.70992804", "text": "def _calc_hash(value)\n value.hash\nend", "title": "" }, { "docid": "d57cbacd52ef2e4534221858d84aeadd", "score": "0.7001394", "text": "def hash\n value = self.length\n self.each do |item|\n value = (value << 1) | (value < 0 ? 1 : 0)\n value ^= item.hash\n end\n\n return value\n end", "title": "" }, { "docid": "e56887f6c01358af7a868f7041844ff2", "score": "0.6982235", "text": "def hash_this(word)\n hash = 11\n iterate_through_this(word, hash)\n hash %= @size\n if hash == 0\n hash = 7\n iterate_through_this(word, hash)\n end\n hash %= @size\n end", "title": "" }, { "docid": "ee9b8766c1f77c441a647dea468acdf4", "score": "0.69537646", "text": "def _hash(key, distinct_id, salt=\"\")\n hash_key = Digest::SHA1.hexdigest \"#{key}.#{distinct_id}#{salt}\"\n return (Integer(hash_key[0..14], 16).to_f / 0xfffffffffffffff)\n end", "title": "" }, { "docid": "e978120cb1672953622311abfa6fe228", "score": "0.6904244", "text": "def hash_function(val)\n return @hash_fn.call(val) if @hash_fn\n complex_hash(val)\n end", "title": "" }, { "docid": "22ddf6d5a90b89aa5599e02a51b1d6bd", "score": "0.68768084", "text": "def hash_function value_s\n value_size = value_s.length\n (value_s[0].ord * value_size + value_s[value_size - 1].ord) % @size\n end", "title": "" }, { "docid": "4b8dc9c4037fd5434364d75fdd100c88", "score": "0.6868824", "text": "def hash_for(key)\n hashed_key = key.each_byte.inject(0) do |hash, byte|\n hash = 31 * hash + byte\n hash = MAX - (MIN - hash) + 1 while hash < MIN\n hash = MIN - (MAX - hash) - 1 while hash > MAX\n hash\n end\n\n hashed_key & \"ffffffff\".hex\n end", "title": "" }, { "docid": "fff1d340d09abfeab4e4d4deafe3b442", "score": "0.6850352", "text": "def hash() ajd.hash end", "title": "" }, { "docid": "d4d85885b13b68f2110028d1f74b5e43", "score": "0.6845463", "text": "def hash\n # sample at most 5 elements of receiver\n ts = Thread.__recursion_guard_set\n added = ts.__add_if_absent(self)\n unless added\n return 0 \n end\n hval = 4459 \n begin\n mysize = self.size\n interval = (mysize - 1).__divide(4)\n if interval < 1\n interval = 1\n end\n n = 0\n while n < mysize\n elem = self.__at(n)\n eh = elem.hash\n if eh._not_equal?(0)\n eh = Type.coerce_to( eh, Fixnum, :to_int)\n hval = (hval >> 1) ^ eh\n end\n n += interval\n end\n ensure\n ts.remove(self)\n end\n hval \n end", "title": "" }, { "docid": "12c9b7ea14d43172f0d7d1c6ca08e359", "score": "0.68302196", "text": "def hash_function key\r\n\t\treturn (key[1].ord + key[3].ord + key[5].ord)%20\r\n\tend", "title": "" }, { "docid": "226867762a59c5f604e4958d3c1a974d", "score": "0.68177056", "text": "def hash_value\n result = 0\n for i in 0..8 do\n result *= 3\n result += @state[i]\n end\n result\n end", "title": "" }, { "docid": "ae1a628dcfbcd0df0510d0ce3bf0cde6", "score": "0.6811046", "text": "def hash=(_arg0); end", "title": "" }, { "docid": "ae1a628dcfbcd0df0510d0ce3bf0cde6", "score": "0.6811046", "text": "def hash=(_arg0); end", "title": "" }, { "docid": "ae1a628dcfbcd0df0510d0ce3bf0cde6", "score": "0.6811046", "text": "def hash=(_arg0); end", "title": "" }, { "docid": "ea580ab8a0c79154f9c2f0c1e860d4c7", "score": "0.6808053", "text": "def hashValue()\n n = data.length\n sum = 0\n p_base = 31\n exponent = 1\n data.each_byte do |c|\n sum += c*(p_base**(n-exponent))\n exponent += 1\n end\n return sum\n end", "title": "" }, { "docid": "26fab0c477fbf1eaa413cec435e785b2", "score": "0.6800967", "text": "def hash\n 0\n end", "title": "" }, { "docid": "9e637d740421637880e5a7a3194c2dc1", "score": "0.6795763", "text": "def hash_for(key)\n XXhash.xxh32(key, @hash_seed)\n end", "title": "" }, { "docid": "5a45cc4f72685a329ec2b116a12a272b", "score": "0.67918336", "text": "def hash_for(key)\r\n Zlib.crc32(key)\r\n end", "title": "" }, { "docid": "879db85c9a5447d703cb94c91e7e6852", "score": "0.6786959", "text": "def h_i(i, s)\n sha256 = Digest::SHA256.new\n sha256 << s << i.to_s(2) # Ints take a parameter in #to_s for the base\n return sha256.hexdigest.to_i(16).modulo(@m)\n end", "title": "" }, { "docid": "dc6bf9f5a1eed7410807dbc4f6b07d57", "score": "0.6773206", "text": "def calculate_hash(str_in, hash_method = :hash_lookup)\n str_in.unpack('U*').map(&method(hash_method)).reduce(:+) % 65_536\nend", "title": "" }, { "docid": "a5bdec0073fbd70247896dc129ac9599", "score": "0.6771334", "text": "def hashValueToInt(value)\n return Digest::SHA256.digest(value).unpack('q').first.abs\n end", "title": "" }, { "docid": "a38a5ff80e615b643c7e6b195a3523f1", "score": "0.6764948", "text": "def test_hash\n property_of{\n value = range(lo = 0, hi = 65_536)\n }.check{ |value|\n hashed_value = @checker.hash(value)\n assert (hashed_value = ((value**3000) + (value**value) - (3**value)) * (7**value))\n }\n end", "title": "" }, { "docid": "8a56140892349f04fb716e9234b9bcde", "score": "0.6736997", "text": "def hash(input_str)\n hash = DEFAULT_HASH_VALUE\n input_str.split(//).each do |c|\n hash = ((hash << 5) + hash) + c.ord # hash * 33 + c:\n end\n return hash\n end", "title": "" }, { "docid": "73b1373f509628bd8e9d50bbe8a37f7a", "score": "0.6735715", "text": "def hash(word)\n hex = FNV.new.fnv1a_32(word) % self.size\n [hex]\n end", "title": "" }, { "docid": "f7403ed60e53bb7569dc0ad188afe5d0", "score": "0.67233527", "text": "def elfhash( key, len=key.length )\n state = 0\n x = 0\n len.times{ |i|\n state = (state << 4) + key[i]\n if (x = state & 0xF0000000) != 0\n state ^= (x >> 24)\n state &= ~x\n end\n }\n return state\nend", "title": "" }, { "docid": "a61fbf3aeaf5e2935199de7671b55250", "score": "0.6722522", "text": "def H(n, *a)\n nlen = 2 * ((('%x' % [n]).length * 4 + 7) >> 3)\n hashin = a.map {|s|\n next unless s\n shex = s.class == String ? s : '%x' % s\n if shex.length > nlen\n raise 'Bit width does not match - client uses different prime'\n end\n '0' * (nlen - shex.length) + shex\n }.join('')\n sha1_hex(hashin).hex % n\n end", "title": "" }, { "docid": "6cbfd913f26e7e64c8b43dce00a05e3e", "score": "0.6715965", "text": "def hash(word)\n word.chars.reduce(0) { |acc, char| char.ord + acc } % @bucket_size \n end", "title": "" }, { "docid": "7774d1f9a68b5fb2464d6cd3a87b8b92", "score": "0.6712986", "text": "def hash(s)\n total = 0\n characters = s.split('')\n characters.each do |x|\n x = x.unpack('U*')[0]\n total += ((x**3000) + (x**x) - (3**x)) * (7**x)\n end\n (total % 65_536).to_s(16)\n end", "title": "" }, { "docid": "0f2d0ca6a0560c9cdeb6e77daafcedda", "score": "0.67034614", "text": "def hash_for(key)\n (key.crc32_ITU_T >> 16) & 0x7fff\n end", "title": "" }, { "docid": "de255613ee8db95b9931255a97b5e5dd", "score": "0.6692565", "text": "def make_hash(word)\n my_hash = 0\n word.each_char.with_index { |c,i| \n my_hash += c.ord * (31 ** i)\n }\n my_hash % @size\n end", "title": "" }, { "docid": "87189b8c4f5953c3719674c1cc3f5b48", "score": "0.66869146", "text": "def hash_url(url)\n l = url.length\n i = 0\n h = l\n while i < l\n h = h ^ url[i].ord\n i = i + 1\n end\n h % 4\n end", "title": "" }, { "docid": "de162bb4d5a6acaaec8bdf1974c71753", "score": "0.66806865", "text": "def test_hash_val_low\r\n assert_equal 0, @g.hash_val(65536)\r\n end", "title": "" }, { "docid": "0dbe2a68299399de67be9d62005975d7", "score": "0.66750556", "text": "def hash;0;end", "title": "" }, { "docid": "640731dcfd4af7616ba488aca6f3da9c", "score": "0.66740954", "text": "def hash_char_val(char)\n (char**2000) * ((char + 2)**21) - ((char + 5)**3)\nend", "title": "" }, { "docid": "b916a1e05401a4fd51980e65f29d47cf", "score": "0.6665773", "text": "def hash(str)\n return djb2(str)\n end", "title": "" }, { "docid": "ade7252bb75472492457acf34246a627", "score": "0.6655856", "text": "def hash\n p, q = 17, 37\n p = q * p + @type.hash\n p = q * p + @text.hash\n p = q * p + @scope.hash \n \n # bound the hash function by the TABLE_SIZE\n return (p % SymbolTable::TABLE_SIZE).to_i\n end", "title": "" }, { "docid": "bd025a190d20b84a6e44f89d68d1e46c", "score": "0.6652317", "text": "def hash\n to_i\n end", "title": "" }, { "docid": "27a979a095ad4d2ea547e0f70ee523b8", "score": "0.6636524", "text": "def hash(data)\n return @cryptoHlpr.hash(data);\n end", "title": "" }, { "docid": "86b546d8d001693bbc502f4828655d76", "score": "0.6631291", "text": "def lsh_hash(funct, *v)\n v.inject(101){|memo, i| memo *(i ** funct + funct)} % buckets\n end", "title": "" }, { "docid": "c2d27642e27bfca3ffe38549f6aa7bad", "score": "0.6624239", "text": "def hash(obj)\n\th = Array.new(5){0};\n\n\tS.length.times do |i|\n\t\ttmp = 0\n\t\tmd5 = Digest::MD5.hexdigest(obj.to_s + S[i].to_s).unpack(\"B*\")\n\n\t\tmd5.to_s.each_char.with_index { |c, i|\n\t\t\tif c.to_i == 1 then\n\t\t\t \ttmp+=1\n\t\t\tend\n\t\t}\n\t\th[i] = (tmp + S[i]) % SIZE\n\tend\n\n\treturn h\nend", "title": "" }, { "docid": "b7ee5fe4fa0d116e19469f631fdb65e8", "score": "0.66225594", "text": "def hash(oid)\r\n oid % @cwidth\r\n end", "title": "" }, { "docid": "7093cdd79d9ab729e475300891f62b0a", "score": "0.6613926", "text": "def calcIntDigest(digester)\n return digester.hexdigest.to_i(16) % BIG_PRIME\nend", "title": "" }, { "docid": "40e37a27363ca514beac077036836473", "score": "0.6589726", "text": "def bin_for(key)\n # key.hash —> where does this .hash method come from?\n # is that a modulo operator? bin_count = 11\n key.hash % self.bin_count\n end", "title": "" }, { "docid": "c71589222d9983d1465d977cf7f0a818", "score": "0.65804005", "text": "def hash\n value = 0\n for row in @rows\n for e in row\n value ^= e.hash\n end\n end\n return value\n end", "title": "" }, { "docid": "d380b21383987fbda06848c4e42d1ae7", "score": "0.65553635", "text": "def test_hash_val_high\r\n assert_equal 65535, @g.hash_val(131071)\r\n end", "title": "" }, { "docid": "a6d4ffe0852cc4b4e0c9fa0baf0f841f", "score": "0.65386045", "text": "def hash\n self.inject(37){|memo,str| memo + 17*str.hash}\n end", "title": "" }, { "docid": "70e8e8129b7ac0d085db6fc9f1c925d8", "score": "0.6536766", "text": "def hash\n source.hash ^ (target.hash + 1)\n end", "title": "" }, { "docid": "63dc6c43e60d27c9835350811ac7b561", "score": "0.65258145", "text": "def hash(word)\n word[0].downcase.ord - 97\n end", "title": "" }, { "docid": "8f97e73317cd71f4efbc229f285343ba", "score": "0.65253055", "text": "def hash_function\n @hash_function ||= 'sha256'\n end", "title": "" }, { "docid": "c1d192d052b7fc0ba569dd92d77a2a81", "score": "0.64989024", "text": "def hash\n excl = @exclude_end ? 1 : 0\n hash = excl\n hash ^= @first.hash << 1\n hash ^= @last.hash << 9\n hash ^= excl << 24;\n return hash\n end", "title": "" }, { "docid": "bb2b0d7fde9992a7ff7fa76c3faee229", "score": "0.64933676", "text": "def test_hash_char \n\t\tmem = Hash.new\n\t\thashed = hash_char('A', mem)\n\t\t\n\t\tx = 65\n\t\ttest = ((x ** 2000) * ((x + 2) ** 21) - ((x + 5) ** 3)) % 65536\n\t\tassert_equal test, hashed \n\tend", "title": "" }, { "docid": "8a12e998720d493bacf70b3981cb1e68", "score": "0.6489555", "text": "def calc_hash(line)\n string_hash = 0\n\n # convert each character to its UTF-8 value\n line.each_char do |x|\n string_hash += @stored_chars[x]\n end\n\n string_hash = string_hash % 65_536 # mod the string_hash for the final hash value\n string_hash.to_s(16) # convert line hash value to hex\n end", "title": "" }, { "docid": "bec1ea75992ecda120e69d2acb2eecc0", "score": "0.6486328", "text": "def hash_methods\n hackerrank.store(543121, 100)\n hackerrank.keep_if { |key, value| key.is_a? Integer}\n hackerrank.delete_if { |key, value| key % 2 == 0 }\n end", "title": "" }, { "docid": "6d919d3a34325abcb55840d65aa522cb", "score": "0.6484419", "text": "def hash(key)\n index = gen_hash_index(key) # make sure the new index is within the array size\n\n index = collision?(index, key)\n\n index #return index\n end", "title": "" }, { "docid": "53b66f31eb1b0c8fca11a9ef4cde2899", "score": "0.64809954", "text": "def hash expr, algo = 'SHA1'\n Expression.new(\"CONVERT(BINARY(32), HASHBYTES('#{algo}', #{expr}), 2)\", MM::DataType::TYPE_Binary, expr.is_mandatory)\n end", "title": "" }, { "docid": "20277807e44403042f92161b4d06e5cf", "score": "0.6474101", "text": "def test_hash_bill\n assert_equal('f896', @checker.calculate_hash('bill'.unpack('U*')))\n end", "title": "" }, { "docid": "1f0accc4061dd8ea73d1d1bad08bd9d5", "score": "0.6472286", "text": "def phash1\n (phash >> 32) & 0xFFFFFFFF\n end", "title": "" }, { "docid": "02829dc7b34a0763e70e978e4630d8f8", "score": "0.6456347", "text": "def hash(input)\n hash = 0\n characters = input.split(\"\")\n input_length = characters.length\n \n characters.each_with_index do |character, index|\n hash += character.ord * modulo_exp(input_length - 1 - index) % @mod\n hash = hash % @mod\n end\n @prev_hash = hash\n @prev_input = input\n @highest_power = input_length - 1\n hash\n end", "title": "" }, { "docid": "185a3ded7aad3d48b022eb0c22db4970", "score": "0.64517534", "text": "def hash\n self.to_i.hash\n end", "title": "" }, { "docid": "af445584a3dab3a1191578de486937fa", "score": "0.64486957", "text": "def calculate_hash_value(string)\n return -1\n end", "title": "" }, { "docid": "53a74f1cc7641919fab952b763a95415", "score": "0.64482397", "text": "def secure_it(number)\n\trandom = rand(2**80)\t\n\thash = Digest::SHA3.hexdigest(('random') * number.to_i)\nputs \"Hash: \" + hash \nend", "title": "" }, { "docid": "6e005f5da6115fecfdaaf4235a3ca6f6", "score": "0.64404017", "text": "def hash\n hash_val = size\n mask = Fixnum::MAX >> 1\n\n # This is duplicated and manually inlined code from Thread for performance\n # reasons. Before refactoring it, please benchmark it and compare your\n # refactoring against the original.\n\n id = object_id\n objects = Thread.current.recursive_objects\n\n # If there is already an our version running...\n if objects.key? :__detect_outermost_recursion__\n\n # If we've seen self, unwind back to the outer version\n if objects.key? id\n raise Thread::InnerRecursionDetected\n end\n\n # .. or compute the hash value like normal\n begin\n objects[id] = true\n\n each { |x| hash_val = ((hash_val & mask) << 1) ^ x.hash }\n ensure\n objects.delete id\n end\n\n return hash_val\n else\n # Otherwise, we're the outermost version of this code..\n begin\n objects[:__detect_outermost_recursion__] = true\n objects[id] = true\n\n each { |x| hash_val = ((hash_val & mask) << 1) ^ x.hash }\n\n # An inner version will raise to return back here, indicating that\n # the whole structure is recursive. In which case, abondon most of\n # the work and return a simple hash value.\n rescue Thread::InnerRecursionDetected\n return size\n ensure\n objects.delete :__detect_outermost_recursion__\n objects.delete id\n end\n end\n\n return hash_val\n end", "title": "" }, { "docid": "3a29f74e5e17020c8a28da2a840599cd", "score": "0.64330053", "text": "def compute_hash(hsh_key)\n hsh_key % @hsh_arry.size\n end", "title": "" }, { "docid": "818dfb991535496155f05f3aaf2ee71f", "score": "0.6430082", "text": "def hashes(data)\n m = @ba.size\n h = Digest::MD5.hexdigest(data.to_s).to_i(16)\n x = h % m\n h /= m\n y = h % m\n h /= m\n z = h % m\n [x] + 1.upto(@k - 1).collect do |i|\n x = (x + y) % m\n y = (y + z) % m\n x\n end\n end", "title": "" }, { "docid": "a4e02373e766881204a59e8498b5ad36", "score": "0.6415959", "text": "def calc_hash( data )\n sha = Digest::SHA256.new\n sha.update( data )\n sha.hexdigest\nend", "title": "" }, { "docid": "976e2425a1ca680aeb514c9251f0f83d", "score": "0.6406546", "text": "def hash_string(s)\n n = nil\n loop do\n s = algorithm.digest(s)\n n = s.unpack('H*').first.to_i(16)\n break if n < @hash_cieling\n end\n n % group.order\n end", "title": "" }, { "docid": "6938cc34537e4457ae5dd123375a97d6", "score": "0.6400136", "text": "def hash\n hash = 17\n hash = 37 * hash + @prob.hash\n hash = 37 * hash + @alias.hash\n hash = 37 * hash + @values.hash\n hash\n end", "title": "" }, { "docid": "39b15da071a5d18e77c7674f9a946414", "score": "0.6378256", "text": "def hash\n @hash || calculate_hash!\n end", "title": "" }, { "docid": "894795fad3b32518cf0703a24124af92", "score": "0.6378099", "text": "def hash(obj)\n obj = normalise(obj)\n indices = [Digest::SHA1, Digest::MD5].map do |hasher|\n hasher.digest(obj).unpack(\"N*\").reduce {|accum, n| (accum+n)%filter.length}\n end\n indices << Zlib::crc32(obj)\n pattern = empty_pattern(filter.length)\n indices.each {|index| pattern[index % filter.length ] = 1}\n pattern\n end", "title": "" }, { "docid": "727b40f9aeaf16679278f4e7e7c6a588", "score": "0.6363215", "text": "def hash()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "727b40f9aeaf16679278f4e7e7c6a588", "score": "0.6363215", "text": "def hash()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "727b40f9aeaf16679278f4e7e7c6a588", "score": "0.636165", "text": "def hash()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "c4868bc4b6797c9d061fdfa3a931f562", "score": "0.6361558", "text": "def mine(key)\n\n number = 0\n\n while true\n hash = Digest::MD5.hexdigest(\"#{key}#{number}\")\n return number if hash =~ /\\A000000/\n number += 1\n end\nend", "title": "" }, { "docid": "c74b013b64475e002799e6faa18e3841", "score": "0.6356172", "text": "def hash\n @bits.hash\n end", "title": "" }, { "docid": "666c9fb9f59159f6cd6871f38585ff9d", "score": "0.63489485", "text": "def bkdrhash( key, len=key.length )\n seed = 131 # 31 131 1313 13131 131313 etc..\n state = 0\n\n len.times{ |i|\n state = ( state * seed ) + key[i]\n }\n return state\nend", "title": "" }, { "docid": "fb25dff2b7c8a85d0e28b9c32fcd889f", "score": "0.63432074", "text": "def test_driver5_7\n initval = 0\n key = 'Four score and seven years ago'\n hashval = @h.hashlittle(key, initval)\n str = sprintf \"%.8x\", hashval\n assert_equal str, '17770551'\n end", "title": "" }, { "docid": "0e8010c1e62a106936728e43c21a4b6e", "score": "0.63422066", "text": "def hash(key)\n Digest::SHA2.hexdigest(key).freeze\n end", "title": "" }, { "docid": "25e1de26338d2ab54336050e0eb2f763", "score": "0.6338842", "text": "def hash32(string)\n num = 64-string.length\n i = 0\n while i < num.to_i do\n string.insert(0,\"0\")\n i += 1\n end\n return string\n end", "title": "" }, { "docid": "b52aa6ab88d2331364eac875b5c2e840", "score": "0.63362503", "text": "def hash(n)\n h = Digest::MD5.hexdigest(\"#{Salt}#{n}\")\n 2016.times do\n h = Digest::MD5.hexdigest(h)\n end\n h\nend", "title": "" }, { "docid": "a7a065b2dbe36e8bb7e3d8fb8c486f85", "score": "0.63284314", "text": "def generate_short_hash(number)\n hashids = Hashids.new('mysecretsalt')\n hashids.encode(number)\n end", "title": "" }, { "docid": "8ad8f536b4be5ea83ec2a972ee3d5592", "score": "0.6325558", "text": "def hash\n total = 17\n each_field do |fid, field_info|\n name = field_info[:name]\n value = self.send(name)\n total = (total * 37 + value.hash) & 0xffffffff\n end\n total\n end", "title": "" }, { "docid": "e08db0e8d8f06175397c0e3356ceab0f", "score": "0.6304365", "text": "def hash\n (self.x*self.y + self.z).abs.ceil\n end", "title": "" } ]
166981e555d7a758b936a00ba939531b
This method is used to let the player choose the desired move. Can only be
[ { "docid": "f84846be09ef1bada1f86500d8e66f25", "score": "0.0", "text": "def move\r\n @turn_grid = Array.new\r\n loop do\r\n puts \"It's \" + @symbol.to_s + \" turn. Please chose the row of your\"\r\n puts \"move, between 0 and 2.\"\r\n @pos1 = (gets.chomp.to_i)\r\n break if @pos1.between?(0,2)\r\n end\r\n @turn_grid.push(@pos1)\r\n\r\n loop do\r\n puts \"And what column? Between 0 and 2.\"\r\n @pos2 = (gets.chomp.to_i)\r\n break if @pos2.between?(0,2)\r\n end\r\n @turn_grid.push(@pos2)\r\n end", "title": "" } ]
[ { "docid": "a868f98734e33d8418f2a1d8635a7977", "score": "0.7229683", "text": "def select_move\n puts \"It's #{@player.color}'s turn. Please enter your move/command.\"\n input = gets.chomp.downcase.split(\"\")\n check_move_input(input)\n end", "title": "" }, { "docid": "8026a7181c27d7ea159a56c563aa4834", "score": "0.706818", "text": "def choose_action(mark)\r\n # Gets player's input\r\n print \"\\e[39m > \"\r\n move = gets.chomp\r\n\r\n # Declare all possibles moves\r\n possible_choices = {0 => 'tl', 1 =>'tc', 2 =>'tr', 3 =>'ml', 4 => 'mc', 5 => 'mr', 6 => 'bl', 7 => 'bc', 8 => 'br'}\r\n\r\n # If user's move is one of the possible choices\r\n if possible_choices.values.include?(move)\r\n # Iterate over all the possible choices\r\n possible_choices.each do |key, value|\r\n # If one of the possible choices correspond to user's choice\r\n if move === value\r\n # Checks if the grid's case isn't already filled\r\n if @grid[key] != \" \" # TODO replace by .empty\r\n puts \"This case isn't available anymore. Please choose another one.\"\r\n choose_action(mark)\r\n # If grid's case isn't filled, put user's mark in it\r\n else\r\n @grid[key] = mark\r\n end\r\n end\r\n end\r\n # Else this means user has input a wrong choice, so we force him to start again\r\n else\r\n puts \"Choice error. You must select one of the following option\"\r\n choose_action(mark)\r\n end\r\n end", "title": "" }, { "docid": "b86efed017ad5ba218a9686e6267ff2c", "score": "0.7059582", "text": "def choose\n return super if move_history.size < 2\n\n human_choice_two_rounds_prior = @@players[0].move_history[-3]\n choice = nil\n loop do\n choice = Move::VALUES.sample\n @move = Move.initialize_move_type(choice)\n break if move > Move.initialize_move_type(human_choice_two_rounds_prior)\n end\n move_history << choice\n end", "title": "" }, { "docid": "eaa1e8feccbbc69c8967f8145a911cee", "score": "0.7053898", "text": "def chooseMove\r\n\t\tnegamax\r\n\t\treturn @bmove\r\n\tend", "title": "" }, { "docid": "1834893a51db1132e856ec8677f2e03d", "score": "0.704934", "text": "def move(options, role)\n #capture all available board moves\n free = BOARD.free_moves(options)\n choice = nil\n \n\n #check if the users choice is in the array\n #of available moves, if not prompt for another\n #number\n until free.include? choice \n choice = REF.req_num(\"Choose your next move:\", 0, SPACES)\n unless free.include? choice\n puts \"The chosen space is occupied, please choose another.\"\n end\n end\n puts \"Placing #{role} in position #{choice}...\"\n choice\n end", "title": "" }, { "docid": "1febc40437de0f01caa07147341e8995", "score": "0.7039981", "text": "def set_move\n system \"clear\"\n puts @name + \", select your move: (\" + rules.prompt.upcase + \")\"\n @move = check_input(@rules.valid)\n @move = \"SCISSOR\" if @move == \"SCISSORS\"\n @move = @rules.random_move if @move == \"RANDOM\"\n @move\n end", "title": "" }, { "docid": "744c70569ae3ad3673883840d49251a5", "score": "0.7026563", "text": "def do_move(player, place)\r\n @choices[player].push place \r\n @board.set(place, player)\r\n end", "title": "" }, { "docid": "6aa5a68e9dd1386308e6c0ee1000eb36", "score": "0.70221436", "text": "def user_selection\n if @current_players_turn == @player_1.symbol\n print \"#{@player_1.name} what column would you like to drop a piece in? (1-10): \"\n @current_players_move = gets.chomp.to_i\n self.valid_move?\n else\n print \"#{@player_2.name} what column would you like to drop a piece in? (1-10): \"\n @current_players_move = gets.chomp.to_i\n self.valid_move?\n end\n @current_players_move\n end", "title": "" }, { "docid": "62ff274e95fb21de31b038c8296d01a9", "score": "0.7017581", "text": "def move\n potential_move ||= winning_move\n potential_move ||= living_move\n potential_move ||= random_move\n end", "title": "" }, { "docid": "4c7614cd34e8f4daf4b3ef5389deb309", "score": "0.70154667", "text": "def move_from_choice\n puts \"Please choose a position from which to move\"\n @starting_position = gets.upcase!.chomp.strip\n move_choice_valid?(@starting_position) && is_any_piece_in_this_position?(@starting_position) ? @starting_position : move_from_choice\n end", "title": "" }, { "docid": "a094839c8baa5cf0694810182612d17d", "score": "0.6957643", "text": "def player_move\n pm = get_player_move.to_sym\n \n if spot_taken? pm\n player_move\n else\n @board[pm] = player_symbol\n @whose_turn = :computer\n pm\n end\n end", "title": "" }, { "docid": "09d2ae7587b646baac9b9e375e9ba035", "score": "0.69245106", "text": "def select_move_position\n puts \"\\nSelect a position to move to:\"\n selection = gets.chomp.downcase.to_sym\n if !@@cells.include? selection\n raise InvalidSelection\n else\n return selection\n end\n rescue InvalidSelection\n system \"clear\"\n self.print_board\n self.print_turn\n puts \"\\nInvalid move position. Please select a position on the gameboard!\"\n retry\n end", "title": "" }, { "docid": "d7232aaa4400dd82bd43a0dd3b88fd66", "score": "0.6907571", "text": "def make_move(player)\n #available options for the computer to pick from\n available_moves = @new_board.board.join.scan(/\\d/)\n if player.name == \"Tron\"\n puts \"Tron is making a move..........\"\n sleep(1)\n @new_board.turn(available_moves.sample.to_i, player.character)\n @new_board.display_board\n else\n puts \"#{player.name}'s turn. Please choose a number on the grid to place an '#{player.character}'.\"\n position = gets.chomp\n character = player.character\n @new_board.turn(position, character)\n @new_board.display_board\n end\n end", "title": "" }, { "docid": "50dfad5ebe0d8035f78c27d185f01669", "score": "0.69069153", "text": "def player_choose_piece\n puts \"What piece would you like to move?\"\n print \">> \"\n from_position = convert_location(gets.chomp)\n until @board.valid_player_piece?(@turn.color, from_position)\n puts \"Not a valid piece! Try again.\"\n print \">> \"\n from_position = convert_location(gets.chomp)\n end\n from_position\n end", "title": "" }, { "docid": "872675ae5b43026acb73d4157ae32d78", "score": "0.68820035", "text": "def turn\r\n place = current_player.select_place(self)\r\n move(place)\r\n end", "title": "" }, { "docid": "7bc278f1af0aa1191ad742de1288e029", "score": "0.6864179", "text": "def player_move\r\n move = player_input-1\r\n if cells[move] = \" \"\r\n cells[move] = @current_player.symbol\r\n else\r\n puts \" please choose other number, this one taken\"\r\n self.player_move\r\n end\r\n @current_player.taken_cells << move\r\n end", "title": "" }, { "docid": "86a9c2fbf68c78a589ce9a8132a8be5a", "score": "0.684506", "text": "def next_move(player)\n case @difficulty_level\n when 1 then random_only\n when 2 then block_win_random(player)\n when 3 then win_block_random(player)\n end\n end", "title": "" }, { "docid": "c6722e5f3f20c773673627a79b0dcf7c", "score": "0.68424016", "text": "def pick_move\t\t\n\t\t# Naive AI: always take one turn, and walk towards the target if possible\n\t\tmyself = self.entity.get(:display)\n\t\t\n\t\t# Randomly decide if you should go horizontally or vertically first\n\t\t# Otherwise, you'll always close distance on the shortest axis\n\t\tif rand(2) == 1\n\t\t\t# Try to move horizontally first\n\t\t\tx = get_move_x_dir\n\t\t\ty = x == myself.x ? get_move_y_dir : myself.y\n\t\telse\n\t\t\t# try to move vertically first\n\t\t\ty = get_move_y_dir\n\t\t\tx = y == myself.y ? get_move_x_dir : myself.x\n\t\tend\n\t\t\t\t\n\t\treturn {:x => x, :y => y}\n\tend", "title": "" }, { "docid": "87b7492f8976723ddf0ea969be2853d8", "score": "0.6831219", "text": "def turn\n selection = self.current_player.move(board)\n if @board.valid_move?(selection)\n @board.update(selection, current_player)\n else\n puts \"Invalid move. Try again.\"\n self.turn\n end\n end", "title": "" }, { "docid": "71fc6f76d67f160460eb083a3e0c923b", "score": "0.6822533", "text": "def play(playerX, playerY)\n\t\toption = 0\n\t\tgame_option = @game_option * @game_option\n\t\twhile !(1..game_option).include?(option.to_i)\n\t\t\tputs \"\\n\\n\" + @new_player.name + \": Please select your desired position from 1 to #{game_option}:\"\n\t\t\tinput = gets.chomp.to_i\n\t\t\toption = 0\n\n\t\t\t# If someone already placed\n\t\t\toption = input if is_valid_input(input, playerX, playerY) === true\n\t\tend\n\n\t\t# Updating desired position\n\t\t@new_player.actions.push(option.to_i) \n\t\t@new_player.actions = @new_player.actions.sort\n\t\t@total_actions += 1\n\t\toption\n\tend", "title": "" }, { "docid": "7194aae2c2a2773e505e98af61f5a4a6", "score": "0.68194443", "text": "def solicit_move\n \"\n Merci à #{current_player.name} de choisir une position (de 1 à 9)\n \"\n end", "title": "" }, { "docid": "e22f98534aa73c0850420eeb5be63f12", "score": "0.68157727", "text": "def choose\n if human? # need this as a method now\n # prolly choose something\n choice = nil\n loop do\n puts \"Please choose rock, paper, or scissors:\"\n choice = gets.chomp\n break if ['rock', 'paper', 'scissors'].include? choice\n puts \"Sorry, invalid choice.\"\n end\n self.move = choice\n else\n # prolly randomize\n self.move = ['rock', 'paper', 'scissors'].sample\n end\n end", "title": "" }, { "docid": "3c3eb6a6402d529e8e03ecd3808e3293", "score": "0.6806901", "text": "def pick_movement player, row, column\n\tif player == 1\n\t\tprint \"\\n Player \\u2B24 choose where to move (e.g. G2): \"\n\telsif player == 2\n\t\tprint \"\\n Player \\u25EF choose where to move (e.g. B3): \"\n\tend\n\ttile = gets.chomp.upcase\n\tabort(\"\\n Exit Program\") if tile == \"quit\".upcase\n\twhile true do\n\t\tif (syntax_ok?(tile) && check_move(player, row, column, tile))\n\t\t\treturn\n\t\telse\n\t\t\tputs \"\\n *** Illegal tile chosen ***\\n \"\n\t\t\tprint \" Choose a proper tile: \"\n\t\t\ttile = gets.chomp.upcase\n\t\t\tabort(\"\\n Exit Program\") if tile == \"quit\".upcase\n\t\t\tputs \"\"\n\t\tend\n\tend\nend", "title": "" }, { "docid": "875c2b3bffbdd831229e7d65d0dd1f06", "score": "0.68062484", "text": "def pick_move (possible_moves)\n # determine which move is most advantageous based on both players life, cards in hand, cards in play\n end", "title": "" }, { "docid": "9d521900d353b4666675e53512deda79", "score": "0.67782235", "text": "def human_select_move\n puts \"Rock, Paper, or Scissors?\"\n gets.chomp.downcase\n end", "title": "" }, { "docid": "9be1ed1a8d4bf87db65ab5803dccd555", "score": "0.67452586", "text": "def play_move\n\n begin\n start_square = @current_player.move\n\n if @board[*start_square].class == EmptySquare\n raise StandardError\n end\n rescue StandardError\n puts \"This square is empty, please choose a different starting position\"\n sleep(1)\n # puts \"This will reset in 3...\"\n # sleep(1)\n # puts \"2...\"\n # sleep(1)\n # puts \"1...\"\n # sleep(1)\n\n # WE NEED TO RESET THE selected_pos\n retry\n end\n #\n begin\n end_square = @current_player.move\n unless @board[*start_square].valid_moves.include?(end_square)\n raise StandardError\n end\n rescue StandardError\n puts \"Dude, obviously you can't go there.\"\n puts \"For more information, please Google 'chess for idiots'\"\n sleep(1)\n # puts \"Choose a better end move in 3...\"\n # sleep(1)\n # puts \"2...\"\n # sleep(1)\n # puts \"1...\"\n # sleep(1)\n retry\n end\n @board.move_piece(start_square, end_square)\n # puts \"Alright, your turn is done, #{@current_player.name}\"\n # switch_players\n # puts \"It's #{@current_player.name}'s turn\"\n # sleep(2)\n\n\n\n\n\n end", "title": "" }, { "docid": "cb9d21647300e21e093dc9c096cba7ef", "score": "0.6741631", "text": "def report_invalid_move\n puts \"INVALID MOVE -- Robot will not be placed on the board.\"\n prompt = TTY::Prompt.new\n choices = [\n {name: 'Yes', value: 1},\n {name: 'No', value: 2},\n ]\n players_input = prompt.select(\"Would You Like to Reselect your commands?\", choices) \n case players_input\n when 1\n execute_game\n when 2\n main_menu\n end \nend", "title": "" }, { "docid": "032269f8446184e41dcc553575d5b4a7", "score": "0.6739636", "text": "def choose\n last_move = move_history[-1]\n if move_history[-2] == last_move\n super\n else\n @move = Move.initialize_move_type(last_move)\n move_history << last_move\n end\n end", "title": "" }, { "docid": "263f7797c72854142bd55a0b7a9c8a19", "score": "0.6739587", "text": "def player_choose_move_piece(from_position)\n puts \"Where would you like to move your piece?\"\n print \">> \"\n to_position = convert_location(gets.chomp)\n end", "title": "" }, { "docid": "987d315e5157c34dd3b8867f6c83e8e3", "score": "0.6733062", "text": "def select_cell(player)\n puts \"#{player.name}, please select a position for your #{player.marker}:\"\n move = gets.chomp.to_i\n if @board.available?(move)\n board.set_cell(move, player.marker)\n puts \"#{player.name} played cell \\##{move.to_s}.\"\n @board.print\n swap_players\n else\n puts \"Sorry, that play is not valid. Please try again.\"\n end\n end", "title": "" }, { "docid": "ca46fd958d6c03c640b7e28b9b561776", "score": "0.67282426", "text": "def move(choice)\n\t\tif valid_move?(choice)\n\t\t\tif @total_moves % 2 == 0\n\t\t\t\t@board_array[choice-1] = \"x\"\n\t\t\t\t@player = \"Player2\"\n\t\t\telse\n\t\t\t\t@board_array[choice-1] = \"o\"\n\t\t\t\t@player = \"Player1\"\n\t\t\tend\n\t\t\t@total_moves += 1\n\t\telse\n\t\t\t\"Invalid move! Try again.\"\n\t\tend\n\tend", "title": "" }, { "docid": "1a553e4b16a894196534992a245d9c36", "score": "0.6722993", "text": "def choose_from\n puts \"#{@current_player.name}, among #{@current_player.color} chesspieces, which chesspiece you want to move?\"\n from = ask_coordinate\n until team?(from, @current_player.color)\n puts \"You pick a wrong chessman.\"\n from = ask_coordinate\n end\n from\n end", "title": "" }, { "docid": "65e06868f90328c06bc0e31ba4bb8113", "score": "0.67168707", "text": "def turn\n player = self.current_player\n if player.is_a?(Human)\n puts \"Please enter a number 1-9:\"\n input = player.move\n until self.board.valid_move?(input)\n puts \"Sorry, that was not a valid move. Please enter a number 1-9:\"\n input = player.move\n end\n elsif player.is_a?(Computer)\n board_state = self.board\n input = player.move(board_state)\n input = player.move(board_state) until self.board.valid_move?(input)\n puts \"Beep-bop-boop! PlayerBot chooses location #{input}!\"\n end\n self.board.update(input, player)\n self.board.display\n end", "title": "" }, { "docid": "2003c629d242e03c518f1e15d6ae14e7", "score": "0.6701458", "text": "def move_type_custom\n if stopping?\n command = @move_route.list[@move_route_index] # Get movement command\n @move_failed = false\n if command.code == 0 # End of list\n if @move_route.repeat # [Repeat Action]\n @move_route_index = 0\n elsif @move_route_forcing # Forced move route\n @move_route_forcing = false # Cancel forcing\n @move_route = @original_move_route # Restore original\n @move_route_index = @original_move_route_index\n @original_move_route = nil\n end\n else\n case command.code\n when 1 # Move Down\n move_down\n when 2 # Move Left\n move_left\n when 3 # Move Right\n move_right\n when 4 # Move Up\n move_up\n when 5 # Move Lower Left\n move_lower_left\n when 6 # Move Lower Right\n move_lower_right\n when 7 # Move Upper Left\n move_upper_left\n when 8 # Move Upper Right\n move_upper_right\n when 9 # Move at Random\n move_random\n when 10 # Move toward Player\n move_toward_player\n when 11 # Move away from Player\n move_away_from_player\n when 12 # 1 Step Forward\n move_forward\n when 13 # 1 Step Backwards\n move_backward\n when 14 # Jump\n jump(command.parameters[0], command.parameters[1])\n when 15 # Wait\n @wait_count = command.parameters[0] - 1\n when 16 # Turn Down\n turn_down\n when 17 # Turn Left\n turn_left\n when 18 # Turn Right\n turn_right\n when 19 # Turn Up\n turn_up\n when 20 # Turn 90° Right\n turn_right_90\n when 21 # Turn 90° Left\n turn_left_90\n when 22 # Turn 180°\n turn_180\n when 23 # Turn 90° Right or Left\n turn_right_or_left_90\n when 24 # Turn at Random\n turn_random\n when 25 # Turn toward Player\n turn_toward_player\n when 26 # Turn away from Player\n turn_away_from_player\n when 27 # Switch ON\n $game_switches[command.parameters[0]] = true\n $game_map.need_refresh = true\n when 28 # Switch OFF\n $game_switches[command.parameters[0]] = false\n $game_map.need_refresh = true\n when 29 # Change Speed\n @move_speed = command.parameters[0]\n when 30 # Change Frequency\n @move_frequency = command.parameters[0]\n when 31 # Walking Animation ON\n @walk_anime = true\n when 32 # Walking Animation OFF\n @walk_anime = false\n when 33 # Stepping Animation ON\n @step_anime = true\n when 34 # Stepping Animation OFF\n @step_anime = false\n when 35 # Direction Fix ON\n @direction_fix = true\n when 36 # Direction Fix OFF\n @direction_fix = false\n when 37 # Through ON\n @through = true\n when 38 # Through OFF\n @through = false\n when 39 # Transparent ON\n @transparent = true\n when 40 # Transparent OFF\n @transparent = false\n when 41 # Change Graphic\n set_graphic(command.parameters[0], command.parameters[1])\n when 42 # Change Opacity\n @opacity = command.parameters[0]\n when 43 # Change Blending\n @blend_type = command.parameters[0]\n when 44 # Play SE\n command.parameters[0].play\n when 45 # Script\n eval(command.parameters[0])\n end\n if not @move_route.skippable and @move_failed\n return # [Skip if Cannot Move] OFF & movement failure\n end\n @move_route_index += 1\n end\n end\n end", "title": "" }, { "docid": "b52d979a64bca91543070159d4a4d15e", "score": "0.66965705", "text": "def choose\n return super if move_history.empty?\n\n last_move = move_history[-1]\n choice = nil\n loop do\n choice = Move::VALUES.sample\n @move = Move.initialize_move_type(choice)\n break if move > Move.initialize_move_type(last_move)\n end\n move_history << choice\n end", "title": "" }, { "docid": "82c82ad1aa6ec6dbc2b539c898dc529a", "score": "0.6692597", "text": "def move_type_toward_player\n if near_the_player?\n case rand(6)\n when 0 then move_toward_player\n when 1 then move_toward_player\n when 2 then move_toward_player\n when 3 then move_toward_player\n when 4 then move_random\n when 5 then move_forward\n end\n else\n move_random\n end\n end", "title": "" }, { "docid": "9093ba27faeb91543f65c8aeb116db62", "score": "0.66896415", "text": "def choose_move\n move = \"\"\n loop do\n print \"#{@players[@turn].name.bold_yellow}, please select a number (1-9) that is available for your turn: \"\n move = gets.chomp.to_i\n break if (1..9).include?(move) && @board.valid_move?(move)\n\n puts \"That is not a valid choice\".red\n end\n move\n end", "title": "" }, { "docid": "ca8626e664fe483842b7f319c56d41fd", "score": "0.66811997", "text": "def player_to_move; self.send(self.next_to_move); end", "title": "" }, { "docid": "cce70500cf7d88732da4c6ee488e419f", "score": "0.66775984", "text": "def move(select)\n self.clear_screen\n if (select =~ /q/i)\n self.menu(4)\n else\n # depending on input, we allow them to move or give an error message\n case select\n # make sure syntax is x,y within required fields\n when /^[1-5],[1-5]$/;\n result = select.split(',')\n self.toggle(result[0].to_i,result[1].to_i)\n self.toggle_neighbors(result[0].to_i, result[1].to_i)\n @score += 1\n\n # check if input isn't within required fields, display error\n when /^[^1-5],[^1-5]$/;\n print \"\\nInvalid move, coords must appear on grid.\\n\\n\"\n\n # user didn't follow x,y syntax, display error\n else;\n print \"\\nInvalid move, please use x,y syntax to label coords.\\n\\n\"\n end\n end\n end", "title": "" }, { "docid": "5e4e908c8484dab574cb55588eb60cf4", "score": "0.667548", "text": "def prompt_player_to_move\n \n direction = read_keystroke.last_character.upcase\n if move_keystroke_is_valid(direction)\n case direction\n when 'A' then player.move(:north, map)\n when 'B' then player.move(:south, map)\n when 'C' then player.move(:east, map)\n when 'D' then player.move(:west, map)\n end\n print_map\n end\n end", "title": "" }, { "docid": "add06f69e542f8c258a745be0fed0aee", "score": "0.6655157", "text": "def choose\n if @next_move\n @next_move\n else\n CHOICES.sample\n end\n end", "title": "" }, { "docid": "33e34703533d96df8668c9b4359cb5bb", "score": "0.66499376", "text": "def turn(cur_player)\n display.selected = nil\n display.cursor_pos = [0,0]\n cur_player.cursor_pos = [0,0]\n\n selected_pos = nil\n until selected_pos\n display.render\n selected_pos = cur_player.get_input\n display.cursor_pos = cur_player.cursor_pos\n end\n display.selected = selected_pos\n\n target_pos = nil\n until target_pos\n display.render\n target_pos = cur_player.get_input\n display.cursor_pos = cur_player.cursor_pos\n end\n board.move(selected_pos, target_pos)\n\n rescue MoveError => e\n puts \"Invalid move, sukkah\"\n retry\n\n\n display.render\n end", "title": "" }, { "docid": "9a7b0a783dbce70ab415f7031177e002", "score": "0.6642033", "text": "def choice_r2d2\n select_move('Rock')\n end", "title": "" }, { "docid": "c2f53a8367765b03a2561b777b531bef", "score": "0.6638616", "text": "def pick(move)\n quit = false\n case move\n when 'Q'\n print_score\n quit = true\n when 'H'\n print_help\n when 'C'\n eat\n when 'I'\n show_inventory\n when 'N' \n \tif @room == 1 \n \t puts 'NO EXIT THAT WAY'\n \t else\n \t @room = 1\n \tend\n when 'S' \n \tif @room == 2 \n \t\tputs 'THERE IS NO EXIT SOUTH'\n \telse\n \t @room = 2\n \tend\n when 'E' \n \tif @room == 3\n \t\tputs 'YOU CANNOT GO IN THAT DIRECTION'\n \telse\n \t @room = 3\n \tend\n when 'W' \n \tif @room == 4\n \t puts 'YOU CANNOT MOVE THROUGH SOLID STONE'\n \t else\n \t @room = 4\n \tend\n when 'U' \n \tif @room == 5\n \tputs 'THERE IS NO WAY UP FROM HERE'\n else\n @room = 5\n end\n when 'D' \n \tif @room == 6 \n \t puts 'YOU CANNOT DESCEND FROM HERE'\n \telse\n \t @room = 6\n \tend\n when 'F' \n \tif @room == 7\n \t puts 'THERE IS NOTHING TO FIGHT HERE'\n \t else\n \t fight\n end\n when 'M'\n prng = Random.new\n @room = prng.rand(1...20)\n if @room == 6 or @room == 11\n win\n quit = true\n end\n when 'P'\n if @room == 7\n puts \"THERE IS NO TREASURE TO PICK UP\"\n elsif @inventory['light'] == 0\n puts \"YOU CANNOT SEE WHERE IT IS\"\n else\n \t pickup_treasure\n \tend\n when 'A'\n abbracadabra\n when 'V'\n win\n quit = true\n end\n quit\n end", "title": "" }, { "docid": "cc60ab11cf7308ecad0e434ea168d04e", "score": "0.6632886", "text": "def player_move\n puts \"\\n#{@player} : pick your square\"\n # to_i will convert any string to 0\n position = gets.to_i\n if valid_input?(position)\n @board[position] = @player\n else\n player_move\n end\n end", "title": "" }, { "docid": "f4aed1282169876c718dcc7828635aa5", "score": "0.66300863", "text": "def winning_move\n simulate_move(@player_num)\n end", "title": "" }, { "docid": "2b116ab1b76c23913d38ae6a55a1d915", "score": "0.66265064", "text": "def request_player_action\n\tplayer = 1\n\twhile true do\n\t\tpiece = pick_piece player\n\t\trow = get_row piece\n\t\tcolumn = get_column piece\n\t\tpick_movement(player, row, column)\n\t\tplayer == 1? player = 2 : player = 1\n\tend\nend", "title": "" }, { "docid": "01d73a27eb0f1d08ced1147a0913ad44", "score": "0.6614914", "text": "def player_action(player)\n\t\[email protected]_player_to_play(player)\n\t\tposition = gets.chomp.to_s\n\t\twhile @@combinations.include?(position)\n\t\t\tprint \"Case occupée, sélectionne une autre case : \"\n\t\t\tposition = gets.chomp.to_s\n\t\tend\n\t\twhile !@@position_possible.include?(position)\n\t\t\tprint \"Cette case n'existe pas, sélectionne une case valide : \"\n\t\t\tposition = gets.chomp.to_s\n\t\tend\n\t\t@@combinations << position\n\t\[email protected]_move(player, position)\n\t\[email protected]_board(@game.board.board_array)\n\tend", "title": "" }, { "docid": "ed47e99696e314a5f0a7349bd6e7bc1f", "score": "0.66132665", "text": "def make_move()\n puts\n print \"Please select a valid move. (i.e.: (1,5) is 15): \"\n gets.chomp\n end", "title": "" }, { "docid": "e5d1f6ebfeeb2e1f38afa7d7079678d1", "score": "0.66099316", "text": "def pick_movement player, row, column\n\tif player == 1\n\t\tprint \"Player \\u2B24 choose where to move (e.g. G2): \"\n\telsif player == 2\n\t\tprint \"Player \\u25EF choose where to move (e.g. B3): \"\n\tend\n\ttile = gets.chomp.upcase\n\twhile true do\n\t\tif (syntax_ok?(tile) && move_legal?(player, row, column, tile))\n\t\t\treturn tile\n\t\telse\n\t\t\tputs \"\\n *** Illegal tile chosen ***\\n \"\n\t\t\tprint \" Choose a proper tile: \"\n\t\t\ttile = gets.chomp.upcase\n\t\tend\n\tend\nend", "title": "" }, { "docid": "76c5e33d9af2b7a32ebdd061dc8e752b", "score": "0.6601428", "text": "def switch_player()\n if @current_turn == \"o\"\n @current_turn = \"x\"\n elsif @current_turn == \"x\"\n @current_turn = \"o\"\n end\n end", "title": "" }, { "docid": "b858a4dc60a0bfb2befc03834cb4a3f7", "score": "0.6589267", "text": "def choose_a_move\n puts \"#{name}: would you like: 1 = rock, 2 = paper, or 3 = scissors? \"\n @turn = gets.chomp.to_i\n \n check = false\n while check == false do\n if @turn == 1 || @turn == 2 || @turn == 3\n check = true\n @moves << @turn\n else \n puts \"#{name}, we're not playing rock, paper, scissors, lizard, spock here. Pick a valid choice next time.\"\n choose_a_move\n end #end of if/else\n end #end of while\n return @turn #return @moves.last\n end", "title": "" }, { "docid": "187a44e32d75ef2fcd92819a80514419", "score": "0.6580422", "text": "def get_player_move\r\n Console_screen.cls\r\n\r\n loop do\r\n Console_screen.cls\r\n puts \"To make a move, type one of the following and press Enter:\\n\\n\"\r\n print \"[Rock] [Paper] [Scissors]: \"\r\n\r\n @choice = STDIN.gets\r\n @choice.chop!\r\n\r\n break if @choice =~ /Rock|Paper|Scissors/i \r\n end\r\n\r\n # Makes move always uppercase and returns it to the calling statement\r\n return @choice.upcase\r\n end", "title": "" }, { "docid": "52dbf98bfc16691b2f052ef6995a6b63", "score": "0.6573998", "text": "def move_player\n # if the selected location is map the player is on\n Sound.play_cancel\n\n # find the opposite direction\n x = $game_player.x\n y = $game_player.y\n \n if x == 0\n opp_direction = 6\n elsif x >= $game_map.width-1\n opp_direction = 4\n elsif y == 0\n opp_direction = 2\n elsif y >= $game_map.height-1\n opp_direction = 8\n else\n opp_direction = $game_player.direction\n end\n \n # turn the player round and exit\n\t\t$game_player.set_direction(opp_direction)\n end", "title": "" }, { "docid": "85f8e0607db4f707470e8960f0812014", "score": "0.656979", "text": "def select_move(sarakarta_board)\n\n \tloop do\n\t \tprint \"What piece do you want to move, #{@name}? (x pos)\"\n\t \tx = gets\n\n\t \tprint \"What piece do you want to move, #{@name}? (y pos)\"\n\t \ty = gets\n\n\t \tsrc = Space.new(x, y, @player_id)\n\n\n\t \tprint \"Where do you want to move the piece to, #{@name}? (x pos)\"\n\t \tx = gets\n\n\t \tprint \"What do you want to move the piece to, #{@name}? (y pos)\"\n\t \ty = gets\n\n\t \tdest = Space.new(x, y, @player_id)\n\n\t \tvalid = sarakarta_board.check_move(src, dest)\n\n\t \tbreak if valid != nil\n\n \t\tsarakarta_board.perform_move(src, dest)\n \t\treturn true\n\n \tend\n\n \treturn false\n\n end", "title": "" }, { "docid": "2c45aaae50e293d6269ce32427c6a406", "score": "0.65694594", "text": "def go(player, token)\n\t puts \"#{player} select a spot on the board by typing in its number:\"\n\t ans = gets.chomp.to_i\n set_move(ans, token)\n end", "title": "" }, { "docid": "ac5287df9e9a5c5b1292e50a0abf85ac", "score": "0.65693355", "text": "def request_player_action\n\tplayer = 1\n\twhile true do\n\t\tpiece = pick_piece player\n\t\trow = get_row piece\n\t\tcolumn = get_column piece\n\t\tmovement = pick_movement(player, row, column)\n\t\tto_row = get_row movement\n\t\tto_column = get_column movement\n\t\tupdate_state(player, row, column, to_row, to_column)\n\t\tupdate_board\n\t\tplayer == 1? player = 2 : player = 1\n\tend\nend", "title": "" }, { "docid": "116c402a7a9682a2ca8fee501d927278", "score": "0.6563221", "text": "def attempt_move(move, current_player)\n save_board_state(move.first, move.last)\n board.place_move(move.first, move.last)\n check = check?(current_player)\n restore_board(move.first, move.last)\n check\n end", "title": "" }, { "docid": "49e8c9c82db4812ebfdfc045ec807f42", "score": "0.65399927", "text": "def move_to\n @move_to = nil\n while @move_to == nil\n puts \"Which rod would you like to move the selected disk TO?\"\n to = gets.chomp\n if to.upcase == \"QUIT\"\n exit\n elsif @rods.key?(to.to_i)\n @move_to = @rods[to.to_i]\n else\n puts \"Please select a valid rod.\"\n end\n end\n end", "title": "" }, { "docid": "9b47969809ea21732f15eff4b5a6187e", "score": "0.65340525", "text": "def ask_move_p2\n loop do\n puts \"\\n#{@players_array[1].name}, choisissez la case où jouer: (A1/B2/C3...)\"\n print \"\\n> \"\n @chosen_move_p2 = gets.chomp.downcase\n if @valid_moves.include?(@chosen_move_p2) == true\n break\n end\n puts \"Choix invalide, réessayer.\"\n end\n @valid_moves.delete chosen_move_p2\n end", "title": "" }, { "docid": "46750780edc4ed887382cd17af07bd76", "score": "0.65165025", "text": "def play_move(display_in, who)\n if who == COMPUTER_MARK\n computer_choice!(display_in)\n else # user gets to go\n user_choice!(display_in)\n end\n game_over, winner = game_over?(display_in)\n return game_over, winner\n end", "title": "" }, { "docid": "864b05c9d67c50ba0a14a63dfe1d12b8", "score": "0.6512531", "text": "def play\n puts \"Alright, player #{@state.get_turn} here is the board:\"\n BoardUI.print_board(@state.get_board)\n\n puts \"Blank spaces are valid positions. What position would you like to play?\n Here is a list of options:\"\n @state.get_board\n .each_with_index do |position, index|\n print \" - #{index + 1} - \" if position.nil?\n end\n\n print \"\\n Input decision: \"\n user_choice = gets.chomp\n\n if valid_move?(user_choice)\n @state.set_spot(user_choice.to_i)\n @state.increment_turn_count\n @state.change_turn\n end\n end", "title": "" }, { "docid": "b1578616f47dd56bbedd16e29390e2e3", "score": "0.6506853", "text": "def move_type_toward_player\n sx = @x - $game_player.x\n sy = @y - $game_player.y\n if sx.abs + sy.abs >= 20\n move_random\n else\n case rand(6)\n when 0..3; move_toward_player\n when 4; move_random\n when 5; move_forward\n end\n end\n end", "title": "" }, { "docid": "82da061df5336d5fb143044ca6ca3609", "score": "0.64933085", "text": "def ask_player_for_move(current_player, stdin = STDIN)\n (current_player == COMPUTER_PLAYER) ? computer_move(current_player) : human_move(current_player, stdin)\n self\n end", "title": "" }, { "docid": "5461f6b2ce9ab564633ef9fe90ea2d29", "score": "0.6492483", "text": "def player_move()\n puts \"As #{@name}, what do you want to do this turn?\"\n puts \"1) Attack an enemy\"\n puts \"2) Heal an ally\"\n move = gets.chomp.to_i\n if move == 1\n return 1\n elsif move == 2\n return 2\n else\n puts \"command not found\"\n end\n end", "title": "" }, { "docid": "cdf38de0704771cb854f9ddb05f8981f", "score": "0.6485894", "text": "def choose_turn\n x = req_num(\"Who goes first? (1) Player 1 (2) Player 2\",1,2)\n\n if x == 1\n puts \"Player1: X\"\n puts \"Player2: O\"\n P1.role = X\n $P2.role = O\n else\n puts(\"Player2: X\")\n puts(\"Player1: O\") \n $P2.role = X\n P1.role = O\n end\n end", "title": "" }, { "docid": "d9f1bf97016ee253281365705a0be0da", "score": "0.6484119", "text": "def turn\n input = current_player.move(board)\n\n if board.valid_move?(input)\n board.update(input, current_player)\n board.display\n else\n turn\n end\n end", "title": "" }, { "docid": "93c72804a2a9a1c8e92d29bca416dbe3", "score": "0.64805245", "text": "def choose\n choice = ['rock', 'paper', 'scissors'].sample\n @move = case choice\n when 'rock' then Rock.new\n when 'paper' then Paper.new\n when 'scissors' then Scissors.new\n end\n move_history << choice\n end", "title": "" }, { "docid": "b7ad490217beaef989aabe88032b91b1", "score": "0.6478853", "text": "def choose_move\n puts \"Please choose a position to move to between 1-9.\"\n loop do\n input = gets.chomp.to_i\n if input > 0 && input < 10\n @move = input-1\n return @move\n else\n puts \"Your choice is not between 1-9. Please choose again.\"\n end\n end\n end", "title": "" }, { "docid": "8ddf4d84daace1d62b377c5c7b4e249e", "score": "0.6476562", "text": "def player_turn board, player\n\n # ask a player to select their move\n print \"Player #{player} >> Please select one coordinate for your move (eg. A3): \"\n player_move = gets.chomp.downcase\n puts\n\n # allows players to quit the game\n if player_move == \"q\"\n puts \"Thanks for playing! Goodbye :)\".colorize(:red)\n puts\n sleep 1\n exit \n end\n\n # loop until the player has made a valid move\n while true\n\n if user_choice(board, player_move) == \" \"\n move_on_board(player_move, board, player)\n break\n else\n print \"Oops! That move is invalid. Try again: \"\n player_move = gets.chomp.downcase\n puts\n end\n\n end\n\nend", "title": "" }, { "docid": "d46ebfbd624f5567f43847188cb0c58c", "score": "0.64762014", "text": "def move(moves)\n puts \"#{name}'s move: \"\n player_move = nil\n until(player_move)\n puts \"Available moves: #{moves.inspect}\"\n print \"What move? \"\n choice = gets.chomp.to_i\n if(moves.include?(choice))\n player_move = choice\n else\n puts \"Invalid move\"\n end\n end\n player_move\n end", "title": "" }, { "docid": "803163898f743f94f5430877bbe33098", "score": "0.6471186", "text": "def move_type_toward_player\n # Get difference in player coordinates\n sx = @x - $game_player.x\n sy = @y - $game_player.y\n # Get absolute value of difference\n abs_sx = sx > 0 ? sx : -sx\n abs_sy = sy > 0 ? sy : -sy\n # If separated by 20 or more tiles matching up horizontally and vertically\n if sx + sy >= 20\n # Random\n move_random\n return\n end\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Approach player\n move_toward_player\n when 4 # random\n move_random\n when 5 # 1 step forward\n move_forward\n end\n end", "title": "" }, { "docid": "803163898f743f94f5430877bbe33098", "score": "0.6471186", "text": "def move_type_toward_player\n # Get difference in player coordinates\n sx = @x - $game_player.x\n sy = @y - $game_player.y\n # Get absolute value of difference\n abs_sx = sx > 0 ? sx : -sx\n abs_sy = sy > 0 ? sy : -sy\n # If separated by 20 or more tiles matching up horizontally and vertically\n if sx + sy >= 20\n # Random\n move_random\n return\n end\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Approach player\n move_toward_player\n when 4 # random\n move_random\n when 5 # 1 step forward\n move_forward\n end\n end", "title": "" }, { "docid": "02885f0fa3934bea9634b2fae54147a8", "score": "0.6455756", "text": "def turn\n puts \"#{current_player.name}, where would you like to move?\"\n board.display\n current_move = current_player.move(board)\n if board.taken?(current_move)\n puts \"Sorry, that spot is taken. Please select an open position.\"\n turn\n elsif !board.valid_move?(current_move)\n puts \"Sorry, valid moves are positions 1-9. Please enter a valid move.\"\n turn\n else\n puts \"Turn #{board.turn_count + 1}: #{current_player.name} moves to position #{current_move}.\"\n board.update(current_move, current_player)\n end\n end", "title": "" }, { "docid": "1fe15b10252aa067ba24b49b6b17ea0d", "score": "0.6455647", "text": "def next_move\n\t\tchoice = rand(0..2)\n\t\tRSP[choice]\n\t\t# convert choice into one of the symbols :rock, :paper, :scissors\n\tend", "title": "" }, { "docid": "6d27735900921d0eb01050a059d548bd", "score": "0.6455353", "text": "def turn\n puts \"#{@current_player.name}\\'s de jouer. Choisi ta case entre (1-9): \"\n choice = gets.chomp.to_i\n if choice > 9 || choice < 1\n puts \"Attention mon COCO : le nombre doit etre compris entre 1 et 9\"\n elsif @current_player.move(choice) != false\n @winner = @current_player if @current_player.winner?\n @turn += 1\n switch_player\n end\n end", "title": "" }, { "docid": "761e27fe09c6bfbb8201286853260749", "score": "0.64552635", "text": "def move_type_toward_player\r\n # Get difference in player coordinates\r\n sx = @x - $game_player.x\r\n sy = @y - $game_player.y\r\n # Get absolute value of difference\r\n abs_sx = sx > 0 ? sx : -sx\r\n abs_sy = sy > 0 ? sy : -sy\r\n # If separated by 20 or more tiles matching up horizontally and vertically\r\n if sx + sy >= 20\r\n # Random\r\n move_random\r\n return\r\n end\r\n # Branch by random numbers 0-5\r\n case rand(6)\r\n when 0..3 # Approach player\r\n move_toward_player\r\n when 4 # random\r\n move_random\r\n when 5 # 1 step forward\r\n move_forward\r\n end\r\n end", "title": "" }, { "docid": "dd8a13054890c810f20d56409e3ea849", "score": "0.6454344", "text": "def get_player_move\n\n\tConsole_Screen.cls #clear the display area\n puts \"\\a\"\n\tloop do #loop forever\n\n\t\tConsole_Screen.cls #clear the display area\n\n\t\t#prompt the player to select a move\n\t\tputs \"To make a move, type one of the following:\\n\\n\"\n\t\tprint \"[R] [P] [S]: \"\n\n\t\t@choice = STDIN.gets #collect the player's answer\n\t\[email protected]! #remove any extra characters appended to string\n\n\t\t#terminate the loop if valid input was provided\n\t\tbreak if @choice =~ /R|P|S/i\n\n\t\t\t\n\t\tend\n\n\t\t#convert the player move to uppercase and return it to the calling \n\t\t#statement\n\t\treturn @choice.upcase\n\n\tend", "title": "" }, { "docid": "a05a98cf99a467bff5bc7ba35e66cd59", "score": "0.6454064", "text": "def move\n return win_lose if win_lose\n \n if current_game.turns == 1\n ai_first_move\n elsif current_game.turns == 3\n ai_second_move\n elsif current_game.turns == 5\n ai_third_move\n else\n ai_other_moves\n end\n\n end", "title": "" }, { "docid": "f91de41b96ed0c53755811be27130a4f", "score": "0.6453615", "text": "def move_type_toward_player\n sx = @x - $game_player.x\n sy = @y - $game_player.y\n abs_sx = sx > 0 ? sx : -sx\n abs_sy = sy > 0 ? sy : -sy\n if sx + sy >= 20\n move_random\n return\n end\n move_toward_player\n end", "title": "" }, { "docid": "990c9e823cc4d39858320bdcba54bf88", "score": "0.64529467", "text": "def computersMove\n move = rand(0..8)\n # checks to see if the move is available or not\n if (@availableMoves.include? move)\n puts \"Computer's turn\"\n makeMove(@computer, move)\n @availableMoves = @availableMoves - [move]\n else\n computersMove\n end\n end", "title": "" }, { "docid": "badd240fec8f0fdcf4e2acb330fc69b0", "score": "0.6446529", "text": "def turn\n input = current_player.move(board)\n if board.valid_move?(input)\n board.update(input, current_player)\n else\n puts \"That is not a valid move. Please choose another number.\"\n turn\n end\n board.display\n puts \"Next player:\"\n end", "title": "" }, { "docid": "9e0b5255a2cdb8a8ee129cfb9ed36317", "score": "0.6432942", "text": "def playerTurn\n puts \"Your turn\"\n printBoard\n puts \"Enter a number between 0 and 8\"\n move = gets.chomp.to_i\n # checks to see if the move is available or not\n if (@availableMoves.include? move)\n makeMove(@player, move)\n @availableMoves = @availableMoves - [move]\n printBoard\n else\n puts \"Spot not available\"\n playerTurn\n end\n end", "title": "" }, { "docid": "fa9f2964c2808418171972e9a22f8a16", "score": "0.643259", "text": "def turn\n #puts \"Please select an empty space in which to move, player #{current_player}, 1-9.\"\n #@board.display\n move = current_player.move(@board) #can't call repeatedly, need one instance\n if [email protected]_move?(move)\n #puts \"invalid #{move}\"\n turn #'til Human gets it right\n else\n @board.update(move, current_player)\n #puts \"Updated Board:\"\n @board.display\n end\n end", "title": "" }, { "docid": "b2ef01855e9c6cdee6339ff847425d77", "score": "0.6430605", "text": "def choose_to(from)\n to = nil\n puts \"#{@current_player.name}, you chose a #{@board.grids[from].class}. Now where do you want to put your chesspiece?\"\n while true\n to = ask_coordinate\n if all_legal_moves.include?([from, to])\n set_between_capture(from, to)\n break\n else\n puts \"Not a legal move\"\n end\n end\n to\nend", "title": "" }, { "docid": "87da8ddc12916cee7651455932298465", "score": "0.6423851", "text": "def play_turn\n match.show_board\n puts match.players[match.turn % 2].name + ', choose your movement (use available numbers): '\n movement = gets.chomp\n match.update_after_move(movement)\n end", "title": "" }, { "docid": "87903a641ebd09f40c14dcd56511b546", "score": "0.641605", "text": "def player_move(current_player)\n played = false\n until played\n puts 'Player ' + current_player + ': Where would you like to play?'\n player_choice = gets.chomp.upcase\n row = player_choice[0].to_i - 1\n col = COL_NUM[player_choice[1]]\n if validate_position(row, col)\n @board[row][col] = current_player\n played = true\n end\n end\n end", "title": "" }, { "docid": "120d446747a407fb6b75ee8ea5e64e45", "score": "0.64068353", "text": "def play\n\tmove = gets.chomp.to_i\n\tif @board.move_is_valid?(move)\n\t\tproceed_with(move)\n\telse \n\t\tputs \"That spot is taken. Try again.\"\n\t\tplay\n\tend\nend", "title": "" }, { "docid": "2b87e3c810ef6ae29d08d78fc654b595", "score": "0.6405087", "text": "def turn\n input = current_player.move(board)\n\n if board.valid_move?(input)\n board.update(input, current_player)\n board.display\n else\n turn\n end\n end", "title": "" }, { "docid": "ef38a08b93c96c5194cc187aaceb9c4e", "score": "0.640199", "text": "def play_selected_move(id)\n for i in 1..@p_moves_list[id].length-1\n src = @p_moves_list[id][i-1]\n dest = @p_moves_list[id][i]\n self.move(src[0], src[1], dest[0], dest[1])\n end\n \n @calculation_board.white_is_playing = !@calculation_board.white_is_playing\n @p_moves_list.clear \n end", "title": "" }, { "docid": "bcae32ca12dd0e2ce9aa171c08b0d982", "score": "0.6401893", "text": "def move_type_toward_player\n # プレイヤーの座標との差を求める\n sx = @x - $game_player.x\n sy = @y - $game_player.y\n # 差の絶対値を求める\n abs_sx = sx > 0 ? sx : -sx\n abs_sy = sy > 0 ? sy : -sy\n # 縦横あわせて 20 タイル以上離れている場合\n if abs_sx + abs_sy >= 20\n # ランダム\n move_random\n return\n end\n # 乱数 0~5 で分岐\n case rand(6)\n when 0..3 # プレイヤーに近づく\n move_toward_player\n when 4 # ランダム\n move_random\n when 5 # 一歩前進\n move_forward\n end\n end", "title": "" }, { "docid": "be7e379ea78d1727f10e72a9f384f20b", "score": "0.6398049", "text": "def move(options, human_role, cpu_role, skill)\n open_spaces = BOARD.free_moves(options)\n open_spaces.each do |s|\n options[s] = cpu_role\n unless BOARD.verify(BOARD.options) != cpu_role\n puts s\n return s\n end\n options[s] = s\n end\n \n # Block human from winning next move\n open_spaces.each do |s|\n options[s] = human_role\n unless BOARD.verify(BOARD.options) != human_role\n puts s\n return s\n end\n options[s] = s\n end\n \n # Choose best available spaces\n skill.each do |s|\n if open_spaces.include? s\n puts s\n return s\n end\n end\n end", "title": "" }, { "docid": "2e3cbe4591fdf8db2adea8e3682f05f4", "score": "0.6396246", "text": "def ask_move_p1\n loop do\n puts \"\\n#{@players_array[0].name}, choisissez la case où jouer: (A1/B2/C3...)\"\n print \"\\n> \"\n @chosen_move_p1 = gets.chomp.downcase\n if @valid_moves.include?(@chosen_move_p1) == true\n break\n end\n puts \"Choix invalide, réessayer.\"\n end\n @valid_moves.delete chosen_move_p1\n end", "title": "" }, { "docid": "92410a31741d9bbc220759d40f6331f9", "score": "0.6385298", "text": "def select_move(instruction)\n case instruction\n when \"l\" then self.turn(\"left\")\n when \"r\" then self.turn(\"right\")\n when \"f\" then self.forward\n else \n raise StandardError, \"The move needs to be of type l, r, or f.\"\n end\n end", "title": "" }, { "docid": "151da8697662adf0b61b0c6d18e1940c", "score": "0.63803387", "text": "def intelligent_move(board)\n offensive(board) || defensive(board) || random(board)\n end", "title": "" }, { "docid": "308a1476f0eb1f7cba7c137ea52489c3", "score": "0.6379044", "text": "def execute_player_move(player, board, moves)\n begin\n user_picked_correct_move = false\n \n user_move = player.make_move()\n user_move_coord = transform_user_move_into_coordinate(user_move)\n \n if user_move_coord != nil && board.valid_position?(user_move_coord.x, user_move_coord.y)\n moves.each do |origin|\n origin.each do |comp|\n if comp.destination.x === user_move_coord.x && comp.destination.y == user_move_coord.y\n user_picked_correct_move = true\n break\n end\n end\n break if user_picked_correct_move\n end \n end\n end until user_picked_correct_move\n\n puts\n puts \"You picked: (#{user_move_coord.x}, #{user_move_coord.y})\"\n puts\n \n flank_opponent_discs(user_move_coord, moves, board, player.color)\n end", "title": "" }, { "docid": "63ef186bedc7020058989a2c2f8ec440", "score": "0.63768405", "text": "def choose_position(player)\n\t\tcheck_answer do\n\t\t\tputs \"Hey #{player.name}, where you wanna play?\"\n\t\t\tgets.chomp.to_i\n\t\tend\n\tend", "title": "" }, { "docid": "722855952f85a2dc05ea06b6e11b332a", "score": "0.63717955", "text": "def execute_pick(available, positions, pick, obj)\n available.delete(pick)\n positions[pick] = 'X' if obj == \"Player\"\n positions[pick] = 'O' if obj == \"Computer\"\n evaluate_winner(available, positions, obj)\nend", "title": "" }, { "docid": "300529799d66c45617ae2085015784c0", "score": "0.6361315", "text": "def move(board, movechoice, playertoken = \"X\")\n movechoice = movechoice.to_i\n movechoice = movechoice - 1\n board [movechoice] = playertoken\nend", "title": "" }, { "docid": "42d60204ec48490d9aedd912b4619214", "score": "0.6361254", "text": "def turn\n if current_player.is_a?(Players::Human)\n valid_input = false\n\n until valid_input == true do\n input = current_player.move(board)\n valid_input = board.valid_move?(input)\n end\n\n self.board.cells[input.to_i - 1] = current_player.token\n\n else #computer should move\n self.board.cells[current_player.move(board).to_i - 1] = current_player.token\n end\n\n self.board.display\n end", "title": "" }, { "docid": "9709e2712afa8f85a6dab9eb01051244", "score": "0.63606185", "text": "def player_selection\n player_name = who_is_playing?\n puts \"What's your move #{player_name.name}?\"\n print \" >\" \n @selection = gets.chomp\n checking_selection\n end", "title": "" } ]
57d43294890f8636f8b1a742f54259b6
Builds the error from the raw JSON response and the specified status code.
[ { "docid": "0ca3792415d0c28af3b0200fede85d86", "score": "0.5738062", "text": "def initialize(headers, errors, status_code)\n @headers = headers\n\n if errors.is_a?(Array) || !errors\n @errors = (errors || []).map do |error|\n OpenStruct.new(error['error'])\n end\n else\n @errors = [OpenStruct.new(message: 'The API returned an unexpected '\\\n 'response. This is likely due to an incorrectly defined base URL.')]\n end\n\n @status_code = status_code\n end", "title": "" } ]
[ { "docid": "7261ba5c107cfd2b06d1535b15babe59", "score": "0.7565914", "text": "def build_error(msg, status)\n {\n json: {\n errors: [\n {\n \"status\": Rack::Utils::SYMBOL_TO_STATUS_CODE[status].to_s,\n \"title\": msg,\n \"detail\": msg\n }\n ]\n },\n content_type: 'application/vnd.api+json',\n status: status\n }\n end", "title": "" }, { "docid": "2f1cb6de64b9f7e530cd131901b1cbcd", "score": "0.6647961", "text": "def parse_platform_error(status_code, body)\n parsed = JSON.parse(body)\n data = parsed.is_a?(Hash) ? parsed : {}\n details = data.fetch(\"error\", {})\n msg = details.fetch(\"message\", \"Unexpected HTTP response with status #{status_code}; body: #{body}\")\n [msg, details]\n end", "title": "" }, { "docid": "322b8d773aae62ac510cad1eb571b13f", "score": "0.6646347", "text": "def error(status_code, error_message)\n content_type 'application/json'\n [status_code, JSON.dump({error: {message: error_message}})]\n end", "title": "" }, { "docid": "2cbb6dd89f2aeb3d3829327d0eeaa67a", "score": "0.6585053", "text": "def populate_error resp\n code = resp.http_response.status\n if EMPTY_BODY_ERRORS.include?(code) and empty_response_body?(resp.http_response.body)\n error_class = EMPTY_BODY_ERRORS[code]\n resp.error = error_class.new(resp.http_request, resp.http_response)\n else\n super\n end\n end", "title": "" }, { "docid": "708192b7f042f5ca98d1cd8a000eb0a6", "score": "0.65136415", "text": "def error(status, code, message)\n render :json => {:response_type => \"ERROR\", :response_code => code, :message => message}.to_json, :status => status\n end", "title": "" }, { "docid": "b22ea24b39f1599e32ffbf0fc4c10a6b", "score": "0.64871454", "text": "def build_error_response(error)\n error_messages = messages_from_error(error)\n\n JsonRender.convert(:status => :error, :messages => error_messages)\n end", "title": "" }, { "docid": "2e786022ac88f880d529c4486b51b20b", "score": "0.64531535", "text": "def json_error err, status = 400, headers = {}\n\t\t\tjson_resp({'error' => err}, status, headers)\n\t\tend", "title": "" }, { "docid": "b0b0814876732f660ecef3ecfbad1295", "score": "0.6451444", "text": "def legacy_error status, message, extra={}\n case status\n when Error\n status = status.http_code\n when StandardError\n extra[:backtrace] = status.backtrace if params[:backtrace]\n status = 500\n end\n content_type 'application/json'\n return status, {\n error: message,\n }.merge(extra).to_json\n end", "title": "" }, { "docid": "5b9bc8a3abb7110f0bf886b7d4f39f34", "score": "0.6362975", "text": "def build_excon_response(body, status = 200)\n response = Excon::Response.new(:body => body, :status => status)\n if body && body.key?(\"error\")\n msg = \"Google Cloud did not return an error message\"\n\n if body[\"error\"].is_a?(Hash)\n response.status = body[\"error\"][\"code\"]\n if body[\"error\"].key?(\"errors\")\n msg = body[\"error\"][\"errors\"].map { |error| error[\"message\"] }.join(\", \")\n elsif body[\"error\"].key?(\"message\")\n msg = body[\"error\"][\"message\"]\n end\n elsif body[\"error\"].is_a?(Array)\n msg = body[\"error\"].map { |error| error[\"code\"] }.join(\", \")\n end\n\n case response.status\n when 404\n raise Fog::Errors::NotFound.new(msg)\n else\n raise Fog::Errors::Error.new(msg)\n end\n end\n\n response\n end", "title": "" }, { "docid": "d2e3360afedcd9b215ec903243cdc73e", "score": "0.6202979", "text": "def status_to_error(status)\n case status\n when 1\n 'InvalidRequest'\n when 2\n 'InvalidCredentials'\n when 3\n 'NonExistentOrder'\n when 4\n 'NonExistentOrderItem'\n when 5\n 'InvalidStateChange'\n when 6\n 'InvalidStorno'\n when 7\n 'AnotherError'\n when 8\n 'OrderNotExported'\n when 9\n 'AutomaticDeliveryError'\n end\n end", "title": "" }, { "docid": "da4293ab26cce0c191e2c82f0eb7943e", "score": "0.6152426", "text": "def json_error_response\n # status must be assigned, ||= will often return 200\n self.status = 401\n self.content_type = \"application/json\"\n # have to include format_json here because custom error app\n # doesn't seem to call render json: as normal\n # so pretty param is ignored\n self.response_body = format_json(\n { errors: [{ status: status, detail: i18n_message }] },\n {} # options hash normally handled by render block\n )\n end", "title": "" }, { "docid": "9a69f4e598e01c1ff49857244a359784", "score": "0.6148777", "text": "def generic(code)\n {}.tap do |data|\n data[:errors] = { code: code, message: status.fetch(code.to_s.to_sym) }\n end\n end", "title": "" }, { "docid": "a1757ddbbed1cd8c12edeca43efe2af2", "score": "0.6142995", "text": "def _error(message,code) \n status code\n response.headers['Content-Type'] = 'application/json'\n body({:error=>{:message=>message}}.to_json)\n end", "title": "" }, { "docid": "5f993d7f3be05a7608306511586a782b", "score": "0.6116094", "text": "def render_error(error_code_and_message)\n LogWrapper.log('ERROR', {\n 'message' => error_code_and_message[1],\n 'method' => \"#{controller_name}##{action_name}\",\n 'status' => error_code_and_message[0]\n })\n return api_response_builder(error_code_and_message[0], {message: error_code_and_message[1]}.to_json)\n end", "title": "" }, { "docid": "02a1f1bad08e4561c1dcddbe93a7e823", "score": "0.6106252", "text": "def handle_error(errors, status, content_type)\n if defined?(Rails)\n Rails.logger.warn \"RESPONSE STATUS: #{status}\"\n Rails.logger.warn errors\n end\n\n OpenStruct.new(success?: false, status: status, body: { errors: errors }, content_type: content_type)\n end", "title": "" }, { "docid": "4c2eea5ffb7b967acb84cb10c8cdbd43", "score": "0.61000496", "text": "def build_json_error(opts = {})\n json_body = { errors: [{ status: opts[:error_code] }] }\n json_body[:errors][0].store('message', opts[:message]) if opts[:message]\n if opts[:pointer]\n json_body[:errors][0].store(\n 'source',\n build_json_error_source(\n opts[:pointer],\n opts[:parameter]\n )\n )\n end\n json_body.to_json\n end", "title": "" }, { "docid": "df839bf38d7a36b5c1e3e96d82a9f362", "score": "0.6088429", "text": "def error!(status, message)\n response.status = status\n response[\"Content-Type\"] = \"application/json\"\n response.write({error: message}.to_json)\n request.halt\n end", "title": "" }, { "docid": "a9dceb0b80820bef2a9de4c82241c7a1", "score": "0.6083019", "text": "def render_error(status, msg)\n render json: {errors: [msg]}, status: status\n end", "title": "" }, { "docid": "616273574ee221770484cc4b3e8c8073", "score": "0.60490716", "text": "def send_error(code, status = :bad_request, error = nil, data = nil)\n error_hash = {\n code: code\n }\n\n error_hash[:message] = error if error\n error_hash[:data] = data if data\n\n render json: error_hash, status: status\n end", "title": "" }, { "docid": "3484c73376fa83f39d4ff27b366d69b9", "score": "0.6042301", "text": "def create_response(api_response, errors)\n Rails.logger.error \"#{Time.now} ERRORS: #{errors}\"\n api_response[:code] = 99 if errors.length >= 1\n unless errors.empty?\n long_error = \"\"\n errors.each do |error|\n long_error += \"#{error} \"\n end\n api_response[:result] = long_error\n end\n return api_response\n end", "title": "" }, { "docid": "44c88cb01448b518c16e36ce4324caba", "score": "0.6023412", "text": "def error!(error_hash = {}, status_code = 500)\n raise Errors::ApiError.new(error_hash, status_code)\n end", "title": "" }, { "docid": "141d321351d936f2d52b68c2bb1b583d", "score": "0.6022987", "text": "def render_error message, status\n error = {\n error: {\n message: message\n }\n }\n render json: error, status: status\n end", "title": "" }, { "docid": "cdcfdcb6f95e1a97b9a9caf1c8ea53e7", "score": "0.601952", "text": "def api_error(status_code, field_name, field_description)\n endpoint_info[:api_errors] << {\n status_code: status_code,\n response_field_name: field_name,\n response_field_description: field_description\n }\n end", "title": "" }, { "docid": "84cb34b153bf86816776782873cfd207", "score": "0.6005474", "text": "def error(message, code)\n error_response = {\n message: message\n }\n render :json => error_response, :status => code\n end", "title": "" }, { "docid": "e736a41ea13abf108bfaabfb71f4981d", "score": "0.5996837", "text": "def error\n return unless body['error'] || body['error_message']\n\n error_response = normalize_error(body)\n deserialize_json(error_response)\n end", "title": "" }, { "docid": "3a049b86fd5a1042e85cc8a656e8f743", "score": "0.5902077", "text": "def error_base\n {\n code: JSONAPI::VALIDATION_ERROR,\n status: :unprocessable_entity\n }\n end", "title": "" }, { "docid": "225a6447dd77d55720108af2b76eff77", "score": "0.5868096", "text": "def render_api_error(code, status_code, type = 'error' , message = nil)\n error = {}\n error[\"code\"] = code\n error[\"type\"] = type\n error[\"message\"] = message || API_CONFIG[\"api.error\"][code]\n Rails.logger.info(\"Rendered API error. Request: #{request.body.read} \\n Responded:\\n#{{error: error, status: status_code}}\")\n render json: {'error' => error}.to_json, status: status_code\n end", "title": "" }, { "docid": "15c848d3acea8c765fb019647b585199", "score": "0.5833917", "text": "def render_json_error(error_code, extra = \"\")\n error = {\n title: I18n.t(\"error_messages.#{error_code}.title\"),\n status: I18n.t(\"error_messages.#{error_code}.code\")\n }\n\n detail = I18n.t(\"error_messages.#{error_code}.detail\", default: '')\n error[:detail] = extra || detail #unless detail.empty?\n render json: error\n end", "title": "" }, { "docid": "4fd32b018606a24b64d59720a22c5a00", "score": "0.5825293", "text": "def parse_client_error(error)\n response = MultiJson.load(error.body)\n { error: response['error'] }\n rescue MultiJson::ParseError\n {\n error: {\n 'code' => error.status_code,\n 'message' => error.body,\n 'errors' => []\n }\n }\n end", "title": "" }, { "docid": "a9ae57d748f35c9d1bad5b58217f3b35", "score": "0.5824271", "text": "def binding_error(status_code:, messages:)\n OpenStruct.new(status_code: status_code, messages: messages)\n end", "title": "" }, { "docid": "fb1ec552c71bc1f23946e48bafee21ca", "score": "0.5821995", "text": "def raise_http_errors(status, message)\n error_class = Starwars::Error.errors[status]\n fail(error_class.new(message, status)) if error_class\n end", "title": "" }, { "docid": "709a5fd06a34ed1ad4ae5c42b31a9915", "score": "0.5813478", "text": "def render_error error_code, error_type, text\n content_type :json\n\n #compose output JSON\n output = { \n :status => \"error\", \n :code => error_code.to_i, \n :error_type => error_type.to_s, \n :executed_at => Time.now.strftime(\"%Y-%m-%d %H:%M:%S\"), \n }\n\n if text.is_a?(Hash)\n output.merge!(text)\n else\n output[:message] = text \n end\n\n #warning about conent type!\n output[:warning_invalid_content_type] = \"Please set request header content-type to 'application/json' - if you will not se it you are limited by 64KB by request\" unless request.env['CONTENT_TYPE'] && request.env['CONTENT_TYPE'].include?(\"application/json\")\n\n #items and name specified\n halt error_code.to_i, Yajl::Encoder.encode(output)\n end", "title": "" }, { "docid": "a3a0954a44e3c696b8d38bbb12b49c9b", "score": "0.5807926", "text": "def http_error(code, message = nil, headers = {})\n [code, {'Content-Type' => 'text/plain; charset=utf-8'}.merge(headers),\n [http_status(code) + (message.nil? ? \"\\n\" : \" (#{message})\\n\")]]\n end", "title": "" }, { "docid": "bf675d3cabfd02de8fec1e492427b4d9", "score": "0.5805025", "text": "def parse_error(response)\n ret = ''\n code = nil\n message = nil\n details = nil\n if (response.respond_to?(:status))\n code = response.status.to_s\n end\n if (response.respond_to?(:body))\n details = response.body.to_s\n begin\n err_msg = MultiJson.decode(response.body)\n err_msg.map { |_,v|\n if ! v.kind_of? Hash\n message = v.to_s\n next\n end\n code = v[\"code\"].to_s if v.has_key?(\"code\")\n message = v[\"message\"] if v.has_key?(\"message\")\n details = nil\n details = v[\"details\"] if v.has_key?(\"details\")\n }\n rescue MultiJson::DecodeError => error\n end\n else\n message = \"Unknown error response: \" + response.to_s\n end\n ret += code + \" \" unless code.nil?\n ret += message unless message.nil?\n unless details.nil?\n ret += \": \" unless ret.empty?\n ret += details\n end\n return ret\n end", "title": "" }, { "docid": "4bb92cebbca19afdbd15ef67fd7a0d05", "score": "0.5804567", "text": "def error_msg(code=ErrorCodes::INTERNAL_SERVER_ERROR, detail=\"Unspecified error\", errors = nil, data = nil)\n @response[:errors] = {\n code: code[:code],\n detail: detail,\n errors: errors,\n data: data\n }\n end", "title": "" }, { "docid": "c44b09c1c55b28e0fe134f1ca232d121", "score": "0.5789811", "text": "def response_error(args = {})\n opts = { code: 418 }\n opts[:message] ||= args\n render status: opts[:code], json: {\n message: opts[:message]\n }\n end", "title": "" }, { "docid": "ff0993ae2343a71b1ec8c50d8fa325c6", "score": "0.57644236", "text": "def error\n response_json.fetch(\"error\", \"\")\n end", "title": "" }, { "docid": "982c800c889de1962374edd64da20fbc", "score": "0.5751365", "text": "def error_response_method(error)\n if !params[:format].nil? && params[:format] == \"json\"\n @error = {}\n @error[\"code\"]=error[\"status_code\"]\n @error[\"message\"]=error[\"status_message\"]\n return @error\n end\n end", "title": "" }, { "docid": "30567889485583e4e70c7bd17fd1a9fb", "score": "0.57487476", "text": "def response_for(status, exception)\n render json: {\n errors: [exception.message],\n }, status: status\n end", "title": "" }, { "docid": "544bc5a326150798668b80d81d7ef7e6", "score": "0.57434016", "text": "def set_error(status)\n error_response = Rack::Response.new\n error_response.status = status\n @error_response = error_response.finish {yield}\n end", "title": "" }, { "docid": "ff9e39c177a4f0a656fc0ed922299fda", "score": "0.5737749", "text": "def render_json_error(error_message, status = 400)\n render_json_errors [error_message], status\n end", "title": "" }, { "docid": "49620b8bd8e7dab645d33ec1bef1fd51", "score": "0.57300776", "text": "def add(status, code, title: nil, details: nil, meta: nil)\n @errors << {}.tap do |err|\n err[:status] = (status || @status).to_s\n err[:code] = code\n err[:title] = title if title.present?\n err[:detail] = details if details.present?\n err[:meta] = Hash(meta) if meta.present?\n end\n end", "title": "" }, { "docid": "6b62a14b3b457cdfb8405409548bde40", "score": "0.57288545", "text": "def validate_response(response) # :nodoc:\n code = response.code.to_i\n raise HttpError, \"#{code} #{response.msg}\" if code < 200 || code > 299\n end", "title": "" }, { "docid": "6825e29ba1425057a82fbd6d01e453d9", "score": "0.5727097", "text": "def status_code; 422; end", "title": "" }, { "docid": "6825e29ba1425057a82fbd6d01e453d9", "score": "0.5727097", "text": "def status_code; 422; end", "title": "" }, { "docid": "6825e29ba1425057a82fbd6d01e453d9", "score": "0.5727097", "text": "def status_code; 422; end", "title": "" }, { "docid": "6825e29ba1425057a82fbd6d01e453d9", "score": "0.5727097", "text": "def status_code; 422; end", "title": "" }, { "docid": "ffa054e471215c7718891ab0f47afd06", "score": "0.5724645", "text": "def initialize(response)\n response.error = self\n @response = response\n\n message = []\n\n if response.parsed.is_a?(Hash)\n @code = response.parsed['error']\n @description = response.parsed['error_description']\n message << \"#{@code}: #{@description}\"\n end\n\n message << response.body.force_encoding(\"UTF-8\")\n\n super(message.join(\"\\n\"))\n end", "title": "" }, { "docid": "a9bf56f4864d29d4503111a9e9ed402e", "score": "0.5720056", "text": "def status_code\n @status_code || errors.empty? ? 200 : 422\n end", "title": "" }, { "docid": "ae30533c18974117a8750b2f482b09c2", "score": "0.57154816", "text": "def failure(message:, statusCode: 404)\n {\n isBase64Encoded: false,\n statusCode: statusCode,\n body: {\n error: message\n }.to_json\n }\nend", "title": "" }, { "docid": "42fa295f745951dab52ad5afc27db10c", "score": "0.5714423", "text": "def from_response(response)\n\n payload = response.body\n @error = payload['error']\n @error_code = payload['error_code']\n @details = payload['details']\n @response = response\n\n logger.error(\"Request failed with status #{response.code.to_s}: '#{@error_code} #{@error}': #{response.body}\")\n\n self\n end", "title": "" }, { "docid": "bd25644605a311a1379627cd3435dffa", "score": "0.570112", "text": "def from_error(error)\n child = error.get_elements('Errors')[0].get_elements('error')[0]\n code = child.attributes['code']\n exception = exceptions.find{|exc| exc.http_code == code }\n exception ||= self\n message = child.children.empty? ? '' : child.children[0].attributes['message']\n exception.new code, message\n end", "title": "" }, { "docid": "62bc34009989142a6eb3b226f0dd7d6c", "score": "0.5678818", "text": "def error(response)\n ChefAPI::Log.info \"Parsing response as error...\"\n\n case response[\"Content-Type\"]\n when /json/\n ChefAPI::Log.debug \"Detected error response as JSON\"\n ChefAPI::Log.debug \"Parsing error response as JSON\"\n message = JSON.parse(response.body)\n else\n ChefAPI::Log.debug \"Detected response as text/plain\"\n message = response.body\n end\n\n case response.code.to_i\n when 400\n raise Error::HTTPBadRequest.new(message: message)\n when 401\n raise Error::HTTPUnauthorizedRequest.new(message: message)\n when 403\n raise Error::HTTPForbiddenRequest.new(message: message)\n when 404\n raise Error::HTTPNotFound.new(message: message)\n when 405\n raise Error::HTTPMethodNotAllowed.new(message: message)\n when 406\n raise Error::HTTPNotAcceptable.new(message: message)\n when 504\n raise Error::HTTPGatewayTimeout.new(message: message)\n when 500..600\n raise Error::HTTPServerUnavailable.new\n else\n raise \"I got an error #{response.code} that I don't know how to handle!\"\n end\n end", "title": "" }, { "docid": "e68f1e646d5b43a435a6b84e998aa3ca", "score": "0.567152", "text": "def build_object\n response = make_request\n body = JSON.load(response.body) if response.body \n body = { response: body } if body.is_a? Array\n hash = body.to_snake_keys if body\n response_object = Hashie::Mash.new(hash)\n response_object.status_code = response.code.to_i unless response_object.status_code\n response_object\n end", "title": "" }, { "docid": "50c00edaadea0a9fc5f56ec0d26559b3", "score": "0.5671106", "text": "def initialize(status_code, result)\n @status_code = status_code\n @result = result\n end", "title": "" }, { "docid": "b3b16a1cfc91d3bd2ba0e8d4a2c14579", "score": "0.5664385", "text": "def initialize(status_code)\n @status_code = status_code\n end", "title": "" }, { "docid": "6f1538c58a2a370f34203dcbc80ab616", "score": "0.5640436", "text": "def format_response_or_raise_error response\n if response.status / 100 == 2\n response.body\n elsif response.status == 404\n raise Unloq::APIError::NotFoundError.new(response.status, response.body)\n else\n raise Unloq::APIError.new(response.status, response.body)\n end\n end", "title": "" }, { "docid": "ae90d7d3aedd4b2ddbf2209981b5f7eb", "score": "0.56295246", "text": "def parsed_error\n default = %({\"error_description\": \"#{message}\"})\n value = response_value(:body, fallback: default)\n\n JSON.parse(value)\n end", "title": "" }, { "docid": "264d1eff2e39fba2bf0cdfd44bed3038", "score": "0.5622495", "text": "def initialize(http_response, http_response_code, http_raw_response)\n @http_status_code = http_response_code\n @http_raw_response = http_raw_response\n\n # only set these variables if a message-body is expected.\n if not @http_raw_response.kind_of? Net::HTTPNoContent\n @body = MultiJson.load(http_response) unless http_response.nil?\n @request = MultiJson.load(@body[\"request\"].to_s) if @body[\"request\"]\n @api_status = @body[\"status\"].to_i if @body[\"status\"]\n @api_error_message = @body[\"error_message\"].to_s if @body[\"error_message\"]\n end\n end", "title": "" }, { "docid": "fe9c931c4e9cf2d94ded384b6227ddb9", "score": "0.56159866", "text": "def return_error_infos(status, error_message, error_code, values)\n if values.nil?\n render :status => status, :json => { :error => { :message => error_message, :code => error_code }}\n else\n render :status => status, :json => { :error => { :message => error_message, :values => values, :code => error_code }}\n end\n end", "title": "" }, { "docid": "9eef5385c3baf9720badb058440882fc", "score": "0.5614664", "text": "def render_error_add status = :unprocessable_entity, string\n render status: status, json: {errors: [I18n.t(\"error.#{string}\")]}\n end", "title": "" }, { "docid": "5b5fb9cb4183faf8d1f67a2bdecbbc39", "score": "0.56019956", "text": "def error!(status, message)\n request.halt status, {error: message}.to_json\n end", "title": "" }, { "docid": "5b5fb9cb4183faf8d1f67a2bdecbbc39", "score": "0.56019956", "text": "def error!(status, message)\n request.halt status, {error: message}.to_json\n end", "title": "" }, { "docid": "7ffae2fdc0b02ca3a31cc60416c7a0c7", "score": "0.55955964", "text": "def handle_status_code(req)\n case req.code\n when 200..204; return\n when 400; raise ResponseError.new req\n when 401; raise ResponseError.new req\n else raise StandardError\n end\n end", "title": "" }, { "docid": "768f6e915eb1de7834587b9a4482da1d", "score": "0.55912346", "text": "def parse_error(env, status_to_render)\n raise Common::Exceptions::BackendServiceException.new(\n \"VETEXT_#{status_to_render}\",\n {\n detail: parse_detail(env.body),\n code: \"VETEXT_#{env.status}\",\n source: \"#{env.method.upcase}: #{env.url.path}\"\n },\n env.status,\n env.body\n )\n end", "title": "" }, { "docid": "e8b116f7cb6c058c2d42e6db042f8e42", "score": "0.5584518", "text": "def check_error(json)\n if json[\"nyplAPI\"][\"response\"][\"headers\"][\"status\"] == \"error\"\n msg = \"NYPL Repo API Error: \" + json[\"nyplAPI\"][\"response\"][\"headers\"][\"code\"] + \" \"+ json[\"nyplAPI\"][\"response\"][\"headers\"][\"message\"]\n raise msg\n end\n\n end", "title": "" }, { "docid": "aaeb64a9b6d28d7efe3e203bc96515dc", "score": "0.55804014", "text": "def build_error_response_body(message) \n JSON.generate({\n \"findItemsByKeywordsResponse\": [\n {\n \"ack\": 'failure',\n \"version\": '1.0.0',\n \"timestamp\": Time.now.utc,\n \"error_message\": message,\n \"searchResult\": [\n \"count\": 0,\n \"item\": []\n ]\n }\n ] \n })\n end", "title": "" }, { "docid": "d09138586849d449dc8bc2e8d2eba7b9", "score": "0.5577141", "text": "def extract_error_code response\n return unless response\n return unless response['data'] && response['data'].class == Hash\n return unless response['data']['errorCode']\n\n response['data']['errorCode'].to_i\n end", "title": "" }, { "docid": "81735e6479047438a3eedfd8c22dbe2d", "score": "0.5569024", "text": "def error_message(errors, status)\n render json: { errors: errors }, status: status\n end", "title": "" }, { "docid": "f8d6a60f6351735ba352c0e5ac46eebc", "score": "0.55679", "text": "def fail_response(data={})\n status = data.delete(:status) || 400\n {\n status: status,\n json: {\n status: \"fail\",\n data: data\n }\n }\n end", "title": "" }, { "docid": "d9623f491a8b1906c144e8b934c1b130", "score": "0.5560173", "text": "def set_error(error_code, msg, status_code=nil)\n return if @error\n @error = {:code => error_code, :message => msg} \n @status_code = status_code || 500\n end", "title": "" }, { "docid": "344d3640436328eb358fae45a3707499", "score": "0.5554492", "text": "def buildError(error)\n code = error[:code]\n text = error[:text]\n type = getTypeFromCode(code)\n field = nil\n\n if !type.nil? and ERROR_FIELDS.has_key? type\n field = ERROR_FIELDS[type]\n else\n field = getFieldFromText(text)\n end\n\n return {\n :code => code,\n :text => text,\n :type => type,\n :field => field,\n }\n end", "title": "" }, { "docid": "b3ca658b99d58a63c176348d60ba1299", "score": "0.55486864", "text": "def render_error(err)\n json_response({ message: err }, :unprocessable_entity)\n end", "title": "" }, { "docid": "13d46db49b377cfabbe0ab6593ac0bc1", "score": "0.5541989", "text": "def check_for_errors\n info = MultiJson.load(self.body).first\n\n if info['result'] && info['result'] != 0\n if info['result'] == 500\n raise Webceo::Api::ServerError.new(self.status.to_i, self.body)\n else\n raise Webceo::Api::ClientError.new(self.status.to_i, self.body)\n end\n end\n end", "title": "" }, { "docid": "779c879473bf3683926d782fb276ffd5", "score": "0.5531577", "text": "def err(code, hash, opts = {})\n error = { error: hash.merge(code: code) }\n error = error.merge(meta: opts) if opts.keys.any?\n ::Aux.h2json(error)\n end", "title": "" }, { "docid": "04f691c2cb91df0776a6a100ef8e9878", "score": "0.55240154", "text": "def render_json(status=200)\n # If successful, render given status\n if @response[:errors].nil?\n render json: @response, status: status\n else\n # If not successful, render with status from ErrorCodes module\n render json: @response, status: ErrorCodes.const_get(@response[:errors][:code])[:status]\n end\n end", "title": "" }, { "docid": "f898b0efc4b864b92eb55e5c01ad2214", "score": "0.5523802", "text": "def render_json_error(obj, opts = {})\n opts = { status: opts } if opts.is_a?(Fixnum)\n render json: MultiJson.dump(create_errors_json(obj, opts[:type])), status: opts[:status] || 422\n end", "title": "" }, { "docid": "e8bd87cf22b25d6861d84d2581a008f5", "score": "0.55181646", "text": "def render_error(code, message)\n respond_with Utils::RenderableError.new(code, message), status: code\n end", "title": "" }, { "docid": "197f6608e658f618f8066e6f49c8a786", "score": "0.55094296", "text": "def initialize(status_code, headers={}, body='')\n @status_code = status_code.to_i\n @headers = headers\n @body = body\n end", "title": "" }, { "docid": "2728999c02023b292e7f35c947683ca5", "score": "0.5506533", "text": "def handle_response(response) # :nodoc:\n case response.code\n when 400\n #IN CASE WE WANT MORE PRECISE ERROR NAMES\n #data = response.parsed_response\n #case data['code']\n #when 230\n # raise ParameterDataInvalid.new data\n #else\n # raise BadRequest.new data\n #end\n raise BadRequest.new(response.parsed_response)\n when 403\n raise Unauthorized.new(response.parsed_response)\n when 404\n raise NotFound.new\n when 400...500\n raise ClientError.new\n when 500...600\n raise ServerError.new\n else\n response.parsed_response\n end\n end", "title": "" }, { "docid": "7b0336aadebc4da330f8c657855f4d43", "score": "0.550543", "text": "def status_code\n return manual_status_code if manual_status_code\n return 422 if errors.present?\n return 200 if result\n return 400\n end", "title": "" }, { "docid": "668b68a1253a65ddc2bcfd4bccacdb31", "score": "0.5503543", "text": "def api_response(*args) # :nodoc:\n code = args.first\n args.shift\n\n err = @@ERROR_CODES[code] || @@ERROR_CODES[:unknown]\n render :json => {\n :error => {\n :code => err[0],\n :message => err[1],\n },\n :content => args.first,\n }, :status => err[2]\n end", "title": "" }, { "docid": "02705dabeffe55517012a4bc5535f68e", "score": "0.54903156", "text": "def error(message, status = 422)\n render text: message, status: status\n end", "title": "" }, { "docid": "880ceab002cb3815df86acd7201b94e3", "score": "0.548282", "text": "def render_error(resource, status)\n render json: resource, status: status, adapter: :json_api, serializer: ActiveModel::Serializer::ErrorSerializer\n end", "title": "" }, { "docid": "57638959f0c751e7668a69f9492fa311", "score": "0.5469", "text": "def render_error_json(msg = '', status = :internal_server_error, data = nil, links = nil)\n render json: {\n status: 'error',\n code: ApplicationHelper.code_status[status],\n msg: msg,\n data: data,\n links: links\n }, status: status\n end", "title": "" }, { "docid": "40b7c132cf3b43f99e4e6753a6565cc7", "score": "0.54657567", "text": "def failure(response)\n catch_throttling_error(response)\n parsed_response = JSON.parse(response.body.to_s)\n raise RequestError, parsed_response['detail']\n rescue JSON::ParserError\n raise RequestError, response.status\n end", "title": "" }, { "docid": "718fe4113ca434d425c09db1e158a82f", "score": "0.5460673", "text": "def error(body)\n parsed_body = JSON.parse(body)\n \"#{parsed_body['errorNum']}: #{parsed_body[\"errorMessage\"]}\"\n end", "title": "" }, { "docid": "2a54e7e25156931136c766c7ff6e139f", "score": "0.5457983", "text": "def resp_error(message = '')\n # {code: 300, message: message}\n error!({code: 300, message: message}, 300)\n end", "title": "" }, { "docid": "d871c6bc0832f7cd9c9a020782a4b9f6", "score": "0.5451932", "text": "def error_message(response)\n json = parse_as_json(response)\n json.dig('error', 'message')\n rescue UnexpectedResponseError\n summary = \"Status: #{response.code}; Body: #{response.body}\"\n \"Could not parse error message. #{summary}\"\n end", "title": "" }, { "docid": "295d00c8900557f38650fa13926d4580", "score": "0.54498684", "text": "def error_response(status_code, message=nil)\n message ||= \"Your request has been denied as a #{status_code} error\"\n raise select_error(status_code), message\n end", "title": "" }, { "docid": "f6cd4c29ff9b446a54ea5893b495ee4d", "score": "0.5447686", "text": "def validation_error(resource, status = 400, title = 'Bad Request')\n render json: {\n errors: [\n {\n status: status,\n title: title,\n detail: resource.errors,\n code: '100'\n }\n ]\n }, status: status\n end", "title": "" }, { "docid": "bda1f5e7f1486b6c7a8bbc8c47d5b75f", "score": "0.5439389", "text": "def validate(response)\n unless response.code == 200\n message = response.parsed_response\n message = message['error'] if message.respond_to?(:has_key?) and message.has_key?('error')\n message = message['message'] if message.respond_to?(:has_key?) and message.has_key?('message')\n raise RequestError.new(message, response.code)\n end\n\n response\n end", "title": "" }, { "docid": "e9e7583e9b0209ca26b69d46335fbae9", "score": "0.5438988", "text": "def error(code=500, body = nil)\n unless code.is_a?(Integer)\n body = code\n code = 500\n end\n\n response.status = code\n response.body = body if body\n halt\n end", "title": "" }, { "docid": "e18d5bfd10e6d20471898358b0001002", "score": "0.54242337", "text": "def error_response(opts={}, message=\"Server Error\")\n status = opts.delete(:status) || 500\n {\n status: status,\n json: {\n status: \"error\",\n message: message\n }\n }\n end", "title": "" }, { "docid": "dbcb00b621e317248594583ddb2738a0", "score": "0.54143924", "text": "def raise_api_error_msg(res)\n \"HTTP status code: #{res.status}, \" \\\n \"Error message: #{res.body['message']}, \" \\\n \"Reference: #{res.body['reference']}\"\n end", "title": "" }, { "docid": "327667c5f3938effe04c440e4942b7b9", "score": "0.5413445", "text": "def validate(response)\n case response.code\n when 400 then fail(Error::BadRequest.new, error_message(response))\n when 401 then fail(Error::Unauthorized.new, error_message(response))\n when 403 then fail(Error::Forbidden.new, error_message(response))\n when 404 then fail(Error::NotFound.new, error_message(response))\n when 405 then fail(Error::MethodNotAllowed.new, error_message(response))\n when 409 then fail(Error::Conflict.new, error_message(response))\n when 500 then fail(Error::InternalServerError.new, error_message(response))\n when 502 then fail(Error::BadGateway.new, error_message(response))\n when 503 then fail(Error::ServiceUnavailable.new, error_message(response))\n end\n response.parsed_response\n end", "title": "" }, { "docid": "a2f8b7f1fd4ae98a3b0ea7ef33350dda", "score": "0.541175", "text": "def render_error_message(error_message)\n error_response = { error_message: error_message }\n render json: error_response, status: :unprocessable_entity\n end", "title": "" }, { "docid": "1fb2087ee3a6b27c76821b1bda24840d", "score": "0.5402655", "text": "def render_unprocessable_entity(error)\n json_response({ error: { message: error.message } }, :unprocessable_entity)\n end", "title": "" }, { "docid": "558077683ffce277f5fbdd2cd2ac7410", "score": "0.5400932", "text": "def extract_error(response, _parsed_response)\n [response.status.to_s, response.body.to_str].reject(&:empty?).join(': ')\n end", "title": "" }, { "docid": "07b35fa6cad8a7df40c21031dc0ee5ad", "score": "0.5399931", "text": "def render_error_messages(errors, status = :unprocessable_entity)\n render(json: { errors: errors }, status: status)\n end", "title": "" } ]
62881b9f2547d7effa578e7b05e5b90e
Returns the names of all branches containing the given commit.
[ { "docid": "8e9e0494c8328ce3780d30f116d078c1", "score": "0.7334887", "text": "def branches_containing_commit(commit_ref)\n `git branch --column=dense --contains #{commit_ref}`.\n sub(/\\((HEAD )?detached (from|at) .*?\\)/, ''). # ignore detached HEAD\n split(/\\s+/).\n reject { |s| s.empty? || s == '*' }\n end", "title": "" } ]
[ { "docid": "068b74a1ecdda33d7b06897f6bd941a4", "score": "0.69083405", "text": "def get_branch_names(repo)\n repo.heads.collect(&:name)\n end", "title": "" }, { "docid": "2a7c8edca55ca615665bc632fd8f094b", "score": "0.69041085", "text": "def branches_containing_commit(commit_ref); end", "title": "" }, { "docid": "2a7c8edca55ca615665bc632fd8f094b", "score": "0.6903793", "text": "def branches_containing_commit(commit_ref); end", "title": "" }, { "docid": "0e530579ceeb2f18b5e996a32e77fc13", "score": "0.6656717", "text": "def all_branches\n @branches ||= git_call('branch -a').split(\"\\n\").collect { |s| s.strip }\n end", "title": "" }, { "docid": "8492794b457474cc4d58f77e85db785a", "score": "0.6607323", "text": "def branches\n @branch_heads.keys\n end", "title": "" }, { "docid": "a7a814ba1ea961e9de7da225cf4831c8", "score": "0.65378976", "text": "def all_branches\n %x( git branch ).gsub!('*', '').gsub!(' ', '').split(\"\\n\")\nend", "title": "" }, { "docid": "97f2635dca3e11cfbc5231265931d9fd", "score": "0.64767724", "text": "def ls_branches\n working_branches = get_branches\n if working_branches.empty?\n $stdout.puts \"No branches\"\n exit\n end\n working_branches.map.with_index { |branch, idx| \"#{idx}. #{branch}\" }\nend", "title": "" }, { "docid": "cf33dba3d294a2edb5aa794303efadc9", "score": "0.63994634", "text": "def branch_list\n raw_branches = `cd #{project_repo_path} && git branch -r`\n branches = raw_branches.split(/\\n/)\n return branches\n end", "title": "" }, { "docid": "ed42821ca5d1d18512757c257abc7f8a", "score": "0.6349981", "text": "def all_branches\n git(\"branch --all\")\n end", "title": "" }, { "docid": "34b2a67df95c15daf9f5a9d45d682a89", "score": "0.629069", "text": "def branches\n zombie_check\n pattern = self.class.branch_pattern(:name => @name)\n @repo.branches.select{ |b| b.name =~ pattern }\n end", "title": "" }, { "docid": "80155901ac2fea6e40b923b3819486d3", "score": "0.62798476", "text": "def list\n Dir.chdir @root do\n cmd = \"git branch\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n case stderr\n when /Not a git repository/\n raise NotARepositoryError\n else\n raise Error, stderr\n end\n end\n return stdout.split.map { |s|\n # Remove trailing/leading whitespace and astericks\n s.sub('*', '').strip\n }.reject { |s|\n # Drop elements created due to trailing newline\n s.size == 0\n }\n end\n end", "title": "" }, { "docid": "394b01b3e7da87fccfc0f442a2ee194d", "score": "0.6141424", "text": "def git_branches(git)\n array = Array.new\n body = raw_file(http_uri + git)\n body.scan(/\" title=\".*>(.*)<\\/a><\\/li>/) do |branch|\n array << branch\n end\n array.flatten\n end", "title": "" }, { "docid": "da3aa17e877c3bc2fe3e44df1d7f2df7", "score": "0.6025206", "text": "def list\n Rugged::Branch.each_name(@git, :local).to_a\n end", "title": "" }, { "docid": "7c1bcd5a5a1c15edfbde8bb3b2acf89c", "score": "0.60220075", "text": "def get_descendant_commits_of_branch(commit_oid)\n verified_commit_oid = lookup(commit_oid).try(:oid)\n\n return [] if verified_commit_oid.nil? || commit_on_master?(commit_oid)\n\n commits = []\n\n walker = get_walker(main_branch.target_id, verified_commit_oid, false)\n walker.each do |commit|\n commits << commit if repository.descendant_of?(commit.oid, verified_commit_oid)\n break if commit == merge_to_master_commit(verified_commit_oid)\n end\n\n build_commits(commits)\n end", "title": "" }, { "docid": "f0cbc0b8c0ad3cc01786e4207a4496b2", "score": "0.5993007", "text": "def local_branches(repo_path)\n result = []\n `(cd \"#{repo_path}\" && git branch | cut -c3-)`.split(\"\\n\").each do |branch|\n result << branch unless `(cd #{repo_path} && git log -1 --pretty=full #{branch})` =~ /git-svn-id:/\n end\n result\n end", "title": "" }, { "docid": "45f6f971253237d95f2a46bccc595674", "score": "0.5960569", "text": "def branches(repo)\n api.branches(repo).index_by(&:name)\n end", "title": "" }, { "docid": "cb57b078683562d4afd077fb78a29c94", "score": "0.58903396", "text": "def commits(commit=head)\n commits_for(commit)\n end", "title": "" }, { "docid": "53a9ce9c5b71893d184625a5d4332c8f", "score": "0.5882998", "text": "def entry_name_from_branch(commit_hash)\n Git::Parser.branch_of_commit(commit_hash).tr('-', ' ')\n end", "title": "" }, { "docid": "4dd83cdd66e29a35d70d7c764db821b3", "score": "0.58786535", "text": "def get_all_commits_in_repo\n @branches.collect(&:commits).flatten.sort_by { |k| k.authored_date }.reverse\n end", "title": "" }, { "docid": "eb6c3ab6a3b33242a5d87a1032dff1b6", "score": "0.58477896", "text": "def fetch_commit_hash_list()\n `git rev-list --all --reverse`.strip.split(/\\n/)\nend", "title": "" }, { "docid": "b4c9faa14cac937d47823346beba1ecb", "score": "0.5732607", "text": "def branches\n @branches ||= get(\"/repos/show/#{owner.login}/#{name}/branches\")['branches'].map do |name, head|\n Branch.new(connection, \n :name => name,\n :head => head,\n :repo => self\n )\n end\n end", "title": "" }, { "docid": "9aa3f954584d1b381a8129965bf75937", "score": "0.5722835", "text": "def branch_commits\n\tcommits = {}\n\tresp = github_api(\"branches\")\n\tresp.each do |b|\n\t\t#puts b\n\t\tcommit_dates = []\n\t\tsha = b[\"commit\"][\"sha\"]\n\t\twhile true\n\t\t\tr = github_api(\"commits?sha=#{sha}&per_page=100\")\n\t\t\t# puts r\n\t\t\tif r.count != 1 \n\t\t\t\tsha = r[r.count - 1][\"sha\"]\n\t\t\t\tcommit_dates = commit_dates.concat(r[0..-1].map {|c| c[\"commit\"][\"committer\"][\"date\"]})\n\t\t\t\t#puts commit_dates\n\t\t\telse\n\t\t\t\tcommit_dates = commit_dates.concat(r.map {|c| c[\"commit\"][\"committer\"][\"date\"]})\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tcommits[b[\"name\"]] = commit_dates\n\tend\n\tcommits\nend", "title": "" }, { "docid": "d5f80f4d3f0c8deeafc56b2d92b12a66", "score": "0.57134354", "text": "def determine_branch_name(repo)\n name = \"\"\n repo.branches.each do |branch|\n if branch.head?\n name = branch.name\n break\n end\n end\n return name\nend", "title": "" }, { "docid": "04b8b39c08b9198a7df30283970a90e9", "score": "0.566993", "text": "def refs\n select_branches(git.grit.refs)\n end", "title": "" }, { "docid": "dd3e868bf622b9a554bd03ee25520d9a", "score": "0.56525624", "text": "def commits(branch = DEFAULT_BRANCH)\n if @commits[branch].nil?\n @authors[branch] = {}\n @commits[branch] = []\n load_commits(branch).each do |git_commit|\n commit = Commit.new(self, branch, git_commit)\n @commits[branch] << commit\n @authors[branch][commit.author.id] = commit.author\n end\n end\n\n @commits[branch]\n end", "title": "" }, { "docid": "0e0a82d128e2f888fc4bc6d99afaa905", "score": "0.56466585", "text": "def all_commits\n `git --git-dir=#{git_dir} log --all --pretty='%H'`.split(/\\n/).uniq\n end", "title": "" }, { "docid": "1cd5ec61e1245aca99abc7cb388656e1", "score": "0.56196797", "text": "def branches(hash={})\n Branch.all(:id => LoanHistory.parents_where_loans_of(Branch, {:loan => {:funding_line_id => funding_lines.map{|x| x.id}}, :branch => hash}))\n end", "title": "" }, { "docid": "9704a9daa8132e4fcdd55a9935e33fb9", "score": "0.56157094", "text": "def branches\n if ancestor_ids.empty? then\n nil\n else\n read_attribute(self.base_class.ancestry_column).to_s.split(',')\n end\n end", "title": "" }, { "docid": "abb05b63e85ad0a00feee682a1d17417", "score": "0.5605755", "text": "def commits(branch = DEFAULT_BRANCH)\n if @commits[branch].nil?\n @authors[branch] = {}\n @commits[branch] = []\n load_commits(branch).each do |gh_commit|\n commit = Commit.new(self, branch, gh_commit)\n @commits[branch] << commit\n @authors[branch][commit.author.id] = commit.author\n end\n end\n\n @commits[branch]\n end", "title": "" }, { "docid": "18ad2bbe60dc0c21e4d9458c5ed0a47a", "score": "0.5589209", "text": "def branches\n client.branches(repo)\n end", "title": "" }, { "docid": "29e57e1e9720380098e3908cb0540af9", "score": "0.55498093", "text": "def build_branch_list\n local_branches = `git branch`.split(' ')\n active_branch_index = local_branches.index('*')\n\n local_branches.reject { |i| i == '*' }.map.with_index do |b, i|\n BranchModel.new(b, i == active_branch_index)\n end\n end", "title": "" }, { "docid": "200966bf3be981eaa48d34b57bbb384f", "score": "0.55392456", "text": "def local_branches\n @local_branches ||= begin\n branches = []\n if not git.branches.local.empty?\n branches << git.branches.local.select{ |b| b.current }[0].name\n branches << git.branches.local.select{ |b| not b.current }.map{ |b| b.name }\n end\n branches.flatten\n end\n end", "title": "" }, { "docid": "bd3c6965709775cfa0cb13d0d030946c", "score": "0.5525384", "text": "def branches\n if ancestor_ids.empty? then\n nil\n else\n read_attribute(self.base_class.structure_column).to_s.split(',')\n end\n end", "title": "" }, { "docid": "c33b63a9c707b7356c7b211b7d79ec11", "score": "0.55232584", "text": "def fetch_commits(branch) \n puts \"Getting commits of a branch: #{branch.name} and #{branch.commit_id}\"\n stop = false\n branch_commits = []\n commit_id = branch.commit_id\n until stop\n cs = @github_client.fetch_commits(@repo_user,@repo_name,commit_id, COMMITS_PER_PAGE)\n commits = cs.map { |c| commit(branch.name, c) }\n branch_commits.concat(commits)\n puts \"Loaded commits: #{branch_commits.length}\" \n sha = commits.last.parent_ids[0]\n if commits.last.initial? || commit_id == sha\n stop = true\n else \n commit_id = sha\n end \n end\n branch_commits.reverse\n end", "title": "" }, { "docid": "0fbad5988827ceda46c4a3ea9f9980e7", "score": "0.55226517", "text": "def filter_branch_refs(refs)\n refs.select do |r|\n ref_name = r[\"ref\"]\n ref_name.start_with? \"refs/heads\"\n end\n end", "title": "" }, { "docid": "d97457e67c17a41a2e8758f904c9164c", "score": "0.5509981", "text": "def files_in branch:\n array_output_of(\"git ls-tree -r --name-only #{branch}\")\nend", "title": "" }, { "docid": "ba8ade6ea91e25f99ddf2ce34bc582fb", "score": "0.5502315", "text": "def get_repository_project_branches(repoName)\n self.log(INFO, repoName, \"Searching for project branches...\")\n branches = []\n b=`git branch -r`\n b.each_line do |remoteBranch|\n remoteBranch.gsub!(/\\n/, \"\")\n if remoteBranch =~ /origin\\/project/\n localBranch = \"#{remoteBranch}\"\n localBranch.slice! \"origin/\"\n branches << localBranch.strip! || localBranch\n end\n end\n self.log(INFO, repoName, \"Project branches found : #{branches}\")\n self.log(INFO, repoName, \"Done.\")\n return branches\n end", "title": "" }, { "docid": "10f406a08a0c90e386634d5b11e4c4d2", "score": "0.5501966", "text": "def branches\n object.branches.map { |b| b.id }\n end", "title": "" }, { "docid": "b4c3cee3e9a2e1449131c0c1b9dd0e55", "score": "0.550047", "text": "def branches\n @branches ||= build_branches\n end", "title": "" }, { "docid": "fa23093dc882500d0587e3a7522e38cf", "score": "0.5500399", "text": "def get_branch_name\r\n\tputs IO.popen('git branch --no-abbrev').read.slice(2..-1)\r\nend", "title": "" }, { "docid": "d25700ee9f8e9fa944c102509b5ccf57", "score": "0.5480203", "text": "def commit_refs(commit, repo_param)\n commit.refs.map{ |r| commit_ref(r, repo_param) }.join(\"\\n\")\n end", "title": "" }, { "docid": "25dd63c27c07d4c93e568f13550cf033", "score": "0.5469844", "text": "def branches(*nodes)\n branches = []\n nodes = [changelog.tip] if nodes.empty?\n # for each node, find its first parent (adam and eve, basically)\n # -- that's our branch!\n nodes.each do |node|\n t = node\n # traverse the tree, staying to the left side\n # node\n # / \\\n # parent1 parent2\n # .... ....\n # This will get us the first parent. When it's finally NULL_ID,\n # we have a root -- this is the basis for our branch.\n loop do\n parents = changelog.parents_for_node t\n if parents[1] != NULL_ID || parents[0] == NULL_ID\n branches << [node, t, *parents]\n break\n end\n t = parents.first # get the first parent and start again\n end\n end\n \n branches\n end", "title": "" }, { "docid": "840c64bba06686dd196e893e28016609", "score": "0.5430154", "text": "def get_dependent_commits(commit_oid)\n master = main_branch.target\n\n dependent_commits = []\n common_ancestor_oid = nil\n loop do\n common_ancestor_oid = repository.merge_base(master.oid, commit_oid)\n break if common_ancestor_oid != commit_oid\n dependent_commits << build_commit(master) if merge_commit_for?(master, commit_oid)\n master = master.parents.first\n end\n\n dependent_commits + commits_between(common_ancestor_oid, commit_oid)[0...-1]\n end", "title": "" }, { "docid": "b5630faa9c8e81f497638ddd80a0f032", "score": "0.54041004", "text": "def branch(name, options = {})\n get_path(\n path_to_branch(name),\n options,\n get_parser(:collection, Tinybucket::Model::Commit)\n )\n end", "title": "" }, { "docid": "922a5d88fd4cd94d3d08181782f138b5", "score": "0.5401189", "text": "def list\n if today?\n commits = commits_today(repo, branch)\n elsif yesterday?\n commits = commits_yesterday(repo, branch)\n elsif this_week?\n commits = commits_this_week(repo, branch)\n elsif last_week?\n commits = commits_last_week(repo, branch)\n elsif this_month?\n commits = commits_this_month(repo, branch)\n elsif after && before\n commits = commits_between(repo, branch, after, before)\n elsif after\n commits = commits_after(repo, branch, after)\n elsif before\n commits = commits_before(repo, branch, before)\n else\n commits = all_commits(repo, branch)\n end\n\n write_json(commits.map(&:to_h))\n end", "title": "" }, { "docid": "a649f9e6c46fb0cffffb6e590258b39c", "score": "0.5400392", "text": "def test_branches_all\n branches = @lib.branches_all\n assert(branches.size > 0)\n assert(branches.select { |b| b[1] }.size > 0) # has a current branch\n assert(branches.select { |b| /\\//.match(b[0]) }.size > 0) # has a remote branch\n assert(branches.select { |b| !/\\//.match(b[0]) }.size > 0) # has a local branch\n assert(branches.select { |b| /master/.match(b[0]) }.size > 0) # has a master branch\n end", "title": "" }, { "docid": "80e254507b1408a3de7eff9b58c6af15", "score": "0.5352242", "text": "def branch_name\n `git name-rev --name-only HEAD`.strip\n end", "title": "" }, { "docid": "1fcd4ccf0da45479c1abb32db8c97689", "score": "0.5320948", "text": "def get_branches\n xml = call(:branches).parsed_response\n xml.css('branches branch').map { |b| Branch.new(b, self) }\n end", "title": "" }, { "docid": "4908f9a0ac829febe1b5764fa132f4af", "score": "0.53007907", "text": "def human_friendly_branch_information\n return git_fork_config.branch if git_fork_config.branch.to_s.length > 0\n return sha[0...7]\n end", "title": "" }, { "docid": "8f0b38dee2c25ad94e9c6fbc6c5755bb", "score": "0.5296485", "text": "def get_git_branch()\n return `git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e \"s/* \\\\(.*\\\\)/\\\\1/\"`.strip\nend", "title": "" }, { "docid": "518c462ababfe2a4f5c15954f95f77b4", "score": "0.528924", "text": "def load_commits(branch)\n commits = []\n page = 1\n begin\n begin\n commits += Octokit.commits(\"#{@user}/#{@project}\", branch, :page => page)\n page += 1\n end while true\n rescue Octokit::NotFound\n end\n commits\n end", "title": "" }, { "docid": "d91d5687260ff2e15536d90e95941e30", "score": "0.5282736", "text": "def fetch_branches\n refs = @github_client.fetch_refs(@repo_user,@repo_name) \n branch_refs = filter_branch_refs refs \n branch_refs = fetch_and_set_dates(branch_refs)\n branch_refs = sort_by_date(branch_refs) \n branches(branch_refs)\n end", "title": "" }, { "docid": "4d052f17d3910d1de1298f2c7ac1bdd9", "score": "0.5264146", "text": "def add_commits_in_branch branch_name\n array_output_of(\"git log #{branch_name} --format='%h|%s|%an <%ae>' --topo-order --reverse\").each do |commit|\n sha, message, author = commit.split('|')\n next if message == 'Initial commit'\n @commit_list.add sha: sha, message: message, branch_name: branch_name, author: author\n end\n @commit_list\n end", "title": "" }, { "docid": "0514dcf2c731ce17ef3f580eb548fc44", "score": "0.5235192", "text": "def blobs_for_committish(committish)\n commits = grit.batch(committish)\n unless commits.empty?\n commits.first.tree.blobs\n end\n end", "title": "" }, { "docid": "b707437901ea9e51218416ac2d1e8e59", "score": "0.52258563", "text": "def branches *path\n return enum_for(:branches, *path) unless block_given?\n self.each_pair do |k,v|\n if k.slice(0, path.size) == path\n sub_key = k - k.slice(0,path.size)\n v = proxy?(v) ? v.deproxy : v\n yield sub_key[0], v unless sub_key.size != 1\n end\n end\n end", "title": "" }, { "docid": "0545a79a32acc06a499f1edbd0b3278d", "score": "0.5222956", "text": "def recent_branches_strict\n\t\tbranches = `git branch -a`.gsub!(/^\\*?\\s+|\\(no branch\\)\\s*/, \"\").split(/\\n/).map {|i|\n\t\t\ti.split(/ -> /)[0]\n\t\t}\n\t\tretrieve_branch_details(branches)\n\tend", "title": "" }, { "docid": "40a6cfcab6845c717cdaf039d7251cc9", "score": "0.52066994", "text": "def branches\n @branches = config.fetch('branches', ['master'])\n end", "title": "" }, { "docid": "40a6cfcab6845c717cdaf039d7251cc9", "score": "0.52066994", "text": "def branches\n @branches = config.fetch('branches', ['master'])\n end", "title": "" }, { "docid": "1166c3a6329b4cb333bdf4818939ac9d", "score": "0.51475024", "text": "def find_branch(repo, branch)\n name, num = branch.split('-')\n\n variations = [ branch, \"#{name}#{num}\", \"#{name}_#{num}\" ]\n\n branches = %x( cd #{repo} ; git branch --list ).gsub('*', '').split(\"\\n\")\n branches.each do |b|\n b.strip!\n variations.each do |v|\n return b if (b == v)\n end\n end\n\n return nil\nend", "title": "" }, { "docid": "3877751ae9d851546c586f60f7f58fd5", "score": "0.51473886", "text": "def branch\n %x[cd #{repo_path};git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'}].chomp\n end", "title": "" }, { "docid": "949e6390e6ce80de32a9597738f7f9f8", "score": "0.51410216", "text": "def commits(branch)\n raise \"Given branch: #{branch} is not found in this repository\" unless @branch_heads.key? branch.to_sym\n head = @branch_heads[branch.to_sym]\n CommitIterator.new(head)\n end", "title": "" }, { "docid": "e64cd83c6ac5b548c73564187241e978", "score": "0.51387626", "text": "def ostree_branches(id)\n criteria = {:type_ids => [Runcible::Extensions::OstreeBranch.content_type]}\n unit_search(id, criteria).map { |i| i['metadata'].with_indifferent_access }\n end", "title": "" }, { "docid": "799486cf50975741ed6031c2e33f3559", "score": "0.5116749", "text": "def remote_branches(remote)\n run(\"git branch -r\").split(\"\\n\")\n .map { |r| r.chomp.gsub(/^\\s+/, \"\") }\n .select { |r| r[remote] && ! r[\"HEAD\"] }\n .map { |r| r.gsub(\"#{remote}/\", \"\") }\n end", "title": "" }, { "docid": "e5131b3d9ea8dfaf289629621d21c289", "score": "0.5114741", "text": "def branches; end", "title": "" }, { "docid": "074e6ad94523d59921f35ef159f2a741", "score": "0.5100124", "text": "def current_branch\n %x(git branch | grep '*' | cut -d' ' -f2).chomp\nend", "title": "" }, { "docid": "abb78b96256f72c17a9fc6f9c89a43bb", "score": "0.5088293", "text": "def branch(branch)\n all.select { |r| r.branch == branch }\n end", "title": "" }, { "docid": "c6414fe50a35a037a47fa7c48ed6d947", "score": "0.5080894", "text": "def commits\n @commits ||= data[:commits].map { |commit| project.commit(commit[:id]) }.reverse\n end", "title": "" }, { "docid": "074c8b46c024d7eedeb6424c6e4fdca2", "score": "0.50806653", "text": "def get_target_branches\n unless @target_branches\n fetch_all\n base = @config['branches']['production']\n allowed_branches = @config['branches'].values\n allowed_branches << @config['prefixes']['release'] if @config['prefixes']['release']\n banned_branches = ['HEAD']\n target_branches = `git branch -r origin/#{base} | grep -ie '\\\\(#{allowed_branches.join(\"\\\\|\")}\\\\)' | grep -iv '\\\\(#{banned_branches.join(\"\\\\|\")}\\\\)' | sed -e 's/origin\\\\///g'`\n @target_branches = target_branches.split(\"\\n\").map{|a| a.gsub(/\\s+/, \"\")}\n end\n @target_branches\n end", "title": "" }, { "docid": "2fa2b280c006a644d40978e464892da7", "score": "0.50635374", "text": "def branches\n edges\n end", "title": "" }, { "docid": "e2ecb31dbea2653deadbebb95269abfb", "score": "0.5056058", "text": "def rebased_commits\n rebased_ref = detached_head? ? 'HEAD' : rebased_branch\n @rebased_commits ||=\n `git rev-list --topo-order --reverse #{upstream_branch}..#{rebased_ref}`.\n split(\"\\n\")\n end", "title": "" }, { "docid": "83e33808eefd025db20f0c7d43d534cc", "score": "0.5041116", "text": "def trails(commit, remotes: true, tags: true)\n\t\t\tmerges={}\n\t\t\twith_dir do\n\t\t\t\t%x/git for-each-ref/.each_line do |l|\n\t\t\t\t\thash, type, name=l.split\n\t\t\t\t\tnext if type==\"tags\" and !tags\n\t\t\t\t\tnext if type==\"commit\" && !name.start_with?(\"refs/heads/\") and !remotes\n\t\t\t\t\tmb=`git merge-base #{commit.shellescape} #{hash}`.chomp\n\t\t\t\t\tmb=:disjoint if mb.empty?\n\t\t\t\t\tmerges[mb]||=[]\n\t\t\t\t\tmerges[mb] << name\n\t\t\t\tend\n\t\t\tend\n\t\t\tmerges\n\t\tend", "title": "" }, { "docid": "36492e5825b9c52100e786e48bcb0619", "score": "0.5031534", "text": "def create_branches(repo)\n @branch_names.collect {|branch_name| \n Branch.new(branch_name ,Grit::Commit.find_all(repo, branch_name).sort_by { |k| k.authored_date}.reverse)}\n end", "title": "" }, { "docid": "1c38d17472f77c4babfc7ea1501cd6f6", "score": "0.50308275", "text": "def branch\n case @vcs\n when 'github'\n if @data.key? 'ref'\n @data['ref'].sub('refs/heads/', '')\n else\n @data['repository']['default_branch']\n end\n when 'gitlab'\n @data['ref'].sub('refs/heads/', '')\n when 'bitbucket-server'\n @data['changes'][0]['refId'].sub('refs/heads/', '')\n when 'bitbucket'\n return @data['push']['changes'][0]['new']['name'] unless deleted?\n\n @data['push']['changes'][0]['old']['name']\n when 'stash'\n @data['refChanges'][0]['refId'].sub('refs/heads/', '')\n when 'tfs'\n @data['resource']['refUpdates'][0]['name'].sub('refs/heads/', '')\n end\n end", "title": "" }, { "docid": "f32566cbf82189ae95a43e4fececed09", "score": "0.50284785", "text": "def branch_names_list(branch_names)\n markaby do\n ul.page_control do\n for name in branch_names\n li do\n a name, :href => \"##{name.underscore}\"\n end\n end\n end\n end\n end", "title": "" }, { "docid": "ba222bafd4d1bd6a4420af97883ac717", "score": "0.50275683", "text": "def get_authors\n @branches.collect(&:author_names).flatten.uniq.sort_by { |k| k.downcase }\n end", "title": "" }, { "docid": "5ed9a5add8f61f4aa8d756fad4705a7f", "score": "0.5025934", "text": "def all\n root.branch\n end", "title": "" }, { "docid": "34e501e2da19dda66e248f3579b817a4", "score": "0.50109094", "text": "def get_files_in_commit(commit)\n\tfiles = {}\n\tcommit.diffs.each do | diff |\n\t\tfiles[diff.a_path] = nil unless files.has_key? diff.a_path\n\t\tfiles[diff.b_path] = nil unless files.has_key? diff.b_path\n\t\t# what about diff.deleted_file and diff.new_file?\n\tend\n\treturn files.keys\nend", "title": "" }, { "docid": "44976dcb16c601f37f71bf7a6b5d3f07", "score": "0.5008453", "text": "def get_commits(repo, branch)\n # Downcase the strings\n repo.downcase!\n branch.downcase!\n\n # Make sure we're ending with a trailing / on the repo\n repo << '/' unless repo[repo.size - 1] == '/'\n\n # The full path for a call is:\n # https://api.github.com/repos/avalonmediasystem/avalon/commits/master/\n # The user may or may not have called with the /commits/ part since we don't\n # specifically require it\n # Determine if it is present, add it if it is not\n commits = 'commits/'\n last_char_pos = repo.size\n repo << commits unless repo[last_char_pos - commits.size..last_char_pos - 1] == commits\n\n # Use Rest Client to call the Github API and return it as JSON\n api_call = repo + branch\n resp = rest_client_get(api_call)\n return JSON.parse(resp) unless resp.nil?\n end", "title": "" }, { "docid": "d10a5402e2625ae6d6ad7b5cec16b984", "score": "0.50067794", "text": "def commit_entries(pr_id)\n q = <<-QUERY\n select c.sha as sha\n from pull_requests pr, pull_request_commits prc, commits c\n where pr.id = prc.pull_request_id\n and prc.commit_id = c.id\n and pr.id = ?\n QUERY\n commits = db.fetch(q, pr_id).all\n\n commits.reduce([]){ |acc, x|\n a = mongo.find(:commits, {:sha => x[:sha]})[0]\n acc << a unless a.nil?\n acc\n }.select{|c| c['parents'].size <= 1}\n end", "title": "" }, { "docid": "62e9e7520a51229ffb08a14dba31af32", "score": "0.49951482", "text": "def recent_branches_fast\n\t\trefs = []\n\t\trefs.concat Pathname.glob(dot_git + 'refs/heads/**/*')\n\t\trefs.concat Pathname.glob(dot_git + 'refs/remotes/**/*')\n\n\t\tbranches = refs.reject {|r| r.directory? }.sort_by {|r| r.mtime }.last(@opts[:max_num]).map {|r|\n\t\t\tref = r.read.chomp\n\t\t\tif name = ref[/ref: (.+)/, 1]\n\t\t\t\tbegin\n\t\t\t\t\t(dot_git + name).read.chomp\n\t\t\t\trescue\n\t\t\t\t\t`git rev-parse #{name}`.chomp\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tref\n\t\t\tend\n\t\t}\n\t\tretrieve_branch_details(branches)\n\tend", "title": "" }, { "docid": "ed6c56fe3ef150faa6c788ec72b06f95", "score": "0.49873066", "text": "def get_all_commits(repo)\n all_commits = []\n page = 0\n page_size = 10\n commits = repo.commits('master', page_size, page)\n while commits.length > 0\n all_commits = all_commits + commits\n page = page + page_size\n commits = repo.commits('master', page_size, page)\n end\n return all_commits\nend", "title": "" }, { "docid": "1f24987d8aab8f697754daa85a594820", "score": "0.49821645", "text": "def branch_name\n $repo.current_branch\n end", "title": "" }, { "docid": "53783c945b84497a3e5d909fb3387acd", "score": "0.49630034", "text": "def commit_entries(pr_id)\n q = <<-QUERY\n select c.sha as sha\n from pull_requests pr, pull_request_commits prc, commits c\n where pr.id = prc.pull_request_id\n and prc.commit_id = c.id\n and pr.id = ?\n QUERY\n commits = db.fetch(q, pr_id).all\n\n commits.reduce([]){ |acc, x|\n a = mongo['commits'].find_one({:sha => x[:sha]})\n acc << a unless a.nil?\n acc\n }.select{|c| c['parents'].size <= 1}\n end", "title": "" }, { "docid": "039897490875c9276d5dad23bd0b213d", "score": "0.4962165", "text": "def retrieve_branch_details(branches)\n\t\tdetails = []\n\t\tIO.popen(\"-\", \"r+\") do |io|\n\t\t\tif io.nil?\n\t\t\t\targs = [ \"show\", \"--pretty=format:%H\\t%d\\t%ct\\t%cr\\t%an\\t%s\", *branches ]\n\t\t\t\targs << \"--\"\n\t\t\t\texec \"git\", *args\n\t\t\telse\n\t\t\t\twhile l = io.gets\n\t\t\t\t\tnext unless l =~ /^[a-z0-9]{40}/\n\t\t\t\t\thash, refs, time, rtime, author, subject = * l.chomp.split(/\\t/)\n\t\t\t\t\trefs.gsub!(/^\\s*\\(|\\)\\s*$/, '')\n\n\t\t\t\t\trefs.split(/\\s*,\\s*/).each do |ref|\n\t\t\t\t\t\tis_remote = ref[%r{refs/remotes}]\n\t\t\t\t\t\tref.gsub!(%r{refs/(remotes|heads)/}, '')\n\t\t\t\t\t\tdetails.push Ref.new(hash, ref, time.to_i, rtime, author, subject)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tdetails\n\tend", "title": "" }, { "docid": "00b6624025c464349de026d2e27e1dea", "score": "0.49564892", "text": "def load_ref_commits(ref)\n commits = []\n page = 1\n begin\n loop do\n commits += Octokit.commits(@path, ref, :page => page)\n page += 1\n end\n rescue Octokit::NotFound, Faraday::Error::ResourceNotFound\n end\n commits\n end", "title": "" }, { "docid": "676bf1526b62cc855ad006185d722bf6", "score": "0.49402982", "text": "def branches\n Git::Branches.new(self)\n end", "title": "" }, { "docid": "e7a42c5adb20136dbf9edc270c9eda3c", "score": "0.49386021", "text": "def revlist\n (`git rev-list --all`).split(\"\\n\")\n end", "title": "" }, { "docid": "fb30441903dd86e43d0184de1df6ae78", "score": "0.49381906", "text": "def add_commits_in_current_repo\n existing_branches.each do |branch_name|\n add_commits_in_branch branch_name\n end\n @commit_list\n end", "title": "" }, { "docid": "000ef3d0d0e8f14a0511d26bfda60cd6", "score": "0.49277908", "text": "def branchname\n @branchname ||= self.branch.name\n end", "title": "" }, { "docid": "e04281b4a185f76f6f2cc5f1a9eaea77", "score": "0.49275455", "text": "def commits\n object.commits.map { |c| c.id }\n end", "title": "" }, { "docid": "24313d339317c6b899f8ba7fd8c1f283", "score": "0.49237552", "text": "def remote_branches\n @rugged_repository.branches.each_name(:remote).sort\n end", "title": "" }, { "docid": "2c6a24d79b5dfee437368ecf4a57e689", "score": "0.49089336", "text": "def root_branches\n @root_branches = branches.select(&:root?)\n end", "title": "" }, { "docid": "96657f2ebb6a4d07f8040eb67cf8e04a", "score": "0.49005634", "text": "def commits\n if !@commits\n @commits = []\n x = 0\n loop do\n x += 1\n response = get(\"/commits/list/#{repo.owner.login}/#{repo.name}/#{name}?page=#{x}\")\n break unless response.code == 200\n @commits += response['commits'].map { |c| Commit.new(connection, c.merge(:repo => self)) }\n end\n end\n @commits\n end", "title": "" }, { "docid": "df2488a761c0f58624eb029d24dd459a", "score": "0.49003908", "text": "def ref_names(repo)\n refs(repo).map do |ref|\n ref.sub(%r{^refs/(heads|remotes|tags)/}, \"\")\n end\n end", "title": "" }, { "docid": "b61af28463d6b2d9eac7522f8ebec6e1", "score": "0.48993647", "text": "def find_branch(repo_slug, pattern)\n list = `git ls-remote --heads --sort=version:refname https://github.com/#{repo_slug} #{pattern}`\n list.split(\"\\n\")\n .map { |line| line.sub(%r{[0-9a-f]+\\trefs/heads/}, '').chomp }\n .last # Latest ref found, in \"version:refname\" semantic order\n end", "title": "" }, { "docid": "3ddeceae797074348df8a38de27f6341", "score": "0.48971033", "text": "def get_checksums(commit)\n # Reset @currenthash\n @currenthash = Hash.new\n path = find_relative_git_cookbook_path\n #puts \"path is '#{path}' commit hash is #{commit}\"\n #puts \"commit.tree is #{commit.tree}\"\n unless path == '.'\n tree = commit.tree / path\n git_checksum_hash(tree)\n else\n git_checksum_hash(commit.tree)\n end\n end", "title": "" }, { "docid": "76cdbe5eea96320bf4891a9564d9e616", "score": "0.48964995", "text": "def local_branch_information\n #This is sensitive to checkouts of branches specified with wrong case\n\n listing = capture_process_output(\"#{LOCAL_BRANCH_LISTING_COMMAND}\")[1]\n\n raise(NotOnGitRepositoryError, listing.chomp) if listing =~ /Not a git repository/i\n if listing =~ /\\(no branch\\)/\n raise InvalidBranchError, [\"Couldn't identify the current local branch. The branch listing was:\",\n LOCAL_BRANCH_LISTING_COMMAND.red, listing].join(\"\\n\")\n end\n\n current_branch = nil\n branches = listing.split(\"\\n\").map do |line|\n current = line.include? '*'\n clean_line = line.gsub('*','').strip\n current_branch = clean_line if current\n clean_line\n end\n\n return current_branch, branches\n end", "title": "" }, { "docid": "0d9437bb0754d259c8ade61d00f5a64d", "score": "0.4894357", "text": "def currentbranch\n %x{git branch | grep \"*\" | sed \"s;* ;;\"}.squish\n end", "title": "" }, { "docid": "ef490babc12c4558547ff252e471bd04", "score": "0.48942962", "text": "def extract_branches(decorate, remove_head = true)\n return [] if decorate.blank?\n decorate.strip[1...-1].split(', ').\n reject { |b| remove_head && b == 'HEAD' || b =~ /^tag:\\s/ }\n end", "title": "" }, { "docid": "e9f4d1b440e5319e166c67e48e5e7fbd", "score": "0.48921573", "text": "def case_branches(branches)\n branches.select do |branch|\n id == branch.root_id && branch.start_line != start_line\n end\n end", "title": "" } ]
bc55dcdc46c827af4090822aa69998df
Return the Puppet::Util::IniConfig::Section for this yumrepo resource
[ { "docid": "2039c8d6fdb75ebdc2c90cbf5717f8a5", "score": "0.5020899", "text": "def section\n self.class.section(self[:name])\n end", "title": "" } ]
[ { "docid": "dfc87e749fff507dd985736ebef9cf00", "score": "0.6193932", "text": "def config_section\n node.manifest.config.send(self.class.instance_variable_get(:@config_section_name))\n end", "title": "" }, { "docid": "4d8243ea2ea1e44d023ef27799151c60", "score": "0.57753265", "text": "def get_configuration(section)\n this_dir = '/powercontrol/'\n conf_home = ENV['RACK_HOME'] + this_dir\n config = YAML.load_file(conf_home + \"hosts.yaml\")\n out = config[section]\n @user = out['user']\n @passwd = out['pass']\n @serverlist = out['servers']\n end", "title": "" }, { "docid": "bf3b6a1ff43580e3cb2dc70d0b8bc556", "score": "0.56300366", "text": "def config_file\n @config_file ||= ConfigFile.new(config_path, @section)\n end", "title": "" }, { "docid": "21b303c3a1e253c5d291b01ffeba19cc", "score": "0.56104743", "text": "def []( section )\n return nil if section.nil?\n @ini[section.to_s]\n end", "title": "" }, { "docid": "c4e5af720a41f79ed522ff7f1b44803c", "score": "0.5569871", "text": "def get_section(section)\n (all_configs[\"[#{section}]\"] || {}).dup\n end", "title": "" }, { "docid": "dc5c0ed1dcf03ddafa8021bea04c22e8", "score": "0.55039436", "text": "def config\n @config ||= begin\n config_dir = File.join(ENV['HOME'], '.keyman')\n if File.exist?(config_dir)\n YAML.load_file(config_dir)\n else\n {}\n end\n end\n end", "title": "" }, { "docid": "51ff3701ed233517c4ca056dd2242b59", "score": "0.54842275", "text": "def chef_config\n Chef::Config\n end", "title": "" }, { "docid": "b10e7f85324e5863cbdaf8c3b3d99ea6", "score": "0.5467375", "text": "def []( section )\n return nil if section.nil?\n @ini[section.to_s]\n end", "title": "" }, { "docid": "a16d6c362a6f5a1e270c153d6884b5b7", "score": "0.54473495", "text": "def readConfigFile\n @config\n end", "title": "" }, { "docid": "4a460373ab613dc29529be334dedea49", "score": "0.5445857", "text": "def get_section(key)\n section = Lorj.defaults.get_meta_section(key)\n\n unless section\n return PrcLib.debug('%s: Unable to get account data '\\\n \"'%s'. No section found. check defaults.yaml.\",\n __callee__, key)\n end\n section\n end", "title": "" }, { "docid": "455b739004c9a5e2e4873887cfea63ba", "score": "0.54368657", "text": "def read_config\n config_hash = {}\n\t\tif File.exist?(@config_file.to_s)\n\t\t\tlines = File.new(@config_file.to_s, 'r').readlines\n\n\t\t\t# Redhat based config files use the format: KEY=value\n\t\t\tlines.select {|l| l =~ /=/ }.each do |line|\n\t\t\t\tkey = line.split('=')[0].chomp\n\t\t\t\t config_hash[key.upcase.to_sym] = line.split('=')[1].chomp\n\t\t\tend\n\t\t\t\n\t\t\tPuppet.debug \"Imported config file to a hash\"\n\t\t\treturn config_hash\n\t\telse\n\t\t\t# TODO Puppet could create the file if nil?\n\t\t\tPuppet.debug \"Puppet was looking for #{@config_file.to_s} and coundn't find it\"\n\t\t\traise Puppet::Error, \"Puppet can't find the config file for %s\" % @resource[:name]\n\t\t\treturn nil\n\t\tend\n\tend", "title": "" }, { "docid": "7f40e08dbb68122f21e9ba8ea0f13a0f", "score": "0.5431199", "text": "def knife_config\n ::Chef::Knife.config_loader.config_location.nil? ? '' : ::Chef::Knife.config_loader.config_location\n end", "title": "" }, { "docid": "c91891d3629db6087b9060f54f666ac1", "score": "0.5407309", "text": "def []( section )\n return nil if section.nil?\n @ini[section.to_sym] \n end", "title": "" }, { "docid": "9b4bd23180e4c1f760e4dc50a6add30b", "score": "0.5393532", "text": "def config\n @config ||= begin\n @config_file ||= find_config_file\n Config.new(@config_file)\n end\n end", "title": "" }, { "docid": "440297e72d519d7b34c21c67405cc2a0", "score": "0.538275", "text": "def configfile\n @log.debug 'Finding config file'\n @config_file_paths.each do |file|\n @log.debug \"Checking if file '#{file}' exists\"\n if File.file?(file)\n @log.debug 'Reading config file from: ' + file\n config_file = File.read(file)\n parsed_config_file = YAML.load(config_file)\n # parsed_config_file = IniParse.parse(config_file).to_hash\n @log.debug 'configuration read from config file: ' + parsed_config_file.to_s\n return parsed_config_file if parsed_config_file.is_a?(Hash)\n else\n @log.debug \"Configuration file '#{file}' not found\"\n end\n end\n {}\n end", "title": "" }, { "docid": "18607560a9a5d1a025433a51ba469d1a", "score": "0.5374027", "text": "def config\n return @config if @config\n @config = (File.exists? @config_file) ? (YAML.safe_load_file @config_file) : {}\n end", "title": "" }, { "docid": "220c7679f616ece731f2e0f187c29d92", "score": "0.5356573", "text": "def chef_configuration\n data[:chef_configuration]\n end", "title": "" }, { "docid": "f9ad6b8b14de8d048dc72df3033da594", "score": "0.534518", "text": "def get_section( section )\n\t\treturn unless @ini[section]\n\t\t@ini[section]\n\tend", "title": "" }, { "docid": "334cf98a0a21b3c1041d737f64ad66e0", "score": "0.53445876", "text": "def config\n @config ||= Config.load(config_file)\n end", "title": "" }, { "docid": "998d03b9913222205b2e8410c910131a", "score": "0.53391284", "text": "def config\n @config ||= begin\n if config_file.exist?\n YAML.load_file(config_file)\n else\n {}\n end\n end\n end", "title": "" }, { "docid": "0e9565ad39f0cd01b804f5267e12d71c", "score": "0.53248733", "text": "def config\n HashWithIndifferentAccess.new YAML.load_file(CONFIG_FILE)\n end", "title": "" }, { "docid": "62d899ade7e0f0cc2c32e0f660a49caf", "score": "0.532239", "text": "def config\n @config ||= Config.load(config_file)\n end", "title": "" }, { "docid": "a0491f6100b76b3df344daa17533551f", "score": "0.529793", "text": "def iis_section(section, location)\n command = \"Import-Module WebAdministration; get-webconfiguration -Filter '#{section}' -PSPath 'MACHINE/WEBROOT/APPHOST' -Location '#{location}' -metadata | Select-Object IsLocked, OverrideMode, OverrideModeEffective | ConvertTo-JSON\"\n cmd = @inspec.command(command)\n override_mode_enumeration = %w(N/A Inherit Allow Deny Unknown)\n\n begin\n section = JSON.parse(cmd.stdout)\n rescue JSON::ParserError => _e\n return {}\n end\n\n # map our values to a hash table\n {\n is_locked: section['IsLocked'],\n override_mode: override_mode_enumeration[section['OverrideMode']],\n override_mode_effective: override_mode_enumeration[section['OverrideModeEffective']],\n }\n end", "title": "" }, { "docid": "9a022264f960d988f5a3a2a3c511e691", "score": "0.5297801", "text": "def config\n unless defined? @config then\n @config = Config.new site, path\n @config = @config.parent unless content.start_with? \"---\"\n end\n @config\n end", "title": "" }, { "docid": "9a022264f960d988f5a3a2a3c511e691", "score": "0.5297801", "text": "def config\n unless defined? @config then\n @config = Config.new site, path\n @config = @config.parent unless content.start_with? \"---\"\n end\n @config\n end", "title": "" }, { "docid": "c40d119ebf85717e2f616d299089b040", "score": "0.52899396", "text": "def config\n\t\t\treturn @@config if @@config\n\t\t\t\n\t\t\tif File.exists?(CONFIG_LOCATION)\n\t\t\t\t@@config = YAML.load_file(CONFIG_LOCATION)\n\t\t\telse\n\t\t\t\t@@config = {}\n\t\t\tend\n\t\t\t\n\t\t\t@@config\n\t\tend", "title": "" }, { "docid": "4347c485ee582f16b38c031673265017", "score": "0.52788097", "text": "def config_sections; end", "title": "" }, { "docid": "4fa57ab9fd4aa469cabdb5a69216a75b", "score": "0.52753747", "text": "def sections\n @ini.keys\n end", "title": "" }, { "docid": "3a806d83f25116ede5843aadc17d277d", "score": "0.5272321", "text": "def config\n return @@config if @@config\n \n if File.exists?(CONFIG_LOCATION)\n @@config = YAML.load_file(CONFIG_LOCATION)\n else\n @@config = {}\n end\n \n @@config\n end", "title": "" }, { "docid": "9d0c8276c56c984d5d6e622bd9638ed5", "score": "0.5264025", "text": "def section\n if tags.include?(\"section\")\n value = tags.find { |tag| tag.name == \"section\" }.value\n root.sections.find { |s| s.name == value }\n else\n namespace.section\n end\n end", "title": "" }, { "docid": "fddfdf392a6ceaf98f23dcbfb816a357", "score": "0.5261728", "text": "def get_configuration(host)\n config = YAML::load(File.read(CONFIG_FILE))\n resul = config['im'][host]\n if resul == nil\n resul = DEFAULT_CONFIG\n end\n return resul\n end", "title": "" }, { "docid": "653ecc2e7225268aa3a79f13dc74c5c8", "score": "0.5250054", "text": "def section\n return @children['section'][:value]\n end", "title": "" }, { "docid": "653ecc2e7225268aa3a79f13dc74c5c8", "score": "0.5249318", "text": "def section\n return @children['section'][:value]\n end", "title": "" }, { "docid": "c152b650423ebb2bf1518c30c025fd7a", "score": "0.52493", "text": "def section\n unless defined?(@resource_type)\n raise Puppet::DevError,\n \"Cannot determine Etc section without a resource type\"\n\n end\n\n if @resource_type.name == :group\n \"gr\"\n else\n \"pw\"\n end\n end", "title": "" }, { "docid": "bf08ae8f406ab74f449631c4eefad12f", "score": "0.52445126", "text": "def parse_config # rubocop:disable MethodLength\n # Test for file usability\n fail \"Config file '#{@config_path}' not found\"\\\n unless @config_path.file?\n fail \"Config file '#{@config_path}' not readable\"\\\n unless @config_path.readable?\n\n @ini_file = IniFile.load(@config_path)\n\n begin\n docker_image = @ini_file[:main]['docker_image']\n @docker_image = Docker::Image.get(docker_image)\n @logger.info(to_s) do\n \"Docker image id=#{@docker_image.id[0..11]} name=#{docker_image}\"\n end\n rescue NoMethodError\n raise 'No docker_image in section main in config found'\n rescue Docker::Error::NotFoundError\n raise \"Docker_image '#{docker_image}' not found\"\n rescue Excon::Errors::SocketError => e\n raise \"Docker connection could not be established: #{e.message}\"\n end\n end", "title": "" }, { "docid": "067e4524a9cf74877e51812b51641b49", "score": "0.52391064", "text": "def config_file\n @config_file\n end", "title": "" }, { "docid": "b6e16f876d3572bc829c4afc8b3a95cc", "score": "0.52390414", "text": "def sections\n @ini.keys\n end", "title": "" }, { "docid": "39378b9c0bb28b041698b00d0a9e0403", "score": "0.5234626", "text": "def cfg\n @cfg ||= Cfg.new(self) if exists?\n end", "title": "" }, { "docid": "d2c9963f73daab8ec0c0de2d3c603c90", "score": "0.522383", "text": "def config\n configs[\"_config.yml\"]\n end", "title": "" }, { "docid": "661b689fea02b01ebf0d095a8bb90949", "score": "0.5215734", "text": "def sections\n @conf.keys()\n end", "title": "" }, { "docid": "a7b541682d7f6fa402f606bb55fa262c", "score": "0.521498", "text": "def cfg\r\n return @cfg\r\n end", "title": "" }, { "docid": "f5042b6e78de28028f25ee5f0c78da13", "score": "0.5207645", "text": "def config\n @config_file ||= begin\n raise NoConfiguration unless File.exist?('config.yml')\n YAML.load_file('config.yml') || {}\n end\n end", "title": "" }, { "docid": "6a4307f1ef4630c26dc730ae51f8df81", "score": "0.5198327", "text": "def getconfig\n @conf\n end", "title": "" }, { "docid": "821e2b1164a9fa25e2076471936814f2", "score": "0.5183444", "text": "def get_config(key)\r\n CONFIG[key]\r\n end", "title": "" }, { "docid": "727c95bed458dc0b4d47901d42e9906a", "score": "0.51769483", "text": "def config\n @config ||= SiteConfig.load(path)\n end", "title": "" }, { "docid": "b7477b48f0301bbb925db5914d596d50", "score": "0.5173302", "text": "def configs; self.repo.config; end", "title": "" }, { "docid": "16ff2cee3ee755d7c8f53176f050eed2", "score": "0.517247", "text": "def read_config_file\n @config = YAML::load(File.open(Dir.home + '/.escli'))\n end", "title": "" }, { "docid": "cf59cbcd5847da2ff9044f47e4a023ce", "score": "0.5169866", "text": "def read_config( config_file )\n return IniFile.load(config_file)\nend", "title": "" }, { "docid": "08bcd12f9b3dcf3021cb3567247dbff4", "score": "0.51695627", "text": "def get(section, name, default: false)\n all_configs.dig(\"[#{section}]\", name) || default\n end", "title": "" }, { "docid": "9fbbf97f29a1687e143291aad3b7d037", "score": "0.51694334", "text": "def get_section section\n return self[section]\n end", "title": "" }, { "docid": "9956c99e3ad135b1df277398db53ca26", "score": "0.516309", "text": "def chef_config\n @chef_config ||= begin\n unless File.exist?(chef_config_path)\n raise ::Strainer::Error::ChefConfigNotFound, \"You specified a path to a Chef configuration file that did not exist: '#{chef_config_path}'\"\n end\n\n Chef::Config.from_file(chef_config_path.to_s)\n Chef::Config\n end\n end", "title": "" }, { "docid": "aec930631c3f3ae1c829ff06678fa845", "score": "0.5158771", "text": "def _get_setting(key_name)\n ini = Rex::Parser::Ini.new(@config_file)\n group = ini[@group_name]\n return nil if group.nil?\n return nil if group[key_name].nil?\n\n group[key_name]\n end", "title": "" }, { "docid": "a602342c7ad88a20a6fb44ad9c1675c7", "score": "0.51537746", "text": "def [] section\n fail 'No file found.' unless @ini\n @ini[section]\n end", "title": "" }, { "docid": "2f3176bc0dbdf7f5dc1c28ece96be93f", "score": "0.5153537", "text": "def get_puppet_config\n system_config = %x{puppet config --section master print}\n\n config_hash = Hash.new\n\n system_config.each_line do |line|\n k,v = line.split('=')\n config_hash[k.strip] = v.strip\n end\n\n return config_hash\n end", "title": "" }, { "docid": "897983464817c44bce2dcc9cd837fb3b", "score": "0.51521355", "text": "def get_config(product)\n # FC001: Use strings in preference to symbols to access node attributes\n # foodcritic thinks we are accessing a node attribute\n node.run_state[:ingredient_config_data] ||= {}\n node.run_state[:ingredient_config_data][product] ||= ''\n end", "title": "" }, { "docid": "7553a78e1f82b20892fc81868d0354b9", "score": "0.51499116", "text": "def section\n attributes.fetch(:section)\n end", "title": "" }, { "docid": "2946c059cd14bc2bb31d103b20e052a6", "score": "0.514578", "text": "def config\n @config ||= OCI::ConfigFileLoader.load_config(\n config_file_location: config_file,\n profile_name: profile_name\n )\nend", "title": "" }, { "docid": "604e97a0ade0f550c057fb7fd1553e79", "score": "0.51369506", "text": "def get_configuration\n @cfg\n end", "title": "" }, { "docid": "807d6ccf3aac115034170361512f7d90", "score": "0.5133359", "text": "def read config_file\n b = binding\n\n config = Config.new\n file = ERB.new(File.read(config_file)).result b\n file = YAML.load(file)\n\n config.namespace = file['namespace']\n config.application_name = file['application_name']\n config.generator_name = file['generator_name']\n\n config.docker_registry = read_docker_registry file['docker_registry'] unless file['docker_registry'] == nil\n config.docker = read_docker_section file['docker'] unless file['docker'] == nil\n\n config.fetch = read_task_section file['fetch'], config.docker unless file['fetch'] == nil\n config.build = read_task_section file['build'], config.docker unless file['build'] == nil\n config.test = read_task_section file['test'], config.docker unless file['test'] == nil\n config.run = read_task_section file['run'], config.docker unless file['run'] == nil\n config.cucumber = read_task_section file['cucumber'], config.docker unless file['cucumber'] == nil\n\n return config\n end", "title": "" }, { "docid": "1fe1ec172acf80fd73b6ca1b78e0c97c", "score": "0.51283747", "text": "def readini()\n @inihash = Ini.read_from_file(@path)\n end", "title": "" }, { "docid": "b2d4b4d812db0015a0fff81217bbddb7", "score": "0.51240224", "text": "def get_config_item(item)\n File.join(File.expand_path('../../config', __FILE__), item)\n end", "title": "" }, { "docid": "b2d4b4d812db0015a0fff81217bbddb7", "score": "0.51240224", "text": "def get_config_item(item)\n File.join(File.expand_path('../../config', __FILE__), item)\n end", "title": "" }, { "docid": "b2d4b4d812db0015a0fff81217bbddb7", "score": "0.51240224", "text": "def get_config_item(item)\n File.join(File.expand_path('../../config', __FILE__), item)\n end", "title": "" }, { "docid": "97c10267eae8b783e0f794785369eb36", "score": "0.5116344", "text": "def read_config_file; end", "title": "" }, { "docid": "a3c16a9f3e2c137872a6548152ab6cfa", "score": "0.5110692", "text": "def config_from_node(inventory_hash, node_name)\n inventory_hash['groups'].each do |group|\n group['targets'].each do |node|\n if node['uri'] == node_name\n return node['config']\n end\n end\n end\n raise \"No config was found for #{node_name}\"\n end", "title": "" }, { "docid": "2183e51933d80dd43bbe3d7e50592936", "score": "0.51071024", "text": "def get(key)\n value = Configuration.find(:first, :conditions => { :name => self.namespaced(key) }).try(:value)\n\n value = @configs[key][:default] if value.nil? && @configs[key][:default]\n\n value\n end", "title": "" }, { "docid": "7812ae5a7528f0499b72a234eea8efe8", "score": "0.51039624", "text": "def config()\n return @config\n end", "title": "" }, { "docid": "07cec186171f8c0d85850b9af50f086f", "score": "0.5097893", "text": "def config\n @config ||=\n begin\n # Recursion lock.\n @config = EMPTY_HASH\n\n cfg = nil\n \n config_file_path.reverse.select { | file | File.exists? file }.each do | file |\n cfg = read_config_file_with_includes file, cfg\n end\n\n cfg ||= {\n 'cabar' => {\n 'version' => Cabar.version,\n 'configuration' => {\n },\n },\n }\n\n validate_config_hash cfg\n @config_raw = cfg\n \n # pp cfg\n\n x = cfg['cabar']['configuration'] \n x['config_file_path'] ||= config_file_path\n \n # Overlay command line -C=opt=value\n x.cabar_merge!(@cmd_line_overlay || EMPTY_HASH)\n\n # Take component_search_path from config.\n if x['component_search_path']\n self.component_search_path = x['component_search_path']\n end\n\n # Install component_search_path into config.\n x['component_search_path'] ||=\n component_search_path\n \n x\n end\n end", "title": "" }, { "docid": "cf817a1e76c9b4b13ca5bb90350642a8", "score": "0.5097012", "text": "def load(path = nil)\n path = config_file if (!path)\n\n return Rex::Parser::Ini.new(path)\n end", "title": "" }, { "docid": "7320a2704897156e713f2d3b6ba3b109", "score": "0.5091929", "text": "def conf\n ConfigFile.Instance\n end", "title": "" }, { "docid": "99fb7da4ca2f140a7a9006a56d9504d6", "score": "0.50831", "text": "def config\n @config ||= @module_config || {}\n end", "title": "" }, { "docid": "99fb7da4ca2f140a7a9006a56d9504d6", "score": "0.50831", "text": "def config\n @config ||= @module_config || {}\n end", "title": "" }, { "docid": "041ba8f1a7b3a636760e97eeac2f2ad4", "score": "0.5078293", "text": "def conf\n begin\n @conf ||= JSON.parse(File.read(config_file))\n rescue\n @conf ||= {}\n end\n end", "title": "" }, { "docid": "7b47c81274881022c30e90796923b85e", "score": "0.5078269", "text": "def config\n return @config unless @config.empty?\n\n cmd = \"#{ansible_inventory_path}\" \\\n \" --inventory #{Shellwords.escape(@path)}\" \\\n \" --yaml --list\"\n o, e, s = run_command(cmd)\n unless s.success?\n warn e\n raise \"failed to run `#{cmd}`: #{s}\"\n end\n @config = YAML.safe_load(o)\n end", "title": "" }, { "docid": "b6133a8bfcfaaa1dd14dcf2631b147e6", "score": "0.50737673", "text": "def load_config\n\t @repositories = {}\n current_repo = {}\n\t line_num = 0\n\t File.open(@conf_file, 'r').each do |line|\n puts \"line is #{line}\"\n line_num =+ 1\n line.gsub!(/^((\".*?\"|[^#\"])*)#.*/) {|m| m=$1}\n line.gsub!('=', ' = ')\n line.gsub!(/\\s+/, ' ')\n line.strip!\n next if line.empty?\n if res = line.match(/repo\\s+([\\w|\\-|@]*)$/ )\t \t\n @repositories[res[1]] = {permissions: {}, configs: [], options: []}\n current_repo = @repositories[\"#{res[1]}\"]\n elsif line.match(/config\\s[^$]*$/) \n current_repo[:configs] << line\n elsif line.match(/option\\s[^$]*$/) \n current_repo[:options] << line\n elsif perm = line.match(/(.*)=(.*)$/)\n current_repo[:permissions][perm[1].strip] = perm[2].split(\" \")\n else\n raise \"Error parsing #{@conf_file}:#{lin_num}\"\n end\n end \n\t\tend", "title": "" }, { "docid": "d1b71657b8b9051fc4d86a137f45ba30", "score": "0.5064838", "text": "def read\n require 'augeas'\n\n map = nil\n cfgfile = self.configfile\n unless cfgfile.nil?\n aug = Augeas::open('/', nil, Augeas::NO_MODL_AUTOLOAD)\n aug.transform(:lens => 'Shellvars.lns', :incl => cfgfile, :name => 'jboss-as.conf')\n aug.load\n is_bool = lambda { |value| !/^(true|false)$/.match(value).nil? }\n to_bool = lambda { |value| if !/^true$/.match(value).nil? then true else false end }\n map = {}\n aug.match(\"/files#{cfgfile}/*\").each do |key|\n m = key[/(JBOSS_.+)$/]\n if m\n v = aug.get(key)\n v = to_bool.call(v) if is_bool.call(v)\n map[m.downcase.sub('jboss_', '')] = v\n end\n end\n aug.close\n end\n map\n end", "title": "" }, { "docid": "21322071dcac8d206ac5cc48247737b9", "score": "0.5062242", "text": "def conf\n @conf ||= JSON.parse(File.read(config_file))\n rescue\n @conf ||= {}\n end", "title": "" }, { "docid": "d48e861585dc40742e7df20e06d66c2a", "score": "0.5060572", "text": "def config\n unless @config\n @config = YAML.load_file( @config_file )\n end\n @config\n end", "title": "" }, { "docid": "d0055b72cea0450b7f3568115ccabe1e", "score": "0.5059659", "text": "def ipmi_config(component = 'bmc')\n output = shell_out(\"#{component}-config --checkout\")\n\n result = {}\n\n sections = Hash[output.stdout.scan(/^Section\\s+(.*?)\\s*\\n+(.*?)EndSection/m)]\n\n sections.each do |name,config|\n h = {}\n config.each_line do |line|\n (key,value) = line.match(/^\\s*(.*?)\\s+(.*)/).captures\n next if key =~ /^#/ #skip comments\n h[key] = value\n end\n result[name] = h\n end\n\n return result\n end", "title": "" }, { "docid": "16876c54a19e1cee0e6fc90615b241a1", "score": "0.5053832", "text": "def file\n config['config_file']\n end", "title": "" }, { "docid": "85e84aa5f417ba0bc2f94ab84cb7a2e0", "score": "0.5050951", "text": "def config_from_node(inventory_hash, node_name)\n inventory_hash['groups'].each do |group|\n group['nodes'].each do |node|\n if node['name'] == node_name\n return node['config']\n end\n end\n end\n raise \"No config was found for #{node_name}\"\n end", "title": "" }, { "docid": "278d264e5f54c595af32491559be6366", "score": "0.50395113", "text": "def config\n return @config if @config\n cmd = \"#{ansible_inventory_path} --inventory '#{@path}' --yaml --list\"\n o, e, s = run_command(cmd)\n unless s.success?\n warn e\n raise \"failed to run `#{cmd}`: #{s}\"\n end\n @config = YAML.safe_load(o)\n end", "title": "" }, { "docid": "d83eccb1457dcfbc596862ffe0e6218d", "score": "0.50386983", "text": "def config\n if config?\n (YAML.load_file(config_file) || {}).with_indifferent_access\n else\n {}\n end\n end", "title": "" }, { "docid": "51fb3e6febe0aae2b43cf8a52e2d7ac4", "score": "0.50382835", "text": "def [](key)\n @config_mutex.synchronize() do\n return @config[key]\n end\n end", "title": "" }, { "docid": "94b3a55df0f3134e44c89ce609bd820c", "score": "0.50379705", "text": "def read_configuration\n end", "title": "" }, { "docid": "f794afe1d47345513d8d5bdbde70cedc", "score": "0.50365055", "text": "def config_file\n File.join(Gem.user_home, '.gemrc')\n end", "title": "" }, { "docid": "600537d3c669e107fef3e67e5560c029", "score": "0.50334555", "text": "def get_test_config( section )\n\t\treturn {} unless TESTING_CONFIG_FILE.exist?\n\n\t\tRedleaf.logger.debug \"Trying to load test config: %s\" % [ TESTING_CONFIG_FILE ]\n\n\t\tbegin\n\t\t\tconfig = YAML.load_file( TESTING_CONFIG_FILE )\n\t\t\tif config[ section ]\n\t\t\t\tRedleaf.logger.debug \"Loaded the config, returning the %p section: %p.\" %\n\t\t\t\t\t[ section, config[section] ]\n\t\t\t\treturn config[ section ]\n\t\t\telse\n\t\t\t\tRedleaf.logger.debug \"No %p section in the config (%p).\" % [ section, config ]\n\t\t\t\treturn {}\n\t\t\tend\n\t\trescue => err\n\t\t\tRedleaf.logger.error \"Test config failed to load: %s: %s: %s\" %\n\t\t\t\t[ err.class.name, err.message, err.backtrace.first ]\n\t\t\treturn {}\n\t\tend\n\tend", "title": "" }, { "docid": "02d371b7222c165a117ced70074b2609", "score": "0.5033383", "text": "def config_read(id: 1, env: 'sandbox')\n response = http_client.get(\"#{base_path}/configs/#{env}/#{id}\")\n resource_instance(response)\n end", "title": "" }, { "docid": "183a77e4942ef4f5ab30a7eea69ccf71", "score": "0.50046176", "text": "def config\n @config ||= root.join(@options.fetch(:config) { DEFAULT_CONFIG })\n end", "title": "" }, { "docid": "183a77e4942ef4f5ab30a7eea69ccf71", "score": "0.50046176", "text": "def config\n @config ||= root.join(@options.fetch(:config) { DEFAULT_CONFIG })\n end", "title": "" }, { "docid": "d50ed74786c5bbf8fdb5a180d94c8938", "score": "0.49991703", "text": "def read_configuration\n\tconfig = YAML.load_file(\"config.yml\")\n\tconfig_p = config[\"production\"]\n\treturn config_p\nend", "title": "" }, { "docid": "05356b6285bae5809a6a1676efef2d85", "score": "0.49977174", "text": "def get_cfg\n get_uri = @controller.get_ext_mount_config_uri(self)\n response = @controller.rest_agent.get_request(get_uri)\n check_response_for_success(response) do |body|\n NetconfResponse.new(NetconfResponseStatus::OK, body)\n end\n end", "title": "" }, { "docid": "61ebd29a9547342dcba43a3fd52effd4", "score": "0.4996308", "text": "def parsed_repo\n return new_resource.repo if new_resource.repo\n new_resource.container_name\n end", "title": "" }, { "docid": "90c0bc8a5119fc46bc58e2c85dd195a2", "score": "0.49888793", "text": "def get_repo(name)\n repo_configs.find { |rc| rc.name == name }\n end", "title": "" }, { "docid": "d3b072c9c5a0472dcf317f577fa36956", "score": "0.49840987", "text": "def getSSHConfig\n end", "title": "" }, { "docid": "a531743bed2b0a7ae1c15f556ff4ce78", "score": "0.49790844", "text": "def config\n return @config ||= buildfile.config_for(self[:target_name], SC.build_mode).merge(SC.env)\n end", "title": "" }, { "docid": "0d001ee664b2d295190f88cfa107a913", "score": "0.49774703", "text": "def config\n @config ||= Configuration.load_from(config_path)\n end", "title": "" }, { "docid": "0d001ee664b2d295190f88cfa107a913", "score": "0.49774703", "text": "def config\n @config ||= Configuration.load_from(config_path)\n end", "title": "" }, { "docid": "fa87fc6d12c0b5da889f1bb6a33e77d8", "score": "0.49738932", "text": "def cfg\n Hash[\n CONFIG_KEYS.map { |key|\n [key, self.instance_variable_get(\"@#{key}\")]\n }\n ]\n end", "title": "" }, { "docid": "3eb08a5130eb1d380de7601d537048da", "score": "0.49719855", "text": "def config_from_node(inventory_hash, node_name)\n config = targets_in_inventory(inventory_hash) do |target|\n next unless target['uri'].casecmp(node_name).zero?\n\n return target['config'] unless target['config'].nil?\n end\n\n config.empty? ? nil : config[0]\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "acb1a4b8fdbd5c70c4e8321cb26c99c0", "score": "0.0", "text": "def set_voluntario_temporal\n @voluntario_temporal = VoluntarioTemporal.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59219855", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.589884", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889191", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58780754", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5863248", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.58094144", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.57375425", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57285565", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.57149214", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.56900954", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.56665677", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.5651118", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5648135", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56357735", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5627078", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5608873", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5598699", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5598419", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5589822", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55084664", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.5504379", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465574", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.5464707", "text": "def on_setup(&block); end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54471064", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54455084", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5437386", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54160327", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5397424", "text": "def post_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392518", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.5385411", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53487605", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5346655", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53448105", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5342072", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5341318", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53243506", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53025913", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.5283114", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5282289", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.52585614", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.52571374", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.52483684", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.5244467", "text": "def action_awareness\n if action_aware?\n if [email protected]?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.5236853", "text": "def after_setup\n end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52330637", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52300817", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.522413", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.521999", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.5215832", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.5213786", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.52100146", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52085197", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5203262", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5202406", "text": "def performed(action)\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.520174", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.5201504", "text": "def create_setup\n \n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.5191404", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5178325", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.51765746", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.5162045", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5150735", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.5143402", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51415485", "text": "def code_action_provider; end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51376045", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.51318985", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.5115387", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5109771", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5107364", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.5106081", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51001656", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50964546", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.5093199", "text": "def add_callbacks(base); end", "title": "" } ]
d36e938fb1e5ab5e1cc41fc233794136
PATCH/PUT /generators/1 PATCH/PUT /generators/1.json
[ { "docid": "9c8719b898941994e1632bf9cd4fb1d8", "score": "0.626261", "text": "def update\n respond_to do |format|\n if @generator.update(params[:result])\n format.html { redirect_to(generators_path(@generators))}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "bbba1e8745a5d2a35295e52db03004e1", "score": "0.66659075", "text": "def update\n @generator = Generator.find(params[:id])\n\n respond_to do |format|\n if @generator.update_attributes(params[:generator])\n format.html { redirect_to @generator, notice: 'Generator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9255b8a84452efd51ff7466ccbc96ec8", "score": "0.65815306", "text": "def update\n respond_to do |format|\n if @generator.update(generator_params)\n format.html { redirect_to @generator, notice: 'Generator was successfully updated.' }\n format.json { render :show, status: :ok, location: @generator }\n else\n format.html { render :edit }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5318fcc1f92a633cc015a43f61628df4", "score": "0.6569074", "text": "def update\n respond_to do |format|\n if @generator.update(generator_params)\n format.html { redirect_to @generator, notice: 'Data was successfully updated.' }\n format.json { render :show, status: :ok, location: @generator }\n else\n format.html { render :edit }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d5eaea298e64625a71a15a970f3b75ed", "score": "0.64167154", "text": "def patch *args\n make_request :patch, *args\n end", "title": "" }, { "docid": "0263cfe67475cb67ca4e2e8a9aff994f", "score": "0.61805433", "text": "def update\n @generator = Generator.find(params[:id])\n\t\tparams[:generator][:system_type_id] = SystemType.find_by_name(params[:generator][:system_type_id]).id\n\n respond_to do |format|\n if @generator.update_attributes(params[:generator])\n format.html { redirect_to station_generators_path(@generator.station), notice: 'Generator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42e4d81ce0f91ce996dcbc347df2958d", "score": "0.6154138", "text": "def update\n @response = self.class.put(\"#{@server_uri}/resource_name/#{@opts[:id]}.json\", :body => \"{'resource_form_name':#{JSON.generate(@opts)}}\")\n end", "title": "" }, { "docid": "b4cc3ee2207b39abaf779a6078bbaf3a", "score": "0.6107409", "text": "def patch\n PATCH\n end", "title": "" }, { "docid": "b4cc3ee2207b39abaf779a6078bbaf3a", "score": "0.6107409", "text": "def patch\n PATCH\n end", "title": "" }, { "docid": "8a1fcbdae3046e2102f533f681b61c66", "score": "0.61033523", "text": "def update_contact\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/contacts/3'\n ).to_s\n\n puts RestClient.patch(\n url, {contact: {name: \"Josh\", email: \"[email protected]\"}} )\nend", "title": "" }, { "docid": "b4fbe2bb4554c75214ec612a847f458e", "score": "0.6067438", "text": "def update_tenant_circle(args = {}) \n id = args['id']\n temp_path = \"/tenantcircles.json/{circleId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantcircleId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "title": "" }, { "docid": "fa16209f5ac39ae638cdf45c17fd5f18", "score": "0.60454", "text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end", "title": "" }, { "docid": "fa16209f5ac39ae638cdf45c17fd5f18", "score": "0.60454", "text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end", "title": "" }, { "docid": "ca9fd5f1d76d6a1a8f9b0a89c64e0aa5", "score": "0.6023607", "text": "def post_update(params)\n @client.post(\"#{path}/update\", nil, params, \"Content-Type\" => \"application/json\")\n end", "title": "" }, { "docid": "0c1a09a9d20ee815b5c9f998eda70b44", "score": "0.60073644", "text": "def patch(path, params = {}, options = {})\n options[:content_type] ||= :json\n options[:Authorization] = \"simple-token #{self.access_token}\"\n RestClient.patch(request_url(path), params.to_json, options)\n end", "title": "" }, { "docid": "f0686f191a0def3b6c3ad6edfbcf2f03", "score": "0.59764045", "text": "def update_user(email)\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/users/2.json'\n ).to_s\n\n puts RestClient.patch(\n url,\n { user: { email: email } }\n )\n end", "title": "" }, { "docid": "aa0b87a16ede7353758305dbbaf57c22", "score": "0.5951069", "text": "def put(*a) route 'PUT', *a end", "title": "" }, { "docid": "a21658e8869b48b877bfbe57de8fb717", "score": "0.59343094", "text": "def update_contact\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/contacts/3'\n ).to_s\n\n puts RestClient.put(\n url,\n { Contact: { email: \"[email protected]\" } } )\n \nend", "title": "" }, { "docid": "47abb2cddfa1a665018f717cdaaa4164", "score": "0.5854701", "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": "ea416b077fa0aa7e84ec3fe2ef9c3772", "score": "0.5827712", "text": "def put\n request_method('PUT')\n end", "title": "" }, { "docid": "6b3d6af3e1ade5f41124866b57a6b326", "score": "0.58229184", "text": "def patch(path, **args); end", "title": "" }, { "docid": "6b9fde418b2c43a16c55a943133854da", "score": "0.5813505", "text": "def update\n respond_to do |format|\n if @generator_form.update(generator_form_params)\n format.html { redirect_to @generator_form, notice: 'Generator form was successfully updated.' }\n format.json { render :show, status: :ok, location: @generator_form }\n else\n format.html { render :edit }\n format.json { render json: @generator_form.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2562194eda10f9e580b3a59267fb73b2", "score": "0.5802755", "text": "def update!\n request_ids.shift\n return unless request_ids.empty?\n\n node = @root.render\n `PATCHER(#{root.node}, #{node})`\n @root.node = node\n end", "title": "" }, { "docid": "353d5ffcf0643b2587fb2912a944895f", "score": "0.57828707", "text": "def update\n respond_to do |format|\n if @table_generator.update(table_generator_params)\n format.html { redirect_to @table_generator, notice: 'Table generator was successfully updated.' }\n format.json { render :show, status: :ok, location: @table_generator }\n else\n format.html { render :edit }\n format.json { render json: @table_generator.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b2d5fc83a907f25e5176864fa6beb3d0", "score": "0.57600194", "text": "def put_rest(path, json) \n run_request(:PUT, create_url(path), json)\n end", "title": "" }, { "docid": "16714f614b8fe1809e96d03da962e6d9", "score": "0.57323885", "text": "def edit_client (client_id = nil, name = nil, contact = nil, email = nil, password = nil, msisdn = nil, timezone = nil, client_pays = nil, sms_margin = nil, opts={})\n query_param_keys = [:client_id,:name,:contact,:email,:password,:msisdn,:timezone,:client_pays,:sms_margin]\n headerParams = {}\n\n \n \n # set default values and merge with input\n options = {\n :'client_id' => client_id,\n :'name' => name,\n :'contact' => contact,\n :'email' => email,\n :'password' => password,\n :'msisdn' => msisdn,\n :'timezone' => timezone,\n :'client_pays' => client_pays,\n :'sms_margin' => sms_margin\n \n }.merge(opts)\n\n #resource path\n path = \"/edit-client.json\".sub('{format}','json')\n \n # pull querystring keys from options\n queryopts = options.select do |key,value|\n query_param_keys.include? key\n end\n\n # header parameters\n headers = {}\n\n _header_accept = 'application/json'\n if _header_accept != ''\n headerParams['Accept'] = _header_accept\n end \n _header_content_type = ['application/x-www-form-urlencoded']\n headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'\n\n \n \n headers[:'Authorization'] = @api_key_secret\n\n # http body (model)\n post_body = nil\n \n # form parameters\n form_parameter_hash = {}\n \n \n \n Swagger::Request.new(:PUT, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make\n \n \n end", "title": "" }, { "docid": "4aa4caf9cabfc802182480deda06c6cc", "score": "0.57076395", "text": "def regenerate\n res = @client.post(\"#{path}/regenerate\", nil, {})\n\n if res.success?\n @path = nil\n @attributes = res.json\n end\n end", "title": "" }, { "docid": "2c5497f059ab1d7457ffc834ecb8f6a2", "score": "0.5707622", "text": "def patch(path, params = {})\n request(:patch, path, params)\n end", "title": "" }, { "docid": "c8a460a2e0eba6f70eb9006b9ea72e3e", "score": "0.5699601", "text": "def update\n respond_to do |format|\n if @pid_generator.update(pid_generator_params)\n format.html { redirect_to @pid_generator, notice: 'PID Generator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pid_generator.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "05c1bed948daa058e70016e863c7cd96", "score": "0.5699358", "text": "def update_request(data)\n client.create_request('PATCH', url_path, 'data' => data)\n end", "title": "" }, { "docid": "7f7c16b9e14f1352bb07fd27f83679a7", "score": "0.56689143", "text": "def patch(path, params: {}, headers: {})\n request_json :patch, path, params, headers\n end", "title": "" }, { "docid": "fe34f93da0751ad55cc5052cfdd2366c", "score": "0.5663967", "text": "def update\n render json: Person.update(params[\"id\"], params[\"person\"])\n end", "title": "" }, { "docid": "d61c0aeb123e4c5cfcb2ba019dd903a0", "score": "0.5660317", "text": "def patch(options = {})\n request :patch, options\n end", "title": "" }, { "docid": "0f8872308cd71e90aed963baf02fd23e", "score": "0.56496644", "text": "def update\n request = RestClient.put File.join(API_SERVER,\"rest-api/departments\"), { \n 'id' => params['id'], \n 'name' => params['department']['name'], \n 'description' => params['department']['description'] }.to_json, :content_type => :json, :accept => :json\n\n redirect_to :action => :index\n end", "title": "" }, { "docid": "adece6c8dbba6da8d956774b410c645a", "score": "0.5645882", "text": "def update_mobile_carrier(args = {}) \n id = args['id']\n temp_path = \"/mobile.json/{carrierId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"mobileId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "title": "" }, { "docid": "66a93f47189fc68e1ae9ce4ff5ad7ec2", "score": "0.56387854", "text": "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= builder.content_type\n post opts.fetch(:path, update_path), opts\n end", "title": "" }, { "docid": "2d5dc23a513bbc7e45aefe91ad790e49", "score": "0.563462", "text": "def set_or_update_arrays_for_floorplan(args = {}) \n id = args['id']\n temp_path = \"/floorplans.json/{floorplanId}/arrays\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"floorplanId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "title": "" }, { "docid": "5fd5f00640bdb0c785bcac4689a46f3c", "score": "0.5599294", "text": "def patch(data, options={})\n raise NotImplementedError, \"We only patchs to singular resources.\" if count > 1\n first.patch(data, options)\n end", "title": "" }, { "docid": "a0f223d202792f2579383a8d4e32a375", "score": "0.5599211", "text": "def update\n respond_to do |format|\n if @yield.update(yield_params)\n format.html { redirect_to @yield, notice: \"Yield was successfully updated.\" }\n format.json { render :show, status: :ok, location: @yield }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @yield.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "882c8317370987b86425c0adbf5bfe8c", "score": "0.55935055", "text": "def update_aos_version(args = {}) \n put(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "title": "" }, { "docid": "1372856b45a7a924dc31b72a27db0324", "score": "0.5586728", "text": "def patch(path, params: {}, body: {})\n request(:patch, path, params: params, body: body)\n end", "title": "" }, { "docid": "af9aedd4f428a2c26c3fd57798526020", "score": "0.5579049", "text": "def put(path, data = {}, header = {})\n _send(json_request(Net::HTTP::Patch, path, data, header))\n end", "title": "" }, { "docid": "77ce27989a6eb1263af612ecffa00850", "score": "0.55777615", "text": "def update\n update! do |success, failure|\n success.json { render :json => resource }\n end\n end", "title": "" }, { "docid": "fbd7c46b15ae2792fd842ba0d764b7d0", "score": "0.55749637", "text": "def put uri, args = {}; Request.new(PUT, uri, args).execute; end", "title": "" }, { "docid": "eb550615010ae00d41ba93bcb049c849", "score": "0.55671895", "text": "def update\n if @nitrogen.update(nitrogen_params)\n render json @nitrogen\n else\n render json: @nitrogen.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "1b57231ba2ba0a84b687da72812aa027", "score": "0.5559101", "text": "def update_report_template(args = {}) \n id = args['id']\n temp_path = \"/reports.json/template/{templateId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"reportId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "title": "" }, { "docid": "8e18db431964c254de53caa41795b702", "score": "0.55566376", "text": "def put *args\n make_request :put, *args\n end", "title": "" }, { "docid": "cfe60af276f4366be6cdb1b797753da6", "score": "0.5547326", "text": "def update\n resource.update(client_params)\n respond_with resource\n end", "title": "" }, { "docid": "49300db0ecbd5af1bcc47da2addac2ec", "score": "0.55407107", "text": "def update\n yield @fractal if block_given?\n respond_to do |format|\n if @fractal.update(fractal_params)\n format.html { redirect_to @fractal, notice: 'Fractal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fractal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "76947a495f8371e8e772fdb40663d3b8", "score": "0.5537433", "text": "def update_report_template(args = {}) \n put(\"/reports.json/template/#{args[:templateId]}\", args)\nend", "title": "" }, { "docid": "f300558635440a8c331bfd6edd8fd1b1", "score": "0.5530695", "text": "def update_guest_access_portal(args = {}) \n id = args['id']\n temp_path = \"/guestaccess.json/gap/{portalId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"guestaccesId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "title": "" }, { "docid": "6283d5b0efd676645cd5b91fb528018a", "score": "0.5526571", "text": "def favorite\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/contacts/2/favorite'\n ).to_s\n\n puts RestClient.patch(\n url,{}\n )\nend", "title": "" }, { "docid": "2c19398654f425f1b3f8528d2e888b3a", "score": "0.5524251", "text": "def patch?; end", "title": "" }, { "docid": "2c19398654f425f1b3f8528d2e888b3a", "score": "0.5524251", "text": "def patch?; end", "title": "" }, { "docid": "2c19398654f425f1b3f8528d2e888b3a", "score": "0.5524251", "text": "def patch?; end", "title": "" }, { "docid": "ed0826bfec77d499b10e6b0e6ded59c9", "score": "0.5512783", "text": "def patch?; request_method == \"PATCH\" end", "title": "" }, { "docid": "498115bd81888c332f5fbdc24043cfea", "score": "0.5509687", "text": "def update\n respond_to do |format|\n if @gen_detail.update(gen_detail_params)\n format.html { redirect_to action: \"index\", notice: \"Generator Type is updated successfully.\"}\n else\n format.html { render :edit }\n format.json { render json: @gen_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "86551651ffd65dd264aeafa7d287402c", "score": "0.5506582", "text": "def test_edit_contact_with_valid_email\n get_contacts_request\n url = @url_base + \"/api/v1/user/contact/\" + @contact['id'].to_s\n @response = RestClient.put(url, \n {\n :contact => {\n :first_name => \"edited name\", \n :last_name => \"edited last name\"\n }\n },\n {\n \"Content-Type\" => \"application/json\",\n \"X-User-Email\" => \"[email protected]\"\n })\n assert_equal 200, @response.code\n end", "title": "" }, { "docid": "c69ef5a559fc65f554a105367e861e52", "score": "0.5504025", "text": "def update\n# @requests_cloning = Requests::Cloning.find(params[:id])\n\n respond_to do |format|\n if @requests_cloning.update(requests_cloning_params)\n #Generarte PDF\n filename = \"public/pdf/#{'%.6d' % @requests_cloning.id}_pcr.pdf\"\n PdfGenerator.request(@requests_cloning, filename)\n format.html { redirect_to @requests_cloning, notice: t('notices.updated_successfully') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @requests_cloning.errors, status: :unprocessable_entity }\n end\n end\n\n end", "title": "" }, { "docid": "e0fcaa8cc669a09eb117ee6a9b22e6db", "score": "0.5490314", "text": "def update\n spec[UPDATE]\n end", "title": "" }, { "docid": "abce1dfbfa7adc8a127622108f732a95", "score": "0.5476017", "text": "def update_person(api, cookie, perstoupdate, person)\n pers_id = perstoupdate['id']\n option_hash = { content_type: :json, accept: :json, cookies: cookie }\n pers = nil\n res = api[\"people/#{pers_id}\"].patch person.to_json, option_hash unless $dryrun\n if res&.code == 201\n pers = JSON.parse(res.body)\n end\n pers\nend", "title": "" }, { "docid": "3551a93e8829fecafd58bf691a860eeb", "score": "0.5473278", "text": "def update_object(path, id, info)\n json_parse_reply(*json_put(@target, \"#{path}/#{URI.encode(id)}\", info,\n @auth_header, if_match: info[:meta][:version]))\n end", "title": "" }, { "docid": "5d1d0a1cfae8d276693aa145776d8152", "score": "0.5459857", "text": "def update\n respond_with []\n end", "title": "" }, { "docid": "dbb28b78ebd14a35895337cf6eecee2a", "score": "0.5456988", "text": "def patch(path, data = nil)\n request(:patch, path, data)\n end", "title": "" }, { "docid": "289e54a931fadb30622e879bc789310a", "score": "0.54517823", "text": "def update!(**args)\n @api_methods = args[:api_methods] if args.key?(:api_methods)\n @resources = args[:resources] if args.key?(:resources)\n end", "title": "" }, { "docid": "6c599ef7192cee6370183799cb315c8e", "score": "0.54446924", "text": "def create_method\n :http_put\n end", "title": "" }, { "docid": "6c599ef7192cee6370183799cb315c8e", "score": "0.54446924", "text": "def create_method\n :http_put\n end", "title": "" }, { "docid": "c797a7ed49652f33aee31b199bf77311", "score": "0.54437345", "text": "def patch(path, params = {}, options = {}, &block)\n request(:patch, path, params, options, &block)\n end", "title": "" }, { "docid": "c02a8e1e047e02b981879dff39c51e4a", "score": "0.5438492", "text": "def update\n create\n end", "title": "" }, { "docid": "c02a8e1e047e02b981879dff39c51e4a", "score": "0.5438492", "text": "def update\n create\n end", "title": "" }, { "docid": "c02a8e1e047e02b981879dff39c51e4a", "score": "0.5438492", "text": "def update\n create\n end", "title": "" }, { "docid": "c02a8e1e047e02b981879dff39c51e4a", "score": "0.5438492", "text": "def update\n create\n end", "title": "" }, { "docid": "c02a8e1e047e02b981879dff39c51e4a", "score": "0.5438492", "text": "def update\n create\n end", "title": "" }, { "docid": "c02a8e1e047e02b981879dff39c51e4a", "score": "0.5438492", "text": "def update\n create\n end", "title": "" }, { "docid": "c02a8e1e047e02b981879dff39c51e4a", "score": "0.5438492", "text": "def update\n create\n end", "title": "" }, { "docid": "c02a8e1e047e02b981879dff39c51e4a", "score": "0.5438492", "text": "def update\n create\n end", "title": "" }, { "docid": "07cb25f42024ec84a4e613758ac08291", "score": "0.5433303", "text": "def update!(**args)\n @api_methods = args[:api_methods] unless args[:api_methods].nil?\n @resources = args[:resources] unless args[:resources].nil?\n end", "title": "" }, { "docid": "a6d2e276d02c66970a03a21e13d8cf37", "score": "0.543319", "text": "def patch; end", "title": "" }, { "docid": "9e2f3b99d8acdc95a08492878bb59822", "score": "0.54316676", "text": "def patch(path, attributes)\n resp = token.post(prefix + path, attributes.to_json, HEADERS.merge({\"x-http-method-override\" => \"PATCH\"}))\n end", "title": "" }, { "docid": "fe54881c68547925852f91938fc42a82", "score": "0.5429226", "text": "def resource_patch(scopes_uri, operation, path, value = nil)\n ensure_client && ensure_uri\n body = { 'op' => operation,\n 'path' => path,\n 'value' => value }\n options = { 'Content-Type' => 'application/json-patch+json',\n 'If-Match' => '*', 'body' => [body] }\n response = @client.rest_patch(scopes_uri, options, @api_version)\n @client.response_handler(response)\n end", "title": "" }, { "docid": "a843ed3d4059b8fbe8245772491016ff", "score": "0.54159224", "text": "def update\n @genere = Genere.find(params[:id])\n\n respond_to do |format|\n if @genere.update_attributes(params[:genere])\n format.html { redirect_to @genere, notice: 'Genere was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @genere.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "781b2f0ac0622ebf22bfde8972b7037e", "score": "0.54099935", "text": "def update\n if @client.update(client_params)\n render json: @client\n else\n render json: @client.errors, status: :unprocessable_entity\n end\nend", "title": "" }, { "docid": "0f2bfb55104e7042629073f7f9172435", "score": "0.5406533", "text": "def update\n @generation = Generation.find(params[:id])\n\n respond_to do |format|\n if @generation.update_attributes(params[:generation])\n format.html { redirect_to @generation, notice: 'Generation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @generation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bcd961352efdd74545698e234d25056e", "score": "0.54017305", "text": "def update\n update! do |format|\n format.all { head :ok }\n end\n end", "title": "" }, { "docid": "4ea58026dcc83522ae6b9b9963cdbc39", "score": "0.5399364", "text": "def patch(action, **args); end", "title": "" }, { "docid": "2d2c8daf1da88dc8b9ee1bcbccf9fc89", "score": "0.5391625", "text": "def do_resource_path_update(rest_service, new_resource_path, user_submitting)\n transaction do # do update\n begin \n @new_resource = RestResource.check_duplicate(rest_service, new_resource_path)\n\n if @new_resource.nil?\n @new_resource = RestResource.new(:rest_service_id => rest_service.id, :path => new_resource_path)\n @new_resource.submitter = user_submitting\n @new_resource.save!\n end\n \n old_resource_id = self.rest_resource.id # needed for deletion if it is no longer used\n\n if RestMethod.check_duplicate(@new_resource, self.method_type).nil? # endpoint does not exist\n self.rest_resource_id = @new_resource.id\n self.save!\n \n old_res = RestResource.find(old_resource_id)\n old_res.destroy if old_res && old_res.rest_methods.blank? # remove unused RestResource\n else # endpoint exists \n raise # complain that the endpoint already exists and return\n end\n rescue\n @new_resource.destroy if @new_resource\n return \"Could not update the endpoint. If this error persists we would be very grateful if you notified us.\"\n end\n \n # update template params\n template_params = new_resource_path.split(\"{\")\n template_params.each { |p| p.gsub!(/\\}.*/, '') } # remove everything after '}' \n \n # only keep the template params that have format: param || param_name || param-name\n template_params.reject! { |p| !p.gsub('-', '_').match(/^\\w+$/) } \n template_params.reject! { |x| x.blank? }\n \n params_to_delete = self.request_parameters.select { |p| p.param_style==\"template\" && !template_params.include?(p.name) }\n params_to_delete.each { |p| p.destroy }\n \n self.request_parameters # reload collection\n \n self.add_parameters(template_params.join(\"\\n\"), user_submitting, \n :mandatory => true, \n :param_style => \"template\",\n :make_local => true)\n end # transaction\n \n return nil\n end", "title": "" }, { "docid": "6e199a66ffec4e759e7fd21a993922f4", "score": "0.53910905", "text": "def update\n respond_to do |format|\n if @gen_avail.update(gen_avail_params)\n format.html { redirect_to controller: \"gen_details\", action: \"index\", notice: \"Generator was updated successfully.\" }\n# format.html { redirect_to @gen_avail, notice: 'Gen avail was successfully updated.' }\n# format.json { render :show, status: :ok, location: @gen_avail }\n else\n format.html { render :edit }\n format.json { render json: @gen_avail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c7d3cd0f218c42e01dbd0246ab7b00c9", "score": "0.53892636", "text": "def put(path, params={}); make_request(:put, host, port, path, params); end", "title": "" }, { "docid": "0a565cef00d6874eb6d07052cd70dfab", "score": "0.5385044", "text": "def update(json_resource)\n jsonapi_request(:patch, \"#{@route}/#{json_resource['id']}\", \"data\"=> json_resource)\n end", "title": "" }, { "docid": "1b43604bd409d8c4644421c395d71320", "score": "0.5381329", "text": "def update\n\t\t\t\trender json: {}, status: 405\n\t\t\tend", "title": "" }, { "docid": "404fee129164f0e580bdc585d4b60289", "score": "0.53808224", "text": "def update\n @req = Req.find(params[:id])\n\n respond_to do |format|\n if @req.update_attributes(params[:req])\n format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @req.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6606fe2a54e816a24177fba301eedf64", "score": "0.53753066", "text": "def patch(path, params = nil, headers = nil)\n process(:patch, path, params, headers)\n end", "title": "" }, { "docid": "6606fe2a54e816a24177fba301eedf64", "score": "0.53753066", "text": "def patch(path, params = nil, headers = nil)\n process(:patch, path, params, headers)\n end", "title": "" }, { "docid": "bb7ed616376db4ed2ff763d2659f1e13", "score": "0.537335", "text": "def update\n respond_to do |format|\n if @boilerplate.update(boilerplate_params)\n format.json { render :show, status: :ok, location: @api_v1_boilerplate }\n else\n format.json { render json: @boilerplate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b094d2d9e05d560edfc9226aa941ad22", "score": "0.53706944", "text": "def patch(path, options={})\n send_request(:patch, path, options)\n end", "title": "" }, { "docid": "bdb1db4d361e973f07d43bdeeaeba7e3", "score": "0.5370216", "text": "def update\n delete(true)\n create\n end", "title": "" }, { "docid": "2572fb900123dab962d92dfd5cd31505", "score": "0.5361767", "text": "def update\n spice = Spice.find_by(id: params[:id])\n spice.update(spice_params)\n render json: spice\nend", "title": "" }, { "docid": "6b8d9d95614c32acd801ddd5ade727a5", "score": "0.5358609", "text": "def update\n if request.request_method_symbol == :put\n update_put\n elsif request.request_method_symbol == :patch\n update_patch\n else\n render partial: 'api/v1/error', locals: {:@error => {code: 501, message: 'Not Implemented'}}, status: 501\n end\n\n\n=begin\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "title": "" }, { "docid": "2bd0f8437d690524e73d4e5ae5481fa0", "score": "0.5357392", "text": "def patch(path, params: {}, body: {})\n request(:patch, URI.parse(api_endpoint).merge(path), params: params, body: body)\n end", "title": "" }, { "docid": "abf6e1284c7f5988240a82a3994d0bf4", "score": "0.5356856", "text": "def stub_any_publishing_api_path_reservation\n stub_request(:put, %r{\\A#{PUBLISHING_API_ENDPOINT}/paths/}).to_return do |request|\n base_path = request.uri.path.sub(%r{\\A/paths}, \"\")\n body = JSON.parse(request.body).merge(base_path: base_path)\n {\n status: 200,\n headers: { content_type: \"application/json\" },\n body: body.to_json,\n }\n end\n end", "title": "" }, { "docid": "ad4fd451ba062d4212571c3e3f3673a7", "score": "0.5354799", "text": "def update\n respond_with do |format|\n format.json {\n id = params[\"id\"]\n \n # delete form data we don't need\n params.delete(\"id\")\n params.delete(\"format\")\n params.delete(\"action\")\n params.delete(\"controller\")\n \n vs = ValueSet.find(id)\n # Whitelist necessary here. When passing in code_sets it breaks update_attributes.\n whitelist = [:oid, :description, :category, :concept, :organization, :version, :key]\n # splat needed below to flatten attributes to slice()\n if !vs.update_attributes(params.slice(*whitelist))\n render :json => {:message => \"error\", :errors => vs.errors}\n end\n \n if params.keys.include?(\"code_sets\")\n # symbolize our params\n sliced = params.slice(*whitelist)\n params_syms = {}\n sliced.map {|k,v| params_syms[k.to_sym] = v }\n \n # our form has embedded code_sets so now we need to add them\n form_code_sets = params[\"code_sets\"].keys.collect {|i| params[\"code_sets\"][i]}\n \n # this was a pain: embedded docs were not saving right\n vs.update_attributes(:code_sets => form_code_sets)\n vs.save\n else\n # our form has no embedded code_sets so delete them all\n vs.code_sets.delete_all\n vs.code_sets = []\n end\n \n if vs.save\n flash[:notice] = \"you just updated over ajax...\"\n render :json => {:message => \"success\"}\n else\n render :json => {:message => \"error\", :errors => vs.errors}\n end\n }\n end\n end", "title": "" } ]
630f50335c2455756d2a4bc538338ce0
Encode the temporal expression into +codes+.
[ { "docid": "acb7b492fe2e784dcd2a7833e28deaf0", "score": "0.6693738", "text": "def encode(codes)\n encode_list(codes, @terms)\n codes << encoding_token\n end", "title": "" } ]
[ { "docid": "63e9d5d022bf2e6f7e34a0593930b108", "score": "0.7303541", "text": "def encode(codes)\n encode_list(codes, @days)\n codes << encoding_token\n end", "title": "" }, { "docid": "5423129967f7111cf0ae8f61634dc7b4", "score": "0.72753364", "text": "def encode(codes)\n @base_date.nil? ? (codes << 0) : encode_date(codes, @base_date)\n codes << encoding_token\n end", "title": "" }, { "docid": "d7ce79cc302b9a2ec75745dc1e9fe1c2", "score": "0.7190874", "text": "def encode(codes)\n if @base_date\n encode_date(codes, @base_date)\n else\n codes << 0\n end\n codes << ',' << @interval << encoding_token\n end", "title": "" }, { "docid": "cdc74c32c5ba3a4d3549bbc50b586508", "score": "0.71409684", "text": "def encode(codes)\n encode_list(codes, @months)\n codes << encoding_token\n end", "title": "" }, { "docid": "b549a5ab598a540b086fe6b88e86f9fd", "score": "0.67948395", "text": "def encode(codes)\n codes << encoding_token\n end", "title": "" }, { "docid": "d69575e5b226ad2724434170ed5f6d69", "score": "0.6645118", "text": "def encode(codes)\n encode_list(codes, @parts)\n codes << encoding_token\n end", "title": "" }, { "docid": "d631d8c4a4e87adf6c84b066673a0cbc", "score": "0.65139914", "text": "def encode(codes)\n @term.encode(codes)\n codes << @prewindow_days << \",\" << @postwindow_days << \"s\"\n end", "title": "" }, { "docid": "76d5bc793419819732105852cd12bd89", "score": "0.6474602", "text": "def encode(codes)\n @term.encode(codes)\n codes << encoding_token\n end", "title": "" }, { "docid": "f34ddde90526fa0e504696b423f7bdbb", "score": "0.63544035", "text": "def encode(ary)\n ary.map { |(code, argument)| [INSTRUCTIONS[code], argument] }\n end", "title": "" }, { "docid": "71c24cb1e19fc5cd70c46420634d16ae", "score": "0.610779", "text": "def to_code\n return \"(#{@x.map(&:to_code).join(\", \")})\"\n end", "title": "" }, { "docid": "1aec42a19d67204a1b4c7df430e73353", "score": "0.60874826", "text": "def encode_date(codes, date)\n codes << date.strftime(\"%Y-%m-%d\")\n end", "title": "" }, { "docid": "495cef204e6a1f043d18172d10b1f0b3", "score": "0.60504043", "text": "def encode_with(coder); end", "title": "" }, { "docid": "495cef204e6a1f043d18172d10b1f0b3", "score": "0.60504043", "text": "def encode_with(coder); end", "title": "" }, { "docid": "495cef204e6a1f043d18172d10b1f0b3", "score": "0.60504043", "text": "def encode_with(coder); end", "title": "" }, { "docid": "495cef204e6a1f043d18172d10b1f0b3", "score": "0.60504043", "text": "def encode_with(coder); end", "title": "" }, { "docid": "4686e3937221f97ebccde9c72d474125", "score": "0.5958349", "text": "def encode_with(coder)\n vars = instance_variables.map { |x| x.to_s }\n vars = vars - [\"@dummy\"]\n\n vars.each do |var|\n var_val = eval(var)\n coder[var.gsub('@', '')] = var_val\n end\n end", "title": "" }, { "docid": "39be8a25655a4e7e1168bbf844438eba", "score": "0.5934127", "text": "def encode\n return @encoded if @encoded\n\n deltas = @delta.deltas_rounded @array_of_lat_lng_pairs\n chars_array = deltas.map { |v| @value_encoder.encode v }\n\n @encoded = chars_array.join\n end", "title": "" }, { "docid": "7bb3a341a8ac3b7425c70b37e8169457", "score": "0.5916022", "text": "def encode_list(codes, list)\n if list.empty?\n codes << \"[]\"\n elsif list.size == 1\n codes << list.first\n else\n codes << \"[\"\n prev = nil\n list.each do |item|\n codes << \",\" if prev && ! prev.kind_of?(TExp::Base)\n codes << item.to_s\n prev = item\n end\n codes << \"]\"\n end\n end", "title": "" }, { "docid": "85ea16e1c3ebd4f37aea1ea5b83e9dc0", "score": "0.5893037", "text": "def to_code\n \"(#{@x} #{@cond_type} #{@y})\"\n end", "title": "" }, { "docid": "d56e6fb9b7d9d5bd986e49112afa4ad7", "score": "0.5833906", "text": "def encode_time(time); end", "title": "" }, { "docid": "2b21512997e78ef339073558dafa88f4", "score": "0.5801949", "text": "def encode\n\t\t\t[@operator.to_s, *@values.map { |v| v.is_a?(Condition) ? v.encode : v } ]\n\t\tend", "title": "" }, { "docid": "9fb27a16877d45b379759c5e8909d18a", "score": "0.5779536", "text": "def encode(value); end", "title": "" }, { "docid": "9fb27a16877d45b379759c5e8909d18a", "score": "0.5779536", "text": "def encode(value); end", "title": "" }, { "docid": "9fb27a16877d45b379759c5e8909d18a", "score": "0.5779536", "text": "def encode(value); end", "title": "" }, { "docid": "ab5f57fb65239b6e1eaf02e3ed57aaad", "score": "0.57289094", "text": "def encode\n scratch_value = @value\n code = []\n\n begin\n octet = scratch_value & 0b1111111\n scratch_value >>= 7\n octet = (octet | 0b10000000) if scratch_value > 0\n code.push(BitVector.new(octet,8))\n end while scratch_value > 0\n\n return code\n end", "title": "" }, { "docid": "823bf6414a4f9daad150faea4de73b22", "score": "0.5713576", "text": "def encode_a_instruction(symbol, symbols_table)\n if symbol =~ /^\\d+$/\n value = symbol.to_i\n else\n value = symbols_table.fetch(symbol)\n end\n\n \"%016b\" % value\nend", "title": "" }, { "docid": "b18ad2f9d35fdb9151cbd68118ad178f", "score": "0.57125217", "text": "def to_s\r\n @_values.pack @_code\r\n end", "title": "" }, { "docid": "b9505e321b2f9f4cdc0f657669aa6183", "score": "0.5695859", "text": "def store_code(x)\r\n for i in 0..3 do\r\n @code[i] = \"o\".colorize(x[i].to_sym)\r\n end\r\n end", "title": "" }, { "docid": "f3b7e2d759fb66c368adc42db4960b68", "score": "0.5588279", "text": "def encode(code, options = T.unsafe(nil)); end", "title": "" }, { "docid": "d9ae21b5bd26357b88921ede6842ad86", "score": "0.5567589", "text": "def encode(params); end", "title": "" }, { "docid": "604b72cd01bb6a7b4c51ff9be025593a", "score": "0.5565531", "text": "def encode_code(eof = nil)\n @code = Rex::Text.encode_base64(Rex::Text.to_unicode(code))\n end", "title": "" }, { "docid": "a054c543195fb5059413e265f0cca3e4", "score": "0.5536529", "text": "def codes(*symbols)\n @codes = symbols\n end", "title": "" }, { "docid": "124998e0c7a9a4201748c093b6268da6", "score": "0.5517326", "text": "def encode\n \n end", "title": "" }, { "docid": "cc047f473baeb836cd07c4bf3a0aa92c", "score": "0.54946667", "text": "def encode_date(date); end", "title": "" }, { "docid": "7da9b6bbf7e092eecf6612df7ebd6539", "score": "0.5485103", "text": "def encode\n\t\t\ttransform_underscores\n\t\t\tvalues = @values.map { |v| v.is_a?(Condition) ? v.encode : v }\n\t\t\[email protected]? ? values[0] : [@operator.to_s, *values]\n\t\tend", "title": "" }, { "docid": "32b18432d96a5ebe7cda53632a7fe656", "score": "0.5457452", "text": "def encode(source, *instructions)\n string = source.to_s.dup\n if (instructions.empty?)\n instructions = [:basic]\n elsif (unknown_instructions = instructions - INSTRUCTIONS) != []\n raise InstructionError,\n \"unknown encode_entities command(s): #{unknown_instructions.inspect}\"\n end\n \n basic_entity_encoder =\n if instructions.include?(:basic) || instructions.include?(:named)\n :encode_named\n elsif instructions.include?(:decimal)\n :encode_decimal\n else instructions.include?(:hexadecimal)\n :encode_hexadecimal\n end\n #p basic_entity_encoder.to_s\n string.gsub!(basic_entity_regexp){ __send__(basic_entity_encoder, $&) }\n \n extended_entity_encoders = []\n if instructions.include?(:named)\n extended_entity_encoders << :encode_named\n end\n if instructions.include?(:decimal)\n extended_entity_encoders << :encode_decimal\n elsif instructions.include?(:hexadecimal)\n extended_entity_encoders << :encode_hexadecimal\n end\n unless extended_entity_encoders.empty?\n string.gsub!(extended_entity_regexp){\n encode_extended(extended_entity_encoders, $&)\n }\n end\n \n return string\n end", "title": "" }, { "docid": "eef34bf061071b836a0a84ba18b7174a", "score": "0.5457397", "text": "def encode_with(coder)\n coder.scalar = to_s\n coder.tag = nil\n end", "title": "" }, { "docid": "eef34bf061071b836a0a84ba18b7174a", "score": "0.5457397", "text": "def encode_with(coder)\n coder.scalar = to_s\n coder.tag = nil\n end", "title": "" }, { "docid": "eef34bf061071b836a0a84ba18b7174a", "score": "0.5457397", "text": "def encode_with(coder)\n coder.scalar = to_s\n coder.tag = nil\n end", "title": "" }, { "docid": "eef34bf061071b836a0a84ba18b7174a", "score": "0.5457397", "text": "def encode_with(coder)\n coder.scalar = to_s\n coder.tag = nil\n end", "title": "" }, { "docid": "eef34bf061071b836a0a84ba18b7174a", "score": "0.5457397", "text": "def encode_with(coder)\n coder.scalar = to_s\n coder.tag = nil\n end", "title": "" }, { "docid": "e2ce31e75c965e32c54a88a9c548bec9", "score": "0.54554987", "text": "def encode_with(coder)\n coder.seq = to_a\n end", "title": "" }, { "docid": "d9937da57a1d64fd45514130fff53988", "score": "0.5443278", "text": "def array_to_code(arr)\n code = ''\n arr.each_with_index do |part, i|\n code << ' + ' if i > 0\n case part\n when Symbol\n code << part.to_s\n when String\n code << %{\"#{part}\"}\n else\n raise \"Don't know how to compile array part: #{part.class} [#{i}]\"\n end\n end\n code\n end", "title": "" }, { "docid": "b3d932a3bda642555595a172cc87fbba", "score": "0.5436185", "text": "def encode(data); end", "title": "" }, { "docid": "9dec76bab7d3efeb7296c4546a67af76", "score": "0.5434045", "text": "def encode_datetime(time); end", "title": "" }, { "docid": "c31e4005d20ce365571df713453f0964", "score": "0.5433544", "text": "def encode_traces(encoder, traces)\n trace_hashes = traces.map do |trace|\n encode_trace(trace)\n end\n\n # Wrap traces & encode them\n encoder.encode(traces: trace_hashes)\n end", "title": "" }, { "docid": "fb92dd429854bf86f5b273d5bb023f40", "score": "0.5400851", "text": "def to_s\n codes = []\n encode(codes)\n codes.join(\"\")\n end", "title": "" }, { "docid": "bd8c405645e1d9bcd135e7dca871a146", "score": "0.54005086", "text": "def encode_with(coder)\n coder.represent_seq(nil, records)\n end", "title": "" }, { "docid": "03c8691e3f54eb9602a94ee1cc6261ea", "score": "0.5395908", "text": "def encode_with(coder)\n coder.scalar = @source\n end", "title": "" }, { "docid": "50f63241e92198aba942ec5051ad45e9", "score": "0.5386687", "text": "def timecodes\n @timecodes ||= times.collect(&:timecodes).flatten.uniq\n end", "title": "" }, { "docid": "3f2c427896fea3ed6ee487b2396f2d86", "score": "0.5379044", "text": "def encode( value )\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "59a8871dfff7cd7bf203f4a99fb4c116", "score": "0.53660375", "text": "def encode(data)\r\n end", "title": "" }, { "docid": "199e7ff43456614f759612c979392788", "score": "0.5336513", "text": "def encode_with(coder)\n vars = instance_variables.map { |x| x.to_s }\n vars = vars - [\"@current_env\"]\n\n vars.each do |var|\n var_val = eval(var)\n coder[var.gsub('@', '')] = var_val\n end\n end", "title": "" }, { "docid": "199e7ff43456614f759612c979392788", "score": "0.5336513", "text": "def encode_with(coder)\n vars = instance_variables.map { |x| x.to_s }\n vars = vars - [\"@current_env\"]\n\n vars.each do |var|\n var_val = eval(var)\n coder[var.gsub('@', '')] = var_val\n end\n end", "title": "" }, { "docid": "bf50cc30fd8be6f5bda8370fcae78a35", "score": "0.532522", "text": "def codes_to_binary_string(codes)\n codes = codes.sort\n unless legal_code_value?(codes.first) && legal_code_value?(codes.last)\n raise ArgumentError.new(\"All codes must be between 1 and 127: #{codes.inspect}.\")\n end\n bitmap_number = BitMapping.set_bit_position_array_to_number(codes)\n BitMapping.number_to_binary_string(bitmap_number)\n end", "title": "" }, { "docid": "58ae25406bd68162da09723f431e60a5", "score": "0.5316207", "text": "def encodeopcode(filename,address,line,symboltable,opcodereference,labelflag)\n encodedline = 0\n twentysixbitmask = 0x3FFFFFF\n sixteenbitmask = 0xFFFF\n labelflag ? opcodeelement = 1 : opcodeelement = 0\n operandelement = opcodeelement + 1\n\n encodingvalue = opcodereference[line[opcodeelement]][\"encoding\"].to_s.to_i\n opcodetype = opcodereference[line[opcodeelement]][\"type\"].to_s\n functioncode = opcodereference[line[opcodeelement]][\"functioncode\"].to_s.to_i\n\n if opcodetype == \"i\"\n case self.imap[line[opcodeelement]]\n when \"none\"\n # Do nothing. Literally.\n\n when \"number\"\n encodedline = encodingvalue\n encodedline <<= (32-6)\n operand = line[operandelement].to_i\n encodedline |= operand\n\n when \"gpr\"\n targetaddress = 0\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n destinreg = line[operandelement].gsub!(\"r\",'').to_i\n targetaddress |= destinreg\n targetaddress <<= (32 - 6 - 5)\n encodedline |= targetaddress\n\n when \"gprname\"\n pc = address.hex + 4\n targetaddress = 0\n labelelement = operandelement + 1\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n destinreg = line[operandelement].gsub!(\"r\",'').to_i\n targetaddress |= destinreg\n targetaddress <<= (32 - 6 - 5)\n encodedline |= targetaddress\n targetaddress = 0\n label = line[labelelement] + \":\"\n targetaddress |= symboltable[filename][label].hex\n targetaddress = (targetaddress - pc).to_i\n targetaddress &= sixteenbitmask\n encodedline |= targetaddress\n\n when \"gprnum\"\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n destinreg = line[operandelement].gsub!(\"r\",'').to_i\n destinreg <<= (32 - 6 - 5 - 5)\n encodedline |= destinreg\n immfield = operandelement + 1\n immediate = line[immfield].to_i\n encodedline |= immediate\n\n when \"gprgprint\"\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n destinreg = line[operandelement+1].gsub!(\"r\",'').to_i\n destinreg <<= (32 - 6 - 5)\n encodedline |= destinreg\n sourcereg = line[operandelement].gsub!(\"r\",'').to_i\n sourcereg <<= (32 - 6 - 5 - 5)\n encodedline |= sourcereg\n immelement = operandelement + 2\n immedfield = line[immelement] + \":\"\n if symboltable[filename].has_key?(immedfield)\n immediate = symboltable[filename][immedfield].hex\n else immediate = line[immelement].to_i\n end\n encodedline |= immediate\n\n when \"gprgpruint\"\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n destinreg = line[operandelement+1].gsub!(\"r\",'').to_i\n destinreg <<= (32 - 6 - 5)\n encodedline |= destinreg\n sourcereg = line[operandelement].gsub!(\"r\",'').to_i\n sourcereg <<= (32 - 6 - 5 - 5)\n encodedline |= sourcereg\n immelement = operandelement + 2\n immedfield = line[immelement] + \":\"\n if symboltable[filename].has_key?(immedfield)\n immediate = symboltable[filename][immedfield].hex\n else immediate = line[immelement].to_i\n end\n encodedline |= immediate\n\n when \"dproff\"\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n immelement = operandelement + 1\n immedfield = line[immelement] + \":\"\n if symboltable[filename].has_key?(immedfield)\n offset = symboltable[filename][immedfield].hex\n sourcereg = 0\n else\n operandpieces = line[operandelement+1].split(\"(\")\n operandpieces[1].gsub!(\"r\",'').to_i\n operandpieces[1].gsub!(\")\",'').to_i\n offset = operandpieces[0].to_i\n sourcereg = operandpieces[1].to_i\n end\n sourcereg <<= (32 - 6 - 5)\n encodedline |= sourcereg\n destinreg = line[operandelement].gsub(\"f\",'').to_i\n destinreg <<= (32 - 6 - 5 -5)\n encodedline |= destinreg\n encodedline |= offset\n\n when \"gproff\"\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n immelement = operandelement + 1\n immedfield = line[immelement] + \":\"\n if symboltable[filename].has_key?(immedfield)\n offset = symboltable[filename][immedfield].hex\n sourcereg = 0\n else\n operandpieces = line[operandelement+1].split(\"(\")\n operandpieces[1].gsub!(\"r\",'').to_i\n operandpieces[1].gsub!(\")\",'').to_i\n offset = operandpieces[0].to_i\n sourcereg = operandpieces[1].to_i\n end\n sourcereg <<= (32 - 6 - 5)\n encodedline |= sourcereg\n destinreg = line[operandelement].gsub(\"r\",'').to_i\n destinreg <<= (32 - 6 - 5 -5)\n encodedline |= destinreg\n encodedline |= offset\n\n when \"fproff\"\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n immelement = operandelement + 1\n immedfield = line[immelement] + \":\"\n if symboltable[filename].has_key?(immedfield)\n offset = symboltable[filename][immedfield].hex\n sourcereg = 0\n else\n operandpieces = line[operandelement+1].split(\"(\")\n operandpieces[1].gsub!(\"r\",'').to_i\n operandpieces[1].gsub!(\")\",'').to_i\n offset = operandpieces[0].to_i\n sourcereg = operandpieces[1].to_i\n end\n sourcereg <<= (32 - 6 - 5)\n encodedline |= sourcereg\n destinreg = line[operandelement].gsub(\"f\",'').to_i\n destinreg <<= (32 - 6 - 5 -5)\n encodedline |= destinreg\n encodedline |= offset\n\n when \"offgpr\"\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n immedfield = line[operandelement] + \":\"\n if symboltable[filename].has_key?(immedfield)\n offset = symboltable[filename][immedfield].hex\n sourcereg = 0\n else\n operandpieces = line[operandelement].split(\"(\")\n operandpieces[1].gsub!(\"r\",'').to_i\n operandpieces[1].gsub!(\")\",'').to_i\n offset = operandpieces[0].to_i\n sourcereg = operandpieces[1].to_i\n end\n sourcereg <<= (32 - 6 - 5)\n encodedline |= sourcereg\n destinreg = line[operandelement+1].gsub(\"r\",'').to_i\n destinreg <<= (32 - 6 - 5 -5)\n encodedline |= destinreg\n offset &= sixteenbitmask\n encodedline |= offset\n\n when \"offdpr\"\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n immedfield = line[operandelement] + \":\"\n if symboltable[filename].has_key?(immedfield)\n offset = symboltable[filename][immedfield].hex\n sourcereg = 0\n else\n operandpieces = line[operandelement].split(\"(\")\n operandpieces[1].gsub!(\"r\",'').to_i\n operandpieces[1].gsub!(\")\",'').to_i\n offset = operandpieces[0].to_i\n sourcereg = operandpieces[1].to_i\n end\n sourcereg <<= (32 - 6 - 5)\n encodedline |= sourcereg\n destinreg = line[operandelement+1].gsub(\"f\",'').to_i\n destinreg <<= (32 - 6 - 5 -5)\n encodedline |= destinreg\n offset &= sixteenbitmask\n encodedline |= offset\n\n when \"offfpr\"\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n immedfield = line[operandelement] + \":\"\n if symboltable[filename].has_key?(immedfield)\n offset = symboltable[filename][immedfield].hex\n sourcereg = 0\n else\n operandpieces = line[operandelement].split(\"(\")\n operandpieces[1].gsub!(\"r\",'').to_i\n operandpieces[1].gsub!(\")\",'').to_i\n offset = operandpieces[0].to_i\n sourcereg = operandpieces[1].to_i\n end\n sourcereg <<= (32 - 6 - 5)\n encodedline |= sourcereg\n destinreg = line[operandelement+1].gsub(\"f\",'').to_i\n destinreg <<= (32 - 6 - 5 -5)\n encodedline |= destinreg\n offset &= sixteenbitmask\n encodedline |= offset\n end\n\n elsif opcodetype == \"j\" && self.imap[line[opcodeelement]] == \"name\"\n\n pc = address.hex + 4\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n label = line[operandelement] + \":\"\n labeladdress = symboltable[filename][label].hex\n targetaddress = (labeladdress - pc).to_i\n targetaddress &= twentysixbitmask\n encodedline |= targetaddress\n\n # If the instruction is an rtype instruction, it gets encoded in the following section.\n elsif opcodetype == \"r\"\n case self.imap[line[opcodeelement]]\n when \"gprfpr\"\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n sourcereg1 = line[operandelement+1].gsub!(\"f\",'').to_i\n sourcereg1 <<= (32 - 6 - 5)\n encodedline |= sourcereg1\n destinreg = line[operandelement].gsub!(\"r\",'').to_i\n destinreg <<= (32 - 6 - 5 - 5 - 5)\n encodedline |= destinreg\n encodedline |= functioncode\n\n when \"dprdpr\"\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n sourcereg1 = line[operandelement+1].gsub!(\"f\",'').to_i\n if sourcereg1 % 2 != 0\n puts \"error in register operand for movd\"\n exit\n end\n sourcereg1 <<= (32 - 6 - 5)\n encodedline |= sourcereg1\n destinreg = line[operandelement].gsub!(\"f\",'').to_i\n if destinreg % 2 != 0\n puts \"error in register operand for movd\"\n exit\n end\n destinreg <<= (32 - 6 - 5 - 5 - 5)\n encodedline |= destinreg\n encodedline |= functioncode\n\n when \"fprfpr\"\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n sourcereg1 = line[operandelement+1].gsub!(\"f\",'').to_i\n sourcereg1 <<= (32 - 6 - 5)\n encodedline |= sourcereg1\n destinreg = line[operandelement].gsub!(\"f\",'').to_i\n destinreg <<= (32 - 6 - 5 - 5 - 5)\n encodedline |= destinreg\n encodedline |= functioncode\n\n when \"fprgpr\"\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n sourcereg1 = line[operandelement+1].gsub!(\"r\",'').to_i\n sourcereg1 <<= (32 - 6 - 5)\n encodedline |= sourcereg1\n destinreg = line[operandelement].gsub!(\"f\",'').to_i\n destinreg <<= (32 - 6 - 5 - 5 - 5)\n encodedline |= destinreg\n encodedline |= functioncode\n\n when \"fprdpr\"\n newpiece = 0\n encodedline |= encodingvalue\n encodedline <<= (32 - 6)\n sourcereg1 = line[operandelement+1].gsub!(\"f\",'').to_i\n sourcereg1 <<= (32 - 6 - 5)\n encodedline |= sourcereg1\n destinreg = line[operandelement].gsub!(\"f\",'').to_i\n destinreg <<= (32 - 6 - 5 - 5 - 5)\n encodedline |= destinreg\n encodedline |= functioncode\n\n when \"dprfpr\"\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n sourcereg1 = line[operandelement+1].gsub!(\"f\",'').to_i\n sourcereg1 <<= (32 - 6 - 5)\n encodedline |= sourcereg1\n destinreg = line[operandelement].gsub!(\"f\",'').to_i\n destinreg <<= (32 - 6 - 5 - 5 - 5)\n encodedline |= destinreg\n encodedline |= functioncode\n\n when \"gprgprgpr\"\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n sourcereg1 = line[operandelement+1].gsub!(\"r\",'').to_i\n sourcereg1 <<= (32 - 6 - 5)\n encodedline |= sourcereg1\n sourcereg2 = line[operandelement+2].gsub!(\"r\",'').to_i\n sourcereg2 <<= (32 - 6 - 5 - 5)\n encodedline |= sourcereg2\n destinreg = line[operandelement].gsub!(\"r\",'').to_i\n destinreg <<= (32 - 6 - 5 - 5 - 5)\n encodedline |= destinreg\n encodedline |= functioncode\n\n when \"dprdprdpr\"\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n sourcereg1 = line[operandelement+1].gsub!(\"f\",'').to_i\n sourcereg1 <<= (32 - 6 - 5)\n encodedline |= sourcereg1\n sourcereg2 = line[operandelement+2].gsub!(\"f\",'').to_i\n sourcereg2 <<= (32 - 6 - 5 - 5)\n encodedline |= sourcereg2\n destinreg = line[operandelement].gsub!(\"f\",'').to_i\n destinreg <<= (32 - 6 - 5 - 5 - 5)\n encodedline |= destinreg\n encodedline |= functioncode\n\n when \"fprfprfpr\"\n encodedline = encodingvalue\n encodedline <<= (32 - 6)\n sourcereg1 = line[operandelement+1].gsub!(\"f\",'').to_i\n sourcereg1 <<= (32 - 6 - 5)\n encodedline |= sourcereg1\n sourcereg2 = line[operandelement+2].gsub!(\"f\",'').to_i\n sourcereg2 <<= (32 - 6 - 5 - 5)\n encodedline |= sourcereg2\n destinreg = line[operandelement].gsub!(\"f\",'').to_i\n destinreg <<= (32 - 6 - 5 - 5 - 5)\n encodedline |= destinreg\n encodedline |= functioncode\n end\n end\n encodedline\n end", "title": "" }, { "docid": "8bdcc5b035b958453937329de8597481", "score": "0.53059685", "text": "def encode(value)\n raise \"@type.fits?(value)\" unless @type.fits?(value)\n (value << @shamt) & mask\n end", "title": "" }, { "docid": "ce4c9d12a504f08e8e42359e96d5af12", "score": "0.52996975", "text": "def encode(*); self; end", "title": "" }, { "docid": "b504a6b87883a4c014b0e39a0d910ec3", "score": "0.52853125", "text": "def coder; end", "title": "" }, { "docid": "b504a6b87883a4c014b0e39a0d910ec3", "score": "0.52853125", "text": "def coder; end", "title": "" }, { "docid": "b504a6b87883a4c014b0e39a0d910ec3", "score": "0.52853125", "text": "def coder; end", "title": "" }, { "docid": "b504a6b87883a4c014b0e39a0d910ec3", "score": "0.52853125", "text": "def coder; end", "title": "" }, { "docid": "b504a6b87883a4c014b0e39a0d910ec3", "score": "0.52853125", "text": "def coder; end", "title": "" }, { "docid": "b504a6b87883a4c014b0e39a0d910ec3", "score": "0.52853125", "text": "def coder; end", "title": "" }, { "docid": "b504a6b87883a4c014b0e39a0d910ec3", "score": "0.52853125", "text": "def coder; end", "title": "" }, { "docid": "0c49e93538fdefef767b793ad2871b08", "score": "0.5277389", "text": "def add_expression_result_escaped(code); end", "title": "" }, { "docid": "0c49e93538fdefef767b793ad2871b08", "score": "0.5277389", "text": "def add_expression_result_escaped(code); end", "title": "" }, { "docid": "0c49e93538fdefef767b793ad2871b08", "score": "0.5277389", "text": "def add_expression_result_escaped(code); end", "title": "" }, { "docid": "ad467c0878f4c4eb284da112691f8ffb", "score": "0.5268995", "text": "def assemble\n code = []\n @_lines.each do |line|\n case line[0]\n when :code\n mnemonic, mode, value, comment = line[1..4]\n size = mode_size(mode)\n code << opcode(mnemonic, mode).value\n code << value % 256 if size > 1\n code << value / 256 if size > 2\n end\n end\n code\n end", "title": "" }, { "docid": "b8730a550f40042c2a3adbe74cbce036", "score": "0.52670926", "text": "def codes= c\n @codehistory << @codes if @codes\n if c.nil?\n @codes = nil\n return nil\n end\n\n if( c.is_a? Array) or (c.is_a? Range)\n @codes = c.to_a\n else\n @codes = c.split(//)\n end\n\n return @codes\n end", "title": "" }, { "docid": "ac776c942854eaba65c9a8aec8fdaad3", "score": "0.526024", "text": "def burst_encode\n # encode('Hola')\n encode(text_to_encode)\n end", "title": "" }, { "docid": "ac1052e9e4cc149b08a7d00f0a788a31", "score": "0.52531874", "text": "def to_code\n \"(#{@condition.to_code} ? (#{@x.to_code}) : (#{@y.to_code}))\"\n end", "title": "" }, { "docid": "b55cf51588de7c0e4acbefb6f7de67ca", "score": "0.52484167", "text": "def to_code\n \"((#{@lower.to_code} #{@lower_cond} (#{@x.to_code})) and ((#{@x.to_code}) #{@upper_cond} #{@upper.to_code}))\"\n end", "title": "" }, { "docid": "aaa8279fd95b55ee7c3a034582dd048e", "score": "0.52480763", "text": "def encode(code, lang, options = T.unsafe(nil)); end", "title": "" }, { "docid": "c507a485b1b8136390a8b0289b4c540c", "score": "0.52317244", "text": "def vlq_encode_mappings(ary); end", "title": "" }, { "docid": "85ad584c7e2db610cacaf0d5e15ffb51", "score": "0.5230337", "text": "def encode(elev)\n\n values = {\n elev_010: \"a\",\n elev_020: \"b\",\n elev_030: \"c\",\n elev_040: \"d\",\n elev_050: \"e\",\n elev_060: \"f\",\n elev_070: \"g\",\n elev_080: \"h\",\n elev_090: \"i\",\n elev_100: \"j\",\n elev_110: \"k\",\n elev_120: \"l\",\n elev_130: \"m\",\n elev_140: \"n\",\n water_010: \"A\",\n water_020: \"B\",\n water_030: \"C\",\n water_040: \"D\",\n water_050: \"E\",\n water_060: \"F\",\n water_070: \"G\",\n water_080: \"H\",\n water_090: \"I\",\n water_100: \"J\",\n water_110: \"K\",\n water_120: \"L\",\n water_130: \"M\",\n water_140: \"N\",\n water: \"A\",\n zone: \"Z\" }\n ch = values.fetch(elev,:no_data)\n ch = \"x\" if ch == :no_data\n ch = \"A\" if ch.between?(\"A\",\"N\") && SHOW_WATER == :solid\n ch\n end", "title": "" }, { "docid": "dcbf75004bcd434a91d2ca6989dfd98a", "score": "0.5225816", "text": "def runtime_encoding(arr)\n\nend", "title": "" }, { "docid": "39cad6cf03e4622e478f5be0aa1e8a4f", "score": "0.52127904", "text": "def encoded; end", "title": "" }, { "docid": "39cad6cf03e4622e478f5be0aa1e8a4f", "score": "0.52127904", "text": "def encoded; end", "title": "" }, { "docid": "d03746af811dc1c3295415dbdca64001", "score": "0.52116543", "text": "def to_s\n\t\t@code\n\tend", "title": "" }, { "docid": "82f2866994daccf8f1d0b833ede23901", "score": "0.52107537", "text": "def codes\n [code]\n end", "title": "" }, { "docid": "ab058fec72472aae7aef2866ae050a86", "score": "0.5205256", "text": "def encode(code, lang, format, options = T.unsafe(nil)); end", "title": "" }, { "docid": "2394dd0c44cf64d0ccecf9bfaeeff516", "score": "0.51947886", "text": "def encode(data)\r\n @encode.call(data)\r\n end", "title": "" }, { "docid": "a10072361b5f0dc6c6a43171b0fedeb2", "score": "0.5167823", "text": "def coder\n @coder ||= HTMLEntities.new\n end", "title": "" }, { "docid": "995b60182f1d7b660b8596a97edf4990", "score": "0.51630825", "text": "def encode_istate(state)\n state.transform_values(&:to_json)\n end", "title": "" }, { "docid": "52a31fde18a88d93ea184af9e75211df", "score": "0.51627123", "text": "def code\n actualize\n @code\n end", "title": "" }, { "docid": "e7128c623eada4779a8509f9a961d358", "score": "0.51617676", "text": "def add_expression(indicator, code); end", "title": "" }, { "docid": "e7128c623eada4779a8509f9a961d358", "score": "0.51617676", "text": "def add_expression(indicator, code); end", "title": "" }, { "docid": "e7128c623eada4779a8509f9a961d358", "score": "0.51617676", "text": "def add_expression(indicator, code); end", "title": "" }, { "docid": "6f8737871b4d595388dff4c5fca7b1ae", "score": "0.51199394", "text": "def encoder; end", "title": "" }, { "docid": "6f8737871b4d595388dff4c5fca7b1ae", "score": "0.51199394", "text": "def encoder; end", "title": "" }, { "docid": "306881b7ae28eb28afc872fe934adc9f", "score": "0.5114221", "text": "def encode(data)\r\n data\r\n end", "title": "" }, { "docid": "e23b64e41402cc45fe51ddac49cf1b87", "score": "0.5113016", "text": "def encode( ary = [] )\n ary_b = \"\"\n ary.each { |v|\n i_b = v.to_i.abs.to_bin( @nbit )\n # how to encode the sign: the first bit is 0 if i_b is >= 0, and 1 if it's < 0\n v.to_i >= 0 ? i_b[0] = \"0\" : i_b[0] = \"1\"\n d_b = ( ( (v-v.to_i)/@cfg[:tol] ).to_i.abs ).to_bin( @nbit )\n ary_b += i_b+d_b\n }\n return ary_b\n end", "title": "" }, { "docid": "f9160df1f75acead5e6da40ca7677ceb", "score": "0.51112217", "text": "def encode(value)\n value\n end", "title": "" }, { "docid": "8ed30558c95361442a8ebc493139216d", "score": "0.5107834", "text": "def to_code\n \"Math::exp(#{@x.to_code})\"\n end", "title": "" }, { "docid": "51bd234be36bca82c5906b71923089ba", "score": "0.51072586", "text": "def register_coder(coder); end", "title": "" }, { "docid": "580b0afae2caa21d6ac99f5370d5538e", "score": "0.50979817", "text": "def code_to_s\n @code = @code.to_s\n end", "title": "" }, { "docid": "9e56fc6f04d6ee9c94d8b1df503f1d31", "score": "0.50962347", "text": "def encode(value)\n _encode(value)\n end", "title": "" }, { "docid": "47e3cc6593f28fced2b23bbadb55aed6", "score": "0.50809705", "text": "def vlq_encode(ary); end", "title": "" } ]
1900059fce3c62ce933fd145ebb1d3a5
Lists PlayerStreamerInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning.
[ { "docid": "1fce18446c7daef2d7bcaaf81fab08e3", "score": "0.0", "text": "def list(order: T.unsafe(nil), status: T.unsafe(nil), limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" } ]
[ { "docid": "a9c66823cc6063f85623f1ea34d13e1b", "score": "0.71183115", "text": "def list(limit: nil, page_size: nil)\n self.stream(limit: limit, page_size: page_size).entries\n end", "title": "" }, { "docid": "a9c66823cc6063f85623f1ea34d13e1b", "score": "0.71183115", "text": "def list(limit: nil, page_size: nil)\n self.stream(limit: limit, page_size: page_size).entries\n end", "title": "" }, { "docid": "a9c66823cc6063f85623f1ea34d13e1b", "score": "0.71183115", "text": "def list(limit: nil, page_size: nil)\n self.stream(limit: limit, page_size: page_size).entries\n end", "title": "" }, { "docid": "abb9375dde8fc6999d1dc28f5cc0660a", "score": "0.70980304", "text": "def list(limit: nil, page_size: nil)\n self.stream(limit: limit, page_size: page_size).entries\n end", "title": "" }, { "docid": "7a211a28dfc09c63fea189d827e31c6f", "score": "0.70955646", "text": "def list(limit: nil, page_size: nil)\n self.stream(limit: limit, page_size: page_size).entries\n end", "title": "" }, { "docid": "381534b6f492b042a0e1ff81da627e9c", "score": "0.69365335", "text": "def list(limit: nil, page_size: nil)\n self.stream(\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "381534b6f492b042a0e1ff81da627e9c", "score": "0.69365335", "text": "def list(limit: nil, page_size: nil)\n self.stream(\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "381534b6f492b042a0e1ff81da627e9c", "score": "0.69365335", "text": "def list(limit: nil, page_size: nil)\n self.stream(\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "381534b6f492b042a0e1ff81da627e9c", "score": "0.69365335", "text": "def list(limit: nil, page_size: nil)\n self.stream(\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "381534b6f492b042a0e1ff81da627e9c", "score": "0.69365335", "text": "def list(limit: nil, page_size: nil)\n self.stream(\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "381534b6f492b042a0e1ff81da627e9c", "score": "0.69365335", "text": "def list(limit: nil, page_size: nil)\n self.stream(\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "381534b6f492b042a0e1ff81da627e9c", "score": "0.69365335", "text": "def list(limit: nil, page_size: nil)\n self.stream(\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "381534b6f492b042a0e1ff81da627e9c", "score": "0.69365335", "text": "def list(limit: nil, page_size: nil)\n self.stream(\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "381534b6f492b042a0e1ff81da627e9c", "score": "0.69365335", "text": "def list(limit: nil, page_size: nil)\n self.stream(\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "381534b6f492b042a0e1ff81da627e9c", "score": "0.69365335", "text": "def list(limit: nil, page_size: nil)\n self.stream(\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "381534b6f492b042a0e1ff81da627e9c", "score": "0.69365335", "text": "def list(limit: nil, page_size: nil)\n self.stream(\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "1367c3059f407b175d20294ef7a679b4", "score": "0.6682996", "text": "def list(friendly_name: :unset, limit: nil, page_size: nil)\n self.stream(friendly_name: friendly_name, limit: limit, page_size: page_size).entries\n end", "title": "" }, { "docid": "5b4943330c1d56f38368efb1716c2a13", "score": "0.6619771", "text": "def list(friendly_name: :unset, limit: nil, page_size: nil)\n self.stream(\n friendly_name: friendly_name,\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "5b4943330c1d56f38368efb1716c2a13", "score": "0.6619771", "text": "def list(friendly_name: :unset, limit: nil, page_size: nil)\n self.stream(\n friendly_name: friendly_name,\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "19491bfadf118e7d3a69f2355fecead4", "score": "0.6463751", "text": "def list(muted: nil, limit: nil, page_size: nil)\n self.stream(\n muted: muted,\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "ae1fd4f9596ae50077a31a912ba64601", "score": "0.6417237", "text": "def list(limit = 50, offset = 0)\n Lister.new(self).list(limit, offset)\n end", "title": "" }, { "docid": "2a650b7d1de3467aa2389f6cde24f740", "score": "0.63577354", "text": "def list(friendly_name: :unset, status: :unset, limit: nil, page_size: nil)\n self.stream(\n friendly_name: friendly_name,\n status: status,\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "2190c21df0d8b3a44e1f87efc2612b92", "score": "0.62797457", "text": "def list(type: :unset, limit: nil, page_size: nil)\n self.stream(\n type: type,\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "4b633ee055b22d0f1cc48311891289a3", "score": "0.6128775", "text": "def list(muted: :unset, hold: :unset, limit: nil, page_size: nil)\n self.stream(muted: muted, hold: hold, limit: limit, page_size: page_size).entries\n end", "title": "" }, { "docid": "05a22deecc5326d6a8a15547a18e0eb6", "score": "0.6020594", "text": "def tracks(limit: 100, offset: 0)\n last_track = offset + limit - 1\n if @tracks_cache && last_track < 100\n return @tracks_cache[offset..last_track]\n end\n\n url = \"users/#{@owner.id}/playlists/#{@id}/tracks\" \\\n \"?limit=#{limit}&offset=#{offset}\"\n\n json = if users_credentials && users_credentials[@owner.id]\n User.oauth_get(@owner.id, url)\n else\n RSpotify.auth_get(url)\n end\n\n tracks = json['items'].map { |i| Track.new i['track'] }\n @tracks_cache = tracks if limit == 100 && offset == 0\n tracks\n end", "title": "" }, { "docid": "f687e702d9bb719291ce53cfccdac547", "score": "0.5986518", "text": "def list\n with_error_handling do\n receipes = client.entries(\n DEFAULT_OPTIONS.merge(\n skip: skip,\n limit: limit\n )\n )\n transform_data(receipes)\n end\n end", "title": "" }, { "docid": "1aa2fc3dd43f2a5feaebaade0204ca87", "score": "0.5984875", "text": "def list(sink_sid: T.unsafe(nil), limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "a545d5bfb43114ac009dbeded975ce13", "score": "0.593746", "text": "def stream(friendly_name: :unset, limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(\n friendly_name: friendly_name,\n page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "a545d5bfb43114ac009dbeded975ce13", "score": "0.59370553", "text": "def stream(friendly_name: :unset, limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(\n friendly_name: friendly_name,\n page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "a56f4ba12c2ca6d8b377230171d3a1c5", "score": "0.5911436", "text": "def stream(friendly_name: :unset, status: :unset, limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(\n friendly_name: friendly_name,\n status: status,\n page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "5bb2759d5413790d7631343628442bba", "score": "0.58746874", "text": "def limit_records(records)\n \n records.slice(offset, limit)\n \n end", "title": "" }, { "docid": "30fcec8d167650209d190ab5397b8105", "score": "0.586824", "text": "def stream(friendly_name: :unset, limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(friendly_name: friendly_name, page_size: limits[:page_size],)\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "bedf3b7c428ce9c9501892cb8292e4d2", "score": "0.5867475", "text": "def list(redacted: :unset, limit: nil, page_size: nil)\n self.stream(\n redacted: redacted,\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "c4f7da0e591e7673ae2afc6ae4f7bb6f", "score": "0.58485943", "text": "def list(order: :unset, status: :unset, limit: nil, page_size: nil)\n self.stream(order: order, status: status, limit: limit, page_size: page_size).entries\n end", "title": "" }, { "docid": "7b0193f64469f609c1b17b4fd8f09b67", "score": "0.5807623", "text": "def stream(limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(page_size: limits[:page_size],)\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "202b279522ea1069ec1fca1514144381", "score": "0.57942", "text": "def list(call_sid: nil, limit: nil, page_size: nil)\n self.stream(\n call_sid: call_sid,\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "cce7ddc01e4b2f5cd4dcf437468abe3d", "score": "0.57887846", "text": "def list(enabled: :unset, date_created_after: :unset, date_created_before: :unset, limit: nil, page_size: nil)\n self.stream(\n enabled: enabled,\n date_created_after: date_created_after,\n date_created_before: date_created_before,\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "9c423e0f6ce6e90a6a9fca117ad380d9", "score": "0.57870543", "text": "def stream(limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(\n page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "9c423e0f6ce6e90a6a9fca117ad380d9", "score": "0.57870543", "text": "def stream(limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(\n page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "9c423e0f6ce6e90a6a9fca117ad380d9", "score": "0.57870543", "text": "def stream(limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(\n page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "9c423e0f6ce6e90a6a9fca117ad380d9", "score": "0.57870543", "text": "def stream(limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(\n page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "9c423e0f6ce6e90a6a9fca117ad380d9", "score": "0.57870543", "text": "def stream(limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(\n page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "9c423e0f6ce6e90a6a9fca117ad380d9", "score": "0.57870543", "text": "def stream(limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(\n page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "9c423e0f6ce6e90a6a9fca117ad380d9", "score": "0.57870543", "text": "def stream(limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(\n page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "9c423e0f6ce6e90a6a9fca117ad380d9", "score": "0.57870543", "text": "def stream(limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(\n page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "9c423e0f6ce6e90a6a9fca117ad380d9", "score": "0.57870543", "text": "def stream(limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(\n page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "9c423e0f6ce6e90a6a9fca117ad380d9", "score": "0.57870543", "text": "def stream(limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(\n page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "9c423e0f6ce6e90a6a9fca117ad380d9", "score": "0.57870543", "text": "def stream(limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(\n page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "5f3a26b5ece79253b52ce9e6c76c5418", "score": "0.57832956", "text": "def stream(limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(page_size: limits[:page_size],)\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "d44c393384fb597fb1aec65bea3c5aa5", "score": "0.5779182", "text": "def stream(limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "d44c393384fb597fb1aec65bea3c5aa5", "score": "0.5779182", "text": "def stream(limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "61a5f7c0cc65667cc002345332fe49d3", "score": "0.57726026", "text": "def stream(limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "title": "" }, { "docid": "7b1f13d66f1ead441a60531a944d5aab", "score": "0.5750411", "text": "def list(offset = 0, limit = 100)\n api.get('', offset: offset, limit: limit)\n end", "title": "" }, { "docid": "7b1f13d66f1ead441a60531a944d5aab", "score": "0.5750411", "text": "def list(offset = 0, limit = 100)\n api.get('', offset: offset, limit: limit)\n end", "title": "" }, { "docid": "7b1f13d66f1ead441a60531a944d5aab", "score": "0.5750411", "text": "def list(offset = 0, limit = 100)\n api.get('', offset: offset, limit: limit)\n end", "title": "" }, { "docid": "7b1f13d66f1ead441a60531a944d5aab", "score": "0.5750411", "text": "def list(offset = 0, limit = 100)\n api.get('', offset: offset, limit: limit)\n end", "title": "" }, { "docid": "7b1f13d66f1ead441a60531a944d5aab", "score": "0.5750411", "text": "def list(offset = 0, limit = 100)\n api.get('', offset: offset, limit: limit)\n end", "title": "" }, { "docid": "f06d3130175a09fe784d0e6e2b460aa5", "score": "0.5743112", "text": "def all(options = {}, &block)\n return @query.connection.accumulate(\n :path => 'streams',\n :json => 'streams',\n :create => -> hash { Stream.new(hash, @query) },\n :limit => options[:limit],\n :offset => options[:offset],\n &block\n )\n end", "title": "" }, { "docid": "906e430e9072ebc0257ec649039b4eb9", "score": "0.5733627", "text": "def list_records(opts={})\n do_resumable(OAI::ListRecordsResponse, 'ListRecords', opts)\n end", "title": "" }, { "docid": "8a4c05333b2d50ed1b5a9a04a202733e", "score": "0.57252216", "text": "def index\n limit = (params[:limit] || 25).to_i\n @plays = Play.includes(:artist, :song, :album).limit(limit)\n end", "title": "" }, { "docid": "b2317010aa8741259193cdff3f9b12e4", "score": "0.570292", "text": "def list(date_created_after: :unset, date_created_before: :unset, track: :unset, publisher: :unset, kind: :unset, limit: nil, page_size: nil)\n self.stream(\n date_created_after: date_created_after,\n date_created_before: date_created_before,\n track: track,\n publisher: publisher,\n kind: kind,\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "fb2a6e557acc22441eb09a7526c65e24", "score": "0.56134295", "text": "def list(identity: :unset, address: :unset, limit: nil, page_size: nil)\n self.stream(\n identity: identity,\n address: address,\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "dfe492bcad9c0dd76974819339fdd913", "score": "0.5608702", "text": "def list\n @activities = Activity.limit(14)\n end", "title": "" }, { "docid": "4897faddff6bbfa12fbb0fbee2733b72", "score": "0.56053776", "text": "def history(limit=10, override_opts={})\n request = {\n method: :get,\n http_path: \"/v1/me/player/recently-played\",\n keys: %i[items],\n limit: limit\n }\n\n send_multiple_http_requests(request, override_opts).map do |item|\n Spotify::SDK::Item.new(item, self)\n end\n end", "title": "" }, { "docid": "1a8b96233aa88a1a9897914fcc0650c6", "score": "0.5591154", "text": "def fetch_playlists\n Excon.get(\n \"https://api.spotify.com/v1/me/playlists?limit=50\",\n headers: {\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json\",\n \"Authorization\" => \"Bearer #{@access_token}\"\n }\n )\n end", "title": "" }, { "docid": "85e5bb0ec416b6badf98f6a2fe8c5c4a", "score": "0.5586193", "text": "def list_records(options = {})\n Response::ListRecords.new(provider_context, options).to_xml\n end", "title": "" }, { "docid": "9526fa93f28df05f3fadeadeb3426ca5", "score": "0.5575372", "text": "def get_all(limit = 20)\n uri = '/api/v1/pulses/activity'\n params = {limit: limit}\n pulses = []\n begin\n json_data = get(uri, params)\n page = json_data['next']\n\n params = URI::decode_www_form(URI(page).query).to_h unless page.nil?\n\n pulses += json_data['results']\n end while page && !json_data['results'].empty?\n\n results = []\n pulses.each do |pulse|\n results << OTX::Pulse.new(pulse)\n end\n\n return results\n end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.55739367", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.55739367", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.55739367", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.55739367", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.55739367", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.55739367", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.55739367", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573623", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573623", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573623", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573623", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573623", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573623", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573623", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573271", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573271", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573271", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573271", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573271", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573271", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573271", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573271", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573271", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573271", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5573271", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.55727106", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.55727106", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.55727106", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.55727106", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.55727106", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5572545", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5572545", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5572545", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "7367086ad9ef7e64143cbc29f0dc00e8", "score": "0.5572545", "text": "def list(limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" } ]
d6302d00676c767636834c299db10498
Returns the IndexedDirectory in which the Document is included. Returns nil if no corresponding dir is found.
[ { "docid": "1a2f7f2f9dfdf741abadeeb48d6141b1", "score": "0.7279886", "text": "def indexed_directory\n Picolena::IndexedDirectories.keys.find{|indexed_dir|\n dirname.starts_with?(indexed_dir)\n }\n end", "title": "" } ]
[ { "docid": "a905ba9f8fdab23356d8b981cf37c325", "score": "0.6587496", "text": "def directory_index\n @directory_index = @hash.fetch(\"DirectoryIndex\")\n return @directory_index\n end", "title": "" }, { "docid": "a6b21096ff3c7b76ff30f0436128b528", "score": "0.62946534", "text": "def directory_document\n return @directory_document ||= (begin\n response = self.execute!(\n :http_method => :get,\n :uri => self.directory_uri,\n :authenticated => false\n )\n response.data\n end)\n end", "title": "" }, { "docid": "70f662b57d5b37a31813abb7c404103d", "score": "0.60271126", "text": "def directory_index\n if (@directory_index == nil)\n read_http_config\n end\n return @directory_index\n end", "title": "" }, { "docid": "ff813f2d41fec30e80a19b9631fda2e4", "score": "0.58509547", "text": "def getAnalyzedRecordedDir\n return @MusicMasterConf[:Directories][:AnalyzeRecord]\n end", "title": "" }, { "docid": "1c59cdeb0c4e3918a98a9695fb2a9ad6", "score": "0.5783093", "text": "def directory\n self.directory? ? self : self.dirname\n end", "title": "" }, { "docid": "b4d136c35fc6443606041b2074244614", "score": "0.57650745", "text": "def ifs_getDir(p, miqfs = nil)\n $log.debug \"NTFS.ifs_getDir >> p=#{p}\" if $log && $log.debug?\n\n # If this is being called from a FileObject instance, then MiqFS owns contained instance members.\n # If this is being called from an NTFS module method, then self owns contained instance members.\n miqfs = self if miqfs.nil?\n\n # Wack leading drive.\n p = unnormalizePath(p).downcase\n\n # Get an array of directory names, kill off the first (it's always empty).\n names = p.split(/[\\\\\\/]/)\n names.shift\n\n # Get the index for this directory\n index = ifs_getIndex(names, miqfs)\n $log.debug \"NTFS.ifs_getDir << #{index.nil? ? \"Directory not found \" : \"\"}p=#{p}\" if $log && $log.debug?\n index\n end", "title": "" }, { "docid": "034e089665aa3a1954d31ecfab55d611", "score": "0.57320064", "text": "def directory_document\n return @directory_document ||= (begin\n request_uri = self.directory_uri\n request = ['GET', request_uri, [], []]\n response = self.transmit_request(request)\n status, headers, body = response\n if status == 200 # TODO(bobaman) Better status code handling?\n merged_body = StringIO.new\n body.each do |chunk|\n merged_body.write(chunk)\n end\n merged_body.rewind\n JSON.parse(merged_body.string)\n else\n raise TransmissionError,\n \"Could not retrieve discovery document at: #{request_uri}\"\n end\n end)\n end", "title": "" }, { "docid": "7a50f907de8fde4bb2be507c4f2d16a6", "score": "0.56950444", "text": "def directory\n # concatenate relative path to root_path\n dir, base = (self.class.root_path + permalink.gsub(/^\\//, '')).split\n normalized = base.to_s.upcase\n\n match = nil\n dir.find do |path|\n if path.basename.to_s.dasherize.upcase == normalized\n match = path\n Find.prune # stop find\n end\n end\n @directory ||= match\n rescue Errno::ENOENT => e\n nil\n end", "title": "" }, { "docid": "f24e7e714f1cbe242d96d6739e0f706f", "score": "0.56875324", "text": "def docdir\n @docdir ||= File.join home, \"doc\"\n end", "title": "" }, { "docid": "c118b2b34c9004736936aa881c68d829", "score": "0.56863654", "text": "def dir\n @dir ||= directory? ? path : File.dirname(path)\n end", "title": "" }, { "docid": "93679222525778331d4f8f39a93e5f18", "score": "0.56668603", "text": "def get_directory\n connection.directories.get(directory_name)\n end", "title": "" }, { "docid": "818b1b247a868d5aebc0cb3b2d5a8ef4", "score": "0.5665618", "text": "def paths\n defined?(@doc_dir) ? [ @doc_dir ] : nil\n end", "title": "" }, { "docid": "9447e03332f4a671691cf8c8adbe0e52", "score": "0.5656983", "text": "def dir\n if dirs \n File::SEPARATOR + File.join(*dirs)\n else\n nil\n end\n end", "title": "" }, { "docid": "e0ec06b7cc7ec9af9c247bf33a07d026", "score": "0.56441706", "text": "def get_file_directory\n return @directory\n end", "title": "" }, { "docid": "2913089b179fe55607443cc127a0a8ca", "score": "0.562968", "text": "def find_single_directory\n roots = (@droplet.root + '*').glob.select(&:directory?)\n roots.size == 1 ? roots.first : nil\n end", "title": "" }, { "docid": "be1a593fc06b99d78b61412413a05a10", "score": "0.561763", "text": "def directory\n @directory.path\n end", "title": "" }, { "docid": "86f4e2e8eee11ef152faeb86f9ed1bd6", "score": "0.55673015", "text": "def dir\n self\n end", "title": "" }, { "docid": "df42b7ebde0b8d0aeb79a20f07e03654", "score": "0.55360985", "text": "def directory\n @directory\n end", "title": "" }, { "docid": "ad05ddb93fca2f31a9f5f8bff4c8ebe9", "score": "0.5535788", "text": "def dir\n if dirs\n if relative?\n File.join(*dirs)\n else\n File.join(\"\", *dirs)\n end\n else\n nil\n end\n end", "title": "" }, { "docid": "d4c93d26493070eea6a36f0a18d5d06a", "score": "0.5526072", "text": "def directory\n @directory\n end", "title": "" }, { "docid": "d4c93d26493070eea6a36f0a18d5d06a", "score": "0.5526072", "text": "def directory\n @directory\n end", "title": "" }, { "docid": "a089f0082873291997e4f595191a4891", "score": "0.5522205", "text": "def directory\n @directory\n end", "title": "" }, { "docid": "0fd8497ee44614980ac5eed1ce946793", "score": "0.5509879", "text": "def dir\r\n raise \"dir not set\" unless @dir\r\n @dir\r\n end", "title": "" }, { "docid": "001e64c3a08c7fdd687e6a1243c74a03", "score": "0.54671365", "text": "def get_dir; @dir; end", "title": "" }, { "docid": "0a8df81ad7a67e8add33eb657e815eea", "score": "0.54641974", "text": "def getWaveDir\n return @MusicMasterConf[:Directories][:Wave]\n end", "title": "" }, { "docid": "0545a2fc4617af701b1c72cd0eed5183", "score": "0.54615843", "text": "def dirname\n @dirname || DEFAULT_DIRNAME\n end", "title": "" }, { "docid": "9fea714d717479a687f048485183f5b8", "score": "0.54524755", "text": "def __DIR__(file=nil)\n if file\n Dir.glob(File.join(File.dirname(@_file), file)).first || file\n else\n File.dirname(@_file)\n end\n end", "title": "" }, { "docid": "15074f5f34e53baf55145649353187c6", "score": "0.5411884", "text": "def directory_structure\n @directory_structure\n end", "title": "" }, { "docid": "a47e52b5f2e7d72401f10efe0302a5ff", "score": "0.5411692", "text": "def wd2dir(n)\n\t\tarr = @wds.find { |dir, wd| wd == n }\n\t\treturn nil if arr.empty?\n\t\treturn arr[0]\n\tend", "title": "" }, { "docid": "e317ec40540134306af7565954eac61a", "score": "0.54050666", "text": "def directory\n Webdav::Directory.new(self)\n end", "title": "" }, { "docid": "0defe7325e3306f7cc9a4ab200f467da", "score": "0.5403305", "text": "def dir\n File.dirname(complete_path)\n end", "title": "" }, { "docid": "a4d6ec21e232f3fab74ddbb906b69013", "score": "0.53922856", "text": "def dir\n nil\n end", "title": "" }, { "docid": "8440db5d6885d853070e9b463917557f", "score": "0.5381898", "text": "def directory\n @directory ||= workdir\n end", "title": "" }, { "docid": "050015fa1697f0d36417df057a3569f4", "score": "0.53695637", "text": "def dir_path\n Index.virtual_parent_dir_for(filename,false) || path.sub(/\\/[^\\/]+\\Z/m,'')\n end", "title": "" }, { "docid": "1c36e43a180e912fe8158776cff5d5c9", "score": "0.5368188", "text": "def directory_scope\n return @directory_scope\n end", "title": "" }, { "docid": "1c36e43a180e912fe8158776cff5d5c9", "score": "0.5368188", "text": "def directory_scope\n return @directory_scope\n end", "title": "" }, { "docid": "077defb313580636034b3cacc54dbeef", "score": "0.53535074", "text": "def folder\n return nil if self[:folder].pointer.address.zero?\n self[:folder]\n end", "title": "" }, { "docid": "6a33d5057a6d6e385581cae88003dc61", "score": "0.53312564", "text": "def subdirectory\n Digest::MD5.hexdigest(@doc_id)[0..(STORAGE_SUBDIRECTORY_LENGTH-1)]\n end", "title": "" }, { "docid": "15f3c1a64d67f563f13afd905d8f0e8e", "score": "0.530551", "text": "def dir_path\n self.get_metadata if @is_dir.blank?\n self.is_dir ? @path : File.dirname(@path)\n end", "title": "" }, { "docid": "69d6b23611329dd73bf80f7d972d76cd", "score": "0.5293927", "text": "def get_dir\n\t\t$logger.info \"Called get_dir.\"\n\t\ttotal = 0\n\t\[email protected]_pair do |dir, count |\n\t\t\ttotal += count\n\t\tend\n\n\t\tselect = rand( total ) + 1\n\t\t$logger.info \"Total #{ total }, select #{ select}.\"\n\n\t\ttotal = 0\n\t\[email protected]_pair do |dir, count |\n\t\t\ttotal += count\n\t\t\treturn dir if total >= select\n\t\tend\n\n\t\tnil\n\tend", "title": "" }, { "docid": "43eb0f15c5bb3e751de6c25ba4d49bac", "score": "0.52903515", "text": "def dir_entry(filename)\n @entries.each do |dentry|\n full_dentry_filename = dentry.extension.length > 0 ? \"#{dentry.filename}.#{dentry.extension}\".downcase : dentry.filename.downcase\n return dentry if dentry.type == :directory and filename.downcase == full_dentry_filename\n end\n\n nil\n end", "title": "" }, { "docid": "56d939f347e19161faf614b16743accd", "score": "0.52778167", "text": "def directory\n if @directory.nil?\n if not self.state.directory.nil?\n @directory = Directory::new(self.state.directory)\n else\n @directory = Configuration::find_path(::File.dirname(@path.to_s))\n end\n \n if @directory.nil?\n raise Exception::new(\"File from directory which isn't covered by rb.rotate found: \" << @path.to_s << \".\")\n end\n end\n \n return @directory\n end", "title": "" }, { "docid": "d3c6e9dfc0417dab43cf67dd9edda0fb", "score": "0.52618426", "text": "def subdirectory\n nil\n end", "title": "" }, { "docid": "e67de9cf5e6330248fb357595345ad52", "score": "0.5256496", "text": "def get_directory\r\n Course.find(self.node_object_id).directory_path\r\n end", "title": "" }, { "docid": "ac9cbcfd7e29d8f1168f732077bd119c", "score": "0.52508926", "text": "def documents_path\n NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true)[0]\n end", "title": "" }, { "docid": "2174f23aabb10e971d0bf20ee2e2b998", "score": "0.5250824", "text": "def ns\n document_dir = path.dirname\n\n if document_dir != directory\n document_dir.relative_path_from(directory).to_s.gsub('/', '.')\n end\n end", "title": "" }, { "docid": "082ce8eaeb7125dc4b51f6743dd15abc", "score": "0.52408886", "text": "def doc_base; self[:doc_base] || root_dir; end", "title": "" }, { "docid": "1806235e1c503ae7c050ab134f65c214", "score": "0.5237972", "text": "def directories\n return @directories\n end", "title": "" }, { "docid": "730a8e23fcbd6d79be0fabf06b8fd45e", "score": "0.52365863", "text": "def folder\n if !@conn_id.nil? && [email protected]?\n self.class.folder_class.find(@conn_id, @location.path)\n else\n []\n end\n end", "title": "" }, { "docid": "e7078d73a74d820d35901802642c85a1", "score": "0.5226348", "text": "def included_dirs\n @included_dirs ||= []\n end", "title": "" }, { "docid": "db09a3079df58488d899520bcc1ccb32", "score": "0.52244705", "text": "def directory\n extract\n @directory\n end", "title": "" }, { "docid": "7ef985879dd280dfe187b9705f85bf09", "score": "0.5216552", "text": "def directory(dir_name)\n @directories.each do |dir|\n return dir if dir.name == dir_name\n end\n false\n end", "title": "" }, { "docid": "2217d4a79699987657ba0717a1a7ead0", "score": "0.5206628", "text": "def dir()\n\t\traise \"dir() called on a Builder with no target set yet\" if targets().empty?()\n\t\treturn targets()[0].dirname()\n\tend", "title": "" }, { "docid": "15a917d8fef20631aba95fff944cc40f", "score": "0.52060133", "text": "def directory__reverse_index\n\n directory__reverse_index = File.join( @parent_bucket.parent_adapter.home_directory,\n 'indexes',\n 'reverse_index',\n @parent_bucket.name.to_s,\n @name.to_s )\n\n ensure_directory_path_exists( directory__reverse_index )\n\n return directory__reverse_index\n\n end", "title": "" }, { "docid": "fc270509c755891f184951becc5605e2", "score": "0.51786256", "text": "def local_dir\n dir_for_set(id)\n end", "title": "" }, { "docid": "78602a898747b54cece6c4d03334aa9d", "score": "0.5161701", "text": "def doc\n @doc ||= @indexer.get_id(@index)\n @doc\n end", "title": "" }, { "docid": "52b711306f9ec89d55219a6a58728d8f", "score": "0.51596504", "text": "def get index_dir, url\n xtractr = nil\n xtractr = xtractr_for index_dir\n xtractr.get url\n end", "title": "" }, { "docid": "da86e601747d6bec5ee8b1be5173466d", "score": "0.51479703", "text": "def filepath\n return @dirpath\n end", "title": "" }, { "docid": "98b80a97a875cf3256401e828e2e21f0", "score": "0.5147199", "text": "def parent\n parts = path.split(\"/\")\n if path.include?(app.index_file)\n parts.pop\n end\n \n return nil if parts.length < 1\n \n parts.pop\n parts.push(app.index_file)\n \n parent_path = \"/\" + parts.join(\"/\")\n \n if store.exists?(parent_path)\n store.page(parent_path)\n else\n nil\n end\n end", "title": "" }, { "docid": "68e0637301d4e6cd8a3bea8fc6ce5573", "score": "0.514667", "text": "def initial_directory()\n @initial_directory = nil if !defined?(@initial_directory)\n return @initial_directory\n end", "title": "" }, { "docid": "07718bc5e8e8ef1bd48bf09a39aaf362", "score": "0.5145124", "text": "def root_directory_path\n\n directory = \"\"\n eebo = is_eebo?\n id = document_id\n (0..4).each { |i|\n if eebo\n directory = File.join(directory, \"#{id[i * 2]}#{id[(i * 2)+1]}\")\n else\n directory = File.join(directory, id[i])\n end\n }\n return directory\n end", "title": "" }, { "docid": "a1348c74837448fd38056d0013a6f0f5", "score": "0.51329225", "text": "def dir\n Path.new(File.dirname(@path))\n end", "title": "" }, { "docid": "32825fda094583cd20f33fcc860c6419", "score": "0.51262575", "text": "def product_index_files_directory\n File.join(@cache_directory, \"indexes\")\n end", "title": "" }, { "docid": "cbb3427c68de7531eff0b6b1e31d47a6", "score": "0.5124268", "text": "def managed_directory\n @path\n end", "title": "" }, { "docid": "4b587c641b6a5c92d9b79900d843ef71", "score": "0.5122358", "text": "def folder\n return @folder\n end", "title": "" }, { "docid": "4b587c641b6a5c92d9b79900d843ef71", "score": "0.5122358", "text": "def folder\n return @folder\n end", "title": "" }, { "docid": "5254a4798d4a29d726b797f6bb5b2fde", "score": "0.51159906", "text": "def dirname\n @dirname ||= File.dirname(@path)\n end", "title": "" }, { "docid": "a3490f313e8cecbb8f53c8074d3b59ae", "score": "0.5114207", "text": "def target_folder\n case\n when (not well_formed?)\n nil\n when @kwds[:path] == \"\"\n @siteroot\n else\n search_path = Path.new(@kwds[:path])\n @siteroot.find_file_by_path(search_path)\n end\n end", "title": "" }, { "docid": "2e13b21bb838934eeb4e7cfc3ddfce21", "score": "0.51094586", "text": "def dir\n Filer::Dir.new(File.dirname(@path))\n end", "title": "" }, { "docid": "748417746bd8c4272f1b42c25010a838", "score": "0.51006854", "text": "def dirname\n epub.opf_dirname\n end", "title": "" }, { "docid": "d06c4d92112cc61b7c08d3d6006b11c7", "score": "0.5091277", "text": "def folder\n @structure[:folder]\n end", "title": "" }, { "docid": "898999ffd43f3c43e092143cf5046e92", "score": "0.5085962", "text": "def directory\n @account.imap_directory || ''\n end", "title": "" }, { "docid": "1968e80e8e7d533f1c255bb6d520d4bb", "score": "0.50841445", "text": "def dirname\n File.dirname(self)\n end", "title": "" }, { "docid": "d7b066efec64d3e5dc86c0c8831412fb", "score": "0.50840706", "text": "def index\n @directory = find_directory params[:path]\n end", "title": "" }, { "docid": "1c4dd8f7888dc3403bab3ad8a79bd7b9", "score": "0.50799555", "text": "def ifs_getDir(p, miqfs = nil)\n # If this is being called from a FileObject instance, then MiqFS owns contained instance members.\n # If this is being called from an Ext3 module method, then self owns contained instance members.\n miqfs = self if miqfs.nil?\n\n # Wack leading drive.\n p = unnormalizePath(p)\n\n # Check for this path in the cache.\n if miqfs.dir_cache.key?(p)\n miqfs.cache_hits += 1\n return Directory.new(miqfs.boot_sector, DirectoryEntry.new(miqfs.dir_cache[p], miqfs.boot_sector.suff))\n end\n\n # Return root if lone separator.\n return miqfs.drive_root if p == \"/\" || p == \"\\\\\"\n\n # Get an array of directory names, kill off the first (it's always empty).\n names = p.split(/[\\\\\\/]/); names.shift\n\n # Find target dir.\n de = miqfs.drive_root.myEnt\n loop do\n break if names.empty?\n dir = Directory.new(miqfs.boot_sector, de)\n de = dir.findEntry(names.shift, Directory::FE_DIR)\n raise \"Can't find directory: \\'#{p}\\'\" if de.nil?\n end\n\n # Save dir ent in the cache & return a Directory.\n # NOTE: This stores only the directory entry data string - not the whole object.\n miqfs.dir_cache[p] = de.myEnt\n Directory.new(miqfs.boot_sector, de)\n end", "title": "" }, { "docid": "421de17926d6b459267ceb1c8ef73dfb", "score": "0.50783974", "text": "def get_directory\r\n end", "title": "" }, { "docid": "140092a5254ace2f5129e17739d73614", "score": "0.50767124", "text": "def ifs_getDir(p, miqfs = nil)\n # If this is being called from a FileObject instance, then MiqFS owns contained instance members.\n # If this is being called from an Ext4 module method, then self owns contained instance members.\n miqfs = self if miqfs.nil?\n\n # Wack leading drive.\n p = unnormalizePath(p)\n\n # Get an array of directory names, kill off the first (it's always empty).\n names = p.split(/[\\\\\\/]/)\n names.shift\n\n dir = ifs_getDirR(names, miqfs)\n raise MiqFsDirectoryNotFound, p if dir.nil?\n dir\n end", "title": "" }, { "docid": "da7111b5809b0b630a67516e96d3a367", "score": "0.5074956", "text": "def dirname\n rebuild(@path.dirname).as_directory\n end", "title": "" }, { "docid": "789fc120f363de3121684833bca43d66", "score": "0.5074016", "text": "def dir\n url[-1, 1] == '/' ? url : File.dirname(url)\n end", "title": "" }, { "docid": "13055f7fb505a375e6397740c8528e57", "score": "0.5071857", "text": "def dir_path\n # binding.pry\n if extension.nil?\n node_warn(node: parent, msg: \"Extension '#{extension_name}' not found\")\n elsif extension.segment(extension_path).nil?\n node_warn(node: parent, msg: \"Extension '#{extension_name}' segment '#{extension_path}' not found\")\n else\n return extension.segment(extension_path)\n end\n parent.parent.rootpath.join(parent.node_name).to_s\n end", "title": "" }, { "docid": "d566315465dc8759795e934192f8848b", "score": "0.5062076", "text": "def data_directory()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "4c998f9e65544bdf5eb28b47720fdc43", "score": "0.5046796", "text": "def wiki_dir\n @wiki_dir || Dir.pwd\n end", "title": "" }, { "docid": "4c998f9e65544bdf5eb28b47720fdc43", "score": "0.5046796", "text": "def wiki_dir\n @wiki_dir || Dir.pwd\n end", "title": "" }, { "docid": "f26d3dbdf527f53685a89f0a4d91bdf0", "score": "0.5046685", "text": "def default_public_directory\n Engines.select_existing_paths(%w(assets public).map { |p| File.join(directory, p) }).first\n end", "title": "" }, { "docid": "0a2122e55b10ce520b532ae91e2bf91f", "score": "0.5043491", "text": "def dirname\n tr = folder? ? @pathname.to_s : @pathname.dirname.to_s\n tr == \".\" ? \"\" : tr\n end", "title": "" }, { "docid": "7115dea63f95f9d3e92af4c46bb42dda", "score": "0.50420505", "text": "def r_Dir\n r_const_get :Dir\n end", "title": "" }, { "docid": "81bc254e03b1106697dc63ac3facae2a", "score": "0.5041675", "text": "def relative_store_dir\n sd = self.instance.send(\"#{self.attribute}_store_dir\")\n if options[:store_dir].is_a?( Proc )\n sd ||= options[:store_dir].call(self.instance, self.attribute)\n else\n sd ||= options[:store_dir]\n end\n return sd\n end", "title": "" }, { "docid": "fbae7a43e8186b208e00358df83a5296", "score": "0.50333846", "text": "def app_documents_dir\n base_dir = app_sandbox_dir\n if base_dir.nil?\n nil\n else\n File.join(base_dir, 'Documents')\n end\n end", "title": "" }, { "docid": "f88caeaa2ed9bb75f84f11994fd02389", "score": "0.50327456", "text": "def path\n @directory\n end", "title": "" }, { "docid": "a28406178da47bc11cc081cf7f8e5114", "score": "0.502712", "text": "def directory\n options.directory ? options.directory : '.'\n end", "title": "" }, { "docid": "7c148b9debd1e152fea2ba9c68f1ac92", "score": "0.50155956", "text": "def directory_index\n \tif @config_map.has_key?(\"DirectoryIndex\")\n \t @config_map[\"DirectoryIndex\"].each { |k,v| return \"#{v}\"}\n \tend\n \t# default directory index if not provided in config\n \treturn \"index.html\"\n end", "title": "" }, { "docid": "e4e92c18f9f9e179627481cf3afb86af", "score": "0.5008425", "text": "def dir_path\n File.dirname(file_path)\n end", "title": "" }, { "docid": "563e2470a4958414ae5275f6bb017878", "score": "0.5008388", "text": "def origin\n # check for included IDL\n enc = @node.enclosure\n while enc\n return File.basename(enc.fullpath) if enc.is_a?(IDL::AST::Include)\n\n enc = enc.enclosure\n end\n # not from include but from IDL source file\n File.basename(params[:idlfile])\n end", "title": "" }, { "docid": "5ae173fb5cfb2ba65fbe90a381efc04b", "score": "0.50063825", "text": "def get_directory\n connection.directories.get(fog_directory)\n end", "title": "" }, { "docid": "8fcbc67a5669e543bb161e838c5ae875", "score": "0.5002051", "text": "def dirname\n File.join(root_path, partitioned_path)\n end", "title": "" }, { "docid": "c350795477f53be8cb866cd2b6359116", "score": "0.50017744", "text": "def managed_directory\n @path\n end", "title": "" }, { "docid": "a9256e2f76cb7552ef861a38baa6959e", "score": "0.49973154", "text": "def get_directory\n end", "title": "" }, { "docid": "eb33f9e9d19ce4d648369c615f35ad37", "score": "0.49961737", "text": "def get_alias_path!\n alias_dir=Picolena::IndexedDirectories[indexed_directory]\n self[:alias_path]=dirname.sub(indexed_directory,alias_dir) if indexed_directory\n end", "title": "" }, { "docid": "17b276708f916eb87d5e8ed850022d22", "score": "0.49939668", "text": "def get_first_directory\n Dir[\"#{folder}/*\"].each do |p|\n pname = File.basename(p)\n return pname if File.directory?(p) && pname != 'xDefault'\n end\n return nil\n end", "title": "" }, { "docid": "6e916b373ea2975c5c34184da57e0f71", "score": "0.49925712", "text": "def ifs_getDir(p, miqfs = nil)\n # If this is being called from a FileObject instance, then MiqFS owns contained instance members.\n # If this is being called from an NTFS module method, then self owns contained instance members.\n miqfs = self if miqfs.nil?\n\n # Wack leading drive.\n p = unnormalizePath(p)\n\n # Check for this path in the cache.\n if miqfs.dir_cache.key?(p)\n miqfs.cache_hits += 1\n return Directory.new(miqfs.boot_sector, miqfs.dir_cache[p])\n end\n\n # Return root if lone separator.\n return Directory.new(miqfs.boot_sector) if p == \"/\" || p == \"\\\\\"\n\n # Get an array of directory names, kill off the first (it's always empty).\n names = p.split(/[\\\\\\/]/); names.shift\n\n # Find first cluster of target dir.\n cluster = miqfs.boot_sector.rootCluster\n loop do\n break if names.empty?\n dir = Directory.new(miqfs.boot_sector, cluster)\n de = dir.findEntry(names.shift, Directory::FE_DIR)\n raise \"Can't find directory: \\'#{p}\\'\" if de.nil?\n cluster = de.firstCluster\n end\n\n # Save cluster in the cache & return a Directory.\n miqfs.dir_cache[p] = cluster\n Directory.new(miqfs.boot_sector, cluster)\n end", "title": "" } ]
40608f0b6e12b77dbf6779f66cb5fb89
we no longer support the & syntax
[ { "docid": "ba4746c6f53b628213dd84013a23ba25", "score": "0.0", "text": "def formatflag(engine=nil,format=nil)\n case getvariable('distribution')\n when 'standard' then prefix = \"--fmt\"\n when /web2c/io then prefix = web2cformatflag(engine)\n when /miktex/io then prefix = \"--undump\"\n else return \"\"\n end\n if format then\n \"#{prefix}=#{format.sub(/\\.\\S+$/,\"\")}\"\n else\n prefix\n end\n end", "title": "" } ]
[ { "docid": "f7ce46b9bb7aa287ddba7f14eac70536", "score": "0.6763258", "text": "def ampersand!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 12 )\n\n type = AMPERSAND\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 144:4: '&'\n match( 0x26 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 12 )\n\n end", "title": "" }, { "docid": "3039d2d8f62568441d901b4161cb36b1", "score": "0.66697204", "text": "def ampersand(&block)\n block.call\n yield\nend", "title": "" }, { "docid": "ecf50230071fcaf5898257ba4f9560d5", "score": "0.6099489", "text": "def getValue; join(\"&\"); end", "title": "" }, { "docid": "91ebb68855ceceef337d7eba42cbc699", "score": "0.59910184", "text": "def &(other)\n false\n end", "title": "" }, { "docid": "e413ac4d7203da173cb280ee8507b3f2", "score": "0.59594303", "text": "def cmd_concat_operator\n\t\t\" & \"\n\tend", "title": "" }, { "docid": "f882cf22fe173d7f54ebccda2175f699", "score": "0.5921566", "text": "def and_c\n end", "title": "" }, { "docid": "a086f08c994acf4464745eac86c99ea3", "score": "0.5891967", "text": "def tagging_symbol\n '&'\n end", "title": "" }, { "docid": "9855fd8f7fe289cb9bac2bc8361b0ea0", "score": "0.5872936", "text": "def test_regular_ampersand\n filter = TypogrubyFilter.new \\\n \t\"one & two\"\n\n assert_equal %(one <span class=\"amp\">&amp;</span>&nbsp;two),\n filter.call\n end", "title": "" }, { "docid": "4b3f0460ab7ff16043acd4a0fc12c3d3", "score": "0.58271784", "text": "def and\n self\n end", "title": "" }, { "docid": "4e391d92577e107f6a0479c7c1871e3e", "score": "0.5813803", "text": "def &(p0) end", "title": "" }, { "docid": "4e391d92577e107f6a0479c7c1871e3e", "score": "0.5813803", "text": "def &(p0) end", "title": "" }, { "docid": "6b16dfdacfbff4a7dd8a64469db807d9", "score": "0.58044904", "text": "def bitwise_and(num1, num2)\n bnum1 = num1.to_s(2)\n bnum2 = num2.to_s(2)\n band = (num1 & num2).to_s(2)\n puts \"num1 = \" + ( ' ' * bnum2.length ) + num1.to_s(2)\n puts \"num2 = \" + ( ' ' * bnum1.length ) + num2.to_s(2)\n puts \"b2& = \" + ( ' ' * ([bnum1.length, bnum2.length].max ) + band)\n # puts \"base 10 & = \" + (num1 & num2).to_s(10)\nend", "title": "" }, { "docid": "cd935dd7165ce98271dd06c711b4d91b", "score": "0.5804348", "text": "def and_l\n end", "title": "" }, { "docid": "c785d032f7f9cf4b398fb7008586ec13", "score": "0.57844615", "text": "def and_b\n end", "title": "" }, { "docid": "d9613ff034578443909557d6f82a40ef", "score": "0.57548034", "text": "def &(arg0)\n end", "title": "" }, { "docid": "d9613ff034578443909557d6f82a40ef", "score": "0.57548034", "text": "def &(arg0)\n end", "title": "" }, { "docid": "d9613ff034578443909557d6f82a40ef", "score": "0.57548034", "text": "def &(arg0)\n end", "title": "" }, { "docid": "1d8f30d21ea1f98ab7766d6997feaf7a", "score": "0.5721684", "text": "def carry_out (p,q)\n p & q\nend", "title": "" }, { "docid": "052e9b86e36da0884b38e197fc4cd81b", "score": "0.572124", "text": "def and_e\n end", "title": "" }, { "docid": "2fffb9135f0006c8a126bb9b803097bd", "score": "0.5714128", "text": "def defp &p\r\n $p = p\r\n g2 &p # this is ok\r\nend", "title": "" }, { "docid": "8ad050ba1992ac65bdb913eea4867d0a", "score": "0.57039213", "text": "def f6; return *['a','b'] &['a','Y','Z'] end", "title": "" }, { "docid": "6b5e17c949c479711bcfd532b058d836", "score": "0.57019955", "text": "def and_d\n end", "title": "" }, { "docid": "2d87ba82dea6886befa65f527e2920e0", "score": "0.56604576", "text": "def & other\n if self\n other ? true : false\n else\n false\n end\n end", "title": "" }, { "docid": "be42fc135304e057ab447049e24e77f4", "score": "0.56183004", "text": "def andand(*)\n self\n end", "title": "" }, { "docid": "0bfab5e24993aeb34f345df679891f02", "score": "0.56181717", "text": "def and_a\n end", "title": "" }, { "docid": "f8d5744989b5b1e7181351525e598dc7", "score": "0.5558524", "text": "def & other\n call_enum \"boolean\", other, :and\n end", "title": "" }, { "docid": "2e92f3c2ca22658471f9430b64ede5f7", "score": "0.551414", "text": "def and_this(&b)\n\t\t\t\tnil? ? nil : this(&b)\n\t\t\tend", "title": "" }, { "docid": "8da1df1557234a543794e67af5ddb224", "score": "0.5490006", "text": "def ref; end", "title": "" }, { "docid": "33b1ec40c286e4f348a76fb1bd3392f2", "score": "0.5481587", "text": "def |(p0) end", "title": "" }, { "docid": "33b1ec40c286e4f348a76fb1bd3392f2", "score": "0.5481587", "text": "def |(p0) end", "title": "" }, { "docid": "33b1ec40c286e4f348a76fb1bd3392f2", "score": "0.5481587", "text": "def |(p0) end", "title": "" }, { "docid": "33b1ec40c286e4f348a76fb1bd3392f2", "score": "0.5481587", "text": "def |(p0) end", "title": "" }, { "docid": "33b1ec40c286e4f348a76fb1bd3392f2", "score": "0.5481587", "text": "def |(p0) end", "title": "" }, { "docid": "33b1ec40c286e4f348a76fb1bd3392f2", "score": "0.5481587", "text": "def |(p0) end", "title": "" }, { "docid": "f9e245051c3817c9608a5481ece31214", "score": "0.54811853", "text": "def &(other)\n\t\tself.class.new(value & other)\n\tend", "title": "" }, { "docid": "b61b9d43bbc6f8f45b84000e2ecde7f0", "score": "0.5465941", "text": "def entityReference(isParam, name)\n\t finishStartTag() if @inStartTag\n\t @io << \"#{isParam ? '%' : '&'}#{name};\"\n\tend", "title": "" }, { "docid": "7c629130eedcc3ec6f45cb70231cb436", "score": "0.5452931", "text": "def Hola &bloque\n otra_prueba(&bloque)\nend", "title": "" }, { "docid": "91a840c7a4d58d2b7ccd775829452ee2", "score": "0.54519993", "text": "def replace_and(business)\n return business.gsub(\"&\", \"and\")\n end", "title": "" }, { "docid": "7eb80f7f789865805020e1dfd5d7fd38", "score": "0.53938746", "text": "def method a, &b\r\n\t1\r\nend", "title": "" }, { "docid": "7eb80f7f789865805020e1dfd5d7fd38", "score": "0.53938746", "text": "def method a, &b\r\n\t1\r\nend", "title": "" }, { "docid": "7eb80f7f789865805020e1dfd5d7fd38", "score": "0.53938746", "text": "def method a, &b\r\n\t1\r\nend", "title": "" }, { "docid": "7eb80f7f789865805020e1dfd5d7fd38", "score": "0.53938746", "text": "def method a, &b\r\n\t1\r\nend", "title": "" }, { "docid": "857f1253790cac3be4397e83dc24c693", "score": "0.53746563", "text": "def and_d8\n end", "title": "" }, { "docid": "7ffbb4e5006949657dd133fa1a19bbee", "score": "0.53590906", "text": "def bit_and\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 53 )\n return_value = BitAndReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal241 = nil\n equality240 = nil\n equality242 = nil\n\n tree_for_char_literal241 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 597:5: equality ( '&' equality )*\n @state.following.push( TOKENS_FOLLOWING_equality_IN_bit_and_3943 )\n equality240 = equality\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, equality240.tree )\n end\n # at line 597:14: ( '&' equality )*\n while true # decision 56\n alt_56 = 2\n look_56_0 = @input.peek( 1 )\n\n if ( look_56_0 == AMP )\n alt_56 = 1\n\n end\n case alt_56\n when 1\n # at line 597:17: '&' equality\n char_literal241 = match( AMP, TOKENS_FOLLOWING_AMP_IN_bit_and_3948 )\n if @state.backtracking == 0\n\n tree_for_char_literal241 = @adaptor.create_with_payload( char_literal241 )\n root_0 = @adaptor.become_root( tree_for_char_literal241, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_equality_IN_bit_and_3952 )\n equality242 = equality\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, equality242.tree )\n end\n\n else\n break # out of loop for decision 56\n end\n end # loop for decision 56\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 53 )\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "f01d44716d51d77558fdd1b74c2ae8ff", "score": "0.5335365", "text": "def and(e1, e2)\n eval_ex(e1) & eval_ex(e2)\n end", "title": "" }, { "docid": "361ef41739f1cf754d99b174b23c34d5", "score": "0.530574", "text": "def references; end", "title": "" }, { "docid": "361ef41739f1cf754d99b174b23c34d5", "score": "0.530574", "text": "def references; end", "title": "" }, { "docid": "32371acf77817c72a01b3fc4b207dbaf", "score": "0.53043747", "text": "def amp\n\t\t@amp\n\tend", "title": "" }, { "docid": "a7bf9a5c27ad4d051b5ff53c9dc7b947", "score": "0.5295199", "text": "def and\n x, y = stack.pop(2)\n push x & y\n end", "title": "" }, { "docid": "3dbcbedb0fbca87de1637f105877bb47", "score": "0.52934813", "text": "def convert_link(url)\n url.gsub('&', '&amp;')\nend", "title": "" }, { "docid": "62d97379171bfe4b006a14ba04be5a36", "score": "0.52751756", "text": "def =~(p0) end", "title": "" }, { "docid": "62d97379171bfe4b006a14ba04be5a36", "score": "0.52751756", "text": "def =~(p0) end", "title": "" }, { "docid": "62d97379171bfe4b006a14ba04be5a36", "score": "0.52751756", "text": "def =~(p0) end", "title": "" }, { "docid": "609b47d4de278925761f59c60c9c4345", "score": "0.52628195", "text": "def and_hl\n end", "title": "" }, { "docid": "0fc52c785d586d5db8bb9ff04e5f07c8", "score": "0.5250445", "text": "def amp_asgn!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n\n type = AMP_ASGN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 123:12: '&='\n match( \"&=\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n end", "title": "" }, { "docid": "3800c75e2d4d956a10d1549c99fb96dd", "score": "0.5238141", "text": "def |(parslet); end", "title": "" }, { "docid": "3800c75e2d4d956a10d1549c99fb96dd", "score": "0.5238141", "text": "def |(parslet); end", "title": "" }, { "docid": "3faced73c9494180b495937adb62fa4e", "score": "0.5237247", "text": "def argument_references(argument); end", "title": "" }, { "docid": "85bb7b647aac301ac47b8d79b68d8ba2", "score": "0.5215263", "text": "def &(val)\n data & Reg.clean_value(val)\n end", "title": "" }, { "docid": "4acd69954ef891089e8f3a2b6801fd40", "score": "0.52087504", "text": "def bandand\n bandbool :and\n end", "title": "" }, { "docid": "d41e8b2a59fdfcc0a8980a11933d22f3", "score": "0.51709265", "text": "def test_and\n assert_false F & F, 'F & F'\n assert_false F & M, 'F & M'\n assert_false F & T, 'F & T'\n\n assert_false M & F, 'M & F'\n assert_maybe M & M, 'M & M'\n assert_maybe M & T, 'M & T'\n\n assert_false T & F, 'T & F'\n assert_maybe T & M, 'T & M'\n assert_true T & T, 'T & T'\n end", "title": "" }, { "docid": "4897e625e60997ba6afef6ab7ed3a773", "score": "0.5141077", "text": "def refs_at; end", "title": "" }, { "docid": "d5a85d10b6e0455e52144419d9572f35", "score": "0.51325023", "text": "def BEQ(r1,r2,address) opcode \"BEQ\", [r1,r2,address] end", "title": "" }, { "docid": "c69714a0e9af1f25d67b0ec8c5492117", "score": "0.5127863", "text": "def &(expr2)\n Operator.new(S_AND, self, expr2)\n end", "title": "" }, { "docid": "35c9d8f67f5c76d44083bfc233221c8f", "score": "0.51201594", "text": "def and_ a, b\n self.and a, b\n end", "title": "" }, { "docid": "675fa04ce9e4a80963ea8aad559b3403", "score": "0.50975555", "text": "def html_escape(str)\r\n str.gsub('&', '&amp;').str('<', '&lt;').str('>', '&gt;').str('\"', '&quot;')\r\nend", "title": "" }, { "docid": "2cc9969eb7789e4fe75844b6f57cb6b4", "score": "0.5093855", "text": "def refutal()\n end", "title": "" }, { "docid": "5f0c0ccac650d69271f54b0624a0c657", "score": "0.5091873", "text": "def implicit_reference(b)\n false\n end", "title": "" }, { "docid": "09fb501a08205b7a6b032272e63d3a00", "score": "0.5086054", "text": "def and_h\n end", "title": "" }, { "docid": "7f4fb8d80a44a5452e9b0bd479e0be0d", "score": "0.50860375", "text": "def execute_AND(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value &= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend", "title": "" }, { "docid": "db32f67faae00a76975ba21cf3267479", "score": "0.5066852", "text": "def whiny=(_arg0); end", "title": "" }, { "docid": "dd1f8eca76cf856439e6aa7d2df2b8b2", "score": "0.50632983", "text": "def test_entity_insertions\n assert_equal(\"&amp;\", REXML::Text.new(\"&amp;\", false, nil, true).to_s)\n #assert_equal(\"&\", REXML::Text.new(\"&amp;\", false, false).to_s)\n end", "title": "" }, { "docid": "75598b72838b7c81dbe6f93aff346165", "score": "0.5056796", "text": "def And(a, b)\n return a && b\nend", "title": "" }, { "docid": "68114aae5d40c8b77b5122663d9a26ed", "score": "0.5051026", "text": "def _reduce_39(val, _values, result)\n result = s(:and, val[0], val[2])\n \n result\nend", "title": "" }, { "docid": "40d478de1a9570de0d41c39d3bf290c6", "score": "0.5039446", "text": "def PRF02=(arg)", "title": "" }, { "docid": "1d1337b59894d0ca4d8e9dd5d8a81622", "score": "0.50266874", "text": "def AND(x,y); \tif x==1 && y==1 \tthen 1 else 0 end; end", "title": "" }, { "docid": "6730e4b90e2e1c967b13f2f01afbc33f", "score": "0.5025931", "text": "def back_ref(kind)\n if lm = last_match()\n res = case kind\n when :&\n lm[0]\n when :\"`\"\n lm.pre_match\n when :\"'\"\n lm.post_match\n when :+\n lm.captures.last\n end\n\n return res\n end\n\n return nil\n end", "title": "" }, { "docid": "227f6de45e409e8b92d178bb0682f93a", "score": "0.5006629", "text": "def PO114=(arg)", "title": "" }, { "docid": "1a5368bac0da03df2aaa0e077375605d", "score": "0.49924436", "text": "def scan_for_and(token); end", "title": "" }, { "docid": "d8216257f367748eea163fc1aa556306", "score": "0.4989806", "text": "def bs; end", "title": "" }, { "docid": "7df4fafe197a7f9b5b1158fb124a5bdf", "score": "0.4988534", "text": "def look_ahead_for_support_both_sides\n look_ahead_for_support do |left, right|\n left & right\n end\n end", "title": "" }, { "docid": "ed30756a17b0d0b33a13bfd2fc447686", "score": "0.49884114", "text": "def back_ref(kind)\n if lm = @last_match\n res = case kind\n when :&\n lm[0]\n when :\"`\"\n lm.pre_match\n when :\"'\"\n lm.post_match\n when :+\n lm.captures.last\n end\n\n return res\n end\n\n return nil\n end", "title": "" }, { "docid": "01f5d5072b258f5875a109f63ac3c949", "score": "0.49774793", "text": "def qwerty\n\t\tfalse\n\tend", "title": "" }, { "docid": "c9d63043127f4d8834416df6a2504856", "score": "0.49717817", "text": "def stringToQuery (val)\n\t\t\n\tend", "title": "" }, { "docid": "13dd0c523ffc3de3c969b06673576261", "score": "0.4971002", "text": "def *(p0) end", "title": "" }, { "docid": "13dd0c523ffc3de3c969b06673576261", "score": "0.4971002", "text": "def *(p0) end", "title": "" }, { "docid": "13dd0c523ffc3de3c969b06673576261", "score": "0.4969417", "text": "def *(p0) end", "title": "" }, { "docid": "d3666bb6151f973726efc78125338dce", "score": "0.49692008", "text": "def SAC07=(arg)", "title": "" }, { "docid": "3c1a0e918dade7dd4043a8f0ee975aa8", "score": "0.49651986", "text": "def reference(name, type)\n \n end", "title": "" }, { "docid": "a2f721ea66b41eb2dcb75464c2819502", "score": "0.49641156", "text": "def &\n a = pop\n b = pop\n push (a == -1) && (b == -1) ? -1 : 0\n end", "title": "" }, { "docid": "550948d497df15013f44c29072df178f", "score": "0.49580306", "text": "def left=(_arg0); end", "title": "" }, { "docid": "550948d497df15013f44c29072df178f", "score": "0.49580306", "text": "def left=(_arg0); end", "title": "" }, { "docid": "6e5d54015ddf90b6b996c308bb6153e5", "score": "0.49571902", "text": "def indirect &b\n call_block &b\nend", "title": "" }, { "docid": "6e5d54015ddf90b6b996c308bb6153e5", "score": "0.49571902", "text": "def indirect &b\n call_block &b\nend", "title": "" }, { "docid": "0ee27284dbfa1e68741dc95297e570de", "score": "0.49565455", "text": "def operator; end", "title": "" }, { "docid": "bfa09d97a6bd931a910990c1193a0e87", "score": "0.49542373", "text": "def _reduce_38(val, _values, result)\n result = s(:and, val[0], val[2])\n \n result\nend", "title": "" }, { "docid": "bfa09d97a6bd931a910990c1193a0e87", "score": "0.49542373", "text": "def _reduce_38(val, _values, result)\n result = s(:and, val[0], val[2])\n \n result\nend", "title": "" }, { "docid": "14792482b9a5961e3fe44f2d3431b0d3", "score": "0.49534068", "text": "def active=(_arg0); end", "title": "" }, { "docid": "14792482b9a5961e3fe44f2d3431b0d3", "score": "0.49534068", "text": "def active=(_arg0); end", "title": "" }, { "docid": "997d83321a6423bdc3973c88919af727", "score": "0.49346653", "text": "def PO110=(arg)", "title": "" }, { "docid": "713f78ad1532fd1d02707c4324748dac", "score": "0.49241978", "text": "def leeway=(_arg0); end", "title": "" } ]
41d6cb57fbf4914fdd18fdf76f1ae860
PATCH/PUT /events/1 PATCH/PUT /events/1.json
[ { "docid": "c88e9b236d93f48c2ec6088b49b0c50a", "score": "0.0", "text": "def update\n @event = Event.find(params[:id])\n redirect_to events_path if @event.update(event_params)\n end", "title": "" } ]
[ { "docid": "dc4ff2adcbcefec9118bdd7e8716ad75", "score": "0.73754156", "text": "def update\n event = event.find(params[\"id\"]) \n event.update_attributes(event_params) \n respond_with event, json: event\n end", "title": "" }, { "docid": "0050f781a1e526879347940817ef65b8", "score": "0.7236674", "text": "def update\n #TODO params -> strong_params\n if @event.update(params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "2827d845ba442028d80242de02c60173", "score": "0.722452", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { head :no_content, status: :ok }\n format.xml { head :no_content, status: :ok }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.xml { render xml: @event.errors, status: :unprocessable_entity }\n end\n end\n\n end", "title": "" }, { "docid": "e53ac6aaed698a8f60ef0ffd649d7a37", "score": "0.71946955", "text": "def update\n @event = Event.find(params[:id])\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.json { head :ok }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25c70818308792c1eeb416d6f7873983", "score": "0.71436787", "text": "def update\n @event = Event.find(params[:event_id])\n respond_to do |format|\n if @event.update(event_params)\n format.json { render json: @event, status: :ok }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f8df991b07ce1ccb21665df10b8a9346", "score": "0.71228635", "text": "def update\n if !params[\"event\"][\"payload\"].is_a?(String)\n @event.payload = params[\"event\"][\"payload\"].to_json\n end\n\n if params[\"event\"][\"timestamp\"]\n @event.timestamp = Time.at(params[\"event\"][\"timestamp\"].to_f)\n end\n\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "158cc85c267c341d95fec85c61eca325", "score": "0.7105082", "text": "def update\n if @event.update(event_params)\n render json: @event.to_json, status: :ok\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "de04757f39fd1fb259531f6fefd81e4d", "score": "0.71024436", "text": "def update\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "c1e91edfe4a0b5c098fb83a06d3cccfc", "score": "0.7101236", "text": "def update\n @event.update(event_params)\n head :no_content\n end", "title": "" }, { "docid": "6057d92b0704aa37b9cfaa5dd5be8f36", "score": "0.7082709", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6057d92b0704aa37b9cfaa5dd5be8f36", "score": "0.7082709", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6057d92b0704aa37b9cfaa5dd5be8f36", "score": "0.7082709", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a29b26d0bd365434c592cf3e22fec741", "score": "0.70634943", "text": "def update\n if @event.update(event_params)\n head :ok\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "5415dd71b3b7941d4591b6418720b8db", "score": "0.70612466", "text": "def update\n event = Event.find(params[:id])\n if event.update(event_params)\n render json: event\n else\n render json: { error: '' }, status: 403\n end\n end", "title": "" }, { "docid": "ff13892cc987facfe256433aec09dc17", "score": "0.7047931", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { render html: '200', status: :ok }\n format.json { render 'event', status: :ok, event: @event }\n else\n format.html { render html: '500', status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "49d38487712349de37855d7601fdfa81", "score": "0.7028951", "text": "def update\n respond_with(@event)\n end", "title": "" }, { "docid": "de65359d72023e3884547c61b2f5fda2", "score": "0.7023433", "text": "def update\n @event_req = EventReq.find(params[:id])\n\n respond_to do |format|\n if @event_req.update_attributes(params[:event_req])\n format.html { redirect_to @event_req, notice: 'Event req was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_req.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "32a87162afe9140a07c1e917817498f8", "score": "0.70222205", "text": "def update\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "32a87162afe9140a07c1e917817498f8", "score": "0.70222205", "text": "def update\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "557b7dee79ad9c6676f191d5695796dc", "score": "0.7011029", "text": "def update\n @event.update!(event_params)\n if @event.save\n #if saved then output saved data to JSON\n render json: @event.to_json, status: 201\n else\n #if failed send bad request error\n render json: {message: \"Failed to update event\"}, status: 400\n end\n end", "title": "" }, { "docid": "93a3d30cd144eb5bdb908d4ebfe49137", "score": "0.70058835", "text": "def update\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to edit_event_path(@event), notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "de2c55d956ebbb4e392396ea6163cc38", "score": "0.69955355", "text": "def update\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c522d393f2acb36d4e2d8421240ab6f", "score": "0.6975325", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f6192a895ca82ab8840d90a325550516", "score": "0.6969704", "text": "def update\n @event = @eventable.events.find(params[:id])\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to [@eventable, :events], notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f86bb6893253a259a886907999d0e363", "score": "0.6966855", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n @events = Event.event_list\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b55c90bc72532f587b41b7972c69b6a8", "score": "0.6957137", "text": "def update\n respond_with( @event ) do |format|\n if @event.update_attributes( params[ :event ] )\n flash[ :notice ] = \"Event was successfully updated.\"\n format.html { redirect_to @event }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0ee8fcfa321abca1c8a254f293929bba", "score": "0.6954494", "text": "def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "0ee8fcfa321abca1c8a254f293929bba", "score": "0.6954494", "text": "def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "52e9e72b37ddfcd52aaf63494e820a52", "score": "0.69469154", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ce5ec604f96dac2452bf80d63d407246", "score": "0.6942871", "text": "def update\n @event = Event.find(params[:id])\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "42af8cad338d1a0fb6a141a290d5c02d", "score": "0.6924787", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to \"/events\", :notice => 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c48dd5de3d640b106604be10a59b4863", "score": "0.692109", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e2f4c464da5fbe99c15fbce88b53b476", "score": "0.69186515", "text": "def update\n \n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to event_path }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8abf7256fcc94246150b7cf92a1bf461", "score": "0.69149256", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to events_path, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8abf7256fcc94246150b7cf92a1bf461", "score": "0.69149256", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to events_path, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cbd082b8b517c84c5a23f384b0cc4800", "score": "0.69125044", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to future_events_path, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc7f236f87547ec1114e61d78932e190", "score": "0.6911122", "text": "def update\n @event = Event.find(params[:id])\n\n #respond_to do |format|\n if @event.update_attributes(params[:event])\n #format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n #format.json { head :no_content }\n\tredirect_to '/events'\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n #end\n end", "title": "" }, { "docid": "3dcb85e50a745d4930fd9058f06bd9c6", "score": "0.69070804", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :json => @event }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "583edc49a5b6d87c4dadba5ada09dfaf", "score": "0.6905695", "text": "def update \n\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "69631969c3255f2f77ccb590786681d2", "score": "0.69038516", "text": "def update\n\t\tevent_id = params[:id]\n\t\tif event_id.present? && params[:event].present?\n\t\t\tevent_params = params[:event]\n\t\t\t@event = Com::Nbos::Events::Event.where(:id => event_id).first\n\t\t\tif @event.present? \n\t\t\t\[email protected](event_params.permit!)\n\t\t\t\tif @event.save\n\t\t\t\t\trender :json => @event\n\t\t\t\telse\n\t\t\t\t\trender :json => {status: 500, message: @event.errors.messages}, status: 500\n\t\t\t\tend\n\t\t\telse\n\t\t\t\trender :json => {status: 404, message: \"Event Not Found\"}, status: 404\n\t\t\tend\n\t\telse\n\t\t\trender :json => {status: 400, message: \"Bad Request\"}, status: 400\n\t\tend\n\tend", "title": "" }, { "docid": "5227fd477a80d50e1f1d0da025f49cc8", "score": "0.68830234", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5227fd477a80d50e1f1d0da025f49cc8", "score": "0.68830234", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c62ac3138d49f99a5a8e1317a5d09115", "score": "0.687825", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: t('events.update_success.') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c6e1887bbeb9d4f5ca6fe42c4cd169f2", "score": "0.68766665", "text": "def update # rubocop:disable Metrics/MethodLength\n respond_to do |format|\n if @event.update(event_params)\n format.html do\n redirect_to @event, notice: \"#{notice_prefix} updated.\"\n end\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json json_unprocessable_entity\n end\n end\n end", "title": "" }, { "docid": "cf9830ccd54098709fef563138c5e26f", "score": "0.6871994", "text": "def update\n authorize! :create, @event\n was_updated = @event.update(event_params)\n check_event_changes if was_updated\n\n respond_to do |format|\n if was_updated\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f385d8f35dc61a314fdb9b0863780330", "score": "0.6871833", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to events_url, notice: I18n.t('events.update') }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "96a05b34a5f958c31888bbdc7834f734", "score": "0.68688256", "text": "def update\n @event = Event.find(params[:id])\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b6cc113b2b3199f44b311be47f18a65", "score": "0.6866517", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event - объект успешно изменён.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fffbdc530600ec78263ccd8109bd428c", "score": "0.6864879", "text": "def update\n #FIXME_AB: only the creator of event can be able to edit\n\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e877cac0684728687cb69ba89a9bce69", "score": "0.6860599", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to events_path}\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "41c686b87cf703156185d05825d04911", "score": "0.6859267", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: t('.success') }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9fe231cdee8313867014574de897febb", "score": "0.68590885", "text": "def update\n @event = Event.find(params[:id])\n if @event.update(event_params)\n EventRequirement.where(event_id: @event.id).map {|er| er.destroy!}\n requirement_params[:requirements].each do |req|\n req = Requirement.find(req[\"id\"].to_i)\n EventRequirement.create({event_id: @event.id, requirement_id: req.id})\n end\n render json: @event, serializer_params: { current_user: @current_user }, status: :updated\n else\n render json: @event.errors, serializer_params: { current_user: @current_user }, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "29aec7fa4944a6d95794f1a012be75ff", "score": "0.68554264", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event}\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "29aec7fa4944a6d95794f1a012be75ff", "score": "0.68554264", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event}\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aa1a8a994e0cc33251b851b7b4081777", "score": "0.68517303", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fa5a2dc012270e7e0e76a4d988f4fde8", "score": "0.6848056", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37ddd73d6a187db1b6047fd3edbd0426", "score": "0.68461853", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37ddd73d6a187db1b6047fd3edbd0426", "score": "0.68461853", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37ddd73d6a187db1b6047fd3edbd0426", "score": "0.68461853", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37ddd73d6a187db1b6047fd3edbd0426", "score": "0.68461853", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37ddd73d6a187db1b6047fd3edbd0426", "score": "0.68461853", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37ddd73d6a187db1b6047fd3edbd0426", "score": "0.68461853", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37ddd73d6a187db1b6047fd3edbd0426", "score": "0.68461853", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37ddd73d6a187db1b6047fd3edbd0426", "score": "0.68461853", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ae598b2155b01a423c628a5fcccdb754", "score": "0.6841379", "text": "def update\n @event.update_attributes event_params\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "22871bb5851af762ff1f3a49f7000eaa", "score": "0.6828408", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: t(\"notice.event_updated\") }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "438bfb800a681490193c0b150dc83369", "score": "0.6828083", "text": "def update\n\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a637f89ce8a20bfe8dfd072e65686400", "score": "0.682553", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to list_events_path, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a6de98941c5df443540d8e51cbc9bbdf", "score": "0.68218386", "text": "def update\n if @api_event.update(api_event_params)\n render :show, status: :ok, location: @api_event\n else\n render json: @api_event.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "2310e00ac962fbbe735060ee9800241b", "score": "0.68167496", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'event was successfully updated' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66ceb4adf993224337e7f0250c392766", "score": "0.6814237", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66ceb4adf993224337e7f0250c392766", "score": "0.68141645", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66ceb4adf993224337e7f0250c392766", "score": "0.68141645", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66ceb4adf993224337e7f0250c392766", "score": "0.68139076", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66ceb4adf993224337e7f0250c392766", "score": "0.68139076", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66ceb4adf993224337e7f0250c392766", "score": "0.68139076", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66ceb4adf993224337e7f0250c392766", "score": "0.68139076", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66ceb4adf993224337e7f0250c392766", "score": "0.68139076", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66ceb4adf993224337e7f0250c392766", "score": "0.68139076", "text": "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
48dfa14350048879a4914d97e2cb7101
Return true if user is authorized for wiki, otherwise false
[ { "docid": "bef02d3a39d23039d560a2d812e4d0f8", "score": "0.0", "text": "def authorize_for(group)\n current_user.becomes(LearnUser).allowed_to?(group)\n end", "title": "" } ]
[ { "docid": "af7717b0ec8df7061416ece094d86fe6", "score": "0.85034037", "text": "def authorized?\n if self.respond_to?(\"mini_wiki_authorized\")\n @authorized = mini_wiki_authorized\n else\n @authorized = true;\n end\n end", "title": "" }, { "docid": "c9183a13bea1383a67ac96cbb446933a", "score": "0.75222343", "text": "def authorized\n\t\tif current_user\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "title": "" }, { "docid": "058f8f41ad3d2a5441f003d78551dc91", "score": "0.7403982", "text": "def authorized?\n logged_in?\n end", "title": "" }, { "docid": "058f8f41ad3d2a5441f003d78551dc91", "score": "0.7403982", "text": "def authorized?\n logged_in?\n end", "title": "" }, { "docid": "a2b5b39035e50d49fe6ad73ca4d0553d", "score": "0.7400234", "text": "def authorized?\n logged_in?\n end", "title": "" }, { "docid": "4d857065a38b5cacf755f484360b8373", "score": "0.7397596", "text": "def authorized?\n logged_in?\n end", "title": "" }, { "docid": "4d857065a38b5cacf755f484360b8373", "score": "0.7397596", "text": "def authorized?\n logged_in?\n end", "title": "" }, { "docid": "534a07400fe52f845349074a6d6d8ce1", "score": "0.7382775", "text": "def authorized?\n true\n end", "title": "" }, { "docid": "f1b49729b162516fb5919f0632525f4d", "score": "0.73294705", "text": "def authorized?\nlogged_in?\nend", "title": "" }, { "docid": "871d5a9b3ad7334d6d9143309fb26056", "score": "0.73241633", "text": "def authorized?(user)\n true\n end", "title": "" }, { "docid": "4f0a2f91374403fb7af82df9d19b967d", "score": "0.72854805", "text": "def authorized?\n current_user.logged_in?\n end", "title": "" }, { "docid": "0b474081ffe6e52cf8c25a174d7298f0", "score": "0.7271424", "text": "def authorized?\n true\n end", "title": "" }, { "docid": "aa5353fbc1e9e6f2a61d96bff3176e1c", "score": "0.72423655", "text": "def logged_in?\n authorized?\n end", "title": "" }, { "docid": "be9077c7fe9c6f9069acd78a2d41f01d", "score": "0.7232527", "text": "def authorized?\n logged_in?\n end", "title": "" }, { "docid": "15f2c223b835e7b2559a8859d626e4a2", "score": "0.722223", "text": "def authorized?\n logged_in? && current_user.login == \"ej0c\"\n end", "title": "" }, { "docid": "906f296462b4218020a2e949b8d2a8fa", "score": "0.7210149", "text": "def authorized?\n logged_in? && (admin? || member_actions.include?(action_name) || allow_member?)\n end", "title": "" }, { "docid": "942b050a91e1470f94f172c58fdb4648", "score": "0.7201613", "text": "def authorized?\n\t\t\t@authenticated\n\t\tend", "title": "" }, { "docid": "85d4390f7d20cc234e34e78553cd4f30", "score": "0.71706915", "text": "def authorized?\n if Vermonster::Client.connection.get(\"me\").status == 200\n true\n else\n false\n end\n end", "title": "" }, { "docid": "8f45a5690be85dbe7692719da84e2a17", "score": "0.71631277", "text": "def authorized?\n current_user.login == \"Admin\"\n end", "title": "" }, { "docid": "29b2d897d131b5e7861563af79192085", "score": "0.7111011", "text": "def authorized?\n\t\tif session[:authorization]\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "title": "" }, { "docid": "f6caae65d2ecd586e7cb8e54c94a4d1a", "score": "0.71029204", "text": "def authorized?(user)\n current_user == user\nend", "title": "" }, { "docid": "8cdeff2b4cb09eb9702afe103ddecc01", "score": "0.70694464", "text": "def logged_in?\n\tsession[:user] and CTRL.authorize(session[:user], session[:session])\nend", "title": "" }, { "docid": "5237108b88444f44d1ec6e81ec1d489b", "score": "0.70593375", "text": "def editable_by?(usr)\n if wiki.project &&\n wiki.project.module_enabled?('wiki') &&\n wiki.project.module_enabled?('redmine_advanced_wiki_permissions')\n !protected? || usr.wiki_allowed_to?(self, :protect_wiki_pages)\n else\n !protected? || usr.allowed_to?(:protect_wiki_pages, wiki.project)\n end\n end", "title": "" }, { "docid": "0bfe70ab381639d4792d734d4bcbdad2", "score": "0.7045647", "text": "def authorized?\n\n current_user && current_user.is_admin?\n end", "title": "" }, { "docid": "ab9b0ef3fabfda3364d62c9533c50bb3", "score": "0.7028348", "text": "def authorized?\n !!request.env['REMOTE_USER']\n end", "title": "" }, { "docid": "0553b99ee362c344efa010ba7ee70e6c", "score": "0.70230705", "text": "def authorized?\n\t\treturn self.authenticated?\n\tend", "title": "" }, { "docid": "9af99632b3fc4f43697e94cb5d071ef0", "score": "0.702157", "text": "def has_privilege?\n if (!logged_in?)\n redirect_to '/login' and return\n elsif (params[:user_id].to_i != current_user.id)\n redirect_to user_stories_path(current_user) and return\n end\n end", "title": "" }, { "docid": "e77fbd0277372962ef4bebf6c7512e83", "score": "0.69861484", "text": "def authorized?\n [email protected]['REMOTE_USER']\n end", "title": "" }, { "docid": "78c357d5ec141e9f18228841f3887e44", "score": "0.69537336", "text": "def user_authorized?(user)\n user == current_user || is_admin?\n end", "title": "" }, { "docid": "ebd7f590de949b2648ed5d039984c151", "score": "0.69519186", "text": "def authorized?\n\n return false unless current_user\n\n %w{ show index }.include?(action_name) || current_user.is_admin?\n end", "title": "" }, { "docid": "041b859704a364bfc9169f5d359c32f6", "score": "0.69461095", "text": "def must_authenticate \n if @authenticated_user && (@user_is_viewing_themselves != false)\n return true\n else\n request_http_basic_authentication(\"Social bookmarking service\") \n return false\n end \n end", "title": "" }, { "docid": "966e8ec5d0b92bfd04ca3748b1ae1cf0", "score": "0.69356984", "text": "def authorized?\n @authorized ||= current_user.present? # TODO: Check for authorization\n end", "title": "" }, { "docid": "308c348f2e050b2d65be043bd06e0be2", "score": "0.69269615", "text": "def owns?(wiki)\n true if self.id == wiki.user_id\n end", "title": "" }, { "docid": "fc63396f9167fa5e34874b3caf36fcc5", "score": "0.69173306", "text": "def is_authorized?\n @authorized\n end", "title": "" }, { "docid": "fc63396f9167fa5e34874b3caf36fcc5", "score": "0.69173306", "text": "def is_authorized?\n @authorized\n end", "title": "" }, { "docid": "bef31ff2933028c93ade06f3e22dbefa", "score": "0.6915456", "text": "def authorized?\n # TODO(samstern): Check for expired token.\n !(session[:user_id].nil?)\n end", "title": "" }, { "docid": "1dad9b79b740ec8881a0c4a9e2a6826b", "score": "0.6905347", "text": "def can_access?\n allows_current_user_access_to? :access\n end", "title": "" }, { "docid": "1bfb3eefcbcbadd5c8a42f3a3a92113d", "score": "0.6899661", "text": "def authorized?(user, action)\n\t\ttrue\n\tend", "title": "" }, { "docid": "3130a2d75f82a5a49f39ae7be693f257", "score": "0.68601763", "text": "def authorized?\n if $credentials != nil\n @Userz = User.first(:username => $credentials[0])\n if @Userz\n if @Userz.edit == true\n return true\n else\n return false\n end\n else\n return false\n end\n end\n end", "title": "" }, { "docid": "a067e9d2fe5c33a433d7fa7ca1f0f27a", "score": "0.6854953", "text": "def authorized?(tmp_user)\n user == tmp_user\n end", "title": "" }, { "docid": "f343c14fee03e4084848059541c26d0f", "score": "0.6853004", "text": "def authorized?(**args)\n true\n end", "title": "" }, { "docid": "dd433d2e67c4dc2adc7316414f9c0c0c", "score": "0.68505985", "text": "def ck_user\n ctrl = request.path_parameters['controller'].to_sym\n action = request.path_parameters['action'].to_sym\n flash[:warnings] = []\n\n\n # Are we handling an already authenticated system user?\n if session[:sysuser_id]\n @sysuser = Sysuser.find_by_id(session[:sysuser_id])\n return true if @sysuser\n end\n\n # Is the user requesting a public action?\n raise AuthenticationRequired unless is_public_action?(ctrl, action)\n\n # Ok, this is a public area - go ahead\n return true\n end", "title": "" }, { "docid": "b47d03af479487f2c8c1e5871f340ada", "score": "0.6836559", "text": "def authorize?(user)\n true\n end", "title": "" }, { "docid": "ee75bd3bfc801a5a51cee0661dad9d81", "score": "0.6826063", "text": "def authorized?\n\n if session[:current_user] != nil\n true\n else\n redirect '/not_authorized'\n end\n\n end", "title": "" }, { "docid": "d44935a009896c2a8fb93996378f06c5", "score": "0.6815362", "text": "def authenticated?\n (session[:drupal_user_role] && session[:drupal_user_role].values.include?('authenticated user')) ? true : false\n end", "title": "" }, { "docid": "72a760f2235a94c0871840294c83c3c2", "score": "0.6811436", "text": "def authorize?(_user)\n true\n end", "title": "" }, { "docid": "72a760f2235a94c0871840294c83c3c2", "score": "0.6811436", "text": "def authorize?(_user)\n true\n end", "title": "" }, { "docid": "5368c430541852aec3be68b7b5e9aff0", "score": "0.68101496", "text": "def authorized?\n !auth.nil?\n end", "title": "" }, { "docid": "7837eee33b9a83c79285a461210f01ed", "score": "0.6791706", "text": "def authorized?(user_id)\n logged_in_user_id == user_id\n end", "title": "" }, { "docid": "ac7a9db4a511f7b83d1a865ce860a7ea", "score": "0.6785838", "text": "def authorize?(user)\n true\n #user.login == \"administrador\"\n end", "title": "" }, { "docid": "7282a7ffc0d36872394f4d5204708bde", "score": "0.67829883", "text": "def authenticate\n\t logged_in? ? true : access_denied\n\tend", "title": "" }, { "docid": "136ea0b9cd27c16e4b566adfb8b46c14", "score": "0.67617196", "text": "def authorized?(user, request, params)\n true\n end", "title": "" }, { "docid": "6a8b284bd6833fce8603f451687a4b87", "score": "0.6755491", "text": "def authorized?\n %w(new create plans canceled thanks).include?(self.action_name) || \n ((self.action_name == 'dashboard') && current_user) ||\n admin?\n end", "title": "" }, { "docid": "6a8b284bd6833fce8603f451687a4b87", "score": "0.6755491", "text": "def authorized?\n %w(new create plans canceled thanks).include?(self.action_name) || \n ((self.action_name == 'dashboard') && current_user) ||\n admin?\n end", "title": "" }, { "docid": "d4db6255f01563b76d071f93118c0129", "score": "0.67430997", "text": "def authorize?(user)\n user && user.admin?\n end", "title": "" }, { "docid": "96baedd9962992ba854877e780a0bc57", "score": "0.6733262", "text": "def authorize?(user)\n user && user.moderator?\n end", "title": "" }, { "docid": "3f9a95080c6b991cb740279cc862cff9", "score": "0.6722887", "text": "def logged_in?\n session[:authorized] == true\n end", "title": "" }, { "docid": "8ee707bbfa1751b61e6b34f2f2225326", "score": "0.6721638", "text": "def login_required\n username, passwd = get_auth_data\n logged_in? && authorized? ? true : access_denied\n end", "title": "" }, { "docid": "b4068dcd2d9044836aa0d1acd12e35f1", "score": "0.67169994", "text": "def check_login\n head :forbidden unless self.current_user\n end", "title": "" }, { "docid": "93070a50327be5a7bd8bca549fad8b0b", "score": "0.67093533", "text": "def authorized?\n session[:password] == SETTINGS[\"password\"]\n end", "title": "" }, { "docid": "36d083124391ac9ee100707d3813d85e", "score": "0.67087024", "text": "def user_is_authenticated\r\n !!current_user\r\n end", "title": "" }, { "docid": "e39f130c254b472c6ae294432f55aea3", "score": "0.6707643", "text": "def authorized?(logged_in, username, controller_name, action_name, id)\n path = \"#{controller_name}/#{action_name}\"\n path = \"#{path}/#{id}\" if id\n if logged_in or [\"login\", \"logout\", \"check\"].include?(action_name)\n RAILS_DEFAULT_LOGGER.info \"Access granted to #{path}\"\n return true\n else\n RAILS_DEFAULT_LOGGER.info \"Access DENIED to #{path}\"\n return false\n end\n end", "title": "" }, { "docid": "29c568c9c623eb175a4f66ed6d75ed4f", "score": "0.6704161", "text": "def authorized?\n @current_user ||= User.first(:conditions => {:name => session[:cas_user]})\n !@current_user.nil?\n end", "title": "" }, { "docid": "5eabf1db5884d7f327eb17064a861ebd", "score": "0.66946435", "text": "def user_authorize\n if session[:user_id]\n return true\n else\n redirect_to new_session_path\n return false\n end\n end", "title": "" }, { "docid": "3216b32b87c1d55086c72b33a2a5752a", "score": "0.6690417", "text": "def authenticate\n\tlogged_in? ? true : access_denied \n end", "title": "" }, { "docid": "fff4936b5167aa2eacf32736a6ad73f2", "score": "0.66901916", "text": "def authenticate\n\t\t\tlogged_in? ? true : access_denied\n\t\tend", "title": "" }, { "docid": "1bfe2ebaf894977e616284f6d538c9fd", "score": "0.66769356", "text": "def consumer_site_is_authorized?\n return false unless current_user\n if user_owns_identity_url?\n return true if (trust = current_user.trusts.find_by_trust_root(openid_request.trust_root)) && trust.active?\n end\n return false\n end", "title": "" }, { "docid": "fce7cf471fc453a477cfbe2d31500e0f", "score": "0.66715354", "text": "def logged_in?\n\t\tif not current_user.present? then redirect_to \"/unauthorized\" and return false\n\t\tend\n\t\treturn true\n\tend", "title": "" }, { "docid": "a419dc25ad323dda04fcca1fa9837ec6", "score": "0.66710854", "text": "def is_authorized\n (!current_user.nil? and auth_types.include? current_user.user_attributes[:bor_type])\n end", "title": "" }, { "docid": "e5077087caf24508c2eda61a340c80dd", "score": "0.6665671", "text": "def luxury_search_authorized?\n authorized_for?(:action => :read)\n end", "title": "" }, { "docid": "9b3ac7e3f8a3fd1025baeae41e81b44c", "score": "0.66639286", "text": "def authorize_show\n user = requested_user(:user_id)\n if request.format.ics?\n unauthorized(\"Invalid privacy token.\") unless params[:pt] == user.privacy_token\n else\n unauthorized unless user == current_user\n end\n true\n end", "title": "" }, { "docid": "9cc833a97bc55ea0346afa270240a76e", "score": "0.6657388", "text": "def accessible_by?(user)\n return false unless user&.logged_in?\n\n accessible_by_user?(user)\n end", "title": "" }, { "docid": "18058f3caea01f9625b5d977a4bdcdbf", "score": "0.66561884", "text": "def has_access\n if !current_user\n redirect_to \"/error\"\n return false;\n end\n return true\n end", "title": "" }, { "docid": "c7e321ca8185275c7e0c34c29cdfd241", "score": "0.66528857", "text": "def authorized?(action = action_name, resource = nil)\n logged_in?\n end", "title": "" }, { "docid": "ac087ba7c84793256c0bdfec07b6253f", "score": "0.66513807", "text": "def authenticate\n logged_in? ? true : access_denied\n end", "title": "" }, { "docid": "5c4fcededa446cb5b1a31b8bdbb59c38", "score": "0.6650812", "text": "def access action\n\t\tif current_user\n \treturn true\n else\n \treturn false\n end\n\n\tend", "title": "" }, { "docid": "8152bbdef98ea681ba1520d50254bf5c", "score": "0.66491044", "text": "def view_authorized(current_user)\n return self.goal.public? || self.edit_authorized(current_user)\n end", "title": "" }, { "docid": "ff450f33d6f155bbfb96903e66834fe8", "score": "0.6635446", "text": "def authorized?\n !!@access_token\n end", "title": "" }, { "docid": "78e39319328bc6e2b232f30ddcd01f7f", "score": "0.66302425", "text": "def authorized?\n #if current_user is nil, return false\n #otherwise, check for authorization\n if current_user\n authorized = false\n\n #if user is admin, return true\n if session[:admin] == true\n authorized = true\n else\n #puts authorized user ids in an array and check against\n #the current_user id\n authorized_users = Array.new\n\n authorized_users.push(@project.user_id)\n @project.collaborators.each do |col|\n authorized_users.push(col.user_id)\n end\n\n authorized_users.each do |user|\n # binding.pry\n if current_user.id == user\n authorized = true\n end\n end\n #authorized user not found\n if !authorized\n false\n end\n end\n\n #return result\n authorized\n else\n #current_user is nil, return false\n false\n end\n end", "title": "" }, { "docid": "3300afd1d8f6f25bf57fcf73cd4bb948", "score": "0.6622688", "text": "def authenticate\n \tlogged_in? ? true : access_denied\n end", "title": "" }, { "docid": "3d092cd586ca587bc28b846fa362fbce", "score": "0.6615481", "text": "def is_authenticated?\n end", "title": "" }, { "docid": "2b0e565c4d8b960ab5e34eb4dc96b0f6", "score": "0.66134375", "text": "def show_private_tab\n current_user && (current_user.admin? || # if current_user is an admin\n current_user.premium? || # current_user is a premium\n current_user.wiki_collaborations.any?) # current_user has any private wiki collaborations\n end", "title": "" }, { "docid": "8f76fb654819a8216797cfd13e568655", "score": "0.66089123", "text": "def authorized?\n !current_user.nil? || current_user.is_a?(Administrator)\n end", "title": "" }, { "docid": "d0b5f603ef16a4a1350a6a8b1d181170", "score": "0.66068417", "text": "def can_access?(user)\n user == self.user\n end", "title": "" }, { "docid": "0fc452f67140d408331ccac75b15049e", "score": "0.66054755", "text": "def authorized?\n return if session[:access_token]\n end", "title": "" }, { "docid": "9f91f7ce2b0672f82c449a2b0c5ff72e", "score": "0.66031504", "text": "def public_user?\n \tcurrent_user.username.eql? \"public_user\"\n end", "title": "" }, { "docid": "c4992facd8641e6c7360b3d56334e21d", "score": "0.65854335", "text": "def logged_in?\n act = StudyListAction.new(self)\n act.get\n !(act.redirected_to_login?)\n end", "title": "" }, { "docid": "af5f9e233a7ec97dd20946212a03e417", "score": "0.65837556", "text": "def authenticate\n \t\tlogged_in? || access_denied\n \tend", "title": "" }, { "docid": "adc16b2dc07092cb71f3fd89d0239dd2", "score": "0.658121", "text": "def authorized?\n @authorized ||= User.get(@env).present?\n end", "title": "" }, { "docid": "63622359c8951857497e1a452ae18c8a", "score": "0.657978", "text": "def logged_in?\n return false unless @auth_header\n true\n end", "title": "" }, { "docid": "fdc8669dc6491727e331d1975d370936", "score": "0.6579716", "text": "def check_is_login_required\n authorized_denied unless logged_in?\n end", "title": "" }, { "docid": "a309a1148654bd27221dfdf117df0803", "score": "0.6569345", "text": "def authok?\n @authok\n end", "title": "" }, { "docid": "a309a1148654bd27221dfdf117df0803", "score": "0.6569345", "text": "def authok?\n @authok\n end", "title": "" }, { "docid": "a309a1148654bd27221dfdf117df0803", "score": "0.6569345", "text": "def authok?\n @authok\n end", "title": "" }, { "docid": "a309a1148654bd27221dfdf117df0803", "score": "0.6569345", "text": "def authok?\n @authok\n end", "title": "" }, { "docid": "450a5ce76273954e9bdccfc90051a22a", "score": "0.6567721", "text": "def logged_in?\n !session[:user_id].nil? #&& User.find(session[:user_id]).owns(@current_site)\n end", "title": "" }, { "docid": "fd34bdae846692476c89a1957b60ad5e", "score": "0.65663946", "text": "def view_authorized(current_user)\n return self.public? || self.edit_authorized(current_user)\n end", "title": "" }, { "docid": "ce4b651d1533d3275c400ab8d9f43747", "score": "0.65642", "text": "def allow_access\n !current_cas_user.nil?\n end", "title": "" }, { "docid": "766877cff3d382dc840641ba1ef3ca3d", "score": "0.6564113", "text": "def authorized?\n if logged_in? || posing_as_logged_out?\n super_user || current_user.admin?\n end\n end", "title": "" }, { "docid": "3c619e8a995aab860a3364c9f25ba214", "score": "0.6560507", "text": "def authorized(m)\n m.user == current_user\n end", "title": "" }, { "docid": "77cdf3c180eb261b870a3b8554ed6854", "score": "0.6557074", "text": "def authenticate\n logged_in? || access_denied\n end", "title": "" } ]
98d678713563ff78be616c6ed21d10c0
Returns a list of all posts, filtered by argument. get all (this is a very expensive query) d.posts_all get all posts matching ruby d.posts_all(:tag => WWW::Delicious::Tag.new('ruby')) === Options :tag:: a tag to filter by. It can be either a WWW::Delicious::Tag or a +String+.
[ { "docid": "c5dc597ed5e27f96e93b3134a842f706", "score": "0.6833269", "text": "def posts_all(options = {})\n params = prepare_posts_params(options.clone, [:tag])\n response = request(API_PATH_POSTS_ALL, params)\n parse_post_collection(response.body)\n end", "title": "" } ]
[ { "docid": "5caf6ca47905bf18f1bbb5a15fca4db2", "score": "0.6671368", "text": "def posts\n Post.filter(:tag_id => self.tag_id)\n end", "title": "" }, { "docid": "1f2734168447ea52501b03277749f199", "score": "0.6384473", "text": "def all(options = {})\n response= handle_errors { self.class.get('/all', :query => options)}\n response[\"posts\"][\"post\"].collect{|i| Rubycious::Post.new(i)}\n end", "title": "" }, { "docid": "c3f5670ce065a67b48ceccdb330103df", "score": "0.6282713", "text": "def find_all_tagged_with(*args)\n find_tagged_with(*args)\n end", "title": "" }, { "docid": "718604023a28b8cc477aabe833a31dbe", "score": "0.6199653", "text": "def posts_by_tags(tags, page = 1, limit = options[:limits][:per_page])\n tags = clean_tags(tags)\n posts_url = self.class::OLD_API ? 'post.json' : 'posts.json'\n do_request(posts_url, tags: tags, page: page, limit: limit)\n end", "title": "" }, { "docid": "bd617b99d1ae7b70862845ec9a7e4825", "score": "0.6169856", "text": "def posts(options={})\n tags = self.self_and_descendants\n post_ids = Tagging.filter([[:tag_id, tags.collect(&:id)]]).select(:post_id).collect(&:post_id).uniq\n query = Post.filter([[:id, post_ids]]).filter(:is_draft => false).reverse_order(:created_at)\n if options[:non_sticky] && sticky = self.sticky_post\n query = query.filter(\"posts.id <> ?\", sticky.id)\n end \n if options[:page] \n query = query.paginate(options[:page], options[:per_page] || 10)\n end\n query\n end", "title": "" }, { "docid": "84b90534c88a0976ea2c276f0b9fa979", "score": "0.6169623", "text": "def all_by_tag(*tags)\n find(:all).by_tag(*tags)\n end", "title": "" }, { "docid": "84b90534c88a0976ea2c276f0b9fa979", "score": "0.6169623", "text": "def all_by_tag(*tags)\n find(:all).by_tag(*tags)\n end", "title": "" }, { "docid": "5e0c835dcd0067ef8104a343eb2907b2", "score": "0.61169547", "text": "def index\n if params[:tag]\n @posts = Post.tagged_with(params[:tag])\n elsif params[:search]\n @posts = Post.search(params[:search])\n else\n @posts = Post.all.newest\n end\n end", "title": "" }, { "docid": "a89fcc49ecd5326cc9b03dbf84479b16", "score": "0.6078922", "text": "def all_post\n end", "title": "" }, { "docid": "fb4fa7e05c0ef17574213bd92b7dc848", "score": "0.59822285", "text": "def posts\n\t\tif params[:query] && params[:query].empty?\n\t\t\t@search_results = Post.where(guest: false).includes(:taggings).page(params[:page])\n\t\telse\n\t\t\t@search_results = Post.where(guest: false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.includes(:taggings)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.search_by_tags(params[:query]).page(params[:page])\n\t\tend\n\t\t\n\t\trender 'single_search'\n\tend", "title": "" }, { "docid": "871900d3df27bf990bb04563fe4f1f68", "score": "0.5972088", "text": "def index \n if params[:tag]\n @posts = Post.tagged_with(params[:tag])\n else\n @posts = Post.all.paginate(page: params[:page], per_page: 20)\n end\n end", "title": "" }, { "docid": "f87ca5e4a4687aa37218b401aa48e75e", "score": "0.5929235", "text": "def index\n if params[:tag]\n @posts = Post.most_recent.published.paginate(:page => params[:page], per_page: 6).tagged_with(params[:tag])\n else\n @posts = Post.most_recent.published.paginate(:page => params[:page], per_page: 6)\n end\n end", "title": "" }, { "docid": "d4d441509ae8fb751b450ee7ad32c8ad", "score": "0.58208066", "text": "def index\n get_posts_with_filter\n end", "title": "" }, { "docid": "6704177917acce72fa40fe5b12792a32", "score": "0.5820268", "text": "def all_posts( opts={} )\n @loc = geo_locate(opts[:location])\n results = []\n 15.times do |page|\n results << geocode(:lat => @loc[:lat], :lng => @loc[:lng], :distance => (opts[:distance] || 10), :per_page=>100, :page=>page+1 ) if @loc and not opts[:keyword]\n results << keyword(:keyword=>opts[:keyword], :per_page=>100, :page=>page+1) if opts[:keyword] and not @loc\n results << geocode_and_keyword(:keyword=>opts[:keyword], :lat => @loc[:lat], :lng => @loc[:lng], :distance => (opts[:distance] || 10), :per_page=>100, :page=>page+1 ) if @loc and opts[:keyword]\n end\n results.flatten!\n\n # get text for each tweet\n @tweets = []\n results.each{ |result| result.each { |t| @tweets << t } }\n\n # get time range of tweets\n @first_time = @tweets.sort!{|a,b| a.created_at <=> b.created_at}.last.created_at\n @last_time = @tweets.first.created_at \n return [@tweets, @first_time, @last_time]\n end", "title": "" }, { "docid": "53e76a4f39d8c0ef9b7bd0ccd2876c6b", "score": "0.5750522", "text": "def index\n if params[:all]\n @posts = Post.all\n elsif\n @posts = Post.tagged_with(\"blog\")\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "title": "" }, { "docid": "3bbcb93d43ef6b4b84b9f842c16fd9cc", "score": "0.5738891", "text": "def get_posts(name)\n posts = []\n blog(name).articles.each do |post|\n posts.push(post)\n end\n return posts\n end", "title": "" }, { "docid": "7aa87d341e38eec2e511019c52cfecbe", "score": "0.5718962", "text": "def get_all_posts(site, start = 0, total = nil)\n first_read = read(site, {:num => 50,:start => start}).perform\n raise %Q(Tumblr response was not successful, \"#{first_read.code}: #{first_read.message}\") if !first_read.success?\n posts = self.class.get_posts(first_read)\n offset = start + posts.count\n post_total = total || first_read['tumblr']['posts']['total'].to_i\n if post_total > offset\n posts |= get_all_posts(site, offset, post_total)\n end\n posts\n end", "title": "" }, { "docid": "269a39008e4980f92397f353a983a70f", "score": "0.56954455", "text": "def get_all_posts()\n return Post.where(:parent_id => nil )\n end", "title": "" }, { "docid": "cedf0b3742cd74de61d7dafbfdae47a7", "score": "0.56941354", "text": "def call(_obj, args, _ctx)\n { ids: ::Post.where(\"posts.title like ?\", \"%#{args[:title]}%\").pluck(:id) }\n end", "title": "" }, { "docid": "835ecb83dc116c7f58230fbc8b01c278", "score": "0.5681666", "text": "def listPosts(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n thread = args.first\n options.merge!(:thread => thread) if ([:ident, :link] & options.keys).empty?\n response = get('threads/listPosts', options)\n end", "title": "" }, { "docid": "8c3af276744b16339446cc7629d42c2e", "score": "0.5678215", "text": "def all\n@posts = Post.all\nend", "title": "" }, { "docid": "3cab2bae5e00d3b0e51c6b412ef8fdb7", "score": "0.56744456", "text": "def index\n @posts = if params[:tag]\n Post.tagged_with(params[:tag])\n else\n Post.scoped\n end\n @posts = @posts.where(:published => true).order(\"created_at DESC\")\n @posts = @posts.paginate(:page => params[:page], :per_page => 4) unless params[:count] == \"all\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.rss { render :layout => false }\n format.xml { render :xml => @posts }\n end\n end", "title": "" }, { "docid": "7c089a2a8984368b3063a7f9c8761790", "score": "0.56670755", "text": "def all(arg={})\n find(:all, :conditions => arg)\n end", "title": "" }, { "docid": "60773203db8df995981b809046a023d6", "score": "0.5661165", "text": "def get_posts(initial_scope, tag, order, filter, running = true)\n if initial_scope.nil?\n posts = Post.all\n else\n posts = initial_scope\n end\n\n unless tag.blank?\n posts = posts.tagged_with(tag)\n end\n\n # apply scopes for ordering\n posts = posts.popular if order == \"popular\"\n posts = posts.newest if order == \"newest\"\n posts = posts.liked if order == \"liked\"\n\n # apply scopes for filtering\n posts = posts.last_week if filter == \"week\"\n posts = posts.last_month if filter == \"month\"\n\n # only return running videos\n if running\n #posts = posts.running\n end\n\n return posts\n end", "title": "" }, { "docid": "88258bd1078115d31844f3891602c7f3", "score": "0.5652819", "text": "def get_all_posts\n @posts = []\n results = Post.all\n results.each do |post|\n @posts << post.to_hash\n end\n end", "title": "" }, { "docid": "77cb9186e00ae812d4293a1cc8fd2c79", "score": "0.56400716", "text": "def get_posts\n if logged_in? && current_user.has_role?('administrator')\n @blog.posts.find(:all, {:limit => 10, :order => \"updated_at DESC\"})\n else\n @blog.enabled_posts_shortlist\n end\n end", "title": "" }, { "docid": "13ce4580285f7f26b0a44c24489a5746", "score": "0.5632751", "text": "def index\n if params[:tag]\n @posts = Post.tagged_with(params[:tag]).includes(:tags)\n elsif params[:category]\n @posts = Post.includes(:tags).where(category: params[:category])\n else\n #@posts = Post.all\n @posts = Post.includes(:tags)\n end\n respond_with @posts, methods: [:tag_list, :tag_ary]\n end", "title": "" }, { "docid": "a4c902158460bd0aafe1809d49f62c36", "score": "0.5626402", "text": "def index\n options = {:page => params[:page] || 1, :per_page => 2}\n @posts = (params[:tag].blank? ? Post.published.search(params[:search], options) : Post.published.paginate_tagged_with(params[:tag], options))\n respond_to do |format|\n format.html{}\n format.xml{ render :xml => @posts }\n end\n end", "title": "" }, { "docid": "d49715b95e4bee8e8f35613ea048415d", "score": "0.5617135", "text": "def index\n\t #this accesses all the posts from the model 'Post' and stores them in @post\n\t #the includes method ensures that comments will be loaded simultaneously with Posts\n\t if params[:tag]\n @posts = Post.includes(:comments).order(\"created_at DESC\").tagged_with(params[:tag]).page(params[:page]).per(21)\n\t else\t\n\t @posts = Post.includes(:comments).order(\"created_at DESC\")\n\t end\n\t \n\n\n\t\t@q = @posts.search(params[:q])\n\t\t@posts = @q.result(:distinct => true).page(params[:page]).per(21)\n\t #This enables atom feeds\n\t # respond_to do |format|\n # format.html\n # format.atom\n # format.rss { render :layout => false } #index.rss.builder\n # end\n\tend", "title": "" }, { "docid": "443d082165d72d25a2102ff0f30b7fb4", "score": "0.56136423", "text": "def get(options = EMPTY_HASH)\n parameters = Specification.new(\n tag: Types::Tags,\n dt: Types::Time,\n url: Types::URL,\n meta: Types::Boolean\n ).parameters(options)\n posts_from client.get(\"/posts/get\", parameters)\n end", "title": "" }, { "docid": "5171e48ac21de047dfea0cea02f3c25c", "score": "0.55896544", "text": "def get_all_posts\n @posts = []\n\n Post.all.each do|post|\n @posts << post.to_hash\n end\n end", "title": "" }, { "docid": "0f7f5dbcb34656f24e411361ee69ed2e", "score": "0.5544054", "text": "def index\n if params[:search_term]\n @posts = @posts.search(params[:search_term]).page(params[:page])\n else\n @posts = @posts.page(params[:page])\n end\n end", "title": "" }, { "docid": "597c54ba87ff849e82f98590b0cfbb3d", "score": "0.5543045", "text": "def collect_blog_posts\n\t\treturn @all_blog_posts\n\tend", "title": "" }, { "docid": "a06de53eff09511399db6df08a5ecae3", "score": "0.55379826", "text": "def apply_tag_filter\n return if params[:tag].blank?\n params[:tag].tap do |tag|\n @posts = @posts.tagged_with tag\n add_breadcrumb \"by tag \\\"#{tag}\\\"\"\n end\n end", "title": "" }, { "docid": "f3a80b95e5bae7fcd6375f39b0ecbbf1", "score": "0.553189", "text": "def index\n if params[:tag]\n @posts = Post.tagged_with(params[:tag])\n else\n @posts = Post.order(\"created_at desc\")\n end\n @posts = @posts.page params[:page]\n\nend", "title": "" }, { "docid": "2785ea7d54fb8548cd2510b866c8afa3", "score": "0.5517498", "text": "def all(*args)\n find(:all, *args)\n end", "title": "" }, { "docid": "aff3c4814563603dd487b3ae56114a1f", "score": "0.55120546", "text": "def get_posts_for_year_and_tags\n posts = get_posts_for_year\n posts = get_posts_for_tags posts\n posts\n end", "title": "" }, { "docid": "f4f932ea6bc0ebbeeec8f128094c4b04", "score": "0.5505935", "text": "def retrieve_posts(dir); end", "title": "" }, { "docid": "f5238c9ea20989a0a17dec12e469693b", "score": "0.5500753", "text": "def search\n terms = params[:query].split\n query = terms.map { |term| \"title like '%#{term}%' OR body like '%#{term}%' OR tags like '%#{term}%'\" }.join(\" OR \")\n \n @posts = Post.where(query).order(\"created_at DESC\").first(10)\n end", "title": "" }, { "docid": "4cc3730205408d43a3d3b72fe0899df1", "score": "0.54990566", "text": "def all(*args)\n find(:all, *args)\n end", "title": "" }, { "docid": "4cc3730205408d43a3d3b72fe0899df1", "score": "0.54990566", "text": "def all(*args)\n find(:all, *args)\n end", "title": "" }, { "docid": "d7e15a7cd5d7bf9b8b07126f3d5d142a", "score": "0.5487569", "text": "def find_with_tags(*tags)\n options = tags.extract_options!\n self.all(options.merge(:tags => tags))\n end", "title": "" }, { "docid": "649f7e2ed3c78d5ea0aa3da847021055", "score": "0.5484262", "text": "def retrieve_posts\n query = \"SELECT * FROM `wp_posts` WHERE `post_type` = 'post' AND post_status = 'publish'\"\n db[query]\n end", "title": "" }, { "docid": "927ee7d4801e6d15ff8645b90d02114f", "score": "0.5484121", "text": "def index\n\t@posts = list_posts\n end", "title": "" }, { "docid": "7e9f97f04dded294a2c70fdd6d83f107", "score": "0.54771644", "text": "def search_by_tags\n tag_ids = params[:term].present? ? Tag.search(params[:term]).select(:id) : []\n posts = PostsQuery.new.by_tags(tag_ids)\n related_posts = PostsQuery.new(posts).related_posts\n posts = posts.merge(related_posts.distinct)\n posts = posts.where.not(id: User.unscoped.find(@user_id).blocking_posts) if @user_id.present?\n posts = posts.paginate(pagination_params)\n render json: posts, user_id: @user_id, meta: pagination_dict(posts)\n end", "title": "" }, { "docid": "1f34bec974c60dd3d964430233a5ab41", "score": "0.5457558", "text": "def refresh_posts( tagger, all_tags = nil )\n require 'news/feed'\n\n all_tags ||= Tag.find(:all)\n\n puts \"refreshing posts with: #{self.klass}\"\n feed = self.klass.constantize.new( curb_get(self.url), self.content_type )\n\n feed.items.each_with_index do|item,count|\n timer = Time.now\n puts \"loading post: #{item.title}...\"\n post = Post.new(:title => item.title,\n :link => item.links.first,\n :image => item.image,\n :body => item.body,\n :author => item.authors.first,\n :published_at => item.published,\n :feed_id => self.id,\n :tag_list => item.categories )\n post.summarize!\n # check for images in the body pick the first one as the icon to use and use rmagick to scan it down\n post.retag(tagger,all_tags) if post.tag_list.empty?\n puts post.permalink\n other = Post.find_by_title(post.title)\n if post.valid? and (other.nil? or other.published_at != post.published_at)\n post.save!\n puts \"post: #{item.title}, loaded in #{Time.now - timer} with tags: #{post.tag_list.inspect}, item: #{count} of #{feed.items.size}\"\n else\n puts \"skipping: #{item.title}, item: #{count} of #{feed.items.size}\"\n end\n end\n end", "title": "" }, { "docid": "15f3fa210c025bfc5d5f20956f025811", "score": "0.5451591", "text": "def index\n @posts = Post.includes(:tags).all.page(params[:page]).per(PER).order(id:\"DESC\")\n end", "title": "" }, { "docid": "a8dc567c42cff0417fb060ecd5b81842", "score": "0.544775", "text": "def get_posts posts\n # Get the 6 latest -- TODO this should be configurable\n limit = 6\n # Our page number\n page = (params[:page].to_i - 1) || 1\n # Our query if there is one set\n @query = params[:query] || ''\n # Get the latest posts by go_live\n posts = posts.order('go_live DESC')\n # Make sure we are only getting those that are published\n posts = posts.where( :state => :published )\n # Make sure we are talking about posts or messages\n t = Post.arel_table\n posts = posts.where( t[:object_type].matches(:post).or(t[:object_type].matches(:message)))\n # Make sure they don't have a password.. those are \"private\"\n posts = posts.where( :password => nil )\n # If a query is set, use it\n posts = posts.where([\"content like ?\", '%'+@query+'%'] ) if @query.present?\n # Get our filtered post count for pagination\n filtered_post_count = posts.count\n # Limit the number of posts to show\n posts = posts.limit(limit)\n # Set the offset if we aren't on the first page.\n posts = posts.offset(limit.to_i * page.to_i) if page > 0\n # Need this to show a previous/next button\n @pagination_number_of_pages = (filtered_post_count / limit) +1\n @pagination_current_page = (page.to_i + 1) > 0 ? (page.to_i + 1) : 1\n\n posts\n end", "title": "" }, { "docid": "d106cc0f1bc0f578b93152e183c45c55", "score": "0.54456896", "text": "def index\n @posts = Post.search(params[:search]).sort(params[:sort]).all.page(params[:page]).per(12)\n end", "title": "" }, { "docid": "37e84eea325c64d39155ab5f11762961", "score": "0.5442161", "text": "def posts\n posts = @client.entries(content_type: 'post').items\n posts || []\n end", "title": "" }, { "docid": "73103adcd8677601c66dae2a33d609fa", "score": "0.54053545", "text": "def query(query)\n init\n @query = @query_vars = Railspress::Functions.wp_parse_args(query)\n get_posts\n end", "title": "" }, { "docid": "c3495eed4e0f90388f84e111896a473e", "score": "0.53842974", "text": "def read_posts(dir)\n read_publishable(dir, \"_posts\", Document::DATE_FILENAME_MATCHER)\n end", "title": "" }, { "docid": "2866f35defdfa7b506253e7ea052db87", "score": "0.5373096", "text": "def find_tagged_with(*args)\n options = find_options_for_find_tagged_with(*args)\n options.blank? ? [] : find(:all, options)\n end", "title": "" }, { "docid": "5a52e82564e2db07ded025950caca594", "score": "0.53671473", "text": "def posts_list\n posts = Post.all.published.order(score: :desc, created_at: :desc)\n post_tags = Post.published.order(score: :desc, created_at: :desc).map { |post| Post.includes(:tags, :taggings).find_by(id: post.id).tags }\n categories = Category.all\n tags = Tag.all\n\n render_json(posts: posts, categories: categories, tags: tags, post_tags: post_tags)\n end", "title": "" }, { "docid": "e3c4ae91ea263e2b4ef7b28dc95c8c5c", "score": "0.5357183", "text": "def posts(opts)\n response = get(\"posts\", opts)\n response\n end", "title": "" }, { "docid": "c14aa93925d30743bdc4040395cab79a", "score": "0.535484", "text": "def index\n if PostSetting.all.count > 0\n @posts = Post.order(\"created_at desc\").paginate(:page => params[:page], :per_page => PostSetting.last.posts_per_page)\n else\n @posts = Post.order(\"created_at desc\").paginate(:page => params[:page], :per_page => 10)\n end\n if params[:tag]\n @posts = @posts.tagged_with(params[:tag])\n else\n @posts = @posts.all\n end\n end", "title": "" }, { "docid": "fd41cdbf7602ad301b89835d0566e101", "score": "0.5337385", "text": "def index\n\n if params[:tag]\n @posts = Post.tagged_with(params[:tag])\nelsif params[:category]\n @category_id = Category.find_by(name: params[:category]).id\n @posts = Post.where(category_id: @category_id).order(\"created_at DESC\")\nelsif params[:subcategory]\n @subcategory_id = Subcategory.find_by(name: params[:subcategory]).id\n @posts = Post.where(subcategory_id: @subcategory_id).order(\"created_at DESC\")\nelse\n @posts = Post.all.order(\"created_at DESC\")\nend\n\n\n @posts = @posts.page params[:page]\nend", "title": "" }, { "docid": "a3d642660abf6efb8c81ea72e164a3a1", "score": "0.5329774", "text": "def index\n @posts_in_pages = cache(\"post_index\", tag: params[:tag] || \"none\") do\n posts = PostArchive.list_published_order_by_id_desc(tag: params[:tag])\n\n posts.in_groups_of(POSTS_PER_PAGE, false)\n end\n\n @pagination = {\n curr_page: params[:page].try(:to_i) || 1,\n total_pages: @posts_in_pages.count,\n }\n\n expires_in(10.minutes, public: true)\n end", "title": "" }, { "docid": "805feb2e70741963933982f5c35c6b86", "score": "0.5299961", "text": "def index\n if params.has_key?(:content)\n @rent_posts = RentPost.order(\"created_at DESC\").page(params[:page]).per(5).where('content like ?', \"%#{params[:content]}%\")\n else\n @rent_posts = RentPost.where(rented: false).order(\"created_at DESC\").page(params[:page]).per(5)\n end\n end", "title": "" }, { "docid": "f991e4fcd0971c59a5622dce4f60e1aa", "score": "0.52989763", "text": "def tags(params)\n if validate_tags(params)\n db = connect_to_db()\n db.results_as_hash = true\n result = db.execute('SELECT posts.* FROM tags INNER JOIN posts_tags ON posts_tags.tagId = tags.id INNER JOIN posts ON posts.id = posts_tags.postId WHERE tags.id=?', params[\"id\"])\n return {posts: result}\n else\n return {error: \"There is no such tag!\"}\n end\n end", "title": "" }, { "docid": "0e4d3285b64b6124e41a7a5c68d0f4b7", "score": "0.5296276", "text": "def index\n # TODO: implement listing all posts\n end", "title": "" }, { "docid": "03aeb29507af7cb95a1709d8096a0c27", "score": "0.5281486", "text": "def find_tagged_with(*args)\n options = find_options_for_find_tagged_with(*args)\n options.blank? ? [] : find(:all, options)\n end", "title": "" }, { "docid": "2a361420f04fd3cc22b2d7b6fd0c715e", "score": "0.52756715", "text": "def index\n @page_title = \"Posts\"\n # if params[:tag]\n # @posts = Post.order(created_at: :desc).tagged_with(params[:tag]).paginate(:page => params[:page], :per_page => 3)\n # @firstLetter = ActsAsTaggableOn::Tag.all.order(\"name\").group_by{|letter| letter.name[0]}\n # @tags = ActsAsTaggableOn::Tagging.limit(8).includes(:tag).where(context: 'tags').map { |tagging| tagging.tag.name }.uniq\n # else\n # @posts = Post.order(created_at: :desc).paginate(:page => params[:page], :per_page => 6)\n # end\n @posts = Post.order(created_at: :desc).paginate(:page => params[:page], :per_page => 6)\n @posts_with_tag = Post.order(created_at: :desc).tagged_with(params[:tag]).paginate(:page => params[:page], :per_page => 3)\n respond_to do |format|\n format.html {}\n format.js {}\n end\n end", "title": "" }, { "docid": "a7b09e8511b9f058c2997a4e10437080", "score": "0.5268669", "text": "def find_tags\n @tags = BlogPost.tag_counts_on(:tags)\n end", "title": "" }, { "docid": "97105678abf6977f5a08a2e1ffba538d", "score": "0.52619714", "text": "def the_posts_pagination( args = {} )\n get_the_posts_pagination( args )\n end", "title": "" }, { "docid": "dbac52084aa3801acf430fc02c581f56", "score": "0.5250155", "text": "def call\n if category.blank? && search.blank?\n posts = Post.by_branch(branch).all\n elsif category.blank? && search.present?\n posts = Post.by_branch(branch).search(search)\n elsif category.present? && search.blank?\n posts = Post.by_category(branch, category)\n elsif category.present? && search.present?\n posts = Post.by_category(branch, category).search(search)\n else\n end\n end", "title": "" }, { "docid": "0b0f775e330e5dbfae10908989a32f97", "score": "0.5244423", "text": "def find_all( opts = {} )\n # opts[:order] ||= [:posted_at.desc, :id.asc]\n model.all( opts )\n end", "title": "" }, { "docid": "d2cc65ac4a98137241e7909260779f38", "score": "0.521316", "text": "def index\n if params[:tag]\n @articles = Article.tagged_with(params[:tag], on: 'tags')\n elsif params[:category]\n @articles = Article.tagged_with(params[:category], on: 'categories')\n else\n @articles = Article.all\n end\n end", "title": "" }, { "docid": "47aee2c779d1495c072c29784ac3025d", "score": "0.52119535", "text": "def retrieve_posts\n # Get posts\n rss = RSS::Parser.parse(AWL_RSS_URL)\n\n # Grab shortened URLs\n links = rss.items.map(&:guid).map(&:content)\n\n @articles = []\n\n links.each do |link|\n @articles << Article.new(link)\n end\n\n # TODO: Only grab the tags for articles that haven't already be tweeted\n @articles.map(&:retrieve_tags)\n end", "title": "" }, { "docid": "c72fe92d4e4f2876d2cb31091badc709", "score": "0.52076274", "text": "def posts\n @posts ||= retrieve_posts\n end", "title": "" }, { "docid": "b8c40377e28db69d0391c3a155cd694f", "score": "0.51993126", "text": "def all\n response= handle_errors{ self.class.get('/get')}\n response[\"tags\"][\"tag\"].collect do |tag| \n t= Rubycious::Tag.new(tag)\n end\n end", "title": "" }, { "docid": "ca0501060e4f220a532675869f307d06", "score": "0.51961744", "text": "def all_posts\r\n\t\t#eager load author to avoid N+1 query\r\n\t\tmy_posts = extract_post_info( posts.includes(:author) )\r\n\t\tleft_posts = extract_post_info( left_friends_posts.includes(:author) )\r\n\t\tright_posts = extract_post_info( right_friends_posts.includes(:author) )\r\n\r\n\t\tresult = my_posts + left_posts + right_posts\r\n\t\t#sort by udpated_at, so the most recent post is at top\r\n\t\tresult.sort_by {|post| post[:post].updated_at }.reverse[0..9]\r\n\tend", "title": "" }, { "docid": "a39fdec9a7659a6f8bcb9dcd11f9ead9", "score": "0.51855445", "text": "def user_posts(user, tag = nil)\n was_subscribed = true\n ret = []\n\n # unless we already subscribed, subscribe to user\n unless subs.keys.include?(user)\n sub(user)\n was_subscribed = false\n end\n \n # grab list of user's posts\n inbox_dates.keys.each do |date|\n ret += inbox(date).find_all do |post| \n post['user'] == user && (tag == nil || post['tags'].include?(tag))\n end\n end\n\n # unsubscribe from user unless we were already subscribed\n unsub(user) unless was_subscribed\n\n # return list of user's posts\n ret\n end", "title": "" }, { "docid": "09d856b2bfa3f8de3effb0244fdc93da", "score": "0.51835793", "text": "def index\n @posts = PostService.getAllPosts\n end", "title": "" }, { "docid": "d21c9fe4a319b36b39dff1728d86e7c8", "score": "0.51826185", "text": "def getPosts()\n\t\tself.post\n\tend", "title": "" }, { "docid": "7219318971062ba47050229b6594c07c", "score": "0.51823944", "text": "def index\n posts = Post.all\n @view.list_all_posts(posts)\n # TODO: implement listing all posts\n end", "title": "" }, { "docid": "e22916367fd039c9966389b8ca04f6ff", "score": "0.51755106", "text": "def index\n filter_by_type unless filter_by_tag\n @blog_posts ||= BlogPost.all\n @blog_posts = @blog_posts.paginate(page: params[:page], per_page: 25)\n end", "title": "" }, { "docid": "b1838368fd6e662f703e14c0ff106590", "score": "0.51740605", "text": "def search\n tag_list = params[:tag_list]\n @riders = Rider.master.tagged_with(tag_list)\n end", "title": "" }, { "docid": "962f06d8a99797c6ca57bfc1d40acaf5", "score": "0.5172358", "text": "def list_post\n \t@post = Post.find(params[:id])\n end", "title": "" }, { "docid": "43e74560b870af4de528e032ecba4d05", "score": "0.5160155", "text": "def posts\n return [] unless valid?\n\n @posts ||=\n Course::Discussion::Post.forum_posts.from_course(@course).\n includes(topic: { actable: :forum }).\n calculated(:upvotes, :downvotes).\n where(created_at: start_time..end_time).\n where(creator_id: @user)\n end", "title": "" }, { "docid": "7bfc943491b44372aa89abf1c7e6808d", "score": "0.51551217", "text": "def index\n\t\t@posts = Post.all\n\t\tif params[:search]\n \t\t@posts = Post.search(params[:search]).order(\"created_at DESC\")\n \t\telse\n \t\t@posts = Post.all.order('created_at DESC')\n \t\tend\n\tend", "title": "" }, { "docid": "f2a1d1c44b06b3f24ec2f9e310833afd", "score": "0.51542157", "text": "def index\n PostCleanupJob.perform_later\n if(params[:tag])\n # this will handle the tag links search\n posts = Post.order(updated_at: :desc).search(params[:tag])\n else\n # the query will be used for the search functionality, the search method\n # is defined in the post model\n @query = params[:query]\n posts = Post.order(updated_at: :desc).search(params[:query])\n end\n\n set = Set.new(posts)\n @posts = set.to_a\n\n # for side_bar display variables\n @categories = Category.all\n @favourites = Favourite.where(user: current_user)\n end", "title": "" }, { "docid": "95266cc87d7e619293a6a302e065406c", "score": "0.5153581", "text": "def tagwise(tag_css_class, post_css_class)\n html = \" \"\n Rails.cache.fetch(\"posts_by_tags\") do\n Post.where.not(tag: nil).pluck(:tag).uniq.each do |tag|\n html += %Q[<p class=\"#{tag_css_class}\">#{tag}</p>]\n Post.where(tag: tag).each do |post|\n html+= %Q[\n <div class=\"#{post_css_class}\">\n <ul>\n <li><a href=\"#{post_path(post)}\">#{post.title}</a></li>\n </ul>\n </div>\n ]\n end\n end\n html\n end\n end", "title": "" }, { "docid": "920f536d162c2bfc46d9a2d6b88e990e", "score": "0.51499885", "text": "def index\n if params[\"keyword\"]\n @keywords = params[\"keyword\"].split(\" \")\n @posts = find_by_keywords(@keywords)\n else\n @posts = Post.order('created_at DESC').page params[:page]\n end\n @is_index = true\n end", "title": "" }, { "docid": "d12b5915af49b4500bb708f064fd937a", "score": "0.51498175", "text": "def get_posts\n posts = Post.order(\"post_date DESC\").where('post_date <= ?', Time.now)\n posts = posts.limit(count_limit) unless count_limit.blank?\n posts = posts.where(\"posts.post_date >= ?\", Time.now - past_days_limit.days) unless past_days_limit.blank?\n posts = posts.where(\"posts.blog_id IN (?)\", [blog.id] + blog_ids )\n end", "title": "" }, { "docid": "460442e149d4498dda3dbd9c7e155aff", "score": "0.5146713", "text": "def searchPost(keyword)\n posts = PostRepository.searchPost(keyword)\n end", "title": "" }, { "docid": "c20f91b720618f98fb5e4320b3462013", "score": "0.5143994", "text": "def all_posts\n # alle posts mit gewuenschter sortierung aus der DB holen\n @posts = Post.find(:all, :order => \"#{params[:sort]} DESC\")\n \n # aktuelle sortierung rausgeben um sie im view anzeigen zu koennen\n @active_sort = [\n params[:sort] == \"created_at\" ? \"act_sort\" : \"not_act_sort\",\n params[:sort] == \"rating\" ? \"act_sort\" : \"not_act_sort\",\n params[:sort] == \"user_id\" ? \"act_sort\" : \"not_act_sort\"\n ]\n end", "title": "" }, { "docid": "b8f6cbc54d669a64524cd2d75a6b7b91", "score": "0.51433533", "text": "def index\n @questions = Question.preload(:user, :post).order('created_at DESC').page(params[:page]).per(10)\n\n @questions = @questions.tagged_with(params[:tag]) if params[:tag]\n end", "title": "" }, { "docid": "13cd06d633cfd39b72180cf00566bc23", "score": "0.5140575", "text": "def index\n pagination_params = {:page => params[:page], :per_page => 10, :order => \"created_at DESC\"}\n if params[:tag]\n @blog_posts = BlogPost.tagged_with(params[:tag]).paginate(pagination_params)\n else\n @blog_posts = BlogPost.paginate(pagination_params)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blog_posts }\n end\n end", "title": "" }, { "docid": "c4c89312ab8e3aa496a82eac73d0b712", "score": "0.51371866", "text": "def user_posts(user, tag = nil)\n was_subscribed = true\n ret = []\n\n # unless we already subscribed, subscribe to user\n unless subs.keys.include?(user)\n sub(user)\n was_subscribed = false\n end\n \n # grab list of user's posts\n inbox_dates.keys.each do |date|\n ret += inbox(date).find_all do |post| \n post['user'] == user && (tag == nil || post['tags'].include?(tag))\n end\n end\n\n # unsubscribe from user unless we were already subscribed\n unsub(user) unless was_subscribed\n\n # return list of user's posts\n ret\n end", "title": "" }, { "docid": "076ac687b686ee8bc040b3379d538d89", "score": "0.51363736", "text": "def posts; end", "title": "" }, { "docid": "bc4fa835e52c4bff415bc5c5784aa049", "score": "0.51350784", "text": "def fetch(hashtags = Mingle::Hashtag.all, since = nil)\n unless since\n if Post.any?\n since = Post.ordered.last.created_at\n else\n since = Mingle.config.since\n end\n end\n\n hashtags = Array(hashtags)\n\n posts = []\n hashtags.each do |hashtag|\n posts += posts_through_search hashtag, since\n end\n\n posts.collect do |data|\n create_post_from_data(data, hashtags)\n end\n end", "title": "" }, { "docid": "23ba52d11b0c72c3ace99d2a2a6c626d", "score": "0.51346266", "text": "def posts_through_search hashtag, since\n warn \"DEPRECATION WARNING: Facebook has deprecated searching for posts. It is no \" +\n \"longer available for new applications and will cease to work for existing \" +\n \"applications in April 2015.\"\n\n posts = FbGraph::Post.search(hashtag.tag_name_with_hash, since: since.to_i, return_ssl_resources: 1, access_token: config.access_token)\n\n # Facebook search is fairly unpredictable, so ensure the query is actually mentioned\n posts.select { |post| matches? post, hashtag.tag_name }\n end", "title": "" }, { "docid": "cdc438e566384c58a3eb4330f55e792b", "score": "0.51286274", "text": "def blogfeed\n if params[:tag]\n @blogposts = current_user.blog_feed.tagged_with(params[:tag]).paginate(page: params[:page], :per_page => 10)\n else\n @blogposts = current_user.blog_feed.paginate(page: params[:page], :per_page => 10)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogposts }\n end\n end", "title": "" }, { "docid": "d0cc668ce33c6799e59fca34e09d7a2d", "score": "0.5121676", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListPostsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "d0cc668ce33c6799e59fca34e09d7a2d", "score": "0.5121676", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListPostsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "d0cc668ce33c6799e59fca34e09d7a2d", "score": "0.5121676", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListPostsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "d4da0ed77de3fc8ad35ffdae0b1eae1e", "score": "0.51186526", "text": "def index\n @tags_posts = TagsPost.all\n end", "title": "" }, { "docid": "51cf27630d3d3f8b80074b57581de405", "score": "0.511571", "text": "def index\n console\n @posts = Post.order(updated_at: :desc)\n @tags = sorted_tags.reverse\n end", "title": "" }, { "docid": "66ec08f33e3a0d763f8138ac3f433d8c", "score": "0.51133275", "text": "def index \n\n @posts = Post.find(@user_id)\n\n # Get Params\n params_title = params[:title]\n params_category = params[:category] #ADASDSA\n \n # Retorna el post dependiendo el filtro\n return category_title_filter if params_category && params_title\n return title_filter if params_title \n return category_filter if params_category \n \n # Si no se hay parametros para filtrar retorna todos los posts\n render json: @posts, status: :ok, each_serializer: PostListSerializer\n end", "title": "" } ]
02c29bc2d0b64784e9969e94c34361ec
Input: [1,2,3,4,5,6,7] and k = 3 Output: [5,6,7,1,2,3,4] Explanation: rotate 1 steps to the right: [7,1,2,3,4,5,6] rotate 2 steps to the right: [6,7,1,2,3,4,5] rotate 3 steps to the right: [5,6,7,1,2,3,4]
[ { "docid": "ce23992d82bc2ce9130eccbf5333fe85", "score": "0.79773325", "text": "def rotate(a, k)\n return a if k == 0\n b = []\n length = a.length\n\n rotate = length - k\n\n b[0..k] = a[rotate..-1]\n b[k..-1] = a[0..rotate-1]\n\n b\nend", "title": "" } ]
[ { "docid": "b4bf92d8e07faa55681faec837b6a1d7", "score": "0.8515881", "text": "def rotate(nums, k)\n result = []\n len = nums.length\n for i in (len-k)...len\n result << nums[i]\n end\n \n for i in (0...len-k)\n result << nums[i]\n end\n \n result.each_with_index do |n, j|\n nums[j] = result[j]\n end\nend", "title": "" }, { "docid": "7ddb91944f7a6287ee250351dcb6bda3", "score": "0.8356225", "text": "def rotate(nums, k)\n k.times do\n el = nums.pop\n nums.unshift(el)\n end\nend", "title": "" }, { "docid": "456c68f94f39fde5e786fe90cca75d2a", "score": "0.83023787", "text": "def rotate(nums, k)\n right_part = nums.slice(nums.length - k, k)\n left_part = nums.slice(0, nums.length - k)\n\n return right_part + left_part\n\nend", "title": "" }, { "docid": "2653a55c48f92f17634f5361882f719a", "score": "0.8298802", "text": "def rotate(nums, k)\n k.times do\n ele = nums.pop\n nums.unshift(ele)\n end\nreturn nums\nend", "title": "" }, { "docid": "c1aa0b2e39ea8110f7e74386e2d3605f", "score": "0.8293604", "text": "def rotate3(nums, k)\n k.times do\n nums.unshift(nums.pop)\n end\n nums\nend", "title": "" }, { "docid": "60b03e18b7178d048eca24df517220bc", "score": "0.8224635", "text": "def rotate(nums, k)\n k = k % nums.size\n new_arr = []\n current_index = 0\n \n while current_index <= nums.length - 1\n new_index = (current_index + k) % nums.length\n new_arr[new_index] = nums[current_index]\n current_index += 1\n end\n \n new_arr\nend", "title": "" }, { "docid": "2b731709215a5214c7842e1ce71b215d", "score": "0.8209024", "text": "def rotate(nums, k)\n for i in 0...k\n nums.insert(0,nums.last)\n nums.pop\n end\nend", "title": "" }, { "docid": "c80fdf08eb034f0c284fea80d8bec29c", "score": "0.8064886", "text": "def rotate_array_k_steps(array, k)\n n = array.size\n puts \"Input array is\"\n p array\n shifts = (n.to_f/k).ceil\n # binding.pry\n current = nil\n for i in 0..k-1\n current = array[i] if current.nil?\n nxt = (i+k)%n\n shifts.times do\n temp = array[nxt]\n array[nxt] = current\n current = temp\n nxt = (nxt+k)%n\n end\n end\n puts \"Rotated array is\"\n p array\n p current\nend", "title": "" }, { "docid": "a4116687c3ed292ec155921878fc6d03", "score": "0.7749684", "text": "def rotate_imp(nums, k)\n result = []\n for i in 0...nums.length\n result[(i+k)%nums.length] = nums[i]\n end\n result.each_with_index do |n, j|\n nums[j] = n\n end\nend", "title": "" }, { "docid": "4a402398f9cb4a7882b16127ab5cd8fe", "score": "0.75854325", "text": "def solution(a, k)\n # write your code in Ruby 2.2\n \n a.rotate(-k)\nend", "title": "" }, { "docid": "215426e58335c6931f6de06df2dd6104", "score": "0.74996847", "text": "def rotate_array(k = 0, n = 10)\n new_array = Array.new(n)\n\n n.times do |i|\n next_value = i + 1\n next_index = k + i\n last_index = n - 1\n\n next new_array[(n - k - i) * -1] = next_value if last_index < next_index\n next new_array[next_index] = next_value if last_index == next_index\n\n new_array[next_index] = next_value\n end\n\n new_array\nend", "title": "" }, { "docid": "91994b7e358173749f5f7d1c2f6e688b", "score": "0.7335028", "text": "def josephus(items, k)\n result = []\n items.length.times do\n items.rotate!(k - 1)\n result << items.shift\n end\n result\nend", "title": "" }, { "docid": "54b737a0108a0de25a2ab6950dfcb438", "score": "0.7282711", "text": "def circularArrayRotation(a, k, queries)\n # a.rotate!(-k)\n # queries.map do |q|\n # a[q]\n # end\n queries.map do |q|\n a[(q-k)%a.size]\n end\nend", "title": "" }, { "docid": "f9114bb398dd40e8f1ec2d842e47700d", "score": "0.7275858", "text": "def josephus_2(items, k)\r\n Array.new(items.length) { items.rotate!(k).pop }\r\nend", "title": "" }, { "docid": "3c0c207d45478b1e7651f83f45f986bb", "score": "0.71660537", "text": "def josephus(items,k)\n new_array = []\n while items.size > (k-1)\n new_array << items.delete_at(k-1)\n items.rotate!(k-1)\n end\n while items.size > 0\n items.rotate!(k-1)\n new_array << items.delete_at(0)\n end\n new_array\nend", "title": "" }, { "docid": "704ca8a1ad7a1f77a316f90ee9366f6c", "score": "0.7127842", "text": "def josephus(items,k)\n Array.new(items.size) { items.rotate!(k).pop }\nend", "title": "" }, { "docid": "fefb317166d231a705f80ec1e97cc288", "score": "0.69886494", "text": "def josephus(arr, k)\n removed_elements = []\n while arr.length > 0 do\n arr = arr.rotate(k)\n removed_elements << arr.pop\n end\n removed_elements\nend", "title": "" }, { "docid": "2257160afeefced51da7d635d3ac4a9a", "score": "0.69618535", "text": "def rotate!(arr, n)\n n.times do \n arr.push arr.shift\n end\nend", "title": "" }, { "docid": "91e4642981dd8fb9be747459b1f5111d", "score": "0.6876242", "text": "def rotate_array(array,k,type=\"right\")\n puts \"Input array is\"\n p array\n reverse_array(array, 0, array.size-1)\n if type == \"right\"\n reverse_array(array,0,k-1)\n reverse_array(array,k,array.size-1)\n else\n reverse_array(array,0,k)\n reverse_array(array,k+1,array.size-1)\n end\n puts \"#{type} rotated array is\"\n p array\nend", "title": "" }, { "docid": "d20d35f93b405303329b02dd4fb05af3", "score": "0.6689992", "text": "def rotate(n)\n self[n..-1].concat(self[0...n])\n end", "title": "" }, { "docid": "e20c36dc446b7848a047e97c2b9e53c9", "score": "0.6687369", "text": "def shift_linked_list(head, k)\n\n list_length = 1\n list_tail = head\n\n while !list_tail.next.nil?\n list_tail = list_tail.next\n list_length += 1\n end\n\n offset = k.abs % list_length\n if offset == 0\n return head\n end\n\n if k > 0\n new_tail_position = list_length - offset\n else\n new_tail_position = offset\n end\n\n new_tail = head\n\n for i in 1..(new_tail_position - 1)\n new_tail = new_tail.next\n i+=1\n end\n\n new_head = new_tail.next\n new_tail.next = nil\n list_tail.next = head\n\n return new_head\n\nend", "title": "" }, { "docid": "6bca7d62f948643f5a9157a24a37c050", "score": "0.66819745", "text": "def josephus(items,k)\n killed = []\n # loop the following two until items == []\n until items.length == 0 do\n items = items.rotate(k)\n killed << items.pop\n end\n killed\nend", "title": "" }, { "docid": "e700a4ab5dc9293f3551e9fce5df58c2", "score": "0.66786265", "text": "def solution(a, k)\n # array length is zero or one the array should remain the same\n if(a.length > 1)\n # if k > length we should k%length and get the remainder to be the new k\n if(k > a.length)\n k = k % a.length\n end\n\n b = a[0, a.length - k]\n a = a[a.length - k, a.length]\n a = a + b\n end\n a\nend", "title": "" }, { "docid": "5e3bae7a11db47aa179b82f364e28c1c", "score": "0.663961", "text": "def rotate(arr, n)\n curr_i = new_i = 0\n temp = new_val = arr[curr_i]; \n i = 0\n while (i < arr.length)\n curr_i = new_i\n\n #compute the new index for current value \n new_i = (arr.length - (n % arr.length) + curr_i) % arr.length; \n\n #take backup of new index value \n temp = arr[new_i]\n\n #assign the value to the new index \n arr[new_i] = new_val \n\n new_val = temp\n i+=1\n end\n arr\nend", "title": "" }, { "docid": "c69562cf55929c5846d2d2bf3d509e8c", "score": "0.65974253", "text": "def reverse_k_group(head, k)\n count = 0\n it = head\n while it && count < k\n count += 1\n it = it.next\n end\n \n if count == k\n it = reverse_k_group(it, k)\n \n while count > 0\n count -= 1\n tmp = head.next\n head.next = it\n it = head\n head = tmp\n end\n \n head = it\n end\n \n head\nend", "title": "" }, { "docid": "da5a89b3af39b9f01ad484e18b01b3dd", "score": "0.6566421", "text": "def rotate(array, i)\n i.times { array << array.shift }\n array\nend", "title": "" }, { "docid": "b194f708367e8e9d71721ed7aeb8c465", "score": "0.65601796", "text": "def rotate(n=1)\n if n == 1\n @position += 1\n @rotor_array << @rotor_array.shift\n else\n n.times do\n @position += 1\n @rotor_array << @rotor_array.shift\n end\n end\n end", "title": "" }, { "docid": "32a6dac65437148e8c05aefca290b772", "score": "0.6550837", "text": "def rotate(list, n)\n head, tail = split(list, n >= 0 ? n % list.length : list.length + n)\n return tail + head\nend", "title": "" }, { "docid": "ed3ec863e8089579f7e43bd94bccdb06", "score": "0.65120935", "text": "def rotate(n=1)\n n.times {@rotor_array << @rotor_array.shift}\n end", "title": "" }, { "docid": "dec78c4623c131b0a0bf4abc7271c0bd", "score": "0.65069896", "text": "def rot #@\n a = pop\n b = pop\n c = pop\n push a\n push c\n push b\n end", "title": "" }, { "docid": "3c3f7a13f0dafb8d7c505ce9e408776d", "score": "0.64842093", "text": "def josephus(items,k)\n n = -1\n out = []\n while items.length > 0 do \n n = (n + k) % items.length \n out.push(items.slice!(n))\n n -= 1 \n end\n out\nend", "title": "" }, { "docid": "fd13a7bed4686c5cf4c51f4eebf73940", "score": "0.6470992", "text": "def rotate_array1(array, delimit)\n k = array.length\n i = 0\n while(i < delimit)\n temp = array[0]\n index = 0\n while(index < k-1)\n array[index] = array[index+1]\n index += 1\n end\n array[k-1] = temp\n i+=1\n end\n array\nend", "title": "" }, { "docid": "52b04841c8561a22d8fce613a7b140d2", "score": "0.6413258", "text": "def my_rotate(shift = 1)\n shift = shift % count\n drop(shift) + take(shift)\nend", "title": "" }, { "docid": "91787ac9c5af857bb173daced64bd1ff", "score": "0.63904023", "text": "def rotLeft(a, d)\n d.times do\n ele = a.shift\n a << ele\n end\n return a\nend", "title": "" }, { "docid": "f8af81d1ef87586a8108acc389a9f7ea", "score": "0.6349446", "text": "def rotate(arr)\n\nend", "title": "" }, { "docid": "81aebab64fec3f402099c095332f8a0c", "score": "0.6341167", "text": "def rotate\n push shift\n end", "title": "" }, { "docid": "3bafddafb001db361b9475b0dc1e1e1a", "score": "0.6336169", "text": "def solution(a, k)\n # write your code in Ruby 2.2\n \n unless a.empty?\n for i in 1..k\n last = a.pop\n a.insert(0, last)\n end\n end\n \n return a\nend", "title": "" }, { "docid": "6d83cc0020624754916b7dd98a48f9d1", "score": "0.6275031", "text": "def my_rotate(rotation = 1)\n # debugger\n answer = []\n each_with_index { |x, i| answer[i] = x }\n if rotation > 0\n rotation.times { answer.push(answer.shift) }\n elsif rotation == 0\n answer\n else\n rotation.abs.times { answer.unshift(answer.pop) }\n end\n answer\n end", "title": "" }, { "docid": "88780f10b8b90510640ebb8f5a157c4e", "score": "0.62743956", "text": "def rotate(input)\n input[1..-1] << input[0]\nend", "title": "" }, { "docid": "12134d729f54999caba1e8114b4c9536", "score": "0.6273885", "text": "def my_rotate(arr, offset=1)\r\n # your code goes here\r\n # take first offset elements and append to end of array\r\n shift = offset % arr.length\r\n arr.drop(shift) + arr.take(shift)\r\nend", "title": "" }, { "docid": "7941c9cb4baefee818547ad53d02ddfd", "score": "0.6264031", "text": "def my_rotate(arr, offset=1)\n # your code goes here\n shift = offset % arr.length\n arr.drop(shift) + arr.take(shift)\nend", "title": "" }, { "docid": "461cb70023303bf28889381504baf328", "score": "0.6243549", "text": "def my_rotate(arr, offset=1)\n modOffset = offset % arr.length\n arr.drop(modOffset).concat(arr.take(modOffset))\nend", "title": "" }, { "docid": "ed63fca81dadd3653af9f5615f3ed061", "score": "0.6234648", "text": "def rotate_array(arr, num)\n num.times do\n elem = arr.pop\n arr.unshift(elem)\n return arr\n end\nend", "title": "" }, { "docid": "c693871340a3c285016b21881ae4a47e", "score": "0.6225107", "text": "def rotLeft(a, d)\r\n size = a.size\r\n d.times do\r\n first = a.shift\r\n a.insert(size-1, first)\r\n end\r\n a\r\nend", "title": "" }, { "docid": "bce149d308e4455e54b974250d7454fd", "score": "0.6194471", "text": "def my_rotate(arr)\n print arr.rotate\n end", "title": "" }, { "docid": "f125811146e6d057e523f16a989bb1fa", "score": "0.61893564", "text": "def my_rotate(n=1)\n split_index = n % self.length\n self.drop(split_index) + self.take(split_index)\n end", "title": "" }, { "docid": "a9e2cac8e1b150369e35582a70f3f54b", "score": "0.6186379", "text": "def my_rotate(arr, offset=1)\n # your code goes here\n arr.drop(offset % arr.length) + arr.take(offset % arr.length)\nend", "title": "" }, { "docid": "5b53531a911ee1a5dbf67dbc74ec13e0", "score": "0.61863583", "text": "def rotate_array(arr)\n results = arr.map { |n| n }\n results << results.shift\nend", "title": "" }, { "docid": "47da0e6d8a48ef5fe24ac5bf2d8a643e", "score": "0.61845225", "text": "def rotate(array,opt)\r\n\ti=0\r\n\tif opt > 0\r\n\t\twhile i < opt\r\n\t\t\tarray.unshift(array.last)\r\n\t\t\tarray.pop\r\n\t\t\ti +=1\r\n\t\t\r\n\t\tend\r\n\telsif opt < 0\r\n\t\twhile opt < i\r\n\t\t\tarray << array.first\r\n\t\t\tarray.shift\r\n\t\t\topt +=1\r\n\t\tend\r\n\tend\r\n\r\n\tarray\r\n\r\nend", "title": "" }, { "docid": "2137203fbc800d9168c208005cb86acb", "score": "0.6182087", "text": "def rotate_array(arr, num)\n num.times do\n arr.unshift(arr.pop())\n end\n return arr\nend", "title": "" }, { "docid": "be86af9c81985595d238dfc2936dc8e2", "score": "0.6172667", "text": "def rotate3(num)\n length = num.inspect.length\n max_rotate = rotate2(num, length)\n loop do \n length -= 1\n max_rotate = rotate2(max_rotate, length)\n break if length == 0\n end\n max_rotate\nend", "title": "" }, { "docid": "b34fafcc28316684b909120137bbc4bf", "score": "0.61672354", "text": "def lexicographic_permutation(k)\n k -= 1\n s = self.dup\n n = s.length\n n_less_1_factorial = (n - 1).factorial # compute (n - 1)!\n (1..n-1).each do |j|\n tempj = (k / n_less_1_factorial) % (n + 1 - j)\n s[j-1..j+tempj-1]=s[j+tempj-1,1]+s[j-1..j+tempj-2] unless tempj==0\n n_less_1_factorial = n_less_1_factorial / (n- j)\n end\n s\n end", "title": "" }, { "docid": "5c0de83bccc1d815993aae3d854b1297", "score": "0.61627", "text": "def my_rotate(arr, offset=1)\n rotations = offset % arr.length\n arr.drop(rotations) + arr.take(rotations)\nend", "title": "" }, { "docid": "e538898c8f76cf01f93acaff1386806d", "score": "0.6162633", "text": "def my_rotate(arr, offset = 1)\n arr.drop(offset % arr.length) + arr.take(offset % arr.length)\nend", "title": "" }, { "docid": "3e28df6fe8545bce0c9e0abb594fb086", "score": "0.61592144", "text": "def josephus(items,k)\n result = []\n count = k\n until items.length == 0 do\n remove_these = []\n items.each_with_index do |item, i|\n if count == 1\n result << items[i]\n remove_these << i\n end\n count = count == 1 ? k : count -= 1\n end\n remove_these.reverse!\n remove_these.each do |r|\n items.delete_at(r)\n end\n end\n result\nend", "title": "" }, { "docid": "ac17d5014bdd2f3d26fe27fe78358abe", "score": "0.61359984", "text": "def rotate(n)\n return self.class.empty if empty?\n\n n %= size\n return self if n == 0\n\n a, b = @front, @rear\n\n if b.size >= n\n n.times { a = a.cons(b.head); b = b.tail }\n else\n (size - n).times { b = b.cons(a.head); a = a.tail }\n end\n\n self.class.alloc(a, b)\n end", "title": "" }, { "docid": "2c63ba8c87df20c86c66f6978f975a1b", "score": "0.6133639", "text": "def rotate_array(arr, num)\n num.times do \n ele = arr.pop \n arr.unshif(ele)\n end\n return arr \nend", "title": "" }, { "docid": "187982b1549214915727bb6fa6cc4169", "score": "0.6114408", "text": "def rotate_arr(arr)\n result_arr = arr.map{|num| num}\n result_arr << result_arr[0]\n result_arr.shift\n result_arr\nend", "title": "" }, { "docid": "6cfb688be8f5d47c7f26e1678dcea28a", "score": "0.61110604", "text": "def solve(nums, k)\n k.times do\n nums.push(nums.shift)\n end\n return nums\nend", "title": "" }, { "docid": "2a167fd4629ccbc5bc01c4984d83582f", "score": "0.61084306", "text": "def rotate_array(array, number)\n number.times{array.unshift(array.pop)}\n array\nend", "title": "" }, { "docid": "4ac57b5f2acb1663e784297292230e4d", "score": "0.6107731", "text": "def rotate! n = 1\n n %= size\n return self if n.zero?\n new_index = (@current_index - n) % size\n center_indices_at new_index\n @array.rotate! n\n end", "title": "" }, { "docid": "0e3a5e416ef3f4cab28daab675afcd66", "score": "0.6106658", "text": "def rotate_reverse(n = 1)\n return if self.size.zero?\n n.times { self.unshift(self.pop) }\n end", "title": "" }, { "docid": "87693787b5379f9b041c58cd7287c50d", "score": "0.6105191", "text": "def rotate_array(arr, num)\r\n num.times do\r\n ele = arr.pop\r\n arr.unshift(ele)\r\n end\r\n\r\n return arr\r\nend", "title": "" }, { "docid": "b0eddd626eda55c64104701b59ff5794", "score": "0.6102197", "text": "def rotateRight(a, l, r)\n arr = a.dup\n temp = arr[r]\n r.downto(l + 1).each do |i|\n arr[i] = arr[i - 1]\n end\n arr[l] = temp\n arr\n end", "title": "" }, { "docid": "ec0ad7a2a948d8cc78bc5ca802a1f2a5", "score": "0.60996264", "text": "def my_rotate(arr, offset=1)\n offset = offset % 4\n arr_take = arr.take(offset)\n arr_drop = arr.drop(offset)\n arr_drop + arr_take\nend", "title": "" }, { "docid": "1ac61a2e78ee12f7f17ed290f8a7588f", "score": "0.60759956", "text": "def rotateLeft(a, l, r)\n arr = a.dup\n temp = arr[l]\n (l...r).each do |i|\n arr[i] = arr[i + 1]\n end\n arr[r] = temp\n arr\n end", "title": "" }, { "docid": "532885635a7ef6e8be9ae78d26eb8617", "score": "0.6075497", "text": "def rotate_by(array, offset)\n offset.times do\n starting = array.length - offset\n (starting).downto(0) do |j|\n temp = array[j]\n array[j] = array[j-1]\n array[j-1] = temp\n end\n end\n return array\nend", "title": "" }, { "docid": "1683c1ce1d6f3db644573736caf79e80", "score": "0.60738456", "text": "def rotate_backwards(arr)\n\nend", "title": "" }, { "docid": "a4d25e3e6bb6784f4e05b9ff12caf9db", "score": "0.60663605", "text": "def rotate_array(arr, num)\n num.times do\n value = arr.pop()\n arr.unshift(value)\n end\n return arr\nend", "title": "" }, { "docid": "2d71d825cc639b63be6a76936c8ad187", "score": "0.6065469", "text": "def rotate_without_changing(arr)\n\nend", "title": "" }, { "docid": "7d4387022d5f00e72c205721d5344056", "score": "0.60559213", "text": "def my_rotate!(array, amt)\n\nend", "title": "" }, { "docid": "e4344df5067b83717a8fd8bedc965cef", "score": "0.60500234", "text": "def my_rotate(arr, offset=1)\n unshifted = arr.pop(arr.length % offset)\n arr.push(popped)\nend", "title": "" }, { "docid": "1540655c8fdcb9fce0ae7eb89fe8b69c", "score": "0.60474", "text": "def rotate_array(arr, num)\n j = 0\n max = num\n len = arr.length - 1\n\n while j < max\n arr.unshift(arr[len])\n arr.pop()\n j += 1\n end\n return arr\n\nend", "title": "" }, { "docid": "234e2c5ca38b4f66cbf971b8cb99f85a", "score": "0.6024349", "text": "def my_rotate(arr, offset=1)\n split_idx = offset % arr.length\n arr.drop(split_idx) + arr.take(split_idx) \nend", "title": "" }, { "docid": "2f18f9aeadf13ebf596f3e0877b1b62f", "score": "0.60213256", "text": "def rotate_array(arr, num)\n\tnum.times do\n toFront = arr.pop\n arr.unshift(toFront)\n end\n \treturn arr\nend", "title": "" }, { "docid": "da24f51b5d8d026715da299ad43e02e5", "score": "0.5988985", "text": "def rotate_array(arr)\nnew_arr = []\narr.each do |num|\nnew_arr << num\nend\t\nnew_arr << new_arr.shift\nend", "title": "" }, { "docid": "4c0c37e89e4d87a25bd7809626f052a3", "score": "0.59889174", "text": "def shift_left(list)\n # rotate moves the value\n print list.rotate\nend", "title": "" }, { "docid": "40c1f81c8151dd63ab3f05f737396389", "score": "0.59869134", "text": "def left_rotate_array_optimized(arr, d, n)\n \n gcd = gcd(d, n) - 1\n \n (0..gcd).each do |i|\n temp = arr[i]\n j = i\n while 1\n k = j + d\n k = k - n if k >=n\n break if k == i\n arr[j] = arr[k]\n j = k\n end\n arr[j] = temp\n end\n return arr\nend", "title": "" }, { "docid": "78dd1426fc562df7cc3c0aa18184761e", "score": "0.59817266", "text": "def my_rotate(arr, offset=1)\n # your code goes here\n drop(offset) + take(offset)\n\nend", "title": "" }, { "docid": "fcf8627a2ccbd0aa5a504c98c2cedf70", "score": "0.5979505", "text": "def my_rotate(num = 1)\n offset = num % self.length\n self.drop(offset) + self.take(offset)\n end", "title": "" }, { "docid": "f5539a38afbbaf5c4332c199d27d8f90", "score": "0.59439903", "text": "def rotate!(count=1) self.replace(self.rotate(count)) end", "title": "" }, { "docid": "686b3a14f60be34d56e7bad79f232479", "score": "0.5919083", "text": "def rotate_array(numbers)\n arr = []\n numbers.each { |num| arr << num }\n arr.push(numbers[0]).shift\n arr\nend", "title": "" }, { "docid": "3ac1040ff8b10cace3b405827d0b831d", "score": "0.5915754", "text": "def kth_to_last(k)\n current = @head\n scout = current\n\n k.times do\n scout = scout.next\n end\n\n until scout.next.nil?\n current = current.next\n scout = scout.next\n end\n current.value\n end", "title": "" }, { "docid": "9c42f155c3a2e4a68335a60b1e2aa07c", "score": "0.5898548", "text": "def combinations(list, k)\n if k == 0\n [[]]\n elsif k == list.length\n [list]\n else\n rest = list[1..-1]\n combinations(rest, k-1).map { |sub| [list.first] + sub } + combinations(rest, k)\n end\nend", "title": "" }, { "docid": "bfc0e9bb5d0b1dcf555f8d40365c317e", "score": "0.58797544", "text": "def josephus_survivor(n,k)\n arr = (1..n).to_a\n\n while arr.length > 1\n idx = k % arr.length\n\n if arr.length > k\n arr = arr.drop(k) + arr.take(k - 1)\n elsif arr.length == k \n arr = arr[0...-1]\n else\n arr = arr.drop(idx) + arr.take(idx - 1)\n end\n end\n \n arr[0]\nend", "title": "" }, { "docid": "e818682e4fa218630ac96030e6a1d8d1", "score": "0.5876046", "text": "def rotate_array(a, d) #Input array \"a\" and rotation by \"d\" elemets\n finish =a.length-1\n block_swap(a,0,finish,d)\nend", "title": "" }, { "docid": "996667f5aee96d48c457ca944190e48a", "score": "0.58718973", "text": "def rotate(array, number)\n\t#put the strings we want to move into a new string\n\tnewArray = array.shift\n\t#subtract the number\n\tnumber-=1\n\t#push the strings to the back of the array\n\tarray.push(newArray)\n\t#keep doing this until our number is 0\n\trotate(array, number) unless number ==0\nend", "title": "" }, { "docid": "60a2891ed3c4ed5f43ad11c5531b9b77", "score": "0.5867829", "text": "def rotate_array(arr, num)\n# \tloop num times\n for i in 0...num\n temp = arr.pop\n arr.unshift(temp)\n end\n return arr\nend", "title": "" }, { "docid": "46c7a3bb349f8470cb71eaaf9d3691af", "score": "0.58634675", "text": "def rotate(array)\n array.map.with_index do |elem, index|\n if (index + 1) < array.size\n array[index + 1]\n else\n array[0]\n end\n end\nend", "title": "" }, { "docid": "29da41abf706baf842786282a8a95b51", "score": "0.58516276", "text": "def rotate_matrix(n_by_n_matrix)\n # largest index\n n = n_by_n_matrix.first.count - 1\n half_of_n = (n_by_n_matrix.first.count/2).floor\n half_of_n.times do |c| # c = cycle\n v = n-(c*2) # v = vars to rotate\n v.times do |r| # r = rotation\n n_by_n_matrix[c][c+r], n_by_n_matrix[v+c-r][c] = n_by_n_matrix[v+c-r][c], n_by_n_matrix[c][c+r]\n n_by_n_matrix[v+c-r][c], n_by_n_matrix[v+c][v+c-r] = n_by_n_matrix[v+c][v+c-r], n_by_n_matrix[v+c-r][c]\n n_by_n_matrix[v+c][v+c-r], n_by_n_matrix[c+r][v+c] = n_by_n_matrix[c+r][v+c], n_by_n_matrix[v+c][v+c-r]\n end\n end\n n_by_n_matrix\nend", "title": "" }, { "docid": "a31ddb488fd136b9707dabde80819249", "score": "0.58498883", "text": "def josephus_survivor(n,k)\n # (1..n) people are put into the circle\n items = (1..n).to_a\n Array.new(n){items.rotate!(k-1).shift}.last\nend", "title": "" }, { "docid": "8e55eabb5759170200d480bbfec642fe", "score": "0.58351845", "text": "def kth_to_last_node(k, head)\n if k < 1\n raise \"k should greater or equal to one\"\n end\n\n list_length = 1\n current_node = head\n\n while current_node = current_node.next\n list_length += 1\n end\n\n raise \"k greater than linked list's length\" if k > list_length\n\n current_node = head\n\n (list_length - k).times do\n current_node = current_node.next\n end\n\n current_node\nend", "title": "" }, { "docid": "988e0c80ddb2e4a044f887a5e8c75119", "score": "0.581585", "text": "def quickSort(array, k, r)\n if k < r\n pivot = partition(array, k, r)\n quickSort(array, k, pivot - 1)\n quickSort(array, pivot + 1, r)\n end\nend", "title": "" }, { "docid": "29a7108f0669079ba3e80a00e3ba98f5", "score": "0.5811204", "text": "def josephus(n,m)\n arr = Array.new\n order = Array.new\n\n for i in 1..n\n arr[i] = i\n end\n\n arr.compact!\n\n for i in 0..n-1\n arr= arr.rotate(m-1)\n order << arr[0]\n arr[0] = nil\n arr.compact!\n end\n\n puts \"order: #{order.to_s}\"\nend", "title": "" }, { "docid": "c25de3c7cce11fc1e5ca488640a2fb91", "score": "0.58073676", "text": "def kth_to_last_node(k, head)\n if k < 1\n raise \"k should greater or equal to one\"\n end\n\n left_node = head\n right_node = head\n\n (k - 1).times do\n\n unless right_node = right_node.next\n raise \"k greater than linked list's length\" if k > list_length\n end\n end\n\n while right_node = right_node.next\n left_node = left_node.next\n end\n\n left_node\nend", "title": "" }, { "docid": "472043d349d825749f6b3fe7e9e9bdc0", "score": "0.58037704", "text": "def rotate_array(list)\n list[1..-1] + [list[0]]\nend", "title": "" }, { "docid": "71b10ac11904bb1d254141f3ad8d02bd", "score": "0.57822", "text": "def my_rotate(num = 1)\n num < 1 ? num.abs.times {self.unshift(self.pop)} : num.times {self.push(self.shift)}\n self\n end", "title": "" }, { "docid": "1597745fedadbc83f4e54409567982c3", "score": "0.5763495", "text": "def array_rotation(arr, num)\n\tarr.rotate(num)\nend", "title": "" }, { "docid": "f67bf4d523c5e32b4e7bb8a24dffc8d2", "score": "0.57421505", "text": "def my_rotate(pos=1)\n pos.times do\n self.push(self.shift)\n end\n return self\n end", "title": "" }, { "docid": "983618e69c411fbdd5e91b45b4874f62", "score": "0.5737018", "text": "def rotate_array(arr, num)\n\n if num == 1\n arr.unshift(arr[-1])\n arr.pop\n end\n\n if num > 1\n\n i = 0\n while i < arr.length - num\n arr.push(arr[0])\n arr.shift\n i += 1 \n end \n end\n\n return arr\nend", "title": "" } ]
979710dca7d96962cc0b6fe92e8ca92f
Adds input options for the underlying data source.
[ { "docid": "576d8fd2f11092748e7c1cee34a32567", "score": "0.0", "text": "def options(options)\n options.each do |key, value|\n jreader.option(key, value.to_s)\n end\n self\n end", "title": "" } ]
[ { "docid": "8cd86353d0a08444a310e001b9a8c168", "score": "0.6219003", "text": "def fill_in_inputs(options, default_options={})\n\n end", "title": "" }, { "docid": "8699ee122509e34a8fe02f9cbf3e3028", "score": "0.6202875", "text": "def additional_data_options=(value)\n @additional_data_options = value\n end", "title": "" }, { "docid": "398fe70e248adce7399f8b5cf92cb033", "score": "0.6025992", "text": "def add_options(&block); end", "title": "" }, { "docid": "398fe70e248adce7399f8b5cf92cb033", "score": "0.6025992", "text": "def add_options(&block); end", "title": "" }, { "docid": "aa41622416af4985cef01e804af78059", "score": "0.60091245", "text": "def register_options; end", "title": "" }, { "docid": "2cb932081a92d1febf975490eb2da95e", "score": "0.5978896", "text": "def add_options\n\t\t\t\tself.console.fatal(\"Cowtech::Lib::Script#add_options must be overidden by subclasses.\")\n\t\t\tend", "title": "" }, { "docid": "dc40ca1876774d4a14f67a72f160727d", "score": "0.5978797", "text": "def override_input_operations\n consolidate_yeast_inputs\n consolidate_protease_inputs\n\n associate_plan_options(OPTIONS)\n end", "title": "" }, { "docid": "a0ac2fc979d40ce26f47e87fc88f875a", "score": "0.5968156", "text": "def modify options\n collect_data_points options[:only_data_with], true if\n options[:only_data_with]\n\n delete_data_points options[:ignore_data_with], true if\n options[:ignore_data_with]\n\n collect_data_points options[:only_data] if options[:only_data]\n\n delete_data_points options[:ignore_data] if options[:ignore_data]\n\n @data\n end", "title": "" }, { "docid": "8afa34692fdf0d61974288e15459b671", "score": "0.59248525", "text": "def register_options(options, owner = self.class)\n self.options.add_options(options, owner)\n self.datastore.import_options(self.options, 'self', true)\n import_defaults(false)\n end", "title": "" }, { "docid": "30b19922a04648075f1f18f62900676e", "score": "0.58767515", "text": "def register_advanced_options(options, owner = self.class)\n self.options.add_advanced_options(options, owner)\n self.datastore.import_options(self.options, 'self', true)\n import_defaults(false)\n end", "title": "" }, { "docid": "405fea18a4b1c44628508aeed3f63e98", "score": "0.58332705", "text": "def add_specific_options(opts)\n end", "title": "" }, { "docid": "495419ea568ab1c50e1d8023645231e6", "score": "0.5823539", "text": "def options() end", "title": "" }, { "docid": "2e5e0277b9925bb32342a390e9e9d285", "score": "0.5787543", "text": "def input_options(input_options = nil)\n if input_options\n @input_options = input_options\n else\n @input_options || nil\n end\n end", "title": "" }, { "docid": "7f41ed107a2bdfb9375a9ebb1b111a30", "score": "0.57874584", "text": "def add(options); end", "title": "" }, { "docid": "dd16f80e4600a9f4d0a28c7783addeed", "score": "0.57812566", "text": "def override_input_operations\n\n consolidate_yeast_inputs\n consolidate_protease_inputs\n\n associate_plan_options(OPTIONS)\n end", "title": "" }, { "docid": "5fe65c950c9bf8a4046c8db7787509e1", "score": "0.57653016", "text": "def options_call; end", "title": "" }, { "docid": "240fd90c6b643e791d6431d6bc0cb650", "score": "0.57434726", "text": "def options(*) end", "title": "" }, { "docid": "234125ec141cf533a2291ecb6a936c48", "score": "0.5725597", "text": "def initialize_data_source\n if self.action && opts[:string].nil? && opts[:file].nil? && !self.stdin.tty?\n opts[:file] = '-'\n end\n end", "title": "" }, { "docid": "d05bdb6a04875d5dda90cd86a9ffada1", "score": "0.56972504", "text": "def add_option(name, value); end", "title": "" }, { "docid": "d05bdb6a04875d5dda90cd86a9ffada1", "score": "0.56972504", "text": "def add_option(name, value); end", "title": "" }, { "docid": "d05bdb6a04875d5dda90cd86a9ffada1", "score": "0.56972504", "text": "def add_option(name, value); end", "title": "" }, { "docid": "1d70cc079395600b6be838708e0d7f0e", "score": "0.5657705", "text": "def add_options(new_options={})\n @options.merge!(new_options)\n end", "title": "" }, { "docid": "a5dd23d7c86fcb4035d462902e81de66", "score": "0.5644557", "text": "def options(opt); end", "title": "" }, { "docid": "a5dd23d7c86fcb4035d462902e81de66", "score": "0.5644557", "text": "def options(opt); end", "title": "" }, { "docid": "a5dd23d7c86fcb4035d462902e81de66", "score": "0.5644557", "text": "def options(opt); end", "title": "" }, { "docid": "a6aa5b79568fa524e181bd7fdc531042", "score": "0.56053597", "text": "def add_input_option(option_name, *args)\n (@input_options ||= []).push(option_name)\n args.each { |ea| @input_options.push(Shellwords.escape(ea.to_s)) }\n\n # Support call chaining:\n self\n end", "title": "" }, { "docid": "8c9e40185b9f2e02b9f9c66e3789cd80", "score": "0.5589418", "text": "def options=(p1)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "8c9e40185b9f2e02b9f9c66e3789cd80", "score": "0.5589418", "text": "def options=(p1)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "5e3d394f533c9238b96d37fd6b4c57e4", "score": "0.5584101", "text": "def options(data = T.unsafe(nil), opt = T.unsafe(nil)); end", "title": "" }, { "docid": "54c026efaabd172749c7e528824e8a2d", "score": "0.5570399", "text": "def data_source=(source)\n @data_source = DataSource.new(source)\n end", "title": "" }, { "docid": "43de7e046a7602a0c5b1b539ce9fa94e", "score": "0.55687076", "text": "def do_options\n end", "title": "" }, { "docid": "33e5ac7ba6ae037bc1f8e5e2546f2faa", "score": "0.55579567", "text": "def options\n end", "title": "" }, { "docid": "33e5ac7ba6ae037bc1f8e5e2546f2faa", "score": "0.55579567", "text": "def options\n end", "title": "" }, { "docid": "33e5ac7ba6ae037bc1f8e5e2546f2faa", "score": "0.55579567", "text": "def options\n end", "title": "" }, { "docid": "ab1d9f38b1e4ec6326bc5ddb1fb866e0", "score": "0.5553599", "text": "def add_options(new_options = {})\n @options.merge!(new_options)\n end", "title": "" }, { "docid": "9b372bccdfd4a337e48721528341b8ad", "score": "0.55412084", "text": "def set_options(options); end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5532743", "text": "def options; end", "title": "" } ]
3ae21d6429b1057d0e8628caee94c3a7
time: iterator to compare elements is O(n)? how does recursion affect the time complexity? space: O(n) or O(nlogn) ask ned about how to come up with time and space complexities for both versions o quick sort, in place and out of place.
[ { "docid": "2aa1fa010f9406784ebcd276c3d8be85", "score": "0.7014678", "text": "def quick_sort_in_place! arr, s_idx = 0, e_idx = arr.length-1\n\n e_idx = 0 if e_idx < 0\n if e_idx - s_idx < 1\n return\n end\n\n pivot_idx = partition_and_idx! arr, s_idx, e_idx\n quick_sort_in_place! arr, s_idx, pivot_idx - 1\n quick_sort_in_place! arr, pivot_idx + 1, e_idx\n return arr\nend", "title": "" } ]
[ { "docid": "7543c28f0fe2f08b354b0d4a0dec08df", "score": "0.742857", "text": "def in_place_quick_sort(collection, left, right)\n if left < right\n pivot_index = right\n q = partition(collection, left, right, pivot_index)\n in_place_quick_sort(collection, left, q-1)\n in_place_quick_sort(collection, q+1, right)\n end\n return collection\nend", "title": "" }, { "docid": "11bc893b8569d36cd31bcda41f39fa80", "score": "0.71054476", "text": "def quicksort\n ->(xs) {\n if empty?.(xs)\n empty\n else\n pivot = head.(xs)\n partitions = (F.map.(self.quicksort) * partition_by.(F.is_lte.(pivot)) << tail.(xs)).to_a\n append.(partitions[0],cons.(pivot, partitions[1]))\n end\n } * to_stream ### if only this wasn't infinitely recursing...\n end", "title": "" }, { "docid": "d7c2a24a7f47079fcc1948d1fcca4266", "score": "0.71053714", "text": "def use_quick_sort(arr)\r\n if arr.length < 2\r\n return arr #Base case: arrays with 0 or 1 element are already “sorted.”\r\n else\r\n pivot = arr[0] #Recursive case\r\n less = arr[(1...arr.length)].select{|x| x <= pivot} #Sub-array of all the elements less than the pivot\r\n greater = arr[(1...arr.length)].select{|x| x > pivot} #Sub-array of all the elements greater than the pivot\r\n return use_quick_sort(less) + [pivot] + use_quick_sort(greater)\r\n end\r\nend", "title": "" }, { "docid": "399483d2aed15fc0d3b64e1c5fb7761c", "score": "0.7049711", "text": "def quick_sort(arr, left, right)\n size = arr.size\n\n if left < right\n partition_index = partition(arr, left, right)\n quick_sort(arr, left, partition_index)\n quick_sort(arr, partition_index+1, right)\n end\n\n return arr\nend", "title": "" }, { "docid": "c0528760c0e9823293b03df96b9ac0c0", "score": "0.70186937", "text": "def quick_sort(arr, start, last)\n if start < last\n pi = partition(arr, start, last)\n\n quick_sort(arr, start, pi-1)\n quick_sort(arr, pi+1, last)\n end\n arr\nend", "title": "" }, { "docid": "788e3ab0537b0e9cbbe320ef02b2f19a", "score": "0.7007093", "text": "def quicksort_aux(items, start_index, end_index)\n if end_index - start_index < 2\n return\n end\n\n k = partition(items, start_index, end_index)\n quicksort_aux(items, start_index, k)\n quicksort_aux(items, k+1, end_index)\n return\nend", "title": "" }, { "docid": "f91a52c954cbb31fa0a385a02400b1d3", "score": "0.70053214", "text": "def my_quick_sort(&prc)\n return self if size <= 1\n prc ||= proc { |x, y| x <=> y}\n\n pivot = shift\n left = select { |el| prc.call(el, pivot) < 1 }\n right = select { |el| prc.call(el, pivot) == 1}\n\n left.my_quick_sort(&prc) + [pivot] + right.my_quick_sort(&prc)\n end", "title": "" }, { "docid": "41a1bb006910767c0eae14854d9b28b6", "score": "0.6975376", "text": "def my_quick_sort(&prc)\n return self if length <= 1\n prc ||= Proc.new { |x, y| x <=> y }\n\n pivot = first\n left = self[1..-1].select { |el| prc.call(el, pivot) == -1 }\n right = self[1..-1].select { |el| prc.call(el, pivot) != -1 }\n\n left.my_quick_sort(&prc) + [pivot] + right.my_quick_sort(&prc)\n\n end", "title": "" }, { "docid": "ba4c6fe341e9a3b21328437b64b0bfc2", "score": "0.6943715", "text": "def quick_sort(array, start, finish)\n return array if start > finish # Base case to end recursion - at this point array is not valid\n pindex = partition(array, start, finish)\n quick_sort(array, start, pindex-1)\n quick_sort(array, pindex+1, finish)\nend", "title": "" }, { "docid": "e375975feea19b8874dcc05c305ba8fd", "score": "0.6937284", "text": "def quick_sort( array )\n if array.size <= 1\n return array\n end\n \n pivoit_index = (( array.size - 1 )/2).floor \n pivoit = array[ pivoit_index ]\n \n left_array = []\n right_array = []\n \n array.each_index do |index|\n if index != pivoit_index\n if array[index] <= pivoit \n left_array.push(array[index])\n else\n right_array.push(array[index])\n end\n end\n \n end\n \n puts \"==========Level #{$recursion_level}=======\"\n p pivoit\n p left_array\n p right_array\n puts \"====================================\"\n # if $max_level > 0\n $recursion_level += 1\n sorted_left = quick_sort(left_array)\n sorted_right = quick_sort(right_array)\n #end\n \n sorted_left.push(pivoit)\n \n return sorted_left + sorted_right\nend", "title": "" }, { "docid": "962094e5dc8d2c1d149b087451f3715a", "score": "0.6918185", "text": "def quickysort(list, pivot, right)\n next_p = 0 #the partition will move \n\n if pivot < right then\n next_p = partition(list, pivot, right)\n quickysort(list, pivot, next_p-1)\n quickysort(list, next_p+1, right)\n end\nend", "title": "" }, { "docid": "5299b2f32a7f152053f1234053e515f7", "score": "0.68994784", "text": "def quick(unsorted)\n \t\t\tif unsorted.length < 2\n @opts = @opts + 1\n unsorted\n else\n pivot = unsorted[unsorted.length/2]\n left = []\n right = []\n unsorted.each do |x|\n @opts = @opts + 1\n if x > pivot\n right << x\n elsif x < pivot\n left << x\n end\n end\n (quick(left) << pivot) + quick(right)\n end\n end", "title": "" }, { "docid": "750799c441685378496021cf4db7806b", "score": "0.6885028", "text": "def quick_sort(ar)\n\nend", "title": "" }, { "docid": "403749d06bd4cca6c53e4b0bc45a0dd1", "score": "0.68502444", "text": "def quick_sort(arr, low, high)\n if low < high\n position = partition(arr, low, high)\n quick_sort(arr, 0, position - 1)\n quick_sort(arr, position + 1, high)\n end\n arr\nend", "title": "" }, { "docid": "6b09b9a85f04553bd2dbc069b7593fda", "score": "0.68499047", "text": "def recursive_quick_sort vector_order, index, by, ascending, left_lower, right_upper\n if left_lower < right_upper\n left_upper, right_lower = partition(vector_order, index, by, ascending, left_lower, right_upper)\n if left_upper - left_lower < right_upper - right_lower\n recursive_quick_sort(vector_order, index, by, ascending, left_lower, left_upper)\n recursive_quick_sort(vector_order, index, by, ascending, right_lower, right_upper)\n else\n recursive_quick_sort(vector_order, index, by, ascending, right_lower, right_upper)\n recursive_quick_sort(vector_order, index, by, ascending, left_lower, left_upper)\n end\n end\n end", "title": "" }, { "docid": "b75c50c5e145206a700f6aa62e993043", "score": "0.68395674", "text": "def quick_sort(a,lo,hi)\n if lo<hi\n temp=partition(a,lo,hi)\n l=temp[0]\n r=temp[1]\n quick_sort(a,lo,l-1)\n quick_sort(a,r+1,hi)\n end\nend", "title": "" }, { "docid": "4aa1ee83cec621208cc942f6bbae718d", "score": "0.6838914", "text": "def quick_sort(to_sort)\n # stop the recursion if nothing to sort. base case\n return to_sort if to_sort.length <= 1\n\n # pick the pivot (I pick the last element)\n pivot = to_sort.pop\n # partition operation\n smaller_array = []\n larger_array = []\n to_sort.each do |element|\n if element <= pivot\n smaller_array.push(element)\n else\n larger_array.push(element)\n end\n end\n\n # recursively sort the sub arrays and concatenate the results\n return quick_sort(smaller_array).push(pivot) + quick_sort(larger_array)\nend", "title": "" }, { "docid": "fb294ee96b37fcf605057c0040ef102c", "score": "0.6831331", "text": "def quicksort_in_place(arr)\n return arr if arr.length <= 1\n\n pivot = arr[0]\n\n swapped = true\n i = 1\n j = arr.length - 1\n\n while swapped\n\n while i < arr.length && arr[i] <= pivot\n i += 1\n end\n\n while arr[j] > pivot\n j -= 1\n end\n\n if i < j\n arr[i], arr[j] = arr[j], arr[i]\n swapped = true\n else\n arr[0], arr[j] = arr[j], arr[0]\n swapped = false\n end\n\n end\n\n quicksort_in_place(arr[0...j]) + [pivot] + quicksort_in_place(arr[(j + 1)..-1])\n\nend", "title": "" }, { "docid": "ffa9d75d4d81a789d3fbe2f63fcbb5dc", "score": "0.682936", "text": "def quick_sort(nums)\n \n return nums if nums.size <= 1\n \n return [nums.min, nums.max] if nums.size == 2\n \n partition = nums[-1]\n \n l, r = 0, nums.size-2\n \n until l >= r\n p [l,r]\n while l <= nums.size-2 and nums[l] < partition\n l+=1\n end\n \n while r > 0 and r >= l and nums[r] >= partition\n r-=1\n end\n \n if l!=r and l < r\n nums[l],nums[r] = nums[r],nums[l]\n end\n end\n \n nums[-1],nums[l] = nums[l],nums[-1]\n \n return [nums[0]] + quick_sort(nums[1..-1]) if l == 0\n \n return quick_sort(nums[0..l-1]) + [nums[l]] + quick_sort(nums[l+1..-1]) if l < nums.size-1\n \n return quick_sort(nums[0..l-1]) + [nums[l]]\n \nend", "title": "" }, { "docid": "598f37e26a1a4c85451fb7a6b4250b0c", "score": "0.6816532", "text": "def quick_sort(f, a)\n return [] if a.empty?\n pivot = a[0]\n before = quick_sort(f, a[1..-1].delete_if { |x| not f.call(x, pivot) })\n after = quick_sort(f, a[1..-1].delete_if { |x| f.call(x, pivot) })\n return (before << pivot).concat(after)\nend", "title": "" }, { "docid": "b0c4010bbdb317b748e9f035001ffd0a", "score": "0.6813758", "text": "def quick_sort\n\n return self if self.length <= 1\n\n pivot = self.shift\n numbers_greater = []\n numbers_less = []\n\n self.each do | number |\n if number <= pivot\n numbers_less << number\n else\n numbers_greater << number\n end\n end\n return numbers_less.quick_sort + [pivot] + numbers_greater.quick_sort\n end", "title": "" }, { "docid": "c8a0fb8681f107714814cabc4c40bf65", "score": "0.68056226", "text": "def quicksort(arr, first, last)\n if first < last\n p_index = partition(arr, first, last)\n quicksort(arr, first, p_index - 1)\n quicksort(arr, p_index + 1, last)\n end\n arr\nend", "title": "" }, { "docid": "5389725d9505abec36114f7cf1da5f96", "score": "0.6785096", "text": "def quicksort(arr, first, last)\n p \"Input2: \", arr\n puts \"Lo : #{first}\"\n puts \"Hi : #{last}\"\n if first < last\n p_index = partition2(arr, first, last)\n quicksort(arr, first, p_index - 1)\n quicksort(arr, p_index + 1, last)\n end\n\n arr\nend", "title": "" }, { "docid": "08505bfe74765e5d3c4f9a3535df1d04", "score": "0.67733306", "text": "def quick_sort(arr, low, high)\n if low < high\n temp = partition(arr, low, high)\n left = temp[0]\n right = temp[1]\n quick_sort(arr, low, left - 1)\n quick_sort(arr, right + 1, high)\n end\nend", "title": "" }, { "docid": "640b2c68e1cef724051e2fd1097b7120", "score": "0.67716914", "text": "def quick_sort(arr, left, right)\n if (right > left)\n pivot_ind = partition(arr, left, right)\n quick_sort(arr, left, pivot_ind-1)\n quick_sort(arr, pivot_ind+1, right)\n end\n end", "title": "" }, { "docid": "640b2c68e1cef724051e2fd1097b7120", "score": "0.67716914", "text": "def quick_sort(arr, left, right)\n if (right > left)\n pivot_ind = partition(arr, left, right)\n quick_sort(arr, left, pivot_ind-1)\n quick_sort(arr, pivot_ind+1, right)\n end\n end", "title": "" }, { "docid": "3aa23a943a3465eae11f8136b75971b4", "score": "0.67715484", "text": "def quicksort(inputs, lo, hi)\n if lo < hi\n mi = partition inputs, lo, hi\n quicksort inputs, lo, (mi-1)\n quicksort inputs, (mi+1), hi\n end\n p inputs\nend", "title": "" }, { "docid": "8ed643ce24cec4c51d3dae782745cb5b", "score": "0.67666185", "text": "def quick_sort(collection)\n return collection if collection.length <= 1\n pivot = collection.sample\n\n left = Array.new\n right = Array.new\n\n collection.each do |x|\n if x <= pivot\n left << x\n else\n right << x\n end\n end\n\n quick_sort(left) + quick_sort(right)\n\nend", "title": "" }, { "docid": "2aa0581906749e4ae44d81c925d12611", "score": "0.67663026", "text": "def my_quick_sort(&prc)\n\n end", "title": "" }, { "docid": "8fb991c54db12a407b104837566b69d4", "score": "0.6765445", "text": "def quickSort( ar)\n if ar.length <= 1\n return ar\n end\n\n pivot = ar[0]\n left = []\n right = []\n\n ar.each do |value|\n if value < pivot\n left.push(value)\n else\n right.push(value)\n end\n end\n\n return quickSort(left) + quickSort(right)\nend", "title": "" }, { "docid": "a4d6f54b2a86586fa38f0c38f95b3970", "score": "0.674805", "text": "def quick_sort(arr)\n return arr if arr.size <= 1\n pivot = arr.first\n left, right = arr.drop(1).partition{|el| el <= pivot }\n quick_sort(left) + [pivot] + quick_sort(right)\nend", "title": "" }, { "docid": "4ce8918e283c97f4e508a5a76a884354", "score": "0.6738446", "text": "def func_quick_sort(list)\n\treturn list if list.length <= 1\n\th, *t = list\n\tfunc_quick_sort(t.select { |i| i < h }) + [h] + func_quick_sort(t.select { |i| i >= h })\nend", "title": "" }, { "docid": "2c507b53a5cfecf757104d5b1b2fd09e", "score": "0.67356944", "text": "def quicksort(arr, s_idx = 0, e_idx = arr.length)\n if s_idx == e_idx \n\n end \n pivot_idx = 0\n barrier_idx = 0\n i = 1 \n while i < arr.length \n if arr[i] < arr[pivot_idx]\n barrier_idx += 1\n else \n #swap \n end \n i+=1\n end \nend", "title": "" }, { "docid": "cde2891dc1fb4f1fc4ac6626f903ef75", "score": "0.67189205", "text": "def quick_sort(array, start=0, finish=(array.size - 1))\n if start < finish\n pivot = partition(array, start, finish)\n quick_sort(array, start, pivot - 1)\n quick_sort(array, pivot + 1, finish)\n end\nend", "title": "" }, { "docid": "177bf4fb75a4648d6511779dffefa1ad", "score": "0.6718404", "text": "def quick_sort3(array, left, right)\n\n if left == right\n return\n end\n \n pivoit_index = ((right + left) / 2).floor\n pivoit = array[pivoit_index]\n \n new_left = left\n new_right = right\n \n while new_left <= new_right\n while array[new_left] < pivoit\n new_left += 1\n end\n while array[new_right] > pivoit\n new_right -= 1\n end\n \n if new_left <= new_right\n tmp = array[new_left]\n array[new_left] = array[new_right]\n array[new_right] = tmp\n new_left += 1\n new_right -= 1\n end\n end\n \n if array[new_left] == pivoit\n pivoit_index = new_left\n end\n \n if array[new_right] == pivoit\n pivoit_index = new_right\n end\n\n\n puts pivoit\n puts \"left #{left} new_left #{new_left}, new_right #{new_right} right #{right}\"\n p array\n\n quick_sort3(array, left, pivoit_index - 1)\n\n \n\n quick_sort3(array, pivoit_index + 1 , right)\n\n\n\nend", "title": "" }, { "docid": "5eb47e338fb9aecd0636d3123a6696cf", "score": "0.6713901", "text": "def quick_sort(arr)\n\nreturn arr if arr.length <= 1 \npivot_arr = [arr.first]\nleft_side = arr[1..-1].select {|ele| ele < arr.first}\nright_side = arr[1..-1].select {|ele| ele >= arr.first}\nquick_sort(left_side) + pivot_arr + quick_sort(right_side)\nend", "title": "" }, { "docid": "d2e7836569b289941a1d4b9aa72f0d9e", "score": "0.6699049", "text": "def quicksort(arr, first, last)\n if first < last\n pivot_index = partition(arr, first, last)\n quicksort(arr, first, pivot_index - 1)\n quicksort(arr, pivot_index + 1, last)\n end\nend", "title": "" }, { "docid": "579c1efc5752437103984b1998f8b091", "score": "0.66988397", "text": "def quickSort(list)\n\nend", "title": "" }, { "docid": "32e3ebca3225aa785e713658dad35852", "score": "0.66945046", "text": "def quicksort(arr)\n if arr.length <= 1\n return arr\n else\n copy = arr.dup\n pivot = copy.shift\n left = []\n right = []\n copy.each do |el|\n if el < pivot\n left << el\n else\n right << el\n end\n end\n quicksort(left) + [pivot] + quicksort(right)\n end\nend", "title": "" }, { "docid": "b60c8b80df06c63123c95e52af59bb3d", "score": "0.6689051", "text": "def quick_sort(arr)\n quick_sort_helper(arr, 0, arr.length - 1)\n\n arr\nend", "title": "" }, { "docid": "e9d94f72d9d5fe2667f1ec4581be2f55", "score": "0.66820574", "text": "def quick_sort(arr)\n return arr if arr.length <= 1\n\n pivot = arr[0]\n left_side = arr[1..-1].select { |ele| ele < pivot }\n right_side = arr[1..-1].select { |ele| ele >= pivot } # put dupes on only one side!\n\n quick_sort(left_side) + [pivot] + quick_sort(right_side)\nend", "title": "" }, { "docid": "51ead4396c55b9224728c3bf0fb95903", "score": "0.66773224", "text": "def quick_sort\n return self if self.length <= 1\n array = self\n pivot_index = (array.length/2).to_i\n pivot = array[pivot_index]\n left_array = []\n right_array = []\n (0...pivot_index).each do |i|\n left_array << array[i] if array[i] <= pivot\n right_array << array[i] if array[i] > pivot\n end\n (pivot_index+1...array.length).each do |i|\n left_array << array[i] if array[i] <= pivot\n right_array << array[i] if array[i] > pivot\n end\n left_array = left_array.quick_sort if left_array.length > 1\n right_array = right_array.quick_sort if right_array.length > 1\n left_array + [pivot] + right_array\nend", "title": "" }, { "docid": "82593c5fbf1e8d3cca860a485de21b23", "score": "0.66679627", "text": "def quicksort(xs, &prc)\n return [] unless xs\n\n pivot = Undefined\n xs.each { |o| pivot = o; break }\n return xs if pivot.equal? Undefined\n\n lmr = xs.group_by do |o|\n if o.equal?(pivot)\n 0\n else\n yield(o, pivot)\n end\n end\n\n quicksort(lmr[-1], &prc) + lmr[0] + quicksort(lmr[1], &prc)\n end", "title": "" }, { "docid": "5ef58a3c0a45f14c1cc5b249ea809657", "score": "0.6667778", "text": "def quick_sort(start, pend, array)\n\t\n\tif (start < pend)\n\t\t\n\t\t# p is partitioning index, array[p]\n\t\t# is at right place\n\t\tp = partition(start, pend, array)\n\t\t\n\t\t# Sort elements before partition\n\t\t# and after partition\n\t\tquick_sort(start, p - 1, array)\n\t\tquick_sort(p + 1, pend, array)\n end \nend", "title": "" }, { "docid": "90c5ae4cfaa23c6cee56845424a8f3e9", "score": "0.6660985", "text": "def quicksort(a, p, r)\n if p < r\n q = partition(a, p, r)\n quicksort(a, p, q - 1)\n quicksort(a, q + 1, r)\n end\nend", "title": "" }, { "docid": "8f30dc84068d44e34828ebb21a505190", "score": "0.66529", "text": "def quick_sort(numbers, left, right)\n i = left + 1\n k = right\n while i < k do\n while numbers[i] < numbers[left] && i < right do\n i += 1\n end\n while numbers[k] >= numbers[left] && k > left do\n k -= 1\n end\n if i < k\n w = numbers[i]\n numbers[i] = numbers[k]\n numbers[k] = w\n end\n end\n w = numbers[left]\n numbers[left] = numbers[k]\n numbers[k] = w\n while left < (k - 1) do\n quick_sort(numbers, left, k - 1)\n end\n while (k + 1) < right do\n quick_sort(numbers, k + 1, right)\n end\n numbers\nend", "title": "" }, { "docid": "892aa18ac7e1e955ae6b7b7daacc636e", "score": "0.6647486", "text": "def quick_sort(arr)\n #base case\n return arr if arr.length <= 1\n #inductive case\n pivot = [arr[0]] # add array to array\n left_side = arr[1..-1].select { |el| el <= arr[0]}\n right_side = arr[1..-1].select { |el| el >= arr[0]}\n quick_sort(left_side) + pivot + quick_sort(right_side)\nend", "title": "" }, { "docid": "62ba6d49d4662198d1334c16cc0bd36b", "score": "0.66466063", "text": "def quick_sort(arr)\n return [] if arr.length == 0\n return arr if arr.length == 1\n pivot = arr[0]\n left = arr[1..-1].select { |el| el < pivot }\n right = arr[1..-1].select { |el| el >= pivot }\n quick_sort(left) + [pivot] + quick_sort(right)\nend", "title": "" }, { "docid": "ddc328796298bd1586dec814ca0b279f", "score": "0.6640945", "text": "def qsort!()\n # Stack stores the indexes that still need sorting\n stack = []\n left_end, right_end = @start, (@total - 1)\n\n # We are either processing a 'new' partition or one that\n # was saved to stack earlier.\n while true\n left, right = left_end, (right_end - 1) # Leave room for pivot\n eqls_left, eqls_right = (left_end - 1), right_end\n\n # Choose pivot from median\n # CAUTION: This is NOT the same as #qsort_block!\n middle = left_end + ((right_end - left_end) / 2)\n low, mid, hi = @tuple.at(left_end), @tuple.at(middle), @tuple.at(right_end)\n\n segment_size = right_end - left_end\n\n # \"Heuristic\" to avoid problems with reverse-sorted\n if segment_size > 1000 and (low <=> mid) == 1 and (mid <=> hi) == 1\n semi_left = @tuple.at(left_end + ((middle - left_end) / 2))\n semi_right = @tuple.at(middle + ((right_end - middle) / 2))\n\n if (low <=> semi_left) == 1 and (semi_left <=> mid) == 1 and\n (mid <=> semi_right) == 1 and (semi_right <=> hi) == 1\n\n r = segment_size / 4\n while r > 0\n @tuple.swap(rand(segment_size), rand(segment_size))\n r -= 1\n end\n\n middle += (right_end - middle) / 2\n end\n end\n\n # These can be reordered which may help with sorting randomly\n # distributed elements at the cost of presorted. Be sure to\n # mark down the correct order though..\n @tuple.swap(left_end, right_end) if (hi <=> low) < 0\n @tuple.swap(left_end, middle) if (mid <=> low) < 0\n @tuple.swap(middle, right_end) if (hi <=> mid) < 0\n\n pivot = @tuple.at(middle)\n @tuple.swap(right_end, middle) # Known position to help partition three ways\n\n # Partition\n while true\n while left < right_end\n case @tuple.at(left) <=> pivot\n when -1\n left += 1\n when 0\n @tuple.swap(left, (eqls_left += 1))\n left += 1\n else\n break\n end\n end\n\n while right > left_end\n case @tuple.at(right) <=> pivot\n when 1\n right -= 1\n when 0\n @tuple.swap(right, (eqls_right -= 1))\n right -= 1\n else\n break\n end\n end\n\n break if left >= right\n @tuple.swap(left, right)\n end\n\n # Move pivot back to the middle\n @tuple.swap(left, right_end)\n left, right = (left - 1), (left + 1)\n\n # Move the stashed == pivot elements back to the middle\n while eqls_left >= left_end\n @tuple.swap(eqls_left, left)\n left -= 1\n eqls_left -= 1\n end\n\n unless right >= right_end\n while eqls_right < right_end and right < right_end\n @tuple.swap(eqls_right, right)\n right += 1\n eqls_right += 1\n end\n end\n\n # Continue processing the now smaller partitions or if\n # done with this segment, restore a stored one from the\n # stack until nothing remains either way.\n left_size, right_size = (left - left_end), (right_end - right)\n\n # Insertion sort is faster at anywhere below 7-9 elements\n if left_size < ISORT_THRESHOLD\n isort! left_end, left\n\n # We can restore next saved if both of these are getting sorted\n if right_size < ISORT_THRESHOLD\n isort! right, right_end\n break if stack.empty? # Completely done, no stored ones left either\n left_end, right_end = stack.pop\n else\n left_end = right\n end\n\n elsif right_size < ISORT_THRESHOLD\n isort! right, right_end\n right_end = left\n\n # Save whichever is the larger partition and do the smaller first\n else\n if left_size > right_size\n stack.push [left_end, left]\n left_end = right\n else\n stack.push [right, right_end]\n right_end = left\n end\n end\n end\n end", "title": "" }, { "docid": "59829ec60667cbd9340d90621e6e2d3e", "score": "0.6639278", "text": "def quick_sort(arr, low, high)\n if low < high\n pi = partition(arr, low, high)\n quick_sort(arr, low, pi-1) #sort left of pivot\n quick_sort(arr, pi+1, arr.length-1)\n end\nend", "title": "" }, { "docid": "837603966beedc4c004b20497c2f0fe8", "score": "0.6638788", "text": "def quick_sort2(array, left, right)\n pivoit_index = ((right + left) / 2).floor\n pivoit = array[pivoit_index]\n \n new_left = left\n new_right = right\n \n while new_left <= new_right\n while array[new_left] < pivoit\n new_left += 1\n end\n while array[new_right] > pivoit\n new_right -= 1\n end\n \n if new_left <= new_right\n tmp = array[new_left]\n array[new_left] = array[new_right]\n array[new_right] = tmp\n new_left += 1\n new_right -= 1\n end\n end\n\n\n puts pivoit\n puts \"left #{left} new_left #{new_left}, new_right #{new_right} right #{right}\"\n p array\n\n if left < new_right\n quick_sort2(array, left, new_right )\n end\n \n if new_left < right\n quick_sort2(array, new_left , right)\n end\n\n\nend", "title": "" }, { "docid": "5bf183608809a72370da890cc04c965b", "score": "0.6624699", "text": "def quick_sort(arr)\n return arr if arr.length <= 1\n pivot = arr[0]\n left = []\n right = []\n idx = 1\n while idx < arr.length\n if arr[idx] < pivot\n left.push(arr[idx])\n else\n right.push(arr[idx])\n end\n idx += 1\n end\n quick_sort(left).concat([pivot]).concat(quick_sort(right))\nend", "title": "" }, { "docid": "5ea8ec2191c6b243ce2353befbd03c29", "score": "0.6611698", "text": "def quickSort(a, l, r)\n\n if l >= r\n return a\n end\n\n x = a[l]\n i = l\n j = r\n\n while i <= j do\n while a[i] < x do\n i += 1\n end\n while a[j] > x do\n j -= 1\n end\n if i <= j\n t = a[i]\n a[i] = a[j]\n a[j] = t\n i += 1\n j -= 1\n end\n end\n\n # recovering here\n quickSort(a, l, j)\n quickSort(a, i, r)\n\n\n\n return a\nend", "title": "" }, { "docid": "53179c40bdce1dab9601a4e2f3800281", "score": "0.6608396", "text": "def quick_sort(array, low = 0, high = array.size - 1)\n if low < high\n partition_idx = partition(array, low, high)\n quick_sort(array, low, partition_idx - 1)\n quick_sort(array, partition_idx + 1, high)\n end\n\n array\nend", "title": "" }, { "docid": "848a31b74afb809c7ffdcf3ba70fd517", "score": "0.6604388", "text": "def quick_sort(arr)\n return arr if arr.length <= 1\n\n pivot_arr = [arr.first]\n left_side = arr[1..-1].select { |ele| ele < arr.first }\n right_side = arr[1..-1].select { |ele| ele >= arr.first }\n\n quick_sort(left_side) + pivot_arr + quick_sort(right_side)\n\n\nend", "title": "" }, { "docid": "8103492a674766cd4238a3cc5aee0233", "score": "0.6600428", "text": "def quick_sort(nums)\n if nums.count <= 1\n return nums\n else\n pivot = nums.sample\n left = nums.select { |num| num < pivot}\n right = nums.select { |num| num > pivot}\n\n quick_sort(left) + [pivot] + quick_sort(right)\n end\nend", "title": "" }, { "docid": "b9ecf07a86b8f2ac5e9be3e1d8e2e45d", "score": "0.65916413", "text": "def quick_sort(array)\n # Base Case\n # => if there is only one element in the array, return array\n if array.length <= 1\n return array\n end\n\n # grab first element as a pivot element\n # => push all other elements less than pivot into left\n # => all elements greater or equal to right\n pivot = array[0]\n left = []\n right = []\n\n array[1..-1].each do |val|\n if val < pivot\n left.push(val)\n else\n right.push(pivot)\n end\n end\n\n # recursively call left\n # => and pivot plus recursive call with right\n quick_sort(left) + pivot + quick_sort(right)\nend", "title": "" }, { "docid": "57fea9b4694dfecd8d58460ca465acaa", "score": "0.6589884", "text": "def quickSort(arr)\n partation(arr)\n arr\nend", "title": "" }, { "docid": "2b28a16524a57c7d5224ca344d165c2e", "score": "0.6588312", "text": "def quick_sort(array, low = 0, high = array.size - 1)\n if low < high\n partition_idx = partition(array, low, high)\n # passing refs -> array is mutated after calling partition\n quick_sort(array, low, partition_idx - 1)\n quick_sort(array, partition_idx + 1, high)\n end\n\n array\nend", "title": "" }, { "docid": "302a85d32bc78b33f77e287149495759", "score": "0.65879834", "text": "def quick_sort arr\n if arr.length <= 1\n return arr\n end\n\n pivot = arr.first\n\n lesser, greater = [], []\n\n (1..arr.length-1).each do |idx|\n el = arr[idx]\n if el <= pivot\n lesser.push el\n else\n greater.push el\n end\n end\n\n return quick_sort(lesser) + [pivot] + quick_sort(greater)\nend", "title": "" }, { "docid": "c3f0e2719036eae5561f032953c09d0b", "score": "0.65818477", "text": "def introspective_sort(array)\n return array if array.empty?\n\n depth_limit = (2 * Math.log10(array.size) / Math.log10(2)).floor\n quick_sort(array, depth_limit)\nend", "title": "" }, { "docid": "f6eec60173ac5a0827c447029bb0d49e", "score": "0.6577376", "text": "def quicksort(array, left, right)\n if right - left <= 0\n return\n end\n\n pivot = partition(array,left, right)\n quicksort(array, left, pivot - 1)\n quicksort(array, pivot+1, right)\n\n array\nend", "title": "" }, { "docid": "7395c6307b975f20b65aecea48e92799", "score": "0.6575554", "text": "def quick_sort(&prc)\n return self if length <= 1\n\n prc ||= proc { |x, y| x <=> y }\n left, right = [], []\n pivot = rand(size)\n\n each_index do |i|\n next if i == pivot\n comparison = prc.call(self[i], self[pivot])\n comparison < 1 ? left << self[i] : right << self[i]\n end\n\n left.quick_sort(&prc) + [self[pivot]] + right.quick_sort(&prc)\n end", "title": "" }, { "docid": "0d6e0c142d0e330d3722eccfc521f442", "score": "0.65744007", "text": "def quick_sort(arr)\n return arr if arr.length <= 1\n pivot_arr = [arr.first]\n left_side = arr[1..-1].select { |ele| ele < arr.first}\n right_side = arr[1..-1].select { |ele| ele >= arr.first}\n quick_sort(left_side) + pivot_arr + quick_sort(right_side)\nend", "title": "" }, { "docid": "d2565a59b0bcd66ad3bb172cd65ac835", "score": "0.65740055", "text": "def quick_sort(collection, left_index, right_index)\n unless collection\n return nil\n end\n\n if right_index <= left_index\n return collection\n else\n\n pivot = collection[right_index]\n new_pivot_loc = left_index\n\n for i in left_index...(right_index)\n\n temp = collection[i]\n if temp < pivot\n collection[i] = collection[new_pivot_loc]\n collection[new_pivot_loc] = temp\n new_pivot_loc += 1\n end\n end\n\n collection[right_index] = collection[new_pivot_loc]\n collection[new_pivot_loc] = pivot\n\n\n quick_sort(collection, left_index, new_pivot_loc - 1)\n quick_sort(collection, new_pivot_loc + 1, right_index)\n end\n\n end", "title": "" }, { "docid": "fe26173debe06abf9efeef6ef037ec58", "score": "0.65655404", "text": "def quicksort(arr)\n return arr if arr.length <= 1\n\n # set one element as pivot\n pivot = arr[0]\n \n # set bound behind which all values <= pivot\n bound = 1\n (1...arr.length).each do |i|\n \n # rearrange array so that:\n # less than pivot => left of pivot (unordered)\n # greater than pivot => right of pivot (unordered)\n # PIVOT IS NOW IN THE CORRECT POSITION\n if pivot > arr[i]\n if bound != i\n puts \"swapping #{arr[i]} and #{arr[bound]}\"\n arr[i], arr[bound] = arr[bound], arr[i]\n end\n bound += 1\n end\n end\n \n # recursively sort elements on either side of pivot\n quicksort(arr[1...bound]) + [pivot] + quicksort(arr[bound...arr.length])\nend", "title": "" }, { "docid": "d95fec8a8b2be54628ac7b1ac616756f", "score": "0.65598965", "text": "def quick_sort(array)\n if array.size < 2\n array\n else\n pivot = array.last\n partition = array[0...-1].partition { |elem| elem < pivot }\n quick_sort(partition.first) + [pivot] + quick_sort(partition.last)\n end\nend", "title": "" }, { "docid": "7fcf42b35e761459d1c96e8e66d82b4a", "score": "0.6550829", "text": "def quick_sort(collection, p=0, r=collection.length - 1 )\n if p < r\n q = partition(collection, p, r)\n #sort the sub-arrays\n quick_sort(collection, p, q-1)\n quick_sort(collection, q+1, r)\n end\n return collection\nend", "title": "" }, { "docid": "ef468452d3cdd47dc8ddaa36f7e879ab", "score": "0.65465945", "text": "def quick_sort(arr, arr_start = 0, arr_end = arr.length - 1)\n #if end of array is the same as start - 1 element array already sorted, otherwise no values to check\n if arr_end <= arr_start || arr.length < 2\n return\n end\n\n #partition the received array and receive the pivot point index to divide it further\n pivot = partition_2sides(arr, arr_start, arr_end)\n #sort the remaining halves to the left and right of pivot\n quick_sort(arr, arr_start, pivot - 1)\n quick_sort(arr, pivot + 1, arr_end)\n return\nend", "title": "" }, { "docid": "f13a0733db6a4948c90c1cd1684950eb", "score": "0.6537773", "text": "def quicksort(lst)\n if lst.size <= 1\n return lst\n else\n pivot = lst.shift\n return quicksort(lst.select{|x| x <= pivot}) +\n [pivot] +\n quicksort(lst.select{|x| x > pivot})\n end\nend", "title": "" }, { "docid": "3ed79c4148f218ee3dd2370c6325dc5c", "score": "0.65376097", "text": "def quicksort(array, arr_start, arr_end)\n p \"array is #{array}\"\n p \"arr_start is #{arr_start}\"\n p \"arr_end is #{arr_end}\"\n # Greater than ensures base case reached when only one element left in array, \n # or segment is invalid (e.g. calling index-1 of 0th element)\n if arr_start < arr_end\n p_index = partition(array, arr_start, arr_end)\n quicksort(array, arr_start, p_index -1)\n quicksort(array, p_index +1, arr_end)\n end\n array\nend", "title": "" }, { "docid": "fdbbf5878f448034d689ab2398246ded", "score": "0.6529811", "text": "def quicksort(data, left, right)\n return if left+1 >= right\n #ai, bi, ci = left, (left+right)/2, right-1\n\tai = left\n bi = (left+right)/2\n\tci = right-1\n #a, b, c = data[ai], data[bi], data[ci]\n\ta = data[ai]\n\tb = data[bi]\n\tc = data[ci]\n if a < b\n if c < a\n pos = ai\n elsif c < b\n pos = ci\n else\n pos = bi\n\t\tend\n else\n if c < b\n pos = bi\n elsif c < a\n pos = ci\n else\n pos = ai\n\t\tend\n\tend\n pivot = data[pos]\n\tdata[pos] = data[right-1]\n tail = left\n (left..right-1).each do |i|\n if data[i] < pivot\n #data[tail], data[i] = data[i], data[tail]\n\t\t\tt = data[tail]\n\t\t\tdata[tail] = data[i]\n\t\t\tdata[i] = t\n tail += 1\n\t\tend\n\tend\n #data[right-1], data[tail] = data[tail], pivot\n\tdata[right-1] = data[tail]\n\tdata[tail] = pivot\n quicksort(data, left, tail)\n quicksort(data, tail+1, right)\nend", "title": "" }, { "docid": "82a6a3de1caf927dbb96e18fa93163df", "score": "0.65193295", "text": "def quicksort(array, low, high) \n move = 0\n if low < high\n \n l = low\n (low..high-1).each do |i|\n if array[i] <= array[high]\n array[i], array[l] = array[l], array[i]\n l += 1\n \n move += 1\n end\n end\n array[l], array[high] = array[high], array[l]\n move += 1\n\n low_index = l\n \n movetoleft = quicksort(array, low, low_index - 1) \n movetoright = quicksort(array, low_index + 1, high)\n \n move += movetoleft + movetoright\n end\n \n return move\nend", "title": "" }, { "docid": "537655177535b70dd8daf1d17cb9ed9f", "score": "0.65173715", "text": "def quick_sort(array)\n return array if array.length <= 1\n pivot = array.pop \n left_array,right_array= [],[]\n array.each do |i| \n i < pivot ? left_array.push(i) : right_array.push(i)\n end\n #quicksort the subarrays recursively \n sorted_left = quick_sort(left_array)\n sorted_right = quick_sort(right_array)\n sorted_left + [pivot] + sorted_right\nend", "title": "" }, { "docid": "b51d7c3f20929eb5060d0471265f8edf", "score": "0.65079916", "text": "def quick_sort(arr, min, max)\n\tif min >= max #One element to sort\n\t\t#end\n\telse\n\t\tpivot = partition(arr, min, max)\n\n\t\tquick_sort(arr, min, pivot-1)\n\t\tquick_sort(arr, pivot+1, max)\n\tend\nend", "title": "" }, { "docid": "74ef1553092570ae0f3eaccfd1b39482", "score": "0.6500962", "text": "def quick_sort(a,st,ed)\n\n if a.length == 0\n return nil\n end\n if a.length < 2\n return a\n end\n\n if st < ed\n p_index = partition(a,st,ed) # calling partition index\n quick_sort(a,st,p_index-1)\n quick_sort(a,p_index+1,ed)\n end\n return a\nend", "title": "" }, { "docid": "0d41b01e7212f1c984dc12b59b614fe0", "score": "0.6491148", "text": "def quicksort(array)\n return array if array.length <= 1\n pivot = array[(array.length/2)]\n #puts \"#{array.inspect}, #{pivot}\"\n left = []\n right = []\n track_same_value = []\n array.each do |a|\n if a < pivot\n left.push(a)\n elsif a > pivot\n right.push(a)\n elsif pivot == a\n track_same_value.push(a)\n end\n end\n quicksort(left).concat(track_same_value).concat(quicksort(right))\nend", "title": "" }, { "docid": "0b18f31b1d3b334964da73fd36f45cac", "score": "0.64764667", "text": "def quickSort(array)\n if array.length <= 1\n puts \"returning an array of one\"\n return array\n end\n\n pivot_index = array.length/2\n pivot_val = array[pivot_index]\n before = []\n after = []\n\n array.each do |num|\n if num < pivot_val\n before << num\n elsif num > pivot_val\n after << num\n end\n end\n\n puts \"Before: #{before}\"\n puts \"After: #{after}\"\n\n return quickSort(before) + [pivot_val] + quickSort(after)\nend", "title": "" }, { "docid": "fec811c999975757fd5092d4d82015c5", "score": "0.64642096", "text": "def quicksort(arr)\n return arr if arr.length <= 1\n pivot_arr = [arr.first]\n left_side = arr[1..-1].select { |el| el < arr.first }\n right_side = arr[1..-1].select { |el| el >= arr.first }\n p \"left: #{left_side}, piv: #{pivot_arr}, right: #{right_side}\"\n quicksort(left_side) + pivot_arr + quicksort(right_side)\nend", "title": "" }, { "docid": "5a9706892ef6f882cee09cfecce30a99", "score": "0.6457865", "text": "def Quick(array, left, right)\n if left < right\n pivot = Partition(array, left, right)\n Quick(array, left, pivot - 1)\n Quick(array, pivot + 1, right)\n end\nend", "title": "" }, { "docid": "7da970bdb5208c23258a262e036d54ee", "score": "0.6448277", "text": "def quick_sort_recursive(p, r, pivot_selection, pred)\n if p < r\n q = partition(p, r, pivot_selection, pred)\n quick_sort_recursive(p, q - 1, pivot_selection, pred)\n quick_sort_recursive(q + 1, r, pivot_selection, pred)\n end\n end", "title": "" }, { "docid": "3ad9da329b1efcbddb41dd7b95dbdf48", "score": "0.6428406", "text": "def quicksort(array)\n pivot_idx = array.length-1 #pivot is always the last elem\n #p array\n if array.length == 1\n return array\n else\n #p array\n 0.upto(array.length-1) {|idx|\n if array[idx] < array[pivot_idx]\n array[idx], array[-1] = array[-1], array[idx]#swap\n elsif array[pivot_idx] > array[idx]\n array[idx], array[0] = array[0], array[idx]\n else\n array[idx], array[pivot_idx-1] = array[pivot_idx-1], array[idx]\n end\n }\n pivot_idx -= 1\n #another loop after pivot idx changes\n quicksort(array[0..(pivot_idx-1)])\n p array[(pivot_idx+1)..-1]\n #p array[-1]\n # if array[(pivot_idx+1)..-1]\n quicksort(array[(pivot_idx+1)..-1])\n # end\n end\nend", "title": "" }, { "docid": "d15588ecaf0645b740676c5a22850a75", "score": "0.6423912", "text": "def quick_sort(array)\n divide = lambda do |start_index,end_index|\n return if start_index >= end_index\n\n mid = start_index\n\n pivot = array[end_index]\n for i in start_index..end_index\n if array[i] < pivot\n array[i], array[mid] = array[mid], array[i]\n mid += 1\n end\n end\n array[mid], array[end_index] = array[end_index], array[mid]\n divide.call(start_index, mid - 1)\n divide.call(mid + 1, end_index )\n end\n divide.call(0, array.length - 1 )\n array\n end", "title": "" }, { "docid": "9d13c397e1266625a986a1df7e6ad3de", "score": "0.6413868", "text": "def quick_sort(a, l, r)\n if l < r\n \td = partition(a, l, r)\n \tquick_sort(a, l, d - 1)\n \tquick_sort(a, d + 1, r)\n end\n \n a \t \n end", "title": "" }, { "docid": "9cba898fedb847d4100a136aff3b5f44", "score": "0.6413378", "text": "def quick_sort(array)\n return array if array.length <= 1\n pivot_point = (0...array.length).to_a.sample\n array[0], array[pivot_point] = array[pivot_point], array[0] \n\n pivot_boundry = 1\n unpartitioned_boundry = 1\n\n (1...array.length).each do |i|\n if array[i] < array[0]\n array[pivot_boundry], array[i] = array[i], array[pivot_boundry]\n pivot_boundry += 1\n end\n unpartitioned_boundry += 1\n end\n array[0], array[pivot_boundry-1] = array[pivot_boundry-1], array[0]\n quick_sort(array[0...pivot_boundry]) + quick_sort(array[pivot_boundry...array.length])\nend", "title": "" }, { "docid": "e6d75de24c83b15ba60fd38a266faf0e", "score": "0.64014316", "text": "def test_e2318_median3_quicksort\n\n check_sort_correctness :e2318_median3_quicksort\n\n thousand_items = (0..1000).to_a\n @aux = Array.new(thousand_items.length)\n merge_sort_proc = Proc.new {\n standard_merge_sort(thousand_items.shuffle, 0, thousand_items.length - 1)\n }\n\n median3_sort_proc = create_proc :e2318_median3_quicksort, thousand_items.shuffle\n # Check that its faster than the standard merge sort\n assert_faster_proc(median3_sort_proc, merge_sort_proc)\n end", "title": "" }, { "docid": "3321847fcccec14ef1f77dbba4888a92", "score": "0.6393352", "text": "def quick_sort(arr, start_idx = 0, len = arr.length)\n return arr if len < 2\n\n pivot_idx = start_idx\n pivot = arr[pivot_idx]\n\n ((start_idx + 1)...(start_idx + len)).each do |idx|\n el = arr[idx]\n\n if el < pivot\n arr[idx] = arr[pivot_idx + 1]\n arr[pivot_idx + 1] = pivot\n arr[pivot_idx] = el\n\n pivot_idx += 1\n end\n end\n\n left_len = pivot_idx - start_idx\n right_len = len - (left_len + 1)\n \n quick_sort(arr, start_idx, left_len)\n quick_sort(arr, pivot_idx + 1, right_len)\nend", "title": "" }, { "docid": "bce2e655a46d69ded50c25d84bc1bd0f", "score": "0.63680524", "text": "def quick_sort(arr)\n return arr if arr.length <= 1\n pivot = arr.pop\n less = arr.select { |x| x < pivot }\n more = arr.select { |x| x > pivot }\n print less + [pivot] + more\nend", "title": "" }, { "docid": "9c6ddec5e7fcb6ef0e262d3d49118a52", "score": "0.6362182", "text": "def recursive_partition arr, low, high\n\t\t# The current partition of the array\n\t\trange = (low..high)\n\t\t@comparisons += range.size-1\n\t\t\n\t\t# The pivot by which this recursive call will sort\n\t\tpivot_index = choose_pivot(range, arr)\n\t\tpivot_value = arr[pivot_index]\n\t\t\n\t\t# Move the pivot to the beginning of the partition \n\t\tarr.swap! pivot_index, low\n\t\tpivot_index = low\n\n\t\t# i is the index keeping track of where the pivot should be moved\n\t\t# j is the index keeping track of our pass through the partition\n\t\ti = j = low\n\n\t\t# Base case when there are just two elements then brute force it\n\t\tif range.size <=2\n\t\t\tarr.swap!(i, i+1) if arr[i+1] < arr[i]\n\t\telse\n\t\t# Otherwise scan through the partition looking for values less than\n\t\t# the pivot and swapping when this is the case\n\t\t\twhile j <= high do\n\t\t\t\tif arr[j] <= pivot_value\n\t\t\t\t\tarr.swap! i, j\n\t\t\t\t\ti += 1\n\t\t\t\tend\n\t\t\t\tj += 1\n\t\t\tend\n\n\t\t\tarr.swap! pivot_index, i-1\n\t\t\tpivot_index = i-1\n\n\t\t\trecursive_partition(arr, low, pivot_index-1) unless low >= pivot_index-1\n\t\t\trecursive_partition(arr, pivot_index+1, high) unless pivot_index+1 >= high\n\t\tend\n\n\t\treturn arr\n\tend", "title": "" }, { "docid": "41f2f54b0bfc7b4086ef4f9c4b0ba059", "score": "0.63583666", "text": "def quicksort(arr, start_idx = 0, length = arr.length)\n return arr if length <= 1\n\n pivot_idx = partition(arr, start_idx, length)\n left_length = pivot_idx - start_idx\n right_length = length - left_length - 1\n\n quicksort(arr, start_idx, left_length)\n quicksort(arr, pivot_idx + 1, right_length)\n arr\nend", "title": "" }, { "docid": "ccaeb2d2bc9d4cb338b0dd992afaadd0", "score": "0.63535285", "text": "def quick_sort(array)\n return array if array.length <= 1\n\n pivot = array[0]\n lower_array = []\n higher_array = []\n\n array[1..(array.length - 1)].each do |element|\n element <= pivot ? lower_array << element : higher_array << element\n end\n\n quick_sort(lower_array).concat([pivot]).concat(quick_sort(higher_array))\nend", "title": "" }, { "docid": "62dfb725a611a08994d58dd498c4cf21", "score": "0.6349516", "text": "def quick_sort_two arr, left, right\n if (left + CUT_OFF < right)\n p = median(arr, left, right)\n arr[p], arr[right] = arr[right], arr[p]\n pivot = arr[right]\n i = left \n j = right - 1\n loop do\n i += 1 while i < j and arr[i] < pivot\n j -= 1 while i < j and arr[j] > pivot\n break if i >= j\n arr[i], arr[j] = arr[j], arr[i]\n i += 1\n j -= 1\n end\n\n arr[i], arr[right] = arr[right], arr[i] if arr[i] > pivot\n\n quick_sort_two arr, left, i - 1 if left < i\n quick_sort_two arr, i + 1, right if right > i\n else\n insertion_sort arr, right - left + 1\n end\n arr\n end", "title": "" }, { "docid": "200ae07edf07a1e4a009eb995340dc8b", "score": "0.63487124", "text": "def quicksort(nums)\n if (nums.length <= 1) then return nums end\n\n pivot = nums[nums.length - 1]\n left = []\n right = []\n\n i = 0\n while (i < nums.length - 1)\n if (nums[i] < pivot)\n left.push(nums[i])\n else\n right.push(nums[i])\n end\n i += 1\n end\n\n sortedLeft = quicksort(left)\n sortedRight = quicksort(right)\n\n return sortedLeft + [pivot] + sortedRight\n\nend", "title": "" }, { "docid": "5d32ce233aadde9808051ec1300a8796", "score": "0.63449126", "text": "def quickSort\n\nend", "title": "" }, { "docid": "d406a533e912bc70bbaef5cfcb6f4fe0", "score": "0.63405", "text": "def quick_sort_simple(array)\n # return [] if array.empty?\n return array if array.size < 2\n #partition the array with the 1st element of the array: smaller on the left and larger on the right\n left, right = array[1..-1].partition { |y| y <= array.first } \n quick_sort_simple(left) + [ array.first ] + quick_sort_simple(right)\nend", "title": "" }, { "docid": "7f1cfd98893018eb01a7db257fe75019", "score": "0.63375527", "text": "def quick_sort(a,lo,hi)\n if lo<hi\n p=partition(a,lo,hi)\n quick_sort(a,lo,p-1)\n quick_sort(a,p+1,hi)\n end\n return a\n end", "title": "" }, { "docid": "95f635bba14179c8cef6a4397af1ac96", "score": "0.63364553", "text": "def quicksort(tosort)\n\tif tosort.length<=1\n\t\t return tosort\n\t\tend\n\n\tpivot_index = tosort.length/2\n\n\tless= Array.new\n\tgreater= Array.new\n\tpivot=tosort.delete_at(pivot_index)\n\n\ttosort.each do |x| \n\t\tif x<=pivot\n\t\t\tless << x\n\t\telse\n\t\t\tgreater << x\n\t\tend\n\tend\n\treturn quicksort(less) << pivot << quicksort(greater)\nend", "title": "" }, { "docid": "a7069a66a4a715693026f7dab8cfa480", "score": "0.6332577", "text": "def quickSort!(time=false,verbose=false,visual=false,randomize=false)\n\t\tstartTime = Time.now if time\n\t\ttarget = self\n\t\tif randomize\n\t\t\ttarget.length.times do |i|\n swapPos = rand((target.length) -i ) + i\n \t target[i],target[swapPos] = target[swapPos],target[i]\n end\n\t\tend\n\t\tresult = qSort(target,0,(target.length)-1,verbose,visual)\n\t\tendTime = Time.now if time\n\t\treturn [result,endTime - startTime] if time\n\t\treturn result\n\tend", "title": "" }, { "docid": "68ced4ed81b2d2aa9fb84c5d5b4ff610", "score": "0.63299704", "text": "def advanced_quicksort(array)\n quick_sort(array, 0, array.length - 1)\nend", "title": "" }, { "docid": "68ced4ed81b2d2aa9fb84c5d5b4ff610", "score": "0.63299704", "text": "def advanced_quicksort(array)\n quick_sort(array, 0, array.length - 1)\nend", "title": "" } ]
16895b5f50ab8ecc5b6a01da6f9cce51
Set a SockJS socket handler. This handler will be called with a SockJS socket whenever a SockJS connection is made from a client
[ { "docid": "3eea3ef3339e9ca6ce13f62972dff224", "score": "0.6507073", "text": "def socket_handler\n if block_given?\n @j_del.java_method(:socketHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::VertxApex::SockJSSocket.new(event)) }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling socket_handler()\"\n end", "title": "" } ]
[ { "docid": "593fda371688071fc88f0c2f0ae2cdf7", "score": "0.6507575", "text": "def socket_handler\n if block_given?\n @j_del.java_method(:socketHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxWeb::SockJSSocket)) }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling socket_handler()\"\n end", "title": "" }, { "docid": "40b658483a1b81ab4ebba32cd36dd19c", "score": "0.6491448", "text": "def configure_event_handling(options = {})\n @socket.onopen { |handshake| handle_open(handshake) }\n @socket.onclose { handle_close }\n @socket.onmessage { |raw_message| handle_message_received(raw_message) }\n end", "title": "" }, { "docid": "1df7a480694abab42fa8de60c0fd8300", "score": "0.64315933", "text": "def onHandlerConnected(sock)\n if (@sock != nil)\n # already listening to a handler\n sock.write('ERROR Already connected to a handler')\n sock.close\n return\n end\n listenOn(sock)\n end", "title": "" }, { "docid": "2907e35e552304bc4dd1cca0e421630c", "score": "0.63227427", "text": "def tcp_handler(handler, event_data)\n on_error = handler_error(handler, event_data)\n begin\n EM::connect(handler[:socket][:host], handler[:socket][:port], Socket) do |socket|\n socket.on_success = Proc.new do\n @handling_event_count -= 1 if @handling_event_count\n end\n socket.on_error = on_error\n timeout = handler[:timeout] || 10\n socket.set_timeout(timeout)\n socket.send_data(event_data.to_s)\n socket.close_connection_after_writing\n end\n rescue => error\n on_error.call(error)\n end\n end", "title": "" }, { "docid": "894f926b7611e5fe4494e1cd604545bb", "score": "0.62579274", "text": "def register_writable sock\n if reactor_thread?\n @poller.register_writable sock.raw_socket\n end\n end", "title": "" }, { "docid": "9f68dd2fb6dcd6c938bc1eb92f0ef7da", "score": "0.6216803", "text": "def socket(socket)\n self.set(:sock, socket)\n end", "title": "" }, { "docid": "3e5cd41a670dcc8f214dd5adcd909d3b", "score": "0.613795", "text": "def handler(nsock = nil)\n # If no socket was provided, try the global one.\n if ((!nsock) and (self.client))\n nsock = self.client.conn\n end\n\n # If the parent claims the socket associated with the HTTP client, then\n # we rip the socket out from under the HTTP client.\n if (((rv = super(nsock)) == Handler::Claimed) and\n (self.client) and\n (nsock == self.client.conn))\n self.client.conn = nil\n end\n\n rv\n end", "title": "" }, { "docid": "d4f1101223ff5304f8d0e3d80d261ebf", "score": "0.6106106", "text": "def socket(socket_type, handler = nil)\n zmq_socket = @context.socket(socket_type)\n \n fd = []\n if zmq_socket.getsockopt(ZMQ::FD, fd) < 0\n raise \"Unable to get socket FD: #{ZMQ::Util.error_string}\"\n end\n \n \n EM.watch(fd[0], EventMachine::ZeroMQ::Socket, zmq_socket, socket_type, handler).tap do |s|\n s.register_readable if READABLES.include?(socket_type)\n s.register_writable if WRITABLES.include?(socket_type)\n \n yield(s) if block_given?\n end\n end", "title": "" }, { "docid": "2179ebaed3790f50ff7e26ad99bdfb56", "score": "0.609843", "text": "def handle_connection(socket)\n @sockets << socket\n end", "title": "" }, { "docid": "6c0f1e853979dc84fb6a8bc91856e76d", "score": "0.60906315", "text": "def push_socket handler_instance\n create_socket handler_instance, ZMQMachine::Socket::Push\n end", "title": "" }, { "docid": "38e41ca5ab9724ed587e99e9a8aa0460", "score": "0.60707325", "text": "def socket=(value)\n @socket = value\n end", "title": "" }, { "docid": "38f2ee9dd0c3704939b120ecb014a4c5", "score": "0.60272515", "text": "def rep_socket handler_instance\n create_socket handler_instance, ZMQMachine::Socket::Rep\n end", "title": "" }, { "docid": "0b2de33fa8bfd9d70391860dea3fb61c", "score": "0.60201335", "text": "def sub_socket handler_instance\n create_socket handler_instance, ZMQMachine::Socket::Sub\n end", "title": "" }, { "docid": "6889c22a8b36583f653da9bde37fe4cb", "score": "0.6000657", "text": "def handler(nsock = nil)\n\t\t# If no socket was provided, try the global one.\n\t\tif ((!nsock) and\n\t\t (self.client))\n\t\t\tnsock = self.client.conn\n\t\tend\n\t\n\t\t# If the parent claims the socket associated with the HTTP client, then\n\t\t# we rip the socket out from under the HTTP client.\n\t\tif (((rv = super(nsock)) == Handler::Claimed) and\n\t\t (self.client) and\n\t\t (nsock == self.client.conn))\n\t\t\tself.client.conn = nil\n\t\tend\n\n\t\trv\n\tend", "title": "" }, { "docid": "bc9334d08928526a1ec530f194331e45", "score": "0.5966335", "text": "def on_open(ws, settings)\n settings.sockets << ws\n end", "title": "" }, { "docid": "6350b9f8d839850d0f72e6bbdd3ec2dd", "score": "0.5961981", "text": "def handler(sock)\n\t\treturn if not sock\n\t\t\n\t\t_find_prefix(sock)\n\n\t\t# Flush the receive buffer\n\t\tsock.get_once(-1, 1)\n\t\t\n\t\t# If this is a multi-stage payload, then we just need to blindly\n\t\t# transmit the stage and create the session, hoping that it works.\n\t\tif (self.payload_type != Msf::Payload::Type::Single)\n\t\t\thandle_connection(sock)\n\t\t# Otherwise, check to see if we found a session. We really need\n\t\t# to improve this, as we could create a session when the exploit\n\t\t# really didn't succeed.\n\t\telse\n\t\t\tcreate_session(sock)\n\t\tend\n\n\t\treturn self._handler_return_value\n\tend", "title": "" }, { "docid": "961ca7c17aad97cf4dd48ff096a76ea8", "score": "0.5959532", "text": "def req_socket handler_instance\n create_socket handler_instance, ZMQMachine::Socket::Req\n end", "title": "" }, { "docid": "d61e78f8fa7709d0a00ae50ea07282ee", "score": "0.5953209", "text": "def handler(nsock = nil)\n\t\t# If no socket was provided, try the global one.\n\t\tif ((!nsock) and\n\t\t (self.client))\n\t\t\tnsock = self.client.conn\n\t\tend\n\n\t\t# If the parent claims the socket associated with the HTTP client, then\n\t\t# we rip the socket out from under the HTTP client.\n\t\tif (((rv = super(nsock)) == Handler::Claimed) and\n\t\t (self.client) and\n\t\t (nsock == self.client.conn))\n\t\t\tself.client.conn = nil\n\t\tend\n\n\t\trv\n\tend", "title": "" }, { "docid": "3deaff8d4e1c196c8d00bfb227cde5d4", "score": "0.5930344", "text": "def socket type, handler = nil, *args\n socket = Socket.new(@zmq_context.socket(type), handler, *args)\n block_given? ? yield(socket) : socket\n end", "title": "" }, { "docid": "8f877be84f6faa60f1398f79b85286bb", "score": "0.5927205", "text": "def handle_gs_set_game_server(socket, message)\n log \"setting game server\" if not @game_server\n @game_server ||= socket\n end", "title": "" }, { "docid": "fa59c5743a33dbdbf84deb34aca7a055", "score": "0.59185183", "text": "def on_connect(socket)\n end", "title": "" }, { "docid": "8dc58aa69b3cb07fe9af5ad3b9a3e250", "score": "0.5881381", "text": "def setup_handler\n if !datastore['Proxies'].blank? && !datastore['ReverseAllowProxy']\n raise RuntimeError, \"TCP connect-back payloads cannot be used with Proxies. Use 'set ReverseAllowProxy true' to override this behaviour.\"\n end\n\n ex = false\n\n comm = select_comm\n local_port = bind_port\n\n bind_addresses.each do |ip|\n begin\n self.listener_sock = Rex::Socket::TcpServer.create(\n 'LocalHost' => ip,\n 'LocalPort' => local_port,\n 'Comm' => comm,\n 'Context' =>\n {\n 'Msf' => framework,\n 'MsfPayload' => self,\n 'MsfExploit' => assoc_exploit\n })\n rescue\n ex = $!\n print_error(\"Handler failed to bind to #{ip}:#{local_port}:- #{comm} -\")\n else\n ex = false\n via = via_string_for_ip(ip, comm)\n print_status(\"Started #{human_name} handler on #{ip}:#{local_port} #{via}\")\n break\n end\n end\n raise ex if (ex)\n end", "title": "" }, { "docid": "10931cac062ac91825a7bfb3a1b70ad1", "score": "0.58582795", "text": "def sock=(sock)\n\tself.scanner_socks ||= {}\n\tself.scanner_socks[Thread.current.to_s] = sock\nend", "title": "" }, { "docid": "d7782c2824643f214ee3a06c4f9c583b", "score": "0.58431983", "text": "def websocket_handler\n @websocket_handler ||= self.class.websocket_handler.new(self, @options || {})\n end", "title": "" }, { "docid": "29e44c48b52fa907e457212f822fa82c", "score": "0.58421785", "text": "def notify_socket_created(comm, sock, param)\n each_event_handler() { |handler|\n handler.on_socket_created(comm, sock, param)\n }\n end", "title": "" }, { "docid": "5d3f2cf4104438915b181be5a539cce6", "score": "0.5837209", "text": "def method_missing method, *args, &block\n @sock.send method, *args, &block\n end", "title": "" }, { "docid": "a5d0086b208b5990f9a5c0088b0ec978", "score": "0.5836493", "text": "def socket\n hijack do |ws|\n sock = TCPSocket.new(*@server.vnc_address)\n Thread.new do\n loop do\n IO.select([sock], [], [sock])\n begin\n data = sock.recv(8192)\n raise \"EOF\" if data.length == 0\n ws.send_data Base64.strict_encode64(data)\n rescue => e\n ws.close\n break\n end\n end\n end\n ws.onmessage do |data|\n begin\n sock << Base64.decode64(data)\n rescue\n sock.close\n ws.close\n end\n end\n end\n end", "title": "" }, { "docid": "6047f77ebc77a61a110f30f681134c93", "score": "0.58253604", "text": "def init_handler()\n self.class.recvsocket[@bind_host] = Socket.new(\n Socket::PF_INET,\n Socket::SOCK_RAW,\n Socket::IPPROTO_ICMP\n )\n if @bind_host != \"*\"\n saddr = Socket.pack_sockaddr_in(0, @bind_host)\n self.recvsocket.bind(saddr)\n end\n \n if EM.respond_to?(:watch)\n self.class.handler = EM.watch(self.recvsocket, Handler, self.recvsocket){ |c| c.notify_readable = true }\n else\n self.class.handler = EM.attach(self.recvsocket, Handler, self.recvsocket)\n end\n end", "title": "" }, { "docid": "524e914363db5c4eb3600f7088fb6627", "score": "0.5824569", "text": "def on_writable socket\n #@reactor.log :debug, \"#{self.class}#on_writable, deregister for writes on sid [#{@session_id}]\"\n @reactor.deregister_writable socket\n end", "title": "" }, { "docid": "38ab0f6957b04e11284a12bcf06bfcaa", "score": "0.58150667", "text": "def set_up_socket_monitor( reactor, socket, *events )\n\t\treturn reactor.register_monitor( socket, *events, &self.method(:on_monitor_event) )\n\tend", "title": "" }, { "docid": "b31923a0376892305cb64fbf4950a621", "score": "0.58086014", "text": "def register_readable sock\n if reactor_thread?\n @poller.register_readable sock.raw_socket\n end\n end", "title": "" }, { "docid": "b3298b231e17dfbe444e47f068ea2357", "score": "0.5798724", "text": "def xreq_socket handler_instance\n create_socket handler_instance, ZMQMachine::Socket::XReq\n end", "title": "" }, { "docid": "9a82cee5939d581e00d9ebf302485755", "score": "0.5780189", "text": "def web_socket_handler\n @web_socket_handler ||= WebSocket.new config\n end", "title": "" }, { "docid": "448942f518cf30a25a138c0861d4378b", "score": "0.5778393", "text": "def on_socket_event( event )\n\t\tif event.readable?\n\t\t\tself.handle_client_input( event )\n\t\telsif event.writable?\n\t\t\tself.handle_client_output( event )\n\t\telse\n\t\t\traise \"Socket event was neither readable nor writable!? (%s)\" % [ event ]\n\t\tend\n\tend", "title": "" }, { "docid": "de5ae19e9f3032c16a840c382113630d", "score": "0.57614094", "text": "def on_socket_created(comm, sock, param)\n end", "title": "" }, { "docid": "f83e65da34289888cf9da79063e1d1be", "score": "0.57590365", "text": "def handle_ws_connection(socket)\n add_client(socket)\n super(socket)\n end", "title": "" }, { "docid": "ae506f3318809d400f7a7e37b4a16a19", "score": "0.5706738", "text": "def configure_client(options = {})\n socket.client.set(options)\n end", "title": "" }, { "docid": "5e3076811fb9a46ab612847a635bd008", "score": "0.5704902", "text": "def connect(socket, observer = nil, &callback)\n @mutex.synchronize { @observers[socket] = (observer || callback) }\n end", "title": "" }, { "docid": "1220adbce27925d516c10e5d14c1141e", "score": "0.5704432", "text": "def set_new_socket\n @socket = @server.accept_nonblock\n rescue IO::WaitReadable, Errno::EINTR\n end", "title": "" }, { "docid": "05187c1278e4f0d6bbe18dca22b639fe", "score": "0.56934935", "text": "def pub_socket handler_instance\n create_socket handler_instance, ZMQMachine::Socket::Pub\n end", "title": "" }, { "docid": "46e9a971fc4c396e473e2001328f4048", "score": "0.5692824", "text": "def method_missing(method_sym, *arguments, &block)\n @socket.send(method_sym, *arguments, &block)\n end", "title": "" }, { "docid": "46e9a971fc4c396e473e2001328f4048", "score": "0.5692824", "text": "def method_missing(method_sym, *arguments, &block)\n @socket.send(method_sym, *arguments, &block)\n end", "title": "" }, { "docid": "4672f8dc8448fdfe19be424d786c32bc", "score": "0.56822187", "text": "def initialize(socket, opts = {})\n @socket = socket\n @logger = opts[:logger] || Logger.new(STDOUT)\n @is_client = opts[:is_client]\n @path = opts[:path]\n @host = opts[:host]\n @origin = opts[:origin]\n\n # sent to indicate that the connection is closing\n # the only time this should be true is when the server initiates\n # a connection_close_frame and is waiting for the client response\n @closing = false\n @previous_opcode = nil\n @serve_thread = nil\n\n @handlers = opts[:handlers] || Hash.new {|h, v| h[v] = []}\n @default_handlers = Hash.new {|h, v| h[v] = []}\n set_default_handlers\n end", "title": "" }, { "docid": "c5ee83577ee9e5b98aae40b2fbd08fda", "score": "0.56788546", "text": "def listen\n @socket.listen\n end", "title": "" }, { "docid": "9af1809f498feaba580de35ea60d2860", "score": "0.56728095", "text": "def start_socket_server\n EventMachine::WebSocket.start(configuration.socket_options) do |socket|\n socket.onopen do\n connection = Connection.new(socket)\n connection.establish\n\n socket.onmessage { |data| connection.process(data) }\n socket.onclose { Channel.remove(connection) }\n end\n end\n end", "title": "" }, { "docid": "c51853d3014989c3823b0c1c16043e78", "score": "0.56611854", "text": "def pull_socket handler_instance\n create_socket handler_instance, ZMQMachine::Socket::Pull\n end", "title": "" }, { "docid": "af23bafeba3aa2d1976228acac908d0e", "score": "0.5656124", "text": "def onWSBinary(socket, message)\n \n nil\n\n nil\n end", "title": "" }, { "docid": "3f8579f39078fce2fbeaa5f1fb7fc358", "score": "0.5648953", "text": "def initialize socket\n super\n @socket = socket\n end", "title": "" }, { "docid": "72d1a38ce87fdd32981ffae984750d70", "score": "0.5622411", "text": "def xrep_socket handler_instance\n create_socket handler_instance, ZMQMachine::Socket::XRep\n end", "title": "" }, { "docid": "ff41a81550baf6b9e747e0456cdd290e", "score": "0.56214845", "text": "def serving_socket(options)\n port = options[:port] || 0\n interface_ip = options[:ip] || '0.0.0.0'\n socket = Zerg::Support::SocketFactory.socket :in_addr => interface_ip,\n :in_port => port, :no_delay => true, :reuse_addr => true\n socket.listen\n socket\n end", "title": "" }, { "docid": "78c7899cc50a49794ab3f80ef27aec9a", "score": "0.5611916", "text": "def configure_socket\n shutdown_socket if self.sock\n self.sock = ::Rex::Socket::Udp.create(\n 'Context' =>\n { 'Msf' => framework, 'MsfExploit' => framework_module }\n )\n end", "title": "" }, { "docid": "31a3149cc05ed6dd633652b73748205e", "score": "0.5600074", "text": "def add_socket(sock)\n\t\tself.sockets << sock\n\tend", "title": "" }, { "docid": "2767c24d49d9879cedaa22949b2a925c", "score": "0.5591051", "text": "def with_socket_monitor( reactor, socket, *events )\n\t\tmon = self.set_up_socket_monitor( reactor, socket )\n\n\t\treturn yield\n\tensure\n\t\tself.clean_up_socket_monitor( mon )\n\tend", "title": "" }, { "docid": "6c7eb294f85ca5a7514e4c2087c6e99f", "score": "0.55904144", "text": "def setup_handler\n if !datastore['Proxies'].blank? && !datastore['ReverseAllowProxy']\n raise RuntimeError, \"TCP connect-back payloads cannot be used with Proxies. Use 'set ReverseAllowProxy true' to override this behaviour.\"\n end\n\n ex = false\n\n comm = select_comm\n local_port = bind_port\n bind_addresses.each { |ip|\n begin\n\n self.listener_sock = Rex::Socket::SslTcpServer.create(\n 'LocalHost' => ip,\n 'LocalPort' => local_port,\n 'Comm' => comm,\n 'SSLCert' => datastore['HandlerSSLCert'],\n 'Context' =>\n {\n 'Msf' => framework,\n 'MsfPayload' => self,\n 'MsfExploit' => assoc_exploit\n })\n\n ex = false\n\n via = via_string_for_ip(ip, comm)\n print_status(\"Started reverse SSL handler on #{ip}:#{local_port} #{via}\")\n break\n rescue\n ex = $!\n print_error(\"Handler failed to bind to #{ip}:#{local_port}\")\n end\n }\n raise ex if (ex)\n end", "title": "" }, { "docid": "c367773e2f30bae3b259012957a9d6af", "score": "0.5577811", "text": "def setup_handler\n if !datastore['Proxies'].blank? && !datastore['ReverseAllowProxy']\n raise RuntimeError, 'TCP connect-back payloads cannot be used with Proxies. Can be overriden by setting ReverseAllowProxy to true'\n end\n\n ex = false\n\n comm = select_comm\n local_port = bind_port\n\n bind_addresses.each { |ip|\n begin\n\n self.listener_sock = Rex::Socket::SslTcpServer.create(\n 'LocalHost' => ip,\n 'LocalPort' => local_port,\n 'Comm' => comm,\n 'SSLCert' => datastore['HandlerSSLCert'],\n 'Context' =>\n {\n 'Msf' => framework,\n 'MsfPayload' => self,\n 'MsfExploit' => assoc_exploit\n })\n\n ex = false\n\n via = via_string_for_ip(ip, comm)\n\n print_status(\"Started reverse double SSL handler on #{ip}:#{local_port} #{via}\")\n break\n rescue\n ex = $!\n print_error(\"Handler failed to bind to #{ip}:#{local_port}\")\n end\n }\n raise ex if (ex)\n end", "title": "" }, { "docid": "6b6e8ce31729b70cebf7b72b31dff41a", "score": "0.5568729", "text": "def handler(nsock = self.ip_sock)\n\t\ttrue\n\tend", "title": "" }, { "docid": "101359136f5454f7626b268b9dc7355b", "score": "0.5564941", "text": "def add_socket(message,socket)\n # Must do server side error handling if a phony hostname gets sent in here.\n host = message[:host]\n if !@sockets[host]\n @sockets[host] = {}\n end\n if message[:server] && !@sockets[host][:server]\n @sockets[host][:server] = socket\n elsif !message[:server] && !@sockets[host][message[:clientID]]\n @sockets[host][message[:clientID]] = socket\n end\n end", "title": "" }, { "docid": "547a6c13aac7485c9122e3fe30364cd9", "score": "0.55558246", "text": "def handle_connection socket\n connection = H2::Server::Connection.new socket: socket, server: self\n @on_connection[connection]\n connection.read if connection.attached?\n end", "title": "" }, { "docid": "547a6c13aac7485c9122e3fe30364cd9", "score": "0.55558246", "text": "def handle_connection socket\n connection = H2::Server::Connection.new socket: socket, server: self\n @on_connection[connection]\n connection.read if connection.attached?\n end", "title": "" }, { "docid": "a39aa1819c406deb10ecdda3ca75fb34", "score": "0.55516744", "text": "def with_connection\n connect if @sock.nil? || [email protected]?\n yield @sock\n end", "title": "" }, { "docid": "d6cb95758531a8a5460c3508c133a6b6", "score": "0.55476916", "text": "def socket_start_listening\n EventMachine::WebSocket.start(@socket_params) do |ws|\n handle_open(ws)\n handle_message(ws)\n end\n end", "title": "" }, { "docid": "ce3360a46eb28a1397eed3441186456e", "score": "0.5541344", "text": "def configure_socket(options, env); end", "title": "" }, { "docid": "1a11087fc4aa59c351bc89b13a2737fa", "score": "0.5530028", "text": "def start_server(addr, port, handler = Connection, *args, &block)\n # make sure we're a 'real' class here\n klass = if (handler and handler.is_a?(Class))\n handler\n else\n Class.new( Connection ) {handler and include handler}\n end\n \n server = Coolio::TCPServer.new(addr, port, CallsBackToEM, *args) do |wrapped_child| \n conn = klass.new(wrapped_child)\n conn.heres_your_socket(wrapped_child) # ideally NOT have this :)\n wrapped_child.call_back_to_this(conn) \n block.call(conn) if block\n end\n\n server.attach(Coolio::Loop.default)\n end", "title": "" }, { "docid": "1c6df1dd03a23b620ea03ad0feb6cfb6", "score": "0.5523567", "text": "def heres_your_socket(instantiated_coolio_socket)\n instantiated_coolio_socket.call_back_to_this self\n @wrapped_coolio = instantiated_coolio_socket\n end", "title": "" }, { "docid": "5299c3bed161cc9e770b026bcc6ba9e1", "score": "0.55140203", "text": "def client_listen\nend", "title": "" }, { "docid": "9020855c594bc537b8ebd143996b0ecf", "score": "0.5513451", "text": "def handle_connection socket\n remote_port = socket.remote_address.ip_port\n remote_hostname = socket.remote_address.ip_address\n remote_ip = socket.remote_address.ip_address\n\n info = {ip:remote_ip, port:remote_port, hostname:remote_hostname, now:Clock.now}\n if accept? socket, info\n accept_connection socket, info\n else\n reject_connection socket, info\n end\n rescue ConnectionError => e\n log \"Rejected connection from #{remote_ip}:#{remote_port}, #{e.to_s}\", level: :warning\n notify_error e\n rescue StandardError => e\n log \"Connection: #{e.to_s}\", exception: e, level: :error\n notify_error e, level: :internal\n ensure\n close socket, info\n end", "title": "" }, { "docid": "e47b3f176b7081262ad9d3a308163726", "score": "0.550706", "text": "def startup_client\n this = self\n WebSocket::Client::Simple.connect(\"#{@stream_endpoint}/v2/signalflow/connect\",\n # Verification is disabled by default so this is essential\n {verify_mode: OpenSSL::SSL::VERIFY_PEER}) do |ws|\n @ws = ws\n ws.on :error do |e|\n @logger.error(\"ERROR #{e.inspect}\")\n end\n\n ws.on :close do |e|\n this.on_close(e)\n end\n\n ws.on :message do |m|\n this.on_message(m)\n end\n\n ws.on :open do\n this.on_open\n end\n end\n end", "title": "" }, { "docid": "c96aba409e5ccac16b6d3901daecc7a3", "score": "0.5493042", "text": "def initialize(socket)\n @socket = socket\n @events = {}\n end", "title": "" }, { "docid": "49c4da179c8d3b996b8157244d52b478", "score": "0.54831904", "text": "def set_my_socket_as_a(role,garden_pid=Process.pid)\n case role\n when :garden\n set_my_socket(Process.pid.to_s)\n @reader = {:sockets => [@my_socket], :buffer => {}}\n @writer = {:sockets => [], :buffer => {}}\n when :gardener\n set_garden_path(garden_pid)\n set_my_socket(Process.pid.to_s + Time.now.to_i.to_s + rand(10000).to_s)\n when :row\n set_garden_path(garden_pid)\n set_my_socket(Process.pid.to_s)\n end\n end", "title": "" }, { "docid": "59b790bc8e8226470c88ecd4e62bdefc", "score": "0.54799837", "text": "def socket\n\t\treturn @socket ||= self.reactor.socket_for_ptr( @poller_event[:socket] )\n\tend", "title": "" }, { "docid": "231f392b820cf5d627a02ec3f7bde8a2", "score": "0.5479498", "text": "def method_missing(name, *args, &block)\n socket.public_send(name, *args, &block)\n end", "title": "" }, { "docid": "ef5f0016f9f907bfc1cfbddd9171d68b", "score": "0.547402", "text": "def configure_socket\n TCP_OPTS.each { |opt| @session.setsockopt(*opt) }\n end", "title": "" }, { "docid": "fe88a2a438ce8734a0fa9fa548c3301d", "score": "0.5470711", "text": "def open_socket\n\t\t\tif @@socket_state == :off\n\t\t\t\tEventMachine.run{\n\t\t\t\t\tEventMachine::WebSocket.start(:host => '0.0.0.0', :port => 9001) do |ws|\n\n\t\t\t\t\t\tws.onopen{\n\t\t\t\t\t\t\t# Much of this will change when I get sessions up and running correctly. I just need some logic to play with right now.\n\t\t\t\t\t\t\t@@clients << ws\n\t\t\t\t\t\t\tputs \"Websocket connection open with #{@@clients.length} clients.\"\n\t\t\t\t\t\t\t@@socket_state = :on\n\t\t\t\t\t\t\tws.send({'action' => 'load',\n\t\t\t\t\t\t\t\t\t\t\t 'boss' => Character.find(5).to_json(:include => :attacks),\n\t\t\t\t\t\t\t\t\t\t\t 'characters' => [Character.find(1),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \tCharacter.find(2), \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \tCharacter.find(3),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \tCharacter.find(4)],\n\t\t\t\t\t\t\t\t\t\t\t 'attacks' => Character.find(1).attacks}.to_json\n\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\tws.onclose{\n\t\t\t\t\t\t\tputs \"Connection closed\"\n\t\t\t\t\t\t\t@@socket_state = :off\n\t\t\t\t\t\t\t@@clients.delete ws\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t# I wonder if there is a better way to delegate the flow of logic here. \n\t\t\t\t\t\t# I initially assumed that most of it would be processed in a few of the\n\t\t\t\t\t\t# classes in the Combat module, but I think there might be a way to actually\n\t\t\t\t\t\t# change the socket object being used in certain situations. I just need \n\t\t\t\t\t\t# to be aware of the changes being made on the front-end so the back-end\n\t\t\t\t\t\t# doesnt end up having holes.\n\n\t\t\t\t\t\tws.onmessage{ |msg|\n\t\t\t\t\t\t\tp @@socket_state\n\t\t\t\t\t\t\tmessage = JSON.parse(msg)\n\n\t\t\t\t\t\t\tif message['action'] == 'attack'\n\t\t\t\t\t\t\t\ttarget = Character.find(message['target'])\n\t\t\t\t\t\t\t\tassailant = Character.find(message['assailant'])\n\t\t\t\t\t\t\t\tattack = Attack.find(message['attack'])\n\n\t\t\t\t\t\t\t\tresolved_target = Combat::Offense.attack_target(assailant, target, attack)\n\n\t\t\t\t\t\t\t\t@@clients.each do |socket|\n\t\t\t\t\t\t\t\t\tsocket.send(resolved_target.to_json)\n\t\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t@@clients.each do |socket|\n\t\t\t\t\t\t\t\t\tsocket.send('Not a valid action.')\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\tputs \"Recieved message: #{msg}\"\n\t\t\t\t\t\t\tws.send \"Pong: #{msg}\"\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tws.onerror{|e| \n\t\t\t\t\t\t\tputs \"Error: #{e.message}\"\n\t\t\t\t\t\t}\n\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\trender 'battle/battleui'\n\t\t\t# -------------\n\t\t\telse\n\t\t\t\trender 'battle/battleui'\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "2489817c86668da4972554607e36766f", "score": "0.5469511", "text": "def on(event, &handler)\n if @connection_event_handlers.keys.include?(event)\n @connection_event_handlers[event] << handler\n end\n end", "title": "" }, { "docid": "2489817c86668da4972554607e36766f", "score": "0.5469511", "text": "def on(event, &handler)\n if @connection_event_handlers.keys.include?(event)\n @connection_event_handlers[event] << handler\n end\n end", "title": "" }, { "docid": "5e9a82d10b23e276fce8e2b01119fea2", "score": "0.5467803", "text": "def initialize(server, sock=nil)\n @server = server # Reactor or connector associated with this session.\n @sock = sock # File descriptor handle for this session.\n @addr = \"\" # Network address of this socket.\n @accepting=@connected=@closing=@write_blocked=false\n end", "title": "" }, { "docid": "de2dd886664e8d04be47532d828e1b85", "score": "0.5467678", "text": "def initialize sock, remoteHost, userdir, socketType\n @authenticated = false\n @user = nil\n @userdb = nil\n @@clients << self\n @socket = sock\n @remoteHost = remoteHost\n @socketType = socketType\n @userdir = userdir\n end", "title": "" }, { "docid": "44af834fa270654af21fdff390b84396", "score": "0.5465046", "text": "def init_socket(role, name)\n puts \"(DEBUG)(Core::Server#%s) Entering method.\" % __callee__\n key = @conn_mngr.expect(role)\n socket = TCPSocket.new(@host, @port)\n socket.puts hello_string(role, name, key)\n puts \"(DEBUG)(Core::Server#%s) Leaving method.\" % __callee__\n socket\n end", "title": "" }, { "docid": "75721eb2cb632fc6127a8ba61db1e9b8", "score": "0.5463783", "text": "def worker\n trap(\"INT\") { exit }\n handler = get_handler\n loop do\n @session = @socket.accept\n configure_socket\n handler.run @session\n end\n end", "title": "" }, { "docid": "3378caa0d3a0192b9c1879dcbebc4ef9", "score": "0.54621166", "text": "def on_socket_connect\n post_init\n end", "title": "" }, { "docid": "c8a67900d27a9e891e4e1bb38f9c61c2", "score": "0.5448609", "text": "def configure_server(options = {})\n socket.server.set(options)\n end", "title": "" }, { "docid": "ff6679638319826178f41813c46e1fc4", "score": "0.5444381", "text": "def configure\n @socket.onopen do |handshake|\n puts \"Connection open\"\n end\n\n @socket.onclose do\n puts \"Connection closed\"\n end\n\n configure_message_callbacks unless @onmessage.empty?\n\n true\n end", "title": "" }, { "docid": "41036c495df2148dd150dd651bd138d7", "score": "0.54415107", "text": "def start(srvsock = nil)\n\n self.listener = srvsock.is_a?(Rex::Socket::TcpServer) ? srvsock : Rex::Socket::TcpServer.create(\n 'LocalHost' => self.listen_host,\n 'LocalPort' => self.listen_port,\n 'Context' => self.context,\n 'Comm' => self.comm\n )\n\n # Register callbacks\n self.listener.on_client_connect_proc = Proc.new { |cli|\n on_client_connect(cli)\n }\n # self.listener.on_client_data_proc = Proc.new { |cli|\n # on_client_data(cli)\n # }\n self.clients = []\n self.monitor_thread = Rex::ThreadFactory.spawn(\"SshServerClientMonitor\", false) {\n monitor_clients\n }\n self.listener.start\n end", "title": "" }, { "docid": "8c5051ce97374eb9ca84bb4701a19e9d", "score": "0.5438719", "text": "def with_connection\n connect if @socket.nil? || [email protected]?\n yield @socket\n end", "title": "" }, { "docid": "e1dcd1b8108d39771759db868b90e01b", "score": "0.54357016", "text": "def on! socket='all', options={}\n call '-o', socket, options\n end", "title": "" }, { "docid": "c485dd7886f5720ad43caf0d3e24b2fd", "score": "0.5434081", "text": "def serve(socket)\n header = read_header(socket)\n # not documented protocol?\n if header['probe'] == '1'\n write_header(socket, build_header)\n elsif check_header(header)\n write_header(socket, build_header)\n read_and_callback(socket)\n if header['persistent'] == '1'\n loop do\n read_and_callback(socket)\n end\n end\n else\n socket.close\n raise 'header check error'\n end\n end", "title": "" }, { "docid": "5145ca0f71a05141f2655c10fa361f56", "score": "0.5425731", "text": "def validate_socket_handler(handler)\n socket = handler[:socket]\n if is_a_hash?(socket)\n must_be_a_string(socket[:host]) ||\n invalid(handler, \"handler host must be a string\")\n must_be_an_integer(socket[:port]) ||\n invalid(handler, \"handler port must be an integer\")\n else\n invalid(handler, \"handler socket must be a hash\")\n end\n end", "title": "" }, { "docid": "4c2dfaa053e37704cc8f9562d9cebe0f", "score": "0.541915", "text": "def call env\n @env = env\n # assert if the request is from a websocket\n if socket_request?\n socket = spawn_socket\n\n # build the connected clients list\n @clients << socket\n\n # return socket rack response in order for connection on client to finish\n # acknowledgement that the websocket has been established\n socket.rack_response\n \n else # drain remaining out of middleware\n @app.call env\n end\n end", "title": "" }, { "docid": "8e3c339b29128c595ac49984a67cd8f9", "score": "0.54149234", "text": "def setup_web_socket\n @web_socket.onopen = lambda do |event|\n send_request\n @web_socket.onmessage = lambda do |event|\n data = event.data\n EventMachine.defer do\n @recv_queue.push data\n end\n end\n @web_socket.onclose = lambda do |event|\n code = event.code\n EventMachine.defer do\n @recv_queue.push code\n end\n end\n end\n end", "title": "" }, { "docid": "5674c92d77b69ca588906eab12168ebf", "score": "0.54093874", "text": "def handle(socket, parsed_message)\n end", "title": "" }, { "docid": "a2b4e30165f9d53c78a63827ff91fa86", "score": "0.5403238", "text": "def register( socket, *events, &handler )\n\t\tif !events.empty? && !events.last.is_a?( Symbol )\n\t\t\thandler_obj = events.pop\n\t\t\thandler = handler_obj.method( :handle_io_event )\n\t\tend\n\n\t\traise LocalJumpError, \"no block or handler given\" unless handler\n\n\t\tself.synchronize do\n\t\t\tself.unregister( socket )\n\n\t\t\tptr = self.ptr_for_socket( socket )\n\t\t\trc = CZTop::Poller::ZMQ.poller_add( @poller_ptr, ptr, nil, 0 )\n\t\t\tself.log.debug \"poller_add: rc = %p\" % [ rc ]\n\t\t\tCZTop::HasFFIDelegate.raise_zmq_err if rc == -1\n\n\t\t\tself.log.info \"Registered: %p with handler: %p\" % [ socket, handler ]\n\t\t\tself.sockets[ socket ][ :handler ] = handler\n\t\t\tself.enable_events( socket, *events )\n\n\t\t\t@socket_pointers[ ptr.to_i ] = socket\n\t\tend\n\tend", "title": "" }, { "docid": "d48e0b1b764177ea786b704c333f917c", "score": "0.53695095", "text": "def add_connection socket\n # make safe TODO\n @connections[socket.remote_node]=socket\n end", "title": "" }, { "docid": "0b0a6d34ce0b54c4d29090be9afecddd", "score": "0.53693753", "text": "def on(event, &handler)\n return unless @connection_event_handlers.keys.include?(event)\n @connection_event_handlers[event] << handler\n end", "title": "" }, { "docid": "c8851067ab302c5d11dfc9f9cdd8583b", "score": "0.5366284", "text": "def init_socket\n host, port = @sipc_proxy.split(':')\n begin\n @socket = TCPSocket.new(host, port)\n rescue Exception => e\n @log.error {\"Cannot connect to sipc proxy -> #{e}\"}\n raise Exception, \"Cannot connect to sipc proxy -> #{e}\"\n end\n end", "title": "" }, { "docid": "4a99d913ceb8017e92e3966b0e982337", "score": "0.5366029", "text": "def on(event, handler)\n raise ArgumentError, \"Unrecognized event (#{event})\" unless (@connection_events + @events).include?(event&.to_sym)\n raise ArgumentError, \"Invalid handler provided. Handler must be callable.\" unless handler.respond_to?(:call)\n\n if @connection_events.include?(event&.to_sym)\n @handlers[event.to_sym] = handler\n else\n RequestHandler.instance.register_handler(event, handler)\n end\n end", "title": "" }, { "docid": "7abd0033ffb9cf859b3666539b3726d2", "score": "0.5354623", "text": "def initialize(params)\n\n super\n @params = params\n @listenPort = getParam(@params, 'server_port').to_i\n @localIF = getParam(@params, 'local_if')\n\n @serverSock = TCPServer.open(@listenPort)\n debug(\"Connected\");\n\n Thread.new(@serverSock) { |ss|\n while ss == @serverSock do\n debug(\"Listen for handler call on '#{@listenPort}'\")\n sock = ss.accept\n onHandlerConnected(sock)\n end\n }\n end", "title": "" }, { "docid": "59a48aae80ec878363a0fbbd3f0cf85e", "score": "0.5347159", "text": "def socket\n @receiver\n end", "title": "" }, { "docid": "59a48aae80ec878363a0fbbd3f0cf85e", "score": "0.5347159", "text": "def socket\n @receiver\n end", "title": "" }, { "docid": "6f243cdd3e2afceb7a6c8f7580d4aa92", "score": "0.53379416", "text": "def websocket\n EM.run do\n EM::WebSocket\n .start host: \"0.0.0.0\", port: @config.port.inbound do |server|\n \n server.onopen do\n @source.clients[UUID.new.generate] = server\n if @source.respond_to? :open\n @source.open server, @source.clients.key(server)\n end\n end\n\n server.onmessage do |message|\n begin\n @message = ::JSTP::Dispatch.new message\n @source.dispatch(@message, server)\n rescue Exception => exception\n log_exception exception, @message\n end\n end\n\n server.onclose do \n if @source.respond_to? :close\n @source.close server, @source.clients.key(server)\n end\n end\n end\n end\n end", "title": "" }, { "docid": "ae1601b9c9c799d21340431fc0585eac", "score": "0.53344715", "text": "def pair_socket handler_instance\n create_socket handler_instance, ZMQMachine::Socket::Pair\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "6e28b76cfa1065a59dfdb2e1149bd779", "score": "0.0", "text": "def argumentative_answer_params\n params.fetch(:argumentative_answer, {})\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": "" } ]
2372dcfff5901b88b819c3f009bbf144
GET /eatables GET /eatables.json
[ { "docid": "b465b3555abf772ffb5385ebe53a03f0", "score": "0.70169157", "text": "def index\n @eatables = Eatable.all\n end", "title": "" } ]
[ { "docid": "a19aa1746ca3ee1e66222e054c011fab", "score": "0.65352094", "text": "def abilities\n get('/ability/')\n end", "title": "" }, { "docid": "7245a99b2919dc773c2b0b84e3eda56b", "score": "0.62024826", "text": "def index\n @weapons = Weapon.all\n\n render json: @weapons\n end", "title": "" }, { "docid": "99f804c9158a156c0ff1ee289a0b8012", "score": "0.61519915", "text": "def index\n @eatens = Eaten.all\n end", "title": "" }, { "docid": "aee3d0e447bda23879af3a76e60c4269", "score": "0.606768", "text": "def index\n @electors = Elector.all\n\n render json: @electors\n end", "title": "" }, { "docid": "8a6ae53616c29b622bcfa898b8243af5", "score": "0.60148764", "text": "def items\n @beverages = Beverage.available\n respond_to do |format|\n format.json { render :json => @beverages.to_json(methods: :image_url)}\n end\n end", "title": "" }, { "docid": "9490c5eb7798340fd48bbc892fbf4f77", "score": "0.60142726", "text": "def index\n json_response(current_restaurant.restaurant_food_items)\n end", "title": "" }, { "docid": "3dfeccab3c1fe19ae2a21596d0721d73", "score": "0.59600776", "text": "def index\n @eats = Eat.all\n end", "title": "" }, { "docid": "03271de0495124ed54714821dc2f512c", "score": "0.5924059", "text": "def index\n #@food_items automatically set to FoodItem.accessible_by(current_ability)\n\n respond_to do |format|\n format.html { render 'index', layout: !(request.xhr?) }\n format.json { render json: @food_items }\n end\n end", "title": "" }, { "docid": "1e76aeadf8c367bac7d5d140548ad51c", "score": "0.588277", "text": "def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end", "title": "" }, { "docid": "b00d393e583f90c314ca18fedb5fb65a", "score": "0.5881056", "text": "def index\n @enemies = Enemy.find_by(name: params[:name])\n render json: @enemies\n end", "title": "" }, { "docid": "2eb986340eac0e957da6b3eadf625e44", "score": "0.5859327", "text": "def index\n @eicons = Eicon.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eicons }\n end\n end", "title": "" }, { "docid": "3e5c65cf21c383f4ba3c25e93a00d6d1", "score": "0.58526534", "text": "def index\n @alleys = Alley.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alleys }\n end\n end", "title": "" }, { "docid": "193b41b8db50a90ed1a3f57ae96190b7", "score": "0.58355933", "text": "def index\n @attendees = Attendees.all\n render json: @attendees\n end", "title": "" }, { "docid": "6fbebc207c48b2392c7c3a51f167c271", "score": "0.58351004", "text": "def index\n @offers = Offer.all\n\n render json: @offers\n end", "title": "" }, { "docid": "f2ec12ebe139a6d744166b8e49b13074", "score": "0.5819681", "text": "def index\n @eatings = Eating.all\n end", "title": "" }, { "docid": "6bcdddfa8b3e987db47a318f9eacacd3", "score": "0.58145386", "text": "def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end", "title": "" }, { "docid": "c1b4b7a88d893bf6ed65ffb8b01fd21e", "score": "0.580308", "text": "def show\n @eatvent = Eatvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eatvent }\n end\n end", "title": "" }, { "docid": "218eab31665e186fecd476d1c3434acd", "score": "0.5797017", "text": "def show\n render json: @diet, status: 200, root: true\n end", "title": "" }, { "docid": "584f5978bc7276a4c0d60803be777809", "score": "0.5785866", "text": "def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end", "title": "" }, { "docid": "f08fae841f3c7e48c20f679018265c9f", "score": "0.57795197", "text": "def index\n @heroes = Hero.all\n\n render json: @heroes\n end", "title": "" }, { "docid": "cd2ef76fa458691426d45d0dd87674e6", "score": "0.57741845", "text": "def items\n \tbegin\n \t@categories = Category.all.includes(items: [:dimensions])\n \t@ingredients = Ingredient.actives\n \trender 'api/v1/home/items', status: :ok\n \trescue Exception => e\n \t\terror_handling_bad_request(e)\n \tend\n\n\tend", "title": "" }, { "docid": "41348066b4d1d3881f4c9986854c8bc2", "score": "0.5769925", "text": "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @life_insurances }\n end\n end", "title": "" }, { "docid": "d52a53214f5500234d4a1c0c0c619009", "score": "0.5766081", "text": "def index\n @teaches = Teach.all\n\t\trespond_to do |format|\n\t\t\tformat.html { render :index }\n\t\t\tformat.json { render json: Oj.dump(@teaches) }\n\t\tend\n\n end", "title": "" }, { "docid": "94938c29c55d28f36b13e86783a13bad", "score": "0.5765783", "text": "def index\n @attendees = Attendee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attendees }\n end\n end", "title": "" }, { "docid": "cc9e82559bebc955c5af8abd56761c87", "score": "0.57598674", "text": "def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend", "title": "" }, { "docid": "23ca7dec53609f6ef1aab5bfff3ea9aa", "score": "0.5759284", "text": "def index\n @objectives = current_user.objectives.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @objectives }\n end\n end", "title": "" }, { "docid": "048d479abe1b13fe4edd9d19424fc5a1", "score": "0.57572806", "text": "def index\n @weapon_types = WeaponType.all\n\n render json: @weapon_types\n end", "title": "" }, { "docid": "ccc4a637d35d0994a1997880ff2d1bef", "score": "0.5755423", "text": "def index\n @items = Item.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n format.xml { render xml: @items }\n end\n end", "title": "" }, { "docid": "e21494bf89f4d187ee8313667f1d954e", "score": "0.5753987", "text": "def index\n @equipcats = Equipcat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @equipcats }\n end\n end", "title": "" }, { "docid": "1c00b1f8ed55042cf6b529d329e4cd8f", "score": "0.57534605", "text": "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "title": "" }, { "docid": "3f2e4f2b4f29ac053a5de3975be81370", "score": "0.5745382", "text": "def index\r\n @attestations = Attestation.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @attestations }\r\n end\r\n end", "title": "" }, { "docid": "b7547733f418dc2d4037e7cf006121d8", "score": "0.5739669", "text": "def index\n @adopters = Adopter.where(filtering_params)\n\n render json: @adopters\n end", "title": "" }, { "docid": "4bc237f5b5b38d01e512bb0088ea603f", "score": "0.57341605", "text": "def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end", "title": "" }, { "docid": "e8f896014b373ca98fd9abb15856ad75", "score": "0.5728204", "text": "def list_ingredients\n rid = params[:id]\n items = Aws.get_ingredients_from_db(rid)\n render :json => items\n end", "title": "" }, { "docid": "5f3638123893e7bdad56825c587e22ef", "score": "0.5726565", "text": "def index\n @teaches = Teach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end", "title": "" }, { "docid": "2fa9c85974f7af11d3d33d76a2817bbc", "score": "0.57239234", "text": "def index\n @breeds = Breed.all\n\n render json: @breeds\n end", "title": "" }, { "docid": "f43811b5ce5441dff9741620d2246ff4", "score": "0.5721109", "text": "def index\n @objectives = @goal.objectives.all \n render json: @objectives \n end", "title": "" }, { "docid": "d5b5f835329620a68c4dac902739a8d1", "score": "0.57201225", "text": "def index\n @offers = Offer.all\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end", "title": "" }, { "docid": "2bed1d9677ef72fa4d9be59ea195d818", "score": "0.5704987", "text": "def index \n ingredients = Ingredient.all\n #render will return the object back in json format so that it can be used by the frontend\n render json: ingredients\n end", "title": "" }, { "docid": "53d8f66056b401bf533988d967eea6ef", "score": "0.56944525", "text": "def favorite_foods\n get(\"/user/#{@user_id}/foods/log/favorite.json\")\n end", "title": "" }, { "docid": "5da70207794132fe291e9c1ca0bd8d28", "score": "0.5690756", "text": "def list_inventors\n json_out(Inventor.all)\n end", "title": "" }, { "docid": "5da70207794132fe291e9c1ca0bd8d28", "score": "0.5690756", "text": "def list_inventors\n json_out(Inventor.all)\n end", "title": "" }, { "docid": "07c8c269a362af22fcbd2bbeba04d24d", "score": "0.56899667", "text": "def show\n json_response(@food_item)\n end", "title": "" }, { "docid": "b20783d2876b409327fa5c69b5dfc76d", "score": "0.56680626", "text": "def index\n\n # use a shooting collection cache\n\n respond_to do |format|\n format.html # index.html.erb\n format.json do\n @shootings = Shooting.get_shootings_from_yammer(Yammer::TokenClient.new(token: current_user.access_token))\n render json: { shootings: @shootings }\n end\n end\n end", "title": "" }, { "docid": "b1e42c81d6f585a54fca808250b3d533", "score": "0.5662894", "text": "def show\n render json: @weapon\n end", "title": "" }, { "docid": "72f3eed548a16166c3b843d5ba84e5cf", "score": "0.5661379", "text": "def index\n @enzymes = Enzyme.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enzymes }\n end\n end", "title": "" }, { "docid": "bc214e2a6226f30ab90a07cb6bf6c1b0", "score": "0.5658597", "text": "def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end", "title": "" }, { "docid": "5fafdcdbb1ba51a45a91362c46ad95d1", "score": "0.5655727", "text": "def index\n @adocao_animals = AdocaoAnimal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @adocao_animals }\n end\n end", "title": "" }, { "docid": "32c22b93a6651c0f798c525a19ea34bd", "score": "0.56554955", "text": "def index\n @breeds = Breed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @breeds }\n end\n end", "title": "" }, { "docid": "9b96e3a7886e80ea92951ffe8dce3d8e", "score": "0.5651274", "text": "def index\n response = HTTParty.get('http://okta-api:8080/pets/v1/cats', {headers: {\"X-Token\"=> session[:oktastate][:credentials][:token]}})\n if response.code == 200\n @cats = JSON.parse(response.body)\n else\n @cats = []\n end\n end", "title": "" }, { "docid": "3a17e4fe5c022cad03ffa81f171015e7", "score": "0.5650539", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @representante_athlete }\n end\n end", "title": "" }, { "docid": "032f3506b1c3562078418df18497fac2", "score": "0.56503", "text": "def index\n @advertisements = Advertisement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advertisements }\n end\n end", "title": "" }, { "docid": "032f3506b1c3562078418df18497fac2", "score": "0.56503", "text": "def index\n @advertisements = Advertisement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advertisements }\n end\n end", "title": "" }, { "docid": "d019bd1853a72c3c85667866bcbaf988", "score": "0.56478447", "text": "def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "title": "" }, { "docid": "7ab8738ee7a69a4e9b018c1c726b1a88", "score": "0.5645063", "text": "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end", "title": "" }, { "docid": "7ab8738ee7a69a4e9b018c1c726b1a88", "score": "0.5645063", "text": "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end", "title": "" }, { "docid": "5841e393693629fb6362ea5cacdaefe3", "score": "0.563935", "text": "def index\n @diets = @profile.diets\n respond_with @diets\n end", "title": "" }, { "docid": "dc1fd0930fa2abd885543937f876ceac", "score": "0.56390464", "text": "def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunes }\n end\n end", "title": "" }, { "docid": "b3f491d0df1efbc0376183320db9c922", "score": "0.5637623", "text": "def index\n recipes = Recipe.all\n render status: :ok, json: recipes\n end", "title": "" }, { "docid": "90d3fe32f82708b9a4946287e03eaf5e", "score": "0.56319994", "text": "def index\n @vegetables = Vegetable.all\n end", "title": "" }, { "docid": "e157caa55aae98ebd6e668a5db54ac16", "score": "0.5628129", "text": "def index\n @foodhampers = Foodhamper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodhampers }\n end\n end", "title": "" }, { "docid": "d36df6648c0c258e22be18459890d591", "score": "0.56247675", "text": "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end", "title": "" }, { "docid": "d8d4d4fef7308700e632075f5d3fc76e", "score": "0.56203216", "text": "def index\n @housing_features = HousingFeature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @housing_features }\n end\n end", "title": "" }, { "docid": "a910a57d78b8e21c88472bb4debf1a82", "score": "0.56050736", "text": "def show\n animal = Animal.find(params[:id])\n #return all the sightings for the animal\n render json: animal.to_json(include: :sightings)\nend", "title": "" }, { "docid": "6e05dac1a10dd934a2c730a32b69010b", "score": "0.55970573", "text": "def show\n @etape = Etape.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etape }\n end\n end", "title": "" }, { "docid": "69759e2a8f05eb897b95e2a67befaa70", "score": "0.5592904", "text": "def index\n getProfile\n @availabilities = @therapist.get_availabilities\n @rec_Availabilities = @therapist.get_recuring_availabilities(2000,1)\n respond_to do |format|\n format.html { redirect_to availabitity_index, notice: \"Appointment declined.\"}\n format.json { render :status => 200, :json => { action: :index,\n availabilities: @availabilities,\n rec_availabilities: @rec_Availabilities,\n user: @user, therapist: @therapist}}\n end\n end", "title": "" }, { "docid": "536873467717fc6bf310a76f16b665d6", "score": "0.55903214", "text": "def index\n @recent = Highfive.recent.approved\n @leaders = User.leaders\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @highfives }\n end\n end", "title": "" }, { "docid": "0bb060056c186e0a76174889d5aff4ae", "score": "0.55900633", "text": "def show\n @ingredient = Ingredient.find_by_url_slug(params[:id])\n @ingredient = Ingredient.find(params[:id]) if @ingredient.nil?\n @recipes = @ingredient.recipes.order('created_at DESC')\n logger.debug @recipes.inspect\n respond_to do |format|\n format.html {render :layout => 'wall'}\n format.json { render json: @ingredient }\n end\n end", "title": "" }, { "docid": "4fd1f0d53f7fdc2c2a7ba7b2bfa3b6af", "score": "0.5589556", "text": "def index\n @representante_athletes = current_user.organization.athletes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @representante_athletes }\n end\n end", "title": "" }, { "docid": "2ea137c123f44a6dabe8da128f10c671", "score": "0.5588672", "text": "def index\n weathers = Weather.all\n render json: weathers, status: 200\n end", "title": "" }, { "docid": "6645fd236ccbb23d5508ac73c0d16661", "score": "0.5580612", "text": "def index\n @weapons_types = WeaponsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weapons_types }\n end\n end", "title": "" }, { "docid": "561fac744b64eae3279ec540ec59a3de", "score": "0.5576504", "text": "def index\n @expenses = find_expenses.all\n render json: @expenses\n end", "title": "" }, { "docid": "288c22158c2434cc2909b1ad35ff5221", "score": "0.5571502", "text": "def index\n @equipment_lists = EquipmentList.all\n render :json => @equipment_lists, :include => [:weapons, :armours, :equipments]\n end", "title": "" }, { "docid": "9bca47d9da6667c6ef035eac8ac3aa75", "score": "0.5567556", "text": "def show\n render json: @dice\n end", "title": "" }, { "docid": "46997487586c8e494d2aa832191374c8", "score": "0.55658334", "text": "def index\n @episodes = Episode.all\n\n render json: @episodes\n end", "title": "" }, { "docid": "f0e74198d19024bb6e4052fd59929207", "score": "0.5565696", "text": "def list_inventors\n \tjson_out(Inventor.all)\n\tend", "title": "" }, { "docid": "6b46a86a65d9bd550d5779c8b51471ff", "score": "0.55626535", "text": "def index\n json_response(Restaurant.all)\n end", "title": "" }, { "docid": "fb6b7001c88c156e4a9e764ba13f69b1", "score": "0.5562065", "text": "def index\n @illnesses = Illness.all\n\n render json: @illnesses\n end", "title": "" }, { "docid": "af516b019c990327fd323baf7d7840db", "score": "0.5561447", "text": "def index\n @honey_badgers = HoneyBadger.all\n respond_to do |format|\n format.html\n format.json { render json: @honey_badgers }\n end\n end", "title": "" }, { "docid": "f8722fa4d0ebf102be1ebdee6987edf6", "score": "0.55608004", "text": "def ingredient_data\n respond_to do |format|\n format.json { render json: helpers.get_ingredient(params[:ingredient_type], params[:ingredient_id]) }\n end\n end", "title": "" }, { "docid": "d2b5c1571d30d242a6547c20553c08a1", "score": "0.55606407", "text": "def index\n @recipes = Recipe.all\n render json: @recipes\n end", "title": "" }, { "docid": "bfe293029a4e4d19cb3ca59ae38e0644", "score": "0.5559264", "text": "def index\n @athletes = Athlete.all\n end", "title": "" }, { "docid": "bfe293029a4e4d19cb3ca59ae38e0644", "score": "0.5559264", "text": "def index\n @athletes = Athlete.all\n end", "title": "" }, { "docid": "f410a66536843ec6c3224dac92201b1e", "score": "0.5558715", "text": "def index\n @shop_bonus_offers = Shop::BonusOffer.order('resource_id asc, currency asc, price asc')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json do\n @shop_bonus_offers.each do |offer|\n offer[:resource_effect] = offer.effect_for_character(current_character) \n end\n \n render json: @shop_bonus_offers\n end\n end\n end", "title": "" }, { "docid": "3390260184d86b521c1cd33f84111c73", "score": "0.55548394", "text": "def index\n @extras = Extra.all\n\n render json: @extras\n end", "title": "" }, { "docid": "c661146db8f3371df72fe8422cb13076", "score": "0.554811", "text": "def index\n @sayings = Saying.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sayings }\n end\n end", "title": "" }, { "docid": "59b7ed13f2db1b43f68c3ccc1521873f", "score": "0.554752", "text": "def index\n @weapons = Weapon.all\n render :json => @weapons, :include => :special_rules\n \n end", "title": "" }, { "docid": "51f7b8aeb063933f872bcd6f9a7caf06", "score": "0.554678", "text": "def index\n @awards = Award.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @awards }\n end\n end", "title": "" }, { "docid": "3b86a3fd8fdba8e58dbdb26a81c40596", "score": "0.55458313", "text": "def index\n @ideas = Idea.all\n\n render json: @ideas\n end", "title": "" }, { "docid": "19aa3aeb1bb18d715a0ab5c25cc2a620", "score": "0.5538773", "text": "def index\n @dices = Dice.all\n\n render json: @dices\n end", "title": "" }, { "docid": "6a9c6504041b9c3483220c011c16517f", "score": "0.5535456", "text": "def index\n @used_bikes = UsedBike.all\n\n render json: @used_bikes, each_serializer: Web::V1::UsedBikeSerializer\n end", "title": "" }, { "docid": "a07e205c827d6d9303c7bc2b3d10b741", "score": "0.5532328", "text": "def index_attending\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.attended_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end", "title": "" }, { "docid": "7dad6f5e2862593587d2c6dec9b1c054", "score": "0.55317163", "text": "def index\n @pets = Pet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pets }\n end\n end", "title": "" }, { "docid": "6e1629baface37968ea7cbf62e3f4fd6", "score": "0.55266815", "text": "def index\n @drone_attacks = DroneAttack.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :layout => 'blank'}\n end\n end", "title": "" }, { "docid": "6c016e3cc46dc595489355577db5e93d", "score": "0.5525426", "text": "def index\n @items = Item.order('created_at DESC').where(activated: true)\n respond_to do |format|\n format.html\n format.json {render html: '<strong>404 Not Found</strong>'.html_safe}\n end\n end", "title": "" }, { "docid": "60528cd7ab53148df76a39e37b8f70e9", "score": "0.5519053", "text": "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "title": "" }, { "docid": "fb8c7f383cac53d639619f1be2b098c3", "score": "0.5518781", "text": "def show\n render :json => @equipment_list, :include => [:weapons, :armours, :equipments]\n end", "title": "" }, { "docid": "126e798d689e9dc2be303824e0b3d0c7", "score": "0.55174685", "text": "def index\n @emilies = Emily.all\n end", "title": "" }, { "docid": "035bb6acaba0196ebaf755937fb9e16d", "score": "0.5512204", "text": "def index\n @occupants = Occupant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @occupants }\n end\n end", "title": "" }, { "docid": "19e863094e57948f4f07058812616603", "score": "0.5511021", "text": "def index\n @attorneys = Attorney.all\n end", "title": "" } ]
90f145efec21976d815eddb6831c34b6
Returns the path to the Chef binary, taking into account the `binary_path` configuration option.
[ { "docid": "e19b564bfe0850d636f5be501a36e625", "score": "0.86206806", "text": "def chef_binary_path(binary)\n return binary if [email protected]_path\n return File.join(@config.binary_path, binary)\n end", "title": "" } ]
[ { "docid": "e2c1511bbd6b43b66caecc0087be96ac", "score": "0.86471826", "text": "def chef_binary_path()\n binary = \"chef-#{@client_type}\"\n return binary if [email protected]_path\n return win_friendly_path(File.join(@config.binary_path, binary))\n end", "title": "" }, { "docid": "5b81370e8b1da9ee8d9318a5411e34c7", "score": "0.7632666", "text": "def bin_path(_opts)\n '/bin'\n end", "title": "" }, { "docid": "5b81370e8b1da9ee8d9318a5411e34c7", "score": "0.7632666", "text": "def bin_path(_opts)\n '/bin'\n end", "title": "" }, { "docid": "5b81370e8b1da9ee8d9318a5411e34c7", "score": "0.7632666", "text": "def bin_path(_opts)\n '/bin'\n end", "title": "" }, { "docid": "4ca9c28cef9d48998ea942281a1e7991", "score": "0.7272063", "text": "def wix_path binary\n home = ENV['WIX_HOME'].to_s\n return binary if home.empty?\n home = File.join home, 'bin', binary\n home = home.gsub '\\\\', '/'\n end", "title": "" }, { "docid": "fd93b9e99266d151afc5cdc534246c8c", "score": "0.7222541", "text": "def ruby_bin_path\n #config_section.ruby_bin_path || ENV['_'] =~ /ruby/ ||\n require 'rbconfig'\n File.expand_path(Config::CONFIG['RUBY_INSTALL_NAME'], Config::CONFIG['bindir'])\n end", "title": "" }, { "docid": "cff7c1db34813f7e6a0348a998d795ed", "score": "0.7136684", "text": "def binary_path\n # Always prefer a manually entered path\n if cracker_path && ::File.file?(cracker_path)\n return cracker_path\n else\n # Look in the Environment PATH for the john binary\n if cracker == 'john'\n path = Rex::FileUtils.find_full_path(\"john\") ||\n Rex::FileUtils.find_full_path(\"john.exe\")\n elsif cracker == 'hashcat'\n path = Rex::FileUtils.find_full_path(\"hashcat\") ||\n Rex::FileUtils.find_full_path(\"hashcat.exe\")\n else\n raise PasswordCrackerNotFoundError, 'No suitable Cracker was selected, so a binary could not be found on the system'\n end\n\n if path && ::File.file?(path)\n return path\n end\n\n raise PasswordCrackerNotFoundError, 'No suitable john/hashcat binary was found on the system'\n end\n end", "title": "" }, { "docid": "ccffb6a7566309fc8d027f9b55bb1a91", "score": "0.70385665", "text": "def binary_path_for(version)\n \"/opt/#{ChefUtils::Dist::Org::LEGACY_CONF_DIR}/embedded/postgresql/#{version}/bin\"\n end", "title": "" }, { "docid": "53c2c0fa5f18a5c699953f41ab5b0f3b", "score": "0.70374167", "text": "def which_path(bin_name)\n bin_path = `which #{bin_name}`.strip\n bin_path.empty? ? nil : bin_path\n end", "title": "" }, { "docid": "7bda42df74e5491b6f4f5d7475307270", "score": "0.69793856", "text": "def bin_path\n '/usr/local/bin'.p\n end", "title": "" }, { "docid": "9483fd566064bc8829abd8cc500a830a", "score": "0.688028", "text": "def ruby_path\n File.join(%w(bindir RUBY_INSTALL_NAME).map{|k| RbConfig::CONFIG[k]})\n end", "title": "" }, { "docid": "f4a73cacf1aeec4c712071a7d305db7e", "score": "0.6864258", "text": "def bin_path\n @bin_path ||= begin\n path = settings[:bin] || \"bin\"\n path = Pathname.new(path).expand_path(root).expand_path\n SharedHelpers.filesystem_access(path) {|p| FileUtils.mkdir_p(p) }\n path\n end\n end", "title": "" }, { "docid": "4d77df0523064779db17d96c69447701", "score": "0.67850304", "text": "def bin_path\n @bin_path ||= Wide::PathUtils.secure_path_join(Settings.compilation_base,\n user.user_name, name)\n end", "title": "" }, { "docid": "0b6202caee20b56d50067935e824f22c", "score": "0.66099745", "text": "def bin\n File.join(@root, 'bin')\n end", "title": "" }, { "docid": "8079bbe81398e060370bcb0af3073fdf", "score": "0.65839684", "text": "def chef_config_path\n if Chef::Config['config_file']\n ::File.dirname(Chef::Config['config_file'])\n else\n raise(\"No chef config file defined. Are you running \\\nchef-solo? If so you will need to define a path for the ohai_plugin as the \\\npath cannot be determined\")\n end\n end", "title": "" }, { "docid": "e5ef68bb86014b0f936218b2b59099f3", "score": "0.65471977", "text": "def executable_path; end", "title": "" }, { "docid": "a395b7647f67d1847c3c40b460c8a2f9", "score": "0.64920855", "text": "def chef_config_path\n Berkshelf.root.join(\"spec/config/knife.rb\").to_s\n end", "title": "" }, { "docid": "d8c1ad65956f2d547ffe3e6dc7f1a8c3", "score": "0.6444146", "text": "def ruby_path\n ext = ((RbConfig::CONFIG['ruby_install_name'] =~ /\\.(com|cmd|exe|bat|rb|sh)$/) ? \"\" : RbConfig::CONFIG['EXEEXT'])\n File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + ext).sub(/.*\\s.*/m, '\"\\&\"')\n end", "title": "" }, { "docid": "7ac41be5db79ee7f0e0c4efcc5123ecb", "score": "0.64176506", "text": "def cmd_path\n return @cmd_path unless @cmd_path.nil?\n\n @cmd_path = File.join(context.root_path, 'bin', cmd)\n # Return the path to the command if it exists on disk, or we have a gemfile (i.e. Bundled install)\n # The Bundle may be created after the prepare_invoke so if the file doesn't exist, it may not be an error\n return @cmd_path if PDK::Util::Filesystem.exist?(@cmd_path) || !PDK::Util::Bundler::BundleHelper.new.gemfile.nil?\n\n # But if there is no Gemfile AND cmd doesn't exist in the default path, we need to go searching...\n @cmd_path = alternate_bin_paths.map { |alternate_path| File.join(alternate_path, cmd) }\n .find { |path| PDK::Util::Filesystem.exist?(path) }\n return @cmd_path unless @cmd_path.nil?\n\n # If we can't find it anywhere, just let the OS find it\n @cmd_path = cmd\n end", "title": "" }, { "docid": "dd77d3ee99662cd837ec86933ab4934e", "score": "0.6394287", "text": "def ruby_bin\n @ruby_bin ||= begin\n c = ::Config::CONFIG\n File.join(c['bindir'], c['ruby_install_name']) << c['EXEEXT']\n end\n end", "title": "" }, { "docid": "7168180d4bfd2a91b3df4197ffb632ab", "score": "0.63245296", "text": "def bin(name)\n self.path.join('bin',name.to_s).to_s\n end", "title": "" }, { "docid": "ccaae699eaca7e4ef678a338ea2c416f", "score": "0.63195956", "text": "def binary_for_app(app_path)\n binary_dir = File.join(app_path, \"Contents\", \"MacOS\")\n binary_path = Dir.glob(File.join(binary_dir, \"*-bin\")).first\n if binary_path.nil?\n standard_path = File.join(binary_dir, File.basename(app_path, \".app\"))\n if File.exists?(standard_path)\n binary_path = standard_path\n end\n end\n return binary_path\nend", "title": "" }, { "docid": "20912d8770f2ee66a104b27c244a6752", "score": "0.6262146", "text": "def config_path\n if result = chef_api_config_path\n Pathname(result).expand_path\n else\n Pathname(\"\")\n end\n end", "title": "" }, { "docid": "bdb747c619a3710c933883b41426696a", "score": "0.62231183", "text": "def absolute_gem_binary\n ::File.expand_path(gem_binary, path)\n end", "title": "" }, { "docid": "cc446caef3813c939aa4c28996fec758", "score": "0.6204702", "text": "def path_with_prepended_ruby_bin\n env_path = ENV[\"PATH\"].dup || \"\"\n existing_paths = env_path.split(File::PATH_SEPARATOR)\n existing_paths.unshift(RbConfig::CONFIG[\"bindir\"])\n env_path = existing_paths.join(File::PATH_SEPARATOR)\n env_path.encode(\"utf-8\", invalid: :replace, undef: :replace)\n end", "title": "" }, { "docid": "49f393ee50dc95a19ef2d5368ab4ce8f", "score": "0.61899996", "text": "def which(*bins)\n bins.flatten.each do |bin|\n ENV[\"PATH\"].split(\":\").each do |dir|\n full_path = File.join(dir, bin)\n return full_path if File.exist? full_path\n end\n end\n nil\nend", "title": "" }, { "docid": "110973ce16251dc4715d79843a9be367", "score": "0.6182029", "text": "def path\n Rails.root.join(ROOT, type, name, executable).to_s\n end", "title": "" }, { "docid": "16d6408177c469e0f3f0aff7c0fbe4a4", "score": "0.6173654", "text": "def binary_exists(binary)\n print_status(\"Trying to find binary(#{binary}) on target machine\")\n binary_path = shell_command_token(\"which #{binary}\").to_s.strip\n if binary_path.eql?(\"#{binary} not found\") || binary_path == \"\"\n print_error(binary_path)\n return nil\n else\n print_status(\"Found #{binary} at #{binary_path}\")\n return binary_path\n end\n end", "title": "" }, { "docid": "43462055ae0907e173205407930fddc4", "score": "0.61551464", "text": "def binary\n @binary ||= begin\n if brewed?\n # If the python is brewed we always prefer it!\n # Note, we don't support homebrew/versions/pythonXX.rb, though.\n Formula.factory(@name).opt_prefix/\"bin/python#{@min_version.major}\"\n else\n # Using the ORIGINAL_PATHS here because in superenv, the user\n # installed external Python is not visible otherwise.\n which(@name, ORIGINAL_PATHS.join(':'))\n end\n end\n end", "title": "" }, { "docid": "456b941be034a819fe1bf1b7a0dc13e6", "score": "0.61355793", "text": "def python_binary\n ::File.join('', 'usr', 'bin', system_package_name)\n end", "title": "" }, { "docid": "6aa870a3a0e9b9944e65f1e03211a02e", "score": "0.61324334", "text": "def private_bin_dir\n return pretty_path(File.join(right_link_home_dir, 'bin'))\n end", "title": "" }, { "docid": "19e101318f21a5b57c754374d81bd2dd", "score": "0.61203825", "text": "def bin\n return \"#{@protk_dir}/bin\"\n end", "title": "" }, { "docid": "ec18c3d8e2b09cec1111dc38399147f2", "score": "0.611988", "text": "def binary_path_for(version)\n \"/usr/pgsql-#{version}/bin\"\n end", "title": "" }, { "docid": "967e4bd202b5450d262c4527f5a7b4fd", "score": "0.61174035", "text": "def kubernetes_path_to_binaries\n kube_commands(kubernetes_bin_prefix)\n end", "title": "" }, { "docid": "d99da818d735a71bed86d90485a62b23", "score": "0.60983205", "text": "def ruby_interpreter_path\n Pathname.new(\n File.join(Config::CONFIG[\"bindir\"],\n Config::CONFIG[\"RUBY_INSTALL_NAME\"]+Config::CONFIG[\"EXEEXT\"])\n ).realpath\n end", "title": "" }, { "docid": "880201fba49db6395ded38d4c1ce7aa6", "score": "0.6088787", "text": "def ruby_gem_bindir\n cmd = shell_out!([new_resource.parent_ruby.gem_binary, 'environment'])\n # Parse a line like:\n # - EXECUTABLE DIRECTORY: /usr/local/bin\n matches = cmd.stdout.scan(/EXECUTABLE DIRECTORY: (.*)$/).first\n if matches\n matches.first\n else\n raise PoiseApplicationRuby::Error.new(\"Cannot find EXECUTABLE DIRECTORY: #{cmd.stdout}\")\n end\n end", "title": "" }, { "docid": "9a5325ce3b3ea434f5b0ef030c51bf7f", "score": "0.6079175", "text": "def cookbook_path\n @cookbook_paths.first\n end", "title": "" }, { "docid": "5be762937a0b96e7ad7e8cc31b647ba2", "score": "0.60632044", "text": "def gem_bindir\n cmd = shell_out!([new_resource.absolute_gem_binary, 'environment'])\n # Parse a line like:\n # - EXECUTABLE DIRECTORY: /usr/local/bin\n matches = cmd.stdout.scan(/EXECUTABLE DIRECTORY: (.*)$/).first\n if matches\n matches.first\n else\n raise Error.new(\"Cannot find EXECUTABLE DIRECTORY: #{cmd.stdout}\")\n end\n end", "title": "" }, { "docid": "1c518f706c7fab6fb216fc522aef8f99", "score": "0.6062231", "text": "def chef_file_path\n File.join(RIGHT_LINK_SPEC_HELPER_TEMP_PATH, '__chef.js')\n end", "title": "" }, { "docid": "258fab3d67687ae8d5bb482e3915c340", "score": "0.60613936", "text": "def terraform_docs_bin\n @terraform_docs_bin ||= ::File.join(bin_root, \"#{terraform_docs_name}-#{terraform_docs_version}\" ,terraform_docs_name)\n end", "title": "" }, { "docid": "a5ff66fef5a6d86369b50114ee3ca955", "score": "0.6023511", "text": "def executable(type)\n type = type.to_s\n exe_path = File.join(File.dirname(RbConfig.ruby), \"#{type}.exe\")\n bat_path = File.join(File.dirname(RbConfig.ruby), \"#{type}.bat\")\n ruby_path = File.join(File.dirname(RbConfig.ruby), type)\n\n if Gem.win_platform?\n if File.exist?(exe_path)\n return \"\\\"#{exe_path}\\\"\"\n elsif File.exist?(bat_path)\n return \"\\\"#{bat_path}\\\"\"\n end\n elsif File.exist?(ruby_path)\n return ruby_path\n end\n\n # Fall back to PATH lookup if known path does not exist\n type\n end", "title": "" }, { "docid": "6a72e7ca4019ce32e69eae7d1c5051a7", "score": "0.60012645", "text": "def bin_file(name)\n File.join bin_dir, name\n end", "title": "" }, { "docid": "df19aa1d3e33747a26272f053f872164", "score": "0.59759647", "text": "def tfsec_bin\n @tfsec_bin ||= ::File.join(bin_root, \"#{tfsec_name}-#{tfsec_version}\" ,tfsec_name)\n end", "title": "" }, { "docid": "93539aab55a0faed0dfd5e3d175d7fa4", "score": "0.59648675", "text": "def bin_wrapper_file\n rbconfig('ruby_install_name').match /^(.*)ruby(.*)$/\n File.join(Config.bin_dir, \"#{$1}#{@bin_name}#{$2}\")\n end", "title": "" }, { "docid": "d6d9a27c6a700eedae6a14f1810a1daa", "score": "0.59493166", "text": "def embedded_bin(bin)\n windows_safe_path(\"#{install_dir}/embedded/bin/#{bin}\")\n end", "title": "" }, { "docid": "4dbde66c4510ad72ab62993871c65deb", "score": "0.5925928", "text": "def path_to_bin(name = nil)\n home = ENV['JAVA_HOME'] or fail 'Are we forgetting something? JAVA_HOME not set.'\n bin = Util.normalize_path(File.join(home, 'bin'))\n fail 'JAVA_HOME environment variable does not point to a valid JRE/JDK installation.' unless File.exist? bin\n Util.normalize_path(File.join(bin, name.to_s))\n end", "title": "" }, { "docid": "cb4624c5934307ef9095049e7efffd5f", "score": "0.5915387", "text": "def bundler_binary\n @bundler_binary ||= ::File.join(gem_bindir, 'bundle')\n end", "title": "" }, { "docid": "61aa01d236a46c2edbb897f1a06e9d9f", "score": "0.58866197", "text": "def find_binary( name )\n\t\treturn ENV[ name.to_s.upcase ] if ENV.key?( name.to_s.upcase )\n\n\t\tdirs = ENV['PATH'].split( File::PATH_SEPARATOR )\n\t\tdirs += dirs.\n\t\t\tfind_all {|dir| dir.end_with?('bin') }.\n\t\t\tmap {|dir| dir[0..-4] + 'libexec' }\n\n\t\tpaths = dirs.collect {|dir| File.join(dir, name) }\n\t\tfound = paths.find {|path| File.executable?(path) } or\n\t\t\traise \"Unable to find %p in your PATH, or in corresponding 'libexec' directories.\" %\n\t\t\t\t[name]\n\n\t\treturn found\n\tend", "title": "" }, { "docid": "7eeac1c82f0c4a27abfebea5c9f88936", "score": "0.5873864", "text": "def installer_path\n %x[which apt-get].chomp\n end", "title": "" }, { "docid": "f2dca54a6ebcc110badfd1a158705e8b", "score": "0.5868451", "text": "def env_path\n @bin_resolver.env_path\n end", "title": "" }, { "docid": "42fa7d878d6ff18e1f6bc8f69a7aff5e", "score": "0.5866344", "text": "def get_bundle_install_name(bundle_dir, binary)\n\tcurrent_dir = \"#{bundle_dir}/#{BUNDLE_MAIN_EXE_PATH}\"\n\trelative_path = Pathname.new(binary).relative_path_from(Pathname.new(current_dir)).to_s\n\trelative_path = \"@executable_path/#{relative_path}\"\n\treturn relative_path\nend", "title": "" }, { "docid": "2ea4f681dfeb58ae4b9ca57e5084400f", "score": "0.5857991", "text": "def rackup_path_from_argv\n if path = @bin.options[:rackup]\n return path if path.file?\n warn \"rackup does not exist at #{path} (given with -R)\"\n end\n end", "title": "" }, { "docid": "98fecbeb7ac84ebeeae9af8571fc9bec", "score": "0.5857283", "text": "def chef_config\n ci = @json.split('/').last.gsub('.json', '')\n \"#{prefix_root}/home/oneops/#{@circuit}/components/cookbooks/\" \\\n \"chef-#{ci}.rb\"\n end", "title": "" }, { "docid": "f8feddc76cfc55e062167dda36a7d8cc", "score": "0.5839376", "text": "def bin_dir *args\n root.join('bin', *args).to_s\n end", "title": "" }, { "docid": "8e79b4866a3878a73c2b99fdc3cb4d56", "score": "0.5835569", "text": "def private_bin_dir\n '/opt/rightscale/bin'\n end", "title": "" }, { "docid": "8e79b4866a3878a73c2b99fdc3cb4d56", "score": "0.5835569", "text": "def private_bin_dir\n '/opt/rightscale/bin'\n end", "title": "" }, { "docid": "831e064256d04324c19bd13958b748e0", "score": "0.58354396", "text": "def alternate_bin_paths\n [\n PDK::Util::RubyVersion.bin_path,\n File.join(PDK::Util::RubyVersion.gem_home, 'bin'),\n PDK::Util::RubyVersion.gem_paths_raw.map { |gem_path_raw| File.join(gem_path_raw, 'bin') },\n PDK::Util.package_install? ? File.join(PDK::Util.pdk_package_basedir, 'bin') : nil\n ].flatten.compact\n end", "title": "" }, { "docid": "c0e6c28c6572733523d52ee91af91d17", "score": "0.58333987", "text": "def npm_bin_path\n @npm_bin_path ||= npm_path_for(\"bin\")\n end", "title": "" }, { "docid": "48e40e1d1b22478563682631ae0f90df", "score": "0.58121574", "text": "def chef_api_config_path\n ENV[\"CHEF_API_CONFIG\"] || if ENV.key?(\"HOME\")\n \"~/.chef-api\"\n else\n nil\n end\n end", "title": "" }, { "docid": "397808432abc1bfd734133ace85d10a3", "score": "0.5800094", "text": "def rackup_path_from_which\n return if is_windows?\n require 'open3'\n\n path = Open3.popen3('which', 'rackup'){|si,so,se| so.read.chomp }\n path if path.size > 0 && File.file?(path)\n rescue Errno::ENOENT\n # which couldn't be found or something nasty happened\n end", "title": "" }, { "docid": "1983e9b93e9eba5b37c97d6521b76084", "score": "0.5795271", "text": "def terraform_bin\n OS.locate('terraform')\n end", "title": "" }, { "docid": "3094903d51a48c8478faea7fdb59214e", "score": "0.5784578", "text": "def executable\n return File.basename(archive_path)\n end", "title": "" }, { "docid": "cb3f2d3fac429823e7738d49e6a91208", "score": "0.57722944", "text": "def file_cache_path\n Chef::Config[:file_cache_path]\n end", "title": "" }, { "docid": "2b08365b8fb1acba615d4153fc586dd9", "score": "0.57516575", "text": "def bin_folder configuration = 'Release'\n conf['bin'] || proj.output_path(configuration)\n end", "title": "" }, { "docid": "e4c889ad67516b89facbc40b0ef525d8", "score": "0.5745972", "text": "def default_installed_bin_dir\n if Gem.win_platform?\n # TODO: Also support Windows without cygwin\n '/cygdrive/c/Program\\ Files/Puppet\\ Labs/DevelopmentKit/bin'\n else\n '/opt/puppetlabs/bin'\n end\nend", "title": "" }, { "docid": "e4b9c194db948ee1e73d2ed835864952", "score": "0.57445604", "text": "def berkshelf_path\n @berkshelf_path ||= File.expand_path(ENV[\"BERKSHELF_PATH\"] || \"~/.berkshelf\")\n end", "title": "" }, { "docid": "fa29d8874e2c560998b47a1089151303", "score": "0.57289624", "text": "def GetBinary\n ProbeKernel() if !@kernel_probed\n @binary\n end", "title": "" }, { "docid": "e510702da1704c9e7672fa76cc90d984", "score": "0.57242817", "text": "def directory\n File.join(Cfg.rootdir, @category, @suitename, @component, \"binary-#{name}\")\n end", "title": "" }, { "docid": "2be797e5874e76a648a3eefc83fe5173", "score": "0.57240397", "text": "def config_directory\n \"C:\\\\chef\"\n end", "title": "" }, { "docid": "49731df67c50c56a7fafbccc9b537b89", "score": "0.57010597", "text": "def path\n return ENV['ORBIT_FILE'] if ENV.include? 'ORBIT_FILE'\n\n [ENV.fetch('ORBIT_HOME'), 'config', 'orbit.json'].join(SEP)\n rescue KeyError\n raise 'env ORBIT_HOME not set'\n end", "title": "" }, { "docid": "b5b4fa5ac87398a250294ef2260b4159", "score": "0.56743205", "text": "def find_relative_git_cookbook_path\n\n cb = Pathname.new(find_local_cookbook).realpath()\n git_root = Pathname.new(find_git_root(cb)).realpath()\n relative = cb.relative_path_from(git_root)\n #puts (\"find cb \\n#{cb} relative to path\\n#{git_root} and it is \\n#{relative}\")\n return relative.to_s\n end", "title": "" }, { "docid": "d9a2d022a6af10354f799e4c6ff82c96", "score": "0.56688637", "text": "def get_path\n cmd_exec('echo $PATH').to_s\n rescue\n raise \"Unable to determine path\"\n end", "title": "" }, { "docid": "ca42d40595ec990d2c53eb99b80ca0b3", "score": "0.56627536", "text": "def mock_executable_dir(executable_name)\n File.join(\"kit\", executable_name, \"bin\")\n end", "title": "" }, { "docid": "d7fed252b285719b44e7d974a798f64d", "score": "0.5660102", "text": "def make_installer_gtifw exe_path\n end", "title": "" }, { "docid": "48e9e5345e788451563aa763ba24fa5f", "score": "0.565427", "text": "def which(executable)\n if File.executable?(exec = File.join(Dir.pwd, 'bin', executable))\n exec\n else\n executable\n end\n end", "title": "" }, { "docid": "6cc92d9c3b064ab3835b98ed6714c74e", "score": "0.5649832", "text": "def download_path\n ::File.join(Chef::Config[:file_cache_path],\n ::File.basename(source_path))\n end", "title": "" }, { "docid": "8bac467d229323cc9a1def2abb46f6b8", "score": "0.56488544", "text": "def toolchain_binary(file)\n\n # Determine the type of prebuilt binary to use\n if RbConfig::CONFIG['host_os'] =~ /linux/\n build_os = 'linux-x86';\n elsif RbConfig::CONFIG['host_os'] =~ /darwin/\n build_os = 'darwin-x86';\n else\n throw 'Unknown build OS: ' + RbConfig::CONFIG['host_os']\n end\n\n # Special case:\n # Clang does not follow the same conventions as GCC\n # This is hardcoded for NDK r8c\n if file == 'clang'\n return @ndk_path + '/toolchains/llvm-3.1/prebuilt/' + build_os + '/bin/clang'\n else\n return @ndk_path +\n '/toolchains/'+ @target_arch + '-linux-androideabi-' +\n @ndk_toolchain_version +\n '/prebuilt/' +\n build_os +\n '/bin/' + @target_arch + '-linux-androideabi-' + file\n end\n end", "title": "" }, { "docid": "a2a757b8df5b00263e086ea701df943d", "score": "0.564246", "text": "def install_path\n Berkshelf.cookbook_store.storage_path\n .join(\"#{dependency.name}-#{revision}\")\n end", "title": "" }, { "docid": "0c71f51fc62fb4859689a1f434307d93", "score": "0.56362617", "text": "def build_path\n \"#{Chef::Config['file_cache_path']}/nginx-#{new_resource.version}\"\n end", "title": "" }, { "docid": "304e18a7231efffaefc3a5cfee9b4266", "score": "0.56338614", "text": "def which(executable)\n if File.executable?(exec = File.join(Dir.pwd, 'bin', executable))\n exec\n else\n executable\n end\n end", "title": "" }, { "docid": "304e18a7231efffaefc3a5cfee9b4266", "score": "0.56338614", "text": "def which(executable)\n if File.executable?(exec = File.join(Dir.pwd, 'bin', executable))\n exec\n else\n executable\n end\n end", "title": "" }, { "docid": "304e18a7231efffaefc3a5cfee9b4266", "score": "0.56338614", "text": "def which(executable)\n if File.executable?(exec = File.join(Dir.pwd, 'bin', executable))\n exec\n else\n executable\n end\n end", "title": "" }, { "docid": "8abf33a3918ee5ba4f7f27198685513d", "score": "0.5630001", "text": "def bin_dir\n @bin_dir ||= File.join gem_dir, bindir\n end", "title": "" }, { "docid": "0a3618970605c4b1f0592425005d173c", "score": "0.5621295", "text": "def executable_path=(_arg0); end", "title": "" }, { "docid": "b7ef098ef46a8af8f955d796c3bdc0cf", "score": "0.5617293", "text": "def ruby_relative_path\n ruby_pathname = Pathname.new(ruby)\n bindir_pathname = Pathname.new(target_bin_dir)\n ruby_pathname.relative_path_from(bindir_pathname).to_s\n end", "title": "" }, { "docid": "bef53d475e136f6e9f38cb76460d0607", "score": "0.56103235", "text": "def build_ruby\n bin = RbConfig::CONFIG[\"RUBY_INSTALL_NAME\"] || RbConfig::CONFIG[\"ruby_install_name\"]\n bin << (RbConfig::CONFIG['EXEEXT'] || RbConfig::CONFIG['exeext'] || '')\n File.join(RbConfig::CONFIG['bindir'], bin)\n end", "title": "" }, { "docid": "936a25f60fed2e72e8d7f7607b3b3dcf", "score": "0.561", "text": "def which(executable)\n if File.file?(executable) && File.executable?(executable)\n executable\n elsif ENV[\"PATH\"]\n path = ENV[\"PATH\"].split(File::PATH_SEPARATOR).find do |p|\n File.executable?(File.join(p, executable))\n end\n path && File.expand_path(executable, path)\n end\n end", "title": "" }, { "docid": "e9a561c9479176bd261097f8a4176924", "score": "0.5608844", "text": "def which(cmd)\n path = \"/usr/local/bin/#{cmd}\"\n if not File.exists?(path)\n path = \"/sw/bin/#{cmd}\"\n end\n return path;\nend", "title": "" }, { "docid": "386718c6e42c905775f3e8d919a22b10", "score": "0.55617595", "text": "def install_directory\n \"C:\\\\opscode\\\\chef\"\n end", "title": "" }, { "docid": "138894835a08c7c5630eb98af454c756", "score": "0.55505115", "text": "def component_build_bin(cmp)\n component(cmp).fetch('buildbin', CONF_DEFAULT_BUILDBIN)\nend", "title": "" }, { "docid": "2a3b162bfb1343f11328a439527de47e", "score": "0.5549683", "text": "def install_path(val = NULL_ARG)\n unless val.equal?(NULL_ARG)\n @install_path = windows_safe_path(val)\n end\n @install_path || raise(MissingProjectConfiguration.new('install_path', '/opt/chef'))\n end", "title": "" }, { "docid": "8b6331fe37f96f3cff18fc17320f108c", "score": "0.5540513", "text": "def datafile_path(env)\n env[:machine].data_dir.join(\"berkshelf\")\n end", "title": "" }, { "docid": "b30f5337e60733f3d3a127c33b1f23a6", "score": "0.55404", "text": "def find_executable(bin,*paths)\n paths = ENV['PATH'].split(File::PATH_SEPARATOR) if paths.empty?\n paths.each do |path|\n file = File.join(path,bin)\n if File.executable?(file) then\n Launchy.log \"#{self.name} : found executable #{file}\"\n return file\n end\n end\n Launchy.log \"#{self.name} : Unable to find `#{bin}' in #{paths.join(', ')}\"\n return nil\n end", "title": "" }, { "docid": "fe92fbff82c65031cffde282ba65a502", "score": "0.55374813", "text": "def custom_config_path\n argv.each_with_index do |arg, index|\n if arg == \"--config-path\" || arg == \"-c\"\n next_arg = argv[index + 1]\n raise ConfigPathNotProvided.new if next_arg.nil?\n raise ConfigPathInvalid.new(next_arg) unless File.file?(next_arg) && File.readable?(next_arg)\n\n return next_arg\n end\n end\n nil\n end", "title": "" }, { "docid": "0f40f302885de67f4851940db37b7bbb", "score": "0.5532228", "text": "def find_config_path\n path = Pathname(Pathname.pwd).ascend{|d| h=d+config_filename; break h if h.file?}\n end", "title": "" }, { "docid": "a18b222beea26523fd2cd3d4f7b841ad", "score": "0.5531008", "text": "def omnibus_root\n \"/opt/chef\"\n end", "title": "" }, { "docid": "2e0ed3eea5b64d48dc07b97acfac8355", "score": "0.5494012", "text": "def which(cmd, extra_path: %w{/bin /usr/bin /sbin /usr/sbin}, path: nil)\n # If it was already absolute, just return that.\n return cmd if cmd =~ /^(\\/|([a-z]:)?\\\\)/i\n # Allow passing something other than the real env var.\n path ||= ENV['PATH']\n # Based on Chef::Mixin::Which#which\n # Copyright 2010-2015, Chef Softare, Inc.\n paths = path.split(File::PATH_SEPARATOR) + extra_path\n paths.each do |candidate_path|\n filename = ::File.join(candidate_path, cmd)\n return filename if ::File.executable?(filename)\n end\n false\n end", "title": "" }, { "docid": "680df5637ba56838d364e71dc6dc30e1", "score": "0.5489004", "text": "def which(cmd)\n return nil unless cmd && cmd.length > 0\n if cmd.include?(File::SEPARATOR)\n return cmd if File.executable? cmd\n end\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n binary = File.join(path, \"#{cmd}\")\n return binary if File.executable? binary\n end\n return nil\n end", "title": "" }, { "docid": "250d767ffe358001bdd77c3d9a001dde", "score": "0.54836273", "text": "def which(executable)\n if File.file?(executable) && File.executable?(executable)\n executable\n elsif ENV[\"PATH\"]\n path = ENV[\"PATH\"].split(File::PATH_SEPARATOR).find do |p|\n File.executable?(File.join(p, executable))\n end\n path && File.expand_path(executable, path)\n end\n end", "title": "" }, { "docid": "9dd368816b15a1350d9cb1b9d0a15b8c", "score": "0.5476059", "text": "def rackup_path_from_rubylib\n env_path_separator = is_windows? ? ';' : ':'\n path_separator = Regexp.escape(File::ALT_SEPARATOR || File::SEPARATOR)\n needle = /#{path_separator}rack#{path_separator}/\n\n paths = ENV[\"RUBYLIB\"].to_s.split(env_path_separator)\n\n if rack_lib = paths.find{|path| path =~ needle }\n path = Pathname.new(rack_lib).parent.join(\"bin\").join(\"rackup\").expand_path\n path if path.file?\n end\n end", "title": "" } ]
0ad721d3a15077bc38b87c0e2b245cc6
Get Work Type By Id
[ { "docid": "75a9cce4b87283945431f5de45600983", "score": "0.63574094", "text": "def time_work_types_id_get(id, opts = {})\n data, _status_code, _headers = time_work_types_id_get_with_http_info(id, opts)\n return data\n end", "title": "" } ]
[ { "docid": "f471cec4788ed16e01272865fa6bca71", "score": "0.6943259", "text": "def get_work_by_id( work_id )\n\n begin\n return GenericWork.find( work_id )\n rescue => e\n end\n\n return nil\n end", "title": "" }, { "docid": "19ee5b7c76fca67edcc95c3ba0659c6d", "score": "0.69426227", "text": "def get_work_id\n self.class.name == 'Work' ? self.id : self.work_id\n end", "title": "" }, { "docid": "88cb26f12548d06663c5960988ebdeb8", "score": "0.6885116", "text": "def typew_awork abswork_id\n data_awork(abswork_id)[:type_w]\n end", "title": "" }, { "docid": "bb47afb146eab8b564f3bcf646064792", "score": "0.68838304", "text": "def set_work_type\n @work_type = WorkType.find(params[:id])\n end", "title": "" }, { "docid": "bb47afb146eab8b564f3bcf646064792", "score": "0.68838304", "text": "def set_work_type\n @work_type = WorkType.find(params[:id])\n end", "title": "" }, { "docid": "a7aa2f5e3a4c4ab24d4150a517f3d561", "score": "0.67215925", "text": "def set_worktype\n @worktype = Worktype.find(params[:id])\n end", "title": "" }, { "docid": "47a13c702719cf60707ee2d45aed60e0", "score": "0.6540304", "text": "def work_type_from_json(json:)\n return nil unless json.present? && json[:work_type].present?\n return nil unless ::Identifier.work_types.keys.include?(json[:work_type].downcase)\n\n json[:work_type].downcase\n end", "title": "" }, { "docid": "6b4b21a0c497f435074914ee767171d9", "score": "0.65180296", "text": "def get_type(id, params={})\n validate_id!(id)\n execute(method: :get, url: \"#{base_path}/types/#{id}\", params: params)\n end", "title": "" }, { "docid": "95cf8a0881b3003731a28b38da6a4f9f", "score": "0.63928044", "text": "def technotype\n object.technotype.id\n end", "title": "" }, { "docid": "c18e1fba6678fe35473c79be9af303f7", "score": "0.6358909", "text": "def itemtype\n @work['itemtype']\n end", "title": "" }, { "docid": "9540682a3b8bf15a67240a01c566c846", "score": "0.6216028", "text": "def exercise_type\n exercise_type_id.get_object\n end", "title": "" }, { "docid": "55c9f4f422c8c815858e3dfc390920db", "score": "0.61732996", "text": "def time_work_types_id_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: WorkTypesApi.time_work_types_id_get ...\"\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 WorkTypesApi.time_work_types_id_get\"\n end\n # resource path\n local_var_path = \"/time/workTypes/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\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 => 'WorkType')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WorkTypesApi#time_work_types_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "d8d653657cab47d0883d290ab07716ef", "score": "0.61605614", "text": "def get_type id\n @@externals[:types][id.downcase] ||= ObjectType.new({}, id, get_app)\n end", "title": "" }, { "docid": "7454a6c72e11e01a1038b1f5b34bf512", "score": "0.6134629", "text": "def set_workshop_type\n @workshop_type = WorkshopType.find(params[:id])\n end", "title": "" }, { "docid": "eb9e49d36244e7fa6ee1280f55addfd6", "score": "0.6116533", "text": "def find_by_id(type, id)\n if id != nil\n case type\n when :channel\n channels.find{|chan| chan.channel_number == id}\n when :program\n programs.find{|obj| obj.uid == id}\n when :recording\n recordings.find{|obj| obj.uid == id}\n end\n end\n end", "title": "" }, { "docid": "db2d29d4f3e2c581ddefd66e0dca417e", "score": "0.6111714", "text": "def type_of(id)\n id = id.to_sym\n DATA_NOEUDS[id][:type]\nend", "title": "" }, { "docid": "0ebb3080666870300befdf05ca942d94", "score": "0.6078156", "text": "def id\n read_attribute(:wks_work_id)\n end", "title": "" }, { "docid": "381234b37920097303b903c4d9dd4ed6", "score": "0.607394", "text": "def find_work\n @work = Work.find_by(id: params[:id])\n end", "title": "" }, { "docid": "9b77122fe701f15803388f460cc0da7b", "score": "0.5993967", "text": "def type_by_id(id)\n @type_by_id ||= {}\n if result = @type_by_id[id]\n result\n else\n template = pick_template(\"typebyid\")\n raise \"Repository does not define required URI-template 'typebyid'\" unless template\n url = fill_in_template(template, \"id\" => id)\n\n @type_by_id[id] = Type.create(conn, self, conn.get_atom_entry(url))\n end\n end", "title": "" }, { "docid": "4f0e4aac37dfc3b446fb0c01aee2e894", "score": "0.59684044", "text": "def app_type_id_by_id_or_name(id_or_name)\n case id_or_name\n when Integer\n Admin::AppType.find_by_id(id_or_name)&.id\n when String\n Admin::AppType.find_by_name(id_or_name)&.id\n end\n end", "title": "" }, { "docid": "2eb25c119741be2d0d26cb89edf75462", "score": "0.59302825", "text": "def factType\n FactType.find(params[:id])\n end", "title": "" }, { "docid": "e297bf24b7ebb3d8face41a3a8d6dd7e", "score": "0.59257966", "text": "def orcid_work_type internal_work_type, internal_work_subtype\n logger.debug \"Determining ORCID work type term from #{internal_work_type} / #{internal_work_subtype}\"\n type = case internal_work_type\n when \"Text\"\n case internal_work_subtype\n when /^(Article|Articles|Journal Article|JournalArticle)$/i\n \"journal-article\"\n when /^(Book|ebook|Monografie|Monograph\\w*|)$/i\n \"book\"\n when /^(chapter|chapters)$/i\n \"book-chapter\"\n when /^(Project report|Report|Research report|Technical Report|TechnicalReport|Text\\/Report|XFEL.EU Annual Report|XFEL.EU Technical Report)$/i\n \"report\"\n when /^(Dissertation|thesis|Doctoral thesis|Academic thesis|Master thesis|Masterthesis|Postdoctoral thesis)$/i\n \"dissertation\"\n when /^(Conference Abstract|Conference extended abstract)$/i\n \"conference-abstract\" \n when /^(Conference full text|Conference paper|ConferencePaper)$/i\n \"conference-paper\"\n when /^(poster|Conference poster)$/i\n \"conference-poster\"\n when /^(working paper|workingpaper|preprint)$/i\n \"working-paper\"\n when /^(dataset$)/i\n \"data-set\"\n end\n \n when \"Collection\"\n case internal_work_subtype\n when /^(Collection of Datasets|Data Files|Dataset|Supplementary Collection of Datasets)$/i\n \"data-set\"\n when \"Report\"\n \"report\"\n end\n end # double CASE statement ends\n \n if type.nil?\n logger.info \"Got nothing from heuristic, falling back on generic type mapping for '#{internal_work_type}' or else defaulting to other\"\n type = TYPE_OF_WORK[internal_work_type] || 'other'\n end\n \n logger.debug \"Final work type mapping: #{internal_work_type||'undef'} / #{internal_work_subtype||'undef'} => #{type || 'undef'}\"\n return type\n end", "title": "" }, { "docid": "edff117f528da198abe3ef098a546298", "score": "0.5917005", "text": "def find_store_item_by_id_type(id, type = nil)\n type = (type || :default).to_sym\n\n store.find_by_meta {|meta| meta[:id] == id && meta[:type] == type}\n end", "title": "" }, { "docid": "08f4ffcce03cb5aa572156dae4cdac70", "score": "0.5906119", "text": "def journal_task_type\n journal.journal_task_types.find_by(kind: self.class.name)\n end", "title": "" }, { "docid": "6bb5cab0d7d86532fa6c8ae319c957da", "score": "0.59048975", "text": "def set_company_work_type\n @company_work_type = CompanyWorkType.find(params[:id])\n end", "title": "" }, { "docid": "ac53809002f003d8e0baa5d72e82a9e2", "score": "0.59048223", "text": "def type()\n sql = 'SELECT name FROM item_types WHERE id = $1'\n values = [@type_id]\n result = SqlRunner.run(sql, values).first['name']\n return result\n end", "title": "" }, { "docid": "09352bf6e26e424ed185a64286f27629", "score": "0.589375", "text": "def work_identifier(str)\n product.work_identifiers.find { |obj| obj.id_value == str }\n end", "title": "" }, { "docid": "6eb5872e4dfd15b310df43e172ba81ff", "score": "0.58918077", "text": "def set_work_relationship_type\n @work_relationship_type = WorkRelationshipType.find(params[:id])\n end", "title": "" }, { "docid": "a79f02c0f5d349d80fe5a36e07da1bcd", "score": "0.5887631", "text": "def find_by_type_and_id(type, id)\n constant = Shoeboxed.const_get(type)\n document = Api::Document.new(connection, type, id)\n attributes = document.submit_request\n constant.new(attributes)\n end", "title": "" }, { "docid": "3391f7ddf655f6a5af797e7ed0d98635", "score": "0.58827794", "text": "def get_contest_type_name(contest_id)\n PCS::Model::Contest.find(contest_id).contest_type.name\n end", "title": "" }, { "docid": "0393442d9485907fb95dd0c2cfccf1aa", "score": "0.5879629", "text": "def geo_work_type(presenter)\n presenter.human_readable_type.sub('Work', '')\n end", "title": "" }, { "docid": "f27ad2eabedcb90cc6bd1b082fb0ac29", "score": "0.58460575", "text": "def poly(type, id)\n if type.singularize.classify.constantize.find_by_id(id)\n return type.singularize.classify.constantize.find(id)\n end\n end", "title": "" }, { "docid": "7202a639a83539fa0794e838f9e45f3f", "score": "0.582737", "text": "def getProjectType(project)\n projectTypes = getProjectTypes\n projectTypes.each do |x|\n if x['id'] == project.project_type_id\n return x\n end\n end\n end", "title": "" }, { "docid": "10cfb374aa2cf641400305f75024c43e", "score": "0.58238995", "text": "def type_to_name(type_id)\n all.body.find { |_, type| type['type'].casecmp(type_id).zero? }.last['name']\n end", "title": "" }, { "docid": "ce7f988361204b431dc61f03fe9773eb", "score": "0.5818473", "text": "def find_workshop(id)\n @workshop ||= Workshop.find_by_id(id)\n end", "title": "" }, { "docid": "4012a321213c539d729fff374fb3c6a7", "score": "0.5811724", "text": "def type_id() end", "title": "" }, { "docid": "f511709fa870ef789ef1c1effb9e71a6", "score": "0.58116806", "text": "def set_work_log_type\n @work_log_type = WorkLogType.find(params[:id])\n end", "title": "" }, { "docid": "a7293009ef43039e6f0d1db3a0bfb209", "score": "0.5809349", "text": "def get_break_type(id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/labor/break-types/{id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'id' => { 'value' => id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "title": "" }, { "docid": "d9e07e6a2f5876c801c1e102c37d7c90", "score": "0.58036906", "text": "def for\n for_type.constantize.find(for_id)\n end", "title": "" }, { "docid": "7f37ffb963e6d0bf55666eca3280c2d4", "score": "0.58014417", "text": "def set_work\n work.first.id\n end", "title": "" }, { "docid": "3f2c254d6986134c634411fb32feec55", "score": "0.58005375", "text": "def get_object(type, id)\n repo = barerepo\n return false if repo.empty?\n return repo.head.target unless id\n begin\n res = repo.lookup id\n rescue\n return false\n end\n (res.type == type) ? res : false\n end", "title": "" }, { "docid": "c0b490e6bfff60de3fe756ef8c510db3", "score": "0.579959", "text": "def frbr_type\n \"work\"\n end", "title": "" }, { "docid": "1f1bbd8f7df647673328bb9c18fab2a4", "score": "0.57985616", "text": "def set_housework_type\n @housework_type = HouseworkType.find(params[:id])\n end", "title": "" }, { "docid": "5406c5901863627d09abd525bd1e1abd", "score": "0.578998", "text": "def type\n return Report_type.find(:report_type_id)\n end", "title": "" }, { "docid": "a0484b54ab15f8694802ce43d4337b9b", "score": "0.57593197", "text": "def show\n @work_type = WorkType.find_by_slug(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_type }\n end\n end", "title": "" }, { "docid": "13cc5152283f4ffbe16c61642473b5cb", "score": "0.5755621", "text": "def find_tweetable_type\n %w(organization person).each do |type|\n param_name = [type, 'id'].join('_').to_sym\n requested_id = params[param_name]\n return type.to_sym unless requested_id.blank?\n end\n nil\n end", "title": "" }, { "docid": "7aba0504311bc2ba3d4a137a96ecd830", "score": "0.5752877", "text": "def work_type_label_key\n options[:work_type] ? options[:work_type].underscore : 'default'\n end", "title": "" }, { "docid": "7c210933501796849ccc374aa7b8d733", "score": "0.57493156", "text": "def getType\n\t\treturn Type.find(self.type_id)\n\tend", "title": "" }, { "docid": "d9e6323c95b0272f6b54798340ba75f3", "score": "0.57411087", "text": "def find_type(concept_id)\n type = nil\n\n if !concept_id.eql? \"\"\n if concept_id[0].downcase.eql? \"c\"\n type = Collection\n elsif concept_id[0].downcase.eql? \"g\"\n type = Granule\n end\n end\n end", "title": "" }, { "docid": "5042511e3e250a675989f4fe56642071", "score": "0.57104087", "text": "def datatype\n Datatypehelper.find_by_id(datatype_id) unless datatype_id.nil?\n end", "title": "" }, { "docid": "9081697432d0ae1a9f523c1c64d16737", "score": "0.56777275", "text": "def find_tweetable\n tweetable_type.to_s.classify.constantize.find(tweetable_id)\n end", "title": "" }, { "docid": "121738f1f4d5d969b5d8065db5eb3903", "score": "0.5642468", "text": "def question_type\n \tQuestionType.find_by_id(question_type_id)\n end", "title": "" }, { "docid": "a22d818ccbd5d29f5b191a8b8c8087e2", "score": "0.5640284", "text": "def target\n target = self.variables[\"target\"]\n\n # CANNOT use find here since find will raise error if :id doesn't exist\n target[\"type\"].camelize.constantize.where(:id => target[\"id\"]).first\n end", "title": "" }, { "docid": "224beec7cf2b58508b44376328eb5c26", "score": "0.56350344", "text": "def question_type(question_id)\n @question_type=Question.where(:id=>question_id).first.question_type\n end", "title": "" }, { "docid": "f4df9df161932a2bb2730149d41cc0ea", "score": "0.56262785", "text": "def getType(id)\n\tresponse = RestClient.get(\"https://api.trello.com/1/types/\"+id+\"?key=\"+$key+\"&token=\"+$token+\"&filter=open\")\n\tresponse = JSON.parse(response)\nend", "title": "" }, { "docid": "76e0e7bfac348975f74bcbedb6e2e928", "score": "0.5625777", "text": "def set_workout_unit_type\n @workout_unit_type = WorkoutUnitType.find(params[:id])\n end", "title": "" }, { "docid": "8a82227d72e670d6c07012d2a740f4ed", "score": "0.5621521", "text": "def get_works\n Work.where(\"person_id = ?\", id)\n end", "title": "" }, { "docid": "122b9dd4e0447c6af2e8fe10611961db", "score": "0.56143236", "text": "def show\n @work_time_type = WorkTimeType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_time_type }\n end\n end", "title": "" }, { "docid": "5e64765d0951c43ec34bbdbcfa06705a", "score": "0.56119746", "text": "def type\n business_type.name if business_type\n end", "title": "" }, { "docid": "c031f09ba5cfae4a2d69f3607eb84e0b", "score": "0.55988955", "text": "def work_model(class_name = nil)\n class_name.constantize\n rescue NameError\n raise \"Invalid work type: #{class_name}\"\n end", "title": "" }, { "docid": "ddc8419304bee5cd1c15496cab5e58dd", "score": "0.5587551", "text": "def type_id\n\t\tself.class.type_id\n\tend", "title": "" }, { "docid": "c4f57f4624848bf0a29549bcac32e67c", "score": "0.55867547", "text": "def find_work\n @work = Work.find_by(id: params[:id].to_i)\n if @work.nil?\n flash.now[:warning] = 'Cannot find the work'\n render :notfound, status: :not_found\n end\n end", "title": "" }, { "docid": "3b46a366d2f4a5cd0254b7a95a943b7f", "score": "0.55847144", "text": "def find_by_id( id )\n id = self.decode_url_id( id, true )\n\n if enabled?\n begin\n new(\n get('/workitems/' + id + '.json')\n )\n rescue Net::HTTPServerException => e\n nil\n end\n else\n nil\n end\n end", "title": "" }, { "docid": "5521161f81d0a5a045a7b0392e489d5c", "score": "0.5578184", "text": "def find_business_type\n @business = BusinessType.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n resource_not_found\n end", "title": "" }, { "docid": "48ff99e1c63bf80bd3323874981b411e", "score": "0.5565957", "text": "def add_work_identifier(value, type = 1)\n # process based on value type\n if value.is_a?(WorkIdentifier)\n str = value.id_value\n obj = value\n else\n str = value\n obj = ONIX::WorkIdentifier.new(:work_id_type => type, :id_value => value)\n end\n # check if exists already\n unless work_identifier(str)\n product.work_identifiers << obj\n end\n end", "title": "" }, { "docid": "06cb3314701e72f82d71eac7af7422be", "score": "0.55412686", "text": "def find_addressable_type\n %w(organization person).each do |type|\n param_name = [type, 'id'].join('_').to_sym\n requested_id = params[param_name]\n return type.to_sym unless requested_id.blank?\n end\n nil\n end", "title": "" }, { "docid": "f1b0cfd447d0c544ed940d77a6146ba5", "score": "0.5536024", "text": "def type_id\n return @children['type-id'][:value]\n end", "title": "" }, { "docid": "f1b0cfd447d0c544ed940d77a6146ba5", "score": "0.5536024", "text": "def type_id\n return @children['type-id'][:value]\n end", "title": "" }, { "docid": "f1b0cfd447d0c544ed940d77a6146ba5", "score": "0.5536024", "text": "def type_id\n return @children['type-id'][:value]\n end", "title": "" }, { "docid": "9496aa261d40f0cd364496e944ef2b3a", "score": "0.55287826", "text": "def type\n types.first\n end", "title": "" }, { "docid": "518c2a5496b6ca7b156483bab31363ac", "score": "0.5528266", "text": "def index\n @worktypes = Worktype.all\n end", "title": "" }, { "docid": "8004c96e4825890bd533aa8144f30759", "score": "0.55228364", "text": "def find_and_assign this_type, this_id\n\n\t\tif [\"user\", \"team\", \"event\", \"game\", \"venue\", \"personal_trainer\", \"group_training\", \"offering_session\"].include? this_type.underscore and this_id\n\t\t\tthis_type.camelize.constantize.find_by_id(this_id)\n\t\telse\n\t\t\tnil\n\t\tend\n\tend", "title": "" }, { "docid": "6df2fa5ba1a956d4234c216f05dca7c1", "score": "0.55091786", "text": "def pubid_type(id)\n id_to_pref_num(id)&.first\n end", "title": "" }, { "docid": "2ce62afbc0862b73d61913f234e058af", "score": "0.5507766", "text": "def works\n Work.all.select {|work| work.model_id == id}\n end", "title": "" }, { "docid": "176546fa633fc15e524cad5f76697b9c", "score": "0.5498443", "text": "def get_listing_type\n listing_shape_name = Maybe(ListingShape.where(id: listing_shape_id).last).name.or_else(nil) if listing_shape_id\n\n self.class.get_listing_type_helper(availability, listing_shape_name) if listing_shape_name\n\n end", "title": "" }, { "docid": "cff858427be6d20d1e24a6ed5693652b", "score": "0.54894626", "text": "def type\n h = case company_type_id\n when 1 then 'Automotive'\n when 2 then 'Vets Office'\n when 3 then 'Medical Office'\n when 4 then 'General'\n end\n h\n end", "title": "" }, { "docid": "f69d7e63cc4f7aff7cf981ba49abe434", "score": "0.5469", "text": "def team_type \n RFGTeamIDdig_for_string(\"type\")\n end", "title": "" }, { "docid": "a394a921e5186f09ba6214ea457335d8", "score": "0.5460556", "text": "def type\n types.first\n end", "title": "" }, { "docid": "d743f7f827505e35d7a1245a9986cfb0", "score": "0.5459658", "text": "def set_work\n @work = Work.friendly.find(params[:id])\n end", "title": "" }, { "docid": "d743f7f827505e35d7a1245a9986cfb0", "score": "0.5459658", "text": "def set_work\n @work = Work.friendly.find(params[:id])\n end", "title": "" }, { "docid": "d0b2e2d3f78269612005905b312a6b81", "score": "0.54590064", "text": "def show\n @workout_type = WorkoutType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workout_type }\n end\n end", "title": "" }, { "docid": "e4c3e08ed9ce01dd35d4fec1c6af723e", "score": "0.5457977", "text": "def get_by_type(type_str)\n @list_ids.each do |x|\n if labels = self.class::NSIDs[x[0]] then\n if i = labels.index(type_str) then\n return x[i+1]\n end\n end\n end\n nil\n end", "title": "" }, { "docid": "716b70e0320fc726fd3a79214726c2d1", "score": "0.5454815", "text": "def unit_of_work_id\n context[:unit_of_work_id]\n end", "title": "" }, { "docid": "d15c7cfdea9dcd32121b70678c4634da", "score": "0.54451287", "text": "def find_competition_type\n\t\t\t\t\t\t@competition_type = CompetitionType.find(params[:id])\n\t\t\t\t\tend", "title": "" }, { "docid": "fa74a56763c8844f8d95e237704ea1df", "score": "0.54443", "text": "def work_types_for_select\n possible_work_types.map(&:to_sym)\n end", "title": "" }, { "docid": "5248f333059b8c00c3caa3cb6f76b247", "score": "0.5442235", "text": "def idtype\n @idtype ||= \"#{id}:#{type}\"\n end", "title": "" }, { "docid": "60e6f169d6f616103a6a2a235bf2423a", "score": "0.5441389", "text": "def target\n target_type.constantize.find(target_id)\n end", "title": "" }, { "docid": "a0deda19634b92b58ce478d2bf387e6d", "score": "0.5441014", "text": "def show\n @work_relationship_type = WorkRelationshipType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_relationship_type }\n end\n end", "title": "" }, { "docid": "665d10c7e11b386129e121d1d9bdc630", "score": "0.54362524", "text": "def get_type_id type\n @types_indexes ||= retrieve_types_indexes\n return @types_indexes[type] || set_get_type_id(type)\n end", "title": "" }, { "docid": "88015e62b6fd134138e16a48eefa7c61", "score": "0.54211366", "text": "def set_job_type\n @job_type = current_business.job_types.find(params[:id])\n end", "title": "" }, { "docid": "609afedc1b3981701c6226af4d89b28c", "score": "0.5416957", "text": "def worker_type\n RRRSpec.redis.hget(key, 'worker_type')\n end", "title": "" }, { "docid": "609afedc1b3981701c6226af4d89b28c", "score": "0.5416957", "text": "def worker_type\n RRRSpec.redis.hget(key, 'worker_type')\n end", "title": "" }, { "docid": "1bca16dc6eda81e13ab82f5ec254e7a1", "score": "0.54166067", "text": "def get_job_type_code(n)\n job_type = @jobtype_xpath[n].text.downcase\n job_type.gsub!('internship', 'intern')\n @job_type_codes[job_type]\n end", "title": "" }, { "docid": "067636d1607c0087f7669600201fc79d", "score": "0.54138476", "text": "def get_space_types_from_hash(id)\n return @building.build_space_type_hash[id]\n end", "title": "" }, { "docid": "8da0e245ee2ffbe1538fb85eff65924f", "score": "0.5413442", "text": "def find_element(type, id)\n raise ArgumentError.new(\"type needs to be one of 'node', 'way', and 'relation'\") unless type =~ /^(node|way|relation|changeset)$/\n return nil if id.nil?\n begin\n response = get(\"/#{type}/#{id}\")\n response.is_a?(Array ) ? response.first : response\n rescue NotFound\n nil\n end\n end", "title": "" }, { "docid": "0ea54a277b266e8770f55cc6588f4715", "score": "0.5411361", "text": "def get_item_type_from_id(item_id)\n return item_id & 0xF000\n end", "title": "" }, { "docid": "c086e53d714a9e5603711af64a7a16d4", "score": "0.5409438", "text": "def find id\n\t\t\tself.new(\n\t\t\t\tNSConnector::Restlet.execute!(\n\t\t\t\t\t:action => 'retrieve',\n\t\t\t\t\t:type_id => type_id,\n\t\t\t\t\t:fields => fields,\n\t\t\t\t\t:data => {'id' => Integer(id)}\n\t\t\t\t),\n\t\t\t\ttrue\n\t\t\t)\n\t\tend", "title": "" }, { "docid": "e70b299c204c3dc126d63856280f50f4", "score": "0.5399595", "text": "def get_resource(id, record_type)\n return 'New' if id == 'new'\n instance_variable_get(\"@#{record_type.singularize}\")\n end", "title": "" }, { "docid": "baf2316b0544db7fcddbccbfe8379bde", "score": "0.53815335", "text": "def get_by_id(id)\n object = self.categories.select { |category| category.type_identifier == id }\n object = self.entities.select { |entity| entity.id == id } if object.empty?\n object.first\n end", "title": "" }, { "docid": "baf2316b0544db7fcddbccbfe8379bde", "score": "0.53815335", "text": "def get_by_id(id)\n object = self.categories.select { |category| category.type_identifier == id }\n object = self.entities.select { |entity| entity.id == id } if object.empty?\n object.first\n end", "title": "" } ]
c484767abdb7e31956b7d98e4810b4d5
Find the view_as configuration for the first model reference, if there is one for :edit. Only returns true if :edit is defined and is one of the not embeddable types. If not defined, it is considered embeddable.
[ { "docid": "c53f0c3d122682904f5fff0c725c30a8", "score": "0.6522998", "text": "def editable_model_not_embeddable?(mrs)\n mrs.first.to_record_options_config&.dig(:view_as, :edit)&.in?(NotEmbeddedOptions)\n rescue StandardError\n nil\n end", "title": "" } ]
[ { "docid": "f8d470cdb59414a3df31380f6d53657d", "score": "0.6361252", "text": "def view_embedded?\n params[:view_as]&.in? %w[embedded simple-embedded]\n end", "title": "" }, { "docid": "6d2e44acd288d8743909fddc494982c8", "score": "0.61787933", "text": "def can_edit?(doc_type)\n self.can_access?(doc_type)\n end", "title": "" }, { "docid": "62c02eb64dd450b71e7abd0f1c627cea", "score": "0.60443234", "text": "def show_edit_entry_link?\n user_signed_in? && @document.present? && (entry = @document.model_object).present? && can?(:edit, entry)\n end", "title": "" }, { "docid": "f00fb403bdbc0d0230e8d8d8bf0824a7", "score": "0.603019", "text": "def has_route_for_edit?(object)\n self.respond_to?(edit_object_path_string(object))\n end", "title": "" }, { "docid": "f5b99ee382af05cf0625aedc63d3a4a0", "score": "0.59908295", "text": "def is_edit?\n action = params[:action]\n (action == \"edit\" || action == \"update\" || @editable) ? true : false\n end", "title": "" }, { "docid": "fef3fd0ddc0c72ea8c26a5557b76766f", "score": "0.5988316", "text": "def edit_mode?\n !!@edit_mode\n end", "title": "" }, { "docid": "4c363de5ab0682f16e6e61fb50fd608d", "score": "0.5960828", "text": "def edit_link\n detect { |link| link.rel == 'edit' }\n end", "title": "" }, { "docid": "0c3aebdf5207ac1f5c70218f51af1e33", "score": "0.5903433", "text": "def can_edit?(doc_type)\n logged_in? && (current_user.can_edit?(doc_type) || can?('edit', doc_type))\n end", "title": "" }, { "docid": "f54284f0e6ce7b86af95f03fa4b1c0df", "score": "0.5852607", "text": "def in_edit_mode?\n !@edit_mode.nil?\n end", "title": "" }, { "docid": "1ce77d77580a7492c402dd234bb6def5", "score": "0.579759", "text": "def can_edit?(user)\n user == self || !!(user && user.admin?)\n end", "title": "" }, { "docid": "4a35e9f9b37ac06328f1fd6c56cc83e7", "score": "0.57869506", "text": "def reader_view? view\n lookup_access_view view\n end", "title": "" }, { "docid": "5534a4358579ae7a0587d79a2c86e89e", "score": "0.57755834", "text": "def can_edit?(user)\n self.user == user || !!(user && user.admin?)\n end", "title": "" }, { "docid": "bae5e28695e84873a11fee80cdbd4cd1", "score": "0.5758226", "text": "def can_edit? user\n user.try(\"is_admin?\") || user.try(\"is_a_moderator?\") || instructed_by?(user)\n end", "title": "" }, { "docid": "0a83d2479067952a3483f1a892f6924e", "score": "0.57437253", "text": "def is_edit_form?\n params[:action] == 'edit' || params[:action] == 'update'\n end", "title": "" }, { "docid": "cfd543e84e9b18330103433533f043f5", "score": "0.57369417", "text": "def edit_and_owner?\n edit? and owner?\n end", "title": "" }, { "docid": "57400d4145eb81eb58f533e22bb24ff7", "score": "0.57258934", "text": "def can_edit?(user)\n return user == self.user || user.has_role?(:admin)\n end", "title": "" }, { "docid": "c8573f0a79bd6bf25ecbf0eaeaa3220f", "score": "0.5710255", "text": "def can_edit_model_index?(model_or_relation)\n Right.where(role_id: roles)\n .where('organization_id IS NULL')\n .where(subject_type: cast_class_name(model_or_relation))\n .where('subject_id IS NULL')\n .where(level: Right.action_to_level(:edit))\n .present?\n end", "title": "" }, { "docid": "4c5a20f1ca86753f25c908c6e6841ff8", "score": "0.5705206", "text": "def can_edit?(user)\n can_x? user, [:edit]\n end", "title": "" }, { "docid": "1cc0d00248d0d8cde1939e147745b196", "score": "0.5701843", "text": "def edit_action?\n action?('edit')\n end", "title": "" }, { "docid": "b37b15867b1d3b1d0d715c869bf3b638", "score": "0.5685915", "text": "def relview?\n self.kind_of?(Schema::Logical::Relview)\n end", "title": "" }, { "docid": "57574ca3d7eb8af86d50c624cb2a4622", "score": "0.56757754", "text": "def edit?\n is_admin?\n end", "title": "" }, { "docid": "fe03c70df84a3e3cd2cd314e39d02b85", "score": "0.5637279", "text": "def editor?\n return false if anonymous_link?\n current_ability.can?(:edit, curation_concern.id)\n end", "title": "" }, { "docid": "fe03c70df84a3e3cd2cd314e39d02b85", "score": "0.5637279", "text": "def editor?\n return false if anonymous_link?\n current_ability.can?(:edit, curation_concern.id)\n end", "title": "" }, { "docid": "7d4b39103b7bb077ec686cd93480672f", "score": "0.56368536", "text": "def show?\r\n\t\tis_editor? and is_owner?\r\n\tend", "title": "" }, { "docid": "b51cc528e40cb0dc04bb5e22989400b7", "score": "0.56323814", "text": "def edit?\n producer_admin_for?(user) || group_admin_for?(user)\n end", "title": "" }, { "docid": "e1034500cbfd23445d9d953b30a75653", "score": "0.5630605", "text": "def can_edit?(user = User.current)\n user == self\n end", "title": "" }, { "docid": "e1034500cbfd23445d9d953b30a75653", "score": "0.5630605", "text": "def can_edit?(user = User.current)\n user == self\n end", "title": "" }, { "docid": "e46c56a35830a300ab4fb5974f1272bf", "score": "0.5619495", "text": "def dc_edit_mode?\n _origin.session[:edit_mode] > 1\nend", "title": "" }, { "docid": "e46c56a35830a300ab4fb5974f1272bf", "score": "0.5619495", "text": "def dc_edit_mode?\n _origin.session[:edit_mode] > 1\nend", "title": "" }, { "docid": "86b5a2f5053047574b7f33d2fb73f122", "score": "0.5608861", "text": "def edit?\n user.has_role?(:site_admin) || (user.has_role?(:can_edit_applications) && record.belongs_to_college(user.college_id))\n end", "title": "" }, { "docid": "1fafd0ecda5a2c9fb53c5aa929bced49", "score": "0.5603584", "text": "def edit?\n if is_super_admin?\n true\n elsif is_admin? && is_company_owner?(@blog_post.company_id)\n true\n elsif is_manager? && current_user.company_id == @blog_post.company_id\n true\n elsif is_user? && @blog_post.user_id == current_user.id\n true\n else\n false\n end\n end", "title": "" }, { "docid": "6d12a55479ccf05957a11f27b0dc0b6c", "score": "0.5577725", "text": "def have_link_or_button_to_edit(instance)\n have_link_or_button_to edit_polymorphic_path(instance)\n end", "title": "" }, { "docid": "12b898ef452fc07d6a633b95b897fe74", "score": "0.55725545", "text": "def can_edit?(user)\n user.nil? ? false : self.admins.include?(user.email)\n end", "title": "" }, { "docid": "fababd748f334822ebe2f15bc1ee817e", "score": "0.5569509", "text": "def edit?\n if @current_user\n true\n else\n false\n end\n end", "title": "" }, { "docid": "f17f6f0da2ec10da777e77ba23415096", "score": "0.5564367", "text": "def edit_standards?\n admin_or_material_admin? || owner?\n end", "title": "" }, { "docid": "89ef453d442db898b70c3956badf7d5b", "score": "0.5561621", "text": "def can_edit?(user)\n self.user.can_edit? user\n end", "title": "" }, { "docid": "42163e41238a4732f5e3b5a498c00149", "score": "0.5558239", "text": "def editable_by? editor=nil\n\t\treturn true if((editor)&&(self==editor))\n\tend", "title": "" }, { "docid": "a349706339dff2f169a0b1244249f32e", "score": "0.5556894", "text": "def edited?\n if @structure.nil?\n @edited\n else\n @edited || edited(aggregates) || edited(annotations)\n end\n end", "title": "" }, { "docid": "d0fe12ac2a3d65fb2a22872e0a3737a5", "score": "0.5556826", "text": "def affects_edit?\n \n return gui_block.respond_to?(:element_form)\n\n end", "title": "" }, { "docid": "c15ac5b7bddd5e87b1c2575e83eb0837", "score": "0.5541179", "text": "def edit?\n show?\n end", "title": "" }, { "docid": "c15ac5b7bddd5e87b1c2575e83eb0837", "score": "0.5541179", "text": "def edit?\n show?\n end", "title": "" }, { "docid": "d739e042777123b80c6baf9a0b0c6f1e", "score": "0.55403364", "text": "def can_edit? user\n user and user.is_admin?\n end", "title": "" }, { "docid": "7e9dad8fd2aed47113bfb8fc653b2f19", "score": "0.55398744", "text": "def can_edit?(user)\n return true if user.admin?\n edit_roles.include?(user.role)\n end", "title": "" }, { "docid": "7101a92853930bc8f50779783eecac9b", "score": "0.55353886", "text": "def can_edit?(user)\n if user.nil?\n false\n else\n if self.admins.include?(user.email)\n return true\n else\n self.user_in_group_share?(user, 'Edit')\n end\n end\n end", "title": "" }, { "docid": "bbf5aa500c187c2a9368623b020628d3", "score": "0.55332", "text": "def can_edit?(user)\n record_field.can_edit?(user)\n end", "title": "" }, { "docid": "bb9f8db9dbfefed5b4ed81a8423bbfdf", "score": "0.5532702", "text": "def can_edit?(user)\n if ownable == user || user.admin?\n true\n else\n false\n end\n end", "title": "" }, { "docid": "bb9f8db9dbfefed5b4ed81a8423bbfdf", "score": "0.5532702", "text": "def can_edit?(user)\n if ownable == user || user.admin?\n true\n else\n false\n end\n end", "title": "" }, { "docid": "e16a2ae5a96544820afc6a9830d5ffb9", "score": "0.55221975", "text": "def edit?\n user and event.owner?(user)\n end", "title": "" }, { "docid": "51c443300128b8c685df8f366bf371a3", "score": "0.5519029", "text": "def can_edit?(user)\n case access\n when 'consortia'\n user.admin? || user.institution_id == institution_id\n when 'institution'\n user.admin? || (user.institional_admin? && user.institution_id == institution_id)\n when 'restricted'\n user.admin? || (user.institional_admin? && user.institution_id == institution_id)\n end\n end", "title": "" }, { "docid": "0845f518099bd5814bd73dede04db0c9", "score": "0.55143243", "text": "def can_edit?(record=nil)\n record ||= @proposal || @user\n raise ArgumentError, \"No record specified\" unless record\n\n if logged_in?\n if current_user.admin?\n true\n else\n # Normal user\n case record\n when Proposal\n # FIXME Add setting to determine if users can alter their proposals after the accepting_proposals deadline passed.\n ### accepting_proposals?(record) && record.can_alter?(current_user)\n record.can_alter?(current_user)\n when User\n current_user == record\n else\n raise TypeError, \"Unknown record type: #{record.class}\"\n end\n end\n else\n false\n end\n end", "title": "" }, { "docid": "ce1daebec93bde87e0cf4eb4b3196e22", "score": "0.55002296", "text": "def current_user_can_edit?\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"current_user&.email=#{current_user&.email}\",\n \"curation_concern.edit_users=#{curation_concern.edit_users}\",\n \"\" ] if data_sets_controller_debug_verbose\n return false unless current_user.present?\n curation_concern.edit_users.include? current_user.email\n end", "title": "" }, { "docid": "bdf29c94b219745a188948573f293e87", "score": "0.54903775", "text": "def can_edit? org\n superadmin? || (!org.nil? && organisation == org)\n end", "title": "" }, { "docid": "ea8eb161852a2107f1e1f6fab7c48eb2", "score": "0.5487928", "text": "def editable?\n return false if folded?\n\n content_definitions.present? || taggable?\n end", "title": "" }, { "docid": "c1d5b7c0fd62d903103a1598efe73188", "score": "0.54863113", "text": "def can_edit?() false end", "title": "" }, { "docid": "c1d5b7c0fd62d903103a1598efe73188", "score": "0.54863113", "text": "def can_edit?() false end", "title": "" }, { "docid": "42bc41b4607d8fd7e05f4b0ff122b23a", "score": "0.5482085", "text": "def edit_or_update?\n [\"edit\", \"update\"].include?(controller.action_name)\n end", "title": "" }, { "docid": "d4ad37313f64f9faba6e34bdee0d5077", "score": "0.54790634", "text": "def specialized\n result = @edits_on.subclasses(true).detect do |c|\n @object.class == c\n end\n return result\n end", "title": "" }, { "docid": "433540efed6e218c77ff1bd96719555f", "score": "0.54784596", "text": "def can_edit?(user)\n is_staff?(user) || !!(user && user.admin?)\n end", "title": "" }, { "docid": "6ece91d743a65292cb6ffd60e7bb9554", "score": "0.54532605", "text": "def can_edit?(document)\n if has_permission?('account_holder || administrator') || current_user.id == document.user_id\n true\n else\n false\n end\n end", "title": "" }, { "docid": "6ece91d743a65292cb6ffd60e7bb9554", "score": "0.54532605", "text": "def can_edit?(document)\n if has_permission?('account_holder || administrator') || current_user.id == document.user_id\n true\n else\n false\n end\n end", "title": "" }, { "docid": "6d0611daef4332f26adc55726f219513", "score": "0.54517996", "text": "def can_edit?(thing)\r\n if thing.class == Bodysize || thing.class == CompleteBodysize\r\n if self == thing.creator\r\n return true\r\n end\r\n end\r\n \r\n return false\r\n end", "title": "" }, { "docid": "9719d75649a2c5fad0dfdf6614872987", "score": "0.54444283", "text": "def editable_by?(user)\n user == self.user || user.try(:admin?)\n end", "title": "" }, { "docid": "46982d3d1ef9686ccd542a09bf6f8b17", "score": "0.54441285", "text": "def edit?\n admin?\n end", "title": "" }, { "docid": "a420d9d15fa55bc6da4db818a3d47754", "score": "0.5436476", "text": "def medium_editor?(medium)\n current_user.admin || medium.edited_with_inheritance_by?(current_user)\n end", "title": "" }, { "docid": "a420d9d15fa55bc6da4db818a3d47754", "score": "0.5436476", "text": "def medium_editor?(medium)\n current_user.admin || medium.edited_with_inheritance_by?(current_user)\n end", "title": "" }, { "docid": "f40d2713d755a28ee2aee5cedabf3e97", "score": "0.543452", "text": "def permission_to_edit?(user:)\n return false unless user\n\n # curator, dataset owner or admin for the same tenant\n admin_for_this_item?(user: user)\n end", "title": "" }, { "docid": "8375e8823c81f78e2cb22c9956d91887", "score": "0.54335785", "text": "def ca_edit?(*controller_names)\n a_edit? && controller?(*controller_names)\n end", "title": "" }, { "docid": "71909f31e22bf2df9db9ddbe045572ab", "score": "0.5431329", "text": "def current_user_can_edit?(model)\n # Если у модели есть юзер и он залогиненный, пробуем у неё взять .event\n # Если он есть, проверяем его юзера на равенство current_user.\n user_signed_in? && (\n model.user == current_user ||\n (model.try(:event).present? && model.event.user == current_user)\n )\n end", "title": "" }, { "docid": "4bac10bb612b60849f9f92d7a053c63f", "score": "0.54284835", "text": "def can_edit?(user)\n is_admin?(user)\n end", "title": "" }, { "docid": "40f72412e89ff05fb6c1d149218f547f", "score": "0.5422835", "text": "def can_edit?(user = User.current_user)\n return false unless user\n return true if new_record? && self.class.can_create?\n user = user.user if user.is_a?(Person)\n (user == self.user) || user.is_admin? || (is_project_administered_by?(user.person) && self.user.nil?)\n end", "title": "" }, { "docid": "b1d74fdce32291f89b0cf758c13d1ead", "score": "0.5409821", "text": "def can_edit?(user)\n return false if user.nil?\n return true if user.admin?(\"brochicken\")\n return false if user.brother.nil?\n return self.officer.dke_info.brother.id == user.brother.id\n end", "title": "" }, { "docid": "3449be3dfd26a3ee80aed961b1459cd2", "score": "0.5408781", "text": "def can_view?(*args)\n # TODO: Man does this need a big cleanup!\n \n if args.empty?\n if this_parent && this_field\n object = this_parent\n field = this_field\n else\n object = this\n end\n elsif args.first.is_a?(String, Symbol)\n object = this\n field = args.first\n else\n object, field = args\n end\n \n if field\n # Field can be a dot separated path\n if field.is_a?(String) && (path = field.split(\".\")).length > 1\n _, _, object = Hobo.get_field_path(object, path[0..-2])\n field = path.last\n end\n elsif (origin = object.try.origin)\n object, field = origin, object.origin_attribute\n end\n \n @can_view_cache ||= {}\n @can_view_cache[ [object, field] ] ||=\n if !object.respond_to?(:viewable_by)\n true\n elsif object.viewable_by?(current_user, field)\n # If possible, we also check if the current *value* of the field is viewable\n if field.is_a?(Symbol, String) && (v = object.send(field)) && v.respond_to?(:viewable_by?)\n v.viewable_by?(current_user, nil)\n else\n true\n end\n else\n false\n end\n end", "title": "" }, { "docid": "c66daf69e9a7619139ef9b35cf6620ea", "score": "0.5406705", "text": "def viewer?\n self.info.has_key? :views\n end", "title": "" }, { "docid": "0aeeb3f57aa7c24b3b5045f2676ad5e2", "score": "0.54013914", "text": "def editable_by? editor=nil\n\t\treturn true if((editor)&&(self.headmaster==editor))\n\tend", "title": "" }, { "docid": "5089bf68a8ad65256ceb0b9d3e327b8c", "score": "0.54006284", "text": "def action_type?\n @config.parent?\n end", "title": "" }, { "docid": "36551376330f6feff2a1be11146254f6", "score": "0.5387109", "text": "def edit?\n update?\n end", "title": "" }, { "docid": "36551376330f6feff2a1be11146254f6", "score": "0.5387109", "text": "def edit?\n update?\n end", "title": "" }, { "docid": "a9a49e1f13cac8ea69869a4984f0ddf6", "score": "0.5383666", "text": "def editable?(user)\n\n return false if user.nil?\n\n return (user.admin?(User::AUTH_ADDRESSBOOK) or self.owner_id == user.id)\n end", "title": "" }, { "docid": "dd4769487d28f725bcb6764dfed4e18a", "score": "0.5374502", "text": "def canBeEditedBy?(user)\n\t\treturn isAuthoredByUser?(user) || user.admin?\n\tend", "title": "" }, { "docid": "7ff9c7997a378b50c3b7a342a0724196", "score": "0.5368519", "text": "def can_edit_user?(user)\n administrator? or (self == user)\n end", "title": "" }, { "docid": "692fb55d03b0b5f3bb0c2771b0e1d262", "score": "0.53656703", "text": "def permission_to_edit?(user:)\n return false unless user\n # superuser, dataset owner or admin for the same tenant\n user.superuser? || user_id == user.id || (user.tenant_id == tenant_id && user.role == 'admin')\n end", "title": "" }, { "docid": "10d20269004f3fcd2a0d28f007244353", "score": "0.53627104", "text": "def edit?\n user.has_role? :site_admin or user.has_role? :can_edit_category\n end", "title": "" }, { "docid": "d5b6078dbb991aa25ac96b17c8d8857f", "score": "0.5351864", "text": "def edit?\n if credential.admin?\n true\n else\n user_has_project_access?(record)\n end\n end", "title": "" }, { "docid": "d7aa6bf2bfcd603aba4f9fdbe2ef7ea1", "score": "0.5350802", "text": "def has_edit_idea_link?\n has_css? @edit_idea_link\n end", "title": "" }, { "docid": "4b67f5ee4a31e80b91e2873851d31b26", "score": "0.53497064", "text": "def can_edit?(user)\n return true if check_user(user)\n false\n end", "title": "" }, { "docid": "215447259c13c4254653e034561e66b8", "score": "0.5348872", "text": "def supported_mtm_edit?(assoc, request)\n mtm_association_select_options(request).map(&:to_s).include?(assoc)\n end", "title": "" }, { "docid": "3f27dfb5e07b18591972aca19ea95adb", "score": "0.5340533", "text": "def showable?(mode=:view,organization,current_user)\n field_access_control = organization.field_access_controls.find_by(template_field_id: self.id)\n return true if field_access_control.nil? # meaning if no fac, there is no access defined\n org_specific_user_role_ids = current_user.roles.where(\"organization_id=?\",organization.id).map(&:id)\n field_access_control_roles = field_access_control.roles(mode)\n (field_access_control_roles & org_specific_user_role_ids.map(&:to_s)).any?\n end", "title": "" }, { "docid": "49fabb6d0217000584614aa6710c4423", "score": "0.53392047", "text": "def from_record_viewable\n return unless from_record_type_us\n\n !!current_user.has_access_to?(:access, :table, from_record_type_us.pluralize)\n end", "title": "" }, { "docid": "43395b2a41c5d60298451f3e43a4d91e", "score": "0.5338407", "text": "def edit?\n if is_super_admin? || current_user.id == post_category.user_id\n true\n else\n false\n end\n end", "title": "" }, { "docid": "6f53f7195624daa5fdf46322e2baefff", "score": "0.53256226", "text": "def editable?\n !!@options[:allow_editing]\n end", "title": "" }, { "docid": "718a830816a5a80981c605c974222f43", "score": "0.53183967", "text": "def can_edit?(object)\n if object.is_a?(User)\n self != object\n elsif object.is_a?(Device)\n device_group.nil? ||\n device_group.self_and_descendants.all(\n :joins => :devices,\n :conditions => {:devices => {:id => object.id}}\n ).any?\n else\n true\n end\n end", "title": "" }, { "docid": "c7368c328d66a908a034fe6434339ad5", "score": "0.5318262", "text": "def can_view?(*args)\n # TODO: Man does this need a big cleanup!\n\n if args.empty?\n # if we're repeating over an array, this_field ends up with the current index. Is this useful to anybody?\n if this_parent && this_field && !this_field.is_a?(Integer)\n object = this_parent\n field = this_field\n else\n object = this\n end\n elsif args.first.is_one_of?(String, Symbol)\n object = this\n field = args.first\n else\n object, field = args\n end\n\n if field\n # Field can be a dot separated path\n if field.is_a?(String) && (path = field.split(\".\")).length > 1\n _, _, object = Dryml.get_field_path(object, path[0..-2])\n field = path.last\n end\n elsif (origin = object.try.origin)\n object, field = origin, object.origin_attribute\n end\n\n @can_view_cache ||= {}\n @can_view_cache[ [object, field] ] ||=\n if !object.respond_to?(:viewable_by?)\n true\n elsif object.viewable_by?(current_user, field)\n # If possible, we also check if the current *value* of the field is viewable\n if field.is_one_of?(Symbol, String) && (v = object.send(field)) && v.respond_to?(:viewable_by?)\n if v.is_a?(Array)\n v.new_candidate.viewable_by?(current_user, nil)\n else\n v.viewable_by?(current_user, nil)\n end\n else\n true\n end\n else\n false\n end\n end", "title": "" }, { "docid": "632083087ae4ae9c8e4d1bb855567b2e", "score": "0.5302906", "text": "def editable_by? editor=nil\n\t\treturn true if((editor)&&(self.founding_teacher)&&(self.founding_teacher==editor))\n\tend", "title": "" }, { "docid": "0df947b41fa09ba1dc274e8d3b3c3ec6", "score": "0.5301707", "text": "def edit?\n user.has_role? :site_admin or (user.college_id == record.college_id && user.has_role?(:can_edit_courses))\n end", "title": "" }, { "docid": "93302beedbb79482a9862a4311d20824", "score": "0.5295565", "text": "def edit_action?\n %i[edit update].include?(action)\n end", "title": "" }, { "docid": "3074f26b92d54d69048aad67865d4c61", "score": "0.52904594", "text": "def can_edit?(thing)\r\n if thing.class == Bodysize || thing.class == CompleteBodysize\r\n return true\r\n end\r\n \r\n return false\r\n end", "title": "" }, { "docid": "9885fc87d4d579815f9dc4a6e015a212", "score": "0.528815", "text": "def can_edit? user\n #Rails.logger.info \"%%%%%%%%\"\n #Rails.logger.info \"Current User id is #{user.id}\"\n #Rails.logger.info \"Goal User id is #{self.user_id}\"\n user.id == self.user_id\n end", "title": "" }, { "docid": "a0043a4f058b8332cbf1bd95095ac9f1", "score": "0.528089", "text": "def view?\n @gapi[\"type\"] == \"VIEW\"\n end", "title": "" }, { "docid": "a0043a4f058b8332cbf1bd95095ac9f1", "score": "0.528089", "text": "def view?\n @gapi[\"type\"] == \"VIEW\"\n end", "title": "" }, { "docid": "a0043a4f058b8332cbf1bd95095ac9f1", "score": "0.528089", "text": "def view?\n @gapi[\"type\"] == \"VIEW\"\n end", "title": "" } ]
5e8fc267d7896e2a2cc032158f30eb94
Capture a screenshot defining global method to capture screenshot
[ { "docid": "ae58403aa690b856526fb494f7cdfae8", "score": "0.70506966", "text": "def screenshot(filename)\n basepath = File.join(File.dirname(__FILE__), 'screenshot')\n # Create dir if not exists\n Dir.mkdir basepath, 0755 if not File.exist? basepath\n #%x(mkdir -p #{basepath})\n # Capture screenshot\n $b.driver.save_screenshot(\"#{basepath}/#{filename}_#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}.png\")\nend", "title": "" } ]
[ { "docid": "ad0ccc9c6cc1741e29ba0501add60caf", "score": "0.83892643", "text": "def capture_screen\n create_screenshot\n end", "title": "" }, { "docid": "9c5e2acfaf7cd18889829bbe12a2390b", "score": "0.83231276", "text": "def take_screenshot; end", "title": "" }, { "docid": "d19c61ddda326399957976d12ac120a6", "score": "0.7782657", "text": "def captureScreen\n begin\n outputFile = \"\"\n preoutputFile = DateTimestamp() + \"IMG.png\"\n postoutputFile = preoutputFile.gsub(\" \", \"\")\n formattedOutput = postoutputFile.gsub(\":\", \"\")\n \n outputFile = $imgScreenShoot + formattedOutput\n $browser.driver.save_screenshot(outputFile)\n return outputFile\n rescue Exception => e\n @@utils.setFalseResult(\"Couldn't capture screenshot\")\n puts( e.class )\n puts( e )\n return nil\n end\n end", "title": "" }, { "docid": "f4db34f12aae873ae8552daeb85a28ca", "score": "0.77467847", "text": "def capture_screenshot(filename)\n do_command(\"captureScreenshot\", [filename,])\n end", "title": "" }, { "docid": "6b74417e187a62d223438b500193fa82", "score": "0.75883245", "text": "def screenshot(); RawImage.new(@device.getScreenshot()) end", "title": "" }, { "docid": "1fcd71cd45a2a13b30670f9683bf28bb", "score": "0.7421098", "text": "def screenshot_and_save_page; end", "title": "" }, { "docid": "33f0ba70a90b7c19fce8366b5a827484", "score": "0.74099004", "text": "def capture_screenshot(path = nil)\n t = Toolkit.getDefaultToolkit\n s = t.getScreenSize\n rect = Rectangle.new(0, 0, s.width, s.height);\n \n @robot ||= Robot.new\n image = @robot.createScreenCapture(rect)\n if path.nil?\n path = Time.now.to_i.to_s + '_screenshot.png'\n end\n file = java.io.File.new(path)\n ImageIO.write(image, 'png', file)\n end", "title": "" }, { "docid": "d60f403e34fd915ea55ccd80d9efedf6", "score": "0.7355961", "text": "def capture_screen_shot( prefix = '')\n capture_screen_shot_base( @current_scenario , prefix )\n end", "title": "" }, { "docid": "5c054836f62f1d28b5d33666285bbfbb", "score": "0.73089975", "text": "def screenshot(args)\n ADB.screencap(qualifier, args)\n end", "title": "" }, { "docid": "77653860c7122c9b73d1722b75b8b476", "score": "0.73058486", "text": "def screencapture(options:)\n get_device do |device|\n out = @config.out\n payload = {\n mysubmit: \"Screenshot\",\n passwd: @dev_password,\n archive: Faraday::UploadIO.new(File::NULL, 'application/octet-stream')\n }\n response = nil\n multipart_connection(device: device) do |conn|\n response = conn.post \"/plugin_inspect\", payload\n end\n\n path = /<img src=\"([^\"]*)\">/.match(response.body)\n raise ExecutionError, \"Failed to capture screen\" unless path\n path = path[1]\n\n unless out[:file]\n out[:file] = /time=([^\"]*)\">/.match(response.body)\n out_ext = /dev.([^\"]*)\\?/.match(response.body)\n out[:file] = \"dev_#{out[:file][1]}.#{out_ext[1]}\" if out[:file]\n end\n\n response = nil\n simple_connection(device: device) do |conn|\n response = conn.get path\n end\n\n File.open(File.join(out[:folder], out[:file]), \"wb\") do |io|\n io.write(response.body)\n end\n @logger.info \"Screen captured to #{File.join(out[:folder], out[:file])}\"\n end\n end", "title": "" }, { "docid": "5d1f2e389ff1ef8f3da122cd3f6de652", "score": "0.728584", "text": "def screenshot(args = {})\n args[:device_id] = serial\n IDeviceScreenshot.capture(args)\n end", "title": "" }, { "docid": "5d1f2e389ff1ef8f3da122cd3f6de652", "score": "0.728584", "text": "def screenshot(args = {})\n args[:device_id] = serial\n IDeviceScreenshot.capture(args)\n end", "title": "" }, { "docid": "cb809db6f3e25c33b92a30dc11b9e8c4", "score": "0.7218418", "text": "def show_screen\n if respond_to?(:save_screenshot)\n page.save_screenshot(\"screenshot.png\")\n system(\"open 'screenshot.png'\")\n end\nend", "title": "" }, { "docid": "c4638943746c7e08a4932a415a47ba9d", "score": "0.72134835", "text": "def screenshot!\n page.save_screenshot(Rails.root.join('tmp/rspec_screens/screenshot.png'))\n end", "title": "" }, { "docid": "b4dfee8248265256d9da756dfc3514b5", "score": "0.7197156", "text": "def take_screenshot\n @driver.save_screenshot(\"#{@dir_name}\" + \"/\" + \"#{Time.now.strftime(\"screen_shot__%H_%M_%S\")}.png\")\n end", "title": "" }, { "docid": "347e97f87eb6c653553839bb4d7dda95", "score": "0.7165597", "text": "def capture_screen_shot_base( scenario, prefix = '' )\n\n feature_name = feature_name()\n\n image_capture_file_name = \"#{feature_name}-#{scenario.name.gsub(/[ \\.'\"\\?]/,'_')}\" + \n \"-#{Time.now.strftime(\"%m%d%Y_%H%M%S\")}.jpg\"\n image_capture_file_name = ( prefix != '' )? prefix + \"-\" +\n image_capture_file_name : image_capture_file_name\n type = (scenario.failed?)? '[Failure]' : '[Normal]'\n\n embed_screenshot( image_capture_file_name )\n screen_capture_base_path = Warden::Config::run_mode == \"server\" ? SCREEN_CAPTURE_SERVER : SCREEN_CAPTURE_DIR\n screen_capture_url = \"#{type} screen capture is at: \" + screen_capture_base_path + '/' + Config::test_target_name + '/' +\n image_capture_file_name\n #print FORMATS[:failed].call(screen_capture_url) if scenario.failed? \n\n scneario_outline = scenario.scenario_outline if scenario.kind_of? Cucumber::Ast::OutlineTable::ExampleRow\n\n if @@scenario_screen_capture.has_key?(scenario)\n @@scenario_screen_capture[scenario].push(screen_capture_url)\n else\n @@scenario_screen_capture[scenario] = []\n @@scenario_screen_capture[scenario].push(screen_capture_url)\n end\n #also store the screen capture under a scneario outline\n #because 'print_screen_capture_url' will only passed in scneario_ouline object not\n #the example row obejct\n @@scenario_screen_capture[scneario_outline] = [] unless @@scenario_screen_capture.has_key?(scneario_outline)\n @@scenario_screen_capture[scneario_outline].push(screen_capture_url) if scneario_outline\n image_capture_file_name\n end", "title": "" }, { "docid": "faf9c7a2230771107980f66f02ebb4b8", "score": "0.71649796", "text": "def take_screenshot\n @driver.save_screenshot(\"logs/#{name}.png\")\n end", "title": "" }, { "docid": "9de3a10d03c5d3b1829c36708004195d", "score": "0.7143573", "text": "def screenshot\n ensure_dir!(absolute_png_path)\n save_screenshot(absolute_png_path)\n end", "title": "" }, { "docid": "16ed766fbcff79f88249495cb7c88988", "score": "0.71296173", "text": "def screenshot(png_save_path)\n @driver.save_screenshot png_save_path\n nil\n end", "title": "" }, { "docid": "5bc47e1dd6d74ed2750b33483444a683", "score": "0.71212703", "text": "def ScreenShot(functionname)\n begin\n require 'java'\n \n include_class 'java.awt.Dimension'\n include_class 'java.awt.Rectangle'\n include_class 'java.awt.Robot'\n include_class 'java.awt.Toolkit'\n include_class 'java.awt.event.InputEvent'\n include_class 'java.awt.image.BufferedImage'\n include_class 'javax.imageio.ImageIO'\n \n toolkit = Toolkit::getDefaultToolkit()\n screen_size = toolkit.getScreenSize()\n rect = Rectangle.new(screen_size)\n robot = Robot.new\n image = robot.createScreenCapture(rect)\n path = ConfigFile.screenshotpath #File.dirname(__FILE__)\n f = java::io::File.new(path.to_s + \"\\\\\" + functionname + '.png')\n ImageIO::write(image, \"png\", f) \n rescue\n ErrorHandler(\"error\",\"ScreenShot\")\n end\nend", "title": "" }, { "docid": "f4d3c432ddd5895067f8fe1b3dd52217", "score": "0.7090475", "text": "def screenshot(png_save_path)\n @driver.save_screenshot png_save_path\n end", "title": "" }, { "docid": "6ed353c653070fd48f38e86a31b2c8dd", "score": "0.70328015", "text": "def capture(mode=@mode)\n \n blob = screenshot(mode)\n \n if @file then\n \n File.write @file % @count, blob\n \n end\n\n @count += 1 \n @blob << blob\n\n end", "title": "" }, { "docid": "3e5e9fc76453388c1bf7e622f9bbb096", "score": "0.702319", "text": "def screenshot( quality=50 )\n request = Packet.create_request( COMMAND_ID_STDAPI_UI_DESKTOP_SCREENSHOT )\n request.add_tlv( TLV_TYPE_DESKTOP_SCREENSHOT_QUALITY, quality )\n\n if client.platform == 'windows'\n # Check if the target is running Windows 8/Windows Server 2012 or later and there are session 0 desktops visible.\n # Session 0 desktops should only be visible to services. Windows 8/Server 2012 and later introduce the restricted\n # desktop for services, which means that services cannot view the normal user's desktop or otherwise interact with\n # it in any way. Attempting to take a screenshot from a service on these systems can lead to non-desireable\n # behavior, such as explorer.exe crashing, which will force the compromised user to log back into their system\n # again. For these reasons, any attempt to perform screenshots under these circumstances will be met with an error message.\n opSys = client.sys.config.sysinfo['OS']\n build = opSys.match(/Build (\\d+)/)\n if build.nil?\n raise RuntimeError, 'Could not determine Windows build number to determine if taking a screenshot is safe.', caller\n else\n build_number = build[1].to_i\n if build_number >= 9200 # Windows 8/Windows Server 2012 and later\n current_desktops = enum_desktops\n current_desktops.each do |desktop|\n if desktop[\"session\"].to_s == '0'\n raise RuntimeError, 'Current session was spawned by a service on Windows 8+. No desktops are available to screenshot.', caller\n end\n end\n end\n end\n\n # include the x64 screenshot dll if the host OS is x64\n if( client.sys.config.sysinfo['Architecture'] =~ /^\\S*x64\\S*/ )\n screenshot_path = MetasploitPayloads.meterpreter_path('screenshot','x64.dll')\n if screenshot_path.nil?\n raise RuntimeError, \"screenshot.x64.dll not found\", caller\n end\n\n screenshot_dll = ''\n ::File.open( screenshot_path, 'rb' ) do |f|\n screenshot_dll += f.read( f.stat.size )\n end\n\n request.add_tlv( TLV_TYPE_DESKTOP_SCREENSHOT_PE64DLL_BUFFER, screenshot_dll, false, true )\n end\n\n # but always include the x86 screenshot dll as we can use it for wow64 processes if we are on x64\n screenshot_path = MetasploitPayloads.meterpreter_path('screenshot','x86.dll')\n if screenshot_path.nil?\n raise RuntimeError, \"screenshot.x86.dll not found\", caller\n end\n\n screenshot_dll = ''\n ::File.open( screenshot_path, 'rb' ) do |f|\n screenshot_dll += f.read( f.stat.size )\n end\n\n request.add_tlv( TLV_TYPE_DESKTOP_SCREENSHOT_PE32DLL_BUFFER, screenshot_dll, false, true )\n end\n\n # send the request and return the jpeg image if successfull.\n response = client.send_request( request )\n if( response.result == 0 )\n return response.get_tlv_value( TLV_TYPE_DESKTOP_SCREENSHOT )\n end\n\n return nil\n end", "title": "" }, { "docid": "ca1cd30ecb5cefc9a947316065720a4c", "score": "0.70093787", "text": "def screenshot(log_folder, ver_num)\n if ver_num =~ /10\\.(7|6|5)/\n print_status(\"Capturing screenshot\")\n picture_name = ::Time.now.strftime(\"%Y%m%d.%M%S\")\n if is_root?\n print_status(\"Capturing screenshot for each loginwindow process since privilege is root\")\n if session.type =~ /shell/\n loginwindow_pids = cmd_exec(\"/bin/ps aux \\| /usr/bin/awk \\'/name/ \\&\\& \\!/awk/ \\{print \\$2\\}\\'\").split(\"\\n\")\n loginwindow_pids.each do |pid|\n print_status(\"\\tCapturing for PID:#{pid}\")\n cmd_exec(\"/bin/launchctl bsexec #{pid} /usr/sbin/screencapture -x /tmp/#{pid}.jpg\")\n file_local_write(log_folder + \"//screenshot_#{pid}.jpg\",\n cmd_exec(\"/bin/cat /tmp/#{pid}.jpg\"))\n cmd_exec(\"/usr/bin/srm -m -z /tmp/#{pid}.jpg\")\n end\n end\n else\n cmd_exec(\"/usr/sbin/screencapture\", \"-x /tmp/#{picture_name}.jpg\")\n file_local_write(log_folder+\"//screenshot.jpg\",\n cmd_exec(\"/bin/cat /tmp/#{picture_name}.jpg\"))\n cmd_exec(\"/usr/bin/srm\", \"-m -z /tmp/#{picture_name}.jpg\")\n end\n print_status(\"Screenshot Captured\")\n end\n end", "title": "" }, { "docid": "7cc02517b0d305438a34f3ed8c914ae8", "score": "0.7003154", "text": "def screenshot(params)\n begin\n filepath = \"screenshots/#{params[0]}.png\"\n if params[-1] == \"time\" or params[-2] == \"time\"\n filepath = \"screenshots/#{params[0..-2].join(' ')}_#{DateTime.now.strftime(\"%d-%m-%Y_%H.%M\")}.png\"\n end\n if params[-1] == \"full\" or params[-2] == \"full\"\n $results.log_action(params.join(' '))\n @driver.execute_script(\"document.getElementsByTagName('html')[0].style['zoom'] = 0.7\")\n sleep 3\n @driver.save_screenshot(filepath)\n @driver.execute_script(\"document.getElementsByTagName('html')[0].style['zoom'] = 1\")\n $results.success\n else\n @driver.save_screenshot(filepath)\n end\n rescue => ex\n $results.fail(message, ex)\n end\n end", "title": "" }, { "docid": "b725307ba9e1a4ed4124848386263e1e", "score": "0.69755876", "text": "def captureScreen(filename=nil, hidePatientDetails=false)\n screenCaptureBtn = Element.new(\"Capture Screen Button\", \":Form.captureScreenButton_QPushButton\")\n screenCaptureBtn.click\n snooze 1\n ScreenCapturePopup.new.saveScreenshot(filename, hidePatientDetails)\n end", "title": "" }, { "docid": "5b7f55d29cfac6c21f0ab164ec0215ff", "score": "0.69730854", "text": "def screenshot\n @screen_local = true\n redraw\n export(TH::Map_Saver::Screenshot_Directory)\n $game_message.add(\"Screenshot taken\")\n end", "title": "" }, { "docid": "d23c374dd34e08a6a841cddd6026a4e8", "score": "0.69186497", "text": "def take_screenshot\n Dir::mkdir('screenshots_failed_tests') if not File.directory?('screenshots_failed_tests')\n screenshot_file =\"./screenshots_failed_tests/screenshot-#{Time.now.strftime('%Y-%m-%d %H-%M-%S')}.png\"\n $browser.save_screenshot(screenshot_file)\n encoded_img = @browser.screenshot_as(:base64)\n embed(\"data:image/png;base64,#{encoded_img}\",'image/png')\nend", "title": "" }, { "docid": "10c7058d14feeceadd192b6b12428eb1", "score": "0.69113356", "text": "def take_screenshot!\n meta = RSpec.current_example.metadata\n filename = File.basename File.basename(meta[:file_path])\n line_number = meta[:line_number]\n\n # Build the screenshot name\n screenshot_name = [\n Time.now.to_i,\n SecureRandom.hex(3),\n filename,\n line_number\n ].join('-') + '.png'\n\n tmp_dir = PROJECT_ROOT.join('tmp')\n screenshot_dir, = FileUtils.mkdir_p File.join tmp_dir, 'screenshots'\n screenshot_path = File.join screenshot_dir, screenshot_name\n\n # Save and inform\n page.save_screenshot(screenshot_path, full: true)\n puts '', meta[:full_description], \" Screenshot: #{screenshot_path}\"\n end", "title": "" }, { "docid": "621e37f68d0d7d46379926c0147e7622", "score": "0.69101423", "text": "def take_screenshot args\n if !File.exist?(\"screenshots/\")\n $gtk.system \"mkdir screenshots/\"\n end\n \n if File.file?(\"screenshots/screenshot#{args.state.screenshot_index}.png\")\n args.state.screenshot_index += 1\n end\n \n args.outputs.screenshots << {\n x: 0,\n y: 0,\n w: 1280,\n h: 720,\n path: \"screenshots/screenshot#{args.state.screenshot_index}.png\",\n r: 255,\n g: 255,\n b: 255,\n a: 255\n }\nend", "title": "" }, { "docid": "56ae22c61ad46d8c5f6468b80a047042", "score": "0.6906197", "text": "def take_screenshot(name)\r\n\tpage.save_screenshot \"screenshots/#{name}.png\"\r\nend", "title": "" }, { "docid": "5b2c442b2cc7fd24ea8a2efde92ff783", "score": "0.68945646", "text": "def embed_screenshot( image_capture_file_name )\n #%x(scrot #{$ROOT_PATH}/images/#{id}.png)\n project_name = Config::test_target_name\n image_capture_project_path = \"#{Config::SCREEN_CAPTURE_DIR}/#{project_name}\"\n\n unless Dir.exist?( image_capture_project_path )\n Dir.mkdir( image_capture_project_path )\n end\n\n image_capture_file_name.gsub!(ILLEGALC, '_')\n file_path = \"#{image_capture_project_path}/#{image_capture_file_name}\"\n\n File.open(file_path,'wb') do |f|\n case Capybara.current_driver\n when :selenium\n f.write(Base64.decode64(page.driver.browser.screenshot_as(:base64)))\n when :webkit\n page.driver.render(f.path)\n else\n puts \"Doesn't support screen capture for driver '#{Capybara.current_driver}'\"\n end\n end\n end", "title": "" }, { "docid": "49e27028802c6de85cbe285f31baa565", "score": "0.6871699", "text": "def screen_capture(fileName)\n return $marathon.screenCapture(fileName)\nend", "title": "" }, { "docid": "3cfa8af6366c6c7e381ce39d4f1b063b", "score": "0.686761", "text": "def screenshot(name=\"screenshot\")\n page.driver.render(\"#{name}.jpg\",full: true)\n end", "title": "" }, { "docid": "d9a35bb4319d8762be158372f3e8ff44", "score": "0.686168", "text": "def screenshot_as(format); end", "title": "" }, { "docid": "36adf59f10e05a180a34708ba2536a58", "score": "0.6765787", "text": "def screenshot(page)\n page.driver.render(Rails.root.join(\"public/screenshot.jpg\").to_s)\n end", "title": "" }, { "docid": "f396e8e665d68a9aabb4cc26af9d605d", "score": "0.6758301", "text": "def screenshot png_save_path\n @driver.save_screenshot png_save_path\n end", "title": "" }, { "docid": "e6532c65787c2d9c60704a1d88edfe4c", "score": "0.6748675", "text": "def screen_capture(filename , active_window_only=false, save_as_bmp=false)\n\n\n keybd_event = Win32API.new(\"user32\", \"keybd_event\", ['I','I','L','L'], 'V')\n vkKeyScan = Win32API.new(\"user32\", \"VkKeyScan\", ['I'], 'I')\n winExec = Win32API.new(\"kernel32\", \"WinExec\", ['P','L'], 'L')\n openClipboard = Win32API.new('user32', 'OpenClipboard', ['L'], 'I')\n setClipboardData = Win32API.new('user32', 'SetClipboardData', ['I', 'I'], 'I')\n closeClipboard = Win32API.new('user32', 'CloseClipboard', [], 'I')\n globalAlloc = Win32API.new('kernel32', 'GlobalAlloc', ['I', 'I'], 'I')\n globalLock = Win32API.new('kernel32', 'GlobalLock', ['I'], 'I')\n globalUnlock = Win32API.new('kernel32', 'GlobalUnlock', ['I'], 'I')\n memcpy = Win32API.new('msvcrt', 'memcpy', ['I', 'P', 'I'], 'I')\n\n \n filename = Dir.getwd.tr('/','\\\\') + '\\\\' + filename unless filename.index('\\\\')\n\n if active_window_only ==false\n keybd_event.Call(VK_SNAPSHOT,0,0,0) # Print Screen\n else\n keybd_event.Call(VK_SNAPSHOT,1,0,0) # Alt+Print Screen\n end \n\n winExec.Call('mspaint.exe', SW_SHOW)\n sleep(1)\n \n # Ctrl + V : Paste\n keybd_event.Call(VK_CONTROL, 1, 0, 0)\n keybd_event.Call(vkKeyScan.Call(?V), 1, 0, 0)\n keybd_event.Call(vkKeyScan.Call(?V), 1, KEYEVENTF_KEYUP, 0)\n keybd_event.Call(VK_CONTROL, 1, KEYEVENTF_KEYUP, 0)\n\n\n # Alt F + A : Save As\n keybd_event.Call(VK_MENU, 1, 0, 0)\n keybd_event.Call(vkKeyScan.Call(?F), 1, 0, 0)\n keybd_event.Call(vkKeyScan.Call(?F), 1, KEYEVENTF_KEYUP, 0)\n keybd_event.Call(VK_MENU, 1, KEYEVENTF_KEYUP, 0)\n keybd_event.Call(vkKeyScan.Call(?A), 1, 0, 0)\n keybd_event.Call(vkKeyScan.Call(?A), 1, KEYEVENTF_KEYUP, 0)\n sleep(1)\n\n # copy filename to clipboard\n hmem = globalAlloc.Call(GMEM_MOVEABLE, filename.length+1)\n mem = globalLock.Call(hmem)\n memcpy.Call(mem, filename, filename.length+1)\n globalUnlock.Call(hmem)\n openClipboard.Call(0)\n setClipboardData.Call(CF_TEXT, hmem) \n closeClipboard.Call \n sleep(1)\n \n # Ctrl + V : Paste\n keybd_event.Call(VK_CONTROL, 1, 0, 0)\n keybd_event.Call(vkKeyScan.Call(?V), 1, 0, 0)\n keybd_event.Call(vkKeyScan.Call(?V), 1, KEYEVENTF_KEYUP, 0)\n keybd_event.Call(VK_CONTROL, 1, KEYEVENTF_KEYUP, 0)\n\n if save_as_bmp == false\n # goto the combo box\n keybd_event.Call(VK_TAB, 1, 0, 0)\n keybd_event.Call(VK_TAB, 1, KEYEVENTF_KEYUP, 0)\n sleep(0.5)\n\n # select the first entry with J\n keybd_event.Call(vkKeyScan.Call(?J), 1, 0, 0)\n keybd_event.Call(vkKeyScan.Call(?J), 1, KEYEVENTF_KEYUP, 0)\n sleep(0.5)\n end \n\n # Enter key\n keybd_event.Call(VK_RETURN, 1, 0, 0)\n keybd_event.Call(VK_RETURN, 1, KEYEVENTF_KEYUP, 0)\n sleep(1)\n \n # Alt + F4 : Exit\n keybd_event.Call(VK_MENU, 1, 0, 0)\n keybd_event.Call(VK_F4, 1, 0, 0)\n keybd_event.Call(VK_F4, 1, KEYEVENTF_KEYUP, 0)\n keybd_event.Call(VK_MENU, 1, KEYEVENTF_KEYUP, 0)\n sleep(1) \n\n end", "title": "" }, { "docid": "8764bb5e6ebdc601068729bda4fb8315", "score": "0.6721718", "text": "def take_screenshot\n return super unless Capybara.last_used_session\n Capybara.using_session(Capybara.last_used_session) { super }\n end", "title": "" }, { "docid": "3947d6eaee1379061bfb69749eca81f4", "score": "0.6721231", "text": "def save_screenshot(file_path)\n @driver.save_screenshot file_path\n end", "title": "" }, { "docid": "9075fb646735a0891a79fb7c4dfc029e", "score": "0.6710513", "text": "def screenshot(file, opts = {})\n SimCtl.screenshot(self, file, opts)\n end", "title": "" }, { "docid": "7dd4835298ed32053cfb93b2a19082b7", "score": "0.669783", "text": "def screenshot\n name = Time.now.getutc\n path = Rails.root.join(\"tmp/#{name}.png\")\n save_screenshot(path)\n end", "title": "" }, { "docid": "e9fcb05f4181c5a96c3fe8db56803259", "score": "0.6692083", "text": "def create_screenshot(params = {})\n connection.post('screenshots', params)\n end", "title": "" }, { "docid": "b17a29f5144568a10f57dae0d8709836", "score": "0.6686418", "text": "def take_screenshot\n return super unless Capybara.last_used_session\n\n Capybara.using_session(Capybara.last_used_session) { super }\n end", "title": "" }, { "docid": "b17a29f5144568a10f57dae0d8709836", "score": "0.6686418", "text": "def take_screenshot\n return super unless Capybara.last_used_session\n\n Capybara.using_session(Capybara.last_used_session) { super }\n end", "title": "" }, { "docid": "716eb005464e996184109bf27c95c24a", "score": "0.6678751", "text": "def png\n @driver.screenshot_as(:png)\n end", "title": "" }, { "docid": "fd53cd4ae4e3d64a5171448cba60faba", "score": "0.66778344", "text": "def capture_screenshot(browser, file_name)\n STDERR.puts \"Sorry - no screenshots on your platform yet.\"\n end", "title": "" }, { "docid": "91fa763f01fb0ca4a83eb31c05f3e4d9", "score": "0.6665411", "text": "def add_screenshot\n file_path = 'screenshot.png'\n page.driver.browser.save_screenshot(file_path)\n image = File.open(file_path, 'rb', &:read)\n attach(image, 'image/png')\n end", "title": "" }, { "docid": "57e24a9ebd8b7f582f656bf5b162c075", "score": "0.6664272", "text": "def make_screenshot_here\n data_time = Time.now.strftime('%d-%m-%Y_%H:%M')\n puts \"Saving screenshot #{data_time}.png ...\"\n page.save_screenshot('tmp/screens/' + data_time + '.png')\n end", "title": "" }, { "docid": "8fe9c50ee6b6f8bf10572a7d5552d41d", "score": "0.66526985", "text": "def capture(url, ext='png')\n return unless File.exist? capturer\n \n tmp = Tempfile.new('screencap')\n @out = \"#{tmp.path}.#{ext}\"\n puts \"saving screencap to #{@out}...\"\n begin\n SystemTimer.timeout_after(@@timeout_seconds) {\n system \"DISPLAY=localhost:1.0 #{capturer} #{BinOpts} --url='#{url}' --out=#{@out}\"\n }\n rescue Timeout::Error => e\n puts \"Timeout saving screencap (#{@@timeout_seconds} s. max): #{e.message}..killing process\"\n system \"pkill #{ScreenCapBin}\"\n @out = nil\n ensure\n tmp.delete\n end\n puts \"screencap done.\"\n @out\n end", "title": "" }, { "docid": "ecc123a05b5c914a5e951eb3f647436c", "score": "0.6650516", "text": "def take_screenshot_from_listener(a)\n\ta\nend", "title": "" }, { "docid": "83223cc128b2f8643a5eba8c66e796a9", "score": "0.66484725", "text": "def screenshot(location = 'screenshot/screen.png')\n Rails.logger.info 'saving screenshot'\n sleep(1)\n @browser.save_screenshot(location)\n end", "title": "" }, { "docid": "c7973c0d68844796dda0a67390da9ef1", "score": "0.6638916", "text": "def take_screenshot_of(browser)\n save_html(browser)\n screenshot\n end", "title": "" }, { "docid": "70fea980076ebe234d128bec30401cff", "score": "0.66327316", "text": "def window_capture(fileName, windowName)\n return $marathon.screenCapture(fileName, windowName)\nend", "title": "" }, { "docid": "d2ded2e55838ef2b266bf2a329d64eda", "score": "0.6615517", "text": "def take_screenshot(text = 'screenshot')\n time = Time.now.strftime('%Y-%m-%d_%H-%M-%S')\n @browser.screenshot.save \"./screenshots/#{text}_#{time}.png\"\nend", "title": "" }, { "docid": "f1baaddead7858a187b40f6824075ba5", "score": "0.66113883", "text": "def take_screenshot\n\t\tpage.driver.render test_root + \"/tmp/#{(Time.now.to_f * 1.milion).round}.png\"\n\tend", "title": "" }, { "docid": "21c34554ad3d886b90fb2d6c574a03ca", "score": "0.66098166", "text": "def take_browser_screenshot(file_name=\"screenshot_#{Time.now.strftime('%Y%m%d-%H%M%S')}.png\", embeded_title='Screenshot')\n new_screenshot_path = \"#{ExecutionEnvironment.log_directory}/#{file_name}\"\n Log.instance.debug \"Saving snapshot to \\\"#{new_screenshot_path}\\\"...\"\n if ENV[\"HEADLESS\"].nil?\n @browser.save_screenshot new_screenshot_path\n else\n @headless.take_screenshot new_screenshot_path\n end\n embed file_name, 'image/png', embeded_title\n new_screenshot_path\nend", "title": "" }, { "docid": "9da6dd61730a8e8a71ad40d7143d108d", "score": "0.6592941", "text": "def screendump(file=nil)\n pngdata = VixAPI._capture_screen_image(self)\n end", "title": "" }, { "docid": "00dbb0b00d67de9f4091c67501b4468a", "score": "0.65843576", "text": "def take_screenshot\n return super unless Capybara.last_used_session\n Capybara.using_session(Capybara.last_used_session) { super }\n end", "title": "" }, { "docid": "5c92021f8ccb042750746fdb936793d7", "score": "0.6576979", "text": "def screenshot(filename)\n File.delete(filename) if File.exists?(filename)\n session.Visible = true unless visible\n\n if jruby?\n toolkit = Toolkit::getDefaultToolkit()\n screen_size = toolkit.getScreenSize()\n rect = Rectangle.new(screen_size)\n robot = Robot.new\n image = robot.createScreenCapture(rect)\n f = java::io::File.new(filename)\n ImageIO::write(image, \"png\", f)\n else\n hwnd = session.WindowHandle\n Win32::Screenshot::Take.of(:window, hwnd: hwnd).write(filename)\n end\n\n session.Visible = false unless visible\n end", "title": "" }, { "docid": "6dffd6c0632d9f38b587111ea779e883", "score": "0.6571921", "text": "def capture(checkpoint = nil)\n \n if checkpoint\n @checkpoint = checkpoint\n end\n \n filename = (@checkpoint ? @checkpoint.to_s + '-' : '') + Time.now.to_i.to_s + '.png'\n \n file = \"#{tmp_dir}/#{filename}\"\n \n capture_time = Time.now\n code.call(file)\n \n File.exist? file or raise \"Couldn't capture screenshot\"\n \n image = Magick::ImageList.new(file).first\n \n if @last_capture\n delay = (capture_time - @last_capture).to_i\n images.last.delay = delay\n end\n @last_capture = capture_time\n \n images << image\n image\n end", "title": "" }, { "docid": "6891c5875f9f40518a3a29cdd7c00bba", "score": "0.65454674", "text": "def capture\n # This necessary to install PhantomJS via proxy\n Phantomjs.proxy_host = proxy_host if proxy_host\n Phantomjs.proxy_port = proxy_port if proxy_port\n\n output = Phantomjs.run(options, SCRIPT_PATH.to_s, *prepared_params)\n handle_output(output)\n\n Gastly::Image.new(image)\n end", "title": "" }, { "docid": "b1f7d5119dcff46af5eb317a01a37c24", "score": "0.65161633", "text": "def screenshot(opts = {})\n data, _status_code, _headers = screenshot_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "fdca356a970c7d8f4817c09968a65f14", "score": "0.6509413", "text": "def capture_entire_page_screenshot(filename)\n do_command(\"captureEntirePageScreenshot\", [filename,])\n end", "title": "" }, { "docid": "4e19121160a3ca735f4c1f4a4a3709c8", "score": "0.6499224", "text": "def embed_screenshots(scenario)\n\nend", "title": "" }, { "docid": "a8ccef8a622c010ee183572f7039e187", "score": "0.6497846", "text": "def save_and_open_full_screenshot\n path = File.join Rails.root, 'tmp/capybara', SecureRandom.hex(8) + '.png'\n page.driver.save_screenshot path, full: true\n page.send :open_file, path\n end", "title": "" }, { "docid": "177d29efce13b67a93d0b37784d51cd4", "score": "0.6485294", "text": "def element_screenshot(element, png_save_path)\n @driver.take_element_screenshot element, png_save_path\n nil\n end", "title": "" }, { "docid": "b02dd97ec678d81bfb09f09a5a530cf0", "score": "0.64752644", "text": "def take_screenshot(filename = \"screenshot1.png\")\n\t\treturn if !checkConn\n\t\t@screenshotFilename = filename\n\t\tsend_command(\"SCREENSHOT\")\n\t\tget_response\n\tend", "title": "" }, { "docid": "d50abcee1cb639f01ff9eddc27df29c7", "score": "0.64726907", "text": "def screenshot(screenshot_test_id, params = {})\n connection.get(\"screenshots/#{screenshot_test_id}\", params)\n end", "title": "" }, { "docid": "58703de5212b31e0eb63ec32cf34efe5", "score": "0.6451199", "text": "def screenshot(file)\n browser.screenshot.save(file)\n end", "title": "" }, { "docid": "c46da64abe069b4a3206af796e30de98", "score": "0.64475477", "text": "def take_screenshot(filename = \"screenshot1.png\")\n\t\t\t\t\treturn if !checkConn\n\t\t\t\t\t@screenshotFilename = filename\n\t\t\t\t\tsend_command(\"SCREENSHOT\")\n\t\t\t\t\tget_response\n\t\t\t\tend", "title": "" }, { "docid": "3b1572f26733b9da99358244ea4e288a", "score": "0.64446765", "text": "def capture(url, path, opts = {})\n begin\n # Default settings\n width = opts.fetch(:width, 120)\n height = opts.fetch(:height, 90)\n gravity = opts.fetch(:gravity, \"north\")\n quality = opts.fetch(:quality, 85)\n full = opts.fetch(:full, true)\n selector = opts.fetch(:selector, nil)\n allowed_status_codes = opts.fetch(:allowed_status_codes, [])\n\n # Reset session before visiting url\n Capybara.reset_sessions! unless @session_started\n @session_started = false\n\n # Open page\n visit url\n\n # Timeout\n sleep opts[:timeout] if opts[:timeout]\n\n # Check response code\n status_code = page.driver.status_code.to_i\n unless valid_status_code?(status_code, allowed_status_codes)\n fail WebshotError, \"Could not fetch page: #{url.inspect}, error code: #{page.driver.status_code}\"\n end\n\n tmp = Tempfile.new([\"webshot\", \".png\"])\n tmp.close\n begin\n screenshot_opts = { full: full }\n screenshot_opts = screenshot_opts.merge({ selector: selector }) if selector\n\n # Save screenshot to file\n page.driver.save_screenshot(tmp.path, screenshot_opts)\n\n # Resize screenshot\n thumb = MiniMagick::Image.open(tmp.path)\n if block_given?\n # Customize MiniMagick options\n yield thumb\n else\n thumb.combine_options do |c|\n c.thumbnail \"#{width}x\"\n c.background \"white\"\n c.extent \"#{width}x#{height}\"\n c.gravity gravity\n c.quality quality\n end\n end\n\n # Save thumbnail\n thumb.write path\n thumb\n ensure\n tmp.unlink\n end\n rescue Capybara::Poltergeist::StatusFailError, Capybara::Poltergeist::BrowserError, Capybara::Poltergeist::DeadClient, Capybara::Poltergeist::TimeoutError, Errno::EPIPE => e\n # TODO: Handle Errno::EPIPE and Errno::ECONNRESET\n raise WebshotError.new(\"Capybara error: #{e.message.inspect}\")\n end\n end", "title": "" }, { "docid": "ab01b6a97bca992303c326d7804edba0", "score": "0.6418359", "text": "def run\n super\n\n uri = _get_entity_name\n\n session = create_browser_session\n\n # capture a screenshot and save it as a detail\n _set_entity_detail(\"hidden_screenshot_contents\",capture_screenshot(session, uri))\n\n # cleanup\n destroy_browser_session(session)\n\n end", "title": "" }, { "docid": "2e150f58c844b832581ac3ec778fb066", "score": "0.63962054", "text": "def work(path)\n out = \"#{path}/#{@name}.png\"\n @fetcher.fetch(output: out, width: @size[0], height: @size[1], dpi: @dpi)\n rescue Screencap::Error\n puts \"Fail to capture screenshot #{@url}\"\n end", "title": "" }, { "docid": "560d10a69fd8d8c8f91829cea173c7a0", "score": "0.6394306", "text": "def obter_evidencia\n caminho_pasta = \"result/screenshots\"\n FileUtils.mkdir_p caminho_pasta unless checar_pasta_existe(caminho_pasta)\n nome_arquivo = SecureRandom.urlsafe_base64\n $screenshot = \"#{caminho_pasta}/#{nome_arquivo}.png\"\n page.save_screenshot($screenshot)\n attach(File.read($screenshot), 'image/png')\nend", "title": "" }, { "docid": "8ddf87677ae07d9e18966929e73bcab4", "score": "0.6385538", "text": "def captures( )\n\t\t\tself.class.captures(@board, @square, @color)\n\t\tend", "title": "" }, { "docid": "0a67912fbb262f0e4494137c21d77dc5", "score": "0.63704085", "text": "def capture(url, path, opts = {})\n begin\n # Default settings\n @width = opts.fetch(:width, 120) if opts[:width]\n @height = opts.fetch(:height, 90) if opts[:width]\n\n # Reset session before visiting url\n Capybara.reset_sessions! unless @session_started\n @session_started = false\n\n # Open page\n visit(url)\n\n # Timeout\n sleep opts[:timeout] if opts[:timeout]\n\n # Check response code\n if page.driver.status_code.to_i == 200 || page.driver.status_code.to_i / 100 == 3\n page.driver.save_screenshot(path, :full => true)\n else\n raise Webstract::Errors::PageError.new(\"Could not fetch page: #{url.inspect}, error code: #{page.driver.status_code}\")\n end\n rescue Capybara::Poltergeist::BrowserError, Capybara::Poltergeist::DeadClient, Capybara::Poltergeist::TimeoutError, Errno::EPIPE => e\n # TODO: Handle Errno::EPIPE and Errno::ECONNRESET\n raise Webstract::Errors::CaptureError.new(\"Capybara error: #{e.message.inspect}\")\n end\n end", "title": "" }, { "docid": "8fd92d676cfc4f0f20838c01bb487674", "score": "0.63617253", "text": "def save_screenshot(file_name = nil)\n $focus_driver = self\n file_name = \"#{Pathname.pwd}/#{$conf['screenshot_location']}/#{Time.new.strftime(\"%Y-%m-%d-%H-%M-%S\")}.png\" if file_name.nil?\n @driver.save_screenshot(file_name)\n end", "title": "" }, { "docid": "53defe87f723f3224bffd4e7cda70b22", "score": "0.63564134", "text": "def take_comparison_screenshot(capture_options, driver_options, screenshot_path)\n screenshoter = build_screenshoter_for(capture_options, driver_options)\n screenshoter.take_comparison_screenshot(screenshot_path)\n end", "title": "" }, { "docid": "ab8cb82508eb575d8e9004c373df620b", "score": "0.6350491", "text": "def get_screenshot(rotation = nil, tag = nil)\n @tag_for_screenshot_debug = tag\n @visible_screenshot_call_count = 0\n image = mobile_device? || [email protected]_fullpage_screenshot ? visible_screenshot : @browser.fullpage_screenshot\n Applitools::Selenium::Driver.normalize_image(self, image, rotation)\n image\n end", "title": "" }, { "docid": "85fe14c09935b136d70c14f619bbead3", "score": "0.6348923", "text": "def screenshot(screenshot_id)\n res_name = 'screenshot'\n endpoint = \"projects/#{@project_id}/runs/#{@run_id}/device-runs/#{id}/screenshots/#{screenshot_id}\"\n\n @client.get_file(endpoint, res_name)\n end", "title": "" }, { "docid": "179a9f07b97fde9a2fd7544fa26f0e59", "score": "0.6348741", "text": "def save_screenshot(selenium_driver)\n save_screenshot_to absolute_png_path\n end", "title": "" }, { "docid": "bd4b48bca6e9eb00faae288ba80db04f", "score": "0.6348056", "text": "def screenshot\n return if accessibility_report == {} ||\n !accessibility_report.audits.respond_to?('full-page-screenshot')\n\n @screenshot ||= FenrirView::Component::AccessibilityScreenshot.new(\n screenshot: accessibility_report.audits\n .public_send('full-page-screenshot')\n .details.screenshot\n )\n end", "title": "" }, { "docid": "515ae2daf341dabce2178a8ee72bfbff", "score": "0.6347029", "text": "def capture(url, path, opts = {})\n # Default settings\n width = opts.fetch(:width, 120)\n height = opts.fetch(:height, 90)\n gravity = opts.fetch(:gravity, \"north\")\n quality = opts.fetch(:quality, 85)\n browser_width = opts.fetch(:browser_width, Webshot.width)\n browser_height = opts.fetch(:browser_height, Webshot.height)\n\n # Reset session before visiting url\n Capybara.reset_sessions! rescue nil\n\n # Ensure we are passing desired params\n page.driver.headers = {\"User-Agent\" => CRAWLER_USER_AGENT}\n page.driver.browser.js_errors = false\n page.driver.resize(browser_width, browser_height)\n\n # Open page\n visit url\n\n # Timeout\n sleep opts[:timeout] || 3\n\n tmp = Tempfile.new([\"webshot-#{SecureRandom.hex(12)}\", \".png\"])\n tmp.close\n\n begin\n # Save screenshot to file\n page.driver.save_screenshot(tmp.path, full: true)\n\n # Resize screenshot\n thumb = MiniMagick::Image.open(tmp.path)\n if block_given?\n # Customize MiniMagick options\n yield thumb\n\n else\n thumb.combine_options do |c|\n c.thumbnail \"#{width}x\"\n c.background \"white\"\n c.extent \"#{width}x#{height}\"\n c.gravity gravity\n c.quality quality\n end\n end\n \n # Save thumbnail\n thumb.write path\n thumb\n ensure\n tmp.unlink\n end\n end", "title": "" }, { "docid": "8c20d4cfac0d619014006c74ad8b5f00", "score": "0.6341107", "text": "def screenshot!\n page.save_screenshot(Rails.root.join('tmp/capybara/debug.png'), { full: true })\n File.open(Rails.root.join('tmp/capybara/page.html'), 'w') do |f|\n f.write(page.body)\n end\n end", "title": "" }, { "docid": "291ab5f06885bd08b119f7a17817dfe0", "score": "0.63391554", "text": "def save_screenshot(path)\n @browser.save_screenshot @url.url, path\n end", "title": "" }, { "docid": "d72a773bdab1570bad14dc2824243862", "score": "0.6308321", "text": "def capture_signature_bmp\n $testCaseID = \"VT229-0429\"\n imgFormat = \"bmp\"\n Rho::SignatureCapture.take(url_for( :action => :signature_callback), { :imageFormat => imgFormat, :penColor => 0xff0000, :penWidth=>5, :border => true, :bgColor => 0x00ff00 })\n redirect :action => :index\n end", "title": "" }, { "docid": "2eb972871869ce4fa54fe763fc99ff2c", "score": "0.6305528", "text": "def take_screenshot(index, action)\n @browser.take_screenshot(Flow.new(@home, index.to_s, action, Date.today, nil, \".png\"))\n end", "title": "" }, { "docid": "67798480c07a2c70f07bee8ead8aff36", "score": "0.63021404", "text": "def shot(filename = 'screenshot', image_type = 2)\r\n # Adds File Extension\r\n filename += image_type == 0 ? '.bmp' : image_type == 1 ? '.jpg' : '.png'\r\n # Create True Filename\r\n file_name = Dir + filename\r\n # Make Screenshot\r\n Screen.call(0, 0, 640, 480, file_name, handel, image_type)\r\n end", "title": "" }, { "docid": "f34ea3858ea0280e68b5de05287c27ff", "score": "0.62830776", "text": "def screenshot(filename)\n File.delete(filename) if File.exists?(filename)\n original_visibility = @visible\n self.visible = true\n\n if jruby?\n toolkit = Toolkit::getDefaultToolkit()\n screen_size = toolkit.getScreenSize()\n rect = Rectangle.new(screen_size)\n robot = Robot.new\n image = robot.createScreenCapture(rect)\n f = java::io::File.new(filename)\n ImageIO::write(image, \"png\", f)\n else\n hwnd = system.WindowHandle\n Win32::Screenshot::Take.of(:window, hwnd: hwnd).write(filename)\n end\n\n self.visible = false unless original_visibility\n end", "title": "" }, { "docid": "79cc30c3fa41f935f49dba46ed721277", "score": "0.6274468", "text": "def capture\n\t\t\t\tclient.snapshot\n\t\t\tend", "title": "" }, { "docid": "8b5647f041b0f0af44340e6905ca0ce5", "score": "0.62539274", "text": "def take_snapshot(identifier)\r\n newArrayStart= @@test_case_fail_artifacts.length\r\n justFile =@@g_base_dir[(@@g_base_dir.rindex('/')+1)..@@g_base_dir.length]\r\n @driver.save_screenshot(\"#{@@artifact_dir}/#{identifier}_#{justFile}_#{newArrayStart}.png\")\r\n #shortArtifactDir = @@artifact_dir.gsub(\"\\\\\\\\hannover-re.grp\\\\shares\\\\hlrus_ex\\\\CDMI_Project\\\\Testing\\\\AutomationLogs\\\\\",\"\")\r\n\r\n shortArtifactDir = @@artifact_dir.downcase.gsub(\"c:/automation/logs/\",\"#{@@base_url[0..(@@base_url.length-2)]}:8001\\\\\")\r\n #shortArtifactDir = @@artifact_dir.gsub(\"c:/Automation/logs/\",\"#{@@base_url[0..(@@base_url.length-2)]}:8001\\\\\")\r\n\r\n @@test_case_fail_artifacts.push(\"#{shortArtifactDir}/#{identifier}_#{justFile}_#{newArrayStart}.png\")\r\n @util.logging(\"#{identifier} Saved a screenshot at #{@@artifact_dir}/#{identifier}_#{justFile}_#{newArrayStart}.png \")\r\n end", "title": "" }, { "docid": "1072bc2ee533389e96a2628fa7f73adb", "score": "0.624303", "text": "def save_screenshot(file_name)\n driver.screenshot.save(file_name)\n end", "title": "" }, { "docid": "a1652ed6c4f80c847b3283839fab8115", "score": "0.62380475", "text": "def capture_inline_bmp\n $testCaseID = \"VT229-0437\"\n Rho::SignatureCapture.visible(true, :imageFormat=>'bmp',:penColor => 0xff0000, :penWidth=>3, :border => true, :bgColor => 0x00ff00 )\n end", "title": "" }, { "docid": "893d6998ba2423ff67d6065e642c69b2", "score": "0.6237139", "text": "def create_screenshot\n material_path = material.file.file\n movie = ScreenshotService.new(material_path, 10).perform\n update_attribute(:screenshot, File.open(movie.path))\n end", "title": "" }, { "docid": "435b8ee8dff3a551fc61088f70a06e69", "score": "0.6232075", "text": "def take_screenshot_if_failed(scenario)\r\n #if (scenario.failed?)\r\n # scenario_name = scenario.to_sexp[3].gsub(/\\ /, \"_\")\r\n # time = Time.now.strftime(\"%Y-%m-%d-%H%M\")\r\n # screenshot_path = 'c:\\\\scorebig\\\\log\\\\' + time + '-' + scenario_name + '.png'\r\n # Win32::Screenshot::Take.of(:window, :title => /ScoreBig/).write(screenshot_path)\r\n #end\r\nend", "title": "" }, { "docid": "feff496aa677b9e0ce212c38f372f36e", "score": "0.6217642", "text": "def takeScreenShot(file)\n\t\tpath = \"screenshots/\"\n\t\tDir.mkdir(path) unless File.exists?(path)\n\t\t$b.screenshot.save(path + file + \".png\")\n\tend", "title": "" }, { "docid": "a24544844033bf8b83ee3427fc6eda2b", "score": "0.621049", "text": "def screenshot_cmd(filename:, resolution: nil)\n resolution = resolution ? resolution_arg(resolution) : nil\n # -f overwrites existing file\n \"#{ffmpeg_bin} -f #{options.capture_device} -i #{options.input} -framerate 1 -frames:v 1 #{resolution}#{filename}\"\n end", "title": "" }, { "docid": "83e342e713cd4d9260542f784ac5f410", "score": "0.62012213", "text": "def capture_signature_png\n $testCaseID = \"VT229-0428\"\n imgFormat = \"png\"\n Rho::SignatureCapture.take(url_for( :action => :signature_callback), { :imageFormat => imgFormat, :penColor => 0xff0000, :penWidth=>5, :border => true, :bgColor => 0x00ff00 })\n redirect :action => :index\n end", "title": "" }, { "docid": "5b6a1b19eb0762bcac4015cff7918c63", "score": "0.6190716", "text": "def _screenshot_counter; end", "title": "" } ]
fdd9b89dd052bf10fb2073ab5b4a30f3
name level Master 1 All Admin 2 Group Admin 3 User 4
[ { "docid": "f3d51b61d0a88a5f7e3349618d69d275", "score": "0.0", "text": "def can_approve_member?\n\t\t[1,2].include? level\n\tend", "title": "" } ]
[ { "docid": "c1aaf7b72d1dbcff167775dcfed89341", "score": "0.63854927", "text": "def admin_level\n 5\n end", "title": "" }, { "docid": "cde42d94e10acb94d48f6053274cc14c", "score": "0.63132095", "text": "def admin_status\n if self.user_admin\n if self.user_admin.level == 1\n return \"Contributor\"\n elsif self.user_admin.level == 2\n return \"Administrator\"\n elsif self.user_admin.level == 3\n return \"Super-Admin\"\n else\n return \"Undefined\"\n end \n else\n return \"Undefined\" \n end\n end", "title": "" }, { "docid": "88c67d420227d8874140a5464768ce27", "score": "0.61252254", "text": "def admin_name\n self.user.name\n end", "title": "" }, { "docid": "f31f5e156b513174ca38d399341f4d62", "score": "0.6089376", "text": "def gadm_level(row)\n return '2' if !row['name_2'].to_s.strip.blank?\n return '1' if !row['name_1'].to_s.strip.blank?\n '0'\n end", "title": "" }, { "docid": "88b1c2f68113ea26f7a20cc7e525e359", "score": "0.60244757", "text": "def level_name\n name = (Membership::LEVELS.respond_to?(:key) ? Membership::LEVELS.key(level) : Membership::LEVELS.index(level)).to_s\n end", "title": "" }, { "docid": "2403a87c2f8708fc35ac4e65519388ac", "score": "0.602189", "text": "def admin_labels\n labels = []\n if admin?\n labels << \"Admin\"\n else\n labels << \"User Admin\" if user_admin?\n labels << \"Moderator\" if moderator?\n end\n labels\n end", "title": "" }, { "docid": "6d66ed0644c9f4f2cdcf91990557c2ac", "score": "0.5837778", "text": "def username\n \"administrator\"\n end", "title": "" }, { "docid": "d785af50620d41647c4e1b3040e3cd69", "score": "0.5753288", "text": "def levelname\n\t\t\tlevel.level_name\n\t\tend", "title": "" }, { "docid": "07f3943c5f55ee4e31859759ddc354a1", "score": "0.57352257", "text": "def name\r\n\t\t@usr_name\r\n\tend", "title": "" }, { "docid": "07f3943c5f55ee4e31859759ddc354a1", "score": "0.57352257", "text": "def name\r\n\t\t@usr_name\r\n\tend", "title": "" }, { "docid": "b3d8412055c2892001c16f6a81b99025", "score": "0.5725009", "text": "def level\r\n\tif $lvl == 1\r\n\t\tlevel2\r\n\telse \r\n\t\tif $lvl == 2\r\n\t\t\tlevel3\r\n\t\telse\r\n\t\t\tif $lvl == 3\r\n\t\t\t\tlevel4\r\n\t\t\tend\r\n\t\tend\t\r\n\tend\t\r\nend", "title": "" }, { "docid": "e93dcefb41e8b5958d2f771163a5e5a2", "score": "0.57043535", "text": "def user_is_admin?\n\t`groups`.split.include? \"admin\"\n end", "title": "" }, { "docid": "7cdf82423c4de05b0604760f5b249d06", "score": "0.5640281", "text": "def clistalladmins(m)\n if is_supadmin?(m.user) || is_admin?(m.user)\n m.reply \"The current admins are #{$adminhash}.\", true\n else\n m.reply NOTADMIN, true\n end\n end", "title": "" }, { "docid": "c7539d3cfb33a16272748e8fd70f534f", "score": "0.5632769", "text": "def display_name\n \"#{user} - #{group}\"\n end", "title": "" }, { "docid": "71e2df53c26694f16ba132bb458695e7", "score": "0.5629036", "text": "def admin_subordinates\n mypost=Login.current_login.staff.position\n post_name=mypost.name\n if post_name==\"Timbalan Pengarah (Pengurusan)\"\n adm_sub=mypost.descendants.map(&:staff_id)\n else\n adm_sub=[]\n end\n adm_sub\n end", "title": "" }, { "docid": "6130af0c56c37611968a26c7041b17e5", "score": "0.5616745", "text": "def check_privilege(type)\n\nif type.floor == 1\n\t\"seller\"\n\nelsif type.floor == 2\n\t\"manager\"\n\nelsif type.floor == 3 \n\t\"admin\"\n\nelse \n \t\"user\"\n\n\tend\nend", "title": "" }, { "docid": "142be71eb3f37f708d1ec6296e97694d", "score": "0.55883384", "text": "def index\n @member_groups = @user.groups_where_member\n @admin_groups = @user.groups_where_admin\n end", "title": "" }, { "docid": "e5ab62fc2f0919a43e87364ee208bb35", "score": "0.5584884", "text": "def admin_menu\n if session[:user_id] and session[:position]\n @admin_user = AdminUser.find_by_id(session[:user_id])\n\n @admin_expenses = Expense.where(:admin_user_id => @admin_user.id)\n\n # the following conditional sets the permissions\n if @admin_user.position.to_s == \"ManagerSnr\"\n flash[:notice] == \"#{@admin_user.first_name} is logged in \"\n @manager_permission = AdminUser.find_by_id(session[:user_id])\n\n elsif @admin_user.position.to_s == \"Manager17\"\n flash[:notice] == \"#{@admin_user.first_name} is logged in \"\n @manager_permission = AdminUser.find_by_id(session[:user_id])\n\n elsif @admin_user.position.to_s == \"Manager15\"\n flash[:notice] == \"#{@admin_user.first_name} is logged in \"\n @manager_permission = AdminUser.find_by_id(session[:user_id])\n\n elsif @admin_user.position.to_s == \"Manager12\"\n flash[:notice] == \"#{@admin_user.first_name} is logged in \"\n @manager_permission = AdminUser.find_by_id(session[:user_id])\n\n elsif @admin_user.position.to_s == \"Secretary\" or \"Treasurer\" or \"Chairman\"\n flash[:notice] == \"#{@admin_user.first_name} is logged in\"\n @admin_permission = AdminUser.find_by_id(session[:user_id])\n\n # superuser has full access\n elsif @admin_user.position.to_s == \"Administrator\"\n flash[:notice] == \"#{@admin_user.first_name} is logged in\"\n @super_user = AdminUser.find_by_id(session[:user_id])\n end\n end\n end", "title": "" }, { "docid": "d5b21f7cfe3a45b642c2975b81205d61", "score": "0.5540913", "text": "def index\n @username = (is_admin? ? params[:id] : current_user_model.username)\n @pronoun = (is_admin? ? \"\" : \" Your \")\n @username = current_user_model.username if @username.blank?\n if is_admin?\n @investigators = Investigator.by_name\n render :action => 'admin_index'\n else\n render\n end\n end", "title": "" }, { "docid": "ff31ee32b0a255ac2e6338761f3110df", "score": "0.5538647", "text": "def name\n\t self.username\n end", "title": "" }, { "docid": "3b0eb559526475d10b2a7446a8719f09", "score": "0.5500684", "text": "def index\n\t\t# si rol mayor a desarrollador, listar todos los grupos \n \tif has_role_with_hierarchy?(:administrador) \n\t\t\t@groups = Group.all\n\t\t# si rol es desarrollador, listar solo sus grupos\n\t\telse\n\t\t\t@groups = Group.all :conditions => { :user_id, current_user.id }\n\t\tend\n end", "title": "" }, { "docid": "feb508c4abfcd4cd3e0b287f1f535d12", "score": "0.54965055", "text": "def show\n @admin_level = Admin.find(session[:admin_id]).admin_level\n end", "title": "" }, { "docid": "40946a694ea7f5e02f1385f72ea4c59d", "score": "0.54872376", "text": "def user_level arg = nil\n if arg == nil\n return session[:group_id]\n elsif arg.class == User\n return arg.group_id\n elsif USER_LEVELS.index(arg) != nil\n return USER_LEVELS.index(arg)\n end\n USER_LEVELS[arg]\n end", "title": "" }, { "docid": "4ce26e1797071baacf442be91ad13e72", "score": "0.5474269", "text": "def role_hierarchy\n [:visitor, :data_entry, :editor, :admin]\n end", "title": "" }, { "docid": "dae441d6de3c87489be105930755be54", "score": "0.5457049", "text": "def user_admin\n user_role.in? [\"Department Admin\",\"College Admin\",\"Tech User\"] if user_role\n end", "title": "" }, { "docid": "05867803c1e6e2ca83358994c364ac35", "score": "0.54523283", "text": "def check_privilege(i = 0)\n floor_i = i.floor\n if floor_i == 1\n 'seller'\n elsif floor_i == 2\n 'manager'\n elsif floor_i >= 3\n 'admin'\n else\n 'user'\n end\nend", "title": "" }, { "docid": "d9e4eee5c85d6f84d0cf23da5f31c67a", "score": "0.5451975", "text": "def admin_name(last_acted_by, admin)\n last_acted_by = last_acted_by.to_i\n if (last_acted_by > 0)\n admin[:name]\n elsif (last_acted_by == Admin::AUTO_APPROVE_ADMIN_ID)\n GlobalConstant::Admin.auto_approved_admin_name\n else\n ''\n end\n end", "title": "" }, { "docid": "4ba0af5bbcd15094d43afaeb84e1760b", "score": "0.54474103", "text": "def listAdmin\n super()\n updateModules()\n\n if @modulesUsed.include?(\"Autograde\") then\n autogradeListAdmin()\n end\n\n if @modulesUsed.include?(\"Scoreboard\") then\n scoreboardListAdmin()\n end\n\n if @modulesUsed.include?(\"Partners\") then\n partnersListAdmin()\n end\n \n if @modulesUsed.include?(\"Svn\") then\n svnListAdmin()\n end\n end", "title": "" }, { "docid": "9c6cfbba495aec10f988934f153138da", "score": "0.54333323", "text": "def index\n #displays session variable onto the console\n puts session[:current_user_id]\n # here we get the superadmin of the particular id\n @superadmin=Superadmin.first\n # we get moderators that belongs to that superadmins\n @moderators= @superadmin.moderators\n end", "title": "" }, { "docid": "881ddc8aab624efd8d06f429d6a4c4a0", "score": "0.5427237", "text": "def username\n @data[GROUPNAME]\n end", "title": "" }, { "docid": "e7d9bfc32f8ab8be33eb219d60e7ddc9", "score": "0.54219586", "text": "def group() self['group'] || node[:users]['root'][:primary_group] ; end", "title": "" }, { "docid": "18bdcf84beb49c52d63e9897382373db", "score": "0.54061604", "text": "def is_master_admin?\n access_level == \"master_admin\"\n end", "title": "" }, { "docid": "cbc3f75fc56bcb63d38f25ec0af4c0c2", "score": "0.54029065", "text": "def username\n name\n end", "title": "" }, { "docid": "a12d0e92f46171c17f0df9296b263952", "score": "0.53962576", "text": "def user_admin_level\n if !!current_user\n @user_admin_level = User.find(session[:user_id]).admin_level\n end\n end", "title": "" }, { "docid": "4e87039ea31ea73e366ba0e8fd29a71a", "score": "0.53928334", "text": "def members_login\r\n\t@title = \"Members Login\"\r\n end", "title": "" }, { "docid": "9eddddae79e4941fec6a88b929bf6dd3", "score": "0.53887016", "text": "def index\n @admin_levels = Admin::Level.all\n end", "title": "" }, { "docid": "d54967857a9a89d917c57fad7377d2df", "score": "0.538269", "text": "def index\n @admins = @admin.role == 1 ? Admin.order(first_name: 'asc') : Admin.joins(:admins_sites).where(\"site_id = ?\", @site.id).order('first_name asc')\n end", "title": "" }, { "docid": "9f66150ea37b48a8cecd84ca80a82e77", "score": "0.53823483", "text": "def index\n if current_user.admin_group?\n @admin_user = current_user\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), auth_assign_permits_path\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_user }\n end\n end\n end", "title": "" }, { "docid": "166ff61538d4fa29ebede25887b50554", "score": "0.5375555", "text": "def level1_eg\r\n\r\n end", "title": "" }, { "docid": "5638f081086ed3bdbd98b80918a4304d", "score": "0.53687316", "text": "def get_level_name(key)\n key = Access::Validate.level(key)\n get_hash_value(Access::Core.levels_hash, key, :name)\n end", "title": "" }, { "docid": "a83712c75196aad255e5e2e27198ec6e", "score": "0.53651065", "text": "def checkrole\n if roles_mask == 4\n 'User'\n elsif roles_mask == 6\n 'Administrator'\n end\n end", "title": "" }, { "docid": "84a6647a34340bb473c91fdcd00859b5", "score": "0.5342886", "text": "def full_title_admin(page_title = '')\r\n base_title = \"Modulect\"\r\n if page_title.empty?\r\n \"Admin | \" + base_title\r\n else\r\n page_title + \" - Admin | \" + base_title\r\n end\r\n end", "title": "" }, { "docid": "93a79b492d037e7f91819a4378539a21", "score": "0.5342756", "text": "def admin?\n name == 'admin'\n end", "title": "" }, { "docid": "f2f084f034132a88d6b2e6fd71b488b2", "score": "0.53395617", "text": "def display_name \n username\n end", "title": "" }, { "docid": "78c2db8300828273f9a037881b55ea56", "score": "0.53305477", "text": "def group_name(group)\n if group.name == 'all users'\n :adjust_permissions_all_users.t\n elsif group.name == 'reviewers'\n :REVIEWERS.t\n elsif group.name.match(/^user \\d+$/)\n group.users.first.legal_name\n else\n group.name\n end\n end", "title": "" }, { "docid": "d07cc4f6594d09fce029c36d7edb74d1", "score": "0.53300977", "text": "def role(user)\n if user.admin\n return \"Admin\"\n else return \"User\"\n end\n end", "title": "" }, { "docid": "f9e47aa4d79f97301094ad347e7dbbee", "score": "0.53283465", "text": "def unit_members\n #Academicians & Mgmt staff : \"Teknologi Maklumat\", \"Perpustakaan\", \"Kewangan & Akaun\", \"Sumber Manusia\",\"logistik\", \"perkhidmatan\" ETC.. - by default staff with the same unit in Position will become unit members, whereby Ketua Unit='unit_leader' role & Ketua Program='programme_manager' role.\n #Exceptional for - \"Kejuruteraan\", \"Pentadbiran Am\", \"Perhotelan\", \"Aset & Stor\" (subunit of Pentadbiran), Ketua Unit='unit_leader' with unit in Position=\"Pentadbiran\", Note: whoever within these unit if wrongly assigned as 'unit_leader' will also hv access for all ptdos on these unit staff\n \n exist_unit_of_staff_in_position = Position.find(:all, :conditions =>['unit is not null and staff_id is not null']).map(&:staff_id).uniq\n if exist_unit_of_staff_in_position.include?(Login.current_login.staff_id)\n current_unit = Position.find_by_staff_id(Login.current_login.staff_id).unit\n \n #replace current_unit value if academician also a Unit Leader\n current_roles=Login.current_login.roles.map(&:name)\n current_unit=unit_lead_by_academician if current_roles.include?(\"Unit Leader\") && Programme.roots.map(&:name).include?(current_unit)\n \n if current_unit==\"Pentadbiran\"\n unit_members = Position.find(:all, :conditions=>['unit=? OR unit=? OR unit=? OR unit=?', \"Kejuruteraan\", \"Pentadbiran Am\", \"Perhotelan\", \"Aset & Stor\"]).map(&:staff_id).uniq-[nil]+Position.find(:all, :conditions=>['unit=?', current_unit]).map(&:staff_id).uniq-[nil]\n elsif [\"Teknologi Maklumat\", \"Pusat Sumber\", \"Kewangan & Akaun\", \"Sumber Manusia\"].include?(current_unit) || Programme.roots.map(&:name).include?(current_unit)\n unit_members = Position.find(:all, :conditions=>['unit=?', current_unit]).map(&:staff_id).uniq-[nil]\n else #logistik & perkhidmatan inc. \"Unit Perkhidmatan diswastakan / Logistik\" or other UNIT just in case - change of unit name, eg. Perpustakaan renamed as Pusat Sumber\n unit_members = Position.find(:all, :conditions=>['unit ILIKE(?)', \"%#{current_unit}%\"]).map(&:staff_id).uniq-[nil] \n end\n else\n unit_members = []#Position.find(:all, :conditions=>['unit=?', 'Teknologi Maklumat']).map(&:staff_id).uniq-[nil]\n end\n unit_members #collection of staff_id (member of a unit/dept)\n end", "title": "" }, { "docid": "a797b207bd4ad601246f0c1f89d3841d", "score": "0.53050524", "text": "def test_username\n self.child_id.split(' ', 2).map(&:downcase).join\n end", "title": "" }, { "docid": "664a982c0d6c623bb9c159bead84236c", "score": "0.5288542", "text": "def access\n if self.read_users.present?\n \"limited\"\n elsif self.read_groups.empty?\n \"private\"\n elsif self.read_groups.include? \"public\"\n \"public\"\n elsif self.read_groups.include? \"registered\"\n \"restricted\" \n else \n \"limited\"\n end\n end", "title": "" }, { "docid": "7372e16623a37cdf29ef12731c987ac3", "score": "0.5287394", "text": "def show_admins\r\n @admins_pages, @admins = paginate(:users, \r\n :conditions => ['level = 2'],\r\n :order => 'username') \r\n end", "title": "" }, { "docid": "d11533deb1858f3a58b5504bb6abbe17", "score": "0.52744186", "text": "def index\n if session[:user_id].to_s == ''\n flash[:notice] = \"You must login to access the app...\"\n redirect_to login_path\n end\n if session[:admin].to_s == \"[true]\" and session[:user_id] != ''\n @usergroup = Usergroup.all\n @usergroup = @usergroup.order('group_name')\n end\n end", "title": "" }, { "docid": "be58c812f6a4dd7b9ea221f3d012b0ac", "score": "0.5272339", "text": "def sanitize_level\n return Sanitize::Config::BASIC if self.user.nil?\n return nil if self.user.admin?\n return Sanitize::Config::RELAXED if self.user.any_role?('editor', 'manager', 'contributor')\n Sanitize::Config::BASIC\n end", "title": "" }, { "docid": "ce7b3bf7f09c7b3c7d3a23720e96ee21", "score": "0.52700764", "text": "def username; end", "title": "" }, { "docid": "ce7b3bf7f09c7b3c7d3a23720e96ee21", "score": "0.52700764", "text": "def username; end", "title": "" }, { "docid": "ce7b3bf7f09c7b3c7d3a23720e96ee21", "score": "0.52700764", "text": "def username; end", "title": "" }, { "docid": "ce7b3bf7f09c7b3c7d3a23720e96ee21", "score": "0.52700764", "text": "def username; end", "title": "" }, { "docid": "ee982a15e76ab521693d79fdc09907ad", "score": "0.5269052", "text": "def edit_master\r\n @admin_members = ActivityMember.get_activity_admins(@activity_id)\r\n end", "title": "" }, { "docid": "cc6d1bb5e1e8909bcf5b4652f14e5fe2", "score": "0.52677405", "text": "def forum_admin?\n privilege?('User Manager')\n end", "title": "" }, { "docid": "03a08c8db1110697375d656f20361a4a", "score": "0.5267733", "text": "def build_level(user)\n shell=user_science_level(user, @shell_science_id)\n shield=user_science_level(user, @shield_science_id)\n laser=user_science_level(user, @laser_science_id)\n ionen=user_science_level(user, @ionen_science_id)\n bomb=user_science_level(user, @bomb_science_id)\n pilot=user_science_level(user, @pilot_science_id)\n spy=user_science_level(user, @spy_science_id)\n return [shell, shield, laser, ionen, bomb, pilot, spy]\n end", "title": "" }, { "docid": "0382f7e349921cfb95a0af8b4edefe4d", "score": "0.52654296", "text": "def master_username\n data[:master_username]\n end", "title": "" }, { "docid": "0382f7e349921cfb95a0af8b4edefe4d", "score": "0.52654296", "text": "def master_username\n data[:master_username]\n end", "title": "" }, { "docid": "832c471768793d0e3310d49f94283268", "score": "0.52640754", "text": "def info_for_forms\n #Info for page\n #Saving info if we are SA\n @is_super_admin = is_super?\n #Array of admins for SA\n @admins = User.admins_list(with_mentors: false) if @is_super_admin\n end", "title": "" }, { "docid": "a624d1588c880f59713bbbcf50a6bfbf", "score": "0.5263371", "text": "def check_username_uniqueness\n if self.type == 'MultiSchoolAdmin'\n h_user = self.higher_user\n if h_user.present? and h_user.type == 'MultiSchoolAdmin' #higher user is client admin only when msg is created for the first time\n user_detail = AdminUser.first(:joins=>[:school_group_user],\n :conditions=>[\"school_group_users.school_group_id=? and admin_users.username=?\",h_user.school_group_user.school_group_id,self.username])\n self.errors.add(:username,\"is already taken\") if user_detail.present?\n end\n else\n self.errors.add(:username,\"is already taken\") if AdminUser.exists?([\"admin_users.type NOT IN ('MultiSchoolAdmin') and admin_users.username=?\",self.username])\n end \n end", "title": "" }, { "docid": "0574d7bc3845b178e876572990b4ffcd", "score": "0.5262898", "text": "def is_admin?\n @level > LEVEL_PLAYER ? true : false\n end", "title": "" }, { "docid": "ac3f7a4bb75bae95d863421f7ae2322f", "score": "0.52608174", "text": "def role\n admin ? \"admin\" : \"user\"\n end", "title": "" }, { "docid": "bc7363622dc6115b09c678fab47f1954", "score": "0.52566123", "text": "def unit_members#(current_unit, current_staff, current_roles)\n #Academicians & Mgmt staff : \"Teknologi Maklumat\", \"Perpustakaan\", \"Kewangan & Akaun\", \"Sumber Manusia\",\"logistik\", \"perkhidmatan\" ETC.. - by default staff with the same unit in Position will become unit members, whereby Ketua Unit='unit_leader' role & Ketua Program='programme_manager' role.\n #Exceptional for - \"Kejuruteraan\", \"Pentadbiran Am\", \"Perhotelan\", \"Aset & Stor\" (subunit of Pentadbiran), Ketua Unit='unit_leader' with unit in Position=\"Pentadbiran\" Note: whoever within these unit if wrongly assigned as 'unit_leader' will also hv access for all ptdos on these unit staff\n\n current_staff=staff\n exist_unit_of_staff_in_position = Position.find(:all, :conditions => ['unit is not null and staff_id is not null']).map(&:staff_id).uniq\n if exist_unit_of_staff_in_position.include?(current_staff)\n\n current_unit=staff.position.unit #staff.positions.first.unit\n #replace current_unit value if academician also a Unit Leader (23)\n #current_roles=User.where(userable_id: userable_id).first.roles.map(&:name) ##\"Unit Leader\" #userable.roles.map(&:role_id)\n current_roles=roles.map(&:name)\n current_unit=unit_lead_by_academician if current_roles.include?(\"Unit Leader\") && Programme.roots.map(&:name).include?(current_unit)\n\n if current_unit==\"Pentadbiran\"\n unit_members = Position.find(:all, :conditions => ['unit=? OR unit=? OR unit=? OR unit=?', \"Kejuruteraan\", \"Pentadbiran Am\", \"Perhotelan\", \"Aset & Stor\"]).map(&:staff_id).uniq-[nil]+Position.find(:all, :conditions => ['unit=?', current_unit]).map(&:staff_id).uniq-[nil]\n elsif [\"Teknologi Maklumat\", \"Pusat Sumber\", \"Kewangan & Akaun\", \"Sumber Manusia\"].include?(current_unit) || Programme.roots.map(&:name).include?(current_unit)\n unit_members = Position.find(:all, :conditions => ['unit=?', current_unit]).map(&:staff_id).uniq-[nil]\n else #logistik & perkhidmatan inc.\"Unit Perkhidmatan diswastakan / Logistik\" or other UNIT just in case - change of unit name, eg. Perpustakaan renamed as Pusat Sumber\n unit_members = Position.find(:all, :conditions => ['unit ILIKE(?)', \"%#{current_unit}%\"]).map(&:staff_id).uniq-[nil]\n end\n else\n unit_members = []#Position.find(:all, :conditions=>['unit=?', 'Teknologi Maklumat']).map(&:staff_id).uniq-[nil]\n end\n unit_members #collection of staff_id (member of a unit/dept) - use in model/user.rb (for auth_rules)\n #where('staff_id IN(?)', unit_members) ##use in ptdo.rb (controller - index)\n end", "title": "" }, { "docid": "438a4bcd8159a3c584e15ee09099e6a7", "score": "0.5255095", "text": "def level_to_admin\r\n Admin.to_admin params[:id]\r\n redirect_to :action => 'show_admins' \r\n end", "title": "" }, { "docid": "a8c987944d346c9238ec80d480a96863", "score": "0.52529174", "text": "def master_admin\n if !current_user_master_admin?\n flash[:notice] = \"Unauthorized. Please Contact Admin\"\n redirect_to login_url\n end\n end", "title": "" }, { "docid": "3df4bca19b0af0dede8c4404ccd4c689", "score": "0.5247201", "text": "def group_admin\n @attributes[:group_admin]\n end", "title": "" }, { "docid": "b7c7cfd2a2efa1073eff15280c8c2aa4", "score": "0.5242068", "text": "def discover_groups\n super << Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED\n end", "title": "" }, { "docid": "6755057eb695f82d6cc2a5bea4b30709", "score": "0.52408063", "text": "def admin_privilages\n @reset_passwords=(admin_params[:can_reset_password]==\"1\") ? \"1\" : \"0\"\n @generate_codes=(admin_params[:can_generate_code]==\"1\") ? \"2\" : \"0\"\n @add_products=(admin_params[:can_add_product]==\"1\") ? \"3\" : \"0\"\n @add_places=(admin_params[:can_add_place]==\"1\") ? \"4\" : \"0\"\n privilages =@reset_passwords+\",\"+@generate_codes+\",\"+@add_products+\",\"+@add_places\n return privilages\n end", "title": "" }, { "docid": "41ef15182a818075118602db40ab7090", "score": "0.523822", "text": "def admin_username\n vm.os_profile.admin_username\n end", "title": "" }, { "docid": "a9c54fdf25fb7f3648da0a0c7977ef7d", "score": "0.522812", "text": "def show\r\n @webuser = Webuser.find(params[:id])\r\n @hash_level= Hash[0,\"普通用户\",1,\"收费用户\",99,\"试用用户\"]\r\n end", "title": "" }, { "docid": "9df571912d1dad729977d7adef281096", "score": "0.5220058", "text": "def permissions_level_description\n \"#{Customer.mentors_Label} in this group can view and edit #{PERMISSION_LEVELS[permissions_level.to_sym]}\"\n end", "title": "" }, { "docid": "1e9dadab4aee5867d4d14729a91e3018", "score": "0.52104485", "text": "def name\n \"#{bts} // #{login}\"\n end", "title": "" }, { "docid": "d92fcc47302efc9e7ea9fcfd02319ad3", "score": "0.5209364", "text": "def username\n end", "title": "" }, { "docid": "d1b5cb9f5edf655b244e0a7ea0250135", "score": "0.5209026", "text": "def show_details\n effective_sysadmin(@user, @role_limit)\n end", "title": "" }, { "docid": "c6add1e5b91b2c523414eb720bd384f6", "score": "0.5201237", "text": "def build_level(user)\n shell = user_science_level(user, @shell_science_id)\n shield = user_science_level(user, @shield_science_id)\n laser = user_science_level(user, @laser_science_id)\n ionen = user_science_level(user, @ionen_science_id)\n bomb = user_science_level(user, @bomb_science_id)\n pilot = user_science_level(user, @pilot_science_id)\n spy = user_science_level(user, @spy_science_id)\n return [shell, shield, laser, ionen, bomb, pilot, spy]\n end", "title": "" }, { "docid": "5ef51d071115ecca8adf3490bacfc0a0", "score": "0.52003646", "text": "def current_user_level\n current_user.level\n end", "title": "" }, { "docid": "6d7392076298c1339770f8e20029fa90", "score": "0.5200107", "text": "def info_for_new_page\n # TODO FIX BUG WHEN SAVING FAILS LINKED MENTOR IS UNSET\n @is_super_adm = is_super?\n\n if @is_super_adm\n # Loading Choosing of adm\n @admins = User.admins_list\n\n @mentors =\n if @admins.empty?\n [@admins]\n else\n User.mentors_list(@admins.first[1], additional_users: User.all_local_admins)\n end\n elsif current_user.local_admin?\n @mentors = User.mentors_list(current_user.role_model.id, additional_users: [current_user])\n end\n end", "title": "" }, { "docid": "07f568c66e203dcbfad663cb26ffe403", "score": "0.51989007", "text": "def set_level_names(levels)\n levels.each_with_index do |level, index|\n self['level_' + index.to_s + '_name'] = level\n end\n save\n end", "title": "" }, { "docid": "6de7d98fb0ec52034530cc5de6854f60", "score": "0.5198256", "text": "def display_name\n username\n end", "title": "" }, { "docid": "ac6f5df6bf46043f973baa114da52411", "score": "0.51975423", "text": "def set_breadcrumbs name\n case name \n when \"change_password\"\n add_breadcrumb \"Dashboard\", admin_root_path, :title => \"Dashboard\"\n add_breadcrumb \"Change Password\", admin_change_password_path, :title => \"Change Password\" \n else\n add_breadcrumb \"Dashboard\", admin_root_path, :title => \"Dashboard\"\n end\n end", "title": "" }, { "docid": "52dfe2fb1bcba0e94a504891889d07cf", "score": "0.519615", "text": "def isCurrentUserAdmin(id)\n\t@user = User.find(id)\n return @user.group == 1\n end", "title": "" }, { "docid": "f7f1caf9d85778adea187acf5bb3e4f8", "score": "0.51913315", "text": "def admin_id\n 9\n end", "title": "" }, { "docid": "8b861f6eed91486bd1a432f4449ffddd", "score": "0.51906335", "text": "def info_for_edit_page\n @is_super_adm = is_super?\n\n if @is_super_adm\n # Loading Choosing of adm\n @admins = User.admins_list\n\n if @admins.empty?\n @mentors = [@admins]\n else\n employee = @user.client.employee\n if employee.present?\n @admins_cur = employee.employee_id\n @mentors_cur = @user.client.employee_id\n else\n @admins_cur = params[:administrator_id]\n @mentors_cur = 0\n end\n @mentors = User.mentors_list(@admins_cur, additional_users: User.all_local_admins)\n end\n elsif current_user.local_admin?\n @mentors = User.mentors_list(current_user.role_model.id, additional_users: [current_user])\n @mentors_cur = @user.client.employee_id\n end\n end", "title": "" }, { "docid": "01cbe85e9f2f0dbd9fd47e813504772e", "score": "0.51836026", "text": "def admin?\n role= current_user ? current_user.role : \"\"\n role.upcase.split(\",\").include?(\"A\")\n rescue\n false\n end", "title": "" }, { "docid": "5dc317998c7f07e4f41d938bf54cfbb1", "score": "0.51826096", "text": "def is_organization_admin?\n #self.is_head?\n level >= USER_LEVELS[\"organization_admin\"] && level <= USER_LEVELS[\"system_admin\"]\n end", "title": "" }, { "docid": "948b8af678ce74aada33d605ab86a12f", "score": "0.5173898", "text": "def level_management_setup(data, data_id, name, level = 1)\n kendrick_experience_management_setup(data, data_id, name, level)\n @exp = @data.exp_for_level(level)\n @max_exp = @data.exp_for_level(@max_lv)\n end", "title": "" }, { "docid": "8728c3f8bf8049271c316d09a2f73412", "score": "0.5162591", "text": "def set_admin_level\n @admin_level = Admin::Level.find(params[:id])\n end", "title": "" }, { "docid": "cab682f362da1ff122bbf4b718e0afd7", "score": "0.51617414", "text": "def admin?\n @name.include?(\"@ataxo.com\")\n end", "title": "" }, { "docid": "d81757fc54634904a412475b3c078138", "score": "0.51598555", "text": "def player_names\n groups.flat_map{ |group| group.users }.map{ |user| user.login }\n end", "title": "" }, { "docid": "1d7ddc9688791a92150fc4aa9614272e", "score": "0.5155656", "text": "def student_level\n @grades=grades\n if grades<40\n level=\"D\"\n elsif grades>=40 && @grades<60\n level=\"C\"\n elsif grades>=60 && @grades<80\n level=\"B\"\n else level=\"A\"\n end\n print \"The level is \",level,\"\\n\"\n end", "title": "" }, { "docid": "fc9b5b0e8445c310af06f915fd9434d9", "score": "0.51540506", "text": "def is_admin?\n level >= USER_LEVELS[\"system_admin\"]\n end", "title": "" }, { "docid": "326f1908bc815ee605777333a21df02a", "score": "0.5148036", "text": "def name_with_difficulty_level\r\n self.name + \" - \" + self.difficulty_level\r\n end", "title": "" }, { "docid": "e9bcc317d666b74e02183f99a626e039", "score": "0.5147745", "text": "def current_user_group_name\n logged_in? ? current_user.send(self.class.current_user_group_method) : YamledAcl.guest_group_name\n end", "title": "" }, { "docid": "a3f2c63413e5ceb9b27253cf27bfcf20", "score": "0.5146277", "text": "def nest\n authorize :big_wedgie\n @patients=User.find(:all,:conditions=>{:role=>5,:hatched=>false}, :order => \"family_name,given_names\")\n render :layout=>'layouts/standard'\n end", "title": "" }, { "docid": "66900f2e508368b8d50d937c0daff97f", "score": "0.5135264", "text": "def superadmin #all admin roles need to include this method.\n role.name == \"admin\"\n end", "title": "" }, { "docid": "bf505a6a3740d14683832f1e8dd66c18", "score": "0.5135225", "text": "def admin?\n self.name == \"Keien Ohta\" or self.name == \"David Liu\" or (self.current_committee and self.current_committee.name.include? \"Exec\")\n #or self.committees.include?(Committee.where(name: \"Executive\").first)\n end", "title": "" }, { "docid": "1b0b329f64aa9ce3707603019a385c0e", "score": "0.5131609", "text": "def admin_types\n ['ProgrammeLeader']\n end", "title": "" }, { "docid": "4e6a4e232d113988e6fd4c5dfea42b12", "score": "0.51314884", "text": "def index\n @warp_user = Warp::User.find params[:user_id]\n @levels = @warp_user.levels\n #@warp_levels = Warp::Level.where user_id: @warp_user.id\n end", "title": "" } ]
d22b2d5b9fa9dab8299ccbca00df67e6
Check that current user is not an admin (i.e. is a student)
[ { "docid": "124e3e1ccc4d618390b1ee50742f9cb0", "score": "0.7720522", "text": "def non_admin_user\n if !@signed_in || current_user.sk.admin\n render 'errors/access_refused' and return\n end\n end", "title": "" } ]
[ { "docid": "56133566c3d48201530afb16121a300c", "score": "0.79185563", "text": "def is_admin_user\n not_found(\"You don't have sufficient privileges to complete that action\") if !current_signed_in_resource.is_admin?\n end", "title": "" }, { "docid": "c3b2987df08482b3765b5032a8cf099f", "score": "0.7866639", "text": "def user_is_not_admin?\n role != \"admin\"\n end", "title": "" }, { "docid": "fcc2e6dfef776655142394da123ff7d4", "score": "0.782118", "text": "def is_admin\n\t\t# I know that the quicker way to write this\n\t\t# is to check if a user is a student and return false if they are\n\t\t# and true if not (so an admin) accordingly. \n\t\t# But the enum \"user_access\" is a bit confusing\n\t\t# so I took the longer route\n\t\tif current_user.user_level == \"super_admin_access\" || current_user.user_level == \"department_admin_access\"\n\t\t\ttrue\n\t\telse \n\t\t\tfalse\n\t\tend\n\tend", "title": "" }, { "docid": "c5510ea22d268563ab2e75e6dc900455", "score": "0.7785129", "text": "def is_not_admin\n if current_user != @user and !current_user.admin?\n flash[:danger] = \"Debes loguearte \"\n render 'new'\n end\n end", "title": "" }, { "docid": "6b569fa818d30ea1714b7638697f1969", "score": "0.77525353", "text": "def isadmin\n unless current_user && current_user.admin?\n render :forbidden\n end\n end", "title": "" }, { "docid": "ff016e7e73e08e6c6945a15dbeb0b867", "score": "0.7716291", "text": "def isadmin\n unless current_user && current_user.admin?\n render :forbidden\n end\n end", "title": "" }, { "docid": "d3d63c168e400e05e3a26096143585b2", "score": "0.76687557", "text": "def is_student\n !(is_teacher||is_admin)\n end", "title": "" }, { "docid": "e7b7b8d3423cc28e35d54c7668a8e6d6", "score": "0.764047", "text": "def check_admin_only\n\t\t\n\t\tif (not @current_user.is_administrator?)\n\t\t\tredirect_to root_path, notice: \"Access Denied\"\n\t\t\treturn\n\t\tend\n\tend", "title": "" }, { "docid": "133e518bdb36c0b9f812df4aef806442", "score": "0.7602129", "text": "def unscrape?\n @user.is_admin?\n end", "title": "" }, { "docid": "8f5bd57bcb3975f66b55a390977ac9cb", "score": "0.7578956", "text": "def is_admin\n\t\t\t\traise ActiveRecord::RecordNotFound if !current_user || current_user.admin.nil?\n\t\tend", "title": "" }, { "docid": "bf1e65f0f2b51f35b64b09a91da9037b", "score": "0.7564917", "text": "def current_user_is_admin?\n !current_user.nil? && current_user.admin?\n end", "title": "" }, { "docid": "01d4581bfa5cd1f417ad1f7cf6fca409", "score": "0.75600487", "text": "def is_admin\n user = UserAdmin.find_by_user_id(current_user.id)\n unless user and user.level > 1\n redirect_to root_path, alert: \"You must be an adminstrator to access this page\"\n end\n end", "title": "" }, { "docid": "1f557b7c4d248ade0861af1d8b49aea7", "score": "0.75279903", "text": "def admin_user?\n current_user.admin != 0\n end", "title": "" }, { "docid": "48ad5749cac74dd7df63494ff62cbc78", "score": "0.75265634", "text": "def require_not_logged_in_or_admin\n if !current_user.nil?\n if !current_user.admin?\n redirect_to root_path, alert: \"Geen bevoegdheid\"\n end\n end\n end", "title": "" }, { "docid": "75ee398f018b97eb77b5db6e26644ede", "score": "0.7524617", "text": "def check_if_admin\n redirect_to root_path unless (@current_user.present? && @current_user.admin?)\n end", "title": "" }, { "docid": "a5991231246911ca95dbba96aa9591c9", "score": "0.7514349", "text": "def admin_required\n current_user.admin? || access_denied(\"You must be an admin user to access that page. Please login as an admin user.\")\n end", "title": "" }, { "docid": "6893eed41b12e0296839326627ea83be", "score": "0.7513589", "text": "def check_admin_only\n\t\t# Check permissions\n\t\tif (not @current_user.is_administrator?)\n\t\t\tredirect_to root_path, notice: \"Access Denied\"\n\t\t\treturn\n\t\tend\n\tend", "title": "" }, { "docid": "6893eed41b12e0296839326627ea83be", "score": "0.7513589", "text": "def check_admin_only\n\t\t# Check permissions\n\t\tif (not @current_user.is_administrator?)\n\t\t\tredirect_to root_path, notice: \"Access Denied\"\n\t\t\treturn\n\t\tend\n\tend", "title": "" }, { "docid": "6893eed41b12e0296839326627ea83be", "score": "0.7513589", "text": "def check_admin_only\n\t\t# Check permissions\n\t\tif (not @current_user.is_administrator?)\n\t\t\tredirect_to root_path, notice: \"Access Denied\"\n\t\t\treturn\n\t\tend\n\tend", "title": "" }, { "docid": "72fc3ea446b70554813505902f13c1e1", "score": "0.7509256", "text": "def is_admin?\n\t\t!current_user.nil? && current_user.id == 1\n\tend", "title": "" }, { "docid": "b4347a77a827caae6447c04099133fc9", "score": "0.7494949", "text": "def admin_only\n if current_user.nil? || current_user.role != \"admin\"\n no_access_notify\n end\n end", "title": "" }, { "docid": "eff69d873c23febc74c8eeb7f8a0c041", "score": "0.7488925", "text": "def is_not_admin\n if admin_logged_in?\n redirect_to courses_url\n end\n end", "title": "" }, { "docid": "03a67b076a0dda0c23c860214b7bb635", "score": "0.7487512", "text": "def check_if_admin\n if current_user.role == \"admin\" || current_user.role == \"staff\"\n else\n flash[:danger] = 'Sorry, only admins allowed!' unless current_user.role == \"admin\" || current_user.role == \"staff\"\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "c12088b0f2af909cecf3a21e56271a2b", "score": "0.7463258", "text": "def is_admin?\n if !current_user || !current_user.admin\n flash[:alert] = \"You must be an admin\"\n redirect_to movies_path\n end\n end", "title": "" }, { "docid": "52f1c4c77cdfc94883ff6c368fbed31a", "score": "0.7462657", "text": "def is_admin_user?\n false\n #is_logged_in? && (is_admin? || is_manager? || is_division_rep?)\n end", "title": "" }, { "docid": "0a8b157fc41a05572d98b884696ff60e", "score": "0.7462245", "text": "def is_admin?\n current_user ? current_user.login == \"admin\" : false\n end", "title": "" }, { "docid": "132289ae6268c2fe646667573b3ebbe4", "score": "0.74463856", "text": "def check_current_user\n unless @user == current_user or current_user.has_role?(:admin) # Only allow access to this page for the current user.\n redirect_to :back, :alert => \"Access denied.\"\n end\n end", "title": "" }, { "docid": "0ee53892157c77f658e8b51c1e2373b9", "score": "0.7440218", "text": "def current_user_is_admin?\n return current_user && current_user.id == 1\n end", "title": "" }, { "docid": "03cf806b622ca84ce082f855358aa694", "score": "0.74397814", "text": "def is_admin?\n unless Canvasking::ADMINISTRATORS.include?(current_user.email) && current_user.admin\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "9801aedb31583e60ee59cb4c634236b9", "score": "0.743632", "text": "def check_if_admin\n redirect_to(root_path) unless @current_user.is_admin?\n end", "title": "" }, { "docid": "d90c5f6923b373b631b93c2b070e646b", "score": "0.7435739", "text": "def check_if_admin\n redirect_to(root_path) unless @current_user.is_admin?\n end", "title": "" }, { "docid": "d90c5f6923b373b631b93c2b070e646b", "score": "0.7435739", "text": "def check_if_admin\n redirect_to(root_path) unless @current_user.is_admin?\n end", "title": "" }, { "docid": "5b629240263636ba387e575b84bbe626", "score": "0.7431769", "text": "def user_is_admin\n unless current_user.is_admin? || current_user.is_dock?\n user_not_authorized\n end\n end", "title": "" }, { "docid": "8d07461a0d098b68c6cd0b2d59d23df6", "score": "0.7429981", "text": "def check_admin\n unless current_user.admin?\n raise ActiveRecord::RecordNotFound\n end\n end", "title": "" }, { "docid": "5e8bab2e1f3a4510a48ce5493a51b67e", "score": "0.74261296", "text": "def user_is_admin?\n redirect_to root_path unless current_user && current_user.admin?\n end", "title": "" }, { "docid": "7cdc79e368a6fe27a24018b7de811aff", "score": "0.7426106", "text": "def admin?\n current_user && (current_user.login==MDSL_SUPER_USER) \n end", "title": "" }, { "docid": "9b64c8787e163fab1309701fbf32d01d", "score": "0.74248576", "text": "def is_admin?\n user.admin? || current_admin \n end", "title": "" }, { "docid": "26b6ee4a004f067417123f0bc69108e5", "score": "0.7424561", "text": "def must_be_admin\n unless current_user && current_user.admin?\n redirect_to root_path, notice: \"Restricted page - sorry\"\n end\n end", "title": "" }, { "docid": "217f4b6e8636b2f19504501e43d7b9fe", "score": "0.7423456", "text": "def verify_is_admin\n (current_user.nil?) ? redirect_to(new_user_session_path) : (redirect_to(new_user_session_path) unless current_user.admin?)\n end", "title": "" }, { "docid": "6ac282d5341afc0c0bde6ec8f564d2b9", "score": "0.74225914", "text": "def admin?\n @current_user.user_type == 0\n end", "title": "" }, { "docid": "ecaf53e4f7688868b6cbe291d9398e3b", "score": "0.7419234", "text": "def check_admin\n @user = find_current_user\n unless @user.present? and @user.is_admin\n redirect_to root_path\n end\nend", "title": "" }, { "docid": "2feacb838206ce85e3b147ad736a8e65", "score": "0.74172837", "text": "def is_admin\n if !current_role(Admin)\n print \"\\n\\nNot Admin\\n\\n\"\n redirect_to logout_path, :alert => \"Insufficient priviledges!\"\n end\n end", "title": "" }, { "docid": "50620f57c356c8bbab85c0dd05a83a97", "score": "0.7412577", "text": "def is_admin?(user)\n (not user.nil?) and user.user_type == 2\n end", "title": "" }, { "docid": "2d17ec469a93dd36d2e1ef2bf37e8b38", "score": "0.7397291", "text": "def check_admin?\n current_user.user_id == \"admin\" if current_user.present?\n end", "title": "" }, { "docid": "57ae27c1ce1b933bea439dfa40f37001", "score": "0.7397187", "text": "def validate_admin\n\t\t@admin = current_user\t\t\t\tif current_user.is_a? Admin\n\tend", "title": "" }, { "docid": "a4a1606acb451f3df2ab16641a6f57c1", "score": "0.7390049", "text": "def admin_required\n current_user && current_user.admin? ? true : access_denied\n end", "title": "" }, { "docid": "a224905ca89cc371253ea13a2b12fe9e", "score": "0.7384824", "text": "def verify_admin\n unless current_user && current_user.admin_role\n redirect_to user_path(current_user), alert:'inaccessible'\n end\n end", "title": "" }, { "docid": "a79474ec78ad2247191ae9c732d461bd", "score": "0.73847157", "text": "def is_admin_user\n if current_user != :false\n if current_user.role == \"Admin\"\n return true\n else\n access_denied\n end\n else\n access_denied\n end\n end", "title": "" }, { "docid": "406a41013142526d7c889d7a0d448f20", "score": "0.737799", "text": "def logged_in_as_admin?\n not current_user.nil? and current_user.is_a? Admin\n end", "title": "" }, { "docid": "4cf158787b6487cdb78b67c9e31816e3", "score": "0.7372288", "text": "def current_user_admin\n #if \"admin\".casecmp(current_user.user_class)\n if current_user.user_class == \"admin\"\n return true\n end\n end", "title": "" }, { "docid": "4e791b164df5a4746e128e26388e3796", "score": "0.7372236", "text": "def require_current_user_or_admin\n if !current_user.admin\n redirect_to home_path, :notice => 'Only administrators may edit other people\\'s user accounts' unless current_user.id == params[:id].to_i\n end\n end", "title": "" }, { "docid": "ac1a0afa76f70a9b0c978fec0953c308", "score": "0.7370887", "text": "def is_admin?\n\t\t\tnot current_user.nil? and current_user.is_a? Admin\n\t\tend", "title": "" }, { "docid": "b715df5ee863c0ed60f3311231d230b9", "score": "0.7363954", "text": "def is_admin?\n !current_user.nil? && current_user.role.class == Sap::Admin\n end", "title": "" }, { "docid": "a288519c8ddcf04a043c568ef2fb35f1", "score": "0.7363071", "text": "def only_admin\n redirect_to '/advising' unless !is_student\n end", "title": "" }, { "docid": "6dca60c38d330b013161f02e7500d1d7", "score": "0.7362198", "text": "def is_admin?\n unless current_user.admin?\n flash[:alert] = 'you can not access this rute'\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "6dca60c38d330b013161f02e7500d1d7", "score": "0.7362198", "text": "def is_admin?\n unless current_user.admin?\n flash[:alert] = 'you can not access this rute'\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "7457c6c5207618422f00212ff746dd6f", "score": "0.7359192", "text": "def check_admin\n unless user_signed_in? && current_user.admin?\n abort()\n end\n end", "title": "" }, { "docid": "f8af0a5d3e3573475fb970c6aa866f3f", "score": "0.7357902", "text": "def is_admin?\n if current_user.try(:admin)\n true\n else\n flash[:error] = \"WHAT ARE YOU DOING HERE ? ACCESS DENIED.\"\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "1993cd9e7128ed497cac5d3eabcdd136", "score": "0.735542", "text": "def check_for_admin\n if current_user && User.first == User.last\n unless current_user.has_role? :admin\n current_user.add_role :admin\n end\n end\n end", "title": "" }, { "docid": "6085d270181deb7a332f521d1db8d221", "score": "0.73547167", "text": "def admin?\n !current_user.nil? && !current_user.is_a?(Symbol) && current_user.role && current_user.role.name=='admin'\n end", "title": "" }, { "docid": "0b6fc842c690f8e03604ddf8ef315daf", "score": "0.7352167", "text": "def admin_only\n # if the currently logged user has an admin role, let them continue.\n if current_user.has_role? :admin\n # if the user is not an admin, redirect them to the root path and display a denied alert.\n else\n flash[:alert] = \"You are not authorised to carry out this action.\"\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "0882b3f071b9d0da296e5b2db33c7918", "score": "0.73438185", "text": "def do_not_destroy_admin_user\n if @user and @user.is_the_administrator?\n redirect_to :action => 'list' and return false\n end\n end", "title": "" }, { "docid": "2a0bb7881c11feef0c28b88c2df6a38c", "score": "0.73417926", "text": "def is_user_admin\n unless current_user.isadmin?\n flash[:notice] = 'You do not have privileges for this page.'\n redirect_to :authenticated_root\n end\n end", "title": "" }, { "docid": "6ad2ebbab8819660c2f4ebac0c9b687e", "score": "0.73371685", "text": "def is_admin?\n if(current_user == nil)\n return false\n else\n current_user.name == \"admin\" or current_user.name == \"administrator\"\n end\n end", "title": "" }, { "docid": "8d423fa81caf2ebaf1fcebd54a784edc", "score": "0.7334483", "text": "def isadmin\n unless current_user.user_type == \"admin\"\n redirect_to home_url\n end \n end", "title": "" }, { "docid": "5f1cc71052d195e16a260a08bac79c8d", "score": "0.73323184", "text": "def check_admin?\n unless logged_in? && !current_user.nil? && current_user.role_id == 1\n flash[:error] = \"<b>Action denied.</b><p>This action is restricted to Administrators.</p>\"\n redirect_to login_url\n end\n end", "title": "" }, { "docid": "bbb799e32c5cae3d504d718fbf5de701", "score": "0.7330554", "text": "def is_admin?\n redirect_to(root_url) unless (current_user && current_user[:is_admin])\n end", "title": "" }, { "docid": "e3b87f0782e32cf6c172af460056871e", "score": "0.7330259", "text": "def is_admin()\n @user = current_user if current_user.admin == true;\n end", "title": "" }, { "docid": "3d6418be927f9eee0acf3f556081076d", "score": "0.73244053", "text": "def only_for_admin_user\n if !(is_admin_user?)\n redirect_to :action =>'error_403', :controller => 'errors'\n end\n end", "title": "" }, { "docid": "2e96b2e8b9aab4d0cd14044ba12e415f", "score": "0.73093075", "text": "def admin?\n\t\t\tcurrent_user && current_user.username == \"admin\"\n\t\tend", "title": "" }, { "docid": "03f6536104c8f5874af79f1eca60bd37", "score": "0.7302352", "text": "def is_admin?\n current_user.try(:admin?)\n end", "title": "" }, { "docid": "7faadd755008c79338dce5438ef97f86", "score": "0.72992635", "text": "def admin_check\n\t\t\tif @current_user.admin != true\n\t\t\t\tshow_error(\"You are not allowed to do that.\")\n\t\t\t\tredirect_to \"/\"\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "044fb93ec5b45dcad865181eec96fd63", "score": "0.7294225", "text": "def is_admin?\n return (!current_user.nil? && current_user.is_admin?)\n end", "title": "" }, { "docid": "ad02a903dac8384ba9d2037b6ef3af82", "score": "0.72940207", "text": "def is_admin\n unless @current_user.is_admin\n flash[:error] = t(:must_be_admin)\n redirect_to root_path\n return false\n end\n end", "title": "" }, { "docid": "77030a18fecde3b5f6d8ee03e6b35b6d", "score": "0.72889346", "text": "def restrict_to_admin\n if !current_user.admin?\n flash[:notice] = \"You are not authorized to view that page.\"\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "c0e9a61826895eda8356fcb35350cc65", "score": "0.72861344", "text": "def current_user_admin?\n\t\tif !current_user\n\t\t\tfalse\n\t\telse\n\t\t\tcurrent_user.admin?\n\t\tend\n\tend", "title": "" }, { "docid": "d23ed928b03832a503a621183bea8bd6", "score": "0.7279083", "text": "def admin?\n current_user.class.name == 'User'\n end", "title": "" }, { "docid": "0f7f530e23cb45e01dff6da262a0aef6", "score": "0.72782964", "text": "def check_admin\n non_admin_cant(request.fullpath) unless is_admin?\n end", "title": "" }, { "docid": "7d31138987499b8fbafda802f77ae84e", "score": "0.7269734", "text": "def current_user?(admin_admin)\n admin_admin == current_user\n end", "title": "" }, { "docid": "a715134ef3c8d68b860a85e99892702a", "score": "0.726971", "text": "def verify_is_admin\n (current_user.nil?) ? redirect_to(root_path) : (redirect_to(root_path) unless current_user.admin?)\n\tend", "title": "" }, { "docid": "b5e53cc47ee01859283c35614957a9f1", "score": "0.72695255", "text": "def verify_is_admin\n (current_user.nil?) ? redirect_to(root_path) : (redirect_to(root_path) unless current_user.is_admin)\n end", "title": "" }, { "docid": "0014d2787e098bc79972f9f43b00e254", "score": "0.7269212", "text": "def is_admin?\n\t\tno_permission_redirection unless self.current_user && self.current_user.has_system_role('admin')\n end", "title": "" }, { "docid": "35e480bbd12ec6084106b061e435e415", "score": "0.72662336", "text": "def admin_only\n if !Volt.current_user.admin\n redirect_to '/login'\n end\n end", "title": "" }, { "docid": "bb6253ab871820524d81706fca22aec7", "score": "0.72648966", "text": "def admin\n current_user.admin? ? true : access_denied\n end", "title": "" }, { "docid": "4226b0afa8b587b62b0da4ff4f840427", "score": "0.7261153", "text": "def is_admin?\n current_user && current_user.starts_with?('admin')\n end", "title": "" }, { "docid": "5bb99aca5a0e6ff2c9a113252d9b64a5", "score": "0.7257946", "text": "def is_admin?\n \tif current_user.nil? || current_user.role != \"admin\"\n \tredirect_to \"/\"\n end\n end", "title": "" }, { "docid": "3e72d9541093acab694969a5bd3540ea", "score": "0.72538114", "text": "def is_admin\n @team = Team.find(params[:id])\n if !current_user?(User.find(@team.admin_id))\n flash[:danger] = \"You have no right to access this page!\"\n redirect_to(root_url)\n end\n end", "title": "" }, { "docid": "58cbcd4e1065e88511e548eafe5c0212", "score": "0.7251183", "text": "def check_admin\n redirect_to user_root_path unless current_user[:role] == 'admin'\n end", "title": "" }, { "docid": "241b9fa85ecc7e1acb2a3709f7732231", "score": "0.724659", "text": "def require_admin\n #If current logged in user is not admin\n if logged_in? and !current_user.admin\n #Display message\n flash[:danger] = \"Only admin users can perform that action\"\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "8a3d84c65100412edd8edca3d77ec4bb", "score": "0.72461617", "text": "def admin_only\n return true if admin_user?\n admin_access_denied\n end", "title": "" }, { "docid": "a30e5b2986589b8f8826493888022395", "score": "0.72456306", "text": "def admin?(user)\n user.admin.nil? == false\n end", "title": "" }, { "docid": "383eecb84d8914653993434222d25149", "score": "0.7242183", "text": "def admin?\n\t\tcurrent_user.admin\t\n\tend", "title": "" }, { "docid": "43405a2e2fb4a009d58c678e1ea4ef83", "score": "0.7239638", "text": "def admin?\n u = current_user\n if u.nil? or u == false\n return nil\n else\n return u.admin?\n end\n end", "title": "" }, { "docid": "71a1ef754369ce4e58de63ef206f3964", "score": "0.72334427", "text": "def admin?\n result = false\n if current_user != nil && ADMIN_ID == current_user.id.to_s\n result = true\n end\n result\n end", "title": "" }, { "docid": "69f44a4961f4ad92b3c73c42d05cb3a9", "score": "0.72297704", "text": "def is_admin?\n # current_user.admin \n current_user.try(:admin?)\n end", "title": "" }, { "docid": "7a3054b85842de72e3d2a103fa4c1e75", "score": "0.72284096", "text": "def check_admin\n unless current_user.admin?\n redirect_to root_path\n end \n end", "title": "" }, { "docid": "4f8bdddc98f3b292cb9ada15bf470d9e", "score": "0.72283185", "text": "def is_student\n unless current_user.role < 5\n redirect_to root_path, alert: \"You must be a student to use this page\"\n end\n end", "title": "" }, { "docid": "21634846d7566c1952b834c5b13ada17", "score": "0.72270095", "text": "def admin_required\n (logged_in? && current_user.role == Role.find_by_name('Admin')) || admin_denied\n end", "title": "" }, { "docid": "ceda8486d7fd80d1369651145f9ac9f8", "score": "0.72242045", "text": "def admin_only\n\t\tif !current_user.admin?\n\t\t\tredirect_to root_path\n\t\tend\n\tend", "title": "" }, { "docid": "e2111757dff32f0eb3af56a4bb02b8df", "score": "0.7223195", "text": "def admin_in!\n access_denied! unless current_user.admin?\n end", "title": "" } ]
c54c65248fe4d452ed0b59cef85ec973
can override this method to skip or change certain column declarations
[ { "docid": "a226277809c7f569106006aab170087b", "score": "0.0", "text": "def autoreport_column(column)\n return if column.name == report_model.primary_key\n\n name, reflection = report_model.reflections.find { |_, reflection| reflection.foreign_key == column.name }\n case\n when reflection.present?\n column_name = (reflection.klass.column_names & autoreport_association_name_columns(reflection)).first\n if column_name.present?\n category_dimension name, expression: \"#{reflection.klass.table_name}.#{column_name}\", relation: ->(r) { r.joins(name) }\n else\n category_dimension column.name\n end\n when %i[datetime timestamp time date].include?(column.type)\n time_dimension column.name\n when %i[integer float decimal].include?(column.type)\n number_dimension column.name\n else\n category_dimension column.name\n end\n end", "title": "" } ]
[ { "docid": "701eaad1f52b775c74439fc0d9a80ebf", "score": "0.79129964", "text": "def ignored_columns; end", "title": "" }, { "docid": "d91606483ecb357b3f3febcdf3541210", "score": "0.7316791", "text": "def reset_column_information\n @columns_except_type = nil\n super\n end", "title": "" }, { "docid": "4f667db6f550acbf944aa2e8c79c451a", "score": "0.716996", "text": "def column_definitions\n end", "title": "" }, { "docid": "fd4554f91df27257cf3f57127197404a", "score": "0.70860755", "text": "def reset_column_information\n generated_methods.each { |name| undef_method(name) }\n @column_names = @columns_hash = @content_columns = @dynamic_methods_hash = @read_methods = @inheritance_column = nil\n @@columns.delete(table_name)\n end", "title": "" }, { "docid": "910e84ddb6259930490aafbec0e2a9f9", "score": "0.7007804", "text": "def reset_column_information\r\n generated_methods.each { |name| undef_method(name) }\r\n @column_names = @columns_hash = @content_columns = @dynamic_methods_hash = @read_methods = nil\r\n end", "title": "" }, { "docid": "2176b8d1572b88c67100199248591681", "score": "0.70028585", "text": "def reset_column_information\r\n columns = @columns\r\n super\r\n @columns = columns\r\n end", "title": "" }, { "docid": "b45ea9e0373570968739318c6d4bd4e4", "score": "0.6992769", "text": "def reset_column_information\n\tcolumns = @columns\n\tsuper\n\t@columns = columns\n end", "title": "" }, { "docid": "47bc883b38b9ba78e21b8d6db84bb901", "score": "0.69315654", "text": "def set_skip_saving_generated_columns\n return if @_skip_saving_columns_no_override\n s = []\n db_schema.each do |k, v|\n s << k if v[:generated] \n end\n @skip_saving_columns = s.freeze\n nil\n end", "title": "" }, { "docid": "4016e55e0141dbd8b1e4103909793be0", "score": "0.6924541", "text": "def defined_columns\n load_columns_from_db unless @columns_from_db_loaded\n super\n end", "title": "" }, { "docid": "baaaf78e8c84236aceeb8237079a2a97", "score": "0.6908037", "text": "def whitelist\n @columns = []\n end", "title": "" }, { "docid": "8b592131839eba650bbcc6d22e071fe6", "score": "0.68932104", "text": "def ignored_columns\n @ignored_columns || superclass.ignored_columns\n end", "title": "" }, { "docid": "bb99eb69eee5e90bd4f21eb0430a0b37", "score": "0.6799964", "text": "def _save_update_all_columns_hash\n _save_removed_skipped_columns(super)\n end", "title": "" }, { "docid": "9cef51ea5b64287de4f638ab75d5e32e", "score": "0.67845243", "text": "def row_skipped_columns\n super + SKIPPED_FIELDS\n end", "title": "" }, { "docid": "fa89c86269e141a9d06bc7acf14b052d", "score": "0.6769541", "text": "def column_definitions(table_name); end", "title": "" }, { "docid": "b5b603f99535a1c1ee733476551461ac", "score": "0.6753295", "text": "def reset_column_information\n generated_methods.each { |name| undef_method(name) }\n @column_names = @columns_hash = @content_columns = @dynamic_methods_hash = @generated_methods = nil\n end", "title": "" }, { "docid": "85f4e9a0ec37d48c4e823f59c507dcad", "score": "0.67366207", "text": "def columns\n super.reject { |column| column.name == \"code\" }\n end", "title": "" }, { "docid": "c8e7a7262677f0adb20d3cd2f0be3832", "score": "0.6689066", "text": "def columns=(_); end", "title": "" }, { "docid": "9d57941d9f1d23914dca4395d1211ad5", "score": "0.6679007", "text": "def skip_saving_columns=(v) \n @_skip_saving_columns_no_override = true\n @skip_saving_columns = v.dup.freeze\n end", "title": "" }, { "docid": "a3839d999d562ea4a55718f739fffa07", "score": "0.66713136", "text": "def _save_update_changed_colums_hash\n _save_removed_skipped_columns(super)\n end", "title": "" }, { "docid": "c3572876017287c57790d342aa9f347e", "score": "0.66521204", "text": "def remake_columns\n\t\t@columns=@keys_to_show+@all_columns-@keys_to_ignore\n\tend", "title": "" }, { "docid": "27bf8eefdd6a857c88d77fc64bd5ced2", "score": "0.6634668", "text": "def columns\n super + [:extra_column]\n end", "title": "" }, { "docid": "54fe8b72821e5012a63e6e997653b7d8", "score": "0.66287434", "text": "def columns(table_name, name = nil)\r\n commit_db_transaction\r\n super(table_name, name)\r\n end", "title": "" }, { "docid": "7ce903d82fc8c4fde475706bf6bb75da", "score": "0.65993905", "text": "def columns_allowed\n columns_default + ['description','created_at','updated_at']\n end", "title": "" }, { "docid": "9c3a595c780d89e1097729213d870f97", "score": "0.65561336", "text": "def columns(table_name, name = nil) end", "title": "" }, { "docid": "9c3a595c780d89e1097729213d870f97", "score": "0.65561336", "text": "def columns(table_name, name = nil) end", "title": "" }, { "docid": "358d4080177b354b7cabbee4201170e0", "score": "0.6521263", "text": "def freeze\n @allowed_columns.freeze\n super\n end", "title": "" }, { "docid": "49a6fbc75dcf841c636f04c7e921f384", "score": "0.6511588", "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": "ae37880a3526b8ef01b3daf9ce5a4f4f", "score": "0.64921874", "text": "def ignore_columns(*columns)\n self.ignored_columns ||= []\n self.ignored_columns += columns.map(&:to_s)\n reset_column_information\n descendants.each(&:reset_column_information)\n self.ignored_columns.tap(&:uniq!)\n end", "title": "" }, { "docid": "71751f3c61bc206e4c7b7913c1395987", "score": "0.64856064", "text": "def set_skipped_string_nilifying_columns\n if @db_schema\n blob_columns = @db_schema.map{|k,v| k if v[:type] == :blob}.compact\n skip_string_nilifying(*blob_columns)\n end\n end", "title": "" }, { "docid": "87cd0757116c065c6ead2c8ae7d4c33c", "score": "0.647318", "text": "def freeze\n @pg_typecast_on_load_columns.freeze\n\n super\n end", "title": "" }, { "docid": "1bcba8654d103049ee975e960b7baf00", "score": "0.6458082", "text": "def add_columns(transaction, table_name, columns)\n Kernel.raise NotImplementedError\n end", "title": "" }, { "docid": "87b524a2ab4f577df4ece5e160439563", "score": "0.6451927", "text": "def column_defaults; end", "title": "" }, { "docid": "bc0bf1b62db061ee6e031113f7ae86ea", "score": "0.6448939", "text": "def grid_row_skipped_columns\n super + HIDDEN_FIELDS\n end", "title": "" }, { "docid": "4b59a3fa96e29894a2b032d4843d77a4", "score": "0.6444019", "text": "def added_columns\n attribute_names_plus.reject{|name| column_names.include?(name)}\n rescue ActiveRecord::StatementInvalid\n attribute_names_plus\n end", "title": "" }, { "docid": "b9d0f67497710316c39257643deda2c1", "score": "0.64342576", "text": "def set_revisable_columns(options)\n return unless self.versioned_columns.blank?\n return self.versioned_columns = [] if options[:except] == :all\n return self.versioned_columns = [options[:only]].flatten.map(&:to_s).map(&:downcase) unless options[:only].blank?\n\n except = [options[:except]].flatten || []\n #don't version some columns by default\n except += %w(created_at created_on updated_at updated_on) unless options[:timestamps]\n self.versioned_columns ||= (column_names - except.map(&:to_s)).flatten.map(&:downcase)\n end", "title": "" }, { "docid": "65556f5eaa301215aaa06d72556f6291", "score": "0.6419659", "text": "def default_columns\n @model.column_names - Outpost.config.excluded_list_columns\n end", "title": "" }, { "docid": "134af1a5c932f8081ee0d24734aea3cf", "score": "0.63939804", "text": "def reset_column_information\n out = super\n _low_card_row_manager.column_information_reset!\n out\n end", "title": "" }, { "docid": "7289b4db9a5fa6b9fa60432be65d365e", "score": "0.6393544", "text": "def column_types; end", "title": "" }, { "docid": "d5a789ecc6ceec770ed516dff79ddbcc", "score": "0.6383834", "text": "def column_definitions(table_name) # :nodoc:\n # TODO: settle on schema, I think we've switched to attributes, so\n # columns can be removed soon?\n definition(table_name)['attributes'] || definition(table_name)['columns']\n end", "title": "" }, { "docid": "dc517a1f80ea58022ef5fe2536b78c09", "score": "0.63836604", "text": "def columns(table_name); end", "title": "" }, { "docid": "dc517a1f80ea58022ef5fe2536b78c09", "score": "0.63836604", "text": "def columns(table_name); end", "title": "" }, { "docid": "a515307ca40cc96978ceb989b17b280c", "score": "0.63651526", "text": "def prepare_column_specs\n column_specs.select do |col|\n col[:action] == 'new_field'\n end.map do |col|\n field_guid = Guid.new.to_s\n col[:field] = field_guid\n TableFields::Local.new col[:name], field_guid, ''\n end\n end", "title": "" }, { "docid": "582bba2ad478db117e5ebb5e28f27b59", "score": "0.63477784", "text": "def freeze\n @restricted_columns.freeze\n\n super\n end", "title": "" }, { "docid": "9d7a676c59dbb1f300e6ae9a43597d85", "score": "0.6338264", "text": "def create_missing_columns\n return false unless config.create_missing_fields?\n if missing = missing_columns.empty? || @_columns_checked\n @_columns_checked = true unless @_columns_checked\n return true\n end\n BlockStack::Models::SQL.processing_model(self)\n db.alter_table(dataset_name) do\n missing = BlockStack::Models::SQL.processing_model.missing_columns\n BlockStack.logger.info(\"Attempting to create #{BBLib.plural_string(missing.size, 'missing column')}.\")\n BlockStack::Models::SQL.processing_model.attr_columns.each do |column|\n next unless missing.include?(column[:name])\n BlockStack.logger.info(\"Adding missing column #{column[:name]} [#{column[:type]}]#{column[:options].empty? ? nil : \"(#{column[:options].map { |k, v| \"#{k}: #{v}\" }.join(', ')})\"}\")\n add_column(column[:name], column[:type], column[:options])\n end\n end\n missing.each do |column|\n attr_data = attr_columns.find { |col| col[:name] == column }\n next unless attr_data && !attr_data[:default].nil?\n dataset.update(SQL.serialize_sql(column => attr_data[:default]))\n end\n true\n end", "title": "" }, { "docid": "68ea5df63c480ba1cffbf13427a0f459", "score": "0.6328628", "text": "def skip_column_header=(value)\n @config.set('library.skip_column_header', value)\n end", "title": "" }, { "docid": "0e0e2ac6f02c17cf5bbe27b8e440074a", "score": "0.63265944", "text": "def columns(table_name, name = nil)\n# log(\"into columns for #{table_name}. use slave? #{@config[:use_slaves_for_meta]}\", \"column\")\n if @config[:use_slaves_for_meta] \n load_balance_query { super }\n else\n super\n end\n end", "title": "" }, { "docid": "892bef4298e73df5a46f1f1414a006b3", "score": "0.63225335", "text": "def columns(table)\n raise NotImplementedError\n end", "title": "" }, { "docid": "39215033d174773641549ed48bdea6e3", "score": "0.6311825", "text": "def columns(table_name) end", "title": "" }, { "docid": "9e31fbff2af4caf01da2af7df093d884", "score": "0.6311467", "text": "def set_column_types!\n result = connection.exec(\"SELECT * FROM #{@table_name} LIMIT 1\")\n (0...result.num_fields).each do |i|\n column_name = result.fields[i]\n column_types[column_name] = Postgresina::Connection::TYPE_MAP[\n Postgresina::Connection::TYPES[result.ftype(i)]\n ]\n self.class_eval <<-RUBY\n def #{column_name}; instance_variable_get(\"@#{column_name}\"); end\n def #{column_name}=(v); instance_variable_set(\"@#{column_name}\", v); end\n RUBY\n end\n end", "title": "" }, { "docid": "95354c1c51937cbdebd63230fe0116af", "score": "0.63050747", "text": "def columns(table_name)\n # Limit, precision, and scale are all handled by the superclass.\n column_definitions(table_name).map do |column_name, options|\n new_column(column_name, options)\n end\n end", "title": "" }, { "docid": "e445d1ab577960e651c9b2488710d6e1", "score": "0.6299218", "text": "def column_definitions(table_name) #:nodoc:\n query <<-end_sql\n SELECT a.attname, format_type(a.atttypid, a.atttypmod), #{adsrc_expr('d')}, a.attnotnull\n FROM pg_attribute a LEFT JOIN pg_attrdef d\n ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n WHERE a.attrelid = '#{quote_table_name(table_name)}'::regclass\n AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n end_sql\n end", "title": "" }, { "docid": "1bfa86759f27d0ca6a58b6c18e269e7a", "score": "0.62927544", "text": "def _insert_values\n _save_removed_skipped_columns(Hash[super])\n end", "title": "" }, { "docid": "33b9fb583eb6f9238506ddc3feb2a657", "score": "0.6291133", "text": "def table_columns_to_observe\n @table_columns_to_observe ||= AdminActivityChangeLogger::TABLE_ALLOWED_KEYS_MAPPING[table_name][:columns]\n end", "title": "" }, { "docid": "9834b0cb17c588b04bb64237450fd29e", "score": "0.6289062", "text": "def load_schema!\n @columns_hash = connection.schema_cache.columns_hash(table_name).except(*ignored_columns)\n ####+++\n @columns_hash_uncasted = @columns_hash.map do |k, v|\n nk = if column_castings.key(k).present?\n column_castings.key(k)\n else\n k\n end\n nv = v.dup\n nv.instance_variable_set :@name, nk\n [nk, nv]\n end.to_h if column_castings.present?\n ###\n @columns_hash.each do |name, column|\n define_attribute(name,\n connection.lookup_cast_type_from_column(column),\n default: column.default,\n user_provided_default: false)\n end\n end", "title": "" }, { "docid": "16a110e96e4ac924348866ac3a32d407", "score": "0.62850046", "text": "def columns=(_arg0); end", "title": "" }, { "docid": "48f55a563e827c0bfed54b56a4528330", "score": "0.6273977", "text": "def reset_columns\n\t\t\t@columns = []\n\t\tend", "title": "" }, { "docid": "815b817c0bf5f2a540e2758f21f600cc", "score": "0.6267641", "text": "def allow_insert_columns=(value)\n @allow_insert_columns = value\n end", "title": "" }, { "docid": "60faaef92baa99926ed17dee6e74886f", "score": "0.62673795", "text": "def column_names; end", "title": "" }, { "docid": "78eed30ffe486cd93dbdd36c594a63f3", "score": "0.62430966", "text": "def columns(columns); end", "title": "" }, { "docid": "21397c5c5a6ff100f52923aceb28fb67", "score": "0.6230411", "text": "def mark_used_columns\n sql_bind_variables.each { |col, value| mark_as_used(col) unless value.nil? }\n end", "title": "" }, { "docid": "022f4ad1c458c7f96d59451bfb910fcc", "score": "0.6223927", "text": "def columns\n @columns ||= add_user_provided_columns(connection.schema_cache.columns(table_name))\n end", "title": "" }, { "docid": "9e974bc8788c5b0d7bbc2e8092e994d4", "score": "0.62222713", "text": "def set_dataset(*)\n super\n set_skipped_string_stripping_columns\n end", "title": "" }, { "docid": "b632525a40bc93aacd2a47383d9567ac", "score": "0.6217524", "text": "def non_audited_columns\n @non_audited_columns ||= audited_options[:only].present? ?\n column_names - audited_options[:only] :\n default_ignored_attributes | audited_options[:except]\n end", "title": "" }, { "docid": "9bc98ebbdaaf5c7a7f1781ea09cacf54", "score": "0.619699", "text": "def set_skipped_string_stripping_columns\n if @db_schema\n blob_columns = @db_schema.map{|k,v| k if v[:type] == :blob}.compact\n skip_string_stripping(*blob_columns)\n end\n end", "title": "" }, { "docid": "9bc98ebbdaaf5c7a7f1781ea09cacf54", "score": "0.619699", "text": "def set_skipped_string_stripping_columns\n if @db_schema\n blob_columns = @db_schema.map{|k,v| k if v[:type] == :blob}.compact\n skip_string_stripping(*blob_columns)\n end\n end", "title": "" }, { "docid": "60124c0cfe034f62eb065305876c2547", "score": "0.61902493", "text": "def optional_columns\n nice_col_names(PossibleColumns - RequiredColumns)\n end", "title": "" }, { "docid": "b882283fe06483da3e84e829c6787970", "score": "0.61891985", "text": "def columns(table_name)\n # Limit, precision, and scale are all handled by the superclass.\n column_definitions(table_name).map do |column_name, type, default, notnull, oid, fmod, collation|\n oid = oid.to_i\n fmod = fmod.to_i\n type_metadata = fetch_type_metadata(column_name, type, oid, fmod)\n default_value = extract_value_from_default(default)\n default_function = extract_default_function(default_value, default)\n new_column(column_name, default_value, type_metadata, !notnull, default_function, collation)\n end\n end", "title": "" }, { "docid": "747f64f9f1aca00805d9e1d71081b29e", "score": "0.61879444", "text": "def allow_insert_columns\n return @allow_insert_columns\n end", "title": "" }, { "docid": "98731ea4627b66e44f016546a83129e9", "score": "0.6185855", "text": "def available_columns\n super\n\n index_tyear = @available_columns.find_index {|column| column.name == :tyear}\n\n # Already overriden\n return @available_columns if index_tyear\n\n ################\n # Smile Specific #379708 Liste entrées de temps : colonne semaine\n\n index = @available_columns.find_index {|column| column.name == :tweek}\n\n # + TYEAR\n # spent_on_column = base.available_columns.detect{|c| c.name == :spent_on}\n @available_columns.insert (index + 1), QueryColumn.new(:tyear,\n :sortable => [\"#{TimeEntry.table_name}.spent_on\", \"#{TimeEntry.table_name}.created_on\"],\n :groupable => true,\n :caption => l(:label_year)\n )\n\n # + TMONTH\n @available_columns.insert (index + 1), QueryColumn.new(:tmonth,\n :sortable => [\"#{TimeEntry.table_name}.spent_on\", \"#{TimeEntry.table_name}.created_on\"],\n :groupable => true,\n :caption => l(:label_month)\n )\n\n # + WDAY\n @available_columns.insert (index + 1), QueryColumn.new(:wday,\n :sortable => [\"#{TimeEntry.table_name}.spent_on\", \"#{TimeEntry.table_name}.created_on\"],\n :groupable => true,\n :caption => l(\"datetime.prompts.day\")\n )\n\n # TWEEK : groupable\n tweek_column = @available_columns.detect{|c| c.name == :tweek}\n\n if tweek_column\n tweek_column.groupable = \"#{TimeEntry.table_name}.tyear || '-' || #{TimeEntry.table_name}.tweek\"\n end\n # END -- Smile Specific #379708 Liste entrées de temps : colonne semaine\n #######################\n\n @available_columns\n end", "title": "" }, { "docid": "fd765bbe0136b972e3cb9e7754de156f", "score": "0.61857927", "text": "def extended_with_exceptions\n columns - (@parent.column_names | exclude_always)\n end", "title": "" }, { "docid": "106da5121d0bc24a20e83664fb2809d1", "score": "0.6185023", "text": "def freeze\n @prepared_statements_column_defaults.freeze if @prepared_statements_column_defaults\n\n super\n end", "title": "" }, { "docid": "a6e3300fb3f1e20888f48c13ef856255", "score": "0.61814266", "text": "def column_definition_sql(column)\n column.delete(:default) if column[:type] == File || (column[:type] == String && column[:text] == true)\n super\n end", "title": "" }, { "docid": "a2a19d8f0f0dab3e800321d604e742af", "score": "0.61805904", "text": "def column_info; end", "title": "" }, { "docid": "199bb0a7953658d518a37bf7219ede1f", "score": "0.61737347", "text": "def real_column; end", "title": "" }, { "docid": "7c313e7cc8fbb4b72ba90e01eff87571", "score": "0.61732596", "text": "def col_names_for_insert \n self.class.column_names.delete_if { |col| col == \"id\"}.join(\", \") #=> \"name, grade\"\n end", "title": "" }, { "docid": "7264888d08fec7588cc0f8d0b7dab9a9", "score": "0.61697125", "text": "def columns_for_select\n @columns_for_select || begin\n qualify_columns = qualify_columns?\n @columns_for_select = []\n \n i = 0\n columns.each do |column|\n class_for_loader = column.table.klass\n @loaders[class_for_loader].add_column(column, i) if class_for_loader\n @columns_for_select << column.to_sql(qualify_columns)\n i += 1\n end\n \n @columns_for_select\n end\n \n end", "title": "" }, { "docid": "fd903f9af2ecf95e9d862fb2e212b0a7", "score": "0.61695224", "text": "def change_column_null(table_name, *)\n return super unless is_chrono?(table_name)\n _on_temporal_schema { super }\n end", "title": "" }, { "docid": "fd903f9af2ecf95e9d862fb2e212b0a7", "score": "0.61695224", "text": "def change_column_null(table_name, *)\n return super unless is_chrono?(table_name)\n _on_temporal_schema { super }\n end", "title": "" }, { "docid": "909bbca9ecb26474a4f35b71e3895b51", "score": "0.61668324", "text": "def set_allowed_columns(*cols)\n @allowed_columns = cols\n end", "title": "" }, { "docid": "a6f40d8180d9649b4113b1627f3e04d3", "score": "0.61635536", "text": "def column_names\n raise NotSupportedError\n end", "title": "" }, { "docid": "88b2915516bd7e808b8ebb56b5031a3c", "score": "0.616277", "text": "def optional_columns=(optionals)\n @optional_columns= Array(optionals)\n end", "title": "" }, { "docid": "1a84c1b1460887cdcab687edb1ff593d", "score": "0.6156272", "text": "def column_list_sql(g)\n ks = []\n g.constraints.each{|c| ks = c[:columns] if [:primary_key, :unique].include?(c[:type])} \n g.columns.each{|c| c[:null] = false if ks.include?(c[:name]) }\n super\n end", "title": "" }, { "docid": "5f3cefcfdc45037801ce34b106974d51", "score": "0.61558735", "text": "def columns(table_name)\n # Limit, precision, and scale are all handled by the superclass.\n column_definitions(table_name).map do |column_name, options|\n new_column(column_name, lookup_cast_type(options['type']), options)\n end\n end", "title": "" }, { "docid": "da7ce286e59e5fadc6d4c5a85a307b8a", "score": "0.61536133", "text": "def change_non_default_columns_to_be_nullable(table_name)\r\n primary_keys = primary_keys(table_name)\r\n\r\n @connection.columns(table_name).each { |column|\r\n if !column.has_default? && !primary_keys.include?(column.name)\r\n change_column_null(table_name, column.name, true)\r\n end\r\n }\r\n end", "title": "" }, { "docid": "01d078d621225a8490596ad02b14cc1b", "score": "0.6152527", "text": "def change_column_null(table_name, *)\n return super unless is_chrono?(table_name)\n on_temporal_schema { super }\n end", "title": "" }, { "docid": "7105e7cf416feff831f421b006821ffd", "score": "0.6148853", "text": "def add_column_options!(sql, options) # :nodoc:\n sql = annotate_sql(sql) if @annotate\n\n @logger.unknown(\"ODBCAdapter#add_column_options!>\") if @@trace\n @logger.unknown(\"args=[#{sql}]\") if @@trace\n\n super(sql, options)\n rescue Exception => e\n @logger.unknown(\"exception=#{e}\") if @@trace\n raise StatementInvalid, e.message\n end", "title": "" }, { "docid": "88c4da5cb9eb94f40ebacfa505478373", "score": "0.61473274", "text": "def add_columns(transaction, table_name, columns)\n if trace?\n trace(alter_table_sql(table_name){ \n columns.each_pair{|name, type| add_column(name, type)}\n })\n end\n return super unless trace_only?\n nil\n end", "title": "" }, { "docid": "6a2d453f3971b90ed751b1e0621e5224", "score": "0.6135704", "text": "def columns_except_type\n @columns_except_type ||= begin\n query = arel_table\n (column_names - [inheritance_column]).each do |c|\n query = query.project(arel_table[c.to_sym])\n end\n query\n end\n @columns_except_type.dup\n end", "title": "" }, { "docid": "db20cff01ba2fc3d2c8eebaff15683ca", "score": "0.613495", "text": "def set_initial_columns( columns = nil )\n if columns.nil?\n if @opts[:header] == false\n columns = (0...csv_column_count).map{ |i| :\"col#{i}\" }\n else\n columns = fetch_csv_headers.map{ |name| self.class.getter_name( name ) }\n end\n else\n unless !@csv || columns.length == csv_column_count\n $stderr.puts \"Warning <#{@spreadsheet_file}>: columns array does not match the number of columns in the spreadsheet.\" \n compare_columns_to_headers\n end\n end\n \n for column in columns\n raise \"#{column} is in the list FORBIDDEN_COLUMN_NAMES\" if FORBIDDEN_COLUMN_NAMES.include?(column)\n end\n \n @columns = columns\n end", "title": "" }, { "docid": "7bb7039860315bcaa90cfe9cd33e6f45", "score": "0.6134855", "text": "def default_columns\n (data_adapter.model_attributes + self.class.declared_columns).uniq\n end", "title": "" }, { "docid": "371441cf51f176dc083172b33a64a94b", "score": "0.6133115", "text": "def setup_columns\n if inheritable?\n Set.new([primary_key, inheritance_column])\n else\n primary_key.blank? ? Set.new : Set.new([primary_key])\n end \n end", "title": "" }, { "docid": "3ecc31249a5f77685dc0d35871c655f7", "score": "0.61260307", "text": "def columns\n raise NotImplementedError, \"#{self.class}#columns\"\n end", "title": "" }, { "docid": "3852052fe8e0ec2fe7a6304f1089ec9a", "score": "0.6124009", "text": "def column=(_); end", "title": "" }, { "docid": "3852052fe8e0ec2fe7a6304f1089ec9a", "score": "0.6124009", "text": "def column=(_); end", "title": "" }, { "docid": "3852052fe8e0ec2fe7a6304f1089ec9a", "score": "0.6124009", "text": "def column=(_); end", "title": "" }, { "docid": "3080264f53b3d22993ca5359c962097d", "score": "0.6119786", "text": "def import_columns\n return unless import_columns = @options.delete('columns')\n import_columns.each { |c| add_column(c) }\n end", "title": "" }, { "docid": "c13c9ebd627d38bba6c12066c202f6ec", "score": "0.6112075", "text": "def _update_columns(columns_updated)\n @columns_updated = columns_updated\n super\n end", "title": "" }, { "docid": "b3081bed89b01684169cda93c58472b0", "score": "0.61058927", "text": "def get_setter_methods\n if allowed_columns\n allowed_columns.map{|x| \"#{x}=\"}\n else\n super\n end\n end", "title": "" }, { "docid": "d71963ce7f773a3b27d7dd0c5d136951", "score": "0.6100816", "text": "def default_scrummer_columns\n self.column_names = IssueQuery::SCRUMMER_COLUMNS\n\t\t\tend", "title": "" }, { "docid": "516476d3c42738e8b1d68a79fdc00753", "score": "0.6100569", "text": "def column_info\n raise NotImplementedError\n end", "title": "" }, { "docid": "8dc5872852764bdeb49852af586fff1a", "score": "0.61005104", "text": "def test_change_columns\n assert_nothing_raised { @connection.change_column_default(:group, :order, 'whatever') }\n #the quoting here will reveal any double quoting issues in change_column's interaction with the column method in the adapter\n assert_nothing_raised { @connection.change_column('group', 'order', :Int, :default => 0) }\n assert_nothing_raised { @connection.rename_column(:group, :order, :values) }\n end", "title": "" } ]
1bc3897697a0913181bda5bf24adba41
create should call set_vars and save! if successful and return true otherwise, it should raise an exception
[ { "docid": "4c02af7b41c62e87b20ff5e8dd22c074", "score": "0.6653096", "text": "def create(opts={})\n return false #override me\n\n end", "title": "" } ]
[ { "docid": "e732b8b7e932649a82f5fac9512a37b3", "score": "0.73121816", "text": "def create!\n setup\n true\n end", "title": "" }, { "docid": "d012f180af0585fb2a86293b5c6e94ed", "score": "0.71777785", "text": "def save\n # begin\n create_or_update\n # rescue\n # puts $!\n # return false\n # end\n end", "title": "" }, { "docid": "f85373f851ed11325b8756548b931a0a", "score": "0.71590924", "text": "def create\n true\n end", "title": "" }, { "docid": "f85373f851ed11325b8756548b931a0a", "score": "0.71590924", "text": "def create\n true\n end", "title": "" }, { "docid": "f95b852aacc68404f895dcee6219209d", "score": "0.71536964", "text": "def create!\n if valid?\n # store into database\n return self\n else\n return false\n end \n end", "title": "" }, { "docid": "3f82c4c68718951612086d3460f6e43c", "score": "0.71180254", "text": "def create(*args)\n new(*args).save!\n rescue AmbryError\n false\n end", "title": "" }, { "docid": "d9d09bb9cf8ff15dd5fef92925d9e57c", "score": "0.7115956", "text": "def save\n valid? && create\n end", "title": "" }, { "docid": "8d92d2f1bb67837b7705ded3179dd8bc", "score": "0.70814097", "text": "def create(*args)\n create!(*args)\n rescue *exceptions\n false\n end", "title": "" }, { "docid": "a73f61d790f3c7bd84685b6abd5d7fc6", "score": "0.6897063", "text": "def safe_create\n\n\tend", "title": "" }, { "docid": "bc7bcdd4507a36eea818e4af7afaabce", "score": "0.6861182", "text": "def create\n begin\n create!\n rescue RSpreedly::Error::Base\n nil\n end \n end", "title": "" }, { "docid": "bee7361b13b9ce06a0256eeb76533be4", "score": "0.68287975", "text": "def create!\n if valid?\n return self\n else\n return false\n end \n end", "title": "" }, { "docid": "2e6c5bd0f34594154d7076cc9721936f", "score": "0.67879766", "text": "def create?\n true\n end", "title": "" }, { "docid": "2e6c5bd0f34594154d7076cc9721936f", "score": "0.67879766", "text": "def create?\n true\n end", "title": "" }, { "docid": "2e6c5bd0f34594154d7076cc9721936f", "score": "0.67879766", "text": "def create?\n true\n end", "title": "" }, { "docid": "2e6c5bd0f34594154d7076cc9721936f", "score": "0.67879766", "text": "def create?\n true\n end", "title": "" }, { "docid": "0c8d15639cca50721d40a362267f07ef", "score": "0.67127395", "text": "def save\n valid? && create && persist\n end", "title": "" }, { "docid": "0352de608fa7f536f0af0219e6cd8728", "score": "0.67011786", "text": "def create?\n return true\n end", "title": "" }, { "docid": "651d8e72bff4e4e531e9b196f293e98a", "score": "0.66873807", "text": "def create\n save_to_database\n end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", "score": "0.66662157", "text": "def create; end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", "score": "0.66662157", "text": "def create; end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", "score": "0.66662157", "text": "def create; end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", "score": "0.66662157", "text": "def create; end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", "score": "0.66662157", "text": "def create; end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", "score": "0.66662157", "text": "def create; end", "title": "" }, { "docid": "8cd9eb3928c76ac7a92444f83d1cdd16", "score": "0.6657245", "text": "def save!\n persist!\n rescue StandardError\n false\n end", "title": "" }, { "docid": "284eeada84c9cdb84ef0989327cf0994", "score": "0.6638192", "text": "def save\n if valid?\n build\n else\n false\n end\n end", "title": "" }, { "docid": "bc9dfa1feac2d93f667f6c1412947cb7", "score": "0.6630469", "text": "def create?\n end", "title": "" }, { "docid": "41faa708112da8b2ad80d289774cd72c", "score": "0.6624756", "text": "def create\n \t\n end", "title": "" }, { "docid": "41faa708112da8b2ad80d289774cd72c", "score": "0.6624756", "text": "def create\n \t\n end", "title": "" }, { "docid": "2a653309e2aa82a949b8647e972a11c7", "score": "0.66238666", "text": "def create!\n self.class.fail_validate!(self) unless self.create\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "c9d85a05338a7231eacb59587b8bf87d", "score": "0.660441", "text": "def create?\n true\n end", "title": "" }, { "docid": "85876d56e280768d1593044681796d35", "score": "0.65712684", "text": "def create?\n\t\ttrue\n\tend", "title": "" }, { "docid": "85821b7c901833285eb68d70d01fd111", "score": "0.6564499", "text": "def create\n \n end", "title": "" }, { "docid": "85821b7c901833285eb68d70d01fd111", "score": "0.6564499", "text": "def create\n \n end", "title": "" }, { "docid": "85821b7c901833285eb68d70d01fd111", "score": "0.6564499", "text": "def create\n \n end", "title": "" }, { "docid": "85821b7c901833285eb68d70d01fd111", "score": "0.6564499", "text": "def create\n \n end", "title": "" }, { "docid": "c7c618b240fc4955be103f90d0db852c", "score": "0.6542836", "text": "def create\n create! do |success,failure|\n failure.html { redirect_to :back, flash: { :error => \"#{I18n.t(:error_saving)}\" } }\n end\n end", "title": "" }, { "docid": "66fe98cea91c3e4573640a669a3c00e3", "score": "0.65425974", "text": "def create\n\t end", "title": "" }, { "docid": "6856f17483da9b3d9806044cb477d7c7", "score": "0.6540651", "text": "def create?\n true\n end", "title": "" }, { "docid": "00e2a56b755731396e68fc1575c3e7e1", "score": "0.653965", "text": "def create_valid_resource_and_return_false!\n Thong.create!(title: 'Title', body: 'Body')\n false\n end", "title": "" }, { "docid": "e62ccf49ddadba2fee64551a580658ef", "score": "0.65377545", "text": "def save\n save!\n rescue\n false\n end", "title": "" }, { "docid": "9a56b8cb644355d571515d156b7c6f4d", "score": "0.6527741", "text": "def save\n save!\n rescue\n false\n end", "title": "" }, { "docid": "9f6eadf535d159853a26a4a0cc87a631", "score": "0.65212953", "text": "def create!\n raise 'Not implemented'\n end", "title": "" }, { "docid": "53969dca56fd3184c671683606452d3e", "score": "0.6505057", "text": "def create()\n end", "title": "" }, { "docid": "53969dca56fd3184c671683606452d3e", "score": "0.6505057", "text": "def create()\n end", "title": "" }, { "docid": "53969dca56fd3184c671683606452d3e", "score": "0.6505057", "text": "def create()\n end", "title": "" }, { "docid": "53969dca56fd3184c671683606452d3e", "score": "0.6505057", "text": "def create()\n end", "title": "" }, { "docid": "73fc83910cda3ab89c3bb4397171246a", "score": "0.65049225", "text": "def create\n # helps with boilerplateness\n end", "title": "" }, { "docid": "8861806fd1da32269c8340adf4604b31", "score": "0.64990485", "text": "def save\n return false unless valid?\n persist\n true\n end", "title": "" }, { "docid": "3c279560cf65a1261514e7c6dff458a7", "score": "0.64624184", "text": "def save!\n raise TicketSystemError, \"Ticket Create Failed\" unless self.save\n true\n end", "title": "" }, { "docid": "2cea5a07fbc0b3c30b05a6dc7b3e8fa3", "score": "0.6457112", "text": "def create\n try_and_create(\"new\")\n end", "title": "" }, { "docid": "dea573c7b01cba5b7569f4dcc23f2a46", "score": "0.6439581", "text": "def create?\n false\n end", "title": "" }, { "docid": "dea573c7b01cba5b7569f4dcc23f2a46", "score": "0.6439581", "text": "def create?\n false\n end", "title": "" }, { "docid": "dea573c7b01cba5b7569f4dcc23f2a46", "score": "0.6439581", "text": "def create?\n false\n end", "title": "" }, { "docid": "dea573c7b01cba5b7569f4dcc23f2a46", "score": "0.6439581", "text": "def create?\n false\n end", "title": "" }, { "docid": "f28eed17240126b57f4c14b10d61799b", "score": "0.64394546", "text": "def save\n return false unless valid?\n persist!\n true\n end", "title": "" }, { "docid": "80e5b37354dda57fb3616a06af8ae64b", "score": "0.6436515", "text": "def create\n \n end", "title": "" }, { "docid": "b38e27395cfd9c5d1a5bf3d7c5d0fe9d", "score": "0.6432151", "text": "def create\n #\n end", "title": "" }, { "docid": "28c6e8bfaab112362630d0af440c13f3", "score": "0.64186186", "text": "def save!\n valid?\n end", "title": "" }, { "docid": "43435d303f8ca4a6926980dc6e762bda", "score": "0.64128387", "text": "def save\n\n begin\n save!\n true\n rescue Exception => e\n false\n end\n end", "title": "" }, { "docid": "3011cac2d9a5cfdebe17e06a43b55ed6", "score": "0.6408277", "text": "def create_model\n values = sanitize_attributes\n\n result = persistence_klass.send(:create, values)\n result ? Success(result) : Failure(result)\n end", "title": "" }, { "docid": "98e9dbf70428de60b6486cbe14aa7f59", "score": "0.63718235", "text": "def create\n\t\t\n\tend", "title": "" }, { "docid": "cdb27e779521e2c77e91f6c54623d7af", "score": "0.6362597", "text": "def create\r\n end", "title": "" }, { "docid": "f3b5ddc4a789b42e60237a0f966f7e23", "score": "0.6356021", "text": "def allow_create?\n allow_create == true\n end", "title": "" }, { "docid": "81e62cf0fdbaea8ae54088a683b3ee99", "score": "0.6338113", "text": "def create\n end", "title": "" }, { "docid": "81e62cf0fdbaea8ae54088a683b3ee99", "score": "0.6338113", "text": "def create\n end", "title": "" }, { "docid": "81e62cf0fdbaea8ae54088a683b3ee99", "score": "0.6338113", "text": "def create\n end", "title": "" }, { "docid": "81e62cf0fdbaea8ae54088a683b3ee99", "score": "0.6338113", "text": "def create\n end", "title": "" }, { "docid": "81e62cf0fdbaea8ae54088a683b3ee99", "score": "0.6338113", "text": "def create\n end", "title": "" }, { "docid": "81e62cf0fdbaea8ae54088a683b3ee99", "score": "0.6338113", "text": "def create\n end", "title": "" }, { "docid": "81e62cf0fdbaea8ae54088a683b3ee99", "score": "0.6338113", "text": "def create\n end", "title": "" }, { "docid": "81e62cf0fdbaea8ae54088a683b3ee99", "score": "0.6338113", "text": "def create\n end", "title": "" }, { "docid": "1272ef58325838e836b0c7badcddc14e", "score": "0.6335435", "text": "def create\n @property_hash[:ensure] = :present\n end", "title": "" }, { "docid": "9fd30565e9233f3669ff7fa332685d70", "score": "0.63296163", "text": "def standard_create \n @standard_create ||= false\n end", "title": "" }, { "docid": "81d77e8cf1f0a680c7ffc93d7618fcdc", "score": "0.6318798", "text": "def create_models\n validate_presences\n return false if errors.any?\n\n build_and_validate_models\n return false if errors.any?\n\n save_models!\n true\n end", "title": "" }, { "docid": "bbf09ec30f57eaa8bbbfc6020e422723", "score": "0.63176334", "text": "def create_record\n fail 'Method not supported in this persistor'\n end", "title": "" }, { "docid": "71ee97b1fbccf7577254e065cabab6a9", "score": "0.63023937", "text": "def save\n valid?\n end", "title": "" }, { "docid": "d54c0bc01558741847fd0a18e1e1254c", "score": "0.62984395", "text": "def save\n return false unless valid?\n !!(new_record? ? create : update)\n end", "title": "" }, { "docid": "0fe8bd9a5b5da1f6562be3cf645cba61", "score": "0.6284304", "text": "def create\r\n\r\n end", "title": "" }, { "docid": "9a4bde9024b3fb30b12767bc2899bf16", "score": "0.6278972", "text": "def create\n set_attributes(JSON.parse(Rackspace::Connection.post(self.class.resource_url, {self.class.resource.singularize => JSON.parse(self.to_json)}))[self.class.resource.singularize])\n true\n end", "title": "" }, { "docid": "e8c4e8dce8a9d9bf1fbfc136728abd8e", "score": "0.6274497", "text": "def create_allowed?\n true\n end", "title": "" } ]
d263c81d26a636805cc5d4ec9476d949
Tells if there is any connection.
[ { "docid": "219848a90c8812688c34ce9795abadf9", "score": "0.84209037", "text": "def has_connection?\n return [email protected]?\n end", "title": "" } ]
[ { "docid": "bf1d9cf3699b8af413c4a61e5662c484", "score": "0.8179092", "text": "def connected?\n !connections.empty?\n end", "title": "" }, { "docid": "bf1d9cf3699b8af413c4a61e5662c484", "score": "0.8179092", "text": "def connected?\n !connections.empty?\n end", "title": "" }, { "docid": "f561e860fb33148b9e689e2642e6f248", "score": "0.8112589", "text": "def connected?\n [email protected]?\n end", "title": "" }, { "docid": "dff740d02032476e33d1dc9a3adf1bb3", "score": "0.8098121", "text": "def has_connection?\n connection.connected?\n end", "title": "" }, { "docid": "de422906944ad9c691a477edf0622dd5", "score": "0.8032632", "text": "def connected?\n !connections.empty?\n end", "title": "" }, { "docid": "74f1da59e84f1e8f9b96d4280dac24dc", "score": "0.78938836", "text": "def connected?\n [email protected]? && @connected\n end", "title": "" }, { "docid": "ab4988b9f80fbcf4018c4d844c3608d9", "score": "0.78726083", "text": "def connections?\n @connections.any?\n end", "title": "" }, { "docid": "ab4988b9f80fbcf4018c4d844c3608d9", "score": "0.78726083", "text": "def connections?\n @connections.any?\n end", "title": "" }, { "docid": "d93675152931e0903feec5fdbd13e580", "score": "0.784694", "text": "def connected?; @connection and @connection.established? end", "title": "" }, { "docid": "cc5b0434632dd4d3836f37fd71fb7a25", "score": "0.7838375", "text": "def connected?\n @connection && @connection.connected?\n end", "title": "" }, { "docid": "8d5b07101c3f9a635a62ff0f43fbbaa6", "score": "0.7792343", "text": "def connected?\n @connection.present?\n end", "title": "" }, { "docid": "b00aaeea02a8dcc2dbb5da2ea9ac79a5", "score": "0.7776522", "text": "def connected?\n @connection && @connection.open?\n end", "title": "" }, { "docid": "8472125ab5f965d504822211e32a6897", "score": "0.7774374", "text": "def connected?\n synchronize { @connections.any? }\n end", "title": "" }, { "docid": "8472125ab5f965d504822211e32a6897", "score": "0.7774374", "text": "def connected?\n synchronize { @connections.any? }\n end", "title": "" }, { "docid": "8472125ab5f965d504822211e32a6897", "score": "0.7774374", "text": "def connected?\n synchronize { @connections.any? }\n end", "title": "" }, { "docid": "8472125ab5f965d504822211e32a6897", "score": "0.7774374", "text": "def connected?\n synchronize { @connections.any? }\n end", "title": "" }, { "docid": "47cc930e030b7fd2e3db299860b39ccc", "score": "0.77572864", "text": "def connected?\n !!(@conn && @conn.open?())\n end", "title": "" }, { "docid": "a4984118fc79ddee01e05a8fb9102ae8", "score": "0.77492326", "text": "def connected?\n not @socket.nil?\n end", "title": "" }, { "docid": "eb8f7bbbb3b04326cba6e38699f25f68", "score": "0.7743631", "text": "def connection_made?\n @connections.any?(&:_makara_connected?)\n end", "title": "" }, { "docid": "eb8f7bbbb3b04326cba6e38699f25f68", "score": "0.7743631", "text": "def connection_made?\n @connections.any?(&:_makara_connected?)\n end", "title": "" }, { "docid": "8a28d4415ab281badd04f9e215dcab6f", "score": "0.7740434", "text": "def connected?\n [email protected]\n end", "title": "" }, { "docid": "d9d51f7394aecf35faa38917df154435", "score": "0.77340686", "text": "def connected?\n @connection&.established?\n end", "title": "" }, { "docid": "1d62ceba04f60a01c575ef60b56569bc", "score": "0.7718015", "text": "def isConnected?\n return @conn != false\n end", "title": "" }, { "docid": "fbbed25ebf99a18e691408659bcdcf11", "score": "0.7687442", "text": "def connected?\n connection{ |conn| conn.connected? }\n end", "title": "" }, { "docid": "241fd4dc06d3c5778331efc03dd4379b", "score": "0.7669084", "text": "def connected?\n @connection.respond_to?(:connected?) &&\n @connection.connected?\n end", "title": "" }, { "docid": "cc376cf630af12150d29255c58ef5bb8", "score": "0.7650884", "text": "def idle?\n @connections.empty?\n end", "title": "" }, { "docid": "c0f8e80b8ac590fcb87897507c6814cb", "score": "0.76248693", "text": "def connected?\n if @connection\n true\n end\n end", "title": "" }, { "docid": "93e16090c64caa6be22ba338da2b2675", "score": "0.76205873", "text": "def connected?\n return false unless @connection\n return false unless @connection.started?\n true\n end", "title": "" }, { "docid": "e30a5ba628c0b12593605d11662d62f4", "score": "0.7595289", "text": "def connected?\n [email protected]? \n end", "title": "" }, { "docid": "be3dc48fc6eaa869c68f8305746db18d", "score": "0.7552838", "text": "def connected?\n return @connection.connected?\n end", "title": "" }, { "docid": "45f9182675796f3c0a46a4437bf0f70b", "score": "0.75484926", "text": "def has_connection?(connection)\n @connections.has_value? connection\n end", "title": "" }, { "docid": "afc9cb2db8fbb1e4f951bed4bd03247a", "score": "0.75419164", "text": "def connected?\r\n !! @sock\r\n end", "title": "" }, { "docid": "90cf4f2697772e50709bae8af2a72851", "score": "0.7535479", "text": "def connected?\n self.connection.connected?\n end", "title": "" }, { "docid": "dbc69929401e84fdb1ceba75ef55cb7b", "score": "0.7535186", "text": "def connected?\n return @sock.nil? ? false : true\n end", "title": "" }, { "docid": "f8f601555df267406c7df386b741c6ad", "score": "0.7526119", "text": "def connected?\n !!@sock\n end", "title": "" }, { "docid": "96f7252f47e00a4ef63f4eb9cc337df1", "score": "0.7518966", "text": "def empty?\n @connections.empty?\n end", "title": "" }, { "docid": "b07536699b931c68e1a6a6aeccfcfb6e", "score": "0.74906707", "text": "def connected?\n connection.connected?\n end", "title": "" }, { "docid": "9b759186ba5f5d5006e3a6fb5fa46170", "score": "0.7489795", "text": "def connected?\n [email protected]? && [email protected]?\n end", "title": "" }, { "docid": "9b759186ba5f5d5006e3a6fb5fa46170", "score": "0.7489795", "text": "def connected?\n [email protected]? && [email protected]?\n end", "title": "" }, { "docid": "76e5d09731897e7611784bbbc410301a", "score": "0.7489057", "text": "def connected?\r\n @connection_active\r\n end", "title": "" }, { "docid": "19c6a0e59ec644132fd6f729ffe1af73", "score": "0.7483991", "text": "def connect?\n connect != false\n end", "title": "" }, { "docid": "53b11ca205e43e67a213959ba7456fe4", "score": "0.7482442", "text": "def connected?\n connection_handler.connected?(connection_specification_name)\n end", "title": "" }, { "docid": "23e3ae9e0fa4ce45bcf7090a18a96071", "score": "0.7458271", "text": "def connected?\n ! @ssl.nil?\n end", "title": "" }, { "docid": "61ca7abc1cb29b0f5fbc651d6812024e", "score": "0.74351805", "text": "def connected?\n @connected.true? # synchronize { @connections.any? }\n end", "title": "" }, { "docid": "3211cd32e28e7212376d82c7889913c4", "score": "0.74334997", "text": "def connected?\n !!@socket && !!@connection && !!@driver\n end", "title": "" }, { "docid": "60d7b85615ef008eb236791d65fb934b", "score": "0.7407894", "text": "def empty?\n connections.empty?\n end", "title": "" }, { "docid": "ae0a9a5a4a8f74f194a737b47623a298", "score": "0.7397673", "text": "def connected?\n @socket&.connected\n end", "title": "" }, { "docid": "282555832b9a51b684bb91d024461fa9", "score": "0.73918545", "text": "def connected?\n !!socket\n end", "title": "" }, { "docid": "b3cb081ffe32b080cb36dd7af9434afb", "score": "0.73801184", "text": "def check_connection\r\n #\r\n end", "title": "" }, { "docid": "33f879708d33095222ca7f0c21771bf9", "score": "0.737521", "text": "def connected?\n return false unless @connection\n return false unless @connection.started?\n true\n end", "title": "" }, { "docid": "33f879708d33095222ca7f0c21771bf9", "score": "0.737521", "text": "def connected?\n return false unless @connection\n return false unless @connection.started?\n true\n end", "title": "" }, { "docid": "33f879708d33095222ca7f0c21771bf9", "score": "0.737521", "text": "def connected?\n return false unless @connection\n return false unless @connection.started?\n true\n end", "title": "" }, { "docid": "a0ce60b6f6476cbfe5410a05b05f29a1", "score": "0.73659617", "text": "def connected?\n @connected && !(@socket.closed?) \n end", "title": "" }, { "docid": "b0958eb7559794d5b42716450a299911", "score": "0.7364483", "text": "def connected?\n !!socket\n end", "title": "" }, { "docid": "6cfab449fe3997e4dc5f3ad8a08657c7", "score": "0.7362802", "text": "def connected?(name)\n conn = retrieve_connection_pool(name)\n conn && conn.connected?\n end", "title": "" }, { "docid": "a781dcdb43cc9e7971300fd40e7d18c7", "score": "0.7354793", "text": "def connected?\n !!@socket\n end", "title": "" }, { "docid": "7f54e873a529d5ee1dc1214663ba4e08", "score": "0.733613", "text": "def check_connection\n unless established?\n close if close_wait?\n initialize\n end\n end", "title": "" }, { "docid": "80ccb357bfeee4eb820ff48335b9f449", "score": "0.7335948", "text": "def connected?\n start_ssh {|ssh| } # do nothing\n rescue *CONNECTION_EXCEPTIONS => ex\n @connection_error = ex\n return false\n else\n return true\n end", "title": "" }, { "docid": "83e7af5652383cc8f908a44d3353b7ce", "score": "0.73239994", "text": "def connected?; connection_state == :connected end", "title": "" }, { "docid": "f796c67fa3d5906c24404ac25d7bfc22", "score": "0.7318911", "text": "def connected?; @connected.true? end", "title": "" }, { "docid": "dc93f73b2e963371f3986bc0ee85cb71", "score": "0.7313182", "text": "def connected?\n !!@socket\n end", "title": "" }, { "docid": "6c57c855d8b0973f0d9d1609c6fbd619", "score": "0.73086643", "text": "def connect?\n @connect ||= false\n end", "title": "" }, { "docid": "43e20feb3e7deb4ba9672abbae9f3cba", "score": "0.72907066", "text": "def connected?; @connected end", "title": "" }, { "docid": "781f06aef622417772cd03074144cf00", "score": "0.7279423", "text": "def connected?\n !closed? && !error? && !interrupted? && !!@socket\n end", "title": "" }, { "docid": "52b6354fe193d13861e85dfad4e9a3fe", "score": "0.72778946", "text": "def connection?\n\t\t\t\t@stream_id.zero?\n\t\t\tend", "title": "" }, { "docid": "f9200b274e64ffd003b2ef430b7ea545", "score": "0.7267249", "text": "def check_conn?\n begin\n res = send_request_cgi('uri' => '/', 'method' => 'GET')\n if res\n vprint_good(\"Server is responsive...\")\n return true\n end\n rescue ::Rex::ConnectionRefused,\n ::Rex::HostUnreachable,\n ::Rex::ConnectionTimeout,\n ::Rex::ConnectionError,\n ::Errno::EPIPE\n end\n false\n end", "title": "" }, { "docid": "e0aac6d054dc20781e27db2958ddfebd", "score": "0.72606945", "text": "def connected?; [email protected]?; end", "title": "" }, { "docid": "1668c93e74f42303a8be9c3d1cc7e30b", "score": "0.72491026", "text": "def connected?\n connection_handler.connected?(self)\n end", "title": "" }, { "docid": "e1e892fb721103ece10cb447220a53e4", "score": "0.724358", "text": "def connected_to_ems?\n connection_state == 'connected' || connection_state.nil?\n end", "title": "" }, { "docid": "b6ce3a12347f7658c7583f553b5d9479", "score": "0.7236104", "text": "def connected?\r\n end", "title": "" }, { "docid": "b2d8cdcff981d0b623c13cc5f12c8ba4", "score": "0.7231799", "text": "def connected?\n @connector.connected?\n end", "title": "" }, { "docid": "3ab0dd8a75df4d158ef86788193d9877", "score": "0.7230147", "text": "def for_connection?(connection)\r\n end", "title": "" }, { "docid": "7705ad0d7a965ce5a158e4773d17b4a9", "score": "0.721913", "text": "def tcp_connection_established?\n @tcp_connection_established\n end", "title": "" }, { "docid": "c8c1bfe603330d1d0ad58d272def5c07", "score": "0.72078687", "text": "def check_connection\n\n # connect\n @checkpoints[\"connection\"] = false\n socket_stream, err_message = connect(@checkpoints[\"host\"], @checkpoints[\"port\"])\n if socket_stream.nil?\n finish(false, err_message)\n end\n @checkpoints[\"connection\"] = true\n socket_stream\n end", "title": "" }, { "docid": "7ded3a3b9e198430b81897147c9db8da", "score": "0.72016627", "text": "def connected?\n !!@connected\n end", "title": "" }, { "docid": "7ded3a3b9e198430b81897147c9db8da", "score": "0.72016627", "text": "def connected?\n !!@connected\n end", "title": "" }, { "docid": "ef3c5bf94bd199d414bcb2d798a0d5bb", "score": "0.7191591", "text": "def connected?\n true\n end", "title": "" }, { "docid": "f3373bcc24d173ae876a57950b782135", "score": "0.7186258", "text": "def connected?\n @primary_pool && @primary_pool.host && @primary_pool.port\n end", "title": "" }, { "docid": "3ed52e258242095b0a90b8db48d0c49d", "score": "0.7184304", "text": "def connecting?\n do_command('Stats') =~ /Now connecting/\n end", "title": "" }, { "docid": "8f0cf1c5d9cc09d5cf5c952cdd69740b", "score": "0.7180526", "text": "def connected?\n connection.status == :started\n end", "title": "" }, { "docid": "8f0cf1c5d9cc09d5cf5c952cdd69740b", "score": "0.7180526", "text": "def connected?\n connection.status == :started\n end", "title": "" }, { "docid": "01dcc2d791036e71acf50777f71a5b88", "score": "0.7173667", "text": "def conn?\n\t\tconn != nil\n\tend", "title": "" }, { "docid": "3caa9ddbe2ee535372bcedf270a761ab", "score": "0.7156648", "text": "def connected?\n return @connected\n end", "title": "" }, { "docid": "f53063cb1b6e2c6356523ed915dd92dc", "score": "0.71565104", "text": "def connected?\n @connected\n end", "title": "" }, { "docid": "f53063cb1b6e2c6356523ed915dd92dc", "score": "0.71565104", "text": "def connected?\n @connected\n end", "title": "" }, { "docid": "f53063cb1b6e2c6356523ed915dd92dc", "score": "0.71565104", "text": "def connected?\n @connected\n end", "title": "" }, { "docid": "f53063cb1b6e2c6356523ed915dd92dc", "score": "0.71565104", "text": "def connected?\n @connected\n end", "title": "" }, { "docid": "f53063cb1b6e2c6356523ed915dd92dc", "score": "0.71565104", "text": "def connected?\n @connected\n end", "title": "" }, { "docid": "f53063cb1b6e2c6356523ed915dd92dc", "score": "0.71565104", "text": "def connected?\n @connected\n end", "title": "" }, { "docid": "f53063cb1b6e2c6356523ed915dd92dc", "score": "0.71565104", "text": "def connected?\n @connected\n end", "title": "" }, { "docid": "7a3adfd51e80d84fe5509c95a4e322c3", "score": "0.7154081", "text": "def connected?\n true\n end", "title": "" }, { "docid": "bfa0d3841d8e4861df04214e9d6142ca", "score": "0.71513253", "text": "def connected?\n setup? && [email protected]?\n end", "title": "" }, { "docid": "a446f1bf452ec306e88eeed35fc326ba", "score": "0.7151133", "text": "def has_active_connection? connection\n @connections.index connection\n end", "title": "" }, { "docid": "7ca1232c8f66ecde27636a55a255c877", "score": "0.7148956", "text": "def connected?\n server\n end", "title": "" }, { "docid": "fea0be1d1ea0eb45f3346bfd27a1b4fa", "score": "0.7138564", "text": "def connected?\n @connected\n end", "title": "" }, { "docid": "fea0be1d1ea0eb45f3346bfd27a1b4fa", "score": "0.7138564", "text": "def connected?\n @connected\n end", "title": "" }, { "docid": "fea0be1d1ea0eb45f3346bfd27a1b4fa", "score": "0.7138564", "text": "def connected?\n @connected\n end", "title": "" }, { "docid": "b2e60968730cffe3b0dc7eafab7fbf06", "score": "0.71366674", "text": "def connected?\n false\n end", "title": "" }, { "docid": "a7f8cb18c94e9e24aec724d6c7f5a78a", "score": "0.71329826", "text": "def online?\n @logger.info \"Test the connection\" if @logger\n send Istat::Frames::ConnectionTestRequest.new\n response = Istat::Frames::ConnectionTestResponse.new(receive)\n response.success?\n end", "title": "" }, { "docid": "f312fe5df8c841c5a194ba5623f6b108", "score": "0.71328396", "text": "def connected?\n @connected.true?\n end", "title": "" } ]
9a00157fdad4c5203d10ba3d3fc93133
Set the correct working status for the command module
[ { "docid": "32610ae69331c8f42933e026b86a0c25", "score": "0.70729864", "text": "def set_command_module_status(command_mod)\n case command_mod.verify_target()\n when BeEF::Core::Constants::CommandModule::VERIFIED_NOT_WORKING\n command_module_status = BeEF::Core::Constants::CommandModule::VERIFIED_NOT_WORKING\n when BeEF::Core::Constants::CommandModule::VERIFIED_USER_NOTIFY\n command_module_status = BeEF::Core::Constants::CommandModule::VERIFIED_USER_NOTIFY\n when BeEF::Core::Constants::CommandModule::VERIFIED_WORKING\n command_module_status = BeEF::Core::Constants::CommandModule::VERIFIED_WORKING\n when BeEF::Core::Constants::CommandModule::VERIFIED_UNKNOWN\n command_module_status = BeEF::Core::Constants::CommandModule::VERIFIED_UNKNOWN\n else\n command_module_status = BeEF::Core::Constants::CommandModule::VERIFIED_UNKNOWN\n end\n# return command_module_status\n command_module_status\n end", "title": "" } ]
[ { "docid": "0bd5c78fd42893d895b6b562754ad4ee", "score": "0.770665", "text": "def mark_working!; self.status = 1 end", "title": "" }, { "docid": "0bd5c78fd42893d895b6b562754ad4ee", "score": "0.770665", "text": "def mark_working!; self.status = 1 end", "title": "" }, { "docid": "afb9e9ad2b655c22cab6f69c6a4ae720", "score": "0.67504007", "text": "def status\n @commands_and_opts.unshift COMMANDS[:status]\n include_multiple_commands?\n self\n end", "title": "" }, { "docid": "c392665f76d72aea210b6d741d2d43a4", "score": "0.6628902", "text": "def switch_task_status()\n @status = !@status\n end", "title": "" }, { "docid": "d78eaf79b8fa246da33ec4ceb650bfd1", "score": "0.6543805", "text": "def set_next_status\n update_attribute(:status,\n any_work_units_failed? ? FAILED :\n self.splitting? ? PROCESSING :\n self.mergeable? ? MERGING :\n SUCCEEDED\n )\n end", "title": "" }, { "docid": "0c23314700711910b4be00a7b602634a", "score": "0.64222497", "text": "def letRunning()\n return @status = :running ;\n end", "title": "" }, { "docid": "fe575c5c8ba32a734f0412421fd13327", "score": "0.63792795", "text": "def status=(status); end", "title": "" }, { "docid": "fe575c5c8ba32a734f0412421fd13327", "score": "0.63792795", "text": "def status=(status); end", "title": "" }, { "docid": "d0b1eac913898eb7cc2fab0049e3050c", "score": "0.63682306", "text": "def update_status\n @status = !@status\n end", "title": "" }, { "docid": "6e9d3a364bf390585757f29ed58de68b", "score": "0.6368131", "text": "def set_status\n if self.started? && !self.flop? && !self.turn? && !self.river? && !self.ended?\n self.status = \"flop\"\n self.flop = true\n elsif self.flop? && self.started?\n self.status = \"turn\"\n self.flop = false\n self.turn = true\n elsif self.turn? && self.started?\n self.status = \"river\"\n self.turn = false\n self.river = true\n elsif self.river? && self.started?\n self.status = \"ended\"\n self.river = false\n self.ended = true\n self.started = false\n end\n end", "title": "" }, { "docid": "76c6d6a17cc300d5ef56f0a72419135a", "score": "0.63614213", "text": "def statuscmd\n end", "title": "" }, { "docid": "834de4de4e43b7e2aa21f6fdb63cc8d9", "score": "0.62659717", "text": "def mark_started!; self.status = 0 end", "title": "" }, { "docid": "834de4de4e43b7e2aa21f6fdb63cc8d9", "score": "0.62659717", "text": "def mark_started!; self.status = 0 end", "title": "" }, { "docid": "e101a3903369f195369a7f56a94a6788", "score": "0.62462294", "text": "def cmd_status()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "f6ad729b700b03e52984fd1dbd27ec51", "score": "0.6245668", "text": "def update_task_status(event) # :nodoc:\n\t if event.success?\n\t\tplan.task_index.add_state(self, :success?)\n\t\tself.success = true\n\t elsif event.failure?\n\t\tplan.task_index.add_state(self, :failed?)\n\t\tself.success = false\n @failure_reason ||= event\n @failure_event ||= event\n end\n\n\t if event.terminal?\n\t\t@terminal_event ||= event\n\t end\n\t \n\t if event.symbol == :start\n\t\tplan.task_index.set_state(self, :running?)\n\t\tself.started = true\n\t\t@executable = true\n\t elsif event.symbol == :stop\n\t\tplan.task_index.remove_state(self, :running?)\n plan.task_index.add_state(self, :finished?)\n\t\tself.finished = true\n self.finishing = false\n\t @executable = false\n\t end\n\tend", "title": "" }, { "docid": "9adc93dde160c86999812d0e9a978e74", "score": "0.6226367", "text": "def run!\n @status = :running\n end", "title": "" }, { "docid": "f54b3c98e6fee14977575fc27defecba", "score": "0.6195041", "text": "def set_status status\n @status = status\n end", "title": "" }, { "docid": "7ef11cbd336f5b12798e533d02072b7f", "score": "0.61812985", "text": "def status\n @status = 'done'\n end", "title": "" }, { "docid": "5be4800890720c062ff42381e5b65482", "score": "0.6175081", "text": "def change_status!\n if status\n update(status: false)\n else\n update(status: true)\n end\n end", "title": "" }, { "docid": "e06fb36f412b79bedac44041844a9b6d", "score": "0.61627287", "text": "def statuscmd\n (@resource[:hasstatus] == :true) && [initscript, :status]\n end", "title": "" }, { "docid": "c14a9ba573d508ffa38738f8b2f6c345", "score": "0.615972", "text": "def set_status(status)\n @elapsed_time = Time.new - @start_time\n @end_time = Time.new\n @elapsed_time = @end_time - @start_time\n LyberCore::Log.info(\"#{item_id} #{status} in #{@elapsed_time} seconds\")\n if (@druid)\n Dor::WorkflowService.update_workflow_status(@work_queue.workflow.repository, @druid, @work_queue.workflow.workflow_id, @work_queue.workflow_step, status, @elapsed_time)\n end\n end", "title": "" }, { "docid": "56c710b57177ae88232ab90c71c423a2", "score": "0.6159101", "text": "def set_status status\n @status = status\n end", "title": "" }, { "docid": "391eb5068e23b6276eeb10137d7ff0d9", "score": "0.6153693", "text": "def set_default_status\n self.status = 0\n end", "title": "" }, { "docid": "559bd7db72a81a754657b9188705ae88", "score": "0.6133906", "text": "def change_status(status, result = nil, message = nil)\n @result = result if result\n @status = status\n @message = message\n end", "title": "" }, { "docid": "e29676fc47c655d1a188d6d6402457fd", "score": "0.6124132", "text": "def realtime_status \n return status if status == 'finished' or status == 'failed'\n \n self.import_modules.update_statuses\n\n if import_modules.load.select{ |im| im.status == 'failed'}.count > 0\n update_attribute(:status, 'failed')\n elsif import_modules.load.select{ |im| im.finished? }.count == import_modules.size\n update_attribute(:status, 'finished')\n elsif import_modules.load.select{ |im| im.status == 'pending' }.count > 0\n update_attribute(:status, 'pending')\n elsif import_modules.load.select{ |im| im.status != 'ready' && im.status != 'waiting' }.count > 0 and status != 'working'\n update_attribute(:status, 'working')\n end\n status\n end", "title": "" }, { "docid": "567c463c70bb790747442db47c6daaab", "score": "0.61204624", "text": "def set_status\n #sets active status on remote server\n NereusStatsItem.delay.set_status(id)\n end", "title": "" }, { "docid": "077d67d5eb8580d38d490f3d1a39e836", "score": "0.611187", "text": "def setStatus(error, power_mode, period_comm)\n\t##### First byte, cmd1\n\t# bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0\n # err - - PWD - - - -\n\t##### Second byte, cmd2\n\t# bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0\n # PWD - PER5 PER4 PER3 PER2 PER1 PER0i\n\n\t# mount a string convering period to binary\n\n\tif (period_comm > 63 || period_comm < 1)\n\t\treturn \"Comm Period: max 63 minutes, min 1 minute\"\n\tend\n\n\tif (error != 1 && error != 0)\n\t\treturn \"error must be 1(has error) or 0(no error)\"\n\tend\n\n\tif (power_mode != 1 && power_mode != 0)\n\t\treturn \"power mode must be 1(turn off module) or 0(turn on module)\"\n\tend\n\n\tcmd1 = (error.to_s + \"0\" + \"0\" + power_mode.to_s).ljust(8, \"0\").to_s\n\tcmd2 = (power_mode.to_s + \"0\" + period_comm.to_s(2).rjust(6, \"0\")).to_s\n\t\n\t#puts cmd1 + \"|\" + binary_to_ascii(cmd1).to_s + \"|\" + cmd2 + \"|\" + binary_to_ascii(cmd2).to_s\n\treturn binary_to_ascii(cmd1).to_s + binary_to_ascii(cmd2).to_s\n\t# setStatus(0,1,\n\t\nend", "title": "" }, { "docid": "5b6001f47adae4758f60f8575ad12c7c", "score": "0.60904115", "text": "def status=(val)\n write_attribute(:status, val)\n self.priority = 0 if self.status == :done\n end", "title": "" }, { "docid": "6fbfdc64bea6675b9770bded9ebf29f5", "score": "0.6080402", "text": "def set_status\n self.status ||= :NO_RESULTS\n end", "title": "" }, { "docid": "b5017db362b9b907d22e3c6c0077418f", "score": "0.6054539", "text": "def change_status\n notice = \"\"\n status_changed = false\n if self.status == \"enabled\"\n self.status = \"disabled\"\n notice = _('Campaign_stopped') + \": \" + self.name\n status_changed = true\n else\n notice = _('No_actions_for_campaign') + \": \" + self.name if self.sms_adactions.size == 0\n notice = _('No_free_numbers_for_campaign') + \": \" + self.name if self.new_numbers_count == 0\n #note the order in whitch we are checking whether campaing will be able to start\n #dont change it without any reason(ticket #2594)\n notice = _('User_has_no_credit_left') if self.user_has_no_credit?\n notice = _('User_has_empty_balance') if self.user_has_no_balance?\n notice = _('User_is_blocked') if self.user_blocked?\n\n if self.sms_adactions.size > 0 and self.new_numbers_count > 0 and !self.user_has_no_credit? and !self.user_has_no_balance? and !self.user_blocked?\n self.status = \"enabled\"\n notice = _('Campaign_started') + \": \" + self.name\n status_changed = true\n end\n end\n return notice, status_changed\n end", "title": "" }, { "docid": "7560f466380618a59466b6088de4729f", "score": "0.60523504", "text": "def executing?; status == 'executing'; end", "title": "" }, { "docid": "6551b8e4fcb62cda06db0ca064a70526", "score": "0.60499465", "text": "def sc!\n @__status__.status\n end", "title": "" }, { "docid": "9e3cd55fd1cdbd9ec8e6ea9947a8aaf8", "score": "0.6042216", "text": "def change_status(status)\n @status = status\n end", "title": "" }, { "docid": "33861cfa9ed1cf606436bf37b2083e66", "score": "0.60274833", "text": "def working!\n update_column :status, WORKING\n end", "title": "" }, { "docid": "fad6a0905b718a9d929c6805ef1cf955", "score": "0.6027479", "text": "def start\n self.status\n end", "title": "" }, { "docid": "fad6a0905b718a9d929c6805ef1cf955", "score": "0.6027479", "text": "def start\n self.status\n end", "title": "" }, { "docid": "56257c147db039f547b7025f391599bc", "score": "0.60229903", "text": "def start()\n self.status=\"started\" \n end", "title": "" }, { "docid": "f2a554f77033c2076c5471ec304f860c", "score": "0.6003932", "text": "def status\n run_cmd('status -uno')\n end", "title": "" }, { "docid": "e40cda57289802d8ebc484592bce9c8c", "score": "0.60009634", "text": "def status=(_); end", "title": "" }, { "docid": "e40cda57289802d8ebc484592bce9c8c", "score": "0.60009634", "text": "def status=(_); end", "title": "" }, { "docid": "c005c8702776220856fedafb0966f8a2", "score": "0.59898907", "text": "def status\n execute('status') do\n if @experiment.preparing?\n return status_prepare_action\n elsif @experiment.started?\n return status_experiment_action\n end\n end\n end", "title": "" }, { "docid": "96469ea250ff3fb9c208226609650fce", "score": "0.5983412", "text": "def set_signal_start_or_stop status\n command_list = build_command_list :M0012, :setStart, {\n securityCode: Validator.config['secrets']['security_codes'][2],\n status: status\n }\n send_command_and_confirm @task, command_list, \"Request series of signal groups to #{status}\"\n end", "title": "" }, { "docid": "60749778a98b08bba607ab8d99fd4e3a", "score": "0.5973438", "text": "def full_status(command=nil)\n command ||= @command\n @command.status(self)\n end", "title": "" }, { "docid": "60749778a98b08bba607ab8d99fd4e3a", "score": "0.5973438", "text": "def full_status(command=nil)\n command ||= @command\n @command.status(self)\n end", "title": "" }, { "docid": "d0e44ea2ec4565c7dad7451b73ebfd35", "score": "0.5970583", "text": "def set_status\n self.status = 'Pending'\n end", "title": "" }, { "docid": "51a49a5bd4809a3d4534bfad6932e219", "score": "0.59635174", "text": "def handle(command)\n self.status\n end", "title": "" }, { "docid": "3a4a838a6b0c31e11436f8346ac9076c", "score": "0.59515667", "text": "def status\n ((val = command[:status]) && val.to_sym) || :executing\n end", "title": "" }, { "docid": "155bf917d06a4bb15007ae5ba527a5de", "score": "0.5949554", "text": "def change_status_of_project\n project.progress(:in_progress) if project.requested?\n end", "title": "" }, { "docid": "544ca7b0a7aa971166f298947023869e", "score": "0.5946401", "text": "def status\n # Initialize a nil value to something meaningful\n @status ||= :not_executed\n @status\n end", "title": "" }, { "docid": "675bd16e685ec634501f11aba6106cbb", "score": "0.5944412", "text": "def set_status(task_name, status)\n command = Command::SetStatus.new(task_name, status)\n Client.run(command)\n end", "title": "" }, { "docid": "18398cd43243362484ede4631ecfbc22", "score": "0.59302217", "text": "def update_steps_status\n update_started_at = ['problem','hold'].include?(self.aasm_state)\n self.update_attribute(:started_at, Time.now) unless update_started_at#unless started_at?\n if steps.top_level.includes(:parent).all? { |step| step.complete_or_not_executable? }\n finish!\n else\n prepare_steps_for_execution\n end\n end", "title": "" }, { "docid": "1d0f2fa13fbed102f130cbc370626467", "score": "0.59286666", "text": "def status=(status)\n if status && !VALID_STATUS.include?(status.to_sym)\n raise ArgumentError, \"Invalid Action (#{status}), use: #{VALID_STATUS*' '}\"\n end\n command[:status] = status\n end", "title": "" }, { "docid": "da81f894860d5ef716fac120232345d5", "score": "0.591362", "text": "def status!\n return @status if @status.nil? || @status =~ /_DONE_/\n refresh_status\n @status\n end", "title": "" }, { "docid": "ab1d07d26cff08b23b439f79f8f7f918", "score": "0.5909035", "text": "def set_status\n self.status = :pending\n end", "title": "" }, { "docid": "ab1d07d26cff08b23b439f79f8f7f918", "score": "0.5909035", "text": "def set_status\n self.status = :pending\n end", "title": "" }, { "docid": "323fb7eb5dcc9e1064c94c15b1cd4b61", "score": "0.59049785", "text": "def set_status\n self.status ||= 'pending'\n end", "title": "" }, { "docid": "456fb94ef126a1f3930fa1d26b3ec6ff", "score": "0.5893104", "text": "def update(status)\n case status\n when :stop\n @main = nil\n @builtin = nil\n end\n end", "title": "" }, { "docid": "c563803f468dac2474c7bec0eb241e0d", "score": "0.58866036", "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": "02d966fde0e1ad95eb1e568842a23b80", "score": "0.5873013", "text": "def setstatus(status)\n if STATES.include? status\n if is_flapping?\n # If it's flapping, set the highest priority\n if STATES.index(status) > STATES.index(@last_status)\n @status=status\n else\n @status=@last_status\n end\n else\n @status=status\n end\n else\n raise \"Unkown status: #{status}\"\n end\n end", "title": "" }, { "docid": "5bf98b5383129773849723bebc51a29d", "score": "0.58697414", "text": "def set_status(status)\n if status.is_a? TaskStatus\n @status = status \n end\n @status = TaskStatus::UNAVAIL\n end", "title": "" }, { "docid": "a3372a36d03766b5e443b5d70148c630", "score": "0.58660126", "text": "def set_status(new_status, caretaker=nil)\n details = { from: self.status, to: new_status }\n\n case new_status\n when SPROUT\n self.manifested = false\n self.growing = true\n when PLANT\n self.manifested = true\n self.growing = false\n when TREE\n self.manifested = true\n self.growing = true\n end\n \n if caretaker\n actor = caretaker\n else\n actor = self\n end\n \n EventLog.entry(actor, self, EPICENTER_STATUS_CHANGE, details)\n self.save\n end", "title": "" }, { "docid": "6e72864b9fd91f5e19b3591792cbec6d", "score": "0.5855369", "text": "def status=(status)\n end", "title": "" }, { "docid": "87df23075cc2a75e8adda1ff7bf5482a", "score": "0.58510226", "text": "def SetStatus(perc, _text, doupd = false)\n # NOTE:\n # These two lines optimized the executing of a backup dramaticly. The reason for this, is that it takes time\n # every time that the status has to be updated. Actually with a database with 10.000 rows, it will be updated\n # 10.000 times. But since the human eye can only see about hundred, there is no reason to show more.\n # And that is what is done here by comparing two variables.\n\n perc = round(perc, 3)\n if perc != @perc || doupd\n @label.set_text(\"Status: \" . text)\n\n @perc = perc\n @@progress.set_percentage(perc)\n updwin\n end\n end", "title": "" }, { "docid": "c40e50bff3e3bedfcd1fd01c4a915fe4", "score": "0.5850388", "text": "def set_status\n self.status = \"pending\"\n end", "title": "" }, { "docid": "d9d7b53f6895e537f3c332f425b8cf6b", "score": "0.5840777", "text": "def test\n flag = (params[:flag] || 'menu').underscore.to_sym\n\n if flag != :menu\n show_system_status(\n url_on_completion: status_test_url,\n completion_button: 'Test Again',\n main_status: 'Running test process'\n ) do |status|\n sleep 0.5\n\n File.open(BarkestCore::WorkPath.system_status_file, 'wt') do |f|\n 2.times do |i|\n f.write(\"Before loop status message ##{i+1}.\\n\")\n f.flush\n sleep 0.1\n end\n sleep 0.5\n\n status.set_percentage(0) if flag == :with_progress\n 15.times do |t|\n c = (t % 2 == 1) ? 3 : 5\n c.times do |i|\n f.write(\"Pass ##{t+1} status message ##{i+1}.\\n\")\n f.flush\n sleep 0.1\n end\n status.set_percentage((t * 100) / 15) if flag == :with_progress\n sleep 0.5\n end\n end\n end\n end\n end", "title": "" }, { "docid": "28f6ec75354f02637065251ac5593d43", "score": "0.58332396", "text": "def set_status(status)\n @status = status\n end", "title": "" }, { "docid": "cbce1cef4ee492a488c0ba4e7c2096ef", "score": "0.58300674", "text": "def status!\n fail NotImplementedError, 'Must implement #status!'\n end", "title": "" }, { "docid": "049274bb52e25d100d86283e154ae1f5", "score": "0.5817704", "text": "def update_status\n self.status = check_board\n end", "title": "" }, { "docid": "a3084dd8178270df57cbef2d893952a1", "score": "0.58170044", "text": "def status_command(arg = nil)\n set_or_return(\n :status_command,\n arg,\n :kind_of => [ String, NilClass, FalseClass ]\n )\n end", "title": "" }, { "docid": "5c86cbd7315357fe6aecf09e29f64563", "score": "0.5815305", "text": "def set_status(status)\n @status = status\n end", "title": "" }, { "docid": "044fb855b1874c584c27a33bdab693c1", "score": "0.5806751", "text": "def status=(status)\n @status = status.to_i\n end", "title": "" }, { "docid": "4f8e9b8a050718834e865a7b829813f8", "score": "0.5806349", "text": "def toggle_status\n @completion_status = !@completion_status\n end", "title": "" }, { "docid": "f04c175913ac466e26cdc015224183d5", "score": "0.579675", "text": "def status\n @status || super\n end", "title": "" }, { "docid": "f04c175913ac466e26cdc015224183d5", "score": "0.579675", "text": "def status\n @status || super\n end", "title": "" }, { "docid": "38b74a721997aabf8fbddf9e771a73a4", "score": "0.5786564", "text": "def update\n # If it's not done, mark it as done, and vice versa\n @completed_status = !@completed_status\n puts \"The completion status of #{@description} is now #{completed_status}.\"\n end", "title": "" }, { "docid": "792db72587949f2979ea7f085871e018", "score": "0.57856023", "text": "def toggle_status\n @completion_status = \"(X)\"\n end", "title": "" }, { "docid": "28490053d898c252124ce106ec29724c", "score": "0.5777399", "text": "def setStatus(status)\r\n\t\t\t\t\t@status = status\r\n\t\t\t\tend", "title": "" }, { "docid": "28490053d898c252124ce106ec29724c", "score": "0.5777399", "text": "def setStatus(status)\r\n\t\t\t\t\t@status = status\r\n\t\t\t\tend", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5774066", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5773339", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5773339", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5773339", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5773339", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5773339", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5773339", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5773339", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5773339", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5773339", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5773339", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5773339", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5773339", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5773339", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5773339", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5773339", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5773339", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5773239", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5772987", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5772987", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5772987", "text": "def status=(value)\n @status = value\n end", "title": "" }, { "docid": "95abbf82b6367ee48fd28473a1605787", "score": "0.5772987", "text": "def status=(value)\n @status = value\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "1dfeb1742268d111798fc5e0253b5388", "score": "0.0", "text": "def set_venta\n @venta = Venta.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59219855", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.589884", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889191", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58780754", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5863248", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.58094144", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.57375425", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57285565", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.57149214", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.56900954", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.56665677", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.5651118", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5648135", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56357735", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5627078", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5608873", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5598699", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5598419", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5589822", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55084664", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.5504379", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465574", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.5464707", "text": "def on_setup(&block); end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54471064", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54455084", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5437386", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54160327", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5397424", "text": "def post_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392518", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.5385411", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53487605", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5346655", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53448105", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5342072", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5341318", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53243506", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53025913", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.5283114", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5282289", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.52585614", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.52571374", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.52483684", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.5244467", "text": "def action_awareness\n if action_aware?\n if [email protected]?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.5236853", "text": "def after_setup\n end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52330637", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52300817", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.522413", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.521999", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.5215832", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.5213786", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.52100146", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52085197", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5203262", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5202406", "text": "def performed(action)\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.520174", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.5201504", "text": "def create_setup\n \n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.5191404", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5178325", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.51765746", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.5162045", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5150735", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.5143402", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51415485", "text": "def code_action_provider; end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51376045", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.51318985", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.5115387", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5109771", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5107364", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.5106081", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51001656", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50964546", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.5093199", "text": "def add_callbacks(base); end", "title": "" } ]
0094f4119ed351a4ee87a3eb001e74be
Add a PlainLocal to the local table.
[ { "docid": "a7650086923e4426e6b391f4d812d35b", "score": "0.6548758", "text": "def plain(name)\n locals << PlainLocal.new(name) unless has?(name)\n end", "title": "" } ]
[ { "docid": "f535160e676fa9cc734ff2c71bf09196", "score": "0.5868491", "text": "def create_local_datum(_name, local_datum_type)\n LocalDatum.create(name, local_datum_type)\n end", "title": "" }, { "docid": "2c0e82d6f2bad3348a2e62cae48c16db", "score": "0.5733348", "text": "def enterLocal(name)\n path = @path.clone\n path.addName(name)\n self[name] = SymTabGen.generateEntry(name,path,@level + 1)\n self[name]\n end", "title": "" }, { "docid": "02e1a05bfb31e02ebcdae8d4aef87fd9", "score": "0.5587908", "text": "def set_type_local\n @type_local = TypeLocal.find(params[:id])\n end", "title": "" }, { "docid": "d9f910a14727f2783efbd7aa3872e9a2", "score": "0.5554411", "text": "def create \n @local = Local.new(locals_params) \n if @local.save \n flash[:notice] = 'Store added!' \n redirect_to locals_path \n else \n flash[:error] = 'Failed to edit local!' \n render :new \n end \n end", "title": "" }, { "docid": "43dd0ce73c8144f0354256b58f60b850", "score": "0.5520022", "text": "def add_localgroup(localgroup, server_name = nil)\n # Set up the # LOCALGROUP_INFO_1 structure.\n addr_group = session.railgun.util.alloc_and_write_wstring(localgroup)\n # https://docs.microsoft.com/windows/desktop/api/lmaccess/ns-lmaccess-localgroup_info_1\n localgroup_info = [\n addr_group, # lgrpi1_name\n 0x0 # lgrpi1_comment\n ].pack(client.arch == ARCH_X86 ? \"VV\" : \"QQ\")\n result = client.railgun.netapi32.NetLocalGroupAdd(server_name, 1, localgroup_info, 4)\n client.railgun.multi([\n [\"kernel32\", \"VirtualFree\", [addr_group, 0, MEM_RELEASE]], # addr_group\n ])\n return result\n end", "title": "" }, { "docid": "53c93690441469552b37dc83da7466d6", "score": "0.545447", "text": "def local_table; end", "title": "" }, { "docid": "a00701233edcd71eb89e166b08bb6e4e", "score": "0.545433", "text": "def local=(value)\n @local = value\n end", "title": "" }, { "docid": "d8802c819c3300dc1a3c4d457c811403", "score": "0.54497707", "text": "def create\n @type_local = TypeLocal.new(type_local_params)\n\n respond_to do |format|\n if @type_local.save\n format.html { redirect_to @type_local, notice: 'Type local was successfully created.' }\n format.json { render :show, status: :created, location: @type_local }\n else\n format.html { render :new }\n format.json { render json: @type_local.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "75fa9b42af827963f4d0022960a67dc5", "score": "0.541635", "text": "def add_local_definition(identifier, type); end", "title": "" }, { "docid": "ba34d5bb90b4156e4316ef2985b4f8c7", "score": "0.5308764", "text": "def set_local\n @local = Local.find(params[:local][:id])\n end", "title": "" }, { "docid": "ed39910cefdc6dd765a2b84049be6f89", "score": "0.52493584", "text": "def create\n @local = Local.new(local_params)\n @caminho = admin_locals_path\n\n respond_to do |format|\n if @local.save\n format.html { redirect_to admin_local_path(@local), notice: 'Local was successfully created.' }\n format.json { render :show, status: :created, location: @local }\n else\n format.html { render :new }\n format.json { render json: @local.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9df0efef3a570788d230a3ef914745f5", "score": "0.5219841", "text": "def new \n @local = Local.new \n end", "title": "" }, { "docid": "d73e0d28c894e989ee9d62235a027200", "score": "0.5187961", "text": "def create\n @local = current_propietario_local.locals.new(local_params)\n respond_to do |format|\n if @local.save\n format.html { redirect_to locals_mis_locales_path, notice: 'Tu local fue creado con éxito.' }\n format.json { render :show, status: :created, location: @local }\n else\n format.html { render :new }\n format.json { render json: @local.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c41d8eaae839f68e53837feb07f0daf", "score": "0.51789457", "text": "def create\n @local = Local.new(local_params)\n respond_to do |format|\n if @local.save\n format.html { redirect_to @local, notice: 'Local was successfully created.' }\n format.json { render :show, status: :created, location: @local }\n else\n format.html { render :new }\n format.json { render json: @local.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85151d460639e92a5e5497c5e63dd86b", "score": "0.5160995", "text": "def add_members_localgroup(localgroup, username, server_name = nil)\n addr_username = session.railgun.util.alloc_and_write_wstring(username)\n # Set up the LOCALGROUP_MEMBERS_INFO_3 structure.\n # https://docs.microsoft.com/windows/desktop/api/lmaccess/ns-lmaccess-localgroup_members_info_3\n localgroup_members = [\n addr_username,\n ].pack(client.arch == ARCH_X86 ? \"V\" : \"Q\")\n result = client.railgun.netapi32.NetLocalGroupAddMembers(server_name, localgroup, 3, localgroup_members, 1)\n client.railgun.multi([\n [\"kernel32\", \"VirtualFree\", [addr_username, 0, MEM_RELEASE]],\n ])\n return result\n end", "title": "" }, { "docid": "db2f825aa4602efa4ad926b28d6a4c01", "score": "0.5158318", "text": "def set_local\n @local = Local.find(params[:id])\n end", "title": "" }, { "docid": "db2f825aa4602efa4ad926b28d6a4c01", "score": "0.5158318", "text": "def set_local\n @local = Local.find(params[:id])\n end", "title": "" }, { "docid": "db2f825aa4602efa4ad926b28d6a4c01", "score": "0.5158318", "text": "def set_local\n @local = Local.find(params[:id])\n end", "title": "" }, { "docid": "db2f825aa4602efa4ad926b28d6a4c01", "score": "0.5158318", "text": "def set_local\n @local = Local.find(params[:id])\n end", "title": "" }, { "docid": "db2f825aa4602efa4ad926b28d6a4c01", "score": "0.5158318", "text": "def set_local\n @local = Local.find(params[:id])\n end", "title": "" }, { "docid": "db2f825aa4602efa4ad926b28d6a4c01", "score": "0.5158318", "text": "def set_local\n @local = Local.find(params[:id])\n end", "title": "" }, { "docid": "db2f825aa4602efa4ad926b28d6a4c01", "score": "0.5158318", "text": "def set_local\n @local = Local.find(params[:id])\n end", "title": "" }, { "docid": "db2f825aa4602efa4ad926b28d6a4c01", "score": "0.5158318", "text": "def set_local\n @local = Local.find(params[:id])\n end", "title": "" }, { "docid": "db2f825aa4602efa4ad926b28d6a4c01", "score": "0.5158318", "text": "def set_local\n @local = Local.find(params[:id])\n end", "title": "" }, { "docid": "446771d5c234cf762a9fc3a66080781f", "score": "0.5153075", "text": "def create\n @local = Local.new(local_params)\n\n respond_to do |format|\n if @local.save\n format.html { redirect_to @local, notice: 'Local was successfully created.' }\n format.json { render :show, status: :created, location: @local }\n else\n format.html { render :new }\n format.json { render json: @local.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "446771d5c234cf762a9fc3a66080781f", "score": "0.5153075", "text": "def create\n @local = Local.new(local_params)\n\n respond_to do |format|\n if @local.save\n format.html { redirect_to @local, notice: 'Local was successfully created.' }\n format.json { render :show, status: :created, location: @local }\n else\n format.html { render :new }\n format.json { render json: @local.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0bf0b333b97fe2e92df6a48f671788c9", "score": "0.50891805", "text": "def add_local_definition(identifier, type)\n name = identifier.value.delete_suffix(\":\")\n\n local =\n if type == :argument\n locals[name] ||= Local.new(type)\n else\n resolve_local(name, type)\n end\n\n local.add_definition(identifier.location)\n end", "title": "" }, { "docid": "e3212ad36e04027b08297062217043f6", "score": "0.5039431", "text": "def set_local\n @local = Local.find(params[:id])\n end", "title": "" }, { "docid": "ec585b087bb6315964525d98ef33c94c", "score": "0.50270665", "text": "def local(size, locals, id)\n # I don't understand the scheme to translating the number in the getlocal and setlocal instructions to local\n # variable indicies. This seems to work for the examples that we have. Please fix if you understand it!\n local = locals[2 + size - id]\n raise unless local\n local\n end", "title": "" }, { "docid": "15c78f4d8d2f95065bf9d1487028b6bc", "score": "0.50183684", "text": "def ext_local\n mod = context_module('Local')\n return self if is_a?(mod)\n extend(mod).ext_local\n end", "title": "" }, { "docid": "f0a5d9f36db9338a96c42951104bb02f", "score": "0.5003197", "text": "def write_local_header\n write_bytes(local_header)\n end", "title": "" }, { "docid": "4e404ee5bffab8674789dcbed5129e59", "score": "0.49879783", "text": "def create\n @local = Local.new(params[:local])\n\n respond_to do |format|\n if @local.save\n if params[:submit_and_go_to_new]\n flash.now[:notice] = t('general.messages.create_success', model_name: t('activerecord.models.local'))\n else\n flash[:notice] = t('general.messages.create_success', model_name: t('activerecord.models.local'))\n end\n format.html { redirect_to edit_local_path(@local) }\n format.json { render json: @local, status: :created, location: @local }\n format.js { render action: 'save.js.erb' }\n else\n flash.now[:error] = t('general.messages.create_error', model_name: t('activerecord.models.local'))\n format.html { render action: \"new\" }\n format.json { render json: @local.errors, status: :unprocessable_entity }\n format.js { render action: 'save.js.erb' }\n end\n end\n end", "title": "" }, { "docid": "ca3515fa5f73076f90b99aa2b420b4ac", "score": "0.49781567", "text": "def local_params\n params.require(:local).permit(:foto, :nro_local, :ubicacion_pasillo, :area_planta, :area_terraza, :area_mezanina, :tipo_local_id, :tipo_estado_local, :nivel_mall_id, :mall_id)\n end", "title": "" }, { "docid": "1dddb5749ba48b4a113ca3f7cc61bcb4", "score": "0.49722487", "text": "def add_local_usage(identifier, type)\n name = identifier.value.delete_suffix(\":\")\n resolve_local(name, type).add_usage(identifier.location)\n end", "title": "" }, { "docid": "9ed4706861b72dd6b2536b6584eff49b", "score": "0.49702132", "text": "def type_local_params\n params.require(:type_local).permit(:name)\n end", "title": "" }, { "docid": "5f3442f376d8ed61050d44fa2cefcbc7", "score": "0.49591127", "text": "def create\n self.validar_admin\n @local = Local.new(local_params)\n\n respond_to do |format|\n if @local.save\n format.html { redirect_to @local, notice: 'Local was successfully created.' }\n format.json { render :show, status: :created, location: @local }\n else\n format.html { render :new }\n format.json { render json: @local.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2b396766d1df7a13513b3e7777702f6a", "score": "0.49558473", "text": "def add_local_data(hsh)\n if(hsh.is_a?(Hash))\n @local.push hsh\n else\n raise TypeError.new \"Expecting Hash value. Received: #{ary.class}\"\n end\n self\n end", "title": "" }, { "docid": "9908123648a6c2adf2f1fc139da13f8b", "score": "0.49523467", "text": "def add_lvar(lvar)\n @cblock[:lvars][lvar] ||= { kind: :local }\n end", "title": "" }, { "docid": "c26a4fadbbf7dba8c49663abfbadfa0b", "score": "0.49430442", "text": "def local_params\n params.require(:local).permit(:name, :description, :lat, :long, :status)\n end", "title": "" }, { "docid": "f9ec5c8bbb2229c4e82c69a99cc473e3", "score": "0.49394616", "text": "def create\n @local = Local.new(local_params)\n @local.usuario = current_usuario\n\n respond_to do |format|\n if @local.save\n format.html { redirect_to new_turma_sem_local_path @local, notice: 'Novo local cadastrado com sucesso. Verifique se já está aparecendo na lista' }\n format.json { render :show, status: :created, location: @local }\n else\n format.html { render :new }\n format.json { render json: @local.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c009c83b387d21e868e927d9a538fd8", "score": "0.49047655", "text": "def local= value\r\n value = value.to_s\r\n @attributes['local'] = value\r\n value.to_number\r\n end", "title": "" }, { "docid": "ad4f0bb88d1a720f3b53506774b1a608", "score": "0.4894617", "text": "def local; end", "title": "" }, { "docid": "ad4f0bb88d1a720f3b53506774b1a608", "score": "0.4894617", "text": "def local; end", "title": "" }, { "docid": "ad4f0bb88d1a720f3b53506774b1a608", "score": "0.4894617", "text": "def local; end", "title": "" }, { "docid": "ad4f0bb88d1a720f3b53506774b1a608", "score": "0.4894617", "text": "def local; end", "title": "" }, { "docid": "ad4f0bb88d1a720f3b53506774b1a608", "score": "0.4894617", "text": "def local; end", "title": "" }, { "docid": "378e75a2ea1aa0f6e9c00ebfa4c20831", "score": "0.48382643", "text": "def local_params\n params.require(:local).permit(:nome, :cidade_id, :endereco, :latitude, :longitude)\n end", "title": "" }, { "docid": "79f47ba069918a36adf3c70dbacb9773", "score": "0.4820865", "text": "def initialize(local)\n @local = local\n end", "title": "" }, { "docid": "b3006a77451b146587a41a91f87358b0", "score": "0.4788666", "text": "def preprocess_local\n logger.debug 'Local type preprocess'\n begin\n validate 'local'\n rescue Exception => e\n @body[:skip] = true\n raise e\n end\n end", "title": "" }, { "docid": "64208c2b3aea664296a6338e33554071", "score": "0.47768334", "text": "def local=(_); end", "title": "" }, { "docid": "64208c2b3aea664296a6338e33554071", "score": "0.47768334", "text": "def local=(_); end", "title": "" }, { "docid": "4f7d18d24288ba049b2bcb22f903761e", "score": "0.4774322", "text": "def set_local_info\n @local_info = LocalInfo.find(params[:id])\n end", "title": "" }, { "docid": "c3d5b823ad65f64d4fa4c77ce891d2a9", "score": "0.47719637", "text": "def ocupar_local local\n # Caso esteja tentando ocupar o mesmo local, pára\n return if @local == local\n\n # Sai do local atual:\n @local.desocupar self unless @local.nil?\n\n # Cria a referência para o novo local\n @local = local\n\n # Ocupa o novo local\n @local.ocupar self unless @local.nil?\n\n # Começa uma conquista se o local é uma cidade\n if [email protected]? and @local.is_cidade and @local.jogador != @jogador\n @jogador.adicionar_atividade AtConquista.new(self, @local)\n end\n end", "title": "" }, { "docid": "805d3f1919ec13d243f7206c4a46aae2", "score": "0.476262", "text": "def local_params\n params.require(:local).permit(:No_Local, :No_Direccion, :Nu_Telefono, :Tx_Correo)\n end", "title": "" }, { "docid": "6ed147ab2ad2c2406f73d2ff59ae1583", "score": "0.47358587", "text": "def quote_local_table_name(name)\n return name if ::Arel::Nodes::SqlLiteral === name\n\n @connection.quote_local_table_name(name)\n end", "title": "" }, { "docid": "3bf24e5d135199a408381beb8f13fd03", "score": "0.47307366", "text": "def local_params\n params.require(:local).permit(:nom, :nombrePlaces, :point_service_id)\n end", "title": "" }, { "docid": "d05e19f3fa4835f12b7f8fb6d0a2124f", "score": "0.47271478", "text": "def local_params\n params.require(:local).permit(:nome, :cep, :rua, :numero, :cidade_id, :bairro, :telefone,:ativo)\n end", "title": "" }, { "docid": "1407d4a6459b29d2d1ae3e17b10ac6bf", "score": "0.47250867", "text": "def add_local_usage(identifier, type); end", "title": "" }, { "docid": "89312027b00b2a08bde51209c0c7a6d6", "score": "0.47092184", "text": "def create_local\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n @tmpl_folder, @tmpl_local_folder = TemplatesHelper.get_tmpl_subfolder(TemplatesHelper::TMPL_LOCAL)\n\n unless @tmpl_local_folder.nil?\n item = Item.new_info(@tmpl_local_folder.id)\n item.title = t('template.new')\n item.user_id = 0\n item.save!\n else\n Log.add_error(request, nil, '/'+TemplatesHelper::TMPL_ROOT+'/'+TemplatesHelper::TMPL_LOCAL+' NOT found!')\n end\n\n render(:partial => 'ajax_local', :layout => false)\n end", "title": "" }, { "docid": "55b195c4b335e20288ccd6f1cca10fa9", "score": "0.47027853", "text": "def local_params\n params.require(:local).permit([:nome,:codigo,:municipio,:escola,:setorial,:secretaria,:local_pai])\n end", "title": "" }, { "docid": "0ec4d51781201379039d33047aa2de5a", "score": "0.47006288", "text": "def local\n @local\n end", "title": "" }, { "docid": "b3660a8adc15ebc8f5ccfa363c15474d", "score": "0.4693825", "text": "def set_tbl_localidad\n @tbl_localidad = TblLocalidad.find(params[:id])\n end", "title": "" }, { "docid": "2dd3a1d6401b612a17179ca6aeb4ab96", "score": "0.46886", "text": "def follow_local!(local)\n users_follow_locals.create!(followed_id:local.id)\n end", "title": "" }, { "docid": "0f96097940f4d023ad496742c8952f5c", "score": "0.46791497", "text": "def local_time(*args)\n time_with_datetime_fallback(:local, *args)\n end", "title": "" }, { "docid": "0f96097940f4d023ad496742c8952f5c", "score": "0.46791497", "text": "def local_time(*args)\n time_with_datetime_fallback(:local, *args)\n end", "title": "" }, { "docid": "a2a7a52c8e56553c7dfa350ce6bac717", "score": "0.4674521", "text": "def parse_local(header_id, data)\n new(header_id, data, false)\n end", "title": "" }, { "docid": "715af14515a561208203cc5b1153f8f9", "score": "0.46676323", "text": "def name\n 'local'\n end", "title": "" }, { "docid": "53de8d84ecb9f5be6a10c65ced2cfbe4", "score": "0.46566278", "text": "def add_sticky_local(name, &block); end", "title": "" }, { "docid": "53de8d84ecb9f5be6a10c65ced2cfbe4", "score": "0.46566278", "text": "def add_sticky_local(name, &block); end", "title": "" }, { "docid": "01f377f8d1f90decd5b16baacb8263ee", "score": "0.46373382", "text": "def local_params\n params.require(:local).permit(:nombre, :comuna_id, :direccion, :descripcion, :imagen, :busqueda)\n end", "title": "" }, { "docid": "b09bc351cc8b6fec877744312e652a58", "score": "0.4634735", "text": "def addLocalFileToBeTransfered(iLocalFileName)\n rError = nil\n\n # Get the set of files to be transfered\n rError, lTransferFiles = getFilesToBeTransfered\n if (rError == nil)\n # Increment its usage counter\n if (lTransferFiles[iLocalFileName] == nil)\n lTransferFiles[iLocalFileName] = 1\n else\n lTransferFiles[iLocalFileName] += 1\n end\n # Write the files to be transfered\n rError = putFilesToBeTransfered(lTransferFiles)\n end\n\n return rError\n end", "title": "" }, { "docid": "6b68001812a5dabf11e75440e4c16826", "score": "0.46275383", "text": "def local(key)\n if respond_to?(key)\n __send__(key)\n else\n locals.fetch(key) { NullLocal.new(key) }\n end\n end", "title": "" }, { "docid": "f80f8dfc0b087948ebdbf6d273c3e84b", "score": "0.46109065", "text": "def set_localtion\n @localtion = Localtion.find(params[:id])\n end", "title": "" }, { "docid": "35e3cc2bc14778101fcecdc6027e5254", "score": "0.45923465", "text": "def local(*args)\n time = Time.utc(*args)\n ActiveSupport::TimeWithZone.new(nil, self, time)\n end", "title": "" }, { "docid": "7e285414d4ae57a01f1da751024f882b", "score": "0.4585175", "text": "def add_local_user(id, user)\n @@connected_users[id.to_s.to_sym] = user\n end", "title": "" }, { "docid": "29866fee3b27bbf76e12aa6df71fe896", "score": "0.45813712", "text": "def local_time(*args)\n time_with_datetime_fallback(:local, *args)\n end", "title": "" }, { "docid": "0169c49d250ebf6e4bb4c898043c3735", "score": "0.45772445", "text": "def set_local_data(ary)\n if(ary.is_a?(Array))\n @local = ary\n else\n raise TypeError.new \"Expecting Array value. Received: #{ary.class}\"\n end\n self\n end", "title": "" }, { "docid": "31af6e7cb5e29b3f7a19d85fa9be6c89", "score": "0.45537022", "text": "def with_local_root(local_root)\n with_view(view.with_local_root(local_root))\n end", "title": "" }, { "docid": "b7cd900f2fc36939f31cac360abbdd2b", "score": "0.45428497", "text": "def addTable\n # It could be just a temporary solution for inconsistency between fully\n # and partially qualified objects' names before we integrate SymbolTable\n # calls closer to the generation layer.\n # @st.clearFlag(:SCHEMA)\n @st.addTable[:NAME]\n end", "title": "" }, { "docid": "f8b675e81a018f3bc652d1999bae4223", "score": "0.45428318", "text": "def local?\n @type == \"local\"\n end", "title": "" }, { "docid": "cb166a0df32ef2d54c7e1e309841c22e", "score": "0.4542724", "text": "def create_localcontext=(createLocalContext)\n self.add_option(key: :localcontext, value: createLocalContext)\n createLocalContext\n end", "title": "" }, { "docid": "3280db5452008729255dd72e5b92980c", "score": "0.4540018", "text": "def update \n @local = Local.find(params[:id]) \n if @local.update_attributes(locals_params) \n flash[:notice] = 'Store updated!' \n redirect_to locals_path \n else \n flash[:error] = 'Failed to edit local!' \n render :edit \n end \n end", "title": "" }, { "docid": "fd118a6bda85927d305a8ede79c50c2c", "score": "0.45288545", "text": "def local_params\n params.require(:local).permit(:rol,:pago,:giro,:fecha_otorgada,:codigo_sii,:rol_propiedad,:numero,:calle,:casa,:departamento,:oficina,:local)\n end", "title": "" }, { "docid": "e6cbd142117146faca81df42c913d023", "score": "0.4525331", "text": "def assign_local_reference(var)\n unless variable = variables[var.name]\n variable = new_local var.name\n end\n\n var.variable = CompilerNG::LocalReference.new variable\n end", "title": "" }, { "docid": "4f0ac86b3207d2810832b7fb325229de", "score": "0.45202303", "text": "def load_local name, parent = nil\n raise NotImplementedError\n end", "title": "" }, { "docid": "23c9e759c719b010d464e168c53fd3a5", "score": "0.45155442", "text": "def local(*args); end", "title": "" }, { "docid": "23c9e759c719b010d464e168c53fd3a5", "score": "0.45155442", "text": "def local(*args); end", "title": "" }, { "docid": "23c9e759c719b010d464e168c53fd3a5", "score": "0.45155442", "text": "def local(*args); end", "title": "" }, { "docid": "2299650749e713a4eba5e535ad0047d8", "score": "0.45064902", "text": "def create_local\n uuid = @data.dig(:id)\n\n log_event \"[I] Creating local political_force #{uuid}\"\n\n @entity = PoliticalForce.new(uuid: uuid)\n\n apply_for_update\n\n @entity.save\n @entity\n end", "title": "" }, { "docid": "d325f1cb60ca3b2fc9f28a70bf4bf5ba", "score": "0.44996518", "text": "def local_params\n params.require(:local).permit( :nome, :descricao, :endereco,\n :usuario, :imagem, :cidade, :pais, :estadoprovincia, :contato1, :contato2, :latitude, :longitude) # List here whitel\n end", "title": "" }, { "docid": "383f1a9e8e26d8c47de6914ad77ebb1e", "score": "0.44964263", "text": "def inject_local(name, value, binding); end", "title": "" }, { "docid": "383f1a9e8e26d8c47de6914ad77ebb1e", "score": "0.44964263", "text": "def inject_local(name, value, binding); end", "title": "" }, { "docid": "f8ef27a3045a6f07e141264a595480f9", "score": "0.44843873", "text": "def new\n @local = Local.new\n\n respond_to do |format|\n format.html { render layout: nil } # new.html.erb\n format.json { render json: @local }\n end\n end", "title": "" }, { "docid": "f5dd3901107a8849ef3d74b4519bcfb3", "score": "0.44640678", "text": "def register_local(obj)\n\t\tid = generate_id()\n\t\t@locals[id] = obj\n\t\tregister_object(obj,id)\n\t\tput_network( NewObjectEvent(id,obj) )\n\tend", "title": "" }, { "docid": "499ed344109c6b7c58b6b1cc83cb2a7c", "score": "0.4461867", "text": "def importToLocal(entry)\n name = entry.getName\n entry = entry.clone\n path = @path.clone\n path.addName(name)\n entry.setPath(path)\n self[name] = entry\n end", "title": "" }, { "docid": "eab9b4d64486d2717e847756967b8f46", "score": "0.44584084", "text": "def local_params\n params.require(:local).permit(:descricao)\n end", "title": "" }, { "docid": "f3f4835bb95cba6ae0cce7bb3be6e6a6", "score": "0.44578847", "text": "def add(table_name); end", "title": "" }, { "docid": "86b462afe7c135b14788d3d976a45c4b", "score": "0.4457761", "text": "def append_local_identity\n if own_password && !identities.exists?(service: 'local')\n local_identity = Identity.new(service: 'local',\n token: SecureRandom.hex(5),\n name: 'Bruse',\n uid: SecureRandom.uuid)\n identities << local_identity\n end\n end", "title": "" }, { "docid": "2cc91b8b23196d3db1b40d7f7cd50b55", "score": "0.4457472", "text": "def <<(local_path_to_file)\n add(local_path_to_file)\n self\n end", "title": "" }, { "docid": "e4fb0b7ebf67dad737a35562d80e6de1", "score": "0.44427606", "text": "def locals_params \n params.require(:local).permit(:name, :review, :address, :website) \n end", "title": "" } ]
a10c90814c6935d51eda0b0fa992d872
Notify the GUI that we are quitting
[ { "docid": "319e155e616cbe59b18f1724c4fc27f7", "score": "0.67914134", "text": "def notifyExit\n # Stop Timers of the Controller\n @TimersManager.killTimers\n # Notify everybody\n notifyRegisteredGUIs(:onExiting)\n # Delete any integration plugin instance\n @Options[:intPluginsOptions].each do |iPluginID, ioPluginsList|\n ioPluginsList.each do |ioInstantiatedPluginInfo|\n iTagID, iActive, iOptions, ioInstanceInfo = ioInstantiatedPluginInfo\n ioInstance, iTag = ioInstanceInfo\n if (ioInstance != nil)\n # We have to delete the instance\n log_debug \"Delete integration plugin #{iPluginID} for Tag #{iTagID.join('/')}\"\n accessIntegrationPlugin(iPluginID) do |iPlugin|\n # Unregister it if it was registered\n if (iActive)\n unregisterGUI(ioInstance)\n end\n iPlugin.deleteInstance(self, ioInstance)\n end\n end\n end\n end\n # Write tips index in options first\n if (@TipsProvider != nil)\n @Options[:lastIdxTip] = @TipsProvider.current_tip\n end\n # Save options\n saveOptionsData(@Options, @DefaultOptionsFile)\n end", "title": "" } ]
[ { "docid": "4539598914155804b98f5e3f34a9c0f4", "score": "0.72316206", "text": "def quit\n Gtk.main_quit\n end", "title": "" }, { "docid": "40b1c12cbbc4f450ca29d6cb4f87d665", "score": "0.71999997", "text": "def on_prompting_for_quit\n end", "title": "" }, { "docid": "a3884f33bfdcbc87844b3105a82e8919", "score": "0.7160841", "text": "def on_quitting\n end", "title": "" }, { "docid": "79caa4428ce453d58f9ec204478b2b52", "score": "0.7127055", "text": "def quit\n ui.quit\n Dumon::logger.info 'Terminted...'\n end", "title": "" }, { "docid": "d4b5a840920e50c5aa10dc5b6cbc99c5", "score": "0.7057905", "text": "def on_quit\n end", "title": "" }, { "docid": "7ecd3b081228a87fb04747b5075dbab3", "score": "0.6979096", "text": "def will_quit\n end", "title": "" }, { "docid": "21b0ae3bd93258edf65b8ec52e66737a", "score": "0.6977993", "text": "def quit; @quit = 1 end", "title": "" }, { "docid": "de7bed430dd401db38c47db57e8b109a", "score": "0.697024", "text": "def onClose(sender, sel, event)\n $app.exit(0)\n end", "title": "" }, { "docid": "de7bed430dd401db38c47db57e8b109a", "score": "0.697024", "text": "def onClose(sender, sel, event)\n $app.exit(0)\n end", "title": "" }, { "docid": "cca291a692a1be126cbb7d0b4fad08d3", "score": "0.6960059", "text": "def quit\n end", "title": "" }, { "docid": "c19d384a09c47740ab28530d15d6328e", "score": "0.6956508", "text": "def quit!\n quit\n exit!\n end", "title": "" }, { "docid": "a34b145040f310d2a6ab1a2794c8178e", "score": "0.6950879", "text": "def quit; end", "title": "" }, { "docid": "a34b145040f310d2a6ab1a2794c8178e", "score": "0.6950879", "text": "def quit; end", "title": "" }, { "docid": "dbc478d8f68e5cb5139022c9f62c7066", "score": "0.6925402", "text": "def exit\n stop\n $window.deleteAllWidgets\n $window.createWidgets\n $window.deleteAllImages\n $window.cursor.unforceVisible\n terminate\n end", "title": "" }, { "docid": "78447be71e174b6fbba60ced846dae95", "score": "0.6875433", "text": "def quit\n @ui.close\n @player.close\n @logger.close\n exit\n end", "title": "" }, { "docid": "78447be71e174b6fbba60ced846dae95", "score": "0.6875433", "text": "def quit\n @ui.close\n @player.close\n @logger.close\n exit\n end", "title": "" }, { "docid": "02d8d3b43cebeb60786a0b56a3873500", "score": "0.68636864", "text": "def quit\n Gamework::App.quit\n end", "title": "" }, { "docid": "5776c6da5042566310c91b1de01b5de9", "score": "0.682242", "text": "def quit\n abort (\"Thanks for checking it out!\") \nend", "title": "" }, { "docid": "2d2ffce0d75b6c48e62cd34b38c7ea0e", "score": "0.6767815", "text": "def force_quit; @quit = 2 end", "title": "" }, { "docid": "073f6533f8b9b3007149d81eba9f7054", "score": "0.6748504", "text": "def quit\n exit(1)\n end", "title": "" }, { "docid": "d357fb6ace689f8a41f511369c46de83", "score": "0.66968834", "text": "def quit\n send_cmd \"quit\"\n nil\n end", "title": "" }, { "docid": "d312e498709d4a2b3e81cd5bb1757ba4", "score": "0.66919667", "text": "def quit()\n @ole.Quit()\n end", "title": "" }, { "docid": "b560ad7e7ca165865509213c039caaac", "score": "0.66661423", "text": "def end\r\n onEnd\r\n $window.deleteAllWidgets\r\n $window.createWidgets\r\n $window.deleteAllImages\r\n $window.cursor.unforceVisible\r\n onTerminate\r\n end", "title": "" }, { "docid": "87c6cd48ce2e1920c234270544fbd549", "score": "0.6654369", "text": "def mouse_quit\n $game_system.se_play($data_system.cancel_se)\n if display_message(ext_text(8997, 42), 1, ext_text(8997, 33), ext_text(8997, 34)) == 0\n @return_data = false\n @running = false\n end\n end", "title": "" }, { "docid": "ad4d4abd01315e9cefa7651b43e8a167", "score": "0.6647638", "text": "def onDestroy\n puts \"Fin de l'application\"\n #Quit 'propre'\n Gtk.main_quit\n end", "title": "" }, { "docid": "ad4d4abd01315e9cefa7651b43e8a167", "score": "0.6647638", "text": "def onDestroy\n puts \"Fin de l'application\"\n #Quit 'propre'\n Gtk.main_quit\n end", "title": "" }, { "docid": "70d2b789793990d9f24971e0d6872f39", "score": "0.6646125", "text": "def mouse_quit\n $game_system.se_play($data_system.cancel_se)\n if display_message(ext_text(8997, 40), 1, ext_text(8997, 33), ext_text(8997, 34)) == 0\n @return_data = false\n @running = false\n end\n end", "title": "" }, { "docid": "0cdcdc3a11adcd5d73e7406c1807147f", "score": "0.664142", "text": "def exit\n @window.pause = true\n @window.close\n end", "title": "" }, { "docid": "eb97c456898d19c0ab3cf5c5647aa678", "score": "0.65773094", "text": "def quit\n @threads&.each do |t|\n t.kill.join\n end\n Gtk.main_quit\n end", "title": "" }, { "docid": "fe172ce695c0c3d54c24ee6abcef9bef", "score": "0.6559932", "text": "def quit\n abort(\"Thank you!\")\n end", "title": "" }, { "docid": "757dbfc9b016deb1555a228b02349ef1", "score": "0.655931", "text": "def quit?\n @quit\n end", "title": "" }, { "docid": "e9c8aa82c427aa782c57b40dd4ff0e20", "score": "0.655388", "text": "def exit\n\t\tquit\n\tend", "title": "" }, { "docid": "cf288a1e3ff91a54e6ed3c7f65e182a9", "score": "0.65425426", "text": "def quit\n system('clear')\n exit\n end", "title": "" }, { "docid": "2e413613c13997f518476cc698833ffa", "score": "0.6533296", "text": "def quit_command()\n @subSceneScan.hide_windows()\n @target_enemy_window.active = true\n end", "title": "" }, { "docid": "b3bc982bd269dd48137cc3207a6b6889", "score": "0.65217227", "text": "def on_MainWindow_destroy\n @wfsock.close\n Gtk.main_quit\n end", "title": "" }, { "docid": "3590204c2354d84ac6337345b93ed007", "score": "0.6518732", "text": "def quitting?; @quit > 0 end", "title": "" }, { "docid": "11b2030f80d29aa6645910c3e23d5fcc", "score": "0.6476404", "text": "def windowWillClose(notification)\n OSX::NSApp.terminate(self)\n end", "title": "" }, { "docid": "11b2030f80d29aa6645910c3e23d5fcc", "score": "0.6476404", "text": "def windowWillClose(notification)\n OSX::NSApp.terminate(self)\n end", "title": "" }, { "docid": "0fda512420a9ee2f3124c3b0b3178c5b", "score": "0.6432601", "text": "def exit\n @interface.hide\n # sth to destroy all dat shit??\n # Shut down propeller\n end", "title": "" }, { "docid": "37cb065dab29057092584c64811a6c8f", "score": "0.64307535", "text": "def quit\n puts 'The library is now closed for renovations'\n end", "title": "" }, { "docid": "b3dd2ae6941c4d6279620bf51d0f2a5f", "score": "0.6411532", "text": "def quit\n send_command(:quit)\n read_response # \"Bye!\"\n disconnect\n end", "title": "" }, { "docid": "d028770cfe6f3596b16a6a08afa8b452", "score": "0.640928", "text": "def confirm_quit\n connection.puts \"Are you sure you want to quit?\"\n if yes_entered?\n connection.close\n\n else\n @world.render\n end\n end", "title": "" }, { "docid": "6d1c513d9c74e8b403c5d4f1e802ff3c", "score": "0.6406363", "text": "def onQuit\n if DECORPOT_DOWNLOADS.length > 0\n #show_wikihouse_error \"Aborting downloads from #{WIKIHOUSE_TITLE}\"\n puts \"Aborting downloads from #{DECORPOT_TITLE}\"\n end\n if DECORPOT_UPLOADS.length > 0\n #show_wikihouse_error \"Aborting uploads to #{WIKIHOUSE_TITLE}\"\n puts \"Aborting uploads to #{DECORPOT_TITLE}\"\n end\n end", "title": "" }, { "docid": "104e0f2d034fc365b60483d07e422a64", "score": "0.6396556", "text": "def quit()\n @webdriver.quit()\n cleanUp();\n end", "title": "" }, { "docid": "0714e4101b53c704eddaaa3157c53324", "score": "0.63912064", "text": "def command_quit\n command_save\n exit(0)\n end", "title": "" }, { "docid": "6d6286be08c6fbd982249831e43d697e", "score": "0.6373392", "text": "def quit_command()\n @command_window.active = false\n $scene = Scene_Menu.new(3)\n end", "title": "" }, { "docid": "d63dee3bc57c42e5afbf9a4afa0e348b", "score": "0.63595515", "text": "def quit(reason = \"You told me to\")\n @t.puts \"QUIT :#{reason}\"\n exit\n end", "title": "" }, { "docid": "c9d42b6d196d95025675bb23bc148d19", "score": "0.6342155", "text": "def quit_command()\n return_scene\n end", "title": "" }, { "docid": "c9d42b6d196d95025675bb23bc148d19", "score": "0.6342155", "text": "def quit_command()\n return_scene\n end", "title": "" }, { "docid": "ce9e77af9ef51dc515bb269844f20327", "score": "0.6342027", "text": "def close_nx\n return @dialog.setCompleted unless @dialog.abortWasRequested\n\n @dialog.setMainStatusAndLogIt('Aborted')\n end", "title": "" }, { "docid": "1fb626b7b1bf91ec2c78a28d937229e8", "score": "0.6315676", "text": "def exit\n @main_loop = false\n end", "title": "" }, { "docid": "3de0d55f792411d3b3d311a9e27bc5aa", "score": "0.630209", "text": "def quit\r\n raise Shells::NotRunning unless running?\r\n raise Shells::ShellBase::QuitNow\r\n end", "title": "" }, { "docid": "5bb1a41f378c88c9b4b0c7da779fdfcd", "score": "0.6282756", "text": "def gtk_main_quit\n @ctrl.save_all_da_park\n Gtk::main_quit()\n end", "title": "" }, { "docid": "e3f7fe8f04365d0252300c8f7c2a6b60", "score": "0.6276151", "text": "def quit\n @open = false\n 'The library is now closed for renovations.'\n end", "title": "" }, { "docid": "49efed74daf3f02507cbfcccd769ba21", "score": "0.62648827", "text": "def waitQuit()\n @device.waitQuit() ;\n end", "title": "" }, { "docid": "a5ca157507e2c3174162cc26d6bbf76e", "score": "0.62612945", "text": "def quit\n @browser.close\n end", "title": "" }, { "docid": "dc0b4ea5f4251ebdfabfc20b7ff17976", "score": "0.6261136", "text": "def quit _signal = :SIGINT\n @networks.each do |network|\n network.transmit :QUIT, 'Got SIGINT?'\n network.disconnect\n end\n\n EventMachine.stop\n end", "title": "" }, { "docid": "293000f3e82a9a035d908692eaa78b77", "score": "0.6253209", "text": "def destroy\n self.timelog_stop_tracking\n \n #Use quit-variable to avoid Gtk-warnings.\n Gtk.main_quit if @quit != true\n @quit = true\n end", "title": "" }, { "docid": "a135a72c976b3e33a76fbcb5ec14df0c", "score": "0.62241316", "text": "def shutdown\n Termbox.tb_shutdown\n exit\n end", "title": "" }, { "docid": "c3fc0afd893e9ee6fe06c62f31e7c151", "score": "0.6214115", "text": "def CloseWindow\n @window.hide\n Gtk.main_quit\n end", "title": "" }, { "docid": "4f55e8e03fee8d2a62ff5eb6352d3064", "score": "0.62016743", "text": "def exit\n @dir_scanner.exit\n @exiting = true\n Gtk.main_quit\n clean_tmp_dir\n end", "title": "" }, { "docid": "625d76da3c8687a76c96d45b8122e7ef", "score": "0.61941093", "text": "def stop\n @quit = true\n end", "title": "" }, { "docid": "351b4e9886ac6c52945c18e510c52caf", "score": "0.6189468", "text": "def quit\n client.quit\n end", "title": "" }, { "docid": "039c0116133976547fc845e075185835", "score": "0.61888367", "text": "def forced_exit?; @quit > 1 end", "title": "" }, { "docid": "ed1a386d7d8857138e47e1e1f08809b3", "score": "0.61767685", "text": "def quit\n watchers.each(&:quit)\n end", "title": "" }, { "docid": "8e8460d08b6518914ac7b686b0800996", "score": "0.61627644", "text": "def quit(message=\"\")\n sendmsg \"QUIT :#{message}\"\n end", "title": "" }, { "docid": "e7a13c8e18de6222acc1c3fb0b2bbf76", "score": "0.61364025", "text": "def quit!(sticky: false)\n fade_length = 0\n\n unless sticky\n fade_length = FADE_LENGTH\n fade_out(fade_length)\n end\n\n set_progress(100)\n\n # TODO: Callback on a timer or on the fade_out animation end.\n # Though we **do** want to stop processing from the queue.\n # This is not a callback yet because we don't have an ergonomic way to\n # produce those callbacks for LVGL yet.\n exit_timestamp = Time.now + fade_length/1000.0 + PROGRESS_UPDATE_LENGTH/1000.0 + 0.1\n LVGUI.main_loop do\n if Time.now > exit_timestamp\n sleep(2) if LVGL::Introspection.simulator?\n exit(0)\n end\n end\n # (end TODO)\n end", "title": "" }, { "docid": "64cfd2f0db1774a0c2c77d37cb55e66f", "score": "0.61355513", "text": "def finalize!\n # Default is to not show a GUI\n @gui = false if @gui == UNSET_VALUE\n end", "title": "" }, { "docid": "64135415bc6d682299e7f914fc08e5a0", "score": "0.61103684", "text": "def quit_self\n @calendar_network.quit!\n end", "title": "" }, { "docid": "a687067a2723aca8552133cfa54108b9", "score": "0.6100804", "text": "def disconnect quit_message = \"Terminus-Bot: Terminating\"\n send_command 'QUIT', [], quit_message\n\n @disconnecting = true\n end", "title": "" }, { "docid": "cc37bf2c29f14b0b59c457ecb94ffe44", "score": "0.6097749", "text": "def game_exit\n Message.game_quit\n false\n end", "title": "" }, { "docid": "4c9b8fec0f8a3e068cc499f6ed67f9f7", "score": "0.60948855", "text": "def quit_driver()\n @driver.shutdown\n end", "title": "" }, { "docid": "3d1c16c8b91198934e8c03752d88eafa", "score": "0.6087723", "text": "def quit\n\t\[email protected]\n\tend", "title": "" }, { "docid": "ed537ce72f18c74522fc23d9a736e403", "score": "0.6071952", "text": "def sigExit(eventName,callerName,event,caller)\n\t\thideAll\n\t\[email protected]\n\tend", "title": "" }, { "docid": "edf6b3511474705a8663e85786768f56", "score": "0.60680586", "text": "def onDestroy()\n\t\tif @save_flag == true && @indiceTypeJeu == 0\n\t\t\tsave?()\n\t\tend\n Gtk.main_quit\n @window.destroy\n\n \t\tif @indiceTypeJeu != 2\n \t\t\tMenuPrincipal.new(@pseudo)\n else\n Gtk.main_quit\n end\n end", "title": "" }, { "docid": "0ff7c0bef80572d439627284beb361f6", "score": "0.6060201", "text": "def quit_on_delete!\n on_delete do\n quit\n end\n end", "title": "" }, { "docid": "5f0406346adfd224763be9533f5f4a2c", "score": "0.60491604", "text": "def close_window\n end", "title": "" }, { "docid": "7c04ba516bd3c8193064fa9d1f9abdd4", "score": "0.6036886", "text": "def quit\n Rubygame.quit()\n exit\n end", "title": "" }, { "docid": "127df3f098de6a1e7ebc5dd5ea8561ff", "score": "0.6026659", "text": "def destructionFen \n @v1.getWindow.destroy\n Gtk.main_quit\n end", "title": "" }, { "docid": "cf4d97a6e5aef1439135d207f9e4b1f6", "score": "0.6020291", "text": "def c_quit()\n \tputs \"closing mucs\"\n\tcb = proc { \n\t\tsleep 5\n\t\treturn 1\n\t}\n#\[email protected] {|chan,mucobj| }\n#\tEventMachine::defer (cb, proc {|r| on_quit(r)})\n\tend", "title": "" }, { "docid": "55d3aa5fdf511601db50b3f6593737ca", "score": "0.5992464", "text": "def icl_quit( args )\n if !(@foodDB.saved?) || !(@log.saved?)\n icl_save( @foodDB.path )\n end\n\n puts \"Thank you, have a nice day\"\n return 0\n end", "title": "" }, { "docid": "7d6275e3bb501135dfd127136ed5b578", "score": "0.5990948", "text": "def quit\r\n @@driver.quit\r\n end", "title": "" }, { "docid": "398204dd79a000e6e550246b60dd110e", "score": "0.5978915", "text": "def on_mainWindow_delete_event(widget, arg0)\n @db.close unless @db.nil?\n Gtk.main_quit\n end", "title": "" }, { "docid": "d46e8dbf7d5ef33b59a51675547d9da2", "score": "0.59787387", "text": "def quit\n submit({ :task => :quit })\n end", "title": "" }, { "docid": "354a6c32ffa09e3a544d8e49c8724b19", "score": "0.5969169", "text": "def quit(msg)\n if @started\n msg.reply('Game exited.'.freeze)\n @started = false\n @random_number = nil\n @tries = nil\n else\n msg.reply('There is not game to exit.'.freeze)\n end\n end", "title": "" }, { "docid": "17a12791921e88671bb5c274ad3aa7e0", "score": "0.59678155", "text": "def exit_session\n @window.dispose\n @viewport.dispose\n ShellOptions.save\n end", "title": "" }, { "docid": "2697a71041fbb1ab6f5020940fe6cbfd", "score": "0.5958198", "text": "def quit\n send_line('QUIT')\n reply = read_reply\n close\n reply\n end", "title": "" }, { "docid": "3ff25e5c80a95ed486a69777982ecd61", "score": "0.5956575", "text": "def quit _value=0\n send_cmd(\"quit #{_value}\")\n end", "title": "" }, { "docid": "3d71983a301f7fb931461c906f053d72", "score": "0.59551746", "text": "def on_exit\n end", "title": "" }, { "docid": "6b6e900fc0e65424239c5b945d9c9172", "score": "0.5952504", "text": "def quit\n resp = send_recv( KJess::Request::Quit.new )\n return KJess::Response::Eof === resp\n end", "title": "" }, { "docid": "2062df843bb3f0471995b91786547433", "score": "0.5950392", "text": "def quit # :nodoc:\n @master = @master.close if @master\n end", "title": "" }, { "docid": "5177a0c708ea22d7450e3f9254264b7b", "score": "0.59408045", "text": "def someone_did_quit(stem, person, msg)\n end", "title": "" }, { "docid": "d78f06509f97b52814f031b3305aa2ba", "score": "0.5936496", "text": "def quit(reason = 'bye')\n send_msg(\"QUIT :#{reason}\")\n @sock.close\n exit\n end", "title": "" }, { "docid": "dc912a0db1bdc3e96a7f92147d3d2995", "score": "0.5935308", "text": "def quitCmd\n\tputs \"Cient sent a quit command\"\nend", "title": "" }, { "docid": "7dfdc8608692fb809da1eba5edbcc38f", "score": "0.5934965", "text": "def exit_star\n stop_music\n abort(\"You're logged out\")\n end", "title": "" }, { "docid": "1ba85397cbef24a42e2d4515153a9763", "score": "0.5934167", "text": "def exit_program\n abort('Exiting...')\n end", "title": "" }, { "docid": "58bf91aebcb2467ac2abb0fd62326d6c", "score": "0.5924104", "text": "def finish() #method\n puts \"Menu cooked successfully.\"\n exit\n end", "title": "" }, { "docid": "598c950c1d2798385993b17bd9f7b43a", "score": "0.5923424", "text": "def seeYa()\n abort(\"\\nQuiting now. Bye!\") \nend", "title": "" }, { "docid": "27dff9a4cee1ca7063e2cc6a7925bcca", "score": "0.59186053", "text": "def quit!\n @done = true\n @quit = true\n\n # If quit! is called from other than a command, we need to interrupt the\n # breakpoint listener thread\n unless @debug_thread\n @breakpoint_tracker.debug_channel.send nil\n @breakpoint_listener.join\n end\n end", "title": "" }, { "docid": "cd4fee9553e36913463586631b9c5ede", "score": "0.59020376", "text": "def on_btn_Cancel_clicked(widget)\n @db.close unless @db.nil?\n Gtk.main_quit\n end", "title": "" } ]
004780168103b4ae075c202283dcf6e9
PATCH/PUT /location_admins/1 PATCH/PUT /location_admins/1.json
[ { "docid": "bea9c21f16a55029dc2210ac7f38ebb7", "score": "0.7065082", "text": "def update\n respond_to do |format|\n if @location_admin.update(location_admin_params)\n format.html { redirect_to @location_admin, notice: 'Location admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @location_admin }\n else\n format.html { render :edit }\n format.json { render json: @location_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "e867a1dbdfeef04f242c3e1537600459", "score": "0.6971257", "text": "def update\n @admin_location = Admin::Location.find(params[:id])\n\n respond_to do |format|\n if @admin_location.update_attributes(params[:admin_location])\n format.html { redirect_to @admin_location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c78c1efbd40600abe65628c5766bd50d", "score": "0.6911755", "text": "def update\n @location = Location.find(params[:id])\n if @location.update_attributes(params[:location])\n Location.rebuild!\n end\n respond_with(:admin,@location) do |format|\n format.html { redirect_to admin_menus_path }\n end\n end", "title": "" }, { "docid": "b0f2080fbf8554851949875cac850a68", "score": "0.66817653", "text": "def update\n respond_to do |format|\n if @admin_location.update(admin_location_params)\n format.html { redirect_to @admin_location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_location }\n else\n format.html { render :edit }\n format.json { render json: @admin_location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6b4b210303446168ad4041849ec57d8b", "score": "0.6681088", "text": "def update\r\n respond_to do |format|\r\n if @admin_location.update(admin_location_params)\r\n format.html { redirect_to @admin_location, notice: 'Admin location was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @admin_location }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @admin_location.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "ca9a35f636bc0c8d20cd631f5e02e34f", "score": "0.65921736", "text": "def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(location_params)\n format.html { redirect_to adm_locations_url, notice: \"Location #{@location.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "31ecc7d98e9fdeaaaa08d66ee8850470", "score": "0.6580073", "text": "def update\n\n @location = Location.find(params[:id])\n\n if request.xhr?\n @location.name = params['name']\n @location.address = params['address']\n @location.pwd = params['pwd']\n else\n @location.update_attributes(params[:location])\n end\n\n respond_to do |format|\n if @location.save\n puts \"<<<<<<<#{@location.pwd}>>>>>>\"\n @locations = current_user.locations\n if request.xhr?\n format.json { render json: @locations}\n else\n format.html { redirect_to locations_path }\n end\n else\n format.html { redirect_to locations_url }\n format.json { render json: @locations.errors, status: :unprocessable_entity }\n end\n end\n\n end", "title": "" }, { "docid": "3c448d6f33fd1efe24cd215d4fe61f52", "score": "0.6555859", "text": "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to admin_location_path(@location), notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "51bba0a3ae2a4119e7a3f1f7a9de82b9", "score": "0.65256846", "text": "def update\n respond_to do |format|\n if @admin.update_attribute(:name , params[:admin][:name]) | @admin.update_attribute(:right_sig_url , params[:admin][:right_sig_url]) |\n\t\t\t\t\t\t\t\t @admin.update_attribute(:mkt_place_url , params[:admin][:mkt_place_url]) |\n\t\t\t\t\t\t\t\t @admin.update_attribute(:phone , params[:admin][:phone]) |\n\t\t\t\t\t\t\t\t @admin.update_attribute(:fax , params[:admin][:fax])\n\t\t\t\t\t\t \n format.html { redirect_to @admin, notice: 'Admin user was successfully updated!' }\n format.json { render :show, status: :ok, location: @admin }\n\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b8564227745f031be007ea9618631ed", "score": "0.64921635", "text": "def update\n @location = Location.find(params[:id])\n @lat = @location.lat\n @lng = @location.lng\n\n # prevent normal users from changing author\n params[:location][:author] = @location.author unless admin_signed_in?\n\n # manually update location types :/\n unless params[:location].nil? or params[:location][:locations_types].nil?\n # delete existing types before adding new stuff\n @location.locations_types.collect{ |lt| LocationsType.delete(lt.id) }\n # add/update types\n lt_seen = {}\n params[:location][:locations_types].each{ |dc,data|\n lt = LocationsType.new\n lt.type_id = data[:type_id] unless data[:type_id].nil? or (data[:type_id].strip == \"\")\n lt.type_other = data[:type_other] unless data[:type_other].nil? or (data[:type_other].strip == \"\")\n next if lt.type_id.nil? and lt.type_other.nil?\n k = lt.type_id.nil? ? lt.type_other : lt.type_id\n next unless lt_seen[k].nil?\n lt_seen[k] = true\n lt.location_id = @location.id \n lt.save\n }\n params[:location].delete(:locations_types)\n end\n\n respond_to do |format|\n if (!current_admin.nil? or verify_recaptcha(:model => @location, :message => \"ReCAPCHA error!\")) and \n @location.update_attributes(params[:location])\n log_changes(@location,\"edited\")\n expire_things\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "title": "" }, { "docid": "30909b38d893dbb07f5e5e1d4ff02f9b", "score": "0.64719677", "text": "def update\n @location.modified_by = current_user.id\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fd864946e02bd63477c8fa351cba4149", "score": "0.6442471", "text": "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to [:admin, @location], notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3614c620d32485446d77f030714f12a6", "score": "0.6410752", "text": "def update\n respond_to do |format|\n if @hospital_location.update(hospital_location_params)\n format.html { redirect_to [:admin, @hospital_location], notice: t('hosp_loc_updated') }\n format.json { render :show, status: :ok, location: [:admin, @hospital_location] }\n else\n format.html { render :edit }\n format.json { render json: @hospital_location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c13e025b0a393ad57430773412e69e5", "score": "0.64057726", "text": "def update\n Location.update(params[:location].keys, params[:location].values)\n\n redirect_to admin_locations_path\n end", "title": "" }, { "docid": "522d320a9f3a6ad9e561a19c691c46e5", "score": "0.6399746", "text": "def update\n respond_to do |format|\n if @api_v1_admin.update(api_v1_admin_params)\n format.html { redirect_to @api_v1_admin, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_admin }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d6e38973b014f73490766d70bb7e32ac", "score": "0.63814837", "text": "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: \"#{@location.name} location was revised in the system\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fe2318e68ec2d233776255ecfdfdc562", "score": "0.6373831", "text": "def inline_update\n respond_to do |format|\n if @location.update(location_params)\n format.json { render :show, status: :ok, location: @location }\n else\n format.json { render json: { error: @location.errors }, status: :ok }\n end\n end\n end", "title": "" }, { "docid": "45e75638a263f73851ecd49803e989e6", "score": "0.63714206", "text": "def update\n @id = session[:user_id]\n @admin = Admin.find_by(id: @id)\n respond_to do |format|\n if @admin.update_attribute(:name , params[:admin][:name]) |\n\t\t\t\t\t\t\t\t @admin.update_attribute(:phone , params[:admin][:phone]) |\n\t\t\t\t\t\t\t\t @admin.update_attribute(:email , params[:admin][:email])\n\t\t\t\t\t\t \n format.html { redirect_to @admin, notice: 'Admin user was successfully updated!' }\n format.json { render :show, status: :ok, location: @admin }\n\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "29bb661f8ef15d59cf80965fb4444a53", "score": "0.63656574", "text": "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to [:admin, @location.org, @location], notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: [:admin, @location.org, @location] }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e2138b3e2a6587214634bf0a15fb07c", "score": "0.63532335", "text": "def update\n respond_to do |format|\n if @rooms_admin.update(rooms_admin_params)\n format.html do\n redirect_to @rooms_admin, notice: 'Rooms admin was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @rooms_admin }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @rooms_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "397696041074f68c11c70c4d72fc574a", "score": "0.63488895", "text": "def update\n respond_to do |format|\n if @admin.update(admin_params)\n format.html { redirect_to edit_admin_admin_path(@admin), notice: 'admin was successfully updated.' }\n format.json { render action: 'show', status: :updated, location: @admin }\n #format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4ca03678ee189fdd297e71012e61a355", "score": "0.63481617", "text": "def update\n update_object(@admin, admins_url, secure_params)\n end", "title": "" }, { "docid": "e9af5011b36d3b5ef6e59171b37e6d6c", "score": "0.63405615", "text": "def update\n respond_to do |format|\n if @admin.update(admin_params)\n format.html { redirect_to :admins, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin }\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b3d0832de843bb452fc34cc73e7ea993", "score": "0.6334814", "text": "def update\n respond_to do |format|\n if @location.update(location_params.merge(updated_by: current_user))\n format.html { redirect_to admin_locations_url, notice: 'Location was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "title": "" }, { "docid": "13a0ca0c019fe6acef5634d864db2456", "score": "0.63346654", "text": "def update\n respond_to do |format|\n if @admin.update(admin_params)\n format.html { redirect_to admins_url, notice: 'Admin ' + @admin._read_attribute(:name) + ' was successfully updated.' }\n format.json { render :index, status: :ok, location: @admin }\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e6a52461a62a1ae87824bdbc132954f5", "score": "0.6331321", "text": "def update\n @restaurant_admin = Restaurant::Admin.find(params[:id])\n\n respond_to do |format|\n if @restaurant_admin.update_attributes(params[:restaurant_admin])\n format.html { redirect_to @restaurant_admin, notice: 'Admin was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a182c7010c410fb75fca2f7f90e9340c", "score": "0.63239497", "text": "def update\n # binding.pry;''\n @place.administrators << User.find(params[:adminstrator]) if params[:adminstrator]\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @place }\n else\n format.html { render :edit }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b9f1721b4a844ff23a96ae558d063c5", "score": "0.632273", "text": "def update\n unless current_user.has_perm?(\"equipment_locations_equipment_locations_can_edit\")\n permission_deny\n else\n @equipment_location = EquipmentLocation.find(params[:id])\n\n respond_to do |format|\n if @equipment_location.update_attributes(params[:equipment_location])\n flash[:notice] = 'EquipmentLocation was successfully updated.'\n format.html { redirect_to([:admin, @equipment_location]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @equipment_location.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "title": "" }, { "docid": "dd0ed1d1881a453fc4b2297d2a172c13", "score": "0.63179326", "text": "def update!(**args)\n @admins = args[:admins] if args.key?(:admins)\n end", "title": "" }, { "docid": "31cabd1c80fef7f3c1300bae1727336a", "score": "0.6317546", "text": "def update\n redirect_to '/admins'\n end", "title": "" }, { "docid": "82a02c99261c4b1aa9f592783a7858ca", "score": "0.6298615", "text": "def update\n respond_to do |format|\n if @admin.update(admin_params)\n format.html { redirect_to @admin, notice: \"Admin #{@admin.name} successfully updated.\" }\n format.json { render :show, status: :ok, location: @admin }\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cca8d3890f11d11227f028f43b16c943", "score": "0.6297132", "text": "def update\n @location = Location.find(params[:id])\n if @location.admin?( current_user ) || params[:signature]\n @location.update_attributes location_params\n end\n\n respond_to do |format|\n if @location.valid?\n format.html { redirect_to location_url( @location ) }\n else\n format.html { render action: 'edit' }\n end\n end\n end", "title": "" }, { "docid": "8eb16f2a0b3d4285b64691f6b46e2432", "score": "0.62938535", "text": "def update\n respond_to do |format|\n if @admin_admin.update(admin_admin_params)\n format.html { redirect_to @admin_admin, notice: 'Admin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7fd18939f4fe4f9052031228cbe140f8", "score": "0.62913996", "text": "def update\n if current_user.role == Role.find_by(name: 'Super Admin')\n respond_to do |format|\n if @location.update(location_params)\n if @location.warnings\n warnings = @location.warnings.full_messages\n location = @location.as_json\n location[:warnings] = warnings\n end\n flash[:success] = 'Local actualizado exitosamente.'\n flash.keep(:success)\n format.html { redirect_to locations_path }\n format.json { render :json => location }\n else\n puts @location.errors.full_messages\n format.html { redirect_to locations_path, alert: 'No se pudo guardar el local.' }\n format.json { render :json => { :errors => @location.errors.full_messages }, :status => 422 }\n end\n end\n else\n @location_times = Location.find(params[:id]).location_times\n @location_times.each do |location_time|\n location_time.location_id = nil\n location_time.save\n end\n @location = Location.find(params[:id])\n respond_to do |format|\n if @location.update(location_params)\n @location_times.destroy_all\n if @location.warnings\n warnings = @location.warnings.full_messages\n location = @location.as_json\n location[:warnings] = warnings\n end\n flash[:success] = 'Local actualizado exitosamente.'\n flash.keep(:success)\n format.html { redirect_to locations_path }\n format.json { render :json => location }\n else\n @location_times.each do |location_time|\n location_time.location_id = @location.id\n location_time.save\n end\n format.html { redirect_to locations_path, alert: 'No se pudo guardar el local.' }\n format.json { render :json => { :errors => @location.errors.full_messages }, :status => 422 }\n end\n end\n end\n end", "title": "" }, { "docid": "5af5ac5fbe8c8168ceaebccbf08faccb", "score": "0.62912714", "text": "def update\n require_login\n @company_administrator = CompanyAdministrator.find(params[:id])\n if @company_administrator.update_attributes(params[:company_administrator])\n respond_with @company_administrator, location: @company_administrator\n else\n respond_with @company_administrator, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "d7c4d3f4461bd0a58a8dd209c36b95f7", "score": "0.62911004", "text": "def update\n authorize! :update, @location\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2497014d458a9958679b120062b63220", "score": "0.6284259", "text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user]) and @user.location.update_attributes(:address => params[:location][:address])\n if current_user.admin? \n format.html { redirect_to users_path, notice: 'User was successfully updated.' }\n else \n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c4494cb4aa7b254d5c326a9d374f8782", "score": "0.62816006", "text": "def update\n @locations = []\n @errors = []\n @hide_map = true\n if params.has_key? :id\n location = Location.find(params[:id])\n @locations = [ location ]\n location_params = params.clone\n [:created_at, :id, :updated_at, :category, :subcategories, :markerVisible, :action, :controller, :location].each do |param|\n location_params.delete param\n end\n location.update_attributes location_params\n @errors = location.errors\n elsif params.has_key? :locations\n params[:locations][:location].each do |data|\n l = Location.find data[0]\n if not l.update_attributes data[1]\n pp l.errors\n @errors.push l.errors\n end\n @locations.push l\n end\n end\n\n respond_to do |format|\n if @errors.empty?\n format.html { redirect_to :locations, :notice => 'Locations successfully updated.'}\n format.json { head :no_content }\n else\n format.html { render :action =>\"edit\" }\n format.json { render :json => @errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9251e4b24708b893917e56088f7c0014", "score": "0.62760854", "text": "def update\n respond_to do |format|\n if @admin.update(admin_params)\n format.html { redirect_to current_user, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :ok, location: current_user }\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n\n end", "title": "" }, { "docid": "c3745d64b675fe128f9a7defa698bbec", "score": "0.6266192", "text": "def update\n @location = Location.find(params[:id])\n\n if(params[:location] && params[:location][:validated])\n params[:location][:validated] = @location.validated\n end\n \n if(params[:location] && params[:location][:validated_by])\n params[:location][:validated_by] = @location.validated_by\n end\n \n if(params[:location] && params[:location][:created])\n params[:location][:created] = @location.created\n end\n \n if(params[:location] && params[:location][:created_by])\n params[:location][:created_by] = @location.created_by\n end\n \n if(params[:authentication]!=nil && params[:authentication][:username]!=nil && params[:authentication][:password]!=nil)\n user = User.authenticate(params[:authentication][:username], params[:authentication][:password])\n if user\n self.current_user = user\n end\n end\n \n if(params[:location] && params[:location][:modified])\n params[:location][:modified] = Time.now\n else\n @location.modified = Time.now\n end\n \n if authorized?\n @location.modified_by = self.current_user.login\n else\n @location.modified_by = 'anonymous'\n end\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to(locations_path) }\n format.xml { head :ok }\n format.js {\n render :json => {:success=>true,:id=>@location.id.to_s}\n }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @location.errors, :status => :unprocessable_entity }\n format.js {\n render :json => {:success=>false}\n }\n end\n end\n end", "title": "" }, { "docid": "82295c82c2b47ec6d2ec82c3d80b92ae", "score": "0.62607104", "text": "def update\n if params[:appt_id]\n appointment = Appointment.find(params[:appt_id])\n @location = appointment.locations.find(params[:id])\n if params[:location][:name] == 'tmp'\n patient = Patient.find(appointment.patient_id)\n l = patient.locations.find(params['loc-select'])\n l_params = { name: l.name, addr1: l.addr1, addr2: l.addr2, city: l.city, state: l.state, zip: l.zip, preset: l.preset }\n else\n l_params = location_params\n end\n end\n respond_to do |format|\n if @location.update(l_params)\n flash[:info] = 'Update was successful!'\n format.html { redirect_to root_url }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0f1236e0c7deff3b7f951c09a7a0e774", "score": "0.6256909", "text": "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to [@client, @location], notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2d4cc7317e1f0d151c1fb2c1f391c4d4", "score": "0.6256733", "text": "def update\n if params[:admin][:password].blank?\n params[:admin].delete(:password)\n params[:admin].delete(:password_confirmation)\n end\n\n @admin = Admin.find(params[:id])\n\n # Self user cannot change its roles\n params[:admin].delete(:role_ids) if @admin == current_admin\n\n respond_to do |format|\n if @admin.update_attributes(params[:admin])\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bf73efda988b2dd6d820b8747bbb9fd2", "score": "0.62540126", "text": "def update\n location = Location.find(params[:id])\n if !current_user\n redirect_to root_url, :alert => \"You must log in to do that.\"\n elsif current_user.id != location.owner.to_i\n if !user_admin?\n redirect_to root_url, :alert => \"Permission Denied.\"\n end\n else\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "title": "" }, { "docid": "842d0b79c4d33365375650c02d6cafb2", "score": "0.6249126", "text": "def update\n respond_to do |format|\n if @admin.update(admin_params)\n format.html { redirect_to @current_user, notice: \"Admin '#{@admin.name}' was successfully updated.\" }\n format.json { render :show, status: :ok, location: @admin }\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "976c79f4f8d880ce408535fddc455084", "score": "0.62490064", "text": "def update\n respond_to do |format|\n if @admin.update_attributes(admin_params)\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin }\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15118cf0bb0bc3748809de02000c71b7", "score": "0.6235027", "text": "def update\n respond_to do |format|\n if @admin.update(admin_params)\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin }\n else\n format.html { render :edit }\n #format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "50591aadc056de33d4c5583c4f53276a", "score": "0.6218092", "text": "def update\n @add_location_to_user = AddLocationToUser.find(params[:id])\n\n respond_to do |format|\n if @add_location_to_user.update_attributes(params[:add_location_to_user])\n format.html { redirect_to @add_location_to_user, notice: 'Add location to user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @add_location_to_user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39fe3ef1fc5bf09e86dd20bfd7793a25", "score": "0.62176645", "text": "def update\n check_api_key!(\"api/locations/update\") if request.format.json?\n @location = Location.find(params[:id])\n\n # santize input to only legit fields\n update_okay = [\"author\",\"description\",\"observation\",\"type_ids\",\"lat\",\n \"lng\",\"season_start\",\"season_stop\",\"no_season\",\"unverified\",\"access\"]\n params[:location] = params[:location].delete_if{ |k,v| not update_okay.include? k }\n\n # set aside observations params for manually processing\n obs_params = params[:location][:observation]\n params[:location].delete(:observation)\n @observation = prepare_observation(obs_params,@location)\n\n # prevent normal users from changing author\n params[:location][:author] = @location.author unless user_signed_in? and current_user.is? :admin\n\n # set author\n @observation.author = current_user.name unless @observation.nil? or (not user_signed_in?) or (current_user.add_anonymously)\n # overwrite with field setting if given\n @observation.author = params[:author] if not @observation.nil? and params[:author].present? and not params[:author].blank?\n\n # compute diff/patch so we can undo later\n unless params[:location][:description].nil?\n dmp = DiffMatchPatch.new\n patch = dmp.patch_to_text(dmp.patch_make(params[:location][:description],@location.description.nil? ? '' : @location.description))\n else\n patch = \"\"\n end\n former_type_ids = @location.type_ids\n former_location = @location.location\n\n # parse and normalize types\n params[:location][:type_ids] = normalize_create_types(params)\n\n # FIXME: Only decrement cluster if save is successful\n # decrement cluster (since location may have moved into a different cluster)\n cluster_decrement(@location)\n\n log_api_request(\"api/locations/update\",1)\n respond_to do |format|\n # FIXME: recaptcha check should go right at the beginning (before doing anything else)\n test = user_signed_in? ? true : verify_recaptcha(:model => @location,\n :message => \"ReCAPCHA error!\")\n if test and @location.update_attributes(params[:location]) and (@observation.nil? or @observation.save)\n log_changes(@location,\"edited\",nil,params[:author],patch,former_type_ids,former_location)\n cluster_increment(@location)\n expire_things\n format.html { redirect_to @location, notice: I18n.translate('locations.messages.updated') }\n format.json { render json: {\"status\" => 0} }\n else\n cluster_increment(@location) # do increment even if we fail so that clusters don't slowly deplete :/\n format.html { render action: \"edit\", notice: I18n.translate('locations.messages.not_updated') }\n format.json { render json: {\"status\" => 2, \"error\" => I18n.translate('locations.messages.not_updated') + \": #{(@location.errors.full_messages + @observation.errors.full_messages).join(\";\")}\" } }\n end\n end\n end", "title": "" }, { "docid": "f6a244435ec76fe6e13a3a9e5777f709", "score": "0.62132305", "text": "def update\n respond_to do |format|\n if @adminstrator.update(adminstrator_params)\n flash[:success] = 'Adminstrator was successfully updated.'\n format.html { redirect_to modify_admin_path }\n format.json { render :show, status: :ok, location: @adminstrator }\n else\n flash[:danger] = \"There are some mistakes, please try again\"\n format.html { render :edit }\n format.json { render json: @adminstrator.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d4999aa4aef4504de020e4b1c4413dfb", "score": "0.6206569", "text": "def edit_admins\n end", "title": "" }, { "docid": "35d2f4097faef52e64de96706ef43bd0", "score": "0.6205016", "text": "def update\n respond_to do |format|\n if @admin_admin.update(admin_admin_params)\n format.html { redirect_to admin_admins_path, notice: 'Administrador ha sido modificado.' }\n format.json { render :show, status: :ok, location: admin_admins_path }\n else\n format.html { render :edit }\n format.json { render json: @admin_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0071b18cb16a170e52050c1f088ed212", "score": "0.6203854", "text": "def update\n respond_to do |format|\n if @super_admin.update(super_admin_params)\n format.html { redirect_to @super_admin, notice: 'Super admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @super_admin }\n else\n format.html { render :edit }\n format.json { render json: @super_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0071b18cb16a170e52050c1f088ed212", "score": "0.6203854", "text": "def update\n respond_to do |format|\n if @super_admin.update(super_admin_params)\n format.html { redirect_to @super_admin, notice: 'Super admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @super_admin }\n else\n format.html { render :edit }\n format.json { render json: @super_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "95b5c2de6429b317ea6addd7635875e8", "score": "0.6202788", "text": "def update\n respond_to do |format|\n if @admin.update(admin_params)\n format.html {redirect_to @admin, notice: 'Admin was successfully updated.'}\n format.json {render :show, status: :ok, location: @admin}\n else\n format.html {render :edit}\n format.json {render json: @admin.errors, status: :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "95b5c2de6429b317ea6addd7635875e8", "score": "0.6202788", "text": "def update\n respond_to do |format|\n if @admin.update(admin_params)\n format.html {redirect_to @admin, notice: 'Admin was successfully updated.'}\n format.json {render :show, status: :ok, location: @admin}\n else\n format.html {render :edit}\n format.json {render json: @admin.errors, status: :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "4e874f26e50a454878a4fdde0c7af2b0", "score": "0.6195676", "text": "def update_location(params)\n @client.put(\"#{path}/location\", nil, params, \"Content-Type\" => \"application/json\")\n end", "title": "" }, { "docid": "0828e8c7648027fdaa2b67fe538706bb", "score": "0.6192662", "text": "def update\n @location = Location.find(params[:id])\n\n # prevent normal users from changing author\n params[:location][:author] = @location.author unless user_signed_in? and current_user.is? :admin\n\n p = 0\n lts = []\n @location.locations_types.collect{ |lt| LocationsType.delete(lt.id) }\n params[:types].split(/,/).collect{ |e| e[/^([^\\[]*)/].strip.capitalize }.uniq.each{ |type_name|\n lt = LocationsType.new\n t = Type.where(\"name = ?\",type_name).first\n if t.nil? \n lt.type_other = type_name\n else\n lt.type = t\n end\n lt.position = p\n lt.location_id = @location.id\n p += 1\n lts.push lt\n } if params[:types].present?\n\n lt_update_okay = lts.collect{ |lt| lt.save }.all?\n\n ApplicationController.cluster_decrement(@location)\n respond_to do |format|\n test = user_signed_in? ? true : verify_recaptcha(:model => @location, \n :message => \"ReCAPCHA error!\")\n if test and @location.update_attributes(params[:location]) and lt_update_okay\n \n log_changes(@location,\"edited\")\n ApplicationController.cluster_increment(@location)\n expire_things\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.mobile { redirect_to @location, notice: 'Location was successfully updated.' }\n else\n format.html { render action: \"edit\" }\n format.mobile { render action: \"edit\" }\n end\n end\n end", "title": "" }, { "docid": "1a3b6df863777744bc496aa1b5795e7c", "score": "0.6192587", "text": "def update!(**args)\n @allowed_locations = args[:allowed_locations] if args.key?(:allowed_locations)\n end", "title": "" }, { "docid": "e164a884595adb52851f3b3d5ed9b2da", "score": "0.61896914", "text": "def update\n respond_to do |format|\n if @location_level.update(location_level_params)\n format.html { redirect_to @location_level, notice: 'Location level was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location_level.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "449d8c353e84c2502c69ac87eca67b5f", "score": "0.61873895", "text": "def update\n @admin = Admin.find(params[:id])\n\n respond_to do |format|\n if @admin.update_attributes(params[:admin])\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.',:layout=>\"admin_list\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c0de0986a63453a4f278929cf53e20e0", "score": "0.61843204", "text": "def update\n\t\t#Change ',' characters for '.' so they work\n\t\treplace_commas \n\t\trespond_to do |format|\n\t\t\tif @location.update(location_params)\n\t\t\t\tformat.html { redirect_to locations_path, notice: I18n.t(:location_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: @location.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "48fdc81e2fe7a07002a11f5d9039426b", "score": "0.6183901", "text": "def update\n return unless ssl_login\n return unless lookup_permitted_object\n\n case\n when (@administrator.present? and @administrator.admin?)\n @object.update_attributes(administrator_params)\n when @object.nil?\n return\n else\n @object.update_attributes(mortal_params)\n end\n head 200\n end", "title": "" }, { "docid": "a81b44bfefb988a216a787fd96526113", "score": "0.6177201", "text": "def update\n \n if @location.update(location_params)\n render JSON: @location\n else\n render JSON: @location.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "f2e04a8396e2157428789ad38b2666e7", "score": "0.6171491", "text": "def update\n respond_to do |format|\n params[:super_admin][:email].downcase!\n params[:super_admin][:name].downcase!\n if @super_admin.update(super_admin_params)\n format.html { redirect_to @super_admin, notice: 'Super admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @super_admin }\n else\n format.html { render :edit }\n format.json { render json: @super_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6a1960cf94022c271bb560fab7b38f03", "score": "0.61682", "text": "def update\n respond_to do |format|\n if @admin.update(admin_params)\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin }\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6a1960cf94022c271bb560fab7b38f03", "score": "0.61682", "text": "def update\n respond_to do |format|\n if @admin.update(admin_params)\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin }\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6a1960cf94022c271bb560fab7b38f03", "score": "0.61682", "text": "def update\n respond_to do |format|\n if @admin.update(admin_params)\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin }\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6a1960cf94022c271bb560fab7b38f03", "score": "0.61682", "text": "def update\n respond_to do |format|\n if @admin.update(admin_params)\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin }\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6a1960cf94022c271bb560fab7b38f03", "score": "0.61682", "text": "def update\n respond_to do |format|\n if @admin.update(admin_params)\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin }\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "020634669e383616a2c7f11c88ae28b8", "score": "0.61545867", "text": "def update\n respond_to do |format|\n if @administrator.update_attributes(params[:administrator])\n format.html { redirect_to @administrator, notice: 'Administrator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @administrator.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4900b4ab5f94a25fd0f27c397ca826a4", "score": "0.6152869", "text": "def update\n @admin = Admin.find(params[:id])\n\n respond_to do |format|\n if @admin.update_attributes(params[:admin])\n format.html { redirect_to @admin, :notice => 'Admin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @admin.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d5a8f8ea13f35c921fa2344d80e68601", "score": "0.6150404", "text": "def update\n @survey_location = SurveyLocation.find(params[:id])\n\n respond_to do |format|\n if @survey_location.update_attributes(params[:survey_location])\n format.html { redirect_to @survey_location, notice: 'Survey location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey_location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8aea828802f2b5a5dc5e0504a0372409", "score": "0.614153", "text": "def update\n respond_to do |format|\n if @admin_administrator.update(admin_administrator_params)\n format.html { redirect_to @admin_administrator, notice: \"Dados atualizados com sucesso!\" }\n format.json { render :show, status: :ok, location: @admin_administrator }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @admin_administrator.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15b3533c8945085e9c0fc60f8d2c158b", "score": "0.61404246", "text": "def update\n @location = Location.find(params[:location_id])\n @manager = Manager.find(params[:id])\n\n respond_to do |format|\n if @manager.update_attributes(manager_params)\n format.html { redirect_to @manager, notice: 'Manager was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manager.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "516d4be7feebbaf2d42087c0512fb272", "score": "0.61381286", "text": "def update\n @admin = Admin.find(params[:id])\n\n respond_to do |format|\n if @admin.update_attributes(params[:admin])\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "516d4be7feebbaf2d42087c0512fb272", "score": "0.61381286", "text": "def update\n @admin = Admin.find(params[:id])\n\n respond_to do |format|\n if @admin.update_attributes(params[:admin])\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "516d4be7feebbaf2d42087c0512fb272", "score": "0.61381286", "text": "def update\n @admin = Admin.find(params[:id])\n\n respond_to do |format|\n if @admin.update_attributes(params[:admin])\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "80b292b926a9af2f59f4e792e73681da", "score": "0.61316466", "text": "def update\n respond_to do |format|\n if @adminrose.update(adminroses_paths)\n format.html { redirect_to adminroses_path, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @adminrose }\n else\n format.html { render :edit }\n format.json { render json: @adminroses.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "143dd1407559f8efdf607f9d2c8f660e", "score": "0.6125492", "text": "def update\n @admin_admin = Admin.find(params[:id])\n\n respond_to do |format|\n if @admin_admin.update_attributes(params[:admin])\n format.html { redirect_to [:admin, @admin_admin], notice: 'Admin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a312b3f319deba0e435cc8f677d6b8d4", "score": "0.612272", "text": "def update\n authorize! :manage_account, current_account\n @location = current_account.locations.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to(@location, :notice => 'Location was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @location.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "162e28fa07aaa2bf3a84f02c50634dba", "score": "0.6119233", "text": "def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render json: @location}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3e1087e696af42945a1d3254328656f5", "score": "0.6115759", "text": "def update\n @superadmin = Superadmin.find(params[:id])\n\n respond_to do |format|\n if @superadmin.update_attributes(params[:superadmin])\n format.html { redirect_to @superadmin, notice: 'Superadmin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @superadmin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f1f5afc0f0186abf9203ceea84eee7d2", "score": "0.6115161", "text": "def update\n @admin = Admin.find(params[:id])\n\n respond_to do |format|\n if @admin.update_attributes(params[:admin])\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f1f5afc0f0186abf9203ceea84eee7d2", "score": "0.6115161", "text": "def update\n @admin = Admin.find(params[:id])\n\n respond_to do |format|\n if @admin.update_attributes(params[:admin])\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "764e34bf0d0014c985dc66b206f8b436", "score": "0.61138546", "text": "def update\n respond_to do |format|\n if @admin.update(admin_params)\n format.html { redirect_to @admin, notice: 'Admin Atualizado com Sucesso.' }\n format.json { render :show, status: :ok, location: @admin }\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "34c6471962196603e2f127f3fc0adc3f", "score": "0.6113387", "text": "def update\n respond_to do |format|\n if @people_admin.update(people_admin_params)\n format.html { redirect_to @people_admin, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @people_admin }\n else\n format.html { render :edit }\n format.json { render json: @people_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d272334c862e8bb4eef365b80af41eef", "score": "0.61125296", "text": "def update\n respond_to do |format|\n if @administrator.update(administrator_params)\n format.html {redirect_to @administrator, notice: 'Administrator was successfully updated.'}\n format.json {render :show, status: :ok, location: @administrator}\n else\n format.html {render :edit}\n format.json {render json: @administrator.errors, status: :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "3c07300489bd9d1ccf360234f7a629f9", "score": "0.61080664", "text": "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3c07300489bd9d1ccf360234f7a629f9", "score": "0.61080664", "text": "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3c07300489bd9d1ccf360234f7a629f9", "score": "0.61080664", "text": "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3c07300489bd9d1ccf360234f7a629f9", "score": "0.61080664", "text": "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3c07300489bd9d1ccf360234f7a629f9", "score": "0.61080664", "text": "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3c07300489bd9d1ccf360234f7a629f9", "score": "0.61080664", "text": "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3c07300489bd9d1ccf360234f7a629f9", "score": "0.61080664", "text": "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3c07300489bd9d1ccf360234f7a629f9", "score": "0.61080664", "text": "def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ae41cdfe93dc2a009c848f4d9005187a", "score": "0.6106391", "text": "def update\n return unless @admin\n @location.hours = params[:hours]\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "76cc5b6503df308cea4a15a32b565348", "score": "0.61047274", "text": "def update\n @user_location = UserLocation.find(params[:id])\n\n respond_to do |format|\n if @user_location.update_attributes(params[:user_location])\n format.html { redirect_to @user_location, notice: 'User location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "24762b3d617f8b88159183cb34ba0ed6", "score": "0.60981554", "text": "def update\n @user = current_user\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c5ed0b3fc95281354930f883f467b70d", "score": "0.6095995", "text": "def update\n @rayons_admin = RayonsAdmin.find(params[:id])\n\n respond_to do |format|\n if @rayons_admin.update_attributes(params[:rayons_admin])\n format.html { redirect_to @rayons_admin, notice: 'Rayons admin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rayons_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fae3387d4c4b4d3638c4f58da844fd85", "score": "0.6094019", "text": "def update\n location_type = params[:location][:as_location_type]\n strong_params_method_to_call = location_type+'_params' \n respond_to do |format|\n if @location.update(self.send(strong_params_method_to_call.to_sym))\n @location.create_activity :update, owner: current_user\n format.html { redirect_to [:admin,@location], notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
9ad6e0b05df318d2aac6acbff5d2c9ad
Return an episode's partial level scores and splits using 2 methods: 1) The actual episode splits, using SimVYo's tool 2) The IL splits Also return the differences between both
[ { "docid": "78ab947ac6e23f706270cd11ec9ca52b", "score": "0.54808253", "text": "def send_splits(event)\n # Parse message parameters\n msg = event.content\n ep = parse_highscoreable(msg, mappack: true)\n ep = ep.episode if ep.is_a?(Levelish)\n raise OutteError.new \"Sorry, columns can't be analyzed yet.\" if ep.is_a?(Storyish)\n mappack = ep.is_a?(MappackHighscoreable)\n board = parse_board(msg, 'hs')\n raise OutteError.new \"Sorry, speedrun mode isn't available for Metanet levels yet.\" if !mappack && board == 'sr'\n raise OutteError.new \"Sorry, episode splits are only available for either highscore or speedrun mode\" if !['hs', 'sr'].include?(board)\n scores = ep.leaderboard(board, pluck: false)\n rank = parse_range(msg)[0].clamp(0, scores.size - 1)\n ntrace = board == 'hs' # Requires ntrace\n\n # Calculate episode splits\n if board == 'sr'\n valid = [true] * 5\n ep_scores = Demo.decode(scores[rank].demo.demo, true).map(&:size)\n ep_splits = splits_from_scores(ep_scores, start: 0, factor: 1, offset: 0)\n elsif FEATURE_NTRACE\n file = nil\n valid = valid = [false] * 5\n ep_splits = []\n ep_scores = []\n\n # Execute ntrace in mutex\n wait_msg = event.send_message(\"Queued...\") if $mutex[:ntrace].locked?\n $mutex[:ntrace].synchronize do\n wait_msg.delete if !wait_msg.nil?\n\n # Export input files\n File.binwrite('inputs_episode', scores[rank].demo.demo)\n ep.levels.each_with_index{ |l, i|\n map = !l.is_a?(Map) ? MappackLevel.find(l.id) : l\n File.binwrite(\"map_data_#{i}\", map.dump_level)\n }\n shell(\"python3 #{PATH_NTRACE}\")\n\n # Read output files\n file = File.binread('output.txt') rescue nil\n if !file.nil?\n valid = file.scan(/True|False/).map{ |b| b == 'True' }\n ep_splits = file.split(/True|False/)[1..-1].map{ |d|\n round_score(d.strip.to_i.to_f / 60.0)\n }\n ep_scores = scores_from_splits(ep_splits, offset: 90.0)\n FileUtils.rm(['output.txt'])\n end\n\n # Cleanup\n FileUtils.rm(['inputs_episode', *Dir.glob('map_data_*')])\n end\n end\n\n # Calculate IL splits\n lvl_splits = ep.splits(rank, board: board)\n if lvl_splits.nil?\n event << \"Sorry, that rank doesn't seem to exist for at least some of the levels.\"\n return\n end\n scoref = !mappack ? 'score' : \"score_#{board}\"\n factor = mappack && board == 'hs' ? 60.0 : 1\n lvl_scores = ep.levels.map{ |l| l.leaderboard(board)[rank][scoref] / factor }\n\n # Calculate differences\n full = (!ntrace || FEATURE_NTRACE) && !file.nil?\n\n event << \"ntrace failed.\" if file.nil?\n\n if full\n errors = valid.count(false)\n if errors > 0\n wrong = valid.each_with_index.map{ |v, i| !v ? i.to_s : nil }.compact.to_sentence\n event << \"Warning: Couldn't calculate episode splits (error in #{'level'.pluralize(errors)} #{wrong}).\"\n full = false\n end\n\n cum_diffs = lvl_splits.each_with_index.map{ |ls, i|\n mappack && board == 'sr' ? ep_splits[i] - ls : ls - ep_splits[i]\n }\n diffs = cum_diffs.each_with_index.map{ |d, i|\n round_score(i == 0 ? d : d - cum_diffs[i - 1])\n }\n end\n\n # Format response\n rows = []\n rows << ['', '00', '01', '02', '03', '04']\n rows << :sep\n rows << ['Ep splits', *ep_splits] if full\n rows << ['Lvl splits', *lvl_splits]\n rows << ['Total diff', *cum_diffs] if full\n rows << :sep if full\n rows << ['Ep scores', *ep_scores] if full\n rows << ['Lvl scores', *lvl_scores]\n rows << ['Ind diffs', *diffs] if full\n\n event << \"#{rank.ordinalize} #{format_board(board)} splits for episode #{ep.name}:\"\n event << \"(Episode splits aren't available because ntrace is disabled).\" if ntrace && !FEATURE_NTRACE\n event << format_block(make_table(rows))\nrescue => e\n lex(e, \"Error calculating splits.\", event: event)\nend", "title": "" } ]
[ { "docid": "3804c8411650f5b03cc09f4051b00463", "score": "0.5662043", "text": "def split(more: false, realtime_end_ms: nil, gametime_end_ms: nil) # rubocop:todo Metrics/AbcSize Metrics/CyclomaticComplexity Metrics/MethodLength\n prev_segment = segments.order(segment_number: :asc).where(realtime_end_ms: nil).first\n if prev_segment.nil? && more\n prev_segment = segments.order(segment_number: :asc).last\n end\n\n next_segment = segments.find_by(segment_number: prev_segment.segment_number + 1) if prev_segment\n\n # Normal split\n if !more || next_segment\n if !prev_segment\n errors.add(:segments, :full, message: 'are all completed; pass more=1 to add one and split')\n return\n end\n\n if realtime_end_ms\n prev_segment.assign_attributes(\n realtime_end_ms: realtime_end_ms,\n realtime_duration_ms: realtime_end_ms - prev_segment.start(Run::REAL).to_ms,\n realtime_gold: prev_segment.histories.where('realtime_duration_ms < ?', realtime_end_ms - prev_segment.start(Run::REAL).to_ms).none?,\n )\n end\n\n if gametime_end_ms\n prev_segment.assign_attributes(\n gametime_end_ms: gametime_end_ms,\n gametime_duration_ms: gametime_end_ms - prev_segment.start(Run::GAME).to_ms,\n gametime_gold: prev_segment.histories.where('gametime_duration_ms < ?', gametime_end_ms - prev_segment.start(Run::GAME).to_ms).none?,\n )\n end\n\n prev_segment.save\n\n prev_segment_history = prev_segment.histories.new(\n attempt_number: attempts + 1,\n )\n\n if realtime_end_ms\n prev_segment_history.assign_attributes(\n realtime_duration_ms: realtime_end_ms - prev_segment.start(Run::REAL).to_ms,\n )\n end\n\n if gametime_end_ms\n prev_segment_history.assign_attributes(\n gametime_duration_ms: gametime_end_ms - prev_segment.start(Run::GAME).to_ms,\n )\n end\n\n prev_segment_history.save\n\n # segment could be nil if we just finished the run.\n if next_segment\n next_segment.update(\n realtime_start_ms: realtime_end_ms,\n gametime_start_ms: gametime_end_ms,\n )\n else\n update(\n attempts: attempts + 1,\n realtime_duration_ms: realtime_end_ms,\n gametime_duration_ms: gametime_end_ms,\n )\n histories.create(\n attempt_number: attempts,\n realtime_duration_ms: realtime_end_ms,\n gametime_duration_ms: gametime_end_ms,\n )\n end\n\n return\n end\n\n # Smart split, making new segments if none are left\n\n # If the run was empty\n if !prev_segment\n prev_segment = segments.create(\n segment_number: 0,\n name: 'Segment 1',\n realtime_start_ms: 0,\n realtime_end_ms: realtime_end_ms,\n realtime_duration_ms: realtime_end_ms,\n realtime_gold: true,\n gametime_start_ms: 0,\n gametime_end_ms: gametime_end_ms,\n gametime_duration_ms: gametime_end_ms,\n gametime_gold: true,\n )\n\n prev_segment.histories.create(\n attempt_number: 1,\n realtime_duration_ms: realtime_end_ms,\n gametime_duration_ms: gametime_end_ms,\n )\n end\n\n if realtime_end_ms\n prev_segment.assign_attributes(\n realtime_end_ms: realtime_end_ms,\n realtime_duration_ms: realtime_end_ms - prev_segment.start(Run::REAL).to_ms,\n realtime_gold: prev_segment.histories.where('realtime_duration_ms < ?', realtime_end_ms - prev_segment.start(Run::REAL).to_ms).none?,\n )\n end\n\n if gametime_end_ms\n prev_segment.assign_attributes(\n gametime_end_ms: gametime_end_ms,\n gametime_duration_ms: gametime_end_ms - prev_segment.start(Run::GAME).to_ms,\n gametime_gold: prev_segment.histories.where('gametime_duration_ms < ?', gametime_end_ms - prev_segment.start(Run::GAME).to_ms).none?,\n )\n end\n\n prev_segment.save\n\n prev_segment_history = prev_segment.histories.build(\n attempt_number: attempts + 1,\n )\n\n if realtime_end_ms\n prev_segment_history.assign_attributes(\n realtime_duration_ms: realtime_end_ms - prev_segment.start(Run::REAL).to_ms,\n )\n end\n\n if gametime_end_ms\n prev_segment_history.assign_attributes(\n gametime_duration_ms: gametime_end_ms - prev_segment.start(Run::GAME).to_ms,\n )\n end\n\n prev_segment_history.save\n\n next_segment = segments.create(\n segment_number: prev_segment.segment_number + 1,\n name: \"Segment #{prev_segment.segment_number + 2}\",\n realtime_start_ms: prev_segment.end(Run::REAL).to_ms,\n gametime_start_ms: prev_segment.end(Run::GAME).to_ms,\n )\n\n $s3_bucket_internal.put_object(\n key: \"splits/#{s3_filename}\",\n body: ApplicationController.new.render_to_string(\n template: 'runs/exports/exchange',\n layout: false,\n locals: {:@run => self},\n ),\n )\n\n save\n end", "title": "" }, { "docid": "8473f216247608b83cc460b9630c9e39", "score": "0.53900516", "text": "def split_into_runs par\n sor=0\n sor_level=par['level']\n run = Hash.new\n run['sor']=sor\n chars=par['characters']\n len=chars.length\n par['runs']=Array.new\n 0.upto(len - 1) do |index|\n char=chars[index]\n next unless char['level']\n if char['level'] != sor_level\n run['sor']=sor\n run['sorType']=chars[sor]['level'].odd? ? 'R' : 'L'\n run['eor']=index\n run['eorType']=chars[index]['level'].odd? ? 'R' : 'L'\n sor=index\n par['runs'].push run\n run=Hash.new\n sor_level=char['level']\n end\n end # upto\n run['sor']=sor\n run['sorType']=chars[sor]['level'].odd? ? 'R' : 'L'\n run['eor']=len\n run['eorType']=par['level'].odd? ? 'R' : 'L'\n par['runs'].push run\n end", "title": "" }, { "docid": "eb9b4ea92484f8fae9223741a1740225", "score": "0.53867984", "text": "def item_difficulty_analysis\n dif={}\n @ds.vectors.each{|f| dif[f]=@ds[f].mean }\n dif_sort = dif.sort { |a,b| -(a[1]<=>b[1]) }\n scores_sort={}\n [email protected]_mean\n scores.each_index{ |i| scores_sort[i]=scores[i] }\n scores_sort=scores_sort.sort{|a,b| a[1]<=>b[1]}\n ds_new = Daru::DataFrame.new({}, order: ([:case,:score] + dif_sort.collect{|a,b| a.to_sym}))\n scores_sort.each do |i,score|\n row = [i, score]\n case_row = @ds.row[i].to_h\n dif_sort.each{ |variable,dif_value| row.push(case_row[variable]) }\n ds_new.add_row(row)\n end\n ds_new\n end", "title": "" }, { "docid": "1f84c530039ff693e0287e14e1485cb3", "score": "0.53709745", "text": "def assemble_expert_performance\n # Load all Matches\n matches = Match.all\n expert = Expert.where(name: \"zulubet\").first().id\n\n # For each Match check whether Odds and Predictions exist\n matches.each do |match|\n predictions = Prediction.where(match: match).where(expert_id: expert).first()\n odds = Odd.where(match: match)\n\n # If Odds and Predictions exist, calculate min, max, avg, etc for each\n if predictions && odds.count > 0 && match.home_goals && match.away_goals\n\n odds_home_average = odds.average(:home_odd)\n odds_draw_average = odds.average(:draw_odd)\n odds_away_average = odds.average(:away_odd)\n\n odds_home_max = odds.maximum(:home_odd)\n odds_draw_max = odds.maximum(:draw_odd)\n odds_away_max = odds.maximum(:away_odd)\n\n odds_home_min = odds.minimum(:home_odd)\n odds_draw_min = odds.minimum(:draw_odd)\n odds_away_min = odds.minimum(:away_odd)\n\n predictions_home = predictions.home_probability\n predictions_draw = predictions.draw_probability\n predictions_away = predictions.away_probability\n\n winner = match.home_goals - match.away_goals\n # TODO: Add standard deviaton calculation for odds and predictions\n # Include expert quality score to weight the predictions\n\n # Write all Data with append to the training file\n CSV.open(\"csv_input/assemble_expert_performance.csv\", \"ab\") do |csv|\n csv << [\n winner,\n # I need the Outcome of the Game to improve the ML Algo\n # As Difference of Goals?\n # As Winner?\n # As Percentage (of what though)?\n\n odds_home_average,\n odds_draw_average,\n odds_away_average,\n odds_home_max,\n odds_draw_max,\n odds_away_max,\n odds_home_min,\n odds_draw_min,\n odds_away_min,\n predictions_home,\n predictions_draw,\n predictions_away,\n ]\n end\n end\n end\n end", "title": "" }, { "docid": "8b817a9267d1a965a0bfbb3734ed7915", "score": "0.5150447", "text": "def getMidSeasonStatistics()\n for player in @skater_data\n begin\n stats = JSON.parse((RestClient.get \"https://statsapi.web.nhl.com/api/v1/people/#{player[5]}/stats?stats=statsSingleSeason\"))[\"stats\"][0][\"splits\"][0][\"stat\"]\n gamesLeft = 82 - @games_played[player[player.length-1]]\n player[6] = ((player[6].to_f/82)*gamesLeft + stats[\"goals\"]).to_i\n player[7] = ((player[7].to_f/82)*gamesLeft + stats[\"assists\"]).to_i\n player[8] = ((player[8].to_f/82)*gamesLeft + stats[\"powerPlayPoints\"]).to_i\n player[9] = ((player[9].to_f/82)*gamesLeft + stats[\"plusMinus\"]).to_i\n player[10] = ((player[10].to_f/82)*gamesLeft + stats[\"shots\"]).to_i\n player[11] = ((player[11].to_f/82)*gamesLeft + stats[\"hits\"]).to_i\n rescue\n gamesLeft = 82 - @games_played[player[player.length-1]]\n player[6] = ((player[6].to_f/82)*gamesLeft).to_i\n player[7] = ((player[7].to_f/82)*gamesLeft).to_i\n player[8] = ((player[8].to_f/82)*gamesLeft).to_i\n player[9] = ((player[9].to_f/82)*gamesLeft).to_i\n player[10] = ((player[10].to_f/82)*gamesLeft).to_i\n player[11] = ((player[11].to_f/82)*gamesLeft).to_i\n end\n puts player\n end\n for goalie in @goalie_data\n begin\n stats = JSON.parse((RestClient.get \"https://statsapi.web.nhl.com/api/v1/people/#{goalie[5]}/stats?stats=statsSingleSeason\"))[\"stats\"][0][\"splits\"][0][\"stat\"]\n gamesLeft = 82 - @games_played[goalie[goalie.length-1]]\n goalie[6] = ((goalie[6].to_f/82)*gamesLeft + stats[\"gamesStarted\"]).to_i\n goalie[7] = ((goalie[7].to_f/82)*gamesLeft + stats[\"wins\"]).to_i\n goalie[9] = (((goalie[9].to_f)*gamesLeft + stats[\"savePercentage\"]*@games_played[goalie[13]])/82).round(4)\n goalie[11] = (((goalie[11].to_f)*gamesLeft + stats[\"goalAgainstAverage\"]*@games_played[goalie[13]])/82).round(4)\n goalie[12] = ((goalie[12].to_f/82)*gamesLeft + stats[\"shutouts\"]).to_i\n rescue\n gamesLeft = 82 - @games_played[goalie[goalie.length-1]]\n goalie[6] = ((goalie[6].to_f/82)*gamesLeft).to_i\n goalie[7] = ((goalie[7].to_f/82)*gamesLeft).to_i\n goalie[9] = ((goalie[9].to_f/82)*gamesLeft).to_i\n goalie[11] = ((goalie[11].to_f/82)*gamesLeft).to_i\n goalie[12] = ((goalie[12].to_f/82)*gamesLeft).to_i\n end\n puts goalie\n end\nend", "title": "" }, { "docid": "f13bcaea1ace16dc350ef1571a60e4f7", "score": "0.51421076", "text": "def energy()\n score = 0\n @matches.each do |m|\n # Teams Same School\n if m.team_a.school == m.team_b.school\n score -= @penalties[:teams_same_school]\n end\n # Judges Same School\n m.judges.each do |j|\n if j.school == m.team_a.school\n score -= @penalties[:judge_same_school]\n end\n if j.school == m.team_b.school\n score -= @penalties[:judge_same_school]\n end\n end\n # Different Win/Loss\n if m.team_a.num_wins != m.team_b.num_wins\n score -= (1 + @penalties[:different_win_loss]) **\n (m.team_a.num_wins - m.team_b.num_wins).abs\n score -= 1 # No, really, this makes sense...\n end\n end\n score\n end", "title": "" }, { "docid": "1d17707b37efa95f0b2410af18b4f4d9", "score": "0.513058", "text": "def get_standings(games)\n teams = Hash.new\n games.each do |game|\n division_id = game.division_id\n home_team = game.home_team\n away_team = game.visiting_team\n if(teams[home_team.name].nil?)\n teams[home_team.name] = {:win => 0, :loss => 0, :tie => 0, :point=> 0}\n end\n\n if(teams[away_team.name].nil?)\n teams[away_team.name] = {:win => 0, :loss => 0, :tie => 0, :point => 0}\n end\n if(game.home_team_score && game.visiting_team_score)\n if(game.home_team_score > game.visiting_team_score)\n # home team won\n teams[home_team.name][:win] += 1\n teams[home_team.name][:point] += 5\n # visiting team loss\n teams[away_team.name][:loss] += 1\n elsif(game.home_team_score < game.visiting_team_score)\n # home team loss\n teams[home_team.name][:loss] += 1\n #visiting team won\n teams[away_team.name][:win] += 1\n teams[away_team.name][:point] += 5\n else\n # tie game\n teams[home_team.name][:tie] += 1\n teams[home_team.name][:point] += 1\n teams[away_team.name][:tie] += 1\n teams[away_team.name][:point] += 1\n end\n end\n end\n teams.each do |team, value|\n puts team\n total_games = value[:win] + value[:loss] + value[:tie]\n if total_games > 0 \n win_percentage = value[:win]/total_games.to_f\n else\n win_percentage = 0\n end \n value[:percentage] = win_percentage\n end\n teams_sorted = teams.sort_by{ |k, v| v[:point]}.reverse\n return teams_sorted\n end", "title": "" }, { "docid": "36e4c46c512967e0e3a5586b6efb4216", "score": "0.51298964", "text": "def parse_game(score_page)\n\n #parse score\n score = score_page.search('div#all_line_score')\n\n #remove the comments, since data we need is hidden in the comments\n score.xpath('//comment()').each { |comment| comment.replace(comment.text) }\n score_table = score.css(\"table\")\n scores = score_table.css(\"td\").css(\"strong\")\n teams = score_table.css(\"td\").css(\"a\")\n home_score = scores[1].text\n away_score = scores[0].text\n home_team = teams[1].text\n away_team = teams[0].text\n\n home_result = \"n/a\"\n away_result = \"n/a\"\n if home_score.to_i > away_score.to_i\n home_result = \"win\"\n away_result = \"loss\"\n else\n home_result = \"loss\"\n away_result = \"win\"\n end\n\n #parse 4 factors\n factors = score_page.search('div#all_four_factors')\n factors.xpath('//comment()').each { |comment| comment.replace(comment.text) }\n factors_table = factors.css(\"table\")\n efg_pct = factors_table.css(\"td[data-stat='efg_pct']\")\n tov_pct = factors_table.css(\"td[data-stat='tov_pct']\")\n orb_pct = factors_table.css(\"td[data-stat='orb_pct']\")\n ft_rate = factors_table.css(\"td[data-stat='ft_rate']\")\n\n home_eft_pct = efg_pct[1].text\n home_tov_pct = tov_pct[1].text\n home_orb_pct = orb_pct[1].text\n home_ft_rate = ft_rate[1].text\n away_eft_pct = efg_pct[0].text\n away_tov_pct = tov_pct[0].text\n away_orb_pct = orb_pct[0].text\n away_ft_rate = ft_rate[0].text\n\n\n #this out put will be piped to an output file\n puts away_team + \", \" + away_score.to_s + \", \" + away_eft_pct.to_s + \", \" + away_tov_pct.to_s + \", \" + away_orb_pct.to_s + \", \" + away_ft_rate.to_s + \", \" + away_result\n puts home_team + \", \" + home_score.to_s + \",\" + home_eft_pct.to_s + \",\" + home_tov_pct.to_s + \",\" + home_orb_pct.to_s + \",\" + home_ft_rate.to_s + \", \" + home_result\n\nend", "title": "" }, { "docid": "b79c09feb4e1380ac34a8abf05978f40", "score": "0.5059316", "text": "def biggest_bust(seasonasstring)\n #get all teams in data\n #find all games played by team in season - given by arg\n #get subset of 95 where p is in season marker\n #count games won in subset on 95 / total games in subset on 95\n #get subset of 85 where r is in season marker\n #count games won in subset on 98 / total games in subset on 98\n #result of line 97 - line 99\n #find highest number\n #return team name of result of line 101\n end", "title": "" }, { "docid": "18d8751fea8a6acfea2b9eb9ea509905", "score": "0.5039956", "text": "def get_trailing_avg_day\n how_many_games = {}\n\n names = []\n db = Mysql.new('127.0.0.1','root',ENV[\"SQL_PASSWORD\"],'fanduel')\n name_results = db.query(\"SELECT name from oconnor where fanduel_pts is not null and mp > 0 order by name asc\")\n\n name_results.each do |name_result|\n names << name_result[0]\n end\n names = names.uniq\n\n names.each do |name|\n master_avgs_string = \"#{name}, \"\n\n db = Mysql.new('127.0.0.1','root',ENV[\"SQL_PASSWORD\"],'fanduel')\n results = db.query(\"SELECT date, name, fanduel_pts, mp from oconnor where name='#{Mysql.escape_string(name)}' and fanduel_pts is not null and date < '#{Date.today}' order by date asc\")\n\n games = []\n\n results.each do |result|\n games.push(result[2].to_f/result[3].to_f)\n end\n\n empty = []\n averages1=[]\n averages2=[]\n averages3=[]\n averages4=[]\n averages5=[]\n averages6=[]\n averages7=[]\n averages8=[]\n averages9=[]\n averages10=[]\n averages11=[]\n averages12=[]\n averages13=[]\n averages14=[]\n averages15=[]\n\n differences = [[empty], [averages1], [averages2], [averages3], [averages4], [averages5], [averages6], [averages7], [averages8], [averages9], [averages10], [averages11], [averages12], [averages13], [averages14], [averages15]]\n\n avg_differences = []\n games.each do |game|\n\n game_num = games.index(game)\n if game_num!=0\n #puts \"Actual Performance in game #{game_num}: #{games[game_num]}\"\n\n if game_num > 15\n upper = 15\n else\n upper = game_num\n end\n\n for j in 1..upper\n\n trailing_number = j\n sum = 0\n i = 1\n\n while i <= trailing_number\n game_avg = games[game_num-i]\n sum+= game_avg\n i+=1\n end\n\n trailing_avg = sum/trailing_number\n difference = (games[game_num]-trailing_avg).abs\n differences[trailing_number].push(difference)\n #puts \"#{trailing_number} game average: #{difference} p/m off\"\n end\n end\n end\n haystack = []\n for d in 1..15\n sum=0\n num_of_avgs=0\n differences[d].each do |diff|\n if diff.class==Float\n #puts \"#{d}: #{diff}\"\n sum+=diff\n num_of_avgs+=1\n end\n end\n\n if num_of_avgs>0\n avg_avg = sum/num_of_avgs\n haystack.push(avg_avg)\n master_avgs_string << \"#{avg_avg},\"\n end\n end\n\n if haystack!=nil\n what_to_use = 0\n if haystack.index(haystack.min) != nil\n what_to_use = haystack.index(haystack.min)\n end\n #puts \"#{name} - #{what_to_use+1}\"\n how_many_games[name] = what_to_use+1\n end\n end\n return how_many_games\nend", "title": "" }, { "docid": "d8b9534730648ce2a8b6da5dcd3f8dfa", "score": "0.5007201", "text": "def halvsies(halvme)\n halvme.partition { |i| halvme.length.to_f / 2 > halvme.index(i)}\nend", "title": "" }, { "docid": "17571538f987fecb93d855eb4036dcc9", "score": "0.4992759", "text": "def get_splits\n @logical_splits\n end", "title": "" }, { "docid": "6ea76212f6a553cb2bf68089e88a95d4", "score": "0.498847", "text": "def addFeaturesAndLabel(home_team, away_team, earliest_date, latest_date)\n home_faceoffs = Game.where(\"home_team = ? and away_team = ? and game_date > ? and game_date <= ?\", home_team, away_team, earliest_date, latest_date).order(\"game_date desc\")\n away_faceoffs = Game.where(\"home_team = ? and away_team = ? and game_date > ? and game_date <= ?\", away_team, home_team, earliest_date, latest_date).order(\"game_date desc\")\n past_games = home_faceoffs.concat(away_faceoffs)\n past_games = past_games.sort {|game1, game2| game1.game_date <=> game2.game_date }\n\n if past_games.size < 3\n return\n end\n\n run_differentials = [0, 0, 0]\n\n past_games.each_with_index do |past_game, index|\n feature_set = Feature.new\n\n feature_set.game_id = past_game.id\n feature_set.home_team_won = past_game.home_team_won\n\n if past_game.home_team == home_team.to_s\n feature_set.h2h_diff_1 = run_differentials[2]\n feature_set.h2h_diff_2 = run_differentials[1]\n feature_set.h2h_diff_3 = run_differentials[0]\n\n run_differentials << past_game.home_team_runs - past_game.away_team_runs\n else \n feature_set.h2h_diff_1 = -1*run_differentials[2]\n feature_set.h2h_diff_2 = -1*run_differentials[1]\n feature_set.h2h_diff_3 = -1*run_differentials[0]\n\n run_differentials << past_game.away_team_runs - past_game.home_team_runs \n end\n\n feature_set.save\n\n if run_differentials.size > 3\n run_differentials.shift\n end\n end\nend", "title": "" }, { "docid": "6e8fed8256d033d18d019777d2dbe34d", "score": "0.49634698", "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": "c0301338f9c405906f79539c11ee8006", "score": "0.49508035", "text": "def historic_diff\n # get the two versions to diff\n @new_measure = Measure.by_user(current_user).where({:_id => params[:new_id]}).first\n unless @new_measure\n @new_measure = ArchivedMeasure.where({:measure_db_id => params[:new_id]}).first.to_measure\n end\n\n @old_measure = Measure.by_user(current_user).where({:_id => params[:old_id]}).first\n unless @old_measure\n @old_measure = ArchivedMeasure.where({:measure_db_id => params[:old_id]}).first.to_measure\n end\n\n results = {}\n results['diff'] = []\n results['pre_upload'] = { \n 'cms_id' => @old_measure.cms_id,\n 'updateTime' => (@old_measure.updated_at.tv_sec * 1000),\n 'hqmf_id' => @old_measure.hqmf_id,\n 'hqmf_version_number' => @old_measure.hqmf_version_number }\n results['post_upload'] = { \n 'cms_id' => @new_measure.cms_id,\n 'updateTime' => (@new_measure.updated_at.tv_sec * 1000),\n 'hqmf_id' => @new_measure.hqmf_id,\n 'hqmf_version_number' => @new_measure.hqmf_version_number }\n\n measure_logic_names = HQMF::Measure::LogicExtractor::POPULATION_MAP.clone\n measure_logic_names['VARIABLES'] = 'Variables'\n\n # Walk through the population sets and populations for the measure and create a\n # diffy for each populationm.\n @new_measure.populations.each_with_index do |new_population_set, population_set_index|\n old_population_set = @old_measure.populations[population_set_index]\n population_diff = []\n\n # For each population within the population set, get the population logic and\n # perform the diffy\n measure_logic_names.each_pair do |population_code, population_title|\n # if the code is for VARIABLE, leave it. If it's IPP, etc., then access the actual code name from the\n # population set (e.g. IPP_1).\n code = (population_code == 'VARIABLES') ? 'VARIABLES' : new_population_set[population_code]\n new_logic = @new_measure.measure_logic.find { |logic| logic['code'] == code }\n old_logic = @old_measure.measure_logic.find { |logic| logic['code'] == code }\n\n # skip if both are non existent\n next if !new_logic && !old_logic\n \n # Remove the first line of the measure logic, which is the the name of the population.\n old_logic_text = old_logic ? old_logic['lines'][1..-1].join() : \"\"\n new_logic_text = new_logic ? new_logic['lines'][1..-1].join() : \"\"\n\n logic_diff = Diffy::SplitDiff.new(old_logic_text, new_logic_text,\n format: :html, include_plus_and_minus_in_html: true, allow_empty_diff: false)\n\n population_diff << {code: population_code, title: population_title, pre_upload: logic_diff.left, post_upload: logic_diff.right}\n end\n\n results['diff'] << population_diff\n end\n\n render :json => results\n end", "title": "" }, { "docid": "fc2ab893cec3c9592e7d7a9220c46ac2", "score": "0.4931867", "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": "7f603a19a4ccef2664bc6b2a0be195e3", "score": "0.49256474", "text": "def split_and_evaluate\n self.split(true)\n end", "title": "" }, { "docid": "67ef149932999d15c2b16bb92de6619f", "score": "0.49174857", "text": "def failed_split(*bonds)\n puts \"Ground Truth: #{basic_split(*bonds).inspect}\"\n self.find_internal_adducts unless @adducts\n # binding.pry if bonds.size == 2\n returns = []\n mols = []\n mols2 = []\n product_mols = []\n if bonds.size > 0\n # set apart the adducts\n p delete_and_restore_bonds(*bonds) do |mol|\n mol.ob.separate.map(&:upcast)\n end\n bonds.each do |bond|\n delete_and_restore_bonds(bond) do |mol| \n mols = mol.ob.separate.map(&:upcast)\n puts \"MOLS: #{mols.inspect}\"\n mols = []\n adducts_present = []\n mol.ob.separate.map(&:upcast).map {|a| @adducts.include?(a) ? adducts_present << a : mols << a}\n puts \"MOLS: #{mols.inspect}\"\n product_mols << mols\n end\n end # bonds.each\n puts \"PMOLS: #{product_mols.inspect}\"\n mols\n else\n mols = self.ob.separate.map(&:upcast).delete_if {|a| @adducts.include?(a)}\n mols2 = mols.map(&:dup)\n mols_all = mols.map(&:dup)\n @adducts.map do |adduct|\n #mols2.each {|mol| mol.associate_atom! adduct.atoms.first }\n mols_all.product([adduct]).map {|mol, adduct| mol.associate_atom! adduct.atoms.first }\n mols2.product([adduct]).map {|mol, adduct| mol.associate_atom! adduct.atoms.first }\n end\n# p mols3\n# p mols_all\n# puts \"+\"*50\n# p mols2 != mols\n products = mols2 != mols ? mols.product(mols2) : [mols]\n # p products\n products.delete_if do |set|\n puts \"set: #{set}\"\n set.last.ob.separate.map(&:upcast).include?(set.first)\n puts \"set: #{set}\"\n end\n # p products\n #binding.pry\n #puts \"adduct_added: #{adduct_added.inspect}\"\n # Right now, I'm making the response sets of matched pairs, even if they have adducts... which they should?\n # Is there a better way to feed these back?\n #adduct_added.empty? ? mols : mols.flatten.sort_by(&:mol_wt).reverse.zip(adduct_added.sort_by(&:mol_wt))\n #products.first.is_a?(Array) ? products.flatten : products\n products\n end\n end", "title": "" }, { "docid": "3af61021d510dc56091aee3a4538b4dc", "score": "0.4902739", "text": "def breakingRecords(score)\n times_score_decrease = 0\n times_score_increase = 0\n highest = score[0]\n lowest = score[0]\n score.each do |num|\n if (num > highest)\n highest = num\n times_score_increase += 1\n end\n\n if (num < lowest)\n lowest = num\n times_score_decrease += 1\n end\n end\nend", "title": "" }, { "docid": "942b1919f4cb16e88236a84e6be81d0e", "score": "0.4894405", "text": "def most_specific_subdivision; end", "title": "" }, { "docid": "c7a6ec49dca3f024c4e8b67447dbfc31", "score": "0.48912436", "text": "def least_accurate_team(seasonasstring) # shots in game team stats\n #inverse of above\n end", "title": "" }, { "docid": "3091f9e6c612be6cdc3dce69a974c903", "score": "0.4889837", "text": "def find_and_set_season_episode_fields\n @season_ep_field_pos = nil\n SeasonEp_Regexps.each do |re|\n @filename_fields.each_with_index do |fn_field, idx|\n if fn_field =~ re\n @season_ep_field_pos = idx\n @result[:season] = $1.to_i\n @result[:episode] = $2.to_i\n break\n end\n end\n break unless @season_ep_field_pos.nil?\n end\n @season_ep_field_pos\n end", "title": "" }, { "docid": "c2d9bb0fe31a1b69a1499cf0ac2c537c", "score": "0.48897907", "text": "def retrieve_season_hall_of_fame\n seasons_hall_of_fame = []\n get_involved_teams unless @involved_teams\n\n @involved_teams.each do |team|\n team_placement = {}\n team_placement[:team] = team\n %w[first_place second_place third_place].each_with_index do |rank, index|\n placement = index + 1\n team_placement[rank.to_sym] = team.computed_season_ranking.joins(:season).where(\"seasons.season_type_id = #{@season_type.id} AND computed_season_rankings.rank = #{placement}\").count\n end\n seasons_hall_of_fame << team_placement\n end\n seasons_hall_of_fame.sort { |p, n| (n[:first_place] * 10_000 + n[:second_place] * 100 + n[:third_place]) <=> (p[:first_place] * 10_000 + p[:second_place] * 100 + p[:third_place]) }\n end", "title": "" }, { "docid": "93ed77c94649283243ebb2ba02df1e3c", "score": "0.4884894", "text": "def split(p, pstate)\nm = []\nr = p[0]\npn = []\np.each{|p0| pn.push(p0)}\npn.delete(p[0])\ntag = 0\npn.each{|p0|\[email protected]{|a|\nt1 = get_transition(r, a)\nt2 = get_transition(p0, a)\ntag = 0\nif t1 != nil && t2 != nil\npstate.each{|s|\nif !(t1 == t2)\nif !(m.include?(p0))\nif s.include?(t1[0]) && s.include?(t2[0])\ntag = 1\nend\nend\nelse\ntag = 1\nend\n}\nif tag == 0\nm.push(p0)\nend\nelsif t2 == nil && t1 == nil\nnext\nelsif t1 != nil || t2 != nil\nm.push(p0)\nend\n}\n}\nm.each{|o| p.delete(o)}\np = p.sort\nresult = [p, m]\nresult\nend", "title": "" }, { "docid": "2f7d990a4962a10c4e6dd79eba5a3d57", "score": "0.4884276", "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": "54b5a04b5709efbda06f838626206ec1", "score": "0.48714972", "text": "def goodVsEvil(good, evil)\n # good_power, evil_power = 0, 0\n # good.split.each_with_index do |num, i|\n # if i < 3\n # good_power += num.to_i * (i + 1)\n # elsif i < 5\n # good_power += num.to_i * i\n # elsif i == 5\n # good_power += num.to_i * 2 * i\n # end\n # end\n god = good.split.each_with_index.inject(0) do |sum, (num, i)|\n if i < 3\n sum + num.to_i * (i + 1)\n elsif i < 5\n sum + num.to_i * i\n elsif i == 5\n sum + num.to_i * 2 * i\n end\n end\n \n \n evl = evil.split.each_with_index.inject(0) do |sum, (num, i)|\n case i\n when 0\n sum + num.to_i * (i + 1)\n when 1, 2, 3\n sum + num.to_i * 2\n when 4\n sum + num.to_i * (i - 1)\n when 5\n sum + num.to_i * i\n when 6\n sum + num.to_i * (i + 4) \n end\n end\n \n if evl > god\n str = \"Evil eradicates all trace of Good\"\n elsif evl < god\n str = \"Good triumphs over Evil\"\n else\n str = \"No victor on this battle field\"\n end\n \n \"Battle Result: #{str}\"\nend", "title": "" }, { "docid": "0ff702e4d5bbeff92bd90b4e10e25248", "score": "0.4856306", "text": "def addFeaturesAndLabel(team, earliest_date, latest_date, examples, labels)\n home_faceoffs = Game.where(\"home_team = ? and game_date > ? and game_date <= ?\", team, earliest_date, latest_date).order(\"game_date desc\")\n away_faceoffs = Game.where(\"away_team = ? and game_date > ? and game_date <= ?\", team, earliest_date, latest_date).order(\"game_date desc\")\n past_games = home_faceoffs.concat(away_faceoffs)\n # games sort in ascending order. The first game of the 2001 season is located first\n past_games = past_games.sort {|game1, game2| game1.game_date <=> game2.game_date }\n \n player_performances = Hash.new\n\n past_games.each_with_index do |past_game, index|\n feature_set = Feature.find_by_game_id(past_game.id)\n performances = Performance.where(\"game_id = ?\", past_game.id)\n\n performances.each do |perf|\n player = Player.find_by_id(perf.player_id)\n if !player_performances.has_key?(player.retrosheet_id)\n addBlankPlayer(player.retrosheet_id, player_performances)\n end\n end\n\n if past_game.home_team == team.to_s\n feature_set.home_batting_spot_1_walks_last_1_game = player_performances[past_game.home_batting_spot_1][\"walks_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_2_walks_last_1_game = player_performances[past_game.home_batting_spot_2][\"walks_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_3_walks_last_1_game = player_performances[past_game.home_batting_spot_3][\"walks_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_4_walks_last_1_game = player_performances[past_game.home_batting_spot_4][\"walks_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_5_walks_last_1_game = player_performances[past_game.home_batting_spot_5][\"walks_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_6_walks_last_1_game = player_performances[past_game.home_batting_spot_6][\"walks_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_7_walks_last_1_game = player_performances[past_game.home_batting_spot_7][\"walks_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_8_walks_last_1_game = player_performances[past_game.home_batting_spot_8][\"walks_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_9_walks_last_1_game = player_performances[past_game.home_batting_spot_9][\"walks_last_1_game\"].reduce(:+)\n \n feature_set.home_batting_spot_1_walks_last_2_games = player_performances[past_game.home_batting_spot_1][\"walks_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_2_walks_last_2_games = player_performances[past_game.home_batting_spot_2][\"walks_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_3_walks_last_2_games = player_performances[past_game.home_batting_spot_3][\"walks_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_4_walks_last_2_games = player_performances[past_game.home_batting_spot_4][\"walks_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_5_walks_last_2_games = player_performances[past_game.home_batting_spot_5][\"walks_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_6_walks_last_2_games = player_performances[past_game.home_batting_spot_6][\"walks_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_7_walks_last_2_games = player_performances[past_game.home_batting_spot_7][\"walks_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_8_walks_last_2_games = player_performances[past_game.home_batting_spot_8][\"walks_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_9_walks_last_2_games = player_performances[past_game.home_batting_spot_9][\"walks_last_2_games\"].reduce(:+)\n\n feature_set.home_batting_spot_1_walks_last_5_games = player_performances[past_game.home_batting_spot_1][\"walks_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_2_walks_last_5_games = player_performances[past_game.home_batting_spot_2][\"walks_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_3_walks_last_5_games = player_performances[past_game.home_batting_spot_3][\"walks_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_4_walks_last_5_games = player_performances[past_game.home_batting_spot_4][\"walks_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_5_walks_last_5_games = player_performances[past_game.home_batting_spot_5][\"walks_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_6_walks_last_5_games = player_performances[past_game.home_batting_spot_6][\"walks_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_7_walks_last_5_games = player_performances[past_game.home_batting_spot_7][\"walks_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_8_walks_last_5_games = player_performances[past_game.home_batting_spot_8][\"walks_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_9_walks_last_5_games = player_performances[past_game.home_batting_spot_9][\"walks_last_5_games\"].reduce(:+)\n\n feature_set.home_batting_spot_1_walks_last_10_games = player_performances[past_game.home_batting_spot_1][\"walks_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_2_walks_last_10_games = player_performances[past_game.home_batting_spot_2][\"walks_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_3_walks_last_10_games = player_performances[past_game.home_batting_spot_3][\"walks_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_4_walks_last_10_games = player_performances[past_game.home_batting_spot_4][\"walks_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_5_walks_last_10_games = player_performances[past_game.home_batting_spot_5][\"walks_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_6_walks_last_10_games = player_performances[past_game.home_batting_spot_6][\"walks_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_7_walks_last_10_games = player_performances[past_game.home_batting_spot_7][\"walks_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_8_walks_last_10_games = player_performances[past_game.home_batting_spot_8][\"walks_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_9_walks_last_10_games = player_performances[past_game.home_batting_spot_9][\"walks_last_10_games\"].reduce(:+)\n\n feature_set.home_batting_spot_1_walks_last_20_games = player_performances[past_game.home_batting_spot_1][\"walks_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_2_walks_last_20_games = player_performances[past_game.home_batting_spot_2][\"walks_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_3_walks_last_20_games = player_performances[past_game.home_batting_spot_3][\"walks_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_4_walks_last_20_games = player_performances[past_game.home_batting_spot_4][\"walks_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_5_walks_last_20_games = player_performances[past_game.home_batting_spot_5][\"walks_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_6_walks_last_20_games = player_performances[past_game.home_batting_spot_6][\"walks_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_7_walks_last_20_games = player_performances[past_game.home_batting_spot_7][\"walks_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_8_walks_last_20_games = player_performances[past_game.home_batting_spot_8][\"walks_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_9_walks_last_20_games = player_performances[past_game.home_batting_spot_9][\"walks_last_20_games\"].reduce(:+)\n\n \n feature_set.home_batting_spot_1_walks_per_game_career = player_performances[past_game.home_batting_spot_1][\"career_games\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"career_walks\"] / player_performances[past_game.home_batting_spot_1][\"career_games\"]\n feature_set.home_batting_spot_2_walks_per_game_career = player_performances[past_game.home_batting_spot_2][\"career_games\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"career_walks\"] / player_performances[past_game.home_batting_spot_2][\"career_games\"]\n feature_set.home_batting_spot_3_walks_per_game_career = player_performances[past_game.home_batting_spot_3][\"career_games\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"career_walks\"] / player_performances[past_game.home_batting_spot_3][\"career_games\"]\n feature_set.home_batting_spot_4_walks_per_game_career = player_performances[past_game.home_batting_spot_4][\"career_games\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"career_walks\"] / player_performances[past_game.home_batting_spot_4][\"career_games\"]\n feature_set.home_batting_spot_5_walks_per_game_career = player_performances[past_game.home_batting_spot_5][\"career_games\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"career_walks\"] / player_performances[past_game.home_batting_spot_5][\"career_games\"]\n feature_set.home_batting_spot_6_walks_per_game_career = player_performances[past_game.home_batting_spot_6][\"career_games\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"career_walks\"] / player_performances[past_game.home_batting_spot_6][\"career_games\"]\n feature_set.home_batting_spot_7_walks_per_game_career = player_performances[past_game.home_batting_spot_7][\"career_games\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"career_walks\"] / player_performances[past_game.home_batting_spot_7][\"career_games\"]\n feature_set.home_batting_spot_8_walks_per_game_career = player_performances[past_game.home_batting_spot_8][\"career_games\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"career_walks\"] / player_performances[past_game.home_batting_spot_8][\"career_games\"]\n feature_set.home_batting_spot_9_walks_per_game_career = player_performances[past_game.home_batting_spot_9][\"career_games\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"career_walks\"] / player_performances[past_game.home_batting_spot_9][\"career_games\"]\n \n\n feature_set.home_batting_spot_1_batting_percentage_last_1_game = player_performances[past_game.home_batting_spot_1][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_1][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_2_batting_percentage_last_1_game = player_performances[past_game.home_batting_spot_2][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_2][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_3_batting_percentage_last_1_game = player_performances[past_game.home_batting_spot_3][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_3][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_4_batting_percentage_last_1_game = player_performances[past_game.home_batting_spot_4][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_4][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_5_batting_percentage_last_1_game = player_performances[past_game.home_batting_spot_5][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_5][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_6_batting_percentage_last_1_game = player_performances[past_game.home_batting_spot_6][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_6][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_7_batting_percentage_last_1_game = player_performances[past_game.home_batting_spot_7][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_7][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_8_batting_percentage_last_1_game = player_performances[past_game.home_batting_spot_8][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_8][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_9_batting_percentage_last_1_game = player_performances[past_game.home_batting_spot_9][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_9][\"at_bats_last_1_game\"].reduce(:+)\n\n feature_set.home_batting_spot_1_batting_percentage_last_2_games = player_performances[past_game.home_batting_spot_1][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_1][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_2_batting_percentage_last_2_games = player_performances[past_game.home_batting_spot_2][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_2][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_3_batting_percentage_last_2_games = player_performances[past_game.home_batting_spot_3][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_3][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_4_batting_percentage_last_2_games = player_performances[past_game.home_batting_spot_4][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_4][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_5_batting_percentage_last_2_games = player_performances[past_game.home_batting_spot_5][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_5][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_6_batting_percentage_last_2_games = player_performances[past_game.home_batting_spot_6][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_6][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_7_batting_percentage_last_2_games = player_performances[past_game.home_batting_spot_7][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_7][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_8_batting_percentage_last_2_games = player_performances[past_game.home_batting_spot_8][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_8][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_9_batting_percentage_last_2_games = player_performances[past_game.home_batting_spot_9][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_9][\"at_bats_last_2_games\"].reduce(:+)\n\n feature_set.home_batting_spot_1_batting_percentage_last_5_games = player_performances[past_game.home_batting_spot_1][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_1][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_2_batting_percentage_last_5_games = player_performances[past_game.home_batting_spot_2][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_2][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_3_batting_percentage_last_5_games = player_performances[past_game.home_batting_spot_3][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_3][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_4_batting_percentage_last_5_games = player_performances[past_game.home_batting_spot_4][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_4][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_5_batting_percentage_last_5_games = player_performances[past_game.home_batting_spot_5][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_5][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_6_batting_percentage_last_5_games = player_performances[past_game.home_batting_spot_6][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_6][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_7_batting_percentage_last_5_games = player_performances[past_game.home_batting_spot_7][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_7][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_8_batting_percentage_last_5_games = player_performances[past_game.home_batting_spot_8][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_8][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_9_batting_percentage_last_5_games = player_performances[past_game.home_batting_spot_9][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_9][\"at_bats_last_5_games\"].reduce(:+)\n\n feature_set.home_batting_spot_1_batting_percentage_last_10_games = player_performances[past_game.home_batting_spot_1][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_1][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_2_batting_percentage_last_10_games = player_performances[past_game.home_batting_spot_2][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_2][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_3_batting_percentage_last_10_games = player_performances[past_game.home_batting_spot_3][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_3][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_4_batting_percentage_last_10_games = player_performances[past_game.home_batting_spot_4][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_4][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_5_batting_percentage_last_10_games = player_performances[past_game.home_batting_spot_5][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_5][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_6_batting_percentage_last_10_games = player_performances[past_game.home_batting_spot_6][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_6][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_7_batting_percentage_last_10_games = player_performances[past_game.home_batting_spot_7][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_7][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_8_batting_percentage_last_10_games = player_performances[past_game.home_batting_spot_8][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_8][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_9_batting_percentage_last_10_games = player_performances[past_game.home_batting_spot_9][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_9][\"at_bats_last_10_games\"].reduce(:+)\n\n feature_set.home_batting_spot_1_batting_percentage_last_20_games = player_performances[past_game.home_batting_spot_1][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_1][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_2_batting_percentage_last_20_games = player_performances[past_game.home_batting_spot_2][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_2][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_3_batting_percentage_last_20_games = player_performances[past_game.home_batting_spot_3][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_3][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_4_batting_percentage_last_20_games = player_performances[past_game.home_batting_spot_4][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_4][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_5_batting_percentage_last_20_games = player_performances[past_game.home_batting_spot_5][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_5][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_6_batting_percentage_last_20_games = player_performances[past_game.home_batting_spot_6][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_6][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_7_batting_percentage_last_20_games = player_performances[past_game.home_batting_spot_7][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_7][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_8_batting_percentage_last_20_games = player_performances[past_game.home_batting_spot_8][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_8][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_9_batting_percentage_last_20_games = player_performances[past_game.home_batting_spot_9][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_9][\"at_bats_last_20_games\"].reduce(:+)\n\n feature_set.home_batting_spot_1_batting_percentage_career = player_performances[past_game.home_batting_spot_1][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"career_hits\"] / player_performances[past_game.home_batting_spot_1][\"career_at_bats\"]\n feature_set.home_batting_spot_2_batting_percentage_career = player_performances[past_game.home_batting_spot_2][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"career_hits\"] / player_performances[past_game.home_batting_spot_2][\"career_at_bats\"]\n feature_set.home_batting_spot_3_batting_percentage_career = player_performances[past_game.home_batting_spot_3][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"career_hits\"] / player_performances[past_game.home_batting_spot_3][\"career_at_bats\"]\n feature_set.home_batting_spot_4_batting_percentage_career = player_performances[past_game.home_batting_spot_4][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"career_hits\"] / player_performances[past_game.home_batting_spot_4][\"career_at_bats\"]\n feature_set.home_batting_spot_5_batting_percentage_career = player_performances[past_game.home_batting_spot_5][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"career_hits\"] / player_performances[past_game.home_batting_spot_5][\"career_at_bats\"]\n feature_set.home_batting_spot_6_batting_percentage_career = player_performances[past_game.home_batting_spot_6][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"career_hits\"] / player_performances[past_game.home_batting_spot_6][\"career_at_bats\"]\n feature_set.home_batting_spot_7_batting_percentage_career = player_performances[past_game.home_batting_spot_7][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"career_hits\"] / player_performances[past_game.home_batting_spot_7][\"career_at_bats\"]\n feature_set.home_batting_spot_8_batting_percentage_career = player_performances[past_game.home_batting_spot_8][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"career_hits\"] / player_performances[past_game.home_batting_spot_8][\"career_at_bats\"]\n feature_set.home_batting_spot_9_batting_percentage_career = player_performances[past_game.home_batting_spot_9][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"career_hits\"] / player_performances[past_game.home_batting_spot_9][\"career_at_bats\"]\n\n feature_set.home_batting_spot_1_OPS_last_1_game = player_performances[past_game.home_batting_spot_1][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_1][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_2_OPS_last_1_game = player_performances[past_game.home_batting_spot_2][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_2][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_3_OPS_last_1_game = player_performances[past_game.home_batting_spot_3][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_3][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_4_OPS_last_1_game = player_performances[past_game.home_batting_spot_4][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_4][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_5_OPS_last_1_game = player_performances[past_game.home_batting_spot_5][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_5][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_6_OPS_last_1_game = player_performances[past_game.home_batting_spot_6][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_6][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_7_OPS_last_1_game = player_performances[past_game.home_batting_spot_7][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_7][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_8_OPS_last_1_game = player_performances[past_game.home_batting_spot_8][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_8][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_9_OPS_last_1_game = player_performances[past_game.home_batting_spot_9][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_9][\"at_bats_last_1_game\"].reduce(:+)\n\n feature_set.home_batting_spot_1_OPS_last_2_games = player_performances[past_game.home_batting_spot_1][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_1][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_2_OPS_last_2_games = player_performances[past_game.home_batting_spot_2][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_2][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_3_OPS_last_2_games = player_performances[past_game.home_batting_spot_3][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_3][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_4_OPS_last_2_games = player_performances[past_game.home_batting_spot_4][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_4][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_5_OPS_last_2_games = player_performances[past_game.home_batting_spot_5][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_5][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_6_OPS_last_2_games = player_performances[past_game.home_batting_spot_6][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_6][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_7_OPS_last_2_games = player_performances[past_game.home_batting_spot_7][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_7][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_8_OPS_last_2_games = player_performances[past_game.home_batting_spot_8][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_8][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_9_OPS_last_2_games = player_performances[past_game.home_batting_spot_9][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_9][\"at_bats_last_2_games\"].reduce(:+)\n\n feature_set.home_batting_spot_1_OPS_last_5_games = player_performances[past_game.home_batting_spot_1][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_1][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_2_OPS_last_5_games = player_performances[past_game.home_batting_spot_2][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_2][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_3_OPS_last_5_games = player_performances[past_game.home_batting_spot_3][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_3][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_4_OPS_last_5_games = player_performances[past_game.home_batting_spot_4][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_4][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_5_OPS_last_5_games = player_performances[past_game.home_batting_spot_5][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_5][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_6_OPS_last_5_games = player_performances[past_game.home_batting_spot_6][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_6][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_7_OPS_last_5_games = player_performances[past_game.home_batting_spot_7][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_7][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_8_OPS_last_5_games = player_performances[past_game.home_batting_spot_8][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_8][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_9_OPS_last_5_games = player_performances[past_game.home_batting_spot_9][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_9][\"at_bats_last_5_games\"].reduce(:+)\n\n feature_set.home_batting_spot_1_OPS_last_10_games = player_performances[past_game.home_batting_spot_1][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_1][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_2_OPS_last_10_games = player_performances[past_game.home_batting_spot_2][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_2][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_3_OPS_last_10_games = player_performances[past_game.home_batting_spot_3][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_3][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_4_OPS_last_10_games = player_performances[past_game.home_batting_spot_4][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_4][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_5_OPS_last_10_games = player_performances[past_game.home_batting_spot_5][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_5][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_6_OPS_last_10_games = player_performances[past_game.home_batting_spot_6][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_6][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_7_OPS_last_10_games = player_performances[past_game.home_batting_spot_7][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_7][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_8_OPS_last_10_games = player_performances[past_game.home_batting_spot_8][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_8][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_9_OPS_last_10_games = player_performances[past_game.home_batting_spot_9][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_9][\"at_bats_last_10_games\"].reduce(:+)\n\n feature_set.home_batting_spot_1_OPS_last_20_games = player_performances[past_game.home_batting_spot_1][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_1][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_2_OPS_last_20_games = player_performances[past_game.home_batting_spot_2][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_2][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_3_OPS_last_20_games = player_performances[past_game.home_batting_spot_3][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_3][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_4_OPS_last_20_games = player_performances[past_game.home_batting_spot_4][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_4][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_5_OPS_last_20_games = player_performances[past_game.home_batting_spot_5][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_5][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_6_OPS_last_20_games = player_performances[past_game.home_batting_spot_6][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_6][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_7_OPS_last_20_games = player_performances[past_game.home_batting_spot_7][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_7][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_8_OPS_last_20_games = player_performances[past_game.home_batting_spot_8][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_8][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_9_OPS_last_20_games = player_performances[past_game.home_batting_spot_9][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_9][\"at_bats_last_20_games\"].reduce(:+)\n\n feature_set.home_batting_spot_1_OPS_career = player_performances[past_game.home_batting_spot_1][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"career_total_bases\"] / player_performances[past_game.home_batting_spot_1][\"career_at_bats\"]\n feature_set.home_batting_spot_2_OPS_career = player_performances[past_game.home_batting_spot_2][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"career_total_bases\"] / player_performances[past_game.home_batting_spot_2][\"career_at_bats\"]\n feature_set.home_batting_spot_3_OPS_career = player_performances[past_game.home_batting_spot_3][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"career_total_bases\"] / player_performances[past_game.home_batting_spot_3][\"career_at_bats\"]\n feature_set.home_batting_spot_4_OPS_career = player_performances[past_game.home_batting_spot_4][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"career_total_bases\"] / player_performances[past_game.home_batting_spot_4][\"career_at_bats\"]\n feature_set.home_batting_spot_5_OPS_career = player_performances[past_game.home_batting_spot_5][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"career_total_bases\"] / player_performances[past_game.home_batting_spot_5][\"career_at_bats\"]\n feature_set.home_batting_spot_6_OPS_career = player_performances[past_game.home_batting_spot_6][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"career_total_bases\"] / player_performances[past_game.home_batting_spot_6][\"career_at_bats\"]\n feature_set.home_batting_spot_7_OPS_career = player_performances[past_game.home_batting_spot_7][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"career_total_bases\"] / player_performances[past_game.home_batting_spot_7][\"career_at_bats\"]\n feature_set.home_batting_spot_8_OPS_career = player_performances[past_game.home_batting_spot_8][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"career_total_bases\"] / player_performances[past_game.home_batting_spot_8][\"career_at_bats\"]\n feature_set.home_batting_spot_9_OPS_career = player_performances[past_game.home_batting_spot_9][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"career_total_bases\"] / player_performances[past_game.home_batting_spot_9][\"career_at_bats\"]\n\n feature_set.home_batting_spot_1_strikeout_rate_last_1_game = player_performances[past_game.home_batting_spot_1][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_1][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_2_strikeout_rate_last_1_game = player_performances[past_game.home_batting_spot_2][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_2][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_3_strikeout_rate_last_1_game = player_performances[past_game.home_batting_spot_3][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_3][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_4_strikeout_rate_last_1_game = player_performances[past_game.home_batting_spot_4][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_4][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_5_strikeout_rate_last_1_game = player_performances[past_game.home_batting_spot_5][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_5][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_6_strikeout_rate_last_1_game = player_performances[past_game.home_batting_spot_6][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_6][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_7_strikeout_rate_last_1_game = player_performances[past_game.home_batting_spot_7][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_7][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_8_strikeout_rate_last_1_game = player_performances[past_game.home_batting_spot_8][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_8][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.home_batting_spot_9_strikeout_rate_last_1_game = player_performances[past_game.home_batting_spot_9][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_9][\"at_bats_last_1_game\"].reduce(:+)\n\n feature_set.home_batting_spot_1_strikeout_rate_last_2_games = player_performances[past_game.home_batting_spot_1][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_1][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_2_strikeout_rate_last_2_games = player_performances[past_game.home_batting_spot_2][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_2][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_3_strikeout_rate_last_2_games = player_performances[past_game.home_batting_spot_3][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_3][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_4_strikeout_rate_last_2_games = player_performances[past_game.home_batting_spot_4][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_4][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_5_strikeout_rate_last_2_games = player_performances[past_game.home_batting_spot_5][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_5][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_6_strikeout_rate_last_2_games = player_performances[past_game.home_batting_spot_6][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_6][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_7_strikeout_rate_last_2_games = player_performances[past_game.home_batting_spot_7][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_7][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_8_strikeout_rate_last_2_games = player_performances[past_game.home_batting_spot_8][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_8][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.home_batting_spot_9_strikeout_rate_last_2_games = player_performances[past_game.home_batting_spot_9][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_9][\"at_bats_last_2_games\"].reduce(:+)\n\n feature_set.home_batting_spot_1_strikeout_rate_last_5_games = player_performances[past_game.home_batting_spot_1][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_1][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_2_strikeout_rate_last_5_games = player_performances[past_game.home_batting_spot_2][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_2][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_3_strikeout_rate_last_5_games = player_performances[past_game.home_batting_spot_3][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_3][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_4_strikeout_rate_last_5_games = player_performances[past_game.home_batting_spot_4][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_4][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_5_strikeout_rate_last_5_games = player_performances[past_game.home_batting_spot_5][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_5][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_6_strikeout_rate_last_5_games = player_performances[past_game.home_batting_spot_6][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_6][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_7_strikeout_rate_last_5_games = player_performances[past_game.home_batting_spot_7][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_7][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_8_strikeout_rate_last_5_games = player_performances[past_game.home_batting_spot_8][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_8][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.home_batting_spot_9_strikeout_rate_last_5_games = player_performances[past_game.home_batting_spot_9][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_9][\"at_bats_last_5_games\"].reduce(:+)\n\n feature_set.home_batting_spot_1_strikeout_rate_last_10_games = player_performances[past_game.home_batting_spot_1][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_1][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_2_strikeout_rate_last_10_games = player_performances[past_game.home_batting_spot_2][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_2][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_3_strikeout_rate_last_10_games = player_performances[past_game.home_batting_spot_3][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_3][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_4_strikeout_rate_last_10_games = player_performances[past_game.home_batting_spot_4][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_4][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_5_strikeout_rate_last_10_games = player_performances[past_game.home_batting_spot_5][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_5][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_6_strikeout_rate_last_10_games = player_performances[past_game.home_batting_spot_6][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_6][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_7_strikeout_rate_last_10_games = player_performances[past_game.home_batting_spot_7][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_7][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_8_strikeout_rate_last_10_games = player_performances[past_game.home_batting_spot_8][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_8][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.home_batting_spot_9_strikeout_rate_last_10_games = player_performances[past_game.home_batting_spot_9][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_9][\"at_bats_last_10_games\"].reduce(:+)\n\n feature_set.home_batting_spot_1_strikeout_rate_last_20_games = player_performances[past_game.home_batting_spot_1][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_1][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_2_strikeout_rate_last_20_games = player_performances[past_game.home_batting_spot_2][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_2][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_3_strikeout_rate_last_20_games = player_performances[past_game.home_batting_spot_3][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_3][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_4_strikeout_rate_last_20_games = player_performances[past_game.home_batting_spot_4][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_4][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_5_strikeout_rate_last_20_games = player_performances[past_game.home_batting_spot_5][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_5][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_6_strikeout_rate_last_20_games = player_performances[past_game.home_batting_spot_6][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_6][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_7_strikeout_rate_last_20_games = player_performances[past_game.home_batting_spot_7][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_7][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_8_strikeout_rate_last_20_games = player_performances[past_game.home_batting_spot_8][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_8][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.home_batting_spot_9_strikeout_rate_last_20_games = player_performances[past_game.home_batting_spot_9][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.home_batting_spot_9][\"at_bats_last_20_games\"].reduce(:+)\n \n feature_set.home_batting_spot_1_strikeout_rate_career = player_performances[past_game.home_batting_spot_1][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_1][\"career_strikeouts\"] / player_performances[past_game.home_batting_spot_1][\"career_at_bats\"]\n feature_set.home_batting_spot_2_strikeout_rate_career = player_performances[past_game.home_batting_spot_2][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_2][\"career_strikeouts\"] / player_performances[past_game.home_batting_spot_2][\"career_at_bats\"]\n feature_set.home_batting_spot_3_strikeout_rate_career = player_performances[past_game.home_batting_spot_3][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_3][\"career_strikeouts\"] / player_performances[past_game.home_batting_spot_3][\"career_at_bats\"]\n feature_set.home_batting_spot_4_strikeout_rate_career = player_performances[past_game.home_batting_spot_4][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_4][\"career_strikeouts\"] / player_performances[past_game.home_batting_spot_4][\"career_at_bats\"]\n feature_set.home_batting_spot_5_strikeout_rate_career = player_performances[past_game.home_batting_spot_5][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_5][\"career_strikeouts\"] / player_performances[past_game.home_batting_spot_5][\"career_at_bats\"]\n feature_set.home_batting_spot_6_strikeout_rate_career = player_performances[past_game.home_batting_spot_6][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_6][\"career_strikeouts\"] / player_performances[past_game.home_batting_spot_6][\"career_at_bats\"]\n feature_set.home_batting_spot_7_strikeout_rate_career = player_performances[past_game.home_batting_spot_7][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_7][\"career_strikeouts\"] / player_performances[past_game.home_batting_spot_7][\"career_at_bats\"]\n feature_set.home_batting_spot_8_strikeout_rate_career = player_performances[past_game.home_batting_spot_8][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_8][\"career_strikeouts\"] / player_performances[past_game.home_batting_spot_8][\"career_at_bats\"]\n feature_set.home_batting_spot_9_strikeout_rate_career = player_performances[past_game.home_batting_spot_9][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.home_batting_spot_9][\"career_strikeouts\"] / player_performances[past_game.home_batting_spot_9][\"career_at_bats\"]\n else\n \n feature_set.away_batting_spot_1_walks_last_1_game = player_performances[past_game.away_batting_spot_1][\"walks_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_2_walks_last_1_game = player_performances[past_game.away_batting_spot_2][\"walks_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_3_walks_last_1_game = player_performances[past_game.away_batting_spot_3][\"walks_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_4_walks_last_1_game = player_performances[past_game.away_batting_spot_4][\"walks_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_5_walks_last_1_game = player_performances[past_game.away_batting_spot_5][\"walks_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_6_walks_last_1_game = player_performances[past_game.away_batting_spot_6][\"walks_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_7_walks_last_1_game = player_performances[past_game.away_batting_spot_7][\"walks_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_8_walks_last_1_game = player_performances[past_game.away_batting_spot_8][\"walks_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_9_walks_last_1_game = player_performances[past_game.away_batting_spot_9][\"walks_last_1_game\"].reduce(:+)\n\n feature_set.away_batting_spot_1_walks_last_2_games = player_performances[past_game.away_batting_spot_1][\"walks_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_2_walks_last_2_games = player_performances[past_game.away_batting_spot_2][\"walks_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_3_walks_last_2_games = player_performances[past_game.away_batting_spot_3][\"walks_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_4_walks_last_2_games = player_performances[past_game.away_batting_spot_4][\"walks_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_5_walks_last_2_games = player_performances[past_game.away_batting_spot_5][\"walks_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_6_walks_last_2_games = player_performances[past_game.away_batting_spot_6][\"walks_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_7_walks_last_2_games = player_performances[past_game.away_batting_spot_7][\"walks_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_8_walks_last_2_games = player_performances[past_game.away_batting_spot_8][\"walks_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_9_walks_last_2_games = player_performances[past_game.away_batting_spot_9][\"walks_last_2_games\"].reduce(:+)\n\n feature_set.away_batting_spot_1_walks_last_5_games = player_performances[past_game.away_batting_spot_1][\"walks_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_2_walks_last_5_games = player_performances[past_game.away_batting_spot_2][\"walks_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_3_walks_last_5_games = player_performances[past_game.away_batting_spot_3][\"walks_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_4_walks_last_5_games = player_performances[past_game.away_batting_spot_4][\"walks_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_5_walks_last_5_games = player_performances[past_game.away_batting_spot_5][\"walks_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_6_walks_last_5_games = player_performances[past_game.away_batting_spot_6][\"walks_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_7_walks_last_5_games = player_performances[past_game.away_batting_spot_7][\"walks_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_8_walks_last_5_games = player_performances[past_game.away_batting_spot_8][\"walks_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_9_walks_last_5_games = player_performances[past_game.away_batting_spot_9][\"walks_last_5_games\"].reduce(:+)\n\n feature_set.away_batting_spot_1_walks_last_10_games = player_performances[past_game.away_batting_spot_1][\"walks_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_2_walks_last_10_games = player_performances[past_game.away_batting_spot_2][\"walks_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_3_walks_last_10_games = player_performances[past_game.away_batting_spot_3][\"walks_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_4_walks_last_10_games = player_performances[past_game.away_batting_spot_4][\"walks_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_5_walks_last_10_games = player_performances[past_game.away_batting_spot_5][\"walks_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_6_walks_last_10_games = player_performances[past_game.away_batting_spot_6][\"walks_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_7_walks_last_10_games = player_performances[past_game.away_batting_spot_7][\"walks_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_8_walks_last_10_games = player_performances[past_game.away_batting_spot_8][\"walks_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_9_walks_last_10_games = player_performances[past_game.away_batting_spot_9][\"walks_last_10_games\"].reduce(:+)\n\n feature_set.away_batting_spot_1_walks_last_20_games = player_performances[past_game.away_batting_spot_1][\"walks_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_2_walks_last_20_games = player_performances[past_game.away_batting_spot_2][\"walks_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_3_walks_last_20_games = player_performances[past_game.away_batting_spot_3][\"walks_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_4_walks_last_20_games = player_performances[past_game.away_batting_spot_4][\"walks_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_5_walks_last_20_games = player_performances[past_game.away_batting_spot_5][\"walks_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_6_walks_last_20_games = player_performances[past_game.away_batting_spot_6][\"walks_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_7_walks_last_20_games = player_performances[past_game.away_batting_spot_7][\"walks_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_8_walks_last_20_games = player_performances[past_game.away_batting_spot_8][\"walks_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_9_walks_last_20_games = player_performances[past_game.away_batting_spot_9][\"walks_last_20_games\"].reduce(:+)\n\n feature_set.away_batting_spot_1_walks_per_game_career = player_performances[past_game.away_batting_spot_1][\"career_games\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"career_walks\"] / player_performances[past_game.away_batting_spot_1][\"career_games\"]\n feature_set.away_batting_spot_2_walks_per_game_career = player_performances[past_game.away_batting_spot_2][\"career_games\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"career_walks\"] / player_performances[past_game.away_batting_spot_2][\"career_games\"]\n feature_set.away_batting_spot_3_walks_per_game_career = player_performances[past_game.away_batting_spot_3][\"career_games\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"career_walks\"] / player_performances[past_game.away_batting_spot_3][\"career_games\"]\n feature_set.away_batting_spot_4_walks_per_game_career = player_performances[past_game.away_batting_spot_4][\"career_games\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"career_walks\"] / player_performances[past_game.away_batting_spot_4][\"career_games\"]\n feature_set.away_batting_spot_5_walks_per_game_career = player_performances[past_game.away_batting_spot_5][\"career_games\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"career_walks\"] / player_performances[past_game.away_batting_spot_5][\"career_games\"]\n feature_set.away_batting_spot_6_walks_per_game_career = player_performances[past_game.away_batting_spot_6][\"career_games\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"career_walks\"] / player_performances[past_game.away_batting_spot_6][\"career_games\"]\n feature_set.away_batting_spot_7_walks_per_game_career = player_performances[past_game.away_batting_spot_7][\"career_games\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"career_walks\"] / player_performances[past_game.away_batting_spot_7][\"career_games\"]\n feature_set.away_batting_spot_8_walks_per_game_career = player_performances[past_game.away_batting_spot_8][\"career_games\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"career_walks\"] / player_performances[past_game.away_batting_spot_8][\"career_games\"]\n feature_set.away_batting_spot_9_walks_per_game_career = player_performances[past_game.away_batting_spot_9][\"career_games\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"career_walks\"] / player_performances[past_game.away_batting_spot_9][\"career_games\"]\n \n\n feature_set.away_batting_spot_1_batting_percentage_last_1_game = player_performances[past_game.away_batting_spot_1][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_1][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_2_batting_percentage_last_1_game = player_performances[past_game.away_batting_spot_2][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_2][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_3_batting_percentage_last_1_game = player_performances[past_game.away_batting_spot_3][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_3][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_4_batting_percentage_last_1_game = player_performances[past_game.away_batting_spot_4][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_4][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_5_batting_percentage_last_1_game = player_performances[past_game.away_batting_spot_5][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_5][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_6_batting_percentage_last_1_game = player_performances[past_game.away_batting_spot_6][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_6][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_7_batting_percentage_last_1_game = player_performances[past_game.away_batting_spot_7][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_7][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_8_batting_percentage_last_1_game = player_performances[past_game.away_batting_spot_8][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_8][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_9_batting_percentage_last_1_game = player_performances[past_game.away_batting_spot_9][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"hits_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_9][\"at_bats_last_1_game\"].reduce(:+)\n\n feature_set.away_batting_spot_1_batting_percentage_last_2_games = player_performances[past_game.away_batting_spot_1][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_1][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_2_batting_percentage_last_2_games = player_performances[past_game.away_batting_spot_2][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_2][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_3_batting_percentage_last_2_games = player_performances[past_game.away_batting_spot_3][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_3][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_4_batting_percentage_last_2_games = player_performances[past_game.away_batting_spot_4][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_4][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_5_batting_percentage_last_2_games = player_performances[past_game.away_batting_spot_5][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_5][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_6_batting_percentage_last_2_games = player_performances[past_game.away_batting_spot_6][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_6][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_7_batting_percentage_last_2_games = player_performances[past_game.away_batting_spot_7][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_7][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_8_batting_percentage_last_2_games = player_performances[past_game.away_batting_spot_8][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_8][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_9_batting_percentage_last_2_games = player_performances[past_game.away_batting_spot_9][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"hits_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_9][\"at_bats_last_2_games\"].reduce(:+)\n\n feature_set.away_batting_spot_1_batting_percentage_last_5_games = player_performances[past_game.away_batting_spot_1][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_1][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_2_batting_percentage_last_5_games = player_performances[past_game.away_batting_spot_2][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_2][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_3_batting_percentage_last_5_games = player_performances[past_game.away_batting_spot_3][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_3][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_4_batting_percentage_last_5_games = player_performances[past_game.away_batting_spot_4][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_4][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_5_batting_percentage_last_5_games = player_performances[past_game.away_batting_spot_5][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_5][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_6_batting_percentage_last_5_games = player_performances[past_game.away_batting_spot_6][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_6][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_7_batting_percentage_last_5_games = player_performances[past_game.away_batting_spot_7][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_7][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_8_batting_percentage_last_5_games = player_performances[past_game.away_batting_spot_8][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_8][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_9_batting_percentage_last_5_games = player_performances[past_game.away_batting_spot_9][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"hits_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_9][\"at_bats_last_5_games\"].reduce(:+)\n\n feature_set.away_batting_spot_1_batting_percentage_last_10_games = player_performances[past_game.away_batting_spot_1][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_1][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_2_batting_percentage_last_10_games = player_performances[past_game.away_batting_spot_2][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_2][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_3_batting_percentage_last_10_games = player_performances[past_game.away_batting_spot_3][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_3][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_4_batting_percentage_last_10_games = player_performances[past_game.away_batting_spot_4][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_4][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_5_batting_percentage_last_10_games = player_performances[past_game.away_batting_spot_5][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_5][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_6_batting_percentage_last_10_games = player_performances[past_game.away_batting_spot_6][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_6][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_7_batting_percentage_last_10_games = player_performances[past_game.away_batting_spot_7][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_7][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_8_batting_percentage_last_10_games = player_performances[past_game.away_batting_spot_8][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_8][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_9_batting_percentage_last_10_games = player_performances[past_game.away_batting_spot_9][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"hits_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_9][\"at_bats_last_10_games\"].reduce(:+)\n\n feature_set.away_batting_spot_1_batting_percentage_last_20_games = player_performances[past_game.away_batting_spot_1][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_1][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_2_batting_percentage_last_20_games = player_performances[past_game.away_batting_spot_2][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_2][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_3_batting_percentage_last_20_games = player_performances[past_game.away_batting_spot_3][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_3][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_4_batting_percentage_last_20_games = player_performances[past_game.away_batting_spot_4][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_4][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_5_batting_percentage_last_20_games = player_performances[past_game.away_batting_spot_5][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_5][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_6_batting_percentage_last_20_games = player_performances[past_game.away_batting_spot_6][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_6][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_7_batting_percentage_last_20_games = player_performances[past_game.away_batting_spot_7][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_7][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_8_batting_percentage_last_20_games = player_performances[past_game.away_batting_spot_8][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_8][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_9_batting_percentage_last_20_games = player_performances[past_game.away_batting_spot_9][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"hits_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_9][\"at_bats_last_20_games\"].reduce(:+)\n \n feature_set.away_batting_spot_1_batting_percentage_career = player_performances[past_game.away_batting_spot_1][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"career_hits\"] / player_performances[past_game.away_batting_spot_1][\"career_at_bats\"]\n feature_set.away_batting_spot_2_batting_percentage_career = player_performances[past_game.away_batting_spot_2][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"career_hits\"] / player_performances[past_game.away_batting_spot_2][\"career_at_bats\"]\n feature_set.away_batting_spot_3_batting_percentage_career = player_performances[past_game.away_batting_spot_3][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"career_hits\"] / player_performances[past_game.away_batting_spot_3][\"career_at_bats\"]\n feature_set.away_batting_spot_4_batting_percentage_career = player_performances[past_game.away_batting_spot_4][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"career_hits\"] / player_performances[past_game.away_batting_spot_4][\"career_at_bats\"]\n feature_set.away_batting_spot_5_batting_percentage_career = player_performances[past_game.away_batting_spot_5][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"career_hits\"] / player_performances[past_game.away_batting_spot_5][\"career_at_bats\"]\n feature_set.away_batting_spot_6_batting_percentage_career = player_performances[past_game.away_batting_spot_6][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"career_hits\"] / player_performances[past_game.away_batting_spot_6][\"career_at_bats\"]\n feature_set.away_batting_spot_7_batting_percentage_career = player_performances[past_game.away_batting_spot_7][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"career_hits\"] / player_performances[past_game.away_batting_spot_7][\"career_at_bats\"]\n feature_set.away_batting_spot_8_batting_percentage_career = player_performances[past_game.away_batting_spot_8][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"career_hits\"] / player_performances[past_game.away_batting_spot_8][\"career_at_bats\"]\n feature_set.away_batting_spot_9_batting_percentage_career = player_performances[past_game.away_batting_spot_9][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"career_hits\"] / player_performances[past_game.away_batting_spot_9][\"career_at_bats\"]\n\n feature_set.away_batting_spot_1_OPS_last_1_game = player_performances[past_game.away_batting_spot_1][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_1][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_2_OPS_last_1_game = player_performances[past_game.away_batting_spot_2][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_2][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_3_OPS_last_1_game = player_performances[past_game.away_batting_spot_3][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_3][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_4_OPS_last_1_game = player_performances[past_game.away_batting_spot_4][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_4][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_5_OPS_last_1_game = player_performances[past_game.away_batting_spot_5][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_5][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_6_OPS_last_1_game = player_performances[past_game.away_batting_spot_6][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_6][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_7_OPS_last_1_game = player_performances[past_game.away_batting_spot_7][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_7][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_8_OPS_last_1_game = player_performances[past_game.away_batting_spot_8][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_8][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_9_OPS_last_1_game = player_performances[past_game.away_batting_spot_9][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"total_bases_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_9][\"at_bats_last_1_game\"].reduce(:+)\n\n feature_set.away_batting_spot_1_OPS_last_2_games = player_performances[past_game.away_batting_spot_1][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_1][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_2_OPS_last_2_games = player_performances[past_game.away_batting_spot_2][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_2][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_3_OPS_last_2_games = player_performances[past_game.away_batting_spot_3][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_3][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_4_OPS_last_2_games = player_performances[past_game.away_batting_spot_4][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_4][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_5_OPS_last_2_games = player_performances[past_game.away_batting_spot_5][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_5][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_6_OPS_last_2_games = player_performances[past_game.away_batting_spot_6][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_6][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_7_OPS_last_2_games = player_performances[past_game.away_batting_spot_7][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_7][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_8_OPS_last_2_games = player_performances[past_game.away_batting_spot_8][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_8][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_9_OPS_last_2_games = player_performances[past_game.away_batting_spot_9][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"total_bases_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_9][\"at_bats_last_2_games\"].reduce(:+)\n\n feature_set.away_batting_spot_1_OPS_last_5_games = player_performances[past_game.away_batting_spot_1][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_1][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_2_OPS_last_5_games = player_performances[past_game.away_batting_spot_2][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_2][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_3_OPS_last_5_games = player_performances[past_game.away_batting_spot_3][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_3][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_4_OPS_last_5_games = player_performances[past_game.away_batting_spot_4][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_4][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_5_OPS_last_5_games = player_performances[past_game.away_batting_spot_5][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_5][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_6_OPS_last_5_games = player_performances[past_game.away_batting_spot_6][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_6][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_7_OPS_last_5_games = player_performances[past_game.away_batting_spot_7][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_7][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_8_OPS_last_5_games = player_performances[past_game.away_batting_spot_8][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_8][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_9_OPS_last_5_games = player_performances[past_game.away_batting_spot_9][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"total_bases_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_9][\"at_bats_last_5_games\"].reduce(:+)\n\n feature_set.away_batting_spot_1_OPS_last_10_games = player_performances[past_game.away_batting_spot_1][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_1][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_2_OPS_last_10_games = player_performances[past_game.away_batting_spot_2][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_2][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_3_OPS_last_10_games = player_performances[past_game.away_batting_spot_3][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_3][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_4_OPS_last_10_games = player_performances[past_game.away_batting_spot_4][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_4][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_5_OPS_last_10_games = player_performances[past_game.away_batting_spot_5][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_5][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_6_OPS_last_10_games = player_performances[past_game.away_batting_spot_6][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_6][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_7_OPS_last_10_games = player_performances[past_game.away_batting_spot_7][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_7][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_8_OPS_last_10_games = player_performances[past_game.away_batting_spot_8][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_8][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_9_OPS_last_10_games = player_performances[past_game.away_batting_spot_9][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"total_bases_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_9][\"at_bats_last_10_games\"].reduce(:+)\n\n feature_set.away_batting_spot_1_OPS_last_20_games = player_performances[past_game.away_batting_spot_1][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_1][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_2_OPS_last_20_games = player_performances[past_game.away_batting_spot_2][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_2][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_3_OPS_last_20_games = player_performances[past_game.away_batting_spot_3][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_3][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_4_OPS_last_20_games = player_performances[past_game.away_batting_spot_4][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_4][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_5_OPS_last_20_games = player_performances[past_game.away_batting_spot_5][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_5][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_6_OPS_last_20_games = player_performances[past_game.away_batting_spot_6][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_6][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_7_OPS_last_20_games = player_performances[past_game.away_batting_spot_7][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_7][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_8_OPS_last_20_games = player_performances[past_game.away_batting_spot_8][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_8][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_9_OPS_last_20_games = player_performances[past_game.away_batting_spot_9][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"total_bases_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_9][\"at_bats_last_20_games\"].reduce(:+)\n\n \n feature_set.away_batting_spot_1_OPS_career = player_performances[past_game.away_batting_spot_1][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"career_total_bases\"] / player_performances[past_game.away_batting_spot_1][\"career_at_bats\"]\n feature_set.away_batting_spot_2_OPS_career = player_performances[past_game.away_batting_spot_2][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"career_total_bases\"] / player_performances[past_game.away_batting_spot_2][\"career_at_bats\"]\n feature_set.away_batting_spot_3_OPS_career = player_performances[past_game.away_batting_spot_3][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"career_total_bases\"] / player_performances[past_game.away_batting_spot_3][\"career_at_bats\"]\n feature_set.away_batting_spot_4_OPS_career = player_performances[past_game.away_batting_spot_4][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"career_total_bases\"] / player_performances[past_game.away_batting_spot_4][\"career_at_bats\"]\n feature_set.away_batting_spot_5_OPS_career = player_performances[past_game.away_batting_spot_5][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"career_total_bases\"] / player_performances[past_game.away_batting_spot_5][\"career_at_bats\"]\n feature_set.away_batting_spot_6_OPS_career = player_performances[past_game.away_batting_spot_6][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"career_total_bases\"] / player_performances[past_game.away_batting_spot_6][\"career_at_bats\"]\n feature_set.away_batting_spot_7_OPS_career = player_performances[past_game.away_batting_spot_7][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"career_total_bases\"] / player_performances[past_game.away_batting_spot_7][\"career_at_bats\"]\n feature_set.away_batting_spot_8_OPS_career = player_performances[past_game.away_batting_spot_8][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"career_total_bases\"] / player_performances[past_game.away_batting_spot_8][\"career_at_bats\"]\n feature_set.away_batting_spot_9_OPS_career = player_performances[past_game.away_batting_spot_9][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"career_total_bases\"] / player_performances[past_game.away_batting_spot_9][\"career_at_bats\"]\n\n feature_set.away_batting_spot_1_strikeout_rate_last_1_game = player_performances[past_game.away_batting_spot_1][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_1][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_2_strikeout_rate_last_1_game = player_performances[past_game.away_batting_spot_2][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_2][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_3_strikeout_rate_last_1_game = player_performances[past_game.away_batting_spot_3][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_3][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_4_strikeout_rate_last_1_game = player_performances[past_game.away_batting_spot_4][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_4][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_5_strikeout_rate_last_1_game = player_performances[past_game.away_batting_spot_5][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_5][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_6_strikeout_rate_last_1_game = player_performances[past_game.away_batting_spot_6][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_6][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_7_strikeout_rate_last_1_game = player_performances[past_game.away_batting_spot_7][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_7][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_8_strikeout_rate_last_1_game = player_performances[past_game.away_batting_spot_8][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_8][\"at_bats_last_1_game\"].reduce(:+)\n feature_set.away_batting_spot_9_strikeout_rate_last_1_game = player_performances[past_game.away_batting_spot_9][\"at_bats_last_1_game\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"strikeouts_last_1_game\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_9][\"at_bats_last_1_game\"].reduce(:+)\n\n feature_set.away_batting_spot_1_strikeout_rate_last_2_games = player_performances[past_game.away_batting_spot_1][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_1][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_2_strikeout_rate_last_2_games = player_performances[past_game.away_batting_spot_2][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_2][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_3_strikeout_rate_last_2_games = player_performances[past_game.away_batting_spot_3][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_3][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_4_strikeout_rate_last_2_games = player_performances[past_game.away_batting_spot_4][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_4][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_5_strikeout_rate_last_2_games = player_performances[past_game.away_batting_spot_5][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_5][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_6_strikeout_rate_last_2_games = player_performances[past_game.away_batting_spot_6][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_6][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_7_strikeout_rate_last_2_games = player_performances[past_game.away_batting_spot_7][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_7][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_8_strikeout_rate_last_2_games = player_performances[past_game.away_batting_spot_8][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_8][\"at_bats_last_2_games\"].reduce(:+)\n feature_set.away_batting_spot_9_strikeout_rate_last_2_games = player_performances[past_game.away_batting_spot_9][\"at_bats_last_2_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"strikeouts_last_2_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_9][\"at_bats_last_2_games\"].reduce(:+)\n\n feature_set.away_batting_spot_1_strikeout_rate_last_5_games = player_performances[past_game.away_batting_spot_1][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_1][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_2_strikeout_rate_last_5_games = player_performances[past_game.away_batting_spot_2][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_2][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_3_strikeout_rate_last_5_games = player_performances[past_game.away_batting_spot_3][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_3][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_4_strikeout_rate_last_5_games = player_performances[past_game.away_batting_spot_4][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_4][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_5_strikeout_rate_last_5_games = player_performances[past_game.away_batting_spot_5][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_5][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_6_strikeout_rate_last_5_games = player_performances[past_game.away_batting_spot_6][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_6][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_7_strikeout_rate_last_5_games = player_performances[past_game.away_batting_spot_7][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_7][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_8_strikeout_rate_last_5_games = player_performances[past_game.away_batting_spot_8][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_8][\"at_bats_last_5_games\"].reduce(:+)\n feature_set.away_batting_spot_9_strikeout_rate_last_5_games = player_performances[past_game.away_batting_spot_9][\"at_bats_last_5_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"strikeouts_last_5_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_9][\"at_bats_last_5_games\"].reduce(:+)\n\n feature_set.away_batting_spot_1_strikeout_rate_last_10_games = player_performances[past_game.away_batting_spot_1][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_1][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_2_strikeout_rate_last_10_games = player_performances[past_game.away_batting_spot_2][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_2][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_3_strikeout_rate_last_10_games = player_performances[past_game.away_batting_spot_3][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_3][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_4_strikeout_rate_last_10_games = player_performances[past_game.away_batting_spot_4][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_4][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_5_strikeout_rate_last_10_games = player_performances[past_game.away_batting_spot_5][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_5][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_6_strikeout_rate_last_10_games = player_performances[past_game.away_batting_spot_6][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_6][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_7_strikeout_rate_last_10_games = player_performances[past_game.away_batting_spot_7][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_7][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_8_strikeout_rate_last_10_games = player_performances[past_game.away_batting_spot_8][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_8][\"at_bats_last_10_games\"].reduce(:+)\n feature_set.away_batting_spot_9_strikeout_rate_last_10_games = player_performances[past_game.away_batting_spot_9][\"at_bats_last_10_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"strikeouts_last_10_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_9][\"at_bats_last_10_games\"].reduce(:+)\n\n feature_set.away_batting_spot_1_strikeout_rate_last_20_games = player_performances[past_game.away_batting_spot_1][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_1][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_2_strikeout_rate_last_20_games = player_performances[past_game.away_batting_spot_2][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_2][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_3_strikeout_rate_last_20_games = player_performances[past_game.away_batting_spot_3][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_3][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_4_strikeout_rate_last_20_games = player_performances[past_game.away_batting_spot_4][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_4][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_5_strikeout_rate_last_20_games = player_performances[past_game.away_batting_spot_5][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_5][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_6_strikeout_rate_last_20_games = player_performances[past_game.away_batting_spot_6][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_6][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_7_strikeout_rate_last_20_games = player_performances[past_game.away_batting_spot_7][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_7][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_8_strikeout_rate_last_20_games = player_performances[past_game.away_batting_spot_8][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_8][\"at_bats_last_20_games\"].reduce(:+)\n feature_set.away_batting_spot_9_strikeout_rate_last_20_games = player_performances[past_game.away_batting_spot_9][\"at_bats_last_20_games\"].reduce(:+) == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"strikeouts_last_20_games\"].reduce(:+).to_f / player_performances[past_game.away_batting_spot_9][\"at_bats_last_20_games\"].reduce(:+)\n \n feature_set.away_batting_spot_1_strikeout_rate_career = player_performances[past_game.away_batting_spot_1][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_1][\"career_strikeouts\"] / player_performances[past_game.away_batting_spot_1][\"career_at_bats\"]\n feature_set.away_batting_spot_2_strikeout_rate_career = player_performances[past_game.away_batting_spot_2][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_2][\"career_strikeouts\"] / player_performances[past_game.away_batting_spot_2][\"career_at_bats\"]\n feature_set.away_batting_spot_3_strikeout_rate_career = player_performances[past_game.away_batting_spot_3][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_3][\"career_strikeouts\"] / player_performances[past_game.away_batting_spot_3][\"career_at_bats\"]\n feature_set.away_batting_spot_4_strikeout_rate_career = player_performances[past_game.away_batting_spot_4][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_4][\"career_strikeouts\"] / player_performances[past_game.away_batting_spot_4][\"career_at_bats\"]\n feature_set.away_batting_spot_5_strikeout_rate_career = player_performances[past_game.away_batting_spot_5][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_5][\"career_strikeouts\"] / player_performances[past_game.away_batting_spot_5][\"career_at_bats\"]\n feature_set.away_batting_spot_6_strikeout_rate_career = player_performances[past_game.away_batting_spot_6][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_6][\"career_strikeouts\"] / player_performances[past_game.away_batting_spot_6][\"career_at_bats\"]\n feature_set.away_batting_spot_7_strikeout_rate_career = player_performances[past_game.away_batting_spot_7][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_7][\"career_strikeouts\"] / player_performances[past_game.away_batting_spot_7][\"career_at_bats\"]\n feature_set.away_batting_spot_8_strikeout_rate_career = player_performances[past_game.away_batting_spot_8][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_8][\"career_strikeouts\"] / player_performances[past_game.away_batting_spot_8][\"career_at_bats\"]\n feature_set.away_batting_spot_9_strikeout_rate_career = player_performances[past_game.away_batting_spot_9][\"career_at_bats\"] == 0 ? 0 : player_performances[past_game.away_batting_spot_9][\"career_strikeouts\"] / player_performances[past_game.away_batting_spot_9][\"career_at_bats\"]\n end\n\n feature_set.save\n\n performances.each do |perf|\n player = Player.find_by_id(perf.player_id)\n # career updates\n player_performances[player.retrosheet_id][\"career_games\"] += 1\n player_performances[player.retrosheet_id][\"career_at_bats\"] += perf.at_bats\n player_performances[player.retrosheet_id][\"career_walks\"] += perf.walks\n player_performances[player.retrosheet_id][\"career_hits\"] += perf.hits\n player_performances[player.retrosheet_id][\"career_strikeouts\"] += perf.strikeouts \n player_performances[player.retrosheet_id][\"career_total_bases\"] += perf.total_bases \n \n player_performances[player.retrosheet_id][\"at_bats_last_1_game\"] << perf.at_bats\n player_performances[player.retrosheet_id][\"at_bats_last_2_games\"] << perf.at_bats\n player_performances[player.retrosheet_id][\"at_bats_last_5_games\"] << perf.at_bats\n player_performances[player.retrosheet_id][\"at_bats_last_10_games\"] << perf.at_bats\n player_performances[player.retrosheet_id][\"at_bats_last_20_games\"] << perf.at_bats\n \n player_performances[player.retrosheet_id][\"at_bats_last_1_game\"].shift\n player_performances[player.retrosheet_id][\"at_bats_last_2_games\"].shift\n player_performances[player.retrosheet_id][\"at_bats_last_5_games\"].shift\n player_performances[player.retrosheet_id][\"at_bats_last_10_games\"].shift\n player_performances[player.retrosheet_id][\"at_bats_last_20_games\"].shift\n\n player_performances[player.retrosheet_id][\"walks_last_1_game\"] << perf.walks\n player_performances[player.retrosheet_id][\"walks_last_2_games\"] << perf.walks\n player_performances[player.retrosheet_id][\"walks_last_5_games\"] << perf.walks\n player_performances[player.retrosheet_id][\"walks_last_10_games\"] << perf.walks\n player_performances[player.retrosheet_id][\"walks_last_20_games\"] << perf.walks\n \n player_performances[player.retrosheet_id][\"walks_last_1_game\"].shift\n player_performances[player.retrosheet_id][\"walks_last_2_games\"].shift\n player_performances[player.retrosheet_id][\"walks_last_5_games\"].shift\n player_performances[player.retrosheet_id][\"walks_last_10_games\"].shift\n player_performances[player.retrosheet_id][\"walks_last_20_games\"].shift\n\n player_performances[player.retrosheet_id][\"hits_last_1_game\"] << perf.hits\n player_performances[player.retrosheet_id][\"hits_last_2_games\"] << perf.hits\n player_performances[player.retrosheet_id][\"hits_last_5_games\"] << perf.hits\n player_performances[player.retrosheet_id][\"hits_last_10_games\"] << perf.hits\n player_performances[player.retrosheet_id][\"hits_last_20_games\"] << perf.hits\n \n player_performances[player.retrosheet_id][\"hits_last_1_game\"].shift\n player_performances[player.retrosheet_id][\"hits_last_2_games\"].shift\n player_performances[player.retrosheet_id][\"hits_last_5_games\"].shift\n player_performances[player.retrosheet_id][\"hits_last_10_games\"].shift\n player_performances[player.retrosheet_id][\"hits_last_20_games\"].shift\n\n player_performances[player.retrosheet_id][\"strikeouts_last_1_game\"] << perf.strikeouts\n player_performances[player.retrosheet_id][\"strikeouts_last_2_games\"] << perf.strikeouts\n player_performances[player.retrosheet_id][\"strikeouts_last_5_games\"] << perf.strikeouts\n player_performances[player.retrosheet_id][\"strikeouts_last_10_games\"] << perf.strikeouts\n player_performances[player.retrosheet_id][\"strikeouts_last_20_games\"] << perf.strikeouts\n \n player_performances[player.retrosheet_id][\"strikeouts_last_1_game\"].shift\n player_performances[player.retrosheet_id][\"strikeouts_last_2_games\"].shift\n player_performances[player.retrosheet_id][\"strikeouts_last_5_games\"].shift\n player_performances[player.retrosheet_id][\"strikeouts_last_10_games\"].shift\n player_performances[player.retrosheet_id][\"strikeouts_last_20_games\"].shift\n\n player_performances[player.retrosheet_id][\"total_bases_last_1_game\"] << perf.total_bases\n player_performances[player.retrosheet_id][\"total_bases_last_2_games\"] << perf.total_bases\n player_performances[player.retrosheet_id][\"total_bases_last_5_games\"] << perf.total_bases\n player_performances[player.retrosheet_id][\"total_bases_last_10_games\"] << perf.total_bases\n player_performances[player.retrosheet_id][\"total_bases_last_20_games\"] << perf.total_bases\n \n player_performances[player.retrosheet_id][\"total_bases_last_1_game\"].shift\n player_performances[player.retrosheet_id][\"total_bases_last_2_games\"].shift\n player_performances[player.retrosheet_id][\"total_bases_last_5_games\"].shift\n player_performances[player.retrosheet_id][\"total_bases_last_10_games\"].shift\n player_performances[player.retrosheet_id][\"total_bases_last_20_games\"].shift\n end\n end\nend", "title": "" }, { "docid": "180a7fe07c82e593915a95f5024c329c", "score": "0.4849322", "text": "def test_part2\n output = PART2_SLOPES.map { |args| trees_encountered(TEST_INPUT, **args) }\n assert_equal [2, 7, 3, 4, 2], output\n assert_equal 336, output.reduce(:*)\n end", "title": "" }, { "docid": "2f79b3d24f007ea05a978facbd0d1988", "score": "0.484802", "text": "def split_teams\n @split_teams ||= shuffled_teams.each_slice(team_count/2).to_a\n end", "title": "" }, { "docid": "9ee1820f3dae66d56b3f1aeb347bc96c", "score": "0.483096", "text": "def split\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 38 )\n\n\n return_value = SplitReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __K_SPLIT197__ = nil\n __LPAR198__ = nil\n __RPAR200__ = nil\n __Identificador201__ = nil\n __EOL203__ = nil\n string199 = nil\n var_local202 = nil\n\n\n tree_for_K_SPLIT197 = nil\n tree_for_LPAR198 = nil\n tree_for_RPAR200 = nil\n tree_for_Identificador201 = nil\n tree_for_EOL203 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 184:4: K_SPLIT LPAR string RPAR ( Identificador | var_local ) EOL\n __K_SPLIT197__ = match( K_SPLIT, TOKENS_FOLLOWING_K_SPLIT_IN_split_872 )\n if @state.backtracking == 0\n tree_for_K_SPLIT197 = @adaptor.create_with_payload( __K_SPLIT197__ )\n @adaptor.add_child( root_0, tree_for_K_SPLIT197 )\n\n end\n\n __LPAR198__ = match( LPAR, TOKENS_FOLLOWING_LPAR_IN_split_874 )\n if @state.backtracking == 0\n tree_for_LPAR198 = @adaptor.create_with_payload( __LPAR198__ )\n @adaptor.add_child( root_0, tree_for_LPAR198 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_string_IN_split_876 )\n string199 = string\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, string199.tree )\n end\n\n __RPAR200__ = match( RPAR, TOKENS_FOLLOWING_RPAR_IN_split_878 )\n if @state.backtracking == 0\n tree_for_RPAR200 = @adaptor.create_with_payload( __RPAR200__ )\n @adaptor.add_child( root_0, tree_for_RPAR200 )\n\n end\n\n # at line 184:29: ( Identificador | var_local )\n alt_28 = 2\n look_28_0 = @input.peek( 1 )\n\n if ( look_28_0 == Identificador )\n alt_28 = 1\n elsif ( look_28_0 == DOUBLEDOT )\n alt_28 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 28, 0 )\n\n end\n case alt_28\n when 1\n # at line 184:30: Identificador\n __Identificador201__ = match( Identificador, TOKENS_FOLLOWING_Identificador_IN_split_881 )\n if @state.backtracking == 0\n tree_for_Identificador201 = @adaptor.create_with_payload( __Identificador201__ )\n @adaptor.add_child( root_0, tree_for_Identificador201 )\n\n end\n\n\n when 2\n # at line 184:44: var_local\n @state.following.push( TOKENS_FOLLOWING_var_local_IN_split_883 )\n var_local202 = var_local\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, var_local202.tree )\n end\n\n\n end\n __EOL203__ = match( EOL, TOKENS_FOLLOWING_EOL_IN_split_886 )\n if @state.backtracking == 0\n tree_for_EOL203 = @adaptor.create_with_payload( __EOL203__ )\n @adaptor.add_child( root_0, tree_for_EOL203 )\n\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\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\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\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 38 )\n\n\n end\n\n return return_value\n end", "title": "" }, { "docid": "c0a3f97b198971d37acf75d2e0d86725", "score": "0.48278373", "text": "def divide\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 32 )\n divide_start_index = @input.index\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 \n end\n # at line 311:9: ( 'D' | 'd' ) ( 'I' | 'i' ) ( 'V' | 'v' ) ( 'I' | 'i' ) ( 'D' | 'd' ) ( 'E' | 'e' )\n if @input.peek( 1 ).between?( T__42, T__43 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__24, T__25 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__44, T__45 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__24, T__25 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__42, T__43 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__28, T__29 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 32 )\n memoize( __method__, divide_start_index, success ) if @state.backtracking > 0\n\n end\n \n return \n end", "title": "" }, { "docid": "00f3f1de0bf70f36ef896f58c4e4170c", "score": "0.48224914", "text": "def separate_bets\n # iterate each matches\n # ap all_matches\n start_time = Time.now\n total_markets = 0\n all_matches.each do |match|\n # interate each market\n logger_trace \"@@@@@@@@@@@@#{match[:name]}@@@@@@@@@@@@@@@\"\n\n match[:markets].each do |market|\n # ap market[:bets]\n logger_trace \"==========#{market[:title]}================\"\n split_bets(market[:bets])\n # match_bets(back, lays)\n end\n end\n end_time = Time.now\n markets = all_matches.map{|t| t[:markets] }.flatten\n bets = markets.flatten.map{ |t| t[:bets] }.flatten\n # puts markets\n puts \"Total matches = #{all_matches.length}, Total Markets = #{markets.length} and Total Bets = #{bets.length} ---------------#{end_time - start_time} secs\"\n end", "title": "" }, { "docid": "e66e246da109f6b4a8185adf96a83bb9", "score": "0.48118943", "text": "def calculate_title(id)\n @user = User.find(id)\n @passed_slots = @user.slot_assesses.where(status: \"Passed\")\n array = []\n next_competency_passed = 0\n hash = {}\n\n # Competency\n Competency.order(\"id\").each do |c|\n max_value = 0\n p c.name\n rank = \"\"\n pre_level = \"0\"\n value_of_level_raking = 0\n\n # Level \n c.levels.order(\"id\").each do |level|\n total_sum = 0\n passed_count = 0\n not_passed_count = 0\n assessed_all_slots = true\n number_of_slot = level.slots.count\n pass_level_point = (number_of_slot*5)/2\n\n # Slot\n level.slots.order(\"id\").each do |slot|\n if slot.slot_assesses.where(user_id: @user.id, status: \"Passed\").length > 0\n score = get_max_score(slot.slot_assesses.where(user_id: @user.id, status: \"Passed\"))\n passed_count += 1\n total_sum += score.to_i\n\n elsif slot.slot_assesses.where(user_id: @user.id, status: \"Not Passed\").length > 0\n score = get_max_score(slot.slot_assesses.where(user_id: @user.id, status: \"Not Passed\"))\n not_passed_count += 1\n total_sum += score.to_i\n else\n assessed_all_slots = false\n end\n end\n # End Slot\n\n if passed_count == number_of_slot\n rank = level.name.gsub(\"Level \", \"\")\n elsif passed_count > 0 && passed_count < number_of_slot && total_sum >= pass_level_point && assessed_all_slots\n rank = \"++\" + level.name .gsub(\"Level \", \"\") \n elsif passed_count > 0 && passed_count < number_of_slot\n rank = pre_level.gsub(\"Level \", \"\") + \"-\" + level.name.gsub(\"Level \", \"\") \n end\n\n pre_level = level.name.gsub(\"Level \", \"\")\n \n rank = \"0\" if rank == \"\"\n value_of_level_raking = calculate_level_raking(rank) if rank != \"\"\n \n # p rank\n # p value_of_level_raking\n # p \"================\"\n if rank != \"0\"\n if c.titles_competencies.where(\"value < ?\", value_of_level_raking).length > 0\n max_value = c.titles_competencies.where(\"value < ?\", value_of_level_raking)[0].title.value\n end\n\n if c.titles_competencies.where(\"value > ?\", value_of_level_raking).length > 0\n max_value = c.titles_competencies.where(\"value > ?\", value_of_level_raking)[0].title.value\n end \n\n if c.titles_competencies.where(\"value = ?\", value_of_level_raking).length > 0\n max_value = c.titles_competencies.where(\"value = ?\", value_of_level_raking)[0].title.value\n end\n else\n max_value = 0\n end\n \n end\n # End Level\n\n hash[c.name] = rank\n array.push(max_value)\n end\n\n # p hash\n # p array\n\n\n # hash, array = calculate_ranking_of_competency(id)\n # End Competency\n\n min = array.min\n\n # p min, \"=========================\"\n\n flag_da = false\n\n while min > 0 && min <= 6\n if min <= 3\n title = Title.where(value: min).first\n else\n title = Title.where(value: min, career_path: @user.career_path).first\n end\n\n # p title\n\n # If user's competency is not passed to get any title, code will stop\n if title\n pass_all_other_subjects = true\n other_subject_assesses = @user.other_subject_assesses\n\n # Get list scoring belongs to title's id\n TitleGroupsOtherSubject.where(title_id: title.id).each do |to|\n other_subject_assess = other_subject_assesses.find_by_other_subject_id(to.other_subject_id)\n unless other_subject_assess.score.eql?(nil) \n # If all Other Subject Assessed by user have score >= scoring in of each Other Subject in Title -> pass\n if other_subject_assess.score >= to.scoring && other_subject_assess.status.eql?(\"Passed\")\n flag_da = false\n else\n pass_all_other_subjects = false\n flag_da = true\n min -= 1\n break\n\n end\n else\n pass_all_other_subjects = false\n end\n end\n\n\n if flag_da\n next\n end\n\n # p pass_all_other_subjects\n\n if pass_all_other_subjects\n check_new_user = false\n pass_competency_count = 0\n # p \"Array: #{array}\"\n for i in 0...array.length\n # p \"#{array[i]} -------- #{min}\"\n array[i] = array[i] - min\n if array[i] > 0\n pass_competency_count += 1\n check_new_user = true\n else\n check_new_user = true\n end\n\n end \n\n # Check rank for each Title\n if check_new_user\n rank_id = title.ranks.first.id\n if pass_competency_count > 0\n title.ranks.each do |r|\n if pass_competency_count >= r.number_competencies_next_level\n rank_id = r.id\n end\n end\n else\n rank_id = title.ranks.first.id\n end\n\n # p rank_id\n\n @current_title = @user.current_title\n @current_title.update_attributes(rank_id: rank_id)\n break\n else\n break\n end\n \n else\n break\n end\n\n end\n end\n return hash\n end", "title": "" }, { "docid": "316061be0e1dd74891cf011b0bdcabbb", "score": "0.48009205", "text": "def improve_teams\n @teams = steepest_ascent_hill(@teams)\n end", "title": "" }, { "docid": "383a251dfab6361c24194f2312ebcd47", "score": "0.47991687", "text": "def power_play_goal_percentage(seasonasstring) # power_play info in game team stat\n #find list of all games in season given by arg\n #sum all power play goals\n #sum all power play oppertunities\n #divide line 146 and line 147\n #return total of above\n end", "title": "" }, { "docid": "0bbf40f56a019367a2a1b58b70617ff2", "score": "0.47912484", "text": "def supermaster\n @tab_title = I18n.t('team_management.fin_supermaster')\n\n # Find out steam affiliation. Fix-ME\n team_affiliation = @team.team_affiliations.includes(:season).where(\"season_id = 182\").first\n tsc = TeamSupermasterCalculator.new(team_affiliation)\n tot_swimmers = tsc.parse_swimmer_results()\n @team_supermaster_scores = tsc.team_supermaster_dao.sort{|p,n| (n.get_results_count*10000 + n.get_total_score) <=> (p.get_results_count*10000 + p.get_total_score) }\n @full_events_swimmers = tsc.full_events_swimmers\n @ranking_min = 0\n @ranking_max = 9999\n @ranking_context = 9999\n @ranking_range = \"A\"\n\n # Determines the ranking context based on full_events_swimmer count\n # TODO - Store range on DB\n case @full_events_swimmers\n # Range F 25\n when 1..30\n @ranking_min = 1\n @ranking_max = 30\n @ranking_context = 25\n @ranking_range = \"F\"\n # Range E 50\n when 31..55\n @ranking_min = 31\n @ranking_max = 55\n @ranking_context = 50\n @ranking_range = \"E\"\n # Range D 75\n when 56..85\n @ranking_min = 56\n @ranking_max = 85\n @ranking_context = 75\n @ranking_range = \"D\"\n # Range C 100\n when 86..110\n @ranking_min = 86\n @ranking_max = 110\n @ranking_context = 100\n @ranking_range = \"C\"\n # Range B 125\n when 111..140\n @ranking_min = 111\n @ranking_max = 140\n @ranking_context = 125\n @ranking_range = \"B\"\n # Range A more than 125\n else\n @ranking_min = 140\n @ranking_max = 9999\n @ranking_context = 9999\n @ranking_range = \"A\"\n end\n\n end", "title": "" }, { "docid": "fa2b0577d33ed662611873189ddbec1e", "score": "0.478156", "text": "def most_accurate_team(seasonasstring) # shots in game team stats\n #get a list of all teams that played in that season - given by arg\n #use above list to sum all shots across all games in season\n #divide above by goals made across all games in season\n #find highest percentage\n #return team name as found in 127\n end", "title": "" }, { "docid": "3ea50034504c61bd0591b49c3836b87f", "score": "0.47777086", "text": "def show_diff\n dir = \"/home/deploy/ci_logs_full/\"\n\n result = TestResult.where(:id => params[:id1]).first\n tool_name = Tool.where(:id => result.tool_id).first.name\n target_dir = \"#{dir}#{tool_name}-#{result.date}-#{result.benchmark}/\"\n target = \"#{target_dir}#{result.benchmark}.#{result.date}.#{tool_name}.log\"\n\n target1 = File.read(target).split(\"\\n\")\n @tname_1 = \"#{tool_name}.#{result.benchmark}.#{result.date}\"\n\n result = TestResult.where(:id => params[:id2]).first\n tool_name = Tool.where(:id => result.tool_id).first.name\n target_dir = \"#{dir}#{tool_name}-#{result.date}-#{result.benchmark}/\"\n target = \"#{target_dir}#{result.benchmark}.#{result.date}.#{tool_name}.log\"\n\n target2 = File.read(target).split(\"\\n\")\n @tname_2 = \"#{tool_name}.#{result.benchmark}.#{result.date}\"\n\n\n if target1.length != target2.length\n @error = true\n else\n @error = false\n end\n\n @list = []\n @rlist1 = []\n @rlist2 = []\n\n level = params[:level].to_i\n target1.each_with_index do |value, index|\n if index <= 3\n next\n end\n result1_s = target1[index].split(\", \")\n result2_s = target2[index].split(\", \")\n\n if result1_s[2] != result2_s[2]\n if level == 0\n if result1_s[2].include? \"sat\" and result2_s[2].include? \"sat\" \n @list.append(result1_s[0])\n @rlist1.append(result1_s[2])\n @rlist2.append(result2_s[2])\n end\n elsif level == 1\n if result1_s[2].include? \"timeout\" or result2_s[2].include? \"timeout\" \n @list.append(result1_s[0])\n @rlist1.append(result1_s[2])\n @rlist2.append(result2_s[2])\n end\n else\n @list.append(result1_s[0])\n @rlist1.append(result1_s[2])\n @rlist2.append(result2_s[2])\n end\n end\n end\n\n @display_types = DisplayType.all\n end", "title": "" }, { "docid": "7b39adc4df1765371cd5986498550e38", "score": "0.47591543", "text": "def run_app\n games = []\n @standings = []\n\n # load file from cli arg and parse teams and games\n # NOTE: for this exercise, if CLI argument is omitted, \n # it will load the sample file by default\n load_file.each do |line|\n game = []\n\n # get game's teams, fetch scores, and ensure team is listed in standings\n teams = line.chomp.split(\", \")\n\n teams.each do |team|\n team_stats = parse_game(team)\n add_team_to_standings(team_stats[:name])\n\n game << team_stats\n end\n\n games << game\n end\n\n # determine if tie game\n games.each do |game|\n if game.first[:score] == game.last[:score]\n its_a_tie(game)\n else\n determine_winner(game)\n end\n end\n\n # return and print winners by placement\n output_placements\nend", "title": "" }, { "docid": "f53e900c44089435a4c9add920455ab4", "score": "0.47533143", "text": "def goodVsEvil(good, evil)\ngarr = good.split(\" \")\nbarr = evil.split(\" \")\ngarr = garr.map {|x| x.to_i}\nbarr = barr.map {|x| x.to_i}\ngscore = [1, 2, 3, 3, 4, 10]\nbscore = [1, 2, 2, 2, 3, 5, 10]\ngfin, bfin = [], []\ngtotal, btotal = 0, 0\nfor i in 0..(garr.length-1)\n gfin.push(garr[i] * gscore[i])\n gtotal += (garr[i] + gscore[i])\nend\nfor i in 0..(barr.length-1)\n bfin.push(barr[i] * bscore[i])\n btotal += (barr[i] + bscore[i])\nend\nif gtotal > btotal\n return \"Battle Result: Good triumphs over Evil\"\nelsif btotal > gtotal\n return \"Battle Result: Evil eradicates all trace of Good\"\nelsif btotal == gtotal\n return \"Battle Result: No victor on this battle field\"\nend\n\nend", "title": "" }, { "docid": "3c2eb51df0755429518fa6faa3dcc653", "score": "0.47484484", "text": "def vexflow\n bars = []\n self.bars.times do |i|\n # assume 3 voices max\n voices = []\n voice1 = []\n voice2 = []\n voice3 = []\n\n # buffer for excess notes\n overflow1 = []\n overflow2 = []\n\n # voice1\n self.notes.where(:bar => i).select('beat, duration').distinct.order('beat ASC').each do |n|\n if !voice1.empty?\n if voice1.last[0].end_beat < n.beat # fill in gap\n # voice1 << [{:duration => n.beat - voice1.last[0].end_beat, :drum => -1}]\n voice1.last.each do |m|\n m.assign_attributes({ :duration => n.beat - m.beat })\n end\n elsif voice1.last[0].end_beat > n.beat # overlap\n overflow_notes << n\n next\n end\n else # leading rest\n if n.beat != 0\n voice1 << [{:duration => n.beat, :drum => -1}]\n end\n end\n voice1 << self.notes.where(:bar => i, :beat => n.beat, :duration => n.duration)\n end\n\n # overflow => voice2\n overflow1.each do |n|\n if !voice2.empty?\n if voice2.last[0].end_beat < n.beat # fill in gap\n # voice2 << [{:duration => n.beat - voice2.last[0].end_beat, :drum => -1}]\n voice2.last.each do |m|\n m.assign_attributes({ :duration => n.beat - m.beat })\n end\n elsif voice2.last[0].end_beat > n.beat # overlap\n overflow2 << n\n next\n end\n else # leading rest\n if n.beat != 0\n voice2 << [{:duration => n.beat, :drum => -1}]\n end\n end\n voice2 << self.notes.where(:bar => i, :beat => n.beat, :duration => n.duration)\n end\n\n # overflow2 => voice3\n overflow2.each do |n|\n if !voice3.empty?\n if voice3.last[0].end_beat < n.beat # fill in gap\n # voice3 << [{:duration => n.beat - voice3.last[0].end_beat, :drum => -1}]\n voice3.last.each do |m|\n m.assign_attributes({ :duration => n.beat - m.beat })\n end\n elsif voice3.last[0].end_beat > n.beat # overlap\n overflow2 << n\n next\n end\n else # leading rest\n if n.beat != 0\n voice3 << [{:duration => n.beat, :drum => -1}]\n end\n end\n voice3 << self.notes.where(:bar => i, :beat => n.beat, :duration => n.duration)\n end\n\n # add trailing rests\n if voice1.any? && voice1.last[0].end_beat != self.meter_bottom\n extraRests = []\n voice1.last.each do |m|\n if self.meter_bottom - m.beat > 1\n m.assign_attributes({ :duration => 1 })\n extraRests[0] = {:duration => self.meter_bottom - m.end_beat, :drum => -1}\n else\n m.assign_attributes({ :duration => self.meter_bottom - m.beat })\n end\n end\n if extraRests.any?\n voice1 << extraRests\n end\n # voice1 << [{:duration => self.meter_bottom - voice1.last[0].end_beat, :drum => -1}]\n end\n if voice2.any? && voice2.last[0].end_beat != self.meter_bottom\n extraRests = []\n voice2.last.each do |m|\n if self.meter_bottom - m.beat > 1\n m.assign_attributes({ :duration => 1 })\n extraRests[0] = {:duration => self.meter_bottom - m.end_beat, :drum => -1}\n else\n m.assign_attributes({ :duration => self.meter_bottom - m.beat })\n end\n end\n if extraRests.any?\n voice2 << extraRests\n end\n # voice2 << [{:duration => self.meter_bottom - voice2.last[0].end_beat, :drum => -1}]\n end\n if voice3.any? && voice3.last[0].end_beat != self.meter_bottom\n extraRests = []\n voice3.last.each do |m|\n if self.meter_bottom - m.beat > 1\n m.assign_attributes({ :duration => 1 })\n extraRests = {:duration => self.meter_bottom - m.end_beat, :drum => -1}\n else\n m.assign_attributes({ :duration => self.meter_bottom - m.beat })\n end\n end\n if extraRests.any?\n voice3 << extraRests\n end\n # voice3 << [{:duration => self.meter_bottom - voice3.last[0].end_beat, :drum => -1}]\n end\n\n # full measure rest\n if voice1.empty?\n voice1 << [{:duration => self.meter_bottom, :drum => -1}]\n end\n\n # add any voices to bar\n voices << voice1\n if voice2.any?\n voices << voice2\n end\n if voice3.any?\n voices << voice3\n end\n bars << voices\n end\n\n return bars\n end", "title": "" }, { "docid": "6633277be7696f887b5f1d79d4652444", "score": "0.47351745", "text": "def return_teams\r\n result = Array.new(@teams) { [] }\r\n allocation = @neighbourhoods_list[0].l_best_position\r\n (0..@length - 1).each do |x|\r\n (0..@teams - 1).each do |y|\r\n result[y].append(@table[x]['id']) if allocation[x][y] == 1\r\n end\r\n end\r\n # If there are any separated students\r\n # Assign them to teams\r\n assign_separated(result) unless @separated.nil?\r\n result\r\n end", "title": "" }, { "docid": "2d6b3e9b4c756081cc84e2fa95c6927c", "score": "0.47324318", "text": "def index\n @players = Player.order(elo: :desc).to_a\n @group1 = @players.first(3)\n @group2 = @players.first(6) - @group1\n @group3 = @players - @group1 - @group2\n @all_elo = Event.all.inject([]){|s,e| s|=eval(e.elos).values}\n @min = @all_elo.min - 20\n @max = @all_elo.max + 20\n end", "title": "" }, { "docid": "c5a2e95f2c03d1e98156fbae95ec449a", "score": "0.47178146", "text": "def transform_results(options={})\n\n season = options[:season] ? options[:season] : '1314'\n league_id_str = league_id = options[:league]\n\n puts \"Fetching 'Results by League' info for league #{league_id_str} from production data store ...\"\n match_xml = Nokogiri::XML(aws_data_fetch({\n name: \"HistoricMatches-league-#{league_id_str}-#{season}.xml\",\n path: 'soccer/raw-data',\n }))\n\n data_file_recs = Array.new\n \n # live_score_xml = Nokogiri::XML(File.open(\"XML/LiveScore-league3-latest.xml\"))\n # live_score_match_ids = live_score_xml.xpath(\"//Match/Id\").map{ |node| node.text }\n # # puts \"live_score_match_ids #{live_score_match_ids}\"\n live_score_match_ids = Array.new\n\n match_xml.xpath(\"//Match\").each do |node|\n\n next if node.xpath(\"Id\").text == \"62364\"\n\n\n # puts \"========= MATCH ID : '#{node.xpath(\"FixtureMatch_Id\").text}' : LEAGUE : #{league} =========\"\n fixture_match_id = node.xpath(\"FixtureMatch_Id\").text\n fixture_id_str = standardize_id_str(fixture_match_id, :fixture)\n\n # Get substitution info from LiveScore data\n if live_score_match_ids.include? fixture_match_id\n live_score_node = live_score_xml.at(\"Id:contains(#{fixture_match_id})\").parent\n [\"Home\",\"Away\"].each do |team|\n sub_details = Array.new\n sub_details_node = node.add_child(\"<#{team}SubDetails></#{team}SubDetails>\")\n live_score_node.xpath(\"#{team}SubDetails\").text.split(';').reverse_each do |sub|\n sub_details << get_sub_details(sub)\n sub_details_node.first.add_child(\"<SubDetail />\")\n end\n\n i = 0\n node.xpath(\"#{team}SubDetails/SubDetail\").each do |detail|\n sub_detail_string = \"<Time>#{sub_details[i][:time]}</Time>\" +\n \"<Name>#{sub_details[i][:name]}</Name>\" +\n \"<Direction>#{sub_details[i][:dir]}</Direction>\"\n detail.add_child(sub_detail_string)\n i += 1\n end\n end\n end\n\n # Goal scorers\n [\"Home\",\"Away\"].each do |team|\n # JMC - skip Brasiliero 'GoalDetails' for now\n unless league_id == \"37\" or node.xpath(\"#{team}GoalDetails\").first.nil?\n goal_details = get_details(node.xpath(\"#{team}GoalDetails\").text)\n node.xpath(\"#{team}GoalDetails\").first.content = ''\n goal_details.each do |goal|\n tmp_str = \"<GoalDetail>\" +\n \"<Name>#{goal[:name]}</Name>\" +\n \"<Time>#{goal[:time]}</Time>\" +\n \"</GoalDetail>\"\n node.xpath(\"#{team}GoalDetails\").first.add_child(tmp_str)\n end\n end\n end\n\n # # Lineups\n # [\"Home\",\"Away\"].each do |team|\n # node.xpath(\"#{team}LineupDefense\").text.split(';').each do |player|\n # node << (\"<#{team}LineupDefender>#{player.strip}</#{team}LineupDefender>\")\n # end\n # node.xpath(\"#{team}LineupMidfield\").text.split(';').each do |player|\n # node << (\"<#{team}LineupMidfielder>#{player.strip}</#{team}LineupMidfielder>\")\n # end\n # node.xpath(\"#{team}LineupForward\").text.split(';').each do |player|\n # node << (\"<#{team}LineupForwardist>#{player.strip}</#{team}LineupForwardist>\")\n # end\n # end\n\n # Lineups\n [\"Home\",\"Away\"].each do |team|\n node.add_child(\"<#{team}Lineup />\")\n tmp_str = \"<Player>\" +\n \"<Name>#{node.xpath(\"#{team}LineupGoalkeeper\").text.strip}</Name>\" + \n \"<Position>G</Position>\" +\n \"</Player>\"\n node.xpath(\"#{team}Lineup\").first.add_child(tmp_str)\n node.xpath(\"#{team}LineupGoalkeeper\").remove\n \n [\"Defense\",\"Midfield\",\"Forward\"].each do |position|\n position_str = node.xpath(\"#{team}Lineup#{position}\").text\n node.xpath(\"#{team}Lineup#{position}\").remove\n position_str.split(';').each do |player|\n tmp_str = \"<Player>\" +\n \"<Name>#{player.strip}</Name>\" +\n \"<Position>#{position[0]}</Position>\" +\n \"</Player>\"\n node.xpath(\"#{team}Lineup\").first.add_child(tmp_str)\n end\n end\n end\n\n # Bookings: Yellow and Red Cards\n [\"Home\",\"Away\"].each do |team|\n [\"Yellow\",\"Red\"].each do |card|\n # Skip when missing 'TeamCardDetails' element (identified in Serie B data)\n unless node.xpath(\"#{team}Team#{card}CardDetails\").first.nil?\n tmp_card_details = get_details(node.xpath(\"#{team}Team#{card}CardDetails\").text)\n node.xpath(\"#{team}Team#{card}CardDetails\").first.content = ''\n tmp_card_details.each do |tcd|\n tmp_str = \"<CardDetail>\" +\n \"<Name>#{tcd[:name]}</Name>\" +\n \"<Time>#{tcd[:time]}</Time>\" +\n \"</CardDetail>\"\n node.xpath(\"#{team}Team#{card}CardDetails\").first.add_child(tmp_str)\n end\n end\n end\n end\n\n # Add the league_id\n league_name = node.xpath(\"League\").text\n league_id = @xmlsoccer_league_map[league_name]\n node.add_child(\"<League_Id>#{league_id}</League_Id>\")\n\n # Handle the shittle situation\n if league_id == \"20\"\n if node.xpath(\"HomeTeam_Id\").text == \"579\"\n node.xpath(\"HomeTeam\").first.content = 'Shittle Flounders FC'\n elsif node.xpath(\"AwayTeam_Id\").text == \"579\"\n node.xpath(\"AwayTeam\").first.content = 'Shittle Flounders FC'\n end\n end \n\n # Save the XML file for this match\n filename = write_xml_file({\n group: 'match',\n group_info: fixture_id_str,\n node: node,\n })\n\n # Save record for generating json and rake files\n data_file_recs << { name: filename, \n path: 'soccer/matches',\n # has_corrections: false,\n # format: 'xml',\n # data_store: 'aws',\n # data_store_id: 1,\n timestamp: `date`.strip } \n\n end # end match_reports\n\n # Save as json file for uploading xml files to data store\n write_upload_list_json_file({\n rec_type: 'result',\n rec_info: league_id_str,\n rec_data: 'xml',\n recs: data_file_recs,\n })\n\n # JMC-CREATE: Initialize the DataFile records\n write_create_records_rake_file({\n rec_class: 'DataFile',\n rec_type: 'file',\n desc: 'Fill database with file data',\n recs: data_file_recs,\n jmc: 'r1',\n ext: league_id_str,\n })\n\n # Create rake file to update Fixture.report_id with the match report id.\n # Yep, same as Fixture.match_id - essentially used as a 'has match report'\n # boolean for now, but keeping since the report id is likely to change\n # fixture_match_ids = match_xml.xpath(\"//Match/FixtureMatch_Id\").map{ |node| node.text }\n update_recs = Array.new\n missing_recs = Array.new\n fixture_ids = get_league_fixture_ids(league_id_str)\n $stdout.flush\n match_xml.xpath(\"//Match/FixtureMatch_Id\").map{ |node| node.text }.each do |match_id|\n next if match_id == \"0\"\n if fixture_ids.include? match_id\n update_recs << { match_id: match_id, report_id: match_id }\n else\n missing_recs << { match_id: match_id }\n end\n end\n puts missing_recs\n\n # JMC-UPDATE: Fixture-update rec for NoDB\n update_recs.each do |update_rec|\n write_nodb_record_json_file({\n rec_type: 'fixtures',\n rec_info: \"#{update_rec[:match_id]}-update-r1\",\n rec: update_rec,\n })\n end\n\n # JMC-UPDATE: Fixture-missing rec for NoDB\n missing_recs.each do |missing_rec|\n write_nodb_record_json_file({\n rec_type: 'fixtures',\n rec_info: \"#{missing_rec[:match_id]}-missing-r1\",\n rec: missing_rec,\n })\n end\n\n # JMC-UPDATE: Fixture-update record (with 'has-match-report' info)\n write_update_records_rake_file({\n rec_class: 'Fixture',\n rec_type: 'fixture',\n rec_key: 'match_id',\n desc: 'Update database with match report data',\n recs: update_recs,\n jmc: 'r1',\n ext: league_id_str,\n })\n\n # JMC-UPDATE-TBD: Fixture-update record\n filename = write_record_array_json_file({\n rec_type: 'fixtures',\n rec_info: \"#{league_id_str}-update-r1\",\n recs: update_recs,\n })\n @nodb_file_recs << { name: filename, path: 'soccer/nodb', timestamp: `date`.strip, }\n\nend", "title": "" }, { "docid": "701689b352e38b7adb17c6aed9c70c3f", "score": "0.4710815", "text": "def climbs\n if self.climbs_string\n\n # \"72487,100.1278839111328,85801,147.2848510742188|201190,99.21577453613281,202669,131.0301055908203\"\n climbs_array = []\n self.climbs_string.split(\"|\").each do |climb|\n climb_array = climb.split(\",\")\n start_pos = climb_array[0]\n start_el = climb_array[1]\n end_pos = climb_array[2]\n end_el = climb_array[3]\n length = end_pos.to_f - start_pos.to_f\n grade = ((end_el.to_f - start_el.to_f) * 100 / length).round(1)\n climbs_array.push Hash[ :grade, grade, :length, length, :start_pos, start_pos.to_f, :start_el, start_el.to_f.round(1), :end_pos, end_pos.to_f, :end_el, end_el.to_f.round(1) ]\n end\n climbs_array\n end\n end", "title": "" }, { "docid": "0d87eabffe9079b7f4dfd0c4bda8da61", "score": "0.4710806", "text": "def compare_epochs(p2c1, p2c2, p2p1, p2p2, epoch1, epoch2, top_1000)\n # Output seven categories:\n # p2p -> p2c & p2p -> c2p\n # p2p -> no longer present\n # p2c -> p2p\n # p2c -> no longer present\n # p2c -> c2p & c2p -> p2c\n # new p2p\n # new p2c\n\n total1 = p2p1 | p2c1\n total2 = p2p2 | p2c2\n\n # init from epoch 0, p2p and p2c from epoch 1\n def disappeared(init,p2p,p2c)\n init.select do |pair|\n not (p2c.include? pair or p2c.include? [pair[1],pair[0]] or p2p.include? pair.sort)\n end\n end\n\n def p2pchanged(p2p1,p2c2)\n p2p1.select do |pair|\n p2c2.include? pair or p2c2.include? pair.sort\n end\n end\n\n def p2cchanged(p2c1,p2p2)\n p2c1.select do |pair|\n p2p2.include? pair.sort\n end\n end\n\n def flipped(p2c1,p2c2)\n p2c1.select do |pair|\n p2c2.include? [pair[1],pair[0]]\n end\n end\n\n def print_and_dump(dataset, output_file, dat, denom)\n output_file.puts \"%-30s %8d %01f\" % [dataset, dat.size, percent(denom,dat)]\n\n # File.open(filename, \"w\") do |f|\n # dat.each { |i| f.puts i.join(\",\") }\n # end\n end\n\n def print_temporary_disappearances(output_file)\n output_file.puts \"Total disappeared p2p: #{@all_disappeared_p2p.size}\"\n p2p_isect = @all_disappeared_p2p & @all_new_p2p\n output_file.puts \"Total that came back: #{p2p_isect.size} (#{p2p_isect.size * 100.0 / @all_disappeared_p2p.size})\"\n\n output_file.puts \"Total disappeared p2c: #{@all_disappeared_p2c.size}\"\n p2c_isect = @all_disappeared_p2c & @all_new_p2c\n output_file.puts \"Total that came back: #{p2c_isect.size} (#{p2c_isect.size * 100.0 / @all_disappeared_p2c.size})\"\n\n output_file.puts \"== p2p ==\"\n @all_disappeared_p2p.each { |l| output_file.puts l.join(\" \") }\n output_file.puts \"== p2c ==\"\n @all_disappeared_p2c.each { |l| output_file.puts l.join(\" \") }\n end\n\n def percent(denom, dat)\n (dat.size * 100.0 / denom)\n end\n\n [[\"nop_filter\",@nop_csv,@nop_txt], [\"weak_filter\",@weak_csv,@weak_txt], [\"strict_filter\",@strict_csv,@strict_txt]].each do |dataset,csv,txt|\n method = top_1000.method(dataset)\n denom = total1.select { |i| method.call(i) }.size\n p2p_dis = disappeared(p2p1,p2p2,p2c2).select { |i| method.call(i) }\n @all_disappeared_p2p += p2p_dis\n p2c_dis = disappeared(p2c1,p2p2,p2c2).select { |i| method.call(i) }\n @all_disappeared_p2c += p2c_dis\n p2p_changed = p2pchanged(p2p1,p2c2).select { |i| method.call(i) }\n p2c_changed = p2cchanged(p2c1,p2p2).select { |i| method.call(i) }\n flipped = flipped(p2c1,p2c2).select { |i| method.call(i) }\n new_p2p = disappeared(p2p2,p2p1,p2c1).select { |i| method.call(i) }\n @all_new_p2p += new_p2p\n new_p2c = disappeared(p2c2,p2p1,p2c1).select { |i| method.call(i) }\n @all_new_p2c += new_p2c\n txt.puts \"====== #{epoch1} <-> #{epoch2} ======\"\n txt.puts \"denominator: #{denom}\"\n print_and_dump(\"p2p_disappeared\", txt, p2p_dis, denom)\n print_and_dump(\"p2c_disappeared\", txt, p2c_dis, denom)\n print_and_dump(\"p2p_changed\", txt, p2p_changed, denom)\n print_and_dump(\"p2c_changed\", txt, p2c_changed, denom)\n print_and_dump(\"flipped\", txt, flipped, denom)\n print_and_dump(\"new_p2p\", txt, new_p2p, denom)\n print_and_dump(\"new_p2c\", txt, new_p2c, denom)\n\n # Epoch number,p2p_dis,p2c_dis,p2p_changed,p2c_changed,flipped,new_p2p,new_p2c\n row = [@epoch, percent(denom,p2p_dis), percent(denom,p2c_dis), percent(denom,p2p_changed),\n percent(denom,p2c_changed), percent(denom,flipped), percent(denom,new_p2p), percent(denom,new_p2c)]\n csv << row\n end\n\n @epoch += 1\n end", "title": "" }, { "docid": "f70aa1fbf4df54542251d30b4fceb5c5", "score": "0.4702311", "text": "def subdivisions; end", "title": "" }, { "docid": "6c2030577164801a0aad602a723bec70", "score": "0.46784446", "text": "def dividing_line; end", "title": "" }, { "docid": "8402106852220178d7143ad067e2f20e", "score": "0.46782026", "text": "def part2(elves)\n higher_power = Math::log(elves,3).ceil\n lower_power = higher_power - 1\n if elves == 3**higher_power\n return elves\n elsif elves >= 2*3**lower_power\n return elves - (3**lower_power - elves)\n else\n return elves - (3**lower_power)\n end\nend", "title": "" }, { "docid": "9b8b19903f5d2922f2d37ef2e1f39534", "score": "0.46730345", "text": "def best_laps\n best_laps = []\n RACER_RECORDS.each {|racer| best_laps << [ racer.piloto, racer.best_lap ]}\n @view.display_best_laps(best_laps)\n end", "title": "" }, { "docid": "65f1fbdbf8d893e9d9740a1132a474ad", "score": "0.46714494", "text": "def addPartialScore(likelyscores, mainteamnumber, bHigh) #bHigh: whether or not this is the high goal\n\tscorethismatch = 0.0\n\tfuelthismatch = 0.0\n\theatMapHits = {} #heatMapHits: {endtime: fuel} .. to be used in calculating accuracy\n\tlikelyscores.each do |time, teamshash|\n\t\tendtime = teamshash[mainteamnumber] #for heat map\n\t\tfuelScoreRatio = (bHigh ? 1.0 : 3.0) #ratio of fuel to score. autonomous: 1/high 3/low, tele: 3/high 9/low\n\t\tfuelScoreRatio *= 3.0 if (time < 16000)\n\t\tcase teamshash.length\n\t\twhen 0 \n\t\t\tputs \"WARNING: For some reason we have a teamsthatscored key with no value\"\n\t\twhen 1\n\t\t\tif teamshash.has_key?(mainteamnumber) #The team scored alone - cool!\n\t\t\t\tscoretoadd = 1 #They get credit for scoring 1 point with high fuel\n\t\t\t\tfueltoadd = (1 * fuelScoreRatio)\n\t\t\tend #We don't care to record what the other teams are doing, only the one we're analyzing\n\t\twhen 2\n\t\t\tif teamshash.has_key?(mainteamnumber) #The team was one of 2 to be shooting high at this time\n\t\t\t\tscoretoadd = 0.5\n\t\t\t\tfueltoadd = (0.5 * fuelScoreRatio)\n\t\t\tend\n\t\twhen 3\n\t\t\tif teamshash.has_key?(mainteamnumber) #One of 3\n\t\t\t\tscoretoadd = 1.to_f / 3.to_f\n\t\t\t\tfueltoadd = ((1.to_f / 3.to_f) * fuelScoreRatio)\n\t\t\tend\n\t\telse\n\t\t\tputs \"WARNING: Unknown error in likelyscores.each having to do wth the case switch\"\n\t\tend\n\t\theatMapHits[endtime] = fueltoadd \n\t\tscorethismatch += scoretoadd\n\t\tfuelthismatch += fueltoadd\n\tend\n\treturn [scorethismatch, fuelthismatch, heatMapHits]\nend", "title": "" }, { "docid": "22f88383b1335aa1d894aa90c54e7166", "score": "0.46656114", "text": "def update_score\n games = Hash.new([])\n predictions.each do |prediction|\n key = prediction.match_id\n games[key] = {}\n games[key][:teams] = []\n games[key][:round] = prediction.round_id\n unless prediction.winner.nil?\n games[key][:teams] << prediction.winner.id\n end\n end\n Game.includes(:team1, :team2).find_each do |game|\n key = game.match_id\n unless game.winner.nil?\n games[key][:teams] << game.winner.id\n end\n end\n\n puts games.inspect\n\n score = 0\n games.each do |key, data|\n round = games[key][:round]\n winners = games[key][:teams]\n if winners.length == 2 and winners.first == winners.last\n score += (2 ** (round))\n end\n end\n self.update_attributes :score => score\n end", "title": "" }, { "docid": "a756aeb0d49abd94e97cd277445313ab", "score": "0.46580702", "text": "def split()\r\n if(@curplayer.nummoves > 0)\r\n return false\r\n end\r\n #check their 2 cards, if theyre the same, split cur players hand into a 2 dimensional array of hands.\r\n if(@curplayer.hand.cards[0].equals(@curplayer.hand.cards[1]))\r\n #two cards are the same\r\n #split is allowed\r\n splitplayer = Player.new(@curplayer.name, @curplayer.money)\r\n splitbet = @curplayer.curBet/2\r\n #split the bet in half and give it to the new player\r\n splitplayer.curBet = splitbet\r\n #subtract split bet from current bet\r\n @curplayer.curBet = @curplayer.curBet - splitbet\r\n #take one of the cards and give it to the new player\r\n splitplayer.hand.addCard(@curplayer.hand.cards.pop())\r\n #update the scores of both hands\r\n splitplayer.hand.updateScore()\r\n @curplayer.hand.updateScore()\r\n splitplayer.state = \"fine\"\r\n #set the parent pointer so that I can take any winnings and give it to them\r\n splitplayer.parent = @curplayer\r\n splitplayer.split = true\r\n @players.push(splitplayer)\r\n #set number of moves to 1 so that they cant split again/double down\r\n @curplayer.nummoves += 1\r\n splitplayer.nummoves +=1\r\n return splitplayer\r\n else\r\n return false\r\n end\r\n end", "title": "" }, { "docid": "94f65a034bfe2e1c127bb97f42721b4e", "score": "0.46575373", "text": "def create\n params.require(:result).sort_by{|match_id,_| match_id}.each do |match_id, attrs|\n complete = true\n match = Match.find(match_id)\n\n if attrs['team1_score'].present? and attrs['team2_score'].present?\n\n team1_score = attrs['team1_score'].split('*').first.to_i\n team2_score = attrs['team2_score'].split('*').first.to_i\n\n if match.stage <= 16\n attrs['team1_id'] = match.team1_id\n attrs['team2_id'] = match.team2_id\n\n if match.stage < 16\n if match.stage == 8\n if match.pos_in_stage == 1\n parentMatch1 = Match.where(stage: 16, pos_in_stage: 1).first\n parentMatch2 = Match.where(stage: 16, pos_in_stage: 2).first\n elsif match.pos_in_stage == 2\n parentMatch1 = Match.where(stage: 16, pos_in_stage: 5).first\n parentMatch2 = Match.where(stage: 16, pos_in_stage: 6).first\n elsif match.pos_in_stage == 3\n parentMatch1 = Match.where(stage: 16, pos_in_stage: 3).first\n parentMatch2 = Match.where(stage: 16, pos_in_stage: 4).first\n elsif match.pos_in_stage == 4\n parentMatch1 = Match.where(stage: 16, pos_in_stage: 7).first\n parentMatch2 = Match.where(stage: 16, pos_in_stage: 8).first\n end\n elsif match.stage == 4\n if match.pos_in_stage == 1\n parentMatch1 = Match.where(stage: 8, pos_in_stage: 1).first\n parentMatch2 = Match.where(stage: 8, pos_in_stage: 2).first\n else\n parentMatch1 = Match.where(stage: 8, pos_in_stage: 3).first\n parentMatch2 = Match.where(stage: 8, pos_in_stage: 4).first\n end\n else\n parentMatch1 = Match.where(stage: 4, pos_in_stage: 1).first\n parentMatch2 = Match.where(stage: 4, pos_in_stage: 2).first\n end\n\n if match.stage == 2 and match.pos_in_stage == 1\n attrs['team1_id'] = parentMatch1.loser_id\n attrs['team2_id'] = parentMatch2.loser_id\n else\n attrs['team1_id'] = parentMatch1.winner_id\n attrs['team2_id'] = parentMatch2.winner_id\n end\n\n complete = false unless attrs['team1_id'].present? and attrs['team2_id'].present?\n end\n\n if complete\n if team1_score > team2_score\n attrs['winner_id'] = attrs['team1_id']\n elsif team1_score < team2_score\n attrs['winner_id'] = attrs['team2_id']\n else\n if attrs['team2_score'].include? '*'\n attrs['winner_id'] = attrs['team2_id']\n attrs['team2_score'] = team2_score\n else\n attrs['winner_id'] = attrs['team1_id']\n attrs['team1_score'] = team1_score\n end\n end\n end\n end\n\n match.attributes = attrs\n if match.changed? and complete\n match.save\n Forecast.update_user_points(match)\n end\n else\n match.team1_score = nil\n match.team2_score = nil\n match.winner_id = nil\n\n match.save\n end\n end\n\n flash[:notice] = 'Resultados actualizados correctamente'\n redirect_to points_path\n end", "title": "" }, { "docid": "3d369520ce07a003417ee55fd0442c21", "score": "0.46485636", "text": "def judge_teams\n pilot_flight.pfj_results.collect { |pfj_result| pfj_result.judge }\n end", "title": "" }, { "docid": "5a1e5de1e06865087fe3036661b49a29", "score": "0.46418068", "text": "def split_showers(showers)\n showers.\n each_slice(2).\n flat_map{|before, after|\n next unless after\n [ [:shower, before], [:pause, hours_between(before, after)] ].\n push([ :shower, showers.last ]).\n unshift([ :pause, hours_between(Time.now, showers.first) ])\n }\nend", "title": "" }, { "docid": "d309d92e5c698b62a50f309b391076be", "score": "0.46387896", "text": "def compared_stages\n @compared_stages ||= project.stages.ordered.each_cons(2).map do |ahead, behind|\n comparison = snapshot&.comparisons&.detect { |c| c.behind_stage_id == behind.id && c.ahead_stage_id == ahead.id }\n {\n stages: [ahead, behind],\n snapshot: comparison,\n diff: diff_commits(comparison),\n blame: diff_blame(comparison),\n score: (ComparisonService.comparison_score(comparison) if comparison)\n }\n end\n end", "title": "" }, { "docid": "7df3ce16e42a13d7b359e4002dcff702", "score": "0.46336952", "text": "def update_games_from_logic(params_logic)\n params_logic.collect do |region_name, region_logic|\n region_logic.collect do |game_index, game_logic|\n game_logic.collect do |game_id, team_id_winner|\n Game.update(game_id.to_i,\n :team_id_winner => team_id_winner.to_i,\n :team_id_loser => Game.find_by(:id => game_id.to_i).\n teams.collect{|team| team.id}.reject{|team_id| team_id == team_id_winner.to_i}.first)\n end\n end\n end.flatten\n end", "title": "" }, { "docid": "a78bc5a084ec913cf46c21d0149df719", "score": "0.46307662", "text": "def goodVsEvil(good, evil)\n goodStats = {\n :hobbits => 1,\n :men => 3,\n :elves => 3,\n :dwarves => 3,\n :eagles => 4,\n :wizards => 10\n }\n evilStats = {\n :orcs => 1,\n :men => 2,\n :wargs => 2,\n :goblins => 2,\n :urukHai => 3,\n :trolls => 5,\n :wizards => 10\n }\n\n def getScore(side, stats)\n getArr = side.split(' ').each_with_index.map{|e,i| e.to_i * stats.values[i]}\n getArr.reduce{|sum,el| sum+= el}\n end\n\n goodScore = [getScore(good, goodStats), 2147483647].min\n evilScore = [getScore(evil, evilStats), 2147483647].min\n\n if goodScore == evilScore\n return \"Battle Result: No victor on this battle field\"\n elsif goodScore > evilScore\n return \"Battle Result: Good triumphs over Evil\"\n elsif evilScore > goodScore\n return \"Battle Result: Evil eradicates all trace of Good\"\n end\nend", "title": "" }, { "docid": "2009a9768659f07625b08c8e7993465f", "score": "0.46253112", "text": "def winning_team\n final_scores = player_collection.reduce(home: 0, away: 0) { |teams_points, next_player|\n case \n when next_player[:location] === :away\n teams_points[:away] += next_player[:points];\n when next_player[:location] === :home\n teams_points[:home] += next_player[:points];\n end\n teams_points; \n }\n winner = final_scores.reduce { |highest_points, team_points| \n highest_points[1] > team_points[1] ? highest_points : team_points; \n }\n game_hash[winner[0]][:team_name]; \nend", "title": "" }, { "docid": "dd03c0ac60b11c9775a35cb63075248d", "score": "0.46198598", "text": "def play_as_master_second\r\n card_avv_s = @card_played[0].to_s\r\n card_avv_info = @deck_info.get_card_info(@card_played[0])\r\n max_points_take = 0\r\n max_card_take = @cards_on_hand[0]\r\n min_card_leave = @cards_on_hand[0]\r\n min_points_leave = @deck_info.get_card_info(min_card_leave)[:points] + card_avv_info[:points]\r\n take_it = []\r\n leave_it = []\r\n # build takeit leaveit arrays\r\n @cards_on_hand.each do |card_lbl|\r\n card_s = card_lbl.to_s\r\n bcurr_card_take = false\r\n card_curr_info = @deck_info.get_card_info(card_lbl)\r\n if card_s[2] == card_avv_s[2]\r\n # same suit\r\n if card_curr_info[:rank] > card_avv_info[:rank]\r\n # current card take\r\n bcurr_card_take = true\r\n take_it << card_lbl\r\n else\r\n leave_it << card_lbl\r\n end\r\n elsif card_s[2] == @briscola.to_s[2]\r\n # this card is a briscola \r\n bcurr_card_take = true\r\n take_it << card_lbl\r\n else\r\n leave_it << card_lbl\r\n end\r\n # check how many points make the card if it take\r\n points = card_curr_info[:points] + card_avv_info[:points]\r\n if bcurr_card_take\r\n if points > max_points_take\r\n max_card_take = card_lbl\r\n max_points_take = points\r\n end\r\n else\r\n # leave it as minimum\r\n if points < min_points_leave or (points == min_points_leave and\r\n card_curr_info[:rank] < @deck_info.get_card_info(min_card_leave)[:rank] )\r\n min_card_leave = card_lbl\r\n min_points_leave = points\r\n end\r\n end\r\n end\r\n #p min_points_leave\r\n #p min_card_leave\r\n curr_points_me = 0\r\n @team_mates.each{ |name_pl| curr_points_me += @points_segno[name_pl] }\r\n tot_points_if_take = curr_points_me + max_points_take\r\n curr_points_opp = 0\r\n @opp_names.each{ |name_pl| curr_points_opp += @points_segno[name_pl] }\r\n \r\n #p take_it\r\n #p leave_it\r\n #p max_points_take\r\n #p min_points_leave\r\n if take_it.size == 0\r\n #take_it is not possibile, use leave it\r\n @log.debug(\"play_as_master_second, apply R1 #{min_card_leave}\")\r\n return min_card_leave \r\n end\r\n max_card_take_s = max_card_take.to_s\r\n if tot_points_if_take >= @target_points\r\n # take it, we win\r\n @log.debug(\"play_as_master_second, apply R2 #{max_card_take}\")\r\n return max_card_take\r\n end\r\n if @pending_points > 0\r\n card_to_play = best_taken_card(take_it)[0]\r\n @log.debug(\"play_as_master_second, apply R2-decl #{card_to_play}\")\r\n return card_to_play \r\n end\r\n if max_card_take_s[2] == @briscola.to_s[2]\r\n # card that take is briscola, pay attention to play it\r\n if max_points_take >= 20\r\n @log.debug(\"play_as_master_second, apply R3 #{max_card_take}\")\r\n return max_card_take\r\n end\r\n elsif max_points_take >= 10\r\n # take it, strosa!\r\n @log.debug(\"play_as_master_second, apply R4 #{max_card_take}\")\r\n return max_card_take\r\n end\r\n best_leave_it = nil\r\n if leave_it.size > 0\r\n best_leave_it = best_leaveit_card(leave_it)\r\n end\r\n if best_leave_it == nil\r\n card_to_play = best_taken_card(take_it)[0]\r\n @log.debug(\"play_as_master_second, apply R9 #{card_to_play} - force taken\")\r\n return card_to_play\r\n end\r\n points_best_leave = @deck_info.get_card_info(best_leave_it)[:points]\r\n if card_avv_info[:points] == 0 and points_best_leave == 0\r\n @log.debug(\"play_as_master_second, apply R10 #{best_leave_it} \")\r\n return best_leave_it\r\n end\r\n if take_it.size > 0\r\n w_and_best = best_taken_card(take_it)\r\n # we can take it\r\n if curr_points_opp > 29 and max_points_take > 0 and take_it.size > 1\r\n # try to take it\r\n card_to_play = w_and_best[0]\r\n @log.debug(\"play_as_master_second, apply R5 #{card_to_play}\")\r\n return card_to_play\r\n end\r\n if curr_points_opp > 36 and (card_avv_info[:points] > 0 or points_best_leave > 0)\r\n # try to take it\r\n card_to_play = w_and_best[0]\r\n @log.debug(\"play_as_master_second, apply R11 #{card_to_play}\")\r\n return card_to_play\r\n end\r\n if points_best_leave > 2 or min_points_leave > 3 and w_and_best[1] < 320\r\n # I am loosing too many points?\r\n card_to_play = w_and_best[0]\r\n @log.debug(\"play_as_master_second, apply R6 #{card_to_play}\")\r\n return card_to_play\r\n end\r\n end \r\n # leave it\r\n if best_leave_it\r\n @log.debug(\"play_as_master_second, apply R7 #{best_leave_it}\")\r\n return best_leave_it\r\n end\r\n \r\n @log.debug(\"play_as_master_second, apply R8 #{min_card_leave}\")\r\n return min_card_leave \r\n #crash\r\n end", "title": "" }, { "docid": "f29218f847826ca4d31e36a1f36c064e", "score": "0.4618168", "text": "def goal_difference\n total_diff = 0\n\n wattball_matches_as_team1.each do |match|\n total_diff += match.goal_difference[0]\n end\n\n wattball_matches_as_team2.each do |match|\n total_diff += match.goal_difference[1]\n end\n \n total_diff\n end", "title": "" }, { "docid": "905dbb7ceb61d5e36199229dd7f8340c", "score": "0.4615755", "text": "def fewest_hits(seasonasstring) # shots in game team stats\n #inverse of above\n end", "title": "" }, { "docid": "b2860ac59f904ea27c8923b10d175415", "score": "0.4608979", "text": "def test\n\t\t##\n\t\t# Possible outcomes for each test. Do all tests and count the outcome\n\t\t##\n\t\twinLoss = {win: 0, loss: 0, sorted: 0, unsorted: 0}\n\t\t@xData[:test].each{|test|\n\t\t\t#Get the truth\n\t\t\tsorted \t\t= test.sort{|a,b| a <=> b}\n\t\t\t#Take an educated guess\n\t\t\tprediction\t= @machine.run(test).first.round\n\t\t\t##\n\t\t\t# Record outcomes\n\t\t\t##\n\t\t\t#If it is classed as sorted and is sorted\n\t\t\tif prediction == 1 && test == sorted \n\t\t\t\twinLoss[:win] \t\t+= 1\n\t\t\t\twinLoss[:sorted]\t+= 1\n\t\t\t#If it's classed as unsorted and is unsorted\n\t\t\telsif prediction == 0 && test != sorted\n\t\t\t\twinLoss[:win] \t\t+= 1\n\t\t\t\twinLoss[:unsorted]\t+= 1\n\t\t\t#A loos. You've broke something somewhere (probably)\n\t\t\telse\n\t\t\t\twinLoss[:loss] \t\t+= 1\n\t\t\tend\n\t\t}\n\t\t#Print the results\n\t\tputs \"Iterations: #{@iterations}\\nMAX_MSE: #{@maxError}\\n\\t#{winLoss}\" # proof\n\tend", "title": "" }, { "docid": "24f754c75f5c4a9ab424391727d26e40", "score": "0.45988283", "text": "def by_fragmentation\n peptide2 = @peptide.split('').insert(0,\"h\").insert(-1,\"oh\").join\n\t\tfrag__b = ([email protected]+1).collect do |num|\n peptide2.split('').insert(num,'b').join \n end\t\n frag__y = frag__b.collect do |po|\n (2..(@peptide.size+1)).to_a.collect do |ei|\n po.split('').insert(ei,'y').join \n end \n end\n\t\t \n frag__2good = frag__y.flatten.delete_if {|x| x.include?(\"by\") or x.include?(\"yb\")}\n final_arry_spectra = frag__2good.collect do |pep_b|\n pep_b.gsub!(/[by]/, 'b'=>'+-h', 'y'=>'%-h').split(\"-\")\n end \n final_arry_spectra\n end", "title": "" }, { "docid": "b533fb1591dbbb34efa054a457af0245", "score": "0.45891267", "text": "def parse\n # TODO: Try to convert lsynth parts, maybe flag parts that are troublesome for manual editing,\n # look up to see if I've stored a conversion from ldraw ID to Bricklink ID,\n # convert Ldraw color IDs to BL color IDs, etc.\n parts = {}\n temp_parts = []\n\n @lines.each_with_index do |line, i|\n # This will stop getting parts for the base model once a submodel is reached\n break if line.match(/0 FILE/) && i > 15\n\n @submodels << line.match(/\\w+\\.ldr/).to_s.downcase if line.match(/^1/) && line.match(/\\.ldr$/)\n @lsynthed_parts << line.gsub('0 SYNTH BEGIN', '').split if line =~ /^0 SYNTH BEGIN/\n next unless line.match(/^1/) && line.match(/.dat$/)\n\n part = line.match(/\\w+\\.dat/).to_s.gsub!('.dat', '')\n next if lsynth_part?(part)\n\n color = line.match(/^1\\s\\d+/).to_s.gsub!('1 ', '')\n bl_part = get_bl_part_number(part)\n temp_parts << [bl_part, color, part]\n end\n\n # Now go through all submodels to determine the parts belonging to the submodels\n temp_parts = handle_submodels(temp_parts)\n\n # Not yet functional\n # handle_lsynthed_parts(temp_parts)\n\n temp_parts.each do |info|\n if parts.key?(\"#{info[0]}_#{info[1]}\")\n parts[\"#{info[0]}_#{info[1]}\"]['quantity'] += 1\n else\n parts[\"#{info[0]}_#{info[1]}\"] = {}\n parts[\"#{info[0]}_#{info[1]}\"]['quantity'] = 1\n parts[\"#{info[0]}_#{info[1]}\"]['ldraw_part_num'] = info[2]\n end\n end\n\n parts\n end", "title": "" }, { "docid": "983764deeb0bf63b081d6c1604bfbb28", "score": "0.45873162", "text": "def calculate_score\n # Calculate score given the number of lines cleared at once\n case (@deleted_indexes.length / 2)\n when 1\n @score += 40 * (@level + 1)\n when 2\n @score += 100 * (@level + 1)\n when 3\n @score += 300 * (@level + 1)\n when 4\n @score += 1200 * (@level + 1)\n end\n @score\n end", "title": "" }, { "docid": "ebe646308179b56cfc77839dee191902", "score": "0.45867148", "text": "def divideCode longCode\n\t\t# regex to find n characters, a space, then n numbers\n\t\t# the rest is the section code\n\t\t# \"hello\".rpartition(/.l/) #=> [\"he\", \"ll\", \"o\"]\n\n\t\t# this regex searches for three numbers sandwiched between letters\n\t\tregex = /(?<=[A-Z]) ?[0-9]{3}(?=[A-Z])/\n\t\t# strip whitespace and search\n\t\tresults = longCode.gsub(/\\s+/, \"\").rpartition(regex);\n\n\t\t# puts \"#{results[0]}|#{results[1]}|#{results[2]}\"\n\n\t\tif results[0].length > 0 and results[1].length > 0 and results[2].length > 0\n\t\t\t# valid results\n\t\t\tdepartmentCode = results[0]\n\t\t\tcourseCode = results[1]\n\t\t\tsectionShortcode = results[2]\n\t\t\treturn [departmentCode, courseCode, sectionShortcode]\n\t\telse \n\t\t\t# invalid results\n\t\t\treturn []\n\t\tend\n\tend", "title": "" }, { "docid": "bed66e19531f9310a652aef7670abbb6", "score": "0.4582337", "text": "def test_alg_not_work02\r\n rep = ReplayManager.new(@log)\r\n match_info = YAML::load_file(File.dirname(__FILE__) + '/saved_games/alg_flaw_02.yaml')\r\n segno_num = 0\r\n rep.replay_match(@core, match_info, {}, segno_num, 1)\r\n assert_equal(0, @io_fake.warn_count)\r\n assert_equal(0, @io_fake.error_count)\r\n end", "title": "" }, { "docid": "49fe747d70fb2a1d7336a28dc8ba7e4e", "score": "0.45811906", "text": "def generate_scores(stage1, matches, players)\n i, matches_per_round = 0, 1\n round_depth = Math.log2(players.length).ceil\n query = PlayerMatch.select(:player_id, :match_id, :result)\n .where(match_id: matches).reorder(match_id: :asc)\n scores = Array.new(round_depth, [])\n\n while (i < round_depth)\n j, k = 0, 0\n scores[i] = Array.new(matches_per_round, nil)\n while (k < scores[i].count)\n results = query.where(match_id: stage1[i][k]).first\n if (!results.blank?)\n if results['result'] == \"Win\"\n scores[i][j] = [1,0]\n else\n scores[i][j] = [0,1]\n end\n else\n scores[i][j] = [nil, nil]\n end\n j += 1\n k += 1\n end\n\n i += 1\n matches_per_round *= 2\n end\n return scores\n end", "title": "" }, { "docid": "dd353521241f2d6960bb12f00846dce8", "score": "0.45794722", "text": "def get_live_league_games\n\tcurrent_matches = []\n\tDota.live_leagues.each do |match|\n\t\tif match.raw_live_league['dire_team'] && match.raw_live_league['radiant_team']\n\t\t\tcurrent_matches.push(match)\n\n\t\tend\n\tend\n\n\t#puts 'New Matches:'\n\tcurrent_matches.sort! { |a, b| b.lobby_id <=> a.lobby_id }\n\tcurrent_matches\nend", "title": "" }, { "docid": "5809d5332f8f755abe0db9ef0d3500f1", "score": "0.45764875", "text": "def gametime_collapsed_segments\n segments.reduce([]) do |segs, seg|\n if segs.last.try(:gametime_duration_ms) == 0\n skipped_seg = segs.last\n segs + [Segment.new(\n segs.pop.attributes.merge(\n name: \"#{skipped_seg.name} + #{seg.name}\",\n realtime_start_ms: skipped_seg.realtime_start_ms,\n realtime_end_ms: seg.realtime_end_ms,\n realtime_duration_ms: seg.realtime_duration_ms,\n gametime_start_ms: skipped_seg.gametime_start_ms,\n gametime_end_ms: skipped_seg.gametime_end_ms,\n gametime_duration_ms: seg.gametime_duration_ms,\n gametime_reduced: true\n )\n )]\n else\n segs + [seg]\n end\n end\n end", "title": "" }, { "docid": "f3d9462589811d5ddc3f1c4c071a06dd", "score": "0.45755306", "text": "def worst_loss(team_id)\n @games.map do |game|\n if game.away_team_id.to_s == team_id\n game.home_goals - game.away_goals\n elsif game.home_team_id.to_s == team_id\n game.away_goals - game.home_goals\n end\n end.compact.max\n end", "title": "" }, { "docid": "39c32155bf17daab5b492aec423f7682", "score": "0.4573302", "text": "def partition_by_viols\n partition = []\n @competition.each do |cand|\n match = partition.find_index { |part| part[0].ident_viols? cand }\n add_to_partition(cand, match, partition)\n end\n partition\n end", "title": "" }, { "docid": "0f6fa5356b5b3b7cbec92cf79acf7837", "score": "0.4568442", "text": "def per_game_stats(season = nil)\n season_id = season ? season.id : Season.current.id\n StatLine.find_by_sql('SELECT AVG(fgm) as fgm, AVG(fga) as fga, coalesce(AVG(fgm)/nullif(AVG(fga), 0), 0) as fgpct, AVG(twom) as twom, AVG(twoa) as twoa, coalesce(AVG(twom)/nullif(AVG(twoa), 0), 0) as twopct, AVG(threem) as threem, AVG(threea) as threea, coalesce(AVG(threem)/nullif(AVG(threea), 0), 0) as threepct,' \\\n 'AVG(ftm) as ftm, AVG(fta) as fta, coalesce(AVG(ftm)/nullif(AVG(fta), 0), 0) as ftpct, AVG(orb) as orb, AVG(drb) as drb, AVG(trb) as trb, AVG(ast) as ast, AVG(stl) as stl, AVG(blk) as blk, AVG(fl) as fl, AVG(\"to\") as to,' \\\n 'AVG(points) as points, COUNT(*) as game_count, sums.league_id FROM (SELECT SUM(fgm) as fgm, SUM(fga) as fga, SUM(twom) as twom, SUM(twoa) as twoa, SUM(threem) as threem, SUM(threea) as threea,' \\\n 'SUM(ftm) as ftm, SUM(fta) as fta, SUM(orb) as orb, SUM(drb) as drb, SUM(trb) as trb, SUM(ast) as ast, SUM(stl) as stl, SUM(blk) as blk, SUM(fl) as fl, SUM(\"to\") as to,' \\\n \"SUM(points) as points, g.league_id as league_id FROM stat_lines sl INNER JOIN games g ON sl.game_id = g.id \" \\\n \"WHERE g.winner is not null AND (g.forfeit is null or not g.forfeit) AND (sl.dnp is null OR not sl.dnp) AND team_id = #{self.id} AND g.season_id = #{season_id} GROUP BY game_id, g.league_id) sums GROUP BY sums.league_id\")\n end", "title": "" }, { "docid": "e52e4ca5c0f71eb922ad6cd86d306e69", "score": "0.45655695", "text": "def score_matchup(matchup_id, winning_submission_id, losing_submission_id)\n # TODO: ensure we're filtering by category or whatever\n matchup = $MATCHUPS.find{|matchup| matchup[:id] == matchup_id}\n matchup[:completed] = true\n matchup[:winning_submission_id] = winning_submission_id\n\n winning_submission = $SUBMISSIONS.find{|s| s[:id] == winning_submission_id }\n losing_submission = $SUBMISSIONS.find{|s| s[:id] == losing_submission_id }\n\n winning_sub_elo = Elo::Player.new(:rating => winning_submission[:elo_rating])\n losing_sub_elo = Elo::Player.new(:rating => losing_submission[:elo_rating])\n \n winning_sub_elo.wins_from(losing_sub_elo)\n\n winning_submission[:elo_rating] = winning_sub_elo.rating\n losing_submission[:elo_rating] = losing_sub_elo.rating\n\n # $SUBMISSIONS.map{|s| s[:id] == winning_submission_id ? winning_submission : s[:id] == losing_submission_id ? losing_submission : s }\n\n # $MATCHUPS.map{|m| m[:id] == matchup_id ? matchup : m }\n incomplete_matches = $MATCHUPS.select{|m| m[:completed] == false && m[:assigned] == false}\n\n if(incomplete_matches.count() < $NUM_TEAMS) \n generate_more_matchups()\n end\nend", "title": "" }, { "docid": "7e903dde6b176077c8d79d77769cc305", "score": "0.45508826", "text": "def discover_tests\n # List of exterior cells coordinates, per worldspace name, per plugin name\n # Hash< String, Hash< String, Array<[Integer, Integer]> > >\n exterior_cells = {}\n @game.xedit.run_script('DumpInfo', only_once: true)\n @game.xedit.parse_csv('Modsvaskr_ExportedDumpInfo') do |row|\n esp_name, record_type = row[0..1]\n if record_type.downcase == 'cell'\n cell_type, cell_name, cell_x, cell_y = row[3..6]\n if cell_type == 'cow'\n if cell_x.nil?\n log \"!!! Invalid record: #{row}\"\n else\n esp_name.downcase!\n exterior_cells[esp_name] = {} unless exterior_cells.key?(esp_name)\n exterior_cells[esp_name][cell_name] = [] unless exterior_cells[esp_name].key?(cell_name)\n exterior_cells[esp_name][cell_name] << [Integer(cell_x), Integer(cell_y)]\n end\n end\n end\n end\n # Test only exterior cells that have been changed by mods, and make sure we test the minimum, knowing that each cell loaded in game tests 5x5 cells around\n vanilla_esps = @game.game_esps\n vanilla_exterior_cells = vanilla_esps.inject({}) do |merged_worldspaces, esp_name|\n merged_worldspaces.merge(exterior_cells[esp_name] || {}) do |_worldspace, ext_cells_1, ext_cells_2|\n (ext_cells_1 + ext_cells_2).sort.uniq\n end\n end\n changed_exterior_cells = {}\n exterior_cells.each do |esp_name, esp_exterior_cells|\n next if vanilla_esps.include?(esp_name)\n\n esp_exterior_cells.each do |worldspace, worldspace_exterior_cells|\n if vanilla_exterior_cells.key?(worldspace)\n changed_exterior_cells[worldspace] = [] unless changed_exterior_cells.key?(worldspace)\n changed_exterior_cells[worldspace].concat(vanilla_exterior_cells[worldspace] & worldspace_exterior_cells)\n end\n end\n end\n tests = {}\n # Value taken from the ini file\n # TODO: Read it from there (uiGrid)\n loaded_grid = 5\n delta_cells = loaded_grid / 2\n changed_exterior_cells.each do |worldspace, worldspace_exterior_cells|\n # Make sure we select the minimum cells\n # Use a Hash of Hashes for the coordinates to speed-up their lookup.\n remaining_cells = {}\n worldspace_exterior_cells.each do |(cell_x, cell_y)|\n remaining_cells[cell_x] = {} unless remaining_cells.key?(cell_x)\n remaining_cells[cell_x][cell_y] = nil\n end\n until remaining_cells.empty?\n cell_x, cell_ys = remaining_cells.first\n cell_y, _nil = cell_ys.first\n # We want to test cell_x, cell_y.\n # Knowing that we can test it by loading any cell in the range ((cell_x - delta_cells..cell_x + delta_cells), (cell_y - delta_cells..cell_y + delta_cells)),\n # check which cell would test the most wanted cells from our list\n best_cell_x = nil\n best_cell_y = nil\n best_cell_score = nil\n (cell_x - delta_cells..cell_x + delta_cells).each do |candidate_cell_x|\n (cell_y - delta_cells..cell_y + delta_cells).each do |candidate_cell_y|\n # Check the number of cells that would be tested if we were to test (candidate_cell_x, candidate_cell_y)\n nbr_tested_cells = remaining_cells.\n slice(*(candidate_cell_x - delta_cells..candidate_cell_x + delta_cells)).\n inject(0) { |sum_cells, (_cur_cell_x, cur_cell_ys)| sum_cells + cur_cell_ys.slice(*(candidate_cell_y - delta_cells..candidate_cell_y + delta_cells)).size }\n next unless best_cell_score.nil? || nbr_tested_cells > best_cell_score\n\n best_cell_score = nbr_tested_cells\n best_cell_x = candidate_cell_x\n best_cell_y = candidate_cell_y\n end\n end\n # Remove the tested cells from the remaining ones\n (best_cell_x - delta_cells..best_cell_x + delta_cells).each do |cur_cell_x|\n next unless remaining_cells.key?(cur_cell_x)\n\n (best_cell_y - delta_cells..best_cell_y + delta_cells).each do |cur_cell_y|\n remaining_cells[cur_cell_x].delete(cur_cell_y)\n end\n remaining_cells.delete(cur_cell_x) if remaining_cells[cur_cell_x].empty?\n end\n tests[\"#{worldspace}/#{best_cell_x}/#{best_cell_y}\"] = {\n name: \"Load #{worldspace} cell #{best_cell_x}, #{best_cell_y}\"\n }\n end\n end\n tests\n end", "title": "" }, { "docid": "94cd22cf2c75e663c8a2b92184ec8e0f", "score": "0.45497054", "text": "def blend_internal_loads(runner, model, source_space_or_space_type, target_space_type, ratios, collection_floor_area, space_hash)\n # ratios\n floor_area_ratio = ratios[:floor_area_ratio]\n num_people_ratio = ratios[:num_people_ratio]\n ext_surface_area_ratio = ratios[:ext_surface_area_ratio]\n ext_wall_area_ratio = ratios[:ext_wall_area_ratio]\n volume_ratio = ratios[:volume_ratio]\n\n # for normalizing design level loads I need to know effective number of spaces instance is applied to\n if source_space_or_space_type.to_Space.is_initialized\n eff_num_spaces = source_space_or_space_type.multiplier\n else\n eff_num_spaces = 0\n source_space_or_space_type.spaces.each do |space|\n eff_num_spaces += space.multiplier\n end\n end\n\n # array of load instacnes re-assigned to blended space\n instances_array = []\n\n # internal_mass\n source_space_or_space_type.internalMass.each do |load_inst|\n load_def = load_inst.definition.to_InternalMassDefinition.get\n if load_def.surfaceArea.is_initialized\n # edit and assign a clone of definition and normalize per area based on floor area ratio\n if collection_floor_area == 0\n runner.registerWarning(\"Can't determine building floor area to normalize #{load_def}. #{load_inst} will be asigned the the blended space without altering its values.\")\n else\n cloned_load_def = load_def.clone(model).to_InternalMass.get\n orig_design_level = cloned_load_def.surfaceArea.get\n cloned_load_def.setSurfaceAreaperSpaceFloorArea(eff_num_spaces * orig_design_level / collection_floor_area)\n cloned_load_def.setName(\"#{cloned_load_def.name} - pre-normalized value was #{orig_design_level.round} m^2.\")\n load_inst.setInternalMassDefinition(cloned_load_def)\n end\n elsif load_def.surfaceAreaperSpaceFloorArea.is_initialized\n load_inst.setMultiplier(load_inst.multiplier * floor_area_ratio)\n elsif load_def.surfaceAreaperPerson.is_initialized\n if num_people_ratio.nil?\n runner.registerError(\"#{load_def} has value defined per person, but people ratio wasn't passed in\")\n return false\n else\n load_inst.setMultiplier(load_inst.multiplier * num_people_ratio)\n end\n else\n runner.registerError(\"Unexpected value type for #{load_def.name}\")\n return false\n end\n load_inst.setSpaceType(target_space_type)\n instances_array << load_inst\n end\n\n # people\n source_space_or_space_type.people.each do |load_inst|\n load_def = load_inst.definition.to_PeopleDefinition.get\n if load_def.numberofPeople.is_initialized\n # edit and assign a clone of definition and normalize per area based on floor area ratio\n if collection_floor_area == 0\n runner.registerWarning(\"Can't determine building floor area to normalize #{load_def}. #{load_inst} will be asigned the the blended space without altering its values.\")\n else\n cloned_load_def = load_def.clone(model).to_PeopleDefinition.get\n orig_design_level = cloned_load_def.numberofPeople.get\n cloned_load_def.setPeopleperSpaceFloorArea(eff_num_spaces * orig_design_level / collection_floor_area)\n cloned_load_def.setName(\"#{cloned_load_def.name} - pre-normalized value was #{orig_design_level.round} people.\")\n load_inst.setPeopleDefinition(cloned_load_def)\n end\n elsif load_def.peopleperSpaceFloorArea.is_initialized\n load_inst.setMultiplier(load_inst.multiplier * floor_area_ratio)\n elsif load_def.spaceFloorAreaperPerson.is_initialized\n load_inst.setMultiplier(load_inst.multiplier * floor_area_ratio)\n else\n runner.registerError(\"Unexpected value type for #{load_def.name}\")\n return false\n end\n load_inst.setSpaceType(target_space_type)\n instances_array << load_inst\n end\n\n # lights\n source_space_or_space_type.lights.each do |load_inst|\n load_def = load_inst.definition.to_LightsDefinition.get\n if load_def.lightingLevel.is_initialized\n # edit and assign a clone of definition and normalize per area based on floor area ratio\n if collection_floor_area == 0\n runner.registerWarning(\"Can't determine building floor area to normalize #{load_def}. #{load_inst} will be asigned the the blended space without altering its values.\")\n else\n cloned_load_def = load_def.clone(model).to_LightsDefinition.get\n orig_design_level = cloned_load_def.lightingLevel.get\n cloned_load_def.setWattsperSpaceFloorArea(eff_num_spaces * orig_design_level / collection_floor_area)\n cloned_load_def.setName(\"#{cloned_load_def.name} - pre-normalized value was #{orig_design_level.round} W.\")\n load_inst.setLightsDefinition(cloned_load_def)\n end\n elsif load_def.wattsperSpaceFloorArea.is_initialized\n load_inst.setMultiplier(load_inst.multiplier * floor_area_ratio)\n elsif load_def.wattsperPerson.is_initialized\n if num_people_ratio.nil?\n runner.registerError(\"#{load_def} has value defined per person, but people ratio wasn't passed in\")\n return false\n else\n load_inst.setMultiplier(load_inst.multiplier * num_people_ratio)\n end\n else\n runner.registerError(\"Unexpected value type for #{load_def.name}\")\n return false\n end\n load_inst.setSpaceType(target_space_type)\n instances_array << load_inst\n end\n\n # luminaires\n source_space_or_space_type.luminaires.each do |load_inst|\n # TODO: - can't normalize luminaire. Replace it with similar normalized lights def and instance\n runner.registerWarning(\"Can't area normalize luminaire. Instance will be applied to every space using the blended space type\")\n instances_array << load_inst\n end\n\n # electric_equipment\n source_space_or_space_type.electricEquipment.each do |load_inst|\n load_def = load_inst.definition.to_ElectricEquipmentDefinition.get\n if load_def.designLevel.is_initialized\n # edit and assign a clone of definition and normalize per area based on floor area ratio\n if collection_floor_area == 0\n runner.registerWarning(\"Can't determine building floor area to normalize #{load_def}. #{load_inst} will be asigned the the blended space without altering its values.\")\n else\n cloned_load_def = load_def.clone(model).to_ElectricEquipmentDefinition.get\n orig_design_level = cloned_load_def.designLevel.get\n cloned_load_def.setWattsperSpaceFloorArea(eff_num_spaces * orig_design_level / collection_floor_area)\n cloned_load_def.setName(\"#{cloned_load_def.name} - pre-normalized value was #{orig_design_level.round} W.\")\n load_inst.setElectricEquipmentDefinition(cloned_load_def)\n end\n elsif load_def.wattsperSpaceFloorArea.is_initialized\n load_inst.setMultiplier(load_inst.multiplier * floor_area_ratio)\n elsif load_def.wattsperPerson.is_initialized\n if num_people_ratio.nil?\n runner.registerError(\"#{load_def} has value defined per person, but people ratio wasn't passed in\")\n return false\n else\n load_inst.setMultiplier(load_inst.multiplier * num_people_ratio)\n end\n else\n runner.registerError(\"Unexpected value type for #{load_def.name}\")\n return false\n end\n load_inst.setSpaceType(target_space_type)\n instances_array << load_inst\n end\n\n # gas_equipment\n source_space_or_space_type.gasEquipment.each do |load_inst|\n load_def = load_inst.definition.to_GasEquipmentDefinition.get\n if load_def.designLevel.is_initialized\n # edit and assign a clone of definition and normalize per area based on floor area ratio\n if collection_floor_area == 0\n runner.registerWarning(\"Can't determine building floor area to normalize #{load_def}. #{load_inst} will be asigned the the blended space without altering its values.\")\n else\n cloned_load_def = load_def.clone(model).to_GasEquipmentDefinition.get\n orig_design_level = cloned_load_def.designLevel.get\n cloned_load_def.setWattsperSpaceFloorArea(eff_num_spaces * orig_design_level / collection_floor_area)\n cloned_load_def.setName(\"#{cloned_load_def.name} - pre-normalized value was #{orig_design_level.round} W.\")\n load_inst.setGasEquipmentDefinition(cloned_load_def)\n end\n elsif load_def.wattsperSpaceFloorArea.is_initialized\n load_inst.setMultiplier(load_inst.multiplier * floor_area_ratio)\n elsif load_def.wattsperPerson.is_initialized\n if num_people_ratio.nil?\n runner.registerError(\"#{load_def} has value defined per person, but people ratio wasn't passed in\")\n return false\n else\n load_inst.setMultiplier(load_inst.multiplier * num_people_ratio)\n end\n else\n runner.registerError(\"Unexpected value type for #{load_def.name}\")\n return false\n end\n load_inst.setSpaceType(target_space_type)\n instances_array << load_inst\n end\n\n # hot_water_equipment\n source_space_or_space_type.hotWaterEquipment.each do |load_inst|\n load_def = load_inst.definition.to_HotWaterDefinition.get\n if load_def.designLevel.is_initialized\n # edit and assign a clone of definition and normalize per area based on floor area ratio\n if collection_floor_area == 0\n runner.registerWarning(\"Can't determine building floor area to normalize #{load_def}. #{load_inst} will be asigned the the blended space without altering its values.\")\n else\n cloned_load_def = load_def.clone(model).to_HotWaterEquipmentDefinition.get\n orig_design_level = cloned_load_def.designLevel.get\n cloned_load_def.setWattsperSpaceFloorArea(eff_num_spaces * orig_design_level / collection_floor_area)\n cloned_load_def.setName(\"#{cloned_load_def.name} - pre-normalized value was #{orig_design_level.round} W.\")\n load_inst.setHotWaterEquipmentDefinition(cloned_load_def)\n end\n elsif load_def.wattsperSpaceFloorArea.is_initialized\n load_inst.setMultiplier(load_inst.multiplier * floor_area_ratio)\n elsif load_def.wattsperPerson.is_initialized\n if num_people_ratio.nil?\n runner.registerError(\"#{load_def} has value defined per person, but people ratio wasn't passed in\")\n return false\n else\n load_inst.setMultiplier(load_inst.multiplier * num_people_ratio)\n end\n else\n runner.registerError(\"Unexpected value type for #{load_def.name}\")\n return false\n end\n load_inst.setSpaceType(target_space_type)\n instances_array << load_inst\n end\n\n # steam_equipment\n source_space_or_space_type.steamEquipment.each do |load_inst|\n load_def = load_inst.definition.to_SteamDefinition.get\n if load_def.designLevel.is_initialized\n # edit and assign a clone of definition and normalize per area based on floor area ratio\n if collection_floor_area == 0\n runner.registerWarning(\"Can't determine building floor area to normalize #{load_def}. #{load_inst} will be asigned the the blended space without altering its values.\")\n else\n cloned_load_def = load_def.clone(model).to_SteamEquipmentDefinition.get\n orig_design_level = cloned_load_def.designLevel.get\n cloned_load_def.setWattsperSpaceFloorArea(eff_num_spaces * orig_design_level / collection_floor_area)\n cloned_load_def.setName(\"#{cloned_load_def.name} - pre-normalized value was #{orig_design_level.round} W.\")\n load_inst.setSteamEquipmentDefinition(cloned_load_def)\n end\n elsif load_def.wattsperSpaceFloorArea.is_initialized\n load_inst.setMultiplier(load_inst.multiplier * floor_area_ratio)\n elsif load_def.wattsperPerson.is_initialized\n if num_people_ratio.nil?\n runner.registerError(\"#{load_def} has value defined per person, but people ratio wasn't passed in\")\n return false\n else\n load_inst.setMultiplier(load_inst.multiplier * num_people_ratio)\n end\n else\n runner.registerError(\"Unexpected value type for #{load_def.name}\")\n return false\n end\n load_inst.setSpaceType(target_space_type)\n instances_array << load_inst\n end\n\n # other_equipment\n source_space_or_space_type.otherEquipment.each do |load_inst|\n load_def = load_inst.definition.to_OtherDefinition.get\n if load_def.designLevel.is_initialized\n # edit and assign a clone of definition and normalize per area based on floor area ratio\n if collection_floor_area == 0\n runner.registerWarning(\"Can't determine building floor area to normalize #{load_def}. #{load_inst} will be asigned the the blended space without altering its values.\")\n else\n cloned_load_def = load_def.clone(model).to_OtherEquipmentDefinition.get\n orig_design_level = cloned_load_def.designLevel.get\n cloned_load_def.setWattsperSpaceFloorArea(eff_num_spaces * orig_design_level / collection_floor_area)\n cloned_load_def.setName(\"#{cloned_load_def.name} - pre-normalized value was #{orig_design_level.round} W.\")\n load_inst.setOtherEquipmentDefinition(cloned_load_def)\n end\n elsif load_def.wattsperSpaceFloorArea.is_initialized\n load_inst.setMultiplier(load_inst.multiplier * floor_area_ratio)\n elsif load_def.wattsperPerson.is_initialized\n if num_people_ratio.nil?\n runner.registerError(\"#{load_def} has value defined per person, but people ratio wasn't passed in\")\n return false\n else\n load_inst.setMultiplier(load_inst.multiplier * num_people_ratio)\n end\n else\n runner.registerError(\"Unexpected value type for #{load_def.name}\")\n return false\n end\n load_inst.setSpaceType(target_space_type)\n instances_array << load_inst\n end\n\n # space_infiltration_design_flow_rates\n source_space_or_space_type.spaceInfiltrationDesignFlowRates.each do |load_inst|\n if load_inst.designFlowRateCalculationMethod == 'Flow/Space'\n # edit load so normalized for building area\n if collection_floor_area == 0\n runner.registerWarning(\"Can't determine building floor area to normalize #{load_def}. #{load_inst} will be asigned the the blended space without altering its values.\")\n else\n orig_design_level = load_inst.designFlowRate.get\n load_inst.setFlowperSpaceFloorArea(eff_num_spaces * orig_design_level / collection_floor_area)\n load_inst.setName(\"#{load_inst.name} - pre-normalized value was #{orig_design_level} m^3/sec\")\n end\n elsif load_inst.designFlowRateCalculationMethod == 'Flow/Area'\n load_inst.setFlowperSpaceFloorArea(load_inst.flowperSpaceFloorArea.get * floor_area_ratio)\n elsif load_inst.designFlowRateCalculationMethod == 'Flow/ExteriorArea'\n load_inst.setFlowperExteriorSurfaceArea(load_inst.flowperExteriorSurfaceArea.get * ext_surface_area_ratio)\n elsif load_inst.designFlowRateCalculationMethod == 'Flow/ExteriorWallArea'\n load_inst.setFlowperExteriorWallArea(load_inst.flowperExteriorWallArea.get * ext_wall_area_ratio)\n elsif load_inst.designFlowRateCalculationMethod == 'AirChanges/Hour'\n load_inst.setAirChangesperHour (load_inst.airChangesperHour.get * volume_ratio)\n else\n runner.registerError(\"Unexpected value type for #{load_inst.name}\")\n return false\n end\n load_inst.setSpaceType(target_space_type)\n instances_array << load_inst\n end\n\n # space_infiltration_effective_leakage_areas\n source_space_or_space_type.spaceInfiltrationEffectiveLeakageAreas.each do |load|\n # TODO: - can't normalize space_infiltration_effective_leakage_areas. Come up with logic to address this\n runner.registerWarning(\"Can't area normalize space_infiltration_effective_leakage_areas. It will be applied to every space using the blended space type\")\n load.setSpaceType(target_space_type)\n instances_array << load\n end\n\n # add OA object if it doesn't already exist\n if target_space_type.designSpecificationOutdoorAir.is_initialized\n blended_oa = target_space_type.designSpecificationOutdoorAir.get\n else\n blended_oa = OpenStudio::Model::DesignSpecificationOutdoorAir.new(model)\n blended_oa.setName('Blended OA')\n blended_oa.setOutdoorAirMethod('Sum')\n target_space_type.setDesignSpecificationOutdoorAir(blended_oa)\n instances_array << blended_oa\n end\n\n # update OA object\n if source_space_or_space_type.designSpecificationOutdoorAir.is_initialized\n oa = source_space_or_space_type.designSpecificationOutdoorAir.get\n oa_sch = nil\n if oa.outdoorAirFlowRateFractionSchedule.is_initialized\n # TODO: - improve logic to address multiple schedules\n runner.registerWarning(\"Schedule #{oa.outdoorAirFlowRateFractionSchedule.get.name} assigned to #{oa.name} will be ignored. New OA object will not have a schedule assigned\")\n end\n if oa.outdoorAirMethod == 'Maximum'\n # TODO: - see if way to address this by pre-calculating the max and only entering that value for space type\n runner.registerWarning(\"Outdoor air method of Maximum will be ignored for #{oa.name}. New OA object will have outdoor air method of Sum.\")\n end\n # adjusted ratios for oa (lowered for space type if there is hard assigned oa load for one or more spaces)\n oa_floor_area_ratio = floor_area_ratio\n oa_num_people_ratio = num_people_ratio\n if source_space_or_space_type.class.to_s == 'OpenStudio::Model::SpaceType'\n source_space_or_space_type.spaces.each do |space|\n if !space.isDesignSpecificationOutdoorAirDefaulted\n if space_hash.nil?\n runner.registerWarning('No space_hash passed in and model has OA designed at space level.')\n else\n oa_floor_area_ratio -= space_hash[space][:floor_area_ratio]\n oa_num_people_ratio -= space_hash[space][:num_people_ratio]\n end\n end\n end\n end\n # add to values of blended OA load\n if oa.outdoorAirFlowperPerson > 0\n blended_oa.setOutdoorAirFlowperPerson(blended_oa.outdoorAirFlowperPerson + oa.outdoorAirFlowperPerson * oa_num_people_ratio)\n end\n if oa.outdoorAirFlowperFloorArea > 0\n blended_oa.setOutdoorAirFlowperFloorArea(blended_oa.outdoorAirFlowperFloorArea + oa.outdoorAirFlowperFloorArea * oa_floor_area_ratio)\n end\n if oa.outdoorAirFlowRate > 0\n\n # calculate quantity for instance (doesn't exist as a method in api)\n if source_space_or_space_type.class.to_s == 'OpenStudio::Model::SpaceType'\n quantity = 0\n source_space_or_space_type.spaces.each do |space|\n if !space.isDesignSpecificationOutdoorAirDefaulted\n quantity += space.multiplier\n end\n end\n else\n quantity = source_space_or_space_type.multiplier\n end\n\n # can't normalize air flow rate, convert to air flow rate per floor area\n blended_oa.setOutdoorAirFlowperFloorArea(blended_oa.outdoorAirFlowperFloorArea + quantity * oa.outdoorAirFlowRate / collection_floor_area)\n end\n if oa.outdoorAirFlowAirChangesperHour > 0\n # floor area should be good approximation of area for multiplier\n blended_oa.setOutdoorAirFlowAirChangesperHour(blended_oa.outdoorAirFlowAirChangesperHour + oa.outdoorAirFlowAirChangesperHour * oa_floor_area_ratio)\n end\n end\n\n # note: water_use_equipment can't be assigned to a space type. Leave it as is, if assigned to space type\n # todo - if we use this measure with new geometry need to find a way to pull water use equipment loads into new model\n\n return instances_array\n end", "title": "" }, { "docid": "03e46c65b9475eb1178a67af1e5f3907", "score": "0.45468664", "text": "def load_stats\n[\n {\n home_team: \"Jets\",\n away_team: \"Giants\",\n home_score: 21,\n away_score: 3\n },\n {\n home_team: \"Steelers\",\n away_team: \"Giants\",\n home_score: 21,\n away_score: 3\n },\n {\n home_team: \"Patriots\",\n away_team: \"Giants\",\n home_score: 21,\n away_score: 3\n },\n {\n home_team: \"Chargers\",\n away_team: \"Jets\",\n home_score: 13,\n away_score: 6\n },\n {\n home_team: \"Patriots\",\n away_team: \"Jets\",\n home_score: 13,\n away_score: 6\n },\n {\n home_team: \"Steelers\",\n away_team: \"Jets\",\n home_score: 3,\n away_score: 6\n },\n {\n home_team: \"Dolphins\",\n away_team: \"Jets\",\n home_score: 0,\n away_score: 3\n },\n{\n home_team: \"Browns\",\n away_team: \"Jets\",\n home_score: 0,\n away_score: 21\n },\n {\n home_team: \"Chargers\",\n away_team: \"Jets\",\n home_score: 7,\n away_score: 21\n },\n {\n home_team: \"Steelers\",\n away_team: \"Broncos\",\n home_score: 7,\n away_score: 13\n },\n {\n home_team: \"Patriots\",\n away_team: \"Broncos\",\n home_score: 7,\n away_score: 3\n },\n {\n home_team: \"Broncos\",\n away_team: \"Colts\",\n home_score: 3,\n away_score: 0\n },\n {\n home_team: \"Patriots\",\n away_team: \"Colts\",\n home_score: 11,\n away_score: 7\n },\n {\n home_team: \"Steelers\",\n away_team: \"Patriots\",\n home_score: 7,\n away_score: 21\n },\n {\n home_team: \"Steelers\",\n away_team: \"Colts\",\n home_score: 24,\n away_score: 21\n },\n {\n home_team: \"Steelers\",\n away_team: \"Colts\",\n home_score: 24,\n away_score: 21\n }\n]\nend", "title": "" }, { "docid": "6b7681edf4124442482236344607194f", "score": "0.45396456", "text": "def calculate!\n ov = self[:overall]\n ov[:high_night] = {}\n ov[:winners] = {}\n\n self.each do |player_id, st|\n next if player_id == :overall\n\n ## calculate computed stats for player\n st[:nights] += st[:dates].keys.length # if st[:nights] == 0\n st[:high_night] = st[:dates].values.max\n st[:gold_stars] = 1 if st[:nights] == 29\n st[:warps_per_game] = 1.0 * st[:warps] / st[:games] rescue 0\n st[:warps_per_night] = 1.0 * st[:warps] / st[:nights] rescue 0\n st[:games_per_night] = 1.0 * st[:games] / st[:nights] rescue 0\n st[:wins_per_night] = 1.0 * st[:wins] / st[:nights] rescue 0\n st[:wins_per_game] = 1.0 * st[:wins] / st[:games] rescue 0\n\n ## accumulate overall stats\n [:warps, :wins, :cfbs,\n :mystery_factors, :gold_stars]. each do |field|\n ov[field] += st[field]\n end\n [:wimps, :come_ons].each do |field|\n if st[field]\n ov[field] ||= 0\n ov[field] += st[field]\n end\n end\n # nights won calculation\n st[:dates].each do |date,warps|\n ov[:dates][date] += warps\n hnd = ov[:high_night][date] ||= {:players => [], :warps => 0}\n if hnd[:warps] < warps\n hnd[:players] = [player_id]\n hnd[:warps] = warps\n elsif hnd[:warps] == warps\n hnd[:players].push(player_id)\n end\n end\n end\n\n ## update overall computed stats\n st = self[:overall]\n ov[:games] = ov[:wins]\n ov[:nights] = ov[:dates].keys.length\n ov[:nights] = 29 if ov[:nights] == 0 ## provide sane default\n ov[:nights] = ov[:nights_real] if ov[:nights_real]\n ov[:warps_per_game] = 1.0 * ov[:warps] / ov[:games] rescue 0\n ov[:warps_per_night] = 1.0 * ov[:warps] / ov[:nights] rescue 0\n ov[:games_per_night] = 1.0 * ov[:games] / ov[:nights] rescue 0\n ov[:high_night].each do |date,h|\n h[:players].each {|p| self[p][:nights_won] += 1}\n end\n\n ## determine per-stat winners\n # fuck everyone but the top 50 OR those with 50+ warps\n # the 51 below is not a bug\n sorted_players = self.keys.sort{|a,b| self[b][:warps] <=> self[a][:warps]}\n fifty_plus = self.keys.select{|p| self[p][:warps] >= 50}\n eligible = (sorted_players[0..51] | fifty_plus).\n inject(Hash.new(false)) {|acc,p| acc.merge(p => true)}\n [:warps, :games, :nights, :wins, :nights_won, :cfbs,\n :come_ons, :wimps, :warps_per_game, :warps_per_night,\n :games_per_night, :wins_per_game, :high_night].each do |field|\n owf = ov[:winners][field] = {:players => [], :value => 0}\n self.each do |player, st|\n next if player == :overall\n next unless eligible[player]\n if st[field].to_f > owf[:value]\n owf[:players] = [player]\n owf[:value] = st[field]\n elsif st[field] == owf[:value]\n owf[:players].push(player)\n end\n end\n end\n\n ## mark per-stat winners\n ov[:winners].each do |field, win|\n win[:players].each do |player|\n self[player][:winner][field] = true\n end\n end\n\n self\n end", "title": "" }, { "docid": "9da33f4c7892ae2924ae4cd96e93b4af", "score": "0.45361358", "text": "def parse_game team\n parsed_team = team.rpartition(' ')\n\n name = parsed_team.first\n score = parsed_team.last.to_i\n\n {\n name: name,\n score: score\n }\nend", "title": "" }, { "docid": "13619c263b458cf234b7701125669136", "score": "0.4534478", "text": "def getInts(pep)\n rt_helper = RetentionTime::Helper\n pep_id = pep[0]\n p_int = pep[7] + rt_helper.RandomFloat(-5,2)\n if p_int > 10\n p_int -= 10\n end\n predicted_int = (p_int * 10**-1) * 14183000.0 \n low = 0.1*predicted_int\n relative_ints = (@db.execute \"SELECT ints FROM core_spec WHERE pep_id=#{pep_id}\").flatten[0].gsub(/\\[/,\"\").split(/,/).map{|val| val.to_f}\n core_mzs = (@db.execute \"SELECT mzs FROM core_spec WHERE pep_id=#{pep_id}\").flatten[0].gsub(/\\[/,\"\").split(/,/).map{|val| val.to_f}\n avg = pep[5] #p_rt\n\n sampling_rate = @opts[:sampling_rate].to_f\n wobA = Distribution::Normal.rng(@opts[:wobA].to_f,0.0114199604).call #0.0014199604 is the standard deviation from Hek_cells_100904050914 file\n wobB = Distribution::Normal.rng(@opts[:wobB].to_f,0.01740082).call #1.20280082 is the standard deviation from Hek_cells_100904050914 file\n tail = Distribution::Normal.rng(@opts[:tail].to_f,0.018667495).call #0.258667495 is the standard deviation from Hek_cells_100904050914 file\n front = Distribution::Normal.rng(@opts[:front].to_f,0.01466692).call #4.83466692 is the standard deviation from Hek_cells_100904050914 file\n # These number didn't work. May need to get more samples or figure something else out. For now this will give us some\n # meta variance in any case\n mu = @opts[:mu].to_f\n\n index = 0\n sx = pep[9]\n sy = (sx**-1) * Math.sqrt(pep[8]) #abu\n\n shuff = rt_helper.RandomFloat(0.05,1.0)\n core_mzs.each_with_index do |mzmu,core_idx|\n\n relative_abundances_int = relative_ints[index]\n\n t_index = 1\n\n (Mspire::Simulator::Spectra::r_times[pep[10]..pep[11]]).each_with_index do |rt,i| \n\n\n if !@one_d\n #-------------Tailing-------------------------\n shape = (tail * (t_index / sx)) + front\n int = (rt_helper.gaussian((t_index / sx) ,mu ,shape,100.0))\n t_index += 1\n #---------------------------------------------\n\n else\n #-----------Random 1d data--------------------\n int = (relative_abundances_int * ints_factor) * shuff\n #---------------------------------------------\n end\n\n if int < 0.01\n int = rt_helper.RandomFloat(0.001,0.4)\n end\n\n=begin\n if !@one_d\n #-------------M/Z Peak shape (Profile?)-------\n fraction = rt_helper.gaussian(fin_mzs[i],mzmu,0.05,1)\n factor = fraction/1.0\n fin_ints[i] = fin_ints[i] * factor\n #---------------------------------------------\n end\n=end\t \n\n if int > 0.4\n #-------------Jagged-ness---------------------\n sd = (@opts[:jagA] * (1-Math.exp(-(@opts[:jagC]) * int)) + @opts[:jagB])/2\n diff = (Distribution::Normal.rng(0,sd).call)\n int += diff\n #---------------------------------------------\n end\n\n #-------------mz wobble-----------------------\n wobble_mz = nil\n if int > 0\n wobble_int = wobA*int**wobB\n wobble_mz = Distribution::Normal.rng(mzmu,wobble_int).call\n if wobble_mz < 0\n wobble_mz = 0.01\n end\n end\n #---------------------------------------------\n\n\n int = int*(predicted_int*(relative_abundances_int*10**-2)) * sy\n if int > low.abs and wobble_mz > 0\n @db.execute \"INSERT INTO spectra VALUES(#{@cent_id},#{pep_id},#{rt},#{wobble_mz},#{int},NULL,#{core_idx})\"\n# @db.execute \"INSERT INTO spectra VALUES(#{@cent_id},#{pep_id},#{rt},#{wobble_mz},#{int},NULL)\"\n @cent_id += 1\n if @max_mz < wobble_mz\n @max_mz = wobble_mz\n end\n end\n end\n index += 1\n end\n end", "title": "" }, { "docid": "35ff0a42531463f767355ec43edf01d6", "score": "0.45344168", "text": "def analyze_benchmarks(benches, runs, mode)\n # Build table for energy consumed for each run\n front_path = \"\"\n front_dat = \"\"\n device = \"\"\n dir = \"\"\n case mode\n when :intel_mode\n front_path = \".\"\n front_dat = \"./dat\"\n device = \"Intel\"\n dir = \"adapt_run\"\n when :pi_mode\n front_path = \"./pi_bench\"\n front_dat = \"./pi_dat\"\n device = \"Pi\"\n dir = \"badapt_run\"\n when :droid_mode\n front_path = \"./android_bench\"\n front_dat = \"./droid_dat\"\n device = \"Droid\"\n dir = \"badapt_run\"\n end \n\n consumedtable = {}\n normaltable = {}\n benches.each do |bench, path|\n energy = []\n nenergy = []\n maxe = 0.0\n drop_first = false\n num_runs = 0\n\n runs.each do |run| \n m = File.open(\"./#{front_path}/#{path}/#{dir}/#{run}.txt\").read().scan(/^(?!\\/\\/)ERun.*:(.*)$/)\n e = 0.0\n\n case mode\n when :intel_mode\n drop_first = true\n num_runs = m.length-1\n when :pi_mode\n drop_first = true\n num_runs = m.length-1\n when :droid_mode\n drop_first=false\n front_path = \"./android_bench\"\n num_runs = m.length\n end \n\n for i in 0..m.length-1 do\n next if i == 0 && drop_first\n\n e += m[i][0].strip().split()[2].to_f\n end\n e = e / num_runs.to_f\n maxe = e unless maxe > e \n energy << e\n end\n nenergy = energy.map { |n| n / maxe }\n normalize = energy[6]\n\n nenergy = energy.map { |n| n / normalize }\n consumedtable[bench] = energy\n normaltable[bench] = nenergy\n end\n\n # Dump tables for gnuplot\n consumeddat = File.open(\"#{front_dat}/badapt_consumed.dat\", \"w+\")\n\n #consumeddat.write(\"xcord\\tbench\\tdata\\tenergy_saver\\tmanaged\\tfull_throttle\\tlow_percent_saved\\tmid_percent_saved\\n\")\n consumeddat.write(\"xcord\\tbench\\tdata\\tenergy_saver\\tmanaged\\tlow_percent_saved\\tmid_percent_saved\\n\")\n\n k = 0\n benches.each do |bench, path|\n #for i in 0..2 do\n\n #for j in (((i+1)*3)-1).downto(i*3) do\n # consumeddat.write(\"\\t#{normaltable[bench][j]}\")\n #end\n\n #top = (((i+1)*3)-1)\n \n saver = (((consumedtable[bench][6]-consumedtable[bench][8]) / consumedtable[bench][6]) * 100.0).round(2)\n managed = (((consumedtable[bench][6]-consumedtable[bench][7]) / consumedtable[bench][6]) * 100.0).round(2)\n\n xcord = 0*$LITTLEGAP+k*$LARGEGAP\n consumeddat.write(\"#{xcord}\\t#{bench}\\t#{$DATAS[2]}\\t#{normaltable[bench][8]}\\t0\\t#{saver}\\t\\\"\\\"\\n\")\n xcord = 1*$LITTLEGAP+k*$LARGEGAP\n consumeddat.write(\"#{xcord}\\t#{bench}\\t#{$DATAS[2]}\\t0\\t#{normaltable[bench][7]}\\t\\\"\\\"\\t#{managed}\\n\")\n\n k += 1\n end\n\n #k = 0\n #benches.each do |bench, path|\n # for i in 0..2 do\n # xcord = i*$LITTLEGAP+k*$LARGEGAP\n # consumeddat.write(\"#{xcord}\\t#{bench}\\t#{$DATAS[i]}\")\n # for j in (((i+1)*3)-1).downto(i*3) do\n # consumeddat.write(\"\\t#{normaltable[bench][j]}\")\n # end\n#\n# top = (((i+1)*3)-1)\n# \n# saver = (((consumedtable[bench][top-2]-consumedtable[bench][top]) / consumedtable[bench][top-2]) * 100.0).round(2)\n# managed = (((consumedtable[bench][top-2]-consumedtable[bench][top-1]) / consumedtable[bench][top-2]) * 100.0).round(2)\n#\n# #if (managed-saver).abs <= 2.0 \n# # consumeddat.write(\"\\t#{saver}\\t\")\n# #else\n# consumeddat.write(\"\\t#{saver}\\t#{managed}\")\n# #end\n#\n# consumeddat.write(\"\\n\")\n# end\n# k += 1\n# end\n\n consumeddat.close\n\n puts \"\\\\hline\"\n puts \"\\\\textbf{name} & \\\\textbf{workload} & \\\\textbf{full boot (J)} & \\\\textbf{managed boot saved (J)} & \\\\textbf{managed boot saved (\\\\%)} & \\\\textbf{saver boot saved (J)} & \\\\textbf{saver boot saved (\\\\%)} \\\\\\\\\"\n\n # Dump energy consumed diff\n rows = []\n rowse = []\n benches.each do |bench, path|\n ld_ft_m = consumedtable[bench][6]-consumedtable[bench][7]\n ld_ft_me = (ld_ft_m / consumedtable[bench][6]) * 100.0\n\n ld_ft_es = consumedtable[bench][6]-consumedtable[bench][8]\n ld_ft_ese = (ld_ft_es / consumedtable[bench][6]) * 100.0\n\n md_ft_m = consumedtable[bench][3]-consumedtable[bench][4]\n md_ft_me = (md_ft_m / consumedtable[bench][3]) * 100.0\n\n md_ft_es = consumedtable[bench][3]-consumedtable[bench][5]\n md_ft_ese = (md_ft_es / consumedtable[bench][3]) * 100.0\n\n sd_ft_m = consumedtable[bench][0]-consumedtable[bench][1]\n sd_ft_me = (sd_ft_m / consumedtable[bench][0]) * 100.0\n\n sd_ft_es = consumedtable[bench][0]-consumedtable[bench][2]\n sd_ft_ese = (sd_ft_es / consumedtable[bench][0]) * 100.0\n\n rows << [bench, ld_ft_m.round(2), ld_ft_es.round(2), md_ft_m.round(2), md_ft_es.round(2), sd_ft_m.round(2), sd_ft_es.round(2)]\n rowse << [bench, ld_ft_me.round(2), ld_ft_ese.round(2), md_ft_me.round(2), md_ft_ese.round(2), sd_ft_me.round(2), sd_ft_ese.round(2)]\n\n puts \"\\\\hline\"\n puts \"#{bench} & full & #{consumedtable[bench][6].round(2)} & #{ld_ft_m.round(2)} & #{ld_ft_me.round(2)}\\\\% & #{ld_ft_es.round(2)} & #{ld_ft_ese.round(2)}\\\\% \\\\\\\\\"\n\n puts \"\\\\hline\"\n puts \"#{bench} & managed & #{consumedtable[bench][3].round(2)} & #{md_ft_m.round(2)} & #{md_ft_me.round(2)}\\\\% & #{md_ft_es.round(2)} & #{md_ft_ese.round(2)}\\\\% \\\\\\\\\"\n\n puts \"\\\\hline\" \n puts \"#{bench} & saver & #{consumedtable[bench][0].round(2)} & #{sd_ft_m.round(2)} & #{sd_ft_me.round(2)}\\\\% & #{sd_ft_es.round(2)} & #{sd_ft_ese.round(2)}\\\\% \\\\\\\\\"\n\n rows << :separator\n rowse << :separator\n end\n \n puts \"\\\\hline\"\n\n puts Terminal::Table.new :title => \"#{device} Raw Difference\", \n :headings => [\"Bench\", \"ld:full-managed\", \"ld:full-saver\", \"md:full-managed\", \"md:full-saver\", \"sd:full-managed\", \"sd:full-saver\"], \n :rows => rows\n\n puts Terminal::Table.new :title => \"#{device} Percent Error (Against full-throttle)\", \n :headings => [\"Bench\", \"ld:full-managed\", \"ld:full-saver\", \"md:full-managed\", \"md:full-saver\", \"sd:full-managed\", \"sd:full-saver\"], \n :rows => rowse\n\n return consumedtable\nend", "title": "" }, { "docid": "93ca9c464829bf15741ad99f40acaa1b", "score": "0.45327744", "text": "def run_extraction\n\n run_on_all_extractors(@score_card.price) { |e| \n result = e.extract_stock_price()\n @score_card.price = result['price']\n @score_card.currency = result['currency']\n }\n \n run_on_all_extractors(@score_card.return_on_equity) { |e|\n e.extract_roe(@score_card.return_on_equity)\n }\n\n run_on_all_extractors(@score_card.ebit_margin) { |e|\n e.extract_ebit_margin(@score_card.ebit_margin, @score_card.share.financial)\n }\n \n run_on_all_extractors(@score_card.equity_ratio) { |e|\n e.extract_equity_ratio(@score_card.equity_ratio)\n }\n\n run_on_all_extractors(@score_card.current_price_earnings_ratio) { |e|\n e.extract_current_price_earnings_ratio(@score_card.current_price_earnings_ratio)\n }\n\n run_on_all_extractors(@score_card.average_price_earnings_ratio) { |e|\n e.extract_average_price_earnings_ratio(@score_card.average_price_earnings_ratio)\n }\n\n run_on_all_extractors(@score_card.analysts_opinion) { |e|\n e.extract_analysts_opinion(@score_card.analysts_opinion)\n }\n\n run_on_all_extractors(@score_card.reaction) { |e|\n e.extract_reaction_on_figures(@score_card.reaction)\n }\n\n run_on_all_extractors(@score_card.profit_revision) { |e|\n e.extract_profit_revision(@score_card.profit_revision)\n }\n\n run_on_all_extractors(@score_card.stock_price_dev_half_year) { |e|\n e.extract_stock_price_dev_half_year(@score_card.stock_price_dev_half_year)\n }\n \n run_on_all_extractors(@score_card.stock_price_dev_one_year) { |e|\n e.extract_stock_price_dev_one_year(@score_card.stock_price_dev_one_year)\n }\n\n run_on_all_extractors(@score_card.reversal) { |e|\n e.extract_three_month_reversal(@score_card.reversal)\n }\n\n run_on_all_extractors(@score_card.profit_growth) { |e|\n e.extract_profit_growth(@score_card.profit_growth)\n }\n\n run_on_all_extractors(@score_card.insider_info) { |e|\n e.extract_insider_deals(@score_card.insider_info)\n }\n\n end", "title": "" }, { "docid": "2cdf44c6d89e7154686078a12a12ac56", "score": "0.4532497", "text": "def apply_elo_ratings\n raise \"Cannot apply an unfinished game\" unless finished?\n\n p1 = {\n rating: player1.elo_rating,\n games: player1.all_finished_1v1_games.select { |g| g.finished_at <= finished_at }.count,\n score: score1\n }\n\n p2 = {\n rating: player2.elo_rating,\n games: player2.all_finished_1v1_games.select { |g| g.finished_at <= finished_at }.count,\n score: score2\n }\n\n\n # Record the state of player's Elo ratings for reporting, before and after this game\n self.elo_rating1_in = p1[:rating]\n self.elo_rating2_in = p2[:rating]\n\n game = EloGame.new(p1, p2)\n\n self.elo_rating1_out = player1.elo_rating = game.rating1_out\n self.elo_rating2_out = player2.elo_rating = game.rating2_out\n\n player1.save!\n player2.save!\n save!\n nil\n end", "title": "" }, { "docid": "564cf47acc165bcd2900dbeaca7d6236", "score": "0.4528896", "text": "def parse_rsssf_tables(text, tier=1)\n # Regex segment for a league position. Dot is optional as it's\n # missing in the 1994-95 file on the Premier League table, among\n # others.\n #\n place = '^ *([0-9]+)\\.?=? '\n\n return [nil, tier] unless /#{place}/ === text\n\n divisions = []\n info = []\n header = ['Caps', 'Pos', 'Team']\n table = []\n table_started = false\n\n # Add blank line to end to ensure that table can be added to\n # divisions array.\n #\n (text + \"\\n \").split(\"\\n\").each do |line|\n # Not part of a table.\n #\n unless /#{place}/ === line\n if !table_started\n if line.downcase.include?('pts')\n header += line.split\n else\n info << line.strip if line.strip.size > 0\n end\n else\n # Division 3 (North) and Division 3 (South) were at the same\n # level, but the north one is always listed first and so would\n # end up in a higher tier.\n #\n tier -= 1 if info.any? {|x| x.include?('(South)')}\n\n # Ignore 'non-tables' with information about play-offs, etc.\n #\n unless header.size == 3\n divisions << {\n :info => info,\n :header => header,\n :tier => tier,\n :table => table,\n }\n end\n\n table_started = false\n tier += 1\n\n info = []\n header = ['Caps', 'Pos', 'Team']\n table = []\n end\n\n next\n end\n\n table_started = true\n\n # +prefix+ is everything up to and including the first numerical\n # item (+stat+) after the team name - usually games played.\n #\n prefix, pos, team, stat = *line.match(/#{place}(.*?) +([0-9]+)/)\n\n caps = (team == team.upcase)\n stats = line.gsub(prefix, '').split.map {|x| x.to_i}\n\n table << [caps, pos.to_i, fix_team_name(team), stat.to_i] + stats\n end\n\n [divisions, tier]\nend", "title": "" }, { "docid": "bedaebe07f869af1c040ceb2c5ddb9e9", "score": "0.45226723", "text": "def flu_season\n event_display(\"It's flu season!\\n One player has been infected and needs some time to recuperate.\")\n {Game.last.players.sample.id.to_s =>\n {wellbeing: -100}\n }\n end", "title": "" }, { "docid": "0a7d2a306f5efbea09a9f73a643423a5", "score": "0.45175835", "text": "def wins_losses\n GAME_INFO.each do |game|\n @team_records.each do |team|\n if game[:home_team] == team.name && game[:home_score] > game[:away_score] #refactor later\n team.wins += 1\n elsif game[:home_team] == team.name && game[:home_score] < game[:away_score]\n team.losses += 1\n end\n end\n end\n\n GAME_INFO.each do |game|\n @team_records.each do |team|\n if game[:away_team] == team.name && game[:away_score] > game[:home_score] #refactor later\n team.wins += 1\n elsif game[:away_team] == team.name && game[:away_score] < game[:home_score]\n team.losses += 1\n end\n end\n end\n\n end", "title": "" }, { "docid": "671743afdf37ad48ba91bf76f61e786e", "score": "0.45167455", "text": "def eval h,o1,o2,s\n z = eval_speed(s)\n mismatches_in_horizon(h,o1,o2,s){|band| z += band.width}\n z\n end", "title": "" }, { "docid": "64f0f7ad7af4a9dc9d747674aa2ee3af", "score": "0.45165807", "text": "def test_total_split\n dinner = Checksplitter.new(20, 20, 4)\n \n assert_equal(dinner.total_split, (dinner.total_cost / dinner.number_of_people))\n end", "title": "" }, { "docid": "4bae410e006f72dfadd1d873aa8c1c13", "score": "0.45138723", "text": "def calc_plus_minus_stat(arrs)\n\n\t\t# Gets all the events\n\t\tall_stats = get_stats_rows_from_games\n\n\t\tif all_stats.nil?\n\t\t\treturn nil\n\t\tend\n\t\tall_combos = Set.new\n solutions = 1\n i = 0\n while i < arrs.length do\n \tsolutions *= arrs[i].length\n \ti += 1\n end\n while i < solutions do\n \tlist = Array.new\n \tj = 1\n \tarrs.each do |arr|\n \t\tlist << arr[(i / j) % arr.length]\n \t\tj *= arr.length\n \tend\n \tlist.sort!\n \ttestSet = list.to_set\n \tif (testSet.length == arrs.length)\n \t\tall_combos << list\n \tend\n \ti += 1\n end\n\n combo_stat_map = Hash.new\n\t\tcur_game = \"notAGame\"\n \ton_field_array = [\"chaserA\", \"chaserB\", \"chaserC\", \"keeper\", \"beaterA\", \"beaterB\", \"seeker\"]\n \t\n\t\tstart_time = -1\n\t\tstart_bludger_time = -1\n\t\thave_control = false\n\t\tsnitch_release_time = -1\n\n \tall_stats.each do |event|\n \t\tif event[\"vid_id\"] != cur_game\n \t\t\ton_field_array = [\"chaserA\", \"chaserB\", \"chaserC\", \"keeper\", \"beaterA\", \"beaterB\", \"seeker\"]\n \t\tend\n \t\tcur_game = event['vid_id']\n \t\tsorted_on_field_array = sort_on_field_array_by_position(on_field_array)\n \t\tshould_skip = should_skip_event(@sop, event[\"time\"], event[\"stat_name\"], snitch_release_time)\n \t\tcase event['stat_name']\n \t\twhen 'GOAL'\n \t\t\tif !should_skip\n\t \t\t\tall_combos.each do |combo|\n\t \t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, 1, 'GOAL', cur_game)\n\t \t\t\tend\n \t\t\tend\n \t\twhen 'AWAY_GOAL'\n \t\t\tif !should_skip\n\t \t\t\tall_combos.each do |combo|\n\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, 1, 'AWAY_GOAL', cur_game)\n\t \t\t\tend\n\t \t\tend\n\t\t\twhen 'GAIN_CONTROL'\n\t\t\t\thave_control = true\n\t\t\t\tstart_bludger_time = event['time']\n\t\t\t\tif !should_skip\n\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, 1, 'GAIN_CONTROL', cur_game)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\twhen 'LOSE_CONTROL'\n\t\t\t\tif start_bludger_time != -1\n\t\t\t\t\tbludger_time_to_add = event[\"time\"] - start_bludger_time\n\t\t\t\t\tif bludger_time_to_add != 0 && !should_skip\n\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, bludger_time_to_add, 'bludger_time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\thave_control = false\n\t\t\t\tstart_bludger_time = -1\n\t\t\t\t\n\t\t\t\tif !should_skip\n\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, 1, 'LOSE_CONTROL', cur_game)\n\t\t\t\t\tend\n\t\t\t\tend\n \t\twhen 'SUB'\n\t\t\t\tif start_time != -1\n\t\t\t\t\ttime_to_add = event[\"time\"] - start_time\n\t\t\t\t\tif time_to_add != 0 && !should_skip\n\t\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, time_to_add, 'time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tstart_time = event[\"time\"]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif start_bludger_time != -1\n\t\t\t\t\tbludger_time_to_add = event[\"time\"] - start_bludger_time\n\t\t\t\t\tif bludger_time_to_add != 0 && !should_skip\n\t\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, bludger_time_to_add, 'bludger_time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tstart_bludger_time = event[\"time\"]\n\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\tind = on_field_array.index(event['player_id'])\n\t\t\t\ton_field_array[ind] = event[\"player_in_id\"]\n\t\t\twhen 'SWAP'\n\t\t\t\tif start_time != -1\n\t\t\t\t\ttime_to_add = event[\"time\"] - start_time\n\t\t\t\t\tif time_to_add != 0 && !should_skip\n\t\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, time_to_add, 'time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tstart_time = event[\"time\"]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif start_bludger_time != -1\n\t\t\t\t\tbludger_time_to_add = event[\"time\"] - start_bludger_time\n\t\t\t\t\tif bludger_time_to_add != 0 && !should_skip\n\t\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, bludger_time_to_add, 'bludger_time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tstart_bludger_time = event[\"time\"]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tind = on_field_array.index(event['player_id'])\n\t\t\t\tind2 = on_field_array.index(event['player_in_id'])\n\t\t\t\ton_field_array[ind] = event[\"player_in_id\"]\n\t\t\t\ton_field_array[ind2] = event[\"player_id\"]\n\t\t\t\t\n \t\twhen 'PAUSE_CLOCK'\n\t\t\t\tif start_time != -1\n\t\t\t\t\ttime_to_add = event[\"time\"] - start_time\n\t\t\t\t\tif time_to_add != 0 && !should_skip\n\t\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, time_to_add, 'time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tstart_time = -1\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif start_bludger_time != -1\n\t\t\t\t\tbludger_time_to_add = event[\"time\"] - start_bludger_time\n\t\t\t\t\tif bludger_time_to_add != 0 && !should_skip\n\t\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, bludger_time_to_add, 'bludger_time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tstart_bludger_time = -1\n\t\t\t\tend\n \t\twhen 'START_CLOCK'\n \t\t\tstart_time = event[\"time\"]\n \t\t\tif have_control\n \t\t\t\tstart_bludger_time = event[\"time\"]\n \t\t\tend\n \t\twhen 'GAME_START'\n \t\t\tstart_time = event[\"time\"]\n \t\t\tif have_control\n \t\t\t\tstart_bludger_time = event[\"time\"]\n \t\t\tend\n\t\t\twhen 'SEEKERS_RELEASED'\n\t\t\t\tif start_time != -1\n\t\t\t\t\ttime_to_add = event[\"time\"] - start_time\n\t\t\t\t\tif time_to_add != 0 && !should_skip\n\t\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, time_to_add, 'time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tstart_time = event[\"time\"]\n\t\t\t\tend\n\t\t\t\tif start_bludger_time != -1\n\t\t\t\t\tbludger_time_to_add = event[\"time\"] - start_bludger_time\n\t\t\t\t\tif bludger_time_to_add != 0 && !should_skip\n\t\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, bludger_time_to_add, 'bludger_time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tstart_bludger_time = event[\"time\"]\n\t\t\t\tend\n\t\t\t\tsnitch_release_time = event[\"time\"]\n \t\twhen 'ZERO_BLUDGERS_FORCED'\n \t\t\tif !should_skip\n\t \t\t\tall_combos.each do |combo|\n\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, 1, 'ZERO_BLUDGERS_FORCED', cur_game)\n\t \t\t\tend\n\t \t\tend\n \t\twhen 'ZERO_BLUDGERS_GIVEN'\n \t\t\tif !should_skip\n\t \t\t\tall_combos.each do |combo|\n\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, 1, 'ZERO_BLUDGERS_GIVEN', cur_game)\n\t \t\t\tend\n\t \t\tend\n \t\twhen 'OFFENSE'\n \t\t\tif !should_skip && event[\"bludger_count\"] == 0\n \t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, 1, 'ZERO_BLUDGERS_FORCED', cur_game)\n\t\t\t\t\tend\n\t\t\t\tend\n \t\twhen 'DEFENSE'\n \t\t\tif !should_skip && event[\"bludger_count\"] == 0\n \t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, 1, 'ZERO_BLUDGERS_GIVEN', cur_game)\n\t\t\t\t\tend\n\t\t\t\tend\n\t \tend\n end\n\n # this loop takes the combos map, and prepares it\n # for displaying\n combo_stat_map_return = Hash.new\n combo_stat_map.each { |k, v|\n \tnew_key = []\n \t# loops through the keys values and puts\n \t# names to each id\n \tk.each { |id|\n \t\tplayer_index = @players.find_index { |item| \t\n\t\t\t\t\titem['objectId'] == id\n\t\t\t\t}\n\t\t\t\tif player_index.nil?\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\ton_field_array[player_index] = id\n \t\tif @players[player_index].nil?\n \t\t\tnew_key << '?'\n \t\telse\n \t\t\tnew_key << @players[player_index]['first_name'] + ' ' + @players[player_index]['last_name']\n \t\tend\n \t}\n \t# loop through the vals here, modding each one\n \tv.update(v) { |key1, val1|\n\t\t\t\tif key1 == :games_played\n \t\t\tval1 = v[key1].length\n\t\t\t\telse\n\t\t\t\t\tval1 = v[key1]\n\t\t\t\tend\n\n \t}\n\t\t\tif @per == 1 # per minute\n\t \tv.update(v) { |key1, val1|\n\t\t\t\t\tif key1 != :time && v[:time] != 0 && key1 != :ratio && key1 != :control_percent && key1 != :games_played\n\t \t\t\tval1 = val1.to_f / (v[:time].to_f / 60.0)\n\t\t\t\t\t\tval1.round(2)\n\t\t\t\t\telse\n\t\t\t\t\t\tval1 = v[key1]\n\t\t\t\t\tend\n\n\t \t}\n\t\t\telsif @per == 2 # per game\n\t\t\t\tv.update(v) { |key1, val1|\n\t\t\t\t\tif key1 != :games_played && key1 != :ratio && v[:games_played] != 0 && key1 != :control_percent\n\t\t\t\t\t\tval1 = val1.to_f / (v[:games_played].to_f)\n\t\t\t\t\t\tif key1 == :time\n\t\t\t\t\t\t\tval1.round(0)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tval1.round(2)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tval1 = v[key1]\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend\n\t\t\t\n \t# this is cheating, sort of\n \tprettyTime = Time.at(v[:time]).utc.strftime(\"%M:%S\")\n \tif v[:time] >= 0\n \t\t# v[:time] = prettyTime\n \t\tcombo_stat_map_return[new_key] = v\n \tend\n \t\t\n }\n combo_stat_map_return.to_a\n\tend", "title": "" }, { "docid": "787073de3c0dd7af089e40a833de02e1", "score": "0.45093745", "text": "def split_total_amount\n total=0\n reim_split_details.each do |split|\n next if split.marked_for_destruction?\n total+=split.percent_amount if split.percent_amount\n end\n total\n end", "title": "" }, { "docid": "75fa91271f3e09bf005eb66366e3cfee", "score": "0.45028374", "text": "def get_stages exec_trace\n ret_array = []\n lines = exec_trace.split /\\n/\n current_line = 0\n # Skip past preamble\n until lines[current_line] =~ /M@/\n current_line += 1\n end\n pattern = /M@(\\w+)/\n while current_line < lines.length\n if lines[current_line].match pattern\n command = lines[current_line].sub pattern, '\\1'\n case command\n when \"assign\"\n var = lines[current_line += 1]\n exp = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n f_store = lines[current_line += 1]\n f_heap = lines[current_line += 1]\n text = \"#{var} := #{exp}\"\n ret_array.push Stage.new i_heap, i_store, f_heap, f_store, text\n current_line += 1\n when \"new\"\n var = lines[current_line += 1]\n exp = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n f_store = lines[current_line += 1]\n f_heap = lines[current_line += 1]\n text = \"#{var} := new(#{exp})\"\n ret_array.push Stage.new i_heap, i_store, f_heap, f_store, text\n current_line += 1\n when \"dispose\"\n var = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n f_store = lines[current_line += 1]\n f_heap = lines[current_line += 1]\n text = \"free(#{var})\"\n ret_array.push Stage.new i_heap, i_store, f_heap, f_store, text\n current_line += 1\n when \"lookup\"\n var1 = lines[current_line += 1]\n var2 = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n f_store = lines[current_line += 1]\n f_heap = lines[current_line += 1]\n text = \"#{var1} := [#{var2}]\"\n ret_array.push Stage.new i_heap, i_store, f_heap, f_store, text\n current_line += 1\n when \"mutate\"\n var = lines[current_line += 1]\n exp = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n f_store = lines[current_line += 1]\n f_heap = lines[current_line += 1]\n text = \"[#{var}] := #{exp}\"\n ret_array.push Stage.new i_heap, i_store, f_heap, f_store, text\n current_line += 1\n when \"conditional\"\n bool = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n prog = lines[current_line += 1]\n text = \"if #{bool} (taking branch: #{prog})\"\n ret_array.push Stage.new i_heap, i_store, i_heap, i_store, text\n current_line += 1\n else\n raise \"command did not match\"\n end\n else\n raise \"line #{lines[current_line]} didn't match\"\n end\n end\n ret_array\nend", "title": "" }, { "docid": "0fe0071ccd29f99cebdcfe66252e5700", "score": "0.44990182", "text": "def split_simplify(deadline,volume)\n info { \"Spliting...\" }\n # The on set is a copy of self [F].\n on = self.simpler_clone\n on0 = Cover.new(*@variables)\n (0..(on.size/2-1)).each do |i|\n on0 << on[i].clone\n end\n on1 = Cover.new(*@variables)\n (((on.size)/2)..(on.size-1)).each do |i|\n on1 << on[i].clone\n end\n debug { \"on0=#{on0}\\n\" }\n debug { \"on1=#{on1}\\n\" }\n # Simplify each part independently\n inc_indent\n on0 = on0.simplify(deadline,volume)\n on1 = on1.simplify(deadline,volume)\n dec_indent\n # And merge the results for simplifying it globally.\n on = on0 + on1\n on.uniq!\n new_cost = cost(on)\n # if (new_cost >= @first_cost) then\n # info { \"Giving up with final cost=#{new_cost}\" }\n # # Probably not much possible optimization, end here.\n # result = self.clone\n # result.uniq!\n # return result\n # end\n # Try to go on but with a timer (set to 7 times the deadline since\n # there are 7 different steps in total).\n begin\n Timeout::timeout(7*deadline) {\n on = on.simplify(deadline,Float::INFINITY)\n }\n rescue Timeout::Error\n info do\n \"Time out for global optimization, ends here...\"\n end\n end\n info do\n \"Final cost: #{cost(on)} (with #{on.size} cubes)\"\n end\n return on\n end", "title": "" }, { "docid": "146b19a99a6aedc7526d53630edef0b3", "score": "0.44959322", "text": "def compare_ranking_lines(a, b)\n res = 0\n\n if a['points'] < b['points']\n res = 1\n\n elsif b['points'] < a['points']\n res = -1\n\n else\n a_won_games = a['3_points'] + a['2_points']\n b_won_games = b['3_points'] + b['2_points']\n\n if a_won_games < b_won_games\n res = 1\n\n elsif b_won_games < a_won_games\n res = -1\n\n else\n #tied in won games, look at ratio won sets/lost sets\n a_ratio = a['won_sets'].to_f / a['lost_sets']\n b_ratio = b['won_sets'].to_f / b['lost_sets']\n\n if a_ratio < b_ratio\n res = 1\n elsif b_ratio < a_ratio\n res = -1\n end\n end\n end\n\n return res\n end", "title": "" }, { "docid": "a6a308361e264cf2772cb86af918a25e", "score": "0.44952568", "text": "def compare\n results = []\n @sets.each do |set|\n results << interpret(set)\n end\n\n base = nil\n results.each do |res|\n if base.nil?\n base = res\n base[:slower] = 0\n else\n res[:slower] = ((res[:mean] / base[:mean]) * 100) - 100\n end\n end\n\n results\n end", "title": "" }, { "docid": "c6cf17f8ce1be631a00827619339ac18", "score": "0.44869488", "text": "def elo_delta(rating_a, score_a, rating_b, score_b,\n k_factor, win_weight, max_score)\n # elo math please never quiz me on this\n expected_a = 1 / (1 + 10**((rating_b - rating_a) / 800.to_f))\n expected_b = 1 / (1 + 10**((rating_a - rating_b) / 800.to_f))\n\n outcome_a = score_a / (score_a + score_b).to_f\n if outcome_a < 0.5\n # a won\n outcome_a **= win_weight\n outcome_b = 1 - outcome_a\n else\n # b won\n outcome_b = (1 - outcome_a)**win_weight\n outcome_a = 1 - outcome_b\n end\n\n # divide elo change to be smaller if it wasn't a full game to 10\n ratio = [score_a, score_b].max / max_score.to_f\n\n # calculate elo change\n delta_a = (k_factor * (outcome_a - expected_a) * ratio).round\n delta_b = (k_factor * (outcome_b - expected_b) * ratio).round\n [delta_a, delta_b]\nend", "title": "" }, { "docid": "8e57d6bfb6e11de076edb008c7dc99a4", "score": "0.4486843", "text": "def separate_tubes(outname, ops, test_str, stamp_columns)\n stop_cycles_tab = display_stop_cycles(outname, ops, stamp_columns)\n wells_tab = display_plate(outname, ops, stamp_columns)\n coll = ops.first.output(outname).collection # get collection item\n\n show do\n title \"Separate #{test_str} stripwell tubes\"\n note \"During the <b>#{REAL}</b> qPCR run, you will need to remove single wells when different cycles are reached, according to the following:\"\n table stop_cycles_tab\n check \"Get a scissors and carefully separate the wells of <b>#{coll}-#{test_str}</b>\"\n check \"Verify that the separated wells are in the correct order:\"\n table wells_tab\n end\n end", "title": "" }, { "docid": "ea354ac3acab30a3df080e1bd3ea63b6", "score": "0.4483209", "text": "def big_shoe_rebounds\n big_shoes = []\n max_shoe = []\n what_team = []\n game_hash.each do |location, team_color_player|\n team_color_player.each do |tcp, players|\n if tcp == :players\n players.each do |player, stat|\n stat.each do |statistic, actual|\n if statistic == :shoe\n max_shoe.push(actual)\n if max_shoe.max == actual\n big_shoes.push(player)\n what_team.push(location)\n end\n end\n end\n end\n end\n end\n end\n return game_hash[what_team.last][:players][big_shoes.last][:rebounds]\nend", "title": "" }, { "docid": "6dcea305e64dd08a5b03e8f673c1e9eb", "score": "0.44824716", "text": "def detect_segment_errors(segment, segment_start, segment_end) #collapse_start\n segment_length = segment.length\n averaged_segment = Array.new(segment_length)\n local_maxes = Array.new\n\n # Smooth the data by taking the averages\n for i in 0...segment_length\n if i == 0\n averaged_segment[i] = segment.slice(0,3).inject(:+).to_f / 3.0\n elsif i == 1\n averaged_segment[i] = segment.slice(0,4).inject(:+).to_f / 4.0\n elsif i == segment_length-1\n averaged_segment[i] = segment.slice(segment_length-3, 3).inject(:+).to_f / 3.0\n elsif i == segment_length-2\n averaged_segment[i] = segment.slice(segment_length-4, 4).inject(:+).to_f / 4.0\n else\n averaged_segment[i] = segment.slice(i-2, 4).inject(:+).to_f / 4.0\n end\n end\n\n # Find all the local maxes in the data, that can correspond to qrs segments or smaller local maxes\n j = 0\n while j < segment_length\n current = averaged_segment[j]\n local_max = true\n\n if (current - BASELINE_VALUE) > 20\n starting = [j-10, 0].max\n ending = [j+10, segment_length].min\n for k in starting...ending\n if averaged_segment[k] > current\n local_max = false\n break\n end\n end\n\n if local_max\n if (current - 512) > 250\n local_maxes.push({ index: j, type: 'qrs' })\n else\n local_maxes.push({ index: j, type: 'small' })\n end\n j += 10\n end\n end\n j += 1\n end\n\n distances = Array.new\n flutters = Array.new\n w = 0\n\n # Find the distances between qrs segments\n # Find the number of small local maxes in between qrs segments (corresponding to atrial flutters)\n while w < local_maxes.length - 1\n current = local_maxes[w]\n if current[:type] == 'qrs'\n idx = w+1\n counter = 0\n\n while idx < local_maxes.length\n if local_maxes[idx][:type] == 'qrs'\n distances.push({\n start: current[:index],\n stop: local_maxes[idx][:index],\n distance: local_maxes[idx][:index] - current[:index]\n })\n if counter >= 4\n flutters.push({\n start: current[:index],\n stop: local_maxes[idx][:index],\n distance: local_maxes[idx][:index] - current[:index]\n })\n end\n break;\n end\n\n counter += 1\n idx += 1\n end\n\n w = idx\n else\n w += 1\n end\n end\n\n max_distance = distances.present? ? distances.max_by { |obj| obj[:distance] }[:distance] : 0\n min_distance = distances.present? ? distances.min_by { |obj| obj[:distance] }[:distance] : 0\n long_distances = Array.new\n if max_distance - min_distance > 75\n long_distances = distances.select { |obj| obj[:distance] > max_distance-25 }\n long_distances = long_distances.reduce([]) do |memo, val|\n last = memo.last\n if last\n if last[:stop] == val[:start]\n last[:stop] = val[:stop]\n last[:distance] = last[:distance] + val[:distance]\n memo[-1] = last\n\n memo\n else\n memo.push(val)\n end\n else\n [val]\n end\n end\n end\n\n long_distances.each do |dist_obj|\n signal = segment.slice(dist_obj[:start], dist_obj[:distance])\n\n StreamAlert.create({\n signal: signal,\n start_time: Time.at(segment_start.to_f + dist_obj[:start]*MS_PER_SAMPLE/1000.0),\n end_time: Time.at(segment_start.to_f + dist_obj[:stop]*MS_PER_SAMPLE/1000.0),\n alert: 'Sinus Arrythmia',\n ecg_stream_id: self.id\n })\n end\n\n flutters.each do |flutter_obj|\n signal = segment.slice(flutter_obj[:start], flutter_obj[:distance])\n\n StreamAlert.create({\n signal: signal,\n start_time: Time.at(segment_start.to_f + flutter_obj[:start]*MS_PER_SAMPLE/1000.0),\n end_time: Time.at(segment_start.to_f + flutter_obj[:stop]*MS_PER_SAMPLE/1000.0),\n alert: 'Atrial Flutter',\n ecg_stream_id: self.id\n })\n end\n end", "title": "" } ]
b8e34771b4d44a279c2e5d59c32eb7ac
POST /person_interests POST /person_interests.json
[ { "docid": "31b2b40d639be572deba60c613ec4a55", "score": "0.7466398", "text": "def create\n @person_interest = PersonInterest.new(params[:person_interest])\n\n respond_to do |format|\n if @person_interest.save\n format.html { redirect_to @person_interest, notice: 'Person interest was successfully created.' }\n format.json { render json: @person_interest, status: :created, location: @person_interest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "ea118c1ba9ede7500485fad5f72f061e", "score": "0.72515744", "text": "def create\n @interest = Interest.new(params[:interest])\n \n respond_to do |format|\n if @interest.save\n format.json { render :json => @interest,\n :status => :created, :location => @interest }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d91af2ab35f661a978c54f40f8233804", "score": "0.72165966", "text": "def create\n @interests = Interests.new(params[:interests])\n @interests.person = @person\n\n respond_to do |format|\n if @interests.save\n flash[:notice] = 'Interests saved.'\n format.html { redirect_to(welcome_path(:id => @person)) }\n format.xml { render :xml => @interests, :status => :created, :location => @interests }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @interests.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2511e4e83cd6785c6f6342dbb17a6322", "score": "0.70331836", "text": "def create\n @interest = Interest.new(params[:interest])\n\n respond_to do |format|\n if @interest.save\n format.html { redirect_to @interest, :notice => 'Interest was successfully created.' }\n format.json { render :json => @interest, :status => :created, :location => @interest }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "731dfb74ea9da887d917e243264c0c7e", "score": "0.69694084", "text": "def create\n @interest = Interest.new(params[:interest])\n\n respond_to do |format|\n if @interest.save\n format.html { redirect_to @interest, notice: 'Interest was successfully created.' }\n format.json { render json: @interest, status: :created, location: @interest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a53a6644042e2f774221e6c1473e5d46", "score": "0.66245186", "text": "def create\n @user_interest = UserInterest.new(user_interest_params)\n\n respond_to do |format|\n if @user_interest.save\n format.html { redirect_to @user_interest, notice: 'User interest was successfully created.' }\n format.json { render :show, status: :created, location: @user_interest }\n else\n format.html { render :new }\n format.json { render json: @user_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a9cb8a560b405282fdff967d6b80fd2b", "score": "0.66048574", "text": "def create\n @user = User.find(params[:user])\n @animal = Animal.find(params[:animal])\n @interest = Interest.new(user_id: @user.id, animal_id: @animal.id, date: Date.today)\n\n respond_to do |format|\n if @interest.save\n format.html { redirect_to :back, notice: 'You sent an interest to the animal' }\n format.json { head :no_content }\n else\n format.html { redirect_to animals_url, notice: @interest.errors.full_messages[0] }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "6a94212bf296a672a37c1bd5c861b017", "score": "0.6587387", "text": "def create\n @interest = Interest.new(params[:interest])\n if @interest.save\n redirect_to interests_path\n else\n redirect_to new_interest_path\n end\n end", "title": "" }, { "docid": "997d7810a1b1b98b011f1a0460d4fac3", "score": "0.6579149", "text": "def create\n if user_interest_params && @current_user.id == user_interest_params[:user_id].to_i #only create them if the current user = the parameter user\n \n @user_id = user_interest_params[:user_id]\n\n count = 1\n interests_to_add = does_interest_exist(user_interest_params) #only add interests that don't exist yet\n \n if interests_to_add.length >= 1 #only run this if there are interests to add\n interests_to_add.each do |interest|\n @user_interest = UserInterest.new(user_id: @user_id, interest_id: interest)\n \n if @user_interest.save\n if count == interests_to_add.length #show success only for the last one\n render json: { \n status: 200,\n message: \"Successfully added user interests\",\n user_interests: @user_interest\n }.to_json\n end\n else\n render json: {\n status: 500,\n message: \"Couldn't save user interests\",\n errors: @user_interest.errors\n }.to_json\n end\n count += 1\n end\n else #if there are no interests to add, state so.\n render json: {\n status: 200,\n message: \"No interests to add\"\n }.to_json\n end\n else\n render json: {\n status: 400,\n message: \"Invalid authentication\"\n }.to_json\n end\n end", "title": "" }, { "docid": "17bfeaef5bd12f9f20a6491e02a51e46", "score": "0.6534249", "text": "def create\n @interest = Interest.new(interest_params)\n authorize @interest\n respond_to do |format|\n if @interest.save\n format.html { redirect_to @interest, notice: t('flash.notice.created') }\n format.json { render :show, status: :created, location: @interest }\n else\n format.html { render :new }\n format.json { render json: @interest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d811f45a9d13178929d59ae9bf446f40", "score": "0.6533948", "text": "def create \n @interest = Interest.new(interest_params)\n @interest.save\n end", "title": "" }, { "docid": "8382dc640f4dbe85123a2fcae82166ca", "score": "0.6531679", "text": "def create_interest_params\n params.permit(:yelp_id, :interests => [:min_seats, :max_seats, :datetime])\n end", "title": "" }, { "docid": "06691bf1f21e457596f8d6deb2df13c2", "score": "0.64920205", "text": "def add_interest(id)\n SocietyInterest.create(society_id: self.id, interest_id: id)\n end", "title": "" }, { "docid": "c3e40724812e4b4d032359ff08fc8dbf", "score": "0.6478085", "text": "def interest_params\n params.require(:interest).permit(:user_id, :animal_id, :date)\n end", "title": "" }, { "docid": "bbb7d0896d349eb8424fdc344357b3e7", "score": "0.64384145", "text": "def new\n @person_interest = PersonInterest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person_interest }\n end\n end", "title": "" }, { "docid": "81958cafd09e00b5b6869939fec1e21c", "score": "0.64365655", "text": "def index\n \n @interests = Interest.find(@interestsId)\n \n if params[:persona_id] == nil \n @interests = Interest.order(:name) \n end\n \n respond_to do |format|\n format.json { render :json => @interests }\n end\n end", "title": "" }, { "docid": "eb7f58f53b3a10dd0cc9cd4dc3f8049e", "score": "0.6395011", "text": "def user_interest_params\n params.require(:user_interest).permit(:person_id, :course_id)\n end", "title": "" }, { "docid": "00b1fbda0ae831d7c2a2fbf9245063e8", "score": "0.6361647", "text": "def create\n @interest = Interest.new(interest_params)\n @interest.user_id=current_user.id\n if(@interest.save)\n render json: {\"success\":true,\"message\":\"Done!\"}\n else\n render json: {\"success\":false,\"message\":@interest.errors}\n end\n # respond_to do |format|\n # if @interest.save\n # format.html { redirect_to @interest, notice: 'Interest was successfully created.' }\n # format.json { render :show, status: :created, location: @interest }\n # else\n # format.html { render :new }\n # format.json { render json: @interest.errors, status: :unprocessable_entity }\n # end\n # end\n end", "title": "" }, { "docid": "4e8a9650d6c2acd4a4e35afa1f1ddef4", "score": "0.6337478", "text": "def create\n standard_create(Interest, interest_params)\n end", "title": "" }, { "docid": "2ebe79ec73b34e0b9f6cf72782c9096e", "score": "0.6298721", "text": "def interest_params\n params.require(:interest).permit(:name)\n end", "title": "" }, { "docid": "c6d1a7e7ab06cfbbd40cc4090b84fb45", "score": "0.6261161", "text": "def interest_params\n params.require(:interest).permit(:name, :interest_category_id, :highlight, :include_on_application, :inactive)\n end", "title": "" }, { "docid": "5d58a83012d8856461c1985e29ffc831", "score": "0.62444156", "text": "def create\n @student_interest = StudentInterest.new(student_interest_params)\n\n respond_to do |format|\n if @student_interest.save\n format.html { redirect_to @student_interest, notice: 'Student interest was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student_interest }\n else\n format.html { render action: 'new' }\n format.json { render json: @student_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "90668c695b6a9a2131892f442254d074", "score": "0.62359047", "text": "def create\n @interest = Interest.new(params[:interest])\n\n respond_to do |format|\n if @interest.save\n flash[:notice] = 'Interest was successfully created.'\n format.html { redirect_to(@interest) }\n format.xml { render :xml => @interest, :status => :created, :location => @interest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3fa1c029336281503aba9e522850af7", "score": "0.62041914", "text": "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end", "title": "" }, { "docid": "f5b6beda6db856522fef7d0f294fe7f8", "score": "0.61970174", "text": "def index\n @interests = Interests.for_person(@person)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @interests }\n end\n end", "title": "" }, { "docid": "8bc196f30befe0153d64184c494815e6", "score": "0.61626065", "text": "def interest_params\n params.require(:interest).permit(:rating, :comment)\n end", "title": "" }, { "docid": "66e20b833c37f24b280836375e1a87d3", "score": "0.6152428", "text": "def user_interest_params\n params.permit(\n :user_id, :interest_id, :value\n )\n end", "title": "" }, { "docid": "f3712c9e0052d72442764aa8c669d9ca", "score": "0.61378586", "text": "def update\n @interests = Interests.for_person(@person)[0]\n\n respond_to do |format|\n if @interests.update_attributes(params[:interests])\n flash[:notice] = 'Interests updated.'\n format.html { redirect_to(person_path(:id => @person)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interests.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9abcc18bf7565f8d1c9bf5b6050871ec", "score": "0.61364084", "text": "def create\n respond_to do |format|\n if @interest.save\n format.html { redirect_to @interest, :notice => 'Интересот е успешно додаден.' }\n format.json { render :json => @interest, :status => :created, :location => @interest }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8e8c10262c255ab33337aff926c1725a", "score": "0.6130351", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interest }\n end\n end", "title": "" }, { "docid": "93c6e200111f033a22c52a54c5cd6cef", "score": "0.6113072", "text": "def api_v1_mentorship_interest_params\n params.fetch(:api_v1_mentorship_interest, {})\n end", "title": "" }, { "docid": "00be89102ea260007ad25a4ead052fa8", "score": "0.61105305", "text": "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interest }\n end\n end", "title": "" }, { "docid": "437b96c85c0902f2a017c9f456311d94", "score": "0.6079253", "text": "def set_interest\n @interest = Interest.find(params[:id])\n end", "title": "" }, { "docid": "437b96c85c0902f2a017c9f456311d94", "score": "0.6079253", "text": "def set_interest\n @interest = Interest.find(params[:id])\n end", "title": "" }, { "docid": "437b96c85c0902f2a017c9f456311d94", "score": "0.6079253", "text": "def set_interest\n @interest = Interest.find(params[:id])\n end", "title": "" }, { "docid": "437b96c85c0902f2a017c9f456311d94", "score": "0.6079253", "text": "def set_interest\n @interest = Interest.find(params[:id])\n end", "title": "" }, { "docid": "437b96c85c0902f2a017c9f456311d94", "score": "0.6079253", "text": "def set_interest\n @interest = Interest.find(params[:id])\n end", "title": "" }, { "docid": "996be50a5085d78cbf7e0fcdadd2fcb9", "score": "0.6062223", "text": "def eventinterest_params\n params.require(:eventinterest).permit(:isinterest, :user_id, :events_id)\n end", "title": "" }, { "docid": "67df1ef8315f409ee7d6b833f9658d6f", "score": "0.60560644", "text": "def create\n @event_interest = EventInterest.new(params[:event_interest])\n\n respond_to do |format|\n if @event_interest.save\n format.html { redirect_to @event_interest, notice: 'Event interest was successfully created.' }\n format.json { render json: @event_interest, status: :created, location: @event_interest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b41ecb4dac34e6158a1b578a1d1b0b4", "score": "0.6050709", "text": "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interest }\n end\n end", "title": "" }, { "docid": "ea0c5c029025bda07548350db3086927", "score": "0.60343796", "text": "def interest_params\n params.require(:interest).permit(:label, :uri)\n end", "title": "" }, { "docid": "5846f68d890e3da137c71197c172193f", "score": "0.60339385", "text": "def interests\n @articles = Article.tagged_with(current_user.interest_list, any: true)\n @articles = @articles.paginate(page: params[:page], per_page: 10).order('pub_date DESC')\n end", "title": "" }, { "docid": "67826590f868d52f4754d6e83c089ff2", "score": "0.6002293", "text": "def index\n @interests = Interest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interests }\n end\n end", "title": "" }, { "docid": "5a2fc0b8672d868fd67f4d80c29d239a", "score": "0.5990389", "text": "def show\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person_interest }\n end\n end", "title": "" }, { "docid": "801f6f2decf6650767f48387e7cc813f", "score": "0.59688425", "text": "def create\n @api_v1_mentorship_interest = Api::V1::MentorshipInterest.new(api_v1_mentorship_interest_params)\n\n respond_to do |format|\n if @api_v1_mentorship_interest.save\n format.html { redirect_to @api_v1_mentorship_interest, notice: 'Mentorship interest was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_mentorship_interest }\n else\n format.html { render :new }\n format.json { render json: @api_v1_mentorship_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67c996fd1c627e9b644907ca2bbeff8e", "score": "0.59618646", "text": "def followed\n\t\t@interest = Interest.find(params[:id])\n\t\[email protected] = @interest.score + 1\n\t\[email protected]\n\t\tcurrent_user.create_rel(\"HAS_INTEREST\", @interest) \n\t\tif request.xhr?\n\t\t\trender json: { id: @interest.id }\n\t\telse\n\t\t\tredirect_to @user\n\t\tend\n\n\tend", "title": "" }, { "docid": "9c5001d47f218e96dea40e0db65944a7", "score": "0.5955878", "text": "def index\n @interests = Interest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @interests }\n end\n end", "title": "" }, { "docid": "dde7fe45e3c9a4515d0b24a21224e38b", "score": "0.59381574", "text": "def set_interest\n begin\n @interest = Interest.find(params[:id])\n rescue\n redirect_to \"/interest\"\n end\n end", "title": "" }, { "docid": "c2a1aa9fbf12741661165170059c2792", "score": "0.5897898", "text": "def save_interest\n @record_count = Interest.find_all_by_user_id(current_user.id)\n @interest = Interest.new(:category_id => params[:category_id], :subcategory_id => params[:subcategory_id], :user_id => current_user.id)\n @same_pair = Interest.find_same_pair(params[:category_id], params[:subcategory_id], current_user.id)\n if (@same_pair.empty? && @record_count.count != 15)\n @interest.save\n else\n if(!@same_pair.empty?)\n @interest = {:message => \"same pair.\"}\n elsif(@record_count.count == 15)\n @interest = {:message => \"limit exceed.\"}\n end\n end\n respond_to do |format|\n format.json { render :json => @interest }\n end\n end", "title": "" }, { "docid": "e456a95e9ed892f959bfa443c02c9584", "score": "0.5880371", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @interests }\n end\n end", "title": "" }, { "docid": "a54a5b4d0a8ba68ecc468dbb77c14ed1", "score": "0.5870705", "text": "def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "29d32b24e577762d9e4fedafd5006fcd", "score": "0.5864738", "text": "def pending_interest_params\n params.require(:pending_interest).permit(:name)\n end", "title": "" }, { "docid": "18f38d811436f242a264090176fb56bc", "score": "0.58443624", "text": "def set_interest # :norobots:\n pass_query_params\n type = params[:type].to_s\n oid = params[:id].to_i\n state = params[:state].to_i\n uid = params[:user]\n target = Comment.find_object(type, oid)\n if @user\n interest = Interest.find_by_target_type_and_target_id_and_user_id(type, oid, @user.id)\n if uid && @user.id != uid.to_i\n flash_error(:set_interest_user_mismatch.l)\n elsif !target && state != 0\n flash_error(:set_interest_bad_object.l(:type => type, :id => oid))\n else\n if !interest && state != 0\n interest = Interest.new\n interest.target = target\n interest.user = @user\n end\n if state == 0\n name = target ? target.unique_text_name : '--'\n if !interest\n flash_notice(:set_interest_already_deleted.l(:name => name))\n elsif !interest.destroy\n flash_notice(:set_interest_failure.l(:name => name))\n else\n if interest.state\n flash_notice(:set_interest_success_was_on.l(:name => name))\n else\n flash_notice(:set_interest_success_was_off.l(:name => name))\n end\n end\n elsif interest.state == true && state > 0\n flash_notice(:set_interest_already_on.l(:name => target.unique_text_name))\n elsif interest.state == false && state < 0\n flash_notice(:set_interest_already_off.l(:name => target.unique_text_name))\n else\n interest.state = (state > 0)\n interest.updated_at = Time.now\n if !interest.save\n flash_notice(:set_interest_failure.l(:name => target.unique_text_name))\n else\n if state > 0\n flash_notice(:set_interest_success_on.l(:name => target.unique_text_name))\n else\n flash_notice(:set_interest_success_off.l(:name => target.unique_text_name))\n end\n end\n end\n end\n end\n if target\n redirect_back_or_default(:controller => target.show_controller,\n :action => target.show_action, :id => oid,\n :params => query_params)\n else\n redirect_back_or_default(:controller => 'interest',\n :action => 'list_interests')\n end\n end", "title": "" }, { "docid": "3bda7a4593b20511d4cb5238de519221", "score": "0.5825108", "text": "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end", "title": "" }, { "docid": "372a236b8c02b918d6a2d9393b07169e", "score": "0.5815151", "text": "def interests\n respond_with get_tags_for_contexts([\"interests\", \"reject_interests\"], params[:exclude_tags])\n end", "title": "" }, { "docid": "a9278904ba4bebe263c6ed92e1d2f365", "score": "0.57774943", "text": "def student_interest_params\n params.require(:student_interest).permit(:firstName, :lastName, :school_id, :category_id, :notes)\n end", "title": "" }, { "docid": "279ab55e7804fb2bff84f0a26c64119a", "score": "0.57533556", "text": "def create\n @eventinterest = Eventinterest.new(eventinterest_params)\n\n respond_to do |format|\n if @eventinterest.save\n format.html { redirect_to @eventinterest, notice: 'Eventinterest was successfully created.' }\n format.json { render :show, status: :created, location: @eventinterest }\n else\n format.html { render :new }\n format.json { render json: @eventinterest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b44d0e74c3dd1490d4850b21741a83e2", "score": "0.57512283", "text": "def update\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n if @person_interest.update_attributes(params[:person_interest])\n format.html { redirect_to @person_interest, notice: 'Person interest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dc5c6b5aa5e0ebcb1e9bed96379e644a", "score": "0.5745195", "text": "def index\n @interests = Interest.all\n end", "title": "" }, { "docid": "dc5c6b5aa5e0ebcb1e9bed96379e644a", "score": "0.5745195", "text": "def index\n @interests = Interest.all\n end", "title": "" }, { "docid": "0f186392fd95e4ca74a8ec1de48c0a6c", "score": "0.5744887", "text": "def create\n filter_sampled_persons_ineligibilties\n\n @person = Person.new(params[:person])\n @provider = Provider.find(params[:provider_id]) unless params[:provider_id].blank?\n\n respond_to do |format|\n if @person.save\n create_relationship_to_participant\n\n path = people_path\n msg = 'Person was successfully created.'\n if @provider\n path = provider_path(@provider)\n msg = \"Person was successfully created for #{@provider}.\"\n end\n format.html { redirect_to(path, :notice => msg) }\n format.json { render :json => @person }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @person.errors }\n end\n end\n end", "title": "" }, { "docid": "e257a9f622fb93a60bf7d28ca58cc25a", "score": "0.5741771", "text": "def interest_params\n params.require(:interest).permit(:n_empenho, :aplicacao, :rsrp, :obs, :pregao, :company_id, :emissao, :processo, \n :sims_squad_id, :data_envio, :prazo, :avatar, :user_cadastro, :user_atualiza,\n :especifications_attributes => [:id, :descricao, :type_id, :qtde, :valor_un, :modality_id, :_destroy])\n end", "title": "" }, { "docid": "5e5014ba231ddb0e0912001b85db43e1", "score": "0.57311916", "text": "def mentoring_interest_params\n params.fetch(:mentoring_interest, {})\n end", "title": "" }, { "docid": "66b980760159f70864116fab7ed6aeb7", "score": "0.56961733", "text": "def create\n @interest_group = InterestGroup.new(interest_group_params)\n @interest_group.user = current_user\n \n respond_to do |format|\n if @interest_group.save\n format.html { redirect_to @interest_group, notice: 'Interest group was successfully created.' }\n format.json { render :show, status: :created, location: @interest_group }\n else\n format.html { render :new }\n format.json { render json: @interest_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "116e74c5a4d5abb794f105f4744e452e", "score": "0.5691066", "text": "def set_interest\n @interest = Interest.find(params[:id]) \n @especifications = Especification.where(\"interest_id = #{params[:id]}\")\n end", "title": "" }, { "docid": "15862d3df4ae7933af895950c750bb0c", "score": "0.5690414", "text": "def create\n\n # Rails.logger.warn \"====================\"\n # Rails.logger.warn foaf_params[:interests_attributes]\n # Rails.logger.warn \"====================\"\n\n \n @foaf = Foaf.new(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n end\n end\n\n respond_to do |format|\n if @foaf.save \n format.html { redirect_to @foaf, notice: 'Foaf was successfully created.' }\n format.json { render action: 'show', status: :created, location: @foaf }\n else\n format.html { render action: 'new' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c2fa7fe62d84685d2f67e3d7b75b5358", "score": "0.5677112", "text": "def create\n \t\t@interested = Interested.new(params[:interested])\n\n \t\trespond_to do |format|\n \t\t\tif @interested.save\n \t\t\t\tformat.html{ redirect_to @interested, notice: 'Interested was successfully created.'}\n \t\t\t\tformat.json{ render json: @interested, status: :create, location: @interested }\n \t\t\telse\n \t\t\t\tformat.html { render action: \"new\" }\n \t\t\t\tformat.json { render json: @interested.error, status: :unprocessable_entity }\n \t\t\tend\n \t\tend\n \tend", "title": "" }, { "docid": "4de4585a9b0970be8bb15cafd9d2d272", "score": "0.56628335", "text": "def handle_explore_interests\n @explore_interest_ids = []\n tag_ids = params[:tag_ids]\n @interests = Interest.all\n @interests.each do |i_box|\n # Set the interest information from form to instance variable\n @interest_info = i_box.id\n\n if (!tag_ids.nil?) && (tag_ids.include? i_box.id.to_s)\n @explore_interest_ids.push i_box.id\n else\n @explore_interest_ids.delete i_box.id\n end\n end\n redirect_to users_explore_path\n end", "title": "" }, { "docid": "4bfe8a843f323980fad02e587514730b", "score": "0.5648661", "text": "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interest }\n end\n end", "title": "" }, { "docid": "0e2ce6137e3470a9bd6a35f82048dd33", "score": "0.56229407", "text": "def create\n\n # Rails.logger.warn \"====================\"\n # Rails.logger.warn foaf_params[:interests_attributes]\n # Rails.logger.warn \"====================\"\n\n \n @foaf = Foaf.new(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n end\n end\n\n respond_to do |format|\n if @foaf.save \n format.html { redirect_to @foaf, notice: 'FOAF was successfully created.' }\n format.json { render action: 'show', status: :created, location: @foaf }\n else\n format.html { render action: 'new' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f39baaeb8fa078d34720d382d1ce3ae3", "score": "0.56192076", "text": "def create\n @project_interest_point = ProjectInterestPoint.new(project_interest_point_params)\n\n respond_to do |format|\n if @project_interest_point.save\n format.html { redirect_to @project_interest_point, notice: 'Project interest point was successfully created.' }\n format.json { render :show, status: :created, location: @project_interest_point }\n else\n format.html { render :new }\n format.json { render json: @project_interest_point.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e13a867ce0f65a4950edd3e316095a0e", "score": "0.56089485", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @interest }\n end\n end", "title": "" }, { "docid": "49798a7d4f852dcd053c2bc4bf89677e", "score": "0.5601554", "text": "def create\n @invitation_request = InvitationRequest.new(invitation_request_params)\n\n respond_to do |format|\n if @invitation_request.save\n format.html { redirect_to root_path, notice: 'Invitation received. We will notify you soon!' }\n format.json { render :show, status: :created, location: @invitation_request }\n else\n @interests = Interest.all\n format.html { render :new }\n format.json { render json: @invitation_request.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66602a25c957527f3c3d8ca16186419e", "score": "0.55974674", "text": "def set_user_interest\n @user_interest = UserInterest.find(params[:id])\n end", "title": "" }, { "docid": "a1c84b356f08da46562d56417c8ab16e", "score": "0.5593343", "text": "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @interest }\n end\n end", "title": "" }, { "docid": "5e4dd70784c0226acea240772b943dae", "score": "0.552923", "text": "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @interest }\n end\n end", "title": "" }, { "docid": "e8237e41df7246f73f146dd9320703a7", "score": "0.55285364", "text": "def change_interest\n user = User.find(params[:id])\n if current_user.interested?(user)\n msg = \"I'm <span>interested</span> in this profile\"\n Interest.delay.delete_all([\"user_id = ? and interestable_id = ? and interestable_type = ?\", current_user.id, user.id, \"User\"])\n NetworkUpdate.removeInterestedUpdate(current_user.id, user.id)\n else\n msg = \"Remove <span>interest</span> in profile\"\n current_user.interest!(user)\n NetworkUpdate.delay.createInterestedUpdate(current_user.id, user.id)\n SneakPeekMailer.delay(:queue => 'mailers').interested_email(current_user, user)\n end\n render :text => msg\n end", "title": "" }, { "docid": "b0a78b70fb44ffb1e91bebb623b69c21", "score": "0.5521766", "text": "def index\n @user_interests = UserInterest.all\n end", "title": "" }, { "docid": "0ae2f6641659178a17191b44605014d5", "score": "0.55180186", "text": "def interest_rate\n params['interest_rate'] = params['interest_rate'].to_f\n\n old_rate = @@interest_rate\n @@interest_rate = params['interest_rate']\n json_response(old_rate: old_rate, new_rate: @@interest_rate)\n end", "title": "" }, { "docid": "1e3c08d119f86c6e6fa62cfc15694ff7", "score": "0.5506208", "text": "def destroy\n @person_interest = PersonInterest.find(params[:id])\n @person_interest.destroy\n\n respond_to do |format|\n format.html { redirect_to person_interests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "525fb0627cce518d996d1c60fc9a1559", "score": "0.549223", "text": "def update\n respond_to do |format|\n if @interest.update(interest_params)\n format.html { redirect_to animals_url, notice: 'You sent an interest to the animal' }\n format.json { head :no_content }\n else\n format.html { redirect_to animals_url, notice: @interest.errors.full_messages[0] }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "65fb157456ec65cf5363315e565aa8f6", "score": "0.54846156", "text": "def create\n @postulate_area_interest = PostulateAreaInterest.new(postulate_area_interest_params)\n\n respond_to do |format|\n if @postulate_area_interest.save\n format.html { redirect_to @postulate_area_interest }\n format.json { render :show, status: :created, location: @postulate_area_interest }\n else\n format.html { render :new }\n format.json { render json: @postulate_area_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e91cc6c79f8ff9ecfb8e4150461cf77", "score": "0.5482404", "text": "def list_interests # :norobots:\n store_location\n @title = :list_interests_title.t\n notifications = Notification.find_all_by_user_id(@user.id).sort do |a,b|\n result = a.flavor.to_s <=> b.flavor.to_s\n result = a.summary.to_s <=> b.summary.to_s if result == 0\n result\n end\n interests = Interest.find_all_by_user_id(@user.id).sort do |a,b|\n result = a.target_type <=> b.target_type\n result = (a.target ? a.target.text_name : '') <=>\n (b.target ? b.target.text_name : '') if result == 0\n result\n end\n @targets = notifications + interests\n @pages = paginate_numbers(:page, 50)\n @pages.num_total = @targets.length\n @targets = @targets[@[email protected]]\n end", "title": "" }, { "docid": "aaf5736c70ad488502f6d9ce7e822c4f", "score": "0.54763114", "text": "def postulate_area_interest_params\n params.require(:postulate_area_interest).permit(:area_interest_id, :postulate_id)\n end", "title": "" }, { "docid": "2f92d72e762baa187c4a557be98fd8aa", "score": "0.5468271", "text": "def profile_params\n params.require(:profile).permit(:name, :bio, :country_id, :picture, interest_ids: [])\n end", "title": "" }, { "docid": "9b056211ea2c4ac8b7655d21bb2ccdb5", "score": "0.5439726", "text": "def set_student_interest\n @student_interest = StudentInterest.find(params[:id])\n end", "title": "" }, { "docid": "0036c4d79d420ec5045cc2e90e5d5ba2", "score": "0.54227674", "text": "def create\n @brochure_interest = BrochureInterest.new(params[:brochure_interest])\n\n respond_to do |format|\n if @brochure_interest.save\n format.html { redirect_to(@brochure_interest, :notice => 'Brochure interest was successfully created.') }\n format.xml { render :xml => @brochure_interest, :status => :created, :location => @brochure_interest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @brochure_interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b02c69c842f09630a9a36f60dce0445", "score": "0.5422456", "text": "def create\n @interesting = Interesting.new(params[:interesting])\n\n respond_to do |format|\n if @interesting.save\n format.html { redirect_to @interesting, notice: 'Interesting was successfully created.' }\n format.json { render json: @interesting, status: :created, location: @interesting }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "066e92757a82975d9fc3899b49756207", "score": "0.5414561", "text": "def new\n\t\t@interest = Interest.new\t\n\tend", "title": "" }, { "docid": "83911aafc31b5c9eb46190af04ab8534", "score": "0.54108965", "text": "def index\n number_tweets = if params[\"count\"] then params[\"count\"].to_i else 10 end\n tweet_ids = []\n if @user.interests\n for i in 1..number_tweets\n interest = @user.interests.sample\n tweet = Rails.application.config.twitter_client.search(\"#{interest[:hashtag]}\", count: 1).take(1)\n tweet_ids.push(tweet.first.id.to_s)\n end\n end\n\n render json: tweet_ids, status: :ok\n end", "title": "" }, { "docid": "31bcd9e47f13036932c7f3bc99a75948", "score": "0.54069275", "text": "def interest_point_params\n params.require(:interest_point).permit(:name, :description, :image_url, :latitude, :longitude, :point_image)\n end", "title": "" }, { "docid": "4a268e76956d43869244551816eb05b1", "score": "0.53913856", "text": "def create\n @interview = Interview.new(interview_params)\n\n respond_to do |format|\n if @interview.save\n format.html { redirect_to interviews_url, notice: 'Interview was successfully created.' }\n format.json { render action: 'show', status: :created, location: @interview }\n else\n format.html { render action: 'new' }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ce32f0959ca5c918564bf64a4baa79fa", "score": "0.53890646", "text": "def index\n @api_v1_mentorship_interests = Api::V1::MentorshipInterest.all\n end", "title": "" }, { "docid": "0a9c82e2c1d150fda51454f4171fe614", "score": "0.5380389", "text": "def update\n respond_to do |format|\n if @interest.update(interest_params)\n format.html { redirect_to @interest, notice: 'Interest was successfully updated.' }\n format.json { render :show, status: :ok, location: @interest }\n else\n format.html { render :edit }\n format.json { render json: @interest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7502d6561905db9d7d7b72b4c08c9c3c", "score": "0.53785133", "text": "def set_interest_point\n @interest_point = InterestPoint.find(params[:id])\n end", "title": "" }, { "docid": "7e3fff0c5cdc8a3b796806fe8eab10f6", "score": "0.53714406", "text": "def user_interest_share_params\n params.require(:user_interest_share).permit(:user_id, :to_user_id, :interest_id)\n end", "title": "" }, { "docid": "d5240605e97f81025d01582b3f44b882", "score": "0.53656673", "text": "def create\n @expression_of_interest = ExpressionOfInterest.new(expression_of_interest_params)\n\n respond_to do |format|\n if @expression_of_interest.save\n format.html { redirect_to @expression_of_interest, notice: 'Expression of interest was successfully created.' }\n format.json { render :show, status: :created, location: @expression_of_interest }\n else\n format.html { render :new }\n format.json { render json: @expression_of_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b15085b8ebe0f929720fc799ccb1766b", "score": "0.5356654", "text": "def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v1_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "f178f3bd6da6115da681ff3f33b57cfe", "score": "0.5348402", "text": "def create\n @interest_area = InterestArea.new(params[:interest_area])\n\n respond_to do |format|\n if @interest_area.save\n format.html { redirect_to @interest_area, notice: 'Interest area was successfully created.' }\n format.json { render json: @interest_area, status: :created, location: @interest_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interest_area.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fe2800b7060e1827064c381bd2d9a241", "score": "0.5347901", "text": "def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "3e9903d9df158a509b979345a44ceaff", "score": "0.53406477", "text": "def get_region_interest_form_params\n params.require(:profile).permit(:region_interest)\n end", "title": "" } ]
7a84ae1d8b32a287930eb7366fc22522
Apply limit clause to source, return new source.
[ { "docid": "228efdc4a022c9b1466df069c8a00a36", "score": "0.64134747", "text": "def handle_limit(source, limit)\n raise NotImplementedError\n end", "title": "" } ]
[ { "docid": "b70e39e2d8d687ae0ced94f44a1b43ff", "score": "0.7638134", "text": "def limit limit\n _clone._tap do |c|\n c.limit_clause = limit\n end\n end", "title": "" }, { "docid": "17b5d62ed9ecdc500031152482a93a9e", "score": "0.7352204", "text": "def apply_limit_to(query)\n return query unless _limit\n query.limit(_limit)\n end", "title": "" }, { "docid": "ddab827a15ac9358446963976d68fd66", "score": "0.70925117", "text": "def apply_limit(limit)\n @scope = @scope.limit(limit)\n end", "title": "" }, { "docid": "699888b1847c156642c802333b81ab09", "score": "0.6957376", "text": "def limit(limit)\n clone.tap { |data_set| data_set.row_limit = limit }\n end", "title": "" }, { "docid": "699888b1847c156642c802333b81ab09", "score": "0.6957376", "text": "def limit(limit)\n clone.tap { |data_set| data_set.row_limit = limit }\n end", "title": "" }, { "docid": "83f87fed17bfec0e60ea3458e254723a", "score": "0.69571084", "text": "def limit(limit)\n clone.tap do |crit|\n crit.clear_cache\n crit.options[:rows] = limit\n end\n end", "title": "" }, { "docid": "16085955242b9dc54d455a56718f3eaf", "score": "0.68714166", "text": "def add_filter_for_limit(q, limit)\n q.limit(limit)\n end", "title": "" }, { "docid": "175e51d65d2fdfde6163e056d806a5d4", "score": "0.680397", "text": "def limit(limit)\n clone.tap { |data_set| data_set.limit = limit }\n end", "title": "" }, { "docid": "2078a16b0c1a6cf623a6571ac8574343", "score": "0.6710615", "text": "def limit limit\n _with(:limit => limit)\n end", "title": "" }, { "docid": "bd2e916d6f98cacfc62f6a095bf0e19c", "score": "0.66186816", "text": "def add_limit_offset!(statement, limit, offset, bind_values)\n if limit\n statement.replace statement.gsub(/^SELECT/i, \"SELECT TOP #{limit}\")\n end\n\n # TODO handle offsets - perhaps send a signal down to do_openedge\n # to manually adjust the ResultSet cursor?\n end", "title": "" }, { "docid": "2be3ecb3e5acb88df970bcb36e2486b1", "score": "0.6611294", "text": "def select_limit_sql(sql)\n if l = @opts[:limit]\n return if is_2012_or_later? && @opts[:order] && @opts[:offset]\n shared_limit_sql(sql, l)\n end\n end", "title": "" }, { "docid": "436faab171be67cd7bb3f7d987f91819", "score": "0.6602832", "text": "def limit(opts)\n return self if opts.blank?\n\n query = clone\n query.limit_value = opts\n query\n end", "title": "" }, { "docid": "959ced3167dc8dd8c95e55651419c25f", "score": "0.6592433", "text": "def select_limit_sql(sql)\n if l = @opts[:limit]\n sql << TOP\n literal_append(sql, l)\n end\n end", "title": "" }, { "docid": "f032ac0870974f8494dd0017f4cd1f85", "score": "0.6518564", "text": "def limit count\n dup.tap do |query|\n query.criteria << build_criterion(:limit, count)\n end # tap\n end", "title": "" }, { "docid": "3ad429f0dc07d0783c82b4e225b15b2d", "score": "0.64650106", "text": "def limit(num)\n relation = __new_relation__(all.take(num))\n relation.send(:set_from_limit)\n relation\n end", "title": "" }, { "docid": "47a30fc58d39b4e0801566b325f7d668", "score": "0.6455208", "text": "def select_limit_sql(sql)\n raise(Error, \"OFFSET not supported\") if @opts[:offset]\n if l = @opts[:limit]\n sql << \" TOP \"\n literal_append(sql, l)\n end\n end", "title": "" }, { "docid": "1da097f25050eb1fc8c6c4eb45cbfefd", "score": "0.643352", "text": "def select_limit_sql(sql)\n if l = @opts[:limit]\n sql << \" TOP \"\n literal_append(sql, l)\n end\n end", "title": "" }, { "docid": "0477fd17ef74c812c8ec4e8cef677c40", "score": "0.6421661", "text": "def select_limit_sql(sql)\n raise(Error, \"OFFSET not supported\") if @opts[:offset]\n # if l = @opts[:limit]\n # sql << \" TOP \"\n # literal_append(sql, l)\n # end\n end", "title": "" }, { "docid": "ad61ecd83a26b097bd37c392cb39497d", "score": "0.64169306", "text": "def select_limit_sql(sql, opts)\n raise(Error, \"OFFSET not supported\") if opts[:offset]\n sql << \" TOP #{opts[:limit]}\" if opts[:limit]\n end", "title": "" }, { "docid": "05333c052b8a5ff2fa04553810b22dd5", "score": "0.64131194", "text": "def take(limit)\n new(relation.take(limit))\n end", "title": "" }, { "docid": "e209bd5ea747eadf37f1d2f211cbbb91", "score": "0.6400593", "text": "def select_limit_sql(sql)\n sql << \" TOP #{@opts[:limit]}\" if @opts[:limit]\n end", "title": "" }, { "docid": "e209bd5ea747eadf37f1d2f211cbbb91", "score": "0.6400593", "text": "def select_limit_sql(sql)\n sql << \" TOP #{@opts[:limit]}\" if @opts[:limit]\n end", "title": "" }, { "docid": "eb5993887ee7e9a483341f4974750aae", "score": "0.6377451", "text": "def add_limit!(sql, options, scope = :auto)\n scope = scope(:find) if :auto == scope\n\n if scope\n options[:limit] ||= scope[:limit]\n options[:offset] ||= scope[:offset]\n end\n\n connection.add_limit_offset!(sql, options)\n end", "title": "" }, { "docid": "26c04dc499e9cf9fe2b231b1d5e2e737", "score": "0.6369445", "text": "def limit(val)\n Limit.new(clause_list, val, self)\n self\n end", "title": "" }, { "docid": "7ca9fda5a5f9830a4a049f222662071c", "score": "0.6358877", "text": "def limit(limit = nil)\n limit.nil? ? self : self[0...limit]\n end", "title": "" }, { "docid": "6d76877d559a5337b8db144d5904c432", "score": "0.63436764", "text": "def limit(limit)\n operation.limit = limit\n self\n end", "title": "" }, { "docid": "97462eb46cd123e7c15b2ea89724dac1", "score": "0.63435066", "text": "def limit(limit)\n @criteria[:limit] = limit\n self\n end", "title": "" }, { "docid": "97462eb46cd123e7c15b2ea89724dac1", "score": "0.63435066", "text": "def limit(limit)\n @criteria[:limit] = limit\n self\n end", "title": "" }, { "docid": "82a8fd73bb66eac7a75fc9677388fe93", "score": "0.63173264", "text": "def limit_from_sql\n limit_clause = original_select.limit_option == :LIMIT_OPTION_DEFAULT ? nil : original_select&.limit_count\n return nil if limit_clause.nil?\n\n get_int_value(limit_clause)\n end", "title": "" }, { "docid": "e2b62cfcd0439b145790f1a89ad51a30", "score": "0.63053167", "text": "def select_limit_sql(sql)\n sql << \" LIMIT #{literal(@opts[:limit])}\" if @opts[:limit]\n sql << \" OFFSET #{literal(@opts[:offset])}\" if @opts[:offset]\n end", "title": "" }, { "docid": "cadd5b9f2660cd4e13348bfae8ce8d86", "score": "0.6275821", "text": "def limit(l, o = nil)\n if @opts[:sql]\n return from_self.limit(l, o)\n end\n\n opts = {}\n if l.is_a? Range\n lim = (l.exclude_end? ? l.last - l.first : l.last + 1 - l.first)\n opts = {:limit => lim, :offset=>l.first}\n elsif o\n opts = {:limit => l, :offset => o}\n else\n opts = {:limit => l}\n end\n clone(opts)\n end", "title": "" }, { "docid": "866271788d3d62622d87cd8d80f2c9eb", "score": "0.6249797", "text": "def limit(num)\n __new_relation__(all.take(num))\n end", "title": "" }, { "docid": "c1a0ef933dc28435016df7a9c970a6c2", "score": "0.62251306", "text": "def optimize\n wrap_operand.take(operand.limit)\n end", "title": "" }, { "docid": "3bc73455efbf4498305395b9e837bd36", "score": "0.6217073", "text": "def limit(limit)\r\n @limit = limit\r\n return self\r\n end", "title": "" }, { "docid": "d03e67b574d5505079bc8e92951fa3dd", "score": "0.62035775", "text": "def select_limit_sql(sql)\n l = @opts[:limit]\n o = @opts[:offset]\n if l || o\n if l\n sql << \" TOP \"\n literal_append(sql, l)\n else\n sql << \" TOP 2147483647\"\n end\n\n if o \n sql << \" START AT (\"\n literal_append(sql, o)\n sql << \" + 1)\"\n end\n end\n end", "title": "" }, { "docid": "579e39b6e572a3cd0c1bbddf9570f4ea", "score": "0.6200369", "text": "def apply_search_limit( ds, options )\n\t\tif (( limit = options[:limit] ))\n\t\t\tself.log.debug \" limiting to %s results\" % [ limit ]\n\t\t\toffset = options[:offset] || 0\n\t\t\tds = ds.limit( limit, offset )\n\t\tend\n\n\t\treturn ds\n\tend", "title": "" }, { "docid": "579e39b6e572a3cd0c1bbddf9570f4ea", "score": "0.6200369", "text": "def apply_search_limit( ds, options )\n\t\tif (( limit = options[:limit] ))\n\t\t\tself.log.debug \" limiting to %s results\" % [ limit ]\n\t\t\toffset = options[:offset] || 0\n\t\t\tds = ds.limit( limit, offset )\n\t\tend\n\n\t\treturn ds\n\tend", "title": "" }, { "docid": "0ade3bf251d197f42455b355acf873be", "score": "0.61891896", "text": "def limit_range!(param)\n offset = param.min\n size = param.max.to_i - param.min.to_i\n @_limit = Babik::QuerySet::Limit.new(size, offset)\n self\n end", "title": "" }, { "docid": "d88d3c76fa63a8b44fd5430aa4ee413d", "score": "0.6185892", "text": "def limit(limit)\n limit_options[:offset] ||= 0\n limit_options[:limit] = limit.to_i\n self\n end", "title": "" }, { "docid": "61714350042f0ed3c0dbebfbce531255", "score": "0.6174855", "text": "def limit(limit)\n @_limit = limit\n self\n end", "title": "" }, { "docid": "2a2e26074361ccec45f2d5901b4373a1", "score": "0.6173665", "text": "def limit_sql(sql)\n if l = @opts[:limit]\n sql << \" LIMIT \"\n literal_append(sql, l)\n end\n end", "title": "" }, { "docid": "7720bea773325714e8d0e02186ecfa19", "score": "0.6162848", "text": "def limit(value)\n return self if value.nil? && !@_fetch.nil?\n where(limit: value)\n end", "title": "" }, { "docid": "4a82e9b48101619eff08e16731ab61e7", "score": "0.61411077", "text": "def limit(limit)\n Operation::Limit.new(self, limit)\n end", "title": "" }, { "docid": "274838a7d171be8dfb0bce94cfb89618", "score": "0.6135193", "text": "def limit(options={})\n limit = options[:limit]\n raise \"Need to provide a limit\" unless limit\n queryLimitedToLast(limit)\n end", "title": "" }, { "docid": "676ceea6869efb6ad7422a718be022a8", "score": "0.6116533", "text": "def agnostic_limit(select, number)\n return select.where(Arel.sql('ROWNUM').lteq(number)) if @is_oracle\n return select.take(number)\n end", "title": "" }, { "docid": "c91ac0ee1a08cd12aa6d994636fa0bef", "score": "0.61106354", "text": "def limit(value)\n query.limit(value.to_i)\n self\n end", "title": "" }, { "docid": "c852260a26937a91815369767b8f0826", "score": "0.6109317", "text": "def limit *args\n return @limit if args.empty?\n collection_with(:limit => Integer(args.first))\n end", "title": "" }, { "docid": "6af2c683d43ca9dc0afc1fdd5979c29d", "score": "0.61083233", "text": "def optimize\n operand.take(limit)\n end", "title": "" }, { "docid": "5bb2759d5413790d7631343628442bba", "score": "0.608978", "text": "def limit_records(records)\n \n records.slice(offset, limit)\n \n end", "title": "" }, { "docid": "2f440065f91b97f6d1ad2c5f0f578b3c", "score": "0.60815054", "text": "def limit(count)\n @sql += \" LIMIT #{count}\"\n\n self\n end", "title": "" }, { "docid": "a5718c87ee83820abc100a50cdef6cbd", "score": "0.60715634", "text": "def take limit=100\n @connection.unsafe.get_range(self, nil, nil).take(limit)\n end", "title": "" }, { "docid": "08900c6e2d46a8fcce7566e7701aa1a4", "score": "0.60700953", "text": "def limit(l, o = nil)\n return from_self.limit(l, o) if @opts[:sql]\n\n if Range === l\n o = l.first\n l = l.last - l.first + (l.exclude_end? ? 0 : 1)\n end\n l = l.to_i if l.is_a?(String) && !l.is_a?(LiteralString)\n if l.is_a?(Integer)\n raise(Error, 'Limits must be greater than or equal to 1') unless l >= 1\n end\n opts = {:limit => l}\n if o\n o = o.to_i if o.is_a?(String) && !o.is_a?(LiteralString)\n if o.is_a?(Integer)\n raise(Error, 'Offsets must be greater than or equal to 0') unless o >= 0\n end\n opts[:offset] = o\n end\n clone(opts)\n end", "title": "" }, { "docid": "c9b50bd5421e813fde81605c4a2e31e1", "score": "0.6051863", "text": "def limit(num)\n @cached_exec = nil\n\n criteria[:limit] = num\n self\n end", "title": "" }, { "docid": "b0cbbca3ebf769c92d3232f87e6b970a", "score": "0.6051412", "text": "def limit\n @column.limit if @column\n end", "title": "" }, { "docid": "299594e35b6a1feaa956f3aee1f744ef", "score": "0.6045793", "text": "def limit(val)\n Limit.new(expressions, val)\n self\n end", "title": "" }, { "docid": "783cc154e30a5c35bef30d8c0ec69fba", "score": "0.6042089", "text": "def limit(criteria, inputs)\n if inputs.key?(:limit)\n criteria.limit(inputs.fetch(:limit))\n end\n self\n end", "title": "" }, { "docid": "5d61e4b90139a16530b5a0751df13029", "score": "0.6037269", "text": "def limit(*args)\n return @limit if args.empty?\n collection_with(:limit => Integer(args.first))\n end", "title": "" }, { "docid": "362b1152f7722ee14f89b150481f52dd", "score": "0.6026643", "text": "def apply_limit\n if @limit.nil? || @limit.zero?\n modified_select.limit_option = :LIMIT_OPTION_DEFAULT\n modified_select.limit_count = nil\n else\n modified_select.limit_option = :LIMIT_OPTION_COUNT\n modified_select.limit_count = make_int_value_node(@limit)\n end\n end", "title": "" }, { "docid": "360038cbc761ae46a967a148dc84c9cc", "score": "0.6020827", "text": "def select_limit_sql(sql)\n return unless @opts[:from]\n l = @opts[:limit]\n o = @opts[:offset]\n if l || o\n sql << \" LIMIT \"\n if o\n literal_append(sql, o)\n if l\n sql << ', '\n literal_append(sql, l)\n else\n # Hope you don't have more than 2**32 + offset rows in your dataset\n sql << \",4294967295\"\n end\n else\n literal_append(sql, l)\n end\n end\n end", "title": "" }, { "docid": "d4fc47439c1a33c72ceb76e0873f9cbe", "score": "0.60192245", "text": "def select_limit_sql(sql)\n return unless opts[:from]\n super\n end", "title": "" }, { "docid": "d4fc47439c1a33c72ceb76e0873f9cbe", "score": "0.60192245", "text": "def select_limit_sql(sql)\n return unless opts[:from]\n super\n end", "title": "" }, { "docid": "cee2d9bfe3239b5f4c86f8b66be22778", "score": "0.59899133", "text": "def limit(limit)\n @limit = limit\n self\n end", "title": "" }, { "docid": "cee2d9bfe3239b5f4c86f8b66be22778", "score": "0.59899133", "text": "def limit(limit)\n @limit = limit\n self\n end", "title": "" }, { "docid": "13042e054fe41ad60c3e1be746852177", "score": "0.59885335", "text": "def limit_results\n self.scope = scope.limit(Settings.CONSTANTS.PAGINATION.MAX_LIMIT)\n end", "title": "" }, { "docid": "f504adad9a1ec189ab56ed4a7b9876ad", "score": "0.5978293", "text": "def limit(limit)\n record_limit(limit)\n end", "title": "" }, { "docid": "f504adad9a1ec189ab56ed4a7b9876ad", "score": "0.5978293", "text": "def limit(limit)\n record_limit(limit)\n end", "title": "" }, { "docid": "0215634356069d5d6984c8f888748028", "score": "0.5971924", "text": "def result_limit(offset, limit)\n # we create a new object in case the user wants to store off the\n # filter chain and reuse it later\n APIParameterFilter.new(self.target, @parameters.merge({ :result_offset => offset, :result_limit => limit }))\n end", "title": "" }, { "docid": "10547604a1767f16ad28cdb21a9afb43", "score": "0.5966421", "text": "def select_limit_sql(sql)\n if o = @opts[:offset]\n sql << \" OFFSET \"\n literal_append(sql, o)\n sql << \" ROWS\"\n end\n if l = @opts[:limit]\n sql << \" FETCH FIRST \"\n literal_append(sql, l)\n sql << \" ROWS ONLY\"\n end\n end", "title": "" }, { "docid": "3d44189162db8db872abb2aa2f2fa9aa", "score": "0.5960981", "text": "def limit(*args)\n new(dataset.__send__(__method__, *args))\n end", "title": "" }, { "docid": "604ea27e27237ee829b41a56d9706dfe", "score": "0.5934829", "text": "def limit(value = 20)\n clone.tap { |crit| crit.options[:limit] = value }\n end", "title": "" }, { "docid": "da4075ba60078e765a66f65c89a9b27e", "score": "0.59292036", "text": "def select_limit_sql(sql)\n strategy = db.offset_strategy\n return super if strategy == :limit_offset\n\n if strategy == :offset_fetch && (o = @opts[:offset]) \n sql << \" OFFSET \"\n literal_append(sql, o)\n sql << \" ROWS\"\n end\n\n if l = @opts[:limit]\n if l == 1\n sql << \" FETCH FIRST ROW ONLY\"\n else\n sql << \" FETCH FIRST \"\n literal_append(sql, l)\n sql << \" ROWS ONLY\"\n end\n end\n end", "title": "" }, { "docid": "46fd3554860c82d5eb936011159e5c85", "score": "0.59095424", "text": "def limit(value)\n fresh.tap do |criteria|\n criteria.limit_value = value.to_i\n end\n end", "title": "" }, { "docid": "045c05669b14cb54a0c84b835a9016ca", "score": "0.5904261", "text": "def limit(value)\n self.limiting = value\n self\n end", "title": "" }, { "docid": "045c05669b14cb54a0c84b835a9016ca", "score": "0.5904261", "text": "def limit(value)\n self.limiting = value\n self\n end", "title": "" }, { "docid": "c34357e711d077f59232b12a6457603a", "score": "0.589769", "text": "def select_limit_sql(sql)\n if auto_param?(sql) && (@opts[:limit] || @opts[:offset])\n sql.skip_auto_param{super}\n else\n super\n end\n end", "title": "" }, { "docid": "73cc7eed55e6e2dfac98cc7833b12174", "score": "0.58819747", "text": "def limit(value)\n clone.tap do |r|\n r.per_page_value = value\n end\n end", "title": "" }, { "docid": "ba396a4176957865c01562179f9d16ae", "score": "0.5878999", "text": "def take(limit)\n new(sorted.take(limit))\n end", "title": "" }, { "docid": "c8c56d04b42ce48758b418ecb5b84596", "score": "0.5871839", "text": "def limit value\n @limit = value\n self\n end", "title": "" }, { "docid": "3ee4f69012afb853e91bc14e7a97a5c9", "score": "0.5864519", "text": "def limit=(limit); end", "title": "" }, { "docid": "d6cc1edf112c254e4c3db3e0a9b3cccd", "score": "0.5837633", "text": "def limit(value)\n clone.tap do |r|\n r.per_page_value = value.to_i\n end\n end", "title": "" }, { "docid": "6c56ab9b59b397dba63aebc0b658b4a2", "score": "0.58288425", "text": "def limit_results_to(count)\n @limit = count\n end", "title": "" }, { "docid": "efac1c63ee5dc416fd9ac36e670ec340", "score": "0.5817861", "text": "def select_limit_sql(sql)\n if l = @opts[:limit]\n if l == 1\n sql << \" FETCH FIRST ROW ONLY\"\n elsif l > 1\n sql << \" FETCH FIRST \"\n literal_append(sql, l)\n sql << \" ROWS ONLY\"\n end\n end\n end", "title": "" }, { "docid": "13ced8c510c5add7bf3325a2723ac4aa", "score": "0.5809786", "text": "def limit!(size, offset = 0)\n @_limit = Babik::QuerySet::Limit.new(size, offset)\n self\n end", "title": "" }, { "docid": "de6308bd260ee9b65d5052abc3215e07", "score": "0.5802503", "text": "def limit\n operation.limit\n end", "title": "" }, { "docid": "fea2f67950de56365e3f5068d277a3df", "score": "0.5766982", "text": "def limit count\n self\n end", "title": "" }, { "docid": "794840ca72cec3d9dae631b0ef599440", "score": "0.57591355", "text": "def limitTo(num)\n if r = ref\n is_left = r.queryParams && r.queryParams.queryObject[\"vf\"] == \"l\"\n new_ref = is_left ? r.freshRef.queryLimitedToFirst(num) : r.freshRef.queryLimitedToLast(num)\n self.ref = new_ref\n end\n end", "title": "" }, { "docid": "fc0ee38eef0dc0e31d608b32cf01e1fb", "score": "0.57590765", "text": "def limit(limit)\n @builder[:limit] = limit\n self\n end", "title": "" }, { "docid": "45ef8f36542d7bbf4ca818cb4313dbb5", "score": "0.5757245", "text": "def set_limit(relation, limit_value); end", "title": "" }, { "docid": "2beb9f29fd4f94cf75b231b3d52e7eb4", "score": "0.57485175", "text": "def limit(limit)\n fail ArgumentError, \"Invalid limit given: #{limit}\" unless limit > 0\n\n self.stored_limit = limit\n self\n end", "title": "" }, { "docid": "869195ace92673e8b9696c366cdcde73", "score": "0.57445425", "text": "def limit(n)\n where(limit_param => n)\n end", "title": "" }, { "docid": "563aa6c37725ac96d345da601599de06", "score": "0.57400346", "text": "def limit int\n @limit = int\n self\n end", "title": "" }, { "docid": "a5d256d6d33b503025cd4729be855c4e", "score": "0.5719103", "text": "def limit(limit = nil)\n configure(:limit, limit)\n end", "title": "" }, { "docid": "362d4f61cdaf926370ed7a09bdad3ffe", "score": "0.57146335", "text": "def optimize\n operand.operand.take(min_limit)\n end", "title": "" }, { "docid": "da2f95ce361aaeb84a72818d67998df5", "score": "0.57093364", "text": "def limit(n)\n\t Query.new(self).limit(n)\n\t end", "title": "" }, { "docid": "0e05ce249b93b179c0999306aa22f2d5", "score": "0.570562", "text": "def compound_from_self\n if @opts[:offset] && !@opts[:limit] && !is_2012_or_later?\n clone(:limit=>LIMIT_ALL).from_self\n elsif @opts[:order] && !(@opts[:sql] || @opts[:limit] || @opts[:offset])\n unordered\n else\n super\n end\n end", "title": "" }, { "docid": "0229c13ed2ab8d7467f1ee8f986a2e45", "score": "0.5695418", "text": "def add_limit_offset!(sql, options)\n @logger.unknown(\"ODBCAdapter#add_limit_offset!>\") if @@trace\n @logger.unknown(\"args=[#{sql}]\") if @@trace\n if limit = options[:limit] then sql << \" LIMIT #{limit}\" end\n if offset = options[:offset] then sql << \" OFFSET #{offset}\" end\n end", "title": "" }, { "docid": "ef8ebcf4dfe686d45f7b7a4a8101a93b", "score": "0.5689108", "text": "def take(limit = T.unsafe(nil)); end", "title": "" }, { "docid": "ef8ebcf4dfe686d45f7b7a4a8101a93b", "score": "0.5689108", "text": "def take(limit = T.unsafe(nil)); end", "title": "" }, { "docid": "4de424de24d12fc70d94f6180752f129", "score": "0.567632", "text": "def limit(limit)\n @params[:limit] = \"#{limit}\"\n self\n end", "title": "" }, { "docid": "d85d10427f523e5e47e61387da8e85e3", "score": "0.56715983", "text": "def limit(value); end", "title": "" } ]
6c1d3c4ebc8271e178c2bd6f050bd931
Interrupt callback. Default is to rethrow the error.
[ { "docid": "e62d6cad739cc08488089164fa202d1f", "score": "0.78127074", "text": "def interrupt(ex)\n raise ex\n end", "title": "" } ]
[ { "docid": "f13bd98bde12492472306628123b87af", "score": "0.69893223", "text": "def interrupt!\n @interrupted = true\n end", "title": "" }, { "docid": "cf86e20e8d99e582e8d82f2e18385547", "score": "0.68582815", "text": "def do_with_interrupt_handling\n yield if block_given?\n rescue StandardError => e\n warn HighLine.color(\"\\nAborting, fatal #{e.class}, #{e} at #{error_call_site(e)}\", :red)\n Kernel.exit(3)\n rescue Interrupt\n warn HighLine.color(\"\\nAborting, interrupt received\", :red)\n Kernel.exit(2)\n rescue RuntimeError => e\n warn HighLine.color(\"\\nAborting, fatal unhandled error, #{e} at #{error_call_site(e)}\", :red)\n Kernel.exit(1)\n end", "title": "" }, { "docid": "e47984d1067dbf51dd810c1edb9381a9", "score": "0.68003225", "text": "def interrupt!\n @interrupted = true\n logger.info \"Interrupted, terminating...\"\n end", "title": "" }, { "docid": "a4e1ca66cad16539fb124d0b44256a54", "score": "0.6652706", "text": "def interrupt!\n @mutex.synchronize do\n case @blocked\n when NOT_YET, BLOCKED\n @result = INTERRUPTED\n @cond.broadcast\n else\n return\n end\n end\n end", "title": "" }, { "docid": "a4e1ca66cad16539fb124d0b44256a54", "score": "0.6652706", "text": "def interrupt!\n @mutex.synchronize do\n case @blocked\n when NOT_YET, BLOCKED\n @result = INTERRUPTED\n @cond.broadcast\n else\n return\n end\n end\n end", "title": "" }, { "docid": "81529d81795266be93277f27193c3ad0", "score": "0.6580412", "text": "def run_interrupted; end", "title": "" }, { "docid": "fdfc10277ee330b4906b8850febbf709", "score": "0.6558655", "text": "def handle_interrupt; end", "title": "" }, { "docid": "c8200a45d01dd40261836b58fb819cbf", "score": "0.65303874", "text": "def abort_on_exception(*) end", "title": "" }, { "docid": "fa3aede9373deebe5e38cb4c7139ce90", "score": "0.6504576", "text": "def interrupt\n current_context.interrupt\n end", "title": "" }, { "docid": "ffbab62a5f270b4b2efaef4338984293", "score": "0.6502036", "text": "def cancel\n throw(:abort)\n end", "title": "" }, { "docid": "bb710addddf6a645fdcb0b12cd269cdc", "score": "0.64838266", "text": "def abort!\n throw :abort!, :aborted\n end", "title": "" }, { "docid": "71530ca0f5ac09cc9b46c14352ff75f0", "score": "0.6437886", "text": "def interrupt; end", "title": "" }, { "docid": "ff8384af6541be832c092ceab4b5db6c", "score": "0.64374024", "text": "def interrupt_handler\n signal_handler(2)\n end", "title": "" }, { "docid": "bc4755d7196e614260bf350931a36685", "score": "0.6415077", "text": "def handle_interrupt\n case @interrupt\n when :signal\n Process.kill('SIGINT', Process.pid)\n when :exit\n exit(130)\n when Proc\n @interrupt.call\n when :noop\n return\n else\n raise InputInterrupt\n end\n end", "title": "" }, { "docid": "26c5dfe95a57adc7c0deb923c83db45a", "score": "0.6386237", "text": "def interrupt?; end", "title": "" }, { "docid": "6e75c3809cec6d24b46e04157ff4e676", "score": "0.6352384", "text": "def abort_on_exception=(_arg0); end", "title": "" }, { "docid": "5d122d53468b9519915d7a81417d49a5", "score": "0.63419694", "text": "def interrupt\n user_interrupt or true\n end", "title": "" }, { "docid": "674bfa004e5baa5d19db411e44100f40", "score": "0.6336939", "text": "def _interrupt\n\t\tbegin\n\t\t\tuser_want_abort?\n\t\trescue Interrupt\n\t\t\t# The user hit ctrl-c while we were handling a ctrl-c, send a\n\t\t\t# literal ctrl-c to the shell. XXX Doesn't actually work.\n\t\t\t#$stdout.puts(\"\\n[*] interrupted interrupt, sending literal ctrl-c\\n\")\n\t\t\t#$stdout.puts(run_cmd(\"\\x03\"))\n\t\tend\n\tend", "title": "" }, { "docid": "1408f5d9a274a907cddce08cbda21298", "score": "0.6307842", "text": "def push_interrupt(e); end", "title": "" }, { "docid": "c92790d56303630c2fe034a2cde6a830", "score": "0.6256124", "text": "def execute_with_rescue\n yield if block_given?\n rescue Interrupt\n rescue_interrupt\n rescue => error\n log_error(error)\n end", "title": "" }, { "docid": "258822e49d25593351846633eb85599f", "score": "0.6239909", "text": "def abort_on_exception=(*) end", "title": "" }, { "docid": "42aee17bf299b4f3a68d2f8fff54f8b5", "score": "0.6154219", "text": "def with_repl_like_sigint\n orig_handler = trap(\"INT\") { raise Interrupt }\n yield\n rescue Interrupt\n puts(\"^C\")\n retry\n ensure\n trap(\"INT\", orig_handler)\n end", "title": "" }, { "docid": "ce6018509cfa5fd6e04d64f0b0832e24", "score": "0.61522156", "text": "def interrupt\n\t\t\t@interrupted = true\n\t\t\t@selector&.wakeup\n\t\tend", "title": "" }, { "docid": "ae0297196e2b49e895d0f210667946ab", "score": "0.6089462", "text": "def reenable_on_interrupt=(_arg0); end", "title": "" }, { "docid": "6a305f5e23ca12b194db3e18d733dfe3", "score": "0.6082419", "text": "def abort\n # only abort once\n self.stop\n\n # assume that the thread has abort_on_exception and it does not rescue non-StandardError\n @thread.raise Abort, \"ABORT #{@subject} watchdog timeout\"\n end", "title": "" }, { "docid": "8b0dfb22285bf75dc1224966bc21e3e8", "score": "0.6058001", "text": "def interrupt\n SQLite::API.interrupt( @handle )\n end", "title": "" }, { "docid": "8c1572a717d44737579b8df04b252851", "score": "0.6040196", "text": "def interrupt\n\t\t\t@interrupted = true\n\t\t\[email protected]\n\t\tend", "title": "" }, { "docid": "ced4bbf21ee603b6d36bd68d6190fac1", "score": "0.60154283", "text": "def abort!(message)\n error(message)\n exit 1\n end", "title": "" }, { "docid": "54e312cab19e873662fdcc74d4e9fd3d", "score": "0.59731185", "text": "def reenable_on_interrupt; end", "title": "" }, { "docid": "8e3a42388bfc759cfde1d754bd67f5b6", "score": "0.59364134", "text": "def abort_on_exception=(val)\n @abort_on_exception = val\n end", "title": "" }, { "docid": "7547c4c0173252a0d3fdb6cc09aeb4bc", "score": "0.59180605", "text": "def rescue_interrupt\n `stty icanon echo`\n puts \"\\n Command was cancelled due to an Interrupt error.\"\n end", "title": "" }, { "docid": "43c4e248bbea04b1125fe507e9e1225b", "score": "0.5913054", "text": "def abort; end", "title": "" }, { "docid": "43c4e248bbea04b1125fe507e9e1225b", "score": "0.5913054", "text": "def abort; end", "title": "" }, { "docid": "43c4e248bbea04b1125fe507e9e1225b", "score": "0.5913054", "text": "def abort; end", "title": "" }, { "docid": "ada1af922429216c896e764aad53a045", "score": "0.5908034", "text": "def abort!(msg)\n @log.error msg\n exit\nend", "title": "" }, { "docid": "f97f3b3ec1eacc9909952ca518eb5c1f", "score": "0.5905849", "text": "def abort(*rest) end", "title": "" }, { "docid": "f6253b0ee34f3dd3a5fd660a249ca9da", "score": "0.5896647", "text": "def abort(s)\n report_error(s)\n exit 1\nend", "title": "" }, { "docid": "f6253b0ee34f3dd3a5fd660a249ca9da", "score": "0.5896647", "text": "def abort(s)\n report_error(s)\n exit 1\nend", "title": "" }, { "docid": "f6253b0ee34f3dd3a5fd660a249ca9da", "score": "0.5896647", "text": "def abort(s)\n report_error(s)\n exit 1\nend", "title": "" }, { "docid": "79cc271ccb94af2dfb6fc22b728f86e8", "score": "0.58614975", "text": "def pop_interrupt; end", "title": "" }, { "docid": "3bdcc413ca6e19c8ad416df956c7b461", "score": "0.5861207", "text": "def abort(message)\n warn message\n exit 1\nend", "title": "" }, { "docid": "3bdcc413ca6e19c8ad416df956c7b461", "score": "0.5861207", "text": "def abort(message)\n warn message\n exit 1\nend", "title": "" }, { "docid": "a7b3ff9ba44b0b772a7b2dc2c967dc00", "score": "0.5859941", "text": "def stop!\n throw :return, 1\n end", "title": "" }, { "docid": "6eca1ee733588de1867c81572cb7a7d2", "score": "0.5813196", "text": "def interrupt_exception\n\t\t\tm = Module.new\n\t\t\t(class << m; self; end).instance_eval do\n\t\t\t\tdefine_method(:===){|e|\n\t\t\t\t\te.message =~ /interrupt/i || e.class == Curl::Err::MultiBadEasyHandle\n\t\t\t\t}\n\t\t\tend\n\t\t\tm\n\t\tend", "title": "" }, { "docid": "98d6f9f700955f0d738818ba5e4692f6", "score": "0.5768356", "text": "def on_abort &proc\n @abort_hadnler = proc\n end", "title": "" }, { "docid": "b5a769dc38e9ff223ffe421615fd903a", "score": "0.57364076", "text": "def cancel\n @error = :cancelled\n end", "title": "" }, { "docid": "67fb6db7ab55f26e29d5f9e30e5c8679", "score": "0.5710883", "text": "def abort(msg)\n logger.error msg\n exit 1\n end", "title": "" }, { "docid": "68454c1c9a7f87c0efe00932c3db50c8", "score": "0.5705593", "text": "def abort ; conclude(false) ; end", "title": "" }, { "docid": "fe2dd1dc4ad608623ccb415cebb2d369", "score": "0.569269", "text": "def user_interrupt\n write 'Terminating' # XXX get rid of this\n stoploop\n end", "title": "" }, { "docid": "1f8cf9332cc1bea082d049841a3675b7", "score": "0.5692475", "text": "def abort(reason)\n debug [:abort, reason]\n close_connection\n end", "title": "" }, { "docid": "0db6cda25172fb84b73bb4cec2b481a5", "score": "0.5670465", "text": "def emit_cancel sid, error\n @cancel_proc.call sid, error if @cancel_proc\n end", "title": "" }, { "docid": "608f0e5d8955e3970a4f3222fd4df8e5", "score": "0.56617063", "text": "def cancel_event(msg = nil)\n raise CallbackError.new(msg)\n end", "title": "" }, { "docid": "bbdb7fb4a19e09d0cdc997aeae77be14", "score": "0.5654078", "text": "def abort(msg)\n puts msg\n exit(1)\nend", "title": "" }, { "docid": "6f4251726c3d9ce6aabd164fb88f4370", "score": "0.5643024", "text": "def abort_with(topic, message = nil, &block)\n error(topic, message, &block)\n abort\n end", "title": "" }, { "docid": "8ef8ec7287433cfc0e4db0dcad59bd06", "score": "0.56187844", "text": "def abort\n unless @finished\n do_abort\n end\n end", "title": "" }, { "docid": "c5bc23df370c9caa07d27898c4374b38", "score": "0.5617559", "text": "def cancel\n self.solved(:abort)\n end", "title": "" }, { "docid": "78837be9144b2729070105eb78b30c44", "score": "0.5535192", "text": "def abort\n synchronize do\n @aborted = true\n @buf.clear\n end\n end", "title": "" }, { "docid": "3ea5d27b8da46f364f4ca83c668850af", "score": "0.55293345", "text": "def aborting=(_arg0); end", "title": "" }, { "docid": "f8f85c98f3091d94819dc25a77883483", "score": "0.55055654", "text": "def abort!\n update aborted_at: Time.now.utc\n end", "title": "" }, { "docid": "872a049003a89ef47ac07d8d12ca2239", "score": "0.55020666", "text": "def raise_exception_on_sigterm(answer = T.unsafe(nil)); end", "title": "" }, { "docid": "197da64ceb18f6acc03f359ce74bd772", "score": "0.55004126", "text": "def abort_test!\n throw 'abort_test!'\n end", "title": "" }, { "docid": "49881fc71d1da1562200cfb61d618d47", "score": "0.5485899", "text": "def cancel\n self.break_condition = 1\n end", "title": "" }, { "docid": "4d5130d49caba6d868f2d8463972bc9c", "score": "0.54748607", "text": "def run(&block)\n raise \"#{self} cannot run; it was permanently killed.\" if @dead\n \n super do |socket, revents|\n if socket == @int_sock_rep || socket == @int_sock_pull\n key, * = socket.recv_array\n kill = key == \"KILL\"\n blocking = socket == @int_sock_rep\n \n # Call the user block of #interrupt and store the return value\n unless kill\n result = @interruptions.pop.call\n @outerruptions.push result if blocking\n end\n \n # Call the user block of #run\n block.call nil, nil if block\n \n # Send a response if the interruption was blocking\n socket.send_array [\"OKAY\"] if blocking\n \n if kill\n @int_sock_rep.close\n @int_sock_pull.close\n @dead = true\n end\n else\n block.call socket, revents if block\n end\n end.tap do |hash|\n hash.delete @int_sock_rep\n hash.delete @int_sock_pull\n end\n end", "title": "" }, { "docid": "1c017eb73b3ea2e6cdcb7da52b1cb397", "score": "0.5473475", "text": "def add_irb_trap\n Merb.trap(\"INT\") do\n if @interrupted\n Merb.logger.warn! \"Interrupt received a second time, exiting!\\n\"\n exit\n end\n\n @interrupted = true\n Merb.logger.warn! \"Interrupt a second time to quit.\"\n Kernel.sleep 1.5\n ARGV.clear # Avoid passing args to IRB\n\n if @irb.nil?\n require \"irb\"\n IRB.setup(nil)\n @irb = IRB::Irb.new(nil)\n IRB.conf[:MAIN_CONTEXT] = @irb.context\n end\n\n Merb.trap(:INT) { @irb.signal_handle }\n catch(:IRB_EXIT) { @irb.eval_input }\n\n Merb.logger.warn! \"Exiting from IRB mode back into server mode.\"\n @interrupted = false\n add_irb_trap\n end\n end", "title": "" }, { "docid": "9fccd8bf2513f7b4a5c5bf9e325a2767", "score": "0.54510516", "text": "def abort( msg )\n @log.fatal msg\n exit 1\n end", "title": "" }, { "docid": "3e7fe455f6c0e42acc1a26201ccbb203", "score": "0.54352874", "text": "def call(error)\n cause = error\n case error\n when ContextualError\n cause = error.cause\n @terminal.puts(cause_string(cause))\n @terminal.puts(context_string(error), :bold)\n when ::Interrupt\n @terminal.puts\n @terminal.puts(\"INTERRUPTED\", :bold)\n else\n @terminal.puts(cause_string(error))\n end\n exit_code_for(cause)\n end", "title": "" }, { "docid": "5c42abf55188674e2a2bf3b56079b70a", "score": "0.5432578", "text": "def exit(ret = 0)\n IRB.irb_exit(@irb, ret)\n rescue UncaughtThrowError\n super\n end", "title": "" }, { "docid": "073fa6822e9d938a46bab23e2b120e29", "score": "0.5427902", "text": "def abort\n return unless @running\n @loop = nil\n @abort = true\n @running = false\n end", "title": "" }, { "docid": "d6760b998a3032177f1f76af92de9ba9", "score": "0.54150814", "text": "def abort(message, *extras)\n extras << { :color => :red }\n warn message, *extras\n exit 1\n end", "title": "" }, { "docid": "8900e61006275ae2708ac552be1efb80", "score": "0.54069084", "text": "def abort( msg )\n @log.fatal msg\n exit 1\n end", "title": "" }, { "docid": "fb7e884aaa8832f863553ae4b9ccd9ed", "score": "0.538914", "text": "def interrupt!(start_date)\n update_attribute('interrupted_on', start_date)\n end", "title": "" }, { "docid": "6717e49b1d1710e61108a497effc7664", "score": "0.53795487", "text": "def on_interrupt(&block)\n trap(\"INT\") { yield \"SIGINT\" }\n trap(\"QUIT\") { yield \"SIGQUIT\" }\n trap(\"TERM\") { yield \"SIGTERM\" }\n end", "title": "" }, { "docid": "c711a3f289e753155ff0761340c69986", "score": "0.5378988", "text": "def detect_interruption\n trap('INT') do\n interrupted!\n puts\n puts 'Hold on, let me finish this file...'\n end\n end", "title": "" }, { "docid": "8347aa91873ade2ccd8b3cb1b17d7350", "score": "0.53587633", "text": "def cancel_multi ()\n raise Exception, 'not implemented'\n end", "title": "" }, { "docid": "5e47364a3b902d91972edd775286d140", "score": "0.5342125", "text": "def cancel\n super\n end", "title": "" }, { "docid": "5e47364a3b902d91972edd775286d140", "score": "0.5342125", "text": "def cancel\n super\n end", "title": "" }, { "docid": "5e47364a3b902d91972edd775286d140", "score": "0.5342125", "text": "def cancel\n super\n end", "title": "" }, { "docid": "391a6a2258edb9cf00fcbd4a8c733bca", "score": "0.5341148", "text": "def cancel\n super\nend", "title": "" }, { "docid": "a0e9f219b67ed56c06809cea2ea08ee3", "score": "0.53327525", "text": "def halt\n throw :halt\n end", "title": "" }, { "docid": "ed19f784297b5ee7fd40db7b7c7a9efe", "score": "0.53213817", "text": "def pass_exception\n throw :next_exception_handler\n end", "title": "" }, { "docid": "30f8b0220225637acd5b65159a0066b4", "score": "0.52964556", "text": "def cancel\n # TODO: That thing I'm claiming to do in the comments\n super\n end", "title": "" }, { "docid": "32b02aa4dbf71c0193ca5f9836c873c0", "score": "0.52884734", "text": "def cancel\n raise CancelInterpolation.new\n end", "title": "" }, { "docid": "e1e3f47bf6746ba177bb2f0c6f8b0abc", "score": "0.5286766", "text": "def on_program_interrupt(&callback)\n @on_signal << callback\n self\n end", "title": "" }, { "docid": "47fa99dece77678700aa23e1d125b767", "score": "0.5256741", "text": "def abort( msg )\n\t$stderr.puts( msg )\n\texit 1\nend", "title": "" }, { "docid": "ed0e729416c32db196e9e1043c5743d1", "score": "0.5253682", "text": "def keep_it_in\n raise \"rawr\"\nrescue\n # ahem\nend", "title": "" }, { "docid": "2cd2c2688b7482ce62065bbc1f0e4362", "score": "0.52529", "text": "def cancel\n super\n end", "title": "" }, { "docid": "2cd2c2688b7482ce62065bbc1f0e4362", "score": "0.52529", "text": "def cancel\n super\n end", "title": "" }, { "docid": "2cd2c2688b7482ce62065bbc1f0e4362", "score": "0.52529", "text": "def cancel\n super\n end", "title": "" }, { "docid": "2cd2c2688b7482ce62065bbc1f0e4362", "score": "0.52529", "text": "def cancel\n super\n end", "title": "" }, { "docid": "2cd2c2688b7482ce62065bbc1f0e4362", "score": "0.52529", "text": "def cancel\n super\n end", "title": "" }, { "docid": "2cd2c2688b7482ce62065bbc1f0e4362", "score": "0.52529", "text": "def cancel\n super\n end", "title": "" }, { "docid": "2cd2c2688b7482ce62065bbc1f0e4362", "score": "0.52529", "text": "def cancel\n super\n end", "title": "" }, { "docid": "2cd2c2688b7482ce62065bbc1f0e4362", "score": "0.52529", "text": "def cancel\n super\n end", "title": "" }, { "docid": "2cd2c2688b7482ce62065bbc1f0e4362", "score": "0.52529", "text": "def cancel\n super\n end", "title": "" }, { "docid": "2cd2c2688b7482ce62065bbc1f0e4362", "score": "0.52529", "text": "def cancel\n super\n end", "title": "" }, { "docid": "2cd2c2688b7482ce62065bbc1f0e4362", "score": "0.52529", "text": "def cancel\n super\n end", "title": "" }, { "docid": "2cd2c2688b7482ce62065bbc1f0e4362", "score": "0.52529", "text": "def cancel\n super\n end", "title": "" }, { "docid": "2cd2c2688b7482ce62065bbc1f0e4362", "score": "0.52529", "text": "def cancel\n super\n end", "title": "" }, { "docid": "2cd2c2688b7482ce62065bbc1f0e4362", "score": "0.52529", "text": "def cancel\n super\n end", "title": "" }, { "docid": "2cd2c2688b7482ce62065bbc1f0e4362", "score": "0.52529", "text": "def cancel\n super\n end", "title": "" } ]
dee3e1aa3ab259f7a0019b1c04e43001
Sets the car color to white as a default, tank as full, resets the distance Increments the total car count and most popular color for the class
[ { "docid": "d7ebf91f180b21a78d32bec3bd6926d2", "score": "0.72677714", "text": "def initialize(color = \"white\")\n\t\t@fuel = 10\n\t\t@distance = 0\n\t\t@color = color\n\t\t@@total_car_count += 1\n\t\tif @@car_colors.include?(color)\n\t\t\t@@car_colors[color] += 1\n\t\telse\n\t\t\t@@car_colors.merge!(color => 1)\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "c37823f98fc808ee563b3374fe377b7c", "score": "0.6577933", "text": "def paint_car(new_paint_color)\n\t\tnew_paint_color.captialize!\n\n\t\t@@cars_per_color.each_key { |color| \n\t\t\tif color == new_paint_color\n\t\t\t\t@@cars_per_color[color] += 1\n\t\t\telse\n\t\t\t\t@@cars_per_color[new_paint_color] = 1\t\n\t\t\tend\n\t\t}\n\t\t\n\t\t@@cars_per_color[@car_color] -= 1\n\t\t@car_color = new_paint_color\n\tend", "title": "" }, { "docid": "4064f56cc2d450f3d333b059c768f8cb", "score": "0.575222", "text": "def update_color_for_count(count)\n if count > 0\n proportion = count / Time.secsIn25Mins.to_f\n color = UIColor.new_from_two_colors(UIColor.pomo_red_color, UIColor.pomo_green_color, proportion)\n else\n color = UIColor.pomo_grey_color\n end\n self.color = color\n end", "title": "" }, { "docid": "d8228773abad248a695f4bf5b840f8c3", "score": "0.5739533", "text": "def jump_to_color(distance)\n current_hsl = rgb_to_hsl\n new_hsl = []\n current_sector=get_sector_info_by_hsl(current_hsl[Constants::HSL_H])\n new_sector=get_sector_info_by_sector((current_sector[Constants::Col_number]+distance)%12)\n \n divisor=(current_sector[Constants::Col_max_H]-current_sector[Constants::Col_min_H])/30.0\n current_position=(current_hsl[Constants::HSL_H]-current_sector[Constants::Col_min_H])/divisor\n \n saturation_difference = current_hsl[Constants::HSL_S]/((current_sector[Constants::Col_min_S]+current_sector[Constants::Col_max_S])/2) \n lightness_difference = current_hsl[Constants::HSL_L]/((current_sector[Constants::Col_min_L]+current_sector[Constants::Col_max_L])/2)\n \n #Hue\n new_hsl[Constants::HSL_H]=new_sector[Constants::Col_min_H]+((new_sector[Constants::Col_max_H]-new_sector[Constants::Col_min_H]).abs/30.0)*current_position\n #Saturation\n if new_sector[Constants::Col_min_S]>new_sector[Constants::Col_max_S]\n new_hsl[Constants::HSL_S]=new_sector[Constants::Col_min_S]-((new_sector[Constants::Col_max_S]-new_sector[Constants::Col_min_S]).abs/30.0)*current_position\n else\n new_hsl[Constants::HSL_S]=new_sector[Constants::Col_min_S]+((new_sector[Constants::Col_max_S]-new_sector[Constants::Col_min_S]).abs/30.0)*current_position\n end\n #Lightness\n if new_sector[Constants::Col_min_L]>new_sector[Constants::Col_max_L]\n new_hsl[Constants::HSL_L]=new_sector[Constants::Col_min_L]-((new_sector[Constants::Col_max_L]-new_sector[Constants::Col_min_L]).abs/30.0)*current_position\n else\n new_hsl[Constants::HSL_L]=new_sector[Constants::Col_min_L]+((new_sector[Constants::Col_max_L]-new_sector[Constants::Col_min_L]).abs/30.0)*current_position \n end\n \n new_hsl[Constants::HSL_S]*=saturation_difference\n new_hsl[Constants::HSL_L]*=lightness_difference\n \n new_hsl[Constants::HSL_S]= new_hsl[Constants::HSL_S]>100 ? 100 : new_hsl[Constants::HSL_S]\n new_hsl[Constants::HSL_L]= new_hsl[Constants::HSL_L]>100 ? 100 : new_hsl[Constants::HSL_L]\n \n new_rgb = hsl_to_rgb(new_hsl)\n \n return Colour.new(new_rgb[0],new_rgb[1],new_rgb[2])\n \n end", "title": "" }, { "docid": "1ef76eb4a723b7b1e0c552b56806c6b6", "score": "0.5725562", "text": "def set_lazy_color\n if self.card_type.include? \"Land\" or self.name.include? \"token card\"\n #binding.pry\n self.update_attributes(:lazy_color => 8)\n elsif self.color.size > 1\n self.update_attributes(:lazy_color => 6)\n else\n case self.color[0]\n when \"White\"\n self.update_attributes(:lazy_color => 1)\n when \"Blue\"\n self.update_attributes(:lazy_color => 2)\n when \"Black\"\n self.update_attributes(:lazy_color => 3)\n when \"Red\"\n self.update_attributes(:lazy_color => 4)\n when \"Green\"\n self.update_attributes(:lazy_color => 5)\n when \"Colorless\"\n self.update_attributes(:lazy_color => 7)\n end\n end\n end", "title": "" }, { "docid": "f3479632bfec5a9bde9b61186bc70add", "score": "0.5704834", "text": "def update\r\n # @color = Color::WHITE\r\n end", "title": "" }, { "docid": "96b4670ff93ff45bca0868f2589906cd", "score": "0.56927454", "text": "def theater_chase( color, opts = {} )\n wait_ms = opts.fetch(:wait_ms, self.wait_ms)\n iterations = opts.fetch(:iterations, 10)\n spacing = opts.fetch(:spacing, 3)\n\n iterations.times do\n spacing.times do |sp|\n leds.clear\n (sp...leds.length).step(spacing) { |ii| leds[ii] = color }\n leds.show\n sleep(wait_ms / 1000.0)\n end\n end\n\n self\n end", "title": "" }, { "docid": "9afb173b051fe1e46fb78f2e3833497b", "score": "0.5645182", "text": "def reset\n @max_color_distance = @color_distance_limit ? 0 : nil\n @max_shift_distance = @shift_distance_limit ? 0 : nil\n @left = @top = @right = @bottom = nil\n end", "title": "" }, { "docid": "ff5878ceada6606d0855379c0ac77d15", "score": "0.56029075", "text": "def color=(color); end", "title": "" }, { "docid": "ff5878ceada6606d0855379c0ac77d15", "score": "0.56029075", "text": "def color=(color); end", "title": "" }, { "docid": "fc2678faa2fcf61d7d94bcd5ce4cee59", "score": "0.5597393", "text": "def theater_chase( color, opts = {} )\n wait_ms = opts.fetch(:wait_ms, self.wait_ms)\n iterations = opts.fetch(:iterations, 10)\n spacing = opts.fetch(:spacing, 3)\n\n iterations.times do\n spacing.times do |sp|\n self.clear\n (sp...self.length).step(spacing) { |ii| self[ii] = color }\n self.show\n sleep(wait_ms / 1000.0)\n end\n end\n\n self\n end", "title": "" }, { "docid": "ae501efed6d807dbdfd1abfa2a36bf8e", "score": "0.5543642", "text": "def recolor(color)\n @color = color\n self\n end", "title": "" }, { "docid": "97e74b9082656c3e5cc3fb07a5dd990e", "score": "0.5538028", "text": "def initial_color= col; initial_colour = col; end", "title": "" }, { "docid": "7941f72c55170cf127b0c4d680a0fee1", "score": "0.55290115", "text": "def set_color\n end", "title": "" }, { "docid": "4339ed6720a18170db34bd8783e7df48", "score": "0.5514692", "text": "def set_color_depth(depth)\n @standard_nv_pairs['cd'] = depth\n self\n end", "title": "" }, { "docid": "cc4359f26dd02e586a18dfe3dba47ca4", "score": "0.5470841", "text": "def spray_paint=(color)\n self.color = color\n puts \"Car color is now #{color}\"\n end", "title": "" }, { "docid": "948c627b65c9ed9dbd693512b3187c74", "score": "0.5453757", "text": "def vary_colors; end", "title": "" }, { "docid": "4942c8ee59b5eaf000f673015b8f15b7", "score": "0.54412806", "text": "def reset \r\n\t\t@colors_left = 4\r\n\t\t@guess = []\r\n\t\t@guess_bad_position = []\r\n\t\t@black_pegs = 0\r\n\t\t@white_pegs = 0\r\n\tend", "title": "" }, { "docid": "1d1abca03571e96ea0e7e6a21aa764e4", "score": "0.5436315", "text": "def initialize(year, color)\n @year = year\n @color = color\n @odometer = 0\n @num_wheels = 2\n end", "title": "" }, { "docid": "b1c4f1f265f691f484a11f11e0f421cf", "score": "0.54361683", "text": "def set_color_depth(depth)\n @details['cd'] = depth\n self\n end", "title": "" }, { "docid": "c03164bb109b9204ecd6880b6f2e6d8f", "score": "0.5434293", "text": "def increment_fill\n begin\n # increment the fill value. reset value to a certain minimum if it goes over the max gray value.\n @ball_fill = ((@ball_fill += @@INCREMENT_FILL_VAL) > 255 ) ? @@MIN_FILL : @ball_fill += @@INCREMENT_FILL_VAL\n @@GRAYS_USED << @ball_fill unless @@GRAYS_USED.include?(@ball_fill)\n rescue => e\n puts \"error in increment_fill: #{e.message}\"\n end\n end", "title": "" }, { "docid": "08f7baf0952424d6162ffd159e3ca3d1", "score": "0.54206944", "text": "def paint!(new_color)\n @color = new_color\n end", "title": "" }, { "docid": "9f660c916ca7cfbadee40c1a5d8b4ab1", "score": "0.54133517", "text": "def changerStatut(color, forceEnleverRouge)\n if color > Couleur::ILE_9\n if( !forceEnleverRouge && self.name.include?(\"red\") )\n self.name = \"grid-cell-ile-small-red\"\n else\n self.name = \"grid-cell-ile-small\"\n end\n self.set_label(color.to_s)\n elsif color >= Couleur::ILE_1\n if( !forceEnleverRouge && self.name.include?(\"red\") )\n self.name = \"grid-cell-ile-red\"\n else\n self.name = \"grid-cell-ile\"\n end\n self.set_label(color.to_s)\n elsif color == Couleur::NOIR\n if(!forceEnleverRouge && self.name.include?(\"red\"))\n self.name = \"grid-cell-red-block\"\n else\n self.name = \"grid-cell-block\"\n end\n\n self.set_label(\"\")\n\n elsif color == Couleur::GRIS\n self.set_label(\"\")\n if(!forceEnleverRouge && self.name.include?(\"red\"))\n self.name = \"grid-cell-red\"\n else\n self.name = \"grid-cell\"\n end\n elsif color == Couleur::BLANC\n if(!forceEnleverRouge && self.name.include?(\"red\"))\n self.name = \"grid-cell-round-red\"\n else\n self.name = \"grid-cell-round\"\n end\n if(!Sauvegardes.getInstance.getSauvegardeParametre.casesGrises?)\n self.set_label(\"●\")\n else\n self.set_label(\"\")\n end\n end\n end", "title": "" }, { "docid": "5bd0f1f0f3b9b584e709e3da55a10c43", "score": "0.54037046", "text": "def force_colors; end", "title": "" }, { "docid": "5bd0f1f0f3b9b584e709e3da55a10c43", "score": "0.54037046", "text": "def force_colors; end", "title": "" }, { "docid": "6303934c847f8782fda0b3cea3617e6b", "score": "0.5402748", "text": "def spray_paint(new_color)\n self.color = new_color\n puts \"The new color of your car is #{@color}\"\n end", "title": "" }, { "docid": "4a6ab0ede6519409352df40454f3837a", "score": "0.5371012", "text": "def color_depth\n @color_depth ||= 1\n end", "title": "" }, { "docid": "cd47bc60037147782fc56fc2a7605f56", "score": "0.53638923", "text": "def initialize(name, color = \"clear\")\n\t@strength = 100\n\t@color = color\n\t@name = name\n\t@caffeine_level = 100\n\tend", "title": "" }, { "docid": "55717c1b9df08b34358cfc3e8f465a72", "score": "0.5357764", "text": "def theater_chase(color, iterations: 10, spacing: 3)\n iterations.times do\n spacing.times do |sp|\n self.clear\n (sp...length).step(spacing) { |ii| self[ii] = color }\n show\n end\n end\n end", "title": "" }, { "docid": "a1b646d6438f89c281574eaf5848321d", "score": "0.5352427", "text": "def reset\n @color_map = Hash.new(:WHITE)\n end", "title": "" }, { "docid": "a1b646d6438f89c281574eaf5848321d", "score": "0.5352427", "text": "def reset\n @color_map = Hash.new(:WHITE)\n end", "title": "" }, { "docid": "66c2ac4a96334b4a82b64bca5b97c61d", "score": "0.535222", "text": "def go_dark\n @darken = true\n @dark.z = last_z + 1\n end", "title": "" }, { "docid": "dfe30065c07c8601336da5942b91c9ba", "score": "0.5349532", "text": "def initialize(color, brand)\n # instance variables\n # @color represents the color of the instance in question\n @color = color\n @brand = brand\n @wheels = 4\n @year = 2021\n end", "title": "" }, { "docid": "d15f79966c27f1d759767a8aad7a9fa1", "score": "0.5349134", "text": "def color= c\n @color = c\n end", "title": "" }, { "docid": "50a8f4f850e3abf11f1c1df13520c431", "score": "0.5328131", "text": "def colorize!; @colors = true; end", "title": "" }, { "docid": "50a8f4f850e3abf11f1c1df13520c431", "score": "0.5328131", "text": "def colorize!; @colors = true; end", "title": "" }, { "docid": "c4b9eef304a8fa6e579f4215c122a264", "score": "0.5321327", "text": "def vary_colors=(v); end", "title": "" }, { "docid": "1e9e4ca0da5afa4e771a96f40d0cca9b", "score": "0.5316994", "text": "def paint!(color)\n @color = color\n end", "title": "" }, { "docid": "c0fc9460d3f273d6009d94401f26111e", "score": "0.531506", "text": "def fill (color)\n @color = color\n end", "title": "" }, { "docid": "cdcfb9f99d5dc053ad885c69f98e24f2", "score": "0.5285235", "text": "def change_color\n @cur_color = %i[blue green red white yellow].sample\n [\n @changing_button,\n @metal,\n @prog,\n @count_progress\n ].each do |color_changing|\n color_changing&.change_color(@cur_color)\n end\n end", "title": "" }, { "docid": "e830eb4887cae4bb81ac3501e9f9c3f1", "score": "0.527905", "text": "def force_colors=(_arg0); end", "title": "" }, { "docid": "e830eb4887cae4bb81ac3501e9f9c3f1", "score": "0.527905", "text": "def force_colors=(_arg0); end", "title": "" }, { "docid": "166c22ee3406205e4c6e4fc67a9228b8", "score": "0.52732867", "text": "def kick_train_car\n @carriages -= 1 if @speed.zero? && @carriages.count.positive?\n end", "title": "" }, { "docid": "7130ab14f28dfe2dfcc864d777202e5f", "score": "0.5246826", "text": "def spreay_paint(color)\n self.color = color\n puts \"Your car has now been repainted #{color}\"\n end", "title": "" }, { "docid": "c49de6f873c070157c2cd7f58f138ec4", "score": "0.5235746", "text": "def initialize(color, year, model)\n self.color = color\n @year = year # can't call self here because haven't defined setter method for year\n @model = model\n self.current_speed = 0\n @@number_of_vehicles += 1\n puts \"Sweet #{self.color} #{self.year} #{self.model} bro!\"\n end", "title": "" }, { "docid": "0f5508ec0de54a44553f128ea6723688", "score": "0.5217166", "text": "def theater_chase_rainbow( opts = {} )\n wait_ms = opts.fetch(:wait_ms, self.wait_ms)\n spacing = opts.fetch(:spacing, 3)\n\n 256.times do |jj|\n spacing.times do |sp|\n leds.clear\n (sp...leds.length).step(spacing) { |ii| leds[ii] = wheel((ii+jj) % 255) }\n leds.show\n sleep(wait_ms / 1000.0)\n end\n end\n\n self\n end", "title": "" }, { "docid": "c121e9eaacf59caed5e1934757098166", "score": "0.52098745", "text": "def initialize_color\n Ncurses.start_color\n [\n [Color::RED, Ncurses::COLOR_RED],\n [Color::GREEN, Ncurses::COLOR_GREEN],\n [Color::YELLOW, Ncurses::COLOR_YELLOW],\n [Color::BLUE, Ncurses::COLOR_BLUE],\n [Color::MAGENTA, Ncurses::COLOR_MAGENTA],\n [Color::CYAN, Ncurses::COLOR_CYAN],\n [Color::WHITE, Ncurses::COLOR_WHITE]\n ].each do |color, ncurses_color|\n Ncurses.init_pair(color, ncurses_color, Ncurses::COLOR_BLACK)\n end\n end", "title": "" }, { "docid": "31b7102cd7bc5284b7e0bc2b82cc499d", "score": "0.519894", "text": "def spray_paint(color)\n self.color = color\n puts \"My car is now #{color}!\"\n end", "title": "" }, { "docid": "890fe906f2a645abfc361f92d0eca5a7", "score": "0.5180858", "text": "def initialize(color)\n @color = color\n end", "title": "" }, { "docid": "890fe906f2a645abfc361f92d0eca5a7", "score": "0.5180858", "text": "def initialize(color)\n @color = color\n end", "title": "" }, { "docid": "890fe906f2a645abfc361f92d0eca5a7", "score": "0.5180858", "text": "def initialize(color)\n @color = color\n end", "title": "" }, { "docid": "890fe906f2a645abfc361f92d0eca5a7", "score": "0.5180858", "text": "def initialize(color)\n @color = color\n end", "title": "" }, { "docid": "bf8ba50232cc20d2c83a5ba91001c49d", "score": "0.51761067", "text": "def AddSpotColor(name, c, m, y, k)\n if @spot_colors[name].nil?\n i = 1 + @spot_colors.length\n @spot_colors[name] = {'i' => i, 'c' => c, 'm' => m, 'y' => y, 'k' => k}\n end\n end", "title": "" }, { "docid": "2fae4cb980e7e195bf9be36fb266166e", "score": "0.51666397", "text": "def set_color\n self.color = random_hex_color\n end", "title": "" }, { "docid": "e04beaf0b18c1e1fe92581ce92653df5", "score": "0.51640135", "text": "def initialize\n @color = Car::COLORS.first\n # def color # these removed and replaced by attr\n # @color\n # end\n def color= (new_color)\n if !Car::COLORS.include?(new_color)\n raise Exception.new(\"Error - that's not a color\") \n end\n @color = new_color \n end\nend", "title": "" }, { "docid": "7c947cee1a46422849960710acd91f93", "score": "0.51588345", "text": "def red=(v); v = 0 if v < 0; v = 1 if v > 1; @red = v; end", "title": "" }, { "docid": "f09fe6b44c61859db103060119d534f3", "score": "0.5155252", "text": "def colour!(value)\n @value = value\n end", "title": "" }, { "docid": "43fb67d3eee200b8f0a2bbd839290dad", "score": "0.515314", "text": "def initialize(color)\n @warm_blooded = true\n @hungry = true #Instance variable that is only available to the instance of the class.\n @color, @legs = color \n @legs = @@LEGS\n\n end", "title": "" }, { "docid": "84fa98f12fac956e73fd189762dd0bfe", "score": "0.5149277", "text": "def color=(c)\n @color = Color.new(c)\n end", "title": "" }, { "docid": "dfab2e3265da40d5189a99af803904aa", "score": "0.5139159", "text": "def set_color\n\t\tself.color = self.token[0..5].each_char.map{|t| (t.ord * 7 % 16).to_s(16) }.join\n\t\tself.save\n\tend", "title": "" }, { "docid": "072639c5040135dd3a5dfc05d5498a4f", "score": "0.5134591", "text": "def initialize w, max, color = :green\n self.w = w\n self.a = []\n self.max = max\n unless @@c[color] then\n @@c[color] ||= (0..99).map { |n| (\"%s%02d\" % [color, n]).to_sym }.reverse\n end\n self.c = @@c[color]\n end", "title": "" }, { "docid": "3329e6f7cc9f7b15af4261889b72add4", "score": "0.51336694", "text": "def forceColors!()\n\t\t# we force our image to be constitued of 3 colors excactly (white, black, and the gray between cells)\n\t\t@image = @image.trim.posterize(3).trim\n\t\treturn self\n\tend", "title": "" }, { "docid": "6f3c804e8795da20bd90bcaf701c0119", "score": "0.51300764", "text": "def initialize\n puts \"Creating a new car\"\n # Data - Instance variable\n @engine_started = false\n # Data - Instance variable\n @color = \"black\"\n end", "title": "" }, { "docid": "7808a73118cb57d3187174a0958d2a2b", "score": "0.5129988", "text": "def allocate_color\n @current_color = (current_color + 1) % COLORS.size\n COLORS[current_color]\n end", "title": "" }, { "docid": "ce1450750c7b31022786f406cc5cf2c1", "score": "0.51257074", "text": "def next_available_color_index\n if @color_index\n @color_index += 1\n else\n @color_index = FIRST_COLOR_INDEX\n end\n end", "title": "" }, { "docid": "e834b9f1abf3bc3f7aa96a51247e8708", "score": "0.5119579", "text": "def change()\n @col = color(255, 0, 0)\n end", "title": "" }, { "docid": "e834b9f1abf3bc3f7aa96a51247e8708", "score": "0.5119579", "text": "def change()\n @col = color(255, 0, 0)\n end", "title": "" }, { "docid": "217b08f1bd51c1f13d0002c07186a44d", "score": "0.51194024", "text": "def theater_chase_rainbow( opts = {} )\n wait_ms = opts.fetch(:wait_ms, self.wait_ms)\n spacing = opts.fetch(:spacing, 3)\n\n 256.times do |jj|\n spacing.times do |sp|\n self.clear\n (sp...self.length).step(spacing) { |ii| self[ii] = wheel((ii+jj) % 255) }\n self.show\n sleep(wait_ms / 1000.0)\n end\n end\n\n self\n end", "title": "" }, { "docid": "8e3f753ec0f596557e2d8ff4513c2265", "score": "0.5118486", "text": "def ctermbg=(color)\n @ctermbg = Color.new(color).to_cterm\n end", "title": "" }, { "docid": "132a95377914b70104758b2fc28f8d0a", "score": "0.51175004", "text": "def color=(v); end", "title": "" }, { "docid": "1250e44f8b0776f99510f41b8a9aad95", "score": "0.511544", "text": "def color=(c)\n self[:color] = c\n end", "title": "" }, { "docid": "c32ce58d9112f505028f9e6a41604eeb", "score": "0.5115109", "text": "def reset \nself.map_opacity = 255 \nself.map_tone = Color.new(0,0,0,0) \nself.horizon = 960 # default value, equivalent to 30 tiles \nself.map_gradual_opacity = 0 \nself.map_gradual_tone = Tone.new(0,0,0,0) \nend", "title": "" }, { "docid": "2c915bd1f298f95d42b63715dded7b3e", "score": "0.51147294", "text": "def color=(value)\n @color = value\n end", "title": "" }, { "docid": "2c915bd1f298f95d42b63715dded7b3e", "score": "0.51147294", "text": "def color=(value)\n @color = value\n end", "title": "" }, { "docid": "2c915bd1f298f95d42b63715dded7b3e", "score": "0.51147294", "text": "def color=(value)\n @color = value\n end", "title": "" }, { "docid": "02e6b10a25a74761648a6817f6823682", "score": "0.511364", "text": "def initialize(year, model, color)\n @year = year\n @model = model\n @color = color\n @current_speed = 0\n end", "title": "" }, { "docid": "60a8d8e13bef2eeb09d201084b58c431", "score": "0.5110422", "text": "def initialize(x,y,c=\"clear\") # or could skip this and color starts unset\n super(x,y)\n @color = c\n end", "title": "" }, { "docid": "2a27c1e0d794c1d6a642bb4e5e2ff1fa", "score": "0.510909", "text": "def set(color)\n @last_color = color\n @light.set(color)\n end", "title": "" }, { "docid": "04c9914bbfbbbfe0eb5fe0d6f1d4bbf9", "score": "0.5101849", "text": "def cyan=(cc)\n @c = Color.normalize(cc / 100.0)\n end", "title": "" }, { "docid": "aa7c2d0e7529f437d5a01e69868c633a", "score": "0.5101342", "text": "def change_color\n self.color || 'rgb(12, 124, 231)'\n end", "title": "" }, { "docid": "988ef7231ada89d5ee315800a64859d9", "score": "0.50956845", "text": "def preferred_color\n colors = {}\n 5.times { |color| colors[color] = 0 }\n @cards.collect { |card| colors[card.color] += card.point_value }\n colors.delete(4) # nil out black, 'cause we don't want to pick it\n colors = colors.sort_by { |_, val| val }\n @log.info { \"Player #{name} played wild card and prefers #{RunoCards::COLORS[colors.last[0]]}\" }\n colors.last[0]\n end", "title": "" }, { "docid": "8fac8c1628642cd4c86114d4eaebd091", "score": "0.50949067", "text": "def get_car_color\n car ? car.color : 'N/A'\n end", "title": "" }, { "docid": "25ed63cbe4a4759d23e6258a44338ca5", "score": "0.50934404", "text": "def distance_color cell\n if distances && distances[cell]\n intensity = (distances_max - distances[cell].to_f) / distances_max\n '#' + gradient.at(intensity).color.hex\n else\n nil\n end\n end", "title": "" }, { "docid": "607d8c57cbd365d86f18b11c47dfa263", "score": "0.5085699", "text": "def color_gradient(city_review_average)\n # red = 255\n # green = 0\n # stepSize = 5\n # array = []\n #\n # while green < 255\n # green += stepSize;\n # if green > 255\n # green = 255\n # end\n # array << [red, green]\n # end\n #\n # while red > 0\n # red -= stepSize;\n # if red < 0\n # red = 0\n # end\n # array << [red, green]\n # end\n\n array = [[255, 0, 1],\n [255, 0, 2],\n [255, 0, 3],\n [255, 0, 4],\n [255, 0, 5],\n [255, 0, 6],\n [255, 0, 7],\n [255, 0, 8],\n [255, 0, 9],\n [255, 0, 10],\n [255, 0, 11],\n [255, 0, 12],\n [255, 0, 13],\n [255, 0, 14],\n [255, 0, 15],\n [255, 0, 16],\n [255, 2, 17],\n [255, 5, 18],\n [255, 5, 19],\n [255, 10, 20],\n [255, 20, 21],\n [255, 30, 22],\n [255, 40, 23],\n [255, 50, 24],\n [255, 60, 25],\n [255, 70, 26],\n [255, 70, 27],\n [255, 70, 28],\n [255, 80, 29],\n [255, 80, 30],\n [255, 80, 31],\n [255, 80, 32],\n [255, 80, 33],\n [255, 80, 34],\n [255, 80, 35],\n [255, 80, 36],\n [255, 80, 37],\n [255, 80, 38],\n [255, 80, 39],\n [255, 80, 40],\n [255, 100, 41],\n [255, 100, 42],\n [255, 100, 43],\n [255, 100, 44],\n [255, 100, 45],\n [255, 100, 46],\n [255, 100, 47],\n [255, 100, 48],\n [255, 100, 49],\n [255, 100, 50],\n [255, 200, 51],\n [255, 220, 52],\n [255, 230, 53],\n [255, 250, 54],\n [255, 255, 55],\n [230, 255, 56],\n [255, 255, 57],\n [255, 255, 58],\n [255, 255, 59],\n [255, 255, 60],\n [205, 255, 61],\n [200, 255, 62],\n [195, 255, 63],\n [190, 255, 64],\n [185, 255, 65],\n [180, 255, 66],\n [175, 255, 67],\n [170, 255, 68],\n [165, 255, 69],\n [160, 255, 70],\n [155, 255, 71],\n [150, 255, 72],\n [120, 255, 73],\n [120, 255, 74],\n [120, 255, 75],\n [120, 255, 76],\n [120, 255, 77],\n [120, 255, 78],\n [100, 255, 79],\n [100, 255, 80],\n [100, 255, 81],\n [100, 255, 82],\n [95, 255, 83],\n [90, 255, 84],\n [85, 255, 85],\n [80, 255, 86],\n [75, 255, 87],\n [70, 255, 88],\n [65, 255, 89],\n [60, 255, 90],\n [55, 255, 91],\n [20, 255, 92],\n [20, 255, 93],\n [20, 255, 94],\n [20, 255, 95],\n [20, 255, 96],\n [20, 255, 97],\n [15, 255, 98],\n [15, 255, 99],\n [10, 255, 100],\n [5, 255, 101],\n [0, 255, 102]]\n\n \"rgb(\" + array[(city_review_average * 10)][0].to_s + \",\" + array[(city_review_average * 10)][1].to_s + \", 0)\"\n end", "title": "" }, { "docid": "e8096da0ac556438226a9b595bf021fd", "score": "0.5083307", "text": "def change_color\n @color = Gosu::Color.rgb(rand * 255, rand * 255, rand * 255)\n end", "title": "" }, { "docid": "7a934c9aae250503da67faa9dc285ee7", "score": "0.50807476", "text": "def init\n self.color_text_card ||= \"#ffffff\"\n self.color_bground ||= \"#49aef5\"\n self.color_lines ||= \"#3c759f\"\n self.color_text_lines ||= \"#08304d\"\n self.color_card ||= \"#3c759f\"\n self.color_button ||= \"#08304d\"\n self.color_title ||= \"#08304d\"\n self.color_field_title ||= \"#08304d\"\n \n self.background_mosaic ||= false\n end", "title": "" }, { "docid": "69f9a6be86f84c98e2ef793ef07f5499", "score": "0.5075327", "text": "def blue=(v); v = 0 if v < 0; v = 1 if v > 1; @blue = v; end", "title": "" }, { "docid": "febb8817bc04a4381a7661f036aa301e", "score": "0.50706536", "text": "def color=(new_color)\n @color = new_color\n end", "title": "" }, { "docid": "c34582672eaf395e163f8eec3eff49a0", "score": "0.50706226", "text": "def changeBackgroundColor(canvas,data)\n data['moves'] += 1\n moves = data['moves']\n newColor ='#'+toHex(RED*moves/SUN_SIZE)+toHex(GREEN*moves/SUN_SIZE)+toHex(BLUE*moves/SUN_SIZE)\n canvas.configure('bg'=>newColor)\nend", "title": "" }, { "docid": "4c2b5eee45d1431e5b919b5e123a0765", "score": "0.50705594", "text": "def bar_color=(color); end", "title": "" }, { "docid": "3416899869421fc594e3372e3d97e974", "score": "0.50697386", "text": "def initialize_colors\n # walk red, green, and blue around a circle separated by equal thirds.\n #\n # To visualize, type this into wolfram-alpha:\n #\n # plot (3*sin(x)+3), (3*sin(x+2*pi/3)+3), (3*sin(x+4*pi/3)+3)\n\n # 6 has wide pretty gradients. 3 == lolcat, about half the width\n @colors = (0...(6 * 7)).map { |n|\n n *= 1.0 / 6\n r = (3 * Math.sin(n ) + 3).to_i\n g = (3 * Math.sin(n + 2 * PI_3) + 3).to_i\n b = (3 * Math.sin(n + 4 * PI_3) + 3).to_i\n\n # Then we take rgb and encode them in a single number using base 6.\n # For some mysterious reason, we add 16... to clear the bottom 4 bits?\n # Yes... they're ugly.\n\n 36 * r + 6 * g + b + 16\n }\n end", "title": "" }, { "docid": "d2333d4a3f1ccfee5da3315ccac05fae", "score": "0.50641", "text": "def color=(color)\n end", "title": "" }, { "docid": "db7f1c844a00a792a4e4b53f201ba3c5", "score": "0.5062984", "text": "def set_color\n @color = Color.with_deleted.find(params[:id])\n end", "title": "" }, { "docid": "cc39f374b3b11cf3959e998b9e4533c5", "score": "0.50579506", "text": "def set_card_color\n @card_color = CardColor.find(params[:id])\n end", "title": "" }, { "docid": "7f39bcea2419013d98147db7d97e593b", "score": "0.50575614", "text": "def initialize(color)\n @color = color\n end", "title": "" }, { "docid": "7f39bcea2419013d98147db7d97e593b", "score": "0.50575614", "text": "def initialize(color)\n @color = color\n end", "title": "" }, { "docid": "d77b623bd158003a583d741bd6c5495b", "score": "0.5055565", "text": "def change_color(new_color)\n puts \"Originator: I\\'m changing the car color from #{color}.\"\n @color = new_color\n puts \"Originator: and my color has changed to: #{@color}\"\n end", "title": "" }, { "docid": "2c3990c758f0cbae0f64c6d1ad738047", "score": "0.5054427", "text": "def set_color color\n attrset COLOR_PAIR(color)\n end", "title": "" }, { "docid": "ffb8ab4204348c78c925661a6355bec5", "score": "0.5051705", "text": "def change_color(new_color)\n self.color = new_color\n end", "title": "" }, { "docid": "c0102096d70ad005c702e0c4811ee4be", "score": "0.50430167", "text": "def fixed_color; end", "title": "" }, { "docid": "2b4a38afb81539b153c32da1cc6d3a32", "score": "0.5037445", "text": "def initialize(name, color)\n puts \"Initialize method!\"\n @name = name\n @color = color\n @@no_of_apples += 1\n end", "title": "" } ]
49da1f866ad149ad8015b219e795e3d7
Custom attribute writer method with validation
[ { "docid": "4b90328cea1c8e0052633a685202bb78", "score": "0.0", "text": "def version=(version)\n if !version.nil? && version.to_s.length > 255\n fail ArgumentError, 'invalid value for \"version\", the character length must be smaller than or equal to 255.'\n end\n\n if !version.nil? && version.to_s.length < 0\n fail ArgumentError, 'invalid value for \"version\", the character length must be great than or equal to 0.'\n end\n\n pattern = Regexp.new(/^[\\p{White_Space}\\p{L}\\p{M}\\p{S}\\p{N}\\p{P}]*$/)\n if !version.nil? && version !~ pattern\n fail ArgumentError, \"invalid value for \\\"version\\\", must conform to the pattern #{pattern}.\"\n end\n\n @version = version\n end", "title": "" } ]
[ { "docid": "5a0bcdaca95c21b13aacca36f9fad742", "score": "0.6955513", "text": "def _write_attribute(attr_name, value); end", "title": "" }, { "docid": "5812dd7a37c0eccc3d9481c23d74c649", "score": "0.69278884", "text": "def write_attribute(attr_name, value); end", "title": "" }, { "docid": "592eaedb6e9b9540b7d75bbf39753328", "score": "0.6748806", "text": "def attr_internal_writer(*attrs); end", "title": "" }, { "docid": "a775d3339a8dee1814a1cbf65648a50c", "score": "0.6578924", "text": "def attr_writer(name); end", "title": "" }, { "docid": "ed39c33b2de8111fd1af7a578549baca", "score": "0.64354604", "text": "def evaluate_attr_writer(arguments, context)\n arguments.each do |arg|\n define_attribute(arg.value.to_s, context, true)\n end\n end", "title": "" }, { "docid": "d72b5a36b20ffe9083b0b422c6853428", "score": "0.63046175", "text": "def ecwid_writer(*attrs)\n attrs.map(&:to_s).each do |attribute|\n method = \"#{attribute.underscore}=\"\n define_accessor(method) do |value|\n @new_data[attribute] = value\n end unless method_defined?(method)\n end\n end", "title": "" }, { "docid": "282b9e882407637e34103b86ed10f369", "score": "0.6283928", "text": "def validated_attr_accessor(symbols, validator); end", "title": "" }, { "docid": "818a28ea23a393353f522258d13ba1d1", "score": "0.62821025", "text": "def writer(*args)\n attr_writer(*args)\n args\n end", "title": "" }, { "docid": "b34e1be72fa653af8d32020df969705c", "score": "0.62763333", "text": "def write_attribute(attr, value)\n write_handle_attribute(attr, value)\n end", "title": "" }, { "docid": "3166f88ed8e7b3071fc74b28818b2cf5", "score": "0.62148595", "text": "def define_writer(name, options = {})\n values = extract_values_from(options)\n format = extract_format_from(options)\n types = extract_types_from(options)\n\n define_method(\"#{name}=\") do |value|\n raise InvalidAttributeValue.new(value, values) if values && !values.include?(value)\n\n raise InvalidAttributeFormat.new(value, format) if !format.nil? && value !~ format\n\n raise InvalidAttributeType.new(value, types) if value && types && types.none? { |klass| value.is_a?(klass) }\n\n instance_variable_set(:\"@#{name}\", value)\n end\n end", "title": "" }, { "docid": "68363c8c5419ec508c635a4745eaf554", "score": "0.6182247", "text": "def is_attribute?; end", "title": "" }, { "docid": "980f1ecce12cb6af88aea60e530e6082", "score": "0.61233336", "text": "def attr_allowed(attribute, *args)\n opt = args.last.is_a?(Hash) ? args.pop : {}\n vals = {}\n args.flatten.map { |v| vals[v.to_sym] = v.to_s }\n defn = Definition.new(attribute, vals, opt)\n easy_attribute_accessors(attribute, defn)\n end", "title": "" }, { "docid": "01837abe5abbf99e492036b9ec7a3cf0", "score": "0.6087238", "text": "def create_attr_writer(name, type:, class_attribute: false, &block)\n create_attribute(name, kind: :writer, type: type, class_attribute: class_attribute, &block)\n end", "title": "" }, { "docid": "fe6b9841a175c460b83a392a86e9a4ac", "score": "0.60593253", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"allowedValues\", @allowed_values)\n writer.write_string_value(\"attributeSet\", @attribute_set)\n writer.write_string_value(\"description\", @description)\n writer.write_boolean_value(\"isCollection\", @is_collection)\n writer.write_boolean_value(\"isSearchable\", @is_searchable)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"status\", @status)\n writer.write_string_value(\"type\", @type)\n writer.write_boolean_value(\"usePreDefinedValuesOnly\", @use_pre_defined_values_only)\n end", "title": "" }, { "docid": "ea18c1b0c4d2aef5b4e160624bd93529", "score": "0.60422766", "text": "def define_attribute_writer(name)\n\t\[email protected] :attr_writer, name.to_sym\t # Instance accessor\n\t end", "title": "" }, { "docid": "ea18c1b0c4d2aef5b4e160624bd93529", "score": "0.60422766", "text": "def define_attribute_writer(name)\n\t\[email protected] :attr_writer, name.to_sym\t # Instance accessor\n\t end", "title": "" }, { "docid": "965cc558ab492e6f5b2f1e58c6621f8f", "score": "0.6041824", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_number_value(\"maxAttributesPerSet\", @max_attributes_per_set)\n end", "title": "" }, { "docid": "d0307a1367c4f94ff24ad1bca5de1541", "score": "0.602339", "text": "def define_attribute_methods; end", "title": "" }, { "docid": "c0142e6bd3d8bfe14d99f95667e5e7c3", "score": "0.6009878", "text": "def addSpecialAttribute( val )\n raise \"!!! special attribute error\" if val.nil?\n puts \"TODO: adding spcial attribute #{val}\"\n end", "title": "" }, { "docid": "cda602bf226ef7f05781f0a5fb4534e1", "score": "0.5996017", "text": "def _write_attribute(attr_name, value) # :nodoc:\n @attributes.write_from_user(attr_name, value)\n end", "title": "" }, { "docid": "df1d5602c98b216cef36c904fc9e9cbc", "score": "0.5991221", "text": "def difiiculty=(diffultu)\n\twrite_attribute(\"difficytly \")\n\t\n\n\t# Trail.new(trails_params \n\t# {title: \"Mt.Hood', description: \"Horible hike, length: 15, \n\t# \t, image_url: ...., difficulty: \"1\"})\n\n# custom attribute writer rails 5 -- google this \n# It's that you dont' give up. \n\nend", "title": "" }, { "docid": "2c512f1af45d460bce4089e53969e67d", "score": "0.59887075", "text": "def valid_attributes\n {name: \"MyRule\"}\n end", "title": "" }, { "docid": "4b88599bf2add1e271ab41ca9972c47c", "score": "0.59819275", "text": "def write_attribute(attr, value)\n attr = attr.to_s\n\n old_value = old_attribute_value(attr)\n\n result = super(attr, value)\n save_changed_attribute(attr, old_value)\n result\n end", "title": "" }, { "docid": "70614cca49616d8819f4001d4d9f468f", "score": "0.5980955", "text": "def test_attribute_detection\n verify_method :is_attribute?, with: [\n {param: ' attr_reader :a', expect: true},\n {param: ' attr_accessor :a1', expect: true},\n {param: ' attr_writer :a_a', expect: true},\n {param: ' attr_reader :a?', expect: true},\n {param: ' attr_accessor :a-', expect: true},\n {param: ' def attr_accessor :a', expect: false},\n {param: ' attr_accessor = :a', expect: false}\n ]\n end", "title": "" }, { "docid": "2b0633ade1d424863b32639914123d7e", "score": "0.5980007", "text": "def attr_internal_writer(*attrs)\n attrs.each { |attr_name| attr_internal_define(attr_name, :writer) }\n end", "title": "" }, { "docid": "6a4cddfea9e2180573e2da43f8cc404d", "score": "0.5966393", "text": "def define_filtered_attr_writer(attribute, filter)\n define_method(\"#{attribute}=\") do |value|\n result =\n case filter\n when Symbol\n value.respond_to?(filter) ? value.send(filter) : value\n when Regexp\n value.respond_to?(:gsub) ? value.gsub(filter, '') : value\n when Proc\n filter.call(value)\n else # nil\n end\n\n if defined?(super)\n super(result)\n else\n # Required for non-column attributes:\n instance_variable_set(\"@#{attribute}\".to_sym, result)\n write_attribute(attribute.to_sym, result)\n end\n end\n end", "title": "" }, { "docid": "ecfaa59d56852699fa1761ee5a7ea35d", "score": "0.5966327", "text": "def write_attribute(attr, value)\n attr = attr.to_s\n\n save_changed_attribute(attr, value)\n\n super(attr, value)\n end", "title": "" }, { "docid": "d309dffd28fdac85d4496f776991c611", "score": "0.5964533", "text": "def attribute=(attr_name, value); end", "title": "" }, { "docid": "c01342d55ab5caf003423e01d81377db", "score": "0.5961117", "text": "def _write_attribute(attr_name, value) # :nodoc:\n @attributes.write_from_user(attr_name.to_s, value)\n value\n end", "title": "" }, { "docid": "8a9895284a9b203f486922739ef6f381", "score": "0.5956784", "text": "def define_method_attribute=(attr_name)\n method = attr_name + '='\n return if (bad_attribute_names.include?(method.to_sym))\n super(attr_name)\n end", "title": "" }, { "docid": "9c046178bf04c989733be8cad495b654", "score": "0.5953332", "text": "def attribute(name, type = Type::Value.new, *args, **options)\n arg_options = args.each_with_object({}) { |arg, hsh| hsh[arg.to_sym] = true }\n options = arg_options.merge options\n\n type = check_allowed_type type\n options[:of] = check_allowed_type(options[:of]) if options.key?(:of)\n\n attribute_metadata name, type, options\n\n build_attribute_aliases name, options\n\n options = Validations.build_for(self, name)\n\n super(name, type, **options)\n end", "title": "" }, { "docid": "ab58aeee3f5b99ce829071ac1bb7b033", "score": "0.595229", "text": "def dangerous_attribute_method?(name); end", "title": "" }, { "docid": "b82d0071cb895e7c6b0c45add42bc541", "score": "0.5948709", "text": "def _create_writer_with_dirty_tracking(name, attribute)\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n chainable(:dirty_tracking) do\n #{attribute.writer_visibility}\n\n def #{name}=(value)\n prev_value = #{name}\n new_value = super\n\n if prev_value != new_value\n unless original_attributes.key?(:#{name})\n original_attributes[:#{name}] = prev_value\n end\n\n attribute_dirty!(:#{name}, new_value)\n end\n\n new_value\n end\n end\n RUBY\n end", "title": "" }, { "docid": "4dce47fe45d27f87602ffc54b53ba257", "score": "0.5938289", "text": "def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end", "title": "" }, { "docid": "212882a4ba4e1056b2e89cf2b37f804f", "score": "0.5934965", "text": "def write_attribute_with_security(name, value)\n if not writeable?(name)\n security_error(:write, name)\n end\n write_attribute_without_security(name, value)\n end", "title": "" }, { "docid": "cf5240c2dd4986db781b51d27c63c815", "score": "0.5919929", "text": "def write_attribute(attr, value)\n attr = attr.to_s\n\n old_value = old_attribute_value(attr)\n\n result = super\n store_original_raw_attribute(attr)\n save_changed_attribute(attr, old_value)\n result\n end", "title": "" }, { "docid": "e0ad71b013b72c836c776d5a92e5e1df", "score": "0.59189177", "text": "def new_attribute( attribute )\n @attribute += attribute\n attribute.each { |a|\n a.set_owner self\n @name_list.add_item( a )\n if( a.is_omit? )then\n @n_attribute_omit += 1\n elsif( a.is_rw? )then\n @n_attribute_rw += 1\n else\n @n_attribute_ro += 1\n end\n if a.get_initializer then\n # 登録後にチェックしても問題ない(attr を参照できないので、自己参照しない)\n a.get_type.check_init( @locale, a.get_identifier, a.get_initializer, :ATTRIBUTE )\n end\n }\n end", "title": "" }, { "docid": "b41f07d297c43d6d4b5b92dfbd552027", "score": "0.5914331", "text": "def write_attribute_after_cleaning(attr_name, value)\n send(:\"#{attr_name}=\", value)\n end", "title": "" }, { "docid": "5edea91537a6f7a201d943c0bf010447", "score": "0.5911822", "text": "def add_attr_accessors\n self.class._validators.keys.each do |key|\n unless self.class.attribute_types.keys.include? key.to_s\n @attribute_collection.push Attribute.new(key.to_s, ActiveModel::Type::String.new, self.class, self)\n end\n end\n end", "title": "" }, { "docid": "46c831f1e719073f61b578a1298771c9", "score": "0.5908848", "text": "def define_attribute_writer(field_name, field_type, visibility)\n define_meta_module_method(\"#{field_name}=\", visibility) do |val|\n write_attribute(field_name, val)\n end\n end", "title": "" }, { "docid": "6885d25d09b003087b572ac7edaf6c93", "score": "0.5905603", "text": "def write_attributes(writer, node)\r\n if node.attributes.count > 0\r\n # stuff them into an array of strings\r\n attrs = []\r\n\r\n node.attributes.each do |attr|\r\n # special case:\r\n # example: <nav class=\"top-bar\" data-topbar>\r\n if attr.value.nil?\r\n attrs << attr.name\r\n else\r\n attrs << attr.name + '=\"' + attr.value + '\"'\r\n end\r\n end\r\n\r\n # separate them with a space\r\n attr_str = attrs.join(' ')\r\n\r\n # requires a leading space as well to separate from the element name.\r\n writer.write(' ' + attr_str)\r\n end\r\n\r\n nil\r\n end", "title": "" }, { "docid": "6edcf9feceb5ad7be674379e34948b5a", "score": "0.59029615", "text": "def attribute(*args)\n options = args.extract_options!\n validate_attribute_options(options, args.size)\n\n args.each do |name|\n if options[:access] == :none\n @attributes.delete(name)\n @write_attributes.delete(name)\n else\n @attributes[name] = options\n\n model_attr = (options[:model_attr] || name).to_sym\n model_attr = define_attr_methods(name, model_attr, options)\n\n if options[:access] != :ro\n validate_attr_writable(model_attr)\n @write_attributes[name] = model_attr\n end\n end\n end\n end", "title": "" }, { "docid": "bbe1cfec56468f18493687c58516b7c0", "score": "0.5877301", "text": "def define_attribute_method_matchers\n attribute_method_suffix '='\n attribute_method_suffix '?'\n end", "title": "" }, { "docid": "c50effab6a2f1360de36944bf1dfb58f", "score": "0.5866572", "text": "def define_dynamic_writer(name)\n return unless name.valid_method_name?\n\n class_eval do\n define_method(\"#{name}=\") do |value|\n write_attribute(name, value)\n end\n end\n end", "title": "" }, { "docid": "871ba04ea0ab441d435b36ab87a9b6cf", "score": "0.5864339", "text": "def write_attribute(name, value)\n name = name.to_s\n\n if respond_to? \"#{name}=\"\n __send__(\"attribute=\", name, value)\n else\n raise ActiveAttr::UnknownAttributeError, \"unknown attribute: #{name}\"\n end\n end", "title": "" }, { "docid": "92e6aa696609ba32f99fa779d8a20c0c", "score": "0.58497715", "text": "def write_parsed_attribute(attr, value)\n write_handler_for_parsed_attribute(attr, value)\n end", "title": "" }, { "docid": "8bb4d32870ff371cbfca57f5102673e7", "score": "0.5849734", "text": "def metaattr_writer(*syms)\n syms.pop if syms.last === true\n metaclass_eval { attr_writer(*syms) }\n end", "title": "" }, { "docid": "a6ef04c8a26f46a5950381216ae001e5", "score": "0.58494484", "text": "def attr_writer(*fields)\n writable *fields\n nil\n end", "title": "" }, { "docid": "7a53241e5abb38a98a4dceb1dd071f2c", "score": "0.5846668", "text": "def attribute_factory; end", "title": "" }, { "docid": "7a53241e5abb38a98a4dceb1dd071f2c", "score": "0.5846668", "text": "def attribute_factory; end", "title": "" }, { "docid": "7a53241e5abb38a98a4dceb1dd071f2c", "score": "0.5846668", "text": "def attribute_factory; end", "title": "" }, { "docid": "62b672f2f65c06e9bc8c1f67c4b82d8b", "score": "0.58455044", "text": "def write(options = {})\n if options[:validate] != false\n raise ConstraintViolation, \"#{self.class.name} failed constraint #{self.errors.full_messages}\" if !self.valid?\n end\n \n row.set_attribute(attr_name, self.to_json)\n end", "title": "" }, { "docid": "3f879bf451a02a929af89cced82010dc", "score": "0.58372414", "text": "def eattr_writer(*attrs)\n eigenclass_eval { attr_writer *attrs }\n end", "title": "" }, { "docid": "92029ef38760cb1c817909d3f16b0445", "score": "0.58346754", "text": "def instance_writers\n _attrs.keys.map { |m| \"#{m}=\".to_sym }.select { |m| method_defined?(m) }\n end", "title": "" }, { "docid": "39337c2ee2f1e20a95528ee374323c34", "score": "0.58328366", "text": "def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end", "title": "" }, { "docid": "b5eb499d740f7df61e285add36f971d4", "score": "0.58315015", "text": "def instance_write(attr, value)\n setter = :\"#{name}_#{attr}=\"\n responds = instance.respond_to?(setter)\n instance.send(setter, value) if responds || attr.to_s == \"file_name\"\n end", "title": "" }, { "docid": "464c50a33b9010439399d24730f9f294", "score": "0.5827371", "text": "def attr_writer?(*var_ids,&block)\n if block\n var_ids.each do |var_id|\n define_method(:\"#{var_id}=\",&block)\n end\n else\n last = var_ids[-1]\n\n if !last.is_a?(String) && !last.is_a?(Symbol)\n raise ArgumentError,'default value not allowed for writer'\n end\n\n attr_writer(*var_ids)\n end\n end", "title": "" }, { "docid": "27c694e0ecfcdec80579a9299aaee379", "score": "0.5823302", "text": "def write_friendly_attribute(attr, value)\n friendly_instance_for_attribute(attr).send(:\"#{attr}=\", value)\n end", "title": "" }, { "docid": "f676bb6c78ed48cc816cb3f410be1351", "score": "0.5812019", "text": "def define_valid_attributes(name)\n define_method(\"valid_#{name}_attributes\") do |*args|\n valid_attributes = send(\"new_#{name}\", *args).attributes\n valid_attributes.delete_if { |key, value| value.nil? }\n valid_attributes.stringify_keys!\n valid_attributes.make_indifferent!\n valid_attributes\n end\n end", "title": "" }, { "docid": "e1dd23ac6b766e903cb454b05c2bd21c", "score": "0.5806696", "text": "def write_attribute(attr, value)\n attr = attr.to_s\n \n # The attribute already has an unsaved change.\n if changed_attributes.include?(attr)\n old = changed_attributes[attr]\n changed_attributes.delete(attr) if value == old\n else\n old = clone_attribute_value(attr)\n changed_attributes[attr] = old unless value == old\n end\n \n # Carry on.\n super\n end", "title": "" }, { "docid": "2ae510d25a630fa0fc9975a535b1ad8e", "score": "0.58049893", "text": "def create_attr_writer(name, type:, &block)\n create_attribute(name, kind: :writer, type: type, &block)\n end", "title": "" }, { "docid": "5f7de0294be9ef9d674d4a8d074a45b2", "score": "0.57933354", "text": "def decorate decorate\n self.attributes << \"decorate = #{decorate}\"\n end", "title": "" }, { "docid": "9540dff4e701b0cf477696a4ace9031c", "score": "0.5793136", "text": "def writer(*names)\n names.each { |name| attribute name, :writer }\n end", "title": "" }, { "docid": "0fb0efde4ee22a7c8e11f61ae1c9fcfa", "score": "0.5779595", "text": "def write_attribute(attr, value)\n @attributes[attr] = types[attr].coerce(value)\n end", "title": "" }, { "docid": "ea711966728349596b0cbdfbc1b8018c", "score": "0.57777816", "text": "def define_writer( attribute )\n\n write_accessor_name = attribute.write_accessor_name\n\n instance_controller = ::CascadingConfiguration::Core::InstanceController.create_instance_controller( self )\n\n instance_controller.define_instance_method( write_accessor_name ) do |value|\n\n return set_attribute( attribute, value )\n \n end\n \n return self\n\n end", "title": "" }, { "docid": "a5402415db02129f625424c166641b2c", "score": "0.57667106", "text": "def write_attribute(*args)\n reset_target\n super\n end", "title": "" }, { "docid": "0b0444ec26df64d9e7f9a34cdff4a558", "score": "0.57602316", "text": "def define_attribute_writer_method(key, *key_path)\n define_method(:\"#{key}=\") do |value|\n @attrs.deep_reverse_merge! keypath_hash_for(key_path << key, value)\n end\n end", "title": "" }, { "docid": "d05e9e2b053d8e8aa4ce7ce56b32823e", "score": "0.5751413", "text": "def write_attribute(attr, value)\n @attributes[attr] = types[attr].coerce(value)\n end", "title": "" }, { "docid": "1d923250c38485d9a68c8207340e3246", "score": "0.57457274", "text": "def write_attribute(name, value)\n __send__(\"#{name}_will_change!\") if value != self[name]\n \n name = name.to_s\n \n if @attributes.has_key?(name) || self.respond_to?(name)\n @attributes[name] = value\n else\n raise ::ActiveAttr::UnknownAttributeError, \"unknown attribute: #{name}\"\n end\n end", "title": "" }, { "docid": "14c72bd4c936f2f997dde5fd7df0fa6e", "score": "0.5729468", "text": "def method_missing(method_sym, *arguments, &block)\n attribute_name = method_sym.to_s\n attribute_name = attribute_name.chop if attribute_name.ends_with?(\"=\")\n\n if arguments.count > 1\n write(attribute_name, arguments)\n elsif arguments.count.positive?\n write(attribute_name, arguments.first)\n else\n sanitize(read(attribute_name))\n end\n end", "title": "" }, { "docid": "0388ff1a4d3f3e60a09be66e747d0fd5", "score": "0.57265335", "text": "def cattr_writer(*attrs)\n attrs.each do |attr|\n instance_eval(\"def #{attr}=(val); @#{attr} = val; end\")\n end\n end", "title": "" }, { "docid": "7159b25f4b05788baa0f4a826c8751af", "score": "0.57211995", "text": "def write_attribute(attr_name, value)\n assign_attributes(attr_name => value)\n end", "title": "" }, { "docid": "c00bcf6cd0ae1ff579e0a90846125266", "score": "0.57100457", "text": "def abstract_attr_writer(method_name)\n abstract \"#{method_name}=\"\n end", "title": "" }, { "docid": "c1a72b998a72fdb97be68516ce0d4317", "score": "0.5707535", "text": "def define_method_attribute(attr_name)\n return if (bad_attribute_names.include?(attr_name.to_sym))\n super(attr_name)\n end", "title": "" }, { "docid": "7e8d8422e62ad0b4b3923393f6a77a16", "score": "0.56912196", "text": "def define_attr_accessor(attr)\n _attribute(attr)\n super\n end", "title": "" }, { "docid": "f38e01e1f6099e1e0d7c74f931b0ab5f", "score": "0.5684669", "text": "def write_handler_for_parsed_attribute(attr, val)\n case self.class.attribute_type(attr)\n when :string then\n @attributes[attr] = val.to_s.gsub(/[,.]/, \"\").squeeze.gsub(/(.+) $/, '\\1')\n when :numeric then\n decimal = self.class.attribute_decimal(attr)\n if decimal\n dot = val.length - decimal\n @attributes[attr] = \"#{val[0, dot]}.#{val[dot, val.length]}\".to_f\n else\n @attributes[attr] = val.to_i\n end\n when :date then\n @attributes[attr] = Date.strptime(val, ActiveEDI::DEFAULT_DATE_MASK)\n end\n end", "title": "" }, { "docid": "f319cf3a2941971527e8ff082102957d", "score": "0.5675639", "text": "def write_attribute(name, value)\n if self.nullable_attributes.include? name.to_sym\n column = column_for_attribute(name)\n if column && (column.type == :string || column.type == :text) && column.null == true\n value = nil if value == ''\n end\n end\n super(name, value)\n end", "title": "" }, { "docid": "f741c9ca645e5667a9637cbdd35ef98b", "score": "0.5674746", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_enum_value(\"arity\", @arity)\n writer.write_enum_value(\"multivaluedComparisonType\", @multivalued_comparison_type)\n writer.write_collection_of_object_values(\"supportedAttributeTypes\", @supported_attribute_types)\n end", "title": "" }, { "docid": "6f6eb4828ac299f3ea2e7fc1975c9db2", "score": "0.567405", "text": "def attr_writer(name) #:nodoc:\n class_eval <<-CODE\n def #{name}=(value)\n attributes[:#{name}] = value\n end\n CODE\n end", "title": "" }, { "docid": "eeca87baa0fff0c51a4d20277c99c6ce", "score": "0.5668188", "text": "def valid_attributes\n { name: \"MyName\",\n preliminary: false}\n end", "title": "" }, { "docid": "f3d9ef169caee4762dfbfc5bd008d8b3", "score": "0.566381", "text": "def mattr_writer(*syms)\n syms.each do |sym|\n raise NameError.new(\"invalid attribute name: #{sym}\") unless sym =~ /^[_A-Za-z]\\w*$/\n class_eval(<<-EOS, __FILE__, __LINE__ + 1)\n @@#{sym} = nil unless defined? @@#{sym}\n def self.#{sym}=(obj)\n @@#{sym} = obj\n end\n EOS\n\n send(\"#{sym}=\", yield) if block_given?\n end\n end", "title": "" }, { "docid": "67fb8b4780de0b875159fdc18dbc50b8", "score": "0.5657996", "text": "def write_attribute(name, value)\n if name[0] == '{'\n (namespace, local_name) = Service.parse_clark_notation(name)\n if @namespace_map.key?(namespace)\n # It's an attribute with a namespace we know\n write_attribute(\n @namespace_map[namespace] + ':' + local_name,\n value\n )\n else\n # We don't know the namespace, we must add it in-line\n @adhoc_namespaces[namespace] = 'x' + (@adhoc_namespaces.size + 1).to_s unless @adhoc_namespaces.key?(namespace)\n\n write_attribute_ns(\n @adhoc_namespaces[namespace],\n local_name,\n namespace,\n value\n )\n end\n else\n @writer.write_attribute(name, value)\n end\n end", "title": "" }, { "docid": "16d20ba640b02d42c7ede34a10c8168c", "score": "0.5657499", "text": "def attribute(name); end", "title": "" }, { "docid": "a723cbc4ce3016f2fa688728b4d71e21", "score": "0.56522715", "text": "def instance_write(attr, value)\n setter = :\"#{name}_#{attr}=\"\n responds = instance.respond_to?(setter)\n self.instance_variable_set(\"@_#{setter.to_s.chop}\", value)\n instance.send(setter, value) if responds || attr.to_s == \"file_name\"\n end", "title": "" }, { "docid": "599a5fd4761b11617835644f95218e90", "score": "0.56501293", "text": "def before_attr_writer_action(method, action_type, *values)\n if options_exist? && current_options.debug?\n puts \"before attr_writer action method: :#{method}, action: #{action_type}, values: #{values}\"\n end\n self\n end", "title": "" }, { "docid": "f9672a80332b9db7692ecb09e929a2c4", "score": "0.56358296", "text": "def method_missing(method, *args, &block)\n \n attribute = ActiveSupport::Inflector.camelize(method.to_s, false)\n dashed_attribute = ActiveSupport::Inflector.dasherize(ActiveSupport::Inflector.underscore(attribute))\n \n if attribute =~ /=$/ # Handle assignments only for read-writable attributes\n attribute = attribute.chop\n return super unless self.attributes.include?(attribute)\n self.changed_attributes[attribute] = args[0]\n self.attributes[attribute] = args[0]\n elsif self.attributes.include?(attribute) # Accessor for existing attributes\n self.attributes[attribute]\n elsif self.read_only_members.include?(\"#{dashed_attribute}\") # Accessor for existing read-only members\n self.read_only_members[\"#{dashed_attribute}\"]\n else # Not found - use default behavior\n super\n end \n \n end", "title": "" }, { "docid": "f2dbc9fc70beb9a4d941a582379f1d5a", "score": "0.56336564", "text": "def write_attribute_text_p28writer(rubyfile, attribute_name)\n rubyfile.puts \" a___\" + attribute_name + \".text = \" + attribute_name\nend", "title": "" }, { "docid": "f4573dc7eef7c0f635007484a15b51f9", "score": "0.5629341", "text": "def attribute(name, value=nil)\n if value\n write_attribute(name, value)\n else\n super(name)\n end\n end", "title": "" }, { "docid": "2ecab7d67b5a395765526b7d7bc1ee08", "score": "0.5628885", "text": "def attributes\n fail \"You need override the attributes method\"\n end", "title": "" }, { "docid": "e34ca10265c8863ffc2c99f0291e322c", "score": "0.56253725", "text": "def require_attr(name)\n send(name).tap do |_|\n if _.respond_to?(:body)\n raise AttributeError, \"Attribute must be set: #{name}\" if _.body.nil? || _.body.empty?\n else\n raise AttributeError, \"Attribute must be set: #{name}\" if _.nil?\n end\n end\n end", "title": "" }, { "docid": "63c0888972dec6e4f5e11ed783f0c45b", "score": "0.56250834", "text": "def format(args)\n\n err = self.send :instance_variable_get, \"@err\"\n reg_exp = args.last[:with] \n len = args.count-2\n args[0..len].each do |attr_name| \n\n attr_name = attr_name.to_s\n attr_value = self.send attr_name \n if !reg_exp.match(attr_value)\n if !(err.include?(\"#{attr_name} is invalid\"))\n err << \"#{attr_name} is invalid\"\n end\n end \n\n end #args[0..len].each do |attr_name| \n \n end", "title": "" }, { "docid": "09d3f3521cf7ba832fb84c69b01b2abe", "score": "0.56217307", "text": "def write_attribute(name, value=nil)\n #write attribute, marking dirty\n attribute_will_change!(name.to_sym)\n @attributes[name.to_sym] = value\n end", "title": "" }, { "docid": "b0962d222dd59279cd99a700280e9d40", "score": "0.56205475", "text": "def private_attr_writer(*attrs)\n attr_writer(*attrs)\n private(*attrs.map { |attr| \"#{attr}=\".to_sym })\n end", "title": "" }, { "docid": "228ddb3a6c650861d3b7b0ec0a5caf83", "score": "0.56203234", "text": "def valid_attributes\n { name: \"MyString\" }\n end", "title": "" }, { "docid": "4b44c0f23ca3690aa5f8e1ace42f6e5e", "score": "0.5619315", "text": "def write_attribute(predicate, values)\n predicate = predicate.respond_to?(:uri) ? predicate.uri.to_s : predicate.to_s\n values = [ values ] unless(values.respond_to?(:each))\n @builder.attribute do \n @builder.predicate { @builder.text!(predicate) }\n values.each { |val| write_target(val) }\n end\n end", "title": "" }, { "docid": "b2ab04e7ab42e85327db89a13578c2e8", "score": "0.5612575", "text": "def add_checked_attribute_1(clazz, attribute)\n eval \"\n class #{clazz}\n def #{attribute}=(value)\n raise 'Invalid attribute' unless value #if value is nil or false\n @#{attribute} = value\n end\n\n def #{attribute}\n @#{attribute}\n end\n end\n \"\nend", "title": "" }, { "docid": "223864ead7eb658997a76b5d14915ce7", "score": "0.5609068", "text": "def define_write_method_for_dates_and_times(attr_name)\n method_body = <<-EOV\n def #{attr_name}=(value)\n write_date_time_attribute('#{attr_name}', value)\n end\n EOV\n evaluate_attribute_method attr_name, method_body, \"#{attr_name}=\"\n end", "title": "" }, { "docid": "8c9beaf0b446939d3250d32443b8fbd5", "score": "0.5606325", "text": "def create\n respond_to do |format|\n if @customizable_attribute.save\n format.html { redirect_to([:admin, @customizable_attribute], notice: 'Customizable Attribute was successfully created.') }\n format.xml { render xml: @customizable_attribute, status: :created, location: @customizable_attribute }\n website.add_log(user: current_user, action: \"Created customizable attribute: #{@customizable_attribute.name}\")\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @customizable_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "707f7212a7f177f64f20893aeedcb326", "score": "0.5596995", "text": "def define_attribute_writer(name)\n\t\tmethod_name = name.to_s + '='\n\n\t\t# Class accessor that forwards to the Sketch\n\t\[email protected]_eval \"class << self; def #{method_name}(value); sketch.#{method_name} value; end; end\"\n\n\t\t# Instance accessor that forwards to the Sketch\n\t\[email protected] :define_method, method_name.to_sym do |value|\n\t\t sketch.send method_name, value\n\t\tend\n\n\t\t# Instance accessor on the new Sketch\n\t\t@sketch_klass.send :attr_writer, name.to_sym\n\t end", "title": "" }, { "docid": "8a192bafd6cd3b3b457be3e82f516a30", "score": "0.5596728", "text": "def write_attribute(attr_name, value)\n write_attribute_with_type_cast(attr_name, value, true)\n end", "title": "" }, { "docid": "bbfc89589eb93e3a8027a60c6c127b5b", "score": "0.55869466", "text": "def write_attr(attr_name, value)\n self[attr_name.to_sym] = value\n end", "title": "" } ]
6d81d8a57ac71ae9912a23889b29c49f
Decorate this node with the decorators set up in this node's Document
[ { "docid": "656cf2584457c8a220b91c87899accbc", "score": "0.72329766", "text": "def decorate!\n document.decorate(self) if document\n end", "title": "" } ]
[ { "docid": "516a643505b3632c319abedaf4e318be", "score": "0.76000273", "text": "def decorate(node); end", "title": "" }, { "docid": "516a643505b3632c319abedaf4e318be", "score": "0.76000273", "text": "def decorate(node); end", "title": "" }, { "docid": "23e1799af78830dbe652ce6d2be4e984", "score": "0.7596291", "text": "def decorate!\n document.decorate(self)\n end", "title": "" }, { "docid": "a425a60f1420f43cb736b6c1397677f2", "score": "0.6991658", "text": "def decorate(node)\n return unless @decorators\n @decorators.each { |klass,list|\n next unless node.is_a?(klass)\n list.each { |moodule| node.extend(moodule) }\n }\n end", "title": "" }, { "docid": "3e1fdfc45be42850ece6956b777f9586", "score": "0.68590724", "text": "def decorate(node)\n return unless @decorators\n\n @decorators.each do |klass, list|\n next unless node.is_a?(klass)\n\n list.each { |moodule| node.extend(moodule) }\n end\n end", "title": "" }, { "docid": "51bfbf6ae0d75d14a48c9fef610c0ff2", "score": "0.6372838", "text": "def decorate!; end", "title": "" }, { "docid": "51bfbf6ae0d75d14a48c9fef610c0ff2", "score": "0.6372838", "text": "def decorate!; end", "title": "" }, { "docid": "685688a7f08c593f4fa7c5706cdec87c", "score": "0.6077287", "text": "def initialize(document)\n @document = document.parent\n decorate!\n end", "title": "" }, { "docid": "ccac1491d14961308511c0051ef0be1c", "score": "0.59375113", "text": "def initialize(*args)\n super\n decorators(Nokogiri::XML::Node) << Nokogiri::Decorators::XBEL\n decorate!\n\n# self.root = '<xbel version=\"1.0\"></xbel>'\n end", "title": "" }, { "docid": "3776a39ebfd729babf1ee8f0d914aa42", "score": "0.5911699", "text": "def slop!\n unless decorators(XML::Node).include? Nokogiri::Decorators::Slop\n decorators(XML::Node) << Nokogiri::Decorators::Slop\n decorate!\n end\n\n self\n end", "title": "" }, { "docid": "7e6602a80e4d287d476fa25a2c5dc591", "score": "0.58505154", "text": "def decorators(key); end", "title": "" }, { "docid": "7e6602a80e4d287d476fa25a2c5dc591", "score": "0.58505154", "text": "def decorators(key); end", "title": "" }, { "docid": "7d9b9544141068fe21d8f50ea5209663", "score": "0.57316893", "text": "def slop!\n unless decorators(XML::Node).include?(Nokogiri::Decorators::Slop)\n decorators(XML::Node) << Nokogiri::Decorators::Slop\n decorate!\n end\n\n self\n end", "title": "" }, { "docid": "a1a5a3a8786c0f41e79cc209255b3d08", "score": "0.56863916", "text": "def _decorators!\n @_decorators = nil\n _decorators\n end", "title": "" }, { "docid": "a7b9bb77ce511d437c5d5f050d29fc59", "score": "0.55004734", "text": "def each(&block)\n decorators.each(&block)\n end", "title": "" }, { "docid": "8d5a21950972af64370a28d108d774d1", "score": "0.54916567", "text": "def initialize(document, options)\n @document = document.parent\n decorate!\n end", "title": "" }, { "docid": "06b3c2d580d9d67d8989a082aec0d366", "score": "0.54031473", "text": "def decorators\n _decorators.map { |d| CallableDecorator.new(d) }\n end", "title": "" }, { "docid": "be3ada4a78117e5311194a559ac01720", "score": "0.5301822", "text": "def decorates(*args)\n args.each do |name|\n __delegates << name\n end\n end", "title": "" }, { "docid": "b1553f07a0aff428dcadeb582d34d103", "score": "0.5295353", "text": "def add_attrs\n yield self\n end", "title": "" }, { "docid": "cc9752b2355edb29a4dc946007ce1cad", "score": "0.52296567", "text": "def annotator; end", "title": "" }, { "docid": "4b594de784de4227289c1ed20f218bdc", "score": "0.5217851", "text": "def add_writer_tags(klass, new_method, member); end", "title": "" }, { "docid": "39b7d76c4b8e18cb0d9ab9da5d177858", "score": "0.5214203", "text": "def wrap(node_or_tags); end", "title": "" }, { "docid": "970f9e03b60dc357db1ebb9053030514", "score": "0.51984155", "text": "def collection_decorator\n\n\n\n\n\n\n\n if decorator_class\n\n\n\n\n\n\n\n Wrapper.wrap decorator_class\n\n\n\n\n\n\n\n end\n\n\n\n\n\n\n\n end", "title": "" }, { "docid": "1999acd3d4880c3d58c90b04877bea59", "score": "0.51899457", "text": "def decorate_with(decorator)\n tap do\n self.entity = decorator.represent(entity)\n end\n end", "title": "" }, { "docid": "11c53c7f5b52969cfd3d0d110102878d", "score": "0.5182379", "text": "def initialize(decorators = [])\n @decorators = decorators\n end", "title": "" }, { "docid": "eb6399430d93774191f5c32a57f58db8", "score": "0.51629686", "text": "def process_style_modifiers\n @doc.css('b', 'i', 'em', 'strong', 'ins', 'u', 'del', 'cite').each do |node|\n # We are getting the html of the children, we can't use {node.text} here\n # because we would be missing all the other html tags.\n text = node.children.to_s\n replacement_value = MODIFIERS[node.name.to_sym]\n\n node.replace(replacement_value + text.strip + replacement_value)\n end\n end", "title": "" }, { "docid": "5a192ddfdf79a858ccfa9a4d6dad7864", "score": "0.51565844", "text": "def decorate\n @decorate ||= OfferDecorator.new self\n end", "title": "" }, { "docid": "90a6a9ea4baa4dd0daafcbd156b56d78", "score": "0.5146464", "text": "def decorators\n DecoratorList.new(\n DecoratorWithArguments.new(DefaultClass, TriplePoweredResource),\n DecoratorWithArguments.new(ClassConfiguration, config_map)\n )\n end", "title": "" }, { "docid": "5ac561e007c114e7c928d430a7c5b9c3", "score": "0.5126086", "text": "def render(*args)\n decorate_all\n super\n end", "title": "" }, { "docid": "962d4ccaf7c6d4dde6e2a61746c36a7a", "score": "0.5123487", "text": "def load_decorators_from_class\n self.class.decorators.each { |decorator_class, options| decorate(decorator_class, options) }\n self\n end", "title": "" }, { "docid": "81877c00e20b69d0541e902dd65c197b", "score": "0.5094787", "text": "def __auto_decorate_exposed_ones_\n __decorate_ivars__\n __decorate_exposed_ones_\n __decorate_ctx_exposed_ones_ \n rescue StandardError => e\n __handle_decorate_error_(e)\n end", "title": "" }, { "docid": "51ee28699018c76d62fc936c3e1d4280", "score": "0.5079639", "text": "def add_nodes(*args)\n node = super\n node.fontname = @font\n node\n end", "title": "" }, { "docid": "3030f01606dc2f884b38476903d25d2a", "score": "0.5054361", "text": "def decorator( name, **options, &block )\n\t\tname = name.to_sym\n\t\tself.decorators[ name ] = block\n\t\tself.decorator_options[ name ] = options\n\tend", "title": "" }, { "docid": "363d1e9105310789fa706c953a5b0114", "score": "0.4996908", "text": "def _actual_decorator\n @_decorator\n end", "title": "" }, { "docid": "c89d1e2439d792820b52248dddea60b8", "score": "0.4967928", "text": "def decorated_tokens\n description.map(&:decorate)\n end", "title": "" }, { "docid": "22762355d422cb680ff072038a43414f", "score": "0.49606344", "text": "def decorators(key)\n @decorators ||= {}\n @decorators[key] ||= []\n end", "title": "" }, { "docid": "caa5c8b5d8e8adba41f78fe1b4906b14", "score": "0.49573275", "text": "def decorate(decorator_class, *args)\n validate!\n decorators << [decorator_class, args]\n end", "title": "" }, { "docid": "70bd0212028029765268645f6d3cb848", "score": "0.49506447", "text": "def decorate(object_or_enumerable, with: :__guess__)\n self.class.decorate(object_or_enumerable, with: with)\n end", "title": "" }, { "docid": "70fc67e44a765b67c5346013b151682b", "score": "0.49348313", "text": "def new_body(node)\n return super unless its?(node)\n\n transform_its(node.body, node.send_node.arguments)\n end", "title": "" }, { "docid": "597c44554eb59f4492c669f690c86848", "score": "0.49187225", "text": "def wrap_with_paragraphs(env, nodes); end", "title": "" }, { "docid": "adfc414c9019a2f02828658ca86dc18b", "score": "0.49076867", "text": "def prepended_writer=(*args, **kw_args)\n super\n end", "title": "" }, { "docid": "2fd26b1878870804e4563e54dd3d2259", "score": "0.4900138", "text": "def all_decorators\n pop_decorators + eigenclass_engine.all_decorators\n end", "title": "" }, { "docid": "87bda4ac82b334eee86480790c3a7b3e", "score": "0.48756328", "text": "def decorate(decoration)\n if DECORATION_TYPE_NAMES.key?(decoration.to_i)\n primitive \"decorate #{DECORATION_TYPE_NAMES[decoration.to_i]}\"\n else\n primitive \"decorate #{enquote(decoration)}\"\n end\n end", "title": "" }, { "docid": "23239238f1d3f38f4ba33fed807a5731", "score": "0.48682654", "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": "43d92fe872b1f724f5d738963cd7e44c", "score": "0.48625335", "text": "def add_public_and_protected(doc)\n\n return if doc.nil?\n\n store_public_and_protected_class_members(doc)\n\n next_doc = load_parent(doc)\n add_public_and_protected(next_doc)\n\n end", "title": "" }, { "docid": "df2d2025c5f0c9152f875d6b862eeecb", "score": "0.48387054", "text": "def generate_decorator\n inside 'app' do\n inside 'decorators' do\n create_file \"#{file_name}.rb\", <<-FILE\nclass #{file_name.camelize} < BaseDecorator\n\nend\n FILE\n end\n end\n end", "title": "" }, { "docid": "e386bca459a8c7546b7450a9f00e399c", "score": "0.48266482", "text": "def decorate(record)\n if @decorator_class\n @decorator_class.decorate(record)\n else\n record\n end\n end", "title": "" }, { "docid": "3f9815376137767893c203ff02ccf1cb", "score": "0.48157126", "text": "def method_annotator(name, &block)\n (class << self; self; end).module_eval do\n define_method(name) do |*args|\n anns = { name => (args.size > 1 ? args : args.first) }\n Methods.pending_annotations[self] << [anns, block]\n end\n end\n end", "title": "" }, { "docid": "e5df91f4051f01d266c5fecf06b833f0", "score": "0.48149663", "text": "def decorators(key)\n @decorators ||= Hash.new\n @decorators[key] ||= []\n end", "title": "" }, { "docid": "916fee4c8da5bc6b1675da2becf774fa", "score": "0.48078084", "text": "def included(descendant)\n super\n\n define_delegate_macro(descendant)\n end", "title": "" }, { "docid": "bc509db9dd4b0327cf0711a17e3f7434", "score": "0.48002148", "text": "def decorate_item(item)\n item_decorator.call(item, context: context)\n end", "title": "" }, { "docid": "2492f60b7939187164e672f6685e4118", "score": "0.4799322", "text": "def method_missing(method, *args)\n super unless object.respond_to? method\n\n # We want to define it on the singleton class, not the whole Decorator\n # class, otherwise it would grow continually across all decorators.\n define_singleton_method method do\n object.send method, *args\n end\n\n send method, *args\n end", "title": "" }, { "docid": "2b5e01880ac7eed2e01ec264cbc7bc70", "score": "0.4785272", "text": "def decorate(model)\n ActiveDecorator::Decorator.instance.decorate(model)\n end", "title": "" }, { "docid": "2d0f29011d737b4e1b7cd019db2308c3", "score": "0.47827548", "text": "def add_doc(doc)\n\n return if doc.nil?\n\n store_all_class_members(doc)\n\n next_doc = load_parent(doc)\n\n # Start recursing superclasses.\n add_public_and_protected(next_doc)\n\n end", "title": "" }, { "docid": "f5fda80df243c748f5ee7ae81b6d8a2f", "score": "0.47776523", "text": "def document\n capture_args\n capture_return\n super\n end", "title": "" }, { "docid": "795998593b63a2c033e2e11eebc125e5", "score": "0.47564113", "text": "def wraps\n meta.fetch(:wraps, [])\n end", "title": "" }, { "docid": "8be73b1fa6dc0a0b1f944eab36ec8429", "score": "0.47276524", "text": "def add_reader_tags(klass, new_method, member); end", "title": "" }, { "docid": "d471b9ac79c9914a17b660f71365d549", "score": "0.47257116", "text": "def decorated_object_behavior\n #code\n end", "title": "" }, { "docid": "82118d0b24d5eed3eff02b1a14565e79", "score": "0.47231978", "text": "def method_missing(method, *args, &block)\n super unless term_colorizer_methods.include? method\n self.class.send(:define_method, method) do\n str = self\n str = add_normal_color(str, method) if color_methods.include? method\n str = add_bright_color(str, method) if bright_color_methods.include? method\n str = add_bg_color(str, method) if bg_color_methods.include? method\n str = add_underline(str) if \"underline\".eql? method.to_s\n str = add_strikethrough_effect(str) if \"strikethrough\".eql? method.to_s\n str = str + \"\\e[0m\" unless str.end_with? \"\\e[0m\"\n str\n end and self.send(method, *args)\n end", "title": "" }, { "docid": "73072fdf89c32db1577f8de648bf9dde", "score": "0.47196642", "text": "def on_def(node)\n return unless in_migration?(node)\n\n node.each_descendant(:send) do |send_node|\n method_name = node.children[1]\n\n if method_name == :datetime || method_name == :timestamp\n add_offense(send_node, location: :selector, message: format(MSG, method_name))\n end\n end\n end", "title": "" }, { "docid": "1824dc8bf3b0c1096504d53a5df54596", "score": "0.47196138", "text": "def create_model_design_doc_reader\n model.instance_eval \"def #{method}; @#{method}; end\"\n end", "title": "" }, { "docid": "ff20fb57c4f4debfdb1c91aa6a8791b1", "score": "0.47086567", "text": "def _decorators\n if @_decorators\n return @_decorators\n elsif !@_decorator_chain\n return []\n end\n\n decorator = @_decorator_chain\n @_decorators = []\n until decorator.is_a?(Decorum::ChainStop) \n @_decorators << decorator\n decorator = decorator.next_link\n end\n @_decorators\n end", "title": "" }, { "docid": "423986cf0613526e56f8ddb9eacca003", "score": "0.47060105", "text": "def collection_decorator\n if decorator_class\n Wrapper.wrap decorator_class\n end\n end", "title": "" }, { "docid": "e1ae9bb508eb184d95d32f9e1596b67b", "score": "0.4699083", "text": "def on_embdoc(token)\n log \"EMBDOC: '#{token}'\"\n super(token)\n end", "title": "" }, { "docid": "f59e9fb731e1bd7e620b43fda8d1aaf7", "score": "0.4697892", "text": "def add_annotations(elements, level = T.unsafe(nil), parent = T.unsafe(nil)); end", "title": "" }, { "docid": "47ecd4508a974392523e571dbf4715f8", "score": "0.46908742", "text": "def decorate_review(review, current_user)\n REVIEW_DECORATOR.decorate(review, current_user)\n end", "title": "" }, { "docid": "14cea2a1c5b9e46a4701df6e1db24453", "score": "0.4673153", "text": "def initialize markup = nil\n super nil, markup\n\n @markup.add_regexp_handling RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF\n @markup.add_regexp_handling(/(((\\{.*?\\})|\\b\\S+?)\\[\\S+?\\])/, :TIDYLINK)\n\n add_tag :BOLD, '', ''\n add_tag :TT, '', ''\n add_tag :EM, '', ''\n\n @res = []\n end", "title": "" }, { "docid": "2b5a787a0e7ab4cc61f393dc870a0908", "score": "0.4658116", "text": "def transform_body(node, base_indent)\n \"#{base_indent} #{new_body(node)}\"\n end", "title": "" }, { "docid": "a9eeb6278cd726fc62cd65b4b3fadfe6", "score": "0.46229726", "text": "def wraps?; @wraps; end", "title": "" }, { "docid": "9a53234f1bdb9e40207e086645f9fc61", "score": "0.45932642", "text": "def decorate_collection(collection, decorator_class)\n decorated_collection = decorator_class.decorate_collection(collection)\n yield(decorated_collection) if block_given?\n decorated_collection\n end", "title": "" }, { "docid": "413ca7c9ba30655c67800ac58e35bd89", "score": "0.45874378", "text": "def doc_transformed(root)\n\n end", "title": "" }, { "docid": "1e565f63bdd69823b9dace2721bef810", "score": "0.4565635", "text": "def render_decoration type, block, **args\n return unless block[:decorations].present? && block[:decorations][type].present?\n\n data = block[:decorations][type]\n classes = [type]\n classes << \"#{type}--#{args[:alignment] || data[:alignment] || 'left'}\" unless type == :circle\n classes << \"gradient--#{data[:color] || 'orange'}\" if type == :gradient\n\n if type == :gradient && args[:size]\n args[:size].each do |size|\n classes << \"gradient--#{size}\"\n end\n end\n\n if type == :circle\n inline_svg_tag 'graphics/circle.svg', class: classes\n elsif type == :sidetext\n classes << 'sidetext--overlay' unless args[:static]\n content_tag :div, data[:text], class: classes\n else\n tag.div class: classes\n end\n end", "title": "" }, { "docid": "a2c3d3a0612b8e85f83994503f643a43", "score": "0.45621997", "text": "def method_added(sym)\n current = nil\n each_ancestor do |ancestor|\n if ancestor.lazy_registry.has_key?(sym)\n current = ancestor\n break\n end\n end\n \n if current\n args = current.lazy_registry[sym]\n const_attrs[sym] ||= Lazydoc.register_caller(*args)\n end\n \n super\n end", "title": "" }, { "docid": "c659b8266176cefbdde436c593fba2cf", "score": "0.45538864", "text": "def render_document_class(document = @document)\n types = super || \"\"\n types << \" #{document_class_prefix}private\" if document.private?(current_exhibit)\n types\n end", "title": "" }, { "docid": "4df5e2c7f493d8f55934f46e1fa664d8", "score": "0.4549653", "text": "def setshadow(*)\n super\n end", "title": "" }, { "docid": "80d37336a9a929a5563e069058c04925", "score": "0.4542922", "text": "def write_via(parent)\n @parent = parent\n context(parent.output, parent.prettyprint, parent.indentation, parent.helpers) do\n content\n end\n end", "title": "" }, { "docid": "7ceee05a5132a1fe170797710fde9f0a", "score": "0.45353428", "text": "def decoration_tokens\n @decoration_tokens ||= begin\n dt = Tml::Tokenizers::Decoration.new(label)\n dt.parse\n dt.tokens\n end\n end", "title": "" }, { "docid": "551b47e503b59d5589953698d13e8f2b", "score": "0.45260638", "text": "def setup_markup_transform(&block)\n self.send :define_method, :markup, block\n end", "title": "" }, { "docid": "6cee62cd85c4670ff0bee18ec3893114", "score": "0.4520054", "text": "def add_node( node )\n super( node )\n __add_node__( node )\n end", "title": "" }, { "docid": "7126a053555f05781c4caaf24ef5c4d6", "score": "0.4518131", "text": "def initialize\r\n raise MissingFormatterMethodError unless @node\r\n @default_font_size = @document.default_paragraph_style.font_size\r\n set_text_runs\r\n end", "title": "" }, { "docid": "f5f6a1d0cd4aedea3382a1eae97a3872", "score": "0.45173377", "text": "def start_doc\n return if @done_documenting\n\n @document_self = true\n @document_children = true\n @ignored = false\n @suppressed = false\n end", "title": "" }, { "docid": "c38cd382e9295acd42814a19ed90eab1", "score": "0.45158297", "text": "def decorate(item, **opt)\n # noinspection RubyMismatchedArgumentType\n generate(item, force: true, **opt)\n end", "title": "" }, { "docid": "00fc68eb2beba70bdd1ae8219ba99309", "score": "0.45118356", "text": "def settextcolorind(*)\n super\n end", "title": "" }, { "docid": "ee55d46b464828c9e4fe269fef8110e4", "score": "0.44985875", "text": "def modify\n super\n end", "title": "" }, { "docid": "da1c89805bad5312ad764dc070bd0aaf", "score": "0.44932106", "text": "def initialize\n @compositor = nil\n @sym = :document\n @children = {}\n creation\n end", "title": "" }, { "docid": "3dc8b0e0570c6e41ba412e1d6b4520cc", "score": "0.44695875", "text": "def decorate(obj)\n return obj if defined?(Jbuilder) && (Jbuilder === obj)\n\n case obj\n when Array\n obj.each {|e| decorate e }\n when Hash\n obj.each_value {|v| decorate v }\n when nil, true, false\n # Do nothing\n else\n if defined? ActiveRecord\n if obj.is_a? ActiveRecord::Relation\n return decorate_relation obj\n elsif ActiveRecord::Base === obj\n obj.extend ActiveDecorator::Decorated unless ActiveDecorator::Decorated === obj\n end\n end\n\n d = decorator_for obj.class\n obj.extend d if d && !(d === obj)\n end\n\n obj\n end", "title": "" }, { "docid": "daf59713f7d94bcab64ddbaac8c7f7f2", "score": "0.44690913", "text": "def myletter\n \n end", "title": "" }, { "docid": "483bac4c95fab20fe73c7561872958ff", "score": "0.44676045", "text": "def decorated_resource\n @document.decorated_resource\n end", "title": "" }, { "docid": "d59b9ecfd0a5669a02ac8556ef50c402", "score": "0.44650447", "text": "def selntran(*)\n super\n end", "title": "" }, { "docid": "780ae5f8822a5ec0fc037d7648d7a3c4", "score": "0.44582066", "text": "def initialize\n @attribute_manager = RDoc::Markup::AttributeManager.new\n @output = nil\n end", "title": "" }, { "docid": "ea4e98fc18ebdd4c6b60f23b57c4a203", "score": "0.44565246", "text": "def wrap\n clasp_entry_nodes\n clasp_inner_nodes\n clasp_end_nodes\n\n create_enclosing_representation\n store_in_parent\n end", "title": "" }, { "docid": "ec05955ec89dd86cca1283e4a3f53774", "score": "0.4455896", "text": "def wrapped_by_paragraph; end", "title": "" }, { "docid": "97bcb28f4a052222883097bb954d95e2", "score": "0.44539416", "text": "def on_defs(node); end", "title": "" }, { "docid": "6f3e20a38084b2e46bcb1ac30c7d1198", "score": "0.4448246", "text": "def to_definition(*args)\n complete_overrides\n super\n end", "title": "" }, { "docid": "df93c6605469e697f1c1bdfc13b3dc25", "score": "0.4443265", "text": "def apply_to(rep)\n Nanoc3::RuleContext.new(rep).instance_eval &@block\n end", "title": "" }, { "docid": "73131df1f100f9c74507d336ec0be291", "score": "0.44426045", "text": "def document\n comment_code\n super\n end", "title": "" }, { "docid": "03977aaab4d8a7f0b58a6c0fb09551e7", "score": "0.4435117", "text": "def add_child_node_and_reparent_attrs(node); end", "title": "" }, { "docid": "03977aaab4d8a7f0b58a6c0fb09551e7", "score": "0.4435117", "text": "def add_child_node_and_reparent_attrs(node); end", "title": "" }, { "docid": "305d1fa85423e8ad8bd972bae8b45c12", "score": "0.4421699", "text": "def semanticize_font_styles!\n @document.tree.css('span').each do |node|\n if node.bold?\n node.node_name = 'strong'\n elsif node.italic?\n node.node_name = 'em'\n end\n end\n end", "title": "" }, { "docid": "57984c51c8fb03d8c963c96a5721a6d2", "score": "0.44192904", "text": "def decorator_class\n Staff::ProposalDecorator\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "34ea466128aabaf23a3a2fffc218c14b", "score": "0.0", "text": "def set_sale\n @sale = Sale.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59219855", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.589884", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889191", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58780754", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5863248", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.58094144", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.57375425", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57285565", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.57149214", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.56900954", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.56665677", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.5651118", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5648135", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56357735", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5627078", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5608873", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5598699", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5598419", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5589822", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55084664", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.5504379", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465574", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.5464707", "text": "def on_setup(&block); end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54471064", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54455084", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5437386", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54160327", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5397424", "text": "def post_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392518", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.5385411", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53487605", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5346655", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53448105", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5342072", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5341318", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53243506", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53025913", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.5283114", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5282289", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.52585614", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.52571374", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.52483684", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.5244467", "text": "def action_awareness\n if action_aware?\n if [email protected]?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.5236853", "text": "def after_setup\n end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52330637", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52300817", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.522413", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.521999", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.5215832", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.5213786", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.52100146", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52085197", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5203262", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5202406", "text": "def performed(action)\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.520174", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.5201504", "text": "def create_setup\n \n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.5191404", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5178325", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.51765746", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.5162045", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5150735", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.5143402", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51415485", "text": "def code_action_provider; end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51376045", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.51318985", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.5115387", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5109771", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5107364", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.5106081", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51001656", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50964546", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.5093199", "text": "def add_callbacks(base); end", "title": "" } ]
c569a9851e33ada7edb53ce6b7690d5a
The constructor which takes a hash containing configuration parameters. Valid configuration parameter names are as follows. :host :service_owner_api_key :service_owner_api_secret :service_api_key :service_api_secret
[ { "docid": "d619be9a1024847c88656c9d71f8d9b5", "score": "0.8686222", "text": "def initialize(config = {})\n @host = extract_value(config, :host)\n @service_owner_api_key = extract_value(config, :service_owner_api_key)\n @service_owner_api_secret = extract_value(config, :service_owner_api_secret)\n @service_api_key = extract_value(config, :service_api_key)\n @service_api_secret = extract_value(config, :service_api_secret)\n end", "title": "" } ]
[ { "docid": "1380f426d47592b2617c1c5781dda504", "score": "0.75518495", "text": "def initialize(host, api_key: nil, api_secret: nil)\n @host = host\n @api_key = api_key\n @api_secret = api_secret\n\n end", "title": "" }, { "docid": "029df89b47cf12d735b64ccfa0a694bc", "score": "0.75445294", "text": "def initialize(host, api_key: nil, api_secret: nil)\n @host = host\n @api_key = api_key\n @api_secret = api_secret\n end", "title": "" }, { "docid": "6c0579057881bd7f5b57d25958e67da3", "score": "0.7454808", "text": "def initialize(opts = {})\n raise RuntimeError, \"You must provide an API key and host\" unless opts[:apikey] && opts[:host]\n @apikey = opts[:apikey]\n @host = opts[:host]\n end", "title": "" }, { "docid": "7db2bd5ee771c9d2ad89e6eaf5c22d4b", "score": "0.7310426", "text": "def initialize(host = nil, key = nil, user = nil, pass = nil, port = 55443)\n @host = host || MooMoo.config.host\n @key = key || MooMoo.config.key\n @user = user || MooMoo.config.user\n @pass = pass || MooMoo.config.pass\n @port = port || MooMoo.config.port\n end", "title": "" }, { "docid": "d3fed48bd65caf3254b7d710be1f3651", "score": "0.72486067", "text": "def initialize(\n api_key:,\n secret_key:,\n host: \"dns.idcfcloud.com\",\n endpoint: \"/api/v1\",\n verify_ssl: true\n )\n\n @api_key = api_key\n @secret_key = secret_key\n @host = host\n @endpoint = endpoint\n @verify_ssl = verify_ssl\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72297996", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "188acbb0d168ee009fa74d14bccfec24", "score": "0.72289765", "text": "def initialize(config)\n super(config, SERVICE_INFO)\n end", "title": "" }, { "docid": "6f30ac755af6f6e38bcd21a5fe7d3677", "score": "0.7063046", "text": "def initialize(host: nil, o_auth_access_token: nil)\r\n Configuration.host = host if host\r\n Configuration.o_auth_access_token = o_auth_access_token if o_auth_access_token\r\n end", "title": "" }, { "docid": "233dd3494c69674f09745a0fba7b84b7", "score": "0.7054576", "text": "def initialize(config)\n @access_token = config.delete(:access_token) || fail(\n ArgumentError, 'Missing access_token option'\n )\n\n @api_address = config.delete(:api_address) || DEFAULT_API_ADDRESS\n end", "title": "" }, { "docid": "3a094bad328b4654f4bbd0e8dcec0c02", "score": "0.7052483", "text": "def initialize(params)\n @api_base_url = params[:api_base_url]\n @api_key = params[:api_key]\n @api_secret = params[:api_secret]\n @api_spec = params[:api_spec]\n @timeout = 60\n if (params.key?(:config))\n config = params[:config]\n if (config.key?(:timeout))\n @timeout = config[:timeout]\n end\n end\n end", "title": "" }, { "docid": "0388878f315f843ed74a6e7a1b295024", "score": "0.70211357", "text": "def initialize(api_key_or_params={})\n @host = HOST_URL\n @api = API_PATH\n @verify_ssl = true\n api_key_or_params={} if api_key_or_params.nil? # fix for nil value as argument\n api_key_or_params = {:api_key => api_key_or_params} if api_key_or_params.is_a?(String)\n api_key_or_params = Config.get if Config.parsed? and api_key_or_params.empty?\n set_up_configuration api_key_or_params if api_key_or_params.is_a? Hash\n end", "title": "" }, { "docid": "9c1078f3ff2cb96a0d3fcf133285e6de", "score": "0.7019418", "text": "def initialize(config)\n @configuration = config.collect{|k,v| [k.to_s, v]}.to_h\n if @configuration['server_url'] == \"\" && @configuration['tenant'] == \"\"\n $logger.error(\"Either ServerURL or Tenant must be set\")\n raise InvalidConfigurationException\n end\n \n if @configuration['username'].nil? || @configuration['password'].nil?\n $logger.error(\"Must provide username and password\")\n raise InvalidConfigurationException\n end\n \n if @configuration['tld'].nil?\n @configuration['tld'] = DEFAULT_TLD\n end\n \n if @configuration['api_path_uri'].nil?\n @configuration['api_path_uri'] = DEFAULT_API_PATH_URI\n end\n @configuration['api_path_uri'].delete_suffix!(\"/\")\n \n if @configuration['token_path_uri'].nil?\n @configuration['token_path_uri'] = DEFAULT_TOKEN_PATH_URI\n end\n @configuration['token_path_uri'].delete_suffix!(\"/\")\n end", "title": "" }, { "docid": "675d93e6bce6917fa46714aa11f61f61", "score": "0.700139", "text": "def initialize(host = nil, provider_authentication_key = nil)\n @host = host\n @provider_authentication_key = provider_authentication_key\n end", "title": "" }, { "docid": "0cfb44a5c1c03a278f422fc5e1d295d2", "score": "0.6954702", "text": "def initialize(params={})\n config = defaults.merge(params)\n @hostname = config[:hostname]\n @username = config[:username]\n @servicename = config[:servicename]\n @eqcmd_path = config[:eqcmd_path]\n @ssh_options = config[:ssh_options]\n\n raise ArgumentError, 'hostname missing' if hostname.nil? or hostname.empty?\n raise ArgumentError, 'username missing' if username.nil? or username.empty?\n raise ArgumentError, 'servicename missing' if servicename.nil? or servicename.empty?\n end", "title": "" }, { "docid": "29a1d7523d8291d8deea8ff9e7f59e3f", "score": "0.6952852", "text": "def initialize(api_host, api_port = 80)\n @api_host = api_host\n @api_port = api_port\n end", "title": "" }, { "docid": "3314d6b82037747f7d9c91a962c16ded", "score": "0.69330513", "text": "def initialize project, credentials, host: nil, timeout: nil,\n client_config: nil\n @project = project\n @credentials = credentials\n @host = host || V1::SpannerClient::SERVICE_ADDRESS\n @timeout = timeout\n @client_config = client_config || {}\n end", "title": "" }, { "docid": "3314d6b82037747f7d9c91a962c16ded", "score": "0.69330513", "text": "def initialize project, credentials, host: nil, timeout: nil,\n client_config: nil\n @project = project\n @credentials = credentials\n @host = host || V1::SpannerClient::SERVICE_ADDRESS\n @timeout = timeout\n @client_config = client_config || {}\n end", "title": "" }, { "docid": "ee506766ae071bb22f21f4b32faa4b13", "score": "0.6931141", "text": "def initialize(host)\n \n @host = host\n load_configuration\n end", "title": "" }, { "docid": "37b7d7820173e118bd88229caf177653", "score": "0.69112325", "text": "def initialize(config={organization_name: nil, hostname: nil, caller_id: nil})\n raise RuntimeError.new(\"organization_name is required\") if config[:organization_name].nil?\n\n @organization_name = config[:organization_name]\n @hostname = config[:hostname] || \"#{@organization_name}.api.crm.dynamics.com\"\n @organization_endpoint = \"https://#{@hostname}/XRMServices/2011/Organization.svc\"\n @caller_id = config[:caller_id]\n end", "title": "" } ]
1b8eb0fcd57cb55c17296275e362928d
Returns true/false on whether the adapter you want to use is supported for the cache.
[ { "docid": "c73644116117ab920cf26089889c9a52", "score": "0.89256847", "text": "def adapter_supported?(a = cache_conn_instance.get(cache_name).class)\n return !unsupported_adapters.include?(a)\n end", "title": "" } ]
[ { "docid": "9e17cfda38819dc511c5d5e33118551e", "score": "0.708397", "text": "def cacheable?\n @cacheable\n end", "title": "" }, { "docid": "b9645c258ad8c17f17de7a05bc0e9774", "score": "0.7032771", "text": "def enabled?\n @cache_enabled\n end", "title": "" }, { "docid": "b9645c258ad8c17f17de7a05bc0e9774", "score": "0.7032771", "text": "def enabled?\n @cache_enabled\n end", "title": "" }, { "docid": "fd20c955b1e4ba871271b7f2c782af4c", "score": "0.69013053", "text": "def enabled?\n @config[:caching][:enabled]\n end", "title": "" }, { "docid": "550490c9226ac4de6c4f55e41098c76a", "score": "0.68530357", "text": "def cacheable?\n return false if method != :get && method != :head\n return false if cache_control.no_store?\n true\n end", "title": "" }, { "docid": "b2d3a500008b86cb39bd3a5fef0f3ed0", "score": "0.6743705", "text": "def adapter\n a = cache_conn_instance.get(cache_name)\n if adapter_supported?(a.class)\n return a\n else\n raise Cachetastic::Errors::UnsupportedAdapter.new(cache_name, a.class)\n end\n end", "title": "" }, { "docid": "2363dd8cbfc93923199e2ce44b088779", "score": "0.6741012", "text": "def cacheable?\n true\n end", "title": "" }, { "docid": "f21f3b8f62a9b59b9725ba992110a1f8", "score": "0.6738922", "text": "def cache_enabled?(opts)\n # only gets ever get cached\n return false unless opts[:method] == :get\n return false if opts[:cache_key].nil?\n return false unless Tml.cache.enabled?\n true\n end", "title": "" }, { "docid": "258a76671a6673d29a309d0f7e86764e", "score": "0.6706554", "text": "def supports?\n raise \"Method 'supports?' must be defined\"\n end", "title": "" }, { "docid": "b7c01eb750ec9e52b263611f50de281c", "score": "0.67018044", "text": "def supported?\n false\n end", "title": "" }, { "docid": "bf1e7a898ffc3efd3f6ae938cb9c48d9", "score": "0.66534424", "text": "def available?\n @backends.present?\n end", "title": "" }, { "docid": "328541eb19a5e2b0fd5da9bf20b868ba", "score": "0.6650801", "text": "def cacheable?(response)\n return false unless response.success?\n return false unless method.in? CACHEABLE_METHODS\n return false if header.cache_control && header.cache_control.include?('no-store')\n true\n end", "title": "" }, { "docid": "e6fd2a89a20bc7708c63366b18797abd", "score": "0.6647411", "text": "def supports?\n fail \"Method 'supports?' must be defined\"\n end", "title": "" }, { "docid": "7a8a8a95a0d73ab73cf14ada9e860527", "score": "0.6552265", "text": "def cached?\n options[:cache] == true\n end", "title": "" }, { "docid": "eed027dfb7bdb5a7bc9b6f6870eb59bc", "score": "0.65220124", "text": "def available?\n true\n end", "title": "" }, { "docid": "7905267cfaeedcdb02c4e2e55016c870", "score": "0.6477894", "text": "def available?\n true\n end", "title": "" }, { "docid": "aa397ba7f2c93e21d823c1ecee46b705", "score": "0.6466542", "text": "def available?\n return false\n end", "title": "" }, { "docid": "1581db49856bb603ee625e156c2cb9b7", "score": "0.6416033", "text": "def use_cache?(opts = {})\n return true if opts[:cache].nil?\n opts[:cache]\n end", "title": "" }, { "docid": "a7a61b3a9b4bbd134c3cbd9f562fb8ee", "score": "0.6415582", "text": "def read_from_cache?\n raise NotImplementedError, \"You must implement #{self.class}##{__method__}\"\n end", "title": "" }, { "docid": "01e8bafe3219398408458cb4bc0e076c", "score": "0.64094514", "text": "def available?\n raise ::NotImplementedError\n end", "title": "" }, { "docid": "afbc55f0b767fbd8c4b7f1db17136592", "score": "0.63897693", "text": "def supports_statement_cache?\n true\n end", "title": "" }, { "docid": "afbc55f0b767fbd8c4b7f1db17136592", "score": "0.63897693", "text": "def supports_statement_cache?\n true\n end", "title": "" }, { "docid": "616537b01fc0e94c331bb60f2f4bee45", "score": "0.6359451", "text": "def supports?\n [email protected]?\n end", "title": "" }, { "docid": "a068052f2daafe1f11a6cf0803c684fb", "score": "0.6343327", "text": "def available?\n false\n end", "title": "" }, { "docid": "a773e4a15a3181a378877fbc2b0b11b9", "score": "0.6329589", "text": "def available?()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "d273a637e69cba3a51af48d515f040da", "score": "0.6329505", "text": "def cache?\n caching && true\n end", "title": "" }, { "docid": "37b7cee8508ada8de3816526678b5c07", "score": "0.63069963", "text": "def cacheable?\n last.nil? || last.cacheable\n end", "title": "" }, { "docid": "d170ae404f324ac92ef8528a495efa30", "score": "0.6280848", "text": "def cacheable?\n return false unless CACHEABLE_RESPONSE_CODES.include?(status)\n return false if cache_control.no_store? || cache_control.private?\n validateable? || fresh?\n end", "title": "" }, { "docid": "1285d2fb99e0da60815e7719627f9b59", "score": "0.6254327", "text": "def should_cache?\n false\n end", "title": "" }, { "docid": "12fd9eddb84a06b9a654545c561e3897", "score": "0.6251038", "text": "def cache?\n false\n end", "title": "" }, { "docid": "1791acb08718c4c668a3c040e2ac5746", "score": "0.61945343", "text": "def supported?\n each_accepted_cipher_suite.any?\n end", "title": "" }, { "docid": "b2ee5c273000bc0ec6cc490d5b25e14e", "score": "0.6193196", "text": "def supported?\n CurrencyExchangeRate.supported?(self)\n end", "title": "" }, { "docid": "eb0aa67eb7ba0ce837e25d1b77c9fcee", "score": "0.61745363", "text": "def use_cache?\n super && !against_head?\n end", "title": "" }, { "docid": "eb0aa67eb7ba0ce837e25d1b77c9fcee", "score": "0.61745363", "text": "def use_cache?\n super && !against_head?\n end", "title": "" }, { "docid": "0db083e19ebe7ae8ddbbfbb23ba1369b", "score": "0.6155297", "text": "def cacheable_request?\n (request.get? || request.head?) && (request.params[:cache] != 'false')\n end", "title": "" }, { "docid": "9a19a915817a7dae9d6ab290b38f7e13", "score": "0.6143418", "text": "def data_available?\n true\n end", "title": "" }, { "docid": "a3f6256181795ff0d752821d4e15afab", "score": "0.61280566", "text": "def supports_required_capabilities?(tcp)\n (ToolProxy::ENABLED_CAPABILITY - tcp['capability_offered']).blank?\n end", "title": "" }, { "docid": "83b7ca02d83bf1f572789ea3e5088956", "score": "0.6127213", "text": "def template_cache_configured?\n if defined?(Rails)\n defined?(ActionController::Base) && ActionController::Base.perform_caching\n else\n Rabl.configuration.perform_caching\n end\n end", "title": "" }, { "docid": "0eab90576cb5b2602c34bb6da9b908f4", "score": "0.611863", "text": "def is_available\n return @is_available\n end", "title": "" }, { "docid": "c491cde42d1c1b9b7895b0f26e3684d8", "score": "0.6117832", "text": "def should_cache?\n ctrait = controller.trait\n\n [ Global.cache_all,\n ctrait[:cache_all],\n actions_cached.map{|k,v| k.to_s}.include?(method),\n ].any?\n end", "title": "" }, { "docid": "6a9a453988628ca726de59909eed2401", "score": "0.60871494", "text": "def cached_lookup_allowed?\n @klass.use_activerecord_cache && arel.where_sql.nil? && arel.join_sources.empty? && @limit_value.nil? && @offset_value.nil?\n end", "title": "" }, { "docid": "ac5bdd7e8f631dc0ccd7ed05531aa6d5", "score": "0.6080613", "text": "def available?(obj)\n if self.methods\n return !!methods_available?(obj)\n else\n # In this case, the provider has to declare support for this\n # feature, and that's been checked before we ever get to the\n # method checks.\n return false\n end\n end", "title": "" }, { "docid": "be675f4187de9b235f37df88fa864dc8", "score": "0.6079337", "text": "def supports_platform?\n if @supports_platform.nil?\n @supports_platform = metadata.supports_platform?(@backend)\n end\n if @backend.backend.class.to_s == \"Train::Transports::Mock::Connection\"\n @supports_platform = true\n end\n\n @supports_platform\n end", "title": "" }, { "docid": "bddc60c1c2375587fefe95a99118b91a", "score": "0.6069159", "text": "def cached?\n cache_path.exist?\n end", "title": "" }, { "docid": "fbb3e396aa94934cfa050929b7f50b2e", "score": "0.60663545", "text": "def ok?\n ! adapter.nil?\n end", "title": "" }, { "docid": "4813576532fc99258b6fe27944abe327", "score": "0.605999", "text": "def performing_caching?\n @config ? @config.perform_caching : Rails.application.config.action_controller.perform_caching\n end", "title": "" }, { "docid": "1a95a42eca78d38bca45113e01b2fa08", "score": "0.604216", "text": "def cached?\n cache_path.exist?\n end", "title": "" }, { "docid": "ecfb91f3cb1adb40130ca95f3981f462", "score": "0.60330904", "text": "def valid?\n return false unless @adapter\n if sqlite_adapter?\n return true if @database\n else\n return super\n end\n false\n end", "title": "" }, { "docid": "70a475d2da84e267f4d26ff765a3e9d9", "score": "0.6025555", "text": "def supported?\n !!@supported_proc.call\n end", "title": "" }, { "docid": "36aa2d7165bec009a60d8f842010a546", "score": "0.60058695", "text": "def cache?\n val = @gapi.configuration.query.use_query_cache\n return false if val.nil?\n val\n end", "title": "" }, { "docid": "639b9c82eb8ad174394cca9a4cd837fd", "score": "0.6005596", "text": "def is_available?\n return @status == :AVAILABLE\n end", "title": "" }, { "docid": "6f288f16238f5363d654378fd5a521a9", "score": "0.6001452", "text": "def support?\n Support.new(ENV, verbose: verbose).support?\n end", "title": "" }, { "docid": "0533051dd84f5471081a07e0a38306af", "score": "0.59917855", "text": "def from_cache?\n @from_cache\n end", "title": "" }, { "docid": "a3d855bca93b3d90c90dc8ed8a0ac832", "score": "0.5983742", "text": "def available?\n !version.nil?\n end", "title": "" }, { "docid": "7a6edb516296528bfb24b8628b376682", "score": "0.59810466", "text": "def caching?\n @params.key?(:cache) ? @params[:cache] : @@caching\n end", "title": "" }, { "docid": "c2d4b63f0a4fa864e2405d2469fe869d", "score": "0.5979479", "text": "def written_to_cache?\n raise NotImplementedError, \"You must implement #{self.class}##{__method__}\"\n end", "title": "" }, { "docid": "cbae4ea43cada789adc277fe17929056", "score": "0.5978389", "text": "def has_cached_banner?\n @server.make_json_request('show.cache', tvdbid: @tvdbid)['data']['banner'] == 1\n end", "title": "" }, { "docid": "8eddb661d93a839a0ad2d81385e55bee", "score": "0.59771353", "text": "def cacheable?(env)\n result = false\n if (url = request_url(env)).blank?\n log(\"NO URI for request #{env.inspect}\")\n elsif cacheable_paths&.none? { |path| url.include?(path) }\n log(\"NON-CACHEABLE URI: #{url}\")\n else\n result = true\n end\n result\n end", "title": "" }, { "docid": "8eddb661d93a839a0ad2d81385e55bee", "score": "0.59771353", "text": "def cacheable?(env)\n result = false\n if (url = request_url(env)).blank?\n log(\"NO URI for request #{env.inspect}\")\n elsif cacheable_paths&.none? { |path| url.include?(path) }\n log(\"NON-CACHEABLE URI: #{url}\")\n else\n result = true\n end\n result\n end", "title": "" }, { "docid": "54244ce2cb0729f9d883b9492237f6b0", "score": "0.5963418", "text": "def requestable?\n # Sometimes a PUBFI002 error code isn't really an error,\n # but just means not available. \n if response_hash && response_hash[\"Error\"] && (response_hash[\"Error\"][\"ErrorNumber\"] == \"PUBFI002\")\n return false\n end\n\n # Items that are available locally, and thus not requestable via BD, can\n # only be found by looking at the RequestMessage, bah \n if locally_available?\n return false\n end\n\n return response_hash[\"Available\"].to_s == \"true\"\n end", "title": "" }, { "docid": "80b1bbd5f4b75741ccf85433006613fe", "score": "0.5946469", "text": "def available?\n !!version\n end", "title": "" }, { "docid": "b071b3f7af63def8a826e5009cc1c97d", "score": "0.59437233", "text": "def patchable?\n available? && loaded? && compatible?\n end", "title": "" }, { "docid": "1b4c616674aaa3e64f92cb90f39c252e", "score": "0.59298646", "text": "def required_capabilities?(tcp)\n (ToolProxy::ENABLED_CAPABILITY - tcp['capability_offered']).blank?\n end", "title": "" }, { "docid": "d666e2f0f46ab9679b83b5998e9e8fd7", "score": "0.5925732", "text": "def enabled?\n @parent.gemset_globalcache :enabled\n end", "title": "" }, { "docid": "3bb7f5d6f0e1db7239c09987f95b349b", "score": "0.592225", "text": "def enabled?\n REAPERS.include?(reaper)\n end", "title": "" }, { "docid": "310bd3d739975a2042008fc6ab9f9a92", "score": "0.5906707", "text": "def isSatisfiable?()\n\tend", "title": "" }, { "docid": "f5e1a3610e2fdc44bfef96e6c156af8c", "score": "0.59064734", "text": "def cache?\n persisted?\n end", "title": "" }, { "docid": "987bd79d5365844025336c2f5c509a1f", "score": "0.5899817", "text": "def supports_device_licensing\n return @supports_device_licensing\n end", "title": "" }, { "docid": "d3af2c900c44ee0f03157a87501dea41", "score": "0.589607", "text": "def supports?(type)\n supported.include? type.to_sym\n end", "title": "" }, { "docid": "b1bee706cffdf38c54067287cc437d45", "score": "0.5891824", "text": "def may_cache?\n may_cache_field?(headers['cache-control'])\n end", "title": "" }, { "docid": "0fbdc975b5c51c0c41e5ec507a5d9d78", "score": "0.5882593", "text": "def use?\n inclusively { enabled? && needed? }\n end", "title": "" }, { "docid": "257e611bf0e299ad19a69ce7ae54a20a", "score": "0.58802676", "text": "def available?\n return false if deleted?\n return false if karma < app_settings(:post_karma_barrier)\n true\n end", "title": "" }, { "docid": "869f9d4436ba6149aac03379b47fb1e0", "score": "0.58797365", "text": "def cached?\n !(!@cached)\n end", "title": "" }, { "docid": "a9de7f20be1f8d98df05d3f0982d85a5", "score": "0.5877105", "text": "def available?\n @dao.active?\n end", "title": "" }, { "docid": "1e17d8fbcba0ef3202746e30dd93c28c", "score": "0.5875501", "text": "def installed?\n raise NotImplementedError\n end", "title": "" }, { "docid": "ecf8091fb8b92b4ca0ae0397a989b6f0", "score": "0.5854971", "text": "def suitable?\n false\n end", "title": "" }, { "docid": "ecf8091fb8b92b4ca0ae0397a989b6f0", "score": "0.5854971", "text": "def suitable?\n false\n end", "title": "" }, { "docid": "ed08041c4e2f1e20fa98adaf6fbbe1e6", "score": "0.58549035", "text": "def cached?(key)\n false\n end", "title": "" }, { "docid": "f67711c382b798ec35dbeaabfb89502e", "score": "0.5848478", "text": "def requestable?\n (ill? || available? || recallable? ||\n processing? || on_order? || offsite? || ezborrow?)\n end", "title": "" }, { "docid": "cc5549dc4ed3da1b839a72a2617a85c7", "score": "0.5824695", "text": "def available?\n status == :available\n end", "title": "" }, { "docid": "57f38029639c3d9ef1a4e0696ad1bd1f", "score": "0.5821033", "text": "def sqlite_adapter?\n @adapter && (@adapter.downcase == 'sqlite' || @adapter.downcase == 'sqlite3')\n end", "title": "" }, { "docid": "2a0a03c01b60962b64d0c98a0b229004", "score": "0.5806188", "text": "def support?(mode)\n @modes.keys.include?(mode)\n end", "title": "" }, { "docid": "7fed0b6e6e5cf8710767b2cd06dffde1", "score": "0.5805203", "text": "def cached?\n io_index.kind_of?(Array)\n end", "title": "" }, { "docid": "d1e8f27332f5184e576417d44257db2a", "score": "0.5795485", "text": "def discoverable?(*)\n true\n end", "title": "" }, { "docid": "7cb9609f9bd3c94b24f0646df603775b", "score": "0.57876956", "text": "def object_storage?\n name.include?(\"ObjectStorage\")\n end", "title": "" }, { "docid": "a12e458a946db486aaffb52c81c0137c", "score": "0.5785597", "text": "def supported?(name); end", "title": "" }, { "docid": "67dc27d10cf0859d2e69acf48f4bf192", "score": "0.57801497", "text": "def connected?\n redis.exists(rate_limiter_key) == 1 &&\n redis.ttl(rate_limiter_key).to_i.positive?\n end", "title": "" }, { "docid": "21993fa1fa7c50ea163f401a4e4ec137", "score": "0.5776259", "text": "def using_local_cache?\n @use_local_cache == true\n end", "title": "" }, { "docid": "95574caa2586947df873f9bb21f5978a", "score": "0.5772711", "text": "def cached?\n @rules = cached_rules if cached_rules? && caching_on?\n end", "title": "" }, { "docid": "0b5dba3d98bdcebb8db2db2103bd75cd", "score": "0.57702845", "text": "def has_cacheable_credentials?\n bearer_token.present?\n end", "title": "" }, { "docid": "e3523f1fdc7ad7013c27e7a2734dfbd6", "score": "0.5769943", "text": "def should_queue?\n @options[:offline_queueing] && @offline_handler.queueing?\n end", "title": "" }, { "docid": "85af95a629692069f1feea0f60655cd3", "score": "0.5769106", "text": "def servers?\n [email protected]?\n # \n # return false if @cache.servers.blank?\n # @cache.stats\n # true\n # rescue\n # false\n end", "title": "" }, { "docid": "63d29ddabc9e563d8d09cef3acac2abe", "score": "0.5764582", "text": "def enabled?\n !host.nil?\n end", "title": "" }, { "docid": "c4b9a69835e49b19011e6fb8eeb69b3f", "score": "0.5759508", "text": "def consider_caching?(path)\n return false if self.disabled\n return true if self.except.blank? && self.only.blank?\n return false if list_match?(self.except, path)\n return true if self.only.blank?\n return true if list_match?(self.only, path)\n false\n end", "title": "" }, { "docid": "7c600cbe262a055bbfa2b880f35e0bd9", "score": "0.57487494", "text": "def define_cachedp_method\n # we don't expect this to be called more than once, but we're being\n # defensive.\n return if defined?(cached?)\n\n if defined?(::ActiveRecord) && ::ActiveRecord::VERSION::STRING >= '5.1.0'\n def cached?(payload)\n payload.fetch(:cached, false)\n end\n else\n def cached?(payload)\n payload[:name] == CACHED_QUERY_NAME\n end\n end\n end", "title": "" }, { "docid": "80eef3f89dba0a7f5962d22d1686438d", "score": "0.5744074", "text": "def supported?\n supports_platform? && supports_runtime?\n end", "title": "" }, { "docid": "768326e118841948670b2a423f17c6d9", "score": "0.57405674", "text": "def disk_cache_enabled; end", "title": "" }, { "docid": "846376dcce94c90744b9453272172237", "score": "0.57363033", "text": "def cache_on?; end", "title": "" }, { "docid": "846376dcce94c90744b9453272172237", "score": "0.57363033", "text": "def cache_on?; end", "title": "" }, { "docid": "d55744fdb492c0664454737ac5d3c02d", "score": "0.57321227", "text": "def supports?(url)\n return @service_types.member?(url)\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "a097fc15ff4615d838d930f25eff9164", "score": "0.0", "text": "def set_trajetpumd\n @trajetpumd = Trajetpumd.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59219855", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.589884", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889191", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58780754", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5863248", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.58094144", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.57375425", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57285565", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.57149214", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.56900954", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.56665677", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.5651118", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5648135", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56357735", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5627078", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5608873", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5598699", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5598419", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5589822", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55084664", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.5504379", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465574", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.5464707", "text": "def on_setup(&block); end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54471064", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54455084", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5437386", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54160327", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5397424", "text": "def post_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392518", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.5385411", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53487605", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5346655", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53448105", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5342072", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5341318", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53243506", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53025913", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.5283114", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5282289", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.52585614", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.52571374", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.52483684", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.5244467", "text": "def action_awareness\n if action_aware?\n if [email protected]?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.5236853", "text": "def after_setup\n end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52330637", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52300817", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.522413", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.521999", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.5215832", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.5213786", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.52100146", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52085197", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5203262", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5202406", "text": "def performed(action)\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.520174", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.5201504", "text": "def create_setup\n \n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.5191404", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5178325", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.51765746", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.5162045", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5150735", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.5143402", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51415485", "text": "def code_action_provider; end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51376045", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.51318985", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.5115387", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5109771", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5107364", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.5106081", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51001656", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50964546", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.5093199", "text": "def add_callbacks(base); end", "title": "" } ]
a8ca66ce8969524108ca9a69ecd00f07
spaces_around return all the spaces around player,nil if nothing
[ { "docid": "0c884b9a1379cb937876a6b7e1dd1f33", "score": "0.66671693", "text": "def spaces_around(direction = @directions)\n spaces = []\n directions.each{|d|\n spaces << @warrior.feel(d)\n }\n spaces\n end", "title": "" } ]
[ { "docid": "bab4ccd25f2091cb9fc1ef8fab2aee83", "score": "0.7000021", "text": "def getSpaces playerData\r\n spaces = []\r\n\tgame.spaces.each do |space|\r\n\t if space.owner==playerData\r\n\t spaces.push(space)\r\n\t end\r\n\tend\r\n\treturn spaces\r\n end", "title": "" }, { "docid": "781bca32e3ddce408bc828b694cc2018", "score": "0.6969576", "text": "def mySpaces\r\n return getSpaces @playerData\r\n end", "title": "" }, { "docid": "95eaa4de5c9ef6deaf30dd5812cba9a2", "score": "0.6687446", "text": "def spaces\n @spaces ||= space.one_or_more\n end", "title": "" }, { "docid": "dcc4a4f0093d4010a60c05550126649c", "score": "0.6560196", "text": "def getSpaces\n @spaces\n end", "title": "" }, { "docid": "dcc4a4f0093d4010a60c05550126649c", "score": "0.6560196", "text": "def getSpaces\n @spaces\n end", "title": "" }, { "docid": "726e32582abae6849465557802df1f37", "score": "0.65480334", "text": "def available_spaces\n spaces = []\n @board.each do |s|\n spaces << s if s != \"X\" && s != \"O\"\n end\n return spaces\n end", "title": "" }, { "docid": "9046952b322f8da6a359518596647b0a", "score": "0.64433867", "text": "def available_spaces\n\t\tspaces = []\n\n\t\[email protected]_with_index do |row, index|\n\t\t\trow.each_index { |column| spaces << [column, index] if @board[index][column] == \"_\" }\n\t\tend\n\t\t\n\t\tspaces\n\tend", "title": "" }, { "docid": "4349503afebd8a5d6850277edf66fa1f", "score": "0.63526785", "text": "def empty_space\r\n\ti = @rng.rand((@size_x-1)*(@size_y-1) - @snek.size - 1) # i-ième case vide du board\r\n\t0.upto(@size_x) do |x|\r\n\t\t0.upto(@size_y) do |y|\r\n\t\t\tif i <= 0 && @board[x][y] == ' '\r\n\t\t\t\treturn [x,y]\r\n\t\t\telse\r\n\t\t\t\ti -= 1\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\treturn nil # no more space\r\n end", "title": "" }, { "docid": "259404ad05b7a451b87668ddfeb223e4", "score": "0.6286938", "text": "def open_spaces(pt)\n spaces = Array.new\n pts = Array.new\n # 4 adjacent points\n pts << left_val(pt) << right_val(pt) << up_val(pt) << down_val(pt)\n # do we have any that are SPACE and not yet visited?\n pts.each { |pt| spaces << pt if (pt.val == SPACE && [email protected]?(pt)) }\n spaces\n end", "title": "" }, { "docid": "d1ac5322a6639fc55f5f8e9c45cac1e3", "score": "0.6277599", "text": "def space_per_player\n rules_hash[\"space_per_player\"]\n end", "title": "" }, { "docid": "0348263d55ce3353885a2b6811e3e43b", "score": "0.6211269", "text": "def available_spaces\n spaces = []\n @grid.each_with_index do |column, col_index|\n column.each_with_index do |space, row_index|\n spaces << [col_index, row_index] if space == nil\n end\n end\n spaces\n end", "title": "" }, { "docid": "d87ee8ba659c12a6053b14bee1f56e0f", "score": "0.6188481", "text": "def space(position)\n return nil_space if position.nil?\n @spaces.find{|s| s.position == position}\n end", "title": "" }, { "docid": "c15d359ab91b41b1fc970271bf6088a9", "score": "0.61774445", "text": "def current_player\r\n available_spaces.size.even? ? @player_o : @player_x\r\n end", "title": "" }, { "docid": "d9d8707e3d4311c02de54d77eee0eabf", "score": "0.61747545", "text": "def show_empty_spaces\n $game_temp.grid[0].each do |grid|\n grid.show if !grid.get_unit.is_a?(Game_Battler) && Grid.ally_spaces.include?($game_temp.grid[0].index(grid))\n end\n end", "title": "" }, { "docid": "5ef558e7db9ca9d1042424084497cf21", "score": "0.6161639", "text": "def spaces\n intervening_cols = col_distance > 0 ? between(self.start_space.col, self.to_space.col) : between(self.to_space.col, self.start_space.col)\n intervening_rows = row_distance > 0 ? between(self.start_space.row, self.to_space.row) : between(self.to_space.row, self.start_space.row)\n\n self.start_space.board.spaces.select do |space|\n intervening_cols.include?(space.col) && \n intervening_rows.include?(space.row) &&\n self.start_space.has_line_to?(space)\n end\n end", "title": "" }, { "docid": "caabb8d815ea5e1e628d9808005c5e4c", "score": "0.6104558", "text": "def available_spaces\n available = []\n @board.size.times do |i|\n available << i if empty_place?(i)\n end\n\n available\n end", "title": "" }, { "docid": "b2d621dfd56725e966b869e07d39c9fc", "score": "0.60707456", "text": "def spaces\n rooms = if cache == :none\n api.get_joined_rooms.joined_rooms.map { |id| Room.new(self, id) }\n else\n self.rooms\n end\n\n rooms.select(&:space?)\n end", "title": "" }, { "docid": "82064465c846b23e1cd941057931c006", "score": "0.6036851", "text": "def surrounding_space_clear?(pos)\n @gameboard[pos[0]][pos[1]].class == String ? true : false\n end", "title": "" }, { "docid": "4613a6b77740b566e9c13d576a5cbea1", "score": "0.60350144", "text": "def _space\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\" \")\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"\\t\")\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_space unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "4613a6b77740b566e9c13d576a5cbea1", "score": "0.60350144", "text": "def _space\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\" \")\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"\\t\")\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_space unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "4613a6b77740b566e9c13d576a5cbea1", "score": "0.60350144", "text": "def _space\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\" \")\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"\\t\")\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_space unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "1dcc1ef8671c0015eb2988262cd63dfb", "score": "0.6015267", "text": "def mark_space_checker(mark_spaces)\n mark_spaces.each do |space|\n return space if board.spaces[space[0]][space[1]].empty?\n end\n nil\n end", "title": "" }, { "docid": "677d3d45517579f7ead9d4bd637c1cce", "score": "0.5991945", "text": "def get_local_zone\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Get all the spaces this pawn could move to\n\t\tboard_side = @owner.board_side\t\t\t\t\t\t\t\t\t\t\t# Find out which side of the board the player who owns this pawn started on\n\t\tpawn_column, pawn_row = get_piece_location\t\t\t\t\t\t\t\t# Find out the column and row of the pawn\n\t\tupper_left = nil\n\t\tupper_right = nil\n\t\tif board_side == :top\t\t\t\t\t\t\t\t\t\t\t\t\t# If we started on the top\n\t\t\treturn [:wall, :wall, :wall] if pawn_column == @board.board.size-1\t# We should return walls if we made it to the end\n\t\t\tdirection = 1\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Our direction for calculating zone is 1\n\t\t\tif pawn_row == 0\t\t\t\t\t\t\t\t\t\t\t\t\t# If we are moving down the left side\n\t\t\t\tupper_right = :wall\t\t\t\t\t\t\t\t\t\t\t\t# Our upper right is out of bounds\n\t\t\tend\n\t\t\tif pawn_row == @board.board[0].size-1\t\t\t\t\t\t\t\t# If we are moving down the right side\n\t\t\t\tupper_left = :wall\t\t\t\t\t\t\t\t\t\t\t\t# Our upper left is out of bounds\n\t\t\tend\n\t\telsif board_side == :bottom\t\t\t\t\t\t\t\t\t\t\t\t# If we started on the bottom\n\t\t\treturn [:wall, :wall, :wall] if pawn_column == 0\t\t\t\t\t# Return walls if we started on the bottom and are now on the top\n\t\t\tdirection = -1\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Our direction is -1\n\t\t\tif pawn_row == 0\t\t\t\t\t\t\t\t\t\t\t\t\t# If we are moving up the left side\n\t\t\t\tupper_left = :wall\t\t\t\t\t\t\t\t\t\t\t\t# Our upper left is out of bounds\n\t\t\tend\n\t\t\tif pawn_row == @board.board[0].size-1\t\t\t\t\t\t\t\t# If we are moving up the right side\n\t\t\t\tupper_right = :wall\t\t\t\t\t\t\t\t\t\t\t\t# Our upper right is out of bounds\n\t\t\tend\n\t\tend\n\t\tupper_left = @board.board[pawn_column+direction][pawn_row+direction] if upper_left != :wall\t\t# If the left or right side weren't\n\t\tupper_middle = @board.board[pawn_column+direction][pawn_row]\t\t\t\t\t\t\t\t\t# defined as :wall in the statement above\n\t\tupper_right = @board.board[pawn_column+direction][pawn_row-direction] if upper_right != :wall\t# then they are on the board.\n\t\treturn [upper_left,upper_middle,upper_right]\n\tend", "title": "" }, { "docid": "2b15bc26354c92aa16893678826a9aba", "score": "0.5910905", "text": "def open_spots\n spots = []\n valid_spaces.each do |space_key|\n board_value = @board[space_key]\n spots << space_key if @board[space_key] == ' '\n end\n spots\n end", "title": "" }, { "docid": "c16d8596fc377f7541967831b10c2768", "score": "0.58334756", "text": "def move_space(current,direction)\n output=[current.first + direction.first,current[1] + direction.last]\n output=if @board[output[0]] and @board[output[0]][output[1]] and #this checks to make sure position is valid\n not yield(@board[output[0]][output[1]]) #this checks to see if its obstructed\n then output else nil end\n end", "title": "" }, { "docid": "52928ef706ede08df061aa046686c8c9", "score": "0.5810755", "text": "def get_nearby_units(x, y)\n spaces = [] \n spaces.push(get_unit(x, y-1))\n spaces.push(get_unit(x+1, y))\n spaces.push(get_unit(x, y+1))\n spaces.push(get_unit(x-1, y))\n return spaces\n end", "title": "" }, { "docid": "f473822ab0e60fa43625418cfe266b73", "score": "0.5806754", "text": "def generate_spaces(length, pos, orientation)\n length.times do |t|\n @spaces << case orientation\n when \"L\"\n [(pos[0] - t), pos[1]]\n when \"R\"\n [(pos[0] + t), pos[1]]\n when \"U\"\n [pos[0], (pos[1] - t)]\n when \"D\"\n [pos[0], (pos[1] + t)]\n else\n ##figure out what to do here\n return nil\n end\n end\n end", "title": "" }, { "docid": "acea3d1b1431684ebed546d2d4648838", "score": "0.57911485", "text": "def week_space\n spaces = spaces_around\n captives = spaces.select{|r| r.captive?}\n holes = spaces.select{|r| (r.empty? && !r.stairs?)}\n enemies = spaces.select{|r| r.enemy?}\n\n if captives.length > 0\n return captives.first\n end\n\n if holes.length > 0\n return holes.first\n end\n\n if enemies.length > 0\n return enemies.first\n end\n\n return res.first\n end", "title": "" }, { "docid": "68da37068e302c67b0bb0357ca85f02b", "score": "0.5781986", "text": "def spaces(query_params = {})\n\t\t\tstring_data = get('spaces.xml', query_params).body\n\t\t\tparsed_xml = Nokogiri::XML(string_data).xpath('.//r25:spaces/r25:space')\n\t\t\tparsed_xml.map{|xml| Space.new(xml) }\n\t\tend", "title": "" }, { "docid": "6235a6741df93ed3e31599eede53c8da", "score": "0.5771095", "text": "def occupied_positions\n spaces.map{ |s| s.position unless s.pieces.empty? }.compact\n end", "title": "" }, { "docid": "2501b28549ca79f2ef413ebc5a7e8728", "score": "0.57539093", "text": "def find_space(com)\n if $coms.include? com \n return false\n else\n $coms.push(com)\n puts \"New computer piece recorded\".yellow\n if $players.length == 3 # Already placed 3 players, we are done\n return false\n end\n if check_for_diagonal()\n return true\n end\n end\n if $board[$right_of[com]] == \"-\" && $board[$right_of[$right_of[com]]] != \"p\"\n $rota.place($right_of[com])\n $players.push($right_of[com])\n return true\n elsif $board[$left_of[com]] == \"-\" && $board[$left_of[$left_of[com]]] != \"p\"\n $rota.place($left_of[com])\n $players.push($left_of[com])\n return true\n else\n # Other placement procedure if above does not work\n end\n puts \"\\nCould not find open space for placement!!! :(\\n\\n\".red\n puts $rota.status\n exit(1) # Kill program for revisions\n end", "title": "" }, { "docid": "1c3357271a005e672cc3518005c08258", "score": "0.57484376", "text": "def spacePosition()\r\n #Returns the position of the space variable or nil if no space\r\n if @space == nil\r\n return nil\r\n end\r\n return @space.getPosition()\r\n end", "title": "" }, { "docid": "b503296433f8fcf0764ef7ef121d28d4", "score": "0.5743939", "text": "def legal_moves\n if self.is_white?\n legal_moves = []\n ##Check regular movement\n unless @current_square.above.nil?\n check_square = @current_square.above\n legal_moves << check_square if check_square.piece.nil?\n ##Check if pawn hasn't moved\n unless has_moved\n check_square = check_square.above\n legal_moves << check_square if check_square.piece.nil?\n end\n end\n ##Check if pawn can take anything\n legal_moves << @current_square.top_left if opponent_exists(@current_square.top_left)\n legal_moves << @current_square.top_right if opponent_exists(@current_square.top_right)\n return legal_moves\n else\n legal_moves = []\n ##Check regular movement\n unless @current_square.below.nil?\n check_square = @current_square.below\n legal_moves << check_square if check_square.piece.nil?\n ##Check if pawn hasn't moved\n unless has_moved\n check_square = check_square.below\n legal_moves << check_square if check_square.piece.nil?\n end\n end\n ##Check if pawn can take anything\n legal_moves << @current_square.bottom_left if opponent_exists(@current_square.bottom_left)\n legal_moves << @current_square.bottom_right if opponent_exists(@current_square.bottom_right)\n return legal_moves\n end\n end", "title": "" }, { "docid": "c5b87dfc913766763c13b805051f983d", "score": "0.57300234", "text": "def valid_space?(new_space)\n opponent_pieces.each do |piece|\n return false if piece.valid_move?(new_space)\n end\n end", "title": "" }, { "docid": "7ee46e6e3579afcccc4d4f4262066865", "score": "0.56738114", "text": "def empty_spaces(board)\n board.values.map.with_index do |value, i|\n if value.nil?\n row = i / 9\n col = i % 9\n [row, col]\n end\n end.compact\n end", "title": "" }, { "docid": "1885b90470dd62a055aabed93feafbfa", "score": "0.5667363", "text": "def valid_knight_moves(current_space)\n # No moves if space itself is not a valid space\n return [] unless valid_space?(current_space)\n\n # Extract coordinates\n x, y = current_space\n\n # Collect all possible moves\n valid_spaces = KNIGHT_MOVES_DELTA.each_with_object([]) do |move, accumulator|\n delta_x, delta_y = move\n test_space = [x + delta_x, y + delta_y]\n accumulator << test_space if valid_space?(test_space)\n end\n\n valid_spaces\nend", "title": "" }, { "docid": "b18d2ea195ed1ba47cf5d246e2023a52", "score": "0.56577504", "text": "def possible_empty_spaces\n empty_spaces = {}\n all_moves.each do |start_pos, moves|\n empty_spaces[start_pos] = moves.select { |end_pos| board[end_pos].empty? }\n end\n empty_spaces.reject { |k, v| v.empty? }\n end", "title": "" }, { "docid": "b57ccf0561ac3077d9a060a7b243afe0", "score": "0.56461996", "text": "def get_empty_spaces(board)\n board.map.with_index{|el, i| el == \" \" ? i : nil}.compact\nend", "title": "" }, { "docid": "a5be50e62c6d66c6d7dc688534b41115", "score": "0.56309086", "text": "def available_spaces\r\n @places.each_index.select { |place| place_available?(place) }\r\n end", "title": "" }, { "docid": "b6140d677b930b25cae88f03ecbc4304", "score": "0.5620156", "text": "def empty_side(grid)\n moves = Grid.middles.collect {|space|\n space if grid.state[space].nil?\n }.compact\n end", "title": "" }, { "docid": "6c3d559b820fa4cd8dd3fdefc42fa950", "score": "0.5614429", "text": "def get_position x, y\n\t\t@spaces[x + (y * @width)]\n\tend", "title": "" }, { "docid": "632edadfef4280d9a6a2944903fb3872", "score": "0.55903417", "text": "def space(x,y)\n return nil if x < 0\n return nil if y < 0\n return nil if x >= @width\n return nil if y >= @height\n @grid[y][x]\n end", "title": "" }, { "docid": "632edadfef4280d9a6a2944903fb3872", "score": "0.55903417", "text": "def space(x,y)\n return nil if x < 0\n return nil if y < 0\n return nil if x >= @width\n return nil if y >= @height\n @grid[y][x]\n end", "title": "" }, { "docid": "9af9ecacb6811f48023602cda5dd2325", "score": "0.5581896", "text": "def space\n\t\t\t@space\n\t\tend", "title": "" }, { "docid": "dfd307eb4b259654223f9905be93a2aa", "score": "0.5557608", "text": "def free_space\n spaces = []\n @grid.each_with_index do |row, idx|\n row.each_with_index do |col, i|\n location = [idx, i]\n if empty?(location) || @grid[location[0]][location[1]] == \"E\"\n spaces << location\n end\n end\n end\n spaces\n end", "title": "" }, { "docid": "68e912edd68ea9e4f6f1b36395194cd7", "score": "0.5534951", "text": "def winning_space(line, board)\n if board.values_at(*line).count(HUMAN_MARKER) == 2\n board.select { |k, v| line.include?(k) && v == INITIAL_MARKER }.keys.first\n else\n nil\n end\n end", "title": "" }, { "docid": "669f50700d3684ddd137d79412e731c6", "score": "0.5522865", "text": "def misplaced_space?\n space && (space_id != space.space_id)\n end", "title": "" }, { "docid": "319274a34f1212f23ba0808a63313fb7", "score": "0.5522176", "text": "def win?\n unique_spaces = @spaces.uniq { |space| space.value }\n unique_spaces.length == 1 && marks(nil) == 0\n end", "title": "" }, { "docid": "579c70ce2b9aa5eb61ba14917d6c833a", "score": "0.55049706", "text": "def filled_spaces\n state.space_combinations\n .reject { |x, y| !state.spaces[x][y].piece } # reject spaces with no pieces in them\n .map do |x, y|\n if block_given?\n yield x, y, state.spaces[x][y]\n else\n [x, y, state.spaces[x][y]] # sets definition of space\n end\n end\n end", "title": "" }, { "docid": "97d6ed8c72cff731cd1bb0590e6d73f3", "score": "0.5490735", "text": "def spacePositionAsString()\r\n #Returns the position of the space variable as a string or nil if no space.\r\n if @space == nil\r\n return nil\r\n end\r\n return @space.positionAsString()\r\n end", "title": "" }, { "docid": "4eccbf7c1a75d2074a852a98dce1be8d", "score": "0.5487203", "text": "def identify_viewable_spaces(viewable_spaces)\n\t\t\n\t\tviewable_symbols = Array.new\n\n\t\tviewable_spaces.each { |viewable_space|\n\t\t\t\n\t\t\tif viewable_space.wall?\n\t\t\t\tviewable_symbols.push(:wall)\n\t\t\t\n\t\t\telsif viewable_space.enemy?\n\t\t\t\tviewable_symbols.push(:enemy)\n\t\t\t\n\t\t\telsif viewable_space.captive?\n\t\t\t\tviewable_symbols.push(:captive)\n\t\t\t\n\t\t\telsif viewable_space.stairs?\n\t\t\t\tviewable_symbols.push(:stairs)\n\t\t\t\n\t\t\telsif viewable_space.empty?\n\t\t\t\tviewable_symbols.push(:empty)\n\t\t\t\n\t\t\telse\n\t\t\t\tviewable_symbols.push(:unkown_space)\n\t\t\t\n\t\t\tend \n\t\t}\n\t\n\t\treturn viewable_symbols\n\t\n\tend", "title": "" }, { "docid": "42ae37a2e870fedfdcfec9347ebe0f73", "score": "0.5486873", "text": "def space_width\n @space_width || narrow_width\n end", "title": "" }, { "docid": "41f24c1a0a17b27e1ec73079ab5d7f5c", "score": "0.54828393", "text": "def space(coords)\n indices = translate_move(coords)\n @board[indices.first][indices.last]\n end", "title": "" }, { "docid": "3fc4f0126165f788dba99604e3541e31", "score": "0.54685205", "text": "def spaces\n \" \" * number_of_spaces\n end", "title": "" }, { "docid": "1e69abb4a5e0faf2d9cbf5f8808d41fd", "score": "0.54633546", "text": "def alive_units\n a_units = self.player_units.find(:all, :conditions => [\"hp_left > ?\",0])\n return a_units\n end", "title": "" }, { "docid": "892b7ccb60f68e65c2bba3746eb5f056", "score": "0.54533553", "text": "def spaces\n \tarray = []\n y = 1\n (:A..:H).each do |x|\n while y < 9\n array << [x,y]\n y += 1\n end\n y = 1\n end\n array\n end", "title": "" }, { "docid": "892b7ccb60f68e65c2bba3746eb5f056", "score": "0.54533553", "text": "def spaces\n \tarray = []\n y = 1\n (:A..:H).each do |x|\n while y < 9\n array << [x,y]\n y += 1\n end\n y = 1\n end\n array\n end", "title": "" }, { "docid": "f248e1322afb2d75b5d4ff670217d6f8", "score": "0.54450583", "text": "def _space\n _tmp = match_string(\" \")\n set_failed_rule :_space unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "f248e1322afb2d75b5d4ff670217d6f8", "score": "0.54450583", "text": "def _space\n _tmp = match_string(\" \")\n set_failed_rule :_space unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "48bebbbed62cd21f54d9ded837220330", "score": "0.5435135", "text": "def occupied_spaces\n all_spaces.map do |space|\n if space.occupied == true\n space.name\n end\n end\n end", "title": "" }, { "docid": "90e01fbbae3100b026e3bf4c06198650", "score": "0.5409159", "text": "def space\n @space ||= @font_profile.width_of(\" \")\n end", "title": "" }, { "docid": "14193f445dc94c1fa50bb4d2d3ba425e", "score": "0.5407719", "text": "def open_space?(x_end, y_end)\n #Check if space is open\n self.game.pieces.where(x_pos: x_end, y_pos: y_end).empty?\n end", "title": "" }, { "docid": "c53cd5c7cd822b1f0f8cc24ea75b0202", "score": "0.54051584", "text": "def empty_positions(board)\n board.keys.select {|position| board[position] == ' '}\nend", "title": "" }, { "docid": "b1aec1300f87279ae10b6a71c2a21f12", "score": "0.53979516", "text": "def move_position(num_spaces = 1)\n\t\tif num_spaces > 1\n\t\t\tnum_spaces.times { move_position }\n\t\telse\n\t\t\t@current_position = person_in_spot(@current_position + 1)\n\t\t\tp = @seats[@current_position]\n\t\t\tif @hands.size > @max_can_win.size\n\t\t\t\tmove_position if [email protected]?(p) or @max_can_win.keys.include?(p)\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "6ef6b2bee1c835219a4ad47e054ff225", "score": "0.53941464", "text": "def has_space_across_for_word?(row, col, word)\n @board[row][col...word.length].each_with_index do |board_space, index|\n return if !board_space.nil? && board_space != word[index]\n end\n return word\n end", "title": "" }, { "docid": "02e075cda628e296e82e171bb5924cee", "score": "0.5393788", "text": "def guess_word\n @num_spaces = @secret_word.length\n @blank_spaces = \"-\" * @num_spaces\n p @blank_spaces = @blank_spaces.split('')\n end", "title": "" }, { "docid": "c6c0c320f6f9f0b37f154028f3525ca0", "score": "0.53742003", "text": "def choose_space\n\t\treturn attempt_match if @mode == 1 and @player == 2\n\n\t\tputs \"Choose a space:\"\n\t\tdisplay number_board if @turn_count < @player\n\n\t\tchoice = ''\n\t\tuntil number_board.has_value? choice\n\t\t\tchoice = gets.chomp\n\t\t\tdisplay number_board if choice.upcase == 'K' or choice.upcase == \"KEY\"\n\t\t\texit if choice.upcase == 'Q' or choice.upcase == \"QUIT\"\n\t\t\tputs \"Enter '1' through '9' to make a choice. (K)ey for choices. (Q)uit to cancel.\" if choice !~ /^[1-9]{1}$/\n\t\t\tputs \"This space is occupied\" if !number_board.has_value? choice and choice =~ /^[1-9]{1}$/\n\t\tend\n\t\treturn choice\n\tend", "title": "" }, { "docid": "ce3378560098e37dee81fcdc6051ddd2", "score": "0.5373717", "text": "def full?\n @board.none? {|space| space == \" \"}\n end", "title": "" }, { "docid": "b6242fd0fe3e3fdcf0b34d34a1a1e139", "score": "0.53691006", "text": "def space_race_modifiers(player:)\n # TODO\n []\n end", "title": "" }, { "docid": "ffd446f612f42433bc2e7c5b486ebc76", "score": "0.5367572", "text": "def kill_zone\n [(monster_position - Spaceship::KILL_ZONE), (monster_position + Spaceship::KILL_ZONE)]\n end", "title": "" }, { "docid": "880941452fe3d6a7e91fd0023a5d4e10", "score": "0.5363814", "text": "def check\n client.spaces\n end", "title": "" }, { "docid": "ee7f9a05f07322d44fae5d6fcd9daaf2", "score": "0.53617257", "text": "def test_for_winning_space_at_index_0\r\n\t\tplayer = UnbeatableAi.new(\"x\")\r\n\t\tassert_equal(0, player.get_move([\"\", \"x\", \"x\", \"\", \"\", \"\", \"\", \"\", \"\"]))\r\n\tend", "title": "" }, { "docid": "b4ab47710f5dcbc290870ede6895d4d1", "score": "0.53574693", "text": "def move(board)\n\n player_occupied_cells = []\n board.cells.each_with_index do |cell, i|\n if cell == get_player_token\n player_occupied_cells << i\n end\n end\n\n # if player goes first and goes in a corner, play the center space\n if board.turn_count == 1 && !board.cells.include?(self.token) && !board.taken?(5)\n return \"5\"\n\n # on turn 3, if player has 2 tokens in corners, play an edge\n elsif board.turn_count == 3 && board.cells.count(self.token) == 1 && CORNERS.include?(player_occupied_cells[0]) && CORNERS.include?(player_occupied_cells[1])\n return \"2\"\n\n # otherwise, check if we can win or are in danger of losing\n elsif check_win_lose_combos(board) != nil\n return check_win_lose_combos(board).to_s\n\n # if not in danger of losing or able to win at the moment check -\n # does the list of empty positions contain any corner spaces? if so, return the first one\n elsif find_empty_positions(board).detect {|position| [1, 3, 7, 9].include?(position)} != nil\n return find_empty_positions(board).detect {|position| [1, 3, 7, 9].include?(position)}.to_s\n\n # if there are no empty corners, return the first empty space on the board\n else\n return find_empty_positions[0].to_s\n end\n end", "title": "" }, { "docid": "f5cc20a7c893d15add713a2f0d1a7186", "score": "0.53560686", "text": "def space?\n @main_board.flatten.any? { |mark| mark != 'X' && mark != 'O' }\n end", "title": "" }, { "docid": "ee325f8ada65766c3e18f1f984de57ff", "score": "0.53542995", "text": "def far_off_captive?(the_space)\n if look_ahead(:forward)[the_space].captive?\n true\n else\n false\n end\n end", "title": "" }, { "docid": "8ce4bd9ff7923a48f009af086d9172d1", "score": "0.5349112", "text": "def towards_safe_space\n puts \"Moving toward safe space\"\n return towards(location_of_closest_safe_space)\n\n if @player.taking_damage? and @player.should_rest?\n # Move away from threat\n direction = away_from(location_of_closest_enemy)\n else\n direction = opposite_direction_of(@player.direction)\n end\n direction\n end", "title": "" }, { "docid": "56fcf5121314c365b90cb09aea9ab7aa", "score": "0.53460896", "text": "def full?\n @board.all? {|no_space| no_space != \" \"}\n end", "title": "" }, { "docid": "446f40ec52b2c6472ef1649a2d7d9cfe", "score": "0.5335622", "text": "def find_any_space\n @board.each_with_index { |row, index| row.each_with_index { |position, row_index| return [index, row_index] if position == ' ' } }\n false\n end", "title": "" }, { "docid": "7949c1bde87f4745045290e56b794c8b", "score": "0.53340447", "text": "def move_spaces(spaces_to_move)\n @position += spaces_to_move\n end", "title": "" }, { "docid": "b993f4ce6a32ca913bde58e8b974966c", "score": "0.5332008", "text": "def horizontal_spacing\n (padding[:right] - padding[:left]) / scores.length\n end", "title": "" }, { "docid": "6243714a0da8cdf3ce427eb227cb5d87", "score": "0.53311086", "text": "def full?\n [email protected]? {|space| space == \" \"}\n end", "title": "" }, { "docid": "88750b0ca12f42372e6ea415b771228a", "score": "0.5330879", "text": "def scan\n surroundings = {}\n binding.pry\n up = Robot.in_position(position[0], position[1]+1)\n if up\n surroundings[:above] = up\n end\n down = Robot.in_position(position[0], position[1]-1)\n if down\n surroundings[:below] = down\n end\n right = Robot.in_position(position[0]+1, position[1])\n if right\n surroundings[:right] = right\n end\n left = Robot.in_position(position[0]-1, position[1])\n if left\n surroundings[:left] = left\n end\n if surroundings\n puts \"You have #{surroundings[:above].size} enemies above you.\"\n puts \"#{surroundings[:below].size} enemies below you\"\n puts \"#{surroundings[:left].size} enemies to the left of you, and\"\n puts \"#{surroundings[:right].size} enemies to the right of you.\"\n end\n return surroundings\n end", "title": "" }, { "docid": "ca611d47d7dc28a43aae50ababb76377", "score": "0.53287065", "text": "def horizontal_spacing\n if scores.length > 1\n (padding[:right] - padding[:left]) / (scores.length - 1)\n else\n padding[:right]\n end\n end", "title": "" }, { "docid": "5da12f259e60787267a7872bd356a7f5", "score": "0.53262955", "text": "def inbounds?(space)\n # Return false if outside of array\n return false if space[0] < 0 || space[0] > 4\n return false if space[1] < 0 || space[1] > 4\n # Return false if space marked as off limits\n # return false if self.class::INITIAL_BOARD[space[0]][space[1] * 2] == \"-\"\n return false if current_position[space[0]][space[1]] == \"-\"\n # Otherwise return true\n true\n end", "title": "" }, { "docid": "fd9b4dceffc5e40d04786968d2940774", "score": "0.53247243", "text": "def legal_moves\n @legal_moves = []\n # Different Y coordinates for black and white pieces (moving up and down)\n if self.color == \"w\"\n y = @y + 1\n y2 = @y + 2\n elsif self.color == \"b\"\n y = @y - 1\n y2 = @y - 2\n end\n # The move is available if the space is empty\n if @@board[y][@x] == \" \"\n @legal_moves << [@x, y]\n end\n # For first move of a pawn, 2 moves forward is allowed\n if @first_move && @@board[y2][@x] == \" \" && @@board[y][@x] == \" \"\n @legal_moves << [@x, y2] \n end\n @legal_moves\n end", "title": "" }, { "docid": "194075b284c82358ee0a9302f3ba7e90", "score": "0.53227895", "text": "def won? piece\n # performs action on all space combinations\n won = [[-1, 0, 1]].product([-1, 0, 1]).map do |xs, y|\n\n # Checks if the 3 grid spaces with the same y value (or same row) and\n # x values that are next to each other have pieces that belong to the same player.\n # Remember, the value of piece is equal to the current turn (which is the player).\n horizontal_match = state.spaces[xs[0]][y].piece == piece &&\n state.spaces[xs[1]][y].piece == piece &&\n state.spaces[xs[2]][y].piece == piece\n\n # Checks if the 3 grid spaces with the same x value (or same column) and\n # y values that are next to each other have pieces that belong to the same player.\n # The && represents an \"and\" statement: if even one part of the statement is false,\n # the entire statement evaluates to false.\n vertical_match = state.spaces[y][xs[0]].piece == piece &&\n state.spaces[y][xs[1]].piece == piece &&\n state.spaces[y][xs[2]].piece == piece\n\n horizontal_match || vertical_match # if either is true, true is returned\n end\n\n # Sees if there is a diagonal match, starting from the bottom left and ending at the top right.\n # Is added to won regardless of whether the statement is true or false.\n won << (state.spaces[-1][-1].piece == piece && # bottom left\n state.spaces[ 0][ 0].piece == piece && # center\n state.spaces[ 1][ 1].piece == piece) # top right\n\n # Sees if there is a diagonal match, starting at the bottom right and ending at the top left\n # and is added to won.\n won << (state.spaces[ 1][-1].piece == piece && # bottom right\n state.spaces[ 0][ 0].piece == piece && # center\n state.spaces[-1][ 1].piece == piece) # top left\n\n # Any false statements (meaning false diagonal matches) are rejected from won\n won.reject_false.any?\n end", "title": "" }, { "docid": "6dc16439bac6fbaca4749e22efb927f7", "score": "0.5322055", "text": "def getSpace i\n @spaces[i]\n end", "title": "" }, { "docid": "05058e6ad696a5fe4f3e1ac005f5b18d", "score": "0.5314985", "text": "def move_position(num_spaces = 1)\n\t\tif num_spaces > 1\n\t\t\tnum_spaces.times { move_position }\n\t\telse\n\t\t\t@current_position = person_in_spot(@current_position + 1)\n\t\t\tmove_position unless @hands.keys.include?(@seats[@current_position])\n\t\tend\n\tend", "title": "" }, { "docid": "8cdbd3f951d4e488e609862035218db6", "score": "0.53146815", "text": "def full?(board)\n board.all? do |space_taken|\n space_taken != \" \"\n end\nend", "title": "" }, { "docid": "a128afc7a3293ddc4fc16754431f3ebd", "score": "0.53095466", "text": "def list_spaces\n result = nil\n birst_soap_session do |bc|\n result = bc.list_spaces\n end\n BirstSoapResult.new(\"list_spaces complete\", result)\n end", "title": "" }, { "docid": "791b4becee8515d33fec4aa50e46a79f", "score": "0.53026366", "text": "def not_in_spaces\n !in_space? || Space::TYPES.exclude?(space_object.space_type)\n end", "title": "" }, { "docid": "6667ec8e034293f160707d7e766ed8f1", "score": "0.5301905", "text": "def player\n @board.count(\" \") % 2 == 0 ? \"O\" : \"X\"\n end", "title": "" }, { "docid": "15dd63c27d5de25a46a42194c95cb706", "score": "0.5301518", "text": "def does_player_have_position?(index, token)\n @board.spaces[index] == token\n end", "title": "" }, { "docid": "02f02eab0788c2fcb38f3debe1dc1a36", "score": "0.5294084", "text": "def with_spaces\n add_spacing( with_cut_symbols )\n end", "title": "" }, { "docid": "51e0c39648e3d5e7e5f7db7f9cc55b90", "score": "0.5293248", "text": "def empty_space?(board,arr)\n chessboard_index(board,arr[0],arr[1]) == ' '\n end", "title": "" }, { "docid": "c3ddaf455b0fb6f049ffed3ce9d89aa5", "score": "0.5293025", "text": "def far_off_captive?(the_space)\n if look_ahead[the_space].captive?\n true\n else\n false\n end\n end", "title": "" }, { "docid": "822c86a9b3f09b04b293d1d042fba3db", "score": "0.5287398", "text": "def match_spaces\n stack = []\n matched = match_space\n while matched != :failed\n stack << matched\n matched = match_space\n end\n stack\n end", "title": "" }, { "docid": "aee83241e6e97914558d3309c6d7c9e2", "score": "0.52786976", "text": "def position_open?(board, space)\n if (board[space] == \"\" || board[space] == \" \" || board[space] == nil)\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "eed06896e2c8a05b510880f286ee1887", "score": "0.52707326", "text": "def count_paces\r\n @paces.count\r\n end", "title": "" }, { "docid": "2df6d99cb008092f7d30cf84dfecd766", "score": "0.5267942", "text": "def player_positions\n\n end", "title": "" } ]
a5a62982c25876cee47c8d7393406ee2
GET /day_types GET /day_types.json
[ { "docid": "be8937b24aeb275f3d955bf618f471ab", "score": "0.74145824", "text": "def index\n @day_types = DayType.all\n end", "title": "" } ]
[ { "docid": "1d5a8df29d75f859bd804141ed274b59", "score": "0.6838959", "text": "def appointment_types(params = {})\n scope 'default'\n get('schedule/appointmenttypes/', params)\n end", "title": "" }, { "docid": "0a7c5b04b264bddb270b86799b6ee88f", "score": "0.6699223", "text": "def show\n @daytype = Daytype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daytype }\n end\n end", "title": "" }, { "docid": "5025ae3da2b73102bfa0a39e2789e2eb", "score": "0.63036823", "text": "def index\n @calendar_types = CalendarType.all\n end", "title": "" }, { "docid": "0952bd3cb89e5f16edf0ce535a2d5f82", "score": "0.628675", "text": "def index\n @date_types = DateType.all\n end", "title": "" }, { "docid": "85614be02365df1aa754e3ebad6f3be4", "score": "0.6162331", "text": "def index\n @entry_types = EntryType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entry_types }\n end\n end", "title": "" }, { "docid": "4381d1d6d7c23c835903d6fac43050f8", "score": "0.6114195", "text": "def index\n @event_types = EventType.all\n respond_with @event_types\n end", "title": "" }, { "docid": "7b9884edd5fe1e37bdeaa60bd9a452c0", "score": "0.6091462", "text": "def index\r\n @classdays = Classday.all\r\n\r\n render json: @classdays\r\n end", "title": "" }, { "docid": "3da85f29df1dc5f725acc21329064903", "score": "0.60667497", "text": "def index\n @day_weeks = DayWeek.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @day_weeks }\n end\n end", "title": "" }, { "docid": "519da913d9a62fc2b86893c0d5961c5b", "score": "0.6065022", "text": "def index\n @event_types = EventType.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_types }\n end\n end", "title": "" }, { "docid": "226f5a11939e911c54a546beb03070af", "score": "0.6023782", "text": "def get_lesson_types\n get \"lessonTypes.json\"\n end", "title": "" }, { "docid": "aa7f783369f6c23c8b9a97561c3d49f9", "score": "0.5997059", "text": "def index\n # @weekdays = Weekday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@weekdays, mode: :compat) }\n end\n end", "title": "" }, { "docid": "8961f8e8b03b0ad4a89fdc00b9328993", "score": "0.59952265", "text": "def dayIndex\n render json: Restaurant.restaurantsDay\n end", "title": "" }, { "docid": "7892cac0590a029361ccf465cb4c1e7b", "score": "0.5984534", "text": "def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end", "title": "" }, { "docid": "b76dc2c288ff232c6c24af9cabff3f88", "score": "0.59667593", "text": "def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end", "title": "" }, { "docid": "ea0e41b95898e5d2e6de721b22c295b2", "score": "0.59416366", "text": "def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end", "title": "" }, { "docid": "2704b7d6157d74e75db03710a3080bb9", "score": "0.59396863", "text": "def ride_types(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:ride_types),\n access_token: args.delete(:access_token),\n options: { query: args }\n )\n end", "title": "" }, { "docid": "44260e1cf4ce4b93e4bb05d0be599e3e", "score": "0.59289414", "text": "def index\n @edge_types = EdgeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @edge_types }\n end\n end", "title": "" }, { "docid": "56cadb519cd4358be924826c6627edc9", "score": "0.5927996", "text": "def new\n @daytype = Daytype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daytype }\n end\n end", "title": "" }, { "docid": "408a6573a993b33702705aba5dce4335", "score": "0.5918909", "text": "def index\n @days = @trip.days.order(trip_day: :asc)\n render json: @days, include: [:activities]\n end", "title": "" }, { "docid": "aaf30505fe376bc7e7852cd201ad1ca6", "score": "0.5879376", "text": "def types\n @client.make_request :get, reports_path\n end", "title": "" }, { "docid": "1842f949810abe63a37db16bc8e9fcb8", "score": "0.5835062", "text": "def index\n @timerecord_types = TimerecordType.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timerecord_types }\n end\n end", "title": "" }, { "docid": "05d9c15955522fd60271837b04c2a4ec", "score": "0.5821515", "text": "def index\n @event_types = EventType.all.sort { |p1, p2| p1.name <=> p2.name }\n\n respond_to do |format|\n format.json { render json: @event_types }\n format.xml { render xml: @event_types.to_xml({ include: :categories }) }\n end\n end", "title": "" }, { "docid": "024d8b2d1b6854cf335a474ef86bbc08", "score": "0.5815315", "text": "def show\n @event_types = EventType.find(params[:id])\n respond_with @event_type\n end", "title": "" }, { "docid": "fa5b36d7871e515c9868f34b38ce10b9", "score": "0.58099514", "text": "def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end", "title": "" }, { "docid": "110b27536be97ce00e51832ea1b5c15f", "score": "0.5801085", "text": "def set_day_type\n @day_type = DayType.find(params[:id])\n end", "title": "" }, { "docid": "7eeda5a6adb149a957fdb9f9f02e32f2", "score": "0.5792959", "text": "def index\n @talk_types = TalkType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_types }\n end\n end", "title": "" }, { "docid": "2093346e0bd1a11b879c5835c4a386b1", "score": "0.5789392", "text": "def index\n @agendaitemtypes = Agendaitemtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @agendaitemtypes }\n end\n end", "title": "" }, { "docid": "d56ec1dad2ff4b16f2f0b34532c18c38", "score": "0.5748435", "text": "def types\n if @@types.nil? || (@@last_type_check + (4 * 60 * 60)) < Time.now\n @@last_type_check = Time.now\n @@types = _make_request(:types)['results']\n end\n @@types\n end", "title": "" }, { "docid": "0df248963ef6ea283f2092b1e8e3e320", "score": "0.5738422", "text": "def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end", "title": "" }, { "docid": "098f113044c559a4d9c9fcafe890bdd1", "score": "0.5730544", "text": "def showtimes_json(day)\n showtimes_by_cinemas_json(CONST::WORD_DAY_HASH[day]).to_json\n end", "title": "" }, { "docid": "b1c305aa86e3b0f731cb1173263f5c1c", "score": "0.5724769", "text": "def index\n @task_types = TaskType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @task_types }\n end\n end", "title": "" }, { "docid": "d3deb608bcd195cfc75bb336137ff318", "score": "0.5711591", "text": "def show\n @day_list = DayList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @day_list }\n end\n end", "title": "" }, { "docid": "d5d43fd115ec8b97e3a7f76c5f52f83e", "score": "0.5710263", "text": "def index\n @dept_types = DeptType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @dept_types }\n end\n end", "title": "" }, { "docid": "62af9a0435471ae417c6ec29eeb4205e", "score": "0.5699552", "text": "def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end", "title": "" }, { "docid": "db691bf1180fcfd3257c8c769c9db38f", "score": "0.5687789", "text": "def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end", "title": "" }, { "docid": "2a9265dce7f83e5eda8b1ecb1b44739d", "score": "0.5676182", "text": "def index\n @typegroups = Typegroup.all\n respond_to do |format|\n format.html\n format.json { render json: @typegroups }\n end\n end", "title": "" }, { "docid": "66c276b4d298554e3fbc980ff777be04", "score": "0.56743443", "text": "def index\n @types = Type.all\n end", "title": "" }, { "docid": "31ce2382edbbe7633d4f554d33bf62f2", "score": "0.56623507", "text": "def index\n @event_types = EventType.paginate(page: params[:page])\n end", "title": "" }, { "docid": "4572792574900e11b76fa694a536e719", "score": "0.5661372", "text": "def index\n @days = Day.all\n end", "title": "" }, { "docid": "1c39c7adf67272c4331bfcafdab45f43", "score": "0.5660315", "text": "def index\n @technotypes = Technotype.all\n\n respond_to do |format|\n format.json { render json: @technotypes, status: 200 }\n end\n end", "title": "" }, { "docid": "d91015eb20879998acc0beea616b9753", "score": "0.5649123", "text": "def day_type_params\n params.require(:day_type).permit(:regular, :date_created, :user_id)\n end", "title": "" }, { "docid": "7fa3ddae017ef6cb2a131db7c1499ec5", "score": "0.5627418", "text": "def show\n respond_to do |format|\n format.html { }\n format.json {\n render :json => @week, :methods => [:monday, :tuesday, :wednesday, :friday, :thursday, :saturday, :sunday, :image ] }\n end\n end", "title": "" }, { "docid": "01813414eb7fb9d71a6c97d21fed5a3b", "score": "0.5609578", "text": "def get_days\n return 0b0 if @params[:type] != 'advanced'\n\n return get_weekday_bitmask(['weekday_sun', 'weekday_mon', 'weekday_tue', 'weekday_wed', 'weekday_thu', 'weekday_fri', 'weekday_sat']) if @params[:schedule] == 'weekly'\n\n return get_month_bitmask(@params[:dates_picked]) if @params[:schedule] == 'monthly' && @params[:days] == 'specific'\n\n return get_unspecific_days\n\n end", "title": "" }, { "docid": "77581a33f84c026cbb208792c604a017", "score": "0.56084853", "text": "def index\n\n respond_to do |format| \n format.html do\n @days = Day.all\n # Movement.permitted_for_user(@current_user).pluck(day)\n\n end\n format.json do\n end\n\n end\n\n end", "title": "" }, { "docid": "64f799704b138a889674568e8840767c", "score": "0.5604142", "text": "def index\n if params[:date]\n redirect_date(params[:date])\n else\n @school_days = SchoolDay.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @school_days }\n end\n end\n end", "title": "" }, { "docid": "b97bb42ef75aadfc34939896aa87cb0c", "score": "0.5598476", "text": "def index\n @time_of_days = TimeOfDay.all\n end", "title": "" }, { "docid": "a753c4dbfcd594eafc74e6cc227abcf8", "score": "0.55935955", "text": "def index\n @observation_types = ObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @observation_types }\n end\n end", "title": "" }, { "docid": "c17f21a170b8330b65ec98690611bc63", "score": "0.55876416", "text": "def index\n @workout_days = WorkoutDay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workout_days }\n end\n end", "title": "" }, { "docid": "f5b2b738a2284fd2d0e21f4a79e848d1", "score": "0.5587376", "text": "def show\n render json: @day, include: [:activities]\n end", "title": "" }, { "docid": "428ca8684845a36500000b055c8b6481", "score": "0.5583446", "text": "def show\n @daytime = Daytime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daytime }\n end\n end", "title": "" }, { "docid": "e86b9315938175ad3593926b04a3c0a5", "score": "0.55793", "text": "def index\n @techaxis_types = TechaxisType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @techaxis_types }\n end\n end", "title": "" }, { "docid": "a2b88d9b0df7d6e611a5fd24dad8700d", "score": "0.55787706", "text": "def index\n @os_types = OsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @os_types, except: [:desc, :created_at, :updated_at] } \n end\n end", "title": "" }, { "docid": "5c7ac9c781039fcc8c2594d49353a126", "score": "0.55781627", "text": "def excercise_types_index_mobile\n\t\t@excercise_types = ExcerciseType.all\n\t\trender json: @excercise_types\n\tend", "title": "" }, { "docid": "daa916b23cdbc65d9014d5cae56cbb33", "score": "0.5574728", "text": "def index\n types = @user.tried_beer_ratings.last.beer_types.map do |type|\n {name: type.name, description: type.beg_description}\n end\n render json: types\n end", "title": "" }, { "docid": "1f348ff7a5adaf3c0c934a8308c9450d", "score": "0.5562262", "text": "def index\n @event_types = EventType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @event_types }\n end\n end", "title": "" }, { "docid": "9bb9ce06ff6ab9772185cb64d1a8ed88", "score": "0.5560614", "text": "def get_hotel_facility_types(request_parameters)\r\n http_service.request_get(\"/json/bookings.getHotelFacilityTypes\", request_parameters)\r\n end", "title": "" }, { "docid": "bdcc58acd47a726b36619cc9cf4e8aad", "score": "0.5555334", "text": "def index\n @novelty_types = NoveltyType.all\n end", "title": "" }, { "docid": "fafc11bad006146100c65002ac4b18ad", "score": "0.5554325", "text": "def index\n @run_types = RunType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @run_types }\n end\n end", "title": "" }, { "docid": "1a37fff6ca51cc792e1cd82f42b5009d", "score": "0.5546675", "text": "def days\n @trainings = Training.all\n @activities = Activity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trainings }\n end\n end", "title": "" }, { "docid": "1a787efbf969eba68c07c3fb49b09b37", "score": "0.5546483", "text": "def index\n @type_of_meetings = TypeOfMeeting.all\n end", "title": "" }, { "docid": "3655e57e33cd0dec894ba167bb0ee665", "score": "0.55449134", "text": "def index\n @fender_types = FenderType.all\n end", "title": "" }, { "docid": "a28f3d672edbde06ad5bd69fb5ca6e4e", "score": "0.5543175", "text": "def index\n @food_type_id = @foodTypes.first\n\n if params['type']\n @foods = Food.includes(:type).includes(:nutritional_information).where( type_id: params['type']['type_id']).paginate(page: params[:page])\n else\n @foods = Food.includes(:type).includes(:nutritional_information).where( type_id: @food_type_id).paginate(page: params[:page])\n end\n\n respond_with @foods\n end", "title": "" }, { "docid": "2592768dd3b5c4d5a30362b6cab2a8ab", "score": "0.5520342", "text": "def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end", "title": "" }, { "docid": "2769ae8bf09fd3664612f41bbda110e0", "score": "0.5513223", "text": "def list_types\n user = current_user\n if !params[:distance].nil? and params[:distance].to_i > 0\n distance = params[:distance].to_i\n else\n distance = 30\n end\n if !params[:latitude].blank? \n latitude = params[:latitude].to_f\n else\n latitude = user.latitude\n end\n if !params[:longitude].blank? \n longitude = params[:longitude].to_f\n else\n longitude = user.longitude\n end\n\n if !params[:latitude].blank? and !params[:longitude].blank? \n user.latitude = latitude\n user.longitude = longitude\n user.save\n end\n\n result = Venue.collect_network_types(current_user, latitude, longitude, distance)\n \n render json: success(result)\n end", "title": "" }, { "docid": "09703d83d9cdce96b94e2c3178f20f6a", "score": "0.55089986", "text": "def create\n @day_type = DayType.new(day_type_params)\n\n respond_to do |format|\n if @day_type.save\n format.html { redirect_to @day_type, notice: 'Day type was successfully created.' }\n format.json { render :show, status: :created, location: @day_type }\n else\n format.html { render :new }\n format.json { render json: @day_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e9c0c69352fc7f38e87c0c29e8bca3a", "score": "0.55082107", "text": "def index\n @departure_types = DepartureType.all\n end", "title": "" }, { "docid": "18c99b422ecdd1c62f3afea450f4ab9c", "score": "0.550777", "text": "def index\n @dishtypes = Dishtype.all\n end", "title": "" }, { "docid": "5911e79b9f833116665cb96ed2709bc3", "score": "0.5495986", "text": "def index\n @day_availabilities = DayAvailability.all\n\n respond_to do |format|\n format.html {redirect_to @day_availabilities.week_availability}\n # format.json { render json: @day_availability }\n end\n end", "title": "" }, { "docid": "5927ef68edc6d76f3d79cee71ba0fb95", "score": "0.54921234", "text": "def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end", "title": "" }, { "docid": "4a12fd0a204711e3f55c5676318d058c", "score": "0.54911757", "text": "def index\n @ftypes = Ftype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ftypes }\n end\n end", "title": "" }, { "docid": "e879e3aea7a4b346aab073ecaab846d6", "score": "0.5487044", "text": "def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end", "title": "" }, { "docid": "305d0c52ae4c36c612c8b19ead4181ed", "score": "0.5478819", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end", "title": "" }, { "docid": "c2d660c2488d05ee92d30bdbc7b05652", "score": "0.54775995", "text": "def index\n @equipament_types = EquipamentType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @equipament_types }\n end\n end", "title": "" }, { "docid": "a89319e7eb55045d0ece3dde21b444fa", "score": "0.547636", "text": "def index\n @type_reasons = TypeReason.all\n end", "title": "" }, { "docid": "82d126ed533f2258f071e898822439b7", "score": "0.54668677", "text": "def index\n @downtime_types = DowntimeType.all.paginate(:page=> params[:page])#.order(nr: :desc)\n end", "title": "" }, { "docid": "fab1811225fd2bd4cde32dd61c417f41", "score": "0.54664475", "text": "def get_static_assests\n types = LocationType.all\n facilities = Facility.all\n type_array = []\n facility_array = []\n types.each do |type|\n type_array << type.name\n end\n facilities.each do |facility|\n facility_array << facility.name\n end\n render json: { location_types: type_array, location_facilities: facility_array }\n end", "title": "" }, { "docid": "3be7b1fa4db7f1710c62fc66e1d99cc1", "score": "0.54656106", "text": "def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end", "title": "" }, { "docid": "095a008b9cd4660922e38060bca289c8", "score": "0.54651225", "text": "def index\n @typeconges = Typeconge.all\n end", "title": "" }, { "docid": "7b5ecfb7ec341498842a205844289f6d", "score": "0.54627526", "text": "def available_types\n # TODO pull this from DB or config\n [\n :kiosk,\n :ride,\n :store,\n :restaurant\n ]\n end", "title": "" }, { "docid": "9998d412439b027c43e3a8e736cfd270", "score": "0.5460317", "text": "def index\n @farmer_types = FarmerType.all\n end", "title": "" }, { "docid": "ddb6a5c6816ebb9dd2e55bad83748c9d", "score": "0.5457793", "text": "def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leavetypes }\n end\n end", "title": "" }, { "docid": "ddb6a5c6816ebb9dd2e55bad83748c9d", "score": "0.5457793", "text": "def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leavetypes }\n end\n end", "title": "" }, { "docid": "2d27da6d3fc33b8f4d25a388a949b63e", "score": "0.5450672", "text": "def view_types(for_select = true) # get the defined view type partials. e.g. views/views/list.html.erb\n fetch_array_for get_view_types, for_select\n end", "title": "" }, { "docid": "8517ca95656c9e67ad1985d60457ef67", "score": "0.5448684", "text": "def index\n @meeting_types = MeetingType.all\n end", "title": "" }, { "docid": "bd73818f13640aae3654b1b8512cfb97", "score": "0.54453087", "text": "def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end", "title": "" }, { "docid": "d6483184e62cad07a35dd894c89f3080", "score": "0.5442736", "text": "def index\n @heart_rate_types = HeartRateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heart_rate_types }\n end\n end", "title": "" }, { "docid": "4f815d7d6307b0eafd79745c88ceb7e9", "score": "0.54418916", "text": "def event_types\n meeting_events.includes(:event_type).map(&:event_type)\n end", "title": "" }, { "docid": "22782baec825a553a8526a7e7d453c4e", "score": "0.5432842", "text": "def create\n @daytype = Daytype.new(params[:daytype])\n\n respond_to do |format|\n if @daytype.save\n format.html { redirect_to @daytype, notice: 'Daytype was successfully created.' }\n format.json { render json: @daytype, status: :created, location: @daytype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @daytype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b64b97696a2e5f9f675336b9b8d931c1", "score": "0.5428773", "text": "def show\n @weekday = Weekday.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weekday }\n end\n end", "title": "" }, { "docid": "9a40dc8cd22b3aa88a21e60cf955d4ad", "score": "0.5422892", "text": "def index\n @student_types = StudentType.all\n\n render json: @student_types\n end", "title": "" }, { "docid": "a33b46c120b0c80e36cd7c530e836298", "score": "0.5422199", "text": "def get_available_types_from_usage(usage) #TODO: Research use\n return @client.raw(\"get\", \"/helpers/available-types/#{usage}\")\n end", "title": "" }, { "docid": "135d06f93cee15df06c35192fe41fc03", "score": "0.54205614", "text": "def index\n @recipe_types = RecipeType.all\n end", "title": "" }, { "docid": "e71cd91428f757a823918d646f716020", "score": "0.54099137", "text": "def index\n @departuretypes = Departuretype.all\n end", "title": "" }, { "docid": "ffba06762ec2982be74c0ac69e564e76", "score": "0.54027015", "text": "def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end", "title": "" }, { "docid": "7c8f73d40965dadeca4f952861d4a533", "score": "0.539888", "text": "def index\n @hardware_types = HardwareType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hardware_types }\n end\n end", "title": "" }, { "docid": "c8f7afe1314ad048337d2f2eedad22ee", "score": "0.53980166", "text": "def find_all_fedora_type(params, ftype)\n # ftype should be :collection or :apo (or other symbol if we added more since this was updated)\n date_range_q = get_date_solr_query(params)\n solrparams = {\n :q => \"#{Type_Field}:\\\"#{Fedora_Types[ftype]}\\\" #{date_range_q}\",\n :wt => :json,\n :fl => @@field_return_list\n }\n get_rows(solrparams, params)\n response = run_solr_query(solrparams)\n determine_proper_response(params, response)\n end", "title": "" }, { "docid": "38df4c11e4bacb95aaa7f8c1e286f0c3", "score": "0.5396762", "text": "def show\n respond_to do |format|\n format.html \n # format.json { render json: @day_availability }\n end\n end", "title": "" }, { "docid": "7bb37086300b21c39d69400a9a6384f2", "score": "0.53963184", "text": "def readable_entry_types\n BIDURI['entry_types'].select{|s| s['has_own_page'].nil? || s['has_own_page'] == true}.map{|m| m['entry_type']}\n end", "title": "" }, { "docid": "59596fd46bf4befdfb59309fc908ff1d", "score": "0.5380342", "text": "def show\n @holidaytype = Holidaytype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holidaytype }\n end\n end", "title": "" }, { "docid": "dc329721dea1bd4cd7aa7781bb9170da", "score": "0.5372793", "text": "def index\n @recipe_types = RecipeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @recipe_types }\n end\n end", "title": "" } ]
5ff47ea373a54f73392a7dc065a7c7ab
puts middle_way([1, 5, 3], [1, 4, 2]) puts middle_way([2, 4, 1, 2, 8], [5, 2, 3])
[ { "docid": "ce7e858721a14f21d8a2103838989c56", "score": "0.0", "text": "def either_2_4(list)\n count = 0\n index = 0\n\n list.each do |i|\n if i == 2 && i == list[index + 1] || i == 4 && i == list[index + 1]\n count += 1\n end\n index = index + 1\n end\n\n if count == 1\n return true\n end\n\n return false\nend", "title": "" } ]
[ { "docid": "82bd3e8f7ae1492164acc25bc0d343e4", "score": "0.771687", "text": "def middle_way(list1,list2)\n new_list = []\n if list1.size % 2 == 1\n middle1 = list1[list1.size/2]\n new_list.push(middle1)\n else\n middle1 = (list1[list1.size/2] + list1[list1.size/2 - 1]) / 2.0\n new_list.push(middle1)\n end\n if list2.size % 2 == 1\n middle2 = list2[list2.size/2]\n new_list.push(middle2)\n else\n middle2 = (list2[list2.size/2] + list2[list2.size/2 - 1]) / 2.0\n new_list.push(middle2)\n end\n print new_list\nend", "title": "" }, { "docid": "d09ffd04fc84120ce1dc970ae8b5d375", "score": "0.75750244", "text": "def middle_way(list1, list2) #Middle way ===> Complete\n new_list = [0,0]\n new_list[0] = list1[(list1.size / 2)]\n new_list[1] = list2[(list2.size / 2)]\n return new_list\nend", "title": "" }, { "docid": "538cf7ef5c63687cc1727b9fa75a617c", "score": "0.7563157", "text": "def middle_way(list1, list2) #return list with middle of lists (assume both lists have odd number of elements)\n return [list1[list1.size/2], list2[list2.size/2]]\nend", "title": "" }, { "docid": "618779ef4f942bf58df9394f139527f2", "score": "0.7539512", "text": "def middle_way(first_list, second_list)\n\n if first_list.size % 2 == 1\n point_one = first_list.size / 2\n first_mid = first_list[point_one]\n else \n return false\n end\n if second_list.size % 2 == 1\n point_two = second_list.size / 2\n second_mid = second_list[point_two]\n else \n return false\n end\n return first_mid, second_mid\nend", "title": "" }, { "docid": "eaa9034223561c2cd80104820296c596", "score": "0.74293584", "text": "def middle_way(list1, list2)\n\n if list1.size%2 == 1 && list2.size%2 == 1\n x = list1[list1.size / 2]\n y = list2[list2.size / 2]\n end\n\n return x, y\nend", "title": "" }, { "docid": "9ad6f411c891880f6eff0bba3de153ab", "score": "0.70701194", "text": "def midway(list1, list2)\n newlist1 = list1[list1.size / 2]\n newlist2 = list2[list2.size / 2]\n newlist = []\n newlist.push(newlist1)\n newlist.push(newlist2)\n return newlist\n end", "title": "" }, { "docid": "8240283fd606575398ff6e4dc6171cf3", "score": "0.70255554", "text": "def middle_way(list1, list2)\n median1 = 0\n if list1.size % 2 == 1\n median1 = list1[list1.size / 2]\n else\n median1 = (list1[list1.size / 2] + list1[(list1.size / 2) - 1]) / 2.0\n end\n\n median2 = 0\n if list2.size % 2 == 1\n median2 = list2[list2.size / 2]\n else\n median2 = (list2[list2.size / 2] + list2[(list2.size / 2) - 1]) / 2.0\n end\n\n puts \"(#{median1}, #{median2})\"\nend", "title": "" }, { "docid": "9cfb70c215378e5b30e5359fcd0680ba", "score": "0.6970587", "text": "def find_middle (num1, num2, num3)\n puts [num3, num2, num1].sort()[1]\nend", "title": "" }, { "docid": "8a6ee4119e6288aabaeede60510ed8a6", "score": "0.6585878", "text": "def middle(arr)\n\n p arr\n puts\n\n even_arr = []\n\n if arr.length.odd?\n # p \"its odd\"\n # puts\n middle_index = (arr.length / 2)\n # p middle_index\n return middle_index\n else\n # p \"its even\"\n # puts\n middle1= (arr.length/2) - 1\n middle2= (arr.length/2)\n even_arr << middle1\n even_arr << middle2\n # p even_arr\n return even_arr\n\n #formula\n #middle_index = (middle1 + middle2) / 2\n end\n\n \nend", "title": "" }, { "docid": "d2a2ca6b665c9777a2055a7d42b0e747", "score": "0.6517074", "text": "def middle_array\n\n array = Array.new\n new_array = Array.new\n\n puts \"Give me array with at least 3 elements and odd length.\"\n array = gets.chomp\n\n if (array.length<3)\n puts \"Array has to have at least 3 elements.\"\n elsif (array.length%2==0)\n puts \"Array has to have odd length.\"\n else\n middle_index = array.length/2\n new_array = [array[middle_index-1], array[middle_index], array[middle_index+1]]\n puts \"New array: [#{new_array.join(',')}]\"\n end\nend", "title": "" }, { "docid": "8f4e6a261aa2300759294f03885f6ac6", "score": "0.64426833", "text": "def middle_permutation(string)\n combos = string.chars.sort.permutation(string.size).map(&:join)\n combos.size.even? ? combos[combos.size / 2 - 1] : combos[combos.size / 2] \nend", "title": "" }, { "docid": "bf2002755cac14cea08db265423030fd", "score": "0.64370567", "text": "def halvsies(array)\n size = array.size\n if size.even?\n halfway_mark_index = (size / 2) - 1\n else \n halfway_mark_index = (size / 2)\n end \n first_half = []\n second_half = []\n\n array[0..halfway_mark_index].each do |element|\n first_half << element\n end \n\n second_starter = halfway_mark_index +1\n array[second_starter..-1].each do |element|\n second_half << element\n end \n\n [first_half, second_half]\n\nend", "title": "" }, { "docid": "7593b7a0f711db1057f284eb24953b19", "score": "0.63820714", "text": "def middle(head)\n\tlist = link_to_array(head)\n\tmiddle = list.length / 2\n\n\tlist[middle]\nend", "title": "" }, { "docid": "eb74dc3d89609aa35effc2566b46e102", "score": "0.62824035", "text": "def get_sandwich(werds)\n bread_positions = []\n (str.size-4).times do |i|\n         if werds[i..i+4] == \"bread\"\n             bread_positions.push(i)\n         end\n     end\n     if bread_positions.size == 2\n         pos1 = bread_positions[0]+5\n         pos2 = bread_positions[1]-1\n         return werds[pos1..pos2]\n     else\n         return false\n     end\nend\n\n# puts get_sandwich(\"breadjamsandwichsomethingoranotherbreadhellobread\") #jamsandwichsomethingoranotherbreadhello\n# puts get_sandwich(\"sandwichbreargfbreadkelsiebreadsomething\") #kelsie\n# puts get_sandwich(\"breadsomethingbutnobred\") #\"\"\n\n\n\n\n\ndef shift_left(list)\n newlist = []\n newlist.push(list[1])\n list.size.times do |i|\n if i != i[0]\n newlist.push(list[i])\n end\n end\n newlist.push(list[0])\nend\n\n# puts shift_left([1, 2, 3, 4, 5]) # 2, 3, 4, 5, 1\n\n\n\n\ndef middle_way(list1,list2)\n new_list = []\n if list1.size % 2 == 1\n middle1 = list1[list1.size/2]\n new_list.push(middle1)\n else\n middle1 = (list1[list1.size/2] + list1[list1.size/2 - 1]) / 2.0\n new_list.push(middle1)\n end\n if list2.size % 2 == 1\n middle2 = list2[list2.size/2]\n new_list.push(middle2)\n else\n middle2 = (list2[list2.size/2] + list2[list2.size/2 - 1]) / 2.0\n new_list.push(middle2)\n end\n print new_list\nend\n\n# puts middle_way([1,2,3,4,5], [3,4,4,5,5,6]) # 3,4\n\n\n\n\n\n\ndef count_code(str)\n count = 0\n (str.size-3).times do |i|\n     slice = str[i..i+3]\n     if slice[0..1] == \"co\" && slice[3] == \"e\"\n         count += 1\n     end\n end\n return count\nend\n \n#puts count_code(\"sobe,cobe,code\")\n\n\n\n\n\n \ndef either_2_4(list)\n numbers = 0\n list.each_with_index do |num,i|\n slice = list[i..i+1]\n if slice == [2,2] || slice == [4,4]\n numbers += 1\n end\n end\n if numbers > 1\n return false\n elsif numbers == 1\n return true\n elsif numbers == 0\n return false\n end\nend\n\nputs either_2_4([1,2,2,3]) # true\nputs either_2_4([1,2,3]) # false\nputs either_2_4([1,2,2,3,4,4]) # false", "title": "" }, { "docid": "84c2168ba429059e009f574f2eed1520", "score": "0.6259586", "text": "def halvsies(arr)\n middle = arr.length.odd? ? (arr.length / 2) + 1 : (arr.length / 2)\n [arr[0,middle], arr[middle..-1]]\nend", "title": "" }, { "docid": "21b19a9ad8bf804fc7ada77c9179fb5d", "score": "0.6176032", "text": "def middle_array\n array = Array.new\n new_array = Array.new\n puts \"Give me array containing even number of elements.\"\n array = gets.chomp\n if (array.length%2==0)\n index1 = array.length/2\n index2 = index1 - 1\n new_array = [array[index2],array[index1]]\n puts \"New array with middle elements: [#{new_array.join(',')}]\"\n else\n puts \"Array doesn't contain even number of elements.\"\n end\nend", "title": "" }, { "docid": "4e1ffc033e2adfc3257113304416c830", "score": "0.6094222", "text": "def middle(string)\n words_array = string.split\n halfway = words_array.size/2\n return '' if words_array.empty?\n return words_array[halfway] if words_array.size.odd?\n [words_array[halfway - 1], words_array[halfway]].join ' '\nend", "title": "" }, { "docid": "6b16d63e83b7cfe7aa1348529d8c8b04", "score": "0.60922635", "text": "def middle_element(array)\n if array.size == 0\n nil\n elsif array.size % 2 == 0\n (array[array.size / 2] + array[(array.size/2) - 1]).to_f / 2\n else\n array[array.size / 2]\n end\nend", "title": "" }, { "docid": "f6c9b1943136287b717bbc2da2fa510b", "score": "0.6071418", "text": "def halvsies(arr)\n new_arr = []\n first_arr = []\n second_arr = []\n\n arr.each_with_index do |num, index|\n if index <= arr.size / 2 \n first_arr << num\n else\n second_arr << num\n end\n end\n new_arr.push(first_arr).push(second_arr)\nend", "title": "" }, { "docid": "33011d0669c3c22789a56577d104eab2", "score": "0.60657996", "text": "def get_middle(s)\n if s.length.even?\n return s[s.length / 2-1] + s[s.length / 2]\n else \n return s[s.length / 2]\n end\nend", "title": "" }, { "docid": "f87009e8a4ce99c306be4bc40791fc5c", "score": "0.60645515", "text": "def middle_word(string)\n return string if string.length == 1 || string.length == 0\n words = string.split\n index = words.size / 2\n even_set = []\n if words.size.odd?\n return words[index]\n elsif \n even_set << words[index - 1] << words[index]\n end\n even_set\nend", "title": "" }, { "docid": "d7a1694d84fc6e597c76f7240253f7f0", "score": "0.6062111", "text": "def half (int, arr_of_int, itteration)\n middle_num = (arr_of_int.length / 2)\n \n puts spaces(itteration) + \"Recurse : Array Split at\" + middle_num.to_s\n puts spaces(itteration) + \"int:\" + int.to_s + \" Array;\" + arr_of_int.to_s\n\n if int == arr_of_int.at(middle_num)\n puts spaces(itteration) + \"Found it\"\n return middle_num\n elsif int > arr_of_int.at(middle_num)\n puts spaces(itteration) + \"In Upper Half\"\n return middle_num + half(int, arr_of_int[middle_num...(arr_of_int.length)], itteration+1)\n else\n puts spaces(itteration) + \"In Lower Half\"\n half(int, arr_of_int.first(middle_num), itteration+1)\n end\n\n\nend", "title": "" }, { "docid": "19e035111662fc14ec738c28f114d812", "score": "0.60612196", "text": "def get_middle(s)\n s.length.even? ? s[(s.length/2)-1] + s[s.length/2] : s[s.length/2]\nend", "title": "" }, { "docid": "d05ce21a5fea842c266a41f5ca66dbe8", "score": "0.6059269", "text": "def get_middle(s)\n if s.length.even?\n return s[((s.length/2)-1)]+s[(s.length/2)]\n else\n return s[s.length/2]\n end\nend", "title": "" }, { "docid": "62329e046853622cfa666276225f277c", "score": "0.6050295", "text": "def middle(word)\n half = word.length/2\n if word.length % 2 == 1\n middle = word[half]\n else\n middle = word[half - 1] + word[half]\n end\nend", "title": "" }, { "docid": "5fd3e32b470c24830fffd1d0ab32955f", "score": "0.60472775", "text": "def halvsies(arr)\n first_half = []\n second_half = []\n if arr.length.even?\n first_half << arr.first(arr.length / 2)\n second_half << arr.last(arr.length / 2)\n [first_half.flatten, second_half.flatten]\n elsif arr.length.odd?\n first_half << arr.first(arr.length / 2 + 1)\n second_half << arr.last(arr.length / 2)\n [first_half.flatten, second_half.flatten]\n end\nend", "title": "" }, { "docid": "0a9b0b5dd2406b555901511e65589398", "score": "0.60388905", "text": "def halvsies(arr)\n first_half = []\n ((arr.length+1)/2).times{first_half << arr.shift}\n [first_half,arr]\nend", "title": "" }, { "docid": "f05e7c69f305973629ac4aa847261fcd", "score": "0.6038614", "text": "def do_something(first, mid, last)\n\nend", "title": "" }, { "docid": "4af90383ba8ebb64db174da512da57f8", "score": "0.60332125", "text": "def halvsies(array1)\n array2 = []\n result = []\n half = array1.size / 2\n half.times { array2 << array1.pop }\n result << array1 << array2.reverse\nend", "title": "" }, { "docid": "0e23ad191d253f31b20abf5c47c9e22d", "score": "0.6026561", "text": "def middle\n self[(size-1) / 2]\n end", "title": "" }, { "docid": "0e23ad191d253f31b20abf5c47c9e22d", "score": "0.6026561", "text": "def middle\n self[(size-1) / 2]\n end", "title": "" }, { "docid": "0e23ad191d253f31b20abf5c47c9e22d", "score": "0.6026561", "text": "def middle\n self[(size-1) / 2]\n end", "title": "" }, { "docid": "3241ccb251f07811bc93465b50ef24e6", "score": "0.60228837", "text": "def halvsies(array)\n middle = (array.size) / 2\n middle += 1 if array.size % 2 == 1\n half1 = array.slice (0..middle - 1)\n half2 = array.slice (middle..array.size)\n [half1, half2]\n \n \nend", "title": "" }, { "docid": "e7bdc9e19e2064e61aa54dc8d4a2c71e", "score": "0.6016554", "text": "def gimme(input_array)\n sorted_array = input_array.sort\n middle_val = sorted_array[1]\n input_array.index(middle_val) \nend", "title": "" }, { "docid": "ff53c3afb4eb6c662186dec869617d3f", "score": "0.6000993", "text": "def get_middle(s)\n s[(s.size-1)/2..s.size/2]\nend", "title": "" }, { "docid": "c832910240f0c5aa4ea9809870cb3409", "score": "0.599098", "text": "def every_possible_pairing_of_students(array)\nend", "title": "" }, { "docid": "c832910240f0c5aa4ea9809870cb3409", "score": "0.599098", "text": "def every_possible_pairing_of_students(array)\nend", "title": "" }, { "docid": "40e4fd22e8b880b7682a7ffe8225619e", "score": "0.5990515", "text": "def get_middle(s)\n return s if s.size <= 1\n \n s.size.even? ? s.slice(s.size / 2 - 1, 2) : s.slice(s.size / 2)\nend", "title": "" }, { "docid": "86d1f104e1527a95a361a9b118615774", "score": "0.59884614", "text": "def halvsies(array)\n both = []\n arr1 = []\n if array.length.odd?\n ((array.length / 2) + 1).times do\n arr1 << array.slice!(0)\n end\n else (array.length / 2).times do \n arr1 << array.slice!(0)\n end\n end\n both << arr1\n both << array\n both\nend", "title": "" }, { "docid": "86f5c33ecd3a35880ffc803501d823bf", "score": "0.5985324", "text": "def halvsies(arr)\n return [[],[]]if arr == []\n return [arr, []] if arr.size == 1\n size = arr.size\n middle = (size - 1) / 2\n [arr[0..middle], arr[(middle + 1)..-1]]\nend", "title": "" }, { "docid": "a0645c885a5c3d77bf4e9fc5d9029ad9", "score": "0.5946824", "text": "def get_middle(s)\n s[(s.size-1)/2..s.size/2]\nend", "title": "" }, { "docid": "a0645c885a5c3d77bf4e9fc5d9029ad9", "score": "0.5946824", "text": "def get_middle(s)\n s[(s.size-1)/2..s.size/2]\nend", "title": "" }, { "docid": "cd8554624f3c9c0b973212ab41a595d5", "score": "0.5946598", "text": "def halvsies(arr)\n arr1 = []\n arr2 = []\n length = arr.length\n arr.each_with_index {|e,n|\n length.even? ?\n n >= (length/2) ?\n arr2 << e\n : arr1 << e\n : n > (length/2) ?\n arr2 << e\n : arr1 << e\n }\n \n [arr1,arr2]\nend", "title": "" }, { "docid": "06c4a5a59665df7a80eef4c1f7901e8f", "score": "0.5943718", "text": "def last_two(array)\nend", "title": "" }, { "docid": "0775b2071c4a9d1473e023f16c84f961", "score": "0.5940084", "text": "def halvsies(array)\n half_array = []\n half_array << array.pop(array.length / 2)\n half_array.unshift(array.pop(array.length))\n half_array\nend", "title": "" }, { "docid": "d9c3254ccadd2a9f2a954a488d9c8cb9", "score": "0.59381014", "text": "def get_middle(s)\n x = (s.length/2)\n s.length.even? ? s[x-1..x] : s[x]\nend", "title": "" }, { "docid": "f36af4007b7120a886a00833cb2b3e49", "score": "0.59354985", "text": "def halvsies(arr)\n halfway = arr.length / 2\n arr2 = arr.slice!(halfway * -1, halfway)\n [arr, arr2]\nend", "title": "" }, { "docid": "a957442b96c8111252ef869b014a37be", "score": "0.5931457", "text": "def halvsies(arr)\n new_arr = [[], []]\n arr.each do |a| \n if arr.size.even? \n if arr.index(a) <= (arr.size/2) - 1\n new_arr[0]<< a\n else\n new_arr[1]<< a\n end \n else\n if arr.index(a) < (arr.size/2) + 1\n new_arr[0]<< a\n else\n new_arr[1]<< a\n end \n end \n end \n new_arr\nend", "title": "" }, { "docid": "ddc51873e7676d808891dc17be44ac91", "score": "0.5927098", "text": "def middle_word(words, include_even: false)\n word_ary = words.split\n return nil if include_even != true && word_ary.size.even?\n middle = (word_ary.size.to_f / 2).round\n puts \"Word no. #{middle} for size of #{word_ary.size}\"\n word_ary[middle - 1]\nend", "title": "" }, { "docid": "3adff74ccc8275802afe81a0cb528f0a", "score": "0.59199214", "text": "def halvsies(arr)\n halfway = ( arr.length / 2.0 ).round\n first, last = arr.slice!(0, halfway), arr\n\n [first, last]\nend", "title": "" }, { "docid": "8e87401bef7a585f6aad855e1a534e21", "score": "0.5916877", "text": "def halvsies(arr)\n len = arr.length\n# mid = len.odd? ? (len / 2) + 1 : len / 2\n mid = (len / 2.0).ceil\n first_arr = arr.slice(0, mid)\n second_arr = arr.slice(mid, len - first_arr.size)\n\n [first_arr, second_arr]\nend", "title": "" }, { "docid": "326827e9534acc63eeac870d9eab3e38", "score": "0.59161025", "text": "def halvsies(array)\n halfway_index = array.size.odd? ? array.size / 2 : array.size / 2 - 1\n [array[0..halfway_index], array[halfway_index + 1..array.size - 1]]\nend", "title": "" }, { "docid": "a2bbd4d880d67b18fa1f3eb517522cb0", "score": "0.59016985", "text": "def get_middle(s)\n mid =(s.length - 1)/2\n s.length.even? ? s[mid..mid+1]:s[mid]\nend", "title": "" }, { "docid": "0eca4c886f66e4acb2b910c0b164135b", "score": "0.5882705", "text": "def every_possible_pairing_of_students(array)\n output = []\n number = array.length - 1\n array.each_with_index do |element, index|\n next_index = 1\n if index == array.length - 1\n\n else\n (number - index).times do\n new_array = [element, array[index + next_index]]\n output.push(new_array)\n next_index += 1\n end\n end\n end\n return output\nend", "title": "" }, { "docid": "3e77d7c72df6e562f1ff77b90a7cecbf", "score": "0.5881556", "text": "def halve list\n middle = (list.length/2.0).round\n\n ugly_left = list[0..middle]\n ugly_right = list[(middle + 1)..(list.length)] # \"but the math is ugly\", quibbles Nick\n\n left = list.slice(0, middle) # ... \"this is neater,\" he retorts.\n right = list.slice(middle, list.length)\n\n [left,right]\nend", "title": "" }, { "docid": "c0464376c069a770cf52dac86078bb0f", "score": "0.58738875", "text": "def middle_one(word)\n arr = word.split('')\n if arr.length.even?\n return \"#{arr[(arr.length/2)-1]}#{arr[(arr.length/2)]}\"\n else\n return arr[arr.length/2]\n end\nend", "title": "" }, { "docid": "8b22c2279c7626474ee388ac3cf0c390", "score": "0.58698046", "text": "def half_it(array)\n if array.size.even?\n first_length = array.size / 2\n second_length = first_length\n else \n first_length = (array.size + 1) / 2\n second_length = (array.size - 1) / 2\n end\n first_array = array.slice!(0...first_length).to_a\n second_array = array\n new_array = []\n new_array << first_array\n new_array << second_array\n \nend", "title": "" }, { "docid": "532056340b37c2daadbb654b720f4fd3", "score": "0.58685035", "text": "def last_two(input_array)\n # TODO\nend", "title": "" }, { "docid": "e47e2d55ca91bfed0ec311dafca96d15", "score": "0.5861413", "text": "def halvsies2(arr)\n first_arr = []\n second_arr =[]\n second_size = (arr.size) /2\n first_size = arr.size - second_size\n index = 0\n loop do \n if index < first_size\n first_arr << arr[index]\n else \n second_arr << arr[index]\n end \n index += 1\n break if index == arr.size\n end \n output = first_arr, second_arr\n output\nend", "title": "" }, { "docid": "382b9a3563f9cc79d043558a29a2817f", "score": "0.5858624", "text": "def first_half(array)\n even = array.length / 2 #so 1st array has 2\n uneven = array.length / 2 + 1 #so 3 for 2nd aray\n if array.length % 2 == 0 #here the code will go 1 away of another\n array = array[0..even - 1] #because 4 / 2 = 2 and indexing starts at 0\n else\n array = array[0...uneven] #3\n end\nend", "title": "" }, { "docid": "110faab68caffbf4059744ebb0037229", "score": "0.5855418", "text": "def check_array(nums)\n midArr = []\n \thalf = nums.length/2;\n\tmidArr[0] = nums[half-1];\n\tmidArr[1] = nums[half];\n\treturn midArr;\nend", "title": "" }, { "docid": "110faab68caffbf4059744ebb0037229", "score": "0.5855418", "text": "def check_array(nums)\n midArr = []\n \thalf = nums.length/2;\n\tmidArr[0] = nums[half-1];\n\tmidArr[1] = nums[half];\n\treturn midArr;\nend", "title": "" }, { "docid": "a9136ebe9f72f866bce64f461f73fc5e", "score": "0.5852244", "text": "def middle_word(words)\n words_array = words.split\n number_of_words = words_array.size\n middle = number_of_words / 2\n\n if number_of_words.zero?\n words\n elsif number_of_words.even?\n words_array[middle - 1..middle].join(' ')\n else\n words_array[middle]\n end\nend", "title": "" }, { "docid": "76623258c710f62cb24b8b00abd44afe", "score": "0.58505034", "text": "def get_middle(s)\n if s.length % 2 == 1\n s[(s.length + 1) / 2 - 1]\n else\n s[s.length / 2 - 1..s.length / 2]\n end\nend", "title": "" }, { "docid": "4bb49b9d383a09f8715a8ddaa2d02d9f", "score": "0.5848874", "text": "def find_middle_element\n current = @head\n middle = @head\n length = 0\n while (current.next != nil)\n length += 1\n if length % 2 == 0\n middle = middle.next\n end\n current = current.next\n end\n if length % 2 == 1\n middle = middle.next\n end\n return middle\n end", "title": "" }, { "docid": "3c7652a932c5af26db004c0c7720ff9b", "score": "0.58459693", "text": "def halvsies(arr)\n halved_arr = [[], []]\n arr.each_with_index do |num, index|\n if arr.length.even?\n index < (arr.length / 2) ? halved_arr[0] << num : halved_arr[1] << num\n else\n index <= (arr.length / 2) ? halved_arr[0] << num : halved_arr[1] << num\n end\n end\n halved_arr\nend", "title": "" }, { "docid": "da0b11bad5894f804d2843a2de09b163", "score": "0.58402044", "text": "def swingers(arrays)\n returning = []\n arrays.each_with_index do |couples, i|\n man = couples[0]\n if i == arrays.length - 1\n i = 0\n woman = arrays[i][1]\n else \n i += 1\n woman = arrays[i][1]\n end\n returning << [man, woman]\n end\n returning.each do |new_couple|\n puts \"#{new_couple.join(\" is now with \")}\"\n end\nend", "title": "" }, { "docid": "a29c8dac1e1f43c6e3d627658443d94a", "score": "0.58356553", "text": "def middle_node1(head)\n len = 0\n curr = head\n\n # find the total length of the list\n while curr != nil\n len += 1\n curr = curr.next\n end\n\n curr = head\n (len/2).times do\n curr = curr.next\n end\n\n curr\nend", "title": "" }, { "docid": "89b52f915d6d5162dc7deb57f0249161", "score": "0.5835262", "text": "def halvsies(array)\n second_half = []\n array = array.dup\n (array.size / 2).times do |index|\n second_half.unshift(array.pop)\n end\n [array, second_half]\nend", "title": "" }, { "docid": "9c53c89f1d21ddd06317ae1791627034", "score": "0.5832594", "text": "def halvsies(array)\n left = []\n right = []\n array.each_index do |index|\n if index < (array.size / 2.0).ceil\n left << array[index]\n else\n right << array[index]\n end\n end\n [left, right]\nend", "title": "" }, { "docid": "84f3c63152b1541502b5f9ff30bf716a", "score": "0.58137584", "text": "def calculate_middle(lowest,highest)\n\tmiddle = highest - lowest\n\tputs \"#{highest} - #{lowest} = #{middle}\"\n\treturn middle\nend", "title": "" }, { "docid": "3a0c790c2376007e37aba6153010206f", "score": "0.58123744", "text": "def switch_pairs(array)\n if array.length <= 1\n return array\n else\n (array[0],array[1] = array[1],array[0]) + switch_pairs(array[2..-1])\n end\nend", "title": "" }, { "docid": "5c1d86433e1a6c8db708a5639c32244e", "score": "0.58038175", "text": "def find_middle(linked_list)\n i = 1\n current = head\n \n while current.next != nil\n i += 1\n end\n \n middle = i / 2\n \n pointer = head\n \n middle.times do\n pointer = pointer.next\n end\n \n return pointer.value\nend", "title": "" }, { "docid": "622863dbfc01970ebb4fa87912c36c55", "score": "0.58003616", "text": "def halvsies(arr)\n mid = (arr.size) / 2\n mid += 1 if arr.size.odd?\n [arr[0...mid], arr[mid..arr.size]]\nend", "title": "" }, { "docid": "1942b1439339701414912e8994fecce7", "score": "0.57996756", "text": "def halvsies(array)\n array_length = array.length\n if array_length.odd?\n arr1 = array[0..(array_length/2)]\n arr2 = array[((array_length/2) + 1)..-1]\n else\n arr1 = array[0..((array_length/2 - 1))]\n arr2 = array[((array_length/2))..-1]\n end\n [arr1,arr2]\nend", "title": "" }, { "docid": "e51ec3b17d2afc7e1f6c55f5e89eefde", "score": "0.57920104", "text": "def get_middle(string)\n letters = string.split('')\n\n if letters.length % 2 == 0\n puts \"#{letters[((string.length / 2) - 1)]}#{letters[string.length / 2]}\"\n else\n puts \"#{letters[string.length / 2]}\"\n end\nend", "title": "" }, { "docid": "51da5f6393ec4142dc177bf2f88f942d", "score": "0.5780599", "text": "def get_middle(s)\n len = s.length\n if len <=1 \n return s\n end\n if len % 2 == 0 \n return s[len/2 -1] + s[len/2]\n else\n return s[len/2]\n end\nend", "title": "" }, { "docid": "624a85252a6b90ab1b0409561c4501b3", "score": "0.5778989", "text": "def halvsies(arr)\n \n # create empty arrays for half1 and half2\n # get the halfway point in array\n # iterate from zero to halfway, adding element at index to half1\n # iterate from halfway to size, adding elements to half2\n # return [half1, half2]\n\n half1, half2 = [], []\n half_index = (arr.size - 1) / 2\n \n arr.each_with_index { |el, i| i <= half_index ? half1 << el : half2 << el }\n\n [half1, half2]\nend", "title": "" }, { "docid": "25908d7904d4a3c2e55329cc19763131", "score": "0.5776709", "text": "def halvsies(arr)\n index = arr.size / 2\n index -= 1 if arr.size.even?\n [arr[0..index],arr[index+1..-1]]\nend", "title": "" }, { "docid": "0f94e0aaffd7b89f87bbe7e0d428c36f", "score": "0.577363", "text": "def first_half(array)\n # Write your code here\nend", "title": "" }, { "docid": "a781ea541f2702089070c7bebf8a74da", "score": "0.576651", "text": "def halvsies(array)\n return [[], []] if array.size == 0\n return [array, []] if array.size == 1\n middle = array.size / 2\n if array.size.even?\n arr1 = array.slice(0, middle)\n arr2 = array.slice(array.size, middle)\n else\n arr1 = array.slice(0, (middle + 1))\n arr2 = array.slice((middle + 1), middle)\n end\n [arr1, arr2]\nend", "title": "" }, { "docid": "1fb204931e24cfb81e111af67d82edcd", "score": "0.57651484", "text": "def merge_sort(list)\n #If list length is less than or equal to 1 then go to list.\n if list.length <= 1\n list\n #else we will create three variables\n else\n #declaring our mid as list length divided by two\n mid = (list.length / 2).floor\n #It calls the list array and saying give me the first element[0] go all the way to the middle and subtract 1 from it\n # And bring that value to me\n left = merge_sort(list[0..mid - 1])\n #Then this one does the same except return to me whatever is to the right of the mid value.\n right = merge_sort(list[mid..list.length])\n merge(left, right)\n end\nend", "title": "" }, { "docid": "fac362cd5b15d3836111ecae1e77bbb0", "score": "0.5748266", "text": "def halvsies(array)\n stop_index = ''\n new_array = []\n other_new_array = []\n combined_array = [new_array, other_new_array]\n\n if array.size == 1\n stop_index = 1\n elsif array.size.odd?\n stop_index = (array.size / 2) + 1\n elsif array.size.even?\n stop_index = (array.size / 2)\n elsif array.empty?\n combined_array\n end\n \n counter = 0\n loop do\n break if array.empty?\n new_array << array[counter]\n counter += 1\n break if counter == stop_index\n end\n\n counter = stop_index\n loop do\n break if array.empty?\n other_new_array << array[counter]\n counter += 1\n break if counter >= array.size\n end\n other_new_array.compact!\n combined_array\nend", "title": "" }, { "docid": "24ad221d825275cf8e60f47f48b1d303", "score": "0.57463896", "text": "def one_three(base_chord)\n left_key=map_to(base_chord.sort[0], :C2)\n right_chord=[]\n base_chord.reverse.each do |note|\n note=map_to(note, :A3)\n right_chord.push(note)\n end\n return left_key, right_chord.sort.ring\nend", "title": "" }, { "docid": "24ad221d825275cf8e60f47f48b1d303", "score": "0.57463896", "text": "def one_three(base_chord)\n left_key=map_to(base_chord.sort[0], :C2)\n right_chord=[]\n base_chord.reverse.each do |note|\n note=map_to(note, :A3)\n right_chord.push(note)\n end\n return left_key, right_chord.sort.ring\nend", "title": "" }, { "docid": "7f83d4a717c5a8c5550bf6603bd27b01", "score": "0.5745207", "text": "def another_way(nth)\n first, last = [1, 1]\n 3.upto(nth) do\n first, last = [last.to_s[-1].to_i, (first + last).to_s[-1].to_i]\n end\n last\nend", "title": "" }, { "docid": "a172c50b6b6191fac70328ca991af0d4", "score": "0.57269835", "text": "def meth(arr_input,arr_input2)\n\n\n mid_elem = arr_input.insert(2, [arr_input2])\n puts mid_elem\n\nend", "title": "" }, { "docid": "daec4a9ee69ae09bcdd1b2ddd8b92a82", "score": "0.5721692", "text": "def prime_list(ends)\r\n prime_arr = number_list(2,ends)\r\n\r\n #puts middle\r\n primefind(prime_arr,ends)\r\nend", "title": "" }, { "docid": "d39e2f37a0b4b126fedeeb2a8aff0051", "score": "0.5721376", "text": "def panoramic_pairs(landmarks)\n result = []\n\n (0...landmarks.length).each do |i|\n if i == landmarks.length - 1\n result << [landmarks[-1], landmarks[0]]\n else\n result << [landmarks[i], landmarks[i + 1]]\n end\n end\n\n result\nend", "title": "" }, { "docid": "f5993224f2472b5a1772042dcd517ee4", "score": "0.5720527", "text": "def halve array\n middle = (array.size / 2.0).round - 1\n left = array[0..middle]\n right = array[(middle+1)..(array.last)]\n [left,right]\nend", "title": "" }, { "docid": "a7249a8b45cc6f276a06b08ec1aa5813", "score": "0.5716779", "text": "def halve array\n middle = (array / 2.0).round\n left = array[0..middle]\n right = array[middle..last]\n return [left, right] #explicit return for clarity\nend", "title": "" }, { "docid": "3b657257aa417bfa01a01ae281f8dbef", "score": "0.5716192", "text": "def halvsies(array)\n middle = (array.size / 2.0).ceil\n arr1 = array.slice(0, middle)\n arr2 = array.slice(middle, array.size-middle)\n [arr1, arr2]\nend", "title": "" }, { "docid": "0fc39c1222acce76fecc30ea8f6784b7", "score": "0.57041407", "text": "def merge_pairs_odd(multi)\r\n last = multi.count - 1\r\n next_to_last = multi.count - 2\r\n # Perform a union on the last two inner arrays\r\n # Google: set operators with Ruby arrays\r\n together = multi[next_to_last] | multi[last]\r\n # Assign the next-to-the-last inner array the union value (3 items)\r\n multi[next_to_last] = together\r\n # Delete the last inner array\r\n multi.delete_at(last)\r\n #puts \"Run list_pairs_odd(multi)...\" # inline test\r\n return multi # for testing, comment out for production\r\n #list_pairs_odd(multi) # for production, comment out for testing\r\nend", "title": "" }, { "docid": "eae9987517cd13dca18fca99ba80adfb", "score": "0.570281", "text": "def halvsies(arr)\n new_arr = [[], []]\n if arr.size.odd?\n new_arr[0] = arr[0..(arr.size / 2)]\n new_arr[1] = arr[(arr.size / 2) + 1..-1]\n p new_arr\n else\n new_arr[0] = arr[0..(arr.size / 2) - 1]\n new_arr[1] = arr[(arr.size / 2)..-1]\n p new_arr\n end\nend", "title": "" }, { "docid": "e5d7308b6ff69edf7c1ce71a25f764d1", "score": "0.57024056", "text": "def halvsies(array)\n length = array.length\n if length.even?\n array1 = array[0..(length / 2 - 1)]\n array2 = array[(length / 2)..-1]\n else\n array1 = array[0..(length / 2)]\n array2 = array[(length / 2 + 1)..-1]\n end\n [array1, array2]\nend", "title": "" }, { "docid": "de606c540d10582c382fed33ea7d9fa7", "score": "0.5700338", "text": "def first_and_last(input_array)\n # TODO\nend", "title": "" }, { "docid": "e2931ee6c2a866a727700534aa2b99af", "score": "0.5695872", "text": "def halvsies(arr)\n half1 = []\n half2 = arr\n half1_size = (arr.size / 2 + arr.size.remainder(2))\n half1_size.times { half1 << half2.shift }\n [half1, half2]\nend", "title": "" }, { "docid": "856a509a4eef7f7537c753bfcd428985", "score": "0.56950444", "text": "def got_three? (array)\n\t#I started in that direction\n\t#array.each_cons(3) { |a, b, c| new_array << [a, b, c] }\n\t# but it was getting complicated so moved to something easier.\n\tl = array.length\n\ti= 0\n\ttf=false\n\twhile i!=(l-2)\n\t if array[i] == array[i+1] && array[i] == array[i+2]\n\t tf=true\n\t end\n\ti+=1\n\tend\ntf\nend", "title": "" }, { "docid": "f80069ccb3394c1df4959a054e8c9f48", "score": "0.569445", "text": "def makePairsUtil( nuts, bolts, low, high)\n\tif (low < high)\n\t\t# Choose first element of bolts array as pivot to partition nuts.\n\t\tpivot = partition(nuts, low, high, bolts[low])\n\t\t# Using nuts[pivot] as pivot to partition bolts.\n\t\tpartition(bolts, low, high, nuts[pivot])\n\t\t# Recursively lower and upper half of nuts and bolts are matched.\n\t\tmakePairsUtil(nuts, bolts, low, pivot - 1)\n\t\tmakePairsUtil(nuts, bolts, pivot + 1, high)\n\tend\nend", "title": "" }, { "docid": "5f95f0afbd364f69115105ca40ee0f02", "score": "0.56876725", "text": "def halvsies(array)\r\n arr_1_length = (array.length / 2.0).round - 1\r\n arr_2_length = arr_1_length + 1\r\n\r\n first_half = array[0..arr_1_length]\r\n second_half = array[arr_2_length..array.length]\r\n\r\n [first_half, second_half]\r\nend", "title": "" }, { "docid": "04153ea83fbbc9cb972236a67a05e592", "score": "0.5686969", "text": "def halvsies(array)\n first_half = []\n second_half = []\n count = 0\n if array.size.even?\n while count < array.size / 2 do\n first_half << array[count]\n second_half = array - first_half\n count += 1\n end\n else\n while count <= array.size / 2 do\n first_half << array[count]\n second_half = array - first_half\n count += 1\n end\n end\n [first_half, second_half]\nend", "title": "" } ]
1807ca7d3d6b5b18b0a5edcb9288003e
Changes the image encoding format to the given format See even === Parameters [format (to_s)] an abreviation of the format === Yields [Magick::Image] additional manipulations to perform === Examples image.convert(:png) source://carrierwave//lib/carrierwave/processing/rmagick.rb122
[ { "docid": "94dcbe5a87c89069aedff785f9502ffd", "score": "0.58119386", "text": "def convert(format); end", "title": "" } ]
[ { "docid": "323e48d7ef1c60eee89b7e94a5c91710", "score": "0.80231905", "text": "def convert!(format)\n process! do |img|\n img.format = format.to_s.upcase\n img\n end\n end", "title": "" }, { "docid": "b1dfeb88a3f74adde7e5bfa4654c397e", "score": "0.77777934", "text": "def convert!(format)\n manipulate! do |img|\n img.format = format.to_s.upcase\n img\n end\n end", "title": "" }, { "docid": "86325aa5bdb95f9a8c0aa0477c053f2b", "score": "0.7258135", "text": "def convert(format, page=nil)\n @format = format\n @page = page\n manipulate! do |img|\n img = yield(img) if block_given?\n img\n end\n end", "title": "" }, { "docid": "bfa2bb0a933ec61c5cf1c5380218fd58", "score": "0.71990114", "text": "def convert(img, format, &block)\n processor.convert!(img, format, &block)\n end", "title": "" }, { "docid": "f3d82f3687d0cd59d5d85aacf8c32d1d", "score": "0.7013762", "text": "def convert(format, opts = {})\n format = format.to_s.downcase\n format = 'jpg' if format == 'jpeg'\n\n chain! { |builder| builder.convert(format).saver(opts) }\n end", "title": "" }, { "docid": "421840010a3abbfc3859d17dd68c0454", "score": "0.6684451", "text": "def convert_to_format\n if directives.fetch(:format) == 'jpg'\n Hydra::Derivatives::Processors::Image.new(converted_file, directives).process\n else\n output_file_service.call(File.read(converted_file), directives)\n end\n end", "title": "" }, { "docid": "105e350bf72042237e83209ebf7fadfc", "score": "0.6681708", "text": "def format(format)\n MiniMagick::Tool::Convert\n end", "title": "" }, { "docid": "6b6f880d0a1eeacd2d10fd240c06b7fc", "score": "0.66545415", "text": "def format(format, page = 0)\n c = CommandBuilder.new('mogrify', '-format', format)\n yield c if block_given?\n c << @path\n run(c)\n\n old_path = @path.dup\n @path.sub!(/(\\.\\w*)?$/, \".#{format}\")\n File.delete(old_path) if old_path != @path\n\n unless File.exists?(@path)\n begin\n FileUtils.copy_file(@path.sub(\".#{format}\", \"-#{page}.#{format}\"), @path)\n rescue => ex\n raise MiniMagick::Error, \"Unable to format to #{format}; #{ex}\" unless File.exist?(@path)\n end\n end\n ensure\n Dir[@path.sub(/(\\.\\w+)?$/, \"-[0-9]*.#{format}\")].each do |fname|\n File.unlink(fname)\n end\n end", "title": "" }, { "docid": "b9533aba53802a3b75d2f8ada4978871", "score": "0.6580813", "text": "def convert(format, page=nil, &block)\n minimagick!(block) do |builder|\n builder = builder.convert(format)\n builder = builder.loader(page: page) if page\n builder\n end\n end", "title": "" }, { "docid": "18f9be8ac687c0bfa1d3dc6c072a8942", "score": "0.65751743", "text": "def convert(new_format)\n unless new_format.is_a?(DynamicImage::Format)\n new_format = DynamicImage::Format.find(new_format)\n end\n if frame_count > 1 && !new_format.animated?\n self.class.new(extract_frame(0), target_format: new_format)\n else\n self.class.new(image, target_format: new_format)\n end\n end", "title": "" }, { "docid": "a7bc44a1cb0c1a7d3197078cd96c7679", "score": "0.6400392", "text": "def format(new_format)\n image.format(new_format)\n @content_type = MIME.mime_type_for_format(new_format)\n end", "title": "" }, { "docid": "ee01e5fa83f4abe2aee3d15db1b56e19", "score": "0.63168967", "text": "def format=(format)\n FFI::GMagick.MagickSetImageFormat( @wand, format )\n end", "title": "" }, { "docid": "7d7ddbac431831548b153081fac75871", "score": "0.6309013", "text": "def to_image(format = 'PNG')\n @to_image ||= begin\n draw\n renderer.finish\n image = renderer.image\n image.format = format\n image\n end\n end", "title": "" }, { "docid": "f26316a77448100d6fbfd46b235c0700", "score": "0.62683463", "text": "def convert!(file_format, required_format, output_dir, qemu_img_binary)\n Itchy::Log.info \"[#{self.class.name}] Converting image \" \\\n \"#{@metadata.dc_identifier.inspect} from \" \\\n \"original format: #{file_format} to \" \\\n \"required format: #{required_format}.\"\n\n new_file_name = \"#{::Time.now.to_i}_#{@metadata.dc_identifier}\"\n qemu_command = qemu_img_binary || Itchy::BASIC_QEMU_COMMAND\n convert_cmd = Mixlib::ShellOut.new(\"#{qemu_command} convert -f #{file_format} -O #{required_format} #{@unpacking_dir}/#{@metadata.dc_identifier} #{output_dir}/#{new_file_name}\")\n convert_cmd.run_command\n begin\n convert_cmd.error!\n rescue Mixlib::ShellOut::ShellCommandFailed, Mixlib::ShellOut::CommandTimeout,\n Mixlib::Shellout::InvalidCommandOption => ex\n Itchy::Log.fatal \"[#{self.class.name}] Converting of image failed with \" \\\n \"error messages #{convert_cmd.stderr}.\"\n fail Itchy::Errors::FormatConversionError, ex\n end\n new_file_name\n end", "title": "" }, { "docid": "284b0d3b4fcc2cff21c7ab49c76bc525", "score": "0.6205395", "text": "def format\n @image.format\n end", "title": "" }, { "docid": "cfcfe345dc55f17043877b26ed88669c", "score": "0.60912883", "text": "def convert_format_for_website\n image.format = 'PNG' unless ['GIF', 'JPEG'].include?(image.format)\n end", "title": "" }, { "docid": "7db85cbb2f6ee524fe4cc1780a3b4fae", "score": "0.5973258", "text": "def convert(format)\n branch format: format\n end", "title": "" }, { "docid": "d7feb62ecea37a531cb5f5fdbc60abbf", "score": "0.59491915", "text": "def to_format(format)\n case format\n when \"svg\"\n self.to_svg\n else\n raise RuntimeError, \"Cannot convert to format #{format}.\"\n end\n end", "title": "" }, { "docid": "43354ecddcb7163c8e54e75737f8ab63", "score": "0.5904888", "text": "def format\n return image_format\n end", "title": "" }, { "docid": "43354ecddcb7163c8e54e75737f8ab63", "score": "0.5904888", "text": "def format\n return image_format\n end", "title": "" }, { "docid": "fed3de888aeed5b95be65ac627ed0128", "score": "0.5904073", "text": "def format\n target.format.to_s == 'jpg' ? 'jpeg' : target.format.to_s\n end", "title": "" }, { "docid": "ea56c1290fee9609bcd91d16abf19f75", "score": "0.5862787", "text": "def set_ImageFormat(value)\n set_input(\"ImageFormat\", value)\n end", "title": "" }, { "docid": "b7e1c5f2062a2782cdd0f903cbb1cfd4", "score": "0.58108044", "text": "def format\r\n return image_format\r\n end", "title": "" }, { "docid": "a65d43207c8cb5b9e77e034a360a1440", "score": "0.5808215", "text": "def image_processing_transform(file, format)\n operations = transformations.each_with_object([]) do |(name, argument), list|\n if name.to_s == \"combine_options\"\n ActiveSupport::Deprecation.warn(\"The ImageProcessing ActiveStorage variant backend doesn't need :combine_options, as it already generates a single MiniMagick command. In Rails 6.1 :combine_options will not be supported anymore.\")\n list.concat argument.keep_if { |key, value| value.present? }.to_a\n elsif argument.present?\n list << [name, argument]\n end\n end\n\n processor\n .source(file)\n .loader(page: 0)\n .convert(format)\n .apply(operations)\n .call\n end", "title": "" }, { "docid": "7ab8ae0da9da0940ef3054b71432f4fa", "score": "0.5771977", "text": "def format\n FFI::GMagick.MagickGetImageFormat( @wand )\n end", "title": "" }, { "docid": "625bebf4f0af5a01b75e3de07455862c", "score": "0.57679355", "text": "def encode(format, options = {})\n case format\n when 'jpg'\n # If we're trying to save an JPEG, we need to convert it to RGB\n canvas = BufferedImage.new @width, @height, BufferedImage::TYPE_INT_RGB\n \n graphics = canvas.graphics\n graphics.draw_image @canvas, 0, 0, @width, @height, nil\n else\n canvas = @canvas\n end\n \n output_stream = ByteArrayOutputStream.new\n ImageIO.write(canvas, format, output_stream)\n String.from_java_bytes output_stream.to_byte_array\n end", "title": "" }, { "docid": "70820da2d9b2265f3b9779b0bda5583a", "score": "0.5749551", "text": "def set_ImageFormat(value)\n set_input(\"ImageFormat\", value)\n end", "title": "" }, { "docid": "a2c1be850d3dfdb0e35dcd2eabbd1c49", "score": "0.57454956", "text": "def encoded_image(image, options = {})\n unless render_format.in?(Alchemy::Picture.allowed_filetypes)\n raise WrongImageFormatError.new(picture, @render_format)\n end\n\n options = {\n flatten: !render_format.in?(ANIMATED_IMAGE_FORMATS) && picture.image_file_format == \"gif\"\n }.with_indifferent_access.merge(options)\n\n encoding_options = []\n\n convert_format = render_format.sub(\"jpeg\", \"jpg\") != picture.image_file_format.sub(\"jpeg\", \"jpg\")\n\n if render_format =~ /jpe?g/ && (convert_format || options[:quality])\n quality = options[:quality] || Config.get(:output_image_jpg_quality)\n encoding_options << \"-quality #{quality}\"\n end\n\n if options[:flatten]\n encoding_options << \"-flatten\"\n end\n\n convertion_needed = convert_format || encoding_options.present?\n\n if picture.has_convertible_format? && convertion_needed\n image = image.encode(render_format, encoding_options.join(\" \"))\n end\n\n image\n end", "title": "" }, { "docid": "73926a6695f08c11cbed294bfef8e389", "score": "0.5689163", "text": "def convert(format, opts = {})\n format = format.to_s.downcase\n raise ArgumentError, \"Format must be one of: #{ALLOWED_FORMATS.join(',')}\" unless ALLOWED_FORMATS.include?(format)\n @_format = format\n @_format_opts = opts\n self\n end", "title": "" }, { "docid": "a81c39e5ec09451d5de5b2c9cfc545a7", "score": "0.5687726", "text": "def convert_to(format)\n prepare_for_conversion unless @prepare_for_conversion\n\n output_path = output_path(format)\n\n log_folder = create_log_folder\n stdout_log, stderr_log = stdout_log(format), stderr_log(format)\n\n Cmd::Conversion.new(temp_path, output_path, format).run! %W(#{stdout_log} a), %W(#{stderr_log} a)\n rescue StandardError => e\n FileUtils.rm_rf output_folder\n raise e\n end", "title": "" }, { "docid": "b110200318335667dbb7bdfb1cd3e493", "score": "0.56767213", "text": "def convert(format, page=nil)\n vips! do |builder|\n builder = builder.convert(format)\n builder = builder.loader(page: page) if page\n builder\n end\n end", "title": "" }, { "docid": "e61177b055e1969418c155710e143515", "score": "0.5659909", "text": "def mini_magick_transform(file, format)\n image = MiniMagick::Image.new(file.path, file)\n\n transformations.each do |name, argument_or_subtransformations|\n image.mogrify do |command|\n if name.to_s == \"combine_options\"\n argument_or_subtransformations.each do |subtransformation_name, subtransformation_argument|\n pass_transform_argument(command, subtransformation_name, subtransformation_argument)\n end\n else\n pass_transform_argument(command, name, argument_or_subtransformations)\n end\n end\n end\n\n image.format(format) if format\n\n image.tempfile.tap(&:open)\n end", "title": "" }, { "docid": "022bec818a0070707e547ac96475ebf0", "score": "0.5634495", "text": "def convert(path)\n begin\n mm_image = MiniMagick::Image.open(path)\n mm_image.format('png')\n mm_image\n rescue MiniMagick::Invalid\n raise InvalidImageFileError, \"#{path} is not an image\"\n end\n end", "title": "" }, { "docid": "803e46ce06898707e1cb89d26081f0ae", "score": "0.56207496", "text": "def to_blob(fileformat='PNG')\n draw\n return @im.to_blob do\n self.format = fileformat\n end\n end", "title": "" }, { "docid": "48e1d5488341f74aa5150f934fbe1636", "score": "0.55547", "text": "def format\n @resource.format.downcase.sub('jpeg', 'jpg')\n end", "title": "" }, { "docid": "4ae924f23e92ccdd2ca74f3cc4d3a358", "score": "0.55515414", "text": "def with_format format, &block\n old_formats = formats\n begin\n self.formats = [format]\n return block.call\n ensure\n self.formats = old_formats\n end\n end", "title": "" }, { "docid": "0f78330c897c5ff0ac57eb7200722610", "score": "0.5542969", "text": "def convert_to_png\n manipulate! do |img|\n img.format(\"png\") do |cmd|\n cmd.background \"transparent\"\n cmd.colorspace \"sRGB\"\n end\n img = yield(img) if block_given?\n img\n end\n end", "title": "" }, { "docid": "b951028d7d19bdd0b099bf8679808dd7", "score": "0.5541435", "text": "def transform(file, format:); end", "title": "" }, { "docid": "b951028d7d19bdd0b099bf8679808dd7", "score": "0.5541435", "text": "def transform(file, format:); end", "title": "" }, { "docid": "e6c08fff2ed23d10dc4050425f8bff3d", "score": "0.55233574", "text": "def setGoodImageFormat(sheet)\n oldPath = sheet.image.path\n pathArray = oldPath.split(\".\")\n pathArray.pop\n pathArray.push( \"jpg\" )\n newPath = pathArray.join(\".\")\n system(\"convert -density 175 #{oldPath} #{newPath}\")\n img = MiniMagick::Image.open(newPath)\n img.path = newPath\n File.delete(oldPath)\n img\n end", "title": "" }, { "docid": "1151ba2f3806b5c3d20e82dab3afa5f4", "score": "0.5498506", "text": "def with_format(format, &block)\n\t old_formats = formats\n\t self.formats = [format]\n\t block.call\n\t self.formats = old_formats\n\t nil\n\tend", "title": "" }, { "docid": "6e8ffda09a2f252e1d9d91299ed29b60", "score": "0.5483406", "text": "def format=(format)\n @format = format.to_s\n raise UnsupportedFormat unless VALID_FORMATS.include? @format\n end", "title": "" }, { "docid": "741de0fa9d18825bbbf4650ed136e503", "score": "0.5478513", "text": "def process_to_fill(width, height, quality, format)\n manipulate! do |image|\n image.fuzz \"3%\" # fuzzy treatment of \"the same color\" for the trim command\n image.trim # automatically removes borders from images (areas of the same color)\n img_width, img_height = image[:dimensions]\n\n image.format(format) do |img|\n image = yield(img) if block_given?\n end\n\n image.combine_options do |combo|\n if width != img_width || height != img_height\n ratio_width = width / img_width.to_f\n ratio_height = height / img_height.to_f\n\n if ratio_width >= ratio_height\n img_width = (ratio_width * (img_width + 0.5)).round\n img_height = (ratio_width * (img_height + 0.5)).round\n combo.resize \"#{img_width}\"\n else\n img_width = (ratio_height * (img_width + 0.5)).round\n img_height = (ratio_height * (img_height + 0.5)).round\n combo.resize \"x#{img_height}\"\n end\n end\n\n combo.gravity \"Center\"\n combo.background \"rgba(255,255,255,0.0)\"\n combo.extent \"#{width}x#{height}\" if img_width != width || img_height != height\n # combo.crop \"#{width}x#{height}-0-0\" if img_width != width || img_height != height\n end\n\n image.quality(quality.to_s)\n image = yield(image) if block_given?\n\n image\n end\n end", "title": "" }, { "docid": "869b636b544c860d145c3e6a55876416", "score": "0.5445827", "text": "def create_image script_filename, new_format\n new_format = new_format.to_s\n begin\n require 'RMagick'\n\n format_support = Magick.formats[new_format]\n raise(ArgumentError, \"RMagick cannot write format '#{new_format}'\") if format_support.nil? || format_support[2] == '-'\n\n raw_svg = create_svg(script_filename)\n\n # Specify input parameters in the block. We're always going to convert *from* SVG, so that goes there.\n image = Magick::Image::from_blob(raw_svg) { self.format = 'SVG' }\n page = image[0].page.dup # Get dimensions\n\n # Set write options.\n # * format is based on the extension the user gives for the file. For most types, just use the extension.\n # For postscript, you actually want PS3.\n # * use-cropbox is for PDFs and postscripts, to tell it to use the cropbox instead of the mediabox. This\n # improves the image quality by forcing it to use a size closer to that of the actual SVG. See also:\n # https://github.com/SciRuby/sciruby/issues/15#issuecomment-2880761\n image[0].format = new_format\n\n if %w{PS PS2 PS3 PDF}.include?(new_format) # PDF/PS settings\n STDERR.puts \"create_image: use-cropbox enabled\"\n image[0][\"use-cropbox\"] = 'true'\n\n unless new_format == 'PDF'\n # This is a kludge. Not clear on why this is necessary, but otherwise quality is simply terrible.\n STDERR.puts \"Warning: PostScript creation is wonky! See documentation on SciRuby::Plotter::create_image.\"\n STDERR.puts \"create_image: setting density to 100x100; setting page dimensions\"\n image[0].density = \"100x100\"\n image[0].page = page\n end\n end\n\n image[0]\n rescue LoadError\n raise(ArgumentError, \"RMagick not found; cannot write PDF\")\n end\n end", "title": "" }, { "docid": "d0feb14caff724913809334b6da17636", "score": "0.5424241", "text": "def format(format)\n\t\t\t\tif format =~ /^(pfm|jaspar)$/\n\t\t\t\t\tmotifs = [self]\n\t\t\t\t\treturn Bio::Jaspar.write(motifs, format)\n\t\t\t\telse\n\t\t\t\t\traise ArgumentError, \"Unknown format type #{format}\"\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "0ff9a0487a0e2793864b739c356f8cc7", "score": "0.54223555", "text": "def transform(file, format:)\n output = process(file, format: format)\n\n begin\n yield output\n ensure\n output.close!\n end\n end", "title": "" }, { "docid": "ae79033b5f6e43975e8398893f0ca24e", "score": "0.5400544", "text": "def encode(temp_object, format, args='')\n format = format.to_s.downcase\n throw :unable_to_handle unless supported_formats.include?(format.to_sym)\n details = identify(temp_object)\n\n if details[:format] == format.to_sym\n\t if args.empty?\n temp_object\n\t else\n\t\t ## TODO: cwebp cannot process webp images, need to decode first, then recode with new settings, which is not needed in my usecase\n\t\t throw :unable_to_handle\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tconvert(temp_object, args, format)\n\t\t\t\tend\n end", "title": "" }, { "docid": "06dceb8da8382a38e549184b4230ccd7", "score": "0.5385033", "text": "def with_format(format, &block)\n old_formats = formats\n self.formats = [format]\n yield\n self.formats = old_formats\n nil\n end", "title": "" }, { "docid": "9b24daa1aa705759ffc68e5ec1e8c752", "score": "0.5380374", "text": "def to_blob(format = 'PNG')\n warn '#to_blob is deprecated. Please use `to_image.to_blob` instead'\n to_image.format = format\n to_image.to_blob\n end", "title": "" }, { "docid": "092a02939eceeb3fc9dad97142ed1e55", "score": "0.5372227", "text": "def convert_to_image_by_size(page_number, image_format, width=0, height=0)\n \n begin\n \n if @filename == \"\"\n raise(\"filename not specified\")\n end\n \n if page_number == \"\"\n raise(\"page number not specified\")\n end\n \n if image_format == \"\"\n raise(\"image format not specified\")\n end\n \n \n str_uri = $productURI + \"/pdf/\" + @filename + \"/pages/\" + page_number.to_s + '?format=' + image_format + '&width=' + width.to_s + '&height=' + height.to_s\n str_signed_uri = Common::Utils.sign(str_uri)\n \n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'}) \n \n valid_output = Common::Utils.validate_output(response_stream)\n \n if valid_output == \"\" \n output_path = $OutPutLocation + Common::Utils.get_filename(@filename) + '_' + page_number.to_s + \".\" + image_format\n Common::Utils.saveFile(response_stream,output_path)\n return \"\"\n else\n return valid_output\n end\n \n rescue Exception=>e\n print e\n end\n \n end", "title": "" }, { "docid": "927d8b3b500ec6de4a0eeb6a5103883c", "score": "0.5370466", "text": "def convert_to_image page_number, image_format\n begin\n \n if page_number == \"\"\n raise(\"page number not specified\")\n end\n \n if image_format == \"\"\n raise \"image format not specified\"\n end\n \n str_uri = $productURI + \"/pdf/\" + @filename + \"/pages/\" + page_number.to_s + '?format=' + image_format\n str_signed_uri = Common::Utils.sign(str_uri)\n \n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'}) \n \n valid_output = Common::Utils.validate_output(response_stream)\n \n if valid_output == \"\" \n output_path = $OutPutLocation + Common::Utils.get_filename(@filename) + '_' + page_number.to_s + \".\" + image_format\n Common::Utils.saveFile(response_stream,output_path)\n return \"\"\n else\n return valid_output\n end\n \n rescue Exception=>e\n print e \n end \n end", "title": "" }, { "docid": "fc3ded7ad3a1fec267da415008282a1c", "score": "0.536975", "text": "def with_format(format, &block)\n old_formats = formats\n begin\n self.formats = [format]\n return block.call\n ensure\n self.formats = old_formats\n end\n end", "title": "" }, { "docid": "d06b52ecbcf5f5a07f75498894d8adce", "score": "0.5369536", "text": "def to(format, options = {})\n case format\n when :ascii then\n require \"theseus/formatters/ascii/#{type.downcase}\"\n Formatters::ASCII.const_get(type).new(self, options)\n when :png then\n require \"theseus/formatters/png/#{type.downcase}\"\n Formatters::PNG.const_get(type).new(self, options).to_blob\n else\n raise ArgumentError, \"unknown format: #{format.inspect}\"\n end\n end", "title": "" }, { "docid": "61de6bb7913492edc2c803262f5f06ae", "score": "0.5362224", "text": "def produce_format\n case format.to_sym\n when :yaml\n produce_yaml\n else\n produce_json\n end\n end", "title": "" }, { "docid": "87d591e3f0edc77fa508cc1295b22811", "score": "0.53568465", "text": "def format= new_format\n @gapi.configuration.extract.update! destination_format: Convert.source_format(new_format)\n end", "title": "" }, { "docid": "574d263e64a2e78b82162eb471be0adb", "score": "0.5339724", "text": "def format\n image_format = MemoryPointer::new( ImageFormat )\n error = OpenCL.clGetImageInfo( self, FORMAT, image_format.size, image_format, nil)\n error_check(error)\n return ImageFormat::new( image_format )\n end", "title": "" }, { "docid": "dedf2e0e0fa6270ffe35408194400e94", "score": "0.53062135", "text": "def correct_format(file_name)\n ext = File.extname file_name\n if Gg::ImageProcessing::SUPPORTED_FILE_TYPES.include? ext\n file_name\n else\n file_name.gsub(/#{ext}/i, '.png')\n end\n end", "title": "" }, { "docid": "79743469dc161a24c8511f2bb437ef7a", "score": "0.5298351", "text": "def to format\n #Formats are enums in java, so they are all uppercase\n if to_formats.include? format\n @citero::to(Formats::valueOf(format.upcase))\n else\n @citero::to(CitationStyles::valueOf(format.upcase))\n end\n #rescue any exceptions, if the error is not caught in JAR, most likely a \n #problem with the source format\n rescue Exception => e\n raise ArgumentError, \"Missing a source format. Use from_[format] first.\"\n end", "title": "" }, { "docid": "e666daefb9b2fe40d6e5d7759f7e13c9", "score": "0.5289995", "text": "def image_format\n ImageMeta.format_for_path(self)\n end", "title": "" }, { "docid": "6de7a96259985b1afe041f4b432d1ac5", "score": "0.5279735", "text": "def _process_format(format) # :nodoc:\n end", "title": "" }, { "docid": "1f65568e1715b8c5f0d6f940725c4f12", "score": "0.5279148", "text": "def with_format(new_format, &block)\n\n old_format = self.class.format\n\n begin\n self.class.format = new_format\n yield\n ensure\n self.class.format = old_format\n end\n end", "title": "" }, { "docid": "e5055cac992f245f6d724e44410eccc6", "score": "0.52699316", "text": "def with_format(format, &block)\n old_formats = formats\n self.formats = [format]\n content = block.call\n self.formats = old_formats\n content\n end", "title": "" }, { "docid": "23f2fa1a3ea9afaff57d8e4aad2d8c09", "score": "0.5269071", "text": "def with_format(format, &block)\n old_formats = formats\n self.formats = [format]\n block.call\n self.formats = old_formats\n nil\n end", "title": "" }, { "docid": "23f2fa1a3ea9afaff57d8e4aad2d8c09", "score": "0.5269071", "text": "def with_format(format, &block)\n old_formats = formats\n self.formats = [format]\n block.call\n self.formats = old_formats\n nil\n end", "title": "" }, { "docid": "23f2fa1a3ea9afaff57d8e4aad2d8c09", "score": "0.5269071", "text": "def with_format(format, &block)\n old_formats = formats\n self.formats = [format]\n block.call\n self.formats = old_formats\n nil\n end", "title": "" }, { "docid": "23f2fa1a3ea9afaff57d8e4aad2d8c09", "score": "0.5269071", "text": "def with_format(format, &block)\n old_formats = formats\n self.formats = [format]\n block.call\n self.formats = old_formats\n nil\n end", "title": "" }, { "docid": "23f2fa1a3ea9afaff57d8e4aad2d8c09", "score": "0.5269071", "text": "def with_format(format, &block)\n old_formats = formats\n self.formats = [format]\n block.call\n self.formats = old_formats\n nil\n end", "title": "" }, { "docid": "fd625afaa8678e3a992685c2b7978132", "score": "0.526772", "text": "def to_blob(fileformat='PNG')\n draw()\n return @base_image.to_blob do\n self.format = fileformat\n end\n end", "title": "" }, { "docid": "bc508ba7e2920a17e6c3e4f32fc696a5", "score": "0.52671766", "text": "def save(path, format=nil, quality=nil)\n ext = File.extname(path)[1..-1]\n if not format\n format = (ext and ext.downcase == 'png') ? 'png' : 'jpg'\n end\n\n output_path = path.sub(/\\.\\w+$/, '') + \".#{format}\"\n\n if format == 'jpg'\n writer = ::VIPS::JPEGWriter.new @image, :quality => (quality || 80)\n else\n writer = ::VIPS::PNGWriter.new @image\n end\n\n writer.write output_path\n\n # Reset the image so we can use it again\n @image = ::VIPS::Image.new @path\n\n output_path\n end", "title": "" }, { "docid": "b6f27ddfbf47e4937cc832d329f6b9fe", "score": "0.5266424", "text": "def encode(format, options = {})\n @canvas.format = format.to_s.upcase\n @canvas.to_blob\n end", "title": "" }, { "docid": "34d14546808e0da00ad23ec04f3a073c", "score": "0.5262144", "text": "def encode_png_image_pass_to_stream(stream, color_mode, bit_depth, filtering); end", "title": "" }, { "docid": "66925e71d87e0a54d984ab80a798f24f", "score": "0.5259095", "text": "def convert_to_jpeg input_file, output_file\n begin\n puts \"Opening temp file '#{input_file.path}'...\"\n imagick = MiniMagick::Image.open input_file.path\n if imagick.type == \"JPEG\"\n puts \"Skipping JPEG recompression. Image is already JPEG!\"\n imagick.write output_file.path\n return true\n end\n imagick.format \"jpeg\"\n imagick.quality 100\n imagick.write output_file.path\n puts \"Conversion to JPEG success...\"\n puts \"Wrote to #{output_file.path}...\"\n rescue\n puts \"Conversion to JPEG failed!!!\"\n return false\n end\n return true\n end", "title": "" }, { "docid": "bf61cc796be6047cb33a000492ceb9f8", "score": "0.52572966", "text": "def pixel_format=(pixel_format)\n return if pixel_format == @pixel_format\n @pixel_format = pixel_format\n teardown\n end", "title": "" }, { "docid": "ad8b23cf4697cc1059f3757cddf16875", "score": "0.52508897", "text": "def shrink_to_fit(width, height, quality, format)\n manipulate! do |image|\n img_width, img_height = image.dimensions\n\n image.format(format) do |img|\n if img_width > width || img_height > height\n ratio_width = img_width / width.to_f\n ratio_height = img_height / height.to_f\n\n if ratio_width >= ratio_height\n img.resize \"#{width}x#{(img_height / ratio_width).round}\"\n else\n img.resize \"#{(img_width / ratio_height).round}x#{height}\"\n end\n end\n\n img.quality(quality.to_s)\n image = yield(img) if block_given?\n end\n\n image\n end\n end", "title": "" }, { "docid": "94d871a5a3389649c21031d6ede3832b", "score": "0.5224131", "text": "def format\n Mrmagick::Capi.get_format(self)\n end", "title": "" }, { "docid": "f43334ba6ba93ee1c8e0508323b63964", "score": "0.5217208", "text": "def to_blob(fileformat='PNG')\n draw()\n return @base_image.to_blob do\n self.format = fileformat\n end\n end", "title": "" }, { "docid": "943bd81f0f3ccc135f177166d6a2a0f4", "score": "0.5211032", "text": "def image_formats\n [:jpeg]\n end", "title": "" }, { "docid": "7633c7d0ab606e5cb791933d3ca24f9c", "score": "0.51921517", "text": "def format(format = nil, &block)\n if format\n self.formats[:format] = block\n else\n self.formats.default_proc = block\n end\n end", "title": "" }, { "docid": "51872bb691452bb4cc04343b75ace309", "score": "0.51920915", "text": "def _process_format(format); end", "title": "" }, { "docid": "85e12c62c6d2871f2b4e4813f68b2f93", "score": "0.51871973", "text": "def formatType=(format)\n if $allFormats[format]\n @outputFormat = $allFormats[format].dup\n @outputType = format\n debug \"format switched to #{format}\"\n else\n displayWarning \"Attempted to select invalid format: #{format}\"\n return nil\n end\n end", "title": "" }, { "docid": "fd03c74614168919554656c76d9aa2eb", "score": "0.51833767", "text": "def process_image_convert\n icon.variant(resize: '100x100').processed\n end", "title": "" }, { "docid": "f481f2d5c259549fa32f47b962f1d51d", "score": "0.5168696", "text": "def convert(pdf, size, format)\n basename = File.basename(pdf, File.extname(pdf))\n subfolder = @sizes.length > 1 ? size.to_s : ''\n directory = File.join(@output, subfolder)\n FileUtils.mkdir_p(directory) unless File.exists?(directory)\n out_file = File.join(directory, \"#{basename}_%05d.#{format}\")\n cmd = \"gm convert +adjoin #{MEMORY_ARGS} #{DENSITY_ARG} #{resize_arg(size)} #{quality_arg(format)} \\\"#{pdf}#{pages_arg}\\\" \\\"#{out_file}\\\" 2>&1\"\n result = `#{cmd}`.chomp\n raise ExtractionFailed, result if $? != 0\n renumber_images(out_file, format)\n end", "title": "" }, { "docid": "711878c9afd2d6bcea892a9014267eaf", "score": "0.5142189", "text": "def default_render_format\n if convertible?\n Config.get(:image_output_format)\n else\n image_file_format\n end\n end", "title": "" }, { "docid": "e62e6583ac60b73e9bb3044618aeac87", "score": "0.5133668", "text": "def to_image(scale=1, density=300, format='JPEG', footer=nil, quality= 85)\n\n #Create a new collection of ImageMagick images...\n image_list = Magick::ImageList.new\n \n @images.each do |image_info|\n \n image = nil\n\n #Load each of the images into memory...\n self.class.quietly do\n image = Magick::Image.read(image_info[:path]) {self.density = density if density; self.quality = quality if quality }\n image = image.first\n end\n\n #... rotate the given image, so it's upright...\n image.rotate!(image_info[:rotation])\n\n #If a scale has been provided, use it.\n unless scale == 0 || scale == 1\n image.scale!(scale)\n end\n\n #and add it to our image list.\n image_list << image\n\n end\n\n #If a footer was provided, add it to the image.\n image_list << Magick::Image.read(footer).first unless footer.nil?\n\n #Merge all of the images in the list into a single, tall JPEG.\n image = image_list.append(true)\n image.format = format unless image.format.nil?\n\n #Destroy the original ImageList, freeing memory.\n image_list.destroy!\n\n #And return the image.\n image\n\n\n end", "title": "" }, { "docid": "6e06f7b1e0abc2b62dd5b8468b15b7d5", "score": "0.5131729", "text": "def compress_image(convert, quality)\n convert.quality \"#{quality}\" if quality\n convert << '-unsharp' << '0.25x0.25+8+0.065'\n convert << '-dither' << 'None'\n #convert << '-posterize' << '136' # posterize slows down imagamagick extremely in some env due to buggy libgomp1\n convert << '-define' << 'jpeg:fancy-upsampling=off'\n convert << '-define' << 'png:compression-filter=5'\n convert << '-define' << 'png:compression-level=9'\n convert << '-define' << 'png:compression-strategy=1'\n convert << '-define' << 'png:exclude-chunk=all'\n convert << '-interlace' << 'none'\n convert << '-colorspace' << 'sRGB'\n convert.strip\n end", "title": "" }, { "docid": "237e5ca83c6a06b01d22bcb4fc66a3a8", "score": "0.5119846", "text": "def transform(file, format: nil)\n ActiveSupport::Notifications.instrument(\"transform.active_storage\") do\n if processor\n image_processing_transform(file, format)\n else\n mini_magick_transform(file, format)\n end\n end\n end", "title": "" }, { "docid": "4cb83838f6e2441f2b3f47dd99eaada7", "score": "0.5115975", "text": "def with_format(format, &block)\n old_formats = formats\n self.formats = [format]\n result = block.call\n self.formats = old_formats\n result\nend", "title": "" }, { "docid": "4cb83838f6e2441f2b3f47dd99eaada7", "score": "0.5115975", "text": "def with_format(format, &block)\n old_formats = formats\n self.formats = [format]\n result = block.call\n self.formats = old_formats\n result\nend", "title": "" }, { "docid": "3edd6675c756b96de3b10f970e4e332c", "score": "0.5115954", "text": "def process_image(src_file)\n ext = File.extname(src_file).downcase[1..-1]\n ext = 'jpg' if ext == 'jpeg'\n\n unless Sup::LEGAL_EXTENSIONS.include? ext\n logger.error \"unsupported format: #{src_file}\"\n raise\n end\n\n # Get new id\n id = last_id\n begin\n id36 = (id += 1).to_s(36)\n end while Sup::BAD_IDS.include? id36\n logger.info \"-> new image id: #{id36} (#{id})\"\n\n # Generating image copy in alternative format\n format = jpg_png(ext)\n key = \"#{id36}.#{format}\"\n dst_file = File.join(@proc_dir, key)\n ensure_dir_exists(@proc_dir)\n unless convert(src_file, dst_file, @args[:quality])\n logger.error \"error converting source image\"\n return nil\n end\n\n # Using most compact format\n src_size = File.size(src_file)\n dst_size = File.size(dst_file)\n if src_size <= dst_size\n File.unlink(dst_file)\n format = ext\n key = \"#{id36}.#{format}\"\n dst_file = File.join(@proc_dir, key)\n FileUtils.copy_file(src_file, dst_file)\n end\n\n files = [[key, ext2ctype(format), dst_file]]\n\n # Some logging\n max_size = [dst_size, src_size].max\n gain = (Float(dst_size - src_size).abs / max_size * 100).round(1)\n logger.info \"#{format.upcase} is #{gain}% more compact\"\n width, height = dimensions(dst_file)\n size = [dst_size, src_size].min\n pretty_size = Filesize.from(\"#{size} B\").pretty\n logger.info \"image size: #{pretty_size} (#{width}x#{height})\"\n\n # Generate preview\n if @args[:preview]\n key = File.join(Sup::PREVIEW_DIR, \"#{id36}.#{format}\")\n dst_file = File.join(@proc_dir, key)\n files << [key, ext2ctype(format), dst_file]\n ensure_dir_exists(File.join(@proc_dir, Sup::PREVIEW_DIR))\n resize(src_file,\n dst_file,\n @args[:max_width],\n @args[:max_height],\n @args[:quality])\n preview_size = File.size(dst_file)\n pretty_size = Filesize.from(\"#{preview_size} B\").pretty\n preview_width, preview_height = dimensions(dst_file)\n logger.info \"preview size: #{pretty_size} \" +\n \"(#{preview_width}x#{preview_height})\"\n else\n preview_size, preview_width, preview_height = nil, nil, nil\n end\n\n # Generate metadata file\n if @args[:meta]\n key = File.join(Sup::META_DIR, \"#{id36}.json\")\n file_name = File.join(@proc_dir, key)\n files << [key, ext2ctype('json'), file_name]\n ensure_dir_exists(File.join(@proc_dir, Sup::META_DIR))\n File.write(file_name, JSON.dump({\n width: width,\n height: height,\n preview_width: preview_width,\n preview_height: preview_height,\n content_type: ext2ctype(format),\n size: size,\n preview_size: preview_size,\n timestamp: Time.now.utc.to_s\n }))\n end\n\n # Save new image id as last id\n File.write(id_file, id)\n\n return {\n :files => files,\n :url => URI.join(@base_url, \"#{id36}.#{format}\").to_s\n }\n end", "title": "" }, { "docid": "55b894a8b7abd6d86577976fd2f4a31f", "score": "0.50907683", "text": "def encoder format, options = {}\n CodeRay::Encoders[format].new options\n end", "title": "" }, { "docid": "b4b305cbd44604a4fb2024a822c4e65c", "score": "0.5065634", "text": "def image_file_format\n if !(image_file.original_filename =~ /\\.jpg\\Z/)\n errors.add(file_format_error, I18n.t('products.needs_jpeg_format')) # \" - The file needs to be in JPEG (.jpg) format.\"\n end\n end", "title": "" }, { "docid": "5284401564a5769c243a035048011257", "score": "0.506448", "text": "def quality_arg(format)\n case format.to_s\n when /jpe?g/ then \"-quality 85\"\n when /png/ then \"-quality 100\"\n else \"\"\n end\n end", "title": "" }, { "docid": "5ede4675d6fabba7d983aa49853185e4", "score": "0.5036734", "text": "def class_from_format format\n s = format.to_s\n s == \"image\" ? \"images\" : s\n end", "title": "" }, { "docid": "2385d2524fbc2eff691ac6988f1ee681", "score": "0.5026012", "text": "def convertible?\n Config.get(:image_output_format) &&\n Config.get(:image_output_format) != \"original\" &&\n has_convertible_format?\n end", "title": "" }, { "docid": "48cd0047d12c0f83fe3e5db01499817a", "score": "0.50254273", "text": "def send_image(img, format)\n content_type format.to_sym\n img\n end", "title": "" }, { "docid": "f4e2d448910c229ce88ad7c350de0894", "score": "0.501977", "text": "def convert(patterns, format = 'png', options = nil)\n Dir[*patterns].uniq.map do |f|\n filename = File.join(Dir.pwd, f)\n\n # I am verbose\n STDERR.puts filename\n\n `convert #{filename} #{options} #{format}:-`\n end.join(\"\\n\")\n end", "title": "" }, { "docid": "4b6fc0908b4d801f3443cbd922a5adbf", "score": "0.5007388", "text": "def process(file, format:); end", "title": "" }, { "docid": "e2d25b37188a0363a7d211f05d459193", "score": "0.50017333", "text": "def process(file, format:) # :doc:\n raise NotImplementedError\n end", "title": "" }, { "docid": "9ecac80a414ec9ec67eb048769108ccb", "score": "0.49978924", "text": "def transform\n is_irb = 'irb' == @format\n opts = {:css_class => nil,\n :inline_theme => @highlight_opts[:base16] ? Rouge::Themes::Base16.new : Rouge::Themes::Github.new,\n :line_numbers => @highlight_opts[:lineno]}\n\n if is_irb\n make_irb_string(opts)\n else\n make_formatted_string(opts)\n end\n end", "title": "" } ]
ef6afaf77ac97a643a8bcaa80174319b
Searches for a given string in the DOM tree. Use `getSearchResults` to access search results or `cancelSearch` to end this search session.
[ { "docid": "dd8693b027a1f477c462aceb974f7d55", "score": "0.0", "text": "def perform_search(query:, include_user_agent_shadow_dom: nil)\n {\n method: \"DOM.performSearch\",\n params: { query: query, includeUserAgentShadowDOM: include_user_agent_shadow_dom }.compact\n }\n end", "title": "" } ]
[ { "docid": "8a88b46ec241509964467a147da7db5b", "score": "0.70465994", "text": "def search(search_string)\n GoogleAjax::Search.web(search_string)[:results]\n end", "title": "" }, { "docid": "e19b54d744b9a98b743c4a39f7475bf9", "score": "0.6821071", "text": "def search(string, options = {})\n if (string.is_a?(Hash))\n options = string\n else\n options.merge!(:search => string)\n end\n\n options = merge_defaults(options)\n\n if options[:search].nil? || options[:search].empty?\n raise Lolbase::Exceptions::NoSearchString.new\n end\n\n if !valid_search_type?(options[:type])\n raise Lolbase::Exceptions::InvalidSearchType.new(options[:type])\n end\n\n options.merge!(:caching => false)\n\n data = post_html(@@search_url, options)\n\n results = []\n\n if (data)\n case options[:type]\n\n when 'characters'\n data.xpath('//div[@class=\"table\"]/table/tbody/tr').each do |char|\n results << Lolbase::Classes::SearchCharacter.new(char, self)\n end\n end\n end\n\n return results\n end", "title": "" }, { "docid": "3c436182db36145936466faee3d314be", "score": "0.6544386", "text": "def search(string, options = {})\n\t\t\tif (string.is_a?(Hash))\n\t\t\t\toptions = string\n\t\t\telse\n\t\t\t\toptions.merge!(:search => string)\n\t\t\tend\n\t\t\t\n\t\t\toptions = merge_defaults(options)\n\t\t\t\n\t\t\tif options[:search].nil? || options[:search].empty?\n\t\t\t\traise Wowr::Exceptions::NoSearchString.new\n\t\t\tend\n\t\t\t\n\t\t\tif !@@search_types.has_value?(options[:type])\n\t\t\t\traise Wowr::Exceptions::InvalidSearchType.new(options[:type])\n\t\t\tend\n\t\t\t\n\t\t\toptions.merge!(:caching => false)\n\t\t\toptions.delete(:realm) # all searches are across realms\n\t\t\t\t\t\t\n\t\t\txml = get_xml(@@search_url, options)\n\t\t\t\n\t\t\tresults = []\n\t\t\t\t\t\t\n\t\t\tif (xml) && (xml%'armorySearch') && (xml%'armorySearch'%'searchResults')\n\t\t\t\tcase options[:type]\n\t\t\t\t\t\n\t\t\t\t\twhen @@search_types[:item]\n\t\t\t\t\t\t(xml%'armorySearch'%'searchResults'%'items'/:item).each do |item|\n\t\t\t\t\t\t\tresults << Wowr::Classes::SearchItem.new(item)\n\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\twhen @@search_types[:character]\n\t\t\t\t\t\t(xml%'armorySearch'%'searchResults'%'characters'/:character).each do |char|\n\t\t\t\t\t\t\tresults << Wowr::Classes::SearchCharacter.new(char, self)\n\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\twhen @@search_types[:guild]\n\t\t\t\t\t\t(xml%'armorySearch'%'searchResults'%'guilds'/:guild).each do |guild|\n\t\t\t\t\t\t\tresults << Wowr::Classes::SearchGuild.new(guild)\n\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\twhen @@search_types[:arena_team]\n\t\t\t\t\t\t(xml%'armorySearch'%'searchResults'%'arenaTeams'/:arenaTeam).each do |team|\n\t\t\t\t\t\t\tresults << Wowr::Classes::SearchArenaTeam.new(team)\n\t\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\treturn results\n\t\tend", "title": "" }, { "docid": "3c436182db36145936466faee3d314be", "score": "0.6544386", "text": "def search(string, options = {})\n\t\t\tif (string.is_a?(Hash))\n\t\t\t\toptions = string\n\t\t\telse\n\t\t\t\toptions.merge!(:search => string)\n\t\t\tend\n\t\t\t\n\t\t\toptions = merge_defaults(options)\n\t\t\t\n\t\t\tif options[:search].nil? || options[:search].empty?\n\t\t\t\traise Wowr::Exceptions::NoSearchString.new\n\t\t\tend\n\t\t\t\n\t\t\tif !@@search_types.has_value?(options[:type])\n\t\t\t\traise Wowr::Exceptions::InvalidSearchType.new(options[:type])\n\t\t\tend\n\t\t\t\n\t\t\toptions.merge!(:caching => false)\n\t\t\toptions.delete(:realm) # all searches are across realms\n\t\t\t\t\t\t\n\t\t\txml = get_xml(@@search_url, options)\n\t\t\t\n\t\t\tresults = []\n\t\t\t\t\t\t\n\t\t\tif (xml) && (xml%'armorySearch') && (xml%'armorySearch'%'searchResults')\n\t\t\t\tcase options[:type]\n\t\t\t\t\t\n\t\t\t\t\twhen @@search_types[:item]\n\t\t\t\t\t\t(xml%'armorySearch'%'searchResults'%'items'/:item).each do |item|\n\t\t\t\t\t\t\tresults << Wowr::Classes::SearchItem.new(item)\n\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\twhen @@search_types[:character]\n\t\t\t\t\t\t(xml%'armorySearch'%'searchResults'%'characters'/:character).each do |char|\n\t\t\t\t\t\t\tresults << Wowr::Classes::SearchCharacter.new(char, self)\n\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\twhen @@search_types[:guild]\n\t\t\t\t\t\t(xml%'armorySearch'%'searchResults'%'guilds'/:guild).each do |guild|\n\t\t\t\t\t\t\tresults << Wowr::Classes::SearchGuild.new(guild)\n\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\twhen @@search_types[:arena_team]\n\t\t\t\t\t\t(xml%'armorySearch'%'searchResults'%'arenaTeams'/:arenaTeam).each do |team|\n\t\t\t\t\t\t\tresults << Wowr::Classes::SearchArenaTeam.new(team)\n\t\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\treturn results\n\t\tend", "title": "" }, { "docid": "fc38713aa25949f6588eba9597e7e3b7", "score": "0.6510938", "text": "def search(search_string)\n queue=search_string.split '/'\n current_term=queue.shift\n return [self] if current_term.nil? #If for some reason nothing is given in the search string\n matches=[]\n if current_term=='*'\n\t\t\t\tnew_matches=self.children.values\n\t\t\t\tnew_matches.sort! {|a, b| a.node_name <=> b.node_name} rescue nil #is this evil?\n matches.concat new_matches\n elsif current_term[/\\d+/]==current_term\n matches << @children[current_term.to_i]\n else\n matches << @children[current_term.to_sym]\n end\n if queue.empty?\n return matches.flatten.compact\n else\n return matches.collect {|match| match.search(queue.join('/'))}.flatten.compact\n end\n end", "title": "" }, { "docid": "2f8f2200054c86037c2b00a78086286b", "score": "0.63649404", "text": "def search(value)\n return @searchMethods.searchAtTree(value, @root)\n end", "title": "" }, { "docid": "aea7de24a7668d11e4a1968c9e163af5", "score": "0.6345713", "text": "def search(*args)\n search_internal([\"SEARCH\"], *args)\n end", "title": "" }, { "docid": "a622cfa081f55926b766b7e46f73f932", "score": "0.633877", "text": "def search(text)\n # If current state set to RUUNING, call cancel method\n cancel if @@state == RUNNING\n\n # Set current state to RUNNING\n @@state = RUNNING\n\n # Perform the search\n found = []\n filter = Regexp.new(text, Regexp::IGNORECASE, 'n')\n\t\t \n\t\t $gtk2driver.module_tree.refresh(filter)\n\t\t $gtk2driver.module_tree.expand\n end", "title": "" }, { "docid": "f9ba4278506d586f8769d455ed41d614", "score": "0.6280367", "text": "def search(plaintext)\n call(:search, :plaintext => plaintext)[:search_response][:return]\n end", "title": "" }, { "docid": "939d62d1bc0bd6ecb188202a3cb608ef", "score": "0.6214666", "text": "def search(search_string)\n\n # Convert to a get-paramenter\n search_string = CGI.escapeHTML search_string\n search_string.gsub!(\" \", \"&nbsp;\")\n\n results = []\n \n return results\n end", "title": "" }, { "docid": "9fa509a8660861be485236aafa6331e0", "score": "0.61886305", "text": "def search(*args)\n search_provider.search(*args)\n end", "title": "" }, { "docid": "eb7db03acd779f5d7eeba8da75e41deb", "score": "0.61068887", "text": "def search\n if Config[\"ISEARCH\"]\n incremental_search\n else\n str = getstr('/')\n do_search NEXT, str\n end\n end", "title": "" }, { "docid": "a482e2112a405ed5ce6c4b37d78feea2", "score": "0.61034566", "text": "def search(string)\n sleep 1\n search_input_element.when_visible Utils.short_wait\n self.search_input = string\n search_input_element.send_keys :enter\n wait_for_spinner\n end", "title": "" }, { "docid": "b44597a43956f3f6137f72d919407430", "score": "0.60550773", "text": "def search_for(search_term)\n driver = get_driver\n search = driver.find_element(elements[:search])\n\n search.send_keys(search_term)\n search.send_keys(:enter)\n end", "title": "" }, { "docid": "5fd2c30998798662b2fd2cc426ac1c98", "score": "0.60524094", "text": "def search_for(text: '')\n search_field.set(text)\n search_button.click\n end", "title": "" }, { "docid": "37a32e98587e670b94e77c3cc56da854", "score": "0.60239065", "text": "def search(xpath, &proc)\n @doc.search(xpath, &proc)\n end", "title": "" }, { "docid": "2581aa1a0e7fbba4ff7ccc43d6d1c6f4", "score": "0.5998312", "text": "def search(node, qry)\n node.search(qry)\n end", "title": "" }, { "docid": "c12a353400985be97f0ceaa7343abedd", "score": "0.593322", "text": "def do_search(term = nil)\n @terms = term unless term.nil? #replace saved term with argument, if passed\n @attempts += 1\n @doc = Nokogiri::XML(open(build_call(@terms)))\n parse\n end", "title": "" }, { "docid": "fe57b3b27bc44d89d0155178d16ad020", "score": "0.5932785", "text": "def search_for(search_term)\n type_into TestElements.search_box, search_term\n type_into TestElements.search_box, :return\n end", "title": "" }, { "docid": "b978f5bea900416f136664ecc3af07c3", "score": "0.5912497", "text": "def search_for_text(text)\n fail \"INTERNAL ERROR: In method call to 'search_for_text' no text was entered\" if text == nil\n self.search_text = text\n submit_search\n if Capybara.current_session.current_url.include? SEARCH_RESULTS_URL_IDENTIFIER\n return SearchResultsPage.new(@page,@country)\n elsif Capybara.current_session.current_url.include? SEARCH_NO_RESULTS_URL_IDENTIFIER\n return SearchNoResultsPage.new(@page,@country)\n else\n fail \"ERROR: Product Search for '#{text}' did not return the URL for either the 'SearchResults' or the 'SearchNoResults' page\"\n end\n end", "title": "" }, { "docid": "343a5f76adf934c8a8120db7911ae87c", "score": "0.5909051", "text": "def search(term)\n raise NoSearchTermException, \"No search term specified\" if term.nil?\n connection do\n client.search(term)\n end \n end", "title": "" }, { "docid": "11a6964359e4ae6ea3583284c7dd17a6", "score": "0.5806088", "text": "def search(*args)\n return \"No XML\" if !@ndoc\n @ndoc.search(*args)\n end", "title": "" }, { "docid": "a248b1d844d0ba827d212c5782b8acc9", "score": "0.5803154", "text": "def at(search_string)\n self.search(search_string).first\n end", "title": "" }, { "docid": "b203aaee16ac032773a6a9d98500d930", "score": "0.5774999", "text": "def text_search (string,text)\n\tif !$browser.text.include? string \n\t\tputs \"Error: #{text} not found\"\n\tend\nend", "title": "" }, { "docid": "1feded1770079705bd784067abb9ddff", "score": "0.5771837", "text": "def search_for_term(term)\n self.search_field = term\n self.search\n wait_for_ajax\n end", "title": "" }, { "docid": "0a5b3994c780c9d878b2b4ef40e3b771", "score": "0.57713205", "text": "def search(term=nil, options={})\n options.to_options!\n params = {}\n params[:'max-result'] = options[:max_result] || 1\n params[:'start-index'] = options[:start_index]\n term = options[:term] || term\n params.reject! { |k,v| !v }\n response = request \"artist/search?#{term.to_query('term')}&#{params.to_param}\"\n parse_many response.read\n end", "title": "" }, { "docid": "067367730389c1c526936308c2d74ec9", "score": "0.57641214", "text": "def search(**args)\n params = parameters(args) do\n required_params :term\n optional_params :term, :item_type, :start, :limit, :exact_match\n end\n request(:get, 'searchResults', params)\n end", "title": "" }, { "docid": "b56edd78d04c58eeb1957018a0d2e559", "score": "0.57554585", "text": "def search_for(*args, &block)\n __elasticsearch__.search(*args, &block)\n end", "title": "" }, { "docid": "c77bec7ef0fcb2ec459ad5a09bfedb2e", "score": "0.57454383", "text": "def search(one_or_all, search_str, escape_char=nil, *paths)\n json_op(:search, self, one_or_all.to_s, search_str, escape_char, *paths)\n end", "title": "" }, { "docid": "831a10cd3910ee517a041a0e232bcdc5", "score": "0.572752", "text": "def search(query)\n @search_svc.search query\n end", "title": "" }, { "docid": "7c2e1261610064a5e9e102ab618091e9", "score": "0.5725145", "text": "def search\n engine = BentoSearch.get_engine(params[:engine_id])\n # put it in an iVar mainly for testing purposes.\n @engine = engine\n\n\n unless engine.configuration.allow_routable_results == true\n raise AccessDenied.new(\"engine needs to be registered with :allow_routable_results => true\")\n end\n\n @results = engine.search safe_search_args(engine, params)\n # template name of a partial with 'yield' to use to wrap the results\n @partial_wrapper = @results.display_configuration.lookup!(\"ajax.wrapper_template\")\n\n # partial HTML results\n render \"bento_search/search/search\", :layout => false\n\n end", "title": "" }, { "docid": "3aa470c24e5d9e8f09b9c0e0179c9cbf", "score": "0.5697594", "text": "def search(string, options = {})\n \n\t\t\tif (string.is_a?(Hash))\n\t\t\t\toptions = string\n\t\t\telse\n\t\t\t\toptions.merge!(:search => string)\n\t\t\tend\n\n options = merge_defaults(options)\n\n\t\t\tif options[:search].nil? || options[:search].empty?\n\t\t\t\traise \"no search string\"\n\t\t\tend\n\n\t\t\tif !@@search_types.has_value?(options[:type])\n\t\t\t\traise \"invalid search type\"\n\t\t\tend\n\n results = []\n\n case options[:type]\n when @@search_types[:character]\n url = self.base_url + @@requester_file\n character_names = Net::HTTP.post_form(URI.parse(url), {\"f\"=>\"autocompleteNicks\", \"nickname\"=>\"#{options[:search]}\"})\n character_names = character_names.body.split('\"')\n character_names.each_index do |d|\n if character_names[d].include?(\";\")\n character_names.delete_at(d)\n end\n end\n character_names.delete_at(0)\n\n character_names.each do |character|\n sheet = self.get_character(character)\n if sheet.account.id > 0\n results << self.get_character(character)\n end\n end\n end\n\n return results\n \n end", "title": "" }, { "docid": "ba73ca82f12bdba35c1ea104ffbdb493", "score": "0.56925356", "text": "def search(search, admin)\n if !search.blank?\n @results = []\n if !search.strip.include? \" \"\n @results = self.search_keyword(search, admin)\n else\n @results = self.search_phrase(search, admin)\n end\n end\n end", "title": "" }, { "docid": "ccbd01f93ad672487764dacd4a3aa49d", "score": "0.5686465", "text": "def search!(\n query, case_sensitive: false, whole_sentence: true,\n limit: 10, skip: 0, sentence_limit: 80\n )\n results = search(\n query,\n case_sensitive: case_sensitive,\n whole_sentence: whole_sentence,\n limit: limit,\n skip: skip\n )\n\n results.each do |doc|\n doc.search!(\n query,\n case_sensitive: case_sensitive,\n whole_sentence: whole_sentence,\n sentence_limit: sentence_limit\n )\n yield(doc) if block_given?\n end\n\n results\n end", "title": "" }, { "docid": "16bf24f876e53ab4d4d63797a59deef5", "score": "0.5684011", "text": "def search_string\n @search_string\n end", "title": "" }, { "docid": "333bc6ad06317c160e00d66fb243beb2", "score": "0.56801975", "text": "def search(term)\n raise \"Must be overridden\"\n end", "title": "" }, { "docid": "6b95cb022c11c78023d7fc4cb329cd66", "score": "0.56779647", "text": "def search(key, namespaces=nil, limit=@options[:limit], max_results=@options[:max_results])\n titles = []\n offset = 0\n in_progress = true\n\n form_data = { 'action' => 'query',\n 'list' => 'search',\n 'srwhat' => 'text',\n 'srsearch' => key,\n 'srlimit' => limit\n }\n if namespaces\n namespaces = [ namespaces ] unless namespaces.kind_of? Array\n form_data['srnamespace'] = namespaces.map! do |ns| namespaces_by_prefix[ns] end.join('|')\n end\n begin\n form_data['sroffset'] = offset if offset\n form_data['srlimit'] = [limit, max_results - offset.to_i].min\n res, offset = make_api_request(form_data, '//query-continue/search/@sroffset')\n titles += REXML::XPath.match(res, \"//p\").map { |x| x.attributes[\"title\"] }\n end while offset && offset.to_i < max_results.to_i\n titles\n end", "title": "" }, { "docid": "db13f872d89fe75a64bbc86caa0b02b2", "score": "0.5670036", "text": "def search_results search\n search = normalize search\n @searches[search.to_s]\n end", "title": "" }, { "docid": "2ca7349f160649c20f74e853516d819c", "score": "0.56617045", "text": "def search_for(_spec)\n raise NotImplementedError, not_implemented_msg(:search_for)\n end", "title": "" }, { "docid": "3d8415d953ea705d4e043cb2daf24193", "score": "0.5652983", "text": "def search\n check_throttle_limits\n @search ||= Savon.client(\n wsdl: SEARCH_WSDL,\n headers: { 'Cookie' => \"SID=\\\"#{session_id}\\\"\", 'SOAPAction' => '' },\n env_namespace: :soapenv,\n logger:,\n log: true,\n log_level: @log_level,\n pretty_print_xml: true\n )\n rescue Savon::SOAPFault => e\n # this may occur if the session identifier timed out and we didn't catch it, this allows us to request\n # a new session identifier and try the API call again\n # see https://github.com/sul-dlss/sul_pub/wiki/Web-of-Sciences-Expanded-API-Throttle-Limits for known API limits\n # the number of queries per session should already be accounted for, but not the time out limit\n raise e unless e.message.include? 'There is a problem with your session identifier (SID)'\n\n session_close\n retry\n end", "title": "" }, { "docid": "39d67705b9d446c9245c003784ecf6de", "score": "0.56344366", "text": "def search_for(value)\n search_element.send_keys(value)\n submit_element.click\n end", "title": "" }, { "docid": "63a4e9140092812b3a0bdef093809d21", "score": "0.56324744", "text": "def get_search_results\n\t\twait_until_page_loads\n\t\[email protected]_elements(@locs[:results_item])\n\tend", "title": "" }, { "docid": "8691b0acacd40eb6992324cba6c9e59d", "score": "0.5611805", "text": "def search(term=nil, options={})\n options.to_options!\n params = {}\n params[:'max-result'] = options[:max_result] || 1\n params[:'start-index'] = options[:start_index]\n term = options[:term] || term\n params.reject! { |k,v| !v }\n response = request \"video/search?#{term.to_query('term')}&#{params.to_param}\"\n parse_many response.read\n end", "title": "" }, { "docid": "ceb6735678dfb860e54516ff89d2fae7", "score": "0.56095344", "text": "def search\n @users = User.search(@search_term)\n @tweets = Tweet.search(@search_term)\n @tags = Tag.search(@search_term)\n end", "title": "" }, { "docid": "cfbc48ac4e250444a57ce3b0899d9c9c", "score": "0.5606242", "text": "def search(query, options={})\n self.perform_get(\"/search\", {\n :q => query\n }.merge(options|| {}))\n end", "title": "" }, { "docid": "e7116f37ae83062dc0b0ae6c78e4e9a6", "score": "0.5604906", "text": "def search(path)\n self.find_by_xpath(path)\n end", "title": "" }, { "docid": "7902e1619613bd5103798ec494c3005b", "score": "0.5601358", "text": "def search(index, query, options = {})\n raise NotImplementedError, 'Search has not been implemented'\n end", "title": "" }, { "docid": "5f4a3156bdbc4793b6a99af7e33d25d6", "score": "0.5600446", "text": "def searches(ast)\n ast.xpath(\"//fcall/ident[@value = 'search']\")\n end", "title": "" }, { "docid": "5f4a3156bdbc4793b6a99af7e33d25d6", "score": "0.5600446", "text": "def searches(ast)\n ast.xpath(\"//fcall/ident[@value = 'search']\")\n end", "title": "" }, { "docid": "38fe547a94fe6f2b4278c3d480426c9a", "score": "0.55905443", "text": "def do_search(results, term, options)\n wait\n \n esearch_url = expand_uri(@uri_template, options.merge({:term => term}))\n doc = Nokogiri::XML( open esearch_url )\n\n results.count = doc.xpath('/eSearchResult/Count').first.content.to_i\n \n doc.xpath('/eSearchResult/IdList/Id').each {|n| results.pmids << n.content.to_i}\n \n doc.xpath('/eSearchResult/TranslationStack/TermSet/Term').each do |n|\n if n.content =~ /\"(.*)\"\\[MeSH Terms\\]/\n results.exploded_mesh_terms << $1\n end\n end\n \n doc.xpath('/eSearchResult/ErrorList/PhraseNotFound').each {|n| results.phrases_not_found << n.content }\n\n results\n end", "title": "" }, { "docid": "0c97e297697ea198973068f79619a652", "score": "0.5585788", "text": "def search(word)\n Parser.new(query(word)).parse\n end", "title": "" }, { "docid": "63575f9206e6fd8844c6ee4770ed4e55", "score": "0.55854213", "text": "def apply_search(results:)\n return results unless search_params.present?\n\n terms = search_params[:search_words] || ''\n return results unless terms.present?\n\n results.search(term: terms)\n end", "title": "" }, { "docid": "67cd25375cc138c2d4d2024d521ab74d", "score": "0.556982", "text": "def search(criteria)\n api_paginated_response(api_get(\"#{PATH}/search\", criteria))\n end", "title": "" }, { "docid": "2bc3c45345b9322f0680eae2f180ae2a", "score": "0.5568817", "text": "def verify_search_results(search_string)\n search_results_element.when_visible\n search_results_element.div_elements(:class => 'rc').each do |search_result|\n expect search_result.text.downcase.should include search_string\n end\n end", "title": "" }, { "docid": "db247d341d6b2904752c47780107f2d8", "score": "0.5562586", "text": "def search(path, options={})\n $LEDGER.search(path, options)\n end", "title": "" }, { "docid": "c66dafa2bdce37787d7e578fdae46aa9", "score": "0.55598176", "text": "def _rl_nsearch_dosearch(cxt)\r\n @rl_mark = cxt.save_mark\r\n\r\n # If rl_point == 0, we want to re-use the previous search string and\r\n # start from the saved history position. If there's no previous search\r\n # string, punt.\r\n if (@rl_point == 0)\r\n if @noninc_search_string.nil?\r\n rl_ding()\r\n rl_restore_prompt()\r\n rl_unsetstate(RL_STATE_NSEARCH)\r\n return -1\r\n end\r\n else\r\n # We want to start the search from the current history position.\r\n @noninc_history_pos = cxt.save_line\r\n @noninc_search_string = @rl_line_buffer.dup\r\n\r\n # If we don't want the subsequent undo list generated by the search\r\n #matching a history line to include the contents of the search string,\r\n #we need to clear rl_line_buffer here. For now, we just clear the\r\n #undo list generated by reading the search string. (If the search\r\n #fails, the old undo list will be restored by rl_maybe_unsave_line.)\r\n rl_free_undo_list()\r\n end\r\n\r\n rl_restore_prompt()\r\n noninc_dosearch(@noninc_search_string, cxt.direction)\r\n end", "title": "" }, { "docid": "aab18172a55da029b9a8738292e2d8f7", "score": "0.55408525", "text": "def search=(value)\n @search = value\n end", "title": "" }, { "docid": "7a27a6dbae406714d60bec35a06f4fd6", "score": "0.5530393", "text": "def search(text)\n normal\n type \"/#{text}<CR>\"\n end", "title": "" }, { "docid": "990588cedf6625fba5addb607befe667", "score": "0.55248386", "text": "def search(params={})\n rpc_call :search, params\n end", "title": "" }, { "docid": "633862ca1825a105d3fa07b258dcb3b9", "score": "0.55218977", "text": "def do_search\n @search_text = params[:q]\n\n # Doctoring for the view to find matches:\n @q = @search_text\n @q.chop! if params[:q] =~ /\\*$/\n @q = @q[1..-1] if params[:q] =~ /^\\*/\n\n # TODO: we'll want some whitelist filtering here later:\n # params[:q] = \"#{@q}*\" unless params[:q] =~ /\\*$/ or params[:q] =~ /^[-+]/ or params[:q] =~ /\\s/\n params[:q] = I18n.transliterate(params[:q]).downcase\n\n # TODO: This search suggestions block is large; extract.\n\n # First step (and, yes, this will be slow—we will optimize later), look for\n # search suggestions that match the query:\n words = params[:q].split # TODO: we might want to remove words with ^-\n # TODO: we might also want to remove stopwords e.g.: https://github.com/brenes/stopwords-filter\n suggestions = []\n # YUCK! This is the best way to do this in Searchkick at the moment, though.\n # :S\n words.each do |word|\n word_search = SearchSuggestion.search(word, fields: [{ match: :exact }])\n suggestions += word_search.results if word_search.respond_to?(:results)\n end\n\n # If we only found one thing and they only asked for one thing:\n if suggestions.size == 1 && params[:q] !~ /\\s/\n Rails.logger.warn(\"One suggestion.\")\n # TODO: move this to a helper? It can't go on the model...\n suggestion = suggestions.first\n suggestion = suggestion.synonym_of if suggestion.synonym_of\n where = case suggestion.type\n when :page\n suggestion.page\n when :object_term\n term_records_path(uri: suggestion.object_term, object: true)\n when :path\n suggestion.path\n when :wkt_string\n flash[:notice] = \"Unimplemented, sorry.\"\n \"/\"\n end\n return redirect_to(where)\n elsif suggestions.size >= 2 && params[:q] =~ /\\s/\n Rails.logger.warn(\"Multiple suggestions.\")\n groups = suggestions.group_by(&:type)\n # Easier to handle:\n groups[:page] ||= []\n groups[:object_term] ||= []\n groups[:path] ||= []\n groups[:wkt_string] ||= []\n if groups[:page].size > 1\n Rails.logger.warn(\"Multiple PAGE suggestions.\")\n # We can't use suggestions if there's more than one species. Sorry.\n flash[:notice] = t(\"search.flash.more_than_one_species\",\n species: groups[:page].map(&:match).to_sentence)\n else\n Rails.logger.warn(\"0 or 1 Page suggestions.\")\n clade = groups[:page].try(:first).try(:page_id)\n Rails.logger.warn(\"Page suggestion: #{clade}\") if clade\n if groups[:object_term].size > 2\n Rails.logger.warn(\"Over two TERM suggestions.\")\n flash[:notice] = t(\"search.flash.more_than_two_terms\",\n terms: groups[:object_term].map(&:match).to_sentence)\n elsif groups[:path].size > 0\n Rails.logger.warn(\"...had PATH suggestions.\")\n flash[:notice] = t(\"search.flash.cannot_combine_paths\",\n path: groups[:path].map(&:match).to_sentence)\n else # NOTE: this assumes we only have OBJECT term suggestions, not predicates.\n Rails.logger.warn(\"Usable suggestions...\")\n (first, second) = groups[:object_term] # Arbitrary which is first...\n Rails.logger.warn(\"First term: #{first.object_term}\")\n Rails.logger.warn(\"Second term: #{second.object_term}\") if second\n return redirect_to(term_records_path(uri: first.object_term, object: true,\n and_object: second.try(:object_term), clade: clade))\n end\n end\n end\n\n @clade = if params[:clade]\n puts \"*\" * 100\n puts \"** Filtering by clade #{params[:clade]}\"\n # It doesn't make sense to filter some things by clade:\n params[:only] = if params[:only]\n Array(params[:only]) - [:collections, :users, :predicates, :object_terms]\n else\n [:pages, :media]\n end\n puts \"Only param should now be: #{params[:only]}\"\n Page.find(params[:clade])\n else\n nil\n end\n\n default = params.has_key?(:only)? false : true\n @types = {}\n [ :pages, :collections, :articles, :images, :videos, :videos, :sounds, :links, :users, :predicates, :object_terms ].\n each do |sym|\n @types[sym] = default\n end\n\n @types[params[:only].to_sym] = true if params.has_key?(:only)\n\n # if params.has_key?(:only)\n # Array(params[:only]).each { |type| @types[type.to_sym] = true }\n # elsif params.has_key?(:except)\n # Array(params[:except]).each { |type| @types[type.to_sym] = false }\n # end\n\n # NOTE: no search is performed unless the @types hash indicates a search for\n # that class is required:\n\n @pages = if @types[:pages]\n fields = %w[preferred_vernacular_strings^20 vernacular_strings^20 preferred_scientific_names^10 scientific_name^10 synonyms^10 providers resource_pks]\n match = words.size == 1 ? :text_start : :phrase\n basic_search(Page, boost_by: [:page_richness, :specificity, :depth], match: match, fields: fields,\n where: @clade ? { ancestry_ids: @clade.id } : nil,\n includes: [:preferred_vernaculars, :medium, { native_node: { node_ancestors: :ancestor } }])\n else\n nil\n end\n\n\n @collections = if @types[:collections]\n basic_search(Collection, fields: [\"name^5\", \"description\"])\n else\n nil\n end\n\n @articles = if @types[:articles]\n basic_search(Searchkick,\n fields: [\"name^5\", \"resource_pk^10\", \"owner\", \"description^2\"],\n where: @clade ? { ancestry_ids: @clade.id } : nil,\n index_name: [Article])\n else\n nil\n end\n\n @images = if @types[:images]\n media_search(\"image\")\n else\n nil\n end\n\n @videos = if @types[:videos]\n media_search(\"video\")\n else\n nil\n end\n\n @sounds = if @types[:sounds]\n media_search(\"sound\")\n else\n nil\n end\n\n # @links = if @types[:links]\n # basic_search(Searchkick,\n # fields: [\"name^5\", \"resource_pk^10\", \"owner\", \"description^2\"],\n # where: @clade ? { ancestry_ids: @clade.id } : nil,\n # index_name: [Link])\n # else\n # nil\n # end\n\n @users = if @types[:users]\n basic_search(User, fields: [\"username^6\", \"name^4\", \"tag_line\", \"bio^2\"])\n else\n nil\n end\n\n Searchkick.multi_search([@pages, @articles, @images, @videos, @sounds, @collections, @users].compact)\n\n @pages = PageSearchDecorator.decorate_collection(@pages) if @pages\n @articles = ArticleSearchDecorator.decorate_collection(@articles) if @articles\n @images = ImageSearchDecorator.decorate_collection(@images) if @images\n @videos = VideoSearchDecorator.decorate_collection(@videos) if @videos\n @sounds = SoundSearchDecorator.decorate_collection(@sounds) if @sounds\n @collections = CollectionSearchDecorator.decorate_collection(@collections) if @collections\n @users = UserSearchDecorator.decorate_collection(@users) if @users\n\n # if @types[:predicates]\n # @predicates_count = TraitBank.count_predicate_terms(@q)\n # # NOTE we use @q here because it has no wildcard.\n # @predicates = Kaminari.paginate_array(\n # TraitBank.search_predicate_terms(@q, params[:page], params[:per_page]),\n # total_count: @predicates_count\n # ).page(params[:page]).per(params[:per_page] || 50)\n # end\n #\n # if @types[:object_terms]\n # @object_terms_count = TraitBank.count_object_terms(@q)\n # # NOTE we use @q here because it has no wildcard.\n # @object_terms = Kaminari.paginate_array(\n # TraitBank.search_object_terms(@q, params[:page], params[:per_page]),\n # total_count: @object_terms_count\n # ).page(params[:page]).per(params[:per_page] || 50)\n # end\n\n respond_to do |fmt|\n fmt.html do\n @page_title = t(:page_title_search, query: @q)\n end\n\n fmt.js { }\n\n # TODO: JSON results for other types! TODO: move; this is view logic...\n fmt.json do\n render json: JSON.pretty_generate(@pages.results.as_json(\n except: :native_node_id,\n methods: :scientific_name,\n include: {\n preferred_vernaculars: { only: [:string],\n include: { language: { only: :code } } },\n # NOTE I'm excluding a lot more for search than you would want for\n # the basic page json:\n top_media: { only: [ :id, :guid, :owner, :name ],\n methods: [:small_icon_url, :medium_icon_url],\n include: { provider: { only: [:id, :name] },\n license: { only: [:id, :name, :icon_url] } } }\n }\n ))\n end\n end\n end", "title": "" }, { "docid": "8bba0c8669a16e14a9446189b9aca1ec", "score": "0.5520607", "text": "def search\n return Fast.debug(&method(:execute_search)) if debug_mode?\n\n execute_search do |file, results|\n results.each do |result|\n binding.pry if @pry # rubocop:disable Lint/Debugger\n report(file, result)\n end\n end\n end", "title": "" }, { "docid": "f4a4a086c44f190e12cc48b02b9d8f98", "score": "0.551679", "text": "def search(string)\n if not @open\n raise Exception, \"The library is not open.\", caller\n elsif string.empty? || string.length < 4\n output = \"Search string must contain at least four characters.\"\n else\n results = @books.select { |k,book| \n (book.get_title().downcase.include?(string.downcase) || book.get_author().downcase.include?(string.downcase)) && book.get_due_date() == nil\n }\n\n if results.count > 0\n output = \"\"\n # make sure it only returns unique results\n results.to_a.uniq { |k,b| \n b.get_author() && b.get_title() \n }.each { |k,b| output = output + \"#{b.to_s}\\n\" }\n else\n output = \"No books found.\"\n end\n end\n output\n end", "title": "" }, { "docid": "31bab2c7bbc2057a4eba7ca80021447e", "score": "0.5486633", "text": "def handle_search(query)\n @results = search query unless query.empty?\n\n prompt_for_selection(query)\nend", "title": "" }, { "docid": "d9ae9bfe8d4ce25235513d08d7ea1d2c", "score": "0.547962", "text": "def set_SearchString(value)\n set_input(\"SearchString\", value)\n end", "title": "" }, { "docid": "f683bd54cfbeb88f5fcc68d409e90e07", "score": "0.5479574", "text": "def search(word)\n \n end", "title": "" }, { "docid": "54a4a6b196932c78042ce0073feea55d", "score": "0.5479008", "text": "def search(keyword)\n $logger.info(\"HomePage: search for #{keyword}\")\n search_field.send_keys keyword\n search_field.submit\n FreelancerSearchResultsPage.new(@driver, $logger)\n end", "title": "" }, { "docid": "9a7a247f4e588891830361e69e8d1559", "score": "0.5478729", "text": "def search_for(options = {})\n search_scopes.search_for(options)\n end", "title": "" }, { "docid": "d9ae9bfe8d4ce25235513d08d7ea1d2c", "score": "0.5478417", "text": "def set_SearchString(value)\n set_input(\"SearchString\", value)\n end", "title": "" }, { "docid": "dcabff544a0019b7287bc53e75af4609", "score": "0.5462108", "text": "def search_by_name\n puts 'Enter a name to search for'\n lookup_name = gets.chomp\n result = @search.name(lookup_name)\n puts \"\\n#{formatted_search_result(result)}\"\n rescue EntryNotFoundError => e\n puts e.message\n end", "title": "" }, { "docid": "a7d41e1ed6629e121562a58352fbf62d", "score": "0.54611933", "text": "def search index:, query_string: nil, query: nil, sort: nil\n if query_string\n log.info \"Searching elastic search for #{query_string} on #{index}\"\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_search?q=#{query_string}&sort=#{sort}\")\n req = Net::HTTP::Post.new(uri)\n else\n log.debug \"Searching elastic search index #{index} for body #{query}\"\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_search\")\n req = Net::HTTP::Post.new(uri)\n req.body = query.is_a?(String) ? query : query.to_json\n end\n\n run(uri, req)\n end", "title": "" }, { "docid": "412fe64d550d8e912d01f25fc4d960cc", "score": "0.54486966", "text": "def osops_search(\n search_string, # recipe or role name\n one_or_all=:one,# return first node found or a list of nodes?\n # if set to :all a list will be returned\n # even if only one node is found.\n include_me=true,# include self in results\n order=[:role, :recipe], # if only one item is to be returned and\n # there are results from both the role\n # search and the recipe search, pick the\n # first item from the list specified here.%\n # must be :recipe or :role\n safe_deref=nil, # if nil, return node(s), else return\n # rcb_safe_deref(node,safe_deref)\n current_node=nil,\n options = {}\n )\n\n # Next refactor, move options to first/only param\n # Passing options from other methods to override search params\n options = {\n :search_string => search_string,\n :one_or_all => one_or_all,\n :include_me => include_me,\n :order => order,\n :safe_deref => safe_deref,\n :current_node => current_node\n }.merge(options)\n\n search_string = options[:search_string]\n one_or_all = options[:one_or_all]\n include_me = options[:include_me]\n order = options[:order]\n safe_deref = options[:safe_deref]\n current_node = options[:current_node]\n\n debug(\"Osops_search: search_string:#{search_string}, one_or_all:#{one_or_all},\"\\\n + \"include_me:#{include_me}, order:#{order}, safe_deref:#{safe_deref}\")\n results = {\n :recipe => [],\n :role => [],\n :tag => []\n }\n\n current_node ||= node\n\n for query_type in order\n if include_me and current_node[\"#{query_type}s\"].include? search_string\n debug(\"node #{current_node} contains #{query_type} #{search_string}, so adding node to results\")\n results[query_type] << current_node\n break if one_or_all == :one # skip expensive searches if unnecessary\n end\n\n search_string.gsub!(/::/, \"\\\\:\\\\:\")\n query = \"#{query_type}s:#{search_string} AND chef_environment:#{current_node.chef_environment}\"\n debug(\"osops_search query: #{query}\")\n result, _, _ = Chef::Search::Query.new.search(:node, query)\n results[query_type].push(*result)\n break if one_or_all == :one and results.values.map(&:length).reduce(:+).nonzero?\n end #end for\n\n #combine results into prioritised list\n return_list = order.map { |search_type| results[search_type] }.reduce(:+)\n\n #remove duplicates\n return_list.uniq!(&:name)\n\n #remove self if returned by search but include_me is false\n return_list.delete_if { |e| e.name == current_node.name } if not include_me\n\n if not safe_deref.nil?\n # result should be dereferenced, do that then remove nils.\n debug(\"applying deref #{safe_deref}\")\n return_list.map! { |nodeish| rcb_safe_deref(nodeish, safe_deref) }\n return_list.delete_if { |item| item.nil? }\n end\n\n debug(\"ospos_search return_list: #{return_list}\")\n\n if one_or_all == :one\n #return first item\n return_list.first\n else\n #return list (even if it only contains one item)\n return_list\n end\n end", "title": "" }, { "docid": "90aec780c8957ab0a81ef2f9ddc4ecff", "score": "0.5433749", "text": "def search_xml(search_path)\n\t\t\tself.xml.search(search_path)\n\t\trescue Exception => e\n\t\t\tputs \"Error searching XML: #{e}\"\n\t\tend", "title": "" }, { "docid": "9f842fd568b6a6467682653fd6f8804c", "score": "0.5433174", "text": "def search_for(keywords, options = {})\n solr_server.find(keywords, options.merge(:results => PublicEarth::Search::PlaceResults))\n end", "title": "" }, { "docid": "6a0f06c5725ac3b3490fcf3caf129f89", "score": "0.5428815", "text": "def search(q, opts = {})\n data, _status_code, _headers = search_with_http_info(q, opts)\n data\n end", "title": "" }, { "docid": "f7151a2aa2eea5b205d364d54fa80830", "score": "0.5412356", "text": "def search\n\tuser_search = gets.strip.downcase\n\tsearch_input(user_search)\nend", "title": "" }, { "docid": "b91f6bc382596e8330206152168c0be7", "score": "0.540483", "text": "def search(q, options={})\n build_object DocumentCloud::SearchResults, get(SEARCH_PATH, options.merge(:q => q))\n end", "title": "" }, { "docid": "2b6c903c29dc11d54c75f8e2bd9e1ab1", "score": "0.539709", "text": "def search(search_builder = {}, eds_params = {})\n send_and_receive(blacklight_config.solr_path, search_builder, eds_params)\n end", "title": "" }, { "docid": "dcd59de940e96ce1d88147a77a634410", "score": "0.53954417", "text": "def search(query, reverse = false)\n doc = fetch_parsed_response(query, reverse)\n doc && doc['status'] == \"OK\" ? doc : nil\n end", "title": "" }, { "docid": "2a9d4c568be6f949c3c08d513d7490a3", "score": "0.53918695", "text": "def search_non_note(string)\n logger.info \"Searching for '#{string}'\"\n search string\n end", "title": "" }, { "docid": "9c028aa0e14b2192933db96e859db6d2", "score": "0.5387474", "text": "def search(word)\n search_prefix(root, word, 0)\n end", "title": "" }, { "docid": "35caa69681487bd54f418ba37f3edfd0", "score": "0.5379384", "text": "def search\n\t @search_term = params[:term]\n\n\t if !@search_term then\n\t @search_term = session[:last_search_term]\n\t end\n\t # Save this for after editing\n\t session[:last_search_term] = @search_term\n\n\t # Need this so that links show up\n\t @title = \"Search Results For '#{@search_term}'\"\n\n\t @search_count = Product.search(@search_term, true, nil)\n\t @product_pages = Paginator.new(self, @search_count, 30, params[:page])\n\t # to_sql is an array\n\t # it seems to return the limits in reverse order for mysql's liking\n\t the_sql = @product_pages.current.to_sql.reverse.join(',')\n\t @products = Product.search(@search_term, false, the_sql)\n\n\t render :action => 'list'\n\tend", "title": "" }, { "docid": "62e93af2f17f74baf4f176666448f036", "score": "0.5365692", "text": "def search(query)\n alert_setup_incomplete && return unless is_setup_ok?\n client = get_client\n query = \"tag:#{query}\" if options[:tag]\n client.search query\n end", "title": "" }, { "docid": "d39399e645a4de2b53e8983c3022f6be", "score": "0.5362407", "text": "def searches(ast)\n return [] unless ast.respond_to?(:xpath)\n ast.xpath(\"//fcall/ident[@value = 'search']\")\n end", "title": "" }, { "docid": "85bdc42512f7e13bfe692263fead5be1", "score": "0.53283954", "text": "def search\n\t\treturn false if self.search_url.blank?\n\t\tbegin\n\t\t\turi = URI.parse(self.search_url)\n\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\trequest = Net::HTTP::Get.new(uri.request_uri)\n\t\t\tif ENV['TRACKING_USER_AGENT']\n\t\t\t\trequest[\"User-Agent\"] = ENV['TRACKING_USER_AGENT']\n\t\t\tend\n\t\t\tresponse = http.request(request)\n\n\t\t\tlog_search_results(response) if response.kind_of? Net::HTTPSuccess\n\t\trescue # something bad happened, ignore for now\n\t\t\tfalse\n\t\tend\n\tend", "title": "" }, { "docid": "f7ce75fd7c77e2c2f4aed84723d502cd", "score": "0.5327881", "text": "def search(query, opts={})\n clear_cookies\n find_url = BASE_URL + '/find?q=%s' % CGI.escape(query)\n results = @cache.get(find_url)\n if not results or not @use_cache\n page = @agent.get(find_url)\n results = page.search('.findResult .result_text a').map do |result|\n url = result.attributes['href'].value.gsub(/\\/\\?.*?$/, '')\n title = result.text\n if url.match RE_ID\n { :id => $1,\n :type => $2,\n :url => url,\n :title => title }\n end\n end\n @cache.put(find_url, results)\n end\n\n # should never happen, but remove broken results\n results.reject! do |result|\n result == nil\n end\n\n if opts[:limit]\n results = results.first opts[:limit]\n end\n if opts[:exact]\n results.reject! do |result|\n query.upcase != result[:title].upcase\n end\n end\n if opts[:type]\n results.reject! do |result|\n result[:type] != opts[:type]\n end\n end\n\n results\n end", "title": "" }, { "docid": "428702e0b2b34e534348590bf1b87412", "score": "0.5327139", "text": "def search(query, results = nil)\n params = { :query => query }\n params[:results] = results unless results.nil?\n get :webSearch, params\n end", "title": "" }, { "docid": "e1b7a867511fc75d1d1ffe05b78e0b00", "score": "0.5327068", "text": "def search_tag(tag)\n search_text(tag.name)\n end", "title": "" }, { "docid": "589ce8ab1a3f9ff557eecf3d9027b014", "score": "0.5326917", "text": "def search\n end", "title": "" }, { "docid": "3dccd675e63206994f65799105317779", "score": "0.53246874", "text": "def searching\n raise \"Caught recursion on #{@name}\" if searching?\n\n # If we've gotten this far, we're not already searching, so go ahead and do so.\n @searching = true\n begin\n yield\n ensure\n @searching = false\n end\n end", "title": "" }, { "docid": "a55c7e654a0d8c2637a9fd69d8893f3c", "score": "0.53239596", "text": "def search(query, qrserver_id=0, requestheaders = {}, verbose = false, params = {})\n search_with_timeout(10, query, qrserver_id, requestheaders, verbose, params)\n end", "title": "" }, { "docid": "dfb0ec6aa4755000673cd0d3b36875a9", "score": "0.5315394", "text": "def search(games, search_term)\n search_index = games.find_index(search_term)\n search_result = if search_index\n \"Game #{search_term} found: #{games[search_index]} at index #{search_index}.\"\n else\n \"Game #{search_term} not found.\"\n end\n return search_result\nend", "title": "" }, { "docid": "4f32d1b6700d719a1767e26c787d205d", "score": "0.5305995", "text": "def search(opts = {})\n data, _status_code, _headers = search_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "50fdd26483934684ec6ff1dd41624b83", "score": "0.53055936", "text": "def search\n @start = starting_point\n return [] if start.nil?\n while continue_search?\n result = iterate\n break if early_trigger?(result)\n end\n results\n end", "title": "" }, { "docid": "0cebf16aad5b2f50a4cf8509227ab7ba", "score": "0.5303957", "text": "def searches(name=nil)\n name ? @searches[ name ] : @searches\n end", "title": "" }, { "docid": "d14953f7f7187b72786f1111a353d252", "score": "0.53030115", "text": "def TreeView_GetISearchString(hwndTV, lpsz) send_treeview_message(hwndTV, :GETISEARCHSTRING, lparam: lpsz) end", "title": "" }, { "docid": "83fa899930728b273e6aca54cdf7aa56", "score": "0.53019404", "text": "def search(query, state = 'open')\n Core.search(:user => @user, :repo => @repo, :state => state, :search_term => query)\n end", "title": "" }, { "docid": "91f5b93841530b2c20417e2c595dc878", "score": "0.5301904", "text": "def search query, max_results=nil\n setup_query query\n ret = []\n num_per_call = max_results || 100\n begin\n while true\n results = run_query query, num_per_call\n ret += results\n break if max_results || results.size < num_per_call\n end\n ensure\n teardown_query query\n end\n\n ret\n end", "title": "" }, { "docid": "337f04dd0e5a266595d17a80cacbf169", "score": "0.52999556", "text": "def search(term)\n contacts_index(Contact.search(term))\n end", "title": "" }, { "docid": "ee095bf91f2ab92393964c7656fef73d", "score": "0.5297543", "text": "def search\n\n end", "title": "" }, { "docid": "87969216494754d6ad38556e9e9ae3b7", "score": "0.5294761", "text": "def search_for(category, keyword)\n\n unless %w[jobs freelancers].include?(category.to_s)\n Log.error(\"Category #{category} is not allowed\")\n return\n end\n\n Log.message(\"Input <#{keyword}> and search for #{category} >>\")\n\n Log.message(\"Choose <#{category.capitalize}> category\")\n click_wait(SEARCH_CATEGORY_BUTTON, 3)\n\n if category.to_s.include?('freelancers')\n click(DROPDOWN_OPTION_FREELANCERS) unless selected?(DROPDOWN_OPTION_FREELANCERS, nil, false)\n else\n click(DROPDOWN_OPTION_JOBS) unless selected?(DROPDOWN_OPTION_JOBS, nil, false)\n end\n\n Log.message(\"Input <#{keyword}> and click on search button\")\n click(SEARCH_FIELD)\n type(SEARCH_FIELD, keyword)\n click_wait(SEARCH_BUTTON, 10)\n\n SearchResultPage.new(BaseTest.driver)\n end", "title": "" }, { "docid": "a4e37947ffddb76d5abfbff1833f172a", "score": "0.52901834", "text": "def search(query); end", "title": "" } ]
4f13f4eae84c9588b250b7363161c298
Add a sheet to the colleection of worksheets. sheetname (string) is the name of the worksheet tab objectType (string) is the type of object you're sending in. objects is your collection of ActiveRecord objects. Here's an example
[ { "docid": "1174e13e8ae640ccff10e5ab22a42186", "score": "0.83755636", "text": "def addWorksheetFromActiveRecord(sheetname, objectType, objects)\r\n\t \r\n\t objects = [objects] unless objects.class == Array\r\n\t \r\n\t item = [sheetname.to_s, objectType.to_s, objects]\r\n\t @worksheets += [item]\r\n\t end", "title": "" } ]
[ { "docid": "9e5b25433ecbb5da613c1466d53bc5f5", "score": "0.7027272", "text": "def worksheet (sheetname, objectType,objects)\r\n\t\r\n\t buffer =\"\"\r\n\t xm = Builder::XmlMarkup.new(buffer) # stream to the text buffer\r\n\t type = ActiveRecord::Base.const_get(objectType.classify)\r\n\t \r\n\t xm.Worksheet 'ss:Name' => sheetname do\r\n \t xm.Table do\r\n \t \r\n \t # Header\r\n \t xm.Row do\r\n \t for column in type.columns do\r\n \t xm.Cell do\r\n \t xm.Data column.human_name, 'ss:Type' => 'String'\r\n \t end\r\n \t end\r\n \t end\r\n \t \r\n \t # Rows\r\n \t for record in objects\r\n \t xm.Row do\r\n \t for column in type.columns do\r\n \t xm.Cell do\r\n \t xm.Data record.send(column.name), 'ss:Type' => 'String'\r\n \t end\r\n \t end\r\n \t end\r\n \t end # for\r\n \t \r\n \t end # table\r\n\t end #worksheet\r\n\t \r\n\t return xm.target! # retrieves the buffer\r\n\t\r\n\t end", "title": "" }, { "docid": "77327eb6f19f74270a93471c63fa9ef0", "score": "0.6325598", "text": "def add_sheet title, values: []\n add_sheet_request = Google::Apis::SheetsV4::AddSheetRequest.new\n add_sheet_request.properties = Google::Apis::SheetsV4::SheetProperties.new\n add_sheet_request.properties.title = title\n\n batch_update_spreadsheet_request = Google::Apis::SheetsV4::BatchUpdateSpreadsheetRequest.new\n batch_update_spreadsheet_request.requests = Google::Apis::SheetsV4::Request.new\n\n batch_update_spreadsheet_request_object = [ add_sheet: add_sheet_request ]\n batch_update_spreadsheet_request.requests = batch_update_spreadsheet_request_object\n\n response = @service.batch_update_spreadsheet(@key, batch_update_spreadsheet_request)\n\n resp = append_to_sheet(title, values) if values&.any?\n\n add_sheet = response.replies[0].add_sheet\n\n sheet = Sheet.new(@service, add_sheet, self)\n\n sheet.values = values if values&.any?\n\n self.sheets << sheet\n\n sheet\n end", "title": "" }, { "docid": "93c3b1ce5ad48ade6e2a1d5ddb536884", "score": "0.63203394", "text": "def addWorksheetFromArrayOfHashes(sheetname, array)\r\n\t item = [sheetname.to_s, 'array', array]\r\n\t @worksheets += [item]\r\n\t end", "title": "" }, { "docid": "385621e7a5ded62184cf86228206fbf9", "score": "0.6280335", "text": "def create\n @sheet = Sheet.new(sheet_params)\n user = User.find(current_user)\n\n respond_to do |format|\n if user.sheets << @sheet\n log = Log.new(:text => \"create sheet #{@sheet.title}\")\n @sheet.logs << log\n format.html { redirect_to @sheet}\n format.json { render :json => @sheet, :status => :created, :location => @sheet }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sheet.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b26d34615a420c76ec471a6acb392843", "score": "0.6260047", "text": "def sheets\n @workbook = @excel.ActiveWorkbook\n\n add_workbook if(@workbook.nil?) # check user hasn't closed it manually\n \n @workbook.Worksheets\n end", "title": "" }, { "docid": "88fd2a90117a1b2d0d1dcd642fcf0f0f", "score": "0.6246492", "text": "def swrite(wb_object,worksheet,array,objects,attributes)\n\t#workbook is the object, worksheet will be the name of the new sheet, array will be the header row, objects will be the array of objects\n\t#attributes in an array of attributes - this is to control layout\n\twb_object.add_worksheet(:name => worksheet) do |sheet|\n\t\tsheet.add_row array\n\t\tobjects.each do |object|\n\t\t\tif attributes\n\t\t\t\tsheet.add_row attributes.map { |attribute|\n\t\t\t\t\tif object.instance_variable_get(attribute).is_a? Array\n\t\t\t\t\t\tobject.instance_variable_get(attribute).join(\", \")\n\t\t\t\t\telse\n\t\t\t\t\t\tobject.instance_variable_get(attribute)\n\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\telse\n\t\t\t\tsheet.add_row object.instance_variables.map { |attribute|\n\t\t\t\t\tif object.instance_variable_get(attribute).is_a? Array\n\t\t\t\t\t\tobject.instance_variable_get(attribute).join(\", \")\n\t\t\t\t\telse\n\t\t\t\t\t\tobject.instance_variable_get(attribute)\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\tend\nend", "title": "" }, { "docid": "cc8abceeec273ec4532409269b0b92f4", "score": "0.6222007", "text": "def add_worksheet(name = nil)\n if name.nil? then\n n = 0\n\n begin\n name = SHEET_NAME_TEMPLATE % (n += 1)\n end until self[name].nil?\n end\n\n new_worksheet = Worksheet.new(:workbook => self, :sheet_name => name)\n worksheets << new_worksheet\n new_worksheet\n end", "title": "" }, { "docid": "717fccc3294fc5a6a2435b8b5f5e941c", "score": "0.6169317", "text": "def worksheets=(value)\n @worksheets = value\n end", "title": "" }, { "docid": "aafb19a5efb698d555fdfd30c9142e27", "score": "0.61657465", "text": "def add_worksheet(name = '')\n name = check_sheetname(name)\n worksheet = Worksheet.new(self, @worksheets.size, name)\n @worksheets << worksheet\n worksheet\n end", "title": "" }, { "docid": "8e6fddebd3c6d7a597e6013798c4fb3a", "score": "0.61574185", "text": "def add_worksheet(name = '')\n index = @worksheets.size\n name = check_sheetname(name)\n\n worksheet = Worksheet.new(self, index, name)\n @worksheets[index] = worksheet\n @sheetnames[index] = name\n\n worksheet\n end", "title": "" }, { "docid": "ad3aaa2dbf76359aa74b9860091c4df1", "score": "0.61116624", "text": "def sheet_by_name(name); end", "title": "" }, { "docid": "84e5279b46323e7ee0e0d2f749f5d069", "score": "0.61096203", "text": "def build( objects, opts = { :on_error => :print } )\n spreadsheet = CsvMadness::Sheet.new( @column_syms )\n\n for object in objects\n STDOUT << \".\"\n record = {}\n for sym in @column_syms\n record[sym] = build_cell( object, sym, opts )\n end\n\n spreadsheet.add_record( record ) # hash form\n end\n\n spreadsheet\n end", "title": "" }, { "docid": "3d08a2359ab83a1b644fb2cff73f92ed", "score": "0.6000241", "text": "def add_worksheet(name = nil)\n new_worksheet = Worksheet.new(self, name)\n worksheets << new_worksheet\n new_worksheet\n end", "title": "" }, { "docid": "7aca3537ade98d2b1a006c62abf5e939", "score": "0.5990645", "text": "def add_sheet( sheet_name = nil )\n\t\[email protected]\n\t\t\n\t\tset_sheet_name(sheet_name) unless sheet_name.nil?\n end", "title": "" }, { "docid": "dac66afd81a8189106ca115386e2945e", "score": "0.59395844", "text": "def put_worksheet_ole_object( put_worksheet_ole_object_request, opts = {})\n\n data, _status_code, _headers = put_worksheet_ole_object_request.create_http_request(@api_client,opts )\n return data\n end", "title": "" }, { "docid": "ff0d68aa22967e86d8eecba3e169c111", "score": "0.5936531", "text": "def sheet\n push Workbook::Sheet.new unless first\n first\n end", "title": "" }, { "docid": "76114f41276d9f4f9aae606401fa3ae4", "score": "0.5929595", "text": "def worksheet title, options = {}, &block\n ws = Worksheet.new(self, title, options, &block)\n @worksheets << ws\n end", "title": "" }, { "docid": "d4535a1aef19524c9360674097c464ba", "score": "0.59104013", "text": "def <<(obj)\n row = columns.map { |column| column.value(self, obj) }\n add_totals row\n sheet.add_row row, row_options\n end", "title": "" }, { "docid": "2e543d64abcbdea51e3ca0ec16314deb", "score": "0.59036785", "text": "def add_worksheet(title, max_rows = 100, max_cols = 20, index: nil)\n (response,) = batch_update([{\n add_sheet: {\n properties: {\n title: title,\n index: index,\n grid_properties: {\n row_count: max_rows,\n column_count: max_cols,\n },\n },\n },\n }])\n Worksheet.new(@session, self, response.add_sheet.properties)\n end", "title": "" }, { "docid": "5370915a7783e025de39d5233721ee67", "score": "0.5839716", "text": "def add_style_sheets(*sheets)\n for sheet in sheets do\n @style_sheets << \" -s #{sheet} \"\n end\n end", "title": "" }, { "docid": "291df69bf40ce2d956469dc0f74e6372", "score": "0.5837325", "text": "def set_sheet\n @sheet = Sheet.find(params[:id])\n end", "title": "" }, { "docid": "291df69bf40ce2d956469dc0f74e6372", "score": "0.5837325", "text": "def set_sheet\n @sheet = Sheet.find(params[:id])\n end", "title": "" }, { "docid": "1c00d5e86d4e403b866af4a8972d68fc", "score": "0.58327806", "text": "def set_sheet\n @sheet = Sheet.find(params[:id])\n end", "title": "" }, { "docid": "b943a131543e4c1ed955a5a9a2be23df", "score": "0.58305454", "text": "def create_work_sheet(headings)\n header_format = @workbook.add_format(\n pattern: 1, size: 10, border: 1,\n color: 'black', align: 'center',\n valign: 'vcenter'\n )\n header_color = @workbook.set_custom_color(10, 171, 208, 245) # Light Blue\n header_format.set_bg_color(header_color)\n @worksheet.set_column(1, 1, 5)\n (1..6).each do |c|\n @worksheet.set_column(c, c, 20)\n end\n @worksheet.set_row(0, 20)\n xls_header_fields = headings\n @worksheet.set_column(0, 0, 20)\n @worksheet.set_column(2, 3, 20)\n @worksheet.set_column(4, 5, 15)\n @worksheet.set_column(6, 9, 10)\n xls_header_fields.each_with_index do |rec, col|\n @worksheet.write(0, col, rec, header_format)\n end\n end", "title": "" }, { "docid": "d819fa94da82d61b8ef834ae6df62a81", "score": "0.5821496", "text": "def add_style_sheets(*sheets)\n for sheet in sheets do\n @style_sheets << \" -s #{sheet} \"\n end\n end", "title": "" }, { "docid": "d819fa94da82d61b8ef834ae6df62a81", "score": "0.5821496", "text": "def add_style_sheets(*sheets)\n for sheet in sheets do\n @style_sheets << \" -s #{sheet} \"\n end\n end", "title": "" }, { "docid": "60f9c02a9d7ca136838c39cf0db56dd7", "score": "0.58025765", "text": "def to_s\n \"<Spreadsheet::#{object_id} '#{title}' by #{author_name} w/ #{Sheety.length_s(@worksheets)} Worksheets>\"\n end", "title": "" }, { "docid": "6ab5334e66d9aaefae9a400a536cf00f", "score": "0.57911086", "text": "def put_worksheet_list_object( put_worksheet_list_object_request, opts = {})\n\n data, _status_code, _headers = put_worksheet_list_object_request.create_http_request(@api_client,opts )\n return data\n end", "title": "" }, { "docid": "e388161d4b9b3030d04fe23cd40f4b15", "score": "0.57811683", "text": "def << sheet = Workbook::Sheet.new\n sheet = Workbook::Sheet.new(sheet) unless sheet.is_a? Workbook::Sheet\n super(sheet)\n sheet.book = self\n end", "title": "" }, { "docid": "1f0350e8b20a7ed94c771efaa7c9fc67", "score": "0.57668096", "text": "def create_spreadsheets\n\t\t@value\n\tend", "title": "" }, { "docid": "a41c400c0f7f25f458cefba3c3e2fde6", "score": "0.5762817", "text": "def add_worksheet(title, max_rows = 100, max_cols = 20)\n xml = <<-\"EOS\"\n <entry xmlns='http://www.w3.org/2005/Atom'\n xmlns:gs='http://schemas.google.com/spreadsheets/2006'>\n <title>#{h(title)}</title>\n <gs:rowCount>#{h(max_rows)}</gs:rowCount>\n <gs:colCount>#{h(max_cols)}</gs:colCount>\n </entry>\n EOS\n doc = @session.post(@worksheets_feed_url, xml)\n url = doc.search(\n \"link[@rel='http://schemas.google.com/spreadsheets/2006#cellsfeed']\")[0][\"href\"]\n return Worksheet.new(@session, url, title)\n end", "title": "" }, { "docid": "26a25f4e4b4438b3f6a66060b7a60e69", "score": "0.57623935", "text": "def add_worksheet(name)\n @worksheet = @package.workbook.add_worksheet(name: name)\n end", "title": "" }, { "docid": "0b9b0f2818e1cc7cba34cc5646bb8c1d", "score": "0.5758618", "text": "def add_worksheet(name = '', encoding = 0)\n name, encoding = check_sheetname(name, encoding)\n\n index = @worksheets.size\n\n worksheet = Worksheet.new(\n self,\n name,\n index,\n encoding\n )\n @worksheets[index] = worksheet # Store ref for iterator\n @sheetnames[index] = name # Store EXTERNSHEET names\n # @parser->set_ext_sheets($name, $index) # Store names in Formula.pm\n return worksheet\n end", "title": "" }, { "docid": "8e618d0371723ba8fde641439fa5e396", "score": "0.5749714", "text": "def add_worksheet(title, max_rows = 100, max_cols = 20)\n xml = <<-\"EOS\"\n <entry xmlns='http://www.w3.org/2005/Atom'\n xmlns:gs='http://schemas.google.com/spreadsheets/2006'>\n <title>#{h(title)}</title>\n <gs:rowCount>#{h(max_rows)}</gs:rowCount>\n <gs:colCount>#{h(max_cols)}</gs:colCount>\n </entry>\n EOS\n doc = @session.request(:post, self.worksheets_feed_url, :data => xml)\n return Worksheet.new(@session, self, doc.root)\n end", "title": "" }, { "docid": "3be1938077af78e0a9c6ee854d81fa31", "score": "0.5735678", "text": "def sheet; end", "title": "" }, { "docid": "48520f7dd400e6ce31300c25f8dd07b0", "score": "0.57302296", "text": "def worksheet; end", "title": "" }, { "docid": "48520f7dd400e6ce31300c25f8dd07b0", "score": "0.57302296", "text": "def worksheet; end", "title": "" }, { "docid": "48520f7dd400e6ce31300c25f8dd07b0", "score": "0.57302296", "text": "def worksheet; end", "title": "" }, { "docid": "48520f7dd400e6ce31300c25f8dd07b0", "score": "0.57302296", "text": "def worksheet; end", "title": "" }, { "docid": "48520f7dd400e6ce31300c25f8dd07b0", "score": "0.57302296", "text": "def worksheet; end", "title": "" }, { "docid": "48520f7dd400e6ce31300c25f8dd07b0", "score": "0.57302296", "text": "def worksheet; end", "title": "" }, { "docid": "48520f7dd400e6ce31300c25f8dd07b0", "score": "0.57302296", "text": "def worksheet; end", "title": "" }, { "docid": "48520f7dd400e6ce31300c25f8dd07b0", "score": "0.57302296", "text": "def worksheet; end", "title": "" }, { "docid": "48520f7dd400e6ce31300c25f8dd07b0", "score": "0.57302296", "text": "def worksheet; end", "title": "" }, { "docid": "48520f7dd400e6ce31300c25f8dd07b0", "score": "0.57302296", "text": "def worksheet; end", "title": "" }, { "docid": "48520f7dd400e6ce31300c25f8dd07b0", "score": "0.57302296", "text": "def worksheet; end", "title": "" }, { "docid": "48520f7dd400e6ce31300c25f8dd07b0", "score": "0.57302296", "text": "def worksheet; end", "title": "" }, { "docid": "48520f7dd400e6ce31300c25f8dd07b0", "score": "0.57302296", "text": "def worksheet; end", "title": "" }, { "docid": "48520f7dd400e6ce31300c25f8dd07b0", "score": "0.57302296", "text": "def worksheet; end", "title": "" }, { "docid": "d78ff69c899d2d322616f653c0a6b4de", "score": "0.57272667", "text": "def worksheet=(value)\n @worksheet = value\n end", "title": "" }, { "docid": "d78ff69c899d2d322616f653c0a6b4de", "score": "0.57272667", "text": "def worksheet=(value)\n @worksheet = value\n end", "title": "" }, { "docid": "d78ff69c899d2d322616f653c0a6b4de", "score": "0.57272667", "text": "def worksheet=(value)\n @worksheet = value\n end", "title": "" }, { "docid": "f799bb82a1021046c48b743a8ecda736", "score": "0.5713478", "text": "def add_worksheet(title, max_rows = 100, max_cols = 20)\n xml = <<-\"EOS\"\n <entry xmlns='http://www.w3.org/2005/Atom'\n xmlns:gs='http://schemas.google.com/spreadsheets/2006'>\n <title>#{h(title)}</title>\n <gs:rowCount>#{h(max_rows)}</gs:rowCount>\n <gs:colCount>#{h(max_cols)}</gs:colCount>\n </entry>\n EOS\n doc = @session.post(@worksheets_feed_url, xml)\n url = as_utf8(doc.search(\n \"link[@rel='http://schemas.google.com/spreadsheets/2006#cellsfeed']\")[0][\"href\"])\n return Worksheet.new(@session, self, url, title)\n end", "title": "" }, { "docid": "1b0e617c9ad1479461f23251f459de44", "score": "0.5712742", "text": "def set_worksheet\n @worksheet = Worksheet.find(params[:id])\n end", "title": "" }, { "docid": "1b0e617c9ad1479461f23251f459de44", "score": "0.5712742", "text": "def set_worksheet\n @worksheet = Worksheet.find(params[:id])\n end", "title": "" }, { "docid": "387718df206885e8bea5d26c02dde2f6", "score": "0.56990623", "text": "def index\n @worksheets = Worksheet.all\n end", "title": "" }, { "docid": "447948c304dec23c13f3b58395144e8e", "score": "0.569435", "text": "def people_sheet\n @people_sheet ||= spreadsheet.worksheet_by_title('People')\nend", "title": "" }, { "docid": "8dc688c676239a340a4f8d841431eddf", "score": "0.569416", "text": "def categories_sheet\n @book.worksheet(WBF[:category_sheet])\n end", "title": "" }, { "docid": "cfe4db7d5ba7b2556c481cdf2dd66d35", "score": "0.5689865", "text": "def create_or_open_sheet_at index\n s = self[index]\n s = self[index] = Workbook::Sheet.new if s.nil?\n s.book = self\n s\n end", "title": "" }, { "docid": "ff18f678706dc2a0f6670af6b1853a1e", "score": "0.56778634", "text": "def create_sheet(index=nil)\n Xl::Worksheet.new(self).tap do |new_sheet|\n add_sheet(new_sheet, index)\n end\n end", "title": "" }, { "docid": "a6a4ca19330e0005caef2aec7577f572", "score": "0.56703055", "text": "def add_workbook( start_sheets = 3 ) \n @workbook = @excel.Workbooks.Add()\n \n # N.B excel.SheetsInNewWorkbook = 1 \n # is retained even after we quit in user's preferences\n \n start_sheets = 1 if start_sheets < 1 \n \n while(sheets.Count > start_sheets)\n @workbook.Worksheets( sheets.Count ).Delete\n end\n \n while(sheets.Count < start_sheets)\n add_sheet\n end\n end", "title": "" }, { "docid": "5db4c466b0a7ca5452ef91bc82e277f4", "score": "0.5667379", "text": "def add_style_sheets(*sheets)\n @style_sheets << sheets.map { |sheet| \" -s #{sheet} \" }.join(' ')\n end", "title": "" }, { "docid": "8a42628ff6e4f94deb67df78e0ebbe24", "score": "0.5663354", "text": "def create\n @sheet = Sheet.new(params[:sheet])\n\n respond_to do |format|\n if @sheet.save\n format.html { redirect_to sheets_path, notice: \"Sheet #{@sheet.name} was successfully created.\" }\n format.json { render json: @sheet, status: :created, location: @sheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7dd2dcac07dc63371793f7278ec4e882", "score": "0.5659222", "text": "def add_sheet(sheet = nil, opts = { })\n add_or_copy_sheet(sheet, opts)\n end", "title": "" }, { "docid": "fc5e314bb90c9dd6017db2e191c9e801", "score": "0.56541336", "text": "def xls_add_plate_sheet(workbook, sheet_name, y_offset=0, x_offset=0)\n sheet = workbook.create_worksheet\n sheet.name = sheet_name\n\n row_name_format = Spreadsheet::Format.new(:weight => :bold)\n col_name_format = Spreadsheet::Format.new(:weight => :bold)\n\n # write row names\n 8.times do |row|\n row_name = ((?A)+row).chr\n sheet[y_offset+row+1, x_offset] = row_name\n sheet.row(y_offset+row+1).set_format(x_offset, row_name_format)\n end\n\n # write column names\n 12.times do |col|\n col_name = (col+1).to_s\n sheet[y_offset, x_offset+col+1] = col_name\n sheet.row(y_offset).set_format(x_offset+col+1, col_name_format)\n end\n sheet\n end", "title": "" }, { "docid": "482a98bbc845fd9b713d8904fc787207", "score": "0.5631944", "text": "def add_worksheet(options = T.unsafe(nil)); end", "title": "" }, { "docid": "dd006a808dba5fe1a23bb236caaf0f4a", "score": "0.56242853", "text": "def add_style_sheets(*sheets)\n for sheet in sheets.flatten do\n @style_sheets << \" -s #{stylesheet_file_path sheet.to_s} \"\n end\n end", "title": "" }, { "docid": "f8ed911008dd06a0d8260b06c77d3c04", "score": "0.5613732", "text": "def sheets(*args)\n if args.empty?\n @worksheets\n else\n args.collect{|i| @worksheets[i] }\n end\n end", "title": "" }, { "docid": "f8ed911008dd06a0d8260b06c77d3c04", "score": "0.5613732", "text": "def sheets(*args)\n if args.empty?\n @worksheets\n else\n args.collect{|i| @worksheets[i] }\n end\n end", "title": "" }, { "docid": "fb9be9c347f41e35f06fb5507cdf0d95", "score": "0.5612925", "text": "def set_sheet\n # debo buscar la lamina que corresponde al protocolo a editar.\n @sheet = Sheet.find_by(id: sheet_params[:id])\n end", "title": "" }, { "docid": "942e62c1255d9f041e3ad772b63d26ec", "score": "0.56063515", "text": "def sheets(*args)\n if args.empty?\n @worksheets\n else\n args.collect{|i| @worksheets[i] }\n end\n end", "title": "" }, { "docid": "af2e6888078bd2f02a875921ff822c63", "score": "0.5594804", "text": "def index\n @sheets = Sheet.all\n end", "title": "" }, { "docid": "af2e6888078bd2f02a875921ff822c63", "score": "0.5594804", "text": "def index\n @sheets = Sheet.all\n end", "title": "" }, { "docid": "7364bb8684be150d2b30ad8a1caeb06d", "score": "0.5580611", "text": "def create\n @worksheet = Worksheet.new(worksheet_params)\n\n respond_to do |format|\n if @worksheet.save\n format.html { redirect_to @worksheet, notice: 'Анкета успешно создана.' }\n format.json { render action: 'show', status: :created, location: @worksheet }\n else\n format.html { render action: 'new' }\n format.json { render json: @worksheet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e75a47e914851cca2e813d1b8c25d5aa", "score": "0.55587965", "text": "def add_empty_sheet(opts = { })\n new_sheet_name = opts.delete(:as)\n after_or_before, base_sheet = opts.to_a.first || [:after, last_sheet]\n @ole_workbook.Worksheets.Add({ after_or_before.to_s => base_sheet.ole_worksheet })\n new_sheet = worksheet_class.new(@excel.Activesheet)\n new_sheet.name = new_sheet_name if new_sheet_name\n new_sheet\n end", "title": "" }, { "docid": "ba4e8add0a937fc68649acbc2ea268f0", "score": "0.55584687", "text": "def createSheet(workbook, name, title)\t\t\n\t\tworksheet = workbook.add_worksheet(name)\n\t\tworksheet.write(0,0, title, TITLE_FORMAT)\n\t\treturn worksheet\n\tend", "title": "" }, { "docid": "fdbef3ba942de6f7d3eb553dc9c62b02", "score": "0.55482996", "text": "def push sheet = Workbook::Sheet.new\n sheet = Workbook::Sheet.new(sheet) unless sheet.is_a? Workbook::Sheet\n super(sheet)\n sheet.book = self\n end", "title": "" }, { "docid": "5ae9e0b663bf442f897f079f19541f8e", "score": "0.5545429", "text": "def create_sheet(folder_id, sheet_name)\n client.create_spreadsheet(sheet_name)\n end", "title": "" }, { "docid": "71344fc28a602d0f80ae8c518a5dc1b6", "score": "0.5542986", "text": "def sheets\n @sheets ||= worksheets.collect { |worksheet| normalize_string(worksheet.name) }\n end", "title": "" }, { "docid": "aabadced47b5403b9064050208782485", "score": "0.5541234", "text": "def build_sheet\n\t\t\tsheet = @book.create_worksheet :name => @name\n\t\t\tsheet\n\t\tend", "title": "" }, { "docid": "b546a090b2db106278b70ab7aff4594c", "score": "0.554027", "text": "def sheet(name)\n worksheet_class.new(@ole_workbook.Worksheets.Item(name))\n rescue WIN32OLERuntimeError => msg\n raise NameNotFound, \"could not return a sheet with name #{name.inspect}\"\n end", "title": "" }, { "docid": "f88755740cb9430b6b8bfc38217d7cc7", "score": "0.5530692", "text": "def sheet(name)\n worksheet_class.new(@ole_workbook.Worksheets.Item(name))\n rescue WIN32OLERuntimeError, Java::OrgRacobCom::ComFailException => msg\n raise NameNotFound, \"could not return a sheet with name #{name.inspect}\"\n end", "title": "" }, { "docid": "9151273af4ef0946af0c203a808dd96e", "score": "0.552872", "text": "def create\n @sheet = Sheet.new(params[:sheet])\n\n respond_to do |format|\n if @sheet.save\n format.html { redirect_to @sheet, notice: 'Sheet was successfully created.' }\n format.json { render json: @sheet, status: :created, location: @sheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3b3017099a302c03e3f0a8c3bd02512", "score": "0.55223036", "text": "def turn_to sheet, sheet_opts = {}\n if sheet.kind_of?(Integer) && sheet <= sheets.size\n @workbook.default_sheet = sheets[sheet - 1]\n @sheet_opts = process_options sheet_opts\n set_sheet_attributes\n elsif sheet.kind_of?(String) && sheets.include?(sheet)\n @workbook.default_sheet = sheet\n @sheet_opts = process_options sheet_opts\n set_sheet_attributes\n else\n raise SheetNotFoundError\n end\n end", "title": "" }, { "docid": "411267d5c9964f5c34d0b4039f719662", "score": "0.5519626", "text": "def post_worksheet_list_object( post_worksheet_list_object_request, opts = {})\n\n data, _status_code, _headers = post_worksheet_list_object_request.create_http_request(@api_client,opts )\n return data\n end", "title": "" }, { "docid": "144b4621a4ecfa18dbe0fc3aec70b441", "score": "0.5513229", "text": "def sheet(name)\n @sheets[name] ||= Sheet.new(@workbook, name)\n @current_sheet = @sheets[name]\n end", "title": "" }, { "docid": "5c4963deaf046d627437abf1f5cb3134", "score": "0.55095446", "text": "def create\n @group = Group.find(params[:group_id])\n @survey = @group.surveys.find(params[:survey_id])\n @sheet = @survey.sheets.build(params[:sheet])\n \n survey_properties = @survey.survey_properties\n survey_properties.each do |survey_property|\n sheet_property = SheetProperty.new\n sheet_property.position_x = 1\n sheet_property.position_y = 1\n sheet_property.colspan = 1\n sheet_property.survey_property_id = survey_property.id\n @sheet.sheet_properties << sheet_property\n end\n\n if @sheet.save\n redirect_to group_survey_sheet_url(@group, @survey, @sheet)\n else\n render :action => \"new\"\n end\n end", "title": "" }, { "docid": "1665cc1807d4b7191e24d09e7afb451e", "score": "0.55034477", "text": "def worksheets\n api_spreadsheet = @session.sheets_service.get_spreadsheet(id, fields: 'sheets.properties')\n api_spreadsheet.sheets.map{ |s| Worksheet.new(@session, self, s.properties) }\n end", "title": "" }, { "docid": "e9b1d2c0197163ef6800e4907ce9bdfa", "score": "0.5497365", "text": "def create_work_sheet\n header_format = @workbook.add_format(\n pattern: 1, size: 10, border: 1,\n color: 'black', align: 'center',\n valign: 'vcenter'\n )\n header_color = @workbook.set_custom_color(10, 171, 208, 245) # Light Blue\n header_format.set_bg_color(header_color)\n\n # Alive sheet\n @alive_sheet.set_column(0, @new_header.length, 20)\n @alive_sheet.set_row(0, 20)\n @alive_sheet.write_col(@alive_row_count, 0, [@new_header], header_format)\n @alive_row_count += 1\n\n # Missing sheet\n @missing_sheet.set_column(0, @old_header.length, 20)\n @missing_sheet.set_row(0, 20)\n @missing_sheet.write_col(@missing_row_count, 0, [@old_header], header_format)\n @missing_row_count += 1\n end", "title": "" }, { "docid": "9c1679956229f914f3097b12a65d1f03", "score": "0.5490798", "text": "def new_xls(s_s,num) #wb name and sheet number\n ss = WIN32OLE::new('excel.Application')\n wb = ss.Workbooks.Open(s_s)\n ws = wb.Worksheets(num)\n ss.visible = true # For debug\n xls = [ss,wb,ws]\nend", "title": "" }, { "docid": "9c1679956229f914f3097b12a65d1f03", "score": "0.5490798", "text": "def new_xls(s_s,num) #wb name and sheet number\n ss = WIN32OLE::new('excel.Application')\n wb = ss.Workbooks.Open(s_s)\n ws = wb.Worksheets(num)\n ss.visible = true # For debug\n xls = [ss,wb,ws]\nend", "title": "" }, { "docid": "9c1679956229f914f3097b12a65d1f03", "score": "0.5490798", "text": "def new_xls(s_s,num) #wb name and sheet number\n ss = WIN32OLE::new('excel.Application')\n wb = ss.Workbooks.Open(s_s)\n ws = wb.Worksheets(num)\n ss.visible = true # For debug\n xls = [ss,wb,ws]\nend", "title": "" }, { "docid": "d5e4932774da5b03bcae9f08fe6ed084", "score": "0.5488218", "text": "def create\n @sheet = Sheet.new(sheet_params)\n\n respond_to do |format|\n if @sheet.save\n format.html { redirect_to @sheet, notice: 'Sheet was successfully created.' }\n format.json { render :show, status: :created, location: @sheet }\n else\n format.html { render :new }\n format.json { render json: @sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "303c66efe8a0ab136264f653fc7f1684", "score": "0.5479313", "text": "def build_xslx json_objects, key, sheet\n\n\t\t\texcel_headers = build_headers json_objects, sheet\n\n\t\t\tbuild_values json_objects, excel_headers, key, sheet\n\n\t\t\twrite \"#{@path}/#{@name}.xls\"\n\t\tend", "title": "" }, { "docid": "bb21bcb0c6a45f0026c3f92ba50c67db", "score": "0.5478505", "text": "def create\n @timesheet = Timesheet.new(timesheet_params)\n\n respond_to do |format|\n if @timesheet.save\n xls = XlsxSubsheets.new\n subsheet_names = xls.divide_into_subsheets(2, 0, @timesheet.file.path, @timesheet.file.updated_at)\n subsheet_names.uniq.each do |path|\n @timesheet.subsheets.build(subsheet_path: path)\n @timesheet.save\n end\n\n format.html { redirect_to @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": "0a0700da8f1bec53d306035550b25ebc", "score": "0.54767007", "text": "def create\n @worksheet = Worksheet.new(worksheet_params)\n\n respond_to do |format|\n if @worksheet.save\n format.html { redirect_to @worksheet, notice: \"Worksheet was successfully created.\" }\n format.json { render :show, status: :created, location: @worksheet }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @worksheet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ddec7e05e6a1f0a905ba32eecf2afaa2", "score": "0.5472741", "text": "def sheet_name\n 'Sheet1'\n end", "title": "" }, { "docid": "0f2ef944955a11f5c0b0a966fb0862fc", "score": "0.5441168", "text": "def sheets_info\n if @info[:default_sheet]\n @info[:default_sheet] = verify_sheet_name(@info[:default_sheet])\n @info[:sheets].merge!(sheet_info(@info[:default_sheet]))\n else\n @info[:sheets_name].each { |name| @info[:sheets].merge!(sheet_info(name)) }\n @workbook.default_sheet = @info[:sheet_current]\n end\n end", "title": "" }, { "docid": "9df885fa17d675cefdd5e0a903d7604a", "score": "0.5426659", "text": "def set_ext_sheets(worksheet, index)\n # The _ext_sheets hash is used to translate between worksheet names\n # and their index\n @ext_sheets[worksheet] = index\n end", "title": "" }, { "docid": "9fa49ebd0ae5c3a58933f407ad6dbc08", "score": "0.54214597", "text": "def sheets_by_name(name)\n @sheets.select { |s| s.name == name }\n end", "title": "" } ]
a623c224c50a24adbaae38b2618a9961
Array that contains all elements from both arguments in sorted order. You may not provide any solution that requires you to sort the result array. You must build the result array one element at a time in the proper order. Your solution should not mutate the input arrays. Examples: merge([1, 5, 9], [2, 6, 8]) == [1, 2, 5, 6, 8, 9] merge([1, 1, 3], [2, 2]) == [1, 1, 2, 2, 3] merge([], [1, 4, 5]) == [1, 4, 5] merge([1, 4, 5], []) == [1, 4, 5] PEDAC: Understand the Problem: > Input: arrays with integer values (2) > Output: array of integers (1) > Requirements: must take two arrays as arguments > arrays contain integers > arrays can be empty must return one array with values from each array combined and sorted > Rules: original arrays cannot be mutated cannot make use of sort method on result array > need to build result array one element at a time Examples: merge([1, 5, 9], [2, 6, 8]) == [1, 2, 5, 6, 8, 9] merge([1, 1, 3], [2, 2]) == [1, 1, 2, 2, 3] merge([], [1, 4, 5]) == [1, 4, 5] merge([1, 4, 5], []) == [1, 4, 5] Data Structures: start by creating a temp array to hold the contents of both args create the results array to hold final values loop on temp array until temp array is empty remove min value and add to result array return result array Algorithm: > Pseudo: START program DEFINE merge(arr1, arr2) SET temp_arr = arr1 + arr2 SET merged_and_sorted_arr = [] UNTIL temp_arr is empty ADD temp_arr.delete(temp_arr.min) to merged_and_sorted_arr END RETURN merged_and_sorted_arr END Code with Intent: this method does not pass; delete removes all instances of the element
[ { "docid": "a67036cd9608751dabb63e74ff08ebc2", "score": "0.7564297", "text": "def merge(arr1, arr2)\n temp_arr = arr1 + arr2\n merged_and_sorted_arr = []\n until temp_arr.empty?\n merged_and_sorted_arr << temp_arr.delete(temp_arr.min)\n end\n merged_and_sorted_arr\nend", "title": "" } ]
[ { "docid": "96c8753148bde25390fce7fe16abed10", "score": "0.79365045", "text": "def merge_sorted_arrays(array1, array2)\nend", "title": "" }, { "docid": "6f60487bfc4e8a574087197197847e54", "score": "0.78782606", "text": "def merge(array_1, array_2, return_array)\n if array_1 == [] && array_2.length > 0\n array_2.each {|element| return_array.push(element)}\n elsif array_2 == [] && array_1.length > 0\n array_1.each {|element| return_array.push(element)}\n else\n if array_1[0] < array_2[0]\n return_array.push(array_1[0])\n array_1.delete(array_1[0])\n merge(array_1, array_2, return_array)\n elsif array_2[0] < array_1[0]\n return_array.push(array_2[0])\n array_2.delete(array_2[0])\n merge(array_1, array_2, return_array)\n else\n p \"Something went wrong\"\n end\n end\n return_array\n end", "title": "" }, { "docid": "731440ff35db5e71b4cb58076180ee5a", "score": "0.7845424", "text": "def merge(arr1, arr2)\n not_result_array = (arr1 + arr2).sort\n result = not_result_array\nend", "title": "" }, { "docid": "16a2fb9fab77cbae3528bcbbe9923a64", "score": "0.7765767", "text": "def merge_arrays(array1, array2)\n \n merged_array = array1 + array2\n \n if array1.empty? \n merged_array = array2\n elsif array2.empty?\n merged_array = array1 \n else\n starting_index = [array1[0], array2[0]].min\n merged_array[0] = starting_index\n second_index = [array1[0], array2[0]].max\n merged_array[1] = second_index\n second_to_the_last_index = [array1[-1], array2[-1]].min\n merged_array[-1] = second_to_the_last_index\n last_index = [array1[-1], array2[-1]].max\n merged_array << last_index\n remaining_elements = (array1[1..-2] + array2[1..-2]).sort\n merged_array[2..-3] = remaining_elements\n end\n merged_array\nend", "title": "" }, { "docid": "227c931fab41efb2104830d2e8dbddb1", "score": "0.77046347", "text": "def merge_sorted(array1, array2)\n merged_array_length = array1.length + array2.length\n merged_array = Array.new(merged_array_length, nil)\n\n array1_index = 0\n array2_index = 0\n merged_index = 0\n\n until merged_index == (merged_array.length)\n array1_exhausted = (array1_index >= array1.length)\n array2_exhausted = (array2_index >= array2.length)\n\n if !array1_exhausted && !array2_exhausted\n if array1[array1_index] > array2[array2_index]\n merged_array[merged_index] = array2[array2_index]\n array2_index += 1\n merged_index += 1\n else\n merged_array[merged_index] = array1[array1_index]\n array1_index += 1\n merged_index += 1\n end\n else\n if array1_exhausted\n merged_array[merged_index] = array2[array2_index]\n array2_index += 1\n merged_index += 1\n else\n merged_array[merged_index] = array1[array1_index]\n array1_index += 1\n merged_index += 1\n end\n end\n end\n\n merged_array\nend", "title": "" }, { "docid": "9867264410562ce3cfaf5b62b0c7ea51", "score": "0.76934856", "text": "def merge_sorted(array1, array2)\n i = 0 # array 1\n j = 0 # array 2\n array1_len = array1.length\n array2_len = array2.length\n \n sorted_array = []\n \n while sorted_array.length < (array1_len + array2_len)\n if i == array1_len\n array2[j..-1].each do |num|\n sorted_array << num\n end\n elsif\n j == array2_len\n array1[i..-1].each do |num|\n sorted_array << num\n end\n elsif array1[i] < array2[j]\n sorted_array << array1[i]\n i += 1\n elsif array1[i] > array2[j]\n sorted_array << array2[j]\n j += 1\n end\n end\n \n return sorted_array\nend", "title": "" }, { "docid": "9a4b17e3bfaae4892d651b3d38563984", "score": "0.7667618", "text": "def merge_sort(array1, array2)\n result = []\n\n if array1[0] < array2[0]\n result << array1.shift\n else\n result << array2.shift\n end\n\n if array1.length == 0\n return result + array2\n elsif array2.length ==0\n return result + array1\n else\n return result + merge_sort(array1, array2)\n end\n \nend", "title": "" }, { "docid": "ff6b337ffc7dc2d662359f628682ad42", "score": "0.76246583", "text": "def merge(left, right)\n new_arr = []\n left_idx = 0\n right_idx = 0\n\n # As the arrays are already sorted, can work along each array comparing minimum values\n # Whichever is smaller gets added to the new array and index is incremented\n # Process repeats until one array has been added to new_arr\n # At this point, we know that all remaining values of the other array can be added, no need to check\n while left_idx < left.length && right_idx < right.length do\n if left[left_idx] <= right[right_idx]\n p \"left: #{left[left_idx]} right: #{right[right_idx]}\"\n new_arr.push(left[left_idx])\n left_idx += 1\n p \"new_arr: #{new_arr}\"\n else\n p \"left: #{left[left_idx]} right: #{right[right_idx]}\"\n new_arr.push(right[right_idx])\n right_idx += 1\n p \"new_arr: #{new_arr}\"\n end\n end\n\n # Adds the number of values remaining if right array left over\n for i in 0..(right.length - right_idx -1) do\n new_arr.push(right[right_idx])\n right_idx += 1\n p \"new_arr: #{new_arr}\"\n end\n\n # Adds the number of values remaining if left array left over\n for i in 0..(left.length - left_idx -1) do\n new_arr.push(left[left_idx])\n left_idx += 1\n p \"new_arr: #{new_arr}\"\n end\n\n # Returns new array\n new_arr\nend", "title": "" }, { "docid": "f687f44749e13c76dc1957e203e6601d", "score": "0.75479364", "text": "def merge(arr_1, arr_2)\n result = []\n arr_1_index = 0\n arr_2_index = 0\n \n while (arr_1_index < arr_1.size) \\\n && (arr_2_index < arr_2.size)\n if arr_1[arr_1_index] <= arr_2[arr_2_index]\n result << arr_1[arr_1_index]\n arr_1_index += 1\n else\n result << arr_2[arr_2_index]\n arr_2_index += 1\n end\n end\n \n # one of the input arrays is fully inserted to result\n if arr_1_index < arr_1.size\n result += arr_1[arr_1_index..-1]\n else\n result += arr_2[arr_2_index..-1]\n end\n \n result\nend", "title": "" }, { "docid": "f687f44749e13c76dc1957e203e6601d", "score": "0.75479364", "text": "def merge(arr_1, arr_2)\n result = []\n arr_1_index = 0\n arr_2_index = 0\n \n while (arr_1_index < arr_1.size) \\\n && (arr_2_index < arr_2.size)\n if arr_1[arr_1_index] <= arr_2[arr_2_index]\n result << arr_1[arr_1_index]\n arr_1_index += 1\n else\n result << arr_2[arr_2_index]\n arr_2_index += 1\n end\n end\n \n # one of the input arrays is fully inserted to result\n if arr_1_index < arr_1.size\n result += arr_1[arr_1_index..-1]\n else\n result += arr_2[arr_2_index..-1]\n end\n \n result\nend", "title": "" }, { "docid": "e45fd373ad7bf11308f6e8a48d58482c", "score": "0.75446564", "text": "def merge(array1, array2, merged_array=[])\n len_of_a1 = array1.length #Get length of arrays and compare to the array's index\n len_of_a2 = array2.length\n index1 = 0 #Set the starting index for both arrays - always 0 since we are going left to right.\n index2 = 0\n\n while index1 < len_of_a1 and index2 < len_of_a2 #This loop continues until the end of one of the arrays is reached\n if array1[index1] < array2[index2] #It compares the index values of both arrays, and appends the one that is lower in value\n merged_array << array1[index1]\n index1 += 1\n else\n merged_array << array2[index2]\n index2 += 1\n end\n end\n\n if index1 < len_of_a1 #Appends any remaining values to the merged array\n merged_array += array1[index1..-1] \n elsif index2 < len_of_a2\n merged_array += array2[index2..-1]\n end\n merged_array #Returns the merged array\nend", "title": "" }, { "docid": "2e3239ed0fe38f7463dd26d46c8b1fbb", "score": "0.7483941", "text": "def merge(a, b) # merge takes in arrays a and b as parameters\n idx_a = 0\n idx_b = 0\n\n new_arr = []\n\n while idx_a < a.length && idx_b < b.length do\n if a[idx_a] <= b[idx_b] then\n new_arr << a[idx_a]\n idx_a += 1\n else\n new_arr << b[idx_b]\n idx_b += 1\n end\n end\n if (idx_a < a.length) then\n for i in (idx_a..a.length-1) do\n new_arr << a[i]\n end\n else\n for i in (idx_b..b.length-1) do\n new_arr << b[i]\n end\n end\n return new_arr\nend", "title": "" }, { "docid": "775450bfcecc0bf3c056f38efe35ec51", "score": "0.74809635", "text": "def merge_arrays(left, right)\n sorted_array = []\n # this works with the assumption that the 2 arrays are sorted themselves\n while !left.empty? && !right.empty?\n sorted_array << (left[0] < right[0] ? left.shift : right.shift)\n end\n # adding left and right in case the length of the two arrays wasn't the same\n sorted_array + left + right\nend", "title": "" }, { "docid": "9f363f1508bce9c10c330cd85a5f2294", "score": "0.7462377", "text": "def merge_arr(int_arr1, int_arr2)\r\n m_arr = []\r\n m_arr = int_arr1 + int_arr2\r\n m_arr = m_arr.sort \r\n return m_arr\r\nend", "title": "" }, { "docid": "2ec50b2c8f99bbd6c732b693a7458745", "score": "0.74536514", "text": "def two_unsorted_to_sorted_single(first, second)\n puts \"first array is #{first}\"\n first = merge_sort(first)\n puts \"second array is #{second}\"\n second = merge_sort(second)\n puts \"Merged into single sorted array\"\n p merge(first, second)\nend", "title": "" }, { "docid": "a3a14a74f7b718f31c8d95fd1bedc9c6", "score": "0.74443984", "text": "def merge_arrays(arr1, arr2)\n len = arr1.length + arr2.length\n newArr = Array.new()\n # keep walking over each array until we have a new array \n # with the same size as both of our old arrays\n begin\n \t# get each array's values\n arr1_val = arr1.at(0)\n arr2_val = arr2.at(0)\n # if the arrays are uneven, just pusn the values\n if arr1_val.nil? \n newArr.push(arr2_val)\n arr2.slice!(0)\n next\n end\n if arr2_val.nil?\n newArr.push(arr1_val)\n arr1.slice!(0)\n next\n end\n # otherwise compare and select the lowest value, \n # removing it from the array\n \t\tif arr1_val <= arr2_val\n newArr.push(arr1_val)\n arr1.slice!(0)\n else\n newArr.push(arr2_val)\n arr2.slice!(0)\n end\n end until newArr.length == len\n\n newArr\nend", "title": "" }, { "docid": "bdb7f5c45e7ad236269c0b80c186fe07", "score": "0.7437115", "text": "def merge(arr_1, arr_2)\n compares = arr_1.size + arr_2.size\n sorted_arr = []\n compares.times do\n if arr_1.empty? || (arr_2.first && (arr_2.first < arr_1.first))\n sorted_arr << arr_2.shift\n else\n sorted_arr << arr_1.shift\n end\n end\n sorted_arr\nend", "title": "" }, { "docid": "d58a82aed3f577b638fef0a1f97b7146", "score": "0.7433471", "text": "def merge_sort(array1, array2)\n # write your code here\n sorted_array = []\n i = 0\n j = 0\n \n while i < array1.size && j < array2.size\n if array1[i] < array2[j]\n sorted_array << array1[i]\n i += 1\n else\n sorted_array << array2[j]\n j += 1\n end\n end\n \n if i < array1.size\n sorted_array.concat(array1[i..-1])\n end\n \n if j < array2.size\n sorted_array.concat(array2[j..-1])\n end\n \n sorted_array\n end", "title": "" }, { "docid": "fc7054200dfa142acbcef1a856164819", "score": "0.74293566", "text": "def merge(array_one, array_two)\n p (array_one + array_two).sort\nend", "title": "" }, { "docid": "a32042528da282aad833f02aabaaaad7", "score": "0.7423968", "text": "def merge_arrays(a, b)\n # build a holder array that is the size of both input arrays\n # O(n) space\n result = []\n\n # get lower head value\n if a[0] < b[0]\n result << a.shift\n else\n result << b.shift\n end\n\n # check to see if either array is empty\n if a.length == 0\n return result + b\n elsif b.length ==0\n return result + a\n else\n return result + merge_arrays(a, b)\n end\n \nend", "title": "" }, { "docid": "ad261883b0f50bee134b0e2853f49839", "score": "0.73995936", "text": "def merge(left, right)\n final_sort = [] \n # Make comparison while we have two subarrays with elements\n while !left.empty? && !right.empty?\n # compare the first elements of the left & right subarrays\n # if the first element of the left is larger or equal, remove it from the left array and place it in the final_sort array\n if left.first <= right.first\n final_sort << left.shift\n else\n # if the previous condition failed, then remove the first element of the right array and put it in the final_sort array\n final_sort << right.shift\n end\n end\n # if there is a remaining single element combine it with the final_sort array\n final_sort.concat(left).concat(right)\nend", "title": "" }, { "docid": "bcaace0ecda28cdcbe28bbfb255b3daf", "score": "0.73970175", "text": "def sorted_merge(a, b)\n index_a = a.size - 1 # index of last element in array a\n index_b = b.size - 1 # index of last element in array b\n index_merged = a.size + b.size - 1 # end of merged array\n merged_array = Array.new(index_merged)\n\n # merge a and b starting with the last element in each\n while index_b >= 0\n if (index_a >= 0) && (a[index_a] > b[index_b])\n merged_array[index_merged] = a[index_a]\n index_a -= 1\n else\n merged_array[index_merged] = b[index_b]\n index_b -= 1\n end\n index_merged -= 1\n end\n merged_array\nend", "title": "" }, { "docid": "db3fce94fad7ceedae3fbe221f72ff06", "score": "0.7386315", "text": "def merge_arrays(a, b)\n (a | b).sort\nend", "title": "" }, { "docid": "ba50bd794819c4a3af4e534de48ab585", "score": "0.73834485", "text": "def merge(left_arr,right_arr)\n sorted_arr = [] \n until left_arr.empty? || right_arr.empty?\n if left_arr.first < right_arr.first\n sorted_arr << left_arr.shift\n else\n sorted_arr << right_arr.shift\n end \n end \n sorted_arr +left_arr + right_arr #one of them will be empty so it doesn't matter\nend", "title": "" }, { "docid": "59be56526ae9d8468a5e1e55876bb224", "score": "0.7360319", "text": "def merge(arr_1, arr_2)\n if arr_1.empty?\n arr_2\n elsif arr_2.empty?\n arr_1\n elsif arr_1.first < arr_2.first\n [arr_1.first] + merge(arr_1[1..arr_1.length], arr_2)\n else\n [arr_2.first] + merge(arr_1, arr_2[1..arr_2.length])\n end\nend", "title": "" }, { "docid": "24873f27820f72cb463c813c5ada9a87", "score": "0.7345578", "text": "def merge_sorted_arrays(arr1, arr2)\n sorted_arr = []\n until arr1.empty? && arr2.empty?\n if arr1[0].nil? || arr2[0].nil?\n sorted_arr.append arr1.shift || arr2.shift\n elsif arr1[0] < arr2[0]\n sorted_arr.append arr1.shift\n else\n sorted_arr.append arr2.shift\n end\n end\n sorted_arr\nend", "title": "" }, { "docid": "de036c3456abb23815e2f3dbe2380eb0", "score": "0.73395693", "text": "def merge left, right\n output = []\n # until we've emptied both arrays\n while left[0] && right[0]\n # compare the first index of both arrays\n # take the lesser value and push it into a new array\n if left[0]<right[0]\n output.push(left.shift)\n elsif right[0]<left[0]\n output.push(right.shift)\n # if the values are equal, push both of them\n else\n output.push(right.shift).push(left.shift)\n end\n end\n while left[0]\n output.push(left.shift)\n end\n\n while right[0]\n output.push(right.shift)\n end\n\n output\n\n # merge two arrays to make them sorted\n\nend", "title": "" }, { "docid": "5233a9dc6bce5cc90ccf8854d582a8f3", "score": "0.7338185", "text": "def merge_sort(arr, result = [])\n # base case: return array if the array has only one number\n if arr.length < 2\n return arr\n else\n # split the array in two recursively until we reach the base case\n half = arr.length / 2\n split_one = merge_sort(arr[0...half])\n split_two = merge_sort(arr[half...arr.length])\n \n # build an array sorted by comparing each array's smallest values\n while split_one.empty? == false && split_two.empty? == false\n if split_one.first > split_two.first\n result << split_two.first\n split_two.shift\n else\n result << split_one.first\n split_one.shift\n end\n end\n \n # once one of the arrays is empty, append the already sorted rest of the other array to result\n split_two.empty? ? split_one.each { |n| result << n } : split_two.each { |m| result << m }\n end\n \n # return result and move up the recursion tree until done\n result\nend", "title": "" }, { "docid": "fd7d275acc1126a212b2b6f3dc33cded", "score": "0.7337299", "text": "def merge(array1, array2)\n if array1.empty? then return array2 end\n if array2.empty? then return array1 end\n array1_index = 0\n array2_index = 0\n merged_array = []\n final_size = array1.size + array2.size\n until merged_array.size == final_size do\n if array1[array1_index] <= array2[array2_index]\n merged_array << array1[array1_index]\n array1_index += 1\n if array1_index == array1.size\n merged_array << array2[array2_index..-1]\n return merged_array.flatten\n end\n else\n merged_array << array2[array2_index]\n array2_index +=1\n if array2_index == array2.size\n merged_array << array1[array1_index..-1]\n return merged_array.flatten\n end\n end\n end\nend", "title": "" }, { "docid": "e8d548923680521b9a82e6ea3bf6f936", "score": "0.7337087", "text": "def merge(a, b, arr)\n acounter, bcounter = 0, 0\n arr[0..-1] = []\n until acounter == a.size and bcounter == b.size\n if acounter == a.size\n arr.push b[bcounter]\n bcounter += 1\n elsif bcounter == b.size\n arr.push a[acounter]\n acounter += 1\n elsif a[acounter] > b[bcounter]\n arr.push b[bcounter]\n bcounter += 1\n elsif b[bcounter] >= a[acounter]\n\t\t arr.push a[acounter]\n\t\t acounter += 1\n end\n end\n \n return arr\nend", "title": "" }, { "docid": "e67bc0744d220e85ce3447ae09f34c6b", "score": "0.73359597", "text": "def merge(array_left, array_right)\n\n\tarray_sorted = []\n\twhile array_left.length > 0 && array_right.length > 0 do\n\t\t\n\t\tif array_left[0] > array_right[0]\n\t\t\tarray_sorted << array_right.slice!(0)\n\t\telse\n\t\t\tarray_sorted << array_left.slice!(0)\n\t\tend\n\n\tend\n\n\tif array_left.size == 0 \n\t\tarray_sorted.concat array_right\n\telsif array_right.size == 0\n\t\tarray_sorted.concat array_left\n\tend\n\n\tarray_sorted\nend", "title": "" }, { "docid": "3b0450e094264f1c30537dac5f00ecf9", "score": "0.7322198", "text": "def merge(arr1, arr2)\n result = []\n loop do \n compare = arr1.first <=> arr2.first\n case compare\n when -1\n result << arr1.shift\n when 1\n result << arr2.shift\n when nil\n if arr1.empty?\n result << arr2.shift\n else\n result << arr1.shift\n end\n end\n #binding.pry\n break if arr1.empty? && arr2.empty?\n end\n # compare first element from arr1 with \n ## first element from arr2\n # smaller number is appended to result array\n result\nend", "title": "" }, { "docid": "0147a8d3a1b23f3460273d02eead3541", "score": "0.7318029", "text": "def merge(arr_1, arr_2)\n merged = []\n\n arr_1_idx = 0\n arr_2_idx = 0\n\n sorted = false\n\n until sorted\n if arr_1[arr_1_idx] == nil\n merged += arr_2[arr_2_idx..-1]\n sorted = true\n elsif arr_2[arr_2_idx] == nil\n merged += arr_1[arr_1_idx..-1]\n sorted = true\n elsif arr_1[arr_1_idx] < arr_2[arr_2_idx]\n merged << arr_1[arr_1_idx]\n arr_1_idx += 1\n else\n merged << arr_2[arr_2_idx]\n arr_2_idx += 1\n end\n end\n\n merged\nend", "title": "" }, { "docid": "422482d4612692bb12ead23f7c4d901e", "score": "0.7310037", "text": "def merge(first_array, second_array)\n return first_array if second_array.empty?\n return second_array if first_array.empty?\n\n merged_array = []\n first_index, second_index = 0, 0\n\n while first_index < first_array.length && second_index < second_array.length\n if first_array[first_index] <= second_array[second_index]\n merged_array << first_array[first_index]\n first_index += 1\n else\n merged_array << second_array[second_index]\n second_index += 1\n end\n\n if first_index == first_array.length\n merged_array << second_array[second_index .. -1]\n elsif second_index == second_array.length\n merged_array << first_array[first_index .. -1]\n end\n end\n\n merged_array.flatten\nend", "title": "" }, { "docid": "422482d4612692bb12ead23f7c4d901e", "score": "0.7310037", "text": "def merge(first_array, second_array)\n return first_array if second_array.empty?\n return second_array if first_array.empty?\n\n merged_array = []\n first_index, second_index = 0, 0\n\n while first_index < first_array.length && second_index < second_array.length\n if first_array[first_index] <= second_array[second_index]\n merged_array << first_array[first_index]\n first_index += 1\n else\n merged_array << second_array[second_index]\n second_index += 1\n end\n\n if first_index == first_array.length\n merged_array << second_array[second_index .. -1]\n elsif second_index == second_array.length\n merged_array << first_array[first_index .. -1]\n end\n end\n\n merged_array.flatten\nend", "title": "" }, { "docid": "c2a3e8dcdb6dc118a6312e195e4c14af", "score": "0.7309937", "text": "def merge(arr1, arr2)\n result = []\n while arr1 != [] && arr2 != []\n if arr1[0] < arr2[0]\n result << arr1[0]\n arr1 = arr1.drop(1)\n else\n result << arr2[0]\n arr2 = arr2.drop(1)\n end\n end\n if arr1 == []\n result += arr2\n else\n result += arr1\n end\n result\nend", "title": "" }, { "docid": "9da22219a01f0ba3b923f369f5241944", "score": "0.73014355", "text": "def merge_arrays(a, b)\n merged_array = []\n while a.count >= 1 && b.count >= 1\n if a[0] < b[0]\n merged_array << a.shift\n elsif a[0] > b[0]\n merged_array << b.shift\n end\n end\n !a.empty? if merged_array << a\n !b.empty? if merged_array << b\n merged_array.flatten\nend", "title": "" }, { "docid": "20798fd32689e19daf45879a78b77665", "score": "0.7297604", "text": "def merge(arrayA, arrayB)\n a = 0\n b = 0\n result = []\n #Taking the larger number between two arrays and putting that in the output\n while a < arrayA.length && b < arrayB.length do\n if arrayA[a] > arrayB[b]\n result.push(arrayA[a])\n a += 1\n elsif arrayA[a] < arrayB[b]\n result.push(arrayB[b])\n b += 1\n else\n result.push(arrayA[a])\n result.push(arrayB[b])\n a += 1\n b += 1\n end\n end\n #After either one of the arrays has been 'emptied out', push the\n #remaining elements in the other array to the result\n if a < arrayA.length\n until a == arrayA.length do\n result.push(arrayA[a])\n a += 1\n end\n else\n until b == arrayB.length do\n result.push(arrayB[b])\n b += 1\n end\n end\n return result\nend", "title": "" }, { "docid": "1fc5b7f2d16e9ddfdff8c2e120699e7b", "score": "0.7293087", "text": "def sorted_merge(array_a, array_b)\n combined_length = array_a.length + array_b.length\n i = 0\n j = 0\n while i < combined_length\n if i >= array_a.length\n array_a << array_b[j]\n j += 1\n elsif array_a[i] > array_b[j]\n array_a.insert(i, array_b[j])\n j += 1\n end\n break if array_a.length == combined_length\n i += 1\n end\n array_a\nend", "title": "" }, { "docid": "a5b75e8a3195a71182cf9b26aada46b4", "score": "0.72793686", "text": "def merging(left=[], right=[], sorted=[])\n\ti_left = 0\n\ti_right = 0\n\ti_sorted = 0\n\twhile (i_left < left.length) && (i_right < right.length)\n\t\tif left[i_left] < right[i_right]\n\t\t\tsorted << left[i_left]\n\t\t\ti_left +=1\n\t\telse\n\t\t\tsorted << right[i_right]\n\t\t\ti_right += 1\n\t\tend\n\t\ti_sorted += 1\n\tend\n\tif i_left == left.length\n\t\twhile i_right < right.length\n\t\t\tsorted << right[i_right]\n\t\t\ti_right += 1\n\t\tend\n\telsif i_right == right.length\n\t\twhile i_left < left.length\n\t\t\tsorted << left[i_left]\n\t\t\ti_left += 1\n\t\tend\n\tend\n\tsorted\nend", "title": "" }, { "docid": "9136e585e0c7b0e3160bc2c368dcfdad", "score": "0.7274366", "text": "def merged_sorted_arrays(first_array, second_array)\n\tp sorted_array = second_array.zip(first_array)\nend", "title": "" }, { "docid": "2f657d7a14ec6fccf0b0f0a5625f4298", "score": "0.7270909", "text": "def merge2(array1, array2)\n merged = []\n\n while array1 != [] && array2 != []\n if array1[0] < array2[0]\n merged << array1.shift\n else\n merged << array2.shift\n end\n end\n\n if array1 == []\n merged = merged + array2\n else\n merged = merged + array1\n end\n\n merged\nend", "title": "" }, { "docid": "b89a613283aca833579389e2ab0d863f", "score": "0.7267857", "text": "def merge(arr1, arr2)\nend", "title": "" }, { "docid": "3659703bd50c2a956aa4c50b756f5fad", "score": "0.725238", "text": "def merge(arr1, arr2)\n merged_arr = []\n until arr1.empty? || arr2.empty?\n if arr1.first < arr2.first\n merged_arr << arr1.shift\n else\n merged_arr << arr2.shift\n end\n end\n merged_arr + arr1 + arr2\nend", "title": "" }, { "docid": "3489587587d8dedf6e083c20bbcbc2bf", "score": "0.7247887", "text": "def poorly_written_ruby_2(*arrays)\n sorted_array = merge_sort(arrays.flatten)\n # Return the sorted array\n sorted_array\n end", "title": "" }, { "docid": "b9e6f7b7dba4cdecd3cf30d6a3552beb", "score": "0.72452587", "text": "def merge(arr1, arr2)\n\t\ttemp = []\n\t\ti = 0\n\t\tj = 0\n\t\twhile (i < arr1.size && j < arr2.size) do\n\t\t\tif arr1[i] < arr2[j]\n\t\t\t\ttemp << arr1[i]\n\t\t\t\ti = i + 1\n\t\t\telse\n\t\t\t\ttemp << arr2[j]\n\t\t\t\tj = j + 1\n\t\tend\n\n\t\twhile i < arr1.size\n\t\t\ttemp << arr1[i]\n\t\t\ti = i + 1\n\t\tend\n\n\t\twhile j < arr2.size\n\t\t\ttemp << arr2[j]\n\t\t\tj = j + 1\n\t\tend\n\n\t\ttemp\n\tend\nend", "title": "" }, { "docid": "154a3b6d9a7d3844808c60d6b46a700d", "score": "0.72426254", "text": "def merge(arr1, arr2)\n results = []\n size = arr1.size + arr2.size\n\n loop do \n case arr1[0] <=> arr2[0]\n when nil\n if arr1.empty? \n results << arr2[0] \n arr2 = arr2[1..-1]\n else \n results << arr1[0]\n arr1 = arr1[1..-1]\n end\n when -1 || 0\n results << arr1[0]\n arr1 = arr1[1..-1]\n when 1\n results << arr2[0]\n arr2 = arr2[1..-1]\n end\n break if results.size == size\n end\n results\nend", "title": "" }, { "docid": "34d65b9421d6d40bb17cd444983533f0", "score": "0.72373164", "text": "def merge_sort(arr, result=[])\n return arr if arr.size == 1\n\n # Store arr size for the sake of cleaner code.\n size = arr.size\n\n # Split arr into two halves (+-1).\n arr1 = arr[0...size/2]\n arr2 = arr[size/2..size]\n\n # Call recursive merge_sort on arr halves.\n arr1 = merge_sort(arr1)\n arr2 = merge_sort(arr2)\n\n # Create pointers.\n arr_p = 0\n arr1_p = 0\n arr2_p = 0\n\n # Pick smaller element from two pointers and append to result array.\n while arr1_p < arr1.size && arr2_p < arr2.size\n if arr1[arr1_p] < arr2[arr2_p]\n result << arr1[arr1_p]\n\n arr1_p += 1 # Increment arr 1pointer.\n else\n result << arr2[arr2_p]\n arr2_p += 1 # Increment arr2 pointer.\n end\n arr_p += 1 # Increment arr pointer.\n end\n\n # When one list (arr) is exhausted, copy elements of other arr into result array.\n if arr1_p == arr1.size\n result += arr2[arr2_p..arr2.size] # Appent remaining arr2 elements to result.\n else\n result += arr1[arr1_p..arr1.size] # Appent remaining arr1 elements to result.\n end\n\n return result\n\nend", "title": "" }, { "docid": "8f0927f0ef28ec8a2c86631746500026", "score": "0.72339773", "text": "def merge(array1,array2)\n #var c(array3) as array\n array3 = Array.new\n\n #while ( a and b have elements )\n #if ( a[0] > b[0] )\n #add b[0] to the end of c\n #remove b[0] from b\n #else\n #add a[0] to the end of c\n #remove a[0] from a\n while(!array1.empty? and !array2.empty?)\n if array1[0] > array2[0]\n array3.push(array2[0])\n array2.delete_at(0)\n else\n array3.push(array1[0])\n array1.delete_at(0)\n end\n end\n\n #while ( a has elements )\n #add a[0] to the end of c\n #remove a[0] from a\n while(!array1.empty?)\n array3.push(array1[0])\n array1.delete_at(0)\n end\n \n #while ( b has elements )\n #add b[0] to the end of c\n #remove b[0] from b\n while(!array2.empty?)\n array3.push(array2[0])\n array2.delete_at(0)\n end\n #return c\n array3\n end", "title": "" }, { "docid": "a9f1deffe8e6424e96587e67c809dce4", "score": "0.7223875", "text": "def merge_arrays(a, b)\n\n x = a.length - 1\n y = b.length - 1\n z = a.length - 1\n\n # Find the last element in array a\n while (a[x] == nil)\n x -= 1\n end\n\n # Merge arrays\n while (x >= 0 || y >= 0)\n if x < 0 \n a[z] = b[y]\n y -= 1\n elsif y < 0\n a[z] = a[x]\n x -= 1\n elsif a[x] < b[y]\n a[z] = b[y]\n y -= 1\n else\n # if a[x] > b[y]\n a[z] = a[x]\n x -= 1\n end\n z -= 1\n end\nend", "title": "" }, { "docid": "f006afdbb3a5cf0a46653c7186e2038e", "score": "0.7219141", "text": "def merge_arrays(a, b)\n result = []\n\n a_index, b_index = [0, 0]\n\n until result.length == a.length + b.length\n # When we should put an item from a into the result:\n #\n # If the current element in a is not nil AND EITHER:\n # - The current element in b is nil OR\n # - The current element in a is less than the current element in b\n\n if !a[a_index].nil? && (b[b_index].nil? || a[a_index] < b[b_index])\n result << a[a_index]\n a_index += 1\n else\n result << b[b_index]\n b_index += 1\n end\n end\n\n result\nend", "title": "" }, { "docid": "8eb0b0af68b70428f89e4795364169a1", "score": "0.7217845", "text": "def merge(arr1, arr2)\n first_array_index = 0\n second_array_index = 0\n output = []\n loop do\n if arr1[first_array_index] == nil\n (second_array_index...arr2.size).each do |num|\n output << arr2[num]\n end\n return output\n end\n\n if arr2[second_array_index] == nil\n (first_array_index...arr1.size).each do |num|\n output << arr1[num]\n end\n return output\n end\n\n if arr1[first_array_index] == arr2[second_array_index]\n output << arr1[first_array_index] << arr2[second_array_index]\n first_array_index += 1\n second_array_index += 1\n elsif arr1[first_array_index] < arr2[second_array_index]\n output << arr1[first_array_index]\n first_array_index += 1\n else \n output << arr2[second_array_index]\n second_array_index += 1\n end\n break if arr1[first_array_index] == nil && arr2[second_array_index] == nil\n end\n output\nend", "title": "" }, { "docid": "2002d68a7405bcdfb293909c0d720e10", "score": "0.7217333", "text": "def merge(array1, array2)\n merged = []\n while !array1.empty? && !array2.empty?\n if array1.first < array2.first\n merged << array1.first\n array1 = array1.drop(1)\n else\n merged << array2.first\n array2 = array2.drop(1)\n end\n end\n if array1 == []\n merged += array2\n else\n merged += array1\n end\n merged\nend", "title": "" }, { "docid": "3ddfd08665bb302403ea33b4fd7f4590", "score": "0.72151536", "text": "def merge_sort(array_of_ints)\n \n array_length = array_of_ints.length \n \n return array_of_ints if array_length === 1\n\n right_array = array_of_ints[0..(array_length/2-1)]\n left_array = array_of_ints[array_length/2..(array_length-1)]\n \n right_array = merge_sort(right_array)\n left_array = merge_sort(left_array)\n\n return merge(right_array, left_array)\nend", "title": "" }, { "docid": "f8b6633aebbda2772f76ee13841087ef", "score": "0.72101146", "text": "def merge(arr1, arr2)\n if arr1.empty? || arr2.empty?\n return arr1 + arr2\n end\n idx1, idx2 = 0, 0\n merged_array = []\n loop do\n if !arr2[idx2]\n merged_array << arr1[idx1]\n idx1 += 1\n elsif !arr1[idx1]\n merged_array << arr2[idx2]\n idx2 += 1\n elsif arr1[idx1] < arr2[idx2]\n merged_array << arr1[idx1]\n idx1 += 1\n else\n merged_array << arr2[idx2]\n idx2 += 1\n end\n break if merged_array.size == (arr1.size + arr2.size)\n end\n merged_array\nend", "title": "" }, { "docid": "f3579f397e5d548314732355d70b1908", "score": "0.720974", "text": "def merge(left_array, right_array)\n #Declear an array for holding result\n rusult = []\n until left_array.length == 0 || right_array.length == 0 do\n rusult << (left_array.first <= right_array.first ? left_array.shift : right_array.shift)\n end\n rusult + left_array + right_array\nend", "title": "" }, { "docid": "502deccb8f89bd023e2e4094503ec025", "score": "0.7209364", "text": "def merge(array1, array2)\n #results = []\n if array1.size >= array2.size\n helper(array1, array2)\n else helper(array2, array1)\n end\n\nend", "title": "" }, { "docid": "0211f4a05d2b4060fc1b90e73c4b678e", "score": "0.72029966", "text": "def merge(arr1, arr2)\n merged = []\n num1_idx = num2_idx = 0\n final_length = arr1.length + arr2.length\n loop do\n if arr1[num1_idx].nil?\n merged << arr2[num2_idx]\n num2_idx += 1\n elsif arr2[num2_idx].nil?\n merged << arr1[num1_idx]\n num1_idx += 1\n elsif arr1[num1_idx] < arr2[num2_idx]\n merged << arr1[num1_idx]\n num1_idx += 1\n else\n merged << arr2[num2_idx]\n num2_idx += 1\n end\n break if merged.length == final_length\n end\n merged\nend", "title": "" }, { "docid": "db7d0f68fc3df93f1c5b795d8e129e5b", "score": "0.72028714", "text": "def mergeArrays(a, b)\n\n a_idx, b_idx = 0, 0\n a_len, b_len = a.length, b.length\n merged_array = []\n\n # Keep track of indices and compare sorted values in parallel\n while (a_idx < a_len && b_idx < b_len)\n case a[a_idx] <=> b[b_idx]\n when 0\n merged_array << a[a_idx]\n a_idx += 1\n b_idx += 1\n when -1\n merged_array << a[a_idx]\n a_idx += 1\n else\n merged_array << b[b_idx]\n b_idx += 1\n end\n end\n\n # merge remainder values of either of the arrays\n merged_array.concat(a[a_idx..-1]).concat(b[b_idx..-1])\n\n merged_array\nend", "title": "" }, { "docid": "1116a632d5820f1acba3b6a56db036ee", "score": "0.71979564", "text": "def merge_sort(array1, array2)\n array = []\n i_dx = 0\n j_dx = 0\n\n while i_dx < array1.length && j_dx < array2.length\n if array1[i_dx] < array2[j_dx]\n array << array1[i_dx]\n i_dx += 1\n else\n array << array2[j_dx]\n j_dx += 1\n end\n end\n\n # Add the remaining elements in the left sublist\n add_elements(i_dx, array, array1)\n\n # Add the remaining elements in the right sublist\n add_elements(j_dx, array, array2)\n\n array\nend", "title": "" }, { "docid": "5e439bf4f36b9541567a704b79496a83", "score": "0.7196636", "text": "def merge(arr1, arr2)\n counter = 0\n sorted_arr = []\n \n return [arr1] if arr2 == nil\n arr1.each do |el|\n while arr2[counter] != nil && arr2[counter] <= el\n sorted_arr << arr2[counter]\n counter += 1\n end\n sorted_arr << el\n end\n [sorted_arr + arr2[counter..-1]]\nend", "title": "" }, { "docid": "d85be7a1f1ddf99090c5ffd7e5af79ec", "score": "0.7195193", "text": "def merge(arr1, arr2)\n result = []\n i = 0\n j = 0\n while i<arr1.length && j<arr2.length do \n if arr1[i]<=arr2[j]\n result.push(arr1[i])\n i += 1\n else \n result.push(arr2[j])\n j += 1\n end\n end\n while i<arr1.length do\n result.push(arr1[i])\n i += 1\n end\n while j<arr2.length do\n result.push(arr2[j])\n j += 1\n end\n return result\nend", "title": "" }, { "docid": "fde3730175460b07300b6e3bc44f12c3", "score": "0.7190962", "text": "def merge(array1, array2)\n arr1, arr2 = array1.dup, array2.dup\n out_arr = []\n until arr1.empty? || arr2.empty?\n out_arr << (arr1[0] <= arr2[0] ? arr1 : arr2).shift\n end\n out_arr + arr1 + arr2\nend", "title": "" }, { "docid": "3d2ec135d578448de674830fcca99b4e", "score": "0.7184206", "text": "def merge(array1, array2)\n order = array1.empty? ? [array2, array1] : [array1, array2]\n results = order[0].map { |x| x }\n\n order[1].each do |a_value|\n results.each_with_index do |r_value, index|\n if r_value > a_value\n results.insert(index, a_value)\n break\n end\n end\n end\n\n results\nend", "title": "" }, { "docid": "084cef1ead0f7b10eee0c4e299375ce5", "score": "0.7183689", "text": "def merge_arrays(array1, array2)\n length_of_arrays = (array1 + array2).length\n merged_array = [nil] * length_of_arrays\n\n first_array_index = 0\n second_array_index = 0\n merged_array_index = 0\n\n while merged_array_index < length_of_arrays\n first_array_num = array1[first_array_index]\n second_array_num = array2[second_array_index]\n\n if first_array_index >= array1.length\n merged_array[merged_array_index] = array2[second_array_index]\n second_array_index += 1\n elsif second_array_index >= array2.length\n merged_array[merged_array_index] = array1[first_array_index]\n first_array_index += 1\n elsif first_array_num < second_array_num\n merged_array[merged_array_index] = first_array_num\n first_array_index += 1\n else\n merged_array[merged_array_index] = second_array_num\n second_array_index += 1\n end\n merged_array_index +=1\n end\n return merged_array\nend", "title": "" }, { "docid": "aee94d7883e5de926d2337fba53f7855", "score": "0.718329", "text": "def merge(array1,array2)\n index1=0\n index2=0\n x = array1.length + array2.length\n mergedArray = []\n while(mergedArray.length < x)\n if(array1[index1].nil?)\n mergedArray.push(array2[index2])\n index2 += 1\n elsif (array2[index2].nil?)\n mergedArray.push(array1[index1])\n index1 += 1\n elsif(array1[index1] < array2[index2])\n mergedArray.push(array1[index1])\n index1 += 1\n else\n mergedArray.push(array2[index2])\n index2 += 1\n end\n end\n return mergedArray\nend", "title": "" }, { "docid": "85c394d5eff89f2c9ff1730074a0ccf8", "score": "0.7183018", "text": "def merge(arr1, arr2)\n merged = []\n until arr1.empty? || arr2.empty?\n if arr1.first <= arr2.first\n merged << arr1.shift\n else\n merged << arr2.shift\n end\n end\n merged + arr1 + arr2\nend", "title": "" }, { "docid": "483ca9c25e35baa7e466f30b892b70b2", "score": "0.7179248", "text": "def merge(arr1, arr2)\n i, j = 0, 0\n result = []\n\n while i < arr1.length && j < arr2.length\n if arr1[i] < arr2[j]\n result << arr1[i]\n i += 1\n else\n result << arr2[j]\n j += 1\n end\n end\n\n result += arr1[i..-1] if i < arr1.length\n result += arr2[j..-1] if j < arr2.length\n\n result\nend", "title": "" }, { "docid": "cf22560e5a3ee7ee64b2051929dccf4e", "score": "0.71700394", "text": "def merge(arr1, arr2)\n res = []\n until arr1.empty? && arr2.empty?\n if arr1.empty?\n res += arr2\n arr2 = []\n elsif arr2.empty?\n res += arr1\n arr1 = []\n elsif arr1.first >= arr2.first\n res << arr2.shift\n else\n res << arr1.shift\n end\n end\n res\nend", "title": "" }, { "docid": "159bc4d733fabfb3e2a4030d1a47a913", "score": "0.71657103", "text": "def merge_sort array\nend", "title": "" }, { "docid": "907fccdbd54006a4be85955a9863f266", "score": "0.71654934", "text": "def merge(arr1, arr2)\n arr1 = arr1.dup\n arr2 = arr2.dup # duplicate to prevent mutation of original array\n result = []\n until arr1.empty? && arr2.empty?\n if arr1.empty?\n result << arr2.shift\n elsif arr2.empty?\n result << arr1.shift\n else\n if arr1[0] <arr2[0]\n result << arr1.shift\n else\n result << arr2.shift\n end\n end\n end\n result\nend", "title": "" }, { "docid": "bda342ed9b62f8156b040eef85db4040", "score": "0.71569204", "text": "def merge(arr1, arr2)\n l1 = arr1.length\n l2 = arr2.length\n arr = []\n i=j=0\n while(i < l1 and j < l2) \n if(arr1[i] < arr2[j])\n arr << arr1[i]\n i+=1\n else\n arr << arr2[j]\n j+=1\n end \n end\n arr = arr + arr1[i...l1] + arr2[j...l2] \nend", "title": "" }, { "docid": "43b6c60944fd59d51afc3c3d4aee775d", "score": "0.7152481", "text": "def merge(arr1, arr2)\n sorted = []\n\n counter1 = 0\n counter2 = 0\n\n loop do\n if arr1[counter1] == nil\n sorted << arr2[counter2]\n counter2 += 1\n break if sorted.length >= (arr1 + arr2).length\n next\n elsif arr2[counter2] == nil\n sorted << arr1[counter1]\n counter1 += 1\n break if sorted.length >= (arr1 + arr2).length\n next\n elsif (arr1[counter1] < arr2[counter2])\n sorted << arr1[counter1]\n counter1 += 1\n break if sorted.length >= (arr1 + arr2).length\n next\n elsif (arr2[counter2] < arr1[counter1])\n sorted << arr2[counter2]\n counter2 += 1\n break if sorted.length >= (arr1 + arr2).length\n next\n end\n end\n sorted\nend", "title": "" }, { "docid": "8460e14730c0dce917ddc8228638baa5", "score": "0.7150605", "text": "def merge(arr1, arr2)\n output = []\n \n total_size = arr1.size + arr2.size\n (0..total_size-1).each do |n|\n if arr2.size == 0\n output << arr1.delete_at(0)\n next\n end\n if arr1.size == 0\n output << arr2.delete_at(0)\n next\n end\n \n if arr1[0] <= arr2[0]\n output << arr1.delete_at(0)\n else\n output << arr2.delete_at(0)\n end\n end\n output\nend", "title": "" }, { "docid": "3731409efa3d998bc6f34d950c976db3", "score": "0.71460205", "text": "def merge(arr1, arr2)\n # YOUR WORK HERE\nend", "title": "" }, { "docid": "13e0ba25bb5c9a1327bb1f2767d79c72", "score": "0.7141525", "text": "def merge(array_one, array_two)\n new_array = []\n\n while !array_one.empty? && !array_two.empty?\n if array_one.first <= array_two.first\n new_array << array_one.first\n array_one = array_one[1..-1]\n else \n new_array << array_two.first\n array_two = array_two[1..-1]\n end\n end\n \n while !array_one.empty?\n new_array << array_one.first\n array_one = array_one[1..-1]\n end\n\n while !array_two.empty?\n new_array << array_two.first\n array_two = array_two[1..-1]\n end\n\n return new_array\n\nend", "title": "" }, { "docid": "56756d008cfb405c576c0660224a69ec", "score": "0.7138517", "text": "def merge(arr1, arr2)\n result = []\n until arr1.empty? || arr2.empty?\n if arr1.first < arr2.first\n result << arr1.shift\n else\n result << arr2.shift\n end\n end\n\n result.concat(arr1).concat(arr2)\nend", "title": "" }, { "docid": "9a9b5107505858819734a9f62de2bc83", "score": "0.7135963", "text": "def merge(arr1, arr2)\n ind1 = ind2 = 0\n new_arr = []\n\n loop do\n break if arr1 == [] || arr2 == []\n if arr1[ind1] > arr2[ind2]\n new_arr << arr2[ind2]\n ind2 += 1\n else\n new_arr << arr1[ind1]\n ind1 += 1\n end\n break if ind1 >= arr1.size || ind2 >= arr2.size\n end\n\n if ind1 == arr1.size\n temp = arr2[ind2..-1]\n else\n temp = arr1[ind1..-1]\n end\n\n temp.each {|element| new_arr << element}\n\n new_arr\nend", "title": "" }, { "docid": "3a3440889f6c8850b384b52473b1971d", "score": "0.7135845", "text": "def merge(arr1, arr2)\n index1 = 0\n index2 = 0\n result = []\n \n until index1 >= arr1.size || index2 >= arr2.size\n if arr1[index1] < arr2[index2]\n result << arr1[index1]\n index1 += 1\n elsif arr1[index1] > arr2[index2]\n result << arr2[index2]\n index2 += 1\n else \n result << arr1[index1]\n index1 += 1\n index2 += 1\n end \n end \n \n if arr1.empty? \n result += arr2[index1..-1]\n else\n result += arr1[index1..-1]\n end \n result\nend", "title": "" }, { "docid": "bda58b5f204157b513abae62f3ea78d2", "score": "0.71329504", "text": "def merge(arr1, arr2)\n if arr1 == []\n return arr2\n elsif arr2 == []\n return arr1\n end\n \n result = []\n arr2_pos = 0\n \n arr1.each_index {|n|\n loop {\n #binding.pry\n if arr2_pos == (arr2.length) || arr1[n] < arr2[arr2_pos]\n result << arr1[n]\n break\n else\n result << arr2[arr2_pos]\n arr2_pos += 1\n end\n }\n }\n \n if arr2_pos != (arr2.length)\n arr2_pos.upto(arr2.length) {|n|\n result << arr2[n]\n }\n end\n \n result\nend", "title": "" }, { "docid": "5807b9fcca3b6d5815b4394943495e99", "score": "0.71317697", "text": "def merge(a1, a2)\n final=[]\n until a1==[] || a2==[]\n if ( a1.first <= a2.first)\n final << a1.shift\n else\n final << a2.shift\n end\n end\n\n until a1==[]\n final.push(a1[0])\n a1.shift\n end\n until a2==[]\n final.push(a2[0])\n a2.shift\n end\n return final\nend", "title": "" }, { "docid": "840570b0082f02befe108a4fdcaa9a57", "score": "0.71308935", "text": "def merge_sort(arr)\n return arr if arr.length <= 1\n\n array_a = merge_sort(arr[0..arr.length / 2 - 1 ])\n array_b = merge_sort(arr[arr.length/2..-1])\n new_array = []\n \n until array_a.empty? || array_b.empty?\n new_array << if array_a[0] <= array_b[0]\n array_a.shift\n else\n array_b.shift\n end\n end\n new_array.concat(array_a, array_b)\n\n end", "title": "" }, { "docid": "bde385871084ecdbea630d358c59dcf4", "score": "0.7130663", "text": "def merge(left_sorted, right_sorted)\n if left_sorted.empty?\n right_sorted\n elsif right_sorted.empty?\n left_sorted\n elsif left_sorted.first < right_sorted.first\n [left_sorted.first] + merge(left_sorted[1..left_sorted.length], right_sorted)\n else\n [right_sorted.first] + merge(left_sorted, right_sorted[1..right_sorted.length])\n end\nend", "title": "" }, { "docid": "14ccf282e52b292e9fc711f2e6c15b8b", "score": "0.7129443", "text": "def merge_sort(array)\n #Check if the array is larger than one. No need to sort if not\n if array.count <= 1\n return array\n end\n\n mid = array.count / 2\n\n #recursive call to break input array up into smaller single\n #element arrays that can then be merged back together in a\n #sorted order.\n part_a = merge_sort(array.slice(0, mid))\n part_b = merge_sort(array.slice(mid, array.count - mid))\n\n new_array = []\n offset_a = 0\n offset_b = 0\n\n #Merge the smaller arrays together by comparing the first\n #element and pushing the smaller of the two to the new\n #array\n while offset_a < part_a.count && offset_b < part_b.count\n a = part_a[offset_a]\n b = part_b[offset_b]\n\n if a <= b\n new_array << a\n offset_a += 1\n else\n new_array << b\n offset_b += 1\n end\n end\n\n #There might be left over item that has not been pushed in\n #either part_a or part_b. This handles that case.\n while offset_a < part_a.count\n new_array << part_a[offset_a]\n offset_a += 1\n end\n\n while offset_b < part_b.count\n new_array << part_b[offset_b]\n offset_b += 1\n end\n\n return new_array\nend", "title": "" }, { "docid": "c019f411c67de9f3d008b12f2e10f21b", "score": "0.7125641", "text": "def merge_arrays(a, b)\n a.concat(b).uniq.sort\nend", "title": "" }, { "docid": "755c829954e7c9bf577f4a8c3ec88942", "score": "0.71250105", "text": "def merge2(a,b)\n result = []\n length = a.length + b.length\n i = 0\n j = 0\n\n for k in 0...length do #1\n if a[i] < b[j] #\n result[k] = a[i]\n i += 1\n elsif b[j] < a[i]\n result[k] = b[j]\n j += 1\n end\n end\n\n if a.length > b.length\n result += a\n elsif b.length < a.length\n result += b\n end\n\n result\nend", "title": "" }, { "docid": "98bb6f84e9128521a577d7e77891dac6", "score": "0.71160644", "text": "def merge(array1, array2)\n new_array = []\n until array1.empty? or array2.empty?\n smaller = [array1[0], array2[0]].min\n new_array.push(smaller)\n if smaller == array1[0]\n array1.shift\n elsif smaller == array2[0]\n array2.shift \n else\n raise StandardError, \"unknown impossible error\" \n end \n end\n \n if array2.empty?\n remainder = array1 \n elsif array1.empty?\n remainder = array2 \n else\n raise StandardError, \"unknown impossible error\" \n end\n \n new_array += remainder\n return new_array\n\nend", "title": "" }, { "docid": "cd154d5dbf9ea9bab99075f4c1f2bf01", "score": "0.71035326", "text": "def combine(a, b)\n # create results array\n results = Array.new\n\t\n\t# counters pointing to the index of the smallest elements in each array\n first_counter = 0\n second_counter = 0\n\n # check that we have elements to compare\n # push the smaller element onto the result array\n unless a.empty? && b.empty?\n if a[first_counter] >= b[second_counter]\n results << b[first_counter]\n first_counter += 1\n else \n results << a[second_counter]\n second_counter += 1\n end\n end\n\n\t# if there are elements left over in a, move them to result\n if a.length > 0 \n results.push(a)\n end\n\n if b.length > 0 \n results.push(b)\n end\n \n\n\t# if there are elements left over in b, move them to result\n \n return results\n\t# create a results array\n\t# counters pointing to the index of the smallest elements in each array\n\t# check that we have elements to compare\n\t\t# push the smaller element onto the result array\n\t# if there are elements left over in a, move them to result\n\t# if there are elements left over in b, move them to result\nend", "title": "" }, { "docid": "55abc2e01cd1acb5f72e28f7b10914e0", "score": "0.7090046", "text": "def merge_recursive(arr1, arr2, merged = [])\n # p \"arr1: #{arr1}, arr2: #{arr2}, merged: #{merged}\"\n return merged + arr2 if arr1.empty?\n return merged + arr1 if arr2.empty?\n if arr1[0] < arr2[0]\n merged << arr1.shift\n else\n merged << arr2.shift\n end\n return merge_recursive(arr1, arr2, merged)\nend", "title": "" }, { "docid": "9635cacf15ef52e085f1a3614b5b7866", "score": "0.7087968", "text": "def merge_sorted_arrays(arr1, arr2)\n # assumes values in arr1 and arr2 are unique\n merged_arr = []\n\n arr1_pointer = 0\n arr2_pointer = 0\n\n while arr1_pointer < arr1.length || arr2_pointer < arr2.length\n if arr2_pointer == arr2.length || (arr1_pointer != arr1.length && arr1[arr1_pointer] < arr2[arr2_pointer])\n merged_arr << arr1[arr1_pointer]\n arr1_pointer += 1\n elsif arr1_pointer == arr1.length || (arr2_pointer != arr2.length && arr2[arr2_pointer] < arr1[arr1_pointer])\n merged_arr << arr2[arr2_pointer]\n arr2_pointer += 1\n end\n end\n\n p merged_arr\nend", "title": "" }, { "docid": "8b7b980c28b1ce4799650a26dd9cc350", "score": "0.7087699", "text": "def merge(array1, array2)\n (array1 + array2).uniq.sort\nend", "title": "" }, { "docid": "79035b9a2261e240843905ae95151a3f", "score": "0.7063841", "text": "def merge_helper(arr1, arr2)\n head1 = arr1.shift\n head2 = arr2.shift\n merged = []\n\n while head1 || head2\n if head1.nil?\n merged << head2\n head2 = arr2.shift\n elsif head2.nil?\n merged << head1\n head1 = arr1.shift\n elsif head1 < head2\n merged << head1\n head1 = arr1.shift\n else\n merged << head2\n head2 = arr2.shift\n end\n end\n merged\nend", "title": "" }, { "docid": "8a23a94de7c7a546c2092816aecf9a34", "score": "0.7063601", "text": "def merge(first, second)\n return_array = []\n first_count = 0\n second_count = 0\n while return_array.length < (first.length + second.length)\n if first[first_count].nil?\n return_array << second[second_count]\n second_count += 1\n elsif second[second_count].nil?\n return_array << first[first_count]\n first_count += 1\n elsif first[first_count] > second[second_count]\n return_array << second[second_count]\n second_count += 1\n else # second_count == second.length || second[second_count] < first[first_count]\n return_array << first[first_count]\n first_count += 1\n end\n end\n return_array\nend", "title": "" }, { "docid": "f8e42b9a4370d90b680c52b660340b21", "score": "0.7052402", "text": "def new_merge(arr)\n if arr.length <2 \n return arr\n # elsif arr.length == 2\n # if arr[0] > arr[1]\n # return [arr[1], arr[0]]\n # else\n # return arr\n # end\n else\n #sort left\n l = new_merge(arr[0, (arr.length/2)+ arr.length % 2])\n #sort right\n r = new_merge(arr[(arr.length/2)+ arr.length % 2, arr.length])\n #merge\n num_times = l.length + r.length\n l_place = 0\n r_place = 0\n merged_array =[]\n num_times.times {\n if l_place == l.length\n merged_array.push(r[r_place, r.length])\n elsif r_place == r.length\n merged_array.push(l[l_place, l.length]) \n elsif l[l_place] < r[r_place]\n merged_array.push(l[l_place])\n l_place += 1\n else\n merged_array.push(r[r_place])\n r_place += 1\n end\n }\n return merged_array.flatten\n end\nend", "title": "" }, { "docid": "9782733e9fd633a8e950ea8f26b5de0a", "score": "0.70429677", "text": "def merge(array1, array2)\n final_array = []\n (final_array << array1 << array2).flatten.sort.uniq\nend", "title": "" }, { "docid": "6135c83ec3d93c2e4ffea8e081374c76", "score": "0.704219", "text": "def merge_sort(left, right)\n if left.empty? # If left side is empty, return the value of the right\n right\n elsif right.empty?\n left\n elsif left.first < right.first\n # Keep performing merge sort on the rest of the left and right arrays\n [left.first] + merge_sort(left[1..left.length], right)\n else\n [right.first] + merge_sort(left, right[1..right.length])\n end\nend", "title": "" }, { "docid": "f2d1b8cbc7ecc617fb5a88d0fd03c99a", "score": "0.70419157", "text": "def merge(array1, array2)\n merged = []\n\n counter1 = 0\n counter2 = 0\n while counter1 <= array1.size - 1 && counter2 <= array2.size - 1\n if array1[counter1] < array2[counter2]\n merged << array1[counter1]\n counter1 += 1\n else\n merged << array2[counter2]\n counter2 += 1\n end\n end\n\n if counter1 > array1.size - 1 # nothing left there\n merged = merged + array2[counter2...array2.size]\n else\n merged = merged + array1[counter1...array1.size]\n end\n\n merged\nend", "title": "" }, { "docid": "b4cfc7e651465c8c64d2dc6c7a9f8663", "score": "0.7039379", "text": "def merge_sort(array)\nend", "title": "" }, { "docid": "b4cfc7e651465c8c64d2dc6c7a9f8663", "score": "0.7039379", "text": "def merge_sort(array)\nend", "title": "" }, { "docid": "750ec9fc7eace5ab9d554b74ab8a8333", "score": "0.70359445", "text": "def merge(arr1, arr2)\n idx1 = 0\n idx2 = 0\n result = []\n loop do\n if ( idx1 < arr1.size && idx2 <= arr2.size ) && ( idx2 == arr2.size || arr1[idx1] < arr2[idx2] )\n result << arr1[idx1]\n idx1 += 1\n elsif idx2 < arr2.size \n result << arr2[idx2]\n idx2 += 1\n else\n break\n end\n end\n result\nend", "title": "" } ]
1634fb39b752b0055018579c54d4b735
Invoke the appropriate behavior when duplicate columns are present.
[ { "docid": "112aa356215eafd8b203361cf4478988", "score": "0.7347326", "text": "def handle_duplicate_columns(cols)\n message = \"#{caller(*CALLER_ARGS).first}: One or more duplicate columns present in #{cols.inspect}\"\n\n case duplicate_columns_handler_type(cols)\n when :raise\n raise DuplicateColumnError, message\n when :warn\n warn message\n end\n end", "title": "" } ]
[ { "docid": "e561074ca1b6c3d619b3e12ad733b567", "score": "0.7389071", "text": "def on_duplicate_columns(handler = (raise Error, \"Must provide either an argument or a block to on_duplicate_columns\" unless block_given?; nil), &block)\n raise Error, \"Cannot provide both an argument and a block to on_duplicate_columns\" if handler && block\n clone(:on_duplicate_columns=>handler||block)\n end", "title": "" }, { "docid": "10b4914fc3a60c635913cd56eac502a3", "score": "0.686821", "text": "def duplicate_columns_handler_type(cols)\n handler = opts.fetch(:on_duplicate_columns){db.opts.fetch(:on_duplicate_columns, :warn)}\n\n if handler.respond_to?(:call)\n handler.call(cols)\n else\n handler\n end\n end", "title": "" }, { "docid": "fbb70feef51d9a04e30989f24a96c1b9", "score": "0.66473806", "text": "def columns=(cols)\n if cols && cols.uniq.size != cols.size\n handle_duplicate_columns(cols)\n end\n super\n end", "title": "" }, { "docid": "85f7192bd80cc7ef068ef0f971bcc95a", "score": "0.6035176", "text": "def duplicate!(column_name, new_name=nil)\n return false unless self.labels.include?(column_name)\n unless new_name\n i = 1\n i += 1 while self.labels.include?(new_column_name(column_name, i))\n new_name = new_column_name(column_name, i)\n end\n self.append!(new_name, self.render_column(column_name).dup)\n true\n end", "title": "" }, { "docid": "fb89fca51be7cc04ef9b615d41bf8f8e", "score": "0.59939235", "text": "def has_duplicate_db_columns?\n !get_all_db_columns.get_duplicates.empty?\n end", "title": "" }, { "docid": "0c75053d1584caeb34d693dd39cbbd35", "score": "0.59770864", "text": "def check_duplicate_csv_headers(table)\n if table.headers.size != table.headers.uniq.size\n dups = table.headers.select{|e| table.headers.count(e) > 1 }\n Squib.logger.warn \"CSV duplicated the following column keys: #{dups.join(',')}\"\n end\n end", "title": "" }, { "docid": "612473bf0482867ca398c6e88d9f8476", "score": "0.597155", "text": "def add_column_for_on_duplicate_key_update( column, options = {} ) # :nodoc:\n arg = options[:on_duplicate_key_update]\n case arg\n when Hash\n columns = arg.fetch( :columns ) { arg[:columns] = [] }\n case columns\n when Array then columns << column.to_sym unless columns.include?( column.to_sym )\n when Hash then columns[column.to_sym] = column.to_sym\n end\n when Array\n arg << column.to_sym unless arg.include?( column.to_sym )\n end\n end", "title": "" }, { "docid": "612473bf0482867ca398c6e88d9f8476", "score": "0.597155", "text": "def add_column_for_on_duplicate_key_update( column, options = {} ) # :nodoc:\n arg = options[:on_duplicate_key_update]\n case arg\n when Hash\n columns = arg.fetch( :columns ) { arg[:columns] = [] }\n case columns\n when Array then columns << column.to_sym unless columns.include?( column.to_sym )\n when Hash then columns[column.to_sym] = column.to_sym\n end\n when Array\n arg << column.to_sym unless arg.include?( column.to_sym )\n end\n end", "title": "" }, { "docid": "4cb50a9f1a82ea408931e64a75b5a7d7", "score": "0.5969738", "text": "def resolve_ambiguous_headers(models_columns, raw_header)\n return if models_columns.size < 2\n m0_cols = models_columns[0][:allowed_cols] - [\"id\", \"updated_by\", \"created_at\", \"updated_at\"]\n m1_cols = models_columns[1][:allowed_cols] - [\"id\", \"updated_by\", \"created_at\", \"updated_at\"]\n dup_names = []\n m0_cols.each do |n1|\n m1_cols.each do |n2|\n if n1 == n2\n dup_names << n1\n end\n end\n end\n#logger.debug \"resolve_ambiguous_headers found dup_names: #{dup_names}\"\n return if dup_names.empty?\n# normalize all headers\n header = raw_header.map {|h| normalize_header(h) }\n dup_names.each do |dn|\n#logger.debug \"resolve_ambiguous_headers handle dup_name: #{dn}\"\n fi = li = nil\n # find first instance of the dup name in header\n header.each_with_index do |h, i|\n if dn == h\n fi = i\n break\n end\n end\n #logger.debug \"resolve_ambiguous_headers dup_name: #{dn} first index: #{fi}\"\n # next if the dup name is not used in the sheet\n next if fi.nil?\n # find last instance of the dup name in header\n header.reverse_each.with_index do |h, ri|\n if dn == h\n li = (header.size - 1) - ri\n break\n end\n end\n #logger.debug \"resolve_ambiguous_headers dup_name: #{dn} last index: #{li}\"\n if fi == li\n # one instance of dup name\n m1_no_dups = models_columns[1][:allowed_cols] - dup_names\n first_m1_index = nil\n header.each_with_index do |h, i|\n if m1_no_dups.include?(h)\n # we foud the first non-ambiguous header of 2nd model\n first_m1_index = i\n break\n end\n end\n if first_m1_index.nil? || fi < first_m1_index\n # assign to the 1st model\n #logger.debug \"resolve_ambiguous_headers dup_name: #{dn} assign to first\"\n models_columns[0][:dups][dn] = fi\n models_columns[1][:dups][dn] = nil\n else\n # assign to the 2nd model\n #logger.debug \"resolve_ambiguous_headers dup_name: #{dn} assign to second\"\n models_columns[0][:dups][dn] = nil\n models_columns[1][:dups][dn] = fi\n end\n else\n#logger.debug \"resolve_ambiguous_headers assign dup_name: #{dn} first index: #{fi} last index: #{li}\"\n# two instances of dup name\n models_columns[0][:dups][dn] = fi\n models_columns[1][:dups][dn] = li\n end\n end\n end", "title": "" }, { "docid": "410e2894dba067c0de013085409adf99", "score": "0.58200276", "text": "def has_duplicate_db_columns?\n return false unless abstract_form_valid?\n !abstract_form.get_duplicate_db_columns.empty?\n end", "title": "" }, { "docid": "22810b9e1079353dfd5f719e8edb8247", "score": "0.5774762", "text": "def empty_dup(result_cols = nil)\n result_cols ||= heads\n result_types = types.select { |k,_v| result_cols.include?(k) }\n result = self.class.new(result_cols, **result_types)\n tolerant_cols.each do |h|\n result.tolerant_cols << h\n result.column(h).tolerant = true\n end\n (instance_variables - result.instance_variables).each do |v|\n result.instance_variable_set(v, instance_variable_get(v))\n end\n result\n end", "title": "" }, { "docid": "164c34d5d265726fcf2959cefdd8f2bc", "score": "0.5771712", "text": "def check_column_conflicts\n mod = Sequel::Model\n columns.find_all{|c| mod.method_defined?(c)}.each{|c| get_column_conflict!(c)}\n columns.find_all{|c| mod.method_defined?(\"#{c}=\")}.each{|c| set_column_conflict!(c)}\n end", "title": "" }, { "docid": "ab5e411af13eafb0e7482e8e6c6915c4", "score": "0.5689102", "text": "def duplicate()\n bug( \"you must override duplicate()\" )\n end", "title": "" }, { "docid": "a5913b659d9a89d87834c23db3cd3a51", "score": "0.5677732", "text": "def validate_unique *colnames\n\t\t\tcolnames.each { |colname|\n\t\t\t\tds = self.class.where colname => send(colname)\n\t\t\t\tds.filter!(~{primary_key => send(primary_key)}) unless new?\n\t\t\t\tif ds.count > 0\n\t\t\t\t\terrors.add(colname, 'must be unique.')\n\t\t\t\tend\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "57259b6dedd772046f3b5b7fe9f21d19", "score": "0.56380534", "text": "def duplicate_primary_key(duplicate_row:, key:, node_id:)\n # nothing\n end", "title": "" }, { "docid": "059e80853d7194ec4215f4383d962f7f", "score": "0.56002545", "text": "def _insert_dataset\n if upsert_plugin_upserting\n if postgres?\n super.insert_conflict(update: values_to_update, target: self.class.upsert_plugin_identifying_columns)\n elsif mysql?\n columns_to_update = values_to_update.keys - self.class.upsert_plugin_identifying_columns\n super.on_duplicate_key_update(*columns_to_update)\n else\n super\n end\n else\n super\n end\n end", "title": "" }, { "docid": "42a62513dfd016a5582f42463a2f6c1a", "score": "0.5546417", "text": "def _update_without_checking(columns)\n super(identifier_hash(columns))\n end", "title": "" }, { "docid": "b69d1063500541ef188f3ddf87f3e718", "score": "0.5535224", "text": "def validates_as_unique(options = {})\n validated_columns = self.dimension_columns.map { |c| c.to_sym }\n return if validated_columns.empty?\n validates_each(validated_columns.first, options) do |record, attr_name, value|\n where_parts = []\n validated_columns.each do |column|\n value = record.send(column)\n if value.nil?\n # ignore\n elsif column == :start_time || column == :end_time\n where_parts << \"#{connection.quote_table_name(column)} = #{quote_value(value.strftime(\"%Y-%m-%d %H:%M:%S\"))}\"\n else\n where_parts << \"#{connection.quote_table_name(column)} = #{quote_value(value)}\"\n end\n end\n\n if !where_parts.empty?\n # don't need this since we only validate as unique on create currently\n #unless record.new_record?\n #where_parts << \"#{connection.quote_table_name(primary_key)} <> #{quote_value(record.send(primary_key))}\"\n #end\n\n duplicates = self.find_by_sql(\"SELECT 1 FROM #{connection.quote_table_name(self.to_s.underscore.pluralize)} WHERE #{where_parts.join(\" AND \")}\")\n unless duplicates.empty?\n record.errors.add_to_base(\"Set of dimension columns is not unique\")\n end \n else\n record.errors.add_to_base('All columns in validates_as_unique constraint have nil values')\n end\n end\n end", "title": "" }, { "docid": "45a4f971a092d5cea48738025376fd86", "score": "0.5525677", "text": "def apply_single\n validate_schema\n\n # Prepare some lists of columns.\n key_cols = @db1.primary_key(@table1)\n data_cols = @db1.except_primary_key(@table1)\n all_cols = @db1.column_names(@table1)\n\n # Let our public know we are beginning.\n @patch.begin_diff\n\n # Advertise column names.\n @rc_columns = DiffColumns.new\n @rc_columns.title_row = all_cols\n @rc_columns.update(0)\n cells = all_cols.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"@@\",cells)\n @patch.apply_row(rc)\n\n # If requested, we will be providing context rows around changed rows.\n # This is not a natural thing to do with SQL, so we do it only on request.\n # When requested, we need to buffer row changes.\n @pending_rcs = []\n\n # Prepare some useful SQL fragments to assemble later.\n sql_table1 = @db1.quote_table(@table1)\n sql_table2 = @db1.quote_table(@table2)\n sql_key_cols = key_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_all_cols = all_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_key_match = key_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS #{sql_table2}.#{c}\"}.join(\" AND \")\n sql_data_mismatch = data_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS NOT #{sql_table2}.#{c}\"}.join(\" OR \")\n\n # For one query we will need to interleave columns from two tables. For\n # portability we need to give these columns distinct names.\n weave = all_cols.map{|c| [[sql_table1,@db1.quote_column(c)],\n [sql_table2,@db2.quote_column(c)]]}.flatten(1)\n dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]}\"}\n sql_dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]} AS #{c[0].gsub(/[^a-zA-Z0-9]/,'_')}_#{c[1].gsub(/[^a-zA-Z0-9]/,'_')}\"}.join(\",\")\n\n # Prepare a map of primary key offsets.\n keys_in_all_cols = key_cols.each.map{|c| all_cols.index(c)}\n keys_in_dbl_cols = keys_in_all_cols.map{|x| 2*x}\n\n # Find rows in table2 that are not in table1.\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table2} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table1} WHERE #{sql_key_match})\"\n apply_inserts(sql,all_cols,keys_in_all_cols)\n\n # Find rows in table1 and table2 that differ while having the same primary\n # key.\n sql = \"SELECT #{sql_dbl_cols} FROM #{sql_table1} INNER JOIN #{sql_table2} ON #{sql_key_match} WHERE #{sql_data_mismatch}\"\n apply_updates(sql,dbl_cols,keys_in_dbl_cols)\n\n # Find rows that are in table1 but not table2\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table1} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table2} WHERE #{sql_key_match})\"\n apply_deletes(sql,all_cols,keys_in_all_cols)\n\n # If we are supposed to provide context, we need to deal with row order.\n if @patch.want_context\n sql = \"SELECT #{sql_all_cols}, 0 AS __coopy_tag__ FROM #{sql_table1} UNION SELECT #{sql_all_cols}, 1 AS __coopy_tag__ FROM #{sql_table2} ORDER BY #{sql_key_cols}, __coopy_tag__\"\n apply_with_context(sql,all_cols,keys_in_all_cols)\n end\n\n # Done!\n @patch.end_diff\n end", "title": "" }, { "docid": "45a4f971a092d5cea48738025376fd86", "score": "0.5525677", "text": "def apply_single\n validate_schema\n\n # Prepare some lists of columns.\n key_cols = @db1.primary_key(@table1)\n data_cols = @db1.except_primary_key(@table1)\n all_cols = @db1.column_names(@table1)\n\n # Let our public know we are beginning.\n @patch.begin_diff\n\n # Advertise column names.\n @rc_columns = DiffColumns.new\n @rc_columns.title_row = all_cols\n @rc_columns.update(0)\n cells = all_cols.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"@@\",cells)\n @patch.apply_row(rc)\n\n # If requested, we will be providing context rows around changed rows.\n # This is not a natural thing to do with SQL, so we do it only on request.\n # When requested, we need to buffer row changes.\n @pending_rcs = []\n\n # Prepare some useful SQL fragments to assemble later.\n sql_table1 = @db1.quote_table(@table1)\n sql_table2 = @db1.quote_table(@table2)\n sql_key_cols = key_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_all_cols = all_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_key_match = key_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS #{sql_table2}.#{c}\"}.join(\" AND \")\n sql_data_mismatch = data_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS NOT #{sql_table2}.#{c}\"}.join(\" OR \")\n\n # For one query we will need to interleave columns from two tables. For\n # portability we need to give these columns distinct names.\n weave = all_cols.map{|c| [[sql_table1,@db1.quote_column(c)],\n [sql_table2,@db2.quote_column(c)]]}.flatten(1)\n dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]}\"}\n sql_dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]} AS #{c[0].gsub(/[^a-zA-Z0-9]/,'_')}_#{c[1].gsub(/[^a-zA-Z0-9]/,'_')}\"}.join(\",\")\n\n # Prepare a map of primary key offsets.\n keys_in_all_cols = key_cols.each.map{|c| all_cols.index(c)}\n keys_in_dbl_cols = keys_in_all_cols.map{|x| 2*x}\n\n # Find rows in table2 that are not in table1.\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table2} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table1} WHERE #{sql_key_match})\"\n apply_inserts(sql,all_cols,keys_in_all_cols)\n\n # Find rows in table1 and table2 that differ while having the same primary\n # key.\n sql = \"SELECT #{sql_dbl_cols} FROM #{sql_table1} INNER JOIN #{sql_table2} ON #{sql_key_match} WHERE #{sql_data_mismatch}\"\n apply_updates(sql,dbl_cols,keys_in_dbl_cols)\n\n # Find rows that are in table1 but not table2\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table1} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table2} WHERE #{sql_key_match})\"\n apply_deletes(sql,all_cols,keys_in_all_cols)\n\n # If we are supposed to provide context, we need to deal with row order.\n if @patch.want_context\n sql = \"SELECT #{sql_all_cols}, 0 AS __coopy_tag__ FROM #{sql_table1} UNION SELECT #{sql_all_cols}, 1 AS __coopy_tag__ FROM #{sql_table2} ORDER BY #{sql_key_cols}, __coopy_tag__\"\n apply_with_context(sql,all_cols,keys_in_all_cols)\n end\n\n # Done!\n @patch.end_diff\n end", "title": "" }, { "docid": "45a4f971a092d5cea48738025376fd86", "score": "0.5525677", "text": "def apply_single\n validate_schema\n\n # Prepare some lists of columns.\n key_cols = @db1.primary_key(@table1)\n data_cols = @db1.except_primary_key(@table1)\n all_cols = @db1.column_names(@table1)\n\n # Let our public know we are beginning.\n @patch.begin_diff\n\n # Advertise column names.\n @rc_columns = DiffColumns.new\n @rc_columns.title_row = all_cols\n @rc_columns.update(0)\n cells = all_cols.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"@@\",cells)\n @patch.apply_row(rc)\n\n # If requested, we will be providing context rows around changed rows.\n # This is not a natural thing to do with SQL, so we do it only on request.\n # When requested, we need to buffer row changes.\n @pending_rcs = []\n\n # Prepare some useful SQL fragments to assemble later.\n sql_table1 = @db1.quote_table(@table1)\n sql_table2 = @db1.quote_table(@table2)\n sql_key_cols = key_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_all_cols = all_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_key_match = key_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS #{sql_table2}.#{c}\"}.join(\" AND \")\n sql_data_mismatch = data_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS NOT #{sql_table2}.#{c}\"}.join(\" OR \")\n\n # For one query we will need to interleave columns from two tables. For\n # portability we need to give these columns distinct names.\n weave = all_cols.map{|c| [[sql_table1,@db1.quote_column(c)],\n [sql_table2,@db2.quote_column(c)]]}.flatten(1)\n dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]}\"}\n sql_dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]} AS #{c[0].gsub(/[^a-zA-Z0-9]/,'_')}_#{c[1].gsub(/[^a-zA-Z0-9]/,'_')}\"}.join(\",\")\n\n # Prepare a map of primary key offsets.\n keys_in_all_cols = key_cols.each.map{|c| all_cols.index(c)}\n keys_in_dbl_cols = keys_in_all_cols.map{|x| 2*x}\n\n # Find rows in table2 that are not in table1.\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table2} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table1} WHERE #{sql_key_match})\"\n apply_inserts(sql,all_cols,keys_in_all_cols)\n\n # Find rows in table1 and table2 that differ while having the same primary\n # key.\n sql = \"SELECT #{sql_dbl_cols} FROM #{sql_table1} INNER JOIN #{sql_table2} ON #{sql_key_match} WHERE #{sql_data_mismatch}\"\n apply_updates(sql,dbl_cols,keys_in_dbl_cols)\n\n # Find rows that are in table1 but not table2\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table1} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table2} WHERE #{sql_key_match})\"\n apply_deletes(sql,all_cols,keys_in_all_cols)\n\n # If we are supposed to provide context, we need to deal with row order.\n if @patch.want_context\n sql = \"SELECT #{sql_all_cols}, 0 AS __coopy_tag__ FROM #{sql_table1} UNION SELECT #{sql_all_cols}, 1 AS __coopy_tag__ FROM #{sql_table2} ORDER BY #{sql_key_cols}, __coopy_tag__\"\n apply_with_context(sql,all_cols,keys_in_all_cols)\n end\n\n # Done!\n @patch.end_diff\n end", "title": "" }, { "docid": "c20a2a221556458f03f819bb2581f45f", "score": "0.5508355", "text": "def check_columns!\n if columns.nil? || columns.empty?\n raise Error, 'cannot literalize HashRow without columns'\n end\n end", "title": "" }, { "docid": "6de5f1a39a60f353e3357dea22c00f28", "score": "0.5503487", "text": "def columnheaders_unique?\r\n columnheaders_raw.length == columnheaders_raw.uniq.length\r\n end", "title": "" }, { "docid": "fd5497f1af1be638cbf15eb4f0aeeacc", "score": "0.5486278", "text": "def warn_about_duplicate_keys(h1, h2); end", "title": "" }, { "docid": "2bbc2a94b7bad085e41ad16560b8b769", "score": "0.53863055", "text": "def fixup_columns\n @columns.each_index do |idx| \n\n if @columns[idx][:searchable].nil? then\n @columns[idx][:searchable] = @model_class.column_methods_hash[@columns[idx][:id].intern] ? true : false\n end\n @columns[idx][:query] = @columns[idx][:id] if @columns[idx][:query].nil?\n \n if @columns[idx][:sortable].nil? then\n @columns[idx][:sortable] = @columns[idx][:query] == false ? false : true\n end\n \n end\n end", "title": "" }, { "docid": "a78f85d85a66738d01ce13fc5ca7f630", "score": "0.5353254", "text": "def method_missing(header, *args)\n\t header = header.to_sym\n\t if HEADER.include? header #If columns is allowed else print stacktrace\n\t \targs.first[HEADER[header]]\n\t else\n\t p \"#{header} method is missing! Column does not exist or not allowed.\"\n\t end\n \tend", "title": "" }, { "docid": "0322730ed8970deb6e999aebda7f17f1", "score": "0.5347425", "text": "def check_columns_for_winner\n # TODO\n end", "title": "" }, { "docid": "a5732bcfac7d2c54990e1fcb2347323d", "score": "0.5295719", "text": "def import_without_validations_or_callbacks(column_names,\n array_of_attributes,\n options={})\n results = super\n if !self.kafka_config[:import] || array_of_attributes.empty?\n return results\n end\n\n # This will contain an array of hashes, where each hash is the actual\n # attribute hash that created the object.\n array_of_hashes = []\n array_of_attributes.each do |array|\n array_of_hashes << column_names.zip(array).to_h.with_indifferent_access\n end\n hashes_with_id, hashes_without_id = array_of_hashes.partition { |arr| arr[:id].present? }\n\n self.kafka_producers.each { |p| p.send_events(hashes_with_id) }\n\n if hashes_without_id.any?\n if options[:on_duplicate_key_update].present? &&\n options[:on_duplicate_key_update] != [:updated_at]\n unique_columns = column_names.map(&:to_s) -\n options[:on_duplicate_key_update].map(&:to_s) - %w(id created_at)\n records = hashes_without_id.map do |hash|\n self.where(unique_columns.map { |c| [c, hash[c]] }.to_h).first\n end\n self.kafka_producers.each { |p| p.send_events(records) }\n else\n # re-fill IDs based on what was just entered into the DB.\n last_id = if self.connection.adapter_name.downcase =~ /sqlite/\n self.connection.select_value('select last_insert_rowid()') -\n hashes_without_id.size + 1\n else # mysql\n self.connection.select_value('select LAST_INSERT_ID()')\n end\n hashes_without_id.each_with_index do |attrs, i|\n attrs[:id] = last_id + i\n end\n self.kafka_producers.each { |p| p.send_events(hashes_without_id) }\n end\n end\n results\n end", "title": "" }, { "docid": "7956513912484ac0bf757a8a03f36b25", "score": "0.5291658", "text": "def without_duplicates(bindings); end", "title": "" }, { "docid": "d3a4b22f6c1e4ed39c7e4577582d7fa5", "score": "0.5268516", "text": "def multi_column?\n @columns.size > 1\n end", "title": "" }, { "docid": "5b3576fca1b437bc91e3f23af4fb22b2", "score": "0.5230822", "text": "def sql_for_on_duplicate_key_update( table_name, *args ) # :nodoc:\n arg, model, primary_key, locking_column = args\n arg = { columns: arg } if arg.is_a?( Array ) || arg.is_a?( String )\n return unless arg.is_a?( Hash )\n\n sql = ' ON CONFLICT '.dup\n conflict_target = sql_for_conflict_target( arg )\n\n columns = arg.fetch( :columns, [] )\n condition = arg[:condition]\n if columns.respond_to?( :empty? ) && columns.empty?\n return sql << \"#{conflict_target}DO NOTHING\"\n end\n\n conflict_target ||= sql_for_default_conflict_target( primary_key )\n unless conflict_target\n raise ArgumentError, 'Expected :conflict_target to be specified'\n end\n\n sql << \"#{conflict_target}DO UPDATE SET \"\n case columns\n when Array\n sql << sql_for_on_duplicate_key_update_as_array( table_name, model, locking_column, columns )\n when Hash\n sql << sql_for_on_duplicate_key_update_as_hash( table_name, model, locking_column, columns )\n when String\n sql << columns\n else\n raise ArgumentError, 'Expected :columns to be an Array or Hash'\n end\n\n sql << \" WHERE #{condition}\" if condition.present?\n\n sql\n end", "title": "" }, { "docid": "9f1609f0e894f12814ae2fc69338b10e", "score": "0.52253544", "text": "def duplicate_dp_records\n # only works once mark_duplicate_dp_records_invalid has been called\n connection.query(%{\n SELECT\n CONCAT(dp_lot_number, '/', dp_section_number, '/', dp_plan_number),\n COUNT(dp_plan_number) AS duplicate_count\n FROM local_government_area_records\n WHERE local_government_area_id = %d\n AND error_details ? 'duplicate_dp'\n GROUP BY dp_lot_number, dp_section_number, dp_plan_number\n } % [id])\n end", "title": "" }, { "docid": "4365210789635e0fc158ee22e9e44c69", "score": "0.52182674", "text": "def sql_for_on_duplicate_key_update( table_name, *args ) # :nodoc:\n arg, model, primary_key, locking_column = args\n arg = { columns: arg } if arg.is_a?( Array ) || arg.is_a?( String )\n return unless arg.is_a?( Hash )\n\n sql = ' ON CONFLICT '.dup\n conflict_target = sql_for_conflict_target( arg )\n\n columns = arg.fetch( :columns, [] )\n condition = arg[:condition]\n if columns.respond_to?( :empty? ) && columns.empty?\n return sql << \"#{conflict_target}DO NOTHING\"\n end\n\n conflict_target ||= sql_for_default_conflict_target( table_name, primary_key )\n unless conflict_target\n raise ArgumentError, 'Expected :conflict_target or :constraint_name to be specified'\n end\n\n sql << \"#{conflict_target}DO UPDATE SET \"\n case columns\n when Array\n sql << sql_for_on_duplicate_key_update_as_array( table_name, model, locking_column, columns )\n when Hash\n sql << sql_for_on_duplicate_key_update_as_hash( table_name, model, locking_column, columns )\n when String\n sql << columns\n else\n raise ArgumentError, 'Expected :columns to be an Array or Hash'\n end\n\n sql << \" WHERE #{condition}\" if condition.present?\n\n sql\n end", "title": "" }, { "docid": "e5253ccdcd2201c7f7d3f33c4c837fc0", "score": "0.52170855", "text": "def on_conflict(column = nil)\n ::MultiInsert::Query::OnConflict.new(self, column)\n end", "title": "" }, { "docid": "146226001efdfb771e39710f4c25737f", "score": "0.52012545", "text": "def has_duplicate_row? row_id\n @skip_table.has_key?(row_id)\n end", "title": "" }, { "docid": "db21a15d0e39b888705478571f8ac3fb", "score": "0.5194306", "text": "def _update_without_checking(columns)\n ds = _update_dataset\n lc = model.lock_column\n rows = ds.clone(ds.send(:default_server_opts, :sql=>ds.output(nil, [Sequel[:inserted][lc]]).update_sql(columns))).all\n values[lc] = rows.first[lc] unless rows.empty?\n rows.length\n end", "title": "" }, { "docid": "e8d38ee209824cbc98f98acdca5f387b", "score": "0.5192563", "text": "def save_detecting_duplicate_entry_constraint_violation\n begin\n save\n rescue ActiveRecord::StatementInvalid => e\n # Would that rails gave us the nested exception to check...\n if e.message =~ /.*[Dd]uplicate/\n errors.add_to_base(translate_with_theme('duplicate_entry_please_try_again'))\n false\n else\n raise e\n end\n end\n end", "title": "" }, { "docid": "0483fd0b49932226292164932c5c4664", "score": "0.5189738", "text": "def is_duplicate?()\n resources = DB[:resources]\n auto_cols = [:id, :ah_id, :rdatadateadded, :resource_id]\n cols_to_compare = resources.columns - auto_cols\n h = {}\n for col in cols_to_compare\n h[col] = self.send(col)\n end\n existing = resources.where(Sequel.negate(id: self.id)).where(h)\n if existing.count == 0\n return false\n end\n dep_tables = []\n for table in DB.tables\n dep_tables << table if DB[table].columns.include? :resource_id\n end\n for table in dep_tables\n ds = DB[table]\n cols_to_compare = ds.columns - auto_cols\n rows = self.send table\n for row in rows\n h = {}\n for col in cols_to_compare\n h[col] = row.send col\n end\n if table == :tags\n existing = ds.where(h)\n else\n existing = ds.where(Sequel.negate(id: row.id)).where(h)\n end\n if existing.count == 0\n return false\n end\n end\n end\n true\n end", "title": "" }, { "docid": "d0e1af91d900bca1ddcc9fff4f85e1bd", "score": "0.51880133", "text": "def column_show_add_new(column, associated, record)\n true if column != :personnel_data &&\n column != :health_data \n end", "title": "" }, { "docid": "74007bd259a457d4324e3f71568eebbf", "score": "0.51857734", "text": "def duplicate_primary_key(duplicate_row:, key:, node_id:)\n puts \"Duplicate primary key in '#{duplicate_row}' for key '#{key}' in #{node_id}\"\n end", "title": "" }, { "docid": "aad37860bc6c7389367896eff5e5be1c", "score": "0.5171123", "text": "def check_for_duplicates(csv_data, column_name)\n data = csv_data.select{|item| !item[column_name].nil? }\n value = data.map{|i| i[column_name]}\n duplicates = value.filter{ |e| value.count(e) > 1 }.sort.uniq\n naughty_values = duplicates.map{|i| \" 👉 \\\"#{i}\\\"\" }.join(\"\\n\")\n if value.uniq.length != value.length\n puts \"🔴 Found some services with the same #{column_name} \\n\\n#{naughty_values}\\n\\n\"\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "bf1798559657d3811ab14a09f36cc272", "score": "0.5165442", "text": "def sql_for_on_duplicate_key_ignore( *args ) # :nodoc:\n arg = args.first\n conflict_target = sql_for_conflict_target( arg ) if arg.is_a?( Hash )\n \" ON CONFLICT #{conflict_target}DO NOTHING\"\n end", "title": "" }, { "docid": "bda90c3256ecc109564b897f777d1bc7", "score": "0.5155217", "text": "def get_rid_of_duplicate_columns(columns)\n\t\tcolumns.length.times do |x|\n\t\t\t# Only select rows that don't repeat colors in a column\n\t\t\t@current_options = @current_options.select do |option|\n\t\t\t\tcolumns[x].include?(option[x]) == false\n\t\t\tend\n\t\tend\n\t\t@current_options\n\tend", "title": "" }, { "docid": "8c9ee84e56667ac8a5c7a90e99ba93b5", "score": "0.515449", "text": "def missing_columns(fetched_columns)\n (@all_columns - SimpleSet.new(fetched_columns)) << @primary_key\n end", "title": "" }, { "docid": "c0f14b767cc9d5960f67cf42a2b8b8ef", "score": "0.5142717", "text": "def import_cached_appeals(conflict_columns, columns)\n start_time = Time.now.utc\n\n values_to_cache = yield\n\n CachedAppeal.import(\n values_to_cache,\n on_duplicate_key_update: {\n conflict_target: conflict_columns,\n condition: conflict_clause(start_time),\n columns: columns\n }\n )\n\n values_to_cache\n end", "title": "" }, { "docid": "3a9afa8145cb3dd87f8f478c7d124b51", "score": "0.51387185", "text": "def column_changed?(column)\n initial_values.has_key?(column)\n end", "title": "" }, { "docid": "ad4393e8be470c1a770a1aa2416a8c0c", "score": "0.51372766", "text": "def columns; self.class.columns.dup; end", "title": "" }, { "docid": "569f0f682867ed1700fe9a5866054938", "score": "0.5131642", "text": "def save_if_unique(column)\n save\n rescue ActiveRecord::RecordNotUnique => e\n self.errors.add(column, :taken)\n false\n end", "title": "" }, { "docid": "3b455e1c58b1ba841bfcd2269a8e5bf8", "score": "0.5119071", "text": "def verify_header_names(key, models_columns, header)\n normalized_header = []\n\n got_error = false\n header.each_with_index do |h, i|\n logger.debug \"verify header: #{h}\"\n if h == \"id\"\n error(cur_sheet_name, 1, \"Header column #{h} not allowed, update not supported yet\")\n next\n end\n\n if h.nil?\t# ignore empty header\n normalized_header[i] = nil\n next\n else\n normalized_header[i] = normalize_header(h)\n end\n\n # see if heading is an attribute name, pseudo attribute,\n # fk_finder, refrerence id or reference to one\n # if so, put it in the models_columns :headers hash with header index\n header_is_known = false\n show_header_in_results = true\n models_columns.each_with_index do |mc, ci|\n\n # check for ambiguous header name\n if mc[:dups].has_key?(normalized_header[i])\nlogger.debug \"verify_header: ci: #{ci} found ambiguous header: #{normalized_header[i]}\"\n dup_index = mc[:dups][normalized_header[i]]\nlogger.debug \"verify_header: ci: #{ci} dup_index: #{dup_index}\"\n next if dup_index.nil?\n if dup_index == i\n header_is_known = true\n mc[:headers] << [normalized_header[i], i] # 0 based index\nlogger.debug \"header #{h} i: #{i} ci: #{ci} is_ambiguous_model_column mc[:headers]: #{mc[:headers]}\"\n break\n end\n next\n end\n\n if mc[:allowed_cols].include?(normalized_header[i])\n header_is_known = true\n mc[:headers] << [normalized_header[i], i] # 0 based index\nlogger.debug \"header #{h} is_model_column mc[:headers]: #{mc[:headers]}\"\n break\n end\n\n if is_pseudo_attr(mc[:model], normalized_header[i])\n header_is_known = true\n mc[:headers] << [normalized_header[i], i]\nlogger.debug \"header #{h} is_model_pseudo_attr mc[:headers]: #{mc[:headers]}\"\n break\n end\n\n if is_fk_finder_header(normalized_header[i], mc)\n header_is_known = true\n mc[:headers] << [normalized_header[i], i]\nlogger.debug \"header #{h} is_fk_finder mc[:headers]: #{mc[:headers]}\"\n break\n end\n\n if is_ref_def_header(normalized_header[i], mc[:model])\n header_is_known = true\n show_header_in_results = false\n @sheet_results[key][:_refs][(mc[:model]).name] = normalized_header[i]\n @sheet_results[key][:_ref_ids][normalized_header[i]] = {}\n mc[:headers] << [normalized_header[i], i]\nlogger.debug \"header #{h} is_ref_def mc[:headers]: #{mc[:headers]}\"\n break\n end\n\n if is_ref_ref_header(normalized_header[i], mc)\n header_is_known = true\n mc[:headers] << [normalized_header[i], i]\nlogger.debug \"header #{h} is_ref_ref mc[:headers]: #{mc[:headers]}\"\n break\n end\n end\n if !show_header_in_results\n normalized_header.delete_at(i)\n end\n next if header_is_known\n\n # error if not recognized, but continue to gather all errors\n got_error = true\n error(cur_sheet_name, 1, \"Header name '#{h}' is not recognized for model(s) #{model_column_names(models_columns)}\")\n end\n return false if got_error\n\n#logger.debug \"mc[0][:headers]: #{models_columns[0][:headers]}\"\n#logger.debug \"mc[1][:headers]: #{models_columns[1][:headers]}\"\n\n @sheet_results[key][:header] = [\"id\"] + normalized_header.compact\n logger.debug \"Normalized header: key: #{key} #{@sheet_results[key][:header]}\"\n return true\nend", "title": "" }, { "docid": "b8a8363f972ea8c9b5ef376c5069b884", "score": "0.51058733", "text": "def update!\n @model.columns.each do |column|\n if row = @attrs.find {|x| x[:name] == column.name}\n if row[:type] != type_str(column)\n puts \" M #{@model}##{column.name} [#{row[:type]} -> #{type_str(column)}]\"\n row[:type] = type_str(column)\n elsif row[:desc] == InitialDescription::DEFAULT_DESCRIPTION\n new_desc = InitialDescription.for(@model, column.name)\n if row[:desc] != new_desc\n puts \" M #{@model}##{column.name} description updated\"\n row[:desc] = new_desc\n end\n end\n else\n puts \" A #{@model}##{column.name} [#{type_str(column)}]\"\n @attrs << {\n :name => column.name,\n :type => type_str(column),\n :desc => InitialDescription.for(@model, column.name)\n }\n end\n end\n\n # find columns that no more exist in db\n orphans = @attrs.map{|x| x[:name]} - @model.columns.map(&:name)\n unless orphans.empty?\n orphans.each do |orphan|\n puts \" D #{@model}##{orphan}\"\n @attrs = @attrs.select {|x| x[:name] != orphan}\n end\n end\n\n @attrs\n end", "title": "" }, { "docid": "30df9ff15e461d62b15b974bf8e767d1", "score": "0.5102787", "text": "def scrooge_seen_column!( callsite_signature, attr_name )\n scrooge_callsite( callsite_signature ).column!( attr_name )\n end", "title": "" }, { "docid": "30ef4d48cf6190db8adccb97e0051735", "score": "0.50920916", "text": "def proxy_columns(columns)\n columns.each do |column|\n if (type = column_type(column.type)).present?\n # When setting the default value, note that +main_instance+ might be nil, so we have to use +try+\n attribute column.name, type, default: proc { |f| f.main_instance.try(column.name) }\n end\n end\n end", "title": "" }, { "docid": "2c62d5c406925d9d709709616d7f46c0", "score": "0.50851727", "text": "def method_missing(name, *args, &block)\n if args.empty?\n RibColumn.new(name, @columns, @primary_keys, @to_avoid, @default_values)\n else\n hsh = args.grep(Hash).first || {}\n args.grep(Symbol).each do |ss|\n hsh[ss] = true\n end\n \n hsh = {:column => name}.merge(hsh)\n \n if hsh[:primary_key]\n @primary_keys << name.to_s\n end\n\n if hsh[:avoid]\n @to_avoid << name.to_s.downcase\n if hsh[:default]\n @default_values[name.to_s.downcase] = hsh[:default]\n end\n end\n \n @columns[name.to_s] = [hsh[:column].to_s, hsh]\n nil\n end\n end", "title": "" }, { "docid": "6a1c88f2bf17b35bcb4a7f6afd700def", "score": "0.5078097", "text": "def is_column_exist (row_key, col_family, col_name)\r\n [email protected](row_key)[col_family+':'+col_name].blank? \r\n end", "title": "" }, { "docid": "ac4d6c37a0eb72e7c3c0d0b07d139594", "score": "0.5077739", "text": "def finding_with_ambiguous_select?(select_clause)\n !select_clause && columns.size != 2\n end", "title": "" }, { "docid": "b73d175afe466aadd559d093206e99ea", "score": "0.5072535", "text": "def mark_duplicate_rows(csv_data)\n # Grouping on first name, last name, email & phone - two different people with the same name shouldn't be counted as one, and if a person has moved they won't be counted as two (people are likely to keep the same email and phone number)\n grouped_data = csv_data.group_by { |row| [row[:first_name], row[:last_name], row[:email], row[:phone]] }\n\n # Add validation errors\n grouped_data.each do |k,rows|\n # Sort by date and reverse first to make sure we don't add the errors to the wrong row\n rows.sort_by! { |row| row[:date_added]}.reverse!\n rows[1..].each do |row|\n row[:validation_errors].append(:duplicate)\n end\n end\n\n grouped_data.transform_values(&:count).count { |k,v| v > 1 }\n end", "title": "" }, { "docid": "11ad0b5790a20ff3d9578feb2c8ddcca", "score": "0.5066863", "text": "def check_duplicate_item(db, tbl,field_name,value)\r\n check_command = \"Select * from ? where ? = ?\",[tbl, field_name,value]\r\n if db.execute(check_command).length > 0\r\n return true\r\n else \r\n return false \r\n end \r\nend", "title": "" }, { "docid": "b7e64e2d6181ac9decc60597d84e4669", "score": "0.50605136", "text": "def victory_column?(column_values)\n unique_values = column_values.uniq\n one_unique_value?(unique_values)\nend", "title": "" }, { "docid": "e66381e2c88ee52b43925c2a0bd1dab5", "score": "0.5047391", "text": "def valid_column?(index)\n column_values = column(index).compact\n column_values == column_values.uniq\n end", "title": "" }, { "docid": "58beef5b4891e2cae5783560ad12893b", "score": "0.5038243", "text": "def duplicate!(**args)\n self.dont_create_legend_item = true\n duplicate = super(args)\n return duplicate if duplicate.new_record? || duplicate.errors.present?\n\n duplicate\n end", "title": "" }, { "docid": "05108f1f514ce1c70e53205ac75e2461", "score": "0.50378275", "text": "def _update_without_checking(columns)\n if use_prepared_statements_for?(:update)\n _set_prepared_statement_server(model.send(:prepared_update, columns.keys)).call(Hash[columns].merge!(pk_hash))\n else\n super\n end\n end", "title": "" }, { "docid": "870b6d3a637e66596dc836751518ea31", "score": "0.50318843", "text": "def has_key?(name)\n @result_set ? @callsite.columns_hash.has_key?(name) : super || @monitored_columns.has_key?(name)\n end", "title": "" }, { "docid": "0743346a9e1dfdd0b0337be3f11c4a53", "score": "0.50317705", "text": "def _update_columns(columns)\n _update(columns) unless columns.empty?\n end", "title": "" }, { "docid": "3852052fe8e0ec2fe7a6304f1089ec9a", "score": "0.5022936", "text": "def column=(_); end", "title": "" }, { "docid": "ed489ff878d44ddbb66ae7f268193747", "score": "0.50167", "text": "def duplicate?(person)\n return false if self.id == person.id\n # FIXME: more sophisticated dup check, please\n #self.display_name == person.display_name\n self.firstname == person.firstname\n end", "title": "" }, { "docid": "75250257c69f26911944143edab6b872", "score": "0.5012148", "text": "def sql_for_on_duplicate_key_ignore( table_name, *args ) # :nodoc:\n arg = args.first\n conflict_target = sql_for_conflict_target( arg ) if arg.is_a?( Hash )\n \" ON CONFLICT #{conflict_target}DO NOTHING\"\n end", "title": "" }, { "docid": "caa393dd8473874224f8833ccf8dd827", "score": "0.49950716", "text": "def merge_with(other, unique_id_col = 'id')\n raise \"unmergable objects\" if other.class.column_names != self.class.column_names || self.send(unique_id_col.to_sym) != other.send(unique_id_col.to_sym)\n\n column_names = self.class.column_names\n\n self.trackzored_columns.each do |tc|\n has_updated_by_col = column_names.include?(\"#{tc}_updated_by\")\n has_updated_at_col = column_names.include?(\"#{tc}_updated_at\")\n \n if has_updated_at_col\n self_time = self.send(\"#{tc}_updated_at\".to_sym)\n other_time = other.send(\"#{tc}_updated_at\".to_sym)\n else\n self_time = self.updated_at\n other_time = other.updated_at\n end\n\n if self_time.nil? || (!other_time.nil? && other_time > self_time)\n self.send(\"#{tc}_updated_at=\".to_sym, other_time) if has_updated_at_col\n self.send(\"#{tc}_updated_by=\".to_sym, other.send(\"#{tc}_updated_by\".to_sym)) if has_updated_by_col\n self.send(\"#{tc}=\".to_sym, other.send(tc.to_sym))\n end\n end\n\n if other.updated_at > self.updated_at\n (column_names - self.trackzored_columns - self.trackzor_maintained_columns).each do |c|\n self.send(\"#{c}=\".to_sym, other.send(c.to_sym))\n end\n end\n\n puts \"Merged #{self.send(unique_id_col.to_sym)}: #{self.changes.inspect}\" unless self.changes.empty?\n self.send(:update_without_callbacks)\n end", "title": "" }, { "docid": "0695fea1f8e3027134dc32fccdaeed93", "score": "0.49922985", "text": "def columns=(value)\n return if @columns == value\n @columns = value\n refresh\n end", "title": "" }, { "docid": "e3435188188ec1fdba1f5cd5e33186f2", "score": "0.49645773", "text": "def get_column_conflict!(column)\n @get_column_conflicts[column.to_sym] = @get_column_conflicts[column.to_s] = column.to_sym\n end", "title": "" }, { "docid": "eeab26d175f9e0947babe0b8c38d0633", "score": "0.496154", "text": "def update\n $all_columns.each do |col|\n col[0] = col[1].call unless col[1].nil?\n end\nend", "title": "" }, { "docid": "3a965501d4431ee17dc32a55fb193bbf", "score": "0.49571857", "text": "def duplicate?\n @duplicate == true\n end", "title": "" }, { "docid": "c17f5f16821cf96e94644e5a64416c6a", "score": "0.49561802", "text": "def expected_columns; end", "title": "" }, { "docid": "b19c2ea79343aa3641087e1af859d3b2", "score": "0.4950881", "text": "def duplicate(&block)\n @on_duplicate = block\n end", "title": "" }, { "docid": "6ce225b85b6436c76ae4e75cb3148028", "score": "0.49431372", "text": "def updateColumns ws,srcColumn,srcHash,destColumn,writeNew = false\r\n row = 1\r\n keys = srcHash.keys\r\n #as long as the cell content is not nill\r\n while value = ws.cells(row,srcColumn).value\r\n #check if the contents of the srcColumn is present in the given hash\r\n if keys.include? value\r\n ws.cells(row,destColumn).value = srcHash[value]\r\n\t\t\t#Delete the entry , after writing into the excel\r\n\t\t\tsrcHash.delete value\r\n end\r\n\t\trow = row + 1\r\n end \r\n\t#check if new values should be written\r\n\tsrcHash.clear unless writeNew\r\n\r\n\t#Write the remaining entries in the excel sheet\r\n\tsrcHash.each do |key, value|\r\n\t\t#Since the key dint exist originally, write that as well\r\n\t\tws.cells(row,srcColumn).value = key\r\n\t\tws.cells(row,destColumn).value = srcHash[key]\r\n\t\trow = row + 1\r\n\tend\r\n \r\nend", "title": "" }, { "docid": "65679269c0b3c3e009e14568752f570d", "score": "0.49236032", "text": "def log_row(row)\n #overwrite this class\n end", "title": "" }, { "docid": "de7cfc95d102497f57274f9cb5cecfdc", "score": "0.49203146", "text": "def new_column_access(name)\n if @callsite.columns_hash.has_key?(name)\n @result_set.reload! if @result_set && name != @callsite.primary_key\n Callsites.add_seen_column(@callsite, name)\n end\n @monitored_columns[name]\n end", "title": "" }, { "docid": "57f320cf59f0c010380ff8e718c497a9", "score": "0.49119318", "text": "def changed_columns\n cc = super\n cc = cc.dup if frozen?\n deserialized_values.each{|c, v| cc << c if !cc.include?(c) && original_deserialized_value(c) != v} \n cc\n end", "title": "" }, { "docid": "ca69f4d7f917cb1ba300bc3e8eb4ab2a", "score": "0.4910312", "text": "def create!\n Upsert.logger.info \"[upsert] Creating or replacing database function #{name.inspect} on table #{table_name.inspect} for selector #{selector_keys.map(&:inspect).join(', ')} and setter #{setter_keys.map(&:inspect).join(', ')}\"\n\n selector_column_definitions = column_definitions.select { |cd| selector_keys.include?(cd.name) }\n setter_column_definitions = column_definitions.select { |cd| setter_keys.include?(cd.name) }\n update_column_definitions = setter_column_definitions.select { |cd| cd.name !~ CREATED_COL_REGEX && !options[\"ignore_on_update\"].include?(cd.name) }\n\n first_try = true\n connection.execute(%{\n CREATE OR REPLACE FUNCTION #{name}(#{(selector_column_definitions.map(&:to_selector_arg) + setter_column_definitions.map(&:to_setter_arg)).join(', ')}) RETURNS VOID AS\n $$\n DECLARE\n first_try INTEGER := 1;\n BEGIN\n LOOP\n -- first try to update the key\n UPDATE #{quoted_table_name} SET #{update_column_definitions.map(&:to_setter).join(', ')}\n WHERE #{selector_column_definitions.map(&:to_selector).join(' AND ') };\n IF found THEN\n RETURN;\n END IF;\n -- not there, so try to insert the key\n -- if someone else inserts the same key concurrently,\n -- we could get a unique-key failure\n BEGIN\n INSERT INTO #{quoted_table_name}(#{setter_column_definitions.map(&:quoted_name).join(', ')}) VALUES (#{setter_column_definitions.map(&:to_setter_value).join(', ')});\n RETURN;\n EXCEPTION WHEN unique_violation THEN\n -- seamusabshere 9/20/12 only retry once\n IF (first_try = 1) THEN\n first_try := 0;\n ELSE\n RETURN;\n END IF;\n -- Do nothing, and loop to try the UPDATE again.\n END;\n END LOOP;\n END;\n $$\n LANGUAGE plpgsql;\n })\n rescue\n if first_try and $!.message =~ /tuple concurrently updated/\n first_try = false\n retry\n else\n raise $!\n end\n end", "title": "" }, { "docid": "b0e1317786db2bd3b3bdc77139483f76", "score": "0.49085626", "text": "def should_be_wrong_duplicated_name(wrong_artist = @wrong_artist)\n validate_column_errors(wrong_artist, :name, false, 'activerecord.errors.messages.taken')\n end", "title": "" }, { "docid": "3c1cf45275f4fde0db3427aa5918e2c0", "score": "0.49083483", "text": "def apply_with_context(sql,all_cols,keys_in_all_cols)\n hits = {}\n @pending_rcs.each do |rc|\n hits[rc.key] = rc\n end \n hist = []\n n = 2\n pending = 0\n skipped = false\n noted = false\n last_row = nil\n @db1.fetch(sql,all_cols + [\"__coopy_tag__\"]) do |row|\n tag = row.pop.to_i\n k = keyify(row.values_at(*keys_in_all_cols))\n if hits[k]\n emit_skip(row) if skipped\n hist.each do |row0|\n cells = row0.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n end\n hist.clear\n pending = n\n @patch.apply_row(hits[k])\n hits.delete(k)\n skipped = false\n noted = true\n elsif tag == 1\n # ignore redundant row\n elsif pending>0\n emit_skip(row) if skipped\n cells = row.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n pending = pending-1\n skipped = false\n else\n hist << row\n if hist.length>n\n skipped = true\n last_row = row\n hist.shift\n end\n end\n end\n emit_skip(last_row) if skipped and noted\n end", "title": "" }, { "docid": "3c1cf45275f4fde0db3427aa5918e2c0", "score": "0.49083483", "text": "def apply_with_context(sql,all_cols,keys_in_all_cols)\n hits = {}\n @pending_rcs.each do |rc|\n hits[rc.key] = rc\n end \n hist = []\n n = 2\n pending = 0\n skipped = false\n noted = false\n last_row = nil\n @db1.fetch(sql,all_cols + [\"__coopy_tag__\"]) do |row|\n tag = row.pop.to_i\n k = keyify(row.values_at(*keys_in_all_cols))\n if hits[k]\n emit_skip(row) if skipped\n hist.each do |row0|\n cells = row0.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n end\n hist.clear\n pending = n\n @patch.apply_row(hits[k])\n hits.delete(k)\n skipped = false\n noted = true\n elsif tag == 1\n # ignore redundant row\n elsif pending>0\n emit_skip(row) if skipped\n cells = row.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n pending = pending-1\n skipped = false\n else\n hist << row\n if hist.length>n\n skipped = true\n last_row = row\n hist.shift\n end\n end\n end\n emit_skip(last_row) if skipped and noted\n end", "title": "" }, { "docid": "3c1cf45275f4fde0db3427aa5918e2c0", "score": "0.49083483", "text": "def apply_with_context(sql,all_cols,keys_in_all_cols)\n hits = {}\n @pending_rcs.each do |rc|\n hits[rc.key] = rc\n end \n hist = []\n n = 2\n pending = 0\n skipped = false\n noted = false\n last_row = nil\n @db1.fetch(sql,all_cols + [\"__coopy_tag__\"]) do |row|\n tag = row.pop.to_i\n k = keyify(row.values_at(*keys_in_all_cols))\n if hits[k]\n emit_skip(row) if skipped\n hist.each do |row0|\n cells = row0.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n end\n hist.clear\n pending = n\n @patch.apply_row(hits[k])\n hits.delete(k)\n skipped = false\n noted = true\n elsif tag == 1\n # ignore redundant row\n elsif pending>0\n emit_skip(row) if skipped\n cells = row.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n pending = pending-1\n skipped = false\n else\n hist << row\n if hist.length>n\n skipped = true\n last_row = row\n hist.shift\n end\n end\n end\n emit_skip(last_row) if skipped and noted\n end", "title": "" }, { "docid": "54474ae40ab54611dcf8dc9a5daa55a7", "score": "0.49058786", "text": "def merge(dupe)\n return false if self == dupe\n dupe.traits.update_all(master_trait_id: self.id)\n dupe.destroy\n end", "title": "" }, { "docid": "db94fcae57a9494720d3223c67a17fb5", "score": "0.49052244", "text": "def process_rows!\n # Correct incorrect rows in the table\n table.each do |row|\n row_metric = row[\"metric\"] # perf optimization\n # TODO inject Saikuro reference\n if row_metric == :saikuro\n fix_row_file_path!(row)\n end\n tool_tables[row_metric] << row\n file_tables[row[\"file_path\"]] << row\n class_tables[row[\"class_name\"]] << row\n method_tables[row[\"method_name\"]] << row\n end\n end", "title": "" }, { "docid": "b4d87805fe196e4bdc1fbd843362f9b7", "score": "0.49036556", "text": "def should_be_wrong_duplicated_name(wrong_album = @wrong_album)\n validate_column_errors(wrong_album, :name, false, 'activerecord.errors.messages.taken')\n end", "title": "" }, { "docid": "5d89890e8ba84fa5ceeb74edf33f7556", "score": "0.49013537", "text": "def set_column_conflict!(column)\n @set_column_conflicts[:\"#{column}=\"] = @set_column_conflicts[\"#{column}=\"] = column.to_sym\n end", "title": "" }, { "docid": "a10be3ce2c1f6ec7a68228ca9cf5bf2d", "score": "0.4897328", "text": "def _update_without_checking(columns)\n _update_dataset.update(columns)\n end", "title": "" }, { "docid": "a10be3ce2c1f6ec7a68228ca9cf5bf2d", "score": "0.4897328", "text": "def _update_without_checking(columns)\n _update_dataset.update(columns)\n end", "title": "" }, { "docid": "736722b08760fa51dc58698319468f07", "score": "0.48920557", "text": "def duplicable?\n true\n end", "title": "" }, { "docid": "f8c614910a34c4636e9a3f0d6d0a8341", "score": "0.4889697", "text": "def duplicate\n dup.tap do |c|\n c.page = nil\n columns.each do |column|\n c.columns << column.duplicate\n end\n pictures.each do |picture|\n c.pictures << picture.duplicate\n end\n end\n end", "title": "" }, { "docid": "3af95c0e270099845ddf61917e5ba7f3", "score": "0.4885902", "text": "def valid_data_columns?\n revision_missmatch = get_revision_sheet_numbers.any? { |number| column_headings_revision(number) != REVISION_COLUMN_HEADINGS }\n\n if column_headings_ready_for_web != READY_FOR_WEB_COLUMN_HEADINGS || revision_missmatch\n message = 'Endorser spreadsheet columns have been re-arranged or modified. Unable to sync'\n LOG.error(message)\n send_email(message)\n return false\n end\n true\n end", "title": "" }, { "docid": "d85b9e1861f56f030dc99ea99aafea51", "score": "0.48780328", "text": "def validate_slug_columns\n raise ArgumentError, \"Source column '#{self.slug_source}' does not exist!\" if !self.respond_to?(self.slug_source)\n raise ArgumentError, \"Slug column '#{self.slug_column}' does not exist!\" if !self.respond_to?(\"#{self.slug_column}=\")\n end", "title": "" }, { "docid": "8506715b1126c7eef653035d82e43542", "score": "0.4876089", "text": "def update!(**args)\n @column = args[:column] if args.key?(:column)\n @description = args[:description] if args.key?(:description)\n @dimension = args[:dimension] if args.key?(:dimension)\n @ignore_null = args[:ignore_null] if args.key?(:ignore_null)\n @name = args[:name] if args.key?(:name)\n @non_null_expectation = args[:non_null_expectation] if args.key?(:non_null_expectation)\n @range_expectation = args[:range_expectation] if args.key?(:range_expectation)\n @regex_expectation = args[:regex_expectation] if args.key?(:regex_expectation)\n @row_condition_expectation = args[:row_condition_expectation] if args.key?(:row_condition_expectation)\n @set_expectation = args[:set_expectation] if args.key?(:set_expectation)\n @statistic_range_expectation = args[:statistic_range_expectation] if args.key?(:statistic_range_expectation)\n @table_condition_expectation = args[:table_condition_expectation] if args.key?(:table_condition_expectation)\n @threshold = args[:threshold] if args.key?(:threshold)\n @uniqueness_expectation = args[:uniqueness_expectation] if args.key?(:uniqueness_expectation)\n end", "title": "" }, { "docid": "0a7a6a38ff84507adebfe0347225ac7b", "score": "0.48753673", "text": "def synthetic_columns\n @columns ||= [:id]\n end", "title": "" }, { "docid": "a7e05305e3d164b0f1b27d20738d513b", "score": "0.486367", "text": "def exsiting_columns_for_audit\n columns_for_audit & self.column_names\n end", "title": "" }, { "docid": "f794b8aba87d3d94b3b6ae42a40be05d", "score": "0.48591402", "text": "def unique_record_check(record,row)\n #recupero tutte le info necessarie per memorizzare la chiave primaria\n plot_id = Plot.find(:first,:conditions => [\"numero_plot = ? AND deleted = false\",record.cod_plot]).id\n active_campaign_id = Campagne.find(:first,:conditions => [\"active = true\"]).id\n file = ImportFile.find(session[:file_id])\n #cerco la chiave primaria\n pk = Copl.find(:first,:conditions => [\"campagne_id = ? AND plot_id = ? AND subplot = ? AND in_out = ? AND priest = ? AND file_name_id = ? AND import_num = ?\", active_campaign_id, plot_id, record.subplot, record.in_out, record.priest, file.id, file.import_num])\n #se già è presente\n if pk\n #salvo l'errore\n save_error(record,\"Duplicate row\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n end", "title": "" }, { "docid": "29c21b5380e25354629d73c1b59672be", "score": "0.48573273", "text": "def row_skipped_columns\n ManifestItemDecorator.send(__method__)\n end", "title": "" }, { "docid": "da7c2d1345bead837b157fd46463215d", "score": "0.48494017", "text": "def clone(opts = OPTS)\n c = super(:freeze=>false)\n c.opts.merge!(opts)\n unless opts.each_key{|o| break if COLUMN_CHANGE_OPTS.include?(o)}\n c.clear_columns_cache\n end\n c.freeze if frozen?\n c\n end", "title": "" }, { "docid": "7f4047194999b776168dc24e71f27888", "score": "0.4847305", "text": "def includeColumn? (col)\n return @cols.nil? ? true : @cols.member?(col)\nend", "title": "" }, { "docid": "ff1cdb6c3b93ce2ba603d7531ab58ab8", "score": "0.48470625", "text": "def duplicate_entry?(entry_hash)\n unless entry_hash.include? \"id\" # conditional for record updates\n formatted = format_hash(entry_hash)\n db_hash = get_entry(formatted[\"fname\"], formatted[\"lname\"])\n difference = (formatted.to_a - db_hash.to_a).flatten\n difference.size > 0 ? false : true\n else\n false\n end\nend", "title": "" } ]
09c27c91b6739ffc032e95908572940e
GET /article_categories/1 GET /article_categories/1.xml
[ { "docid": "0d7b9d99e3a105c3be3468b1cf8b1418", "score": "0.0", "text": "def show\n @article_category = ArticleCategory.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml do\n result=Array.new\n @article_category.articles.each do |article|\n hash = Hash.new\n hash[:title] = article.title\n hash[:subtitle] = article.subtitle\n hash[:url] = \"/article_bb/#{article.id}\"\n hash[:gallery_url] = \"/articles/#{article.id}.xml\"\n hash[:date] = article.date\n if article.gallery_items != []\n hash[:thumbnail] = article.gallery_items[0].image.url(:iphone_thumb).gsub(/\\?.*$/, \"\").gsub(\" \", \"%20\")\n end\n # hash[:thumbnails] = Array.new\n # hash[:gallery_photos] = Array.new\n # article.gallery_items.each do |gallery_item|\n # hash[:thumbnails].push gallery_item.image.url(:iphone_thumb).gsub(/\\?.*$/, \"\").gsub(\" \", \"%20\")\n # hash[:gallery_photos].push gallery_item.image.url(:iphone_gallery).gsub(/\\?.*$/, \"\").gsub(\" \", \"%20\")\n # end\n result.push hash\n end\n render :xml => result\n end\n \n # format.json do\n # result_hash= Array.new\n # articles = @article_category.articles\n # 0.upto(@article_category.articles.size()-1) do |article_id|\n # article = articles[article_id]\n # hash = Hash.new\n # hash[:title] = article.title\n # hash[:category] = article.article_category.name.upcase\n # hash[:date] = article.date\n # hash[:id] = article.id\n # result_hash.push hash\n # end\n # render :json => result_hash.to_json\n # end\n end\n end", "title": "" } ]
[ { "docid": "8fb11c432a8bb2c5fc11d5fb6181b5b5", "score": "0.7126932", "text": "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end", "title": "" }, { "docid": "9ea8a3f2836b2e8526538d1018c0c774", "score": "0.71189326", "text": "def index\n @article_categories = ArticleCategory.find(:all, :order => \"parent_id, position\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @article_categories }\n end\n end", "title": "" }, { "docid": "d87e111810c0a38c399e04fbe6fe671d", "score": "0.70971406", "text": "def show\n @article = Article.find(params[:id])\n @categories = Category.find(:all)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "bd7f457291ea26e7a11c69e4c64b3fd9", "score": "0.7067351", "text": "def fetch_categories\n xml = \"Request categories.\"\n respond_with_raw get(\"#{BASE_URL}/v1/categories?api_key=#{API_KEY}&format=json\", :body => xml)\n end", "title": "" }, { "docid": "47034e1c46c886a820036f64ac9e53a0", "score": "0.7013637", "text": "def index\n @articles = Article.find(:all, :order => \"date\")\n @categories = Category.find(:all)\n\t \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "title": "" }, { "docid": "cad28eef5538ca6fabd1c8b1cf5bd5f9", "score": "0.6926834", "text": "def show\n @article_category = ArticleCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article_category }\n end\n end", "title": "" }, { "docid": "7e20e04f5e44b782f9204d73a41464a7", "score": "0.6855748", "text": "def index\n @categories = Category.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @categories.to_xml }\n end\n end", "title": "" }, { "docid": "54aa4c8c20092a0b80b29557694dbcac", "score": "0.6853704", "text": "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "title": "" }, { "docid": "54aa4c8c20092a0b80b29557694dbcac", "score": "0.6853704", "text": "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "title": "" }, { "docid": "54aa4c8c20092a0b80b29557694dbcac", "score": "0.6853704", "text": "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "title": "" }, { "docid": "bcce0a9c1791f220b6c10a19ac98a209", "score": "0.68520236", "text": "def index\n @roots_categories = Category.roots\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @roots_categories }\n end\n end", "title": "" }, { "docid": "aee2ade1b902220f2f3662a41d451de8", "score": "0.6838723", "text": "def new\n @article = Article.new\n @articles = Article.root_articles\n @categories = Category.all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "e685111b0bb38fba7ab7ca4efc64ca36", "score": "0.6814244", "text": "def index \n @description = t('activerecord.models.category')\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "title": "" }, { "docid": "818f5e37547be6c9808f48cd5ed2e91c", "score": "0.67615885", "text": "def index\r\n @categories = Category.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @categories }\r\n end\r\n end", "title": "" }, { "docid": "59e21b8fe3f9172997b302fee35904b2", "score": "0.67515004", "text": "def index\n @articles = Article.find(:all, :conditions => {:category => \"Support\"})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "title": "" }, { "docid": "bba7206e5be05b1b24415abe9d5b6db5", "score": "0.6733922", "text": "def index\n @doc_categories = DocCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @doc_categories }\n end\n end", "title": "" }, { "docid": "a279000b29ab419a8a7a43c6b3055cef", "score": "0.67153084", "text": "def new\n @article = Article.new\n @categories = Category.all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "f0de27cd4b744b81008c2bbb7cfc727f", "score": "0.6651187", "text": "def index\n @attcategories = Attcategory.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @attcategories }\n end\n end", "title": "" }, { "docid": "07e24113e966eca8802aee307eba6809", "score": "0.6632362", "text": "def index\n @encategories = Encategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @encategories }\n end\n end", "title": "" }, { "docid": "1eafe466b91dd57dd1de7ec5897bfa67", "score": "0.6624454", "text": "def index\n @categories = Category.all\n\t\tif params[:id]\n\t\t\t@category = Category.find(params[:id])\n\t\telse\n\t\t\t@category = Category.new\n\t\tend\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "title": "" }, { "docid": "c7753c6bfdfa615f6af40be2ed9f4b99", "score": "0.6602482", "text": "def index\n #@categories = Category.all\n @categories = Category.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "title": "" }, { "docid": "f87619d2f6d6e34efc415db1ad503e16", "score": "0.65599406", "text": "def index\n @blog_categories = BlogCategory.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blog_categories }\n end\n end", "title": "" }, { "docid": "dcacf4733098e57b0b78cc4918c8b21c", "score": "0.6551331", "text": "def index\n @categories = @categories.page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "title": "" }, { "docid": "d04b2eb0afd3e6ac3fc85200508e0494", "score": "0.6550246", "text": "def index\n @categorizations = Categorization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categorizations }\n end\n end", "title": "" }, { "docid": "3ae724fe6d3240db10059f27f94272e6", "score": "0.6514564", "text": "def new\n @article = Article.new\n\t @categories = Category.find(:all)\n\t \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "efcb5e10780279c84a4be599091f0268", "score": "0.6513479", "text": "def categories\n call_api('/categories')\n end", "title": "" }, { "docid": "a9ec0b769338dd03f96bbc1f1971bed8", "score": "0.64996576", "text": "def new\n @article = Article.new\n @category = Category.all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "ea9449e4d7ef91087ef325348e162a4e", "score": "0.64891696", "text": "def index\n @categories = Category.find(:all, :conditions => [\"parent_id = ?\", 0])\n respond_to do |format|\n format.html { render :layout => 'home'}\n format.xml { render :xml => @contents }\n end\n end", "title": "" }, { "docid": "a6e6186288f36ccc7883af9370545e42", "score": "0.6480513", "text": "def index\n @concept_categories = ConceptCategory.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @concept_categories.to_xml }\n end\n end", "title": "" }, { "docid": "10236746ce328c38e4657c582d493303", "score": "0.64755976", "text": "def index\n \n id = SecureRandom.uuid.to_s\n\n category_info = {:id => id, :type => \"index\" }\n\n publish :category, JSON.generate(category_info) \n\n @categories = get_categories(id) \n end", "title": "" }, { "docid": "7933f6c35b3764540c81836a084f4073", "score": "0.6467591", "text": "def index\n @article_categories = ArticleCategory.all\n end", "title": "" }, { "docid": "01b092e0513ee8063e59c8a781c62a50", "score": "0.6452745", "text": "def index\n @diagnosis_items = DiagnosisItem.categories\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @diagnosis_items }\n end\n end", "title": "" }, { "docid": "0db130fb5f5d85808d358ae54e3699f7", "score": "0.6435093", "text": "def index\n @linkcategories = Linkcategory.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @linkcategories }\n end\n end", "title": "" }, { "docid": "98a2ad8b862e61cc42e48435fb6552f4", "score": "0.6409418", "text": "def index\n @news_categories = NewsCategory.paginate(:page=>params[:page], :per_page=>20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @news_categories }\n end\n end", "title": "" }, { "docid": "2945a28bb96d35168e5517ad9f53994c", "score": "0.64074105", "text": "def index\n\n #if I18n.available_locales.count > 1\n @categories = Category.active.ordered.with_translations(I18n.locale)\n #else\n # @categories = Category.active.alpha\n #end\n @page_title = I18n.t :knowledgebase, default: \"Knowledgebase\"\n @title_tag = \"#{AppSettings['settings.site_name']}: \" + @page_title\n @meta_desc = \"Knowledgebase for #{AppSettings['settings.site_name']}\"\n @keywords = \"Knowledgebase, Knowledge base, support, articles, documentation, how-to, faq, frequently asked questions\"\n add_breadcrumb @page_title, categories_path\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "title": "" }, { "docid": "86e5d5637eeb2a8cc989235e83e67c7b", "score": "0.6403274", "text": "def get\n payload = {}\n @client.post('categories/get', payload)\n end", "title": "" }, { "docid": "5af0f9bfd11a1dfbeeb007be39c88f81", "score": "0.63934624", "text": "def index\n authorize! :index, @user, :message => 'Not authorized as an administrator.'\n @categories = Category.nested_set.select(:id, :title, :content, :secret_field, :parent_id, :lft, :rgt, :depth).paginate(:page => params[:page]).order('id DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n format.xml { render xml: Category.all }\n end\n end", "title": "" }, { "docid": "5c1bf3c25ebfe500ccf237c44d162546", "score": "0.6366659", "text": "def show\n @news_category = NewsCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_category }\n end\n end", "title": "" }, { "docid": "498bb395c9de374a81754fe295b40d73", "score": "0.63647294", "text": "def index\n @categories = Admin::Category.top\n @parent=nil\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "title": "" }, { "docid": "eaab05de1a1bddc332dbca93e792625e", "score": "0.6364005", "text": "def index\n get_categories\n @admin_articles = Admin::Article.all\n end", "title": "" }, { "docid": "9f7fb485e5f5560554eac5ea8c5c9855", "score": "0.63403296", "text": "def new\n @article_category = ArticleCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article_category }\n end\n end", "title": "" }, { "docid": "9f7fb485e5f5560554eac5ea8c5c9855", "score": "0.63403296", "text": "def new\n @article_category = ArticleCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article_category }\n end\n end", "title": "" }, { "docid": "8e1abd1795c29bc436d5ced01a91a98d", "score": "0.6337683", "text": "def get_appcon_categories \n get(\"/appcon.json/categories\")\nend", "title": "" }, { "docid": "20a5c6098751edc78152ed9757ad2ce5", "score": "0.63282263", "text": "def list\n\t@itemcategories = Itemcategory.paginate :page => params[:page], :per_page => 10\n\t\trespond_to do |format|\t\t\n\t\tformat.html \n\t\tformat.xml { render :xml => @itemcategories }\t\t#Render to XML File\n\t\tend\n\tend", "title": "" }, { "docid": "ebfc40f4d2bfcfa8eb74a5784873631f", "score": "0.632233", "text": "def show\n @category = Category.active.where(id: params[:id]).first\n if I18n.available_locales.count > 1\n @docs = @category.docs.ordered.active.with_translations(I18n.locale).page params[:page]\n else\n @docs = @category.docs.ordered.active.page params[:page]\n end\n @categories = Category.active.alpha.with_translations(I18n.locale)\n @related = Doc.in_category(@doc.category_id) if @doc\n\n @page_title = @category.name\n @title_tag = \"#{AppSettings['settings.site_name']}: #{@page_title}\"\n @meta_desc = @category.meta_description\n @keywords = @category.keywords\n\n add_breadcrumb t(:knowledgebase, default: \"Knowledgebase\"), categories_path\n add_breadcrumb @page_title, category_path(@category)\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @category }\n end\n end", "title": "" }, { "docid": "6d2573a7dd7e66c6b090cb93914bf727", "score": "0.6297045", "text": "def categories!\n mashup(self.class.get(\"/\", :query => method_params('aj.categories.getList'))).categories.category\n end", "title": "" }, { "docid": "a2e0d0dbbc2ca24493f02eacb4ea3024", "score": "0.6292802", "text": "def show\n @category = Category.find(params[:id])\n @datasets = Dataset.find(:all, :conditions => {:category_id => @category.id, :status => \"Published\"}, :order=> \"name ASC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "title": "" }, { "docid": "41e7d8e2d53a696323eb710ee8e712fe", "score": "0.62910163", "text": "def index\n @field_categories = FieldCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @field_categories }\n end\n end", "title": "" }, { "docid": "572e2b9f1ae3e7359f17dc0f14d8d4fe", "score": "0.62882817", "text": "def show\n @category = Category.find(params[:id])\n @articles = @category.articles\n end", "title": "" }, { "docid": "2c464cfbce0d33a7dcc3c2f96d3efd84", "score": "0.6285323", "text": "def index \n @forum_cat_l2s = ForumCatL2.find(:all, :include => [:forum_posts => :forum_replies])\n @categories = ForumCatL1.find(:all)\n @page_description = t(:forums_descriptions)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @forum_cat_l2s }\n end\n end", "title": "" }, { "docid": "da10a8908c77e40b82f2337e3f7bfb57", "score": "0.6269588", "text": "def index\n @articles = Article.all\n @categories = Category.all\n end", "title": "" }, { "docid": "da10a8908c77e40b82f2337e3f7bfb57", "score": "0.6269588", "text": "def index\n @articles = Article.all\n @categories = Category.all\n end", "title": "" }, { "docid": "d6c4e1b73ef1f8047357582b99fa8b67", "score": "0.6265979", "text": "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @category.to_xml }\n end\n end", "title": "" }, { "docid": "efc35168bf3165d0b116ff487abf7feb", "score": "0.6255602", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "title": "" }, { "docid": "9a46c6f09a849b4df51149009ea2dd30", "score": "0.6254183", "text": "def index\n @cats = Cat.all\n\n respond_to do |format|\n format.json\n format.xml { render xml: @cats, status: 200 }\n end\n end", "title": "" }, { "docid": "2f82187ab60cbc34240a20a16a986947", "score": "0.6253157", "text": "def show\n @doc_category = DocCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @doc_category }\n end\n end", "title": "" }, { "docid": "eb562fa6e6e097e20d93a711322b0e55", "score": "0.62486076", "text": "def index\n @categories = Category.find(:all, :order => 'lft ASC')\n @me = Category.find_by_parent_id(nil).all_children_count\n # @tree = growTree\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "title": "" }, { "docid": "7200f3d909b781dc54f55e26e317394b", "score": "0.6236606", "text": "def index\n @categories = Category.all\n @article2s = Article.all\n end", "title": "" }, { "docid": "422b13dc8f6664482d03cb3902e4fe38", "score": "0.6233878", "text": "def show\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "title": "" }, { "docid": "dd400f17747d90fefb21ff5f26134366", "score": "0.6233525", "text": "def index\n @photo_categories = PhotoCategory.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photo_categories.to_xml(:skip_types => true) }\n end\n end", "title": "" }, { "docid": "40e362931c1bbbc502b6fa90585992d1", "score": "0.62286925", "text": "def new\n @category = Category.new\n\n respond_to do |format|\n format.xml\n end\n end", "title": "" }, { "docid": "470ada68900a96eeb7880b790a59749d", "score": "0.6225751", "text": "def index\n @outlay_categories = @house_book.outlay_categories\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @outlay_categories }\n end\n end", "title": "" }, { "docid": "b717c71ec0e74c2967ba181960a4aefc", "score": "0.62208486", "text": "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "title": "" }, { "docid": "b717c71ec0e74c2967ba181960a4aefc", "score": "0.62208486", "text": "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "title": "" }, { "docid": "b717c71ec0e74c2967ba181960a4aefc", "score": "0.62208486", "text": "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "title": "" }, { "docid": "b717c71ec0e74c2967ba181960a4aefc", "score": "0.62208486", "text": "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "title": "" }, { "docid": "5a81bb0aab50c059c28f2aaf40464bb0", "score": "0.62193286", "text": "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "title": "" }, { "docid": "5a81bb0aab50c059c28f2aaf40464bb0", "score": "0.62193286", "text": "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "title": "" }, { "docid": "5a81bb0aab50c059c28f2aaf40464bb0", "score": "0.62193286", "text": "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "title": "" }, { "docid": "5a81bb0aab50c059c28f2aaf40464bb0", "score": "0.62193286", "text": "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "title": "" }, { "docid": "5a81bb0aab50c059c28f2aaf40464bb0", "score": "0.62193286", "text": "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "title": "" }, { "docid": "5a81bb0aab50c059c28f2aaf40464bb0", "score": "0.62193286", "text": "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "title": "" }, { "docid": "5a81bb0aab50c059c28f2aaf40464bb0", "score": "0.62193286", "text": "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "title": "" }, { "docid": "5a81bb0aab50c059c28f2aaf40464bb0", "score": "0.62193286", "text": "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "title": "" }, { "docid": "5a81bb0aab50c059c28f2aaf40464bb0", "score": "0.62193286", "text": "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "title": "" }, { "docid": "5a81bb0aab50c059c28f2aaf40464bb0", "score": "0.62188387", "text": "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "title": "" }, { "docid": "8742c0d66e276819e083b7f1d700166a", "score": "0.6213143", "text": "def index\n @articles = Article.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "title": "" }, { "docid": "3daa3c9091d83cac3b53a2ca20088498", "score": "0.621043", "text": "def categories(params={})\r\n url = api_url \"/categories\"\r\n req = request_params({currency: @currency, locale: @locale}.merge(params))\r\n \r\n feed_or_retry do\r\n RestClient.get url, req\r\n end \r\n end", "title": "" }, { "docid": "6c85d4e66ba7c4368b00d86daaa70d5d", "score": "0.6203383", "text": "def index\n # check main category\n if params[:cat]\n # show categories\n category = Category.find_by_id(params[:cat])\n if !category.nil?\n @categories = category.children\n else\n flash[:error] = t(:category_not_found)\n @categories = nil\n end\n else\n # show all categories\n @categories = Category.subcategory\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "title": "" }, { "docid": "b56268790ce4fd4686b085e9709939a8", "score": "0.6194432", "text": "def show\n @category = Category.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "title": "" }, { "docid": "b56268790ce4fd4686b085e9709939a8", "score": "0.6194432", "text": "def show\n @category = Category.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "title": "" }, { "docid": "ea4b3d55faa47ca50b71dda1cf3ab80f", "score": "0.6188256", "text": "def show\n\t@itemcategory = Itemcategory.find(params[:id])\n\t\trespond_to do |format|\t\t\n\t\tformat.html \n\t\tformat.xml { render :xml => @itemcategories }\t\t#Render to XML File\n\t\tend\n\tend", "title": "" }, { "docid": "c31f957cc3a0ed9ef3631674b4102258", "score": "0.61867255", "text": "def category\n # Whats the last category we are asking for? (the rest don't matter I don't think..)\n requested_category = params[:category].split(\"/\").last\n category = Taxonomy.find_by_seo_url requested_category\n\n if category.present?\n @contents = ContentDecorator.decorate(get_contents category.contents, { :state => :published, :is_indexable => true, :is_sticky => false, :password => nil })\n\n respond_to do |format|\n format.html { render :template => 'default/index' }\n format.json { render json: @contents }\n end\n else\n # No such category found, redirect to root index\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "9b2ae244078a489c28d52b4984ce970f", "score": "0.61864257", "text": "def index\n @articles = Article.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "title": "" }, { "docid": "9b2ae244078a489c28d52b4984ce970f", "score": "0.61864257", "text": "def index\n @articles = Article.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "title": "" }, { "docid": "0cd7138bd54947d9fa780cd133dd2571", "score": "0.61861885", "text": "def index\n @articles = Article.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml \n end\n end", "title": "" }, { "docid": "5dcc0e401eb6685f0364e1063bdd2b28", "score": "0.61763257", "text": "def show\n @categorization = Categorization.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @categorization }\n end\n end", "title": "" }, { "docid": "38192e94164bc5eab0fd532b60c2a11d", "score": "0.61664534", "text": "def index\n @title = 'Articles'\n if params[:category_id]\n @category = Category.find params[:category_id]\n @articles = @category.articles.order(:title).paginate page: params[:page]\n else\n @articles = Article.order(:title).paginate page: params[:page]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "title": "" }, { "docid": "0c884467e2739371bd4b20aa104de272", "score": "0.6146479", "text": "def index\n #@subcategories = Subcategory.find(:all).paginate :per_page => 10, :page => params[:page]\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subcategories }\n end\n end", "title": "" }, { "docid": "06b8935471936e29ade2d4cc33487774", "score": "0.61382914", "text": "def index\n if @topic.nil?\n @category_element_associations = @element.category_element_associations\n else\n @category_element_associations = @element.category_element_associations.all(:conditions => {:root_id => @topic.id})\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @category_element_associations }\n end\n end", "title": "" }, { "docid": "b7b1e4c10ab8174aa796e52ec580dc1b", "score": "0.6136205", "text": "def index\r\n get_item_categories \r\n end", "title": "" }, { "docid": "cf3af9e4b81ace96543c7517697fd1a8", "score": "0.6136032", "text": "def index\n @translated_titles = @category.translated_titles\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @translated_titles }\n end\n end", "title": "" }, { "docid": "c2f18350bf2cacb590a751dda95cbd4b", "score": "0.6135803", "text": "def index\n @subcategories = Subcategory.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subcategories }\n end\n end", "title": "" }, { "docid": "2b1588373e22ef62caea31adfe0dd343", "score": "0.6117786", "text": "def index\n @gallery_categories = GalleryCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @gallery_categories }\n end\n end", "title": "" }, { "docid": "77f6cccc9dd888f8e69504404f657d40", "score": "0.6113044", "text": "def index\n @articles = Article.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @articles.to_xml }\n end\n end", "title": "" }, { "docid": "2fcf1bbbfaaf790648ef4a1a59f526c6", "score": "0.61075294", "text": "def show\n @articles = category_articles\n end", "title": "" }, { "docid": "1a2078367db9592c1f14a918467ce6e4", "score": "0.6105039", "text": "def new\n @article = Article.new(:category_id =>params[:category_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "1f20fed4b13060106a5596a1784884c9", "score": "0.60936457", "text": "def index\n @articles = @current_department.articles.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "title": "" }, { "docid": "62482b30a217d0d577fdd13ea3e6bff7", "score": "0.6082483", "text": "def index\r\n @category_questions = CategoryQuestion.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @category_questions }\r\n end\r\n end", "title": "" }, { "docid": "0d1cffe07f684eecc6a37c63092e250f", "score": "0.6082059", "text": "def show\n @topic_category = TopicCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topic_category }\n end\n end", "title": "" }, { "docid": "a923f3214ccaea2f8988c0a042cad086", "score": "0.60812014", "text": "def show\r\n @category = Category.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @category }\r\n end\r\n end", "title": "" } ]
ca1c5d58debba8aabf61cb05b14cdf03
File activesupport/lib/active_support/core_ext/hash/reverse_merge.rb, line 17
[ { "docid": "a9b1924f105d809d777a825968723cbc", "score": "0.64788365", "text": "def fwf_reverse_merge!(other_hash)\n # right wins if there is no left\n merge!( other_hash ){|key,left,right| left }\n end", "title": "" } ]
[ { "docid": "3510460842b8e7c11a5592ac47934064", "score": "0.74726707", "text": "def reverse_merge(other_hash); end", "title": "" }, { "docid": "3510460842b8e7c11a5592ac47934064", "score": "0.74726707", "text": "def reverse_merge(other_hash); end", "title": "" }, { "docid": "3510460842b8e7c11a5592ac47934064", "score": "0.74726707", "text": "def reverse_merge(other_hash); end", "title": "" }, { "docid": "939514a6e5c29725d10752c17da016bc", "score": "0.7344521", "text": "def reverse_merge!(other_hash); end", "title": "" }, { "docid": "939514a6e5c29725d10752c17da016bc", "score": "0.7344521", "text": "def reverse_merge!(other_hash); end", "title": "" }, { "docid": "3e775f0e85124cd24b4ba6ce59d49c17", "score": "0.7041711", "text": "def reverse_duplicate_merge(hash); end", "title": "" }, { "docid": "059357a55d2fbf184adc9fc380dc5594", "score": "0.70157516", "text": "def reverse_merge(other_hash)\n super other_hash.with_indifferent_access\n end", "title": "" }, { "docid": "18512cf8d82a1b2731b92a2a7225eb7f", "score": "0.6962558", "text": "def reverse_merge(other_hash)\n\t\tsuper self.class.new_from_hash_copying_default(other_hash)\n\tend", "title": "" }, { "docid": "8fe3cd3a04a6c18237c0119f493de70e", "score": "0.6717548", "text": "def reverse_merge!(other_hash)\r\n replace(reverse_merge(other_hash))\r\n end", "title": "" }, { "docid": "399f7bfcd04d2148d2d1ec6095011882", "score": "0.665697", "text": "def reverse_merge! hash\n replace hash.merge(self)\n end", "title": "" }, { "docid": "fdce3460437a8d856d1544e2386abca0", "score": "0.6637557", "text": "def reverse_merge!(hash = {})\n hash.each_pair do |key, value|\n next unless self.try(:\"#{key.to_s}\")\n self.new_ostruct_member(:\"#{key.to_s}\")\n self.send(:\"#{key.to_s}=\", value)\n end\n end", "title": "" }, { "docid": "d3f0c417c4bc56d6473f08d02bef3c9e", "score": "0.6623696", "text": "def reverse_merge!(other_hash)\n replace(reverse_merge(other_hash))\n end", "title": "" }, { "docid": "fd2b309371e515fa296d0944171926cc", "score": "0.657444", "text": "def reverse_merge!(hash = {})\n hash.each_pair do |key, value|\n next unless self.try(:\"#{key.to_s}\")\n self.new_ostruct_member(:\"#{key.to_s}\")\n self.send(:\"#{key.to_s}=\", value)\n end\n end", "title": "" }, { "docid": "b3e1f381ab8caac06e1cdc1e6e8c24f3", "score": "0.6573826", "text": "def reverse_merge!(other_hash)\n replace(reverse_merge(other_hash))\n end", "title": "" }, { "docid": "b3e1f381ab8caac06e1cdc1e6e8c24f3", "score": "0.6573826", "text": "def reverse_merge!(other_hash)\n replace(reverse_merge(other_hash))\n end", "title": "" }, { "docid": "dbafa806502a7a4613b8ab544ffb5b6e", "score": "0.6572009", "text": "def _deep_merge(hash, other_hash); end", "title": "" }, { "docid": "2efbcdb6050c517014739cb2cf130007", "score": "0.6555263", "text": "def reverse_merge(other_hash)\n super self.class.new_from_hash_copying_default(other_hash)\n end", "title": "" }, { "docid": "cf7fc3784b88b23927bcb4225d2f97ae", "score": "0.65483785", "text": "def stringified_merge(target, other)\n other.each do |key, value|\n key = key.to_s # this line is what it's all about!\n existing = target[key]\n\n if value.is_a?(Hash) and (existing.is_a?(Hash) or existing.nil?)\n stringified_merge(existing || (target[key] = {}), value)\n else\n target[key] = value\n end\n end\n end", "title": "" }, { "docid": "3b5e7394dbb4e0ec3dbbc6fb024fab63", "score": "0.65411854", "text": "def deep_merge!(l_hash, r_hash); end", "title": "" }, { "docid": "43600235f15bc35988b6cd8c375dd310", "score": "0.65150005", "text": "def reverse_merge!(other_hash)\n replace(reverse_merge( other_hash ))\n end", "title": "" }, { "docid": "8c4c4840f2ad18e9756f41954b10344d", "score": "0.65116864", "text": "def merge!(other_hash); end", "title": "" }, { "docid": "1382920e6983eafdf6a303c6c251fc97", "score": "0.6508275", "text": "def merge(other_hash); end", "title": "" }, { "docid": "16cd3b115d8f31dce418c14a3592f18e", "score": "0.6495501", "text": "def infuse_with!(defaults)\n unless respond_to?(:symbolize_keys) and respond_to?(:reverse_merge!)\n raise \"Cannot infuse hash, try requiring active_support first\" \n end\n self.symbolize_keys!\n self.reverse_merge!(defaults)\n end", "title": "" }, { "docid": "eeb56d7d2d26d48d18dacde843c3c355", "score": "0.64632785", "text": "def reverse_merge!(other_hash)\n replace(reverse_merge(other_hash))\n end", "title": "" }, { "docid": "773ed56ffc4b31f873bc0af441b3fa79", "score": "0.6457275", "text": "def stringified_merge(target, other)\n other.each do |key, value|\n key = key.to_s # this line is what it's all about!\n existing = target[key]\n\n if value.is_a?(Hash) and (existing.is_a?(Hash) or existing.nil?)\n stringified_merge(existing || (target[key] = {}), value)\n else\n target[key] = value\n end\n end\n end", "title": "" }, { "docid": "773ed56ffc4b31f873bc0af441b3fa79", "score": "0.6457275", "text": "def stringified_merge(target, other)\n other.each do |key, value|\n key = key.to_s # this line is what it's all about!\n existing = target[key]\n\n if value.is_a?(Hash) and (existing.is_a?(Hash) or existing.nil?)\n stringified_merge(existing || (target[key] = {}), value)\n else\n target[key] = value\n end\n end\n end", "title": "" }, { "docid": "773ed56ffc4b31f873bc0af441b3fa79", "score": "0.6457275", "text": "def stringified_merge(target, other)\n other.each do |key, value|\n key = key.to_s # this line is what it's all about!\n existing = target[key]\n\n if value.is_a?(Hash) and (existing.is_a?(Hash) or existing.nil?)\n stringified_merge(existing || (target[key] = {}), value)\n else\n target[key] = value\n end\n end\n end", "title": "" }, { "docid": "daa3cdef340fcdd8b4e4b58189cda6b3", "score": "0.63960576", "text": "def internal_deep_merge!(source_hash, specialized_hash)\n\n #puts \"starting deep merge...\"\n\n specialized_hash.each_pair do |rkey, rval|\n #puts \" potential replacing entry : \" + rkey.inspect\n\n if source_hash.has_key?(rkey) then\n #puts \" found potentially conflicting entry for #{rkey.inspect} : #{rval.inspect}, will merge :\"\n if rval.is_a?(Hash) and source_hash[rkey].is_a?(Hash) then\n #puts \" recursing...\"\n internal_deep_merge!(source_hash[rkey], rval)\n elsif rval == source_hash[rkey] then\n #puts \" same value, skipping.\"\n else\n #puts \" replacing.\"\n source_hash[rkey] = rval\n end\n else\n #puts \" found new entry #{rkey.inspect}, adding it...\"\n source_hash[rkey] = rval\n end\n end\n\n #puts \"deep merge done.\"\n\n return source_hash\n end", "title": "" }, { "docid": "3ab0a79437e9ef45f5fa834c9543e22c", "score": "0.63947535", "text": "def shallow_merge(other_hash); end", "title": "" }, { "docid": "a835fec22b0aedc67d91dc0e2b540e92", "score": "0.63856393", "text": "def merge(hash); end", "title": "" }, { "docid": "a835fec22b0aedc67d91dc0e2b540e92", "score": "0.63856393", "text": "def merge(hash); end", "title": "" }, { "docid": "a835fec22b0aedc67d91dc0e2b540e92", "score": "0.63856393", "text": "def merge(hash); end", "title": "" }, { "docid": "a835fec22b0aedc67d91dc0e2b540e92", "score": "0.63856393", "text": "def merge(hash); end", "title": "" }, { "docid": "d44b455b6460f4d5dd6033df3dc6b9db", "score": "0.6376894", "text": "def deep_merge(source, hash); end", "title": "" }, { "docid": "d44b455b6460f4d5dd6033df3dc6b9db", "score": "0.6376894", "text": "def deep_merge(source, hash); end", "title": "" }, { "docid": "d44b455b6460f4d5dd6033df3dc6b9db", "score": "0.6376894", "text": "def deep_merge(source, hash); end", "title": "" }, { "docid": "5ef2b086ca5480e0b5adde63b42139cb", "score": "0.6372348", "text": "def reverse_merge!(hash, other_hash)\n hash.merge!( other_hash ){|k,o,n| o }\n end", "title": "" }, { "docid": "938671d1bc0a5eb3f98335df6df4e1c2", "score": "0.63623613", "text": "def deep_safe_merge(source_hash, new_hash)\n source_hash.merge(new_hash) do |key, old, new|\n if new.respond_to?(:blank) && new.blank?\n old \n elsif (old.kind_of?(Hash) and new.kind_of?(Hash))\n deep_merge(old, new)\n elsif (old.kind_of?(Array) and new.kind_of?(Array))\n old.concat(new).uniq\n else\n new\n end\n end\n end", "title": "" }, { "docid": "5e742f8b29c51cb3a122ae80856a5fd1", "score": "0.63186854", "text": "def deep_merge!(other_hash)\n replace(deep_merge(other_hash))\n end", "title": "" }, { "docid": "4090776f917c7ea4931aef09c37dfdbb", "score": "0.6307579", "text": "def deep_safe_merge(other_hash)\n self.merge(other_hash) do |key, oldval, newval|\n oldval = oldval.to_hash if oldval.respond_to?(:to_hash)\n newval = newval.to_hash if newval.respond_to?(:to_hash)\n if oldval.class.to_s == 'Hash'\n if newval.class.to_s == 'Hash'\n oldval.deep_safe_merge(newval)\n else\n oldval\n end\n else\n newval\n end\n end\n end", "title": "" }, { "docid": "4090776f917c7ea4931aef09c37dfdbb", "score": "0.6307579", "text": "def deep_safe_merge(other_hash)\n self.merge(other_hash) do |key, oldval, newval|\n oldval = oldval.to_hash if oldval.respond_to?(:to_hash)\n newval = newval.to_hash if newval.respond_to?(:to_hash)\n if oldval.class.to_s == 'Hash'\n if newval.class.to_s == 'Hash'\n oldval.deep_safe_merge(newval)\n else\n oldval\n end\n else\n newval\n end\n end\n end", "title": "" }, { "docid": "c4a160e796073328abf16f851690adcd", "score": "0.6291344", "text": "def test_hash_deep_merge\n x = {}\n assert x.respond_to?('deep_merge!'.to_sym)\n hash_src = {'id' => [3,4,5]}\n hash_dest = {'id' => [1,2,3]}\n assert hash_dest.ko_deep_merge!(hash_src)\n assert_equal({'id' => [1,2,3,4,5]}, hash_dest)\n\n hash_src = {'id' => [3,4,5]}\n hash_dest = {'id' => [1,2,3]}\n assert hash_dest.deep_merge!(hash_src)\n assert_equal({'id' => [1,2,3,4,5]}, hash_dest)\n\n hash_src = {'id' => 'xxx'}\n hash_dest = {'id' => [1,2,3]}\n assert hash_dest.deep_merge(hash_src)\n assert_equal({'id' => [1,2,3]}, hash_dest)\n end", "title": "" }, { "docid": "08ab24e27eedd9603781514446173100", "score": "0.62802386", "text": "def deep_merge!(target, hash); end", "title": "" }, { "docid": "08ab24e27eedd9603781514446173100", "score": "0.62802386", "text": "def deep_merge!(target, hash); end", "title": "" }, { "docid": "08ab24e27eedd9603781514446173100", "score": "0.62802386", "text": "def deep_merge!(target, hash); end", "title": "" }, { "docid": "9f5a595151363a2e460a68665ce5e83a", "score": "0.6268392", "text": "def deep_merge!(other_hash, &blk); end", "title": "" }, { "docid": "d4e466a89d63118125ced2033ec53a40", "score": "0.6267539", "text": "def merge!(data)\n data.extend(HashExtensions)\n data = data.stringify_keys\n super(data)\n end", "title": "" }, { "docid": "3d1a4667243346cde028f901515ca022", "score": "0.62331235", "text": "def merge!(hash); end", "title": "" }, { "docid": "3d1a4667243346cde028f901515ca022", "score": "0.62331235", "text": "def merge!(hash); end", "title": "" }, { "docid": "5e347d59e8c0550f7211ad8275a7d2ed", "score": "0.6230523", "text": "def merge(base_hash, derived_hash); end", "title": "" }, { "docid": "d209af524c5b4518f5f1886a5d04512e", "score": "0.6197744", "text": "def fwf_reverse_merge( other_hash )\n other_hash.merge( self )\n end", "title": "" }, { "docid": "6f7e24d4ae6ad6def72a82078b3efdb4", "score": "0.61624384", "text": "def forms_merge(hash1, hash2) #:nodoc:\n target = hash1.dup\n hash2.keys.each do |key|\n if hash2[key].is_a? Hash and hash1[key].is_a? Hash\n target[key] = forms_merge(hash1[key], hash2[key])\n next\n end\n target[key] = hash2[key] == '/' ? nil : hash2[key]\n end\n# delete keys with nil value \n target.delete_if{ |k,v| v.nil? }\nend", "title": "" }, { "docid": "7abcd74b028e9899b41436cddd628cfc", "score": "0.61513734", "text": "def deep_merge!(other_hash)\n replace(deep_merge(other_hash))\n end", "title": "" }, { "docid": "7abcd74b028e9899b41436cddd628cfc", "score": "0.61513734", "text": "def deep_merge!(other_hash)\n replace(deep_merge(other_hash))\n end", "title": "" }, { "docid": "7abcd74b028e9899b41436cddd628cfc", "score": "0.61513734", "text": "def deep_merge!(other_hash)\n replace(deep_merge(other_hash))\n end", "title": "" }, { "docid": "7abcd74b028e9899b41436cddd628cfc", "score": "0.61513734", "text": "def deep_merge!(other_hash)\n replace(deep_merge(other_hash))\n end", "title": "" }, { "docid": "965c24c3cd02312ec1e43cce5f1b55a8", "score": "0.61219656", "text": "def deep_merge(other_hash, &blk); end", "title": "" }, { "docid": "d99b64a14fb918ae1dbcfde0e0c61db8", "score": "0.61193466", "text": "def merge(hash1,hash2)\n new_hash = {}\n # debugger\n hash1.each do |k,v|\n # debugger\n new_hash[k] = v\n end\n hash2.each do |k,v|\n # debugger\n new_hash[k] = v\n end\n # debugger\n new_hash\nend", "title": "" }, { "docid": "08ddf58fb1350e3be4ab3f7d933c6470", "score": "0.6119124", "text": "def custom_merge(hash1 , hash2)\n newhash = hash1.dup\n hash2.each { |key , value| newhash[key] = value }\n newhash\n\n\nend", "title": "" }, { "docid": "51bd4f677109ba5b5406fd7b62c85707", "score": "0.61036617", "text": "def deep_merge!(other_hash)\n replace(deep_merge(other_hash))\n end", "title": "" }, { "docid": "51bd4f677109ba5b5406fd7b62c85707", "score": "0.61036617", "text": "def deep_merge!(other_hash)\n replace(deep_merge(other_hash))\n end", "title": "" }, { "docid": "071ea2ae3ae8d98b35fc481101b2f531", "score": "0.60681117", "text": "def deep_merge!(other_hash, &block); end", "title": "" }, { "docid": "071ea2ae3ae8d98b35fc481101b2f531", "score": "0.60681117", "text": "def deep_merge!(other_hash, &block); end", "title": "" }, { "docid": "071ea2ae3ae8d98b35fc481101b2f531", "score": "0.60681117", "text": "def deep_merge!(other_hash, &block); end", "title": "" }, { "docid": "071ea2ae3ae8d98b35fc481101b2f531", "score": "0.60681117", "text": "def deep_merge!(other_hash, &block); end", "title": "" }, { "docid": "86672b49cb510848e9254f19106978af", "score": "0.6064594", "text": "def reverse_deep_merge!(other_hash)\n replace(reverse_deep_merge(other_hash))\n self\n end", "title": "" }, { "docid": "48003b633fd5c1ed30acb5e103308d37", "score": "0.6054478", "text": "def reverse_merge(other_hash)\n self.class.new(other_hash).merge(self)\n end", "title": "" }, { "docid": "48003b633fd5c1ed30acb5e103308d37", "score": "0.6054478", "text": "def reverse_merge(other_hash)\n self.class.new(other_hash).merge(self)\n end", "title": "" }, { "docid": "f4e6f95dbbd68d2fdb32bb76109fe2c7", "score": "0.60528827", "text": "def merge!(other_hash)\n super(other_hash) do |key, old_val, new_val|\n if old_val.kind_of?(Hash) then self.class.from(old_val).merge!(new_val) else new_val end\n end\n end", "title": "" }, { "docid": "0078b12ee24a224e4fb5052b3f558161", "score": "0.60512596", "text": "def merge(hash)\n super(__convert_without_dup(hash))\n end", "title": "" }, { "docid": "3012bfa38388640356e4303967c13b4a", "score": "0.6046013", "text": "def deep_merge(base_hash, added_hash)\n added_hash.each do |key, value|\n if base_hash[key].is_a?(Hash)\n deep_merge(base_hash[key], value) unless value.empty?\n else\n base_hash[key] = value\n end\n end\n end", "title": "" }, { "docid": "8a5addfb380a475aef8a5583311a72e0", "score": "0.6041581", "text": "def merge!(hash, key, value); end", "title": "" }, { "docid": "1fd6b4955231675fad8b87559e0e3efc", "score": "0.6015998", "text": "def my_merge(hash2)\n end", "title": "" }, { "docid": "9aba863696aaaba470b8d7949a7f5b43", "score": "0.6008631", "text": "def merge!(other_hash, &blk); end", "title": "" }, { "docid": "68703fa208b16fa25ef96ceafa0ec642", "score": "0.60083085", "text": "def merge(base_hash, derived_hash, **opts); end", "title": "" }, { "docid": "339af9e5d9853b3c6cfec94937c7ae28", "score": "0.60064596", "text": "def key_value_swap(hash)\r\n\r\nend", "title": "" }, { "docid": "59ff1bcd875033569c52a67da0378b41", "score": "0.60029405", "text": "def deep_merge_entries(a, b)\n if b.is_a?(Hash)\n a.is_a?(Hash) ? a.deep_merge(b) : b\n else\n b.nil? ? a : b\n end\nend", "title": "" }, { "docid": "e38f3caa1875941b564fa0a97cd0617c", "score": "0.5970055", "text": "def safe_merge(hash, hash_to_merge)\n conflicting_path = nil\n hash_to_merge.each do |key, value_to_merge|\n if hash.key?(key)\n if hash[key].is_a?(Hash) && value_to_merge.is_a?(Hash)\n sub_conflicting_path = safe_merge(hash[key], value_to_merge)\n conflicting_path = [key] + sub_conflicting_path unless sub_conflicting_path.nil?\n elsif hash[key] != value_to_merge\n conflicting_path = [key]\n end\n else\n hash[key] = value_to_merge\n end\n break unless conflicting_path.nil?\n end\n conflicting_path\n end", "title": "" }, { "docid": "74ec232ec5184a0f1acb8813a4a4f7e0", "score": "0.5948659", "text": "def pyfix_hash_merge\n expect_len 2 # target + one argument\n @message_name = 'update'\n return self\n end", "title": "" }, { "docid": "d634f22d5c1443c37f9a5757f0a4f803", "score": "0.5936113", "text": "def deep_reverse_merge!(base, spec)\n spec.each do |key, value|\n if base[key].is_a?(Hash) && value.is_a?(Hash)\n deep_reverse_merge!(base[key], value)\n elsif !base.key?(key)\n base[key] = value\n elsif base[key].is_a?(Array) && value.is_a?(Array)\n if key == \"parameters\"\n # merge arrays\n base[key] |= value\n end\n else\n # no-op\n end\n end\n base\n end", "title": "" }, { "docid": "5b3a519f8461067c053a763ec59bb35e", "score": "0.59257907", "text": "def custom_merge(hash1, hash2)\n new_hash = hash1.dup\n hash2.each{ |key, value| new_hash[key] = value }\n new_hash\nend", "title": "" }, { "docid": "57efd54505901f6398ff8a561f72c2a8", "score": "0.59232384", "text": "def reverse_deep_merge(other_hash)\n __convert(other_hash).deep_merge(self)\n end", "title": "" }, { "docid": "88b753d4c9c2d237bd51a04a0a5a3ac4", "score": "0.591775", "text": "def custom_merge(hash1, hash2)\n new_hash = hash1.dup\n hash2.each { |key, value| new_hash[key] = value }\n new_hash\nend", "title": "" }, { "docid": "1d31e93e79315e2ac5fa02e8e518aaf7", "score": "0.58959705", "text": "def deep_merge!(source_hash, new_hash)\n source_hash.merge!(new_hash) do |key, old, new|\n if new.respond_to?(:blank) && new.blank?\n old \n elsif (old.kind_of?(Hash) and new.kind_of?(Hash))\n deep_merge!(old, new)\n elsif (old.kind_of?(Array) and new.kind_of?(Array))\n old.concat(new).uniq\n elsif new.nil?\n # Allowing nil values to over-write on merge messes things up.\n # don't set a nil value if you really want to force blank, set\n # empty string. \n old\n else\n new\n end\n end\n end", "title": "" }, { "docid": "d6e3da8247d79dc6cf74d50a22e42a34", "score": "0.5885484", "text": "def deep_merge!(hash, other_hash)\n other_hash.each_pair do |k,v|\n tv = hash[k]\n hash[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? deep_merge!(tv, v) : v\n end\n hash\nend", "title": "" }, { "docid": "9fa7c2cab78ed83e66d31385340615cd", "score": "0.58835477", "text": "def custom_merge(hash1, hash2)\n new_hash = hash1.dup\n hash2.each {|key, value| new_hash[key] = value}\n new_hash\nend", "title": "" }, { "docid": "10f640910b67d2dffb93911bd2c20289", "score": "0.58821326", "text": "def merge(hash1, hash2)\n hash1.merge(hash2)\nend", "title": "" }, { "docid": "32a52bb19e3b722b9d6d5b5948a0a57a", "score": "0.58055246", "text": "def hash_dup; end", "title": "" }, { "docid": "5c259f22cfaaabce4ce809305727619c", "score": "0.57581484", "text": "def deep_merge(source_hash, new_hash)\n source_hash.merge(new_hash) do |key, old, new|\n if new.respond_to?(:blank) && new.blank?\n old\n elsif (old.kind_of?(Hash) and new.kind_of?(Hash))\n deep_merge(old, new)\n elsif (old.kind_of?(Array) and new.kind_of?(Array))\n old.concat(new).uniq\n else\n new\n end\n end\nend", "title": "" }, { "docid": "a48b64faa0514e48c23899031021c5c0", "score": "0.57476723", "text": "def deep_merge(other_hash)\n self.merge(other_hash) do |key, oldval, newval|\n if oldval.class.to_s == 'Array' && newval.class.to_s == 'Array'\n oldval | newval\n else\n oldval = oldval.to_hash if oldval.respond_to?(:to_hash)\n newval = newval.to_hash if newval.respond_to?(:to_hash)\n oldval.class.to_s == 'Hash' && newval.class.to_s == 'Hash' ? oldval.deep_merge(newval) : newval\n end\n end\n end", "title": "" }, { "docid": "e716de102712bfb9a2a04586e6234d31", "score": "0.5737056", "text": "def force(hash); end", "title": "" }, { "docid": "0567e854b81e662fca66e26bdef79ad8", "score": "0.573497", "text": "def deep_merge!(other_hash)\n\t\tother_hash.each_pair do |k,v|\n\t\t\ttv = self[k]\n\t\t\tself[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? tv.deep_merge(v) : v\n\t\tend\n\t\tself\n\tend", "title": "" }, { "docid": "46605053244727f09feaab5078fa3fc6", "score": "0.5729127", "text": "def deep_merge!(other_hash)\n\t\tmerger = proc {|k, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }\n\t\tself.merge!(other_hash, &merger)\n\tend", "title": "" }, { "docid": "aa22ab106191361bb008cd5d8999fb0f", "score": "0.5727387", "text": "def merge(other_hash, &blk); end", "title": "" }, { "docid": "2136bece7e4f9205312de29210d53682", "score": "0.5724472", "text": "def re_hash(input_hash)\n input_hash.keys.each { |k|\n\n value_hash = input_hash[k]\n if value_hash != nil and value_hash.is_a? Hash and value_hash.keys.length > 0\n value_hash = re_hash(value_hash)\n end\n\n if k.index('.') != nil\n input_hash.delete(k)\n normalized_hash = normalize(k, value_hash)\n input_hash = input_hash.deep_merge(normalized_hash)\n else\n input_hash.delete(k)\n input_hash = input_hash.merge({k => value_hash})\n end\n }\n return input_hash\n end", "title": "" }, { "docid": "22b6bff81e380340448b12404411e3fb", "score": "0.5706939", "text": "def assume_unordered_hashes; end", "title": "" }, { "docid": "05cacba33854cceb223694a6da36cbd3", "score": "0.570455", "text": "def merge_hash(hash, prelude = nil)\n hash.reduce({}) do |acc, kv|\n k, v = kv\n generated_key = prelude ? \"#{prelude}_#{k}\" : k.to_s\n #puts(\"Generated key #{generated_key}\")\n if v.is_a?(Hash)\n acc.merge!(merge_hash(v, generated_key))\n elsif v.is_a?(Array)\n acc[generated_key] = v.to_s\n else\n acc[generated_key] = v\n end\n acc\n end\n end", "title": "" }, { "docid": "16e1b35ba40e9a3ca2ab286651570554", "score": "0.5680219", "text": "def deep_merge!(second)\n second.each_pair do |k,v|\n if self[k].is_a?(Hash) and second[k].is_a?(Hash)\n self[k].deep_merge!(second[k])\n else\n self[k] = second[k] end\n end\n end", "title": "" }, { "docid": "1805ac3dd9a3a59c0af69fdbdd8a9939", "score": "0.56762624", "text": "def deep_merge!(second)\n second.each_pair do |k,v|\n if self[k].is_a?(Hash) and second[k].is_a?(Hash)\n self[k].deep_merge!(second[k])\n else\n self[k] = second[k]\n end\n end\n end", "title": "" }, { "docid": "1805ac3dd9a3a59c0af69fdbdd8a9939", "score": "0.56762624", "text": "def deep_merge!(second)\n second.each_pair do |k,v|\n if self[k].is_a?(Hash) and second[k].is_a?(Hash)\n self[k].deep_merge!(second[k])\n else\n self[k] = second[k]\n end\n end\n end", "title": "" } ]
54111c72f90856e4894558367c96aa56
Free the native resources associated with this object. This will be done automatically on garbage collection if not called explicitly.
[ { "docid": "3295da3def6916f003b523f1ffe1b56c", "score": "0.6217724", "text": "def destroy\n if @finalizer\n @finalizer.call\n ObjectSpace.undefine_finalizer(self)\n end\n @ptr = @finalizer = nil\n \n self\n end", "title": "" } ]
[ { "docid": "43ea462322034edf1887a49e6b806f24", "score": "0.80773443", "text": "def free\n self.autorelease = false\n FFI::Platform::POSIX.free(self) unless null?\n end", "title": "" }, { "docid": "351b8b3b55fbcd3bae90e78246ff234e", "score": "0.7961796", "text": "def free\n self.autorelease = false\n Platform::POSIX.free(self) unless null?\n #self.class.set_address self, nil\n end", "title": "" }, { "docid": "1929af5e29201bf69c581819f05549cb", "score": "0.790401", "text": "def release\n return unless @native\n\n @native.free\n @native = nil\n end", "title": "" }, { "docid": "0dcc893aa6bfed029d556c3df4e42a17", "score": "0.78215134", "text": "def free\n self.autorelease = false\n Platform::POSIX.free(self) unless null?\n self.class.set_address self, nil\n end", "title": "" }, { "docid": "ebc225660e4c13c47d379077ab5a68d9", "score": "0.76452184", "text": "def dispose\n call Memory.deAlloc(self)\n end", "title": "" }, { "docid": "e28db214100dd3238bf3cda41c873792", "score": "0.7372269", "text": "def cleanup\n handle.free\n end", "title": "" }, { "docid": "e28db214100dd3238bf3cda41c873792", "score": "0.7372269", "text": "def cleanup\n handle.free\n end", "title": "" }, { "docid": "bfe2b485bda24bc56040f4886cc26c33", "score": "0.6982816", "text": "def dispose\n return if ptr.nil?\n\n C.dispose_target_data(self)\n @ptr = nil\n end", "title": "" }, { "docid": "6ff7ee95c93bb9214da1cdcf4369bde3", "score": "0.6977756", "text": "def dealloc()\n\n\t\tnil;\n\n\tend", "title": "" }, { "docid": "2c2cdc4648c39d4d2cb790156c962d8a", "score": "0.6969172", "text": "def free\r\n V2.raptor_free_namespace(self) unless ptr.null?\r\n end", "title": "" }, { "docid": "98738f1e0b4e50edf52f8da7176c825e", "score": "0.69653803", "text": "def close\n destroyer.call\n @ptr = nil\n end", "title": "" }, { "docid": "a65dee549f3711905d9949b5f896a948", "score": "0.6961487", "text": "def free\n\n # nothing ... :( I hope there's no memory leak\n end", "title": "" }, { "docid": "d53ecfd26faceec4458bc12d7ec829e6", "score": "0.69506365", "text": "def finalize\n if @handle\n @handle.release_interface(0)\n @handle.close\n end\n end", "title": "" }, { "docid": "1bec8b156057a65147c40e6daedf0c67", "score": "0.69335085", "text": "def finalize(*args)\n FFI::Libvirt.virNodeDeviceFree(self)\n end", "title": "" }, { "docid": "15218481df0413b3b1465d769a76dca6", "score": "0.6913204", "text": "def free\n\n # nothing to do, kept for similarity with Rufus::Tokyo\n end", "title": "" }, { "docid": "6895681d9e62581cfc2664d0448b2bf2", "score": "0.6903693", "text": "def dealloc()\n\n\t\tself.disconnect();\n\n\t\tnil;\n\n\tend", "title": "" }, { "docid": "f7d09d6fb0e03a73f08cfff7ccc964e1", "score": "0.68502814", "text": "def dispose\n if (@handle > 0)\n @fmod.invoke('System_Close', @handle)\n @fmod.invoke('System_Release', @handle)\n @handle = 0\n end\n @fmod = nil\n end", "title": "" }, { "docid": "f7d09d6fb0e03a73f08cfff7ccc964e1", "score": "0.68502814", "text": "def dispose\n if (@handle > 0)\n @fmod.invoke('System_Close', @handle)\n @fmod.invoke('System_Release', @handle)\n @handle = 0\n end\n @fmod = nil\n end", "title": "" }, { "docid": "e17af834fd115793e0018b9541550a34", "score": "0.6829016", "text": "def dispose()\r\n delete()\r\n end", "title": "" }, { "docid": "c3f52fe47aee06900b2f0231fbeacdcb", "score": "0.6774345", "text": "def release!\n release_events()\n @properties.clear\n @properties = nil\n @parent = nil\n @window = nil\n nil\n end", "title": "" }, { "docid": "42840db4ad2d92e41f241734230e15ba", "score": "0.6758406", "text": "def finalize(*args)\n FFI::Libvirt.virStorageVolFree(self)\n end", "title": "" }, { "docid": "6b75be1812a5f760b4ecd543c35e1451", "score": "0.6737656", "text": "def dispose\n return if @ptr.nil?\n\n C.dispose_target_machine(self)\n @ptr = nil\n end", "title": "" }, { "docid": "2b37ce7a10b724192bfe5759de422d83", "score": "0.67264926", "text": "def dealloc()\n\n\t\[email protected] if [email protected]?\n\t\t@oEventManager = nil\n\n\t\[email protected] if [email protected]?\n\t\t@oFletcher = nil\n\n\t\[email protected] if [email protected]?\n\t\t@oIncomingFrame = nil\n\n\t\t@hFrameHistory = nil\n# TOFIX: prio 9\n\t\[email protected] do |hClient|\n\t\t\thClient[:marker].dealloc() if !hClient[:marker].nil?\n\t\tend # loop all markers\n\t\t@hOnlineClientHash = nil\n\n\t\tnil\n\n\tend", "title": "" }, { "docid": "1c216bf68cfa1764786779352ccacd1d", "score": "0.67016286", "text": "def dispose\n call Memory.deAlloc(@x)\n end", "title": "" }, { "docid": "5d0b09b2653b65569d87a01994fbde19", "score": "0.66784185", "text": "def release\n @image = nil\n GC.start\n self\n end", "title": "" }, { "docid": "148be15bffc1858aef41f48098a479b3", "score": "0.66750866", "text": "def finalize(*args)\n FFI::Libvirt.virNetworkFree(self)\n end", "title": "" }, { "docid": "feb151a08180bef5f53ab68c6aa6f100", "score": "0.6656653", "text": "def free\n @membership_lock.synchronize do\n @notify_handles.each { |handle| Hoard.inotify.delete_watch(handle) }\n @objects.values.each {|object|\n __unmanage__(object)\n }\n @objects = nil\n end\n end", "title": "" }, { "docid": "35f0171d21f01fd1290691b0aca33ebf", "score": "0.6632358", "text": "def dispose()\r\n @dispose.call()\r\n end", "title": "" }, { "docid": "1a82bd47ddbbfba42d5da867e924e956", "score": "0.66156644", "text": "def free_own_memory\n if @i_own_enterprise\n FFI::LibC.free(@enterprise_ptr) unless @enterprise_ptr.null?\n @struct.enterprise = FFI::Pointer::NULL\n end\n end", "title": "" }, { "docid": "24c12d1cce9fe6cacee170a77c35fbe1", "score": "0.6596244", "text": "def free\r\n Tidylib.buf_free(@struct)\r\n end", "title": "" }, { "docid": "a038f01ab841818855cab0bdefe77620", "score": "0.6569795", "text": "def close\n ffi_delegate.destroy\n end", "title": "" }, { "docid": "3bc319feb064fba4f1c0a0d808c93c27", "score": "0.6564652", "text": "def cleanup\n # Stop external processes etc.\n end", "title": "" }, { "docid": "2b87175c5f0e37da23c6906395184d1d", "score": "0.6505752", "text": "def dealloc()\n\n\t\t# and disconnect\n\t\[email protected]() if [email protected]?\n\t\t@oSerial = nil\n\n\t\tputs 'OK:Serial disconnected'\n\n\t\[email protected]() if [email protected]?\n\t\t@oEthernet = nil\n\n\t\[email protected]() if [email protected]?\n\t\t@oIOframeHandler = nil\n\n\t\tputs 'OK:Ethernet disconnected'\n\n\t\[email protected] { |oPipe| oPipe.dealloc() } if [email protected]?\n\t\t@aPipes = nil\n\n\t\tputs 'OK:Triggers halted'\n\n\t\t# remove output log?\n\n\t\t# shutdown EventMachine\n\t\tEM::stop_event_loop()\n\n\t\t# remove pid file\n\t\tsPathFilePID = self.get(:pathFilePID, @@_defaultPathFilePID)\n\t\tFile.delete(sPathFilePID) if File.exists? sPathFilePID\n\n\t\tputs 'OK:PID file removed from ' << sPathFilePID\n\n\t\tputs 'Good Bye - Enjoy Life'\n\n\t\t# and quit\n\t\texit! true\n\n\t\tnil\n\n\tend", "title": "" }, { "docid": "a72517a8d3c97d35f47556ae3660a3ee", "score": "0.6493719", "text": "def release\n _do_if_open { _handle_closed! ; ::Dnet.blob_free(self) }\n end", "title": "" }, { "docid": "c7238c465ae67b497d6843b29fbb5aaa", "score": "0.6484536", "text": "def close\n free()\n @names = nil\n @column_metadata = nil\n end", "title": "" }, { "docid": "30e912b5dd543b932998beadeeace09d", "score": "0.64830256", "text": "def close\n self.C_Finalize\n self.unload_library\n end", "title": "" }, { "docid": "80f96155a284111491ea9059999dccd0", "score": "0.6481325", "text": "def free\n @conn.del(current_uris_key)\n @conn.del(staged_uris_key)\n @conn.del(cached_uris_key)\n\n @conn.disconnect!\n end", "title": "" }, { "docid": "56880dd6ef8e2d94c8f0ded07ef08e6e", "score": "0.64495116", "text": "def close!\n _close\n @clean_proc.call\n ObjectSpace.undefine_finalizer(self)\n @data = @tmpname = nil\n end", "title": "" }, { "docid": "9feb3cd3990063c5dd46c18f4e47d6df", "score": "0.6447868", "text": "def dispose\n call @bat.dispose\n call @ball.dispose\n call Memory.deAlloc(self)\n end", "title": "" }, { "docid": "724e5c07b8ee8f6d9112e89994add844", "score": "0.64471954", "text": "def free() end", "title": "" }, { "docid": "c215b5d9da6bc36b7564c0d27ff6bb7b", "score": "0.6436391", "text": "def free\n @command = nil\n @stdout = nil\n @stderr = nil\n end", "title": "" }, { "docid": "51321ea6cb5417baa5c7fd71ec26a0e2", "score": "0.643485", "text": "def dispose()\r\n @encodings.every.dispose()\r\n end", "title": "" }, { "docid": "88d8b154cbae9e262619b41849f6270e", "score": "0.6404662", "text": "def release(pointer)\n Yajl::FFI.free(pointer)\n end", "title": "" }, { "docid": "bd13c62aa89c77b35d520e54e76ba6c8", "score": "0.6396969", "text": "def clear_memory\r\n # Dispose Memory\r\n @memory.dispose\r\n # Set To nil\r\n @memory = nil\r\n end", "title": "" }, { "docid": "25e85db60697587ce99049e1715ba5c7", "score": "0.6391134", "text": "def free\n end", "title": "" }, { "docid": "71a9ff984043287923cb93f20bfa7fa7", "score": "0.63899446", "text": "def release()\n raise \"Call To IndexArray#release On Invalid Object\" unless @buffer_valid\n \n buff_ptr = FFI::MemoryPointer.new(:uint)\n buff_ptr.write_uint(@buffer_id)\n \n Native.glDeleteBuffers(1, buff_ptr)\n \n @buffer_valid = false\n end", "title": "" }, { "docid": "bc84de60565eeec8bae149195d89cacb", "score": "0.62990403", "text": "def dispose\n end", "title": "" }, { "docid": "1e8f4b90f84fdfa2d291c55f9f4dff89", "score": "0.62710947", "text": "def finalize!\n erase\n @@registry.delete(self)\n\n children.each { |c|\n del_child c\n }\n\n cdk_scr.destroy if cdk?\n component.finalize! if component?\n end", "title": "" }, { "docid": "387c3bcb0b0b761bb0b54a65d6bcea71", "score": "0.627069", "text": "def release\n refcount(-1)\n self\n end", "title": "" }, { "docid": "bc4636ccbf3b430a4dd4a58a01b7acd1", "score": "0.627013", "text": "def close\n `#@native.close()`\n end", "title": "" }, { "docid": "bc4636ccbf3b430a4dd4a58a01b7acd1", "score": "0.627013", "text": "def close\n `#@native.close()`\n end", "title": "" }, { "docid": "b1d6201b94be470b5b839b4023b2e8dd", "score": "0.62577045", "text": "def finalize\n nil\n end", "title": "" }, { "docid": "b1d6201b94be470b5b839b4023b2e8dd", "score": "0.62577045", "text": "def finalize\n nil\n end", "title": "" }, { "docid": "1b49dd7861c6f33b5bb48f5e08c0c9a6", "score": "0.62352836", "text": "def dispose\r\n return if @disposed\r\n @window.bitmap.dispose if @window.bitmap\r\n @pause_sprite.dispose if @pause_sprite\r\n @cursor_sprite.dispose if @cursor_sprite\r\n @texts.each { |text| text.dispose }\r\n @texts.clear\r\n @text_viewport.dispose if @text_viewport != @window.viewport\r\n @window.dispose\r\n @disposed = true\r\n end", "title": "" }, { "docid": "dcff68554f7fd6b6529a90ea246731a3", "score": "0.6227681", "text": "def release()\n raise \"Call To VertexArray#release On Invalid Object\" unless @buffer_valid\n \n buff_ptr = FFI::MemoryPointer.new(:uint)\n buff_ptr.write_uint(@buffer_id)\n \n Native.glDeleteBuffers(1, buff_ptr)\n \n @buffer_valid = false\n end", "title": "" }, { "docid": "f50428a35bf01198a1b0c1b651da05bf", "score": "0.6226062", "text": "def xDecref\n AutoPyPointer.release(@pointer)\n @pointer.free\n end", "title": "" }, { "docid": "b73daa32619c10c66aa577c208318994", "score": "0.62146646", "text": "def dispose()\n @feed_data = nil\n @feed_data_type = nil\n @xml_document = nil\n @root_node = nil\n @title = nil\n @id = nil\n @time = nil\n end", "title": "" }, { "docid": "3b48e48c0500631aae79c24588e0662a", "score": "0.6211307", "text": "def cleanup\n nil\n end", "title": "" }, { "docid": "504dda61ca0dd5ea0deb2ffe8a93a16d", "score": "0.6210894", "text": "def free_gc (*args)\n free_gc!(*args).abandon\n end", "title": "" }, { "docid": "07259d5c4adb5eaba12a00599ae98963", "score": "0.620879", "text": "def finalize\n @buffer = nil\n if @socket\n @socket.close\n @socket = nil\n end\n end", "title": "" }, { "docid": "4459e60965e4a26dcc34f9c91a9d0b2b", "score": "0.6204313", "text": "def dispose; end", "title": "" }, { "docid": "2fd13ae6ddee52d9e65171521bb081da", "score": "0.6197087", "text": "def dispose\n @back.dispose\n @icons.each do |i|\n i.dispose\n end\n @cursor.dispose\n end", "title": "" }, { "docid": "abfbd2410b7746327824666147799e16", "score": "0.61907554", "text": "def release; @pages.each {|p| @free.call(p)}; end", "title": "" }, { "docid": "d7e12eefdd5ea4af192e19ac31abddce", "score": "0.61835593", "text": "def unref\n return if @closed\n ::Libuv::Ext.unref(handle)\n end", "title": "" }, { "docid": "3a601e8c26929b834b87eb04725d5ca7", "score": "0.6166099", "text": "def dispose\n @stack.each(&:dispose)\n @stack.clear\n end", "title": "" }, { "docid": "7e03ecd7901e0947332d548114290553", "score": "0.6165379", "text": "def release( ptr )\n C.destroy( ptr )\n end", "title": "" }, { "docid": "b957b84bfb8be8892931d3017a396caf", "score": "0.61569786", "text": "def destroy\n self.cleanTitle\n self.destroyInfo\n\n # Clean up the windows.\n CDK.deleteCursesWindow(@scrollbar_win)\n CDK.deleteCursesWindow(@shadow_win)\n CDK.deleteCursesWindow(@win)\n\n # Clean up the key bindings.\n self.cleanBindings(:RADIO)\n\n # Unregister this object.\n CDK::SCREEN.unregister(:RADIO, self)\n end", "title": "" }, { "docid": "37acf40d6ba38bdf1ca57cec4b67f82a", "score": "0.6152132", "text": "def dispose()\r\n end", "title": "" }, { "docid": "16373eeb89231d6f50de39784d2c0221", "score": "0.61517245", "text": "def deallocate_unused\n # implemented by subclass\n end", "title": "" }, { "docid": "28c3a56e4fb803d4c89962643f4a741c", "score": "0.6144673", "text": "def freeResources() \n begin\n slave.close();\n if (interactIn != nil) \n interactIn.stopProcessing();\n end\n if (interactOut != nil) \n interactOut.stopProcessing();\n end\n if (interactErr != nil) \n interactErr.stopProcessing();\n end\n if (stderrSelector != nil) \n stderrSelector.close();\n end\n if (@stdoutSelector != nil)\n @stdoutSelector.close();\n end\n if (@toStdin != nil)\n @toStdin.close();\n end\n rescue\n # Cleaning up is a best effort operation, failures are\n # logged but otherwise accepted.\n log(\"Failed cleaning up after spawn done\");\n end\n end", "title": "" }, { "docid": "066fe4cd0ead14565542c34c61b71061", "score": "0.6136097", "text": "def close\n API.finalize( @vm )\n end", "title": "" }, { "docid": "bf79204758802cff43a420f7d7908859", "score": "0.61352134", "text": "def dispose\n end", "title": "" }, { "docid": "bf79204758802cff43a420f7d7908859", "score": "0.61352134", "text": "def dispose\n end", "title": "" }, { "docid": "bf79204758802cff43a420f7d7908859", "score": "0.61352134", "text": "def dispose\n end", "title": "" }, { "docid": "5245bdbfa4998600cd2472f1cb0e1f0d", "score": "0.61089474", "text": "def manage_native(&block)\n # check that a destructor has been registered\n unless self.class.instance_variable_get('@destructor')\n raise 'No native destructor registered. use native_destroy to ' \\\n 'set the method used to cleanup the native object this ' \\\n 'class manages.'\n end\n native = block.call\n @native = FFI::AutoPointer.new(native, self.class.method(:on_release))\n end", "title": "" }, { "docid": "156b06c6d34ad0710e0788a700d7ee45", "score": "0.6106834", "text": "def dispose\n return unless @native\n @native.Dispose()\n @native = nil\n V8::C::V8::ContextDisposedNotification()\n def self.enter\n fail \"cannot enter a context which has already been disposed\"\n end\n end", "title": "" }, { "docid": "de6ad084382c2523e96d91eb8dd1c90c", "score": "0.61033857", "text": "def close() \n @obj.close()\n end", "title": "" }, { "docid": "c6143ee0e74f7c1ece0ace776aff8dd5", "score": "0.60749096", "text": "def cleanup\n # Nothing to do!\n end", "title": "" }, { "docid": "93756e906a8fef5033cd81da191fd2f8", "score": "0.6067216", "text": "def free\n V2.raptor_free_statement(self)\n @subject = @predicate = @object = nil # Allow GC to start\n end", "title": "" }, { "docid": "1838592c598571501e15a2603cdb2215", "score": "0.606331", "text": "def free\n @conn.shutdown\n end", "title": "" }, { "docid": "cb5d0b4beeb0e17c11d5fb6f7e868dd4", "score": "0.60625976", "text": "def dispose\n @sprites.each_value do |stack|\n stack.each(&:dispose)\n stack.clear\n end\n @sprites.clear\n end", "title": "" }, { "docid": "214e50a1f01756c8f0f09c7d67645297", "score": "0.6058662", "text": "def destroy\n if @finalizer\n @finalizer.call\n ObjectSpace.undefine_finalizer(self)\n end\n @ptr = @finalizer = @ruby_socket = @bucket = nil\n \n self\n end", "title": "" }, { "docid": "bf7a0ea9bc26bd68ce7860174962bdc7", "score": "0.6053906", "text": "def cleanup\n @object_space = nil\n class << ObjectSpace\n alias_method :define_finalizer_with_mock_reference, :define_finalizer\n alias_method :define_finalizer, :define_finalizer_without_mock_reference\n end\n\n class << WeakReference\n alias_method :new_with_mock_reference, :new\n alias_method :new, :new_without_mock_reference\n end\n\n class << SoftReference\n alias_method :new_with_mock_reference, :new\n alias_method :new, :new_without_mock_reference\n end\n end", "title": "" }, { "docid": "14c0aac290ec263bbafd558f9ac34edd", "score": "0.60324216", "text": "def dispose\n end", "title": "" }, { "docid": "9913252c8d7de589924b3a97349098eb", "score": "0.60261697", "text": "def finalize\n close\n end", "title": "" }, { "docid": "5471e2813e820a2785f84e44a8170f59", "score": "0.60233015", "text": "def dispose\n call @square.dispose\n call Memory.deAlloc(self)\n end", "title": "" }, { "docid": "f2aa224c173ae8631d065a2c78228e0f", "score": "0.6008366", "text": "def cleanup\n end", "title": "" }, { "docid": "f2aa224c173ae8631d065a2c78228e0f", "score": "0.6008366", "text": "def cleanup\n end", "title": "" }, { "docid": "8926479f238a402ec043e1908446172f", "score": "0.599924", "text": "def dispose\n raise \"not implemented\"\n \n @disposed = true\n end", "title": "" }, { "docid": "1072735002f428f2e5a73b0247935609", "score": "0.59984034", "text": "def cleanup!; end", "title": "" }, { "docid": "1072735002f428f2e5a73b0247935609", "score": "0.59984034", "text": "def cleanup!; end", "title": "" }, { "docid": "1072735002f428f2e5a73b0247935609", "score": "0.59984034", "text": "def cleanup!; end", "title": "" }, { "docid": "50ac251336e9b296522856fbceea34e5", "score": "0.5992885", "text": "def free\n cache.clear\n nil\n end", "title": "" }, { "docid": "c7e60af6a2cb0a0ca2fd87966646a1cc", "score": "0.5984498", "text": "def cleanup\n Monitor.cleanup\n end", "title": "" }, { "docid": "aeb9c5682d24b55b73bb73877a593c19", "score": "0.5974728", "text": "def cleanup; end", "title": "" }, { "docid": "aeb9c5682d24b55b73bb73877a593c19", "score": "0.5974728", "text": "def cleanup; end", "title": "" }, { "docid": "aeb9c5682d24b55b73bb73877a593c19", "score": "0.5974728", "text": "def cleanup; end", "title": "" }, { "docid": "aeb9c5682d24b55b73bb73877a593c19", "score": "0.5974728", "text": "def cleanup; end", "title": "" }, { "docid": "a930d703f8c05061d50e564223ac9fd3", "score": "0.5973818", "text": "def destroy\n # Clean up the windows.\n CDK.deleteCursesWindow(@shadow_win)\n CDK.deleteCursesWindow(@win)\n\n # Clean the key bindings.\n self.cleanBindings(:MARQUEE)\n\n # Unregister this object.\n CDK::SCREEN.unregister(:MARQUEE, self)\n end", "title": "" }, { "docid": "14bfc51536e3521e1af49a1160c430d3", "score": "0.5972425", "text": "def dispose\n pbDisposeSpriteHash(@fp)\n end", "title": "" } ]
ab38ccf8a9f913635f2f368fb9b5e783
Outputs a single line of Applescript code
[ { "docid": "166f68d3c06dabee9b0f5d5ac0c343b6", "score": "0.0", "text": "def output(command)\n @buffer << command.gsub(/'/, '\"')\n end", "title": "" } ]
[ { "docid": "824717868fc085286c451d7a053cdecf", "score": "0.63589495", "text": "def show(output = $stout)\n pp(@code,output)\n end", "title": "" }, { "docid": "69131b46218acd5bca092241785e30a6", "score": "0.629022", "text": "def execute_applescript(scpt)\n File.open(FILE_APPLESCRIPT, 'w') {|f| f.write(scpt)}\n result = run(\"osascript #{FILE_APPLESCRIPT}\")\n File.unlink(FILE_APPLESCRIPT)\n result\n end", "title": "" }, { "docid": "69131b46218acd5bca092241785e30a6", "score": "0.629022", "text": "def execute_applescript(scpt)\n File.open(FILE_APPLESCRIPT, 'w') {|f| f.write(scpt)}\n result = run(\"osascript #{FILE_APPLESCRIPT}\")\n File.unlink(FILE_APPLESCRIPT)\n result\n end", "title": "" }, { "docid": "1eb54d8d65406dc4c7cf11865e58f8ca", "score": "0.6009665", "text": "def osascript(script)\n\t\tcmd = ['osascript'] + script.split(/\\n/).map { |line| ['-e', line] }.flatten\n\t\tIO.popen(cmd) { |io| return io.read }\n\tend", "title": "" }, { "docid": "4d770052fe4688794564d22f6215ddb7", "score": "0.60049355", "text": "def code\n # Short circuit is this isn't a Command Paper.\n return \"#{source} #{session} (#{paper_no}) #{vol} #{start_page}\" if source != 'CMD'\n\n # Paper number prefixes are different for sessions.\n prefix = case session[0..3].to_i\n when 1000..1869 then ''\n when 1870..1899 then 'C.'\n when 1900..1919 then 'Cd.'\n else 'Cmd.'\n end\n \n \"HC #{session} [#{prefix}#{paper_no}] #{vol} #{start_page}\"\n end", "title": "" }, { "docid": "4cb374a4a450c4d0fa33c72fe0e82410", "score": "0.59765744", "text": "def output( line )\n puts( line ) \n end", "title": "" }, { "docid": "d4024fa63893f5f517d852bf3dded9d1", "score": "0.5828795", "text": "def emit(code, options={})\n tab = options.has_key?(:tab) ? options[:tab] : \"\\t\"\n @code << \"#{tab}#{code}\\n\"\n end", "title": "" }, { "docid": "e92b01e9cd36a5f334f9e3ebfc41bc06", "score": "0.57944757", "text": "def introduction # def opens a function/ method\n\tputs \"This is an introduction program to ruby.\" # puts includes \\n newline before displaying a string\n\tputs \"If you entered this from the command line it would have looked something like this...\"\n\tputs \"\\n\\t$\\t#{$0}\" # \"#{$0}\"\" displays the script ran from the command line. \nend", "title": "" }, { "docid": "f0a70e84ff42b1a21c30d7c0bd6fbbe8", "score": "0.57679677", "text": "def output()\n add_newline if @linebreak\n @text\n end", "title": "" }, { "docid": "ce4f5a5f54aecc9bf3a6be8aafe20adc", "score": "0.5751087", "text": "def line\n puts \"########################################################\"\nend", "title": "" }, { "docid": "3ce456754ffa7f5097f5e5606005b204", "score": "0.5702184", "text": "def usage\n\tputs \"ruby unicorn2vba.rb unicornOutputFileHere\" \nend", "title": "" }, { "docid": "38b6312ba007b3754ab89c4fd65b8cfb", "score": "0.5701208", "text": "def emit(s, out: $output)\n out.print(TAB, s)\nend", "title": "" }, { "docid": "38b6312ba007b3754ab89c4fd65b8cfb", "score": "0.5701208", "text": "def emit(s, out: $output)\n out.print(TAB, s)\nend", "title": "" }, { "docid": "38b6312ba007b3754ab89c4fd65b8cfb", "score": "0.5701208", "text": "def emit(s, out: $output)\n out.print(TAB, s)\nend", "title": "" }, { "docid": "8711e057b888e9f5b0bfcdb2fe196786", "score": "0.5701151", "text": "def get_current_doc_path\n run_applescript <<HERE\n tell application id \"OGfl\"\n set currentDocument to document of front window\n set p to path of currentDocument\n do shell script \"echo \" & quoted form of p\n end tell\nHERE\nend", "title": "" }, { "docid": "893e6a911f7f81d8f2caffaaf5c718dc", "score": "0.5684601", "text": "def printResult(result)\r\n puts\r\n puts \" Least number of times you can copy paste a \"\r\n puts \" print statement: #{result}\"\r\n puts \"======================== END ========================\\n\\n\"\r\nend", "title": "" }, { "docid": "a571ff69f9140dac91bfc07c5b79f333", "score": "0.56593174", "text": "def run_code(code)\n @output.puts # spacer\n begin\n @output.puts \" BEGIN DEBUG \".center(WIDTH, '=')\n eval(code.join(\"\\n\")) # Need to join, since +code+ is an Array.\n @output.puts \" END DEBUG \".center(WIDTH, '=')\n rescue Exception => error\n @output.puts \" DEBUG FAILED \".center(WIDTH, '=')\n @output.puts error\n end\n @output.puts # spacer\n end", "title": "" }, { "docid": "913731cfa677953eb55f173dac9030c9", "score": "0.56429154", "text": "def output text\n puts text\n end", "title": "" }, { "docid": "b837a51f11327985e2a7d9ca794fc482", "score": "0.5620908", "text": "def show_line\n say \"=\" * 25\nend", "title": "" }, { "docid": "9cbe204d3b795c12f458a9903846a7d1", "score": "0.5612413", "text": "def ishowu_applescriptify\n execute_applescript(%Q`\n try\n tell application \"Finder\"\n set the a_app to (application file id \"com.tcdc.Digitizer\") as alias\n end tell\n set the plist_filepath to the quoted form of ¬\n ((POSIX path of the a_app) & \"Contents/Info\")\n do shell script \"defaults write \" & the plist_filepath & space ¬\n & \"NSAppleScriptEnabled -bool YES\"\n end try\n `)\n end", "title": "" }, { "docid": "2c2c0a49c63c7ddeba70c62260f4e91d", "score": "0.558764", "text": "def show (i)\n puts \"@#{@line}:\" \\\n \"\\t#{@output[i].scan(/.{4}|.+/).join(\"_\") unless @instruction.nil?}\" \\\n \"\\t#{@cmd[:comments]}\"\n end", "title": "" }, { "docid": "17ded7ac4c906f8631a04a6776dcb258", "score": "0.5574076", "text": "def banner()\n print \"\"\" \n =================================================================\n =================================================================\n\t ==========International Morse Code translator v 0.0.1 =========\n ==========Transates user supplied Morse Code to text ============\n\t =================================================================\n ==========Coded by Rick Flores | nanotechz9l ====================\n ==========E-mail 0xnanoquetz9l<<\\|/>>gmail.com ===================\n\t =================================================================\n =================================================================\n \n\"\"\".foreground(:blue).bright\nend", "title": "" }, { "docid": "a8c4ecd3d60a335fa3b3962f4073c284", "score": "0.5563559", "text": "def output(text)\n puts text\n end", "title": "" }, { "docid": "b5e520eb79959d9698002006b5f9ecbf", "score": "0.5546059", "text": "def printed_code\n self.code.gsub('/','-')\n end", "title": "" }, { "docid": "b5e520eb79959d9698002006b5f9ecbf", "score": "0.5546059", "text": "def printed_code\n self.code.gsub('/','-')\n end", "title": "" }, { "docid": "19fc4f134e9a50586bf058d908c50ce9", "score": "0.5532358", "text": "def stamp\n @output.write(\"#{ESC}o\")\n end", "title": "" }, { "docid": "d29be81a3bb9dd4ce87ea537d2e048e4", "score": "0.55212826", "text": "def script; end", "title": "" }, { "docid": "d29be81a3bb9dd4ce87ea537d2e048e4", "score": "0.55212826", "text": "def script; end", "title": "" }, { "docid": "93d071d260dc8b022a8a81e496f14c55", "score": "0.55205923", "text": "def render_code(exe_str, display_str = nil)\n dsp_str = display_str\n dsp_str = exe_str if !display_str\n dsp_str.strip!\n #puts \"exe_str: #{exe_str}\"\n stack :margin_bottom => 12 do \n background rgb(210, 210, 210), :curve => 4\n para dsp_str, {:size => 9, :margin => 12, :font => 'monospace'}\n stack :top => 0, :right => 2, :width => 70 do\n stack do\n background \"#8A7\", :margin => [0, 2, 0, 2], :curve => 4 \n para link(\"Run this\", :stroke => \"#eee\", :underline => \"none\") { eval(exe_str, TOPLEVEL_BINDING) },\n :margin => 4, :align => 'center', :weight => 'bold', :size => 9\n end\n stack :top => 0, :right => 2, :width => 70 do\n background \"#8A7\", :margin => [0, 2, 0, 2], :curve => 4 \n para link(\"Copy this\", :stroke => \"#eee\", :underline => \"none\") { self.clipboard = exe_str },\n :margin => 4, :align => 'center', :weight => 'bold', :size => 9\n end\n end\n end\n end", "title": "" }, { "docid": "892f17c1641927338f49854a6c8be0b8", "score": "0.5516091", "text": "def say(output)\n puts \"===> #{output} <===\"\nend", "title": "" }, { "docid": "63222735a92c89aa22057d936f9da44b", "score": "0.55078626", "text": "def ruby\n unless @ruby\n @ruby = \"\"\n @body.each_line do |l|\n @commands << {:ruby => l}\n @ruby << l\n end\n end \n @ruby\n end", "title": "" }, { "docid": "8cdca65768f25c2397481231990e31e8", "score": "0.5463619", "text": "def draw\n $code.each { |color| print \"[ #{Rainbow(\"o\").background(color)} ] \" }\n puts \"\\n\\n\"\n end", "title": "" }, { "docid": "2930c2c1e40d92d8b43cdcfff261b2cf", "score": "0.545966", "text": "def code_with_trailing_space\n code.chomp+\" \"\n end", "title": "" }, { "docid": "74d56124a84e7895ec67fc911d704517", "score": "0.5442783", "text": "def show\n \"\\t#{@line}: #{first_line}\"\n end", "title": "" }, { "docid": "eb72af785bb7b9dc85d6b888896f83d5", "score": "0.5440083", "text": "def type_via_applescript(str, opts = {})\n opts[:speed] = 50 unless !opts[:speed].nil?\n opts[:speed] = opts[:speed] / 1000.0\n\n full_str = \"\"\n str.split(\"\").each do |a|\n a.gsub!(/\"/, '\\\"')\n full_str += \"delay #{opts[:speed]}\\n\" if !full_str.empty?\n full_str += \"keystroke \\\"#{a}\\\"\\n\"\n end\n cmd = %Q'\n tell application \"System Events\"\n set frontApp to name of first item of (processes whose frontmost is true)\n tell application frontApp\n #{full_str}\n end\n end tell\n '\n execute_applescript cmd\n\n str\n end", "title": "" }, { "docid": "bb0a4cfa8c7b114bba86acfd023c6592", "score": "0.54200757", "text": "def welcome\n puts <<-END\nWelcome to the voting simulator!\nHave fun!\n END\nend", "title": "" }, { "docid": "7f6c866a4d009d6482da8fff7121e520", "score": "0.541912", "text": "def emitln(s, out: $output)\n emit(s, out: out)\n out.puts\nend", "title": "" }, { "docid": "7f6c866a4d009d6482da8fff7121e520", "score": "0.541912", "text": "def emitln(s, out: $output)\n emit(s, out: out)\n out.puts\nend", "title": "" }, { "docid": "7f6c866a4d009d6482da8fff7121e520", "score": "0.541912", "text": "def emitln(s, out: $output)\n emit(s, out: out)\n out.puts\nend", "title": "" }, { "docid": "949a571b2d08da40117677ffb006605e", "score": "0.5416297", "text": "def as_execute(script)\n #from applescript gem, by Lucas Carlson\n osascript = `which osascript`\n if not osascript.empty? and File.executable?(osascript)\n raise AppleScriptError, \"osascript not found, make sure it is in the path\"\n else\n #result = `osascript -e \"#{script.gsub('\"', '\\\"')}\" 2>&1`\n result = `osascript -s s -e \"#{script.gsub('\"', '\\\"')}\"`\n if result =~ /execution error/\n raise AppleScriptError, result\n end\n result\n end\nend", "title": "" }, { "docid": "c4b01f29b11bf877d6bc24410882b174", "score": "0.5413543", "text": "def show_test_message\r\n cc 0x02\r\n puts \"Testing script #{@script}\"\r\n cc 0x07\r\n puts \"Type : \"\r\n puts \"reload to reload the script\"\r\n puts \"restart to restart the scene\"\r\n puts \"quit to quit the test\"\r\n print \"Commande : \"\r\n end", "title": "" }, { "docid": "2fd99d1db97e501d156482effbae9e5b", "score": "0.54088867", "text": "def joke1\n puts \"A peanut was walking down the street. He was a-salt-ed.\"\nend", "title": "" }, { "docid": "dc4c8360a11d039bc092921f2516189c", "score": "0.5399092", "text": "def say text\n @output.say text\n end", "title": "" }, { "docid": "56981a22edcb473aa92e30808d7380ef", "score": "0.53975195", "text": "def put_a_line\n puts \"\\n\"\n puts \"/\\\\\" * 40\n puts \"\\n\"\n end", "title": "" }, { "docid": "e78f33188896b620a5f2418f22c054dc", "score": "0.53959894", "text": "def helper\n return puts '\n ===================== CHANGE COORDINATES SPACE PROBES =========================\n | To run script you need to set a data of upland, actual position and commands |\n | Example: |\n | ruby change_coordinate.rb \" |\n | 5 5 |\n | 1 2 N |\n | LMLMLMLMM |\n | 3 3 E |\n | MMRMMRMRRM\" |\n | |\n | Note 1: You can use a file with extension csv or txt to run. Example: |\n | ruby change_coordinate.rb file.csv |\n | Or... |\n | ruby change_coordinate.rb file.txt |\n | |\n | Note 2: The file net to be exactly like first example. |\n | |\n | @author: fabiosoaresv |\n | @email: [email protected] |\n ================================================================================\n '\n end", "title": "" }, { "docid": "997936224517da5e5073f3a5ac9dae04", "score": "0.5388487", "text": "def execute(show_output=true, &block) #:yield: output\n print_output self.to_s, :debug\n # print_task 'shell', self.to_s, :debug if show_output\n Xcode::Shell.execute(self, false) do |line|\n print_input line.gsub(/\\n$/,''), :debug if show_output\n yield(line) if block_given?\n end\n end", "title": "" }, { "docid": "47dfc0ccc511882161f4e702b948943a", "score": "0.53834003", "text": "def say text\n @output.say text\n end", "title": "" }, { "docid": "dad158fa4cf2b20730358d78e3a5e218", "score": "0.53728473", "text": "def print_output()\n\t#print \"$array= \\n\"\n\t$array.each { |i| i.each {\n\t\t\t\t\t |j|\n\t\t\t\t\t case j\n\t\t\t\t\t when 4\n\t\t\t\t\t \tprint \"•\"\n\t\t\t\t\t when 3\n\t\t\t\t\t \tprint \"x\"\n\t\t\t\t\t when 2\n\t\t\t\t\t \tprint \"*\"\n\t\t\t\t\t when 1\n\t\t\t\t\t \tprint \"█\"\n\t\t\t\t\t when 0\n\t\t\t\t\t \tprint \" \"\n\t\t\t\t\t end }\n\t\t\t\t print \"\\n\"}\nend", "title": "" }, { "docid": "3200cfc64003d6c9e32075a25b2abbe7", "score": "0.53703654", "text": "def titleSlide()\n=begin \n print \"\\n-------------------------------------------------------------------------\\n\"\n print $titleSlideFont.write(\"Console Light Show\")\n print \"\\nA program for Joshua Bruce\\nWritten with love by Robert Leslie\\n\"\n print \"---------------------------------------------------------------------------\\n\"\n=end\n titleSlideFont = TTY::Font.new(:standard)\n titleBox = TTY::Box.frame(\n width: TTY::Screen.width-1,\n height: 15,\n border: :thick,\n align: :center,\n padding: 1\n )do\n \"#{titleSlideFont.write(\"Console Light Show\")}\n \\nA program for Joshua Bruce\\nWritten with love by Robert Leslie\\n2019\"\n end\n print titleBox\n menu()\nend", "title": "" }, { "docid": "a807ee6c6e1c3c0f24b76c67161d7228", "score": "0.53659946", "text": "def interp\n rboutput = `ruby #{RB_FILE} #{RBTEX_OUT}`\n if rboutput == ''\n puts 'Your ruby file had no puts statments'.green\n end\n return 0\nend", "title": "" }, { "docid": "b1c83e57da7482ddd25240f8c128bde3", "score": "0.5358616", "text": "def go\n puts Rainbow(<<-PARAGRAPH # hyphen allows the end marker to be indented\n \\n\\n\\n\n /$$ /$$ /$$ /$$$$$$$$ /$$ /$$\n | $$ | $$ |__/|__ $$__/ |__/| $$\n | $$ | $$ /$$$$$$ /$$$$$$ /$$$$$$ /$$ | $$ /$$$$$$ /$$| $$ /$$$$$$$\n | $$$$$$$$ |____ $$ /$$__ $$ /$$__ $$| $$ | $$ |____ $$| $$| $$ /$$_____/\n | $$__ $$ /$$$$$$$| $$ \\ $$| $$ \\ $$| $$ | $$ /$$$$$$$| $$| $$| $$$$$$\n | $$ | $$ /$$__ $$| $$ | $$| $$ | $$| $$ | $$ /$$__ $$| $$| $$ \\____ $$\n | $$ | $$| $$$$$$$| $$$$$$$/| $$$$$$$/| $$ | $$| $$$$$$$| $$| $$ /$$$$$$$/\n |__/ |__/ \\_______/| $$____/ | $$____/ |__/ |__/ \\_______/|__/|__/|_______/\n | $$ | $$\n | $$ | $$\n |__/ |__/ \\n\n PARAGRAPH\n ).blue.bright.blink\nend", "title": "" }, { "docid": "ddc5dfe34f0b44cf6b975f3ce580852a", "score": "0.5346349", "text": "def taph\n tap {\n puts \"<pre>\" +\n \"#{File.basename caller[2]}: #{self.inspect}\".gsub('&', '&amp;').gsub('<', '&lt;') +\n \"</pre>\"\n }\n end", "title": "" }, { "docid": "3fc0f343c3e3defc21228fcecce97c52", "score": "0.53428394", "text": "def output\n temp_string = basic_output()\n if @polygon != nil\n temp_string = temp_string + \"$Polygon\\n\"\n temp_string = temp_string + \"$\\t#{@polygon.utype} = #{@polygon.commandName}\\n\"\n end\n if @zone != nil\n temp_string = temp_string + \"$Zone\\n\"\n temp_string = temp_string + \"$\\t#{@zone.utype} = #{@zone.commandName}\\n\"\n end\n return temp_string\n end", "title": "" }, { "docid": "88d98e3fc2a6d6adf5ae5135fd734ea4", "score": "0.53412414", "text": "def pretty_system(code)\n require 'shellwords'\n cmds = Shellwords.shellsplit(code)\n cmds << \"2>&1\"\n\n status =\n Tools.popen4(*cmds) do |pid, i, o, e|\n i.close\n\n last = nil\n clear_on_nl = false\n while c = o.getc\n # Because Ruby 1.8.x returns a number on #getc\n c = \"%c\" % [c] if c.is_a?(Fixnum)\n\n break if o.closed?\n if last == \"\\n\"\n if clear_on_nl\n clear_on_nl = false\n print \"\\033[0m\"\n end\n\n # Color the verbose echo commands\n if c == \"$\" && ((c += o.read(1)) == \"$ \")\n clear_on_nl = true\n print \" \"*7 + \"\\033[32m#{c}\\033[34m\"\n\n # (Don't) color the status messages\n elsif c == \"-\" && ((c += o.read(5)) == \"----->\")\n print c\n\n # Color errors\n elsif c == \"=\" && ((c += o.read(5)) == \"=====>\")\n print \"\\033[31m=====>\\033[0m\"\n\n else\n print \" \"*7 + c\n end\n else\n print c\n end\n\n last = c\n end\n end\n status.exitstatus\n end", "title": "" }, { "docid": "11d6527086ab119eae27dcc1759669bb", "score": "0.5330287", "text": "def stdout; end", "title": "" }, { "docid": "11d6527086ab119eae27dcc1759669bb", "score": "0.5330287", "text": "def stdout; end", "title": "" }, { "docid": "11d6527086ab119eae27dcc1759669bb", "score": "0.5330287", "text": "def stdout; end", "title": "" }, { "docid": "11d6527086ab119eae27dcc1759669bb", "score": "0.5330287", "text": "def stdout; end", "title": "" }, { "docid": "11d6527086ab119eae27dcc1759669bb", "score": "0.5330287", "text": "def stdout; end", "title": "" }, { "docid": "11d6527086ab119eae27dcc1759669bb", "score": "0.5330287", "text": "def stdout; end", "title": "" }, { "docid": "9a222f29fdecbd121b1a2cf71741e9b7", "score": "0.5322476", "text": "def raw\n text = (@parse_results[:command][1..-1].map {|a| a[:text]}).join(\" \")\n ((EventPrinter::Vocab::Command + \" \") * (@parse_results[:indent] + 1)) + text\n end", "title": "" }, { "docid": "d9c85f8a529888e91aaed0c9aefd1aba", "score": "0.5316559", "text": "def showInformation()\n print(\"Starting up the scraper for the RAND Terrorism Incident Database. The flashing numbers that will appear represent written incidents. It will take a few moments for the initial program to load... \\n\");\nend", "title": "" }, { "docid": "7cf8bf7e978be1db1f752c3dbac20672", "score": "0.53145635", "text": "def print_menu\n puts \"\"\"\n 1. Input the students\n 2. Show the students\n 9. Exit\n \"\"\"\nend", "title": "" }, { "docid": "e9e9e3cfd69f2ac240fcaed96709ba4a", "score": "0.5305284", "text": "def output\n\t\tputs \"Our favorite language is #{@gemlove}. We think #{@gemlove} is better than #{@gemhate}.\"\n\tend", "title": "" }, { "docid": "b84ee07f7c9beb4267a22acc12b7bcc2", "score": "0.5300422", "text": "def lines_of_code; end", "title": "" }, { "docid": "b84ee07f7c9beb4267a22acc12b7bcc2", "score": "0.5300422", "text": "def lines_of_code; end", "title": "" }, { "docid": "1264c230022b974060644431f0f5deef", "score": "0.5295791", "text": "def to_s\n \"$ \" + input + \"\\n\" + output\n end", "title": "" }, { "docid": "239fff247a4efc6e34ee9f884014a6e5", "score": "0.5293491", "text": "def read_script\n DATA.readlines.collect { |line|\n line = line.chomp.delete(\"\\t\").delete(\"\\n\")\n line = \"-e '#{line}' \"\n }.join\nend", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.528664", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.528664", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.528664", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.528664", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.528664", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.528664", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.528664", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.528664", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.528664", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.528664", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.528664", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.528664", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.528664", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.528664", "text": "def output; end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.528664", "text": "def output; end", "title": "" }, { "docid": "9cdb6cd42731baec25410d9f56f6c5fd", "score": "0.5286505", "text": "def show_code_buffer(code)\n return (@output.puts \"Buffer empty.\") if code.size.zero?\n @output.puts \"== BUFFER ==\\n\"\n code.each_with_index do |buf, line_num|\n @output.print \"#{line_num + 1}: \".rjust(5)\n @output.puts buf\n end\n end", "title": "" }, { "docid": "7fa539d09a64b9f6c83e50130596b869", "score": "0.52860695", "text": "def usage\n puts <<EOU\nUSAGE:\n #{__FILE__} [ARGUMENT]\n\nArgument:\n -h, --help Visa denna information\n\n -a, --alias ALIAS Lista alias vars 'alias' matchar ALIAS\n -r, --reciever MOTTAGARE Lista alias vars 'mottagare' matchar MOTTAGARE\n\nTIPS: Använd tillsammans med less om listan är för lång:\n\n #{__FILE__}|less\n\nEOU\n\n # We also exit the script here..\n exit(0)\nend", "title": "" }, { "docid": "cce91bde41dd36501dbe16ebaf1eec29", "score": "0.52817816", "text": "def print_script(os = $stdout)\n @initial.each { |str| os.puts \"initial: #{str}\" }\n @final.each { |str| os.puts \"final: #{str}\" }\n @quit.each { |str| os.puts \"quit: #{str}\" }\n @pre.each { |src,dest| os.puts \"pre: #{src} #{dest}\" }\n @post.each { |src,dest| os.puts \"post: #{src} #{dest}\" }\n @synons.values.each { |arr| os.puts \"synon: #{arr.join(' ')}\" }\n @keys.values.each { |key| key.print(os) }\n end", "title": "" }, { "docid": "7a6da5dc83de1f55851c542c083b5eb7", "score": "0.5272157", "text": "def source_line; end", "title": "" }, { "docid": "e6a26b0cda611e7dc88fe780dc0b1450", "score": "0.5265338", "text": "def sysout(string)\n\tputs (\"[SYSTEM]: \" + string) \nend", "title": "" }, { "docid": "e6a26b0cda611e7dc88fe780dc0b1450", "score": "0.5265338", "text": "def sysout(string)\n\tputs (\"[SYSTEM]: \" + string) \nend", "title": "" }, { "docid": "6267e8d83dc484ef003467e96b173c43", "score": "0.5256732", "text": "def to_script_code(skip_separator_index = 0)\n payload = to_payload\n payload = subscript_codeseparator(skip_separator_index) if skip_separator_index > 0\n Tapyrus.pack_var_string(payload)\n end", "title": "" }, { "docid": "561518877e79361ac4c94bf95f324d43", "score": "0.525449", "text": "def end_program\n # ascii text from http://patorjk.com/software/taag/\n puts \"\n \n --.--| | \n | |---.,---.,---.|__/ ,---. \n | | |,---|| || \\ `---. \n ` ` '`---^` '` ``---' \n ,---. \n |__. ,---.,---. \n | | || \n | ` `---'` o \n ,---.| ,---., ..,---.,---.\n | || ,---|| ||| || |\n |---'`---'`---^`---|`` '`---|\n | `---' `---'\n \"\n puts \"Created by Philip Sterling and Karen Go \\nwith Flatiron School Seattle-Web-060319\\n\\n\\n\\n\\n\".blue\nend", "title": "" }, { "docid": "ee1b6c7857efa798ae7d785ceed43ba5", "score": "0.52514786", "text": "def what_is code\n print \"#{code}: \"\n puts(opcodes[add_underline(code)] || 'undefined')\nend", "title": "" }, { "docid": "bcb074d75eee84096c3a06f3599d055c", "score": "0.5246182", "text": "def print_to_output(text)\n if Object.const_defined?('Shamus')\n asset = Shamus.current.current_step.add_inline_asset('.txt', Shamus::Cucumber::InlineAssets::RENDER_AS_TEXT)\n File.open(asset, 'w') { |f| f.puts(\"#{text}\") }\n else\n puts \"#{text}\"\n end\n end", "title": "" }, { "docid": "8b3e8b66803bac42e0aed4823db1767e", "score": "0.5245292", "text": "def line\n\tputs \"-\" * 100\nend", "title": "" }, { "docid": "3d451cd49374140adae5840a1cb23b86", "score": "0.52431566", "text": "def displayln(out=$stdout)\n out.puts self\n end", "title": "" }, { "docid": "769b906348268ae053e46fd27ec6c4a6", "score": "0.52413857", "text": "def echo(value); end", "title": "" }, { "docid": "769b906348268ae053e46fd27ec6c4a6", "score": "0.52413857", "text": "def echo(value); end", "title": "" }, { "docid": "ba6ffe9f76085453e7b2bdc3c941294e", "score": "0.5238535", "text": "def echo(text)\n\ttext \nend", "title": "" }, { "docid": "c4a06cc3fc97f7843fdb860e12c89f58", "score": "0.5237826", "text": "def my_first_interpreter code\n # Implement your interpreter here\n text = ''\n count = 0\n x = 0\n while x < code.length do \n if code[x] == '+'\n count += 1\n elsif code[x] == '.'\n text << count.chr\n end\n if count >= 256\n count = 0\n end\n x += 1\n end\n text\nend", "title": "" }, { "docid": "cd71ff3a8ed0c3cdf5de914ca7fa426a", "score": "0.52334046", "text": "def save_document_via_applescript()\n run_applescript <<HERE\n tell application id \"OGfl\"\n save front document\n end tell\nHERE\nend", "title": "" }, { "docid": "23226dcf2d7dae388cab815e2fbe1c06", "score": "0.5227369", "text": "def display_puppetfile(puppetfile_contents)\n puts <<-EOF\n\nYour Puppetfile has been generated. Copy and paste between the markers:\n\n=======================================================================\n#{puppetfile_contents.chomp}\n=======================================================================\n EOF\n end", "title": "" } ]
d32e40913252f847bdcd79e2f24f37cc
Returns the maximum size of the queue.
[ { "docid": "5d5fad07c583c408469854669388857d", "score": "0.0", "text": "def max\n @max\n end", "title": "" } ]
[ { "docid": "5f021a251b7c09b660e41a7afd09f6c1", "score": "0.8248831", "text": "def max_queue_count()\n @max_queue_count\n end", "title": "" }, { "docid": "ac95e731273bb5e66c281e458d3f4f68", "score": "0.78035843", "text": "def queue_size\n _get(\"/system/queue-size\") { |json| json }\n end", "title": "" }, { "docid": "b5fdfb7287db19bb422de8fa5bc7a6d8", "score": "0.77765614", "text": "def size\n @max\n end", "title": "" }, { "docid": "f6dd1ee4893f815fee6fdbc5ababf5c8", "score": "0.7671496", "text": "def get_queue_size\n if @number_of_processes\n @queueSize = @number_of_processes\n else\n @queueSize = DATSauce::PlatformUtils.processor_count * 2\n # get max threads from platform utils\n end\n @queueSize\n end", "title": "" }, { "docid": "c2d2c0aabbbeb37a14a535b216e8ae17", "score": "0.7521967", "text": "def queue_size\n @redis.llen(\"xque:queue:#{@queue_name}\")\n end", "title": "" }, { "docid": "d3104eb7a051d590d42b5b2f5a0090b5", "score": "0.75029206", "text": "def queue_size(queue)\n Resque.size(queue)\n end", "title": "" }, { "docid": "cb597a890d76de98673c450b0de40498", "score": "0.74986625", "text": "def size\n @queue.size\n end", "title": "" }, { "docid": "5a3df9c050822979b2ce0f526e19f500", "score": "0.7478602", "text": "def size\n @queue.size\n end", "title": "" }, { "docid": "1ff4737b61d1ab5ab81735d89ca5eac8", "score": "0.74686503", "text": "def size\n @queue.size\n end", "title": "" }, { "docid": "26f809c7f48ff927658c5e419978a534", "score": "0.74562824", "text": "def size\n\n @queue.size\n end", "title": "" }, { "docid": "b979ac0e5fba8e21cb6d1cf29a1c1b70", "score": "0.7451859", "text": "def size\n @queue.size\n end", "title": "" }, { "docid": "eabac137505e7dee30cc9edc05e8bb67", "score": "0.741948", "text": "def max_size\n @max_size ||= options[:max_size] || [DEFAULT_MAX_SIZE, min_size].max\n end", "title": "" }, { "docid": "3bd9770f0b3edf2762564937de0b4ec6", "score": "0.7355977", "text": "def queue_length\n @executor.getQueue.size\n end", "title": "" }, { "docid": "2f25b5ace7f9f76f48b485e3d11c4519", "score": "0.72871846", "text": "def size\n @max_entries\n end", "title": "" }, { "docid": "6ae65e30a656514880d2efd150f4e4d8", "score": "0.727519", "text": "def remaining_capacity\n @max_queue == 0 ? -1 : @executor.getQueue.remainingCapacity\n end", "title": "" }, { "docid": "aea1a01d772a37dde6471cec018e93c3", "score": "0.7269554", "text": "def size\n @mutex.synchronize { @queue.size }\n end", "title": "" }, { "docid": "ec97167e233aaeb52d88608484318038", "score": "0.7259476", "text": "def queue_length\n @job_queue.length\n end", "title": "" }, { "docid": "ed21e3dc17b331fa63dbf5bab25d1a0d", "score": "0.72501767", "text": "def max\n if size == 0\n 0/0.0\n else\n self.size - 1\n end\n end", "title": "" }, { "docid": "758d4e9508e3ba6aadc042f939e97aca", "score": "0.7227436", "text": "def remaining_capacity\n mutex.synchronize { @max_queue == 0 ? -1 : @max_queue - @queue.length }\n end", "title": "" }, { "docid": "190062b7ce7f35f21fb348f9d0408408", "score": "0.7226148", "text": "def max_size\n @group.max_size\n end", "title": "" }, { "docid": "1731765cbbbd34277ff9c818437c1746", "score": "0.7213366", "text": "def queue_length\n if system.empty?\n 0\n else\n system.length - 1\n end\n end", "title": "" }, { "docid": "7b323daf18b2dbe60aa81d122cb6b998", "score": "0.71724147", "text": "def item_max\n return @data.size\n end", "title": "" }, { "docid": "7b323daf18b2dbe60aa81d122cb6b998", "score": "0.71724147", "text": "def item_max\n return @data.size\n end", "title": "" }, { "docid": "b5105d49905ca12cf2fd154fd56f6e26", "score": "0.7110121", "text": "def queue_count()\n @queue.length\n end", "title": "" }, { "docid": "4d283c6654e811c684e1d5754d0d9191", "score": "0.70997703", "text": "def queue_length\n @queues.inject(0) do |length, (_, queue)|\n length + queue.length\n end\n end", "title": "" }, { "docid": "f65b9292cc01a5fa37c8ef8686450ee5", "score": "0.7099175", "text": "def length\n @queue.length\n end", "title": "" }, { "docid": "bde3a54fd6a4ebf3449edc568c154e62", "score": "0.707078", "text": "def length\n @queue.length\n end", "title": "" }, { "docid": "54b389996840a8717e1b6b4b3f3e9aaf", "score": "0.70648956", "text": "def max_size; end", "title": "" }, { "docid": "99bfb8d0c8d0066e28c7ba5eaf11e85e", "score": "0.7040667", "text": "def queue_length\n mutex.synchronize { running? ? @queue.length : 666 }\n end", "title": "" }, { "docid": "861765887c551a9e8ba148301de79d5a", "score": "0.7036149", "text": "def queue_length\n request_queue.length\n end", "title": "" }, { "docid": "8d6745b97ed960429beb0d85b569d8fa", "score": "0.7028277", "text": "def largest_length\n @executor.getLargestPoolSize\n end", "title": "" }, { "docid": "7914a79d1ed47f81c3be17f956fa8c81", "score": "0.7005138", "text": "def work_queue_size()\n @work_queue.size\n end", "title": "" }, { "docid": "339e3d68091f62e66029526d1d7e0b5b", "score": "0.6961257", "text": "def size\n Float::MAX.to_i\n end", "title": "" }, { "docid": "1f15ff5305e1c72ba4faed20d4849fea", "score": "0.69398326", "text": "def z_queue_size(queue)\n handle_pipeline(@redis.zcount(redis_key_for_queue(queue), 0, Float::INFINITY), &:to_i)\n end", "title": "" }, { "docid": "0bf49b50b393f027c909ae9cf1e617a1", "score": "0.6932718", "text": "def item_max\r\n @list.size\r\n end", "title": "" }, { "docid": "7ec5d96886394f408f9745066bc978b5", "score": "0.6913946", "text": "def item_max\n return @data.nil? ? 0 : @data.size\n end", "title": "" }, { "docid": "c75e2c3e36ad8cc3661aca01a7153665", "score": "0.68992096", "text": "def size\n self.queued.inject(0) { |result, data| result + data.last.size }\n end", "title": "" }, { "docid": "e110fc54435fcfc1fa3b966133ca3f14", "score": "0.68891245", "text": "def item_max\n return 0 unless @data\n @data.size\n end", "title": "" }, { "docid": "4be4465a60044d8eec5c615f9cafbe42", "score": "0.6866666", "text": "def item_max\n @data.nil? ? 0 : @data.size\n end", "title": "" }, { "docid": "d9689d1651b668500a8489a9670aa5d0", "score": "0.68431723", "text": "def item_max\n @data ? @data.size : 0\n end", "title": "" }, { "docid": "d9689d1651b668500a8489a9670aa5d0", "score": "0.68431723", "text": "def item_max\n @data ? @data.size : 0\n end", "title": "" }, { "docid": "d9689d1651b668500a8489a9670aa5d0", "score": "0.68431723", "text": "def item_max\n @data ? @data.size : 0\n end", "title": "" }, { "docid": "d9689d1651b668500a8489a9670aa5d0", "score": "0.68431723", "text": "def item_max\n @data ? @data.size : 0\n end", "title": "" }, { "docid": "d9689d1651b668500a8489a9670aa5d0", "score": "0.68431723", "text": "def item_max\n @data ? @data.size : 0\n end", "title": "" }, { "docid": "d9689d1651b668500a8489a9670aa5d0", "score": "0.68431723", "text": "def item_max\n @data ? @data.size : 0\n end", "title": "" }, { "docid": "d9689d1651b668500a8489a9670aa5d0", "score": "0.68431723", "text": "def item_max\n @data ? @data.size : 0\n end", "title": "" }, { "docid": "6cae24fdbddd693b289c95c75a1020af", "score": "0.684315", "text": "def specific_max_size(number)\n [self.size, number].min\n end", "title": "" }, { "docid": "10d2dd3bd00891847ea9a13203571311", "score": "0.6834036", "text": "def max\n max = @storage[0]\n @size.times do |i|\n if @storage[i] > max\n max = @storage[i]\n end\n\n end\n return max\n end", "title": "" }, { "docid": "db69ec14fc0ca1da59cc42e8b3a55b23", "score": "0.6796443", "text": "def max_allocated_storage\n data[:max_allocated_storage]\n end", "title": "" }, { "docid": "62a816d1b3784dd648ebd4c5a3779b05", "score": "0.6792148", "text": "def max_size_in_megabytes\n to_i description['MaxSizeInMegabytes']\n end", "title": "" }, { "docid": "d6d409adf077b462d78237306d905450", "score": "0.6778212", "text": "def maximum_size\n @ids.size\n end", "title": "" }, { "docid": "724ec63ad111d559f25fdac5ee0f4550", "score": "0.6776824", "text": "def maximum_bytes_billed\n Integer @gapi.configuration.query.maximum_bytes_billed\n rescue StandardError\n nil\n end", "title": "" }, { "docid": "22491197a07840a8b0a5ecdd8dc8887e", "score": "0.67710155", "text": "def max\n puts 'Queue id empty' and return if @root.nil?\n q = QueueWithLinkedList.new\n q.enqueue(@root)\n max = 0\n while !q.isEmpty?\n node = q.dequeue\n max = node.data if node.data > max\n q.enqueue(node.left) if node.left\n q.enqueue(node.right) if node.right\n end\n return max\n end", "title": "" }, { "docid": "976f89abf79972a31d5da661600425de", "score": "0.67681736", "text": "def max_length\n @executor.getMaximumPoolSize\n end", "title": "" }, { "docid": "44967ac864a5aff42c4113a4991119c9", "score": "0.6750174", "text": "def max\n start_addr + size - 1\n end", "title": "" }, { "docid": "f079f201504570af9c0545ebd14a52c9", "score": "0.67423236", "text": "def size\n\t\t\[email protected] + @queue.size\n\t\tend", "title": "" }, { "docid": "f631c7ee09b2147aeb8d5b68d602a7a8", "score": "0.66864866", "text": "def max_size\n 1\n end", "title": "" }, { "docid": "a96d32edaea257f1158da0662f465609", "score": "0.66851544", "text": "def maximum_queued_data_size\n super\n end", "title": "" }, { "docid": "545949aea1c497a034758f8eeee696c5", "score": "0.6684429", "text": "def item_max\n @data ? @data.size : 1;\n end", "title": "" }, { "docid": "e330d83b2717fc65d36f76d5a61653c7", "score": "0.6668468", "text": "def max_size=(_arg0); end", "title": "" }, { "docid": "496751fb57ac48e5e1bdb3767ec4e3c6", "score": "0.66547513", "text": "def queue_size(paypal_id)\n queue = @queue_map[paypal_id]\n if(queue.nil?)\n 0\n else\n queue.size\n end\n end", "title": "" }, { "docid": "a3dd025ee64c41b7c034a76cedc950f3", "score": "0.6645287", "text": "def queue_count\n @queues.length\n end", "title": "" }, { "docid": "2e706656134abd75fce3d90b239cc2c4", "score": "0.6631117", "text": "def gevent_queue_size\r\n return @proc_queue.size\r\n end", "title": "" }, { "docid": "eccf9ee0da5dbd898d1381b60c132a69", "score": "0.6596975", "text": "def item_max\n @data ? @data.size : 1\n end", "title": "" }, { "docid": "eccf9ee0da5dbd898d1381b60c132a69", "score": "0.6596975", "text": "def item_max\n @data ? @data.size : 1\n end", "title": "" }, { "docid": "eccf9ee0da5dbd898d1381b60c132a69", "score": "0.6596975", "text": "def item_max\n @data ? @data.size : 1\n end", "title": "" }, { "docid": "eccf9ee0da5dbd898d1381b60c132a69", "score": "0.6596975", "text": "def item_max\n @data ? @data.size : 1\n end", "title": "" }, { "docid": "eccf9ee0da5dbd898d1381b60c132a69", "score": "0.6596975", "text": "def item_max\n @data ? @data.size : 1\n end", "title": "" }, { "docid": "eccf9ee0da5dbd898d1381b60c132a69", "score": "0.6596975", "text": "def item_max\n @data ? @data.size : 1\n end", "title": "" }, { "docid": "7677358f8b79a889bd60f62bd1c397ad", "score": "0.6572924", "text": "def item_max; @data ? @data.size : 0; end", "title": "" }, { "docid": "5d9ceb2a62a562497fae14c57b87f3f6", "score": "0.6568162", "text": "def largest_sized_bucket\n keys = @buckets.keys.sort\n keys.reverse.inject(keys[0]) {|max, k| @buckets[max].size < @buckets[k].size ? k : max}\n end", "title": "" }, { "docid": "3e0e4bf92b51d8c76633b23e081511d3", "score": "0.6565133", "text": "def max_items\n main.max_items\n end", "title": "" }, { "docid": "e0aea7f9cd123cc979d3fd41020e9ee4", "score": "0.65431356", "text": "def max_box\n return @boxes.size\n end", "title": "" }, { "docid": "65815b4e055c9663bc7fb12922b64804", "score": "0.6538639", "text": "def queue_size(queue)\n prioritized?(queue) ? z_queue_size(queue) : super\n end", "title": "" }, { "docid": "3a924ce124f4733121a9b5e9ab5d65dc", "score": "0.65336734", "text": "def waitlist_size\n @queue.size\n end", "title": "" }, { "docid": "5674244ceaea4d761b9410bf96d486d4", "score": "0.65274394", "text": "def maxbytes\n @maxbytes ||= File.read('/proc/sys/kernel/keys/maxbytes').strip.to_i\n end", "title": "" }, { "docid": "b25bb2a77ced187d618be8e0cb292eca", "score": "0.6517034", "text": "def max\n array.length - 1\n end", "title": "" }, { "docid": "b8bd1415d09ac14cc74d57aeb4c3e965", "score": "0.6484727", "text": "def max_frame_size\n defined?(@max_frame_size) ? @max_frame_size : WebSocket.max_frame_size\n end", "title": "" }, { "docid": "58b4510f02209d7d5a68f192fd9288c1", "score": "0.64759195", "text": "def max_queue_threads\n 1\n end", "title": "" }, { "docid": "d8c2d5ece1fa5dd2f2ab2b9633539703", "score": "0.647259", "text": "def max_value_size\n @max_value_size ||= options[:values].max { |a, b| a.size <=> b.size }.size\n end", "title": "" }, { "docid": "33f069d447c79152d822068973063ae8", "score": "0.6460931", "text": "def max_size()\n ACCOUNTING_REPLY_MAX_SIZE\n end", "title": "" }, { "docid": "54722f2a8d41412352cbb03f84be9195", "score": "0.64441156", "text": "def queued_max_age\n max_age = 0\n \n @collection.find(status: 'QUEUED').each do |item|\n age = Time.now - item[\"queue_time\"]\n if age > max_age\n max_age = age\n end\n end\n\n return max_age\n end", "title": "" }, { "docid": "d2349ed7d0faa2a8bf74c7ad28a78fb7", "score": "0.64438295", "text": "def sizeof(queue, statistics = nil)\n statistics ||= stats\n\n if queue == :all\n available_queues.inject({}){|h,q| h[q] = sizeof(queue, statistics)}\n else\n IO.popen(\"#{db_stat} -d /tmp/qache/#{queue}\").readlines.\n detect{|line| line =~ /(\\d+)\\tNumber of records in the database\\n/ }\n $1.to_i\n end\n end", "title": "" }, { "docid": "a7e208676418ff1e2f9c2a62293e3b5e", "score": "0.6432806", "text": "def item_max\r\r\n @data ? @data.size : 1\r\r\n end", "title": "" }, { "docid": "cfdd3c5c8394cd7b483b6877a3c07c88", "score": "0.6427724", "text": "def get_max()\n return @maxs_stack.peek()\n end", "title": "" }, { "docid": "a53b4d67693fabbb671826cf852acaaa", "score": "0.6417447", "text": "def max\n @max ||= map {|a| a[0].length}.max\n end", "title": "" }, { "docid": "396e2f146d178751c180d0d4acb4c39a", "score": "0.6410276", "text": "def heap_maximum()\n\t\t@heap[0]\n\tend", "title": "" }, { "docid": "0299edba6e56eaea7c85ea93579b4447", "score": "0.6407529", "text": "def mailbox_size\n @strategy.mailbox_size\n end", "title": "" }, { "docid": "c18c3668bbce0886efb8961417a7bb48", "score": "0.64071935", "text": "def maxsize(value)\n merge(ormaxsize: value.to_s)\n end", "title": "" }, { "docid": "01b60ec690dbddfaf731778c73c7ae93", "score": "0.6393459", "text": "def specific_max_size(number); end", "title": "" }, { "docid": "a8e0de4e0a8c5ca67e1e5a5aab7a0476", "score": "0.63854855", "text": "def item_max\r\n \t@data ? @data.size : 1\r\n end", "title": "" }, { "docid": "2109f4a05720d4cdcc36514c2547617d", "score": "0.6381361", "text": "def local_maximum_packet_size; end", "title": "" }, { "docid": "d7ec01e5b1d2f05c50aa79fe610d278c", "score": "0.6380812", "text": "def cache_size\n\n @cache.maxsize\n end", "title": "" }, { "docid": "32824233fee85f3afde69affd1b81927", "score": "0.63806623", "text": "def backlog\n @queue.size\n end", "title": "" }, { "docid": "22c8b368b6d901a7a143c3da91f2860f", "score": "0.63718283", "text": "def max\n @keys[@keys.size-1]\n end", "title": "" }, { "docid": "79d87260d71e1a7eb8e480316e0857e6", "score": "0.63661855", "text": "def default_max_size\n [Setting[:histsize], self.size].min\n end", "title": "" }, { "docid": "f1de3817eef4357991db9bf26492db1b", "score": "0.63441825", "text": "def queued_messages\n @queue.length\n end", "title": "" }, { "docid": "626f306bee4fe2a6b4c88f125b90d207", "score": "0.6342512", "text": "def pending_size\n @redis.zcard(\"xque:pending:#{@queue_name}\")\n end", "title": "" }, { "docid": "08a3f9b8bf21ee1296a7d1740fc1a4ac", "score": "0.6336414", "text": "def maximum\n return @maximum\n end", "title": "" }, { "docid": "06af01994037b0dd440c0f33e4090b15", "score": "0.6331861", "text": "def sizeof(queue, statistics = nil)\n statistics ||= stats\n\n if queue == :all\n queue_sizes = {}\n available_queues(statistics).each do |queue|\n queue_sizes[queue] = sizeof(queue, statistics)\n end\n return queue_sizes\n end\n\n statistics.inject(0) { |m,(k,v)| m + v[\"queue_#{queue}_items\"].to_i }\n end", "title": "" }, { "docid": "f18526c9581a4dbe7402fddc0f433a81", "score": "0.6319775", "text": "def item_max\n @item_max\n end", "title": "" } ]
c6546d675b9c537427043c8b99179a4d
p first_anagram?("dog", "god") true p first_anagram?("dog", "cat") false Phase II: Write a method second_anagram? that iterates over the first string. For each letter in the first string, find the index of that letter in the second string (hint: use Arrayfind_index) and delete at that index. The two strings are anagrams if an index is found for every letter and the second string is empty at the end of the iteration. Try varying the length of the input strings. What are the differences between first_anagram? and second_anagram?? iterate through str1 if char.include?(str2) index at str2 = "" O(n)
[ { "docid": "c0c653d987fcf805a5ebba89c48da75e", "score": "0.85427636", "text": "def second_anagram?(str1, str2)\n str1_array = str1.chars\n str2_array = str2.chars\n\n str1_array.each_with_index do |char, idx|\n if str2_array.include?(char)\n index2 = str2_array.index(char)\n str2_array[index2] = \"\"\n end\n end\n\n str2_array.join.empty?\nend", "title": "" } ]
[ { "docid": "53cb0fc7623df3e7ec13dc1e3044cca4", "score": "0.87325275", "text": "def second_anagram?(string1, string2)#time O(n) #space O(n)\n string2 = string2.split('')\n string1.each_char do |char|\n index = string2.index(char) \n if !index.nil?\n string2.delete_at(index)\n end\n end\n string2.empty?\nend", "title": "" }, { "docid": "2a0941750239866b5558bf54fe9e6268", "score": "0.86981326", "text": "def second_anagram?(str1, str2) # O(n)\n str1_arr = str1.chars\n str2_arr = str2.chars\n\n str1_arr.each do |el|\n idx = str2_arr.find_index(el)\n str2_arr.delete(str2_arr[idx]) unless idx.nil?\n end\n\n str2_arr.empty?\nend", "title": "" }, { "docid": "88c48eebd29f5eb77e55cf7298190d85", "score": "0.86980623", "text": "def second_anagram?(string1, string2)\n string2 = string2.chars\n\n string1.each_char do |char|\n char_index = string2.find_index(char)\n string2.delete_at(char_index) if char_index\n end\n\n string2.empty?\nend", "title": "" }, { "docid": "5aa8cd0099da8645a0af936ee4caa68c", "score": "0.8690915", "text": "def second_anagram?(str1, str2)\n return false if str1.length != str2.length\n letters1 = str1.chars\n letters2 = str2.chars\n deleted = false\n\n idx = 0\n # debugger\n until letters1.empty? || letters2.empty?\n el = letters1[idx]\n letters2.each_with_index do |el2, idx2|\n if el == el2\n letters1.shift\n letters2.delete_at(idx2)\n deleted = true\n end\n end\n deleted ? idx = 0 : idx += 1\n end\n\n letters1.empty? && letters2.empty?\nend", "title": "" }, { "docid": "d8ddacc6e365f983748a592652437f75", "score": "0.86842066", "text": "def second_anagram?(str_1, str_2)\n str_array = str_2.chars\n str_1.each_char do |char|\n idx = str_array.find_index(char)\n return false if idx.nil?\n str_array.delete_at(idx)\n end\n str_array.empty?\nend", "title": "" }, { "docid": "9b42dd7f27b6462715f97c9313fac5b3", "score": "0.8677978", "text": "def second_anagram?(str1, str2)\n str1.chars.each do |char1|\n str2.delete!(char1)\n str1.delete!(char1)\n end\n str1.empty? && str2.empty?\nend", "title": "" }, { "docid": "475db3d08560858ffdc69b5959ffa226", "score": "0.8672201", "text": "def second_anagram?(str1, str2)\n str1.chars.each do |el|\n str2.delete!(str2[str2.chars.find_index(el)]) unless str2.chars.find_index(el).nil?\n end\n\n str2.empty?\nend", "title": "" }, { "docid": "229912139cd78bdb90b840cb938c7b13", "score": "0.86562717", "text": "def second_anagram?(str1,str2)\n debugger\n str2_arr = str2.split(\"\")\n str1.each_char do |letter|\n idx = str2_arr.find_index(letter)\n str2_arr.delete_at(idx) if idx\n end\n str2_arr.length == 0\nend", "title": "" }, { "docid": "7c652f8a0a269da79e160d48a3191d8e", "score": "0.86562675", "text": "def second_anagram?(word1, word2)\n first = word1.chars\n second = word2.chars \n\n first.each do |ch1|\n second.each do |ch2|\n if second.include?(ch1)\n second.delete_at(second.index(ch1))\n end\n end \n end\n\n second.empty?\nend", "title": "" }, { "docid": "8e5e61a46c24a2cb9df009d445352c48", "score": "0.86514604", "text": "def second_anagram?(string1, string2)\n return false if string1.length != string2.length\n letters1, letters2 = string1.chars, string2.chars\n\n letters1.each do |letter|\n idx = letters2.index(letter)\n return false unless idx\n letters2.delete_at(idx)\n end\n\n letters2.empty?\nend", "title": "" }, { "docid": "c289cd6437b4640c33d330b59cbba4e3", "score": "0.8641449", "text": "def second_anagram(str1, str2)\n str1_chars = str1.chars\n str2_chars = str2.chars\n\n str1.length.times do |i|\n if str2.include?(str1[i])\n str1_chars.each_with_index do |ch, j|\n if ch == str1[i]\n str1_chars.delete_at(j)\n end\n end\n str2_chars.each_with_index do |ch, j|\n if ch == str1[i]\n str2_chars.delete_at(j)\n end\n end\n end\n end\n\n str1_chars.empty? && str2_chars.empty?\nend", "title": "" }, { "docid": "5c958af77b2e835223fd878dc0557e9e", "score": "0.86390036", "text": "def second_anagram?(str1, str2)\n i = 0\n\n len = str1.length\n\n i = 0\n while i < len\n letter = str1[0]\n str1.delete!(letter)\n str2.delete!(letter)\n i += 1\n end\n p str1\n p str2\n\n str1.empty? && str2.empty?\nend", "title": "" }, { "docid": "4ef19817241586b476526a94c14e3b6d", "score": "0.86331975", "text": "def second_anagram?(str1, str2)\r\n return true if str1.length == 0 && str2.length == 0\r\n arr1 = str1.split(\"\")\r\n arr2 = str2.split(\"\")\r\n char = arr1.shift \r\n return false unless arr2.include?(char)\r\n i = arr2.find_index(char)\r\n arr2.delete_at(i)\r\n second_anagram?(arr1.join(\"\"), arr2.join(\"\"))\r\n\r\nend", "title": "" }, { "docid": "1791b6c0232f05adfebe0a86935721e1", "score": "0.8623378", "text": "def second_anagram?(str1, str2)\n return false if str1.length != str2.length\n chars2 = str2.chars\n str1.each_char do |letter|\n idx = chars2.index(letter) \n return false if !idx\n chars2.delete_at(idx) \n end\n if chars2.length == 0\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "0227616e33bee38e7bab858e570d8cb4", "score": "0.8622265", "text": "def second_anagram?(str_1, str_2) #Time Complexity: O(n^2)\n target = str_2.split(\"\")\n str_1.each_char.with_index do |char, i|\n idx = target.find_index(char)\n target.delete_at(idx) if idx\n end\n target.empty? \nend", "title": "" }, { "docid": "f4fc4e85b323019e521a69105181fb2b", "score": "0.8620638", "text": "def second_anagram(str1, str2)\n str1.chars.each do |char1|\n str2.chars.each do |char2|\n if char1 == char2\n str1.sub!(char1, \"\")\n str2.sub!(char1, \"\")\n end\n end\n end\n str1.empty? && str2.empty?\nend", "title": "" }, { "docid": "c8c1a0fc00428a7461f2498c75a4eff2", "score": "0.86154544", "text": "def second_anagram?(str_1, str_2) # O(n^2)\n str_1.each_char do |char| # n\n str_2.delete! char if str_2.include?(char) # n\n # if str_2.include?(char)\n # idx = str_2.index(char)\n # str_2.delete_at(idx)\n # end\n # p str_2\n end\n str_2.empty?\n\nend", "title": "" }, { "docid": "cb500e7f5ad8014cb8d1a6900c88a992", "score": "0.86030805", "text": "def second_anagram?(str1, str2)\n str2Arr = str2.split('')\n str1.each_char do |char|\n idx = str2Arr.find_index(char)\n str2Arr.delete_at(idx) unless idx.nil?\n end\n str2Arr.empty?\nend", "title": "" }, { "docid": "7ca592acd59762abffa1acf451b98569", "score": "0.86004686", "text": "def second_anagram?(string_1, string_2)\n string_1.each_char do |char| \n if !string_2.include?(char)\n return false \n else\n idx = string_2.index(char)\n string_2.delete!(string_2[idx])\n end \n end\n string_2.chars.empty?\nend", "title": "" }, { "docid": "0cdb9fda9048883435ad7ff050ce9132", "score": "0.85986316", "text": "def second_anagram?(str1, str2)\n # debugger\n arr = str2.split(\"\") #\n str1.each_char do |char|\n if arr.include?(char)\n i = arr.index(char) \n arr.delete_at(i)\n end\n end\n arr.join(\"\") == \"\"\nend", "title": "" }, { "docid": "09b5a926f7df4b488f3811b6787437d5", "score": "0.8596449", "text": "def second_anagram?(str_1, str_2)\n new_str = str_2.split(\"\")\n str_1.each_char.with_index do |char, i|\n index = new_str.find_index(char)\n new_str.delete_at(index) if index\n end\n\n new_str.empty?\nend", "title": "" }, { "docid": "0a3893c1618a0ff28dc83fd1f6aa9f31", "score": "0.85956544", "text": "def second_anagram?(str1, str2)\n str2 = str2.split('')\n \n str1.each_char do |char|\n idx = str2.find_index(char)\n str2.delete_at(idx)\n end\n \n str2.empty?\nend", "title": "" }, { "docid": "1cb7235b5a1c0c29cf4a0303e6f87644", "score": "0.8590369", "text": "def second_anagram?(first_word, second_word) #O(n^2)\n letters_word_one, letters_word_two = first_word.split(\"\"), second_word.split(\"\")\n letters_word_one.each_with_index do |letter, idx|\n letter_pos = letters_word_two.find_index(letter)\n return false if letter_pos.nil?\n letters_word_two.delete_at(letter_pos)\n end\n return true if letters_word_two.empty?\n false\nend", "title": "" }, { "docid": "279578e3e12fcd7982d1b4551bd1a522", "score": "0.858721", "text": "def second_anagram?(str1, str2)\n str_to_arr = str2.chars\n \n str1.each_char.with_index do |char, i|\n idx = str_to_arr.find_index(char)\n unless idx.nil?\n str_to_arr = str_to_arr - [str_to_arr.delete_at(idx)]\n end\n end\n \n str_to_arr.empty?\nend", "title": "" }, { "docid": "1d0dc645c8de9ec364645803c7fec1a9", "score": "0.8583969", "text": "def second_anagram?(str1, str2)\n word2 = str2.split(\"\")\n\n str1.each_char do |char|\n idx = word2.find_index(char)\n\n word2.delete_at(idx) if !idx.nil?\n end\n\n word2.empty? \nend", "title": "" }, { "docid": "c8b63bddb37e5603187fba97eb2a367e", "score": "0.8582543", "text": "def second_anagram?(str1, str2)\n return false if str1.length != str2.length\n\n (0...str1.length).each do |i|\n index = str2.split(\"\").find_index(str1[i])\n return false if index.nil? \n str2.split(\"\").delete_at(index)\n end\n\n true\nend", "title": "" }, { "docid": "691ea04285ac8fc53d2156542993ef64", "score": "0.8582396", "text": "def second_anagram?(str_1,str_2)\r\n\r\n str_2_arr = str_2.split(\"\")\r\n\r\n str_1.split(\"\").each_with_index do |char,idx|\r\n if str_2_arr.index(char) != nil\r\n str_2_arr.delete_at(str_2_arr.index(char))\r\n end\r\n end\r\n\r\n str_2_arr.empty?\r\nend", "title": "" }, { "docid": "9205c16b591a5376f2d798023eb7557c", "score": "0.85723245", "text": "def second_anagram?(str1,str2)\n letters_1 = str1.split(\"\")\n letters_2 = str2.split(\"\")\n\n letters_1.each_with_index do |ele, idx|\n indices = letters_2.find_index(ele)\n # p indices\n if indices != nil\n letters_2.delete_at(indices)\n else\n return false\n end\n end\n letters_2.empty?\nend", "title": "" }, { "docid": "6bdea0302d48b25c2086c3caf85ca0e3", "score": "0.85714704", "text": "def second_anagram(string_one, string_two)\n string_one_dup = string_one.dup\n string_two_dup = string_two.dup\n string_one.each_char do |char1|\n string_two.each_char do |char2|\n if char1 == char2\n string_one_dup.sub!(char1, \"\")\n string_two_dup.sub!(char2, \"\")\n end\n end\n end\n string_one_dup.empty? && string_two_dup.empty?\nend", "title": "" }, { "docid": "45ac4be5c719fe71b69a0235a80f553f", "score": "0.85652906", "text": "def second_anagram?(str1, str2)\n str1.each_char do |s|\n if str2.chars.include?(s)\n str1 = str1.sub(s, '')\n str2 = str2.sub(s, '')\n end\n end\n\n str1.empty? && str2.empty?\nend", "title": "" }, { "docid": "21166527d02c8e21b5bfd4e4767ae672", "score": "0.8564352", "text": "def second_anagram?(str1, str2) \n arr = str1.split(\"\")\n arr2 = str2.split(\"\")\n indices = []\n arr.each do |letter| \n if arr2.include?(letter)\n index = arr2.index(letter)\n indices << index\n arr2.delete_at(index)\n end\n end\n arr2.empty? && indices.length == arr.length\nend", "title": "" }, { "docid": "97a58900a1da2d2c6411a92f07d316ed", "score": "0.85632575", "text": "def second_anagram?(str1, str2)\n arr1 = str1.split('')\n arr2 = str2.split('')\n\n arr1.each do |letter|\n target_idx = arr2.find_index(letter)\n return false unless target_idx\n arr2.delete_at(target_idx)\n end\n\n arr2.empty?\nend", "title": "" }, { "docid": "a4b3c0b7b6b30fc1e64e3f58dd3372d3", "score": "0.8562828", "text": "def second_anagram?(str_1, str_2)\n str_1.each_char do |ele|\n idx_2 = str_2.index(ele)\n if idx_2 != nil\n str_2[ele] = \"\"\n end\n end\n str_2.empty?\nend", "title": "" }, { "docid": "f59bc4b8ef4d365bfea0c127f5f436cb", "score": "0.85610497", "text": "def second_anagram?(string1, string2)\n\n return false unless string2.length == string1.length\n\n string2 = string2.chars\n\n string1.each_char.with_index do |c1, i1| # => n\n return false unless string2.include?(c1) # => n\n string2.delete_at(string2.index(c1))\n end\n\n string2.empty?\nend", "title": "" }, { "docid": "91cc27af3ac35149d165360d37499e8d", "score": "0.85555583", "text": "def anagram_2(str1, str2)\n return false if str1.length != str2.length\n str1_arr = str1.chars\n str2_arr = str2.chars\n str1.length.times do |i|\n char = str1[i]\n str1_arr.delete(char)\n str2_arr.delete(char)\n end\n str1_arr.empty? && str2_arr.empty?\nend", "title": "" }, { "docid": "5f9009c40aa99b15e7fbc06bb410fa5d", "score": "0.85547256", "text": "def second_anagram?(str1, str2)\n # debugger\n # return false if str1.length != str2.length\n str1.chars.each do |char| # O(n)\n str2.delete!(char) unless str2.index(char).nil? # O(n)\n end\n str2.length == 0\nend", "title": "" }, { "docid": "5e4f7ef7583315d2a574f635c9627996", "score": "0.85534763", "text": "def anagrams_2(string1, string2)\n string1_chars = string1.chars\n string2_chars = string2.chars\n string1_chars.each do |char|\n # debugger\n char_index = string2_chars.index(char)\n unless char_index.nil?\n string2_chars.delete_at(char_index)\n end\n end\n string2_chars.length.zero? ? true : false\nend", "title": "" }, { "docid": "02a6962b2709fd36a8f12c4133c5549f", "score": "0.8552771", "text": "def second_anagram?(str1, str2)\n chars1 = str1.split('')\n chars2 = str2.split('')\n\n chars1.each_with_index do |ele1, i1|\n if chars2.include?(ele1)\n chars2.delete_at(chars2.index(ele1))\n end\n end\n\n if chars2.empty?\n return true \n else\n return false\n end\nend", "title": "" }, { "docid": "6c121f8ddc9bb3651dcc2596a3900093", "score": "0.8552496", "text": "def second_anagram?(str1, str2)\n arr1 = str1.chars\n arr2 = str2.chars\n \n arr1.each do |ch| \n ch_idx = arr2.index(ch)\n return false if arr2.empty?\n arr2.delete_at(ch_idx) if ch_idx\n end\n \n arr2.empty?\n \n \nend", "title": "" }, { "docid": "ed68e44df1c1fa4fa90ef20f2db2674f", "score": "0.85515916", "text": "def second_anagram(string1, string2)\n return false if string1.length != string2.length\n\n (0...string1.length).each do |i|\n if string2.include?(string1[i])\n string2.delete!(string1[i])\n end\n end\n p string1\n p string2\n\n return true if string2.length == 0\n false\nend", "title": "" }, { "docid": "ea92a10c968b2c9da0909ec98b0914e4", "score": "0.85476875", "text": "def second_anagram?(str1, str2)\n str2_arr = str2.split('')\n str1.split('').each do |char|\n return false unless str2_arr.index(char)\n str2_arr.delete_at(str2_arr.index(char))\n end\n str2_arr.length == 0\nend", "title": "" }, { "docid": "6187274917d13c10c45cdf5b4f9dd6f9", "score": "0.8547014", "text": "def second_anagram?(string_1, string_2)\n arr = string_2.split(\"\")\n string_1.each_char do |char|\n i = arr.find_index(char)\n arr.delete_at(i) if i != nil\n end\n arr == []\nend", "title": "" }, { "docid": "9d3959576d01563cbfed3ee5b3a7bf79", "score": "0.8546837", "text": "def anagram2?(str1, str2)\n chars1 = str1.chars\n chars2 = str2.chars\n\n chars1.each do |ch|\n if chars2.find_index(ch)\n chars2.delete_at(chars2.find_index(ch))\n end \n end \n chars2.length == 0\nend", "title": "" }, { "docid": "296e8d08ee2ff3ddb67c5ee48433fc06", "score": "0.8543723", "text": "def second_anagram(first, second) # time O(n^2) | # space complexity O(n)\r\n second_array = second.split(\"\")\r\n\r\n first.each_char.with_index do |char, i|\r\n index = second_array.index(char)\r\n return false if index.nil?\r\n second_array.delete_at(index)\r\n end\r\n second_array.empty?\r\nend", "title": "" }, { "docid": "cd9dc3cedce0c668e3b6e1d10e01ea1d", "score": "0.8537048", "text": "def second_anagram?(str1, str2) # O(n^2)\n word1, word2 = str1.split(\"\"), str2.split(\"\")\n str1.each_char.with_index do |char1, idx1|\n str2.each_char.with_index do |char2, idx2|\n if char1 == char2\n word1[idx1] = nil\n word2[idx2] = nil\n end\n end\n end\n word1.compact.empty? && word2.compact.empty?\nend", "title": "" }, { "docid": "26ebfd35bb5ae760dd7d0855ffcf9384", "score": "0.8533743", "text": "def second_anagram?(string1, string2)\n str1 = string1.dup\n str2 = string2.dup\n\n string1.chars.each do |char1|\n if string2.include?(char1)\n str1.delete!(char1)\n str2.delete!(char1)\n end\n end\n\n str1.empty? && str2.empty?\nend", "title": "" }, { "docid": "ab8e8c1dcdbb208b7bbfd2d91626b72e", "score": "0.85325855", "text": "def second_anagram?(str1,str2) #n\n words = str1.split(\"\")\n word2 = str2.split(\"\")\n words.each_with_index do |char,i|\n new_idx = word2.find_index(char)\n if new_idx != nil \n word2.delete(word2[new_idx])\n end\n end\n word2.empty?\nend", "title": "" }, { "docid": "521a5a09db3805729fdb81f5be21c732", "score": "0.85307825", "text": "def second_anagram?(word1, word2)\n word1_arr = word1.split(\"\") #w1 m \n word2_arr = word2.split(\"\") #w2 n\n\n word1_arr.each do |char| #w1 m\n idx_char = word2_arr.find_index(char) #n\n if !idx_char.nil? # 1\n word2_arr.delete_at(idx_char) #w2 1\n end\n end\n word2_arr.length == 0\n\n # m + n + mn\n # O(mn)\n\nend", "title": "" }, { "docid": "5687f0cd32189d8ae5498a2dd447531d", "score": "0.8530325", "text": "def second_anagram?(str1, str2)\n arr_str1, arr_str2 = str1.split(\"\"), str2.split(\"\")\n\n arr_str1.each do |char|\n target_idx = arr_str2.find_index(char)\n return false unless target_idx\n arr_str2.delete_at(target_idx)\n end\n\n arr_str2.length == 0\nend", "title": "" }, { "docid": "ef4f4cf3869a896c2201e7b89b15b36c", "score": "0.85283077", "text": "def second_anagram?(str1, str2)\n str2 = str2.split(\"\")\n\n str1.chars.each do |letter|\n idx = str2.find_index(letter)\n case idx.nil?\n when true\n return false\n when false\n str2.delete_at(idx)\n end\n end\n\n return false unless str2.empty?\n return true\nend", "title": "" }, { "docid": "0655136be4ce44e0694823f52259aee9", "score": "0.8527966", "text": "def second_anagram?(word_1, word_2)\n # debugger\n raise ArgumentError unless word_1.is_a?(String) && word_2.is_a?(String)\n return false unless word_1.length == word_2.length\n\n word_2_chars = word_2.chars\n word_1.each_char do |word_1_char|\n index = word_2_chars.find_index(word_1_char)\n word_2_chars.delete_at(index) unless index.nil?\n end\n\n word_2_chars.empty?\n end", "title": "" }, { "docid": "8c48d58c9b3f7c0468a5ef5dcb08ded2", "score": "0.8527794", "text": "def second_anagram?(word1, word2)\n word1.each_char do |char1|\n word2.each_char do |char2|\n if char1 == char2\n word1.sub!(char1, \"\")\n word2.sub!(char2, \"\")\n end\n end\n end\n\n word1 == \"\" && word2 == \"\"\nend", "title": "" }, { "docid": "d89718af54419b01f8f3407cc1e4168b", "score": "0.8527564", "text": "def second_anagram?(word_1, word_2)\n word_2_arr = word_2.split(\"\")\n word_1.each_char do |char|\n target = word_2_arr.find_index(char)\n word_2_arr.delete_at(target)\n end\n\n word_2_arr.empty?\nend", "title": "" }, { "docid": "a123c4ea19aff02a7425052159cef495", "score": "0.8521404", "text": "def second_anagram?(str_1, str_2)\n str_1.each_char do |char|\n return false if !str_1.include?(str_2[0])\n str_2.chars.delete_at(str_2.index(char))\n end\n true\nend", "title": "" }, { "docid": "ef6a67d391a50a0b7ff9b5454a177f6b", "score": "0.8518847", "text": "def second_anagram?(str, str2)\n str1_copy = str.dup\n str2_copy = str2.dup\n\n str.chars.each do |char|\n str2_copy.sub!(char,\"\")\n end\n\n str2.chars.each do |char|\n str1_copy.sub!(char,\"\")\n end\n\n str2_copy == \"\" && str1_copy == \"\"\nend", "title": "" }, { "docid": "a54feb500648fc428a12f0cdbd45f8f5", "score": "0.8518177", "text": "def second_anagram?(str1, str2)\n str1.length.times do |i|\n idx = str2.index(str1[i])\n if idx \n str2[idx] = \"\"\n end\n end\n str2.empty?\nend", "title": "" }, { "docid": "d484703ac043c7d93419d99a92a8242e", "score": "0.85180527", "text": "def second_anagram?(string1, string2)\n string1.chars.each do |el|\n string2.chars.each do |el2|\n if el == el2\n string1.\n string2[idx2] = \"\"\n end\n end\n end\n return true if string1.empty? && string2.empty?\n false\nend", "title": "" }, { "docid": "1aa3635b2b786a31b3a169a8aa269ac4", "score": "0.8517742", "text": "def second_anagram?(str1, str2)\n letters1 = str1.chars\n letters2 = str2.chars\n\n until letters2.empty? || letters1.empty?\n if letters1.include?(letters2.first)\n letter_idx2 = letters1.index(letters2.first)\n letters1.delete_at(letter_idx2)\n letters2.shift\n else\n return false\n end\n end\n\n letters2.empty? && letters1.empty?\nend", "title": "" }, { "docid": "f1a295423162dbe7c1593f354531b220", "score": "0.8516425", "text": "def second_anagram?(str1, str2) # O(n^3) | O(n^3)\n arr1 = str1.split(\"\")\n arr2 = str2.split(\"\")\n arr1.each do |char1|\n arr2.each_with_index do |char2, i|\n if char1 == char2\n arr2.delete_at(i) \n break\n end\n end\n end\n arr2.empty?\nend", "title": "" }, { "docid": "e0a11a432d5eae2e9d3bdb93cef1b512", "score": "0.85097426", "text": "def second_anagram?(str1, str2)\n str1.chars do |char|\n # debugger\n idx = str2.index(char)\n return false if idx.nil? \n str2.delete!(str2[idx]) \n end \n \n str2.empty?\nend", "title": "" }, { "docid": "2e71a7bb7e2a29e0e056fbe1c4a5cb6c", "score": "0.8508598", "text": "def second_anagram?(string1, string2) # O(n^2); O(N * M) if no line 18\n\n return false if string1.length != string2.length\n\n array2 = string2.split(\"\")\n\n string1.each_char do |char| # N\n index = array2.index(char) # N\n array2.delete_at(index) if !index.nil? # N \n end\n\n array2.empty?\n\nend", "title": "" }, { "docid": "b669d9a2a61872e2874df165e923c304", "score": "0.85082334", "text": "def second_anagram?(str1, str2)\n return false if str1.length != str2.length\n\n str2_arr = str2.chars # O(n)\n str1.each_char do |chr| #O(n)\n idx = str2_arr.find_index(chr) # O(n)\n return false if idx.nil?\n str2_arr.delete_at(idx)\n end\n str2_arr.empty?\nend", "title": "" }, { "docid": "b5ae54886228d5e3f7bc459b1aa6e50d", "score": "0.85068625", "text": "def second_anagram?(str_1, str_2) #O(n^2) : quadratic\n return false if str_1.length != str_2.length \n arr_2 = str_2.split(\"\")\n str_1.each_char do |char|\n idx2 = arr_2.find_index(char) #another iteration, searching through arr, n \n unless idx2.nil?\n arr_2.delete_at(idx2) #another iteration, * 2\n end \n end\n arr_2.length == 0 \nend", "title": "" }, { "docid": "d98c239fb2a1315d10e1b63a25b911a3", "score": "0.85063934", "text": "def second_anagram?(word1, word2)\n word1_letters = word1.split(\"\")\n word2_letters = word2.split(\"\")\n\n check_letters = word1_letters.dup\n\n check_letters.each do |letter|\n return false if !word2_letters.include?(letter)\n word1_letter_index = word1_letters.find_index(letter)\n word2_letter_index = word2_letters.find_index(letter)\n word1_letters.delete_at(word1_letter_index)\n word2_letters.delete_at(word2_letter_index)\n end\n\n word1_letters.empty? && word2_letters.empty?\nend", "title": "" }, { "docid": "b8767efc287394181fa3b549dff0cade", "score": "0.85063136", "text": "def second_anagram?(first_string, second_string)\n first_string.each_char do |ch|\n i = second_string.index(ch)\n second_string = second_string[0...i] + second_string[i + 1..-1] unless i.nil?\n end\n second_string == \"\"\nend", "title": "" }, { "docid": "2856a8ee5b232b3f19ef74cea9085004", "score": "0.8504145", "text": "def second_anagram?(first, second)\n second_arr = second.split('')\n\n first.split('').each do |char|\n index = second_arr.find_index(char)\n\n return false unless index\n\n second_arr.delete_at(index)\n end\n\n second_arr.empty?\nend", "title": "" }, { "docid": "d6ee3d9c5f7f53ea77614caf280a21fd", "score": "0.84991235", "text": "def second_anagram?(str1, str2)\r\n arr1 = str1.split(\"\")\r\n arr2 = str2.split(\"\")\r\n arr1.each do |char|\r\n i = arr2.find_index(char)\r\n return false if i == nil\r\n arr2.delete_at(i)\r\n end\r\n arr2.empty?\r\nend", "title": "" }, { "docid": "36c1b42af6133e551b9a8ded1fb0d608", "score": "0.84974974", "text": "def anagram?(str_1, str_2)\r\n str1 = str_1.split(\"\") #n\r\n str2 = str_2.split(\"\") #n\r\n\r\n str1.each do |ele| #n\r\n index = str2.find_index(ele) #n\r\n if !index.nil?\r\n str2.delete_at(index) #n\r\n end\r\n end\r\n\r\n str2.empty?\r\nend", "title": "" }, { "docid": "fc308de651da01608485ddbcdd82cc1b", "score": "0.8497328", "text": "def second_anagram?(string1, string2)\r\n string1.each_char.with_index do |char, idx|\r\n idx1 = string2.chars.find_index(char)\r\n return false if idx1 == nil\r\n string2_split = string2.chars\r\n string2_split.delete_at(idx1)\r\n string2 = string2_split.join()\r\n end\r\n string2.empty? ? true : false\r\nend", "title": "" }, { "docid": "26b4b41c3da6d1b50ce0c4e1f45b9ae3", "score": "0.84969234", "text": "def second_anagram?(str1, str2)\n str_2_spl = str2.split(\"\")\n str1.each_char do |char| \n i = str_2_spl.find_index(char)\n return false if i.nil?\n str_2_spl.delete_at(i)\n end\n str_2_spl.empty?\nend", "title": "" }, { "docid": "0940b3ce79cddd8967d973365cbe76f2", "score": "0.84947413", "text": "def second_anagram?(string1, string2)\n letters_in_one = string1.chars\n letters_in_two = string2.chars\n string1.chars.each_with_index do |letter, i|\n if letters_in_two.include?(letter)\n first_idx = letters_in_one.find_index(letter)\n second_idx = letters_in_two.find_index(letter)\n letters_in_two.delete_at(second_idx)\n letters_in_one.delete_at(first_idx)\n end\n end\n return true if letters_in_one.empty? && letters_in_two.empty?\n false\nend", "title": "" }, { "docid": "a0c0cc2d401cf29f256273efb193cca6", "score": "0.8491652", "text": "def second_anagram(s1, s2)\n s1 = s1.chars\n s2 = s2.chars\n until s1.empty?\n letter_idx = s2.index(s1[0])\n return false if letter_idx.nil?\n s1.shift\n s2.delete_at(letter_idx)\n end\n s1 == s2\nend", "title": "" }, { "docid": "a9459dc5c9cfc8bf64c7a32a03f21942", "score": "0.84915596", "text": "def second_anagram?(str_1, str_2)\n arr_1 = str_1.split(\"\")\n arr_2 = str_2.split(\"\")\n\n arr_1.each do |ele|\n idx = arr_2.find_index(ele)\n return false if idx.nil?\n arr_2.delete(arr_2[idx])\n end\n\n arr_2.empty?\nend", "title": "" }, { "docid": "59b14dda889c8193e40994050be96cf3", "score": "0.8477149", "text": "def second_anagram?(string1, string2)\n s1_letters = string1.chars\n s2_letters = string2.chars\n idx2 = 0\n until s1_letters.empty?\n while idx2 < s2_letters.length\n if s1_letters[0] == s2_letters[idx2]\n s2_letters.delete_at(idx2)\n end\n idx2 += 1\n end\n idx2 = 0\n s1_letters.delete_at(0)\n end\n\n return true if s1_letters.empty? && s2_letters.empty?\n false\nend", "title": "" }, { "docid": "89e555c655cd35f1375457209e27a975", "score": "0.8475773", "text": "def second_anagram?(str1,str2)\n str2 = str2.split(\"\")\n str1.each_char do |char|\n i2 = str2.find_index(char)\n str2.delete(i2)\n end\n return true if str2.empty?\n false\n\nend", "title": "" }, { "docid": "6f8acbf6ce764b36dcc6e20770777a60", "score": "0.8473913", "text": "def second_anagram?(str1, str2)\n arr1 = str1.split('')\n arr2 = str2.split('')\n\n if str1.length != str2.length\n return false\n end\n\n (0...arr1.length).each do |idx|\n letter = arr1[idx]\n target = arr2.find_index(letter)\n arr2.delete(arr2[target])\n end\n\n return true if arr2.empty?\nend", "title": "" }, { "docid": "62bd17f119d4abc799449dd12529bd72", "score": "0.8473505", "text": "def second_anagram?(str1, str2)\n\tstr_arr = str2.split(\"\")\n\tstr1.each_char do |char| \n\t\ti1 = str_arr.find_index(char)\n\t\treturn false unless i1\n\t\tstr_arr.delete_at(i1) \n\tend\n\tstr_arr.empty?\nend", "title": "" }, { "docid": "4d92370f8308c3332fbadf45e0af0f56", "score": "0.8472745", "text": "def second_anagram?(str1, str2)\n return false if str1.length != str2.length\n\n str2 = str2.split(\"\")\n str1.each_char do |char|\n str2.delete(char) if str2.include?(char)\n end\n\n str2.empty?\nend", "title": "" }, { "docid": "322cdea512058b8449c11da80acce4bb", "score": "0.84686303", "text": "def second_anagram?(str1, str2)\n str1.each_char do |char|\n i2 = str2.index(char)\n str2.split('').delete_at(i2) unless i2.nil?\n end\n str2.empty? ? true : false\nend", "title": "" }, { "docid": "347c04a7196f3c169d0af8d8f06c8acf", "score": "0.84675324", "text": "def anagram2?(str1,str2)\narr = str2.chars\n str1.each_char do |char|\n ifarr.include?(char)\n i =arr.index(char)\n arr.delete_at(i)\n end\n end", "title": "" }, { "docid": "7165174e6e82b390de95b98a0ba3b277", "score": "0.84674925", "text": "def second_anagram?(first_word,second_word)\n return false unless first_word.length == second_word.length\n first_word.each_char do |letter|\n if second_word.include?(letter)\n index = second_word.index(letter)\n second_word[index] = \"\"\n end\n end\n second_word.empty?\nend", "title": "" }, { "docid": "8a7af742c435347910f1506da5a1f2a0", "score": "0.84673035", "text": "def second_anagram?(string1, string2) #IO(n^2)\n string2 = string2.chars #O(n)\n\n string1.each_char do |char| #O(n)\n index = string2.find_index(char) #O(n)\n unless index.nil? #O(1)\n string2.delete_at(index) #O(1)\n else\n return false #O(1)\n end\n end\n\n string2.empty? #O(1)\nend", "title": "" }, { "docid": "46d3c026fabe7ab32488daef81c2c27b", "score": "0.84633064", "text": "def second_anagram?(str1, str2)\n return false if str1.length != str2.length #0(1)\n (0...str1.length).each do |i| #0(n)\n if str2.include?(str1[i]) #0(n)\n str2.delete!(str1[i]) #0(n)\n end\n end\n if str2.length == 0 #0(1)\n return true #0(1)\n else\n false #0(1)\n end\nend", "title": "" }, { "docid": "048dbb59b44c6d4156383c3e47deee2e", "score": "0.84609956", "text": "def second_anagram?(str1, str2)\n string1_letters = str1.split(\"\")\n string2_letters = str2.split(\"\")\n idx1 = 0\n idx2 = 0\n\n until idx1 == string1_letters.length\n while idx2 < string2_letters.length\n if string1_letters[idx1] == string2_letters[idx2]\n string1_letters.delete_at(idx1)\n string2_letters.delete_at(idx2)\n idx1 -= 1\n else\n idx2 += 1\n end\n end\n idx1 += 1\n idx2 = 0\n end\n\n return true if string1_letters.length == 0 && string2_letters.length == 0\n false\nend", "title": "" }, { "docid": "bc342c2891deb155f52594d3afdbdf44", "score": "0.8460649", "text": "def second_anagram?(str1,str2)\n\n str1.each_char do |char|\n idx = str2.index(char)\n str2[idx] = '' unless idx.nil?\n end\n\n str2.empty?\n\nend", "title": "" }, { "docid": "1e0cc85899adc4f422a4d215ccd85d35", "score": "0.8460415", "text": "def second_anagram?(str1, str2) #O(n^2) better than first\n split2 = str2.split(\"\")\n\n str1.each_char do |char|\n if split2.index(char) != nil\n split2.delete_at(split2.index(char))\n end\n end\n\n split2.empty?\nend", "title": "" }, { "docid": "15fc768dac81205ecd7b8d823714ac3f", "score": "0.8459123", "text": "def second_anagram?(string1,string2) #n^2\n string1.each_char do |char|\n return false if !string2.include?(char)\n idx = string2.split(\"\").index(char)\n string2[idx] = \"\"\n end\n\n return true if string2.empty?\n false\nend", "title": "" }, { "docid": "2cffcb46939d3cafa84436845a30a690", "score": "0.845387", "text": "def second_anagram?(str1,str2)\n str2_arr = str2.split('')\n str1.each_char do |char|\n idx = str2.index(char)\n return false if idx.nil?\n str2_arr.delete_at(str2.index(char))\n end\n true\nend", "title": "" }, { "docid": "b88225fad92bd21ae42783f802cbd00c", "score": "0.8451627", "text": "def second_anagram?(word1, word2)\n letters1 = word1.split('')\n letters2 = word2.split('')\n l1_dup = letters1.dup\n l2_dup = letters2.dup\n\n delete_count = 0\n letters1.each_with_index do |letter, index|\n index2 = l2_dup.index(letter)\n if index2\n l1_dup.delete_at(index - delete_count)\n l2_dup.delete_at(index2)\n delete_count += 1\n end\n end\n\n l1_dup.empty? && l2_dup.empty?\nend", "title": "" }, { "docid": "27239a2a186c6068c1846e14b2d63b5c", "score": "0.8449049", "text": "def second_anagram?(str1, str2)\r\n arr = (0...str2.length).to_a\r\n str1.each_char do |char|\r\n if str2.index(char).nil? \r\n return false \r\n else\r\n arr.delete(str2.index(char))\r\n end\r\n end\r\n arr.empty?\r\nend", "title": "" }, { "docid": "3d2aeefdf6ff3a3addbb9cb503513042", "score": "0.84488773", "text": "def sec_anagram?(first, second)\n\n scd = second.split(\"\")\n\n first.each_char do |char|\n if second.include?(char)\n scd.delete_at(scd.find_index(char))\n end\n end\n\n return scd.empty?\n\nend", "title": "" }, { "docid": "37c87996a70c0e097875c83f4629f94d", "score": "0.844729", "text": "def second_anagram?(str1,str2)\n i = 0 \n while i < str1.length\n if str2.index(str1[i]) != nil \n idx= str2.index(str1[i])\n str2.delete!(str2[idx])\n end \n i+=1\n end\n str2.empty? ? true : false \nend", "title": "" }, { "docid": "80c61ef3a0ac99d7eee7b330b3a81330", "score": "0.84439206", "text": "def second_anagram?(str1, str2)\n arr1, arr2 = str1.split(\"\"), str2.split(\"\")\n arr1.each do |ele|\n j = arr2.index(ele)\n return false if j.nil?\n arr2.delete_at(j)\n end\n arr2.empty?\nend", "title": "" }, { "docid": "5fe5bb7d82810f041beba7b91ddc370f", "score": "0.8437713", "text": "def second_anagram?(str1, str2)\n str1.each_char do |char| #O(n)\n idx = str2.index(char) # O(n)\n return false if idx.nil?\n str2.delete!(char) #O(n)\n end\n return str2.empty?\nend", "title": "" }, { "docid": "bcd886f271b13822cd31b51131aa0f7b", "score": "0.8437702", "text": "def second_anagram?(str1, str2)\r\n arr = str2.split(\"\")\r\n str1.each_char.with_index do |char, i| # O(n)\r\n idx = arr.find_index(char) # O(n)\r\n arr.delete_at(idx) if !idx.nil? # O(1)\r\n end\r\n arr.empty?\r\nend", "title": "" }, { "docid": "3867ba75033b4b812c8738d529ff5ae3", "score": "0.8428687", "text": "def second_anagram?(str1,str2)\n return false unless str1 && str2\n str_array1 = str1.chars\n str_array2 = str2.chars\n str_array1dup = str_array1.dup\n str_array2dup = str_array2.dup\n str_array1.each_with_index do |char,idx|\n if str_array2dup.include?(char)\n str_count = str_array2dup.count(char)\n str_array2dup.delete(char)\n (1...count).times{|num| str_array2dup << char} if str_count > 1\n else\n return false\n end\n end\n str_array2.each_with_index do |char,idx|\n if str_array1dup.include?(char)\n str_count = str_array1dup.count(char)\n str_array1dup.delete(char)\n (1...count).times{|num| str_array1dup << char} if str_count > 1\n else\n return false\n end\n end\n true\nend", "title": "" }, { "docid": "e52c7b3055688cb81e71a4a037497ee2", "score": "0.8427846", "text": "def second_anagram?(first, second)\n first = first.split(\"\")\n second = second.split(\"\")\n first.each_with_index do |char, idx|\n if second.include?(char)\n delete_idx = second.index(char)\n second.delete_at(delete_idx)\n first.delete_at(idx)\n end\n end\n \n first == second\nend", "title": "" }, { "docid": "5a2ca5a57eee8c927f955a20061bbe8e", "score": "0.8424024", "text": "def second_anagram?(string1, string2)\n split_string1 = string1.split(\"\")\n split_string2 = string2.split(\"\")\n split_string1.each do |letter|\n string1 = string1.delete(letter) if split_string1.count(letter) == split_string2.count(letter)\n end\n\n return true if string1 == \"\"\n\n false\n\nend", "title": "" }, { "docid": "ce0433c531c99f6b49e7c0972cb30594", "score": "0.8420943", "text": "def second_anagram?(str1, str2)\r\n str1.each_char.with_index do |char, i|\r\n if str2.index(str1[i])\r\n str2[str2.index(str1[i])] = \"\"\r\n end\r\n end\r\n str2.empty?\r\nend", "title": "" }, { "docid": "ad9591457f6b3d50da88f2671de462bd", "score": "0.8420818", "text": "def second_anagram?(str1, str2)\n # iterate over str1\n\n str1.each_char.with_index do |char, i|\n # # for each char, find index of char in str2 using #find_index\n found_index = str2.index(char)\n # # delete str2[@ found index]\n return false if found_index == nil\n str2 = str2[0...found_index] + str2[found_index + 1..-1]\n end\n\n # if str2 is empty? then return true\n str2.empty? ? true : false\nend", "title": "" } ]
d4073b475d8c0f96981d1f99fdcb3b39
Read in keys from file and find the locations of the values
[ { "docid": "e764801336cc61dba43cfc5b0200d2cc", "score": "0.6410773", "text": "def search_from_file\r\n\t\tprint_search_header\r\n\t\tsearch_keys = File.readlines(\"SEARCH.txt\")\r\n\t\tsearch_keys.each do |key|\r\n\t\t\tresult = search(key.chomp)\r\n\t\t\tif result == -1\r\n\t\t\t\tprint_search(key.chomp, \"Record not found\" , \"\")\r\n\t\t\telse\r\n\t\t\t\tprint_search(key.chomp, result[:data] , result[:location])\r\n\t\t\tend\r\n\t\tend\r\n\tend", "title": "" } ]
[ { "docid": "49409aa31127ef44bbebf82915457c12", "score": "0.6888244", "text": "def read_keys\n keys = File.open(\"nod32keysfile.txt\", \"r\").read\n fkeys = keys.each_line { |line| }\nend", "title": "" }, { "docid": "e591bc65d46c6df6cc4e81a75ff8634b", "score": "0.6572232", "text": "def parse_file\n File.open(filename).each { |line| parse_word line.chomp }\n hash.select { |k, v| {k => v} if hash[k][1] }.map { |k, v| [k, v[0]] }.sort\n end", "title": "" }, { "docid": "0b5f1d30f483d4933a7c7c0c0efff242", "score": "0.6454491", "text": "def extract_keys(path)\n keys = []\n File.open(path, 'rb') do |f|\n while (line = f.gets)\n line.scan(search_config[:pattern]) do |match|\n key = parse_key(match)\n key = absolutize_key(key, path) if key.start_with? '.'\n if key =~ /^[\\w.\\#{}]+$/\n keys << key\n end\n end\n end\n end\n keys\n end", "title": "" }, { "docid": "45d9f2c04164eaf14c975296e542e335", "score": "0.6444676", "text": "def read_keys\n file_to_read = \"#{File.dirname(__FILE__)}/geo_srv_info\"\n \n if(!File.exists?(file_to_read))\n @@keys['google'] = [nil, 2500, (DateTime.now + 1).iso8601]\n @@keys['bing'] = ['AmBTPstLJhUmi10CXRQpPXneu5ToFdxidu0EWBYoxJIHFpqDN-QF9AaTkGPHkpR-', 50000, (DateTime.now + 1).iso8601]\n @@keys['nominatim'] = [nil, FIXNUM_MAX, DateTime.now.iso8601]\n @@keys['yandex'] = [nil, 25000, (DateTime.now + 1).iso8601]\n write_keys\n else\n File.open(file_to_read, 'r') do |file|\n @@keys = JSON.load(file)\n check_keys\n end\n end\n \n sort_keys\n GeocodeUtil.keys(@@keys)\n end", "title": "" }, { "docid": "7608f8ed7dc862f6dcfc1665cd00b07d", "score": "0.64362293", "text": "def read_keys_file(path)\n return [] unless File.exists?(path)\n File.readlines(path).map! { |l| l.chomp.strip }\n end", "title": "" }, { "docid": "7608f8ed7dc862f6dcfc1665cd00b07d", "score": "0.64362293", "text": "def read_keys_file(path)\n return [] unless File.exists?(path)\n File.readlines(path).map! { |l| l.chomp.strip }\n end", "title": "" }, { "docid": "afc7e10496d3de5e764554f0ce26ecd7", "score": "0.637286", "text": "def test_read_dictionary\n reader = FileReader.new('small_graph.txt')\n dict = reader.read_dictionary('testfiles/testlist.txt')\n assert_equal dict.keys, %w[a big collar]\n end", "title": "" }, { "docid": "53bc9819eb8349bdf4986cc67dcc9168", "score": "0.6298047", "text": "def extract_keys_from_files(localizable_files)\n keys_from_file = {}\n localizable_files.each do |file|\n lines = File.readlines(file)\n\n # Grab just the keys, we don't need the translation\n keys = lines.map { |e| e.split(\"=\").first }\n # Filter newlines and comments\n keys = keys.select do |e|\n e != \"\\n\" && !e.start_with?(\"/*\") && !e.start_with?(\"//\")\n end\n keys_from_file[file] = keys\n end\n keys_from_file\n end", "title": "" }, { "docid": "6d9a6fe2880545b459db17d5b13fa6e1", "score": "0.6270155", "text": "def get_keys(file_name)\n keys_json = File.open(file_name, \"r\").read\n parsed = JSON.parse(keys_json)\nend", "title": "" }, { "docid": "4479c4efcc30aaaecfbb32643271a95e", "score": "0.62625813", "text": "def deep_key_search(file)\n keys = []\n File.foreach(file) do |line|\n begin\n object = JSON.parse(line).with_indifferent_access\n keys |= object.deep_keys\n rescue JSON::ParserError\n next\n end\n end\n File.open(output_file, 'a') do |f|\n f << keys.sort.join(\"\\n\")\n end\n end", "title": "" }, { "docid": "9e688dbd95c92e53fa15c94c6f6bef97", "score": "0.62503886", "text": "def search_pass(keyboard)\n current_key = nil\n File.open('input.txt') do |f|\n f.each do |line|\n line.strip.split(\"\").each do |next_key|\n current_key ||= 5\n key = keyboard[current_key][next_key.to_sym]\n current_key = key unless key.nil?\n end\n p current_key\n end\n end\nend", "title": "" }, { "docid": "bd298023f509562c9dbdd8bee15b1375", "score": "0.623823", "text": "def readFileToHash(filePath)\n result = Hash.new\n f = File.open(filePath)\n while !f.eof do\n l = f.gets.chomp.strip.split(/---/)\n key = l[0].strip\n value = l[1].strip.to_i\n result[\"#{key}\"] = value\n end\n return result\nend", "title": "" }, { "docid": "ca044289a5ff4ea2e2481425b7a62c29", "score": "0.61954165", "text": "def keys\n GDBM.open(file_path, 0664, GDBM::READER) do |index|\n index.keys\n end\n end", "title": "" }, { "docid": "3f9a36c323002c59d452314f5cecc9c2", "score": "0.6110697", "text": "def get_keys( location )\n begin\n location = File.expand_path(location)\n keys = JSON.parse(File.read(location),{:symbolize_names => true})\n rescue\n return nil\n end\n\n return keys\nend", "title": "" }, { "docid": "c6db1061637374b974a376a4a7f5b9cb", "score": "0.60455155", "text": "def load(fp)\n count = 0\n fp.each_line do |line|\n count += 1\n unless /^\\[([0-9A-Za-z_\\-]+),\\s+(.+)\\]/ =~ line\n raise \"line has invalid format\"\n end\n key = $1\n val, = parseobj($2)\n if count == 63\n @mykey = key\n end\n add(key, val)\n unless @mykey.nil?\n get(@mykey)\n end\n end\n end", "title": "" }, { "docid": "08ee9df2c58edccdb562e31e10a7568e", "score": "0.6023116", "text": "def get_inputs(filename)\n inputs = []\n file = File.new(filename, 'r')\n while row=file.gets\n data = row.split(\"\\s\")\n @loc = Hash.new\n @loc[\"ID\"] = data[0].to_i\n @loc[\"Latitude\"] = data[1].to_i\n @loc[\"Longitude\"] = data[2].to_i\n inputs << @loc\n end\n return inputs\nend", "title": "" }, { "docid": "4f033e2a997921a234a94289368dbc5c", "score": "0.6005071", "text": "def read_map(filename)\n file_data = []\n\n File.open(filename, 'r') do |file|\n file.each_line do |line|\n index = 0\n line_hash = {}\n line_data = line.split(' ')\n line_data.length.times do\n line_hash[index] = line_data[index]\n index += 1\n end\n file_data << line_hash\n end\n end\n file_data\nend", "title": "" }, { "docid": "95372a41dc789405751efd3444d7b587", "score": "0.5996577", "text": "def read_dictionary(filename)\n dictionary = {}\n File.open(File.absolute_path(filename)).each { |line| dictionary[line.chomp(\"\\n\")] = \"e\" }\n dictionary\nend", "title": "" }, { "docid": "9eca9a9c7bcbccc029b526fcf2d96040", "score": "0.5933247", "text": "def loadDictionary(path)\n File.readlines(path).each do |line|\n loadValue(line.chomp!)\n end\n end", "title": "" }, { "docid": "5e00fad95b7fe09c478b7d8638fc1988", "score": "0.58793056", "text": "def get_mapping_list( filename )\n res = {}\n\n File.open( filename ).each do |line|\n tokens = line.split( \",\" )\n next if tokens.length < 2\n\n fname = tokens[ 0 ]\n id = tokens[ 1 ]\n if res.include?( id )\n res[ id ] << fname unless res[ id ].include? fname\n else\n res[ id ] = [ fname ]\n end\n end\n\n return res\n end", "title": "" }, { "docid": "fd199dd5219ea61a582c700ebc3e02e5", "score": "0.5826666", "text": "def read mapping\n lines = File.readlines(mapping)\n lines.map! do |line|\n row = line.strip.split\n [row[1].to_f,row[2].to_f,row[0].to_i]\n end\n @tree = KDTree.new(lines)\n end", "title": "" }, { "docid": "e68710de2bcc40e4a6ae949459799cbe", "score": "0.58213645", "text": "def read_keys_file\n return [] unless File.exists?(ROOT_TRUSTED_KEYS_FILE)\n File.readlines(ROOT_TRUSTED_KEYS_FILE).map! { |l| l.chomp.strip }\n end", "title": "" }, { "docid": "3e24a4e14c87e686d2c8efbcd41d8763", "score": "0.580014", "text": "def read_keys!(filename)\n raise NotFound, \"Could not find key file: #{filename}\" unless File.exist?(filename)\n\n raw_contents = File.read(filename)\n keylist = raw_contents.scan(/(-----BEGIN .*?RIVATE KEY-----.*?-----END .*?PRIVATE KEY-----)/m).flatten\n raise NotFound, \"Could not find any private keys in #{filename}\" if keylist.empty? \n\n keylist.collect do |key|\n OpenSSL::PKey::RSA.new(key)\n end\n end", "title": "" }, { "docid": "1543512f96a392f2216365e84ce5642d", "score": "0.578251", "text": "def find key=nil\n @start = dump.pos\n while (@line = @dump.gets)\n pos = dump.pos\n break unless @line\n @line.chomp!\n if @line.empty?\n\t@start = pos\n\tnext\n end\n if key\n\tunless @line.start_with? key\n\t @start = pos\n\t next\n\tend\n end\n @key,@value = @line.split \":\"\n if @value.nil?\n @start = pos\n\tnext\n end\n if key\n\tunless key == @key\n\t @start = pos\n\t next\n\tend\n\treturn @value.strip!\n end\n return @key, @value.strip!\n end\n nil\n end", "title": "" }, { "docid": "b523b2408e1c8c9a8ef44d24835cbb2f", "score": "0.5781825", "text": "def get_working_key_file_locations\n key_file_locations.reject {|f| f unless ::File.file?(f) }.first\n end", "title": "" }, { "docid": "18ff8b5a335fff034970e8b89a850ce8", "score": "0.5777894", "text": "def readConfig(config_file)\n configHash = Hash.new\n File.open(config_file) do |f|\n f.each do |line|\n position = line.split(\" \")\n configHash[position[0]]=position[1]\n end\n end\n return configHash\nend", "title": "" }, { "docid": "4e3696efb3a9a16ae9b2f9663e0fd62d", "score": "0.57701886", "text": "def load_keys(path)\n file_lines = read_keys_file(path)\n\n keys = []\n file_lines.map do |l|\n components = LoginPolicy.parse_public_key(l)\n\n if components\n #preserve algorithm, key and comments; discard options (the 0th element)\n keys << [ components[1], components[2], components[3] ]\n elsif l =~ COMMENT\n next\n else\n RightScale::Log.error(\"Malformed (or not SSH2) entry in authorized_keys file: #{l}\")\n next\n end\n end\n\n keys\n end", "title": "" }, { "docid": "4e3696efb3a9a16ae9b2f9663e0fd62d", "score": "0.57701886", "text": "def load_keys(path)\n file_lines = read_keys_file(path)\n\n keys = []\n file_lines.map do |l|\n components = LoginPolicy.parse_public_key(l)\n\n if components\n #preserve algorithm, key and comments; discard options (the 0th element)\n keys << [ components[1], components[2], components[3] ]\n elsif l =~ COMMENT\n next\n else\n RightScale::Log.error(\"Malformed (or not SSH2) entry in authorized_keys file: #{l}\")\n next\n end\n end\n\n keys\n end", "title": "" }, { "docid": "5ac286acf7d461fcba0a2f60db00a04f", "score": "0.5759977", "text": "def populate_positions\n @f.seek(8)\n while @f.pos < @used\n padded_len = @f.read(4).unpack('l')[0]\n key = @f.read(padded_len).unpack(\"A#{padded_len}\")[0].strip\n @positions[key] = @f.pos\n @f.seek(16, :CUR)\n end\n end", "title": "" }, { "docid": "cde33e94d0786db432a48f2343d2ed6e", "score": "0.57541025", "text": "def load_keys(file)\n yaml = YAML.load(File.read(file))\n return [] if yaml.values.compact.empty?\n flatten_keys(yaml[yaml.keys.first])\n end", "title": "" }, { "docid": "ea6e0770d3ccf5034b688abc8fb20e63", "score": "0.57438403", "text": "def entries; @entries_by_filename.values; end", "title": "" }, { "docid": "e0a40692e37989ba6e8821da5d45954a", "score": "0.5732885", "text": "def load_file(dir, file)\n\tk = {}\n\tFile.open(dir + file, \"r\") {|f|\n\t\twhile (line = f.gets)\n\t\t\tline.strip!\n\t\t\tnext if line =~ /^#/\n\t\t\tnext if line =~ /^$/\n\t\t\tif line =~ /^include *(.*)$/\n\t\t\t\t k.merge!(load_file(dir, $1))\n\t\t\telsif line =~ /^([^ ]*) 0x([^ ]*)(.*)$/\n\t\t\t\tname = $1\n\t\t\t\tscancode = $2\n\t\t\t\tmods = $3.split(\" \") & [\"shift\", \"altgr\", \"control\"]\n\t\t\t\tk[name] = [ scancode, mods ]\n\t\t\tend\n\t\tend\n\t}\n\tk\nend", "title": "" }, { "docid": "8cfb10e2bd6b1caa94d6d60d6606157d", "score": "0.57299846", "text": "def process_internals_hash\n open(file_name) do |f|\n f.each do |line|\n internal_searched, searched = line.split(\"\\t\")\n internal_search = internal_searched.to_textual\n sequence_text = internal_search.to_textual.de_comma unless nil\n sequence_creation = sequence_text.de_comma.de_space unless nil\n sequence_complete = sequence_creation.split(//).sort.join('').strip unless nil\n sequence_lexigram = lexigram_sequencer(sequence_text) unless nil\n sequence_singular = sequence_complete.squeeze unless nil\n sequence_lense = ''\n description = \"internal search\"\n reference = searched.to_s.strip\n anagram = 0\n name = 0\n phrase = 0\n research = 0\n external = 0\n internal = 1\n puts \"#{sequence_text}\\t#{sequence_creation}\\t#{sequence_complete}\\t#{sequence_lexigram}\\t#{sequence_singular}\\t#{sequence_lense}\\t#{description}\\t#{reference}\\t#{anagram}\\t#{name}\\t#{phrase}\\t#{research}\\t#{external}\\t#{internal}\\t#{Time.now}\\n\"\n end\n end\n end", "title": "" }, { "docid": "d67f3faa08930f974f1ead5c8d7bc749", "score": "0.5727432", "text": "def read_dict\n if !File.file?(@file)\n raise RuntimeError, \"Cannot find dict file: #{@file}\"\n end\n dict = []\n IO.readlines(@file).each do |line|\n line.strip!\n if line.length <= @chars && line =~ @allowed\n dict << line\n end\n end\n return dict\n end", "title": "" }, { "docid": "d0a36509b3425f96fd96479d96d136f1", "score": "0.57243395", "text": "def read_key\n File.read(key)\n end", "title": "" }, { "docid": "5f6da4a62dde6d12d14dc817977a892f", "score": "0.5704578", "text": "def load_dictionary\n dict = File.open(@options[:index] + '.dict')\n dictionary = {}\n loop do\n term = \"\"\n position = \"\"\n count = \"\"\n char = \"\"\n loop do\n char = dict.gets 1\n break if char.nil? or char == \":\"\n term << char\n end\n loop do\n char = dict.gets 1\n break if char.nil? or char == \":\"\n position << char\n end\n loop do\n char = dict.gets 1\n break if char.nil? or char == \";\"\n count << char\n end\n break if char.nil?\n dictionary[term] = {:position => position.to_i, :count => count.to_i}\n end\n dict.close\n return dictionary\n end", "title": "" }, { "docid": "b217013eda0e30bd7816b6801506e3b8", "score": "0.5702752", "text": "def get_locations file_path\n locations = []\n File.open(file_path).each do |line|\n locations.push(line.gsub(/\\n/, \"\"))\n end\n locations\n end", "title": "" }, { "docid": "2b305248737b44e8302de020b38cf547", "score": "0.5699178", "text": "def read_file()\n File.open(@filename).each do |row|\n row.chomp!\n row = row.split(\"\\t\")\n next unless row[2] == \"transcript\"\n if row[-1] =~ /reference_id \\\"(\\w*\\d*)\\\";/\n row[-1] =~ /reference_id \\\"(\\w*\\d*)\\\";/\n trans_id = $1\n else\n row[-1] =~ /transcript_id \\\"(\\w*\\d*)\\\";/\n trans_id = $1\n end\n row[-1] =~ /FPKM \\\"(\\d*\\.\\d*)\\\"/\n fpkm_v = $1\n @fpkm[trans_id] = fpkm_v.to_f\n row[-1] =~ /TPM \\\"(\\d*\\.\\d*)\\\"/\n tpm_v = $1\n @tpm[trans_id] = tpm_v.to_f\n end\n end", "title": "" }, { "docid": "4006cbce8f6f6d12b7879e662e42e4bb", "score": "0.56962913", "text": "def read_index(index_file)\n index_hash = Hash.new\n index_file = File.open(index_file, \"r\")\n lines = index_file.readlines\n index_file.close\n for line in lines\n line = line.split(/\\s+/)\n index_hash[line[0]] = line[1]\n end\n return index_hash\nend", "title": "" }, { "docid": "f47ccfe84193e35bc1041bf71d17e23d", "score": "0.569489", "text": "def get_map(file)\n file=File.new(file,'r')\n element_map = Hash.new\n line_count = 0\n while (line = file.gets)\n if line_count > 0 \n solr,nyu_core,dc = line.split(' ')\n element_map[solr] = [nyu_core,dc]\n end \n line_count = line_count + 1\n end\n return element_map \nend", "title": "" }, { "docid": "9558954c8c3fd87e593e7315932ecb8b", "score": "0.56809473", "text": "def read_file(path)\n # build a config file mapping we can manipulate\n ::Chef::Log.debug(\"Reading ssh config #{path}\")\n ::File.read(path).each_line.with_index do |conf_line, index|\n\n # this builds a hash of key => value pairs for every config var it finds\n #if conf_line.match(/^[^#]\\S+\\s/)\n if conf_line.match(/^\\S{2,}\\s/)\n conf_var, conf_val = conf_line.split(/\\s+/, 2)\n if conf_var.start_with?(\"#\")\n conf_var = conf_var[1..-1]\n end\n @conf_lookup[conf_var] ||= []\n @conf_lookup[conf_var] << index\n end\n\n conf_line.rstrip!\n @conf_lines << conf_line\n\n end\n\n end", "title": "" }, { "docid": "bf2d633d768f39f889a02357df54b628", "score": "0.5673286", "text": "def readIDSFile(filename, char_hash)\n File.open(filename) do |f|\n while (line = f.gets)\n next if line.match(/^;;/) # line commented out?\n a = line.strip.split(\"\\t\")\n char_hash[a[0]] = Hash.new() unless char_hash.has_key? a[0]\n char_hash[a[0]][:ids] = a[2].to_u\n end\n end\nend", "title": "" }, { "docid": "b25a88c21af4ec23b5a002c35e714012", "score": "0.56692", "text": "def read_file\n File.open('./Dictionary/words') do |f|\n f.each_line do |line|\n @words_hash[\"#{line[0]}\"] = [] if @words_hash[\"#{line[0]}\"].nil?\n @words_hash[\"#{line[0]}\"] << line.chomp # Remove new line character\n end\n end\n end", "title": "" }, { "docid": "6428d68ec7becf992f33d4dabd13d25e", "score": "0.566758", "text": "def get_access_keys(fname)\n return true if aws_access_key_id and aws_secret_access_key\n \n lines = IO.readlines(fname)\n @aws_access_key_id = lines.first.strip.split(\"=\")[1]\n @aws_secret_access_key = lines.last.strip.split(\"=\")[1]\n end", "title": "" }, { "docid": "1c26001f4450c30906af4225e2ae900b", "score": "0.5653318", "text": "def readfile(path)\n\t\tdictionary_entry = IO.readlines(path) if File::exists?(path)\n\t\treturn dictionary_entry.map {|x| x.delete \"\\n\"} #remove newline characters\n\tend", "title": "" }, { "docid": "e89df11c40521c0690bafcba43a7c10c", "score": "0.5635825", "text": "def known_keys\n dotgpg.each_child.map do |key_file|\n Dotgpg::Key.read key_file.open\n end\n end", "title": "" }, { "docid": "ab9b8bae190801dfc52263b047ac06f2", "score": "0.56327295", "text": "def load\n g = Hash.new(\".\")\n r = 0\n IO.foreach(\"22.in\") do |l|\n l.chomp.chars.each_with_index {|v,c| g[[r,c]] = v }\n r += 1\n end\n [g, r]\nend", "title": "" }, { "docid": "84cb054d6d9fabce6c463f1847c8348e", "score": "0.5618572", "text": "def handleFile(f)\n\tfile = File.open(f,'r')\n\trem = tokenize(file,[\" \"],SYMBOLS)\n\t\n\t# grab just the file name (not the full path) \n\tfl = f.split('/')[-1][0...-5]\n\n\t# return a hash with the parsed lines of the file & the file name\n\treturn {:lines => rem, :file => fl}\nend", "title": "" }, { "docid": "f7e7327c46ce0d24fd173cb2cca1b960", "score": "0.5610716", "text": "def read_file(path)\n\n if !::File.file?(path)\n raise ::Errno::ENOENT.new(\"#{path} does not exist\")\n end\n\n #::Chef::Log.debug(\"Reading redis file #{path}\")\n\n ::File.read(path).each_line.with_index do |conf_line, index|\n\n # this builds a hash of key => value pairs for every config var it finds\n if conf_line.match(/^[^#]\\S+\\s/)\n conf_var, conf_val = conf_line.split(/\\s+/, 2)\n @conf_lookup[conf_var] ||= []\n #if !conf_lookup.has_key?(conf_var)\n # conf_lookup[conf_var] = []\n #end\n @conf_lookup[conf_var] << index\n end\n\n conf_line.rstrip!\n @conf_lines << conf_line\n\n end\n\n end", "title": "" }, { "docid": "741ddb084878315c55bb336822ff0581", "score": "0.5609337", "text": "def parse_file \n @file.readlines.each_with_index do |line, index|\n if match = check_section(line)\n set_section(match)\n elsif match = check_key_value(line)\n set_key_value(match)\n elsif match = check_value_continuation(line)\n set_value_continuation(match)\n elsif not check_blank_line(line)\n raise_exception\n end\n end\n end", "title": "" }, { "docid": "6fa25101df4f6c8ad3b8d7d8f798fd9d", "score": "0.55482244", "text": "def read_keywords(name)\r\n keys = Hash.new { |h, k| h[k] = [] }\r\n i = 0 # i is code of emotion group such as 1: aggressive, 2: sad, 3: happiness\r\n File.open(name).each do |line|\r\n keys[i] = line.downcase!.split\r\n i += 1\r\n end\r\n keys\r\n end", "title": "" }, { "docid": "c6b9967eb14e021d55bc95eebc0a1b37", "score": "0.55415", "text": "def scan(fileName, beginpos, endpos, fileloc)\n file = File.new(fileName, \"r\")\n counter = 1\n while (line = file.gets)\n if line =~ /BEGIN_(\\w+)/\n throw \"Symbol '#{$1}' already defined\" if fileloc[$1]\n fileloc[$1] = fileName\n beginpos[$1] = counter+1\n puts \"BEGIN #{$1}: #{beginpos[$1]}\"\n end\n if line =~ /END_(\\w+)/\n endpos[$1] = counter-1\n puts \"END #{$1}: #{endpos[$1]}\"\n end\n counter = counter + 1\n end\n file.close\nend", "title": "" }, { "docid": "94ceac9fb5974ad77ffb683b26859c71", "score": "0.55395085", "text": "def get_key\n File.read(@filename).split(/\\s/).map{ |v| v.strip!; v.empty? ? nil : v }.compact\n end", "title": "" }, { "docid": "94ceac9fb5974ad77ffb683b26859c71", "score": "0.55395085", "text": "def get_key\n File.read(@filename).split(/\\s/).map{ |v| v.strip!; v.empty? ? nil : v }.compact\n end", "title": "" }, { "docid": "1eed76c41e063b5291437c386a28ade6", "score": "0.5520704", "text": "def all_values\n with_file_lock do\n @positions.map do |key, pos|\n @f.seek(pos)\n value, timestamp = @f.read(16).unpack('dd')\n [key, value, timestamp]\n end\n end\n end", "title": "" }, { "docid": "c6f019ce9672ed38f2814a7f768509a5", "score": "0.55202657", "text": "def process_externals_hash\n open(file_name) do |f|\n f.each do |line|\n external_searched, searched = line.split(\"\\t\")\n external_search = external_searched.to_textual\n sequence_text = external_search.to_textual.de_comma unless nil\n sequence_creation = sequence_text.de_comma.de_space unless nil\n sequence_complete = sequence_creation.split(//).sort.join('') unless nil\n sequence_lexigram = lexigram_sequencer(sequence_text) unless nil\n sequence_singular = sequence_complete.squeeze unless nil\n description = \"external search\"\n reference = searched.to_s.strip\n anagram = 0\n name = 0\n phrase = 0\n research = 0\n external = 1\n internal = 0\n created_at = \"2011-12-12 12:12:00\"\n puts \"#{sequence_text}\\t#{sequence_creation}\\t#{sequence_complete}\\t#{sequence_lexigram}\\t#{sequence_singular}\\t#{sequence_lense}\\t#{description}\\t#{reference}\\t#{anagram}\\t#{name}\\t#{phrase}\\t#{research}\\t#{external}\\t#{internal}\\t#{created_at}\\n\"\n end\n end\n end", "title": "" }, { "docid": "57de48d3c1ec8d038e1b63b59136b3d5", "score": "0.5518318", "text": "def keys_to_load; end", "title": "" }, { "docid": "ec91639566b543364501407133d96a5d", "score": "0.551661", "text": "def key_data_from_file(key_file_name)\n full_key_file_path = File.join(File.dirname(input.path), Metasploit::Credential::Importer::Zip::KEYS_SUBDIRECTORY_NAME, key_file_name)\n File.open(full_key_file_path, 'r').read\n end", "title": "" }, { "docid": "c81e590d53a8cb7a9d85e5bdfe9330fb", "score": "0.54975784", "text": "def read_preordered_hash_f file_name\n hsh, ordered_genes = {}, []\n File.foreach(file_name) do |line|\n words = line.delete(\"\\n\").split()\n hsh[words[0]] = words[1].to_f\n ordered_genes << words[0]\n end\n \n return [hsh, ordered_genes]\nend", "title": "" }, { "docid": "3ab01f4f54add8f1ed8eb888a3f378af", "score": "0.54945165", "text": "def load_data(file_name)\n data = {}\n header = true\n File.open(File.join(Folder, \"../data/\"+file_name), 'r') do |file|\n file.each do |line|\n tokens = line.split(\";\")\n if header\n KEYS.each{|key| data[key] = []}\n header = false\n else\n i = 0\n data.each_key{|k| data[k] << tokens[i].to_f; i+=1}\n end # if\n end # file.each\n end # File.open\n \n return data\n end", "title": "" }, { "docid": "dd3cae2d1c2375b450870323a96c621d", "score": "0.54943955", "text": "def process_file(file)\n fp = File.open(file)\n\n fp.each do |each_line|\n initial = each_line[0]\n if (!judge(initial))\n next\n end\n\n #get the first position of ':'\n pos = each_line.index(\":\")\n\n #ignore the wrong format\n if pos == nil\n next\n end\n\n #get the remation part of data string\n temp = each_line[pos + 1, each_line.length]\n pos = temp.index(\":\")\n #get the danmu information\n danmu = temp[pos + 1, temp.length]\n #delete line break \n danmu.chomp!\n \n hash_add(@data_hash, danmu)\n end\n end", "title": "" }, { "docid": "1fc04833cd365be885381772779e4ea5", "score": "0.5478019", "text": "def read_index\n f = File.new(@index_file)\n @sha_count = 0\n @commit_index = {}\n @commit_order = {}\n @all_files = {}\n while line = f.gets\n if /^(\\w{40})/.match(line)\n shas = line.scan(/(\\w{40})/)\n current_sha = shas.shift.first\n parents = shas.map { |sha| sha.first }\n @commit_index[current_sha] = {:files => [], :parents => parents }\n @commit_order[current_sha] = @sha_count\n @sha_count += 1\n else\n file_name = line.chomp\n tree = ''\n File.dirname(file_name).split('/').each do |part|\n next if part == '.'\n tree += part + '/'\n @all_files[tree] ||= []\n @all_files[tree].unshift(current_sha)\n end\n @all_files[file_name] ||= []\n @all_files[file_name].unshift(current_sha)\n @commit_index[current_sha][:files] << file_name\n end\n end\n end", "title": "" }, { "docid": "9a4d677fc2c61e140d32ca6b51633914", "score": "0.5477262", "text": "def getlinesofkey(path, keypat)\n\t\tlines = []\n\t\tFile.readlines(path).each do |line|\n\t\t\tif line =~ /#{keypat}/\n\t\t\t\tlines << line.strip\n\t\t\tend\n\t\tend\n\t\treturn lines\n\tend", "title": "" }, { "docid": "d33c96ea8b43c2dc0a4419fba2f07248", "score": "0.546801", "text": "def find_keys(lines, key)\n lines.select { |l| key_matches?(l, key) }\nend", "title": "" }, { "docid": "f7446bb164c4a6e523ecd299dd0f3451", "score": "0.54627925", "text": "def read_param_sfo(file)\r\n params = {}\r\n file.pos = 0x08\r\n key_table_start = file.read(0x04).unpack(\"l<\").first\r\n data_table_start = file.read(0x04).unpack(\"l<\").first\r\n tables_entries = file.read(0x04).unpack(\"l<\").first\r\n index_table = file.pos\r\n tables_entries.times do |n|\r\n pos = file.pos\r\n key_offset = file.read(0x02).unpack(\"s<\").first\r\n data_fmt = file.read(0x02).unpack(\"s<\").first\r\n data_len = file.read(0x04).unpack(\"l<\").first\r\n data_max = file.read(0x04).unpack(\"l<\").first\r\n data_offset = file.read(0x04).unpack(\"l<\").first\r\n file.pos = key_offset + key_table_start\r\n key = (file.gets(0.chr)[0...-1]).to_sym\r\n file.pos = data_offset + data_table_start\r\n params[key] = file.gets(data_len - 1)\r\n file.pos = pos + 0x10\r\n end\r\n params\r\nend", "title": "" }, { "docid": "2478c900e0590a693ca814624e82b7a8", "score": "0.54522824", "text": "def load_distribution(path)\n words = {}\n File.read(path).each_line do |line|\n word, after = line.rstrip.split(\"\\t\",2)\n next if word.nil?\n words[word] = after.split\n end\n words\nend", "title": "" }, { "docid": "e9ee2666dcd5cb009680ada5a88ff537", "score": "0.54452485", "text": "def dictionary\n dictionary_path = File.expand_path('../../data/dictionary.txt', __FILE__)\n File.open(dictionary_path).readlines\n end", "title": "" }, { "docid": "f6efaaa974e335c8a0ed278f2d6a4911", "score": "0.54414743", "text": "def read_aucs file\n f = File.new(file, \"r\")\n h = {}\n while line = f.gets\n line.chomp!\n fields = line.split(\"\\t\")\n\n # Insert in the hash\n h[ fields[0].to_i ] = fields[1].to_f\n end\n f.close\n\n h\nend", "title": "" }, { "docid": "70c67696748f0efcfaf8b0cbde008eb5", "score": "0.5439818", "text": "def read_entry(file, key)\n index = cached_keys[key]\n return unless index\n read_from_index file, index\n end", "title": "" }, { "docid": "3649af287b527203f713610918aacae1", "score": "0.5432409", "text": "def values_by_name(key, names)\n vals = {}\n names.each do |name|\n FFI::Pointer.from_string_to_wide_string(name) do |subkeyname_ptr|\n begin\n _, vals[name] = read(key, subkeyname_ptr)\n rescue Puppet::Util::Windows::Error => e\n # ignore missing names, but raise other errors\n raise e unless e.code == Puppet::Util::Windows::Error::ERROR_FILE_NOT_FOUND\n end\n end\n end\n vals\n end", "title": "" }, { "docid": "67cee226ddf56dbf0cb4d6889d2b168c", "score": "0.54302275", "text": "def readDictFromFile(file, delim = \"=\")\n dict = Hash.new\n hash = Hash.new\n currSubject = \"\"\n File.open(file, \"r\") do |f|\n f.each_line do |line|\n line = line.chomp\n\n # skip empty lines or comments\n next if line == \"\" or line.start_with?(\"#\")\n\n # catch subjects\n if line.start_with?(\"[\")\n dict[currSubject] = hash if currSubject != \"\"\n currSubject = line.sub('[','').sub(']','')\n hash = Hash.new\n else\n key, value = line.split(delim,2)\n value = value.sub('[','').sub(']','').split(\", \") if value.start_with?(\"[\")\n hash[key] = value\n end\n end\n dict[currSubject] = hash if currSubject != \"\"\n end\n return dict\nend", "title": "" }, { "docid": "3ff94c10959641db565e7e73fd3be539", "score": "0.5418158", "text": "def test_read_file\n reader = FileReader.new('testfiles/testgood.txt')\n testnodes = reader.read_file\n realnodes = {}\n realnodes[1] = Node.new 1, 'A', [2, 3]\n realnodes[2] = Node.new 2, 'C', [3]\n realnodes[3] = Node.new 3, 'D', []\n realarr = realnodes.values\n testarr = testnodes.values\n assert_equal realnodes.keys, testnodes.keys\n assert_equal realarr[0].id, testarr[0].id\n assert_equal realarr[0].letter, testarr[0].letter\n assert_equal realarr[0].neighbors, testarr[0].neighbors\n end", "title": "" }, { "docid": "f663e1f3c8306b106e86e0b78aa78002", "score": "0.5399377", "text": "def read_user_map(filename)\n user_data = open(filename).read\n user_map = {}\n user_data.each_line do |line|\n user_id, movie_id, rating, _ = line.split(' ')\n if user_map[user_id.to_sym] == nil\n user_map[user_id.to_sym] = User.new(user_id.to_sym)\n end\n user_map[user_id.to_sym].add_movie_rating(@movie_map[movie_id.to_sym], rating.to_f)\n @user_location_map[user_id.to_sym] = user_map[user_id.to_sym].genre_score_vector.map{|x| x.round.to_i}\n end\n return user_map\n end", "title": "" }, { "docid": "4a5d68dca82740abd49c3b71d110057f", "score": "0.5398957", "text": "def parse(file,dict)\n File.open(file,'r').each do |line|\n if line.include?(\"CA_\")\n dict[line.split[0]] ? dict[line.split[0]]+=line.chomp.split[1].to_i : dict[line.split[0]]=line.chomp.split[1].to_i\n end\n end\n return dict\nend", "title": "" }, { "docid": "b597a19d74b02d93bbf7f1d403cc4cca", "score": "0.539578", "text": "def load_names\n names = []\n\n File.open(\"map_names.txt\", 'r') do |file|\n while line = file.gets\n names.push line\n end\n end\n\n names\nend", "title": "" }, { "docid": "5b2dcad027d4a6a1ad09da9a417c51ad", "score": "0.53933346", "text": "def parse_inifile( inifile_path = nil )\n\n fh = File.open( inifile_path ) # open an ini file to read\n ini_hash = {} # create a hash bucket to store key, value pairs\n key = nil # hash key\n fh.each_line do | line | # eumerate each line to find out information\n line.strip! # strip leading and trailing white spaces\n next if ( line =~ /^#/ )\n line.gsub!( /\\s*#.*$/, '' )\n if ( line =~ /^\\[(.*?)\\]/ )\n key = $1\n ini_hash[key] = {}\n elsif ( line =~ /(.*?)\\s*=\\s*([^=].*?)$/ )\n ini_hash[key][$1] = $2\n end\n end\n\n ini_hash\n end", "title": "" }, { "docid": "217eae6d856a44b34360b8860b176ad4", "score": "0.5386063", "text": "def load_map\n txt = File.read(\"map.txt\")\n @map = txt.each_line.map { |l| l.chomp!.each_char.to_a }\n end", "title": "" }, { "docid": "f124c413d3779fa9936ec0074980bfbe", "score": "0.5377965", "text": "def read_key(f)\n h = Hash.new\n 8.times do\n q,id = goto_next_header(f)\n d = read_block(f) \n m = /[\\ \\t]([^\\ \\t]*):[\\ \\t]*$/.match(id)\n if m\n id = m[1]\n end\n h[id] = d\n end\n req_items = ['n', 'e', 'd', 'p', 'q', 'dP', 'dQ', 'qInv']\n req_items.each do |e|\n printf(\"ERROR: key component %s is missing!\\n\", e) if !h[e]\n end\n h.each_key do |e| \n printf(\"ERROR: unknown item '%s'!\\n\", e) if !req_items.index(e)\n end\n return h\nend", "title": "" }, { "docid": "7514d74522ceb5a1ea0694f1824ac176", "score": "0.53699005", "text": "def readfile(path=(FILE_STORE + 'dictionary.txt'))\n\t\tdictionary_entry = IO.readlines(path) if File::exists?(path)\n\t\treturn dictionary_entry\n\tend", "title": "" }, { "docid": "1c36d3cc27c3b110e699049ae1a72982", "score": "0.536635", "text": "def process_internals_hash\n File.open(\"./lib/internals/internals_table_data_input_hash.txt\", \"r\") do |f|\n #File.open(\"./lib/internals/internals_table_data.lines.txt\", \"r\") do |f|\n f.each_line do |line|\n internal_searched, searched = line.chomp.split(\"\\t\") # HASH usage\n # puts line.to_textual # LINES usage\n # created_sequence_id = external_searched(/continue code/)\n # creation_sequence_id = \n # complete_sequence_id = \n # lexigram_sequence_id = \n # singular_sequence_id = complete_sequence_id.squeeze\n puts \"#{internal_searched.to_textual}\\t#{searched}\" \n # sleep(0.1)\n end\n end\n end", "title": "" }, { "docid": "47322b1b835f2771039c3b4b907b1b35", "score": "0.53636205", "text": "def load_keys!\n load_keys(@keyfile)\n end", "title": "" }, { "docid": "caa4c8fdb9b40fcf3c8890ea6fd5d842", "score": "0.5352225", "text": "def read_attacks_file(path)\n positionArray = Array.new()\n index = 0\n read_file_lines(path) {|string|\n if string =~ /^\\(([0-9]+),([0-9]+)\\)$/\n newPosition = Position.new($1.to_i, $2.to_i)\n positionArray[index] = newPosition\n index = index + 1\n end\n }\n return positionArray\nend", "title": "" }, { "docid": "da0310aca0ffe4a2e45a4cf4659f5be5", "score": "0.53434044", "text": "def read_state\n obj = {}\n begin\n contents = File.read @file\n contents.strip.split(\";\").each {|kv|\n chunk = kv.split(\"=\")\n key = chunk[0].intern\n obj[key] = chunk[1]\n }\n rescue => e\n # ignore file not found\n end\n obj\n end", "title": "" }, { "docid": "0ab9dfa401f97855cff7f9941dbef709", "score": "0.53400046", "text": "def search_in_known_locations\n self.class.keypair_paths.each do |path|\n full_path = ::File.join( ::File.expand_path(path), ::File.basename(filepath))\n return full_path if ::File.exists?(full_path)\n end\n # raise Exception.new(\"We cannot continue without a keypair. Please define a keypair in your clouds.rb\")\n # TODO: Add raise for keypair\n nil\n end", "title": "" }, { "docid": "6a1aa2a2cf2324d4423cc6888d6a66dc", "score": "0.5338301", "text": "def key_file_locations\n [\n \".ppkeys\",\n \"#{Default.base_config_directory}/.ppkeys\",\n \"#{Default.storage_directory}/ppkeys\", \n \"~/.ppkeys\",\n \"ppkeys\"\n ]\n end", "title": "" }, { "docid": "92fb5694f5f67072ffcc5bbcaba1eeff", "score": "0.5338047", "text": "def load_mappings\n word_file = File.new(\"words.txt\", 'r')\n\n while (line = word_file.gets)\n tokens = line.chomp.split(\"\\t\")\n @mappings[tokens[1]] = tokens[0].to_f\n end\n word_file.close\n\n @mappings\n end", "title": "" }, { "docid": "24a74dc9bc68d59545e9015b3801326b", "score": "0.53367645", "text": "def populate_dict()\n File.readlines(\"dictionary.txt\").each_with_index do |line, line_num|\n @dictionary[line_num] = line.chomp\n end\n return @dictionary\n end", "title": "" }, { "docid": "87337e9444b9c3dce563fe281386fb4f", "score": "0.5335932", "text": "def get_topics(hash, txtfile)\nFile.open(txtfile) do |fp|\n fp.each do |line|\n key = line.chomp.split(\"\\n\")\n hash[key] = 0\n end end \nend", "title": "" }, { "docid": "5123fbe53a640c7760dd8735847e4977", "score": "0.53247005", "text": "def prepare_identities_from_files\n key_files.map do |file|\n if readable_file?(file)\n identity = {}\n cert_file = file + \"-cert.pub\"\n public_key_file = file + \".pub\"\n if readable_file?(cert_file)\n identity[:load_from] = :pubkey_file\n identity[:pubkey_file] = cert_file\n elsif readable_file?(public_key_file)\n identity[:load_from] = :pubkey_file\n identity[:pubkey_file] = public_key_file\n else\n identity[:load_from] = :privkey_file\n end\n identity.merge(privkey_file: file)\n end\n end.compact\n end", "title": "" }, { "docid": "903782691bf66bf89f9799e8d705d95c", "score": "0.532396", "text": "def leerIndices\n\tindices_archivo = File.new(\"indices.txt\", 'r')\n\t$indices_array = indices_archivo.readlines #leemos líneas del archivo y las guardamos en un arreglo\n\t$indices_array = $indices_array.sort #ordenamos las líneas alfabéticamente\n\t$num_lineas = $indices_array.size #contamos las líneas que tiene el archivo de índices para saber cuantos contactos tenemos\n\n\t$indices_hash = Hash.new #creamos un Hash para guardar los índices, la llave será el apellido y el valor la línea en donde se encuentra en el archivo\n\n\tfor i in 0...$num_lineas #creando hash de los indices {apellido => linea}\n\t\taux = $indices_array[i].to_s.split(' ')#dividimos la cadena en apellido(llave) y en numero de bloque(valor)\n\t\t$indices_hash[aux[0]] = aux[1] #ponemos como llave del hash el apellido y como valor el número de bloque\n\tend\n\n\tindices_archivo.close #cerramos el archivo de índices\nend", "title": "" }, { "docid": "43488e2abae5d17f424f67b51e8f002f", "score": "0.5323664", "text": "def grab_params(fh)\n hash = {}\n in_add_amino_acid_section = false\n add_section_re = /^\\s*add_/\n prev_pos = nil\n while line = fh.gets\n if line =~ add_section_re\n in_add_amino_acid_section = true\n end\n if (in_add_amino_acid_section and !(line =~ add_section_re))\n fh.pos = prev_pos\n break\n end\n prev_pos = fh.pos\n if line =~ /\\w+/\n one,two = line.split @@param_re\n two,comment = two.split @@param_two_split\n hash[one] = two.rstrip\n end\n end\n hash\n end", "title": "" }, { "docid": "5b1a61ab12b7e6fd48607e49630d8a8b", "score": "0.5323589", "text": "def scan(fileName, content, location)\n file = File.new(fileName, \"r\")\n $stderr << \"Scanning '#{fileName}'\\n\"\n active = {}\n file.each do |line|\n hasBeginOrEnd = false\n line.scan(/BEGIN\\:([a-zA-Z][a-zA-Z0-9]*)/).flatten.each do |name|\n if content[name] || active[name]\n $stderr << \"Symbol '#{name}' multiply defined\\n\"\n else\n # $stderr << \" Found '#{name}'\\n\"\n end\n active[name] = []\n location[name] = fileName\n hasBeginOrEnd = true\n end\n line.scan(/END\\:([a-zA-Z][a-zA-Z0-9]*)/).flatten.each do |name|\n content[name] = active[name]\n active.delete(name)\n hasBeginOrEnd = true\n end\n if !hasBeginOrEnd\n active.values.each do |list|\n list << line\n end\n end\n end\n active.keys.each do |name|\n $stderr << \"Missing close for #{name}\\n\"\n end\n file.close\nend", "title": "" }, { "docid": "6a5b9b8274eeabaac3a2a155151e1ddb", "score": "0.5318849", "text": "def get_ids(filename)\n $stderr.puts \"fetching ids from #{filename}\"\n\n ests_file=File.new(filename,'r')\n ests_file.each_line {|line|\n line.chomp!\n next if /^;/.match(line) # ignore comment lines\n @@contig_est_gbacc[line] = 1\n }\nend", "title": "" }, { "docid": "4b648c3e9a62b256353ef5e2e29ed2e5", "score": "0.5311969", "text": "def each_key\n Dir[File.join(@path, '.index', '*')].each { |file_name|\n key = File.basename(file_name)\n if valid_key(key)\n yield key\n end\n }\n end", "title": "" }, { "docid": "66e7a03133db280eb34aae62bab38421", "score": "0.5310988", "text": "def values_if(&block)\n self.read_file()\n vs = []\n @hash.each do |k, v|\n if block.call(k, v)\n vs << v\n end\n end\n return vs\n\n end", "title": "" }, { "docid": "11a2cc8321ccf435484dfd5020a9bafb", "score": "0.53093654", "text": "def parse_input()\n values = {}\n File.open(ARGV[1], 'r') do |file|\n # read file line by line\n file.each do |line|\n # only keep lines with \"=\" inside\n if line.include? \"=\"\n # split by words (and remove char \")\n splitted = line.delete(\"\\\"\").split(\" \")\n # store values into a hash\n values[splitted[0]] = splitted[-1]\n end\n end\n end\n return values\nend", "title": "" }, { "docid": "be6132e26dc9784986523249109c7f9c", "score": "0.53060645", "text": "def init_value_map(file)\n value_map = {}\n file.properties.each do |key, value|\n keylist = (value_map[value.to_s] ||= [])\n keylist << key\n end\n value_map\n end", "title": "" }, { "docid": "a5a05cac4ab320d2b79741232c255a40", "score": "0.53053796", "text": "def find_snps()\n return snps_from_snp_file if @snp_file\n snps_in_file = []\n in_data = false\n in_header = true\n File.open(@input_file).each do |line|\n if in_header then\n if line =~ /^\\[Data\\].*$/i then\n in_header = false\n end\n elsif !in_header && !in_data then\n in_data = true\n elsif in_data && !in_header then\n (snp,chr,pos) = line.split(/\\t/)[1,3]\n # snps_in_file[snp] = {:chr => chr.to_i, :pos => pos.to_i}\n snp = Snp.new(snp,chr,pos)\n snps_in_file.push(snp) unless snps_in_file.include?(snp)\n end #what section of the file\n end\n snps_in_file\n end", "title": "" }, { "docid": "1f07a0607b82fbfd768fbbd4e8ef023b", "score": "0.5304458", "text": "def load_file(file_name)\n File.foreach(file_name) do |line| \n next if line.strip.chomp.size == 0\n next if line.strip.chomp[0] == \"#\"\n \n (key, value) = line.split(\"=\").map { |s| s.strip.chomp }\n @hash[key] = value\n end\n self\n end", "title": "" }, { "docid": "5d2e1622cda2be19e1453c94fe1affae", "score": "0.5299394", "text": "def build_incremental_index\n index = {}\n File.open('alice.txt') do |file| # auto close file\n line_pos = 0\n file.each_line do |line|\n clean(line).scan(/\\w+/).each do |word|\n next if STOPWORDS.include?(word)\n (index[word] ||= []) << line_pos\n end\n line_pos = file.pos\n end\n end\n index\nend", "title": "" } ]
37c4e531f5b56d23c44a00c1ee06b80e
The default hook used by oauth to specify the redirect url for failure.
[ { "docid": "56eb7b90c071c2e8f183deee3351668f", "score": "0.59467137", "text": "def after_oauth_failure_path_for(scope)\n new_session_path(scope)\n end", "title": "" } ]
[ { "docid": "99145c8a4adfe75e8fc1b8cebdfdbe5f", "score": "0.7053104", "text": "def default_redirect_uri_callback(uri, res)\n newuri = urify(res.header['location'][0])\n if !http?(newuri) && !https?(newuri)\n warn(\"#{newuri}: a relative URI in location header which is not recommended\")\n warn(\"'The field value consists of a single absolute URI' in HTTP spec\")\n newuri = uri + newuri\n end\n if https?(uri) && !https?(newuri)\n raise BadResponseError.new(\"redirecting to non-https resource\")\n end\n puts \"redirect to: #{newuri}\" if $DEBUG\n newuri\n end", "title": "" }, { "docid": "8224ffb21034f5589729e9b7479ab8df", "score": "0.7047128", "text": "def redirect_url; end", "title": "" }, { "docid": "70ba74bb84f9466776c4573b87d1ef48", "score": "0.6993937", "text": "def access_denied_redirect_url\n root_url\n end", "title": "" }, { "docid": "2de4b0e1bb8212c3911d7729c5cc2b83", "score": "0.67989695", "text": "def redirect_url\n nil\n end", "title": "" }, { "docid": "0f6a1f11ae909abba5ec95bbfce48c08", "score": "0.67853093", "text": "def failure\n redirect_to \"/auth/twitter\"\n end", "title": "" }, { "docid": "b3da3714f11828430e6459d8f54fca6a", "score": "0.669313", "text": "def redirect_url\n redirect? ? headers['location'] : nil\n end", "title": "" }, { "docid": "3f134c8190de338c0b58dfb5caf1b403", "score": "0.6674043", "text": "def default_unauthorized_redirect_url\n url_params = params[:t].present? ? \"?t=#{params[:t]}\" : ''\n \"/login#{url_params}\"\n end", "title": "" }, { "docid": "84ebcac419183d014f4e2fb4e47d797c", "score": "0.6595932", "text": "def redirect(url); end", "title": "" }, { "docid": "eccbb795450335ffedecdcd0fbd98948", "score": "0.6583923", "text": "def default_redirect_status\n 302\n end", "title": "" }, { "docid": "eccbb795450335ffedecdcd0fbd98948", "score": "0.6583923", "text": "def default_redirect_status\n 302\n end", "title": "" }, { "docid": "228ec976f6dee9b837ff3786207f84e1", "score": "0.65459615", "text": "def failure\n if request.referer && request.referer.index(request.host+launch_path)\n loc = Addressable::URI.parse(request.referer)\n new_query = loc.query_values || {}\n new_query[\"auto_auth_failed\"] = true\n loc.query_values = new_query\n redirect_to loc.to_s\n else\n redirect_to new_user_session_path\n end\n end", "title": "" }, { "docid": "11552d78c3566da3f6d9d123a826c0b6", "score": "0.6509608", "text": "def oauth_failure\n # TODO: Render something appropriate here\n render text:\"failed...\"\n end", "title": "" }, { "docid": "7cc74913cf5ee1887149bb8d8c4a1b22", "score": "0.6497528", "text": "def fail\n ap params\n error = \"We could not connect to #{params[\"strategy\"].capitalize}\"\n logger.warn \"OAUTH FAILED #{params}\"\n if session[:user_id].nil?\n redirect_to params[\"origin\"] || root_path , :notice => error\n else\n user = User.find( session[:user_id])\n redirect_to user_path(user), :notice => error\n end\n end", "title": "" }, { "docid": "53e3dc5f131d2ad96ca6182bd9ccae0c", "score": "0.64906764", "text": "def specific_oauth_error(resp, error_code, context); end", "title": "" }, { "docid": "240ab8641a7dd8b4e294c956bf31c6ad", "score": "0.6488165", "text": "def back_url(oauth_error, provider)\n base_url = oauth_origin || request.referer || root_path\n \"#{base_url}?error=#{oauth_error}##{provider}\"\n end", "title": "" }, { "docid": "78b1f2cc781748f569742c840af1e54a", "score": "0.64865714", "text": "def invalid_oauth_response; end", "title": "" }, { "docid": "b5fd46f03df50753c7ff62b3e18e7825", "score": "0.6464533", "text": "def failure\n redirect_to root_path, error: I18n.t('errors.omniauth_fail',\n provider: params[:strategy].capitalize,\n reason: params[:message].gsub('_', ' '))\n end", "title": "" }, { "docid": "f236327e3b7b135075751fe28e148e30", "score": "0.64172935", "text": "def redirect_url(realm, return_to = T.unsafe(nil), immediate = T.unsafe(nil)); end", "title": "" }, { "docid": "e4210277eb39599f9cd4241a69eb43b6", "score": "0.6367477", "text": "def after_omniauth_failure_path_for(scope)\n super(scope)\n\tend", "title": "" }, { "docid": "c1493b18e063c9a36cc448927fc19626", "score": "0.63669926", "text": "def after_omniauth_failure_path_for(scope)\n super(scope)\n end", "title": "" }, { "docid": "85b82b0ccb48ea82104163d8535d9379", "score": "0.6361332", "text": "def redirect_url\n params[:redirect_url].blank? ? nil : params[:redirect_url]\n end", "title": "" }, { "docid": "d691d98ce9642807cd9a7944b823e2ba", "score": "0.6349557", "text": "def after_omniauth_failure_path_for(_scope)\n # super(scope)\n redirect_to root_path, alert: _('We are having trouble communicating with your institution at this time.')\n end", "title": "" }, { "docid": "c66104c8f1ce4653908ace8d29b46c3d", "score": "0.6348495", "text": "def after_omniauth_failure_path_for(scope)\n super(scope)\n end", "title": "" }, { "docid": "c66104c8f1ce4653908ace8d29b46c3d", "score": "0.6348495", "text": "def after_omniauth_failure_path_for(scope)\n super(scope)\n end", "title": "" }, { "docid": "a77028ac80356252d0a79078abc3d470", "score": "0.63396096", "text": "def website_redirect_location; end", "title": "" }, { "docid": "5daccc2db4f9f0c3ad9108781eb0f31c", "score": "0.63211936", "text": "def website_redirect_location(value); end", "title": "" }, { "docid": "75bd8ac1fc0037ad20dc887c4314a1b4", "score": "0.6307332", "text": "def bad_url_redirect\n flash[:error] = 'That URL does not exist.'\n redirect_to root_url\n end", "title": "" }, { "docid": "76feb1ec89763d602e4865d8121d318f", "score": "0.63061553", "text": "def follow_redirect!; end", "title": "" }, { "docid": "76feb1ec89763d602e4865d8121d318f", "score": "0.63061553", "text": "def follow_redirect!; end", "title": "" }, { "docid": "76feb1ec89763d602e4865d8121d318f", "score": "0.63061553", "text": "def follow_redirect!; end", "title": "" }, { "docid": "9636075a86a5151ab7b55003a6a7d906", "score": "0.6291966", "text": "def after_omniauth_failure_path_for(scope)\n super(scope)\n end", "title": "" }, { "docid": "95c8bf2ae7b967585993ebdb7c8bcf0e", "score": "0.62899214", "text": "def get_redirection_url(resp)\n status_code = resp.code.to_i\n (status_code >= 300 && status_code < 400) ? resp['location'] : nil\n end", "title": "" }, { "docid": "35d540ba27f615d1a1d978267df17d80", "score": "0.6289712", "text": "def failure\n redirect_to login_path, alert: \"#{t 'sessions.oauth_failure', default: 'Session not opened. Try again or register'}.\"\n end", "title": "" }, { "docid": "79d095478b0ba96b07be479df114d5e2", "score": "0.62749684", "text": "def after_omniauth_failure_path_for(scope)\n super(scope)\n end", "title": "" }, { "docid": "fa03a9af0cd71ae0eb838b54ccf4958c", "score": "0.6271473", "text": "def lactic_google_calendar_redirect\n # redirect_to profile_path\n\n # puts \"IN LACTIC GOOGLE CAL REDIRECT #{params.inspect}\"\n\n if params[:error] && params[:error] == 'access_denied' || !params[:code]\n # redirect_to profile_path(:google_token => 'false')\n # redirect_to profile_path(:google_token => 'false')\n redirect_to \"#{session[:google_caller]}?google_token='false'\"\n\n else\n\n # puts \"IN LACTIC GOOGLE CAL REDIRECT 2222 #{params.inspect}\"\n @GOOGLE_API_CLIENT = google_calendar_token_auth\n\n response = fetch_token\n\n # redirect_to profile_path(:google_token => response, :google_access_token => session[:access_token])\n redirect_to \"#{session[:google_caller]}?google_token=#{response}&google_access_token=#{session[:access_token]}\"\n end\n end", "title": "" }, { "docid": "20823f5163e375840dde2296e6607fbb", "score": "0.6260391", "text": "def hook_url\n raise NotImplementedError\n end", "title": "" }, { "docid": "0a76b6b3909b9346ec75726462744349", "score": "0.62321436", "text": "def redirect_to url\n {url: url, status: 302}\n end", "title": "" }, { "docid": "f3efc2970dc2c4104e15c4480ef2a99b", "score": "0.62234414", "text": "def redirect=(_arg0); end", "title": "" }, { "docid": "2b350cb1204bdd2f5262bc0459b80967", "score": "0.6215535", "text": "def invalid_url=(_arg0); end", "title": "" }, { "docid": "90cc81b80ddc0fe393e60b703a6824f1", "score": "0.6214781", "text": "def redirect_callbacks\n super\n end", "title": "" }, { "docid": "6dcf4838242bb652e774fd886f50f190", "score": "0.61932975", "text": "def redirect(_options = {})\n nil\n end", "title": "" }, { "docid": "2c4fbfbfa4f32d000e600f52b72e7e70", "score": "0.6177998", "text": "def redirect_url\n test? ? test_redirect_url : live_redirect_url\n end", "title": "" }, { "docid": "e1aca64e734d51c00d54866596fbb417", "score": "0.61750543", "text": "def omniauth_callback_failure\n redirect_to root_path\n end", "title": "" }, { "docid": "a38f3aa9f67f29f49afa48044cd1c16c", "score": "0.6174711", "text": "def failure\n I18n.locale = URLUtils.extract_locale_from_url(request.env['omniauth.origin']) if request.env['omniauth.origin']\n error_message = params[:error_reason] || \"login error\"\n kind = env[\"omniauth.error.strategy\"].name.to_s || \"Facebook\"\n flash[:error] = t(\"devise.omniauth_callbacks.failure\",:kind => kind.humanize, :reason => error_message.humanize)\n redirect_to root\n end", "title": "" }, { "docid": "ab3c2eec17a171268add7580e2b5192e", "score": "0.6172852", "text": "def redirect_on_failure(options = {})\n location = options[:location] ||\n request.env['HTTP_REFERER'].presence ||\n index_path\n flash[:alert] ||= error_messages.presence || flash_message(:failure)\n redirect_to location\n end", "title": "" }, { "docid": "87383ffb36861d8bbb2c756f52fca2b8", "score": "0.6170654", "text": "def redirect_url\n @redirect_url\n end", "title": "" }, { "docid": "8a1f286bd3fa72561631dac71fb60731", "score": "0.6170066", "text": "def redirect(options = {})\r\n end", "title": "" }, { "docid": "3a6296cab8ef662a7f71bf8eb42bf04f", "score": "0.61322844", "text": "def callback_url\n options[:redirect_uri] || (full_host + script_name + callback_path)\n end", "title": "" }, { "docid": "84b1377150022200111de602bbd64a94", "score": "0.61234796", "text": "def redirect_url\n flash[:error] = \"Invalid login or password\"\n \n #session[:previous_url] || login_path\n login_path # always want login failures to go back to the login screen\n end", "title": "" }, { "docid": "7f5f58aeeeeeaaca9c88cf237a2bd284", "score": "0.61231405", "text": "def default_unauthorized_redirect_url\n next_path = \"\"\n if params[\"r_m\"] == \"1\"\n next_path = \"?next=#{CGI.escape request.fullpath}\"\n end\n \"/admin/login#{next_path}\"\n end", "title": "" }, { "docid": "5382b46c834bda9553cbdd6b8848b07d", "score": "0.6121299", "text": "def adjust_for_redirect\n self.url = fetch_url(self.url)\n end", "title": "" }, { "docid": "ec07a4255c3073c1934422b03ca44edc", "score": "0.6118646", "text": "def after_omniauth_failure_path_for(scope)\n '/'\n end", "title": "" }, { "docid": "f76911a8bdf771294a891cb89db42dc6", "score": "0.60858494", "text": "def redirect_url(immediate=false)\n @auth_request.redirect_url(realm, return_to, immediate)\n end", "title": "" }, { "docid": "6e35631b4e5e32c707f2a823d0796052", "score": "0.60692006", "text": "def validate_oauth2_redirect_url!\n redirect_url = params[:redirect_url]\n raise Vidibus::Oauth2Server::MissingRedirectUrlError if redirect_url.blank?\n raise Vidibus::Oauth2Server::MalformedRedirectUrlError unless valid_uri?(redirect_url)\n unless redirect_url.match(/^https?:\\/\\/([a-z0-9]+\\.)?#{@oauth2_client.domain}/) # allow subdomains but ensure host of client application\n raise Vidibus::Oauth2Server::InvalidRedirectUrlError\n end\n end", "title": "" }, { "docid": "58ed827e90746dd9dac7a57ea124a53a", "score": "0.6059632", "text": "def invalid_url; end", "title": "" }, { "docid": "b1fe44363db1331a344e92a4b01732a6", "score": "0.60562617", "text": "def redirect; end", "title": "" }, { "docid": "7fa66338515e00129e93f0050d5a0e81", "score": "0.6048292", "text": "def custom_failure!; end", "title": "" }, { "docid": "0d1bbb99e0e53b3e6ed1c7aeeab659eb", "score": "0.604472", "text": "def failed!(code, url)\n @failure_callback.call(code, url) if @failure_callback\n end", "title": "" }, { "docid": "a7efaa8070611f67485d387746db712f", "score": "0.60445416", "text": "def set_default_redirect(default, options = {})\n on = options[:on] || :success\n redirect_to (params[:_redirect_on] && params[:_redirect_on][on]) || default\n end", "title": "" }, { "docid": "452bac6198d1767518a76a9629389b1b", "score": "0.60343355", "text": "def invalidUrl=(_arg0); end", "title": "" }, { "docid": "65fe2a1902aa648a8fa9c5ca33924528", "score": "0.6031144", "text": "def access_denied; store_location; authenticate; end", "title": "" }, { "docid": "5c7f31c8b8596face66fb305203ae65d", "score": "0.6028715", "text": "def failure_message\n \"expected the location header to be #{@url}\"\n end", "title": "" }, { "docid": "d7952219157df120846aae1f2377784f", "score": "0.60247546", "text": "def redirect\n GoogleOauth.revoke_access(current_user)\n authorization_uri = GoogleOauth.authorization_uri(url_for(action: :callback))\n redirect_to authorization_uri.to_s\n end", "title": "" }, { "docid": "f34646341b7795e2e0c2e46d76765d6e", "score": "0.60129094", "text": "def redirect_url\n params.fetch(\n :redirect_url,\n DeviseJwtAuth.default_confirm_success_url\n )\n end", "title": "" }, { "docid": "ea8821ff7abf730c006c643651886481", "score": "0.60016704", "text": "def follow_redirect!(**args); end", "title": "" }, { "docid": "ba83e504c8c5b208512de870e615b1e6", "score": "0.59919196", "text": "def callback_url\n options.redirect_uri || full_host + script_name + callback_path\n end", "title": "" }, { "docid": "cc4e869e9ceb7ed51ee0a9f2da8feefd", "score": "0.59881276", "text": "def callback_url\n options[:redirect_uri] || (full_host + script_name + callback_path)\n end", "title": "" }, { "docid": "cc4e869e9ceb7ed51ee0a9f2da8feefd", "score": "0.59881276", "text": "def callback_url\n options[:redirect_uri] || (full_host + script_name + callback_path)\n end", "title": "" }, { "docid": "cc4e869e9ceb7ed51ee0a9f2da8feefd", "score": "0.59881276", "text": "def callback_url\n options[:redirect_uri] || (full_host + script_name + callback_path)\n end", "title": "" }, { "docid": "cc4e869e9ceb7ed51ee0a9f2da8feefd", "score": "0.59881276", "text": "def callback_url\n options[:redirect_uri] || (full_host + script_name + callback_path)\n end", "title": "" }, { "docid": "cc4e869e9ceb7ed51ee0a9f2da8feefd", "score": "0.59881276", "text": "def callback_url\n options[:redirect_uri] || (full_host + script_name + callback_path)\n end", "title": "" }, { "docid": "03d831cc1f873b84fffe9df0165c0b40", "score": "0.5985753", "text": "def redirect_to_google_auth_url(options = {})\n url = google_user_authorizer.get_authorization_url(\n login_hint: options[:login_hint],\n request: request,\n redirect_to: options[:redirect_to],\n scope: options[:scope])\n redirect_to url\n end", "title": "" }, { "docid": "9326f3e80ffe71cfb17eefa64d749900", "score": "0.5983983", "text": "def redirect?; url != redirect && !redirect.empty? end", "title": "" }, { "docid": "6e1a7cf938ef983e1e214bebe65e30a7", "score": "0.59773326", "text": "def negative_failure_message\n \"expected the location header to be different to #{@url}\"\n end", "title": "" }, { "docid": "6a46a72d8ede1f65f0682ac56eabb0ce", "score": "0.5970209", "text": "def url\n redirect.url\n end", "title": "" }, { "docid": "062a9d5975c9e7ea0fa581fdfabab820", "score": "0.5969054", "text": "def oauth_failure\n env = request.env\n # logger.debug2 \"env.keys = #{env.keys.sort.join(', ')}\"\n # logger.debug2 \"env = #{env} (#{env.class})\"\n error = env['omniauth.error']\n type = env['omniauth.error.type']\n strategy = env['omniauth.error.strategy']\n logger.debug2 \"error = #{error} (#{error.class})\"\n logger.debug2 \"error.methods = #{error.methods.sort.join(', ')}\"\n logger.debug2 \"error.message = #{error.message} (#{error.message.class})\"\n\n # check cancelled facebook login\n # Parameters: {\"error_reason\"=>\"user_denied\",\n # \"error\"=>\"access_denied\",\n # \"error_description\"=>\"The user denied your request.\", \"state\"=>\"480ee4d402ad5b940d6b48\n # error.message = OmniAuth::Strategies::OAuth2::CallbackError (String)\n # request_uri = http://localhost/auth/facebook/callback?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request.&state=480ee4d402ad5b940d6b48805c6ec91ac70f840d400ac998\n # type = invalid_credentials (Symbol)\n # error.class = OmniAuth::Strategies::OAuth2::CallbackError\n # error.message = OmniAuth::Strategies::OAuth2::CallbackError\n request_uri = env['REQUEST_URI']\n uri_prefix = \"#{SITE_URL}auth/facebook/callback?error\"\n if request_uri.first(uri_prefix.length) == uri_prefix and\n type == :invalid_credentials and\n error.class == OmniAuth::Strategies::OAuth2::CallbackError and\n params[:error] == 'access_denied'\n logger.debug2 \"facebook login was cancelled\"\n save_flash_key \".login_cancelled\", :provider => 'facebook', :appname => APP_NAME\n redirect_to :controller => :auth\n return\n end\n\n # todo: check cancelled google+ login\n # no cancel button in google+ - use have to use back button\n\n # check for cancelled linkedin login\n # that is first logon with scope r_basicprofile r_network\n # and additional authorisation with scope r_basicprofile r_network rw_nus.)\n type = env['omniauth.error.type']\n if request_uri == \"#{SITE_URL}auth/linkedin/callback\" and\n type == :invalid_credentials and\n error.class == OAuth::Problem and\n error.message == 'parameter_absent'\n client = get_linkedin_api_client()\n if client\n logger.debug2 \"request for linked rw_nus priv. was cancelled\"\n save_flash_key \".linkedin_rw_nus_cancelled\", :appname => APP_NAME\n redirect_to :controller => :gifts\n else\n logger.debug2 \"linkedin login was cancelled\"\n save_flash_key \".login_cancelled\", :provider => 'linkedin', :appname => APP_NAME\n redirect_to :controller => :auth\n end\n return\n end\n\n # todo: check cancelled twitter login\n # twitter login fejlede! invalid_credentials: 401 Unauthorized\n logger.debug2 \"request_uri = #{request_uri}\"\n logger.debug2 \"type = #{type} (#{type.class})\"\n logger.debug2 \"error.class = #{error.class}\"\n logger.debug2 \"error.message = #{error.message}\"\n # request_uri = http://localhost/auth/twitter/callback?denied=2ddtp3zYx5CdldwXCOshMuFVC3QEiAMyAJpKUbO4Fc\n # type = invalid_credentials (Symbol)\n # error.class = OAuth::Unauthorized\n # error.message = 401 Unauthorized\n # Parameters: {\"denied\"=>\"2ddtp3zYx5CdldwXCOshMuFVC3QEiAMyAJpKUbO4Fc\"}\n uri_prefix = \"#{SITE_URL}auth/twitter/callback?denied=\"\n if request_uri.first(uri_prefix.length) == uri_prefix and\n type == :invalid_credentials and\n error.class == OAuth::Unauthorized and\n error.message == '401 Unauthorized'\n logger.debug2 \"twitter login was cancelled\"\n save_flash_key \".login_cancelled\", :provider => 'twitter', :appname => APP_NAME\n redirect_to :controller => :auth\n return\n end\n\n # logger.debug2 \"type = #{type}\"\n # logger.debug2 \"strategy = #{strategy}\"\n # logger.debug2 \"strategy.methods = #{strategy.methods.sort.join(', ')}\"\n # logger.debug2 \"strategy.name = #{strategy.name}\"\n #error = :\n # {\n # \"errorCode\": 0,\n # \"message\": \"Unable to verify access token\",\n # \"requestId\": \"K7SXSRYQUA\",\n # \"status\": 401,\n # \"timestamp\": 1384762283211\n #}\n #type = invalid_credentials\n #strategy = #<OmniAuth::Strategies::LinkedIn:0xb6480cb8>\n #strategy.name = linkedin\n message = $1 if error.message =~ /\"message\": \"(.*?)\"/\n message = error.message unless message\n message = message.to_s.first(40)\n # flash[:notice] = \"Authentication failure! #{type}: #{message}\"\n save_flash_key '.authentication_failure', :provider => provider_downcase(strategy.name), :type => type, :message => message\n redirect_to '/auth'\n end", "title": "" }, { "docid": "9f8dd22a877765cb3836e71b00709b43", "score": "0.59681964", "text": "def oauth_callback_url\n complete_oauth_login_url\n end", "title": "" }, { "docid": "bd32ccede5b0d0f4ea0406219ef37520", "score": "0.5956313", "text": "def url_redirect\n \turl = self.url\n \t(url.include?(\"http://\") || url.include?(\"https://\") ? url : \"http://\"+url)\n end", "title": "" }, { "docid": "bc6263613c9010d3b2ec91cf1a49429d", "score": "0.5955335", "text": "def gocardless_redirect\n start_redirect_flow(gocardless_success_url)\n end", "title": "" }, { "docid": "2d5eca782d79c6626da57fc59efa37c4", "score": "0.59542906", "text": "def custom_failure?; end", "title": "" }, { "docid": "5e380aaa8af772783038dabd59bc66d9", "score": "0.59492105", "text": "def redirect_url\n behavior.redirect_url\n end", "title": "" }, { "docid": "7e58f307375ed2eb49c0921b9b8baac5", "score": "0.5948692", "text": "def redirect_back(fallback_location:, allow_other_host: T.unsafe(nil), **args); end", "title": "" }, { "docid": "790f35b2323cf8e64089f9dd6d49d1f7", "score": "0.59465224", "text": "def render_create_error_not_allowed_redirect_url\n response = {\n status: 'error',\n data: resource_data\n }\n message = I18n.t(\"devise_token_auth.passwords.not_allowed_redirect_url\", redirect_url: @redirect_url)\n render_error(403, message, response)\n end", "title": "" }, { "docid": "851896b074ec2153c96b2bd36177eee6", "score": "0.59416884", "text": "def redirect_url()\n # If the redirect URL has been set then return it.\n unless self.instance_variable_defined? :@redirect_url\n raise OpenIDConnectClientException, \"The redirect URL has not been set.\"\n end\n\n @redirect_url\n end", "title": "" }, { "docid": "4977346e156e49de4abeea8c9a31e2d6", "score": "0.5938441", "text": "def redirect_url_for(token)\n \"#{redirect_url}#{token}\"\n end", "title": "" }, { "docid": "4977346e156e49de4abeea8c9a31e2d6", "score": "0.5938441", "text": "def redirect_url_for(token)\n \"#{redirect_url}#{token}\"\n end", "title": "" }, { "docid": "d5d2202cd8385af9e89a84f38c1f3083", "score": "0.5936538", "text": "def failure\n origin_locale = get_origin_locale(request, available_locales())\n I18n.locale = origin_locale if origin_locale\n error_message = params[:error_reason] || \"login error\"\n kind = env[\"omniauth.error.strategy\"].name.to_s || \"Facebook\"\n flash[:error] = t(\"devise.omniauth_callbacks.failure\",:kind => kind.humanize, :reason => error_message.humanize)\n redirect_to search_path\n end", "title": "" }, { "docid": "b3fcdb1f07fa878e4d5781d14bb00163", "score": "0.5933175", "text": "def on_failure; end", "title": "" }, { "docid": "de5dc53612bf54928acefea77f1ff679", "score": "0.593286", "text": "def oauth\n set_callback\n session[:oauth_last_url] = params[:dest] || request.referer\n login_at(auth_params[:provider])\n end", "title": "" }, { "docid": "40acb253304421be5bef381f49f083d1", "score": "0.5931498", "text": "def redirect(location, status = '302'); request.redirect(location, status); end", "title": "" }, { "docid": "40acb253304421be5bef381f49f083d1", "score": "0.5931498", "text": "def redirect(location, status = '302'); request.redirect(location, status); end", "title": "" }, { "docid": "08fee9362c7851f16a2fa87aa84c4512", "score": "0.5928541", "text": "def failure\n redirect_to root_path\n end", "title": "" }, { "docid": "08fee9362c7851f16a2fa87aa84c4512", "score": "0.5928541", "text": "def failure\n redirect_to root_path\n end", "title": "" }, { "docid": "d44a3e008e690df5b1f84b2b59874f4c", "score": "0.59224385", "text": "def location_for_redirect\n if request.url.include?('/api')\n request.referer\n else\n request.url\n end\n end", "title": "" }, { "docid": "6814472bfad2f0dd6e7af1eed4fb202f", "score": "0.5914698", "text": "def redirect_to(url_options = {}, response_options = {})\n response_options[:status] ||= :see_other unless request.get?\n super url_options, response_options\n end", "title": "" }, { "docid": "00bbb0b11ef23868c959a14400a136ca", "score": "0.59129274", "text": "def redirect_after_unsuccessful_authentication\n\t\tparams_hsh = {}\n\t\tparams_hsh[:customer_app] = params[:customer_app] if params[:customer_app]\n\t\tparams_hsh[:redirect_back_url] = params[:redirect_back_url] if params[:redirect_back_url]\n\t\tredirect_to add_query_params(default_sign_in_url, params_hsh)\n\t\treturn\n \tend", "title": "" }, { "docid": "c2197e55cb2e11fffca7c76ebaf007c7", "score": "0.5906824", "text": "def follow_redirects(value = T.unsafe(nil)); end", "title": "" }, { "docid": "de3c956f20def79c3182faca15df309e", "score": "0.5906624", "text": "def oauth_callback\n @callback_url ||= \"http://#{request.host_with_port}/twitter/after_login\"\n end", "title": "" }, { "docid": "53a302b8089175d441ba5c9f35bc8773", "score": "0.5899223", "text": "def set_redirect_location\n @redirect_location = @favable\n end", "title": "" }, { "docid": "53c54f86fee3d8d37dd6d5e2120895e5", "score": "0.5898547", "text": "def set_redirect_location(opts)\n opts = check_params(opts,[:redirect_locations])\n super(opts)\n end", "title": "" } ]
f09dc7e4e5107a8a854d1070be3e4dca
GET /perfis GET /perfis.xml
[ { "docid": "8ba453c30296107b0b0f75318899ca32", "score": "0.5874237", "text": "def index\n @perfis = Perfil.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @perfis }\n end\n end", "title": "" } ]
[ { "docid": "9754e7c0da3eae7e2f38fb7601ed2b3d", "score": "0.6114356", "text": "def index\n @perf_benchmarks = @app.perf_benchmarks.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @perf_benchmarks }\n end\n end", "title": "" }, { "docid": "4522cf8448c0d86dd1697fdbb6d7ec22", "score": "0.58774275", "text": "def stats\n request :get, \"_stats\"\n end", "title": "" }, { "docid": "4522cf8448c0d86dd1697fdbb6d7ec22", "score": "0.58774275", "text": "def stats\n request :get, \"_stats\"\n end", "title": "" }, { "docid": "eeeb18729c935d8c66ebe08cbb693d0b", "score": "0.5817852", "text": "def show\n @perf_benchmark = @app.perf_benchmarks.includes(:perf_tests).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @perf_benchmark }\n end\n end", "title": "" }, { "docid": "52171d62e6ca89856d20fce107956bac", "score": "0.58148575", "text": "def show\n @mriperformance = Mriperformance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mriperformance }\n end\n end", "title": "" }, { "docid": "c142226b26da68b26dc83303a8672a99", "score": "0.5729813", "text": "def performance\n authenticated_post(\"auth/r/stats/perf:1D/hist\")\n end", "title": "" }, { "docid": "1ad6281e03728f3dcf4cd04b39203f4f", "score": "0.5714881", "text": "def getinfo\n request :getinfo\n end", "title": "" }, { "docid": "9fcb57d7200a6ac66660050a9b3303fb", "score": "0.5666685", "text": "def raw_stats\n url = URI.parse(stats_url)\n Net::HTTP.start(url.host, url.port) {|http|\n http.request(Net::HTTP::Get.new(url.path))\n }.body\nend", "title": "" }, { "docid": "26a4dc29a68fdc616edfb3490f41f4aa", "score": "0.55657", "text": "def stats\n Client.current.get(\"#{resource_url}/stats\")\n end", "title": "" }, { "docid": "057efbc2a764eed42cb9d26df0740470", "score": "0.547041", "text": "def http( *args )\n p http_get( *args )\n end", "title": "" }, { "docid": "9fef28c6459aa9c8f491acad6e12e3b1", "score": "0.5464244", "text": "def info( opts = {} )\n http_action :get, nil, opts\n end", "title": "" }, { "docid": "c63d01cc01f0073cce98ca85347cb7b7", "score": "0.54399633", "text": "def info\n CouchRest.get \"#{@uri}/\"\n end", "title": "" }, { "docid": "671feb115b10bf43be728dddbb8426f9", "score": "0.5400934", "text": "def show\n @st_pi = StPi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @st_pi }\n end\n end", "title": "" }, { "docid": "cf0e373a281c8f82e585907747ee6574", "score": "0.5397926", "text": "def get_flows()\n\tputs \"Getting flows\"\n\tresponse = request_get('/api/partner/flow')\n\tputs response.body\nend", "title": "" }, { "docid": "501aec595e2503c610a5f16ee5dc28dc", "score": "0.5385456", "text": "def make_request\n if @test\n host = 'wwwcie.ups.com'\n else\n host = 'www.ups.com'\n end\n\n path = \"/ups.app/xml/Rate\"\n server = Net::HTTP.new(host, 443)\n data = @xml_pieces.collect{|p| p.to_s}.join(\"\\n\")\n if @debug\n File.open(@debug_request_path, 'w') do |file|\n file.puts data\n end\n end\n headers = { \"Content-Type\" => \"text/xml\"}\n server.use_ssl = true\n resp = server.post(path, data, headers)\n if @debug\n File.open(@debug_response_path, 'w') do |file|\n file.puts resp.body\n end\n end\n prices = parse_response(resp.body)\n end", "title": "" }, { "docid": "761bffc654c27f6d8bfe9ad88b1517f1", "score": "0.53786176", "text": "def request_timestamp(cli,request)\n\t\tprint_status(\"#{cli.peerhost} - #{current_time} - [HTTP GET] - #{request.uri}\")\n\tend", "title": "" }, { "docid": "cae220edb0cb916fea26e3bb6bc872c4", "score": "0.53747356", "text": "def call_rest_getlbvstats\n print \"get lb vserver stats\\n\"\n @uri.path = \"/nitro/v1/config/lbvserver/\"\n @request = Net::HTTP::Get.new(@uri)\n @request.basic_auth \"#{@username}\", \"#{@password}\"\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.lbvserver+json')\n\n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n\n if response.code == \"200\"\n result = JSON.parse(response.body)\n File.open(\"lbvserver-stats.json\", \"w\") do |file|\n file.write(JSON.pretty_generate(result))\n end\n end\n }\n\n end", "title": "" }, { "docid": "403f293b4056b7f15deb831af9fa363b", "score": "0.53650343", "text": "def show\n @app = App.includes(:perf_benchmarks).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n end\n end", "title": "" }, { "docid": "902adf030359d9e7acaa73878730d2fa", "score": "0.53521883", "text": "def http_method\n :get\n end", "title": "" }, { "docid": "98c1edbf6b19fe1c4291907ceefa0920", "score": "0.5349467", "text": "def get endpoint\n do_request :get, endpoint\n end", "title": "" }, { "docid": "66b7f95ffc089c0ff0a146dc58ea1c6d", "score": "0.53262776", "text": "def show\n @p_stat = PStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @p_stat }\n end\n end", "title": "" }, { "docid": "117a07090a1040933493335394796af6", "score": "0.5323897", "text": "def info\n get '/'\n end", "title": "" }, { "docid": "34dcc8ec65d7e99c8102c0b97bd24027", "score": "0.53076684", "text": "def query_api(path)\n with_http_error_handling do\n res = RestClient.get(endpoint + path)\n h = Hash.from_xml(res.body)\n h[\"response\"]\n end\n end", "title": "" }, { "docid": "725070539a53cd6a8488fe7ff4225130", "score": "0.53060174", "text": "def index\n @st_ipis = StIpi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @st_ipis }\n end\n end", "title": "" }, { "docid": "999e466e4919a813ddf1573541d93b49", "score": "0.529362", "text": "def get_blockchain_stats\n stats = HTTParty.get(\"http://webbtc.com/stats.json\")\nend", "title": "" }, { "docid": "d1d44f6e0e054398989bf21a4bab4717", "score": "0.5293096", "text": "def show\n @bowling_performance = BowlingPerformance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bowling_performance }\n end\n end", "title": "" }, { "docid": "904b98330909fc6404ba82eb2bbffef4", "score": "0.52782625", "text": "def get\n start { |connection| connection.request http :Get }\n end", "title": "" }, { "docid": "93ce3bf03a9178edabdd48c5952913df", "score": "0.52753454", "text": "def show\n @performance_benefit_std = PerformanceBenefitStd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @performance_benefit_std }\n end\n end", "title": "" }, { "docid": "30e93cec0ffe21385bdabf5d48252b69", "score": "0.5240981", "text": "def show\n @traffic = Traffic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @traffic }\n end\n end", "title": "" }, { "docid": "15316ad149e21e881b80fcef36cac45a", "score": "0.52346474", "text": "def get_usage(args= {})\n args = {:day=>\"today\", :type=>\"heat\"}.merge(args)\n result = HTTParty.get( @tstat_ip + '/tstat/datalog', :headers => @headers) \n \n day = result[args[:day]]\n runtime = day[args[:type] + '_runtime']\n\n return runtime\n end", "title": "" }, { "docid": "8b1783e307539a116d1de9cddcc329ee", "score": "0.5226058", "text": "def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n return doc\n \n end\n \nend", "title": "" }, { "docid": "fd78587858af2bd13f199762e2802bfc", "score": "0.52219194", "text": "def index\n @st_pis = StPi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @st_pis }\n end\n end", "title": "" }, { "docid": "ff81bd114a8e745c2079205a5e813ffd", "score": "0.5214798", "text": "def get path_and_params\n start if not @pid\n @lock.synchronize do\n @last_use = Time.new.to_f\n\n # Make request to xtractr\n uri = URI.parse(\"http://127.0.0.1:#{@port}/#{path_and_params}\")\n response = Net::HTTP.get_response(uri)\n\n # Copy headers from response\n headers = {}\n response.each_header {|name,val| headers[name] = val}\n\n return response.code.to_i, headers, response.body\n end\n end", "title": "" }, { "docid": "8c015e7f9aec31eb74fd5a815ce72cf7", "score": "0.52094257", "text": "def _api_call(method, args)\r\n uri = _uri(method, args)\r\n response = XmlSimple.xml_in(_http_get(uri))\r\n end", "title": "" }, { "docid": "227e699c2d0fac56beb379a1fd0ef2c6", "score": "0.5195343", "text": "def index\n @traffics = Traffic.find(:all, :order => \"created_at\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traffics }\n end\n end", "title": "" }, { "docid": "46ca5cf2259fac1374a744bf0cf096b1", "score": "0.51924336", "text": "def retrieve_rates(date)\n path = \"http://openexchangerates.org/api/historical/#{date.to_s}.json?app_id=#{$app_id}\"\n response = Net::HTTP.get_response(URI.parse path)\n # TODO: error handling\n response.body\nend", "title": "" }, { "docid": "cf06302bfac61e5b1a66df4691b4a72e", "score": "0.51902694", "text": "def GET; end", "title": "" }, { "docid": "e0772e639939f760f8455fe8f12ce92e", "score": "0.5186308", "text": "def show\r\n SignalStrength.switch_data(params[:connection], \"daily\")\r\n #@signal_strengths = SignalStrength.find(params[:id])\r\n #@signal_strengths = SignalStrength.find(:all, :origin=>'94531', :within=>10)\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @signal_strengths.to_xml(:dasherize => false) }\r\n end\r\n end", "title": "" }, { "docid": "d3811a0ce4c959e5551c47f899f34973", "score": "0.5183336", "text": "def getinfo\n @api.request 'getinfo'\n end", "title": "" }, { "docid": "bd4127a8901f54a858df3cf73b29e0fa", "score": "0.51779747", "text": "def index\n page = params[:page] || 1\n @metric_speedtests = MetricSpeedtest.page(page)\n end", "title": "" }, { "docid": "5e142eaa20cab679e39f03ccdfd9f087", "score": "0.51748246", "text": "def incident_list(statuspage_id)\n request :method => :get,\n :url => @url + 'incident/list/' + statuspage_id\n end", "title": "" }, { "docid": "34566e6d696f5c11ee4fa437f9a5fed6", "score": "0.51746196", "text": "def get_page_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PublicPerformanceApi.get_page ...'\n end\n # resource path\n local_var_path = '/cms/v3/performance/'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'domain'] = opts[:'domain'] if !opts[:'domain'].nil?\n query_params[:'path'] = opts[:'path'] if !opts[:'path'].nil?\n query_params[:'pad'] = opts[:'pad'] if !opts[:'pad'].nil?\n query_params[:'sum'] = opts[:'sum'] if !opts[:'sum'].nil?\n query_params[:'period'] = opts[:'period'] if !opts[:'period'].nil?\n query_params[:'interval'] = opts[:'interval'] if !opts[:'interval'].nil?\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'end'] = opts[:'_end'] if !opts[:'_end'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'PublicPerformanceResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth2']\n\n new_options = opts.merge(\n :operation => :\"PublicPerformanceApi.get_page\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PublicPerformanceApi#get_page\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "9c4d3041824ad1dab934f39f1161b3b6", "score": "0.51742774", "text": "def get\n check_response( @httpcli.get(@endpoint) )\n end", "title": "" }, { "docid": "f4659d7b6c3fc32280dd92e1d49d168d", "score": "0.5167516", "text": "def http_get_early(request, response)\n params = request.query_parameters\n return http_get(request, response) if params['sabreAction'] == 'info'\n end", "title": "" }, { "docid": "bc2586396ad5dabf2de8960e8465a809", "score": "0.5165992", "text": "def speed\n self.class.get(\"/get/speed\").to_i\n end", "title": "" }, { "docid": "cffea7ce2cb178f03785989ff091db1c", "score": "0.5157114", "text": "def get_productivity_stats()\n @client.api_helper.get_response(Config::TODOIST_COMPLETED_GET_STATS_COMMAND, {})\n end", "title": "" }, { "docid": "075b0361f4c36f71a3747b9d99073056", "score": "0.5155465", "text": "def get_json_stats_from(ip, port)\n Net::HTTP.start(ip, port) {|http| http.get('/stats.json') }.body rescue \"{}\"\nend", "title": "" }, { "docid": "5f237b28351f5b278416a3d66a71bf66", "score": "0.5145437", "text": "def performance(id)\n request_query = { 'iPerf_no' => id.to_s, 'iModeOfSale' => '10' }\n response = self.class.get(performance_detail_path, query: request_query)\n\n case response.code\n when 200 then Performance.new(response.body)\n else false\n end\n end", "title": "" }, { "docid": "26bfaaaeacb1b1c622397672b58e4e41", "score": "0.5143601", "text": "def stats\n _get(\"/system/stats\") { |json| json }\n end", "title": "" }, { "docid": "45cda18271a765539b30c0a7cd5a76d8", "score": "0.5137748", "text": "def get_perf_data(host, perf_start, perf_end)\n @logger.perf_output(\"Getting perf data for host: \" + host)\n if PERF_SUPPORTED_PLATFORMS.match?(host['platform']) # All flavours of Linux\n host.exec(Command.new(\"sar -A -s #{perf_start.strftime('%H:%M:%S')} -e #{perf_end.strftime('%H:%M:%S')}\"), :acceptable_exit_codes => [0, 1, 2]) if not @options[:collect_perf_data]&.include?('aggressive')\n if (defined? @options[:graphite_server] and not @options[:graphite_server].nil?) and\n (defined? @options[:graphite_perf_data] and not @options[:graphite_perf_data].nil?)\n export_perf_data_to_graphite(host)\n end\n else\n @logger.perf_output(\"Perf (sysstat) not supported on host: \" + host)\n end\n end", "title": "" }, { "docid": "387b5d9c8eed1eb27b66314ca1d7c8ff", "score": "0.512343", "text": "def index\n @cst_ipis = CstIpi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cst_ipis }\n end\n end", "title": "" }, { "docid": "cca27b60dde85138a5ba7a3fae200ad6", "score": "0.51223296", "text": "def find_perf( path )\n perfs[path]\n end", "title": "" }, { "docid": "02186f40c5e888e421f84bd55069c587", "score": "0.5102932", "text": "def show\n @threat = Threat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @threat }\n end\n end", "title": "" }, { "docid": "950fb8b671b17ac05fb0d817540763e2", "score": "0.50966686", "text": "def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end", "title": "" }, { "docid": "c66fcf1207fd525f01faed86c90bbd44", "score": "0.5089897", "text": "def GETCall url\n \n a = Time.now.to_f\n \n uri = URI.parse url\n \n http = Net::HTTP.new(uri.host,443)\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.use_ssl = true if uri.scheme == 'https'\n req = Net::HTTP::Get.new uri.path\n response = http.request req\n code = response.code.to_f.round\n body = response.body\n \n b = Time.now.to_f\n c = ((b-a)*100).round.to_f/100\n \n final = {code: code}\n final = final.merge(body: body)\n final = final.merge(time: c)\n \n final\n \n end", "title": "" }, { "docid": "3f868a10df9ad8690d5fd66b18b22793", "score": "0.50874215", "text": "def http_get(path)\n http_methods(path, :get)\n end", "title": "" }, { "docid": "bac572d5edae6cb03c1128f086fe7f1e", "score": "0.5082657", "text": "def get_metrics\n {\n method: \"Performance.getMetrics\"\n }\n end", "title": "" }, { "docid": "34dfc5f6aa0d9315fa1aaa7389485a1b", "score": "0.5075499", "text": "def request(method, args = {})\n uri = self.class.url_for_request(method, args)\n response = nil\n begin\n timed_out = Timeout::timeout(@timeout) do\n puts \"DEBUG: requesting #{uri}\" if @debug\n response = Net::HTTP.get_response(uri)\n puts response.body if @debug\n end\n rescue Timeout::Error\n raise Timeout::Error, \n \"Catalogue of Life didn't respond within #{timeout} seconds.\"\n end\n Nokogiri::XML(response.body)\n end", "title": "" }, { "docid": "c1734e923169b1842a28754ecd732117", "score": "0.5072898", "text": "def get_channnel_xml( url )\n path = url.sub(/http:\\/\\/gdata\\.youtube\\.com/,'')\n xml = \"\"\n\n Net::HTTP.version_1_2\n Net::HTTP.start(\"#{@url}\", \"#{@port}\") do |http|\n response = http.get(\"/#{path}\")\n xml = response.body\n end\n\n return xml\n end", "title": "" }, { "docid": "aa6a2bc55467101dca48753a2323abe9", "score": "0.5069833", "text": "def get(options = {})\n @response_xml = options[:cache_file] ? File.read(options[:cache_file]) : http_get(options)\n response = Response.parse(response_xml, options) do | inner_response, elements |\n parse_reports(inner_response, elements)\n end\n response.response_items.first # there is is only one\n end", "title": "" }, { "docid": "7a6e5e8af45774d03df7ea3cfb47ae86", "score": "0.50672054", "text": "def api_call(url_string)\n uri = URI.parse(url_string)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n http.read_timeout = get_param(:timeout)\n #todo use JSON calls where available vs xml\n if get_param(:action_name)=='ADMIN'\n xstring = Nokogiri::XML(open(url_string))\n else\n response = http.request(request)\n puts \"Response: #{response.code} #{response.message} #{response.class.name}\"\n puts \"#{request}\"\n end\n end", "title": "" }, { "docid": "f9de12c6e56f009b3b6e93c0098b522f", "score": "0.50577784", "text": "def show\n @probe = Probe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @probe }\n end\n end", "title": "" }, { "docid": "1958c4fa0357ecb2abedb070ffd2e00f", "score": "0.50512296", "text": "def show\n @tps_report = TpsReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tps_report }\n end\n end", "title": "" }, { "docid": "9d4a27a7b2ed4d844162111f1a1729a5", "score": "0.50498515", "text": "def get; end", "title": "" }, { "docid": "3db8265df41f25129a2ea305528d0689", "score": "0.5045728", "text": "def show\n# @probe_types = ProbeType.find(params[:id])\n @probe_types = ProbeType.paginate :page => params[:page]\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @probe_type.to_xml }\n end\n end", "title": "" }, { "docid": "4cdbc0041898bade8b1a0997795e58ce", "score": "0.50440294", "text": "def show\n @tstat = Tstat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tstat }\n end\n end", "title": "" }, { "docid": "1000e22f01e537b33459a2093651bd63", "score": "0.5038475", "text": "def call\n url = URI(WIKI_URL)\n res = Net::HTTP.get_response(url)\n content = parsed_page_content(res)\n\n parse_procedures(content)\n end", "title": "" }, { "docid": "3264c166704dd672ee9ad3b9a06d1dc2", "score": "0.5035401", "text": "def get_request(hash=true)\n resp = RestClient.get get_url\n hash ? Hash.from_xml(resp).it_keys_to_sym : resp\n end", "title": "" }, { "docid": "71d2a677a83a573722bb7924c18b2f02", "score": "0.50286055", "text": "def requests_get\n @attributes[:requests_get]\n end", "title": "" }, { "docid": "ec76e5a8cc73eeea3840180e3729edc7", "score": "0.50259054", "text": "def _get\n http_method(:get)\n end", "title": "" }, { "docid": "4d8afff9d3d3c31e28eeee89279c0b9d", "score": "0.5023862", "text": "def index\n @provider_stats = ProviderStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @provider_stats }\n end\n end", "title": "" }, { "docid": "2b43b5222aaa31e268c7e04786ef6065", "score": "0.5021953", "text": "def index\n @visit_stats = VisitStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @visit_stats }\n end\n end", "title": "" }, { "docid": "6c5f1a6e8965b98b2fb2a803f393a7d8", "score": "0.5019589", "text": "def print_perf_info\n @perf_end_timestamp = Time.now\n @hosts.map { |h| get_perf_data(h, @perf_timestamp, @perf_end_timestamp) }\n end", "title": "" }, { "docid": "eb82161341289d6d77919d05be533ac3", "score": "0.5015853", "text": "def show\n @st_ipi = StIpi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @st_ipi }\n end\n end", "title": "" }, { "docid": "1a051228b0f14922957d38602d91ff2e", "score": "0.5012711", "text": "def show\n @tourist_sight = TouristSight.find(params[:id])\n @evaluations = @tourist_sight.evaluations(params[:page])\n @average = @tourist_sight.evaluation_average\n\t\t@city = @tourist_sight.city\n\t\t@tips = @tourist_sight.tips(params[:page_tips])\n\t\t@tourist_sight.increase_hits\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tourist_sight }\n end\n end", "title": "" }, { "docid": "395a32b0d6cefbb44d8fe1f82e67717a", "score": "0.5011744", "text": "def pivotal_tracker(server)\n clnt = HTTPClient.new\n clnt.get(server[:url], nil, { \"X-TrackerToken\" => server[:token] })\nend", "title": "" }, { "docid": "eb06694939e268e76f76291de57ad8e1", "score": "0.50116223", "text": "def to_get_request\n 'get_%ss' % api_name\n end", "title": "" }, { "docid": "9cf512de1dd325410445f121dceb26fb", "score": "0.5010179", "text": "def index\n @performances = Performance.all\n end", "title": "" }, { "docid": "11fd09e378aa1b40da53ed319f2c8f67", "score": "0.5007645", "text": "def info\n IbmCloudRest.get \"#{@uri}/\"\n end", "title": "" }, { "docid": "b543d171b45eb09d8827bc2fcc904f89", "score": "0.50046384", "text": "def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend", "title": "" }, { "docid": "b1ac5d0b2adb1666f9b0f2fb6e0058ab", "score": "0.5003366", "text": "def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end", "title": "" }, { "docid": "b1ac5d0b2adb1666f9b0f2fb6e0058ab", "score": "0.5003366", "text": "def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end", "title": "" }, { "docid": "76308ac57fb8027d690c39aaaf89a5f8", "score": "0.499733", "text": "def get(url); end", "title": "" }, { "docid": "7d4f4b85adaf14cefa6ec2afabd65b7f", "score": "0.4995643", "text": "def show\n @questions = CareerAdvisorWebServices.new(\"\",\"\").get_short_form_ip\n # @questions = OnetWebService.new(\"arwins\",\"9436zfu\").get_interest_profiler_questions_60(1,60)\n end", "title": "" }, { "docid": "c76681244f9fbfcb610aad9868a722ef", "score": "0.49926046", "text": "def show\n @visit_stat = VisitStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @visit_stat }\n end\n end", "title": "" }, { "docid": "31b3927df33c3d15a1f0f548ef040a18", "score": "0.4992534", "text": "def get(url = \"/api/system/info\")\n url = File.join(@client.url, url)\n request = Typhoeus::Request.new(url,\n method: :get,\n headers: headers,\n ssl_verifypeer: @client.ssl_verify_peer?,\n cookiefile: cookie_file_path, # read from\n cookiejar: cookie_file_path, # write to\n userpwd: [@client.user, @client.password].join(\":\"))\n request.run\n request.response\n end", "title": "" }, { "docid": "4f947e7f344b775e07e67240a3336e5d", "score": "0.49923128", "text": "def show\n @reqinfo = Reqinfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end", "title": "" }, { "docid": "44ff88a92cd0b6e5c8c8297fe6e31bb5", "score": "0.49920154", "text": "def info\n get(\"/api-info\")\n end", "title": "" }, { "docid": "ca8db9cf23f7ab266de226165db081a0", "score": "0.49898943", "text": "def show\n @performance_test = PerformanceTest.find(params[:id])\n # @performance_test_results = @performance_test.performance_test_results\n @performance_test_results = PerformanceTestResult.show_query(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @performance_test }\n end\n end", "title": "" }, { "docid": "6020e5c3ad89286bf3898b1bc53fe59a", "score": "0.49888003", "text": "def show\n @discovery = Discovery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "title": "" }, { "docid": "e871b1a53a996ea4a014753a8d9cba0f", "score": "0.4987495", "text": "def get(path, data = {})\n # Allow format override\n format = data.delete(:format) || @format\n # Add parameters to URL query string\n get_params = {\n :method => \"get\", \n :verbose => DEBUG\n }\n get_params[:params] = data unless data.empty?\n # Create GET request\n get = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", get_params)\n # Send request\n do_request(get, format, :cache => true)\n end", "title": "" }, { "docid": "6b257385bf9d9db248989aa5c9050251", "score": "0.49871492", "text": "def service_description\n resp = http.resource(service_descriptor_href).get(:accept => 'application/vnd.absolute-performance.sysshep+json')\n JSON.parse(resp.body)\n end", "title": "" }, { "docid": "f2cf035112144f14f97f99d1bcbd50ad", "score": "0.49837524", "text": "def show\n @pfs_consultation = PfsConsultation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pfs_consultation }\n end\n end", "title": "" }, { "docid": "fc16027d2aa0ece40db4ee6c1776b796", "score": "0.49806854", "text": "def probe(url)\n # @todo Create args options Hash to dynamically configure settings.\n raise ArgumentError.new, \"Incorrect number of arguments: expected 1.\" if url.nil? \n\n # Associate argument with @uri element tag for future logging purposes.\n # Will also serve for faster clash checking (aka w/o DBMS)\n url = URI.parse(url)\n @uri = url\n\n #Create NET::HTTP request to the specified IP\n http = Net::HTTP.new(url.host, url.port)\n http.read_timeout, http.open_timeout = 3\n \n request = Net::HTTP::Get.new(url)\n request['User-Agent'] = \"Gerridae Gem\"\n request['Accept'] = \"*/*\"\n \n # Gather response, switch code to string, add it to content hash.\n response = http.request(request)\n code = response.code.to_s \n @content[:return_code] = code\n\n\n # todo Abstract to own method within Helpers module.\n if Helpers::is_good_http_response? code.to_i \n @content = { :http_version => response.http_version, :message => response.message }\n\n # @todo Use JSON parsing method here\n response.each do |key, value|\n @content[key.to_sym] = value unless key.nil? && value.nil? \n end\n #todo Return HTTP code to indicate success.\n end\n #todo Return nil or other failure indicator for failure.\n\n end", "title": "" }, { "docid": "721a89f95038147d9191d5ec3768f778", "score": "0.49744284", "text": "def gethashespersec\n @api.request 'gethashespersec'\n end", "title": "" }, { "docid": "f96893dcb16db323d58d8fbcae754238", "score": "0.49696836", "text": "def stats\n @stats = time_data SolarReading.all\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: time_data(SolarReading.all, :hash), callback: params[:callback] }\n format.xml { render xml: time_data(SolarReading.all, :hash) }\n end\n end", "title": "" }, { "docid": "872bd975d172a20784f4cf6c81c34249", "score": "0.49695116", "text": "def get(params={})\n rpc_call :get, params\n end", "title": "" }, { "docid": "bc4b150605e1e45d51334eda81dd6da4", "score": "0.49623635", "text": "def getXMLTicket(path)\n resp2 = @@conn.get do |req|\n req.url path\n req.headers['Authorization'] = 'Basic aHIuc2VsbGVydEBnbWFpbC5jb206c2VzMTEy' #@TODO make this a param\n req.headers['Content-Type'] = 'application/xml'\n end\n # puts \"Responce : \" + resp2['body'].inspect\n # puts \"Responce2 : \" + resp2.body.to_s()\n \n return resp2.body.to_s()\n end", "title": "" }, { "docid": "18a3ee08894450b079b781a804601c03", "score": "0.49621165", "text": "def info\n _get(\"/query/dataleaks/info\") { |json| json }\n end", "title": "" }, { "docid": "3a18feea69231f7388fd2a60528afe5a", "score": "0.49616304", "text": "def show\n @services_charger = ServicesCharger.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @services_charger }\n end\n end", "title": "" } ]
9d90a9110782d22af47750be92de1285
Returns a list of visible notes
[ { "docid": "215ecedb2aacf813f46f8a99d5d503c7", "score": "0.68945974", "text": "def visible_notes\n user = params.permit(:latitude, :longitude)\n center = Geokit::LatLng.new(user[:latitude], user[:longitude])\n render json: GeoNote.within(base_radius, units: :meters, origin: center).all.select{|geonote| not is_treasure(geonote)}\n end", "title": "" } ]
[ { "docid": "ca92948ffcf07b788b2b98a9db173a6e", "score": "0.67997223", "text": "def visible_collapsed_note_ids\n els = browser.find_elements(xpath: '//div[contains(@id, \"note-\")][contains(@id, \"-is-closed\")]')\n els.map do |el|\n parts = el.attribute('id').split('-')\n (parts[2] == 'is') ? parts[1] : parts[1..2].join('-')\n end\n end", "title": "" }, { "docid": "2ab2a5c7ca73f821a700c2e53c3b3461", "score": "0.6762028", "text": "def list_notes\n notes = if unsafe_params[:editable]\n Note.editable_by(@context).where.not(title: nil).accessible_by_private\n else\n Note.accessible_by(@context).where.not(title: nil)\n end\n\n if unsafe_params[:scopes].present?\n check_scope!\n notes = notes.where(scope: unsafe_params[:scopes])\n end\n\n if unsafe_params[:note_types].present?\n fail \"Param note_types can only be an Array of Strings containing 'Note', 'Answer', or 'Discussion'\" unless unsafe_params[:note_types].is_a?(Array) && unsafe_params[:note_types].all? { |type| %w(Note Answer Discussion).include?(type) }\n\n note_types = unsafe_params[:note_types].map { |type| type == \"Note\" ? nil : type }\n notes = notes.where(note_type: note_types)\n end\n\n result = notes.order(id: :desc).map do |note|\n if note.note_type == \"Discussion\"\n note = note.discussion\n elsif note.note_type == \"Answer\"\n note = note.answer\n end\n describe_for_api(note, unsafe_params[:describe])\n end\n\n render json: result\n end", "title": "" }, { "docid": "de2d396a17cc37b8d623aebe405c4bdb", "score": "0.67270595", "text": "def notes\n\t\tNote.find(:all)\n\tend", "title": "" }, { "docid": "fb1acbc3a63dda2af1b8b373b066615b", "score": "0.6468744", "text": "def index\n @notes_lists = @note.notes_lists.all\n end", "title": "" }, { "docid": "8519140cea6d82fc6ae13132bbf09d61", "score": "0.64671725", "text": "def notes\n return @notes\n end", "title": "" }, { "docid": "8519140cea6d82fc6ae13132bbf09d61", "score": "0.64671725", "text": "def notes\n return @notes\n end", "title": "" }, { "docid": "8519140cea6d82fc6ae13132bbf09d61", "score": "0.64671725", "text": "def notes\n return @notes\n end", "title": "" }, { "docid": "8519140cea6d82fc6ae13132bbf09d61", "score": "0.64671725", "text": "def notes\n return @notes\n end", "title": "" }, { "docid": "8c1b129fca69c5ddf61a8cb545b9cafb", "score": "0.6463004", "text": "def notes\n @notes\n end", "title": "" }, { "docid": "347694fb97b33aab3bc86abf78fe8094", "score": "0.64478815", "text": "def show_notes\n logger.info 'Checking notes tab'\n wait_for_update_and_click notes_button_element\n wait_for_update_and_click show_hide_notes_button_element if show_hide_notes_button? && show_hide_notes_button_element.text.include?('Show')\n end", "title": "" }, { "docid": "d8d01189c3c96719ad619926ef2bee53", "score": "0.644777", "text": "def notes\n notes_range.to_a.map(&:to_s)\n end", "title": "" }, { "docid": "1b8013903bb453269825a77770e26973", "score": "0.6438969", "text": "def note\n comment_list = []\n return @notes if [email protected]?\n for page in @pages\n next if !page || !page.list || page.list.size <= 0\n note_page = page.list.dup\n \n note_page.each do |item|\n next unless item && (item.code == 108 || item.code == 408)\n comment_list.push(item.parameters[0])\n end\n end\n @notes = comment_list.join(\"\\r\\n\")\n return @notes\n end", "title": "" }, { "docid": "8035c90eba633a7f5328af9b47b05527", "score": "0.6433584", "text": "def notes\n return Note.find(:all, :conditions => [\"type_id = ? AND owner = ?\", self.id, :property ])\n end", "title": "" }, { "docid": "a042ff59795604858c4378fcb6fe966f", "score": "0.6386212", "text": "def note_contents\n self.notes.map(&:content)\n end", "title": "" }, { "docid": "a042ff59795604858c4378fcb6fe966f", "score": "0.6386212", "text": "def note_contents\n self.notes.map(&:content)\n end", "title": "" }, { "docid": "310ea9fad9d7510ef0db35a80d551fbe", "score": "0.6298132", "text": "def filter_for_restricted_notes(current_educator, params)\n authorization = current_educator.can_view_restricted_notes?\n intention = (params.fetch(:include_restricted_notes, 'false').downcase == 'true')\n if authorization && intention\n [true, false]\n else\n [false]\n end\n end", "title": "" }, { "docid": "daac3d252e14d22b69d2454b4dffa12c", "score": "0.6274679", "text": "def note_contents\n self.notes.collect {|note| note.content }\n end", "title": "" }, { "docid": "39757d754f979c4ab775e746727e79c2", "score": "0.6272954", "text": "def index\n @internal_notes = InternalNote.all\n end", "title": "" }, { "docid": "837df9ea7b5447bf94927b839ca39848", "score": "0.6244655", "text": "def note_contents\n self.notes.each.map{|note| note.content}\n end", "title": "" }, { "docid": "d74d2752ee1f2e18dbddc7189548be07", "score": "0.624202", "text": "def note_contents\n self.notes.collect {|note| note.content}\n end", "title": "" }, { "docid": "7ff2283ecf395a76bf2a80d80fde5290", "score": "0.6217843", "text": "def notes_show_formatted\n Observation.show_formatted(notes)\n end", "title": "" }, { "docid": "babd7d5d23011569a343fba7323954d8", "score": "0.6214242", "text": "def index\n @notes = Note.where(published_state:true)\n end", "title": "" }, { "docid": "1bd42502ceaec4a6ea732b3e7d3adddc", "score": "0.6195672", "text": "def list\n\t\t@notes = Note.where(topic: params[:topic])\n\tend", "title": "" }, { "docid": "58f87ff6b2988047424405acad6609e9", "score": "0.61567825", "text": "def show\n horse = set_horse\n @notes = horse.notes.paginate(:page => params[:page], :per_page => 20).order('created_at DESC')\n end", "title": "" }, { "docid": "eed6cdaf6f34d3533e4891554454f9db", "score": "0.61478204", "text": "def show\n @notes = @bookmark.notes\n end", "title": "" }, { "docid": "b95cb38df6bec6952805f2be4c3d65bb", "score": "0.61411905", "text": "def visible_journals_with_index(user=User.current)\n result = journals.\n preload(:details).\n preload(:user => :email_address).\n reorder(:created_on, :id).to_a\n\n result.each_with_index {|j,i| j.indice = i+1}\n\n unless user.allowed_to?(:view_private_notes, project)\n result.select! do |journal|\n !journal.private_notes? || journal.user == user\n end\n end\n\n Journal.preload_journals_details_custom_fields(result)\n result.select! {|journal| journal.notes? || journal.visible_details.any?}\n result\n end", "title": "" }, { "docid": "124db484a0c5a8f96feeb1b0420857dd", "score": "0.6140282", "text": "def note_contents\n self.notes.collect do |note|\n note.content\n end\n end", "title": "" }, { "docid": "24b11e6a82a28b1e35b65ad7dc12f3c1", "score": "0.6108234", "text": "def index\n @personal_notes = Note.where(:user_id => current_user.id)\n @public_notes = Note.where(:isPublic => true).where.not(:user_id => current_user.id)\n @shared_notes = Note.where(:id => NotesUser.where(:user_id => current_user.id).select(:note_id))\n #@notes = Note.all\n end", "title": "" }, { "docid": "c0d198cf4116c6da48e61761ba608e28", "score": "0.6092356", "text": "def list_notes(identifier, opts = {})\n data, _status_code, _headers = list_notes_with_http_info(identifier, opts)\n return data\n end", "title": "" }, { "docid": "45b65b9feb61e5c6b8067491aabd047d", "score": "0.60784465", "text": "def show_notes\n info \"showing notes\"\n res = run(\"git notes --ref #{refname} show\")\n if res[:val] == 0\n info \"existing note: #{res[:out].strip}\"\n else\n info \"no existing note\"\n end\n end", "title": "" }, { "docid": "c9ad4b90c6ce202713e61ba5893b61f0", "score": "0.6065119", "text": "def starred_notes\n fetch_notes_for nil, true\n end", "title": "" }, { "docid": "b60fae8b082068e100b9ce335892db4a", "score": "0.6061346", "text": "def notes_chronologically\n notes.in_order\n end", "title": "" }, { "docid": "f217d8297d749e9a246f64c0f457dd7c", "score": "0.604352", "text": "def all_notes\n self.has_notes? ? self.annotations.map {|n| n.body }.join(' ') : '' \n end", "title": "" }, { "docid": "9724cd427c999478a08c37a00ce68935", "score": "0.60215414", "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": "bf521b5955a6a7748df7dd30e3095585", "score": "0.60199165", "text": "def show_all_notes(db)\n notes = server.get_index\n notes.each do |note|\n note = server.get_note(note[\"key\"])\n show_note(note)\n end\nend", "title": "" }, { "docid": "98a2a059a7705194da233c22ecb99380", "score": "0.60114413", "text": "def index\n @user_has_notes = UserHasNote.all\n end", "title": "" }, { "docid": "6186805668097a695d0e1e35849158f3", "score": "0.6006792", "text": "def notebook\n @pagy, @private_notes = pagy(PrivateNote.where(user: current_user).order(created_at: :desc), items: 5)\n authorize @private_notes\n end", "title": "" }, { "docid": "adfd0ac6b68354046631932adcd78cc4", "score": "0.5975997", "text": "def show_all_notes_db(db)\n db.all_notes.select { |note| !note[\"deleted\"] }\n .each { |note| show_note(note) }\nend", "title": "" }, { "docid": "149b8192b66d57e9b99e9695f8283118", "score": "0.5968405", "text": "def index\n @pagy, @private_notes = pagy(PrivateNote.order(created_at: :desc), items: 25)\n authorize @private_notes\n end", "title": "" }, { "docid": "eb3dde962a48d03f4836a403b3a9878b", "score": "0.5968175", "text": "def index\n @notebook_notes = Notebook::Note.all\n end", "title": "" }, { "docid": "84390418c7fce0d9a8c0720653ef255f", "score": "0.5966837", "text": "def get_notes(opts = {})\n data, status_code, headers = get_notes_with_http_info(opts)\n return data\n end", "title": "" }, { "docid": "eb97e153260dd16cc3a81d276faad3fa", "score": "0.596213", "text": "def show_notifications # :norobots:\n pass_query_params\n data = []\n @observation = find_or_goto_index(Observation, params[:id].to_s)\n return unless @observation\n name_tracking_emails(@user.id).each do |q|\n fields = [:naming, :notification, :shown]\n naming_id, notification_id, shown = q.get_integers(fields)\n next unless shown.nil?\n notification = Notification.find(notification_id)\n if notification.note_template\n data.push([notification, Naming.find(naming_id)])\n end\n q.add_integer(:shown, 1)\n end\n @data = data.sort_by { rand }\n end", "title": "" }, { "docid": "e719160fb2d547d4f3906df8c9e8145f", "score": "0.5955568", "text": "def index\n @notes = Note.all\n end", "title": "" }, { "docid": "e719160fb2d547d4f3906df8c9e8145f", "score": "0.5955568", "text": "def index\n @notes = Note.all\n end", "title": "" }, { "docid": "e719160fb2d547d4f3906df8c9e8145f", "score": "0.5955568", "text": "def index\n @notes = Note.all\n end", "title": "" }, { "docid": "e719160fb2d547d4f3906df8c9e8145f", "score": "0.5955568", "text": "def index\n @notes = Note.all\n end", "title": "" }, { "docid": "e719160fb2d547d4f3906df8c9e8145f", "score": "0.5955568", "text": "def index\n @notes = Note.all\n end", "title": "" }, { "docid": "60f15eb1a33dbafd4d6febde5ad6817d", "score": "0.59229285", "text": "def index\n #@notes = Note.all\n @notes = current_user.notes\n end", "title": "" }, { "docid": "0bd545f16a01ef5497ef8a0c7c0e9a44", "score": "0.59226745", "text": "def notes\n @data[:notes]\n end", "title": "" }, { "docid": "3b2fc97eb98fdb17477ee93efd36b6ef", "score": "0.5914978", "text": "def collection\n return @client.api_helper.collection(\"notes\")\n end", "title": "" }, { "docid": "d6159980597cccf9e16f1615fcc20e8a", "score": "0.5912894", "text": "def notes_within(ivp_x, ivp_y, ivp_width, ivp_height)\n vp_x = ivp_x.to_i\n vp_y = ivp_y.to_i\n vp_width = ivp_width.to_i\n vp_height = ivp_height.to_i\n\n # Get appropriate notes:\n vp_notes_strict = self.notes.find(:all, :readonly => true, :conditions => \n [\"(x+width) >= ? AND x <= ? AND (y+height) >= ? AND y <= ?\",\n vp_x, vp_x+vp_width, vp_y, vp_y+vp_height\n ]\n )\n\n # Add notes with direct links to viewport notes\n vp_notes = vp_notes_strict.clone\n vp_notes_strict.each do |n|\n\n # See if the note has any unadded sources\n n.edges_to.each do |e|\n # .. by checking the original\n testnote = Note.find(e.source_note.id)\n if !vp_notes_strict.include?(testnote)\n # Add the source note\n vp_notes.push(testnote)\n end\n end\n\n # Same for outgoing edges\n n.edges_from.each do |e|\n testnote = Note.find(e.target_note.id)\n if !vp_notes_strict.include?(testnote)\n vp_notes.push(testnote)\n end\n end\n end\n\n return vp_notes\n end", "title": "" }, { "docid": "fedcb899bf7a163ce0e9231af1c1ec3e", "score": "0.588079", "text": "def notes params=nil\n @nimble.get \"contact/#{self.id}/notes\", params\n end", "title": "" }, { "docid": "1b667f6f26831ed84d52a6742bc25bc7", "score": "0.5873397", "text": "def index\n @sticky_notes = StickyNote.all\n end", "title": "" }, { "docid": "077086131fee62b038dc117cb2036e66", "score": "0.58662564", "text": "def notes\n\t\tall.map do |tone|\n\t\t\tKey.from_index(tone.tone, tone.letter_index).name\n\t\tend.extend(NoteSequence)\n\tend", "title": "" }, { "docid": "dd7c5a487a5d185cf1957ddb537bb2e3", "score": "0.58519447", "text": "def private_notes\n end", "title": "" }, { "docid": "e1d2e97b99ba68fcfc32439e74def41c", "score": "0.5850261", "text": "def notes(element_key)\n parameter = { basic_auth: @auth }\n\n response = self.class.get(\"/elements/#{element_key}/notes\", parameter)\n if response.success?\n search_response_header = SearchResponseHeader.new(response)\n search_response_header.elementList\n end\n end", "title": "" }, { "docid": "94e8cdb260f1d7b01cec584f0376c9ef", "score": "0.58376116", "text": "def show\n @notes = @hold.notes\n respond_with(@hold)\n end", "title": "" }, { "docid": "d2f548f910433a55de72a469064c46fa", "score": "0.58105916", "text": "def index\n respond_with Note.all\n end", "title": "" }, { "docid": "861ceb03d67be212ebdf2f2525665426", "score": "0.58004725", "text": "def evernote_note_titles\n Rails.cache.fetch(\"#{cache_key}/evernote_note_titles\", expires_in: 12.hours) do\n Evernote::NoteStoreExplorer.new(self).app_notes.map {|n| n.title}\n end\n end", "title": "" }, { "docid": "73795d12f0a27eab44028f80651da00a", "score": "0.57998383", "text": "def list\n # an oncases handler would be nice TODO\n# if !@permitted\n# render :action => :reserved\n# return\n# end\n @page = params[:page] # get @note_notes, @notes = paginate :notes, :per_note => 10 # paginate\n @show = params[:show] # ?show all,related,min,tree,local\n @style = params[:style] # ?style thumb,list\n @notes = nil\n @notes = @note.find_children if @note\n render :action => \"list\"\n end", "title": "" }, { "docid": "dbddbceedaafd8bfb82b6c94a7e3ae5e", "score": "0.57967114", "text": "def get_note_list\n note = queued_email_note\n note ? note.value.to_s.split(\",\") : nil\n end", "title": "" }, { "docid": "f22796a2375ff78f0fc66d2293d1ead4", "score": "0.5796636", "text": "def notes\n @attributes[:notes]\n end", "title": "" }, { "docid": "f22796a2375ff78f0fc66d2293d1ead4", "score": "0.5796636", "text": "def notes\n @attributes[:notes]\n end", "title": "" }, { "docid": "a312acaf0d16352ae2be38827bd4e96f", "score": "0.573268", "text": "def notes; end", "title": "" }, { "docid": "a312acaf0d16352ae2be38827bd4e96f", "score": "0.573268", "text": "def notes; end", "title": "" }, { "docid": "a312acaf0d16352ae2be38827bd4e96f", "score": "0.573268", "text": "def notes; end", "title": "" }, { "docid": "b025d4c95ed03cb093719511dba98f4a", "score": "0.57253146", "text": "def index\n @notes = current_user.notes.paginate(:page => params[:page])\n end", "title": "" }, { "docid": "5c38ef20aeb245f39a801a8f0fc11645", "score": "0.5720135", "text": "def notes(wspace=workspace)\n\t\twspace.notes\n\tend", "title": "" }, { "docid": "094e0bbc2e95cfa18fa842b9382a27dd", "score": "0.57185626", "text": "def character_notes\n self.object.character_notes.map do |note|\n {\n c_note_id: note.id,\n c_note_title: note.title,\n c_note_content: note.content,\n visible_to_other_players: note.visible_to_other_players,\n amount_spent: note.amount_spent,\n amount_earned: note.amount_earned\n }\n end\n end", "title": "" }, { "docid": "f19efcada8120b00bf0fb31838c2b6de", "score": "0.5717686", "text": "def notes( params={} )\n notes = get_connections(\"notes\", params)\n return map_connections notes, :to => Facebook::Graph::Note\n end", "title": "" }, { "docid": "dc6756a9c1cf8cf1c2d76a68b9faf1fb", "score": "0.5710378", "text": "def list_case_notes\n\t\t@case_notes = CaseNote.where(case_id: params[:case_id])\n\tend", "title": "" }, { "docid": "25b579a7c88dd952adf756758056d26a", "score": "0.5709849", "text": "def index\n @textnotes = Textnote.all\n end", "title": "" }, { "docid": "7cf69ecb11ebebf2a0007d4ab4cd33f4", "score": "0.56997114", "text": "def notes(params = {})\n @notes ||= MailchimpAPI::Note.find(:all, params: { member_id: id }.deep_merge(prefix_options).deep_merge(params))\n end", "title": "" }, { "docid": "68d8bb22afe5002e20ab1c04162bf301", "score": "0.5698031", "text": "def visible\n lines.map { |line| line[ox...(ox + bordered_width)] || '' }\n end", "title": "" }, { "docid": "14e28e2a21e8f9db9f8fdd0dcec36018", "score": "0.5684265", "text": "def get_your_bottles\n bottles = get_bottles\n your_bottles = bottles.map do |bottle|\n # if user_id == viewer_id, the entry is private and should not be displayed alongside bottles\n if bottle.is_read && bottle.user_id != bottle.viewer_id\n bottle\n end\n end\n return your_bottles.compact\n end", "title": "" }, { "docid": "6bc7f805f780d2f2282940302df19592", "score": "0.5672146", "text": "def private_notes\n \n end", "title": "" }, { "docid": "28d6c38ae76595aa1872d77c2547aa74", "score": "0.56559145", "text": "def notes\n Notes.new(self)\n end", "title": "" }, { "docid": "1a0290a3dbf290265b7572163c6e0567", "score": "0.5651292", "text": "def notes\n @sponsorship_level = SponsorshipLevel.find(params[:id])\n @notes = @sponsorship_level.notes.includes(:author).search_sort_paginate(params, :parent => @sponsorship_level)\n end", "title": "" }, { "docid": "a6d34aa1dd64db382d2b756619d6d97f", "score": "0.5637297", "text": "def notes\n run(helm('get', 'notes', name))\n end", "title": "" }, { "docid": "f4f8d7766c93570191f0213737284b22", "score": "0.56338763", "text": "def visible_documents\n permissions = self.permissions.find(:all, \n :conditions => [\"controller = ? AND action = ?\", \"documents\", \"show\"])\n ids = permissions.collect{|p| p.subject_id}\n Document.find(:all, :conditions => {:id => ids||[]})\n end", "title": "" }, { "docid": "64513264a28a9cc37d5ff7e25723b9b3", "score": "0.56216127", "text": "def all_items( hidden = false )\r\n\t\t\tresults = []\r\n\t\t\[email protected] do\r\n\t\t\t\t|item|\r\n\t\t\t\tif ( item.hidden == true && hidden == true ) || ( item.hidden == false )\r\n\t\t\t\t\tresults << item.description \r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\treturn results\r\n\t\tend", "title": "" }, { "docid": "4967304987ab20f063c74092b7308925", "score": "0.5619184", "text": "def list(message)\n return if message.user.nick === ForrstBot::Bot.nick\n\n count = ForrstBot::Model::Note.filter(:user => message.user.nick).count\n\n if count > 0\n message.reply(\n \"You have #{count} note(s), speak in a channel I'm active in and \" \\\n + \"I'll send them to you.\",\n true\n )\n end\n end", "title": "" }, { "docid": "cd93b88f97fbbcd5bc8623ce259a376b", "score": "0.5597631", "text": "def index\n @communication_notes = CommunicationNote.all\n end", "title": "" }, { "docid": "a5807bcc153217fae0d05b6c36283c89", "score": "0.55946064", "text": "def non_archived_notes\n notes.select { |n| n.archived.blank? }.sort_by!(&:created_at)\n end", "title": "" }, { "docid": "0cfc449f69c290cf34ca296a5a37457b", "score": "0.5567853", "text": "def note_nodes\n nodes = Nokogiri::HTML.fragment(self.notes).children\n if nodes.size == 1\n content = Scrub.remove_surrounding(notes)\n Nokogiri::HTML.fragment(content).children\n else\n return nodes\n end\n end", "title": "" }, { "docid": "e8d9a667fb4b84fc2524312f3ffeb8fd", "score": "0.55584794", "text": "def filter_notes\n filters = []\n filters << {:re => /(https?:\\/\\/\\S+)/i, :sub => '<a href=\\1>\\1</a>'}\n filters << {:re => /\\brt:(\\d+)\\b/i, :sub => '<a href=https://apps.education.ucsb.edu/rt/Ticket/Display.html?id=\\1>rt:\\1</a>'}\n filters << {:re => /\\bwiki:([\\S\\(\\)_]+)/i, :sub => '<a href=http://wiki.education.ucsb.edu/\\1>wiki:\\1</a>'}\n filters << {:re => /#(\\S+)\\b/i, :sub => '<a href=/deezy/hosts?search[order]=&search[mac_or_ip_or_itgid_or_room_or_hostname_or_uid_or_notes_contains]=%23\\1>#\\1</a>'}\n\n @hosts = [@host] if @hosts == nil\n @hosts.each do |e|\n filters.collect { |f| e.notes.gsub! f[:re], f[:sub] }\n end\n end", "title": "" }, { "docid": "8f175e2d575b4ccce91e329840571412", "score": "0.55508983", "text": "def journal_notes\n css = \"Relationship[@Name='Incident has Notes']\" +\n \" BusinessObject[@Name=JournalNote]\"\n return @dom.css(css).map do |element|\n JournalNote.new(element.to_xml)\n end\n end", "title": "" }, { "docid": "817c70e489efd3cfb7043bb634d924ce", "score": "0.5543968", "text": "def note_attachment_els(note)\n spans = browser.find_elements(xpath: \"//li[contains(@id, 'note-#{note.id}-attachment')]//span[contains(@id, '-attachment-')]\")\n links = browser.find_elements(xpath: \"//li[contains(@id, 'note-#{note.id}-attachment')]//a[contains(@id, '-attachment-')]\")\n spans + links\n end", "title": "" }, { "docid": "fa09bba8ecb984140c2d56d36848cf3e", "score": "0.5534745", "text": "def index\n @property_notes = PropertyNote.all\n end", "title": "" }, { "docid": "712ac35506fbddfe9cb51688044fb3f7", "score": "0.5518276", "text": "def visible_aliases\n aliases.select { |a| !a[:hidden] }\n end", "title": "" }, { "docid": "cb1daf9891be0f86b342ccf330d630a7", "score": "0.5507931", "text": "def citations\n Footnote.where(noted_id: id).where(slug: '')\n end", "title": "" }, { "docid": "ff7814ef73fa6cc7e988fc4ef5536201", "score": "0.54975027", "text": "def get_unanswered_notes\n page = params[:page] || 1\n @notes = Note.find_all_unanswered(page)\n render :action => \"index\"\n end", "title": "" }, { "docid": "e81a06a062b6118a76b8970f4200261c", "score": "0.549207", "text": "def index\n @sr_notes = SrNote.all\n end", "title": "" }, { "docid": "2a4b9b1c20a5403dc375ea3c85cb4ba0", "score": "0.5489018", "text": "def cat\n unless encrypted_notes.empty?\n print_notes(:encrypted => true)\n decrypted_notes = @cipher.decrypt_files(encrypted_notes)\n end\n\n matching_notes.each do |note_path|\n contents = \\\n if FuzzyNotes::Cipher.encrypted?(note_path)\n decrypted_notes.shift\n elsif FuzzyNotes::EvernoteSync.evernote?(note_path)\n FuzzyNotes::EvernoteSync.sanitize_evernote(note_path)\n elsif FuzzyNotes::ImageViewer.image?(note_path)\n FuzzyNotes::ImageViewer.display(@viewer, note_path)\n else\n FuzzyNotes::TextViewer.read(note_path)\n end\n\n if contents\n log.info \"=== #{note_path} ===\\n\\n\"\n puts \"#{contents}\\n\"\n end\n end\n end", "title": "" }, { "docid": "f9dcfc05ab39c52954e7224bcd1c9f2c", "score": "0.54845846", "text": "def show\n @notifications = Notification.where(user: current_user).where(notification_obeject_id: params[:id]).where(read: false)\n @notifications.each do |note|\n note.read = true\n note.save\n end\n end", "title": "" }, { "docid": "0b335c34d5c964b2a4a873b006518a51", "score": "0.5479079", "text": "def index\n @pnotes = Pnote.all\n end", "title": "" }, { "docid": "f6fa6b270c643583df4c1478a0481de2", "score": "0.54762936", "text": "def visible_collapsed_note_data(note)\n subject_el = div_element(id: \"note-#{note.id}-is-closed\")\n date_el = div_element(id: \"collapsed-note-#{note.id}-created-at\")\n {\n :subject => (subject_el.attribute('innerText').gsub(\"\\n\", '') if subject_el.exists?),\n :date => (date_el.text.gsub(/\\s+/, ' ') if date_el.exists?)\n }\n end", "title": "" }, { "docid": "c39cb4c316f2298491506c68cf719e11", "score": "0.54646224", "text": "def show\n render json: @notes\n end", "title": "" }, { "docid": "bd35891728ab2421c3a2c3d0911da923", "score": "0.54619867", "text": "def index\n @voice_notes = VoiceNote.all\n end", "title": "" }, { "docid": "a342ee78769202cd6ea9bcd8a3473e43", "score": "0.54572934", "text": "def index\n @notes = Note.all\n \n respond_with(@notes)\n end", "title": "" } ]
7e790dc12bf740124ce3cd9291d2941c
Sets the attribute path
[ { "docid": "e0cd18bac032a42bea08e60c0698a868", "score": "0.0", "text": "def path=(_arg0); end", "title": "" } ]
[ { "docid": "1b1b78f85d5a7e4aa1409d535a3e894d", "score": "0.7495515", "text": "def path=(new_path)\n write_attribute path_field, new_path\n end", "title": "" }, { "docid": "2a53347d060952a7f5d8407b89087959", "score": "0.7032812", "text": "def attr_rw_path(*attrs)\n attrs.each do |attr|\n class_eval %Q{\n def self.#{attr}\n return @#{attr} if instance_variable_defined?(:@#{attr})\n @#{attr} = InheritableAttr.inherit_for(self, :#{attr})\n end\n\n def self.#{attr}=(value)\n @#{attr} = FPM::Cookery::Path.new(value)\n end\n\n def #{attr}=(value)\n self.class.#{attr} = value\n end\n\n def #{attr}(path = nil)\n self.class.#{attr}(path)\n end\n }\n end\n\n register_attrs(:path, *attrs)\n end", "title": "" }, { "docid": "d19e884d5dc885a1800b6662682bb7d8", "score": "0.6969312", "text": "def path=(v); self[:path]=v end", "title": "" }, { "docid": "dad6711306f71a69fd0a73a2b57b1103", "score": "0.69505537", "text": "def write_attribute path, attribute_name, value\n if is_new?\n @doc = create_empty\n end\n\n nodes = path.eval_xpath(@doc)\n if nodes.length == 0\n path.create(@doc)\n end\n nodes[0].set_attribute attribute_name, value\n end", "title": "" }, { "docid": "79ea307d52dea19923d85b5c97db5887", "score": "0.6932125", "text": "def []=(key, value)\n Path.setfattr(path, key, value)\n @attrs = nil # clear cached xattrs\n end", "title": "" }, { "docid": "d1ea65eb633d93826f551aaa28987ed4", "score": "0.6924406", "text": "def Path=(value)", "title": "" }, { "docid": "69befa55bb3374f05e5463f8630d6cc2", "score": "0.68549055", "text": "def path=(value)\n @path = value\n end", "title": "" }, { "docid": "69befa55bb3374f05e5463f8630d6cc2", "score": "0.68549055", "text": "def path=(value)\n @path = value\n end", "title": "" }, { "docid": "51eb596e29dc6d3c409441f7029c3398", "score": "0.6799578", "text": "def set_attribute(attribute_path, attribute_value)\n begin\n attribute_path_value = eval('node' + attribute_path)\n rescue NoMethodError\n # if the beginning of the attribute path not yet defined, this rescue is needed\n # to prevent an exception while attempting to retrieve the value on the node\n end\n if !attribute_path_value\n eval('node.default' + attribute_path + ' = attribute_value')\n end\nend", "title": "" }, { "docid": "622afac837e30ca3da6a795e53ede279", "score": "0.67843205", "text": "def path=(value)\n @path = value\n end", "title": "" }, { "docid": "622afac837e30ca3da6a795e53ede279", "score": "0.67843205", "text": "def path=(value)\n @path = value\n end", "title": "" }, { "docid": "811abf2378885f071392e8457a05b9de", "score": "0.6778402", "text": "def path= value\r\n value = value.to_s\r\n @attributes['path'] = value\r\n value.to_number\r\n end", "title": "" }, { "docid": "e409a9a8e91a74c564a9c61074261e71", "score": "0.6744041", "text": "def path=(path)\n Path.path = path\n end", "title": "" }, { "docid": "e075779827b749454b42c015d91223b6", "score": "0.67337036", "text": "def set_attributes_from_filename!(path)\n fail InvalidKeyError.new(path) if path.to_s[0] == '/'\n\n relative = directory.join(path.to_s).relative_path_from(directory)\n name = relative.basename.to_s.split('.', 2).first\n subdir = relative.dirname.to_s\n\n @subdirectory = subdir == NO_DIR ? nil : subdir\n\n self.key = name\n end", "title": "" }, { "docid": "675e688fd05433bda7926670c677b4da", "score": "0.6664244", "text": "def set_attr_value(xml, value)\n text = to_xml_text(value)\n @path.first(xml, ensure_created: true).text = text\n end", "title": "" }, { "docid": "081400e71d135523122119e846a808d6", "score": "0.6630183", "text": "def set_attribute(entities, path, attribute, value)\n dictionary_name = path.last\n entities.each{ |entity|\n dict = find_dictionary(entity, path, true)\n next warn(\"AttributeInspector: dictionary `#{path.inspect}` not found for entity #{entity}\") unless dict\n ent = dict.parent.parent # attribute_dictionary -> attribute_dictionaries -> entity\n ent.set_attribute(dictionary_name, attribute, value)\n }\n end", "title": "" }, { "docid": "b0221c10228ec6f6cdd87bbc7731ac0b", "score": "0.659235", "text": "def set_path(path)\n @path = path\n end", "title": "" }, { "docid": "b107907b305d88b829f6cb26636bd460", "score": "0.6566523", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "b107907b305d88b829f6cb26636bd460", "score": "0.6566523", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "b107907b305d88b829f6cb26636bd460", "score": "0.6566523", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "b107907b305d88b829f6cb26636bd460", "score": "0.6564419", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "39faf5186757229931ec05be7423723d", "score": "0.6559176", "text": "def path=(path) #:nodoc:\n @path = path\n end", "title": "" }, { "docid": "5c52a7a6983dca35498c657627ac7dfc", "score": "0.65331334", "text": "def path=(path)\n @path = File.expand_path(path)\n end", "title": "" }, { "docid": "c119aee5c3d1b4ee0c865c398a62d850", "score": "0.6530079", "text": "def setstat(path, attrs); end", "title": "" }, { "docid": "36ba0c46ec6085dba8cb062dea0da0ea", "score": "0.65243953", "text": "def setPath(seq)\n @path = seq\n end", "title": "" }, { "docid": "5d0a84c0b50a1e88a9e4f22a80fbb115", "score": "0.6520328", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "5d0a84c0b50a1e88a9e4f22a80fbb115", "score": "0.6520328", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "5d0a84c0b50a1e88a9e4f22a80fbb115", "score": "0.6520328", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "5d0a84c0b50a1e88a9e4f22a80fbb115", "score": "0.6520328", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "5d0a84c0b50a1e88a9e4f22a80fbb115", "score": "0.6520328", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "5d0a84c0b50a1e88a9e4f22a80fbb115", "score": "0.6520328", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "5d0a84c0b50a1e88a9e4f22a80fbb115", "score": "0.6520328", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "5d0a84c0b50a1e88a9e4f22a80fbb115", "score": "0.6520328", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "5d0a84c0b50a1e88a9e4f22a80fbb115", "score": "0.6520328", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "5d0a84c0b50a1e88a9e4f22a80fbb115", "score": "0.6520328", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "5d0a84c0b50a1e88a9e4f22a80fbb115", "score": "0.6520328", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "5d0a84c0b50a1e88a9e4f22a80fbb115", "score": "0.6520328", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "5d0a84c0b50a1e88a9e4f22a80fbb115", "score": "0.6520328", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "5d0a84c0b50a1e88a9e4f22a80fbb115", "score": "0.6520328", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "5d0a84c0b50a1e88a9e4f22a80fbb115", "score": "0.6520328", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "5d0a84c0b50a1e88a9e4f22a80fbb115", "score": "0.6520328", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "f5c66bd1deaf0001e856b827979b862b", "score": "0.6506602", "text": "def set_attribute(key, value)\n attr_hash = HashWithIndifferentAccess.from_dotted_path(key, value)\n self.normal = self.normal.deep_merge(attr_hash)\n end", "title": "" }, { "docid": "9f7bb7dce4d9deb5371957f7c8e8d945", "score": "0.6495373", "text": "def path=(path)\n @path = File.expand_path(path)\n end", "title": "" }, { "docid": "c03cdd898f7073e49c0ae02bc72ccbac", "score": "0.64854515", "text": "def set_nested_attribute_link_parameters(attr)\n @attr_name = attr.gsub(\"_\",\" \").capitalize\n\n return @attr_path = \"/#{users_path}/#{attr}\" unless attr == \"quests\"\n\n @attr_path = \"/#{users_path}/objectives\"\n end", "title": "" }, { "docid": "f027203ea4dcb8fccd294ef0ecf5abaf", "score": "0.6485074", "text": "def attribute=(attr, value)\n @attributes[attr] = value\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "fd66eb65c53ad86621cae69dcd0ffa09", "score": "0.64672714", "text": "def path\n @attributes[:path]\n end", "title": "" }, { "docid": "d309dffd28fdac85d4496f776991c611", "score": "0.645473", "text": "def attribute=(attr_name, value); end", "title": "" }, { "docid": "90e305e2cf72024e2b77862871838ef6", "score": "0.6434463", "text": "def set_path path, val, meta={}\n meta = self.curr_meta.merge meta\n path = path.split(\"/\").map{|p| p =~ /^\\d+$/ ? p.to_i : p}\n self.document.set_path path, val, meta\n end", "title": "" }, { "docid": "26aa7831307722c42d89a5ec3307e3cb", "score": "0.64247364", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "26aa7831307722c42d89a5ec3307e3cb", "score": "0.64247364", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "26aa7831307722c42d89a5ec3307e3cb", "score": "0.64247364", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "26aa7831307722c42d89a5ec3307e3cb", "score": "0.64247364", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "26aa7831307722c42d89a5ec3307e3cb", "score": "0.64247364", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "26aa7831307722c42d89a5ec3307e3cb", "score": "0.64247364", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "26aa7831307722c42d89a5ec3307e3cb", "score": "0.64247364", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "26aa7831307722c42d89a5ec3307e3cb", "score": "0.64247364", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "26aa7831307722c42d89a5ec3307e3cb", "score": "0.64247364", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "26aa7831307722c42d89a5ec3307e3cb", "score": "0.64247364", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "26aa7831307722c42d89a5ec3307e3cb", "score": "0.64247364", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "26aa7831307722c42d89a5ec3307e3cb", "score": "0.64247364", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "26aa7831307722c42d89a5ec3307e3cb", "score": "0.64247364", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "26aa7831307722c42d89a5ec3307e3cb", "score": "0.64247364", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "26aa7831307722c42d89a5ec3307e3cb", "score": "0.64247364", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "26aa7831307722c42d89a5ec3307e3cb", "score": "0.64247364", "text": "def set_Path(value)\n set_input(\"Path\", value)\n end", "title": "" }, { "docid": "0eb4e88ec1545c6100cf9952057ccbf9", "score": "0.64234525", "text": "def set_path! path, val, meta={}\n meta = self.curr_meta.merge meta\n path = path.split(\"/\").map{|p| p =~ /^\\d+$/ ? p.to_i : p}\n self.document.set_path! path, val, meta\n end", "title": "" }, { "docid": "545a78ed388c4451d06b750b534b14c6", "score": "0.6413292", "text": "def path(value)\n metadata[METADATA_NAMESPACE][:path] = value\n end", "title": "" }, { "docid": "fdc4596a1d1c072f1a34e3b81f9e9405", "score": "0.64081967", "text": "def fsattr_pset(attribute, value)\n err = setxattr(@path, attribute, value, value.bytesize, 0,0)\n end", "title": "" }, { "docid": "def7438c5fdc607aa9ba582ce1f01a68", "score": "0.63968", "text": "def setDirAttribute(attribute)\n # Make sure they are not the same.\n if @dir_attribute != attribute\n @dir_attribute = attribute\n self.setDirContents\n end\n end", "title": "" }, { "docid": "773cf4fe7a20ba33a069f93c251b71e9", "score": "0.6395723", "text": "def path=(value)\n api['path'] = value\n end", "title": "" }, { "docid": "773cf4fe7a20ba33a069f93c251b71e9", "score": "0.6395723", "text": "def path=(value)\n api['path'] = value\n end", "title": "" }, { "docid": "43d4db7fba82c0a9ce6f2015a03b074d", "score": "0.6393938", "text": "def set_path(p)\n\t\t@path = p\n\tend", "title": "" }, { "docid": "f28561b3a40e8718bbe74b99b6953109", "score": "0.63896126", "text": "def nested_attr_accessor(attr, *key_path)\n nested_attr_reader(attr, *key_path)\n define_attribute_writer_method(attr, *key_path)\n end", "title": "" }, { "docid": "dee8af73e02d14199be1fa5805a975ac", "score": "0.635828", "text": "def path=(v)\n @path = Pathname.new(v)\n @spec_path = nil\n end", "title": "" }, { "docid": "e9c52ec25cd5f56847d9ad5fc7159366", "score": "0.63431734", "text": "def set_attribute name, value, doc\n eval_xpath(doc)[0].set_attribute name, value\n end", "title": "" }, { "docid": "3670e0622270597bc9f09f42471c6c5b", "score": "0.6339611", "text": "def set_Attribute(value)\n set_input(\"Attribute\", value)\n end", "title": "" }, { "docid": "f442a44c165439af5b8f1e5c14cbba62", "score": "0.6300633", "text": "def path=(new_path)\n @path = (new_path || \"\")\n end", "title": "" }, { "docid": "585ff234d0c4d229e998278fe2e45350", "score": "0.62792546", "text": "def path=(_); end", "title": "" }, { "docid": "585ff234d0c4d229e998278fe2e45350", "score": "0.62792546", "text": "def path=(_); end", "title": "" }, { "docid": "0091b5110abfb206d1e13dcc273bed25", "score": "0.62646997", "text": "def path=(new_path); end", "title": "" }, { "docid": "0091b5110abfb206d1e13dcc273bed25", "score": "0.62646997", "text": "def path=(new_path); end", "title": "" }, { "docid": "32c79b407f954a6c49e87b9ae7fdb873", "score": "0.6259788", "text": "def path(val)\n modify do |c|\n c.path = val\n end\n end", "title": "" }, { "docid": "35f5b53e750a986c9fbc0d337dff9a45", "score": "0.6257045", "text": "def path=(value)\n @instance = nil\n @path = value\n end", "title": "" } ]
1b62bcfb9664ffdf65fc384081d96bd3
check if we need password to update user data ie if password or email was changed extend this as needed
[ { "docid": "68fff63841293eaa0f31009d93148ca7", "score": "0.0", "text": "def needs_password?(user, params)\n\t\tuser.email != params[:user][:email] ||\n\t\tparams[:user][:password].present?\n\tend", "title": "" } ]
[ { "docid": "c9743bca949c13607bf05812f71f2e1b", "score": "0.79863393", "text": "def supplied_password_on_update?\n !params[:user][:id].nil? && !params[:user][:password].blank? && !params[:user][:password_confirmation].blank?\n end", "title": "" }, { "docid": "0de39ecc8b8bd65f1895d4eb53180984", "score": "0.7793396", "text": "def check_password_updated\n if self.new_record? then\n @password_update = false\n else\n if password.empty? then\n user = User.find(self.id)\n self.password = user.password\n @password_update = false\n else\n @password_update = true\n end\n end\n true\n end", "title": "" }, { "docid": "180fe435bca821d2fd67f46f2dec75a1", "score": "0.7762456", "text": "def check_password_update\n if params[:user][:password].blank? and params[:user][:password_confirmation].blank?\n params[:user].extract!(:password, :password_confirmation)\n end\n end", "title": "" }, { "docid": "728e7fd041770bd4bab0dd6984f94ebc", "score": "0.768983", "text": "def should_validate_password?\n #updating_password || new_record?\n updating_password\n end", "title": "" }, { "docid": "9c6d78f1a5fa90d3f9e186e6fdf6afaf", "score": "0.7663444", "text": "def update_password\n @user = current_user\n @valid_login = Spree::User.check_valid_user?(@user.email, params[:user][:current_password]) #unless @user.blank?\n if @valid_login\n @user.updating_password = true\n @password_updated = @user.update_attributes(user_params_list)\n end\n\n if @password_updated\n sign_in(@user,:bypass => true) if @user.valid?\n mail_params = profile_update_mail_params\n VeganMailer.profile_update_email(mail_params)\n else\n @user.remove_errormessages_added_by_spree\n end\n\n end", "title": "" }, { "docid": "9574a248ecf067c8dc6d59791d904527", "score": "0.763929", "text": "def check_password\n # check if password is empty via bulk upload / or when initial order is placed\n if self.encrypted_password == \"\"\n user_email = correct_imported_email(self.email)\n self.update_attribute(:email, user_email)\n # set to default password - LabUDefault@123\n self.update_attribute(:encrypted_password, \"$2a$12$p3Ocr1/0Xqs2uDLNRovCEutY.TYIF9/d/MBz2OIi.LWh8dAkkhWim\")\n LabULog.debug \"Created user via excel upload - \" + self.email\n end\n end", "title": "" }, { "docid": "6b02e87408478de0af1a43501d1cf809", "score": "0.76233304", "text": "def updating_password?\n (!persisted? && requires_password?) || (!password.nil?)\n end", "title": "" }, { "docid": "c60eecbc208a94b0f8440d0bd3ebef96", "score": "0.76000625", "text": "def should_validate_password?\n # Validate when the update_password variable is set or a new record is being created\n update_password || new_record?\n end", "title": "" }, { "docid": "3802197021416034d600e6f0d1d0fbc5", "score": "0.7595944", "text": "def check_password_changed\n self.temp_password = nil if ( changed.include?('encrypted_password') && !(changed.include?('temp_password')))\n end", "title": "" }, { "docid": "020114e425615b974499dfb83fc7eafe", "score": "0.7594894", "text": "def should_update_password?\n # TODO: Have an accessor for marking this as being updated, i.e.:\n # updating_password || new_record?\n new_record?\n end", "title": "" }, { "docid": "75681c400457458c5b64fbf5885974b2", "score": "0.7588816", "text": "def allow_users_to_change_password\n data.allow_users_to_change_password\n end", "title": "" }, { "docid": "b0f28f8c932c3f16a9c6d6392e9fb3b6", "score": "0.7579573", "text": "def password_update\n !password_confirmation.nil? || !password.nil?\n end", "title": "" }, { "docid": "0d2cac52ad3f7575abb66e5c1c32304d", "score": "0.75599545", "text": "def password_update?\n user = params[:user]\n !user[:current_password].blank? || !user[:password].blank? ||\n !user[:password_confirmation].blank?\n end", "title": "" }, { "docid": "3d1c42da2ef567f0bf951930faa30c26", "score": "0.75203097", "text": "def updating_password?\n new_record? or updating_password\n end", "title": "" }, { "docid": "c5b9c237c7bdf505d232a060d1a37d9a", "score": "0.75070846", "text": "def allow_users_to_change_password\n data[:allow_users_to_change_password]\n end", "title": "" }, { "docid": "7b8fb713ac175b3cfe656b9e6747d082", "score": "0.74996895", "text": "def should_validate_password?\n updating_password || new_record?\n end", "title": "" }, { "docid": "38dff72fd5624f64b2782a8c26d99e46", "score": "0.7497609", "text": "def updating_password?\n return !password.nil?\n end", "title": "" }, { "docid": "c3d0aad4225bdcee50330b4b318f8a70", "score": "0.7484469", "text": "def should_get_current_password?\n updating_password\n end", "title": "" }, { "docid": "057f23897a268f24863076042b6a45b5", "score": "0.7460712", "text": "def needs_password?(user, account_update_params)\n account_update_params[:password].present? ||\n account_update_params[:password_confirmation].present?\n end", "title": "" }, { "docid": "2d9ce9835082a2f50d609afa47bdb40a", "score": "0.7428219", "text": "def should_validate_password?\n updating_password || new_record?\n end", "title": "" }, { "docid": "d5aeae0af46071fa3af5551eaef425fc", "score": "0.7383442", "text": "def changing_password\n return updating_password?\n end", "title": "" }, { "docid": "c01195fe5a07114da6a58be50c991d2d", "score": "0.7383026", "text": "def needs_password_change?\n self.force_password_change || (!self.password_hash.present? || !self.password_salt.present?)\n end", "title": "" }, { "docid": "077e31b2932f4f12da5cc434d8960f7a", "score": "0.7381129", "text": "def update_password\n #puts \"ID ===== #{self.id}\"\n if (self.id.nil?)\n self.password = Password::update(self.password)\n else\n existing = User.find(self.id)\n if (existing.password.nil? or (self.password.length < 192 and existing.password.length == 192))\n self.password = Password::update(self.password)\n end\n end\n end", "title": "" }, { "docid": "8e683da5727712f3ee7c2c588f18ffa9", "score": "0.737925", "text": "def update\n @user = User.find(current_user.id)\n #successfully_updated = if needs_password?(@user, params)\n # @user.update_with_password(params[:user])\n #else\n # remove the virtual current_password attribute update_without_password\n # params[:user].delete(:current_password)\n #end\n if @user.update_attributes(params[:user])\n set_flash_message :notice, :updated\n # Sign in the user bypassing validation in case his password changed\n sign_in @user, :bypass => true\n redirect_to my_accounts_path, notice: \"Hurrey!Your Info update successfully.\"\n else\n render \"edit\"\n end\n end", "title": "" }, { "docid": "b6992166de59715a33d28164954aeb84", "score": "0.73185587", "text": "def check_if_user_must_update_password\n if session[:user_must_update_password]\n flash[:warning] = t(\"winnow.notifications.update_password\")\n redirect_to edit_password_path\n end\n end", "title": "" }, { "docid": "f36dcd64410f65d267de8e8130744fd8", "score": "0.72996163", "text": "def update\n # Case 2\n if params[:user][:password].empty?\n @user.errors.add(:password, \"can't be empty\")\n render 'edit'\n # Case 3\n elsif @user.update_attributes(user_params)\n log_in @user\n # If the user has not already been activated, activate them\n if [email protected]?\n @user.activate\n end\n @user.update_attribute(:reset_digest, nil) # Clear the reset digest so that the link no longer works\n flash[:success] = \"Your password has been reset.\"\n redirect_to @user\n # Case 4\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "2fe42146cd09a8d663480c78ba372284", "score": "0.72965086", "text": "def edit_password\n if request.post?\n if current_user.update_attributes(params[:current_user].merge(:crypted_password => nil))\n session[:user_must_update_password] = false\n flash[:notice] = t(\"winnow.notifications.password_changed\")\n redirect_to feed_items_path\n end\n end\n end", "title": "" }, { "docid": "075c389dcc6644a21e99e006e006cb92", "score": "0.7276291", "text": "def edit\n @title = \"Baguhin ang account info\"\n @user = User.find(session[:user_id])\n if param_posted?(:user)\n attribute = params[:attribute]\n case attribute\n when \"email\"\n try_to_update @user, attribute\n when \"password\"\n if @user.correct_password?(params)\n try_to_update @user, attribute\n else\n @user.password_errors(params)\n end\n end\nend\n # For security purposes, never fill in password fields.\n @user.clear_password!\nend", "title": "" }, { "docid": "94a23656e6aa4db1faa3dfb64e1791d4", "score": "0.7233375", "text": "def valid_password?(password)\n begin\n super(password)\n rescue BCrypt::Errors::InvalidHash\n #if User is flag to auth with POGS if not try with old theSkyNet System\n if boinc_id.nil?\n #auth if old theSkyNet\n return false unless\n Digest::SHA256.hexdigest(self.old_site_password_salt+Digest::SHA256.hexdigest(password)) == self.encrypted_password\n logger.info \"User #{email} is using the old password hashing method, updating attribute.\"\n self.profile.new_profile_step= 2\n self.profile.save\n #look for a boinc account with the same email, pasword.\n boinc = BoincStatsItem.find_by_boinc_auth(email,password)\n if boinc.new_record?\n #Could not find account so do nothing for this step\n else\n #found account so add it\n self.profile.general_stats_item.boinc_stats_item = boinc\n self.profile.save\n end\n self.password = password\n self.password_confirmation = password\n self.save\n true\n else\n #auth with POGS\n #lookup user in boincDB\n boinc_user = BoincRemoteUser.auth(email ,password)\n # check if their vaild\n if boinc_user == false\n #failed to authenticate against the boincdb\n return false\n else\n self.profile.new_profile_step= 2\n self.profile.save\n self.password = password\n self.password_confirmation = password\n self.save\n true\n end\n end\n end\n end", "title": "" }, { "docid": "a667bc2b98f2c76b8b05e3ef63bdd7e0", "score": "0.72175276", "text": "def password_is_not_being_updated?\n self.id and !self.password\n end", "title": "" }, { "docid": "5cf877beaf84b28a6b82c74a452e0a25", "score": "0.72067225", "text": "def display_password_change?\n !params[:user].nil? && params[:user].key?(:password)\n end", "title": "" }, { "docid": "67548018474ec6c53573c2777ebcaf8a", "score": "0.7205167", "text": "def update_with_password(params, *options)\n @allow_empty_password = !!encrypted_password.blank?\n super\n ensure\n @allow_empty_password = false\n end", "title": "" }, { "docid": "a54948183fcb42ca8181496e72aaedd3", "score": "0.71915287", "text": "def password_updation\r\n user_id = params[:user_id]\r\n password = params[:password]\r\n if password.present?\r\n @password = User.find(params[:user_id]).update(password: params[:password], dup_password: params[:password])\r\n render json: {status: @password}, status: :ok\r\n else\r\n render json: { error: 'password can not be nil' }, status: :unauthorized\r\n end \r\n end", "title": "" }, { "docid": "92e12e17c01638cc27a27e95fb937051", "score": "0.719065", "text": "def password_is_not_being_updated?\n self.id and self.password.blank?\n end", "title": "" }, { "docid": "d4fe3b98217c0d3264fa7dcc274ca10d", "score": "0.7188018", "text": "def updating_password?\n registered? && !state_changed? && reset_password_token.blank? &&\n !(password.nil? && password_confirmation.nil? && current_password.nil?)\n end", "title": "" }, { "docid": "508a42d3067bbebc8aa21047524e110c", "score": "0.71871406", "text": "def password_changed?\n !self.new_password.blank?\n end", "title": "" }, { "docid": "0ab93b21ed1881616372d40bb5ce033f", "score": "0.71861196", "text": "def password_is_not_being_updated?\n self.id and self.password.nil?\n end", "title": "" }, { "docid": "96a75f37098f9b5db8b7c451f485268e", "score": "0.7177382", "text": "def check_new_or_reseted_user\n begin\n user = User.find(current_user.id)\n if user.first_access == true\n user.update(password: user.id_func)\n end\n rescue => ex\n puts ex.message\n end\n end", "title": "" }, { "docid": "fdeb46d6ee8d80a0f850cf8073ed3c30", "score": "0.71725416", "text": "def old_password_check\n @user=JSON.parse RestClient.get $api_service+\"/users/#{session[\"user_id\"]}\"\n if @user[\"password\"]==params[\"password\"]\n @data=\"1\"\n else\n @data=\"0\" \n end \nend", "title": "" }, { "docid": "ef32828689da96d5e31db8510c5fe626", "score": "0.71719265", "text": "def requires_password_change?\n attributes[:requires_password_change]\n end", "title": "" }, { "docid": "d4d0ff5ca0be8e62c5395d04d9c4a244", "score": "0.7158738", "text": "def update_password\n user = get_user_with_password params[:user][:old_password]\n if user and @user.update_attributes(params[:user])\n @user.update_attribute(:has_password, true) if (:password_not_set and !params[:user][:password].blank?) # for users who are setting password for first time... for others it is already true...also 2nd condition in 'if' is to check whether user has set a password or simply pressed button without updating password\n flash[:notice]= 'User was successfully updated.'\n sign_in @user # Here we sign in user again ...because we have a before_save callback that creates a new remember_token on saving...this doesnt math the token present in browser cookies...so u have to log in again\n\n respond_to do |format|\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.js { render js: \"window.location='#{user_path @user}'\" }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { render template: 'users/form_new_password', locals: {user: @user} }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n format.js { render 'update_error' }\n end\n end\n end", "title": "" }, { "docid": "a2b0879bd80652e92e76facc7ef5152f", "score": "0.7157267", "text": "def update_password\n puts \" Setting password reset to false for |#{username}|.\" if $options.verbose\n if config['source']['admins'].include?(nickname)\n admin = true\n else\n admin = false\n end\n begin\n result = apps.provision.update_user(username, first, last, nil, nil, admin.to_s, nil, \"false\", nil )\n puts \"Result: #{result}\" if $options.debug\n update = true\n rescue GData::GDataError => e\n if e.code == \"1300\"\n puts \" => Set password reset to false #{username} exists\" if $options.verbose\n update = true\n elsif e.code == \"1000\"\n puts \" => setting password reset to false #{username} unknown error\" if $options.verbose\n update = false\n #retry\n else\n puts \"Error creating user: #{username}\" if $options.verbose\n raise e\n end\n rescue OpenSSL::SSL::SSLError => e\n retry\n end\nend", "title": "" }, { "docid": "8621eea83292d02aa36c2480d91a5d11", "score": "0.7154444", "text": "def update_password\n begin\n student_check\n\n # Password and confirmation\n password = params[:password][:password]\n conf = params[:password][:confirm_password]\n\n # If password and conf match and are not empty\n if !password.empty? && password == conf\n # Update and redirect\n User.find(params[:id]).update_attribute :password, password\n redirect_to edit_user_path\n else\n redirect_to password_user_path\n end\n rescue\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "d3def75a1082a6062b79af566b941aa5", "score": "0.7135424", "text": "def need_change_password!\n if self.class.expire_password_after.is_a? Fixnum\n need_change_password\n self.save(:validate => false)\n end\n end", "title": "" }, { "docid": "26e4b6588a55baa133962f32fb45bcd7", "score": "0.7134663", "text": "def password_changed?\n !@new_password.blank?\n end", "title": "" }, { "docid": "26e4b6588a55baa133962f32fb45bcd7", "score": "0.7134663", "text": "def password_changed?\n !@new_password.blank?\n end", "title": "" }, { "docid": "26e4b6588a55baa133962f32fb45bcd7", "score": "0.7134663", "text": "def password_changed?\n !@new_password.blank?\n end", "title": "" }, { "docid": "7f5c0e96dac64cc9aea7f8b8ad4350d7", "score": "0.7132084", "text": "def password_changed?\n !@new_password.blank?\n end", "title": "" }, { "docid": "7f5c0e96dac64cc9aea7f8b8ad4350d7", "score": "0.7132084", "text": "def password_changed?\n !@new_password.blank?\n end", "title": "" }, { "docid": "7dbffe1733bbb930cc3177b0d7dbb598", "score": "0.71302426", "text": "def update\r\n\r\n successfully_updated = if needs_password?(@user, params)\r\n @user.update_with_password(devise_parameter_sanitizer.sanitize(:account_update))\r\n else\r\n # remove the virtual current_password attribute\r\n # update_without_password doesn't know how to ignore it\r\n params[:user].delete(:current_password)\r\n @user.update_without_password(devise_parameter_sanitizer.sanitize(:account_update))\r\n end\r\n\r\n respond_to do |format|\r\n if successfully_updated\r\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\r\n #format.json { head :no_content }\r\n format.json { respond_with_bip(@user) }\r\n else\r\n format.html { render :action => \"edit\" }\r\n #format.json { render :json => @user.errors, :status => :unprocessable_entity }\r\n format.json { respond_with_bip(@user) }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "8595766c375fb03b2878a916874f1eb0", "score": "0.7127661", "text": "def password_changed?\n [email protected]?\n end", "title": "" }, { "docid": "a017aba8ae4f7b1f37ff3b3eaf59b581", "score": "0.7117313", "text": "def password_changed?\n !@new_password.blank?\n end", "title": "" }, { "docid": "005572364965d4a982531dc77012b6fd", "score": "0.71156245", "text": "def new_password_required?\n lifecycle_changing_password? || changing_password?\n end", "title": "" }, { "docid": "8c1e81c7e6e8b03cc52e3786d596ff09", "score": "0.7114454", "text": "def needs_password_change_email?\n password_digest_changed? && persisted?\n end", "title": "" }, { "docid": "46ec267a2351e14c1d80fd15bdbe155b", "score": "0.71134895", "text": "def must_change_password?\n @must_change_password\n end", "title": "" }, { "docid": "a5b67b641d203199606b3139e9311723", "score": "0.7109767", "text": "def update\n\t\tp !!!params[:user][:password_confirmation].match(params[:user][:password])\n\t\tif params[:user][:password].empty? \n flash.now[:warning] = \"Password can't be empty\"\n render 'edit'\n\t\telsif !!!params[:user][:password].match(VALID_PASSWORD_REGEX)\n\t\t\tflash.now[:warning] = \"The password must be at least 8 characters long and contain at least: one lowercase character, one uppercase character and one number\"\n render 'edit'\n\t elsif !!!params[:user][:password_confirmation].match(params[:user][:password])\n\t\t\tflash.now[:warning] = \"The password confirmation and password must match\"\n render 'edit'\n elsif @user.update(user_params) \n log_in @user\n flash[:success] = \"Password has been reset.\"\n redirect_to @user\n else\n render 'edit' \n end\n end", "title": "" }, { "docid": "a13b5c9fbca2e99a2abbb2598a812684", "score": "0.71005267", "text": "def change_password?\n true\n end", "title": "" }, { "docid": "cb446dc1825af9198a4468c450444e4a", "score": "0.7089359", "text": "def update\n password_changed = false\n if @user = FrontendUser.find_using_perishable_token(params[:id])\n new_pw = params[:frontend_user][:password]\n new_pw_c = params[:frontend_user][:password_confirmation]\n if not new_pw.blank? and not new_pw_c.blank?\n @user.is_reseting_password = true\n #@user.save_without_session_maintenance\n password_changed = @user.update_attributes({\n :password => new_pw, :password_confirmation => new_pw_c\n })\n @user.is_reseting_password = false\n else\n @password_blank = 'Das Passwort und die Wiederholung sind leer.'\n end\n end\n if logged_in?\n current_user_session.destroy\n end\n @current_user = nil\n @current_user_session = nil\n if @user and password_changed\n @current_user_session = FrontendUserSession.new\n render({:template => 'frontend/password_reset_requests/update'})\n elsif @user and !password_changed\n render({:template => 'frontend/password_reset_requests/edit'})\n else\n render({:template => 'frontend/password_reset_requests/new'})\n end\n end", "title": "" }, { "docid": "6937eee9ffba33d2b9a9145d0c4d6025", "score": "0.708757", "text": "def check_or_set_password\n\n if self.password.blank?\n self.password =\n ::Milia::Password.generate(\n 8, Password::ONE_DIGIT | Password::ONE_CASE\n )\n\n self.password_confirmation = self.password\n else\n # if a password is being supplied, then ok to skip\n # setting up a password upon confirm\n self.skip_confirm_change_password = true if ::Milia.use_invite_member\n end\n\n end", "title": "" }, { "docid": "c7f3a64046b8c8c3fb5a0c04b4a5857f", "score": "0.7086859", "text": "def needs_password?(user, params)\n user.email != params[:user][:email]\n end", "title": "" }, { "docid": "e72bb4dab4a384c6808a79cddade12ec", "score": "0.7086074", "text": "def password_changed?\n !!@password\n end", "title": "" }, { "docid": "4cbbc68be9394e9b9559239315d86602", "score": "0.7084296", "text": "def send_password_change_notification?; end", "title": "" }, { "docid": "7c314830276a3020fedd84a05a1d27c3", "score": "0.7069995", "text": "def update\n if params[:user][:password].empty? #checks for attempt to update with blank password\n @user.errors.add(:password, \"can't be empty\") \n render \"edit\" #if the password fields are blank, password edit page is re-rendered\n elsif @user.update_attributes(user_params) #checks for successful update of attributes\n log_in @user #if update is successful, user is logged in\n flash[:success] = \"password has been reset\" #success message is flashed at top of screen\n redirect_to @user #sends user to their user page (user#show)\n else \n render 'edit' #if not successful, re-renders the password edit page\n end\n end", "title": "" }, { "docid": "57df920243fe40f91ff52f32e516e052", "score": "0.70665604", "text": "def change_password?\n user.present? && user == record\n end", "title": "" }, { "docid": "ed703a51b17b02ad7c5d229f2fa40ec4", "score": "0.7065944", "text": "def change_inital_password\n\n #Verify that patient is in pending state, if they are not then they shouldnt be able to use this method\n if (@current_user.status != \"Pending\")\n render(json: { message: \"Patient account already activated\" }, status: 401)\n return\n end\n\n if (params[:password] == params[:passwordConfirmation])\n @current_user.update_password(params[:password])\n render(json: { message: \"Password Upadate Success\" }, status: 200)\n else\n render(json: { message: \"password and passwordConfirmation do not match\" }, status: 422)\n end\n end", "title": "" }, { "docid": "4dd50e6c99875431823c4ad9f73469bd", "score": "0.7060772", "text": "def update\n # TODO with blank password, current_user.update_with_password doesn't return false\n # temporarily add extra exception handling + (password error message doensn't contain \"새로운\")\n password_length = params[:user][:password].length\n if password_length != 0 && current_user.update_with_password(account_update_params)\n bypass_sign_in(current_user)\n # render 'registrations/update_password_success_mobile'\n render_by_device 'registrations/update_password_success'\n else\n if password_length == 0\n current_user.errors.messages[:password] << \"새로운 \" + I18n.t(\"activerecord.errors.models.user.attributes.password.blank\")\n end\n render js: \"$('#error-message').text('#{current_user.errors.messages.first.second.first}');\"\n end\n end", "title": "" }, { "docid": "73b53cd6f7aea47d805ed745773bca84", "score": "0.70593303", "text": "def update_maybe_with_password(params)\n if params[:email] != email || !params[:password].blank? || !params[:password_confirmation].blank?\n update_with_password(params)\n else\n params.delete(:password)\n params.delete(:password_confirmation)\n params.delete(:current_password)\n update_attributes(params)\n end\n end", "title": "" }, { "docid": "f973ceb76829cc53acaeeb44b033677c", "score": "0.7058866", "text": "def password_changed?\n [email protected]?\n end", "title": "" }, { "docid": "d18a57b8ae107c09f6c5593c4e265660", "score": "0.70533794", "text": "def validate_info_change_password(params)\n if params[\"change_password\"].nil?\n return false\n else \n return true\n end\n end", "title": "" }, { "docid": "0539c1bc18a0c2de0f753b243551198b", "score": "0.7051615", "text": "def update\n routine_check\n # Check if password is blank, if so, clear :current_password\n # and update without password, else updates password.\n if current_user.id == user.id\n if user_params[:password].blank? && user_params[:current_password].blank?\n if user.update_without_password(user_params.except(:current_password,:password))\n render json: user, status: :ok\n else\n render json: user.errors, status: :unprocessable_entity\n end\n elsif user.update_with_password(user_params)\n render json: user, status: :ok\n else\n render json: user.errors, status: :unprocessable_entity\n end\n else\n render json: user.errors, status: :forbidden\n end\n end", "title": "" }, { "docid": "35fcf54d5acd53c4ef97857e581aacde", "score": "0.7050648", "text": "def update_password\n \tself.password = ::Password::update(self.password) if self.password_changed?\n \tend", "title": "" }, { "docid": "f68166d5cbe5fdb9d36aec64e8dfeb71", "score": "0.70431536", "text": "def password_changed?\n !password.blank?\n end", "title": "" }, { "docid": "f68166d5cbe5fdb9d36aec64e8dfeb71", "score": "0.70431536", "text": "def password_changed?\n !password.blank?\n end", "title": "" }, { "docid": "52f0928d725f2d4e04797e8607e61be9", "score": "0.7040192", "text": "def needs_password?(user, params)\n #user.email != params[:user][:email] ||\n params[:user][:password].present?\n end", "title": "" }, { "docid": "52f0928d725f2d4e04797e8607e61be9", "score": "0.7040192", "text": "def needs_password?(user, params)\n #user.email != params[:user][:email] ||\n params[:user][:password].present?\n end", "title": "" }, { "docid": "06d68f5228a13593c0f9d183ebf67db1", "score": "0.7039819", "text": "def update\n if @user.reset_password_sent_at < 2.hours.ago\n render plain: \"Password reset has expired.\"\n elsif @user.update_attributes(\n password: params.require(:password),\n password_confirmation: params.require(:password_confirmation)\n )\n render plain: \"Password has been reset!\"\n else\n render plain: \"Nones\"\n end \n end", "title": "" }, { "docid": "1633250b7e0e5713a1a01645c69ae980", "score": "0.70356494", "text": "def needs_password?(user, params)\n return false unless user.password_changeable?\n user.email != params[:user][:email] ||\n params[:user][:password].present? ||\n params[:user][:password_confirmation].present?\n end", "title": "" }, { "docid": "70546d3c5f882ed96aee2e187d8ffdc5", "score": "0.70342326", "text": "def need_change_password?\n set_default_password_expiration\n password_updated_at < self.class.expire_password_after.days.ago\n end", "title": "" }, { "docid": "17ea444880d2667353c8bae3928ea9a7", "score": "0.7032319", "text": "def need_old_password?\n @need_old_password\n end", "title": "" }, { "docid": "38edc70b71801012658397b119fba4b1", "score": "0.7032213", "text": "def will_save_change_to_encrypted_password?\n changed_attributes['encrypted_password'].present?\n end", "title": "" }, { "docid": "8111edf0c8f38e6dfe05d9a50599ca7e", "score": "0.70273924", "text": "def update\n error = false\n # puts (params[:user][:password].to_s)\n #removes the psw and psw conf if the fields are empty\n if params[:user][:password].blank? && params[:user][:password_confirmation].blank?\n params[:user].delete(:password)\n params[:user].delete(:password_confirmation)\n else #the password is beeing reset\n if params[:user][:email].blank?\n flash[:error] = \"Email cannot be empty when setting a password\"\n error = true\n end\n if params[:user][:password].length < 6\n flash[:error] = \"Password too short, minimum 5 characters\"\n error = true\n end \n end\n if @user.update_attributes(params[:user]) && !error\n flash[:success] = \"Profile updated\"\n sign_in @user\n redirect_to @user\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "35c6374be7446afe701fa592b9642989", "score": "0.70264006", "text": "def password_changed?\n [email protected]?\n end", "title": "" }, { "docid": "80ba6c3823de68d56cbc8f0e478686d9", "score": "0.7026268", "text": "def update\n @user = User.find(current_user.id)\n\n successfully_updated = if needs_password?(@user, params)\n @user.update_with_password(params[:user])\n else\n # remove the virtual current_password attribute update_without_password\n # doesn't know how to ignore it\n params[:user].delete(:current_password)\n @user.update_without_password(params[:user])\n end\n\n if successfully_updated\n set_flash_message :notice, :updated\n # Sign in the user bypassing validation in case his password changed\n sign_in @user, :bypass => true\n redirect_to after_update_path_for(@user)\n else\n render \"edit\"\n end\n end", "title": "" }, { "docid": "812cd341fce362b8da4453488277125b", "score": "0.70224804", "text": "def update\n if params[:user][:password].empty? # User password validation allows nil\n @user.errors.add( :password, \"can't be empty\" )\n render 'edit'\n elsif @user.update( user_params )\n log_in @user\n # add security for pwd resetting on public computers, makes impossible to\n # back-track via browser's back button to still unexpired reset link\n @user.update_attribute :reset_digest, nil\n flash[:success] = \"Password has been reset.\"\n redirect_to @user\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "88e81beb5b110a2cb9402bc9d19ae11d", "score": "0.70198274", "text": "def needs_password?(user, params)\n #user.email != params[:user][:email] ||\n params[:user][:password].present?\n end", "title": "" }, { "docid": "7122ae1a6d9a44dbd65d0087cc392f1b", "score": "0.7018305", "text": "def update\n new_password = params[:password]\n old_password = params[:password_confirmation]\n email = params[:email]\n background = params[:background]\n checkUser = getLoggedUser.authenticate(old_password)\n if checkUser\n checkUser.update(background: background)\n checkUser.update(email: email) unless email.empty?\n checkUser.update(password: new_password, password_confirmation: new_password) unless new_password.empty? \n flash[:alert] = \"Account updated\"\n else\n flash[:alert] = \"Password Incorrect\"\n end\n\n redirect_to user_url(getLoggedUser)\n end", "title": "" }, { "docid": "f12a4128893906d943b8f6fe852445e4", "score": "0.7017185", "text": "def failed_password_change?\n password_details.changed? && !email_identity.password_digest_changed? ? true : false\n end", "title": "" }, { "docid": "5733f294665518648ca457c3f5523db0", "score": "0.7016312", "text": "def update\n @user.password = params[:user][:password]\n @user.password_confirmation = params[:user][:password_confirmation]\n if params[:user][:password].nil? or params[:user][:password].blank?\n flash[:error] = t 'password_reset.password_required'\n render :action => :edit \n elsif @user.save\n flash[:notice] = t 'password_reset.pwd_update_success'\n redirect_to my_firehoze_index_path\n else\n render :action => :edit\n end\n end", "title": "" }, { "docid": "1349b56fda5fc5ce85aad5afa42a6305", "score": "0.7014276", "text": "def before_update(user)\n if params[:reset_password]\n user.reset_password\n end\n end", "title": "" }, { "docid": "1349b56fda5fc5ce85aad5afa42a6305", "score": "0.7014276", "text": "def before_update(user)\n if params[:reset_password]\n user.reset_password\n end\n end", "title": "" }, { "docid": "d2edc8a2d2f3dc6504a6716db899009f", "score": "0.7007545", "text": "def update \n if params[:user][:password].empty? #empty password\n @user.errors.add(:password, \"can\\' be empty\" )\n render :edit\n elsif @user.update_attributes(user_params) #unsuccessful update\n log_in @user\n flash[:success] = 'Password was reset successfully'\n redirect_to user_url(@user)\n else #password not valid\n render :edit\n end\n end", "title": "" }, { "docid": "f9761077633f19aacfbbd0497c16a1ca", "score": "0.70052063", "text": "def check_changing_pw\n if [email protected]?(params[:user][:old_password])\n flash[:notice] = \"Wrong old password!\"\n redirect_to change_pw_path\n elsif params[:user][:password] != params[:user][:password_confirmation]\n flash[:notice] = \"New password not matching confirmation!\"\n redirect_to change_pw_path\n end\n end", "title": "" }, { "docid": "85de4cd59fbe3f6b4640980bd4758363", "score": "0.7003922", "text": "def update_password\n return false unless valid?\n\n user.password = password\n user.save\n end", "title": "" }, { "docid": "de8cc2c884f7b0a9346648d643db7d88", "score": "0.69880843", "text": "def update_password\n @company = Company.find(params[:company_id])\n @user = User.find(params[:id])\n @user_access_levels = Flutter::Access.levels\n Flutter::CurrentUser.init_data({\n access: session[:user_access],\n company: session[:company_id]\n })\n # Access is restricted to users (only self)\n if Flutter::CurrentUser.is_user && (params[:id].to_i == session[:user_id])\n @errors = []\n if params[:user][:current_password] && params[:user][:new_password] && params[:user][:new_password_confirm]\n if params[:user][:new_password] != params[:user][:new_password_confirm]\n @errors << \"The passwords do not match\"\n end\n if password_hash(params[:user][:current_password], @user.password_seed) != @user.password_hash\n @errors << \"The current password you entered is incorrect.\"\n end\n else\n @errors << \"You need to supply your current password, your new password and a confirmation of your new password.\"\n end\n if @errors.any?\n render \"edit_password\"\n else\n user_seed = password_seed\n user_hash = password_hash params[:user][:new_password], user_seed\n @user.update(password_hash: user_hash, password_seed: user_seed)\n render \"show\"\n end\n else\n access_denied\n end\n end", "title": "" }, { "docid": "09e7f49c08b6dcc480a44087b6e19e80", "score": "0.69795", "text": "def recently_resend_password?\n @resend_password \n end", "title": "" }, { "docid": "2bcfd692e2b2015ea272c3345c377721", "score": "0.697578", "text": "def password_checks\n if self.new_record?\n if not self.password or not self.password_confirmation or self.password.empty?\n self.password = 'please fill it in' if not self.password or self.password.empty?\n self.errors.add password, \"You need to fill in password and its confirmation\"\n return false\n end\n end\n if self.password and not self.password == self.password_confirmation\n self.errors.add self.password, \"Password and its confirmation must match\"\n end\n end", "title": "" }, { "docid": "743af9c49f2d3256ff69eebd337147d1", "score": "0.6974387", "text": "def password_changed?\n if !self.hashed_password\n return true\n else\n if password_reset_valid?\n return true\n else\n return false\n end\n end\n end", "title": "" }, { "docid": "86f56ea01668074ff5fb4f65669595b0", "score": "0.6966632", "text": "def password_changed?\n !password.blank? or self.encrypted_password.blank?\n end", "title": "" }, { "docid": "443100bc29226ae99636e57d39619f7d", "score": "0.6961879", "text": "def needs_password_change_email?\n encrypted_password_changed? && persisted?\n end", "title": "" }, { "docid": "443100bc29226ae99636e57d39619f7d", "score": "0.6961879", "text": "def needs_password_change_email?\n encrypted_password_changed? && persisted?\n end", "title": "" }, { "docid": "e99616c5e75e41090d16ab2bb1ddc0ef", "score": "0.69603676", "text": "def changed_password?\n params[:db_user][:password] != @user_password\n end", "title": "" } ]
fe2f56c3ac9edcba89da55e235b03384
Generate a multicast and globally unique MAC address
[ { "docid": "466bb5565b52fd3eb98fe77ba0aab349", "score": "0.7401642", "text": "def test_gen_mac_unicast_globally_unique\n mac = RFauxFactory.gen_mac(multicast: false, locally: false)\n first_octect = mac.split(':')[0].to_i(16)\n mask = 0b00000011\n assert_equal first_octect & mask, 0\n end", "title": "" } ]
[ { "docid": "87c2303dfccc7c0b86059a347d87e370", "score": "0.8006559", "text": "def generate_mac\n if locate_config_value(:macaddress).nil?\n ('%02x' % (rand(64) * 4 | 2)) + (0..4).reduce('') { |s, _x|s + ':%02x' % rand(256) }\n else\n locate_config_value(:macaddress)\n end\n end", "title": "" }, { "docid": "805b8feb4c0c04b25ce574bc168de020", "score": "0.7866787", "text": "def generate_mac \n (\"%02x\"%(rand(64)*4|2))+(0..4).inject(\"\"){|s,x|s+\":%02x\"%rand(256)}\n end", "title": "" }, { "docid": "62365366615d337ce8fab7c5aac85adf", "score": "0.7567914", "text": "def mac_address\n unless @mac\n octets = 3.times.map { rand(255).to_s(16) }\n @mac = \"525400#{octets[0]}#{octets[1]}#{octets[2]}\"\n end\n @mac\n end", "title": "" }, { "docid": "e1538cb8ba4eb4940e318a230bf3cd8b", "score": "0.75315917", "text": "def generate_mac\n crc32 = Zlib.crc32(self.id.to_s)\n offset = crc32.modulo(255)\n\n digits = [ %w(0),\n %w(0),\n %w(0),\n %w(0),\n %w(5),\n %w(e),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f),\n %w(5 6 7 8 9 a b c d e f),\n %w(3 4 5 6 7 8 9 a b c d e f),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f) ]\n mac = \"\"\n for x in 1..12 do\n mac += digits[x-1][offset.modulo(digits[x-1].count)]\n mac += \":\" if (x.modulo(2) == 0) && (x != 12)\n end\n mac\n end", "title": "" }, { "docid": "68b6ba88fa37b121d23a96925375e793", "score": "0.7446902", "text": "def test_gen_mac_multicast_globally_unique\n mac = RFauxFactory.gen_mac(multicast: true, locally: false)\n first_octect = mac.split(':')[0].to_i(16)\n mask = 0b00000011\n assert_equal first_octect & mask, 1\n end", "title": "" }, { "docid": "72653fd8dce90e94bc1eb0886796a023", "score": "0.74305457", "text": "def generate_unique_mac\n sprintf('b88d12%s', (1..3).map{\"%0.2X\" % rand(256)}.join('').downcase)\n end", "title": "" }, { "docid": "d8a9d8a1f24c7474b251abefe4092c5a", "score": "0.7396655", "text": "def test_gen_mac_multicast_locally_administered\n mac = RFauxFactory.gen_mac(multicast: true, locally: true)\n first_octect = mac.split(':')[0].to_i(16)\n mask = 0b00000011\n assert_equal first_octect & mask, 3\n end", "title": "" }, { "docid": "b44684ff11a63b1b30286b97ca930031", "score": "0.72476536", "text": "def test_gen_mac_unicast_locally_administered\n mac = RFauxFactory.gen_mac(multicast: false, locally: true)\n first_octect = mac.split(':')[0].to_i(16)\n mask = 0b00000011\n assert_equal first_octect & mask, 2\n end", "title": "" }, { "docid": "26754d652faebbb51b849dbd723fc501", "score": "0.7213217", "text": "def generate_ULA(mac, subnet_id = 0, locally_assigned=true)\n now = Time.now.utc\n ntp_time = ((now.to_i + 2208988800) << 32) + now.nsec # Convert time to an NTP timstamp.\n system_id = '::/64'.to_ip.eui_64(mac).to_i # Generate an EUI64 from the provided MAC address.\n key = [ ntp_time, system_id ].pack('QQ') # Pack the ntp timestamp and the system_id into a binary string\n global_id = Digest::SHA1.digest( key ).unpack('QQ').last & 0xffffffffff # Use only the last 40 bytes of the SHA1 digest.\n\n prefix =\n (126 << 121) + # 0xfc (bytes 0..6)\n ((locally_assigned ? 1 : 0) << 120) + # locally assigned? (byte 7)\n (global_id << 80) + # 40 bit global idenfitier (bytes 8..48)\n ((subnet_id & 0xffff) << 64) # 16 bit subnet_id (bytes 48..64)\n\n prefix.to_ip(Socket::AF_INET6).tap { |p| p.length = 64 }\n end", "title": "" }, { "docid": "547e22e2820c885d746d9410cfa8be96", "score": "0.7011633", "text": "def multicast_mac(options=nil)\n known_args = [:Objectify]\n objectify = false\n\n if (options)\n if (!options.kind_of? Hash)\n raise ArgumentError, \"Expected Hash, but #{options.class} provided.\"\n end\n NetAddr.validate_args(options.keys,known_args)\n\n if (options.has_key?(:Objectify) && options[:Objectify] == true)\n objectify = true\n end\n end\n\n if (@version == 4)\n if (@ip & 0xf0000000 == 0xe0000000)\n # map low order 23-bits of ip to 01:00:5e:00:00:00\n mac = @ip & 0x007fffff | 0x01005e000000\n else\n raise ValidationError, \"#{self.ip} is not a valid multicast address. IPv4 multicast \" +\n \"addresses should be in the range 224.0.0.0/4.\"\n end\n else\n if (@ip & (0xff << 120) == 0xff << 120)\n # map low order 32-bits of ip to 33:33:00:00:00:00\n mac = @ip & (2**32-1) | 0x333300000000\n else\n raise ValidationError, \"#{self.ip} is not a valid multicast address. IPv6 multicast \" +\n \"addresses should be in the range ff00::/8.\"\n end\n end\n\n eui = NetAddr::EUI48.new(mac)\n eui = eui.address if (!objectify)\n\n return(eui)\n end", "title": "" }, { "docid": "b110f8371bb5ae45753cbf3ddf2d88c2", "score": "0.68995744", "text": "def multicast_group\n IPAddr.new(address).hton + IPAddr.new(LOCAL_ADDRESS).hton\n end", "title": "" }, { "docid": "b973dfc44a1b763c21e24b110aa17fd9", "score": "0.6857859", "text": "def random_mac(oui=nil)\n mac_parts = [oui||DEFAULT_OUI]\n [0x7f, 0xff, 0xff].each do |limit|\n mac_parts << \"%02x\" % rand(limit + 1)\n end\n mac_parts.join('-')\nend", "title": "" }, { "docid": "356b1abe9bb72eaa1120159799d45fcf", "score": "0.68375605", "text": "def random_mac_addr(provider)\n symbol = provider.to_sym\n case symbol\n when :virtualbox\n PROVIDER_MAC_PREFIXES[:virtualbox] + 3.times.map { '%02x' % rand(0..255) }.join\n when :libvirt\n PROVIDER_MAC_PREFIXES[:libvirt] + 3.times.map { '%02x' % rand(0..255) }.join\n when :vmware_fusion\n PROVIDER_MAC_PREFIXES[:vmware] + 3.times.map { '%02x' % rand(0..255) }.join\n when :vmware\n PROVIDER_MAC_PREFIXES[:vmware] + 3.times.map { '%02x' % rand(0..255) }.join\n when :parallels\n PROVIDER_MAC_PREFIXES[:parallels] + 3.times.map { '%02x' % rand(0..255) }.join\n when :hyper_v\n PROVIDER_MAC_PREFIXES[:hyper_v] + 3.times.map { '%02x' % rand(0..255) }.join\n else\n raise \"Unsupported provider #{provider}\"\n end\nend", "title": "" }, { "docid": "cc3ec3a806e843c2560aaf7cc620fcdf", "score": "0.66943496", "text": "def mac_eth0\n eth0.mac_address\n end", "title": "" }, { "docid": "478068b026ee82b469468f3213db791c", "score": "0.6647405", "text": "def tap_mac\n\t\[email protected]_address.to_sockaddr[-6,6]\n\tend", "title": "" }, { "docid": "478068b026ee82b469468f3213db791c", "score": "0.6647405", "text": "def tap_mac\n\t\[email protected]_address.to_sockaddr[-6,6]\n\tend", "title": "" }, { "docid": "cae8dd1010b53b778f869bb60cf09ada", "score": "0.65428764", "text": "def tap_mac\n @sock.local_address.to_sockaddr[-6, 6]\n end", "title": "" }, { "docid": "dbfcf1f76d8ffcd87aa78cde21f95689", "score": "0.6522817", "text": "def mac_for_instance(num=nil)\n num = next_instance_to_start if num.nil?\n num = num.to_i if num.is_a?(String) and num =~ /^\\d+$/\n if !num.is_a? Fixnum or num < 0 or num > 255 \n raise TypeError, _('Argument must be an integer between 0 and 255')\n end\n offset = sprintf('%02x', num)\n mac = mac_base_addr.gsub(/00$/, offset)\n\n mac\n end", "title": "" }, { "docid": "c652a7342944566c765e607b8f9fc3bb", "score": "0.65095234", "text": "def prefix_from_multicast\n if ipv6? && multicast_from_prefix?\n prefix_length = (to_i >> 92) & 0xff\n if (prefix_length == 0xff) && (((to_i >> 112) & 0xf) >= 2)\n # Link local prefix\n #(((to_i >> 32) & 0xffffffffffffffff) + (0xfe80 << 112)).to_ip(Socket::AF_INET6).tap { |p| p.length = 64 }\n return nil # See http://redmine.ruby-lang.org/issues/5468\n else\n # Global unicast prefix\n (((to_i >> 32) & 0xffffffffffffffff) << 64).to_ip(Socket::AF_INET6).tap { |p| p.length = prefix_length }\n end\n end\n end", "title": "" }, { "docid": "75b40ae19a5457f61a793877e20420f7", "score": "0.64838856", "text": "def get_mac_address(pool, num)\n end_num = num.to_s(16)\n # mac_address = pool.starting_mac_address\n mac_address = '002440'\n mac_address = mac_address.ljust(12, \"0\")\n mac_address[mac_address.size - end_num.size, mac_address.size]= end_num\n mac_address = mac_address[0,2] + ':' + mac_address[2, 2] + ':' + mac_address[4,2] + ':' + mac_address[6,2] + ':' + mac_address[8,2] + ':' + mac_address[10,2]\n return mac_address\n end", "title": "" }, { "docid": "390b5cab25ca610ac7736fadb11f474d", "score": "0.6472574", "text": "def mac_address\n @mac_address ||= raw_data[22..27].join(':')\n end", "title": "" }, { "docid": "42b7baa288edf076f79a7e51834b1749", "score": "0.64233965", "text": "def mac_address(prefix: T.unsafe(nil)); end", "title": "" }, { "docid": "eee1f808ca1e729dbc4f2760d1278ead", "score": "0.6377844", "text": "def mac_addr\n if (mac_addr = @host.at('tag[name=mac-addr]'))\n mac_addr.inner_text\n end\n end", "title": "" }, { "docid": "439bc54785dbdcad707794cf173d1c1a", "score": "0.6304218", "text": "def mac_address\n super\n end", "title": "" }, { "docid": "b4a23d248a16413f694e811a4120b079", "score": "0.6213674", "text": "def mac_address\n if NicView.empty_mac?(self[\"CurrentMACAddress\"])\n self[\"PermanentMACAddress\"]\n elsif self[\"PermanentMACAddress\"]\n self[\"CurrentMACAddress\"]\n end\n end", "title": "" }, { "docid": "3b902d709dbca8df9a89707d20010b2a", "score": "0.6199512", "text": "def address\n @mac_address ||= addresses.first\n end", "title": "" }, { "docid": "1cda351db99ca60dd52668e95274d5f8", "score": "0.61694777", "text": "def calc_mac(base_mac, i = 1)\n mac_array = base_mac.split(/:/)\n\n mac_array[-1] = sprintf(\"%02x\", mac_array.last.hex + i).upcase\n mac_array.join(\":\")\nend", "title": "" }, { "docid": "d5bc2da122f3ca6235d5e222f7b76c9b", "score": "0.61413467", "text": "def create clock=nil, time=nil, mac_addr=nil\nc = t = m = nil\nDir.chdir Dir.tmpdir do\nunless FileTest.exist? STATE_FILE then\n# Generate a pseudo MAC address because we have no pure-ruby way\n# to know the MAC address of the NIC this system uses. Note\n# that cheating with pseudo arresses here is completely legal:\n# see Section 4.5 of RFC4122 for details.\nsha1 = Digest::SHA1.new\n256.times do\nr = [rand(0x100000000)].pack \"N\"\nsha1.update r\nend\nstr = sha1.digest\nr = rand 14 # 20-6\nnode = str[r, 6] || str\nnode[0] |= 0x01 # multicast bit\nk = rand 0x40000\nopen STATE_FILE, 'w' do |fp|\nfp.flock IO::LOCK_EX\nwrite_state fp, k, node\nfp.chmod 0o777 # must be world writable\nend\nend\nopen STATE_FILE, 'r+' do |fp|\nfp.flock IO::LOCK_EX\nc, m = read_state fp\nc = clock % 0x4000 if clock\nm = mac_addr if mac_addr\nt = time\nif t.nil? then\n# UUID epoch is 1582/Oct/15\ntt = Time.now\nt = tt.to_i*10000000 + tt.tv_usec*10 + 0x01B21DD213814000\nend\nc = c.succ # important; increment here\nwrite_state fp, c, m\nend\nend\n \ntl = t & 0xFFFF_FFFF\ntm = t >> 32\ntm = tm & 0xFFFF\nth = t >> 48\nth = th & 0x0FFF\nth = th | 0x1000\ncl = c & 0xFF\nch = c & 0x3F00\nch = ch >> 8\nch = ch | 0x80\npack tl, tm, th, cl, ch, m\nend", "title": "" }, { "docid": "4142d8df5be0557bc45204a5d797035f", "score": "0.6129608", "text": "def arp_dest_mac= i; typecast \"arp_dest_mac\", i; end", "title": "" }, { "docid": "3fa7f095c632613fbdebb151c41db78c", "score": "0.608408", "text": "def setup_multicast_socket\n set_membership(IPAddr.new(MULTICAST_IP).hton + IPAddr.new('0.0.0.0').hton)\n set_multicast_ttl(@ttl)\n set_ttl(@ttl)\n\n unless ENV[\"RUBY_TESTING_ENV\"] == \"testing\"\n switch_multicast_loop :off\n end\n end", "title": "" }, { "docid": "cde26c98644e0bd82b08482c874daada", "score": "0.6065346", "text": "def unique_id\n '%8x%s@%s' % [\n Time.now.to_i,\n Digest::SHA1.hexdigest(\n '%.8f%8x' % [ Time.now.to_f, rand(1 << 32) ]\n )[0, 32],\n Socket.gethostname\n ]\n end", "title": "" }, { "docid": "74f4a25e12a442fe45564808438d7f5d", "score": "0.6037271", "text": "def base_mac_address\n super\n end", "title": "" }, { "docid": "a2248d4bb3836ff3d418f4f569f2cd11", "score": "0.6030282", "text": "def setup_multicast_socket(socket, multicast_address)\n set_membership(socket,\n IPAddr.new(multicast_address).hton + IPAddr.new('0.0.0.0').hton)\n set_multicast_ttl(socket, MULTICAST_TTL)\n set_ttl(socket, MULTICAST_TTL)\n end", "title": "" }, { "docid": "642fad117197255dc909e7a3d8f8e236", "score": "0.60067874", "text": "def mac\n @mac || REXML::XPath.first(@definition, \"//domain/devices/interface/mac/@address\").value\n end", "title": "" }, { "docid": "e883c96c22218b6e5f995ae82246bce4", "score": "0.5995269", "text": "def multicast\n readConfig unless @@ClusterConfig\n addr=/<multicast addr=\"([^\"]*)\"/.match(@@ClusterConfig)\n return addr[1] unless addr.nil?\n end", "title": "" }, { "docid": "566e110d297467a2e3b78f6439fa475b", "score": "0.5992142", "text": "def generateEmailAddress()\n uuid = SecureRandom.hex(3)\n return \"%s.%[email protected]\" % [uuid, @MAILBOX]\n end", "title": "" }, { "docid": "05595041b510db50cc9f4b3edf5e8122", "score": "0.5988829", "text": "def getMAC\n tmpmac = \"\"\n if Stage.initial\n tmpmac = Convert.to_string(SCR.Read(path(\".etc.install_inf.HWAddr\")))\n end\n cleanmac = Builtins.deletechars(tmpmac != nil ? tmpmac : \"\", \":\")\n cleanmac\n end", "title": "" }, { "docid": "e101d449514a434cf547f23b565c5bc4", "score": "0.5985954", "text": "def format_mac_address\n self.mac_address = self.mac_address.to_s.upcase.gsub(/[^A-F0-9]/,'')\n end", "title": "" }, { "docid": "c5890dd86106eb093a1b9af200eea2ea", "score": "0.5976363", "text": "def new_socket\n membership = IPAddr.new(@broadcast).hton + IPAddr.new('0.0.0.0').hton\n ttl = [@ttl].pack 'i'\n\n socket = UDPSocket.new\n\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, membership\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_MULTICAST_LOOP, \"\\000\"\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_MULTICAST_TTL, ttl\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_TTL, ttl\n\n socket.bind '0.0.0.0', @port\n\n socket\n end", "title": "" }, { "docid": "ff4a74da554b79850306dff433f5d414", "score": "0.5971025", "text": "def multicast_embedded_rp\n raise 'Not a multicast address' if !multicast?\n raise 'Not an embedded-RP addredd' if !multicast_embedded_rp?\n\n riid = (@addr & (0xf << 104)) >> 104\n plen = (@addr & (0xff << 96)) >> 96\n prefix = (@addr & (((1 << plen) - 1) << (32 + (64 - plen)))) << 32\n group_id = @addr & 0xffffffff\n\n IPv6Addr.new(prefix | riid)\n end", "title": "" }, { "docid": "be0b4d5bdc1289aa3badaa402d24563b", "score": "0.59645635", "text": "def mac\n File.open(\"/sys/class/net/#{@name}/address\") do |f|\n f.read.chomp\n end\n end", "title": "" }, { "docid": "3c4e69e3634fd952d1df6b91af9f1b4a", "score": "0.59637934", "text": "def mac_masquerade_address\n super\n end", "title": "" }, { "docid": "3c4e69e3634fd952d1df6b91af9f1b4a", "score": "0.59637934", "text": "def mac_masquerade_address\n super\n end", "title": "" }, { "docid": "8a7af5d9b8a84815f7152697b3d995e2", "score": "0.59618783", "text": "def generate_by_vendor(vendor, opts = {})\n ouis = vendor_table[vendor]\n if ouis.nil? || ouis.empty?\n opts[:raising] ? raise(NotFoundOuiVendor, \"OUI not found for vendor: #{vendor}\") : (return nil)\n end\n oui = ouis[rand(ouis.size)]\n m1 = Address.new(oui[:prefix]).to_i\n m2 = rand(2**24)\n mac = m1 + m2\n Address.new(mac,\n name: vendor,\n address: oui[:address],\n iso_code: oui[:iso_code])\n end", "title": "" }, { "docid": "683cbc89cb2319b129ca0b61e6aeffab", "score": "0.59552795", "text": "def generate_ip\n crc32 = Zlib.crc32(self.id.to_s)\n offset = crc32.modulo(255)\n\n octets = [ 192..192,\n 168..168,\n 0..254,\n 1..254 ]\n ip = Array.new\n for x in 1..4 do\n ip << octets[x-1].to_a[offset.modulo(octets[x-1].count)].to_s\n end\n \"#{ip.join(\".\")}/24\"\n end", "title": "" }, { "docid": "ea784edb79f532e221d894ac52f0f45c", "score": "0.5942932", "text": "def mac_address\n raise ::Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n line=File.new(vmx_path).grep(/^ethernet0.generatedAddress =/)\n if line.nil?\n #Fission.ui.output \"Hmm, the vmx file #{vmx_path} does not contain a generated mac address \"\n return nil\n end\n address=line.first.split(\"=\")[1].strip.split(/\\\"/)[1]\n return address\n end", "title": "" }, { "docid": "bb8afb4af347bfd4a5882fc5cfcb0190", "score": "0.5942557", "text": "def arp_dest_mac; self[:arp_dest_mac].to_s; end", "title": "" }, { "docid": "f1ccd0998f188d7527fc44c2b687cd23", "score": "0.5936768", "text": "def mac_to_ip6_suffix(mac_i)\n mac = [\n mac_i & 0x00000000FFFFFFFF,\n (mac_i & 0xFFFFFFFF00000000) >> 32\n ]\n\n mlow = mac[0]\n eui64 = [\n 4261412864 + (mlow & 0x00FFFFFF),\n ((mac[1]+512)<<16) + ((mlow & 0xFF000000)>>16) + 0x000000FF\n ]\n\n return (eui64[1] << 32) + eui64[0]\n end", "title": "" }, { "docid": "de6cc6cf0d92b9a2c99d817797e74043", "score": "0.58998996", "text": "def getMAC(interface)\n cmd = `ifconfig #{interface}`\n mac = cmd.match(/(([A-F0-9]{2}:){5}[A-F0-9]{2})/i).captures\n @log.debug \"MAC of interface '#{interface}' is: #{mac.first}\"\n return mac.first\n end", "title": "" }, { "docid": "7610cd6b0dd5011b3e1807576839d710", "score": "0.58744156", "text": "def true_mac_address\n super\n end", "title": "" }, { "docid": "7610cd6b0dd5011b3e1807576839d710", "score": "0.58744156", "text": "def true_mac_address\n super\n end", "title": "" }, { "docid": "0e4cf9ab95272a1ec5326e04c96e4264", "score": "0.5841401", "text": "def generate_by_iso_code(iso_code, opts = {})\n ouis = iso_code_table[iso_code]\n if ouis.nil? || ouis.empty?\n opts[:raising] ? raise(NotFoundOuiVendor, \"OUI not found for iso code #{iso_code}\") : (return nil)\n end\n oui = ouis[rand(ouis.size)]\n m1 = Address.new(oui[:prefix]).to_i\n m2 = rand(2**24)\n mac = m1 + m2\n Address.new(mac,\n name: oui[:name],\n address: oui[:address],\n iso_code: iso_code)\n end", "title": "" }, { "docid": "807c331aea57d3c777d693ad5fc327d9", "score": "0.5841092", "text": "def get_macaddr\n currentEth = currentAddr = nil; macaddrs = {}\n `ifconfig`.split(\"\\n\").map! do |line|\n maybeEth = line.match(/([a-z]+[0-9]+): .*/)\n currentEth = maybeEth[1].strip if !maybeEth.nil?\n maybeAddr = line.match(/ether ([0-9 A-Ea-e \\:]+)/)\n currentAddr = maybeAddr[1].strip if !maybeAddr.nil?\n if currentEth != nil && currentAddr != nil\n macaddrs[currentEth] = currentAddr\n currentEth = currentAddr = nil\n end\n end\n macaddrs\nend", "title": "" }, { "docid": "fafe58b07c604b5eb24bb757de09f4e5", "score": "0.5837965", "text": "def base_multicast_address\n return nil if !connection_address\n connection_address.split('/', 2).first\n end", "title": "" }, { "docid": "4151015bacdb5540237a4ac4fbb0dcd0", "score": "0.5832882", "text": "def macify\n split(\":\").map {|a| a[0].chr == \"0\" ? a[1].chr : a}.join(\":\")\n end", "title": "" }, { "docid": "fd776ddf719bea769008b305ba0d5df5", "score": "0.5814486", "text": "def resolve_to_mac(input)\n if valid_mac?(input)\n return input\n end\n lookup_in_ethers(input)\n end", "title": "" }, { "docid": "64671d2e1defe2bcb1d8865a3a8a7270", "score": "0.58017915", "text": "def generate_serial_number_mac_address_mappings(pool)\n start_serial_number = pool.starting_serial_number\n start_mac_address = pool.starting_mac_address\n \n #generate array (serial_numbers), one serial number per row based on size of pool\n serial_numbers = []\n last_serial_number = get_last_serial_number(pool) + 1 \n (0..pool.size-1).each do |i| \n num = i + last_serial_number\n serial_numbers << get_serial_number(pool, num)\n end\n \n #generate array (mac_addresses), one mac address per row based on size of pool\n mac_addresses = []\n last_mac_address = 0\n if is_zigbee?(pool) || is_gateway?(pool) #checks device_type.mac_address_type (zigbee = 0, gateway = 1)\n last_mac_address = get_last_mac_address(pool) + 1\n end\n \n (0..pool.size-1).each do |i|\n num = i + last_mac_address\n if is_zigbee?(pool) || is_gateway?(pool)\n mac_addresses << get_mac_address(pool, num)\n else\n mac_addresses << ''\n end\n end\n \n #add a new device for each row in the pool and save the pool\n Device.transaction do\n (0..pool.size-1).each do |i|\n device = Device.new(:active => false, :pool_id => pool.id, :serial_number => serial_numbers[i], :mac_address => mac_addresses[i])\n device.save!\n end\n pool.ending_serial_number = serial_numbers[pool.size - 1]\n pool.ending_mac_address = mac_addresses[pool.size - 1]\n pool.save!\n end\n end", "title": "" }, { "docid": "f8bce2f07faed5550097fbcd8ed31055", "score": "0.5799314", "text": "def generate\n blake160_bin = [blake160[2..-1]].pack(\"H*\")\n type = [\"01\"].pack(\"H*\")\n bin_idx = [\"P2PH\".each_char.map { |c| c.ord.to_s(16) }.join].pack(\"H*\")\n payload = type + bin_idx + blake160_bin\n ConvertAddress.encode(@prefix, payload)\n end", "title": "" }, { "docid": "149038565121de12f83b9853d2a69db8", "score": "0.5790264", "text": "def get_mac_address(addresses)\n detected_addresses = addresses.detect { |address, keypair| keypair == { \"family\" => \"lladdr\" } }\n if detected_addresses\n detected_addresses.first\n else\n \"\"\n end\n end", "title": "" }, { "docid": "187adb6aeb697c321eae9df977c52a64", "score": "0.5780405", "text": "def read_mac_address\n end", "title": "" }, { "docid": "7f7f32ccc958a709b09bb77a089dccf6", "score": "0.5773553", "text": "def format_mac_address\n\t\tself.mac_address = self.mac_address.to_s().upcase().gsub( /[^A-F0-9]/, '' )\n\tend", "title": "" }, { "docid": "1dcdc9a2c44b0c219f5e72a5b2b00aa5", "score": "0.5764265", "text": "def gen_ip_addresses(max=20)\n (1..max).map do |octet|\n \"192.168.#{octet}.1\"\n end\nend", "title": "" }, { "docid": "fc4dc208ba978ab71994259850093baa", "score": "0.5754572", "text": "def manufacturer_id\n mac[0..7]\n end", "title": "" }, { "docid": "ffc245461fa55d8810aec7674d13297c", "score": "0.5737301", "text": "def arp_saddr_mac\n\t\tEthHeader.str2mac(self[:arp_src_mac].to_s)\n\tend", "title": "" }, { "docid": "9e91f8c3d32ad3cee4ad52a02617c4c2", "score": "0.5734914", "text": "def eui_64(mac)\n if @family != Socket::AF_INET6\n raise Exception, \"EUI-64 only makes sense on IPv6 prefixes.\"\n elsif self.length != 64\n raise Exception, \"EUI-64 only makes sense on 64 bit IPv6 prefixes.\"\n end\n if mac.is_a? Integer\n mac = \"%:012x\" % mac\n end\n if mac.is_a? String\n mac.gsub!(/[^0-9a-fA-F]/, \"\")\n if mac.match(/^[0-9a-f]{12}/).nil?\n raise ArgumentError, \"Second argument must be a valid MAC address.\"\n end\n e64 = (mac[0..5] + \"fffe\" + mac[6..11]).to_i(16) ^ 0x0200000000000000\n IPAddr.new(self.first.to_i + e64, Socket::AF_INET6)\n end\n end", "title": "" }, { "docid": "76dc71c55da9f969c0ef451c9e1ff776", "score": "0.5668745", "text": "def generate_uuid\n hex = []\n (0..9).each { |i| hex << i.to_s }\n ('a'..'f').each { |l| hex << l }\n\n result = []\n sections = [8, 4, 4, 4, 12]\n\n sections.each do |num|\n num.times do \n result << hex[rand(16)]\n end\n result << '-'\n end\n\n result.join.chop\nend", "title": "" }, { "docid": "97231b5486b5191757d032f9f41d7ab5", "score": "0.56660604", "text": "def arp_src_mac= i; typecast \"arp_src_mac\", i; end", "title": "" }, { "docid": "9436b84f3edd65bc8ef4bafcab450bf8", "score": "0.5660079", "text": "def gen_uuid\n arr = [('a'..'f'), (0..9)].map{|i| i.to_a}.flatten\n uuid = \"\"\n 8.times {uuid << arr[rand(16)].to_s} ; uuid << \"-\"\n 3.times {4.times {uuid << arr[rand(16)].to_s} ; uuid << \"-\"}\n 12.times {uuid << arr[rand(16)].to_s}\n uuid\nend", "title": "" }, { "docid": "3ddc8e2148d9ecbf0cdb0e62f8175368", "score": "0.5654575", "text": "def mac(string)\n Digest::SHA256.new.update(string).hexdigest.upcase\n end", "title": "" }, { "docid": "92dbef5632ded36d55c488303829dcde", "score": "0.56480324", "text": "def mac_address\n mac = nil\n\n ovf.xpath(\"//*[local-name()='Machine']/*[local-name()='Hardware']/*[local-name()='Network']/*[local-name()='Adapter']\").each do |net|\n if net.attribute(\"enabled\").value == \"true\"\n mac = net.attribute(\"MACAddress\").value\n break\n end\n end\n\n if mac\n return mac\n else\n fail Errors::BoxAttributeError, error_message: 'Could not determine mac address'\n end\n end", "title": "" }, { "docid": "7c4cc08b94b258ee21fa36d82270eff6", "score": "0.5631476", "text": "def socket\n @socket ||= UDPSocket.new.tap do |socket|\n socket.setsockopt Socket::IPPROTO_IP,\n Socket::IP_ADD_MEMBERSHIP,\n multicast_group\n socket.setsockopt Socket::IPPROTO_IP,\n Socket::IP_MULTICAST_TTL,\n 1\n socket.setsockopt Socket::SOL_SOCKET,\n Socket::SO_REUSEPORT,\n 1 \n end\n end", "title": "" }, { "docid": "2ecb7290935a46b38536c54dcb826d82", "score": "0.5621302", "text": "def generate_node_number\n seed_data = if node['fqdn'].nil?\n \"#{node['ipaddress']}#{node['macaddress']}#{node['ip6address']}\"\n else\n node['fqdn']\n end\n Digest::MD5.hexdigest(seed_data).unpack1('L')\n end", "title": "" }, { "docid": "72db730b26d62f27e2480dba0d836ecf", "score": "0.5599436", "text": "def read_mac_address\n execute(:get_network_mac, VmId: vm_id)\n end", "title": "" }, { "docid": "13e0d5ce36707b950fc2d897642820c2", "score": "0.5581042", "text": "def mac\n @attributes.fetch('mac', nil)\n end", "title": "" }, { "docid": "2e9ce564a928129535abaf94a3d70002", "score": "0.5568473", "text": "def to_source; \"* = $#{@addr.to_s(16)}\"; end", "title": "" }, { "docid": "c42745c0425398c9e5dc70bde76a7539", "score": "0.5567835", "text": "def get_fusion_vm_mac(options)\n options['mac'] = \"\"\n options['search'] = \"ethernet0.address\"\n options['mac'] = get_fusion_vm_vmx_file_value(options)\n if not options['mac']\n options['search'] = \"ethernet0.generatedAddress\"\n options['mac'] = get_fusion_vm_vmx_file_value(options)\n end\n return options['mac']\nend", "title": "" }, { "docid": "a709b03488270994763eed3a0765e11c", "score": "0.55603963", "text": "def generate_random_email\n # random_number = rand(1000000 .. 9000000)\n random_number = Time.now.getlocal.to_s.delete \"- :\"\n \"ruslan.yagudin+#{random_number}@flixster-inc.com\"\nend", "title": "" }, { "docid": "9578e1ed754e695a063874d19eda246b", "score": "0.55502975", "text": "def cisco_rand\n rand(1 << 24)\n end", "title": "" }, { "docid": "25f0ceb74639c45a402b15eb6e51a286", "score": "0.55448246", "text": "def create_uuid\n uuid = ''\n sections = [8, 4, 4, 4, 12]\n\n sections.each do |section|\n section.times { uuid += HEX.sample }\n uuid += '-' unless section == 12\n end\n \n uuid\nend", "title": "" }, { "docid": "302e344c769e4b2b4fd19c508b01d883", "score": "0.55408406", "text": "def make_uuid()\n uuid = \"\"\n 8.times { uuid << rand(16).to_s(16) }\n uuid << \"-\"\n 3.times do\n 4.times { uuid << rand(16).to_s(16) }\n uuid << \"-\"\n end\n 12.times { uuid << rand(16).to_s(16) }\n \n uuid\nend", "title": "" }, { "docid": "72268fa36b39d7a8fad829133ab35246", "score": "0.5530096", "text": "def id\n m = /ether\\s+(\\S+)/.match(`ifconfig wlan0`)\n return nil if m.nil?\n mac = m[1] # WLAN mac address\n return nil if mac.nil?\n MAC2ID[mac.downcase]\n end", "title": "" }, { "docid": "3b55ae5785b6549f86374554d8ab1c40", "score": "0.55300075", "text": "def generate_random_email_address\n random_email_account = SecureRandom.hex(@number_of_random_characters)\n random_domain_name = SecureRandom.hex(@number_of_random_characters)\n return random_email_account + \"@\" + random_domain_name + @email_suffix\n end", "title": "" }, { "docid": "204652707b8290b6d01c44ab001120d6", "score": "0.5521588", "text": "def random_unused_loopback_ip\n [127, *(0...3).map { (rand(127) + 128)}].map(&:to_s).join('.')\n end", "title": "" }, { "docid": "9f00687f1019886ebae6538305f4c986", "score": "0.55165833", "text": "def arp_src_mac; self[:arp_src_mac].to_s; end", "title": "" }, { "docid": "cb15e377055da23533118112b6d0940e", "score": "0.5513171", "text": "def generate_id\n SecureRandom.hex(8)\n end", "title": "" }, { "docid": "a1a9e7b0e38391225df88f3f29db43fa", "score": "0.5506316", "text": "def calc_cmc_mac(base_mac, i = 1)\n mac_array = base_mac.split(/:/)\n mac_array[-2] = \"F%d\" % [i / 100]\n mac_array[-1] = \"%02d\" % [i % 100]\n mac_array.join(\":\")\nend", "title": "" }, { "docid": "7c46fb6f3e0c16aea863a7a6ad504141", "score": "0.5505821", "text": "def add_mac_colon!\n unless mac.include? ':'\n self.mac = mac.to_s.chars.each_slice(2).map(&:join).join(':')\n end\n end", "title": "" }, { "docid": "7c46fb6f3e0c16aea863a7a6ad504141", "score": "0.5505821", "text": "def add_mac_colon!\n unless mac.include? ':'\n self.mac = mac.to_s.chars.each_slice(2).map(&:join).join(':')\n end\n end", "title": "" }, { "docid": "dd4e774d843e452452032c2c98c83418", "score": "0.5505125", "text": "def get_mac_for_interface(interfaces, interface)\n interfaces[interface][:addresses].find { |k, v| v[\"family\"] == \"lladdr\" }.first unless interfaces[interface][:addresses].nil? || interfaces[interface][:flags].include?(\"NOARP\")\n end", "title": "" }, { "docid": "8c8d578488a229e628ac1a88e9c2baba", "score": "0.5493683", "text": "def generate_uuid\n hexadecimals = ('0'..'9').to_a.concat(('a'..'f').to_a)\n uuid = ''\n\n 32.times do\n uuid += hexadecimals.sample\n end\n uuid.insert(8, '-').insert(13, '-').insert(18, '-').insert(23, '-')\nend", "title": "" }, { "docid": "aa2f1488461296f8e7e748fe57c2ddd2", "score": "0.5491149", "text": "def create_socket\n\t\tiaddr = self.class.bind_addr\n\t\tsocket = UDPSocket.new\n\n\t\tsocket.setsockopt( :IPPROTO_IP, :IP_ADD_MEMBERSHIP, iaddr )\n\t\tsocket.setsockopt( :IPPROTO_IP, :IP_MULTICAST_TTL, self.class.multicast_ttl )\n\t\tsocket.setsockopt( :IPPROTO_IP, :IP_MULTICAST_LOOP, 1 )\n\t\tsocket.setsockopt( :SOL_SOCKET, :SO_REUSEPORT, 1 )\n\n\t\treturn socket\n\tend", "title": "" }, { "docid": "482d2afae9299c21296a3a73924c3bbd", "score": "0.5490844", "text": "def generate_UUID\n # build hex string to randomly pick from:\n uuid = \"\"\n hex_array = []\n (0..9).each { |num| hex_array << num.to_s }\n ('a'..'f').each { |char| hex_array << char }\n\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do | section, index|\n section.times { uuid << hex_array.sample }\n uuid << '-' unless index >= sections.size-1\n end\n uuid\nend", "title": "" }, { "docid": "5e3f9670df969b1be442bee527750ac1", "score": "0.5481892", "text": "def read_mac_address\n hw_info = read_settings.fetch('Hardware', {})\n shared_ifaces = hw_info.select do |name, params|\n name.start_with?('net') && params['type'] == 'shared'\n end\n\n raise Errors::SharedInterfaceNotFound if shared_ifaces.empty?\n\n shared_ifaces.values.first.fetch('mac', nil)\n end", "title": "" }, { "docid": "827cef07b60f4042deec7b645d192fed", "score": "0.54753065", "text": "def arp_daddr_mac\n\t\tEthHeader.str2mac(self[:arp_dest_mac].to_s)\n\tend", "title": "" }, { "docid": "07248037637882a743254610ec3e5831", "score": "0.54690254", "text": "def dest_mac\n self[:dest_mac]\n end", "title": "" }, { "docid": "8575de8eaf0556366345c4463159cd3d", "score": "0.54653805", "text": "def get_mac_address\n IO.popen(\"ifconfig\") do |io|\n while line = io.gets\n return $1 if (line =~ /HWaddr ([A-Z0-9:]+)/)\n end\n end\n return nil\nend", "title": "" }, { "docid": "ef8dfb7aab87902606da4e2b01caa2de", "score": "0.54595697", "text": "def generate_UUID_1\n uuid = ''\n hex_index = (0..15)\n hex_values = ('0'..'9').to_a + ('a'..'f').to_a\n\n (0..8).each do |num|\n uuid << hex_values[rand(hex_index)]\n end\n uuid << '-'\n (0..4).each do |num|\n uuid << hex_values[rand(hex_index)]\n end\n uuid << '-'\n (0..4).each do |num|\n uuid << hex_values[rand(hex_index)]\n end\n uuid << '-'\n (0..12).each do |num|\n uuid << hex_values[rand(hex_index)]\n end\n uuid\nend", "title": "" }, { "docid": "1942aab567ae19846c9f62af66f23f9c", "score": "0.54578304", "text": "def address\n return @mac_address if defined? @mac_address and @mac_address\n re = %r/[^:\\-](?:[0-9A-F][0-9A-F][:\\-]){5}[0-9A-F][0-9A-F][^:\\-]/io\n cmds = '/sbin/ifconfig', '/bin/ifconfig', 'ifconfig', 'ipconfig /all', 'cat /sys/class/net/*/address'\n\n null = test(?e, '/dev/null') ? '/dev/null' : 'NUL'\n\n output = nil\n cmds.each do |cmd|\n begin\n r, w = IO.pipe\n ::Process.waitpid(spawn(cmd, :out => w))\n w.close\n stdout = r.read\n next unless stdout and stdout.size > 0\n output = stdout and break\n rescue\n # go to next command!\n end\n end\n raise \"all of #{ cmds.join ' ' } failed\" unless output\n\n @mac_address = parse(output)\n end", "title": "" }, { "docid": "a7c8ebfa9b95660206fe8e1b9691aab1", "score": "0.5457541", "text": "def pretty\n\t\tmacocts = []\n\t\tmac_addr.each_byte { |o| macocts << o }\n\t\tmacocts += [0] * (6 - macocts.size) if macocts.size < 6\n\t\treturn sprintf(\n\t\t\t\t\"#{mac_name}\\n\" +\n\t\t\t\t\"Hardware MAC: %02x:%02x:%02x:%02x:%02x:%02x\\n\" +\n\t\t\t\t\"IP Address : %s\\n\" +\n\t\t\t\t\"Netmask : %s\\n\" +\n\t\t\t\t\"\\n\", \n\t\t\t\tmacocts[0], macocts[1], macocts[2], macocts[3], \n\t\t\t\tmacocts[4], macocts[5], ip, netmask)\n\tend", "title": "" }, { "docid": "8a2d75bc0fbb84ba3383f071d9a29857", "score": "0.5454102", "text": "def setup( mac, ip = '255.255.255.255' )\n \n @magic ||= (\"\\xff\" * 6)\n \n # Validate MAC address and craft the magic packet\n raise AddressException,\n 'Invalid MAC address' unless self.valid_mac?( mac )\n mac_addr = mac.split(/:/).collect {|x| x.hex}.pack('CCCCCC')\n @magic[6..-1] = (mac_addr * 16)\n \n # Validate IP address\n raise AddressException,\n 'Invalid IP address' unless self.valid_ip?( ip )\n @ip_addr = ip\n \n end", "title": "" } ]
f6507bae5f8bf67a5abfe74cf55baaee
Returns a collection of subject alternative names requested. If no alternative names were requested, this returns an empty set.
[ { "docid": "3d0e42cf6354a07ebf7d84761820a44d", "score": "0.7841749", "text": "def subject_alternative_names\n @_subject_alternative_names ||= begin\n if attribute = read_attributes_by_oid('extReq', 'msExtReq')\n set = OpenSSL::ASN1.decode(attribute.value)\n seq = set.value.first\n if sans = seq.value.collect { |asn1ext| OpenSSL::X509::Extension.new(asn1ext).to_a }.detect { |e| e.first == 'subjectAltName' }\n sans[1].gsub(/DNS:/,'').split(', ')\n else\n []\n end\n else\n []\n end\n end\n end", "title": "" } ]
[ { "docid": "d8bbb64e37068744730da7f311111394", "score": "0.6685873", "text": "def subject_names\n @subject_names ||= sw_subject_names\n end", "title": "" }, { "docid": "90a58f32cc79ffd88e877a4425885254", "score": "0.61344117", "text": "def alternative_full_names\n @alternative_full_names ||= []\n end", "title": "" }, { "docid": "fe9308f33e9581efcf56e76add36514d", "score": "0.59845996", "text": "def subject_alternative_name\n extensions[R509::Cert::Extensions::SubjectAlternativeName]\n end", "title": "" }, { "docid": "c2a43e37cf7ab3ef86f7079afca31a3e", "score": "0.59692734", "text": "def subject_keywords\n adverbs = spec_keywords('subject')\n end", "title": "" }, { "docid": "cfc17de812f9d2cf6b662ed305fba3e1", "score": "0.5956588", "text": "def subjects\n bib_subjects || get_item_data_by_name('Subject')\n end", "title": "" }, { "docid": "f51bd9a3073cbb17fd4e6040ede942e1", "score": "0.59104323", "text": "def handle_subject_alternative_names(cert, factory, alt_names)\n fail 'alt_names must be an Array' unless alt_names.is_a?(Array)\n\n name_list = alt_names.map { |m| \"DNS:#{m}\" }.join(',')\n ext = factory.create_ext('subjectAltName', name_list, false)\n cert.add_extension(ext)\n end", "title": "" }, { "docid": "f446880cb2e41d5655779591f72e17e1", "score": "0.5831819", "text": "def subject_names\n ret = []\n if cn = self.subject_component('CN')\n ret << cn\n end\n # Merge in san_names if we got anything.\n if sn = self.san_names\n ret.concat(sn)\n end\n\n return ret.sort.uniq\n end", "title": "" }, { "docid": "b1edf7e696cec8f3f913fe62edf47084", "score": "0.57068247", "text": "def subject_taxon_name_ids\n return taxon_name_id if !taxon_name_id.empty? # only one or the other supposed to be sent\n return subject_taxon_name_id if !subject_taxon_name_id.empty?\n return []\n end", "title": "" }, { "docid": "d3655d0b0cb1ec388ba484ab8a09e9fd", "score": "0.56748164", "text": "def alternative_full_names_without_diacritics\n @alternative_full_names_without_diacritics ||= []\n end", "title": "" }, { "docid": "7b1a9b2e7732587e0a752f35883b9805", "score": "0.56416965", "text": "def all_subjects\n observations + profile_users + glossary_terms\n end", "title": "" }, { "docid": "6a6422bb5771c1a69084a6d7dfd9b179", "score": "0.56266445", "text": "def unfinished_external_subjects\n PlanSubject.find_unfinished_external(self).map {|ps| ps.subject}\n end", "title": "" }, { "docid": "2054cf1898c598313b27110c69120821", "score": "0.55714047", "text": "def subject_titles\n @subject_titles ||= sw_subject_titles\n end", "title": "" }, { "docid": "aeb793e7ff07872fdda224a1e7678939", "score": "0.5452236", "text": "def x509v3_subject_alternative_name\n @x509v3_subject_alternative_name ||= if (node = @node.search('X509v3SubjectAlternativeName'))\n X509v3SubjectAlternativeName.new(node)\n end\n end", "title": "" }, { "docid": "724d4eca2d457e8d0af86c530a6adb16", "score": "0.5438089", "text": "def all_names\n ret = []\n ret << @subject.CN unless @subject.CN.nil?\n ret.concat(self.san.names.map { |n| n.value }) unless self.san.nil?\n\n ret.sort.uniq\n end", "title": "" }, { "docid": "3559d2e0fe6d70fc60d0655841a44df6", "score": "0.54012114", "text": "def get_ead_subject_facets(subjects = Array.new)\n subjects << search(\"//*[local-name()='subject' or local-name()='function' or local-name() = 'occupation']\")\n return clean_facets_array(subjects.flatten.map(&:text))\n end", "title": "" }, { "docid": "562928328379f7d1ac16a18ee0b77041", "score": "0.52637094", "text": "def subject_results\n env.subjects.map(&method(:subject_result))\n end", "title": "" }, { "docid": "4a3cf96f5a433c0c48afa886899282f8", "score": "0.5262247", "text": "def subjects\n curriculums = self.curriculums\n out = []\n\n unless curriculums.empty?\n qualifications = curriculums.collect{ |c| c.qualification }\n\n unless qualifications.empty?\n out = qualifications.collect{ |q| q.subject }\n end\n end\n\n out\n end", "title": "" }, { "docid": "0f380e907a0b4d7ee0c2094f64186684", "score": "0.52323395", "text": "def unfinished_subjects(param = nil)\n @unfinished_subjects ||= plan_subjects - self.finished_subjects\n\n if param == :subjects\n return @unfinished_subjects.map {|p| p.subject}\n else\n return @unfinished_subjects\n end\n end", "title": "" }, { "docid": "04052739847457e017dc65228ac83111", "score": "0.5230114", "text": "def index\n @alternative_tag_names = AlternativeTagName.all\n end", "title": "" }, { "docid": "2e308b952b6e783db1ebf5ad04034ca4", "score": "0.52251977", "text": "def subject_all_search\n vals = topic_search ? Array.new(topic_search) : []\n vals.concat(geographic_search) if geographic_search\n vals.concat(subject_other_search) if subject_other_search\n vals.concat(subject_other_subvy_search) if subject_other_subvy_search\n vals.empty? ? nil : vals\n end", "title": "" }, { "docid": "ae52a81ea6fd794cdc4add9ac65658dc", "score": "0.52229494", "text": "def subject_list\n list = []\n subjects.each { |subject| list << subject.name }\n list.to_sentence\n end", "title": "" }, { "docid": "d07072e65d9601cad5167936dc3e27e0", "score": "0.5214653", "text": "def sw_subject_names(sep = ', ')\n mods_ng_xml.subject.name_el\n .select { |n_el| n_el.namePart }\n .map { |name_el_w_np| name_el_w_np.namePart.map(&:text).reject(&:empty?) }\n .reject(&:empty?)\n .map { |parts| parts.join(sep).strip }\n end", "title": "" }, { "docid": "de4db6dc84a472accb7b430fbf9c62b8", "score": "0.51511353", "text": "def all_subjects\n Subject.current.where(site_id: all_editable_sites.select(:id))\n end", "title": "" }, { "docid": "5cf6aeacc107e58aac63e77cb0db0852", "score": "0.515081", "text": "def extensions\n # ln_sn, value, critical\n [['subjectAltName', \"DNS:#{domain}\", false]]\n end", "title": "" }, { "docid": "d77fdf4b1ad9a630b17febf7c0ac3d7c", "score": "0.5150562", "text": "def subject_topics\n @subject_topics ||= term_values([:subject, :topic])\n end", "title": "" }, { "docid": "ff4b66eea260ecb3f9f1b0a04a362dcd", "score": "0.5125866", "text": "def subject_other_search\n @subject_other_search ||= begin\n vals = subject_occupations ? Array.new(subject_occupations) : []\n vals.concat(subject_names) if subject_names\n vals.concat(subject_titles) if subject_titles\n vals.empty? ? nil : vals\n end\n end", "title": "" }, { "docid": "775b31f979d7fc78f335bace41b328e2", "score": "0.5118016", "text": "def available_speaker_names\n if presentations.present?\n presentations.map{|p| p.speaker_names}.flatten.uniq.join(', ')\n else\n speaker_names\n end\n end", "title": "" }, { "docid": "b31a67af1334936b44634e685ec663aa", "score": "0.5108397", "text": "def get_all\n get_countries_if_necessary\n get_subjects_if_necessary\n get_qualifications_if_necessary\n end", "title": "" }, { "docid": "3748fe0c979c749bd5027b09bc99cd0e", "score": "0.5048632", "text": "def subject_contains\n return @subject_contains\n end", "title": "" }, { "docid": "8fbab3e53f16bc7cab204097e2a439bd", "score": "0.5040984", "text": "def articlePartialMatchNames\n names = []\n if partial_name_match #If partial name matches are allowed for this place\n #Add any words required for a match before each trimmed name\n if before_name_article_accept_strings.length != 0\n\ttrimmed_names.uniq.each do |name|\n\t before_name_article_accept_strings.each do |string|\n\t names << string + \" \" + name\n\t end\n\tend\n else\n\tnames += trimmed_names\n end\n end\n names\n end", "title": "" }, { "docid": "382aeba9e87225f91ca1cde0eea56773", "score": "0.5021444", "text": "def legal_emails\n %w[[email protected]\n [email protected]\n [email protected]\n [email protected]\n [email protected]\n [email protected]\n [email protected]]\n end", "title": "" }, { "docid": "df470af90a0e3c70ed8fd55f7389bc2e", "score": "0.5005033", "text": "def all_name_strings\n names.collect { |a| a.name }\n end", "title": "" }, { "docid": "8b990f2a3f29563d2c0f82c15b9aabdb", "score": "0.49946865", "text": "def extract_subjects(subject)\n if subject.is_a?(Hash) && subject.key?(:any)\n subject[:any]\n else\n [subject]\n end\n end", "title": "" }, { "docid": "e92ce55a7e7e44c5e76d467095d35c40", "score": "0.49471262", "text": "def available_locales\n init_names unless init_names?\n names.keys\n end", "title": "" }, { "docid": "d918c32e0a158ae6608c10cd965b2d57", "score": "0.4946637", "text": "def get_instructor_names(instructors)\n instructors.map do |instructor|\n instructor[:name]\n end.uniq\nend", "title": "" }, { "docid": "a49776e6712c3c4f6a1ce76fc61c6a7b", "score": "0.49371952", "text": "def names\n collect { |a| a.name }\n end", "title": "" }, { "docid": "3723f695ff52923c4c1d8f4a05e5c82a", "score": "0.49209937", "text": "def alternative_full_names=(alternative_full_name)\n if alternative_full_name && alternative_full_name.is_a?(String)\n @alternative_full_names ||= []\n @alternative_full_names << alternative_full_name.strip\n end\n end", "title": "" }, { "docid": "8f4e4ac579860e7c3341ec466265d03c", "score": "0.49076864", "text": "def subject_name\n subjects.any? ? subjects.first.name : nil\n end", "title": "" }, { "docid": "127739e7ca7ca644cb4ac72422c409b3", "score": "0.490571", "text": "def subjects\r\n subjects = []\r\n range =\"#{group[:first_message]}-\"\r\n connection.query(:xhdr, \"Subject\", range) do |status, data|\r\n if status[:code] == 221\r\n data.each do |line|\r\n message = Message.new\r\n message.num, message.subject = line.split(' ', 2)\r\n subjects << message\r\n end\r\n end\r\n end\r\n subjects\r\n end", "title": "" }, { "docid": "22302448f0890bdf7227fcfc6f4519b9", "score": "0.48977286", "text": "def cellect_subjects(workflow_id)\n cellect.get '/subjects', workflow_id: workflow_id\n end", "title": "" }, { "docid": "c5037298ccc72aa88bab1851a1ae4dc6", "score": "0.48796877", "text": "def process_subjects(subjects_arr)\n return_arr = []\n subjects_arr.each do |subject|\n unless subject['_resolved'].blank?\n return_arr.push(subject['_resolved'])\n end\n end\n return_arr\n end", "title": "" }, { "docid": "56c876183cb08d7b6873cf1356be4006", "score": "0.48599842", "text": "def name_constraints\n extensions[R509::Cert::Extensions::NameConstraints]\n end", "title": "" }, { "docid": "a04e0c86f7622964cb94e79bd6225249", "score": "0.48587734", "text": "def subject_other_subvy_search\n @subject_other_subvy_search ||= begin\n vals = subject_temporal ? Array.new(subject_temporal) : []\n gvals = term_values([:subject, :genre])\n vals.concat(gvals) if gvals\n\n # print a message for any temporal encodings\n subject.temporal.each { |n|\n sw_logger.info(\"#{druid} has subject temporal element with untranslated encoding: #{n.to_xml}\") unless n.encoding.empty?\n }\n\n vals.empty? ? nil : vals\n end\n end", "title": "" }, { "docid": "0f5651d81a98b53ba4229d46742936b7", "score": "0.48570082", "text": "def subjects_without_concidering_versions(options={})\n render_without_concidering_versions(options.merge(:only => :subjects)) unless @subjects_rendered\n @subjects\n end", "title": "" }, { "docid": "c1a493ccaf54658671f7fab3e3644802", "score": "0.48554903", "text": "def articleFullyQualifiedMatchNames\n #Add raw_names and article_match strings first\n names = []\n #Add any words required for a match before each name\n if before_name_article_accept_strings.length != 0\n raw_names.each do |name|\n\tbefore_name_article_accept_strings.each do |string|\n\t names << string + \" \" + name\n\tend\n end\n else\n names = raw_names\n end\n\n #Add additional article matches to the list\n if(!match_names.nil?)\n names += match_names.downcase.split(%r{,\\s*})\n end\n names\n end", "title": "" }, { "docid": "9ade6b6433f37128d5b470f66211ec30", "score": "0.48334894", "text": "def subjects\n links = frm.table(:class=>\"listHier\").links.find_all { |link| link.title=~/View announcement/ }\n subjects = []\n links.each { |link| subjects << link.text }\n return subjects\n end", "title": "" }, { "docid": "e99778507c49b4dce52ab139c0e6b621", "score": "0.48328325", "text": "def names\n get('names')\n end", "title": "" }, { "docid": "8990591984d32c9148fe10431eafb450", "score": "0.47934932", "text": "def names\n [@name] + @aliases\n end", "title": "" }, { "docid": "31ce24956f5b358f9ca6b5a68dcace66", "score": "0.47908157", "text": "def nouns\n\t\treturn synsets_dataset.nouns\n\tend", "title": "" }, { "docid": "8e36cfd1487cdb572ef6f5beb3bd909e", "score": "0.4786358", "text": "def _autonyms\n @autonyms\n end", "title": "" }, { "docid": "592828b5e3aa56581ad0fd96fb01fc23", "score": "0.4784616", "text": "def available_letters\n ltrs = []\n letter_set.letter_amount_points.each do |k, v|\n ltrs << k.to_s unless k == '?'\n end\n return ltrs.sort\n end", "title": "" }, { "docid": "1e116483df3caec0dcae2f0528c42106", "score": "0.47725642", "text": "def subject_search_index\n subjects.pluck(:name)\n end", "title": "" }, { "docid": "77787d17e579dd0070492b54c8c04c09", "score": "0.47700617", "text": "def given_names\n get_attribute(Yoti::Attribute::GIVEN_NAMES)\n end", "title": "" }, { "docid": "8b22d38f15dd78bd39af160620607bef", "score": "0.47599182", "text": "def active_subject_results\n active_subjects.map(&method(:subject_result))\n end", "title": "" }, { "docid": "824be9a61fbd861c042ce6d130cee22b", "score": "0.47568503", "text": "def adjective_satellites\n\t\treturn synsets_dataset.adjective_satellites\n\tend", "title": "" }, { "docid": "5998f6d5e2c97210e8322dbca8569c89", "score": "0.47551394", "text": "def get_names(instructors)\n instructors.map do |instructor|\n instructor[:name]\n end\nend", "title": "" }, { "docid": "f85d6867632d53198ace87c0715e5e1c", "score": "0.47450638", "text": "def subjectify(options = {})\n result = []\n all_subjects = []\n sub_array = []\n options[:value].each_with_index do |subject, i|\n spl_sub = subject.split(QUERYSEP)\n sub_array << []\n subject_accum = ''\n spl_sub.each_with_index do |subsubject, j|\n spl_sub[j] = subject_accum + subsubject\n subject_accum = spl_sub[j] + QUERYSEP\n sub_array[i] << spl_sub[j]\n end\n all_subjects[i] = subject.split(QUERYSEP)\n end\n options[:value].each_with_index do |_subject, i|\n lnk = ''\n lnk_accum = ''\n all_subjects[i].each_with_index do |subsubject, j|\n lnk = lnk_accum + link_to(subsubject,\n \"/?f[subject_facet][]=#{CGI.escape sub_array[i][j]}\",\n class: 'search-subject', title: \"Search: #{sub_array[i][j]}\")\n lnk_accum = lnk + content_tag(:span, SEPARATOR, class: 'subject-level')\n end\n result << sanitize(lnk)\n end\n result\n end", "title": "" }, { "docid": "e1fa6b04fce246aa306706aa66f7de46", "score": "0.4722751", "text": "def phrases_not_found\n @phrases_not_found ||= Set.new\n end", "title": "" }, { "docid": "4dfd2d7de8053dd56bb76642610dfd4e", "score": "0.47214684", "text": "def localized_names\n @localized_names ||= []\n end", "title": "" }, { "docid": "8cbb76120eac6de7e626dae152a33f11", "score": "0.47151372", "text": "def get_all(*names)\n set = Set.new\n names.each { |name| set.merge(get(name)) }\n set\n end", "title": "" }, { "docid": "c9245101a2bd7ff4101c563639a72084", "score": "0.46913913", "text": "def find_emails(opts)\n emails.reverse.select do |email|\n email.to.include?(opts[:to]) || email.subject == opts[:subject]\n end\n end", "title": "" }, { "docid": "f22fc3cc8fde29415650abd063eeedd8", "score": "0.46911433", "text": "def subjects_geographic\n get_item_data_by_name('SubjectGeographic')\n end", "title": "" }, { "docid": "a418e157c183cc64f065391b0dc99c20", "score": "0.4686454", "text": "def alternatives\n self.product_suggestions.collect{|ps| ps.suggested_product}\n end", "title": "" }, { "docid": "49b26d6ec0e29f79858ae4ad9cf7a9a0", "score": "0.46851563", "text": "def names\n all.map { |item| item.name_sym }\n end", "title": "" }, { "docid": "70e7802a165c4b29bd4996e6087a34ce", "score": "0.46769643", "text": "def names\n [name] + @aliases\n end", "title": "" }, { "docid": "70e7802a165c4b29bd4996e6087a34ce", "score": "0.46769643", "text": "def names\n [name] + @aliases\n end", "title": "" }, { "docid": "8a5eb0ce2a59f494bd1df26c839a7935", "score": "0.4660909", "text": "def alternative_ids\n return @alternative_ids if @alternative_ids\n\n res = {}\n self.class.alternative_id_fields(access_by: current_user).each { |f| res[f] = alternative_id_value(f) }\n @alternative_ids = res\n end", "title": "" }, { "docid": "6668e0cfc8ceb295e13f2e083f30e8c3", "score": "0.4658786", "text": "def alternative_names\n auth_providers.map do |ap|\n { provider: ap.provider, name: \"#{ap.uname} (#{ap.provider})\" }\n end\n end", "title": "" }, { "docid": "1a11e8798c2be389b5503ed6d65e3b29", "score": "0.4653743", "text": "def synonyms(opts = {})\n self.meanings.uniq.collect { |ref| ref.tags }.flatten.uniq\n end", "title": "" }, { "docid": "104c5df6775b46beb77a2610152a4cf0", "score": "0.4652085", "text": "def aliases(options = { :include_institution_name => true })\n aliases = []\n aliases << self[:name] if options[:include_institution_name]\n aliases << self[:ialias].split(\",\").split(\"|\").flatten.collect(&:strip)\n aliases.flatten.compact\n end", "title": "" }, { "docid": "0ef6abad3e125e7ec8e8d1c962011576", "score": "0.46480608", "text": "def extract_subjects_from_table(subject_list)\n subject_list\n .split(',')\n .map(&:strip)\n .reject { |subject| subject == 'None' }\n .compact\nend", "title": "" }, { "docid": "a5b2bf1ab5469230da78f07872dc6b29", "score": "0.46433714", "text": "def subject_occupations\n @subject_occupations ||= term_values([:subject, :occupation])\n end", "title": "" }, { "docid": "474f4aa4bfccf9b3ab4b3b7c41696564", "score": "0.46338", "text": "def rejected_cipher_suites\n each_rejected_cipher_suite.to_a\n end", "title": "" }, { "docid": "830602a6593bbda3be0b5984e3064dd6", "score": "0.4632525", "text": "def extensions_missing(exts)\n Set.new(exts.flatten).difference extensions.to_set\n end", "title": "" }, { "docid": "d341e082a48b224d1b9881033307ac7a", "score": "0.46231294", "text": "def subjects\n tag_range(\"600\", \"69X\")\n end", "title": "" }, { "docid": "820ee4ddfdc5f8773c8dfc6a098b2a3b", "score": "0.46224543", "text": "def names\n map(&:names).flatten\n end", "title": "" }, { "docid": "d5c24ee8be4146460becc7dccd058af0", "score": "0.4619429", "text": "def subjects\n @graphs.inject([]) {|memo, g| memo += g.subjects}\n end", "title": "" }, { "docid": "19d577e02f4b92bf9a57e80ccca8c9ef", "score": "0.46106", "text": "def all_names\n @__names__\n end", "title": "" }, { "docid": "5684e72eedc29b5f991292a6556f99b6", "score": "0.4606961", "text": "def index\n @subjects = subject_scope\n end", "title": "" }, { "docid": "15f55959de27b4377a2c364517309ca2", "score": "0.45996243", "text": "def subjectsOptions(selected_id, options_all=false, tree_type_id)\n if options_all\n ret = [['All', '']]\n else\n ret = []\n end\n Subject.where(\"tree_type_id = ? AND min_grade < ?\", tree_type_id, 999).order(\"max_grade desc\", \"min_grade asc\", \"code\").each do |s|\n # ret << [ @translations[\"sector.#{s.code}.name\"], s.id ]\n ret << [s.code, s.id]\n end\n return ret\n end", "title": "" }, { "docid": "87f0b3a800f4cc2a0f07a8ad92ec2d61", "score": "0.45979735", "text": "def subjects\n subjects_array = object.syncable_subjects.to_a\n\n return subjects_array unless object.is_send?\n\n subjects_array << Subject.new(subject_code: \"U3\", subject_name: \"Special Educational Needs\")\n\n subjects_array\n end", "title": "" }, { "docid": "5456acbe8a6cfdb03e48888cdaa2d56b", "score": "0.45917246", "text": "def names\n @songs.map(&:name).uniq\n end", "title": "" }, { "docid": "5e2ca11041a656968b36fb07e44cac43", "score": "0.45873374", "text": "def subject_list_for_autocomplete\n subject_list = \"[\"\n all_subjects do |subject|\n subject_list+=\"{label:\\\"#{subject.to_s}\\\",title:\\\"#{subject.title}\\\",value:\\\"#{subject.code}\\\"},\\n\"\n subject_list << { :label => \"#{subject.to_s}\",\n :title => \"#{subject.title}\",\n :value => \"#{subject.code}\" }\n end\n subject_list += \"]\"\n end", "title": "" }, { "docid": "f589f0761f9ee0454921036417a09b7d", "score": "0.458439", "text": "def subject_ids\n self.get_civet_outputs.map(&:dsid)\n end", "title": "" }, { "docid": "10d1b89e069fc31891254da59b94576a", "score": "0.45770064", "text": "def sw_subject_titles(sep = ' ')\n result = []\n mods_ng_xml.subject.titleInfo.each { |ti_el|\n parts = ti_el.element_children.map(&:text).reject(&:empty?)\n result << parts.join(sep).strip unless parts.empty?\n }\n result\n end", "title": "" }, { "docid": "4ff9cfffaf84c2d1631c784eaf5f7332", "score": "0.4575656", "text": "def attestation_subjects\n beg_sem = semester - 3\n end_sem = semester - 1\n return @attestation_subjects ||= plan_subjects.select do |ps|\n (beg_sem..end_sem).include? ps.finishing_on\n end\n end", "title": "" }, { "docid": "0fe09e78c6b5ada5e8fbd12159f22091", "score": "0.45718983", "text": "def names_of_people_who_failed_english(results_set)\nend", "title": "" }, { "docid": "f822617d157aa79f8de230a7b308c32e", "score": "0.45661762", "text": "def get_names\n @names\n end", "title": "" }, { "docid": "219f1be6889ffdbbf2ad40a5b6b8346f", "score": "0.45656466", "text": "def alternate_namespaces\n return @alternate_name.keys()\n end", "title": "" }, { "docid": "baf0ae5bdbfbdd7ab8b1371d7557a4ab", "score": "0.4561675", "text": "def aliases\n return @aliases\n end", "title": "" }, { "docid": "d0e1de61fdd3b17c2381046c60ded7bd", "score": "0.45558363", "text": "def subject_name\n subject_full_name\n end", "title": "" }, { "docid": "190ab3530318654067dd1791f7b04b7e", "score": "0.4555778", "text": "def finished_subjects\n return @finished_subjects ||= plan_subjects.select {|ps| ps.finished?}\n end", "title": "" }, { "docid": "ff1911ef608a2e1be1d0e9699328e3de", "score": "0.45541084", "text": "def alternative_full_names_without_diacritics=(alternative_full_name_without_diacritics)\n if alternative_full_name_without_diacritics && alternative_full_name_without_diacritics.is_a?(String)\n @alternative_full_names_without_diacritics ||= []\n @alternative_full_names_without_diacritics << alternative_full_name_without_diacritics.strip\n end\n end", "title": "" }, { "docid": "6603dcc29a3fc80c24571b9b9a7fdee7", "score": "0.4538159", "text": "def alternatives(by=nil)\n @dimensions.units(nil).reject do |unit|\n unit.is_equivalent_to?(self) || !unit.acts_as_alternative_unit\n end.map(&by).to_a\n end", "title": "" }, { "docid": "5f43cdadca508b4cfe9ce610b27b0c5e", "score": "0.45375556", "text": "def placeholder_names\n placeholders.map(&:contents).to_set\n end", "title": "" }, { "docid": "dfd1b08fd5072ee520f0e60e044cf2f4", "score": "0.45366222", "text": "def get_all_sub_titles\n show_all_titles_and_subtitles(\"subtitle\")\n return @subtitles\n end", "title": "" }, { "docid": "c0e6b1ca39cd379d5478d371ad6f3948", "score": "0.4529944", "text": "def alternative_key_names\n @alternative_key_names ||= [[:alt, :menu, :altKey], [:alt_graph, :AltGraph], [:caps_lock, :CapsLock], [:ctrl, :control, :ctrlKey], \n [:Fn], [:fn_lock, :FnLock], [:Hyper], [:meta, :metaKey], [:num_lock, :NumLock], [:OS], \n [:scroll_lock, :ScrollLock], [:shift, :shiftKey], [:Super], [:Symbol], [:symbol_lock, :SymbolLock]]\n end", "title": "" }, { "docid": "2ca853c1a67a94b68edfd9f5b1f9a0f9", "score": "0.45289955", "text": "def category_names_of_subject subject, &block\n categories_of_subject(subject).keys\n end", "title": "" }, { "docid": "71890fc3868e7a567f05643d533d2cc7", "score": "0.45269138", "text": "def question_names\n self.catalogs.reduce([]) do |names, catalog|\n questions = \"#{catalog.capitalize}Catalog\".constantize.const_get(\"QUESTIONS\")\n namespaced_questions = questions.map{|question| \"#{catalog}_#{question}\".to_sym }\n\n names + namespaced_questions\n end\n end", "title": "" }, { "docid": "1a54480c1655dc33488e718d4496fa65", "score": "0.45255938", "text": "def subject_name\n return @subject_name\n end", "title": "" } ]
88d872848912e07a71fe0efc76714c70
This corresponds to /admin/:id where :id is the admin id This route is where most admin actions will be handled Such actions include: verifying educators, approving DMCA takedowns
[ { "docid": "18bd9f30de6d19aecf290db0e732f0a3", "score": "0.0", "text": "def show\n @educators = Educator.where(verified: [false, nil]).all\n @dmcas = Dmca.all\n end", "title": "" } ]
[ { "docid": "ee3ed234f4863daf711b690c0c13e6b1", "score": "0.7651359", "text": "def admin\n #TODO\n end", "title": "" }, { "docid": "db2dfae624d1b925cc4609a18175f5b2", "score": "0.744634", "text": "def admin\n end", "title": "" }, { "docid": "db2dfae624d1b925cc4609a18175f5b2", "score": "0.744634", "text": "def admin\n end", "title": "" }, { "docid": "db2dfae624d1b925cc4609a18175f5b2", "score": "0.744634", "text": "def admin\n end", "title": "" }, { "docid": "db2dfae624d1b925cc4609a18175f5b2", "score": "0.744634", "text": "def admin\n end", "title": "" }, { "docid": "f38bcc143210468e0c83b3228ce96d50", "score": "0.7436222", "text": "def admin\n\n end", "title": "" }, { "docid": "a1c5b067db98a3e0cccda7853c9aac1b", "score": "0.7273871", "text": "def correct_admin\n @admin_admin = Admin::Admin.find(params[:id])\n redirect_to(admin_admins_path) unless current_user?(@admin_admin)\n end", "title": "" }, { "docid": "3a602d0d96c4daa2f31b2a6c6ce8804b", "score": "0.7196692", "text": "def correct_admin\n @admin = Admin.find(params[:id])\n redirect_to(root_url) unless current_admin?(@admin)\n end", "title": "" }, { "docid": "1b489658b573073bad605610820fd128", "score": "0.7166804", "text": "def set_admin\n # authorize Admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "9b6f30704f058299cdd7a181fdc829ad", "score": "0.70644563", "text": "def correct_admin\n @admin = Admin.find(params[:id])\n redirect_to(root_url) unless current_admin?(@admin)\n end", "title": "" }, { "docid": "6c47c609682db3dfdbfa2140208940f4", "score": "0.7018538", "text": "def admin\n\t\tauthenticate_user!\n\t if current_user.admin\n\t\t return\n\t else\n\t\t redirect_to root_url\n\t end\n\tend", "title": "" }, { "docid": "761418ea334010405ca9611c8ebead81", "score": "0.70100826", "text": "def admin_user\n redirect_to root_url, notice: \"You do not have permission to view or edit this information.\" unless current_user.admin?\n end", "title": "" }, { "docid": "4fcc19509da871d92c2a12a3b8468597", "score": "0.7002438", "text": "def admin!\n redirect_to root_path, alert: \"Not authorized\" and return unless is_admin?\n end", "title": "" }, { "docid": "925897a8ff2da8a8b3c0ed6d03dcdfac", "score": "0.6908091", "text": "def verify_admin\n unless current_user.admin? or params[:id].to_i == current_user.id\n redirect_to users_path, :alert => 'You are unauthorized to do that.'\n end\n end", "title": "" }, { "docid": "81a38d3a7940994e73a37181a07894be", "score": "0.687914", "text": "def set_admin_admin\n @admin_admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "b67a9b157b17600e88b5da953aac353d", "score": "0.687478", "text": "def edit\n find_admin_by_id\n end", "title": "" }, { "docid": "882cec8ce5935d9268e4164fe112068d", "score": "0.6837172", "text": "def set_admin_admin\n @admin_admin = Admin::Admin.find(params[:id])\n end", "title": "" }, { "docid": "86856b4a23756d57f8bcdc93ac82dfc2", "score": "0.6833886", "text": "def admin\n unless current_user.admin?\n redirect_to root_url\n flash[:danger] = \"You have no access here\"\n end\n end", "title": "" }, { "docid": "e7a7bab1159a2f02bedaf00923f93424", "score": "0.6829099", "text": "def admin_user\n redirect_to(root_url) unless current_doctor.admin?\n end", "title": "" }, { "docid": "1fb39e8d1eb9364d571694ef622b7a2f", "score": "0.6823813", "text": "def admin_user\n unless current_user && current_user.admin?\n redirect_to login_url, notice: \"admin can only do this action.\" \n end\n end", "title": "" }, { "docid": "eee8297e4d32b9e9b101964e0ea76d94", "score": "0.6803887", "text": "def set_admin\n\n @admin = Admin.find(params[:id])\n\n end", "title": "" }, { "docid": "991dd1a3f4745e8640cd038fbdbaecdc", "score": "0.6788271", "text": "def admin\n unless current_user.admin?\n flash[:danger] = \"Sorry, you must be an admin to do that.\"\n redirect_to user_path(current_user)\n end\n end", "title": "" }, { "docid": "a44f6f767676d1cec085819359fa9d78", "score": "0.67825335", "text": "def set_admin_admin\n @admin_admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "af2aab2929b777283e2bf24a6ed5c8b5", "score": "0.6778863", "text": "def set_admin\n @admin = Admin.friendly.find(params[:id])\n end", "title": "" }, { "docid": "8af77f57678dc5aa38c2575cdc6976b8", "score": "0.67692393", "text": "def show\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "8af77f57678dc5aa38c2575cdc6976b8", "score": "0.67692393", "text": "def show\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "8af77f57678dc5aa38c2575cdc6976b8", "score": "0.67692393", "text": "def show\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "8af77f57678dc5aa38c2575cdc6976b8", "score": "0.67692393", "text": "def show\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "8af77f57678dc5aa38c2575cdc6976b8", "score": "0.67692393", "text": "def show\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "3c7ae3b216e201ae44760202adfeb4d2", "score": "0.67634356", "text": "def admin\r\n unless session[ :admin ] || session[ :netid ] == Person.find_by_id( params[ :id ] ).netid\r\n flash[ :error ] = 'No access to ' + params[ :id ]\r\n\t if request.env[\"PATH_INFO\"]\r\n \tredirect_to '/login?previous_page=' + request.env[\"PATH_INFO\"] + '?' + request.env[ 'QUERY_STRING' ].gsub(/\\&/,'%26')\r\n\t else\r\n\t \tredirect_to '/login'\r\n\t end\r\n false\r\n end\r\n end", "title": "" }, { "docid": "ccb372448dd0737fe62cf667ad919737", "score": "0.6755933", "text": "def set_admin\n\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "bed3aa5cc03466183b4e07e79774b563", "score": "0.67514193", "text": "def admin_user\n redirect_to(admin_admins_path) unless current_user.admin?\n end", "title": "" }, { "docid": "336155dd9b9a8d6b01e5f3c3497f785f", "score": "0.6744481", "text": "def show\n @admin = Admin.find(params[:id])\n\n end", "title": "" }, { "docid": "1fc5da82211ad301d9a50eb957c0f960", "score": "0.6743226", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "1fc5da82211ad301d9a50eb957c0f960", "score": "0.6742748", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "1fc5da82211ad301d9a50eb957c0f960", "score": "0.6742748", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "1fc5da82211ad301d9a50eb957c0f960", "score": "0.6742748", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "1fc5da82211ad301d9a50eb957c0f960", "score": "0.6742748", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "1fc5da82211ad301d9a50eb957c0f960", "score": "0.6742748", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "1fc5da82211ad301d9a50eb957c0f960", "score": "0.6742748", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "1fc5da82211ad301d9a50eb957c0f960", "score": "0.6742748", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "1fc5da82211ad301d9a50eb957c0f960", "score": "0.6742748", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "1fc5da82211ad301d9a50eb957c0f960", "score": "0.6742748", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "1fc5da82211ad301d9a50eb957c0f960", "score": "0.6742748", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "1fc5da82211ad301d9a50eb957c0f960", "score": "0.6742748", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "1fc5da82211ad301d9a50eb957c0f960", "score": "0.6742748", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "1fc5da82211ad301d9a50eb957c0f960", "score": "0.6742748", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "1fc5da82211ad301d9a50eb957c0f960", "score": "0.6742748", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "1fc5da82211ad301d9a50eb957c0f960", "score": "0.6742748", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "1fc5da82211ad301d9a50eb957c0f960", "score": "0.6742748", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "6121989128130cca60f03e1489c9be9e", "score": "0.6739216", "text": "def admin\n unless current_user.admin?\n #if logged user is not admin display error message and redirect to application INDEX (store_path)\n flash[:error] = \"Authorisation is required to access this content.\"\n redirect_to store_path\n end\n end", "title": "" }, { "docid": "2b28a91adb11a687170b0bd4d8bc81c4", "score": "0.6730799", "text": "def admin_user\n unless logged_in? && current_user.admin?\n redirect_to root_url\n end\n end", "title": "" }, { "docid": "c233e605724e6bda95249842818add4b", "score": "0.6728484", "text": "def admin_user\n redirect_to(root_path) unless is_admin?\n end", "title": "" }, { "docid": "4835cfdb907172ce9d578ffb7d509b0b", "score": "0.67226106", "text": "def show\n authorize @admin\n end", "title": "" }, { "docid": "41a89daf9395bfd103ebc37fb774bee9", "score": "0.67101663", "text": "def admin_user\n redirect_to(root_url) and flash[:danger] = \"Only admins can do that!\" unless current_user.admin?\n\n end", "title": "" }, { "docid": "a8e5cea942abb2d768cb1a5e4d1a65d1", "score": "0.6706664", "text": "def admin\n self.sitemap\n self.follow('dtime:dashboard:admin')\n self.get\n self\n end", "title": "" }, { "docid": "fbdb54c7244a634406f6ae18c74e6b7d", "score": "0.67023915", "text": "def admin_user \n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to edit menu.'\n \n redirect_to(root_url)\n end\n end", "title": "" }, { "docid": "cc8fc0bbbf08e33ab56015172a367945", "score": "0.67016965", "text": "def admin\n unless admin? || request.format.symbol == :json\n flash[:error] = \"please login as admin to view this page\"\n if authenticated?\n reset_session\n flash[:error] = \"you have been logged out - please login as admin to view this page\"\n end\n\n # Throw a 500 for create/update/delete pages -- because there's no point redirecting that.\n if ['create', 'update', 'delete'].include? params[:action]\n render json: 'You are not authorized to do that.', status: 500\n else\n session[:source] = request.path\n redirect_to '/login'\n false\n end\n end\n end", "title": "" }, { "docid": "b0a4e18b05ee31a828300c6fd29c1b54", "score": "0.670024", "text": "def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end", "title": "" }, { "docid": "c4721f5ce77e2772ca41c12e09ce2565", "score": "0.66951364", "text": "def set_admin\n admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "b7970305a25ceeefffda2b1f3a28d4d8", "score": "0.6693609", "text": "def admin_user\n redirect_to(root_url) unless current_user.admin? # se current_user.admin for falso redireciona para pagina principal\n end", "title": "" }, { "docid": "1d6943667a6b65e3c1bb748876c0145a", "score": "0.6690383", "text": "def admin_actions\n unless @current_admin.is_super_admin\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n end", "title": "" }, { "docid": "eb7783de1353a55bcd7c8321dde99e69", "score": "0.66860354", "text": "def show\n @admin = Admin.find params[:id]\n end", "title": "" }, { "docid": "cce71918680cd8afd531f09d2576d02a", "score": "0.66855294", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "5875bcb995ff83447e9839f891233065", "score": "0.66846883", "text": "def be_admin\n if current_user.switch_to(\"admin\")\n flash[:notice] = \"You have now an 'admin' role\"\n else\n flash[:error] = \"You are not authorized to have a 'admin' role\"\n end\n redirect_to( request.env[\"HTTP_REFERER\"])\n end", "title": "" }, { "docid": "ecce8cb9f63d5db36fac864316070f87", "score": "0.66813725", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "709029a9fccec08622eb7a9cfe8cbcd9", "score": "0.6678032", "text": "def admin_user\n if(!current_user.admin?)\n flash[:danger] = \"Access Denied. Admin required\"\n redirect_to root_url\n end\n end", "title": "" }, { "docid": "245f7126395a51b205a4e846adeca12a", "score": "0.6678017", "text": "def index\n if session[:admin_id] != nil\n redirect_to admin_path(Admin.find(session[:admin_id]))\n else\n @admin = Admin.new\n end\n end", "title": "" }, { "docid": "55acbb684a2131dcf8f6faa5b3e1ba03", "score": "0.6666764", "text": "def admin_user\n if logged_in?\n redirect_to root_url unless current_user.admin?\n elsif\n #flash[:failure] = \"Invalid Request\"\n redirect_to(root_url)\n end\n end", "title": "" }, { "docid": "55acbb684a2131dcf8f6faa5b3e1ba03", "score": "0.6666764", "text": "def admin_user\n if logged_in?\n redirect_to root_url unless current_user.admin?\n elsif\n #flash[:failure] = \"Invalid Request\"\n redirect_to(root_url)\n end\n end", "title": "" }, { "docid": "fb9cdd1868364bc016158c6062d1a660", "score": "0.66641587", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "fb9cdd1868364bc016158c6062d1a660", "score": "0.66641587", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "fb9cdd1868364bc016158c6062d1a660", "score": "0.66641587", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "fb9cdd1868364bc016158c6062d1a660", "score": "0.66641587", "text": "def set_admin\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "bc523873401591b24e731460cdad9673", "score": "0.6644879", "text": "def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end", "title": "" }, { "docid": "bc523873401591b24e731460cdad9673", "score": "0.6644879", "text": "def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end", "title": "" }, { "docid": "41670400143f405e28be8f3dcadeaa71", "score": "0.66394854", "text": "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t end", "title": "" }, { "docid": "f7f1caf9d85778adea187acf5bb3e4f8", "score": "0.6636434", "text": "def admin_id\n 9\n end", "title": "" }, { "docid": "dde8cfd75bf2b0a04e1987a7ac7872d6", "score": "0.6633641", "text": "def admin_user\n if user_signed_in? && current_user.adminrole?\n flash.now[:success] = \"Admin Access Granted\"\n else\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "c81a139b8bc978a8913e64884dbfb70a", "score": "0.66316", "text": "def admin_logic\n end", "title": "" }, { "docid": "f7eb4921527b35f842e077b5919dcc59", "score": "0.66303164", "text": "def show_admin\n screen_name(\"Inicial-Admin\")\n\n distribute_ots\n\n respond_to do |format|\n format.html { render action: \"show_admin\" }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "98dc820f141f57d25181d3c434222242", "score": "0.66289145", "text": "def secret\n @admin = Admin.find(params[:id])\n unless @admin.id == current_admin.id\n flash[:notice] = \"Vous n'avez pas les droits d'accès au dashboard d'un autre admin!\"\n redirect_to admin_path(current_admin)\n end\n end", "title": "" }, { "docid": "24da16b670d72440a0bddbb98e5030d7", "score": "0.6620192", "text": "def show\n # authorize Admin\n end", "title": "" }, { "docid": "f4b0b4d2c8794ef5122ab76b4aba52d4", "score": "0.6614136", "text": "def admin_agent\n redirect_to(root_url) unless current_agent.admin?\n end", "title": "" }, { "docid": "853a12267c5db9b9a9893485632cd4b6", "score": "0.6609781", "text": "def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end", "title": "" }, { "docid": "67f9748f0238cf68aec788847ea23a59", "score": "0.6602373", "text": "def admin_user\n unless admin_user?\n redirect_to login_url\n end\n end", "title": "" }, { "docid": "741ea59492030f54c4a01cd45b39fa07", "score": "0.6594631", "text": "def show\n checkadmin\n end", "title": "" }, { "docid": "dc4cca496c77f58a70745f7f44eea90d", "score": "0.6593809", "text": "def admin_user\n unless this_is_admin?(current_user)\n flash[:danger] = \"You don't have the rights for this action.\"\n redirect_to(root_url)\n end\n end", "title": "" }, { "docid": "dc4cca496c77f58a70745f7f44eea90d", "score": "0.6593809", "text": "def admin_user\n unless this_is_admin?(current_user)\n flash[:danger] = \"You don't have the rights for this action.\"\n redirect_to(root_url)\n end\n end", "title": "" }, { "docid": "32c3ada822081898654b4d84d1fa946a", "score": "0.6593223", "text": "def admin_id\n @admin.id\n end", "title": "" }, { "docid": "a81867017658f9e655b5dd05f34fa8a2", "score": "0.6587885", "text": "def admin_edit\n @user = User.find(params[:id])\n end", "title": "" }, { "docid": "a81867017658f9e655b5dd05f34fa8a2", "score": "0.6587885", "text": "def admin_edit\n @user = User.find(params[:id])\n end", "title": "" }, { "docid": "30022c43b88f4525d0c7a9c3655a783f", "score": "0.6585535", "text": "def admin_user\n redirect_to(admin_page_url) if current_user.admin?\n end", "title": "" }, { "docid": "06ba2ab5010cf1f1066f9978cf9a7e50", "score": "0.65830404", "text": "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend", "title": "" }, { "docid": "06ba2ab5010cf1f1066f9978cf9a7e50", "score": "0.65830404", "text": "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend", "title": "" }, { "docid": "8e4099adbab0ee0d6503b8141b481dbb", "score": "0.6574026", "text": "def admin\n\t\tif !session[:admin]\n\t\t\tredirect_to root_url\n\t\tend\n\tend", "title": "" }, { "docid": "a18876fd641df55d6f5df8b0560ea733", "score": "0.65728635", "text": "def w000thenticate_admin!\n check_token\n authenticate_user!\n raise AbstractController::ActionNotFound unless current_user.admin?\n end", "title": "" }, { "docid": "458a52207039663d49f4a05138e9499c", "score": "0.6555858", "text": "def admin_authorize\n \tunless User.find(session[:user_id]).user_type == \"admin\"\n \t\tsession[:original_uri] = nil\n\t\t flash[:warning] = \"You are not authorized to view this page!\"\n\t\t redirect_to(root_path)\n \tend\n end", "title": "" }, { "docid": "70b507a16587ac016f0f713747fc4171", "score": "0.65381944", "text": "def admin_user\n\t\tredirect_to(root_url) unless current_user.admin? #NB il metodo \"admin?\" è stato aggiunto direttamente da Rails quando alla creazione ha visto che admin è un booleano\n\tend", "title": "" }, { "docid": "c563b9ef4a0880d07ebf12bd2f8472d3", "score": "0.65377", "text": "def admin_user\n @user = current_user\n redirect_to @user unless @user.admin?\n end", "title": "" }, { "docid": "8d51f35bb1add9938b616f1227c3d33e", "score": "0.6536116", "text": "def adminprotected!\n if authorized? == true and isuseradmin? == true\n return\n else redirect '/denied'\n end\n end", "title": "" } ]
4ff748337ef91219032bff613e86f4c0
DELETE /situacaodemandas/1 DELETE /situacaodemandas/1.json
[ { "docid": "37076fa91a0d080d395d813de635e57d", "score": "0.7171058", "text": "def destroy\n @situacaodemanda.destroy\n respond_to do |format|\n format.html { redirect_to situacaodemandas_url, notice: 'Situacaodemanda was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "b1a17c1ee1af05c79fe156622df44818", "score": "0.72866964", "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": "887432e4b57a71666f432ad34958877c", "score": "0.7190958", "text": "def destroy\n @solicitud = Solicitud.find(params[:id])\n @solicitud.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4eadb61943fa9a636cad510bf21db1aa", "score": "0.7171211", "text": "def destroy\n @agronomiadecanato = Agronomiadecanato.find(params[:id])\n @agronomiadecanato.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiadecanatos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "72ac27a7d3c22d92045e3a96b3178ab6", "score": "0.7068747", "text": "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7dcf2b66db6f87752bd1b6f60193588b", "score": "0.7054775", "text": "def destroy\n @unidad.destroy\n respond_to do |format|\n format.html { redirect_to unidad_index_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7452c4d15daf08108aaa5a1b728adb31", "score": "0.7053172", "text": "def destroy\n @json.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "b445c184893647d3482f8fbc6a507a52", "score": "0.70484287", "text": "def delete(path, params = {})\n path += '.json'\n res = @connection.delete(path, @header)\n parse_response(res)\n end", "title": "" }, { "docid": "904aa296352b2c896fee466cd2494ede", "score": "0.7046069", "text": "def destroy\n @detalleapuestum = Detalleapuestum.find(params[:id])\n @detalleapuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to detalleapuesta_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "204098c8a68d7cc95caf73f01c73d949", "score": "0.7037319", "text": "def destroy\n @safra_umidade = SafraUmidade.find(params[:id])\n @safra_umidade.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/safra_produtos/#{@safra_umidade.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c1845c093ccf5f204bb61598531cbd6", "score": "0.69992113", "text": "def destroy\n @solicitacao = Solicitacao.find(params[:id])\n @solicitacao.destroy\n\n respond_to do |format|\n format.html { redirect_to solicitacaos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0879ade66bdab83e51e8da609fb6b45b", "score": "0.6998155", "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": "601deef17c0bf3e69b600e3b949d54e9", "score": "0.6997409", "text": "def destroy\n @agronomiagalera = Agronomiagalera.find(params[:id])\n @agronomiagalera.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiagaleras_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "326e6e9e402beca02c7ec8c3d6eb7bdf", "score": "0.6994533", "text": "def destroy\n @sobremesa.destroy\n respond_to do |format|\n format.html { redirect_to sobremesas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c1cde2518cb592b6add14fe05ae1b37d", "score": "0.6992861", "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": "9dd1623806ce1059ff6318fcb9a27c7a", "score": "0.69864064", "text": "def destroy\n @ata = @reuniao.atas.find params[:id]\n @ata.destroy\n respond_to do |format|\n format.html { redirect_to @reuniao}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1afd2afcaf21e327ea307fc6bed21586", "score": "0.6980463", "text": "def destroy\n @atribuicao.destroy\n respond_to do |format|\n format.html { redirect_to atribuicaos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "17608bcf71a72d9868c611c8c81a1ac4", "score": "0.6980262", "text": "def destroy\n\n @idioma.destroy\n respond_to do |format|\n format.html { redirect_to idiomas_path(@idioma, egresso_id: @idioma.egresso_id), notice: 'Idioma excluído com sucesso.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4253b2ebf28805320255b4fc72d3eabe", "score": "0.6976382", "text": "def destroy\n @dia_semana = DiaSemana.find(params[:id])\n @dia_semana.destroy\n\n respond_to do |format|\n format.html { redirect_to dia_semanas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c10841427137fc3649d5b0575cdf3159", "score": "0.69655085", "text": "def destroy\n @nave_nodriza.destroy\n respond_to do |format|\n format.html { redirect_to nave_nodrizas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6d68940da5401777986ad8b6f0d7a92c", "score": "0.69629604", "text": "def destroy\n @solicitud = Solicitud.find(params[:id])\n @solicitud.destroy\n\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8be4a3db8ce7fb49dc5deb783de4c41e", "score": "0.6952397", "text": "def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: 'Solicitud borrada.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dcb604c6b8ffe73ff932b6b6f3f8066f", "score": "0.69482803", "text": "def destroy\r\n @sivic_moduloescola.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_moduloescolas_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "2f34ec3e4ad665020b06b00de2d3e5fe", "score": "0.6947368", "text": "def destroy\n @est_comentario.destroy\n respond_to do |format|\n format.html { redirect_to est_comentarios_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ca5d9fc72823294dbfbdccac5066a54b", "score": "0.6947205", "text": "def destroy\n @motivo_consulta = MotivoConsulta.find(params[:id])\n @motivo_consulta.destroy\n\n respond_to do |format|\n format.html { redirect_to motivos_consulta_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9fa2a48418ea15677544b1fa100b0667", "score": "0.69431573", "text": "def destroy\n @azione = Azione.find(params[:id])\n @azione.destroy\n\n respond_to do |format|\n format.html { redirect_to azioni_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "53d601e5a09cf6da506c93f2d174f5bd", "score": "0.6940701", "text": "def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: 'Solicitud destruida HUMANO.' }\n format.json { head :no_content }\n end\n \n end", "title": "" }, { "docid": "6736df32fa7932507dbdb5daece354f2", "score": "0.6933708", "text": "def destroy\n @enfermedadesoculare = Enfermedadesoculare.find(params[:id])\n #Enfermedadesoculare.find(params[:id]).destroy\n @enfermedadesoculare.destroy\n respond_to do |format| \n msg = { :resp => params[:id] }\n format.json { render :json => msg } \n end\n \n end", "title": "" }, { "docid": "773e5d611adeb09776f9c841e1b876cc", "score": "0.6931463", "text": "def delete_json(path, params = {}, headers = {})\n json_request(:delete, path, params, headers)\n end", "title": "" }, { "docid": "b93e0b2b566d11f6deb93b5220a36903", "score": "0.69314367", "text": "def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: 'La solicitud fue eliminada correctamente' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f245bcabc83c5d69181fc839e9c33b4f", "score": "0.6931186", "text": "def destroy\n @ocupacion = Ocupacion.find(params[:id])\n @ocupacion.destroy\n\n respond_to do |format|\n format.html { redirect_to ocupacions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0674f1b6f8e6fd33271b36be2baf448b", "score": "0.6927219", "text": "def destroy\n @tipo_apuestum = TipoApuestum.find(params[:id])\n @tipo_apuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_apuesta_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "47a3c9c28e1fcd0fcae5ea58416b42bd", "score": "0.6916781", "text": "def delete(path)\n api :delete, path\n end", "title": "" }, { "docid": "c7e01fce2836a1166154e6094190bded", "score": "0.69136274", "text": "def destroy\n @orgao_sistema.destroy\n respond_to do |format|\n format.html { redirect_to orgao_sistemas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9106867cee9e8775ba817195d3bc2020", "score": "0.6909745", "text": "def delete_rest(path) \n run_request(:DELETE, create_url(path)) \n end", "title": "" }, { "docid": "f07c89395f87c02409cea01fc23ddae0", "score": "0.6909548", "text": "def destroy\n @anuncio = Anuncio.find(params[:id])\n @anuncio.destroy\n\n respond_to do |format|\n format.html { redirect_to anuncios_url,:notice => \"Anuncio apagado com sucesso\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "034d813387647ba367ef44dab8899fe3", "score": "0.6909198", "text": "def destroy\n @anotacion = Anotacion.find(params[:id])\n @anotacion.destroy\n\n respond_to do |format|\n format.html { redirect_to anotacions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "57b799133d29316426c358002043baa2", "score": "0.6906096", "text": "def delete_rest(path, headers={}) \n run_request(:DELETE, create_url(path), headers) \n end", "title": "" }, { "docid": "6aacef0a41b0cab169d450bf06d67c78", "score": "0.6905612", "text": "def destroy\n @apuestum = Apuestum.find(params[:id])\n @apuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to apuesta_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e1f4bad5f55893186a3ecea321742d29", "score": "0.6904249", "text": "def destroy\n @statusentrega = Statusentrega.find(params[:id])\n @statusentrega.destroy\n\n respond_to do |format|\n format.html { redirect_to statusentregas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dba16b2327539a3629ad19ee7d16009e", "score": "0.6903871", "text": "def destroy\n @sangano = Sangano.find(params[:id])\n @sangano.destroy\n\n respond_to do |format|\n format.html { redirect_to sanganos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5e84cd531ca83c3f1a6dd18750309851", "score": "0.6901516", "text": "def destroy\n @seguimiento.destroy\n respond_to do |format|\n format.html { redirect_to '/adopcions', notice: 'Seguimiento Eliminado.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8d3ba5a7789cfe06da8471c4003bd23d", "score": "0.6899819", "text": "def destroy\n @tipo_demanda = TipoDemanda.find(params[:id])\n @tipo_demanda.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_demandas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8367c4e543d9e1cad76ea005a57eac68", "score": "0.6899212", "text": "def destroy\n @asesoria = Asesoria.find(params[:id])\n @asesoria.destroy\n\n respond_to do |format|\n format.html { redirect_to asesoria_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "14ac045e510ad481a07e5c7a56b8f41f", "score": "0.6898924", "text": "def destroy\n @adres_osoba.destroy\n respond_to do |format|\n format.html { redirect_to adres_osoba_index_url, notice: 'Adres osoba was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4a5bf91c3a7a4af007ef0608ff5e0109", "score": "0.68954796", "text": "def destroy\n @anio_escolar = AnioEscolar.find(params[:id])\n @anio_escolar.destroy\n\n respond_to do |format|\n format.html { redirect_to anios_escolares_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6019c1cbaa6764b313900ceeab920d3d", "score": "0.689445", "text": "def destroy\n @recetum = Recetum.find(params[:id])\n @recetum.destroy\n\n respond_to do |format|\n format.html { redirect_to receta_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "751479ffc09b9bafd30068231cd643ed", "score": "0.6892162", "text": "def destroy\n @safra_brotado = SafraBrotado.find(params[:id])\n @safra_brotado.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/safra_produtos/#{@safra_brotado.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e24ee4adc4a1a7e1a49389434baa7e1d", "score": "0.68898416", "text": "def destroy\n @fabricante = Fabricante.find(params[:id])\n @fabricante.destroy\n\n respond_to do |format|\n format.html { redirect_to fabricantes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c2a34c52e18ea4a8ac20963418ab0158", "score": "0.6889042", "text": "def destroy\n @tipo_analise.destroy\n respond_to do |format|\n format.html { redirect_to tipo_analises_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "851bfc10f468b300b20eac084b49a20f", "score": "0.6887858", "text": "def destroy\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n addlog(\"Apagou um aviso\")\n\n respond_to do |format|\n format.html { redirect_to avisos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0063393becfeea5760b7e0e3a0f34cc8", "score": "0.6886759", "text": "def destroy\n @comunidad.destroy\n respond_to do |format|\n format.html { redirect_to comunidades_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7f4c8a71a9f076e5797373206a8da727", "score": "0.6886062", "text": "def destroy\n @detalle_aula.destroy\n respond_to do |format|\n format.html { redirect_to detalle_aulas_url, notice: 'Detalle aula was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b60b52c2a1482ba74d04de120626e241", "score": "0.6885725", "text": "def destroy\n @staatu = Staatu.find(params[:id])\n @staatu.destroy\n\n respond_to do |format|\n format.html { redirect_to staatus_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "27abbd952ef7179f6df06c073ad59f6b", "score": "0.6884652", "text": "def destroy\n @idioma = Idioma.find(params[:id])\n @idioma.destroy\n\n respond_to do |format|\n format.html { redirect_to idiomas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d376ba36dccf8e35802336c4d212a699", "score": "0.68795025", "text": "def destroy\n @situacao.destroy\n respond_to do |format|\n format.html { redirect_to situacoes_url, notice: 'Situacao foi apagado com sucesso.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "500b679b8a7c11b36fba31f7f1de8210", "score": "0.6879473", "text": "def destroy\n @nasabah = Nasabah.find(params[:id])\n @nasabah.destroy\n\n respond_to do |format|\n format.html { redirect_to nasabahs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "10f113e5adb1420da7addb818762d61d", "score": "0.6879244", "text": "def destroy\n @safra_impureza = SafraImpureza.find(params[:id])\n @safra_impureza.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/safra_produtos/#{@safra_impureza.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e9fe84fd59751427f89e6fd127181e75", "score": "0.6877402", "text": "def destroy\n @recetum = Recetum.find(params[:id])\n @recetum.destroy\n\n respond_to do |format|\n format.html { redirect_to receta_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f1f4694fea493e6cb4343c4fc662af37", "score": "0.68770975", "text": "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.html { redirect_to asignaturas_url, notice: \"Asignatura was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ea920e9ea2a2ddebf0581389ac94f9f0", "score": "0.6875179", "text": "def destroy\n @fatura = Fatura.find(params[:id])\n @fatura.destroy\n\n respond_to do |format|\n format.html { redirect_to faturas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e6d7ff0f87ed21c2c8b299f55cb5ba30", "score": "0.68741924", "text": "def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to datos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7c69461d7e64f143bf79a6b4362e580b", "score": "0.68727684", "text": "def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to estudiantes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "53a4ec727e837025284fce4497c83c91", "score": "0.6869731", "text": "def destroy\n @actestado.destroy\n respond_to do |format|\n format.html { redirect_to actestados_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "325e3df61887ae18cacda37bbb1b90e3", "score": "0.6869529", "text": "def destroy\n @testudo = Testudo.find(params[:id])\n @testudo.destroy\n\n respond_to do |format|\n format.html { redirect_to testudos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9cb4a779a35ebbe178709119f6c27812", "score": "0.6869232", "text": "def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to estaciones_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c073327d61f2fc992a43c182f5e91b7f", "score": "0.6868963", "text": "def destroy\n @paciente_estado.destroy\n respond_to do |format|\n format.html { redirect_to paciente_estados_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6f4e63099a451de9a0c9d9f52bc3d02d", "score": "0.6868329", "text": "def destroy\n @os_deb_tecnico.destroy\n respond_to do |format|\n format.html { redirect_to os_deb_tecnicos_url, notice: 'Os deb tecnico foi excluído(a)' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "320a85c0ed2ebf76223d07522c0e61b8", "score": "0.68662417", "text": "def destroy\n @motivo_consulta = MotivoConsulta.find(params[:motivo_consulta_id])\n @asignacion = @motivo_consulta.asignaciones.find(params[:id]) \n @asignacion.destroy\n\n respond_to do |format|\n format.html { redirect_to @motivo_consulta }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ece49b4e69227286da936f03d4006c4a", "score": "0.6864801", "text": "def destroy\n @sigesp_solicitud.destroy\n respond_to do |format|\n format.html { redirect_to sigesp_solicituds_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "abff7a0fa0994502e301b2c4c6878d48", "score": "0.68639016", "text": "def destroy\n @ocupacao.destroy\n respond_to do |format|\n format.html { redirect_to ocupacaos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "69e339e75a021e6152b841a16aca89cf", "score": "0.6862983", "text": "def destroy\n @detalle_dia.destroy\n respond_to do |format|\n format.html { redirect_to detalle_dias_url, notice: 'Detalle dia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "61a612450a40bff6bded6a3adcab4156", "score": "0.6858042", "text": "def destroy\n @solicitacao_exclusao.destroy\n respond_to do |format|\n format.html { redirect_to solicitacao_exclusaos_url, notice: 'Solicitacao exclusao was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "88784cca9ec86b8d3391e4467166e0c8", "score": "0.68566537", "text": "def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: 'Solicitud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "88784cca9ec86b8d3391e4467166e0c8", "score": "0.68566537", "text": "def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: 'Solicitud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3edfb95695e18001ac48bc0b15b4f79b", "score": "0.68562156", "text": "def destroy\n @detallefactura = Detallefactura.find(params[:id])\n @detallefactura.destroy\n\n respond_to do |format|\n format.html { redirect_to detallefacturas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "174b723f9e43bfa7501a9cdc389e4c1b", "score": "0.68513185", "text": "def delete\n @response = self.class.delete(\"#{@server_uri}/resource_name/#{@opts[:id]}.json\")\n end", "title": "" }, { "docid": "a5766791764e0af7ae2caf5e13ffa648", "score": "0.68500984", "text": "def destroy\n @sala_de_conferencium.destroy\n respond_to do |format|\n format.html { redirect_to sala_de_conferencia_url, notice: 'Sala de conferencium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cf2af5c39f41649ab1737e6981366284", "score": "0.6849556", "text": "def destroy\n @situacion_revista.destroy\n respond_to do |format|\n format.html { redirect_to situacion_revista_url, notice: 'La situacion de revista fué eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bdd0010a728c10339e310eb16f41e4ca", "score": "0.6848896", "text": "def destroy\n @diasemana.destroy\n respond_to do |format|\n format.html { redirect_to diasemanas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5fd968344b3521219eaf597025e79ae4", "score": "0.6847424", "text": "def destroy\n @anunciante = Anunciante.find(params[:id])\n @anunciante.destroy\n\n respond_to do |format|\n format.html { redirect_to anunciantes_url }\n format.json { head :no_content }\n end\n \n end", "title": "" }, { "docid": "27607aefcfec79c9f70af7a73da767ae", "score": "0.68472296", "text": "def destroy\n @examen_colocacion_idioma.destroy\n respond_to do |format|\n format.html { redirect_to examen_colocacion_idiomas_url, notice: 'La solicitud de examen de colocación se eliminó correctamente.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "179ff0053e8f4f967cb3d92206094cf0", "score": "0.6846943", "text": "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "title": "" }, { "docid": "b063282e6378ad703e64023658409795", "score": "0.6845346", "text": "def destroy\n @amiante.destroy\n respond_to do |format|\n format.html { redirect_to amiantes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "deacc907787f2b7c5e395060a0b17172", "score": "0.6844996", "text": "def destroy\n @restauraunt.destroy\n respond_to do |format|\n format.html { redirect_to restauraunts_url, notice: 'Restauraunt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "011c3812f08d3bc25254d1835584b894", "score": "0.6844951", "text": "def destroy\n @atendente = Atendente.find(params[:id])\n @atendente.destroy\n\n respond_to do |format|\n format.html { redirect_to atendentes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "69b7ad45df21695ae5620306216d4ec7", "score": "0.6843883", "text": "def destroy\r\n @sivic_estado.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_estados_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "aa62c500549ed7cbec37fa479840347e", "score": "0.68430805", "text": "def destroy\n @plantilla.destroy\n respond_to do |format|\n format.html { redirect_to plantillas_url , notice: 'Plantilla Eliminada ' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c3c004b560da2f69036ccfd63eae0361", "score": "0.6843076", "text": "def destroy\n @sustancium.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end", "title": "" }, { "docid": "153320572aa83db9ebd3d7df48e765f8", "score": "0.68420255", "text": "def destroy\n @solicitud_observacion.destroy\n respond_to do |format|\n format.html { redirect_to solicitud_observaciones_url, notice: 'Solicitud observacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "89be318ed3f58e47be3dd724157dad66", "score": "0.6839865", "text": "def destroy\n @ayuda = Ayuda.find(params[:id])\n @ayuda.destroy\n\n respond_to do |format|\n format.html { redirect_to ayudas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fb85f5a45cbea5bcaa8e1c9408f8cf91", "score": "0.6835413", "text": "def destroy\n @estudiante.destroy\n respond_to do |format|\n format.html { redirect_to estudiantes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b62a9319cef063e6bd237dec8cf83d0d", "score": "0.6834687", "text": "def destroy\n @unidad.destroy\n respond_to do |format|\n format.html { redirect_to unidades_url, notice: 'Unidad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0bce5cf45ceecf6a6a5f047c2a5e2c51", "score": "0.6834307", "text": "def destroy\n @remuneracion.destroy\n respond_to do |format|\n format.html { redirect_to remuneraciones_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "775a2d1d2217cc2c33d4619067608ae2", "score": "0.6832998", "text": "def destroy\n @venta_detalle = VentaDetalle.find(params[:id])\n @venta_detalle.destroy\n\n respond_to do |format|\n format.html { redirect_to venta_detalles_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d02b5ce08f4c483ea1d90237d09ce874", "score": "0.6832583", "text": "def destroy\n @atraccion.destroy\n respond_to do |format|\n format.html { redirect_to atraccions_url, notice: 'Atraccion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fad271cd72131e6ebb84e43cf191d124", "score": "0.6831865", "text": "def destroy\n @dados_banco.destroy\n respond_to do |format|\n format.html { redirect_to dados_bancos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4c1c164b581dbae14285797e584e8fb7", "score": "0.68289804", "text": "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "title": "" }, { "docid": "ebb9e8588cdd33bb408241d0ea8f59f0", "score": "0.6827415", "text": "def destroy\n @dudada.destroy\n respond_to do |format|\n format.html { redirect_to dudadas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2ad3bc8364f50035fd01165594c21646", "score": "0.68255013", "text": "def destroy\n @umedida.destroy\n respond_to do |format|\n format.html { redirect_to umedidas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "aa1ef1512731a2c922b794f41bef5477", "score": "0.6823087", "text": "def destroy\n @testedefinicao.destroy\n respond_to do |format|\n format.html { redirect_to testedefinicaos_url, notice: 'Testedefinicao was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "62d9e9690c7315c0fd13c2c4569f2436", "score": "0.0", "text": "def search_session_params\n @search_session_params ||= params.require(:search_session).permit(:search_type, :query, :results_count, :convertable_id, :convertable_type, :ui_session_data)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.7121987", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.70541996", "text": "def expected_permitted_parameter_names; end", "title": "" }, { "docid": "a91e9bf1896870368befe529c0e977e2", "score": "0.69483954", "text": "def param_whitelist\n [:role, :title]\n end", "title": "" }, { "docid": "547b7ab7c31effd8dcf394d3d38974ff", "score": "0.6902367", "text": "def default_param_whitelist\n [\"mode\"]\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6733912", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "4fc36c3400f3d5ca3ad7dc2ed185f213", "score": "0.6717838", "text": "def permitted_params\n []\n end", "title": "" }, { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6687021", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6676254", "text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.66612333", "text": "def filtered_parameters; end", "title": "" }, { "docid": "9a2a1af8f52169bd818b039ef030f513", "score": "0.6555296", "text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "title": "" }, { "docid": "7ac5f60df8240f27d24d1e305f0e5acb", "score": "0.6527056", "text": "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "title": "" }, { "docid": "53d84ad5aa2c5124fa307752101aced3", "score": "0.6456324", "text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "title": "" }, { "docid": "60ccf77b296ed68c1cb5cb262bacf874", "score": "0.6450841", "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": "f12336a181f3c43ac8239e5d0a59b5b4", "score": "0.6450127", "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": "12fa2760f5d16a1c46a00ddb41e4bce2", "score": "0.6447226", "text": "def param_whitelist\n [:rating, :review]\n end", "title": "" }, { "docid": "86b2d48cb84654e19b91d9d3cbc2ff80", "score": "0.6434961", "text": "def valid_params?; end", "title": "" }, { "docid": "16e18668139bdf8d5ccdbff12c98bd25", "score": "0.64121825", "text": "def permitted_params\n declared(params, include_missing: false)\n end", "title": "" }, { "docid": "16e18668139bdf8d5ccdbff12c98bd25", "score": "0.64121825", "text": "def permitted_params\n declared(params, include_missing: false)\n end", "title": "" }, { "docid": "7a6fbcc670a51834f69842348595cc79", "score": "0.63913447", "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": "bd826c318f811361676f5282a9256071", "score": "0.63804525", "text": "def filter_parameters; end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.63804525", "text": "def filter_parameters; end", "title": "" }, { "docid": "068f8502695b7c7f6d382f8470180ede", "score": "0.6373396", "text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "c04a150a23595af2a3d515d0dfc34fdd", "score": "0.6360051", "text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.6355191", "text": "def check_params; true; end", "title": "" }, { "docid": "9d23b31178b8be81fe8f1d20c154336f", "score": "0.62856233", "text": "def valid_params_request?; end", "title": "" }, { "docid": "533f1ba4c3ab55e79ed9b259f67a70fb", "score": "0.627813", "text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "title": "" }, { "docid": "9735bbaa391eab421b71a4c1436d109e", "score": "0.62451434", "text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.6228103", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "5ee931ad3419145387a2dc5a284c6fb6", "score": "0.6224965", "text": "def check_params\n true\n end", "title": "" }, { "docid": "fe4025b0dd554f11ce9a4c7a40059912", "score": "0.6222941", "text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "title": "" }, { "docid": "bb32aa218785dcd548537db61ecc61de", "score": "0.6210244", "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": "ff55cf04e6038378f431391ce6314e27", "score": "0.62077755", "text": "def additional_permitted_params\n []\n end", "title": "" }, { "docid": "c5f294dd85260b1f3431a1fbbc1fb214", "score": "0.61762565", "text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "title": "" }, { "docid": "0d980fc60b69d03c48270d2cd44e279f", "score": "0.61711127", "text": "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "title": "" }, { "docid": "1677b416ad07c203256985063859691b", "score": "0.6168448", "text": "def allow_params_authentication!; end", "title": "" }, { "docid": "3eef50b797f6aa8c4def3969457f45dd", "score": "0.6160164", "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": "c25a1ea70011796c8fcd4927846f7a04", "score": "0.61446255", "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": "8894a3d0d0ad5122c85b0bf4ce4080a6", "score": "0.6134175", "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": "34d018968dad9fa791c1df1b3aaeccd1", "score": "0.6120522", "text": "def paramunold_params\n params.require(:paramunold).permit!\n end", "title": "" }, { "docid": "76d85c76686ef87239ba8207d6d631e4", "score": "0.6106709", "text": "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "title": "" }, { "docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9", "score": "0.60981655", "text": "def quote_params\n params.permit!\n end", "title": "" }, { "docid": "2b19f8222e09c2518b0d19b4bf1f69d3", "score": "0.6076113", "text": "def list_params\n params.permit(:list_name)\n end", "title": "" }, { "docid": "aabfd0cce84d7f71b1ccd2df6a6af7c3", "score": "0.60534036", "text": "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "title": "" }, { "docid": "4f20d784611d82c07d49cf1cf0d6cb7e", "score": "0.60410434", "text": "def all_params; end", "title": "" }, { "docid": "5a96718b851794fc3e4409f6270f18fa", "score": "0.6034582", "text": "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "title": "" }, { "docid": "ff7bc2f09784ed0b4563cfc89b19831d", "score": "0.6029977", "text": "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "title": "" }, { "docid": "6c615e4d8eed17e54fc23adca0027043", "score": "0.6019861", "text": "def user_params\n 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": "" }, { "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": "" }, { "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": "2032edd5ab9475d59be84bdf5595f23a", "score": "0.60184896", "text": "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "title": "" }, { "docid": "c59ec134c641678085e086ab2a66a95f", "score": "0.60157263", "text": "def permitted_params\n @wfd_edit_parameters\n end", "title": "" }, { "docid": "a8faf8deb0b4ac1bcdd8164744985176", "score": "0.6005857", "text": "def user_params\r\n end", "title": "" }, { "docid": "b98f58d2b73eac4825675c97acd39470", "score": "0.6003803", "text": "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "0cb77c561c62c78c958664a36507a7c9", "score": "0.60012573", "text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "title": "" }, { "docid": "7b7196fbaee9e8777af48e4efcaca764", "score": "0.59955895", "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": "be95d72f5776c94cb1a4109682b7b224", "score": "0.5994598", "text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "title": "" }, { "docid": "70fa55746056e81854d70a51e822de66", "score": "0.5993604", "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": "e4c37054b31112a727e3816e94f7be8a", "score": "0.5983824", "text": "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "title": "" }, { "docid": "e3089e0811fa34ce509d69d488c75306", "score": "0.5983166", "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": "2202d6d61570af89552803ad144e1fe7", "score": "0.5977431", "text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "title": "" }, { "docid": "4d77abbae6d3557081c88dad60c735d0", "score": "0.597591", "text": "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "title": "" }, { "docid": "55d8ddbada3cd083b5328c1b41694282", "score": "0.5968824", "text": "def params_permit\n params.permit(:id)\n end", "title": "" }, { "docid": "a44360e98883e4787a9591c602282c4b", "score": "0.5965953", "text": "def allowed_params\n params.require(:allowed).permit(:email)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.59647584", "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.59647584", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "4e758c3a3572d7cdd76c8e68fed567e0", "score": "0.59566855", "text": "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "title": "" }, { "docid": "3154b9c9e3cd7f0b297f900f73df5d83", "score": "0.59506303", "text": "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "title": "" }, { "docid": "b48f61fbb31be4114df234fa7b166587", "score": "0.5950375", "text": "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "title": "" }, { "docid": "c4802950f28649fdaed7f35882118f20", "score": "0.59485626", "text": "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "5d64cb26ce1e82126dd5ec44e905341c", "score": "0.59440875", "text": "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "title": "" }, { "docid": "7fa620eeb32e576da67f175eea6e6fa0", "score": "0.5930872", "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": "da4f66ce4e8c9997953249c3ff03114e", "score": "0.5930206", "text": "def argument_params\n params.require(:argument).permit(:name)\n end", "title": "" }, { "docid": "f7c6dad942d4865bdd100b495b938f50", "score": "0.5925668", "text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "title": "" }, { "docid": "9892d8126849ccccec9c8726d75ff173", "score": "0.59235454", "text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "title": "" }, { "docid": "be01bb66d94aef3c355e139205253351", "score": "0.5917905", "text": "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "title": "" }, { "docid": "631f07548a1913ef9e20ecf7007800e5", "score": "0.59164816", "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": "d6bf948034a6c8adc660df172dd7ec6e", "score": "0.5913821", "text": "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "title": "" }, { "docid": "eb5b91d56901f0f20f58d574d155c0e6", "score": "0.59128743", "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": "c6a96927a6fdc0d2db944c79d520cd99", "score": "0.5906617", "text": "def parameters\n nil\n end", "title": "" }, { "docid": "822c743e15dd9236d965d12beef67e0c", "score": "0.59053683", "text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "title": "" }, { "docid": "a743e25503f1cc85a98a35edce120055", "score": "0.59052664", "text": "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "title": "" }, { "docid": "533048be574efe2ed1b3c3c83a25d689", "score": "0.5901591", "text": "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "title": "" }, { "docid": "02a61b27f286a50802d652930fee6782", "score": "0.58987755", "text": "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "title": "" }, { "docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa", "score": "0.5897456", "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": "238705c4afebc0ee201cc51adddec10a", "score": "0.58970183", "text": "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "title": "" }, { "docid": "d493d59391b220488fdc1f30bd1be261", "score": "0.58942604", "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": "" } ]
467f2bde5d5ff976413322fbcf83798f
:callseq: create_time > string Get the creation time of this run as an instance of class Time.
[ { "docid": "937b30911863592df3cc24f884c6e766", "score": "0.7425324", "text": "def create_time\n Time.parse(@server.read(links[:createtime], \"text/plain\", @credentials))\n end", "title": "" } ]
[ { "docid": "ead0f72fa3c385c99f0f3921809fdc20", "score": "0.82655436", "text": "def create_time\n Time.parse(@server.get_run_attribute(@uuid, @links[:createtime]))\n end", "title": "" }, { "docid": "7d0d2603a100d500e1265f1999c7fe5a", "score": "0.7640868", "text": "def create_time\n if @create_time.nil?\n @create_time = @proc.create_time\n end\n @create_time\n end", "title": "" }, { "docid": "901e91ca025b270975daf76d854a3507", "score": "0.7578815", "text": "def creation_time\n if !block_given?\n return @j_del.java_method(:creationTime, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling creation_time()\"\n end", "title": "" }, { "docid": "1cb3b49c142ce0147887473c843fb60a", "score": "0.7423784", "text": "def create_time\n Convert.timestamp_to_time @grpc.create_time\n end", "title": "" }, { "docid": "03ca3cf3d8cbc438e31ac895a2693c33", "score": "0.7405779", "text": "def creation_time\n Cproton.pn_message_get_creation_time(@impl)\n end", "title": "" }, { "docid": "dd5bdf42735c2aa3473c321276a82cf2", "score": "0.7359636", "text": "def creation_time\n @creation_time\n end", "title": "" }, { "docid": "dd5bdf42735c2aa3473c321276a82cf2", "score": "0.7359636", "text": "def creation_time\n @creation_time\n end", "title": "" }, { "docid": "dd5bdf42735c2aa3473c321276a82cf2", "score": "0.7359636", "text": "def creation_time\n @creation_time\n end", "title": "" }, { "docid": "dd5bdf42735c2aa3473c321276a82cf2", "score": "0.7359636", "text": "def creation_time\n @creation_time\n end", "title": "" }, { "docid": "dd5bdf42735c2aa3473c321276a82cf2", "score": "0.735854", "text": "def creation_time\n @creation_time\n end", "title": "" }, { "docid": "3965398330b9fce649a27d32ccecbf17", "score": "0.7269558", "text": "def instance_create_time\n data[:instance_create_time]\n end", "title": "" }, { "docid": "a931fbcaa4432ef10e193391860183a7", "score": "0.7243707", "text": "def time_created\n DateTime.parse(\"#{raw_date} #{raw_time}\")\n end", "title": "" }, { "docid": "b83fe389ec2825e934ac6f087897817b", "score": "0.7217274", "text": "def cTime\n create_time\n end", "title": "" }, { "docid": "ce8810f9a6bd7bdc95189c5047147ed8", "score": "0.7186197", "text": "def create_time\n data[:create_time]\n end", "title": "" }, { "docid": "ce8810f9a6bd7bdc95189c5047147ed8", "score": "0.7186197", "text": "def create_time\n data[:create_time]\n end", "title": "" }, { "docid": "8da6b8fcb9f6dcb08c5a622c717e8a1d", "score": "0.70940864", "text": "def createtime; end", "title": "" }, { "docid": "f660aaf9f81e5c64f211daf8057fa47d", "score": "0.70913595", "text": "def creation_time\n # Milliseconds\n ms = (@id >> 22) + DISCORD_EPOCH\n Time.at(ms / 1000.0)\n end", "title": "" }, { "docid": "f660aaf9f81e5c64f211daf8057fa47d", "score": "0.70913595", "text": "def creation_time\n # Milliseconds\n ms = (@id >> 22) + DISCORD_EPOCH\n Time.at(ms / 1000.0)\n end", "title": "" }, { "docid": "f660aaf9f81e5c64f211daf8057fa47d", "score": "0.70913595", "text": "def creation_time\n # Milliseconds\n ms = (@id >> 22) + DISCORD_EPOCH\n Time.at(ms / 1000.0)\n end", "title": "" }, { "docid": "d95697aa4fe5c7ee24b2c85c7eee6115", "score": "0.70627743", "text": "def self_created_time()\n Run::Self_Created_Time\n end", "title": "" }, { "docid": "3784f5a2006019829af62e5403e6a54b", "score": "0.7030236", "text": "def generation_time\n ::Time.at(generate_data.unpack1('N')).utc\n end", "title": "" }, { "docid": "6b5aa03de4ce2c9369ae01b00c216083", "score": "0.6983704", "text": "def create_time\n Time.now\n end", "title": "" }, { "docid": "767fa3f3e0ec936fc3f3782e6535650d", "score": "0.68954605", "text": "def creation_date\n puts 'creation_date'\n Time.now\n end", "title": "" }, { "docid": "6d25e99e4823b9d3dd6f2c670088e3d6", "score": "0.6867924", "text": "def creation_date_time\n return @creation_date_time\n end", "title": "" }, { "docid": "805bd6d7f61f102fdd79256c2958b074", "score": "0.683931", "text": "def createtime=(value); end", "title": "" }, { "docid": "30ceaebb2cafc8a8efea112c6b465a01", "score": "0.68016183", "text": "def creation_time=(value)\n @creation_time = value\n end", "title": "" }, { "docid": "30ceaebb2cafc8a8efea112c6b465a01", "score": "0.6800081", "text": "def creation_time=(value)\n @creation_time = value\n end", "title": "" }, { "docid": "30ceaebb2cafc8a8efea112c6b465a01", "score": "0.6800081", "text": "def creation_time=(value)\n @creation_time = value\n end", "title": "" }, { "docid": "30ceaebb2cafc8a8efea112c6b465a01", "score": "0.6800081", "text": "def creation_time=(value)\n @creation_time = value\n end", "title": "" }, { "docid": "30ceaebb2cafc8a8efea112c6b465a01", "score": "0.6800081", "text": "def creation_time=(value)\n @creation_time = value\n end", "title": "" }, { "docid": "5b6b4c9dc7256a39f10ff203c7d0251c", "score": "0.6799932", "text": "def generation_time\n Time.at(@data.pack(\"C4\").unpack(\"N\")[0]).utc\n end", "title": "" }, { "docid": "12b1c8869ea41466037b480d535c19fd", "score": "0.678885", "text": "def creation_time\n (run_baby_run 'GetFileInfo', ['-P', '-d', self]).chomp!\n end", "title": "" }, { "docid": "ba885e8a526a3ed32d87de4788db7650", "score": "0.6771311", "text": "def generation_time\n Time.at(@data.pack(\"C4\").unpack(\"N\")[0]).utc\n end", "title": "" }, { "docid": "ba885e8a526a3ed32d87de4788db7650", "score": "0.6771311", "text": "def generation_time\n Time.at(@data.pack(\"C4\").unpack(\"N\")[0]).utc\n end", "title": "" }, { "docid": "a346422c9c8d13f56e1052ed0535ba05", "score": "0.6770501", "text": "def time\n Time.new\n end", "title": "" }, { "docid": "88184f2ae43859ae8c4b1bcdfd329e0e", "score": "0.6763097", "text": "def createtime_nseconds; end", "title": "" }, { "docid": "ac508613788325a2c7dd043bf2560c45", "score": "0.6757716", "text": "def create_time\n if (sig = signature_line_stypes('CE')).empty?\n if customer && customer.tz\n tz = customer.tz\n else\n tz = 0\n end\n\n # should never be true but just in case.\n cd = self.creation_date\n ct = self.creation_time\n if cd.nil? || ct.nil?\n return created_at.to_datetime\n end\n # Note, the creation date and time from the PMR is in the time\n # zone of the specialist who created the PMR. I don't know\n # how to find out who that specialist was and, even if I\n # could, I don't know his time zone. So, I fudge and put the\n # create time according to the time zone of the customer. So\n # this is going to be wrong sometimes. But, it should never\n # be used anyway.\n DateTime.civil(2000 + cd[1..2].to_i, # not Y2K but who cares?\n cd[4..5].to_i, # month\n cd[7..8].to_i, # day\n ct[0..1].to_i, # hour\n ct[3..4].to_i, # minute\n 0, # second\n tz) # time zone\n else\n sig.first.date\n end\n end", "title": "" }, { "docid": "8947b08bd049f586b66771b4b3ff048c", "score": "0.6755966", "text": "def time\n DateTime.new(1963, 6, 10, hour, min)\n end", "title": "" }, { "docid": "05af320a06f3b50266d890064160b306", "score": "0.67267007", "text": "def time\n @time ||= Time\n end", "title": "" }, { "docid": "78e826a1e34d920eeb00b7f5482ed856", "score": "0.67179036", "text": "def creation_date_time\n @creation_date_time ||= Time.now.iso8601\n end", "title": "" }, { "docid": "1a5ed47735e7a743f52670b7c207ccc8", "score": "0.6707979", "text": "def created_time\n return @created_time\n end", "title": "" }, { "docid": "d0178652e2b4bd13afdf149ed1ba2d24", "score": "0.6679301", "text": "def time\n return @time if @time.is_a? String\n to_time_string(@time)\n end", "title": "" }, { "docid": "1ae50ae183b980f0e5741b3807f20e82", "score": "0.666214", "text": "def system_created\n Time.parse self['system_create_dtsi']\n end", "title": "" }, { "docid": "c1a7b59da51c215ef20f4318d4bb8fce", "score": "0.6658809", "text": "def time\n if Time.respond_to?(:zone) && Time.zone\n self.class.send(:define_method, :time) { Time.zone.now.to_s }\n else\n self.class.send(:define_method, :time) { Time.now.to_s }\n end\n time\n end", "title": "" }, { "docid": "5d61ab071e4ffa52b28812f9acebfe8d", "score": "0.66169655", "text": "def timestamp\n return @create_time.to_i\n end", "title": "" }, { "docid": "6a2f57971f43a0a6d1e462e61ccee01a", "score": "0.6595278", "text": "def measure_creation_time\n @start_time = Time.now\n end", "title": "" }, { "docid": "b52081dc1812d5bd93d42c23c545b7e1", "score": "0.65942377", "text": "def example_time\n return Time.new(2007,11,29,15,25,0)\n end", "title": "" }, { "docid": "d55ec7d189cc7edb2a4d75b4e1556887", "score": "0.6593264", "text": "def time\n DateTime.now.strftime(TIME_FORMAT)\n end", "title": "" }, { "docid": "25a82b280898b04f071e377de36c577b", "score": "0.6584971", "text": "def get_time\n Time.new.strftime(\"%r\")\n end", "title": "" }, { "docid": "dd809995a61e9ab97adb4a1a05b0157e", "score": "0.6567024", "text": "def time\n DateTime.new(year, month, day, hour, 0, 0, DateTime.now.offset)\n end", "title": "" }, { "docid": "0853bc3c91e1f38f2aa2ccd0d944de22", "score": "0.65641844", "text": "def time\n Time.at2(read_attribute(:time))\n end", "title": "" }, { "docid": "33f094906235efa5dfd4f2af7627628c", "score": "0.6560518", "text": "def creation_date_time\n data[:creation_date_time]\n end", "title": "" }, { "docid": "4036ba1029076f703fbccba8dfbcee0a", "score": "0.65548986", "text": "def create_time\n @log and @log.ctime\n end", "title": "" }, { "docid": "19da4083ef64c54dedaaa99358a7c6d1", "score": "0.6538899", "text": "def time\n created_at.strftime(\"%l:%M %P\")\n end", "title": "" }, { "docid": "e26e7e436666ca127d3070bb494dbd78", "score": "0.65291405", "text": "def time\n read_attr :time, :to_f\n end", "title": "" }, { "docid": "c065359d164f0a312bb25c12eb578fb0", "score": "0.65168476", "text": "def time\n @time ||= parse_time\n end", "title": "" }, { "docid": "122fdb0c9726b478cd1590a5ad28e279", "score": "0.65130866", "text": "def time\n @time\n end", "title": "" }, { "docid": "122fdb0c9726b478cd1590a5ad28e279", "score": "0.65103644", "text": "def time\n @time\n end", "title": "" }, { "docid": "d99a8cbcc046e1a2e7150f74ab35597a", "score": "0.650644", "text": "def time\n \t Kronic.format(self.created_at)\n \tend", "title": "" }, { "docid": "37fd8a6b0ae8276349451bcb2f08c14c", "score": "0.64942163", "text": "def start_time\n Time.parse(@server.get_run_attribute(@uuid, @links[:starttime]))\n end", "title": "" }, { "docid": "8a8c30c62d0592293939a18c7e3f25e9", "score": "0.6487955", "text": "def time\n MSPhysics::Newton::World.get_time(@address)\n end", "title": "" }, { "docid": "8af355eddd0b7530b2c5d308517b1374", "score": "0.64848363", "text": "def created_time\n Time.parse(object[\"created_time\"]) if object[\"created_time\"]\n end", "title": "" }, { "docid": "2d0d6bf3d9bc0865e01bf75f4605b385", "score": "0.6483598", "text": "def time\n\t\t\t@time ||= Time.at(@unix_time).utc.freeze\n\t\tend", "title": "" }, { "docid": "d3fe3054ee236b84b75beb2ee8a054b9", "score": "0.6483448", "text": "def time\n @time ||= Time.at(self.epoch_time)\n end", "title": "" }, { "docid": "c63756cebd6d6402d5f4810160c1c11c", "score": "0.6478542", "text": "def created\n Time.parse(get_attribute(:created))\n end", "title": "" }, { "docid": "364fbd0dcaa0a0cb927f684b59c5a65f", "score": "0.647145", "text": "def time\n return @time\n end", "title": "" }, { "docid": "c07abb9539bf04257cf0434d05831de8", "score": "0.6468696", "text": "def time\n @time ||= '%.2i:%.2i:%.2i.%.2i' % 7.downto(4).map { |i| hex_byte_field(i) }\n end", "title": "" }, { "docid": "06eb9e2c16a5f78409c514bea305aa0e", "score": "0.64672416", "text": "def created_time=(value)\n @created_time = value\n end", "title": "" }, { "docid": "55459e71f2e854936b5089a186c27f5b", "score": "0.6465395", "text": "def time\n spread = \"#{namespace}//=\".unpack('m').first.length\n Time.at(*bytes[spread, 4].unpack('N'))\n end", "title": "" }, { "docid": "7b01a730f593802b88373954056f2ca3", "score": "0.6463423", "text": "def getCreatedTime\r\n\t\t\t\t\treturn @createdTime\r\n\t\t\t\tend", "title": "" }, { "docid": "0227bd6d9ca086935a837ad96af500c3", "score": "0.6457847", "text": "def get_time\n Process.clock_gettime(Process::CLOCK_MONOTONIC)\n end", "title": "" }, { "docid": "48dfe35edcef2f8e03a1e8e359a04dff", "score": "0.64552987", "text": "def creation_time(model)\n tag = content_tag(:span, model.created_at.iso8601, :class => 'time', :title => model.created_at)\n (tag + \" by #{model[:creator_name] || model.creator.name}\") if model[:creator_name]\n tag.html_safe\n end", "title": "" }, { "docid": "a41ad0f1ca62a28140db655f56da609d", "score": "0.6454392", "text": "def when_taken\n Time.new object[\"when_taken\"] if object[\"when_taken\"]\n end", "title": "" }, { "docid": "38e396ce9567d9181274676b9e502bb5", "score": "0.64354336", "text": "def time_start\n self.start_time.to_s(:time)\n end", "title": "" }, { "docid": "687871cfa573c748bc1a3e410aeae9e2", "score": "0.6435017", "text": "def creation_date\n stat.ctime\n end", "title": "" }, { "docid": "687871cfa573c748bc1a3e410aeae9e2", "score": "0.6435017", "text": "def creation_date\n stat.ctime\n end", "title": "" }, { "docid": "687871cfa573c748bc1a3e410aeae9e2", "score": "0.6435017", "text": "def creation_date\n stat.ctime\n end", "title": "" }, { "docid": "78e3dd5f5e83440531e0d4b938342b09", "score": "0.6396311", "text": "def calc_time\n\n end", "title": "" }, { "docid": "45af79e0d44c28b6dcda0ca6557b45dd", "score": "0.6387929", "text": "def tammytime()\ntime=Time.new\nputs \"The mighty time function states that the date and time are: \" + time.inspect\nend", "title": "" }, { "docid": "d35df2fc4f6e4c5bd7f3529344131de1", "score": "0.63791794", "text": "def display_time\n\t GameTime.new(self.time).to_s\n\tend", "title": "" }, { "docid": "e80148594190c38b342a1ab167523837", "score": "0.63683015", "text": "def to_time\n Time.at(self)\n end", "title": "" }, { "docid": "2ae06a077f4fc962ec49443fadc26a89", "score": "0.6368086", "text": "def to_time\n @time\n end", "title": "" }, { "docid": "2ae06a077f4fc962ec49443fadc26a89", "score": "0.6368086", "text": "def to_time\n @time\n end", "title": "" }, { "docid": "6f51333f19a28364b27dbb19178986cb", "score": "0.63678384", "text": "def getTime\n\n\t\t$exeTime = Time.new.strftime(\"%Y-%m-%d %H:%M:%S\")\n\t\treturn $exeTime\n\tend", "title": "" }, { "docid": "6d49fb2e1c875a7c9bc6df532cb169d0", "score": "0.6365214", "text": "def time\n now = Time.now\n Time.local(now.year,now.mon,now.day,@h,@m,0)\n end", "title": "" }, { "docid": "998b1b551f8479cfa60aeb37c7ba2e01", "score": "0.6362759", "text": "def time\n Time.at(integer(0..TIMEMAX))\n end", "title": "" }, { "docid": "6b63e36dd6ec71c663b4b806e6cfb87d", "score": "0.6358313", "text": "def created; HfhinvConsoleHelpers.simple_time(created_at) rescue \"nil\"; end", "title": "" }, { "docid": "054d0b065293a86c24a525e0573eac91", "score": "0.63531876", "text": "def timestamp\n \"%.3f\" % (Time.now - @creation_time)\n end", "title": "" }, { "docid": "d5ab9b027a16c179ee7e422816af3415", "score": "0.6327887", "text": "def time_string; end", "title": "" }, { "docid": "1b6e7e9422cd14c44ae5e9ceba30b519", "score": "0.6327738", "text": "def time\n getTime\n end", "title": "" }, { "docid": "30218199f5a46ea3bfb367cafedbf43a", "score": "0.63270384", "text": "def creation_date\n if @file.respond_to?(:create_time)\n @file.create_time\n else\n DateTime.new\n end\n end", "title": "" }, { "docid": "18b76933f6dca851060e6c0aa98632b8", "score": "0.63263243", "text": "def to_s\n starting_time\n end", "title": "" }, { "docid": "80933137b01bda657d1a4d249d00fcea", "score": "0.63235295", "text": "def build_time\n return nil if received_at.blank?\n created_at - received_at\n end", "title": "" }, { "docid": "078229f8094bcda865939fb5877c304a", "score": "0.63234127", "text": "def start_time_name\n nice_time(start_time)\n end", "title": "" }, { "docid": "d67a5209cbeedf518097d2a6c15dc1d1", "score": "0.63204294", "text": "def time; end", "title": "" }, { "docid": "d67a5209cbeedf518097d2a6c15dc1d1", "score": "0.63204294", "text": "def time; end", "title": "" }, { "docid": "d67a5209cbeedf518097d2a6c15dc1d1", "score": "0.63204294", "text": "def time; end", "title": "" }, { "docid": "d67a5209cbeedf518097d2a6c15dc1d1", "score": "0.63204294", "text": "def time; end", "title": "" }, { "docid": "d67a5209cbeedf518097d2a6c15dc1d1", "score": "0.63204294", "text": "def time; end", "title": "" }, { "docid": "d67a5209cbeedf518097d2a6c15dc1d1", "score": "0.63204294", "text": "def time; end", "title": "" } ]
39ff7fecad13e432a68fce185888bdf3
Set the Time To Live (TTL) in seconds.
[ { "docid": "124b03a7b011a95c6d48e92fec96b25f", "score": "0.7786453", "text": "def ttl_in_seconds=(value)\n @ttl_in_seconds = value\n refresh_rates_expiration! if ttl_in_seconds\n end", "title": "" } ]
[ { "docid": "3fe24cb91b9e4939af9c785d7e28a9ac", "score": "0.79687583", "text": "def ttl_in_seconds= value\n @ttl_in_seconds = value\n refresh_rates_expiration! if ttl_in_seconds\n end", "title": "" }, { "docid": "abb47fb769cfed1d77eb558c77f457ba", "score": "0.78698397", "text": "def ttl_in_seconds=(value)\n @ttl_in_seconds = value\n refresh_rates_expiration! if ttl_in_seconds\n end", "title": "" }, { "docid": "abb47fb769cfed1d77eb558c77f457ba", "score": "0.78698397", "text": "def ttl_in_seconds=(value)\n @ttl_in_seconds = value\n refresh_rates_expiration! if ttl_in_seconds\n end", "title": "" }, { "docid": "abb47fb769cfed1d77eb558c77f457ba", "score": "0.78698397", "text": "def ttl_in_seconds=(value)\n @ttl_in_seconds = value\n refresh_rates_expiration! if ttl_in_seconds\n end", "title": "" }, { "docid": "beac7ce164941c57a2e4078fc7bd6be6", "score": "0.77870566", "text": "def ttl_in_seconds=(value)\n @ttl_in_seconds = value\n refresh_rates_expiration! if ttl_in_seconds\n end", "title": "" }, { "docid": "cced393a8350a45be9a76db2488145b4", "score": "0.7662536", "text": "def ttl_in_seconds=(value)\n @ttl_in_seconds = value\n refresh_rates_expiration if ttl_in_seconds\n ttl_in_seconds\n end", "title": "" }, { "docid": "d0ed4ce889e56788519d5ffa53a00ae7", "score": "0.75219226", "text": "def ttl=(seconds)\n self.shared_max_age = age + seconds\n end", "title": "" }, { "docid": "bc1587f85547eebf09c0cf8a1240a5d2", "score": "0.7303188", "text": "def time_to_live=(new_time_to_live)\n @time_to_live = new_time_to_live.round\n @time_to_live = 30.minutes if @time_to_live < 30.minutes\n end", "title": "" }, { "docid": "e29435328da297bd0ca0b4645ddff07d", "score": "0.72555923", "text": "def tag_time_to_live_in_seconds=(value)\n @tag_time_to_live_in_seconds = value\n end", "title": "" }, { "docid": "b15521a9e4db97670e46e17bce0dc708", "score": "0.71237296", "text": "def ttl(ttl)\n @ttl = ttl\n self\n end", "title": "" }, { "docid": "3d705ecb2c9d41e7835489d8c787e1c0", "score": "0.7057216", "text": "def setttl(value)\n @service.context.post(@control_path, :action => 'setttl', :ttl => value)\n end", "title": "" }, { "docid": "bfb9a1e5f5534e5fb63ff7b7f6e9b9a5", "score": "0.69073504", "text": "def client_ttl=(seconds)\n self.max_age = age + seconds\n end", "title": "" }, { "docid": "3a50977fdf50b45fa3bc568de4635aec", "score": "0.6892447", "text": "def default_ttl=(seconds)\n @default_ttl = seconds\n end", "title": "" }, { "docid": "a222bef18cf356b6df5c42fd228c3494", "score": "0.6634137", "text": "def set_cache_ttl(ttl)\n @cache_ttl = ttl\n end", "title": "" }, { "docid": "a222bef18cf356b6df5c42fd228c3494", "score": "0.6634137", "text": "def set_cache_ttl(ttl)\n @cache_ttl = ttl\n end", "title": "" }, { "docid": "b9ad6bc984190605bd11be02448b00d6", "score": "0.6632302", "text": "def ttl_duration\n 900\n end", "title": "" }, { "docid": "2bfcb6c998ffd9011fcff936b1d840d3", "score": "0.6547748", "text": "def tag_time_to_live_in_seconds\n @tag_time_to_live_in_seconds ||= 60\n end", "title": "" }, { "docid": "50eef4630b1569d55a169a10f9c8901d", "score": "0.63136774", "text": "def update_ttl\n Directory[@id].update_ttl\n @ttl = after(@ttl_rate) { update_ttl }\n end", "title": "" }, { "docid": "605fc967f5ba88d56bda0928e7a9efd5", "score": "0.62218547", "text": "def lease_time\n return (0.667 * @ttl).to_i\n end", "title": "" }, { "docid": "fac5b4160d9a37897e32df736446150c", "score": "0.6179143", "text": "def ttl=(duration)\n if duration.is_a? Qpid::Messaging::Duration\n @message_impl.setTtl duration.duration_impl\n else\n @message_impl.setTtl Cqpid::Duration.new duration.to_i\n end\n end", "title": "" }, { "docid": "b8e5875d8ff4e2f7ecd026c867e00e3d", "score": "0.61707824", "text": "def ttl(key)\n send_command([:ttl, key])\n end", "title": "" }, { "docid": "e834a07c14bac2b2232db8ef385dbdfc", "score": "0.61558086", "text": "def ttl\n self[:ip_ttl]\n end", "title": "" }, { "docid": "b6f8a7e6fc85f8ab97bed63d014aee4f", "score": "0.6148867", "text": "def ttl\n max_age - age if max_age\n end", "title": "" }, { "docid": "70cd3f6858ff80e96e4d15b3353d0f04", "score": "0.6146523", "text": "def ttl(key)\n call(key, [:ttl, key], read: true)\n end", "title": "" }, { "docid": "f0b495226818dad5efdad458c507dd10", "score": "0.60202223", "text": "def update!(**args)\n @expire_time = args[:expire_time] if args.key?(:expire_time)\n @ttl = args[:ttl] if args.key?(:ttl)\n end", "title": "" }, { "docid": "1028b1594d8b6d5141c3bc1231baae31", "score": "0.59357", "text": "def time_to_live\n if @time_to_live.nil?\n unless channel_node.nil?\n # get the feed time to live from the xml document\n update_frequency = FeedTools::XmlHelper.try_xpaths(\n self.channel_node,\n [\"syn:updateFrequency/text()\"], :select_result_value => true)\n if !update_frequency.blank?\n update_period = FeedTools::XmlHelper.try_xpaths(\n self.channel_node,\n [\"syn:updatePeriod/text()\"], :select_result_value => true)\n if update_period == \"daily\"\n @time_to_live = update_frequency.to_i.day\n elsif update_period == \"weekly\"\n @time_to_live = update_frequency.to_i.week\n elsif update_period == \"monthly\"\n @time_to_live = update_frequency.to_i.month\n elsif update_period == \"yearly\"\n @time_to_live = update_frequency.to_i.year\n else\n # hourly\n @time_to_live = update_frequency.to_i.hour\n end\n end\n if @time_to_live.nil?\n # usually expressed in minutes\n update_frequency = FeedTools::XmlHelper.try_xpaths(\n self.channel_node, [\"ttl/text()\"],\n :select_result_value => true)\n if !update_frequency.blank?\n update_span = FeedTools::XmlHelper.try_xpaths(\n self.channel_node, [\"ttl/@span\"],\n :select_result_value => true)\n if update_span == \"seconds\"\n @time_to_live = update_frequency.to_i\n elsif update_span == \"minutes\"\n @time_to_live = update_frequency.to_i.minute\n elsif update_span == \"hours\"\n @time_to_live = update_frequency.to_i.hour\n elsif update_span == \"days\"\n @time_to_live = update_frequency.to_i.day\n elsif update_span == \"weeks\"\n @time_to_live = update_frequency.to_i.week\n elsif update_span == \"months\"\n @time_to_live = update_frequency.to_i.month\n elsif update_span == \"years\"\n @time_to_live = update_frequency.to_i.year\n else\n @time_to_live = update_frequency.to_i.minute\n end\n end\n end\n if @time_to_live.nil?\n @time_to_live = 0\n update_frequency_days =\n FeedTools::XmlHelper.try_xpaths(self.channel_node,\n [\"schedule/intervaltime/@day\"], :select_result_value => true)\n update_frequency_hours =\n FeedTools::XmlHelper.try_xpaths(self.channel_node,\n [\"schedule/intervaltime/@hour\"], :select_result_value => true)\n update_frequency_minutes =\n FeedTools::XmlHelper.try_xpaths(self.channel_node,\n [\"schedule/intervaltime/@min\"], :select_result_value => true)\n update_frequency_seconds =\n FeedTools::XmlHelper.try_xpaths(self.channel_node,\n [\"schedule/intervaltime/@sec\"], :select_result_value => true)\n if !update_frequency_days.blank?\n @time_to_live = @time_to_live + update_frequency_days.to_i.day\n end\n if !update_frequency_hours.blank?\n @time_to_live = @time_to_live + update_frequency_hours.to_i.hour\n end\n if !update_frequency_minutes.blank?\n @time_to_live = @time_to_live +\n update_frequency_minutes.to_i.minute\n end\n if !update_frequency_seconds.blank?\n @time_to_live = @time_to_live + update_frequency_seconds.to_i\n end\n if @time_to_live == 0\n @time_to_live = self.configurations[:default_ttl].to_i\n end\n end\n end\n end\n if @time_to_live.nil? || @time_to_live == 0\n # Default to one hour\n @time_to_live = self.configurations[:default_ttl].to_i\n elsif self.configurations[:max_ttl] != nil &&\n self.configurations[:max_ttl] != 0 &&\n @time_to_live >= self.configurations[:max_ttl].to_i\n @time_to_live = self.configurations[:max_ttl].to_i\n end\n @time_to_live = @time_to_live.round\n return @time_to_live\n end", "title": "" }, { "docid": "1b5f2f249c92d6a42f8dbc07cb75f57a", "score": "0.5896157", "text": "def refresh_expiry\n self.expires_at = Time.now + ttl\n end", "title": "" }, { "docid": "bd125c298f2f2aa16bee9b5b278b91df", "score": "0.58608925", "text": "def initialize(object, ttl = nil)\n ttl = TTL_ONE_HOUR if ttl.nil?\n @object = object\n @expiry_time = Time.now + ttl\n end", "title": "" }, { "docid": "e225cde51bfa6e7299bdff822b343d67", "score": "0.580905", "text": "def set_to_live\n # Checks it was created more than 5 seconds ago as there are updates on creation.\n if self.draft? && self.created_at < 5.seconds.ago\n self.draft = false\n self.save!(validate: false)\n end\n end", "title": "" }, { "docid": "1d751e344da8aad6d5b883aa2f58ca5c", "score": "0.5807456", "text": "def update_ttl(session_index, ttl_value, force_update)\n if force_update\n session[session_index] = Time.zone.now + (ttl_value * 1.minute)\n else\n session[session_index] ||= Time.zone.now + (ttl_value * 1.minute)\n end\n end", "title": "" }, { "docid": "cd79c0d0a5f3e1e24d273283daff453d", "score": "0.57195747", "text": "def default_ttl=(interval)\n @default_ttl = Core::Utils::Interval.try_convert(interval)\n end", "title": "" }, { "docid": "cd3a07fa0cd8ec0f260d27d72a7d10e5", "score": "0.5703887", "text": "def set_live\n @live = Live.find(params[:id])\n end", "title": "" }, { "docid": "061f61184583fb8da3946095f2a72eb1", "score": "0.5693772", "text": "def seconds=(new_seconds)\n\t\t@seconds = new_seconds\n\tend", "title": "" }, { "docid": "19dac555ea88ea2721f07901d7273a8c", "score": "0.5672629", "text": "def timeout?(ttl)\n (!ttl.nil?) && (ttl > 0) && ((Time.now - @timestamp) > ttl)\n end", "title": "" }, { "docid": "a3060603c84779551b439380ebd68c21", "score": "0.567209", "text": "def update_ttl new_ttl=nil\n # Load default if no new ttl is specified\n new_ttl = self._default_expire if new_ttl.nil?\n # Make sure we have a valid value\n new_ttl = -1 if !new_ttl.to_i.is_a?(Fixnum) || new_ttl.to_i < 0\n # Update indices\n Ohm.redis.expire(self.key, new_ttl)\n Ohm.redis.expire(\"#{self.key}:_indices\", new_ttl)\n end", "title": "" }, { "docid": "54a4ff6fbab5ca322c7a1717dee8984e", "score": "0.5640638", "text": "def ttl\n config = Pillowfort.config\n\n case self.type\n when 'activation' then config.activation_token_ttl\n when 'password_reset' then config.password_reset_token_ttl\n else config.session_token_ttl\n end\n end", "title": "" }, { "docid": "d92fc9d67266a9adc25d25a383ffeb1d", "score": "0.56188595", "text": "def lifetime_in_minutes=(value)\n @lifetime_in_minutes = value\n end", "title": "" }, { "docid": "18f4cd8e7c51c5600513871864854b29", "score": "0.56013626", "text": "def expires_in=(duration)\n self.expires_at = duration.from_now\n end", "title": "" }, { "docid": "03edb8459e62de12d962b19a16729d57", "score": "0.55754805", "text": "def refresh_rates_expiration!\n @rates_expiration = Time.now + ttl_in_seconds\n end", "title": "" }, { "docid": "03edb8459e62de12d962b19a16729d57", "score": "0.55754805", "text": "def refresh_rates_expiration!\n @rates_expiration = Time.now + ttl_in_seconds\n end", "title": "" }, { "docid": "03edb8459e62de12d962b19a16729d57", "score": "0.55754805", "text": "def refresh_rates_expiration!\n @rates_expiration = Time.now + ttl_in_seconds\n end", "title": "" }, { "docid": "03edb8459e62de12d962b19a16729d57", "score": "0.55754805", "text": "def refresh_rates_expiration!\n @rates_expiration = Time.now + ttl_in_seconds\n end", "title": "" }, { "docid": "dee9095ce388fe93a9f7c4a0f552d812", "score": "0.55724335", "text": "def ttl(key); end", "title": "" }, { "docid": "dee9095ce388fe93a9f7c4a0f552d812", "score": "0.55724335", "text": "def ttl(key); end", "title": "" }, { "docid": "f02ea9209c36e2198f6c500d99cfb67d", "score": "0.55507433", "text": "def delay_time=(seconds)\n end", "title": "" }, { "docid": "be0082e33b701f3ecc39a8e656806d9c", "score": "0.5536651", "text": "def ttl\n Goalkeeper.redis.ttl(key)\n end", "title": "" }, { "docid": "c94c8e7a3bcf04006e219d31129f799f", "score": "0.5534799", "text": "def process_pttl(command)\n ttl = process_ttl(command)\n (ttl > 0)? ttl * 1000 : ttl\n end", "title": "" }, { "docid": "9e655e39cc286bc7b2ef7b2c764411a1", "score": "0.55283344", "text": "def refresh_rates_expiration!\n @rates_expiration = Time.now + ttl_in_seconds\n end", "title": "" }, { "docid": "0472355aac5502278614aece0de0a2aa", "score": "0.55099833", "text": "def setex(key, ttl, value)\n send_command([:setex, key, Integer(ttl), value.to_s])\n end", "title": "" }, { "docid": "2eb0b89d76be165db489e19bb87341d1", "score": "0.5505277", "text": "def save(**options)\n options[:ttl] = self.created_at + self.expires_in + 30\n super(**options)\n end", "title": "" }, { "docid": "028df07d171c187b73cdd7fae53fd2f7", "score": "0.5504836", "text": "def expires_at=(time)\n self.expiry_option = :on\n self[:expires_at] = time\n end", "title": "" }, { "docid": "1578517fa44ef662f3e242fd30cdd89f", "score": "0.55027974", "text": "def ttl()\n Store.db.ttl(db_id)\n end", "title": "" }, { "docid": "e419a1589d49c61a2bb0db91e9777fce", "score": "0.5499146", "text": "def dns_cache_timeout=(value)\n Curl.set_option(:dns_cache_timeout, value_for(value, :int), handle)\n end", "title": "" }, { "docid": "ed0078f55aab246210ecf4074e68c2aa", "score": "0.54793704", "text": "def ttl(controller, action)\n raise ActionNotCached.new(\"You asked for the TTL for the '#{action}' action in the '#{controller}' controller, but according to our wallet configuration, that action is not cached.\") unless cached?(controller, action) \n controller, action = stringify_params controller, action\n if @config[controller][action]\n convert_time @config[controller][action]\n else\n @default_ttl\n end\n end", "title": "" }, { "docid": "b4e9c8ffc1a70b372b083d6cefe21def", "score": "0.5476992", "text": "def lease=duration\n lease = @watch.objects.find { |o| o.name == \"lease\" }\n\n lease.attributes[:val] = duration\n\n Network.put lease.href, lease\n end", "title": "" }, { "docid": "9ec7e91b45d556160632b8730002363c", "score": "0.5471688", "text": "def ttl_or_default(ttl)\n (ttl || @options[:expires_in]).to_i\n rescue NoMethodError\n raise ArgumentError, \"Cannot convert ttl (#{ttl}) to an integer\"\n end", "title": "" }, { "docid": "e9bf73ea56392fd0db7dc8a71a2c3ef2", "score": "0.54568756", "text": "def ttl(key)\n node_for(key).ttl(key)\n end", "title": "" }, { "docid": "7f54161edf5b6850ff04b8c413df8476", "score": "0.54366773", "text": "def expiry(t)\n Time.now.to_i + t\n end", "title": "" }, { "docid": "6b81eea7db2a460e20ff2108ffd05cf4", "score": "0.5431326", "text": "def update!(**args)\n @timeout = args[:timeout] if args.key?(:timeout)\n end", "title": "" }, { "docid": "546b07354061d8eb67ef402c7418fa5a", "score": "0.54277873", "text": "def timeout=(timeout)\n @stop_time = timeout.nil? ? nil : current_time + timeout\n end", "title": "" }, { "docid": "383e32b95868abdf9421836bdbf191e7", "score": "0.54187846", "text": "def expires_in(seconds, options = T.unsafe(nil)); end", "title": "" }, { "docid": "866e52458396fd584cc6e36fc75ee838", "score": "0.5404552", "text": "def set_timeout(value)\n if value.nil?\n @timeout = 2\n else\n return skip_resource 'timeout is not numeric' unless value.to_s =~ /^\\d+$/\n @timeout = value\n end\n end", "title": "" }, { "docid": "03a0037d008dff3a0be98192e5c7f8ae", "score": "0.54020554", "text": "def ttl(key)\n key = add_namespace(key)\n @redis.ttl(key)\n end", "title": "" }, { "docid": "008649d5425efb76a0eef83f3df985d7", "score": "0.5395086", "text": "def set(key, value, ttl: ShopifyClient.config.cache_ttl)\n raise NotImplementedError\n end", "title": "" }, { "docid": "ca952ca7cff8c780950bb474eaafc312", "score": "0.5391078", "text": "def expires_in=(value)\n @expires_in = value\n @expires = nil\n end", "title": "" }, { "docid": "b46c113d590b984ec32b6271b832cc86", "score": "0.53790826", "text": "def timeout=(value)\n @timeout = value\n end", "title": "" }, { "docid": "78eb7c258f4552c97b726e48bfe0ec42", "score": "0.5375599", "text": "def set(key, value, ttl = 0)\n stats[:set] += 1\n handler.set key, value, ttl\n end", "title": "" }, { "docid": "b1cc28791114fa3e6a573eda3414a3ee", "score": "0.5366273", "text": "def watch=(seconds)\n @watch = seconds.to_i\n end", "title": "" }, { "docid": "551e976be4fd9f38ac5e665fe5cd536b", "score": "0.5358157", "text": "def timeout=(timeout)\n @timeout = timeout.to_f/1000 * 60\n end", "title": "" }, { "docid": "d3a57adcc8e40cde7cae3e26d5c6737f", "score": "0.534516", "text": "def set_live\n @live = Live.find(params[:id])\n end", "title": "" }, { "docid": "54440b9b6d1cd89780d40ececd4aab6a", "score": "0.5344424", "text": "def default_message_time_to_live\n to_interval description['DefaultMessageTimeToLive']\n end", "title": "" }, { "docid": "54440b9b6d1cd89780d40ececd4aab6a", "score": "0.5344424", "text": "def default_message_time_to_live\n to_interval description['DefaultMessageTimeToLive']\n end", "title": "" }, { "docid": "44c848d4de8402f0006acc61e0d0addf", "score": "0.5340574", "text": "def sec=(newsec)\n newsec = newsec.to_i\n raise ArgumentError, \"Invalid second: '#{newsec}'.\" if newsec < 0 or newsec > 60\n @t_sec = newsec.to_i\n end", "title": "" }, { "docid": "e6715f02c16f3cc40f867e3bab5bfcca", "score": "0.5336126", "text": "def psetex(key, ttl, value)\n send_command([:psetex, key, Integer(ttl), value.to_s])\n end", "title": "" }, { "docid": "19670caaaa9b0b6710d0659ca4e4f1ef", "score": "0.5332706", "text": "def uptime\n Time.now - live_since\n end", "title": "" }, { "docid": "0bef88b4a2b630284823e5bbab047c4c", "score": "0.5324054", "text": "def expires_at=(value)\n self[:expires_at] = value\n end", "title": "" }, { "docid": "7dd3aa766f4f4c33607cae26c4df64ec", "score": "0.53186977", "text": "def setWaypointTimeout _obj, _args\n \"_obj setWaypointTimeout _args;\" \n end", "title": "" }, { "docid": "44d30b1c7f0e4216257db7de68bcb618", "score": "0.5303753", "text": "def setex(key, ttl, value); end", "title": "" }, { "docid": "44d30b1c7f0e4216257db7de68bcb618", "score": "0.5303753", "text": "def setex(key, ttl, value); end", "title": "" }, { "docid": "c3d00ed2c78eb34db37434df69506f01", "score": "0.5294565", "text": "def latency(seconds)\n @adapter_options[:latency] = seconds\n self\n end", "title": "" }, { "docid": "ad1fc2934062342f0760b114a619f396", "score": "0.52929646", "text": "def expires=(value)\n @expires = value\n @expires_in = nil\n end", "title": "" }, { "docid": "af4e47e98a5e818ee63c3e96a03fa8b7", "score": "0.52904314", "text": "def change(options) #:nodoc:\n TzTime.new(time.change(options), @zone)\n end", "title": "" }, { "docid": "00c2fbb8e3213b86401de60c9b3338b4", "score": "0.52672035", "text": "def set_time(fl, tm)\n shell_out!(\"ncap2 -O -s \\\"validTime = #{tm.to_time.to_f}\\\" #{fl} #{fl}\")\n end", "title": "" }, { "docid": "4032a060198626a8a1b256f7fde2c01c", "score": "0.52555215", "text": "def timeout=(new_timeout)\n if new_timeout && new_timeout.to_f < 0\n raise ArgumentError, \"Timeout must be a positive number\"\n end\n @timeout = new_timeout.to_f\n end", "title": "" }, { "docid": "77d8b3c6c81c287a6fd4bb57b0161e54", "score": "0.52523494", "text": "def set_timer\n user = current_user\n base_seconds = (!user.base_seconds && params[:state] == \"paused\") ? (user.base_seconds.to_i + params[:base_seconds].to_i) : params[:base_seconds].to_i\n user.update_attributes(:timer_start_time => params[:start_time], :timer_state => params[:state], :base_seconds => base_seconds)\n render :nothing => true\n end", "title": "" }, { "docid": "9fedde208590d4bd07395fa56be3550f", "score": "0.5251009", "text": "def update_activity_time\n session[:expires_at] = (configatron.session_time_out.to_i || 10).minutes.from_now\n end", "title": "" }, { "docid": "6ba1f61f7295d55b94518a44c3f11a90", "score": "0.523628", "text": "def default_ttl\n Core::Utils::Interval.try_convert(@default_ttl)\n end", "title": "" }, { "docid": "1ab332f4987924342480267428f3f4a2", "score": "0.52351576", "text": "def ttl; Qpid::Messaging::Duration.new @message_impl.getTtl.getMilliseconds; end", "title": "" }, { "docid": "c9d4faf4451b0e8c20b1f2d1bf7bae7e", "score": "0.52263784", "text": "def set_teetime\n @teetime = Teetime.find params[:id]\n end", "title": "" }, { "docid": "90ee471405309311da7eae74c3061f27", "score": "0.52158374", "text": "def timeout?(ttl)\n @timestamp.timeout?(ttl)\n end", "title": "" }, { "docid": "2ab8a7ff4df3682585519ab734ddfb83", "score": "0.5212815", "text": "def setex(key, ttl, value)\n node_for(key).setex(key, ttl, value)\n end", "title": "" }, { "docid": "c1e61ece3b68388cd44914536705adf7", "score": "0.5211563", "text": "def expiration=(value)\n @expiration = value\n end", "title": "" }, { "docid": "e98f70e58849a92b3f29ef4ce6925efb", "score": "0.5208923", "text": "def timeout=(value)\n @transfer[:timeout] = value\n end", "title": "" }, { "docid": "f43571c2f7eb902574f24fb9124d668e", "score": "0.5204975", "text": "def set_to_live_player\n @to_live_player = ToLive::Player.find(params[:id])\n end", "title": "" }, { "docid": "d58f7b41f726bf8eca7aa6621b2ea97a", "score": "0.5199193", "text": "def update_activity_time\n session[:expires_at] = DateTime.now + 30.minutes\n end", "title": "" }, { "docid": "e05233a7a10c7ff4c715b90230fc8554", "score": "0.5193752", "text": "def time=(new_time)\n @time = new_time\n end", "title": "" }, { "docid": "781035d1068efaa52d14ed4d39e27c1c", "score": "0.51927567", "text": "def ttl(key)\n pttl = @redis.pttl(\"SimpleRedisLock:#{key}\")\n return nil if pttl == -2\n\n pttl.to_f / 1000\n end", "title": "" }, { "docid": "6f98c83e6fd498cc4b6e67722e94db22", "score": "0.51882005", "text": "def expiry\n @expiry ||= 60 * 10\n end", "title": "" }, { "docid": "6f98c83e6fd498cc4b6e67722e94db22", "score": "0.51882005", "text": "def expiry\n @expiry ||= 60 * 10\n end", "title": "" }, { "docid": "e4cf9d3520900bfce21c035c5b035b2e", "score": "0.51807714", "text": "def expire\n update_attribute :expires_at, 1.minute.ago\n end", "title": "" } ]
6ed7e2d150d60538802413c950a6e3a5
GET /conversations/1 GET /conversations/1.json
[ { "docid": "44bb47d1aed75d45bef28b065797d16b", "score": "0.0", "text": "def show\n redirect_to conversation_messages_path(@conversation)\n end", "title": "" } ]
[ { "docid": "a76ae7f2f37f33be4d203540ecee7005", "score": "0.7849923", "text": "def show\r\n @conversation = current_user.mailbox.conversations.find(params[:id])\r\n render json: @conversation\r\n end", "title": "" }, { "docid": "5d5b520ece06808f670fba74b4592a7a", "score": "0.7771957", "text": "def index\r\n @conversations = current_user.mailbox.conversations\r\n render json: @conversations\r\n end", "title": "" }, { "docid": "1aff81cf140b8d7116186b6ec2f3637e", "score": "0.77711976", "text": "def get_conversation(id)\n get(\"conversations/#{id}\")\n end", "title": "" }, { "docid": "1aff81cf140b8d7116186b6ec2f3637e", "score": "0.77711976", "text": "def get_conversation(id)\n get(\"conversations/#{id}\")\n end", "title": "" }, { "docid": "812b8dc4e51d9c1fb9bae49df27ea6dd", "score": "0.7707933", "text": "def index\n @conversations = Conversation.all\n render json: @conversations, status: :ok\n end", "title": "" }, { "docid": "a83e63e87dfe693bdec2a571e7ee3960", "score": "0.77022684", "text": "def index\n # render json: Conversation.all\n @conversations = Conversation.all\n end", "title": "" }, { "docid": "7146907b0ff263cca99e06dc63a02d2d", "score": "0.7664095", "text": "def list_conversations\n call(:get, '/conversations')\n end", "title": "" }, { "docid": "785e2aff826b840b4e31cb2ec4c6f166", "score": "0.762461", "text": "def index\n @conversations = Conversation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conversations }\n end\n end", "title": "" }, { "docid": "785e2aff826b840b4e31cb2ec4c6f166", "score": "0.762461", "text": "def index\n @conversations = Conversation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conversations }\n end\n end", "title": "" }, { "docid": "785e2aff826b840b4e31cb2ec4c6f166", "score": "0.762461", "text": "def index\n @conversations = Conversation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conversations }\n end\n end", "title": "" }, { "docid": "785e2aff826b840b4e31cb2ec4c6f166", "score": "0.762461", "text": "def index\n @conversations = Conversation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conversations }\n end\n end", "title": "" }, { "docid": "762058d063d8b6f95da8042263fe4f42", "score": "0.75493187", "text": "def fetch_conversation\n @conversation = conversations.find(params[:id])\n end", "title": "" }, { "docid": "3051476fbabc6e0ebe4e32cdde4b0ecc", "score": "0.738095", "text": "def index\n conversations = Api::V1::Conversation.where('sender_id = ? OR recipient_id = ?', @current_user.id, @current_user.id).order('updated_at DESC').all\n \n paginate json: conversations\n end", "title": "" }, { "docid": "242736ad61264bd6417f468078c45bbd", "score": "0.7377235", "text": "def chat_conversations; JSON[Api::get_chat_conversations(self)]; end", "title": "" }, { "docid": "341b76aff355b71a34a900c6e3d5082d", "score": "0.7337774", "text": "def conversation\n \n @conversation ||= mailbox.conversations.find(params[:id])\n end", "title": "" }, { "docid": "d9d06e9ce466a2d85e7103b07a76b3fd", "score": "0.7309127", "text": "def index\n @conversations = Conversation.in(id: current_user.participates.pluck(:conversation_id).map(&:to_s)).all.entries\n @conversations = @conversations | current_user.conversations.all.entries\n if params[:id].present?\n @conversation = Conversation.find({id: params[:id]})\n else\n\n id = Message.last.conversation_id\n @conversation = Conversation.find({id: id}) if id.present?\n @conversation = Conversation.last if @conversation.nil?\n end\n @messages = @conversation&.messages\n end", "title": "" }, { "docid": "3b0e324eb4bf8502596d86479afd8866", "score": "0.7306268", "text": "def show\n @conversation = Conversation.find(params[:id])\n render :json => {:conversation => @conversation }\n end", "title": "" }, { "docid": "2798589e4063196e5472727449d799b8", "score": "0.72748315", "text": "def conversations(query=nil)\n @list.client.get(\"#{url}/conversations\", query)\n end", "title": "" }, { "docid": "9987d11b6403c80d5929e53209b80cb9", "score": "0.726273", "text": "def conversation\n @conversation ||= mailbox.conversations.find(params[:id])\n end", "title": "" }, { "docid": "5424309524919e21ec1eb7b0d2c7958a", "score": "0.7244659", "text": "def index\n @messages = @conversation.messages\n render json: @messages\n end", "title": "" }, { "docid": "b6bc44aa4e365c7fba88a064447e2152", "score": "0.7232057", "text": "def index\n conversations = current_user.mailbox.conversations(:mailbox_type => 'not_trash')\n respond_with conversations, each_serializer: Api::V1::CompactConversationSerializer, :current_user => current_user, :root => 'conversations'\n end", "title": "" }, { "docid": "798f85899a275c7c43b5ee893a1f82d2", "score": "0.7232003", "text": "def index\n @conversations = current_user.conversations\n end", "title": "" }, { "docid": "97caab42463f8297a5cec49bac5f7159", "score": "0.72035635", "text": "def index\n @conversations = get_user_conversations(current_user.id)\n @conversation = get_users_conversation(current_user.id, params[:interlocutor_id], 1) if params[:interlocutor_id]\n #@conversations = []\n @messages = Message.all\n @message = Message.new\n #render json: @conversations\n end", "title": "" }, { "docid": "7fcf70ea63e7d3efc3303835fd18785d", "score": "0.72012603", "text": "def show\n @conversation = Conversation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conversation }\n end\n end", "title": "" }, { "docid": "7fcf70ea63e7d3efc3303835fd18785d", "score": "0.72012603", "text": "def show\n @conversation = Conversation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conversation }\n end\n end", "title": "" }, { "docid": "7fcf70ea63e7d3efc3303835fd18785d", "score": "0.72012603", "text": "def show\n @conversation = Conversation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conversation }\n end\n end", "title": "" }, { "docid": "7fcf70ea63e7d3efc3303835fd18785d", "score": "0.72012603", "text": "def show\n @conversation = Conversation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conversation }\n end\n end", "title": "" }, { "docid": "74dcc2d7cfcd1ec47c286c16cd3da429", "score": "0.71964914", "text": "def index\n @conversations = Conversation.all\n end", "title": "" }, { "docid": "74dcc2d7cfcd1ec47c286c16cd3da429", "score": "0.71964914", "text": "def index\n @conversations = Conversation.all\n end", "title": "" }, { "docid": "74dcc2d7cfcd1ec47c286c16cd3da429", "score": "0.71964914", "text": "def index\n @conversations = Conversation.all\n end", "title": "" }, { "docid": "74dcc2d7cfcd1ec47c286c16cd3da429", "score": "0.71964914", "text": "def index\n @conversations = Conversation.all\n end", "title": "" }, { "docid": "74dcc2d7cfcd1ec47c286c16cd3da429", "score": "0.71964914", "text": "def index\n @conversations = Conversation.all\n end", "title": "" }, { "docid": "74dcc2d7cfcd1ec47c286c16cd3da429", "score": "0.71964914", "text": "def index\n @conversations = Conversation.all\n end", "title": "" }, { "docid": "74dcc2d7cfcd1ec47c286c16cd3da429", "score": "0.71964914", "text": "def index\n @conversations = Conversation.all\n end", "title": "" }, { "docid": "37598414dd8f0f0d9fe39fdcab7da542", "score": "0.7187304", "text": "def get_conversations(id, query = {})\n options = {\n query: query.merge(mailbox: id)\n }\n\n get(\"conversations\", options)\n end", "title": "" }, { "docid": "6aa6bd4cd29dbdb3dd000fe8c2131bd5", "score": "0.71774316", "text": "def conversation\n\t\t\n \t \t@conversation ||= mailbox.conversations.find(params[:id])\n \tend", "title": "" }, { "docid": "ea2c804098d11eaf652650b0b51cddf0", "score": "0.71498203", "text": "def index\n @conversations = @mailbox.inbox\n end", "title": "" }, { "docid": "b6b3931664260e9001f791bd0308f194", "score": "0.71177393", "text": "def index\n @messages = Message.load_conversations(current_user)\n end", "title": "" }, { "docid": "6ec3e03606e60692fe51eac09a018d14", "score": "0.711336", "text": "def show\n # #respond_with Conversation.find(params[:id])\n # render json: Conversation.all\n end", "title": "" }, { "docid": "00f1a76aa0dea1609fcf1b4814ed452e", "score": "0.7091882", "text": "def index\n @conversations = Conversation.includes(:users).where(conversations: {id: current_api_user.conversations.pluck(:\"conversations.id\")}).order('conversations.updated_at desc')\n serializer = Conversations::ConversationSerializer.new(@conversations, {params: {current_api_user: current_api_user}, include: [:users, :messages]})\n render json: serializer.serializable_hash\n end", "title": "" }, { "docid": "8d431584785ec9a35977e789e1e45bde", "score": "0.70259243", "text": "def conversations\n Conversation.where(\"sender_id = ? OR recipient_id = ?\", id, id)\n end", "title": "" }, { "docid": "3c746f1533412f127ac32e10245b5764", "score": "0.70150745", "text": "def conversations\n # GET /messages\n # Array of MessageRef objects but due to GROUP BY they only have attributes otherparty_id, newest_message_date, cnt, unseen_cnt.\n # sent_anything is boolean and says whether any message ref exists that is sent to otherparty. This info is used when showing whether recipient has seen messages.\n @conversations = MessageRef.select(\"otherparty_id, max(created_at) newest_message_date, count(1) as cnt, sum(unseen) as unseen_cnt, bool_or(direction = 'sent') sent_anything\").\n group('otherparty_id').\n where(user: current_user).\n order('unseen_cnt desc, newest_message_date desc') # Primary sort groups with unread messages so they appear at top.\n end", "title": "" }, { "docid": "fb5425a7cdc9ea92f9a0e4c8cfc39bfa", "score": "0.6998216", "text": "def index\n @conversations = Conversation.participating(current_user.id).page(params[:page])\n end", "title": "" }, { "docid": "c8b9c288331eee6186520f015a2e3df1", "score": "0.69486386", "text": "def list_messages\n\t messages = []\n if Conversation.between(current_user.id, params[:recipient_id]).present?\n conversation = Conversation.between(current_user.id, params[:recipient_id]).first\n \t messages = conversation.messages\n end\n render json: {conversation: messages}\n end", "title": "" }, { "docid": "a610efdc46ed601f27f6d3e2aa04a322", "score": "0.69484264", "text": "def get_conversation(conversation_id)\n get(\"conversations/#{conversation_id}\")\n end", "title": "" }, { "docid": "668f46fec43bde9efeb1fac45bedd8d9", "score": "0.6921758", "text": "def list \n $sender_Id= params.shift.last() \n $receiver_Id = params.shift.last() \n @conv= Messages.get_conversation($sender_Id, $receiver_Id)\n \n end", "title": "" }, { "docid": "7f4a26fed1eeb824ff8b055e5072ab52", "score": "0.69107926", "text": "def get_teammate_conversations(teammate_id, params = {})\n cleaned = params.permit({ q: [:statuses] })\n list(\"teammates/#{teammate_id}/conversations\", cleaned)\n end", "title": "" }, { "docid": "1d3699063e0de2461fd73ded7049fdd2", "score": "0.6900675", "text": "def get_contact_conversations(contact_id, params = {})\n cleaned = params.permit({ q: [:statuses] })\n list(\"contacts/#{contact_id}/conversations\", cleaned)\n end", "title": "" }, { "docid": "982f5f41352b794133bf1f1cbdef9ce7", "score": "0.6900115", "text": "def index\n \n conversation =\tConversation.involving(current_user.id).order(\"id DESC\")\t\t\n if params[:cid].present?\t\t\n\t cid = Base64.decode64(params[:cid])\n messages = Message.where(:conversation_id => cid)\n else\n messages = conversation.present? ? conversation[0].messages.present? ? conversation[0].messages : conversation[1].messages : nil\t\t \n end\t\n render :json => {conversation: conversation, messages: messages } and return\n end", "title": "" }, { "docid": "83c26ec3b55d37619654039f52ed4089", "score": "0.6894047", "text": "def project_conversations(project_id, query={})\n perform_get(\"/api/1/projects/#{project_id}/conversations\", :query => query)\n end", "title": "" }, { "docid": "eb9cd558e2c0a356ad65e5bacebb8dcb", "score": "0.68874466", "text": "def show\n @recipient = Recipient.find(params[:id])\n # @conversations = @recipient.conversations.group(\"date\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipient }\n end\n end", "title": "" }, { "docid": "bcb311e1a092aed85a6f85faf644ba7c", "score": "0.686141", "text": "def get_single_conversation(id,opts={})\n query_param_keys = [\n :interleave_submissions,\n :scope,\n :filter,\n :filter_mode,\n :auto_mark_as_read\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/conversations/{id}\",\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:get, path, query_params, form_params, headers)\n response\n \n end", "title": "" }, { "docid": "53d006a2d3c77d5ebf9f7c779144f17f", "score": "0.6857995", "text": "def inbox\n @conversations = @person.conversations\n end", "title": "" }, { "docid": "b997367337ff7c7d001d4ae76ffabccf", "score": "0.68513894", "text": "def index\n @conversations = current_user.conversations.where(:kind=> 'channel')\n end", "title": "" }, { "docid": "e2a57b3504fe77bba9a9d5a2f7702df1", "score": "0.68512255", "text": "def conversations; end", "title": "" }, { "docid": "dedf8cf2af95d6d098b90a579bb6341d", "score": "0.68455297", "text": "def conversation(conversation)\n get(\"inbox/conversations/#{conversation}\").pop\n end", "title": "" }, { "docid": "a65b8477c28d7b8c799a573817be57fa", "score": "0.6842801", "text": "def index\n # Retrive conversations where the hirer is the current user\n hc = Conversation.where(hirer: current_user)\n # Get conversations where the owner is the current user\n oc = Conversation.where(owner: current_user)\n # Get conversations that involve current user \n @conversations = hc|oc\n end", "title": "" }, { "docid": "3f35c8a2ee4403fd769d72f44d311861", "score": "0.68361986", "text": "def index\n @users_conversations = UsersConversation.all\n end", "title": "" }, { "docid": "6453ff49b9799415ad4f2c36c3529d21", "score": "0.68272257", "text": "def index\n\t\t@conversations = @mailbox.inbox.paginate(page: params[:page], per_page: 10)\n\tend", "title": "" }, { "docid": "83dca0cc2ffbdbd9ea5d5da2c01c082e", "score": "0.68159384", "text": "def get_conversations(mailbox_id, page = 1, modified_since = nil)\n options = {\n query: {\n page: page,\n modifiedSince: modified_since,\n }\n }\n\n get(\"mailboxes/#{mailbox_id}/conversations\", options)\n end", "title": "" }, { "docid": "55f8816a5a01aaff3f08b000215a4185", "score": "0.68150663", "text": "def index\n if (params.has_key?(:user_id) && !params[:user_id].nil?)\n @messages = (User.sent_messages(@user) + @user.messages)\n else\n @messages = Message.all\n end\n @messages = @messages.sort_by { |m| m.created_at }.reverse\n @conversations = @messages.group_by { |message| message.subject }\n if (params.has_key?(:user_id) && !params[:user_id].nil?)\n @title = User.find(params[:user_id]).name + \"'s messages\"\n else\n @title = \"Messages\"\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conversations }\n end\n end", "title": "" }, { "docid": "babebf14cbed719319888760ca34900a", "score": "0.68031865", "text": "def show\n conversations = Conversation.where(user_1: params[:id]).or(Conversation.where(user_2: params[:id]))\n\n structured_conversations = []\n conversations.each do | conversation |\n full_convo = {\n id: conversation.id,\n title: conversation.title,\n created_at: conversation.created_at,\n user_1: User.select(:id, :name, :avatar_url).where({id: conversation.user_1_id}),\n user_2: User.select(:id, :name, :avatar_url).where({id: conversation.user_2_id}),\n messages: conversation.messages\n }\n structured_conversations.push(full_convo);\n end\n \n render json: structured_conversations\n end", "title": "" }, { "docid": "c0bc43e54e119befe087c83f06803c59", "score": "0.67964375", "text": "def index\n @messages = @conversation.messages\n end", "title": "" }, { "docid": "ad0c69d112115bfdb37bbcbcdfea1a22", "score": "0.6768673", "text": "def conversations\n creds_not_found if @username.nil? == true && @username.nil? == true\n params = {\n 'username' => @username,\n 'auth_token' => @auth_token,\n 'endpoint' => '/loq/conversations'\n }\n jwt = sign_token(params)\n response = endpoint_auth(jwt)\n json_data = post_sc_request(response)\n json_data\n end", "title": "" }, { "docid": "70e4616e0008dc5abf58d52388fbf462", "score": "0.67621636", "text": "def conversations( organization_id, options={} )\n get \"organizations/#{organization_id}/conversations.json\", extra_query: options, response_container: %w( conversations ), transform: SignalCloud::Conversation\n end", "title": "" }, { "docid": "4c13fab2cf11506052f0181b6c5a4116", "score": "0.675331", "text": "def show\n mail = Mail.find(params[:id])\n\n if mail\n @conversation = mail.conversation\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conversation }\n end\n end\n end", "title": "" }, { "docid": "3f9fc0cfc5a38476b1c34dcdefc0198b", "score": "0.67318475", "text": "def conversations\n conversations = Conversation.where(\"sender_id = ? OR recipient_id = ?\", self, self)\n return conversations\n end", "title": "" }, { "docid": "a722e5dfcdd394094a437c201a5f7131", "score": "0.67308176", "text": "def conversations\n Conversation.where(\"user_1 = ? OR user_2 = ?\", id, id)\n end", "title": "" }, { "docid": "cfc6fd4b45c590e65ea591fbec974c59", "score": "0.6727361", "text": "def conversations=(value)\n @conversations = value\n end", "title": "" }, { "docid": "97a4cd351ab6433125b917f1d4f35319", "score": "0.67240113", "text": "def index\n @conversations = Mailbox.as_guest(current_user).paginate(page: params[:page], per_page: 10)\n end", "title": "" }, { "docid": "a002e820fb3a95fd7dca920813d2213c", "score": "0.67206323", "text": "def conversations\n # GET /messages/:id\n @user = User.find(params[:id])\n # Array of MessageRef objects but due to GROUP BY they only have attributes otherparty_id, newest_message_date, cnt, unseen_cnt.\n @conversations = MessageRef.select('otherparty_id, max(created_at) newest_message_date, count(1) as cnt, sum(unseen) as unseen_cnt').\n group('otherparty_id').\n where(user: @user).\n order('unseen_cnt desc, newest_message_date desc') # Primary sort groups with unread messages so they appear at top.\n\n # Additional list is generated to help with seeing deleted messages (refs).\n all_recipients = Message.select('recipient_id').where(sender: @user).group('recipient_id').unscope(:order).collect{|row| User.find(row['recipient_id']) }\n all_senders = Message.select('sender_id').where(recipient: @user).group('sender_id').unscope(:order).collect{|row| User.find(row['sender_id']) }\n @parties = all_recipients | all_senders\n end", "title": "" }, { "docid": "178a206a6157b36aed232d8f4f471454", "score": "0.6715696", "text": "def show\n # @conversations = Conversation.all\n # binding.pry\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipient }\n end\n end", "title": "" }, { "docid": "cb1344466d3741a46f7b57f957669061", "score": "0.6710641", "text": "def recipient\n conversation = Api::V1::Conversation.between(@current_user.id, params[:user_id]).first\n\n unless conversation.nil?\n messages = conversation.messages.order('created_at DESC')\n\n paginate json: messages\n else\n paginate json: []\n end\n end", "title": "" }, { "docid": "09d8cb77abfe52f347ab0055e46cbdfe", "score": "0.6704905", "text": "def index\n @conversations = Conversation.where(\"to_id = :current_user_id OR from_id = :current_user_id\", {current_user_id: @current_user.id}).order(updated_at: :desc).joins(:messages).take(10).uniq.as_json\n \n convos = []\n @conversations.each do |convo|\n convos.push(convo[\"id\"])\n end\n\n @conversations_requests = ConversationsRequest.where(conversation_id: convos)\n\n @conversations.each_with_index do |conversation, index|\n @conversations_requests.each do |convo_request|\n if(conversation[\"id\"] == convo_request.conversation_id)\n @conversations[index][\"request_id\"] = convo_request.request_id\n end\n end\n end\n\n render json: @conversations\n end", "title": "" }, { "docid": "1ccb57e6b208f2f355805f55dae81987", "score": "0.67040586", "text": "def index\n @conversations = Conversation\n .where(\"user_id = ? OR other_user_id = ?\",\n current_user.id, current_user.id)\n render :index\n end", "title": "" }, { "docid": "f6fff751cc13157d48cd3db66be461e1", "score": "0.67023736", "text": "def show\n @conversation = Conversation.find(params[:id])\n load_board\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @conversation }\n end\n end", "title": "" }, { "docid": "9e3383ba3cb1a072e25cac7d87422bf9", "score": "0.66926765", "text": "def index\n @conversations = current_user.conversations.joins(:messages).distinct\n end", "title": "" }, { "docid": "76b1f6a72c0455b385063f427202dec1", "score": "0.6677481", "text": "def fetch_conversation(conversation_id)\r\n self.conversations.fetch(conversation_id.to_s)\r\n end", "title": "" }, { "docid": "a20cc9409cb7c717dea0a61a7636c9c7", "score": "0.6676846", "text": "def index\n @conversations = @mailbox.inbox\n @mailbox_type = \"inbox\"\n end", "title": "" }, { "docid": "a2d9f20436c39dcddbb52cd0c026a197", "score": "0.6660914", "text": "def index\n if params[:to_id]\n if params[:status] and params[:appointment]\n @conversations = Conversation.where(\"to_id = \" + params[:to_id] + \" and status = \" + params[:status] + \" and appointment > \" + params[:appointment])\n elsif params[:only_not_finished]\n else\n \t@conversations = Conversation.where(\"to_id = \"+params[:to_id]+\" and status <> 5 \")\n @conversations = Conversation.where(:to_id => params[:to_id])\n end\n end\n if params[:from_id]\n if params[:only_not_finished]\n \t@conversations = Conversation.where(\"from_id = \"+params[:from_id]+\" and status <> 5 \")\n else \n \t@conversations = Conversation.where(:from_id => params[:from_id])\n end\n end\n if params[:trip_id]\n @conversations = Conversation.where(:trip_id => params[:trip_id])\n end\n render :json => {:conversations => @conversations }\n end", "title": "" }, { "docid": "42b9bb919badb2ff8993ce003cf1b233", "score": "0.6657789", "text": "def conversation\n Conversation\n .where(\"creator_id = ? or member_id = ?\", user_id, user_id)\n .order(\"latest_message_id DESC\").first\n end", "title": "" }, { "docid": "6e25776a977830193c583a8930dc4983", "score": "0.66295874", "text": "def conversation( organization_id, conversation_id, options={} )\n get \"organizations/#{organization_id}/conversations/#{conversation_id}.json\", extra_query: options, response_container: %w( conversation ), transform: SignalCloud::Conversation\n end", "title": "" }, { "docid": "b0de219ebe6d3a2662119479ee822468", "score": "0.6622495", "text": "def index\n @conversation_messages = ConversationMessage.all\n end", "title": "" }, { "docid": "e0ecd09bbcbcebfc56e0a7dd00df5618", "score": "0.6621047", "text": "def to_s\n '<Twilio::REST::Conversations::V1>';\n end", "title": "" }, { "docid": "c48c2bb48e976c532a0c0a5185582229", "score": "0.6616323", "text": "def get_tag_conversations(tag_id, params = {})\n cleaned = params.permit({ q: [:statuses] })\n list(\"tags/#{tag_id}/conversations\", cleaned)\n end", "title": "" }, { "docid": "15548fc884e88e4614e6bfa3740f1e97", "score": "0.6615907", "text": "def index\n @ticket_conversations = TicketConversation.all\n \n end", "title": "" }, { "docid": "d4bf84add4dc482602f55bf4a92aed46", "score": "0.6613993", "text": "def conversation\n @conversation = Conversation.between(params[:sender_id], params[:recipient_id]).first\n end", "title": "" }, { "docid": "9b6c699244b851b8bf399f3fe5fda201", "score": "0.6575074", "text": "def conversations_list(options = {})\n if block_given?\n Pagination::Cursor.new(self, :conversations_list, options).each do |page|\n yield page\n end\n else\n post('conversations.list', options)\n end\n end", "title": "" }, { "docid": "67ffaa64d007d91565be2ea3122d5695", "score": "0.65721875", "text": "def show\n @conversation = Conversation.find(params[:id])\n @primercomentario = @conversation.comments.order(:id).first\n @otroscomentarios = @conversation.comments.paginate page: params[:page], order: 'created_at asc', per_page: 15\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @conversation }\n end\n end", "title": "" }, { "docid": "d570eec950c74a87b66356963fd08784", "score": "0.6555221", "text": "def project_conversation(project_id, id, query={})\n perform_get(\"/api/1/projects/#{project_id}/conversations/#{id}\", :query => query)\n end", "title": "" }, { "docid": "318e9479a2e84dc5247dc9f2c3661d85", "score": "0.6552875", "text": "def conversations\n @conversations ||= Conversation.new(self)\n end", "title": "" }, { "docid": "9f5fb618a2ed9968f38081c76374aa9a", "score": "0.6545327", "text": "def read\n @conversation = current_user.admin_conversations.find(params[:id])\n @conversation.read_by!(current_user)\n render :nothing => true\n end", "title": "" }, { "docid": "9114014ec03e778a04d7682c6e7c8f28", "score": "0.6533629", "text": "def to_s\n '#<Twilio::REST::Conversations>'\n end", "title": "" }, { "docid": "bad42237f091ac2f8df97bc27908bdfa", "score": "0.65039265", "text": "def show\n StatsManager::StatsD.time(Settings::StatsConstants.api['conversation']['show']) do\n if @conversation = Conversation.find(params[:id])\n @status = 200\n else\n render_error(404, \"could not find conversation for id #{params[:id]}\")\n end\n end\n end", "title": "" }, { "docid": "edb8df8e782ffe28e46e65504a813b21", "score": "0.64789677", "text": "def get_conversations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConversationApi.get_conversations ...'\n end\n # resource path\n local_var_path = '/conversation/conversations'\n\n # query parameters\n query_params = {}\n query_params[:'medium'] = opts[:'medium'] if !opts[:'medium'].nil?\n query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?\n query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?\n query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\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 = ['ultraCartOauth', 'ultraCartSimpleApiKey']\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 => 'ConversationsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationApi#get_conversations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "de4ddc2801172bb81d1ca8bb0b36b1e6", "score": "0.6474091", "text": "def index\n @conversation = Conversation.where(\"(conversations.sender_id = ? AND conversations.receiver_id =?) OR (conversations.sender_id = ? AND conversations.receiver_id =?)\", current_user.id, params[:userId].to_i, params[:userId].to_i, current_user.id)\n @messages = @conversation.present? ? @conversation.first.messages.for_display : []\n @message = Message.new\n @user = User.find(params[:userId])\n end", "title": "" }, { "docid": "8928caf388fe98fb85dadf428f8a1c85", "score": "0.6462387", "text": "def index\n\t\tsession[:conversations] ||= []\n\n\t\t@users = User.all.where.not(id: current_user)\n\t\t@conversations = Conversation.includes(:recipient, :messages).find(session[:conversations])\n\tend", "title": "" }, { "docid": "f056b8db4290d47a71f17be6d2d3a8f9", "score": "0.64601827", "text": "def conversations_all\n conversations + reverse_conversations\n end", "title": "" }, { "docid": "d7b2d91e98340cc314987d4543e5d2b4", "score": "0.6457678", "text": "def conversations_get_conversations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConversationsApi.conversations_get_conversations ...'\n end\n # resource path\n local_var_path = '/v3/conversations'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'continuationToken'] = opts[:'continuation_token'] if !opts[:'continuation_token'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n return_type = opts[:return_type] || 'ConversationsResult' \n\n auth_names = opts[:auth_names] || []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#conversations_get_conversations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "ad0f768e7c56952ca9ac4c6629fb6780", "score": "0.6454131", "text": "def to_s\n '<Twilio::REST::Conversations::V1>'\n end", "title": "" }, { "docid": "102b991c00f49aa7111a2ab79039cb9f", "score": "0.6448353", "text": "def index\n @conversations ||= @mailbox.inbox.page(params[:page]).per_page(25)\n @conversationscount ||= current_user.mailbox.inbox.all\n end", "title": "" } ]
27c399bfd61cf25ba75edd6ff3b7a48b
Rolls back a savepoint.
[ { "docid": "1f78ee113fc517cc825c53a609dbaf67", "score": "0.7490998", "text": "def rollback_savepoint(name)\n execute %(ROLLBACK TO SAVEPOINT #{name};)\n end", "title": "" } ]
[ { "docid": "953b18f6f29ecab0951789c10e1c4278", "score": "0.7907303", "text": "def rollback_to_savepoint\n execute(\"ROLLBACK TO SAVEPOINT #{current_savepoint_name}\")\n end", "title": "" }, { "docid": "12c2a294db2a00f31686bd611775ab71", "score": "0.74708563", "text": "def rollback_to_savepoint(name = current_savepoint_name(true))\n @connection.rollback_savepoint(name)\n end", "title": "" }, { "docid": "47937c7c926cdcf491055795bc2cb97a", "score": "0.734045", "text": "def rollback_to( point_name )\n execute( \"ROLLBACK TO SAVEPOINT #{point_name}\" )\n end", "title": "" }, { "docid": "86d5c08455019264d9faa49cf768f991", "score": "0.72290415", "text": "def rollback()\n oldpos = @checkpoints.pop\n unless oldpos\n oldpos = 0\n end\n self.pos = oldpos\n return self \n end", "title": "" }, { "docid": "4d86678da97c65ae361d0a467621fec4", "score": "0.68061715", "text": "def rollback_to_savepoint_with_callback\n increment_transaction_pointer\n begin\n trigger_before_rollback_callbacks\n rollback_to_savepoint_without_callback\n trigger_after_rollback_callbacks\n ensure\n AfterCommit.cleanup(self)\n end\n decrement_transaction_pointer\n end", "title": "" }, { "docid": "0de316063eeb75d3594fe5bfcbab9f47", "score": "0.6657506", "text": "def rollback_savepoint_sql(depth)\n \"ROLLBACK TO SAVEPOINT autopoint_#{depth}\"\n end", "title": "" }, { "docid": "d255bce9922f688b2d38313e1b06cf49", "score": "0.65731746", "text": "def rollback\n File.exists?(@current_name) and FileUtils.rm(@current_name)\n # if it is interrupted, it will correctly restore on next run\n FileUtils.move backup_name, @current_name\n @u = load_u(@current_name)\n set_balance\n end", "title": "" }, { "docid": "f0982ce4807e30f4d07dd74dc55a394c", "score": "0.6406981", "text": "def revertBack\n @power = @powerO\n end", "title": "" }, { "docid": "2fcfb6d88db31084ec27065da0bb70fb", "score": "0.6329537", "text": "def take_back\n self.last_position.delete\n end", "title": "" }, { "docid": "09e2a28fb4f55d4dd63417bea01579a9", "score": "0.626079", "text": "def store_back()\n self.warehouse.put_back\n end", "title": "" }, { "docid": "e30a7d4eb0176531212653cf67089444", "score": "0.625932", "text": "def undo\n raise NoMethodError, \"no state history\" unless self.respond_to? :history\n recall history.pop(2)[0] \n save\n end", "title": "" }, { "docid": "e32b2e6bc51fe99daff0c14577ea11b8", "score": "0.6250283", "text": "def rollback!\n return false if @rolled_back\n _called.reverse_each(&:rollback)\n @rolled_back = true\n end", "title": "" }, { "docid": "7070a72849b2127523d6a2a39268c8b7", "score": "0.6246057", "text": "def back(steps)\n @i -= steps\n @i = 0 if @i < 0\n \n @st[@i]\n end", "title": "" }, { "docid": "ddbdac2cc0aaa51dec1b8b33509fec1d", "score": "0.6241911", "text": "def restore\n end", "title": "" }, { "docid": "986ea7063bfe9af0b94e92cdc075a309", "score": "0.62095594", "text": "def rollback!\n restore_attributes\n end", "title": "" }, { "docid": "986ea7063bfe9af0b94e92cdc075a309", "score": "0.62095594", "text": "def rollback!\n restore_attributes\n end", "title": "" }, { "docid": "986ea7063bfe9af0b94e92cdc075a309", "score": "0.62095594", "text": "def rollback!\n restore_attributes\n end", "title": "" }, { "docid": "986ea7063bfe9af0b94e92cdc075a309", "score": "0.62095594", "text": "def rollback!\n restore_attributes\n end", "title": "" }, { "docid": "986ea7063bfe9af0b94e92cdc075a309", "score": "0.62095594", "text": "def rollback!\n restore_attributes\n end", "title": "" }, { "docid": "986ea7063bfe9af0b94e92cdc075a309", "score": "0.62095594", "text": "def rollback!\n restore_attributes\n end", "title": "" }, { "docid": "986ea7063bfe9af0b94e92cdc075a309", "score": "0.62095594", "text": "def rollback!\n restore_attributes\n end", "title": "" }, { "docid": "617e175c34e04c1393254f477c3b44b2", "score": "0.6202988", "text": "def rollback_savepoint_sql(depth)\n SQL_ROLLBACK_TO_SAVEPOINT % depth\n end", "title": "" }, { "docid": "94b69f232e5dc9052b629dad561f027c", "score": "0.61808527", "text": "def restore\n end", "title": "" }, { "docid": "94b69f232e5dc9052b629dad561f027c", "score": "0.61808527", "text": "def restore\n end", "title": "" }, { "docid": "94b69f232e5dc9052b629dad561f027c", "score": "0.6180545", "text": "def restore\n end", "title": "" }, { "docid": "a6e394be48f1f07f0448ce9682f26d28", "score": "0.6178826", "text": "def rollback_savepoint_sql(depth)\n SQL_ROLLBACK_TO_SAVEPOINT % depth\n end", "title": "" }, { "docid": "a6e394be48f1f07f0448ce9682f26d28", "score": "0.6178826", "text": "def rollback_savepoint_sql(depth)\n SQL_ROLLBACK_TO_SAVEPOINT % depth\n end", "title": "" }, { "docid": "3b319a9f170360d6da547c10ec5f9c30", "score": "0.6155044", "text": "def back(steps)\n forward(-steps)\n end", "title": "" }, { "docid": "4348ea837aede34cba56a6e0060a1eb8", "score": "0.6123628", "text": "def rollback\n end", "title": "" }, { "docid": "c7ef87317e28e96a7300f528c85e4d92", "score": "0.6114712", "text": "def restore\n @api.send(\"world.checkpoint.restore()\")\n end", "title": "" }, { "docid": "7310b3bf089531683b3fe6f9208c2df9", "score": "0.61110085", "text": "def rollback\r\n end", "title": "" }, { "docid": "01c8f35efacc8c5d82a3f22075a64a15", "score": "0.61106896", "text": "def rollback\n @changes = RDF::Changeset.new\n @rolledback = true\n end", "title": "" }, { "docid": "1baa9ec7d9858b495d05dd49e5897666", "score": "0.6097097", "text": "def back_up\n @@line = @@save_line\n end", "title": "" }, { "docid": "872d642366d6462d3ed6f6a65a2124d4", "score": "0.6070575", "text": "def back(steps)\n \n end", "title": "" }, { "docid": "2f3ad0589729a79d6e8c621047b0d4ff", "score": "0.6062507", "text": "def rollback\n reset\n machine.write(object, :state, from)\n end", "title": "" }, { "docid": "2f3ad0589729a79d6e8c621047b0d4ff", "score": "0.6062507", "text": "def rollback\n reset\n machine.write(object, :state, from)\n end", "title": "" }, { "docid": "cf88b3a2923c2b9080a9f538e2d0bae7", "score": "0.60621655", "text": "def back(steps)\n @index -= steps\n @index = 0 if @index < 0\n @histories[@index]\n end", "title": "" }, { "docid": "3f5f137db7aa7127852a7ab6e1e82266", "score": "0.60547316", "text": "def rollback\n @steps.reverse_each do |step|\n step.undo\n\n # We shouldn't raise errors in rollbacks. Definitely want to catch any of these issues\n rescue StandardError => e\n capture_error(e)\n end\n end", "title": "" }, { "docid": "536b44657d0883fff5e7f69de4f49ee0", "score": "0.600616", "text": "def rollback; end", "title": "" }, { "docid": "536b44657d0883fff5e7f69de4f49ee0", "score": "0.600616", "text": "def rollback; end", "title": "" }, { "docid": "536b44657d0883fff5e7f69de4f49ee0", "score": "0.600616", "text": "def rollback; end", "title": "" }, { "docid": "536b44657d0883fff5e7f69de4f49ee0", "score": "0.600616", "text": "def rollback; end", "title": "" }, { "docid": "10e9223b495427454f20b6d878c0d9c6", "score": "0.59995306", "text": "def release_savepoint(name = current_savepoint_name(false))\n @connection.release_savepoint(name)\n end", "title": "" }, { "docid": "74cd7ba025de211859392e0107ae5e54", "score": "0.5986667", "text": "def back(steps)\n end", "title": "" }, { "docid": "7f58c636e1d23ce22f0f6aa76d30eb0f", "score": "0.598202", "text": "def restore; end", "title": "" }, { "docid": "7f58c636e1d23ce22f0f6aa76d30eb0f", "score": "0.598202", "text": "def restore; end", "title": "" }, { "docid": "916a9381b064fe94236d0b9bbe45fad9", "score": "0.5979027", "text": "def restore!\n\n\tend", "title": "" }, { "docid": "00df41ce5a20d79bac5d8e853b4dbb66", "score": "0.5956414", "text": "def rollback!\n raise Rollback\n end", "title": "" }, { "docid": "88019d42fccdc93690519e876fb76623", "score": "0.59563315", "text": "def rollback_savepoint_sql(depth)\n \"IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION autopoint_#{depth}\"\n end", "title": "" }, { "docid": "ab4dc06e424d58d9ef833eab3ce3158a", "score": "0.5947588", "text": "def revert!\n proxy.revert\n nil\n end", "title": "" }, { "docid": "0a79c90fd441c243725cdbcc7f77d1d1", "score": "0.5938352", "text": "def rollback\n # implement in subclasses\n end", "title": "" }, { "docid": "66082178a842ea2af4529ed71a0de96d", "score": "0.58945245", "text": "def back(steps)\n validate_dist(steps)\n go offset(-steps)\n end", "title": "" }, { "docid": "cc9d9e6f148fd90c522f3f28fb043fdf", "score": "0.58905745", "text": "def back(l=1)\n\t\t\tforward(-l)\n\t\tend", "title": "" }, { "docid": "60718fd055dd556c85654e9e7ba59366", "score": "0.58806807", "text": "def rollback_to! version\n transaction do\n restore version\n versions.after(version).destroy_all\n end\n end", "title": "" }, { "docid": "463727909cd5e16a1c86d35d2941d730", "score": "0.58637434", "text": "def back_up\n turn_around\n move\n turn_around\n end", "title": "" }, { "docid": "4000a8dc0b57a6b5e66d3bdadae6ee91", "score": "0.5855155", "text": "def revert_state\n\t\t\t@stack = @saved_stack\n\t\tend", "title": "" }, { "docid": "510a96728a6249405d7661e0f83c593d", "score": "0.5847145", "text": "def rollback_to(name)\n execute \"ROLLBACK TO #{name}\"\n end", "title": "" }, { "docid": "486c0f2fe9659b74c4fd20feea098120", "score": "0.5845557", "text": "def undo_update\n raise \"#{self.class} does not support rolling back the update\"\n end", "title": "" }, { "docid": "669f2f20e9b21141b09856222c4402f1", "score": "0.58179414", "text": "def restore!\n record = self.restore\n record.save!\n self.destroy\n return record\n end", "title": "" }, { "docid": "68c0983cca6de4863c7c7e8c1b0ca990", "score": "0.5817461", "text": "def roll_back!(version, force = false)\n change!({:version => version}, force)\n end", "title": "" }, { "docid": "cd1f10d9832a38df338ed5143d815987", "score": "0.5808062", "text": "def undo\n return if @version==0\n @version-=1\n apply_revision\n end", "title": "" }, { "docid": "b88e6805d117a19d0544f8e183053f63", "score": "0.5797825", "text": "def restore\n @auction = Auction.find(params[:id])\n @auction.restore_auction\n\n redirect_to edit_auction_path, notice: 'Auction was successfully restored.'\n end", "title": "" }, { "docid": "d5f2d47181ecee0ff8dd1401e2e0f44a", "score": "0.57914263", "text": "def there_and_back\n raise CursorRecursionException, \"Cursor position cannot be saved again before restoring\" if @within\n @@monitor.synchronize { self._within = true }\n output do |str|\n str << c.save \n yield(str)\n str << c.restore\n end\n @@monitor.synchronize { self._within = false }\n end", "title": "" }, { "docid": "b92fc74cf9fa2999f918c348d935a238", "score": "0.5763023", "text": "def move_back\n position.depart_train(self)\n @current_station -= 1 if @route.stations[@current_station] != @route.stations.first\n position.add_train(self)\n end", "title": "" }, { "docid": "d2c196a3aa059f12be24785b9c6cdb9d", "score": "0.57625675", "text": "def rollback\n @resource.rollback\n end", "title": "" }, { "docid": "164f69ce22089d5501cb483babd9567a", "score": "0.5750782", "text": "def backward\n end", "title": "" }, { "docid": "4fe218342ee9d9ce5fb093099bf9de79", "score": "0.5750305", "text": "def rollback\n # get last applied migration\n entry = TradeTariffBackend::DataMigration::LogEntry.last\n return unless entry\n\n # clear migrations array before loading\n @migrations = nil\n # load last migration for rollback\n load entry.filename\n # migration class will be loaded to @migrations\n migration = @migrations.last\n return unless migration\n\n # apply migration if can be rolled DOWN\n if migration.can_rolldown?\n Sequel::Model.db.transaction(savepoint: true) {\n migration.down.apply\n report_with.rollback(migration)\n }\n end\n # destroy log entry from data migrations table\n entry.destroy\n end", "title": "" }, { "docid": "428a9cd3d0de847cb8f31713f6522ec5", "score": "0.57462686", "text": "def rollback\n document = @version.reify\n document.save\n redirect_to edit_document_path(document)\n end", "title": "" }, { "docid": "b40ad7c59da01510eb904727a1eec24f", "score": "0.57419294", "text": "def back\n raise BeginningOfGame if boards.first == board\n go_to_move_and_return_board(move - 1)\n end", "title": "" }, { "docid": "6861a9fc99642b458514a6c10dbc99bd", "score": "0.57340884", "text": "def rollback\n root.load_from_store\n finish_transaction\n end", "title": "" }, { "docid": "4464202e5ed47f739f87126085da3b42", "score": "0.5730933", "text": "def back(sender)\n if @state\n #@state.save\n end\n @delegate.action_flow_back\n end", "title": "" }, { "docid": "9840b9963d1d29c4d25ffe9a32491a1c", "score": "0.5728488", "text": "def revert_to!(value)\n revert_to(value)\n reset_version if saved = save\n saved\n end", "title": "" }, { "docid": "210180cf04d014906cbc132440f26371", "score": "0.5726023", "text": "def undo\n end", "title": "" }, { "docid": "210180cf04d014906cbc132440f26371", "score": "0.5726023", "text": "def undo\n end", "title": "" }, { "docid": "210180cf04d014906cbc132440f26371", "score": "0.5726023", "text": "def undo\n end", "title": "" }, { "docid": "210180cf04d014906cbc132440f26371", "score": "0.5726023", "text": "def undo\n end", "title": "" }, { "docid": "0f7e545a4e0c8950f57a6af82d524263", "score": "0.5724503", "text": "def rollback_transaction(conn, opts={})\n if supports_savepoints?\n sps = @transactions[conn][:savepoints]\n if sps.empty?\n log_yield(TRANSACTION_ROLLBACK){conn.rollback}\n else\n log_yield(TRANSACTION_ROLLBACK_SP){conn.rollback(sps.last)}\n end\n else\n log_yield(TRANSACTION_ROLLBACK){conn.rollback}\n end\n end", "title": "" }, { "docid": "f17b20a98c6bab2925f082bb602b7d1a", "score": "0.57235855", "text": "def undo\n\t\t@board = @board_history.pop\n\t\t@move_history.pop\n\t\t@flags_history.pop\n\tend", "title": "" }, { "docid": "9cc56b5e99e153f9dc2c49acc381e77b", "score": "0.5718904", "text": "def rolledback!(force_restore_state = false) #:nodoc:\n run_callbacks :rollback\n ensure\n IdentityMap.remove(self) if IdentityMap.enabled?\n restore_transaction_record_state(force_restore_state)\n end", "title": "" }, { "docid": "99e5282ef28f3e6c502154d2cfc9ee7f", "score": "0.5704925", "text": "def cmd_back(args)\n\t\t\t\t$running_context = self\n\t\t\tend", "title": "" }, { "docid": "0eaa3ea031b0e4ec904b8b8acc647f8b", "score": "0.5697772", "text": "def undo\n\t\t\n\tend", "title": "" }, { "docid": "0eaa3ea031b0e4ec904b8b8acc647f8b", "score": "0.5697772", "text": "def undo\n\t\t\n\tend", "title": "" }, { "docid": "3927c71e4b66c3b0c09cda1e7481acb2", "score": "0.5691343", "text": "def revert\n $clock[$moves.pop][1] = true\n update_hands($moves[-1])\nend", "title": "" }, { "docid": "c4eceb262af541dba3abdddf62549ce4", "score": "0.5680054", "text": "def rollback!\n @some_value = :initial\n end", "title": "" }, { "docid": "3b86d32ed41c96399c97c0c678007af4", "score": "0.56766343", "text": "def rollback\n @adds = {}\n @removals = {}\n end", "title": "" }, { "docid": "01bd359799f23eb878de721ed39c3bca", "score": "0.56619495", "text": "def restore\n data[:restore]\n end", "title": "" }, { "docid": "8764472e64986f49f69f9fe6035c63a5", "score": "0.5652312", "text": "def rollback!\n if challenged_rating_change && challenger_rating_change\n\n if winner?(challenged)\n challenged.rating += - challenged_rating_change.round\n challenger.rating += challenger_rating_change.round.abs + 1\n else\n challenger.rating += - challenger_rating_change.round\n challenged.rating += challenged_rating_change.round.abs + 1\n end\n\n challenged.save\n challenger.save\n end\n\n destroy\n end", "title": "" }, { "docid": "2f01de862868acb0ec9c6d20264de79f", "score": "0.56514466", "text": "def back(steps)\n @i -= steps\n @i = 0 if @i < 0\n return @a[@i]\n end", "title": "" }, { "docid": "0994b7f32c5e72f6851d6280f9e9afc2", "score": "0.5631076", "text": "def restore\n if @@backup.save\n flash[:type] = 'success'\n flash[:title] = t(:successful_restore_todo, :todo => @@backup.title)\n @@backup = nil\n redirect_to todos_path\n else\n flash[:type] = 'error'\n flash[:title] = t(:unsuccessful_restore_todo)\n redirect_to todos_path\n end\n end", "title": "" }, { "docid": "c8243713300e4741b01a4943c9cb5edb", "score": "0.5628052", "text": "def do_back\n update_screen(get_step_content(@step - 1, @editor.value, @output.value))\n end", "title": "" }, { "docid": "6df7a293ebd4c95dc308b5a1a5ff23ba", "score": "0.56253403", "text": "def losePoint\n\t\t@score =@score-1\n\tend", "title": "" }, { "docid": "44284b25f243ded850fa0efa282abb14", "score": "0.56006193", "text": "def HistoRollback (sender)\n begin\n # Déplacer les fichiers\n ext = @current.fichier.split('.').last\n FileUtils.mv(@[email protected]+\".#{ext}\", @prefs[\"Directories\"][\"Download\"][email protected])\n FileUtils.rm(@[email protected]+\".srt\")\n \n rescue Exception=>e\n puts \"# SubsMgr Error # HistoRollback [\"[email protected]+\"] : \"+e\n end\n \n # Mettre à jour l'historique\n HistoClean(sender)\n \n # Mettre à jour la liste\n @current.pending!\n \n rowSelected()\n RaffraichirListe()\n end", "title": "" }, { "docid": "1c696fa3fa2256de95114838cb1f4ff0", "score": "0.5596521", "text": "def undo trace\n @pos = trace\n end", "title": "" }, { "docid": "54b20bae2377eb46ab2bfcee1e201000", "score": "0.55930936", "text": "def undo_last\n\tn = @pts.length - 1\n\tif @state == 0\t\t#exit from tool\n\t\tSketchup.active_model.select_tool nil\n\t\treturn \n\tend\n\t@pts[(n-1)..(n-1)] = @pts[n] unless @open_end || n == 1\n\t@pts[n..n] = []\n\t@state = @state - 1\n\tview = Sketchup.active_model.active_view\n\tonMouseMove(@flmove, @xmove+1, @ymove+1, view)\n\tMATHS_PLUGINS.set_change_draw_mode_possible(@pts.length < 3)\nend", "title": "" }, { "docid": "4a9919009315f7353642ec6d779ba768", "score": "0.55826974", "text": "def rollback_transaction(conn, opts=OPTS)\n if supports_savepoints?\n sps = _trans(conn)[:savepoint_objs]\n if sps.empty?\n log_connection_yield('Transaction.rollback', conn){conn.rollback}\n else\n log_connection_yield('Transaction.rollback_savepoint', conn){conn.rollback(sps.last)}\n end\n else\n log_connection_yield('Transaction.rollback', conn){conn.rollback}\n end\n end", "title": "" }, { "docid": "d30e537658bdb7db9656b35efe8885b8", "score": "0.5573866", "text": "def back\n away\n end", "title": "" }, { "docid": "a153fe20a8f3ccfd110576b454e195f6", "score": "0.557123", "text": "def rollback\n @deleted = {}\n @added = []\n @rollbacked = true\n end", "title": "" }, { "docid": "f03d4eaed1f7e5f5e62a323b15d40ea2", "score": "0.55641687", "text": "def restore_finish\n target = $CFG.get(:backuper, :restore_src).gsub(/%\\{veid\\}/, @veid)\n\n vps = VPS.new(@veid)\n\n vps.honor_state do\n vps.stop(:force => true)\n syscmd(\"#{$CFG.get(:vz, :vzquota)} off #{@veid} -f\", [6,])\n vps.stop\n\n acquire_lock(Db.new) do\n syscmd(\"#{$CFG.get(:bin, :chmod)} -R -t #{$CFG.get(:vz, :vz_root)}/private/#{@veid}\")\n syscmd(\"#{$CFG.get(:bin, :rm)} -rf #{$CFG.get(:vz, :vz_root)}/private/#{@veid}\")\n syscmd(\"#{$CFG.get(:bin, :mv)} #{target} #{$CFG.get(:vz, :vz_root)}/private/#{@veid}\")\n end\n\n # Ignore rc 11 - returned when quota does not exist\n syscmd(\"#{$CFG.get(:vz, :vzquota)} drop #{@veid}\", [11,])\n end\n end", "title": "" }, { "docid": "d361de9bac72ee3b419f2ac418d323cd", "score": "0.55610967", "text": "def step_back\n\t if(@sample_index <= 0)\n\t\t@sample_index = -1\n\t\treturn nil\n\t end\n\t \n\t #could be more performant, but does the job well\n\t seek_to_pos(sample_index - 1)\n end", "title": "" }, { "docid": "c50c401565213b6ced9da6ffa1da180a", "score": "0.5552404", "text": "def restore(id)\n\t\tend", "title": "" } ]