query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
puts num_of_ones puts num_of_twos puts num_of_ones num_of_twos PART TWO example = '0222112222120000' layers = split_into_layers(example, width: 2, height: 2) print_layers layers
def flatten_layers(layers) layers = layers.reverse display = layers[0] layers.slice(1..-1).each do |layer| layer.each_with_index do |row, y| row.each_with_index do |digit, x| display[y][x] = digit unless digit == 2 end end end return display end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_into_parts(*sizes); end", "def num_layers\n num_layers = 0\n # binding.pry\n while !nodes.where(net_id: id, layer: num_layers).empty?\n num_layers += 1\n end\n num_layers\n end", "def pyramid(layers)\r\n upper_layer = \"1\"\r\n tower = [\"1\"]\r\n layers.times do\r\n tower << upper_layer = lower_layer(upper_layer)\r\n end\r\n tower\r\nend", "def dimensions\n dimensions = identify(:layer => 0, :format => \"%wx%h\").chomp.split(\"x\")\n { :x => dimensions[0].to_i,\n :y => dimensions[1].to_i }\n end", "def test_example_part_two\n input = ['1, 1', '1, 6', '8, 3', '3, 4', '5, 5', '8, 9'].join(\"\\n\")\n grid = Grid.new(input, true, 32)\n\n assert_equal 16, grid.region_size\n end", "def towerBuilder(n_floors)\n layer = width = n_floors + (n_floors - 1)\n result = []\n\n while layer > 0\n result.unshift((\"*\" * layer).center(width))\n layer -= 2\n end\n result\nend", "def step_layers(outer, current, inner)\n step(current) do |x, y|\n bugs = neighbors(current, x, y)\n\n bugs << outer[1][2] if y == 0\n bugs << outer[2][3] if x == 4\n bugs << outer[3][2] if y == 4\n bugs << outer[2][1] if x == 0\n\n case [x, y]\n when [2, 1] then bugs += inner.first\n when [3, 2] then bugs += inner.map(&:last)\n when [2, 3] then bugs += inner.last\n when [1, 2] then bugs += inner.map(&:first)\n end\n\n bugs.count { |b| b == '#' }\n end\nend", "def split_array(array, number)\n size = number\n \nend", "def layer_n_nodes(l)\n nodes.where(net_id: id, layer: l).sort_by &:id\n end", "def even_splitters(string)\r\n\r\nend", "def numberOfTree(op1, op2)\n width = 0;\n height = 0;\n\n File.open(\"input\").each do |line|\n width = (line.to_s.length) - 1\n height += 1\n end\n\n array_input = Array.new();\n\n File.open(\"input\").each do |line|\n i = 0\n nline = line.tr(\"\\n\",\"\").to_s * (1 + (height/(width/op2).to_i))\n #array_input << line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\")+ line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\")+ line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\")+ line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\")+ line.tr(\"\\n\",\"\") + line.tr(\"\\n\",\"\")\n array_input << nline\n #puts nline\n end\n\n i = 0\n y = 0\n numberOfTree = Array.new\n while (i < height)\n numberOfTree[i] = array_input[i][y]\n p array_input[i][y]\n y+=op2\n i+=op1\n end\n hp=0\n numberOfTree.each do |p|\n if ( p == \"#\")\n hp +=1\n end\n end\n return hp\nend", "def main(args)\n expectedArgs = 1\n helpMessage = \"Usage\\nlef_layer_blockage_count.rb input_lef [layer_name]\\n\"\n helpMessage << \"Default [layer_name] is VI1\\n\" \n if (args.size<expectedArgs)\n puts helpMessage\n abort\n end\n\n layer_name = \"VI1\"\n lef_file = args.shift\n if args.length>0\n layer_name = args.shift\n end\n\n\n # Header\n puts \"cell_name,#{layer_name}_blockage_count\"\n # Open a file and parse some stuff\n infile = File.open(lef_file,\"r\")\n lines = infile.readlines\n infile.close\n cntr=0\n layer_count=0\n in_obs = false\n in_obs_layer = false\n cell_layer_count = Hash.new()\n while cntr<(lines.length-1)\n line=lines[cntr]\n # Get cell name\n if line=~/^\\s*MACRO\\s+(\\w+)\\s*$/\n cell = $1\n layer_count=0\n # Look for obstruction\n elsif line=~/^\\s*OBS\\s*$/\n in_obs = true\n # Look for layers and get a count\n elsif in_obs && line=~/^\\s*LAYER\\s+#{layer_name}\\s*;/\n in_obs_layer = true\n #keep processinga all the layers and look for the end of the layers\n while in_obs_layer\n cntr+=1\n line=lines[cntr]\n if (line=~/^\\s*LAYER\\s+/) \n in_obs_layer = false\n elsif (line=~/^\\s*END\\s*$/)\n in_obs = false\n in_obs_layer = false\n else\n layer_count+=1\n end\n end\n cell_layer_count[cell]=layer_count\n puts \"#{cell},#{layer_count}\"\n # Look for end of obs\n elsif in_obs && (line=~/^\\s*END\\s*$/)\n in_obs = false\n end\n cntr+=1\n end\nend", "def to_dimensions\n self.split(/x/).map { |s|\n if s.include?('-')\n s.split(/-/).map { |r| r.to_i }\n else \n s.to_i\n end \n } \n end", "def split; end", "def inspect_cluster size_of_cluster\n @cluster.each do |c|\n if c.length == size_of_cluster\n c.each do |s|\n puts \"#{s.to_s}: #{@feature[s].to_s}\"\n end\n end\n end\n end", "def layers\n pixdem = [image.width, image.height].max\n ((Math.log(pixdem) / Math.log(2)) - (Math.log(96) / Math.log(2))).ceil + 1\n end", "def split_on(parts)\n\n raise ArgumentError.new(\"Parts should be Integer greater than 0.\") unless parts.is_a? Integer and parts > 0\n raise ArgumentError.new(\"Subnet has #{size} elements only.\") if parts > size\n\n if size % parts == 0\n part_size = size / parts\n else\n part_size = size / (parts - 1)\n if size % part_size == 0 and part_size > 1\n part_size -= 1\n end\n end\n\n subnets = []\n iter = first\n\n parts.times do |i|\n iter_next = iter + (part_size - 1)\n\n # last part should be smaller\n iter_next = last if iter_next > last or i + 1 == parts\n\n subnets << Subnet.new(iter, iter_next)\n iter = iter_next + 1\n end\n\n subnets\n end", "def get_length\n\tselection = Sketchup.active_model.selection\n\tcount = selection.length\n\tif count != 0\n\t\tselection.each { |sel|\n\t\t\torigin = sel.transformation.origin\n\t\t\tx = origin[0]\n\t\t\ty = origin[1]\n\t\t\tz = origin[2]\n\t\t\tif sel.class == Sketchup::Group\n\t\t\t\tbox = sel.local_bounds\n\t\t\telsif sel.class == Sketchup::ComponentInstance\n\t\t\t\tbox = sel.definition.bounds\n\t\t\tend\n\t\t\tmix = box.min.x.to_f\n\t\t\tmiy = box.min.y.to_f\n\t\t\tmiz = 0\n\n\t\t\tmx = box.max.x.to_f\n\t\t\tmy = box.max.y.to_f\n\t\t\tmz = 0\n\n\t\t\tname = sel.definition.name\n\t\t\t#defn = sel.definition\n\t\t\t#bbox = defn.bounds\n\t\t\t#w = bbox.width.to_l.to_s\n\t\t\t#h = bbox.height.to_l.to_s\n\t\t\t#d = bbox.depth.to_l.to_s\n\t\t\tif name != \"BASE HANDLE#1\"\n\t\t\t\tdim = sel.entities.add_dimension_linear([mix, miy, miz], [mx, my, mz], [25, 0, 0])\n\t\t\t\tdim.material = \"chartreuse\"\n\t\t\tend\n\t\t}\n\telse\n\t\tUI.messagebox \"No models are selected!\", MB_OK\n\tend\nend", "def lower_layer(upper_layer)\r\n lower = upper_layer.split(\" \").map(&:to_i).each_cons(2).map do |first, second|\r\n first + second\r\n end\r\n ([1] + lower + [1]).map(&:to_s).join(\" \")\r\nend", "def subdivisions; end", "def split_in_three(number, length1, length2)\n [number.slice(0, length1), number.slice(length1, length2), number.slice(length1 + length2, 10)]\n end", "def dimensions\n dim = [width, height]\n def dim.to_s\n join 'x'\n end\n dim\n end", "def split\n [self[0,self.length/2], self[self.length/2,self.length]]\nend", "def width_of image; return run(\"sips #{image} -g pixelWidth\").split(' ').last.to_i end", "def read_input_args(input)\n rows = []\n whites = []\n blacks = []\n counter = 1\n \n # reads the whole file and splits it by newlines, then split each line into its integer part. The result is appended to the rows array\n File.readlines(input).map do |line|\n rows << line.split.map(&:to_i)\n end\n \n n, m, b, w = rows[0]\n \n # add every black dot into the array\n 1.upto(b) do \n x, y = rows[counter]\n blacks << [x, y]\n counter += 1\n end\n \n # add every white dot into the array\n 1.upto(w) do\n x, y = rows[counter]\n whites << [x, y]\n counter += 1\n end\n \n return n, m, blacks, whites\nend", "def split(position)\n end", "def split(position)\n end", "def generate_shape(n)\n p (\"+\" * n + \"\\n\") * (n - 1) + \"+\" * n\nend", "def split(grid, n)\n grid.split('/').each_slice(n).map do |rows|\n results = Array.new(rows.first.length / n) {[]}\n rows.map {|row| row.split('').each_slice(n).each_with_index {|r, i| results[i] << r.join('')}}\n results.map {|r| r.join('/')}\n end\nend", "def toggle_lights(n)\n multipled_substring = []\n\n (1..n).each do |count|\n multiplier = 1\n\n loop do\n product = count * multiplier\n break if product > n\n multipled_substring << product\n multiplier += 1\n end\n end\n #multipled_substring\n\n final_result = []\n (1..n).each do |number|\n times_of_toggle = multipled_substring.count(number)\n \n final_result << number if times_of_toggle.odd?\n end\n p final_result\nend", "def output_groups(names_array, size_of_group)\n\tgroup_id = 1\n\tuntil names_array.size == 0 do\n\t\tputs \"Group \" + group_id.to_s\n\t\tputs \"=================\"\n\t\tputs names_array.shift(size_of_group)\n\t\tputs\n\t\tgroup_id += 1\n\tend\nend", "def split_tile_set_into_tiles\n number_of_tiles = @tile_set[0].columns/32\n\n number_of_tiles.times do |i|\n image = @tile_set[0].crop((i*32), 0, 32, 32)\n image.write(\"media/tmp/tile#{i}.png\")\n end\n end", "def split(parts); end", "def layers \n self.layerlist :layersonly=>true\n end", "def point_wh_count point\n point.layers.inject(0){|sum, lay| sum + lay.whs.size }\n end", "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", "def preprocess strokes\n strokes = @@preprocessor.preprocess(strokes)\n @number_of_points = strokes.flatten(1).count\n strokes\n end", "def count_layer_check_files\n %w[01 02 03].map do |number|\n folder = File.join('data', 'layer_check', \"build-#{number}\")\n puts \"CHECK #{folder}\"\n num_states = 0\n LayerPartInfoName.glob(folder).each do |layer_part_info|\n info_string = File.read(File.join(folder, layer_part_info.to_s))\n info = JSON.parse(info_string)\n num_states += info['num_states'].to_i\n end\n puts number_with_comma(num_states)\n puts num_states / (30.0 * 24 * 3600)\n num_states\n end\nend", "def createLayers()\n @layers_array = import() \n end", "def line_split (in_string)\n my_string_array = in_string.split(\"\\n\")\n\n my_string_array.each_index do |index|\n # determine digits in largest line num, digits in current line num, & necessary padding\n max_line_digits = my_string_array.count.to_s.length\n this_line_digits = (index+1).to_s.length\n padding = ' ' * (max_line_digits - this_line_digits)\n\n # output the line\n puts \"Line #{padding}#{index + 1}: #{my_string_array[index]}\"\n end\nend", "def dimension_names\n two_dimensions | three_dimensions\n end", "def total_char_split\n messageData = @data\n output = []\n\n char_me = 0\n msg_me = 0\n char_them = 0\n msg_them = 0\n\n messageData.each do |name, messages|\n\n messages.each do |message|\n if message[2].to_i == 2\n char_me = char_me + message[1].size\n msg_me = msg_me + 1\n else\n char_them = char_them + message[1].size\n msg_them = msg_them + 1\n end\n end\n output << [name, char_me, msg_me, char_them, msg_them]\n char_me = 0\n char_them = 0\n msg_me = 0\n msg_them = 0\n end\n return output\n\n end", "def isolate_layers\n selection_layers = @selection.collect { |s| s.layer }.to_a\n puts \"Isolating #{selection_layers.length} layers...\" if @debug\n layers_to_hide = @layers.to_a - selection_layers.to_a\n if not @selection.empty?\n begin\n @model.start_operation \"Isolate selected layers\"\n layers_to_hide.each { |l|\n puts \"Making layer '#{l}' hidden...\" if @debug\n l.visible = false unless l == @model.active_layer \n }\n @model.commit_operation\n rescue Exception => e\n puts \"Error encountered: #{e}\" # Show even if debuggnig is off.\n end\n else\n puts \"Nothing selected!!!\" if @debug\n end\n end", "def inner_box\n [width, height, depth]\n end", "def print_number(n, size = 2)\n digits = n.to_s.split('').map {|n| n.to_i }\n\n (0..2 * size).each do |i|\n digits.each do |j|\n print @y[i][j]\n print ' '\n end\n\n puts\n end\nend", "def test_if_output_splits_elements_into_strings\n assert_equal [[\"A\", \"A\"], [\"1\", \"2\"]], @board.parse_coordinates([\"A1\", \"A2\"])\n end", "def setup_layers\n\tend", "def split_in_two(number, length)\n [number.slice(0, length), number.slice(length, 10 - length)]\n end", "def load_cutters tiles\r\n i = 0\r\n height = tiles.length\r\n width = tiles[i].length\r\n cutters = Array.new()\r\n\r\n while i < height\r\n j=0\r\n while j < width\r\n if(tiles[i][j]==2)\r\n tiles[i][j]=0\r\n cutters << Cutter.new(j*20,i*20)\r\n end\r\n j+=1\r\n end\r\n i+=1\r\n end\r\n\r\n puts \"total cutters : \" + cutters.length.to_s\r\n cutters\r\nend", "def split(arg1, arg2)\n\tputs (arg1 + arg2)/3\nend", "def split_in_parts (s, part_length)\n s.gsub(/(\\w{#{part_length}})/, '\\1 ').strip\nend", "def test_grid\n t = TreeShape.new(8)\n count = 0\n t.grid.each_index do |xi|\n t.grid[xi].each_index do |yi|\n count += 1\n end\n end\n assert_equal(count, t.height * t.width)\n end", "def test_layers_returns_layers_obj\n obj = Sketchup.active_model.pages.add 'Testup Page'\n layers_obj = obj.layers\n result = layers_obj.class\n expected = Array\n assert_equal(expected, result, 'Expected does not match result.')\n end", "def run\n # Digits 1,4,7,8 have 2,4,3,7 segments respectively\n @list.map{|line| line[1]}.flatten.map(&:length).filter{|len| [2, 4, 3, 7].include?(len)}.count\n end", "def message_split(name)\n messages = @data[name]\n\n char_me = 0\n char_them = 0\n\n messages.each do |msg|\n begin\n if msg[2].to_i == 2\n char_me = char_me + msg[1].size\n else\n char_them = char_them + msg[1].size\n end\n rescue\n next\n end\n end\n\n puts \"My char count: #{char_me} | Their char count: #{char_them}\"\n\n end", "def test_split_block_length\n in_str = \"0|abcd|you>me(100)|100.200|sdfg\"\n out_arr = [\"0\", \"abcd\", \"you>me(100)\", \"100.200\", \"sdfg\"]\n assert_equal out_arr, split_block(in_str)\n end", "def create\n @layer = Layer.new(params[:layer])\n\n respond_to do |format|\n if @layer and @layer.save\n @layers = Layer.all\n format.html { redirect_to layers_path, notice: 'Layer was successfully created.' }\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n else\n format.html { render action: \"new\" }\n format.json { render json: @layer.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_dimensions()\n frame_start\n label(:a) do\n puts \"Zadaj veľkosť bludiska (rozmery musia byť vačšie ako 0): X Y\"\n begin\n @width, @height = convert_s_array_to_i_array(gets.split(\" \"))\n raise(ArgumentError) if @width <= 0 or @height <= 0\n rescue ArgumentError\n puts \"Chybný vstup. Skús znova.\\n\"\n\n # znovu nacitanie vstupu\n goto :a\n end\n end\n frame_end\n end", "def render\n draw\n (@shape.size).times {|c| puts @shape[c]}\n end", "def split\n sw = (w / 2.0).round\n sh = (h / 2.0).round\n return Rect.new(x, y, sw, sh),\n Rect.new(x + sw, y, sw, sh),\n Rect.new(x, y + sh, sw, sh),\n Rect.new(x + sw, y + sh, sw, sh)\n end", "def diamond(length)\n diamonds = (1..length).select { |num| num.odd? }\n shape_array = []\n spaces = length / 2\n length.times do |num|\n index = length / 2 - spaces.abs\n shape_array << \"#{' ' * spaces.abs}#{'*' * diamonds[index]}\"\n spaces -= 1\n end\n shape_array\nend", "def print_fine_points(points,size)\n grid = []\n for i in 0..size-1\n grid.push([])\n for j in 0..size-1\n if points.include? [j,i]\n grid.last.push(\"x\")\n else\n grid.last.push(\".\")\n end\n end\n end\n grid.reverse!\n grid.map {|x| puts x.join(\"\")}\nend", "def group_divider (array_of_names)\n\tcounter = 0\n\tgroup_num = 0\n\tgroup_storage = []\n\tif array_of_names == nil\n\t\treturn nil\n\telsif\n\t\tarray_of_names.length < 3\n\t\tp \"It's no fun in a group less than 3 people.\"\n\telsif array_of_names.length == 3\n\t\tp \"Group 1: \" + array_of_names.join(\", \")\n\telsif array_of_names.length % 4 != 0\n\t\t\n\t\twhile counter < array_of_names.length \n\t\t\tgroup_storage << array_of_names[counter..counter + 3]\n\t\t\tcounter += 4\n\t\t\tif group_storage[group_num].length == 2\n\t\t\t\tgroup_storage.last << group_storage.first.pop\n\t\t\telsif group_storage[group_num].length == 1\n\t\t\t\tgroup_storage.first << group_storage.pop.pop\n\t\t\tend\n\t\t\tgroup_num += 1\n\t\tend\n\telse\n\t\t\n\t\twhile counter < array_of_names.length \n\t\t\tgroup_storage << array_of_names[counter..counter + 3]\n\t\t\tcounter += 4\n\t\tend\n\t\t\n\tend\n\t\n\tgroup_name_assign = 1\n\twhile group_name_assign <= group_storage.length\n\t\tp \"Group #{group_name_assign}: \" + group_storage[group_name_assign - 1].join(\", \")\n\t\tgroup_name_assign += 1\n\tend\t\nend", "def collection_of_borders_and_solids args\n collection_borders = [\n [\n [200, 0, 50, 50], # black border\n [200, 100, 50, 50, 255, 0, 0], # red border\n [200, 200, 50, 50, [0, 255, 0]], # nested color\n ],\n [[200, 300, 50, 50], 0, 0, 255], # nested rect\n [[200, 400, 50, 50], [255, 0, 255]] # nested rect and nested color\n ]\n\n args.outputs.borders << collection_borders\n\n collection_solids = [\n [\n [[300, 300, 50, 50], 0, 0, 255], # nested rect\n [[300, 400, 50, 50], [255, 0, 255]] # nested rect and nested color\n ],\n [300, 0, 50, 50],\n [300, 100, 50, 50, 255, 0, 0],\n [300, 200, 50, 50, [0, 255, 0]], # nested color\n ]\n\n args.outputs.solids << collection_solids\nend", "def subdivide\n smallerFaces = Array.new\n\n @faces.each { |t| smallerFaces.concat t.subdivide }\n\n @faces = smallerFaces\n end", "def split_into_parts\n number = integer.to_i\n\n @parts = [\n number / 10**8,\n (number / 10**4) % 10**4,\n number % 10**4\n ]\n end", "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", "def split(string, n)\n string.split(n)\nend", "def list_nix_partitions_with_size_and_type # nelsongs\n\t`fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && ($6==\"83\" || $6==\"82\")) print $1\":\"$5\":\"$6;else {if ($5==\"83\" || $5==\"82\") print $1\":\"$4\":\"$5}}' | sed s/+//g`.split\nend", "def vertical size, coordinates\n coords = []\n sc = coordinates[0]\n coords << sc\n (size - 1).times do\n coords << sc.next\n sc = sc.next\n end\n coords.map {|x| x + \"#{coordinates[1..-1]}\"}\n end", "def test_doe_latin_hypercube_method_should_return_evenly_distributed_points_across_parameter_space_5_param_case\n @experiment_with_multiple_params.doe_info = [[\"latinHypercube\", [\"param-0\", \"param-1\", \"param-2\", \"param-3\", \"param-4\"]]]\n\n\n doe_method_result = @experiment_with_multiple_params.apply_doe_methods.first\n\n\n\n assert_equal \"latinHypercube\", doe_method_result[0]\n assert_equal [\"param-0\", \"param-1\", \"param-2\", \"param-3\", \"param-4\"], doe_method_result[1]\n assert_equal 6, doe_method_result[2].size\n\n level_counters = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]\n\n doe_method_result[2].each do |input_parameter_space_point|\n input_parameter_space_point.each_with_index do |value, index|\n level_counters[index][value / 20] += 1\n end\n end\n\n level_counters.each { |counter| assert_equal [1, 1, 1, 1, 1, 1], counter }\n end", "def lines\n 2 * @size + 3\n end", "def divide(x1,x2,y1,y2)\n width = x2-x1+1\n length = y2-y1+1\n if length != 1 && width != 1\n if length > width #add walls horizontally\n div = buildWall(x1,x2,y1,y2,\"hor\")\n divide(x1,x2,y1,div-1)\n divide(x1,x2,div+1,y2)\n else #add walls vertically\n div = buildWall(y1,y2,x1,x2,\"ver\")\n divide(x1,div-1,y1,y2)\n divide(div+1,x2,y1,y2)\n end\n end\n end", "def levelsize\n w=@width-(2*@border)\n h=@height-(2*@border)\n return [w, w * gridwidth / gridheight ] if fit_width()\n return [h * gridheight / gridwidth, h]\n end", "def find_possible_centers(size)\n size.odd? ? [size/2] : [(size/2)-1, size/2]\nend", "def split national_number\n _, trunk, ndc, *rest = internal_split national_number\n [trunk, ndc, *rest]\n end", "def printing(letter)\ncase letter\nwhen \"a\"\n @shape1 = \" ### \"\n @shape2 = \" # # \"\n @shape3 = \" ##### \"\n @shape4 = \" # # \"\n @shape5 = \" # # \"\n when \"b\"\n @shape1 = \" #### \"\n @shape2 = \" # # \"\n @shape3 = \" #### \"\n @shape4 = \" # # \"\n @shape5 = \" #### \"\n when \"c\"\n @shape1 = \" ### \"\n @shape2 = \" # \"\n @shape3 = \" # \"\n @shape4 = \" # \"\n @shape5 = \" ### \"\n when \"d\"\n @shape1 = \" #### \"\n @shape2 = \" # # \"\n @shape3 = \" # # \"\n @shape4 = \" # # \"\n @shape5 = \" #### \" \n when \"e\"\n @shape1 = \" #### \"\n @shape2 = \" # \"\n @shape3 = \" ## \"\n @shape4 = \" # \"\n @shape5 = \" #### \"\n when \"f\"\n @shape1 = \" #### \"\n @shape2 = \" # \"\n @shape3 = \" ## \"\n @shape4 = \" # \"\n @shape5 = \" # \"\n when \"g\"\n @shape1 = \" ### \"\n @shape2 = \" # \"\n @shape3 = \" # ### \"\n @shape4 = \" # # \"\n @shape5 = \" ### \"\n when \"h\"\n @shape1 = \" # # \"\n @shape2 = \" # # \"\n @shape3 = \" ##### \"\n @shape4 = \" # # \"\n @shape5 = \" # # \"\n when \"i\"\n @shape1 = \" ### \"\n @shape2 = \" # \"\n @shape3 = \" # \"\n @shape4 = \" # \"\n @shape5 = \" ### \"\n when \"j\"\n @shape1 = \" ### \"\n @shape2 = \" # \"\n @shape3 = \" # \"\n @shape4 = \" # \"\n @shape5 = \" ## \"\n when \"k\"\n @shape1 = \" # # \"\n @shape2 = \" # # \"\n @shape3 = \" ## \"\n @shape4 = \" # # \"\n @shape5 = \" # # \"\n when \"l\"\n @shape1 = \" # \"\n @shape2 = \" # \"\n @shape3 = \" # \"\n @shape4 = \" # \"\n @shape5 = \" #### \"\n when \"m\"\n @shape1 = \" # # \"\n @shape2 = \" ## ## \"\n @shape3 = \" # ## # \"\n @shape4 = \" # # \"\n @shape5 = \" # # \"\n when \"n\"\n @shape1 = \" # # \"\n @shape2 = \" ## # \"\n @shape3 = \" # # # \"\n @shape4 = \" # ## \"\n @shape5 = \" # # \"\n when \"o\"\n @shape1 = \" ### \"\n @shape2 = \" # # \"\n @shape3 = \" # # \"\n @shape4 = \" # # \"\n @shape5 = \" ### \"\n when \"p\"\n @shape1 = \" ### \"\n @shape2 = \" # # \"\n @shape3 = \" ### \"\n @shape4 = \" # \"\n @shape5 = \" # \"\n when \"q\"\n @shape1 = \" ### \"\n @shape2 = \" # # \"\n @shape3 = \" # # \"\n @shape4 = \" # # \"\n @shape5 = \" ## # \"\n when \"r\"\n @shape1 = \" ### \"\n @shape2 = \" # # \"\n @shape3 = \" ### \"\n @shape4 = \" # # \"\n @shape5 = \" # # \"\n when \"s\"\n @shape1 = \" ### \"\n @shape2 = \" # \"\n @shape3 = \" ## \"\n @shape4 = \" # \"\n @shape5 = \" ### \"\n when \"t\"\n @shape1 = \" ##### \"\n @shape2 = \" # \"\n @shape3 = \" # \"\n @shape4 = \" # \"\n @shape5 = \" # \"\n when \"u\"\n @shape1 = \" # # \"\n @shape2 = \" # # \"\n @shape3 = \" # # \"\n @shape4 = \" # # \"\n @shape5 = \" ### \"\n when \"v\"\n @shape1 = \" # # \"\n @shape2 = \" # # \"\n @shape3 = \" # # \"\n @shape4 = \" # # \"\n @shape5 = \" # \"\n when \"w\"\n @shape1 = \" # # \"\n @shape2 = \" # # \"\n @shape3 = \" # ## # \"\n @shape4 = \" ## ## \"\n @shape5 = \" # # \"\n when \"x\"\n @shape1 = \" # # \"\n @shape2 = \" # # \"\n @shape3 = \" # \"\n @shape4 = \" # # \"\n @shape5 = \" # # \"\n when \"y\"\n @shape1 = \" # # \"\n @shape2 = \" # # \"\n @shape3 = \" # \"\n @shape4 = \" # \"\n @shape5 = \" # \"\n when \"z\"\n @shape1 = \" ##### \"\n @shape2 = \" # \"\n @shape3 = \" # \"\n @shape4 = \" # \"\n @shape5 = \" ##### \"\n when \"!\"\n @shape1 = \" ### \"\n @shape2 = \" ### \"\n @shape3 = \" ### \"\n @shape4 = \" # \"\n @shape5 = \" (#) \"\n when \" \"\n @shape1 = \" \"\n @shape2 = \" \"\n @shape3 = \" \"\n @shape4 = \" \"\n @shape5 = \" \"\n when \"?\" || \",\" || \".\" || \";\"\n @shape1 = \"\"\n @shape2 = \"\"\n @shape3 = \"\"\n @shape4 = \"\"\n @shape5 = \"\"\n else\n @shape1 = \"\"\n @shape2 = \"\"\n @shape3 = \"\"\n @shape4 = \"\"\n @shape5 = \"\"\nend\nend", "def estimate_layer_counts(board_size, max_exponent)\n num_cells = board_size**2\n i_max = max_exponent - 2\n max_sum = num_cells * 2**i_max\n table = count_compositions(max_sum, num_cells, 0, i_max)\n table.map.with_index do |row, index|\n sum = (index + 1) * 2\n counts = row.map.with_index do |count_k, i|\n k = i + 1\n count_k * choose(num_cells, k)\n end\n [sum, counts.sum]\n end\nend", "def identify(args={})\n tokens = [\"identify\"]\n tokens << convert_to_arguments(args) if args\n tokens << \" '#{@file}#{\"[#{args[:layer].to_s}]\" if args[:layer]}'\"\n tokens = convert_to_command(tokens)\n output = run(tokens)[0]\n output\n end", "def line_n\n [\"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\"]\nend", "def sides\n \t@labels.length #return 6\n end", "def describe_image(image)\n puts \"#{image[:name]} is #{image[:width]}px * #{image[:height]}px\"\nend", "def size_ls\n size_l.blank? ? '' : size_l.split(/x|\\+/)[0, 2].join('x')\nend", "def generate( type, *args )\n puts \"==> generate >#{type}< - with #{args.size} part(s) #{args.inspect}\"\n\n character = @chars[ type ]\n\n img = nil ## (by default) auto-derive width x height dimension from first image\n\n character.each_with_index do |(part_key, part),i|\n num = args[i]\n\n ## todo/check - double check if part required set to false - why? why not?\n next if num == 0 ## note: skip part if index is 0!!!\n\n attributes = if part.is_a?( Hash )\n part[:attributes]\n else ## assume array - \"inline\" compact attribute format\n part\n end\n\n attribute = attributes[ num-1 ] ## note: num starts counting at 1 (sub 1 for zero-based array index)\n raise ArgumentError, \"no >#{part_key}< part found for index #{num}; sorry\" if attribute.nil?\n\n print \"#{i} #{part_key} => #{num}\"\n print \" - #{attribute[:name]}\" if attribute.is_a?( Hash ) && attribute.has_key?( :name )\n print \"\\n\"\n\n\n img_part = if attribute.is_a?( Integer ) ## assume filename with num (as .png)\n path = \"#{@rootdir}/#{type}/#{part_key}/#{part_key}#{num}.png\"\n img_part = Image.read( path )\n elsif attribute.is_a?( Hash )\n if attribute.has_key?( :design )\n path = \"#{@rootdir}/#{attribute[:design]}.txt\"\n txt = File.open( path, 'r:utf-8') {|f| f.read }\n img_part = Image.parse( txt, colors: attribute[:colors] )\n else ## assume for now has key :path\n path = \"#{@rootdir}/#{attribute[:path]}.png\"\n img_part = Image.read( path )\n end\n else\n puts \"!! ERROR:\"\n pp part\n raise ArgumentError, \"unknown part data type; expected Integer|Hash\"\n end\n ## note: if (very) first part - auto-create empty image with size/dimensions from part\n img = Image.new( img_part.width, img_part.height ) if i==0\n img.compose!( img_part )\n end\n\n img\nend", "def split_reactions(outname, ops, composition, stamp_columns)\n coll = ops.first.output(outname).collection\n\n step_1 = \"Place <b>#{coll}-#{TEST}</b> and <b>#{coll}-#{REAL}</b>\"\n step_1 += \" in the same orientation on the bench\"\n\n if stamp_columns.is_a?(Numeric) && stamp_columns > 1\n step_2 = \"Transfer <b>#{composition.qty_display}</b> of\"\n step_2 += \" reaction mix from each microfuge tube\"\n step_2 += \" to the corresponding tube in\"\n step_2 += \" <b>#{coll}-#{TEST}</b>\"\n\n step_3 = \"Transfer <b>#{stamp_columns} #{composition.qty_display} aliquots</b> of\"\n step_3 += \" reaction mix from each microfuge tube\"\n step_3 += \" to the corresponding <b>column</b> in\"\n step_3 += \" <b>#{coll}-#{REAL}</b>\"\n else\n step_2 = \"Transfer <b>#{composition.qty_display}</b> of\"\n step_2 += \" reaction mix from each tube in\"\n step_2 += \" <b>#{coll}-#{TEST}</b> to the corresponding tube in\"\n step_2 += \" <b>#{coll}-#{REAL}</b>\"\n\n step_3 = \"\"\n end\n\n show do\n title \"Split Reactions\"\n check step_1\n check step_2\n check step_3 if step_3.present?\n end\n end", "def display_input\n\t\n\t\tputs \"2-lettered tiles:\"\n\t\t(@@two_tiles).each { |t| \n\t\t\tprint \"#{t.letters} \" \n\t\t}\n\t\t\n\t\tputs \"\\n3-lettered tiles:\"\n\t\t(@@three_tiles).each { |t| \n\t\t\tprint \"#{t.letters} \" \n\t\t}\n\t\t\n\t\tputs \"\\n4-lettered tiles:\"\n\t\t(@@four_tiles).each { |t| \n\t\t\tprint \"#{t.letters} \" \n\t\t}\n\t\t\n\tend", "def split_for_height(text)\n if @wrap == :word then return text.split(/\\s/)\n else return text.split(//) end\n end", "def cut(num_segments)\n t = direction*(1.0/num_segments)\n ret = [@root]\n num_segments.times do |i|\n ret << @root + t*(i + 1)\n end\n ret\n end", "def input_parse(input)\n list_coords = []\n height = 0\n xMin, xMax, yMin = [500, 0, 500]\n input.split(\"\\n\").each do |com_coords|\n if com_coords[0]=='x'\n x_raw, y_raw = com_coords.split(\",\")\n x = x_raw.delete(\"^0-9\").to_i\n xMin, xMax = [[xMin, x].min, [xMax, x].max]\n y_min, y_max = y_raw.delete(\" y=\").split('..').map{|i| i.to_i}\n height = [height, y_max].max\n (y_min..y_max).each do |y| \n list_coords.push({x: x, y: y})\n end\n else\n y_raw, x_raw = com_coords.split(\",\")\n y = y_raw.delete(\"^0-9\").to_i\n height = [height, y].max\n x_min, x_max = x_raw.delete(\" x=\").split('..').map{|i| i.to_i}\n xMin, xMax = [[xMin, x_min].min, [xMax, x_max].max]\n (x_min..x_max).each do |x| \n list_coords.push({x: x, y: y})\n end\n end\n end\n\n drawing = []\n height.times{|h| drawing.push(' '*((xMax - xMin)+3))}\n list_coords.each{|coords| drawing[coords[:y]-1][coords[:x] - xMin+1] = '#'} # draw clay\n drawing[0][500-xMin+1] = '|'\n drawing\nend", "def get_outer_layer(strio)\r\n str = \"\"\r\n nest = 0\r\n until (ch=strio.read(1)) == ')' and nest == 0\r\n str << ch\r\n str << strio.read(1) if ch == \"\\\\\"\r\n nest += 1 if ch == '('\r\n nest -= 1 if ch == ')'\r\n end\r\n str\r\nend", "def printGrid(number_of_pieces)\n size = number_of_pieces.to_s.length\n print_horizontal_line((size+1) * @width + 1)\n \n (@height - 1).downto(0) do |hIdx|\n print '|'\n @width.times do |wIdx|\n print fixed_string(@grid[wIdx][hIdx].to_s, size)\n print ' ' if wIdx < @width - 1\n end\n print '|'\n print \"\\n\"\n end\n \n print_horizontal_line((size+1) * @width + 1)\n end", "def go\n\nlines = 3 # cut it at line 3\n\nbasename = 'file_to_split.txt'\nextname = \"part\"\n\npart = 1\nline = 0\n\nfline = 0\nfor i in ifp = open(basename)\n fline = fline + 1\nend\nifp.close\n\nparts = fline / lines + 1\n\nfor i in ifp = open(basename)\n if line == 0\n ofp = open(sprintf(\"%s.%s%02d\", basename, extname, part), \"w\")\n printf(ofp, \"%s part%02d/%02d\\n\", basename, part, parts)\n ofp.write(\"BEGIN--cut here--cut here\\n\")\n end\n ofp.write(i)\n line = line + 1\n if line >= lines and !ifp.eof?\n ofp.write(\"END--cut here--cut here\\n\")\n ofp.close\n part = part + 1\n line = 0\n end\nend\nofp.write(\"END--cut here--cut here\\n\")\nofp.close\n\nifp.close\n\nend", "def ne(length_of_sides)\n spaces = length_of_sides\n accum_num = length_of_sides\n length_of_sides.times do\n puts \"#{' ' * (spaces - accum_num)}#{'*' * accum_num}\"\n accum_num -= 1\n end\nend", "def to_s\n output = ''\n (10..@height-10).each do |y|\n (10..@width-10).each do |x|\n output += @surface[y][x].to_s\n end\n output += \"\\n\"\n end\n return output\n\tend", "def print_map\n (@height).times do |y|\n (@width).times do |x|\n if(is_solid?(x, y))\n print(\"#\")\n else\n print(\".\")\n end\n end\n print(\"\\n\")\n end\n end", "def setup_triangles(background)\n gc = Magick::Draw.new\n gc.stroke_width(2)\n gc.stroke(\"red\")\n gc.fill(\"blue\")\n # all the triangles are part of the same body\n body = CP::Body.new(Float::MAX, Float::MAX)\n base = 15\n height = 10\n shape_vertices = [CP::Vec2.new(-base, base), CP::Vec2.new(base, base), CP::Vec2.new(0, -height)]\n # make shapes and images\n 8.times do |i|\n 8.times do |j|\n stagger = (j % 2) * 40\n x = i * 80 + stagger\n y = j * 70 + 80\n shape = CP::Shape::Poly.new(body, shape_vertices, CP::Vec2.new(x, y))\n shape.e = 1\n shape.u = 1\n @space.add_static_shape(shape)\n gc.polygon(x - base + 1, y + base - 1, x + base - 1, y + base - 1, x, y - height + 1)\n end\n end\n # do the drawing\n gc.draw(background)\n end", "def seed_layers(layers, opts)\n start_zoom = opts[:start_zoom]\n end_zoom = opts[:end_zoom] || start_zoom\n geoserver_wms_url = Utils::local_geoserver_address(opts)\n url_format = Utils::get_url_format_from_url(opts[:url])\n tiles_seed_count = 0\n\n for zoom_level in start_zoom..end_zoom\n layers.each do |layer|\n opts_for_squid_layer_seeder = opts.dup\n opts_for_squid_layer_seeder[:layer] = layer\n opts_for_squid_layer_seeder[:zoom_level] = zoom_level\n opts_for_squid_layer_seeder[:geoserver_wms_url] = geoserver_wms_url\n opts_for_squid_layer_seeder[:url_format] = url_format\n\n layer_seeder = SquidLayerSeeder.new(opts_for_squid_layer_seeder)\n tiles_seed_count += layer_seeder.seed\n end\n end\n\n $logger.info \"Total tiles seeded in operation: '#{tiles_seed_count}'\"\n\n return true\nend", "def print_groups(groups)\n\tx = 0\n\t3.times do\n\tputs \"Unit #{x + 1} Groups\"\n\tgroups[x].each { |group| puts \"#{group} \\n\" }\n\tx += 1\nend\nend", "def board\n # split_letters = @board_string.partition { |group| }\n # p split_letters\n # @empty_board.each { |row| puts row }\n @game_board.each_with_index {|row| p row}\n # end\n end", "def draw_cutters cutters\r\n cutters.each do |cutter|\r\n draw_cutter(cutter)\r\n end \r\nend" ]
[ "0.5808757", "0.5765374", "0.5567595", "0.5537976", "0.55103034", "0.531557", "0.52791226", "0.52499366", "0.5210015", "0.5145776", "0.50884956", "0.507714", "0.5074053", "0.504909", "0.50011134", "0.4993981", "0.49810904", "0.49730843", "0.49655437", "0.49503893", "0.49175352", "0.4915464", "0.49122953", "0.4902954", "0.48896188", "0.48698512", "0.48698512", "0.48518103", "0.48255062", "0.48252305", "0.48241177", "0.48187742", "0.48168856", "0.48051032", "0.4792632", "0.4787672", "0.47722661", "0.4750364", "0.47474414", "0.47462153", "0.47420156", "0.47326964", "0.47310278", "0.4730071", "0.47228408", "0.47194016", "0.4718674", "0.47112814", "0.47066808", "0.47057492", "0.47034428", "0.47026336", "0.46880758", "0.46853334", "0.46845385", "0.4679074", "0.46756646", "0.46713692", "0.4667447", "0.46658713", "0.4655227", "0.46529046", "0.46456125", "0.46392244", "0.46210116", "0.4618789", "0.46143785", "0.461054", "0.46058157", "0.46039265", "0.4602847", "0.45922786", "0.45919263", "0.45902207", "0.45860308", "0.4585109", "0.45835072", "0.45567644", "0.45552415", "0.4553452", "0.45524022", "0.4550055", "0.45480177", "0.45427716", "0.4542364", "0.45383537", "0.45377144", "0.45359212", "0.4534907", "0.45347422", "0.45305568", "0.45244527", "0.45235443", "0.45224583", "0.45217296", "0.45216724", "0.4520123", "0.45184705", "0.4518435", "0.45179272" ]
0.5965251
0
determine whether the change set relate to this channel
def create_job(change_set) cs = GtaTravelChannelCtaChangeSetChannel.create(:change_set_id => change_set.id, :channel_id => self.channel.id) cs.delay.run end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def channel?\n self.channel_referent_id > 0\n end", "def changed?\n changes.changed?\n end", "def changed?\n !!@previous\n end", "def change?\n type == 'change'\n end", "def changed?\n @changed\n end", "def changed?\n\t\treturn self.changed_reason ? true : false\n\tend", "def changed?(key = nil)\n if key.nil?\n changes.any?\n else\n changes.include?(key)\n end\n end", "def changed?(key = nil)\n if key.nil?\n changes.any?\n else\n changes.include?(key)\n end\n end", "def changed?\n @changed\n end", "def changed?\r\n @changed\r\n end", "def include?(msg)\n @changes.include? msg\n end", "def changed?\n self.event_state.include? :changed\n end", "def changed_with_associated?\n without_recursion(:changed) do\n changed_without_associated? or changed_associated\n end\n end", "def changed?(key)\n changed.has_key?(key)\n end", "def changed?(key)\n changed.has_key?(key)\n end", "def changed?\n !!@changed\n end", "def changed? \n @changed == true\n end", "def has_changes?\n @has_updated || @has_created\n end", "def changed?\n instance.changed.include? \"#{name}_identifier\"\n end", "def changed?\n to_h != self.class.find(id).to_h\n end", "def changed?\n !!parent\n end", "def changed?(other)\n !unchanged?(other)\n end", "def content_changed?\n changed? && changes.keys != ['is_current']\n end", "def collins_check_can_be_altered?\n collins_osc_state['current_state'] == \"can_be_altered\"\n end", "def _active_remote_track_changes?\n @_active_remote_track_changes != false\n end", "def is_reconciled_and_updated?\n is_reconciled = reconcile_membership\n is_reconciled && is_updated?\n end", "def data_changed?\n changes.include?(\"data\")\n end", "def email_changed?\n (self.channel_referent_id==0) && super\n end", "def change_type_set?\n self.change_type\n end", "def changed?\n !head || head.id != read_head_id\n end", "def changelog_changes?\n git.modified_files.include?(filename) || git.added_files.include?(filename)\n end", "def any_updates?\n change_history.size > 1\n end", "def any_updates?\n change_history.size > 1\n end", "def changed?\n !@newly_set_features.empty?\n end", "def card_content_changed?\n (%w(front back) & changes_to_save.keys).present?\n end", "def issue_linked_to_same_commit?(issue)\n repository.same_commits_in_scope(issue.changesets, self).any?\n end", "def change?\n updated? || deleted?\n end", "def changed?\n head.nil? or head.id != read_head_id\n end", "def track_object_changes_for_draft?\n self.class.draft_class.column_names.include?('object_changes')\n end", "def config_changed?\n self.class.find(id)&.to_config != to_config\n end", "def changed?\n #card_type_changed?\n ret=(changed & DB_FIELDS).present? || VIRTUAL_FIELDS.any? {|attr| self.send(attr).present?}\n ret\n end", "def changed?\n if defined? @observer_state and @observer_state\n true\n else\n false\n end\n end", "def changed?\n mutations_from_database.any_changes?\n end", "def has_changes?\n @has_changed_the_db\n end", "def channel?\n not query?\n end", "def has_changed_parent?\n self.parent_id_changed?\n end", "def has_changes?(branch)\n zombie_check\n end", "def published?(change_set)\n change_set.changed?(:state) && change_set.resource.decorate.public_readable_state?\n end", "def changes\n @changes ||= Set.new\n end", "def changes\n @changes ||= Set.new\n end", "def change_detail_set?\n self.change_detail\n end", "def update_on?(peer); (self_owned? || peer.owns?(self)) && remote_siblings[peer] end", "def changed? \n @values.any { |v| v.changed? || v.deleted? }\n end", "def admin_changed?\n # no change: false\n # false <-> nil: false\n # false|nil <-> true: true\n !!changes['admin'].try {|from, to| !!from != !!to}\n end", "def changed?\n @observer_state\n end", "def changed?\n return false unless ldp_object.present?\n ldp_object.changed?\n end", "def changed?\n if update_type == :no_change\n false\n else\n true\n end\n end", "def added?\n branch != BASE && !changed?\n end", "def updated?\n self.connected && self.updated\n end", "def updated_by?(peer); self_owned? || (remote_siblings[peer] && peer.owns?(self)) end", "def dirty?\n @changes && @changes.size > 0\n end", "def working?\n raise NotImplementedError.new(\"working() must be implemented by subclasses of AbstractChangeset.\")\n end", "def any_changes?\n @counters.empty? || all_counters.any?(&:value_changed?)\n end", "def changed?\n !changed_attributes.empty?\n end", "def hasChanged?(key)\n\t\treturn self[key] != @oldConfig[key]\n\tend", "def dirty?\n @changes.length > 0\n end", "def to? channel\n (!@only && !@except) ||\n (@only && @only.include?(channel)) ||\n (@except && !@except.include?(channel))\n end", "def change_item_set?\n self.change_item\n end", "def in_conflict?(local_diff, remote_diff)\n return true if\n local_diff.target.parent.is_a?(Array) &&\n local_diff.target.value.is_a?(DataModel::Referenceable) &&\n local_diff.target.value.id == remote_diff.target.value.id &&\n local_diff != remote_diff\n\n case [local_diff, remote_diff].map { |d| d.class.name.split('::').last }.sort\n when %w(Change Change)\n local_diff.changed_from.value == remote_diff.changed_from.value &&\n local_diff.target.value != remote_diff.target.value\n when %w(Change Delete)\n true\n else\n false\n end\n end", "def changed?\n true\n end", "def core_changed?\n qtype_name_changed? || option_set_id_changed? || constraint_changed?\n end", "def core_changed?\n qtype_name_changed? || option_set_id_changed? || constraint_changed?\n end", "def changed_line?(previous_line, current_line)\n\t\t\tprevious_line.each do |line|\n\t\t\t\tif current_line.include?(line)\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn true\n\t\tend", "def changed?(attr)\n @is[attr] != @should[attr]\n end", "def channel_backed?\n return false if self.try(:is_project_level)\n self.project_template_level || self.game == Game.applab || self.game == Game.gamelab || self.game == Game.pixelation\n end", "def changed?(key=nil)\n if key\n # return the changed values for the keys\n changed_attributes.key?(key)\n else\n changed_attributes.present?\n end\n end", "def changed?(attribute=nil)\n @snapshot.nil? or not snapshot_equal_content?(attribute)\n end", "def attribute_changed?(attr)\n changed_attributes.include?(attr)\n end", "def changed?(attr=nil)\n @_hr_changed ||= Hash.new(false)\n return @_hr_changed[attr.to_sym] if attr\n return @_hr_changed.keys.count > 0\n end", "def changed?(attr=nil)\n @_hr_changed ||= Hash.new(false)\n return @_hr_changed[attr.to_sym] if attr\n return @_hr_changed.keys.count > 0\n end", "def has_changes?\n (@edited_rows_codes.count > 0) || (@destroyed_rows_codes.count > 0)\n end", "def changed?\n return true if attributes_changed?\n return true if associations_changed?\n false\n end", "def change_type_required?\n self.change_class_set? && self.change_class.change_types.size > 0\n end", "def got_set\n return self.bid != self.tricks\n end", "def has_history?\n Ticket.client(client).any?\n end", "def attachment_reference_changed?\n !!@attachment_changed\n end", "def attachment_reference_changed?\n !!@attachment_changed\n end", "def changed?\n raw?\n end", "def mode_changes?\n ! @start_mode.nil? && @start_mode != @mode\n end", "def needs_updating?(change_set)\n # Always mint/update the ARK unless the resource already has an identifier\n return true unless change_set.resource.try(:identifier)\n # Only update under the following conditions:\n # - The resource has been published with a new identifier\n # - The source metadata identifier has changed\n published?(change_set) || published_with_new_title?(change_set) || change_set.changed?(:source_metadata_identifier)\n end", "def diffable?\n true\n end", "def changed?(olds, news) ; olds != news ; end", "def remote_changed?\n # TODO\n end", "def permissions_changed?\n return true if curation_concern.visibility_changed?\n @saved_permissions != curation_concern.permissions.map(&:to_hash)\n end", "def permissions_changed?\n return true if curation_concern.visibility_changed?\n @saved_permissions != curation_concern.permissions.map(&:to_hash)\n end", "def mapped_to_channel?(channel)\n !RoomTypeChannelMapping.find_by_room_type_id_and_channel_id_and_disabled(self.id, channel.id, false).blank?\n end", "def anything_changed?\n self.changed?;\n end", "def belongs_to_synced?(col, owner)\n # The :belongs_to that points to the instance has changed\n return false if get_belongs_to_attr(col) != owner\n\n # The polymorphic reference (_type, _id) columns do not match, maybe it was just saved\n return false if col.polymorphic && !polymorphic_attr_matches?(col, owner)\n\n # The key reference (_id) column does not match, maybe it was just saved\n return false if _get_attr(col.foreign_key) != owner.try(:id)\n\n true\n end", "def resource_changed?\n (@new_resource.subsystem_synonym && @current_resource.subsystem_synonym != @new_resource.subsystem_synonym) ||\n (@new_resource.arguments && @current_resource.arguments != @new_resource.arguments) ||\n (@new_resource.program && @current_resource.program != @new_resource.program) ||\n (@new_resource.user && @current_resource.user != @new_resource.user) ||\n (@new_resource.standard_input && @current_resource.standard_input != @new_resource.standard_input) ||\n (@new_resource.standard_output && @current_resource.standard_output != @new_resource.standard_output) ||\n (@new_resource.standard_error && @current_resource.standard_error != @new_resource.standard_error) ||\n (@new_resource.auto_restart && @current_resource.auto_restart != @new_resource.auto_restart) ||\n (@new_resource.multiple_instances && @current_resource.multiple_instances != @new_resource.multiple_instances) ||\n (@new_resource.use_signals && @current_resource.use_signals != @new_resource.use_signals) ||\n (@new_resource.use_sockets && @current_resource.use_sockets != @new_resource.use_sockets) ||\n (@new_resource.message_queue_key && @current_resource.message_queue_key != @new_resource.message_queue_key) ||\n (@new_resource.message_type && @current_resource.message_type != @new_resource.message_type) ||\n (@new_resource.priority && @current_resource.priority != @new_resource.priority) ||\n (@new_resource.normal_stop_signal && @current_resource.normal_stop_signal != @new_resource.normal_stop_signal) ||\n (@new_resource.force_stop_signal && @current_resource.force_stop_signal != @new_resource.force_stop_signal) ||\n (@new_resource.show_inactive && @current_resource.show_inactive != @new_resource.show_inactive) ||\n (@new_resource.wait_time && @current_resource.wait_time != @new_resource.wait_time) ||\n (@new_resource.subsystem_group && @current_resource.subsystem_group != @new_resource.subsystem_group)\nend", "def subscribed?; owners.any? { |peer| peer.subscribed?(self) if peer != Distributed } end", "def peer_auditor_issue?\n self.auditor_result == 'Comment'\n end" ]
[ "0.6893729", "0.6571284", "0.6379507", "0.63740695", "0.6322183", "0.6319279", "0.6269379", "0.6269379", "0.626497", "0.62622446", "0.6248768", "0.624072", "0.6238614", "0.62303495", "0.62303495", "0.6182778", "0.61695355", "0.6160975", "0.6157518", "0.6156739", "0.6121604", "0.6106323", "0.6098203", "0.60981", "0.60943294", "0.60799223", "0.6070314", "0.6047753", "0.6022169", "0.6004961", "0.59904885", "0.5984137", "0.5984137", "0.5982842", "0.59624773", "0.59381056", "0.5931685", "0.5928831", "0.5922073", "0.59194577", "0.5917827", "0.59069645", "0.5905401", "0.5898592", "0.5887908", "0.58786166", "0.58773375", "0.5859606", "0.58459336", "0.58459336", "0.5832048", "0.5831445", "0.5828644", "0.58143526", "0.58042115", "0.57952386", "0.57939845", "0.5791114", "0.5784819", "0.5780648", "0.57699335", "0.57681155", "0.57620573", "0.5757898", "0.5757168", "0.5752229", "0.5737503", "0.57252604", "0.5724192", "0.571379", "0.5710184", "0.5710184", "0.5709905", "0.5701449", "0.5701192", "0.5698732", "0.5694414", "0.5691092", "0.56767684", "0.56767684", "0.5674442", "0.56642", "0.56469107", "0.56411093", "0.56337875", "0.56299275", "0.56299275", "0.5615526", "0.5612384", "0.5609096", "0.5605242", "0.5603916", "0.5603589", "0.56012523", "0.56012523", "0.55922204", "0.55868703", "0.5578557", "0.5578452", "0.5571129", "0.5558894" ]
0.0
-1
This is used by acts_as_tree
def has_children? children.size > 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_tree\n\tend", "def parsed_tree; end", "def apply_children\n \n end", "def tree\n\n h.updated_tree || h.original_tree\n end", "def tree\r\n @rootNode\r\n end", "def tree\n h.updated_tree || h.original_tree\n end", "def tree\n @tree ||= build_tree\n end", "def show_tree\n htmltree = \"\"\n self.each { |node| \n htmltree += \"<li><a href='#{normalize(node.name)}'>\"\n htmltree += '&nbsp; ' * node.node_depth * 3\n htmltree += \"#{node.name}</a></li>\\n\"\n }\n htmltree\n end", "def is_leaf\n true\n end", "def is_leaf\n true\n end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def trees_to_html(trees)\nend", "def depth; end", "def show_tree\n\t\t@root_node.show\n\tend", "def new_issue_lft\n 1\n end", "def navigation_children\n sorted_children\n end", "def page_tree_selector \n pages.order(:names_depth_cache).map { |page| [\n \"---\" * page.depth + \n (page.displayed ? \" \" : \" (invisible) \") +\n page.menu_name, \n page.id\n ] }\n end", "def child_node; end", "def allowed_children; end", "def render\n return ro_standard if @readonly \n set_initial_value('html','value')\n require 'sort_alphabetical' \n \n record = record_text_for(@yaml['name'])\n p '******', \"<div id=\\\"#{@yaml['name']}\\\" class=\\\"tree-select\\\" #{set_style()} >\"\n @html << \"<div id=\\\"#{@yaml['name']}\\\" class=\\\"tree-select\\\" #{set_style()} >\"\n# Fill @choices hash. The key is parent object id\n @choices = {}\n do_eval(@yaml['eval']).each {|data| @choices[ data[2].to_s ] ||= []; @choices[ data[2].to_s ] << (data << false)}\n# put current values hash with. To speed up selection when there is a lot of categories\n current_values = {}\n current = @record[@yaml['name']] || []\n current.each {|e| current_values[e.to_s] = true}\n# set third element of @choices when selected\n @choices.keys.each do |key|\n 0.upto( @choices[key].size - 1 ) do |i|\n choice = @choices[key][i]\n choice[3] = true if current_values[ choice[1].to_s ]\n end\n end\n make_tree(nil)\n @html << '</ul></div>'\n# add hidden communication field \n @html << @parent.hidden_field(record, @yaml['name'], value: current.join(','))\n# javascript to update hidden record field when tree looses focus\n @js =<<EOJS\n$(function(){\n $(\"##{@yaml['name']}\").jstree( {\n \"checkbox\" : {\"three_state\" : false}, \n \"core\" : { \"themes\" : { \"icons\": false } },\n \"plugins\" : [\"checkbox\"]\n });\n});\n \n$(document).ready(function() {\n $('##{@yaml['name']}').on('focusout', function(e) {\n var checked_ids = [];\n var checked = $('##{@yaml['name']}').jstree(\"get_checked\", true);\n $.each(checked, function() {\n checked_ids.push( this.data.id );\n });\n $('#record_#{@yaml['name']}').val( checked_ids.join(\",\") );\n });\n});\nEOJS\n self\nend", "def pos; [lft,rgt] end", "def pos; [lft,rgt] end", "def pos; [lft,rgt] end", "def pos; [lft,rgt] end", "def pos; [lft,rgt] end", "def pos; [lft,rgt] end", "def pos; [lft,rgt] end", "def pos; [lft,rgt] end", "def build_tree(arr)\n\tend", "def children_table; end", "def tree_children\n\n tree[2]\n end", "def leaf?; false end", "def update_tree(element); end", "def tree\n Content::ContentTree.key\n end", "def for_node; end", "def tree_actions(row)\r\n html = [link_to(image_tag('std/edit.png'), :controller => :dev_feedbacks, :action => :edit, :id => row.id)]\r\n html << link_to(image_tag('std/del.png'),\r\n {:controller => :dev_feedbacks, :action => :destroy, :id => row.id},\r\n :remote => true,\r\n :confirm => _(\"Are you sure that you want to delete %{name}?\") % {:name => row.disp_name})\r\n c = DevFeedback.get_root.children\r\n html << link_to(image_tag('std/go_up.png'),\r\n {:controller => :dev_feedbacks, :action => :tree_move, :id => row.id, :direction => :prev},\r\n :update => \"dev_feedback_#{row.parent_id || 0}_div\", :remote => true) if row.self_and_siblings.first != row || (row.parent.nil? && c.first != row)\r\n html << link_to(image_tag('std/go_down.png'),\r\n {:controller => :dev_feedbacks, :action => :tree_move, :id => row.id, :direction => :next},\r\n :update => \"dev_feedback_#{row.parent_id || 0}_div\", :remote => true) if row.self_and_siblings.last != row || (row.parent.nil? && c.last != row)\r\n html << link_to(image_tag('std/go_left.png'),\r\n {:controller => :dev_feedbacks, :action => :tree_move, :id => row.id, :direction => :dec},\r\n :update => \"dev_feedback_#{row.parent.parent_id || 0}_div\", :remote => true) unless row.parent.nil?\r\n html << link_to(image_tag('std/go_right.png'),\r\n {:controller => :dev_feedbacks, :action => :tree_move, :id => row.id, :direction => :inc},\r\n :update => \"dev_feedback_#{row.left_sibling.id}_div\",\r\n :loaded => %Q[$(\"dev_feedback_#{row.id}_div\").remove()],\r\n :position => :bottom, :remote => true) if row.left_sibling\r\n return content_tag(:span, html.join.html_safe, :class => 'tree_actions', :id => \"#{row.id}_actions\")\r\n end", "def children=(_arg0); end", "def children=(_arg0); end", "def leaf?; @leaf; end", "def tree attributes: false\n self.document.__tree attributes: attributes\n end", "def nodes; end", "def nodes; end", "def nodes; end", "def tree(data_path, options = {})\n\t\t\t\tresult = \"\"\n\n\t\t\t\t# Unique hash\n\t\t\t\t@hash = Digest::SHA1.hexdigest(data_path.to_s)\n\n\t\t\t\t# Options\n\t\t\t\t@options = options.nil? ? {} : options\n\n\t\t\t\t# Clipboard\n\t\t\t\tif @options[:clipboard_attrs]\n\t\t\t\t\tclipboard = true\n\t\t\t\t\t@options[:clipboard_attrs] = [@options[:clipboard_attrs]] if !@options[:clipboard_attrs].is_a?(Array)\n\t\t\t\t\tclipboard_attrs_js = \"[\" + @options[:clipboard_attrs].map { |item| \"'#{item}'\" }.join(\",\") + \"]\"\n\t\t\t\telse\n\t\t\t\t\tclipboard = false\n\t\t\t\t\tclipboard_attrs_js = \"[]\"\n\t\t\t\tend\n\n\t\t\t\t# Actions\n\t\t\t\tif @options[:actions]\n\t\t\t\t\tactions_js = \"[\"\n\t\t\t\t\toptions[:actions].each do |key, action|\n\t\t\t\t\t\tactions_js += %{\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\turl: '#{action[:path] ? @path_resolver.resolve(action[:path], \":id\") : \"\"}',\n\t\t\t\t\t\t\t\ticon: '#{action[:icon]}',\n\t\t\t\t\t\t\t\tlabel: '#{action[:label]}',\n\t\t\t\t\t\t\t\tcollapsed: #{action[:collapsed] == true ? \"true\" : \"false\"},\n\t\t\t\t\t\t\t\tstyle: '#{action[:style] ? action[:style] : \"default\"}',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tactions_js += \"]\"\n\t\t\t\telse\n\t\t\t\t\tactions_js = \"[]\"\n\t\t\t\tend\n\n\t\t\t\t# Parent\n\t\t\t\tparent = (options[:parent] ? options[:parent] : nil)\n\n\t\t\t\t# Save state\n\t\t\t\tsave_state = (options[:save_state] ? options[:save_state] : :simple)\n\n\t\t\t\t# Application JS\n\t\t\t\tresult += @template.javascript_tag(%{\n\t\t\t\t\tvar rug_tree_#{@hash} = null;\n\t\t\t\t\t$(document).ready(function() {\n\t\t\t\t\t\trug_tree_#{@hash} = new RugTree('#{@hash}', {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Model\n\t\t\t\t\t\t\tmodel: 'node',\n\n\t\t\t\t\t\t\t// State\n\t\t\t\t\t\t\tsaveState: '#{save_state.to_s}',\n\n\t\t\t\t\t\t\t// Parent element\n\t\t\t\t\t\t\tparent: '#{parent.to_s}',\n\n\t\t\t\t\t\t\t// Icons\n\t\t\t\t\t\t\tclosedIcon: '#{@icon_builder.render(@options[:closed_icon] ? @options[:closed_icon] : \"chevron-right\")}',\n\t\t\t\t\t\t\topenedIcon: '#{@icon_builder.render(@options[:opened_icon] ? @options[:opened_icon] : \"chevron-down\")}',\n\n\t\t\t\t\t\t\t// Show\n\t\t\t\t\t\t\tshow: #{check_show(@options) ? 'true' : 'false'},\n\t\t\t\t\t\t\tshowEvent: '#{@options[:show_event] && @options[:show_event].to_sym == :double_click ? \"dblclick\" : \"click\"}',\n\t\t\t\t\t\t\tshowUrl: '#{@path_resolver.resolve(@options[:paths][:show], \":id\")}',\n\n\t\t\t\t\t\t\t// Create\n\t\t\t\t\t\t\tcreate: #{check_create(@options) ? 'true' : 'false'}, \n\t\t\t\t\t\t\tcreateUrl: '#{@path_resolver.resolve(@options[:paths][:create])}',\n\t\t\t\t\t\t\tcreateIcon: '#{@icon_builder.render(@options[:update_icon] ? @options[:update_icon] : \"plus\")}',\n\t\t\t\t\t\t\tcreateLabel: '#{I18n.t(\"general.action.create_child\").upcase_first}',\n\t\t\t\t\t\t\tcreateActionCollapsed: #{@options[:create_action_collapsed] == true ? 'true' : 'false'}, \n\t\t\t\t\t\t\tcreateSuccessMessage: '#{I18n.t(\"general.messages.create.success\")}',\n\n\t\t\t\t\t\t\t// Update\n\t\t\t\t\t\t\tupdate: #{check_update(@options) ? 'true' : 'false'}, \n\t\t\t\t\t\t\tupdateUrl: '#{@path_resolver.resolve(@options[:paths][:update], \":id\")}', \n\t\t\t\t\t\t\tupdateIcon: '#{@icon_builder.render(@options[:update_icon] ? @options[:update_icon] : \"pencil\")}',\n\t\t\t\t\t\t\tupdateLabel: '#{I18n.t(\"general.action.update\").upcase_first}',\n\t\t\t\t\t\t\tupdateActionCollapsed: #{@options[:update_action_collapsed] == true ? 'true' : 'false'}, \n\t\t\t\t\t\t\tupdateSuccessMessage: '#{I18n.t(\"general.messages.create.success\")}',\n\n\t\t\t\t\t\t\t// Destroy\n\t\t\t\t\t\t\tdestroy: #{check_destroy(@options) ? 'true' : 'false'}, \n\t\t\t\t\t\t\tdestroyUrl: '#{@path_resolver.resolve(@options[:paths][:destroy], \":id\")}', \n\t\t\t\t\t\t\tdestroyIcon: '#{@icon_builder.render(@options[:update_icon] ? @options[:update_icon] : \"trash\")}',\n\t\t\t\t\t\t\tdestroyLabel: '#{I18n.t(\"general.action.destroy\").upcase_first}',\n\t\t\t\t\t\t\tdestroyActionCollapsed: #{@options[:destroy_action_collapsed] == true ? 'true' : 'false'}, \n\t\t\t\t\t\t\tdestroyConfirmMessage: '#{I18n.t(\"general.are_you_sure\")}',\n\t\t\t\t\t\t\tdestroySuccessMessage: '#{I18n.t(\"general.messages.destroy.success\")}',\n\n\t\t\t\t\t\t\t// Moving\n\t\t\t\t\t\t\tmoving: #{check_moving(@options) ? 'true' : 'false'},\n\t\t\t\t\t\t\tmovingUrl: '#{@path_resolver.resolve(@options[:paths][:move], \":id\", \":relation\", \":destination_id\")}',\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Type\n\t\t\t\t\t\t\ttypeIconTemplate: '#{@icon_builder.render(\":icon\", class: \"jqtree-icon\")}',\n\t\t\t\t\t\t\ttypeIconAttr: '#{@options[:type_icon_attr]}',\n\n\t\t\t\t\t\t\t// Actions\n\t\t\t\t\t\t\tactions: #{actions_js},\n\t\t\t\t\t\t\tactionsIconTemplate: '#{@icon_builder.render(\":icon\")}',\n\n\t\t\t\t\t\t\t// Clipboard\n\t\t\t\t\t\t\tclipboard: #{clipboard ? 'true' : 'false'},\n\t\t\t\t\t\t\tclipboardIcon: '#{@icon_builder.render(@options[:clipboard_icon] ? @options[:clipboard_icon] : \"clipboard\")}',\n\t\t\t\t\t\t\tclipboardTemplate: \"#{clipboard ? (@options[:clipboard_template] ? @options[:clipboard_template].gsub('\"', \"'\") : \":\" + @options[:clipboard_attrs].first) : \"\"}\",\n\t\t\t\t\t\t\tclipboardAttrs: #{clipboard_attrs_js},\n\t\t\t\t\t\t\tclipboardActionCollapsed: #{@options[:clipboard_action_collapsed] == true ? 'true' : 'false'}, \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Select\n\t\t\t\t\t\t\tselectByDefault: #{@options[:select_by_default] ? @options[:select_by_default].to_i : \"null\"},\n\n\t\t\t\t\t\t\t// Reload\n\t\t\t\t\t\t\treloadIcon: '#{@icon_builder.render(@options[:update_icon] ? @options[:update_icon] : \"refresh\")}',\n\t\t\t\t\t\t\treloadLabel: '#{I18n.t(\"general.action.reload\").upcase_first}',\n\t\t\t\t\t\t});\n\t\t\t\t\t\trug_tree_#{@hash}.ready();\n\t\t\t\t\t});\n\t\t\t\t\t$(document).on('turbolinks:load', function() {\n\t\t\t\t\t\trug_tree_#{@hash}.repair();\n\t\t\t\t\t});\n\t\t\t\t})\n\n\t\t\t\tresult += %{\n\t\t\t\t\t<div id=\"tree-#{@hash}\" data-url=\"#{data_path.to_s}\"></div>\n\t\t\t\t}\n\n\t\t\t\treturn result.html_safe\n\t\t\tend", "def transform(tree); end", "def cmd_tree\n print_tree(Editor, 0)\n end", "def children() []; end", "def is_valid_tree(tree)\n\nend", "def tree\n Tree.new(self)\n end", "def nodes_field\n define_nodes_field\n end", "def roots\n acts_as_nested_set_options[:class].find(:all, :conditions => \"(#{acts_as_nested_set_options[:parent_column]} IS NULL OR #{acts_as_nested_set_options[:parent_column]} = 0)\", :order => \"#{acts_as_nested_set_options[:left_column]}\")\n end", "def _parent; end", "def children=(node_or_tags); end", "def children=(node_or_tags); end", "def provides_tree\n @provides_tree ||= provides_tree!\n end", "def link_tree\n ''.html_safe.tap do |content|\n content << toggle_link\n\n unless leaf?\n content << h.content_tag(:ul) do\n h.content_tag_for(:li, children) do |c|\n c.decorate.link_tree\n end\n end\n end\n end\n end", "def valid_tree?\n true\n end", "def valid_tree?\n true\n end", "def render_tag_tree(tree_node=@tree.root)\n string = \" \" * 2 * tree_node.depth\n string += \"<#{tree_node.info.type}\"\n string += \" class=#{tree_node.info.classes}\" unless tree_node.info.classes.nil?\n string += \" id=#{tree_node.info.id}\" unless tree_node.info.id.nil?\n string += \" name=#{tree_node.info.name}\" unless tree_node.info.name.nil?\n string += \">\"\n string += \" #{tree_node.info.text}\"\n puts string\n\n tree_node.children.each do |child|\n render_tag_tree(child)\n end\n end", "def render\n\t\t\ttree.flatten.map(&:to_s).join\n\t\tend", "def valid_tree?\n false\n end", "def test_save_tree\n end", "def get_children\n \t@children\n end", "def child_node=(_); end", "def node\r\n\t\t\tparent\r\n\t\tend", "def ascii_tree; end", "def get_tree_adaptor\n raise NotImplementedError\n end", "def page_tree\n @tree ||= [self.root_page.tree_hash_value]\n @tree\n end", "def site_tree_select\n pages.order(:names_depth_cache).map { |c| [\"--\" * c.depth + c.menu_name, c.id] }\n end", "def my_depth\n 1\n end", "def display_tree() \n list = []\n yield @tree.value\n left_child = @tree.left_child\n right_child = @tree.right_child\n\n list << left_child if left_child != nil\n list << right_child if right_child != nil\n\n loop do\n break if list.empty?\n node = list.shift\n yield node.value\n list << node.left_child if node.left_child != nil\n list << node.right_child if node.right_child != nil\n end\n end", "def print_tree\n ''\n end", "def node_tree\n @node_tree ||= Node.all({:fields => \"title, permalink, parent_id, _id, path, _type\", :published_at => { :$lte => Time.zone.now }, :published_to => { :$gte => Time.zone.now }, :order => 'parent_id ASC, position ASC'}).group_by{|n| n.parent_id.to_s }\n end", "def produce_tree(ary); end", "def children; []; end", "def set_tree\n @tree = Tree.with_attached_images.find(params[:id])\n end", "def location_tree\n #@locations = Location.all\n # puts \"location_tree\"\n @locations = Location.where(ancestry: nil).order(location_type: :desc)\n #@locations = Location.where(id: 1)\n end", "def before_save\n if owner\n self.page = owner.page if page.nil?\n if page?\n self.depth = parent ? ((parent.depth || 0) + 1) : 0\n else\n self.depth = (owner.content_depth || 0) + 1\n end\n end\n super\n end", "def permitted_params\n super() + [:tree_type, :leaf_position, :leaf_structure, :leaf_type]\n end", "def text\n\t\t@tree.text\n\tend", "def default_tree_name\n ''\n end", "def tree(path)\n root.tree(path)\n end", "def set_tree\n\t\t@tree = Tree.find(params[:id])\n\tend", "def initialize\n @use_tree_model = :self\n @default_taxonomy_require_both = true\n end", "def mirror_tree\n mirror_tree_support(self.root)\n display_support(self.root)\n end", "def create_tree_box(model_name,method_name,filter_type,tree_filter_id,order,filter_id)\n \n html = '<span style=\"border:1px solid #E0E0E0;color:#444;position:relative;bottom:4px;font-weight:bold;background:#EEE;padding-top:2px;padding-left:2px;padding-right:2px;padding-bottom:2px;\">'\n \n feature = modelize(model_name).send(method_name,\n tree_filter_id).join\n \n #This method is called from filter_category module, which decorates the raw feature from the DB and makes it html friendly\n html = html + html_features(feature)\n html = html + '</a> <span style=\"position:relative;bottom:1px;\">'\n\n link = self.form_cross_url(filter_type,\n filter_id,\n order,\n @sub_category_flag,\n tree_filter_id)\n\n html = html + link\n\n html = html + '</span>\n </span>'\n\n html + '<span style=\"color:#6E6A6B;size=2;position:relative;bottom:4px;background:#FFFFF;padding-top:2px;padding-left:2px;padding-right:2px;padding-bottom:2px;\"></span>'\n\n end", "def export\n @tree\n end", "def generate_toc_tree(toc, type, attr); end", "def tree\n @roots = @cards.roots\n # TODO: remove jbuilder?\n render :tree, status: :ok\n end", "def each_child\n \n end" ]
[ "0.7223133", "0.6631809", "0.65941113", "0.655836", "0.6461067", "0.6412466", "0.6382891", "0.63780165", "0.6328665", "0.6328665", "0.6318989", "0.6318989", "0.6318989", "0.6318989", "0.6318989", "0.6318989", "0.6318989", "0.6318989", "0.6318989", "0.6318989", "0.6318989", "0.6318989", "0.62720376", "0.61629915", "0.6138801", "0.6129917", "0.6111859", "0.60964954", "0.6086641", "0.6067713", "0.6060501", "0.60593563", "0.60593563", "0.60593563", "0.60593563", "0.60593563", "0.60593563", "0.60593563", "0.60593563", "0.6049656", "0.6046659", "0.6035278", "0.6031776", "0.6031091", "0.6006447", "0.5997757", "0.599653", "0.59806216", "0.59806216", "0.5974781", "0.5972532", "0.59406805", "0.59406805", "0.59406805", "0.59401524", "0.591697", "0.5916049", "0.5912513", "0.58907384", "0.5867484", "0.5863556", "0.5861326", "0.585223", "0.5851885", "0.5851885", "0.584538", "0.583829", "0.5836865", "0.5836865", "0.5828098", "0.582349", "0.580853", "0.580584", "0.5804203", "0.5803372", "0.57984537", "0.5798024", "0.5796903", "0.57918", "0.577469", "0.5771303", "0.576558", "0.57622975", "0.57563347", "0.57526326", "0.5744499", "0.5737058", "0.5720524", "0.5707698", "0.5705407", "0.5693861", "0.5690426", "0.5688115", "0.5687703", "0.5682222", "0.56778175", "0.5670671", "0.5665334", "0.5660211", "0.5659495", "0.563921" ]
0.0
-1
displays a line in the interface
def put_a_line puts "\n" puts "/\\" * 40 puts "\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_line\n print H_SEP * columns\n end", "def display(line, column=0)\n result = \"\\e[s\"\n result << \"\\e[#{line.to_i};#{column.to_i}H\"\n result << to_s\n result << \"\\e[u\"\n result\n end", "def draw_line(index)\n rect = Rect.new(0, 0, 0, 0)\n rect.x += 4\n rect.y += index * WLH\n rect.width = contents.width - 8\n rect.height = WLH\n self.contents.clear_rect(rect)\n self.contents.font.color = normal_color\n self.contents.draw_text(rect, @lines[index])\n end", "def show\n \"\\t#{@line}: #{first_line}\"\n end", "def display\n system 'clear'\n @line_width = 60\n display_header\n display_board\n display_shield_row\n display_legend\n end", "def line\n end", "def line\n end", "def line(*font)\n @io.puts(tag(:hr))\n end", "def display\n grid.each { |line| p line }\n end", "def show_line\n say \"=\" * 25\nend", "def line\n puts \"########################################################\"\nend", "def display(src, line)\n if src.respond_to? :prefix\n @io.print \"#{reset('')}#{src.prefix}#{reset(bg(fg(line)))}\\n\"\n else\n @io.print \"#{reset(bg(fg(line)))}\\n\"\n end\n end", "def render_line(line)\n raise NotImplementedError\n end", "def draw_line(label=nil)\n unless label.nil? then\n bold_print(label) \n puts\n end\n end", "def display(line, column=0) #:yield:\n result = \"\\e[s\"\n result << \"\\e[#{line.to_i};#{column.to_i}H\"\n if block_given?\n result << yield\n result << \"\\e[u\"\n #elsif string\n # result << string\n # result << \"\\e[u\"\n end\n result\n end", "def how_to_render_lines args\n # Render a horizontal line at the bottom\n args.nokia.lines << { x: 0, y: 0, x2: 83, y2: 0 }\n\n # Render a vertical line at the left\n args.nokia.lines << { x: 0, y: 0, x2: 0, y2: 47 }\n\n # Render a diagonal line starting from the bottom left and going to the top right\n args.nokia.lines << { x: 0, y: 0, x2: 83, y2: 47 }\nend", "def line(length)\r\n puts '-'*length\r\n end", "def print_line(line_elements)\n str = \"| \"\n \n line_elements.each_with_index do |element, index|\n if index == 0\n str += element.to_s.ljust(title_width) + \" | \"\n else\n str += element.to_s.rjust(column_width) + \" | \"\n end\n end\n\n puts str\n end", "def draw_commands(line_number)\n rect = line_rect(line_number)\n rect.y += 3; rect.width = (rect.width - 24) / 2\n draw_key_icon(:C, rect.x, rect.y)\n rect.x += 24\n draw_text(rect, Vocab.forge_start)\n rect.x += rect.width\n draw_key_icon(:B, rect.x, rect.y)\n rect.x += 24\n draw_text(rect, Vocab.forge_cancel)\n end", "def receive_line(line)\n Invoker::Logger.puts \"#{@command_label.color(color)} : #{line}\"\n end", "def display(line, column = T.unsafe(nil)); end", "def display(line, column = T.unsafe(nil)); end", "def display(line, column = T.unsafe(nil)); end", "def draw\n print \" | |\\n\" \\\n \"#{board_line(0)}\\n\" \\\n \" | |\\n\" \\\n \"-----+-----+-----\\n\" \\\n \" | |\\n\" \\\n \"#{board_line(1)}\\n\" \\\n \" | |\\n\" \\\n \"-----+-----+-----\\n\" \\\n \" | |\\n\" \\\n \"#{board_line(2)}\\n\" \\\n \" | |\\n\"\n end", "def draw_line; draw_horizontal_line(@draw_y + (line_height / 2) - 1, 2); end", "def print_line(fields)\n output.puts(format_with_color(fields[:color], format_line(fields)))\n end", "def add_line\n @layout.add_widget(HLine.new)\n end", "def display\n\t\tbreakline = \"---- --- ----\"\n\t\tputs breakline.center(@linewidth)\n\t\tputs \"| #{@board[:one]} | #{@board[:two]} | #{@board[:three]} |\".center(@linewidth)\n\t\tputs breakline.center(@linewidth)\n\t\tputs \"| #{@board[:four]} | #{@board[:five]} | #{@board[:six]} |\".center(@linewidth)\n\t\tputs breakline.center(@linewidth)\n\t\tputs \"| #{@board[:seven]} | #{@board[:eight]} | #{@board[:nine]} |\".center(@linewidth)\n\t\tputs breakline.center(@linewidth)\n\t\tputs \"\".center(@linewidth)\n\tend", "def print_line\n @pdf.stroke_horizontal_line @pdf.bounds.left, @pdf.bounds.right\n end", "def display\n if command\n write_green \"\\t#{hname}\"\n command && write_cyan(\"\\t vite-faits #{command}\")\n end\n # TODO Quand on pourra sortir une version HTML, on pourra mettre\n # un lien vers le mode d'emploi.\n # manuel && puts(\"\\t Ancre manuel : ##{manuel}\")\n end", "def line\n\tputs \"-\" * 100\nend", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line(opts = { print: true })\n if color?\n result = ANSI_CODES[:bold] + GLYPHS[:heavy_dash] * 80 + ANSI_CODES[:reset] + \"\\n\"\n else\n result = \"-\" * 80 + \"\\n\"\n end\n print_or_return(result, opts[:print])\n end", "def print_horizontal_line(length)\n print '+'\n (length - 2).times do |index|\n print '-'\n end\n print '+'\n print \"\\n\"\n end", "def h_line\n puts \"-\" * 50\n nil\nend", "def draw_alt_line\n @dim.times do |i|\n if i.even?\n print draw_x\n else\n if @type == \"allx\"\n print draw_x\n elsif @type == \"alt\"\n print draw_dot\n end\n end\n end\n end", "def hline_top\n\tputs \"__________________________________________________________\"\nend", "def line\n\t\t\t@line.set(buffer.line.start, buffer.line.end)\n\t\tend", "def display\n\t\tputs \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n\t\tputs \"-----------\"\n\t\tputs \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n\t\tputs \"-----------\"\n\t\tputs \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n\tend", "def draw_line(number)\n @dim.times do |i|\n if i+1 == number || @dim-i == number\n print draw_x\n else\n print draw_dot\n end\n end\n end", "def display_lines(min, max); end", "def display\n puts \" #{self.cells[0]} | #{self.cells[1]} | #{self.cells[2]} \"\n puts \"-----------\"\n puts \" #{self.cells[3]} | #{self.cells[4]} | #{self.cells[5]} \"\n puts \"-----------\"\n puts \" #{self.cells[6]} | #{self.cells[7]} | #{self.cells[8]} \"\n end", "def output( line )\n puts( line ) \n end", "def ReportLine(line)\n Builtins.y2milestone(\"%1\", line)\n UI.ChangeWidget(Id(:log_view), :LastLine, Ops.add(line, \"\\n\"))\n\n nil\n end", "def display\r\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\r\n puts \"-----------\"\r\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\r\n puts \"-----------\"\r\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\r\n end", "def h_line\n puts \"-\" * 80\n nil\nend", "def opening_lines \n puts \"What would you like to do?\"\n puts \"(C)reate, (L)ist, (U)pdate, (D)elete, (Q)uit\"\n end", "def display_board(board)\n horiz_line = \"-----------\"\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts horiz_line\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts horiz_line\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend", "def display\n stroke(0)\n stroke_weight(1 + weight * 4)\n line(a.xpos, a.ypos, b.xpos, b.ypos)\n \n if (sending)\n fill(0)\n stroke_weight(1)\n ellipse(sender.x, sender.y, 16, 16)\n end\n end", "def add_line(line)\n @tip.string_content += line.slice(@offset, line.length) + '\\n'\n end", "def line\n 1\n end", "def draw_vertical(start_line, end_line, start_char)\n start_line.upto(end_line) do |line_idx| \n @lines[line_idx][start_char] = PATH_CHAR \n end\n end", "def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end", "def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end", "def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end", "def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end", "def draw_line_preview(view)\n plane = [@compass_position, Z_AXIS]\n projected = @input_point.position.project_to_plane(plane)\n\n # Copying visual style from Rotate tool.\n view.set_color_from_line(projected, @compass_position)\n view.line_stipple = \"_\"\n view.draw(GL_LINES, [@compass_position, projected])\n\n view.line_stipple = \"-\"\n view.drawing_color = \"gray\"\n view.draw(GL_LINES, [@input_point.position, projected])\n end", "def drawLine _obj, _args\n \"_obj drawLine _args;\" \n end", "def show()\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs (@@board[7] + '\t|\t' + @@board[8] + '\t|\t' + @@board[9])\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[4] + '\t|\t' + @@board[5] + '\t|\t' + @@board[6])\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[1] + '\t|\t' + @@board[2] + '\t|\t' + @@board[3])\n\t\tputs (' \t|\t' + ' \t|\t')\n\tend", "def show(screen)\n\n screen.set_pos_by_point(Point.zeroPoint)\n\n if @selected\n screen.attron(A_REVERSE)\n else\n screen.attron(A_UNDERLINE)\n end\n\n @menu_items.each do |menu_item|\n screen.addstr( \"#{menu_item} \")\n end\n\n p = screen.cur_point\n\n screen.addstr( ' ' * (screen.width - p.x) )\n\n if @selected\n screen.attroff(A_REVERSE)\n else\n screen.attroff(A_UNDERLINE)\n end\n\n end", "def Line(x1, y1, x2, y2)\n\t\t#Draw a line\n\t\tout(sprintf('%.2f %.2f m %.2f %.2f l S', x1 * @k, (@h - y1) * @k, x2 * @k, (@h - y2) * @k));\n\tend", "def line_choices \n\tputs \"N\"\n\tputs \"L\"\n\tputs \"SIX\"\nend", "def draw_basic_info(x, line, width)\n draw_player_name(x, line)\n draw_player_title(x, line, width)\n end", "def newline\n incr_y\n end", "def draw_text(line, string, even_text = false, width = nil)\n return if line <= 0\n y = 32 * line - 32\n if even_text\n if width != nil\n draw_even_text(0, y, width, 32, string)\n else\n draw_even_text(0, y, @width, 32, string)\n end\n else\n self.contents.draw_text(0, y, @width, 32, string)\n end\n end", "def line(text, length=20)\n puts \"-\" * length\n puts text \nend", "def rl_forced_update_display()\r\n if (@visible_line)\r\n @visible_line.gsub!(/[^\\x00]/,0.chr)\r\n end\r\n rl_on_new_line()\r\n @forced_display=true if !@forced_display\r\n send(@rl_redisplay_function)\r\n 0\r\n end", "def display\n puts \" #{@cells[0]} | #{@cells[1]} | #{@cells[2]} \"\n puts \"-----------\"\n puts \" #{@cells[3]} | #{@cells[4]} | #{@cells[5]} \"\n puts \"-----------\"\n puts \" #{@cells[6]} | #{@cells[7]} | #{@cells[8]} \"\n end", "def display\n puts \" #{@cells[0]} | #{@cells[1]} | #{@cells[2]} \"\n puts \"-----------\"\n puts \" #{@cells[3]} | #{@cells[4]} | #{@cells[5]} \"\n puts \"-----------\"\n puts \" #{@cells[6]} | #{@cells[7]} | #{@cells[8]} \"\n end", "def insert_line\n down\n\n @lines = lines.insert_line(Vedeu::Editor::Line.new, y)\n\n bol\n\n refresh\n end", "def lineListing\n\tputs \"Enter either: N Line, L Line, Six Line\"\nend", "def displayln(out=$stdout)\n out.puts self\n end", "def draw_text_icon(line, string, graphic_name)\n return if line <= 0\n draw_icon(line, graphic_name)\n y = 32 * line - 32\n self.contents.draw_text(35, y, @width, 32, string)\n end", "def d(data)\n data.send :display \n \"\\n\".send :display\nend", "def display\n puts \" #{@cells[0]} \" + \"|\" + \" #{@cells[1]} \" + \"|\" + \" #{@cells[2]} \"\n puts \"-----------\"\n puts \" #{@cells[3]} \" + \"|\" + \" #{@cells[4]} \" + \"|\" + \" #{@cells[5]} \"\n puts \"-----------\"\n puts \" #{@cells[6]} \" + \"|\" + \" #{@cells[7]} \" + \"|\" + \" #{@cells[8]} \"\n end", "def display_row(row, width = HOLE_SIZE, new_line = true, tab = true)\n\t\tprint \"\\t\" if tab\n\t\trow.each do |hole_color| \n\t\t\tprint SEPARATOR[:vertical]\n\t\t\tprint Mastermind::colorize(\" \" * width, \n\t\t\t\t Mastermind::get_color_code(hole_color))\n\t\tend\n\t\tprint SEPARATOR[:vertical]\n\t\tputs if new_line\n\tend", "def display\n\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n\n end", "def draw\n\t\tputs \"\\n\"\n\t\tmid = (@height/2.0).ceil\n\t\tfor line in 1..@height\n\t\t\tspace0 = (mid - (mid-line).abs).abs\n\t\t\tspace1 = (mid - line).abs * 2 - 1\n\t\t\tputs space1 > 0 ?\n\t\t\t\t \" \" * space0 + \"X \" + \" \" * space1 + \"X\" :\n\t\t\t\t \" \" * space0 + \"X\"\n\t\tend\n\tend", "def print_out_line\n\t\t\t#p ['id', id, 'ctd', ctd]\n\t\t\t#p rcp.results.zip(rcp.results.map{|r| send(r)})\n\t\t\tname = @run_name\n\t\t\tname += \" (res: #@restart_id)\" if @restart_id\n\t\t\tname += \" real_id: #@real_id\" if @real_id\n\t\t\tbeginning = sprintf(\"%2d:%d %-60s %1s:%2.1f(%s)\", @id, @job_no, name, @status.to_s[0,1], @run_time.to_f / 60.0, @nprocs.to_s)\n\t\t\tif @status == :Incomplete and @completed_timesteps\n\t\t\t\tbeginning += sprintf(\" %d steps \", @completed_timesteps)\n\t\t\telsif @percent_complete\n \t\t\t\tbeginning+=sprintf(\" %3s%1s \", percent_complete, \"%\")\n\t\t\tend\n\t\t\tif ctd\n\t\t\t\t#beginning += sprintf(\"Q:%f, Pfusion:%f MW, Ti0:%f keV, Te0:%f keV, n0:%f x10^20\", fusionQ, pfus, ti0, te0, ne0)\n\t\t\tend\n\t\t\tbeginning += \" ---#{@comment}\" if @comment\n\t\t\tbeginning\n\t\tend", "def print_a_line(printer, string)\n printer.print_line string\nend", "def line(number); end", "def display \n system(\"clear\") || system(\"cls\")\n\n grid = content.split(\"\\n\")\n print \" \" # make grid line up\n grid.length.times{|num| print \" #{num + 1}\"}\n grid.length.times{|row|\n puts \"\"\n print (65+row).chr + \" \"\n grid[row].length.times{|col|\n print grid[row][col] \n }\n }\n puts \"\"\n end", "def draw_text_indent(line, string, additional=0)\n return if line <= 0\n y = 32 * line - 32\n self.contents.draw_text(35+additional, y, @width, 32, string)\n end", "def line(number)\n end", "def draw_witch(x)\n move_to_top\n @witch.each do |line|\n line_at x, line\n end\n end", "def print_line(msg='')\n end" ]
[ "0.78199375", "0.7149539", "0.7110881", "0.7102358", "0.6939829", "0.6881724", "0.6881724", "0.6881638", "0.68743956", "0.68733776", "0.6867285", "0.6840915", "0.6765167", "0.675029", "0.6726907", "0.67126447", "0.66923314", "0.66904134", "0.66453195", "0.65753573", "0.6555636", "0.6555636", "0.6555636", "0.6543355", "0.65422165", "0.65370965", "0.6514873", "0.6498954", "0.6471063", "0.6464836", "0.64412296", "0.64405084", "0.64405084", "0.64405084", "0.64405084", "0.64405084", "0.64405084", "0.64405084", "0.64405084", "0.64405084", "0.64405084", "0.64405084", "0.64405084", "0.64405084", "0.64405084", "0.64405084", "0.6436355", "0.6422908", "0.6403479", "0.6398297", "0.6398181", "0.6376089", "0.63610995", "0.6347954", "0.6308164", "0.6291659", "0.6290989", "0.6282615", "0.62714654", "0.62648696", "0.6261987", "0.6261043", "0.6234192", "0.6206067", "0.61915594", "0.6172611", "0.61644727", "0.61644727", "0.61644727", "0.61644727", "0.6152204", "0.61447114", "0.6143035", "0.6139399", "0.61212134", "0.6119771", "0.6115541", "0.61141807", "0.6106113", "0.61038464", "0.61022854", "0.60946167", "0.60946167", "0.6082846", "0.6081686", "0.60775506", "0.606921", "0.6068408", "0.60654676", "0.6048364", "0.6041707", "0.6041297", "0.6023366", "0.6019097", "0.60107493", "0.60097337", "0.60029715", "0.6001735", "0.5998722", "0.5997733" ]
0.61903584
65
GET /package_items GET /package_items.json
def index @package_items = @package.package_items end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getItems()\n return mergeWithAPI(@item_json)['data']\n end", "def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend", "def index\n @user_packages = UserPackage.all\n\n render json: @user_packages\n end", "def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end", "def index\n @imei_packages = ImeiPackage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imei_packages }\n end\n end", "def items\n response[\"items\"]\n end", "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "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", "def show\n @package = Package.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @package }\n end\n end", "def get_all_packages_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PackageApi.get_all_packages ...\"\n end\n # resource path\n local_var_path = \"/package/all\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Package>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PackageApi#get_all_packages\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n render json: RequestItem.all\n end", "def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n #@items = Item.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\n end", "def show\n @imei_package = ImeiPackage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imei_package }\n end\n end", "def items\n @items ||= items_from_response\n end", "def get_items\n @items\n end", "def create\n @package = Package.new(package_params)\n add_items\n \n respond_to do |format|\n if @package.save\n \n format.html { redirect_to @package, notice: 'Package was successfully created.' }\n format.json { render action: 'show', status: :created, location: @package }\n else\n format.html { render action: 'new' }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def harvest_products\n product_type = params[:product_type]\n package_type = params[:package_type]\n cultivation_batch_id = params[:cultivation_batch_id]\n\n catalogue = Inventory::Catalogue.find_by(label: product_type, category: 'raw_sales_product')\n cultivation_batch = Cultivation::Batch.find(cultivation_batch_id)\n facility = cultivation_batch.facility\n facility_strain = cultivation_batch.facility_strain\n\n product = Inventory::Product.find_by(\n facility: facility,\n facility_strain: facility_strain,\n catalogue: catalogue,\n package_type: package_type,\n )\n\n packages = Inventory::ItemTransaction.where(\n catalogue: catalogue,\n product: product,\n ).\n order(created_at: :desc)\n\n packages_json = packages.map do |x|\n {\n id: x.id.to_s,\n tag: x.package_tag,\n product_id: x.product.id.to_s,\n product_type: x.catalogue.label,\n package_type: x.product.package_type,\n event_type: x.event_type,\n }\n end\n\n render json: packages_json, status: 200\n end", "def show\n render json: @user_package\n end", "def index\n @lcb_user_package_items = LcbUserPackageItem.all\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @packages = Package.all(:order => :name)\n @aircratf_types = AircraftType.all.collect{|c| [c.name, c.id]}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @packages }\n end\n end", "def list_items( args={} )\n @session.base_url = \"http://my.cl.ly\"\n \n url = \"/items\"\n args.each do |k, v|\n # probably a nicer way to do this\n if url == \"/items\"\n url << \"?#{k.to_s}=#{v.to_s}\"\n else\n url << \"&#{k.to_s}=#{v.to_s}\"\n end\n end\n resp = @session.get( url )\n \n raise AuthorizationError if resp.status == 401\n Crack::JSON.parse(resp.body)\n end", "def fetch\n result = WebApi.json!('ITFItems_440', 'GetPlayerItems', 1, { :SteamID => @steam_id64 })\n\n @items = []\n result[:items][:item].each do |item_data|\n unless item_data.nil?\n item = TF2Item.new(item_data)\n @items[item.backpack_position - 1] = item\n end\n end\n end", "def index\n @order_pack_items = OrderPackItem.all\n end", "def get_items(product_id, params={})\n self.client.get(\"products/#{product_id}/items\", params)\n end", "def new\n @item = Item.new\n # @packages = current_user.packages.where(:custom_key == false)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def getPendingItemInfo\n @output = []\n @items = Item.where(status: \"pending\")\n for item in @items do\n for cart in item.carts do\n @user = User.find(cart.user_id)\n @output << {user: @user, item: item, cart_id: cart.id }\n end\n end\n render :json => @output\n end", "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", "def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @items }\n end\n end", "def packages_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PackagesApi.packages_get ...'\n end\n # resource path\n local_var_path = '/packages'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKey']\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 => 'PackagesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PackagesApi#packages_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @items = Item.find(:all, :order => 'id ASC')\n # @items = Item.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Admin::Item.by_agency(@current_agency.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_items }\n end\n end", "def fetch\n result = WebApi.json!(\"IEconItems_#{app_id}\", 'GetPlayerItems', 1, { :SteamID => @steam_id64 })\n item_class = self.class.send :class_variable_get, :@@item_class\n\n @items = []\n result[:items].each do |item_data|\n unless item_data.nil?\n item = item_class.new(self, item_data)\n @items[item.backpack_position - 1] = item\n end\n end\n end", "def item_all(data_version = nil)\n item_list = get(resource_path('item'), @version, itemListData: 'all', version: data_version)\n RiotGamesApi::LOL::Model::StaticData::ItemList.new item_list\n end", "def show\n @items = cart.items\n @products = @items.collect(&:product)\n \n respond_to do |format|\n format.html { render layout: false } \n format.json { render json: @items }\n end\n end", "def path\n \"/{databaseId}/items/list/\"\n end", "def index\n @items = Item.includes(:user).order(created_at: :desc).all\n render json: @items\n end", "def get_books(response)\n response[\"items\"]\nend", "def itemsUrl(url, repo_name)\n url + '/api/repos/' + repo_name + '/items'\nend", "def create\n @package_item = PackageItem.new(package_item_params)\n @package_item.package = @package\n\n respond_to do |format|\n if @package_item.save\n format.html { redirect_to package_items_path(@package), notice: 'Package item was successfully created.' }\n format.json { render :show, status: :created, location: @package_item }\n else\n format.html { render :new }\n format.json { render json: @package_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @packages = Package.all\n end", "def index\n @packages = Package.all\n end", "def index\n @packages = Package.all\n end", "def index\n @packages = Package.all\n end", "def items(); @items || CrateAPI::Items.new(); end", "def index\n @package = Package.find(params[:package_id])\n @package_details = @package.package_details\n end", "def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @item_groups = ItemGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @item_groups }\n end\n end", "def index\n @items = current_user.items\n respond_to do |format|\n format.html\n format.json { render json: @items }\n end\n end", "def get_items\n response_xml = http_get(@client, \"#{xero_url}/Items\")\n parse_response(response_xml, {}, {:request_signature => 'GET/items'})\n end", "def item\n # Url generated from Js script function => getitem() of _form.html.erb file under Views of different controllers\n @item = Report.where(\"user_id = ?\" , current_user.id).pluck(:item_name )\n # send item_names' in form of json\n render json: @item\n end", "def index\n @pagetitle = \"Packages\"\n @packages = Package.all\n end", "def update\n respond_to do |format|\n add_items\n if @package.update(package_params)\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_package_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PackageApi.get_package ...\"\n end\n # resource path\n local_var_path = \"/package\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n 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 => 'InlineResponse20032')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PackageApi#get_package\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @items = @channel.items\n @items = @query.search(@items)\n @items = @items.order_by_published_at_desc\n @items = @items.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html\n format.json { render json: @items }\n end\n end", "def index\n @items = @deal.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = @project.items.ready\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def index\n @order_items = OrderItem.all\n # render json: @order_item, status: :created\n # render json: @order_item.as_json(include: :item)\n\n end", "def index\n @order_pack_packages = OrderPackPackage.all\n end", "def show\n item = Item.find(params[:id])\n render json: item\n end", "def item\n @items = Item.select {|k,v| k.product_type_id != 4 }\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json { render json: @items, :only => [:id, :name, :description, :price, :time], :include => {:product_type => { :only => [:id, :name]}}}\n end\n end", "def user_items(user_id=self.username, context='pack')\n response = connection.get do |req|\n req.url \"/users/#{user_id}/items\", :context => context\n end\n response.body.items\n end", "def index\n @apiv1_items = Item.all.order(:name)\n end", "def find_all(options = {})\n response = JSON.parse(@client.get('items', options).body)\n items = response.key?('items') ? response['items'] : []\n items.map { |attributes| Promisepay::Item.new(@client, attributes) }\n end", "def getitem\n\n int_parent = params[:parent]\n @items = Item.where(\"manifestation_id = ?\", int_parent).order(\"item_siglum ASC\")\n @items_master = Array.new\n @items.each do |it|\n @holding_institution = HoldingInstitution.find(it.holding_institution_id)\n str_it_string = \"(\" + it.item_siglum + \") \" + @holding_institution.holding_institution_name + \" [\" + it.item_shelfmark + \"]\"\n @it_item = [str_it_string, it.id]\n @items_master.push(@it_item)\n end\n\n\n respond_to do |format|\n format.html { render json: @items_master }\n format.json { render json: @items_master }\n end\n end", "def index\n @packages = Package.order(:name).paginate(page: params[:page], per_page: 10)\n end", "def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end", "def item(uuid)\n http.get \"/items/#{uuid}\"\n end", "def index\n @cart_items = CartItem.all\n\n render json: @cart_items\n end", "def index\n @auth_shopping_cart_items = @auth_shopping_cart_item_class.find_cart_items({:resource => lookup_resource}).page 1\n respond_with @auth_shopping_cart_items\n end", "def update\n respond_to do |format|\n @package_item.package = @package\n if @package_item.update(package_item_params)\n format.html { redirect_to package_items_path(@package), notice: 'Package item was successfully updated.' }\n format.json { render :show, status: :ok, location: @package_item }\n else\n format.html { render :edit }\n format.json { render json: @package_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end", "def items\n @lastresult[\"items\"]\n end", "def show\n render json: Item.find(params[:id])\n end", "def index\n @packages = paginate(Package.all)\n end", "def show\n @item_kit = ItemKit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_kit }\n end\n end", "def items\n product.items\n end", "def items\n @items\n end", "def items\n @items\n end", "def items\n @items\n end", "def items\n @items\n end", "def items_all\n @work_order_items = WorkOrderItem.by_id\n render json: serialized_work_order_items(@work_order_items)\n end", "def index\n @page_name = 'Optional Packages'\n gon.page_name = @page_name\n gon.user_id = current_user.id\n @items = Stripe::SKU.list().data\n end", "def show\n @item_group = ItemGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_group }\n end\n end", "def package_info_command(*args)\n Licensed::Shell.execute(\"go\", \"list\", \"-e\", \"-json\", *Array(args)).strip\n end", "def index\n respond_to do |format|\n format.html\n format.json { render :json => Item.all}\n end\n\n end", "def my\n items = current_user.items\n render json: items\n end", "def item_from_fridge_id\n @items = Item.where(:fridge_id => params[:fridge_id])\n render :json => @items.to_json(:include => :product)\n end", "def show\n render json: @request_item\n end", "def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end", "def set_package_item\n @package_item = PackageItem.find(params[:id])\n end", "def index\n if @project\n @items = @project.items\n else\n @items = Item.all\n end\n end", "def items\n @items ||= data[\"items\"].map { |item| OrderItem.new(item) }\n end", "def index\n @packages = Package.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @packages }\n end\n end", "def show\n render json: @package, \n include: [:sender, :receiver]\n end" ]
[ "0.69879204", "0.6740856", "0.67260444", "0.6663409", "0.66460216", "0.66193235", "0.65737015", "0.6476479", "0.6285331", "0.62748927", "0.62740433", "0.6260324", "0.62476176", "0.62414014", "0.62349945", "0.62125385", "0.6211312", "0.6210025", "0.6205166", "0.6201211", "0.6192218", "0.6192218", "0.6192218", "0.6192218", "0.6185618", "0.6184043", "0.6182007", "0.61746156", "0.61745864", "0.6170239", "0.6157415", "0.61561686", "0.6154742", "0.61385775", "0.61328816", "0.61204237", "0.6105384", "0.6096447", "0.6095543", "0.6088857", "0.6080429", "0.6078186", "0.607034", "0.6064708", "0.6051113", "0.6050678", "0.6050678", "0.6050678", "0.6050678", "0.604896", "0.6035825", "0.6026165", "0.6010853", "0.5989101", "0.5986756", "0.59689015", "0.5957539", "0.59343916", "0.592668", "0.59265715", "0.5926187", "0.5924366", "0.592395", "0.5921105", "0.5913444", "0.59124917", "0.59076923", "0.58850616", "0.58848864", "0.58817756", "0.5879393", "0.5874147", "0.58717126", "0.5868195", "0.58602536", "0.5856119", "0.5847471", "0.58419293", "0.5839461", "0.5823589", "0.58151567", "0.5812618", "0.5809427", "0.5809427", "0.5809427", "0.5809427", "0.58053476", "0.5798242", "0.5797058", "0.5795042", "0.57923156", "0.5792201", "0.5789827", "0.5786922", "0.5786281", "0.5780805", "0.5780784", "0.5778779", "0.5776919", "0.577141" ]
0.75783783
0
GET /package_items/1 GET /package_items/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @package_items = @package.package_items\n end", "def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end", "def show\n @package = Package.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @package }\n end\n end", "def getItems()\n return mergeWithAPI(@item_json)['data']\n end", "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "def index\n @imei_packages = ImeiPackage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imei_packages }\n end\n end", "def index\n @user_packages = UserPackage.all\n\n render json: @user_packages\n end", "def show\n @imei_package = ImeiPackage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imei_package }\n end\n end", "def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end", "def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @package = Package.find(params[:package_id])\n @package_details = @package.package_details\n end", "def new\n @item = Item.new\n # @packages = current_user.packages.where(:custom_key == false)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def create\n @package_item = PackageItem.new(package_item_params)\n @package_item.package = @package\n\n respond_to do |format|\n if @package_item.save\n format.html { redirect_to package_items_path(@package), notice: 'Package item was successfully created.' }\n format.json { render :show, status: :created, location: @package_item }\n else\n format.html { render :new }\n format.json { render json: @package_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @package = Package.new(package_params)\n add_items\n \n respond_to do |format|\n if @package.save\n \n format.html { redirect_to @package, notice: 'Package was successfully created.' }\n format.json { render action: 'show', status: :created, location: @package }\n else\n format.html { render action: 'new' }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_package_item\n @package_item = PackageItem.find(params[:id])\n end", "def index\n render json: RequestItem.all\n end", "def show\n item = Item.find(params[:id])\n render json: item\n end", "def show\n render json: @user_package\n end", "def show\n @package_status = PackageStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @package_status }\n end\n end", "def update\n respond_to do |format|\n @package_item.package = @package\n if @package_item.update(package_item_params)\n format.html { redirect_to package_items_path(@package), notice: 'Package item was successfully updated.' }\n format.json { render :show, status: :ok, location: @package_item }\n else\n format.html { render :edit }\n format.json { render json: @package_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @items = Item.find(:all, :order => 'id ASC')\n # @items = Item.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def update\n respond_to do |format|\n add_items\n if @package.update(package_params)\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n #@items = Item.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\n end", "def index\n @packages = Package.all(:order => :name)\n @aircratf_types = AircraftType.all.collect{|c| [c.name, c.id]}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @packages }\n end\n end", "def show\n render json: Item.find(params[:id])\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @items }\n end\n end", "def index\n @items = Admin::Item.by_agency(@current_agency.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_items }\n end\n end", "def item(uuid)\n http.get \"/items/#{uuid}\"\n end", "def getPendingItemInfo\n @output = []\n @items = Item.where(status: \"pending\")\n for item in @items do\n for cart in item.carts do\n @user = User.find(cart.user_id)\n @output << {user: @user, item: item, cart_id: cart.id }\n end\n end\n render :json => @output\n end", "def show\n @item_group = ItemGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_group }\n end\n end", "def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend", "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", "def fetch\n result = WebApi.json!('ITFItems_440', 'GetPlayerItems', 1, { :SteamID => @steam_id64 })\n\n @items = []\n result[:items][:item].each do |item_data|\n unless item_data.nil?\n item = TF2Item.new(item_data)\n @items[item.backpack_position - 1] = item\n end\n end\n end", "def get_item\n @item = Item.find_by_id(params[:id])\n if @item\n return @item\n else \n render json: {\"message\": {\"type\": \"error\", \"content\": \"The item could not be found!\"}}\n end\n end", "def show\n @package = Package.find(params[:id])\n end", "def item\n # Url generated from Js script function => getitem() of _form.html.erb file under Views of different controllers\n @item = Report.where(\"user_id = ?\" , current_user.id).pluck(:item_name )\n # send item_names' in form of json\n render json: @item\n end", "def path\n \"/{databaseId}/items/list/\"\n end", "def get_package_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PackageApi.get_package ...\"\n end\n # resource path\n local_var_path = \"/package\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n 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 => 'InlineResponse20032')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PackageApi#get_package\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @order_pack_items = OrderPackItem.all\n end", "def items\n response[\"items\"]\n end", "def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @packages = Package.all\n end", "def index\n @packages = Package.all\n end", "def index\n @packages = Package.all\n end", "def index\n @packages = Package.all\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item.to_json() }\n end\n end", "def show\n render json: Item.find(params[\"id\"])\n end", "def show\n @datapackage = Datapackage.find(params[:id])\n render json: DatapackageSerializer.new(@datapackage)\n end", "def index\n @item_groups = ItemGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @item_groups }\n end\n end", "def show\n @feed_item = Item.find(params[:id])\n\n render json: @feed_item\n end", "def itemsUrl(url, repo_name)\n url + '/api/repos/' + repo_name + '/items'\nend", "def show\n @gitem = Gitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gitem }\n end\n end", "def new\n @package = Package.new\n @aircraft_types = AircraftType.by_name.collect{|c| [c.name, c.id]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @package }\n end\n end", "def index\n @apiv1_items = Item.all.order(:name)\n end", "def show\n render json: @request_item\n end", "def show\n @item_kit = ItemKit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_kit }\n end\n end", "def getitem\n\n int_parent = params[:parent]\n @items = Item.where(\"manifestation_id = ?\", int_parent).order(\"item_siglum ASC\")\n @items_master = Array.new\n @items.each do |it|\n @holding_institution = HoldingInstitution.find(it.holding_institution_id)\n str_it_string = \"(\" + it.item_siglum + \") \" + @holding_institution.holding_institution_name + \" [\" + it.item_shelfmark + \"]\"\n @it_item = [str_it_string, it.id]\n @items_master.push(@it_item)\n end\n\n\n respond_to do |format|\n format.html { render json: @items_master }\n format.json { render json: @items_master }\n end\n end", "def show\n @pack = Packages.find( params[ :id ] ) \n end", "def packages_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PackagesApi.packages_get ...'\n end\n # resource path\n local_var_path = '/packages'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKey']\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 => 'PackagesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PackagesApi#packages_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @launch_item = LaunchItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @launch_item }\n end\n end", "def index\n @items = @project.items.ready\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def harvest_products\n product_type = params[:product_type]\n package_type = params[:package_type]\n cultivation_batch_id = params[:cultivation_batch_id]\n\n catalogue = Inventory::Catalogue.find_by(label: product_type, category: 'raw_sales_product')\n cultivation_batch = Cultivation::Batch.find(cultivation_batch_id)\n facility = cultivation_batch.facility\n facility_strain = cultivation_batch.facility_strain\n\n product = Inventory::Product.find_by(\n facility: facility,\n facility_strain: facility_strain,\n catalogue: catalogue,\n package_type: package_type,\n )\n\n packages = Inventory::ItemTransaction.where(\n catalogue: catalogue,\n product: product,\n ).\n order(created_at: :desc)\n\n packages_json = packages.map do |x|\n {\n id: x.id.to_s,\n tag: x.package_tag,\n product_id: x.product.id.to_s,\n product_type: x.catalogue.label,\n package_type: x.product.package_type,\n event_type: x.event_type,\n }\n end\n\n render json: packages_json, status: 200\n end", "def fetch\n result = WebApi.json!(\"IEconItems_#{app_id}\", 'GetPlayerItems', 1, { :SteamID => @steam_id64 })\n item_class = self.class.send :class_variable_get, :@@item_class\n\n @items = []\n result[:items].each do |item_data|\n unless item_data.nil?\n item = item_class.new(self, item_data)\n @items[item.backpack_position - 1] = item\n end\n end\n end", "def get_all_packages_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PackageApi.get_all_packages ...\"\n end\n # resource path\n local_var_path = \"/package/all\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Package>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PackageApi#get_all_packages\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n render json: @item\n end", "def show\n @bundles_items_design = BundlesItemsDesign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bundles_items_design }\n end\n end", "def index\n @items = @deal.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def show\n @items = cart.items\n @products = @items.collect(&:product)\n \n respond_to do |format|\n format.html { render layout: false } \n format.json { render json: @items }\n end\n end", "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", "def index\n @lcb_user_package_items = LcbUserPackageItem.all\n end", "def index\n @items = Item.includes(:user).order(created_at: :desc).all\n render json: @items\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def item\n @items = Item.select {|k,v| k.product_type_id != 4 }\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json { render json: @items, :only => [:id, :name, :description, :price, :time], :include => {:product_type => { :only => [:id, :name]}}}\n end\n end", "def get_items(product_id, params={})\n self.client.get(\"products/#{product_id}/items\", params)\n end", "def new\n @imei_package = ImeiPackage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @imei_package }\n end\n end", "def get(item)\n self.send(\"GET #{item}\")\n\n # Check for errors\n case @retcode\n when 0 then @retmesg # OK\n when 10 then nil # item doesn't exist\n else\n fail(\"Debconf: debconf-communicate returned #{@retcode}: #{@retmesg}\")\n end\n end", "def show\n @item = @deal.items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @itemstable = Itemstable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @itemstable }\n end\n end", "def show\n @basket_item = BasketItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basket_item }\n end\n end" ]
[ "0.7423864", "0.6777559", "0.6663468", "0.66292006", "0.6573611", "0.6560972", "0.6553197", "0.6547148", "0.6434361", "0.63801116", "0.6358627", "0.6346835", "0.6341379", "0.6329583", "0.62335503", "0.62296116", "0.62263924", "0.6204842", "0.6182607", "0.61817986", "0.6150186", "0.6145804", "0.6139013", "0.6139013", "0.6139013", "0.6139013", "0.61365813", "0.6103601", "0.60974747", "0.60831136", "0.60729045", "0.6059519", "0.60575914", "0.6054892", "0.60499567", "0.604991", "0.60456735", "0.6042945", "0.60428584", "0.6034918", "0.6029889", "0.6029538", "0.6027327", "0.60089433", "0.59898263", "0.5978906", "0.5978906", "0.5978906", "0.5978906", "0.59739876", "0.5970617", "0.59705174", "0.59658194", "0.59562546", "0.59526634", "0.59497", "0.5942012", "0.5934798", "0.59332305", "0.5931558", "0.5924754", "0.59189385", "0.5910472", "0.5905113", "0.5899911", "0.5893868", "0.5890231", "0.5887517", "0.58850336", "0.5881837", "0.58813554", "0.5879982", "0.58723885", "0.58698505", "0.5868038", "0.58643275", "0.58643275", "0.58643275", "0.58643275", "0.58643275", "0.58643275", "0.58643275", "0.58643275", "0.58643275", "0.58643275", "0.58643275", "0.58643275", "0.58643275", "0.58643275", "0.58643275", "0.58643275", "0.58643275", "0.58643275", "0.58643275", "0.5858849", "0.5850509", "0.5845593", "0.58444655", "0.5844301", "0.5835901", "0.5835155" ]
0.0
-1
POST /package_items POST /package_items.json
def create @package_item = PackageItem.new(package_item_params) @package_item.package = @package respond_to do |format| if @package_item.save format.html { redirect_to package_items_path(@package), notice: 'Package item was successfully created.' } format.json { render :show, status: :created, location: @package_item } else format.html { render :new } format.json { render json: @package_item.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @package = Package.new(package_params)\n add_items\n \n respond_to do |format|\n if @package.save\n \n format.html { redirect_to @package, notice: 'Package was successfully created.' }\n format.json { render action: 'show', status: :created, location: @package }\n else\n format.html { render action: 'new' }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def package_item_params\n params.require(:package_item).permit(:quantity, :item_id)\n end", "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def add_item_to_project\n @project = Project.find(params[:id])\n @item = Item.find(params[:item_id])\n\n @project.items << @item\n\n render json: @project, include: :items\n end", "def create\n @item = @package.items.new\n # bad code !!\n @item.name = params[:item][:name]\n @item.description = params[:item][:description]\n if params[:type] == \"text\"\n @item.item_type = 1\n @item.text_content = params[:item][:text_content]\n else\n if params[:item][:file].nil?\n flash[:notice] = \"Please select a file first!\"\n redirect_to new_package_item_path\n return\n else\n if params[:type] == \"file\"\n @item.item_type = 2\n else\n @item.item_type = 3\n end\n @item.file = params[:item][:file]\n @item.filename = params[:item][:file].original_filename\n @item.file_content_type = params[:item][:file].content_type\n end\n end\n #______________________\n if @package.custom_key\n @item.aes_key = params[:item][:aes_key]\n else\n @item.aes_key = Base64.decode64(@package.encrypted_key)\n end\n if @item.save\n flash[:notice] = \"Item was created successfuly !\"\n redirect_to package_path(@package)\n else\n #i = 0\n #@item.errors.full_messages.each do |message|\n # flash[\"error#{i}\"] = message\n # i+=1\n #end\n flash[:alert] = \"Item was created failed !\"\n render action: :new\n end\n # respond_with @package\n end", "def writeItem(app, repo_url, item)\n headers = defaultHeaders(app[\"token\"])\n data = item.to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n response\nend", "def create\n @package = Package.create(package_params)\n\n render json: @package\n end", "def create\n @request_item = RequestItem.new(request_item_params)\n @request_item.item = Item.new(name: params[:request_item][:item][:name])\n\n if @request_item.save\n render json: @request_item \n else\n render json: @request_item.errors, status: :bad_request\n end\n end", "def create\n @api_v1_item = Item.new(api_v1_item_params)\n\n if @api_v1_item.save\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end", "def create\n @order_pack_item = OrderPackItem.new(order_pack_item_params)\n\n respond_to do |format|\n if @order_pack_item.save\n format.html { redirect_to @order_pack_item, notice: 'Order pack item was successfully created.' }\n format.json { render :show, status: :created, location: @order_pack_item }\n else\n format.html { render :new }\n format.json { render json: @order_pack_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n 'currency_code' => 'USD',\n 'amount' => 400\n }\n }\n ]\n }\n\n response = Unirest.post CONNECT_HOST + '/v1/' + LOCATION_ID + '/items',\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully created item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item creation failed'\n puts response.body\n return nil\n end\nend", "def create\n # authorize! :manage, @packages , :message => \"Access denied.\"\n @package = @product.packages.new(package_params)\n\n respond_to do |format|\n if @package.save\n format.html { redirect_to [@package.product, @package], notice: 'Package was successfully created.' }\n format.json { render :show, status: :created, location: @package }\n else\n format.html { render :new }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n add_items\n if @package.update(package_params)\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n item = Item.new(item_params)\n item.done = \"0\"\n item.trash = \"0\"\n\n if item.save\n render json: {data:item}, status: :created\n else\n render json: {data:item}, status: :unprocessable_entity\n end\n end", "def create\n @package = Package.new(params[:package])\n\n respond_to do |format|\n if @package.save\n format.html { redirect_to @package, :notice => 'Package was successfully created.' }\n format.json { render :json => @package, :status => :created, :location => @package }\n else\n @aircraft_types = AircraftType.by_name.collect{|c| [c.name, c.id]}\n\n format.html { render :action => \"new\" }\n format.json { render :json => @package.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend", "def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully added.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n item = Item.new(item_params)\n item.user = current_user\n if item.save\n render json: item\n else\n render json: {errors: item.errors}, status: :unprocessable_entity\n end\n end", "def packages_buy_post_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PackagesApi.packages_buy_post ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling PackagesApi.packages_buy_post\"\n end\n # resource path\n local_var_path = '/packages/buy'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['apiKey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PackagePurchaseResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PackagesApi#packages_buy_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @item = Item.new(item_params)\n if @item.save\n @items = Item.all\n render status: 201, :json => @item\n \n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n \n \n end", "def create\n @package = Package.new(package_params)\n\n if @package.save\n render :show, status: :created, location: @package\n else\n render json: @package.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n @package_item.package = @package\n if @package_item.update(package_item_params)\n format.html { redirect_to package_items_path(@package), notice: 'Package item was successfully updated.' }\n format.json { render :show, status: :ok, location: @package_item }\n else\n format.html { render :edit }\n format.json { render json: @package_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lcb_user_package_item = LcbUserPackageItem.new(lcb_user_package_item_params)\n\n respond_to do |format|\n if @lcb_user_package_item.save\n format.html { redirect_to @lcb_user_package_item, notice: 'Lcb user package item was successfully created.' }\n format.json { render :show, status: :created, location: @lcb_user_package_item }\n else\n format.html { render :new }\n format.json { render json: @lcb_user_package_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def updateItem(app, repo_url, item, id)\n headers = defaultHeaders(app[\"token\"])\n data = id.merge(item).to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n response \nend", "def set_package_item\n @package_item = PackageItem.find(params[:id])\n end", "def create\n create_params = item_params\n item = Item.new(\n name: create_params[:name], \n is_complete: false, #create_params[:is_complete], \n list_id: create_params[:list_id])\n\n item.save!\n render json: item\n end", "def create\n @user_package = UserPackage.new(user_package_params)\n\n if @user_package.save\n render json: @user_package, status: :created, location: @user_package\n else\n render json: @user_package.errors, status: :unprocessable_entity\n end\n end", "def create\n # defined object to receive strict item_params including :description, :price, :stockQty ; else return 400\n @item = Item.new(item_params)\n \n if @item.save\n render json: @item.to_json, status: 201\n else\n head 400\n end\n end", "def create\n @item = Item.new(params[:item])\n @item.save\n respond_with @item\n end", "def index\n @package_items = @package.package_items\n end", "def create\n @apiv1_item = Item.new(apiv1_item_params)\n\n respond_to do |format|\n if @apiv1_item.save\n format.html { redirect_to @apiv1_item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @apiv1_item }\n else\n format.html { render :new }\n format.json { render json: @apiv1_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @package = Package.new(package_params)\n\n respond_to do |format|\n if @package.save\n format.html { redirect_to @package, notice: 'Package was successfully created.' }\n format.json { render :show, status: :created, location: @package }\n else\n format.html { render :new }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @package = Package.new(package_params)\n\n respond_to do |format|\n if @package.save\n format.html { redirect_to @package, notice: 'Package was successfully created.' }\n format.json { render :show, status: :created, location: @package }\n else\n format.html { render :new }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = build_item\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'アップロードしたでー' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def package_params\n params.require(:package).permit(:name, :link, :description, :service_id, :user_id)\n end", "def create\n @item = current_owner.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'Item was created successfully' }\n format.json { render :show, status: :created, location: items_path }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @package = ProductPackage.new\r\n render && return unless request.post?\r\n \r\n # POST method\r\n # Create a new package and then redirect to the list.\r\n @package = ProductPackage.create params[:package]\r\n flash[:notice] = \"Package \\\"#{@package.name}\\\" was successfully created!\"\r\n redirect_to :action => \"edit\", :id => @package.id\r\n end", "def _test_launch_process_with_json_launchitem\n\n li = LI_WITH_DEFINITION.to_h.dup\n\n #puts \"===\"\n #p li.to_json\n #puts \"===\"\n\n li['attributes']['food'] = 'tamales'\n\n post(\n '/processes.json',\n li.to_json,\n { 'CONTENT_TYPE' => 'application/json' })\n\n sleep 0.350\n\n puts @response.body\n\n assert_equal 'application/json', @response.headers['Content-type']\n\n fei = json_parse(@response.body)\n assert_equal 'ruote_rest', fei['engine_id']\n\n assert_equal 1, OpenWFE::Extras::ArWorkitem.find(:all).size\n wi = OpenWFE::Extras::ArWorkitem.find(:first)\n\n assert_equal 'tamales', wi.as_owfe_workitem.fields['food']\n end", "def create\n api_service = Api.find_by(status: true).name\n result_hash = RouteCalculator.call(package_params.merge(service: api_service))\n @package = current_user.packages.new(result_hash.merge(package_params))\n \n respond_to do |format|\n if @package.save\n format.html { redirect_to @package, notice: \"Package was successfully created.\" }\n format.json { render :show, status: :created, location: @package }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to root_url, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, item: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #api_key = \"cb8d3966-e1c6-4429-a8cf-b615523481c4\"\n\n @item = Item.new(item_params)\n\n @swift_api_key = SwiftApiKey.first\n\n api_key = @swift_api_key.key\n\n HTTParty.post(\"https://app.getswift.co/api/v2/deliveries\",\n {\n :body => {\n \"apiKey\": api_key,\n \"booking\":{\n \"items\": [{\n \"quantity\": @item.quantity,\n \"sku\": @item.sku,\n \"description\": @item.description,\n \"price\": @item.price\n }],\n \"pickupDetail\": {\n \"name\": \"Marko\",\n \"phone\": \"604 356 8259\",\n \"address\": \"301 Maude Road, Port Moody, V3H5B1\"\n },\n \"dropoffDetail\": {\n \"name\": @item.name,\n \"phone\": @item.phone,\n \"address\": @item.address\n }\n }\n }.to_json,\n :headers => { 'Content-Type' => 'application/json' }\n }\n )\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n if @item.save\n render json: @item\n else\n render json: { error: t('story_create_error') }, status: :unprocessable_entity\n end\n end", "def create\n @order_item = OrderItem.new(order_items_params)\n\n respond_to do |format|\n if @order_item.save\n format.html { redirect_to @order_item, notice: \"Order item was successfully created.\" }\n format.json { render json: @order_item, status: :created, location: @order_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order_item.errors, status: :unprocessable_entry }\n end\n end\n end", "def save_items_data\n @parsed[\"order_items\"].each do |i| \n external_code = i['item']['id']\n item = Item.find_or_create_by(external_code: external_code)\n item.order_id = @order.id\n item.external_code = i['item']['id']\n item.name = i['item']['title']\n item.price = i['unit_price']\n item.quantity = i['quantity']\n item.total = i['full_unit_price']\n @subItems = []\n item.save\n end\n end", "def create\n @package = current_user.packages.new(params[:package].merge(is_verified: false))\n \n respond_to do |format|\n if @package.save\n format.html { redirect_to package_url(@package), notice: 'Package was successfully created.' }\n format.json { render json: @package, status: :created, location: @package }\n else\n format.html { render action: \"new\" }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(attributes)\n response = JSON.parse(@client.post('items', attributes).body)\n Promisepay::Item.new(@client, response['items'])\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to :items, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @slot }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n update_special_attributes\n # vendor_id_write isn't actually used by vnd_load_data_eload but the value\n # 001 is written to the table\n package_params[:vendor_id_write] = '001'\n @package = Package.new(package_params)\n respond_to do |format|\n if @package.save\n format.html { redirect_to @package }\n flash[:success] = 'Package was successfully created.'\n format.json { render :show, status: :created, location: @package }\n else\n format.html { render :new }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sub_package = SubPackage.new(sub_package_params)\n\n respond_to do |format|\n if @sub_package.save\n format.html { redirect_to @sub_package, notice: 'Sub package was successfully created.' }\n format.json { render :show, status: :created, location: @sub_package }\n else\n format.html { render :new }\n format.json { render json: @sub_package.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_multiple_food_items(items)\n items.each do |item|\n item['_id'] = FoodItem.create_id item[:api_key], item[:item_id]\n FoodItem.new_item item\n end\n items\n end", "def package_params\n params.require(:package).permit(:client_id, :origin, :destiantion, :arrival_date, :reciver, :status, :po, :ref, :coment, :pack_nr, :unit_ids, :components_ids)\n end", "def create_item(user_id, data) \n data = data.just(SETTABLE_ITEM_FIELDS)\n data[:user_id] = user_id\n data[:title] ||= 'item'\n data[:price] ||= 5\n data[:price] = data[:price].to_i\n data[:slug] = get_unique_slug($items,:slug,data[:title])\n\n data[:imgs] = data[:imgs].to_a.map {|link| {link: link}}\n data[:videos] = data[:videos].to_a.map {|link| {link: link}}\n data[:status] = :pending\n item = $items.add(data)\nend", "def item_params\n params.require(:item).permit(:name, :price, :date, :user_id, :group_id, :item_type, { tag_ids: [] })\n end", "def create_item_with_http_info(item_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ItemsApi.create_item ...'\n end\n # verify the required parameter 'item_request_body' is set\n if @api_client.config.client_side_validation && item_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'item_request_body' when calling ItemsApi.create_item\"\n end\n # resource path\n local_var_path = '/items'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(item_request_body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'SingleItem'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth', 'oAuth2ClientCredentials']\n\n new_options = opts.merge(\n :operation => :\"ItemsApi.create_item\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ItemsApi#create_item\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @itemtipo = Itemtipo.new(itemtipo_params)\n\n if @itemtipo.save\n render json: @itemtipo, status: :created, location: @itemtipo\n else\n render json: @itemtipo.errors, status: :unprocessable_entity\n end\n end", "def item_params\n params.require(:item).permit(:item, :body)\n end", "def create\n @item = Item.new(params[:item])\n @item.budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to after_save_redirection_path, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n cart_uuid = params[:cart_id]\n @item = Item.new(item_params.merge(cart_uuid: cart_uuid))\n if @item.save\n render json: @item, status: 201\n else\n render_errors 400, @item.errors.full_messages\n end\n end", "def lcb_user_package_item_params\n params.require(:lcb_user_package_item).permit(:name, :type, :content, :user_id, :summary, :begin_time, :end_time, :tips, :used, :used_time, :id, :owner_id, :create_uid, :write_uid, :amount)\n end", "def create\n @item = @project.items.build(item_params)\n @item.user = current_user\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n # @item.build_note\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n respond_with(@items)\n end\n end\n end", "def package_params\n params.require(:package).permit!\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload_packages(packages)\n test_payload.set(:packages, packages)\n end", "def new\n @item = Item.new\n # @packages = current_user.packages.where(:custom_key == false)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def harvest_products\n product_type = params[:product_type]\n package_type = params[:package_type]\n cultivation_batch_id = params[:cultivation_batch_id]\n\n catalogue = Inventory::Catalogue.find_by(label: product_type, category: 'raw_sales_product')\n cultivation_batch = Cultivation::Batch.find(cultivation_batch_id)\n facility = cultivation_batch.facility\n facility_strain = cultivation_batch.facility_strain\n\n product = Inventory::Product.find_by(\n facility: facility,\n facility_strain: facility_strain,\n catalogue: catalogue,\n package_type: package_type,\n )\n\n packages = Inventory::ItemTransaction.where(\n catalogue: catalogue,\n product: product,\n ).\n order(created_at: :desc)\n\n packages_json = packages.map do |x|\n {\n id: x.id.to_s,\n tag: x.package_tag,\n product_id: x.product.id.to_s,\n product_type: x.catalogue.label,\n package_type: x.product.package_type,\n event_type: x.event_type,\n }\n end\n\n render json: packages_json, status: 200\n end", "def create\n @item = Item.new(item_params)\n if @item.save\n render json: ItemSerializer.new(@item)\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end", "def create\n @order_pack_package = OrderPackPackage.new(order_pack_package_params)\n\n respond_to do |format|\n if @order_pack_package.save\n format.html { redirect_to @order_pack_package, notice: 'Order pack package was successfully created.' }\n format.json { render :show, status: :created, location: @order_pack_package }\n else\n format.html { render :new }\n format.json { render json: @order_pack_package.errors, status: :unprocessable_entity }\n end\n end\n end", "def package_request_params\n params.require(:package_request).permit(:user_id, :item_location_id, :item_id, :item_condition, :package_status, :check_in, :loan_date, :due_date)\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/items', notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n @items.to_json\n end", "def item_params\n params.require(:item).permit(:number, :release_date, :name, :batch, :description, :style, :abv, :case_vol, :can_limit, :price, :price_four_pack, :additional, :canning_date, :canning_phrase, :label_inspiration, :instagram_url, :instagram_embed, :instagram_image, :release_date_difference_seconds, :company_id, hop_ids: [])\n end", "def create\n @pagetitle = \"New package\"\n @package = Package.new(params[:package])\n @package[:slug] = @package[:title].to_slug\n\n respond_to do |format|\n if @package.save\n format.html { redirect_to(@package, :notice => 'Package was successfully created.') }\n format.xml { render :xml => @package, :status => :created, :location => @package }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @package.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @group_item = GroupItem.new(group_item_params)\n\n respond_to do |format|\n if @group_item.save\n format.html { redirect_to @group_item, notice: 'Group item was successfully created.' }\n format.json { render :show, status: :created, location: @group_item }\n else\n format.html { render :new }\n format.json { render json: @group_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def addItem(attrs)\n attrs = attrs.merge project_id: project.id\n http.get('addItem', attrs)\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def stock_item_params\n params.require(:stock_item).permit(:title, :item_id, :quantity, :is_package, :package_quantity)\n end", "def create\n @budget = Budget.new(budget_params)\n respond_to do |format|\n if @budget.save\n \n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: @budget.id)\n end\n end\n \n format.html { redirect_to budgets_path, notice: \"Budget was successfully created.\" }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @package = current_user.packages.new\n #@package.package_pois.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @package }\n end\n end", "def create\n @user = User.find(current_user.id)\n @item = @user.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/items', notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n json_response(current_restaurant.restaurant_food_items.create!(food_item_params), :created)\n end", "def processItemsOrder\n @id = params[:itemID]\n @description = params[:description]\n @price = params[:price]\n @award = params[:award]\n @item = Item.find_by(id: @id)\n \n if @item.save\n head 204\n else\n # test\n render json: @item.to_json, status: 400\n # originally\n #head 400\n end\n end", "def new\n @deal = Deal.find(params[:deal_id]) \n\n token_pipedrive = \"api_token=57f839e9a500cf2ef6b9dc8b156bce2c09a0905d\"\n uri_pipedrive_prod = \"http://api.pipedrive.com/v1/deals/#{@deal.pipedrive_id}/products?start=0&#{token_pipedrive}\"\n\n respprod = Net::HTTP.get_response(URI.parse(uri_pipedrive_prod))\n parsedprod = JSON.parse(respprod.body)\n\n parsedprod[\"data\"].each do |registro|\n @item = @deal.items.build\n @item.unique_id = registro[\"id\"]\n @item.pipe_deal_id = registro[\"deal_id\"]\n @item.order_nr = registro[\"order_nr\"]\n @item.product_id = registro[\"product_id\"]\n @item.item_price = registro[\"item_price\"]\n @item.sum = registro[\"sum\"]\n @item.currency = registro[\"currency\"]\n @item.name = registro[\"name\"]\n @item.quantity = registro[\"quantity\"]\n\n uritpprod = \"http://api.pipedrive.com/v1/products/#{registro[\"product_id\"]}?#{token_pipedrive}\"\n resptpprod = Net::HTTP.get_response(URI.parse(uritpprod))\n parsedtpprod = JSON.parse(resptpprod.body)\n \n @item.product_code = parsedtpprod[\"data\"][\"code\"]\n @item.save\n end\n\n redirect_to :action => :index\n\n #respond_to do |format|\n # format.html # new.html.erb\n # format.json { render json: @item }\n #end\n end", "def create\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @release_item = ReleaseItem.new(release_item_params)\n\n respond_to do |format|\n if @release_item.save\n format.html { redirect_to @release_item, notice: 'Release item was successfully created.' }\n format.json { render :show, status: :created, location: @release_item }\n else\n format.html { render :new }\n format.json { render json: @release_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def package_params\n params.require(:package).permit(:title, :price, :course_id, :chapter_id, chapter_ids: [], package_ids: [])\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.74587506", "0.67272186", "0.6511574", "0.64313406", "0.6417907", "0.64163995", "0.63965976", "0.63420194", "0.62634957", "0.6171616", "0.6145754", "0.61152625", "0.60932004", "0.60147357", "0.6002886", "0.5999663", "0.5994116", "0.59864134", "0.5969918", "0.5960131", "0.5958889", "0.59570336", "0.5924262", "0.5915756", "0.59152746", "0.58780366", "0.5865303", "0.58540475", "0.5846972", "0.58389086", "0.58373797", "0.5837028", "0.5837028", "0.58311874", "0.582696", "0.57998145", "0.57881516", "0.5777768", "0.5771891", "0.5766028", "0.5756994", "0.57496524", "0.5742852", "0.5733782", "0.57327753", "0.571769", "0.5717622", "0.57056934", "0.5699128", "0.569211", "0.56876886", "0.5686226", "0.5685032", "0.5675771", "0.56705594", "0.5660103", "0.5656389", "0.56522965", "0.5640995", "0.56281084", "0.562643", "0.56241804", "0.5620112", "0.5620112", "0.5620112", "0.5620112", "0.5620112", "0.5620112", "0.5620112", "0.5619298", "0.56167895", "0.56090313", "0.5607252", "0.56061107", "0.5585295", "0.5578798", "0.5574602", "0.5571019", "0.55679774", "0.55670047", "0.5561849", "0.55597717", "0.5554383", "0.55532485", "0.55466473", "0.554218", "0.5541268", "0.55404633", "0.55384433", "0.553423", "0.5533259", "0.5529541", "0.55275244", "0.5526413", "0.5526413", "0.5526413", "0.5526413", "0.5526413", "0.5526413", "0.5526413" ]
0.7325522
1
PATCH/PUT /package_items/1 PATCH/PUT /package_items/1.json
def update respond_to do |format| @package_item.package = @package if @package_item.update(package_item_params) format.html { redirect_to package_items_path(@package), notice: 'Package item was successfully updated.' } format.json { render :show, status: :ok, location: @package_item } else format.html { render :edit } format.json { render json: @package_item.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n add_items\n if @package.update(package_params)\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n update_special_attributes\n if @package.update(package_params)\n format.html { redirect_to @package }\n flash[:success] = 'Package was successfully updated.'\n format.json { render :show, status: :ok, location: @package }\n else\n format.html { render :edit }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :manage, @packages , :message => \"Access denied.\"\n respond_to do |format|\n if @package.update(package_params)\n format.html { redirect_to [@package.product, @package], notice: 'Package was successfully updated.' }\n format.json { render :show, status: :ok, location: @package }\n else\n format.html { render :edit }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @package = Package.find(params[:id])\n\n respond_to do |format|\n if @package.update_attributes(params[:package])\n format.html { redirect_to @package, :notice => 'Package was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @package.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @package.update(package_params)\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { render :show, status: :ok, location: @package }\n else\n format.html { render :edit }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @package.update(package_params)\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { render :show, status: :ok, location: @package }\n else\n format.html { render :edit }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @package.update(package_params)\n format.html { redirect_to @package, notice: \"Package was successfully updated.\" }\n format.json { render :show, status: :ok, location: @package }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @request.update(package_params)\n format.html { redirect_to @request, notice: 'Package was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end", "def update\n if @package.update(package_params)\n render :show, status: :ok, location: @package\n else\n render json: @package.errors, status: :unprocessable_entity\n end\n end", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update\n if @package.update(package_params)\n render json: @package, \n include: [:sender, :receiver]\n else\n render json: @package.errors, \n status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @sub_package.update(sub_package_params)\n format.html { redirect_to @sub_package, notice: 'Sub package was successfully updated.' }\n format.json { render :show, status: :ok, location: @sub_package }\n else\n format.html { render :edit }\n format.json { render json: @sub_package.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @package_request.update(package_request_params)\n format.html { redirect_to @package_request, notice: 'Package request was successfully updated.' }\n format.json { render :show, status: :ok, location: @package_request }\n else\n format.html { render :edit }\n format.json { render json: @package_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n #update the item of request_item\n if (params[:request_item].present?)\n @request_item.item = params[:request_item][:item].present? ? Item.new(name: params[:request_item][:item][:name]) : @request_item.item\n end\n #update all other parameters\n if @request_item.update(request_item_params)\n render json: @request_item\n else\n render json: @request_item.errors, status: :bad_request\n end\n\n end", "def update\n respond_to do |format|\n if @file_package.update(file_package_params)\n format.html { redirect_to @file_package, notice: 'File package was successfully updated.' }\n format.json { render :show, status: :ok, location: @file_package }\n else\n format.html { render :edit }\n format.json { render json: @file_package.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if package_params[:user_id] == \"\"\n format.html { redirect_to :back, alert: 'Package save failed. No user selected' }\n elsif @package.update(package_params)\n Logging.log_manual_action nil, @package\n format.html { redirect_to packages_path, notice: 'Package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @package = Package.find(params[:id])\n\n respond_to do |format|\n if @package.update_attributes(params[:package])\n format.html { redirect_to(packages_path, :notice => 'Package was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @package.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @imei_package = ImeiPackage.find(params[:id])\n\n respond_to do |format|\n if @imei_package.update_attributes(params[:imei_package])\n format.html { redirect_to @imei_package, notice: 'Imei package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @imei_package.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pagetitle = \"Edit package\"\n @package = Package.find(params[:id])\n @package[:slug] = params[:package][:title].to_slug\n\n respond_to do |format|\n if @package.update_attributes(params[:package])\n format.html { redirect_to(@package, :notice => 'Package was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @package.errors, :status => :unprocessable_entity }\n end\n end\n end", "def updateItem(app, repo_url, item, id)\n headers = defaultHeaders(app[\"token\"])\n data = id.merge(item).to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n response \nend", "def update\n if @item.update(item_params)\n render json: @item, status: :ok\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @lcb_user_package_item.update(lcb_user_package_item_params)\n format.html { redirect_to @lcb_user_package_item, notice: 'Lcb user package item was successfully updated.' }\n format.json { render :show, status: :ok, location: @lcb_user_package_item }\n else\n format.html { render :edit }\n format.json { render json: @lcb_user_package_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_package = UserPackage.find(params[:id])\n\n if @user_package.update(user_package_params)\n head :no_content\n else\n render json: @user_package.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @data_package.update(data_package_params)\n format.html { redirect_to @data_package, notice: 'Data package was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_package }\n else\n format.html { render :edit }\n format.json { render json: @data_package.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order_pack_item.update(order_pack_item_params)\n format.html { redirect_to @order_pack_item, notice: 'Order pack item was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_pack_item }\n else\n format.html { render :edit }\n format.json { render json: @order_pack_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @package = Package.find(params[:id])\n\n respond_to do |format|\n if @package.update_attributes(params[:package])\n flash[:notice] = 'Package was successfully updated.'\n format.html { redirect_to(@package) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @package.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @item.update_attributes(item_params)\n render json: @item, status: :ok\n else\n render_error(@item, :unprocessable_entity)\n end\n end", "def update\n respond_to do |format|\n if @package_description.update(:package_number => managed_params, :package_name=>params[:package_pack_type])\n format.html { redirect_to @package_description, notice: 'Package description was successfully updated.' }\n format.json { render :show, status: :ok, location: @package_description }\n else\n format.html { render :edit }\n format.json { render json: @package_description.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end", "def update\n json_response(@food_item.update!(food_item_params))\n end", "def update\n respond_to do |format|\n if @order_pack_package.update(order_pack_package_params)\n format.html { redirect_to @order_pack_package, notice: 'Order pack package was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_pack_package }\n else\n format.html { render :edit }\n format.json { render json: @order_pack_package.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_for\n update_for_items.collect(&:package)\n end", "def update(args)\n return @client.api_helper.command(args, \"item_update\")\n end", "def update_item(item_id)\n request_body = {\n 'name' => 'Malted Milkshake'\n }\n\n response = Unirest.put CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully updated item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item update failed'\n puts response.body\n return nil\n end\nend", "def update\n @admin_package = Package.find(params[:id])\n\n respond_to do |format|\n if @admin_package.update_attributes(params[:package])\n format.html { redirect_to(admin_package_path(@admin_package), :notice => 'Package was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @admin_package.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_package_item\n @package_item = PackageItem.find(params[:id])\n end", "def update\n respond_to do |format|\n if @package_type.update(package_type_params)\n format.html { redirect_to @package_type, notice: 'Package type was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @package_type }\n else\n format.html { render action: 'edit' }\n format.json { render json: @package_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work_package.update(work_package_params)\n format.html { redirect_to @work_package, notice: 'Work package was successfully updated.' }\n format.json { render :show, status: :ok, location: @work_package }\n else\n format.html { render :edit }\n format.json { render json: @work_package.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apiv1_item.update(apiv1_item_params)\n format.html { redirect_to @apiv1_item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @apiv1_item }\n else\n format.html { render :edit }\n format.json { render json: @apiv1_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n package = Package.find(params[:package_id])\n @package_detail = package.package_details.find(params[:id])\n respond_to do |format|\n if @package_detail.update_attributes(package_detail_params)\n format.html { redirect_to @package_detail, notice: 'Package detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @package_detail }\n else\n format.html { render :edit }\n format.json { render json: @package_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @package_version.update(package_version_params)\n format.html { redirect_to @package_version, success: 'Package version was successfully updated.' }\n format.json { render :show, status: :ok, location: @package_version }\n else\n format.html { render :edit }\n format.json { render json: @package_version.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = @client.items.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n @item.update_attributes(params[:item])\n respond_with @item\n end", "def update\n respond_to do |format|\n if @workpackage.update(workpackage_params)\n format.html { redirect_to @workpackage, notice: 'Workpackage was successfully updated.' }\n format.json { render :show, status: :ok, location: @workpackage }\n else\n format.html { render :edit }\n format.json { render json: @workpackage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @package_status = PackageStatus.find(params[:id])\n\n respond_to do |format|\n if @package_status.update_attributes(params[:package_status])\n format.html { redirect_to @package_status, notice: 'Package status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @package_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @template_package.update_attributes(template_package_params)\n format.html { redirect_to @template_package, notice: @controller_name +t(:message_success_update)}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @template_package.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n Rails.logger.debug params.inspect\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n respond_with(@items)\n end\n end\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n Item.where([\"budget_id = #{params[:id]}\"]).update_all(budget_id: nil)\n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: params[:id])\n end\n end\n format.html { redirect_to budgets_path, notice: \"Budget was successfully updated.\" }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @order_item = OrderItem.find(params[:id])\n\n if @order_item.update(order_item_params)\n head :no_content\n else\n render json: @order_item.errors, status: :unprocessable_entity\n end\n end", "def update\n @packageinfo = Packageinfo.find(params[:id])\n\n respond_to do |format|\n if @packageinfo.update_attributes(params[:packageinfo])\n format.html { redirect_to(@packageinfo, :notice => 'Packageinfo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @packageinfo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @nontrainer_package.update(nontrainer_package_params)\n format.html { redirect_to packages_path, notice: 'Nontrainer package was successfully updated.' }\n format.json { render :show, status: :ok, location: @nontrainer_package }\n else\n format.html { render :edit }\n format.json { render json: @nontrainer_package.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { respond_with_bip(@item) }\n else\n format.html { render action: 'edit' }\n format.json { respond_with_bip(@item) }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to items_path, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to '/items', notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @needed_item.update(needed_item_params)\n format.html { redirect_to @needed_item, notice: 'Needed item was successfully updated.' }\n format.json { render :show, status: :ok, location: @needed_item }\n else\n format.html { render :edit }\n format.json { render json: @needed_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(item_attrs = {})\n body = { update: item_attrs }\n Iterable.request(conf, base_path).patch(body)\n end", "def update\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @manifest_item = ManifestItem.find(params[:id])\n\n respond_to do |format|\n if @manifest_item.update_attributes(params[:manifest_item])\n format.html { redirect_to @manifest_item, notice: 'Manifest item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manifest_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @package_line.update(package_line_params)\n format.html { redirect_to @package_line, notice: 'Package line was successfully updated.' }\n format.json { render :show, status: :ok, location: @package_line }\n else\n format.html { render :edit }\n format.json { render json: @package_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end", "def update\n respond_to do |format|\n if @requirement_item.update(requirement_item_params)\n format.html { redirect_to @requirement_item, notice: 'Requirement item was successfully updated.' }\n format.json { render :show, status: :ok, location: @requirement_item }\n else\n format.html { render :edit }\n format.json { render json: @requirement_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @workpackage.update(workpackage_params)\n format.html { redirect_to @workpackage, notice: 'Workpackage wurde erfolgreich aktualisiert' }\n format.json { render :show, status: :ok, location: @workpackage }\n else\n format.html { render :edit }\n format.json { render json: @workpackage.errors, status: :unprocessable_entity }\n end\n end\n end", "def package_item_params\n params.require(:package_item).permit(:quantity, :item_id)\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.763633", "0.71005774", "0.69696784", "0.69677657", "0.68880594", "0.68880594", "0.6871805", "0.68466717", "0.68453074", "0.6810982", "0.6737805", "0.6709259", "0.6669252", "0.6657448", "0.66215914", "0.6610505", "0.65669423", "0.6542501", "0.65394735", "0.65220934", "0.6510203", "0.64515275", "0.64510864", "0.6448982", "0.64345455", "0.64174646", "0.6414903", "0.6414004", "0.6399589", "0.6388116", "0.6388116", "0.6381916", "0.6371082", "0.6366354", "0.63499385", "0.63392115", "0.6311689", "0.63096017", "0.6309198", "0.6306324", "0.6296274", "0.6283026", "0.6262207", "0.62609255", "0.6253582", "0.6248765", "0.6202145", "0.6194174", "0.6140975", "0.61330795", "0.61265165", "0.61257917", "0.61184126", "0.61014503", "0.60977876", "0.6088599", "0.6085697", "0.6085294", "0.60831344", "0.60770005", "0.60576344", "0.6046901", "0.60312784", "0.60245633", "0.60245633", "0.60245633", "0.60245633", "0.60245633", "0.60245633", "0.60245633", "0.60245633", "0.60245633", "0.6021154", "0.6021154", "0.6021154", "0.6021154", "0.6021154", "0.6021154", "0.6021154", "0.6021154", "0.6021154", "0.6021154", "0.6021154", "0.6021154", "0.6021154", "0.6019327", "0.60097253", "0.6007045", "0.6000485", "0.5999799", "0.5999799", "0.5999799", "0.5999799", "0.5999799", "0.5999799", "0.5999799", "0.5999799", "0.5999799", "0.5999799", "0.5999799" ]
0.75248927
1
DELETE /package_items/1 DELETE /package_items/1.json
def destroy @package_item.destroy respond_to do |format| format.html { redirect_to package_items_url, notice: 'Package item was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @package.status = nil\n @package.save!\n respond_to do |format|\n format.html { redirect_to packages_url }\n format.json { head :no_content }\n end\n end", "def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body\n return nil\n end\nend", "def destroy\n @package = Package.find(params[:id])\n @package.destroy\n\n respond_to do |format|\n format.html { redirect_to packages_url }\n format.json { head :ok }\n end\n end", "def delete(items)\n item_ids = items.collect { |item| item.id }\n args = {ids: item_ids.to_json}\n return @client.api_helper.command(args, \"item_delete\")\n end", "def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @package.destroy\n respond_to do |format|\n format.html { redirect_to @package, notice: 'Package was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @apiv1_item.destroy\n respond_to do |format|\n format.html { redirect_to apiv1_items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @manifest_item = ManifestItem.find(params[:id])\n @manifest_item.destroy\n\n respond_to do |format|\n format.html { redirect_to manifest_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :manage, @packages , :message => \"Access denied.\"\n @package.destroy\n respond_to do |format|\n format.html { redirect_to product_packages_url, notice: 'Package was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @imei_package = ImeiPackage.find(params[:id])\n @imei_package.destroy\n\n respond_to do |format|\n format.html { redirect_to imei_packages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lcb_user_package_item.destroy\n respond_to do |format|\n format.html { redirect_to lcb_user_package_items_url, notice: 'Lcb user package item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @package.destroy\n respond_to do |format|\n format.html { redirect_to packages_url, notice: 'Package was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @package.destroy\n respond_to do |format|\n format.html { redirect_to packages_url, notice: 'Package was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n render status: 200, json: @request_item.destroy\n end", "def destroy\n @package.destroy\n respond_to do |format|\n format.html { redirect_to packages_url, notice: \"Package was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @sub_package.destroy\n respond_to do |format|\n format.html { redirect_to sub_packages_url, notice: 'Sub package was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = @client.items.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully removed from Inventory.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @file_package.destroy\n respond_to do |format|\n format.html { redirect_to file_packages_url, notice: 'File package was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gitem = Gitem.find(params[:id])\n @gitem.destroy\n\n respond_to do |format|\n format.html { redirect_to gitems_url }\n format.json { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n end\n end", "def destroy\n @item = item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = @project.items.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_items_path(@project, :subdomain => @user.subdomain)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(params[:budget_id]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order_item.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end", "def destroy\n @package_type.destroy\n respond_to do |format|\n format.html { redirect_to package_types_url }\n format.json { head :no_content }\n end\n end", "def delete_item(item)\n @get_items.delete(item)\n end", "def destroy\n @item_kit = ItemKit.find(params[:id])\n @item_kit.destroy\n\n respond_to do |format|\n format.html { redirect_to item_kits_url }\n format.json { head :ok }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to '/items', notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @order_pack_item.destroy\n respond_to do |format|\n format.html { redirect_to order_pack_items_url, notice: 'Order pack item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to packages_url, notice: 'Package was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @package = Package.find(params[:id])\n @package.destroy\n\n respond_to do |format|\n format.html { redirect_to(packages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @package = Package.find(params[:id])\n @package.destroy\n\n respond_to do |format|\n format.html { redirect_to(packages_url) }\n format.xml { head :ok }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def destroy\n @package_request.destroy\n respond_to do |format|\n format.html { redirect_to package_requests_url, notice: 'Package request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @launch_item = LaunchItem.find(params[:id])\n @launch_item.destroy\n\n respond_to do |format|\n format.html { redirect_to launch_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n# @item = Item.get(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to({action: :index}, notice: 'Item was successfully deleted.') }\n format.json { head :ok }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @command_item = CommandItem.find(params[:id])\n @command_item.destroy\n\n respond_to do |format|\n format.html { redirect_to command_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n package = Package.find(params[:package_id])\n @package_detail = package.package_details.find(params[:id])\n @package_detail.destroy\n respond_to do |format|\n format.html { redirect_to packages_path, notice: 'Package detail was successfully destroyed.' }\n #format.json { head :no_content }\n end\n end", "def deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end", "def destroy\n @package_status = PackageStatus.find(params[:id])\n @package_status.destroy\n\n respond_to do |format|\n format.html { redirect_to package_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_item = Admin::Item.find(params[:id])\n @admin_item.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_item = Admin::Item.find(params[:id])\n @admin_item.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_items_url }\n format.json { head :no_content }\n end\n end", "def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = @user.items.find(params[:id])\n @item.destroy\n\n\n respond_to do |format|\n format.html { redirect_to user_items_path(@user) }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n head :no_content\n end", "def destroy\n item = @item.name\n @item.deleted = true\n @item.deleted_at = Time.now\n @item.save\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"#{item} was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\tif Rails.env.production?\n\t\t\tRestClient.patch(\"https://lensshift-drive.firebaseio.com/resources_deleted/#{@resource_item.google_doc_id}.json\", @resource_item.to_json)\n\t\t\tRestClient.delete(\"https://lensshift-drive.firebaseio.com/resources/#{@resource_item.google_doc_id}.json\")\n\t\tend\n\t\t@resource_item.destroy\n\t respond_to do |format|\n\t format.html { redirect_to fellow_resource_items_url, notice: 'Resource item was successfully destroyed.' }\n\t format.json { head :no_content }\n\t end\n\tend", "def destroy\n @data_package.destroy\n respond_to do |format|\n format.html { redirect_to data_packages_url, notice: 'Data package was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @itemstable = Itemstable.find(params[:id])\n @itemstable.destroy\n\n respond_to do |format|\n format.html { redirect_to itemstables_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @basket_item = BasketItem.find(params[:id])\n @basket_item.destroy\n\n respond_to do |format|\n format.html { redirect_to basket_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @admin_package = Package.find(params[:id])\n @admin_package.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_packages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @package_version.destroy\n respond_to do |format|\n format.html { redirect_to package_versions_url, success: 'Package version was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bundles_items_design = BundlesItemsDesign.find(params[:id])\n @bundles_items_design.destroy\n\n respond_to do |format|\n format.html { redirect_to bundles_items_designs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n manifestation = @item.manifestation\n @item.destroy\n\n respond_to do |format|\n flash[:notice] = t('controller.successfully_deleted', model: t('activerecord.models.item'))\n if @item.manifestation\n format.html { redirect_to items_url(manifestation_id: manifestation.id) }\n format.json { head :no_content }\n else\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @package.destroy\n Logunit.where(:package_id => @package.id).destroy_all\n Logcomponent.where(:package_id => @package.id).destroy_all\n respond_to do |format|\n format.html { redirect_to packages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: '削除に成功しました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def item_destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to item_index_path, notice: 'O item foi removido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to channel_items_url }\n format.json { head :no_content }\n end\n end", "def delete(package)\n wait_until(\"Deleting package\") do\n get \"/invoke/wm.server.packages/packageDelete?package=#{CGI.escape package.to_s}\"\n end\n end", "def delete\r\n \tProductPackageNode.delete params[:node_ids]\r\n render :nothing => true\r\n end", "def destroy\n @content_item = ContentItem.find(params[:id])\n @content_item.destroy\n\n respond_to do |format|\n format.html { redirect_to content_items_url }\n format.json { head :ok }\n end\n end", "def delete_item\n item_id = params[\"item_id\"]\n\n item = TextItem.find_by_id(item_id)\n item = Image.find_by_id(item_id) if item.nil?\n item = Collection.find_by_id(item_id) if item.nil?\n render_json :status => :not_found, :messages => \"Could not find the item with id #{item_id}.\" and return if item.nil?\n\n if item.class == Collection\n if params[\"id\"].nil?\n render_json :status => :bad_request, :messages => \"Can't delete a collection reference without providing the parent collection id. Please use the longer url for item deletion.\" and return\n end\n collection = Collection.find_by_id(params[\"id\"])\n else\n collection = Ownership.find_by_item_id(item_id).parent\n end\n;\n render_json :status => :not_found, :messages => \"Could not find parent collection for the item.\" and return if (collection.nil?)\n render_json :status => :forbidden, :messages => \"The user is not allowed to delete from this collection.\" and return if (!collection.delete?(@user, @client))\n\n collection.delete_item(item_id)\n render_json :entry => {} and return\n end" ]
[ "0.702064", "0.7003068", "0.6868799", "0.68579763", "0.68499976", "0.6816435", "0.6815266", "0.6762219", "0.67428964", "0.6724987", "0.671537", "0.6713069", "0.6700218", "0.6673716", "0.6673716", "0.66717136", "0.66713274", "0.66446", "0.6625679", "0.6603149", "0.6585948", "0.6579629", "0.6579502", "0.6568561", "0.655692", "0.6553956", "0.6553818", "0.6550596", "0.6548383", "0.6548176", "0.6548176", "0.6548176", "0.6548176", "0.6548176", "0.6548176", "0.6548176", "0.6548176", "0.6548176", "0.6548176", "0.6548176", "0.6548176", "0.6548176", "0.6548176", "0.6548176", "0.651426", "0.6513639", "0.65104944", "0.650921", "0.65046513", "0.6502542", "0.6494512", "0.64913654", "0.64913267", "0.64913267", "0.6478841", "0.64770156", "0.64770156", "0.64770156", "0.64770156", "0.64770156", "0.64770156", "0.64770156", "0.64770156", "0.64770156", "0.64770156", "0.6473137", "0.6473092", "0.6465956", "0.64560306", "0.6450495", "0.6447644", "0.6444532", "0.6438582", "0.6435087", "0.6416874", "0.6394828", "0.6394828", "0.6393748", "0.63913536", "0.63761663", "0.6371301", "0.637051", "0.63656974", "0.6362664", "0.63520885", "0.6346737", "0.6339348", "0.63330275", "0.6332804", "0.6332198", "0.633156", "0.63313055", "0.63218546", "0.63216686", "0.6320057", "0.631694", "0.63155353", "0.6308085", "0.6301523", "0.63013375" ]
0.73143905
0
Use callbacks to share common setup or constraints between actions.
def set_package_item @package_item = PackageItem.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def package_item_params params.require(:package_item).permit(:quantity, :item_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
def active_audits self.audits.where("end_date <= ?", Date.today) end
def active_audits_with_skipped self.audits.where("end_date >= ?", Date.today) - SkippedAuditReminder.audits end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upcoming_events\n attended_events.where('date >= :current_date AND accepted',\n current_date: DateTime.now)\n end", "def active_events_count\n self.events.where(\"end_day >= ?\", Date.today).where(:deleted => false).count\nend", "def active_exchanges\n self.participations.where([':todays_date > match_date \n AND :todays_date < exchange_date', \n :todays_date => Date.today])\n end", "def active?(date=Time.now)\n date < self.end_date && date > self.start_date\n end", "def expired_ads\n self.ads.where(\"expire_date < ?\", Date.today)\n end", "def index\n @audits_not_started = current_user.audits.where('start_date > ?',Time.now) \n @audits= current_user.audits.paginate(:page => params[:page], :per_page => 3).order('id DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audits }\n end\n\n end", "def active?\n self.inactive_date && Time.now < self.inactive_date\n end", "def get_active_autopays\n todays_end_time = Time.utc(Time.now.year, Time.now.month, Time.now.day + 1).to_i\n return AutoPay.find(:all, :conditions => [\"property_id = ? AND (end_pay > ? OR end_pay = 0)\", self.id, todays_end_time])\n end", "def active_recordings\n self.recordings.where(active: true)\n end", "def active_recordings\n self.recordings.where(active: true)\n end", "def active?\n (start_date <= DateTime.now) and (DateTime.now <= end_date)\n end", "def active\n today = Date.today\n before = (start_date <=> today) == 1\n after = (today <=> end_date) == 1\n\n outside_range = (before or after)\n no_dates = (start_date.nil? and end_date.nil?)\n\n (!outside_range or no_dates)\n end", "def report\n @audits = Audit.all\n end", "def get_active_workouts_for_day(date)\n self.workouts.where(\"? = start_date OR (? BETWEEN workouts.start_date AND workouts.end_date)\", date, date)\n end", "def today_booked_articles\n booked_articles.where(\"bookings.start_date <= :date AND bookings.end_date >= :date\", date: Date.today)\n end", "def ends_today\n all.select {|event| event.ends == (@date_for_test || Date.today)}\n end", "def current_deals\n if params[:start_time] && params[:end_time]\n @deals = Deals.find(:all, :conditions => {:dateTime.now => start_date..end_date})\n end\n end", "def current_courses\n\t\treturn self.courses.where([\"end_date > ?\", DateTime.now-2.weeks])\n\tend", "def upcoming_events\n events.where(\"date > ?\", Time.now)\n end", "def past_events\n events.where(\"date < ?\", Time.now)\n end", "def audits\n Audit::Tracking.log.audits(audit_bucket, self.id)\n end", "def is_active\n\t\tself.active and self.start_date <= Date.today and self.end_date >= Date.today\n\tend", "def load_completed_events\r\n @completed_events = Event.find(:all, \r\n :conditions => [\"user_id = \"\\\r\n \"#{session[:user_id]} and ends < CURRENT_DATE()\"] ,\r\n :order => 'begins ASC')\r\n end", "def timeline( end_time=Time.now )\n Encounter.where('user_id = (?)',self.id).where('created_at <= (?)', end_time)\n end", "def active_seps(day = Date.today)\n special_enrollment_periods.find_all { |sep| (sep.start_date..sep.end_date).include?(day) }\n end", "def get_meets\n Meet.where(\"date > ?\", Date.today - 1.year)\n end", "def find_all &filter\n result_set = self.driver.activities.find_all { |activity| activity.start_date >= @start_date && activity.start_date <= @end_date }\n\n if filter\n return result_set.find_all &filter \n end\n\n result_set\n end", "def filtered_accumulator_bets\n filter_accumulator_bets = AccumulatorBet.played\n if start_date.present?\n filter_accumulator_bets = filter_accumulator_bets.where('accumulator_bets.created_at > ?', start_date)\n end\n filter_accumulator_bets\n end", "def active_interviews\n self.interviews.where(:status=>1).order(\"date\")\nend", "def soon\n @visits = Visit.where(\"visitDate <= ? and aprovalDate is null\", Date.today + 90.day)\n end", "def on_sale\n all.select {|event| (event.starts..event.ends) === (@date_for_test || Date.today)}\n end", "def check_active_subscription_status\n subscriptions = Subscription.where(status: :active)\n subscriptions.each do |subscribe|\n if DateTime.now >= subscribe.end_at\n subscribe.update(status: :expired)\n end\n end\n end", "def active?\n reports.order(id: :desc).limit(6).sum(:hours) > 0\n end", "def active?\n today = Time.now.strftime('%Y-%m-%d %H:%M')\n today >= self.begin_date.strftime('%Y-%m-%d 06:00') && today <= self.end_date.strftime('%Y-%m-%d 23:59')\nend", "def previous_events\n attended_events.where('date < :current_date AND accepted',\n current_date: DateTime.now)\n end", "def get_inactive_periods\n @periods = current_user.periods.where(is_active: false).order(created_at: :desc)\n render json: @periods\n end", "def own_and_associated_audits\n Audited.audit_class.unscoped.where(auditable: self)\n .or(Audited.audit_class.unscoped.where(associated: self))\n .order(created_at: :desc)\n end", "def is_expired?\n self.end_date < DateTime.now\n end", "def index\n @audits = Audit.all\n end", "def index\n @audits = Audit.all\n end", "def get_all_attended_events\n events_id = Attendance.where(:user_id => self).map{ |attendence| attendence.event.id}\n Event.where(:id => events_id).where_first_meeting_starts_in_past\n end", "def active?\n start_date <= Date.today and finish_date >= Date.today\n end", "def events\n # FIXME this logic belongs in the Event model. stop leaking AR outside of the model\n @events ||= Event.includes(:upcoming_observances).where(\"observances.start_on >= ?\", Date.current).references(:observances)\n end", "def index\n @user_audits = UserAudit.all\n end", "def index\n \n @current_productions = Production.where(\"ticket_start_date <= ? and ticket_end_date >= ?\", Date.today, Date.today).order('ticket_start_date ASC')\n @past_productions = Production.where(\"ticket_start_date < ? and ticket_end_date < ?\", Date.today, Date.today).order('ticket_start_date ASC')\n @upcoming_productions = Production.where(\"ticket_start_date > ? and ticket_end_date > ?\", Date.today, Date.today).order('ticket_start_date ASC')\n \n end", "def index\n # @products = Product.all\n @products = Product.as(:p).where(\"p.expired_at > #{Date.today.strftime('%s')}\")\n end", "def past_courses\n\t\treturn self.courses.where([\"end_date < ?\", DateTime.now - 2.weeks])\n\tend", "def active_ads_count\n self.ads.where(\"expire_date >= ?\", Date.today).where(:is_deleted => false, :is_active => true).count\nend", "def audited?\n @audited\n end", "def active_dependents\n monitoring_days_ago = ADMIN_OPTIONS['monitoring_period_days'].days.ago.beginning_of_day\n dependents.where(purged: false, monitoring: true)\n .where('isolation = ? OR continuous_exposure = ? OR last_date_of_exposure >= ? OR (last_date_of_exposure IS NULL AND created_at >= ?)',\n true, true, monitoring_days_ago, monitoring_days_ago)\n end", "def load_completed_private_events\r\n email = User.find(session[:user_id]).email\r\n @completed_events = PrivateEvent.find_by_sql(\"select * from private_events as pe where pe.id in (select distinct pe.id from private_events as pe left join private_invites as pi on pe.id = pi.private_event_id where ((pi.email = '#{email}') or (pe.user_id = '#{session[:user_id]}')) and ((begins < CURRENT_DATE() and ends < CURRENT_DATE())))\") \r\n end", "def subscriptions_in_period(period_start, period_end, is_a_day = nil)\n period_start = period_start.to_s(:db) if period_start.class == Time or period_start.class == Date\n period_end = period_end.to_s(:db) if period_end.class == Time or period_end.class == Date\n if is_a_day.to_s != 'invoices'\n day_sql = !is_a_day.to_s.blank? ? \" AND services.periodtype = 'day' \" : \" AND services.periodtype != 'day' \"\n else\n day_sql = ''\n end\n subs = Subscription.where([\"(? BETWEEN activation_start AND activation_end OR ? BETWEEN activation_start AND activation_end OR (activation_start > ? AND activation_end < ?)) AND subscriptions.user_id = ? #{day_sql}\", period_start, period_end, period_start, period_end, self.id]).includes(:service).all\n subs\n end", "def audits criteria = {}\n $mongo[\"audits.#{self.class.name}\"].\n find(criteria.merge target: id).sort [[:at, -1]]\n end", "def index\n @exemptions = Exemption.where(\"exempt_day > ?\", Date.today)\n end", "def due\n @invoices = @account_invoices.where(invoices: { due_on_date: @start_date...@end_date })\n end", "def get_eligible\n #older than 1 day, not older than X date (whenever they get these cards).\nend", "def applicable_audit\n user.versions.where(\"created_at <= ?\", date.end_of_day).reorder(created_at: :desc).limit(1).first\n end", "def current_assignment\n self.assignments.where(:end_date => nil).first \nend", "def active_prices\n prices.where('active = 1')\n end", "def active?(user)\n user.current_date == start_date && (end_date.nil? || user.current_date <= end_date) && not(complete?(user))\n end", "def has_ended?\n Date.current > end_date\n end", "def in_hot_list\n where(:added_to_hot_list.gte => 4.days.ago.utc)\n end", "def unpaid_backlogs\n self.backlog_payments.where(:is_cleared => false )\n end", "def index\n if params[\"start_date\"].nil? || params[\"start_date\"].empty? \n @start_date = current_user.created_at\n else\n @start_date = params[\"start_date\"].to_date \n end\n if params[\"end_date\"].nil? || params[\"end_date\"].empty?\n @end_date = Time.now.to_date.end_of_day\n else\n @end_date = params[\"end_date\"].to_date.end_of_day \n end\n \n @hotel_expenditures = current_user.hotel_expenditures.where(:created_at=>@start_date..@end_date).paginate(:page => params[:page], :per_page => 13)\n end", "def index\n @invoices = @account_invoices.where(invoices: { created_at: @start_date...@end_date })\n end", "def index\n @user = current_user\n @meetings = @user.meetings.all.where('date >= ?', Date.today).order('date ASC')\n @old_meetings = @user.meetings.all.where('date <= ?', Date.today).order('date ASC')\n end", "def index\n from = DateTime.now - 7.days\n @wallet_histories = WalletHistory.where(\"? <= trade_time\",from).order(\"trade_time desc\")\n end", "def past\n @bookings = Booking.completed(current_user)\n end", "def my_absences\n @absences = AttendanceRecord.get_absences(current_user)\n end", "def all_offdays\n offdays = []\n self.courts.includes(:day_offs).each do |c|\n offdays = offdays + c.day_offs\n end\n offdays = offdays + self.day_offs\n end", "def load_events\r\n @events = Event.find(:all, \r\n :conditions => [\"user_id = \"\\\r\n \"#{session[:user_id]} and (begins >= CURRENT_DATE()\"\\\r\n \"or ends >= CURRENT_DATE())\"] ,\r\n :order => 'begins ASC')\r\n end", "def current_alerts\n Alert.all_raised.select do |alert|\n my_last_update = AlertChanged.first(:person => username, :alert_id => alert.id)\n my_last_update && my_last_update.update_type != \"cleared\"\n end\n end", "def timeline( end_time=Time.now )\n Encounter.where('id in (?)',self.rounds.pluck(:encounter_id))\n end", "def index\n\n @attendences = Attendence.where(datee: Date.today)\n @attendence = Attendence.new\n\n end", "def calculate_dates\n self.inactive_date = Time.now + 2.months\n self.delete_date = Time.now + 4.months\n end", "def latest_interviews\n self.interviews.order(\"DATE DESC\").where(:status=>1)\n end", "def active?\n self.expires_on > Date.today\n end", "def past_calendar_events\n self.calendar_events.joins(:event).where(\"DATEDIFF(`start_time`,?) < 0\", Time.now.beginning_of_day)\n end", "def my_logs\n ActivityLog.all.select {|log| log.user == self}\n end", "def my_logs\n ActivityLog.all.select {|log| log.user == self}\n end", "def dead\n Patient.where(is_alive: false)\nend", "def events_in_period(start, finish = start.end_of_day)\n event_class = ModelFabric.get_class(SocialFramework.event_class)\n events = event_class.joins(:participant_events).where(\n \"social_framework_participant_events.schedule_id = ? AND \" +\n \"social_framework_participant_events.confirmed = ? AND \" + \n \"social_framework_events.start < ? AND \" +\n \"social_framework_events.finish > ?\", self.id, true, finish, start).order(start: :asc)\n\n return events\n end", "def past?\n (end_date < Date.today)\n end", "def active_between\n if self.active\n # If active, end date is now and start date is recent :resume or :initial\n end_date = Time.zone.now\n start_date = standing_events.where.any_of({type: :initial}, {type: :resume}).where(parent_id: nil).order(:created_at).last.created_at\n return start_date, end_date\n else\n # If inactive, end date is recent :retire and start date is prior :resume or :initial\n end_date = standing_events.where(type: :retire).order(:created_at).last.created_at\n start_date = standing_events.where(\"#{StandingEvent.table_name}.created-at < ?\", end_date).any_of({type: :initial}, {type: :resume}).where(parent_id: nil).order(:created_at).last.created_at\n return start_date, end_date\n end\n end", "def activities_in_date_range(from_date, to_date)\n from_date = format_date from_date\n to_date = format_date to_date\n\n @dealing_platform.gather \"history/activity/#{from_date}/#{to_date}\", :activities, AccountActivity\n end", "def overdue\n schedules.where(:when.lte => Time.now)\n end", "def events\n event.user.events.where(:timestamp => beginning...ending)\n end", "def get_current_events\n events = get_events\n current_events = []\n \n events.each do |event| \n if event.date > DateTime.now and event.date < DateTime.now + 2.months\n current_events << event\n end\n end\n \n return current_events\n end", "def setInactive\n self.update_attribute(:end_active_at, DateTime.now - 1.minute)\n end", "def upcoming_calendar_events\n self.calendar_events.joins(:event).where(\"DATEDIFF(`start_time`,?) >= 0\", Time.now.beginning_of_day)\n end", "def soon range=4.days\n schedules.where(:when.lte => range.from_now)\n end", "def attendance_between_dates_condition\n\t\t\"attendances.attendance_on BETWEEN '#{start_on}' AND '#{end_on}'\"\n\tend", "def inactive?\n return false unless self.checked_out?\n return false if self.hidden\n (Date.today - self.checked_out_at.to_date) >= 7\n end", "def reports\n start_date = params[:start_date]\n if (start_date.nil?)\n @date_arr = Order.all\n else\n end_date = params[:end_date]\n @date_arr = []\n Order.all.each do |order|\n if (order.date.strftime(\"%Y-%m-%d\").to_date >= start_date.to_date && order.date.strftime(\"%Y-%m-%d\").to_date <= end_date.to_date)\n @date_arr.push(order)\n end\n end\n end\n end", "def today\n @today = Alerte.where(created_at: Time.now.beginning_of_day..Time.now.end_of_day).order(created_at: :desc).all\n #@today = Alerte.where(created_at: Time.now.beginning_of_day..Time.now.end_of_day, ville_id: Agent.find(session[:id]).ville_id).order(created_at: :desc).all\n end", "def past\n Event.all.where('time_event < ?', Time.now)\n end", "def audit\n @patient=User.find_by_wedgetail(params[:wedgetail],:order =>\"created_at DESC\")\n authorize_only (:patient) {@patient.wedgetail == @user.wedgetail}\n authorize :user\n @audits = Audit.paginate(:page => params[:page],:per_page => 60, :order => 'created_at DESC', :conditions => [\"patient=?\", params[:wedgetail]])\n end", "def last_audit\n audits.last\n end", "def last_audit\n audits.last\n end", "def is_active?\n expiry >= Date.today\n end" ]
[ "0.6638116", "0.66005826", "0.6570501", "0.6461285", "0.639732", "0.6375717", "0.6302779", "0.6245756", "0.62004757", "0.6200022", "0.61931014", "0.6178317", "0.61648226", "0.6160636", "0.6137084", "0.6135155", "0.6131997", "0.6118627", "0.60974604", "0.60694695", "0.6038177", "0.6037215", "0.60135835", "0.6011602", "0.59904283", "0.59875596", "0.5982954", "0.59593874", "0.59198326", "0.5906442", "0.59023255", "0.590159", "0.58793175", "0.5816391", "0.58127517", "0.5791432", "0.5787919", "0.5785604", "0.5777274", "0.5777274", "0.57652533", "0.5756042", "0.5746861", "0.57171524", "0.5713083", "0.5711902", "0.5709129", "0.57033503", "0.56909764", "0.56876564", "0.5681949", "0.56813407", "0.5673493", "0.56327623", "0.56327134", "0.5620126", "0.5612383", "0.56066215", "0.5598152", "0.5576521", "0.55761015", "0.5572506", "0.55692035", "0.55580145", "0.5556782", "0.5553759", "0.554915", "0.5547888", "0.5545049", "0.5534824", "0.5534152", "0.55262065", "0.55253464", "0.55200285", "0.5513714", "0.5513572", "0.5506494", "0.55057466", "0.5505608", "0.5505608", "0.5501004", "0.54965895", "0.5493574", "0.5481644", "0.5480532", "0.547132", "0.5467799", "0.5465881", "0.546235", "0.5451355", "0.54486686", "0.5441405", "0.54374975", "0.54332775", "0.54317975", "0.54307073", "0.54285115", "0.54233366", "0.54233366", "0.5410434" ]
0.7780947
0
obscure the token generation.
def salt() 'monkeynutzzSfaKT7CwImCHCH8Ow' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_token\n self.token = UniqueToken.generate\n end", "def generate_token\n self.perishable_token = Digest::MD5.hexdigest(\"#{Time.now}\")\n end", "def generate_token\n #Token.generate_token(self.id)\n end", "def generate_token\n token_gen = SecureRandom.hex\n self.token = token_gen\n token_gen\n end", "def generate_token\n\t\tself.token = SecureRandom.hex\n end", "def make_token\n secure_digest(Time.now, (1..10).map{ rand.to_s })\n end", "def generate_token\n self.token = custom_token.presence || SecureRandom.hex(3)\n self.custom_token = nil\n generate_token if AliasedLink.exists?(token: token)\n end", "def token\n end", "def set_internal_token!\n self.token ||= generate_token\n end", "def new_token\n \t SecureRandom.urlsafe_base64\n \tend", "def generate_token!\n self.token = SecureRandom.hex\n save!\n end", "def token; end", "def token; end", "def token; end", "def token; end", "def token; end", "def token; end", "def generate_token\n self.token ||= Base64.urlsafe_encode64(SecureRandom.random_bytes(12))\n end", "def generate_token\n self.token = SecureRandom.urlsafe_base64\n end", "def generate_token\n self.token ||= SecureRandom.hex(16)\n end", "def reset_perishable_token\n self.perishable_token = self.class.make_token\n end", "def generate_token\n self.token = secure_digest(Time.now, candidate_id)\n end", "def generate_token\n self.apply_code = \"#{SecureRandom.hex(4)}\"\n self.act_status_type_id = 2\n end", "def new_token\n \t\tSecureRandom.urlsafe_base64\n \tend", "def token_secret=(_arg0); end", "def token_secret=(_arg0); end", "def token_secret=(_arg0); end", "def generate_token\n self.token = SecureRandom.hex if new_record?\n end", "def generate_token\n self.token = SecureRandom.base64(64)\n end", "def generate_token\n loop do\n token = SecureRandom.base64(44).tr(\"+/=\", \"xyz\").first(16).upcase\n break token unless self.class.where(:token => token).first\n end\n end", "def regenerate_token\n self.auth_token = nil\n generate_token\n save!\n end", "def new_token\n\t\tSecureRandom.urlsafe_base64\n\tend", "def generate_token\n self.token = Digest::SHA1.hexdigest([self.workplace_id, self.institute.id, Time.now, rand].join)\n end", "def new_token\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend", "def new_token\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend", "def new_token\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend", "def new_token\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend", "def new_token\n\t\t\tSecureRandom.urlsafe_base64\n\t\tend", "def generate_token\n self.update({:token => SecureRandom.hex})\n end", "def make_token\r\n # From the restful-authentication plug-in\r\n args = [ Time.now, (1..10).map{ rand.to_s } ]\r\n Digest::SHA1.hexdigest(args.flatten.join('--'))\r\n end", "def generate_token\n new_token =\n SimpleTokenAuthentication::TokenGenerator.instance.generate_token\n update(authentication_token: new_token)\n self\n end", "def gen_tokens\n self.access_token = SecureRandom.hex(16)\n end", "def generate_token\n if self.token.blank?\n self.id = self.token = UniqueToken.generate\n end\n end", "def generate_security_token\n self.security_token = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{email}--#{salt}--\")\n end", "def set_token\n self.token ||= SecureRandom.uuid.gsub(/\\-/, '').first(5).upcase\n end", "def friendly_token\n SecureRandom.base64(32).tr('+/=lIO0', 'pqrsxyz')\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def generate_token\n @raw_token = Doorkeeper::OAuth::Helpers::UniqueToken.generate\n secret_strategy.store_secret(self, :token, @raw_token)\n end", "def new_token\n SecureRandom.urlsafe_base64\nend", "def generate_auth_token!\n loop do\n @token = Devise.friendly_token\n break unless Token.find_by(token: @token)\n end\n self.tokens.create token: @token\n return @token\n end", "def populate_token\n if new_record? && self.token.nil?\n self.token = SecureRandom.uuid().to_s.last(8)\n while check_token?(self.token) == true\n self.token = SecureRandom.uuid().to_s.last(8)\n end\n end\n end", "def gen_token()\n used_tokens = []\n @data.records.each() { |r| used_tokens << r.token }\n\n free_tokens = @data.tokens - used_tokens\n\n srand\n free_tokens[rand(free_tokens.length)]\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def token\n @token ||= \"%x-%s\" % [ Time.now.to_i, SecureRandom::hex(4) ]\n end", "def token_secret; end", "def token_secret; end", "def token_secret; end", "def save_token\n self.token = SecureRandom.uuid unless self.token\n end", "def private_generate_token\n begin\n #self.access_id = SecureRandom.base64(40)\n\t self.access_id = SecureRandom.hex(40)\n end while self.class.exists?(access_id: access_id)\n end", "def generate_random_token\n #generates a random hex string of length 5\n unless self.random_token\n self.random_token = SecureRandom.hex(5)\n end\n end", "def generate_token(size)\n validity = Proc.new {|token| Token.where(:token => token).first.nil?}\n\n begin\n token = SecureRandom.hex(size)[0, size]\n token = token.encode(\"UTF-8\")\n end while validity[token] == false\n\n token\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def generate_authentication_token\n self.auth_token = User.new_token\n\t\t\tself.auth_expires_at = Time.now + 240.hours\n\tend", "def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end", "def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end", "def generate_token\n UUIDTools::UUID.random_create.to_s\n end", "def regenerate\n self.token = UUIDTools::UUID.random_create.to_s\n reset_timer\n self.token\n end", "def generate_token\n SecureRandom.hex(64)\nend", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def generate_token\n SecureRandom.hex(10)\n end", "def generate\n yield self if block_given?\n\n token = Token.generate(secret: @secret,\n message: @message,\n iv: @iv,\n now: @now)\n token.to_s\n end", "def generate_auth_token\n\t token = SecureRandom.hex\n\t #self.update_columns(token_key: token)\n\t token\n\t end", "def create_token\n if self.token.nil?\n self.token = loop do\n random_token = \"BON-#{SecureRandom.uuid.split('-').first}\"\n break random_token unless self.class.exists?(token: random_token)\n end\n end\n end", "def generate_token\n self.token = Digest::MD5.hexdigest(\"PersonRecordToken#{email}#{Rails.application.config.try(:hash_salt)}\")[0..254]\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def generate_token\n\t\tUUIDTools::UUID.timestamp_create.to_s\n\tend", "def set_token\n self.token = SecureRandom.hex(16)\n end", "def set_token\n self.token = SecureRandom.hex(16)\n end", "def create_token\n self.token = email.first(4).upcase + Time.now.strftime(\"%H:%M:%S\").strip().to_s.gsub(/[^\\d]/, \"\")\n end", "def genrate_tokn(password_reset_token)\n self.password_reset_token = (Digest::MD5.hexdigest \"#{ActiveSupport::SecureRandom.hex(10)}-#{DateTime.now.to_s}\")\n end", "def token\n len = 8\n token = self.id.to_s\n token = token + self.sha\n token = token[0..5]\n end", "def generate_access_token\n begin\n self.token = SecureRandom.hex\n end while self.class.exists?(token: token)\n end", "def generate_access_token\n begin\n self.token = SecureRandom.hex\n end while self.class.exists?(token: token)\n end", "def token_generate\n res = call('auth.token_generate')\n\n return unless res || res['token']\n\n res['token']\n end", "def assign_unique_token\n unless(self.token)\n begin\n self.token = rand(36**8).to_s(36).downcase # a-z \n end while self.class.exists?(:token => token)\n end\n end" ]
[ "0.7230534", "0.71695286", "0.7152015", "0.71263415", "0.7004038", "0.6962458", "0.6944689", "0.69231546", "0.6914858", "0.6879435", "0.6873058", "0.68599224", "0.68599224", "0.68599224", "0.68599224", "0.68599224", "0.68599224", "0.6847093", "0.6838875", "0.68350285", "0.68269473", "0.68168235", "0.6811711", "0.6806422", "0.67813927", "0.67813927", "0.67813927", "0.67788726", "0.67626894", "0.67313033", "0.67265874", "0.67235595", "0.669959", "0.669423", "0.669423", "0.669423", "0.669423", "0.669423", "0.6693366", "0.66787875", "0.665305", "0.66330445", "0.66310173", "0.6624714", "0.6600047", "0.6599351", "0.6598197", "0.6598197", "0.6598197", "0.6597721", "0.65970147", "0.65857774", "0.6568849", "0.6545671", "0.6542071", "0.6541718", "0.6521962", "0.6521962", "0.6521962", "0.6518427", "0.65134484", "0.6512652", "0.650261", "0.6495461", "0.64946526", "0.64879644", "0.64879644", "0.6482825", "0.6481706", "0.6479099", "0.6463938", "0.6463938", "0.6463938", "0.6463938", "0.6463938", "0.6463938", "0.6463938", "0.6463938", "0.6463938", "0.6463938", "0.6463938", "0.6463938", "0.6463938", "0.6463938", "0.6463938", "0.64510715", "0.64374644", "0.6433743", "0.64328384", "0.64062566", "0.6403609", "0.6391869", "0.63865", "0.63865", "0.63772994", "0.6376829", "0.6374464", "0.63605464", "0.63605464", "0.63577706", "0.63566875" ]
0.0
-1
Memoize the creation time.
def timestamp() @timestamp ||= Time.now.strftime("%Y%m%d%H%M%SZ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def creation_time # :nodoc:\n @creation_time.dup\n end", "def create_time(); @create_time; end", "def creation_date\n stat.ctime\n end", "def timestamp\n memoized_info[:local_timestamp]\n end", "def create_time\r\n begin\r\n # TODO: check which operating system we are on, and get this value accordingly....\r\n\r\n # File.ctime(file_path).to_i # NO NO NO, This is the 'change' time, not the 'create' time :-()\r\n\r\n # OSX stored the birth time of a file in special metadata that Ruby does not have easy access to,\r\n # so start the 'mdls' command in a separate process to extract this info.\r\n # WARNING: This is really slow! It's takes about 4,000 TIMES LONGER than File.mtime()\r\n return Time.parse(Open3.popen3(\r\n \"mdls\", \r\n \"-name\",\r\n \"kMDItemContentCreationDate\", \r\n \"-raw\", file_path)[1].read\r\n ).to_i\r\n rescue\r\n 0\r\n end\r\n end", "def creation_time\n data[:creation_time]\n end", "def mtime; end", "def mtime; end", "def mtime() end", "def mtime() end", "def asctime() end", "def created_time\n ctime\n end", "def instance_create_time\n data[:instance_create_time]\n end", "def get_creation_timestamp(path)\n nil\n end", "def time_since_creation\n ((Time.now - created_at) / 3600).round\n end", "def process_creation_date_time\n return @process_creation_date_time\n end", "def age() Time.now - mtime end", "def time_since_creation\n ((Time.now - created_at) / 3600).round\n end", "def getCreatedTimeLong\r\n\t\t\t\t\treturn @createdTimeLong\r\n\t\t\t\tend", "def getCreatedTimeLong\r\n\t\t\t\t\treturn @createdTimeLong\r\n\t\t\t\tend", "def io_optimized_next_allowed_modification_time\n data[:io_optimized_next_allowed_modification_time]\n end", "def creation_date=(_); end", "def creationtime\r\n\t\t\t`#{BITS::BITSADMIN} /getcreationtime {#{@id}}`\r\n\t\tend", "def now!\r\n @last_build_file.modification_time = @time = Time.now\r\n end", "def now\n cache\n end", "def now\n cache\n end", "def now\n cache\n end", "def time\r\n @time ||= @last_build_file.modification_time\r\n end", "def gmtime() end", "def creation_date\n# stat.ctime\n @bson['uploadDate'] || Date.new\n end", "def memo; end", "def asctime\n end", "def cache_buster_hash(*files)\n i = files.map { |f| File.mtime(f).to_i }.max\n (i * 4567).to_s.reverse[0...6]\n end", "def date\n return @date if @date\n\n return Time.at(ENV['SOURCE_DATE_EPOCH'].to_i).gmtime if ENV['SOURCE_DATE_EPOCH']\n\n return File.mtime(path) if File.exist?(path)\n\n Time.now\n end", "def creation_date\n return @creation_date if defined? @creation_date\n return unless metadata['Creation-Date']\n\n @creation_date = Time.parse(metadata['Creation-Date'])\n end", "def record_creation_timestamp(path, timestamp)\n # Hook method: Linux filesystems doesn't store creation datetime\n end", "def mtime_t\n Time.at(mtime * 0.001)\n end", "def cache_timestamp\n Tml::Utils.interval_timestamp(version_check_interval)\n end", "def cache_time\n @cache_time ||= (ENV['WD_CACHE_TIME'] || DEFAULT_CACHE_TIME)\n @cache_time.to_i\n end", "def generation_time\n Time.at(data.unpack(\"N\")[0]).utc\n end", "def generation_time\n Time.at(data.unpack(\"N\")[0]).utc\n end", "def memo\n end", "def getCreatedTime\r\n\t\t\t\t\treturn @createdTime\r\n\t\t\t\tend", "def getCreatedTime\r\n\t\t\t\t\treturn @createdTime\r\n\t\t\t\tend", "def timestamp\n @file_mtime ||\n if _exist?(name)\n @file_mtime = _mtime(name.to_s)\n else\n Rake::LATE\n end\n end", "def source_file_mtime; end", "def mtime\n Time.at(@mtime)\n end", "def mtime\n Time.at(@mtime)\n end", "def fresh_yaml_time\n newest_file = Dir[\"#{TableSetter.table_path}/*.yml\"].inject do |memo, obj|\n memo_time = File.new(File.expand_path memo).mtime\n obj_time = File.new(File.expand_path obj).mtime\n if memo_time > obj_time\n memo\n else \n obj\n end\n end\n File.new(newest_file).mtime\n end", "def memoized_info\n @memoized_info ||= info(allow_unchecked: true, unit: :raw)\n end", "def touch!\n @created = Time.now.to_i\n end", "def creation_date\n return @creation_date if defined? @creation_date\n return unless metadata['dcterms:created']\n\n @creation_date = Time.parse(metadata['dcterms:created'])\n end", "def mtime() File.mtime( expand_tilde ) end", "def ctime() File.ctime( expand_tilde ) end", "def create_timestamp\n self.created_at = Time.now\n end", "def create_timestamp\n self.created_at = Time.now\n end", "def create_or_renew_token()\n calculate_expiry_time()\n end", "def cache_key\n \"me/#{object.id}-#{object.updated_at.utc.to_s(:number)}\"\n end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def build_timing; end", "def last_modified_time\n mtime\n end", "def created_at\n ensure_full_data!\n Time.at(@gapi[\"creationTime\"] / 1000.0)\n end", "def created_at\n @created_at ||= @path.pathname.ctime\n end", "def expiration_timestamp\n @lock_expire if @lock_expire && owner_ident == @locked_owner_id\n end", "def timestamp\n begin\n File.mtime(name)\n rescue Errno::ENOENT\n Rake::LATE\n end\n end", "def cstime=(*) end", "def create_time=(time)\n @create_time = time\n update_times\n end", "def modify_time(); @modify_time ||= Time.now; end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n end" ]
[ "0.7313262", "0.6941452", "0.6666498", "0.6571832", "0.65381855", "0.64449155", "0.63443124", "0.63443124", "0.6176793", "0.6176793", "0.61567795", "0.61485606", "0.6133342", "0.6104896", "0.6102617", "0.60849696", "0.6066664", "0.6058096", "0.6055995", "0.6055995", "0.6039161", "0.6032468", "0.5992797", "0.59692883", "0.5964094", "0.5964094", "0.5946527", "0.5914228", "0.590274", "0.5901304", "0.5892843", "0.589283", "0.5885189", "0.5866364", "0.585297", "0.58463347", "0.58461076", "0.5833349", "0.58262104", "0.58224976", "0.58224976", "0.5817708", "0.5814197", "0.5814197", "0.58115137", "0.57738113", "0.5771915", "0.5771915", "0.57709855", "0.5765297", "0.5758208", "0.5752554", "0.5723691", "0.571394", "0.57138526", "0.57135487", "0.5684559", "0.56787884", "0.5674921", "0.5674921", "0.5674921", "0.5674921", "0.5674921", "0.5674921", "0.5674921", "0.5674921", "0.5674921", "0.5658685", "0.56411934", "0.56178105", "0.557658", "0.55672526", "0.55642545", "0.554788", "0.55431724", "0.55242825", "0.5519278", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749", "0.5518749" ]
0.586141
34
Identifier for customer: max 15chars, \w only, lowercase
def api_name return @api_name if @api_name sanitized = @username.gsub(/[\W_]+/, '_') @api_name ||= sanitized[0..15] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def Name(name)\n\tname = SecureRandom.alphanumeric\nend", "def db_license_key\n params[:customer_id].split(\"-\").first.gsub(\"\\u0000\", \"\")\n end", "def unique_text_name\n string_with_id(name.real_search_name)\n end", "def short_name \r\n name.gsub(/([A-Z])[^A-Z]+/, '\\1')\r\n end", "def gen_name\n name.to_s.downcase\n end", "def customer_initials\n @customer_initials ||= ('a'..'z').to_a\n end", "def generate_identifier\n self.identifier ||= self.name.parameterize.underscore\n end", "def unique_identifier\n Digest::MD5.hexdigest(@name.to_s)[0..9]\n end", "def generate_unique_key\n # not doing uppercase as url is case insensitive\n charset = ::Shortener.key_chars\n (0...::Shortener.unique_key_length).map{ charset[rand(charset.size)] }.join\n end", "def parse_cust_name\n @name_parsed = true\n\n @cust_tl = ''\n @cust_fs = ''\n @cust_ls = ''\n\n\n temp = subject_cname\n temp = body_cname if temp == nil\n temp = '' if temp == nil\n\n temp.gsub!(/^.*:/, '') # remove RE: FW: etc\n\n res = Customer.split_name(temp)\n\n @cust_tl = res[0]\n @cust_fs = res[1]\n @cust_ls = res[2]\n end", "def id\n name && name.gsub(' ', '').downcase\n end", "def safe_name\n name.gsub(/(^[0-9]*|[^0-9a-z])/i, '')\n end", "def identifier_regex\n /^[\\w\\-:]+$/\n end", "def get_customer_name\n first_name + ' ' + last_name\n end", "def name_as_id\n self.name.downcase.gsub(/\\s/, '-')\n end", "def convert_customer_name_to_id\n\t customer = Customer.find_by_name(self.customer_name)\n\t self.customer_id = customer.id unless customer.nil?\n end", "def generate_username2 (fir, las)\n\tfir.gsub(/[\\W\\d]/, \"\").downcase[0] + las.gsub(/[\\W\\d]/, \"\").downcase unless\n\tfir === \"\" || las === \"\"\nend", "def shortname\n name.downcase.gsub(/[^a-z]/, \"\")\n end", "def generate_id(str); end", "def obfuscate_id_default_spin\n alphabet = Array(\"a\"..\"z\")\n number = name.split(\"\").collect do |char|\n alphabet.index(char)\n end\n\n number.shift(12).join.to_i\n end", "def max_identifier_length\n 63\n end", "def friendly_token\n SecureRandom.base64(32).tr('+/=lIO0', 'pqrsxyz')\n end", "def get_incguard_from_incfname incfname\n incfname.gsub(/[^\\w]+/, \"_\").upcase\nend", "def customer_name\n company.blank? ? full_name : \"#{company} (#{full_name})\"\n end", "def customer_name\n company.blank? ? full_name : \"#{company} (#{full_name})\"\n end", "def short_code\n id.to_s 36\n end", "def username_format\n return if self.username.nil?\n self.username.gsub!(/[^0-9a-z\\- ]/i, '_')\n self.username.gsub!(/\\s+/, '-')\n self.username = self.username.downcase\n self.username = self.username.byteslice(0, 24) #substring 24\n end", "def shortname\n name.downcase.gsub(/[^a-z]/, \"-\")\n end", "def non_unique_letters(string)\nend", "def wsu_id\n \"UsernameToken-#{count}\"\n end", "def basic_generate_id(str); end", "def three_word_name; end", "def pick_name(n,w)\n return USERNAMES[ (n % USERNAMES.size) ] + n.to_s + \"_w#{w.to_s}\"\n end", "def pick_name(n,w)\n return USERNAMES[ (n % USERNAMES.size) ] + n.to_s + \"_w#{w.to_s}\"\n end", "def unique_text_name\n string_with_id(text_name)\n end", "def druid \n \n ## Derived, *relatively* unique ID.\n return display_name.strip.downcase.delete \" .,-_'\"\n \n end", "def set_unique_name\n salt = rand 1000000\n salt2 = rand 100\n if self.title.blank?\n self.unique_name = \"#{salt}_#{salt2}\" \n else\n self.unique_name = \"#{self.title.gsub(/[^\\w\\.\\-]/,'_').downcase}_#{salt}\"\n end\n end", "def gen_inst_id_str(inst_str)\n return inst_str.gsub(/[\\.:\\[\\]]/,'_').upcase\nend", "def get_trunc_name name\n name[0..3].downcase\n end", "def account_card_title\n name_too_long ? name[0..Account::DISPLAY_NAME_LIMIT] + '...' : name\n end", "def name_too_long\n name.length > Account::DISPLAY_NAME_LIMIT\n end", "def random_name\n (1..3).map {\"\" << rand(26) + 65}.to_s\n end", "def short_name\n name.size > 35 ? \"#{name[0..35]}...\" : name\n end", "def random_name\n SecureRandom.hex(20)\n end", "def generate_id(v)\n @collection_id + '-' + v.downcase.gsub(/\\/+/, '_').gsub(/;+|\\.+/, '').gsub(/ /, '-')\n end", "def set_identifier\n self.identifier = self.name.downcase.gsub(/[^a-zA-Z0-9]+/, '-').chomp('-')\n end", "def fake_name_c2(real_name)\n\treal_full_name = real_name.split(\" \")\n\treal_first_name = real_full_name[0] \n\treal_last_name = real_full_name[1]\n\ti = 0\n\tfake_first_name = \"\"\n\tfake_last_name = \"\"\n\tvowel_index = \"\"\n\tlength_first = real_first_name.length\n\tlength_last = real_last_name.length \n\t\twhile i < length_last\n\t\tif real_last_name[i] == \"z\"\n\t\t\tfake_last_name += \"a\"\n\t\telsif real_last_name[i] == \"a\" || real_last_name[i] ==\"e\" || \n\t\t\t real_last_name[i] == \"i\" || real_last_name[i] == \"o\" || \n\t\t\t real_last_name[i] == \"u\"\n\t\t\tfake_last_name += real_last_name[i] \n\t\telse \n\t\t\tfake_last_name += real_last_name[i].next \n\t\tend \n\t\ti+=1\n\tend\n\tfake_last_name\nend", "def client_name\r\n self.name.strip.upcase\r\n end", "def customer_name\n \"#{order.bill_address.firstname} #{order.bill_address.lastname}\"\n rescue\n ''\n end", "def random_id\n \"#{('a'..'z').to_a.sample}-#{SecureRandom.alphanumeric(6)}\"\n end", "def external_identifier \n elements = []\n elements << ipaddress || 'UNKNOWNIP'\n elements << custid || 'anon'\n #OT.ld \"sess identifier input: #{elements.inspect}\"\n @external_identifier ||= elements.gibbler.base(36)\n @external_identifier\n end", "def generate_small_token(column)\n loop do\n token = Devise.friendly_token[0,5].upcase\n break token unless to_adapter.find_first({ column => token })\n end\n end", "def unique_text_name\n real_text_name + \" (#{id || \"?\"})\"\n end", "def unique_safe_name\n \"#{safe_name}_#{id}\"\n end", "def create_username() #t\n email_username = self.email.gsub(/(\\A([\\w\\.\\-\\+]+))@((?:[-a-z0-9]+\\.)+[a-z]{2,})\\z/i, \"\\\\1\")\n email_username = email_username.gsub(/\\W/, \"\")\n username_try = email_username\n \n i = 1\n found_unique_username = false\n while(!found_unique_username)\n if User.unique_username?(nil, username_try)\n found_unique_username = true\n else\n username_try = email_username + i.to_s\n end\n i += 1\n end\n \n self.username = username_try\n end", "def build_discourse_username(edx_username)\n edx_username.slice(0, DISCOURSE_USERNAME_MAX_LENGTH).gsub('__', '_').chomp('_')\n end", "def generate_name\n self.name ||= header ? header.parameterize : id\n end", "def test_name_generator_with_invalid_input\nresult = name_generator(\"89&6\\n 5.,?<\")\nassert_equal(\"Inavalid ID. Please enter new ID with only lower case letters.\", result)\nend", "def name\n [cc_type, last_digits].join(' - ')\n end", "def normalize_friendly_id(string)\n\t super[0..20]\n\tend", "def generate_identifier\n self.identifier = Digest::MD5.hexdigest(\"PersonRecordIdentifier#{email}#{Rails.application.config.try(:hash_salt)}\")[0..254]\n end", "def payerid\n raise \"Plan ID should have 16 characters, but #{super} has only #{super.length}\" if super.length != 16\n super\n end", "def identifier\n SecureRandom.hex(16)\n end", "def set_unique_name\n salt = rand 1000000\n salt2 = rand 100\n if self.title.blank?\n self.unique_name = \"#{salt}_#{salt2}\" \n else\n self.unique_name = \"#{sanitized_title.downcase}_#{salt}\"\n end\n end", "def alpha_char\n self.last_name[0..0].downcase\n end", "def customer_name\n customer.name\n end", "def generate_unique_name\n SecureRandom.uuid\n end", "def random_name(length = 10, char_set = nil)\n if char_set.eql? nil\n char_set = [('a'..'z'), ('A'..'Z')].map {|i| i.to_a }.flatten\n end\n name = (0...length).map{ char_set[rand(char_set.length)] }.join\n end", "def two_word_name; end", "def createRandomUserName20\n len = 20\n # Random capital letter for first and last name\n nameFirst = (65 + rand(26)).chr\n nameLast = (65 + rand(26)).chr\n # Length of first and last remaining lower case letters\n remainingFirst = rand(len - 2) # First name can be between 1 and full length minus 2 (space and at least 1 char for last name)\n remainingLast = rand(len - 2 - remainingFirst) # Last name between 1 and full length minus 2 (space and at least 1 char for first name\n # Remaining letters\n (remainingFirst).times{nameFirst << (97 + rand(26)).chr}\n (remainingLast).times{nameLast << (97 + rand(26)).chr}\n return nameFirst, nameLast\nend", "def international_phone\n \"011-#{rand(100) + 1}-#{rand(100)+10}-#{rand(10000)+1000}\"\n end", "def getClientIdentificationObjName\r\n\t\t\treturn \"mfiforce__Client_Identification__c\"\r\n\t\tend", "def random_name\n \"#{random_letters(pick_range(4..12)).capitalize} #{random_letters(pick_range(4..12)).capitalize}\"\n end", "def random_name\n \"#{random_letters(pick_range(4..12)).capitalize} #{random_letters(pick_range(4..12)).capitalize}\"\n end", "def clean_name\n clean_name = name.strip\n clean_name.gsub!(/\\s+/,'_')\n clean_name.gsub!(/[^0-9A-Za-z_-]/, '_')\n clean_name\n end", "def alphanumeric(placeholder = nil)\n generate(placeholder, ALPHANUMERIC_CHARACTERS)\n end", "def random_common_name(domain_name)\n cert_serial_number(domain_name).to_s(36)\n end", "def random_common_name(domain_name)\n cert_serial_number(domain_name).to_s(36)\n end", "def human_from_name; end", "def name_pattern\n /^#{Regexp.escape(name)}\\s\\d+$/\n end", "def sequence_name_length\n IDENTIFIER_MAX_LENGTH\n end", "def create_unique_name_from_email\n return unless name.blank?\n self.name = email.to_s.split(\"@\").first&.gsub('.', '-')\n last_user = User.where(\"name LIKE ?\", \"#{name}%\").order(:name).last\n if last_user\n number = 2\n last_part = last_user.name.split('-').last\n number = last_part.to_i + 1 if last_part && last_part.to_i.to_s == last_part\n self.name = \"#{name}-#{number}\"\n end\n end", "def _sc_akey( number )\n\t\t\"#{Search_control_prefix}.agent#{number.to_i > 0 ? number : ''}\"\n\tend", "def generate_username4 (first_name, last_name, birth_year, privilege=\"0\")\n user_priv = \"\"\n if (privilege == 1)\n user_priv = \"seller\"\n elsif (privilege == 2)\n \tuser_priv = \"manager\"\n elsif (privilege == 2)\n \tuser_priv = \"admin\"\n end\n\n if ((birth_year.to_s.length == 4) && (birth_year<2015) && (birth_year>1900))\n \t(privilege >= 1? user_priv += \"-\" : \"\") + first_name.chomp[0].downcase + last_name.downcase + birth_year.to_s.chomp[-2..-1]\n end\nend", "def generate_autocomplete\n s = self.name\n s = s.truncate(100, omission: \"\", separator: \" \") if s.length > 100\n write_attribute(:autocomplete, Autocomplete.normalize(s))\n write_attribute(:autocomplete_length, Autocomplete.normalize(s).size)\n end", "def sanitise(str)\n str.gsub(/[^a-zA-Z0-1]+/, \"_\")[0, 20]\n end", "def random_username\n word_list.sample.gsub(/[^0-9a-z]/i, '')\n end", "def unique_name(name)\n \"pedant_#{name}_#{pedant_suffix}\"\n end", "def planning_authority_short_name_encoded\n planning_authority_short_name.downcase.gsub(' ', '_').gsub(/\\W/, '')\n end", "def planning_authority_short_name_encoded\n planning_authority_short_name.downcase.gsub(' ', '_').gsub(/\\W/, '')\n end", "def safe_name\n name.to_s.gsub(/[^a-zA-Z0-9 _\\-:\\.]/, '').gsub(/:/, ' - ').gsub(/ +/, ' ')\n end", "def generate_uid\n def tri vals\n \"#{vals.sample}#{vals.sample}#{vals.sample}\"\n end\n chars = (\"A\"..\"Z\").to_a\n numbers = (\"0\"..\"9\").to_a\n self.uid = loop do\n uid = \"#{tri(chars)}-#{tri(numbers)}-#{tri(chars)}-#{tri(numbers)}-#{tri(chars)}\"\n break uid unless Ticket.where(uid: uid).exists?\n end\n end", "def key_file_name\n self.email.tr('^A-Za-z', '')[0..10] + self.id.to_s\n end", "def gen_alphanumeric(length = 10)\n positive_int! length\n gen_string_from_letters length, ALPHANUMERIC\n end", "def identificacion_company\n \"#{type_identification}-#{rif}\"\n end", "def identification_name(identification_type)\n case identification_type\n when Donor.identification_types['pan_card']\n 'Permanent Account Number'\n when Donor.identification_types['aadhaar_card']\n 'Aadhaar Number'\n when Donor.identification_types['passport']\n 'Passport number'\n when Donor.identification_types['voter_id_card']\n 'Elector\\'s photo identity number'\n when Donor.identification_types['driving_license']\n 'Driving License number'\n when Donor.identification_types['ration_card']\n 'Ration card number'\n when Donor.identification_types['tax_payer_country_of_residence']\n 'Tax Identification Number'\n else\n ''\n end\n end", "def work_profile_password_min_lower_case_characters\n return @work_profile_password_min_lower_case_characters\n end", "def canonize (key)\n key.tr(\"A-Z\",\"a-z\").gsub(/\\s/,\"\")\nend", "def random_alphanumeric\n (1..10).collect { ALPHANUMERIC[rand(ALPHANUMERIC.size)] }.join\n end" ]
[ "0.6302268", "0.6302268", "0.62095207", "0.62001425", "0.6104753", "0.60931057", "0.6085914", "0.6006147", "0.5986254", "0.5924669", "0.5835573", "0.5828168", "0.5825839", "0.58141756", "0.5800179", "0.5796679", "0.5780755", "0.5766519", "0.5766498", "0.57279325", "0.57148606", "0.57039434", "0.5689192", "0.5684262", "0.5668718", "0.56677866", "0.56677866", "0.5660516", "0.5659743", "0.56545013", "0.56510895", "0.5645573", "0.5638621", "0.56375", "0.56265616", "0.56265616", "0.5624671", "0.5621277", "0.56155944", "0.5614619", "0.56085545", "0.5591394", "0.5591154", "0.5573127", "0.5566857", "0.556381", "0.55637336", "0.5562354", "0.5554809", "0.55393904", "0.5539057", "0.5537965", "0.55316824", "0.55247754", "0.5510748", "0.5503353", "0.54983795", "0.54973704", "0.54972386", "0.5494115", "0.5493507", "0.54870194", "0.54856014", "0.5475235", "0.54728454", "0.54712355", "0.5465816", "0.5458924", "0.5449913", "0.54481924", "0.5446087", "0.54421186", "0.5429204", "0.5424079", "0.5421953", "0.5421953", "0.54185903", "0.54166675", "0.5413531", "0.5413531", "0.5411653", "0.54100424", "0.54079115", "0.54069424", "0.54057646", "0.5400962", "0.5397842", "0.5397322", "0.53940564", "0.53936046", "0.53929126", "0.53929126", "0.53872347", "0.5380955", "0.53793776", "0.5376798", "0.53750396", "0.5373913", "0.5366822", "0.53637", "0.5360418" ]
0.0
-1
Salt used in ID generation
def salted_name [api_name,rand_salt].join('--') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_salt\n @salt = self.object_id.to_s + rand.to_s\n end", "def generate_salt\n self.salt = self.object_id.to_s + rand.to_s\n end", "def create_new_salt\n\t\tself.salt = self.object_id.to_s + rand.to_s\n end", "def create_new_salt\n self.salt = self.object_id.to_s + rand.to_s\n end", "def create_new_salt\n self.salt = self.object_id.to_s + rand.to_s\n end", "def salt\n # 72 bits\n SecureRandom.hex(9)\n end", "def create_salt\n\t\t\tself.password_seed = self.object_id.to_s + rand.to_s\n\t\tend", "def create_new_salt \n self.password_salt = self.object_id.to_s + rand.to_s\n end", "def generate_salt\n salt = \"\"\n 64.times { \n salt << (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }\n salt\n end", "def create_new_salt\n\t\t(self.salt = self.object_id.to_s + rand.to_s) if self.salt.nil?\n\tend", "def create_new_salt\n self.salt = Digest::SHA256.hexdigest(Time.now.to_s + rand.to_s)\n end", "def create_new_salt\n self.salt = Digest::SHA256.hexdigest(Time.now.to_s + rand.to_s)\n end", "def generate_salt\n Digest.hexencode(Digest::SHA1.digest(\n \"#{rand(2 ** 128) * ( Time.now.to_i * Process.pid)}\"))\n end", "def id_salt=(salt)\n @id_salt = salt\n end", "def make_salt\n secure_hash(\"#Time.now.utc}--#{password}\")\n end", "def generate_salt\n self.salt = SecureRandom.base64(8)\n end", "def generate_salt\n Digest::SHA1.hexdigest(Time.now.to_f.to_s)\n end", "def make_salt\n\t secure_hash(\"#{Time.now.utc}--#{password}\")\n\tend", "def salt() 'monkeynutzzSfaKT7CwImCHCH8Ow' end", "def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end", "def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end", "def salt\n nil\n end", "def create_salt()\n size=10\n pool = ('a'..'z').to_a + ('0'..'9').to_a\n self.salt= (1..size).collect{|a| pool[rand(pool.size)]}.join\n end", "def authenticatable_salt; end", "def make_salt\n secure_hash(\"#{Time.now.utc}--#{password_digest}\")\n end", "def salt!\n returning self.class.generate_salt do |s|\n write_attribute(:salt, s)\n end\n end", "def generate_salt\n return hash(\n Time.now.to_s,\n rand(999_999_999).to_s,\n Time.now.usec\n )\n end", "def make_salt\r\n self.salt = sha_hash(\"#(Time.now.to_s)--#(self.password)\")\r\n end", "def authenticatable_salt\n end", "def salt\n @@salt ||= SALT\n end", "def mutate_bcrypt_salt(_)\n 'au6lOASvp17AGsqkmE7'\n end", "def generate_salt\n salt_time = (ENV['RACK_ENV'] == 'test' ? 0.01 : 1.25)\n self[:salt] = SCrypt::Engine.generate_salt(max_time: salt_time)\n end", "def gen_salt\n chars = []\n 8.times { chars << SALT_CHARS[SecureRandom.random_number(SALT_CHARS.size)] }\n chars.join('')\n end", "def rand_salt\n result = ''\n salt().length.times {result << salt()[rand(salt().length),1]}\n result\n end", "def create_salt\n d = Digest::SHA1.new\n now = Time.now\n d.update(now.to_s)\n d.update(String(now.usec))\n d.update(String(rand(0)))\n d.update(String($$))\n d.update('wxtengu.net')\n d.hexdigest\n end", "def salt\n read_attribute(:salt) or returning self.class.generate_salt do |s|\n write_attribute(:salt, s)\n end\n end", "def create_new_salt\n self.password_salt = [Array.new(6){rand(256).chr}.join].pack(\"m\").chomp\n end", "def gen_salt\n chars = []\n 8.times { chars << SALT_CHARS[rand(SALT_CHARS.size)] }\n chars.join('') \n end", "def init_salt\n self.salt = SecureRandom.hex(25) if self.salt.blank?\n end", "def salt\n @salt ||= Pharos::SaltMinion.new minion_id: hostname\n end", "def code_salt\n 'fbbc13ed4a51e27608037365e1d27a5f992b6339'\n end", "def get_salt\n [Array.new(6){rand(256).chr}.join].pack(\"m\" ).chomp\n end", "def salt\n SecureApi.configuration.secure_api_salt\n end", "def salt\n read_attribute(:salt) || reset_salt\n end", "def salt\n p_salt(profile.salt_bytes)\n end", "def get_salt\n @salt ||= BCrypt::Engine.generate_salt\n end", "def salt\n if salt_path.file?\n salt_path.read\n else\n @salt ||= SecureRandom.bytes(Sia::Lock::DIGEST.new.digest_length)\n end\n end", "def set_salt\n @salt = Salt.find(params[:id])\n end", "def password_salt\n \"choujin-steiner\"\n end", "def generate_salts\n @verify_salt = OpenSSL::Random.random_bytes(KEYLEN)\n @encrypt_salt = OpenSSL::Random.random_bytes(KEYLEN)\n end", "def sid_algorithm; SecureRandom.hex(@options[:sid_len]); end", "def gen_secret\n u = UUID.new\n d = Digest::SHA256.new << u.generate\n self.secret = d.to_s\n end", "def gen_id\n SecureRandom.hex(32)\n end", "def generate_identity\n self.uid ||= OpenSSL::Random.random_bytes(16).unpack('H*').first\n self.secret ||= OpenSSL::Random.random_bytes(32).unpack('H*').first\n true\n end", "def hasher\n Hashids.new(@hash_id_state[:salt], @hash_id_state[:length])\n end", "def authenticatable_salt\n encrypted_password[0,29] if encrypted_password\n end", "def authenticatable_salt\n session_id.presence || reset_session_id!\n end", "def salt_size\n @salt_size ||= 8\n end", "def generate_secret\r\n ActiveSupport::SecureRandom.hex(64)\r\n end", "def salt\n return NSEC3.encode_salt(@salt)\n end", "def authenticatable_salt\n read_attribute(:authenticatable_salt)\n end", "def send_salt( session, user )\n salt = Digest::MD5.hexdigest( user + Time.now.strftime('%M%S') + rand(300).to_s )\n session.puts salt\n return salt\n end", "def authenticatable_salt\n \"#{super}#{session_token}\"\n end", "def authenticatable_salt\n \"#{super}#{session_token}\"\n end", "def set_hash_id_instance(salt)\n @hid = Hashids.new(salt, 12)\n end", "def sid_algorithm\n OpenSSL::Random.random_bytes(@options[:sid_len] / 2).unpack('H*')[0]\n end", "def generate_id\n SecureRandom.hex(8)\n end", "def generate_login_salt\n r = Aws::Kms.new('login', 'user').generate_data_key\n return r unless r.success?\n\n @login_salt_hash = r.data\n\n success\n end", "def get_crypto_salt_hex\n return @crypto_salt if ! @crypto_salt\n @crypto_salt.unpack(\"H*\")\n end", "def generate_token(pass, salt)\n Digest::SHA256.hexdigest(pass + salt)\n end", "def get_default_salt(mode)\r\n\r\n default_salt = nil\r\n\r\n if (mode == AES_128) || (mode == AES_256)\r\n default_salt = OpenSSL::Random.random_bytes(8)\r\n elsif mode == DES\r\n default_salt = OpenSSL::Random.random_bytes(2)\r\n end\r\n\r\n default_salt\r\n end", "def random_instance_id # TODO: don't count on this for security; migrate to a proper instance id, in a cookie, at least twice as long, and with verified randomness\n \"%08x\" % rand( 1 << 32 ) + \"%08x\" % rand( 1 << 32 ) # rand has 52 bits of randomness; call twice to get 64 bits\n end", "def base_32_string_seed\n data.base_32_string_seed\n end", "def id_generator; end", "def random_pbkdf2_salt\n encode_bytes(SecureRandom.random_bytes(16))\n end", "def salt=(value)\n @@salt = value\n end", "def identifier\n SecureRandom.hex(16)\n end", "def uuid\n @keystore[:id]\n end", "def generate_address_salt\n\n r = Aws::Kms.new('api_key','user').generate_data_key\n return r unless r.success?\n\n @address_salt = r.data\n\n success\n\n end", "def token_with_salt(salt)\n Digest::SHA256.hexdigest(CommentToolApp::Application.config.secret_token + salt)\n end", "def generate_api_key\n @user.api_key = BCrypt::Engine.generate_salt\n end", "def secret_generate\n Secret.generate\n end", "def generate_id\n SecureRandom.urlsafe_base64 21\n end", "def generate_sid\n \"%0#{@default_options[:sidbits] / 4}x\" %\n rand(2**@default_options[:sidbits] - 1)\n end", "def id_gen(source, exclude)\n\tid = Digest::SHA1.hexdigest(\"#{ENCODING_PHRASE}-#{source}-#{exclude}-#{@client_id}\")\n\treturn id\nend", "def generate_seed\n update(seed: SecureRandom.hex(16))\n end", "def newId\r\n @seed = @seed + 1\r\n \"X#{@seed}\"\r\n end", "def generate_sid(secure = @sid_secure)\n sid = super(secure)\n sid = \"#{generate_hmac(sid, @config.secret_key)}--\" + sid\n end", "def secret_keygen\n ('k' + Digest.hexencode(rand(9).to_s + self.message[0..2]) + self.id.to_s) \n end", "def generate_user_key\n\t\tself.key = loop do\n random_hex = SecureRandom.urlsafe_base64\n break random_hex unless self.class.exists?(key: random_hex)\n end\n\tend", "def unique_identifier\n Digest::SHA1.hexdigest(\"#{login_name}:#{password}\")\n end", "def default_key \n Digest::SHA1.hexdigest(\"riaque:#{name}\")\n end", "def configure\n yield self\n @id_salt = DEFAULT_SALT if @id_salt.nil?\n set_hash_id_instance(@id_salt)\n end", "def generate_secret\n rand(36**secret_length).to_s(36)\n end", "def unique_identifier\n\t\tDigest::SHA1.hexdigest(\"#{email}:#{password}\")\n\tend", "def secret_ID(id = nil)\r\n return id ? id >> 16 : @id >> 16\r\n end", "def generate_code\n self.code = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{user_id}--#{rand(256)}\")[0,32]\n end", "def generate_key; end", "def authenticatable_salt\n self.encrypted_password[0,29] if self.encrypted_password\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end" ]
[ "0.8030442", "0.8019362", "0.7880557", "0.78701216", "0.78701216", "0.77984184", "0.7742892", "0.76892775", "0.7677463", "0.7635413", "0.7617902", "0.7617902", "0.7600052", "0.7587722", "0.75269276", "0.74987745", "0.74755406", "0.7470617", "0.7464285", "0.7421811", "0.7421811", "0.7421141", "0.7365805", "0.73574775", "0.7331507", "0.73201716", "0.73130167", "0.7233523", "0.7224663", "0.720888", "0.7177054", "0.71563125", "0.7150329", "0.71426696", "0.71044236", "0.7084284", "0.7081917", "0.70670974", "0.6966834", "0.69364345", "0.69245976", "0.6908451", "0.6907615", "0.6906362", "0.68521374", "0.6829962", "0.67782706", "0.675534", "0.67383635", "0.67321676", "0.6692557", "0.6674773", "0.6647129", "0.6629008", "0.6620785", "0.66123223", "0.6612048", "0.6606676", "0.6573792", "0.6555912", "0.6551997", "0.6545023", "0.6544289", "0.6544289", "0.64488786", "0.6419178", "0.6417296", "0.6414565", "0.64025396", "0.63834774", "0.6378369", "0.6374858", "0.6373334", "0.63662845", "0.6364477", "0.6351879", "0.6342858", "0.6339571", "0.6331697", "0.6330718", "0.63238823", "0.6312693", "0.63057065", "0.63020515", "0.6270961", "0.6265328", "0.6240822", "0.6236491", "0.62297535", "0.6229745", "0.61972874", "0.6192317", "0.6190089", "0.6176869", "0.6174559", "0.6173161", "0.61690587", "0.61649084", "0.61615336", "0.6154557" ]
0.68313205
45
SHA1 hash in compact form
def sha1_base64 str = Base64.encode64(Digest::SHA1.digest(salted_name)).strip str.tr('+/', '-_').gsub(/=/,'') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hex_sha1(s)\n binb2hex(core_sha1(str2binb(s), s.length * $chrsz))\n end", "def sha1; end", "def sha1; end", "def hex_sha1(s)\n return binb2hex(core_sha1(str2binb(s), s.length * $chrsz))\n end", "def to_sha1(salt = \"\")\n hashsum(:sha1, salt)\n end", "def short_sha1(length=7)\n sha1[0, length]\n end", "def short_sha1(length=7)\n sha1[0, length]\n end", "def sha1_hex\n Digest::SHA1.hexdigest(salted_name)\n end", "def to_sha1(length = 40)\n Digest::SHA1.hexdigest(self)[0,length]\n end", "def sha1\n @sha1 ||= digest(path, :sha1)\n end", "def sha1=(_); end", "def sha(str)\n Digest::SHA1.hexdigest(str)[0, 40]\n end", "def sha1(string)\n\tOpenSSL::Digest::SHA1.hexdigest(string)\nend", "def sha1?; @sha1; end", "def digest\n Digest::SHA1.hexdigest(self)\n end", "def spki_sha1_hash(cert)\n spki = OpenSSL::ASN1.decode(cert).value[0].find { |e|\n e.tag == 16 && e.value[0].tag == 16\n }\n return unless spki\n [\"sha1\", [OpenSSL::Digest::SHA1.digest(spki.to_der)].pack('m*').chomp].join(\"/\")\n end", "def core_sha1(x, len)\n # append padding\n x[len >> 5] ||= 0\n x[len >> 5] |= 0x80 << (24 - len % 32)\n x[((len + 64 >> 9) << 4) + 15] = len\n\n w = Array.new(80, 0)\n a = 1_732_584_193\n b = -271_733_879\n c = -1_732_584_194\n d = 271_733_878\n e = -1_009_589_776\n\n # for(var i = 0; i < x.length; i += 16)\n i = 0\n while i < x.length\n olda = a\n oldb = b\n oldc = c\n oldd = d\n olde = e\n\n # for(var j = 0; j < 80; j++)\n j = 0\n while j < 80\n if j < 16\n w[j] = x[i + j] || 0\n else\n w[j] = rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1)\n end\n\n t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)),\n safe_add(safe_add(e, w[j]), sha1_kt(j)))\n e = d\n d = c\n c = rol(b, 30)\n b = a\n a = t\n j += 1\n end\n\n a = safe_add(a, olda)\n b = safe_add(b, oldb)\n c = safe_add(c, oldc)\n d = safe_add(d, oldd)\n e = safe_add(e, olde)\n i += 16\n end\n [a, b, c, d, e]\n end", "def hex(string)\n Digest::SHA1.hexdigest(string)\n end", "def digest( str )\n Digest::SHA1.hexdigest( str )\n end", "def core_sha1(x, len)\n # append padding\n x[len >> 5] ||= 0\n x[len >> 5] |= 0x80 << (24 - len % 32)\n x[((len + 64 >> 9) << 4) + 15] = len\n\n w = Array.new(80, 0)\n a = 1732584193\n b = -271733879\n c = -1732584194\n d = 271733878\n e = -1009589776\n\n #for(var i = 0; i < x.length; i += 16)\n i = 0\n while(i < x.length)\n olda = a\n oldb = b\n oldc = c\n oldd = d\n olde = e\n\n #for(var j = 0; j < 80; j++)\n j = 0\n while(j < 80)\n if(j < 16) \n w[j] = x[i + j] || 0\n else \n w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1)\n end\n\n t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)),\n safe_add(safe_add(e, w[j]), sha1_kt(j)))\n e = d\n d = c\n c = rol(b, 30)\n b = a\n a = t\n j += 1\n end\n\n a = safe_add(a, olda)\n b = safe_add(b, oldb)\n c = safe_add(c, oldc)\n d = safe_add(d, oldd)\n e = safe_add(e, olde)\n i += 16\n end\n return [a, b, c, d, e]\n end", "def sha1\n Digest::SHA1.hexdigest(subject.identification + 0.chr + source)\n end", "def sha1(name)\n Digest::SHA1.file(path(name)).hexdigest\n end", "def sha1_fingerprint\n @sha1_fingerprint ||= @node['sha1Fingerprint']\n end", "def sha1(string,\n\t\tpad = true,\n\t\th = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0])\n\t# functions and constants\n\tmask = 0xffffffff\n\n\ts = proc{|n, x| ((x << n) & mask) | (x >> (32 - n))}\n\tf = [\n\t\tproc {|b, c, d| (b & c) | (b.^(mask) & d)},\n\t\tproc {|b, c, d| b ^ c ^ d},\n\t\tproc {|b, c, d| (b & c) | (b & d) | (c & d)},\n\t\tproc {|b, c, d| b ^ c ^ d},\n\t].freeze\n\n\tk = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6].freeze\n\n\tif pad\n\t\tstring = sha1padding(string)\n\tend\n\n\tif string.size % 64 != 0\n\t\tfail \"failed to pad to correct length\"\n\tend\n\n\t#hashing\n\tio = StringIO.new(string)\n\tblock = \"\"\n\n\twhile io.read(64, block)\n\t\tw = block.unpack(\"N16\")\n\n\t\t# Process block.\n\t\t(16..79).each {|t| w[t] = s[1, w[t-3] ^ w[t-8] ^ w[t-14] ^ w[t-16]]}\n\n\t\ta, b, c, d, e = h\n\t\tt = 0\n\t\t4.times do |i|\n\t\t\t20.times do\n\t\t\t\ttemp = (s[5, a] + f[i][b, c, d] + e + w[t] + k[i]) & mask\n\t\t\t\ta, b, c, d, e = temp, a, s[30, b], c, d\n\t\t\t\tt += 1\n\t\t\tend\n\t\tend\n\n\t\t[a,b,c,d,e].each_with_index {|x,i| h[i] = (h[i] + x) & mask}\n\tend\n\treturn h.pack(\"N5\").bytes\nend", "def sha1(data)\n @connection.sha1(data)\n end", "def sha1(data, c: true)\n if c && $linux && File.file?(PATH_SHA1)\n File.binwrite(\"util/#{HASH_INPUT_FN}\", data)\n code = shell(\"./util/sha1 ./util/#{HASH_INPUT_FN} ./util/#{HASH_OUTPUT_FN}\")\n return nil if !code\n hash = File.binread(\"util/#{HASH_OUTPUT_FN}\")\n FileUtils.rm([\"./util/#{HASH_INPUT_FN}\", \"./util/#{HASH_OUTPUT_FN}\"])\n hash\n else\n Digest::SHA1.digest(data)\n end\nrescue => e\n lex(e, 'Failed to compute the SHA1 hash')\n nil\nend", "def sha256; end", "def sha1\n Digest::SHA1.hexdigest self.record\n end", "def sha512; end", "def signature(args)\n str = args.to_s\n if str.length <= SHA1_THRESHHOLD\n args\n else\n Digest::SHA1.hexdigest args.to_s\n end\n end", "def hash(message)\n return Digest::SHA1.hexdigest(message)\n end", "def calc_digest input\n Digest::SHA1.hexdigest(input.to_s).\n\n # XXX: surround all digits with alphabets so\n # Maruku doesn't change them into HTML\n gsub(/\\d/, 'z\\&z')\n end", "def sha1(message, hash_words = nil, add_to_length = 0)\n hash_words ||= [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0] # 5.3.1\n\n # 5.1.1\n # Big-endian u_int32 chunks\n pad_string = mdpad(message, :big, add_to_length).unpack('N*')\n\n # 6.1.2\n pad_string.each_slice(16).each do |chunk| # Split pad_string into 512b chunks (16 * 32b) -- 6.1.2 - 1. Prepare the message schedule\n #Expand from sixteen to eighty -- 6.1.2 - 1. Prepare the message schedule\n (16..79).each { |i| chunk << leftrotate(chunk[i-3] ^ chunk[i-8] ^ chunk[i-14] ^ chunk[i-16], 1) }\n working_vars = hash_words.dup # Copy current hash_words for next round. -- 6.1.2 - 2. Initialize the five working variables.\n\n # 6.1.2 - 3. & 4.1.1 - SHA-1 Functions\n (0..79).each { |i|\n if 0 <= i && i <= 19\n f = (working_vars[1] & working_vars[2]) | (~working_vars[1] & working_vars[3])\n k = 0x5A827999\n elsif 20 <= i && i <= 39\n f = working_vars[1] ^ working_vars[2] ^ working_vars[3]\n k = 0x6ED9EBA1\n elsif 40 <= i && i <= 59\n f = (working_vars[1] & working_vars[2]) | (working_vars[1] & working_vars[3]) | (working_vars[2] & working_vars[3])\n k = 0x8F1BBCDC\n elsif 60 <= i && i <= 79\n f = working_vars[1] ^ working_vars[2] ^ working_vars[3]\n k = 0xCA62C1D6\n end\n # Complete round & Create array of working variables for next round.\n temp = (leftrotate(working_vars[0], 5) + f + working_vars[4] + k + chunk[i]) & 0xffffffff\n working_vars = [temp, working_vars[0], leftrotate(working_vars[1], 30), working_vars[2], working_vars[3]]\n }\n\n # 6.1.2 - 4. Compute the ith intermediate hash value\n hash_words = working_vars.zip(hash_words).map { |wv, hw| (hw + wv) & 0xffffffff }\n end\n\n # Block: Append string with hex formatted partial result, padding 0's due to ruby truncating leading 0's from hex output\n hash_words.map { |partial| partial.to_s(16).rjust(8, ?0) }.join\nend", "def sha1(path)\n result = nil\n chunk_size = 10240\n File.open(path, \"r\") do |file|\n sha1 = Digest::SHA1.new\n\n while true\n chunk = file.read chunk_size\n break if ! chunk\n sha1.update chunk\n end\n result = sha1.hexdigest\n end\n result\n end", "def short_sha\n self.sha[0..6]\n end", "def sha_hash (arg)\r\n Digest::SHA2.hexdigest(arg)\r\n end", "def get_pre_keyed_hash(password)\n md = OpenSSL::Digest::SHA1.new\n passwd_bytes = []\n password.unpack('c*').each do |byte|\n passwd_bytes << (byte >> 8)\n passwd_bytes << byte\n end\n md << passwd_bytes.pack('c*')\n md << 'Mighty Aphrodite'.force_encoding('UTF-8')\n md\n end", "def createSHAHash(data)\n\t\treturn Digest::SHA1.digest(data)\n\tend", "def core_hmac_sha1(key, data)\n bkey = str2binb(key)\n bkey = core_sha1(bkey, key.length * $chrsz) if bkey.length > 16\n\n ipad = Array.new(16, 0)\n opad = Array.new(16, 0)\n # for(var i = 0; i < 16; i++)\n i = 0\n while i < 16\n ipad[i] = (bkey[i] || 0) ^ 0x36363636\n opad[i] = (bkey[i] || 0) ^ 0x5C5C5C5C\n i += 1\n end\n\n hash = core_sha1((ipad + str2binb(data)), 512 + data.length * $chrsz)\n core_sha1((opad + hash), 512 + 160)\n end", "def challenge1(s)\n Utils::Base64.encode(s.dup.extend(Utils::HexString).to_ascii)\n end", "def core_hmac_sha1(key, data)\n bkey = str2binb(key)\n if(bkey.length > 16) \n bkey = core_sha1(bkey, key.length * $chrsz)\n end\n\n ipad = Array.new(16, 0)\n opad = Array.new(16, 0)\n #for(var i = 0; i < 16; i++)\n i = 0\n while(i < 16)\n ipad[i] = (bkey[i] || 0) ^ 0x36363636\n opad[i] = (bkey[i] || 0) ^ 0x5C5C5C5C\n i += 1\n end\n\n hash = core_sha1((ipad + str2binb(data)), 512 + data.length * $chrsz)\n return core_sha1((opad + hash), 512 + 160)\n end", "def sha1\n RunLoop::Directory.directory_digest(path)\n end", "def create_digest(string, bit_size)\n Digest::SHA1.hexdigest(string).hex.to_s(2).rjust(40*4, '0')[0..bit_size-1].to_i(2)\nend", "def get_hash_sha1(user)\n begin\n guid = user['generateduid'][0].to_ruby\n password_hash = nil\n password_hash_file = \"#{@@password_hash_dir}/#{guid}\"\n if File.exists?(password_hash_file) and File.file?(password_hash_file)\n fail(\"Could not read password hash file at #{password_hash_file}\") if not File.readable?(password_hash_file)\n f = File.new(password_hash_file)\n password_hash = f.read\n f.close\n end\n password_hash\n rescue\n return String,new\n end\n end", "def hexdigest\n @digest.unpack('H*'.freeze).first\n end", "def hexdigest\n DigestUtils.pack_hexdigest(digest)\n end", "def call( *args )\n text = args.shift.to_s\n bitlength = (args.shift || 256).to_i\n Digest::SHA2.new( bitlength ).hexdigest( text )\n end", "def sha1_fingerprint\n Digest::SHA1.hexdigest(ssh_public_key_conversion).gsub(/(.{2})(?=.)/, '\\1:\\2')\n end", "def hmac_sha1 key, signature\n\t\trequire 'openssl'\n\t\treturn OpenSSL::HMAC.hexdigest('sha1', key, signature)\n\tend", "def compute_hash( path )\n res = '0'\n autorelease_pool { res = NSData.sha1FromContentsOfFile(path) }\n res\n end", "def encrypt(string)\n Digest::SHA1.hexdigest(string)\n end", "def encrypt(string)\n Digest::SHA1.hexdigest(string)\n end", "def to_sha2(salt = \"\")\n hashsum(:sha2, salt)\n end", "def sha\n result_hash['sha']\n end", "def digest\n Digest::SHA1.hexdigest(@pub.to_der)\n end", "def hmac_sha1(crypto, keyBytes, text)\n digest = OpenSSL::Digest::Digest.new(crypto)\n str2hex(OpenSSL::HMAC.digest(digest, keyBytes, text))\n end", "def hash(tx)\n Digest::SHA256.hexdigest(Digest::SHA256.hexdigest(tx))\nend", "def get_hash(input)\n return $hasher.reset.update(input).to_s\nend", "def file_sha1\n Digest::SHA1.file(self).hexdigest\n end", "def hexhash\n hash.to_s(16)\n end", "def create_sha1 str, namespace\nsha1 = Digest::SHA1.new\nsha1.update namespace.raw_bytes\nsha1.update str\nsum = sha1.digest\nraw = mask 5, sum[0..15]\nret = new raw\nret.freeze\nret\nend", "def digest\n @digest ||= Digest::SHA1.new.update(version.to_s)\n @digest.dup\n end", "def sha1_hexdigest\n @hexdigest ||= begin\n raise StateError, \"not finished reading object\" unless @closed\n @sha1.hexdigest\n end\n end", "def digest_sha1(*files)\n files.flatten.collect { |file| \n File.exists?(file) ? Digest::SHA1.hexdigest(File.read(file)) : nil\n }\n end", "def secure_digest(*args)\n Digest::SHA1.hexdigest(args.flatten.join('--'))\n end", "def secure_digest(*args)\n Digest::SHA1.hexdigest(args.flatten.join('--'))\n end", "def secure_digest(*args)\n Digest::SHA1.hexdigest(args.flatten.join('--'))\n end", "def create_hash(user_pw)\n return Digest::SHA1.hexdigest(user_pw)\nend", "def shortsha(n = 7)\n @sha.slice(0,n)\n end", "def gnu_hash(s)\n s.bytes.reduce(5381) { |acc, elem| (acc * 33 + elem) & 0xffffffff }\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def do_hash(input)\n a = OpenSSL::Digest.hexdigest(\"SHA224\", input).to_i % 19\n b = OpenSSL::Digest.hexdigest(\"SHA512\", input).to_i % 19\n [a, b]\n end", "def short_id\n Digest::SHA1.hexdigest(hex)[0, 6]\n end", "def checksum(hex)\n sha256(sha256(hex))[0...8]\n end", "def computed_sha(string)\n provider.computed_sha(string)\n end", "def pack_hexdigest(bin)\n bin.unpack('H*'.freeze).first\n end", "def pack_hexdigest(bin)\n bin.unpack('H*'.freeze).first\n end", "def to_sha(hash)\n # converts a hash to a SHA256\n return Digest::SHA256.hexdigest(JSON.dump(hash))\nend", "def to_sha512\n ::Digest::SHA512.hexdigest self\n end", "def digest_short_name(name)\n Digest::SHA2.hexdigest(name)[0..24]\n end", "def hash(*) end", "def hexdigest(value)\n Digest::SHA256.new.update(value).hexdigest\n end", "def sha\n id.sha\n end", "def findSmallHash(f)\r\n return Digest::SHA1.file(f).hexdigest()\r\nend", "def fedora_shasum\n \"urn:sha1:#{Digest::SHA1.file(file_path)}\"\n end", "def digest\n Digest::SHA2.new\n end", "def digest\n OpenSSL::HMAC.digest(\n OpenSSL::Digest.new('sha1'),\n secret,\n document\n )\n end", "def hexdigest!()\n #This is a stub, used for indexing\n end", "def cert_sha1_fingerprint certificate\n fingerprint = OpenSSL::Digest::SHA1.hexdigest certificate.to_der\n\n # Format it the same way OpenSSL does.\n fingerprint = fingerprint.chars.each_slice(2).map(&:join).join ':'\n fingerprint.upcase\n end", "def hash(block)\n Digest::SHA256.hexdigest(block.to_s.encode)\n end", "def checksum(hex)\n sha256(sha256(hex))[0...8]\nend", "def sha\n Digest::SHA2.new.update(self.source).to_s\n end", "def digest_name(name)\n Digest::SHA2.hexdigest(short_name(name))[0..24]\n end", "def hash99999\n return nil unless @parts\n\n k = construct\n return nil unless k\n\n Digest::SHA256.hexdigest(construct[0..-6] << '99999')[0..23]\n end" ]
[ "0.8102809", "0.80692303", "0.80692303", "0.8067103", "0.80053693", "0.7842483", "0.7842483", "0.77825", "0.7775534", "0.7670602", "0.758639", "0.7565584", "0.75380504", "0.74949116", "0.7429824", "0.7370881", "0.7357901", "0.7308927", "0.7293829", "0.7262612", "0.72485137", "0.7208118", "0.7131994", "0.7099551", "0.7061863", "0.7022653", "0.69881487", "0.6923244", "0.68849874", "0.6881862", "0.68704975", "0.6857237", "0.68269634", "0.68164635", "0.6808109", "0.6807653", "0.6739322", "0.67011493", "0.66971105", "0.66916865", "0.66534305", "0.65925074", "0.65830123", "0.6575931", "0.65681076", "0.65626067", "0.65516436", "0.6550387", "0.65476304", "0.65474784", "0.65156347", "0.65156347", "0.65139157", "0.65089095", "0.6501469", "0.6487538", "0.64820063", "0.6475471", "0.647346", "0.6460698", "0.64583945", "0.64556956", "0.6448759", "0.6433908", "0.64334875", "0.64334875", "0.64334875", "0.6432627", "0.6421516", "0.6417455", "0.64006543", "0.64006543", "0.64006543", "0.64006543", "0.64006543", "0.64006543", "0.64006543", "0.6395074", "0.6394302", "0.6389796", "0.6369935", "0.6351795", "0.6351795", "0.6343804", "0.6338364", "0.6327296", "0.63137406", "0.63126606", "0.63101983", "0.630627", "0.6301491", "0.6297048", "0.6296244", "0.62884605", "0.628837", "0.6283753", "0.6276458", "0.6268827", "0.62657344", "0.6263574" ]
0.6928819
27
SHA1 hash in salted form
def sha1_hex Digest::SHA1.hexdigest(salted_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_sha1(salt = \"\")\n hashsum(:sha1, salt)\n end", "def hex_sha1(s)\n binb2hex(core_sha1(str2binb(s), s.length * $chrsz))\n end", "def hex_sha1(s)\n return binb2hex(core_sha1(str2binb(s), s.length * $chrsz))\n end", "def sha1_base64\n str = Base64.encode64(Digest::SHA1.digest(salted_name)).strip\n str.tr('+/', '-_').gsub(/=/,'')\n end", "def sha1; end", "def sha1; end", "def create_salt\n d = Digest::SHA1.new\n now = Time.now\n d.update(now.to_s)\n d.update(String(now.usec))\n d.update(String(rand(0)))\n d.update(String($$))\n d.update('wxtengu.net')\n d.hexdigest\n end", "def to_sha1(length = 40)\n Digest::SHA1.hexdigest(self)[0,length]\n end", "def calc_x(username, password, salt)\n spad = if salt.length.odd? then '0' else '' end\n sha1_hex(spad + salt + sha1_str([username, password].join(':'))).hex\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(password + salt)\n end", "def to_sha2(salt = \"\")\n hashsum(:sha2, salt)\n end", "def sha1\n @sha1 ||= digest(path, :sha1)\n end", "def sha1(string)\n\tOpenSSL::Digest::SHA1.hexdigest(string)\nend", "def sha1?; @sha1; end", "def short_sha1(length=7)\n sha1[0, length]\n end", "def short_sha1(length=7)\n sha1[0, length]\n end", "def make_salt\n secure_hash(\"#Time.now.utc}--#{password}\")\n end", "def digest\n Digest::SHA1.hexdigest(self)\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def sha1=(_); end", "def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end", "def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end", "def make_salt\r\n self.salt = sha_hash(\"#(Time.now.to_s)--#(self.password)\")\r\n end", "def make_salt\n secure_hash(\"#{Time.now.utc}--#{password_digest}\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def make_salt\n\t secure_hash(\"#{Time.now.utc}--#{password}\")\n\tend", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def generate_salt\n Digest::SHA1.hexdigest(Time.now.to_f.to_s)\n end", "def create_hash(user_pw)\n return Digest::SHA1.hexdigest(user_pw)\nend", "def generate_salt\n Digest.hexencode(Digest::SHA1.digest(\n \"#{rand(2 ** 128) * ( Time.now.to_i * Process.pid)}\"))\n end", "def get_hash_sha1(user)\n begin\n guid = user['generateduid'][0].to_ruby\n password_hash = nil\n password_hash_file = \"#{@@password_hash_dir}/#{guid}\"\n if File.exists?(password_hash_file) and File.file?(password_hash_file)\n fail(\"Could not read password hash file at #{password_hash_file}\") if not File.readable?(password_hash_file)\n f = File.new(password_hash_file)\n password_hash = f.read\n f.close\n end\n password_hash\n rescue\n return String,new\n end\n end", "def spki_sha1_hash(cert)\n spki = OpenSSL::ASN1.decode(cert).value[0].find { |e|\n e.tag == 16 && e.value[0].tag == 16\n }\n return unless spki\n [\"sha1\", [OpenSSL::Digest::SHA1.digest(spki.to_der)].pack('m*').chomp].join(\"/\")\n end", "def sha(str)\n Digest::SHA1.hexdigest(str)[0, 40]\n end", "def core_sha1(x, len)\n # append padding\n x[len >> 5] ||= 0\n x[len >> 5] |= 0x80 << (24 - len % 32)\n x[((len + 64 >> 9) << 4) + 15] = len\n\n w = Array.new(80, 0)\n a = 1_732_584_193\n b = -271_733_879\n c = -1_732_584_194\n d = 271_733_878\n e = -1_009_589_776\n\n # for(var i = 0; i < x.length; i += 16)\n i = 0\n while i < x.length\n olda = a\n oldb = b\n oldc = c\n oldd = d\n olde = e\n\n # for(var j = 0; j < 80; j++)\n j = 0\n while j < 80\n if j < 16\n w[j] = x[i + j] || 0\n else\n w[j] = rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1)\n end\n\n t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)),\n safe_add(safe_add(e, w[j]), sha1_kt(j)))\n e = d\n d = c\n c = rol(b, 30)\n b = a\n a = t\n j += 1\n end\n\n a = safe_add(a, olda)\n b = safe_add(b, oldb)\n c = safe_add(c, oldc)\n d = safe_add(d, oldd)\n e = safe_add(e, olde)\n i += 16\n end\n [a, b, c, d, e]\n end", "def sha1(name)\n Digest::SHA1.file(path(name)).hexdigest\n end", "def digest( str )\n Digest::SHA1.hexdigest( str )\n end", "def sha1\n Digest::SHA1.hexdigest(subject.identification + 0.chr + source)\n end", "def hex(string)\n Digest::SHA1.hexdigest(string)\n end", "def calc_x(username, password, salt)\n sha512_hex(salt + sha512_str([username, password].join(':'))).hex\n end", "def pwdhash(salt=nil)\n salt = String.random_password.md5 if salt.nil?\n salt = salt[0..8]\n salt+(salt+self).sha1\n end", "def sha1(data)\n @connection.sha1(data)\n end", "def hash(password, salt)\n Digest::SHA512.hexdigest(\"#{ password }:#{ salt }\")\n end", "def salt() 'monkeynutzzSfaKT7CwImCHCH8Ow' end", "def core_sha1(x, len)\n # append padding\n x[len >> 5] ||= 0\n x[len >> 5] |= 0x80 << (24 - len % 32)\n x[((len + 64 >> 9) << 4) + 15] = len\n\n w = Array.new(80, 0)\n a = 1732584193\n b = -271733879\n c = -1732584194\n d = 271733878\n e = -1009589776\n\n #for(var i = 0; i < x.length; i += 16)\n i = 0\n while(i < x.length)\n olda = a\n oldb = b\n oldc = c\n oldd = d\n olde = e\n\n #for(var j = 0; j < 80; j++)\n j = 0\n while(j < 80)\n if(j < 16) \n w[j] = x[i + j] || 0\n else \n w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1)\n end\n\n t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)),\n safe_add(safe_add(e, w[j]), sha1_kt(j)))\n e = d\n d = c\n c = rol(b, 30)\n b = a\n a = t\n j += 1\n end\n\n a = safe_add(a, olda)\n b = safe_add(b, oldb)\n c = safe_add(c, oldc)\n d = safe_add(d, oldd)\n e = safe_add(e, olde)\n i += 16\n end\n return [a, b, c, d, e]\n end", "def encrypt(password)\n Digest::SHA1.hexdigest(\"--#{self.salt}--#{password}--\")\n end", "def calc_hash(pass)\n salt_cost = SCrypt::Engine.autodetect_cost(self[:salt])\n SCrypt::Engine.scrypt(pass, self[:salt], salt_cost, 32).unpack('H*').first\n end", "def sha1_fingerprint\n @sha1_fingerprint ||= @node['sha1Fingerprint']\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--NaCl--#{password}--\")\n end", "def createSHAHash(data)\n\t\treturn Digest::SHA1.digest(data)\n\tend", "def to_sha512(salt = \"\")\n hashsum(:sha512, salt)\n end", "def to_sha256(salt = \"\")\n hashsum(:sha256, salt)\n end", "def get_pre_keyed_hash(password)\n md = OpenSSL::Digest::SHA1.new\n passwd_bytes = []\n password.unpack('c*').each do |byte|\n passwd_bytes << (byte >> 8)\n passwd_bytes << byte\n end\n md << passwd_bytes.pack('c*')\n md << 'Mighty Aphrodite'.force_encoding('UTF-8')\n md\n end", "def salt\n # 72 bits\n SecureRandom.hex(9)\n end", "def salted_sha_encrypt(password)\n self.class.local_encrypt(password, salt)\n end", "def salted_hash(password)\n salt = SecureRandom.random_bytes(SALT_BYTE_SIZE)\n pbkdf2 = OpenSSL::PKCS5::pbkdf2_hmac_sha1(\n password,\n salt,\n CRYPTERATIONS,\n HASH_BYTE_SIZE)\n\n { salt: salt, pbkdf2: Base64.encode64(pbkdf2) }\n end", "def signature(args)\n str = args.to_s\n if str.length <= SHA1_THRESHHOLD\n args\n else\n Digest::SHA1.hexdigest args.to_s\n end\n end", "def encrypt(data)\n Digest::SHA1.hexdigest(data + @salt)\n end", "def encrypt(string)\n Digest::SHA1.hexdigest(string)\n end", "def encrypt(string)\n Digest::SHA1.hexdigest(string)\n end", "def serialize(hash, salt)\n hash + salt\n end", "def do_hash(input)\n a = OpenSSL::Digest.hexdigest(\"SHA224\", input).to_i % 19\n b = OpenSSL::Digest.hexdigest(\"SHA512\", input).to_i % 19\n [a, b]\n end", "def sha_hash (arg)\r\n Digest::SHA2.hexdigest(arg)\r\n end", "def sha1(data, c: true)\n if c && $linux && File.file?(PATH_SHA1)\n File.binwrite(\"util/#{HASH_INPUT_FN}\", data)\n code = shell(\"./util/sha1 ./util/#{HASH_INPUT_FN} ./util/#{HASH_OUTPUT_FN}\")\n return nil if !code\n hash = File.binread(\"util/#{HASH_OUTPUT_FN}\")\n FileUtils.rm([\"./util/#{HASH_INPUT_FN}\", \"./util/#{HASH_OUTPUT_FN}\"])\n hash\n else\n Digest::SHA1.digest(data)\n end\nrescue => e\n lex(e, 'Failed to compute the SHA1 hash')\n nil\nend", "def calculate_auth_string( salt, user )\n return hash( salt, @creds[user] )\n end", "def sha1\n RunLoop::Directory.directory_digest(path)\n end", "def digest(string, options = {})\n salt = options[:salt] || SecureRandom.base64\n Digest::SHA1.hexdigest(\"#{salt}--#{string}\")\n end", "def get_crypto_salt_hex\n return @crypto_salt if ! @crypto_salt\n @crypto_salt.unpack(\"H*\")\n end", "def hash(message)\n return Digest::SHA1.hexdigest(message)\n end", "def sha1\n Digest::SHA1.hexdigest self.record\n end", "def get_hash(input)\n return $hasher.reset.update(input).to_s\nend", "def secure_digest(*args)\n Digest::SHA1.hexdigest(args.flatten.join('--'))\n end", "def secure_digest(*args)\n Digest::SHA1.hexdigest(args.flatten.join('--'))\n end", "def secure_digest(*args)\n Digest::SHA1.hexdigest(args.flatten.join('--'))\n end", "def encrypt(password, salt=nil)\n salt ||= self.salt\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def digest_password\n token = nonce + timestamp + password\n Base64.encode64(Digest::SHA1.hexdigest(token)).chomp!\n end", "def calc_digest input\n Digest::SHA1.hexdigest(input.to_s).\n\n # XXX: surround all digits with alphabets so\n # Maruku doesn't change them into HTML\n gsub(/\\d/, 'z\\&z')\n end", "def hash(ts)\n sig = [\n Rackspace::Email::Api.configuration.user_key,\n Rackspace::Email::Api.configuration.user_agent,\n ts,\n Rackspace::Email::Api.configuration.api_key\n ].join('')\n\n Base64.encode64(Digest::SHA1.digest(sig))\n end", "def salt\n p_salt(profile.salt_bytes)\n end", "def hash_password\n self.password_salt = SecureRandom.base64(8) if self.password_salt == nil\n self.hashed_password = Digest::SHA1.hexdigest(self.password_salt + self.password)\n end", "def salt\n return NSEC3.encode_salt(@salt)\n end", "def fedora_shasum\n \"urn:sha1:#{Digest::SHA1.file(file_path)}\"\n end", "def salt_password( authkey, password )\n combined = authkey.to_s + password.to_s\n return Digest::MD5.hexdigest(combined)\n end", "def generate_salt\n return hash(\n Time.now.to_s,\n rand(999_999_999).to_s,\n Time.now.usec\n )\n end", "def hash(tx)\n Digest::SHA256.hexdigest(Digest::SHA256.hexdigest(tx))\nend", "def mutate_bcrypt_salt(_)\n 'au6lOASvp17AGsqkmE7'\n end", "def sha1(path)\n result = nil\n chunk_size = 10240\n File.open(path, \"r\") do |file|\n sha1 = Digest::SHA1.new\n\n while true\n chunk = file.read chunk_size\n break if ! chunk\n sha1.update chunk\n end\n result = sha1.hexdigest\n end\n result\n end", "def salt!\n returning self.class.generate_salt do |s|\n write_attribute(:salt, s)\n end\n end", "def authenticatable_salt; end", "def hash_user_password\n self.password = sha1_digest(self.user_password, self.salt)\n self.user_password = nil\n end", "def sha256; end", "def generate_sha(file)\n\n sha1 = Digest::SHA1.file file\n return sha1\n\nend", "def encode(plain_pass)\n md5 salt + plain_pass + salt\n end", "def digest\n @digest ||= Digest::SHA1.new.update(version.to_s)\n @digest.dup\n end", "def digest\n Digest::SHA1.hexdigest(@pub.to_der)\n end", "def computed_sha(string)\n provider.computed_sha(string)\n end" ]
[ "0.88181895", "0.77297646", "0.7697292", "0.7617789", "0.7549458", "0.7549458", "0.72615856", "0.72528857", "0.72353816", "0.7209765", "0.72053164", "0.72021896", "0.7101376", "0.7075738", "0.7062704", "0.7062704", "0.7052518", "0.70035803", "0.6998116", "0.6998116", "0.6998116", "0.6998116", "0.6998116", "0.6998116", "0.69830906", "0.69756866", "0.69756866", "0.6969116", "0.69480324", "0.6947197", "0.6944836", "0.689916", "0.6897616", "0.68649465", "0.6859608", "0.6839586", "0.6831173", "0.6786938", "0.6778591", "0.67671835", "0.67577815", "0.6749053", "0.6718035", "0.6706731", "0.66985637", "0.66977406", "0.66850144", "0.66710675", "0.665082", "0.66408896", "0.6632235", "0.66252905", "0.66146165", "0.65890396", "0.6573711", "0.6553745", "0.65379", "0.6534568", "0.6501135", "0.6483189", "0.64367425", "0.643506", "0.64006823", "0.64006823", "0.6395498", "0.6371968", "0.6361688", "0.63425744", "0.63370466", "0.63362163", "0.6335308", "0.6332736", "0.6327635", "0.6293352", "0.6293084", "0.62772524", "0.62772524", "0.62772524", "0.62727976", "0.62612367", "0.62504065", "0.6238554", "0.6232871", "0.6232072", "0.6197884", "0.6194506", "0.61902356", "0.6185647", "0.61833423", "0.6167254", "0.6161409", "0.61482877", "0.6142606", "0.61403465", "0.6135018", "0.6132028", "0.6129547", "0.6124207", "0.6122102", "0.6109377" ]
0.8545342
1
generates a random salt based upon the characters returned by salt()
def rand_salt result = '' salt().length.times {result << salt()[rand(salt().length),1]} result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_salt\n salt = \"\"\n 64.times { \n salt << (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }\n salt\n end", "def gen_salt\n chars = []\n 8.times { chars << SALT_CHARS[rand(SALT_CHARS.size)] }\n chars.join('') \n end", "def gen_salt\n chars = []\n 8.times { chars << SALT_CHARS[SecureRandom.random_number(SALT_CHARS.size)] }\n chars.join('')\n end", "def salt\n # 72 bits\n SecureRandom.hex(9)\n end", "def generate_salt\n return hash(\n Time.now.to_s,\n rand(999_999_999).to_s,\n Time.now.usec\n )\n end", "def create_salt()\n size=10\n pool = ('a'..'z').to_a + ('0'..'9').to_a\n self.salt= (1..size).collect{|a| pool[rand(pool.size)]}.join\n end", "def get_salt\n [Array.new(6){rand(256).chr}.join].pack(\"m\" ).chomp\n end", "def generate_salt\n self.salt = SecureRandom.base64(8)\n end", "def generate_salt\n Digest.hexencode(Digest::SHA1.digest(\n \"#{rand(2 ** 128) * ( Time.now.to_i * Process.pid)}\"))\n end", "def create_new_salt\n self.password_salt = [Array.new(6){rand(256).chr}.join].pack(\"m\").chomp\n end", "def generate_salt\n @salt = self.object_id.to_s + rand.to_s\n end", "def salt() 'monkeynutzzSfaKT7CwImCHCH8Ow' end", "def create_new_salt\n self.salt = Digest::SHA256.hexdigest(Time.now.to_s + rand.to_s)\n end", "def create_new_salt\n self.salt = Digest::SHA256.hexdigest(Time.now.to_s + rand.to_s)\n end", "def generate_salt\n self.salt = self.object_id.to_s + rand.to_s\n end", "def random_pbkdf2_salt\n encode_bytes(SecureRandom.random_bytes(16))\n end", "def generate_salt\n Digest::SHA1.hexdigest(Time.now.to_f.to_s)\n end", "def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end", "def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end", "def generate_salt\n salt_time = (ENV['RACK_ENV'] == 'test' ? 0.01 : 1.25)\n self[:salt] = SCrypt::Engine.generate_salt(max_time: salt_time)\n end", "def make_salt\n secure_hash(\"#Time.now.utc}--#{password}\")\n end", "def make_salt\n\t secure_hash(\"#{Time.now.utc}--#{password}\")\n\tend", "def create_new_salt\n self.salt = self.object_id.to_s + rand.to_s\n end", "def create_new_salt\n self.salt = self.object_id.to_s + rand.to_s\n end", "def make_salt\n secure_hash(\"#{Time.now.utc}--#{password_digest}\")\n end", "def create_new_salt\n\t\tself.salt = self.object_id.to_s + rand.to_s\n end", "def create_new_salt \n self.password_salt = self.object_id.to_s + rand.to_s\n end", "def mutate_bcrypt_salt(_)\n 'au6lOASvp17AGsqkmE7'\n end", "def init_salt\n self.salt = SecureRandom.hex(25) if self.salt.blank?\n end", "def create_salt\n\t\t\tself.password_seed = self.object_id.to_s + rand.to_s\n\t\tend", "def create_new_salt\n\t\t(self.salt = self.object_id.to_s + rand.to_s) if self.salt.nil?\n\tend", "def code_salt\n 'fbbc13ed4a51e27608037365e1d27a5f992b6339'\n end", "def create_salt\n d = Digest::SHA1.new\n now = Time.now\n d.update(now.to_s)\n d.update(String(now.usec))\n d.update(String(rand(0)))\n d.update(String($$))\n d.update('wxtengu.net')\n d.hexdigest\n end", "def salt!\n returning self.class.generate_salt do |s|\n write_attribute(:salt, s)\n end\n end", "def salt\n read_attribute(:salt) or returning self.class.generate_salt do |s|\n write_attribute(:salt, s)\n end\n end", "def password_salt\n \"choujin-steiner\"\n end", "def make_salt\r\n self.salt = sha_hash(\"#(Time.now.to_s)--#(self.password)\")\r\n end", "def get_salt\n @salt ||= BCrypt::Engine.generate_salt\n end", "def crypt(salt=nil)\n salt ||= ((SecureRandom.random_number(26) +\n (SecureRandom.random_number(2) == 0 ? 65 : 97)).chr +\n (SecureRandom.random_number(26) +\n (SecureRandom.random_number(2) == 0 ? 65 : 97)).chr)\n _crypt(salt)\n end", "def generate_salts\n @verify_salt = OpenSSL::Random.random_bytes(KEYLEN)\n @encrypt_salt = OpenSSL::Random.random_bytes(KEYLEN)\n end", "def salt\n if salt_path.file?\n salt_path.read\n else\n @salt ||= SecureRandom.bytes(Sia::Lock::DIGEST.new.digest_length)\n end\n end", "def salt\n p_salt(profile.salt_bytes)\n end", "def send_salt( session, user )\n salt = Digest::MD5.hexdigest( user + Time.now.strftime('%M%S') + rand(300).to_s )\n session.puts salt\n return salt\n end", "def salt\n read_attribute(:salt) || reset_salt\n end", "def salt\n nil\n end", "def salt\n @@salt ||= SALT\n end", "def generate_token(pass, salt)\n Digest::SHA256.hexdigest(pass + salt)\n end", "def get_crypto_salt_hex\n return @crypto_salt if ! @crypto_salt\n @crypto_salt.unpack(\"H*\")\n end", "def get_default_salt(mode)\r\n\r\n default_salt = nil\r\n\r\n if (mode == AES_128) || (mode == AES_256)\r\n default_salt = OpenSSL::Random.random_bytes(8)\r\n elsif mode == DES\r\n default_salt = OpenSSL::Random.random_bytes(2)\r\n end\r\n\r\n default_salt\r\n end", "def salt\n return NSEC3.encode_salt(@salt)\n end", "def generate_secret\n rand(36**secret_length).to_s(36)\n end", "def generate_password\r\n return rand(36 ** 20).to_s(36)\r\n end", "def generate_password\n [*('a'..'z'), *('A'..'Z'), *('0'..'9')].sample(8).join\n end", "def generate_password\n charset = %w{ 2 3 4 6 7 9 A C D E F G H J K M N P Q R T V W X Y Z @ # $ & ! }\n (0...6).map{ charset.to_a[rand(charset.size)] }.join\n end", "def generate_login_salt\n r = Aws::Kms.new('login', 'user').generate_data_key\n return r unless r.success?\n\n @login_salt_hash = r.data\n\n success\n end", "def generate_password\n password = [('a'..'z'), ('A'..'Z'),(0..9)].map { |i| i.to_a }.flatten\n (8...32).map { password[rand(password.length)] }.join\n end", "def authenticatable_salt; end", "def salt=(value)\n @@salt = value\n end", "def crypt3(password, salt = nil)\n characters = [ (\"A\" .. \"Z\").to_a, (\"a\" .. \"z\").to_a, (0 .. 9).to_a, \".\", \"/\" ].flatten\n if salt.nil?\n salt = \"\"\n 1.upto(8) { |index| salt = [salt, characters[rand(characters.length)].to_s].join }\n end\n encrypt = UnixCrypt::MD5.build(password, salt)\n return [\"{CRYPT}\", encrypt].join\n end", "def authenticatable_salt\n encrypted_password[0,29] if encrypted_password\n end", "def authenticatable_salt\n end", "def base_32_string_seed\n data.base_32_string_seed\n end", "def rand_pass(length=8)\n return rand(36**length).to_s(36)\nend", "def random_password\r\n chars = (\"a\"..\"z\").to_a + (\"1\"..\"9\").to_a \r\n newpass = Array.new(8, '').collect{chars[rand(chars.size)]}.join\r\n end", "def generate_seed\n update(seed: SecureRandom.hex(16))\n end", "def salted_password\n @salted_password ||= CredentialCache.cache(cache_key(:salted_password)) do\n hi(user.sasl_prepped_password)\n end\n end", "def generate_password( len = 6 )\n charset = %w{ 2 3 4 6 7 9 A C D E F G H J K M N P Q R T V W X Y Z a c d e g h j k m n p q r v w x y z }\n (0...len).map{ charset.to_a[rand(charset.size)] }.join\nend", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(password + salt)\n end", "def randstr\n\trand(36 ** 8).to_s(36)\nend", "def generate_random_id\n len = 8\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n newpass = \"\"\n 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }\n return newpass\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def make_hash\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n string = \"\"\n 20.times do\n string << chars[rand(chars.size-1)]\n end\n hash = Digest::SHA2.hexdigest(string)\n end", "def salted_hash(password)\n salt = SecureRandom.random_bytes(SALT_BYTE_SIZE)\n pbkdf2 = OpenSSL::PKCS5::pbkdf2_hmac_sha1(\n password,\n salt,\n CRYPTERATIONS,\n HASH_BYTE_SIZE)\n\n { salt: salt, pbkdf2: Base64.encode64(pbkdf2) }\n end", "def salted_name\n [api_name,rand_salt].join('--')\n end", "def crypt(password)\n characters = [ (\"A\" .. \"Z\").to_a, (\"a\" .. \"z\").to_a, (0 .. 9).to_a, \".\", \"/\" ].flatten\n salt = \"\"\n 1.upto(4) { |index| salt = [salt, characters[rand(characters.length)].to_s].join }\n encrypt = [\"{CRYPT}\", password.crypt(salt)].join\n return encrypt\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def make_up_password\n\to = [('a'..'z'), ('A'..'Z'), ('0'..'9')].map { |i| i.to_a }.flatten\n\tpass = (0...12).map { o[rand(o.length)] }.join + \"@\"\n\tputs \"Using #{pass} for password\\n\"\n\treturn pass\nend", "def ran_str_maker\r\n length = 10\r\n ran_str = rand(36**length).to_s(36)\r\n return ran_str\r\nend", "def random_pass\n\t\to = [('0'..'9'),('a'..'z'),('A'..'Z')].map{|i| i.to_a}.flatten\n\t\trand_pass = (0...8).map{ o[rand(o.length)] }.join\n\t\treturn rand_pass\n\tend", "def generate_address_salt\n\n r = Aws::Kms.new('api_key','user').generate_data_key\n return r unless r.success?\n\n @address_salt = r.data\n\n success\n\n end", "def salt_size\n @salt_size ||= 8\n end", "def random_string\n (0...8).map { (65 + rand(26)).chr }.join\n end", "def pseudo_random_chars(length=6)\n (0...length).map{(65 + rand(25)).chr}.join\n end", "def salt_password( authkey, password )\n combined = authkey.to_s + password.to_s\n return Digest::MD5.hexdigest(combined)\n end", "def salt_password( password )\n case placement.to_sym\n when :end\n password.to_s + string\n when :beginning\n string + password.to_s\n when :split\n string[0...(string.length/2).floor] + password.to_s + string[(string.length/2).floor...string.length]\n else\n raise RuntimeError, \"#{placement.to_s} is an invalid salt placement.\"\n end\n end", "def _random_seed(size=32)\n if defined? OpenSSL::Random\n return OpenSSL::Random.random_bytes(size)\n else\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n (1..size).collect{|a| chars[rand(chars.size)] }.join \n end\n end", "def generate(password)\n BCrypt::Password.create(secret + password).to_s\n end", "def random_code(len)\n #generat a random password consisting of strings and digits\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n newcode = \"\"\n 1.upto(len) { |i| newcode << chars[rand(chars.size-1)] }\n return newcode\n end", "def generate_string\n (0...6).map{(65+rand(26)).chr}.join\n end", "def generate_random_key\n (0...8).map { 65.+(rand(25)).chr }.join\n end", "def generate_secret\r\n ActiveSupport::SecureRandom.hex(64)\r\n end", "def rand_string(length = 10)\r\n rand(36**length).to_s(36)\r\n end", "def generate_key(salt, key_size = 64)\n key = \"#{salt}#{key_size}\"\n @cache_keys[key] ||= @key_generator.generate_key(salt, key_size)\n end", "def create_password(length)\n chars = ('a' .. 'z').to_a + ('1' .. '9').to_a + '%$?@!'.split(//)\n Array.new(length, '').collect { chars[rand(chars.size)] }.join\nend" ]
[ "0.8881849", "0.8676958", "0.86555225", "0.8479994", "0.8450091", "0.83791935", "0.83188355", "0.83142114", "0.81385106", "0.80923337", "0.8025615", "0.80214626", "0.7986649", "0.7986649", "0.79608107", "0.78630453", "0.77831805", "0.7756087", "0.7756087", "0.77432925", "0.772149", "0.7715909", "0.7678226", "0.7678226", "0.76597023", "0.76578534", "0.75965834", "0.75739205", "0.75660276", "0.75229245", "0.7505177", "0.74832654", "0.7461361", "0.7455112", "0.74250627", "0.72611415", "0.7253715", "0.7238958", "0.7194993", "0.7176618", "0.7088742", "0.70521593", "0.687892", "0.68532693", "0.6852758", "0.68329996", "0.6787597", "0.6770222", "0.6761349", "0.67528784", "0.6727804", "0.66903", "0.66406906", "0.6640689", "0.65876806", "0.65513813", "0.65488595", "0.65382427", "0.65153205", "0.6497477", "0.64899886", "0.6420392", "0.6411658", "0.63942116", "0.6389726", "0.63852453", "0.63764906", "0.63688874", "0.63532907", "0.6346668", "0.63374966", "0.63374966", "0.63374966", "0.63374966", "0.63374966", "0.63374966", "0.6325979", "0.6314912", "0.63148344", "0.6314403", "0.63055915", "0.62804353", "0.6272386", "0.6267564", "0.62561226", "0.6254759", "0.62509805", "0.62495774", "0.62493587", "0.62488073", "0.6244791", "0.623666", "0.623318", "0.62289774", "0.62265044", "0.62233156", "0.6214852", "0.6209384", "0.6205921", "0.6193352" ]
0.88802
1
:nodoc: Creates an object with the unique device ID uid and adds it to the IP Connection ipcon.
def initialize(uid, ipcon) super uid, ipcon @api_version = [2, 0, 0] @response_expected[FUNCTION_SET_VOLTAGE] = RESPONSE_EXPECTED_FALSE @response_expected[FUNCTION_GET_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE @response_expected[FUNCTION_SET_MODE] = RESPONSE_EXPECTED_FALSE @response_expected[FUNCTION_GET_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identify(uid)\n @uid = uid\n end", "def assign_id\n self.uid = service.mint unless new_record? && uid.present?\n self.id = service.hash(uid)\n end", "def assign_id\n self.uid = service.mint unless new_record? && uid.present?\n self.id = service.hash(uid)\n end", "def uid=(p0) end", "def register\n puts \"register\"\n ApiBase.client.put(\"/device/#{self.id}\", self.to_json)\n end", "def set_uid\n write_attribute('uid', self.uid)\n end", "def initialize(uid, options={})\n raise IncompleteUidError, \"Missing oid in uid\" if uid.oid.nil?\n @uid = uid\n @options = options\n end", "def set_uid\n @uid = Uid.find(params[:id])\n end", "def users cid = IPMI.lan.cid\n @users||= {}\n @users[cid] ||= IPMI::Users.new cid\n end", "def << device # 接入设备\r\n add device\r\n self\r\n end", "def initialize pid = nil\n @id = pid\n end", "def add_device(domain,input_name,device_ip)\n input_id = find_input_id(domain,input_name)\n begin\n Chef::Log.debug(\"Loggly/#{domain}: Attempting to add device #{device_ip} to input #{input_name}...\")\n http = Net::HTTP.new(\"#{domain}.loggly.com\")\n request = Net::HTTP::Post.new(\"/api/devices/\")\n request.set_form_data({'input_id' => input_id, 'ip' => device_ip, 'name' => node.name})\n request.set_content_type(\"text/plain\")\n request.basic_auth node[:loggly][:username], node[:loggly][:password]\n response = http.request(request)\n parsed_response = JSON.parse(http.request(request).body)\n Chef::Log.debug(\"Loggly/#{domain}: Received response code #{response.code}.\")\n unless response[\"id\"].nil?\n Chef::Log.info(\"Loggly/#{domain}: Added device #{device_ip} on input #{input_name} as device id #{parsed_response[\"id\"]}.\")\n end\n return response[\"id\"]\n rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,\n Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, JSON::ParserError => e\n Chef::Log.error(\"Loggly/#{domain}: Error adding node to input #{input_name}: #{e}\")\n end\n end", "def op_puid\n push puid\n end", "def initialize(options = {})\n super()\n @uid = options[:user_id]\n end", "def register(email, user_id = nil)\n attrs = {\n device: device_data\n }\n attrs[:email] = email if email\n attrs[:userId] = user_id if user_id\n Iterable.request(conf, base_path).post(attrs)\n end", "def register\n physical_entity = {name: @name, description: @description, location:@location}\n virtual_entity = {uuid: nil}\n body = {body: {device: {name: @name, \n description: @description, \n model_name: @model, \n location: @location,\n physical_entity_attributes: physical_entity,\n virtual_entity_attributes: virtual_entity}}}\n response = self.class.post(API+'/devices', body)\n @uuid = response['uuid']\n end", "def <<(device)\n return if find_by_ip(device.ip)\n @items << device\n end", "def user_for_udid\n unless params[:udid]\n head :bad_request\n logger.warn 'did not send a udid'\n return\n end\n\n # see if udid exist in db\n the_udid = UniqueDeviceIdentifier.where(udid: params[:udid], device_type: params[:device_type]).sorted.last\n udid_user = the_udid ? UdidUser.where(unique_device_identifier: the_udid.id).sorted.last : nil\n if the_udid && udid_user\n\n # ID of most recent user to use this device\n\n id = udid_user.user_id\n\n # return that user\n @user = specific_show(User, id)\n\n # this user was already in db\n @user.newly_created_user = false\n else\n # create user and a udid in db and pair them up in join table\n udid = UniqueDeviceIdentifier.current_or_create_new(udid: params[:udid], device_type: params[:device_type])\n @user = User.create\n @user.unique_device_identifiers << udid\n\n UdidUser.current_or_create_new(unique_device_identifier_id: udid.id, user_id: @user.id)\n\n @user.newly_created_user = true\n end\n @user.save\n\n # start session as in normal creation\n session[:user_id] = @user.id\n session[:api_key] = @user.api_key\n end", "def initialize(ui)\n unless ui.respond_to?(:received)\n raise Errors::WrongObjectError, \"User Interface must have 'received' method.\"\n end\n @ui = ui\n @receiver = Net::Receiver.new UDP_PORT, TCP_PORT\n\n @receiver.register(self)\n\n ip = Socket.ip_address_list.detect{|intf| intf.ipv4_private?}.ip_address\n sender = Net::Sender.new UDP_PORT, TCP_PORT\n @myself = Node.new ip\n\n @known_nodes = []\n end", "def set_device\n @device = ::Pushar::Core::Device.includes(:app).find(params[:id])\n end", "def uid\n @uid\n end", "def uid\n @uid ||= (@in['uid_hi'] << 16) | @in['uid_lo']\n end", "def uid; end", "def create_nic(options)\n Nic.create(options.merge(:server_id => self.id))\n end", "def set_user_login_record\n user_login = UserLogin.create!(:user_id => @user.id, :ip_address => @remote_ip)\n end", "def id\n @uid\n end", "def make_user_device(user, device,\n ua_token = '64ce3cbfb716c0eb61adc2d6da1f2781e8b74d39b49c1e521108db9109b1be35')\n @@user_device_start_count += 1\n UserDevice.create!(user_id: user.id,\n device_id: device.id,\n name: \"Test Device\",\n )\n end", "def socket\n @socket ||= ::UDPSocket.new\n end", "def create\n REDIS.sadd REDIS_SET, @user.id\n self.class.broadcast\n end", "def register_ip(user_ip)\r\n # Checking database for existing record\r\n {\r\n :ip => user_ip,\r\n :time => Time.now # Check date format compability\r\n }\r\n # Inserting or updating a record\r\n end", "def uid(value)\n @config[:uid] = value\n end", "def uid() end", "def create name = DEFAULT_DEVICE_NAME, id = DEFAULT_INPUT_ID\n if not name.kind_of? String\n raise ArgumentError, \"1st arg expect String\"\n elsif not id.kind_of? Revdev::InputId\n raise ArgumentError, \"2nd arg expect Revdev::InputId\"\n end\n\n uud = UinputUserDev.new({ :name => name, :id => id,\n :ff_effects_max => 0, :absmax => [20],\n :absmin => [30], :absfuzz => [4],\n :absflat => [5] })\n @file.syswrite uud.to_byte_string\n\n set_all_events\n\n @file.ioctl UI_DEV_CREATE, nil\n @is_created = true\n end", "def device_ipaddress=(_arg0); end", "def device_ipaddress=(_arg0); end", "def identify\n Identity.new(self).create\n nil\n end", "def identify\n Identity.new(self).create\n nil\n end", "def identity=(value) @raw_socket.identity = value; end", "def device\n @device ||= Device.new(ua)\n end", "def initialize(env_or_object = nil, attributes = nil)\n # if it's an object with an id, then return that\n if env_or_object.respond_to?(:id) and env_or_object.id.is_a?(BSON::ObjectId)\n user_id = env_or_object.id.to_s\n attributes = {\"$set\" => attributes || {}}\n Webmetrics.users.update({\"user_id\" => user_id}, attributes, :upsert => true, :safe => true)\n\n # set newly created id\n user = Webmetrics.users.find_one({\"user_id\" => user_id})\n self.id = user[\"_id\"] if user.present?\n else\n # perform upsert to build object\n self.env = env_or_object\n self.id = parse_id(env_or_object) || BSON::ObjectId.new.to_s\n\n attributes = {\"$set\" => build_attributes(env_or_object).merge(attributes || {})}\n Webmetrics.users.update({\"_id\" => id}, attributes, :upsert => true)\n end\n\n rescue Exception => e\n if Webmetrics.suppress_errors\n puts \"Unable to log metrics: #{e.to_s}\"\n else\n raise e\n end\n end", "def device_id=(value)\n @device_id = value\n end", "def device_id=(value)\n @device_id = value\n end", "def device_id=(value)\n @device_id = value\n end", "def device_id=(value)\n @device_id = value\n end", "def druid_db_obj\n @druid_db_obj ||= Druid.find_or_create_by!(druid: druid)\n end", "def create\n @user = User.external(user_params, request.headers[\"HTTP_APP_VERSION\"].to_i)\n if @user.errors.blank?\n render json: @user.user_show, status: :created\n if params[:device].present? and params[:device][:device_id].present?\n @device_data=Device.where(\"device_id\": params[:device][:device_id]).first\n @device_data.update(\"user_id\": @user.id) if @device_data.present?\n end\n else\n render_api_error(11, 401, \"error\", @user.try(:errors))\n end\n end", "def register\n instances = @volt_app.store.active_volt_instances\n instances.where(server_id: @server_id).first.then do |item|\n ips = local_ips.join(',')\n time = Time.now.to_i\n if item\n item.assign_attributes(ips: ips, time: time, port: @port)\n else\n instances << {server_id: @server_id, ips: ips, port: @port, time: time}\n end\n end\n end", "def create_custom_object_by_uid(object_name, payload, uid)\n if isNullOrWhiteSpace(object_name)\n raise LoginRadius::Error.new, getValidationMessage('object_name')\n end\n if payload.blank?\n raise LoginRadius::Error.new, getValidationMessage('payload')\n end\n if isNullOrWhiteSpace(uid)\n raise LoginRadius::Error.new, getValidationMessage('uid')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n query_parameters['objectName'] = object_name\n\n resource_path = 'identity/v2/manage/account/' + uid + '/customobject'\n post_request(resource_path, query_parameters, payload)\n end", "def set_device\n @device = current_user.devices.where(id:params[:id]).first\n end", "def uid_add(type, uid)\n val_fatal(\"Invalid UID type\", type) unless UID_TYPES.include?(type)\n uid = uid.to_s\n val_fatal(\"Pre-existing UID\", uid) if self.uids[type].include?(uid)\n self.uids[type].push(uid)\n end", "def add client_id, socket\n @clients[client_id] = socket\n end", "def create\n path = wmi_object.put_.path\n @wmi_object = (connection.get(path)) \n end", "def initialize(ip_address, current_user_session)\n @guid = UUIDTools::UUID.random_create.to_s\n @ip_address = ip_address\n @current_session = current_user_session\n end", "def add_with_id item\n id = @id_gen.gen\n #here we automatically mix in the IdManaged protocol\n item.extend IdManaged\n item.id_manager = self\n item.pool_id =id\n @arr << item\n end", "def initialize(session_key, uid)\n @session_key = session_key\n @uid = uid\n end", "def initialize( * )\n\t\t@socket = UDPSocket.new\n\tend", "def set_order_uid\n return if uid.present?\n begin\n self.uid = SecureRandom.uuid\n end while self.class.exists?(uid: self.uid)\n end", "def initialize(attributes = {})\n @id = attributes[:id] || attributes[:device_id]\n @user_id = attributes[:user_id] || attributes[:uuid]\n @token = attributes[:token] || attributes[:push_token]\n @type = attributes[:type] || attributes[:push_type]\n @application = attributes[:application]\n end", "def set_uid\n unless gn.blank? || sn.blank?\n self['uid'] = gn.to_slug.approximate_ascii.normalize.to_s + '.' + sn.to_slug.approximate_ascii.normalize.to_s if uid.blank?\n end\n end", "def create\n to_server(collection_url, attributes_to_payload) do |response|\n self.uuid = response.data[\"uuid\"]\n end\n end", "def create\n if resource[:ipsource] == \"static\"\n ip = resource[:ip]\n netmask = resource[:netmask]\n gateway = resource[:gateway]\n end\n if resource[:snmp]\n snmp = resource[:snmp]\n end\n ipsrc = resource[:ipsource]\n if resource[:vlanid]\n vlanid = resource[:vlanid]\n end\n enable_channel\n\n end", "def register_device\n user = User.find(params[:user_id])\n\n user.devices.find_or_create_by(token: params[:token], os: params[:os])\n\n head :ok\n end", "def initialize\n @uuid = \"_\" + UUID.new.generate\n end", "def uid\n (@in['uid_hi'] << 16) | @in['uid_lo']\n end", "def << device\r\n devices << device\r\n end", "def assign_id\n Sufia::IdService.mint if Sufia.config.enable_noids\n end", "def xobj2device(xobj, xpath, xpath_context)\n device = Packet::Device.new\n device.client = @packet\n\n DEPLOY_ATTRIBUTES.each do |packet_name, template_name|\n key = \"@#{packet_name}\".to_sym\n val = xobj[\"#{xpath}/#{template_name}\"]\n\n if @globals[template_name]\n # Parameters specified globaly (on host level) can't\n # be overriden on device level. I.e. Packet PROJECT set\n # for (one)host deployer, can't be changed for (one)vm.\n if val.nil? or (val == @globals[template_name])\n device.instance_variable_set(key, @globals[template_name])\n else\n raise \"Parameter #{template_name} can't be overriden\"\n end\n elsif ! val.nil?\n # TODO: make special handling part of DEPLOY_ATTRIBUTES?\n if template_name == 'TAGS'\n val = val.split(',').map { |v| v.strip }\n end\n\n device.instance_variable_set(key, val)\n end\n end\n\n # TODO: can user's & ours userdata cooperate?\n unless device.userdata\n device.userdata = generate_cc(xobj, xpath_context)\n end\n\n device\n end", "def user() @user = DiggUser.new end", "def facebook_id=(uid)\n self.uid = uid\n end", "def initialize(uid, ipcon)\n super uid, ipcon\n\n @api_version = [2, 0, 0]\n\n @response_expected[FUNCTION_GET_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[FUNCTION_SET_GROUP] = RESPONSE_EXPECTED_FALSE\n @response_expected[FUNCTION_GET_GROUP] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[FUNCTION_GET_AVAILABLE_FOR_GROUP] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE\n @response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[FUNCTION_SET_INTERRUPT] = RESPONSE_EXPECTED_TRUE\n @response_expected[FUNCTION_GET_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[CALLBACK_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_FALSE\n @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE\n\n @callback_formats[CALLBACK_INTERRUPT] = 'S S'\n end", "def assign_uuid\n self.id = UUIDTools::UUID.timestamp_create().to_s\n end", "def create\n\n # Save last known user's geo location\n if !params[:geo_lat].nil? && !params[:geo_lon].nil?\n @current_user.geo_lat = params[:geo_lat]\n @current_user.geo_lon = params[:geo_lon]\n if !params[:timezone].nil?\n @current_user.timezone = params[:timezone]\n end\n @current_user.save\n end\n\n @api_v1_device = Api::V1::Device.where('token = ? AND user_id = ? ', params[:token], @current_user.id).first\n\n if @api_v1_device.nil?\n @api_v1_device = Api::V1::Device.new(api_v1_device_params) \n @api_v1_device.user_id = @current_user.id \n \n if !@api_v1_device.save\n render json: @api_v1_device.errors, status: :unprocessable_entity\n else\n head :no_content\n end\n else\n head :no_content\n end\n end", "def initialize(connection, username, password, uid, in_cipher, out_cipher)\n @connection = connection\n @username = username\n @password = password\n @uid = uid\n @in_cipher = in_cipher\n @out_cipher = out_cipher\n end", "def initialize(uid, ipcon)\n super uid, ipcon\n\n @api_version = [2, 0, 0]\n\n @response_expected[FUNCTION_SET_PORT] = RESPONSE_EXPECTED_FALSE\n @response_expected[FUNCTION_GET_PORT] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[FUNCTION_SET_PORT_CONFIGURATION] = RESPONSE_EXPECTED_FALSE\n @response_expected[FUNCTION_GET_PORT_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE\n @response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[FUNCTION_SET_PORT_INTERRUPT] = RESPONSE_EXPECTED_TRUE\n @response_expected[FUNCTION_GET_PORT_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[CALLBACK_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_FALSE\n @response_expected[FUNCTION_SET_PORT_MONOFLOP] = RESPONSE_EXPECTED_FALSE\n @response_expected[FUNCTION_GET_PORT_MONOFLOP] = RESPONSE_EXPECTED_ALWAYS_TRUE\n @response_expected[CALLBACK_MONOFLOP_DONE] = RESPONSE_EXPECTED_ALWAYS_FALSE\n @response_expected[FUNCTION_SET_SELECTED_VALUES] = RESPONSE_EXPECTED_FALSE\n @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE\n\n @callback_formats[CALLBACK_INTERRUPT] = 'k C C'\n @callback_formats[CALLBACK_MONOFLOP_DONE] = 'k C C'\n end", "def id; Common.device_id(@handle); end", "def find_or_create(uid)\n is_new = false\n @user = User.where(\"uid =?\",uid).first\n is_new = true if @user.nil?\n @user = User.new() if @user.nil?\n @user.uid = uid\n @user.is_new = is_new\n @user\n end", "def initialize(options)\n\n # Create logger\n @logger = options[:logger] || logger\n @logger.debug \"XivelyConnector::Device initialize\"\n\n # initialize parent\n data = options[:response]\n @datapoint_buffer_size = options[:datapoint_buffer_size] || 1\n @only_save_changes = options[:only_save_changes] || false\n super(options[:response])\n\n # Convert date strings to ruby dates\n @created = Time.iso8601(created) # 2014-03-28T16:36:30.651731Z\n @updated = Time.iso8601(updated) # 2014-03-28T16:45:05.206472Z\n\n # xively-rb doesn't set location attributes correctly, so do so here\n if data['location']\n loc = data['location']\n @has_location = true\n @location_name = loc['name'] if\n @location_domain = loc['domain'] if loc['domain']\n @location_lon = loc['lon'] if loc['lon']\n @location_lat = loc['lat'] if loc['lat']\n @location_ele = loc['ele'] if loc['ele']\n @location_exposure = loc['exposure'] if loc['exposure']\n @location_disposition = loc['disposition'] if loc['disposition']\n @location_waypoints = loc['waypoints'] if loc['waypoints']\n end\n\n # Setup enhanced datastreams\n @datastream_ref = {}\n datastreams.each { |ds| @datastream_ref[ds.id] = ds }\n\n @logger.info \"Initialized Xively Device #{@id} with #{datastreams.size} datastreams\"\n\n end", "def initialize(server, uid, nick, ident, dhost, rhost, ip, ts, umodestr, gecos)\n # We only care about this one umode anyway\n @isoper = umodestr.include?('o')\n @isadmin = umodestr.include?('a')\n @olevel = if @isadmin\n \"admin\"\n elsif @isoper\n \"oper\"\n else\n\t nil\n end\n @uid = uid\n @nick = nick\n @ident = ident\n @dhost = dhost\n @rhost = if rhost == '*' # i.e., no real host\n ip\n else\n rhost\n end\n @ip = ip\n @ts = ts.to_i()\n @gecos = gecos\n @certfp = nil\n @su = nil\n @channels = []\n @server = server\n\n @@users_by_uid[@uid] = self\n @@users_by_nick[Channel.to_lower(@nick)] = self\n end", "def generate_uid\n if self.id && !self.uid\n self.uid = \"cld-#{self.id}\"\n Group.update_all({uid:self.uid}, {id: self.id})\n end\n return true\n end", "def set_current_device\n return false if ENV['create_device'].nil? && ENV['device_id'].nil?\n device_id = fetch_variable('device_id')\n\n TestChamber::Device.new.tap do |device|\n device.udid = device_id if device_id\n TestChamber.current_device = device\n puts \"Using device with ID: #{device.udid}\"\n end\nend", "def register(object)\n object_id = SecureRandom.uuid\n @objects[object_id] = object\n object_id\n end", "def set_api_v1_user_device_info\n @api_v1_user_device_info = Api::V1::UserDeviceInfo.find(params[:id])\n end", "def set_device\n @device = current_user.devices.find(params[:id])\n end", "def uid_init(userid, password, profile, guest = 'y')\r\n\t\t\t@userid = userid\r\n\t\t\t@password = password\r\n\t\t\t@profile = profile\r\n\t\t\t@guest = guest\r\n\t\t\treturn self\r\n\t\tend", "def uid\n id && Base58GMP.encode(id)\n end", "def user_setup\n\t\tif self.id.blank?\n\t\t\tself.id = self.email\n\t\t\n\t\tend\n\tend", "def uid= uid\n @collectible_user_id = uid.to_i\n # cached_ref # Bust the cache but update the collectible attributes to reflect the ref assoc'd with this id\n # Work back up the hierarchy\n super if defined? super\n end", "def generate_uid\n if self.id && !self.uid\n self.uid = \"app-#{self.id}\"\n App.update_all({uid:self.uid}, {id: self.id})\n end\n return true\n end", "def suuid; uuid; end", "def initialize(id) @id = id; end", "def initialize(id) @id = id; end", "def id\n self[:ip_id]\n end", "def register_for(id); end", "def find_or_create_via_omniauth(attributes, existing_user=nil)\n identity = lookup(attributes[:uid], attributes[:provider])\n if(identity)\n Fission::Data.logger.info \"Found existing identity: #{identity.inspect}\"\n else\n Fission::Data.logger.info \"No existing identity found! Creating new user: #{attributes[:uid]}\"\n source = Source.find_or_create(:name => attributes[:provider])\n username = attributes[:info].try(:[], :nickname) ||\n attributes[:info].try(:[], :login) ||\n attributes[:info].try(:[], :email) ||\n unique_id\n user = User.find_by_username(username)\n unless(user)\n user = User.new(:username => username)\n user.run_state.identity_provider = attributes[:provider]\n user.source = source if source\n user.save\n end\n identity = Identity.new\n identity.user = user\n end\n identity.provider = attributes[:provider]\n identity.uid = attributes[:uid]\n identity.extras = attributes[:extras]\n identity.credentials = attributes[:credentials]\n identity.infos = attributes[:info]\n identity.source = source if source\n # Set login time\n identity.user.session[:login_time] = Time.now.to_f\n identity.user.save_session\n unless(identity.save)\n Fission::Data.logger.error identity.errors.inspect\n raise identity.errors unless identity.save\n end\n identity\n end", "def generate_uid\n begin\n # .uuid or .hex? both seem to do the same job\n self.uid = SecureRandom.uuid.gsub(/[-]/, '')\n end while self.class.exists?(uid: self.uid)\n end", "def get_uid_int\n self.uid.to_i\n end", "def uid_from(*args)\n build_uid(*args)\n end", "def create\n unless current_user\n render json: current_user, status: :ok and return\n end \n existing_device=Device.find_by(endpoint: params[:subscription][:endpoint])\n if existing_device\n #endpoint= params[:subscription][:endpoint]\n #p256dh= params[:subscription][:keys][:p256dh]\n #auth= params[:subscription][:keys][:auth]\n #existing_device.update(endpoint: endpoint,p256dh: p256dh, auth: auth)\n #render json: existing_device, status: :ok and return\n existing_device.destroy\n end\n @device = Device.new()\n @device.user_id=current_user.id\n\n @device.endpoint= params[:subscription][:endpoint]\n @device.p256dh= params[:subscription][:keys][:p256dh]\n @device.auth= params[:subscription][:keys][:auth]\n# @device.save\n respond_to do |format|\n if @device.save\n# format.html { redirect_to @device, notice: 'Device was successfully created.' }\n format.json { render :json => {:message=>\"Sucess\"}}\n# @message = {\n# title: \"Llamado para\",\n# body: \"ELba Neado\",\n# icon: \"/icon-min.png\",\n# url: \"/events/\"\n#}\n# Webpush.payload_send(\n# message: JSON.generate(@message),\n# endpoint: @device.endpoint,\n# p256dh: @device.p256dh,\n# auth: @device.auth,\n# ttl: 24 * 60 * 60,\n# vapid: {\n# subject: 'mailto:sender@example.com',\n# public_key: ENV['VAPID_PUBLIC_KEY'],\n# private_key: ENV['VAPID_PRIVATE_KEY']\n# }\n# )\n# \n# else\n# format.html { render :new }\n# format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "def switch_on(active_user, tag = nil)\n update(status: :active,current_user: active_user.id)\n mqtt_control_on\n socket_usage = SocketUsage.create!(user: active_user,\n el_socket: self, start_time: Time.now.utc,\n date: Date.today, start_tag: tag)\n\n active_user.last_usage = socket_usage.id\n active_user.save\n end", "def initialize(attrs)\n super\n @ccapi = Ccontact.new()\n end", "def add(hid, conf)\n return if @mutex.synchronize { @clusters.key?(hid) }\n\n begin\n cluster = Cluster.new(hid, @client)\n error = ''\n rescue StandardError => e\n cluster = nil\n error = e.message\n\n if !conf.nil?\n mdc = MonitorClient.new(conf[:address], conf[:port], hid)\n mdc.beacon_host_udp(false, error)\n end\n end\n\n add_host(hid, cluster, error)\n\n $logger.info(\"Registered host #{hid} #{error}\")\n end" ]
[ "0.5802023", "0.5724867", "0.5724867", "0.56312394", "0.558753", "0.5515247", "0.5496093", "0.54091233", "0.5360705", "0.53069973", "0.5303579", "0.52928525", "0.5257775", "0.5236803", "0.5218653", "0.52055043", "0.5170483", "0.5138714", "0.51030946", "0.5093923", "0.50928706", "0.508468", "0.5076031", "0.50728583", "0.50674564", "0.5065341", "0.50648975", "0.5028781", "0.5007967", "0.5000652", "0.49726462", "0.49444684", "0.49357554", "0.49311033", "0.49311033", "0.4923815", "0.4923815", "0.49223956", "0.49096113", "0.4903218", "0.4893692", "0.4893692", "0.4893692", "0.4893692", "0.48922822", "0.48844588", "0.48782447", "0.48724014", "0.48678333", "0.48435274", "0.4841841", "0.4840726", "0.48382416", "0.48259935", "0.48244235", "0.482292", "0.48194772", "0.48148677", "0.48139694", "0.48078", "0.48073474", "0.48052377", "0.47918573", "0.4791019", "0.47908783", "0.47862515", "0.47860125", "0.47840887", "0.47703302", "0.47634113", "0.475429", "0.47489506", "0.47434276", "0.4742444", "0.47363892", "0.47359446", "0.47356012", "0.473392", "0.47339147", "0.4732868", "0.473282", "0.47325543", "0.47316825", "0.47298023", "0.47293037", "0.47276235", "0.47122636", "0.47119907", "0.47085905", "0.4701077", "0.4701077", "0.47007662", "0.46962473", "0.46949252", "0.4690529", "0.46896085", "0.46853206", "0.46833077", "0.4680955", "0.4680487", "0.46788222" ]
0.0
-1
Sets the voltage in mV. The possible range is 0V to 5V (05000). Calling this function will set the mode to 0 (see BrickletAnalogOutset_mode). The default value is 0 (with mode 1).
def set_voltage(voltage) send_request(FUNCTION_SET_VOLTAGE, [voltage], 'S', 0, '') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def voltage\n lfac_device = '/sys/bus/iio/devices/iio:device0/'\n raw_voltage = File.read(File.join(lfac_device, 'in_voltage0_raw')).strip.to_f\n scale = File.read(File.join(lfac_device, 'in_voltage_scale')).strip.to_f\n @voltage = raw_voltage * scale\n end", "def voltage\n raw_voltage = File.read('/sys/bus/iio/devices/iio:device0/in_voltage0_raw').strip.to_f\n scale = File.read('/sys/bus/iio/devices/iio:device0/in_voltage_scale').strip.to_f\n @voltage = raw_voltage * scale\n end", "def v11_0=(value)\n @v11_0 = value\n end", "def v11_0=(value)\n @v11_0 = value\n end", "def vol_memory_mode=(vol_memory_mode)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"1LM\", \"2LM\"])\n unless validator.valid?(vol_memory_mode)\n fail ArgumentError, \"invalid value for \\\"vol_memory_mode\\\", must be one of #{validator.allowable_values}.\"\n end\n @vol_memory_mode = vol_memory_mode\n end", "def v5_0=(value)\n @v5_0 = value\n end", "def voltage(code, gain=0.4936)\n\t return (code.to_f / @max.to_f) * (2.048 / gain.to_f) * (180.0 / 33.0)\n\tend", "def mute(value)\n @ole.Mute = value\n nil\n end", "def velocity_limit=(new_velocity_limit)\n Klass.setVelocityLimit(@handle, @index, new_velocity_limit.to_f)\n\t new_velocity_limit\n end", "def vel=(v)\n self.mo = Vector[mo[0], *(mo[0]*v.normalize)]\n end", "def mute\n @volume = 0\n end", "def pin_std_set_value(pin, value, mode)\n @ramps_arduino.execute_command(\"F41 P#{pin} V#{value} M#{mode}\", false, @status_debug_msg)\n end", "def velocity_limit=(new_velocity_limit)\n Klass.setVelocityLimit(@handle, @index, new_velocity_limit.to_f)\n new_velocity_limit\n end", "def pin_std_set_value(pin, value, mode)\n execute_command(\"F41 P#{pin} V#{value} M#{mode}\", false, @status_debug_msg)\n #execute_command(\"F41 P#{pin} V#{value}\", false, true)\n end", "def set_mode(m)\n @mode = m\n end", "def switch_vsync _value=0\n send_cmd(\"switch_vsync #{_value}\")\n end", "def update(mute, volume)\n if mute\n vol = 0\n @cMuteLabel.visible = true\n @cVolumeValue.visible = false\n else\n vol = 100 - volume\n @cMuteLabel.visible = false\n @cVolumeValue.visible = true\n end\n @cVolumeValue.text = sprintf(MENU_CONFIG::VOL_PATTERN, vol)\n @ucVolumeBar.value = vol\n end", "def update(mute, volume)\n if mute\n vol = 0\n @cMuteLabel.visible = true\n @cVolumeValue.visible = false\n else\n vol = 100 - volume\n @cMuteLabel.visible = false\n @cVolumeValue.visible = true\n end\n @cVolumeValue.text = sprintf(MENU_CONFIG::VOL_PATTERN, vol)\n @ucVolumeBar.value = vol\n end", "def volume=(level)\n send_packet(:volume, {\n volume: level.clamp(0, 1000)\n })\n end", "def get_voltage\n send_request(FUNCTION_GET_VOLTAGE, [], '', 2, 'S')\n end", "def pin_std_set_value(pin, value, mode)\n start_command(\"F41 P#{pin} V#{value} M#{mode}\", false, @status_debug_msg)\n end", "def set_Volume(value)\n set_input(\"Volume\", value)\n end", "def set_port_monoflop(port, selection_mask, value_mask, time)\n send_request(FUNCTION_SET_PORT_MONOFLOP, [port, selection_mask, value_mask, time], 'k C C L', 0, '')\n end", "def v5_1=(value)\n @v5_1 = value\n end", "def mode=(mode)\n super(0100000 | (mode & 07777))\n end", "def vmotion=(value)\n Puppet.debug \"Updating vmotion status flag of specified portgroup.\"\n begin\n setupvmotion\n rescue Exception => e\n fail \"Unable to configure the vMotion on a port group because the following exception occurred: -\\n #{e.message}\"\n end\n end", "def mute _value=0\n send_cmd(\"mute #{_value}\")\n end", "def mode=(mode)\n #Can be Rufirmata::INPUT, OUTPUT, ANALOG, PWM or UNAVAILABLE\n return if @mode == mode #Nothing is changing, so nothing to do\n\n raise \"#{to_s} does not have PWM capabilities\" if mode == Rufirmata::PWM and !pwm\n raise \"#{to_s} cannot be used through Firmata\" if @mode == Rufirmata::UNAVAILABLE\n\n changing :pin_mode_changed, :changes=>{ :from=>@mode, :to=>mode } do\n @mode = mode\n unless mode == Rufirmata::UNAVAILABLE\n board.write_command(Rufirmata::SET_PIN_MODE, pin_number, mode)\n enable_reporting if mode == Rufirmata::INPUT\n end\n end\n\n end", "def v10_0=(value)\n @v10_0 = value\n end", "def v10_0=(value)\n @v10_0 = value\n end", "def v10_11=(value)\n @v10_11 = value\n end", "def brightness(val)\n\t\tval = 31 if val > 31\n\t\tval = 0 if val < 0\n\t\t\n\t\tmessage = \"VLMP\"\n\t\tmessage += val.to_s.rjust(4, ' ')\n\t\t\n\t\tdo_send(message)\n\tend", "def scaleBatteryVoltage(v)\n ((v * 675) / 65536.0).round / 100.0\n end", "def setSpeed(value)\r\n @speed = value\r\n end", "def vpi0!\n put_value(Vpi0, VpiScalarVal)\n end", "def mute()\n self.post(\"/devices/#{@volume_device}/commands/mute\")\n end", "def set_medium_voltage_segment\n @medium_voltage_segment = MediumVoltageSegment.find(params[:id])\n end", "def set_actual_volume\n @actual_volume = ActualVolume.find(params[:id])\n end", "def mode=(mode)\n super(040000 | (mode & 07777))\n end", "def music_volume=(value)\n value = value.to_i.abs\n @music_volume = value < 101 ? value : 100\n end", "def mute=(val)\n if val\n %x[pactl set-sink-input-mute #{self.input_id} 1]\n @args[:props][\"mute\"] = \"yes\"\n else\n %x[pactl set-sink-input-mute #{self.input_id} 0]\n @args[:props][\"mute\"] = \"no\"\n end\n \n return nil\n end", "def set_volume_cuft\n self.volume_cuft = (self.length_ins/12) * (self.width_ins/12) * (self.height_ins/12)\n end", "def set_volume(volume)\n puts \"Setting volume to #{volume}\" if $verbose\n v='AG'+(('000'+volume.to_s)[-3..-1])+';'\n puts v if $verbose\n ret=send_cmd(v,'AG;',v,0.5,1.5,3)\n if(ret)\n return(ret.gsub(/^AG/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend", "def set_vibe\n @vibe = vibe.find(params[:id])\n end", "def reset_max_velocity\n @max_velocity = @max_velocity_original.dup\n end", "def v9_0=(value)\n @v9_0 = value\n end", "def speed_set _value\n send_cmd(\"speed_set #{_value}\")\n end", "def set_Mode(value)\n set_input(\"Mode\", value)\n end", "def set_Mode(value)\n set_input(\"Mode\", value)\n end", "def set_pins(motor, mode = :stop)\n pwm, forward, backward = nil, nil, nil\n if motor.port == :a\n pwm = @port_a_pwm\n forward = @pins[:in1]\n backward = @pins[:in2]\n elsif motor.port == :b\n pwm = @port_b_pwm\n forward = @pins[:in3]\n backward = @pins[:in4]\n end\n\n case mode\n when :stop\n pwm.duty_cycle = 0\n RPi::GPIO.set_low(forward)\n RPi::GPIO.set_low(backward)\n when :forward\n pwm.duty_cycle = motor.pwm_speed\n RPi::GPIO.set_high(forward)\n RPi::GPIO.set_low(backward)\n when :backward\n pwm.duty_cycle = motor.pwm_speed\n RPi::GPIO.set_low(forward)\n RPi::GPIO.set_high(backward)\n end\n # log(\"Motor #{motor.port}: POWER: #{motor.power}, PWM: #{pwm.duty_cycle}, forward: #{RPi::GPIO.high?(forward)}, backward: #{RPi::GPIO.high?(backward)}\")\n end", "def v12_0=(value)\n @v12_0 = value\n end", "def set_AnnualFuelOilVolumeEstimate(value)\n set_input(\"AnnualFuelOilVolumeEstimate\", value)\n end", "def v10_15=(value)\n @v10_15 = value\n end", "def volume=(volume)\n validator = EnumAttributeValidator.new('String', ['Mute', 'Low', 'Medium', 'Loud', 'Mixed'])\n unless validator.valid?(volume)\n fail ArgumentError, 'invalid value for \"volume\", must be one of #{validator.allowable_values}.'\n end\n @volume = volume\n end", "def set_Speed(value)\n set_input(\"Speed\", value)\n end", "def set_Speed(value)\n set_input(\"Speed\", value)\n end", "def setValue(value)\n @current = value\n self.limitCurrentValue\n end", "def show_vol()\n\t\tvm = get_vol\n\t\t@volumebar.color=$muted_colors[vm[:mute]]\n\t\t@volumebar.title='Volume'\n\t\t@volumebar.title += ' (Muted)' if vm[:mute]\n\t\t@volumebar.value=vm[:vol]\n\t\t@volumebar.timeout=5\n\tend", "def setLane(currentLane)\n @currentLane = currentLane\n\n @lastSpeed = @currentLane.initialSpeed\n @nextSpeed = Velocity::Zero\n\n updateLane\n end", "def med=(val)\n info \"os10_lldp_interface::med= #{val}\"\n begin\n conf_lines = []\n conf_lines << \"interface #{@interface_name}\"\n conf_lines << 'lldp med enable' if med == 'false' && val == 'true'\n conf_lines << 'lldp med disable' if val == 'false'\n conf_lines.each { |value| info value }\n ecc conf_lines\n return\n rescue Exception => e\n err 'Exception in med='\n err e.message\n err e.backtrace[0]\n raise\n end\n end", "def mode=(mode)\n super(0120000 | (mode & 07777))\n end", "def set_mode(mode)\n puts \"Setting mode to #{mode}\" if $verbose\n m='MD'+mode.to_s+';'\n puts m if $verbose\n ret=send_cmd(m,'MD;',m,0.1,0.5,3)\n if(ret)\n return(ret.gsub(/^MD/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend", "def db= value\n code = if value > 12.0\n '185VL'\n elsif value < -80.0\n '000VL'\n else\n sprintf(\"%03dVL\", (value/0.5 + 161).to_int)\n end\n\n return decode_volume(@vsx.cmd(code, /^VOL(\\d+)$/).shift)\n end", "def set_power_consumption_mode(optimized)\n state = optimized ? 'on' : 'off'\n execute_prlctl('set', @uuid, '--longer-battery-life', state)\n end", "def set_vibe\n @vibe = Vibe.find(params[:id])\n end", "def kiosk_mode_block_volume_buttons=(value)\n @kiosk_mode_block_volume_buttons = value\n end", "def set_volume\n @volume = Volume.find(params[:id])\n end", "def set_volume\n @volume = Volume.find(params[:id])\n end", "def set_vet\n @vet = Vet.find(params[:id])\n end", "def set(left_value, right_value)\n @left.analog_speed = left_value\n @right.analog_speed = right_value\n end", "def set_Mode(value)\n set_input(\"Mode\", value)\n end", "def set_servo_parameters(min_us, max_us, degrees, velocity_max)\n\t Klass.setServoParameters(@handle, @index, min_us, max_us, degrees, velocity_max)\n\t true\n\tend", "def set_mpg_control\n @mpg_control = MpgControl.find(params[:id])\n end", "def set_pin(val)\n\n @pwm.duty_cycle = val ? @duty_cycle : 0 \n super(val)\n \n end", "def set_velocity action = :increment\n if action == :increment and @velocity <= 3\n @velocity += 1\n\n elsif action == :decrement and @velocity > 1\n @velocity -= 1\n end\n end", "def pwm(v)\n regdata = @@i2c.read(0x08, 1)\n @@i2c.write([0x08, regdata[0] | (1 << @id)])\n @@i2c.write([@ion, v])\n @@i2c.write([0x08, regdata[0]])\n end", "def tv_set_brightness _n, _abs=0\n send_cmd(\"tv_set_brightness #{_n} #{_abs}\")\n end", "def set_speed(new_speed:)\n if new_speed > 30\n new_speed = 30\n elsif new_speed < 0\n new_speed = 0\n end\n @curr_speed = new_speed \n end", "def amp=(box)\n\t\t@amp = box\n\tend", "def current_limit=(new_current_limit)\n Klass.setCurrentLimit(@handle, @index, new_current_limit.to_f)\n\t new_current_limit\n end", "def vol_decr\n %x[pactl set-sink-input-volume #{self.input_id} -- -5%]\n new_vol = vol_perc - 5\n new_vol = 0 if new_vol < 0\n @args[:props][\"volume\"] = \"0: #{new_vol}% 1: #{new_vol}%\"\n return nil\n end", "def setSpeedMode _obj, _args\n \"_obj setSpeedMode _args;\" \n end", "def vco_range=(minmax_mhz)\n data = [minmax_mhz.first, minmax_mhz.last].pack('S>2')\n write_command(CMD_FREQ_RANGE, data)\n end", "def update_vibration(value)\n $game_system.set_vibration_rate(value)\n Input.vibrate(100, 100, 20) if SceneManager.scene_is?(Scene_Options)\n end", "def set_amps_min x\n if x<10\n x=10\n end\n @@amps=x\n end", "def volume_adjustment(value)\n @ole.VolumeAdjustment = value\n nil\n end", "def set_magnetic_field\n @magnetic_field = MagneticField.find(params[:id])\n end", "def svm_mode=(svm_mode)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(svm_mode)\n fail ArgumentError, \"invalid value for \\\"svm_mode\\\", must be one of #{validator.allowable_values}.\"\n end\n @svm_mode = svm_mode\n end", "def value=(v)\n @bar.y = start + course.to_f * v.fbound(0, max_value) / max_value\n end", "def set_16Gb(vm_name, vm_config)\n require_string(vm_name)\n require_vagrant_config(vm_config)\n \n set_cpu_and_ram(vm_name, vm_config, 4, 1024 * 16)\n end", "def set_05Gb(vm_name, vm_config)\n require_string(vm_name)\n require_vagrant_config(vm_config)\n\n set_cpu_and_ram(vm_name, vm_config, 2, 512)\n end", "def lower_power_limits!(percent_threshold: 0.8)\n # percent_threshold value should be between 0 and 1\n power_limit = current_power_limit\n new_power_limit = (power_limit * percent_threshold).to_i\n message_helper(\n \"Setting power limits from #{power_limit} to #{new_power_limit}\"\n )\n `sudo nvidia-smi -i #{i} -pl #{new_power_limits}`\n end", "def set_cvs(amps: 75, psi: 50, t: 20)\n Hardware.instance.set_amps amps\n Hardware.instance.set_psi psi\n Hardware.instance.set_t t\n end", "def velocity(val = nil)\n val.nil? ? @state.velocity : @state.velocity = val\n end", "def v10_8=(value)\n @v10_8 = value\n end", "def set_vat vat\n wait_until {contact_vat_number.visible?}\n contact_vat_number.type_text vat\n end", "def v10_14=(value)\n @v10_14 = value\n end", "def music_volume=(value)\n return unless value.between?(0, 100)\n @music_volume = Audio.music_volume = value\n end", "def set_bet_value\n\t\tself.bet_value = self.bet_line\n end", "def limitCurrentValue\n if @current < @low\n @current = @low\n CDK.Beep\n elsif @current > @high\n @current = @high\n CDK.Beep\n end\n end" ]
[ "0.5903527", "0.58412147", "0.5671903", "0.5671903", "0.5534078", "0.55023926", "0.5416621", "0.53050137", "0.53007793", "0.5261536", "0.5217041", "0.51907027", "0.5173838", "0.51657933", "0.5079575", "0.50737715", "0.50315464", "0.50315464", "0.50253576", "0.50165725", "0.5014349", "0.50143313", "0.4965654", "0.4962863", "0.4952653", "0.49404466", "0.49277848", "0.49208987", "0.48696446", "0.48696446", "0.48626086", "0.48621964", "0.4860938", "0.48245868", "0.4805636", "0.47982", "0.4792596", "0.4774311", "0.4765643", "0.47633338", "0.47559673", "0.47471738", "0.47378272", "0.47303915", "0.47144926", "0.47113955", "0.4709442", "0.47081774", "0.47081774", "0.4707323", "0.46936858", "0.46903634", "0.46838984", "0.4677847", "0.4674605", "0.4674605", "0.46734947", "0.46713558", "0.4668867", "0.46686706", "0.46647635", "0.46569067", "0.4653932", "0.465278", "0.4642625", "0.46401274", "0.4639077", "0.4639077", "0.46333292", "0.46324384", "0.46320665", "0.46282277", "0.46204147", "0.46042857", "0.46033412", "0.459285", "0.4582665", "0.4577939", "0.45684066", "0.45632443", "0.4555832", "0.45539534", "0.45476803", "0.4535158", "0.4533836", "0.45325458", "0.45320213", "0.4529826", "0.45284694", "0.45184663", "0.45138705", "0.4513286", "0.45125854", "0.45110878", "0.45048487", "0.4496069", "0.4494781", "0.44946456", "0.4491549", "0.44854227" ]
0.66746545
0
Returns the voltage as set by BrickletAnalogOutset_voltage.
def get_voltage send_request(FUNCTION_GET_VOLTAGE, [], '', 2, 'S') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def voltage\n raw_voltage = File.read('/sys/bus/iio/devices/iio:device0/in_voltage0_raw').strip.to_f\n scale = File.read('/sys/bus/iio/devices/iio:device0/in_voltage_scale').strip.to_f\n @voltage = raw_voltage * scale\n end", "def voltage\n lfac_device = '/sys/bus/iio/devices/iio:device0/'\n raw_voltage = File.read(File.join(lfac_device, 'in_voltage0_raw')).strip.to_f\n scale = File.read(File.join(lfac_device, 'in_voltage_scale')).strip.to_f\n @voltage = raw_voltage * scale\n end", "def set_voltage(voltage)\n send_request(FUNCTION_SET_VOLTAGE, [voltage], 'S', 0, '')\n end", "def voltage(code, gain=0.4936)\n\t return (code.to_f / @max.to_f) * (2.048 / gain.to_f) * (180.0 / 33.0)\n\tend", "def read_voltage(channel, data_bits = 8)\n ad_voltage = process_commands(ProXR.read_voltage_command(channel))\n\n voltage = ad_voltage / voltage_conversion_factor(data_bits)\n\n #special case\n voltage = 0 if ad_voltage == max_channel_reading(data_bits)\n voltage\n end", "def vat_rate\n end", "def db= value\n code = if value > 12.0\n '185VL'\n elsif value < -80.0\n '000VL'\n else\n sprintf(\"%03dVL\", (value/0.5 + 161).to_int)\n end\n\n return decode_volume(@vsx.cmd(code, /^VOL(\\d+)$/).shift)\n end", "def get_volume\n @volume\n end", "def has_voltage?(channel)\n read_voltage(channel) > 0 ? true : false\n end", "def vida\n @vida_actual\n end", "def vpm\n bpm / value\n end", "def to_vr\n vr = @r.nil? ? @v.to_s : \"#{@v}-#{@r}\"\n end", "def get_vibration\n $game_system.vibration_rate\n end", "def angular_velocity\n @rp.angular_velocity\n end", "def velocity\n @velocity ||= (127 * @intensity).round\n end", "def voltage_conversion_factor(data_bits)\n max_channel_reading(data_bits)/max_channel_voltage\n end", "def vol_decr\n %x[pactl set-sink-input-volume #{self.input_id} -- -5%]\n new_vol = vol_perc - 5\n new_vol = 0 if new_vol < 0\n @args[:props][\"volume\"] = \"0: #{new_vol}% 1: #{new_vol}%\"\n return nil\n end", "def vtv\n vtv = version_tracker_version\n vtv = version if vtv.blank?\n vtv\n end", "def value\n return self.actual\n end", "def value\n return self.actual\n end", "def vpiL!\n put_value(VpiL, VpiScalarVal)\n end", "def vin\n generated_vin = [\n # Manufacturer ID / WMI\n fetch_sample(VALID_WMI_REGIONS),\n fetch_sample(VALID_ALPHANUMERIC, count: 2),\n # Vehicle Description\n fetch_sample(VALID_ALPHANUMERIC, count: 3),\n fetch_sample(VALID_ALPHA),\n fetch_sample(VALID_ALPHANUMERIC),\n '0', # check digit placeholder\n fetch_sample(VALID_YEAR_CHARS), # Year of Manufacture\n fetch_sample(VALID_ALPHANUMERIC), # Plant ID\n FFaker.numerify('######') # Serial Number\n ].join\n\n # Calculate the Check Digit\n weighted_sum = generated_vin.chars.each_with_index.sum do |char, idx|\n (TRANSLITERATION_VALUES[char] || char).to_i * POSITION_WEIGHTS[idx]\n end\n\n check_digit = weighted_sum % 11\n check_digit = 'X' if check_digit == 10\n generated_vin[8] = check_digit.to_s\n\n generated_vin\n end", "def vat_number; end", "def vat\n amount_vat_included - amount_vat_excluded\n end", "def current_value\n value = $options.send(getter)\n if @type == :slider\n value = value.clamp(@values[:min], @values[:max])\n return value - (value % @values[:increment])\n end\n value_index = @values.index(value)\n return @values[value_index || 0]\n end", "def series_volume\n end", "def velocity()\n @view__.velocity.toVector\n end", "def vat(unknown)\n\t\t#vf = vo + at\n\t\tcase unknown\n\t\twhen :vfy\n\t\t\tvars[:voy] + (vars[:ay] * vars[:t])\n\t\twhen :voy\n\t\t\tvars[:vfy] - (vars[:ay] * vars[:t])\n\t\twhen :t\n\t\t\t(vars[:vfy] - vars[:voy])/vars[:ay]\n\t\tend\n\tend", "def cur_velocity\n MSPhysics::Newton::CurvySlider.get_cur_velocity(@address)\n end", "def cur_velocity\n MSPhysics::Newton::CurvySlider.get_cur_velocity(@address)\n end", "def benchvariation\n if @london_flag == 'Y'\n @benchvariance = @benchsubtotal1 * @benchmark_rates['M144'].to_f\n else\n 0\n end\n end", "def v\n struct.v\n\n end", "def dvla_data\n vehicle_compliance_response = ComplianceCheckerApi.vehicle_compliance(vrn, zone_ids)\n select_chargeable(vehicle_compliance_response['complianceOutcomes'])\n end", "def t2pv(v)\n v.direction - 0.5 * PI\n end", "def vel\n @velocidad\n end", "def set_velocity\n @chart = policy_scope(Chart).find(params[:id])\n authorize @chart\n @velocity = @chart.velocity\n end", "def vpi0!\n put_value(Vpi0, VpiScalarVal)\n end", "def current_value\n @value\n end", "def vd(value=1)\n @music.vd(value.to_i)\n end", "def scaleBatteryVoltage(v)\n ((v * 675) / 65536.0).round / 100.0\n end", "def vat_rate\n hash[\"VATRate\"]\n end", "def current_battery\n @current_battery ||= (int16_t(16..17) / 100.0)\n end", "def power\n data.power\n end", "def get_threshold\n d = self.vspecs.select(:value).where(name: 'threshold').first\n return d != nil ? d.value : d\n end", "def autosizedPlantLoopVolume\n\n result = OpenStudio::OptionalDouble.new()\n\n name = self.name.get.upcase\n \n model = self.model\n \n sql = model.sqlFile\n \n if sql.is_initialized\n sql = sql.get\n \n query = \"SELECT Value \n FROM tabulardatawithstrings \n WHERE ReportName='ComponentSizingSummary' \n AND ReportForString='Entire Facility' \n AND TableName='PlantLoop' \n AND RowName='#{name}' \n AND ColumnName='Plant Loop Volume'\n AND Units='m3'\"\n \n val = sql.execAndReturnFirstDouble(query)\n \n if val.is_initialized\n result = OpenStudio::OptionalDouble.new(val.get)\n end\n \n end\n\n return result\n \n end", "def volume; self.class.volume; end", "def update_vcb_value\n angle = Sketchup.active_model.shadow_info[\"NorthAngle\"].degrees\n Sketchup.vcb_value = AngleHelper.format_angle(angle)\n end", "def show_vol()\n\t\tvm = get_vol\n\t\t@volumebar.color=$muted_colors[vm[:mute]]\n\t\t@volumebar.title='Volume'\n\t\t@volumebar.title += ' (Muted)' if vm[:mute]\n\t\t@volumebar.value=vm[:vol]\n\t\t@volumebar.timeout=5\n\tend", "def set_valet_datum\n @valet_datum = ValetDatum.find(params[:id])\n end", "def get_uv(position)\n u = (position - self.point).dot(self.left.normalize) / self.u_unit\n v = (position - self.point).dot(self.up.normalize) / self.v_unit\n [u, v]\n end", "def v10_14\n return @v10_14\n end", "def option_value(option_value_id:)\n version_id = option_value_version_id(option_value_id: option_value_id)\n\n version = PaperTrail::Version.find_by(id: version_id)\n version.try(:reify)\n end", "def blade_temperature\n super\n end", "def set_low_voltage_segment\n @low_voltage_segment = LowVoltageSegment.find(params[:id])\n end", "def cur_vector\n MSPhysics::Newton::CurvySlider.get_cur_vector(@address)\n end", "def cur_vector\n MSPhysics::Newton::CurvySlider.get_cur_vector(@address)\n end", "def humidity(vout, vsupply, tempF)\n sensorRH = (vout/vsupply - 0.16) / 0.0062\n trueRH = sensorRH / (1.093 - 0.0012 * tempF)\nend", "def to_vre(_opts = {})\n vr = to_vr\n vre = @e.nil? ? vr : \"#{@e}:#{vr}\"\n end", "def velocity\n x, y = dx_dy\n V[x, y]\n end", "def value\n self\n end", "def get\n val\n end", "def get\n val\n end", "def value!\n @value\n end", "def value\n return @val\n end", "def get_volume\n return get_floor_height.to_f * get_area.to_f\n end", "def p2tv(vd, a)\n assert(vd <= 2 * PI && vd >= 0)\n d = vd + 0.5 * PI\n if d > 2 * PI\n d -= 2 * PI\n end\n Vct.new_dr(d, a)\n end", "def get_variance\n return 1.0/12.0 * (@upper-@lower)**2\n end", "def velocity\n return Math.sqrt(@west_east_velocity ** 2 + @south_north_velocity ** 2)\n end", "def peak_volume(type=TagLib::ID3v2::RelativeVolumeFrame::MasterVolume)\n end", "def beta\n return @beta\n end", "def vco_range\n read_command(CMD_FREQ_RANGE).unpack('S>2')\n end", "def voltdiv vin, r1, r2\n _vout = vin * (r2 / (r1 + r2))\nend", "def vpi1!\n put_value(Vpi1, VpiScalarVal)\n end", "def vel=(v)\n self.mo = Vector[mo[0], *(mo[0]*v.normalize)]\n end", "def v12_0\n return @v12_0\n end", "def outputValue\n\t\tend", "def adc_a_l\n end", "def get_value_wrapper aFormat\n fmt = resolve_prop_type(aFormat)\n val = S_vpi_value.new(:format => fmt)\n vpi_get_value(self, val)\n val\n end", "def get_double_value\n\t\tend", "def set_medium_voltage_segment\n @medium_voltage_segment = MediumVoltageSegment.find(params[:id])\n end", "def adc_a_d8\n end", "def volume; property('volume'); end", "def vin; end", "def current_volume(volume)\n\t\t\"The current volume is #{@volume}\"\n\tend", "def pv\n factor = (1.0 + monthly_rate)**duration\n second_factor = (factor - 1) * (1 + monthly_rate * ptype) / monthly_rate\n\n -(future_value + (payment.to_f * second_factor)) / factor\n end", "def get_value vector\n\t\t\t\treturn self.evaluate_expression(vector) * (1+(rand()-0.5)*@noise_amplitude)\n\t\t\tend", "def den()\n @den\n end", "def v11_0\n return @v11_0\n end", "def v11_0\n return @v11_0\n end", "def value=(v)\n @bar.x = (start + course.to_f * v.fbound(0, max_value) / max_value).to_i\n end", "def velocity=(arg)\n @view__.velocity = arg.is_a?(Vector) ? arg.getInternal__ : arg\n arg\n end", "def volume\n a, b, c, d = @points\n ((a - d) % ((b - d) * (c - d))) / 6\n end", "def to_revolution_per_meter(**options) = convert_to('revolution-per-meter', **options)", "def get_road_volume\n @volumes_east = RoadVolume.get_road_volume('East')\n @volumes_west = RoadVolume.get_road_volume('West')\n end", "def axis_values influences\n\t\tmin = influences[0].velocity\n\t\tmax = influences[0].velocity\n\n\t\tinfluences.each do |influence| \n\t\t\tif influence.velocity < min\n\t\t\t\tmin = influence.velocity\n\t\t\tend\n\t\t\tif influence.velocity > max\n\t\t\t\tmax = influence.velocity\n\t\t\tend\n\n\t\tend\n\t\tv = []\n\t\tmin = (min*100).floor\n\n\t\tv[0] = min.to_s \n\t\tv[1] = ((max*100).ceil).to_s\n\t\tv\n\tend", "def v10_12\n return @v10_12\n end", "def car\n @value1\n end", "def to_v\n @qry.to_v\n end", "def grab\n @claw_servo.max\n end", "def value\n return @value\n end" ]
[ "0.7522642", "0.7414735", "0.6346142", "0.6088153", "0.59655505", "0.5333982", "0.5266469", "0.52199453", "0.51810974", "0.51408494", "0.51283866", "0.51071006", "0.50666225", "0.50404495", "0.50273705", "0.50147206", "0.49600276", "0.49446476", "0.49265528", "0.49265528", "0.48982394", "0.488167", "0.48426834", "0.48241764", "0.48117754", "0.48007828", "0.47689924", "0.47481558", "0.47441152", "0.47441152", "0.4732281", "0.47140628", "0.4710861", "0.4708505", "0.47044158", "0.46883482", "0.46865138", "0.46835414", "0.46793604", "0.4666898", "0.46605164", "0.46585593", "0.463799", "0.46362257", "0.46256214", "0.4622598", "0.46176407", "0.46151638", "0.46110272", "0.46021482", "0.4599171", "0.45980608", "0.4597416", "0.45951366", "0.4590456", "0.4590456", "0.45864514", "0.45773238", "0.45766735", "0.4572107", "0.45698023", "0.45698023", "0.45659497", "0.45554873", "0.4545224", "0.4539428", "0.45363522", "0.45354328", "0.45275712", "0.45267728", "0.45241696", "0.45239902", "0.45238167", "0.45147628", "0.4511977", "0.45056605", "0.4505035", "0.4484855", "0.44742835", "0.4470966", "0.4470468", "0.4469955", "0.44682992", "0.4463215", "0.44606763", "0.4455824", "0.44546583", "0.44543692", "0.44543692", "0.4447826", "0.4443039", "0.44391212", "0.4437135", "0.44362754", "0.44362396", "0.44349667", "0.44278622", "0.44276595", "0.4421205", "0.44210014" ]
0.7135679
2
Sets the mode of the analog value. Possible modes: 0: Normal Mode (Analog value as set by BrickletAnalogOutset_voltage is applied) 1: 1k Ohm resistor to ground 2: 100k Ohm resistor to ground 3: 500k Ohm resistor to ground Setting the mode to 0 will result in an output voltage of 0. You can jump to a higher output voltage directly by calling BrickletAnalogOutset_voltage. The default mode is 1.
def set_mode(mode) send_request(FUNCTION_SET_MODE, [mode], 'C', 0, '') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_Mode(value)\n set_input(\"Mode\", value)\n end", "def mode=(mode)\n #Can be Rufirmata::INPUT, OUTPUT, ANALOG, PWM or UNAVAILABLE\n return if @mode == mode #Nothing is changing, so nothing to do\n\n raise \"#{to_s} does not have PWM capabilities\" if mode == Rufirmata::PWM and !pwm\n raise \"#{to_s} cannot be used through Firmata\" if @mode == Rufirmata::UNAVAILABLE\n\n changing :pin_mode_changed, :changes=>{ :from=>@mode, :to=>mode } do\n @mode = mode\n unless mode == Rufirmata::UNAVAILABLE\n board.write_command(Rufirmata::SET_PIN_MODE, pin_number, mode)\n enable_reporting if mode == Rufirmata::INPUT\n end\n end\n\n end", "def set_Mode(value)\n set_input(\"Mode\", value)\n end", "def set_Mode(value)\n set_input(\"Mode\", value)\n end", "def mode=(mode)\n \n write(\"++mode 1\" ) if mode==:Device \n write(\"++mode 0\" ) if mode==:Controller\n @mode = write(\"++mode\",true).to_i==1 ? :Controller : :Device\n end", "def mode=(val)\n if val.blank? or val.kind_of? Fixnum then\n write_attribute(:mode, val)\n else\n write_attribute(:mode, Mode[val])\n end\n end", "def mode=(mode)\n super(0100000 | (mode & 07777))\n end", "def set_mode(m)\n @mode = m\n end", "def set_mode(new)\n @mode = new\n end", "def set_mode(mode)\n @mode = mode\n\n if mode == 'w'\n File.open(\"#{ GPIO_PATH }/gpio#{ pin_num }/direction\", \"w\") { |f| f.write(GPIO_DIRECTION_WRITE) }\n @pin_file = File.open(\"#{ GPIO_PATH }/gpio#{ pin_num }/value\", \"w\")\n elsif mode =='r'\n File.open(\"#{ GPIO_PATH }/gpio#{ pin_num }/direction\", \"w\") { |f| f.write(GPIO_DIRECTION_READ) }\n @pin_file = File.open(\"#{ GPIO_PATH }/gpio#{pin_num}/value\", \"r\")\n end\n end", "def mode=(new_mode)\n handle_old_mode\n @mode = new_mode\n handle_new_mode\n end", "def set_mode pin, mode\n reg = pin / 10\n shift = (pin % 10) * 3\n new_value = (get_int_at(reg) & ~(7 << shift)) | (mode << shift)\n set_int_at(reg, new_value)\n end", "def mode=(mode)\n super(040000 | (mode & 07777))\n end", "def mode=(select_mode)\n #ensure active\n if select_mode\n @active = true \n else\n @target_area.clear\n end\n @mode = select_mode\n end", "def mode=(new_mode)\n LOGGER.mode = new_mode\n end", "def mode=(new_mode)\n LOGGER.mode = new_mode\n end", "def current_mode=(id)\n @current_mode = id.is_a?(ChipMode) ? id.id : id\n Origen.app.listeners_for(:on_mode_changed).each do |listener|\n listener.on_mode_changed(mode: @current_mode, instance: self)\n end\n @current_mode # rubocop:disable Lint/Void\n end", "def mode=(a_mode)\n @@mode = a_mode.to_sym\n end", "def mode=(mode)\n Nitro.mode = mode.to_sym\n end", "def mode=(mode)\n super(0120000 | (mode & 07777))\n end", "def mode=(type)\n @mode = type.to_s\n end", "def set_mode\n @mode = Mode.find(params[:id])\n end", "def mode=(mode)\n validator = EnumAttributeValidator.new('String', [\"default\", \"custom\"])\n unless validator.valid?(mode)\n fail ArgumentError, \"invalid value for 'mode', must be one of #{validator.allowable_values}.\"\n end\n @mode = mode\n end", "def mode(*modes, &block)\n fail_if_wrong_modes modes\n fail 'Block required' unless block_given?\n self.current_modes = modes\n instance_eval(&block)\n reset_modes\n end", "def mode_name=(value)\n @mode_name = Mode.new value\n end", "def set_mode(name, opts = {})\n cmd = command_builder('switchport mode', opts)\n configure_interface(name, cmd)\n end", "def mode=(mode)\n @mode = mode ? mode.to_sym : nil\n end", "def mode=(newmode)\n case newmode\n when :auto\n update('--auto', @resource.value(:name))\n when :manual\n # No change in value, but sets it to manual\n update('--set', name, path)\n end\n end", "def set_mode\n @mode = Mode.find(params[:id])\n end", "def mode= new_mode\n @gapi.update! mode: verify_mode(new_mode)\n end", "def change_mode(mode)\n\n @mode = mode\n\n # Create new effect and volume modifier\n case mode\n when 'normal', ''\n @effect = @fx_nil\n\n when 'cave'\n @effect = @fx_cave\n \n end\n\n #@sfx.each{ |s| s = nil }\n #@sfx = []\n #GC.start\n\n @sfx.each{ |e| e.feed(@effect,0) }\n \n end", "def set_pin_mode(pin, mode)\n pins[pin].mode = mode\n write(PIN_MODE, pin, mode)\n end", "def color_modes=(value)\n @color_modes = value\n end", "def binmode=(mode)\n if (true == mode or false == mode)\n @options[\"Binmode\"] = mode\n else\n raise ArgumentError, \"argument must be true or false\"\n end\n end", "def binmode=(mode)\n if (true == mode or false == mode)\n @options[\"Binmode\"] = mode\n else\n raise ArgumentError, \"argument must be true or false\"\n end\n end", "def mode=(mode)\n validator = EnumAttributeValidator.new('String', [\"test\", \"live\"])\n unless validator.valid?(mode)\n fail ArgumentError, \"invalid value for \\\"mode\\\", must be one of #{validator.allowable_values}.\"\n end\n @mode = mode\n end", "def in_mode(mode)\n @mode = mode\n self\n end", "def update_mode(new_mode) \t\n \t#return if new_mode == mode\n \t#gateway = Eth485Gateway.new(ENV['ETH485_GATEWAY_IP'], ENV['ETH485_GATEWAY_PORT'].to_i)\n gateway = SerialportGateway.new(ENV['SERIAL_PORT'])\n meter = Mercury.new(gateway, ENV['METER_ADDRESS'].to_i)\n result = {}\n \tcase new_mode\n \t when HEATIN_CORD_OFF_MODE then\n \t \tresult = meter.disable_consumer\n if result['status'] = 'OK'\n self.update!(enable: false, mode: new_mode) \n end \n \t when HEATIN_CORD_MANUAL_ON_MODE then\n result = meter.enable_consumer\n if result['status'] = 'OK'\n self.update!(enable: true, mode: new_mode) \n end \n \t when HEATIN_CORD_AUTOMATIC_1H_SWITCH_MODE, HEATIN_CORD_AUTOMATIC_1H_PER_DAY_MODE then\n update!(mode: new_mode) \n \t #puts meter.enable_consumer \n \tend\n \n result\n end", "def rcv_settle_mode=(mode)\n Cproton.pn_link_set_rcv_settle_mode(@impl, mode)\n end", "def mode=(m)\n @mode = m.to_sym\n end", "def snd_settle_mode=(mode)\n Cproton.pn_link_set_snd_settle_mode(@impl, mode)\n end", "def pin_std_set_mode(pin, mode)\n @ramps_arduino.execute_command(\"F43 P#{pin} M#{mode}\", false, @status_debug_msg)\n end", "def in_mode(mode)\n\t\t@mode = mode\n\t\tself\n\tend", "def set_pins(motor, mode = :stop)\n pwm, forward, backward = nil, nil, nil\n if motor.port == :a\n pwm = @port_a_pwm\n forward = @pins[:in1]\n backward = @pins[:in2]\n elsif motor.port == :b\n pwm = @port_b_pwm\n forward = @pins[:in3]\n backward = @pins[:in4]\n end\n\n case mode\n when :stop\n pwm.duty_cycle = 0\n RPi::GPIO.set_low(forward)\n RPi::GPIO.set_low(backward)\n when :forward\n pwm.duty_cycle = motor.pwm_speed\n RPi::GPIO.set_high(forward)\n RPi::GPIO.set_low(backward)\n when :backward\n pwm.duty_cycle = motor.pwm_speed\n RPi::GPIO.set_low(forward)\n RPi::GPIO.set_high(backward)\n end\n # log(\"Motor #{motor.port}: POWER: #{motor.power}, PWM: #{pwm.duty_cycle}, forward: #{RPi::GPIO.high?(forward)}, backward: #{RPi::GPIO.high?(backward)}\")\n end", "def set_mode newmode\n @mode = newmode\n @view.set_mode newmode\n case newmode\n when :idle\n reset_all_stats\n end\n end", "def mode name, &b\n mode_definitions << [name, b]\n end", "def mode=(mode)\n request.mode = mode\n end", "def set_mode(mode)\n puts \"Setting mode to #{mode}\" if $verbose\n m='MD'+mode.to_s+';'\n puts m if $verbose\n ret=send_cmd(m,'MD;',m,0.1,0.5,3)\n if(ret)\n return(ret.gsub(/^MD/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend", "def next_mode new_mode\n if has_mode? new_mode\n @mode = new_mode\n else\n warn \"Robot #{self.class} switched to unknown mode :#{new_mode}!\"\n @mode = :idle\n end\n end", "def turn_airplane_mode value\n toggle_airplane_mode if value == \"on\"\n set_network_connection(6) if value == \"off\"\n end", "def set_pin_mode()\n\n # set the pins for motor control to output\n @board.set_pin_mode(pin_enb, Firmata::Board::OUTPUT)\n @board.set_pin_mode(pin_dir, Firmata::Board::OUTPUT)\n @board.set_pin_mode(pin_stp, Firmata::Board::OUTPUT)\n\n # set the pins for end stops to input\n @board.set_pin_mode(pin_min, Firmata::Board::INPUT)\n @board.set_pin_mode(pin_max, Firmata::Board::INPUT)\n\n # disable motors\n @board.digital_write(pin_enb, Firmata::Board::HIGH)\n\n # start reading end stops\n @board.toggle_pin_reporting(pin_min)\n @board.toggle_pin_reporting(pin_max)\n \n end", "def pin_std_set_value(pin, value, mode)\n @ramps_arduino.execute_command(\"F41 P#{pin} V#{value} M#{mode}\", false, @status_debug_msg)\n end", "def mode=(mode)\n @mode = mode.to_sym\n\n begin\n require(\"webrat/integrations/#{mode}\")\n rescue LoadError\n # Only some modes have integration code that needs to\n # be loaded, so this is OK\n end\n end", "def modes= m\n m.instance_eval \"def to_s; self.join(','); end\" if m.is_a?(Array) #override to_s\n @modes = m\n end", "def mode=(mode)\n validator = EnumAttributeValidator.new('String', [\"sync\", \"async\"])\n unless validator.valid?(mode)\n fail ArgumentError, \"invalid value for \\\"mode\\\", must be one of #{validator.allowable_values}.\"\n end\n @mode = mode\n end", "def switch_mode mode = \"unknown\"\n begin\n settings = YAML::load_file @settings_file\n @settings[:mode] = mode\n save_settings @settings\n shell.say \"Switched mode to: #{mode}.\"\n shell.say\n print_account\n rescue\n shell.say \"ERROR: Invalid #{@settings_file} settings file.\"\n end\n end", "def mode=(mode)\n @mode = mode.to_sym\n \n # This is a temporary hack to support backwards compatibility\n # with Merb 1.0.8 until it's updated to use the new Webrat.configure\n # syntax\n if @mode == :merb\n require(\"webrat/merb_session\")\n else\n require(\"webrat/#{mode}\")\n end\n end", "def pin_std_set_value(pin, value, mode)\n execute_command(\"F41 P#{pin} V#{value} M#{mode}\", false, @status_debug_msg)\n #execute_command(\"F41 P#{pin} V#{value}\", false, true)\n end", "def duplex_modes=(value)\n @duplex_modes = value\n end", "def mode=(mode)\n case mode\n when :scene\n when :toys_only\n @current_tool = :grab\n if @selected.is_a?(ToyInScene)\n mode = :toy_selected\n else\n @selected = nil\n end\n #@truly_selected = @selected = nil\n @delegate.selected_toy = @selected\n # if @delegate.is_a?(ActionAdderViewController)\n # @delegate.start_action_flow\n # end\n setNeedsDisplay\n when :toy_selected\n @delegate.selected_toy = @selected\n if @mode.nil?\n @delegate.start_action_flow\n end\n else\n @current_point = nil\n end\n\n @mode = mode\n end", "def set_access_mode(mode = :r)\n modes = [:r, :w, :rw, :x]\n raise ArgumentError, \"Mode must be one of #{modes}\" unless modes.include? mode\n case mode\n when :r\n self.access_mode = 0\n when :w\n self.access_mode = 1\n when :rw\n self.access_mode = 2\n when :x\n self.access_mode = 3\n end\n end", "def set_TestMode(value)\n set_input(\"TestMode\", value)\n end", "def set_TestMode(value)\n set_input(\"TestMode\", value)\n end", "def set_TestMode(value)\n set_input(\"TestMode\", value)\n end", "def set_TestMode(value)\n set_input(\"TestMode\", value)\n end", "def set_TestMode(value)\n set_input(\"TestMode\", value)\n end", "def set_TestMode(value)\n set_input(\"TestMode\", value)\n end", "def color_mode=(color_mode)\n validator = EnumAttributeValidator.new('String', [\"Normal\", \"Grayscale\"])\n if color_mode.to_i == 0\n unless validator.valid?(color_mode)\n raise ArgumentError, \"invalid value for 'color_mode', must be one of #{validator.allowable_values}.\"\n end\n @color_mode = color_mode\n else\n @color_mode = validator.allowable_values[color_mode.to_i]\n end\n end", "def pin_std_set_mode(pin, mode)\n execute_command(\"F43 P#{pin} M#{mode}\", false, @status_debug_msg)\n end", "def switch_mode!(mode = nil)\n if present?(mode) && valid_mode?(mode)\n Vedeu.configure { |config| config.terminal_mode = mode }\n\n else\n return fake_mode! if raw_mode?\n return cooked_mode! if fake_mode?\n\n raw_mode!\n\n end\n end", "def current_mode\n self.say \"The current mode is: #{@config[:mode]}\"\n end", "def auto_output(mode = nil)\n mode.nil? ? @state.toggle_auto_output : @state.auto_output = mode\n end", "def port_mode_set(idx, mode)\n port = $ts.dut.port_list[$idx_tx]\n conf = $ts.dut.call(\"mesa_qos_port_conf_get\", port)\n conf[\"key_type\"] = (\"MESA_VCAP_KEY_TYPE_\" + (mode[0] == \"N\" ? \"NORMAL\" : mode))\n conf[\"dmac_dip\"] = (mode == \"NORMAL_DST\" ? true : false)\n $ts.dut.call(\"mesa_qos_port_conf_set\", port, conf)\nend", "def set_state(modes = nil)\r\n @modes = modes\r\n @online = true\r\n end", "def set_mode\n\t\tif @year.nil? and @month.nil?\n\t\t\t@mode = :all\n\t\tend\n\n\t\tif /\\d{4}/ === @year.to_s\n\t\t\t@mode = :year\n\t\telse\n\t\t\t@year = nil\n\t\tend\n\n\t\tif /[12]H/ === @month.to_s\n\t\t\t@mode = :half\n\t\telsif /[1-4]Q/ === @month.to_s\n\t\t\t@mode = :quarter\n\t\telsif (1..12).include?(@month.to_i)\n\t\t\t@mode = :month\n\t\telse\n\t\t\t@month = nil\n\t\tend\n\n\tend", "def mode\n options[:mode]\n end", "def mode\n Initialize() if @_mode == nil\n\n @_mode\n end", "def pin_std_set_mode(pin, mode)\n start_command(\"F43 P#{pin} M#{mode}\", false, @status_debug_msg)\n end", "def switchgamemode(name)\r\n\t\t\t#gamelog \"Switching gamemode to #{name}\"\r\n\t\t\t@gamemode = name\r\n\t\tend", "def pin_std_set_value(pin, value, mode)\n start_command(\"F41 P#{pin} V#{value} M#{mode}\", false, @status_debug_msg)\n end", "def binmode(mode = nil)\n case mode\n when nil\n @options[\"Binmode\"]\n when true, false\n @options[\"Binmode\"] = mode\n else\n raise ArgumentError, \"argument must be true or false\"\n end\n end", "def binmode(mode = nil)\n case mode\n when nil\n @options[\"Binmode\"]\n when true, false\n @options[\"Binmode\"] = mode\n else\n raise ArgumentError, \"argument must be true or false\"\n end\n end", "def mode=(new_mode)\n @mode , @previous_mode = new_mode, @mode\n build_chains() if @mode != @previous_mode && @previous_mode != nil && @previous_mode != \"\"\n end", "def switch_mode!\n return cooked_mode! if raw_mode?\n\n raw_mode!\n end", "def mode\n TflApi::Client::Mode.new(self)\n end", "def init\n \tself.mode = \"Manual\"\n \tself.status = \"Off\"\n end", "def set_TagMode(value)\n set_input(\"TagMode\", value)\n end", "def set_TagMode(value)\n set_input(\"TagMode\", value)\n end", "def office_math_output_mode=(office_math_output_mode)\n validator = EnumAttributeValidator.new('String', [\"Image\", \"MathML\", \"Text\"])\n if office_math_output_mode.to_i == 0\n unless validator.valid?(office_math_output_mode)\n raise ArgumentError, \"invalid value for 'office_math_output_mode', must be one of #{validator.allowable_values}.\"\n end\n @office_math_output_mode = office_math_output_mode\n else\n @office_math_output_mode = validator.allowable_values[office_math_output_mode.to_i]\n end\n end", "def office_math_output_mode=(office_math_output_mode)\n validator = EnumAttributeValidator.new('String', [\"Image\", \"MathML\", \"Text\"])\n if office_math_output_mode.to_i == 0\n unless validator.valid?(office_math_output_mode)\n raise ArgumentError, \"invalid value for 'office_math_output_mode', must be one of #{validator.allowable_values}.\"\n end\n @office_math_output_mode = office_math_output_mode\n else\n @office_math_output_mode = validator.allowable_values[office_math_output_mode.to_i]\n end\n end", "def modes; end", "def set_fan\n fan = CeilingFan.new(\"Living Room\")\n fan_medium = CeilingFanMediumCommand.new(fan)\n fan_high = CeilingFanHighCommand.new(fan)\n fan_off = CeilingFanOffCommand.new(fan)\n @rc.set_command(1, fan_medium, fan_off)\n @rc.set_command(2, fan_high, fan_off)\n end", "def setSpeedMode _obj, _args\n \"_obj setSpeedMode _args;\" \n end", "def modes\n @client.get('/Journey/Meta/Modes')\n end", "def mode() end", "def fake_mode!\n switch_mode!(:fake)\n end", "def on\n set_power(\"on\", \"smooth\",1000)\n end", "def set_learning_mode(opts)\n opts = check_params(opts,[:modes])\n super(opts)\n end", "def set_learning_mode(opts)\n opts = check_params(opts,[:modes])\n super(opts)\n end", "def mode=(value)\n File.chmod(Integer(\"0#{value}\"), @resource[:name])\n end" ]
[ "0.6895601", "0.6885513", "0.68810195", "0.68810195", "0.6496621", "0.6377466", "0.6340785", "0.61997586", "0.61169183", "0.61086524", "0.6068066", "0.6053132", "0.6046438", "0.60447913", "0.60134935", "0.60134935", "0.6009196", "0.58851975", "0.5882023", "0.5881763", "0.5867188", "0.583292", "0.580266", "0.57964015", "0.57404184", "0.5704839", "0.5662178", "0.56610525", "0.5618031", "0.5609583", "0.5572124", "0.55621344", "0.5560947", "0.5558375", "0.5558375", "0.55378747", "0.5528323", "0.55149287", "0.5494412", "0.54936886", "0.5487665", "0.5475688", "0.5475044", "0.54611135", "0.54579556", "0.5416534", "0.5407821", "0.5393925", "0.53900987", "0.5356168", "0.5355844", "0.53549343", "0.5316043", "0.5269524", "0.52659076", "0.5238153", "0.52328885", "0.52225465", "0.5221156", "0.51900923", "0.5183995", "0.5172534", "0.5172534", "0.5172534", "0.5172534", "0.5172534", "0.5172534", "0.5167851", "0.5144881", "0.51338685", "0.50806063", "0.50794536", "0.5070902", "0.5068135", "0.506805", "0.5048208", "0.5045457", "0.5040049", "0.50377136", "0.5037071", "0.50287354", "0.50287354", "0.50166", "0.501598", "0.49933243", "0.49852562", "0.49790537", "0.49790537", "0.4967866", "0.4967866", "0.49674743", "0.4930481", "0.49179524", "0.49078128", "0.49049777", "0.48795274", "0.48636135", "0.48447886", "0.48447886", "0.48361948" ]
0.64443743
5
Returns the mode as set by BrickletAnalogOutset_mode.
def get_mode send_request(FUNCTION_GET_MODE, [], '', 1, 'C') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mode\n\t\treturn self.modes[0]\n\tend", "def mode\n modes(false)[0]\n end", "def mode\n modes(false)[0]\n end", "def mode\n @mode\n end", "def selected_mode\n @selected_mode\n end", "def get_mode()\n end", "def mode() @mode ||= detect_mode end", "def mode\n options[:mode]\n end", "def target_mode\n return nil if resource.mode.nil?\n (resource.mode.respond_to?(:oct) ? resource.mode.oct : resource.mode.to_i) & 007777\n end", "def mode_sym\n (mode || :off).to_sym\n end", "def get_modes\n @_modes\n end", "def mode\n case @data_list\n when QRNumeric\n :mode_number\n when QRAlphanumeric\n :mode_alpha_numk\n else\n :mode_8bit_byte\n end\n end", "def mode\n Initialize() if @_mode == nil\n\n @_mode\n end", "def modes\n fix_mode.modes\n end", "def mode_name\n if mode >= 0 && mode <= 15\n MODES[mode]\n else\n \"(#{mode})\"\n end\n end", "def modes; end", "def mode\n params['mode']\n end", "def modes\n mode_codes.keys\n end", "def mode() end", "def name\n return mode_desc\n end", "def mode; end", "def mode; end", "def mode; end", "def mode; end", "def mode\n TflApi::Client::Mode.new(self)\n end", "def mode?\n return @mode\n end", "def mode\n Mode.new(ENV).mode\n end", "def mode\n \"%o\" % (self.stat(:mode) & 007777)\n end", "def current_mode\n self.say \"The current mode is: #{@config[:mode]}\"\n end", "def mode=(type)\n @mode = type.to_s\n end", "def mode=(m)\n @mode = m.to_sym\n end", "def mode_to_string(mode)\n if mode==MODE_LSB\n return(\"LSB\")\n elsif mode==MODE_USB\n return(\"USB\")\n elsif mode==MODE_CW\n return(\"CW\")\n elsif mode==MODE_FM\n return(\"FM\")\n elsif mode==MODE_AM\n return(\"AM\")\n elsif mode==MODE_DATA\n return(\"DATA\")\n elsif mode==MODE_CW_REV\n return(\"CW-REV\")\n elsif mode==MODE_DATA_REV\n return(\"DATA-REV\")\n else\n return(\"Unknown\")\n end\nend", "def get_mode()\n session['mode'] = session['mode'] || 'edit'\n return session['mode']\n end", "def binmode\n self\n end", "def currentgamemode\r\n\t\t\t@gamemode\r\n\t\tend", "def mode\n raise \"Not implemented\"\n end", "def modes\n @client.get('/Journey/Meta/Modes')\n end", "def mode=(mode)\n Nitro.mode = mode.to_sym\n end", "def type\n params['mode']\n end", "def mode=(val)\n if val.blank? or val.kind_of? Fixnum then\n write_attribute(:mode, val)\n else\n write_attribute(:mode, Mode[val])\n end\n end", "def mode\n @announcer.mode\n end", "def modes\n @modes + autobuild.utilities.values.\n find_all { |u| u.enabled? }.\n map(&:name)\n end", "def type\n params['mode']\n end", "def iom_mode\n provider.facts[\"iom_mode\"] || \"\"\n end", "def mode\n\t\t@mode || (proxy_owner.mode if proxy_owner.respond_to?(:mode))\n\tend", "def mode\n attributes.fetch(:mode) do\n Ably::Util::Crypto::DEFAULTS.fetch(:mode)\n end.downcase\n end", "def mode=(mode)\n @mode = mode ? mode.to_sym : nil\n end", "def mode=(a_mode)\n @@mode = a_mode.to_sym\n end", "def mode\n @gapi.mode\n end", "def automation_mode\n data[:automation_mode]\n end", "def mode\n @_mode ||= Configuration.terminal_mode\n end", "def mode\n @mode ||= :smart \n end", "def get_mode()\n return(get_cmd('MD;',0.1,0.5,3).gsub(/^MD/,'').gsub(/;$/,'').to_i)\nend", "def mode=(mode)\n super(0100000 | (mode & 07777))\n end", "def modes_dd\r\n return $tables.attach(\"ATTENDANCE_MODES\").dd_choices(\"mode\",\"mode\")\r\n end", "def mode\n if stat = resource.stat\n return (stat.mode & 007777).to_s(8)\n else\n return :absent\n end\n end", "def selected_mode\n return @data[self.index]\n end", "def mode\n @mode = Vedeu.config.terminal_mode\n end", "def get_mode(key)\n case key\n when \"S\", \"s\" then -1 # AUTO\n when \"N\", \"n\" then 0 # NUMERIC\n when \"A\", \"a\" then 1 # ALNUM - British number: 0-9 A-Z SP $% * + - /.:\n when \"8\" then 2 # 8BIT\n when \"K\", \"k\" then 3 # KANJI\n end\n end", "def mode\n site.mode\n end", "def color_modes\n return @color_modes\n end", "def mode \n frequency_count = reduce(Hash.new(0)) { |freq, value| freq[value] += 1; freq}\n mode_count = frequency_count.values.max\n mode = frequency_count.select { |key, value| value == mode_count } # Select mode pairs\n return mode.keys.max # In case of multi-modes, return largest\n end", "def getPaymentModeObjName\r\n\t\t\treturn \"mfiforce__Payment_Mode__c\"\r\n\t\tend", "def mode_options\n @mode_options ||= begin\n s_opts = symmetric_options if mode != :asymmetric\n a_opts = asymmetric_options if mode != :symmetric\n [s_opts, a_opts].compact.join(\" \")\n end\n end", "def binmode(mode = nil)\n case mode\n when nil\n @options[\"Binmode\"]\n when true, false\n @options[\"Binmode\"] = mode\n else\n raise ArgumentError, \"argument must be true or false\"\n end\n end", "def binmode(mode = nil)\n case mode\n when nil\n @options[\"Binmode\"]\n when true, false\n @options[\"Binmode\"] = mode\n else\n raise ArgumentError, \"argument must be true or false\"\n end\n end", "def mode=(mode)\n \n write(\"++mode 1\" ) if mode==:Device \n write(\"++mode 0\" ) if mode==:Controller\n @mode = write(\"++mode\",true).to_i==1 ? :Controller : :Device\n end", "def mode name, &b\n mode_definitions << [name, b]\n end", "def mode_name=(value)\n @mode_name = Mode.new value\n end", "def engine_mode\n data[:engine_mode]\n end", "def mode=(mode)\n super(0120000 | (mode & 07777))\n end", "def mode\n request.mode\n end", "def mode=(mode)\n super(040000 | (mode & 07777))\n end", "def mode\n Relation.mode(sender_type, receiver_type)\n end", "def mode\n Relation.mode(sender_type, receiver_type)\n end", "def set_Mode(value)\n set_input(\"Mode\", value)\n end", "def set_mode(m)\n @mode = m\n end", "def current_mode\n if @current_mode\n return _modes[@current_mode] if _modes[@current_mode]\n\n fail \"The mode #{@current_mode} of #{self.class} has not been defined!\"\n else\n unless top_level?\n # Need to do this in case a class besides SubBlock includes Origen::Model\n obj_above_self = parent.nil? ? Origen.top_level : parent\n return nil if obj_above_self.nil?\n\n if obj_above_self.current_mode\n _modes[obj_above_self.current_mode.id] if _modes.include? obj_above_self.current_mode.id\n end\n end\n end\n end", "def mode=(new_mode)\n handle_old_mode\n @mode = new_mode\n handle_new_mode\n end", "def getMode\n return Mode::SURVIE\n end", "def application_mode\n if !FeatureFlag.find_by(name: 'application_mode').nil?\n # Note: @event_application_mode is automatically updated in Application Controller\n @current_mode = @event_application_mode\n else\n @current_mode = 'ERROR'\n end\n end", "def color_modes=(value)\n @color_modes = value\n end", "def set_Mode(value)\n set_input(\"Mode\", value)\n end", "def set_Mode(value)\n set_input(\"Mode\", value)\n end", "def mode(io) \n readable, writable = try_handle(io, \"mode\")\n\n case\n when readable && writable then \"r+\"\n when readable then \"r\"\n when writable then \"w\"\n else\n # occurs for r+ mode, for some reason\n \"r+\"\n end\n end", "def mode\n @mode || (proxy_owner.mode if defined?(proxy_owner) and proxy_owner.respond_to?(:mode))\n end", "def mode pin\n reg = pin / 10\n shift = (pin % 10) * 3\n (get_int_at(reg) >> shift) & 7\n end", "def mode=(new_mode)\n LOGGER.mode = new_mode\n end", "def mode=(new_mode)\n LOGGER.mode = new_mode\n end", "def modes= m\n m.instance_eval \"def to_s; self.join(','); end\" if m.is_a?(Array) #override to_s\n @modes = m\n end", "def bit_rate_mode\n mediainfo.audio.bit_rate_mode\n end", "def options_or_mode(oom)\n return fmode(oom) if oom.kind_of? String\n\n if FeatureGuard.enabled? :encoding\n oom\n else\n fmode(oom[:mode] || \"r:utf-8\")\n end\n end", "def mode\n defined? @mode and @mode or @mode='sandbox'\n end", "def colour_mode\n instance.options[:colour_mode]\n end", "def colour_mode\n instance.options[:colour_mode]\n end", "def binmode=(mode)\n if (true == mode or false == mode)\n @options[\"Binmode\"] = mode\n else\n raise ArgumentError, \"argument must be true or false\"\n end\n end", "def binmode=(mode)\n if (true == mode or false == mode)\n @options[\"Binmode\"] = mode\n else\n raise ArgumentError, \"argument must be true or false\"\n end\n end", "def mode=(_arg0); end", "def mode=(_arg0); end", "def mode=(_arg0); end" ]
[ "0.7370801", "0.7212881", "0.7212881", "0.71988606", "0.7154561", "0.71448255", "0.6890651", "0.6886068", "0.67921597", "0.6740494", "0.6716039", "0.6630949", "0.656621", "0.65430695", "0.65356475", "0.6477413", "0.644903", "0.6425446", "0.6424511", "0.64205956", "0.6416402", "0.6416402", "0.6416402", "0.6416402", "0.6385488", "0.6373903", "0.63571745", "0.63539404", "0.63292676", "0.63286734", "0.6306169", "0.629157", "0.6269392", "0.6175415", "0.6163451", "0.615346", "0.6132675", "0.6122053", "0.61105686", "0.61092615", "0.60927576", "0.608944", "0.6076922", "0.6072772", "0.60408896", "0.60308695", "0.6026333", "0.6023579", "0.60196483", "0.6009929", "0.60051143", "0.5965775", "0.59641874", "0.59591043", "0.5938638", "0.5905598", "0.58907837", "0.5875663", "0.5869676", "0.58687425", "0.5843757", "0.58381313", "0.5800013", "0.57904476", "0.5788916", "0.5788916", "0.5776846", "0.5774106", "0.57617235", "0.57523465", "0.5749873", "0.5740481", "0.573336", "0.57237524", "0.57237524", "0.57203454", "0.56965256", "0.56855315", "0.5685339", "0.56839144", "0.5668904", "0.5659729", "0.56575924", "0.56575924", "0.5641601", "0.5640395", "0.56333685", "0.5591962", "0.5591962", "0.5588564", "0.5586096", "0.55727893", "0.55584615", "0.5544413", "0.5544413", "0.5538072", "0.5538072", "0.55373096", "0.55373096", "0.55373096" ]
0.6799592
8
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier. The position can be 'a', 'b', 'c' or 'd'. The device identifiers can be found :ref:`here `. .. versionadded:: 2.0.0~(Plugin)
def get_identity send_request(FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id; Common.device_id(@handle); end", "def uid() end", "def card_uid\n buffer = PN532::DataBuffer.new\n\n resp = PN532.read_passive_target(\n pn_struct,\n buffer,\n PN532::MIFARE_ISO14443A,\n 1000\n )\n\n return if resp == PN532::STATUS_ERROR\n\n buffer[0...resp]\n end", "def manufacturer_id\n mac[0..7]\n end", "def uid; end", "def uid\n @uid\n end", "def uid\n @uid ||= (@in['uid_hi'] << 16) | @in['uid_lo']\n end", "def device_id\n 'bedroom'\n end", "def uid\n (@in['uid_hi'] << 16) | @in['uid_lo']\n end", "def id\n @uid\n end", "def read_uid\n readers=NFC::Reader.all\n\treaders[0].poll(Mifare::Classic::Tag) do |tag|\n\t begin\n\t \treturn \"#{tag.uid_hex.upcase}\"\n\t end\n\tend\n end", "def uid(*) end", "def device\n device_name\n end", "def device_id\n return @device_id\n end", "def device_id\n return @device_id\n end", "def device_id\n return @device_id\n end", "def device_id\n return @device_id\n end", "def a785274d_dccb_53f1_8262_012d28b070ec\n STROKEDB_UUID_CHAR + self[STROKEDB_UUID]\n end", "def getuid\n\t\trequest = Packet.create_request('stdapi_sys_config_getuid')\n\t\tresponse = client.send_request(request)\n\t\treturn response.get_tlv_value(TLV_TYPE_USER_NAME)\n\tend", "def uid\n read_attribute :uid\n end", "def display_name\n \"#{self.device_name} - #{self.uuid}\"\n end", "def device_id\n accessory_info.device_id\n end", "def get_uuid(device)\n Chef::Log.info(\"Getting uuid for device: #{device}\")\n fs_check = Mixlib::ShellOut.new(\"blkid -c /dev/null #{device}\")\n fs_check.run_command\n match = fs_check.stdout.match(/\\sUUID=\\\"(.*?)\\\"/)\n match = '' if match.nil?\n Chef::Log.info(\"uuid for device: #{device} is #{match[1]}\")\n match[1]\nend", "def platform_id\n case handle\n when \"nokia_6260\"\n 0x101fb3f4\n when \"nokia_6600\"\n 0x101f7963\n when \"nokia_6630\"\n 0x101f7964\n when \"nokia_7610\"\n 0x101fd5db\n when \"nokia_e61\"\n 0x20001858\n when \"nokia_n70\", \"nokia_n72\"\n 0x10200f9a\n else\n raise\n end\n end", "def suuid; uuid; end", "def uid_endpoint\n\t\t\t@uid[-2, 2]\n\t\tend", "def gl_vendor\n glGetString(GL_VENDOR)\n end", "def device\n return nil unless length >= 4\n return nil unless self[3].comment.last.include?(' Build/')\n\n self[3].comment.last.split(' Build/').first\n end", "def gl_vendor()\n glGetString(GL_VENDOR)\n end", "def device\n @client.get('VBD', :device, @uuid)\n end", "def uid\n @name.to_s.downcase.gsub(/[^a-z0-9]+/, '').gsub(/-+$/, '').gsub(/^-+$/, '')\n end", "def uid\n @name.to_s.downcase.gsub(/[^a-z0-9]+/, '').gsub(/-+$/, '').gsub(/^-+$/, '')\n end", "def get_device_info\n IO.popen('adb shell getprop ro.product.brand') { |f| $device = f.gets.chomp.upcase}\n $device += ' '\n IO.popen('adb shell getprop ro.product.model') { |f| $device += f.gets.chomp.upcase}\n IO.popen('adb shell getprop ro.build.version.release') { |f| $os_version = f.gets.chomp.upcase}\n return $device, $os_version\nend", "def uid\n tail_node_uid = tail_node ? tail_node.uid : ''\n head_nade_uid = head_node ? head_node.uid : ''\n tail_node_vpcid = tail_node && tail_node.vpc_id&+'-' || ''\n head_nade_vpcid = head_node && head_node.vpc_id&+'-' || ''\n \"tail-#{tail_node_vpcid}#{tail_node_uid}_head-#{head_nade_vpcid}#{head_nade_uid}_ports-#{port_start}-to-#{port_end}_proto-#{protocol || 'none'}\"\n end", "def uid\n return nil unless user_id\n user_id.split('/').first\n end", "def uid\n return nil unless user_id\n user_id.split('/').first\n end", "def cmd_getuid(*args)\n print_line(\"Server username: #{client.sys.config.getuid}\")\n end", "def get_gear_uid(gear_uuid = nil)\n # a non-numeric string is converted to 0 with to_i (which is the uid for root)\n return -1 if gear_uuid.nil?\n MCollectiveApplicationContainerProxy.rpc_exec('openshift', @id) do |client|\n client.get_gear_uid(:gear_uuid => gear_uuid) do |response|\n output = response[:body][:data][:output]\n return output\n end\n end\n return -1\n end", "def apple_uuid\n get_field('com.apple.uuid')\n end", "def _uid(uuid = @uuid)\n uuid && uuid[0,6]\n end", "def component_id\n if self.urn\n return GURN.create(self.urn, { :model => self.class })\n else\n return GURN.create(self.name, { :model => self.class })\n end\n end", "def component_id(barcode:)\n @cid_lookup[barcode]\n end", "def mount_uuid(device)\n device[\"uuid\"] || \"#{device['pciBusNumber']}#{device['pciDeviceNumber']}\"\n end", "def get_connecting_uid\n request.params[:uid]\n end", "def build_id\n build_id_offsets.each do |offset|\n next unless @leak.n(@libbase + offset + 12, 4) == \"GNU\\x00\"\n\n return @leak.n(@libbase + offset + 16, 20).unpack1('H*')\n end\n nil\n end", "def uuid\n idme_uuid\n end", "def dev_id(device: nil)\n path = \"/plugin_package\"\n response = nil\n simple_connection(device: device) do |conn|\n response = conn.get path\n end\n\n dev_id = /Your Dev ID:\\s*<font[^>]*>([^<]*)<\\/font>/.match(response.body)\n dev_id ||= /Your Dev ID:[^>]*<\\/label> ([^<]*)/.match(response.body)\n dev_id = dev_id[1] if dev_id\n dev_id ||= \"none\"\n dev_id\n end", "def physical_device_id\n return @physical_device_id\n end", "def device_name\n return @device_name\n end", "def device_name\n return @device_name\n end", "def device_name\n return @device_name\n end", "def read_device_version()\n @ramps_arduino.execute_command('F83', false, @status_debug_msg)\n end", "def device_tag\n return @device_tag\n end", "def to_s\n uid\n end", "def to_s\n uid\n end", "def uuid\n output_ptr = FFI::MemoryPointer.new(:char, 36)\n FFI::Libvirt.virDomainGetUUIDString(self, output_ptr)\n output_ptr.read_string\n end", "def cmd_uuid\n puts @fs.uuid\n end", "def uuid\n output_ptr = FFI::MemoryPointer.new(:char, 36)\n FFI::Libvirt.virStoragePoolGetUUIDString(self, output_ptr)\n output_ptr.read_string\n end", "def board_id\n dtag = @discriminator ? @discriminator.to_s[0,1]+'_':''\n \"#{dtag}#{self.img_name}\"\n end", "def ids\n @ids ||= begin\n ioctl(EVIOCGID, buf = '\\x00' * 8)\n buf.unpack('S!4')\n end\n end", "def uuid\n output_ptr = FFI::MemoryPointer.new(:char, 48)\n FFI::Libvirt.virDomainGetUUIDString(self, output_ptr)\n output_ptr.read_string\n end", "def hardware_identifier\n return @hardware_identifier\n end", "def device_id\n apn_device_token\n end", "def uuid\n node_uuid = @os.data.fetch(:dmi, {}).fetch(:system, {}).fetch(:uuid, nil)\n node_uuid && node_uuid.strip\n end", "def display_device_name\n return @display_device_name\n end", "def uuid\n @connection.uuid\n end", "def lookup_uuid\n get(KABUIDProperty)\n end", "def message_send_device_id() -1003; end", "def south_african_pty_ltd_registration_number; end", "def determine_name\n name = nil\n\n case @type\n when :computer\n name = `sudo dmidecode -s system-serial-number`.chomp\n when :hard_drive\n `sudo smartctl -i #{@options['device']}`.each_line do |line|\n line =~ /^Serial\\sNumber:\\s+([A-Za-z0-9_-]+)$/\n name = $1\n end\n end\n\n # Check if the id is valid (all word characters plus dash)\n if ( name =~ /^[A-Za-z0-9_-]+$/ )\n name\n else\n nil\n end\n end", "def get_uid_int\n self.uid.to_i\n end", "def platform_id\n case [edition, fp]\n when [0, 9]\n 0x101f6f88\n when [1, 0]\n 0x101f795f\n when [1, 2]\n 0x101f8202\n when [2, 0]\n 0x101f7960\n when [2, 1]\n 0x101f9115\n when [2, 2]\n 0x101f9115\n when [2, 3]\n 0x10200bab\n when [3, 0]\n 0x101f7961\n when [3, 1]\n 0x102032be\n else\n raise\n end\n end", "def connected_beacon_board_udev_devices\n devices = find_matching_udev_devices do |enumerator|\n enumerator.match_subsystem(\"tty\")\n enumerator.match_property(\"ID_VENDOR_ID\", VENDOR_ID)\n enumerator.match_property(\"ID_MODEL_ID\", PRODUCT_ID)\n end\n\n # Devices returned by dev_enumerator are sorted by serial number, and\n # loading beacons with unique serials is a convenient way to ensure\n # they are loaded in the correct order. To replicate the behavior of\n # dev_enumartor, sort them by serial number here too.\n devices.sort_by { |d| d.property(\"ID_SERIAL\") }\n end", "def get_oid\n \"wee_#{@canvas.current_component.object_id}\"\n end", "def uid\n id && Base58GMP.encode(id)\n end", "def druid \n \n ## Derived, *relatively* unique ID.\n return display_name.strip.downcase.delete \" .,-_'\"\n \n end", "def uid\n \"#{Socket.gethostname}-#{Process.pid}-#{thread_id}\"\n end", "def celluloid_version\n find_loaded_gem_property('celluloid', 'version')\n end", "def uid\n @uid ||= status[\"uid\"]\n end", "def serial\n fetch('device.serial')\n end", "def device_address\n # TODO: look at which device is needed\n\n main_fiber = Fiber.current\n\n # TO discover: wire to devicefound in Adapter under hci, then startdiscovery, get event, stop discovery, use new addr to createdevice in adapter, use to get serial conn\n @adapter.on_signal('DeviceFound') do |addr, attrs|\n if attrs['Name'] == @dev_id\n @adapter.StopDiscovery\n Fiber.yield addr\n end\n end\n\n rf = Fiber.new do\n main_loop = DBus::Main.new\n main_loop << @@bus\n\n @adapter.StartDiscovery\n\n main_loop.run\n end\n\n rf.resume # return result of the fiber (i.e. the address)\n end", "def get_client_id( socket )\n # UNIX socket return effective UID/GID for connected client\n euid, _ = socket.getpeereid\n\n # Find record in /etc/passwd\n user_info = Etc.getpwuid euid\n\n return \"#{user_info.name} (#{user_info.gecos})\"\n end", "def read_uid(reader=0)\n if @@debug\n puts \"Available readers: #{@@readers}\"\n end\n\n @@readers[reader].poll(Mifare::Classic::Tag) do |tag|\n begin\n uid = tag.to_s.split()[0].upcase\n if @@debug\n puts \"#{uid}\"\n end\n return uid\n rescue Exception => e\n puts e\n end\n end\n end", "def identifier\n @info.identifier\n end", "def identifier\n @info.identifier\n end", "def getPlayerUID _args\n \"getPlayerUID _args;\" \n end", "def id\n id = \"#{self.lane}\"\n id += \"_#{illumina_barcode}\" unless illumina_barcode.empty?\n id\n end", "def get_serial\n return serial if serial.present?\n\n serial = \\\n if platform =~ /^jingdong/\n \"#{Date.today.to_s.gsub('-','')}_001\"\n else\n \"#{Date.today.to_s.gsub('-','')}\"\n end\n\n self.update_attribute(:serial, serial)\n serial\n end", "def uid(idx)\n sprintf(\"%s%.2d\", id, idx)\n end", "def card_identification\n message.fields[6].strip\n end", "def name\n File.join(\"/dev/\",@device.gsub(/!/, \"/\"))\n end", "def read_device_version()\n execute_command('F83', false, @status_debug_msg)\n end", "def device_display_name\n return @device_display_name\n end", "def device_display_name\n return @device_display_name\n end", "def api_id\n chip_api.tmp_api_id\n end", "def position\n [ @x, @y, COMPASS[@orientation].to_s ]\n end", "def hive_mind_device_identifiers\n { id: @hive_id }\n end", "def uuid; end", "def uuid; end", "def root_device_name\n data[:root_device_name]\n end", "def serial_number; Common.serial_number(@handle); end" ]
[ "0.5866179", "0.55540454", "0.5548439", "0.55255497", "0.5476197", "0.5472113", "0.5406858", "0.53949773", "0.5350486", "0.5331605", "0.52923614", "0.5280304", "0.5271764", "0.5268144", "0.5268144", "0.5268144", "0.5268144", "0.52675337", "0.52609986", "0.5254086", "0.52394044", "0.523419", "0.5195622", "0.51949483", "0.51944584", "0.5191016", "0.5186175", "0.5177753", "0.5172629", "0.5172556", "0.51723385", "0.51723385", "0.51234597", "0.51133066", "0.5107776", "0.5107776", "0.51072097", "0.50923043", "0.5090876", "0.5088339", "0.5087607", "0.50817746", "0.50698847", "0.5039837", "0.5033002", "0.5030554", "0.5030039", "0.5015429", "0.50069135", "0.50069135", "0.50069135", "0.4999054", "0.49897334", "0.49860016", "0.49860016", "0.49631098", "0.4956709", "0.4952094", "0.49454626", "0.4933876", "0.49334317", "0.49204195", "0.49136564", "0.49119145", "0.48727882", "0.48688135", "0.4862824", "0.48588708", "0.48384053", "0.48209184", "0.481819", "0.48115274", "0.48046437", "0.48027655", "0.48014355", "0.48014292", "0.47872669", "0.47820905", "0.47750604", "0.47733188", "0.47674897", "0.475912", "0.47562215", "0.47546333", "0.47546333", "0.47495046", "0.4747587", "0.47455797", "0.4735975", "0.47269505", "0.4716298", "0.47090882", "0.47078276", "0.47078276", "0.4704088", "0.469791", "0.4696892", "0.4694727", "0.4694727", "0.46762887", "0.46716997" ]
0.0
-1
=begin 1 > st 2 > nd 3 > rd 0, 4..9 > th 11, 12, 13 > th =end
def century(year) if year % 100 == 0 century = year / 100 else century = (year / 100) + 1 end century.to_s + century_suffix(century) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_token # :nodoc:\n # preprocessing\n # if it is not in RD part\n # => method\n while @in_part != \"rd\"\n line = @src[@i]\n @i += 1 # next line\n\n case line\n # src end\n when false\n return [false, false]\n # RD part begin\n when /^=begin\\s*(?:\\bRD\\b.*)?\\s*$/\n if @in_part # if in non-RD part\n @part_content.push(line)\n else\n @in_part = \"rd\"\n return [:WHITELINE, \"=begin\\n\"] # <= for textblockand\n end\n # non-RD part begin\n when /^=begin\\s+(\\w+)/\n part = $1\n if @in_part # if in non-RD part\n @part_content.push(line)\n else\n @in_part = part if @tree.filter[part] # if filter exists\n# p \"BEGIN_PART: #{@in_part}\" # DEBUG\n end\n # non-RD part end\n when /^=end/\n if @in_part # if in non-RD part\n# p \"END_PART: #{@in_part}\" # DEBUG\n # make Part-in object\n part = RDoc::RD::Part.new(@part_content.join(\"\"), @tree, \"r\")\n @part_content.clear\n # call filter, part_out is output(Part object)\n part_out = @tree.filter[@in_part].call(part)\n\n if @tree.filter[@in_part].mode == :rd # if output is RD formatted\n subtree = parse_subtree(part_out.to_a)\n else # if output is target formatted\n basename = TMPFILE.join('.')\n TMPFILE[-1] += 1\n tmpfile = open(@tree.tmp_dir + \"/\" + basename + \".#{@in_part}\", \"w\")\n tmpfile.print(part_out)\n tmpfile.close\n subtree = parse_subtree([\"=begin\\n\", \"<<< #{basename}\\n\", \"=end\\n\"])\n end\n @in_part = nil\n return [:SUBTREE, subtree]\n end\n else\n if @in_part # if in non-RD part\n @part_content.push(line)\n end\n end\n end\n\n @current_indent = @indent_stack.join(\"\")\n line = @src[@i]\n case line\n when false\n if_current_indent_equal(\"\") do\n [false, false]\n end\n when /^=end/\n if_current_indent_equal(\"\") do\n @in_part = nil\n [:WHITELINE, \"=end\"] # MUST CHANGE??\n end\n when /^\\s*$/\n @i += 1 # next line\n return [:WHITELINE, ':WHITELINE']\n when /^\\#/ # comment line\n @i += 1 # next line\n self.next_token()\n when /^(={1,4})(?!=)\\s*(?=\\S)/, /^(\\+{1,2})(?!\\+)\\s*(?=\\S)/\n rest = $' # '\n rest.strip!\n mark = $1\n if_current_indent_equal(\"\") do\n return [:HEADLINE, [MARK_TO_LEVEL[mark], rest]]\n end\n when /^<<<\\s*(\\S+)/\n file = $1\n if_current_indent_equal(\"\") do\n suffix = file[-3 .. -1]\n if suffix == \".rd\" or suffix == \".rb\"\n subtree = parse_subtree(get_included(file))\n [:SUBTREE, subtree]\n else\n [:INCLUDE, file]\n end\n end\n when /^(\\s*)\\*(\\s*)/\n rest = $' # '\n newIndent = $2\n if_current_indent_equal($1) do\n if @in_verbatim\n [:STRINGLINE, line]\n else\n @indent_stack.push(\"\\s\" + newIndent)\n [:ITEMLISTLINE, rest]\n end\n end\n when /^(\\s*)(\\(\\d+\\))(\\s*)/\n rest = $' # '\n mark = $2\n newIndent = $3\n if_current_indent_equal($1) do\n if @in_verbatim\n [:STRINGLINE, line]\n else\n @indent_stack.push(\"\\s\" * mark.size + newIndent)\n [:ENUMLISTLINE, rest]\n end\n end\n when /^(\\s*):(\\s*)/\n rest = $' # '\n newIndent = $2\n if_current_indent_equal($1) do\n if @in_verbatim\n [:STRINGLINE, line]\n else\n @indent_stack.push(\"\\s#{$2}\")\n [:DESCLISTLINE, rest]\n end\n end\n when /^(\\s*)---(?!-|\\s*$)/\n indent = $1\n rest = $'\n /\\s*/ === rest\n term = $'\n new_indent = $&\n if_current_indent_equal(indent) do\n if @in_verbatim\n [:STRINGLINE, line]\n else\n @indent_stack.push(\"\\s\\s\\s\" + new_indent)\n [:METHODLISTLINE, term]\n end\n end\n when /^(\\s*)/\n if_current_indent_equal($1) do\n [:STRINGLINE, line]\n end\n else\n raise \"[BUG] parsing error may occurred.\"\n end\nend", "def parsed_range(splits)\n last_tuple = splits.pop\n body_of(splits) + head_of(last_tuple)\n end", "def stderrs; end", "def partial_instruction_of(splits)\n splits.inject('') do |string, sub_range|\n \"#{string}#{head_of(sub_range)};\"\n end\n end", "def wrap(range, before, after); end", "def wrap(range, before, after); end", "def wrap(range, before, after); end", "def wrap(range, before, after); end", "def wrap(range, before, after); end", "def wrap(range, before, after); end", "def wrap(range, before, after); end", "def else_range(node); end", "def verses(first, last)\n\t\t(first..last).each_with_object(\"\") do |num, str| \n\t\t\tstr << verse(num) + \"\\n\"\n\t\tend\n\tend", "def yummie(n)\r\n\r\n print \"(\"\r\n (1..n).each{\r\n print \" \"\r\n }\r\n print \".\"\r\n (1..n).each{\r\n print \" \"\r\n }\r\n print \"v\"\r\n (1..n).each{\r\n print \" \"\r\n }\r\n print \".\"\r\n (1..n).each{\r\n print \" \"\r\n }\r\n print \")\"\r\n\r\nend", "def parsed_command_of(slits)\n even_odd_half_of(slits).map{|t| parsed_range(t)}\n end", "def reduce_begin_with(_production, _range, _tokens, _children)\n begin_anchor\n end", "def buddy(start, nd)\r\n start.upto(nd) do |n|\r\n potential_match = sum_divisors(n)\r\n next if potential_match < n\r\n return \"(#{n} #{potential_match})\" if sum_divisors(potential_match) == n\r\n end\r\n 'Nothing'\r\nend", "def multi_end2(ttls)\n rpls = ''\n ttl = @tg_end.size-1\n ttl = ttls-1 if ttls\n ttl.downto(0) do |i|\n sz = @tg_end[i][/^ +/].to_s.size\n if ttls || @spc.size <= sz\n send = @tg_end.pop\n if send.strip[0,5]==\"!run!\"\n scrpt = send.gsub(\"\\n\",\"\\n#{@spc}\").split(\"\\n\")\n @doc_src = scrpt[1,99]+@doc_src\n else\n spc = send[/(^[ \\t]*)/,1].to_s\n rpls << (send.gsub(\"\\n\",\"\\n#{spc}\") + \"\\n\") \n end\n end\n end\n p \"End2 : #{rpls}\" if @dbg[:parse] && rpls!= ''\n rpls\n end", "def parts\n return unless isbn13\n\n group = prefix = nil\n\n RANGES.each_pair do |g, prefixes|\n next unless isbn13.match(\"^#{g}\")\n group = g\n\n pre_loc = group.length\n prefixes.each do |p|\n number = isbn13.slice(pre_loc, p[:length]).to_i\n next unless p[:range].include?(number)\n\n prefix = p.merge(:number => number)\n break\n end\n\n break\n end\n\n # In the unlikely event we can't categorize it...\n return unless group && prefix\n\n prefix = sprintf(\"%0#{prefix[:length]}d\", prefix[:number])\n [group[0..2], group[3..-1], prefix, isbn13[(group.length + prefix.length)..-2], isbn13[-1..-1]]\n end", "def folding_ranges; end", "def segments word\n (0..word.length-3).map do |i|\n word[i...i+3]\n end\nend", "def begin(p0) end", "def next_part\n nl \"#{algn\"|::#{id_name}: search_space\"}#{search_space.inspect}\", 3\n nl \"#{algn\"|::#{id_name}: limit\"}#{\" \"*(start_token_search_space.inspect.size-2)}^\", 3\n nl \"#{algn\"|::#{id_name}: find own end pattern\"}#{@rule.end_pattern(start_captures).inspect}\", 3\n \n # If this happens to be a for_pattern rule (which by definition, can't have children)\n if @rule.consume_immediately?\n nl \"|::#{id_name}: CONSUME SELF IMMEDIATELY\", 3 \n # Set the end part to \"\" and stop looking for parts\n @end_part = nil\n @end_part_offset = 0\n return nil\n end\n\n # By default, always look for our own end pattern\n end_patterns = {:own_end_pattern => proc{ @rule.end_pattern(start_captures) }}\n \n # If we have no end rule, look for the parent's rule instead\n if @rule.end_rule.nil? && parent\n nl \"#{algn\"|::#{id_name}: or parent end pattern\"}#{first_parent_end_pattern.inspect}\", 3\n end_patterns[:parent_end_pattern] = proc {\n first_parent_end_pattern\n }\n end\n first_match = Match.first(search_space, @rule.child_rules, start_token_limit, \n #Look for any of our possible child rules' start patterns\n proc{|obj|\n obj.start_pattern\n },\n #... if matched by their end patterns\n proc{|obj, captures|\n obj.end_pattern(captures)\n #Or one of the end patterns we are looking for - whichever comes sooner \n }, end_patterns)\n\n #If we have an unconditional_rule, and we found no start rules\n if @rule.unconditional_rule && (!first_match || !first_match.matched_obj)\n nl \"|:::#{id_name}: UNCONDITIONAL RULE #{@rule.unconditional_rule.scope_name.inspect} \", 3 \n unless @used_up_unconditional\n # Fake a match for the unconditional rule (matching the whole search_space end to end)\n new_scope = nil\n indent \"| \" do\n new_scope = Scope.new(@rule.unconditional_rule, search_space, self)\n end\n @parts << new_scope\n @used_up_unconditional = true\n return new_scope\n else\n nl \"::: but it was used up\",3\n end\n end\n \n # Nothing else is left - we probably ran out of source\n if first_match.nil?# && parent.nil?\n @parts << search_space\n nl \"|:::#{id_name}: FOUND NOTHING AT ALL .. #{search_space.size} chars added to parts\", 1\n return nil\n end\n \n # if we matched one of our children's start rules, create a new scope for them\n if first_match.matched_obj\n nl \"|:::#{id_name}: FOUND NEW SCOPE START #{first_match.matched_obj.scope_name.inspect}\", 3\n @parts << first_match.find_match.pre_match\n advance_by(first_match.find_match.end(0))\n new_scope = nil\n indent \"| \" do\n new_scope_start_part = first_match.find_match[0]\n new_scope_start_captures = first_match.find_match.captures\n new_scope = Scope.new(first_match.matched_obj, first_match.full_post_find_match, self, new_scope_start_part, new_scope_start_captures)\n end\n @parts << new_scope\n return new_scope\n end\n \n # If you found an end_pattern, take note of where you found it and return yourself\n if which_end = first_match.matched_additional\n src_to_end_part = first_match.find_match.pre_match\n @parts << src_to_end_part unless src_to_end_part.empty?\n @end_part_offset = @offset\n if which_end == :own_end_pattern\n @end_part_offset += first_match.find_match.end(0)\n @end_part = first_match.find_match[0]\n elsif which_end == :parent_end_pattern\n # When matching an unconditional end (via it's parent) we want to return BEFORE the actual end token (so the parent may properly consume it)\n @end_part_offset += first_match.find_match.begin(0)\n @end_part = \"\"\n end\n @end_part = nil if @end_part.empty?\n @parts << @end_part unless @end_part.nil?\n nl \"|:::#{id_name}: FOUND END TOKEN #{first_match.matched_additional.inspect} at offset #{@end_part_offset}\", 3\n return nil\n end\n end", "def foldable_comment_block_ranges; end", "def rec(n,d,bl)\n\t\tif d == bl then 'V' \n\t\telsif n % 2 > 0 then \n\t\t\t'($cons $t ' + rec(n/2,d+1,bl) + ')'\n\t\telse\n\t\t\t'($cons $f ' + rec(n/2,d+1,bl) + ')'\n\t\tend\n\tend", "def acct_groups(students)\nnum_students = students.length\n\n#driver code\n# p num_students\n\nif num_students <= 5\n p students\nelsif num_students % 5 == 0 || num_students % 5 >= 3\n p students.each_slice(5).to_a\nelsif num_students % 4 == 0 || num_students % 4 >= 3\n p students.each_slice(4).to_a {|group| p group}\nelsif num_students % 3 == 0\n p students.each_slice(3).to_a {|group| p group}\nelse\n p students.shift(3)\n p students.each_slice(5).to_a\nend\nend", "def process(start, finish)\n # Clean up\n array.clear\n\n # Iterate\n start.upto(finish) do |n|\n if n % (first_number * second_number) == 0\n array << word1 + word2\n elsif n % first_number == 0\n array << word1\n elsif n % second_number == 0\n array << word2\n else\n array << n\n end\n end\n end", "def parts; end", "def parts; end", "def parts; end", "def _reduce_101(val, _values, result)\n index = @block_parser.add_footnote val[1].rdoc\n result = \"{*#{index}}[rdoc-label:foottext-#{index}:footmark-#{index}]\"\n\n result\nend", "def each_mid(&block)\n \n end", "def bst_sequences(root)\n\nend", "def wrap(range, insert_before, insert_after); end", "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", "def lh(t, s, c)\n\n end", "def ex2\n for i in (0..5)\n for j in (1..(4 - (4 - i).abs))\n print '#'\n end\n print \"\\n\"\n end\nend", "def reduce_between_and(_production, _range, _tokens, theChildren)\n lower = theChildren[1].token.lexeme.to_i\n upper = theChildren[3].token.lexeme.to_i\n multiplicity(lower, upper)\n end", "def nd!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n\n type = ND\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n d = nil\n\n\n \n # - - - - main rule block - - - -\n # at line 349:5: d= ( ( DIGIT )* ) '2' ( 'N' | 'n' ) ( 'D' | 'd' )\n # at line 349:7: ( ( DIGIT )* )\n # at line 349:8: ( DIGIT )*\n # at line 349:8: ( DIGIT )*\n while true # decision 2\n alt_2 = 2\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0 == 0x32 )\n look_2_1 = @input.peek( 2 )\n\n if ( look_2_1.between?( 0x30, 0x39 ) )\n alt_2 = 1\n\n end\n elsif ( look_2_0.between?( 0x30, 0x31 ) || look_2_0.between?( 0x33, 0x39 ) )\n alt_2 = 1\n\n end\n case alt_2\n when 1\n # at line 349:8: DIGIT\n digit!\n\n else\n break # out of loop for decision 2\n end\n end # loop for decision 2\n\n match( 0x32 )\n if @input.peek(1) == 0x4e || @input.peek(1) == 0x6e\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n if @input.peek(1) == 0x44 || @input.peek(1) == 0x64\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\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__, 50 )\n\n end", "def insert_before_multi(range, content); end", "def pan_body()\n self.zip((?a..?z).to_a).collect do |n, c|\n sprintf(\" %s%s %c%s\", \\\n (c==?z ? \"and \" : \"\"), \\\n n.to_en, c, \\\n (n>1) ? \"'s\" : \"\")\n end\n end", "def dynamic_chunk(base_ten_num) #=>inncludes first 1 in output\n base_two_num = binarify(base_ten_num)\n base_two_num.slice(static_chunk(base_ten_num).length..(base_two_num.length - 1))\nend", "def arith(b,opt=\"M\") return \"@SP\\nAM=M-1\\nD=M\\nA=A-1\\n\"+opt+\"=M\"+b+\"D\\n\" end", "def tenders_adv(start, num)\n\nend", "def strand; @data[8]; end", "def tdist(n, t); p_t(n, t); end", "def process_range(range)\n multi = multiple_of_3_and_5(range - 1)\n sum = addition(multi)\n\n puts sum\nend", "def iterate rule, seed\n \"00#{seed}00\".chars.each_cons(3).map { |c| rule[c.join.to_i 2] }.join\nend", "def test_nested_loops\n want = <<~EDI.gsub(/\\n/, \"\")\n ST*810*0001~\n BIG*19700101*test*19700101*00000007397108*004010~\n REF*IO*define-this-value~\n N1*ST*Sweeney Todd~\n N3*2705 Fleet St~\n N4*Birmingham*AL*35226*US~\n DTM*011*19700101~\n IT1*1*1*EA*59.95**UP*860001662184*VP*860001662184*A3*860001662184*ZZ*860001662184*EN*860001662184~\n CTP**DPR*0*0**DIS*0*59.95~\n PID*F****CBD Topical Cream 400mg THC Free~\n SAC*C*ZZZZ***0~\n IT1*2*2*EA*49.95**UP*860001662184*VP*860001662184*A3*860001662184*ZZ*860001662184*EN*860001662184~\n CTP**DPR*0*0**DIS*0*49.95~\n PID*F****500mg Full Spectrum Garden Mint Oil Tincture~\n SAC*C*ZZZZ***0~\n TDS*17985~\n CAD*****define-this-value~\n SAC*C*ZZZZ***5995~\n SAC*C*ZZZZ***9990~\n CTT*2~\n SE*21*0001\n EDI\n store = Eddy::Data::Store.new(time: @epoch)\n ts = Eddy::TransactionSets::TS810::TS.new(store)\n ts.BIG do |big|\n big.BIG01 = @epoch\n big.BIG02 = \"test\"\n big.BIG03 = @epoch\n big.BIG04 = \"00000007397108\"\n big.BIG05 = \"004010\"\n end\n ts.REF.REF01 = \"IO\"\n ts.REF.REF02 = \"define-this-value\"\n ts.L_N1 do |n1|\n n1.N1.N101 = \"ST\"\n n1.N1.Name = \"Sweeney Todd\"\n n1.N3.AddressInformation1 = \"2705 Fleet St\"\n n1.N4.CityName = \"Birmingham\"\n n1.N4.StateOrProvinceCode = \"AL\"\n n1.N4.PostalCode = \"35226\"\n n1.N4.CountryCode = \"US\"\n end\n ts.DTM.DTM01 = \"011\"\n ts.DTM.DTM02 = @epoch\n ts.L_IT1 do |rep|\n rep.IT1 do |it1|\n it1.AssignedIdentification = \"1\"\n it1.QuantityInvoiced = 1\n it1.IT103 = \"EA\"\n it1.UnitPrice = 59.95\n it1.IT106 = \"UP\"\n it1.IT107 = \"860001662184\"\n it1.IT108 = \"VP\"\n it1.IT109 = \"860001662184\"\n it1.IT110 = \"A3\"\n it1.IT111 = \"860001662184\"\n it1.IT112 = \"ZZ\"\n it1.IT113 = \"860001662184\"\n it1.IT114 = \"EN\"\n it1.IT115 = \"860001662184\"\n end\n # CTP\n rep.CTP do |ctp|\n ctp.CTP02 = \"DPR\"\n ctp.CTP03 = 0\n ctp.CTP04 = 0\n ctp.CTP06 = \"DIS\"\n ctp.CTP07 = 0\n ctp.CTP08 = 59.95\n end\n # PID\n rep.L_PID do |pid|\n pid.PID.PID01 = \"F\"\n pid.PID.PID05 = \"CBD Topical Cream 400mg THC Free\"\n end\n # SAC\n rep.L_SAC do |sac|\n sac.SAC.SAC01 = \"C\"\n sac.SAC.SAC02 = \"ZZZZ\"\n sac.SAC.SAC05 = 0\n end\n end\n ts.L_IT1 do |rep|\n # IT1\n rep.IT1.AssignedIdentification = \"2\"\n rep.IT1.QuantityInvoiced = 2\n rep.IT1.IT103 = \"EA\"\n rep.IT1.UnitPrice = 49.95\n rep.IT1.IT106 = \"UP\"\n rep.IT1.IT107 = \"860001662184\"\n rep.IT1.IT108 = \"VP\"\n rep.IT1.IT109 = \"860001662184\"\n rep.IT1.IT110 = \"A3\"\n rep.IT1.IT111 = \"860001662184\"\n rep.IT1.IT112 = \"ZZ\"\n rep.IT1.IT113 = \"860001662184\"\n rep.IT1.IT114 = \"EN\"\n rep.IT1.IT115 = \"860001662184\"\n # CTP\n rep.CTP.CTP02 = \"DPR\"\n rep.CTP.CTP03 = 0\n rep.CTP.CTP04 = 0\n rep.CTP.CTP06 = \"DIS\"\n rep.CTP.CTP07 = 0\n rep.CTP.CTP08 = 49.95\n # PID\n rep.L_PID do |rep|\n rep.PID.PID01 = \"F\"\n rep.PID.PID05 = \"500mg Full Spectrum Garden Mint Oil Tincture\"\n end\n # SAC\n rep.L_SAC do |rep|\n rep.SAC.SAC01 = \"C\"\n rep.SAC.SAC02 = \"ZZZZ\"\n rep.SAC.SAC05 = 0\n end\n end\n ts.TDS.TDS01 = 179.85\n ts.CAD.CAD05 = \"define-this-value\"\n ts.L_SAC do |rep|\n rep.SAC.SAC01 = \"C\"\n rep.SAC.SAC02 = \"ZZZZ\"\n rep.SAC.SAC05 = 59.95\n end\n ts.L_SAC do |rep|\n rep.SAC.SAC01 = \"C\"\n rep.SAC.SAC02 = \"ZZZZ\"\n rep.SAC.SAC05 = 49.95 * 2\n end\n ts.CTT.NumberOfLineItems = 2\n result = ts.render()\n assert_equal(want, result)\n end", "def test_verse_range_and_separated_verse\n text = 'Ruth 2,1-3.11'\n t1, t2 = text.split(dot)\n assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 2, v1: 1, b2: :Ruth, c2: 2, v2: 3), dot, pass(text: t2, b1: :Ruth, c1: 2, v1: 11, b2: :Ruth, c2: 2, v2: 11)]\n end", "def navidad(n)\n result = \"\"\n n.times do |ind| \n i = ind + 1 \n (n-i).times do \n result += \" \"\n end\n i.times do\n result += \"* \" \n end\n result += \"\\n\" \n end\n \n 3.times do |i|\n if i != 2\n n.times do |b|\n if (n+1)/2 == b+1\n result += \"* \"\n else\n result += \" \"\n end \n end\n result += \"\\n\"\n else\n n.times do |b| \n if ((n+1)/2)-2 == b || ((n+1)/2)-1 == b || (n+1)/2 == b\n result += \"* \"\n else\n result += \" \"\n end \n end\n end\n end \n result\nend", "def mid_cls\n\tfor index in 0..10\n puts (\"\\n\")\n end\n end", "def segment(text, filters, n)\n uncollected_segments = lex(text).flat_map(&:split)\n segments = uncollected_segments.group_by { |s| [s.start, s.end] }.values.map do |segs|\n Segment.new segs, filters, @starters, @do_unary_branch_check, n\n end\n segments.group_by(&:end).each do |final_offset, segs|\n continuations = segments.select { |s| s.start == final_offset }\n segs.each { |s| s.continuations = continuations }\n end\n segments\n end", "def calcSectionNo(startNo=1, range=0, size=0, dep=1, str='', outerStack)\n stack = outerStack #Stack.instance\n i = dep.to_i\n counter = 0\n numberStr = [[\"%\",i,counter],[\"%%\",i,counter],[\"%%%\",i,counter],\n [\"%%%%\",i,counter],[\"%%%%%\",i,counter],[\"%%%%%%\",i,counter]]\n number = \"\"\n headNo = size.to_i\n\n if (headNo > $MAX_H) || (headNo <= 0) then \n @@log.error(\"AoBane Syntax Error: Header shortage!\") \n raise SyntaxError,\"Headder shortage!\"\n else\n (1..headNo).each_with_index{|k| #h1 to h6\n p k\n if (k < headNo) then\n p \"+++\" # #{k},#{stack.sizeofStack}\"\n if k >= stack.size then\n stack.push(numberStr[k])\n end\n elsif k == headNo then\n p \"---\"\n if stack.size == 0 then\n stack.push(numberStr[k-1])\n end\n if stack.last[$S_SLOT].size > numberStr[k-1][$S_SLOT].size then\n loop do\n stack.pop\n if stack.last[$S_SLOT].size == numberStr[k-1][$S_SLOT].size then\n break\n end\n end\n end\n else\n p \"~~~~\"\n stack.push(numberStr[k])\n end #if...elsif \n }\n=begin\n else\n @@log.error(\"AoBane Syntax Error: Header Number Overflow!\")\n raise SyntaxError,\"Header Number Overflow!\"\n end #case\n=end\n end #if...else\n p \"$$$$\" \n number = \"\"\n stack.each { |item|\n if item == stack.last then\n item[$N_SLOT] += item[$C_SLOT]\n item[$C_SLOT] = 1\n end\n number << (item[$N_SLOT]).to_s + '.'\n @@log.debug number\n }\n \n h = \"#\"\n times = startNo.to_i + size.to_i - 1\n return h*times + number + str\nend", "def book(start, end)\n \n end", "def book(start, end)\n \n end", "def book(start, end)\n \n end", "def first_second_and_third_students\n puts STUDENT_NAMES[0.. 2]\n # Write a solution that returns the first, second and third students\nend", "def three_and_5(number)\r\n \r\nend", "def test_verse_range_and_separated_verse\n text = 'Ruth 2,1-3.11'\n t1, t2 = text.split(dot)\n assert_parsed_ast_for_text [pass(text: t1, b1: :Ruth, c1: 2, v1: 1, b2: :Ruth, c2: 2, v2: 3), dot, pass(text: t2, b1: :Ruth, c1: 2, v1: 11, b2: :Ruth, c2: 2, v2: 11)], text\n end", "def merge numbers, si, mi1, ei\n mi2 = mi1+1\n verboser \"Merging: #{numbers[si..mi1].inspect} and #{numbers[mi2..ei]}\"\n\n # TODO: your cool code goes here\n\n verboser \" Merged subset: #{tmp.inspect}\"\nend", "def the_stans(data)\nend", "def nth(n)\n if n > 9 and n.to_s[-2..-1].to_i.between?(10,19)\n \"#{n}th\"\n elsif n.to_s[-1].to_i == 1\n \"#{n}st\"\n elsif n.to_s[-1].to_i == 2\n \"#{n}nd\"\n elsif n.to_s[-1].to_i == 3\n \"#{n}rd\"\n else\n \"#{n}th\"\n end \n end", "def lfmi()\n return last + \" \" + first + \" \" + middle[0] \n end", "def segments; end", "def nest(name, tex) # nitin: this is the engine that does recursive decent parsing of blocks, sections etc\n rname = Regexp.escape(name)\n rst = Regexp.new(\"\\\\\\\\begin\\{#{rname}\\}(.*?)\\\\\\\\end\\{#{rname}\\}(.*)?\", Regexp::MULTILINE)\n # puts rst.inspect\n m = tex.match(rst)\n # m.to_a.each_with_index do |d,i| \n # puts (\"m#{i}\")*20\n # puts \"name #{name}\"\n # puts d\n # end\n return nil unless m\n found = m[1]\n rest = m[2]\n rest = nil if (rest == \"\" || rest.squeeze == \" \")\n [found, rest]\n end", "def ex1\n for i in (0..5)\n for j in (1..(6 - i))\n print '#'\n end\n print \"\\n\"\n end\nend", "def numbers\n %w[1 2 3 4 5 6 7 8 9 0\n tenth ninth eighth seventh sixth fifth fourth third second first\n ten nine eight seven six five four three two one ]\n end", "def range(input); end", "def compute(name, ref, span, snps)\n return if span.length < 1\n\n span.sort! {|a,b| a[0] <=> b[0]}\n head = span.shift\n ss,ee = head[0],head[1]\n array = []\n \n array << ss \n span.each do |breaks|\n array << breaks[0]\n array << breaks[1]\n end\n array << ee \n\n while array.size > 0\n s = array.shift\n e = array.shift\n# $stderr.puts \"#{ref}\\t#{s}\\t#{e}\"\n (s..e).each do |i|\n @coverage[ref][i] += 1 #Compute coverage on base i\n end\n end\n\n snps.each_key do |pos|\n refbase = @seq[ref][pos-1,1].upcase\n curbase = snps[pos][:snpbase]\n if snps.key?(pos + 1) or snps.key?(pos + 2) or snps.key?(pos - 1) or snps.key?(pos - 2)\n if snps.key?(pos + 1) and refbase == snps[pos+1][:snpbase] and curbase == @seq[ref][pos,1].upcase\n snps[pos][:info] << \"swap;\"\n elsif snps.key?(pos - 1) and refbase == snps[pos-1][:snpbase] and curbase == @seq[ref][pos-2,1].upcase \n snps[pos][:info] << \"swap;\"\n elsif snps.key?(pos + 2) and refbase == snps[pos+2][:snpbase] and curbase == @seq[ref][pos+1,1].upcase\n snps[pos][:info] << \"swap;\"\n elsif snps.key?(pos - 2) and refbase == snps[pos-2][:snpbase] and curbase == @seq[ref][pos-3,1].upcase\n snps[pos][:info] << \"swap;\"\n elsif snps.key?(pos + 1) or snps.key?(pos - 1) \n snps[pos][:info] << \"mnp;\"\n else\n snps[pos][:info] << \"snp;\" \n end\n else\n snps[pos][:info] << \"snp;\" \n end\n @snp[ref][pos] = '' unless @snp[ref].key?(pos)\n @snp[ref][pos] << snps[pos][:info]\n end\nend", "def genome(liszt)\n=begin\n[samopen] SAM header is present: 2 sequences\n7621912 reads; of these:\n 4009241 (52.60%) were paired; of these:\n 1983557 (49.47%) aligned concordantly 0 times\n 1818685 (45.36%) aligned concordantly exactly 1 time\n 206999 (5.16%) aligned concordantly >1 times\n ----\n 1983557 pairs aligned concordantly 0 times; of these:\n 409503 (20.64%) aligned discordantly 1 time\n ----\n 1574054 pairs aligned 0 times concordantly or discordantly; of these:\n 3148108 mates make up the pairs; of these:\n 1009275 (32.06%) aligned 0 times\n 35392 (1.12%) aligned exactly 1 time\n 2103441 (66.82%) aligned >1 times\n 3612671 (47.40%) were unpaired; of these:\n 498719 (13.80%) aligned 0 times\n 2246121 (62.17%) aligned exactly 1 time\n 867831 (24.02%) aligned >1 times\n=end\n #puts(liszt);exit\n dict={}; liszt.shift\n dict[\"total\"]=liszt.shift.split[0]; #liszt.shift\n dict[\"paired\"]=liszt.shift.split[0]; liszt.shift #conc 0\n dict[\"conc_once\"]=liszt.shift.split[0]\n dict[\"conc_mult\"]=liszt.shift.split[0]\n liszt.shift(2); dict[\"disc_once\"]=\"\"; dict[\"disc_mult\"]=\"\"\n line=liszt.shift\n line.include?(\">1 times\") ? dict[\"disc_mult\"]=line.split[0] : dict[\"disc_once\"]=line.split[0]\n liszt.shift\n dict[\"unaligned_pairs\"]=liszt.shift.split[0]\n liszt.shift\n dict[\"unmates\"]=liszt.shift.split[0] #unaligned mates\n dict[\"mate_once\"]=liszt.shift.split[0]\n dict[\"mate_mult\"]=liszt.shift.split[0]\n dict[\"unpaired\"]=liszt.shift.split[0]\n dict[\"unpair_unaligned\"]=liszt.shift.split[0]\n dict[\"unpair_once\"]=liszt.shift.split[0]\n dict[\"unpair_mult\"]=liszt.shift.split[0]\n dict\nend", "def ct(t,w) u=t.length;r=w-(l=w/2-u/2)-u;' '*l+t+' '*r end", "def steps(n)\nend", "def if_range(node); end", "def range_by_lines(range); end", "def part1(i)\n floor = 0\n i.each_char do |char|\n case char\n when '(' then floor += 1\n when ')' then floor -= 1\n end\n end\n floor\nend", "def oxfordize(parts)\n case parts.size\n when 0..1\n parts.first\n when 2\n parts.join(' and ')\n else\n \"#{parts.slice(0..-2).join(', ')}, and #{parts.slice(-1)}\"\n end\nend", "def th!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 52 )\n\n type = TH\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n d = nil\n\n\n \n # - - - - main rule block - - - -\n # at line 351:5: d= ( ( DIGIT )* ) DIGIT ( 'T' | 't' ) ( 'H' | 'h' )\n # at line 351:7: ( ( DIGIT )* )\n # at line 351:8: ( DIGIT )*\n # at line 351:8: ( DIGIT )*\n while true # decision 4\n alt_4 = 2\n look_4_0 = @input.peek( 1 )\n\n if ( look_4_0.between?( 0x30, 0x39 ) )\n look_4_1 = @input.peek( 2 )\n\n if ( look_4_1.between?( 0x30, 0x39 ) )\n alt_4 = 1\n\n end\n\n end\n case alt_4\n when 1\n # at line 351:8: DIGIT\n digit!\n\n else\n break # out of loop for decision 4\n end\n end # loop for decision 4\n\n digit!\n if @input.peek(1) == 0x54 || @input.peek(1) == 0x74\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n if @input.peek(1) == 0x48 || @input.peek(1) == 0x68\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\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__, 52 )\n\n end", "def nthterm(first, n, c)\n first + n * c\nend", "def render_extend_interp_spokes(shiftx, shifty, color, ibegin, iend)\n \n\n iend.each_with_index do |p, i|\n#\tif p.size >= 4 and (p[3].is_a? Integer) and p[3] >= 0 and p[3] < 3 \n#\t @app.stroke $sreps[p[3]].color\n\n\tif p.size >=3 and (p[2].is_a? Integer) and p[2] >= 0 and p[2] < 3 \n\t @app.stroke $sreps[p[2]].color\n\telse \n @app.stroke color\n\tend\n @app.line(ibegin[i][0]+shiftx, ibegin[i][1]+shifty, p[0]+shiftx, p[1]+shifty)\n end\n end", "def insert_after_multi(range, content); end", "def parse_block_math; end", "def create_bban_ranges(bban_structure)\n arr = bban_structure.scan(/((\\d+)![anc])/)\n\n start = 0\n\n arr.each_with_object([]) do |(structure, length), acc|\n end_number = start + length.to_i - 1\n acc.push([structure, start..end_number])\n start = end_number + 1\n end\n end", "def base\n nombre = @nombre\n b = 1# nombre de diese\n nombre.times do |i|\n if i == 0\n next\n end\n espace = \" \"\n has = \"# \"\n \n c = nombre - i# nombre d'espace\n a = nombre - c\n puts \" #{espace*=c} #{has=has*b}\"\n b = (i + 2 + a)-1# nombre de diese\n end\n\nend", "def st!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 49 )\n\n type = ST\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n d = nil\n\n\n \n # - - - - main rule block - - - -\n # at line 348:5: d= ( ( DIGIT )* ) '1' ( 'S' | 's' ) ( 'T' | 't' )\n # at line 348:7: ( ( DIGIT )* )\n # at line 348:8: ( DIGIT )*\n # at line 348:8: ( DIGIT )*\n while true # decision 1\n alt_1 = 2\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0 == 0x31 )\n look_1_1 = @input.peek( 2 )\n\n if ( look_1_1.between?( 0x30, 0x39 ) )\n alt_1 = 1\n\n end\n elsif ( look_1_0 == 0x30 || look_1_0.between?( 0x32, 0x39 ) )\n alt_1 = 1\n\n end\n case alt_1\n when 1\n # at line 348:8: DIGIT\n digit!\n\n else\n break # out of loop for decision 1\n end\n end # loop for decision 1\n\n match( 0x31 )\n if @input.peek(1) == 0x53 || @input.peek(1) == 0x73\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n if @input.peek(1) == 0x54 || @input.peek(1) == 0x74\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\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__, 49 )\n\n end", "def calculate_blocks(s, start_i, end_i, *operators)\n # The reason you do this is because on the final pass, Rs won't me removed\n # before it does one last run, often Rs replace brackets and any number\n # multiplied by R is 0\n # If you don't remove the useless elements it all fucks up\n # IF SOMETHING IS NOT DELETED, UNCOMMENT THIS\n s.delete(\"R\")\n op_index = \"\"\n get_logger.debug(\"Calculating formula blocks with operators #{operators} in range #{start_i}..#{end_i} of #{s}\")\n (start_i..end_i).each.with_index(start_i) { |i|\n v = s[i]\n get_logger.debug(\"Checking index #{i} in array, value present #{v}\")\n # First check if operator is valid, this is done to conform to PEDMAS\n if CalcParser.includes_operator(*operators, v)\n op = CalcParser.extract_operator(v)[0]\n get_logger.debug(\"Found operator '#{op}'\")\n if CalcParser.is_scientific_formula(v)\n # Since a scientific formula can have anything in the brackets, we need\n # check inside for a formula, recursive again\n v = v.delete_prefix(CalcParser.extract_prefix(v)[0]).delete_suffix(\")\")\n v = CalcParser.parse(v)\n # Pow uses a special format\n if op == \"pow\"\n s[i] = get_result(op, v[0].to_f, v[1].to_f)\n else\n perform_pedmas(v, 0, v.length - 1)\n s[i] = get_result(op, v[0].to_f)\n end\n next\n end\n if CalcParser.is_square(v)\n number = CalcParser.extract_number(v)[0].to_f\n # There are two situations where ^ can appear, x^ or (x*x)^, we check for both\n # since the parser don't care\n if number == 0\n number = s[i - 1].to_f\n s[i - 1] = \"R\"\n end\n s[i] = get_result(op, number)\n next\n end\n # We just assume that it's standard left and right operand operations at this point, maybe safe?\n left_operand, right_operand = assign_operands(s, i)\n # Important check, makes sure that there are no double or missing operators. Needs tidied and debug messages added\n if !CalcParser.is_number(left_operand) or !CalcParser.is_number(right_operand)\n exit\n end\n # Replaces the operator found with the answer found using the left and right operator\n s[i - 1] = \"R\"\n s[i + 1] = \"R\"\n result = get_result(op, left_operand.to_f, right_operand.to_f)\n get_logger.debug(\"Replace operator '#{v}' at index '#{op_index}' with result '#{result}'\")\n s[i] = result\n break\n end\n }\nend", "def handle_orr(tokens, outer_span, options); end", "def handle_orr(tokens, outer_span, options); end", "def orf_find(prediction = @prediction)\n\n if prediction.seq_type != \"nucleotide\"\n \"-\"\n end\n \n #stop codons\n stop_codons = [\"TAG\", \"TAA\", \"TGA\"]\n #minimimum ORF length\n orf_length = 100\n \n seq = prediction.raw_sequence\n stops = {}\n result = {}\n\n stop_codons.each do |codon|\n occurences = (0 .. seq.length - 1).find_all { |i| seq[i,3].downcase == codon.downcase }\n occurences.each do |occ|\n stops[occ + 3] = codon\n end\n end\n\n\n #direct strand\n stop_positions = stops.map{|x| x[0]}\n result[\"+1\"] = []\n result[\"+2\"] = []\n result[\"+3\"] = []\n result[\"-1\"] = []\n result[\"-2\"] = []\n result[\"-3\"] = []\n\n #reading frame 1, direct strand\n m3 = stops.map{|x| x[0]}.select{|y| y % 3 == 0}.sort\n m3 = [1, m3, prediction.raw_sequence.length].flatten\n #puts \"multiple of 3: #{m3.to_s}\"\n (1..m3.length-1).each do |i|\n if m3[i] - m3[i-1] > orf_length\n# result[[m3[i-1], m3[i]]] = \"+1\"\n result[\"+1\"].push([m3[i-1], m3[i]])\n end\n end\n \n #reading frame 2, direct strand\n m3_1 = stops.map{|x| x[0]}.select{|y| y % 3 == 1}.sort\n m3_1 = [2, m3_1, prediction.raw_sequence.length].flatten\n #puts \"multiple of 3 + 1: #{m3_1.to_s}\"\n (1..m3_1.length-1).each do |i|\n if m3_1[i] - m3_1[i-1] > orf_length\n# result[[m3_1[i-1], m3_1[i]]] = \"+2\"\n result[\"+2\"].push([m3_1[i-1], m3_1[i]])\n end\n end\n\n #reading frame 3, direct strand\n m3_2 = stops.map{|x| x[0]}.select{|y| y % 3 == 2}.sort\n m3_2 = [3, m3_2, prediction.raw_sequence.length].flatten\n #puts \"multiple of 3 + 2: #{m3_2.to_s}\"\n (1..m3_2.length-1).each do |i|\n if m3_2[i] - m3_2[i-1] > orf_length\n# result[[m3_2[i-1], m3_2[i]]] = \"+3\"\n result[\"+3\"].push([m3_2[i-1], m3_2[i]])\n end\n end\n\n #reverse strand\n stops_reverse = {}\n seq_reverse = seq.reverse.downcase.gsub('a','T').gsub('t','A').gsub('c','G').gsub('g','C')\n stop_codons.each do |codon|\n occurences = (0 .. seq_reverse.length - 1).find_all { |i| seq_reverse[i,3].downcase == codon.downcase }\n #puts \"-1 #{codon}: #{occurences.to_s}\"\n occurences.each do |occ|\n stops_reverse[occ + 3] = codon\n end\n end\n\n stop_positions_reverse = stops_reverse.map{|x| x[0]}\n m3 = stops_reverse.map{|x| x[0]}.select{|y| y % 3 == 0}.sort\n m3 = [1, m3, prediction.raw_sequence.length].flatten\n #puts \"-1 multiple of 3: #{m3.to_s}\"\n (1..m3.length-1).each do |i|\n if m3[i] - m3[i-1] > orf_length\n# result[[m3[i-1], m3[i]]] = \"-1\"\n result[\"-1\"].push([m3[i-1], m3[i]])\n end\n end\n\n m3_1 = stops_reverse.map{|x| x[0]}.select{|y| y % 3 == 1}.sort\n m3_1 = [2, m3_1, prediction.raw_sequence.length].flatten\n #puts \"-1 multiple of 3 + 1: #{m3_1.to_s}\"\n (1..m3_1.length-1).each do |i|\n if m3_1[i] - m3_1[i-1] > orf_length\n result[\"-2\"].push([m3_1[i-1], m3_1[i]])\n end\n end\n\n m3_2 = stops_reverse.map{|x| x[0]}.select{|y| y % 3 == 2}.sort\n m3_2 = [3, m3_2, prediction.raw_sequence.length].flatten\n #puts \"-1 multiple of 3 + 2: #{m3_2.to_s}\"\n (1..m3_2.length-1).each do |i|\n if m3_2[i] - m3_2[i-1] > orf_length\n result[\"-3\"].push([m3_2[i-1], m3_2[i]])\n# result[[m3_2[i-1], m3_2[i]]] = \"-3\"\n end\n end\n\n result\n end", "def ntants\n d = @upper - @center\n (0...(2**@tuple)).map do |bits|\n k = [Vector[*(0...@tuple).map{|i| (bits & (1 << 1)) == 0 ? @center[i]+d[i] : @center[i]-d[i]}], @center]\n yield *k if block_given?\n k\n end\n end", "def digit!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 46 )\n\n \n # - - - - main rule block - - - -\n # at line 392:10: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 46 )\n\n end", "def render_subset_extend_interp_spokes(shiftx, shifty, color, ibegin, iend, srep_index)\n\n iend.each_with_index do |p, i|\n#\tif p.size >= 4 and (p[3].is_a? Integer) and p[3] >= 0 and p[3] < 3 \n#\t @app.stroke $sreps[p[3]].color\n if srep_index == 0\n if $subset_index.include? i\n \n\t\tif p.size >=3 and (p[2].is_a? Integer) and p[2] >= 0 and p[2] < 3 \n\t\t @app.stroke $sreps[p[2]].color\n\n other_srep_index = p[2]\n other_srep_spoke_index = p[3]\n other_srep_spoke_begin = $sreps[other_srep_index].interpolated_spokes_begin[other_srep_spoke_index]\n @app.line(other_srep_spoke_begin[0]+shiftx, other_srep_spoke_begin[1]+shifty, p[0]+shiftx, p[1]+shifty)\n\t\telse \n\t\t @app.stroke color\n\t\tend\n \n\t\t@app.line(ibegin[i][0]+shiftx, ibegin[i][1]+shifty, p[0]+shiftx, p[1]+shifty)\n\t end\n end\n end\n end", "def denest(nested_list)\n len = nested_list.split('for')[1..-1].length\n nested_list_array = nested_list.split('for')[1..-1]\n nested_list_array[-1] = nested_list_array[-1][0..-4.3*len]\n nested_list_array.map(&->x{\"[#{x[1..-1]}end]\"})\nend", "def segments=(_arg0); end", "def begin_group(kind); end", "def reduce_starts_with(_production, _range, _tokens, _children)\n begin_anchor\n end", "def doWithNthRun(_nth, &_block)\n if(_nth == :all) then\n return eachRun(&_block) ;\n else\n return _block.call(nthRun(_nth)) ;\n end\n end", "def manscape(input, a, b, a_plus_minus, b_plus_minus)\n trimmings = input[input.index(a)+a_plus_minus..input.index(b)+b_plus_minus]\n the_rest = input[input.index(b)+b_plus_minus..input.length]\n return [trimmings, the_rest]\nend", "def nesting() end", "def test_hierarchical_loops\n want = <<~EDI.gsub(/\\n/, \"\")\n ST*856*0001~\n BSN*00*??*19700101*00000000*0001~\n DTM*011*19700101~\n HL*1**S~\n TD1*CTN*1****G*0.1773127753*LB~\n TD5*Z*2*??*ZZ*UPS3~\n REF*PK*?~\n DTM*011*19700101~\n N1*ST*Sweeney Todd~\n N3*2705 Fleet St~\n N4*Birmingham*AL*35226*US~\n HL*2*1*O~\n PRF*00000007397108***19700101~\n HL*3*2*P~\n MAN*SM*?~\n HL*4*3*I~\n LIN*1*UP*860001662184*VP*860001662184~\n SN1*1*1*EA**1*EA~\n SLN*1**O*1*EA*59.95*PE~\n CTT*2*159.85~\n SE*21*0001\n EDI\n store = Eddy::Data::Store.new(time: @epoch)\n ts = Eddy::TransactionSets::TS856::TS.new(store)\n ts.BSN do |bsn|\n bsn.BSN01 = \"00\"\n bsn.BSN02 = \"??\"\n bsn.BSN03 = @epoch\n bsn.BSN04 = @epoch\n bsn.BSN05 = \"0001\"\n end\n ts.DTM do |dtm|\n dtm.DateTimeQualifier = \"011\" # Shipped\n dtm.Date = @epoch\n end\n ts.HL_SHIPMENT do |hl_s|\n hl_s.HL.HL01 = \"1\"\n hl_s.HL.HL03 = \"S\"\n hl_s.TD1.TD101 = \"CTN\"\n hl_s.TD1.TD102 = 1\n hl_s.TD1.TD106 = \"G\"\n hl_s.TD1.TD107 = (80.5 / 454) # 0.1773127753\n hl_s.TD1.TD108 = \"LB\"\n hl_s.TD5.TD501 = \"Z\"\n hl_s.TD5.TD502 = \"2\"\n hl_s.TD5.TD503 = \"??\"\n hl_s.TD5.TD504 = \"ZZ\"\n hl_s.TD5.TD505 = \"UPS3\"\n hl_s.REF.REF01 = \"PK\"\n hl_s.REF.REF02 = \"?\"\n hl_s.DTM.DTM01 = \"011\" # Shipped\n hl_s.DTM.DTM02 = @epoch\n hl_s.L_N1 do |n1|\n # N1\n n1.N1.N101 = \"ST\"\n n1.N1.Name = \"Sweeney Todd\"\n # N3\n n1.N3.AddressInformation1 = \"2705 Fleet St\"\n # N4\n n1.N4.CityName = \"Birmingham\"\n n1.N4.StateOrProvinceCode = \"AL\"\n n1.N4.PostalCode = \"35226\"\n n1.N4.CountryCode = \"US\"\n end\n hl_s.HL_ORDER do |hl_o|\n hl_o.HL.HL01 = \"2\"\n hl_o.HL.HL02 = \"1\"\n hl_o.HL.HL03 = \"O\"\n hl_o.PRF.PRF01 = \"00000007397108\"\n hl_o.PRF.PRF04 = @epoch\n end\n hl_s.HL_TARE do |hl_t|\n hl_t.HL.HL01 = \"3\"\n hl_t.HL.HL02 = \"2\"\n hl_t.HL.HL03 = \"P\"\n hl_t.MAN.MAN01 = \"SM\"\n hl_t.MAN.MAN02 = \"?\"\n end\n hl_s.HL_ITEM do |hl_i|\n hl_i.HL.HL01 = \"4\"\n hl_i.HL.HL02 = \"3\"\n hl_i.HL.HL03 = \"I\"\n hl_i.LIN.LIN01 = \"1\"\n hl_i.LIN.LIN02 = \"UP\"\n hl_i.LIN.LIN03 = \"860001662184\"\n hl_i.LIN.LIN04 = \"VP\"\n hl_i.LIN.LIN05 = \"860001662184\"\n hl_i.SN1.SN101 = \"1\"\n hl_i.SN1.SN102 = 1\n hl_i.SN1.SN103 = \"EA\"\n hl_i.SN1.SN105 = 1\n hl_i.SN1.SN106 = \"EA\"\n hl_i.L_SLN do |rep|\n rep.SLN.SLN01 = \"1\"\n rep.SLN.SLN03 = \"O\"\n rep.SLN.SLN04 = 1\n rep.SLN.SLN05 = \"EA\"\n rep.SLN.SLN06 = 59.95\n rep.SLN.SLN07 = \"PE\"\n end\n end\n end\n ts.CTT do |ctt|\n ctt.CTT01 = 2\n ctt.CTT02 = 159.85\n end\n result = ts.render()\n assert_equal(want, result)\n end", "def triple_sequence(start, length)\n \tarry = []\n\t(1..length).each do | count|\n\n if count == 1\n arry << start\n else\n arry << arry[count-2] * 3\n end\n end\n return arry\nend" ]
[ "0.5422467", "0.53138703", "0.53003323", "0.52721924", "0.52382255", "0.52382255", "0.52382255", "0.52382255", "0.52382255", "0.52382255", "0.52382255", "0.5118047", "0.50428486", "0.50202537", "0.50136834", "0.5009789", "0.49928084", "0.49867925", "0.49811777", "0.49675664", "0.49213007", "0.49177036", "0.49158695", "0.4903061", "0.48992673", "0.48959756", "0.48750418", "0.4868372", "0.4868372", "0.4868372", "0.48593715", "0.4853932", "0.48456222", "0.48425275", "0.48403507", "0.48381796", "0.48378924", "0.48206928", "0.4812739", "0.48057288", "0.48050004", "0.48048604", "0.47732362", "0.47654364", "0.47633618", "0.47526157", "0.4743405", "0.47334155", "0.47291443", "0.47265252", "0.4719626", "0.47184852", "0.47184527", "0.47179666", "0.47057784", "0.47057784", "0.47057784", "0.47040856", "0.47036844", "0.47027984", "0.47022867", "0.47018188", "0.47009462", "0.46912175", "0.46824586", "0.4674944", "0.46741524", "0.46732265", "0.46662173", "0.46636328", "0.46562493", "0.46529755", "0.46473923", "0.4645276", "0.46370715", "0.46290392", "0.462779", "0.46192324", "0.46163562", "0.46154752", "0.4615106", "0.46021312", "0.4599694", "0.4596438", "0.45958138", "0.45937744", "0.4584337", "0.4584337", "0.45807126", "0.45803258", "0.45749453", "0.4570231", "0.45693794", "0.45690003", "0.45640582", "0.45573562", "0.45538846", "0.4551257", "0.4545592", "0.4545358", "0.4544402" ]
0.0
-1
GET /posts/1 GET /posts/1.json
def show @num = params[:num] render :"book/show" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @posts = Post.find(params[:id])\n render json: @posts\n end", "def show\n render json: Post.find(params[\"id\"])\n end", "def show\r\n post = Post.find(params[:id])\r\n render json: post\r\n end", "def show\n @post = Post.find(params[:id])\n\n render json: @post\n end", "def show\n \trender json: Post.find(params[:id])\n end", "def show\n post = Post.find(params[:id])\n render json: post\n end", "def show\n\t \trender json: Post.find(params[:id])\n\t end", "def show\n @post = Post.where(:id => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end", "def index\n @posts = Post.all\n render json: @posts\n end", "def index\n @posts = Post.all\n\n render json: @posts\n end", "def index\n @posts = Post.all\n\n render json: @posts\n end", "def index\n @posts = Post.all\n render json: @posts\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def show\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n render json: @post\n end", "def index\n @posts = Post.all\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @posts}\n end\n end", "def index\n\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end", "def show\n \n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end", "def index\n render json: { posts: Post.all }\n end", "def show\n @post ||= Mist::Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end", "def index\n @posts = Post.order(\"created_at DESC\").includes(:user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def show\n # when you go to http://localhost:3000/posts/1, rails interprets this\n # as a call to the show action for the resource and passes 1 to the \n # :id paramater. Using this blog app you can do that by clicking the \n # show link for a post on the index page.\n\n @post = Post.find(params[:id])\n # The show action uses Post.find to search for a single record \n # in the database by its id value. After finding the record, Rails \n # displays it by using app/views/posts/show.html.erb\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n post = Post.find_by(id: params[:id])\n if post \n render json: post\n else\n render json: {errors: 'Not found'}\n end\n end", "def index\n render json: Post.all\n end", "def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end", "def index\n @posts = Post.all.order(created_at: :asc)\n json_response(@posts)\n end", "def index\n @posts = Post.all\n \n render json: @posts\n end", "def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html { render 'application/index' }\n format.json { render :json => { :post => @post.as_json } }\n end\n end", "def show\n render json: @post, serializer: Api::V1::PostSerializer\n end", "def show\r\n @post = root_post_of(Post.find(params[:id]))\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @post }\r\n end\r\n end", "def show\n render json: @post\n end", "def show\n @api_v2_post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_v2_post }\n end\n end", "def show\n render json: @post\n end", "def index\n @posts = Post.paginate(:page => params[:page], :per_page => 10).order('id DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.atom\n end\n end", "def index\n render json: Post.all.order(id: :desc), each_serializer: V1::Posts::PostSerializer\n end", "def show\n render :json => @post\n end", "def index\n # @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @posts }\n end\n end", "def index\n @api_v1_posts = Api::V1::Post.all\n end", "def show\n @post = Post.find(params[:id])\n render json: @post, meta: { status: :ok }, meta_key: 'result'\n end", "def show\n respond_to do |format|\n format.html\n format.json { render jsonapi: @post }\n end\n end", "def show\n @posts = @game.posts.order(created_at: :desc).paginate(page: params[:page], per_page: 5)\n respond_to do |format|\n format.json { render template: 'api/games/game.json' }\n end\n end", "def show\n @post = PostsService.getPostById(params[:id])\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end", "def index\n #@posts = Post.all\n @posts = Post.paginate( :page => params[:page],\n :per_page => 2\n )\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = Post.all\n # Post.all returns all of the posts currently in the \n # database as an array of Post records that we store \n # in an instance variable called @posts.\n # http://guides.rubyonrails.org/active_record_querying.html\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n # The respond_to block handles both HTML and JSON calls \n # to this action. If you browse to \n # http://localhost:3000/posts.json, you’ll see a JSON \n # containing all of the posts. \n end", "def index\n\n # We display the posts be cronological inverted order\n if authenticated?\n @posts = Post.order('created_at DESC').page(params[:page])\n else\n @posts = Post.order('created_at DESC').where(:status => :true).page(params[:page])\n end\n \n respond_to do |format|\n format.html { render html: @posts }\n format.json { render json: @posts }\n end\n end", "def show\n @user = User.find(params[:id])\n @posts = @user.posts\n\n respond_to do |format|\n format.json { render json: {user: User._build(@user), posts: Post.build_posts(@posts)}, location: root_path }\n end\n end", "def index\n\t\tgon.posts = Post.all.as_json\n\tend", "def index\n @posts = Post.order(\"created_at DESC\").where(:published => true).limit(5)\n @title = \"Home\"\n @description = \"the blog and website of bassist and programmer Johnny Grubb. no baseball information here.\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml\n end\n end", "def display_posts\n begin\n response = RestClient.get \"#{@@DOMAIN}/api/posts.json?all\", authorization_hash\n\n puts \"Response code: #{response.code}\"\n puts \"Response cookies:\\n #{response.cookies}\\n\\n\"\n puts \"Response headers:\\n #{response.headers}\\n\\n\"\n puts \"Response content:\\n #{response.to_str}\"\n\n js = JSON response.body\n js.each do |item_hash|\n item_hash.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end", "def show\n #@post = Post.find(params[:id])\n\n #respond_to do |format|\n # format.html # show.html.erb\n #format.json { render json: @post }\n #end\n end", "def index\n @posts = Post.all\n @posts = paginate(@posts)\n authorize @posts\n\n render json: @posts, each_serializer: Api::V1::PostSerializer, meta: meta_attributes(@posts)\n end", "def index\n @posts = Post.find(:all)\n end", "def show\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end", "def index\n render json: { posts: current_user.posts.all.map(&:to_h) }\n end", "def show\n @feed = Feed.find(params[:id])\n @posts = @feed.posts.order(\"published desc\").paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end", "def index\n\t@posts = list_posts\n end", "def show\n #GET a single post by ID\n @post = Post.find(params[:id])\n end", "def posts(opts)\n response = get(\"posts\", opts)\n response\n end", "def show\n @post = Post.find(params[:id])\n @title = @post.title\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end", "def index\n # TODO: implement listing all posts\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml { render xml: @posts }\n end\n end", "def show\n @blogpost = Blogpost.published.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blogpost }\n end\n end", "def show\n # @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @post }\n end\n end", "def post(postid)\n request(:id => postid).posts.first\n end", "def show\n Rails.logger.debug(\"Inside show \")\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @posto = Posto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @posto }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @post }\n format.json do\n render :json => @post.to_json(:only => [:id, :title, :text, :lat, :lng, :created_at, :post_type, :likes], \n :methods => [:image_url, :video_url], \n :include => [:comments])\n end\n end\n end", "def display_post\n begin\n # asks the user for the post id\n print \"Enter the post ID: \"\n id = STDIN.gets.chomp\n response = RestClient.get \"#{@@DOMAIN}/api/posts/#{id}.json\", authorization_hash\n\n js = JSON response.body\n js.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end", "def index\n @posts = Post.all.reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = PostService.getAllPosts\n end", "def show\n render json: {\n data: @post\n }\n end", "def show\n @post = Post.find(params[:id])\n @videos = Video.get_for @post #where([\"post_id = ?\", params[:id]]).all\n @background = get_background_for @post #Background::DEFAULT #Background.where([\"post_id = ?\", params[:id]])\n @nav = get_navigation :for => 'post', :current => @post\n @menu = get_menu :for => 'post'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def index\n @posts = Post.order(created_at: :desc)\n respond_to do |format|\n format.html { render }\n format.text { render }\n format.xml { render xml: @posts }\n format.json { render json: @posts.to_json }\n end\n end", "def get(options = {})\n response= handle_errors { self.class.get('/get', :query => options)}\n if response[\"posts\"][\"post\"].is_a?(Hash)\n Rubycious::Post.new response[\"posts\"][\"post\"]\n elsif response[\"posts\"][\"post\"].is_a?(Array)\n response[\"posts\"][\"post\"].collect{|i| Rubycious::Post.new(i)}\n else\n nil\n end\n end", "def show\n if !params[:id]\n @post = Post.find_by_title('Welcome')\n elsif params[:id] =~ /^[a-zA-Z ]+$/\n @post = Post.find_by_title(params[:id])\n else\n @post = Post.find(params[:id].to_i)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @blogpost = Blogpost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blogpost }\n end\n end", "def show\n @blog_post = BlogPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blog_post }\n end\n end", "def index\n @post = Post.find_by_id(params[:post_id])\n if @post.nil?\n return render json: { error: \"Post not found\" }, status: :not_found\n end\n render json: @post.comments,status: 200\n end", "def show\n @post2 = Post2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post2 }\n end\n end" ]
[ "0.77110183", "0.73537844", "0.73433185", "0.73379177", "0.73228735", "0.7293139", "0.7275997", "0.7256934", "0.7161576", "0.7158913", "0.71552676", "0.71552676", "0.7119547", "0.7094749", "0.7094749", "0.7094749", "0.70943594", "0.7071599", "0.70607626", "0.70452625", "0.7032558", "0.7020259", "0.7020259", "0.7020259", "0.7020259", "0.7020259", "0.7020259", "0.7020259", "0.7020259", "0.7020259", "0.7020259", "0.7020259", "0.7020259", "0.7020259", "0.7020259", "0.69897074", "0.6955722", "0.6955722", "0.6954564", "0.6937062", "0.6936725", "0.69257236", "0.6917876", "0.69010335", "0.69005007", "0.6894985", "0.6893989", "0.68756175", "0.6860515", "0.6853294", "0.6853291", "0.6847577", "0.68364173", "0.68232405", "0.68093437", "0.6804144", "0.67621773", "0.6743674", "0.67226875", "0.6720067", "0.67147297", "0.6713107", "0.6699554", "0.6693189", "0.6679935", "0.6655543", "0.6644503", "0.6641595", "0.66299", "0.6619761", "0.66178924", "0.66124725", "0.6608166", "0.66017526", "0.6597235", "0.65952027", "0.65909946", "0.65858185", "0.6582703", "0.658145", "0.65768254", "0.65733755", "0.6568626", "0.65668", "0.655592", "0.65385455", "0.6525845", "0.65144473", "0.6513119", "0.6497587", "0.6497312", "0.6493223", "0.6491053", "0.64720887", "0.6471776", "0.64655757", "0.6455566", "0.64530945", "0.6448596", "0.64456475", "0.64289075" ]
0.0
-1
POST /posts POST /posts.json
def create redirect_to "/book/index" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n render json: Post.create(params[\"post\"])\n end", "def create\n respond_with Post.create(params[:posts])\n end", "def create\n @post = Post.create(post_params)\n render json: @post, serializer: PostSerializer\n end", "def create\n @post = Post.new(post_params)\n @post.user = current_user\n\n if @post.save\n render json: @post, status: :created, location: api_v1_post_path(@post), serializer: Api::V1::PostSerializer\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "def create\n @post = current_user.posts.new(post_params)\n\n if @post.save\n render json: {\n data: @post\n }\n else\n render json: {\n errors: @post.errors\n }\n end\n end", "def create\n post = @current_user.posts.create(post_params)\n\n if post.save\n render json: post\n else\n render json: { errors: post.errors.full_messages }, status: :forbidden\n end\n end", "def create\n title = params[:title]\n body = params[:body]\n\n @post = current_user.posts.create(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end", "def create\n @post = Post.new({ :title => params[:post][:title] })\n \n respond_to do |format|\n if @post.save\n format.json { render :json => { :post => @post.as_json}, :status => :created, :location => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.find(params[:user_id])\n @post = @user.posts.new(post_params)\n\n if @post.save\n render json: @post, status: :created, location: [@user, @post]\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "def create\n @post = Post.new(post_params)\n\n if @post.save\n render json: {\n message: 'Post was successfully created.'\n }, status: :created\n else\n render json: {\n errors: @post.errors,\n message: 'Post could not be created.'\n }, status: :unprocessable_entity\n end\n end", "def post(id, opts = {})\r\n uri = url_for(\"posts/#{id}\", opts)\r\n response = RestClient.get(uri)\r\n JSON.parse response\r\n end", "def create\n\n\n @post = current_user.posts.build(post_params)\n\n if @post.save\n\n render json: \"Posted successfully\", status: 201\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "def create\n @post = Post.new(params[:post])\n respond_to do |format|\n if @post.save\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with Post.create(params[:post])\n end", "def create\n\t\tpost = @current_user.posts.create(post_params) \n\t\tif post.save\n\t\trender json: {success: true, auth_token: @current_user.authentication_token, post_id: post.id}\n\t else\n\t render json: {success: false, errors: post.errors.full_messages, message: \"Validation failed\"}, status: 422\n\t\tend \n\tend", "def create_posts\n end", "def create_posts\n end", "def create_post\n begin\n #asks the user for the title, body, and whether it should be anonymous\n print \"Title: \"\n title = STDIN.gets.chomp\n print \"Body: \"\n body = STDIN.gets.chomp\n print \"Post as Anonymous? (y/n): \"\n anonymous = STDIN.gets.chomp.upcase == 'Y' ? true : false\n # check user information from login\n\n # Rails will reject this unless you configure the cross_forgery_request check to\n # a null_session in the receiving controller. This is because we are not sending\n # an authenticity token. Rails by default will only send the token with forms /users/new and\n # /users/1/edit and REST clients don't get those.\n # We could perhaps arrange to send this on a previous\n # request but we would then have to have an initial call (a kind of login perhaps).\n # This will automatically send as a multi-part request because we are adding a\n # File object.\n response = RestClient.post \"#{@@DOMAIN}/api/posts.json\",\n\n {\n post: {\n title: title,\n body: body,\n anonymous: anonymous\n },\n }, authorization_hash\n\n if (response.code == 201)\n puts \"Created successfully\"\n end\n puts \"URL for new resource: #{response.headers[:location]}\"\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end", "def create\n @api_post = Api::Post.new(api_post_params)\n\n if @api_post.save\n render json: @api_post, status: :created, location: @api_post\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.json { render :show, status: :created, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \tif logged_in?\n params[:post][:user_id] = current_user.id\n @post = Post.new(post_params)\n if @post.save\n puts @post.published\n render json: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end\n end", "def create\n respond_with Post.create(post_params)\n end", "def posts(opts)\n response = get(\"posts\", opts)\n response\n end", "def post(*args)\n request(:post, *args)\n end", "def post(*args)\n request :post, *args\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @api_post = current_user.posts.new(api_post_params)\n if @api_post.save\n render :show\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end", "def create\n authenticated\n\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new post_params\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n if @post.save\n render :show, status: :created, location: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "def create\n puts \"create post: #{post_params.inspect}\"\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n @title = \"Create New Post\"\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, :notice => 'Post was successfully created.' }\n format.json { render :json => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end", "def create\n post_service = PostService.new(current_user, params)\n post_service.create_post\n #post_service.create\n respond_to do |format|\n if post_service.save?\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { redirect_to new_post_url, alert: post_service.errors }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.json { render json: @post, status: :created, location: @post }\n format.xml { render xml: @post, status: :created, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #raise params.inspect\n \n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @posts = Post.page(params[:page]).order('created_at desc')\n @post = Post.new(post_params)\n @user = User.where('account_id == ?', current_account.id)[0]\n respond_to do |format|\n if @post.save\n format.html { redirect_to '/posts' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :index }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\t\t\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user_post_param\n respond_to do |format|\n if @post.save\n format.html do\n redirect_to @post, notice:\n \"Post was successfully created.\"\n end\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json do\n render json: @post.errors, status:\n :unprocessable_entity\n end\n end\n end\n end", "def create\n @api_v1_post = Api::V1::Post.new(api_v1_post_params)\n\n respond_to do |format|\n if @api_v1_post.save\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_post }\n else\n format.html { render :new }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = current_user.posts.new(params[:post])\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n @post.user_id = current_user.id\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { redirect_to posts_path, flash: { error: @post.errors.full_messages } }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(path, data = {})\n request 'POST', path, body: data.to_json\n end", "def new\n post = Post.new\n render json: post\n end", "def create\n @user = current_user\n @post = @user.posts.build(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save?\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @post = Post.new(params[:post])\r\n\r\n respond_to do |format|\r\n if @post.save\r\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\r\n format.json { render json: @post, status: :created, location: @post }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @post = Post.create(post_params)\n set_posts\n respond_to do |format|\n format.js\n format.html\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, :notice => \"slam\" }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { redirect_to posts_path }\n flash[:alert] = \"shit.\"\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n post\n end", "def create\n @post = Post.new(content: params[:post][:content], user_id: @user.id)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @user }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { redirect_to @user }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @post = Post.new(post_params)\n @post.user_id = params[:user_id]\n if @post.save\n render json: @post, meta: { status: :created }, meta_key: 'result', status: :created\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "def create\n @post = current_user.posts.new(post_params.merge(writter: current_user.name))\n\n if @post.save\n render json: {status: 1, id: @post.id.to_s, notice: \"新增成功,标题是:#{@post.title.capitalize}\", number: @post.number, errors: []}\n else\n render json: {status: -1, notice: \"新增失败,请先登录\", errors: @post.errors.full_messages}\n end\n end", "def create\n puts \"Trying to Create New Post\"\n # Creates new post with given content tied to given userid\n @post = Post.new(post_params) \n if @post.save\n puts \"Post successfully created\"\n response.status=(201)\n render json: {status: \"Success\", message: [\"Post created!\"]}\n else\n # Error handling\n puts \"Something went wrong while creating new Post\"\n puts(@Post.errors.full_messages)\n response.status=(422)\n render json: { status: \"Error\", message: [@post.errors.full_messages]}\n end\n end", "def create\n @post = current_user.posts.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to list_of_posts_post_path(@post.user), notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(*args)\n execute(:post, *args)\n end", "def create\n redirect_to posts_path and return unless Mist.authorized?(:create_post, self)\n coerce_date(params[:post], 'published_at')\n @post = Mist::Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, :notice => 'Post was successfully created.' }\n format.json { render :json => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = current_user.posts.build(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to new_post_successful_posts_path, notice: 'Anúncio criado com sucesso.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end", "def create\n redirect_to login_path unless session[:user_id]\n message = 'Post was successfully created.'\n @post = Post.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: message }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n @post.user = User.find_by_auth_token!(cookies[:auth_token])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = current_user.posts.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n if @post.save\n redirect_to find_redirect(@post.page)\n else\n render :new\n render json: @post.errors, status: :unprocessable_entity\n end\n end" ]
[ "0.74463975", "0.73221767", "0.73072433", "0.7123966", "0.7015686", "0.701327", "0.69841874", "0.6939327", "0.69313824", "0.69053805", "0.68196476", "0.6812792", "0.6793222", "0.6792862", "0.6779654", "0.6779654", "0.67625546", "0.67602354", "0.67515427", "0.6735786", "0.66983837", "0.6694823", "0.6676922", "0.6648634", "0.6618174", "0.6609208", "0.6576672", "0.6567517", "0.6535031", "0.65248317", "0.6517826", "0.6512526", "0.6512526", "0.65004253", "0.64875203", "0.6482612", "0.64796066", "0.6479418", "0.64762664", "0.64762664", "0.64762664", "0.64762664", "0.64762664", "0.64762664", "0.64762664", "0.6452396", "0.6443543", "0.64413923", "0.6439579", "0.6431225", "0.6411242", "0.64027417", "0.6402409", "0.63972473", "0.63956606", "0.6388207", "0.6388207", "0.6380103", "0.63764375", "0.6374259", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.6369631", "0.6361449", "0.6350474", "0.6349784", "0.6345706", "0.6312865", "0.63084143", "0.630361", "0.63009614", "0.62957925", "0.6295694", "0.62955", "0.6294854", "0.62942207", "0.628781", "0.62877417", "0.6283785", "0.6282612", "0.6263583" ]
0.0
-1
PATCH/PUT /posts/1 PATCH/PUT /posts/1.json
def update @num = params[:num] render :"book/update" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end", "def update\n respond_with Post.update(params[:id], params[:posts])\n end", "def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with Post.update(params[:id], params[:post])\n end", "def update\n respond_with post.update(params[:id], params[:post])\n end", "def update\n respond_with Post.update(params[:id],post_params)\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @post.update({\n title: post_params[:title],\n content: post_params[:content],\n })\n render json: Post.all.as_json\n else\n render json: {errors: @post.errors.full_messages}, status: :unprocessable_entity\n end\n end", "def update\n id = Post.find(params[:id])._id\n \n respond_to do |format|\n if ((@post.update_attributes(params[:post])) && (@post._id = id))\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n @post.update_attributes(params[:post])\n format.html { redirect_to posts_url, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n end \n end", "def update\n respond_to do |format|\n if @api_v1_post.update(api_v1_post_params)\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_post }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to posts_path, notice: 'Post was successfully updated.' }\n format.json { render json: @post }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n authenticated\n\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "def update\n @api_post = Api::Post.find(params[:id])\n\n if @api_post.update(api_post_params)\n head :no_content\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end", "def update\n if @post.update(post_params)\n render json: {\n data: @post\n }\n else\n render json: {\n errors: @post.errors\n }\n end\n end", "def update\n @post = Post.find(params[:id])\n\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @api_v2_post = Post.find(params[:id])\n\n respond_to do |format|\n if @api_v2_post.update_attributes(params[:api_v2_post])\n format.html { redirect_to @api_v2_post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v2_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @post\n\n if @post.save\n render json: @post\n else\n render json: @post.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@post = post.find(params[:id])\n\t\t@post.update_attributes(post_params)\n\t\trespond_to do |format|\n\t\t\tformat.html {redirect_to post_path(@post)}\n\t\t\tformat.json {render json: @post}\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.json { render :show, status: :ok, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\tif @post.update(post_params)\n\t\t\trender json: @post, status: :success\n\t\telse\n\t\t\trender json: @post.errors, status: :unprocessable_entity #422\n\t\tend\n\tend", "def update\n @post = Post.find(params[:id])\n @title = \"EDIT\"\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'slam updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "def update\n @post.update_attributes(params[:post])\n respond_with(@post)\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: '' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "def update\n title = params[:title]\n body = params[:body]\n\n @post.update!(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end", "def update\r\n @post = Post.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @post.update_attributes(params[:post])\r\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @user = current_user\n @post = @user.posts.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to :action => 'index', notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if (@post.update(params.permit(:title, :content)))\n render json: @post, status: :ok\n else\n render json: @post.errors, status: 422\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to post_path, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n #disable edit for now\n redirect_to posts_path\n return\n \n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to magazine_post_path(@post.short_url), notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"editor\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @post.update(post_params)\n render action: \"show.json.jbuilder\"\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to post_path(@post), notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\t\n\t\tpost = @current_user.role == \"admin\" ? Post.find_by(id: params[:id]) : @current_user.posts.find_by(id: params[:id]) \n\t\tif post && post.update_attributes(post_params)\n\t\trender json: {success: true, auth_token: @current_user.authentication_token, post_id: post.id, post_desc: post.description}\n\t else\n\t render json: {success: false, message: \"not found or validation failed\"}, status: 422\n\t\tend \n\tend", "def update\n post = Post.find_by(id: params[:id])\n # byebug\n\n post.assign_attributes(update_params)\n if post.valid?\n post.save\n render json: post, status: :created\n else\n render json: {errors: post.errors.full_messages}, status: 422\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find_by_slug(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@post = Post.find(params[:id])\n\n #respond_to do |format|\n # if @post.update_attributes(params[:post])\n # format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n # format.json { head :no_content }\n #else\n # format.html { render action: \"edit\" }\n # format.json { render json: @post.errors, status: :unprocessable_entity }\n #end\n #end\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n #this works largely the same, \n @post = Post.find(params[:id])\n @post.created_at = params[:created_at] if !!params[:created_at]\n if @post.update_attributes(params[:post])\n render \"show\", handlers: [:rabl]\n else\n render :json => @post.errors.full_messages, status: 422\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to \"/#{session[:username]}\", notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update?(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n delete_caches\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n update_resource_response(@post, blog_post_params)\n end", "def update\n \n @previous_content = @post[:content]\n respond_to do |format|\n if @post.update_attributes(params[:post])\n \t\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n \n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n verify_owner_or_admin(@post)\n \n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: \"Post was successfully updated.\" }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @update = Update.find(params[:id])\n @post = @update.post\n\n respond_to do |format|\n if @update.update_attributes(params[:update])\n format.html { redirect_to @post, notice: 'Update was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @post.update(post_params)\n render json: {status: 1, id: @post.id.to_s, notice: \"修改成功,标题是:#{@post.title.capitalize}\", errors: []}\n else\n render json: {status: -1, notice: \"修改失败\", errors: @post.errors.fall_message}\n end\n end", "def update\n params[:post][:tag_ids] ||= []\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to [@post.user, @post], notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @post = Post.find(params[:id])\r\n @root_post = root_post_of(@post)\r\n\r\n respond_to do |format|\r\n if @post.update_attributes(params[:post])\r\n @root_post.touch(:updated_at)\r\n update_child_posts(@post)\r\n\r\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @post.short_body = post_params[:body].split('</p>')[0] + '</p>'\n @post.tags.delete_all\n set_tags\n\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render_forbidden and return unless can_edit?\n @post = Post.friendly.find(params[:id])\n \n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n redirect_to root_path\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7186309", "0.7040826", "0.67726034", "0.6765877", "0.6668908", "0.6647892", "0.6577694", "0.6555246", "0.65498155", "0.6549577", "0.6534143", "0.65298116", "0.64983106", "0.6496966", "0.64672637", "0.6430547", "0.6427938", "0.64262456", "0.6425561", "0.6418947", "0.6418713", "0.64119285", "0.6399606", "0.6399606", "0.63892776", "0.6381486", "0.63693714", "0.63693714", "0.63693714", "0.63693714", "0.63693714", "0.63693714", "0.63693714", "0.63693714", "0.63693714", "0.63693714", "0.63693714", "0.63693714", "0.63693714", "0.63693714", "0.63693714", "0.63693714", "0.6369277", "0.6359675", "0.6359388", "0.6358113", "0.63554066", "0.63554066", "0.63554066", "0.63554066", "0.63474196", "0.6338535", "0.6337404", "0.63322735", "0.632803", "0.6318894", "0.6307735", "0.6294275", "0.62898695", "0.62760407", "0.62711114", "0.6270226", "0.6269743", "0.6262126", "0.62509865", "0.624096", "0.62273777", "0.62152874", "0.6213536", "0.62052906", "0.6202538", "0.6202538", "0.6202538", "0.6202538", "0.6202538", "0.6202538", "0.6202538", "0.6202538", "0.6202538", "0.6202538", "0.6201528", "0.6195767", "0.6180281", "0.6177022", "0.6173562", "0.61671066", "0.6157913", "0.61549973", "0.61461097", "0.61461097", "0.6141184", "0.61211485", "0.611471", "0.6112152", "0.6108012", "0.6106424", "0.61038446", "0.60980886", "0.6096757", "0.6093663", "0.60926044" ]
0.0
-1
DELETE /posts/1 DELETE /posts/1.json
def destroy @num = params[:num] render :"book/destroy" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n post = Post.find(params[:id])\n if post.destroy\n render json: {status: \"success\", data: {id: params[:id]}}, status: :ok\n end\n end", "def destroy\n @post.destroy\n render json: {}, status: :ok\n end", "def destroy\n if @post.destroy\n render json: {\n post: @post\n }, status: :ok\n else\n render status: :bad_request\n end\n end", "def destroy\n @api_v2_post = Post.find(params[:id])\n @api_v2_post.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v2_posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_post.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_posts_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authenticated\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @post = Post.find(params[:id])\n # @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @post.destroy\n\n json_response(@post)\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_with Post.destroy(params[:id])\n end", "def destroy\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n r.delete @post\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end", "def destroy\n @api_post.destroy\n\n head :no_content\n end", "def destroy\n @post.destroy\n render json: {\n data: {\n post: { key: @post.id },\n status: @post.status,\n }\n }\n end", "def destroy\n\t\tpost = Post.find(params[:id])\n\t\t# byebug\n \tpost.destroy\n\t posts = Post.all\n \trender json: posts\n end", "def destroy\r\n @post = Post.find(params[:id])\r\n @post.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to posts_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_path, notice: \"Post removed.\" }\n format.json { render 'destroy' }\n end\n end", "def delete\n @post = Post.find(params[:id])\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_path(client_id:current_user.client.id, per_page:5), notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_with Post.destroy(params[:id])\n end", "def destroy\r\n @post = Post.find(params[:id])\r\n @post.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to root_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @post.destroy\n\n head :no_content\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/posts' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n\n render json: Post.all.as_json\n end", "def destroy\n @post.destroy\n head :no_content\n end", "def destroy\n @post.destroy\n head :no_content\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to blog_posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n @title = \"Kill Post\"\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to all_user_posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n head :no_content\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html {redirect_to posts_url, notice: 'Post was successfully destroyed.'}\n format.json {head 200}\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_path, notice: 'Post was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_with post.destroy(params[:id])\n end", "def destroy\n @post.destroy\n \n respond_to do |format|\n format.html { redirect_to post_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n Post.find(params[:id]).delete\n\n redirect_to '/'\n end", "def destroy\n # @post = Post.find(params[:id])\n #@post.destroy\n\n #respond_to do |format|\n # format.html { redirect_to posts_url }\n #format.json { head :no_content }\n #end\n end", "def delete(url)\n raise Error, \"Missing URL\" unless url\n get('posts/delete?uri=' << u(url))\n nil\n end", "def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to news_url }\n format.json { head :ok }\n end\n end", "def destroy\n @post = Post.find_by_slug(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url, notice: \"Anúncio removido com sucesso.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.friendly.find(params[:id])\n @post.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Story deleted' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: \"Postitus edukalt kustutatud!\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Postagem excluida com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Postagem excluída com sucesso!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mural_post.destroy\n respond_to do |format|\n format.html { redirect_to mural_posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @posto = Posto.find(params[:id])\n @posto.destroy\n\n respond_to do |format|\n format.html { redirect_to postos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_post.destroy\n end" ]
[ "0.8046884", "0.76902676", "0.7583626", "0.75803024", "0.7568048", "0.75047046", "0.75031126", "0.74750155", "0.74671036", "0.74650854", "0.746482", "0.74589694", "0.74589694", "0.74589694", "0.74589694", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7423174", "0.74059606", "0.73990285", "0.73928183", "0.7389498", "0.7371715", "0.7371117", "0.7349121", "0.7344524", "0.7342226", "0.7338908", "0.7313371", "0.73123556", "0.731156", "0.73095584", "0.7299751", "0.7298017", "0.7298017", "0.7282874", "0.7277125", "0.7266815", "0.7260945", "0.72549784", "0.7254856", "0.7239102", "0.7238946", "0.7229726", "0.7227931", "0.7221013", "0.721375", "0.7211237", "0.72097856", "0.7190222", "0.71850675", "0.7171746", "0.71533066", "0.71457464", "0.71434635", "0.7142048", "0.7139985", "0.7137574" ]
0.0
-1
Execute a batch operation
def batch mon_synchronize do begin original, @client = @client, SSDB::Batch.new yield(self) @client.values = original.perform(@client) ensure @client = original end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_batch\n make_run_batch_call\n end", "def exec__batch *args\n batch_commands *args\n end", "def execute\n raise Error::EmptyBatch.new if operations.empty?\n\n @index = -1\n @ops = []\n\n operations.each do |operation|\n operation.each do |name, document|\n if respond_to?(name, true)\n send(name, document)\n else\n raise Error::InvalidBulkOperation.new(name)\n end\n end\n end\n\n ops = merge_ops\n\n replies = []\n until ops.empty?\n op = ops.shift\n\n until op.valid_batch_size?(collection.next_primary.context.max_write_batch_size)\n ops = op.batch(2) + ops\n op = ops.shift\n end\n\n begin\n replies << op.execute(collection.next_primary.context)\n # @todo: No test for max message size.\n rescue Error::MaxBSONSize, Error::MaxMessageSize => ex\n raise ex unless op.batchable?\n ops = op.batch(2) + ops\n end\n return make_response!(replies) if stop_executing?(replies.last)\n end\n make_response!(replies) if op.write_concern.get_last_error\n end", "def batch(*args, &block)\n raise \"Block required!\" unless block_given?\n do_op(:batch, *args, &block)\n end", "def batch(*args, &block)\n raise \"Block required!\" unless block_given?\n do_op(:batch, *args, &block)\n end", "def execute_batch(aggregated_input, batch)\n executor = AsyncTaskExecutor.new(batch, container: container)\n executor.call(aggregated_input)\n end", "def process(cursor, batch) end", "def batch\n req = create_batch_request\n if block_given?\n yield req\n req.execute\n else\n req\n end\n end", "def run_bulk; end", "def process_batch(batch)\n call([], :process_batch, batch.__calls)\n end", "def execute_batch(batch, options={})\n headers = {\n 'Content-Type' => \"multipart/mixed; boundary=#{batch.batch_id}\",\n 'Accept' => 'application/atom+xml,application/xml',\n 'Accept-Charset'=> 'UTF-8'\n }\n\n query = { }\n query[\"timeout\"] = options[:timeout].to_s if options[:timeout]\n\n body = batch.to_body\n response = call(:post, generate_uri('/$batch', query), body, headers, options)\n batch.parse_response(response)\n rescue => e\n raise_with_response(e, response)\n end", "def batch(*args, &block)\n self.instance_exec(*args, &block)\n end", "def multiple_batch!(operations, opts = {})\n response = multiple_batch(operations, opts)\n\n response.wait(opts)\n end", "def execute_batch(batch, options = {})\n headers = {\n Azure::Storage::Common::HeaderConstants::CONTENT_TYPE => \"multipart/mixed; boundary=#{batch.batch_id}\",\n Azure::Storage::Common::HeaderConstants::ACCEPT => Serialization.get_accept_string(options[:accept]),\n \"Accept-Charset\" => \"UTF-8\"\n }\n\n body = batch.to_body(self)\n options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY\n response = call(:post, generate_uri(\"/$batch\", new_query(options), options), body, headers, options, true)\n batch.parse_response(response)\n rescue => e\n raise_with_response(e, response)\n end", "def exec__working_batch *args\n send :exec__batch, @working_batch, *args\n end", "def batch arg = nil\n if arg\n # Backward compatibility\n return scoped.batch(arg)\n else\n raise ArgumentError, \"Block not given\" unless block_given?\n end\n b = BatchAction.send(:new, self, @mutation)\n yield b\n results = Array.new(b.actions.length).to_java\n process = lambda do\n results.each_with_index do |r, idx|\n action = b.actions[idx]\n type = action[:type]\n case type\n when :get\n action[:result] = (r.nil? || r.empty?) ? nil : Row.send(:new, self, r)\n when :append\n action[:result] = r && Row.send(:new, self, r).to_h\n when :increment\n action[:result] = r &&\n Row.send(:new, self, r).to_h.tap { |h|\n h.each do |k, v|\n h[k] = Util.from_bytes :fixnum, v unless v.is_a?(Fixnum)\n end\n }\n else\n case r\n when java.lang.Exception\n action[:result] = false\n action[:exception] = r\n when nil\n action[:result] = false\n else\n action[:result] = true\n end\n end\n end\n b.actions\n end\n\n begin\n htable.batch b.actions.map { |a| a[:action] }, results\n process.call\n rescue Exception => e\n raise HBase::BatchException.new(e, process.call)\n end\n end", "def batch\n yield if block_given?\n end", "def exec__batch_generator batch_generator\n batch_commands batch__from_batch_generator batch_generator\n end", "def batch\n job && job.batch\n end", "def execute_batch(sql, *args, &block)\n @db.execute_batch(rewrite_table_names(sql), *args, &block)\n end", "def execute(etl_batch)\n prepare_stage(etl_batch)\n perform_execution(etl_batch)\n end", "def batch_execute(targets, &block)\n promises = queue_execute(targets, &block)\n await_results(promises)\n end", "def execute_bulk_request(**execute_request_params)\n results = []\n payloads = execute_request_params[:payload].each_slice(@api_limit).to_a\n payloads.each do |p|\n execute_request_params[:payload] = p\n results << execute_request(**execute_request_params)\n end\n results.flatten\n end", "def batch(*spec)\n Batch.new(self, spec.flatten)\n end", "def batch_commands batch, batch_controller=nil\n batch_controller ||= batch_controller__default\n admitted_errors,\n batch_command_method = array__from(batch_controller)\n admitted_errors ||= Float::INFINITY\n batch_command_method ||= :batch_command\n amount_of_errors=0\n results_before = results.dup\n @working_batch = batch\n non_executed_batch_part = batch.drop_while{ |call, *args|\n to_method(batch_command_method).call call, *args\n !(results.last[:success]) && (amount_of_errors += 1)\n amount_of_errors <= admitted_errors\n }\n @working_batch = non_executed_batch_part\n results - results_before\n end", "def execute(http_options = {})\n return [] if batch_calls.empty?\n\n batch_results = []\n batch_calls.each_slice(MAX_CALLS) do |batch|\n # Turn the call args collected into what facebook expects\n args = {\"batch\" => batch_args(batch)}\n batch.each do |call|\n args.merge!(call.files || {})\n end\n\n original_api.graph_call(\"/\", args, \"post\", http_options) do |response|\n raise bad_response if response.nil?\n\n batch_results += generate_results(response, batch)\n end\n end\n\n batch_results\n end", "def run_bulk(t, first, last, incr = 1)\n retry_until { DRMAA.run_bulk_jobs(t.ptr, first, last, incr) }\n end", "def bulk_call(params)\n path = @version + '/Call/Bulk/'\n method = 'POST'\n return request(path, method, params)\n end", "def batch(*requests)\n Batch.new(requests)\n end", "def run_bulk(t, first, last, incr = 1)\n retry_until { DRMAA.run_bulk_jobs(t.ptr, first, last, incr) }\n end", "def batch_insert(operations, chunk_size=1000)\n raise \"Batch request must not exceed 1000 documents.\" unless chunk_size <= 1000\n operations.each_slice(chunk_size)\n .to_a\n .each{|op|\n resp = create_request().post(build_indexing_url(), :json => {:value => op})\n raise_on_http_error(resp)\n resp.to_s\n }\n end", "def execute(http_options = {})\n return [] unless batch_calls.length > 0\n # Turn the call args collected into what facebook expects\n args = {}\n args[\"batch\"] = JSON.dump(batch_calls.map { |batch_op|\n args.merge!(batch_op.files) if batch_op.files\n batch_op.to_batch_params(access_token, app_secret)\n })\n\n batch_result = graph_call_outside_batch('/', args, 'post', http_options) do |response|\n unless response\n # Facebook sometimes reportedly returns an empty body at times\n # see https://github.com/arsduo/koala/issues/184\n raise BadFacebookResponse.new(200, '', \"Facebook returned an empty body\")\n end\n\n # map the results with post-processing included\n index = 0 # keep compat with ruby 1.8 - no with_index for map\n response.map do |call_result|\n # Get the options hash\n batch_op = batch_calls[index]\n index += 1\n\n raw_result = nil\n if call_result\n parsed_headers = if call_result.has_key?('headers')\n call_result['headers'].inject({}) { |headers, h| headers[h['name']] = h['value']; headers}\n else\n {}\n end\n\n if (error = check_response(call_result['code'], call_result['body'].to_s, parsed_headers))\n raw_result = error\n else\n # (see note in regular api method about JSON parsing)\n body = JSON.load(\"[#{call_result['body'].to_s}]\")[0]\n\n # Get the HTTP component they want\n raw_result = case batch_op.http_options[:http_component]\n when :status\n call_result[\"code\"].to_i\n when :headers\n # facebook returns the headers as an array of k/v pairs, but we want a regular hash\n parsed_headers\n else\n body\n end\n end\n end\n\n # turn any results that are pageable into GraphCollections\n # and pass to post-processing callback if given\n result = GraphCollection.evaluate(raw_result, @original_api)\n if batch_op.post_processing\n batch_op.post_processing.call(result)\n else\n result\n end\n end\n end\n end", "def batch_upload_rows(rows, per_page=100); batch_modify_rows('put', rows, per_page); end", "def send_batch(batch)\n return if batch.empty?\n\n logger.debug(\"#{self.class.name}: sending batch of #{batch.size} to Solr\")\n\n json_package = JSON.generate(batch.map { |c| c.output_hash })\n\n begin\n resp = @http_client.post solr_update_url_with_query(@solr_update_args), json_package, \"Content-type\" => \"application/json\"\n rescue StandardError => exception\n end\n\n if exception || resp.status != 200\n error_message = exception ?\n Traject::Util.exception_to_log_message(exception) :\n \"Solr response: #{resp.status}: #{resp.body}\"\n\n logger.error \"Error in Solr batch add. Will retry documents individually at performance penalty: #{error_message}\"\n\n batch.each do |c|\n send_single(c)\n end\n end\n end", "def multiple_batch(operations, opts = {})\n response = @transporter.write(:POST, '/1/indexes/*/batch', { requests: operations }, opts)\n\n MultipleIndexBatchIndexingResponse.new(self, response)\n end", "def run_batch(id, batch)\n run_payload(ETL::Queue::Payload.new(id, batch))\n end", "def send_batch\n batch = @batch.map(&:first) # get the requests\n response = send_batch_request(batch)\n\n begin\n responses = JSON.parse(response)\n rescue\n raise Jimson::ClientError::InvalidJSON.new(json)\n end\n\n process_batch_response(responses)\n responses = @batch\n\n @batch = []\n\n responses\n end", "def batch b\n raise ArgumentError, \"Invalid batch size. Must be a positive integer.\" unless b.is_a?(Fixnum) && b > 0\n spawn :@batch, b\n end", "def script_do_in_batches(options = {}, &block)\n start = Time.now\n count_options = options.reject {|k,v| %w(order select batch_size sleep logger).include?(k.to_s)}\n item_count = count(count_options)\n iteration = 1\n do_in_batches(options) do |record|\n msg = \"#{iteration} of #{item_count} (#{(iteration.to_f / item_count * 100).round(2)}%)\"\n puts \"#{record.id.to_s.ljust(10)} #{msg.ljust(30)} time #{Time.now - start}\"\n yield(record)\n iteration += 1\n end\n puts \"Finished in #{Time.now - start} s\"\n end", "def execute\n server = next_primary\n validate_operations!\n merged_ops.each do |op|\n validate_type!(op.keys.first)\n execute_op(op, server)\n end\n finalize\n end", "def send_batch(batch)\n return if batch.empty?\n json_package = JSON.generate(batch.map { |c| c.output_hash })\n begin\n resp = @http_client.post @solr_update_url, json_package, \"Content-type\" => \"application/json\"\n rescue StandardError => exception\n end\n\n if exception || resp.status != 200\n error_message = exception ? \n Traject::Util.exception_to_log_message(exception) : \n \"Solr response: #{resp.status}: #{resp.body}\"\n\n logger.error \"Error in Solr batch add. Will retry documents individually at performance penalty: #{error_message}\"\n \n batch.each do |c|\n send_single(c)\n end\n end\n end", "def bulk(records)\n records_array = Array(records)\n\n bulk_delay(records_array)\n\n yield\n\n bulk_queue(records_array)\n end", "def batch_command call, *args\n require \"open3\"\n @results ||= []\n command = \"#{call} #{args.join \" \"}\"\n stdin, stdoutanderr, wait_thr = Open3.popen2e(command)\n @results.push({\n :time => Time.now.inspect,\n :call => call,\n :args => args,\n :command => command,\n :success => wait_thr.value.success?,\n :output => (stdoutanderr.entries.join \"\\n\"),\n :batch_command_method => \"batch_command\",\n })\n @results\n end", "def batch(command, options)\n # Update payload to be a batch\n requests = options[:payload].map do |attrs|\n attrs[:method] ||= 'GET'\n Schema::Mercury::MercuryRequest.new(attrs)\n end\n options[:payload] = Schema::Mercury::MercuryMultiGetRequest.new(:request => requests)\n\n # Track the schema\n response_schema = options[:response_schema]\n options[:response_schema] = Schema::Mercury::MercuryMultiGetReply\n\n response = yield(command, options)\n\n # Process each reply\n results = []\n response['result'].reply.each_with_index do |reply, index|\n if (400..599).include?(reply.status_code)\n request = requests[index]\n raise APIError, \"Command \\\"#{command}\\\" for URI \\\"#{request.uri}\\\" failed with message: \\\"#{reply.status_code}\\\"\"\n else\n results << response_schema.decode(reply.body)\n end\n end\n\n response['result'] = results\n response\n end", "def batch options = {}\n Diffbot::APIClient::Batch.new self, options\n end", "def batch_new\n end", "def batch_modify_rows(action, rows, per_page=100)\n if not per_page.is_a? Fixnum or not per_page > 0\n raise VeritableError.new(\"Batch upload or delete must have integer page size greater than 0.\")\n end\n batch = []\n rows.each do |row|\n Util.check_row(row)\n batch.push(row)\n if batch.size == per_page\n post(link('rows'), {'action' => action, 'rows' => batch}) \n batch = []\n end \n end\n if batch.size > 0\n post(link('rows'), {'action' => action, 'rows' => batch})\n end\n end", "def process\n by_time_batch\n by_waiting_batch\n rescue\n @logger.fatal \"Failed to process: #{$!}\"\n @logger.fatal $!.backtrace.join(\"\\n\")\n end", "def batch(commands)\n commands.map! { |c| DEFAULT_BATCH_ARGS.merge(c) }\n commands.map { |c| query(c[:command], c[:timeout], c[:recoverable]) }\n end", "def batch(serial_only=false)\n @batch_request=true\n Thread.current[:facebooker_current_batch_queue]=[]\n yield\n # Set the batch request to false so that post will execute the batch job\n @batch_request=false\n BatchRun.current_batch=Thread.current[:facebooker_current_batch_queue]\n post(\"facebook.batch.run\",:method_feed=>BatchRun.current_batch.map{|q| q.uri}.to_json,:serial_only=>serial_only.to_s)\n ensure\n @batch_request=false\n BatchRun.current_batch=nil\n end", "def processing_batches(w)\n dir = join(@basedir, DIR_PROCESSING)\n w.sftp.dir[dir, '*'].map do |entry|\n Model::Batch.new(:path => join(dir, entry.name), :state => :processing)\n end\n end", "def batch_finished\n end", "def fetch_batch(ids)\n # ids must be complete CNs\n filter = nil\n ids.each do |id|\n filter = if filter.nil?\n obj_filter(id)\n else\n filter | obj_filter(id)\n end\n end\n admin_ldap.search(base: @base, filter: filter)\n end", "def consume_batch(_payloads, _metadata)\n raise NotImplementedError\n end", "def consume_batch(_payloads, _metadata)\n raise NotImplementedError\n end", "def each(&block)\n @batch_queue.each(&block)\n end", "def batch__from_batch_generator batch_generator\n send_args = (send batch_generator) rescue batch_generator\n batch = send *send_args\n end", "def perform_execution(etl_batch)\n raise \"perform_execution method has not been overridden.\"\n end", "def execute!\n stack = InternalMiddleware.batch_stack(self)\n format_response(stack.call(middleware_env))\n end", "def ddl_batch\n raise Google::Cloud::FailedPreconditionError, \"No block given for the DDL batch\" unless block_given?\n begin\n start_batch_ddl\n yield\n run_batch\n rescue StandardError\n abort_batch\n raise\n ensure\n @ddl_batch = nil\n end\n end", "def batch!(request, request_options = {})\n res = batch(request, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n res\n end", "def process_batch(records)\n benchmarks[:processing] << Benchmark.realtime do\n records.each do |record|\n next if skip_before_transform?(record)\n invoke_callback(:before_each, record)\n attrs = transformer.run(record)\n next unless attrs # skip if transformation failed\n invoke_callback(:each_before_save, attrs, record)\n next if invoke_callback(:reject_after_transform_if, attrs)\n invoke_callback(:after_each, record, attrs)\n attrs = data_scrubber.scrub!(attrs)\n \n if update?(record, attrs)\n update_attrs << attrs\n elsif create_new_records\n new_rows << attrs.values\n end\n end\n end\n end", "def batch_update\n @success = true\n ActiveRecord::Base.transaction do\n @selected.each do |selected|\n unless selected.update(batch_update_params)\n @success = false\n raise ActiveRecord::Rollback\n end\n end\n end\n render template: \"/dash/base/batch_update\"\n end", "def execute_batch_set(docs)\n self.inserts_valid = true\n inserts = pre_process_batch_insert(docs)\n if insertable?\n collection.find(selector).update_one(\n positionally(selector, '$set' => { path => inserts }),\n session: _session\n )\n post_process_batch_insert(docs)\n end\n inserts\n end", "def records_for_bulk_index(ids, batch_size = 1000)\n transaction do\n offset = 0\n ids.each_slice(batch_size) do |id_slice|\n records = find( :all, :conditions => [\"id in (?)\", id_slice] )\n #yield records, offset\n yield find( :all, :conditions => [\"id in (?)\", id_slice] ), offset\n offset += batch_size\n end\n end\n end", "def processed_batches(w)\n dir = join(@basedir, DIR_PROCESSED)\n w.sftp.dir[dir, '*'].map do |entry|\n Model::Batch.new(:path => join(dir, entry.name), :state => :processed)\n end\n end", "def run\n handle_options()\n execute_operation()\n end", "def batch(*requests)\n body = requests.map do |request|\n {method: request[0], params: request[1..-1], jsonrpc: '2.0', id: SecureRandom.uuid}\n end\n parsed_response = parse_response(post(body))\n errors = parsed_response.select{|response| response[:error]}\n raise Error, errors if !errors.empty?\n parsed_response.map{|response| response[:result]}\n end", "def batch_iterator\n Unipept::BatchIterator.new(batch_size)\n end", "def batch_save(batch_client)\n perform_save(batch_client)\n end", "def update_compute_batch(vm_json)\n ActiveRecord::Base.transaction do\n update_compute(vm_json)\n end\n end", "def processAllBatches\n Thread.current[:name] = \"batch thread\" # label all stdout from this thread\n loop do\n # Grab a batch from the input queue\n batch = $batchQueue.pop\n batch or break\n\n # And process it\n processBatch(batch)\n end\nend", "def processAllBatches\n Thread.current[:name] = \"batch thread\" # label all stdout from this thread\n loop do\n # Grab a batch from the input queue\n batch = $batchQueue.pop\n batch or break\n\n # And process it\n processBatch(batch)\n end\nend", "def perform_all(operations)\n begin\n Array(operations).each do |operation|\n perform(operation)\n end\n\n # return last value\n stack.peek\n rescue => e\n # if error then return -1\n -1\n end\n end", "def execute(force = false)\n batch = nil\n @mutex.synchronize do\n if force || ready?\n batch = @batch.slice!(0...@size)\n end\n end\n\n if batch && !batch.empty?\n @callback.call(batch)\n end\n end", "def batch_insert(docs)\n execute_batch_push(docs)\n end", "def call\n rows.map.with_index do |row, row_num|\n process_entities(row, row_num, &:call)\n end\n end", "def batch_command__pg_gem call, *args\n @results ||= []\n call = array__from call\n call = call.first\n exec_method ||= \"exec\"\n command = args.join \" \"\n exec_rv, exception = begin\n e = !(call.respond_to? exec_method) && NoMethodError.new(\"undefined method `#{exec_method}' for #{call.class}\")\n (e && [nil, e] || [(call.send exec_method, command), nil])\n rescue => e2\n [nil, e2]\n end\n exec_rv_entries = exec_rv.entries rescue exec_rv\n exception_info = (exception_info_base [exception]) rescue []\n @results.push({\n :time => Time.now.inspect,\n :call => call,\n :args => args,\n :command => command,\n :success => exception_info[2].negate_me,\n :output => exec_rv_entries,\n :batch_command_method => \"batch_command__pg_gem\",\n :exception_info => exception_info,\n })\n @results\n end", "def call\n # Add batches until we run out (FIXME: a more ruby way to do this?)\n while add_batch do\n end\n\n # Clear the disabled attribute\n @dataset.disabled = false\n @dataset.save\n rescue StandardError\n # FIXME: This should probably be a finally block?\n # Don't leave an empty dataset around under any circumstances\n @dataset.destroy\n raise\n end", "def call!\n rows.map.with_index do |row, row_num|\n process_entities(row, row_num, &:call!)\n end\n end", "def batch(options = {})\n _, _, _, options = \n extract_and_validate_params(schema.keys.first, \"\", [options], WRITE_DEFAULTS)\n\n @batch = []\n yield(self)\n compacted_map,seen_clevels = compact_mutations!\n clevel = if options[:consistency] != nil # Override any clevel from individual mutations if \n options[:consistency]\n elsif seen_clevels.length > 1 # Cannot choose which CLevel to use if there are several ones\n raise \"Multiple consistency levels used in the batch, and no override...cannot pick one\" \n else # if no consistency override has been provided but all the clevels in the batch are the same: use that one\n seen_clevels.first\n end\n \n _mutate(compacted_map,clevel)\n ensure\n @batch = nil\n end", "def batch_update(batch_client, attributes)\n perform_update(batch_client, attributes)\n end", "def queue_execute(targets)\n targets.group_by(&:transport).flat_map do |protocol, protocol_targets|\n transport = transport(protocol)\n report_transport(transport, protocol_targets.count)\n transport.batches(protocol_targets).flat_map do |batch|\n batch_promises = Array(batch).each_with_object({}) do |target, h|\n h[target] = Concurrent::Promise.new(executor: :immediate)\n end\n # Pass this argument through to avoid retaining a reference to a\n # local variable that will change on the next iteration of the loop.\n @pool.post(batch_promises) do |result_promises|\n results = yield transport, batch\n Array(results).each do |result|\n result_promises[result.target].set(result)\n end\n # NotImplementedError can be thrown if the transport is not implemented improperly\n rescue StandardError, NotImplementedError => e\n result_promises.each do |target, promise|\n # If an exception happens while running, the result won't be logged\n # by the CLI. Log a warning, as this is probably a problem with the transport.\n # If batch_* commands are used from the Base transport, then exceptions\n # normally shouldn't reach here.\n @logger.warn(e)\n promise.set(Bolt::Result.from_exception(target, e))\n end\n ensure\n # Make absolutely sure every promise gets a result to avoid a\n # deadlock. Use whatever exception is causing this block to\n # execute, or generate one if we somehow got here without an\n # exception and some promise is still missing a result.\n result_promises.each do |target, promise|\n next if promise.fulfilled?\n error = $ERROR_INFO || Bolt::Error.new(\"No result was returned for #{target.uri}\",\n \"puppetlabs.bolt/missing-result-error\")\n promise.set(Bolt::Result.from_exception(target, error))\n end\n end\n batch_promises.values\n end\n end\n end", "def batch(request, request_options = {})\n client.post(Protocol.batch_uri(name), request.to_json, :batch, request_options)\n end", "def execute *operations\n results = operations.map do |op|\n if tables.include? op.table\n op.execute @db[op.table]\n end\n end\n results.grep(Spinoza::ReadResult)\n end", "def send_batch_request(batch)\n post_data = batch.to_json\n resp = RestClient.post(@url, post_data, content_type: 'application/json', user_agent: \"syncano-ruby-#{Syncano::VERSION}\")\n if resp.nil? || resp.body.nil? || resp.body.empty?\n raise Jimson::ClientError::InvalidResponse.new\n end\n\n return resp.body\n end", "def call\n execute(*self.class.executes, abort_on_failure: true)\n end", "def pg_gem_batch__from psql_db, db_queries\n psql_db = array__from psql_db\n db_queries = array__from db_queries\n pg_gem_conn = pg_gem_conn__from psql_db\n pg_connection = pg_gem_conn[5]\n batch = [pg_connection].product db_queries\n end", "def each_task_batch\n self.class.tasks.each_batch\n end", "def execute!\n @actions.each do |action|\n action.call\n end\n end", "def handleBatchLayer(cluster, operation)\n case operation\n when 'bootstrap'\n batchLayerBootStrapping cluster\n when 'start'\n batchLayerStart cluster\n when 'stop'\n batchLayerStop cluster\n else\n puts \"ERROR\"\n end\n end", "def batch_transactions(options = {})\n response = JSON.parse(@client.get(\"items/#{send(:id)}/batch_transactions\", options).body)\n batch_transactions = response.key?('batch_transactions') ? response['batch_transactions'] : []\n batch_transactions.map { |attributes| Promisepay::BatchTransaction.new(@client, attributes) }\n end", "def each_row_batch_by_sql(sql, options={}, &block)\n options = {:connection => self.connection}.merge(options)\n cursor = PostgreSQLCursor::Cursor.new(sql, options)\n return cursor.each_row_batch(&block) if block_given?\n cursor.iterate_batched\n end", "def perform(&block)\n raise Exception.new(\"You must have at least 2 requests\") unless @requests.length > 1\n @responses.clear\n requests.each_slice(Limit).to_a.each do |batch|\n body = {\n :batch => Yajl::Encoder.encode(batch),\n :access_token => Baloo.client_credentials\n }\n Client.post(\"/\", :body => body).each do |response|\n # response['headers'] = Yajl::Parser.parse(response['headers'])\n response['body'] = Yajl::Parser.parse(response['body'])\n yield response\n end\n end\n end", "def send_batch(batch)\n smarty_request = Request.new\n\n return if batch.empty?\n\n converted_lookups = remap_keys(batch.all_lookups)\n\n if batch.size > 1\n smarty_request.payload = @serializer.serialize(converted_lookups)\n else\n smarty_request.parameters = converted_lookups[0]\n end\n\n response = @sender.send(smarty_request)\n\n raise response.error if response.error\n\n candidates = @serializer.deserialize(response.payload)\n candidates = [] if candidates.nil?\n\n assign_candidates_to_lookups(batch, candidates)\n end", "def batch(conn, sql, ctx: nil, limit: 1000, batch_wrapper: nil, silent: false, &block)\n ctx ||= {}\n ctx.update({:count => 0, :start_time => Time::now.to_f })\n\n # if no batch_wrapper is passed in, make a default that just\n # calls passed-in process_batch proc\n if batch_wrapper.nil?\n batch_wrapper = Proc.new do |process_batch|\n process_batch.call\n end\n end\n \n keep_going = true\n offset = 0\n while keep_going\n results = conn.query(sql + \" LIMIT #{limit} OFFSET #{offset}\")\n if results.count > 0\n\n # Proc closure over local vars\n process_batch = Proc.new do\n results.each do |row|\n begin\n block.call row, ctx\n rescue\n puts \"ERROR in #batch, processing row=#{row}\"\n raise\n end\n ctx[:count] += 1\n end\n end\n \n batch_wrapper.call(process_batch)\n \n elapsed = Time::now.to_f - ctx[:start_time]\n rate = 0\n if elapsed > 0\n rate = ctx[:count] / elapsed\n end\n puts \"Processed #{ctx[:count]} records so far in batch(): overall rate: #{rate} records/sec\" unless silent\n\n offset += limit\n else\n keep_going = false\n end\n end\n end", "def batchify\n nodes = pop(Time.now)\n batches = []\n\n nodes.in_groups_of(50, false) do |group|\n batches << SuperNode::Facebook::Batch.new({\n :access_token => access_token,\n :queue_id => queue_id,\n :batch => group,\n })\n end\n\n batches\n end", "def execute\n in_lock(EXCLUSIVE_LOCK_KEY, ttl: LOCK_TIMEOUT, retries: 1) do\n loop_until(timeout: LOOP_TIMEOUT, limit: LOOP_LIMIT) do\n stop_in_batch\n end\n end\n end", "def bulk(params={})\n params = params.merge({ custom_path: 'bulk' })\n @bulk ||= standard(params)\n end" ]
[ "0.7772181", "0.7756316", "0.7631752", "0.75497067", "0.75497067", "0.7442538", "0.7424742", "0.740174", "0.73849195", "0.73021626", "0.7283397", "0.72559154", "0.72144544", "0.7212532", "0.71399385", "0.7060715", "0.70038193", "0.69601953", "0.6811863", "0.66678095", "0.6636786", "0.6629314", "0.6624806", "0.65553385", "0.65537006", "0.6528906", "0.65260816", "0.6519714", "0.6476899", "0.6467371", "0.6365157", "0.63361275", "0.6312698", "0.6312048", "0.62834656", "0.62670666", "0.6194382", "0.6186061", "0.6168967", "0.61658156", "0.6161881", "0.6155028", "0.61478025", "0.6125066", "0.61091304", "0.608608", "0.6050661", "0.6042524", "0.60314757", "0.6030348", "0.5987698", "0.5950227", "0.59384674", "0.5927353", "0.59271216", "0.5907803", "0.588272", "0.5873836", "0.58714986", "0.58537126", "0.5849384", "0.5846127", "0.5842804", "0.5838745", "0.58118176", "0.58046365", "0.57825905", "0.57708603", "0.57660174", "0.5765282", "0.5756007", "0.5750504", "0.5750504", "0.5749892", "0.5748762", "0.57465774", "0.5740291", "0.5723024", "0.57191813", "0.5717272", "0.5710962", "0.5710359", "0.57018024", "0.5691588", "0.5686133", "0.5680797", "0.5680252", "0.5677203", "0.56759375", "0.56723076", "0.56651974", "0.5660366", "0.5652979", "0.5652281", "0.56521225", "0.56507975", "0.5642867", "0.5633791", "0.5632431" ]
0.68860716
19
Returns value at `key`.
def get(key) mon_synchronize do perform ["get", key] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(key)\n self[key]\n end", "def getValue(key)\r\n \r\n return @aHash[key]\r\n end", "def value(key)\n @hash[key]\n end", "def get(key)\n @hash.get(key)\n end", "def get(key)\n @hash[key]\n end", "def get(key)\n position = search(key)\n return nil if (key <=> @keys[position]) != 0\n @values[position]\n end", "def get(key)\n position = find(key)\n if position != nil\n @values[position]\n else\n nil\n end\n end", "def [](key)\n @monitor.synchronize do\n _, value = get(key)\n value\n end\n end", "def get(key)\n index = key_index(key)\n if( index )\n self.values.get(index)\n else\n nil\n end\n end", "def get(key)\n return @data[key.to_s]\n end", "def get(key)\n @ivar.each_with_index do |ele, i|\n if ele[0] == key \n return ele[1]\n end\n end\n end", "def get(key)\n return do_get(key, false)\n end", "def [](key)\n find_value(key)\n end", "def get(key)\n index = key_index(key)\n if( index )\n @i_values.get(index)\n else\n nil\n end\n end", "def get( key )\n key = UniMap.str_to_key( key ) unless key.is_a?( Key )\n key && get_k( key )\n end", "def get(key)\n node_for(key).get(key)\n end", "def get(key)\n node = get_rec(@root, key, 0)\n return nil if node.nil?\n return node.value\n end", "def get_value (key)\r\n @redis.get key\r\n end", "def get(key)\n @map[key]\n end", "def get(key)\n self.map_var.each do |pair|\n return pair[1] if pair[0] == key\n end\n nil\n end", "def get(key)\n row = key >> 10\n column = @a[row].index{|(i,v)| i == key}\n if column\n return @a[row][column][1] \n else\n return -1\n end\n end", "def [](key)\n @hash[key.to_s]\n end", "def get(key)\n node = _get(@root, key)\n return nil unless node\n node.value\n end", "def get(key); end", "def get(key); end", "def get(key); end", "def get(key); end", "def get(key)\n get_all(key).first\n end", "def get(key)\n end", "def get_item(key)\n self[key]\n end", "def get(key)\r\n\t\treturn nil if !key\r\n\t\t# Get the hash of our key\r\n\t\tindex = key.hash % @size\r\n\t\t# If location in array is empty then return nil otherwise find the \r\n\t\t# key and return associated value from the list\r\n\t\treturn nil if !@arr[index]\r\n\t\treturn @arr[index].find(key)\r\n\tend", "def [](key)\n @lock.synchronize do\n rkey = ref_key(key)\n @values[rkey] if rkey\n end\n end", "def get(key)\n key = normalize(key) or return\n table[key]\n end", "def [](key)\n\n lookup(key.to_s)\n end", "def [](key)\n self.get(key)\n end", "def get(key)\n @first.get(key)\n end", "def find(key)\n # TODO(himanshujaju) - possible improvement by not checking for contains.\n if contains?(key)\n return @key_data[key].value\n end\n\n return nil\n end", "def get(key)\n return nil unless @items.key?(key)\n @items[key].call\n end", "def value_of(key)\n @root.value_of(key)\n end", "def [](key)\n @hash[key]\n end", "def [](key)\n @hash[key]\n end", "def [](key)\n @hash[key]\n end", "def [](key)\n @hash[key]\n end", "def get(key)\n _get_from_params(key) || _get_from_values(key)\n end", "def get(key)\n value = @data[key]\n validate!(key, value)\n end", "def get(key)\n return -1 if @h[key].nil?\n cut_list_item_and_put_it_first @h[key]\n @h[key].v\n end", "def get(key)\n node = @cache[key]\n return -1 if node.nil?\n move_to_head(node)\n node.value\n end", "def get_key(key)\n return self.has_key?(key) ? self[key] : nil\n end", "def lookup(key)\n if key_pair = pair(key, hash(key))\n key_pair[1]\n end\n end", "def get(key)\n self.data[key] && self.data[key][:value]\n end", "def [](key)\n @mutex.synchronize { @hash[key] }\n end", "def [](key)\n @mutex.synchronize { @hash[key] }\n end", "def lookup(key)\n\t\t\t\treturn(@keys[key])\n\t\t\tend", "def lookup(key)\n\t\t\t\treturn(@keys[key])\n\t\t\tend", "def get(key)\n i = key.hash % @table.size\n node = @table[i]\n while node\n return node.value if key == node.key\n node = node.next\n end\n nil\n end", "def [](key)\n data[key.to_s]\n end", "def generic_get(key)\n data[key]\n end", "def [](key)\n @mutex.synchronize { @hash[key] }\n end", "def [](key)\n @values[key]\n end", "def [](key)\n result = default(key)\n result ? result.value : nil\n end", "def get(key)\n end", "def get(key)\n if @data.has_key?(key)\n return @data[key]\n else\n return false\n end\n end", "def [](key)\n hash[key]\n end", "def [](key)\n fetch(key)\n end", "def get(key)\n v = Nvmkv::kv_get(@kv_id, @pool_id, key)\n return (v != nil ? NVMKVValue.new(v) : nil)\n end", "def [](key)\n @data[key.to_s]\n end", "def obtain!(key)\n raise \"Missing key #{key}\" unless @hash.key?(key)\n @hash[key]\n end", "def get(key)\n node = node_for_key(key)\n node.read(&@block)\n end", "def [](key)\n @data[key]\n end", "def get(key)\n data = request_data(:get, key_uri(key))\n return nil unless data\n if nodes = data[S_NODE][S_NODES]\n nodes.each_with_object({}) do |node, acc|\n acc[node[S_KEY]] = node[S_VALUE]\n end\n else\n data[S_NODE][S_VALUE]\n end\n end", "def get(key)\n Lib.get @path, @no_follow, key.to_s\n end", "def get(key)\n\n\t\t#we will set the initial value of the variable as nil\n\t\tvalue = nil\n\t\t\n\t\t#iterate through the array\n\t\ti = 0\n\t\twhile i < @size\n\n\t\t\t#if we find the key inside the array\n\t\t\tif @array[i] == key\n\t\t\t\t#we will grab the next element (the value)\n\t\t\t\tvalue = @array[i+1]\n\t\t\t\t#and return it\n\t\t\t\treturn value\n\t\t\tend\n\n\t\t\t#go to all the even indexes\n\t\t\ti += 2\n\t\t\t\n\t\tend\n\n\t\t#if we don't find the key, return value as nil\n\t\treturn value\n\n\tend", "def get(key)\n bucket = @map[key.hash % @size]\n pair = bucket.find {|k, v| k == key}\n if pair \n pair[1]\n else\n -1\n end\n end", "def [](key)\n @mutex.synchronize{@hash[key]}\n end", "def [](key)\n dummy = Pair.new(key,nil)\n pair = @tree.get(dummy)\n return nil unless pair\n return pair.value\n end", "def [](key)\n key = key_for(key, false)\n @hash[key] if key\n end", "def [](*key)\n get(*key)\n end", "def get(key)\n @@list[key]\n end", "def [](key)\n @mutex.synchronize{ @hash[key] }\n end", "def []( key )\n hash = load_hash\n hash[key]\n end", "def get_from_key(key)\n @bucket_key_map[key]\n end", "def get(key)\n @cache[key]\n end", "def [] key\n return @hash[key.to_s]\n end", "def [](key)\n get(key)\n end", "def [](key)\n get(key)\n end", "def [](key)\n get(key)\n end", "def [](key)\n get(key)\n end", "def [](key)\n\t\t\t\treturn(lookup(key))\n\t\t\tend", "def [](key)\n\t\t\t\treturn(lookup(key))\n\t\t\tend", "def get(key)\n node = @table[key]\n return -1 if node.nil?\n\n make_most_recent_used(node)\n node.value\n end", "def get(key)\n \n end", "def [](key)\n @data[key]\n end", "def [](key)\n @data[key]\n end", "def [](key)\n @data[key]\n end", "def [](key)\n @data[key]\n end", "def [](key)\n @data[key]\n end", "def [](key)\n @data[key]\n end", "def [](key)\n @hash[key]\n end", "def [](key)\n if @result.include?(key)\n @result[key]\n else\n data[key]\n end\n end", "def [](key)\n data[key]\n end", "def [](key)\n data[key]\n end" ]
[ "0.8209121", "0.8161836", "0.8128814", "0.8109546", "0.805097", "0.8003338", "0.7934144", "0.7866334", "0.782038", "0.7817339", "0.7716695", "0.76619345", "0.7661221", "0.76153743", "0.75521433", "0.74543685", "0.7449144", "0.73956203", "0.7386595", "0.73797107", "0.7375503", "0.73650336", "0.7357022", "0.7353735", "0.7353735", "0.7353735", "0.7353735", "0.73531693", "0.73064363", "0.7297591", "0.7295531", "0.7290493", "0.7285544", "0.72838616", "0.7279626", "0.72791576", "0.72713387", "0.72661394", "0.72586703", "0.72460765", "0.72460765", "0.72460765", "0.72460765", "0.72408384", "0.722977", "0.72057474", "0.71934474", "0.7185172", "0.71834207", "0.71538997", "0.71498823", "0.71498823", "0.7146373", "0.7146373", "0.7146199", "0.714389", "0.71405745", "0.7138322", "0.7132972", "0.7132652", "0.71319085", "0.71292675", "0.7116102", "0.7107966", "0.71048135", "0.7101043", "0.71004146", "0.70998305", "0.70906514", "0.70746505", "0.70744854", "0.7073913", "0.7060355", "0.7058756", "0.70585424", "0.7056951", "0.7055336", "0.70406324", "0.7040563", "0.7018141", "0.70173234", "0.70136833", "0.700387", "0.7003557", "0.7003557", "0.7003557", "0.7003557", "0.7001482", "0.7001482", "0.69999415", "0.698426", "0.69820553", "0.69820553", "0.69820553", "0.69820553", "0.69820553", "0.69820553", "0.69804657", "0.69739205", "0.6973213", "0.6973213" ]
0.0
-1
Sets `value` at `key`.
def set(key, value) mon_synchronize do perform ["set", key, value], :proc => T_BOOL end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(key, value)\n @value[key.to_sym] = value if key\n end", "def set(key, value)\n change(:set, key, value)\n end", "def set(key, value)\n update(key) { |option| @data[option.name] = cast(value, option.type) }\n end", "def []=(key, value)\n\n set_field(key.to_s, value)\n end", "def []=(key, value)\n self[key].value = value\n end", "def []=(key, value)\n self[key].value = value\n end", "def set(key, value)\n end", "def set( key, value )\n unless key.is_a?( Key )\n k = UniMap.str_to_key( key )\n unless k\n raise IndexError, \"No Key named #{key.inspect} in UniMap.KEY_SPACE\"\n end\n key = k\n end\n set_k( key, value )\n end", "def set(key, value)\n @map[key] = value\n end", "def update(key, value)\n set(key.to_sym => value)\n end", "def set(key, value=nil)\n @data[key.to_s] = value\n end", "def set(key, value)\n\t\t\t\t# TODO This could be a bit more efficient:\n\t\t\t\tself.delete(key)\n\t\t\t\tself.add(key, value)\n\t\t\tend", "def set_value(key, value)\n @store_[key] = value\n YakvdConstants.success\n end", "def set(key, value)\n @store[key] = value\n end", "def set(key, value)\n self.data[key] = { value: value, timestamp: Time.now.to_i }\n self.data[key][:value]\n end", "def []=(key, value)\n @hash[key.to_s] = value\n end", "def []=(key, value)\n set(key, :val => value)\n end", "def []=(key, value)\n new_entry = entry_to_modify(key, value)\n new_entry[:key] = key\n new_entry[:value] = value\n end", "def set(key, value); end", "def set(key, value); end", "def []= key, value\n @hash[key.to_s] = value\n end", "def []=(key, value)\n setValueForKey(key.to_s, value.to_s)\n end", "def set(key, value)\n peek[key.to_sym] = value\n end", "def set_value(key, value)\n database[key] = value\n removed_keys.delete(key)\n end", "def []=(key, value)\n self.put(key, value)\n end", "def set(key, value)\n @manager.store(key, value)\n { key => value }\n end", "def set(key, value, **options)\n node_for(key).set(key, value, **options)\n end", "def set(key, value)\n self.data ||= {}\n self.data[key.to_s] = value\n self.save!\n end", "def set(key, value)\n Lib.set @path, @no_follow, key.to_s, value.to_s\n end", "def []=(key, value)\n set(key, value)\n end", "def set(key, value)\n value = JSON.dump(value) unless value.is_a?(String)\n @hash[key] = value\n end", "def set(key, value)\n @json_dict[key] = value\n end", "def set(key , value)\n index = key_index(key)\n if( index )\n self.keys.set(index , value)\n else\n self.keys.push(key)\n self.values.push(value)\n end\n value\n end", "def []=(key, value)\n coerced_value = coercion(key).present? ? coercion(key).call(value) : value\n old_setter(key, coerced_value)\n end", "def set(key, value)\n @namehash[key.to_sym][0] = value\n end", "def []=(key, value)\n @mutex.synchronize { @hash[key] = value }\n end", "def set(key , value)\n index = key_index(key)\n if( index )\n @i_values.set(index , value)\n else\n @i_keys.push(key)\n @i_values.push(value)\n end\n value\n end", "def []=(key_name, value)\n set(key_name, value)\n end", "def []=(key, value)\n put(key, value)\n end", "def set(key, value)\n arr_pos = to_hash(key)\n list = @array[array_pos]\n node = list.find_by_key(key)\n if node\n node.data = value\n else\n self.put(key, value)\n end\n end", "def []=(key, value)\n put(key, value, :replace => true)\n end", "def []=(key, value)\n @mutex.synchronize { @hash[key] = value }\n end", "def []=(key, value)\n @mutex.synchronize { @hash[key] = value }\n end", "def set(key, value)\n @content[key] = value\n end", "def []=(key, value)\n validate_property!(value)\n\n set_property(key, value)\n end", "def []=(key, value)\n _data[key] = value\n end", "def []=(key, value)\n set(key, value)\n end", "def []=(key, value)\n set(key, value)\n end", "def value=(v)\n connection.set(key, v)\n end", "def set(key, value)\n settings.send :\"#{key}=\", value\n end", "def []=(key, value)\n field_set key, value\n end", "def set(key, value)\n @content[key] = value\n end", "def []=(key, value)\n values[key] = value\n values.save\n end", "def set( key, value )\n fail NotImplementedError\n end", "def []=(key, value)\n data[key] = value\n end", "def set(key, value)\n @mutex.synchronize { @config_hash[key] = value }\n end", "def set(key, value)\n mon_synchronize do\n perform [\"set\", key, value], proc: T_BOOL\n end\n end", "def []=(key, value)\n @hash[key] = value\n end", "def set(key, value)\n @cache[key] = value\n end", "def []=(key, value)\n data[key] = value\n end", "def []=(key, value)\n @mutex.synchronize{@hash[key] = value}\n end", "def []=(key, value)\n store(key, value)\n end", "def []=(key, value)\n store(key, value)\n end", "def []=(key, value)\n store(key, value)\n end", "def set_key_value(key, val, options={})\n # metadata = get_key_metadata(key, options)\n key_value = val.nil? ? nil : val.to_s.strip\n self.value[key] = key_value\n key_value\n end", "def []=(key, value)\n @data[key.to_s]=value\n end", "def set(key, value)\n run_hook(:before_set, key, value)\n db[key] = value\n run_hook(:after_set, key, value)\n value\n end", "def []=(key, value)\n regular_writer(convert_key(key), convert_value(value, conversion: :assignment))\n end", "def set(key, value)\n raise NotImplementedError\n end", "def setvalue(key, value)\r\n @@params[key] = value\r\n end", "def []=(key,value)\n ruby_set(key&&key.to_s, value)\n end", "def set(key, value = nil, options = nil)\n @hash[key] = value\n end", "def field_set(key, value)\n field = self.class.fetch_field(key.to_sym)\n send \"#{key}=\", field.coerce(value)\n end", "def []=(key, value)\n regular_writer(convert_key(key), convert_value(value))\n end", "def set(key, value)\n @metadata[key] = value\n end", "def []=(key, value=nil) \n\n # If we are assigning something to nil, let's remove it\n if value.nil?\n delete(key)\n sleep @key_sleep.to_f\n nil\n else\n\t persistent = (value[:persistent].nil? ? 0 : (value[:persistent] ? 1 : 0))\n\t \n Klass.addKey(@handle, key.to_s, value[:value].to_s, persistent)\n sleep @key_sleep.to_f\n value[:value].to_s\n end\n end", "def []=(key, value)\n @data[key] = value\n end", "def []=(key, value)\n @data[key] = value\n end", "def []=(key, value)\n @data[key] = value\n end", "def []=(key, value)\n hash[key] = value\n end", "def set(key, value)\n response = db.put_item(@table_name, {'id' => {'S' => key}, 'value' => {'S' => value}})\n true\n end", "def []=( key, value )\n context.store(key.to_s, value)\n end", "def []=(key, value)\n fields[key] = value\n end", "def []= key, value\n @data[key] = value\n end", "def []= key, value\n @data[key] = value\n end", "def []=(key, value)\n regular_writer(convert_key(key), convert_value(value))\n end", "def set(key, value)\n raise \"Method not implemented. Called abstract class.\"\n end", "def set_property(key, value)\n @data[key] = value\n end", "def put(key, value)\n position = search(key)\n if (key <=> @keys[position]) == 0\n @values[position] = value\n else\n @keys.insert(position, key)\n @values.insert(position, value)\n end\n end", "def set(key, value)\n pair_idx = @map_arr.index { |pair| pair[0] == key }\n\n if pair_idx\n @map_arr[pair_idx][1] = value\n else\n @map_arr << [key, value]\n end\n\n value\n end", "def set(key, value)\n updated = false\n if self.map_var[0].empty?\n self.map_var[0] = [key, value]\n updated = true\n else \n self.map_var.each do |pair| \n if pair[0] == key \n pair[1] = value \n updated = true\n end\n end \n end\n self.map_var << [key, value] if !updated\n updated \n end", "def []=(key, value)\n @_hash[key.to_sym] = value\n end", "def []=(key, value)\n if RUBY_ENGINE == 'opal'\n @hash[key] = value\n else\n @mutex.synchronize { @hash[key] = value }\n end\n end", "def []= key, value\n key = @schema.resolve_key! key\n @schema.validate_value! key, value\n @values[key] = value\n end", "def []=(key, value)\n if RUBY_ENGINE == 'opal'\n @hash[key] = value\n else\n @mutex.synchronize { @hash[key] = value }\n end\n end", "def []=(key, value)\n @converted[key] = convert_value(value)\n end", "def set(key, val = nil)\n @statistics[:set] += 1\n with_branch_for(key) do |branch|\n branch.set key, val\n end\n end", "def setnx(key, value); end", "def setnx(key, value); end", "def set_field(key, value)\n\n Ruote.set(h.fields, key, value)\n end", "def set(key, *value)\n run { conf.set(key, value, config_params) }\n end" ]
[ "0.8524468", "0.83806324", "0.814796", "0.8060881", "0.8034225", "0.8034225", "0.7945208", "0.7939341", "0.7867888", "0.78562236", "0.7851565", "0.7842134", "0.7839458", "0.78352547", "0.7834426", "0.7817258", "0.7782038", "0.7769835", "0.77680266", "0.77680266", "0.774353", "0.7719783", "0.76899827", "0.76841587", "0.766741", "0.76587105", "0.7650297", "0.76446617", "0.7641735", "0.7631343", "0.7613455", "0.76064754", "0.759928", "0.7561672", "0.75321454", "0.75113916", "0.74621415", "0.74595", "0.7454628", "0.74394655", "0.7419342", "0.7419195", "0.7419195", "0.7410905", "0.7400491", "0.7399054", "0.7397668", "0.7397668", "0.7395963", "0.73876184", "0.7387159", "0.73786616", "0.7362768", "0.736196", "0.7357692", "0.735021", "0.73388547", "0.7334542", "0.7317425", "0.731116", "0.7310402", "0.7307905", "0.7307905", "0.7307905", "0.7300328", "0.72969174", "0.72909266", "0.72817713", "0.7277112", "0.72737235", "0.72623676", "0.72600573", "0.7250875", "0.72503567", "0.724588", "0.7227334", "0.7219178", "0.7219178", "0.7219178", "0.7210599", "0.7207767", "0.7207279", "0.7203758", "0.71988714", "0.71988714", "0.7196584", "0.71894175", "0.71836483", "0.7176915", "0.7174011", "0.71729815", "0.7169311", "0.71641546", "0.7162108", "0.7158929", "0.7153692", "0.7144765", "0.7142248", "0.7142248", "0.71389717", "0.713664" ]
0.0
-1
Increments a `key` by value
def incr(key, value = 1) mon_synchronize do perform ["incr", key, value], :proc => T_INT end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _inc(key,value)\n _set(key, (_get(key) || 0) + value)\n end", "def incr(key); end", "def incr(key); end", "def incrby(key, increment); end", "def incrby(key, increment); end", "def increment(key)\n @counter[key] += 1\n end", "def incr(key)\n node_for(key).incr(key)\n end", "def inc(key)\n \n end", "def incrby(key, increment)\n node_for(key).incrby(key, increment)\n end", "def incr(key, value = 1)\n mon_synchronize do\n perform [\"incr\", key, value], proc: T_INT\n end\n end", "def incr(key)\n send_command([:incr, key])\n end", "def increment\n Dictionary.db.zincrby @key, 1, @value\n end", "def incrby(key, increment)\n send_command([:incrby, key, Integer(increment)])\n end", "def increment_counter(key)\n if @counters.key?(key)\n @counters[key] += 1\n else\n @counters[key] = 1\n end\n end", "def hincrby(key, field, increment); end", "def hincrby(key, field, increment); end", "def hincrby(key, field, increment)\n node_for(key).hincrby(key, field, increment)\n end", "def increment(key, val)\n self[key] += _floatify(val)\n end", "def increase key, amount=1\n @lock.write_sync do\n return unless @data[key].nil? || Numeric === @data[key]\n @data[key] ||= 0\n @data[key] += amount\n end\n end", "def increment(key, amount=1, &block)\n if block.nil?\n key_to_use = key\n else\n key_to_use = self.keys.detect { |k| block.call(key, k) } \n end\n \n if self[key_to_use].nil?\n self[key_to_use] = amount\n else\n self[key_to_use] += amount\n end\n end", "def zincrby(key, increment, member); end", "def zincrby(key, increment, member); end", "def increment key\n @statsd_client.increment [@options[:env], @options[:prefix], key].join(\".\")\n end", "def hincrby(key, field, increment)\n send_command([:hincrby, key, field, Integer(increment)])\n end", "def incrbyfloat(key, increment); end", "def incrbyfloat(key, increment); end", "def incr(key, increment=nil)\n timeout_retry(3, 3){\n if increment\n write \"INCRBY #{key} #{increment}\\r\\n\"\n else\n write \"INCR #{key}\\r\\n\"\n end \n integer_reply\n }\n end", "def zincrby(key, increment, member)\n node_for(key).zincrby(key, increment, member)\n end", "def put(key, value)\n \txk = key % 10001 \n xk = (xk + 1) % 10001 while @arr[xk].first != nil && @arr[xk].first != key \n @arr[xk] = [key, value] \n end", "def increment(key, amount = 1, options = {})\n invoke(:increment, key) do |store|\n alter(store, key, amount, options)\n end\n end", "def increment\n @value += 1\n end", "def incr\n add(1)\n end", "def incr(key, timestamp, set_name)\n redis.zadd(set_name, timestamp, key)\n redis.incr(key).to_i\n end", "def increment(key, offset=1)\n ret, value = Lib.memcached_increment(@struct, key, offset)\n check_return_code(ret, key)\n value\n rescue => e\n tries ||= 0\n raise unless tries < options[:exception_retry_limit] && should_retry(e)\n tries += 1\n retry\n end", "def incr(x) x + 1 end", "def zincr(key, member, score = 1)\n mon_synchronize do\n perform [\"zincr\", key, member, score], :proc => T_INT\n end\n end", "def increment(k, amount = 1, ignored_options = nil)\n handle_fork\n new_v = _get(k).to_i + amount\n _set k, new_v, 0\n new_v\n end", "def update_counting_hash(hash, key)\n hash[key] ? hash[key] += 1 : hash[key] = 1\n hash\nend", "def zincr(key, member, score = 1)\n mon_synchronize do\n perform [\"zincr\", key, member, score], proc: T_INT\n end\n end", "def incrbyfloat(key, increment)\n node_for(key).incrbyfloat(key, increment)\n end", "def update_counting_hash(hash, key)\n if hash[key] \n hash[key] += 1\n else\n hash[key] = 1\n end\n hash\nend", "def zincrby(key, increment, member)\n call(key, [:zincrby, key, increment, member], transform: Redis::Floatify)\n end", "def incr(key, window=@max_window)\n key = key.to_s\n now = Time.now.to_f\n @redis.multi do\n @redis.zadd(key, now, SecureRandom.uuid)\n @redis.expire(key, @max_window.ceil)\n do_get(key, now, window)\n end.last\n end", "def hash_data_add(hash, key)\n if hash.has_key?(key)\n hash[key] = hash[key] + 1\n else \n hash[key] = 1\n end\n end", "def hincrbyfloat(key, field, increment); end", "def hincrbyfloat(key, field, increment); end", "def increment!(subject, val = 1)\n $redis.incrby(key(subject), val)\n end", "def inc(v = 1)\n sync { @v += v }\n end", "def increment(value, score=1, session=nil)\n start_kvs_session(session) do |kvs|\n kvs.sorted_sets[key_name(Time.now)].increment(value, score).to_i\n end\n end", "def put(key, value)\n @root = put_rec(@root, key, value, 0)\n end", "def []=(key, value)\n @next[key] = value\n end", "def increment(node)\n change_by node, 1\n end", "def increment(key, inc_value = 1, expires_in = nil, initial = nil)\n puts \"Rails.cache.increment(#{key}, #{inc_value}, {expires_in: #{get_ttl(expires_in)}, initial: #{initial}, raw: false})\"\n return Rails.cache.increment(key, inc_value, {expires_in: get_ttl(expires_in), initial: initial, raw: false})\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: increment: K: #{key}. M: #{exc.message}, I: #{exc.inspect}\" }\n return nil\n end", "def increment(prob_hash, key)\n di = key[0,2]\n freq_arr = prob_hash[di]\n if !freq_arr\n prob_hash[di] = [[key[-1,1], 1]]\n else\n target_letter = key[-1,1]\n freq = freq_arr.assoc(target_letter)\n if !freq then freq_arr << [target_letter, 1] else freq[1] += 1 end\n end\nend", "def updateKey; @key = getKey; self end", "def key=(value)\n raise TypeError, 'key must respond to #to_i' unless value.respond_to?(:to_i)\n \n @key = value.to_i\n end", "def put(key, value)\n @semaphore.synchronize do\n @hash[key] = value\n @signal.signal\n end\n end", "def put(key, value)\n position = search(key)\n if (key <=> @keys[position]) == 0\n @values[position] = value\n else\n @keys.insert(position, key)\n @values.insert(position, value)\n end\n end", "def update(key, value)\n set(key.to_sym => value)\n end", "def increment_map(map, key, age)\n if map.key?(key)\n map[key] = map[key]+1/2**(age/HALF_LIFE)\n else\n map[key] = 1/2**(age/HALF_LIFE)\n end\nend", "def set(key , value)\n index = key_index(key)\n if( index )\n @i_values.set(index , value)\n else\n @i_keys.push(key)\n @i_values.push(value)\n end\n value\n end", "def increment!\n @value += @increment\n \n self\n end", "def inc_hit(key, options)\n if @hits[key]\n @hits[key]+=1\n else\n @hits[key]=1\n end\n end", "def inc_hit(key, options)\n if @hits[key]\n @hits[key]+=1\n else\n @hits[key]=1\n end\n end", "def put(key, value)\n remove(key) unless get(key) == -1\n @count += 1\n resize! if @count == @size\n bucket = @map[key.hash % @size]\n bucket << [key, value]\n end", "def increment\n curr_value = counter\n self.counter = curr_value + 1\n save\n curr_value\n end", "def put(key, value)\n \n end", "def put(key, value)\n row = key >> 10\n puts \"Insert: #{key},#{value} => row = #{row}\" if @d\n column = @a[row].index{|(i,v)| i == key}\n\n if column\n @a[row][column][1] = value\n else\n @a[row].push([key, value])\n end\n end", "def incr(key, amt = 1, ttl = nil, default = nil)\n check_positive!(amt)\n\n perform(:incr, key, amt.to_i, ttl_or_default(ttl), default)\n end", "def increment(by=1, &block)\n allow_expiration do\n val = redis.incrby(key, by).to_i\n block_given? ? rewindable_block(:decrement, by, val, &block) : val\n end\n end", "def update_key(key, val)\n @ivar.each_with_index do |ele, i|\n if ele[0] == key\n @ivar[i][1] = val \n end\n end\n end", "def []=(key, value)\n self.next[key] = value\n end", "def incrbyfloat(key, increment)\n send_command([:incrbyfloat, key, Float(increment)], &Floatify)\n end", "def put(key, value); end", "def assoc(key)\n __assoc(key, 0)\n end", "def set(key , value)\n index = key_index(key)\n if( index )\n self.keys.set(index , value)\n else\n self.keys.push(key)\n self.values.push(value)\n end\n value\n end", "def rpushx(key, value)\n node_for(key).rpushx(key, value)\n end", "def []=(key, value)\n current = @head\n until current.key == key\n @tail = @tail.nil? ? current.nxt : current\n current.nxt = current.nxt.nil? ? Link.new(current.key + 1, nil, nil, current) : current.nxt\n current = current.nxt\n end\n @tail = current if current.nxt.nil?\n current.val = value\n @length += 1\n end", "def put(key, value)\n @first.put(key, value)\n end", "def increment(att, count = 1)\n key[:counters].call(\"HINCRBY\", att, count)\n end", "def set(key, val = nil)\n @statistics[:set] += 1\n with_branch_for(key) do |branch|\n branch.set key, val\n end\n end", "def decrby(key, decrement); end", "def decrby(key, decrement); end", "def increment(metric, value = 1)\n @adapter.increment metric, value\n end", "def add_pair(key, value)\r\n @redis.set(key, value)\r\n end", "def add_key(key)\n numkeys = @worksheet_obj.list.keys.length\n @worksheet_obj[1, numkeys+1] = key\n @worksheet_obj.save\n end", "def put(key, value)\n obj = KeyValue.find_by_key(key)\n if obj\n KeyValue.update(obj.id, :value=>value)\n else\n KeyValue.create(:key=>key, :value=>value)\n end\n end", "def increment(v = 1)\n if @value.kind_of?(String)\n @value = (to_f_or_i(@value) + v).to_s if to_f_or_i(@value)\n else\n @value += v\n end\n end", "def put(key, value)\n idx, bucket = find_bucket_and_index(key)\n if idx\n bucket[idx] = [key, value]\n else\n bucket << [key, value]\n end\n end", "def rpushx(key, value); end", "def rpushx(key, value); end", "def add_key(key)\n keys.add(key)\n end", "def increment\n @counter = @counter + 1\n end", "def lru_update(key)\n @lru.unshift(@lru.delete(key)|| key)\n end", "def decr(key, value = 1)\n mon_synchronize do\n perform [\"decr\", key, value], proc: T_INT\n end\n end", "def process_incrby(command)\n perform_add(command.first, command[1])\n end", "def rpush(key, value)\n node_for(key).rpush(key, value)\n end", "def key=(new_key)\n @key = new_key\n end", "def incr(att)\n raise ArgumentError unless counters.include?(att)\n write_local(att, db.incr(key(att)))\n end", "def decr(key, value = 1)\n mon_synchronize do\n perform [\"decr\", key, value], :proc => T_INT\n end\n end" ]
[ "0.8499209", "0.84502035", "0.84502035", "0.83065265", "0.83065265", "0.82977116", "0.82953817", "0.8258094", "0.81146497", "0.8103667", "0.7867785", "0.78472924", "0.7653222", "0.7595764", "0.7554784", "0.7554784", "0.74722785", "0.7413495", "0.7356084", "0.7270273", "0.71770006", "0.71770006", "0.70752275", "0.70610386", "0.7023843", "0.7023843", "0.6871495", "0.68515456", "0.66558504", "0.6644768", "0.6642728", "0.66221726", "0.6591738", "0.65802616", "0.65688837", "0.6499573", "0.64989895", "0.64784503", "0.64725494", "0.64693546", "0.63849914", "0.638263", "0.6377479", "0.6342096", "0.6324257", "0.6324257", "0.63025635", "0.62853193", "0.6237213", "0.62258273", "0.6224709", "0.6214898", "0.6208143", "0.6204027", "0.6172746", "0.6155924", "0.6151882", "0.61458135", "0.6143715", "0.6142444", "0.6126071", "0.6114729", "0.61132395", "0.61132395", "0.6111583", "0.61087203", "0.61019254", "0.610129", "0.6083958", "0.60786027", "0.6060072", "0.60562634", "0.6053336", "0.6051358", "0.6041181", "0.6033453", "0.60220325", "0.60211444", "0.6008387", "0.59775704", "0.59744835", "0.5972677", "0.5972677", "0.5966046", "0.5964095", "0.595964", "0.59526503", "0.594276", "0.59411573", "0.59325606", "0.59325606", "0.5923684", "0.5920182", "0.59196734", "0.5911583", "0.590409", "0.5892311", "0.58872867", "0.58850753", "0.5869374" ]
0.8064126
10
Decrements a `key` by value
def decr(key, value = 1) mon_synchronize do perform ["decr", key, value], :proc => T_INT end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrby(key, decrement); end", "def decrby(key, decrement); end", "def decr(key); end", "def decr(key); end", "def decr(key, value = 1)\n mon_synchronize do\n perform [\"decr\", key, value], proc: T_INT\n end\n end", "def decr(key)\n node_for(key).decr(key)\n end", "def decrby(key, decrement)\n node_for(key).decrby(key, decrement)\n end", "def decrby(key, decrement)\n send_command([:decrby, key, Integer(decrement)])\n end", "def decrement(key)\n msg = 'Trying to reduce count below zero.'\n raise RangeError, msg if @counter[key] == 0\n @counter[key] -= 1\n end", "def delete(key)\n @succ.delete key\n end", "def _dec(key,value)\n _set(key, (_get(key) || 0) - value)\n end", "def decrease key, amount=1\n @lock.write_sync do\n return unless @data[key].nil? || Numeric === @data[key]\n @data[key] ||= 0\n @data[key] -= amount\n end\n end", "def dec(key)\n \n end", "def decr(key, increment=nil)\n timeout_retry(3, 3){\n if increment\n write \"DECRBY #{key} #{increment}\\r\\n\"\n else\n write \"DECR #{key}\\r\\n\"\n end \n integer_reply\n }\n end", "def decrement(key, amount = 1, options = {})\n increment(key, -amount, options)\n end", "def delete key\n slot = _find_slot(key)\n return nil if !@data[slot]\n value = @data[slot+1]\n @data[slot] = DELETED\n @data[slot+1] = nil\n\n # Unlink record\n n = @data[slot+2]\n prev = @data[slot+3]\n if prev\n @data[prev+2] = n\n end\n if n\n @data[n+3] = prev\n end\n if @first == slot\n @first = n\n end\n if @last == slot\n @last = prev\n end\n\n # FIXME: It fails without this, which indicates a bug.\n #@length -= 1\n value\n end", "def delete(key)\n key = key.key if key.respond_to?(:key)\n\n unless (idx = @indicies[key]).nil?\n @indicies.delete(key)\n @indicies.each { |k,v| @indicies[k] = v -= 1 if v > idx }\n @lines.delete_at(idx)\n end\n end", "def delete(key)\r\n if record = touch(key)\r\n @store.delete(key)\r\n @head = @tail = nil if @store.length.zero?\r\n record[:value]\r\n end\r\n end", "def decrement(key, offset=1)\n ret, value = Lib.memcached_decrement(@struct, key, offset)\n check_return_code(ret, key)\n value\n rescue => e\n tries ||= 0\n raise unless tries < options[:exception_retry_limit] && should_retry(e)\n tries += 1\n retry\n end", "def delete(key)\n if value = @hash[key]\n @reverse[value].delete(key)\n @reverse.delete value if @reverse[value].empty?\n @hash.delete key\n end\n end", "def remove(key)\n \txk = key % 10001 \n xk = (xk + 1) % 10001 while @arr[xk].first != nil && @arr[xk].first != key \n @arr[xk] = [nil, -1] if @arr[xk].first == key\n end", "def delete_key(key)\n end", "def unset_value(key)\n database.delete(key)\n removed_keys << key\n end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key)\n pop if change_key(key, nil, true)\n end", "def remove(key)\n unless get(key) == -1\n @count -= 1\n bucket = @map[key.hash % @size]\n bucket.reject! {|k, v| k == key}\n end\n end", "def delete(key)\n position = search(key)\n return if (key <=> @keys[position]) != 0\n @keys.delete_at(position)\n @values.delete_at(position)\n end", "def delete key\n @internal_hash[key].clear\n end", "def del(key)\n @first.del(key)\n end", "def remove(key); end", "def del(key)\n position = find(key)\n if position != nil\n # delete\n value = @values[position]\n @slots[position] = nil\n @values[position] = nil\n value\n else\n nil\n end\n end", "def delete(key)\n transaction do |y|\n y.delete(key)\n end\n end", "def lrem(key, count, value); end", "def lrem(key, count, value); end", "def getdel(key); end", "def getdel(key); end", "def delete_pair(key)\r\n @redis.del key \r\n end", "def delete(key)\n return unless in?(key)\n\n hash_index = hasher(key, @keys.size)\n\n if @keys[hash_index] == key\n @keys[hash_index] = nil\n @values[hash_index] = nil\n else\n next_key_index = rehash(hash_index, @keys.size)\n\n while @keys[next_key_index] != nil and @keys[next_key_index] != key\n next_key_index = rehash(next_key_index, @keys.size)\n end\n\n @keys[next_key_index] = nil\n @values[next_key_index] = nil\n end\n end", "def delete(key)\n response = request(:delete, uri(key))\n if response.status == 200\n data = MultiJson.load(response.body)\n data[S_PREV_VALUE]\n else\n nil\n end\n end", "def remove(key)\n\n if include?(key)\n self[key].delete(key)\n @count -= 1\n end\n\n end", "def decrement\n @value -= 1\n end", "def incr(key); end", "def incr(key); end", "def delete(key)\n self.map_var.each_with_index do |pair, idx|\n if pair[0] == key \n first_half = self.map_var[0...idx] \n second_half = self.map_var[idx+1..-1]\n self.map_var = first_half + second_half\n break\n end \n end\n end", "def lrem(key, count, value)\n node_for(key).lrem(key, count, value)\n end", "def delete key\n write_data_entry key, nil, true\n @keydict[key] = nil\n\n sync\n end", "def delete(key)\n\n end", "def remove(key)\n\n end", "def delete(key)\n @lock.synchronize do\n rkey = ref_key(key)\n if rkey\n @references_to_keys_map.delete(rkey)\n @values.delete(rkey)\n else\n nil\n end\n end\n end", "def delete(key)\r\n\t\t# If key does not exist then return nil otherwise delete node from list\r\n\t\t# and decrease total number of items in Hashmap by 1\r\n\t\treturn nil if key == nil || !get(key)\r\n\t\tindex = key.hash % @size\r\n\t\t@total -= 1\r\n\t\treturn @arr[index].delete(key)\r\n\tend", "def decrement(key, amount = 1, options = {})\n invoke(:decrement, key) do |store|\n alter(store, key, -amount, options)\n end\n end", "def delete(key)\n @hash.delete key\n @key_hash.delete key\n end", "def delete(key)\n v = @store.delete(key)\n v ? v.value : v\n end", "def inc(key)\n \n end", "def delete(key)\n @internal_hash.delete(key)\n end", "def delete(key)\n hashed_key = key.hash\n bucket_index = hashed_key % num_buckets\n return nil if !@store[bucket_index].include?(key)\n @count -=1\n @store[bucket_index].remove(key)\n end", "def releaseKey(key)\n\t\t@keysPressed.delete(key)\n\tend", "def remove(key)\n row = key >> 10\n column = @a[row].index{|(i,v)| i == key}\n if column\n @a[row].delete_at(column)\n end\n end", "def delete(key)\n @data.delete(key)\n @key_size.delete(key)\n end", "def lrem(key, count, value)\n send_command([:lrem, key, Integer(count), value])\n end", "def delete(key)\n @mutex.synchronize do\n x = anchor\n level = node_level(x)\n update = Array.new(level)\n x = find_with_update(x, level, key, update)\n \n # remove existing key\n \t if node_compare(x, key) == 0\n \t level = node_level(x)\n \t while level > 0\n \t level -= 1\n \t node_delete_after!(x, update[level], level)\n end\n \t end\n end\n \tself\n \tend", "def delete(key, args={})\n data = request_data(:delete, key_uri(key), args)\n return nil unless data\n data[S_PREV_NODE][S_VALUE]\n end", "def delete(key)\n @redis.delete(key)\n end", "def remove_element(arr, key)\n next_element = 0\n\n for i in 0..(arr.length - 1) \n if arr[i] != key\n arr[next_element] = arr[i]\n next_element += 1\n end\n\n end\n return next_element\nend", "def delete(key)\n i = key.hash % @table.size\n return unless @table[i]\n if @table[i].key == key\n @table[i] = @table[i].next\n @count -= 1\n return\n end\n node = @table[i]\n while node.next\n if key == node.next.key\n node.next = node.next.next\n @count -= 1\n return\n end\n node = node.next\n end\n end", "def decrease_key(key, new_key = nil)\n if node = search_key(key)\n if new_key && node.key < new_key \n puts \"the new key is greater than the old one, cause error.\"\n else\n new_key ? node.key = new_key : node.key = get_new_smaller_key(key)\n parent = node.parent\n if parent && node.key < parent.key\n cut(self, node, parent)\n cascading_cut(parent)\n end\n @min = node if node.key < min.key\n end\n node\n else\n puts \"Cannot find that key in heap.\"\n end\n end", "def delete\n redis.del key\n end", "def remove(key)\n a_hash[key] = nil\n end", "def get(key)\n ret = @values[key]\n return -1 unless ret\n\n @values.delete(key)\n @values[key] = ret\n ret\n end", "def incrby(key, increment); end", "def incrby(key, increment); end", "def delete(key)\n key = alternate_key(key) unless has_key?(key)\n super\n end", "def delete(key)\n return unless key? key\n\n @semaphore.synchronize do\n node = @hashed_storage[key]\n @head_node = node.previous_node if node == @head_node\n @tail_node = node.next_node if node == @tail_node\n node.previous_node.next_node = node.next_node if node.previous_node\n node.next_node.previous_node = node.previous_node if node.next_node\n @hashed_storage.delete(key)\n end\n end", "def decrement(key, value = 1, expires_in = nil, initial = nil)\n puts \"Rails.cache.decrement(#{key}, #{value}, {expires_in: #{get_ttl(expires_in)}, initial: #{initial}, raw: false})\"\n return Rails.cache.decrement(key, value, {expires_in: get_ttl(expires_in), initial: initial, raw: false})\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: decrement: K: #{key}. M: #{exc.message}, I: #{exc.inspect}\" }\n return nil\n end", "def release(key, value)\n return\n end", "def delete(key)\n @hash.delete(key.to_s)\n end", "def remove(key)\n idx, bucket = find_bucket_and_index(key)\n return unless idx\n\n bucket.delete_at(idx)\n end", "def delete(key)\n perform_delete(:delete, key)\n end", "def del(key)\n ensure_connected\n num = redis_handler.del(key.to_s)\n fail ArgumentError, \"Unknown key, cannot delete\" if num == 0\n end", "def delete(key)\n value = self[key]\n\n @memcached.delete key\n\n value\n end", "def remove(value)\n connection.zrem(key_label, value)\n end", "def decr(att)\n raise ArgumentError unless counters.include?(att)\n write_local(att, db.decr(key(att)))\n end", "def subtract(key, value)\n update_array(key, value, :subtract)\n end", "def decrement!\n @value -= @increment\n \n self\n end", "def clear_by_key(key)\n delete(key)\n end", "def delete key\n rv = self[key]\n self.removeField key\n return rv\n end", "def delete _key\n store.transaction() { |s| s.delete(prepare_key(_key)) }\n end", "def delete(key, &block); end", "def decrement(by=1, &block)\n allow_expiration do\n val = redis.decrby(key, by).to_i\n block_given? ? rewindable_block(:increment, by, val, &block) : val\n end\n end", "def pop\n conn.rpop key\n end", "def rem(key, value)\n log(\"get :Deltas, #{key}, #{cache_name(value)}\")\n timestamp = connection.get(:Deltas, key, cache_name(value))\n\n log(\"remove :Deltas, #{key} -> #{timestamp_name(timestamp)}\")\n connection.remove(:Deltas, key, timestamp_name(timestamp))\n\n log(\"remove :Deltas, #{key} -> #{cache_name(value)}\")\n connection.remove(:Deltas, key, cache_name(value))\n end", "def delete(key)\n @ivar.each_with_index do |ele, i|\n if ele[0] == key\n @ivar.delete_at(i)\n end\n end\n end", "def erase(key)\n if !contains?(key)\n return\n end\n\n erase_internal(key)\n end", "def getdel(key)\n node_for(key).getdel(key)\n end", "def decrement(k, amount = 1, ignored_options = nil)\n increment k, -amount\n end", "def remove(key)\n synchronized { @hash.delete(key) { yield if block_given? } }\n end" ]
[ "0.8362622", "0.8362622", "0.82929134", "0.82929134", "0.81447566", "0.7927976", "0.7662722", "0.7445303", "0.739772", "0.7396719", "0.72388434", "0.714702", "0.7124984", "0.710158", "0.70213884", "0.70205045", "0.6959138", "0.69312334", "0.677071", "0.673775", "0.67252386", "0.6720023", "0.669352", "0.66841096", "0.66841096", "0.66841096", "0.66841096", "0.66841096", "0.66711444", "0.6661883", "0.665676", "0.66540194", "0.663394", "0.66233677", "0.6620464", "0.6595368", "0.65818036", "0.65818036", "0.6570118", "0.6570118", "0.6543239", "0.65426683", "0.6525005", "0.64809227", "0.6475193", "0.6421765", "0.6421765", "0.64164937", "0.64149606", "0.6411415", "0.6396513", "0.6395397", "0.63305175", "0.6322551", "0.63030785", "0.6266071", "0.62614703", "0.6224663", "0.62197727", "0.62182915", "0.62143546", "0.62000036", "0.6193001", "0.6187205", "0.61849314", "0.6182221", "0.6171654", "0.61589485", "0.61150044", "0.6113206", "0.6107548", "0.6105999", "0.60986507", "0.60965437", "0.60965437", "0.60923815", "0.60804707", "0.60794234", "0.6077827", "0.60677415", "0.60598", "0.6054732", "0.6050076", "0.60479575", "0.60476094", "0.6030227", "0.6027948", "0.60230637", "0.6022264", "0.6012445", "0.60086334", "0.599824", "0.59978807", "0.5992108", "0.5970739", "0.59707034", "0.5964281", "0.59585786", "0.5956152", "0.5955178" ]
0.8108653
5
Checks existence of `key`.
def exists(key) mon_synchronize do perform ["exists", key], :proc => T_BOOL end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_key?(key)\n !get(key).nil?\n end", "def has_key?(key)\n !get(key).nil?\n end", "def exists?(key)\n unimplemented\n end", "def has_key?(key); end", "def has_key?(key); end", "def has_key? key; key? key; end", "def has_key?(key)\n keys.include?(key)\n end", "def exists?(key)\n key.present? && manager.key?(key)\n end", "def has_key?(key)\n @hash.has_key?(key)\n end", "def has_key?(key)\n !find_node(key).nil?\n end", "def exists(key)\n mon_synchronize do\n perform [\"exists\", key], proc: T_BOOL\n end\n end", "def exist?(key)\n !@store.select { |i| i[:key] == build_key(key) }.empty?\n end", "def exists?(key)\n raise \"Method not implemented. Called abstract class.\"\n end", "def has_key?( key )\n key = UniMap.str_to_key( key ) unless key.is_a?( Key )\n key && contains_key( key )\n end", "def exists?(key)\n @data.has_key?(key) && @data[key].valid?(self)\n end", "def exist?(key)\n !find(key).nil?\n end", "def has_key?(key)\n @table.get(key) != nil\n end", "def has_key?(key)\n !!fetch(key)\n rescue ContextMiss\n false\n end", "def has_key?(key)\n return to_h().has_key?(key)\n end", "def exist?(key)\n\n end", "def exist?(key)\n raise NotImplementedError\n end", "def has_key?(key)\n @cache.has_key?(key)\n end", "def key?(key)\n !self[key].nil?\n end", "def has_key?(key)\n @stored[key] && !@stored[key].empty? ? true : false\n end", "def exist?(key)\n with_client do |client|\n !client.exists(build_key(key)).zero?\n end\n end", "def has_key?(key)\n @h.has_key?(key.to_sym)\n end", "def has_key?(key)\n return self.fetch(key) ? true : false\n end", "def contains?(key)\n not get(key).nil?\n end", "def contains?(key)\n @key_data.has_key?(key)\n end", "def exist(key)\n check_return_code(\n Lib.memcached_exist(@struct, key),\n key\n )\n end", "def is_key_exist(key)\r\n (@redis.exists key) ? true : false \r\n end", "def has_key?(key)\n raise NotImplementedError\n end", "def has_key?(key)\n any? {|mod| mod.name == key}\n end", "def exist?(key)\n store.key?(key)\n end", "def key?(key)\n timeout_retry(3, 3){\n write \"EXISTS #{key}\\r\\n\"\n integer_reply == 1\n }\n end", "def has_key? key\n @lock.read_sync{ @data.has_key? key }\n end", "def exists(key)\n call(key, [:exists, key], transform: Redis::Boolify, read: true)\n end", "def has_key?(key)\n dummy = Pair.new(key,nil)\n return @tree.get(dummy)\n end", "def exists?\n retrieve\n true\n rescue Error::NoSuchKey\n false\n end", "def has_key(hash, key)\n\thash.has_key? key\nend", "def exist?(key, options = {})\n exist(key)\n true\n rescue NotFound\n false\n rescue Error => e\n log_exception e\n end", "def has_key?(key)\n @db.each_key do\n\t|k|\n\treturn true if k == key\n end\n end", "def exists?(key)\n @redis.exists(prefix(key))\n end", "def plist_key_exists?(key, file, opts={})\n plist_read(key, file, opts) != nil\n end", "def include?(key)\n has_key?(key)\n end", "def exist? _key\n store.transaction(:read_only) do |s|\n s.roots.any? { |r| r.to_sym == _key.to_sym }\n end\n end", "def contains?(key)\n @semaphore.synchronize {\n @key_data.has_key?(key)\n }\n end", "def has_key?(p0) end", "def exists?(key, bucket = nil)\n about(key, bucket)\n true\n rescue NoSuchKey\n false\n end", "def has_key?(key)\n @map.has_key?(key.to_sym)\n end", "def has?(key)\n @properties.has_key?(key)\n end", "def exist?(key)\n jiak.client.exist?(jiak.bucket,key)\n end", "def has_key?(key)\n params.keys.include?(key)\n end", "def has_key?(key)\n super(convert_key(key))\n end", "def exist?(key)\n File.exist?(cache_path(key))\n end", "def has_key?(key)\n configs.has_key?(key) || store.has_key?(key) \n end", "def key?(key)\n keys.include?(key) || keys.map(&:to_s).include?(key)\n end", "def key?(key)\n keys.include?(key) || keys.map(&:to_s).include?(key)\n end", "def has_key?(key)\n super(convert_key(key))\n end", "def valid_key? key\n (not key.nil?) and (FileCreator::valid_key?(key.to_sym))\n end", "def key?(key)\n lookup_map.key?(key.to_sym)\n end", "def key?(key)\n @items.key?(key)\n end", "def exists(key)\n\n # FIXME: insert code that connects to the backend and affects the exists\n # operation\n #\n # - Convert any exceptions into a failed status result with a meaningful\n # error message.\n #\n\n { :result => nil, :err_msg => 'FIXME: not implemented' }\n end", "def include?(key)\n # Ensure a Ruby true is returned\n item_exists(key) == true\n end", "def key?(key)\n !(head && head.commit.tree / key_for(key)).nil?\n end", "def key?(key)\n !(head && head.commit.tree / key_for(key)).nil?\n end", "def has?(key)\n node = _get(@root, key)\n !node.nil? && !node.undefined?\n end", "def exists?(key)\n # Use recommended binary-returning method create [with this redis-rb commit](https://github.com/redis/redis-rb/commit/bf42fc9e0db4a1719d9b1ecc65aeb20425d44427).\n return Lit.redis.exists?(key) if Lit.redis.respond_to?(:exists?)\n\n # Fall back with older gem\n Lit.redis.exists(key)\n end", "def key?(key)\n\t\t\t\tif key\n\t\t\t\t\t@keyed.key?(key)\n\t\t\t\tend\n\t\t\tend", "def exist?(key)\n instrument :exist, key: key do |payload|\n id = map_key_to_id(key)\n answer = id.present?\n\n payload[:exist] = answer\n answer\n end\n end", "def has_key?(key)\n @configuration.has_key?(key.to_sym)\n end", "def has?(key)\n respond_to? key\n end", "def key?(key)\n public_method_defined?(key.to_sym)\n end", "def include?(key)\n @hash.has_key?(key.to_s)\n end", "def has_key(key, pos= 0, len= -1)\n end", "def key?(key)\n raise \"you are not allowed to use double dot '..' notation in paths\" if key.match(/\\.\\.\\//)\n ::File.exists?(full_key(key))\n end", "def exists?(key)\n s3_object(key).exists?\n end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def try_key?(*args)\n for key in args\n return false if !self.keys.include?(key) || !self[key]\n end\n return true\n end", "def private_key_exists?\n full_key_path.exist?\n end", "def key?(key)\n configuration.key?(key)\n end", "def has_key?(key)\n local?(key) || (!@parent.nil? && @parent.key?(key))\n end", "def key?(key, options = {})\n load(key, options) != nil\n end", "def key?(key)\n return false if key.nil?\n return true if self.class.mutable? && mutations.key?(key)\n\n respond_to?(key) || fallback_data.key?(key)\n end", "def shell_registry_key_exist?(key)\n begin\n key = normalize_key(key)\n rescue ArgumentError\n return false\n end\n\n results = shell_registry_cmd(\"query \\\"#{key}\\\"\")\n if results =~ /ERROR: /i\n return false\n else\n return true\n end\n end", "def has?(key)\n @definitions.has_key?(key)\n end", "def key_exist?(key)\n FastGettext.key_exist?(key)\n rescue Errno::ENOENT => error\n Yast.y2warning(\"File not found when translating '#{key}' on textdomain #{@my_textdomain}'. \"\\\n \"Error: #{error}. Backtrace: #{error.backtrace}\")\n false\n end", "def exist?(key)\n raise \"subclass responsibility\"\n end", "def has_key?(key)\n #if the key is an alias, lookup the real key\n key = aliasing_hash_aliases[key] if aliasing_hash_aliases.include?(key)\n \n super\n end", "def key?(key)\n @configuration.key?(key)\n end", "def has?(key)\n [cache, values].any? { |store| store.keys.include?(key.to_sym) }\n end", "def check_key_exist url_key\n @url_generators = UrlGenerator.all\n @url_generators.each do |url_generator|\n if url_generator.key == url_key\n return true\n end\n end\n return false\n end", "def exist?(key, options = {})\n invoke(:exist?, key) do |store|\n store.exists(namespaced_key(key, merged_options(options)))\n end\n end", "def contains?(key)\n position = search(key)\n (key <=> @keys[position]) == 0\n end", "def exists?(type, key)\n if directory(type, key)&.files&.head(key_component(type, key))\n true\n else\n false\n end\n end" ]
[ "0.833511", "0.833511", "0.8231147", "0.8154501", "0.8154501", "0.81366646", "0.812203", "0.806389", "0.80307907", "0.79923564", "0.7988228", "0.78915256", "0.7867111", "0.78417283", "0.7825562", "0.78219116", "0.7818071", "0.7807445", "0.7785388", "0.77847975", "0.77836746", "0.7756003", "0.7750057", "0.77419883", "0.7730948", "0.7717438", "0.768839", "0.7685099", "0.7666432", "0.76592255", "0.76295257", "0.75950015", "0.75698256", "0.7555678", "0.7552493", "0.75479376", "0.75467175", "0.7545415", "0.752799", "0.7513402", "0.74947315", "0.74816424", "0.74711514", "0.7457298", "0.74428177", "0.74326175", "0.74248886", "0.7419468", "0.7405961", "0.740288", "0.7365593", "0.73510456", "0.7349717", "0.73184764", "0.73151094", "0.7307554", "0.7293807", "0.7293807", "0.72784704", "0.7229355", "0.72283417", "0.72243243", "0.7218332", "0.7213748", "0.71849084", "0.71849084", "0.7178457", "0.71746004", "0.7165908", "0.71510065", "0.71432596", "0.7141061", "0.7138173", "0.71313125", "0.7127758", "0.7119153", "0.71169055", "0.7116515", "0.7116515", "0.7116515", "0.7116515", "0.7116515", "0.7116515", "0.71087533", "0.7101584", "0.7097177", "0.708081", "0.7077915", "0.70758086", "0.7072897", "0.7065282", "0.7063756", "0.7056637", "0.7053749", "0.7037754", "0.70348716", "0.7022692", "0.702072", "0.70129746", "0.7009219" ]
0.78744876
12
Scans keys between `start` and `stop`.
def keys(start, stop, opts = {}) limit = opts[:limit] || -1 mon_synchronize do perform ["keys", start, stop, limit], :multi => true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keys(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"keys\", start, stop, limit], multi: true\n end\n end", "def zscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zscan\", key, BLANK, start, stop, limit], multi: true, proc: T_STRINT\n end\n end", "def zscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zscan\", key, BLANK, start, stop, limit], :multi => true, :proc => T_STRINT\n end\n end", "def zrscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zrscan\", key, BLANK, start, stop, limit], multi: true, proc: T_STRINT\n end\n end", "def zrscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zrscan\", key, BLANK, start, stop, limit], :multi => true, :proc => T_STRINT\n end\n end", "def scan(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"scan\", start, stop, limit], multi: true, proc: T_STRSTR\n end\n end", "def scan(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"scan\", start, stop, limit], :multi => true, :proc => T_STRSTR\n end\n end", "def search(start_key, end_key, limit, offset, reverse, with_keys)\n offset ||= 0\n \n start_node = find_by_prefix(start_key, reverse)\n !start_node and return []\n \n start_node = skip_nodes(start_node, offset, reverse)\n !start_node and return []\n \n collect_values(start_node, end_key, limit, reverse, with_keys)\n end", "def zkeys(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zkeys\", key, BLANK, start, stop, limit], :multi => true\n end\n end", "def zkeys(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zkeys\", key, BLANK, start, stop, limit], multi: true\n end\n end", "def getrange(key, start, stop); end", "def getrange(key, start, stop); end", "def work!\n (@start..@stop).each {|i| return if $found; d = $data[i]; $found = true and puts \"Found #{d}\" if d == $search_key }\n end", "def range(start, stop)\n fetch(redis.zrange(key, start, stop))\n end", "def lrange(key, start, stop); end", "def lrange(key, start, stop); end", "def zrange(key, start, stop, **options); end", "def rscan(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"rscan\", start, stop, limit], multi: true, proc: T_STRSTR\n end\n end", "def rscan(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"rscan\", start, stop, limit], :multi => true, :proc => T_STRSTR\n end\n end", "def getrange(key, start, stop)\n send_command([:getrange, key, Integer(start), Integer(stop)])\n end", "def range(start, stop)\n fetch(key.call(\"LRANGE\", start, stop))\n end", "def find_line(lines, stop)\n\tlines.each_pair { |key, line| return key if line.include?(stop) }\nend", "def find_line(lines, stop)\n\tlines.each_pair { |key, line| return key if line.include?(stop) }\nend", "def lrange(key, start, stop)\n send_command([:lrange, key, Integer(start), Integer(stop)])\n end", "def zscan(key, cursor, **options); end", "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", "def find_middle(start, stop)\n index = ((stop - start) / 2) + start\n time = time_at(index)\n [index, time]\n end", "def zrange(key, start, stop, byscore: T.unsafe(nil), by_score: T.unsafe(nil), bylex: T.unsafe(nil), by_lex: T.unsafe(nil), rev: T.unsafe(nil), limit: T.unsafe(nil), withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end", "def getrange(key, start, stop)\n node_for(key).getrange(key, start, stop)\n end", "def find_in_range *args\n if args[0].respond_to?(:first) && args[0].respond_to?(:last)\n\tt_start = args[0].first\n\tt_end = args[0].last\n else\n\tt_start = args[0]\n\tt_end = args[1]\n end\n opts = args.last if args.last.respond_to?(:keys)\n if opts\n\tlimit = opts[:limit]\n end\n result = []\n count = 1\n loop do\n rnext = find_next t_start\n break if count > limit if limit\n\tbreak if rnext > t_end\n result << rnext\n t_start = rnext + 1\n\tcount += 1\n end\n result\n end", "def scan_stop_all\n\t\t\tb=scan_list_uids\n\t\t\tb.each {|uuid|\n\t\t\t\tscan_stop(uuid)\n\t\t\t}\n\t\t\treturn b\n\t\tend", "def find(from, to)\n return unless valid_start_end?(from, to)\n\n horiz_traverse = go_horizontal(from, to)\n return horiz_traverse if valid_cycle?(horiz_traverse)\n vert_traverse = go_vertical(from, to)\n return vert_traverse if valid_cycle?(vert_traverse)\n end", "def lrange(key, start, stop)\n node_for(key).lrange(key, start, stop)\n end", "def zscan_each(key, **options, &block); end", "def scan_stop_all\r\n\t\tb=scan_list_uids\r\n\t\tb.each {|uuid|\r\n\t\t\tscan_stop(uuid)\r\n\t\t}\r\n\t\treturn b\r\n\tend", "def find(boundary,value,start,stop)\n return start if start == stop\n mid_index, mid_time = find_middle(start,stop)\n # puts \"+ find_#{boundary} (#{value}, #{start}, #{stop}) [mid_index #{mid_index}:#{mid_time}]\"\n if mid_time == value\n find_adjacent(boundary,value,start,stop,mid_index)\n elsif mid_time > value\n mid_index -= 1 if mid_index == stop\n find(boundary, value, start, mid_index)\n elsif mid_time < value\n mid_index += 1 if mid_index == start\n find(boundary, value, mid_index, stop)\n end\n end", "def cmd_keyscan_start(*args)\n\t\tprint_line(\"Starting the keystroke sniffer...\")\t\n\t\tclient.ui.keyscan_start\n\t\treturn true\n\tend", "def startstop minsize=30\n stopstop(minsize).find_all { | orf | \n codon1= orf.nt.seq[0..2].upcase\n ['ATG','TTG','CTG','AUG','UUG','CUG'].index(codon1) != nil\n }\n end", "def cmd_keyscan_start(*args)\n\t\tprint_line(\"Starting the keystroke sniffer...\")\n\t\tclient.ui.keyscan_start\n\t\treturn true\n\tend", "def zrange(key, start, stop, **options)\n node_for(key).zrange(key, start, stop, **options)\n end", "def get_set(start, finish, interval)\n cur_val = start; result = []\n while(cur_val < finish)\n result << cur_val\n cur_val += interval\n end\n result\n end", "def zrange(key, start, stop, options = {})\n args = [:zrange, key, start, stop]\n\n if options[:withscores]\n args << 'WITHSCORES'\n block = Redis::FloatifyPairs\n end\n\n call(key, args, transform: block, read: true)\n end", "def ltrim(key, start, stop); end", "def ltrim(key, start, stop); end", "def start(start_key)\n KeyValueList.new(self).start(start_key)\n end", "def list_range(key, start, ending)\n timeout_retry(3, 3){\n write \"LRANGE #{key} #{start} #{ending}\\r\\n\"\n multi_bulk_reply\n }\n end", "def preorder_search(start, find_val)\n false\n end", "def zrange(key, start, stop, options = {})\n send_cluster_command([:zrange, key, start, stop, options])\n end", "def get_path_by_names(start, stop)\n s1 = get_node(start)\n s2 = get_node(stop)\n if s1 != nil && s2 != nil\n return get_path(s1, s2)\n end\n Array.new \n end", "def keyscan_start\n\t\trequest = Packet.create_request('stdapi_ui_start_keyscan')\n\t\tresponse = client.send_request(request)\n\t\treturn true\n\tend", "def query_hash_range(key, start, count, step_size, ts_index, ts_size = 2)\n hash = make_redis_hash(start, count, step_size, ts_index, ts_size)\n\n ckey = convert_keys(key)\n node = @root[ckey]\n\n keys = hash.to_a.sort_by { |it| it[0] }\n mres = @redis.pipelined do\n keys.each do |key, values|\n node[key].hmget(*values)\n end\n end\n\n mres.flatten.collect(&:to_i)\n end", "def zrevrange(key, start, stop, **options); end", "def each_search_term(starting_term = nil)\n alpha_terms(starting_term).each { |t| yield t if block_given? }\n end", "def resume_loop(resumes)\n resumes.each do |r|\n keyword_search(r)\n end\nend", "def find_moves(start, target)\n visited = breadth_first_search(start, target)\n moves = []\n find_coordinate = target\n visited.reverse.each do |vertex|\n vertex.neighbors.each do |coordinate|\n if coordinate == find_coordinate\n moves << vertex.key\n find_coordinate = vertex.key\n end\n end\n end\n moves.reverse << target\n end", "def between from_key, to_key\n from(from_key).to(to_key, inclusive: true)\n end", "def search(pattern)\n # Initialize loop variables\n cursor = nil\n list = []\n\n # Scan and capture matching keys\n client.with do |conn|\n while cursor != 0\n scan = conn.scan(cursor || 0, match: pattern)\n list += scan[1]\n cursor = scan[0].to_i\n end\n end\n\n list\n end", "def slice(start, length = nil)\n case start\n when Integer\n if length\n range(start, start + length - 1)\n else\n conn.lindex(key, start) rescue nil\n end\n when Range, Array\n range *range_pair(start)\n else\n []\n end\n end", "def query_lines(chr = nil, start = nil, stop = nil)\n raise EntryFileError, \"Tabix only supports queries with start AND stop\" if start and stop.nil?\n \n # If we're getting all entries, just use File#foreach\n if chr.nil?\n File.foreach(@data_file) { |line| yield line }\n # If we're getting a specific chromosome, use grep to filter the entries\n elsif start.nil? or stop.nil?\n File.grep(@data_file, chr) { |line| yield line }\n # If we're querying for a specific region, use Tabix to index the file\n else\n index() if not indexed?\n low = [start, stop].min\n high = [start, stop].max\n Tabix.query(@bgzipped_file, chr, low, high) { |line| yield line }\n end\n end", "def search_for_a_node_after_another( nokogiri_nodeset, first_key_word, last_key_word )\n matches_found = 0\n start_copy = false\n\n # Convert node content to text lines and scan them all:\n nokogiri_nodeset.text.split(\"\\n\").each do |line|\n\n # Search for a terminator key only if we have begun:\n if start_copy\n start_copy = false if !( line =~ /#{ last_key_word }/ui ).nil?\n # Increase sequences found on end copy:\n matches_found += 1 if !start_copy\n# DEBUG\n puts line if start_copy\n\n # Search for a start only if we haven't already found one:\n else\n start_copy = !( line =~ /#{ first_key_word }/ui ).nil?\n end\n end\n matches_found\n end", "def reachable_stops(initial_s)\n k = [initial_s, 0]\n examine(*k)\n @stops_from[k]\n end", "def find_between(start, stop)\n asteroids = Array.new\n File.open(@db_file, 'r').each do |line|\n arr = line.split(';')\n tmp = arr[0].to_i\n if ((tmp >= start) && (tmp <= stop) )\n resonance = arr[1].delete('[').delete(']').split(',').map{|x| x.to_f}\n asteroids.push(Asteroid.new(arr[0], resonance))\n end\n end\n asteroids\n end", "def initialize(start, stop)\n self.start = start\n self.stop = stop\n end", "def find(prefix)\n\t\tfound_entries = entries.select do |key, value|\n\t\t\tkey[0...prefix.length] == prefix\n\t\tend\n\tend", "def keyscan_stop\n\t\trequest = Packet.create_request('stdapi_ui_stop_keyscan')\n\t\tresponse = client.send_request(request)\n\t\treturn true\n\tend", "def get_stops (line, first_stop, last_stop)\n # puts \"line #{ line } stop #{ first_stop } -> stop #{ last_stop }\"\n first_index = lines[line.to_sym].index(first_stop)\n last_index = lines[line.to_sym].index(last_stop)\n if first_index <= last_index\n trip = lines[line.to_sym][first_index..last_index]\n else\n trip = lines[line.to_sym][last_index..first_index].reverse\n end\n trip.shift # remove first stop\n return trip\nend", "def remove_by_range(start=nil, stop=nil)\n if !start and !stop\n throw \"Must specify either start or stop\"\n end\n\n start = start ? \"(#{start}\" : '-inf'\n stop = stop ? \"#{stop}\" : \"+inf\"\n\n # Get the keys to delete from the hash\n keys = @index.range_by_score(start, stop)\n # Remove the keys from the index\n @index.delete_by_score(start, stop)\n # Remove the values from the hash\n multi do\n keys.each do |key|\n @hash.delete(key)\n end\n end\n\n self\n end", "def slice_from_start_and_length(start, length)\n result = []\n stop = start + length\n index = 0\n each do |item|\n break if index >= stop\n result << item if index >= start\n index += 1\n end\n result if index >= start\n end", "def cmd_keyscan_stop(*args)\n\t\tprint_line(\"Stopping the keystroke sniffer...\")\t\t\n\t\tclient.ui.keyscan_stop\n\t\treturn true\n\tend", "def knump (pattern, text, start, endpos, debug_trigger)\n\n debug = \"none\"\n\n if debug_trigger == true then\n debug = \"debug\"\n end\n\n if (!pattern) || (!text) then\n log(\"No pattern input or no string/file input.\", \"error\")\n return []\n end\n\n if pattern.length == 0 || text.length == 0 then\n log(\"Pattern or text of length zero.\", \"error\")\n return []\n end\n\n if pattern.length == 1 then\n log(\"Pattern is a single character. Using ordinary naive search.\", debug)\n return findchar(pattern, text, start, endpos)\n end\n\n if start >= endpos then\n if (pattern.length == 1) && (start == endpos) then\n if text[start] == pattern[0] then\n return [0]\n else\n log(\"Char in text differs from pattern char.\", debug)\n return []\n end\n end\n log(\"Start position is after end position. Seriously?\", debug)\n return []\n end\n\n if start < 0 || endpos >= text.length then\n log(\"Start position is less than zero or end position after last\\n\" +\n \"position in text (y u do dis... dolan pls)\", \"error\")\n return []\n end\n\n prefix = createPrefixTable(pattern)\n\n log(\"Prefix table created: [#{prefix}].\", debug)\n\n results = Array.new(0,0)\n\n iRes = 0\n iPat = 0 # position in pattern\n iPtx = 0 # position of pattern check in text\n iTex = start # position in text\n\n while true\n\n if iTex > endpos then\n log(\"Main loop reached end position: #{endpos}.\", debug)\n break\n end\n\n if text[iTex] != pattern[0] then\n iTex = iTex + 1\n else\n log(\"Partial match at: #{iTex}. Enter secondary loop.\", debug)\n iPtx = iTex\n iPat = 0\n\n while true\n\n if iPtx > endpos then\n log(\"Reached end at: #{endpos} during partial match.\", debug)\n return\n end\n\n if text[iPtx] == pattern[iPat] then\n iPtx = iPtx + 1\n iPat = iPat + 1\n else\n iPtx = iPtx + prefix[iPat]\n iPat = prefix[iPat]\n end\n\n if iPat >= pattern.length then\n results[iRes] = iTex\n iRes = iRes + 1\n iTex = iTex + prefix[iPat - 1] + 1\n log(\"We've got a match! Advance by #{iTex} and continue.\", debug)\n break\n end\n\n if iPat == 0 then\n log(\"We have reached root of pattern. Advance by 1.\", debug)\n iTex = iTex + 1\n break\n end\n\n end\n\n end\n end\n return results\nend", "def zrange(key, start, stop, options = {})\n send_cluster_command([:zrange, key, start, stop, options],\n master_only: false)\n end", "def find_by_prefix(start_key, reverse)\n dir = dir_for_reverse(reverse)\n x = anchor(reverse)\n # if no prefix given, just return a first node\n !start_key and return node_next(x, 0, dir)\n \n level = node_level(x)\n while level > 0\n level -= 1\n xnext = node_next(x, level, dir)\n if reverse\n # Note: correct key CAN be greater than start_key in this case \n # (like \"bb\" > \"b\", but \"b\" is a valid prefix for \"bb\")\n while node_compare2(xnext, start_key) > 0\n x = xnext\n xnext = node_next(x, level, dir)\n end\n else\n while node_compare(xnext, start_key) < 0\n x = xnext\n xnext = node_next(x, level, dir)\n end\n end\n end\n xnext == anchor(!reverse) and return nil\n node_key(xnext)[0, start_key.size] != start_key and return nil\n xnext\n end", "def subsequence(start, stop)\n \treturn self.seq.slice(start - 1, (stop - start) + 1)\n end", "def keys(*args)\n result = Utils::Queue.new\n\n if args.nil? or args.empty?\n node_keys(@root, result)\n else\n range_keys(@root, result, args[0], args[1])\n end\n\n result\n end", "def cmd_keyscan_stop(*args)\n\t\tprint_line(\"Stopping the keystroke sniffer...\")\n\t\tclient.ui.keyscan_stop\n\t\treturn true\n\tend", "def format_start_stop(start, stop)\n tmp_start = start\n tmp_stop = stop\n\n if start > stop\n tmp_start, tmp_stop = stop, start\n end\n return tmp_start, tmp_stop\n end", "def start(start_key)\n self.class.new(collection, range.merge({begin: start_key, begin_inclusive: true}))\n end", "def initialize(start=nil, stop=nil)\n @start = start\n @stop = stop\n end", "def scan_pause_all\r\n\t\tb=scan_list_uids\r\n\t\tb.each {|uuid|\r\n\t\t\tscan_pause(uuid)\r\n\t\t}\r\n\t\treturn b\r\n\tend", "def get_keys(start_date, end_date = nil)\n keys = []\n keys << get_key_for(start_date)\n unless end_date.nil?\n while start_date <= end_date\n start_date += 60*60\n keys << get_key_for(start_date) unless start_date > end_date\n end\n keys << get_key_for(end_date)\n end\n keys.uniq\n end", "def trip(line, start_stop, end_stop)\n trip_line = s_line(line)\n p trip_line\n start_index = trip_line.index(start_stop)\n end_index = trip_line.index(end_stop)\n stops = \"\"\n\n if start_index < end_index\n until start_index == end_index\n stops += trip_line[start_index]\n start_index += 1\n end\n else\n until start_index == end_index\n stops += trip_line[start_index]\n start_index -= 1\n end\n end\n return stops\nend", "def slice_of_css(start, stop)\n start == stop ? [start] : [start, *slice_of_css(start.next, stop)]\nend", "def find_start_and_finish\n grid.each_with_index do |row, row_idx|\n row.each_with_index do |spot, col_idx|\n if spot == START_MARK\n @start = [row_idx, col_idx]\n elsif spot == END_MARK\n @finish = [row_idx, col_idx]\n end\n end\n end\n end", "def get_range\n\t\tif params.has_key?(\"start\") and params.has_key?(\"end\")\n\t\t\tif params[\"end\"] == \"Z\"\n\t\t\t\t# had to do some hackish stuff to include Z\n\t\t\t\tfirst = AToZEntry.select(:topic, :id).where(topic: params[:start]..params[:end])\n\t\t\t\tprefix = 'Z'\n\t\t\t\tsecond = AToZEntry.select(:topic, :id).where(\"topic LIKE :prefix\", prefix: \"#{prefix}%\")\n\t\t\t\trespond({ status: 0, topics: first+second })\n\t\t\telse\n\t\t\t\trespond({ status: 0, topics: AToZEntry.select(:topic, :id).where(topic: params[:start]..params[:end]) })\n\t\t\tend\t\t\t\n\t\telse\n\t\t\trespond({ status: 1, error: \"Must supply :start and :end parameter.\" })\n\t\tend\t\n\tend", "def get_block_data(data, start_word, end_word, end_word_length)\n objects = []\n start_index = 0\n end_index = 0\n\n # this is a bit of cheesy... if someone knows a better way to do this?\n while(not start_index.nil? and not end_index.nil?) do\n start_index = data.index(start_word, end_index)\n\n unless(start_index.nil?)\n end_index = data.index(end_word, start_index)\n\n unless(end_index.nil?)\n objects.push(data.slice(start_index, end_index - start_index + end_word_length))\n end\n end\n end\n\n objects\n end", "def scan_pause_all\n\t\t\tb=scan_list_uids\n\t\t\tb.each {|uuid|\n\t\t\t\tscan_pause(uuid)\n\t\t\t}\n\t\t\treturn b\n\t\tend", "def zrevrange(key, start, stop, withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end", "def results(stop,start)\n hours = stop.hour - start.hour\n mins = stop.min - start.min\n secs = stop.sec - start.sec\n (mins = mins + 60) && (hours = hours - 1) if mins < 0\n (secs = secs + 60) && (mins = mins - 1) if secs < 0\n puts \"Done in #{hours}:#{mins}:#{secs}\"\n puts \"Got: #{Group.count} groups, #{Category.count} categories, #{Product.count} products\"\n end", "def list_trim(key, start, ending)\n timeout_retry(3, 3){\n write \"LTRIM #{key} #{start} #{ending}\\r\\n\"\n status_code_reply\n }\n end", "def starts_with(prefix)\n search_arr(prefix.chars)\n end", "def save_from_cache(start=nil, stop=nil)\n if start.nil? || stop.nil?\n start = Rails.cache.read(index_min, :raw => true).to_i\n stop = Rails.cache.read(index_max, :raw => true).to_i\n end\n \n t = start\n total = 0\n while t <= stop\n ck = cache_key_for_index(t)\n obj = load(ck)\n unless obj.nil?\n if obj.save!\n Rails.cache.delete(ck)\n total += 1\n end\n end\n \n t += 1\n Rails.cache.write(index_min, t, :raw => true)\n end\n \n total\n end", "def search_within_range(start_time, end_time)\n url = \"#{BASE_URL}\\?q\\=location:#{LOCATION}+created:#{start_time.iso8601}..#{end_time.iso8601}\"\n url = url + \"&access_token=#{ACCESS_TOKEN}\" if ACCESS_TOKEN # speed up if possible\n uri = URI(url)\n json = get_json_from_github(uri)\n\n # if total_count is larger than limit, do spliting\n if json['total_count'].to_i > API_SEARCH_LIMIT\n middle_time = (start_time.to_i + end_time.to_i)/2\n # binary search first part\n search_within_range(start_time, Time.at(middle_time).utc)\n # binary search second part\n search_within_range(Time.at(middle_time).utc, end_time)\n else\n # page through results\n end_page = json['total_count'].to_i/API_PAGE_LIMIT + 1\n\n (1..end_page).each do |page|\n url = \"#{BASE_URL}\\?q\\=location:#{LOCATION}+created:#{start_time.iso8601}..#{end_time.iso8601}&page=#{page}&per_page=#{API_PAGE_LIMIT}\"\n url = url + \"&access_token=#{ACCESS_TOKEN}\" if ACCESS_TOKEN\n uri = URI(url)\n json = get_json_from_github(uri)\n $sg_users.concat(json['items'])\n puts \"Added #{json['items'].size} users into list\"\n end\n end\nend", "def find_start(id, from)\n from= to_epoch(from)\n node = $devices[id].head\n while node.next do\n return node if node.value >= from\n node = node.next\n end\n return nil #from time not in list\nend", "def watch_frequency\n starts, ends = start_times, end_times\n start_index, end_index = 0, 0\n frequencies = []\n active_intervals = 0\n return [] if end_times.empty?\n (0..end_times.last).each do |video_time|\n start_advance = elements_till(starts, start_index) { |time| time <= video_time }\n end_advance = elements_till(ends, end_index) { |time| time < video_time }\n\n active_intervals += start_advance - end_advance\n start_index += start_advance\n end_index += end_advance\n\n frequencies << active_intervals\n end\n frequencies\n end", "def xrange(key, start = T.unsafe(nil), range_end = T.unsafe(nil), count: T.unsafe(nil)); end", "def scan_for_index_start_and_end(code, regex)\n res = []\n code.scan(regex) do\n res << {starts: Regexp.last_match.offset(0).first,\n ends: Regexp.last_match.offset(0).last}\n end\n res\nend", "def bsearch_range(range = 0...length, &block)\n lower = bsearch_lower_boundary(range, &block)\n upper = bsearch_upper_boundary(range, &block)\n lower...upper\n end", "def process(start, finish)\n # Clean up\n array.clear\n\n # Iterate\n start.upto(finish) do |n|\n if n % (first_number * second_number) == 0\n array << word1 + word2\n elsif n % first_number == 0\n array << word1\n elsif n % second_number == 0\n array << word2\n else\n array << n\n end\n end\n end", "def get_word_start_marks(startpos, endpos)\n startpos = 0 if startpos < 0\n endpos = self.size if endpos > self.size\n search_str = self[(startpos)..(endpos)]\n return if search_str == nil\n wsmarks = scan_indexes(search_str, /(?<=[^\\p{Word}])\\p{Word}/)\n wsmarks = wsmarks.collect { |x| x + startpos }\n return wsmarks\n end", "def range(start, stop)\n return [] if stop < start\n return [stop] if start == stop\n\n [start] + range(start+1, stop)\nend" ]
[ "0.69658834", "0.6588213", "0.65460145", "0.6499795", "0.6480413", "0.63850176", "0.63421845", "0.6323305", "0.62536657", "0.6246083", "0.6220278", "0.6220278", "0.59406996", "0.58991563", "0.58034974", "0.58034974", "0.5774559", "0.56819415", "0.566365", "0.55868757", "0.55603683", "0.5520712", "0.5520712", "0.5428054", "0.5418672", "0.53843683", "0.537078", "0.53239363", "0.53211796", "0.53211385", "0.5297942", "0.52845526", "0.52677935", "0.5247406", "0.5217247", "0.52098787", "0.5163283", "0.5148402", "0.51416594", "0.5117558", "0.50805587", "0.50790685", "0.50766426", "0.50766426", "0.50740093", "0.50607365", "0.50553805", "0.50451165", "0.50439125", "0.5017254", "0.5009185", "0.5006368", "0.49884084", "0.4983694", "0.49795818", "0.497714", "0.49717724", "0.4957082", "0.49494475", "0.492379", "0.49101442", "0.49091384", "0.49031246", "0.49005562", "0.4897126", "0.4896627", "0.4889853", "0.48862424", "0.48821878", "0.48786008", "0.4866631", "0.48528633", "0.48433307", "0.48327628", "0.4828733", "0.4827921", "0.48258647", "0.48237962", "0.48215234", "0.4820304", "0.48148245", "0.4811982", "0.48056757", "0.47867668", "0.47811332", "0.47706053", "0.4748241", "0.47417602", "0.47408655", "0.4736504", "0.47329992", "0.47216427", "0.47067288", "0.46995032", "0.46977606", "0.46964005", "0.46824512", "0.46784386", "0.46696186", "0.46679765" ]
0.6968575
0
Scans keys between `start` and `stop`.
def scan(start, stop, opts = {}) limit = opts[:limit] || -1 mon_synchronize do perform ["scan", start, stop, limit], :multi => true, :proc => T_STRSTR end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keys(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"keys\", start, stop, limit], :multi => true\n end\n end", "def keys(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"keys\", start, stop, limit], multi: true\n end\n end", "def zscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zscan\", key, BLANK, start, stop, limit], multi: true, proc: T_STRINT\n end\n end", "def zscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zscan\", key, BLANK, start, stop, limit], :multi => true, :proc => T_STRINT\n end\n end", "def zrscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zrscan\", key, BLANK, start, stop, limit], multi: true, proc: T_STRINT\n end\n end", "def zrscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zrscan\", key, BLANK, start, stop, limit], :multi => true, :proc => T_STRINT\n end\n end", "def scan(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"scan\", start, stop, limit], multi: true, proc: T_STRSTR\n end\n end", "def search(start_key, end_key, limit, offset, reverse, with_keys)\n offset ||= 0\n \n start_node = find_by_prefix(start_key, reverse)\n !start_node and return []\n \n start_node = skip_nodes(start_node, offset, reverse)\n !start_node and return []\n \n collect_values(start_node, end_key, limit, reverse, with_keys)\n end", "def zkeys(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zkeys\", key, BLANK, start, stop, limit], :multi => true\n end\n end", "def zkeys(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zkeys\", key, BLANK, start, stop, limit], multi: true\n end\n end", "def getrange(key, start, stop); end", "def getrange(key, start, stop); end", "def work!\n (@start..@stop).each {|i| return if $found; d = $data[i]; $found = true and puts \"Found #{d}\" if d == $search_key }\n end", "def range(start, stop)\n fetch(redis.zrange(key, start, stop))\n end", "def lrange(key, start, stop); end", "def lrange(key, start, stop); end", "def zrange(key, start, stop, **options); end", "def rscan(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"rscan\", start, stop, limit], multi: true, proc: T_STRSTR\n end\n end", "def rscan(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"rscan\", start, stop, limit], :multi => true, :proc => T_STRSTR\n end\n end", "def getrange(key, start, stop)\n send_command([:getrange, key, Integer(start), Integer(stop)])\n end", "def range(start, stop)\n fetch(key.call(\"LRANGE\", start, stop))\n end", "def find_line(lines, stop)\n\tlines.each_pair { |key, line| return key if line.include?(stop) }\nend", "def find_line(lines, stop)\n\tlines.each_pair { |key, line| return key if line.include?(stop) }\nend", "def lrange(key, start, stop)\n send_command([:lrange, key, Integer(start), Integer(stop)])\n end", "def zscan(key, cursor, **options); end", "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", "def find_middle(start, stop)\n index = ((stop - start) / 2) + start\n time = time_at(index)\n [index, time]\n end", "def zrange(key, start, stop, byscore: T.unsafe(nil), by_score: T.unsafe(nil), bylex: T.unsafe(nil), by_lex: T.unsafe(nil), rev: T.unsafe(nil), limit: T.unsafe(nil), withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end", "def getrange(key, start, stop)\n node_for(key).getrange(key, start, stop)\n end", "def find_in_range *args\n if args[0].respond_to?(:first) && args[0].respond_to?(:last)\n\tt_start = args[0].first\n\tt_end = args[0].last\n else\n\tt_start = args[0]\n\tt_end = args[1]\n end\n opts = args.last if args.last.respond_to?(:keys)\n if opts\n\tlimit = opts[:limit]\n end\n result = []\n count = 1\n loop do\n rnext = find_next t_start\n break if count > limit if limit\n\tbreak if rnext > t_end\n result << rnext\n t_start = rnext + 1\n\tcount += 1\n end\n result\n end", "def scan_stop_all\n\t\t\tb=scan_list_uids\n\t\t\tb.each {|uuid|\n\t\t\t\tscan_stop(uuid)\n\t\t\t}\n\t\t\treturn b\n\t\tend", "def find(from, to)\n return unless valid_start_end?(from, to)\n\n horiz_traverse = go_horizontal(from, to)\n return horiz_traverse if valid_cycle?(horiz_traverse)\n vert_traverse = go_vertical(from, to)\n return vert_traverse if valid_cycle?(vert_traverse)\n end", "def lrange(key, start, stop)\n node_for(key).lrange(key, start, stop)\n end", "def zscan_each(key, **options, &block); end", "def scan_stop_all\r\n\t\tb=scan_list_uids\r\n\t\tb.each {|uuid|\r\n\t\t\tscan_stop(uuid)\r\n\t\t}\r\n\t\treturn b\r\n\tend", "def find(boundary,value,start,stop)\n return start if start == stop\n mid_index, mid_time = find_middle(start,stop)\n # puts \"+ find_#{boundary} (#{value}, #{start}, #{stop}) [mid_index #{mid_index}:#{mid_time}]\"\n if mid_time == value\n find_adjacent(boundary,value,start,stop,mid_index)\n elsif mid_time > value\n mid_index -= 1 if mid_index == stop\n find(boundary, value, start, mid_index)\n elsif mid_time < value\n mid_index += 1 if mid_index == start\n find(boundary, value, mid_index, stop)\n end\n end", "def cmd_keyscan_start(*args)\n\t\tprint_line(\"Starting the keystroke sniffer...\")\t\n\t\tclient.ui.keyscan_start\n\t\treturn true\n\tend", "def startstop minsize=30\n stopstop(minsize).find_all { | orf | \n codon1= orf.nt.seq[0..2].upcase\n ['ATG','TTG','CTG','AUG','UUG','CUG'].index(codon1) != nil\n }\n end", "def cmd_keyscan_start(*args)\n\t\tprint_line(\"Starting the keystroke sniffer...\")\n\t\tclient.ui.keyscan_start\n\t\treturn true\n\tend", "def zrange(key, start, stop, **options)\n node_for(key).zrange(key, start, stop, **options)\n end", "def get_set(start, finish, interval)\n cur_val = start; result = []\n while(cur_val < finish)\n result << cur_val\n cur_val += interval\n end\n result\n end", "def zrange(key, start, stop, options = {})\n args = [:zrange, key, start, stop]\n\n if options[:withscores]\n args << 'WITHSCORES'\n block = Redis::FloatifyPairs\n end\n\n call(key, args, transform: block, read: true)\n end", "def ltrim(key, start, stop); end", "def ltrim(key, start, stop); end", "def start(start_key)\n KeyValueList.new(self).start(start_key)\n end", "def list_range(key, start, ending)\n timeout_retry(3, 3){\n write \"LRANGE #{key} #{start} #{ending}\\r\\n\"\n multi_bulk_reply\n }\n end", "def preorder_search(start, find_val)\n false\n end", "def zrange(key, start, stop, options = {})\n send_cluster_command([:zrange, key, start, stop, options])\n end", "def get_path_by_names(start, stop)\n s1 = get_node(start)\n s2 = get_node(stop)\n if s1 != nil && s2 != nil\n return get_path(s1, s2)\n end\n Array.new \n end", "def keyscan_start\n\t\trequest = Packet.create_request('stdapi_ui_start_keyscan')\n\t\tresponse = client.send_request(request)\n\t\treturn true\n\tend", "def query_hash_range(key, start, count, step_size, ts_index, ts_size = 2)\n hash = make_redis_hash(start, count, step_size, ts_index, ts_size)\n\n ckey = convert_keys(key)\n node = @root[ckey]\n\n keys = hash.to_a.sort_by { |it| it[0] }\n mres = @redis.pipelined do\n keys.each do |key, values|\n node[key].hmget(*values)\n end\n end\n\n mres.flatten.collect(&:to_i)\n end", "def zrevrange(key, start, stop, **options); end", "def each_search_term(starting_term = nil)\n alpha_terms(starting_term).each { |t| yield t if block_given? }\n end", "def resume_loop(resumes)\n resumes.each do |r|\n keyword_search(r)\n end\nend", "def find_moves(start, target)\n visited = breadth_first_search(start, target)\n moves = []\n find_coordinate = target\n visited.reverse.each do |vertex|\n vertex.neighbors.each do |coordinate|\n if coordinate == find_coordinate\n moves << vertex.key\n find_coordinate = vertex.key\n end\n end\n end\n moves.reverse << target\n end", "def between from_key, to_key\n from(from_key).to(to_key, inclusive: true)\n end", "def search(pattern)\n # Initialize loop variables\n cursor = nil\n list = []\n\n # Scan and capture matching keys\n client.with do |conn|\n while cursor != 0\n scan = conn.scan(cursor || 0, match: pattern)\n list += scan[1]\n cursor = scan[0].to_i\n end\n end\n\n list\n end", "def slice(start, length = nil)\n case start\n when Integer\n if length\n range(start, start + length - 1)\n else\n conn.lindex(key, start) rescue nil\n end\n when Range, Array\n range *range_pair(start)\n else\n []\n end\n end", "def query_lines(chr = nil, start = nil, stop = nil)\n raise EntryFileError, \"Tabix only supports queries with start AND stop\" if start and stop.nil?\n \n # If we're getting all entries, just use File#foreach\n if chr.nil?\n File.foreach(@data_file) { |line| yield line }\n # If we're getting a specific chromosome, use grep to filter the entries\n elsif start.nil? or stop.nil?\n File.grep(@data_file, chr) { |line| yield line }\n # If we're querying for a specific region, use Tabix to index the file\n else\n index() if not indexed?\n low = [start, stop].min\n high = [start, stop].max\n Tabix.query(@bgzipped_file, chr, low, high) { |line| yield line }\n end\n end", "def search_for_a_node_after_another( nokogiri_nodeset, first_key_word, last_key_word )\n matches_found = 0\n start_copy = false\n\n # Convert node content to text lines and scan them all:\n nokogiri_nodeset.text.split(\"\\n\").each do |line|\n\n # Search for a terminator key only if we have begun:\n if start_copy\n start_copy = false if !( line =~ /#{ last_key_word }/ui ).nil?\n # Increase sequences found on end copy:\n matches_found += 1 if !start_copy\n# DEBUG\n puts line if start_copy\n\n # Search for a start only if we haven't already found one:\n else\n start_copy = !( line =~ /#{ first_key_word }/ui ).nil?\n end\n end\n matches_found\n end", "def reachable_stops(initial_s)\n k = [initial_s, 0]\n examine(*k)\n @stops_from[k]\n end", "def find_between(start, stop)\n asteroids = Array.new\n File.open(@db_file, 'r').each do |line|\n arr = line.split(';')\n tmp = arr[0].to_i\n if ((tmp >= start) && (tmp <= stop) )\n resonance = arr[1].delete('[').delete(']').split(',').map{|x| x.to_f}\n asteroids.push(Asteroid.new(arr[0], resonance))\n end\n end\n asteroids\n end", "def initialize(start, stop)\n self.start = start\n self.stop = stop\n end", "def find(prefix)\n\t\tfound_entries = entries.select do |key, value|\n\t\t\tkey[0...prefix.length] == prefix\n\t\tend\n\tend", "def get_stops (line, first_stop, last_stop)\n # puts \"line #{ line } stop #{ first_stop } -> stop #{ last_stop }\"\n first_index = lines[line.to_sym].index(first_stop)\n last_index = lines[line.to_sym].index(last_stop)\n if first_index <= last_index\n trip = lines[line.to_sym][first_index..last_index]\n else\n trip = lines[line.to_sym][last_index..first_index].reverse\n end\n trip.shift # remove first stop\n return trip\nend", "def keyscan_stop\n\t\trequest = Packet.create_request('stdapi_ui_stop_keyscan')\n\t\tresponse = client.send_request(request)\n\t\treturn true\n\tend", "def remove_by_range(start=nil, stop=nil)\n if !start and !stop\n throw \"Must specify either start or stop\"\n end\n\n start = start ? \"(#{start}\" : '-inf'\n stop = stop ? \"#{stop}\" : \"+inf\"\n\n # Get the keys to delete from the hash\n keys = @index.range_by_score(start, stop)\n # Remove the keys from the index\n @index.delete_by_score(start, stop)\n # Remove the values from the hash\n multi do\n keys.each do |key|\n @hash.delete(key)\n end\n end\n\n self\n end", "def slice_from_start_and_length(start, length)\n result = []\n stop = start + length\n index = 0\n each do |item|\n break if index >= stop\n result << item if index >= start\n index += 1\n end\n result if index >= start\n end", "def cmd_keyscan_stop(*args)\n\t\tprint_line(\"Stopping the keystroke sniffer...\")\t\t\n\t\tclient.ui.keyscan_stop\n\t\treturn true\n\tend", "def knump (pattern, text, start, endpos, debug_trigger)\n\n debug = \"none\"\n\n if debug_trigger == true then\n debug = \"debug\"\n end\n\n if (!pattern) || (!text) then\n log(\"No pattern input or no string/file input.\", \"error\")\n return []\n end\n\n if pattern.length == 0 || text.length == 0 then\n log(\"Pattern or text of length zero.\", \"error\")\n return []\n end\n\n if pattern.length == 1 then\n log(\"Pattern is a single character. Using ordinary naive search.\", debug)\n return findchar(pattern, text, start, endpos)\n end\n\n if start >= endpos then\n if (pattern.length == 1) && (start == endpos) then\n if text[start] == pattern[0] then\n return [0]\n else\n log(\"Char in text differs from pattern char.\", debug)\n return []\n end\n end\n log(\"Start position is after end position. Seriously?\", debug)\n return []\n end\n\n if start < 0 || endpos >= text.length then\n log(\"Start position is less than zero or end position after last\\n\" +\n \"position in text (y u do dis... dolan pls)\", \"error\")\n return []\n end\n\n prefix = createPrefixTable(pattern)\n\n log(\"Prefix table created: [#{prefix}].\", debug)\n\n results = Array.new(0,0)\n\n iRes = 0\n iPat = 0 # position in pattern\n iPtx = 0 # position of pattern check in text\n iTex = start # position in text\n\n while true\n\n if iTex > endpos then\n log(\"Main loop reached end position: #{endpos}.\", debug)\n break\n end\n\n if text[iTex] != pattern[0] then\n iTex = iTex + 1\n else\n log(\"Partial match at: #{iTex}. Enter secondary loop.\", debug)\n iPtx = iTex\n iPat = 0\n\n while true\n\n if iPtx > endpos then\n log(\"Reached end at: #{endpos} during partial match.\", debug)\n return\n end\n\n if text[iPtx] == pattern[iPat] then\n iPtx = iPtx + 1\n iPat = iPat + 1\n else\n iPtx = iPtx + prefix[iPat]\n iPat = prefix[iPat]\n end\n\n if iPat >= pattern.length then\n results[iRes] = iTex\n iRes = iRes + 1\n iTex = iTex + prefix[iPat - 1] + 1\n log(\"We've got a match! Advance by #{iTex} and continue.\", debug)\n break\n end\n\n if iPat == 0 then\n log(\"We have reached root of pattern. Advance by 1.\", debug)\n iTex = iTex + 1\n break\n end\n\n end\n\n end\n end\n return results\nend", "def zrange(key, start, stop, options = {})\n send_cluster_command([:zrange, key, start, stop, options],\n master_only: false)\n end", "def find_by_prefix(start_key, reverse)\n dir = dir_for_reverse(reverse)\n x = anchor(reverse)\n # if no prefix given, just return a first node\n !start_key and return node_next(x, 0, dir)\n \n level = node_level(x)\n while level > 0\n level -= 1\n xnext = node_next(x, level, dir)\n if reverse\n # Note: correct key CAN be greater than start_key in this case \n # (like \"bb\" > \"b\", but \"b\" is a valid prefix for \"bb\")\n while node_compare2(xnext, start_key) > 0\n x = xnext\n xnext = node_next(x, level, dir)\n end\n else\n while node_compare(xnext, start_key) < 0\n x = xnext\n xnext = node_next(x, level, dir)\n end\n end\n end\n xnext == anchor(!reverse) and return nil\n node_key(xnext)[0, start_key.size] != start_key and return nil\n xnext\n end", "def subsequence(start, stop)\n \treturn self.seq.slice(start - 1, (stop - start) + 1)\n end", "def keys(*args)\n result = Utils::Queue.new\n\n if args.nil? or args.empty?\n node_keys(@root, result)\n else\n range_keys(@root, result, args[0], args[1])\n end\n\n result\n end", "def format_start_stop(start, stop)\n tmp_start = start\n tmp_stop = stop\n\n if start > stop\n tmp_start, tmp_stop = stop, start\n end\n return tmp_start, tmp_stop\n end", "def cmd_keyscan_stop(*args)\n\t\tprint_line(\"Stopping the keystroke sniffer...\")\n\t\tclient.ui.keyscan_stop\n\t\treturn true\n\tend", "def start(start_key)\n self.class.new(collection, range.merge({begin: start_key, begin_inclusive: true}))\n end", "def initialize(start=nil, stop=nil)\n @start = start\n @stop = stop\n end", "def scan_pause_all\r\n\t\tb=scan_list_uids\r\n\t\tb.each {|uuid|\r\n\t\t\tscan_pause(uuid)\r\n\t\t}\r\n\t\treturn b\r\n\tend", "def get_keys(start_date, end_date = nil)\n keys = []\n keys << get_key_for(start_date)\n unless end_date.nil?\n while start_date <= end_date\n start_date += 60*60\n keys << get_key_for(start_date) unless start_date > end_date\n end\n keys << get_key_for(end_date)\n end\n keys.uniq\n end", "def trip(line, start_stop, end_stop)\n trip_line = s_line(line)\n p trip_line\n start_index = trip_line.index(start_stop)\n end_index = trip_line.index(end_stop)\n stops = \"\"\n\n if start_index < end_index\n until start_index == end_index\n stops += trip_line[start_index]\n start_index += 1\n end\n else\n until start_index == end_index\n stops += trip_line[start_index]\n start_index -= 1\n end\n end\n return stops\nend", "def slice_of_css(start, stop)\n start == stop ? [start] : [start, *slice_of_css(start.next, stop)]\nend", "def find_start_and_finish\n grid.each_with_index do |row, row_idx|\n row.each_with_index do |spot, col_idx|\n if spot == START_MARK\n @start = [row_idx, col_idx]\n elsif spot == END_MARK\n @finish = [row_idx, col_idx]\n end\n end\n end\n end", "def get_range\n\t\tif params.has_key?(\"start\") and params.has_key?(\"end\")\n\t\t\tif params[\"end\"] == \"Z\"\n\t\t\t\t# had to do some hackish stuff to include Z\n\t\t\t\tfirst = AToZEntry.select(:topic, :id).where(topic: params[:start]..params[:end])\n\t\t\t\tprefix = 'Z'\n\t\t\t\tsecond = AToZEntry.select(:topic, :id).where(\"topic LIKE :prefix\", prefix: \"#{prefix}%\")\n\t\t\t\trespond({ status: 0, topics: first+second })\n\t\t\telse\n\t\t\t\trespond({ status: 0, topics: AToZEntry.select(:topic, :id).where(topic: params[:start]..params[:end]) })\n\t\t\tend\t\t\t\n\t\telse\n\t\t\trespond({ status: 1, error: \"Must supply :start and :end parameter.\" })\n\t\tend\t\n\tend", "def get_block_data(data, start_word, end_word, end_word_length)\n objects = []\n start_index = 0\n end_index = 0\n\n # this is a bit of cheesy... if someone knows a better way to do this?\n while(not start_index.nil? and not end_index.nil?) do\n start_index = data.index(start_word, end_index)\n\n unless(start_index.nil?)\n end_index = data.index(end_word, start_index)\n\n unless(end_index.nil?)\n objects.push(data.slice(start_index, end_index - start_index + end_word_length))\n end\n end\n end\n\n objects\n end", "def scan_pause_all\n\t\t\tb=scan_list_uids\n\t\t\tb.each {|uuid|\n\t\t\t\tscan_pause(uuid)\n\t\t\t}\n\t\t\treturn b\n\t\tend", "def zrevrange(key, start, stop, withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end", "def results(stop,start)\n hours = stop.hour - start.hour\n mins = stop.min - start.min\n secs = stop.sec - start.sec\n (mins = mins + 60) && (hours = hours - 1) if mins < 0\n (secs = secs + 60) && (mins = mins - 1) if secs < 0\n puts \"Done in #{hours}:#{mins}:#{secs}\"\n puts \"Got: #{Group.count} groups, #{Category.count} categories, #{Product.count} products\"\n end", "def list_trim(key, start, ending)\n timeout_retry(3, 3){\n write \"LTRIM #{key} #{start} #{ending}\\r\\n\"\n status_code_reply\n }\n end", "def starts_with(prefix)\n search_arr(prefix.chars)\n end", "def save_from_cache(start=nil, stop=nil)\n if start.nil? || stop.nil?\n start = Rails.cache.read(index_min, :raw => true).to_i\n stop = Rails.cache.read(index_max, :raw => true).to_i\n end\n \n t = start\n total = 0\n while t <= stop\n ck = cache_key_for_index(t)\n obj = load(ck)\n unless obj.nil?\n if obj.save!\n Rails.cache.delete(ck)\n total += 1\n end\n end\n \n t += 1\n Rails.cache.write(index_min, t, :raw => true)\n end\n \n total\n end", "def search_within_range(start_time, end_time)\n url = \"#{BASE_URL}\\?q\\=location:#{LOCATION}+created:#{start_time.iso8601}..#{end_time.iso8601}\"\n url = url + \"&access_token=#{ACCESS_TOKEN}\" if ACCESS_TOKEN # speed up if possible\n uri = URI(url)\n json = get_json_from_github(uri)\n\n # if total_count is larger than limit, do spliting\n if json['total_count'].to_i > API_SEARCH_LIMIT\n middle_time = (start_time.to_i + end_time.to_i)/2\n # binary search first part\n search_within_range(start_time, Time.at(middle_time).utc)\n # binary search second part\n search_within_range(Time.at(middle_time).utc, end_time)\n else\n # page through results\n end_page = json['total_count'].to_i/API_PAGE_LIMIT + 1\n\n (1..end_page).each do |page|\n url = \"#{BASE_URL}\\?q\\=location:#{LOCATION}+created:#{start_time.iso8601}..#{end_time.iso8601}&page=#{page}&per_page=#{API_PAGE_LIMIT}\"\n url = url + \"&access_token=#{ACCESS_TOKEN}\" if ACCESS_TOKEN\n uri = URI(url)\n json = get_json_from_github(uri)\n $sg_users.concat(json['items'])\n puts \"Added #{json['items'].size} users into list\"\n end\n end\nend", "def find_start(id, from)\n from= to_epoch(from)\n node = $devices[id].head\n while node.next do\n return node if node.value >= from\n node = node.next\n end\n return nil #from time not in list\nend", "def watch_frequency\n starts, ends = start_times, end_times\n start_index, end_index = 0, 0\n frequencies = []\n active_intervals = 0\n return [] if end_times.empty?\n (0..end_times.last).each do |video_time|\n start_advance = elements_till(starts, start_index) { |time| time <= video_time }\n end_advance = elements_till(ends, end_index) { |time| time < video_time }\n\n active_intervals += start_advance - end_advance\n start_index += start_advance\n end_index += end_advance\n\n frequencies << active_intervals\n end\n frequencies\n end", "def xrange(key, start = T.unsafe(nil), range_end = T.unsafe(nil), count: T.unsafe(nil)); end", "def scan_for_index_start_and_end(code, regex)\n res = []\n code.scan(regex) do\n res << {starts: Regexp.last_match.offset(0).first,\n ends: Regexp.last_match.offset(0).last}\n end\n res\nend", "def bsearch_range(range = 0...length, &block)\n lower = bsearch_lower_boundary(range, &block)\n upper = bsearch_upper_boundary(range, &block)\n lower...upper\n end", "def process(start, finish)\n # Clean up\n array.clear\n\n # Iterate\n start.upto(finish) do |n|\n if n % (first_number * second_number) == 0\n array << word1 + word2\n elsif n % first_number == 0\n array << word1\n elsif n % second_number == 0\n array << word2\n else\n array << n\n end\n end\n end", "def get_word_start_marks(startpos, endpos)\n startpos = 0 if startpos < 0\n endpos = self.size if endpos > self.size\n search_str = self[(startpos)..(endpos)]\n return if search_str == nil\n wsmarks = scan_indexes(search_str, /(?<=[^\\p{Word}])\\p{Word}/)\n wsmarks = wsmarks.collect { |x| x + startpos }\n return wsmarks\n end", "def range(start, stop)\n return [] if stop < start\n return [stop] if start == stop\n\n [start] + range(start+1, stop)\nend" ]
[ "0.69682497", "0.69654435", "0.6587442", "0.65453506", "0.64993894", "0.6480091", "0.6383795", "0.6323831", "0.6253944", "0.62462723", "0.62212807", "0.62212807", "0.5940966", "0.58998716", "0.58039916", "0.58039916", "0.57751137", "0.56811994", "0.56630427", "0.5586962", "0.5561052", "0.5522456", "0.5522456", "0.5428385", "0.54186434", "0.53849536", "0.53720194", "0.5323909", "0.53221273", "0.53216356", "0.5298722", "0.52848417", "0.52690184", "0.52480173", "0.5218017", "0.5211217", "0.5162608", "0.5149543", "0.51409346", "0.5118466", "0.5080274", "0.50797564", "0.5077254", "0.5077254", "0.50749", "0.50608283", "0.50566274", "0.504551", "0.5045157", "0.5016417", "0.5009144", "0.50072974", "0.4989016", "0.49844167", "0.4980191", "0.49774975", "0.4971669", "0.49577227", "0.49498776", "0.4925154", "0.49126825", "0.4908999", "0.490405", "0.49019065", "0.48981667", "0.4897207", "0.48901492", "0.48872504", "0.4882317", "0.48777544", "0.48670614", "0.48554543", "0.48438808", "0.48327813", "0.48295513", "0.482886", "0.48265985", "0.48250324", "0.48201963", "0.48197332", "0.48159415", "0.4812518", "0.48062006", "0.47868556", "0.47811472", "0.47691908", "0.47488236", "0.47423378", "0.47409916", "0.47370297", "0.47329718", "0.47217032", "0.47078735", "0.46991825", "0.4697156", "0.4696801", "0.46832362", "0.46783432", "0.46701205", "0.46685925" ]
0.6341124
7
Reversescans keys between `start` and `stop`.
def rscan(start, stop, opts = {}) limit = opts[:limit] || -1 mon_synchronize do perform ["rscan", start, stop, limit], :multi => true, :proc => T_STRSTR end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zrevrange(key, start, stop, **options); end", "def zrevrange(key, start, stop, **options)\n node_for(key).zrevrange(key, start, stop, **options)\n end", "def zrevrange(key, start, stop, options = {})\n args = [:zrevrange, key, start, stop]\n\n if options[:withscores]\n args << 'WITHSCORES'\n block = Redis::FloatifyPairs\n end\n\n call(key, args, transform: block, read: true)\n end", "def zrevrange(key, start, stop, withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end", "def zscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zscan\", key, BLANK, start, stop, limit], multi: true, proc: T_STRINT\n end\n end", "def zrscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zrscan\", key, BLANK, start, stop, limit], multi: true, proc: T_STRINT\n end\n end", "def zremrangebyrank(key, start, stop); end", "def zremrangebyrank(key, start, stop); end", "def zscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zscan\", key, BLANK, start, stop, limit], :multi => true, :proc => T_STRINT\n end\n end", "def zrscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zrscan\", key, BLANK, start, stop, limit], :multi => true, :proc => T_STRINT\n end\n end", "def zremrangebyrank(key, start, stop)\n node_for(key).zremrangebyrank(key, start, stop)\n end", "def zremrangebyrank(key, start, stop)\n call(key, [:zremrangebyrank, key, start, stop])\n end", "def switch_keys_if_descending!(result)\n if result[:descending]\n startkey = result.delete(:startkey)\n endkey = result.delete(:endkey)\n result[:startkey] = endkey unless endkey.nil?\n result[:endkey] = startkey unless startkey.nil?\n end\n end", "def xrevrange(key, range_end = T.unsafe(nil), start = T.unsafe(nil), count: T.unsafe(nil)); end", "def range(start, stop)\n fetch(redis.zrange(key, start, stop))\n end", "def zrange(key, start, stop, byscore: T.unsafe(nil), by_score: T.unsafe(nil), bylex: T.unsafe(nil), by_lex: T.unsafe(nil), rev: T.unsafe(nil), limit: T.unsafe(nil), withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end", "def zrange(key, start, stop, **options); end", "def remove_by_range(start=nil, stop=nil)\n if !start and !stop\n throw \"Must specify either start or stop\"\n end\n\n start = start ? \"(#{start}\" : '-inf'\n stop = stop ? \"#{stop}\" : \"+inf\"\n\n # Get the keys to delete from the hash\n keys = @index.range_by_score(start, stop)\n # Remove the keys from the index\n @index.delete_by_score(start, stop)\n # Remove the values from the hash\n multi do\n keys.each do |key|\n @hash.delete(key)\n end\n end\n\n self\n end", "def zkeys(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zkeys\", key, BLANK, start, stop, limit], multi: true\n end\n end", "def rscan(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"rscan\", start, stop, limit], multi: true, proc: T_STRSTR\n end\n end", "def xrevrange(key, range_end = '+', start = '-', count: nil)\n args = [:xrevrange, key, range_end, start]\n args.concat(['COUNT', count]) if count\n send_command(args, &HashifyStreamEntries)\n end", "def zkeys(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zkeys\", key, BLANK, start, stop, limit], :multi => true\n end\n end", "def zrange(key, start, stop, options = {})\n args = [:zrange, key, start, stop]\n\n if options[:withscores]\n args << 'WITHSCORES'\n block = Redis::FloatifyPairs\n end\n\n call(key, args, transform: block, read: true)\n end", "def zremrangebyrank(key, start, stop)\n send_cluster_command([:zremrangebyrank, key, start, stop])\n end", "def zremrangebyrank(key, start, stop)\n send_cluster_command([:zremrangebyrank, key, start, stop])\n end", "def zrange(key, start, stop, **options)\n node_for(key).zrange(key, start, stop, **options)\n end", "def ltrim(key, start, stop); end", "def ltrim(key, start, stop); end", "def reverse_word(start_i, end_i, all_words)\n while start_i < end_i\n temp = all_words[start_i]\n all_words[start_i] = all_words[end_i]\n all_words[end_i] = temp\n start_i += 1\n end_i -= 1\n end\n return all_words\nend", "def zrange(key, start, stop, options = {})\n send_cluster_command([:zrange, key, start, stop, options])\n end", "def reverse(my_words, start_index, end_index)\n while start_index < end_index\n temp = my_words[start_index]\n my_words[start_index] = my_words[end_index]\n my_words[end_index] = temp\n start_index += 1\n end_index -= 1\n end\n return my_words\nend", "def descending\n swap(:startkey, :endkey) if query[:startkey] || query[:endkey]\n swap(:startkey_docid, :endkey_docid) if query[:startkey_docid] || query[:endkey_docid]\n\n update_query(:descending => true)\n end", "def zrangestore(dest_key, src_key, start, stop, byscore: T.unsafe(nil), by_score: T.unsafe(nil), bylex: T.unsafe(nil), by_lex: T.unsafe(nil), rev: T.unsafe(nil), limit: T.unsafe(nil)); end", "def rindex(loc, stop=99) end", "def lrange(key, start, stop); end", "def lrange(key, start, stop); end", "def zrange(key, start, stop, options = {})\n send_cluster_command([:zrange, key, start, stop, options],\n master_only: false)\n end", "def get_users_stops_by_line(line,origin_stop,destination_stop)\n # stop_list is an array which is line details\n stop_list = get_stop_details(line)\n origin_stop_index = stop_list.index(origin_stop)\n destination_stop_index = stop_list.index(destination_stop)\n\n if origin_stop_index < destination_stop_index\n stop_list[origin_stop_index + 1..destination_stop_index]\n\n else\n stop_list[destination_stop_index..origin_stop_index - 1].reverse()\n end\n end", "def zrangestore(dest_key, src_key, start, stop, **options); end", "def keys(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"keys\", start, stop, limit], multi: true\n end\n end", "def keys(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"keys\", start, stop, limit], :multi => true\n end\n end", "def down!(origin, stop)\n x = origin.row\n\n while x <= stop.row\n add_result extract!(IndexPath[x, origin.column])\n\n x += 1\n end\n\n # Begin moving left from the end of this row\n starts_at = IndexPath[stop.row, stop.column - 1]\n ends_at = IndexPath[stop.row, max_columns - stop.column]\n\n left!(starts_at, ends_at)\n end", "def getrange(key, start, stop); end", "def getrange(key, start, stop); end", "def get_stops (line, first_stop, last_stop)\n # puts \"line #{ line } stop #{ first_stop } -> stop #{ last_stop }\"\n first_index = lines[line.to_sym].index(first_stop)\n last_index = lines[line.to_sym].index(last_stop)\n if first_index <= last_index\n trip = lines[line.to_sym][first_index..last_index]\n else\n trip = lines[line.to_sym][last_index..first_index].reverse\n end\n trip.shift # remove first stop\n return trip\nend", "def save_from_cache(start=nil, stop=nil)\n if start.nil? || stop.nil?\n start = Rails.cache.read(index_min, :raw => true).to_i\n stop = Rails.cache.read(index_max, :raw => true).to_i\n end\n \n t = start\n total = 0\n while t <= stop\n ck = cache_key_for_index(t)\n obj = load(ck)\n unless obj.nil?\n if obj.save!\n Rails.cache.delete(ck)\n total += 1\n end\n end\n \n t += 1\n Rails.cache.write(index_min, t, :raw => true)\n end\n \n total\n end", "def range(start, stop)\n fetch(key.call(\"LRANGE\", start, stop))\n end", "def rslice(range, options = {})\n start, finish = range_pair(range)\n fetch_range :zrevrange, start, finish, options\n end", "def stopGetter(stop_1, stop_2, line)\n if stop_1 > stop_2\n return line[stop_2..stop_1].reverse!\n else\n return line[stop_1..stop_2]\n end\nend", "def remove_range(from = '-inf', to = '+inf')\n connection.zremrangebyscore(key_label, from, to)\n end", "def move_subway start_stop, end_stop, line\n if start_stop > end_stop\n subway_stops = line[end_stop..start_stop - 1].reverse\n else\n subway_stops = line[start_stop + 1..end_stop]\n end\nend", "def ltrim(key, start, stop)\n node_for(key).ltrim(key, start, stop)\n end", "def reverse!\n low = 0\n high = self.__size - 1\n while low < high\n a = self.__at(low)\n b = self.__at(high)\n self.__at_put(high, a)\n self.__at_put(low, b)\n low = low + 1\n high = high - 1\n end\n self\n end", "def rl_reverse_search_history(sign, key)\r\n rl_search_history(-sign, key)\r\n end", "def search(start_key, end_key, limit, offset, reverse, with_keys)\n offset ||= 0\n \n start_node = find_by_prefix(start_key, reverse)\n !start_node and return []\n \n start_node = skip_nodes(start_node, offset, reverse)\n !start_node and return []\n \n collect_values(start_node, end_key, limit, reverse, with_keys)\n end", "def getrange(key, start, stop)\n send_command([:getrange, key, Integer(start), Integer(stop)])\n end", "def zrevrangebylex(key, max, min, limit: T.unsafe(nil)); end", "def z_list_range(key, start = 0, count = 1)\n handle_pipeline(@redis.zrevrange(key, start, start + count - 1)) { |object|\n list = Array(object).map(&method(:without_uuid))\n\n next list.first if count == 1\n\n list\n }\n end", "def get_range(from, to, options = {})\n if options.delete(:include_boundaries)\n connection.zrevrangebyscore(key_label, to, from, options)\n else\n connection.zrevrangebyscore(key_label, \"(#{to}\", \"(#{from}\", options)\n end\n end", "def lrange(key, start, stop)\n send_command([:lrange, key, Integer(start), Integer(stop)])\n end", "def zlist(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zlist\", start, stop, limit], multi: true\n end\n end", "def remove_before(stop)\n remove_by_range(nil, stop)\n end", "def scan(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"scan\", start, stop, limit], multi: true, proc: T_STRSTR\n end\n end", "def rscan(fn = nil, &blk)\n reverse.scan(fn, &blk)\n end", "def ltrim(key, start, stop)\n send_command([:ltrim, key, Integer(start), Integer(stop)])\n end", "def zlist(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zlist\", start, stop, limit], :multi => true\n end\n end", "def zrangestore(dest_key, src_key, start, stop, **options)\n ensure_same_node(:zrangestore, [dest_key, src_key]) do |node|\n node.zrangestore(dest_key, src_key, start, stop, **options)\n end\n end", "def get_range_by_reverse_rank(from, to, options = {})\n connection.zrange(key_label, from, to, options)\n end", "def inverse(start=0)\n start = 0 if [true, false].include?(start) and start\n self.transpose(-1, true).transpose(start+1)\n end", "def scan(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"scan\", start, stop, limit], :multi => true, :proc => T_STRSTR\n end\n end", "def word_reverse(my_words, word_start, word_end)\n return nil if my_words == nil || my_words.length == 0\n\n i = word_start # first index of character word word\n j = word_end # last index of character in word\n\n while i < j\n temp = my_words[i] # swap with temporary variable\n my_words[i] = my_words[j]\n my_words[j] = temp\n i += 1\n j -= 1\n end\n return\nend", "def getrange(key, start, stop)\n node_for(key).getrange(key, start, stop)\n end", "def lrange(key, start, stop)\n node_for(key).lrange(key, start, stop)\n end", "def reverse(string, start ,last)\n i = start\n j = last\n\n while i < j\n string[j], string[i] = string[i], string[j]\n i += 1\n j -= 1\n end\n return string\nend", "def reverse(arr)\n start_point = 0\n end_point = -1\n mid_point = arr.size / 2\n \n while start_point < mid_point\n arr[start_point], arr[end_point] = arr[end_point], arr[start_point]\n start_point += 1\n end_point -= 1\n end\n arr\nend", "def reverse_stops_in_array(stops_array)\n result = stops_array.reverse()\n return result\nend", "def reverse()\n #This is a stub, used for indexing\nend", "def right!(origin, stop)\n y = origin.column\n\n while y <= stop.column\n add_result extract!(IndexPath[origin.row, y])\n\n y += 1\n end\n\n # Begin moving down from the end of this row\n starts_at = IndexPath[stop.row + 1, stop.column]\n ends_at = IndexPath[max_rows - stop.row, stop.column]\n\n down!(starts_at, ends_at)\n end", "def zscan(key, cursor, **options); end", "def format_start_stop(start, stop)\n tmp_start = start\n tmp_stop = stop\n\n if start > stop\n tmp_start, tmp_stop = stop, start\n end\n return tmp_start, tmp_stop\n end", "def up!(origin, stop)\n x = origin.row\n\n while x >= stop.row\n add_result extract!(IndexPath[x, origin.column])\n\n x -= 1\n end\n\n # Begin moving right from the start of this row\n starts_at = IndexPath[stop.row, stop.column + 1]\n ends_at = IndexPath[stop.row, max_columns - stop.column - 1]\n\n right!(starts_at, ends_at)\n end", "def trip(line, from, to)\n line = @subway[line]\n from_index = line.index(from)\n to_index = line.index(to)\n\n if from_index < to_index\n line[from_index..to_index]\n else # opposite direction\n line[to_index..from_index].reverse\n end\nend", "def get_range_by_rank(from, to, options = {})\n connection.zrevrange(key_label, from, to, options)\n end", "def reverse_range(min, max)\n new_arr = []\n\n i = max-1\n while i >= min+1 # i > min\n # reverse\n # exclude\n new_arr << i\n i -= 1\n end\n\n return new_arr\n\nend", "def reverse_inplace(s, start_index = 0, end_index = s.length - 1)\n raise ArgumentError if !s\n \n return s if (end_index - start_index) <= 0\n \n temp_element = s[end_index]\n s[end_index] = s[start_index]\n s[start_index] = temp_element\n return reverse_inplace(s, start_index + 1, end_index - 1)\nend", "def reverse() end", "def reverse() end", "def find_by_prefix(start_key, reverse)\n dir = dir_for_reverse(reverse)\n x = anchor(reverse)\n # if no prefix given, just return a first node\n !start_key and return node_next(x, 0, dir)\n \n level = node_level(x)\n while level > 0\n level -= 1\n xnext = node_next(x, level, dir)\n if reverse\n # Note: correct key CAN be greater than start_key in this case \n # (like \"bb\" > \"b\", but \"b\" is a valid prefix for \"bb\")\n while node_compare2(xnext, start_key) > 0\n x = xnext\n xnext = node_next(x, level, dir)\n end\n else\n while node_compare(xnext, start_key) < 0\n x = xnext\n xnext = node_next(x, level, dir)\n end\n end\n end\n xnext == anchor(!reverse) and return nil\n node_key(xnext)[0, start_key.size] != start_key and return nil\n xnext\n end", "def reverse\n cursor = @tail\n @head = cursor\n until !cursor.prev do\n\n temp = cursor.next\n cursor.next = cursor.prev\n cursor.prev = temp\n cursor = cursor.next\n \n end\n cursor.prev = cursor.next\n cursor.next = nil\n\n @tail = cursor \n \n end", "def reverse!\n @upwards = !@upwards\n skip!(2)\n end", "def keyscan_stop\n\t\trequest = Packet.create_request('stdapi_ui_stop_keyscan')\n\t\tresponse = client.send_request(request)\n\t\treturn true\n\tend", "def reverseAddValues(result, startOffset, endOffset)\n if (endOffset == Node::CURRENT_ENDING_OFFSET) then\n result << @dataSource.valueAt(startOffset)\n else\n scanner = endOffset\n while (scanner >= startOffset) do\n result << @dataSource.valueAt(scanner)\n scanner -= 1\n end\n end\n end", "def reverse\n new(map { |direction| direction.reverse })\n end", "def reversed_each\r\n record = @tail\r\n while record\r\n yield record[:key], record[:value]\r\n record = record[:previous]\r\n end\r\n end", "def reverse_range(min, max)\n reversed = [] \n \n index = max - 1 \n \n while index > min \n reversed << index \n index -= 1\n end \n \n return reversed \n \nend", "def reverse_range(min, max)\n nums = []\n i = max\n while i > min\n if\n i == max\n i -= 1\n next\n end\n nums << i\n i -= 1\n end\n return nums\n end", "def reverse_string(str, start_idx = nil, end_idx = nil)\n if start_idx.nil? || end_idx.nil?\n start_idx = 0\n end_idx = str.length - 1\n end\n\n while start_idx <= end_idx\n str[start_idx], str[end_idx] = str[end_idx], str[start_idx]\n start_idx += 1\n end_idx -= 1\n end\n return str\nend", "def reverse_string(string, start_of_word, end_of_word)\n\n i = start_of_word\n j = end_of_word\n\n while i < j\n temp = string[i]\n string[i] = string[j]\n string[j] = temp\n\n i += 1\n j -= 1\n end\n\n return string\nend", "def slice(start, length = nil)\n case start\n when Integer\n if length\n range(start, start + length - 1)\n else\n conn.lindex(key, start) rescue nil\n end\n when Range, Array\n range *range_pair(start)\n else\n []\n end\n end", "def reverse\n l = self.clone\n l.from = to\n l.from_orient = (to_orient == :+ ? :- : :+)\n l.to = from\n l.to_orient = (from_orient == :+ ? :- : :+)\n l.overlap = reverse_overlap\n l\n end" ]
[ "0.7454863", "0.72677827", "0.72332996", "0.7194127", "0.64104086", "0.6375467", "0.6340569", "0.6340569", "0.632961", "0.63021636", "0.628535", "0.62498945", "0.62089574", "0.62054485", "0.6153453", "0.6104369", "0.6074425", "0.60401446", "0.6023199", "0.6009961", "0.6008541", "0.5984317", "0.59448385", "0.59050727", "0.58678806", "0.5848018", "0.5764116", "0.5764116", "0.5760294", "0.5758321", "0.5738334", "0.57334936", "0.571927", "0.56786996", "0.56778646", "0.56778646", "0.56685716", "0.5639285", "0.5630133", "0.56156814", "0.5595974", "0.55870146", "0.5546082", "0.5546082", "0.5507063", "0.55021393", "0.5485607", "0.5432124", "0.5429693", "0.53972733", "0.5348792", "0.53438246", "0.53430754", "0.53150076", "0.5310911", "0.5281405", "0.5280101", "0.5244879", "0.5237687", "0.5205244", "0.5199665", "0.5192239", "0.5190601", "0.5169587", "0.5166803", "0.5165691", "0.51630497", "0.51536316", "0.5149935", "0.5128826", "0.51227134", "0.5107886", "0.5099657", "0.50786805", "0.5067568", "0.50616074", "0.5060959", "0.50471175", "0.50305057", "0.50289303", "0.5015865", "0.4980145", "0.4978362", "0.49664924", "0.49662653", "0.4953506", "0.4953506", "0.4944934", "0.49281502", "0.492693", "0.49019015", "0.48889157", "0.48840722", "0.4877183", "0.48632476", "0.486023", "0.48592782", "0.48483604", "0.48474848", "0.48425752" ]
0.59261274
23
Checks existence of multiple keys
def multi_exists(keys) keys = Array(keys) unless keys.is_a?(Array) mon_synchronize do perform ["multi_exists", *keys], :multi => true, :proc => T_VBOOL end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists?(*keys); end", "def exists(*keys); end", "def multi_exists(keys)\n keys = Array(keys) unless keys.is_a?(Array)\n mon_synchronize do\n perform [\"multi_exists\", *keys], multi: true, proc: T_VBOOL\n end\n end", "def try_key?(*args)\n for key in args\n return false if !self.keys.include?(key) || !self[key]\n end\n return true\n end", "def all_keys?(*keys)\n keys.all? {|k| has_key? k}\n end", "def keys?(*items)\n items.flatten.each { |item| return false unless key?(item) }\n true\n end", "def contains_expected_keys?(data, *expected_keys)\n expected_keys.each do |expected_key|\n return false until data.keys.include? expected_key\n end\n return true\nend", "def multi_zexists(keys)\n keys = Array(keys) unless keys.is_a?(Array)\n mon_synchronize do\n perform [\"multi_zexists\", *keys], :multi => true, :proc => T_VBOOL\n end\n end", "def has_key?(key)\n keys.include?(key)\n end", "def multi_zexists(keys)\n keys = Array(keys) unless keys.is_a?(Array)\n mon_synchronize do\n perform [\"multi_zexists\", *keys], multi: true, proc: T_VBOOL\n end\n end", "def has_keys?(hash, keys)\n keys.each do |key|\n unless hash.key?(key)\n return false\n end\n end\n true\n end", "def key?(key)\n keys.include?(key) || keys.map(&:to_s).include?(key)\n end", "def key?(key)\n keys.include?(key) || keys.map(&:to_s).include?(key)\n end", "def exists(*keys)\n send_command([:exists, *keys])\n end", "def params_has_key *args\n args.each do |key|\n unless params.has_key? key.to_s\n return false\n end\n end\n return true\nend", "def has_key?(*args)\n @indicies.has_key?(*args)\n end", "def has_key?(key); end", "def has_key?(key); end", "def key?(*key_list)\n first_keys, last_key = split_keys(key_list.flatten)\n data = self\n while (key = first_keys.shift)\n return false unless data.__key__?(key)\n\n data = data.__fetch__(key)\n end\n data.__key__?(last_key)\n end", "def any_unrecognized_keys?(expected, given)\n unrecognized_keys(expected, given).any?\n end", "def exists?(*keys)\n send_command([:exists, *keys]) do |value|\n value > 0\n end\n end", "def exist?(key)\n\n end", "def has_key?(p0) end", "def has_key?(*args)\n @params.has_key?(*args)\n end", "def has_key?(*args)\n @params.has_key?(*args)\n end", "def has_key? key; key? key; end", "def batch_exists(client,\tkey_prefix, size)\n # Batch into one call.\n keys = []\n (0...size).each do |i|\n keys << Key.new(Shared.namespace, Shared.set_name, key_prefix + (i+1).to_s)\n end\n\n exists_array = client.batch_exists(keys)\n\n (0...exists_array.length).each do |i|\n key = keys[i]\n exists = exists_array[i]\n Shared.logger.info(\"Record: ns=#{key.namespace} set=#{key.set_name} key=#{key.user_key} exists=#{exists}\")\n end\nend", "def exist?(key)\n !@store.select { |i| i[:key] == build_key(key) }.empty?\n end", "def does_key_exist?(keys_dir, name, pub)\n does_rsa_key_exist?(keys_dir, name, pub) || does_dsa_key_exist?(keys_dir, name, pub)\nend", "def multiple?(field_key)\n true\n end", "def validate_keys(*valid_keys)\n valid_keys.flatten!\n @hash.each_key do |k|\n unless valid_keys.include?(k)\n raise ArgumentError.new(\"Unknown key: #{k.inspect}. Valid keys are: #{valid_keys.map(&:inspect).join(', ')}\")\n end\n end\n end", "def all_there?(recipe, on_hand)\n recipe.keys.each do |ingredient|\n return false if !(on_hand.keys.include? ingredient)\n end\n\n true\nend", "def any_key?\n @keys == UndefinedSetting\n end", "def validate_input_keys\n input_keys = Input.all.map(&:key)\n preset_keys = user_values.keys\n\n if (intersection = preset_keys - input_keys).any?\n errors.add(:user_values,\n \"contains input keys which don't exist: \" \\\n \"#{ intersection.sort.inspect }\")\n end\n end", "def has_key?(attr_name)\n keys.include?(attr_name.to_s)\n end", "def has_key?(key)\n !get(key).nil?\n end", "def has_key?(key)\n !get(key).nil?\n end", "def valid_keys?(passport)\n (REQ - passport.keys).length === 0\n end", "def multi_key?\n @multi_key\n end", "def has?(key)\n [cache, values].any? { |store| store.keys.include?(key.to_sym) }\n end", "def check_arguments(params, *args)\n contains = true\n args.each do |arg|\n contains = false unless params.key? arg.to_sym\n end\n contains\n end", "def check_keys object, path, allowed = [], required = []\n allowed += required if allowed && required\n required.each { |k| report_error(\"Missing required key: #{\"#{path ? path + \"/\" : \"\"}#{k}\".inspect}\") unless !object[k].nil? }\n object.each_key { |k| report_error(\"Unknown key: #{\"#{path ? path + \"/\" : \"\"}#{k}\".inspect}\") unless allowed.index(k) }\n end", "def unique?(*keyarray)\n raise \"Key(s) required\" if keyarray.empty?\n keyarray = keyarray.flatten\n keys = map {|hash| hash.key_for(keyarray)}\n return false if keys.any?(&:nil?)\n keys.uniq.count == self.count\n end", "def exist?(key)\n [primary, *secondaries].any? { |svc| svc.exist?(key) }\n end", "def has_required_keys?(instance, required_keys, ignore_keys, indent: 3)\n success = true\n\n required_keys[\"name\"] = {\n \"type\" => \"String\",\n \"required\" => true\n }\n\n required_keys.each do |key, data|\n next if ignore_keys.include?(key)\n\n if !instance.key?(key)\n bad \"#{key} is missing\", indent: indent\n success = false\n end\n end\n\n success\n end", "def has_keys?(other)\n\t\t@keys.each do |key|\n\t\t\tif not other.headers.index(key)\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\tend", "def has_key?(key)\n params.keys.include?(key)\n end", "def strict_keys?(input)\n (input.keys - rules.keys).empty?\n end", "def include?(key); end", "def include?(key); end", "def validate_keys(ssh_keys)\n return false unless ssh_keys.is_a? Array\n ssh_keys.each do |entry|\n return false if entry.nil?\n return false if not\n (entry['key'].is_a? String and entry['key'].length > 0)\n return false if not\n (entry['type'].is_a? String and entry['type'].length > 0)\n return false if not\n (entry['comment'].nil? or\n (entry['comment'].is_a? String and entry['comment'].length > 0))\n end\n true\n end", "def contains?(key)\n not get(key).nil?\n end", "def all?(*keys)\n keys.flatten!\n if keys.any?\n # Check only the specified keys\n valid = true\n keys.each do |key|\n unless @values.has_key?(key)\n raise \"Unknown column key :#{key} in call to Row#all?\"\n end\n valid = valid && !@values[key].nil?\n end\n valid\n else\n # Check all value keys\n @values.values.all? {|v| !v.nil? }\n end\n end", "def contains?(key)\n @key_data.has_key?(key)\n end", "def count_keys_with_values?(passport)\n counter_good_keys = 0\n keys = %w(byr iyr eyr hgt hcl ecl pid) #cid)\n passport.each do | field |\n counter_good_keys = counter_good_keys + 1 if keys.include?(field[0])\n end\n counter_good_keys == 7 ? true : false\n end", "def hstore_has_all_keys(column, *keys)\n where(\"#{connection.quote_column_name(column)} ?& ARRAY[:keys]\", :keys => keys.flatten)\n end", "def check_key(key, array)\n return true if ![nil, '', '-'].include?(array[key])\n raise RuntimeError, \"#{key} is empty\"\n end", "def has_key?(key)\n @stored[key] && !@stored[key].empty? ? true : false\n end", "def has_key?(key)\n @db.each_key do\n\t|k|\n\treturn true if k == key\n end\n end", "def include_key?(key)\n\t\t\ttrue\n\t\tend", "def batch_exists(keys, options = nil)\n policy = create_policy(options, BatchPolicy, default_batch_policy)\n results = Array.new(keys.length)\n\n if policy.use_batch_direct\n key_map = BatchItem.generate_map(keys)\n execute_batch_direct_commands(policy, keys) do |node, batch|\n BatchDirectExistsCommand.new(node, batch, policy, key_map, results)\n end\n else\n execute_batch_index_commands(policy, keys) do |node, batch|\n BatchIndexExistsCommand.new(node, batch, policy, results)\n end\n end\n\n results\n end", "def required_alert_keys?(json)\n %w[title description artifacts].all? { |key| json.key? key }\n end", "def includes!(*keys)\n keys.to_sargs.all? {|k| v = self[k]; !v.nil? && !(v.is_a?(String) && v.empty?) }\n end", "def exist?(key)\n with_client do |client|\n !client.exists(build_key(key)).zero?\n end\n end", "def has_key?(key)\n any? {|mod| mod.name == key}\n end", "def hstore_has_any_keys(column, *keys)\n where(\"#{connection.quote_column_name(column)} ?| ARRAY[:keys]\", :keys => keys.flatten)\n end", "def key?(item)\n members.include?(item) && non_nil?(item)\n end", "def hash_and_matches_redundant_keys?(key, value)\n value.is_a?(Hash) && REDUNDANT_KEYS.any? { |sym| sym == key }\n end", "def includes? hash\n hash.each_pair do |key, value|\n return false unless send(\"#{key}\") == value\n end\n true\n end", "def has_key?(key)\n configs.has_key?(key) || store.has_key?(key) \n end", "def clever_validate_keys(ssh_keys)\n ssh_keys.is_a? Array and\n # check each entry\n ssh_keys.map { |entry|\n not entry.nil? and\n entry['key'].is_a? String and entry['key'].length > 0 and\n entry['type'].is_a? String and entry['type'].length > 0 and\n (entry['comment'].nil? or\n (entry['comment'].is_a? String and entry['comment'].length > 0))\n # any false results invalidates the whole set\n }.reduce(:&)\n end", "def validate(keys)\n errors = []\n\n keys.each do |k|\n pretty_key = k.to_s.gsub(/_/, ' ').gsub(/\\w+/){ |w| (w =~ /(ssh)|(aws)/i) ? w.upcase : w.capitalize }\n if Chef::Config[:knife][k].nil? and config[k].nil?\n errors << \"You did not provide a valid '#{pretty_key}' value.\"\n end\n end\n\n if errors.empty?\n return true\n else\n return false\n end\n end", "def rec_exists?(file_name, unique_keys, data)\n json = File.read(file_name + \".json\")\n json = json.split(\",\\n\")\n data = data.to_s\n data = eval data.gsub(\"},\", \"}\")\n json.each do |h|\n h = eval h\n flag = true\n unique_keys.each do |k|\n if h[k.to_s].to_s != data[k.to_s].to_s\n flag = false\n end\n end # end unique keys loop\n if flag == true\n #p \"rec exists!!!!!!!\"\n return true\n end\n end # end json loop\n #p \"doesn't exist, safe to move on\"\n false\nend", "def assert_required_keys(*keys)\n keys.flatten.each do |key|\n raise ArgumentError, \"Required key: #{key.inspect}\" unless key?(key)\n end\n end", "def include?(key)\n # Ensure a Ruby true is returned\n item_exists(key) == true\n end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def require_any_of(*keys)\n args_def.require_any_of(*keys)\n end", "def key?(key)\n values.key?(key)\n end", "def include?(key)\n has_key?(key)\n end", "def includes?(array, target)\n array.each do |k, v|\n if k == key\n return true\n elsif v.class.to_s == \"Array\"\n v.each do |inner_array|\n return has_key(inner_array, key)\n end\n else\n return false\n end\n end\n\nend", "def exists?(key)\n unimplemented\n end", "def must_contain_one_of!(*keys, **options, &block)\n self.permitted_keys = [*permitted_keys, *keys].uniq\n before_validation do\n JSONAPIonify::Continuation.new(**options).check(self) do\n keys += self.keys.select(&block) if block_given?\n valid_keys = keys.map(&:to_sym) & self.keys.map(&:to_sym)\n unless valid_keys.present?\n errors.add('*', \"must contain one of: #{keys_to_sentence(*self.keys)}\")\n end\n end\n end\n end", "def check_key_exist url_key\n @url_generators = UrlGenerator.all\n @url_generators.each do |url_generator|\n if url_generator.key == url_key\n return true\n end\n end\n return false\n end", "def keys_valid?\n valid = true\n msg = []\n required_keys = %w(EMAIL_SMTP_DOMAIN EMAIL_SMTP_PORT FEEDBACK_FROM_EMAIL FEEDBACK_SMTP_AUTH_USER FEEDBACK_SMTP_AUTH_PASSWORD FEEDBACK_TO_EMAIL BACKUP_TYPE SERVER_NAME S3_BUCKET_PREFIX S3_BUCKET_SEPARATOR S3CMD_PATH ROOT_DIR TMP_DIR LOG_DIR BACKUP_SERVER_TIME)\n mysql_keys = %w(MYSQL_USER MYSQL_PASSWORD)\n mitb_keys = %w(MAIL_IN_A_BOX_BACKUP_DIRECTORY MAIL_IN_A_BOX_S3_DIRECTORY)\n missing_keys = []\n keys = required_keys\n if variable_is_true?('HAS_MYSQL')\n keys << mysql_keys\n end\n if variable_is_true?('HAS_MAIL_IN_A_BOX')\n keys << mitb_keys\n end\n keys.flatten!\n keys.each do |key|\n if !variable_exists? key\n missing_keys << key\n end\n end\n\n if missing_keys.length > 0\n msg << \"ERROR: the following keys are missing values: #{missing_keys.join(', ')}\"\n valid = false\n end\n\n\n # make sure the required directories exist\n if !File.exists? ENV['TMP_DIR']\n msg << \"ERROR: the tmp directory '#{ENV['TMP_DIR']}' does not exist and must be created before running this script\"\n valid = false\n end\n if !File.exists? ENV['LOG_DIR']\n msg << \"ERROR: the log directory '#{ENV['LOG_DIR']}' does not exist and must be created before running this script\"\n valid = false\n end\n if variable_is_true?('HAS_MAIL_IN_A_BOX') && !File.exists?(ENV['MAIL_IN_A_BOX_BACKUP_DIRECTORY'])\n msg << \"ERROR: the Mail-In-A-Box backup directory '#{ENV['MAIL_IN_A_BOX_BACKUP_DIRECTORY']}' does not exist and must be created before running this script\"\n valid = false\n end\n\n return valid, msg\nend", "def arg_hash_keys_exact(exact_keys, *args)\n args.each do |h|\n missing = exact_keys - h.keys\n extra = h.keys - exact_keys\n raise ArgumentError, \"Hash keys don't match required set (#{exact_keys.join(', ')}). \" +\n \"Missing required keys (#{missing.join(', ')}); extra keys not allowed (#{extra.join(', ')}).\\n\" +\n \"Got:\\n#{h.inspect}\" if (missing.length > 0) || (extra.length >0)\n end\n end", "def has_key?(field_name); end", "def missing_keys_from(required_keys)\n required_keys.select{ |k| self.get(k).to_s.empty? }\n end", "def key?(name)\n matches = select(name)\n matches.any?\n end", "def has_keypair?\n options.has_key?(:keypair) && options[:keypair] && !options[:keypair].empty?\n end", "def valid_keys?(message)\n [:sender, :sent_to, :type, :uid] - message.keys == []\n end", "def has_key(rsa)\n refresh_keys if @keys.nil?\n return false if @keys.empty?\n\n # loop through arrays checking against 'key'\n @keys.each do |key|\n return true if key[\"key\"] == rsa\n end\n\n return false # key not found\n end", "def key_set?\n !attributes['key'].nil?\n end", "def exists?\n retrieve\n true\n rescue Error::NoSuchKey\n false\n end", "def has_key? k\n @values.has_key?(k)\n end", "def has_key?(key)\n @h.has_key?(key.to_sym)\n end" ]
[ "0.7881508", "0.781122", "0.76587546", "0.7472243", "0.7463313", "0.74212", "0.72459096", "0.7040888", "0.704034", "0.70360565", "0.7025851", "0.700424", "0.700424", "0.6948902", "0.6946515", "0.6935444", "0.69331783", "0.69331783", "0.69084704", "0.68481517", "0.68295574", "0.6826341", "0.678115", "0.67786694", "0.67786694", "0.6759466", "0.6699911", "0.66930556", "0.6634899", "0.66096324", "0.66070443", "0.6600802", "0.6597487", "0.6583201", "0.6582183", "0.6568271", "0.6568271", "0.65448904", "0.653985", "0.6534356", "0.6521552", "0.6493737", "0.6482201", "0.6479447", "0.6466154", "0.6453312", "0.64231724", "0.6422295", "0.64054954", "0.64054954", "0.64012104", "0.63932586", "0.63902247", "0.6369891", "0.63674825", "0.6359912", "0.6358645", "0.63546336", "0.63530755", "0.63515776", "0.631477", "0.6313516", "0.63077825", "0.6296876", "0.6289766", "0.62891847", "0.6284973", "0.62734115", "0.6267893", "0.62451005", "0.6242972", "0.6227059", "0.622", "0.62176573", "0.6201541", "0.619106", "0.619106", "0.619106", "0.619106", "0.619106", "0.619106", "0.61847144", "0.6184511", "0.61836475", "0.6182242", "0.6164719", "0.6161695", "0.6159031", "0.6157861", "0.6154896", "0.6153453", "0.6146405", "0.6131014", "0.61308646", "0.612729", "0.61184597", "0.6115921", "0.6111252", "0.6109283", "0.610035" ]
0.763299
3
Returns the score of `member` at `key`.
def zget(key, member) mon_synchronize do perform ["zget", key, member], :proc => T_CINT end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(member)\n conn.zscore(key, member)\n end", "def zscore(key, member)\n node_for(key).zscore(key, member)\n end", "def zscore(key, member); end", "def zscore(key, member); end", "def zscore(key, member)\n call(key, [:zscore, key, member], transform: Redis::Floatify, read: true)\n end", "def score\n @scores[ result.key ]\n end", "def zrank(key, member)\n node_for(key).zrank(key, member)\n end", "def score\n Dictionary.db.zscore(@key, @value).to_i\n end", "def [](key)\n @members[cast_key(key)]\n end", "def member_total(member_name)\n @roster[member_name]\n end", "def zrank(key, member); end", "def zrank(key, member); end", "def score(player)\n @score[player]\n end", "def zrank(key, member)\n call(key, [:zrank, key, member], read: true)\n end", "def geohash(key, member, *members)\n\t\t\t\t\tcall(\"GEOHASH\", key, member, *members)\n\t\t\t\tend", "def [](key)\n redis.zscore(@redis_key, key)\n end", "def zget(key, member)\n mon_synchronize do\n perform [\"zget\", key, member], proc: T_CINT\n end\n end", "def zincr(key, member, score = 1)\n mon_synchronize do\n perform [\"zincr\", key, member, score], proc: T_INT\n end\n end", "def geohash(key, member)\n send_command([:geohash, key, member])\n end", "def add(member, score)\n conn.zadd key, score, member\n self\n end", "def get(key)\n bucket = @map[key.hash % @size]\n pair = bucket.find {|k, v| k == key}\n if pair \n pair[1]\n else\n -1\n end\n end", "def index(member)\n conn.zrank(key, member)\n end", "def zincr(key, member, score = 1)\n mon_synchronize do\n perform [\"zincr\", key, member, score], :proc => T_INT\n end\n end", "def pfadd(key, member)\n node_for(key).pfadd(key, member)\n end", "def sismember(key, member)\n node_for(key).sismember(key, member)\n end", "def zrevrank(key, member)\n node_for(key).zrevrank(key, member)\n end", "def sismember(key, member); end", "def sismember(key, member); end", "def smismember(key, *members)\n node_for(key).smismember(key, *members)\n end", "def score(campaign=nil)\n Rails.cache.fetch([self, \"score\", campaign]) do\n log_score(campaign)\n end\n rescue ArgumentError => e # Comparison of nil \n 0.0\n end", "def calculate_probability(key)\n\n\t\tk = key\n\n\t\tcase k\n\t\twhen 2\n\t\t\treturn TWO_TWELVE\n\t\twhen 3\n\t\t\treturn THREE_ELEVEN\n\t\twhen 4\n\t\t\treturn FOUR_TEN\n\t\twhen 5\n\t\t\treturn FIVE_NINE\n\t\twhen 6\n\t\t\treturn SIX_EIGHT\n\t\twhen 7\n\t\t\treturn SEVEN\n\t\twhen 8\n\t\t\treturn SIX_EIGHT\n\t\twhen 9\n\t\t\treturn FIVE_NINE\n\t\twhen 10\n\t\t\treturn FOUR_TEN\n\t\twhen 11\n\t\t\treturn THREE_ELEVEN\n\t\twhen 12\n\t\t\treturn TWO_TWELVE\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend", "def get(key)\n if @map.include?(key)\n node = @map[key]\n update_node!(node)\n update_map!(key)\n else\n eject! if count >= @max\n val = calc!(key)\n add_node(key, val)\n update_map!(key)\n end\n\n # Return the value (value of key run through proc)\n val\n end", "def rank(key)\n node_rank(@root, key)\n end", "def score(value)\n connection.zscore(key_label, value)\n end", "def geohash(key, member); end", "def zmscore(key, *members)\n node_for(key).zmscore(key, *members)\n end", "def zset(key, member, score)\n mon_synchronize do\n perform [\"zset\", key, member, score], proc: T_BOOL\n end\n end", "def num_points_scored(player_name)\n# we use .each do |team, random| to iterate over each piece of data to expose specific data, in this case number of points scored by each player, within the above hash\n# and we use symbols (with one object id) to take up less memory\n game_hash.each do |team, random|\n game_hash[team][:players].each do |name, stats|\n if player_name == name\n return stats[:points]\n# then we want to return the number of points scored for each player if player_name is equal to the key of name\n\n end\n end\n end\n\nend", "def get_topic_score(topic)\n return calculate_score(lemmas_hash[topic]) if lemmas_hash[topic]\n end", "def get_score(num)\n return @game[num]\n end", "def get(word)\n score = @redis.zscore(@key, word)\n score ? score.to_i : nil\n end", "def score_method(method = nil)\n @score_method = method if method\n @score_method\n end", "def increment_member_score(lb, handle, score, json)\n increment_by = score\n # if they already exist, add their new score to their current\n score = score + lb.score_for(handle).to_i if lb.score_for(handle)\n lb.rank_member(handle, score, json)\n {:status => \"success\", :message => \"Added #{increment_by} to #{handle} for a current score of #{score}.\"}.to_json\nrescue Exception => e\n {:status => \"error\", :message => e.message}.to_json\nend", "def get(key)\n shard_for(key).find_by(distkey => key)\n end", "def get(key)\n row = key >> 10\n column = @a[row].index{|(i,v)| i == key}\n if column\n return @a[row][column][1] \n else\n return -1\n end\n end", "def node_score\n @property_hash[:node_score]\n end", "def score(player)\n @players[player][:score] += 1\nend", "def [](key)\n @mutex.synchronize { @hash[key] }\n end", "def [](key)\n @mutex.synchronize { @hash[key] }\n end", "def rank(key)\n recursive_rank(root, key)\n end", "def num_points_scored(player)\n \n data = game_hash\n player_hash = players_stats(data)\n \n player_hash.each_pair do |name, player_stat|\n \n if name == player\n player_stat.each_pair do |player_key, player_value|\n if player_key == :points\n return player_value\n end\n end\n end\n \n end\n \n nil\nend", "def [](key)\n @mutex.synchronize{@hash[key]}\n end", "def [](key)\n @mutex.synchronize { @hash[key] }\n end", "def get(key)\n found = @hash[key]\n\n if found\n @list.move_node_to_head(found)\n return found\n end\n\n -1\n end", "def get_score()\r\n return @player.score()\r\n end", "def zset(key, member, score)\n mon_synchronize do\n perform [\"zset\", key, member, score], :proc => T_BOOL\n end\n end", "def weighted_score\n score * metric.weight\n end", "def count(key)\n @counter[key]\n end", "def zdecr(key, member, score = 1)\n mon_synchronize do\n perform [\"zdecr\", key, member, score], proc: T_INT\n end\n end", "def [](key)\n @mutex.synchronize{ @hash[key] }\n end", "def num_points_scored(player)\n game_hash.each do |location, team|\n team[:players].each do |name, stats|\n if name == player\n return stats[:points]\n end\n end\n end\nend", "def score\n # add score caching\n total = 0\n self.votes.each do |vote|\n total += vote.value\n end\n total\n end", "def zrevrank(key, member); end", "def zrevrank(key, member); end", "def calc!(key)\n # suggested helper method; insert an (un-cached) key\n @prc.call(key)\n end", "def points_per_player(player, hashketball)\r\n player.capitalize!\r\n if hashketball[:home][:players].include?(player)\r\n hashketball[:home][:players][player][:stats][:points]\r\n elsif hashketball[:away][:players].include?(player)\r\n hashketball[:away][:players][player][:stats][:points]\r\n else\r\n \"No player found.\"\r\n end\r\nend", "def num_points_scored(team_member)\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n # if attribute == :players\n next unless attribute == :players\n data.each do |player|\n return player[:points] if player[:player_name] == team_member\n end\n end\n end\nend", "def score\n \n case @points\n when 0 \n @player_score[@points] = 'Love'\n return @player_score[@points]\n when 1 \n @player_score[@points] = 'Fifteen'\n return @player_score[@points]\n when 2 \n @player_score[@points] = 'Thirty'\n return @player_score[@points]\n when 3 \n @player_score[@points] = 'Forty'\n return @player_score[@points]\n else \n return @points \n end\n end", "def score(word)\n point_values_hash = point_values\n point_values(word)\n end", "def calculate_score\n @results.collect { |mir| mir.send(@column.to_sym) }.sum\n end", "def [](key)\n @monitor.synchronize do\n _, value = get(key)\n value\n end\n end", "def zrevrank(key, member)\n call(key, [:zrevrank, key, member], read: true)\n end", "def [](key)\n if self.class.key_transformer\n @hash[self.class.key_transformer.call(key)]\n else\n @hash[key]\n end\n end", "def zrandmember(key, count = T.unsafe(nil), withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end", "def lookup(key)\n if key_pair = pair(key, hash(key))\n key_pair[1]\n end\n end", "def zdecr(key, member, score = 1)\n mon_synchronize do\n perform [\"zdecr\", key, member, score], :proc => T_INT\n end\n end", "def smismember(key, *members); end", "def smismember(key, *members); end", "def hit(level = @skl_level)\n return @skl_levelcache[level][:hit_ratio]\n end", "def get_recommendation(data, key, metric = Pearson.new)\n totals = {}\n sim_sums = {}\n\n others = data.keys - [key]\n others.each do |other|\n sim = metric.distance(data, key, other)\n\n # only check others with similarity > 0\n if sim > 0\n data[other].each do |item, score|\n # only check item not rated by me\n if data[key][item].nil? or data[key][item] == 0\n totals[item] = 0 if totals[item].nil?\n sim_sums[item] = 0 if sim_sums[item].nil?\n\n totals[item] += score * sim\n sim_sums[item] += sim\n end\n end\n end\n end\n\n rankings = totals.collect do |item, score|\n [score/sim_sums[item], item] \n end\n rankings.sort!\n rankings.reverse!\n end", "def [](key)\n @hash[key]\n end", "def [](key)\n @hash[key]\n end", "def [](key)\n @hash[key]\n end", "def [](key)\n @hash[key]\n end", "def score\n properties['score']\n end", "def member_rating(group=nil)\n (self.member ? self.member.group_rating(group, \"overall\") : 0.0) || 0.0\n end", "def calculate_score\n raise \"Override and return the metric's score\"\n end", "def pfadd(key, member); end", "def score_letter(ver, letter)\n ver.map do |point, list| \n if list.include?(letter.to_s)\n return point\n end\n end\n return 0 \n end", "def [](key)\n @metrics[key]\n end", "def [](key)\n @hash[key]\n end", "def get_score()\n score = Hash.new(0)\n players.each {|player| score[player.name] = player.score}\n score\n end", "def get(key)\n @hash[key]\n end", "def match(hash)\n score, total_score = @archetype.inject([0, 0]) do |accum, fdef_pair|\n current_score, total_score = accum\n field, field_spec = fdef_pair\n\n scorer = field_spec[:scorer]\n weight = field_spec[:weight]\n\n rvalue = hash[field]\n score = rvalue ? scorer.(field_spec[:value].strip, rvalue.strip) * weight : 0\n\n [current_score + score, total_score + weight]\n end\n\n score.to_f / total_score\n end", "def [](key)\n if @result.include?(key)\n @result[key]\n else\n data[key]\n end\n end", "def [](key)\n hash[key]\n end", "def num_points_scored(player_lookup) \n game_hash.each do |location, team_data|\n#return the number of points scored for that player\n team_data[:players].each do |player|\n if player[:player_name] == player_lookup\n return player[:points]\n end\n end\n end\nend", "def score\n rate.score\n end", "def get(key)\n node = @cache[key]\n return -1 if node.nil?\n move_to_head(node)\n node.value\n end", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend" ]
[ "0.77476054", "0.7294132", "0.6948496", "0.6948496", "0.69160646", "0.60476995", "0.5877046", "0.5868672", "0.5817769", "0.574547", "0.56804794", "0.56804794", "0.56399584", "0.55705225", "0.5511464", "0.53747404", "0.53588665", "0.5335762", "0.5328747", "0.52945024", "0.52759504", "0.5275644", "0.52698636", "0.5269185", "0.52317065", "0.5224128", "0.52211577", "0.52211577", "0.51988536", "0.51728296", "0.5168072", "0.5158928", "0.5153124", "0.5095669", "0.5086062", "0.50651664", "0.5060974", "0.5028238", "0.5025962", "0.50236964", "0.5019016", "0.5017121", "0.5016575", "0.49862427", "0.49836543", "0.4976862", "0.49754718", "0.49739233", "0.49739233", "0.49636662", "0.49602732", "0.49548262", "0.4951297", "0.49471778", "0.4936361", "0.49283487", "0.49272925", "0.4925988", "0.4925779", "0.4923078", "0.4915212", "0.4911269", "0.49061337", "0.49061337", "0.48980382", "0.48944953", "0.48808575", "0.48776573", "0.48759827", "0.48726043", "0.4872083", "0.4871272", "0.4870703", "0.4861186", "0.48610213", "0.48568916", "0.4853651", "0.4853651", "0.48533213", "0.4853193", "0.48512664", "0.48512664", "0.48512664", "0.48512664", "0.48502427", "0.48452467", "0.4835883", "0.4831377", "0.48253784", "0.4820749", "0.48206294", "0.48200828", "0.4817324", "0.48118195", "0.48094207", "0.48024905", "0.47929063", "0.47870603", "0.47811773", "0.4774775" ]
0.53059447
19
Sets the `score` of `member` at `key`.
def zset(key, member, score) mon_synchronize do perform ["zset", key, member, score], :proc => T_BOOL end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zset(key, member, score)\n mon_synchronize do\n perform [\"zset\", key, member, score], proc: T_BOOL\n end\n end", "def []=(key, score)\n update_condition = ->(redis) do\n current_score = redis.zscore(@redis_key, key)\n !current_score || current_score < score\n end\n update_action = ->(redis) do\n redis.zadd(@redis_key, score, key)\n end\n redis_safe_update([@redis_key], update_condition, update_action)\n score\n end", "def set(key, value, score)\n success = multi do\n @hash.set(key, value)\n @index.add(score, key)\n end\n if success && @size_limit && (@size_limit > 0) && (self.size > @size_limit)\n self.truncate(@size_limit)\n end\n success\n end", "def score(member)\n conn.zscore(key, member)\n end", "def add(member, score)\n conn.zadd key, score, member\n self\n end", "def set_member_score(lb, handle, score, json)\n if (params[:score].to_i == -1)\n lb.remove_member(handle)\n {:status => 'success', :message => \"#{params[:handle]} removed from the #{params[:leaderboard]} leaderboard.\"}.to_json\n else\n lb.rank_member(handle, score, json)\n {:status => \"success\", :message => \"Set score for #{handle} to #{score}.\"}.to_json\n end\nrescue Exception => e\n {:status => \"error\", :message => e.message}.to_json\nend", "def initialize( key, score )\n @key = key\n @score = score\n end", "def set_score(num, socre)\n @game[num] = score\n end", "def zscore(key, member); end", "def zscore(key, member); end", "def zscore(key, member)\n call(key, [:zscore, key, member], transform: Redis::Floatify, read: true)\n end", "def zscore(key, member)\n node_for(key).zscore(key, member)\n end", "def updateKey; @key = getKey; self end", "def update!(**args)\n @match_score = args[:match_score] if args.key?(:match_score)\n end", "def set_score(score_name, score)\n # Start out in invalid position and index for each score until we match\n idx = -1\n @scores_ordered_names.each do |name|\n idx += 1\n break if name == score_name\n end\n if valid_scores_idx? idx\n # For debugging\n dup_score = set_added_score_note_attrs score\n @scores[score_name] = dup_score \n end\n self\n end", "def zincr(key, member, score = 1)\n mon_synchronize do\n perform [\"zincr\", key, member, score], proc: T_INT\n end\n end", "def put(score, value)\n connection.zadd(key_label, score, value)\n end", "def set(key, val = nil)\n @statistics[:set] += 1\n with_branch_for(key) do |branch|\n branch.set key, val\n end\n end", "def set_members(key)\n perform_read(:set_members, key)\n end", "def increment_member_score(lb, handle, score, json)\n increment_by = score\n # if they already exist, add their new score to their current\n score = score + lb.score_for(handle).to_i if lb.score_for(handle)\n lb.rank_member(handle, score, json)\n {:status => \"success\", :message => \"Added #{increment_by} to #{handle} for a current score of #{score}.\"}.to_json\nrescue Exception => e\n {:status => \"error\", :message => e.message}.to_json\nend", "def update!(**args)\n @score = args[:score] if args.key?(:score)\n end", "def update!(**args)\n @score = args[:score] if args.key?(:score)\n end", "def zincr(key, member, score = 1)\n mon_synchronize do\n perform [\"zincr\", key, member, score], :proc => T_INT\n end\n end", "def add_to_score_hash(markable, score)\n scores_hash[assessment_group.id][markable.id][student.id] = score\n end", "def []=(key,arg)\n @hash[key] = arg\n end", "def score(player)\n @players[player][:score] += 1\nend", "def []=(key, entry)\n key = key_for(key) unless valid_key?(key)\n @hash[key] = entry if key\n end", "def set(key, value)\n arr_pos = to_hash(key)\n list = @array[array_pos]\n node = list.find_by_key(key)\n if node\n node.data = value\n else\n self.put(key, value)\n end\n end", "def give_score(uid, name, score)\n unless @scores.key? uid\n self.init_user_score(uid, 'name')\n end\n\n @scores[uid]['score'] += score\n\n unless @scores[uid]['name'] == name\n self.update_user_name uid, name\n end\n end", "def update!(**args)\n @mid = args[:mid] if args.key?(:mid)\n @score = args[:score] if args.key?(:score)\n end", "def update!(**args)\n @mid = args[:mid] if args.key?(:mid)\n @score = args[:score] if args.key?(:score)\n end", "def update_score!(points)\n increment!(:score, points)\n end", "def score=(value)\n @score = value\n end", "def set(key, value, ttl = 0)\n stats[:set] += 1\n handler.set key, value, ttl\n end", "def update_score_by(value)\n @score.increment_by(value)\n end", "def key=(key); end", "def set(key, value, **options)\n node_for(key).set(key, value, **options)\n end", "def update_score(user_id, score = 0)\n key = \"user_score:#{user_id}\"\n user_score = $redis.get(key)\n last_user_answered = user_id\n if user_score.nil?\n $redis.set(key, score)\n score\n else\n new_score = user_score.to_i + score\n $redis.set(key, new_score)\n new_score\n end\nend", "def set(key, value)\n\t\t\t\t# TODO This could be a bit more efficient:\n\t\t\t\tself.delete(key)\n\t\t\t\tself.add(key, value)\n\t\t\tend", "def pfadd(key, member)\n node_for(key).pfadd(key, member)\n end", "def update_stats(state, score)\n if @state_stats.has_key?(state)\n @state_stats[state][:score] += score\n @state_stats[state][:tries] += 1\n else\n @state_stats[state] = { :score => score, :tries => 1}\n end\n end", "def assign_score; end", "def assign_score=(_arg0); end", "def set_member?(key, member)\n timeout_retry(3, 3){\n write \"SISMEMBER #{key} #{member.to_s.size}\\r\\n#{member}\\r\\n\"\n case integer_reply\n when 1\n true\n when 0\n false\n when -2\n raise RedisError, \"key: #{key} contains a non set value\"\n end\n }\n end", "def set(key, value); end", "def set(key, value); end", "def pfadd(key, member); end", "def update_key(key, val)\n @ivar.each_with_index do |ele, i|\n if ele[0] == key\n @ivar[i][1] = val \n end\n end\n end", "def update_score\n \t\tuser.score += 10\n user.save\n\tend", "def score=(_); end", "def append(key, value, score)\n # attempt the transaction, retrying a limited number of\n # times if the WATCH makes us bail.\n retry_counter = 0\n while retry_counter < @retry_limit\n # Have to put the watch inside the retry loop because\n # calling EXEC clears all watches.\n # TODO: maybe we want to have Composite#watch(@index) ??\n watch(@index)\n\n # get highest score from the Sorted Set and increment the\n # input score if necessary.\n _value, high_score = @index.last(:with_scores => true)\n if high_score\n if score <= high_score.to_i\n score = high_score.to_i + 1\n end\n end\n\n if set(key, value, score)\n return score\n else\n retry_counter += 1\n end\n end\n\n raise \"Optimistic locking failed too many times\"\n end", "def score=(points)\n s = points\n s = 0 if s < 0\n s = 100 if s > 100\n self[:score] = s\n rerank\n end", "def set(key, value)\n end", "def gain_a_point\n\n self.score += 1\n\n end", "def set(key, value)\n @namehash[key.to_sym][0] = value\n end", "def set_add(key, member)\n timeout_retry(3, 3){\n write \"SADD #{key} #{member.to_s.size}\\r\\n#{member}\\r\\n\"\n case integer_reply\n when 1\n true\n when 0\n false\n when -2\n raise RedisError, \"key: #{key} contains a non set value\"\n end\n }\n end", "def zrank(key, member); end", "def zrank(key, member); end", "def update!(**args)\n @score = args[:score] if args.key?(:score)\n @token = args[:token] if args.key?(:token)\n end", "def set(key, value, timestamp)\n \n end", "def key=(new_key)\n @key = new_key\n end", "def update_attribute(key, value)\n instance_variable_set \"@#{key}\", value\n save_if_match\n end", "def zrank(key, member)\n call(key, [:zrank, key, member], read: true)\n end", "def inc_hit(key, options)\n if @hits[key]\n @hits[key]+=1\n else\n @hits[key]=1\n end\n end", "def inc_hit(key, options)\n if @hits[key]\n @hits[key]+=1\n else\n @hits[key]=1\n end\n end", "def put(key, value)\n @root = put_rec(@root, key, value, 0)\n end", "def set(key, value)\n @map[key] = value\n end", "def sismember(key, member); end", "def sismember(key, member); end", "def set_score\n @score = Score.find(params[:id])\n end", "def set_score\n @score = Score.find(params[:id])\n end", "def set_score\n @score = Score.find(params[:id])\n end", "def set_score\n @score = Score.find(params[:id])\n end", "def set_score\n @score = Score.find(params[:id])\n end", "def set_score\n @score = Score.find(params[:id])\n end", "def set_score\n @score = Score.find(params[:id])\n end", "def set_score\n @score = Score.find(params[:id])\n end", "def set_score\n @score = Score.find(params[:id])\n end", "def set_score\n @score = Score.find(params[:id])\n end", "def set_score\n @score = Score.find(params[:id])\n end", "def set_key(key, &block)\n @callbacks[key.ord] = block\n end", "def set_score\n if $Iterator >= 0 && $Iterator < $Length\n @questions = @subgenre.questions.all\n @question = @questions[$Iterator]\n @options = @question.options.all\n @useranswers = params[:answer_ids]\n flag = 0\n if !@useranswers\n flag = 1\n else\n for option in @options\n if @useranswers.include? (option.id).to_s && option.isanswer == 0\n flag = 1\n break\n elsif option.isanswer == 1 && !(@useranswers.include? (option.id).to_s)\n flag = 1\n break\n end\n end\n end\n if flag == 0\n @stat = Stat.find_by(subgenre_id: @subgenre.id, user_id: session['user_id'])\n x = @stat.score\n y = @question.score\n @stat.update_attributes(score: x+y)\n end\n end\n end", "def set key, value, exp\n @redis.setex key, exp, value\n end", "def set(key, value)\n change(:set, key, value)\n end", "def update!(**args)\n @foreign_meta_score = args[:foreign_meta_score] if args.key?(:foreign_meta_score)\n @hidden_ratio_score = args[:hidden_ratio_score] if args.key?(:hidden_ratio_score)\n @num_tidbits_score = args[:num_tidbits_score] if args.key?(:num_tidbits_score)\n @num_visible_tokens_score = args[:num_visible_tokens_score] if args.key?(:num_visible_tokens_score)\n @outlink_score = args[:outlink_score] if args.key?(:outlink_score)\n @redundancy_score = args[:redundancy_score] if args.key?(:redundancy_score)\n @sentence_start_score = args[:sentence_start_score] if args.key?(:sentence_start_score)\n end", "def score=(new_score)\n @score = new_score && new_score != '.' ? new_score.to_f : nil\n end", "def set(key, value)\n self.data[key] = { value: value, timestamp: Time.now.to_i }\n self.data[key][:value]\n end", "def add_new_key(school, ranking, value)\n\tschool[ranking] = value\nend", "def zrank(key, member)\n node_for(key).zrank(key, member)\n end", "def initialize_score(player)\n\n player.score = 3\n\nend", "def p1_set_score(match)\n @match = match\n mail to: @match.p2.email,\n subject: @match.league.name + \": Score set \" +\n @match.p1_score.to_s + \"-\" + @match.p2_score.to_s +\n \" in match vs. \" + @match.p1.alias\n end", "def set_members(key)\n timeout_retry(3, 3){\n write \"SMEMBERS #{key}\\r\\n\"\n Set.new(multi_bulk_reply)\n }\n end", "def add_score(name,score)\n @scores[name] = score \n end", "def update_rank\n self.score = calculate_score\n self.save\n end", "def key=(value)\n @key = value\n end", "def key=(value)\n @key = value\n end", "def set_record_score\n @record_score = RecordScore.find(params[:id])\n end", "def set_value(key, value)\n unless VALID_KEY.match?(key) && VALID_VALUE.match?(value)\n OpenTelemetry.logger.debug(\"Invalid Tracestate member - #{key} : #{value}\")\n return self\n end\n\n h = Hash[@hash]\n h[key] = value\n self.class.create(h)\n end", "def []=(key, value)\n @mutex.synchronize { @hash[key] = value }\n end", "def setnx(key, value); end" ]
[ "0.7154557", "0.67875224", "0.6729386", "0.6463389", "0.6213083", "0.6131967", "0.6084888", "0.60824776", "0.6057043", "0.6057043", "0.59115064", "0.58831245", "0.5716548", "0.57134265", "0.5702379", "0.5685153", "0.5678638", "0.56314796", "0.5629938", "0.5628831", "0.5615831", "0.5615831", "0.5614104", "0.5575203", "0.5509563", "0.55040854", "0.54990715", "0.54670876", "0.5458052", "0.5432704", "0.5432704", "0.5431792", "0.54137707", "0.541108", "0.5402968", "0.5373166", "0.5368226", "0.5367253", "0.5347714", "0.5339962", "0.531984", "0.53037864", "0.52901554", "0.528806", "0.52670544", "0.52670544", "0.5266889", "0.52561015", "0.52367425", "0.52302015", "0.52297217", "0.522276", "0.52162796", "0.52001756", "0.51996547", "0.5179993", "0.5178813", "0.5178813", "0.516979", "0.51679254", "0.5161331", "0.51553726", "0.5150119", "0.51383686", "0.51383686", "0.5138203", "0.51352376", "0.51302314", "0.51302314", "0.51230943", "0.51230943", "0.51230943", "0.51230943", "0.51230943", "0.51230943", "0.51230943", "0.51230943", "0.51230943", "0.51230943", "0.51230943", "0.5120169", "0.5099606", "0.5099065", "0.5095934", "0.50916684", "0.5091448", "0.507796", "0.50758964", "0.5075559", "0.5075088", "0.50734514", "0.50721973", "0.50699204", "0.5067673", "0.506692", "0.506692", "0.50583845", "0.5051325", "0.5048816", "0.5034827" ]
0.7005211
1
Increments the `member` in `key` by `score`
def zincr(key, member, score = 1) mon_synchronize do perform ["zincr", key, member, score], :proc => T_INT end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zincr(key, member, score = 1)\n mon_synchronize do\n perform [\"zincr\", key, member, score], proc: T_INT\n end\n end", "def add(member, score)\n conn.zadd key, score, member\n self\n end", "def []=(key, score)\n update_condition = ->(redis) do\n current_score = redis.zscore(@redis_key, key)\n !current_score || current_score < score\n end\n update_action = ->(redis) do\n redis.zadd(@redis_key, score, key)\n end\n redis_safe_update([@redis_key], update_condition, update_action)\n score\n end", "def score(member)\n conn.zscore(key, member)\n end", "def increment_member_score(lb, handle, score, json)\n increment_by = score\n # if they already exist, add their new score to their current\n score = score + lb.score_for(handle).to_i if lb.score_for(handle)\n lb.rank_member(handle, score, json)\n {:status => \"success\", :message => \"Added #{increment_by} to #{handle} for a current score of #{score}.\"}.to_json\nrescue Exception => e\n {:status => \"error\", :message => e.message}.to_json\nend", "def score(player)\n @players[player][:score] += 1\nend", "def zset(key, member, score)\n mon_synchronize do\n perform [\"zset\", key, member, score], proc: T_BOOL\n end\n end", "def zscore(key, member); end", "def zscore(key, member); end", "def zset(key, member, score)\n mon_synchronize do\n perform [\"zset\", key, member, score], :proc => T_BOOL\n end\n end", "def put(score, value)\n connection.zadd(key_label, score, value)\n end", "def update_score_by(value)\n @score.increment_by(value)\n end", "def update_score!(points)\n increment!(:score, points)\n end", "def inc_score(table, user)\n ZSet.inc_score(table, user)\n end", "def append(key, value, score)\n # attempt the transaction, retrying a limited number of\n # times if the WATCH makes us bail.\n retry_counter = 0\n while retry_counter < @retry_limit\n # Have to put the watch inside the retry loop because\n # calling EXEC clears all watches.\n # TODO: maybe we want to have Composite#watch(@index) ??\n watch(@index)\n\n # get highest score from the Sorted Set and increment the\n # input score if necessary.\n _value, high_score = @index.last(:with_scores => true)\n if high_score\n if score <= high_score.to_i\n score = high_score.to_i + 1\n end\n end\n\n if set(key, value, score)\n return score\n else\n retry_counter += 1\n end\n end\n\n raise \"Optimistic locking failed too many times\"\n end", "def add_point\n @score += 1\n end", "def increment(value, score=1, session=nil)\n start_kvs_session(session) do |kvs|\n kvs.sorted_sets[key_name(Time.now)].increment(value, score).to_i\n end\n end", "def add_score\n transaction do\n self.player.points = self.player.points + 1\n if self.player.save\n self.player.team.score = self.player.team.score + 1\n self.player.team.save\n end\n self.player.inc_score_stats\n end\n end", "def give_score(uid, name, score)\n unless @scores.key? uid\n self.init_user_score(uid, 'name')\n end\n\n @scores[uid]['score'] += score\n\n unless @scores[uid]['name'] == name\n self.update_user_name uid, name\n end\n end", "def update_score!(sum_cards, score)\n if sum_cards[:user] > sum_cards[:dealer]\n score[:user] += 1\n elsif sum_cards[:user] < sum_cards[:dealer]\n score[:dealer] += 1\n end\nend", "def gain_point\n @score += 1\n end", "def zscore(key, member)\n call(key, [:zscore, key, member], transform: Redis::Floatify, read: true)\n end", "def inc_hit(key, options)\n if @hits[key]\n @hits[key]+=1\n else\n @hits[key]=1\n end\n end", "def inc_hit(key, options)\n if @hits[key]\n @hits[key]+=1\n else\n @hits[key]=1\n end\n end", "def player_score(score)\n @grand_total += (score)\n end", "def zincrby(key, increment, member); end", "def zincrby(key, increment, member); end", "def gain_a_point\n\n self.score += 1\n\n end", "def update_score(user_id, score = 0)\n key = \"user_score:#{user_id}\"\n user_score = $redis.get(key)\n last_user_answered = user_id\n if user_score.nil?\n $redis.set(key, score)\n score\n else\n new_score = user_score.to_i + score\n $redis.set(key, new_score)\n new_score\n end\nend", "def increment(key)\n @counter[key] += 1\n end", "def zscore(key, member)\n node_for(key).zscore(key, member)\n end", "def update_score()\r\n @score += GAME_PRESET[\"score_increment\"]\r\n end", "def incr(key); end", "def incr(key); end", "def set(key, value, score)\n success = multi do\n @hash.set(key, value)\n @index.add(score, key)\n end\n if success && @size_limit && (@size_limit > 0) && (self.size > @size_limit)\n self.truncate(@size_limit)\n end\n success\n end", "def update_score\n \t\tuser.score += 10\n user.save\n\tend", "def gain_points\n @score += 1\n end", "def zrank(key, member); end", "def zrank(key, member); end", "def add_to_score_hash(markable, score)\n scores_hash[assessment_group.id][markable.id][student.id] = score\n end", "def inc(key)\n \n end", "def _inc(key,value)\n _set(key, (_get(key) || 0) + value)\n end", "def add_to_score name, score = OTHER_SCORES[name]\n @calls[signature][name] += score * @multiplier\n end", "def increase_scn_score\n count = voteable.user.scn_score\n count = count + 1\n voteable.user.update_attributes(scn_score: count)\n end", "def add_to_player_score (player)\r\n\tplayer.player_wins += 1\r\n\t@total_number_of_plays += 1\r\n\tend", "def incr(key)\n node_for(key).incr(key)\n end", "def update_stats(state, score)\n if @state_stats.has_key?(state)\n @state_stats[state][:score] += score\n @state_stats[state][:tries] += 1\n else\n @state_stats[state] = { :score => score, :tries => 1}\n end\n end", "def update_total_score\n @total_score += @score\n end", "def AddPoints(score)\n\tscore = score + 100\nend", "def rescore(delta)\n self.score += delta\n self.save!\n end", "def zincrby(key, increment, member)\n node_for(key).zincrby(key, increment, member)\n end", "def add_score(name,score)\n @scores[name] = score \n end", "def incrby(key, increment); end", "def incrby(key, increment); end", "def inc_score(table, user)\n raise NotImplementedError, \"Implement this method in a child class\"\n end", "def addScore _score=0\n SQF.addScore @this, _score\n end", "def increment_counter(key)\n if @counters.key?(key)\n @counters[key] += 1\n else\n @counters[key] = 1\n end\n end", "def inc_rater_score(add)\n if add || false\n fu = self._call_for_rater\n fu.score += add \n end\n #puts \"add: #{add}\"\n add\n end", "def add_vote(vote)\n self.score = self.score + vote.value\n self.votes_count = self.votes_count + 1\n end", "def update_score!\n entries = leaderboards.to_a.map do |lb|\n lb.entrys.where(user: self).last\n end\n\n value = entries.map { |e| e.leaderboard.scored ? Score.value(e.rank) : 0 }.reduce(:+)\n\n update(score: value)\n\n value\n end", "def update_score(score, board)\n if detect_winner(board) == 'Player'\n score[0] += 1\n else\n score[1] += 1\n end\nend", "def increment_scores_index\n @scores_idx +=1 if valid_scores_idx?(@scores_idx + 1)\n self\n end", "def zincrby(key, increment, member)\n call(key, [:zincrby, key, increment, member], transform: Redis::Floatify)\n end", "def increment(key, val)\n self[key] += _floatify(val)\n end", "def update_rank\n self.score = calculate_score\n self.save\n end", "def incement_score\r\n\t\t \t @score += 2000\r\n\t\t end", "def incrbyfloat(key, increment); end", "def incrbyfloat(key, increment); end", "def increment\n Dictionary.db.zincrby @key, 1, @value\n end", "def increase key, amount=1\n @lock.write_sync do\n return unless @data[key].nil? || Numeric === @data[key]\n @data[key] ||= 0\n @data[key] += amount\n end\n end", "def initialize( key, score )\n @key = key\n @score = score\n end", "def inc_highscore(user)\n inc_score(highscore_table, user)\n # update time\n Bazz::Utils::Redis.set(highscore_time(user), Time.new.to_i.to_s)\n end", "def increment_hits\n @node.increment_hits! if @node\n end", "def set_member_score(lb, handle, score, json)\n if (params[:score].to_i == -1)\n lb.remove_member(handle)\n {:status => 'success', :message => \"#{params[:handle]} removed from the #{params[:leaderboard]} leaderboard.\"}.to_json\n else\n lb.rank_member(handle, score, json)\n {:status => \"success\", :message => \"Set score for #{handle} to #{score}.\"}.to_json\n end\nrescue Exception => e\n {:status => \"error\", :message => e.message}.to_json\nend", "def increment_win_score\n PlayerModelContracts.invariant(self)\n @score = @score + 1\n end", "def score\n Dictionary.db.zscore(@key, @value).to_i\n end", "def score(player)\n\t$running = false\n\tplayer.score += 1\n\t$gui.show_scored(player.name)\n\t$gui.show_info()\n\t$gui.update_score($p1.score, $p2.score)\nend", "def add_hit\n @hits += 1\n :hit\n end", "def score(value)\n connection.zscore(key_label, value)\n end", "def increment!(subject, val = 1)\n $redis.incrby(key(subject), val)\n end", "def add_score(score_name, score)\n # Append player name and id to each note for debugging\n dup_score = set_added_score_note_attrs score\n @scores[score_name] = dup_score\n @scores_ordered_names << score_name\n # If there were no scores, set index to new first score\n @scores_idx = 0 if @scores_idx == -1\n self\n end", "def increment(key, amount=1, &block)\n if block.nil?\n key_to_use = key\n else\n key_to_use = self.keys.detect { |k| block.call(key, k) } \n end\n \n if self[key_to_use].nil?\n self[key_to_use] = amount\n else\n self[key_to_use] += amount\n end\n end", "def update_score\n if @round_won\n @player.increment_rounds_won\n else\n @player.increment_rounds_lost\n end\n end", "def ickadd(ick_key,*score_member_pairs)\n if !ick_key.is_a?(String)\n raise ArgumentError, \"bogus non-String ick_key #{ick_key}\"\n end\n if score_member_pairs.size.odd?\n raise ArgumentError, \"bogus odd-numbered #{score_member_pairs}\"\n end\n score_member_pairs.each_slice(2) do |slice|\n score, member = slice\n if ! score.is_a? Numeric\n raise ArgumentError, \"bogus non-Numeric score #{score}\"\n end\n if ! member.is_a? String\n raise ArgumentError, \"bogus non-String member #{member}\"\n end\n end\n _statsd_increment('profile.ick.ickadd.calls')\n _statsd_timing('profile.ick.ickadd.pairs',score_member_pairs.size / 2)\n _statsd_time('profile.ick.time.ickadd') do\n _eval(LUA_ICKADD,ick_key,*score_member_pairs)\n end\n end", "def zdecr(key, member, score = 1)\n mon_synchronize do\n perform [\"zdecr\", key, member, score], proc: T_INT\n end\n end", "def set_score(num, socre)\n @game[num] = score\n end", "def pfadd(key, member); end", "def updateScore(score, result)\n\tif result == \"P1 wins!\"\n\t\tscore[\"Player 1\"] += 1\n\telsif result == \"P2 wins!\"\n\t\tscore[\"Player 2\"] += 1\n\tend\n\tputs result\n\tputs \"Current score:\\n Player 1: \" + score[\"Player 1\"].to_s + \" Player 2: \" + score[\"Player 2\"].to_s + \"\\n\\n\"\n\treturn score\nend", "def update_score(accumulated_score)\n @net_score += accumulated_score\n puts \"Total turn score: #{accumulated_score}, net score: #{@net_score}\"\n @net_score\n end", "def incrby(key, increment)\n node_for(key).incrby(key, increment)\n end", "def zdecr(key, member, score = 1)\n mon_synchronize do\n perform [\"zdecr\", key, member, score], :proc => T_INT\n end\n end", "def win\n @score += 1\n end", "def win\n @score += 1\n end", "def assign_score; end", "def score_player(player)\n score = 0\n player.hand.each do |card|\n score += card.value\n end\n player.update_score(score)\n end", "def score(player)\n @score[player]\n end", "def update!(**args)\n @score = args[:score] if args.key?(:score)\n end", "def update!(**args)\n @score = args[:score] if args.key?(:score)\n end", "def zrank(key, member)\n call(key, [:zrank, key, member], read: true)\n end", "def update_score()\n\t\t# Uses ELO rating to calculate new rank for both users. Ref: https://metinmediamath.wordpress.com/2013/11/27/how-to-calculate-the-elo-rating-including-example/\n\t\t# Updates score by adding game scores to players score\n\tend" ]
[ "0.77639544", "0.74010384", "0.72462547", "0.7201458", "0.7091968", "0.69084466", "0.68013626", "0.67986935", "0.67986935", "0.67018306", "0.66687614", "0.6572654", "0.65612507", "0.65565073", "0.6539253", "0.6500143", "0.6478672", "0.642778", "0.64001894", "0.6373067", "0.6363128", "0.6334131", "0.6326256", "0.6326256", "0.63226223", "0.6320989", "0.6320989", "0.6320149", "0.6317472", "0.6313907", "0.6283309", "0.62789804", "0.6261013", "0.6261013", "0.62235886", "0.62151575", "0.6207713", "0.6206137", "0.6206137", "0.6201978", "0.6187639", "0.61781794", "0.61759096", "0.6175809", "0.615928", "0.6147228", "0.61247075", "0.61206144", "0.6113204", "0.6068517", "0.6067379", "0.6056629", "0.602017", "0.602017", "0.60119575", "0.5973629", "0.59696525", "0.5968562", "0.5936055", "0.59319556", "0.59283483", "0.58971244", "0.5881196", "0.5861837", "0.58471406", "0.5837444", "0.58347094", "0.58347094", "0.5830669", "0.5824343", "0.5819161", "0.58092886", "0.5809124", "0.58044446", "0.5800552", "0.5766475", "0.5750056", "0.5741824", "0.57260567", "0.57198274", "0.56990033", "0.5697974", "0.5696028", "0.56952643", "0.5692802", "0.56879437", "0.5686025", "0.5685329", "0.56781346", "0.567594", "0.5668679", "0.5657269", "0.5657269", "0.5656535", "0.5653801", "0.5640648", "0.56318665", "0.56318665", "0.5627618", "0.56267864" ]
0.7730227
1
Decrements the `member` in `key` by `score`
def zdecr(key, member, score = 1) mon_synchronize do perform ["zdecr", key, member, score], :proc => T_INT end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zdecr(key, member, score = 1)\n mon_synchronize do\n perform [\"zdecr\", key, member, score], proc: T_INT\n end\n end", "def delete_score\n transaction do\n self.player.points = self.player.points - 1\n if self.player.save\n self.player.team.score = self.player.team.score - 1\n self.player.team.save\n end\n self.player.dec_score_stats\n end\n end", "def zincr(key, member, score = 1)\n mon_synchronize do\n perform [\"zincr\", key, member, score], proc: T_INT\n end\n end", "def zincr(key, member, score = 1)\n mon_synchronize do\n perform [\"zincr\", key, member, score], :proc => T_INT\n end\n end", "def zrem(key, member); end", "def zrem(key, member); end", "def decrease key, amount=1\n @lock.write_sync do\n return unless @data[key].nil? || Numeric === @data[key]\n @data[key] ||= 0\n @data[key] -= amount\n end\n end", "def zset(key, member, score)\n mon_synchronize do\n perform [\"zset\", key, member, score], proc: T_BOOL\n end\n end", "def []=(key, score)\n update_condition = ->(redis) do\n current_score = redis.zscore(@redis_key, key)\n !current_score || current_score < score\n end\n update_action = ->(redis) do\n redis.zadd(@redis_key, score, key)\n end\n redis_safe_update([@redis_key], update_condition, update_action)\n score\n end", "def RemovePoints(score)\n\tscore = score - 50\nend", "def decr(key); end", "def decr(key); end", "def zscore(key, member); end", "def zscore(key, member); end", "def remove_vote(vote)\n self.score = self.score - vote.value\n self.votes_count = self.votes_count - 1\n end", "def score(member)\n conn.zscore(key, member)\n end", "def decrement_scores_index\n @scores_idx -=1 if valid_scores_idx?(@scores_idx - 1)\n self\n end", "def zset(key, member, score)\n mon_synchronize do\n perform [\"zset\", key, member, score], :proc => T_BOOL\n end\n end", "def decrement(key)\n msg = 'Trying to reduce count below zero.'\n raise RangeError, msg if @counter[key] == 0\n @counter[key] -= 1\n end", "def remove_score(score_name)\n dead_score = nil\n @scores_ordered_names.each do |name|\n if name == score_name\n dead_score = @scores[score_name]\n break\n end\n end\n # If score_idx is on last position and we're deleting that position, move it into a valid position\n @scores_idx -= 1 if @scores_idx == @scores.length - 1\n @scores.delete dead_score\n @scores_ordered_names.delete score_name\n self\n end", "def lose_a_point\n\n self.score -= 1\n\n end", "def zrem(key, member)\n node_for(key).zrem(key, member)\n end", "def decr(key)\n node_for(key).decr(key)\n end", "def zscore(key, member)\n call(key, [:zscore, key, member], transform: Redis::Floatify, read: true)\n end", "def zrem(key, member)\n call(key, [:zrem, key, member])\n end", "def decrby(key, decrement); end", "def decrby(key, decrement); end", "def zscore(key, member)\n node_for(key).zscore(key, member)\n end", "def zrevrank(key, member); end", "def zrevrank(key, member); end", "def decrease_scn_score\n count = voteable.user.scn_score\n count = count - 1\n voteable.user.update_attributes(scn_score: count)\n end", "def delete(key)\n @succ.delete key\n end", "def dec_rater_score(remove)\n if remove || false\n fu = self._call_for_rater\n fu.score -= remove \n fu.score = 0 if fu.score < 0\n end\n #puts \"remove: #{remove}\"\n remove\n end", "def decr(key, value = 1)\n mon_synchronize do\n perform [\"decr\", key, value], proc: T_INT\n end\n end", "def decr(key, value = 1)\n mon_synchronize do\n perform [\"decr\", key, value], :proc => T_INT\n end\n end", "def delete(key)\n self.map_var.each_with_index do |pair, idx|\n if pair[0] == key \n first_half = self.map_var[0...idx] \n second_half = self.map_var[idx+1..-1]\n self.map_var = first_half + second_half\n break\n end \n end\n end", "def delete(key)\n @mutex.synchronize do\n x = anchor\n level = node_level(x)\n update = Array.new(level)\n x = find_with_update(x, level, key, update)\n \n # remove existing key\n \t if node_compare(x, key) == 0\n \t level = node_level(x)\n \t while level > 0\n \t level -= 1\n \t node_delete_after!(x, update[level], level)\n end\n \t end\n end\n \tself\n \tend", "def set(key, value, score)\n success = multi do\n @hash.set(key, value)\n @index.add(score, key)\n end\n if success && @size_limit && (@size_limit > 0) && (self.size > @size_limit)\n self.truncate(@size_limit)\n end\n success\n end", "def delete key\n slot = _find_slot(key)\n return nil if !@data[slot]\n value = @data[slot+1]\n @data[slot] = DELETED\n @data[slot+1] = nil\n\n # Unlink record\n n = @data[slot+2]\n prev = @data[slot+3]\n if prev\n @data[prev+2] = n\n end\n if n\n @data[n+3] = prev\n end\n if @first == slot\n @first = n\n end\n if @last == slot\n @last = prev\n end\n\n # FIXME: It fails without this, which indicates a bug.\n #@length -= 1\n value\n end", "def remove(key)\n \txk = key % 10001 \n xk = (xk + 1) % 10001 while @arr[xk].first != nil && @arr[xk].first != key \n @arr[xk] = [nil, -1] if @arr[xk].first == key\n end", "def zdel(key, member)\n mon_synchronize do\n perform [\"zdel\", key, member], proc: T_BOOL\n end\n end", "def downvote(id)\n @redis.hincrby(\"id:\"+id,\"score\",-1)\n end", "def add(member, score)\n conn.zadd key, score, member\n self\n end", "def dec(key)\n \n end", "def reset_score\n @score = 0\n end", "def update_score!(points)\n increment!(:score, points)\n end", "def remove_three_and_score(k, v)\n 3.times { v.pop }\n k == 1 ? @current_score += 1000 : @current_score += (k * 100)\n @number_of_dice -= 3\n end", "def delete_scores\n end", "def decrement(key, offset=1)\n ret, value = Lib.memcached_decrement(@struct, key, offset)\n check_return_code(ret, key)\n value\n rescue => e\n tries ||= 0\n raise unless tries < options[:exception_retry_limit] && should_retry(e)\n tries += 1\n retry\n end", "def zdel(key, member)\n mon_synchronize do\n perform [\"zdel\", key, member], :proc => T_BOOL\n end\n end", "def remove(key)\n unless get(key) == -1\n @count -= 1\n bucket = @map[key.hash % @size]\n bucket.reject! {|k, v| k == key}\n end\n end", "def remove(key)\n\n if include?(key)\n self[key].delete(key)\n @count -= 1\n end\n\n end", "def delete_pair(key)\r\n @redis.del key \r\n end", "def delete(key)\n if item = super\n lru_delete(item)\n end\n end", "def zrank(key, member); end", "def zrank(key, member); end", "def lose_pts\n self.score -= 1\n end", "def remove(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def del(key)\n @first.del(key)\n end", "def _dec(key,value)\n _set(key, (_get(key) || 0) - value)\n end", "def delete(key, child)\n\t\t\t\tif key\n\t\t\t\t\t@keyed.delete(key)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t@state.delete(child)\n\t\t\tend", "def destroy\n @score.destroy\n end", "def delete\n redis.del key\n end", "def delete(key)\n key = find(key) unless key.is_a? Node\n case child_count(key)\n when 2\n sub = key.right.data == nil ? max(key.left) : min(key.right)\n when 1\n sub = key.right.nil? ? key.left : key.right\n when 0\n sub = nil\n end\n modify(key, sub)\n end", "def update_score(user_id, score = 0)\n key = \"user_score:#{user_id}\"\n user_score = $redis.get(key)\n last_user_answered = user_id\n if user_score.nil?\n $redis.set(key, score)\n score\n else\n new_score = user_score.to_i + score\n $redis.set(key, new_score)\n new_score\n end\nend", "def delete(key)\r\n\t\t# If key does not exist then return nil otherwise delete node from list\r\n\t\t# and decrease total number of items in Hashmap by 1\r\n\t\treturn nil if key == nil || !get(key)\r\n\t\tindex = key.hash % @size\r\n\t\t@total -= 1\r\n\t\treturn @arr[index].delete(key)\r\n\tend", "def zrevrank(key, member)\n call(key, [:zrevrank, key, member], read: true)\n end", "def delete_key(key)\n end", "def change_score\n @lives = @lives - 1\n end", "def delete(key)\n hashed_key = key.hash\n bucket_index = hashed_key % num_buckets\n return nil if !@store[bucket_index].include?(key)\n @count -=1\n @store[bucket_index].remove(key)\n end", "def wrong_answer\n @score -= 1\n end", "def get_the_score(score)\n score = score.dup\n score.delete(\"o\")\n @hits = score.length\n end", "def get_the_score(score)\n score = score.dup\n score.delete(\"o\")\n @hits = score.length\n end", "def rescore!(score) self.score=score; save! end", "def update_score!(sum_cards, score)\n if sum_cards[:user] > sum_cards[:dealer]\n score[:user] += 1\n elsif sum_cards[:user] < sum_cards[:dealer]\n score[:dealer] += 1\n end\nend", "def remove(value)\n connection.zrem(key_label, value)\n end", "def decr(att)\n raise ArgumentError unless counters.include?(att)\n write_local(att, db.decr(key(att)))\n end", "def score(player)\n @players[player][:score] += 1\nend", "def delete key\n rv = self[key]\n self.removeField key\n return rv\n end", "def decrement(key, amount = 1, options = {})\n increment(key, -amount, options)\n end", "def lrem(key, count, value)\n node_for(key).lrem(key, count, value)\n end", "def zrevrank(key, member)\n node_for(key).zrevrank(key, member)\n end", "def set_member_score(lb, handle, score, json)\n if (params[:score].to_i == -1)\n lb.remove_member(handle)\n {:status => 'success', :message => \"#{params[:handle]} removed from the #{params[:leaderboard]} leaderboard.\"}.to_json\n else\n lb.rank_member(handle, score, json)\n {:status => \"success\", :message => \"Set score for #{handle} to #{score}.\"}.to_json\n end\nrescue Exception => e\n {:status => \"error\", :message => e.message}.to_json\nend", "def lrem(key, count, value); end", "def lrem(key, count, value); end", "def delete(key)\n pop if change_key(key, nil, true)\n end", "def del(key)\n position = find(key)\n if position != nil\n # delete\n value = @values[position]\n @slots[position] = nil\n @values[position] = nil\n value\n else\n nil\n end\n end", "def after_delete\n redis.del(rank_key)\n end", "def delete key\n @internal_hash[key].clear\n end", "def delete(entry)\n deleted_index = @cache.delete(key_for(entry))\n if deleted_index\n @cache.each do |key, index|\n @cache[key] -= 1 if index > deleted_index\n end\n end\n deleted_index\n end", "def delete(key)\n value = self[key]\n\n @memcached.delete key\n\n value\n end", "def remove_customer_cash(customer, cost)\n return customer[:cash] -= cost\nend", "def put(score, value)\n connection.zadd(key_label, score, value)\n end", "def remove(num)\n @count -= 1\n self[num].delete(num)\n end", "def decrease(counter)\n counter[0] -= 1\nend" ]
[ "0.7171971", "0.66796994", "0.6355409", "0.63182896", "0.6274033", "0.6274033", "0.6250731", "0.62432873", "0.6227282", "0.6217739", "0.61954737", "0.61954737", "0.61909205", "0.61909205", "0.6168629", "0.6164304", "0.61160076", "0.61141527", "0.6063342", "0.6016244", "0.60006815", "0.59838563", "0.5970976", "0.59316564", "0.5875597", "0.58730066", "0.58730066", "0.5840396", "0.5839509", "0.5839509", "0.57932645", "0.57922846", "0.57826006", "0.57743835", "0.5765558", "0.5763383", "0.57573926", "0.5756996", "0.57245576", "0.5723796", "0.56836486", "0.5674571", "0.56726116", "0.56631935", "0.5652201", "0.5633095", "0.56250644", "0.562022", "0.5592497", "0.5592029", "0.55779845", "0.5567845", "0.5557897", "0.5553807", "0.5551354", "0.5551354", "0.55290186", "0.552351", "0.5519241", "0.5519241", "0.5519241", "0.5519241", "0.5519241", "0.55164677", "0.55038744", "0.5491826", "0.5477936", "0.547731", "0.54712677", "0.5460267", "0.5452049", "0.54473674", "0.54426265", "0.5438672", "0.5433182", "0.541705", "0.54160154", "0.54160154", "0.5412672", "0.54075867", "0.5388738", "0.5385312", "0.537425", "0.53451014", "0.53445846", "0.532889", "0.53262043", "0.5316579", "0.5315533", "0.5315533", "0.53061765", "0.529832", "0.5292161", "0.5285162", "0.52844346", "0.5277593", "0.5277235", "0.5270623", "0.52705103", "0.52558" ]
0.71095705
1
Checks existence of a zset at `key`.
def zexists(key) mon_synchronize do perform ["zexists", key], :proc => T_BOOL end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zexists(key)\n mon_synchronize do\n perform [\"zexists\", key], proc: T_BOOL\n end\n end", "def exist?(key)\n !@store.select { |i| i[:key] == build_key(key) }.empty?\n end", "def exist(key)\n check_return_code(\n Lib.memcached_exist(@struct, key),\n key\n )\n end", "def exist? _key\n store.transaction(:read_only) do |s|\n s.roots.any? { |r| r.to_sym == _key.to_sym }\n end\n end", "def has_key?(key); end", "def has_key?(key); end", "def exists(key)\n mon_synchronize do\n perform [\"exists\", key], proc: T_BOOL\n end\n end", "def exists?(key)\n key.present? && manager.key?(key)\n end", "def exists?(key)\n @redis.exists(prefix(key))\n end", "def exist?(key)\n with_client do |client|\n !client.exists(build_key(key)).zero?\n end\n end", "def exists(key)\n mon_synchronize do\n perform [\"exists\", key], :proc => T_BOOL\n end\n end", "def is_key_exist(key)\r\n (@redis.exists key) ? true : false \r\n end", "def exists(key)\n call(key, [:exists, key], transform: Redis::Boolify, read: true)\n end", "def has?(key)\n [cache, values].any? { |store| store.keys.include?(key.to_sym) }\n end", "def has_key?(key)\n @cache.has_key?(key)\n end", "def exists?(key)\n @data.has_key?(key) && @data[key].valid?(self)\n end", "def has?(key)\n node = _get(@root, key)\n !node.nil? && !node.undefined?\n end", "def exist?(key)\n store.key?(key)\n end", "def has_key? key; key? key; end", "def has_key?(key)\n !get(key).nil?\n end", "def has_key?(key)\n !get(key).nil?\n end", "def has_key?(key)\n !find_node(key).nil?\n end", "def exist?(key)\n\n end", "def exists?(key)\n unimplemented\n end", "def exists?(key)\n s3_object(key).exists?\n end", "def has_key?(key)\n @stored[key] && !@stored[key].empty? ? true : false\n end", "def exist?(key)\n jiak.client.exist?(jiak.bucket,key)\n end", "def exist?(key)\n !find(key).nil?\n end", "def has_key?(key)\n @db.each_key do\n\t|k|\n\treturn true if k == key\n end\n end", "def contains?(key)\n @key_data.has_key?(key)\n end", "def exists?(key)\n # Use recommended binary-returning method create [with this redis-rb commit](https://github.com/redis/redis-rb/commit/bf42fc9e0db4a1719d9b1ecc65aeb20425d44427).\n return Lit.redis.exists?(key) if Lit.redis.respond_to?(:exists?)\n\n # Fall back with older gem\n Lit.redis.exists(key)\n end", "def has_key?(key)\n keys.include?(key)\n end", "def contains?(key)\n not get(key).nil?\n end", "def has_key?(key)\n any? {|mod| mod.name == key}\n end", "def has_key?(key)\n @hash.has_key?(key)\n end", "def has_key?(key)\n dummy = Pair.new(key,nil)\n return @tree.get(dummy)\n end", "def exist?(key, options = {})\n invoke(:exist?, key) do |store|\n store.exists(namespaced_key(key, merged_options(options)))\n end\n end", "def exist?(key)\n File.exist?(cache_path(key))\n end", "def has_key(hash, key)\n\thash.has_key? key\nend", "def has_key?( key )\n key = UniMap.str_to_key( key ) unless key.is_a?( Key )\n key && contains_key( key )\n end", "def has_key?(key)\n configs.has_key?(key) || store.has_key?(key) \n end", "def has_key?(p0) end", "def contains?(key)\n @semaphore.synchronize {\n @key_data.has_key?(key)\n }\n end", "def exists?\n retrieve\n true\n rescue Error::NoSuchKey\n false\n end", "def has_key?(key)\n @table.get(key) != nil\n end", "def exists?(key)\n raise \"Method not implemented. Called abstract class.\"\n end", "def exists?(type, key)\n require_layers!\n layers.each do |layer|\n return true if layer.exists?(type, key)\n end\n false\n end", "def exists?(key, bucket = nil)\n about(key, bucket)\n true\n rescue NoSuchKey\n false\n end", "def has_key? key\n @lock.read_sync{ @data.has_key? key }\n end", "def has_key?(key)\n\t\tmust_be_in_synchronize_block\n\t\treturn @collection.has_key?(key)\n\tend", "def exists(key, options = nil)\n policy = create_policy(options, Policy, default_read_policy)\n command = ExistsCommand.new(@cluster, policy, key)\n execute_command(command)\n command.exists\n end", "def GOAL_IS_SET(key)\n GOAL(key).is_set?\n rescue\n nil\n end", "def contains?(key)\n position = search(key)\n (key <=> @keys[position]) == 0\n end", "def has_key?(key)\n return self.fetch(key) ? true : false\n end", "def check_key_exist url_key\n @url_generators = UrlGenerator.all\n @url_generators.each do |url_generator|\n if url_generator.key == url_key\n return true\n end\n end\n return false\n end", "def exists?(cache_key)\n @pg.exec_prepared(@exists_statement_name, [object_to_cache_key(cache_key)]).ntuples.eql?(1)\n end", "def exists?(*keys); end", "def exists?(type, key)\n if directory(type, key)&.files&.head(key_component(type, key))\n true\n else\n false\n end\n end", "def has_key?(key)\n !!fetch(key)\n rescue ContextMiss\n false\n end", "def exist?(key, options = {})\n exist(key)\n true\n rescue NotFound\n false\n rescue Error => e\n log_exception e\n end", "def exist?(key)\n raise NotImplementedError\n end", "def has_key?(key)\n return to_h().has_key?(key)\n end", "def in?(key)\n start_slot = hasher(key, @keys.size)\n position = start_slot\n found = false\n\n while @keys[position] != nil and !found\n if @keys[position] == key\n found = true\n else\n position = rehash(position, @keys.size)\n break if position == start_slot\n end\n end\n\n found\n end", "def has?(key)\n @properties.has_key?(key)\n end", "def has?(key)\n @definitions.has_key?(key)\n end", "def exist?(key)\n instrument :exist, key: key do |payload|\n id = map_key_to_id(key)\n answer = id.present?\n\n payload[:exist] = answer\n answer\n end\n end", "def shell_registry_key_exist?(key)\n begin\n key = normalize_key(key)\n rescue ArgumentError\n return false\n end\n\n results = shell_registry_cmd(\"query \\\"#{key}\\\"\")\n if results =~ /ERROR: /i\n return false\n else\n return true\n end\n end", "def has_key?(key)\n @map.has_key?(key.to_sym)\n end", "def include?(key)\n has_key?(key)\n end", "def has_key?(key)\n @h.has_key?(key.to_sym)\n end", "def include?(key)\n found = structures.reverse_each.find { |container| container.include?(key) }\n !found.nil? && (found[key] != Utils::DeletedMarker)\n end", "def include?(key)\n # Ensure a Ruby true is returned\n item_exists(key) == true\n end", "def member? key\n fetch(key, nil) && true\n end", "def exists(key)\n\n # FIXME: insert code that connects to the backend and affects the exists\n # operation\n #\n # - Convert any exceptions into a failed status result with a meaningful\n # error message.\n #\n\n { :result => nil, :err_msg => 'FIXME: not implemented' }\n end", "def include?(key)\n File.exist?(cache_path(key))\n end", "def add?(key)\n hashes = key_to_hashes(key).reject { |hash| filter.set?(hash) }\n hashes.each { |hash| filter.set!(hash) }\n hashes.any?\n end", "def data_set_exists?\n Pathname.new(header_file_full_path).exist?\n end", "def key?(key)\n timeout_retry(3, 3){\n write \"EXISTS #{key}\\r\\n\"\n integer_reply == 1\n }\n end", "def has_key?(key)\n (@stack.length - 1).downto(0).each do |i|\n return true if @stack[i].key? key\n end\n false\n end", "def data_set_exists?\n !BasicInterfaceRegister[@data_lib][@data_set_name].nil?\n end", "def key_set?\n !attributes['key'].nil?\n end", "def exists(*keys); end", "def exists_file?(key)\n # sanitize the name\n key = safe_file_name(key)\n key = add_namespace(key)\n\n boolify(redis.exists?(key))\n end", "def has_key(key, pos= 0, len= -1)\n end", "def meterpreter_registry_key_exist?(key)\n begin\n root_key, base_key = session.sys.registry.splitkey(key)\n rescue ArgumentError\n return false\n end\n\n begin\n check = session.sys.registry.check_key_exists(root_key, base_key)\n rescue Rex::Post::Meterpreter::RequestError, TimesoutError\n return false\n end\n\n check\n end", "def has_key?(key)\n local?(key) || (!@parent.nil? && @parent.key?(key))\n end", "def value_set? key\n @values.key? @schema.resolve_key! key\n end", "def exist?(key, options = nil)\n Rails.cache.exist?(key, options)\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: exists?: K: #{key.inspect}. M: #{exc.message}, I: #{exc.inspect}\" }\n nil\n end", "def has?(key)\n respond_to? key\n end", "def key?(key)\n !(head && head.commit.tree / key_for(key)).nil?\n end", "def key?(key)\n !(head && head.commit.tree / key_for(key)).nil?\n end", "def in?(key)\n return true if get(key)\n false\n end", "def has?(key) ; @docs.member?(key) end", "def has_key?(*args)\n @indicies.has_key?(*args)\n end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def key?(key); end" ]
[ "0.74694544", "0.69498026", "0.6856277", "0.66631037", "0.6655751", "0.6655751", "0.66374934", "0.66104716", "0.66102195", "0.6593313", "0.6588371", "0.6543319", "0.6539127", "0.6521038", "0.6516892", "0.64862496", "0.64846325", "0.6468201", "0.6453052", "0.6452728", "0.6452728", "0.6452304", "0.64429104", "0.6439733", "0.64226335", "0.63837385", "0.63820827", "0.6345425", "0.6336246", "0.63309324", "0.63262683", "0.6319575", "0.6306753", "0.6284947", "0.62713474", "0.62610584", "0.6258528", "0.624381", "0.62317574", "0.6228493", "0.6221149", "0.6215675", "0.6211513", "0.6211", "0.62103313", "0.6201997", "0.6199584", "0.61474067", "0.6122177", "0.61107016", "0.6109408", "0.6093392", "0.6034808", "0.60120463", "0.6003864", "0.60003644", "0.5999001", "0.59907615", "0.59882385", "0.59639233", "0.59524745", "0.5941", "0.59264094", "0.5910412", "0.58958226", "0.5879976", "0.58752704", "0.58708674", "0.58649105", "0.58555496", "0.58529335", "0.5850481", "0.58444905", "0.5828138", "0.58229727", "0.580803", "0.58024025", "0.5799259", "0.5793808", "0.57816255", "0.5778896", "0.5768229", "0.5765397", "0.5751653", "0.5741908", "0.5738017", "0.57332456", "0.57299155", "0.57293487", "0.5728447", "0.5728447", "0.57071835", "0.57043934", "0.569434", "0.56930554", "0.56930554", "0.56930554", "0.56930554", "0.56930554", "0.56930554" ]
0.7396976
1
Returns the cardinality of a set `key`.
def zcard(key) mon_synchronize do perform ["zsize", key], :proc => T_INT end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count\n with_redis { |redis| redis.scard(@set_key).to_i }\n end", "def cardinality\n redis.hget(bucket_key, RedisBackend::COUNT_FIELD).to_i\n end", "def size\n keys.size\n end", "def count(key)\n @counter[key]\n end", "def num_keys\n end", "def cardinality\n tuples.size\n end", "def size\n @keys.size\n end", "def bit_set_size\n @bit_set.size\n end", "def size\n if @size.nil?\n @size = @mset.inject(0) do |total, pair|\n value = pair[1]\n if value.is_a? Array\n total + value.size\n else\n total + 1\n end\n end\n end\n\n @size\n end", "def length\n @set.length\n end", "def count\n @valueset.length\n end", "def length\n keys.length\n end", "def redis_size(db, k)\n t = db.type(k)\n case t\n when 'string' then db.get(k).length\n when 'list' then db.lrange(k, 0, -1).size\n when 'zset' then db.zrange(k, 0, -1).size\n when 'set' then db.smembers(k).size\n else raise(\"Redis type '#{t}' not yet supported.\") # TODO accommodate more types\n end\nend", "def bitcount(key, start = T.unsafe(nil), stop = T.unsafe(nil)); end", "def key_count\n $capitals.keys.length\nend", "def length()\n return @i_keys.get_length()\n end", "def length\r\n\t\t@set.length\r\n\tend", "def length()\n return self.keys.get_length()\n end", "def xlen(key); end", "def count(key)\n Sidekiq.redis do |conn|\n conn.llen(namespace_key(key))\n end\n end", "def count\n redis { |conn| conn.llen(key) }\n end", "def bitcount(key, start = 0, stop = -1)\n node_for(key).bitcount(key, start, stop)\n end", "def hlen(key); end", "def hlen(key); end", "def total_set\n self.inject(0) { |a, bucket| a += bucket.zero? ? 0 : 1; a }\n end", "def length\n hash.keys.length\n end", "def pfcount(*keys); end", "def pfcount(*keys); end", "def number_in_set(game = @owner.game)\n\t\t\tproperties_in_set(game).count\n\t\tend", "def canned_query_count(key)\n query = SPLASH_CANNED_QUERIES[key.to_sym]\n raise ArgumentError.new(\"key must be in SPLASH_CANNED_QUERIES hash\") if query.nil?\n @response.facet_counts[\"facet_queries\"][query]\n end", "def size\n @redis.llen @key\n end", "def length\n @driver_instance.count_list_value(@key)\n end", "def size\n @index.keys.uniq.count\n end", "def size(key)\n raise \"subclass responsibility\"\n end", "def size\n @hash_table.keys.length\n end", "def key_size\n compute_minimal_keys if not @key_length\n @key_length \n end", "def size\n Stal.solve(redis, [\"SCARD\", key])\n end", "def size\n to_set.size\n end", "def cardinality\n @rhs.size\n end", "def size(key)\n @backend.respond_to?(:_size) and return @backend._size(domain, key)\n paths = get_paths(key) or return nil\n paths_size(paths)\n end", "def llen(key)\n node_for(key).llen(key)\n end", "def value_count(hash, value)\n hash.select { |_k, v| v == value }.length\nend", "def item_count\n item_values.values.compact.sum { |v| v.is_a?(Array) ? v.size : 1 }\n end", "def zlexcount(key, min, max); end", "def count_unique_values_for_key(a_key)\n values_array = [] #array of values\n self.lib.songs.each do |song|\n values_array << song.metadata[a_key]\n end\n unique_count = values_array.uniq.count\n puts \"Unique values for key #{a_key} = #{unique_count}\"\n unique_count\n end", "def pairs(k, arr)\n ha = {}\n pairs = Set.new\n count = 0\n arr.to_set.each do |element|\n ha[element] = 1\n end\n arr.to_set.each do |element|\n sum = (k + element)\n if ha.key? sum\n count += 1\n end\n end\n count\nend", "def count\n connection.llen key_label\n end", "def size\n BitCounter.count(@val)\n end", "def key_size\n @key_size ||= if (value = @node['keySize'])\n value.to_i\n end\n end", "def zcount(key, min, max); end", "def zcount(key, min, max); end", "def length\n @results.keys.length\n end", "def hlen(key)\n node_for(key).hlen(key)\n end", "def count(column_family, key_range = ''..'', limit = MAX_INT, consistency = Consistency::WEAK)\n get_key_range(column_family, key_range, limit, consistency).size\n end", "def size\n @size ||= (@key_map || @row || []).size\n end", "def tag_set_count(collection)\n if collection && collection.challenge_type.present?\n if collection.challenge_type == \"GiftExchange\" && !collection.challenge.offer_restriction.owned_tag_sets.empty?\n collection.challenge.offer_restriction.owned_tag_sets.count\n elsif collection.challenge_type == \"PromptMeme\" && !collection.challenge.request_restriction.owned_tag_sets.empty?\n collection.challenge.request_restriction.owned_tag_sets.count\n end\n end\n end", "def llen(key); end", "def llen(key); end", "def count_num_trees_supp(num_keys)\n return 1 if num_keys <= 1\n sum_total = 0\n (1..num_keys).each do |val|\n sum = 0\n left_count = count_num_trees_supp(val - 1)\n right_count = count_num_trees_supp(num_keys - val)\n sum += left_count * right_count\n sum_total += sum\n end\n sum_total\n end", "def KiteCount\n return kites.any? ? kites.count : 0\n end", "def pfcount(*keys)\n ensure_same_node(:pfcount, keys.flatten(1)) do |node|\n node.pfcount(keys)\n end\n end", "def number_of_elements_in_collection\n # collection here refers to the collection that is set with the initialize method\n # collection() is a private accessor method at the bottom of this class that accesses @collection\n collection.count\n end", "def number_of_pets\n @pets.keys.count\n end", "def num_uniq\n Set[*self].size\n end", "def size\n @references_to_keys_map.count do |_, ref|\n ref.object\n end\n end", "def count; @value.size; end", "def value_count\n $capitals.values.length\nend", "def size\n @keys.length - 1\n end", "def key_size server, key\n server\n .debug(:object, key)\n .scan(/serializedlength:([0-9]+)/)\n .flatten.first.to_i\n end", "def number_of_unique_words\n @frequencies.keys.length\n end", "def key_length\n key.unpack('b*').first.length\n end", "def count\n connection.zcard(key_label)\n end", "def size\n self.data.keys.size\n end", "def size\n @store.keys.count { |k| Time.now - @store[k].stamp < @lifetime }\n end", "def count_keys_with_values?(passport)\n counter_good_keys = 0\n keys = %w(byr iyr eyr hgt hcl ecl pid) #cid)\n passport.each do | field |\n counter_good_keys = counter_good_keys + 1 if keys.include?(field[0])\n end\n counter_good_keys == 7 ? true : false\n end", "def possibilities\n @dictionary.length\n end", "def size\n @items_set.size\n end", "def size\n key.call(\"LLEN\")\n end", "def count(i,d,set)\n\tif i==-1\n\t\treturn 0\n\telsif i>set.length-1\n\t\treturn 0\n\tend\n\tdif =(set[i]-set[i+d]).abs\n\tif dif >=1 && dif<=2\n\t\treturn count(i+d,d,set)+1\n\telse\n\t\treturn 1\n\tend\n\t\t\nend", "def set_count(key)\n timeout_retry(3, 3){\n write \"SCARD #{key}\\r\\n\"\n case i = integer_reply\n when -2\n raise RedisError, \"key: #{key} contains a non set value\"\n else\n i\n end\n }\n end", "def strlen(key)\n node_for(key).strlen(key)\n end", "def size\n values.flatten.size\n end", "def PowerSetCount(arr)\n combinations = []\n (0..arr.size).each { |combo| combinations += arr.combination(combo).to_a }\n combinations.size\nend", "def allkeys\n each_with_object({}) do |h, memo|\n h.keys.each {|k| memo[k] += 1}\n end.keys\n end", "def num_unique_words\n @frequencies.keys.length\n end", "def count_documents_function\n \"function(keys, values) {\n return values.length;\n }\"\n end", "def size\n values.flatten.size\n end", "def size\n values.flatten.size\n end", "def size\n values.flatten.size\n end", "def get_size\n @buckets.length\n end", "def count_occurrences(list)\n keys = list.uniq\n count = keys.map{ |key| list.count(key) }\n keys.each_index{ |indx| puts \"#{keys[indx]} => #{count[indx]}\"}\nend", "def length\n table_ = [keyspace, table].compact.join '.'\n statement = \"SELECT COUNT (*) FROM #{table_} ;\"\n result = session.execute(statement)\n result.first['count']\n end", "def total_set\n @field.each_byte.inject(0) { |a, byte| (a += 1; byte &= byte - 1) while byte > 0 ; a }\n end", "def getset(key); end", "def counts\n count = Hash.new(0)\n self.each{|ele| count[ele] += 1}\n count\n end", "def count\n values.inject(0){|m, v| m + v.length}\n end", "def pairs(k, arr)\n # set = Set.new(arr)\n set = arr.to_h { |num| [num, true] }\n\n result = 0\n arr.each do |num|\n target = num + k\n if set.include?(target)\n result += 1\n end\n end\n\n result\nend", "def count_objects\n count = 0\n @objects.keys.each do |key|\n count += @objects[key].length\n end\n\n return count\n end", "def size\n @buckets.length\n end", "def count_num_trees\n print 'Please enter the upper number :: '\n num_keys = gets.chomp.to_i\n sum = count_num_trees_supp(num_keys)\n puts \"Possible different binary trees having unique structure :: #{sum}\"\n end", "def size\n @clients.keys.length\n end" ]
[ "0.68615806", "0.66804004", "0.6228006", "0.6185364", "0.61739576", "0.61649454", "0.60862523", "0.60456806", "0.6033018", "0.6028026", "0.5979503", "0.5916392", "0.5889226", "0.5888013", "0.5849321", "0.58411866", "0.5836342", "0.58279115", "0.58203745", "0.58189285", "0.58088124", "0.5803492", "0.5798555", "0.5798555", "0.5769618", "0.5758087", "0.5736383", "0.5736383", "0.57337874", "0.57198536", "0.57148975", "0.5696299", "0.56673354", "0.5639882", "0.5627068", "0.5599852", "0.5594933", "0.552732", "0.55090666", "0.54870385", "0.54539853", "0.54507756", "0.54501027", "0.5449445", "0.5434129", "0.54170626", "0.5414237", "0.5408493", "0.5400605", "0.539512", "0.539512", "0.539137", "0.5388794", "0.53826934", "0.5375038", "0.5360249", "0.5353801", "0.5353801", "0.53531843", "0.5344795", "0.5336281", "0.53359276", "0.53338206", "0.53274184", "0.53261435", "0.53212595", "0.5314605", "0.5309111", "0.5306971", "0.5296703", "0.5295901", "0.5269086", "0.52621925", "0.52493376", "0.5245964", "0.52437794", "0.5235901", "0.52334875", "0.5224461", "0.5205024", "0.5196442", "0.51959115", "0.5193989", "0.5183663", "0.51644236", "0.515474", "0.5149006", "0.5149006", "0.5149006", "0.51475674", "0.5143917", "0.5139919", "0.5133436", "0.51268244", "0.5123429", "0.51187354", "0.5114778", "0.51108545", "0.5099806", "0.5093496", "0.50914145" ]
0.0
-1
Delete an `member` from a zset `key`.
def zdel(key, member) mon_synchronize do perform ["zdel", key, member], :proc => T_BOOL end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zdel(key, member)\n mon_synchronize do\n perform [\"zdel\", key, member], proc: T_BOOL\n end\n end", "def zrem(key, member); end", "def zrem(key, member); end", "def zrem(key, member)\n node_for(key).zrem(key, member)\n end", "def zrem(key, member)\n call(key, [:zrem, key, member])\n end", "def set_delete(key, member)\n timeout_retry(3, 3){\n write \"SREM #{key} #{member.to_s.size}\\r\\n#{member}\\r\\n\"\n case integer_reply\n when 1\n true\n when 0\n false\n when -2\n raise RedisError, \"key: #{key} contains a non set value\"\n end\n }\n end", "def srem(key, *members); end", "def srem(key, *members); end", "def multi_zdel(key, members)\n members = Array(members) unless members.is_a?(Array)\n mon_synchronize do\n perform [\"multi_zdel\", key, *members], proc: T_INT\n end\n end", "def multi_zdel(key, members)\n members = Array(members) unless members.is_a?(Array)\n mon_synchronize do\n perform [\"multi_zdel\", key, *members], :proc => T_INT\n end\n end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def del(key)\n @first.del(key)\n end", "def srem?(key, *members); end", "def srem?(key, *members); end", "def delete(key)\n pop if change_key(key, nil, true)\n end", "def srem(key, *members)\n node_for(key).srem(key, *members)\n end", "def delete(key)\n\n end", "def delete_entry(key, **options); end", "def delete_key(key)\n end", "def remove(key); end", "def delete_pair(key)\r\n @redis.del key \r\n end", "def zone_remove(zone,member)\n obj_remove(zone,Zone,member)\n end", "def delete(key)\n return unless in?(key)\n\n hash_index = hasher(key, @keys.size)\n\n if @keys[hash_index] == key\n @keys[hash_index] = nil\n @values[hash_index] = nil\n else\n next_key_index = rehash(hash_index, @keys.size)\n\n while @keys[next_key_index] != nil and @keys[next_key_index] != key\n next_key_index = rehash(next_key_index, @keys.size)\n end\n\n @keys[next_key_index] = nil\n @values[next_key_index] = nil\n end\n end", "def getdel(key); end", "def getdel(key); end", "def delete(key)\n @mutex.synchronize do\n x = anchor\n level = node_level(x)\n update = Array.new(level)\n x = find_with_update(x, level, key, update)\n \n # remove existing key\n \t if node_compare(x, key) == 0\n \t level = node_level(x)\n \t while level > 0\n \t level -= 1\n \t node_delete_after!(x, update[level], level)\n end\n \t end\n end\n \tself\n \tend", "def delete(key, &block); end", "def hdel(key, *fields); end", "def delete key\n @internal_hash[key].clear\n end", "def delete(key)\n doozer_pool.with_connection do |doozer|\n doozer.delete(full_key(key))\n end\n end", "def del(key)\n response = db.delete_item(@table_name, {'HashKeyElement' => {'S' => key}})\n true\n end", "def del(key)\n @meta.delete(key.to_sym) if key\n end", "def delete\n redis.del key\n end", "def remove(value)\n connection.zrem(key_label, value)\n end", "def delete_member path\n rewrite_members member_paths.delete(path)\n end", "def zset(key, member, score)\n mon_synchronize do\n perform [\"zset\", key, member, score], proc: T_BOOL\n end\n end", "def delete_entry(key, **_options)\n failsafe(:delete_entry, returning: false) do\n res = collection.remove(key)\n @last_mutation_token = res.mutation_token\n true\n end\n end", "def alias_remove(al,member)\n obj_remove(al,Alias,member)\n end", "def delete key\n rv = self[key]\n self.removeField key\n return rv\n end", "def delete_member_by_id(pid)\n if posn = member_ids.index(pid)\n delete_member_at(posn)\n end\n end", "def hdel(key, *fields)\n fields.flatten!(1)\n node_for(key).hdel(key, fields)\n end", "def delete\n super do\n @members.each do |member|\n Strand.redis.hdel LOOKUP, member.typed_id\n end\n Strand.redis.hdel TOPICS, @id\n end\n end", "def delete key\n slot = _find_slot(key)\n return nil if !@data[slot]\n value = @data[slot+1]\n @data[slot] = DELETED\n @data[slot+1] = nil\n\n # Unlink record\n n = @data[slot+2]\n prev = @data[slot+3]\n if prev\n @data[prev+2] = n\n end\n if n\n @data[n+3] = prev\n end\n if @first == slot\n @first = n\n end\n if @last == slot\n @last = prev\n end\n\n # FIXME: It fails without this, which indicates a bug.\n #@length -= 1\n value\n end", "def delete(key)\n @succ.delete key\n end", "def remove(key)\n\n end", "def srem?(key, *members)\n node_for(key).srem?(key, *members)\n end", "def delete(collection, key)\n @data[collection].delete(key)\n end", "def del(key)\n position = find(key)\n if position != nil\n # delete\n value = @values[position]\n @slots[position] = nil\n @values[position] = nil\n value\n else\n nil\n end\n end", "def del_member(_user_id)\n update!(del_members: [_user_id])\n end", "def delete(key = nil)\n key ? self.data.delete(key) : self.data.clear\n end", "def delete(key = nil)\n key ? self.data.delete(key) : self.data.clear\n end", "def delete_entry(key, options)\n @hash.delete(key)\n end", "def zset(key, member, score)\n mon_synchronize do\n perform [\"zset\", key, member, score], :proc => T_BOOL\n end\n end", "def delete(key)\n @hash.delete key\n @key_hash.delete key\n end", "def xdel(key, *ids); end", "def delete(key)\n key = to_key key\n @group.delete key if @group.key? key\n end", "def delete(key)\n transaction do |y|\n y.delete(key)\n end\n end", "def rm_groupmember(member)\n group = @group_class.new :name => member, :node => self.node\n return nil unless group.exists?\n self[:groupmembers].delete group.generateduid.first\n end", "def delete(key)\n data.delete(key)\n @deleted_hash[key] = nil\n end", "def delete(key)\n if value = @hash[key]\n @reverse[value].delete(key)\n @reverse.delete value if @reverse[value].empty?\n @hash.delete key\n end\n end", "def delete(key)\n @relation.delete(key)\n end", "def hdel(key, *fields)\n fields.flatten!(1)\n send_command([:hdel, key].concat(fields))\n end", "def delete key\n write_data_entry key, nil, true\n @keydict[key] = nil\n\n sync\n end", "def delete(field)\n redis.hdel @key, field\n end", "def destroy\n with_redis do |redis|\n redis.del(@set_key)\n redis.del(@id)\n end\n end", "def delete(key)\n perform_delete(:delete, key)\n end", "def delete(key)\n @data.delete(key)\n @key_size.delete(key)\n end", "def delete(key)\n @hash.delete(key.to_s)\n end", "def delete(key)\r\n if record = touch(key)\r\n @store.delete(key)\r\n @head = @tail = nil if @store.length.zero?\r\n record[:value]\r\n end\r\n end", "def delete(key, options = nil)\n @hash.delete(key)\n end", "def delete _key\n store.transaction() { |s| s.delete(prepare_key(_key)) }\n end", "def clear_by_key(key)\n delete(key)\n end", "def rm_user(member)\n self[:users].delete member\n end", "def delete(key)\n value = self[key]\n\n @memcached.delete key\n\n value\n end", "def delete\n self.class.redis_objects.each do |key, obj|\n obj = self.send(key.to_sym)\n if obj.class == Redis::Set || obj.class == Redis::HashKey || obj.class == Redis::List\n delete_key(key)\n else\n obj.delete\n end\n end\n end", "def delete_entry(key, **options)\n failsafe(:delete_entry, returning: false) do\n with { |c| c.del key }\n end\n end", "def delete(key)\n removeAttribute(key.to_s)\n end", "def delete(key)\n removeAttribute(key.to_s)\n end", "def delete(key)\n removeAttribute(key.to_s)\n end", "def delete(key)\n @redis.delete(key)\n end", "def delete(key, child)\n\t\t\t\tif key\n\t\t\t\t\t@keyed.delete(key)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t@state.delete(child)\n\t\t\tend", "def delete(key)\n @internal_hash.delete(key)\n end", "def sismember(key, member); end", "def sismember(key, member); end", "def delete_entry(key, **options)\n rescue_error_with(false) { @data.with { |c| c.delete(key) } }\n end", "def delete(key)\n unimplemented\n end", "def getdel(key)\n node_for(key).getdel(key)\n end", "def delete(key)\n key = alternate_key(key) unless has_key?(key)\n super\n end", "def delete(item, count = 0)\n conn.lrem key, count, item\n end", "def delete(key)\n\t\t\t\t[self, self, false]\n\t\t\tend", "def delete(key)\n return Nvmkv::kv_delete(@kv_id, @pool_id, key)\n end", "def decr(key); end", "def decr(key); end", "def getdel(key)\n send_command([:getdel, key])\n end", "def delete_attribute(key); end", "def delete(o)\n @val &= ~(1 << o) if valid_member?(o)\n self\n end" ]
[ "0.83847237", "0.814844", "0.814844", "0.81324166", "0.807038", "0.7387503", "0.6894136", "0.6894136", "0.6715972", "0.665433", "0.66479725", "0.66479725", "0.66479725", "0.66479725", "0.66479725", "0.6624721", "0.65294397", "0.65294397", "0.6438684", "0.6384351", "0.632338", "0.6301624", "0.62923867", "0.629234", "0.62916046", "0.62746394", "0.6216493", "0.6209285", "0.6209285", "0.6203079", "0.61671406", "0.61551034", "0.6146181", "0.6131855", "0.6130963", "0.6129474", "0.61140263", "0.60835487", "0.607872", "0.60438955", "0.6014523", "0.6013546", "0.6003599", "0.5996404", "0.59921193", "0.59863347", "0.59827024", "0.5982549", "0.5981328", "0.59757423", "0.5969575", "0.59572226", "0.594852", "0.59478915", "0.59478915", "0.59389806", "0.59370977", "0.5927447", "0.59195", "0.5889325", "0.5886026", "0.58858544", "0.587839", "0.58747315", "0.5870458", "0.58665085", "0.58619994", "0.586064", "0.58541864", "0.5849231", "0.5844712", "0.5841523", "0.58343756", "0.58292884", "0.5826658", "0.58188254", "0.5815184", "0.58020407", "0.5800562", "0.57995266", "0.5793386", "0.5793386", "0.5793386", "0.57788956", "0.5767493", "0.5748147", "0.5746547", "0.5746547", "0.5723773", "0.5720557", "0.5718329", "0.5716766", "0.57127947", "0.57018435", "0.5696845", "0.5691261", "0.5691261", "0.5676836", "0.56673735", "0.5662753" ]
0.82843137
1
Delete All data from key
def clear(key) mon_synchronize do perform(["hclear", key], :proc => T_INT) + perform(["zclear", key], :proc => T_INT) + perform(["qclear", key], :proc => T_INT) + perform(["del", key], :proc => T_INT) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete key\n\t\tdata = @data_base.delete key\n\t\tupdate_database\n\t\tdata\n\tend", "def delete_all\n store.delete(KEY)\n self\n end", "def delete_data(key)\n @data.delete(key)\n end", "def delete_key(key)\n end", "def delete _key\n store.transaction() { |s| s.delete(prepare_key(_key)) }\n end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete_data key\n init_data\n\n Bot::DB[my_name].delete key\n end", "def delete_data key\n init_data\n\n Bot::DB[my_name].delete key\n end", "def delete(key)\n\n end", "def delete_all\n Nvmkv.kv_delete_all(@kv_id)\n end", "def delete(key)\n data.delete(key)\n @deleted_hash[key] = nil\n end", "def clear_by_key(key)\n delete(key)\n end", "def delete(key)\n @data.delete(key)\n @key_size.delete(key)\n end", "def delete_all\n self.store.delete_keys(find_keys)\n end", "def delete(key = nil)\n key ? self.data.delete(key) : self.data.clear\n end", "def delete(key = nil)\n key ? self.data.delete(key) : self.data.clear\n end", "def delete\n redis.del key\n end", "def delete(key)\n @data.delete(key).tap {\n save if autosave?\n }\n end", "def delete key\n write_data_entry key, nil, true\n @keydict[key] = nil\n\n sync\n end", "def destroy\n @key.destroy\n end", "def delete_all(key)\n raise ArgumentError if key.blank?\n\n count = 0\n @redis.keys(\"#{key}*\").each do |k|\n count += @redis.del k\n end\n\n count.positive?\n end", "def delete(key)\n db.delete(key)\n end", "def delete(key)\n super(convert_key(key))\n end", "def clear!(key = nil)\n key.nil? ? @data.clear : @data.delete(key)\n end", "def del\n connection.del(key_label)\n end", "def delete(key)\n transaction do |y|\n y.delete(key)\n end\n end", "def cleanup\n keys = redis.keys(raw_data_key('*')) + redis.keys(data_key('*'))\n multi do\n keys.each{|key| redis.del(key)}\n end\n super\n end", "def clear_all(key)\n _mutex.synchronize do\n _store[key] = {}\n end\n end", "def delete(key)\n unimplemented\n end", "def delete \n @data = {} \n end", "def delete(key)\n super(convert_key(key))\n end", "def delete(key)\n raise \"Method not implemented. Called abstract class.\"\n end", "def delete key\n @internal_hash[key].clear\n end", "def del(key)\n response = db.delete_item(@table_name, {'HashKeyElement' => {'S' => key}})\n true\n end", "def clear_training_data\n keys = @redis.keys(base_key.join(':') + '*')\n\n keys.each do |key|\n @redis.del key\n end\n end", "def delete(key)\n pop if change_key(key, nil, true)\n end", "def remove_all_keys\n\t\tdelete(\"/user/keys\")\n\tend", "def remove_all_keys\n\t\tdelete(\"/user/keys\")\n\tend", "def del(keys)\n keys.each { |key| _data.delete(key) }\n _save\n end", "def delete(key)\n perform_delete(:delete, key)\n end", "def delete(key)\n @hash.delete key\n @key_hash.delete key\n end", "def delete(key)\n doozer_pool.with_connection do |doozer|\n doozer.delete(full_key(key))\n end\n end", "def delete_key(key)\n @keys.delete(key)\n @passwords.each_key { |id| set_password(id, get_password(id)) }\n @otp_keys.each_key { |id| set_otp_key(id, get_otp_key(id)) }\n end", "def delete(key)\n removeAttribute(key.to_s)\n end", "def delete(key)\n removeAttribute(key.to_s)\n end", "def delete(key)\n removeAttribute(key.to_s)\n end", "def delete(key)\n in_transaction_wr\n @table.delete key\n end", "def delete(key)\n\t\t\t\t[self, self, false]\n\t\t\tend", "def getdel(key); end", "def getdel(key); end", "def clear\n @redis.delete_matched(\"#{@key}:*\")\n end", "def delete(key)\n @db.delete(key.to_s.downcase)\n end", "def delete(*key_list)\n first_keys, last_key = split_keys(key_list)\n data = fetch_data(first_keys)\n data.__delete__(last_key) if data.__key__?(last_key)\n end", "def delete(*args)\n if args.blank?\n raise \"Using delete with no args is not allowed. Please use delete_all to delete all records\"\n end\n keys = find_keys(*args)\n self.store.delete_keys(keys)\n end", "def delete(key)\n return if @no_update == true\n @store.transaction do\n @store.delete(key)\n end\n end", "def delete(key)\n key = alternate_key(key) unless has_key?(key)\n super\n end", "def clear\n all_keys = keys\n return 0 if all_keys.empty?\n\n # Delete all keys\n del(*all_keys)\n end", "def delete_row(key)\n hbase.deleteAllRow(table_name, key)\n end", "def delete! key = nil\n if key.nil?\n @schema.delete!\n @values.clear\n else\n key = ::Kernel.String(key).to_sym\n @schema.delete! key\n @values.delete key\n end\n self\n end", "def delete(key)\n @store.delete(key)\n end", "def clear\n synchronize_block do\n @data.clear\n @key_access_store.clear\n end\n end", "def del(key)\n @first.del(key)\n end", "def delete(key)\n storage.transaction {storage.delete(key)}\n end", "def delete( key )\n fail NotImplementedError\n end", "def delete(key)\n @store.delete(key)\n end", "def delete_all_rows\n scan.each do |row|\n delete_row(row['key'])\n end\n end", "def clear!(key = nil)\n key = key.to_sym unless key.nil?\n @store.clear! key\n end", "def delete(key)\n @table.delete(key)\n end", "def xdel(key, *ids); end", "def clear\n heroku.remove_all_keys\n display \"All keys removed.\"\n end", "def clear\n heroku.remove_all_keys\n display \"All keys removed.\"\n end", "def delete_entry(key, **options)\n rescue_error_with(false) { @data.with { |c| c.delete(key) } }\n end", "def hdel(key, *fields); end", "def clear!\n Goalkeeper.redis.del(key)\n end", "def remove(key)\n\n end", "def unset key\n storage.delete key\n end", "def clear\n @redis.del @options[:key_name]\n end", "def clear\n @redis.del @options[:key_name]\n end", "def delete(key)\n raise NotImplementedError\n end", "def delete(key)\n responsible_clients(key).each do |v|\n with_retries { v.logical.delete(wrap_key(key)) }\n end\n end", "def delete_entry(key, options)\n dataset.delete Google::Cloud::Datastore::Key.new @datastore_kind_name, key\n end", "def delete(key)\n run_hook(:before_delete)\n db.delete(key)\n run_hook(:after_delete)\n end", "def delete(key)\n raise NotImplementedError\n end", "def delete(key)\n raise NotImplementedError\n end", "def delete!(key)\n @table.delete(key.to_sym)\n end", "def clear_all\n data.delete_all\n self\n end", "def clear_key(key)\n @redis.del(key)\n end", "def remove(key); end", "def clear!\n @key_files = []\n @known_identities = nil\n self\n end", "def delete\n redis.eval(LUA_SCRIPT_DELETE, :keys => [build_key('*')])\n end", "def destroy\n self.class.remove(key)\n end", "def destroy\n self.class.remove(key)\n end", "def delete\n data.delete( self ); self\n end", "def delete! _key = nil\n ::Kernel.raise DerivedError\n end", "def delete(key)\n attribute = key.to_sym\n details.delete(attribute)\n messages.delete(attribute)\n end", "def delete(key)\n @adapter.delete(key.to_s)\n true\n end", "def delete(key, &block); end" ]
[ "0.79750437", "0.79274124", "0.7924459", "0.78479874", "0.7840088", "0.77406645", "0.77406645", "0.77406645", "0.77406645", "0.77406645", "0.77262783", "0.77262783", "0.7723917", "0.7629206", "0.7620802", "0.7614518", "0.759468", "0.74825007", "0.73590195", "0.73590195", "0.73328096", "0.7325406", "0.7325052", "0.73054826", "0.72700936", "0.7242361", "0.72420174", "0.723564", "0.7202196", "0.7197547", "0.71766084", "0.7175895", "0.715829", "0.7153256", "0.7153107", "0.7142893", "0.71255136", "0.711565", "0.7105193", "0.7104212", "0.7095787", "0.7095787", "0.7089985", "0.70608896", "0.7060636", "0.7058064", "0.70548916", "0.7054866", "0.7054866", "0.7054866", "0.7049748", "0.7024417", "0.701568", "0.701568", "0.701015", "0.6996432", "0.6992707", "0.69778264", "0.69770646", "0.69601846", "0.69448143", "0.6938708", "0.6928428", "0.6927351", "0.6912512", "0.6905325", "0.69010955", "0.69009817", "0.68954986", "0.68934786", "0.6878558", "0.68681526", "0.68626696", "0.6861835", "0.6861835", "0.6859393", "0.68531215", "0.68469125", "0.6842034", "0.6836663", "0.683632", "0.683632", "0.6835738", "0.68308014", "0.6829767", "0.68231666", "0.6816329", "0.6816329", "0.6814445", "0.6807975", "0.68058854", "0.6797168", "0.67588824", "0.67576", "0.67529327", "0.67529327", "0.6738323", "0.67376226", "0.6733587", "0.6726127", "0.672281" ]
0.0
-1
List zset keys between `start` and `stop`.
def zlist(start, stop, opts = {}) limit = opts[:limit] || -1 mon_synchronize do perform ["zlist", start, stop, limit], :multi => true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zkeys(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zkeys\", key, BLANK, start, stop, limit], multi: true\n end\n end", "def zkeys(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zkeys\", key, BLANK, start, stop, limit], :multi => true\n end\n end", "def zrange(key, start, stop, **options); end", "def range(start, stop)\n fetch(redis.zrange(key, start, stop))\n end", "def zrange(key, start, stop, **options)\n node_for(key).zrange(key, start, stop, **options)\n end", "def keys(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"keys\", start, stop, limit], multi: true\n end\n end", "def keys(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"keys\", start, stop, limit], :multi => true\n end\n end", "def zrange(key, start, stop, options = {})\n send_cluster_command([:zrange, key, start, stop, options])\n end", "def zrange(key, start, stop, options = {})\n send_cluster_command([:zrange, key, start, stop, options],\n master_only: false)\n end", "def zlist(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zlist\", start, stop, limit], multi: true\n end\n end", "def zrevrange(key, start, stop, **options); end", "def zrange(key, start, stop, options = {})\n args = [:zrange, key, start, stop]\n\n if options[:withscores]\n args << 'WITHSCORES'\n block = Redis::FloatifyPairs\n end\n\n call(key, args, transform: block, read: true)\n end", "def zrange(key, start, stop, byscore: T.unsafe(nil), by_score: T.unsafe(nil), bylex: T.unsafe(nil), by_lex: T.unsafe(nil), rev: T.unsafe(nil), limit: T.unsafe(nil), withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end", "def getrange(key, start, stop); end", "def getrange(key, start, stop); end", "def range(start, stop)\n fetch(key.call(\"LRANGE\", start, stop))\n end", "def lrange(key, start, stop); end", "def lrange(key, start, stop); end", "def zscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zscan\", key, BLANK, start, stop, limit], multi: true, proc: T_STRINT\n end\n end", "def zrevrange(key, start, stop, **options)\n node_for(key).zrevrange(key, start, stop, **options)\n end", "def zscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zscan\", key, BLANK, start, stop, limit], :multi => true, :proc => T_STRINT\n end\n end", "def z_list_range(key, start = 0, count = 1)\n handle_pipeline(@redis.zrevrange(key, start, start + count - 1)) { |object|\n list = Array(object).map(&method(:without_uuid))\n\n next list.first if count == 1\n\n list\n }\n end", "def zrevrange(key, start, stop, options = {})\n args = [:zrevrange, key, start, stop]\n\n if options[:withscores]\n args << 'WITHSCORES'\n block = Redis::FloatifyPairs\n end\n\n call(key, args, transform: block, read: true)\n end", "def zrscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zrscan\", key, BLANK, start, stop, limit], multi: true, proc: T_STRINT\n end\n end", "def get_set(start, finish, interval)\n cur_val = start; result = []\n while(cur_val < finish)\n result << cur_val\n cur_val += interval\n end\n result\n end", "def ids\n key.call(\"LRANGE\", 0, -1)\n end", "def zrscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zrscan\", key, BLANK, start, stop, limit], :multi => true, :proc => T_STRINT\n end\n end", "def zrevrange(key, start, stop, withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end", "def lrange(key, start, stop)\n node_for(key).lrange(key, start, stop)\n end", "def list_keys()\n # TODO\n end", "def get_keys(start_date, end_date = nil)\n keys = []\n keys << get_key_for(start_date)\n unless end_date.nil?\n while start_date <= end_date\n start_date += 60*60\n keys << get_key_for(start_date) unless start_date > end_date\n end\n keys << get_key_for(end_date)\n end\n keys.uniq\n end", "def keys\n @index.range(0, -1)\n end", "def lrange(key, start, stop)\n send_command([:lrange, key, Integer(start), Integer(stop)])\n end", "def zrangestore(dest_key, src_key, start, stop, **options); end", "def getrange(key, start, stop)\n send_command([:getrange, key, Integer(start), Integer(stop)])\n end", "def slice(start, length = nil)\n case start\n when Integer\n if length\n range(start, start + length - 1)\n else\n conn.lindex(key, start) rescue nil\n end\n when Range, Array\n range *range_pair(start)\n else\n []\n end\n end", "def keys() end", "def getQVat(start, stop)\n stop ||= start\n @qvList[ start .. stop ].join '_'\n end", "def list_range(key, start, ending)\n timeout_retry(3, 3){\n write \"LRANGE #{key} #{start} #{ending}\\r\\n\"\n multi_bulk_reply\n }\n end", "def getrange(key, start, stop)\n node_for(key).getrange(key, start, stop)\n end", "def keys\n out = [ ]\n @source.keys.each do |key|\n if key.starts_with?(@prefix)\n out << key[@prefix.length..-1]\n else\n out << key\n end\n end\n out\n end", "def search(start_key, end_key, limit, offset, reverse, with_keys)\n offset ||= 0\n \n start_node = find_by_prefix(start_key, reverse)\n !start_node and return []\n \n start_node = skip_nodes(start_node, offset, reverse)\n !start_node and return []\n \n collect_values(start_node, end_key, limit, reverse, with_keys)\n end", "def list\n @keychain.keys\n end", "def get_path_by_names(start, stop)\n s1 = get_node(start)\n s2 = get_node(stop)\n if s1 != nil && s2 != nil\n return get_path(s1, s2)\n end\n Array.new \n end", "def get_stops (line, first_stop, last_stop)\n # puts \"line #{ line } stop #{ first_stop } -> stop #{ last_stop }\"\n first_index = lines[line.to_sym].index(first_stop)\n last_index = lines[line.to_sym].index(last_stop)\n if first_index <= last_index\n trip = lines[line.to_sym][first_index..last_index]\n else\n trip = lines[line.to_sym][last_index..first_index].reverse\n end\n trip.shift # remove first stop\n return trip\nend", "def find_middle(start, stop)\n index = ((stop - start) / 2) + start\n time = time_at(index)\n [index, time]\n end", "def get_all_by_range(sorted_set_key, min, max)\n redis.zrangebyscore(sorted_set_key, min, max)\n end", "def keys\n list.keys\n end", "def query_hash_range(key, start, count, step_size, ts_index, ts_size = 2)\n hash = make_redis_hash(start, count, step_size, ts_index, ts_size)\n\n ckey = convert_keys(key)\n node = @root[ckey]\n\n keys = hash.to_a.sort_by { |it| it[0] }\n mres = @redis.pipelined do\n keys.each do |key, values|\n node[key].hmget(*values)\n end\n end\n\n mres.flatten.collect(&:to_i)\n end", "def zrangestore(dest_key, src_key, start, stop, **options)\n ensure_same_node(:zrangestore, [dest_key, src_key]) do |node|\n node.zrangestore(dest_key, src_key, start, stop, **options)\n end\n end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys\n @navigable_map.key_set.to_a\n end", "def zscan(key, cursor, **options); end", "def remove_by_range(start=nil, stop=nil)\n if !start and !stop\n throw \"Must specify either start or stop\"\n end\n\n start = start ? \"(#{start}\" : '-inf'\n stop = stop ? \"#{stop}\" : \"+inf\"\n\n # Get the keys to delete from the hash\n keys = @index.range_by_score(start, stop)\n # Remove the keys from the index\n @index.delete_by_score(start, stop)\n # Remove the values from the hash\n multi do\n keys.each do |key|\n @hash.delete(key)\n end\n end\n\n self\n end", "def ltrim(key, start, stop); end", "def ltrim(key, start, stop); end", "def get_range\n\t\tif params.has_key?(\"start\") and params.has_key?(\"end\")\n\t\t\tif params[\"end\"] == \"Z\"\n\t\t\t\t# had to do some hackish stuff to include Z\n\t\t\t\tfirst = AToZEntry.select(:topic, :id).where(topic: params[:start]..params[:end])\n\t\t\t\tprefix = 'Z'\n\t\t\t\tsecond = AToZEntry.select(:topic, :id).where(\"topic LIKE :prefix\", prefix: \"#{prefix}%\")\n\t\t\t\trespond({ status: 0, topics: first+second })\n\t\t\telse\n\t\t\t\trespond({ status: 0, topics: AToZEntry.select(:topic, :id).where(topic: params[:start]..params[:end]) })\n\t\t\tend\t\t\t\n\t\telse\n\t\t\trespond({ status: 1, error: \"Must supply :start and :end parameter.\" })\n\t\tend\t\n\tend", "def getLineStops (l)\n @lines[l][:stops]\nend", "def list_keys(prefix, after = nil, limit = 1000, &block)\n if @backend.respond_to?(:_list_keys)\n return @backend._list_keys(domain, prefix, after, limit, &block)\n end\n\n res = begin\n @backend.list_keys(:domain => domain, :prefix => prefix,\n :after => after, :limit => limit)\n rescue MogileFS::Backend::NoneMatchError\n return nil\n end\n\n keys = (1..res['key_count'].to_i).map { |i| res[\"key_#{i}\"] }\n if block_given?\n # emulate the MogileFS::Mysql interface, slowly...\n keys.each do |key|\n paths = get_paths(key) or next\n length = paths_size(paths) or next\n yield key, length, paths.size\n end\n end\n\n [ keys, res['next_after'] ]\n end", "def list_trim(key, start, ending)\n timeout_retry(3, 3){\n write \"LTRIM #{key} #{start} #{ending}\\r\\n\"\n status_code_reply\n }\n end", "def slice start, length\n if length == 1\n synchronize do\n decode @redis.lindex @redis_name, start\n end\n else\n synchronize do\n Array(@redis.lrange(@redis_name, start, start + length - 1)).map do |item|\n decode item\n end\n end\n end\n end", "def content_video_ids limit=0, start=0\n (content_zset.revrange start, (start+limit-1)).map(&:to_i)\n end", "def keys(*) end", "def print_search_start(key, index)\n explain \"-\" * 120\n explain \"Already sorted zone:\"\n explain \"[#{@list[0..index - 1].join(\" \")}]\"\n explain \"\"\n explain \"Key: #{key}\"\n puts_key_pointer(index, show_list: true)\n end", "def start(start_key)\n KeyValueList.new(self).start(start_key)\n end", "def find_line(lines, stop)\n\tlines.each_pair { |key, line| return key if line.include?(stop) }\nend", "def find_line(lines, stop)\n\tlines.each_pair { |key, line| return key if line.include?(stop) }\nend", "def keys\n IbmCloudRest.get \"#{@uri}/keys\"\n end", "def switch_keys_if_descending!(result)\n if result[:descending]\n startkey = result.delete(:startkey)\n endkey = result.delete(:endkey)\n result[:startkey] = endkey unless endkey.nil?\n result[:endkey] = startkey unless startkey.nil?\n end\n end", "def keys\n list = []\n each_key{|key| list << key}\n list\n end", "def zremrangebyrank(key, start, stop); end", "def zremrangebyrank(key, start, stop); end", "def keys\n end", "def format_start_stop(start, stop)\n tmp_start = start\n tmp_stop = stop\n\n if start > stop\n tmp_start, tmp_stop = stop, start\n end\n return tmp_start, tmp_stop\n end", "def keys\n store.keys.select { |k| k.match(/^#{prefix}/) and self[k] }\n end", "def technical_stops_in tstops\n dict( tstops.map(&:city), :in )\n end", "def keys\n [Array(hash_keys) + Array(range_keys)].flatten.uniq\n end", "def keys\n [Array(hash_keys) + Array(range_keys)].flatten.uniq\n end", "def keys\n store.keys.select{ |k| k.match(/^#{prefix}/) and self[k] }\n end", "def list_keys\n @keydict.keys\n end", "def slice( start, stop )\n \n start_point = create_period( calculate_bucket( TimeSeries.Normalise_Time( start ) ) )\n stop_point = create_period( calculate_bucket( TimeSeries.Normalise_Time( stop ) ) )\n\n # Create a new TimeSeries object with the same resolution as\n # self, and clones of each bucket from start to stop.\n \n new_slice = TimeSeries.new( @resolution_unit )\n\n ( start_point .. stop_point ).each do |period|\n if not @buckets[period].empty? then\n new_slice[period] = @buckets[period].clone\n end\n end\n \n new_slice\n end", "def _range from, to\n\t\trange = `IDBKeyRange.bound(#{from}, #{to})`\n\t\tEnumerator.new do |out, done|\n\t\t\ttry do\n\t\t\t\ttransaction = `#@db.transaction(['kv'], 'readonly')`\n\t\t\t\tstore = `#{transaction}.objectStore('kv')`\n\t\t\t\tindex = `#{store}.index('key')`\n\t\t\t\t%x{#{index}.openCursor(#{range}).onsuccess = function(e) {\n\t\t\t\t\tvar cursor = e.target.result\n\t\t\t\t\tif(cursor) {\n\t\t\t\t\t\t// #{log `cursor.value.key`, `cursor.value.val`}\n\t\t\t\t\t\t// debugger\n\t\t\t\t\t\t#{out << [`cursor.value.key`, `cursor.value.val`]}\n\t\t\t\t\t\tcursor.continue()\n\t\t\t\t\t} else {\n\t\t\t\t\t\t#{done[]}\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\tend\n\t\tend.lazy\n\tend", "def xrange(key, start = T.unsafe(nil), range_end = T.unsafe(nil), count: T.unsafe(nil)); end", "def list_keys\n @keys.keys\n end", "def zrangestore(dest_key, src_key, start, stop, byscore: T.unsafe(nil), by_score: T.unsafe(nil), bylex: T.unsafe(nil), by_lex: T.unsafe(nil), rev: T.unsafe(nil), limit: T.unsafe(nil)); end", "def sorted_keys; end", "def ls(prefix)\n list_objects(prefix).contents.map(&:key)\n end", "def getStops(stopA, stopB, cL)\n $count += (stopA - stopB).abs;\n stopA < stopB ? cL[stopA..stopB][1..-1].join(\", \") : cL[stopB..stopA].reverse[1..-1].join(\", \") end", "def lists_and_segments\n response = get \"listsandsegments\", {}\n Hashie::Mash.new(response)\n end", "def keys(*args)\n result = Utils::Queue.new\n\n if args.nil? or args.empty?\n node_keys(@root, result)\n else\n range_keys(@root, result, args[0], args[1])\n end\n\n result\n end", "def range(start, finish)\n {\n 'duration' => ((finish - start) * 1000).to_i,\n 'start' => [start.to_i, start.usec/1000].join(''),\n 'end' => [finish.to_i, finish.usec/1000].join('')\n }\n end", "def keys\n end" ]
[ "0.7277973", "0.7243731", "0.69338584", "0.6893841", "0.67550164", "0.6752526", "0.6725627", "0.66870475", "0.64591604", "0.6442594", "0.62284786", "0.6225161", "0.6153335", "0.61086303", "0.61086303", "0.61029345", "0.6070006", "0.6070006", "0.60689163", "0.60241413", "0.60061455", "0.58945197", "0.57559", "0.57103425", "0.5697165", "0.56815463", "0.5660793", "0.56507784", "0.56065494", "0.5599612", "0.55705523", "0.55199426", "0.5517127", "0.55132776", "0.55090034", "0.54973656", "0.5495126", "0.5489356", "0.54886913", "0.5485248", "0.54596025", "0.5412634", "0.53656685", "0.5341732", "0.5329368", "0.5329101", "0.5298016", "0.5284393", "0.52783096", "0.5256164", "0.52421725", "0.52421725", "0.52421725", "0.52421725", "0.52421725", "0.52421725", "0.52421725", "0.52421725", "0.52421725", "0.5226281", "0.5223248", "0.52129406", "0.5193455", "0.5193455", "0.51900893", "0.516335", "0.5160388", "0.51486677", "0.51486176", "0.51419425", "0.5137472", "0.5135829", "0.5122124", "0.50905246", "0.50905246", "0.5054591", "0.50539666", "0.50478953", "0.50397605", "0.50397605", "0.5031414", "0.5029794", "0.5025543", "0.5016805", "0.50050604", "0.50050604", "0.50044286", "0.49999502", "0.4994605", "0.49941856", "0.49925667", "0.498472", "0.49790403", "0.4970804", "0.49705237", "0.49674058", "0.49651876", "0.4937389", "0.49350724", "0.49287865" ]
0.64145744
10
Lists members at `key` starting at `start_member` between `start` and `stop` scores.
def zkeys(key, start, stop, opts = {}) limit = opts[:limit] || -1 mon_synchronize do perform ["zkeys", key, BLANK, start, stop, limit], :multi => true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(start_key)\n KeyValueList.new(self).start(start_key)\n end", "def members(key, options = default_paging_options)\n options = default_paging_options.dup.merge!(options)\n if options[:page] < 1\n options[:page] = 1\n end\n\n if options[:page] > total_pages(key, options[:page_size])\n options[:page] = total_pages(key, options[:page_size])\n end\n\n index_for_redis = options[:page] - 1\n starting_offset = (index_for_redis * options[:page_size])\n\n if starting_offset < 0\n starting_offset = 0\n end\n\n ending_offset = (starting_offset + options[:page_size]) - 1\n Amico.redis.zrevrange(key, starting_offset, ending_offset, :with_scores => false)\n end", "def list_members(prefix = nil, options={})\n raise NotImplementedError\n end", "def start(start_key)\n self.class.new(collection, range.merge({begin: start_key, begin_inclusive: true}))\n end", "def smembers(key); end", "def smembers(key); end", "def lrange(key, start, stop)\n node_for(key).lrange(key, start, stop)\n end", "def zkeys(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zkeys\", key, BLANK, start, stop, limit], multi: true\n end\n end", "def range(start, stop)\n fetch(redis.zrange(key, start, stop))\n end", "def smismember(key, *members); end", "def smismember(key, *members); end", "def slice(start, length = nil)\n case start\n when Integer\n if length\n range(start, start + length - 1)\n else\n conn.lindex(key, start) rescue nil\n end\n when Range, Array\n range *range_pair(start)\n else\n []\n end\n end", "def list_range(key, start, ending)\n timeout_retry(3, 3){\n write \"LRANGE #{key} #{start} #{ending}\\r\\n\"\n multi_bulk_reply\n }\n end", "def keys(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"keys\", start, stop, limit], multi: true\n end\n end", "def zrange(key, start, stop, **options)\n node_for(key).zrange(key, start, stop, **options)\n end", "def keys(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"keys\", start, stop, limit], :multi => true\n end\n end", "def lrange(key, start, stop)\n send_command([:lrange, key, Integer(start), Integer(stop)])\n end", "def range(start, stop)\n fetch(key.call(\"LRANGE\", start, stop))\n end", "def getrange(key, start, stop); end", "def getrange(key, start, stop); end", "def search(start_key, end_key, limit, offset, reverse, with_keys)\n offset ||= 0\n \n start_node = find_by_prefix(start_key, reverse)\n !start_node and return []\n \n start_node = skip_nodes(start_node, offset, reverse)\n !start_node and return []\n \n collect_values(start_node, end_key, limit, reverse, with_keys)\n end", "def lrange(key, start, stop); end", "def lrange(key, start, stop); end", "def smembers(key)\n node_for(key).smembers(key)\n end", "def zrange(key, start, stop, options = {})\n send_cluster_command([:zrange, key, start, stop, options])\n end", "def smismember(key, *members)\n node_for(key).smismember(key, *members)\n end", "def zrange(key, start, stop, options = {})\n args = [:zrange, key, start, stop]\n\n if options[:withscores]\n args << 'WITHSCORES'\n block = Redis::FloatifyPairs\n end\n\n call(key, args, transform: block, read: true)\n end", "def show_start_list\n # TODO\n # Prepare the start-list according to the meeting specs\n # male/female joined and so on\n # Need specific flags on meeting events\n @meeting_events_list = @meeting.meeting_events\n .joins(:event_type, :stroke_type)\n .includes(:event_type, :stroke_type)\n .order('meeting_events.event_order')\n\n # TODO\n # Prepares team stats\n\n # Get a timestamp for the cache key:\n @max_entry_updated_at = get_timestamp_from_relation_chain(:meeting_entries)\n end", "def getrange(key, start, stop)\n node_for(key).getrange(key, start, stop)\n end", "def zrange(key, start, stop, options = {})\n send_cluster_command([:zrange, key, start, stop, options],\n master_only: false)\n end", "def members *args\n page, per_page, options = TibbrResource.extract_params(args, 2)\n cache_lookup(MEMBERS, true, page, per_page) do\n TibbrResource.paginate_collection(get(:members, :params => {:include_group_members => options[:include_group_members], :page => page, :per_page => per_page}), User)\n end\n end", "def zlist(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zlist\", start, stop, limit], multi: true\n end\n end", "def zlist(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zlist\", start, stop, limit], :multi => true\n end\n end", "def show_members\n @members.each do |member, amt|\n puts member\n end\n @members\n end", "def print_search_start(key, index)\n explain \"-\" * 120\n explain \"Already sorted zone:\"\n explain \"[#{@list[0..index - 1].join(\" \")}]\"\n explain \"\"\n explain \"Key: #{key}\"\n puts_key_pointer(index, show_list: true)\n end", "def zrange(key, start, stop, byscore: T.unsafe(nil), by_score: T.unsafe(nil), bylex: T.unsafe(nil), by_lex: T.unsafe(nil), rev: T.unsafe(nil), limit: T.unsafe(nil), withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end", "def list_members(user, list)\n get(\"/#{user}/#{list}/members.json\")\n end", "def set_members(key)\n perform_read(:set_members, key)\n end", "def [](key)\n @members[cast_key(key)]\n end", "def getrange(key, start, stop)\n send_command([:getrange, key, Integer(start), Integer(stop)])\n end", "def zrange(key, start, stop, **options); end", "def zscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zscan\", key, BLANK, start, stop, limit], multi: true, proc: T_STRINT\n end\n end", "def zscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zscan\", key, BLANK, start, stop, limit], :multi => true, :proc => T_STRINT\n end\n end", "def members; end", "def members; end", "def members; end", "def members; end", "def members; end", "def members; end", "def members; end", "def search_members(query, options = {})\n get search_path(\"members\"), options.merge(query: query)\n end", "def conference_list_members(params)\n path = @version + '/Conference/Member/List/'\n method = 'POST'\n return request(path, method, params)\n end", "def get_member_of_list(user, list, member_id)\n get(\"/#{user}/#{list}/members/#{member_id}.json\")\n end", "def getQVat(start, stop)\n stop ||= start\n @qvList[ start .. stop ].join '_'\n end", "def members(options = {})\n KlaviyoAPI::ListMember.all_members params: { list_id: id, **options }\n end", "def list(garbage, start)\n @all_user = session_user.agency.users\n @start = start.to_i || 0\n @limit = request.params[\"limit\"] || UserListingLength\n @user = @all_user[@start .. (@start+@limit)-1] # FIXME: Do it with sequel!\n @uparted = @user.partition{|u| @user.index(u) % 2 == 0 }\n end", "def members\n response = service.get_members\n response.map do |member_data|\n Member.new(member_data)\n end\n end", "def members(*) end", "def start_point; get(start_param) end", "def get_range\n\t\tif params.has_key?(\"start\") and params.has_key?(\"end\")\n\t\t\tif params[\"end\"] == \"Z\"\n\t\t\t\t# had to do some hackish stuff to include Z\n\t\t\t\tfirst = AToZEntry.select(:topic, :id).where(topic: params[:start]..params[:end])\n\t\t\t\tprefix = 'Z'\n\t\t\t\tsecond = AToZEntry.select(:topic, :id).where(\"topic LIKE :prefix\", prefix: \"#{prefix}%\")\n\t\t\t\trespond({ status: 0, topics: first+second })\n\t\t\telse\n\t\t\t\trespond({ status: 0, topics: AToZEntry.select(:topic, :id).where(topic: params[:start]..params[:end]) })\n\t\t\tend\t\t\t\n\t\telse\n\t\t\trespond({ status: 1, error: \"Must supply :start and :end parameter.\" })\n\t\tend\t\n\tend", "def slice_list(list, start, finish)\n raise ArgumentError.new(\"list cannot be empty.\") if list.empty?\n raise ArgumentError.new(\"start must be greater than 0 and less than the length of the list.\") if start == 0 or start >= list.length\n raise ArgumentError.new(\"finish must be greater than start and less than the length of the list.\") if finish <= start or finish > list.length\n\n list.map { |item| item if list.index(item) >= start and list.index(item) < finish }\n .compact\nend", "def zrevrange(key, start, stop, options = {})\n args = [:zrevrange, key, start, stop]\n\n if options[:withscores]\n args << 'WITHSCORES'\n block = Redis::FloatifyPairs\n end\n\n call(key, args, transform: block, read: true)\n end", "def list_members\n HTTP.headers(:accept => @@accept, \"content-type\" => @@content_type).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\"#{@@base_url}/users/#{self.guid}/members\").parse[\"members\"]\n end", "def start\n\t\t\t@start < @end ? @start : @end\n\t\tend", "def show\n authorize! :read, @ml_list\n @search = params[:search]\n @members = @ml_list.all_members.search(@search).order(:firstname).page(params[:page]).per_page(20)#.where(email_source_accounts: {primary: true})\n @external_emails = @ml_list.ml_external_emails\n @redirection_aliases = @ml_list.redirection_aliases\n @admins_and_moderators = @ml_list.super_members\n if can? :admin_members, @ml_list\n @pendings = @ml_list.pendings\n @banneds = @ml_list.banneds\n end\n\n @current_user_is_member = @ml_list.all_members.include?(@current_user)\n end", "def find_middle(start, stop)\n index = ((stop - start) / 2) + start\n time = time_at(index)\n [index, time]\n end", "def nicknames_in(start_date:, end_date:)\n nicknames.where(updated_at: start_date..end_date).order(:name)\n end", "def members\n @source.get_elements('//Member').map { |item| Member.new(item) }\n end", "def index\n if params[:data]\n @members = Member.get_members(params[:data][:kind].to_i, params[:data][:search])\n else\n @members = Member.all\n end\n\n @members = @members.paginate(:page => params[:page], :per_page => 25)\n end", "def slice_from_start_and_length(start, length)\n result = []\n stop = start + length\n index = 0\n each do |item|\n break if index >= stop\n result << item if index >= start\n index += 1\n end\n result if index >= start\n end", "def slice start, length\n if length == 1\n synchronize do\n decode @redis.lindex @redis_name, start\n end\n else\n synchronize do\n Array(@redis.lrange(@redis_name, start, start + length - 1)).map do |item|\n decode item\n end\n end\n end\n end", "def set_members(key)\n timeout_retry(3, 3){\n write \"SMEMBERS #{key}\\r\\n\"\n Set.new(multi_bulk_reply)\n }\n end", "def format_start_stop(start, stop)\n tmp_start = start\n tmp_stop = stop\n\n if start > stop\n tmp_start, tmp_stop = stop, start\n end\n return tmp_start, tmp_stop\n end", "def index\n @starts = Start.all\n end", "def member_list\n DATABASE.execute(\"SELECT members.name FROM media_members JOIN members ON media_members.member_id = members.id WHERE media_members.media_id = #{id};\")\n end", "def zmscore(key, *members); end", "def zmscore(key, *members); end", "def zrscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zrscan\", key, BLANK, start, stop, limit], :multi => true, :proc => T_STRINT\n end\n end", "def zrscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zrscan\", key, BLANK, start, stop, limit], multi: true, proc: T_STRINT\n end\n end", "def search\n @members = Member.search_by params[:category], params[:keywords], params[:is_active]\n\n render :template => '/api/members/index'\n end", "def starting_by\n @prefix = starting_prefix_param\n @tags = Tag.starting_by(@prefix)\n end", "def startkey(value)\n raise \"View#startkey cannot be used when key has been set\" unless query[:key].nil?\n update_query(:startkey => value)\n end", "def startkey(value)\n raise \"View#startkey cannot be used when key has been set\" unless query[:key].nil? && query[:keys].nil?\n update_query(:startkey => value)\n end", "def zrevrange(key, start, stop, **options)\n node_for(key).zrevrange(key, start, stop, **options)\n end", "def members_by_date date\n Member.all.joins(:participations).where(\"structure_id = ? and ((start_date <= ? and end_date >= ?) or end_date is ?)\", self.id, date, date, nil)\n end", "def list_all_members\n @users.each { |x| puts \"-#{x.first}\"}\n end", "def span_start=(_); end", "def activities(start = 0, limit = 100)\n redis.call 'LRANGE', key[:activities], start, start + limit\n end", "def index\n @members = Member.find(:all)\n end", "def smembers(key)\n if queues?(key)\n servers.inject([]) { |a, s| a + s.smembers(key) }.uniq\n else\n server_for(key).smembers(key)\n end\n end", "def list(key, **options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list',\n\t\t\t\t\t\t\t\t\t\t\t\t :video_key => key))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend", "def search_within_range(start_time, end_time)\n url = \"#{BASE_URL}\\?q\\=location:#{LOCATION}+created:#{start_time.iso8601}..#{end_time.iso8601}\"\n url = url + \"&access_token=#{ACCESS_TOKEN}\" if ACCESS_TOKEN # speed up if possible\n uri = URI(url)\n json = get_json_from_github(uri)\n\n # if total_count is larger than limit, do spliting\n if json['total_count'].to_i > API_SEARCH_LIMIT\n middle_time = (start_time.to_i + end_time.to_i)/2\n # binary search first part\n search_within_range(start_time, Time.at(middle_time).utc)\n # binary search second part\n search_within_range(Time.at(middle_time).utc, end_time)\n else\n # page through results\n end_page = json['total_count'].to_i/API_PAGE_LIMIT + 1\n\n (1..end_page).each do |page|\n url = \"#{BASE_URL}\\?q\\=location:#{LOCATION}+created:#{start_time.iso8601}..#{end_time.iso8601}&page=#{page}&per_page=#{API_PAGE_LIMIT}\"\n url = url + \"&access_token=#{ACCESS_TOKEN}\" if ACCESS_TOKEN\n uri = URI(url)\n json = get_json_from_github(uri)\n $sg_users.concat(json['items'])\n puts \"Added #{json['items'].size} users into list\"\n end\n end\nend", "def team_list(trace: false, &block)\n r = dropbox_query(query: '2/team/members/list', trace: trace)\n r['members'].each(&block)\n while r['has_more']\n r = dropbox_query(query: '2/team/members/list/continue', query_data: \"{\\\"cursor\\\":\\\"#{r['cursor']}\\\"}\", trace: trace)\n r['members'].each(&block)\n end\n end", "def start=(value)\n\t\t\t@start = value\n\t\tend", "def find_by_prefix(start_key, reverse)\n dir = dir_for_reverse(reverse)\n x = anchor(reverse)\n # if no prefix given, just return a first node\n !start_key and return node_next(x, 0, dir)\n \n level = node_level(x)\n while level > 0\n level -= 1\n xnext = node_next(x, level, dir)\n if reverse\n # Note: correct key CAN be greater than start_key in this case \n # (like \"bb\" > \"b\", but \"b\" is a valid prefix for \"bb\")\n while node_compare2(xnext, start_key) > 0\n x = xnext\n xnext = node_next(x, level, dir)\n end\n else\n while node_compare(xnext, start_key) < 0\n x = xnext\n xnext = node_next(x, level, dir)\n end\n end\n end\n xnext == anchor(!reverse) and return nil\n node_key(xnext)[0, start_key.size] != start_key and return nil\n xnext\n end", "def index\n @member_check_ins = MemberCheckIn.search(params[:search])\n end", "def zrevrange(key, start, stop, withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end", "def members()\n sql = \"SELECT members.* FROM members INNER JOIN bookings ON bookings.member_id = members.id INNER JOIN gym_classes ON bookings.gym_class_id = gym_classes.id WHERE gym_classes.id = $1\"\n values = [@id]\n results = SqlRunner.run(sql, values)\n return results.map { |member| Member.new(member)}\n end", "def range(start, finish)\n {\n 'duration' => ((finish - start) * 1000).to_i,\n 'start' => [start.to_i, start.usec/1000].join(''),\n #'end' => [finish.to_i, finish.usec/1000].join('')\n }\n end", "def print_members\n\t\tprint \"Members: \"\n\t\t@members.each {|each_member| print \"#{each_member} \".green}\n\tend" ]
[ "0.58673185", "0.58325624", "0.5753942", "0.56524116", "0.55803996", "0.55803996", "0.55398947", "0.55125886", "0.5504957", "0.5494151", "0.5494151", "0.5486556", "0.54747224", "0.5415072", "0.54122776", "0.5378302", "0.53571635", "0.53193235", "0.5314308", "0.5314308", "0.5309802", "0.52921265", "0.52921265", "0.52915466", "0.52828383", "0.5271077", "0.52548414", "0.5239673", "0.52327555", "0.522724", "0.5224529", "0.52166605", "0.5196669", "0.51461047", "0.5098614", "0.508365", "0.50769424", "0.5068638", "0.5067032", "0.5052245", "0.49943057", "0.49913442", "0.49648494", "0.49515653", "0.49515653", "0.49515653", "0.49515653", "0.49515653", "0.49515653", "0.49515653", "0.49439088", "0.49292532", "0.49017286", "0.488258", "0.4857602", "0.48538807", "0.48445338", "0.48323396", "0.47972602", "0.47885978", "0.47792718", "0.47638378", "0.4762493", "0.47600377", "0.4748743", "0.47449943", "0.4741553", "0.47260517", "0.47250757", "0.47223076", "0.47138622", "0.46781498", "0.46735922", "0.46715662", "0.46658987", "0.466265", "0.466265", "0.46616223", "0.46578708", "0.46537915", "0.46503648", "0.46238407", "0.46205896", "0.4617828", "0.46172625", "0.4615678", "0.46149346", "0.4603687", "0.46017957", "0.45929208", "0.45927864", "0.45852682", "0.45842403", "0.45841658", "0.45624524", "0.45619673", "0.45567217", "0.45439315", "0.45423222", "0.45392466" ]
0.5462306
13
Scans for members at `key` starting at `start_member` between `start` and `stop` scores.
def zscan(key, start, stop, opts = {}) limit = opts[:limit] || -1 mon_synchronize do perform ["zscan", key, BLANK, start, stop, limit], :multi => true, :proc => T_STRINT end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(start_key, end_key, limit, offset, reverse, with_keys)\n offset ||= 0\n \n start_node = find_by_prefix(start_key, reverse)\n !start_node and return []\n \n start_node = skip_nodes(start_node, offset, reverse)\n !start_node and return []\n \n collect_values(start_node, end_key, limit, reverse, with_keys)\n end", "def smismember(key, *members); end", "def smismember(key, *members); end", "def start(start_key)\n self.class.new(collection, range.merge({begin: start_key, begin_inclusive: true}))\n end", "def smismember(key, *members)\n node_for(key).smismember(key, *members)\n end", "def zscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zscan\", key, BLANK, start, stop, limit], multi: true, proc: T_STRINT\n end\n end", "def keys(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"keys\", start, stop, limit], :multi => true\n end\n end", "def keys(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"keys\", start, stop, limit], multi: true\n end\n end", "def getrange(key, start, stop); end", "def getrange(key, start, stop); end", "def zkeys(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zkeys\", key, BLANK, start, stop, limit], multi: true\n end\n end", "def zrscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zrscan\", key, BLANK, start, stop, limit], :multi => true, :proc => T_STRINT\n end\n end", "def zkeys(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zkeys\", key, BLANK, start, stop, limit], :multi => true\n end\n end", "def zrscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zrscan\", key, BLANK, start, stop, limit], multi: true, proc: T_STRINT\n end\n end", "def start(start_key)\n KeyValueList.new(self).start(start_key)\n end", "def scan(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"scan\", start, stop, limit], multi: true, proc: T_STRSTR\n end\n end", "def scan(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"scan\", start, stop, limit], :multi => true, :proc => T_STRSTR\n end\n end", "def members(key, options = default_paging_options)\n options = default_paging_options.dup.merge!(options)\n if options[:page] < 1\n options[:page] = 1\n end\n\n if options[:page] > total_pages(key, options[:page_size])\n options[:page] = total_pages(key, options[:page_size])\n end\n\n index_for_redis = options[:page] - 1\n starting_offset = (index_for_redis * options[:page_size])\n\n if starting_offset < 0\n starting_offset = 0\n end\n\n ending_offset = (starting_offset + options[:page_size]) - 1\n Amico.redis.zrevrange(key, starting_offset, ending_offset, :with_scores => false)\n end", "def work!\n (@start..@stop).each {|i| return if $found; d = $data[i]; $found = true and puts \"Found #{d}\" if d == $search_key }\n end", "def range(start, stop)\n fetch(redis.zrange(key, start, stop))\n end", "def getrange(key, start, stop)\n node_for(key).getrange(key, start, stop)\n end", "def smembers(key); end", "def smembers(key); end", "def find_by_prefix(start_key, reverse)\n dir = dir_for_reverse(reverse)\n x = anchor(reverse)\n # if no prefix given, just return a first node\n !start_key and return node_next(x, 0, dir)\n \n level = node_level(x)\n while level > 0\n level -= 1\n xnext = node_next(x, level, dir)\n if reverse\n # Note: correct key CAN be greater than start_key in this case \n # (like \"bb\" > \"b\", but \"b\" is a valid prefix for \"bb\")\n while node_compare2(xnext, start_key) > 0\n x = xnext\n xnext = node_next(x, level, dir)\n end\n else\n while node_compare(xnext, start_key) < 0\n x = xnext\n xnext = node_next(x, level, dir)\n end\n end\n end\n xnext == anchor(!reverse) and return nil\n node_key(xnext)[0, start_key.size] != start_key and return nil\n xnext\n end", "def search_within_range(start_time, end_time)\n url = \"#{BASE_URL}\\?q\\=location:#{LOCATION}+created:#{start_time.iso8601}..#{end_time.iso8601}\"\n url = url + \"&access_token=#{ACCESS_TOKEN}\" if ACCESS_TOKEN # speed up if possible\n uri = URI(url)\n json = get_json_from_github(uri)\n\n # if total_count is larger than limit, do spliting\n if json['total_count'].to_i > API_SEARCH_LIMIT\n middle_time = (start_time.to_i + end_time.to_i)/2\n # binary search first part\n search_within_range(start_time, Time.at(middle_time).utc)\n # binary search second part\n search_within_range(Time.at(middle_time).utc, end_time)\n else\n # page through results\n end_page = json['total_count'].to_i/API_PAGE_LIMIT + 1\n\n (1..end_page).each do |page|\n url = \"#{BASE_URL}\\?q\\=location:#{LOCATION}+created:#{start_time.iso8601}..#{end_time.iso8601}&page=#{page}&per_page=#{API_PAGE_LIMIT}\"\n url = url + \"&access_token=#{ACCESS_TOKEN}\" if ACCESS_TOKEN\n uri = URI(url)\n json = get_json_from_github(uri)\n $sg_users.concat(json['items'])\n puts \"Added #{json['items'].size} users into list\"\n end\n end\nend", "def zrange(key, start, stop, byscore: T.unsafe(nil), by_score: T.unsafe(nil), bylex: T.unsafe(nil), by_lex: T.unsafe(nil), rev: T.unsafe(nil), limit: T.unsafe(nil), withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end", "def smembers(key)\n node_for(key).smembers(key)\n end", "def zrange(key, start, stop, options = {})\n args = [:zrange, key, start, stop]\n\n if options[:withscores]\n args << 'WITHSCORES'\n block = Redis::FloatifyPairs\n end\n\n call(key, args, transform: block, read: true)\n end", "def slice(start, length = nil)\n case start\n when Integer\n if length\n range(start, start + length - 1)\n else\n conn.lindex(key, start) rescue nil\n end\n when Range, Array\n range *range_pair(start)\n else\n []\n end\n end", "def zrange(key, start, stop, **options)\n node_for(key).zrange(key, start, stop, **options)\n end", "def breadth_first_search(start, target)\n queue = [ @vertices[start] ]\n visited = []\n until queue.empty?\n vertex = queue.shift\n break if vertex.key == target\n visited << vertex\n vertex.neighbors.each { |key| queue << @vertices[key] unless visited.include?(@vertices[key])}\n end\n visited\n end", "def search_members(query, options = {})\n get search_path(\"members\"), options.merge(query: query)\n end", "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", "def start_point; get(start_param) end", "def sismember(key, member); end", "def sismember(key, member); end", "def getrange(key, start, stop)\n send_command([:getrange, key, Integer(start), Integer(stop)])\n end", "def members *args\n page, per_page, options = TibbrResource.extract_params(args, 2)\n cache_lookup(MEMBERS, true, page, per_page) do\n TibbrResource.paginate_collection(get(:members, :params => {:include_group_members => options[:include_group_members], :page => page, :per_page => per_page}), User)\n end\n end", "def find_start(id, from)\n from= to_epoch(from)\n node = $devices[id].head\n while node.next do\n return node if node.value >= from\n node = node.next\n end\n return nil #from time not in list\nend", "def query_hash_range(key, start, count, step_size, ts_index, ts_size = 2)\n hash = make_redis_hash(start, count, step_size, ts_index, ts_size)\n\n ckey = convert_keys(key)\n node = @root[ckey]\n\n keys = hash.to_a.sort_by { |it| it[0] }\n mres = @redis.pipelined do\n keys.each do |key, values|\n node[key].hmget(*values)\n end\n end\n\n mres.flatten.collect(&:to_i)\n end", "def search_followers(query)\n redis.zrangebyscore relationship_followers_key, start_score(query), stop_score(query)\n end", "def find_moves(start, target)\n visited = breadth_first_search(start, target)\n moves = []\n find_coordinate = target\n visited.reverse.each do |vertex|\n vertex.neighbors.each do |coordinate|\n if coordinate == find_coordinate\n moves << vertex.key\n find_coordinate = vertex.key\n end\n end\n end\n moves.reverse << target\n end", "def lrange(key, start, stop)\n node_for(key).lrange(key, start, stop)\n end", "def find_between(start, stop)\n asteroids = Array.new\n File.open(@db_file, 'r').each do |line|\n arr = line.split(';')\n tmp = arr[0].to_i\n if ((tmp >= start) && (tmp <= stop) )\n resonance = arr[1].delete('[').delete(']').split(',').map{|x| x.to_f}\n asteroids.push(Asteroid.new(arr[0], resonance))\n end\n end\n asteroids\n end", "def find_in_range *args\n if args[0].respond_to?(:first) && args[0].respond_to?(:last)\n\tt_start = args[0].first\n\tt_end = args[0].last\n else\n\tt_start = args[0]\n\tt_end = args[1]\n end\n opts = args.last if args.last.respond_to?(:keys)\n if opts\n\tlimit = opts[:limit]\n end\n result = []\n count = 1\n loop do\n rnext = find_next t_start\n break if count > limit if limit\n\tbreak if rnext > t_end\n result << rnext\n t_start = rnext + 1\n\tcount += 1\n end\n result\n end", "def range(start, stop)\n fetch(key.call(\"LRANGE\", start, stop))\n end", "def each_member (&code)\n threads = []\n results = {}\n @members.each do |member|\n threads << Thread.new do\n results[member.to_s] = member.instance_exec &code\n end\n end\n threads.each{|t|t.join}\n return results\n end", "def search\n @members = Member.search_by params[:category], params[:keywords], params[:is_active]\n\n render :template => '/api/members/index'\n end", "def find(boundary,value,start,stop)\n return start if start == stop\n mid_index, mid_time = find_middle(start,stop)\n # puts \"+ find_#{boundary} (#{value}, #{start}, #{stop}) [mid_index #{mid_index}:#{mid_time}]\"\n if mid_time == value\n find_adjacent(boundary,value,start,stop,mid_index)\n elsif mid_time > value\n mid_index -= 1 if mid_index == stop\n find(boundary, value, start, mid_index)\n elsif mid_time < value\n mid_index += 1 if mid_index == start\n find(boundary, value, mid_index, stop)\n end\n end", "def retrieve_members\n @root_member = nil\n @members = []\n shared = []\n @member_lookup = {}\n log.finer \"Retrieving members of dimension '#{@name}'\"\n alias_tbls = try{ @cube.get_alias_table_names.to_a }\n mbr_sel = try{ @cube.open_member_selection(\"MemberQuery\") }\n begin\n spec = %Q{@IDESCENDANTS(\"#{self.name}\")}\n query = <<-EOQ.strip\n <OutputType Binary\n <SelectMbrInfo(MemberName, MemberAliasName, ParentMemberName,\n MemberGeneration, MemberLevel, Consolidation,\n ShareOption, MemberFormula, UDAList)\n EOQ\n @cube.instrument 'retrieve_members', dimension: self do\n try{ mbr_sel.execute_query(query, spec) }\n end\n mbr_sel.get_members.get_all.each do |ess_mbr|\n mbr = Member.new(self, ess_mbr, alias_tbls)\n @members << mbr\n if mbr.shared?\n shared << mbr\n else\n @member_lookup[mbr.name.upcase] = mbr\n end\n end\n # Link shared members to non-shared member (and vice versa)\n shared.each do |smbr|\n mbr = @member_lookup[smbr.name.upcase]\n smbr.instance_variable_set(:@non_shared_member, mbr)\n mbr.instance_variable_get(:@shared_members) << smbr\n end\n @root_member = @member_lookup[self.name.upcase]\n # Convert parent names to references to the parent Member object\n # This can only be done after we've seen all members, since the\n # member selection query returns parents after children\n @members.each do |mbr|\n par = @member_lookup[mbr.parent.upcase]\n mbr.instance_variable_set(:@parent, par)\n par.instance_variable_get(:@children) << mbr if par\n end\n ensure\n try{ mbr_sel.close }\n end\n log.finer \"Retrieved #{@members.size} members\"\n end", "def [](key)\n @members[cast_key(key)]\n end", "def print_search_start(key, index)\n explain \"-\" * 120\n explain \"Already sorted zone:\"\n explain \"[#{@list[0..index - 1].join(\" \")}]\"\n explain \"\"\n explain \"Key: #{key}\"\n puts_key_pointer(index, show_list: true)\n end", "def zrange(key, start, stop, options = {})\n send_cluster_command([:zrange, key, start, stop, options])\n end", "def find_middle(start, stop)\n index = ((stop - start) / 2) + start\n time = time_at(index)\n [index, time]\n end", "def zrange(key, start, stop, **options); end", "def search\n # Check input parameters\n if params[:member_ids].blank?\n @error = 'You must choose at least one member to be in this group.'\n raise BadParams\n end\n if params[:leader_ids].blank?\n @error = 'You must choose at least one leader to lead this group.'\n raise BadParams\n end\n\n params[:max_groups] = params[:max_groups] && params[:max_groups].to_i > 0 ? params[:max_groups].to_i : params[:leader_ids].length\n params[:groups_per_leader] = params[:groups_per_leader] && params[:groups_per_leader].to_i > 0 ? params[:groups_per_leader].to_i : 1\n\n\n if params[:max_groups] > params[:leader_ids].length * params[:groups_per_leader]\n @error = \"You don't have enough leaders to lead #{pluralize(params[:max_groups], 'group')}. Either add more leaders, or increase the number of groups per leader.\"\n raise BadParams\n end\n @member_ids = params[:member_ids] ? Array.wrap(params[:member_ids]).map(&:to_i) : []\n @co_leader_ids = params[:co_leader_ids] ? Array.wrap(params[:co_leader_ids]).map(&:to_i) : []\n @leader_ids = params[:leader_ids] ? Array.wrap(params[:leader_ids]).map(&:to_i) : []\n person_ids = @member_ids + @co_leader_ids + @leader_ids\n unless person_ids.empty?\n @people = Person.find(:all, :conditions => [\"#{_(:id, :person)} in (?)\", person_ids])\n timetables = {}\n @no_timetable = []\n @people.each_with_index do |person, i|\n if person.free_times.empty?\n @no_timetable << person\n Timetable.initialize_timetable(person)\n end\n timetables[person] = Timetable.setup_timetable(person)\n end\n # @people -= @no_timetable\n unless @people.empty?\n num_blocks = (params[:length].to_f.hours || 1.hour) / Timetable::INTERVAL\n num_blocks = num_blocks > 0 ? num_blocks : 1\n user_weights = []\n midnight = Time.now.beginning_of_day\n stop_time = midnight + (Timetable::LATEST - (Timetable::INTERVAL * num_blocks))\n\n\n possible_times = []\n 7.times do |day|\n time = midnight + Timetable::EARLIEST\n while time < stop_time\n time_in_seconds = time.to_i - midnight.to_i\n possible_times << {:time => time_in_seconds, :score => 0, :day => day}\n time += Timetable::INTERVAL\n end\n end\n @people.each_with_index do |person, i|\n user_weights[i] = 1.0 / @people.length\n end\n\n # logger.debug \"Initial weights: \\n#{user_weights.inspect}\\n\\n\"\n\n needed_groups = params[:max_groups]\n\n top_times = Timetable.get_top_times(user_weights, timetables, num_blocks, needed_groups, possible_times, @people, @leader_ids)\n\n groups = []\n # if needed_groups > 1\n top_times.each_with_index do |top_time, i|\n groups << [top_time]\n possible_times -= [top_time]\n end\n # end\n\n # pp groups\n\n (2..needed_groups).each do |i|\n # Otherwise, just go with the top pick and recurse from there\n groups.each_with_index do |group, gi|\n time = Timetable.get_top_times(group[i - 2][:user_weights], timetables, num_blocks, needed_groups, possible_times, @people, @leader_ids, group[i - 2][:assigned], i)[0]\n possible_times -= [time]\n groups[gi] << time\n end\n end\n\n # groups.each_with_index do |group, i|\n # logger.debug \"Options #{i + 1}\"\n # group.each do |time_slot|\n # logger.debug \"#{time_slot[:day]} - #{time_slot[:time] / 60.0 / 60}: #{time_slot[:score]}\"\n # end\n # end\n @groups = groups\n end\n end\n\n respond_to do |wants|\n wants.js do\n render :update do |page|\n page[:results].replace_html :partial => 'possible_times'\n page[:results].show\n page[:spinnersubmit].hide\n page[:timetable_search].hide\n end\n end\n end\n rescue BadParams\n respond_to do |wants|\n wants.js do\n render :update do |page|\n page[:results].hide\n page[:spinnersubmit].hide\n page.alert(@error)\n end\n end\n end\n ensure\n # Clear fake timetables\n @no_timetable.each do |person|\n person.timetable.free_times.destroy_all\n end if @no_timetable\n end", "def set_members(key)\n perform_read(:set_members, key)\n end", "def get_range\n\t\tif params.has_key?(\"start\") and params.has_key?(\"end\")\n\t\t\tif params[\"end\"] == \"Z\"\n\t\t\t\t# had to do some hackish stuff to include Z\n\t\t\t\tfirst = AToZEntry.select(:topic, :id).where(topic: params[:start]..params[:end])\n\t\t\t\tprefix = 'Z'\n\t\t\t\tsecond = AToZEntry.select(:topic, :id).where(\"topic LIKE :prefix\", prefix: \"#{prefix}%\")\n\t\t\t\trespond({ status: 0, topics: first+second })\n\t\t\telse\n\t\t\t\trespond({ status: 0, topics: AToZEntry.select(:topic, :id).where(topic: params[:start]..params[:end]) })\n\t\t\tend\t\t\t\n\t\telse\n\t\t\trespond({ status: 1, error: \"Must supply :start and :end parameter.\" })\n\t\tend\t\n\tend", "def zrange(key, start, stop, options = {})\n send_cluster_command([:zrange, key, start, stop, options],\n master_only: false)\n end", "def starts_with(prefix)\n search_arr(prefix.chars)\n end", "def smembers(key)\n if queues?(key)\n servers.inject([]) { |a, s| a + s.smembers(key) }.uniq\n else\n server_for(key).smembers(key)\n end\n end", "def list_members(prefix = nil, options={})\n raise NotImplementedError\n end", "def valid_start_node(positions, avg_start_position = AVERAGE_START_POSITION)\n positions.collect{|p| p.split(':')[1].to_f }.inject{ |sum, el| sum + el } / positions.size <= avg_start_position\nend", "def rscan(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"rscan\", start, stop, limit], :multi => true, :proc => T_STRSTR\n end\n end", "def preorder_search(start, find_val)\n false\n end", "def find_start nums, target, left, right\n if left + 1 >= right\n return left if nums[left] == target\n return right if nums[right] == target\n return -1\n end\n\n mid = left + (right - left) / 2\n\n if nums[mid] >= target\n right = mid\n else\n left = mid\n end\n\n find_start nums, target, left, right\nend", "def zmscore(key, *members); end", "def zmscore(key, *members); end", "def in_bounds(swy, swx, ney, nex, to_return = 10, start_from = 0)\n results_from_search many.within_bounds(swy, swx, ney, nex, to_return, start_from)\n end", "def rscan(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"rscan\", start, stop, limit], multi: true, proc: T_STRSTR\n end\n end", "def index\n @member_check_ins = MemberCheckIn.search(params[:search])\n end", "def start\n\t\t\t@start < @end ? @start : @end\n\t\tend", "def binary_search(array, key, start_position)\n left = start_position\n right = array.size - 1\n\n while left < right\n mid = (left + right) / 2\n\n if array[mid] < key\n left = mid + 1\n else\n right = mid\n end\n end\n\n (left == right && array[left] == key) ? left : -1\nend", "def starting_by\n @prefix = starting_prefix_param\n @tags = Tag.starting_by(@prefix)\n end", "def from(start_key)\n unless partition_specified?\n raise IllegalQuery,\n \"Can't construct exclusive range on partition key #{range_key_name}\"\n end\n scoped(lower_bound: bound(true, true, start_key))\n end", "def lrange(key, start, stop); end", "def lrange(key, start, stop); end", "def if_match(teams, start)\n\tmatch = Array.new\n\ttest = FuzzyStringMatch::JaroWinkler.create( :native )\n\twhile start < RC_C.num_rows\n\t\tteams.each do |team|\n\t\t\ti = test.getDistance(team, RC_C.rows[start][1])\n\t\t\tif i > 0.65\n\t\t\t\tmatch.push(team)\n\t\t\t\t# puts \"match, #{team} matches #{RC_C.rows[start][1]}\"\n\t\t\tend\n\t\tend\n\t\tstart += 1\n\tend\n\treturn match\nend", "def bitcount(key, start = 0, stop = -1)\n node_for(key).bitcount(key, start, stop)\n end", "def start # :nodoc:\n run_corpus\n run_matchers\n save_unmatched_words\n find_event if @matches[:event].empty?\n @matches\n end", "def set_members(key)\n timeout_retry(3, 3){\n write \"SMEMBERS #{key}\\r\\n\"\n Set.new(multi_bulk_reply)\n }\n end", "def find_members \n Member.where(:user_guid => self.guid)\n end", "def multi_zget(key, members)\n members = Array(members) unless members.is_a?(Array)\n mon_synchronize do\n perform [\"multi_zget\", key, *members], :multi => true, :proc => T_MAPINT, :args => [members]\n end\n end", "def members_by_date date\n Member.all.joins(:participations).where(\"structure_id = ? and ((start_date <= ? and end_date >= ?) or end_date is ?)\", self.id, date, date, nil)\n end", "def starts_with(prefix)\n curr = @root\n prefix.each_char.all? do |char|\n curr = curr[char]\n end \n end", "def members_with_schedule *xmember_ids\n xmembers = members.where(id: xmember_ids)\n xmembers.each do |member|\n member.load_schedule_in_day self.date\n end\n xmembers\n end", "def zscore(key, member); end", "def zscore(key, member); end", "def startkey_doc(value)\n update_query(:startkey_docid => value.is_a?(String) ? value : value.id\n end\n\n # The opposite of +#startkey+, finds all index entries whose key is before the value specified.\n #\n # See the +#startkey+ method for more details and the +#inclusive_end+ option.\n def endkey(value)\n raise \"View#endkey cannot be used when key has been set\" unless query[:key].nil?\n update_query(:endkey => value)\n end\n\n # The result set should end at the position of the provided document. \n # The value may be provided as an object that responds to the +#id+ call\n # or a string.\n def endkey_doc(value)\n update_query(:endkey_docid => value.is_a?(String) ? value : value.id\n end\n\n\n # The results should be provided in descending order.\n #\n # Descending is false by default, this method will enable it and cannot be undone.\n def descending\n update_query(:descending => true)\n end\n\n # Limit the result set to the value supplied.\n def limit(value)\n update_query(:limit => value)\n end\n\n # Skip the number of entries in the index specified by value. This would be\n # the equivilent of an offset in SQL.\n #\n # The CouchDB documentation states that the skip option should not be used\n # with large data sets as it is inefficient. Use the +startkey_doc+ method\n # instead to skip ranges efficiently.\n def skip(value = 0)\n update_query(:skip => value)\n end\n\n # Use the reduce function on the view. If none is available this method will fail. \n def reduce\n update_query(:reduce => true)\n end", "def list_range(key, start, ending)\n timeout_retry(3, 3){\n write \"LRANGE #{key} #{start} #{ending}\\r\\n\"\n multi_bulk_reply\n }\n end", "def binary_search array, value, start, ends\n\treturn false if start > ends\n\tpivote = start + ((ends - start) / 2).floor\n\tif value == array[pivote]\n\t\treturn count_repeated array, value, pivote\n\telsif value > array[pivote]\n\t\tbinary_search array, value, pivote+1, ends\n\telse value < array[pivote]\n\t\tbinary_search array, value, start, pivote-1\n\tend\nend", "def starts_with(prefix)\n if search_node(prefix) == nil\n return false\n else\n return true\n end\n end", "def find(prefix)\n\t\tfound_entries = entries.select do |key, value|\n\t\t\tkey[0...prefix.length] == prefix\n\t\tend\n\tend", "def reduce_starts_with(_production, _range, _tokens, _children)\n begin_anchor\n end", "def stand_by_members\n return [] if all_members.size <= max_battle_members\n all_members[max_battle_members, 99].select { |actor| actor.exist? }\n end", "def lrange(key, start, stop)\n send_command([:lrange, key, Integer(start), Integer(stop)])\n end", "def call(cluster:, members:, partitions:)\n partitions_per_member = Hash.new {|h, k| h[k] = [] }\n relevant_partitions = valid_sorted_partitions(members, partitions)\n members_ids = members.keys\n iterator = (0...members.size).cycle\n idx = iterator.next\n\n relevant_partitions.each do |partition|\n topic = partition.topic\n\n while !members[members_ids[idx]].topics.include?(topic)\n idx = iterator.next\n end\n\n partitions_per_member[members_ids[idx]] << partition\n idx = iterator.next\n end\n\n partitions_per_member\n end", "def start; @opts['start']; end", "def multi_zget(key, members)\n members = Array(members) unless members.is_a?(Array)\n mon_synchronize do\n perform [\"multi_zget\", key, *members], multi: true, proc: T_MAPINT, args: [members]\n end\n end", "def startkey(value)\n raise \"View#startkey cannot be used when key has been set\" unless query[:key].nil?\n update_query(:startkey => value)\n end" ]
[ "0.6061801", "0.5776801", "0.5776801", "0.5573358", "0.5560411", "0.5505805", "0.5433612", "0.5432406", "0.54290104", "0.54290104", "0.5346867", "0.53383964", "0.5331739", "0.53166676", "0.53040826", "0.52452666", "0.523969", "0.5209705", "0.52024096", "0.51676834", "0.5151044", "0.5144297", "0.5144297", "0.5133508", "0.5037037", "0.49822664", "0.49077466", "0.49072066", "0.4900351", "0.4880055", "0.48702532", "0.48656732", "0.4838116", "0.48135197", "0.48117587", "0.48117587", "0.47922176", "0.4788184", "0.4777644", "0.47660828", "0.47621697", "0.47476092", "0.47360638", "0.47209504", "0.47100863", "0.46891865", "0.46708232", "0.46705619", "0.4669891", "0.46555316", "0.46520415", "0.464666", "0.46373084", "0.4636911", "0.46256256", "0.46216622", "0.46023363", "0.46008784", "0.46004322", "0.457679", "0.4564181", "0.45447585", "0.45433736", "0.45386413", "0.45346946", "0.45346212", "0.45320022", "0.45320022", "0.45272756", "0.45211145", "0.45063493", "0.4505586", "0.45031905", "0.4500675", "0.4500112", "0.44920996", "0.44920996", "0.44860873", "0.4485924", "0.44799763", "0.44591665", "0.44485784", "0.44473332", "0.4443345", "0.4438241", "0.44376433", "0.44302288", "0.44302288", "0.44299892", "0.4426097", "0.44063193", "0.4403779", "0.4400123", "0.4394294", "0.4389212", "0.43891558", "0.43861488", "0.43681166", "0.4360941", "0.43560508" ]
0.54970205
6
Reverse scans for members at `key` starting at `start_member` between `start` and `stop` scores.
def zrscan(key, start, stop, opts = {}) limit = opts[:limit] || -1 mon_synchronize do perform ["zrscan", key, BLANK, start, stop, limit], :multi => true, :proc => T_STRINT end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zrevrange(key, start, stop, withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end", "def zrevrange(key, start, stop, options = {})\n args = [:zrevrange, key, start, stop]\n\n if options[:withscores]\n args << 'WITHSCORES'\n block = Redis::FloatifyPairs\n end\n\n call(key, args, transform: block, read: true)\n end", "def zrevrange(key, start, stop, **options)\n node_for(key).zrevrange(key, start, stop, **options)\n end", "def zrevrange(key, start, stop, **options); end", "def zremrangebyrank(key, start, stop)\n node_for(key).zremrangebyrank(key, start, stop)\n end", "def zremrangebyrank(key, start, stop); end", "def zremrangebyrank(key, start, stop); end", "def zremrangebyrank(key, start, stop)\n call(key, [:zremrangebyrank, key, start, stop])\n end", "def zrange(key, start, stop, byscore: T.unsafe(nil), by_score: T.unsafe(nil), bylex: T.unsafe(nil), by_lex: T.unsafe(nil), rev: T.unsafe(nil), limit: T.unsafe(nil), withscores: T.unsafe(nil), with_scores: T.unsafe(nil)); end", "def members(key, options = default_paging_options)\n options = default_paging_options.dup.merge!(options)\n if options[:page] < 1\n options[:page] = 1\n end\n\n if options[:page] > total_pages(key, options[:page_size])\n options[:page] = total_pages(key, options[:page_size])\n end\n\n index_for_redis = options[:page] - 1\n starting_offset = (index_for_redis * options[:page_size])\n\n if starting_offset < 0\n starting_offset = 0\n end\n\n ending_offset = (starting_offset + options[:page_size]) - 1\n Amico.redis.zrevrange(key, starting_offset, ending_offset, :with_scores => false)\n end", "def zremrangebyrank(key, start, stop)\n send_cluster_command([:zremrangebyrank, key, start, stop])\n end", "def zremrangebyrank(key, start, stop)\n send_cluster_command([:zremrangebyrank, key, start, stop])\n end", "def zscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zscan\", key, BLANK, start, stop, limit], multi: true, proc: T_STRINT\n end\n end", "def zrange(key, start, stop, options = {})\n args = [:zrange, key, start, stop]\n\n if options[:withscores]\n args << 'WITHSCORES'\n block = Redis::FloatifyPairs\n end\n\n call(key, args, transform: block, read: true)\n end", "def zscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zscan\", key, BLANK, start, stop, limit], :multi => true, :proc => T_STRINT\n end\n end", "def zrange(key, start, stop, **options)\n node_for(key).zrange(key, start, stop, **options)\n end", "def zrscan(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zrscan\", key, BLANK, start, stop, limit], multi: true, proc: T_STRINT\n end\n end", "def xrevrange(key, range_end = T.unsafe(nil), start = T.unsafe(nil), count: T.unsafe(nil)); end", "def search(start_key, end_key, limit, offset, reverse, with_keys)\n offset ||= 0\n \n start_node = find_by_prefix(start_key, reverse)\n !start_node and return []\n \n start_node = skip_nodes(start_node, offset, reverse)\n !start_node and return []\n \n collect_values(start_node, end_key, limit, reverse, with_keys)\n end", "def getrange(key, start, stop); end", "def getrange(key, start, stop); end", "def zrange(key, start, stop, **options); end", "def remove_by_range(start=nil, stop=nil)\n if !start and !stop\n throw \"Must specify either start or stop\"\n end\n\n start = start ? \"(#{start}\" : '-inf'\n stop = stop ? \"#{stop}\" : \"+inf\"\n\n # Get the keys to delete from the hash\n keys = @index.range_by_score(start, stop)\n # Remove the keys from the index\n @index.delete_by_score(start, stop)\n # Remove the values from the hash\n multi do\n keys.each do |key|\n @hash.delete(key)\n end\n end\n\n self\n end", "def xrevrange(key, range_end = '+', start = '-', count: nil)\n args = [:xrevrange, key, range_end, start]\n args.concat(['COUNT', count]) if count\n send_command(args, &HashifyStreamEntries)\n end", "def find_by_prefix(start_key, reverse)\n dir = dir_for_reverse(reverse)\n x = anchor(reverse)\n # if no prefix given, just return a first node\n !start_key and return node_next(x, 0, dir)\n \n level = node_level(x)\n while level > 0\n level -= 1\n xnext = node_next(x, level, dir)\n if reverse\n # Note: correct key CAN be greater than start_key in this case \n # (like \"bb\" > \"b\", but \"b\" is a valid prefix for \"bb\")\n while node_compare2(xnext, start_key) > 0\n x = xnext\n xnext = node_next(x, level, dir)\n end\n else\n while node_compare(xnext, start_key) < 0\n x = xnext\n xnext = node_next(x, level, dir)\n end\n end\n end\n xnext == anchor(!reverse) and return nil\n node_key(xnext)[0, start_key.size] != start_key and return nil\n xnext\n end", "def range(start, stop)\n fetch(redis.zrange(key, start, stop))\n end", "def zrangestore(dest_key, src_key, start, stop, byscore: T.unsafe(nil), by_score: T.unsafe(nil), bylex: T.unsafe(nil), by_lex: T.unsafe(nil), rev: T.unsafe(nil), limit: T.unsafe(nil)); end", "def zkeys(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zkeys\", key, BLANK, start, stop, limit], multi: true\n end\n end", "def zrevrank(key, member); end", "def zrevrank(key, member); end", "def descending\n swap(:startkey, :endkey) if query[:startkey] || query[:endkey]\n swap(:startkey_docid, :endkey_docid) if query[:startkey_docid] || query[:endkey_docid]\n\n update_query(:descending => true)\n end", "def rindex(member)\n conn.zrevrank(key, member)\n end", "def zkeys(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zkeys\", key, BLANK, start, stop, limit], :multi => true\n end\n end", "def getrange(key, start, stop)\n node_for(key).getrange(key, start, stop)\n end", "def zrange(key, start, stop, options = {})\n send_cluster_command([:zrange, key, start, stop, options],\n master_only: false)\n end", "def zrange(key, start, stop, options = {})\n send_cluster_command([:zrange, key, start, stop, options])\n end", "def rindex(loc, stop=99) end", "def ltrim(key, start, stop); end", "def ltrim(key, start, stop); end", "def get_users_stops_by_line(line,origin_stop,destination_stop)\n # stop_list is an array which is line details\n stop_list = get_stop_details(line)\n origin_stop_index = stop_list.index(origin_stop)\n destination_stop_index = stop_list.index(destination_stop)\n\n if origin_stop_index < destination_stop_index\n stop_list[origin_stop_index + 1..destination_stop_index]\n\n else\n stop_list[destination_stop_index..origin_stop_index - 1].reverse()\n end\n end", "def rscan(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"rscan\", start, stop, limit], multi: true, proc: T_STRSTR\n end\n end", "def switch_keys_if_descending!(result)\n if result[:descending]\n startkey = result.delete(:startkey)\n endkey = result.delete(:endkey)\n result[:startkey] = endkey unless endkey.nil?\n result[:endkey] = startkey unless startkey.nil?\n end\n end", "def after(start_key)\n self.class.new(collection, range.merge({begin: start_key, begin_inclusive: false}))\n end", "def srem(key, *members); end", "def srem(key, *members); end", "def lrange(key, start, stop); end", "def lrange(key, start, stop); end", "def rscan(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"rscan\", start, stop, limit], :multi => true, :proc => T_STRSTR\n end\n end", "def zrevrank(key, member)\n call(key, [:zrevrank, key, member], read: true)\n end", "def down!(origin, stop)\n x = origin.row\n\n while x <= stop.row\n add_result extract!(IndexPath[x, origin.column])\n\n x += 1\n end\n\n # Begin moving left from the end of this row\n starts_at = IndexPath[stop.row, stop.column - 1]\n ends_at = IndexPath[stop.row, max_columns - stop.column]\n\n left!(starts_at, ends_at)\n end", "def zrem(key, member); end", "def zrem(key, member); end", "def move_subway start_stop, end_stop, line\n if start_stop > end_stop\n subway_stops = line[end_stop..start_stop - 1].reverse\n else\n subway_stops = line[start_stop + 1..end_stop]\n end\nend", "def zrevrank(key, member)\n node_for(key).zrevrank(key, member)\n end", "def inverse(start=0)\n start = 0 if [true, false].include?(start) and start\n self.transpose(-1, true).transpose(start+1)\n end", "def slice(start, length = nil)\n case start\n when Integer\n if length\n range(start, start + length - 1)\n else\n conn.lindex(key, start) rescue nil\n end\n when Range, Array\n range *range_pair(start)\n else\n []\n end\n end", "def getrange(key, start, stop)\n send_command([:getrange, key, Integer(start), Integer(stop)])\n end", "def lrange(key, start, stop)\n node_for(key).lrange(key, start, stop)\n end", "def range(start, stop)\n fetch(key.call(\"LRANGE\", start, stop))\n end", "def zrevrangebylex(key, max, min, limit: T.unsafe(nil)); end", "def ltrim(key, start, stop)\n node_for(key).ltrim(key, start, stop)\n end", "def reverse(my_words, start_index, end_index)\n while start_index < end_index\n temp = my_words[start_index]\n my_words[start_index] = my_words[end_index]\n my_words[end_index] = temp\n start_index += 1\n end_index -= 1\n end\n return my_words\nend", "def palindromes(start, range_from_start, cmp)\n raise 'no' if range_from_start[start].size == 0\n\n stats = {skip1: nil, skip2s: [], checks: 0}\n\n winner = nil\n products = []\n range_from_start[start].each { |a|\n next if a % 10 == 0\n break stats[:skip1] = a if winner&.send(cmp, a * a)\n range_from_start[a].each { |b|\n stats[:checks] += 1\n product = a * b\n break stats[:skip2s] << [a, b].freeze if winner&.send(cmp, product)\n next if (d = product.digits).reverse != d\n if product == winner\n products << [a, b].sort\n else\n winner = product\n products = [[a, b].sort]\n end\n }\n }\n #p stats\n {'value' => winner, 'factors' => products}\nend", "def z_list_range(key, start = 0, count = 1)\n handle_pipeline(@redis.zrevrange(key, start, start + count - 1)) { |object|\n list = Array(object).map(&method(:without_uuid))\n\n next list.first if count == 1\n\n list\n }\n end", "def srem(key, *members)\n node_for(key).srem(key, *members)\n end", "def zrem(key, member)\n call(key, [:zrem, key, member])\n end", "def start(start_key)\n self.class.new(collection, range.merge({begin: start_key, begin_inclusive: true}))\n end", "def down(start)\n if start <= 0\n puts start\n else\n puts start\n down(start-1)\n end\nend", "def zrem(key, member)\n node_for(key).zrem(key, member)\n end", "def rslice(range, options = {})\n start, finish = range_pair(range)\n fetch_range :zrevrange, start, finish, options\n end", "def zrangestore(dest_key, src_key, start, stop, **options); end", "def reverse_word(start_i, end_i, all_words)\n while start_i < end_i\n temp = all_words[start_i]\n all_words[start_i] = all_words[end_i]\n all_words[end_i] = temp\n start_i += 1\n end_i -= 1\n end\n return all_words\nend", "def find_moves(start, target)\n visited = breadth_first_search(start, target)\n moves = []\n find_coordinate = target\n visited.reverse.each do |vertex|\n vertex.neighbors.each do |coordinate|\n if coordinate == find_coordinate\n moves << vertex.key\n find_coordinate = vertex.key\n end\n end\n end\n moves.reverse << target\n end", "def stopGetter(stop_1, stop_2, line)\n if stop_1 > stop_2\n return line[stop_2..stop_1].reverse!\n else\n return line[stop_1..stop_2]\n end\nend", "def get_range(from, to, options = {})\n if options.delete(:include_boundaries)\n connection.zrevrangebyscore(key_label, to, from, options)\n else\n connection.zrevrangebyscore(key_label, \"(#{to}\", \"(#{from}\", options)\n end\n end", "def get_range_by_reverse_rank(from, to, options = {})\n connection.zrange(key_label, from, to, options)\n end", "def remove_before(stop)\n remove_by_range(nil, stop)\n end", "def lrange(key, start, stop)\n send_command([:lrange, key, Integer(start), Integer(stop)])\n end", "def zdecr(key, member, score = 1)\n mon_synchronize do\n perform [\"zdecr\", key, member, score], proc: T_INT\n end\n end", "def keys(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"keys\", start, stop, limit], multi: true\n end\n end", "def zrevrangebyscore(key, max, min, withscores: T.unsafe(nil), with_scores: T.unsafe(nil), limit: T.unsafe(nil)); end", "def word_reverse(my_words, word_start, word_end)\n return nil if my_words == nil || my_words.length == 0\n\n i = word_start # first index of character word word\n j = word_end # last index of character in word\n\n while i < j\n temp = my_words[i] # swap with temporary variable\n my_words[i] = my_words[j]\n my_words[j] = temp\n i += 1\n j -= 1\n end\n return\nend", "def remove_range(from = '-inf', to = '+inf')\n connection.zremrangebyscore(key_label, from, to)\n end", "def zdecr(key, member, score = 1)\n mon_synchronize do\n perform [\"zdecr\", key, member, score], :proc => T_INT\n end\n end", "def backwardsPrime(start, stop)\n prime_array = []\n (start..stop).each do |i|\n next if i == reverse_number(i)\n next unless prime_number?(i)\n next unless prime_number?(reverse_number(i))\n prime_array << i\n end\n prime_array\nend", "def zscore(key, member); end", "def zscore(key, member); end", "def remove_members(*args)\n from = args.pop if args.last.is_a?(Symbol) || (args.length > 1 && args.last.is_a?(Array))\n return self if args.empty?\n changing_members do\n args.flatten(1).each do |arg|\n m = self.class.to_member(arg)\n \n if exists = m.find_in(members) rescue nil\n exists.delete if exists.remove_grant(from)\n end\n\n if source = m.as_source\n members.select{|m| m.remove_grant(source) }.map(&:delete)\n end\n end\n end\n self\n end", "def keys(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"keys\", start, stop, limit], :multi => true\n end\n end", "def right!(origin, stop)\n y = origin.column\n\n while y <= stop.column\n add_result extract!(IndexPath[origin.row, y])\n\n y += 1\n end\n\n # Begin moving down from the end of this row\n starts_at = IndexPath[stop.row + 1, stop.column]\n ends_at = IndexPath[max_rows - stop.row, stop.column]\n\n down!(starts_at, ends_at)\n end", "def get_range_by_rank(from, to, options = {})\n connection.zrevrange(key_label, from, to, options)\n end", "def up!(origin, stop)\n x = origin.row\n\n while x >= stop.row\n add_result extract!(IndexPath[x, origin.column])\n\n x -= 1\n end\n\n # Begin moving right from the start of this row\n starts_at = IndexPath[stop.row, stop.column + 1]\n ends_at = IndexPath[stop.row, max_columns - stop.column - 1]\n\n right!(starts_at, ends_at)\n end", "def after(start_key)\n scoped(lower_bound: bound(true, false, start_key))\n end", "def zrank(key, member); end", "def zrank(key, member); end", "def scan(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"scan\", start, stop, limit], multi: true, proc: T_STRSTR\n end\n end", "def run_reverse\n reversed_metrics.each do |reversed_metric|\n GRADES.first(GRADES.count / 2).each do |grade|\n grade_metrics = classifier[grade]\n next unless grade_metrics[reversed_metric].present?\n\n reversed_grade_metrics = classifier[REVERSED_GRADES[grade]]\n\n reversed_grade_metrics[reversed_metric], grade_metrics[reversed_metric] =\n grade_metrics[reversed_metric], reversed_grade_metrics[reversed_metric]\n end\n end\n end", "def srem?(key, *members); end", "def srem?(key, *members); end", "def zlist(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zlist\", start, stop, limit], multi: true\n end\n end" ]
[ "0.6757369", "0.6667707", "0.65871423", "0.653469", "0.6254648", "0.62169224", "0.62169224", "0.6160356", "0.6121901", "0.5835975", "0.57464373", "0.56901807", "0.567337", "0.563982", "0.5603473", "0.55687296", "0.55534947", "0.55073726", "0.542154", "0.5393034", "0.5393034", "0.5374387", "0.5334164", "0.5275148", "0.525401", "0.52427924", "0.52289313", "0.5221473", "0.52198344", "0.52198344", "0.5200453", "0.5168042", "0.5163302", "0.51113516", "0.5106163", "0.5101948", "0.5061001", "0.5048858", "0.5048858", "0.50200045", "0.49999765", "0.49907207", "0.49771184", "0.49510938", "0.49510938", "0.49445096", "0.49445096", "0.49374375", "0.49228457", "0.4906814", "0.4901025", "0.4901025", "0.4863061", "0.48461986", "0.4831", "0.48112968", "0.4808123", "0.4799062", "0.47677284", "0.47512785", "0.47150436", "0.47145152", "0.4691186", "0.4687111", "0.46756986", "0.46618503", "0.46473387", "0.46117476", "0.46081746", "0.46038216", "0.4599748", "0.4599545", "0.45817533", "0.45777392", "0.4567297", "0.45642015", "0.45608583", "0.45446548", "0.4527986", "0.4520733", "0.45198646", "0.4519563", "0.451522", "0.4509108", "0.45057592", "0.44975936", "0.44975936", "0.44946322", "0.44936284", "0.44833523", "0.44809598", "0.44782373", "0.44744912", "0.44653568", "0.44653568", "0.44541", "0.444697", "0.44350967", "0.44350967", "0.4429094" ]
0.55055606
18
Checks existence of multiple sets
def multi_zexists(keys) keys = Array(keys) unless keys.is_a?(Array) mon_synchronize do perform ["multi_zexists", *keys], :multi => true, :proc => T_VBOOL end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def does_set_exist!\n\t\ttrue_set = []\n\t\twhile true_set.length == 0 do\n\t\t\tpossibleCombination = @board.combination(3).to_a\n\t\t\tpossibleCombination.each do |setOf3| \n\t\t\t\tif Board.actual_set?(setOf3)\n\t\t\t\t\ttrue_set = setOf3\n\t\t\t\t\tbreak\n\t\t\t\tend \n\t\t\tend\n\t\t\tif true_set.length == 0\n\t\t\t\tadd_cards\n\t\t\tend\n\t\tend\n\t\treturn true_set\n\tend", "def valid?(set); end", "def accept_multiple_sets?\n return true\n end", "def valid_sets; end", "def superset?(set)\n self.all? { |val| set.include?(val) }\n end", "def intersect?(set)\n return (@val & set.to_i) > 0 if set.is_a?(IntegerSet)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n if size < set.size\n any? { |o| set.include?(o) }\n else\n set.any? { |o| include?(o) }\n end\n end", "def multi_exists(keys)\n keys = Array(keys) unless keys.is_a?(Array)\n mon_synchronize do\n perform [\"multi_exists\", *keys], multi: true, proc: T_VBOOL\n end\n end", "def subset?(set)\n set.all? { |val| self.include?(val) }\n end", "def multi_exists(keys)\n keys = Array(keys) unless keys.is_a?(Array)\n mon_synchronize do\n perform [\"multi_exists\", *keys], :multi => true, :proc => T_VBOOL\n end\n end", "def verify_set?(set)\n is_set = false # keep track of valid set\n\n # get arrays of the cards' attributes\n colors = [set[0].color, set[1].color, set[2].color]\n numbers = [set[0].number, set[1].number, set[2].number]\n shapes = [set[0].shape, set[1].shape, set[2].shape]\n textures = [set[0].texture, set[1].texture, set[2].texture]\n\n # or any attribute, if the attribute is the same or different\n # across the cards then the cards are a set.\n # this checks that no attribute is the same for two cards\n # and different for another, because that is the only case\n # where the cards are not a set.\n if colors.uniq.length != 2 && numbers.uniq.length != 2 && shapes.uniq.length != 2 && textures.uniq.length != 2\n is_set = true\n end\n\n # make sure no cards are duplicates\n if set.uniq.length != 3\n is_set = false\n end\n\n is_set # return value\nend", "def proper_subset?(set)\n case\n when set.instance_of?(self.class) && @hash.respond_to?(:<)\n @hash < set.instance_variable_get(:@hash)\n when set.is_a?(Set)\n size < set.size && all? { |o| set.include?(o) }\n else\n raise ArgumentError, \"value must be a set\"\n end\n end", "def proper_subset?(set)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if set.size <= size\n all? { |o| set.include?(o) }\n end", "def all_words_valid? set\n (set & DICTIONARY) == set\n end", "def subset?(other_set)\n other_set.set.all? { |element| include?(element) }\n end", "def intersect?(other_set)\n requires_set(other_set, __method__)\n intersection(other_set).any?\n end", "def subset?(set)\n case\n when set.instance_of?(self.class) && @hash.respond_to?(:<=)\n @hash <= set.instance_variable_get(:@hash)\n when set.is_a?(Set)\n size <= set.size && all? { |o| set.include?(o) }\n else\n raise ArgumentError, \"value must be a set\"\n end\n end", "def intersect?(set)\n case set\n when Set\n if size < set.size\n any? { |o| set.include?(o) }\n else\n set.any? { |o| include?(o) }\n end\n when Enumerable\n set.any? { |o| include?(o) }\n else\n raise ArgumentError, \"value must be enumerable\"\n end\n end", "def check!\n error = proc { | message | raise ArgumentError.new( message ) }\n set1_keys = set1.keys\n set2_keys = set2.keys\n set1_size = set1.size\n set2_size = set2.size\n\n # Check set1\n set1.each do | target , options |\n message = \"Preferences for #{ target.inspect } in `set1` do not match availabilities in `set2`!\"\n options = options.first if options.first.is_a?( Array )\n error[ message ] unless \\\n # Anything there is a preference for is in the other set\n ( options.all? { | preference | set2_keys.include?( preference ) } )\n end\n\n # Check set2 the same way\n set2.each do | target , options |\n message = \"Preferences for #{ target.inspect } in `set2` do not match availabilities in `set1`!\"\n options = options.first if options.first.is_a?( Array )\n error[ message ] unless \\\n # Anything there is a preference for is in the other set\n ( options.all? { | preference | set1_keys.include?( preference ) } )\n end\n\n # We've run the check\n self.checked = true\n end", "def proper_superset?(set)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if size <= set.size\n set.all? { |o| include?(o) }\n end", "def in_set?(set, element)\n set.each do |t|\n if t == element\n return true\n end\n end\n return false\n end", "def subset?(set)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if set.size < size\n all? { |o| set.include?(o) }\n end", "def disjoint?(set)\n !intersect?(set)\n end", "def disjoint?(set)\n !intersect?(set)\n end", "def is_set?\n result = true\n result = false unless correct_combination?@card1.color,@card2.color,@card3.color\n result = false unless correct_combination?@card1.number,@card2.number,@card3.number\n result = false unless correct_combination?@card1.symbol,@card2.symbol,@card3.symbol\n result = false unless correct_combination?@card1.shading,@card2.shading,@card3.shading\n @good_set = result\n result\n end", "def same_set?(a, b)\n ((a - b) + (b - a)).blank?\n end", "def maesb_set_complete?(maesb_equips)\n maesb_sets.each { |set| return true if set && set.set_complete?(maesb_equips) }\n return false\n end", "def disjoint?(set)\n !intersect?(set)\n end", "def subset?(other_set)\n requires_set(other_set, __method__)\n return true if self == other_set\n @internal_hash.keys.each { |k| return false unless other_set.include?(k) }\n true\n end", "def proper_subset?(set)\n return self != set && subset?(set) if set.is_a?(IntegerSet)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if set.size <= size\n all? { |o| set.include?(o) }\n end", "def superset?(set)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if size < set.size\n set.all? { |o| include?(o) }\n end", "def check_visibility(ids, optionss, foundss)\n optionss.zip(foundss).each do |options, founds|\n ids.zip(founds).each do |id, found|\n all(id, options).empty? != found or raise\n end\n end\n end", "def is_in_code_set?(code_set)\n codes.keys.each do |code_system|\n all_codes_in_system = code_set.find_all {|set| set['set'] == code_system}\n all_codes_in_system.each do |codes_in_system|\n matching_codes = codes_in_system['values'] & codes[code_system]\n if matching_codes.length > 0\n return true\n end\n end\n end\n false\n end", "def proper_superset?(set)\n case\n when set.instance_of?(self.class) && @hash.respond_to?(:>)\n @hash > set.instance_variable_get(:@hash)\n when set.is_a?(Set)\n size > set.size && set.all? { |o| include?(o) }\n else\n raise ArgumentError, \"value must be a set\"\n end\n end", "def exists(*keys); end", "def subset?(set)\n return (@val & ~set.to_i) == 0 if set.is_a?(IntegerSet)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if set.size < size\n all? { |o| set.include?(o) }\n end", "def sum_of_two?(set)\n set.any? { |x| set.include?(self-x) }\n end", "def must_unify?(seq1, seq2)\n unique_selectors = seq1.map do |sseq|\n next [] if sseq.is_a?(String)\n sseq.members.select {|sel| sel.unique?}\n end.flatten.to_set\n\n return false if unique_selectors.empty?\n\n seq2.any? do |sseq|\n next false if sseq.is_a?(String)\n sseq.members.any? do |sel|\n next unless sel.unique?\n unique_selectors.include?(sel)\n end\n end\n end", "def superset?(set)\n case\n when set.instance_of?(self.class) && @hash.respond_to?(:>=)\n @hash >= set.instance_variable_get(:@hash)\n when set.is_a?(Set)\n size >= set.size && set.all? { |o| include?(o) }\n else\n raise ArgumentError, \"value must be a set\"\n end\n end", "def multi_zexists(keys)\n keys = Array(keys) unless keys.is_a?(Array)\n mon_synchronize do\n perform [\"multi_zexists\", *keys], multi: true, proc: T_VBOOL\n end\n end", "def valid?(*args)\n valid = true\n @transformed_values.each do |sets| \n sets.each do |set| \n valid = false unless set.valid?\n end\n end\n valid\n end", "def ambiguous?\n found = chart.sets.find { |set| !set.ambiguities.empty? }\n !found.nil?\n end", "def valid?(set)\n set.is_a?(Hash) && set[\"values\"].is_a?(Hash)\n end", "def proper_superset?(set)\n return self != set && superset?(set) if set.is_a?(IntegerSet)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if size <= set.size\n set.all? { |o| include?(o) }\n end", "def assert_in_set reclist, att, set\n values = get_values(reclist, att)\n values.delete_if{|x,y| y.nil?}\n if values.values.length == 0\n log_v \"All values nil for #{reclist[0].class.name}'s #{att} attribute\"\n return\n end\n outliers = values.reject{|k,v| set.include?(v) }\n if outliers.size > 0\n announce 'INVALID DATA:'\n announce \"#{outliers.size} invalid #{att}s.\"\n announce \"Outliers: #{outliers.collect{|x,y| x}*', '}\" if outliers.size < 10\n if outliers.reject{|k,v| v.nil?}.count > 0\n badvals = outliers.collect{|k,v| v}.reject{|a| a.nil?}.uniq\n temp = outliers.reject{|k,v| v.nil?}.count\n announce \" Bad #{att}s: #{badvals * ', '} \" \n announce \" # records with bad #{att}: #{temp}\"\n end\n announce '------'\n else \n announce \"Valid data for #{att}!\\n ----- \"\n end\n end", "def noun_articles_present? set\n ((set & NOUNS).count >= 1) || ((set & ARTICLES).count >= 2)\n end", "def VerifySet? (card1,card2,card3)\n isAset = true\n\n #if a non-existing card is sent to VerifySet? then return false\n if(card1 == nil || card2 == nil || card3 == nil)\n return false\n end\n \n #Checks to see if all card numbers are the same\n if(!(card1.number == card2.number && card1.number == card3.number && card2.number == card3.number)) \n #If card numbers are the same between any two cards the cards are not a set \n if (card1.number == card2.number || card2.number == card3.number || card1.number == card3.number)\n isAset = false \n end \n end \n\n #Checks to see if all card colors are the same\n if(!(card1.color == card2.color && card1.color == card3.color && card2.color == card3.color)) \n #If card colors are the same between any two cards the cards are not a set \n if (card1.color == card2.color || card2.color == card3.color || card1.color == card3.color)\n isAset = false\n end \n end \n\n #Checks to see if all card shading are the same\n if(!(card1.shading == card2.shading && card1.shading == card3.shading && card2.shading == card3.shading))\n #If card shading are the same between any two cards the cards are not a set \n if (card1.shading == card2.shading || card2.shading == card3.shading || card1.shading == card3.shading)\n isAset = false\n end \n end \n\n #Checks to see if all card shape are the same\n if(!(card1.shape == card2.shape && card1.shape == card3.shape && card2.shape == card3.shape))\n #If card shape are the same between any two cards the cards are not a set \n if (card1.shape == card2.shape || card2.shape == card3.shape|| card1.shape == card3.shape)\n isAset = false\n end \n end \n \n return isAset\nend", "def has? *rolegroups\n list == rolegroups.to_symbols_uniq\n end", "def is_a_set?(cards)\n # The sum when adding one number 3 times or adding 3 consecutive numbers is divisible by 3.\n # This represents having all the same attribute or all different attributes.\n # Adding any other 3 number combo of 1,2,3 will result in a value not divisible by 3, failing to be a set.\n isSet = (cards[0].number + cards[1].number + cards[2].number) % 3 == 0 &&\n (cards[0].color + cards[1].color + cards[2].color) % 3 == 0 &&\n (cards[0].shape + cards[1].shape + cards[2].shape) % 3 == 0 &&\n (cards[0].shade + cards[1].shade + cards[2].shade) % 3 == 0\nend", "def is_a_set?(cards)\n result = [false, 0]\n (0..(NB_CARAC-1)).inject(true) do |result[0], carac|\n nb_uniq = cards.map{|card|CARDS[card][carac]}.uniq.size\n result[1] += (nb_uniq == NB_ETAT ? 1 : 0)\n result[0] &&= nb_uniq == 1 || nb_uniq == NB_ETAT\n end\n result\n end", "def superset?(set)\n return (~@val & set.to_i) == 0 if set.is_a?(IntegerSet)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if size < set.size\n set.all? { |o| include?(o) }\n end", "def verb_present? set\n (set & VERBS).count >= 1\n end", "def ==(set)\n equal?(set) and return true\n\n set.is_a?(Set) && size == set.size or return false\n\n hash = @hash.dup\n set.all? { |o| hash.include?(o) }\n end", "def legal?\n [rows, columns, boxes].all? do |group|\n group.all? { |_, n| n.uniq == n }\n end\n end", "def exists?(*keys); end", "def is_valid_set?(id)\n\t\t\treturn true if id =~ /working/i and @working_set\n\t\t\treturn true if @sets.include?(id)\n\t\t\tfalse\n\t\tend", "def member_of_group?(*names)\n @group_names && @group_names.intersect?(names.to_set) \n end", "def hasArg?(arg); argSet.member?(arg) end", "def dictionary_words? set\n (set & DICTIONARY) == set\n end", "def hint(workingSet)\n setFound = false\n for i in workingSet\n for j in workingSet\n for k in workingSet\n if(!(i == k || j == k || i == k))\n setFound = VerifySet?(i,j,k)\n if(setFound)\n return i\n break\n end\n end\n end\n end\n end\n if(setFound == false)\n return nil\n end\nend", "def valid_sudoku(table)\n # seen_set = Set.new()\n # for i in \nend", "def sets\n end", "def hint?(cards12)\n arr12 = (0..(cards12.length()-1)).to_a\n allSets = Array.new\n allSets = arr12.combination(3).to_a\n\n i = 0\n isSet = false\n while i < allSets.length()\n checkHint = Test.new\n comb = Array.new\n comb = allSets[i]\n crd1 = comb[0]\n crd2 = comb[1]\n crd3 = comb[2]\n isSet = checkHint.check_input(crd1, crd2, crd3, cards12)\n break if isSet\n\n i += 1\n end\n if(isSet)\n puts \"#{crd1} #{crd2} #{crd3}\"\n else\n puts \"No Set Found\"\n end\n isSet\n end", "def test_find_words_multiple\n words = ['apple','candy','bat']\n dict = Set['apple','bat','candy','cat']\n assert_equal Set[\"apple\",\"candy\"], @grapher.find_words(words, dict)\n end", "def matching_sets(path, type); end", "def code_in_valuesets(valuesets, input_code, bundle_id)\n # if valueset is a \"direct reference code\" check to see if input_code matches ones of the \"valuesets\"\n return true if valuesets.include? input_code\n\n !ValueSet.where('concepts.code' => input_code, bundle_id:).in(oid: valuesets).empty?\n end", "def include_any?(arr, arr2)\n #good for large sets w/ few matches\n # Set.new(self).intersection(arr).empty?\n arr2.any? {|e| arr.include?(e) }\n end", "def noun_articles_correct? set\n ((set & NOUNS).count >= 1) || ((set & ARTICLES).count >= 2)\n end", "def all_there?(recipe, on_hand)\n recipe.keys.each do |ingredient|\n return false if !(on_hand.keys.include? ingredient)\n end\n\n true\nend", "def validate_measure_ids_set_ids_usage(doc_bundle_neutral_ids, doc_measure_ids, data = {})\n # for each of the setIds that are in the bundle, check that they are for the correct measure id\n entries_start_position = @doc.xpath(first_entry)\n previous = ''\n index = 1\n doc_bundle_neutral_ids.each do |hqmf_set_id|\n # selects the measure id that is in the same entry as the set id\n # iterates through multiple instances of the same setId\n index = if previous == hqmf_set_id\n index + 1\n else\n 1\n end\n measure_id_entry = doc_measure_ids[(@doc.xpath(location_of_set_id(hqmf_set_id, index)) - entries_start_position)]\n previous = hqmf_set_id\n # queries database to see if there is a measure with the combindation of setId and measureId\n if CQM::Measure.where(hqmf_id: measure_id_entry, hqmf_set_id: hqmf_set_id).empty?\n @errors << build_error(\"Invalid HQMF Set ID Found: #{hqmf_set_id} for HQMF ID: #{measure_id_entry}\", '/', data[:file_name])\n end\n end\n end", "def disjoint_test\n\t\treturnValue = true\n\t\t@production_rules.each_key do |non_term|\n\t\t\tpredict_sets = predict_sets(non_term)\n\t\t\tpredict_sets.each_index do |index|\n\t\t\t\tfor sercond_index in (index+1)..(predict_sets.length-1)\n\t\t\t\t\tif(predict_sets[index] & predict_sets[sercond_index] != [])\n\t\t\t\t\t\t#predict sets overlap, return false\n\t\t\t\t\t\tprint \"Predict sets of #{non_term} overlap. Rule #{index} and #{sercond_index}\\n\"\n\t\t\t\t\t\treturnValue = false\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn returnValue\n\tend", "def isSet? card_arr\n return false if card_arr.size != 3\n color_arr = [card_arr[0][0], card_arr[1][0], card_arr[2][0]]\n shape_arr = [card_arr[0][1], card_arr[1][1], card_arr[2][1]]\n num_arr = [card_arr[0][2], card_arr[1][2], card_arr[2][2]]\n shade_arr = [card_arr[0][3], card_arr[1][3], card_arr[2][3]]\n same_or_dif?(color_arr) && same_or_dif?(shape_arr) && same_or_dif?(num_arr) && same_or_dif?(shade_arr)\nend", "def valid_section_ids?(section_ids, require_all: false)\n given_set = section_ids.to_set\n return false if given_set.size != section_ids.size\n\n valid_set = @survey.sections.pluck(:id).to_set\n require_all ? given_set == valid_set : given_set.subset?(valid_set)\n end", "def subset_of?( other_collection )\n all? {|e| other_collection.include? e }\n end", "def combine_lists set\n # get all possible sets of the given values\n combinations = set.flatten.combination(set.size)\n # reject any that contain more than one value from a given list\n combinations.reject do |combination|\n min_size = combination.size - 1\n set.any? do |list|\n (combination - list).size < min_size\n end\n end\n end", "def found_multiple?\n @flags.size > 1\n end", "def validates_includes(set, atts, opts={})\n validatable_attributes(atts, opts){|a,v,m| (m || \"is not in range or set: #{set.inspect}\") unless set.include?(v)}\n end", "def superset?(other_set)\n requires_set(other_set, __method__)\n other_set.subset?(self)\n end", "def include?(other)\n set_indexes.sort & other.set_indexes.sort == other.set_indexes.sort\n end", "def verb_correct? set\n (set & VERBS).count >= 1\n end", "def three_set?\n collected_dice = @dice_cup.group_by { |i| i }\n\n collected_dice.each_value do |v|\n if v.length >= 3\n return true\n end\n end\n\n false # No sets of three... :-(\n end", "def claim? (set)\n return IsASet.is_set set\n end", "def includes_all? *args\n args.all? { |arg| include? arg }\n end", "def check_required_options(option_set_name, options = {})\n required_options = REQUIRED_OPTIONS[option_set_name]\n missing = []\n required_options.each{|option| missing << option if options[option].nil?}\n \n unless missing.empty?\n raise MissingInformationError.new(\"Missing #{missing.collect{|m| \":#{m}\"}.join(', ')}\")\n end\n end", "def intersection(set1, set2)\r\n\t# set1 and set2 are arrays\r\n\t# return the intersection\r\nend", "def apply_set_membership(sets)\n\t\t#We delete previous set memberships and move to new set\n old_sets = set_membership.dup\n old_sets.each { |s| self.remove_relationship(:is_member_of, s) unless HULL_QUEUES.has_key?(s) }\n sets.delete_if { |s| s == \"\"}.each { |s| self.add_relationship :is_member_of, s }\n\tend", "def test_find_words_none_exist\n words =['apple', 'candy']\n dict = Set['zebra','ultra']\n assert_equal Set[], @grapher.find_words(words, dict)\n end", "def matching_sets(path, collection)\n @matched_set_cache ||= {}\n @matched_set_cache[path] ||= {}\n @matched_set_cache[path][collection] ||= valid_sets.select do |set|\n !set.key?(\"scope\") || applies?(set[\"scope\"], path, collection)\n end\n end", "def apply_harvesting_set_membership(sets)\n\t\t#We delete previous set memberships and move to new set\n old_sets = harvesting_set_membership.dup\n old_sets.each { |s| self.remove_relationship(:is_member_of_collection, s) }\n sets.delete_if { |s| s == \"\"}.each { |s| self.add_relationship :is_member_of_collection, s }\n\tend", "def apply_harvesting_set_membership(sets)\n\t\t#We delete previous set memberships and move to new set\n old_sets = harvesting_set_membership.dup\n old_sets.each { |s| self.remove_relationship(:is_member_of_collection, s) }\n sets.delete_if { |s| s == \"\"}.each { |s| self.add_relationship :is_member_of_collection, s }\n\tend", "def valid_table(table_array)\n\n valid_set = Array[]\n for card1 in 0...table_array.length\n for card2 in 0...table_array.length\n if(card1 == card2) #skip if same card\n next\n end\n\n for card3 in 0...table_array.length\n\n if card2 == card3 or card1 == card3 #skip if same card\n next\n end\n\n if is_a_set?([table_array[card1], table_array[card2], table_array[card3]])\n #found valid set\n valid_set[0] = card1\n valid_set[1] = card2\n valid_set[2] = card3\n break\n end\n\n end\n end\n end\n\n return valid_set\nend", "def which_elements_missing? desired_elements\n database_elements = as_set\n desired_elements = Set.new(desired_elements)\n not_in_database = desired_elements - database_elements\n return not_in_database\n end", "def multiple?(type)\n (type.is_a?(Array) || type.is_a?(Set)) && type.size > 1\n end", "def valid_team_and_game_id\n all_teams = Team.all.to_a.map{|u| u.id}\n all_games = Game.all.to_a.map{|u| u.id}\n return all_teams.include?(self.team_id) && all_games.include?(self.game_id)\n end", "def for_all?\n return (self.owner_id == 0 and self.get_groups_a.empty? and self.get_teams_a.empty?)\n end", "def match_maker(criteria, *sets)\n #go through each of the sets, in bulk of two\n score = []\n i = 0\n\n while i < sets.length do\n score << false if criteria == true and !!sets[i] == !!sets[i+1]\n score << true if criteria == false and !!sets[i] == !!sets[i+1]\n score << true if criteria == true and !!sets[i] != !!sets[i+1]\n score << false if criteria == false and !!sets[i]!= !!sets[i+1]\n i += 2\n end\n return score\nend", "def set_intersect(*keys)\n timeout_retry(3, 3){\n write \"SINTER #{keys.join(' ')}\\r\\n\"\n Set.new(multi_bulk_reply)\n }\n end", "def duplicates?(collection); end", "def option_combinations_valid?\n # TO DO - implement your real logic here\n true \n end", "def box_set_results_for(set_of_boxes)\n set_of_boxes.map { |box| is_there_a_check_on(box) }\nend", "def win_condition(cell_1, cell_2, cell_3)\n cell_1.present? && cell_2.present? && cell_3.present? && [cell_1, cell_2, cell_3].uniq.count == 1\n end" ]
[ "0.73127574", "0.7289846", "0.7189075", "0.67668605", "0.6730256", "0.6626348", "0.6622657", "0.66053146", "0.65969527", "0.6590218", "0.6542034", "0.6528631", "0.6517962", "0.6508343", "0.64745414", "0.64614207", "0.6406024", "0.63998914", "0.63539857", "0.634089", "0.63351476", "0.63203543", "0.63203543", "0.62835336", "0.6262886", "0.62620836", "0.6244912", "0.62331915", "0.6217627", "0.6208228", "0.62023467", "0.61711526", "0.6158491", "0.61468524", "0.6146678", "0.6145526", "0.6137439", "0.61346054", "0.6132612", "0.61148083", "0.6070137", "0.60502523", "0.60402113", "0.60377824", "0.6030017", "0.60287994", "0.6010382", "0.59805465", "0.59729344", "0.5934311", "0.59206903", "0.5917937", "0.59145874", "0.59074533", "0.58872426", "0.58700985", "0.5869383", "0.58614135", "0.5839827", "0.5816485", "0.58134", "0.580692", "0.57990503", "0.5795076", "0.57930124", "0.5789778", "0.5775104", "0.57709455", "0.5770209", "0.5766438", "0.5764087", "0.5756771", "0.5748346", "0.5742284", "0.5741401", "0.573983", "0.5728217", "0.572725", "0.57212186", "0.5709089", "0.5702842", "0.5702034", "0.56721497", "0.566555", "0.56654865", "0.564207", "0.56308615", "0.563", "0.563", "0.5625698", "0.5621897", "0.5618886", "0.5614072", "0.5611291", "0.5607625", "0.5604808", "0.55955327", "0.5583539", "0.557234", "0.55664915" ]
0.61320597
39
Returns cardinalities of multiple sets
def multi_zsize(keys) keys = Array(keys) unless keys.is_a?(Array) mon_synchronize do perform ["multi_zsize", *keys], :multi => true, :proc => T_VINT end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_a_set?(cards)\n result = [false, 0]\n (0..(NB_CARAC-1)).inject(true) do |result[0], carac|\n nb_uniq = cards.map{|card|CARDS[card][carac]}.uniq.size\n result[1] += (nb_uniq == NB_ETAT ? 1 : 0)\n result[0] &&= nb_uniq == 1 || nb_uniq == NB_ETAT\n end\n result\n end", "def is_a_set?(cards)\n # The sum when adding one number 3 times or adding 3 consecutive numbers is divisible by 3.\n # This represents having all the same attribute or all different attributes.\n # Adding any other 3 number combo of 1,2,3 will result in a value not divisible by 3, failing to be a set.\n isSet = (cards[0].number + cards[1].number + cards[2].number) % 3 == 0 &&\n (cards[0].color + cards[1].color + cards[2].color) % 3 == 0 &&\n (cards[0].shape + cards[1].shape + cards[2].shape) % 3 == 0 &&\n (cards[0].shade + cards[1].shade + cards[2].shade) % 3 == 0\nend", "def find_categories\n categories = @deck.cards.group_by do |card|\n card.category\n end\n categories.keys\n end", "def suit_count(cards)\n\t\t[\"C\",\"D\",\"H\",\"S\"].collect{|ch| cards.count{|card| card.suite == ch}}\n\tend", "def does_set_exist!\n\t\ttrue_set = []\n\t\twhile true_set.length == 0 do\n\t\t\tpossibleCombination = @board.combination(3).to_a\n\t\t\tpossibleCombination.each do |setOf3| \n\t\t\t\tif Board.actual_set?(setOf3)\n\t\t\t\t\ttrue_set = setOf3\n\t\t\t\t\tbreak\n\t\t\t\tend \n\t\t\tend\n\t\t\tif true_set.length == 0\n\t\t\t\tadd_cards\n\t\t\tend\n\t\tend\n\t\treturn true_set\n\tend", "def ensure_set_has_card_numbers!\n cards = @set_data[\"cards\"]\n numbers = cards.map{|c| c[\"number\"]}\n\n use_mci_numbers! if numbers.compact.empty?\n\n case set_code\n when \"van\"\n set_data[\"cards\"].sort_by{|c| c[\"multiverseid\"]}.each_with_index{|c,i| c[\"number\"] = \"#{i+1}\"}\n when \"pch\", \"arc\", \"pc2\", \"pca\", \"e01\"\n set_data[\"cards\"].each do |card|\n unless (card[\"types\"] & [\"Plane\", \"Phenomenon\", \"Scheme\"]).empty?\n card[\"number\"] = (1000 + card[\"number\"].to_i).to_s\n end\n end\n when \"bfz\", \"ogw\"\n # No idea if this is correct\n basic_land_cards = set_data[\"cards\"].select{|c| (c[\"supertypes\"]||[]) .include?(\"Basic\") }\n basic_land_cards = basic_land_cards.sort_by{|c| [c[\"number\"], c[\"multiverseid\"]]}\n basic_land_cards.each_slice(2) do |a,b|\n raise unless a[\"number\"] == b[\"number\"]\n b[\"number\"] += \"A\"\n end\n when \"rqs\", \"me4\"\n # Just brute force, investigate later wtf?\n set_data[\"cards\"].sort_by{|c| c[\"multiverseid\"]}.each_with_index{|c,i| c[\"number\"] = \"#{i+1}\"}\n when \"st2k\"\n # Just brute force, investigate later wtf?\n set_data[\"cards\"].each_with_index{|c,i| c[\"number\"] = \"#{i+1}\"}\n end\n\n numbers = cards.map{|c| c[\"number\"]}\n if numbers.compact.size == 0\n warn \"Set #{set_code} #{set_data[\"name\"]} has NO numbers\"\n elsif numbers.compact.size != numbers.size\n warn \"Set #{set_code} #{set_data[\"name\"]} has cards without numbers\"\n end\n if numbers.compact.size != numbers.compact.uniq.size\n # This breaks the frontend, so it needs to be hard exception\n duplicates = numbers.compact.group_by(&:itself).transform_values(&:count).select{|k,v| v > 1}\n raise \"Set #{set_code} #{set_data[\"name\"]} has DUPLICATE numbers: #{duplicates.inspect}\"\n end\n end", "def suits\n cards.map(&:suit)\n end", "def valid_table(table_array)\n\n valid_set = Array[]\n for card1 in 0...table_array.length\n for card2 in 0...table_array.length\n if(card1 == card2) #skip if same card\n next\n end\n\n for card3 in 0...table_array.length\n\n if card2 == card3 or card1 == card3 #skip if same card\n next\n end\n\n if is_a_set?([table_array[card1], table_array[card2], table_array[card3]])\n #found valid set\n valid_set[0] = card1\n valid_set[1] = card2\n valid_set[2] = card3\n break\n end\n\n end\n end\n end\n\n return valid_set\nend", "def get_sets\n result = []\n (0..(TAILLE_TAPIS + TAILLE_EXT*self.etendu - 3)).each do |a|\n ((a + 1)..(TAILLE_TAPIS + TAILLE_EXT*self.etendu - 2)).each do |b|\n ((b + 1)..(TAILLE_TAPIS + TAILLE_EXT*self.etendu - 1)).each do |c|\n if (is_a_set?([self.talon[self.tapis[a]], self.talon[self.tapis[b]], self.talon[self.tapis[c]]]))[0]\n result << [a, b, c]\n end\n end\n end\n end\n result\n end", "def calculate_irreducibles\n @irreducibles = make_default_set(@lattice.index_lex)\n for x in @lattice do\n if @lattice.upper_covers[x].count() == 1 then\n @irreducibles.add(x)\n end\n end\n end", "def combos(cards)\n cards.to_a.combination(3).to_a\n end", "def verify_set?(set)\n is_set = false # keep track of valid set\n\n # get arrays of the cards' attributes\n colors = [set[0].color, set[1].color, set[2].color]\n numbers = [set[0].number, set[1].number, set[2].number]\n shapes = [set[0].shape, set[1].shape, set[2].shape]\n textures = [set[0].texture, set[1].texture, set[2].texture]\n\n # or any attribute, if the attribute is the same or different\n # across the cards then the cards are a set.\n # this checks that no attribute is the same for two cards\n # and different for another, because that is the only case\n # where the cards are not a set.\n if colors.uniq.length != 2 && numbers.uniq.length != 2 && shapes.uniq.length != 2 && textures.uniq.length != 2\n is_set = true\n end\n\n # make sure no cards are duplicates\n if set.uniq.length != 3\n is_set = false\n end\n\n is_set # return value\nend", "def getASAry(set)\n ary = Array.new\n set.each{|k,v|\n if v then ary.push(k.to_i) end\n }\n ary.sort!\nend", "def category_sets(category)\n category.curriculum_category_sets.map do |category_set|\n complete[category][category_set] = category_set.courses & taken_courses\n\n get_incomplete_from_set(category, category_set)\n end\n end", "def possibleHandValues\n \thand_values = Set.new [0] # start with value 0\n \t@cards.each do |card| # for each card in the hand\n \t card_values = card.getValue\n \t new_hand_values = Set.new # add its value to all the possible\n \t hand_values.each do |total| # values for each of the previous\n \t \tcard_values.each do |card_value| # cards\n new_hand_values << total+card_value\n end\n end\n # Swap variable names. This makes the loop simpler\n new_hand_values, hand_values = hand_values, new_hand_values\n new_hand_values.clear\n end\n # Get the values that are below 21\n hand_values.delete_if do |value|\n if value > BLACKJACK\n true\n end\n end\n hand_values # Return set of possible values\n end", "def pandigitals(set)\n array = []\n\n set.permutation.each do |permutation|\n if permutation.first != '0'\n array << permutation.join('')\n end\n end\n\n array\nend", "def categories\n categories = []\n @deck.cards.map do |turn|\n categories << turn.category\n end\n categories.uniq!\n end", "def VerifySet? (card1,card2,card3)\n isAset = true\n\n #if a non-existing card is sent to VerifySet? then return false\n if(card1 == nil || card2 == nil || card3 == nil)\n return false\n end\n \n #Checks to see if all card numbers are the same\n if(!(card1.number == card2.number && card1.number == card3.number && card2.number == card3.number)) \n #If card numbers are the same between any two cards the cards are not a set \n if (card1.number == card2.number || card2.number == card3.number || card1.number == card3.number)\n isAset = false \n end \n end \n\n #Checks to see if all card colors are the same\n if(!(card1.color == card2.color && card1.color == card3.color && card2.color == card3.color)) \n #If card colors are the same between any two cards the cards are not a set \n if (card1.color == card2.color || card2.color == card3.color || card1.color == card3.color)\n isAset = false\n end \n end \n\n #Checks to see if all card shading are the same\n if(!(card1.shading == card2.shading && card1.shading == card3.shading && card2.shading == card3.shading))\n #If card shading are the same between any two cards the cards are not a set \n if (card1.shading == card2.shading || card2.shading == card3.shading || card1.shading == card3.shading)\n isAset = false\n end \n end \n\n #Checks to see if all card shape are the same\n if(!(card1.shape == card2.shape && card1.shape == card3.shape && card2.shape == card3.shape))\n #If card shape are the same between any two cards the cards are not a set \n if (card1.shape == card2.shape || card2.shape == card3.shape|| card1.shape == card3.shape)\n isAset = false\n end \n end \n \n return isAset\nend", "def matched_suits\n per_suit = {}\n # Count how many there are of each suit \n aid = @cards.each do |card| \n # Wildcards belong to all suits \n if card.wild?\n for suit in Suit::SUITS\n per_suit[suit] ||= 0\n per_suit[suit] += 1\n end\n else\n per_suit[card.suit] ||= 0\n per_suit[card.suit] += 1\n end\n end\n return per_suit\n end", "def hint?(cards12)\n arr12 = (0..(cards12.length()-1)).to_a\n allSets = Array.new\n allSets = arr12.combination(3).to_a\n\n i = 0\n isSet = false\n while i < allSets.length()\n checkHint = Test.new\n comb = Array.new\n comb = allSets[i]\n crd1 = comb[0]\n crd2 = comb[1]\n crd3 = comb[2]\n isSet = checkHint.check_input(crd1, crd2, crd3, cards12)\n break if isSet\n\n i += 1\n end\n if(isSet)\n puts \"#{crd1} #{crd2} #{crd3}\"\n else\n puts \"No Set Found\"\n end\n isSet\n end", "def competitive_teams\n res = 0\n @teams.each { |team| res += 1 unless TeamLevel.is_primary?(team.team_level) }\n res\n end", "def cardinal; end", "def collect_three_set(*value)\n\n new_set = @dice_cup.group_by { |i| i }\n\n if value.length.zero?\n new_set.each do |k, v|\n if v.length >= 3\n remove_three_and_score(k, v)\n end\n end\n\n elsif value.length == 1\n new_set.each do |k, v|\n if v.length >= 3 && k == value.first\n remove_three_and_score(k, v)\n end\n end\n end\n\n # Set everything back in order\n @dice_cup.clear\n new_set.each_value{ |v| @dice_cup << v } # Shovel them in!!!\n @dice_cup.flatten!\n end", "def match_maker(criteria, *sets)\n #go through each of the sets, in bulk of two\n score = []\n i = 0\n\n while i < sets.length do\n score << false if criteria == true and !!sets[i] == !!sets[i+1]\n score << true if criteria == false and !!sets[i] == !!sets[i+1]\n score << true if criteria == true and !!sets[i] != !!sets[i+1]\n score << false if criteria == false and !!sets[i]!= !!sets[i+1]\n i += 2\n end\n return score\nend", "def is_set?\n result = true\n result = false unless correct_combination?@card1.color,@card2.color,@card3.color\n result = false unless correct_combination?@card1.number,@card2.number,@card3.number\n result = false unless correct_combination?@card1.symbol,@card2.symbol,@card3.symbol\n result = false unless correct_combination?@card1.shading,@card2.shading,@card3.shading\n @good_set = result\n result\n end", "def possible_scores(cards)\n scores = [0]\n\n cards.each do |card|\n if card.face != 'Ace'\n scores.map! {|score| score + card.value} \n else\n new_scores = Array.new\n scores.each do |score|\n new_scores << score + 1\n new_scores << score + 11\n end\n scores = new_scores\n end\n end\n\n return scores.uniq.select {|score| score < 22}\nend", "def sets\n end", "def points_possible_on_set(set,args)\n c = {}\n [true,false].each { |online|\n [true,false].each { |extra_credit|\n c[[online,extra_credit]] = 0\n set.each { |stream_group|\n stream_group.each { |flag_group|\n flags,probs = flag_group\n is_online = (flags.has_key?(\"o\"))\n is_extra_credit = (flags.has_key?(\"*\")) || flags_contain_letter_in_string(flags,args['ec_if'])\n excluded = flags_contain_letter_in_string(flags,args['exclude_if'])\n if is_online==online && is_extra_credit==extra_credit && !excluded then\n probs.each { |g| # g is individualization group\n c[[online,extra_credit]] += 1 unless $has_solution[[g[0][0],g[0][1]]]\n }\n end\n }\n } # end loop over stream groups\n }\n }\n return c\nend", "def reduce(set)\n set.map { |n| Scale::Degree.reduce(n) }\n end", "def total_set\n self.inject(0) { |a, bucket| a += bucket.zero? ? 0 : 1; a }\n end", "def fivesSet(s)\n return (s.find_all {|i| i%5 == 0}).to_set\nend", "def find_poker_subsets\n # calls other poker subset methods\n update_hand_hash\n return 8 if find_straight_flush\n return 7 if find_quad\n return 6 if find_full_house\n return 5 if find_flush\n return 4 if find_straight\n return 3 if find_triple\n return 2 if find_two_pair\n return 1 if find_pair\n return 0 if find_high_card(@cards)\n end", "def answer(input_nums)\n [2,3].each do |set_size|\n all_combinations = input_nums.combination(set_size)\n\n target_set = all_combinations.to_a.find do |x|\n x.sum == 2020\n end\n\n puts \"Answer for set size #{set_size} is #{target_set.reduce(:*)}\"\n end\nend", "def possible_codes\n\t (0..5).each do |first|\n\t\t(0..5).each do |second|\n\t\t (0..5).each do |third|\n\t\t\t(0..5).each do |fourth|\n\t\t\t @set_of_codes << [COLORS[first],COLORS[second],COLORS[third],COLORS[fourth]]\n\t\t\tend\n\t\t end\n\t\tend\n\t end\n\tend", "def any_three?\n results=[]\n [@hand1Values, @hand2Values].each do |handV|\n freqHash = Hash.new(0) \n handV.each { |h| freqHash [h] += 1}\n results << freqHash.values.any? { |freq| freq >= 3}\n end\n\n results\n end", "def mutual_factors(*nums)\n all_factors = Hash.new\n nums.each { |num| all_factors[num] = find_factors(num) }\n all_factors.values[0].intersection(*all_factors.values[1..-1])\nend", "def cardinal_dirs\n cardinals = [[0, 1], [0, -1], [1, 0], [-1, 0]]\n end", "def scoring_of_set(ordinal)\n case scoring.to_sym\n when :two_six_game_ten_point\n ordinal == 3 ? :ten_point : :six_game\n when :one_eight_game\n :eight_game\n else # :three_six_game\n :six_game\n end\n end", "def number_correct_by_category(card_category)\n correct_guesses = []\n correct_by_category = []\n @turns.each do |card|\n if card.correct?\n correct_guesses << card\n end\n end\n correct_guesses.each do |card|\n if card.card.category == card_category\n correct_by_category << card\n end\n end\n correct_by_category.count\n end", "def matter_status_count\n undisputed=self.matter_facts.collect{|mf| mf.status_id if mf.status_id == CompanyLookup.find_by_lvalue_and_company_id('Undisputed', mf.company_id).id}.compact.size\n disputed=self.matter_facts.collect{|mf| mf.status_id if mf.status_id == CompanyLookup.find_by_lvalue_and_company_id('Disputed By Opposition', mf.company_id).id}.compact.size\n\n [undisputed,disputed]\n end", "def coauthors\n works.collect(&:pseuds).flatten.uniq - pseuds\n end", "def mutual_factors(*nums)\n # common_h = Hash.new(0)\n # nums.sort!\n\n # factors(nums[0]).each do |factor|\n # nums.each { |num| common_h[factor] += 1 if num % factor == 0 }\n # end\n\n # common_f = []\n # common_h.each {|k,v| common_f << k if v == nums.length}\n # common_f\n nums.sort!\n facts = factors(nums.first)\n facts.select {|f| nums.all? {|num| num % f == 0} }\nend", "def budget_cards(budget)\n budget.cards.uniq\n end", "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", "def decisions_by_cd\n cds=@sr.cd_id_by_stage(@stage)\n\n decisions=Decision.where(:systematic_review_id=>@sr.id, :canonical_document_id=>cds, :user_id=>@sr.group_users.map {|u| u[:id]}, :stage=>@stage.to_s).group_and_count(:canonical_document_id, :decision).all\n n_jueces_por_cd=AllocationCd.where(:systematic_review_id=>@sr.id, :canonical_document_id=>cds, :stage=>@stage.to_s).group_and_count(:canonical_document_id).as_hash(:canonical_document_id)\n\n\n# n_jueces=@sr.group_users.count\n cds.inject({}) {|ac,v|\n ac[v]=empty_decisions_hash\n ac[v]=ac[v].merge decisions.find_all {|dec| dec[:canonical_document_id]==v }\n .inject({}) {|ac1,v1| ac1[v1[:decision]]=v1[:count]; ac1 }\n suma=ac[v].inject(0) {|ac1,v1| ac1+v1[1]}\n n_jueces=n_jueces_por_cd[v].nil? ? 0 : n_jueces_por_cd[v][:count]\n ac[v][Decision::NO_DECISION]=n_jueces-suma\n ac\n }\n end", "def generate_a_deck\n Card::SUITS.map do |suit|\n Card::RANKS.map do |rank|\n Card.new(suit: suit, rank: rank)\n end\n end.flatten\n end", "def cards_by_suit\n @cards_by_suit ||= @cards.group_by(&:suit)\n end", "def mutual_factors(*nums)\n m_factors = []\n counted = Hash.new(0)\n\n factors = nums.map { |num| factors(num)}\n factors.flatten.each { |ele| counted[ele] += 1}\n counted.each { |k,v| m_factors << k if v >= nums.length }\n\n m_factors\n \nend", "def survey_carnivores\n # really wanted to use Set here as: 1) it's an amazing class, and under-utlized,\n # and 2) it ignores duplicates automatically...\n # However, given the choice between Array and having to also keep track of\n # herbivores (or another potential db call to see if there are any), I choose Array\n @carnivores = Array.new\n\n self.dinosaurs.each do |dino_species|\n @carnivores.push(dino_species) if dino_species.species.is_carnivore\n end\n end", "def print_centralities\n values = @counters.all_counters\n .map(&:centrality)\n .map(&:to_i)\n .inject(Hash.new(0)) { |hash, value| hash[value] += 1 ; hash }\n\n values.each do |value|\n puts value.join(',')\n end\n end", "def naive(set)\n solutions = []\n indexes = (0..set.size-1).to_a\n\n Backtracker.generate do\n candidates { |a| indexes - a }\n solution? { |a| a.size == set.size }\n found_solution do |a| \n solution = a.map { |i| set[i] } \n solutions << solution unless solutions.include? solution\n end\n end\n\n return solutions\nend", "def valid_sets; end", "def _get_keywords_set_int_v_1_55()\n \n result = []\n \n genre_int = Genre.find(:all, :conditions => {:code => 'int'})[0]\n \n categories = Category.find(:all, :conditions => {:genre_id => genre_int.id})\n \n #debug\n if categories != nil\n \n write_log(\n @log_path,\n \"categories.size => #{categories.size}\", \n # __FILE__,\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n else\n write_log(\n @log_path,\n \"categories => nil\", \n # __FILE__,\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s) \n end\n \n if categories != nil and categories.size > 0\n \n kws1 = KeyWordSet.new\n kws1.category = 'China'\n kws1.keywords = '中国 日中'\n \n kws2 = KeyWordSet.new\n kws2.category = 'Europe'\n # kws2.keywords = '米国 アメリカ'\n kws2.keywords = '欧州 イギリス ドイツ フランス ロシア'\n \n result.push(kws1)\n result.push(kws2)\n \n else\n \n kws1 = KeyWordSet.new\n kws1.category = 'China'\n kws1.keywords = '中国 日中'\n \n kws2 = KeyWordSet.new\n kws2.category = 'US'\n # kws2.keywords = '米国 アメリカ'\n kws2.keywords = '米国 アメリカ オバマ 米選挙'\n \n result.push(kws1)\n result.push(kws2)\n \n end\n \n \n return result\n \n end", "def calculate_truth_table\r\n false_s = @char_set[0]\r\n truth_s = @char_set[1]\r\n @table_array.each do |x|\r\n trues = x.count(truth_s)\r\n trues == @size ? x.push(truth_s) : x.push(false_s)\r\n trues > 0 ? x.push(truth_s) : x.push(false_s)\r\n trues.odd? ? x.push(truth_s) : x.push(false_s) \r\n end\r\n end", "def tag_set_count(collection)\n if collection && collection.challenge_type.present?\n if collection.challenge_type == \"GiftExchange\" && !collection.challenge.offer_restriction.owned_tag_sets.empty?\n collection.challenge.offer_restriction.owned_tag_sets.count\n elsif collection.challenge_type == \"PromptMeme\" && !collection.challenge.request_restriction.owned_tag_sets.empty?\n collection.challenge.request_restriction.owned_tag_sets.count\n end\n end\n end", "def cards\n questions.count + answers.count\n end", "def valid_combinations\n\t\treturn @@valid_combinations\n\tend", "def find_factor_sets(collection,tolerance)\n smallest_number = collection.sort.first\n collection.collect { |n| find_all_factors(n,smallest_number,tolerance) }\n end", "def three_set?\n collected_dice = @dice_cup.group_by { |i| i }\n\n collected_dice.each_value do |v|\n if v.length >= 3\n return true\n end\n end\n\n false # No sets of three... :-(\n end", "def mutual_factors(*nums)\n output = []\n nums.each do |num|\n output << find_factors(num)\n end\n output.reduce(:&)\nend", "def skittle_combos(skittles)\n skittles.combination(2).map(&:sort).uniq\nend", "def codes_in_code_set(code_set)\n matching = {}\n codes.keys.each do |code_system|\n matching_codes = []\n matching[code_system] = matching_codes\n all_codes_in_system = code_set.find_all {|set| set['set'] == code_system}\n all_codes_in_system.each do |codes_in_system|\n matching_codes.concat codes_in_system['values'] & codes[code_system]\n end\n end\n matching\n end", "def initialize(cards)\n raise \"Invalid hand size - #{cards.length}\" unless cards.length == 5\n @cards = cards.map {|c| Card.new(c)}.sort\n @by_value = {}\n @by_suit = {}\n @cards.each do |c|\n @by_value[c.value] ||= []\n @by_suit[c.suit] ||= []\n @by_value[c.value] << c\n @by_suit[c.suit] << c\n end\n\n if @cards[4].value+1 == @cards[3].value &&\n @cards[3].value+1 == @cards[2].value &&\n @cards[2].value+1 == @cards[1].value &&\n @cards[1].value+1 == @cards[0].value\n end\n # Is it a straight\n @straight = true\n @cards.reduce do |p,c|\n if p.value != c.value + 1\n @straight = false\n break\n end\n c\n end\n value = [0]\n if @straight # Is it a straight\n value = [500, @cards.first.value]\n end\n # Is it a flush\n if @flush = @by_suit.find {|k,v| v.length == 5}\n if @straight\n value = [900, @cards.first.value]\n else\n value = [600, @cards.first.value]\n end\n end\n if value[0] < 700\n if (a = @by_value.find {|k,v| v.length == 3 }) &&\n (b = @by_value.find {|k,v| v.length == 2 })\n value = [700, a[0], b[0]]\n elsif a = @by_value.find {|k,v| v.length == 4 }\n value = [800, a[0]] # Is it 4 of a kind\n end\n end\n if value[0] < 500 && (a = @by_value.find {|k,v| v.length == 3 })\n value = [400, a[0]] # Is it 3 of a kind\n end\n if value[0] < 400 \n if (a = @by_value.select {|k,v| v.length == 2}).length > 0\n if a.length == 2\n hi,low = a[a.keys.max], a[a.keys.min]\n high = @cards - hi - low\n value = [300,hi.first.value, low.first.value, high.first.value]\n else\n pair = a[a.keys.first]\n high = (@cards - pair).first\n value = [200,pair.first.value, high.value]\n end\n else\n value = [100, @cards.first.value]\n end\n end\n @value = value\n end", "def get_power_set_1(set)\n\t(0..set.length).map {|i| set.combination(i).to_a}.flatten(1)\nend", "def total_set\n @field.each_byte.inject(0) { |a, byte| (a += 1; byte &= byte - 1) while byte > 0 ; a }\n end", "def sequential(set)\n set.enum_for(:each_with_index).map do |n, i|\n index = [i - 1, 0].max\n n - set[index]\n end\n end", "def armor_set\n armor_ids = armors.compact.map{|a| a.real_id}\n SETS::Armors.select{|k,v| (v - armor_ids).empty? }.map{ |a| a[0] }.max\n end", "def try_set(cards)\n try_time = Time.now\n if (is_a_set = is_a_set?(cards.map{|c|self.talon[self.tapis[c]]}))[0]\n if self.etendu == 0 and self.courante < NB_CARTE\n cards.each do |card|\n self.tapis[card] = self.courante\n self.courante += 1\n end\n else\n self.tapis -= cards.map{|card|self.tapis[card]}\n self.etendu -= 1\n end\n self.nb_set = self.nb_set.next\n self.time_last_set = try_time - (self.last_set || self.start)\n self.nb_last_point = is_a_set[1] + self.get_time_bonus(self.time_last_set)\n self.nb_point += self.nb_last_point\n self.last_set = try_time\n extend_if_needed\n true\n else\n self.nb_bad_set = self.nb_bad_set.next\n self.nb_point -= self.get_sets.size\n false\n end\n end", "def total_set\n @field.inject(0) { |a, byte| a += byte & 1 and byte >>= 1 until byte == 0; a }\n end", "def total_set\n @field.inject(0) { |a, byte| a += byte & 1 and byte >>= 1 until byte == 0; a }\n end", "def residue_count\n counted = []\n # N-terminal\n n_term = @seq[0].chr\n if PK[:nterm].key? n_term.to_sym\n counted << {\n :num => 1,\n :residue => n_term.to_sym,\n :pK => PK[:nterm][n_term.to_sym],\n :positive => positive?(n_term)\n }\n elsif PK[:normal].key? n_term.to_sym\n counted << {\n :num => 1,\n :residue => n_term.to_sym,\n :pK => PK[:normal][n_term.to_sym],\n :positive => positive?(n_term)\n }\n end\n # Internal\n tmp_internal = {}\n @seq[1,(@seq.length-2)].each_byte do |x|\n aa = x.chr.to_sym\n if PK[:internal].key? aa\n if tmp_internal.key? aa\n tmp_internal[aa][:num] += 1\n else\n tmp_internal[aa] = {\n :num => 1,\n :residue => aa,\n :pK => PK[:internal][aa],\n :positive => positive?(aa.to_s)\n }\n end\n end\n end\n tmp_internal.each do |aa, val|\n counted << val\n end\n # C-terminal\n c_term = @seq[-1].chr\n if PK[:cterm].key? c_term.to_sym\n counted << {\n :num => 1,\n :residue => c_term.to_sym,\n :pK => PK[:cterm][c_term.to_sym],\n :positive => positive?(c_term)\n }\n end\n counted\n end", "def bisac_categories_codes\n self.bisac_categories.map { |c| c.code }.uniq\n end", "def cases\n return @cases\n end", "def set_counts(set,count)\t\n\n\tnewcount = (set=='new')? count : \"0\"\n\trisingcount = (set=='rising')? count : \"0\"\n\thotcount = (set=='hot')? count : \"0\"\n\n\treturn newcount, risingcount, hotcount\n\nend", "def count_categories!\n counts = Hash.new 0\n modify = []\n @all_sorters.each do |sorter|\n counts[sorter.category] += 1\n if @all_sorters.count{|xx|xx.category == sorter.category} > 1\n modify.push [sorter, counts[sorter.category]]\n end\n end\n modify.each do |sorter, count|\n sorter.category += \" #{count.to_roman}\"\n end\n end", "def bisac_categories_codes\n self.bisac_categories.map{|c| c.code}.uniq\n end", "def repeats\n cards.group_by &:value\n end", "def combine_lists set\n # get all possible sets of the given values\n combinations = set.flatten.combination(set.size)\n # reject any that contain more than one value from a given list\n combinations.reject do |combination|\n min_size = combination.size - 1\n set.any? do |list|\n (combination - list).size < min_size\n end\n end\n end", "def club_sets\n super.uniq\n end", "def active_sen \n\tstates = Legislator.uniq.pluck(:state) #print out the state if pluck only will print out multiple same state like \"CA\"\n\t#ordering of state begin \n\tarray_of_count = []\n states.each do |state|\n array_of_count << [state, Legislator.where(state: state).count]\n states.each do |state|\n puts \"#{state}: #{ Legislator.where(title: \"Sen\", state: state).count}\"+ \" Sen\" + \" #{ Legislator.where(title: \"Rep\", state: state).count }\" + \" Rep\"\n end \n end\nend", "def assosi(minsupp = 2)\n # create 1-frequent-set\n c1 = Product.all.permutation(1).to_a\n l1 = c1.reject { |fi| trans_containing(fi) < minsupp}\n # find k-frequent-set, first elem is nil because k = 2\n l = [nil, l1]\n k = 2\n c = []\n while not(l[k-1].empty?)\n # find candidates\n b = l[k-1].flatten.to_set.to_a\n c = b.reduce([]) do |accu, extension|\n accu + l[k-1].reduce([]) do |accu2, canidate|\n if not(canidate.include?(extension)) then\n accu2 << (canidate + [extension])\n else\n accu2\n end\n end\n end\n # remove dubs\n c = c.collect {|e| e.to_set }.to_set.collect {|e| e.to_a }.to_a\n # select minsupps\n l[k] = c.reject { |canidate| trans_containing(canidate) < minsupp }\n k = k + 1\n end\n #first elem is nil; last elem is an empty list\n l.shift; l.pop\n low_fatten(l)\n end", "def three_of_a_kind?\n cards_by_rank.values.first.count >= 3\n end", "def total_set\n @field.inject(0) { |a, byte| a += byte & 1 and byte >>= 1 until byte == 0; a }\n end", "def total_set\n @field.inject(0) { |a, byte| a += byte & 1 and byte >>= 1 until byte == 0; a }\n end", "def mutual_factors(*nums)\n common_fact = []\n \n max_val = nums.max\n (1..max_val).each do |n|\n is_common = nums.all? { |el| el%n == 0 }\n if is_common\n common_fact << n\n end\n end\n\n return common_fact\nend", "def cuantos_pares\n @pares = []\n @pares = @valores.to_h.select{|k, v| (2..2).cover?(v)}\n @pares.size\n end", "def get_matrix_of_possibilities(problem_set)\n possibilities = []\n\n problem_set.item_prices.each do |price|\n possibilities << find_possible_quantities(price, problem_set.total)\n end\n\n possibilities = possibilities[0].product(*possibilities[1..-1])\n possibilities\n end", "def getAbundants(cap)\n #init array\n abs = []\n #for every number under cap\n for i in 1..cap-1\n #if number is abundant\n if isAbundant(i)\n #add number to abs array\n abs << i\n end\n end\n #return abs\n return abs\nend", "def calculate_totals(cards) \n card_values = cards.map{|card| card[1]}\n total_socre = 0\n card_values.each do |value|\n if value == \"Ace\"\n total_socre += 11\n elsif value.to_i == 0\n total_socre += 10\n else\n total_socre += value.to_i\n end\n end\n#correct for Aces\n card_values.select {|e| e == \"Ace\"}.count.times do\n total_socre -= 10 if total_socre > 21\n end\n total_socre\nend", "def have_new_cards\n cards = []\n suits = [\"♣\", \"♦\", \"♥\", \"♠\"]\n ranks = [\"A\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"J\",\"Q\",\"K\"]\n suits.each do |suit|\n ranks.each do |rank|\n cards << [suit, rank]\n end\n end\n return cards\nend", "def calculate_score(hand_of_cards)\n card_values = hand_of_cards.map{|card_value| card_value[1]}\n total = 0 \n card_values.each do |card_value| \n if card_value == \"ACE\"\n total+= 11\n elsif card_value.to_i == 0 #For suits ie Jester, Queen\n total+= 10\n else \n total+= card_value.to_i\n end\n end \n\n#adjust for Aces\n card_values.select{|card| card == \"ACE\"}.count.times do \n total-=10 if total > 21\n end \n total\nend", "def common_x\n ah, bh, ch = [a,b,c].map {|arr| arr.each_with_object(Hash.new(0)) {|e,h| h[e] += 1}}\n (a & b & c).inject(0) {|sum, e| sum += e * [ah[e], bh[e], ch[e]].min}\nend", "def calc_hand_total(cards)\r\n total = 0\r\n numbers_only_array = cards.map {|g| g[0]}\r\n numbers_only_array.each do |h|\r\n if h == 'ace'\r\n total += 11\r\n elsif h.to_i == 0\r\n total += 10\r\n else\r\n total += h.to_i\r\n end\r\n end\r\n\r\n numbers_only_array.select {|k| k == \"ace\"}.count.times do\r\n total -= 10 if total > 21 \r\n end\r\n\r\n total\r\nend", "def sets_won(team)\n match_sets.reduce(0) do |sum, set|\n winner = set.compute_team_winner\n sum + (winner && winner == team ? 1 : 0)\n end\n end", "def three\n str=Hash.new\n (0..12).each { |i|\n d=[14-i,14-i,14-i]\n @hash_7_card.each {|s,_r| str[s]=@hash_7_card[s]&d }\n z=Array.new #checking that the array we did is really our target\n str.each{|_s,r| z +=r}\n return str if z == d\n }\n nil\n end", "def calculate_total(cards) \n # [['Hearts', '2'], ['Spades', 'Jack'], ...]\n total = 0\n arr = cards.map { |e| e[1] }\n\n arr.each do |card|\n if card == \"Ace\"\n total += 11\n elsif card.to_i == 0 # Jack, Queen, King\n total += 10\n else\n total += card.to_i\n end\n end\n\n # correct for Aces\n arr.select { |e| e == \"Ace\" }.count.times do\n total -= 10 if total > 21\n end\n\n total\nend", "def better_solution_to_multiples\n set.to_a.combination(2) do |number, number1|\n remainder = TOTAL - number - number1\n\n if set.include?(remainder)\n puts remainder * number * number1\n break\n end\n end\n end", "def mutual_factors(*args)\n div_hash = Hash.new\n args.each do |num|\n div_hash[num] = divisors(num)\n end\n common_divisors(div_hash.values)\nend", "def favorite_suit\n suit_counts = Hash.new(0)\n cards.each { |card| suit_counts[card.suit] += 1 }\n favorite_suit, _ = suit_counts.max_by { |k, v| v }\n favorite_suit\n end", "def get_categories\n @cards.each do |card|\n if !@categories.include?(card.category)\n @categories << card.category\n end\n end\n @categories\n end", "def shares_common\n securities.uniq.map(&:shares_common).sum\n end" ]
[ "0.6833697", "0.6341728", "0.606059", "0.59700423", "0.596856", "0.5961811", "0.5934326", "0.5917268", "0.5900039", "0.58926016", "0.58369976", "0.5815769", "0.5791288", "0.5774253", "0.56962323", "0.56900287", "0.56872994", "0.568225", "0.5677321", "0.56345123", "0.5634043", "0.5621367", "0.5611328", "0.56009", "0.55616105", "0.55546665", "0.55490035", "0.5542128", "0.5532834", "0.552645", "0.54906565", "0.5471227", "0.54514015", "0.5443135", "0.5428634", "0.540228", "0.5396372", "0.5385969", "0.5359954", "0.53314966", "0.5319065", "0.53180647", "0.52990425", "0.52948827", "0.5292597", "0.52913976", "0.5289342", "0.52843946", "0.5275065", "0.52715826", "0.5266943", "0.5264781", "0.52602667", "0.5243024", "0.5231208", "0.5219656", "0.52171695", "0.5197583", "0.51972806", "0.5195624", "0.5186014", "0.5180931", "0.5179945", "0.5179052", "0.5178315", "0.5178088", "0.5174919", "0.51740223", "0.51730746", "0.51730746", "0.5171192", "0.5167034", "0.51662856", "0.51646304", "0.5162708", "0.51595336", "0.5146588", "0.5140498", "0.5136783", "0.51347685", "0.51263857", "0.5116792", "0.5116626", "0.5116626", "0.511132", "0.5111045", "0.510815", "0.5098042", "0.5097961", "0.50931734", "0.50923115", "0.5087885", "0.5085243", "0.50821584", "0.5080953", "0.5079229", "0.5076648", "0.5074158", "0.50725615", "0.507057", "0.5066398" ]
0.0
-1
Sets multiple members of `key`
def multi_zset(key, pairs) mon_synchronize do perform ["multi_zset", key, *pairs.to_a].flatten, :proc => T_INT end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_members(key)\n perform_read(:set_members, key)\n end", "def set_multiple(keys, values)\n @mutex.synchronize do\n raise \"Invalid size #{keys}=#{values}\" unless keys.size == values.size\n # pp keys,values\n keys.zip(values).each do |var, val|\n do_set(var,val) unless var.nil? or val.nil?\n end\n end\n end", "def set_members(key)\n timeout_retry(3, 3){\n write \"SMEMBERS #{key}\\r\\n\"\n Set.new(multi_bulk_reply)\n }\n end", "def hmset(key, *attrs); end", "def hmset(key, *attrs); end", "def setnx(key, value); end", "def setnx(key, value); end", "def hset(key, *attrs); end", "def set(key, value); end", "def set(key, value); end", "def me_mset( *args )\n #it must be multi since it keeps an order of commands\n multi{ args.each_slice(2) { |key, value| me_set( key, value ) } }\n end", "def set(key, value)\n end", "def set(key, value, **options); end", "def key=(key); end", "def []=(*key_list, value)\n store_with_init(Array(key_list).flatten, value)\n end", "def set(k,v)\n each do |e|\n e.set k,v\n end\n self\n end", "def set(key , value)\n index = key_index(key)\n if( index )\n self.keys.set(index , value)\n else\n self.keys.push(key)\n self.values.push(value)\n end\n value\n end", "def []=(key, data)\n\t\tset key, data\n\tend", "def set(key , value)\n index = key_index(key)\n if( index )\n @i_values.set(index , value)\n else\n @i_keys.push(key)\n @i_values.push(value)\n end\n value\n end", "def getset(key); end", "def hmset(key, *attrs)\n send_command([:hmset, key] + attrs)\n end", "def set(*args)\n assert_exists\n assert_writable\n\n @element.clear\n @element.send_keys(*args)\n end", "def write_key(*key); end", "def update_key(key, val)\n @ivar.each_with_index do |ele, i|\n if ele[0] == key\n @ivar[i][1] = val \n end\n end\n end", "def []= k,v\n\t set k,v\n\t end", "def []=(key, value); end", "def []=(key, value); end", "def []=(key, value); end", "def []=(key, value); end", "def []=(key, value); end", "def []=(key, value); end", "def []=(key, value); end", "def []=(key, value); end", "def []=(key, value); end", "def []=(key, value); end", "def []=(key, value); end", "def []=(key, value); end", "def []=(key, value); end", "def []=(key, value); end", "def []=(key, value); end", "def []=(key, value); end", "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @token_groups = args[:token_groups] if args.key?(:token_groups)\n end", "def lset(key, index, value); end", "def lset(key, index, value); end", "def []=(key, val); end", "def set key, data\n\t\t@data_base[ key ] = data\n\t\tupdate_database\n\tend", "def key_writer *keys\n keys.each do |method|\n key = method.to_s\n define_method \"#{method}=\" do |value|\n self[key] = value\n end\n end\n end", "def sadd(key, *members); end", "def set(instance)\n # TODO could we not cause a nasty bug by dropping nil value keys when the \n # user is using composite keys? Should we not rather raise an error if\n # the value is nil?\n key = instance.key\n \n raise ArgumentError.new(\"+key+ must be an Array, and can not be empty\") if key.empty? \n @cache[instance.class][key] = instance \n end", "def update!(**args)\n @key = args[:key] if args.key?(:key)\n end", "def update!(**args)\n @key = args[:key] if args.key?(:key)\n end", "def []=(key , value)\n set(key, value)\n end", "def setl(key, *value)\n namespaced_redis.rpush(key, value.map(&:to_json))\n end", "def field_set!(key, value)\n send \"_#{key}_set\", value\n end", "def set(*args)\n unless(args.size > 1)\n raise ArgumentError,\n 'Set requires at least one key and a value'\n end\n value = args.pop\n set_key = args.pop\n leaf = args.inject(self) do |memo, key|\n unless(memo[key].is_a?(Hash))\n memo[key] = Smash.new\n end\n memo[key]\n end\n leaf[set_key] = value\n value\n end", "def update!(**args)\n @keys = args[:keys] if args.key?(:keys)\n end", "def update!(**args)\n @keys = args[:keys] if args.key?(:keys)\n end", "def set(key, value)\n\t\t\t\t# TODO This could be a bit more efficient:\n\t\t\t\tself.delete(key)\n\t\t\t\tself.add(key, value)\n\t\t\tend", "def set k,v\n key = k.to_s.to_sym\n v = (v.is_a?(ASObj) ? v.finish : v) unless v == nil\n @_[key] = v unless v == nil\n @_.delete key if v == nil\n end", "def key_accessor *keys\n key_writer *keys\n key_reader *keys\n end", "def key=(value); end", "def set(key, val = nil)\n @statistics[:set] += 1\n with_branch_for(key) do |branch|\n branch.set key, val\n end\n end", "def updateKey; @key = getKey; self end", "def []=(key, value)\n field_set key, value\n end", "def []=(key,val) ; @data[key] = val ; end", "def update_key_list(keys)\n key_list = get_key_list\n type = keys.first.to_sym\n key_list[type] = key_list[type] || Set.new\n key_chain = keys[1..-1].join('.')\n unless key_list[type].include?(key_chain)\n key_list[type].add key_chain\n _write(Common::KEY, key_list)\n end\n end", "def []=(key,arg)\n @hash[key] = arg\n end", "def do_set current, keys, value\n if keys.blank?\n current[:value] = value\n return current\n end\n\n keys = [keys] unless keys.is_a? Array\n current_key = keys.shift.to_sym\n if current[current_key].blank?\n current[current_key] = {:value => {}}\n end\n \n if keys.size > 0\n current[current_key] = do_set(current[current_key], keys, value)\n else\n current[current_key][:value] = value \n end\n \n current\n end", "def mset(*args); end", "def lset(key, index, value)\n send_command([:lset, key, Integer(index), value])\n end", "def hsetnx(key, field, value); end", "def hsetnx(key, field, value); end", "def new_key(list, key, value)\n\tlist[key] = value\nend", "def liner_set(key, value)\n key = key.to_sym\n with_valid_attribute(key) do\n instance_variable_set \"@#{key}\", value\n end\n end", "def set(key, value, timestamp)\n \n end", "def set(full_key, node)\n key_part, rest = full_key.split('.', 2)\n child = key_to_node[key_part]\n if rest\n unless child\n child = Node.new(key: key_part)\n append! child\n end\n child.children ||= []\n child.children.set rest, node\n dirty!\n else\n remove! child if child\n append! node\n end\n node\n end", "def set( key, value )\n fail NotImplementedError\n end", "def set(values); end", "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @values = args[:values] if args.key?(:values)\n end", "def update!(**args)\n @keys = args[:keys] unless args[:keys].nil?\n end", "def set(key, value)\n arr_pos = to_hash(key)\n list = @array[array_pos]\n node = list.find_by_key(key)\n if node\n node.data = value\n else\n self.put(key, value)\n end\n end", "def set(key, value=self)\n if value.kind_of?(Proc)\n metadef(key, &value)\n metadef(\"#{key}?\") { !!__send__(key) }\n metadef(\"#{key}=\") { |val| set(key, Proc.new{val}) }\n @keys << key \n elsif value == self && key.is_a?(Hash)\n key.to_hash.each { |k,v| set(k, v) }\n elsif respond_to?(\"#{key}=\")\n __send__ \"#{key}=\", value\n @keys << key \n else\n set key, Proc.new{value}\n end\n self\n end", "def set( key, value )\n unless key.is_a?( Key )\n k = UniMap.str_to_key( key )\n unless k\n raise IndexError, \"No Key named #{key.inspect} in UniMap.KEY_SPACE\"\n end\n key = k\n end\n set_k( key, value )\n end", "def set(key, value)\n updated = false\n if self.map_var[0].empty?\n self.map_var[0] = [key, value]\n updated = true\n else \n self.map_var.each do |pair| \n if pair[0] == key \n pair[1] = value \n updated = true\n end\n end \n end\n self.map_var << [key, value] if !updated\n updated \n end", "def keys=(keys_array)\n\t\t\tif keys_array.is_a?(Array)\n\t\t\t\t@lookup = []\n\t\t\t\tdial!(*keys_array)\n\t\t\telse\n\t\t\t\traise ArgumentError, 'Key list must be set to an array.'\n\t\t\tend\n\t\tend", "def set_fields(fields)\n fields.each { |key, value| set_field key, value }\n end", "def hmset(key, *attrs)\n node_for(key).hmset(key, *attrs)\n end", "def set(key, value)\n change(:set, key, value)\n end", "def []=(key, value)\n return super if has_key?(key)\n alt = alternate_key(key)\n has_key?(alt) ? super(alt, value) : super\n end", "def update args\n args.each do |key, value|\n method = \"#{key}=\".to_sym \n if self.respond_to? method\n self.send(method, value)\n end\n end\n end", "def []=(key, value) self.send(\"#{key}=\", value) end", "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @list = args[:list] if args.key?(:list)\n @map = args[:map] if args.key?(:map)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end", "def put(key, value)\n \n end", "def set(key, value)\n raise NotImplementedError\n end" ]
[ "0.7329844", "0.70764166", "0.69601405", "0.6896036", "0.6896036", "0.6775178", "0.6775178", "0.67518073", "0.6709653", "0.6709653", "0.66646457", "0.65382075", "0.65197086", "0.65107787", "0.64333624", "0.6419482", "0.6345557", "0.63393056", "0.6297765", "0.6273586", "0.62178415", "0.6199087", "0.6186965", "0.6168815", "0.6147101", "0.6141071", "0.6141071", "0.6141071", "0.6141071", "0.6141071", "0.6141071", "0.6141071", "0.6141071", "0.6141071", "0.6141071", "0.6141071", "0.6141071", "0.6141071", "0.6141071", "0.6141071", "0.6141071", "0.6139794", "0.61395955", "0.61395955", "0.61247236", "0.6096547", "0.60769737", "0.60728604", "0.606415", "0.60462344", "0.60462344", "0.6043543", "0.6033995", "0.60317755", "0.59940606", "0.5969271", "0.5969271", "0.5951821", "0.593909", "0.593179", "0.590909", "0.59069407", "0.5901578", "0.5893952", "0.5874252", "0.58719057", "0.5869731", "0.58633673", "0.5863098", "0.5852887", "0.58479375", "0.58479375", "0.58414805", "0.5833767", "0.5826613", "0.581764", "0.5814991", "0.58125687", "0.58080125", "0.5807756", "0.580287", "0.57830447", "0.57828104", "0.5780521", "0.577688", "0.5759887", "0.5751164", "0.5746758", "0.57448685", "0.5728682", "0.57274777", "0.5721356", "0.572091", "0.5720561", "0.5720561", "0.5720561", "0.5720561", "0.5720561", "0.5720561", "0.5713443", "0.5711404" ]
0.0
-1
Retrieves multiple scores from `key`
def multi_zget(key, members) members = Array(members) unless members.is_a?(Array) mon_synchronize do perform ["multi_zget", key, *members], :multi => true, :proc => T_MAPINT, :args => [members] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score\n @scores[ result.key ]\n end", "def get_all(key)\n build_if_necessary\n agent.set_query(key)\n [].tap do |results|\n while @trie.predictive_search(agent)\n results << agent_key_value(agent)\n end\n end\n end", "def get_scores\n scores = get_from_url(@scores_conn, SCORES_KEY, {})\n scores.sort! {|a, b| a['date_time'] <=> b['date_time']}\n scores.reverse!\n scores.sort! {|a, b| a['score'] <=> b['score']}\n scores.reverse!\n end", "def load_scores(leaderboard_id, scope)\n path = leaderboard_path(leaderboard_id)\n args = {}\n\n if scope.is_a?(Array)\n args[:p] = scope\n else\n args[:t] = scope.to_s.to_camelcase\n end\n\n raw_scores = service.get(path, args)\n raw_scores.collect { |raw_score| Score.new(raw_score) }\n end", "def read_scores\n end", "def scores\n response[\"scores\"]\n end", "def get_scores\r\n items_db = DYNAMODB.scan(table_name: TABLE_NAME).items\r\n items_hash = make_result_list(items_db)\r\n items = items_hash.sort_by { |hash| hash['score'] }\r\n make_response(HttpStatus::OK, items.reverse().first(10))\r\nend", "def scores\n items.collect { |item| item['points'] }\n end", "def fetch_all(key); end", "def fetch(*key); end", "def get_multiples(number)\n cards = []\n\n @cards_by_score.each_key do |card|\n if @card_scores.count(card.score) == number\n cards << card\n end\n end\n\n cards\n\n end", "def get(key)\n shard_for(key).find_by(distkey => key)\n end", "def obtain_scores\n response = DYNAMODB.scan(table_name: TABLE_NAME)\n parsed_items = parse_items(response.items)\n parsed_items = parsed_items.sort_by{ |item| item['score'] }\n parsed_items.sort_by{ |item| item['date_time'] }\nend", "def scores\n @scores\n end", "def parse_score_leaders()\n users = []\n $redis.scan_each(:match => \"user_score:*\"){ |key| user_id = key.gsub(\"user_score:\", \"\"); users << { :user_id => user_id, :score => get_user_score(user_id), :user_name => get_slack_name(user_id) } }\n finalists = []\n if users.size > 0\n users.each do |user|\n if user[:score] >= 1\n finalists.push(user)\n end\n end\n finalists = finalists.uniq{ |f| f[:user_id] }.sort{ |a, b| b[:score] <=> a[:score] }.slice(0, 100)\n end\n finalists\nend", "def allergy_score(score)\n scorecard = {\n 128 => \"cats\",\n 64 => \"pollen\",\n 32 => \"chocolate\",\n 16 => \"tomatoes\",\n 8 => \"strawberries\",\n 4 => \"shellfish\",\n 2 => \"peanuts\",\n 1 => \"eggs\"\n }\n \n allergies = []\n\n if score == 0\n puts \"No allergies\"\n else\n scorecard.each do |key, value|\n if score >= key\n allergies.push(value)\n score -= key\n end\n end\n p allergies\n end\nend", "def [](key)\n if @result.include?(key)\n @result[key]\n else\n data[key]\n end\n end", "def get_scores\n items = DYNAMODB.scan(table_name: TABLE).items\n sort_items_by_descending_scores_and_ascending_timestamp(items)\n make_result_list(items)\nend", "def obtenirScores\n\t\tif @scores == nil\n\t\t\tcalculerScores()\n\t\tend\n\t\treturn @scores\n\tend", "def get_all_scores\n games = {}\n urls = []\n threads = []\n tags = []\n tags_mutex = Mutex.new\n\n #creates a list of urls to call, one for each day a game is played in a NFL season.\n dates = get_schedule\n dates.each do |date|\n pass_date = date.gsub(\"-\",\"\")\n urls << @client.scoreboard(@options[:season], pass_date)\n end\n\n #Uses threading to call each url generated earlier.\n urls.each do |url|\n threads << Thread.new(url,tags) do |url,tags|\n tag = @client.send_request(url)\n tags_mutex.synchronize {tags << tag}\n end\n end\n\n threads.each(&:join)\n\n #Creating a hash to store results from each scoreboard call.\n tags.each do |tag|\n parsed = parse_scoreboard_response(tag)\n parsed.each do |game|\n games[game['date']] = parsed\n end\n end\n\n #Prints out game scores in easy to read fashion.\n if @options[:team].nil?\n parse_all_scores(games)\n else\n parse_team_scores(games)\n end\n end", "def get_skills_with_scores\n self.skills.map do |skill|\n #need to figure out how to get the score of the grade\n #grade user_id, skill_id, score\n score = skill.grades.find_by(user_id: self.id).score \n {skill: skill, score: score}\n end\n end", "def [](*key)\n get(*key)\n end", "def assignment_scores(grade_hash, assignment_num)\n outArray = []\n grade_hash.each do |key, value|\n outArray.push(value[assignment_num-1])\n\n end\n return outArray\nend", "def index\n\t\t@scores = @product.scores.all\n\tend", "def fetch_scores_for_words(category, wordlist)\n Hash[wordlist.zip(@redis.pipelined do\n wordlist.each do |word|\n @redis.hget base_category_key + category, word\n end\n end)]\n end", "def fetch_scores_for_words(category, wordlist)\n Hash[wordlist.zip(@redis.pipelined do\n wordlist.each do |word|\n @redis.hget base_category_key + category, word\n end\n end)]\n end", "def initialize( key, score )\n @key = key\n @score = score\n end", "def get_score_all_using_get(opts = {})\n data, _status_code, _headers = get_score_all_using_get_with_http_info(opts)\n data\n end", "def index\n @scores, @scores_attached = ScoreService.list(current_user.id)\n end", "def get_score_leaders(options = {})\n options = { :limit => 10, :order => \"desc\" }.merge(options)\n leaders = []\n $redis.scan_each(:match => \"user_score:*\"){ |key| user_id = key.gsub(\"user_score:\", \"\"); leaders << { :user_id => user_id, :score => get_user_score(user_id)} }\n if leaders.size > 1\n if options[:order] == \"desc\"\n leaders = leaders.uniq{ |l| l[:user_id] }.sort{ |a, b| b[:score] <=> a[:score] }.slice(0, options[:limit])\n else\n leaders = leaders.uniq{ |l| l[:user_id] }.sort{ |a, b| a[:score] <=> b[:score] }.slice(0, options[:limit])\n end\n else\n leaders\n end\nend", "def grab(*key)\n synchronize do\n @data.get(*key)\n end\n end", "def scores\n cells = self.concatenate_data_arrays(self.cell_key, 'cells')\n exp_values = self.concatenate_data_arrays(self.score_key, 'expression')\n Hash[cells.zip(exp_values)]\n end", "def fetch(key); end", "def get(key)\n raise 'key must be a String' unless key.is_a?(String)\n shard_for(key.to_s).find_by(distkey => key)\n end", "def read_score_table service, spreadsheet_id\n response = service.get_spreadsheet_values(spreadsheet_id, 'Score!A:B')\n puts 'No data found.' if response.values.empty?\n response.values.each do |row|\n puts \"#{row[0]}, #{row[1]}\"\n end\nend", "def scores\n @raw.map(&:score)\n end", "def [](key)\n fetch(key)\n end", "def multiget(keys)\n data = @client.get_multi(keys)\n keys.map { |k| Marshal.load data[k] }\n end", "def fetch(key)\n result.fetch(key)\n end", "def score_depart(x)\nscore = {\n\t1 => [0,0]\n}\n[score[x]]\nend", "def fetch_data(key)\n [\n input_samples[key],\n input_parameters[key],\n input_data[key],\n output_samples[key],\n output_data[key],\n operation_data[key]\n ].flatten.compact\n end", "def get_skills_with_scores \n self.skills.map do |skill|\n score = skill.grades.find_by(user_id: self.id).score\n {skill: skill, score: score}\n end\n end", "def fetch_results(token)\n options = { with_scores: true }\n if !complete_word?(token) && word.length < 3\n options[:limit] = [0, 50] # use a limit\n end\n values = redis.zrevrangebyscore(\n scored_set(token),\n \"inf\", 0, # max and min\n options\n )\n values.select { |result| within_constraints?(result.first) }\n end", "def get_multi(*keys)\n codes = @backend.get(keys)\n return [] if codes.empty?\n parser.decode_multi(codes.values)\n rescue ::Memcached::Error\n nil\n end", "def fetch_data(key)\n map { |om| om.fetch_data(key) }.flatten.compact\n end", "def get_score()\n score = Hash.new(0)\n players.each {|player| score[player.name] = player.score}\n score\n end", "def score(prog); @scores[prog]; end", "def all\n words_with_scores = @redis.zrevrange(@key, 0, -1, :withscores => true)\n\n if !words_with_scores.empty? and words_with_scores.first.is_a?(Array)\n words_with_scores.each { |pair| pair[1] = pair[1].to_i }\n Hash[words_with_scores]\n else\n index = 1\n size = words_with_scores.size\n\n while index < size\n words_with_scores[index] = words_with_scores[index].to_i\n index += 2\n end\n\n Hash[*words_with_scores]\n end\n end", "def recommendations(url,num=5)\n url = url_host_path(url)\n uid = REDIS[\"id:#{url}\"]\n results = REDIS.zrevrangebyscore(\"recos:#{uid}\", '+inf', '-inf', {:withscores => true} )\n \n recos = results[0...num].map do |x| uid,score = x[0],x[1]\n { :title=>REDIS[\"title:#{uid}\"], :url=>REDIS[\"url:#{uid}\"], :score=>score }\n end\n \n return recos\nend", "def fetch_data(key_list)\n data = self\n key_list.each { |key| data = fetch_key_with_initialization(key, data) }\n data\n end", "def leader_board(scores)\r\n \r\n end", "def get_single_key(key)\n key = @size+key if key < 0\n r = @results[key]\n unless r.nil? && key < @size\n r\n else\n retrieve_for_index(key)\n @results[key]\n end\n end", "def mget(*keys); end", "def review_scores\n list = extract_from_list self.responses, :get_average_score\n (list.empty?) ? [0] : list\n end", "def scores\n quiz_entries.collect { |qe| qe.score }\n end", "def get_recommendation(data, key, metric = Pearson.new)\n totals = {}\n sim_sums = {}\n\n others = data.keys - [key]\n others.each do |other|\n sim = metric.distance(data, key, other)\n\n # only check others with similarity > 0\n if sim > 0\n data[other].each do |item, score|\n # only check item not rated by me\n if data[key][item].nil? or data[key][item] == 0\n totals[item] = 0 if totals[item].nil?\n sim_sums[item] = 0 if sim_sums[item].nil?\n\n totals[item] += score * sim\n sim_sums[item] += sim\n end\n end\n end\n end\n\n rankings = totals.collect do |item, score|\n [score/sim_sums[item], item] \n end\n rankings.sort!\n rankings.reverse!\n end", "def assignment_scores(grade_hash, assignment_num)\n a = []\n grade_hash.values.each { |name| a.push(name[assignment_num - 1]) }\n a\nend", "def index\n @record_scores = RecordScore.all\n end", "def get(key)\n response = request(:get, uri(key))\n if response.status == 200\n data = MultiJson.load(response.body)\n if data.is_a?(Array)\n data.each_with_object({}) do |e, acc|\n acc[e[S_KEY]] = e[S_VALUE]\n end\n else\n data[S_VALUE]\n end\n else\n nil\n end\n end", "def test_by_score(score)\n allergies = Array.new\n $all_allergies.values.reverse.each do |num|\n if num <= score\n score -= num\n allergies << $all_allergies.key(num).to_s\n end\n end\n allergies\nend", "def score(player)\n @score[player]\n end", "def get(key)\n get_all(key).first\n end", "def num_points_scored (sportsman)\ngame_hash\nscores = 0\n game_hash.each do |team_position, team_data|\n team_data.each do | player_name, information|\n # binding.pry\n if player_name == :players \n information.each do |name, numbers|\n #binding.pry\n if name == sportsman \n numbers.each do |key, value|\n #binding.pry\n if key == :points\n #binding.pry\n return scores = value.to_i\n #binding.pry\n end\n end\n end\n end\n end\n end\n end \n #return scores\n end", "def map_fetch(key)\n map { |obj| obj[key] }\n end", "def get_score(num)\n return @game[num]\n end", "def score\n #Here are the letter values. Think about how you might put this data in a usable format for your methods above.\n scores = {a: 1, b: 3, c: 3, d: 2, e: 1,\n f: 4, g: 2, h: 4, i: 1, j: 8,\n k: 5, l: 1, m: 3, n: 1, o: 1,\n p: 3, q: 10, r: 1, s: 1, t: 1,\n u: 1, v: 4, w: 4, x: 8, y: 4,\n z: 10}\n\n# Need to use @word with something to get the value of the letters combined \n\n\n return score\n end", "def fetch_values(*key_list, &block)\n if array_index?(key_list)\n key_list.map { |key| fetch(key, &block) }\n elsif block_given?\n __fetch_values__(*key_list) { |key| yield(key) }\n else\n __fetch_values__(*key_list)\n end\n end", "def get_square_at(key)\n @squares[key]\n end", "def parse_character_stats(stats_array, key)\n stats_array.collect do |url|\n response_hash = get_response(url)\n response_hash[key]\n end\nend", "def get(key)\n @@list[key]\n end", "def key_for(score)\n if score.nil?\n return :not_participated\n end\n\n # if you change the scoring, remember to change the 'about method' page as well.\n case score\n when 0...33\n :against\n when 33...66\n :for_and_against\n when 66..100\n :for\n end\n end", "def get key; call key; end", "def get(key)\n mon_synchronize do\n perform [\"get\", key]\n end\n end", "def get(key)\n mon_synchronize do\n perform [\"get\", key]\n end\n end", "def scores\n {\n 'a' => 1, 'e' => 1, 'i' => 1, 'o' => 1,\n 'u' => 1, 'l' => 1, 'n' => 1, 'r' => 1,\n 's' => 1, 't' => 1, 'd' => 2, 'g' => 2,\n 'b' => 3, 'c' => 3, 'm' => 3, 'p' => 3,\n 'f' => 4, 'h' => 4, 'v' => 4, 'w' => 4,\n 'y' => 4, 'k' => 5, 'j' => 8, 'x' => 8,\n 'q' => 10, 'z' => 10\n }\nend", "def [](key)\n timeout_retry(3, 3){\n write \"GET #{key}\\r\\n\"\n redis_unmarshal(bulk_reply)\n }\n end", "def read_team_scores\n ret = []\n num_entries = read_word.to_i\n num_entries.times do\n ret << read_word.to_i\n end\n [ret, read_word.to_i]\n end", "def retrieve_values(hash1, hash2, key)\n return [hash1[key], hash2[key]]\nend", "def scores\n scores = ValueActivity.all\n render json: ValueActivitiesSerializer.new(scores).serializable_hash\n end", "def players\n # players_array = []\n # iterating through game hash and returning a list of all my players\n game_hash.map do |key, value|\n value[:players]\n end.flatten\n\nend", "def get(key)\n @ivar.each_with_index do |ele, i|\n if ele[0] == key \n return ele[1]\n end\n end\n end", "def get_result(key)\n r = results\n if r != nil\n return r.fetch(key, nil)\n end\n nil\n end", "def index\n @scores = Score.all\n end", "def index\n @scores = Score.all\n end", "def get(key)\n\t\tself.ivar.each do |pair|\n\t\t\tif pair[0] == key\n\t\t\t\treturn pair[1..-1]\n\t\t\tend\n\t\tend\n\t\treturn []\n end", "def get(key_or_list)\n get_async(key_or_list).value\n end", "def most_points_scored\n most_points = 0\n leading_scorer = \"\"\n\n game_hash.values.each do |roster|\n roster[:players].each do |player|\n if player[:points] > most_points\n most_points = player[:points]\n leading_scorer = player[:player_name]\n end\n end\n end\n return leading_scorer\nend", "def [](key)\n _data.fetch(key) { search_in_kept_data(key) }\n end", "def perform(key, value)\n result = []\n key.each_with_index do |k, v|\n result << {k => (value)[v]} #On push dans l'array une portion de hash composer de: key = symbol_text et value = price_text[v] \n end\n puts result\n return result\nend", "def score\n [base_score] + kickers\n end", "def assignment_scores(grade_hash, assignment_num)\n grade_hash.map do |key, value|\n grade_hash[key][assignment_num - 1]\n end\nend", "def index\n @user_scores = UserScore.all\n end", "def list(*key)\n objects(*key).to_a\n end", "def top_students(grade_hash, number_of_students)\n # Loop through hash\n top_students_array = grade_hash.map do |key, value|\n # find average for each student\n average = value.sum / value.length\n # put into array of key, score\n [key, average]\n end\n puts top_students_array\n # turn into hash\n top_students_hash = top_students_array.to_h\n # sort hash\n top_students_sorted = top_students_hash.sort_by do |a, b| \n -b\n end\n # map keys\n sorted_student_array = top_students_sorted.map do |key, value|\n key\n end\n # return top student names in array\n result = sorted_student_array.take(number_of_students)\n result\nend", "def get_scored_list(rows, word_ids)\n total_scores = rows.to_hash { |row| [row[0], 0] }\n\n weights.each do |weight, func|\n scores = self.send(func, rows, word_ids)\n total_scores.keys.each do |url|\n total_scores[url] += weight * scores[url]\n end\n end\n \n return total_scores\n end", "def list(key, **options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list',\n\t\t\t\t\t\t\t\t\t\t\t\t :video_key => key))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend", "def mget(*keys, &blk); end", "def scores_index\n @scores_idx\n end", "def scorecards\n expose Challenge.scorecards(@oauth_token, params[:challenge_id].strip)\n end", "def respond_with_leaderboard(key = \"leaderboard:1\", order = \"desc\", response = \"top\")\n response = $redis.get(key)\n if response.nil?\n leaders = []\n get_score_leaders({:order => order}).each_with_index do |leader, i|\n user_id = leader[:user_id]\n name = get_slack_name(leader[:user_id])\n score = currency_format(get_user_score(user_id))\n leaders << \"#{i + 1}. #{name}: #{score}\"\n end\n if leaders.size > 0\n response = \"Let's take a look at the #{response} scores:\\n\\n#{leaders.join(\"\\n\")}\"\n else\n response = \"There are no scores yet!\"\n end\n $redis.setex(key, 60*5, response)\n end\n response\nend", "def scores( params={} )\n scores = get_connections(\"scores\", params)\n return map_connections scores, :to => Facebook::Graph::Generic\n end" ]
[ "0.66904616", "0.60693157", "0.6061477", "0.6023043", "0.59604263", "0.59427756", "0.5916072", "0.5911103", "0.586596", "0.58605474", "0.5816311", "0.5790233", "0.5778874", "0.576432", "0.5757205", "0.5717964", "0.57110864", "0.5703392", "0.56682533", "0.56382006", "0.556746", "0.5528423", "0.5516007", "0.55145997", "0.5492453", "0.5492453", "0.5457639", "0.54568166", "0.54460335", "0.5432671", "0.5431805", "0.54259604", "0.54128265", "0.5410676", "0.5408847", "0.54026073", "0.5400542", "0.5397252", "0.5391889", "0.5386298", "0.5383977", "0.53642064", "0.53632975", "0.5358375", "0.5357177", "0.53533757", "0.53473306", "0.5345752", "0.5332051", "0.53272724", "0.5327206", "0.5324314", "0.52899164", "0.52777475", "0.52740645", "0.5261447", "0.52497125", "0.5247947", "0.5247946", "0.5239472", "0.5238418", "0.52376425", "0.52273536", "0.52231497", "0.52208966", "0.52182186", "0.519981", "0.51973844", "0.51922244", "0.5191816", "0.5190851", "0.5188894", "0.5188066", "0.5188066", "0.51821643", "0.517604", "0.5167255", "0.5166135", "0.5163901", "0.51627725", "0.51601034", "0.5157097", "0.5155805", "0.5155805", "0.51550895", "0.51539576", "0.5153465", "0.5151782", "0.515013", "0.5149499", "0.51377064", "0.513733", "0.51360023", "0.5132937", "0.5131203", "0.5128522", "0.51227295", "0.5122186", "0.51195717", "0.5117822", "0.5115981" ]
0.0
-1
Deletes multiple members from `key`
def multi_zdel(key, members) members = Array(members) unless members.is_a?(Array) mon_synchronize do perform ["multi_zdel", key, *members], :proc => T_INT end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def srem(key, *members); end", "def srem(key, *members); end", "def del(*keys); end", "def xdel(key, *ids); end", "def multi_zdel(key, members)\n members = Array(members) unless members.is_a?(Array)\n mon_synchronize do\n perform [\"multi_zdel\", key, *members], proc: T_INT\n end\n end", "def delete_multiple(keys = [])\n verify_connection_url\n\n keys.each { |key| delete key }\n end", "def delete(*key_list)\n first_keys, last_key = split_keys(key_list)\n data = fetch_data(first_keys)\n data.__delete__(last_key) if data.__key__?(last_key)\n end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete_key(key)\n end", "def hdel(key, *fields); end", "def delete(key)\n\n end", "def delete_keys! list\n if list.is_a? Array\n list.map{|k| self.delete k}\n else\n self.delete list\n end\n self\n end", "def unlink(*keys); end", "def accept!(*key_list)\n intersection = keys - key_list\n intersection.each{ |key| delete(key) }\n self\n end", "def hdel(key, *fields)\n fields.flatten!(1)\n send_command([:hdel, key].concat(fields))\n end", "def srem(key, *members)\n node_for(key).srem(key, *members)\n end", "def remove(key); end", "def delete(key)\n @ivar.each_with_index do |ele, i|\n if ele[0] == key\n @ivar.delete_at(i)\n end\n end\n end", "def srem?(key, *members); end", "def srem?(key, *members); end", "def hdel(key, *fields)\n fields.flatten!(1)\n node_for(key).hdel(key, fields)\n end", "def delete_keys!(*keys)\r\n\t\tkeys.each do |k| \r\n\t\t\tself.delete(k)\r\n\t\tend \r\n\t\tself\r\n\tend", "def del(key)\n @first.del(key)\n end", "def delete(key)\n pop if change_key(key, nil, true)\n end", "def delete(key)\n return unless in?(key)\n\n hash_index = hasher(key, @keys.size)\n\n if @keys[hash_index] == key\n @keys[hash_index] = nil\n @values[hash_index] = nil\n else\n next_key_index = rehash(hash_index, @keys.size)\n\n while @keys[next_key_index] != nil and @keys[next_key_index] != key\n next_key_index = rehash(next_key_index, @keys.size)\n end\n\n @keys[next_key_index] = nil\n @values[next_key_index] = nil\n end\n end", "def del(*keys)\n keys.flatten!(1)\n return 0 if keys.empty?\n\n send_command([:del] + keys)\n end", "def remove(key)\n\n end", "def delete(*keys)\n multi do\n keys.each do |k|\n @hash.delete(k)\n @index.delete(k)\n end\n end\n nil\n end", "def delete_all(key)\n raise ArgumentError if key.blank?\n\n count = 0\n @redis.keys(\"#{key}*\").each do |k|\n count += @redis.del k\n end\n\n count.positive?\n end", "def delete(key)\n responsible_clients(key).each do |v|\n with_retries { v.logical.delete(wrap_key(key)) }\n end\n end", "def delete_key(key)\n @keys.delete(key)\n @passwords.each_key { |id| set_password(id, get_password(id)) }\n @otp_keys.each_key { |id| set_otp_key(id, get_otp_key(id)) }\n end", "def clear_by_key(key)\n delete(key)\n end", "def delete(key)\n @mutex.synchronize do\n x = anchor\n level = node_level(x)\n update = Array.new(level)\n x = find_with_update(x, level, key, update)\n \n # remove existing key\n \t if node_compare(x, key) == 0\n \t level = node_level(x)\n \t while level > 0\n \t level -= 1\n \t node_delete_after!(x, update[level], level)\n end\n \t end\n end\n \tself\n \tend", "def delete(key)\n\t\t\t\t[self, self, false]\n\t\t\tend", "def delete(key)\n @data.delete(key)\n @key_size.delete(key)\n end", "def xdel(key, *ids)\n args = [:xdel, key].concat(ids.flatten)\n send_command(args)\n end", "def delete(key)\n @hash.delete key\n @key_hash.delete key\n end", "def delete_pair(key)\r\n @redis.del key \r\n end", "def getdel(key); end", "def getdel(key); end", "def delete(key)\n perform_delete(:delete, key)\n end", "def remove!(*keys)\n keys.each{|key| self.delete(key) }\n self\n end", "def remove(key)\n\n if include?(key)\n self[key].delete(key)\n @count -= 1\n end\n\n end", "def delete(keys)\n\t\t\tunless key.is_a? Array\n\t\t\t\tkey = [key]\n\t\t\tend\n\n\t\t\t@@driver.delete(keys)\n\t\tend", "def delete(key)\n transaction do |y|\n y.delete(key)\n end\n end", "def cache_delete(key, *keys)\n # Remove a single key\n if keys.empty?\n nkey = namespaced(key)\n result = @dataset.select(:value).filter(:key => nkey).limit(1)\n\n # Ramaze expects nil values\n if result.empty?\n result = nil\n else\n result = deserialize(result.first[:value])\n end\n\n @dataset.filter(:key => nkey).delete\n # Remove multiple keys\n else\n nkeys = [key, keys].flatten.map! { |n| namespaced(n) }\n result = dataset.select(:value).filter(:key => nkeys)\n\n result.map! do |row|\n deserialize(row[:value])\n end\n\n @dataset.filter(:key => nkeys).delete\n end\n\n return result\n end", "def delete(key)\n key = to_key key\n @group.delete key if @group.key? key\n end", "def delete(key)\n @succ.delete key\n end", "def cache_delete(key, *keys)\n # Remove a single key\n if keys.empty?\n nkey = namespaced(key)\n result = @dataset.select(:value).filter(:key => nkey).limit(1)\n\n # Ramaze expects nil values\n if result.empty?\n result = nil\n else\n result = deserialize(result.first[:value])\n end\n\n @dataset.filter(:key => nkey).delete\n # Remove multiple keys\n else\n nkeys = [key, keys].flatten.map! { |nkey| namespaced(nkey) }\n result = dataset.select(:value).filter(:key => nkeys)\n\n result.map! do |row|\n deserialize(row[:value])\n end\n\n @dataset.filter(:key => nkeys).delete\n end\n \n return result\n end", "def delete(key, &block); end", "def delete_entry(key, **options); end", "def del\n redis do |conn|\n conn.multi do |pipeline|\n pipeline.zrem(DIGESTS, key.digest)\n pipeline.del(key.digest, key.queued, key.primed, key.locked, key.info)\n end\n end\n end", "def zrem(key, member); end", "def zrem(key, member); end", "def del(keys)\n keys.each { |key| _data.delete(key) }\n _save\n end", "def delete(key)\n removeAttribute(key.to_s)\n end", "def delete(key)\n removeAttribute(key.to_s)\n end", "def delete(key)\n removeAttribute(key.to_s)\n end", "def delete(key)\n position = search(key)\n return if (key <=> @keys[position]) != 0\n @keys.delete_at(position)\n @values.delete_at(position)\n end", "def delete(key)\n doozer_pool.with_connection do |doozer|\n doozer.delete(full_key(key))\n end\n end", "def delete(key)\n data.delete(key)\n @deleted_hash[key] = nil\n end", "def delete key\n @internal_hash[key].clear\n end", "def delete(key)\n attribute = key.to_sym\n details.delete(attribute)\n messages.delete(attribute)\n end", "def delete(key)\n unimplemented\n end", "def del(*keys)\n keys.each{|key| expunge_if_expired(key)}\n i = 0\n keys.each do |key|\n if self.exists(key)\n self.expunge(key)\n i += 1\n end\n end\n if keys.size > 1\n true\n else\n i\n end\n end", "def remove_keys(*keys)\n @rye_opts[:keys] ||= []\n @rye_opts[:keys] -= keys.flatten.compact\n @rye_opts[:keys].uniq!\n self # MUST RETURN self\n end", "def delete _key\n store.transaction() { |s| s.delete(prepare_key(_key)) }\n end", "def delete(key)\n raise ArgumentError, \"+key+ is not an Array, but was #{key.class}\" unless Array === key\n\n @second_level_cache.delete(key) if @second_level_cache\n @cache.delete(key)\n end", "def delete(key)\n index = self.keys.index(key) unless @array.empty?\n @array.delete_at(index) if index\n end", "def delete(key)\n key = alternate_key(key) unless has_key?(key)\n super\n end", "def srem?(key, *members)\n node_for(key).srem?(key, *members)\n end", "def remove(key)\n with_client do |client|\n client.del(build_key(key))\n end\n end", "def delete(key)\n raise NotImplementedError\n end", "def delete_all\n store.delete(KEY)\n self\n end", "def delete\n redis.del key\n end", "def remove(key)\n row = key >> 10\n column = @a[row].index{|(i,v)| i == key}\n if column\n @a[row].delete_at(column)\n end\n end", "def delitem(list, item)\n# input: list and key\n list.delete(item)\n# steps: delete a given key item\nend", "def remove(key)\n @store.delete_if { |i| i[:key] == build_key(key) }\n end", "def del(key)\n response = db.delete_item(@table_name, {'HashKeyElement' => {'S' => key}})\n true\n end", "def delete(key)\n raise NotImplementedError\n end", "def delete(key)\n raise NotImplementedError\n end", "def delete(item, count = 0)\n conn.lrem key, count, item\n end", "def destroy\n @key.destroy\n end", "def delete( key )\n fail NotImplementedError\n end", "def delete(key)\n messages.delete(key)\n end", "def delete_multi(names, options = nil)\n return 0 if names.empty?\n\n options = merged_options(options)\n names.map! { |key| normalize_key(key, options) }\n\n instrument_multi :delete_multi, names do\n delete_multi_entries(names, **options)\n end\n end", "def delete(key)\n raise \"Method not implemented. Called abstract class.\"\n end", "def remove(*key)\n @cache.delete(key)\n end", "def remove_key_from_hash_of_arrays!(hash,key)\n hash.each do |name,arr|\n arr.each do |record|\n record.delete(key)\n end\n end\n hash\n end", "def delete!(keys)\n @pages.pipelined do\n keys.each { |k| @pages.del k }\n end\n return keys\n end", "def delete!(keys)\n @pages.pipelined do\n keys.each { |k| @pages.del k }\n end\n return keys\n end", "def delete(key)\n messages.delete(key)\n end", "def delete(key)\n messages.delete(key)\n end", "def delete(key)\n self.map_var.each_with_index do |pair, idx|\n if pair[0] == key \n first_half = self.map_var[0...idx] \n second_half = self.map_var[idx+1..-1]\n self.map_var = first_half + second_half\n break\n end \n end\n end", "def delete(key)\n super(convert_key(key))\n end", "def cache_delete(*keys)\n keys.each {|key| @moneta.delete(key) }\n end" ]
[ "0.7761222", "0.7761222", "0.77502495", "0.76088166", "0.75506496", "0.736162", "0.73305357", "0.73110414", "0.73110414", "0.73110414", "0.73110414", "0.73110414", "0.71877265", "0.71359855", "0.7132244", "0.7117269", "0.71078646", "0.70986193", "0.70623136", "0.70511115", "0.7016884", "0.7010866", "0.699802", "0.699802", "0.69911236", "0.6975715", "0.6964447", "0.69429195", "0.68637675", "0.6860024", "0.6818965", "0.6817899", "0.6777535", "0.67426556", "0.673566", "0.6721229", "0.67189753", "0.6709124", "0.6705458", "0.67023903", "0.66978264", "0.66954464", "0.6643774", "0.6643774", "0.6585902", "0.65701914", "0.65655994", "0.65644383", "0.6536763", "0.65342236", "0.6522521", "0.6520789", "0.65098065", "0.6497289", "0.64959323", "0.6485319", "0.64776605", "0.64776605", "0.6477474", "0.6469471", "0.6469471", "0.6469471", "0.646444", "0.6458996", "0.64446026", "0.64429176", "0.6428784", "0.6424718", "0.64242524", "0.6414908", "0.64055645", "0.6404854", "0.63994974", "0.6381876", "0.63587534", "0.6356984", "0.63238", "0.63220704", "0.63196224", "0.6304669", "0.63043964", "0.63031936", "0.62931544", "0.6292628", "0.6292628", "0.62865007", "0.6284251", "0.6277826", "0.62707675", "0.6268073", "0.6242807", "0.6232039", "0.62092876", "0.61986727", "0.61986727", "0.6198024", "0.6198024", "0.61856717", "0.61752623", "0.61658645" ]
0.74879736
5
record a file download event
def record_file_download_event( id, user = nil ) puts "==> file download event: file id #{id}" event = find_todays_existing_download_event( id, user ) if event.nil? == false event.downloads += 1 else event = create_new_download_event( id, user ) end save_safely( event ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download(event)\n info \"Finished downloading updates\"\n end", "def download\n record_activity(\"downloaded \" + params[:file_name])\n send_file Rails.root.join('public', 'uploads', params[:file_name])\n end", "def handleDownloadFileRequest(req)\n begin\n length = File.size(req.path)\n # There is a possible race condition here. If we get the file size, and then\n # start sending bytes, and a writer is still writing to the end of the file\n # we will write too few bytes. As well if the file shrinks, we won't write enough\n # bytes and the reader will wait forever. Could solve this using a marker at the\n # end of the stream instead of prefixing with the length.\n io = File.open(req.path, \"r\")\n StreamMessage.new(length, io)\n rescue\n StreamMessage.new(0, nil)\n end\n end", "def download\r\n download = Download.find params[:id]\r\n \r\n # If this download is available only after login, execute an authentication process.\r\n return if download.restrict && !user_authentication\r\n \r\n # Download contains an agreement\r\n if download.agreement\r\n # Redirect to the agreement page if it is a GET request.\r\n unless request.post?\r\n render :partial => 'agreement', :object => download.agreement, :layout => true\r\n return false\r\n end\r\n \r\n if params[:commit] == 'Accept'\r\n # User accept this agreement, log this event and then continue.\r\n agreement_log = AgreementLog.create(\r\n :agreement => download.agreement,\r\n :download => download,\r\n :remote_ip => request.remote_ip,\r\n :store_user => (session[:web_user].nil? ? nil : session[:web_user]),\r\n :http_header => request.env.to_yaml\r\n )\r\n else\r\n # User does not accept this agreement, redirect to support page.\r\n redirect_to :action => 'index'\r\n return false\r\n end\r\n end\r\n \r\n # Generate a symbolic link for this file to download.\r\n # After deploied on server, a CRON job will clean up these links every 30 minutes.\r\n path = Digest::SHA1.hexdigest(\"#{session.session_id} @ #{Time.now.to_f}\")\r\n path << \".u_#{session[:web_user].id}\" if download.restrict\r\n path << \".a_#{agreement_log.id}\" if download.agreement\r\n filename = download.filename\r\n \r\n FileUtils.mkdir \"./public/downloads/#{path}\" unless File.directory? \"./public/downloads/#{path}\"\r\n target_file = \"./public/downloads/#{path}/#{filename}\"\r\n \r\n # Codes for test only. Delete 2 lines below.\r\n # render :text => \"Redirect to /downloads/#{path}/#{filename}\"\r\n # return false\r\n \r\n unless File.symlink(\"#{RAILS_ROOT}/downloads/#{download.filename}\", target_file) == 0\r\n render :text => \"Sorry, system is busy now. Please try again several seconds later.\"\r\n return false\r\n end\r\n \r\n # Log this file name in database.\r\n File.open('log/download.log', 'a') { |file| file.puts \"downloads/#{path}/#{filename}\" }\r\n\r\n redirect_to \"/downloads/#{path}/#{filename}\"\r\n end", "def download\n send_file @cfile.path.to_s\n end", "def track_download\n connection.get(links.download_location)[\"url\"]\n end", "def download(path, item)\n Download.download item.link, path\n Logger.instance.info \"Downloaded file #{item.title}\"\n @history.save item\n end", "def download_file\n @request = Request.find_by_n_request(params[:id])\n send_data(@request.file, type: @request.file_type, filename: @request.file_name,\n disposition: 'attachment')\n end", "def download(path, item)\n Download.download item.link, path\n Logger.instance.info \"Downloaded file #{item.title}\"\n @history.save item.title\n end", "def download_url\n process_emulation 10\n clear_progress_bar\n self.downloaded_at = Time.now.utc\n save! && ready!\n end", "def handleDownloadFileRequest(req)\n $logger.debug \"handleDownloadFileRequest called\"\n begin\n # Make sure we don't download files outside of the data dir\n return StreamMessage.new(0, nil) if ! pathIsUnderDataDir(req.path)\n\n length = File.size(req.path)\n # There is a possible race condition here. If we get the file size, and then\n # start sending bytes, and a writer is still writing to the end of the file\n # we will write too few bytes. As well if the file shrinks, we won't write enough\n # bytes and the reader will wait forever. Could solve this using a marker at the\n # end of the stream instead of prefixing with the length.\n io = File.open(req.path, \"r\")\n StreamMessage.new(length, io)\n rescue\n StreamMessage.new(0, nil)\n end\n end", "def download_file\n run_callbacks :download_file do\n if attachment.stored_at_s3?\n @s3_file_processor = S3::ProcessFiles.new(attachment)\n s3_file_processor.download_s3_file\n self.local_file = s3_file_processor.file_path\n else\n self.local_file = attachment.path\n end\n end\n end", "def download\n ExtensionVersion.increment_counter(:web_download_count, @version.id)\n Extension.increment_counter(:web_download_count, @extension.id)\n ManageIQ::Metrics.increment('extension.downloads.web')\n DailyMetric.increment(@version.download_daily_metric_key)\n\n redirect_to @version.download_url\n end", "def send_file_data filename\n\t\tEventMachine::send_file_data @signature, filename\n\tend", "def anonymize_file_download_event( download_event )\n\n # find an anomomyzed version\n event = find_existing_download_event( download_event.date, download_event.file_id, nil )\n if event.nil? == false\n event.downloads += download_event.downloads\n else\n event = create_new_download_event( download_event.file_id, nil )\n event.date = download_event.date\n end\n save_safely( event )\n\n download_event.destroy\n end", "def download_file\n info(\"Downloading file \" + @filename + \" started.\")\n \n open(local_file, 'wb') do |file|\n file << open(remote_file).read\n end\n\n info(\"Downloading file \" + @filename + \" completed successfully.\")\n rescue StandardError => e\n error(\"Unable to download file #{@filename} due to following error occurred #{e}\")\n end", "def download\n\t\tsend_file(params[:path])\n end", "def download\n ExtensionVersion.increment_counter(:web_download_count, @version.id)\n Extension.increment_counter(:web_download_count, @extension.id)\n BonsaiAssetIndex::Metrics.increment('extension.downloads.web')\n DailyMetric.increment(@version.download_daily_metric_key)\n\n redirect_to helpers.download_url_for(@version)\n end", "def download\n @document = Document.find(params[:id])\n @filepath = @document.full_filename\n send_file(@filepath,\n :disposition => 'attachment',\n :encoding => 'utf8',\n :type => 'application/octet-stream') \n end", "def download\n file = BruseFile.find_by(:download_hash => params[:download_hash])\n if file.identity.user == current_user\n # send the file to the user\n send_data file.identity.get_file(file.foreign_ref), filename: file.name, type: file.filetype\n end\n end", "def download_file()\n # gets the student we are watching\n @student = Student.find(params[:id]);\n # Here we wanna decrypt the file\n decr_file = decrypt_file(@student)\n # we make the file downloadable\n send_file(decr_file,\n :filename => @student.file,\n :type => @student.file.content_type,\n :disposition => 'attachment',\n :url_based_filename => true)\n end", "def mark_as_downloaded\n \tself.download_counter += 1\n \tself.save(:validate => false) # no need to perform validations in this case\n end", "def on_session_download(session, remote_path, local_path)\n\tend", "def download_file\n send_file(@static_page.custom_file.path,\n disposition: 'attachment; filename=\"' + @static_page.custom_file.file.filename + '\"',\n type: @static_page.custom_file.file.content_type,\n url_based_filename: true)\n end", "def download(recording, filename = nil)\n \n # If no filename is given, we default to <title>_<recstartts>.<extension>\n if filename.nil?\n filename = recording.title + \"_\" +\n recording.myth_nondelimited_recstart + File.extname(recording.filename) \n end\n\n File.open(filename, \"wb\") do |f|\n stream(recording.path) { |data| f.write(data); puts \".\" }\n end\n end", "def download_link\n download_params = { :sub => 'download', :fileid => @fileid, :filename => @remote_filename, :cookie => @api.cookie }\n DOWNLOAD_URL % [ @server_id, @short_host, download_params.to_query ]\n end", "def meeting_recordings_download_file(download_url)\n raise \"You must use JWT client\" unless self.class == Zoom::Clients::JWT\n file=Tempfile.create\n file.binmode\n response = HTTParty.get(\"#{download_url}?access_token=#{access_token}\",\n stream_body: true,\n follow_redirects: true\n ) do |fragment|\n if fragment.code == 200\n file.write(fragment)\n elsif fragment.code != 302\n raise StandardError, \"Non-success status code while streaming #{fragment.code}\"\n end\n end\n file\n end", "def get_download\n\tend", "def download\n @route.update_last_download_at\n file = @route.gpx\n\n send_file(file)\n end", "def perform()\n @date = Date.today\n download\n end", "def download\n return file if file\n\n self.file = retrieve_file\n end", "def file(_event)\n setTimeout 0 do\n @submitted = true\n @filed = true\n end\n end", "def download\n send_file @document.complete_path, :type => @document.mime, :disposition => 'inline'\n end", "def download\n if Rails.env.production?\n redirect_to @upload.archive.expiring_url(10)\n else\n redirect_to @upload.archive.url\n end\n end", "def download!(source_url, destination_file); end", "def download_original ; path_download_file(:original).download end", "def report_file_download(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id } \r\n\t\tfile=nessus_http_request('file/report/download', post)\r\n\t\treturn file\r\n\tend", "def download_file\n @user = User.find_by_dtoken(params[:dtoken])\n @os = params[:os]\n if @user.nil?\n redirect_to :action => download\n else\n download_file = \"#{BINARIES[@os]}\"\n download_loc = \"#{DOWNLOAD_LOC}/#{download_file}\"\n # download_loc = \"domosaics.jar\" if @os == 'unknown'\n send_file(\"#{download_loc}\", :filename => \"#{BINARIES[@os]}\")\n # EMAIL TO ANGSDT TEAM:\n UserMailer.download_notification(@user).deliver\n #render :text => \"You are in the download area... !\"\n end\n end", "def download\n # TODO: Find out why this is needed, should be handeled in ability.rb\n authorize! :read, params[:id]\n begin\n send_data @file.datastreams['content'].content, {:filename => @file.original_filename, :type => @file.mime_type}\n rescue ActiveFedora::ObjectNotFoundError => obj_not_found\n flash[:error] = 'The basic_files you requested could not be found in Fedora! Please contact your system administrator'\n logger.error obj_not_found.to_s\n render text: obj_not_found.to_s, status: 404\n rescue => standard_error\n flash[:error] = 'An error has occurred. Please contact your system administrator'\n logger.error standard_error.to_s\n render text: standard_error.to_s, status: 500\n end\n end", "def file_download\n if !model.edgarj_file?(params[:column])\n flash[:error] = t('edgarj_file.no_assoc')\n return\n end\n\n file_info_id = user_scoped.find(params[:id]).send(params[:column])\n if file_info_id\n file_info = FileInfo.find(file_info_id)\n if file_info\n send_file(file_info.full_filename, :filename => file_info.filename)\n return\n end\n end\n logger.warn 'invalid file_info'\n end", "def download_attachment\n # Restituisce, in download, l'allegato del messaggio selezionato\n send_data @attachment.data, filename: @attachment.name, type: @attachment.mime_type, disposition: 'attachment'\n end", "def http_download(host, dir, file, ofile, file_log)\n\t\t\tinfo \"* host: \" + host\n\t\t\tinfo \"* dir: \" + dir\n\t\t\tinfo \"* file: \" + file\n\t\t\tinfo \"* ofile: \" + ofile\n\t\t\t\n\t\t\thttp = Net::HTTP.start(host)\n\t\t\treq = Net::HTTP::Get.new(\"/\" + dir + \"/\" + file)\n\t\t\ttransferred = 0\n\t\t\thttp.request(req) do |resp|\n\t\t\t\tfilesize = resp.content_length\n\t\t\t\t\n\t\t\t\tif _check_download_size(ofile, filesize)\n\t\t\t\t\tpb = ProgressBar.new(file, 100)\n\t\t\t\t\tf = File.open(ofile, 'w')\n\t\t\t\t\tresp.read_body do |data|\n\t\t\t\t\t\tif data\n\t\t\t\t\t\t\ttransferred += data.size\n\t\t\t\t\t\t\tif(transferred != 0)\n\t\t\t\t\t\t\t\tpercent_finished = 100 * (transferred.to_f / filesize.to_f)\n\t\t\t\t\t\t\t\tpb.set(percent_finished)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tf.write(data)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\terror \"data returned by server is empty!\"\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tf.close\n\t\t\t\t\tpb.finish\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def download_note\n document = Document.find(params[:id])\n authorize! :download_note, document\n \n begin\n upload = Upload.find(params[:upload_id])\n rescue\n puts \"### ERROR: \" + e.message\n redirect_to show_path(document), notice: \"ERROR: file (upload) ID not found. Upload may have been deleted\"\n return\n end\n \n send_file upload.upfile.path, \n :filename => upload.upfile_file_name, \n :type => 'application/octet-stream'\n end", "def download\n document = Document.find(params[:document_id])\n tempfile = open(document.url)\n send_data tempfile.read, :filename => document.title, :type => document.content_type\n end", "def run_successful_download(broker, agent, files, **kwargs, &block)\n download_file(broker, agent, files, **kwargs) do |datas|\n ensure_successful(broker, [agent], datas, **kwargs, &block)\n end\nend", "def download_file(broker, agent, files, **kwargs, &block)\n params = { files: files }\n target = [\"pcp://#{agent}/agent\"]\n do_module_action(broker, target, 'file', 'download', params, **kwargs, &block)\nend", "def download_file(test = false)\n @update_file = Tempfile.new(['elasticsearch_update_file', @download.extension])\n\n @log.info('Downloading file from url.')\n\n write_file_from_url(@update_file, @download.url) unless test\n\n @update_file\n end", "def filter(event)\n\thost = event.get(\"[agent][name]\")\n \tfilename = event.get(\"[file][name]\")\n\tfile_path = event.get(\"[file][directory_local]\")\n\tfile_patharray = file_path.split(/\\/([^\\/]*)$/)\n\tfile_id = file_patharray[-1]\n\tdownloadsurl = \"/c2logs/\" + \"#{host}\" + \"/cobaltstrike/downloads/\" + \"#{file_id}\" + \"_\" + \"#{filename}\"\n\tevent.tag(\"_rubyparseok\")\n \tevent.set(\"[file][url]\", downloadsurl)\n\treturn [event]\nend", "def process_download(options = {})\n @download = Download.process(self, options)\n end", "def get_downloaded_filename\n get_download_filename\n end", "def file_url(context, inline, generate_event = true)\n if challenge_file?\n token = CHALLENGE_BOT_TOKEN\n result = DNAnexusAPI.new(CHALLENGE_BOT_TOKEN).call(\n \"system\",\n \"describeDataObjects\",\n objects: [dxid],\n )[\"results\"][0]\n project = result[\"describe\"][\"project\"]\n else\n token = context.token\n project = self.project\n end\n\n opts = {\n project: project,\n preauthenticated: true,\n filename: name,\n duration: 86_400,\n }\n inline_attribute = inline.present? ? \"?inline\" : \"\"\n\n api = DNAnexusAPI.new(token)\n url = api.file_download(dxid, opts)[\"url\"] + inline_attribute\n Event::FileDownloaded.create_for(self, context.user) if generate_event\n\n url\n end", "def download(key, &block)\n if block_given?\n instrument :streaming_download, key: key do\n stream(key, &block)\n end\n else\n instrument :download, key: key do\n File.binread file_for(key)\n end\n end\n end", "def download_file(agent, url)\n SouvlakiRS.logger.info \" starting download for #{url}\"\n\n data = agent.get(url)\n unless data\n SouvlakiRS.logger.error ' download failed'\n return nil\n end\n\n filename = get_response_filename(data) || filename_from_url(url)\n [data, filename]\n end", "def download_single(content_blob)\n @content_blob = content_blob\n\n respond_to do |format|\n format.html { handle_download(params[:disposition] || 'attachment') }\n end\n end", "def file_finished(file, offenses); end", "def file_download\n blob_cache(:file_download) do\n raw_download = tiddlywiki_file.download\n is_compressed? ? SiteCommon.decompress_html(raw_download) : raw_download\n end\n end", "def download_note_collection\n collection = Collection.find(params[:id])\n authorize! :download_note_collection, collection\n upload = Upload.find(params[:upload_id])\n \n send_file upload.upfile.path, \n :filename => upload.upfile_file_name, \n :type => 'application/octet-stream'\n end", "def download\n storage.download(id)\n end", "def download_files files,dest,opts = {}\n unless @started\n Logger.<<(__FILE__,\"ERROR\",\"FileManager is not started yet !\")\n abort\n end\n str = \"Will download #{files.size} files to #{dest} ... \"\n download_all_files files,dest\n str += \" Done !\"\n Logger.<<(__FILE__,\"INFO\",str) if opts[:v]\n end", "def download\n @paystub = Paystub.find( params[:id] )\n\n if File.exists?(@paystub.filespec)\n send_file @paystub.filespec,\n\t filename: @paystub.filename,\n type: \"application/pdf\",\n disposition: :attachment\n else\n flash.now[:danger] = \"File #{@paystub.filename} was not found - regenerating\" \n redirect_to export_paystub_path(@paystub)\n end\n end", "def download(\n file_path\n )\n @call_params[:file_path] = file_path\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def download_file(link, basename)\n link.click\n sleep(3)\n if @driver.current_url.include?('https://storage.googleapis.com/')\n assert @driver.current_url =~ /#{basename}/, \"Downloaded file url incorrect, did not find #{basename}\"\n @driver.navigate.back\n else\n # give browser 5 seconds to initiate download\n sleep(5)\n # make sure file was actually downloaded\n file_exists = Dir.entries($download_dir).select {|f| f =~ /#{basename}/}.size >= 1 || File.exist?(File.join($download_dir, basename))\n assert file_exists, \"did not find downloaded file: #{basename} in #{Dir.entries($download_dir).join(', ')}\"\n\n # delete matching files\n Dir.glob(\"#{$download_dir}/*\").select {|f| /#{basename}/.match(f)}.map {|f| File.delete(f)}\n end\n end", "def download!\n\t\traise_if_error C.glyr_opt_download(to_native, true)\n\tend", "def download(download_dir)\n @downloaded_file = File.join(download_dir,\"meddra_adverse_effects.tsv.gz\")\n \n @log.info \"Downloading from SIDER to #{@downloaded_file}\" if @log\n system(\"curl -o #{@downloaded_file} -i ftp://sideeffects.embl.de/SIDER/latest/meddra_adverse_effects.tsv.gz\")\n system(\"gunzip #{@downloaded_file}\")\n \n @file = File.join(download_dir,\"meddra_adverse_effects.tsv\")\n end", "def download\n Delayed::Job.enqueue(ExportJob.new(current_account))\n flash[:success] = _('Give us some time then check your email.')\n redirect_to export_pages_path\n end", "def on_file(&block)\n @on_file = block\n end", "def download_origin\n send_data(@document.original_file, type: @document.data_type, filename: @document.name)\n end", "def set_filedownload\n @filedownload = Filedownload.find(params[:id])\n end", "def report_file1_download(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id, \"v1\" => \"true\" } \r\n\t\tfile=nessus_http_request('file/report/download', post)\r\n\t\treturn file\r\n\tend", "def download\n res = @stash_identifier.last_submitted_resource\n if res&.download_uri\n res = @stash_identifier.last_submitted_resource\n StashEngine::CounterLogger.version_download_hit(request: request, resource: res) if res\n redirect_to res.merritt_producer_download_uri # latest version, friendly download because that's what we do in UI for object\n else\n render text: 'download for this dataset is unavailable', status: 404\n end\n end", "def download(full_spec, path) # :nodoc:\n end", "def download_s3_file\n run_callbacks :download_s3_file do\n @s3_local_object = download(@directory, @key)\n end\n end", "def download(url, filename)\n require 'open-uri'\n if File.exists?(\"lib/\" + filename)\n puts \"'#{filename}' is already downloaded... skipped\"\n else\n puts \"'#{filename}' downloading...\"\n File.open(\"lib/\" + filename, \"wb\") do |saved_file|\n open(url + filename, \"rb\") { |read_file| saved_file.write(read_file.read) }\n end\n end\nend", "def download_fct(target,\n url_to_download,\n count,\n total)\n Log.log_debug('Into download_fct (target=' + target +\n ') url_to_download=' + url_to_download +\n ' count=' + count.to_s +\n ' total=' + total.to_s)\n\n downloaded_filenames = {}\n unless %r{^(?<protocol>.*?)://(?<srv>.*?)/(?<dir>.*)/(?<name>.*)$} =~ url_to_download\n raise URLNotMatch \"link: #{url_to_download}\"\n end\n #\n common_efixes_dirname = get_flrtvc_name(:common_efixes)\n temp_dir = get_flrtvc_name(:temp_dir)\n tar_dir = get_flrtvc_name(:tar_dir)\n #\n if name.empty?\n #############################################\n # URL ends with /, look into that directory #\n #############################################\n case protocol\n when 'http', 'https'\n begin\n uri = URI(url_to_download)\n http = Net::HTTP.new(uri.host, uri.port)\n http.read_timeout = 10\n http.open_timeout = 10\n http.use_ssl = true if protocol.eql?('https')\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE if protocol.eql?('https')\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n subcount = 0\n if response.is_a?(Net::HTTPResponse)\n b_download = 0\n response.body.each_line do |response_line|\n next unless response_line =~ %r{<a href=\"(.*?.epkg.Z)\">(.*?.epkg.Z)</a>}\n url_of_file_to_download = ::File.join(url_to_download, Regexp.last_match(1))\n local_path_of_file_to_download = \\\n ::File.join(common_efixes_dirname, Regexp.last_match(1))\n Log.log_debug('Consider downloading ' +\n url_of_file_to_download +\n ' into ' +\n common_efixes_dirname +\n ':' + count.to_s + '/' + total.to_s + ' fixes.')\n if !::File.exist?(local_path_of_file_to_download)\n # Download file\n Log.log_info('Downloading ' + url_of_file_to_download.to_s +\n ' into ' + common_efixes_dirname.to_s +\n ' and keeping into ' + local_path_of_file_to_download.to_s +\n ':' + count.to_s + '/' + total.to_s + ' fixes.')\n b_download = download(target,\n url_of_file_to_download,\n local_path_of_file_to_download,\n protocol)\n else\n Log.log_debug('Not downloading ' + url_of_file_to_download.to_s +\n ' : already into ' + local_path_of_file_to_download.to_s +\n ':' + count.to_s + '/' + total.to_s + ' fixes.')\n b_download = 0\n end\n downloaded_filenames[::File.basename(local_path_of_file_to_download)] = b_download\n subcount += 1\n end\n Log.log_debug('Into download_fct (target=' +\n target +\n ') http/https url_to_download=' +\n url_to_download +\n ', subcount=' +\n subcount.to_s)\n end\n rescue Timeout::Error => error\n Log.log_err(\"Timeout sending event to server: #{error}\")\n raise 'timeout error'\n end\n when 'ftp'\n #\n ftp_download_result = ftp_download(target,\n url_to_download,\n count,\n total,\n srv,\n dir,\n common_efixes_dirname)\n Log.log_debug('After download_fct name.empty ftp')\n downloaded_filenames.merge(ftp_download_result)\n else\n raise \"protocol must be either 'http', 'https', ftp'\"\n end\n elsif name.end_with?('.tar')\n #####################\n # URL is a tar file #\n #####################\n local_path_of_file_to_download = ::File.join(tar_dir, name)\n Log.log_debug('Consider downloading ' +\n url_to_download +\n ' into ' +\n tar_dir +\n \" : #{count}/#{total} fixes.\")\n if !::File.exist?(local_path_of_file_to_download)\n # download file\n Log.log_info(\"Downloading #{url_to_download} \\\ninto #{tar_dir}: #{count}/#{total} fixes.\")\n b_download = download(target,\n url_to_download,\n local_path_of_file_to_download,\n protocol)\n #\n if b_download == 1\n # We untar only if the tar file does not yet exist.\n # We consider that if tar file already exists,\n # then it has been already untarred.\n Log.log_debug(\"Untarring #{local_path_of_file_to_download} \\\ninto #{temp_dir} : #{count}/#{total} fixes.\")\n untarred_files = untar(local_path_of_file_to_download, temp_dir)\n # Log.log_debug(\"untarred_files = \" + untarred_files.to_s)\n #\n subcount = 1\n Log.log_debug('Copying ' + untarred_files.to_s + \\\n' into ' + common_efixes_dirname)\n untarred_files.each do |filename|\n # Log.log_debug(\" copying filename \" + filename\n # +\": #{count}.#{subcount}/#{total} fixes.\")\n FileUtils.cp(filename, common_efixes_dirname)\n downloaded_filenames[::File.basename(filename)] = b_download\n subcount += 1\n end\n elsif b_download == 0\n Log.log_debug(\"Not downloading #{url_to_download} : already \\\ninto #{tar_dir}: #{count}/#{total} fixes.\")\n tarfiles = tar_tf(local_path_of_file_to_download)\n tarfiles.each { |x| downloaded_filenames[::File.basename(x)] = 0 }\n else\n Log.log_err(\"Error while downloading #{url_to_download} \\\ninto #{tar_dir}: #{count}/#{total} fixes.\")\n downloaded_filenames[url_to_download] = -1\n end\n else\n Log.log_debug(\"Already downloaded : not downloading #{url_to_download} \\\ninto #{tar_dir}: #{count}/#{total} fixes.\")\n tarfiles = tar_tf(local_path_of_file_to_download)\n tarfiles.each { |x| downloaded_filenames[::File.basename(x)] = 0 }\n end\n elsif name.end_with?('.epkg.Z')\n #######################\n # URL is an efix file #\n #######################\n local_path_of_file_to_download =\n ::File.join(common_efixes_dirname, ::File.basename(name))\n Log.log_debug('Consider downloading ' +\n url_to_download +\n ' into ' +\n local_path_of_file_to_download +\n \" : #{count}/#{total} fixes.\")\n if !::File.exist?(local_path_of_file_to_download)\n # download file\n Log.log_info(\"Downloading #{url_to_download} \\\ninto #{local_path_of_file_to_download} : #{count}/#{total} fixes.\")\n b_download = download(target,\n url_to_download,\n local_path_of_file_to_download,\n protocol)\n else\n Log.log_debug(\"Not downloading #{url_to_download} : already into \\\n #{local_path_of_file_to_download} \\\n: #{count}/#{total} fixes.\")\n b_download = 0\n end\n downloaded_filenames[::File.basename(local_path_of_file_to_download)] = b_download\n end\n #\n Log.log_info('Into download_fct returning ' +\n downloaded_filenames.to_s)\n downloaded_filenames\n end", "def download(server, id)\n make_request(\n :get,\n \"/download/#{server}/#{id}\",\n headers: { 'Accept' => '*/*' },\n base: @media_uri\n )\n end", "def download!\n return download if file.nil?\n\n file.close\n file.unlink\n self.file = nil\n download\n end", "def call\n @response = connection.get(url)\n if status == 200\n context.file = save!\n else\n context.fail! message: \"Download failed\"\n end\n end", "def download(download_path)\n Downloader.download(@video_url, download_path)\n @downloaded = true\n end", "def download_document\n doc_name = Event::Document::MAPPING[params[:name].to_sym]\n pdf = File.new(\"public/documents/#{doc_name}\")\n pdf_data = File.read(pdf.path)\n begin\n send_data(pdf_data, type: 'application/pdf', filename: doc_name)\n ensure\n pdf.close\n end\n end", "def start_download(name, folder_name, url, &blk)\n puts pretty_console_block(\"\\n\\ndownloading #{name}\\n\\n\")\n begin\n blk.call(name, folder_name, url)\n begin\n give_metadata(name, folder_name, url)\n rescue Exception => e\n puts pretty_console_block(\"error setting metadata for #{name}\")\n end\n rescue Exception => e\n handle_download_error(name, folder_name, url, e)\n end\n end", "def handle_download_result success\n self.downloading = false\n self.pid = nil\n \n if success\n self.failed = false\n self.downloaded = true\n self.downloaded_at = DateTime.now\n else\n self.failed = true\n end \n \n self.save!\n return success\n end", "def download_remote_log(_local_log_path)\n # override and do something appropriate\n end", "def download_file(uri, dest_dir)\n begin\n u = URI.parse(uri)\n fname, ext = File.basename(u.path).scan(/(.+)\\.(.+)/).flatten\n dest_file = File.join(dest_dir, \"#{fname}_#{Time.now.to_i}.#{ext}\")\n res = send_http_get_request(uri)\n rescue Net::ReadTimeout, IOError, EOFError, Errno::ECONNRESET,\n Errno::ECONNABORTED, Errno::EPIPE, Net::OpenTimeout,\n Errno::ETIMEDOUT => e\n print_error(\"#{e.message}: #{uri}\")\n return\n end\n\n save_file(res.body, dest_file)\n print_status(\"Download completed for #{uri}\")\n end", "def download(id, filename)\n open(filename, \"w\").write(@res[\"/download?id=#{id}\"].get)\n return filename\n rescue\n puts $!\n return nil\n end", "def add_download(user: nil)\n self.events.build(event_type: Event::Type::DOWNLOAD,\n description: \"Download\",\n happened_at: Time.now,\n user: user).save!\n owning_ids = self.item.owning_ids\n institution_id = owning_ids['institution_id']\n unit_id = owning_ids['unit_id']\n collection_id = owning_ids['collection_id']\n return unless institution_id && unit_id && collection_id\n MonthlyItemDownloadCount.increment(self.item)\n MonthlyCollectionItemDownloadCount.increment(collection_id)\n MonthlyUnitItemDownloadCount.increment(unit_id)\n MonthlyInstitutionItemDownloadCount.increment(institution_id)\n end", "def download\n @queja = Queja.find(params[:id])\n send_file(@queja.evidencia.path)\n end", "def download_raw\n document = Document.find(params[:id])\n authorize! :download_raw, document\n \n begin\n upload = Upload.find( document.stuffing_upload_id )\n rescue ActiveRecord::RecordNotFound => e\n puts \"### ERROR: \" + e.message\n redirect_to show_data_path(document), notice: \"ERROR: file (upload) ID not found. Upload may have been deleted\"\n return\n end\n \n send_file upload.upfile.path, \n :filename => upload.upfile_file_name, \n :type => 'application/octet-stream'\n end", "def download(url)\n base.get(url, @file_path)\n end", "def download!(file)\n login\n warn \"DEBUG: downloading #{file}\" if debug\n if dry_run\n warn \"DEBUG: download skipped for dry run\" if dry_run\n filename = file\n body = \"no body\"\n else\n page = agent.get(file)\n filename = page.filename\n body = page.body\n end\n [ filename, body ]\n end", "def send_download_ext_notice\n UserMailer.send_download_ext_notice(self).deliver_now\n end", "def download\n get_metadata\n check_prog_id\n generate_filename\n download_stream\n ffmpeg\n tag\n cleanup\n end", "def download\n\n session[:current_folder] = params[:folder]\n mixpanel_tab_event(\"My Vault\", \"Download File\")\n download_url = Rails.cache.fetch(\"/download_url/#{params[:id]}\", :expires_in => 10.minutes) do\n user_client.download_url(params[:id])\n end\n redirect_to download_url\n end", "def show\n if @event_import_file.event_import.path\n unless Setting.uploaded_file.storage == :s3\n file = @event_import_file.event_import.path\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event_import_file }\n format.download {\n if Setting.uploaded_file.storage == :s3\n redirect_to @event_import_file.event_import.expiring_url(10)\n else\n send_file file, :filename => @event_import_file.event_import_file_name, :type => 'application/octet-stream'\n end\n }\n end\n end", "def download_url(**opt)\n opt[:expires_in] ||= ONE_TIME_USE_EXPIRATION\n attached_file&.url(**opt)\n end", "def run\n ## self.download_events\n files = prepare_files\n events = parse_events(files)\n save_events(events)\n end", "def download_url(filename)\n url(response_content_disposition: %Q{attachment; filename=\"#{filename}\"})\n end", "def show\n @filedownload = @fileupload.filedownload\n @new_file_download = false\n if (!@filedownload)\n @filedownload = Filedownload.new\n @new_file_download = true\n end\n end", "def download_manual \n file = Dir.glob(\"#{Rails.root}/public/s2c_tutorial.pdf\")[0].to_s\n logger.debug file\n send_file(file)\n end", "def download\n super\n rescue\n info \"Failed to download #{to_spec}. Skipping it.\"\n end", "def force_download(path, token, method)\n download_folder = ::File.join(Dir.pwd, path.to_s, @file_name.to_s)\n auth_section = (token.to_s == \"\" ? \"\" : \"/a/#{token}\")\n download_url = \"#{Nsrr::WEBSITE}/datasets/#{@dataset_slug}/files#{auth_section}/m/nsrr-gem-v#{Nsrr::VERSION::STRING.gsub(\".\", \"-\")}/#{@full_path.to_s}\"\n download_request = Nsrr::Helpers::DownloadRequest.new(download_url, download_folder)\n download_request.get\n download_success = false\n if download_request.error.to_s == \"\"\n # Check to see if the file downloaded correctly\n # If the file size does not match, attempt one additional download\n download_success = did_download_succeed?(method, path)\n unless download_success\n download_request = Nsrr::Helpers::DownloadRequest.new(download_url, download_folder)\n download_request.get\n download_success = did_download_succeed?(method, path)\n end\n end\n if download_request.error.to_s == \"\" and download_success\n puts \" downloaded\".green + \" #{@file_name}\"\n download_request.file_size\n elsif download_request.error.to_s == \"\"\n puts \" failed\".red + \" #{@file_name}\"\n if method == \"fast\"\n puts \" File size mismatch, expected: #{@file_size}\"\n puts \" actual: #{@latest_file_size}\"\n else\n puts \" File checksum mismatch, expected: #{@file_checksum_md5}\"\n puts \" actual: #{@latest_checksum}\"\n end\n ::File.delete(download_folder) if ::File.exist?(download_folder)\n \"fail\"\n else\n puts \" failed\".red + \" #{@file_name}\"\n puts \" #{download_request.error}\"\n \"fail\"\n end\n end" ]
[ "0.7068658", "0.70125014", "0.63595754", "0.63029325", "0.6174101", "0.6172651", "0.6141766", "0.6137337", "0.6131357", "0.611393", "0.6088467", "0.6082635", "0.60814774", "0.6080848", "0.6064295", "0.6060903", "0.60247785", "0.60225695", "0.6020604", "0.5992105", "0.59849256", "0.5940255", "0.592423", "0.591922", "0.5909735", "0.5909373", "0.5901173", "0.5885817", "0.58527434", "0.5842786", "0.5838774", "0.583831", "0.5803573", "0.5801985", "0.5776155", "0.5775081", "0.5770275", "0.5766392", "0.5751771", "0.5728975", "0.57287925", "0.57228744", "0.57131857", "0.5701597", "0.5701265", "0.5678004", "0.5675905", "0.5674316", "0.5671799", "0.5660291", "0.56553775", "0.56475157", "0.56456023", "0.56359977", "0.56346875", "0.56278", "0.5624186", "0.56231767", "0.56135356", "0.56066054", "0.5603089", "0.5599273", "0.5596452", "0.55863327", "0.5577516", "0.5566743", "0.5564073", "0.55613786", "0.55585176", "0.5535442", "0.5512769", "0.54995567", "0.54944277", "0.5490785", "0.5488767", "0.54873693", "0.5486898", "0.5476238", "0.5473157", "0.5467747", "0.5455575", "0.54550457", "0.544782", "0.5444005", "0.5442997", "0.5442269", "0.5437854", "0.54284656", "0.54249585", "0.5414751", "0.541229", "0.5410636", "0.5400734", "0.53990215", "0.5397036", "0.5396785", "0.5388938", "0.53801346", "0.5376848", "0.53706753" ]
0.7996708
0
get an aggregate count of work views
def get_work_view_count( work ) return WorkViewStat.where( 'work_id = ?', work.id ).sum( :work_views ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_views_count\n self.visits.count.to_i\n end", "def visible_work_count\n Work.owned_by(self).visible(skip_ownership = true).count(:distinct => true, :select => 'works.id') \n end", "def count(view = :all, *args, &block)\n if view == :all\n return super({}, *args) \n end\n \n if has_view?(view)\n query = args.shift || {}\n result = view(view, {:reduce => true}.merge(query), *args, &block)['rows']\n \n return result.first['value'] unless result.empty?\n end\n 0\n end", "def count\n raise \"View#count cannot be used with group options\" if query[:group]\n if can_reduce?\n row = reduce.skip(0).limit(1).rows.first\n row.nil? ? 0 : row.value\n else\n limit(0).total_rows\n end\n end", "def cool_view_count\n view_count\n end", "def count_view(options)\n search_fields = search_fields(options)\n \n if database.version > 0.8\n view_name = get_view_name(search_fields)\n else\n view_name = get_view_name(search_fields, \"count\")\n end\n \n options[:return_json] = true\n result = generic_view(view_name, find_by_function(search_fields), count_documents_function, options)\n \n result['rows'].first['value'] rescue 0\n end", "def views_count\n self.views_count_cache || self.views_count_cache = self.calculate_views_count\n end", "def count(opts = {})\n view = opts[:view] || @opts[:view]\n client.view(view,\n limit: 0,\n include_docs: false,\n stream: true).total_rows\n end", "def visible_works_count\n self.works.select{|w| w.visible?(User.current_user)}.uniq.size\n end", "def project_counts\n @project_counts ||= Kithe::Model.joins(:contains_contained_by).\n where(published: true, contains_contained_by: {container_id: project_list.collect(&:id) }).\n group(:container_id).\n count\n end", "def number_of_works_realised_through(login=nil)\n count_by_frbr(login, :is_realisation_of, :how_many_works?) \n end", "def get_work_aggregate_size( work )\n return 0 if work.filesets.blank?\n sum = 0\n work.filesets.each { |fs|\n sum += fs.file_size\n }\n return sum\n end", "def index\n @view_counts = ViewCount.all\n end", "def summate_activity_counts\n activity_count = 0\n all_user_projects_subscriptions.find_each do |subscription|\n next if subscription.empty_summary?\n if count = subscription.summary.values.first[:count].to_i\n activity_count += count\n end\n end\n activity_count\n end", "def get_work_download_count( work )\n return 0 if work.filesets.blank?\n sum = 0\n work.filesets.each { |fs|\n sum += get_file_download_count( fs.id )\n }\n return sum\n end", "def visible_works_count\n if User.current_user && User.current_user.kind_of?(Admin)\n self.works.count(:all,\n :conditions => {:posted => true})\n elsif User.current_user.is_a? User\n self.works.visible_to_user(User.current_user.id).size\n else\n self.works.count(:all,\n :conditions => {:posted => true, :restricted => false, :hidden_by_admin => false})\n end\n end", "def total_tasks\n tasks.count\n end", "def workflow_counts\n render json: {\n exposure: current_user.viewable_patients.where(isolation: false, purged: false).size,\n isolation: current_user.viewable_patients.where(isolation: true, purged: false).size\n }\n end", "def workflow_counts\n render json: {\n exposure: current_user.viewable_patients.where(isolation: false, purged: false).size,\n isolation: current_user.viewable_patients.where(isolation: true, purged: false).size\n }\n end", "def number_of_commissioned_works(login=nil)\n count_by_frbr(login, :has_commissioned, :how_many_works?) \n end", "def total_workouts\n set_sport_by_user.count || 0\n end", "def count\n run.count\n end", "def total_views_per_file_path\n iterate_over_file_paths.group_by { |x| x }.map { |k, v| [k, v.count] }\n end", "def total_unique_views_per_file_path\n iterate_unique_views.group_by { |x| x }.map { |k, v| [k, v.count] }\n end", "def view_count_of_videos\n self.view_count\n end", "def counters\n return {} if object.guest?\n\n {\n files: files_private_count,\n folders: folders_private_count,\n apps: apps_private_count,\n workflows: workflows_count,\n jobs: jobs_count,\n assets: assets_count,\n notes: notes_count,\n }\n end", "def counts\r\n @counts\r\n end", "def view_count\n internal_video.view_count\n end", "def task_count()\n @tasks.size\n end", "def counters\n {\n files: files_count,\n apps: apps_count,\n workflows: workflows_count,\n jobs: jobs_count,\n members: members_count,\n }\n end", "def views\n impressionist_count(:filter => :session_hash)\n end", "def tasks_total_count\n tasks.length\n end", "def total_task_lists_count\n task_lists.count\n end", "def recalculate_activity\n activity = Task.recent_count(self.id)\n activity += ClientRequest.recent_count(self.milestones)\n activity += Message.recent_count(self)\n # TODO Count recent timesheet entries\n return activity\n end", "def count\n size = 0\n core_search.group(\"name.id, #{main_group_by_columns}\").each do |_x|\n size += 1\n end\n size\n end", "def count\n # nil is for seq_op => it means the all result go directly to one worker for combine\n @count ||= self.map_partitions('lambda{|iterator| iterator.to_a.size }')\n .aggregate(0, nil, 'lambda{|sum, item| sum + item }')\n end", "def total_activity_count\n return self.timeline_events.find(:all, :conditions => {:event_type => \"document_item_changed\"}).length + \n self.questions.count +\n self.questions.answered.count\n end", "def count(extra_conditions = nil)\n user.company.tasks.count(:conditions => conditions(extra_conditions),\n :include => to_include)\n end", "def count\n @collector.count\n end", "def aggregate(query)\n #query.model.last_query = query\n #y query\n _layout = layout(query.model)\n opts = query.fmp_options\n #opts[:template] = self.class.fmresultset_template_path\n prms = query.to_fmp_query\n #[prms.empty? ? _layout.all(:max_records=>0).foundset_count : _layout.count(prms)]\n [prms.empty? ? _layout.view.total_count : _layout.count(prms)]\n end", "def total_tasks_count\n return @total_tasks_count\n end", "def agg_count\n @agg_count ||= count_unique_related @role_aggregate.agg_fieldname\n end", "def number_of_parent_work(login=nil)\n count_by_frbr(login, :is_part_of, :how_many_works?) \n end", "def test_count\n @tests.count\n end", "def operation_count\n \toperations.count\n end", "def count\n ensure_aggregate!\n SQLite::API.aggregate_count( @func )\n end", "def count(grp)\n @counts[grp] || 0\n end", "def projects_count\n ProjectDetail.all.count\n end", "def resource_count_stats\n klass = klass_from_controller(controller_name)\n full_total = klass.count\n visible_total = if klass.authorization_supported?\n klass.all_authorized_for('view').count\n elsif klass.is_a?(Person) && Seek::Config.is_virtualliver && User.current_user.nil?\n 0\n else\n klass.count\n end\n [visible_total, full_total]\n end", "def total_number_basic_tasks\n total=0\n @sub_tasks.each { |task| total += task.total_number_basic_tasks }\n total \n end", "def issue_count\n issue_count = 0\n self.sections.each { | section| issue_count += section.issue_count }\n issue_count\n end", "def get_all_viewcounts(start_date, end_date)\n view_counts = Viewcount.where(created_at: start_date..end_date).count\n formatted_vc = Array.new\n formatted_vc.push end_date.to_f * 1000\n formatted_vc.push view_counts\n formatted_vc\n end", "def num_of_visits\n self.visits.size\n end", "def count\n Project.count\n end", "def increment_view_count\n gentle_increment_count(:view_count)\n end", "def count\n end", "def count\n end", "def number_of_superwork_evidences(login=nil)\n count_by_frbr(login, :is_evidence_of, :how_many_superworks?) \n end", "def total_complete\n tasks.select { |task| task.complete? }.count\n end", "def calculate_visits_count\n self.visits.count(:conditions => {:unique => true}).to_i\n end", "def count\n @collection.count(Scope.new(@collection, @selector, @opts))\n end", "def total_participation\n self.arguments.published.size + self.votes_count\n end", "def count_results\n team = Team.find_by_id( params[:id] )\n if team\n render( json: ( team.meeting_individual_results.count + team.meeting_relay_results.count ) )\n else\n render( json: 0 )\n end\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n collection.count\n end", "def index\n @estadisticas = Estadistica.all\n @referers = Usuario.collection.aggregate \"$group\" => { _id: \"$referer\", count: { \"$sum\" => 1}}\n @landings = Usuario.collection.aggregate \"$group\" => { _id: \"$landing\", count: { \"$sum\" => 1}}\n end", "def estimated_document_count(options = {})\n View.new(self, {}, options).estimated_document_count(options)\n end", "def count\n filtered = apply_criteria(@data)\n filtered.count\n end", "def results_count(query)\n refresh_elasticsearch\n Opportunity.__elasticsearch__.search(query: query[:query],\n sort: query[:sort]).\n results.count\n end", "def count\n load\n @result_count\n end", "def tasks_total_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_total_count\n end\n end", "def tasks_total_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_total_count\n end\n end", "def total_count\n @all.size\n end", "def count\n @count\n end", "def total\n count = 0\n self.total_time_exercise_workouts.each do |ex|\n count += ex.duration\n end\n count\n end", "def item_count\n @collection.count\n end", "def get_all_uploaded_documents_count\n client = @current_advisor.clients_as_advisor.find_by(id: @client_id)\n if client.consumer_id\n Document.where(:consumer_id => client.consumer_id).count\n else\n client.document_ownerships.count\n end\n end", "def test_case_count\n scenario_count + outlines.reduce(0) { |outline_sum, outline|\n outline_sum += outline.examples.reduce(0) { |example_sum, example|\n example_sum += example.rows.count\n }\n }\n end", "def visitors_count\n self.visitors.count\n end", "def number_of_nodes_edited_by_new_mappers\n \t\tnodes_by_new_mappers = Node_Query.new(analysis_window: aw, constraints: {'user' => {'$in' => aw.new_contributors}}).run\n {'Nodes Edited by New Mappers' => nodes_by_new_mappers.first[:objects].length }\n \tend", "def number_of_nodes_edited_by_new_mappers\n \t\tnodes_by_new_mappers = Node_Query.new(analysis_window: aw, constraints: {'user' => {'$in' => aw.new_contributors}}).run\n {'Nodes Edited by New Mappers' => nodes_by_new_mappers.first[:objects].length }\n \tend", "def number_of_documents_from_caseflow\n count = Document.where(file_number: veteran_file_number).size\n (count != 0) ? count : number_of_documents\n end", "def task_count_instances\n #ex_count = find_exception_count\n if self.occurrence_type.eql?(\"count\")\n count = self.count.to_i\n return count\n elsif self.occurrence_type.eql?(\"until\")\n if self.start_date and self.until\n case(self.repeat)\n when \"DAI\" then daily_count\n when \"WEE\" then weekly_count\n when \"MON\" then monthly_count\n when \"YEA\" then yearly_count\n end\n end\n else\n 1 \n end\n end", "def number_of_work_influences(login=nil)\n count_by_frbr(login, :is_influenced_by, :how_many_works?) \n end", "def count; end", "def count; end", "def count; end", "def display_by_views\n count_unique_views\n count_total_views\n\n sort_views(@unique_views_hash, 'unique views')\n sort_views(@total_views_hash, 'total views')\n end", "def submission_count\n if current_course_user&.manager_or_owner?\n my_students_pending_submissions_count > 0 ? my_students_pending_submissions_count : pending_submissions_count\n elsif current_course_user&.staff?\n my_students_pending_submissions_count\n else\n 0\n end\n end", "def clickCount()\n @view__.clickCount\n end", "def records_total_count\n fetch_records.unscope(:group, :select).count(:all)\n end", "def total_entries\n collection.total_count\n end", "def meeting_count\n Meeting.visible.count(:include => [:project], :conditions => statement)\n rescue ::ActiveRecord::StatementInvalid => e\n raise StatementInvalid.new(e.message)\n end", "def count_results\n # TODO respond with xml, only if valid session, otherwise return nil\n team = Team.find_by_id( params[:id] )\n if team\n render json: ( team.meeting_individual_results.count + team.meeting_relay_results.count )\n else\n render json: 0\n end\n end", "def count\n all.count\n end", "def find_res_count\n res_count = 0\n self.listings.each do |listing|\n res_count += listing.reservations.where(:status => \"accepted\").count\n end\n return res_count\n end", "def total_unprocessed_tasks_count\n return @total_unprocessed_tasks_count\n end", "def get_collections_count()\n uri = build_uri('info/collection_counts')\n @tools.process_get_request(uri, @user_obj.encrypted_login, @user_pwd).body\n end" ]
[ "0.6948625", "0.6819293", "0.6630215", "0.658277", "0.6579473", "0.6553843", "0.6486918", "0.6482332", "0.6368392", "0.63379544", "0.6327346", "0.6314404", "0.62535584", "0.62523395", "0.6233465", "0.6225921", "0.61944914", "0.6192755", "0.6192755", "0.618442", "0.61436504", "0.6142881", "0.61421657", "0.613244", "0.61212796", "0.6082054", "0.60534865", "0.604581", "0.60453624", "0.6024097", "0.6019677", "0.5979287", "0.59641486", "0.5962805", "0.59588826", "0.5937476", "0.5933327", "0.5917749", "0.5912299", "0.58914673", "0.5887367", "0.58719033", "0.5862146", "0.5856789", "0.58466357", "0.58319014", "0.58229595", "0.5817596", "0.5804186", "0.57977617", "0.57897913", "0.57799685", "0.57791626", "0.57696074", "0.5763922", "0.57612234", "0.57612234", "0.5745143", "0.5741165", "0.57295215", "0.57225484", "0.5719982", "0.5717243", "0.57172006", "0.57172006", "0.57172006", "0.57123685", "0.5705135", "0.57022923", "0.5698106", "0.5695276", "0.56933904", "0.56898105", "0.56898105", "0.568926", "0.56865287", "0.56830746", "0.567822", "0.5676651", "0.5674682", "0.56713426", "0.5668428", "0.5668428", "0.5665813", "0.56654763", "0.5662524", "0.5659297", "0.5659297", "0.5659297", "0.56546015", "0.56540716", "0.5653058", "0.56520164", "0.5644082", "0.56412125", "0.5641108", "0.56359565", "0.56322193", "0.56305695", "0.56303453" ]
0.8454733
0
get an aggregate count of work downloads
def get_work_download_count( work ) return 0 if work.filesets.blank? sum = 0 work.filesets.each { |fs| sum += get_file_download_count( fs.id ) } return sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_download_count\n sum(:api_download_count) + sum(:web_download_count)\n end", "def download_count\n web_download_count + api_download_count\n end", "def downloads_count; AddonDownload.sum(:download_count, :addon_id => self.addon_id, :addon_version_id => self.id).to_i rescue 0; end", "def downloads_count; AddonDownload.sum(:download_count, :addon_id => self.id).to_i rescue 0; end", "def get_work_aggregate_size( work )\n return 0 if work.filesets.blank?\n sum = 0\n work.filesets.each { |fs|\n sum += fs.file_size\n }\n return sum\n end", "def get_work_view_count( work )\n return WorkViewStat.where( 'work_id = ?', work.id ).sum( :work_views )\n end", "def counters\n {\n files: files_count,\n apps: apps_count,\n workflows: workflows_count,\n jobs: jobs_count,\n members: members_count,\n }\n end", "def get_file_download_count( fileset_id )\n return FileDownloadStat.where( 'file_id = ?', fileset_id ).sum( :downloads )\n end", "def total_tasks\n tasks.count\n end", "def count\n @collector.count\n end", "def tasks_total_count\n tasks.length\n end", "def send_count\n repository.files.map do |file|\n content = repository.read(file)\n content.to_s.scan(/send/).size\n end.sum\n end", "def count\n # nil is for seq_op => it means the all result go directly to one worker for combine\n @count ||= self.map_partitions('lambda{|iterator| iterator.to_a.size }')\n .aggregate(0, nil, 'lambda{|sum, item| sum + item }')\n end", "def images_count\r\n images_count = 0\r\n jobs.each do |job|\r\n images_count += job.images_for_jobs.count\r\n end\r\n images_count\r\n end", "def count\n coverable_files.size\n end", "def count\n run.count\n end", "def total_task_lists_count\n task_lists.count\n end", "def count\n folder.data_objects.all(parameters).count\n end", "def total_file_count\n self.study_files.non_primary_data.count + self.primary_data_file_count\n end", "def summate_activity_counts\n activity_count = 0\n all_user_projects_subscriptions.find_each do |subscription|\n next if subscription.empty_summary?\n if count = subscription.summary.values.first[:count].to_i\n activity_count += count\n end\n end\n activity_count\n end", "def counters\n return {} if object.guest?\n\n {\n files: files_private_count,\n folders: folders_private_count,\n apps: apps_private_count,\n workflows: workflows_count,\n jobs: jobs_count,\n assets: assets_count,\n notes: notes_count,\n }\n end", "def user_song_uploads_total\r\n self.user_song_uploads.count\r\n end", "def queue_count()\n cnt = 0\n @tasks.each_value { |task| cnt += task.queue_count() }\n cnt\n end", "def count\n load\n @result_count\n end", "def num_files_total\n command_string = 'find '+@install_root+' | wc -l'\n inspec.bash(command_string).stdout.split(\"\\n\")[0].strip.to_i\n end", "def total_complete\n tasks.select { |task| task.complete? }.count\n end", "def task_count()\n @tasks.size\n end", "def complete_check_count\r\n check_number = []\r\n self.jobs.each do |job|\r\n if job.job_status = JobStatus::COMPLETED\r\n check_number << job.check_number\r\n end\r\n end\r\n check_number.uniq!\r\n if check_number.nil?\r\n return 0\r\n else\r\n return check_number.size\r\n end\r\n end", "def primary_data_file_count\n study_file_count = self.study_files.primary_data.size\n directory_listing_count = self.directory_listings.primary_data.map {|d| d.files.size}.reduce(0, :+)\n study_file_count + directory_listing_count\n end", "def total_check_count\r\n check_number = []\r\n self.jobs.each do |job|\r\n if job.parent_job_id.blank?\r\n check_number << job.check_number\r\n end\r\n end\r\n check_number.uniq!\r\n if check_number.nil?\r\n return 0\r\n else\r\n return check_number.size\r\n end\r\n end", "def number_of_commissioned_works(login=nil)\n count_by_frbr(login, :has_commissioned, :how_many_works?) \n end", "def total_count\n total_entries\n end", "def project_counts\n @project_counts ||= Kithe::Model.joins(:contains_contained_by).\n where(published: true, contains_contained_by: {container_id: project_list.collect(&:id) }).\n group(:container_id).\n count\n end", "def num_of_tickets()\n result = films()\n @number_of_tickets = result.count\n end", "def count_exports\n return @count_exports\n end", "def total_repo_count\n repositories.length\n end", "def doGetMaxCountPerRequest()\n end", "def get_job_count(type='scanner')\n job_count = 0\n framework.jobs.each do |k, j|\n if j.name =~ /#{type}/\n job_count = job_count + 1\n end\n end\n return job_count\n end", "def total_tasks_count\n return @total_tasks_count\n end", "def get_total_image_page_count\r\n total_page_count = 0\r\n images_for_jobs.each do |images_for_job|\r\n total_page_count += images_for_job.page_count.to_i\r\n end\r\n total_page_count\r\n end", "def total_number_basic_tasks\n total=0\n @sub_tasks.each { |task| total += task.total_number_basic_tasks }\n total \n end", "def counts\r\n @counts\r\n end", "def total_unprocessed_tasks_count\n return @total_unprocessed_tasks_count\n end", "def count()\n if @count == -1\n params = @params.clone\n params['count'] = 1\n\n res = @api.do_request(\"GET\", @path, params)\n @count = res['count'].to_i\n end\n @count\n end", "def tasks_progress\n total_done = 0\n total_tasks = 0\n self.stories.each do |story|\n story.issues.each do |issue|\n total_tasks += 1\n total_done += issue.done\n end\n end\n total_tasks > 0 ? total_done / total_tasks : 100\n end", "def count_documents\n size = 0\n @data.each_value do |documents|\n size += documents.size\n end\n\n size\n end", "def misc_directory_file_count\n self.directory_listings.non_primary_data.map {|d| d.files.size}.reduce(0, :+)\n end", "def count\n size = 0\n core_search.group(\"name.id, #{main_group_by_columns}\").each do |_x|\n size += 1\n end\n size\n end", "def count_exported\n return @count_exported\n end", "def execution_count\n flow_entry_count\n end", "def count\n @count\n end", "def visible_work_count\n Work.owned_by(self).visible(skip_ownership = true).count(:distinct => true, :select => 'works.id') \n end", "def file_count\n source_dir = Item.new(Path.new(params[:source]))\n type = params[:type]\n\n response = {}\n response[:source_dir] = source_dir\n file_count = source_dir.path.file_count(file_type: type)\n \n if file_count\n response[:msg] = \"Success\"\n response[:file_count] = file_count\n else\n response[:msg] = \"Fail\"\n end\n render json: response\n end", "def total_count\n fetch.json.[](:total_count)\n end", "def mailCount count_type=nil\n # Init the email count to start fresh every time this is called\n total_count = 0\n\n # Get the total count of emails in the Exchange inboxes\n exch_count = exchangeMailCount\n total_count += exch_count\n \n # Get the total count of emails in the IMAP inboxes\n imap_count = imapMailCount\n total_count += imap_count\n\n @email_count = total_count\n puts total_count\n growlNotify\n return @email_count.to_s\n end", "def get_all_uploaded_documents_count\n client = @current_advisor.clients_as_advisor.find_by(id: @client_id)\n if client.consumer_id\n Document.where(:consumer_id => client.consumer_id).count\n else\n client.document_ownerships.count\n end\n end", "def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n image_path = @image_folder.detect{|image_string| image_string.downcase == \"#{@image_path}/#{image.image_file_name}\".downcase}\n count += %x[identify #{image_path}].split(image.image_file_name).length-1 rescue nil #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end", "def total_count(queue)\n collection.find(conditions(queue)).count\n end", "def number_of_pages job\r\n count = 0\r\n pages = job.client_images_to_jobs.length\r\n if (@facility.image_type == 1) && (pages < 2)\r\n job.images_for_jobs.each do |image|\r\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\r\n count += %x[identify \"#{path}\"].split(image.filename).length-1 #command for retrieve number of pages in a tiff file (multi/single)\r\n end\r\n pages = count\r\n end\r\n pages\r\n end", "def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend", "def tasks_finished_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_finished_count\n end\n end", "def tasks_finished_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_finished_count\n end\n end", "def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\n count += %x[identify #{path}].split(image.filename).length-1 #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end", "def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\n count += %x[identify \"#{path}\"].split(image.filename).length-1 #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end", "def total_entries\n collection.total_count\n end", "def count\n dataset.count\n end", "def image_count\n working_article.images.length\n end", "def total\n count = 0\n self.total_time_exercise_workouts.each do |ex|\n count += ex.duration\n end\n count\n end", "def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/Parser/Images/#{image.filename}\").first\n count += %x[identify \"#{path}\"].split(image.filename).length-1 #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end", "def tasks_total_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_total_count\n end\n end", "def tasks_total_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_total_count\n end\n end", "def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\n count += %x[identify #{path}].split(image.filename).length-1 rescue nil #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end", "def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\n count += %x[identify #{path}].split(image.filename).length-1 rescue nil #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def total_upload_mass\n number_to_human_size(self.works.all.sum(:file_size))\n end", "def count()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Count::CountRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def count\n count = 0\n each do |data|\n count += 1\n end\n count\n end", "def get_file_count_from_response(response)\n response.values.map {|entry| entry[:total_files]}.reduce(&:+)\nend", "def songs_count\n value = 0\n packs.each do |pack|\n value += pack.songs.count\n end\n value += songs.count\n end", "def get_all_documents_count\n get_all_documents_ids.count\n end", "def get_DocumentCount()\n \t return @outputs[\"DocumentCount\"]\n \tend", "def recalculate_activity\n activity = Task.recent_count(self.id)\n activity += ClientRequest.recent_count(self.milestones)\n activity += Message.recent_count(self)\n # TODO Count recent timesheet entries\n return activity\n end", "def num_clicks\n count = 0\n self.visits.each { |user| count += user.visits }\n count\n end", "def total_entries\n @total_entries ||= load_count\n end", "def num_records\n num_urls + num_docs\n end", "def num_records\n num_urls + num_docs\n end", "def count; end", "def count; end", "def count; end", "def cron_job_count\n\n @cron_jobs.size\n end", "def pending_job_count\n\n @pending_jobs.size\n end", "def request_count; end", "def get_collections_count()\n uri = build_uri('info/collection_counts')\n @tools.process_get_request(uri, @user_obj.encrypted_login, @user_pwd).body\n end", "def processings\n @processings.size\n end", "def published_copy_count\n # published_copy_count_col may be nil so be careful\n respond_to?(:published_copy_count_col) ? (published_copy_count_col || 0).to_i : copies.find_all(&:published?).size\n end", "def retrieved_records\n results.count\n end", "def num_urls\n @client[URLS_COLLECTION].count\n end", "def total_count\n @all.size\n end" ]
[ "0.74356323", "0.72748256", "0.7244997", "0.71940744", "0.71314454", "0.6645008", "0.66007835", "0.6589589", "0.6516627", "0.64892775", "0.6459012", "0.6441779", "0.6420355", "0.6419459", "0.641944", "0.64016813", "0.6388988", "0.63854903", "0.63791233", "0.6341634", "0.63225365", "0.6287372", "0.6278698", "0.62779915", "0.6277303", "0.6276903", "0.62555206", "0.6227062", "0.61815953", "0.6178851", "0.61631143", "0.6158523", "0.6139808", "0.6136955", "0.61281097", "0.6116783", "0.60984606", "0.6096618", "0.60790724", "0.6076364", "0.60761", "0.6075736", "0.60706437", "0.60645866", "0.6057666", "0.6037818", "0.6034257", "0.60290205", "0.60270244", "0.6024715", "0.602446", "0.6018399", "0.60111535", "0.60071176", "0.5993993", "0.5978377", "0.5977462", "0.5964568", "0.5964009", "0.5959234", "0.59500545", "0.59500545", "0.5949383", "0.59483284", "0.59446263", "0.59430104", "0.59366417", "0.59357417", "0.5931132", "0.59261376", "0.59261376", "0.5917421", "0.5917421", "0.59152526", "0.59152526", "0.59152526", "0.5912651", "0.5912532", "0.5904323", "0.5896608", "0.589484", "0.5890654", "0.5888912", "0.5885431", "0.58829045", "0.58780766", "0.58770597", "0.58770597", "0.5875754", "0.5875754", "0.5875754", "0.5873929", "0.58696806", "0.5867675", "0.5866877", "0.5863953", "0.58616436", "0.5861616", "0.58608663", "0.5857923" ]
0.8286587
0
get an aggregate size of the work files
def get_work_aggregate_size( work ) return 0 if work.filesets.blank? sum = 0 work.filesets.each { |fs| sum += fs.file_size } return sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_upload_mass\n number_to_human_size(self.works.all.sum(:file_size))\n end", "def size_in_bytes\n files.inject(0) do |sum, f|\n path = File.join self.path, f\n sum + File.size(path)\n end\n end", "def total_bytes\n self.files.map {|file| file[:size].to_i}.reduce(:+) # to_i handles any nil file sizes\n end", "def size\n @files.size\n end", "def file_size; @io_size[@rio] end", "def size\n size = popen(%W(du -s), full_path).first.strip.to_i\n (size.to_f / 1024).round(2)\n end", "def size\n @file_list.size\n end", "def recalculate_filesize\n @filesize = @collection.reduce(0) {|sum,asset| sum + asset.size}\n end", "def getFileSize()\n getRealFileSize(file) / MEGABYTE\n end", "def size\n\t\tstat[:size]\n\tend", "def size\n\t\tstat[:size]\n\tend", "def get_size(folder,hash)\n \n size_command = 'du -sh '+folder+' | cut -f 1'\n\n job_size = `#{size_command}`\n job_size = job_size.chomp\n\n hash['job_size']=job_size\n\n\nend", "def size(full_path)\n\t\t`du -sb #{full_path}`.match(/(\\d+)/)[1].to_i\n\tend", "def num_files_total\n command_string = 'find '+@install_root+' | wc -l'\n inspec.bash(command_string).stdout.split(\"\\n\")[0].strip.to_i\n end", "def fast_size2\n c_size = 0\n $postgres.exec_prepared('wsfile_size_multi', [self.id]).each do |row|\n c_size += row.except('id').map{|k,v| v.to_i}.inject(:+)\n end\n c_size\n end", "def size(full_path)\n\t\t`du -s #{Rush.quote(full_path)}`.match(/(\\d+)/)[1].to_i\n\tend", "def fast_size\n c_size = 0\n ids = self.child_ids\n q = \"SELECT octet_length(data), octet_length(body) AS octet_length2 FROM ws_files WHERE id in (#{ ids.join(\", \")})\"\n request = $postgres.exec(q)\n request.each do |req|\n c_size += req.map{|k,v| v.to_i }.inject(:+)\n end\n c_size\n end", "def get_work_download_count( work )\n return 0 if work.filesets.blank?\n sum = 0\n work.filesets.each { |fs|\n sum += get_file_download_count( fs.id )\n }\n return sum\n end", "def get_all_size\n s_old = 0\n Dir.glob($dir + '/**/*').each { | a_file |\n dn = File.dirname(a_file)\n s = File.lstat(a_file).size.to_i\n $file_size[ a_file ] = s\n $dir_size[ dn ] = (s_old = $dir_size[ dn ]) ? s_old + s : s\n }\nend", "def byte_size\n inject(0){ |sum, path| sum + FileTest.size(path) }\n end", "def file_size\n self.file_file_size\n end", "def file_size\n number_to_human_size(super)\n end", "def calculate_disk_usage\n user_own_maps = self.own_maps #saves 4 calls\n\n files = user_own_maps.map{|m| m.unwarped_filename if File.exist? m.unwarped_filename} + user_own_maps.map{| m | m.masked_src_filename if File.exist? m.masked_src_filename} + user_own_maps.map{|m | m.warped_filename if File.exist? m.warped_filename} + user_own_maps.map{|m| m.warped_png_filename if File.exist? m.warped_png_filename}\n files.compact!\n\n total_size = files.inject(0) {| result, file | result + File.size(file) }\n\n return total_size\n end", "def filesize; end", "def file_size\n @file_size ||= 0\n end", "def file_size\n stream.size\n end", "def size\n @size ||= File.size(file)\n end", "def total_size\n self._total_size(self, 0)\n end", "def size\n File.size( fullpath )\n end", "def sizeOnDisk(someFile)\n #get directory\n #size of file in directories\n #add\n return Dir.glob(File.join(someFile, '**', '*')).map{|f| File.size(f)}.inject(:+)\nend", "def primary_data_file_count\n study_file_count = self.study_files.primary_data.size\n directory_listing_count = self.directory_listings.primary_data.map {|d| d.files.size}.reduce(0, :+)\n study_file_count + directory_listing_count\n end", "def total_filesize_count(folder_name)\n\n # You will fill in something here. Remember that the method only\n # gets the folder name, not the folder handle. So the method needs\n # to first create the corresponding handle object.\n\nend", "def file_total_size_gb\n ((total_ram_mb.to_f * 2).to_f / 1024).ceil\n end", "def total_size(bucket)\n # check for saved value\n return @bucket_size[bucket] if @bucket_size[bucket]\n @log.debug \"Computing size for #{bucket.tracker_description}\"\n total_bytes = 0\n bucket.files.each {|object| total_bytes += object.content_length}\n @log.debug \"total bytes = #{total_bytes}\"\n # save the total size for later\n @bucket_size[bucket] = total_bytes / BYTES_PER_GB.to_f\n end", "def bytes\n members.reduce(0) { |sum, gf| sum + gf.file_size.first.to_i }\n end", "def count\n coverable_files.size\n end", "def size\n raise MissingFileMapping.new if mapping.blank?\n raise NodesMissing.new if mapping.nodes.blank?\n\n retrieve_meta!\n\n return self.meta['file_size'].to_i\n end", "def misc_directory_file_count\n self.directory_listings.non_primary_data.map {|d| d.files.size}.reduce(0, :+)\n end", "def size(children: true)\n c_size = 0\n request = $postgres.exec_prepared('wsfile_size', [self.id])\n c_size += request[0].map{|k,v| v.to_i }.inject(:+)\n c_size += self.children.map{|child| child.size}.inject(:+) || 0 if children\n c_size\n end", "def _total_size(folder, size)\n folder.assets.each do |a|\n size = size + a.file_size\n end\n folder.children.each do |f|\n size = _total_size(f,size)\n end\n return size\n end", "def calculate_tree_size(folder)\n\t\ttotal_size = 0\n\t\t@files.each do |name, size|\n\t\t\tbegin\n\t\t\t\tif name.include? folder\n\t\t\t\t\tlocal_size = Integer(size)\n\t\t\t\t\ttotal_size = total_size + local_size\n\t\t\t\tend\n\t\t\trescue TypeError\n\t\t\tend\n\t\tend\n\t\treturn total_size\n\tend", "def get_size\n\t\tend", "def get_attach_size\n\n return 0 if self.mail_attachments.nil? or self.mail_attachments.empty?\n\n sum = 0\n\n self.mail_attachments.each do |attach|\n sum += attach.size\n end\n\n return sum\n end", "def bytes\n @bytes = 0\n @files.each do |file|\n @bytes += File.new(\"#{file}\").size\n end\n @bytes\n end", "def size\n file.size\n end", "def size_mb \n return size / 1048576 # (1024 * 1024) \n end", "def get_file_size\n file = Storage.get_file(ENV['AWS_S3_DIR_PAGES'], self.issue_id, self.filename )\n return file.content_length\n end", "def directory_size(path)\n\ta = get_dir_size(path)\n\tdisplay(a)\n\t@calls = 0\n\treturn a\nend", "def workforce_size\n @workforce.size\n end", "def size\n File.size(self)\n end", "def size\n File.size(self)\n end", "def size\n File.size(self)\n end", "def size\n File.size(self)\n end", "def size\n File.size(@filename)\n end", "def total_file_count\n self.study_files.non_primary_data.count + self.primary_data_file_count\n end", "def size\n instance_read(:file_size) || (@queued_for_write[:original] && @queued_for_write[:original].size)\n end", "def file_size\n # pretty value\n attachments.order(position: 'asc').first.file_size\n rescue StandardError => exc\n logger.error(\"Message for the log file #{exc.message}\")\n 0\n end", "def size\n @size \n end", "def size\n @size \n end", "def calculate_size\n @size = unit_count + holidays_count\n end", "def file_size_field\n Solrizer.solr_name(:file_size, CurationConcerns::CollectionIndexer::STORED_LONG)\n end", "def file_size_field\n Solrizer.solr_name(:file_size, CurationConcerns::CollectionIndexer::STORED_LONG)\n end", "def getFolderSize(folder)\n total_size=0\n @files = Dir.glob(folder+\"**/**\")\n for file in @files\n total_size=total_size+File.size(file)\n end \n return total_size\nend", "def data_size\n File.size(file_path)\n end", "def data_size\n File.size(file_path)\n end", "def total_size\n return @total_size if @total_size\n if @structure.instance_of? Array\n return 0 if @structure.empty?\n @total_size = strip(:size).flatten.inject { |sum, i| sum + i }\n else\n @total_size = size\n end\n end", "def output_size(stat)\n HdfsUtils::Units.new.format_filesize(stat['length'],\n @settings[:filesizeunits])\n end", "def bytesize\n @fd.stat.size\n end", "def size_in_bytes\n ( file_length * 16 ) / 8\n end", "def size\n @size = File.size(self.path) unless @size\n @size\n end", "def calc_size\n @input_size = File.size(@original_filepath)\n @output_size = File.size(@min_filepath)\n @diff_size = @input_size - @output_size\n end", "def matrix_size\n segments = matrix_file_path.split('/')\n bucket_id = segments[2]\n upload_file_name = segments.last\n study = Study.find_by(bucket_id:)\n study_file = StudyFile.find_by(study:, upload_file_name:)\n study_file.upload_file_size\n end", "def path_size (path)\n if Dir.exist? path\n o, e, s = Open3.capture3('du', '-s', '-b', path)\n o.split('/')[0].to_i\n end\n end", "def size; file_log.size(file_rev); end", "def size\n @size.size\n end", "def repo_size\n Dir.glob(File.join(repo.path, '**', '*'), File::FNM_DOTMATCH).reject do |f|\n f.include?('..')\n end.map do |f|\n File.expand_path(f)\n end.uniq.map do |f|\n File.stat(f).size.to_i\n end.reduce(:+)\n end", "def fetch_disk_size\n total_size = 0\n total_size = `lsblk -b --output SIZE -d -n | paste -s -d + - | bc`\n number_to_human_size total_size\n end", "def as_size children: true\n WSFile.human_size(optimal_size)\n end", "def getTorrentFileCount(infoHash)\n return @rpc.call('d.get_size_files', infoHash)\n end", "def file_size_field\n Solrizer.solr_name(:file_size, CurationConcerns::FileSetIndexer::STORED_INTEGER)\n end", "def get_file_size_in_mb\n mb = ::ApplicationController.helpers.number_to_human_size(self.file_size, precision: 2) \n return mb\n end", "def max_files; end", "def work_queue_size()\n @work_queue.size\n end", "def getFileSize\r\n\t\t\t\t\treturn @fileSize\r\n\t\t\t\tend", "def size\n @list.map { |bin| bin.size }.reduce(0, :+)\n end", "def s3_storage_used\n bytes = contents.sum(:size)\n backup_sources.gmail.each do |gmail|\n bytes += gmail.backup_emails.sum(:size)\n end\n # TODO: move size calculations to each source\n backup_sources.blog.each do |blog|\n blog.feed.entries.each do |entry|\n\tif entry.feed_content\n\t bytes += entry.feed_content.size\n\tend\n end\n end\n bytes\n end", "def size\n return 0 unless @spoolfile\n\n @spoolfile.flush\n @spoolfile.stat.size\n end", "def get_total_length(filenames)\n shell_formatted_filenames = Shellwords.join filenames\n res = `afinfo -b #{shell_formatted_filenames}` # total info\n length = 0\n res.lines{|l| length = length + l.split.first.to_f if l.split.first.to_f}\n length\n end", "def size\n size_helper(@root)\n end", "def total_size\n object_versions.inject(0) { |sum, obj| sum += obj.size }\n end", "def size\n File.new(self.server_path).size\n end", "def size\n File.stat(@repo.join(@path)).size\n end", "def get_size\n\t\treturn @size\n\tend", "def size\n @mutex.synchronize{_size}\n end", "def size\n ::File.size(@path)\n end", "def total(fs = ?/.freeze)\n\t\t\t\ts = stat_raw(fs)\n\t\t\t\treturn nil if s.empty?\n\t\t\t\ts.default = 0\n\t\t\t\ts[:block_size] * s[:blocks]\n\t\t\tend", "def current_size(path)\n `du -shm #{path}`.match(/^[0-9]+/).to_s.to_i\n end", "def size\n contents.size\n end", "def file_size(file_name, ignore_errors = false)\n dst_path = \"#{self.path}#{file_name}\"\n \n cmd = self.class.curr_host == host ? \n \"du -sb #{dst_path.shellescape}\" : \n \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"du -sb #{dst_path.shellescape}\\\"\"\n r = ignore_errors ? `#{cmd} 2>/dev/null` : `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n r.to_i\n end", "def file_size(file_name, ignore_errors = false)\n dst_path = \"#{self.path}#{file_name}\"\n \n cmd = self.class.curr_host == host ? \n \"du -sb #{dst_path.shellescape}\" : \n \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"du -sb #{dst_path.shellescape}\\\"\"\n r = ignore_errors ? `#{cmd} 2>/dev/null` : `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n r.to_i\n end" ]
[ "0.76772", "0.7457767", "0.72747403", "0.7252813", "0.72179574", "0.7120239", "0.7052728", "0.70295733", "0.6972544", "0.6950702", "0.6950702", "0.692486", "0.6887583", "0.68838197", "0.6874803", "0.6866598", "0.6850891", "0.6830996", "0.6820592", "0.68160427", "0.67980146", "0.67941135", "0.67921484", "0.67703813", "0.67380273", "0.67073745", "0.67046434", "0.67037463", "0.6702168", "0.66833526", "0.66820264", "0.6679101", "0.667571", "0.66674495", "0.6653561", "0.6650874", "0.66463846", "0.66095513", "0.66051936", "0.6589228", "0.65754503", "0.65709364", "0.6570845", "0.6562455", "0.65588105", "0.6550989", "0.65442306", "0.65351176", "0.6533077", "0.6531165", "0.6531165", "0.6531165", "0.6531165", "0.6529252", "0.65253717", "0.65176916", "0.6508181", "0.65081185", "0.65081185", "0.6499453", "0.64824176", "0.64824176", "0.6482192", "0.64811826", "0.64811826", "0.6478115", "0.6469935", "0.6458149", "0.644618", "0.6442727", "0.64424646", "0.64412576", "0.6438647", "0.64276546", "0.64275604", "0.64008975", "0.6398178", "0.63857144", "0.6368262", "0.6367737", "0.63626283", "0.63603777", "0.635877", "0.6350798", "0.6340802", "0.63344187", "0.6328498", "0.632622", "0.63241035", "0.6320731", "0.631796", "0.6316355", "0.6310189", "0.6307243", "0.6304608", "0.6303144", "0.6294246", "0.62909454", "0.62872267", "0.62872267" ]
0.8909225
0
get an aggregate count of file downloads
def get_file_download_count( fileset_id ) return FileDownloadStat.where( 'file_id = ?', fileset_id ).sum( :downloads ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_download_count\n sum(:api_download_count) + sum(:web_download_count)\n end", "def download_count\n web_download_count + api_download_count\n end", "def get_work_download_count( work )\n return 0 if work.filesets.blank?\n sum = 0\n work.filesets.each { |fs|\n sum += get_file_download_count( fs.id )\n }\n return sum\n end", "def get_file_count_from_response(response)\n response.values.map {|entry| entry[:total_files]}.reduce(&:+)\nend", "def downloads_count; AddonDownload.sum(:download_count, :addon_id => self.addon_id, :addon_version_id => self.id).to_i rescue 0; end", "def send_count\n repository.files.map do |file|\n content = repository.read(file)\n content.to_s.scan(/send/).size\n end.sum\n end", "def count\n coverable_files.size\n end", "def file_count\n source_dir = Item.new(Path.new(params[:source]))\n type = params[:type]\n\n response = {}\n response[:source_dir] = source_dir\n file_count = source_dir.path.file_count(file_type: type)\n \n if file_count\n response[:msg] = \"Success\"\n response[:file_count] = file_count\n else\n response[:msg] = \"Fail\"\n end\n render json: response\n end", "def downloads_count; AddonDownload.sum(:download_count, :addon_id => self.id).to_i rescue 0; end", "def total_views_per_file_path\n iterate_over_file_paths.group_by { |x| x }.map { |k, v| [k, v.count] }\n end", "def num_files_total\n command_string = 'find '+@install_root+' | wc -l'\n inspec.bash(command_string).stdout.split(\"\\n\")[0].strip.to_i\n end", "def total_file_count\n self.study_files.non_primary_data.count + self.primary_data_file_count\n end", "def misc_directory_file_count\n self.directory_listings.non_primary_data.map {|d| d.files.size}.reduce(0, :+)\n end", "def user_song_uploads_total\r\n self.user_song_uploads.count\r\n end", "def added_files\n file_stats.count { |file| file.status == :added }\n end", "def archive_file_count\n Dir.glob('*', base: mounted_path).length\n end", "def primary_data_file_count\n study_file_count = self.study_files.primary_data.size\n directory_listing_count = self.directory_listings.primary_data.map {|d| d.files.size}.reduce(0, :+)\n study_file_count + directory_listing_count\n end", "def total_unique_views_per_file_path\n iterate_unique_views.group_by { |x| x }.map { |k, v| [k, v.count] }\n end", "def counters\n {\n files: files_count,\n apps: apps_count,\n workflows: workflows_count,\n jobs: jobs_count,\n members: members_count,\n }\n end", "def getTorrentFileCount(infoHash)\n return @rpc.call('d.get_size_files', infoHash)\n end", "def get_all_uploaded_documents_count\n client = @current_advisor.clients_as_advisor.find_by(id: @client_id)\n if client.consumer_id\n Document.where(:consumer_id => client.consumer_id).count\n else\n client.document_ownerships.count\n end\n end", "def total_count(file)\n file_obj = File.new(file,'r')\n file_obj.readlines.size\n end", "def number_of_files\n\t\tassets.length\n\tend", "def count_objects(key)\n\n puts \"Bucket: #{@bucket_name} - key: #{key}\\n\"\n\n files = @client.buckets[@bucket_name].\n objects.with_prefix(key)\n\n count = 0\n files.each do |o|\n count += 1\n end\n puts \"Count of files in #{@bucket_name}/#{key}: #{count}\"\n return count\n end", "def dir_file_count\n directory = APP_CONFIG['import_maps_sftp_path']\n count = Dir[File.join(directory, '**')].count { |file| File.file?(file) }\n\n return count\n end", "def bulk_download_response(study_files)\n response = {}\n study_files.each do |study_file|\n file_type = study_file.simplified_file_type\n response[file_type] ||= {total_files: 0, total_bytes: 0}\n response[file_type][:total_files] += 1\n response[file_type][:total_bytes] += study_file.upload_file_size\n end\n response.with_indifferent_access\nend", "def get_count(path)\n file = scope.get(path)\n InvalidPath.raise! {!file}\n return 0 if !file.is_dir\n file.files_count\n end", "def num_urls\n @client[URLS_COLLECTION].count\n end", "def bytes\n @bytes = 0\n @files.each do |file|\n @bytes += File.new(\"#{file}\").size\n end\n @bytes\n end", "def total_bytes\n self.files.map {|file| file[:size].to_i}.reduce(:+) # to_i handles any nil file sizes\n end", "def count\n folder.data_objects.all(parameters).count\n end", "def count_total_lines files\n files.each do |f, k|\n lines_output = `wc -l #{f.to_s}`\n if $? != 0 then\n raise 'Error in counting total lines.'\n end\n lines_count = lines_output.strip.split(' ')[0].to_i\n k['total_lines'] = lines_count\n end\n return files\n end", "def get_attachments_count\n begin\n \n if @filename == ''\n raise 'filename not specified'\n end\n \n \n str_uri = $product_uri + '/pdf/' + @filename + '/attachments'\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) \n\n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n return stream_hash['Attachments']['List'].length\n \n \n rescue Exception=>e\n print e\n end\n end", "def deleted_files\n file_stats.count { |file| file.status == :deleted }\n end", "def file_count\n return unless exists?\n Dir.glob(folder_pathname.join(\"**\")).count do |file|\n File.file?(file)\n end\n end", "def num_urls\n @client[:urls].count\n end", "def count_exports\n return @count_exports\n end", "def page_count\n file_groups\n @highest_page_count\n end", "def number_of_documents_from_caseflow\n count = Document.where(file_number: veteran_file_number).size\n (count != 0) ? count : number_of_documents\n end", "def total_filesize_count(folder_name)\n\n # You will fill in something here. Remember that the method only\n # gets the folder name, not the folder handle. So the method needs\n # to first create the corresponding handle object.\n\nend", "def audio_file_count\n @audio_file_list.length\n end", "def count\n @collector.count\n end", "def get_work_aggregate_size( work )\n return 0 if work.filesets.blank?\n sum = 0\n work.filesets.each { |fs|\n sum += fs.file_size\n }\n return sum\n end", "def size\n @file_list.size\n end", "def counters\n return {} if object.guest?\n\n {\n files: files_private_count,\n folders: folders_private_count,\n apps: apps_private_count,\n workflows: workflows_count,\n jobs: jobs_count,\n assets: assets_count,\n notes: notes_count,\n }\n end", "def num_clicks\n count = 0\n self.visits.each { |user| count += user.visits }\n count\n end", "def index\r\n @agroups = Agroup.all\r\n @mfilesN = Mfile.count\r\n \r\n @numbers = Agroup.joins(:mfiles).group('agroups.id').count(:mfile_id)\r\n \r\n end", "def count_exported\n return @count_exported\n end", "def size\n @files.size\n end", "def count_documents\n size = 0\n @data.each_value do |documents|\n size += documents.size\n end\n\n size\n end", "def size\n streams.map(&:size).inject(0, :+)\n end", "def getOutputFiles\n if (self.getCompleted)\n file_list = JSON.parse(@client[\"/StatsDownloadUrls?loadTestId=#{@test_id}\"].get)['outputFiles']\n if (file_list && file_list.length == @server_cnt)\n file_list\n end\n end\n end", "def images_count\r\n images_count = 0\r\n jobs.each do |job|\r\n images_count += job.images_for_jobs.count\r\n end\r\n images_count\r\n end", "def size_in_bytes\n files.inject(0) do |sum, f|\n path = File.join self.path, f\n sum + File.size(path)\n end\n end", "def count; info['doc_count']; end", "def lines\n repository.files.map do |file|\n repository.read(file).to_s.lines.count\n end.sum\n end", "def tracking_total_count\n link_tracking.count\n end", "def filestotal\r\n\t\t\t`#{BITS::BITSADMIN} /getfilestotal {#{@id}}`\r\n\t\tend", "def report(count)\n puts \"#{$count} html files were processed to #{Dir.getwd}/pages.csv\"\nend", "def countItems( dir )\n if $options[:verbose]\n STDOUT.puts \"DEBUG: Counting files in [#{dir}]\"\n end\n\n count = 0\n Dir.foreach( dir ) do |item|\n next if item == \".\" or item == \"..\"\n count += 1\n fullPath = File.join( dir, item )\n count += countItems( fullPath ) if File.directory? fullPath\n end\n return count\nend", "def countItems( dir )\n if $options[:verbose]\n STDOUT.puts \"DEBUG: Counting files in [#{dir}]\"\n end\n\n count = 0\n Dir.foreach( dir ) do |item|\n next if item == \".\" or item == \"..\"\n count += 1\n fullPath = File.join( dir, item )\n count += countItems( fullPath ) if File.directory? fullPath\n end\n return count\nend", "def uploaded_images_count\n fog_storage = get_fog_storage\n bucket = get_bucket\n \n directory = fog_storage.directories.get(bucket)\n \n images_count = 0 \n \n directory.files.each do |file|\n \n if ( file.key.to_s.start_with? \"uploads/quiz/#{quiz_id}/quiz_question_images/\")\n images_count += 1\n end \n end\n \n return images_count\n end", "def count()\n if @count == -1\n params = @params.clone\n params['count'] = 1\n\n res = @api.do_request(\"GET\", @path, params)\n @count = res['count'].to_i\n end\n @count\n end", "def count_links\n @links_count = Link.count\n end", "def instance_count\n repository.files(:pattern => /.rb/).map do |file|\n content = repository.read(file)\n count_calls(:def,content)\n end.sum\n end", "def num_items\n backup_photo_albums.size\n end", "def transfers_count\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/count').count\n end", "def downloaded\n files_list = []\n files = session[:user].x_files.all(:downloads.gte => 1, uploaded: true)\n files.each { |file| files_list.push(file.description(session[:user])) }\n @result = { files: files_list, success: true }\n end", "def get_progress()\n @result_tfile.rewind\n progress = @result_tfile.each_line.collect do |line|\n group = line.scan(/Completed (\\d+) requests/)\n group = group.empty? ? 0 : group[0][0]\n end\n progress.reject{|x| x == 0}.length * 10\n end", "def file_stats\n @stats = @ff.get_stats\n end", "def collectionobject_link_count(options = {})\n co_count = 0\n MediaFile.where('sourceable_type=? AND resource_id=?', 'collectionobjectLink', self.id).find_each do |rf|\n if rf.access == 1 and rf.display_collectionobject_link == 1\n co_count += 1\n elsif options[:get_hidden]\n co_count += 1\n end\n end\n return co_count\n end", "def CountFiles\n\t\tchildrenFiles = []\n\t\tcwd = File.dirname(__FILE__) # get parent directory from our script\n\t\tchildrenFiles = Dir.glob(cwd + '/**/*').select{ |e| File.file? e }\n\n\t\tchildrenFiles.each do |file|\n\t\t\tif File.extname(file).empty?\n\t\t\t\t@count += 1\n\t\t\t\t@files.push(file)\n\t\t\tend\n\t\tend\n\tend", "def total_entries\n @total_entries ||= begin\n @watched_cursor.rewind!\n @watched_cursor.map {|w| w['movie_id'] }.uniq.size\n end\n end", "def count\n `wc -l < #{filepath}`.to_i - 1\n end", "def count_all_links(dir)\n perform_global_search('//a', [], dir)\n end", "def signups_count\n if File.exists?('./tmp/signup')\n Dir['./tmp/signup/*'].count\n else\n 0\n end\nend", "def count_item\n count = 0\n @g_net.each do |followers|\n count += 1 unless !followers or followers.empty?\n end\n count\n end", "def nbpages\n attachments.order(position: 'asc').first.nbpages\n rescue StandardError => exc\n logger.error(\"Message for the log file #{exc.message}\")\n 0\n end", "def get_bookmarks_count\n begin\n \n if @filename == ''\n raise 'filename not specified'\n end\n \n \n str_uri = $product_uri + '/pdf/' + @filename + '/bookmarks'\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) \n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n return stream_hash['Bookmarks']['List'].length\n \n \n rescue Exception=>e\n print e\n end\n end", "def get_all_documents_count\n get_all_documents_ids.count\n end", "def get_counter_for_file(filename)\n CounterFinder.new(filename, @file_extension).counter\n end", "def size\n @fetcher.size\n end", "def count_media\n general_data['nb_media']\n end", "def count\n load\n @result_count\n end", "def extract_files_and_return_count(src_directory)\n Dir.chdir $executor_directory\n\n \n number_files_before = TestUtils.count_files_directory($dst_directory)\n number_files_src_directory = TestUtils.count_files_directory(src_directory)\n\n system(\"#{$executor_command} #{src_directory} #{$dst_directory}\")\n\n number_files_after = TestUtils.count_files_directory($dst_directory)\n\n total_correct_amount_of_files = number_files_before + number_files_src_directory\n return number_files_before, number_files_after, total_correct_amount_of_files\n\n\tclean_directory\n end", "def file_counter\n Dir.glob(File.join(\"Goal/\", '**', '*')).select { |file| File.file?(file) }.count + 1\nend", "def count_layer_check_files\n %w[01 02 03].map do |number|\n folder = File.join('data', 'layer_check', \"build-#{number}\")\n puts \"CHECK #{folder}\"\n num_states = 0\n LayerPartInfoName.glob(folder).each do |layer_part_info|\n info_string = File.read(File.join(folder, layer_part_info.to_s))\n info = JSON.parse(info_string)\n num_states += info['num_states'].to_i\n end\n puts number_with_comma(num_states)\n puts num_states / (30.0 * 24 * 3600)\n num_states\n end\nend", "def get_total_image_page_count\r\n total_page_count = 0\r\n images_for_jobs.each do |images_for_job|\r\n total_page_count += images_for_job.page_count.to_i\r\n end\r\n total_page_count\r\n end", "def get_links_count page_number\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 \n str_uri = $product_uri + '/pdf/' + @filename + '/pages/' + page_number.to_s + '/links'\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) \n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n return stream_hash['Links']['List'].length\n \n \n rescue Exception=>e\n print e\n end\n end", "def num_records\n num_urls + num_docs\n end", "def num_records\n num_urls + num_docs\n end", "def file_count(dir_path)\n Dir.entries(dir_path).count - 2\n end", "def regular_files\n quarter_months.collect(&:regular_files).sum.to_i\n end", "def songs_count\n value = 0\n packs.each do |pack|\n value += pack.songs.count\n end\n value += songs.count\n end", "def GetFileCount(aDir):\n return Dir[File.join(aDir, '*')].count {|file| File.file?(file)}\n end", "def result\n { TOTAL_TEST_FILES => @total_test_files,\n TOTAL_SOURCE_FILES => @total_source_files\n }\n end", "def progress\n total = asset.pieces.count\n downloaded = total - piece_downloads.incomplete.count\n [downloaded, total]\n end", "def file_size\n # pretty value\n attachments.order(position: 'asc').first.file_size\n rescue StandardError => exc\n logger.error(\"Message for the log file #{exc.message}\")\n 0\n end", "def total_entries\n collection.total_count\n end", "def getFolderSize(folder)\n total_size=0\n @files = Dir.glob(folder+\"**/**\")\n for file in @files\n total_size=total_size+File.size(file)\n end \n return total_size\nend" ]
[ "0.77822095", "0.77077955", "0.73467565", "0.7200584", "0.71080047", "0.7080399", "0.7057292", "0.69814837", "0.6971545", "0.68675935", "0.67329663", "0.67015177", "0.66967535", "0.66870034", "0.6685328", "0.6655517", "0.6549815", "0.6529465", "0.6478196", "0.64778167", "0.632691", "0.63256186", "0.6303699", "0.6293622", "0.6266374", "0.6261987", "0.62596416", "0.62558234", "0.6237161", "0.6226108", "0.6214912", "0.6206412", "0.61911154", "0.6172352", "0.6164147", "0.6153573", "0.6147914", "0.61430764", "0.6132211", "0.6131869", "0.61275285", "0.6123902", "0.6113985", "0.6106831", "0.6104849", "0.6097355", "0.60821635", "0.60696405", "0.60658705", "0.6065076", "0.6059404", "0.60434484", "0.60366553", "0.6015054", "0.6009722", "0.6002428", "0.60003525", "0.59992206", "0.59987676", "0.5975576", "0.5975576", "0.5971991", "0.5963911", "0.5960148", "0.59466654", "0.59421504", "0.59400785", "0.5934857", "0.5934238", "0.5932097", "0.59319144", "0.59217095", "0.5914368", "0.5913851", "0.59113777", "0.5898843", "0.58806753", "0.587938", "0.58760095", "0.58738464", "0.58737576", "0.5872304", "0.58712", "0.5855328", "0.5852497", "0.58490914", "0.5842398", "0.5842267", "0.58390236", "0.58359545", "0.58359545", "0.5835855", "0.58303434", "0.58235955", "0.58116144", "0.5807399", "0.5805547", "0.5802338", "0.5796271", "0.57958144" ]
0.77161497
1
get a list of view events that are identified by user
def get_all_identified_view_events WorkViewStat.where( 'user_id is not NULL' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @user = current_user\n @events = @user.events.all\n end", "def index\n @events = Event.where(user_id: current_user.id)\n end", "def index\n @events = Event.where( \"user_id = ?\", current_user.id )\n end", "def index\n @events = current_user.events\n end", "def index\n @events = current_user.events\n end", "def index\n @created_events = current_user.created_events\n @invited_events = current_user.invited_events\n @attending_events = current_user.attending_events\n end", "def events(user)\n get(:standard, {:method => \"user.getEvents\", :user => user})\n end", "def index\n if params[:u]\n @events = User.find(params[:u]).events\n else\n @events = Event.all\n end\n end", "def get_events\n # events created by this user\n @my_events = User.find(current_user.id).event_attendants.where('owner = 1')\n\n # events this user has joined\n @joined_events = User.find(current_user.id).event_attendants.where('attendee_status = 3 and owner IS NULL')\n \n # events this user is invited to\n @invited_to_events = User.find(current_user.id).event_attendants.where('attendee_status = 0')\n\n @maybe_events = User.find(current_user.id).event_attendants.where('attendee_status = 2')\n end", "def index\n @events = current_user.super_user ? Event.all : current_user.events\n end", "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end", "def index\n @user_events = UserEvent.all\n end", "def index\n @user_events = UserEvent.all\n end", "def index\n @user_events = UserEvent.all\n end", "def show\n @users = @event.users\n end", "def user_events\n @user_events ||= users.map { |u| u.events }.flatten\n end", "def show\n @events = Event.where(user_id: current_user.id).order('created_at DESC')\n end", "def events_for_user (user_id)\n events_users.includes(:event).where(\"events_users.user_id=?\",user_id)\n end", "def show\n @created_events = @user.events\n @invited_events = @user.invited_events\n @past_events = @user.attended_events.past_events\n @upcoming_events = @user.attended_events.upcoming_events\n end", "def show\n @user = User.find(params[:id])\n @events = Event.all\n\n @my_events = @events.select do |event|\n event.date >= DateTime.now && event.creator_id == @user.id\n end\n\n @my_attending_events = UserEvent.joins(:event).where(\"user_id == :user AND events.date >= :current_event_date\",\n {user: @user.id, current_event_date: DateTime.now})\n\n # All the current events you are involved in\n @all_current_events = @my_events + user_events(@my_attending_events)\n\n @my_past_events = @events.select do |event|\n event.date < DateTime.now && event.creator_id == @user.id\n end\n\n @past_attending_events = UserEvent.joins(:event).where(\"user_id == :user AND events.date < :current_event_date\",\n {user: @user.id, current_event_date: DateTime.now})\n\n @all_past_events = @my_past_events + user_events(@past_attending_events)\n end", "def index\n @events = current_user.account.events\n end", "def show\n @events = @user.events\n end", "def my_events\n @events = []\n Event.all.each do |event|\n if (event.creator == current_user.id)\n @events << event\n end\n end\n end", "def show\n @events = Event.find(params[:id])\n @users = @events.users\n end", "def show\n @events_ordered = Event.order('startdate ASC')\n joined_event = []\n event_user = []\n if params[\"from\"]==\"myevents\"\n act = Active.where(user_id: current_user.id)\n act.each do |active|\n joined = @events_ordered.find(active.event_id)\n if joined.user_id != current_user.id\n joined_event << joined\n end\n end\n\n event_user = @events_ordered.where(user_id: current_user.id)\n ev = joined_event + event_user\n @user_events = ev.paginate(page: params[:page], per_page: 5)\n else\n @user_events = @user.events.paginate(page: params[:page], per_page: 5)\n end\n end", "def index\n user = self.current_user && User.find_by_id(self.current_user.id)\n @events = nil\n if user\n @events = user.events \n else\n @events = Event.find(:all)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end", "def index\n @event = Event.where(\"user_id = ?\", current_user.id)\n end", "def events\n event.user.events.where(:timestamp => beginning...ending)\n end", "def index\n @events = []\n Event.all.each do |event|\n if (event.creator != current_user.id)\n @events << event\n end\n end\n end", "def index\n @events = Event.last_events(current_user, 3)\n end", "def show\n @user = User.find(params[:id])\n @events = Event.where(creator_id: @user.id).all\n @past_events = @events.past\n @future_events = @events.upcoming\n @previous_events = @user.attended_events.past\n @upcomming_events = @user.attended_events.upcoming\n end", "def events(count: 150, startId: nil)\n data = get '', resource: 'userEvent', count: count, startId: startId\n data.userEvents\n end", "def index\n @events_users = EventsUser.all\n end", "def index\n @events_users = EventsUser.all\n end", "def index\n @event_tasks = EventTask.user_event_tasks(current_user)\n end", "def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def index\n @events = Event.all.order(:date)\n @admin_events = @events.select{|event| event.owner == current_user}\n @other_events = @events.reject{|event| event.owner == current_user}\n end", "def user_events(user, options={})\n get(\"/users/#{user}/events\", options, 3)\n end", "def index\n @templates = current_user.templates\n @events = Event.by_user_limit current_user\n end", "def index\n @events = Event.all\n\n # Past Events that you and your friends held\n # 4 events with seed file and user 9\n @past_events = @events.select do |event|\n event.date < DateTime.now\n end\n\n # Current Events that you created\n @my_events = @events.select do |event|\n event.date >= DateTime.now && event.creator_id == current_user.id\n end\n\n # Current Events that you are attending\n @attending_events = UserEvent.joins(:event).where(\"user_id == :current_user AND events.date >= :current_event_date\",\n {current_user: current_user.id, current_event_date: DateTime.now})\n\n # All the current events you are involved in\n # 4 events with seed file and user 9\n @all_attending_events = @my_events + user_events(@attending_events)\n\n # Friend made events show all events not created by you\n @friend_made_events = @events.select do |event|\n event.date >= DateTime.now && event.creator_id != current_user.id\n end\n\n # Events made by your friends, where you are not attending\n # 3 events with seed file and user 9\n @friend_events = @friend_made_events - user_events(@attending_events)\n end", "def events_for_authenticated_user page\n events = api_client.received_events(authenticated_user, page: page)\n filter_events events\n end", "def index\n\t\t@events = current_user.events\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @events }\n\t\tend\n\tend", "def index\n @user_event_details = UserEventDetail.all\n end", "def events\n @even = @user.created_events.order('created_at DESC')\n @events = @even.paginate(:page => params[:page])\n end", "def index\n if current_user.nil?\n redirect_to root_path\n end\n @event = EventOwner.find(current_user)\n end", "def index\n @integrations = current_user.integrations\n @events = Event.by_user_limit current_user\n end", "def event_list\n events_list\n end", "def view_event(user, event) \n\tend", "def index\n if params[:user]\n @events = Event.where(user: params[:user]).first\n else\n @events = Event.all.order('created_at asc')\n end\n\n render json: @events, :only => [:id, :date, :user, :event_type, :message, :otheruser]\n end", "def user_events(user_id=self.username, options={})\n response = connection.get do |req|\n req.url \"/users/#{user_id}/events\", options\n end\n response.body.activity\n end", "def index\n @organizing_future_events = get_user_organizing_future_events\n @attending_future_events = get_user_attending_future_events\n @nearby_events = get_upcoming_nearby_events_within_radius(5)\n end", "def index\n current_user_id = current_user.nil? ? nil : current_user.id\n @main_events = MainEvent.where(user_id: current_user_id)\n @my_events = Event.any_in(user_ids: [current_user_id]).all if current_user_id\n @registered_events = current_user.registered_main_events.to_a\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @main_events }\n end\n end", "def events\n @events ||= user_events.concat(org_events).uniq\n end", "def index\n \n @events = current_user.events\n \n \n respond_to do |format|\n format.html {}\n format.json { render json: Event.events_to_json(@events) }\n end\n end", "def index\n @past_events = User::Event.active_events.past_events\n @next_events = User::Event.active_events.next_events\n end", "def users\n @users = Event.find(params[:id]).users\n end", "def index\n @events = Event.all\n redirect_to user_path(current_user)\n end", "def index\n @events = current_user.events\n\n render json: @events\n end", "def show\r\n @ip_events = Ahoy::Event.events_for_ip_and_visit(@visit.ip, @visit.id)\r\n @user_events = []\r\n @event_days = Ahoy::Event.uniq_events_days_for_ip(@visit.ip)\r\n @event_links = Ahoy::Event.top_x_url_visits_for_ip(15, @visit.ip)\r\n end", "def show\n #TODO - only admin should be access people besides themselves\n @events = @user.events.all\n respond_to do |format|\n format.html\n format.json { render :json => { :user => @user } }\n end\n end", "def events\n collection(\"events\")\n end", "def index\n @events = Event.where({ user_id: current_user.id }).order(created_at: :desc)\n @invitations = EventUser.where({ number: current_user.phone }).map { |invite| invite.event }\n \n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def show\n @event = Event.find_by_id(params[:id])\n #event.participants returns a collection and we CANT perform query on it\n host = @event.participants.select { |p| p.role == \"host\" }\n @users = @event.users.select { |u| u.id != host.first.user_id } #excludes the host\n end", "def event_list\n @_events\n end", "def index\n @events_to_me = Event.joins('LEFT OUTER JOIN events_users ON events_users.event_id = events.id').where(\"events_users.user_id=?\", current_user.id)\n @events_from_me = Event.where(creator: current_user)\n\n @events = @events_to_me + @events_from_me\n end", "def index\n if current_user && current_user.is_admin? && params_user_id\n @events = User.find(params_user_id).events.where(is_validated:true)\n elsif params_user_id && params_user_id.to_i == current_user.id\n @events = current_user.events.where(is_validated:true)\n elsif params_user_id && params_user_id.to_i != current_user.id \n redirect_to root_path\n else\n @events= Event.where(is_validated:true)\n end\n end", "def index\n @events = Event.where.not(id: current_user.events.ids + current_user.belongs_events.pluck(:id))\n @event = Event.new\n end", "def index\n @events = current_user.family.events\n @event = Event.new\n end", "def user_events(user_events_array)\n \tuser_events_array.map do |user_event|\n \t\tuser_event.event\n \tend\n end", "def owned_events\n events\n end", "def index\n @events = current_user.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def list\n @events = Event.coming_events\n respond_to do |format|\n format.html do\n render layout: 'events'\n end\n format.json do \n events = @events.map {|event| {event: event, users: event.users, applied: event.users.include?(current_user) }}\n render json: events \n end\n end\n end", "def user_events(user, options = {})\n paginate \"#{User.path user}/events\", options\n end", "def get_events\t\t\t\n @task = UserEvent.where(\"user_id\"=>current_user.id)\n events = []\n @task.each do |task|\n events << {:id => task.id, :title => task.title, :start => DateTime.parse(task.start.to_s).strftime(\"%Y-%m-%d\"), :end => DateTime.parse(task.end.to_s).strftime(\"%Y-%m-%d\") }\n end\n render :text => events.to_json \n end", "def events\n data.events\n end", "def show_events\n @events = Event.order(\"created_at\").to_a\n end", "def show\n @event = Event.find(params[:id])\n @times_allowed = @event.times_allowed.map(&:to_datetime)\n @participants = @event.participants\n end", "def currentuser\n\n @events = Event.where(user_id: current_user).order('created_at DESC')\n\tend", "def index\n @events = Event.all\n # render \"/users/:user_id/events\"\n render :index\n end", "def received_public_events(user, options = {})\n paginate \"#{User.path user}/received_events/public\", options\n end", "def events\n event_lookup()\n end", "def events\n event_lookup()\n end", "def received_events(user, options = {})\n paginate \"#{User.path user}/received_events\", options\n end", "def received_events(user, options={})\n get(\"/users/#{user}/received_events\", options, 3)\n end", "def index\n user = User.find params[:user_id]\n @events = !params.has_key?(:show_all) ? user.event : Event.scoped\n @events = @events.between(Days.firstDay(params[:curDate]), Days.lastDay(params[:curDate])) unless\n params[:curDate].nil?\n @events = @events.opened if params[:showClosed].nil? || !params[:showClosed]\n if !params[:show_date].nil?\n date = params[:show_date].is_a?(String) ? DateTime.parse(params[:show_date]) : params[:show_date]\n date_start = date.beginning_of_day\n date_finish = date.end_of_day\n @events = @events.between(date_start, date_finish) unless params[:show_date].nil?\n end\n #puts @events[1].start unless params[:show_date].nil?\n respond_to do |format|\n format.html {render :html => @events}\n format.json {render :json => @events}\n format.xml {render :xml => @events}\n end\n end", "def index\n if current_user\n @joined_event = []\n @joined = EventUser.where(user_id: current_user.id)\n @joined.each do |x|\n @joined_event << Event.find(x.event_id)\n end\n\n @events = []\n @joined_event_id = []\n @joined.each do |y|\n @joined_event_id << y.event_id\n end\n Event.all.each do |x|\n if @joined_event_id.include? x.id\n # do nothing\n else\n @events << x\n end\n end\n else\n @events = Event.all\n end\n respond_to do |format|\n format.json\n format.html\n end\n end", "def index\n\n # Analytics::Visitor.recent.with_user.including_events.ordered\n @visitors_with_users = Analytics::Visitor.find(:all, :conditions=>{\n :created_at.gt=>1.month.ago.utc,\n :user_id.ne=>nil,\n }, :order=>'created_at DESC')\n\n # @visitors_without_users = Analytics::Visitor.recent.without_user.ordered\n @visitors_without_users = Analytics::Visitor.find(:all, :conditions=>{\n :created_at.gt=>1.month.ago.utc,\n :user_id=>nil,\n }, :order=>'created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def index\n if user_signed_in?\n # for signed in members\n @events = Event.ordered.published.all\n @meetings = Event.meeting.ordered.published.tease.all\n @air_shows = Event.air_show.ordered.published.all\n @special = Event.special.ordered.published.all\n @maint = Event.maint.ordered.published.tease.all\n else\n # for general public\n @events = Event.confirmed.ordered.published.all\n @meetings = Event.meeting.confirmed.ordered.published.tease.all\n @air_shows = Event.air_show.confirmed.ordered.published.all\n @special = Event.special.confirmed.ordered.published.all\n @maint = Event.maint.confirmed.ordered.published.tease.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end", "def index\n if user_is_admin?\n @events = Event.all\n else\n @events = Event.published\n end\n\n end", "def index\n @events = Event.where(['(events.user_id= ? OR guests.user_id = ?)', current_user.id, current_user.id])\n #@events = @events.where(['date >= ?', Date.today])\n @events = @events.includes([:guests, :setting])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end", "def events\n @events = registered_application.events.group_by(&:name)\n end", "def show\n @users = @event.users\n\n unless current_user.super_user\n unless @users.include?(current_user)\n flash[:warning] = t(\"oops_not_access\")\n redirect_to root_path\n end\n end\n end", "def events\n return @events\n end", "def index\n @session_events = SessionEvent.all\n end", "def show\n @events = @user.events\n @rides = @user.rides\n @lostandfounds = @user.lostandfounds\n end", "def index\n if params[:user_id]\n @events = User.find(params[:user_id]).events\n else\n @events = Event.all\n end\n @events = @events.order(start_time: :desc)\n .where(\"start_time > ?\", DateTime.now)\n .limit(params[:count])\n .includes(:non_profit)\n .reverse\n end", "def show\n @events = fetch_events\n end", "def index\n @github_events_by_date ||= begin\n if user_signed_in?\n Github::Event.user_events_by_day current_user_github_access_token,\n current_user_github_username\n else\n []\n end\n end\n end", "def index\n if current_user.admin?\n @event_logs = EventLog.by_mode_type(@mode_type).by_event_type(@event_type).order('id DESC').paginate(:page => @page,:per_page => @per_page)\n else\n @event_logs = EventLog.by_initiator(current_user.supervisor).by_mode_type(@mode_type).by_event_type(@event_type).order('id DESC').paginate(:page => @page,:per_page => @per_page)\n end\n end" ]
[ "0.7566623", "0.7542958", "0.7542518", "0.7511469", "0.7511469", "0.74976957", "0.7456328", "0.7407255", "0.73882276", "0.73038083", "0.72804844", "0.72355795", "0.72355795", "0.72355795", "0.72336775", "0.7198785", "0.718884", "0.7166841", "0.7159458", "0.7137566", "0.71147966", "0.71064466", "0.7093242", "0.70723414", "0.7033797", "0.70100844", "0.6989481", "0.69858426", "0.69750595", "0.6968767", "0.6956727", "0.69468796", "0.6915832", "0.6915832", "0.6904518", "0.6899046", "0.6896899", "0.68853873", "0.6850671", "0.6820542", "0.68179184", "0.674855", "0.6746533", "0.6736209", "0.67329484", "0.67289", "0.67031825", "0.668541", "0.6664801", "0.6663787", "0.6663313", "0.66618973", "0.6657608", "0.66562575", "0.664956", "0.6641511", "0.6635564", "0.66343874", "0.66342235", "0.65717083", "0.6569175", "0.65689886", "0.656788", "0.65596884", "0.65523714", "0.6544131", "0.6537745", "0.6525138", "0.65097654", "0.64896744", "0.6483576", "0.64728117", "0.646488", "0.6462463", "0.6462164", "0.6461991", "0.64505136", "0.6441812", "0.64412373", "0.6424168", "0.64114493", "0.6406026", "0.6406026", "0.64027005", "0.6402404", "0.6395061", "0.63906974", "0.63751405", "0.63644207", "0.6354093", "0.6348971", "0.63485247", "0.634847", "0.6342395", "0.63326234", "0.6330382", "0.63297045", "0.6322689", "0.6322347", "0.63164186" ]
0.7074752
23
get a list of download events that are identified by user
def get_all_identified_download_events FileDownloadStat.where( 'user_id is not NULL' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end", "def events(user)\n get(:standard, {:method => \"user.getEvents\", :user => user})\n end", "def user_events\n @user_events ||= users.map { |u| u.events }.flatten\n end", "def received_events(user, options={})\n get(\"/users/#{user}/received_events\", options, 3)\n end", "def user_events(user, options={})\n get(\"/users/#{user}/events\", options, 3)\n end", "def get_events\n # events created by this user\n @my_events = User.find(current_user.id).event_attendants.where('owner = 1')\n\n # events this user has joined\n @joined_events = User.find(current_user.id).event_attendants.where('attendee_status = 3 and owner IS NULL')\n \n # events this user is invited to\n @invited_to_events = User.find(current_user.id).event_attendants.where('attendee_status = 0')\n\n @maybe_events = User.find(current_user.id).event_attendants.where('attendee_status = 2')\n end", "def getFinishedEvents(u, b)\n @es = []\n if u != nil\n @alles = User.find_by(id: u).events\n @alles.each do |e|\n if eventEnded(e) && (b ? e.private : true)\n @es.push(e)\n end\n end\n end\n return @es\n end", "def events_for_user (user_id)\n events_users.includes(:event).where(\"events_users.user_id=?\",user_id)\n end", "def user_events(user_id=self.username, options={})\n response = connection.get do |req|\n req.url \"/users/#{user_id}/events\", options\n end\n response.body.activity\n end", "def events\n event.user.events.where(:timestamp => beginning...ending)\n end", "def events(count: 150, startId: nil)\n data = get '', resource: 'userEvent', count: count, startId: startId\n data.userEvents\n end", "def events(service, url, args)\n events = []\n ret = service.send_request(GData4Ruby::Request.new(:get, url, nil, nil, args))\n REXML::Document.new(ret.body).root.elements.each(\"entry\"){}.map do |entry|\n entry = GData4Ruby::Utils.add_namespaces(entry)\n e = GCal4Ruby::Event.new(service)\n if e.load(entry.to_s)\n events << e\n end\n end\n return events\nend", "def index\n if params[:u]\n @events = User.find(params[:u]).events\n else\n @events = Event.all\n end\n end", "def events\n @events ||= user_events.concat(org_events).uniq\n end", "def events_for_authenticated_user page\n events = api_client.received_events(authenticated_user, page: page)\n filter_events events\n end", "def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend", "def download_events(apiEngine)\n @events = []\n results = []\n results = apiEngine.client.execute!(\n :api_method => apiEngine.api.events.list,\n :parameters => {\n :calendarId => @ident,\n :singleEvents => true,\n :orderBy => 'startTime',\n :timeMin => @dateMin.iso8601,\n :timeMax => @dateMax.iso8601 })\n\n results.data.items.each do |event|\n if event.start.date_time\n fulldate = event.start.date_time.strftime(\"%B, %d, %Y\")\n month = fulldate.split(',')[0]\n day = fulldate.split(',')[1]\n year = fulldate.split(',')[2]\n else\n fulldate = event.start.date.to_s\n month = fulldate.split('-')[1].to_i\n month = I18n.t(\"date.month_names\")[month]\n day = fulldate.split('-')[2]\n year = fulldate.split('-')[0]\n end\n @events.push(Event.new(event.creator.email, year, month, day, :summary => event.summary))\n end\n end", "def getUnfinishedEvents(u)\n @es = []\n if u != nil\n @alles = User.find_by(id: u).events\n @alles.each do |e|\n if !eventEnded(e)\n @es.push(e)\n end\n end\n end\n return @es\n end", "def received_events(user, options = {})\n paginate \"#{User.path user}/received_events\", options\n end", "def get_events\n events = [] \n @log ||= Rails.logger\n Appsterdam::Application.ical_subscriptions.each do |options|\n @log.info \"getting events from #{options[:url]}\"\n components = parse_ical(options[:url])\n events.concat(extract_events(components.first))\n end\n @log.info \"done importing iCal events.\"\n \n events\n end", "def fetch_events\n params = {'calendarId' => CONFIG[:cal_id], \n 'orderBy' => 'startTime',\n #'timeMax' => Time.utc(CONFIG[:year].to_i + 1, 4, 1).iso8601, \n #'timeMin' => Time.utc(CONFIG[:year].to_i, 4, 1).iso8601,\n 'singleEvents' => 'True'}\n \n result = @client.execute(:api_method => @cal.events.list, :parameters => params)\n\n @events_list = []\n result.data.items.each do |item|\n @events_list << item\n end\n end", "def my_events\n @events = []\n Event.all.each do |event|\n if (event.creator == current_user.id)\n @events << event\n end\n end\n end", "def fetch\n @start_time ||= (Time.current - 1.minute).to_i * 1000\n $mw_log.debug \"Catching Events since [#{@start_time}]\"\n\n new_events = @alerts_client.list_events(\"startTime\" => @start_time, \"tags\" => \"miq.event_type|*\", \"thin\" => true)\n @start_time = new_events.max_by(&:ctime).ctime + 1 unless new_events.empty? # add 1 ms to avoid dups with GTE filter\n new_events\n rescue => err\n $mw_log.info \"Error capturing events #{err}\"\n []\n end", "def event_list\n events_list\n end", "def audio_events(user)\n user = Access::Validate.user(user, false)\n AudioEvent\n .where('(audio_events.creator_id = ? OR audio_events.updater_id = ?)', user.id, user.id)\n .order('audio_events.updated_at DESC')\n end", "def events\n data.events\n end", "def downloaded\n files_list = []\n files = session[:user].x_files.all(:downloads.gte => 1, uploaded: true)\n files.each { |file| files_list.push(file.description(session[:user])) }\n @result = { files: files_list, success: true }\n end", "def feed\n if current_user\n feed = []\n Event.where(user_id: current_user.id).each do |event|\n event.comments.each do |comment|\n if (DateTime.current - comment.created_at.to_datetime).to_f < (DateTime.current - current_user.last_sign_in.to_datetime).to_f\n feed << event.name << comment\n end\n end\n event.file_attachments.each do |file|\n if (DateTime.current - file.created_at.to_datetime).to_f < (DateTime.current - current_user.last_sign_in.to_datetime).to_f\n feed << event.name << file\n end\n end\n end\n respond_with feed\n else\n redirect_to root_path\n end\n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def events\n data[\"events\"]\n end", "def get_events(trace: false, &block)\n r = dropbox_query(query: '2/team_log/get_events', trace: trace)\n r['events'].each(&block)\n while r['has_more']\n r = dropbox_query(query: '2/team_log/get_events/continue', query_data: \"{\\\"cursor\\\":\\\"#{r['cursor']}\\\"}\", trace: trace)\n r['events'].each(&block)\n end\n end", "def index\n @events = Event.last_events(current_user, 3)\n end", "def events\r\n load_private_events\r\n load_completed_private_events\r\n end", "def events *args\n Xmlstats::Endpoints::Events.fetch *args\n end", "def index\n @created_events = current_user.created_events\n @invited_events = current_user.invited_events\n @attending_events = current_user.attending_events\n end", "def index\n @events = Event.where( \"user_id = ?\", current_user.id )\n end", "def events_about_users opts = {:limit => 4 }\n # FIXME: TO nooisy for your own items.. neeeds better filtering, for\n # example, removingn events about items conceerning actions I took\n #events = %w(user.follow.user user.update.item.* user.comment.* user.add.item)\n events = %w(user.follow.user user.comment.* )\n current_user.events_where(events).last(opts[:limit])\n end", "def received_public_events(user, options = {})\n paginate \"#{User.path user}/received_events/public\", options\n end", "def index\n @events = Event.where(user_id: current_user.id)\n end", "def fGetSubscribedEventsFrom(email)\n @users.getSubscribedEventsFrom(email)\n end", "def get_available_users(event)\n event.teamsheet_entries_available.collect{|tse| tse.user_id.to_s}\n end", "def events(dbname, &block)\n # can't use RestClient.get b/c of :block_response\n RestClient::Request.execute(:method => :get,\n :url => root_url('events', @storage, dbname),\n :headers => {:accept => \"text/event-stream\"},\n :block_response => block, &HANDLE_RESPONSE)\n end", "def getEventNotifications(u, e)\n @result = []\n @ns = Notification.all\n @ns.each do |n|\n if u == nil\n if (n.notification_type == 3 || n.notification_type == 4) && n.sender_id == e.to_i\n @result.push(n)\n end\n else\n if (n.notification_type == 3 || n.notification_type == 4) && n.sender_id == e.to_i && n.user_id == u.to_i\n @result.push(n)\n end\n end\n end\n return @result\n end", "def index\n @user_events = UserEvent.all\n end", "def index\n @user_events = UserEvent.all\n end", "def index\n @user_events = UserEvent.all\n end", "def events_for target, event_types\n url = GITHUB_EVENT_API_END_POINT % target\n etag = @etag_hash[target]\n last_event = @last_event_hash[target]\n\n events_to_send = []\n page = 1\n while page <= 10\n result = @clnt.get(url, {client_id: @client_id, client_secret: @client_secret}, {\"If-None-Match\" => etag})\n break unless result.status_code == 200\n events = JSON.load result.body\n if page == 1 # etag and last event should be set when querying the very first page\n @etag_hash[target] = result.header[\"etag\"]\n @last_event_hash[target] = events[0]\n end\n\n events.each do |event|\n return events_to_send if last_event == event # no need to proceed\n events_to_send << event if event_types.accept? event\n end\n\n page += 1\n end\n\n events_to_send\n end", "def index\n @events = current_user.account.events\n end", "def filter(event)\n\thost = event.get(\"[agent][name]\")\n \tfilename = event.get(\"[file][name]\")\n\tfile_path = event.get(\"[file][directory_local]\")\n\tfile_patharray = file_path.split(/\\/([^\\/]*)$/)\n\tfile_id = file_patharray[-1]\n\tdownloadsurl = \"/c2logs/\" + \"#{host}\" + \"/cobaltstrike/downloads/\" + \"#{file_id}\" + \"_\" + \"#{filename}\"\n\tevent.tag(\"_rubyparseok\")\n \tevent.set(\"[file][url]\", downloadsurl)\n\treturn [event]\nend", "def index\n @user = current_user\n @events = @user.events.all\n end", "def user_events(user_events_array)\n \tuser_events_array.map do |user_event|\n \t\tuser_event.event\n \tend\n end", "def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end", "def events(artist)\n get(:standard, {:method => \"artist.getEvents\", :artist => artist})\n end", "def events(param = nil)\n request = new_request Net::HTTP::Report do |request|\n request.body = CalendarQuery.new.event(param).to_xml\n end\n response = perform_request request\n \n events = []\n \n body = Nokogiri::XML.parse(response.body)\n namespaces = { 'dav' => \"DAV:\", 'caldav' => 'urn:ietf:params:xml:ns:caldav' }\n \n body.search(\"./dav:multistatus/dav:response\", namespaces).each do |element|\n calendar_data = element.search(\"./dav:propstat/dav:prop/caldav:calendar-data\", namespaces)\n calendar = Icalendar::Parser.new(calendar_data.text).parse.first\n calendar.events.each do |event|\n event.caldav = {\n :etag => element.search(\"dav:propstat/dav:prop/dav:getetag\", namespaces).text, \n :href => element.search(\"dav:href\", namespaces).text\n }\n events += calendar.events\n end\n end\n \n events\n end", "def index\n @event_tasks = EventTask.user_event_tasks(current_user)\n end", "def index\n @events = current_user.super_user ? Event.all : current_user.events\n end", "def index\n @events = current_user.events\n end", "def index\n @events = current_user.events\n end", "def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def audio_event_imports(user, include_admin: true)\n user = Access::Validate.user(user, false)\n\n return AudioEventImport.all if include_admin && Access::Core.is_admin?(user)\n\n AudioEventImport\n .where('(audio_event_imports.creator_id = ? OR audio_event_imports.updater_id = ?)', user.id, user.id)\n .order('audio_event_imports.updated_at DESC')\n end", "def users\n @users = Event.find(params[:id]).users\n end", "def all(params = {})\n req = WebPay::EventListRequest.create(params)\n raw_response = @client._request(:get, 'events', req)\n WebPay::EventResponseList.new(raw_response)\n end", "def event_list\n @_events\n end", "def entries(limit=nil)\n limit ||= -1\n LiveJournal::Request::GetEvents.new(@user, :recent => limit, :strict => false).run\n end", "def listOfSubscribedEvents (bookieEmail)\r\n events = @BetESS.fMapOfAllEvents\r\n subscribedEvents = @BetESS.fGetSubscribedEventsFrom(bookieEmail)\r\n\r\n puts \"\\t\\tSubscribed Events:\"\r\n subscribedEvents.each {|eventID| puts \"#{events[eventID].toString}------\"}\r\n puts \"########\"\r\n end", "def index\n @events = []\n Event.all.each do |event|\n if (event.creator != current_user.id)\n @events << event\n end\n end\n end", "def events\n @events ||= []\n @events\n end", "def show\n @users = @event.users\n end", "def index\n @github_events_by_date ||= begin\n if user_signed_in?\n Github::Event.user_events_by_day current_user_github_access_token,\n current_user_github_username\n else\n []\n end\n end\n end", "def index\n @events_users = EventsUser.all\n end", "def index\n @events_users = EventsUser.all\n end", "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "def events\n event_lookup()\n end", "def events\n event_lookup()\n end", "def get_file_events(gf_pid, obj_identifier)\n query = \"select intellectual_object_id, institution_id, \" +\n \"identifier, event_type, date_time, detail, \" +\n \"outcome, outcome_detail, outcome_information, \" +\n \"object, agent, generic_file_id, generic_file_identifier \" +\n \"from premis_events_solr where generic_file_id = ?\"\n if @file_events_query.nil?\n @file_events_query = @db.prepare(query)\n end\n result_set = @file_events_query.execute(gf_pid)\n events = []\n result_set.each_hash do |row|\n events.push(get_event(row, obj_identifier))\n end\n events\n end", "def events\n @events = registered_application.events.group_by(&:name)\n end", "def show\n @events_ordered = Event.order('startdate ASC')\n joined_event = []\n event_user = []\n if params[\"from\"]==\"myevents\"\n act = Active.where(user_id: current_user.id)\n act.each do |active|\n joined = @events_ordered.find(active.event_id)\n if joined.user_id != current_user.id\n joined_event << joined\n end\n end\n\n event_user = @events_ordered.where(user_id: current_user.id)\n ev = joined_event + event_user\n @user_events = ev.paginate(page: params[:page], per_page: 5)\n else\n @user_events = @user.events.paginate(page: params[:page], per_page: 5)\n end\n end", "def download_list\n task = params[:task]\n files = []\n\n case task\n when DOWNLOAD_ACTION, OPEN_ACTION, COPY_ACTION, COPY_TO_PRIVATE_ACTION\n nodes = Node.accessible_by(@context).where(id: params[:ids])\n nodes.each { |node| files += node.is_a?(Folder) ? node.all_files : [node] }\n when PUBLISH_ACTION\n nodes = Node.editable_by(@context).\n where(id: params[:ids]).\n where.not(scope: UserFile::SCOPE_PUBLIC)\n nodes.each do |node|\n files += if node.is_a?(Folder)\n node.all_files(Node.where.not(scope: UserFile::SCOPE_PUBLIC))\n else\n [node]\n end\n end\n when DELETE_ACTION\n nodes = Node.editable_by(@context).where(id: params[:ids]).to_a\n files += nodes\n nodes.each { |node| files += node.all_children if node.is_a?(Folder) }\n files.filter! { |file| file.scope == params[:scope] }\n else\n raise ApiError, \"Parameter 'task' is not defined!\"\n end\n\n render json: files,\n each_serializer: FileActionsSerializer,\n scope_name: params[:scope] || SCOPE_PRIVATE,\n action_name: task\n end", "def upcoming_events(order_by: self.class::START_OLDEST_FIRST,\n status: self.class::ALL)\n EventbriteSDK::ResourceList.new(\n url_base: \"#{path}/events\",\n object_class: EventbriteSDK::Event,\n key: 'events',\n query: {\n order_by: order_by,\n status: status\n }\n )\n end", "def show\n @events = Event.find(params[:id])\n @users = @events.users\n end", "def events\n collection(\"events\")\n end", "def load_completed_events\r\n @completed_events = Event.find(:all, \r\n :conditions => [\"user_id = \"\\\r\n \"#{session[:user_id]} and ends < CURRENT_DATE()\"] ,\r\n :order => 'begins ASC')\r\n end", "def past_events(user, options={})\n get(:standard, {:method => \"user.getPastEvents\", :user => user}.merge(options))\n end", "def show\n\n # update_event_archive\n @all_event_details = []\n @event_accepts = {}\n\n # Get all the Events for the user\n @events = Eventuser.joins(\"LEFT OUTER JOIN events ON events.id = eventusers.event_id\").where('user_id = ?',params[:id]).order('events.startime desc')\n\n @pending_invites = 0\n\n # Get details for those Event\n @events.each do |e|\n @event_accepts[e.event_id] = e.status # Display status in User view page\n @event_array = Event.find(e.event_id)\n if e.status == 0 && @event_array.endtime > DateTime.now\n @pending_invites = @pending_invites + 1\n end\n @all_event_details.push(@event_array)\n end\n end", "def events\n @even = @user.created_events.order('created_at DESC')\n @events = @even.paginate(:page => params[:page])\n end", "def add_download(user: nil)\n self.events.build(event_type: Event::Type::DOWNLOAD,\n description: \"Download\",\n happened_at: Time.now,\n user: user).save!\n owning_ids = self.item.owning_ids\n institution_id = owning_ids['institution_id']\n unit_id = owning_ids['unit_id']\n collection_id = owning_ids['collection_id']\n return unless institution_id && unit_id && collection_id\n MonthlyItemDownloadCount.increment(self.item)\n MonthlyCollectionItemDownloadCount.increment(collection_id)\n MonthlyUnitItemDownloadCount.increment(unit_id)\n MonthlyInstitutionItemDownloadCount.increment(institution_id)\n end", "def events\n return @events\n end", "def my_asists\n @events = []\n Attend.all.each do |attend|\n if (attend.userID == current_user.id)\n @events << Event.find(attend.eventID)\n end\n end\n end", "def get_events\t\t\t\n @task = UserEvent.where(\"user_id\"=>current_user.id)\n events = []\n @task.each do |task|\n events << {:id => task.id, :title => task.title, :start => DateTime.parse(task.start.to_s).strftime(\"%Y-%m-%d\"), :end => DateTime.parse(task.end.to_s).strftime(\"%Y-%m-%d\") }\n end\n render :text => events.to_json \n end", "def index\n @events = Event.all.order(:date)\n @admin_events = @events.select{|event| event.owner == current_user}\n @other_events = @events.reject{|event| event.owner == current_user}\n end", "def index\n if params[:user_id]\n @events = User.find(params[:user_id]).events\n else\n @events = Event.all\n end\n @events = @events.order(start_time: :desc)\n .where(\"start_time > ?\", DateTime.now)\n .limit(params[:count])\n .includes(:non_profit)\n .reverse\n end", "def show\n @events = Event.where(user_id: current_user.id).order('created_at DESC')\n end", "def record_file_download_event( id, user = nil )\n puts \"==> file download event: file id #{id}\"\n event = find_todays_existing_download_event( id, user )\n if event.nil? == false\n event.downloads += 1\n else\n event = create_new_download_event( id, user )\n end\n save_safely( event )\n end", "def events\n @finity.events.map { |name, _| name }\n end", "def owned_events\n events\n end", "def user_events(user, options = {})\n paginate \"#{User.path user}/events\", options\n end", "def events\n results = @client.execute(\n :api_method => @calendar.events.list,\n :authenticated => false,\n :parameters => {\n 'calendarId' => @config[:calendar_id],\n 'fields' => 'items(start,end,summary)',\n 'singleEvents' => true,\n 'orderBy' => 'startTime',\n 'timeMin' => DateTime.now.to_s,\n 'timeMax' => (DateTime.now + 7).to_s,\n 'q' => 'LIVE'\n }\n )\n\n results.data.items.map do |event|\n summary = event.summary.gsub(/^LIVE:\\s+/, '')\n CalendarEvent.new(summary, event.start.date_time, event.end.date_time)\n end\n end", "def index\n @events = Event.order(:time).order(:date)\n \n fetch_calendar 'tgbgmclhk5gegn8t95fvqov0s8@group.calendar.google.com'\n end", "def events\n metadata['events'].sort_by! { |event| event['timestamp'] }\n end", "def fetch_watchers\n watcher_users.to_a\n end" ]
[ "0.7129182", "0.6950252", "0.6779924", "0.6691374", "0.66705525", "0.66536707", "0.663865", "0.6558381", "0.65138316", "0.6416778", "0.6413463", "0.6338472", "0.6275424", "0.62752295", "0.6199955", "0.6180463", "0.6153745", "0.6120297", "0.6106054", "0.60949737", "0.6090307", "0.6089397", "0.60718817", "0.60665333", "0.60578585", "0.60439736", "0.60437816", "0.6021875", "0.60101205", "0.600751", "0.5989486", "0.5963476", "0.59627026", "0.59515953", "0.5949007", "0.59341216", "0.5928408", "0.59196234", "0.5908648", "0.59070444", "0.59067756", "0.5904687", "0.5899888", "0.5894179", "0.5894179", "0.5894179", "0.5877397", "0.587208", "0.5868426", "0.5865546", "0.58630234", "0.58547616", "0.5853618", "0.58518165", "0.5851348", "0.5850411", "0.58302635", "0.58302635", "0.58256096", "0.58098674", "0.5809543", "0.57925105", "0.57679945", "0.5767838", "0.576602", "0.5760234", "0.5758805", "0.5753534", "0.5750098", "0.574371", "0.574371", "0.57327265", "0.5719677", "0.5719677", "0.56981987", "0.5693768", "0.5686234", "0.56692195", "0.56662273", "0.5659826", "0.56588227", "0.5657849", "0.5643583", "0.5641553", "0.5632654", "0.56298554", "0.5603558", "0.5603137", "0.55963075", "0.559579", "0.5586921", "0.55837774", "0.5571864", "0.5571328", "0.5565863", "0.5561104", "0.55524844", "0.55489653", "0.55464", "0.55451286" ]
0.8038649
0
anonymize the supplied view event
def anonymize_work_view_event( view_event ) # find an anomomyzed version event = find_existing_view_event( view_event.date, view_event.work_id, nil ) if event.nil? == false event.work_views += view_event.work_views else event = create_new_view_event( view_event.work_id, nil ) event.date = view_event.date end save_safely( event ) view_event.destroy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_event(user, event) \n\tend", "def onReturn(view)\n end", "def _view; end", "def method_missing(method, *args, &block)\n view.send(method, *args, &block)\n end", "def add_view(view)\n\n # Enter\n view.signal_connect('motion-notify-event') do |view, event|\n motion_handler(view, event)\n end\n\n # Leave\n view.signal_connect('leave-notify-event') do |view, event|\n leave_handler(view, event)\n end\n end", "def method_missing(method, *args, &block)\n if @view.respond_to?(method)\n (class << self; self; end).class_eval do\n delegate method, to: :@view\n end\n self.send method, *args, &block\n else\n super\n end\n end", "def method_missing(*args, &block)\n @_view.send(*args, &block)\n end", "def handle_event(event)\n\n\t\tend", "def rendered_views=(_arg0); end", "def event; end", "def event; end", "def event; end", "def event_change\n\t\n\tend", "def view; end", "def on_view(definition, &block)\n on(definition, true, &block)\n end", "def view_modal\n handle_view\n end", "def initialize(view)\n @view = view\n end", "def set_view(view)\n add_actions \"SetView(#{view})\"\n end", "def view_flow=(_arg0); end", "def apply(raw_event); end", "def events=(_); end", "def view\n end", "def move_view\n super\n end", "def add_view\n super\n end", "def mouseUp event\n return if viewAtPoint(convertPoint(event.locationInWindow, fromView:nil)).nil?\n super(event) \n end", "def initialize(view)\n @view = view\n end", "def initialize(view)\n @view = view\n end", "def apphelp_event( event, ctrl = controller )\n apphelp_view_hint( \"event_#{ event }\", ctrl )\n end", "def event_model(model); self.model.event_model(model) end", "def AddViewUpdateEventsHandler(arg0)\n ret = _invoke(1610744231, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "def show\n @event = @event.decorate\n end", "def view\n @_view\n end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def clicked(e)\n \n end", "def define_event_helpers; end", "def change_view\n session[:view_id] = params[:view]\n # Clear session[:order] since this view might not have the same columns\n session[:order_column_id] = nil\n respond_to do |wants|\n wants.html { redirect_to(directory_people_path(:format => :html)) }\n wants.js do\n render :update do |page|\n page.redirect_to(directory_people_path(:format => :html))\n end\n end\n end\n end", "def human_event; end", "def view view, &block\n @views[view]\n if block\n raise \"Nested views not supported\" if @current_view\n @current_view = view\n self.instance_eval &block\n @current_view = nil\n end\n end", "def leave_handler(view, event)\n hide_me()\n end", "def update(view, object)\n raise NotImplementedError\n end", "def view_flow; end", "def type ; :event ; end", "def motion_handler(view, event)\n\n path = view.get_path_at_pos(event.x, event.y)\n\n if (@enabled and path)\n path, col, x, y = path\n tooltip = get_tooltip(view, col, path)\n if tooltip\n tooltip = tooltip.strip\n queue_next( [path, col], tooltip, event.x_root, event.y_root)\n return\n end\n end\n\n hide_me()\n end", "def onCancel flag, view\n ## puts \"onCancel called\"\n\t\tself.reset(view)\n\tend", "def handle(event)\n raise NotImplementedError\n end", "def events\n end", "def add_view(listener)\n @views.add listener\n end", "def event_tag(tag)\n case tag\n when \"NAME\" then tag\n else super(tag)\n end\n end", "def onRButtonUp(flags, x, y, view)\n end", "def onCancel(flag, view)\n self.reset(view)\n end", "def view_select_statement(view, name=nil)\n raise NotImplementedError, \"view_select_statement is an abstract method\"\n end", "def form_view\n end", "def onLButtonUp(flags, x, y, view)\n end", "def configure_events(model, view)\n command_queue.each do |cmd|\n case\n when cmd.is_a?(EventCommand)\n view.add_command(cmd)\n when cmd.is_a?(TimedCommand)\n view.add_timer(cmd)\n view.proxy.start_timer(cmd)\n when cmd.is_a?(BehaviorCommand)\n model.add_command cmd\n end unless cmd.attached?\n end\n end", "def add_view_option(opts)\n opts = check_params(opts,[:view_infos])\n super(opts)\n end", "def process_event(*a)\n parent.process_event(*a) if parent\n super\n end", "def visible!(view, context:)\n run_callback(ViewModel::Callbacks::Hook::BeforeVisit, view, context)\n run_callback(ViewModel::Callbacks::Hook::AfterVisit, view, context)\n end", "def method_missing(method, *args, &block)\n @view.send(method, @selector, *args, &block)\n self\n end", "def loc_view\n \n end", "def set_view_option(opts)\n opts = check_params(opts,[:view_infos])\n super(opts)\n end", "def method_missing( *args )\r\n view = @view\r\n method = args.first\r\n if view.respond_to?(method)\r\n view.send(*args)\r\n else\r\n raise NoMethodError, \"undefined method `#{method}' for #{self.class.name}\"\r\n end\r\n end", "def after_view_setup\n end", "def showEvent(p_event)\n super(p_event)\n\t\t\t\n\t\t\t# Initialize once, reuse state afterwards\n\t\t\tunless @initialized\n\t\t\t\t@initialized = true\n\t\t\t\tcreate_remove_button\n\t\t\tend\n\t\t\t\n\t\t\t# Notify state changed\n\t\t\tstate_changed\n\t\tend", "def method_missing( *args )\n view = @view\n method = args.first\n if view.respond_to?( method )\n view.send(*args)\n else\n raise NoMethodError, \"undefined method `#{method}' for #{self.class.name}\"\n end\n end", "def view( model, view, assigns = {} )\n self << Waves.main::Views[ model ].process( request ) do\n send( view, assigns )\n end\n end", "def vieworder\n end", "def send_events=(_arg0); end", "def onCancel(flag, view)\n self.reset(view)\nend", "def RemoveViewUpdateEventsHandler(arg0)\n ret = _invoke(1610744232, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "def method_missing(sym, *args, &block)\n if matches = sym.to_s.match(/^.*(?=_view$)|view$/)\n return Tanuki::Loader.run_template(\n {},\n self,\n matches[0].to_sym,\n *args,\n &block\n )\n end\n super\n end", "def showEvent(p_event)\n\t\t\n\t\t\t# Only initialize form once, reuse state afterwards\n\t\t\tunless @initialized\n\t\t\t\t@initialized = true\n\t\t\t\t\n\t\t\t\tcreate_path_edit\n\t\t\t\tcreate_shell_tree_view\n\t\t\tend\n\t\t\t\n\t\tend", "def on_keyup(key, view)\n return unless key == CONSTRAIN_MODIFIER_KEY\n return if @axis_lock\n\n # Calling this method with no argument unlocks inference.\n view.lock_inference\n end", "def view(page, *)\n rails_render(action: page.tr(\"-\", \"_\"), layout: true) ||\n rails_render(html: super.html_safe, layout: true)\n end", "def set_common_view_name\n @view_name = \"message_view\"\n @params = params\n end", "def altered_world_event; end", "def view(opts)\n opts = check_params(opts,[:view_names])\n super(opts)\n end", "def onRButtonDoubleClick(flags, x, y, view)\n end", "def attach_view(view)\n @views << view\n end", "def onLButtonDoubleClick(flags, x, y, view)\n end", "def update!(**args)\n @response_view = args[:response_view] if args.key?(:response_view)\n end", "def view()\n @view\n end", "def url_for_event type, opts={}\n p = HashWithIndifferentAccess.new\n parent_controller.request.parameters.each do |k,v|\n if k.end_with? \"_id\" or k == \"id\"\n p[k] = v\n end\n end\n\n super type, p.merge(opts)\n end", "def footer_button_view_listener view_element\n #some business_code here\n end", "def do_action(event)\n case event.class.to_s\n when 'CellClickEvent'\n place_counter(event.col)\n when 'ForfeitClickEvent'\n forfeit\n when 'CounterSelectedEvent'\n @counter_select = event.index\n false\n else\n false\n end\n end", "def event_params\n\n\n end", "def event\r\n @event\r\n @comments\r\n @replies \r\n end", "def change(event)\n event\n end", "def view_info\n super\n end", "def qualified_event; end", "def qualified_event; end", "def calendar_view=(value)\n @calendar_view = value\n end", "def editing ; view.editing ; end", "def clicked;end" ]
[ "0.71625125", "0.6134325", "0.60869074", "0.60780245", "0.5967921", "0.58964616", "0.58817226", "0.58296645", "0.5809241", "0.5784003", "0.5784003", "0.5784003", "0.57759327", "0.5769606", "0.5730399", "0.57269883", "0.5724026", "0.57028395", "0.56849414", "0.5674232", "0.56735647", "0.56700945", "0.5613526", "0.56105876", "0.5581947", "0.55534005", "0.5548432", "0.54423296", "0.5440053", "0.5432242", "0.54255134", "0.54010576", "0.5366868", "0.5366868", "0.5366868", "0.5366868", "0.5366868", "0.5366868", "0.5366868", "0.5366868", "0.5362846", "0.53467065", "0.53332186", "0.52838117", "0.52625865", "0.52361274", "0.5222774", "0.5207483", "0.52067703", "0.5200938", "0.5198949", "0.51820713", "0.5177747", "0.5173833", "0.514806", "0.51425564", "0.5141857", "0.51379734", "0.5131046", "0.51296234", "0.51237744", "0.512172", "0.5116827", "0.5112839", "0.51118904", "0.51100373", "0.510061", "0.5092264", "0.5083201", "0.5078062", "0.50756913", "0.50748885", "0.5070563", "0.50698566", "0.5064645", "0.50541836", "0.5045457", "0.5043625", "0.50196576", "0.50156987", "0.501334", "0.5012669", "0.5011808", "0.50090086", "0.49893144", "0.4979697", "0.49794945", "0.4974981", "0.49730954", "0.4969528", "0.49665844", "0.49653772", "0.49606082", "0.49568683", "0.49368238", "0.49344698", "0.49344698", "0.49297047", "0.49206164", "0.4917201" ]
0.64028484
1
anonymize the supplied download event
def anonymize_file_download_event( download_event ) # find an anomomyzed version event = find_existing_download_event( download_event.date, download_event.file_id, nil ) if event.nil? == false event.downloads += download_event.downloads else event = create_new_download_event( download_event.file_id, nil ) event.date = download_event.date end save_safely( event ) download_event.destroy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download(event)\n info \"Finished downloading updates\"\n end", "def method_missing(name, *args, &block)\n case name\n when :download then deprecated_download(*args, &block)\n else\n super\n end\n end", "def record_file_download_event( id, user = nil )\n puts \"==> file download event: file id #{id}\"\n event = find_todays_existing_download_event( id, user )\n if event.nil? == false\n event.downloads += 1\n else\n event = create_new_download_event( id, user )\n end\n save_safely( event )\n end", "def get_download\n\tend", "def filter(event)\n\thost = event.get(\"[agent][name]\")\n \tfilename = event.get(\"[file][name]\")\n\tfile_path = event.get(\"[file][directory_local]\")\n\tfile_patharray = file_path.split(/\\/([^\\/]*)$/)\n\tfile_id = file_patharray[-1]\n\tdownloadsurl = \"/c2logs/\" + \"#{host}\" + \"/cobaltstrike/downloads/\" + \"#{file_id}\" + \"_\" + \"#{filename}\"\n\tevent.tag(\"_rubyparseok\")\n \tevent.set(\"[file][url]\", downloadsurl)\n\treturn [event]\nend", "def cmd_download\n raise NotImplementedError, \"Subclass must implement cmd_download()\"\n end", "def process_download(options = {})\n @download = Download.process(self, options)\n end", "def on_session_download(session, remote_path, local_path)\n\tend", "def download_original ; path_download_file(:original).download end", "def download_url\n process_emulation 10\n clear_progress_bar\n self.downloaded_at = Time.now.utc\n save! && ready!\n end", "def download\r\n download = Download.find params[:id]\r\n \r\n # If this download is available only after login, execute an authentication process.\r\n return if download.restrict && !user_authentication\r\n \r\n # Download contains an agreement\r\n if download.agreement\r\n # Redirect to the agreement page if it is a GET request.\r\n unless request.post?\r\n render :partial => 'agreement', :object => download.agreement, :layout => true\r\n return false\r\n end\r\n \r\n if params[:commit] == 'Accept'\r\n # User accept this agreement, log this event and then continue.\r\n agreement_log = AgreementLog.create(\r\n :agreement => download.agreement,\r\n :download => download,\r\n :remote_ip => request.remote_ip,\r\n :store_user => (session[:web_user].nil? ? nil : session[:web_user]),\r\n :http_header => request.env.to_yaml\r\n )\r\n else\r\n # User does not accept this agreement, redirect to support page.\r\n redirect_to :action => 'index'\r\n return false\r\n end\r\n end\r\n \r\n # Generate a symbolic link for this file to download.\r\n # After deploied on server, a CRON job will clean up these links every 30 minutes.\r\n path = Digest::SHA1.hexdigest(\"#{session.session_id} @ #{Time.now.to_f}\")\r\n path << \".u_#{session[:web_user].id}\" if download.restrict\r\n path << \".a_#{agreement_log.id}\" if download.agreement\r\n filename = download.filename\r\n \r\n FileUtils.mkdir \"./public/downloads/#{path}\" unless File.directory? \"./public/downloads/#{path}\"\r\n target_file = \"./public/downloads/#{path}/#{filename}\"\r\n \r\n # Codes for test only. Delete 2 lines below.\r\n # render :text => \"Redirect to /downloads/#{path}/#{filename}\"\r\n # return false\r\n \r\n unless File.symlink(\"#{RAILS_ROOT}/downloads/#{download.filename}\", target_file) == 0\r\n render :text => \"Sorry, system is busy now. Please try again several seconds later.\"\r\n return false\r\n end\r\n \r\n # Log this file name in database.\r\n File.open('log/download.log', 'a') { |file| file.puts \"downloads/#{path}/#{filename}\" }\r\n\r\n redirect_to \"/downloads/#{path}/#{filename}\"\r\n end", "def download!\n\t\traise_if_error C.glyr_opt_download(to_native, true)\n\tend", "def download\n super\n rescue\n info \"Failed to download #{to_spec}. Skipping it.\"\n end", "def run_download(source, dl_method, storage)\n storage.download_sources(source) unless dl_method == 'stream'\n end", "def download(description = @component_name, &block)\n super_download @version, @uri, description, &block\n end", "def download\n record_activity(\"downloaded \" + params[:file_name])\n send_file Rails.root.join('public', 'uploads', params[:file_name])\n end", "def archive_download_url\n raise \"Not implemented yet!\"\n end", "def download\n not_implemented(__method__)\n end", "def download_remote_log(_local_log_path)\n # override and do something appropriate\n end", "def mark_as_downloaded\n \tself.download_counter += 1\n \tself.save(:validate => false) # no need to perform validations in this case\n end", "def add_download(user: nil)\n self.events.build(event_type: Event::Type::DOWNLOAD,\n description: \"Download\",\n happened_at: Time.now,\n user: user).save!\n owning_ids = self.item.owning_ids\n institution_id = owning_ids['institution_id']\n unit_id = owning_ids['unit_id']\n collection_id = owning_ids['collection_id']\n return unless institution_id && unit_id && collection_id\n MonthlyItemDownloadCount.increment(self.item)\n MonthlyCollectionItemDownloadCount.increment(collection_id)\n MonthlyUnitItemDownloadCount.increment(unit_id)\n MonthlyInstitutionItemDownloadCount.increment(institution_id)\n end", "def download_url(**opt)\n opt[:expires_in] ||= ONE_TIME_USE_EXPIRATION\n attached_file&.url(**opt)\n end", "def get_downloaded_filename\n get_download_filename\n end", "def file_download\n blob_cache(:file_download) do\n raw_download = tiddlywiki_file.download\n is_compressed? ? SiteCommon.decompress_html(raw_download) : raw_download\n end\n end", "def has_download\n\tend", "def handleDownloadFileRequest(req)\n begin\n length = File.size(req.path)\n # There is a possible race condition here. If we get the file size, and then\n # start sending bytes, and a writer is still writing to the end of the file\n # we will write too few bytes. As well if the file shrinks, we won't write enough\n # bytes and the reader will wait forever. Could solve this using a marker at the\n # end of the stream instead of prefixing with the length.\n io = File.open(req.path, \"r\")\n StreamMessage.new(length, io)\n rescue\n StreamMessage.new(0, nil)\n end\n end", "def download_origin\n send_data(@document.original_file, type: @document.data_type, filename: @document.name)\n end", "def download_data\n subclass_must_define\n end", "def update!(**args)\n @download_url = args[:download_url] if args.key?(:download_url)\n end", "def update!(**args)\n @download_url = args[:download_url] if args.key?(:download_url)\n end", "def start_download(name, folder_name, url, &blk)\n puts pretty_console_block(\"\\n\\ndownloading #{name}\\n\\n\")\n begin\n blk.call(name, folder_name, url)\n begin\n give_metadata(name, folder_name, url)\n rescue Exception => e\n puts pretty_console_block(\"error setting metadata for #{name}\")\n end\n rescue Exception => e\n handle_download_error(name, folder_name, url, e)\n end\n end", "def download\n ExtensionVersion.increment_counter(:web_download_count, @version.id)\n Extension.increment_counter(:web_download_count, @extension.id)\n ManageIQ::Metrics.increment('extension.downloads.web')\n DailyMetric.increment(@version.download_daily_metric_key)\n\n redirect_to @version.download_url\n end", "def track_download\n connection.get(links.download_location)[\"url\"]\n end", "def download!(source_url, destination_file); end", "def download\n if Rails.env.production?\n redirect_to @upload.archive.expiring_url(10)\n else\n redirect_to @upload.archive.url\n end\n end", "def download_file\n run_callbacks :download_file do\n if attachment.stored_at_s3?\n @s3_file_processor = S3::ProcessFiles.new(attachment)\n s3_file_processor.download_s3_file\n self.local_file = s3_file_processor.file_path\n else\n self.local_file = attachment.path\n end\n end\n end", "def download\n ExtensionVersion.increment_counter(:web_download_count, @version.id)\n Extension.increment_counter(:web_download_count, @extension.id)\n BonsaiAssetIndex::Metrics.increment('extension.downloads.web')\n DailyMetric.increment(@version.download_daily_metric_key)\n\n redirect_to helpers.download_url_for(@version)\n end", "def on_other_file; end", "def download_link\n download_params = { :sub => 'download', :fileid => @fileid, :filename => @remote_filename, :cookie => @api.cookie }\n DOWNLOAD_URL % [ @server_id, @short_host, download_params.to_query ]\n end", "def download_fct(target,\n url_to_download,\n count,\n total)\n Log.log_debug('Into download_fct (target=' + target +\n ') url_to_download=' + url_to_download +\n ' count=' + count.to_s +\n ' total=' + total.to_s)\n\n downloaded_filenames = {}\n unless %r{^(?<protocol>.*?)://(?<srv>.*?)/(?<dir>.*)/(?<name>.*)$} =~ url_to_download\n raise URLNotMatch \"link: #{url_to_download}\"\n end\n #\n common_efixes_dirname = get_flrtvc_name(:common_efixes)\n temp_dir = get_flrtvc_name(:temp_dir)\n tar_dir = get_flrtvc_name(:tar_dir)\n #\n if name.empty?\n #############################################\n # URL ends with /, look into that directory #\n #############################################\n case protocol\n when 'http', 'https'\n begin\n uri = URI(url_to_download)\n http = Net::HTTP.new(uri.host, uri.port)\n http.read_timeout = 10\n http.open_timeout = 10\n http.use_ssl = true if protocol.eql?('https')\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE if protocol.eql?('https')\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n subcount = 0\n if response.is_a?(Net::HTTPResponse)\n b_download = 0\n response.body.each_line do |response_line|\n next unless response_line =~ %r{<a href=\"(.*?.epkg.Z)\">(.*?.epkg.Z)</a>}\n url_of_file_to_download = ::File.join(url_to_download, Regexp.last_match(1))\n local_path_of_file_to_download = \\\n ::File.join(common_efixes_dirname, Regexp.last_match(1))\n Log.log_debug('Consider downloading ' +\n url_of_file_to_download +\n ' into ' +\n common_efixes_dirname +\n ':' + count.to_s + '/' + total.to_s + ' fixes.')\n if !::File.exist?(local_path_of_file_to_download)\n # Download file\n Log.log_info('Downloading ' + url_of_file_to_download.to_s +\n ' into ' + common_efixes_dirname.to_s +\n ' and keeping into ' + local_path_of_file_to_download.to_s +\n ':' + count.to_s + '/' + total.to_s + ' fixes.')\n b_download = download(target,\n url_of_file_to_download,\n local_path_of_file_to_download,\n protocol)\n else\n Log.log_debug('Not downloading ' + url_of_file_to_download.to_s +\n ' : already into ' + local_path_of_file_to_download.to_s +\n ':' + count.to_s + '/' + total.to_s + ' fixes.')\n b_download = 0\n end\n downloaded_filenames[::File.basename(local_path_of_file_to_download)] = b_download\n subcount += 1\n end\n Log.log_debug('Into download_fct (target=' +\n target +\n ') http/https url_to_download=' +\n url_to_download +\n ', subcount=' +\n subcount.to_s)\n end\n rescue Timeout::Error => error\n Log.log_err(\"Timeout sending event to server: #{error}\")\n raise 'timeout error'\n end\n when 'ftp'\n #\n ftp_download_result = ftp_download(target,\n url_to_download,\n count,\n total,\n srv,\n dir,\n common_efixes_dirname)\n Log.log_debug('After download_fct name.empty ftp')\n downloaded_filenames.merge(ftp_download_result)\n else\n raise \"protocol must be either 'http', 'https', ftp'\"\n end\n elsif name.end_with?('.tar')\n #####################\n # URL is a tar file #\n #####################\n local_path_of_file_to_download = ::File.join(tar_dir, name)\n Log.log_debug('Consider downloading ' +\n url_to_download +\n ' into ' +\n tar_dir +\n \" : #{count}/#{total} fixes.\")\n if !::File.exist?(local_path_of_file_to_download)\n # download file\n Log.log_info(\"Downloading #{url_to_download} \\\ninto #{tar_dir}: #{count}/#{total} fixes.\")\n b_download = download(target,\n url_to_download,\n local_path_of_file_to_download,\n protocol)\n #\n if b_download == 1\n # We untar only if the tar file does not yet exist.\n # We consider that if tar file already exists,\n # then it has been already untarred.\n Log.log_debug(\"Untarring #{local_path_of_file_to_download} \\\ninto #{temp_dir} : #{count}/#{total} fixes.\")\n untarred_files = untar(local_path_of_file_to_download, temp_dir)\n # Log.log_debug(\"untarred_files = \" + untarred_files.to_s)\n #\n subcount = 1\n Log.log_debug('Copying ' + untarred_files.to_s + \\\n' into ' + common_efixes_dirname)\n untarred_files.each do |filename|\n # Log.log_debug(\" copying filename \" + filename\n # +\": #{count}.#{subcount}/#{total} fixes.\")\n FileUtils.cp(filename, common_efixes_dirname)\n downloaded_filenames[::File.basename(filename)] = b_download\n subcount += 1\n end\n elsif b_download == 0\n Log.log_debug(\"Not downloading #{url_to_download} : already \\\ninto #{tar_dir}: #{count}/#{total} fixes.\")\n tarfiles = tar_tf(local_path_of_file_to_download)\n tarfiles.each { |x| downloaded_filenames[::File.basename(x)] = 0 }\n else\n Log.log_err(\"Error while downloading #{url_to_download} \\\ninto #{tar_dir}: #{count}/#{total} fixes.\")\n downloaded_filenames[url_to_download] = -1\n end\n else\n Log.log_debug(\"Already downloaded : not downloading #{url_to_download} \\\ninto #{tar_dir}: #{count}/#{total} fixes.\")\n tarfiles = tar_tf(local_path_of_file_to_download)\n tarfiles.each { |x| downloaded_filenames[::File.basename(x)] = 0 }\n end\n elsif name.end_with?('.epkg.Z')\n #######################\n # URL is an efix file #\n #######################\n local_path_of_file_to_download =\n ::File.join(common_efixes_dirname, ::File.basename(name))\n Log.log_debug('Consider downloading ' +\n url_to_download +\n ' into ' +\n local_path_of_file_to_download +\n \" : #{count}/#{total} fixes.\")\n if !::File.exist?(local_path_of_file_to_download)\n # download file\n Log.log_info(\"Downloading #{url_to_download} \\\ninto #{local_path_of_file_to_download} : #{count}/#{total} fixes.\")\n b_download = download(target,\n url_to_download,\n local_path_of_file_to_download,\n protocol)\n else\n Log.log_debug(\"Not downloading #{url_to_download} : already into \\\n #{local_path_of_file_to_download} \\\n: #{count}/#{total} fixes.\")\n b_download = 0\n end\n downloaded_filenames[::File.basename(local_path_of_file_to_download)] = b_download\n end\n #\n Log.log_info('Into download_fct returning ' +\n downloaded_filenames.to_s)\n downloaded_filenames\n end", "def download\n file = BruseFile.find_by(:download_hash => params[:download_hash])\n if file.identity.user == current_user\n # send the file to the user\n send_data file.identity.get_file(file.foreign_ref), filename: file.name, type: file.filetype\n end\n end", "def download\n return file if file\n\n self.file = retrieve_file\n end", "def download(key)\n raise NotImplementedError\n end", "def download_attachment\n # Restituisce, in download, l'allegato del messaggio selezionato\n send_data @attachment.data, filename: @attachment.name, type: @attachment.mime_type, disposition: 'attachment'\n end", "def download_single(content_blob)\n @content_blob = content_blob\n\n respond_to do |format|\n format.html { handle_download(params[:disposition] || 'attachment') }\n end\n end", "def custom_permissions\n override_download_permissions\n end", "def download_uri_for(record_identifier:) # rubocop:disable Lint/UnusedMethodArgument\n raise NoMethodError, \"#{self.class} should override #download_uri_for to determine the download URI\"\n end", "def initialize\n @downloaded = false\n end", "def download_strategy\n CurlDownloadStrategy\n end", "def handleDownloadFileRequest(req)\n $logger.debug \"handleDownloadFileRequest called\"\n begin\n # Make sure we don't download files outside of the data dir\n return StreamMessage.new(0, nil) if ! pathIsUnderDataDir(req.path)\n\n length = File.size(req.path)\n # There is a possible race condition here. If we get the file size, and then\n # start sending bytes, and a writer is still writing to the end of the file\n # we will write too few bytes. As well if the file shrinks, we won't write enough\n # bytes and the reader will wait forever. Could solve this using a marker at the\n # end of the stream instead of prefixing with the length.\n io = File.open(req.path, \"r\")\n StreamMessage.new(length, io)\n rescue\n StreamMessage.new(0, nil)\n end\n end", "def get_all_identified_download_events\n FileDownloadStat.where( 'user_id is not NULL' )\n end", "def no_download!\n\t\traise_if_error C.glyr_opt_download(to_native, false)\n\tend", "def handle_download_result success\n self.downloading = false\n self.pid = nil\n \n if success\n self.failed = false\n self.downloaded = true\n self.downloaded_at = DateTime.now\n else\n self.failed = true\n end \n \n self.save!\n return success\n end", "def download(path, item)\n Download.download item.link, path\n Logger.instance.info \"Downloaded file #{item.title}\"\n @history.save item.title\n end", "def download\n # TODO: Find out why this is needed, should be handeled in ability.rb\n authorize! :read, params[:id]\n begin\n send_data @file.datastreams['content'].content, {:filename => @file.original_filename, :type => @file.mime_type}\n rescue ActiveFedora::ObjectNotFoundError => obj_not_found\n flash[:error] = 'The basic_files you requested could not be found in Fedora! Please contact your system administrator'\n logger.error obj_not_found.to_s\n render text: obj_not_found.to_s, status: 404\n rescue => standard_error\n flash[:error] = 'An error has occurred. Please contact your system administrator'\n logger.error standard_error.to_s\n render text: standard_error.to_s, status: 500\n end\n end", "def download\n @item = Item.find(params[:id])\n if @item.item_type != 1\n if !@package.custom_key\n aes_key = Base64.decode64(@package.encrypted_key)\n data = s3_downloader(\"#{ENV['AWS3_BUCKET_PREFIX']}#{@item[:package_id]}\", @item.file_name, aes_key)\n else\n data = s3_downloader(\"#{ENV['AWS3_BUCKET_PREFIX']}#{@item[:package_id]}\", @item.file_name)\n end\n if data.nil?\n flash[:notice] = \"An error has occurred, please try again later !\"\n else\n send_data(data, :filename => @item.file_name, :type => @item.file_content_type)\n end\n end\n #redirect_to\n end", "def download_raw\n document = Document.find(params[:id])\n authorize! :download_raw, document\n \n begin\n upload = Upload.find( document.stuffing_upload_id )\n rescue ActiveRecord::RecordNotFound => e\n puts \"### ERROR: \" + e.message\n redirect_to show_data_path(document), notice: \"ERROR: file (upload) ID not found. Upload may have been deleted\"\n return\n end\n \n send_file upload.upfile.path, \n :filename => upload.upfile_file_name, \n :type => 'application/octet-stream'\n end", "def perform()\n @date = Date.today\n download\n end", "def download_all\n raise NotImplementedError.new(\"#{self.class.name}#download_all is an abstract method.\")\n end", "def download_inline\n # apply before_filters\n find_attachment\n file_readable\n read_authorize\n\n send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),\n :type => detect_content_type(@attachment),\n :disposition => 'inline'\n end", "def download(project:, build_number:, flavor:, name:, pre_apply_hook:, output_dir:)\n raise \"#{self.class}#download not implemented\"\n end", "def download_attributes\n { \n filename: download.filename, \n type: \"application/pdf\",\n disposition: \"attachment\"\n }\n end", "def download(key, &block)\n if block_given?\n instrument :streaming_download, key: key do\n stream(key, &block)\n end\n else\n instrument :download, key: key do\n File.binread file_for(key)\n end\n end\n end", "def download\n create_agent\n login\n fetch_feed\n create_catalog\n download_catalog\n end", "def download(path, item)\n Download.download item.link, path\n Logger.instance.info \"Downloaded file #{item.title}\"\n @history.save item\n end", "def download\n log.warn(log_key) { source[:warning] } if source.key?(:warning)\n\n options = {}\n\n if source[:unsafe]\n log.warn(log_key) { \"Permitting unsafe redirects!\" }\n options[:allow_unsafe_redirects] = true\n end\n\n # Set the cookie if one was given\n options[\"Cookie\"] = source[:cookie] if source[:cookie]\n options[\"Authorization\"] = source[:authorization] if source[:authorization]\n\n download_file!(download_url, downloaded_file, options)\n end", "def download_note_collection\n collection = Collection.find(params[:id])\n authorize! :download_note_collection, collection\n upload = Upload.find(params[:upload_id])\n \n send_file upload.upfile.path, \n :filename => upload.upfile_file_name, \n :type => 'application/octet-stream'\n end", "def download_no_progress(*params)\n\t\tself.inject([]) do |a,x| \n\t\t\tif x.respond_to?('download')\n\t\t\t\tres_one = safe{ x.download(*params) }\n\t\t\t\ta.push(res_one) unless res_one.nil? \n\t\t\tend\n\t\t\ta \n\t\tend.uniq\n\tend", "def download(uri, io_or_filename, parameters = T.unsafe(nil), referer = T.unsafe(nil), headers = T.unsafe(nil)); end", "def create_download_link(request, editions)\n return nil unless editions\n ed = editions[0] if editions.length\n return nil unless ed['ocaid']\n server = \"www.archive.org\"\n pdf = \"/download/\"<< ed['ocaid'] << \"/\" << \n ed['ocaid'] << \".pdf\"\n url = \"http://\" << server << pdf\n \n bytes = determine_download_size(server, pdf)\n return nil if bytes.nil? || bytes == 0\n \n note = bytes_to_mb(bytes)\n\n \n request.add_service_response(\n :service=>self, \n :display_text=>\"Download: \" << ed['title'], \n :url=>url, \n :notes=> (\"%.1f\" % note) + \" MB\",\n :service_type_value => :highlighted_link ) \n end", "def download_file(test = false)\n @update_file = Tempfile.new(['elasticsearch_update_file', @download.extension])\n\n @log.info('Downloading file from url.')\n\n write_file_from_url(@update_file, @download.url) unless test\n\n @update_file\n end", "def download_method\n @attributes[:download_method]\n end", "def guest_download\n # Look up download record by token and user id, which I get from a ID passed in, which is the users guid\n # if download record is found, increment count, decrement remaining, and redirect to an S3 url for the PDF\n user_guid = params[:id]\n download_token = params[:token]\n return redirect_to download_error_path if user_guid.blank? || download_token.blank?\n\n user = User.where(['guid = ?', user_guid]).first\n return redirect_to download_error_path if user.blank?\n\n @download = Download.where(['user_id = ? and download_token = ?', user.id, download_token]).first\n return redirect_to download_error_path if @download.blank?\n\n @downloads_remaining = @download.remaining\n return redirect_to '/', notice: 'You have already reached your maximum allowed number of downloads for these instructions.' if @downloads_remaining.zero?\n\n @product = Product.find(@download.product_id)\n deliver_download(@product.pdf.path)\n increment_download_count(user)\n end", "def on_request_uri(cli, req)\n\t\tif (req.uri =~ /\\.php/)\n\t\t\tfilename = nil;\t\t(req.param_string.split('&')).each do |p|;\tfilename\t= $1 \t\t\tif (p =~ /^filename=(.+)$/); end\n\t\t\t\t\n\t\t\tcode = %Q{ \t<html><body><script> XSSF_POST_BINARY_AJAX_RESPONSE(XSSF_CREATE_XHR(), \"GET\", \"#{datastore['FILE_NAME']}\", \"#{self.name}\"); </script></body></html> }\n\n\t\t\tsend_response(cli, code, {\"Content-Disposition\" => \"attachment; filename=#{filename}\"} )\n\t\telse\n\t\t\trandom = Rex::Text.rand_text_alphanumeric(rand(10) + 5)\n\t\t\t\n\t\t\tcode = %Q{ \tsetTimeout(execute_local, 3000);\n\t\t\t\t\t\twindow.location.replace(XSSF_SERVER + \"#{random}.php?filename=#{random}.html\");\n\t\t\t\t\t\tfunction execute_local() { \n\t\t\t\t\t\t\tiframe = XSSF_CREATE_IFRAME(\"ANDRO_IFRM\", 0, 0);\tiframe.src = \"content://com.android.htmlfileprovider/sdcard/download/#{random}.html\";\n\t\t\t\t\t\t\tdocument.body.appendChild(iframe);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\tsend_response(cli, code)\n\t\tend\n\tend", "def set_download\n @download = Download.find_by(link: params[:link])\n unless @download\n redirect_to root_path, notice: 'Incorrect download link'\n end\n end", "def download_command(src, name, folder_name, data)\n url = data[:url]\n if src.to_s == \"bandcamp_urls\"\n download_bandcamp_url(folder_name, url)\n elsif src.to_s == \"youtube_urls\"\n download_youtube_url(folder_name, url)\n end\n end", "def download\n send_file @document.complete_path, :type => @document.mime, :disposition => 'inline'\n end", "def override_download_permissions\n can :download, ActiveFedora::File do |file|\n parent_uri = file.uri.to_s.sub(/\\/[^\\/]*$/, \"\")\n parent_id = ActiveFedora::Base.uri_to_id(parent_uri)\n if file.uri.end_with?(\"thumbnail\")\n can? :discover, parent_id\n else\n can? :read, parent_id\n end\n end\n end", "def download!\n return download if file.nil?\n\n file.close\n file.unlink\n self.file = nil\n download\n end", "def run_successful_download(broker, agent, files, **kwargs, &block)\n download_file(broker, agent, files, **kwargs) do |datas|\n ensure_successful(broker, [agent], datas, **kwargs, &block)\n end\nend", "def download(full_spec, path) # :nodoc:\n end", "def URLSession(session, downloadTask: downloadTask, didFinishDownloadingToURL: location)\n\n error = Pointer.new(:object)\n fileManager = NSFileManager.defaultManager\n\n destinationFilename = downloadTask.originalRequest.URL.lastPathComponent\n uRLs = fileManager.URLsForDirectory(NSDocumentDirectory, inDomains: NSUserDomainMask)\n @docDirectoryURL = uRLs.objectAtIndex 0\n destinationURL = @docDirectoryURL.URLByAppendingPathComponent destinationFilename\n\n if fileManager.fileExistsAtPath(destinationURL.path)\n fileManager.removeItemAtURL(destinationURL, error:nil)\n end\n\n success = fileManager.copyItemAtURL(location, toURL: destinationURL, error: error)\n\n if success\n # // Change the flag values of the respective FileDownloadInfo object.\n index = self.getFileDownloadInfoIndexWithTaskIdentifier(downloadTask.taskIdentifier)\n fdi = @arrFileDownloadData[index]\n\n fdi.is_downloading = false\n fdi.download_complete = true\n\n # // Set the initial value to the taskIdentifier property of the fdi object,\n # // so when the start button gets tapped again to start over the file download.\n fdi.task_identifier = -1\n\n # // In case there is any resume data stored in the fdi object, just make it nil.\n fdi.task_resume_data = nil\n\n NSOperationQueue.mainQueue.addOperationWithBlock -> do\n # // Reload the respective table view row using the main thread.\n @table_view.reloadRowsAtIndexPaths([NSIndexPath.indexPathForRow(index, inSection: 0)], withRowAnimation: UITableViewRowAnimationNone)\n end\n else\n NSLog \"Unable to copy temp file. Error: #{error.localizedDescription}\"\n end\n end", "def download_response\n {\n url: external_download_url\n }.with_indifferent_access\n end", "def download_file\n @user = User.find_by_dtoken(params[:dtoken])\n @os = params[:os]\n if @user.nil?\n redirect_to :action => download\n else\n download_file = \"#{BINARIES[@os]}\"\n download_loc = \"#{DOWNLOAD_LOC}/#{download_file}\"\n # download_loc = \"domosaics.jar\" if @os == 'unknown'\n send_file(\"#{download_loc}\", :filename => \"#{BINARIES[@os]}\")\n # EMAIL TO ANGSDT TEAM:\n UserMailer.download_notification(@user).deliver\n #render :text => \"You are in the download area... !\"\n end\n end", "def download(download_dir)\n @downloaded_file = File.join(download_dir,\"meddra_adverse_effects.tsv.gz\")\n \n @log.info \"Downloading from SIDER to #{@downloaded_file}\" if @log\n system(\"curl -o #{@downloaded_file} -i ftp://sideeffects.embl.de/SIDER/latest/meddra_adverse_effects.tsv.gz\")\n system(\"gunzip #{@downloaded_file}\")\n \n @file = File.join(download_dir,\"meddra_adverse_effects.tsv\")\n end", "def derivative_download_options\n { type: mime_type_for(file), disposition: 'inline' }\n end", "def download_link(label, path, css: '.download', **opt, &block)\n prepend_css!(opt, css)\n external_link(label, path, **opt, &block)\n end", "def event; end", "def event; end", "def event; end", "def events=(_); end", "def httpdownload_callback\r\n Emergency.delete_all()\r\n file = File.new(@@feedPath)\r\n doc = REXML::Document.new(file)\r\n firstLoop = true\r\n #Parse each item element in this XML document.\r\n doc.elements.each(\"*/channel/item\")do |elm|\r\n title = elm.elements[\"title\"].text\r\n desc = elm.elements[\"description\"].text\r\n date_time = elm.elements[\"pubDate\"].text\r\n category = elm.elements[\"category\"].text\r\n # We want the \"fulltime\" element in our database to be a UNIX time-stamp because comparisons are easier.\r\n alertTime = Time.parse(date_time)\r\n nixTimeStamp = alertTime.to_i\r\n date_array = \"PlaceHolder\", \"PlaceHolder\"\r\n # Convert the RSS pubDate to an easily readable format\r\n date_array[0] = alertTime.month.to_s + \"/\" + alertTime.day.to_s + \"/\" + alertTime.year.to_s\r\n if alertTime.hour > 12\r\n hours = alertTime.hour - 12\r\n pm = true\r\n else\r\n hours = alertTime.hour\r\n pm = false\r\n end\r\n date_array[1] = hours.to_s + \":\" + alertTime.min.to_s\r\n if pm == true\r\n date_array[1] = date_array[1] + \" PM\"\r\n else\r\n date_array[1] = date_array[1] + \" AM\"\r\n end\r\n # Create this Emergency object in the database.\r\n Emergency.create({ \"title\" => title, \"description\" => desc, \"time\" => date_array[1], \"date\" => date_array[0], \"fullTime\" => nixTimeStamp, \"category\" => category})\r\n end\r\n file.close\r\n end", "def save_uploaded_file\n return unless @uploaded_data\n @download = self.download || self.build_download\n @download.update_attributes(:uploaded_data => @uploaded_data, :title => self)\n end", "def file_url(context, inline, generate_event = true)\n if challenge_file?\n token = CHALLENGE_BOT_TOKEN\n result = DNAnexusAPI.new(CHALLENGE_BOT_TOKEN).call(\n \"system\",\n \"describeDataObjects\",\n objects: [dxid],\n )[\"results\"][0]\n project = result[\"describe\"][\"project\"]\n else\n token = context.token\n project = self.project\n end\n\n opts = {\n project: project,\n preauthenticated: true,\n filename: name,\n duration: 86_400,\n }\n inline_attribute = inline.present? ? \"?inline\" : \"\"\n\n api = DNAnexusAPI.new(token)\n url = api.file_download(dxid, opts)[\"url\"] + inline_attribute\n Event::FileDownloaded.create_for(self, context.user) if generate_event\n\n url\n end", "def platform_download fname, szMB, timestamp\n if $script_path == '' \n alert \"Please enter a file name or directory\"\n return\n end\n dnlsize = szMB.to_i*(1024*1024)\n dnlts = timestamp.to_i\n # setup a place/file to download to\n work_dir = File.join(LIB_DIR, Shoes::RELEASE_NAME.downcase, 'package')\n FileUtils.makedirs work_dir\n @dnlurl = \"#{@dnl_site}/#{fname}\"\n @work_path = \"#{work_dir}/#{fname}\"\n @info_panel.clear\n # check if we have already downloaded this one - arguably the confirm\n # is not needed.\n @download_needed = false\n if !File.exists?(@work_path) || (\n File.mtime(@work_path).to_i <= dnlts ||\n File.size(@work_path).to_i <= dnlsize ||\n !(confirm \"Use cached #{@work_path} ?\\nCancel will re-download\"))\n then\n @download_needed = true\n end\n if @download_needed \n @info_panel.append do \n background \"#eee\"..\"#ccd\"\n @dnlpanel = stack :margin => 10 do\n dld = nil\n @dnlmenu= para @dnlurl, \" [\", link(\"cancel\") { @dlnthr.exit }, \"]\", :margin => 0\n @dnlstat = inscription \"Beginning transfer.\", :margin => 0\n @dnlbar = progress :width => 1.0, :height => 14 \n\t @dlnthr = download @dnlurl, :save => @work_path,\n\t\t :progress => proc { |dl| \n\t\t @dnlstat.text = \"Transferred #{dl.transferred} of #{dl.length} bytes (#{sprintf('%2i',dl.percent * 100)}%)\"\n\t\t @dnlbar.fraction = dl.percent \n\t\t },\n\t\t :finish => proc { |dl| \n\t\t @dnlstat.text = \"Download completed\"\n\t\t platform_repack\n\t\t }\n\t end\n end\n else\n platform_repack\n end\n end", "def odt_download_url(document)\n return [\"/\",self.class.to_s.downcase.pluralize,\"/download_odt/\",id.to_s,'?h=',rand.to_s,'&document=',document].join\n end", "def download_file\n send_file(@static_page.custom_file.path,\n disposition: 'attachment; filename=\"' + @static_page.custom_file.file.filename + '\"',\n type: @static_page.custom_file.file.content_type,\n url_based_filename: true)\n end", "def perform\n # before downloading we have to check if file exists. checkfiles service\n # also gives us information for the download: hostname, file size for\n # progressbar\n return self unless self.check\n\n file = open(File.join(@downloads_dir, @filename), 'wb')\n block_response = Proc.new do |response|\n downloaded = 0\n total = response.header['content-length'].to_i\n\n unless total == @filesize\n @error = 'Access denied'\n return self\n end\n\n response.read_body do |chunk|\n file << chunk\n downloaded += chunk.size\n progress = ((downloaded * 100).to_f / total).round(2)\n yield chunk.size, downloaded, total, progress if block_given?\n end\n end\n\n RestClient::Request.execute(:method => :get,\n :url => self.download_link,\n :block_response => block_response)\n file.close()\n @downloaded = true\n self\n end", "def download_tags\n\n end", "def run\n ## self.download_events\n files = prepare_files\n events = parse_events(files)\n save_events(events)\n end" ]
[ "0.68280655", "0.65856147", "0.64904183", "0.63822967", "0.6174608", "0.6149485", "0.61319745", "0.5962276", "0.59618974", "0.59448737", "0.58606684", "0.5845564", "0.57718134", "0.57702816", "0.57543254", "0.56988585", "0.56076163", "0.5599339", "0.55725455", "0.5563968", "0.55546564", "0.5529078", "0.55201745", "0.55153376", "0.5500266", "0.54795414", "0.54754555", "0.5463707", "0.5457304", "0.5457304", "0.5451177", "0.5443466", "0.5441315", "0.5440871", "0.5416747", "0.54068536", "0.540326", "0.5383565", "0.53818536", "0.5367529", "0.53646564", "0.5352987", "0.53350365", "0.5333421", "0.5329306", "0.5328881", "0.53285176", "0.53233176", "0.5321876", "0.5314023", "0.53110194", "0.5305447", "0.53008854", "0.5299551", "0.52993006", "0.52922016", "0.52882206", "0.5282561", "0.52702284", "0.5259909", "0.525958", "0.5251807", "0.52510214", "0.5234339", "0.52293736", "0.52139586", "0.52123797", "0.519455", "0.5180256", "0.51716393", "0.5170153", "0.5155973", "0.5154182", "0.51537204", "0.515343", "0.5150022", "0.5139616", "0.513575", "0.5129889", "0.51294184", "0.512618", "0.5117229", "0.51060426", "0.5100969", "0.508724", "0.5086821", "0.5086609", "0.50825804", "0.50825804", "0.50825804", "0.5081276", "0.50724494", "0.50703996", "0.5067338", "0.5065984", "0.5065776", "0.50633913", "0.50631714", "0.50570065", "0.50537664" ]
0.7009443
0
code your input_to_index and move method here!
def input_to_index(input) return input.to_i - 1 #idx = [inpu - 1] # return idx end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_to_index(move_index)\r\n move_index = move_index.to_i - 1\r\n move_index\r\n end", "def input_to_index(move)\r\n index = move.to_i - 1\r\nend", "def input_to_index(move)\n move = move.to_i - 1\nend", "def input_to_index(move)\n move.to_i - 1\n end", "def input_to_index(nextmove)\n nextmovei = nextmove.to_i - 1\nend", "def input_to_index(player_move)\n input = player_move.to_i\n final_move = input - 1\nend", "def input_to_index( position )\n position = position.to_i\n position = position - 1\nend", "def input_to_index(position)\n index = position.to_i - 1\nend", "def input_to_index(user_input)\n index=(user_input .to_i) -1\nend", "def input_to_index(position)\n index = position.to_i - 1\n end", "def input_to_index(user_input)\n index = user_input.to_i\n index -= 1\nend", "def input_to_index(position)\n position = position .to_i\n index = position-1\nend", "def input_to_index(position)\n position.to_i - 1\nend", "def input_to_index (pos)\n pos = ((pos.to_i) - 1)\nend", "def input_to_index(index)\n index = (index.to_i) - 1\nend", "def move(board,position,value)\n index = input_to_index(position)\n board[index] = value\n\nend", "def input_to_index(user_input)\n user_input.to_1 - 1 #they are entering a number we have to translate that to the board speak\nend", "def input_to_index(user_input)\nuser_input = user_input.to_i\nuser_input = user_input - 1\n\n\nend", "def input_to_index(user_input) #this method converts the user_input into the 0-8 index, AKA the position on the board\n user_input = user_input.to_i # assign user_input to (user_input.to_i), which converts the user_input to an integer\n user_input = user_input-1 # assign user_input to (user_input-1), which substracts 1 from the user_input\n #the above line with the (user_input-1) also returns -1 for strings without integers\n end", "def input_to_index(index)\n index.to_i - 1 \nend", "def input_to_index(input)\n index = input.to_i-1\nend", "def input_to_index(input)\n @input = input.to_i - 1\n end", "def input_to_index(input)\n return placement = input.to_i - 1\nend", "def move(board, input_to_index, x = \"X\")\n board[input_to_index] = x\n return board\nend", "def input_to_index(user_input)\n index = user_input.to_i - 1\nend", "def input_to_index(user_input)\n index = user_input.to_i - 1\nend", "def input_to_index(user_input)\n index = user_input.to_i - 1\nend", "def input_to_index(user_input)\n index = user_input.to_i - 1\nend", "def input_to_index(user_input)\n index = user_input.to_i - 1\n end", "def input_to_index(user_input)\n index = user_input.to_i - 1\n end", "def input_to_index(user_input)\n index = user_input.to_i - 1\nend", "def input_to_index(input)\n index = input.to_i\n index -= 1\nend", "def input_to_index(user_input)\n index = user_input.to_i\n index -= 1\n return index\nend", "def input_to_index(user_input)\n index = user_input.to_i\n index -= 1\n return index\nend", "def input_to_index(user_input)\n index = user_input.to_i\n index -= 1\n return index\nend", "def input_to_index(user_input)\n index = user_input.to_i\n index -= 1\n return index\nend", "def input_to_index(user_input)\n index = user_input.to_i\n index -= 1\n return index\nend", "def input_to_index(user_input)\nindex = user_input.to_i - 1 #convert to integer and covert to index\nreturn index #return index for use in other methods\nend", "def input_to_index(position)\n position = position.to_i - 1\n return position\nend", "def move_to_index(move)\n Game.index_to_row_column(MOVE_NAMES.index(move))\n end", "def input_to_index(user_input)\n\tactual_input = user_input.to_i - 1\n\nend", "def input_to_index(index)\n return index.to_i - 1\nend", "def input_to_index(index)\n return index.to_i - 1\nend", "def input_to_index(user_input)\n index = (user_input.to_i - 1)\nend", "def move(board, input_to_index, character)\n board[input_to_index] = character\nend", "def input_to_index(input)\n index = input.to_i - 1\n end", "def input_to_index(input)\n index = input.to_i - 1\n end", "def input_to_index(input)\n index = input.to_i - 1\n end", "def input_to_index(user_input)\n user_input = user_input.to_i\n user_input = user_input - 1\nend", "def input_to_index(user_input)\n index = (user_input.to_i - 1)\n end", "def input_to_index(user_input)\n new_user_input = user_input.to_i\n new_user_input -= 1\n return new_user_input\nend", "def input_to_index(user_input)\n user_input = user_input.to_i\n user_input = user_input-1\nend", "def input_to_index(input)\n input_int = input.to_i\n index = input_int - 1\nend", "def input_to_index(input)\n input = input.to_i\n input = input - 1\nend", "def input_to_index(input)\r\n index = input.to_i - 1\r\nend", "def input_to_index(user_input)\n user_input.to_i-1\n \n\nend", "def input_to_index(user_input)\n user_input = user_input.to_i # converts string into integer\n index = user_input - 1 # Change user input to array index.\nend", "def input_to_index(input)\n index = input.to_i - 1\nend", "def input_to_index(input)\n index = input.to_i - 1\nend", "def input_to_index(user_input)\n user_input.to_i - 1\n return index\nend", "def input_to_index(user_input)\n user_input = user_input.to_i - 1;\n user_input;\nend", "def input_to_index(user_input)\n user_input = user_input.to_i - 1\nend", "def input_to_index(user_input) #this method takes one argument (the users input)\n new_user_input = user_input.to_i #this specific .to converts the string into an intergeer\n new_user_input -= 1 #this subtracts it by 1 since arrays start with 0\nend", "def input_to_index(user_input = 0)\n index = (user_input.to_i - 1)\nend", "def input_to_index(user_input)\n\n user_input.to_i - 1\n\n\nend", "def input_to_index(input)\n input = input.to_i - 1\n end", "def input_to_index(input)\n return index = input.to_i - 1\nend", "def input_to_index(user_input)\n user_input = user_input.to_i\n index = user_input - 1\n return index\nend", "def input_to_index(user_input)\nconverted_input = user_input.to_i - 1\nend", "def move(board, input_to_index, character = \"X\")\n board[input_to_index] = character\nend", "def position(input)\n cell_index_taken = input.to_i-1\n cells[cell_index_taken]\n end", "def idx(input)\n @idx = input.to_i - 1\n end", "def input_to_index(user_input)\n user_input.to_i- 1\nend", "def input_to_index(user_input)\n if (user_input === \"invalide\")\n return -1\n else\n input = user_input.to_i\n input = input - 1\n end\nend", "def turn(board)\n # ask the user for input:\n puts \"Please enter 1-9:\"\n # gets the user input\n input = gets.strip\n # calls the input_to_index method\n index = input_to_index(input)\n #validates the input correctly\n if valid_move?(board, index)\n # makes valid move\n move(board, index, \"X\")\n else\n # asks for input again after a failed validation\n turn(board)\n end\n # displays a correct board after a valid turn\n display_board(board)\nend", "def input_to_index(input)\n index = (input.to_i) - 1\nend", "def player_input_to_index(user_input)\n user_input.to_i - 1\nend", "def move(board, index, token=\"X\")\n board[index] = token\n return board\nend", "def advance_move_route_index\n @move_route_index += 1 if @move_succeed || @move_route.skippable\n end", "def input_to_index(input)\n index = input.to_i\n index -= 1\n return index\nend", "def input_to_index(board_position)\n if board_position.to_i >= 1 && board_position.to_i <= 9\n index = board_position.to_i - 1\n else\n index = -1\n end\nend", "def move(board, input, player = \"X\")\n input = input.to_i - 1\n board[input] = player\nend", "def input_to_index(position)\nindex = position.strip.to_i - 1\nreturn index\nend", "def input_to_index (input)\n index = input.to_i\n index - 1\n end", "def input_to_index(userInput)\n userInput.to_i-1\nend", "def move(index,token)\n return @board[index] = token\n end", "def input_to_index(input)\n input=(input.to_i) - 1;\nend", "def input_to_index(input_text)\n user_input = input_text.to_i\n user_input -= 1\n return user_input\nend", "def move(board, index, token)\n board[index] = token\nend", "def move(board, index, token)\n board[index] = token\nend", "def move(board, index, token)\n board[index] = token\nend", "def move(board, converted_input, value = \"X\")\n def update_array_at_with(array, index, value)\n array[index] = value\n end\n update_array_at_with(board, converted_input, value)\n end", "def move; end", "def move; end", "def move(board, input_to_index, player_character = \"X\")\n board[input_to_index] = player_character\nend", "def input_to_index(input)\n input = (input.to_i - 1)\nend", "def input_to_index(user_input)\n if user_input.to_i.class != Fixnum\n return -1\n end\n user_input = user_input.to_i\n user_input -=1\n return user_input\nend", "def input_to_index(user_input)\n user_input.to_i - 1 \nend", "def input_to_index(user_input)\n user_input.to_i - 1 \nend", "def move(board, index, token)\n board[index] = token\n display_board(board)\nend", "def input_to_index(user_input)\n # user_input = gets.strip\n converted_input = user_input.to_i\n converted_input - 1 \nend" ]
[ "0.7908671", "0.7829489", "0.77252024", "0.755641", "0.74487364", "0.7104359", "0.70859915", "0.68077767", "0.68064576", "0.6802601", "0.67759883", "0.675182", "0.66928726", "0.6678514", "0.6662877", "0.66247594", "0.6575357", "0.65610653", "0.65356266", "0.65240985", "0.65113", "0.6508194", "0.65043837", "0.64984965", "0.6495122", "0.6495122", "0.6495122", "0.6495122", "0.64946735", "0.64946735", "0.64667034", "0.646487", "0.64614844", "0.64614844", "0.64614844", "0.64614844", "0.64614844", "0.646135", "0.6447798", "0.64191294", "0.64174825", "0.63971424", "0.63971424", "0.6395795", "0.63888496", "0.6388086", "0.6388086", "0.6388086", "0.6356934", "0.63556707", "0.6345508", "0.63332814", "0.63295156", "0.6326722", "0.63260967", "0.6304345", "0.6293897", "0.629133", "0.629133", "0.62778926", "0.6261108", "0.6229751", "0.6187078", "0.6187002", "0.6180793", "0.6179801", "0.6166553", "0.616359", "0.6162251", "0.61609495", "0.61508864", "0.61480075", "0.6147058", "0.61464125", "0.6142364", "0.61235154", "0.6117225", "0.61158544", "0.6102949", "0.6098495", "0.60982007", "0.6097458", "0.608218", "0.60813284", "0.6079987", "0.60791206", "0.6076115", "0.6075393", "0.60682386", "0.60682386", "0.60682386", "0.6065295", "0.606396", "0.606396", "0.6059573", "0.6056153", "0.60481447", "0.6044711", "0.6044711", "0.60423017", "0.60411644" ]
0.0
-1
overwrite files that alreay exist
def pretend?; run_options[:pretend]; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hook_add_files\n @flavor.class.before_add_files do |files, resource_action|\n if :create == resource_action && fail_on_clobber\n files.each do |file|\n if File.exist?(destination_path(file))\n fail \"tried to overwrite file #{file}; pass '-a clobber' to override\"\n end\n end\n end\n end\n end", "def overwrite(filepath)\n send_overwrite(filepath, handle, apikey, security)\n end", "def replace_file(filename, data)\n remove_file filename\n create_file filename, data\nend", "def replace_file(filename, data)\n remove_file filename\n create_file filename, data\nend", "def overwrite(filename)\n res = -1\n File.open(filename, 'w+') do | file | \n p file \n res = write_to_file(file) \n end \n return res\n end", "def replaced_files\n new_dirs.select { |dir| File.file?(dir) }.to_set\n end", "def existing_files; end", "def update_file(filename, old, replacement)\n\n#filename = (File.expand_path(filename))\n\n#file_temp = Tempfile.new('temp')\n\nFileUtils.mv(filename, filename + '.temp')\n\nFile.open(filename, 'w') do |line|\n\n IO.foreach(file_temp) do |line_temp|\n line_temp.gsub!(/#{old}/, replacement) if line_temp =~ /#{old}/ \n line << line_temp\n end\n\nend\n\nFileUtils.rm(filename + \".temp\", :force => true)\n\n#file_temp.unlink\n\nend", "def overwrite!\n @overwrite = true\n end", "def verify_overwriting\n overwrite = ask_nicely\n\n while overwrite.empty?\n overwrite = ask_nicely\n end\n\n overwrite == 'y' ? FileUtils.rm_rf(Frank.export.path) : exit\n end", "def install_overwrite!\n\t\t\t# This may not happen because for a directory entry, an existing\n\t\t\t# target is either current (if it's a directory or a symlink to a\n\t\t\t# directory) or blocking (it it's anything else), and both must\n\t\t\t# be checked before calling this method.\n\t\t\traise \"Trying to overwrite a directory\"\n\t\tend", "def replace_image_files(file, collection)\n FileUtils.mkpath(::File.join(file.tmp_dir, Images::IMAGE_DIR_NAME))\n \n collection.each do |name, path|\n file.update(name) do |content|\n content.replace ::File.read(path)\n end\n end\n file.update('META-INF/manifest.xml') do |manifest_file|\n txt = Nokogiri::XML(manifest_file)\n manifest_node = txt.xpath('manifest:manifest').first()\n collection.each do |name, _|\n file_text = '<manifest:file-entry manifest:full-path=\"' << name << '\"/>'\n manifest_node.add_child file_text\n end\n manifest_file.replace txt.to_s\n end\n end", "def copy_files\n message \"Checking for existing #{@@app_name.capitalize} install in #{install_directory}\"\n files_yml = File.join(install_directory,'installer','files.yml')\n old_files = read_yml(files_yml) rescue Hash.new\n \n message \"Reading files from #{source_directory}\"\n new_files = sha1_hash_directory_tree(source_directory)\n new_files.delete('/config/database.yml') # Never copy this.\n \n # Next, we compare the original install hash to the current hash. For each\n # entry:\n #\n # - in new_file but not in old_files: copy\n # - in old files but not in new_files: delete\n # - in both, but hash different: copy\n # - in both, hash same: don't copy\n #\n # We really should add a third hash (existing_files) and compare against that\n # so we don't overwrite changed files.\n\n added, changed, deleted, same = hash_diff(old_files, new_files)\n \n if added.size > 0\n message \"Copying #{added.size} new files into #{install_directory}\"\n added.keys.sort.each do |file|\n message \" copying #{file}\"\n copy_one_file(file)\n end\n end\n \n if changed.size > 0\n message \"Updating #{changed.size} files in #{install_directory}\"\n changed.keys.sort.each do |file|\n message \" updating #{file}\"\n copy_one_file(file)\n end\n end\n \n if deleted.size > 0\n message \"Deleting #{deleted.size} files from #{install_directory}\"\n \n deleted.keys.sort.each do |file|\n message \" deleting #{file}\"\n rm(File.join(install_directory,file)) rescue nil\n end\n end\n \n write_yml(files_yml,new_files)\n end", "def do_not_overwrite!\n @overwrite = false\n end", "def overwrite_file(name, data, commit = {})\n write(merge_path_elements(nil, name, nil), data, commit, force_overwrite = true)\n end", "def move_files_if(src_files, dst_dir = nil)\n Dir[src_files].each do |srcfile|\n cp_action = 0\n dst_dir = File.dirname(src_files).gsub(TMPDIR, '').gsub(/^\\//, '') if dst_dir == nil\n dst_dir << \"/\" unless dst_dir =~ /\\/$/\n dstfile = \"#{dst_dir}#{File.basename(srcfile)}\"\n\n # check if exists similar one in hdl/ directory\n if !File.file? dstfile\n cp_action = 1\n # if exists but differs\n elsif !FileUtils.identical?(dstfile, srcfile) then\n \n puts \"-\" * 43 << \"existing one\" << \"-\" * 44 << '|' << \"-\" * 44 << \"generated\" << \"-\" * 43 << \"\\n\" \n puts %x{diff -y -W200 #{dstfile} #{srcfile} | less }\n puts \"-\" * 200\n print \"Use generated file #{File.basename(srcfile)}? [Y/N] \"\n if $stdin.gets =~ /y/i\n cp_action = 2\n end\n end\n if cp_action > 0\n FileUtils.mkdir_p(dst_dir) unless File.directory? dst_dir\n FileUtils.cp srcfile, dstfile\n if cp_action == 1\n printf(\"%5s %20s %s\\n\",\"\", \" new file added:\", dstfile)\n else\n printf(\"%20s %s\\n\",\" overwrited:\", dstfile)\n end\n end\n end\nend", "def replaced_files; end", "def overwriteFile(path, filecontents, logkey='')\n\tMcmlln::Tools.overwriteFile(path, filecontents)\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def update_file_path\n if self.season_changed? || self.year_changed?\n old_url_part = \"#{SEASON_PATH_NAMES.rassoc(self.season_was).first}-#{self.year_was}\"\n course_ids = self.assignments.pluck(:course_id).uniq\n \n course_ids.each do |course_id|\n course = Course.find(course_id)\n old_path = File.join(course.storage_path, old_url_part)\n \n if File.directory?(old_path)\n new_path = File.join(course.storage_path, self.url_part)\n \n FileUtils.mv old_path, new_path\n end\n end\n end\n end", "def overwriteFile(path, filecontents, logkey='')\n\tMcmlln::Tools.overwriteFile(path, filecontents)\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def replace_file( src, dest )\n if File.identical? src, dest\n puts \"identical #{dest}, ignoring\"\n else\n puts \"mv #{dest} #{dest}.orig\"\n File.rename( dest, \"#{dest}.orig\" )\n link_file( src, dest )\n end\nend", "def touch\n if !exists?\n touch_directories\n f = File.open(@filepath, \"w\"); f.close\n end\n end", "def overwriteFile(path,filecontents, logkey='')\n\tMcmlln::Tools.overwriteFile(path, filecontents)\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def combine_files!(infiles)\n make_files_by_datetime\n infiles.merge!(@files_by_datetime) do |key, oldval, newval|\n log_error(\"Key collision: #{key}, #{oldval}, #{newval}\")\n raise\n end\n end", "def move_files(tmpdir)\n entries_at_depth(tmpdir, new_resource.strip_components).each do |source|\n target = ::File.join(new_resource.destination, ::File.basename(source))\n # If we are in keep_existing mode, the target might exist already.\n # This is not a great solution and won't have exactly the same behavior\n # as the other providers, but it's something at least.\n FileUtils.rm_rf(target) if ::File.exist?(target)\n # At some point this might need to fall back to a real copy.\n ::File.rename(source, target)\n end\n end", "def check_overwrite(list)\n return if write?\n return if prompt?\n return if skip?\n #if newproject? && !output.glob('**/*').empty? # FIXME?\n # abort \"New project isn't empty. Use --force, --skip or --prompt.\"\n #end\n clobbers = []\n list.each do |action, fname|\n tpath = source + fname\n fpath = output + fname\n if fpath.file? #fpath.exist?\n clobbers << fname\n end\n end\n # TODO: implement --skip\n if !clobbers.empty?\n puts \" \" + clobbers.join(\"\\n \")\n raise \"These files would be overwritten. Use --write, --skip or --prompt.\"\n end\n end", "def remove_moved_files\n scan_for_merges.each do |file|\n if File.amp_lexist?(@repo.working_join(file))\n UI.debug(\"removing #{file}\")\n File.unlink(@repo.working_join(file))\n end\n end\n end", "def overwrite?; end", "def file_update\n File.rename(file_path,\n File.join(File.dirname(file_path),\n File.basename(file_path).gsub(/_\\d+\\.txt/, \"_#{Time.now.to_i}.txt\")))\n end", "def clear!\n \n # Removes old files in the test directory\n ['to', 'from'].each do |folder|\n Dir.glob(File.expand_path(File.dirname(__FILE__) + \"/data/#{folder}/*\")).each do |file|\n FileUtils.rm(file)\n end\n end\n \n {'some_zip_files.zip' => 'zip_real', 'test_package.rar' => 'rar_real'}.each_pair do |first, last|\n\n # Removes old files in the test directory\n Dir.glob(File.expand_path(File.dirname(__FILE__) + \"/data/#{last}/*\")).each do |file|\n FileUtils.rm(file) if Mimer.identify(file).text?\n end\n\n src = File.expand_path(File.dirname(__FILE__) + \"/data/o_files/#{first}\")\n dest = File.expand_path(File.dirname(__FILE__) + \"/data/#{last}/#{first}\")\n FileUtils.copy_file(src, dest)\n end\n\n # Removes old files in the test directory\n Dir.glob(File.expand_path(File.dirname(__FILE__) + \"/data/movie_to/*\")).each do |file|\n FileUtils.rm(file) if Mimer.identify(file).text?\n end\n \n {'test_package.rar' => 'to', 'some_zip_files.zip' => 'to'}.each do |first,last|\n src = File.expand_path(File.dirname(__FILE__) + \"/data/o_files/#{first}\")\n dest = File.expand_path(File.dirname(__FILE__) + \"/data/from/#{first}\")\n FileUtils.copy_file(src, dest)\n end\nend", "def RenDeletingFiles\n\t#arquivo = File.new(\"arquivo1.txt\", \"w\")\n\t#arquivo.close()\n\t#File.delete(\"arquivo1.txt\")\nend", "def fix_files\n Dir.glob(\"./audio/**/*.mp3\").each do |path|\n file_name = file_name_from_path(path)\n proper_file_name = file_name.gsub(/[^a-zA-Z1-9\\_\\.]/) { |char| \"_\" }\n unless file_name == proper_file_name\n `mv \"#{path}\" #{path.gsub(file_name, proper_file_name)}`\n end\n end\n end", "def roll_file! # :nodoc:\n do_once(stream) do\n archive_file = \"#{path}.#{archive_file_suffix}\"\n stream.flush\n current_inode = begin\n File.stat(path).ino\n rescue\n nil\n end\n if @file_inode && current_inode == @file_inode && !File.exist?(archive_file) && File.exist?(path)\n begin\n File.rename(path, archive_file)\n after_roll\n cleanup_files!\n rescue SystemCallError\n # Ignore rename errors since it indicates the file was already rolled\n end\n end\n reopen_file\n end\n rescue => e\n $stderr.write(\"Failed to roll file #{path}: #{e.inspect}\\n#{e.backtrace.join(\"\\n\")}\\n\")\n end", "def delete_files\n #TODO delete original file\n unless filename.blank?\n File.delete(splash_file(:full_path => true)) if File.exists?(splash_file(:full_path => true))\n File.delete(flv_file(:full_path => true)) if File.exists?(flv_file(:full_path => true))\n File.delete(original_file) if File.exists?(original_file)\n end\n end", "def no_clobber(name)\n return name unless File.exists?(name)\n (1..255).each { |v| n = name.sub(/\\.jpg$/,\".#{v}.jpg\"); return n unless File.exists?(n) }\nend", "def appendFile(src, dest)\n Dir.foreach(src) do |file|\n # Do not add file if it was in the exclusion list.\n next if exclude? file\n \n file = File.join(src, file)\n \n # Do not add file if it was in the manifest.\n next if in_manifest? file\n \n if File.directory? file\n appendFile(file, dest) # Recurse over directories.\n else\n # Open the file and copy its contents to the destination.\n begin\n f = File.open(file.strip! || file)\n f.each_line { |line| File.open(dest, 'a') { |f| f.write(line) } }\n f.close\n rescue => e\n puts \"FAILED!\"\n puts e.message\n exit\n end\n end\n end\nend", "def touch_if_not_exist(file)\n FileUtils.touch(file) unless File.exist?(file)\n file\n end", "def write_prep outfile\n return true unless File.exists? outfile\n\n # OK, file exists. See if we can clobber it\n if clobber?\n message { sprintf \"Overwriting existing file '%s'\", outfile }\n return true\n end\n\n message { sprintf \"Not overwriting existing file '%s'\", outfile }\n false\n end", "def update_filepath(_package_id:, _filepath:, _sha1:, _size:); end", "def download_all_files files,dest\n return if files.empty?\n RubyUtil::partition files do |sub|\n cmd = \"mv -t #{dest} \"\n cmd += sub.map { |f| \"\\\"#{f.full_path}\\\"\" }.join(' ')\n exec_cmd(cmd) \n end\n # update files object !\n files.map! { |f| f.path = dest; f }\n end", "def update(_show_output)\n @check_existing_files_for_update = true\n begin\n preheat_existing_files\n ensure\n @check_existing_files_for_update = false\n end\n []\n end", "def add_default_files_to_definition\n mkdir_p('files')\n default_files = File.join(File.dirname(__FILE__), '../../files')\n files = []\n chdir(default_files) do\n files += Dir.glob(\"**/*\")\n end\n files.each do |filespec|\n dest = File.join('files', filespec)\n unless File.exist?(dest)\n src = File.join(default_files, filespec)\n if File.file?(src)\n destdir = File.dirname(dest)\n mkdir_p(destdir) unless File.exist?(destdir)\n # puts \"cp(#{src}, #{dest}), destdir => #{destdir}\"\n cp(src, dest)\n end\n end\n end\n end", "def create_or_update_assets\n # All files in assets folder\n glob_path = File.join(clone_location, assets_subdirectory, \"*.{#{file_extensions.join(',')}}\")\n assets_paths = Dir.glob(glob_path) # full paths\n\n # Get jhove output in order to get the mime type and size for each asset.\n version_control_agent.get({ location: File.join(metadata_subdirectory, JHOVE_OUTPUT_FILENAME) }, clone_location)\n jhove_output = Bulwark::JhoveOutput.new(File.join(clone_location, metadata_subdirectory, JHOVE_OUTPUT_FILENAME))\n\n # Updating or creating asset record for each asset file\n assets_paths.each do |asset_path|\n filename = File.basename(asset_path)\n asset = assets.find_or_initialize_by(filename: filename)\n asset.original_file_location = version_control_agent.look_up_key(File.join(assets_subdirectory, filename), clone_location)\n asset.size = jhove_output.size_for(filename) # In bytes\n asset.mime_type = MIME::Type.simplified(jhove_output.mime_type_for(filename))\n asset.save!\n end\n\n # Removing references to files that have been removed.\n asset_filenames = assets_paths.map { |a| File.basename(a) }\n assets.each do |asset|\n asset.destroy unless asset_filenames.include?(asset.filename)\n end\n end", "def update_file(dst, ori_name, file)\n ori_file = dst.join(ori_name)\n File.delete(ori_file) if File.exist?(ori_file)\n hex = update_hex(get_prefix_from_name(ori_name), new_hex())\n new_name = rename_with_file_type(file.original_filename, hex)\n write_to_file(file, dst.join(new_name))\n new_name\n end", "def make_old(mode=:rm) #mode=:rm or :save\n ## After introduction of dyntask, the default is to save the old file if existing\n if File.exist? @filename\n case mode\n when :save\n FileUtils.mkdir_p(File.join(File.dirname(@filename),\".save\"))\n FileUtils.mv(@filename,@filename_old=File.join(File.dirname(@filename),\".save\",File.basename(@filename)))\n when :rm\n FileUtils.rm(@filename)\n end\n end\n end", "def install_file(source, destination)\n overwrite = overwrite? destination\n if overwrite.downcase == \"y\"\n FileUtils.copy_entry(source, destination, :preserve=>true, :remove_destination=>true)\n return true\n else\n puts \"Skipped installation of #{File.basename(source)}\"\n return false\n end\nend", "def hook_add_templates\n @flavor.class.before_add_templates do |templates, resource_action|\n if :create == resource_action && fail_on_clobber\n templates.each do |template|\n if File.exist?(destination_path(template))\n fail \"tried to overwrite file #{template}; pass '-a clobber' to override\"\n end\n end\n end\n end\n end", "def update_files_from(new_source)\n to_add = new_source.file_paths\n @metadata[:files] ||= {}\n @metadata[:files].each { |pkg,spec_files|\n (new_source.file_paths & to_add).each { |gem_file|\n # skip files already included in spec or in dir in spec\n has_file = spec_files.any? { |sf|\n gem_file.gsub(sf,'') != gem_file\n }\n\n to_add.delete(gem_file)\n to_add << gem_file.rpmize if !has_file &&\n !Gem.ignorable_file?(gem_file)\n }\n }\n\n @metadata[:new_files] = to_add.select { |f| !Gem.doc_file?(f) }\n @metadata[:new_docs] = to_add - @metadata[:new_files]\n end", "def merge_file(fp:, from_dir:, to_dir:, prepend_path: '', keep_rela_path: false, rename: nil)\n\n @@logger.debug \"merge_file #{fp}\"\n @try_counter += 1\n\n do_merge = false\n\n begin\n s_f = most_similar_file(fp, to_dir)\n if !(FileCompare.new(fp, s_f).similar?)\n # not exist, do merge, return target\n @@logger.info \"merge_file new! #{fp}\".green\n do_merge = true\n else\n # exist\n @@logger.info \"merge_file exist. #{s_f}\".yellow\n do_merge = false\n end\n rescue UncertainSimilarityError => e # not sure, user decided\n if !e.user_judge # files are not the same\n @@logger.info \"merge_file new! #{fp} \".green\n do_merge = true\n else # files are the same\n if user_confirm(\"Force merge and overwrite ???\".red)\n File.delete(e.b)\n do_merge = true\n else\n do_merge = false\n @@logger.info \"user skip merge_file #{fp}\"\n end\n end\n end\n\n if do_merge\n if nil != rename && '' != rename\n new_bn = rename\n else\n new_bn = File.basename(fp)\n end\n\n rel_path = Pathname.new(File.dirname(fp)).relative_path_from(Pathname.new(from_dir))\n if keep_rela_path\n @@logger.debug \"prepend_path #{prepend_path} rel_path #{rel_path}\"\n new_path = File.join(prepend_path, rel_path)\n else\n new_path = prepend_path\n end\n\n new_fp = File.join(to_dir, new_path, new_bn)\n\n if !Dir.exist?(File.join(to_dir, new_path))\n FileUtils.mkdir_p(File.join(to_dir, new_path))\n end\n\n FileUtils.cp(fp, new_fp, verbose: true)\n @file_trans.add(from:fp, to:new_fp)\n new_fp\n else\n nil\n end\n end", "def save_to(path)\n update\n Zip::OutputStream.open(path) do |out|\n zip.each do |entry|\n next unless entry.file?\n\n out.put_next_entry(entry.name)\n\n if @replace[entry.name]\n out.write(@replace[entry.name])\n else\n out.write(zip.read(entry.name))\n end\n end\n end\n end", "def mv!(to)\n files.map{|file| file.mv! to }\n end", "def clobber\n rm_r(srcdir)\n rm_r(blddir)\n rm_r(libdir)\n rm_r(config_file)\n end", "def prepend_file_to_file(file_name_1, data1, file_name_2)\n File.open(append_root_path(file_name_1), 'w') do |f1|\n f1.puts data1\n File.foreach(append_root_path(file_name_2)) do |f2|\n f1.puts f2\n end\n end\n end", "def update!\n if canonical_file.exist?\n if file.mtime > canonical_file.mtime\n save!\n end\n else\n save!\n end\n end", "def erase_svn_files\n Dir[\"#{save_dest_path}/**/.svn\"].each do |file|\n puts \"erasing target: #{file}\"\n FileUtils.remove_entry(file)\n end\n end", "def clean_up\n @files.each {|file| FileUtils.remove(file.path)}\n end", "def clobber_sprockets_assets\n manifest.clobber\n end", "def write_file(path, content)\n file_exists = File.exists?(path)\n if file_exists and not @force\n fail \"File #{path} already exists. Not overwritten. Use --force to overwrite\"\n end\n save_file(path,content)\n message = file_exists ? \"File #{path} overwriten with new content\" : \"File #{path} created\"\n Puppet.notice message\n end", "def update_file_paths\n if self.email_changed?\n old_storage_path = File.join(SystemConfiguration.first.storage_path, 'users', self.email_was)\n \n # If the directory exists, move/rename it.\n if File.directory?(old_storage_path) \n FileUtils.mv old_storage_path, File.join(SystemConfiguration.first.storage_path, 'users', self.email)\n end\n \n self.assignment_offerings.each do |assignment_offering|\n old_assignment_path = File.join(\n assignment_offering.course_offering.storage_path,\n 'assignments',\n assignment_offering.assignment.url_part,\n self.email_was)\n \n # If the directory exists, move/rename it.\n if File.directory?(old_assignment_path) \n FileUtils.mv old_assignment_path, File.join(\n assignment_offering.course_offering.storage_path,\n 'assignments',\n assignment_offering.assignment.url_part,\n self.email)\n end\n end\n \n end\n end", "def create_done_copying_files_to_local_file\r\n path = track_when_client_done_dir + \"/done_with_#{File.filename @current_transfer_file}_#{Socket.gethostname}#{extra_stuff_for_done_file}\"\r\n\tif File.exist? path\r\n\t raise \"file already exists #{path}?!\"\r\n\tend\r\n sleep! :client, \"touching done file #{path}\", 0\r\n FileUtils.touch path\r\n end", "def backup_existing_file(file_path)\n FileUtils.move(file_path, \"#{file_path}-#{Time.now.to_i.to_s}\")\n end", "def overwrite?(path)\n if File.exist?(path)\n return yes? \"A file already exists at '#{ path }'. Do you want to overwrite? [y/n]\"\n end\n true\n end", "def remove_old_files\n Dir\n .glob(\"#{@tmp_dir_path}/**/*\")\n .each { |path| FileUtils.rm_rf(path) if old?(path) }\n end", "def test_does_not_duplicate_if_file_already_exists\n test_file = 'extractor_test_small_sample'\n src_directory = File.join('testRawData', 'pdf/')\n dst_directory = File.join('testExtractedData', 'pdf/')\n\n\tnumber_files_before = TestUtils.count_files_directory(dst_directory)\n\n # Order of tests is not guaranteed, so create the file if necessary\n if (not File.exists?(\"#{dst_directory}#{test_file}.txt\"))\n system(\"#{$extractor_command} #{src_directory}#{test_file}.pdf #{dst_directory}\")\n number_files_before = number_files_before + 1\n end\n system(\"#{$extractor_command} #{src_directory}#{test_file}.pdf #{dst_directory}\")\n number_of_files_after = TestUtils.count_files_directory(dst_directory)\n \n assert_equal number_files_before, number_of_files_after\n end", "def obsolete_files\n out = (existing_files - new_files - new_dirs + replaced_files).to_a\n Jekyll::Hooks.trigger :clean, :on_obsolete, out\n out\n end", "def patch_aws_s3\n Dir['bin/*'].each do |bin|\n rm bin\n end\n end", "def batch_copy_missing_destination_files(files)\n dest_domain = DestDomain.find_by_namespace(@dest_mogile.domain)\n\n files.each do |file|\n # Quit if no results\n break if file.nil?\n\n # Quit if program exit has been requested.\n break if SignalHandler.instance.should_quit\n\n # Look up the source file's key in the destination domain\n destfile = DestFile.find_by_dkey_and_dmid(file.dkey, dest_domain.dmid)\n if destfile\n # File exists!\n # Check that the source and dest file sizes match\n if file.length != destfile.length\n # File exists but has been modified. Copy it over.\n begin\n Log.instance.debug(\"Key [ #{file.dkey} ] is out of date. Updating.\")\n stream_copy(file)\n @updated += 1\n @copied_bytes += file.length\n rescue => e\n @failed += 1\n Log.instance.error(\"Error updating [ #{file.dkey} ]: #{e.message}\\n#{e.backtrace}\")\n end\n else\n Log.instance.debug(\"key [ #{file.dkey} ] is up to date.\")\n @uptodate += 1\n end\n else\n # File does not exist. Copy it over.\n begin\n Log.instance.debug(\"key [ #{file.dkey} ] does not exist... creating.\")\n stream_copy(file)\n @added += 1\n @copied_bytes += file.length\n rescue => e\n @failed += 1\n Log.instance.error(\"Error adding [ #{file.dkey} ]: #{e.message}\\n#{e.backtrace}\")\n end\n end\n end\n end", "def new_images(repo, dest, image_files)\n dest ||= ''\n image_files.each do |f|\n tmp = f.tempfile\n file = File.join satellitedir, dest, f.original_filename\n FileUtils.cp tmp.path, file\n if dest.empty?\n repo.index.add f.original_filename\n else\n repo.index.add File.join(dest, f.original_filename)\n end\n end\n end", "def new_images(repo, dest, image_files)\n dest ||= ''\n image_files.each do |f|\n tmp = f.tempfile\n file = File.join satellitedir, dest, f.original_filename\n FileUtils.cp tmp.path, file\n if dest.empty?\n repo.index.add f.original_filename\n else\n repo.index.add File.join(dest, f.original_filename)\n end\n end\n end", "def check_overwrite(list)\n return if force?\n return if prompt?\n return if skip?\n #return if session.overwrite? # TODO: not so sure overwirte? option is a good idea.\n\n if newproject? && !output.glob('**/*').empty? # FIXME?\n abort \"New project isn't empty. Use --force, --skip or --prompt.\"\n end\n\n clobbers = []\n list.each do |action, loc, tname, fname, opts|\n tpath = loc + tname\n fpath = output + fname\n if fpath.file? #fpath.exist?\n clobbers << relative_to_output(fname)\n end\n end\n\n if !clobbers.empty?\n puts \" \" + clobbers.join(\"\\n \")\n abort \"These files would be overwritten. Use --force, --skip or --prompt.\" # TODO: implement --skip\n end\n end", "def move_files_to_destination!(files_array)\n files_array.each do |file|\n new_destination = \"#{@destinaton}/'dirty_#{file}'\"\n system(\"mv #{file} #{new_destination}\")\n destroy_dirty_file!(file)\n end\n puts \"=> #{files_array.count} files copied to #{@destination} and original files destroyed\"\n end", "def filter_nonexistent(modified_files); end", "def replace_file(file, target)\n LOGGER.info \"Replacing #{file}\".blue\n system %(rm -rf \"#{target}\")\n link_file(file, target)\nend", "def write\n entries = Dir.entries(@input_dir)\n entries.delete('.')\n entries.delete('..')\n # TODO: delete config file\n io = Zip::File.open(@output_file, Zip::File::CREATE)\n write_entries(entries, '', io)\n io.close\n end", "def tidy_up\n Dir[\"*nin\"].each do |file|\n File.delete(file)\n end\n Dir[\"*nhr\"].each do |file|\n File.delete(file)\n end\n Dir[\"*nsq\"].each do |file|\n File.delete(file)\n end\n Dir[\"*blast\"].each do |file|\n File.delete(file)\n end\n end", "def fix_image_links( file_name )\r\n\tlines = File.readlines(file_name)\r\n lines.each do |line| \r\n \tline.gsub!(/processed_files/, File.basename( file_name, '.htm') + \"_files\")\r\n\tend\r\n\tFile.open( file_name, 'w') { |f| f.write lines }\r\nend", "def update(files)\n reset_variables\n\n files.each do |filename|\n @files_processed[filename] = false\n @errors = false\n if File.file?(filename)\n begin\n temp_file = Tempfile.new('closed_courseware')\n @@current_filename = filename\n\n File.open(filename, 'r+') do |file|\n file.each_line do |line|\n begin\n line = https_it(line)\n\n temp_file.puts line\n rescue\n @errors = true\n end\n end\n end\n\n FileUtils.mv(temp_file.path, filename)\n temp_file.close\n temp_file.unlink\n\n if !@errors\n @files_processed[filename] = true\n end\n ensure\n temp_file.close\n temp_file.unlink\n end\n end\n end\n end", "def remove_stale_files() = stale_files.each { |file| remove_file(file) }", "def remove_unwanted_files!\n system(\"cd ../#{self.underscored_name} && rm public/index.html public/images/rails.png\")\n system(\"cd ../#{self.underscored_name} && mv config/database.yml config/database.yml.example\")\n end", "def obsolete_files; end", "def write_file\n\n # file_edited is false when there was no match in the whole file and thus no contents have changed.\n if file_edited\n backup_pathname = original_pathname + \".old\"\n FileUtils.cp(original_pathname, backup_pathname, :preserve => true)\n File.open(original_pathname, \"w\") do |newfile|\n contents.each do |line|\n newfile.puts(line)\n end\n newfile.flush\n end\n end\n self.file_edited = false\n end", "def force_file_collision?( dst )\n dst = dst.sub(%r/#{site}\\/?/, '')\n print \"overwrite #{dst}? [(Y)es (n)o (q)uit] \"\n case gets\n when %r/q/i then abort 'user asked to quit'\n when %r/n/i then :skip\n when %r/y/i then :force\n when %r/\\s*/ then :force\n else force_file_collision?(dst) end\n rescue\n retry\n end", "def existing\n select { |fn| File.exist?(fn) }.uniq\n end", "def fileMoveOldXlsx()\n oldXlsx()\n downloadDir = '~/Downloads'\n Dir.chdir(File.expand_path(downloadDir))\n puts \"Checking Downloads Directory for .xlsx files to clean before initiating Fixit...\"\n Dir.glob(\"*.xlsx\") {|file|\n if file\n puts \"Storing file name '#{file}' with .xlsx extension into OLD_XLSX_DATA on Desktop...\"\n temp_data_path = '~/Desktop/OLD_XLSX_DATA'\n FileUtils.mv(\"#{file}\", File.expand_path(temp_data_path))\n else\n puts \"No .xlsx files found in ~/Downloads...\"\n end\n }\nend", "def rename_everything_else\n Dir.glob(\"app/**/*\") do |app_file|\n next if File.directory?(app_file) || !text?(app_file)\n replace(app_file)\n end\n\n Dir.glob(\"lib/**/*.rb\") do |lib_file|\n replace(lib_file)\n end\n\n Dir.glob(\"**/*.rake\") do |rake_file|\n replace(rake_file)\n end\n\n Dir.glob(\"spec/**/*.rb\") do |spec_file|\n replace(spec_file)\n end\n end", "def setup(location = nil)\n @@logs ||= find_files(ArchiveRoot)\n find_files(location) if @@logs.empty?\n @@logs.each do |name,file|\n\tunless File.size?(file)\n\t FileUtils.touch(file)\n\tend\n end\n update\n end", "def single_ucf_file_lists\n File.open(single_bad_ucf_file, 'a') do |mergedfile|\n Dir.glob(\"#{output_directory_path}*name.txt\").each do |file|\n File.foreach(file) do |line|\n mergedfile.write(line)\n end\n end\n end\n end", "def overwrite_older_packages(uploaded_file)\n return [] unless uploaded_file.overwrite || uploaded_file.read_only\n originals = uploaded_file.original_inputs\n return [] unless originals.present?\n sha2_hashes = []\n originals.where('input_sub_category != ? OR input_sub_category is null',\n OriginalInput::XML_SANITIZED).reject { |orig|\n orig.nil? || orig.sha2_hash.nil? }.each { |orig|\n sha2_hashes << orig.sha2_hash\n }\n\n return [] if sha2_hashes.empty?\n\n lst = UploadedFile.joins(:original_inputs)\n .where(validate_only: false)\n .where(original_input: {sha2_hash: sha2_hashes, mime_type: 'text/stix'}).all\n\n overwritten_pkg_guids = []\n\n lst.each do |u|\n u.update_attribute(:status, 'R') if u.status!='I'\n p = StixPackage.where(uploaded_file_id: u.guid).first\n unless p.nil?\n overwritten_pkg_guids << p.guid if p.guid.present?\n p.indicators.destroy_all\n p.destroy\n end\n end\n overwritten_pkg_guids.uniq\n end", "def user_allows_overwrite?(file, opts = {})\n if File.exist?(File.expand_path(file)) && !opts[:force]\n print I18n.t(:overwrite) % file\n answer = HighLine::SystemExtensions.get_character.chr\n puts answer\n return answer =~ /^y/i\n else\n return true\n end\n end", "def clean_files\n FileUtils.rm(Dir[File.join(Rails.root, 'public/sitemap*.xml.gz')])\n end", "def move!(new_path)\n if exists?\n FileUtils.mv(path, new_path) unless File.identical?(new_path, path)\n else\n File.open(new_path, \"wb\") { |f| f.write(read) }\n end\n end", "def copy!(new_path)\n if exists?\n FileUtils.cp(path, new_path) unless new_path == path\n else\n File.open(new_path, \"wb\") { |f| f.write(read) }\n end\n end", "def write()\n entries = Dir.entries(@input_dir); entries.delete(\".\"); entries.delete(\"..\")\n io = Zip::ZipFile.open(@output_file, Zip::ZipFile::CREATE);\n write_entries(entries, \"\", io)\n io.close();\n end", "def existing_files(my_files = true)\n # I can do this in a convoluted set of if checks, of a couple readable selects.\n output = target_files.select { |f| File.exist? f }\n output.delete_if { |f| my_files && is_my_file?(f)}\n\n return output\n end", "def write_to(path)\n if !File.exists?(path)\n FileUtils.mkdir_p(path)\n else\n raise FileExists.new(\"#{path} already exists\")\n end\nend", "def transition_unified_files(file)\r\n\t\tfile.close\r\n\t\tbase_name, path_name, idx = File.basename(file.path, '.log'), File.dirname(file.path), 2\r\n\t\twhile(true)\r\n\t\t\tnew_filepath = path_name + \"/\" + base_name + \"_#{idx}.log\"\r\n\t\t\tif(!File.exists?(new_filepath))\r\n\t\t\t\tFileUtils.mv(file.path, new_filepath) # move our old file to an unused filename\r\n\t\t\t\tfile = File.open(path_name + \"/\" + base_name + \".log\", 'a+') # and re-open a new file with the same name as our old file\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\t\t\tidx += 1\r\n\t\tend\r\n\t\tfile\r\n\tend", "def close_files\n [self.source, self.original, self.destination].each do |f|\n next unless f\n begin\n f.close\n File.unlink(f) if SystemInformation.env == 'production'\n rescue\n nil\n end\n end\n end", "def remove_created_file(file_path)\n File.delete(file_path) if file_path && File.exist?(file_path)\nend", "def new_files\n @new_files ||= Set.new.tap do |files|\n site.each_site_file { |item| files << item.destination(site.dest) }\n end\n end", "def ensure_exists\n create unless Dir.exist? path\n end", "def mirror_file(source, dest, copied = [], duplicated = [], postfix = '_override')\n base, rest = split_name(source)\n dst_dir = File.dirname(dest)\n dup_path = dst_dir / \"#{base}#{postfix}.#{rest}\" \n if File.file?(source)\n mkdir_p(dst_dir) unless File.directory?(dst_dir)\n if File.exists?(dest) && !File.exists?(dup_path) && !FileUtils.identical?(source, dest)\n # copy app-level override to *_override.ext\n copy_entry(dest, dup_path, false, false, true)\n duplicated << dup_path.relative_path_from(Merb.root)\n end\n # copy gem-level original to location\n if !File.exists?(dest) || (File.exists?(dest) && !FileUtils.identical?(source, dest))\n copy_entry(source, dest, false, false, true) \n copied << dest.relative_path_from(Merb.root)\n end\n end\n end" ]
[ "0.66117394", "0.6401798", "0.6383692", "0.6383692", "0.62887317", "0.62620294", "0.6222159", "0.6203022", "0.61995614", "0.61201465", "0.60260844", "0.60065997", "0.60051936", "0.59999794", "0.59840053", "0.5977647", "0.58961195", "0.58834416", "0.5871559", "0.58712983", "0.586147", "0.58547974", "0.58444214", "0.5823057", "0.58150655", "0.5792364", "0.5765957", "0.5743633", "0.57359076", "0.5713851", "0.57135314", "0.5682799", "0.56616014", "0.5645336", "0.56418073", "0.5636553", "0.5629703", "0.56270796", "0.56210333", "0.561497", "0.56063366", "0.5588083", "0.5573165", "0.5568814", "0.556638", "0.5547612", "0.5542468", "0.55392593", "0.55388397", "0.5536137", "0.55232036", "0.552179", "0.5511831", "0.55079967", "0.5495514", "0.54901534", "0.54892665", "0.5481769", "0.5480018", "0.5478763", "0.5476227", "0.5464672", "0.5457257", "0.5454618", "0.5437747", "0.54349643", "0.5430919", "0.54294986", "0.54294986", "0.54287565", "0.5417718", "0.5404731", "0.5393369", "0.5392501", "0.5387826", "0.53818375", "0.53745747", "0.5357588", "0.5355753", "0.53445965", "0.5344128", "0.534184", "0.53405637", "0.5337349", "0.5318488", "0.5318228", "0.5303711", "0.53024673", "0.5300111", "0.52997524", "0.5292963", "0.52891284", "0.52827513", "0.5279643", "0.5278588", "0.52777123", "0.52764696", "0.52751017", "0.52738947", "0.52711535", "0.52689743" ]
0.0
-1
run but do not make any changes
def quiet?; run_options[:quiet]; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n log \"Nothing to do.\"\n end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def unrun\n log \"Nothing to do.\"\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def dry_run\n @dry_run = true\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n \n end", "def run\n \n end", "def run() end", "def run\n raise \"Not implemented yet.\"\n end", "def run\n nil\n end", "def run()\n end", "def run(cmd)\n result = super(cmd)\n if result.error?\n display \"FAILURE\"\n display result.error\n remove_livedev_run_file\n exit 1\n end\n end", "def run(_); end", "def run(_); end", "def run_on_changes(_)\n restart\n end", "def run\n false\n end", "def run!\n run\n die\n end", "def exec; end", "def exec; end", "def inherited\n super\n @run = false\n end", "def run\n end", "def run_all\n jammit\n end", "def run_all\n true\n end", "def run_all\n true\n end", "def run_all\n true\n end", "def run_all\n true\n end", "def start_run; end", "def autorun!\n at_exit do\n exit 1 unless run!\n end\n end", "def run\n raise \"A subclass should override the `CLAide::Command#run` method to \" \\\n \"actually perform some work.\"\n end", "def run!\n report_startup\n setup_stage\n stage_operations\n managed_copy\n remove_stage\n report_complete\n end", "def run_main\n end", "def autorun; end", "def run_all\n run_on_changes\n end", "def run_all()\n end", "def running; end", "def running; end", "def run_all\n deploy_code\n run_test\n end", "def run_all\n end", "def run_all\n end", "def run\n raise \"Not implemented for this check.\"\n end", "def main_run\n raise NotImplementedError\n end", "def dry_run *args\n raise \"Not implemented: #{self.class.name}::dry_run\"\n end", "def script; end", "def script; end", "def run \n create_model_file\n create_migration if @valid==true\n enable_apis if @valid==true\n end", "def always_run=(_arg0); end", "def run\n raise ArgumentError, \"You must override this method\"\n end", "def run_on_change(paths)\n jammit\n end", "def original_run_command; end", "def run!\n raise NotImplementedError\n end", "def runner; end", "def run; new.run; end", "def run()\n\t\tif Core::DEBUG\n\t\t\traise \"View #{self.class.name} can't be build because run method is not redefined.\"\t\t\n\t\tend\n\tend", "def run_all\n copy_all_functions \"Rebuilding all functions\", true\n end", "def run_on_change(paths)\n UI.info \"Functions have changed, copying over\"\n ::Forge::Guard.builder.clean_functions\n ::Forge::Guard.builder.copy_functions\n ::Forge::Guard.builder.clean_includes\n ::Forge::Guard.builder.copy_includes\n end", "def run_on_change(paths)\n clean_paths = Inspector.clean(paths)\n paths.each { |path| reload_file(path) }\n return unless clean_paths.any?# TODO: Maybe bug in guard: watches files not actualy matching, like stuff in db/\n passed = Runner.run(clean_paths, cli)\n if passed\n Formatter.notify \"Awesome, passing! Will check other specs too.\", :image => :success\n else\n Formatter.notify \"Try harder, failing.\", :image => :failed\n end\n end", "def run_on_change(paths)\n puts paths\n deploy_code\n paths.each do |path|\n run_test(path) if File.exists?(\"src/#{path}\")\n end\n end", "def runs; end", "def running\n fail 'not impl.'\n end", "def run\n BerksEffit::FileUtils.nuke_it_all\n end", "def run!(not_used_arg)\n while work = @master.get_work\n puts work.inspect\n Experiment::Config.set work[:options]\n @current_cv = work[:cv]\n @dir = work[:dir]\n @data = work[:input]\n #@data = work[:input]\n execute_experiment!\n \t\t\tresult = analyze_result!(@dir + \"/raw-#{@current_cv}.txt\", @dir + \"/analyzed-#{@current_cv}.txt\")\n \t\t\twrite_performance!\n \t\t\t@master.submit_result @current_cv, result, @abm.first\n end\n\n end", "def runnables; end", "def main; end", "def main\n\n end", "def refork; end", "def run_syncdb\n manage_py_execute('syncdb', '--noinput') if new_resource.syncdb\n end", "def sync\n run 'sync', :quiet => true\n end", "def main\n end", "def run(app)\n raise '@run already set' if @run\n\n @run = app\n end", "def run_on_change(paths = {})\n restart\n end", "def run\n reconfigure\n setup_application\n run_application\n end", "def run_on_changes(paths)\n restart\n end", "def program; end", "def dry_run\n Job::run self\n end", "def run!\n project.mode = :release\n\n # Validate paths\n validate_paths!\n\n # Extract mockup\n copy_source_path_to_build_path!\n\n validate_stack!\n\n # Run stack\n run_stack!\n\n # Cleanup\n cleanup! if config[:cleanup_build]\n ensure\n project.mode = nil\n end", "def run\n puts \"Hello world\"\n end", "def execute!; end", "def run_commands_for_changed_file(files)\n if files and there_are_test_files_to_run?(files)\n commands = @application.construct_commands_for_changed_files(files)\n @application.run!(commands)\n end\n end", "def do_run\n return unless @output\n\n @output_buffer = []\n @output.value = ''\n @editor.focus\n source = @editor.value.strip\n return unless source\n\n # Add additional code if available\n if @loaded && @current_item && @current_item.load_code\n source = \"#{@current_item.load_code}\\n#{source}\"\n end\n\n # Compile\n begin\n code = Opal.compile(source)\n rescue Exception => err\n log_error err\n end\n\n # Run\n eval_code code\n end", "def run!\n raise NotImplemented\n end", "def execute\n return performModify(true)\n end", "def before_run; end", "def dirty; end" ]
[ "0.7166728", "0.65911394", "0.65911394", "0.65911394", "0.65911394", "0.65911394", "0.65911394", "0.65911394", "0.65911394", "0.65911394", "0.6561049", "0.65026355", "0.64395726", "0.64395726", "0.64395726", "0.64395726", "0.64395726", "0.64395726", "0.64395726", "0.63959503", "0.63956916", "0.63956916", "0.63902247", "0.63407624", "0.63407624", "0.6307304", "0.6263686", "0.6250294", "0.6244409", "0.62190944", "0.6188804", "0.6188804", "0.6159804", "0.61463237", "0.61035156", "0.6094618", "0.6094618", "0.6078613", "0.60525984", "0.6032235", "0.6027208", "0.6027208", "0.6027208", "0.6027208", "0.6002738", "0.5985665", "0.5976693", "0.59646875", "0.5964581", "0.5954367", "0.5947224", "0.5938391", "0.5928593", "0.5928593", "0.5888537", "0.5878612", "0.5878612", "0.5860697", "0.5851655", "0.5837407", "0.5825526", "0.5825526", "0.58186543", "0.5815566", "0.58138216", "0.5806368", "0.58025736", "0.5799622", "0.5798073", "0.57903415", "0.57758904", "0.57750463", "0.5763229", "0.5761735", "0.5757648", "0.56898767", "0.5685434", "0.56831354", "0.56465435", "0.56206244", "0.5614951", "0.56101644", "0.5606565", "0.5586251", "0.55798864", "0.5569664", "0.55650175", "0.55569607", "0.5545725", "0.5543897", "0.5540583", "0.5530862", "0.55272776", "0.55255294", "0.55244607", "0.5524174", "0.5519256", "0.5512101", "0.5511493", "0.5504684", "0.5500478" ]
0.0
-1
skip files that already exist Run Options
def debug?; run_options[:debug]; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_options_values\n # Check if files specified with -f option exist\n if @options[:files].nil?\n @files = ['lib', 'bin', 'app', 'test', 'spec', 'feature']\n else\n @files = @options[:files].split(',')\n @files.delete_if do |filename|\n unless File.exist?(filename)\n puts \"#{filename} does not exist. Ignore it.\"\n true\n end\n end\n if @files.empty?\n puts 'No file to analyze. Aborted!'\n exit\n end\n end\n # Check if files specified with -e option exist\n unless @options[:exclude].nil?\n @excluded_files = @options[:exclude].split(',')\n @excluded_files.delete_if do |filename|\n unless File.exist?(filename)\n puts \"#{filename} does not exist. Ignore it.\"\n true\n end\n end\n end\n end", "def load_file_exclusions\n return unless config_hash[\"Exclude Files\"]\n config_options[:excluded_files] = []\n config_hash[\"Exclude Files\"].each do |short_file|\n config_options[:excluded_files] << File.join(starting_path, short_file)\n end\n end", "def except(*skips)\n skips.each {|option| @options.delete option}\n end", "def excluded_files() = []", "def skip(skip = nil)\n set_option(:skip, skip)\n end", "def skip_step?(filename, step)\n if File.exist?(filename) && !@force_overwrite\n print_e \"SKIPPED #{step}: #{filename} already exists.\"\n true\n else\n print_e \"RUN #{step} => #{filename}\"\n false\n end\n end", "def ignored_files=(_arg0); end", "def skip_paths=(_arg0); end", "def should_be_skipped_by_paths?(filepath)\n exclude_by_paths = options[:exclude_by_paths]\n filter_by_paths = options[:filter_by_paths]\n exclude_by_paths.any? { |pattern| pattern.match?(filepath) } ||\n (filter_by_paths && !filter_by_paths.empty? && !filter_by_paths.any? { |pattern| pattern.match?(filepath) })\n end", "def run!(options={})\n options[:exclude_paths] ||= []\n options[:include_paths].each do |path|\n DIR_PATTERS << path\n end if options[:include_paths]\n \n DIR_PATTERS.each do |main_dir|\n Dir.glob(main_dir).each do |path|\n # skip to the next file if this file matches exclude_paths\n next if options[:exclude_paths].detect { |pattern| File.fnmatch(pattern, path) }\n StampFile.new(path, options).stamp!\n end \n end\n true # return true (success)\n end", "def fallback_mode_test_files\n all_test_files_to_run\n end", "def excluded_spec_files\r\n # NOTE, testing only for faster develping agent, remove a couple of test later\r\n [\"selected_scripts_spec.rb\", \"03_passenger_spec.rb\"]\r\nend", "def validate_naming_options(args, options)\n if args.empty?\n $stderr.puts(\"Error due to missing files to analyze. You must provide at least one log file (csv).\\n\")\n exit!\n end\n\n if !options.update.empty? && !File.exist?(options.update)\n $stderr.puts(\"Error: File #{options.update} does not exist.\\n\")\n exit!\n end\nend", "def skip(name)\n puts pretty_console_block(\"DIR ALREADY EXISTS; SKIPPING: #{name}\", :yellow)\n end", "def filter_nonexistent(modified_files); end", "def skip_paths; end", "def clean_files\n #FileUtils.rm options[:file], v\n return true if !options[:file]\n FileUtils.rm options[:file] if File.file? options[:file]\n FileUtils.rm backup_file if File.file? backup_file\n return true\n end", "def remove_files(pattern,skip=nil)\n Dir.glob(pattern).each do |file_name|\n remove_file(file_name) unless file_name == skip\n end\n end", "def excluded_spec_files\r\n # NOTE, testing only for faster develping agent, remove a couple of test later\r\n [\"selected_scripts_spec.rb\", \"passenger_spec.rb\"]\r\nend", "def remove_files_we_dont_need\n say 'Remove files we don\\'t need'\n build :remove_public_index\n build :remove_readme_rdoc\n end", "def ignoring\n %w{*_test.lua *_spec.lua .*}\n end", "def excluded_spec_files\n # NOTE, testing only for faster develping agent, remove a couple of test later\n [\"selected_scripts_spec.rb\", \"passenger_spec.rb\"]\nend", "def skip_load_resource(*args)\n options = args.extract_options!\n name = args.first\n ape_skipper[:load][name] = options\n end", "def validate_run_options(args, options)\n\n if (options.machine.empty?)\n $stderr.puts(\"You have to tag your benchmark data with the --machine flag.\\n\")\n exit!\n end\n\n if (options.experiment.empty?)\n $stderr.puts(\"You have to tag your benchmark data with the --experiment flag.\\n\")\n exit!\n end\n\n if options.coverage < 0 || options.coverage > 1.0\n $stderr.puts(\"Error in --coverage flag: Coverage must be in [0..1.0]\\n\")\n exit!\n end\n\n if options.repetitions < 1\n $stderr.puts(\"Error in --repetitions flag: Repetitions must be >= 1\\n\")\n exit!\n end\n\n if options.concurrency < 1\n $stderr.puts(\"Error in --concurrency flag: Concurrency must be >= 1\\n\")\n exit!\n end\n\n if options.timeout < 1\n $stderr.puts(\"Error in --timeout flag: Timeout must be >= 1 seconds\\n\")\n exit!\n end\n\n if args.empty?\n $stderr.puts(\"You have to specify a log file.\\n\")\n exit!\n end\n\n if args.length > 1\n $stderr.puts(\"You should only specify one log file. You specified #{args.length} logfiles.\\n\")\n exit!\n end\n\n if File.exist?(args[0])\n $stderr.puts(\"Logfile #{args[0]} already exists. You do not want to overwrite collected benchmark data.\\n\")\n exit!\n end\n\nend", "def process_options\n @options.verbose = false if @options.quiet\n # @options.output = \"#{@options.output}/#{File.basename(@options.input)}\" if File.directory?(@options.output)\n @options.output = \"#{@options.output}\" if (File.directory?(@options.output) && File.exists?(File.dirname(@options.output)))\n end", "def remove_check_file(opts)\n opts = check_params(opts,[:file_info])\n super(opts)\n end", "def should_skip\n @skip = process_exist? if @skip.nil?\n @skip\n end", "def exclude_opts\n excludes.map { |exclude_pattern|\n \"--exclude='#{exclude_pattern}'\"\n }.join(' ')\n end", "def testUselessProcessesSourceFiles\n execute_Mix_WithConf({\n :WaveFiles => {\n :FilesList => [\n {\n :Name => 'Wave.wav'\n }\n ]\n },\n :Mix => {\n 'Final' => {\n :Tracks => {\n 'Wave.wav' => {\n :Processes => [\n {\n :Name => 'VolCorrection',\n :Factor => '2db'\n },\n {\n :Name => 'VolCorrection',\n :Factor => '-2db'\n }\n ]\n }\n }\n }\n }\n },\n :PrepareFiles => [\n [ 'Wave/Empty.wav', 'Wave.wav' ]\n ]) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n assert Dir.glob('05_Mix/*.wav').empty?\n assert_wave_lnk 'Empty', '05_Mix/Final/Final.wav'\n end\n end", "def skip_this_when_file_not_found(enabled: true, &example)\n skip_this_when enabled: enabled, expected_exception: Errno::ENOENT, &example\n end", "def exclude?(file)\n File.directory?(file) ||\n file.starts_with?(File.join(self.root_dir, 'samples')) ||\n File.basename(file).starts_with?('_')\n end", "def check_continue\n filename = SAVE_PATH + SAVE_FILE_NAME.gsub(/\\{ID\\}/i) { '*' }\n @continue_enabled = (Dir.glob(filename).size > 0)\n end", "def check_usage\n unless ARGV.length == 2\n puts \"Usage: merge_files.rb dir_path merge_filename\"\n exit\n end\nend", "def prepare_options!\n @cli_options = ARGV.dup.uniq\n @save_options = !!@cli_options.delete('--save')\n\n if options.rails?\n sources.concat(detect_sources)\n set_rails_defaults\n end\n end", "def save_metas_options_skip\n false\n end", "def file_clear_options(file)\n file.sections.each do |sec|\n block_clear_options(sec)\n sec.interfaces.each do |itf|\n block_clear_options(itf)\n end\n end\nend", "def no_file(num, run)\n read = false\n while run\n num += 1\n run = work_prompt(nil, num, read)\n end\n end", "def check_for_inexistent_files\n inexistent_files = []\n @files.each do |file|\n inexistent_files << file unless File.exists? file\n end\n\n inexistent_files\n end", "def mayuse(opts, path)\n if not opts.excludefiles.empty? then\n findme = path\n if opts.use_basename then\n findme = File.basename(path)\n end\n opts.excludefiles.each do |rx|\n if findme.match(rx) != nil then\n return false\n end\n end\n end\n return true\nend", "def run!\n raise 'pry and parallel options are incompatible :(' if @parallel && @pry\n\n if @help || @files.empty? && @pattern.nil?\n puts option_parser.help\n else\n search\n end\n end", "def check_bootstrap_files!(*list_of_opts)\n list = list_of_opts.map {|k| bootstrap_options[k]}\n files = list.map {|f| File.expand_path(f.to_s)}\n notfound = files.select {|f| !File.exist?(f)}\n notfound.empty? or \n raise Hazetug::Exception, \"File(s) not found: #{notfound.join(', ')}\"\n end", "def destroy_non_video_files!\n files = get_files(\"*\")\n \n files.each do |file|\n if is_sample_file(file)\n destroy_dirty_file!(file)\n elsif is_video_file?(file)\n next \n elsif File.directory?(file)\n destroy_directory!(file)\n else\n destroy_dirty_file!(file)\n end\n end\n end", "def add_asset_files(options)\n select_assets(options).each do |name, assets|\n next if name == 'config-file'\n assets.each {|file| file.add unless file.disabled? }\n end\n end", "def discard\n FileUtils.rm options.output\n end", "def discard\n FileUtils.rm options.output\n end", "def ignored_files\n all_files.select { |f| ignore_matcher.matched?(f) }\n end", "def post_processing\n @opts.each do |opt|\n if opt.required? && !@results.key?(opt.to_sym)\n fail \"The option #{opt.to_sym} is required\"\n end\n end\n end", "def error_for_no_files files\n command_abort <<-HERE.gsub(/\\n +/,\"\\n\").strip\n No matching content file(s) found at or under (#{files.join(', ')})\n from here. (This corresponds to the 'source_file_basenames' setting in\n config.yaml.) Did you generate the NanDoc site in the right directory?\n HERE\n end", "def find_specs_without_tasks\n spec_file_names.reject do |spec|\n manifest = Noop::Utils.convert_to_manifest spec\n task_file_names.include? manifest\n end\n end", "def generate_options(filename, code); end", "def generate_options(filename, code); end", "def missing_option; end", "def missing_option; end", "def missing_option; end", "def missing_option; end", "def missing_option; end", "def missing_option; end", "def missing_option; end", "def missing_option; end", "def missing_option; end", "def skip_globals?(file_name_spec)\n return false unless file_name_spec == Noop::Config.spec_name_globals\n return true unless options[:filter_specs]\n not spec_included? file_name_spec\n end", "def should_skip\n if @needed.nil?\n @needed = prerequisite_tasks.empty? || \\\n input_files.since(@last_executed).any? || \\\n @force\n\n # We also make sure that if the rakefile was modified since last\n # execution, we force reexecution\n if @application.rakefile\n @needed ||= File.mtime(@application.rakefile) > @last_executed\n end\n end\n !@needed\n end", "def process_other_source_files\n files = @options[:include_source_files].flatten\n files.each do |f|\n FileUtils.cp Dir[f], @working_dir\n end\n end", "def run!\n target_files.shuffle.each do |target_file|\n FileRunnerBasic.new(target_file).run!\n end\n end", "def remove_match_clone(options)\n UI.command \"removing #{options[:dir]}\"\n FileUtils.remove_entry_secure options[:dir]\nend", "def exclude_files(files, pwd)\n Dir.chdir(pwd)\n exclusions = @engine_config['exclude_paths'] || []\n files.reject { |f| exclusions.include?(f) }\n end", "def excluded_files\n # TODO: also append files marked as %{exclude} (or handle elsewhere?)\n missing_files_for(upstream_gem)\n end", "def find_unmatched_specs\n spec_file_names.reject do |spec|\n next true if spec == Noop::Config.spec_name_globals\n task_list.any? do |task|\n task.file_name_spec == spec\n end\n end\n end", "def find_tasks_without_specs\n task_file_names.reject do |manifest|\n spec = Noop::Utils.convert_to_spec manifest\n spec_file_names.include? spec\n end\n end", "def has_option(opt)\n\n # Create a simple test file\n f = Tempfile.new(['test_has_option', @extension]);\n f.puts 'int main() { }'\n f.flush\n\n#FIXME: /dev/null not portable\n cmd = [ @path, opt, '-o /dev/null', '-c', f.path ].join(' ') + Platform.dev_null\n Platform.execute cmd\n end", "def ignore_paths(options)\n source = options['source']\n destination = options['destination']\n config_files = Configuration[options].config_files(options)\n paths = config_files + Array(destination)\n ignored = []\n\n source_abs = Pathname.new(source).expand_path\n paths.each do |p|\n path_abs = Pathname.new(p).expand_path\n begin\n rel_path = path_abs.relative_path_from(source_abs).to_s\n ignored << Regexp.new(Regexp.escape(rel_path)) unless rel_path.start_with?('../')\n rescue ArgumentError\n # Could not find a relative path\n end\n end\n ignored\n end", "def skip!\n @skip ||= true\n end", "def unused_options\n parser.unused_options\n end", "def skip\n end", "def skip\n end", "def unneeded_files_in_destination\n requested_paths = files.map do |file|\n file.pkg_destination_path\n end\n\n existing_paths = FileFinders::Normal.new(destination_path).find_all('*')\n\n unnecessary_paths = existing_paths - requested_paths\n\n unnecessary_paths.select! do |path|\n !::File.directory?(File.join(destination_path, path))\n end\n\n unnecessary_paths\n end", "def runner_options\n {\n color: false,\n progress: false\n }.merge(@options)\n end", "def stop_on_unknown_option!(*command_names)\n stop_on_unknown_option.merge(command_names)\n end", "def process_options\n options.delete_if { |x,y| y.nil? }\n if options.empty?\n puts @optparse \n exit 0\n end\n options.each do |x,y|\n begin\n if y.to_s.match('^-')\n raise BoilerMakerErr.new(\"Bad args: \\\"#{y}\\\" is not a valid arg to option, \\\"--#{x}\\\". Use the -h flag for syntax help.\")\n end\n rescue => error\n puts error.message + \"\\n\"\n exit 1\n end\n end\n end", "def add_extra_files(*files)\n files.map! {|f| f.include?(\"*\") ? Dir.glob(f) : f }.flatten!\n files.each do |file|\n raise Errno::ENOENT, \"Could not find extra file: #{file}\" unless File.file?(file)\n options[:files] << file\n end\n end", "def process_options\n \n \n @options.verbose = false if @options.quiet\n end", "def keep_files=(_arg0); end", "def modified_files(options); end", "def modified_files(options); end", "def before_loading_app_code_step2(options)\n # Do nothing\n end", "def exclude(*files)\n @paths[''].exclude *files\n self\n end", "def force_copy\n add option: \"-force-copy\"\n end", "def ignored_file?(path); end", "def process_options\n @options.verbose = false if @options.quiet\n end", "def process_options\n @options.verbose = false if @options.quiet\n end", "def process_options\n @options.verbose = false if @options.quiet\n end", "def process_options\n @options.verbose = false if @options.quiet\n end", "def process_options\n @options.verbose = false if @options.quiet\n end", "def process_options\n @options.verbose = false if @options.quiet\n end", "def process_options\n @options.verbose = false if @options.quiet\n end", "def process_options\n @options.verbose = false if @options.quiet\n end", "def process_options\n @options.verbose = false if @options.quiet\n end", "def process_exclusions(globs); end", "def no_junk?(files)\n uns = files - supported(files)\n uns.reject! { |f| f.basename.to_s == 'front.jpg' }\n\n return true if uns.empty? || uns.all?(&:directory?)\n\n raise Aur::Exception::LintDirBadFile, uns.sort.join(\"\\n \")\n end", "def purgefiles\n\n pattern = @commandline.arguments\n purgeall = @commandline.option(\"all\")\n recurse = @commandline.option(\"recurse\")\n\n $dontaskprefixes.push(Dir.glob(\"mpx-*\"))\n\n if purgeall then\n $dontaskprefixes.push(Dir.glob(\"*.tex.prep\"))\n $dontaskprefixes.push(Dir.glob(\"*.xml.prep\"))\n end\n\n $dontaskprefixes.flatten!\n $dontaskprefixes.sort!\n\n if purgeall then\n $forsuresuffixes.push($texnonesuffixes)\n $texnonesuffixes = []\n $forsuresuffixes.flatten!\n end\n\n if ! pattern || pattern.empty? then\n globbed = if recurse then \"**/*.*\" else \"*.*\" end\n files = Dir.glob(globbed)\n report(\"purging#{if purgeall then ' all' end} temporary files : #{globbed}\")\n else\n report(\"purging#{if purgeall then ' all' end} temporary files : #{pattern.join(' ')}\")\n pattern.each do |pat|\n nosuf = File.unsuffixed(pat)\n globbed = if recurse then \"**/#{nosuf}-*.*\" else \"#{nosuf}-*.*\" end\n report(\"checking files that match '#{globbed}'\")\n files = Dir.glob(globbed)\n globbed = if recurse then \"**/#{nosuf}.*\" else \"#{nosuf}.*\" end\n report(\"checking files that match '#{globbed}'\")\n files.push(Dir.glob(globbed))\n end\n end\n files.flatten!\n files.sort!\n\n $dontaskprefixes.each do |file|\n removecontextfile(file)\n end\n $dontasksuffixes.each do |suffix|\n files.each do |file|\n removecontextfile(file) if file =~ /#{suffix}$/i\n end\n end\n $forsuresuffixes.each do |suffix|\n files.each do |file|\n removecontextfile(file) if file =~ /\\.#{suffix}$/i\n end\n end\n files.each do |file|\n if file =~ /(.*?)\\.\\d+$/o then\n basename = $1\n if file =~ /mp(graph|run)/o || FileTest.file?(\"#{basename}.mp\") then\n removecontextfile($file)\n end\n end\n end\n $dummyfiles.each do |file|\n (File.delete(file) if (FileTest.size?(file) rescue 10) < 10) rescue false\n end\n $texnonesuffixes.each do |suffix|\n files.each do |file|\n if file =~ /(.*)\\.#{suffix}$/i then\n if FileTest.file?(\"#{$1}.tex\") || FileTest.file?(\"#{$1}.xml\") || FileTest.file?(\"#{$1}.fo\") then\n keepcontextfile(file)\n else\n strippedname = $1.gsub(/\\-[a-z]$/io, '')\n if FileTest.file?(\"#{strippedname}.tex\") || FileTest.file?(\"#{strippedname}.xml\") then\n keepcontextfile(\"#{file} (potential result file)\")\n else\n removecontextfile(file)\n end\n end\n end\n end\n end\n\n files = Dir.glob(\"*.*\")\n $dontasksuffixes.each do |suffix|\n files.each do |file|\n removecontextfile(file) if file =~ /^#{suffix}$/i\n end\n end\n\n if $removedfiles || $keptfiles || $persistentfiles then\n report(\"removed files : #{$removedfiles}\")\n report(\"kept files : #{$keptfiles}\")\n report(\"persistent files : #{$persistentfiles}\")\n report(\"reclaimed bytes : #{$reclaimedbytes}\")\n end\n\n end", "def process_exclusions globs\n remainder = globs.select do |glob|\n if glob_is_directory?(glob)\n exdir = File.join(directory, glob_to_directory(glob))\n included.delete_if { |file| file.start_with?(exdir) }\n false\n else\n true\n end\n end\n process_globs remainder\n end" ]
[ "0.6411121", "0.6264191", "0.61211485", "0.6069007", "0.60352814", "0.59981984", "0.59226155", "0.58779967", "0.58195144", "0.57471937", "0.5737171", "0.57112867", "0.5703529", "0.56831014", "0.5679069", "0.5655849", "0.5651708", "0.56203735", "0.56104565", "0.5608605", "0.55935615", "0.55506146", "0.5546417", "0.55119383", "0.55078447", "0.54960775", "0.5468123", "0.5449847", "0.54440624", "0.5423545", "0.5405633", "0.5379714", "0.5373814", "0.5355338", "0.53510946", "0.5347962", "0.5339105", "0.53268737", "0.53240985", "0.53232735", "0.53229415", "0.53227836", "0.52981097", "0.52790856", "0.52790856", "0.5275861", "0.5270057", "0.5269448", "0.5269269", "0.52680457", "0.52680457", "0.526485", "0.526485", "0.526485", "0.526485", "0.526485", "0.526485", "0.526485", "0.526485", "0.526485", "0.5263791", "0.52592564", "0.5257001", "0.52555627", "0.5252199", "0.52469724", "0.5246384", "0.52441454", "0.52375966", "0.52287537", "0.52258664", "0.5221288", "0.5217465", "0.5215889", "0.5215889", "0.5213867", "0.5212159", "0.5210069", "0.5199346", "0.5198287", "0.519732", "0.5195383", "0.5194082", "0.5194082", "0.51926535", "0.5192537", "0.5191309", "0.51899993", "0.5189025", "0.5189025", "0.5189025", "0.5189025", "0.5189025", "0.5189025", "0.5189025", "0.5189025", "0.5189025", "0.5188959", "0.5186288", "0.5185825", "0.51848173" ]
0.0
-1
command line options (e.g. not run options override)
def deploy?; run_options[:deploy]; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def program_options\n [\n ['--format', '-f FORMAT', 'Format as html or text(default)',\n lambda { |value| options.format = value }\n ],\n ['--coffee', '-c', 'Show code as coffeescript',\n lambda { |value| options.coffee = true }\n ]\n ]\nend", "def options\n @options ||= args.dig(:options) || {}\n end", "def parse_options()\n\n options = {}\n\n ARGV.each_index do |index|\n case $*[index]\n when '-m' then options[:auto_connect] = false\n when '-v' then options[:verbose] = true\n when '-q' then options[:verbose] = false\n when '-t' then options[:log_truncate] = true\n when '-r' then options[:log_response] = false\n else\n ::Twiga.say_warn \"unknown option: #{arg}\"\n end # case\n\n $*.delete_at(index) # remove from command line\n\n end # do each cmd line arg\n \n return Kinokero::Cloudprint::DEFAULT_OPTIONS.merge(options)\n\n end", "def options() end", "def program_options\n [\n # The values of the array are,\n # [long_option, short_option and parameter, description, code to execute]\n ['--google', '-g', \"Format for Google blogger.\",\n lambda { |value| options.google = true }\n ],\n ['--jayway', '-j', \"Format for Jayway blog.\",\n lambda { |value| options.jayway = true }\n ],\n ['--utf', '-u', \"Include meta charset utf8\",\n lambda { |value| options.utf = true }\n ],\n ['--stylesheet', '-s', \"Add a stylesheet, md.css\",\n lambda { |value| options.stylesheet = true }\n ],\n ['--verbose', '-v', \"Log to standard output.\",\n lambda { |value| options.verbose = true }\n ],\n ['--version', '-V', \"Display the program version.\",\n lambda { |value|\n puts \"#{program_name}, version #{PROGRAM_VERSION}\"\n exit\n }\n ]\n ]\nend", "def command_run_options(c, str_opts)\n c.option '-c', '--categories [string]', String, str_opts.categories\n c.option '-d', '--dl-method [string]', String, str_opts.dl_method\n c.option '-n', '--number [integer]', Integer, str_opts.number\n c.option '-p', '--player [string]', String, str_opts.player\n c.option '-r', '--rng [string]', String, str_opts.rng\n end", "def options; @opts end", "def get_options\n ARGV.options { |opt|\n opt.banner = \"Usage: ruby #{__FILE__} [options] \"\n\n opt.on(\"--help\", \"What you see right now\"){ puts opt; exit 0}\n\n #Try testing with this\n #ruby __FILE__ -x -c -s test\n opt.on(\"-x\", \"parse arguments and show Usage\") {|@quit|}\n\n opt.on(\"--doc=DIRECTORY\", String, \"Output rdoc (Ruby HTML documentation) into directory\"){|dir|\n system(\"rdoc -o #{dir} #{__FILE__}\")\n }\n\n opt.on(\"--verbose\", \"-v\", \"print intermediate steps to STDERR\"){|@verbose|}\n\n opt.on(\"--schema\", \"-S\", \"Use Schema i.e. XSD rather than XML document\"){|@opt_schema|}\n\n opt.on_tail(\"By default splits data according to opt_filter, \",\n \"Subset plots on #{@opt_subset}. Will not create histograms\")\n\n opt.parse!\n } or exit(1);\n\n if @quit\n pp self\n (print ARGV.options; exit)\n end\n\n rescue NameError => err\n STDERR.puts \"ERROR: #{err}\"\n exit 1\n rescue => err\n STDERR.puts \"ERROR: #{err}\"\n exit 1\n end", "def options(opt); end", "def options(opt); end", "def options; [] end", "def options\n db = (opts[\"-d\"] or opts[\"d\"] or opts[\"--database\"] or opts[\"database\"] or \"mysql\")\n rubypath = (opts[\"-r\"] or opts[\"r\"] or opts[\"--ruby\"] or opts[\"ruby\"] )\n rubypath = \"--ruby=#{rubypath}\" if rubypath\n nullary_opts = %w{ -f --freeze --force -s --skip -q --quiet -c --svn -g --git }.reject { |x| !opts.has_key?(x) and !opts.has_key?(x.gsub(/-/, \"\"))}\n \"-d #{db} #{rubypath}\" + nullary_opts.join(\" \")\n end", "def program_options\n [\n # The values of the array are,\n # [long_option, short_option and parameter, description, code to execute] \n ['--to', '-t TO', \"Send email to recipent\",\n lambda { |value| options.to = value }\n ],\n ['--message', '-m MESSAGE', \"Include the message.\",\n lambda { |value| options.message = value }\n ],\n ['--subject', '-s SUBJECT', \"Include the subject.\",\n lambda { |value| options.subject = value }\n ],\n ['--verbose', '-v', \"Log to standard output.\",\n lambda { |value| options.verbose = true }\n ],\n ['--version', '-V', \"Display the program version.\",\n lambda { |value|\n puts \"#{program_name}, version #{PROGRAM_VERSION}\"\n exit\n }\n ]\n ]\nend", "def options\n [\n [ '--ec2-user-id', '-u', GetoptLong::REQUIRED_ARGUMENT],\n [ '--aws-access-key-id', '-a', GetoptLong::REQUIRED_ARGUMENT],\n [ '--aws-secret-access-key', '-s', GetoptLong::REQUIRED_ARGUMENT],\n [ '--snapshot', GetoptLong::NO_ARGUMENT],\n [ '--restore-most-recent', '--start-most-recent', GetoptLong::NO_ARGUMENT],\n [ '--host-role', '-r', GetoptLong::REQUIRED_ARGUMENT],\n [ '--volume-size', GetoptLong::OPTIONAL_ARGUMENT],\n [ '--tell', GetoptLong::NO_ARGUMENT],\n [ '--debug', GetoptLong::NO_ARGUMENT]\n ]\n end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def prepare_options!\n @cli_options = ARGV.dup.uniq\n @save_options = !!@cli_options.delete('--save')\n\n if options.rails?\n sources.concat(detect_sources)\n set_rails_defaults\n end\n end", "def command_line_options\n opts = GetoptLong.new(*ARG_SPEC)\n options = {}\n opts.each do |opt,arg|\n opt[0,2] = ''\n opt = opt.to_sym\n case opt\n when :help\n puts usage(\"[param ...]\")\n exit 0\n else\n options[opt] = arg ? arg : true\n end\n end\n options\nend", "def parse_options(opts, args); end", "def program_options\n [\n # The values of the array are,\n # [long_option, short_option and parameter, description, code to execute]\n ['--verbose', '-v', \"Log to standard output.\",\n lambda { |value| options.verbose = true }\n ],\n ['--version', '-V', \"Display the program version.\",\n lambda { |value|\n puts \"#{program_name}, version #{PROGRAM_VERSION}\"\n exit\n }\n ]\n ]\nend", "def options(opt)\n end", "def common_options(opts)\n opts.separator ''\n opts.separator 'Other options:'\n opts.on('--[no-]color', 'Run without color') do |v|\n Term::ANSIColor.coloring = v\n end\n opts.on_tail('-v', '--version', 'Show version.') do\n ui.trace \"inch #{Inch::VERSION}\"\n exit\n end\n opts.on_tail('-l', '--language [LANGUAGE]',\n 'Set language (elixir|javascript|ruby).') do |language|\n @language = language\n end\n opts.on_tail('-r', '--read-from-dump [FILE]',\n 'Read objects from dump.') do |file|\n @read_dump_file = file\n end\n opts.on_tail('-h', '--help', 'Show this help.') do\n ui.trace opts\n exit\n end\n end", "def process_command_line_options\r\n begin\r\n defer, found = \"\", false\r\n opts = GetoptLong.new(\r\n [ \"--help\", \"-h\", \"-?\", GetoptLong::NO_ARGUMENT ],\r\n [ \"--load\", \"-l\", GetoptLong::REQUIRED_ARGUMENT ],\r\n [ \"--debug\", \"-d\", GetoptLong::NO_ARGUMENT ],\r\n [ \"--quit\", \"-q\", GetoptLong::NO_ARGUMENT ],\r\n [ \"--words\", \"-w\", GetoptLong::NO_ARGUMENT ])\r\n\r\n # Process the parsed options\r\n opts.each do |opt, arg|\r\n unless found\r\n puts; found = true\r\n end\r\n\r\n case opt\r\n when \"--debug\"\r\n @debug = true\r\n when \"--load\"\r\n defer << \"load\\\"#{arg}\\\" \"\r\n when \"--quit\"\r\n defer << \")quit \"\r\n when \"--words\"\r\n defer << \")words \"\r\n else\r\n fail SilentExit\r\n end\r\n end\r\n\r\n puts if found\r\n rescue Exception => e\r\n puts\r\n puts \"fOOrth available options:\"\r\n puts\r\n puts \"--help -h -? Display this message and exit.\"\r\n puts \"--load -l <filename> Load the specified fOOrth source file.\"\r\n puts \"--debug -d Default to debug ON.\"\r\n puts \"--quit -q Quit after processing the command line.\"\r\n puts \"--words -w List the current vocabulary.\"\r\n puts\r\n raise SilentExit\r\n end\r\n\r\n defer\r\n end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def setup_options\n parser = OptionParser.new do |o|\n o.banner = 'Usage: bundle exec qpush-server [options]'\n\n o.on('-c', '--config PATH', 'Load PATH for config file') do |arg|\n load(arg)\n Server.log.info(\"* Server config: #{arg}\")\n end\n\n o.on('-h', '--help', 'Prints this help') { puts o && exit }\n end\n parser.parse!(@argv)\n end", "def process_options\n \n \n @options.verbose = false if @options.quiet\n end", "def init_options\n @since = \"\"\n @format = :markdown\n ARGV.each do |arg|\n if arg.start_with?(\"--since=\")\n @since = arg.dup\n elsif arg == \"--html\"\n @format = :html\n end\n end\nend", "def options(path, **args); end", "def options\n [['--with-debug', 'Build debug and release libraries.']]\n end", "def cli_options\n [cropped_url, threshold, flip].join(' ').strip\n end" ]
[ "0.7706846", "0.75134206", "0.7391062", "0.7377349", "0.73430985", "0.7255606", "0.7181315", "0.71200377", "0.70952886", "0.70947975", "0.709096", "0.7087724", "0.7081374", "0.7018272", "0.6999682", "0.6999682", "0.6999682", "0.6999682", "0.6999682", "0.6999682", "0.6999682", "0.6999682", "0.6999682", "0.6999682", "0.6999682", "0.6999682", "0.6999682", "0.694918", "0.6942814", "0.6910531", "0.69088525", "0.68878686", "0.68725413", "0.68677557", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6853032", "0.6827721", "0.68222564", "0.68187547", "0.6818652", "0.67510575", "0.6746712" ]
0.0
-1
Prepares the app for being staged in one or more environments by loading config(s), middleware, and setting the load path.
def prepare(*env_or_envs) return if prepared? # load config for one or more environments load_config(*env_or_envs) # load each block from middleware stack load_middleware # include pwd in load path $:.unshift(Dir.pwd) unless $:.include? Dir.pwd @prepared = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_app\n call_stack(:before, :load)\n\n # load src files\n @loader = Loader.new\n @loader.load_from_path(config.app.src_dir)\n\n # load the routes\n load_routes\n\n call_stack(:after, :load)\n end", "def setup(env: nil)\n @env = (env ||= config.env.default).to_sym\n performing :configure do\n use_config(env)\n end\n\n performing :setup do\n init_global_logger\n\n @mounts.each do |path, mount|\n builder_local_apps = @apps\n\n @builder.map path do\n app_instance = if defined?(Pakyow::App) && mount[:app].ancestors.include?(Pakyow::App)\n mount[:app].new(env, builder: self, &mount[:block])\n else\n mount[:app].new\n end\n\n # Load the logger middleware last so that any app middleware that halts\n # before the request hits the app will not be logged.\n use Middleware::Logger\n\n builder_local_apps << app_instance\n\n run app_instance\n end\n end\n end\n\n unless @mounts.empty?\n to_app\n end\n\n self\n end", "def prepare_environment(env)\n load_environment_properties(env)\n raise 'environment problem:environment not found' if @env_config.nil?\n create_required_files @env_config\n load_master_config @env_config['config_file']\n end", "def boot!\n adjust_load_path\n adjust_gem_path\n ENV['RACK_ENV'] = rack_env\n change_working_directory\n export_global_settings\n load_settings_from_init_rb\n set_relative_url_root\n run_boot_hooks\n self\n end", "def configures(*envs, &b)\n return if @app.reloading?\n yield self if envs.empty? || envs.include?(@app.options[:env])\n end", "def prepare_for_production\n root_glob = combined_app_root_glob(false)\n root_re = combined_app_root_regexp(false)\n\n # Load application modules\n path_re = /#{root_re}(?<path>.*)/\n Dir.glob(File.join(root_glob, '**/*')) do |file|\n if File.directory? file\n file.match(path_re) do |m|\n mod = File.join(file, File.basename(file)) << '.rb'\n if File.file? mod\n require_for_production mod\n else\n Object.const_set_recursive(m[:path].camelize, Module.new)\n end\n end # match\n end # if\n end\n\n # Load templates\n file_re = /#{root_re}(?<path>.*)\\/.*\\.(?<template>.*)\\./\n Dir.glob(File.join(root_glob, \"**/*#{TEMPLATE_EXT}\")) do |file|\n file.match(file_re) do |m|\n ios = StringIO.new\n TemplateCompiler.compile_template(\n ios, File.read(file), m[:path].camelize, m[:template],\n false, @context.timers\n )\n m[:path].camelize.constantize.class_eval(ios.string)\n end # match\n end # glob\n\n # Load CSS\n css = CssCompressor.compress(compile_css(StringIO.new).string)\n Application.use(Rack::FrozenRoute, %r{/bundle.css}, 'text/css', css)\n Application.pull_down(Rack::StaticDir)\n end", "def setup_application!\n return if @_configured\n self.register_framework_extensions\n self.calculate_paths\n self.register_initializers\n self.require_load_paths\n self.disable :logging # We need do that as default because Sinatra use commonlogger.\n I18n.load_path += self.locale_path\n I18n.reload!\n @_configured = true\n end", "def setup\n @applications = find_applications(pidfile_dir())\n end", "def prep(name=nil)\n env = env(name)\n env.prep\n end", "def setup\n @applications = find_applications(pidfile_dir)\n end", "def initial_setup\n # Copy across the application_record_loader.rb unless it already exists\n copy_file '../static_files/application_record_loader.rb',\n 'lib/record_loader/application_record_loader.rb',\n skip: true\n # Copy across the record_loader.rake unless it already exists\n copy_file '../static_files/record_loader.rake',\n 'lib/tasks/record_loader.rake',\n skip: true\n end", "def setup_path\n # The Java Buildpack for WLS creates the complete domain structure and other linkages during staging.\n # The directory used for staging is at /tmp/staged/app\n # But the actual DEA execution occurs at /home/vcap/app. This discrepancy can result in broken paths and non-startup of the server.\n # So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution\n # Also, this script needs to be invoked before starting the server as it will create the links and also tweak the server args\n # (to listen on correct port, use user supplied jvm args)\n\n File.open(@application.root.to_s + '/' + SETUP_ENV_SCRIPT, 'w') do |f|\n\n f.puts '#!/bin/sh '\n f.puts '# There are 4 things handled by this script '\n f.puts ' '\n f.puts '# 1. Create links to mimic staging env and update scripts with jvm options '\n f.puts '# The Java Buildpack for WLS creates complete domain structure and other linkages during staging at '\n f.puts '# /tmp/staged/app location '\n f.puts '# But the actual DEA execution occurs at /home/vcap/app. '\n f.puts '# This discrepancy can result in broken paths and non-startup of the server. '\n f.puts '# So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution '\n f.puts '# Create paths that match the staging env, as otherwise scripts will break!! '\n f.puts ' '\n f.puts 'if [ ! -d \\\"/tmp/staged\\\" ]; then '\n f.puts ' /bin/mkdir /tmp/staged '\n f.puts 'fi; '\n f.puts 'if [ ! -d \\\"/tmp/staged/app\\\" ]; then '\n f.puts ' /bin/ln -s `pwd` /tmp/staged/app '\n f.puts 'fi; '\n f.puts ' '\n f.puts ' '\n end\n end", "def app_load_path(*paths)\n paths.each do |path|\n dir = app_path(path)\n $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir)\n end\nend", "def setup\n\n setup_path\n save_application_details\n add_jvm_args\n rename_server_instance\n\n \"/bin/sh ./#{SETUP_ENV_SCRIPT}\"\n end", "def app_init!(rails_env)\n if rails_env.development? || rails_env.demo?\n # If we are running a rake command like `rake db:seed` or\n # `rake db:schema:load`, we do not want to try and seed the fakes\n # because our schema may not be loaded yet and it will fail!\n if running_rake_command?\n load!\n else\n load_fakes_and_seed!\n end\n end\n end", "def do_setup(config)\n require File.join(config.root.join('config', 'environment'))\n\n # force eager load of Rails and application irrespective of config\n # context: require 'source' is not atomic or thread-safe, i.e. race conditions can occur if a class is required inside multiple threads at the same time\n rc = Rails.application.config\n rc.eager_load_namespaces.each(&:eager_load!) unless rc.eager_load # if true, already happened\n\n filename = call_hook(:stdout_filename)\n # puts \"stdout to: #{filename} #{Rails.root}\"\n\n if filename\n STDIN.reopen(\"/dev/null\")\n STDOUT.reopen(filename, \"a\")\n STDERR.reopen(STDOUT)\n end\n puts \"starting rails\"\n call_hook(:setup)\n end", "def load_enviroment\n file = ResqueMaster.config['environment'] || '.'\n\n if File.directory?(file) && File.exist?(File.expand_path(\"#{file}/config/environment.rb\"))\n require 'rails'\n require File.expand_path(\"#{file}/config/environment.rb\")\n\n if defined?(::Rails) && ::Rails.respond_to?(:application)\n # Rails 3\n ::Rails.application.eager_load!\n end\n elsif File.file?(file)\n require File.expand_path(file)\n end\n end", "def setup_environment; end", "def setup!(rails_env, app_name: nil)\n load_fakes_and_seed!(app_name: app_name) if rails_env.development?\n end", "def initialize_app_access(owner, app_name, path)\n router = ::UsrRouter.for(owner)\n\n app = ::OodApp.at(path: router.path_for(app: app_name))\n\n # app doesn't exist or you do not have access:\n raise ActionController::RoutingError.new('Not Found') unless app\n\n\n # run idempotent setup script to setup data for user and handle any errors\n app.run_setup_production\n end", "def setup_app_files\n cp HANAMI_TEMPLATES.join('config/hanami-vite.json'), config.config_path\n inject_line_after root.join('config/environment.rb'), 'environment :development do', ' middleware.use(ViteRuby::DevServerProxy, ssl_verify_none: true) if ViteRuby.run_proxy?'\n inject_line_after_last root.join('apps/web/application.rb'), 'include Web::Assets::Helpers', ' include ViteHanami::TagHelpers'\n inject_line_after root.join('apps/web/application.rb'), 'configure :development do', <<-CSP\n # Allow @vite/client to hot reload changes in development\n security.content_security_policy(\n security.content_security_policy\n .sub('script-src', \"script-src 'unsafe-eval'\")\n .sub('connect-src', \"connect-src ws://\\#{ ViteRuby.config.host_with_port }\")\n )\n CSP\n append root.join('Rakefile'), <<~RAKE\n require 'vite_hanami'\n ViteRuby.install_tasks\n RAKE\n end", "def guess_app\n app = if ::File.exists?(::File.join(::File.dirname(@options[:wdir]), \"config/environment.rb\"))\n require 'config/environment'\n Rack::Builder.new do\n use Rails::Rack::Static\n run ActionController::Dispatcher.new\n end\n else\n raise Exception, \"No rackup file nore rails environement file found. Please supply one of them\"\n end\n end", "def setup\n\n setup_path\n save_application_details\n add_jvm_args\n rename_server_instance\n\n \"/bin/bash ./#{SETUP_ENV_SCRIPT}\"\n end", "def load_app\n title = File.basename(@script)[/^([\\w_]+)/,1].gsub /_/,'' \n begin\n all_requires = $LOADED_FEATURES.dup\n load @script\n @requires = ($LOADED_FEATURES - all_requires).select do |req|\n req.index(File.basename(@script) + \"/\") == 0 || req.index(title + \"/\") == 0\n end\n rescue Exception => e\n puts \"!! trouble loading #{title}: [#{e.class}] #{e.message}\"\n puts e.backtrace.join(\"\\n\")\n find_app title\n remove_app\n return\n end\n\n @mtime = mtime\n find_app title\n unless @klass and @klass.const_defined? :C\n puts \"!! trouble loading #{title}: not a Camping app, no #{title.capitalize} module found\"\n remove_app\n return\n end\n \n Reloader.conditional_connect\n @klass.create if @klass.respond_to? :create\n @klass\n end", "def setup_phase\n if options[:setup].respond_to?(:call)\n log :debug, 'Setup endpoint detected, running now.'\n options[:setup].call(env)\n elsif options[:setup]\n log :debug, 'Calling through to underlying application for setup.'\n setup_env = env.merge('PATH_INFO' => setup_path, 'REQUEST_METHOD' => 'GET')\n call_app!(setup_env)\n end\n end", "def stage(env: nil)\n builder = Rack::Builder.new\n\n @env = (env ||= config.env.default).to_sym\n performing :configure do\n use_config(env)\n end\n\n @mounts.each do |_, mount|\n mount[:app].new(env, builder: builder, stage: true, &mount[:block])\n end\n end", "def set_state\n # Set environment variables for later services.\n new_resource.app_state_environment[:DJANGO_SETTINGS_MODULE] = new_resource.settings_module if new_resource.settings_module\n new_resource.app_state_environment[:DATABASE_URL] = new_resource.database[:URL] if new_resource.database[:URL]\n # Set the app module.\n new_resource.app_state[:python_wsgi_module] = new_resource.wsgi_module if new_resource.wsgi_module\n end", "def load!\n if !loaded?\n @loaded = true\n\n logger.info(\"environment\") { \"Loading configuration...\" }\n load_config!\n\n self\n end\n end", "def bootstrap!\n reset!\n require_relative 'kernel'\n end", "def require_apps\n Dir[\"#{Waxx[\"opts\"][:base]}/app/*\"].each{|f|\n next if f =~ /\\/app\\.rb$/ # Don't reinclude app.rb\n require f if f =~ /\\.rb$/ # Load files in the app directory \n if File.directory? f # Load top-level apps\n name = f.split(\"/\").last\n require \"#{f}/#{name}\" if File.exist? \"#{f}/#{name}.rb\"\n end\n }\n end", "def with_application_environment\n backup = nil\n\n ::Bundler.ui.silence do\n if ::Bundler.root != config.source_path\n backup = ENV.to_hash\n ENV.replace(::Bundler.original_env)\n\n # reset bundler to load from the current app's source path\n ::Bundler.reset!\n end\n\n # ensure the bundler environment is loaded before enumeration\n ::Bundler.load\n\n yield\n end\n ensure\n if backup\n # restore bundler configuration\n ENV.replace(backup)\n ::Bundler.reset!\n end\n\n # reload the bundler environment after enumeration\n ::Bundler.load\n end", "def bootstrap!\n reset!\n require_relative 'kernel'\n end", "def require_env\n ENV['RACK_ENV'] = ENV['RAILS_ENV'] = Hadooken.configuration.environment.to_s\n\n # Which means we want to require an environment\n # other than rails.\n if Hadooken.configuration.require_env\n require File.expand_path(Hadooken.configuration.require_env)\n else\n require \"rails\"\n\n if ::Rails::VERSION::MAJOR == 4\n require File.expand_path(\"config/application.rb\")\n ::Rails::Application.initializer \"hadooken.eager_load\" do\n ::Rails.application.config.eager_load = true\n end\n require File.expand_path(\"config/environment.rb\")\n else\n require File.expand_path(\"config/environment.rb\")\n end\n end\n end", "def load(options = {})\n @provider_dir = Path.provider\n\n # load base\n @base_services = load_all_json(Path.named_path([:service_config, '*'], Path.provider_base), Config::Tag)\n @base_tags = load_all_json(Path.named_path([:tag_config, '*'], Path.provider_base), Config::Tag)\n @base_common = load_json( Path.named_path(:common_config, Path.provider_base), Config::Object)\n @base_provider = load_json( Path.named_path(:provider_config, Path.provider_base), Config::Provider)\n\n # load provider\n @nodes = load_all_json(Path.named_path([:node_config, '*'], @provider_dir), Config::Node)\n @common = load_json( Path.named_path(:common_config, @provider_dir), Config::Object)\n @secrets = load_json( Path.named_path(:secrets_config, @provider_dir), Config::Secrets)\n @common.inherit_from! @base_common\n\n # For the default environment, load provider services, tags, and provider.json\n log 3, :loading, 'default environment...'\n env('default') do |e|\n e.services = load_all_json(Path.named_path([:service_config, '*'], @provider_dir), Config::Tag, :no_dots => true)\n e.tags = load_all_json(Path.named_path([:tag_config, '*'], @provider_dir), Config::Tag, :no_dots => true)\n e.provider = load_json( Path.named_path(:provider_config, @provider_dir), Config::Provider, :assert => true)\n e.services.inherit_from! @base_services\n e.tags.inherit_from! @base_tags\n e.provider.inherit_from! @base_provider\n validate_provider(e.provider)\n end\n\n # create a special '_all_' environment, used for tracking the union\n # of all the environments\n env('_all_') do |e|\n e.services = Config::ObjectList.new\n e.tags = Config::ObjectList.new\n e.provider = Config::Provider.new\n e.services.inherit_from! env('default').services\n e.tags.inherit_from! env('default').tags\n e.provider.inherit_from! env('default').provider\n end\n\n # For each defined environment, load provider services, tags, and provider.json.\n environment_names.each do |ename|\n next unless ename\n log 3, :loading, '%s environment...' % ename\n env(ename) do |e|\n e.services = load_all_json(Path.named_path([:service_env_config, '*', ename], @provider_dir), Config::Tag, :env => ename)\n e.tags = load_all_json(Path.named_path([:tag_env_config, '*', ename], @provider_dir), Config::Tag, :env => ename)\n e.provider = load_json( Path.named_path([:provider_env_config, ename], @provider_dir), Config::Provider, :env => ename)\n e.services.inherit_from! env('default').services\n e.tags.inherit_from! env('default').tags\n e.provider.inherit_from! env('default').provider\n validate_provider(e.provider)\n end\n end\n\n # apply inheritance\n @nodes.each do |name, node|\n Util::assert! name =~ /^[0-9a-z-]+$/, \"Illegal character(s) used in node name '#{name}'\"\n @nodes[name] = apply_inheritance(node)\n end\n\n # do some node-list post-processing\n cleanup_node_lists(options)\n\n # apply control files\n @nodes.each do |name, node|\n control_files(node).each do |file|\n begin\n node.eval_file file\n rescue ConfigError => exc\n if options[:continue_on_error]\n exc.log\n else\n raise exc\n end\n end\n end\n end\n end", "def prepare_env(load_stage = stage)\n \n load_stage = load_stage.to_s\n \n if !db_config \n Wpcap::Utility.error(\"No Database Configurations Found\")\n abort \n end\n \n if remote_config(:db_priv_pass).nil?\n Wpcap::Utility.error \"This no privileged user for this server found in servers ssh environment profile (did you set it up with wpcap?)\" \n abort\n end\n \n set(:local_dump) { \"/tmp/#{application}.sql.bz2\" }\n \n if db_config[load_stage]\n \n set(:db_priv_user) { remote_config(:db_priv_user).nil? ? db_config[load_stage][\"username\"] : remote_config(:db_priv_user) }\n set(:db_priv_pass) { remote_config(:db_priv_pass).nil? ? db_config[load_stage][\"password\"] : remote_config(:db_priv_pass) }\n set(:db_host) { db_config[load_stage][\"host\"] }\n set(:db_database) { db_config[load_stage][\"database\"] }\n set(:db_username) { db_config[load_stage][\"username\"] }\n set(:db_password) { db_config[load_stage][\"password\"] }\n set(:db_encoding) { db_config[load_stage][\"encoding\"] }\n set(:db_prefix) { db_config[load_stage][\"prefix\"] } \n \n else\n\n set :db_priv_user , remote_config(:db_priv_user) \n set :db_priv_pass , remote_config(:db_priv_pass) \n set :db_username , \"#{application.split(\".\").first}_#{stage}\"\n set :db_database , \"#{application.split(\".\").first}_#{stage}\"\n set :db_password , random_password(16)\n set :db_prefix , \"wp_\" || db_config[\"development\"][\"prefix\"]\n \n run \"mkdir -p #{shared_path}/config\"\n template \"mysql.yml.erb\", \"#{shared_path}/config/database.yml\"\n server_yaml = capture \"cat #{shared_path}/config/database.yml\"\n server_mysql_config_yaml = YAML.load(server_yaml)\n update_db_config(server_mysql_config_yaml)\n db_config(true)\n end\n \n end", "def bootup\n env = (@options[:environment] || \"development\").to_sym\n is_logging = @options.has_key?(:debug) && (@options[:debug] == \"true\")\n app = ::Middleman.server.inst do\n set :environment, env\n set :logging, is_logging\n end\n \n app_rack = app.class.to_rack_app\n \n opts = @options.dup\n opts[:app] = app_rack\n opts[:logging] = is_logging\n puts \"== The Middleman is standing watch on port #{opts[:port]||4567}\"\n ::Middleman.start_server(opts)\n end", "def setup_files\n create_application_rb\n create_production_rb\n end", "def bootstrap_for_rails\n set_STREAMLINED_RAILS_ROOT\n add_require_line_to_environment_file\n end", "def load_config_files_for_enviroment( *args )\n options = args.extract_options\n\n args << File.join(\n File.dirname( args.first ), \":env.#{File.extension( args.first )}\"\n ) unless args.length > 1\n\n load_config_files( *(args << options) )\n end", "def load_environment!\n raise NotImplementedError\n end", "def build_app(app)\n options[:environment] = ENV['SHELF_ENV'] || options[:environment]\n\n middleware[options[:environment]].reverse.each do |middleware|\n middleware = middleware.call(self) if middleware.respond_to?(:call)\n\n next unless middleware\n\n klass, *args = middleware\n app = klass.new(app, *args)\n end\n\n app\n end", "def setup_env\n @env['kiwi.app'] = self\n @env['kiwi.mime'] = @env['HTTP_ACCEPT']\n @env['kiwi.params'] = ::Rack::Request.new(@env).params\n @env['kiwi.path'] = @env['PATH_INFO']\n @env['kiwi.method'] = @env['REQUEST_METHOD'].downcase.to_sym\n @env['kiwi.format'] ||= @env['kiwi.mime'].to_s.sub(%r{^\\w+/\\w+\\+?}, '')\n @env['kiwi.serializer'] ||= Kiwi.serializers[@env['kiwi.format'].to_sym]\n @env['kiwi.resource'] ||=\n self.class.resources.find{|rsc| rsc.routes? @env['kiwi.path']}\n end", "def check_and_set_environment\n check_env\n set_env\n end", "def load_env(environment=nil)\n environment ||= \"production\"\n load_dot_env \".env\" if environment == \"production\"\n load_dot_env \".env.#{environment}\"\nend", "def bootup\n Merb.trap(\"TERM\") { shutdown }\n\n Merb.logger.warn! \"Running bootloaders...\" if Merb::Config[:verbose]\n BootLoader.run\n Merb.logger.warn! \"Starting Rack adapter...\" if Merb::Config[:verbose]\n Merb.adapter.start(Merb::Config.to_hash)\n end", "def setup_middleware middleware_stack\n where = OpenCensus::Trace.configure.middleware_placement\n case where\n when Class\n middleware_stack.insert_before where, RackMiddleware\n when :begin\n middleware_stack.unshift RackMiddleware\n else\n middleware_stack.use RackMiddleware\n end\n end", "def load_app\n require File.expand_path(File.join('config', 'application.rb'))\n @app ||= Rails.application\n end", "def app_init!(rails_env)\n if rails_env.ssh_forwarding? && !running_rake_command?\n User.authentication_service = Fakes::AuthenticationService\n # This sets up the Fake::VBMSService with documents for the VBMS ID DEMO123. We normally\n # set this up in Fakes::AppealRepository.seed! which we don't call for this environment.\n Fakes::VBMSService.document_records = { \"DEMO123\" => Fakes::Data::AppealData.static_reader_documents }\n end\n\n if rails_env.demo? || rails_env.development?\n # If we are running a rake command like `rake db:seed` or\n # `rake db:schema:load`, we do not want to try and seed the fakes\n # because our schema may not be loaded yet and it will fail!\n if running_rake_command?\n load!\n else\n load_fakes_and_seed!(rails_env: rails_env)\n end\n end\n end", "def setup\n config = self.config\n host = config['app']['host']\n port = config['app']['port']\n @url_base = \"http://#{host}:#{port}\"\n\n # Extract test pcaps and indexes\n FileUtils.rm_rf '/tmp/pcapr_local_test'\n test_tar = File.join(File.expand_path(File.dirname(__FILE__)), 'test.tgz')\n if File.exist? test_tar\n puts `tar -C /tmp/ -xzf #{test_tar}`\n end\n\n # Recreate test database.\n begin\n couch = config['couch']\n RestClient.delete \"#{couch['uri']}/#{couch['database']}\"\n rescue RestClient::ResourceNotFound\n end\n db = PcaprLocal.get_db config\n\n # And restore it from datafile.\n if self.datafile\n load_docs self.datafile, db\n end\n\n # Start server.\n config_file = Tempfile.new \"config\"\n config_file.print config.to_json\n config_file.flush\n @pid = fork do \n Process.setpgid $$, $$\n exec \"#{PcaprLocal::ROOT}/bin/startpcapr -f #{config_file.path} -d\" \n end\n\n # And wait for it to be ready.\n wait_for_server host, port\n end", "def setup_path\n # The Java Buildpack for WLS creates the complete domain structure and other linkages during staging.\n # The directory used for staging is at /tmp/staged/app. But the actual DEA execution occurs at /home/vcap/app. This discrepancy can result in broken paths and non-startup of the server.\n # So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution\n # Also, this script needs to be invoked before starting the server as it will create the links and also tweak the server args\n # (to listen on correct port, use user supplied jvm args)\n\n File.open(@application.root.to_s + '/' + SETUP_ENV_SCRIPT, 'w') do |f|\n\n f.puts '#!/bin/bash '\n f.puts ' '\n f.puts 'function fcomp() '\n f.puts '{ '\n f.puts ' awk -v n1=$1 -v n2=$2 \\'BEGIN{ if (n1 == n2) print \"yes\"; else print \"no\"}\\' '\n f.puts '} '\n f.puts ' '\n f.puts 'function multiplyArgs() '\n f.puts '{ '\n f.puts ' input1=$1 '\n f.puts ' input2=$2 '\n f.puts ' mulResult=`echo $input1 $input2 | awk \\'{printf \"%d\", $1*$2}\\' ` '\n f.puts '} '\n f.puts ' '\n f.puts 'function divideArgs() '\n f.puts '{ '\n f.puts ' input1=$1 '\n f.puts ' input2=$2 '\n f.puts ' divResult=`echo $input1 $input2 | awk \\'{printf \"%.2f\", $1/$2}\\' ` '\n f.puts '} '\n f.puts ' '\n f.puts 'function scaleArgs() '\n f.puts '{ '\n f.puts ' inputToken=$1 '\n f.puts ' factor=$2 '\n f.puts ' numberToken=`echo $inputToken | tr -cd [0-9] ` '\n f.puts ' argPrefix=`echo $inputToken | sed -e \\'s/m$//g\\' | tr -cd [a-zA-Z-+:=] ` '\n f.puts ' multiplyArgs $numberToken $factor '\n f.puts ' # Result saved in mulResult variable '\n f.puts ' scaled_number=$mulResult '\n f.puts ' scaled_token=${argPrefix}${scaled_number}m '\n f.puts '} '\n f.puts ' '\n f.puts '# There are 5 things handled by this script '\n f.puts ' '\n f.puts '# 1. Create links to mimic staging env and update scripts with jvm options '\n f.puts '# The Java Buildpack for WLS creates complete domain structure and other linkages during staging at '\n f.puts '# /tmp/staged/app location '\n f.puts '# But the actual DEA execution occurs at /home/vcap/app. '\n f.puts '# This discrepancy can result in broken paths and non-startup of the server. '\n f.puts '# So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution '\n f.puts '# Create paths that match the staging env, as otherwise scripts will break!! '\n f.puts 'if [ ! -d \\\"/tmp/staged\\\" ]; then '\n f.puts ' /bin/mkdir /tmp/staged '\n f.puts 'fi; '\n f.puts 'if [ ! -d \\\"/tmp/staged/app\\\" ]; then '\n f.puts ' /bin/ln -s /home/vcap/app /tmp/staged/app '\n f.puts 'fi; '\n f.puts ' '\n end\n end", "def run\n loader = RCLoadEnv::Loader.new @config_name,\n exclude: @exclude, include: @include, override: @override,\n project: @project, debug: @debug\n if @command_list\n loader.modify_env ENV\n exec(*@command_list)\n else\n loader.write_dotenv\n end\n end", "def load_application_initializers\n load_trusty_initializers unless deployed_as_app?\n super\n extension_loader.load_extension_initalizers\n end", "def app\n eval \"Rack::Builder.new {( \" + File.read(File.dirname(__FILE__) + '/../config.ru') + \"\\n )}\"\nend", "def setup_apps\n authorize unless @heroku\n\n # get a list of all my current apps on Heroku (so we don't create dupes)\n @my_apps = @heroku.list.map{|a| a.first}\n\n each_heroku_app do |heroku_env, app_name, repo|\n next if @my_apps.include?(app_name)\n\n stack = @config.stack(heroku_env)\n stack_option = \" --stack #{stack}\" if stack.to_s.size > 0\n creation_command \"heroku create #{app_name}#{stack_option} --remote #{app_name}\"\n end\n end", "def setup\n yield(application_config)\n end", "def call env\n try_autoreload(env) do\n valid_host = valid_host?(env)\n\n resp =\n if valid_host && @app.route!(env)\n @app.call!(env)\n\n elsif valid_host && @app.static!(env)\n @app.call_static(env)\n\n elsif @rack_app\n @rack_app.call(env)\n\n elsif !valid_host\n bt = caller\n msg = \"No route for host '%s:%s'\" % [env[SERVER_NAME], env[SERVER_PORT]]\n err = Gin::BadRequest.new(msg)\n err.set_backtrace(bt)\n handle_error(err, env)\n\n else\n @app.call!(env)\n end\n\n resp[1][HOST_NAME] ||=\n (hostname || env[SERVER_NAME]).sub(/(:[0-9]+)?$/, \":#{env[SERVER_PORT]}\")\n\n resp\n end\n end", "def prepare\n started_at = DateTime.now.to_s\n prepare_deploy\n prepare_common_installation\n puppet_installation\n create_prepare_checkpoint(started_at)\n end", "def setup!(rails_env)\n load_fakes_and_seed!(rails_env: rails_env) if rails_env.development?\n end", "def setup_example_app(options={})\n $example_app_counter ||= 0\n $example_app_counter += 1\n\n FileUtils.mkdir_p(tmp_dir)\n write_app_file(options)\n $LOADED_FEATURES.delete app_file_path\n require app_file_path\n self.app = app_const\n app_const.enable :reloader\n end", "def do_setup \n config = self.config\n host = config['app']['host']\n port = config['app']['port']\n @url_base = \"http://#{host}:#{port}\"\n puts config.inspect\n @pcap_dir = config.fetch 'pcap_dir'\n @index_dir = config.fetch 'index_dir'\n\n # Extract test pcaps and indexes\n FileUtils.rm_rf '/tmp/pcapr_local_test'\n FileUtils.mkdir_p @pcap_dir\n FileUtils.mkdir_p @index_dir\n\n\n # Recreate test database.\n begin\n couch = config['couch']\n RestClient.delete \"#{couch['uri']}/#{couch['database']}\"\n rescue RestClient::ResourceNotFound\n end\n db = @db = PcaprLocal.get_db(config)\n end", "def setup\n mutex.synchronize do\n break if @setup\n\n actual_root_dirs.each do |root_dir, namespace|\n set_autoloads_in_dir(root_dir, namespace)\n end\n\n on_setup_callbacks.each(&:call)\n\n @setup = true\n end\n end", "def load_rails_environment(base_path)\n Dir.chdir(base_path) do\n require File.join(base_path, 'config/environment')\n require 'action_mailer/ar_mailer'\n end\n rescue LoadError => e\n puts e\n raise RailsEnvironmentFailed\n end", "def run\n if @initializer.nil?\n @initializer = new\n \n yield @initializer.configuration if block_given?\n @initializer.process\n \n start_app\n else\n yield @initializer.configuration if block_given?\n end\n end", "def load_pre_requisites\n if @yaml.nil?\n @log.info \"No configuration file specified --> returning.\"\n else\n build_catalog(\"staff\", @yaml[\"STAFF_CATALOG\"])\n build_catalog(\"student\", @yaml[\"STUDENT_CATALOG\"])\n @pre_requisites\n end\n end", "def do_boot\n Kernel.require Rucola::RCApp.root_path + '/config/boot'\n end", "def mount *roots, &setup\n return @app if @app\n\n self.map(*roots) if roots.size > 0\n self.class_exec(&setup) if setup\n\n setup!\n map!\n\n builder, app = ::Rack::Builder.new, self\n use?.each { |w| builder.use w[:ware], *w[:args], &w[:proc] }\n url_map.each_key do |route|\n builder.map route do\n run lambda { |env| app.new.call env }\n end\n end\n \n freeze!\n lock!\n\n @app = rewrite_rules.size > 0 ?\n ::AppetiteRewriter.new(rewrite_rules, builder.to_app, self) :\n builder.to_app\n end", "def prepare_for_deploy(services:, secrets:, local_environment:, why_run:)\n @local_env = local_environment\n end", "def load_enviroment(file = nil)\n file ||= \".\"\n\n if File.directory?(file) && File.exists?(File.expand_path(\"#{file}/config/environment.rb\"))\n require 'rails'\n require File.expand_path(\"#{file}/config/environment.rb\")\n if defined?(::Rails) && ::Rails.respond_to?(:application)\n # Rails 3\n ::Rails.application.eager_load!\n elsif defined?(::Rails::Initializer)\n # Rails 2.3\n $rails_rake_task = false\n ::Rails::Initializer.run :load_application_classes\n end\n elsif File.file?(file)\n require File.expand_path(file)\n end\n end", "def load_path\n # TODO: Could this be used to load app dir and blueprint.yml?\n # If not remove it\n owner.before_load_path(rootpath, self) if owner.respond_to?(:before_load_path)\n create_assets\n validate_if_segment\n create_components\n end", "def inject_into_load_path\n \n # Add ALL paths under the engine root to the load path\n %w(app/controllers \n app/helpers \n app/models\n components\n lib).collect { |dir|\n File.join(root, dir)\n }.select { |dir| File.directory?(dir) }.each do |path|\n insert_into_load_path(path) \n end\n end", "def eager_load_app\n Dir.glob(\"#{Jets.root}app/**/*.rb\").select do |path|\n next if !File.file?(path) or path =~ %r{/javascript/} or path =~ %r{/views/}\n next if path.include?('app/functions') || path.include?('app/shared/functions') || path.include?('app/internal/functions')\n\n class_name = path\n .sub(/\\.rb$/,'') # remove .rb\n .sub(%{^\\./},'') # remove ./\n .sub(Jets.root.to_s,'')\n .sub(%r{app/shared/\\w+/},'') # remove shared/resources or shared/extensions\n .sub(%r{app/\\w+/},'') # remove app/controllers or app/jobs etc\n class_name = class_name.classify\n class_name.constantize # use constantize instead of require so dont have to worry about order.\n end\n end", "def update_load_path\n require 'bundler'\n Bundler.setup\n end", "def eager_load_app\n Dir.glob(\"#{Jets.root}/app/**/*.rb\").select do |path|\n next if !File.file?(path) or path =~ %r{/javascript/} or path =~ %r{/views/}\n next if path.include?('app/functions') || path.include?('app/shared/functions') || path.include?('app/internal/functions')\n\n class_name = path\n .sub(/\\.rb$/,'') # remove .rb\n .sub(%{^\\./},'') # remove ./\n .sub(\"#{Jets.root}/\",'')\n .sub(%r{app\\/\\w+/concerns/},'')\n .sub(%r{app/shared/\\w+/},'') # remove shared/resources or shared/extensions\n .sub(%r{app/\\w+/},'') # remove app/controllers or app/jobs etc\n class_name = class_name.classify\n\n if ENV['JETS_DEBUG_EAGER_LOAD']\n puts \"path: #{path}\"\n puts \"class_name: #{class_name}\"\n end\n\n class_name.constantize # use constantize instead of require so dont have to worry about order.\n end\n end", "def call(env)\n middleware_module = lookup_middleware_module\n app_wrapped_with_middleware = middleware_module.new(@app, *@args_for_middleware_new, &@block_for_middleware_new)\n app_wrapped_with_middleware.call(env) \n end", "def app\n # Load the application defined in config.ru\n Rack::Builder.parse_file('config.ru').first\nend", "def app\n # Load the application defined in config.ru\n Rack::Builder.parse_file('config.ru').first\nend", "def load_environment(tasks)\n environment = tasks[:environment]\n if environment.nil?\n Kernel.abort(\"Unable to load details of environment '#{tasks[:environment_name]}'\")\n end\n environment\nend", "def app\n # Load the application defined in config.ru\n Rack::Builder.parse_file('config.ru').first\nend", "def environment(data = nil, options = {})\n sentinel = \"class Application < Rails::Application\\n\"\n env_file_sentinel = \"Rails.application.configure do\\n\"\n data ||= yield if block_given?\n\n in_root do\n if options[:env].nil?\n inject_into_file \"config/application.rb\", optimize_indentation(data, 4), after: sentinel, verbose: false\n else\n Array(options[:env]).each do |env|\n inject_into_file \"config/environments/#{env}.rb\", optimize_indentation(data, 2), after: env_file_sentinel, verbose: false\n end\n end\n end\n end", "def stage(*env_or_envs)\n unless staged?\n prepare(*env_or_envs)\n @staged = true\n end\n\n self.new\n end", "def app\n # Load the application defined in config.ru\n Rack::Builder.parse_file(\"config.ru\").first\nend", "def prepare\n if not @http_server\n config = {}\n config[:BindAddress] = @configuration.get('beef.http.host')\n config[:Port] = @configuration.get('beef.http.port')\n config[:Logger] = WEBrick::Log.new($stdout, WEBrick::Log::ERROR)\n config[:ServerName] = \"BeEF \" + VERSION\n config[:ServerSoftware] = \"BeEF \" + VERSION\n \n @http_server = WEBrick::HTTPServer.new(config)\n \n # Create http handler for the javascript hook file\n mount(\"#{@configuration.get(\"beef.http.hook_file\")}\", true, BeEF::Core::Handlers::HookedBrowsers)\n \n # Create http handlers for all commands in the framework\n BeEF::Modules.get_loaded.each { |k,v|\n mount(\"/command/#{k}.js\", false, BeEF::Core::Handlers::Commands, k)\n }\n \n #\n # We dynamically get the list of all http handler using the API and register them\n #\n BeEF::API.fire(BeEF::API::Server::Handler, 'mount_handlers', self)\n end\n end", "def load_environment(*args)\n\t\t\tpath = environment_path(*args)\n\t\t\t\n\t\t\tif File.exist?(path)\n\t\t\t\t# Load the YAML environment file:\n\t\t\t\t@environment = YAML.load_file(path)\n\t\t\t\t\n\t\t\t\t# We update ENV but only when it's not already set to something:\n\t\t\t\tENV.update(@environment) do |name, old_value, new_value|\n\t\t\t\t\told_value || new_value\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def set_initial_path\n `echo $PATH`.split(':').each do |path|\n add_env_path path\n end\nend", "def loadall(env)\n self.class.loadall(@path, env)\n end", "def initialize_from_env\n conf_prefix = self.env_variable_prefix.upcase\n\n ENV.keys.reject { |key|\n key !~ /^#{conf_prefix}/ # Ignore everything that doesn't match the prefix\n }.each { |key|\n variable = key[conf_prefix.size..-1].downcase\n\n self.store(variable, ENV[key])\n }\n\n after_initialize\n dump\n end", "def reload\n # reload the app file\n load(config.app.path)\n\n # reset config\n envs = config.app.loaded_envs\n config.reset\n\n # reload config\n self.class.load_config(*envs)\n\n load_app\n end", "def run_app(app, env)\n setup_rack(app).call(env)\nend", "def setup_application\n Souffle::Daemon.change_privilege\n Souffle::Config[:server] = true if Souffle::Config[:daemonize]\n @app = Souffle::Server.new\n end", "def configuration_setup\n dirname = File.expand_path(USER_DIR)\n if !File.exists?(dirname)\n Dir.mkdir(dirname) \n create_storage_dir\n create_staging_dir\n create_user_conf_file\n create_user_email_conf_file\n else \n create_user_conf_file if !File.exists?(USER_CONF_FILE)\n create_storage_dir if !File.exists?(File.expand_path(STORAGE_DIR))\n create_staging_dir if !File.exists?(File.expand_path(STAGING_DIR))\n create_user_email_conf_file if !File.exists?(EMAIL_CONF_FILE)\n end\n end", "def prepare\n prepare_sources\n prepare_rubygems\n prepare_gems\n end", "def build_app(options = {})\n @prev_rails_env = ENV[\"RAILS_ENV\"]\n ENV[\"RAILS_ENV\"] = \"development\"\n ENV[\"SECRET_KEY_BASE\"] ||= SecureRandom.hex(16)\n\n FileUtils.rm_rf(app_path)\n FileUtils.cp_r(app_template_path, app_path)\n\n # Delete the initializers unless requested\n unless options[:initializers]\n Dir[\"#{app_path}/config/initializers/**/*.rb\"].each do |initializer|\n File.delete(initializer)\n end\n end\n\n add_to_config <<-RUBY\n config.eager_load = false\n config.session_store :cookie_store, key: \"_myapp_session\"\n config.active_support.deprecation = :log\n config.active_support.test_order = :random\n config.action_controller.allow_forgery_protection = false\n config.log_level = :info\n RUBY\n end", "def init!\n @logger = @config = @database_config = nil\n\n load_application_config\n load_database_config\n note \"Loading #{env} environment (#{Ajaila::VERSION})\"\n load_classes\n note \"Establishing database connection\"\n establish_database_connection\n note \"Running auto-upgrade migrations\"\n run_auto_upgrade_migrations\n note \"Application has been initialized\"\n self\n end", "def set_apps(apps_attrs)\n (apps_attrs || []).each do |app|\n AppEnvironment.from_hash(api, {'app' => app, 'environment' => self})\n end\n end", "def after_initialize\n super\n extension_loader.activate_extensions # also calls initialize_views\n TrustyCms::Application.config.add_controller_paths(extension_loader.paths(:controller))\n TrustyCms::Application.config.add_eager_load_paths(extension_loader.paths(:eager_load))\n end", "def construct_app_stack\n @framework_instance ||= framework.new\n top_app = @framework_instance\n\n middleware.each do |mw_class|\n top_app = mw_class.new(top_app)\n end\n\n top_app\n end", "def start!(roda_app)\n if Bridgetown::Current.preloaded_configuration.base_path == \"/\"\n load_all_routes roda_app\n return\n end\n\n # Support custom base_path configurations\n roda_app.request.on(\n Bridgetown::Current.preloaded_configuration.base_path.delete_prefix(\"/\")\n ) do\n load_all_routes roda_app\n end\n\n nil\n end", "def process\n Rucola::Plugin.before_process(self)\n \n # load the environment config\n @configuration.load_environment_configuration!\n \n Rucola::Debugger.use! if @configuration.use_debugger\n use_reloader! if @configuration.use_reloader\n \n require_dependencies\n require_frameworks\n require_lib_source_files\n require_ruby_source_files\n \n Rucola::Plugin.after_process(self)\n end", "def load!\n configs = {}\n @array.each_with_index do |obj, idx|\n next unless obj.start_with?('--' + @env_prefix)\n\n value = extract_value(obj, idx + 1)\n key = obj.split('=').first\n .sub(/^--#{@env_prefix}_?/, '')\n .downcase.split('__')\n recursive_set(configs, key, split_env_string(value))\n end\n configs\n end", "def call env\n app.call env\n end" ]
[ "0.6559662", "0.65007675", "0.6291141", "0.6250594", "0.62491477", "0.62198794", "0.6118497", "0.59263813", "0.59051", "0.59029967", "0.58917916", "0.58894557", "0.58766335", "0.5861988", "0.58563775", "0.58345497", "0.58173394", "0.5806987", "0.579876", "0.5796181", "0.5726182", "0.57153076", "0.56885767", "0.56850743", "0.56516385", "0.5650175", "0.5641886", "0.5629329", "0.5624376", "0.5612743", "0.5601638", "0.5599229", "0.55856216", "0.5585331", "0.55760634", "0.55735207", "0.5556733", "0.5553204", "0.55456245", "0.55429894", "0.55374146", "0.5528323", "0.5513466", "0.5493395", "0.54730135", "0.5439582", "0.54322076", "0.5414246", "0.5412988", "0.5376877", "0.53698885", "0.5369229", "0.5361963", "0.53609234", "0.532192", "0.5319758", "0.53114444", "0.5309662", "0.53036714", "0.52975255", "0.5294511", "0.529153", "0.5291025", "0.52712804", "0.52448326", "0.5244564", "0.5243341", "0.5227003", "0.5223447", "0.52207077", "0.52160245", "0.5207637", "0.52072394", "0.5201354", "0.5192778", "0.5192778", "0.5185079", "0.51823735", "0.51811063", "0.51789296", "0.51742756", "0.5164612", "0.51589775", "0.515457", "0.5151955", "0.5147309", "0.51446664", "0.51446366", "0.51324594", "0.5131695", "0.5130913", "0.512359", "0.5123005", "0.51228243", "0.5113024", "0.5103971", "0.5100446", "0.50964993", "0.50911987", "0.5088898" ]
0.7817022
0
Stages the app by preparing and returning an instance. This is essentially everything short of running it.
def stage(*env_or_envs) unless staged? prepare(*env_or_envs) @staged = true end self.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n check_args\n Application::InstanceMethods.instance_method(:sandbox).bind(@app).call.\n instance_eval(&@block)\n end", "def main\n @app.main\n end", "def run\n if @initializer.nil?\n @initializer = new\n \n yield @initializer.configuration if block_given?\n @initializer.process\n \n start_app\n else\n yield @initializer.configuration if block_given?\n end\n end", "def make_app(&blk)\n handler = Class.new(TestApp)\n handler.class_eval(&blk)\n handler\nend", "def application!\n res = get!(APPLICATION_PATH)\n build_application(res)\n end", "def call(env)\n env['crossbeams.appname'] = @appname\n env['crossbeams.banner'] = @template if @template\n @app.call(env)\n end", "def build_app(app)\n options[:environment] = ENV['SHELF_ENV'] || options[:environment]\n\n middleware[options[:environment]].reverse.each do |middleware|\n middleware = middleware.call(self) if middleware.respond_to?(:call)\n\n next unless middleware\n\n klass, *args = middleware\n app = klass.new(app, *args)\n end\n\n app\n end", "def app\n MyApp.new\nend", "def call env\n app.call env\n end", "def call env\n app.call env\n end", "def app; @app; end", "def build\n Bridgetown.logger.adjust_verbosity(options)\n\n unless caller_locations.find do |loc|\n loc.to_s.include?(\"bridgetown-core/commands/start.rb\")\n end\n self.class.print_startup_message\n end\n\n # @type [Bridgetown::Configuration]\n config_options = configuration_with_overrides(\n options, Bridgetown::Current.preloaded_configuration\n )\n\n config_options.run_initializers! context: :static\n\n config_options[\"serving\"] = false unless config_options[\"serving\"]\n\n if !Bridgetown.env.production? &&\n !config_options[:skip_frontend] && config_options[\"using_puma\"]\n if Bridgetown::Utils.frontend_bundler_type(config_options[:root_dir]) == :esbuild\n Bridgetown::Utils.update_esbuild_autogenerated_config config_options\n end\n require \"rake\"\n Rake.with_application do |rake|\n rake.load_rakefile\n rake[\"frontend:watcher\"].invoke(true)\n end\n end\n\n @site = Bridgetown::Site.new(config_options)\n\n if config_options.fetch(\"skip_initial_build\", false)\n Bridgetown.logger.warn \"Build Warning:\", \"Skipping the initial build. \" \\\n \"This may result in an out-of-date site.\"\n else\n build_site(config_options)\n end\n\n if config_options.fetch(\"detach\", false)\n Bridgetown.logger.info \"Auto-regeneration:\",\n \"disabled when running server detached.\"\n elsif config_options.fetch(\"watch\", false)\n watch_site(config_options)\n else\n Bridgetown.logger.info \"Auto-regeneration:\", \"disabled. Use --watch to enable.\"\n end\n end", "def start_app\nend", "def run!(options = {})\n Celluloid.boot\n @instance = AppSupervisor.new(registry, options)\n end", "def app\n BranchApp.new\nend", "def build_and_run_block(env)\n builder = Vagrant::Action::Builder.new\n @block.call(builder)\n @child_app = builder.to_app(env)\n Vagrant::Action::Runner.new.run(@child_app, env)\n end", "def launch_app\n @bridge.launch_app\n end", "def app\n @app || make_app\nend", "def start app, &block\n # run available process types\n app[\"ps\"].each do |type,ps|\n ps[\"scale\"].times do |index|\n host = GV::Valley::Runner.random_service \n app[\"ps\"][type][\"containers\"] << host.start(app[\"name\"], type, index, &block)\n end\n end\n end", "def construct_app_stack\n @framework_instance ||= framework.new\n top_app = @framework_instance\n\n middleware.each do |mw_class|\n top_app = mw_class.new(top_app)\n end\n\n top_app\n end", "def build_rack_app\n app = base_rack_app_callable(use_new_dispatch_api?)\n\n @middleware.reverse_each do |args, bl|\n mid, *args = args\n app = mid.new(app, *args, &bl)\n app.freeze if opts[:freeze_middleware]\n end\n\n @app = app\n end", "def call(env)\n middleware_module = lookup_middleware_module\n app_wrapped_with_middleware = middleware_module.new(@app, *@args_for_middleware_new, &@block_for_middleware_new)\n app_wrapped_with_middleware.call(env) \n end", "def delegate\n @app.call(@env)\n end", "def new(*args, &bk)\n setup_application!\n super(*args, &bk)\n end", "def workflow\n prepare_instance_directory\n .bind do\n run_init\n end\n .bind do\n run_validate\n end\n .bind do\n yield\n end\n .or do |failure|\n raise(\n ::Kitchen::ActionFailed,\n failure\n )\n end\n end", "def run\n # rubocop:disable Style/SignalException\n # Parameter 'id' should be of type String\n\n id = unsafe_params[:id]\n fail \"App ID is not a string\" unless id.is_a?(String) && id != \"\"\n\n # Name should be a nonempty string\n name = unsafe_params[:name]\n fail \"Name should be a non-empty string\" unless name.is_a?(String) && name != \"\"\n\n # Inputs should be a hash (more checks later)\n inputs = unsafe_params[\"inputs\"]\n fail \"Inputs should be a hash\" unless inputs.is_a?(Hash)\n\n job_limit = params[:job_limit].to_f.zero? ? current_user.job_limit : params[:job_limit].to_f\n fail \"Job limit exceeds maximum user setting - #{current_user.job_limit}\" if job_limit > current_user.job_limit\n\n run_instance_type = unsafe_params[:instance_type]\n\n fail I18n.t(\"app_instance_type_forbidden\") unless current_user.resources.include?(run_instance_type)\n\n # App should exist and be accessible and runnable by a user.\n @app = App.find_by!(uid: id)\n\n fail I18n.t(\"app_not_accessible_or_runnable\") unless @app.runnable_by?(current_user)\n\n # Check if asset licenses have been accepted\n unless @app.assets.all? { |a| a.license.blank? || a.licensed_by?(@context) }\n fail \"Asset licenses must be accepted\"\n end\n\n # Call JupiterLab service if https app is running\n if @app.https?\n https_apps_client = DIContainer.resolve(\"https_apps_client\")\n input_info = input_spec_preparer.run(@app, inputs)\n\n fail input_spec_preparer.first_error unless input_spec_preparer.valid?\n\n result =\n begin\n https_apps_client.app_run(\n @app.dxid,\n name: name,\n instanceType: run_instance_type,\n jobLimit: job_limit,\n scope: Scopes::SCOPE_PRIVATE,\n input: input_info.run_inputs,\n )\n rescue HttpsAppsClient::Error => e\n fail e.message\n end\n\n job = Job.find_by!(dxid: result[\"dxid\"])\n\n render(json: { id: job.uid }) && return\n end\n\n space_id = unsafe_params[:space_id]\n\n fail \"Invalid space_id\" if space_id && !@app.can_run_in_space?(@context.user, space_id)\n\n space = Space.find_by(id: space_id)\n # Inputs should be compatible\n # (The following also normalizes them)\n input_info = input_spec_preparer.run(@app, inputs, space&.accessible_scopes)\n\n fail input_spec_preparer.first_error unless input_spec_preparer.valid?\n\n if space\n project = space.project_for_user(@context.user)\n permission = space.have_permission?(project, @context.user)\n fail \"You don't have permissions to run app in space #{space.name}\" unless permission\n else\n project = @context.user.private_files_project\n end\n\n job = job_creator(project).create(\n app: @app,\n name: name,\n input_info: input_info,\n run_instance_type: run_instance_type,\n job_limit: job_limit,\n scope: space&.uid,\n )\n\n SpaceEventService.call(space_id, @context.user_id, nil, job, :job_added) if space&.review?\n # rubocop:enable Style/SignalException\n\n render json: { id: job.uid }\n end", "def build(app, &block)\n app ||= block\n raise \"MiddlewareStack#build requires an app\" unless app\n Skylight::Core::Probes::Middleware::Probe.add_instrumentation(app, default_name: \"Rack App\", category: \"rack.app\")\n build_without_sk(app)\n end", "def to_app\n Rack::Builder.new do\n Scrapple.middleware_stack.middleware.each do |ware|\n use ware[0], *ware[1], &ware[2]\n end\n\n run Scrapple.middleware_stack.endpoint\n end \n end", "def build_app!\n super\n ensure\n GC.start\n GC.disable\n end", "def call(env)\n super\n perform_request env\n @app.call env\n end", "def run(env={})\n app = nil\n @ustack.reverse.each do |(klass, options)|\n app = options ? klass.new(app, options) : klass.new(app)\n end\n app.call(env)\n end", "def prepare!\n if !@is_prepared\n @is_prepared = true\n buildfile = manifest.target.buildfile\n if buildfile.task_defined? 'entry:prepare'\n buildfile.invoke 'entry:prepare',\n :entry => self,\n :manifest => self.manifest,\n :target => self.manifest.target,\n :config => self.manifest.target.config,\n :project => self.manifest.target.project\n end\n end\n return self\n end", "def stage(env: nil)\n builder = Rack::Builder.new\n\n @env = (env ||= config.env.default).to_sym\n performing :configure do\n use_config(env)\n end\n\n @mounts.each do |_, mount|\n mount[:app].new(env, builder: builder, stage: true, &mount[:block])\n end\n end", "def run(app, *args)\n opts = args.extract_options!\n @main_app = app\n @build.run(app)\n end", "def run\n raise \"Invalid Bootstrapper\"\n end", "def app\n defined?(@app) ? @app : build_app\n end", "def run\n reconfigure\n setup_application\n run_application\n end", "def run!\n # Validate paths\n validate_paths!\n \n # Extract mockup\n copy_source_path_to_build_path!\n \n validate_stack!\n \n # Run stack\n run_stack!\n \n # Run finalizers\n run_finalizers!\n \n # Cleanup\n cleanup! if self.config[:cleanup_build]\n \n end", "def app\n TestApp.new\n end", "def launch\n # To be overriden in subclass,\n # not implemented here.\n raise NotImplementedError\n end", "def use(*args, &block)\n @middleware.insert(@position, [args, block])\n @app.send(:build_rack_app)\n @position += 1\n nil\n end", "def run; new.run; end", "def app\n TicTacToeAiNApp # most examples use App.new - reason why we don't need .new here? ?????\n end", "def create_app(opts)\n app = nil\n scope = select_scope(opts[:scope])\n\n assets = Asset.accessible_by_user(user).\n where(\n state: Asset::STATE_CLOSED,\n uid: opts[:ordered_assets],\n )\n\n App.transaction do\n app_series = create_app_series(opts[:name], scope)\n release = opts.fetch(:release, UBUNTU_16)\n revision = app_series.latest_revision_app.try(:revision).to_i + 1\n\n applet_dxid = new_applet(\n opts.slice(\n :input_spec,\n :output_spec,\n :code,\n :instance_type,\n :packages,\n :internet_access,\n ),\n release,\n )\n\n app_dxid = new_app(\n opts.slice(\n :name,\n :title,\n :internet_access,\n :readme,\n ).merge(\n applet_dxid: applet_dxid,\n asset_dxids: assets.map(&:dxid),\n revision: revision,\n scope: scope,\n ),\n )\n\n api.project_remove_objects(project, [applet_dxid])\n\n app = App.create!(\n dxid: app_dxid,\n version: nil,\n revision: revision,\n title: opts[:title],\n readme: opts[:readme],\n entity_type: opts[:entity_type] || App::TYPE_REGULAR,\n user: user,\n scope: scope,\n app_series: app_series,\n input_spec: opts[:input_spec],\n output_spec: opts[:output_spec],\n internet_access: opts[:internet_access],\n instance_type: opts[:instance_type],\n ordered_assets: opts[:ordered_assets],\n packages: opts[:packages],\n code: opts[:code].strip,\n assets: assets,\n release: release,\n )\n\n app_series.update!(latest_revision_app: app)\n app_series.update!(latest_version_app: app) if Space.valid_scope?(scope)\n app_series.update!(deleted: false) if app_series.deleted?\n\n Event::AppCreated.create_for(app, user)\n end\n\n app\n end", "def call(env)\n app.call(env)\n end", "def call(env)\n app.call(env)\n end", "def run\n @pid = fork do \n initialize_sandbox\n exec(@app)\n end\n\n _, @exit_status = Process.wait2(@pid)\n @pid\n end", "def call(env)\n to_app.call(env)\n end", "def call(env)\n to_app.call(env)\n end", "def prebuild(choice)\n case choice\n when :none\n run @main_app\n else\n run @main_app\n end\n end", "def context\n unless @instance_context\n @instance_context = AppManifestContext.new(@version , @params['app_sid'])\n end\n @instance_context\n end", "def load_app\n call_stack(:before, :load)\n\n # load src files\n @loader = Loader.new\n @loader.load_from_path(config.app.src_dir)\n\n # load the routes\n load_routes\n\n call_stack(:after, :load)\n end", "def start_instance\n Instance.start(self)\n end", "def call env\n # Ensure the agent is running. (Note the start method is idempotent.)\n @debugger.start\n\n # Enable/resume breakpoints tracing\n @debugger.agent.tracer.start\n\n # Use Stackdriver Logger for debugger if available\n if env[\"rack.logger\"].is_a? Google::Cloud::Logging::Logger\n @debugger.agent.logger = env[\"rack.logger\"]\n end\n\n @app.call env\n ensure\n # Stop breakpoints tracing beyond this point\n @debugger.agent.tracer.disable_traces_for_thread\n\n # Reset quotas after each request finishes.\n @debugger.agent.quota_manager&.reset\n end", "def boot\n return self if booted?\n\n prepare\n\n container.finalize!\n slices.each(&:boot)\n\n @booted = true\n\n self\n end", "def _run(id: nil)\n runtime = Ovto::Runtime.new(self)\n actions = self.class.const_get('Actions').new\n @wired_action_set = WiredActionSet.new(self, actions, [], self.class.middlewares, runtime)\n actions.wired_actions = @wired_action_set.app_wired_actions\n @main_component = create_view(@wired_action_set)\n if id\n %x{\n document.addEventListener('DOMContentLoaded', function(){\n var container = document.getElementById(id);\n if (!container) {\n throw \"Ovto::App#run: tag with id='\" + id + \"' was not found\";\n }\n #{start_application(runtime, `container`)}\n });\n }\n else\n start_application(runtime, nil)\n end\n end", "def initialize(app); end", "def run!\n project.mode = :release\n\n # Validate paths\n validate_paths!\n\n # Extract mockup\n copy_source_path_to_build_path!\n\n validate_stack!\n\n # Run stack\n run_stack!\n\n # Cleanup\n cleanup! if config[:cleanup_build]\n ensure\n project.mode = nil\n end", "def call(env)\n @app.call(env)\n end", "def create\n # check if we are missing the required force\n required_force_is_missing?\n\n # apply some force, when we are boosted with one\n apply_force\n\n # download or update local cache\n download_or_update_local_cache\n\n # copy the framework files from the cache\n copy_over_cache_files\n\n # make necessary changes for the new app, if we were successful in\n # download otherwise, remove the downloaded source\n if has_laravel?\n say_success \"Cloned Laravel repository.\"\n\n # update permissions on storage/ directory (this is the default)\n update_permissions_on_storage if @options[:perms]\n\n # configure this new application, as required\n configure_from_options\n\n say_success \"Hurray! Your Laravel application has been created!\"\n else\n say_failed \"Downloaded source is not Laravel framework or its fork.\"\n show_info \"Cleaning up..\"\n # remove all directories that we created, as well as the cache.\n clean_up\n # raise an error since we failed.. :(\n raise LaravelError, \"Source for downloading repository is corrupt!\"\n end\n end", "def driver\n start_app_if_needed\n @driver\n end", "def app\n TicTacToeNApp # most examples use App.new - reason why we don't need .new here? ?????\n end", "def call(env)\n application.call(env)\n end", "def use(*args, &block)\n @middleware << [args, block].freeze\n build_rack_app\n end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def run(*a)\n reload_app\n if @klass\n @klass.run(*a) \n else\n Camping.run(*a)\n end\n end", "def boot\n Thread.new do\n sleep 1 until EM.reactor_running?\n\n begin\n log.info \"Loading application...\"\n app_init\n load_settings\n Fastr::Plugin.load(self)\n load_app_classes\n setup_router\n setup_watcher unless RbConfig::CONFIG['host_os'] =~ /mswin|mingw/\n\n log.info \"Application loaded successfully.\"\n\n @booting = false\n\n plugin_after_boot\n rescue Exception => e\n log.error \"#{e}\"\n puts e.backtrace\n log.fatal \"Exiting due to previous errors...\"\n exit(1)\n end\n end\n end", "def main_instance\n send main_model\n end", "def app instance=nil, *args\n raise \"Forbidden singelton action\" unless instance || @app\n return @app unless instance\n @app ||= instance.tap{|a| a.args=*args }\n @app\n end", "def new\n puts \"Creating new blank Praxis app under #{app_name}\"\n create_root_files\n create_config\n create_app\n create_design\n create_spec\n create_docs\n end", "def handle(app)\n app\n end", "def application\n self\n end", "def instance(*args)\n loader.call(self, *args)\n end", "def instance(*args)\n loader.call(self, *args)\n end", "def instance\n @instance ||= new\n @instance.startup!\n end", "def build(*args, &bk)\n builder = ::Rack::Builder.new\n builder.use ::Sinatra::ShowExceptions if show_exceptions?\n builder.use ::Rack::CommonLogger if logging?\n builder.use ::Rack::Head\n middleware.each { |c,a,b| builder.use(c, *a, &b) }\n maps.each { |p,b| builder.map(p, &b) }\n app = self\n builder.map \"/\" do\n run app.new!(*args, &bk)\n end\n builder\n end", "def app\n App\nend", "def run\n case action\n when 'new'\n require_relative('templater')\n Templater.new(File.expand_path(directory, Dir.pwd), settings).run!\n when 'console'\n require_relative('console')\n Wukong::Deploy::Console.new.run!\n end\n end", "def app\n no_autostart\n puts \"Running Plezi version: #{::Plezi::VERSION}\"\n Plezi::Base::Router.call_method\n end", "def call(env)\n if @started || @attempts > MAX_ATTEMPTS\n @app.call(env)\n else\n attempt_to_start_agent\n @app.call(env)\n end\n end", "def app\n @app ||= begin\n lock!\n to_app\n end\n end", "def call(env)\n env.response = handle_response(env)\n @app.call(env)\n end", "def bootup\n env = (@options[:environment] || \"development\").to_sym\n is_logging = @options.has_key?(:debug) && (@options[:debug] == \"true\")\n app = ::Middleman.server.inst do\n set :environment, env\n set :logging, is_logging\n end\n \n app_rack = app.class.to_rack_app\n \n opts = @options.dup\n opts[:app] = app_rack\n opts[:logging] = is_logging\n puts \"== The Middleman is standing watch on port #{opts[:port]||4567}\"\n ::Middleman.start_server(opts)\n end", "def call(env)\n @app.call(env)\n end", "def app ; Publisher ; end", "def setup(env: nil)\n @env = (env ||= config.env.default).to_sym\n performing :configure do\n use_config(env)\n end\n\n performing :setup do\n init_global_logger\n\n @mounts.each do |path, mount|\n builder_local_apps = @apps\n\n @builder.map path do\n app_instance = if defined?(Pakyow::App) && mount[:app].ancestors.include?(Pakyow::App)\n mount[:app].new(env, builder: self, &mount[:block])\n else\n mount[:app].new\n end\n\n # Load the logger middleware last so that any app middleware that halts\n # before the request hits the app will not be logged.\n use Middleware::Logger\n\n builder_local_apps << app_instance\n\n run app_instance\n end\n end\n end\n\n unless @mounts.empty?\n to_app\n end\n\n self\n end", "def setup_appengine_application(app, is_new_app)\n initialize_scaling_info_for_app(app)\n uac = UserAppClient.new(@userappserver_private_ip, @@secret)\n app_data = uac.get_app_data(app)\n loop {\n Djinn.log_info(\"Waiting for app data to have instance info for app named #{app}: #{app_data}\")\n\n app_data = uac.get_app_data(app)\n if app_data[0..4] != \"Error\"\n break\n end\n Kernel.sleep(5)\n }\n\n my_public = my_node.public_ip\n my_private = my_node.private_ip\n app_language = app_data.scan(/language:(\\w+)/).flatten.to_s\n \n if is_new_app and @app_info_map[app].nil?\n @app_info_map[app] = {}\n @app_info_map[app]['language'] = app_language\n end\n\n shadow = get_shadow\n shadow_ip = shadow.private_ip\n ssh_key = shadow.ssh_key\n app_dir = \"/var/apps/#{app}/app\"\n app_path = \"/opt/appscale/apps/#{app}.tar.gz\"\n FileUtils.mkdir_p(app_dir)\n \n # First, make sure we can download the app, and if we can't, throw up a\n # dummy app letting the user know there was a problem.\n if !copy_app_to_local(app)\n place_error_app(app, \"ERROR: Failed to copy app: #{app}\")\n app_language = \"python27\"\n end\n\n # Next, make sure their app has an app.yaml or appengine-web.xml in it,\n # since the following code assumes it is present. If it is not there\n # (which can happen if the scp fails on a large app), throw up a dummy\n # app.\n if !HelperFunctions.app_has_config_file?(app_path)\n place_error_app(app, \"ERROR: No app.yaml or appengine-web.xml for app \" +\n app)\n app_language = \"python27\"\n end\n\n HelperFunctions.setup_app(app)\n\n if is_new_app\n maybe_start_taskqueue_worker(app)\n end\n\n if is_new_app\n if @app_info_map[app]['nginx'].nil?\n @app_info_map[app]['nginx'] = find_lowest_free_port(Nginx::START_PORT)\n @app_info_map[app]['haproxy'] = find_lowest_free_port(\n HAProxy::START_PORT)\n @app_info_map[app]['nginx_https'] = Nginx.get_ssl_port_for_app(\n @app_info_map[app]['nginx'])\n end\n\n @app_info_map[app]['appengine'] = []\n end\n\n # Only take a new port for this application if there's no data about\n # this app. Use the existing port if there is info about it.\n nginx_port = @app_info_map[app]['nginx']\n https_port = @app_info_map[app]['nginx_https']\n proxy_port = @app_info_map[app]['haproxy']\n\n port_file = \"/etc/appscale/port-#{app}.txt\"\n if my_node.is_login?\n HelperFunctions.write_file(port_file, \"#{@app_info_map[app]['nginx']}\")\n Djinn.log_debug(\"App #{app} will be using nginx port #{nginx_port}, \" +\n \"https port #{https_port}, and haproxy port #{proxy_port}\")\n\n @nodes.each { |node|\n if node.private_ip != my_node.private_ip\n HelperFunctions.scp_file(port_file, port_file, node.private_ip,\n node.ssh_key)\n end\n }\n else\n loop {\n if File.exists?(port_file)\n Djinn.log_debug(\"Got port file for app #{app}\")\n break\n else\n Djinn.log_debug(\"Waiting for port file for app #{app}\")\n Kernel.sleep(5)\n end\n }\n end\n\n # TODO(cgb): Make sure we don't add the same cron lines in twice for the same\n # app, and only start xmpp if it isn't already started\n if my_node.is_shadow?\n CronHelper.update_cron(my_public, nginx_port, app_language, app)\n start_xmpp_for_app(app, nginx_port, app_language)\n end\n\n # We only need a new full proxy config file for new apps, on the machine\n # that runs the login service (but not in a one node deploy, where we don't\n # do a full proxy config).\n login_ip = get_login.private_ip\n if my_node.is_login?\n begin\n static_handlers = HelperFunctions.parse_static_data(app)\n Djinn.log_run(\"chmod -R +r #{HelperFunctions.get_cache_path(app)}\")\n rescue Exception => e\n # This specific exception may be a json parse error\n error_msg = \"ERROR: Unable to parse app.yaml file for #{app}.\" + \\\n \" Exception of #{e.class} with message #{e.message}\" \n place_error_app(app, error_msg)\n static_handlers = []\n end\n\n Nginx.write_fullproxy_app_config(app, nginx_port, https_port, my_public,\n my_private, proxy_port, static_handlers, login_ip)\n\n loop {\n Kernel.sleep(5)\n success = uac.add_instance(app, my_public, nginx_port)\n Djinn.log_debug(\"Add instance returned #{success}\")\n if success\n # tell ZK that we are hosting the app in case we die, so that\n # other nodes can update the UserAppServer on its behalf\n ZKInterface.add_app_instance(app, my_public, nginx_port)\n break\n end\n }\n end\n\n if my_node.is_appengine?\n # send a warmup request to the app to get it loaded - can shave a\n # number of seconds off the initial request if it's java or go\n # go provides a default warmup route\n # TODO: if the user specifies a warmup route, call it instead of /\n warmup_url = \"/\"\n\n app_manager = AppManagerClient.new(my_node.private_ip)\n # TODO(cgb): What happens if the user updates their env vars between app\n # deploys?\n if is_new_app\n @num_appengines.times { |index|\n appengine_port = find_lowest_free_port(STARTING_APPENGINE_PORT)\n Djinn.log_info(\"Starting #{app_language} app #{app} on \" +\n \"#{HelperFunctions.local_ip}:#{appengine_port}\")\n\n xmpp_ip = get_login.public_ip\n\n pid = app_manager.start_app(app, appengine_port,\n get_load_balancer_ip(), app_language, xmpp_ip,\n [Djinn.get_nearest_db_ip()], HelperFunctions.get_app_env_vars(app))\n\n if pid == -1\n place_error_app(app, \"ERROR: Unable to start application \" + \\\n \"#{app}. Please check the application logs.\")\n end\n\n # Tell the AppController at the login node (which runs HAProxy) that a\n # new AppServer is running.\n acc = AppControllerClient.new(get_login.private_ip, @@secret)\n loop {\n result = acc.add_appserver_to_haproxy(app, my_node.private_ip,\n appengine_port)\n if result == NOT_READY\n Djinn.log_info(\"Login node is not yet ready for AppServers to \" +\n \"be added - trying again momentarily.\")\n Kernel.sleep(5)\n else\n Djinn.log_info(\"Successfully informed login node about new \" +\n \"AppServer for #{app} on port #{appengine_port}.\")\n break\n end\n }\n }\n else\n Djinn.log_info(\"Restarting AppServers hosting old version of #{app}\")\n result = app_manager.restart_app_instances_for_app(app)\n end\n\n if is_new_app\n # now doing this at the real end so that the tools will\n # wait for the app to actually be running before returning\n done_uploading(app, app_path, @@secret)\n end\n end\n\n APPS_LOCK.synchronize {\n if @app_names.include?(\"none\")\n @apps_loaded = @apps_loaded - [\"none\"]\n @app_names = @app_names - [\"none\"]\n end\n\n if is_new_app\n @apps_loaded << app\n else\n @apps_to_restart.delete(app)\n end\n }\n end", "def run_instance\n Souffle::Log.info \"Single instance runs are not currently implemented...\"\n # system = Souffle::System.from_hash(data)\n # provider = Souffle::Provider.plugin(system.try_opt(:provider)).new\n # system_tag = provider.create_system(system)\n end", "def app=(_arg0); end", "def run_weave_application\n options = Rake.application_options(@output, @configurations)\n options << @root\n options += Rake.chunk_files.reject { |chunk| chunk == @root }\n status = Application.with_argv(options) { Weave.new.run }\n raise \"Codnar weave errors\" unless status == 0\n end", "def run\n configure_middleware(rack_builder = Rack::Builder.new)\n rack_builder.run(rack_app)\n\n # Choose and start a Rack handler\n @context.running_server = available_server\n @context.running_server.run rack_builder.to_app, :Host => @context.host, :Port => @context.port do |server|\n [:INT, :TERM].each {|sig| trap(sig) { (server.respond_to? :stop!) ? server.stop! : server.stop } }\n puts \"A#{'n' if @environment =~ /\\A[aeiou]/} #{@environment} Tanuki appears! Press Ctrl-C to set it free.\",\n \"You used #{@context.running_server.name.gsub(/.*::/, '')} at #{@context.host}:#{@context.port}.\"\n end\n end", "def appFX\n appEM.app\nend" ]
[ "0.60773844", "0.60418624", "0.59693027", "0.58831906", "0.5855296", "0.5842363", "0.5792584", "0.5775863", "0.57691264", "0.57691264", "0.57611763", "0.57465196", "0.5739958", "0.5713049", "0.5702809", "0.5687736", "0.56546474", "0.5648494", "0.56421477", "0.5638803", "0.5625383", "0.56171095", "0.5616088", "0.55988526", "0.5598803", "0.55972385", "0.5594367", "0.5580619", "0.55692333", "0.556212", "0.55553836", "0.55497247", "0.55479217", "0.5539031", "0.5523743", "0.55215895", "0.54969525", "0.54851854", "0.5473863", "0.54679054", "0.54462445", "0.54358166", "0.54156935", "0.54055816", "0.5394059", "0.5394059", "0.53810966", "0.53772557", "0.53772557", "0.53760713", "0.5371522", "0.5338036", "0.53363526", "0.53302306", "0.53277797", "0.5321096", "0.5311274", "0.5302461", "0.5301739", "0.5297806", "0.529775", "0.5296869", "0.5292144", "0.5287496", "0.52842534", "0.52842534", "0.52842534", "0.52842534", "0.52842534", "0.52842534", "0.52842534", "0.52842534", "0.52842534", "0.52842534", "0.52745116", "0.52717566", "0.52684426", "0.5264591", "0.52323943", "0.523198", "0.5227037", "0.52242285", "0.52242285", "0.52240175", "0.5220717", "0.5213307", "0.5213282", "0.5210901", "0.52097917", "0.52092946", "0.51996183", "0.51877594", "0.5187654", "0.5185858", "0.51833004", "0.5175181", "0.5174048", "0.5160722", "0.5158653", "0.51583683", "0.51569504" ]
0.0
-1
Runs the staged app.
def run(*env_or_envs) return if running? @running = true builder.run(stage(*env_or_envs)) detect_handler.run(builder, Host: config.server.host, Port: config.server.port) do |server| trap(:INT) { stop(server) } trap(:TERM) { stop(server) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(app, *args)\n opts = args.extract_options!\n @main_app = app\n @build.run(app)\n end", "def run\n check_args\n Application::InstanceMethods.instance_method(:sandbox).bind(@app).call.\n instance_eval(&@block)\n end", "def run_bundle\n end", "def run_bundle ; end", "def run_bundle ; end", "def run(app)\n raise '@run already set' if @run\n\n @run = app\n end", "def run_application\n if Souffle::Config[:daemonize]\n Souffle::Config[:server] = true\n Souffle::Daemon.daemonize(\"souffle\")\n end\n @app.run\n end", "def run_bundle; end", "def run\n unless !@valid_name || File.exists?(@project_name) || File.directory?(@project_name)\n $stdout.puts \"Creating goliath application under the directory #{@project_name}\"\n FileUtils.mkdir @project_name\n \n create_base_dirs\n copy_files_to_target\n setup_api_module\n copy_files_to_dir 'application.rb','config'\n copy_files_to_dir 'database.yml','config'\n $stdout.puts \"\\e[1;32m \\trun\\e[0m\\tbundle install\"\n Dir.chdir(\"#{@project_name}\")\n system(\"bundle install\")\n else \n unless !@valid_name\n $stdout.puts \"\\e[1;31mError:\\e[0m The directory #{@project_name} already exists, aborting. Maybe move it out of the way before continuing.\"\n end\n end\n end", "def main\n @app.main\n end", "def run_weave_application\n options = Rake.application_options(@output, @configurations)\n options << @root\n options += Rake.chunk_files.reject { |chunk| chunk == @root }\n status = Application.with_argv(options) { Weave.new.run }\n raise \"Codnar weave errors\" unless status == 0\n end", "def run!\n report_startup\n setup_stage\n stage_operations\n managed_copy\n remove_stage\n report_complete\n end", "def run_app(command, arguments)\nend", "def execute_app(app)\n load app\n end", "def run\n reconfigure\n setup_application\n run_application\n end", "def run_bundle\n\t\t\t$stdout.puts Rainbow(\"Bundle ...\").green\n\t\t\tr.bundle\n\t\t\t$stdout.puts Rainbow(\"Success: Production env 'bundle' command run for app\").green\n\t\tend", "def run\n @pid = fork do \n initialize_sandbox\n exec(@app)\n end\n\n _, @exit_status = Process.wait2(@pid)\n @pid\n end", "def execute_app(app)\n $LOAD_PATH.unshift(Dir.pwd)\n Shoes.configuration.backend = :swt\n load app\n end", "def run\n case action\n when 'new'\n require_relative('templater')\n Templater.new(File.expand_path(directory, Dir.pwd), settings).run!\n when 'console'\n require_relative('console')\n Wukong::Deploy::Console.new.run!\n end\n end", "def startApplication(app_name, show_std=true)\n if @app_contexts.find { |v| v.orig_name == app_name }\n run_application(app_name, show_std)\n else\n warn \"No application with name '#{app_name}' defined in group #{@name}. Nothing to start\"\n end\n end", "def run_main\n end", "def start_app\nend", "def run\n run_app\n adapter.run\n rescue Interrupt\n shut_down\n end", "def run file_name \n\t\tapplication = select_app file_name \n\t\tsystem \"#{application} #{file_name}\" \n\tend", "def start_apps\n check_apps\n remove_sockets\n _start_apps(ARGV[1])\nend", "def run(argv = [])\n @opts.parse!(argv)\n\n path = argv.delete_at(0)\n proto = __DIR__('../../proto')\n\n abort 'You need to specify a name for your application' if path.nil?\n\n if File.directory?(path) and @options[:force] === false\n abort 'The specified application already exists, use -f to overwrite it'\n end\n\n if File.directory?(path) and @options[:force] === true\n FileUtils.rm_rf(path)\n end\n\n begin\n FileUtils.cp_r(proto, path)\n puts \"The application has been generated and saved in #{path}\"\n rescue\n abort 'The application could not be generated'\n end\n end", "def run file_name\n\t\tapplication = select_app file_name\n\t\tsystem \"#{application} #{file_name}\"\n\tend", "def run file_name\n application = select_app file_name\n system \"#{application} #{file_name}\"\n end", "def run file_name\n application = select_app file_name\n system \"#{application} #{file_name}\"\n end", "def run(argv = ARGV)\n #p [:argv, argv]\n begin\n # cheating\n if argv.include?('-h') or argv.include?('--help')\n puts help_text\n else\n app = from_argv(argv)\n app.run\n end\n rescue Exception => e\n if exit_status == 0\n exit_status 1\n end\n puts \"\\nERROR: #{e}\"\n ensure\n exit(exit_status)\n end\n end", "def run!\n # Validate paths\n validate_paths!\n \n # Extract mockup\n copy_source_path_to_build_path!\n \n validate_stack!\n \n # Run stack\n run_stack!\n \n # Run finalizers\n run_finalizers!\n \n # Cleanup\n cleanup! if self.config[:cleanup_build]\n \n end", "def run_all\n deploy_code\n run_test\n end", "def run file_name \n application = select_app file_name \n system \"#{application} #{file_name}\" \n end", "def launch_native\n if !File.exists? 'build/app'\n puts \"No native app built!\"\n exit\n end\n `( cd build && ./app )`\nend", "def run( file_name )\n application = select_app( file_name )\n system( \"#{application} #{file_name}\" )\n end", "def launch_native\n if !File.exist? 'build/app'\n puts \"No native app built!\"\n exit\n end\n `( cd build && ./app )`\nend", "def run\n # Change the working directory to the directory of this script.\n Dir.chdir(File.dirname(__FILE__)) \n\n # if LIST_TECHNIQUES is true, just output available evasion techniques.\n if datastore['LIST_TECHNIQUES'] == true\n print_available_techniques()\n else\n payload = datastore['PAYLOAD']\n payload_options = datastore['PAYLOAD_OPTIONS']\n output_directory = datastore['OUTPUT_DIRECTORY']\n executable_name = datastore['EXECUTABLE_NAME']\n evasion_stack = datastore['EVASION_STACK']\n msfvenom_path = datastore['MSFVENOM_PATH']\n\n if payload == nil\n print_error(\"PAYLOAD must be set.\")\n return \n end\n if output_directory == nil \n print_error(\"OUTPUT_DIRECTORY must be set.\")\n return\n end\n if executable_name == nil \n print_error(\"EXECUTABLE_NAME must be set.\") \n return\n end\n if msfvenom_path == \"\"\n # Guess at path to msfvenom\n msfvenom_path = Dir.pwd[0..(Dir.pwd.index(\"pro\")+3)]+\"msf3/msfvenom\"\n print_status(\"MSFVENOM_PATH not specified. Hoping msfvenom can be found at \"+msfvenom_path+\".\")\n end\n\n binary_generated = generate_binary(msfvenom_path, payload, payload_options)\n if binary_generated\n print_status(\"Payload binary generated successfully.\")\n print_status(\"Generating evasive source from generated binary.\")\n\n generate_evasive_source(evasion_stack)\n\n executable_generated = generate_executable(output_directory+\"/\"+executable_name)\n\n if executable_generated\n print_status(\"Executable successfully generated.\")\n else\n print_error(\"Unable to generate executable.\")\n end\n else\n print_error(\"Payload generation with msfvenom failed.\")\n end\n\n print_status(\"Cleaning up temporary files.\")\n\n if File.exist?('tmp/bin'+self.uuid+'.c')\n File.delete('tmp/bin'+self.uuid+'.c')\n end\n if File.exist?('tmp/evasive'+self.uuid+'.c')\n File.delete('tmp/evasive'+self.uuid+'.c')\n end\n\n end\n end", "def execute\n\n\t\t#raise \"You must define 'output' for #{self}\" if self.output == nil\n\t\t#raise \"You must define 'application_descriptor'\" if self.application_descriptor == nil || !File.exists?(self.application_descriptor)\n\t\t#raise \"You must define 'keystore' for #{self}\" if self.keystore == nil\n\t\t#raise \"You must define 'keystore_name' for #{self}\" if self.keystore_name == nil\n\t\t#raise \"You must define 'storepass' for #{self}\" if self.storepass == nil\n\t\t#raise \"You must define 'include_files' for #{self}\\neg: include_files << 'bin .'\" if self.include_files.length < 1\n\n\t\t# TODO: Somehow confirm that the initialWindow content is included in the build\n\t\t#app_xml = Nokogiri::XML(File.read(application_descriptor))\n\t\t#swf = app_xml.at_css(\"initialWindow > content\").content.to_s\n\t\t#swf = File.join(@output_dir, swf)\n\t\t#puts swf\n\n\t\tcommand = \"#{FlexSDK::adt}\"\n\t\tcommand << \" -package\"\n\t\tcommand << \" -tsa #{self.tsa}\" if self.tsa != nil\n\t\tcommand << \" -storetype #{self.storetype}\"\n\t\tcommand << \" -keystore #{self.keystore}\"\n\t\tcommand << \" -storepass #{self.storepass}\"\n\t\tcommand << \" -target #{target}\" if target != nil && target != \"air\"\n\t\tcommand << \" #{additional_args}\" if self.additional_args != nil\n\t\tcommand << \" #{self.output}\"\n\t\tcommand << \" #{self.application_descriptor}\"\n\t\tself.include_files.each {|entry| command << \" -C #{entry}\" }\n\t\t\n\t\tstatus = run command, false\n\n\t\tif status.exitstatus != 0\n\t\t\tcase status.exitstatus\n\t\t\twhen 2\n\t\t\t\traise \"Usage error\\n\" + \n\t\t\t\t\t \"Check the command line arguments for errors\"\n\t\t\twhen 5\n\t\t\t\traise \"Unknown error\\n\" +\n\t\t\t\t\t \"This error indicates a situation that cannot be explained by common error conditions.\\n\" +\n\t\t\t\t\t \"Possible root causes include incompatibility between ADT and the Java Runtime Environment,\\n\" +\n\t\t\t\t\t \"corrupt ADT or JRE installations, and programming errors within ADT.\"\n\t\t\twhen 6\n\t\t\t\traise \"Could not write to output directory\\n\" +\n\t\t\t\t\t \"Make sure that the specified (or implied) output directory is accessible and\\n\" +\n\t\t\t\t\t \"that the containing drive has sufficient disk space.\"\n\t\t\twhen 7\n\t\t\t\traise \"Could not access certificate\\n\" +\n\t\t\t\t\t \"Make sure that the path to the keystore is specified correctly: #{self.keystore}\\n\" +\n\t\t\t\t\t \"Make sure that the keystore password is correct: #{self.storepass}\"\n\t\t\t\t\t #\"Check that the certificate within the keystore can be accessed.\"\n\t\t\twhen 8\n\t\t\t\traise \"Invalid certificate\\n\" +\n\t\t\t\t\t \"The certificate file is malformed, modified, expired, or revoked.\"\n\t\t\twhen 9\n\t\t\t\traise \"Could not sign AIR file\\n\" +\n\t\t\t\t\t \"Verify the signing options passed to ADT.\"\n\t\t\twhen 10\n\t\t\t\traise \"Could not create time stamp\\n\" +\n\t\t\t\t\t \"ADT could not establish a connection to the timestamp server.\\n\" + \n\t\t\t\t\t \"If you connect to the internet through a proxy server, you may need to configure\\n\" + \n\t\t\t\t\t \"the JRE proxy settings. There have also been errors reported with Java 7: \\n\" +\n\t\t\t\t\t \"http://www.flashdevelop.org/community/viewtopic.php?p=41221\\n\" + \n\t\t\t\t\t \"You can disable checking a timestamp server by setting 'tsa' to 'none' in your task\"\n\t\t\twhen 11\n\t\t\t\traise \"Certificate creation error\\n\" +\n\t\t\t\t\t \"Verify the command line arguments used for creating signatures.\"\n\t\t\twhen 12\n\t\t\t\traise \"Invalid input\\n\" +\n\t\t\t\t\t \"Verify file paths and other arguments passed to ADT on the command line.\\n\" +\n\t\t\t\t\t \"Be sure the initial content in #{self.application_descriptor} is included in the build by\\n\" +\n\t\t\t\t\t \"appnding it to includ_files (eg, adt.include_files << 'bin .')\"\n\t\t\t\t\t #\"<initialWindow>\\n <content>#{swf}</content>\\n</initialWindow>\"\n\t\t\telse\n\t\t\t\traise \"Operation exited with status #{status.exitstatus}\"\n\t\t\tend\n\t\tend\n\tend", "def run\n FastlaneCore::UI.message('Analyser run, will fetch_app_version...')\n fetch_app_version(options)\n end", "def application_run()\n # we return a Bash exit value which means that rc == 0 is success\n # and anything else is failure. assume we fail then prove otherwise.\n rc = 1\n begin\n if self.respond_to? :application_lock\n applock = self.application_lock\n Log.Debug(\"[LOCKING '#{applock}'...]\") {\n ::Brewed::Path::Lock.lock_file(applock) do\n rc = _application_run\n end\n }\n else\n rc = _application_run\n end\n\n rescue => exp\n msg = Log.exception_to_string exp\n Log.Out msg\n\n rc = 1\n if self.respond_to? :application_fail\n m = self.application_fail msg\n msg = m unless m.nil?\n else\n msg += \"\\n\\nexit status: FAILED!\"\n end\n\n abort \"EXCEPTION #{exp.class.to_s}: #{exp.message}\"\n end\n\n # output the application's success message or our default\n msg =\n if rc == 0\n (self.respond_to? :application_success) ?\n self.application_success : \"exit status: SUCCESS!\"\n else\n \"exit status: FAILED!\"\n end\n\n Log.Out msg\n\n rc\n end", "def run!\n project.mode = :release\n\n # Validate paths\n validate_paths!\n\n # Extract mockup\n copy_source_path_to_build_path!\n\n validate_stack!\n\n # Run stack\n run_stack!\n\n # Cleanup\n cleanup! if config[:cleanup_build]\n ensure\n project.mode = nil\n end", "def launch_app\n @bridge.launch_app\n end", "def run\r\n return puts(\"usage example: glimmer run tictactoe\") unless @name\r\n # Search for the filename (and add the .rb extension if not provided), and run it\r\n if File.exist?(\"#{@name}#{'.rb' unless @name =~ /.rb$/}\")\r\n command = \"#{JRUBY_COMMAND} \\\"#{@name.gsub(/\\\\/, '/')}#{'.rb' unless @name =~ /.rb$/}\\\"\"\r\n else\r\n # Search for all installed samples and try to run of those\r\n command = \"#{JRUBY_COMMAND} \\\"#{SAMPLES_PATH}/#{fetch_app(@name)}.rb\\\"\"\r\n end\r\n puts \"Starting the application with following command:\"\r\n puts command\r\n system command\r\n end", "def run(argv)\n arguments = parse(argv)\n return if @quit\n\n Wright.activate_dry_run if @dry_run\n Wright.log.level = @log_level if @log_level\n @main.extend Wright::DSL\n\n run_script(arguments)\n end", "def run_stage_one \n\t# directory tools is needed by stage on, be sure it does not exist yet\n\tif File.exists?(\"/tools\")\n\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" error > EXIT! Directory or softlink /tools already exists\"\n\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" error > Too risky for me to continue. Remove /tools, then\"\n\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" error > try again.\"\n\t\t$stdout.flush\n\t\traise \"SoftlinkAlreadyThere\"\n\tend\n\t# File.symlink(@builddir + \"/stage01/chroot/tools\", \"/tools\")\n\tsystem(\"mkdir /tools\")\n\tsystem(\"mkdir -p \" + @builddir + \"/stage01/chroot/tools\")\n\tsystem(\"mount -o bind \" + @builddir + \"/stage01/chroot/tools /tools\")\n\t[ \"/stage01\", \"/stage01/build\",\"/stage01/chroot\",\"/stage01/chroot/tools\", \"/tmp\" ].each { |d|\n\t\tunless File.exists?(@builddir + d)\n\t\t\tDir.mkdir(@builddir + d)\n\t\tend\n\t}\n\t# Stage 01 abfrühstücken\n\t# Alle Scripte in stage01 suchen\n\tstage_one_objs = get_stage_one_objs\n\t# Download first\n\tstage_one_objs.each { |i| i.download }\n\t# Unpack\n\tstage_one_objs.each { |i|\n\t\ti.unpack\n\t\t### Dir.chdir(@workdir)\n\t\ti.patch(@log_each)\n\t\t### Dir.chdir(@workdir)\n\t\ti.build(@log_each)\n\t\t### Dir.chdir(@workdir)\n\t\ti.install(@log_each)\n\t\t### Dir.chdir(@workdir)\n\t\ti.filecheck\n\t\t### Dir.chdir(@workdir)\n\t}\n\tsystem(\"umount /tools\")\nend", "def run\n configure_middleware(rack_builder = Rack::Builder.new)\n rack_builder.run(rack_app)\n\n # Choose and start a Rack handler\n @context.running_server = available_server\n @context.running_server.run rack_builder.to_app, :Host => @context.host, :Port => @context.port do |server|\n [:INT, :TERM].each {|sig| trap(sig) { (server.respond_to? :stop!) ? server.stop! : server.stop } }\n puts \"A#{'n' if @environment =~ /\\A[aeiou]/} #{@environment} Tanuki appears! Press Ctrl-C to set it free.\",\n \"You used #{@context.running_server.name.gsub(/.*::/, '')} at #{@context.host}:#{@context.port}.\"\n end\n end", "def start_run; end", "def run\n # rubocop:disable Style/SignalException\n # Parameter 'id' should be of type String\n\n id = unsafe_params[:id]\n fail \"App ID is not a string\" unless id.is_a?(String) && id != \"\"\n\n # Name should be a nonempty string\n name = unsafe_params[:name]\n fail \"Name should be a non-empty string\" unless name.is_a?(String) && name != \"\"\n\n # Inputs should be a hash (more checks later)\n inputs = unsafe_params[\"inputs\"]\n fail \"Inputs should be a hash\" unless inputs.is_a?(Hash)\n\n job_limit = params[:job_limit].to_f.zero? ? current_user.job_limit : params[:job_limit].to_f\n fail \"Job limit exceeds maximum user setting - #{current_user.job_limit}\" if job_limit > current_user.job_limit\n\n run_instance_type = unsafe_params[:instance_type]\n\n fail I18n.t(\"app_instance_type_forbidden\") unless current_user.resources.include?(run_instance_type)\n\n # App should exist and be accessible and runnable by a user.\n @app = App.find_by!(uid: id)\n\n fail I18n.t(\"app_not_accessible_or_runnable\") unless @app.runnable_by?(current_user)\n\n # Check if asset licenses have been accepted\n unless @app.assets.all? { |a| a.license.blank? || a.licensed_by?(@context) }\n fail \"Asset licenses must be accepted\"\n end\n\n # Call JupiterLab service if https app is running\n if @app.https?\n https_apps_client = DIContainer.resolve(\"https_apps_client\")\n input_info = input_spec_preparer.run(@app, inputs)\n\n fail input_spec_preparer.first_error unless input_spec_preparer.valid?\n\n result =\n begin\n https_apps_client.app_run(\n @app.dxid,\n name: name,\n instanceType: run_instance_type,\n jobLimit: job_limit,\n scope: Scopes::SCOPE_PRIVATE,\n input: input_info.run_inputs,\n )\n rescue HttpsAppsClient::Error => e\n fail e.message\n end\n\n job = Job.find_by!(dxid: result[\"dxid\"])\n\n render(json: { id: job.uid }) && return\n end\n\n space_id = unsafe_params[:space_id]\n\n fail \"Invalid space_id\" if space_id && !@app.can_run_in_space?(@context.user, space_id)\n\n space = Space.find_by(id: space_id)\n # Inputs should be compatible\n # (The following also normalizes them)\n input_info = input_spec_preparer.run(@app, inputs, space&.accessible_scopes)\n\n fail input_spec_preparer.first_error unless input_spec_preparer.valid?\n\n if space\n project = space.project_for_user(@context.user)\n permission = space.have_permission?(project, @context.user)\n fail \"You don't have permissions to run app in space #{space.name}\" unless permission\n else\n project = @context.user.private_files_project\n end\n\n job = job_creator(project).create(\n app: @app,\n name: name,\n input_info: input_info,\n run_instance_type: run_instance_type,\n job_limit: job_limit,\n scope: space&.uid,\n )\n\n SpaceEventService.call(space_id, @context.user_id, nil, job, :job_added) if space&.review?\n # rubocop:enable Style/SignalException\n\n render json: { id: job.uid }\n end", "def run\n end", "def run\n end", "def run_app_tests\n end", "def run\n setup\n build_vm\n package_stemcell\n cleanup\n @target\n end", "def run\n setup\n build_vm\n package_stemcell\n cleanup\n @target\n end", "def run\n raise \"Invalid Bootstrapper\"\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run(file_name)\n application = select_app(file_name)\n system \"#{application} #{file_name}\"\n end", "def run\n write_parameter_file\n Tandem.run_commandline_application\n end", "def run_program()\n final_words()\n segmented_output()\n end", "def execute\n if @user_choices[:version]\n puts IO.read(File.join(File.dirname(__FILE__), '../../VERSION')).strip\n else\n logger = setup_logger\n begin\n app = Drbman.new(logger, @user_choices)\n app.execute\n rescue Exception => e\n logger.error { e.to_s }\n logger.debug { e.backtrace.join(\"\\n\") }\n end\n end\n end", "def run\n git_tagger.run\n publisher.run if publish_to_supermarket\n end", "def ship_app\n\t`make --directory #{config.shipit_makefile_path} #{config.shipit_command}`\n end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def launch(app_id, args)\n runcmd 'launch', \"#{app_id} #{args}\" \n end", "def run(argv)\n arguments = parse(argv)\n return if quit\n\n Wright.activate_dry_run if dry_run\n Wright.log.level = log_level if log_level\n main.extend Wright::DSL\n requires.each { |r| require r }\n\n run_script(arguments)\n end", "def run\n command = Minus5.start_script_name\n app_root = Minus5.path_relative_to_start_script(\"/..\") \n config = Minus5.load_config(\"#{app_root}/config/service.yml\")\n service_name = config[:app_name] || File.basename(app_root)\n \n class_name = service_name.camelize\n config = config.merge default_options(app_root, service_name)\n \n require \"#{app_root}/lib/#{service_name}.rb\"\n service = eval(class_name).new(config)\n if service.respond_to?(command) \n service.send(command)\n else\n log \"No method #{command} in #{class_name}!\"\n end \n end", "def startApplications(show_std=true)\n if @app_contexts.empty?\n warn \"No applications defined in group #{@name}. Nothing to start\"\n else\n @applications.each { |app|\n run_application(app[:name], show_std)\n }\n end\n end", "def run(paths)\n return true if paths.empty?\n Bundler.with_clean_env { Kernel.system(\"bundle exec alfred #{paths.join(' ')}\") }\n end", "def run_server\n EM.synchrony do\n @app = Rack::Builder.new do\n use Rack::Lint\n use Rack::ShowExceptions\n run Rack::Cascade.new([Souffle::Http])\n end.to_app\n\n Rack::Handler.get(:thin).run(@app, rack_options)\n end\n end", "def run\n script_name = shift_argument\n unless script_name\n error(\"Usage: mortar local:run SCRIPT\\nMust specify SCRIPT.\")\n end\n validate_arguments!\n\n # cd into the project root\n project_root = options[:project_root] ||= Dir.getwd\n unless File.directory?(project_root)\n error(\"No such directory #{project_root}\")\n end\n Dir.chdir(project_root)\n script = validate_script!(script_name)\n params = config_parameters.concat(pig_parameters)\n\n ctrl = Mortar::Local::Controller.new\n ctrl.run(script, pig_version, params)\n end", "def run\n standard_exception_handling do\n handle_env(ENV)\n handle_options(ARGV)\n config.cmdline = CmdlineBuilder.new(config, Dir.pwd, $0, ENV)\n @output_stream.puts config.output\n end\n end", "def run_suite(tests)\n @app.run_suite(tests)\n end", "def run\n end", "def run_stack(ctn, payload, directory, action)\n unless([:create, :update].include?(action.to_sym))\n abort ArgumentError.new(\"Invalid action argument `#{action}`. Expecting `create` or `update`!\")\n end\n ctn.exec!('bundle install', :cwd => directory, :timeout => 120)\n stack_name = payload.get(:data, :stacks, :name)\n\n event!(:info, :info => \"Starting stack #{action} - #{stack_name}!\", :message_id => payload[:message_id])\n\n stream = Fission::Utils::RemoteProcess::QueueStream.new\n env_vars = build_environment_variables(payload)\n future = Zoidberg::Future.new do\n begin\n ctn.exec(\n \"bundle exec sfn #{action} #{stack_name} --defaults --no-interactive-parameters --file #{payload.get(:data, :stacks, :template)} --yes\",\n :stream => stream,\n :cwd => directory,\n :environment => env_vars.merge(\n 'HOME' => directory,\n 'USER' => 'SparkleProvision'\n ),\n :timeout => 3600 # TODO: This will probably need to be tunable!\n )\n rescue => e\n error \"Stack #{action} failed (ID: #{payload[:message_id]}): #{e.class} - #{e}\"\n debug \"#{e.class}: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n Fission::Utils::RemoteProcess::Result.new(-1, \"Build failed (ID: #{payload[:message_id]}): #{e.class} - #{e}\")\n ensure\n stream.write :complete\n end\n end\n\n until((lines = stream.pop) == :complete)\n lines.split(\"\\n\").each do |line|\n line = line.sub(/^\\[.+?\\]/, '').strip\n next if line.empty?\n debug \"Log line: #{line}\"\n event!(:info, :info => line, :message_id => payload[:message_id])\n end\n end\n\n result = future.value\n ctn.terminate\n\n if(result && result.success?)\n event!(:info, :info => \"Stack #{action} completed - #{stack_name}!\", :message_id => payload[:message_id])\n else\n error \"Stack #{action} failed for stack #{stack_name}\"\n error \"Stack #{action} failed with exit status of `#{result.exit_code}`\"\n error = Fission::Error::RemoteProcessFailed.new(\"Stack #{action} failed - Exit code: #{result.exit_code}\")\n raise error\n end\n end", "def run(argv)\n _run(argv)\n rescue Quickl::Error => ex\n handle_error(ex)\n end", "def start\n status = -1\n begin\n log(INFO, \"Start of #{ @appname }.\")\n status = run\n rescue\n log(FATAL, \"Detected an exception. Stopping ... #{$!} (#{$!.class})\\n\" << $@.join(\"\\n\"))\n ensure\n log(INFO, \"End of #{ @appname }. (status: #{ status })\")\n end\n status\n end", "def run\n loop do\n break unless app_loop\n end\n end", "def start\n configure\n run\n end", "def run_hooks\n run_hook\n run_hook(Terraspace.env)\n end", "def run\n require_relative File.join(absolute_path, 'main')\n Gamefic::Tty::Engine.run\n end", "def run\n if not @test then\n @dirs.each do |dir|\n if @local\n `cd #{dir}; ./local-run.sh #{File.basename(@executable)} #{@ranges['name']} #{@ranges['args']}`\n puts \"task run: #{dir}\"\n else\n `cd #{dir}; ./pbs-run.sh #{File.basename(@executable)} #{@ranges['name']} #{@ranges['args']}`\n puts \"task queued: #{dir}\"\n end\n end\n end\n end", "def run\n\n # Gets possible data source(s)\n service(:sniffer).exec\n\n # Filters the data source(s) to extract the relevant only.\n service(:filter).exec\n\n # ETL\n context[:to_be_extracted].each_with_index do |ds, i|\n log.debug \"starting ETL, idx=#{i + 1}\"\n context[:extract] = ds\n service(:extractor).exec\n service(:transformer).exec\n service(:loader).exec\n end\n\n log.info 'Bye bye'\n end", "def run\n # TODO: include a parse step here and remove duplicate parsing code from\n # individual commands\n execute\n end", "def run(argv = ARGV)\n # => Parse the Params\n configure(argv)\n\n # => Launch the Controller\n Controller.run\n end", "def run_supervised\n process.supervise\n Karafka::App.run!\n Karafka::App.config.internal.fetcher.call\n end", "def generate\n `bundle exec stasis`\nend", "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" ]
[ "0.66115695", "0.66070926", "0.6478408", "0.64727616", "0.64727616", "0.646376", "0.6463089", "0.63749415", "0.63725495", "0.63286674", "0.6312177", "0.628534", "0.6255882", "0.61926407", "0.6160222", "0.61564445", "0.6151872", "0.6136733", "0.6062538", "0.60610193", "0.6060365", "0.6050647", "0.6044951", "0.59897476", "0.59888643", "0.59807026", "0.59789485", "0.5959695", "0.5959695", "0.59343874", "0.59227014", "0.5922536", "0.5917086", "0.5902986", "0.58905864", "0.5889091", "0.5876823", "0.5834747", "0.58317953", "0.58316034", "0.5822164", "0.5817255", "0.5809838", "0.5798256", "0.5793242", "0.5769771", "0.576024", "0.575996", "0.5743304", "0.5743304", "0.5725962", "0.5718188", "0.5717908", "0.571553", "0.571256", "0.571256", "0.571256", "0.571256", "0.571256", "0.571256", "0.571256", "0.571139", "0.5696966", "0.5678497", "0.56774", "0.5670119", "0.5646214", "0.56402564", "0.56402564", "0.56402564", "0.56402564", "0.56402564", "0.56402564", "0.56402564", "0.56402564", "0.56402564", "0.56402564", "0.5630125", "0.5629054", "0.5628201", "0.56233835", "0.56126237", "0.5605742", "0.56004995", "0.55961967", "0.5596129", "0.5593707", "0.5588114", "0.5585712", "0.5575983", "0.5573103", "0.5568504", "0.55623746", "0.55554336", "0.55509275", "0.5540344", "0.5533154", "0.553073", "0.5530065", "0.55285114", "0.5524251" ]
0.0
-1
Defines a route set.
def routes(set_name = :main, &block) if set_name && block @@routes[set_name] = block else @@routes end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def route_sets; end", "def routes(set_name = :main, &block)\n return @routes ||= {} unless block_given?\n routes[set_name] = block\n self\n end", "def routes(set_name = :main, &block)\n self.class.routes(set_name, &block)\n load_routes\n end", "def data_set_routes\n @trains[0].set_route(routes[0])\n @trains[2].set_route(routes[2])\n end", "def set(name, &block)\n @sets[name] = RouteSet.new\n @sets[name].eval(&block)\n end", "def routes(routes_def)\n RouterDefinition.new(routes_def)\n end", "def setRouteList(routeList)\n @routes = routeList\n @fromNodeMap = generateFromNodeMap(routeList)\n @toNodeMap = generateToNodeMap(routeList)\n end", "def set_route\n #puts \"set route #{params}\"\n @myroute = Route.find(params[:id])\n puts \"set route #{@myroute.inspect}\"\n end", "def routes(&block)\n routes = Routes.new\n routes.instance_eval(&block) if block_given?\n @route_definition = routes\n end", "def route_descriptor_ar(routeset)\n routeset.routes.collect do |route|\n name = routeset.named_routes.routes.index(route).to_s\n verb = route.conditions[:method].to_s.upcase\n path = route.segments.inject(\"\") { |str,s| str << s.to_s }\n path.chop! if path.length > 1\n { :name=>name, :verb=>verb, :path=>path }.merge(route.requirements)\n end ; end", "def set_routing_list\n @routing_list = RoutingList.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def restaurants_resources_routes\n # TODO: Implement the 7 CRUD conventional `routes` that a `resources :restaurants`\n # would generate for you.\n\n # You can use the same DSL (Domain Specific Language) that you use\n # in your rails app `config/routes.rb` file\n\n return RoutesSet.draw do\n # get '/some_route', to: 'some_controller#some_action'\n\n # Add more routes here\n # ...\n end\nend", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_routes(origin, destination)\n origin_lines = get_route_line(origin)\n destination_lines = get_route_line(destination)\n get_connections(origin, destination, origin_lines, destination_lines)\n end", "def setRoutes\n return unless area_changed?\n PlaceRoute.delete place_route_ids\n Route.all.each do |route|\n route.waypoints.each do |waypoint|\n if(inArea(waypoint.latitude, waypoint.longitude))\n PlaceRoute.create(:place_id => id, :route_id => route.id)\n\t break\n end\n end\n end\n end", "def set_tourney_set\n @tourney_set = TourneySet.find(params[:id])\n end", "def set_route\n #zeroday is probably the day you seeded your DB\n zeroday = DateTime.parse('2015-12-02')\n params[:end] ||= params[:start].to_i + 1\n\n if params[:end].to_i < params[:start].to_i\n params[:end] = params[:start].to_i + 1\n end\n\n @whichRoute = params[:id]\n @startHour = params[:start].to_i\n @endHour = params[:end].to_i\n\n # @whichRoute = 10867\n # @startHour = 12\n # @endHour = 13\n\n allStops = StopTime.includes({trip: :route}, :stop).where( arrival_time: (zeroday.change( { hour: @startHour } )..zeroday.change( { hour: @endHour } )) )\n myRoutesTrips = Array.new\n #only look at trips that happen on the weekdays (serivce_id == 1)\n Trip.where(route_id: @whichRoute, service_id: 1).each do |trip|\n myRoutesTrips.push(trip.id)\n end\n\n @stoptimesOnMyRoute = allStops.where(trip_id: myRoutesTrips)\n\n end", "def initialize\n @routes = {}\n end", "def set_route\n @route = Route.find(params[:id])\n @place = Place.find_by(id: @route.place1_ID)\n @array = [@route.place1_ID,@route.place2_ID,@route.place3_ID,@route.place4_ID,@route.place5_ID,@route.place6_ID,@route.place7_ID,@route.place8_ID]\n @newarray = @array.select{|place_ID| place_ID.is_a? Integer}\n @places = @newarray.map{|n| Place.find_by(id: n)}\n end", "def set_route_information\n @routes = {\n :root_url => root_url,\n :root_path => root_path,\n :customers_delete_path => customers_delete_path, \n :customers_all_path => customers_all_path,\n :customers_all_url => customers_all_url,\n :customers_creation_form_url => customers_creationform_url,\n :customers_creation_form_path => customers_creationform_path,\n :customers_edit_form_path => customers_editform_path,\n :customers_edit_form_url => customers_editform_url,\n :contacts_customer_contacts_path => contacts_customer_contacts_path,\n :contacts_customer_contacts_url => contacts_customer_contacts_url,\n :contacts_delete_path => contacts_delete_path,\n :contacts_delete_url => contacts_delete_url,\n :contacts_createForm_path => contacts_createForm_path,\n :contacts_createForm_url => contacts_createForm_url,\n :contacts_update_path => contacts_update_path,\n :contacts_update_url => contacts_update_url,\n :contacts_editform_path => contacts_editform_path,\n :contacts_editform_url => contacts_editform_url\n }\n end", "def add_routes(&block)\n @router ||= Routes.new\n @router.define(&block)\n url.router = @router\n end", "def routes(context={})\n \n routes = [ \n ]\n \n end", "def routes(context={})\n \n routes = [ \n ]\n \n end", "def set_routes\n puts '- SCOOP - Setting Sessions routes'\n\n routes = [\n \"\\n get 'login', to: 'sessions#new', as: 'login'\",\n \"\\n post 'login', to: 'sessions#create', as: 'create_login'\",\n \"\\n get 'logout', to: 'sessions#destroy', as: 'logout'\\n\\n\",\n ]\n\n routes.each do |r|\n inject_into_file 'config/routes.rb', r, before: 'end'\n end\n end", "def clear_routes\n @routes = Hash.new { |h, k| h[k] = Set.new }\n end", "def initialize(routes)\n @routes = routes\n end", "def initialize(routes)\n @routes = routes\n end", "def initialize(routes)\n @routes = routes\n end", "def routes\n raise NotImplementedError\n end", "def routes_map; end", "def routes\n @routes ||= []\n end", "def initialize( routes=[], options={} )\n\t\troutes.each do |tuple|\n\t\t\tself.log.debug \" adding route: %p\" % [ tuple ]\n\t\t\tself.add_route( *tuple )\n\t\tend\n\tend", "def route_tables\n @route_tables ||= init_route_tables\n end", "def routes\n @routes ||= []\n end", "def routes\n @routes ||= []\n end", "def set_route_stops\n @node_link.set_route_stops + 1\n end", "def routes\n routes_method.call\n end", "def set_route_builder\n @route_builder = RouteBuilder.find(params[:id])\n end", "def initialize\n @shapes = Set.new\n @lights = Set.new\n end", "def routes=(_arg0); end", "def routes=(_arg0); end", "def routes=(_arg0); end", "def set_route_type\n @route_type = RouteType.find(params[:id])\n end", "def add_route(route={})\n request :post, '/routes', route\n end", "def set_ht_route\n @ht_route = HtRoute.find(params[:id])\n end", "def set_route_allowlist(route_allowlist)\n @@route_allowlist = route_allowlist\n end", "def call_routes=(value)\n @call_routes = value\n end", "def set_select_route\n @select_route = SelectRoute.find(params[:id])\n end", "def routing(&block)\n @routing_config = block\n end", "def routes\n @route_map.dup\n end", "def add(new)\n @routes << new\n end", "def set_train_route\n @train_route = TrainRoute.find(params[:id])\n end", "def routes\n @routes ||= load_routes\n end", "def route_config\n raise StandardError, \"You must set a route_id in Scratch before calling route_config\"\n @route = Nextbus::Route.find @agency_id, @route_id\n sensor_update \"route_title\", @route.title\n set_screen_factors @route.lat_min, @route.lat_max, @route.lon_min, @route.lon_max\n set_stops\n get_vehicle_locations\n end", "def set_trip_route\n @trip_route = TripRoute.find(params[:id])\n end", "def set_train_route\n @train_route = TrainRoute.find(params[:id])\n end", "def all_resources(set = Set.new)\n set << self\n set\n end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def set_walkroute\n @walkroute = Walkroute.find(params[:id])\n end", "def add_route(route)\n @routes << route\n route\n end", "def initialize_routes(data, single)\n data.each do |line|\n @metros[line['ports'][0]].add_distination(line['ports'][1], line['distance'])\n if single == 0\n @metros[line['ports'][1]].add_distination(line['ports'][0], line['distance'])\n end\n end\n end", "def routes(path = nil, &blk)\n if path or block_given?\n @routes = Config::Routes.new(root, path, &blk)\n else\n @routes\n end\n end", "def genuine_rails_resources_route_ar(*args)\n temp_routes = ActionController::Routing::RouteSet.new\n temp_routes.draw {|map| map.resources(*args) }\n route_descriptor_ar(temp_routes)\n end", "def all_resources(set = Set.new)\n set << self\n self.each_resource { |r| r.all_resources(set) }\n set\n end", "def routes(&block); end", "def routes(&block); end", "def set_route_instance\n @route_instance = RouteInstance.find(params[:id])\n end", "def set_rec_run_route\n @rec_run_route = RecRunRoute.find(params[:id])\n end", "def routes\n ['Agriculture, environmental and animal care', 'Business administration', 'Catering and hospitality' \\\n 'Construction',\n 'Creative and design', 'Digital', 'Engineering and manufacturing', 'Hair and beauty', 'Health and science',\n 'Legal, finance and accounting', 'Protective services', 'Sales, marketing and procurement', 'Transport']\n end", "def _routes; end", "def method_missing(rule_set_name, args = {})\n template = Asbestos::RuleSet[rule_set_name]\n raise %{Unknown host DSL call : \"#{rule_set_name}\" for host \"#{name}\"} unless template\n\n @rulesets << \\\n Asbestos::RuleSet.new(rule_set_name, self, template).tap do |rs|\n # override template defaults with provided options\n args.each do |k, v|\n rs.send k, v\n end\n end\n end", "def set_set_statements(name, action, seqno, value)\n raise ArgumentError, 'value must be an Array' unless value.is_a?(Array)\n\n cmds = [\"route-map #{name} #{action} #{seqno}\"]\n remove_set_statements(name, action, seqno, cmds)\n Array(value).each do |options|\n cmds << \"set #{options}\"\n end\n configure(cmds)\n end", "def init_route_tables\n @@client.describe_route_tables.route_tables\n end", "def routes\n { :static => @route_ids, :dynamic => @dynamic }\n end" ]
[ "0.7528972", "0.7443987", "0.7332855", "0.7247125", "0.72449374", "0.66445696", "0.6467639", "0.6394465", "0.6382144", "0.6319095", "0.626583", "0.623494", "0.623494", "0.623494", "0.623494", "0.623494", "0.623494", "0.623494", "0.623494", "0.623494", "0.623494", "0.623494", "0.623494", "0.623494", "0.61261296", "0.6112801", "0.6100912", "0.6100912", "0.6100912", "0.6067483", "0.60521984", "0.60290766", "0.6013421", "0.5965297", "0.5933807", "0.5917969", "0.58571684", "0.56845766", "0.56845766", "0.567157", "0.56526893", "0.56436753", "0.56436753", "0.56436753", "0.56266546", "0.56092733", "0.56042105", "0.5599787", "0.5556986", "0.5552879", "0.5552879", "0.55454916", "0.552796", "0.5522801", "0.54796803", "0.54745454", "0.54745454", "0.54745454", "0.54729533", "0.5468992", "0.54665285", "0.5443039", "0.54414564", "0.5420837", "0.54104245", "0.54089564", "0.5407985", "0.5407661", "0.53928703", "0.53864986", "0.53783107", "0.53768826", "0.5375871", "0.53738284", "0.53738284", "0.53738284", "0.53738284", "0.53738284", "0.53738284", "0.53738284", "0.53738284", "0.53738284", "0.53738284", "0.53738284", "0.53612536", "0.5335121", "0.53315365", "0.5331308", "0.53305507", "0.53225625", "0.5319978", "0.5319978", "0.5318573", "0.5309226", "0.5286174", "0.52851325", "0.52591103", "0.52470356", "0.5246528", "0.5246248" ]
0.76046884
0
Accepts block to be added to middleware stack.
def middleware(&block) @@middleware << block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rack_app_route_block(block)\n block\n end", "def rack_app_route_block(block)\n block\n end", "def middleware(&block); end", "def add(&block)\n @block_args << block\n end", "def middleware(&block)\n return @middleware ||= [] unless block_given?\n middleware << block\n end", "def add_block block\n block.at self.length\n @blocks << block\n end", "def accept_nonblock(*) end", "def accept_nonblock(*) end", "def accept_nonblock(*) end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def accept_nonblock\r\n end", "def <<(block)\n blocks << block\n end", "def with_block(&block)\n end", "def middleware(&block)\n if block_given?\n self._middleware = block\n end\n end", "def on_block(blk)\n log.debug { \">> block: #{blk.hash} (#{blk.payload.size} bytes)\" }\n @node.queue.push([:block, blk])\n end", "def record_block\n @block = true\n end", "def require_block; end", "def blocks; end", "def blocks; end", "def blocks; end", "def block?; end", "def block_node; end", "def block_node; end", "def pre_block\n end", "def pre_block\n end", "def register_block_for(type, &blk); end", "def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end", "def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end", "def add(name, &block)\n blocks[name.to_sym] = block\n end", "def post_block\n end", "def post_block\n end", "def route(&block)\n @route_block = block\n build_rack_app\n end", "def add(block)\n if valid?(block)\n connect(block)\n consolidate_successors(block)\n else\n queue_unconsolidated(block)\n end\n end", "def blocks() end", "def start_new_block\n if (@block_buffer)\n add_block(@block_buffer)\n @block_buffer = nil\n end\n end", "def before_block_boundary?; end", "def add_callback(&block)\n @blocks << block\n end", "def block\n (@blocks ||= Array.new) << Block.new\n @in_block = @blocks.last\n yield\n @in_block = nil\n end", "def handle(pattern, &block)\n @routes << [pattern, block]\n end", "def block\n true\n end", "def block_valid?(block)\n # ...\n end", "def captured_by_block?; end", "def add_block(article_block)\n self.blocks << article_block\n end", "def allow(&block)\n collect_bucket(&block)\n scope = @_env.nil?? :global : @_env\n if @_bucket.any?\n @_allowed_routes[scope].push(@_bucket).flatten!\n end\n @_bucket = nil\n end", "def captured_by_block; end", "def set_block\n @request = JSON.parse(request.body.read, {:symbolize_names => true})\n @block = Block.find_by(prev_block: @request[:prev_block])\n end", "def i_take_a_block\n yield\nend", "def block_class() Block; end", "def add_block(block)\n return if ilp.has_variable?(block)\n ilp.add_variable(block)\n lhs = block_frequency(block) + [[block, -1]]\n ilp.add_constraint(lhs,\"equal\",0,\"block_#{block.qname}\", :structural)\n end", "def register_accept_listener &block\n @accept_listeners << block unless @accept_listeners.include? block\n block\n end", "def add_block\n @user = User.current\n @user.pref.add_block params[:block]\n @user.pref.save\n redirect_to my_page_layout_path\n end", "def block_checker\n block_given?\nend", "def handle_request( request, &block )\n\t\tif block\n\t\t\treturn block.call( request )\n\t\telse\n\t\t\treturn request.response\n\t\tend\n\tend", "def block(block)\n @components[:__base__] = block\n @load_order << :__base__\n true\n end", "def on_block(node)\n builder = DefinitionBuilder::RubyBlock.new(node, current_scope)\n definition = builder.build\n\n associate_node(node, definition)\n\n push_scope(definition)\n end", "def convert_route_block(block)\n block\n end", "def use(mw, *args, &block)\n middleware << [mw, args, block]\n end", "def add_single_block(block)\n\n\t\tif @decoded[block.blocks[0]].nil? \n\t\t \t@decoded[block.blocks[0]] = block.data \n\t\t\t@num_valid += 1\n\t\tend\n\tend", "def begin_block(name, opts)\n @block_name_stack << name\n @block_opts_stack << opts\n @block_break_type_stack << \"entry-break\"\n end", "def block(user)\n post \"blocks/create/#{user}\"\n end", "def run_block_proc\n yield\nend", "def <<(block)\n # parent assignment pending refactor\n #block.parent = self\n @blocks << block\n end", "def response_block\n create_response_block\n end", "def response_block\n create_response_block\n end", "def add_filter(name, &block)\n raise ArgumentError, \"Expected block to be given\" if block.nil?\n\n @filters[name] = block\n end", "def stack(&block)\n @stack ||= begin\n block_given? ? Faraday::Builder.new(&block) : Faraday::Builder.new(&default_middleware)\n end\n end", "def addSetupBlock( &block ); self.class.addSetupBlock( &block ); end", "def block_example(&block)\n does block\n end", "def use(*args, &block)\n @middleware.insert(@position, [args, block])\n @app.send(:build_rack_app)\n @position += 1\n nil\n end", "def parse_block(*_arg0); end", "def add_multi_block(block)\n\t\t\t@encoded << block\n\tend", "def block\n options.fetch(:block)\n end", "def add_serve(patterns, &block)\n raise ArgumentError, \"WawAccess.add_serve expects a block\" unless block \n patterns.each do |pattern|\n raise WawError, \"Invalid serving pattern #{pattern} (#{pattern.class})\"\\\n unless recognized_pattern?(pattern)\n @serve << [pattern, block]\n end\n end", "def after_request(&block)\n @after_request << block\n end", "def acceptable_when(block)\n @acceptable_when = block\n end", "def run_block\n @_block_content = nil\n unless block.blank?\n @_block_content = if view.parent.present?\n capture(view, &block)\n else\n ## We've been called directly from a controller.\n yield(view)\n end\n end\n end", "def require_block(block_given)\n raise ArgumentError, \"Must provide a block\" unless block_given\n end", "def gimme_your_blocks\n yield if block_given?\nend", "def create_block_object(&block)\n block\nend", "def use ware, *args, &proc\n @middleware << {ware: ware, args: args, block: proc}\n self\n end", "def before_request(&block)\n @before_request = block if block\n @before_request || proc { |a| a }\n end" ]
[ "0.68905556", "0.68905556", "0.67735636", "0.67063475", "0.6648033", "0.6500446", "0.6472763", "0.6472763", "0.6472763", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6385426", "0.6365792", "0.63637924", "0.63393646", "0.6323491", "0.62974465", "0.6270979", "0.62418157", "0.62418157", "0.62418157", "0.62082976", "0.61889064", "0.61889064", "0.61421007", "0.61421007", "0.61404294", "0.61253005", "0.61253005", "0.6121924", "0.61193955", "0.61193955", "0.6108009", "0.60428417", "0.60378635", "0.6029004", "0.6025493", "0.59987074", "0.59765255", "0.59588796", "0.5957217", "0.5941527", "0.59384483", "0.5931908", "0.59312755", "0.59262323", "0.5919521", "0.5905572", "0.58988386", "0.5892716", "0.5887832", "0.5886422", "0.58857125", "0.58523464", "0.58368057", "0.5833992", "0.57931876", "0.57891977", "0.577622", "0.5767131", "0.57660514", "0.5765218", "0.5764741", "0.5755897", "0.5755897", "0.5755808", "0.5748687", "0.57485354", "0.5745923", "0.5742768", "0.57387537", "0.57361484", "0.5712221", "0.5710498", "0.5710256", "0.5707745", "0.5705168", "0.5701663", "0.56770986", "0.5672015", "0.56687397", "0.56659794" ]
0.70431674
0
Fetches a stack (before | after) by name.
def stack(which, name) @@stacks[which][name] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stack(name)\n stacks = (Thread.current[:__moped_threaded_stacks__] ||= {})\n stacks[name] ||= []\n end", "def [](name)\n @stack.each do |layer|\n value = layer[name]\n return value unless value.nil?\n end\n nil\n end", "def fetch(name, default = :__raise)\n @key = name\n\n @stack.each do |frame|\n # Prevent infinite recursion.\n next if frame == self\n @frame = frame\n\n # Is this frame a hash?\n hash = frame.respond_to?(:has_key?)\n\n if hash && frame.has_key?(name)\n return frame[name]\n elsif hash && frame.has_key?(name.to_s)\n @key = name.to_s\n return frame[name.to_s]\n elsif !hash && frame.respond_to?(name)\n @frame = nil\n return frame.__send__(name)\n end\n end\n\n @frame = @key = nil\n\n if default == :__raise || mustache_in_stack.raise_on_context_miss?\n raise ContextMiss.new(\"Can't find #{name} in #{@stack.inspect}\")\n else\n default\n end\n end", "def end(name)\n stack(name).pop\n end", "def take_from_stack\n stack.pop\n end", "def stack\n @stack\n end", "def before(stack_name, &block)\n @@stacks[:before][stack_name.to_sym] << block\n end", "def get_stack(organization, name, opts = {})\n data, _status_code, _headers = get_stack_with_http_info(organization, name, opts)\n return data\n end", "def stack_fetch(pos=-1)\n\n type, tname = stack_type_at(pos)\n\n case type\n\n when TNIL then nil\n\n when TSTRING then\n len = FFI::MemoryPointer.new(:size_t)\n ptr = Lib.lua_tolstring(@pointer, pos, len)\n ptr.read_string(len.read_long)\n\n when TBOOLEAN then (Lib.lua_toboolean(@pointer, pos) == 1)\n when TNUMBER then Lib.lua_tonumber(@pointer, pos)\n\n when TTABLE then Table.new(@pointer)\n # warning : this pops up the item from the stack !\n\n when TFUNCTION then Function.new(@pointer)\n when TTHREAD then Coroutine.new(@pointer)\n\n else tname\n end\n end", "def get_stack_select\n stacks = Deployinator.get_stacks\n output = Array.new\n stacks.each do |s|\n current = stack == s\n output << { \"stack\" => s, \"current\" => current }\n end\n output\n end", "def prev(name = nil)\n elements = page.elements.published.where(Element.arel_table[:position].lt(position))\n elements = elements.named(name) if name.present?\n elements.reorder(\"position DESC\").limit(1).first\n end", "def prev(name = nil)\n elements = self.class.all_siblings(self)\n elements = elements.where(:name => name) if name\n elements.where(\"position < ?\", self.position).order(\"position ASC\").limit(1)\n end", "def interrogate_stack(stack_name, client)\n def get_next_page(client, stack_name, current_items, next_token)\n puts(\"DEBUG: getting stack #{stack_name}\")\n result = client.list_stack_resources({:stack_name=>stack_name,:next_token=>next_token})\n updated_items = current_items.merge(result.stack_resource_summaries.map {|entry| [entry.logical_resource_id, entry.physical_resource_id]}.to_h)\n if result.next_token\n get_next_page(client, stack_name, updated_items, next_token)\n else\n updated_items\n end\n end\n\n get_next_page(client, stack_name, {}, nil)\nend", "def stack?(name)\n list_stacks.map(&:stack_name).include?(name)\n end", "def after(stack_name, &block)\n @@stacks[:after][stack_name.to_sym] << block\n end", "def stack\n return (@stack&.stack || [])\n end", "def stack(name, &block)\n resource = Stack.new\n resource.evaluate &block\n add_resource name, resource\n end", "def find(name)\n current = self\n key = name.to_sym\n while current\n if current.defs.include?(key)\n return current.defs[key]\n end\n current = current.parent\n end\n \n # TODO: use of :name here couples us to Parser too much?\n return symbol_table.fetch(key){symbol_table[:name]}\n end", "def prev(name = nil)\n previous_or_next('<', name)\n end", "def begin(name)\n stack(name).push(true)\n end", "def tree_lookup(name)\n @pairs[name]\n end", "def get_thermostat_by_name(name)\n get_thermostat_list[name]\n end", "def pop()\n @stack.shift\n end", "def pop\n @stack.shift\n end", "def pop\n return @stack.pop\n end", "def find_previous(xml, leaf_name, order)\n order.reduce(nil) do |res, curr_name|\n break res if curr_name == leaf_name\n xml.at(curr_name.include?(':') ? \"./#{curr_name}\" : \"./xmlns:#{curr_name}\") || res\n end\n end", "def fetch_parent(stack, node)\n stack_2 = []\n while !stack.empty?\n potential_parent = stack.pop\n potential_structure_marker = potential_parent.structure_marker.to_s.strip\n if is_parent?(potential_structure_marker, node.indentation, potential_parent.indentation)\n parent = potential_parent\n stack_2.push(parent)\n while !stack_2.empty?\n elem = stack_2.pop\n stack.push(elem)\n end\n return parent\n else\n stack_2.push(potential_parent)\n end\n end\n end", "def fetch_parent(stack, node)\n stack_2 = []\n while !stack.empty?\n potential_parent = stack.pop\n potential_structure_marker = potential_parent.structure_marker.to_s.strip\n if is_parent?(potential_structure_marker, node.indentation, potential_parent.indentation)\n parent = potential_parent\n stack_2.push(parent)\n while !stack_2.empty?\n elem = stack_2.pop\n stack.push(elem)\n end\n return parent\n else\n stack_2.push(potential_parent)\n end\n end\n end", "def stack; end", "def stack; end", "def stack(*args); end", "def peek\n @stack[0]\n end", "def pop\n return @stack.pop\n end", "def top()\n @stack[-1]\n end", "def current\n return @stack[-1]\n end", "def pop\n stack.pop\n end", "def pop\n stack.pop\n end", "def pop()\n\t\t@stack.pop\n\tend", "def top()\n @stack[0]\n end", "def pop\n @stack.pop\n end", "def pop\n @stack.pop\n end", "def stack_pop\n\n r = stack_fetch\n stack_unstack if r.class != Rufus::Lua::Table\n\n r\n end", "def get_global(name)\n\n stack_load_global(name)\n stack_pop\n end", "def top(_tag=nil)\n return @stack.last.obj if _tag.nil?\n @stack.reverse_each do |item|\n return item.obj if item.tag == _tag\n end\n return nil\n end", "def top()\n @stack[-1]\n end", "def pop()\n @stack.pop\n end", "def get_slice(name)\n return @slices[name] \n end", "def [](key)\n stacks[key]\n end", "def retrieve_from_stack\n # Pils::log \"We retrieve the next object from the stack. %i\" % @stack.size\n return nil if @stack.nil? || @stack.empty?\n new_state, *state_rest = @stack\n @stack = state_rest\n @syntax = new_state[0]\n @semantics = new_state[1]\n @syntax_position = new_state[2]\n @token_position = new_state[3]\n sync\n # Pils::log \" becomes %i\" % @stack.size\n # @stack.each do |n|\n # Pils::log \" -- %2i %2i %s\" % [n[2], n[3], n[0].display]\n # end\n end", "def lookup_variable_stack (varname)\n\n get_environment.lookup_variable_stack(varname)\n end", "def stack_top\n self # okay maybe I'll implement this\n end", "def pop()\n stack.stack.pop if !empty?\n end", "def in_klass name\n @class_stack.unshift name\n yield\n @class_stack.shift\n end", "def peek\n @stack2 << @stack1.pop until @stack1.empty?\n ret = @stack2.last\n @stack1 << @stack2.pop until @stack2.empty?\n ret\n end", "def top()\n @stack.last\n end", "def top()\n @stack.last\n end", "def top\n @stack.last\n end", "def __stack\n @stack\n end", "def pop # utility\n @stack.pop\n end", "def swap_stack\n <<-CODE\n t1 = stack_pop();\n t2 = stack_pop();\n stack_push(t1);\n stack_push(t2);\n CODE\n end", "def get_method_stack(fqns, name, scope: T.unsafe(nil)); end", "def next(name = nil)\n previous_or_next('>', name)\n end", "def node_pop( name )\n return name.split(\".\")[1]\n end", "def get_slice(name)\n key = @slices.keys[0]\n return @slices[name]\n end", "def top\n @stack[-1]\n end", "def sort_stack(stack)\n return stack\nend", "def pop()\n @stack.pop\n end", "def pop\n stack.pop\n end", "def top()\n @stack[-1]\n end", "def top()\n @stack.last\n end", "def previous_or_next(dir, name = nil)\n elements = page.elements.published.where(\"#{self.class.table_name}.position #{dir} #{position}\")\n elements = elements.named(name) if name.present?\n elements.reorder(\"position #{dir == '>' ? 'ASC' : 'DESC'}\").limit(1).first\n end", "def get_state(name)\n name = name.to_sym\n (@states.detect { |st| st.name == name }).value\n end", "def current\n @stack.last\n end", "def find_by_name(name)\n self.transitions.find {|t| t.name == name}\n end", "def poll_terminator(name)\n lambda { |x| x.resource_type == 'AWS::CloudFormation::Stack' && x.logical_resource_id == name }\n end", "def list_stacks(app_name, options={})\n deprecate # 07/31/2012\n include_deprecated = options.delete(:include_deprecated) || false\n\n json_decode get(\"/apps/#{app_name}/stack\",\n :params => { :include_deprecated => include_deprecated },\n :accept => 'application/json'\n ).to_s\n end", "def lookup( name, stack )\n return nil unless @words.key?( name )\n fac = @faces[name].dup\n\n while fac.size > 1\n fac = fac.select{ |f| stack[i].class <= f[-i] }\n i += 1\n end\n\n if fac[0]\n hit = @words[name][fac[0]]\n elsif @faces[name].key?([])\n hit = @words[name][[]]\n end\n\n return hit\n end", "def stack(url, &block)\n resolve(url).stack(&block)\n end", "def get_stacks\n provider.stacks.all.map do |stack|\n Smash.new(stack.attributes)\n end.sort do |x, y|\n if y[:created].to_s.empty?\n -1\n elsif x[:created].to_s.empty?\n 1\n else\n Time.parse(x[:created].to_s) <=> Time.parse(y[:created].to_s)\n end\n end\n end", "def last_popped_stack_elem\n @stack[@sp]\n end", "def delete_stack(name)\n response = request('Action' => 'DeleteStack', 'StackName' => name)\n rid = response.xpath('//aws:DeleteStackResponse/aws:ResponseMetadata/aws:RequestId', NS).text\n return {:request_id => id}\n end", "def pick #ø\n a = pop\n raise StandardError, \"stack is not that big\" if size <= a\n b = self[-a]\n push a\n push b\n end", "def stack\n @values.fetch('stack') { \n @values['stack'] = nil\n }\n end", "def pop\n self.top = @stack[1]\n @stack.shift\n end", "def find_state_by_name(name)\n find_task_by_name(\"#{name}_state\")\n end", "def peek()\n @stack.peek\n end", "def pop\n raise \"No cursors to pop\" unless @stack.size > 1\n\n @stack.pop\n\n self\n end", "def peek(n = 0)\n stack[(n + 1) * -1]\n end", "def pop()\n @stack.pop \n end", "def stack(name = nil, opts = {})\n if self::StackMiddleware._mwares[name] && mw = self::StackMiddleware._mwares[name]\n unless mw.stack == self\n mw = self::StackMiddleware._mwares[name] = self::StackMiddleware._mwares[name].dup\n end\n mw\n else\n self::StackMiddleware.new(name, self, opts)\n end\n end", "def poplaststat()\n top = @stack.pop()\n if top and top[0] == :break or top[0] == :return then\n return top\n else\n raise \"poplaststat: not found!\"\n end\nend", "def pop\n @stack.shift\n self\n end", "def peek\n if empty?\n nil\n else\n @stack.first\n end\n end", "def top()\n return self.stack[self.stack.length - 1]\n end", "def pop()\n self.min_stack.pop\n return self.stack.pop\n end", "def get_behind(branch_name, commit_sha)\n local_commit = last_commit(remote_branch_from_local(branch_name))\n remote_commit = @rugged_repository.lookup(commit_sha)\n\n @rugged_repository.ahead_behind(remote_commit, local_commit).first\n end", "def __stack\n @stack ||= []\n end", "def current\n if @stack.any?\n @stack[-1]\n elsif @use\n @use\n else\n @list[-1]\n end\n end", "def get(name_)\n case name_\n when ::Integer\n @level_order[name_]\n when Level\n @level_order[name_.value] == name_ ? name_ : nil\n when ::Symbol, ::String\n @level_names[name_.to_sym]\n when nil\n default\n else\n nil\n end\n end", "def cur\n\t\t@stack[-1]\n\tend" ]
[ "0.6649528", "0.59085673", "0.57742584", "0.5726988", "0.5689255", "0.5590191", "0.55600953", "0.5544644", "0.5505837", "0.5425863", "0.53779274", "0.53649753", "0.5347133", "0.5319278", "0.5310055", "0.5294281", "0.5221288", "0.52100426", "0.51855713", "0.51512027", "0.5142453", "0.50980324", "0.50927246", "0.50869197", "0.5061912", "0.5061724", "0.5060244", "0.5060244", "0.4980394", "0.4980394", "0.49801096", "0.49687508", "0.49628505", "0.49550232", "0.4927897", "0.49177194", "0.49177194", "0.49141535", "0.49085107", "0.49045604", "0.49045604", "0.4895063", "0.48920885", "0.4884433", "0.48805714", "0.48804644", "0.48761076", "0.48675838", "0.486635", "0.48638353", "0.48554868", "0.4853474", "0.48503965", "0.48489293", "0.48469827", "0.48469827", "0.48445666", "0.48423117", "0.48397127", "0.48286444", "0.48279625", "0.482793", "0.48181075", "0.48157868", "0.48147", "0.48138058", "0.48120147", "0.48115492", "0.48076367", "0.4791178", "0.47890148", "0.47885504", "0.47844276", "0.4774739", "0.47619963", "0.47618407", "0.4761819", "0.47579652", "0.47536728", "0.47534063", "0.47517908", "0.47495407", "0.47473732", "0.47426584", "0.47345105", "0.47301322", "0.4722659", "0.47192404", "0.47160035", "0.4709897", "0.47056717", "0.47051546", "0.470263", "0.46938658", "0.46924615", "0.46922234", "0.46792743", "0.46717077", "0.46706486", "0.46647024" ]
0.62947977
1
Adds a block to the before stack for `stack_name`.
def before(stack_name, &block) @@stacks[:before][stack_name.to_sym] << block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before(name, options={}, &block)\n self.add_block_container_to_list(\"before_#{name.to_s}\", options, &block)\n nil\n end", "def before &block\n @before_blocks ||= []\n @before_blocks << block if block\n end", "def before(name, &block)\n before_steps[name] ||= EMPTY_ARRAY.dup\n before_steps[name] << Step.new(type: :before, name: name, executor: block)\n self\n end", "def after(stack_name, &block)\n @@stacks[:after][stack_name.to_sym] << block\n end", "def before(name, &block)\n validate_step_name(name)\n before_steps[name] ||= EMPTY_ARRAY.dup\n before_steps[name] << block.to_proc\n self\n end", "def begin_block(name, opts)\n @block_name_stack << name\n @block_opts_stack << opts\n @block_break_type_stack << \"entry-break\"\n end", "def before(&block)\n @before << block\n end", "def render_before_blocks(name_or_container, *args)\n render_before_or_after_blocks(name_or_container, \"before\", *args)\n end", "def before(event, &block)\n triggers[:before][event] << block\n self\n end", "def before_auto_marking(&block)\n @blocks[:before].push block\n end", "def prepend(name, content = nil, &block)\n content = capture(&block) if block_given?\n add_instruction_to_area name, :unshift, content\n end", "def _Gvn_before(&block)\n _Gvn_before_blocks << block\n end", "def pre_block\n end", "def pre_block\n end", "def before(refname)\n yield if block_given?\n call(refname)\n end", "def before(identifier, &block)\n be_callable!(identifier) unless identifier.is_a?(Symbol)\n be_callable!(block)\n synchronize do\n if applied?\n raise Error::ApplyError,\n \"Hooks have already been applied to stack\"\n end\n @before_entries = before_entries +\n [Entry.new(identifier: identifier,\n action: Action.new(stack: stack, callable: block))]\n @before_entries.freeze\n end\n self\n end", "def prepend(name, middleware)\n @stack.unshift Item.new(name, middleware)\n end", "def before(&block)\n block ? @before = block : @before\n end", "def push(block, line_count = -1)\n\t\t@stack[-1].lines << block\n\t\t@stack << block\n\tend", "def prepend(&block)\n be_callable!(block)\n synchronize do\n if applied?\n raise Error::ApplyError,\n \"Hooks have already been applied to stack\"\n end\n @prepend_entries = prepend_entries +\n [Action.new(stack: stack, callable: block)]\n @prepend_entries.freeze\n end\n self\n end", "def begin(name)\n stack(name).push(true)\n end", "def before(str = nil, &blk)\n each { |x| x.parent.insert_before x.make(str, &blk), x }\n end", "def before(&block)\n define_before_or_after_method_with_block(:before, &block)\n end", "def before(&block)\n handle(0, &block)\n end", "def push_block\n \"stack_push(cpu_current_block(state, c));\"\n end", "def before(*args, &block)\n if block_given?\n Thread.current[:before_hook] = block\n else\n Thread.current[:before_hook].call(*args) if Thread.current[:before_hook]\n end\n end", "def stack(name, &block)\n resource = Stack.new\n resource.evaluate &block\n add_resource name, resource\n end", "def before(&block)\n if !block_given? || block.arity != 1\n raise InvalidBlockSpecification, \"before proc should have an arity of 1 (Array: values)\"\n end \n @options[:before] = block\n end", "def before_include( *contexts, & block )\n \n return frame_definer.before_include( *contexts, & block )\n \n end", "def before_each(&block)\n @before_each_blocks << block\n end", "def insert_before(index, *args, **_arg2, &block); end", "def before(node)\n @parent.insert_before(node, self)\n end", "def before(*hooks, &block)\n before_hooks.unshift block if block\n hooks.each { |h| before_hooks.unshift h }\n end", "def pre(&a_proc)\n @@pre_block = a_proc\n end", "def add(name, &block)\n blocks[name.to_sym] = block\n end", "def before(*args, &block)\n add_filter :before, &(args.empty? ? block : construct_filter(*args, &block))\n end", "def before_start(&block)\n @before_start_hooks << block\n end", "def push(block)\n @names[block.name.to_s] ||= []\n @names[block.name.to_s] << block\n end", "def before name, &block\n self.__local_before_command_sets << Task.new(:name => name, :callback => true, &block)\n end", "def before_extend( *contexts, & block )\n \n return frame_definer.before_extend( *contexts, & block )\n \n end", "def before(*args, &block)\n before_callbacks.concat(args)\n before_callbacks << block if block\n end", "def before_fork(&block)\r\n @before_fork = block\r\n end", "def sup_bro\n puts \"This is before a block!\"\n name = \"Katy\"\n yield(name)\n puts \"This is after a block!\"\nend", "def pre_execute(&block)\n @hooks[:pre_execute] = block\n end", "def start_new_block\n if (@block_buffer)\n add_block(@block_buffer)\n @block_buffer = nil\n end\n end", "def add_sticky_local(name, &block)\n config.extra_sticky_locals[name] = block\n end", "def prepend(hash_stack)\n @stack.unshift *hash_stack.stack\n self\n end", "def push_content_node(content_node_name, &block)\n node_data = nil\n if content_data && content_data.key?(content_node_name)\n node_data = content_data[content_node_name]\n else\n node_data = {}\n end\n stack(:__content_node_stack).push(content_node_name)\n stack.push(node_data)\n begin\n yield\n ensure\n pop\n pop(:__content_node_stack)\n end\n end", "def prepend_before(*args, &proc)\n scope, options = scope_and_options(*args)\n example_group = ExampleGroupFactory.get(\n get_type_from_options(options)\n )\n example_group.prepend_before(scope, &proc)\n end", "def before_block_boundary?; end", "def add_block name, hash\n\t\t\t@blocks ||= {}\n\t\t\t@blocks[name] = hash\n\t\tend", "def before(identifier, &block)\n Chef::Sugar::Filters::Injector.new(self, identifier, :before).evaluate(&block)\n end", "def Before(*tag_expressions, name: nil, &proc)\n Dsl.register_rb_hook('before', tag_expressions, proc, name: name)\n end", "def before_intercept(&block)\n @before_intercept = block if block_given?\n \n self\n end", "def new_stack_frame( include_or_extend, *modules, & block )\n\n frame = ::Module::Cluster::Cluster::Frame.new( @cluster.instance,\n @cluster.name,\n @execution_contexts ? @execution_contexts.keys.sort : nil,\n @cascade_contexts ? @cascade_contexts.keys.sort : nil,\n modules,\n include_or_extend,\n block )\n \n instance_controller = @cluster.instance_controller\n\n @hook_contexts.each do |this_hook_context, true_value|\n instance_controller.stack( this_hook_context ).insert_before_and_after( @before_modules, \n @after_modules, \n frame )\n end\n \n return frame\n \n end", "def before(selector, &block)\n add_pointcut BeforePointcut.new(selector, &block)\n end", "def before(*command, &block)\n command.flatten!\n blk = block\n\n if command.last.is_a?(Hash)\n if block_given?\n extra_cfg = command.pop\n else\n # We were given a hash rather than a block,\n # so the last element should be the \"config block\"\n # and the rest are commands for the trigger\n blk = command.pop\n end\n elsif !block_given?\n raise Vagrant::Errors::TriggersNoBlockGiven,\n command: command\n end\n\n command.each do |cmd|\n trigger = create_trigger(cmd, blk, extra_cfg)\n @_before_triggers << trigger\n end\n end", "def child_pre_trace\n old_child_pre_trace = @child_pre_trace\n @child_pre_trace = proc {\n yield\n old_child_pre_trace.call if old_child_pre_trace\n }\n end", "def push_current_content(node, &block)\n stack.push(node)\n begin\n yield\n ensure\n pop\n end\n end", "def block_name_declaration(block_name)\n buff_code \"#{block_name} = __blocks.delete('#{block_name}') { __create_block('#{block_name}') }\"\n end", "def before(klass, meth_name, &block)\n intercept(klass, meth_name, :before, &block)\n end", "def before(&block)\n rules.add('@document:before', Sawtooth::Rules::CallRule.new(:start => block)) if block_given?\n end", "def before_subshell(&block)\n @before_subshell_block = block\n end", "def prepend_before(*args, &proc)\n add_callback(:prepend_before, *args, &proc)\n end", "def pre(name, &block)\n self.pres << item_class.new.tap do |item|\n item.name = name\n block.call(item)\n end\n end", "def before(type=:each, &block)\n raise ArgumentError, \"invalid before-type #{type}\" unless [:each, :all].include?(type)\n type_method = \"before_#{type}\"\n remove_method(type_method) rescue nil #if method_defined?(type_method)\n define_method(type_method, &block)\n end", "def before_suite(&block)\n @before_suite_blocks << block\n end", "def starts_block(block_state)\n @block_state = block_state\n @block_indentation = @last_indentation || ''\n puts \" starts_block #{block_state.inspect}\" if @debug\n puts \" block_indentation: #{@block_indentation.inspect}\" if @debug\n end", "def append_before(*args, &proc)\n scope, options = scope_and_options(*args)\n example_group = ExampleGroupFactory.get(\n get_type_from_options(options)\n )\n example_group.append_before(scope, &proc)\n end", "def add_before(node)\n raise \"Can't add #{self} before a node with no parent\" if node.parent.nil?\n raise \"#{node.parent.class} cannot contain nodes of type #{self.class}\" unless node.parent.can_contain?(self.class)\n raise \"Can't add an node before itself\" if node == self\n raise \"#{self} cannot be its own ancestor\" if node.ancestors.include? self\n\n @__parent__.remove(self) if @__parent__\n @__parent__ = node.parent\n @__parent__.first_child = self if @__parent__.first_child == node\n @__next__ = node\n @__prev__ = node.prev\n node.prev = self\n @__prev__.next = self if @__prev__\n end", "def starts_block(block_state)\n @block_state = block_state\n @block_indentation = @last_indentation || ''\n puts \" starts_block: #{block_state.inspect}\" if @debug\n puts \" block_indentation: #{@block_indentation.inspect}\" if @debug\n end", "def prepended(base = nil, &block)\n if base.nil?\n if instance_variable_defined?(:@_prepended_block)\n if @_prepended_block.source_location != block.source_location\n raise MultiplePrependBlocks\n end\n else\n @_prepended_block = block\n end\n else\n super\n end\n end", "def named_scope_begin(&block)\n lang_eval { @named_scope_begin_block = block }\n nil\n end", "def before_include_or_extend( *contexts, & block )\n\n return frame_definer.before_include_or_extend( *contexts, & block )\n\n end", "def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end", "def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end", "def add_tag(name, &block)\n @custom_tags[name.to_sym] = block\n end", "def add_hook(name, &block)\n hooks[name.to_sym] ||= []\n hooks[name.to_sym] << block\n end", "def start_new_block_element(attrs)\n @current_block = {\n formatting_spans: [],\n paragraph_classes: [],\n }.merge(attrs)\n @block_elements << @current_block\n end", "def before_run(&block)\n @before_run_block = block\n end", "def addSetupBlock( &block ); self.class.addSetupBlock( &block ); end", "def pre(name, &commands)\n @commands_to_run = []\n commands.call\n @to_perform << Hook.new({\n :type => :pre,\n :name => name,\n :commands => commands_to_run\n })\n end", "def add_boundary_stacks(ex, ruby_skip=0)\n if ex.instance_variable_defined?(:@spidermonkey_boundary_stacks)\n list = ex.instance_variable_get(:@spidermonkey_boundary_stacks)\n else\n list = ex.instance_variable_set(:@spidermonkey_boundary_stacks, [])\n end\n\n list << [:js, self.current_stack]\n list << [:ruby, caller(ruby_skip + 1)]\n\n rescue Object\n end", "def before *a, &b; valid_in_context Event; define_hook :before, *a, &b; end", "def in_class(name)\n @class_stack.unshift(name)\n yield\n @class_stack.shift\n end", "def before(&b)\n filter :before, &b\n end", "def extend_and_include( *modules, & block )\n \n return new_stack_frame( :extend_and_include, *modules, & block )\n \n end", "def add_block block\n block.at self.length\n @blocks << block\n end", "def before_enqueue(method_name = nil, &block)\n Karafka.logger.debug(\"Defining before_enqueue filter with #{block}\")\n set_callback :call, :before, method_name ? method_name : block\n end", "def autobefore(name = nil, &block)\n # Not needed to describe the type\n nil\n end", "def include_and_extend( *modules, & block )\n \n return new_stack_frame( :include_and_extend, *modules, & block )\n \n end", "def before_instance( & block )\n \n return frame_definer.before_instance( & block )\n \n end", "def insert_before(idx: nil, callable: nil, &block)\n insert(idx: idx, callable: callable, adjust: 1, &block)\n end", "def stack(name)\n stacks = (Thread.current[:__moped_threaded_stacks__] ||= {})\n stacks[name] ||= []\n end", "def add_before(filename, matching_text, data=nil, &block)\n gsub_file filename, /^(\\s*#{Regexp.escape(matching_text)})/mi do |match|\n \"#{data || block.call}#{match}\"\n end\n end", "def extend_block(name, value = nil, &block)\n value = self._template.context.capture(&block) if value.nil? && block\n self._template.blocks[name] += value\n return self._template.blocks[name]\n end", "def add(template_name)\n @stack << Item.new(template_name, true)\n\n begin\n result = yield\n return [result, cacheable?]\n ensure\n @stack.pop\n end\n end", "def insert_block\n BasicBlock.from_ptr(C.get_insert_block(self))\n end", "def insert_component_before(name, component)\n # iterate over all components, find the component with the given name\n # once found, insert the given component at that location and return\n components.each_with_index do |c, i|\n if c.name == name\n components.insert(i, component)\n return\n end\n end\n\n components << component\n end", "def include( *modules, & block )\n\n new_stack_frame( :include, *modules, & block )\n \n return self\n \n end" ]
[ "0.7453471", "0.67468995", "0.66664416", "0.66487736", "0.66173166", "0.65138286", "0.64530176", "0.63607913", "0.63262993", "0.6308333", "0.62687606", "0.619812", "0.61878437", "0.61878437", "0.61377215", "0.6104828", "0.6081546", "0.60406375", "0.6037799", "0.60254437", "0.59336275", "0.5883205", "0.5869087", "0.5839095", "0.5834847", "0.5823487", "0.5800767", "0.5796284", "0.57503927", "0.5748068", "0.57248306", "0.56747574", "0.56707436", "0.56291485", "0.56280655", "0.5622314", "0.5615691", "0.55753523", "0.5567209", "0.5557089", "0.5537815", "0.55315095", "0.55307144", "0.5528869", "0.55031276", "0.5462046", "0.5455393", "0.5442858", "0.5442024", "0.54273593", "0.5395573", "0.53944373", "0.53800595", "0.5375217", "0.53730017", "0.53605103", "0.53468275", "0.5341531", "0.532447", "0.5312037", "0.5310105", "0.5302959", "0.5298674", "0.5295044", "0.52819955", "0.5280707", "0.5274251", "0.5263442", "0.52576727", "0.5256144", "0.52516407", "0.52440614", "0.5230394", "0.523002", "0.5228179", "0.5228179", "0.5226553", "0.5226415", "0.52238667", "0.52223146", "0.5209087", "0.5207629", "0.5202599", "0.5199604", "0.51837534", "0.5181538", "0.51813644", "0.516628", "0.51550686", "0.5148167", "0.5146478", "0.5140908", "0.5140375", "0.513942", "0.5136336", "0.51220506", "0.509183", "0.5086594", "0.50812614", "0.50730026" ]
0.9117473
0
Adds a block to the after stack for `stack_name`.
def after(stack_name, &block) @@stacks[:after][stack_name.to_sym] << block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after(name, options={}, &block)\n self.add_block_container_to_list(\"after_#{name.to_s}\", options, &block)\n nil\n end", "def after(&block)\n @blocks << block\n end", "def before(stack_name, &block)\n @@stacks[:before][stack_name.to_sym] << block\n end", "def after(name, &block)\n validate_step_name(name)\n after_steps[name] ||= EMPTY_ARRAY.dup\n after_steps[name] << block.to_proc\n self\n end", "def after(name, &block)\n after_steps[name] ||= EMPTY_ARRAY.dup\n after_steps[name] << Step.new(type: :after, name: name, executor: block)\n self\n end", "def push(block, line_count = -1)\n\t\t@stack[-1].lines << block\n\t\t@stack << block\n\tend", "def after(&block)\n @after << block\n end", "def render_after_blocks(name_or_container, *args)\n render_before_or_after_blocks(name_or_container, \"after\", *args)\n end", "def add(name, &block)\n blocks[name.to_sym] = block\n end", "def append(name, content = nil, &block)\n content = capture(&block) if block_given?\n add_instruction_to_area name, :push, content\n end", "def push(block)\n @names[block.name.to_s] ||= []\n @names[block.name.to_s] << block\n end", "def begin_block(name, opts)\n @block_name_stack << name\n @block_opts_stack << opts\n @block_break_type_stack << \"entry-break\"\n end", "def add_block block\n block.at self.length\n @blocks << block\n end", "def after_block_boundary?; end", "def stack(name, &block)\n resource = Stack.new\n resource.evaluate &block\n add_resource name, resource\n end", "def after(&block)\n block ? @after = block : @after\n end", "def after(&block)\n block ? @after = block : @after\n end", "def after(&block)\n block ? @after = block : @after\n end", "def after(&block)\n block ? @after = block : @after\n end", "def around(name, options={}, &block)\n self.add_block_container_to_list(\"around_#{name.to_s}\", options, &block)\n nil\n end", "def after(str = nil, &blk)\n each { |x| x.parent.insert_after x.make(str, &blk), x }\n end", "def after(&block)\n block ? @after = block : @after\n end", "def after(&block)\n block ? @after = block : @after\n end", "def after(event, &block)\n triggers[:after][event] << block\n self\n end", "def block_name_declaration(block_name)\n buff_code \"#{block_name} = __blocks.delete('#{block_name}') { __create_block('#{block_name}') }\"\n end", "def after name, &block\n self.__local_after_command_sets << Task.new(:name => name, :callback => true, &block)\n end", "def sup_bro\n puts \"This is before a block!\"\n name = \"Katy\"\n yield(name)\n puts \"This is after a block!\"\nend", "def extend_block(name, value = nil, &block)\n value = self._template.context.capture(&block) if value.nil? && block\n self._template.blocks[name] += value\n return self._template.blocks[name]\n end", "def after(identifier, &block)\n be_callable!(identifier) unless identifier.is_a?(Symbol)\n be_callable!(block)\n synchronize do\n if applied?\n raise Error::ApplyError,\n \"Hooks have already been applied to stack\"\n end\n @after_entries = after_entries +\n [Entry.new(identifier: identifier,\n action: Action.new(stack: stack, callable: block))]\n @after_entries.freeze\n end\n self\n end", "def after(&block)\n define_before_or_after_method_with_block(:after, &block)\n end", "def after(&block)\n if block_given?\n @temp_block = block\n end\n self\n end", "def append(name = \"\")\n BasicBlock.create(@fun, name)\n end", "def add_block name, hash\n\t\t\t@blocks ||= {}\n\t\t\t@blocks[name] = hash\n\t\tend", "def add_block_callback(hook_name, handle, block)\n case block.arity\n when -1, 0\n fetch_or_create_hooks[hook_name].add_internal_callback(handle, &block)\n else\n add_external_callback(hook_name, handle, block)\n end\n end", "def finish_after_block( event_marker=nil, &block )\n\t\tblock.call( self )\n\trescue Exception => err\n\t\tself.add( err )\n\t\traise\n\tensure\n\t\tself.finish( event_marker )\n\tend", "def after(&block)\n if !block_given? || block.arity != 1\n raise InvalidBlockSpecification, \"after proc should have an arity of 1 (~ActiveRecord: record)\"\n end \n @options[:after] = block\n end", "def push_content_node(content_node_name, &block)\n node_data = nil\n if content_data && content_data.key?(content_node_name)\n node_data = content_data[content_node_name]\n else\n node_data = {}\n end\n stack(:__content_node_stack).push(content_node_name)\n stack.push(node_data)\n begin\n yield\n ensure\n pop\n pop(:__content_node_stack)\n end\n end", "def add_block_callback(hook_name, handle, block)\n case block.arity\n when -1, 0\n hooks[hook_name].add_internal_callback(handle, &block)\n else\n add_external_callback(hook_name, handle, block)\n end\n end", "def post_block\n end", "def post_block\n end", "def after(node)\n @parent.insert_after(node, self)\n end", "def push(node, &block)\n stack.push(node)\n begin\n yield\n ensure\n pop\n end\n end", "def after_each(&block)\n @after_each_blocks << block\n end", "def push_current_content(node, &block)\n stack.push(node)\n begin\n yield\n ensure\n pop\n end\n end", "def end(name)\n stack(name).pop\n end", "def after_crawl(&block)\n @after_crawl_blocks << block\n self\n end", "def after_crawl(&block)\n @after_crawl_blocks << block\n self\n end", "def _close_open_block_commands\n return unless @stack.size > 1\n until @stack.size == 1\n sub = @stack.pop\n @stack.last << sub\n end\n end", "def after(&block)\n handle(1, &block)\n end", "def add(&block)\n @block_args << block\n end", "def go_back_after(&block)\n @page_stack ? @page_stack.push(current_path) : @page_stack = [current_path]\n yield(block)\n visit(@page_stack.pop)\n end", "def block_definition(block_node)\n buff_code \"__blocks['#{block_node.name}'] = __create_block('#{block_node.name}', #{location_node(block_node)}) do\"\n\n code_indent do\n visit_node_children(block_node)\n end\n\n buff_code 'end'\n end", "def named_scope_end(&block)\n lang_eval { @named_scope_end_block = block }\n nil\n end", "def add_block(block)\n return if ilp.has_variable?(block)\n ilp.add_variable(block)\n lhs = block_frequency(block) + [[block, -1]]\n ilp.add_constraint(lhs,\"equal\",0,\"block_#{block.qname}\", :structural)\n end", "def add(name, &block)\n new_node = self.children.create!(:name => name.to_s)\n yield(new_node) if block_given?\n end", "def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end", "def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end", "def on_block(node)\n builder = DefinitionBuilder::RubyBlock.new(node, current_scope)\n definition = builder.build\n\n associate_node(node, definition)\n\n push_scope(definition)\n end", "def after(refname)\n result = call(refname)\n yield if block_given?\n result\n end", "def process_block_token(tk)\n if balances?(tk)\n @statement << tk\n @state = :first_statement\n process_statement_end(tk)\n elsif @block_num > 1 || (@block.empty? && [TkSPACE, TkNL].include?(tk.class))\n @statement << tk\n else\n if @block.empty?\n @statement << TkBlockContents.new(tk.line_no, tk.char_no)\n end\n @block << tk\n end\n end", "def push_block\n \"stack_push(cpu_current_block(state, c));\"\n end", "def after_extend( *contexts, & block )\n\n return frame_definer.after_extend( *contexts, & block )\n\n end", "def addSetupBlock( &block ); self.class.addSetupBlock( &block ); end", "def prepend(name, content = nil, &block)\n content = capture(&block) if block_given?\n add_instruction_to_area name, :unshift, content\n end", "def block(name, &block)\n klass = SuperbTextConstructor.block(name, &block)\n @blocks << klass\n klass\n end", "def replace(name, options={}, &block)\n blocks[name] = nil\n self.define_block_container(name, options, &block)\n nil\n end", "def add_tag(name, &block)\n @custom_tags[name.to_sym] = block\n end", "def add_hook(name, &block)\n hooks[name.to_sym] ||= []\n hooks[name.to_sym] << block\n end", "def append_or_replace(block_name, src)\n if (block_name < 0 || block_name > name_max)\n raise ArgumentError,\"write to nonexistent block #{block_name}; only #{name_max} in file\"\n end\n\n if block_name == name_max\n write_hdr(HDR_MAXINDEX_, block_name+1)\n end\n\n write(block_name, src)\n end", "def add_name(line, name, after: nil)\n if after\n replace_name(line, after, \"#{after} #{name}\")\n else\n return if line !~ /^([^\\s]+)(\\s+)/\n\n i = $~.end(2)\n \"#{$1}#{$2}#{name} #{line[i..-1]}\"\n end\n end", "def add_name(line, name, after: nil)\n if after\n replace_name(line, after, \"#{after} #{name}\")\n else\n return if line !~ /^([^\\s]+)(\\s+)/\n\n i = $~.end(2)\n \"#{$1}#{$2}#{name} #{line[i..-1]}\"\n end\n end", "def after_configure(&block)\n @after_configure_blocks ||= []\n @after_configure_blocks << block\n end", "def after_request(&block)\n @after_request << block\n end", "def addTeardownBlock( &block ); self.class.addTeardownBlock( &block ); end", "def after_instance( & block )\n\n return frame_definer.after_instance( & block )\n\n end", "def agregarBLoqueYSym(name,block)\n #Agrega un par de selector y su respectivo bloque a un lista\n par = name,block\n listaDeBloquesYSelector.push(par)\n end", "def on_block(blk)\n log.debug { \">> block: #{blk.hash} (#{blk.payload.size} bytes)\" }\n @node.queue.push([:block, blk])\n end", "def add_callback(&block)\n @blocks << block\n end", "def after_subshell(&block)\n @after_subshell_block = block\n end", "def close_stack indent_level\r\n while @token_stack.size > 0 and @token_stack[-1].indent_level >= indent_level\r\n if @token_stack.size > 1 # if this is not the last token, add to parents\r\n @token_stack[-2].add_block_code self.convert(@token_stack[-1])\r\n else # this is the last token in the stack\r\n dump self.convert(@token_stack[-1])\r\n end\r\n @token_stack.pop\r\n end\r\n end", "def add(name, &block)\n define_method(name.to_sym) { yield block }\n end", "def amqp_after(scope = :each, &block)\n raise ArgumentError, \"amqp_after only supports :each scope\" unless :each == scope\n evented_spec_hooks_for(:amqp_after).unshift block\n end", "def add_block(article_block)\n self.blocks << article_block\n end", "def send_stack_with_block\n <<-CODE\n next_literal_into(msg.send_site);\n msg.recv = stack_pop();\n msg.block = stack_pop();\n next_int_into(msg.args);\n\n goto perform_send;\n CODE\n end", "def add_block(new_block, blockchain)\n blockchain.push(new_block) if valid_new_block?(new_block, latest_block(blockchain))\n end", "def before(name, options={}, &block)\n self.add_block_container_to_list(\"before_#{name.to_s}\", options, &block)\n nil\n end", "def action( & block )\n \n return new_stack_frame( nil, & block )\n \n end", "def stack(url, &block)\n resolve(url).stack(&block)\n end", "def after?(prev_block)\n (index - prev_block.index) == 1 && prev_block.time <= time && prev_block.hash == prev_hash\n end", "def define_end_capture(key, name = nil, block = nil)\n capture_node = TmGrammar::Capture.new(grammar, name, block).evaluate\n node.add_end_capture(key, capture_node)\n end", "def after(*args, &block)\n after_callbacks.concat(args)\n after_callbacks << block if block\n end", "def after_bundle(&block)\n @after_bundle_callbacks << block\n end", "def start_new_block\n if (@block_buffer)\n add_block(@block_buffer)\n @block_buffer = nil\n end\n end", "def add(template_name)\n @stack << Item.new(template_name, true)\n\n begin\n result = yield\n return [result, cacheable?]\n ensure\n @stack.pop\n end\n end", "def with_stack(kd_el, xml_node, &block)\n @stack.push([kd_el, xml_node])\n @tree = kd_el\n yield\n ensure\n @stack.pop\n @tree = @stack.last.first rescue nil\n end", "def render_before_or_after_blocks(name_or_container, before_or_after, *args)\n options = args.extract_options!\n\n block_options = {}\n if (name_or_container.is_a?(Blocks::Container))\n name = name_or_container.name.to_sym\n block_options = name_or_container.options\n else\n name = name_or_container.to_sym\n block_options = blocks[name].options if blocks[name]\n end\n\n before_name = \"#{before_or_after}_#{name.to_s}\".to_sym\n buffer = ActiveSupport::SafeBuffer.new\n\n blocks[before_name].each do |block_container|\n args_clone = args.clone\n args_clone.push(global_options.merge(block_options).merge(block_container.options).merge(options))\n buffer << view.capture(*(args_clone[0, block_container.block.arity]), &block_container.block)\n end if blocks[before_name].present?\n\n buffer\n end", "def set_block_break_type(type)\n @block_break_type_stack[@block_break_type_stack.size-1] = type\n end", "def begin(name)\n stack(name).push(true)\n end", "def coolio_after(scope = :each, &block)\n raise ArgumentError, \"coolio_after only supports :each scope\" unless :each == scope\n evented_spec_hooks_for(:coolio_after).unshift block\n end", "def append_after(*args, &proc)\n scope, options = scope_and_options(*args)\n example_group = ExampleGroupFactory.get(\n get_type_from_options(options)\n )\n example_group.append_after(scope, &proc)\n end" ]
[ "0.72503245", "0.6692351", "0.6390935", "0.63804823", "0.6378832", "0.62972414", "0.6200467", "0.61942023", "0.607257", "0.6029528", "0.5977615", "0.5859684", "0.5855761", "0.5827147", "0.5816143", "0.57655495", "0.57655495", "0.57655495", "0.57655495", "0.5713373", "0.5709095", "0.5697501", "0.5697501", "0.5677568", "0.56531346", "0.5639427", "0.56100124", "0.5602994", "0.5595423", "0.55841726", "0.5568085", "0.55605125", "0.552888", "0.5507299", "0.54880065", "0.5479441", "0.5470024", "0.54698336", "0.54493153", "0.54493153", "0.5437326", "0.54315066", "0.5431283", "0.54129833", "0.5409359", "0.5402115", "0.5402115", "0.53999287", "0.53990763", "0.5389969", "0.5370979", "0.5346251", "0.53182113", "0.53147316", "0.5313318", "0.52736723", "0.52736723", "0.5262308", "0.5257386", "0.5255563", "0.52218664", "0.51953673", "0.51848084", "0.5180363", "0.51780224", "0.5176746", "0.51578546", "0.5150776", "0.5148636", "0.51242507", "0.51242507", "0.5120499", "0.5114024", "0.5112509", "0.5102638", "0.5097913", "0.5063531", "0.5049792", "0.5046305", "0.5043916", "0.50383264", "0.5026318", "0.5025908", "0.5017593", "0.5009423", "0.500762", "0.49989226", "0.49827948", "0.4975624", "0.49737033", "0.49686977", "0.4959338", "0.49453577", "0.4932876", "0.49317974", "0.4928079", "0.49270543", "0.49192336", "0.49187157", "0.49150446" ]
0.88214636
0
Returns true if the application is running.
def running? @running end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running?\n @applications.each { |a| return true if a.running? }\n return false\n end", "def is_running?\n return @running\n end", "def isRunning\n return running?\n end", "def is_running?\n return @running\n end", "def running?\n pid = `ps x -o pid,command|grep [K]EWatcher|awk '{print $1}'`.to_i\n pid == 0 ? false : pid\n end", "def running?\n @pid.exist? and Pid.running? @pid.pid\n end", "def running?\n @running.true?\n end", "def running?\n !!@pid\n end", "def running?\n self.status == STATUS_RUNNING\n end", "def running?\n pidfile.running?\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def is_running?\n # TODO: cache this maybe?\n fetch_is_running?\n end", "def running?\n @server && !(@server.stopped?)\n end", "def is_running?\n @running\n end", "def present_and_running?\n return active_instance_dir_exists? && running?\n end", "def running?\n status.running? && !starting?\n end", "def is_running?\n result = \"\"\n result = `ps -p #{pid} -o cmd=`.gsub(\"\\n\", \"\") unless pid.empty?\n\n result.split.first == \"unicorn\" ? true : false\n end", "def is_running?\n result = \"\"\n result = `ps -p #{pid} -o cmd=`.gsub(\"\\n\", \"\") unless pid.empty?\n\n running = result.split.first == \"redis-server\" ? true : false\n\n running\n end", "def running?\n 'Running' == self.status\n end", "def running?\n @is_running\n end", "def running?\n !pid.nil? && status == 'running'\n end", "def running?\n begin\n ping\n rescue Errno::EBADF, Errno::ECONNREFUSED => e\n return false\n end\n return true\n end", "def running?\n @run\n end", "def running?\n # First check if we have a pid file and if it exists\n return false if @pid_file.nil? || !File.exists?(@pid_file)\n\n # Then make sure we have a pid\n return false if pid.nil?\n\n # If we can get the process id then we assume it is running\n begin\n Process.getpgid(pid)\n true\n rescue Errno::ESRCH\n false\n end\n end", "def running?\n status == 'running'\n end", "def running?\n runtime_state?(peek_current_state)\n end", "def running?\n status == :running\n end", "def running?\n return @running\n end", "def running?\n @thread and @thread.alive?\n end", "def running?\n !(@server.nil? || @server.closed?)\n end", "def running?\n @server_thread && @server_thread.alive?\n end", "def instruments_app_running?\n ps_output = `ps x -o pid,comm | grep Instruments.app | grep -v grep`.strip\n if ps_output[/Instruments\\.app/, 0]\n true\n else\n false\n end\n end", "def running?\n spawned? and !@status and alive?\n end", "def running?\n !running.empty?\n end", "def running?\n @db && @db.running?\n end", "def running?\n\t\treturn false if @pid.nil?\n\n\t\tif (Process.kill 0, @pid) == 1\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\t\tend\n\trescue Errno::ESRCH\n\t\treturn false\n\tend", "def running?\n (state == :running)\n end", "def running?\n\t\tis_a_window = (@main_window == 0) ? \n\t\t\tfalse : (is_window(@main_window.handle) != 0)\n\t\t\n\t\t@log.debug(\"Main window: #{@main_window.handle}, is a window: #{is_a_window}\")\n\t\tis_a_window\n\tend", "def run?\n @run ||= true\n @run and !@running and app_file? and $0.expand_path == app_file.expand_path\n end", "def running?\n execpipe(\"#{command(:instance_manager)} status\") do |out|\n out.each_line do |line|\n if line =~ /^#{@resource[:name]}\\s+\\d+/\n return true\n end\n end\n end\n return false\n end", "def sim_is_running?\n not sim_pid.nil?\n end", "def started?\n status['Running']\n end", "def running?\n @running && !@stopping\n end", "def running?\n ! (shuttingdown? || shutdown?)\n end", "def running?\n\t\t\t@status == :running\n\t\tend", "def running?\n !(status =~ /running/).nil?\n end", "def running?\n !(status =~ /running/).nil?\n end", "def running?\n !(status =~ /running/).nil?\n end", "def _process_running?\n return _pid == _pid_file_pid\n end", "def running?\n if @pid\n running = true\n begin\n # Process.kill does not work when the game has crashed (the process is still detected as zombie)\n # running = Process.kill(0, @pid) == 1\n tasklist_stdout = `tasklist | find \"#{running_exe}\"`.strip\n running = !tasklist_stdout.empty?\n # log \"[ Game #{name} ] - Tasklist returned no #{running_exe}:\\n#{tasklist_stdout}\" unless running\n rescue Errno::ESRCH\n log \"[ Game #{name} ] - Got error while waiting for #{running_exe} PID #{@pid}: #{$ERROR_INFO}\"\n running = false\n end\n @pid = nil unless running\n running\n else\n false\n end\n end", "def running?\n !@manager_thread.nil? &&\n ['sleep', 'run'].include?(@manager_thread.status)\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def running?\n if File.exist?(\"#{@server_root}/httpd.pid\")\n pid = File.read(\"#{@server_root}/httpd.pid\").strip\n begin\n Process.kill(0, pid.to_i)\n return true\n rescue Errno::ESRCH\n return false\n rescue SystemCallError\n return true\n end\n else\n return false\n end\n end", "def running?\n @state == :started\n end", "def running?\n if get_pid\n begin\n Process.kill(0, get_pid)\n rescue Exception\n return false\n end\n end\n\n false\nend", "def app_starting?\n @launching\n end", "def running?\n return false if state.nil?\n \"running\".casecmp(state).zero?\n end", "def running?\n EM.reactor_running?\n end", "def is_running?\n omnibus_helper = OmnibusHelper.new(node)\n omnibus_helper.service_up?(service_name) || (delegated? && omnibus_helper.service_up?(delegate_service_name) && is_ready?)\n end", "def running?\n self.reload\n self.virtual_machine_state == \"RUNNING\"\n end", "def running?()\n # If we don't have a PID, it's probably not running. Start it!\n start_mplayer unless @pid\n\n # Non-blocking wait on the child process.\n # Should be cross-platform compatible\n begin\n return true if Process.wait(@pid, Process::WNOHANG).nil?\n rescue Exception\n # something must have killed it, start it again!\n start_mplayer()\n end\n end", "def running?\n result = true\n SERVICES.each do |_, check|\n result &&= check.call\n end\n result\n end", "def running?\n return false if pid == 0\n begin\n Process.getpgid(pid)\n true\n rescue Errno::ESRCH\n false\n end\n end", "def running?\n started? && !finished?\n end", "def running?\n started? && !dead?\n end", "def running?(_under = nil)\n return false if info.nil?\n info[:running]\n end", "def server_running?\n if File.exist? pid_path\n pid = read_pid\n begin\n Process.kill(0, pid)\n rescue Errno::ESRCH\n return false\n end\n else\n false\n end\n end", "def server_running?\n if File.exist? pid_path\n pid = read_pid\n begin\n Process.kill(0, pid)\n rescue Errno::ESRCH\n return false\n end\n else\n false\n end\n end", "def running?\n res = shell_out('ps -A -c -o command | grep ^Fantastical\\ 2$ || true')\n res.stdout.strip.empty? ? false : true\n end", "def alive?\n return false unless self.pid && (self.pid == Process.pid)\n\n self.class.process_exists?(self.pid)\n end", "def check_running_state\n if running?\n if prompt.yes?(\"Your app is running based on PID files (#{pids_files.join(', ')}). Do you want continue?\", default: false)\n logger.warn(\"App is running (pids: #{pids_files.join(', ')}). Ignore it and continue.\")\n else\n error('App is running')\n end\n end\n end", "def alive?\n return false unless pid && (pid == Process.pid)\n\n self.class.process_exists?(pid)\n end", "def is_started?\n\t\treturn self.pid ? true : false\n\tend", "def running?\n @state == :running\n end", "def is_running?\n Faraday.get(@base_url + \"/\").status == 200\n end", "def running?\n is_running = false\n \n if container.nil?\n begin\n self.container = ::Docker::Container.get(name)\n rescue \n self.container = nil\n end\n end\n \n unless container.nil?\n is_running = container.is_running?\n end\n \n is_running\n end", "def running?\n @mutex.synchronize { @task_running }\n end", "def started?\n !!@pid\n end", "def is_felix_running?(params) \n Felixwrapper.configure(params)\n pid = Felixwrapper.instance.pid\n return false unless pid\n true\n end", "def active?\n @listener.running?\n end", "def run?\n return false unless @process\n return true\n end", "def check_running?(pid_file)\n return false unless File.file?(pid_file)\n is_running?(pid_in(pid_file))\n end", "def has_current_application?\n not self.current_application.nil?\n end", "def running?\n # Permissions are handled by the script, use: :sudo => false\n run_script! :status, :sudo => false\n true\n\n rescue CmdError => e\n return false if e.exit_code == Daemon::STATUS_DOWN_CODE\n raise e\n end", "def running_here?\n !idle? && @self_started\n end", "def running?\n File.exist?(@lock_file)\n end", "def running_process?\n Process.getpgid @pid\n true\n rescue Errno::ESRCH\n false\n end", "def running?\n @mutex.synchronize {\n return @threads.empty? == false\n }\n end", "def running?\n return RUN_MODE if RUN_MODE.present?\n Rails.env.production?\n end", "def run?\n return false unless @process\n return true\n end" ]
[ "0.8595624", "0.8266758", "0.8239589", "0.80278003", "0.8004639", "0.79786265", "0.7972277", "0.7951324", "0.7930713", "0.7891215", "0.7882951", "0.7882951", "0.7882951", "0.7882951", "0.7882951", "0.7882951", "0.7882951", "0.78783685", "0.7860161", "0.78138435", "0.7791473", "0.778001", "0.77708197", "0.7762779", "0.77466965", "0.77455103", "0.7712444", "0.76808804", "0.76805544", "0.7666545", "0.7664503", "0.7644909", "0.763575", "0.7632968", "0.7621423", "0.7620423", "0.76179373", "0.7615463", "0.76052415", "0.75966114", "0.7581209", "0.75682646", "0.75672245", "0.7553441", "0.75420463", "0.7531047", "0.75203097", "0.75110734", "0.7499108", "0.7490391", "0.7481583", "0.7476114", "0.7476114", "0.7476114", "0.7471077", "0.74680424", "0.7463647", "0.74467045", "0.74467045", "0.7434786", "0.74262154", "0.7423153", "0.7379264", "0.7351174", "0.73427695", "0.73403376", "0.7335725", "0.73290443", "0.7326332", "0.7315471", "0.7310467", "0.730545", "0.7304507", "0.73005307", "0.73005307", "0.7278877", "0.72729784", "0.72573745", "0.72394496", "0.72071254", "0.7179937", "0.7173213", "0.71485025", "0.7105179", "0.7104858", "0.70701915", "0.70576495", "0.7054104", "0.7051016", "0.70292", "0.70272446", "0.7025993", "0.70249665", "0.70192593", "0.70094895", "0.7004071", "0.69966996" ]
0.78841674
12
Returns true if the application is staged.
def staged? @staged end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def staging?\n self.environment == ENV_STAGE\n end", "def staging?\n status == \"STAGING\"\n end", "def staging?\n @staging_index != nil\n end", "def for_startup?\n self.stage_id > 1\n end", "def app_starting?\n @launching\n end", "def use_staged_file_only\n @use_staged_file_only ||= false\n end", "def tooling?\n true\n end", "def development?\n self.environment == ENV_DEV\n end", "def standalone?\n not $SLICED_APP\n end", "def standalone?\n not $SLICED_APP\n end", "def development?\n environment == 'development'\n end", "def development?\n config[:target] == :development\n end", "def live?\n configuration.release_stage?\n end", "def starter?\n games_played < Elo.config.starter_boundry\n end", "def development? ; @app.options[:env] == :development ; end", "def development?\n environment == :development\nend", "def development?\n env == 'development'\n end", "def development?\n !production?\n end", "def is_sandbox?\n @sandbox == true\n end", "def dev_env?\n env == 'development'\n end", "def started? (name)\n bundle = list_bundles.find {|b| b[:name] == name}\n bundle[0][:context] == 'Started'\n end", "def dev?\n Rails.env == 'development'\n end", "def provisioning?\n status == \"PROVISIONING\"\n end", "def development_mode?\n RAILS_ENV == 'development'\n end", "def stressed?\n self.stress_state == :stressed.to_s\n end", "def stage(*env_or_envs)\n unless staged?\n prepare(*env_or_envs)\n @staged = true\n end\n\n self.new\n end", "def sandbox?\n !production?\n end", "def just_started_taking_damage?\n taking_damage? and @map.is_safe_location?(@map.previous_location)\n end", "def bootstrapped?\n # @bootstrapped ||= !run('if [ -f /var/poolparty/bootstrapped ]; then echo \"YES\"; fi').match(/YES/).nil?\n @bootstrapped ||= !run('if [ -f /var/poolparty/bootstrapped ]; then echo \"YES\"; fi').chomp.empty? || false\n end", "def sandbox?\n !production?\n end", "def development?\n @request.development?\n end", "def booted?\n !!@booted\n end", "def has_pushed_rhn_stage?\n return true if rhnqa? || rhnqa_shadow?\n\n has_pushed_since_last_respin?(RhnStagePushJob)\n end", "def developer?\n config[\"developer\"] == true\n end", "def development?\n ENV.fetch('RACK_ENV', 'unknown').casecmp?('development')\n end", "def run?\n @run ||= true\n @run and !@running and app_file? and $0.expand_path == app_file.expand_path\n end", "def provision?\n true\n end", "def stage_exists?(_name)\n Bertrand::UNKNOWN\n end", "def encode_stage?\n\t\ttrue\n\tend", "def legacy_development?\n # Middleman 3.4\n is_development = try(:development?)\n unless is_development.nil?\n return is_development\n end\n\n # Middleman 4.x\n app.development?\n end", "def is_app_instance?\n if @service_type == 'http' && @path_name == '/' && @balancer_configuration == 'app'\n return true\n end\n\n false\n end", "def manifestable_state?\n return true unless manages_state?\n workflow_class.manifest_states.include? Array.wrap(state).first.underscore\n end", "def file_staged?(path)\n command = 'git diff --cached --name-only'\n output = command_stdout(command)\n prefix = repo_root\n output.each_line do |line|\n line.strip!\n return true if path == \"#{prefix}/#{line}\"\n end\n false\n end", "def vendored_bundler?\n false\n end", "def development?\n ENV['RACK_ENV'] == 'development'\n end", "def started?\n status['Running']\n end", "def running?\n @applications.each { |a| return true if a.running? }\n return false\n end", "def backup_minister_installed?\n software_installed?(APP_NAME)\n end", "def dev_or_test?\n development? || test?\n end", "def running?\n return RUN_MODE if RUN_MODE.present?\n Rails.env.production?\n end", "def bootstrapped?\n raise \"Invalid Bootstrapper\"\n end", "def development?\n ::Rails.env.development?\n end", "def need_backup_setup?\n backup_sources.active.empty?\n end", "def stage\n 'dev'\n end", "def production?\n @production ||= true\n end", "def just_set_up?\n AppConfig[:just_set_up] == true\n end", "def stage(root, context: nil)\n staged_root.tap { |p| p.mkpath unless p.exist? }\n\n # Sync the template files over\n oe, s = Open3.capture2e(\"rsync\", \"-a\", \"#{root}/\", \"#{staged_root}\")\n raise oe unless s.success?\n\n # Output user submitted context attributes for debugging purposes\n user_defined_context_file.write(JSON.pretty_generate context.as_json)\n\n # Render all template files using ERB\n render_erb_files(\n template_files,\n binding: TemplateBinding.new(self, context).get_binding\n )\n true\n rescue => e # rescue from all standard exceptions (app never crashes)\n errors.add(:stage, e.message)\n Rails.logger.error(\"ERROR: #{e.class} - #{e.message}\")\n false\n end", "def is_dev?\n @dev\n end", "def can_start_instance?\n if maint_mode?\n return false unless Instance.running_for_profile(self).empty? or\n Instance.running_maint_for_laboratory?(laboratory)\n else\n return false if !active? or \n laboratory.max_instances <= laboratory.active_instances.size\n end\n true\n end", "def production?\n self.environment == ENV_PROD\n end", "def should_build?\n config.auto_build && !dev_server_running?\n end", "def is_deploy_active?(stack, stage)\n if deployname = get_deploy_process_title(stack,stage)\n return system(\"pgrep -f '#{deployname}'\")\n end\n false\n end", "def needed?\n return true if snapshot? && File.exist?(name) && (update_snapshot? || old?)\n super\n end", "def working?\n true\n end", "def working?\n true\n end", "def environment_valid?\n %w(test production development).include?(@environment)\n end", "def cave?\n return $game_player.system_tag == TCave\n end", "def production?\n rails_env == \"production\" || rails_env == \"staging\"\n end", "def workflow_launchable?\n !workflow_status_is?(:pending) && current_workflow_processes.empty?\n end", "def loadable?\n %w(test development).include?(Rails.env) || !loaded?\n end", "def rails_development?\n defined?(::Spring)\n end", "def application?\n gem_dir\n end", "def application?\n gem_dir\n end", "def running_protected_environment?\n protected_environments.collect(&:to_sym).include?(Rails.env.to_sym)\n end", "def development?; self == \"development\"; end", "def not_development?\n !Rails.env.eql?(\"development\")\n end", "def src_enabled?\n !ENV.fetch('STACKI_SRC', '').empty?\nend", "def needs_environment_scoping?(data)\n repository_depth(data) == 0\n end", "def testing?\n $TESTING ||= env?(:test) || Merb::Config[:testing]\n end", "def production? ; @app.options[:env] == :production ; end", "def production?\n config[:target] == :production\n end", "def managed_only?\n !programme_dropdown? &&\n Programme.site_managed_programme.present? &&\n !Programme.can_create?\n end", "def sandbox?\n config[\"sandbox\"] == true\n end", "def started?\n backend.started?\n end", "def allow_unsynced_production_writes?\n !!Rails.configuration.x.stagehand.allow_unsynced_production_writes\n end", "def has_sandbox?\n true\n end", "def skip_active_deployment_check?\n ENV['SKIP_DEPLOYMENT_CHECK'] == 'true' || deployment_check?\n end", "def production?\n @environment == :production\n end", "def instruments_app_running?\n ps_output = `ps x -o pid,comm | grep Instruments.app | grep -v grep`.strip\n if ps_output[/Instruments\\.app/, 0]\n true\n else\n false\n end\n end", "def production?\n environment == :production\n end", "def haveBootstrapped?\n @inventory.haveNode?(@server.mu_name)\n end", "def egg?\n return @step_remaining > 0\n end", "def program_name?\n \"runs\"\n end", "def testing?\n $TESTING || Merb::Config[:testing]\n end", "def standing?\n\t\treturn @standing\n\tend", "def app_is_installed?\n if installed_app_bundle_dir ||\n simctl.app_container(device, app.bundle_identifier)\n true\n else\n false\n end\n end", "def local?\n test_framework?\n end", "def past_step_1?\n status_is_active?(\"base_details\")\n end", "def running?\n runtime_state?(peek_current_state)\n end", "def include_dev?\n config.dig(\"composer\", \"include_dev\") == true\n end" ]
[ "0.7235159", "0.7121673", "0.6456897", "0.6408972", "0.6306472", "0.6295903", "0.61553335", "0.6077606", "0.60681003", "0.60681003", "0.6024236", "0.6012484", "0.5975478", "0.59264153", "0.5916197", "0.5839874", "0.58217937", "0.5767053", "0.5762693", "0.5749853", "0.57411414", "0.5737794", "0.57217294", "0.56992066", "0.5697233", "0.5683991", "0.5679983", "0.5672414", "0.5664038", "0.565348", "0.5647382", "0.56462395", "0.5635929", "0.56334966", "0.56189024", "0.56132615", "0.56080544", "0.5596979", "0.5580777", "0.55762607", "0.55725944", "0.55645883", "0.55609655", "0.55572546", "0.5546375", "0.55439794", "0.55409193", "0.55395895", "0.55319655", "0.5526839", "0.55156714", "0.5509805", "0.5507669", "0.5507174", "0.54987746", "0.5487005", "0.54756206", "0.54701954", "0.5468659", "0.546734", "0.5466197", "0.54648876", "0.54631287", "0.5455158", "0.5455158", "0.544187", "0.5437281", "0.54359365", "0.54344124", "0.54275817", "0.5425679", "0.54208606", "0.54208606", "0.5412644", "0.54018986", "0.539807", "0.5390951", "0.5383743", "0.53719085", "0.5367666", "0.53609395", "0.53553027", "0.5344997", "0.5342918", "0.53414935", "0.53403455", "0.5336886", "0.5332985", "0.53311884", "0.5330441", "0.53253233", "0.53248334", "0.532209", "0.5321846", "0.5321759", "0.5320292", "0.5294928", "0.5294092", "0.5288219", "0.52850306" ]
0.8288656
0
Convenience method for base configuration class.
def config Pakyow::Config end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(sym, *args, &block)\n if configuration.respond_to?(sym)\n configuration.send(sym, *args, &block)\n else\n super\n end\n end", "def method_missing (name, *args)\n @config.has_key?(name.to_s) ? @config[name.to_s] : super\n end", "def configuration_name\n super\n end", "def method_missing (name, *args)\n @config.has_key?(name.to_s) ? @config[name.to_s] : super\n end", "def initialize\n @config = DEFAULT_CONFIG.deep_dup\n end", "def method_missing(name, *args)\n @config.respond_to?(name) ? @config.send(name, *args) : super\n end", "def method_missing(method_name, *arguments, &block)\n if Configuration.instance.respond_to?(method_name)\n Configuration.instance.public_send(method_name, *arguments, &block)\n else\n super\n end\n end", "def config(&block)\n yield(self)\n end", "def add_config_inheritance!\n class_eval do\n def self.inherited(subclass)\n subclass.class_eval do\n class << self\n attr_accessor :sorcery_config\n end\n end\n # Pass parent config to subclass\n subclass.sorcery_config = sorcery_config\n super\n end\n end\n end", "def configurations; end", "def named_configuration_file\n super\n end", "def configuration; end", "def configuration; end", "def configuration; end", "def configuration; end", "def configuration; end", "def configure &block\n @config_helper = ConfigHelper.new(&block)\n end", "def method_missing(name, *args, &blk)\n return self[name.to_s] if has_key?(name.to_s)\n return self['config'][name.to_s] if self['config'] && self['config'].has_key?(name.to_s)\n super(name, *args, &blk)\n end", "def method_missing(name, *args, &blk)\n return self[name.to_s] if has_key?(name.to_s)\n return self['config'][name.to_s] if self['config'] && self['config'].has_key?(name.to_s)\n super(name, *args, &blk)\n end", "def default_configuration=(_arg0); end", "def configure(conf)\n super\n end", "def config\n yield self\n end", "def method_missing(missing_method_name, *args, &block)\n if 'cfg' == missing_method_name.to_s\n self.config.settings\n else\n super\n end\n end", "def config\n yield @@config_options\n end", "def config\n @_config ||= self.class.config.inheritable_copy\n end", "def config_store; end", "def initialize(*args)\n initialize_config unless instance_variable_defined?(:@config)\n super\n end", "def config\n yield self\n end", "def config\n yield self\n end", "def config\n yield self\n end", "def method_missing(method, *_args, &_block)\n @config.send(method)\n end", "def configuration\n self\n end", "def method_missing symbol, *args, &block\n return config[symbol] if config.has_key? symbol\n super symbol, *args, &block\n end", "def method_missing(sym, *args)\n Configuration.fetch(sym, '')\n end", "def config\n self.class.configuration_builder.configuration\n end", "def retriable_configuration\n Take2::Configuration::CONFIG_ATTRS.each_with_object({}) do |key, hash|\n hash[key] = send(key)\n end\n end", "def initialize(...)\n super()\n configure(...)\n end", "def config\n self\n end", "def method_missing(meth, *args, &blk)\n configuration.key?(meth.to_s) ? configuration.fetch(meth.to_s) : super\n end", "def method_missing(meth, *args, &blk)\n configuration.key?(meth.to_s) ? configuration.fetch(meth.to_s) : super\n end", "def parametrize #alias\n self.configuration\n end", "def config(options = T.unsafe(nil)); end", "def setup_config\n # To be Extended\n end", "def configurable(klass, key, opts={})\n opts[:key] = key\n opts[:label] ||= key\n Config.configurables ||= {}\n Config.configurables[klass.full_name] ||= []\n Config.configurables[klass.full_name] << opts\n end", "def initialize(*args)\n super\n attribute_will_change!(:configuration) if configuration\n end", "def configure(&block)\n yield(configuration)\n end", "def configure opts\n configuration.merge!(opts)\n end", "def initialize\n yield self\n Config.apply(self)\n end", "def configure\n yield(self.config) if block_given?\n end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def configure\n yield(config)\n end", "def get_config\n\t\tend", "def initialize\n @configurations = {}\n end", "def configure\n yield(config)\n end", "def initialize\n configure_via_yaml\n configure_via_env\n end", "def configuration_from_options(options); end", "def configuration\n return self\n end", "def config=(_arg0); end", "def config=(_arg0); end", "def config=(_arg0); end", "def config=(_arg0); end", "def config=(_arg0); end", "def as_config\n Configureasy::Config.new self.parse\n end", "def config\n log.deprecated(log_key) do\n 'config (DSL). Please use Config.(thing) instead (capital C).'\n end\n\n Config\n end", "def configure\n self.configuration ||= Configuration.new\n yield(configuration)\n end", "def configure\n self.configuration ||= Configuration.new\n yield(configuration)\n end", "def _handle_config(name, value=nil, override=false)\n if !self.const_defined?(\"CONFIG\")\n self.class_eval(\"CONFIG = {}\")\n end\n \n if value != nil\n if override or self::CONFIG[name] == nil\n self::CONFIG[name] = value \n end\n else\n # if we pass an array of config keys to config(),\n # get the array of values back\n if name.is_a? Array\n name.map { |c| self::CONFIG[c] }\n else\n self::CONFIG[name]\n end\n end \n end", "def method_missing method, *args, &block\n if args.empty?\n @config.send(method)\n else\n @config.send(\"#{method}=\", args.first)\n end\n end", "def internalizeConfig(config)\r\n super(config)\r\n @server = config['Server' ] || Socket.gethostname\r\n @repository_name = config[\"RepositoryBase\"] || nil\r\n @uri = config[\"Uri\" ] || false\r\n @max_items = config[\"MaxItems\" ] || 100\r\n @debug = config[\"Debug\" ] || false\r\n @localhost = _targetServerIsLocalhost(@server)\r\n\r\n if !@repository_name.end_with?('.git')\r\n @repository_name += '/.git'\r\n end\r\n\r\n if ['False', 'false', 'No', 'no', 'Off', 'off', '0'].include?(@debug)\r\n @debug = false\r\n end\r\n end", "def configure &block\n configuration.tap { |conf| yield conf }\n end", "def config\n @config = ActiveSupport::HashWithIndifferentAccess.new(@config) if @config.is_a? Hash\n @config\n end", "def config=(config); end", "def configure(&block)\n yield(configuration)\n end", "def configure\n yield(configuration)\n end", "def configure\n yield(configuration)\n end", "def configure\n yield(configuration)\n end", "def configure\n yield(configuration)\n end", "def configure\n yield(configuration)\n end", "def configure\n yield(configuration)\n end", "def configure\n yield(configuration)\n end", "def configure\n yield(configuration)\n end", "def configure\n yield(configuration)\n end", "def configure\n yield(configuration)\n end", "def configure(&block); end" ]
[ "0.71671015", "0.7078206", "0.69937396", "0.6986439", "0.6951794", "0.6936226", "0.69352037", "0.69260424", "0.69185716", "0.6899628", "0.68372184", "0.6826284", "0.6826284", "0.6826284", "0.6826284", "0.6826284", "0.68262744", "0.6823709", "0.6823709", "0.6817109", "0.6815288", "0.68139994", "0.679776", "0.6788672", "0.6752741", "0.67518026", "0.67251563", "0.6715793", "0.6715793", "0.6715793", "0.66846627", "0.6624646", "0.6619211", "0.66099644", "0.65987515", "0.657592", "0.6562112", "0.6545039", "0.654231", "0.654231", "0.6541301", "0.6534374", "0.6529393", "0.652301", "0.6518007", "0.65175354", "0.651621", "0.65095615", "0.6505088", "0.649471", "0.649471", "0.649471", "0.649471", "0.649471", "0.649471", "0.649471", "0.649471", "0.649471", "0.649471", "0.649471", "0.649471", "0.649471", "0.649471", "0.649471", "0.649471", "0.649471", "0.649471", "0.6489009", "0.6486062", "0.6481998", "0.6478837", "0.64779264", "0.6471123", "0.6469179", "0.64651716", "0.64651716", "0.64651716", "0.64651716", "0.64651716", "0.64647985", "0.64629257", "0.64622337", "0.64622337", "0.64621264", "0.6456055", "0.6455471", "0.645121", "0.64504856", "0.6447731", "0.64465916", "0.6446061", "0.6446061", "0.6446061", "0.6446061", "0.6446061", "0.6446061", "0.6446061", "0.6446061", "0.6446061", "0.6446061", "0.64404017" ]
0.0
-1
Returns the primary (first) loaded env.
def env config.env end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_environment\n return nil unless default_environment_name\n environment(default_environment_name)\n end", "def current\n @env.first\n end", "def detect_env\n @environments.find{|env_name,proc|\n instance_eval(&proc)\n } \n end", "def get_root_environment\n\n fetch_environment.get_root_environment\n end", "def get_environment ()\n service_data = query_for_services()\n return service_data[\"environment\"]\n end", "def env\n Thread.current[ENVIRONMENT] or raise(\"no env in scope\")\n end", "def current_environment\n read_environment_from_cache\n end", "def base_environment\n environment[:all] || (next_library.nil? ? {} : next_library.base_environment)\n end", "def env\n @env || {}\n end", "def env\n @env\n end", "def env\n legacy_env || app_env\n end", "def load\n Dotenv.load(\n root.join(\".env.local\"),\n root.join(\".env.#{Rails.env}\"),\n root.join(\".env\")\n )\n end", "def local_env\n @local_env ||= NewRelic::LocalEnvironment.new\n end", "def env\n return :development unless @env\n @env\n end", "def env\n return {} unless instance.respond_to? :env\n\n instance.env\n end", "def current_env\n @current_env\n end", "def default_environment\n nil\n end", "def get_environment\n\n fetch_environment || get_expression_pool.fetch_engine_environment\n end", "def env\n @_env\n end", "def env\n unless defined?(@environment)\n self.env = DEFAULT_ENVIRONMENT\n end\n\n @environment\n end", "def env\n defined?(Rails) ? Rails.env.to_sym : @env\n end", "def get_env(name)\n @ant.instance_eval(\"@env_%s\" % name)\n end", "def get_env(key)\n\n end", "def global_env\n @global_env ||= global? ? self : @parent.global_env\n end", "def load_local_env\n load_env(KVMRC_LOCAL)\n end", "def env\n env = job[:env]\n env = env - (config[:env].is_a?(Hash) && config[:env][:global] || []) if env\n env = env - config[:global_env] if config[:global_env].is_a?(Array)\n env\n end", "def target_environment\n return unless application = applications.first\n application.split(\"-\").first\n end", "def default_environment; end", "def env\n site.env\n end", "def default_environment_name\n return nil unless config?\n config.default_environment\n end", "def fetch_engine_environment\n\n eei = engine_environment_id\n ee, fei = fetch(eei)\n\n return ee if ee\n\n ee = Environment.new_env(eei, nil, nil, @application_context, nil)\n ee.store_itself\n ee\n end", "def load_environment(tasks)\n environment = tasks[:environment]\n if environment.nil?\n Kernel.abort(\"Unable to load details of environment '#{tasks[:environment_name]}'\")\n end\n environment\nend", "def environment\n @environment ||= nil\n end", "def shell_env\n @shell.env\n end", "def current_env\n Rails.env\n end", "def env(name)\n if name\n Environment.new(name)\n else\n @environment #Environment.current\n end\n end", "def find(id)\n unless environment = ridley.environment.find(id)\n abort EnvironmentNotFound.new(id)\n end\n\n environment\n end", "def get_environment\n if @environment.empty?\n \":\"\n else\n env = @environment.map { |key, value| %(#{key}=\"#{value}\") }\n \"export #{env.join(' ')}\"\n end\n end", "def environment\n self.class.environment\n end", "def pseudo_env\n ENV[\"PSEUDO_PRODUCTION_ENV\"]&.inquiry || Rails.env\n end", "def env(key) \n str = key.to_s \n env?(str) ? ENV[str] : nil\n end", "def env\n @_env ||= ActiveSupport::EnvironmentInquirer.new(ENV[\"RAILS_ENV\"].presence || ENV[\"RACK_ENV\"].presence || \"development\")\n end", "def autodetect_environment\n rails_env = if defined?(::Rails) && ::Rails.respond_to?(:env)\n ::Rails.env.to_s\n elsif defined?(::RAILS_ENV)\n ::RAILS_ENV.to_s\n end\n \n LIVE_RAILS_ENVIRONMENTS.include?(rails_env) ? 'live' : 'test'\n end", "def environment\n @environment ||= ActiveSupport::StringInquirer.new(app.environment.to_s)\n end", "def environment\n @environment || DEFAULT_ENVIRONMENT\n end", "def environment(name = nil)\n name = default_environment_name unless name\n known_environments.find { |env| env.match_name?(name) }\n end", "def environment\n verify_environment\n ENV['ENV']\nend", "def type_env\n @current_env\n end", "def env_hash\n read_env || reset_env unless defined?(DataCache.env_hash)\n DataCache.env_hash\n end", "def env(key)\n if key.nil?\n nil\n else\n ENV[key]\n end\n end", "def env\n @env ||= ActiveSupport::StringInquirer.new(ENV[\"CASSANDRA_ENV\"] || ENV[\"RACK_ENV\"] || \"development\")\n end", "def env\n @env ||= env_with_params\nend", "def environment\n return @vars unless @vars.nil?\n\n # If not set, Try to find them...\n glob_path = File.join(@deployment_home, @settings.env_file_glob_path)\n regexp_find = glob_path.gsub(/\\*/, '(.*)')\n Dir[glob_path].each do | file_name |\n # Get the environment name from the file part of the glob path:\n # e.g. given ./environments/ci_mgt/kb8or.yaml\n # get ci_mgt from ./environments/*/kb8or.yaml\n /#{regexp_find}/.match(file_name)\n env_name = $1\n if env_name == @env_name\n debug \"env=#{env_name}\"\n # Ensure we set the defaults as vars BEFORE we add environment specifics:\n @vars = @settings.defaults\n env_vars = Context.resolve_env_file(file_name)\n @vars = @vars.merge(env_vars)\n @vars = @vars.merge(@overridden_vars)\n @vars['env'] = env_name\n @environment_file = file_name\n break\n end\n end\n # Now finaly, update the settings now we know the environment!\n unless @vars\n @vars = {}\n end\n @settings = @settings.new(@vars)\n update_k8context\n debug \"vars=#{vars}\"\n @vars\n end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def [](env)\n @environments[env.to_s].freeze\n end", "def environment\n if new_resource.parent_python\n environment = new_resource.parent_python.python_environment\n if new_resource.environment\n environment = environment.merge(new_resource.environment)\n end\n environment\n else\n new_resource.environment\n end\n end", "def static_env; end", "def static_env; end", "def static_env; end", "def environment_for(bundle_name=nil)\n\n # If no bundle name is provided, then just return the base environment.\n return base_environment if bundle_name.nil?\n \n # Get the bundle location info. This will return nil if the bundle\n # is not found anywhere. In that case, return nil to indicate bundle\n # does not exist.\n bundle_location = bundle_location_for(bundle_name)\n return nil if bundle_location.nil?\n\n # A bundle was found, so collect the base environment and any bundle-\n # specific configs provided by the developer.\n base_env = base_environment\n config_env = bundle_environment_for(bundle_name)\n\n # Now we have the relevant pieces. Join them together. Start with the\n # base environment and fill in some useful defaults...\n ret = base_env.dup.merge(config_env).merge(bundle_location)\n ret[:required] = [:sproutcore] if ret[:required].nil?\n\n # Add local library so we get proper deployment paths, etc.\n ret[:library] = self\n\n # Done! return...\n return ret\n end", "def with_first_env(rows)\n rows.each { |row| (row[:env] ||= []).concat([first_env]).uniq! unless row[:env] } if first_env\n rows\n end", "def get_env(name)\n ENV[name]\n end", "def load_env(environment=nil)\n environment ||= \"production\"\n load_dot_env \".env\" if environment == \"production\"\n load_dot_env \".env.#{environment}\"\nend", "def env(key)\n if key.nil?\n nil\n elsif override_env.present?\n override_env[key]\n else\n ENV[key]\n end\n end", "def pdb_get_environment(facts)\n if facts.is_a?(Hash) && !facts['trusted'].nil? && !facts['trusted']['value'].nil? && !facts['trusted']['value']['extensions'].nil? && !facts['trusted']['value']['extensions']['pp_environment'].nil?\n environment = facts['trusted']['value']['extensions']['pp_environment']\n Puppet.info(\"#{log_prefix} puppet environment for node is: environment=#{environment}\")\n environment\n else\n \"Unknown\"\n end\n end", "def environment \n if exists?(:stage)\n stage\n elsif exists?(:rails_env)\n rails_env \n elsif(ENV['RAILS_ENV'])\n ENV['RAILS_ENV']\n else\n \"production\" \n end\nend", "def load_enviroment\n file = ResqueMaster.config['environment'] || '.'\n\n if File.directory?(file) && File.exist?(File.expand_path(\"#{file}/config/environment.rb\"))\n require 'rails'\n require File.expand_path(\"#{file}/config/environment.rb\")\n\n if defined?(::Rails) && ::Rails.respond_to?(:application)\n # Rails 3\n ::Rails.application.eager_load!\n end\n elsif File.file?(file)\n require File.expand_path(file)\n end\n end", "def environment\n if exists?(:stage)\n stage\n elsif exists?(:rails_env)\n rails_env\n elsif(ENV['RAILS_ENV'])\n ENV['RAILS_ENV']\n else\n \"production\"\n end\nend", "def environment\n if exists?(:stage)\n stage\n elsif exists?(:rails_env)\n rails_env\n elsif(ENV['RAILS_ENV'])\n ENV['RAILS_ENV']\n else\n \"production\"\n end\nend", "def bundle_environment_for(bundle_name)\n bundle_name = bundle_name.to_sym\n return environment[bundle_name] || (next_library.nil? ? {} : next_library.bundle_environment_for(bundle_name))\n end", "def env(env=nil)\n env ||= 'default'\n e = @environments[env] ||= Environment.new\n yield e if block_given?\n e\n end", "def _load_env\n require 'yaml'\n r_var = _open_sefile('env3.yml') { |f| YAML.load(f) }\n @var.delete :file_open_raised\n r_var.each { |k,v| @var[k] = v } if r_var\nend", "def current\n env[REPO] ||= new(env)\n end", "def successor_environment(env)\n (options[:environment_successors] || {})[env]\n end", "def test_single_environment_set_env_no_name\n cfg = DBGeni::Config.new\n cfg.load(\"environment('foo') { } \\n\")\n cfg.set_env\n assert_equal('foo', cfg.current_environment)\n end", "def env_path\n @bin_resolver.env_path\n end", "def env\r\n original_env.merge(hacked_env)\r\n end", "def environment\n @environment\n end" ]
[ "0.68288726", "0.68041736", "0.67529076", "0.6679614", "0.66529316", "0.6638582", "0.6626394", "0.6515252", "0.6462876", "0.6407105", "0.6390042", "0.63828516", "0.6382845", "0.6379535", "0.6366993", "0.63600594", "0.6346099", "0.6342683", "0.631306", "0.6294777", "0.62840897", "0.6282715", "0.62729555", "0.626975", "0.62670004", "0.62261957", "0.6213887", "0.6196953", "0.6174838", "0.6156104", "0.61494607", "0.6059798", "0.6052219", "0.6049569", "0.60450876", "0.6042888", "0.6040623", "0.60346764", "0.60299885", "0.6026864", "0.6021281", "0.60150987", "0.6009249", "0.6007789", "0.60053974", "0.59797496", "0.59757197", "0.59695345", "0.5942135", "0.59203905", "0.5916992", "0.59149534", "0.5897164", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.58799523", "0.5871054", "0.5858177", "0.58531564", "0.58531564", "0.58531564", "0.58245015", "0.5819849", "0.58185667", "0.5801305", "0.57880175", "0.5780779", "0.57801616", "0.5776832", "0.5766125", "0.5766125", "0.5757245", "0.5741381", "0.57382727", "0.5730178", "0.5716498", "0.5713022", "0.57081", "0.5703654", "0.56946725" ]
0.59907734
46
Called on every request.
def process(env) call_stack(:before, :process) req = Request.new(env) res = Response.new # set response format based on request res.format = req.format @context = AppContext.new(req, res) set_initial_cookies @found = false catch(:halt) { call_stack(:before, :route) @found = @router.perform(context, self) { call_stack(:after, :match) } call_stack(:after, :route) unless found? handle(404, false) if config.app.errors_in_browser response["Content-Type"] = 'text/html' view_file = File.join(File.expand_path('../../', __FILE__), 'views', 'errors', '404.html') content = File.open(view_file).read path = String.normalize_path(request.path) path = '/' if path.empty? content.gsub!('{view_path}', path == '/' ? 'index.html' : "#{path}.html") content.gsub!('{route_path}', path) response.body = [] response.body << content end end } set_cookies call_stack(:after, :process) response.finish rescue StandardError => error call_stack(:before, :error) request.error = error handle(500, false) unless found? if config.app.errors_in_browser response["Content-Type"] = 'text/html' view_file = File.join(File.expand_path('../../', __FILE__), 'views', 'errors', '500.html') content = File.open(view_file).read path = String.normalize_path(request.path) path = '/' if path.empty? nice_source = error.backtrace[0].match(/^(.+?):(\d+)(|:in `(.+)')$/) content.gsub!('{file}', nice_source[1].gsub(File.expand_path(Config.app.root) + '/', '')) content.gsub!('{line}', nice_source[2]) content.gsub!('{msg}', CGI.escapeHTML(error.to_s)) content.gsub!('{trace}', error.backtrace.map { |bt| CGI.escapeHTML(bt) }.join('<br>')) response.body = [] response.body << content end call_stack(:after, :error) response.finish end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_pre_request( request )\n end", "def on_pre_request( request ); end", "def after_request\n end", "def set_request; end", "def after_request\n end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def before_request\n end", "def process(request); end", "def on_request( &block )\n @on_request = block\n end", "def request_phase\n super\n end", "def request_phase\n super\n end", "def on_global_request(type, &block); end", "def call(request); end", "def pre_connect(request); end", "def perform(request, response); end", "def on_ignored_request\n end", "def post_init\n @request = Request.new\n @response = Response.new\n end", "def handler; end", "def handler; end", "def receive(request); end", "def consider_all_requests_local; end", "def consider_all_requests_local; end", "def process_http_request\n route_http_request\n end", "def request\n raise 'need to be implemented'\n end", "def send_request; end", "def on_request &b\n @request_proc = b\n self\n end", "def before_dispatch(_env)\n end", "def middleware; end", "def on_success(_request, response)\n response\n end", "def perform(request, options); end", "def request_log(request); end", "def before_dispatch(env); end", "def handlers; end", "def handlers; end", "def handlers; end", "def on_request( &block )\n @preprocessor = block\n end", "def request_method; end", "def before_filter; end", "def request\n nil\n end", "def req\n \n end", "def request=(request); @request = request end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def process!\n if Server.environment == 'development'\n puts \"----------request--------------\\n#{controller.request.inspect}\"\n puts controller.request.body.read\n controller.request.body.rewind\n end\n\n controller.response.body = controller.send(controller.action_name)\n\n if Server.environment == 'development'\n puts \"----------response--------------\\n#{controller.response.inspect}\"\n end\n end", "def request_data; end", "def apply_request(request_env); end", "def raw_response; end", "def on_request(request, type)\n self.on_request_args = [request, type]\n self.on_request_called = true\n false # cancel request since we can't stub it\n end", "def on_before_load\n end", "def call(request)\r\n self\r\n end", "def before_processing\n end", "def onStart\r\n end", "def request_result\n \n end", "def read(_request)\n raise NotImplementedError, 'Implement this method in your strategy'\n end", "def handler_request!\n response = Core::HandlerResponse.new(\n @req.body,\n @req.code,\n @req.header.to_hash.inspect\n )\n populate_properties! if response.request_successful? && check_request\n end", "def set_request\n $request = request\n end", "def after_view_setup\n end", "def consider_all_requests_local=(_arg0); end", "def consider_all_requests_local=(_arg0); end", "def on_request(env)\n env['sinatra.commonlogger'] = true\n super\n end", "def handle_message(request, message)\n #\n end", "def call(request)\n handler.call(request)\n end", "def generate_request\r\n end", "def handle(_request)\n fail NotImplementedError\n end", "def conditional_requests; end", "def conditional_requests; end", "def handle_request( * ) # :nodoc:\n\t\tself.log.debug \"[:restresources] handling request for REST resource.\"\n\t\tsuper\n\tend", "def first_request\n reset_horizon\n end", "def request_phase\n # Stash the account into the session so that we\n # can trieve it during the callback.\n session['omniauth.zendesk.account'] = fetch_zendesk_account\n\n # Prep the urls using the account ID.\n # TODO: Could we use the :setup option and a Proc\n # to handle this rather than call here?\n set_omniauth_zendesk_urls\n\n # Continue the request as usual.\n super\n end", "def callback_phase\n super\n end", "def state_initial\n @request = ServerSide::HTTP::Request.new(self)\n @response_sent = false\n set_state(:state_request_line)\n end", "def before_stream\n end", "def perform\n super\n end", "def perform\n super\n end", "def perform\n super\n end", "def perform\n super\n end", "def perform\n super\n end", "def perform\n super\n end", "def request; return @request end", "def request\n @_request\n end" ]
[ "0.7934825", "0.7772339", "0.7517309", "0.7253462", "0.71969926", "0.71197206", "0.71197206", "0.71197206", "0.71197206", "0.71197206", "0.71197206", "0.71197206", "0.71197206", "0.71197206", "0.71197206", "0.71197206", "0.704169", "0.7039795", "0.66306996", "0.66304916", "0.66304916", "0.65337867", "0.6507809", "0.64803785", "0.646417", "0.6370349", "0.6338558", "0.6311458", "0.6311458", "0.62896913", "0.62640953", "0.62640953", "0.6212838", "0.61934435", "0.6189154", "0.61681116", "0.61524975", "0.6123834", "0.6082644", "0.60598105", "0.6043127", "0.6029846", "0.60172904", "0.60172904", "0.60172904", "0.599356", "0.5981747", "0.5965465", "0.59647804", "0.5958261", "0.59511524", "0.5936444", "0.5936444", "0.5936444", "0.5936444", "0.5936444", "0.5936444", "0.5936444", "0.5936444", "0.5936444", "0.5936444", "0.5936444", "0.5936444", "0.5936444", "0.5933597", "0.59260684", "0.58867174", "0.5881726", "0.58739865", "0.58339745", "0.5828536", "0.5822546", "0.5793331", "0.5789716", "0.57895726", "0.5783835", "0.57748765", "0.5765936", "0.57486576", "0.57486576", "0.5736672", "0.5732671", "0.57322156", "0.573172", "0.5714713", "0.5712525", "0.5712525", "0.56956655", "0.56944203", "0.5689619", "0.56864524", "0.56725115", "0.5667246", "0.5664835", "0.5664835", "0.5664835", "0.5664835", "0.5664835", "0.5664835", "0.5664317", "0.56637806" ]
0.0
-1
This is NOT a useless method, it's a part of the external api
def reload # reload the app file load(config.app.path) # reset config envs = config.app.loaded_envs config.reset # reload config self.class.load_config(*envs) load_app end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def apis; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def api; end", "def api; end", "def api_error; end", "def private_method\n end", "def schubert; end", "def from_api?; false end", "def weber; end", "def probers; end", "def refutal()\n end", "def internal; end", "def preflight; end", "def implementation; end", "def implementation; end", "def who_we_are\r\n end", "def suivre; end", "def custom; end", "def custom; end", "def identify; end", "def external; end", "def hidden_apis; end", "def parent_api; end", "def parent_api; end", "def get; end", "def get_info\n end", "def get_info\n end", "def get_info\n end", "def extra; end", "def fetch; end", "def fetch; end", "def zuruecksetzen()\n end", "def api_mode; end", "def sitemaps; end", "def api_only; end", "def api_only; end", "def api_only; end", "def verdi; end", "def http; end", "def public; end", "def public; end", "def fetch\n raise \"not implemented\"\n end", "def respond(); end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def user_os_complex\r\n end", "def strategy; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def handle; end", "def request_data; end", "def hidden_apis=(_arg0); end", "def intensifier; end", "def get_parameters; end", "def get_parameters; end", "def operations; end", "def operations; end", "def provider; end", "def wrapper; end", "def get()\n \n end", "def endpoint; end", "def endpoint; end", "def endpoint; end", "def endpoint; end", "def available; end", "def available; end", "def info; end", "def info; end", "def villian; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def offences_by; end", "def informational?; end", "def fetch\n end", "def formation; end", "def api_only=(_arg0); end", "def response_from_service\n\n end", "def details; end", "def isolated; end", "def isolated; end", "def calls; end" ]
[ "0.75731504", "0.64767593", "0.6353592", "0.6353592", "0.6353592", "0.6353592", "0.6325274", "0.6325274", "0.6320839", "0.6317957", "0.62851423", "0.6277157", "0.6222414", "0.62066907", "0.62011826", "0.6149389", "0.6122427", "0.60142106", "0.60142106", "0.59849554", "0.59470516", "0.5932679", "0.5932679", "0.593172", "0.59228534", "0.59152454", "0.5890992", "0.5890992", "0.5879744", "0.58583987", "0.58583987", "0.58583987", "0.58489925", "0.5804914", "0.5804914", "0.5789942", "0.5775651", "0.5756368", "0.57495797", "0.57495797", "0.57495797", "0.5707107", "0.5682385", "0.567468", "0.567468", "0.56621945", "0.56517816", "0.56476974", "0.56476974", "0.56476974", "0.56476974", "0.56476974", "0.56476974", "0.56476974", "0.56476974", "0.56476974", "0.56476974", "0.56476974", "0.5639464", "0.56344986", "0.5631451", "0.5631451", "0.5631451", "0.5631451", "0.56295496", "0.5626171", "0.56246746", "0.56138504", "0.56122327", "0.56122327", "0.561211", "0.561211", "0.558004", "0.55800116", "0.5549883", "0.55441034", "0.55441034", "0.55441034", "0.55441034", "0.55426854", "0.55426854", "0.5540081", "0.5540081", "0.55212414", "0.5519101", "0.5519101", "0.5519101", "0.5519101", "0.5519101", "0.5519101", "0.5519101", "0.5515976", "0.55008626", "0.54975593", "0.54947317", "0.5486401", "0.54774916", "0.54704535", "0.54691935", "0.54691935", "0.5465349" ]
0.0
-1
APP ACTIONS Interrupts the application and returns response immediately.
def halt throw :halt, response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_app\n abort(\"See you next time!\")\n end", "def call!(env)\n before_call(env)\n\n begin\n response = @app.call(env)\n rescue Exception => ex # rubocop:disable Lint/RescueException\n notify_airbrake(ex)\n raise ex\n end\n\n exception = framework_exception(env)\n notify_airbrake(exception) if exception\n\n response\n ensure\n # Clear routes for the next request.\n RequestStore.clear\n end", "def call(env)\n if @cooldown && Time.now > @last + @cooldown\n begin\n MUTEX.synchronize{reload!}\n rescue StandardError, ScriptError => e\n raise unless @handle_reload_errors\n content = \"#{e.class}: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n return [500, {'Content-Type' => 'text/plain', 'Content-Length' => content.bytesize.to_s}, [content]]\n end\n @last = Time.now\n end\n @app_block.call.call(env)\n end", "def terminate app\n app.perform :terminate\n end", "def interrupt\n current_context.interrupt\n end", "def interrupt; end", "def stop; self.app.stop end", "def handle_interrupt; end", "def call(env)\n # rubocop:disable Lint/RescueException\n begin\n response = @app.call(env)\n rescue Exception => ex\n notify_airbrake(ex, env)\n raise ex\n end\n # rubocop:enable Lint/RescueException\n\n exception = framework_exception(env)\n notify_airbrake(exception, env) if exception\n\n response\n end", "def terminate\n\t\tself.request( :terminate )\n\tend", "def action_restart\n return if options['never_restart']\n action_stop\n action_start\n end", "def interrupt?; end", "def isolate_from_interrupts; end", "def interrupt\n user_interrupt or true\n end", "def user_interrupt\n write 'Terminating' # XXX get rid of this\n stoploop\n end", "def start_app\n response = show_menu\n response = show_menu while response < 1 || response > 7\n\n case response\n when 1\n list_books\n when 2\n list_people\n when 3\n create_person\n when 4\n create_book\n when 5\n create_rental\n when 6\n list_rentals_for_person_id\n when 7\n puts 'Thank you for using this app!'\n end\n\n puts \"\\n\"\n end", "def exit_app\n puts \"Chuck Norris disapproves of your choice...\\n\\n\"\n exit!\n end", "def run_interrupted; end", "def action_restart\n proxy_action(:restart)\n end", "def call(env)\n env.response = handle_response(env)\n @app.call(env)\n end", "def perform(env)\n app.call(env)\n rescue Faraday::ConnectionFailed, Faraday::SSLError, Faraday::TimeoutError => e\n # try to avoid caching proxy errors\n raise e if proxy_error?(env, e)\n\n stuff_999_response(env, e)\n end", "def call( env )\n\n if env[ 'options.confirm' ] && !confirm?( env[ 'remote' ], env[ 'branch' ] )\n raise Interrupt, 'Use cancelled the deployment.'\n end\n\n @app.call env\n end", "def interrupt_handler\n signal_handler(2)\n end", "def actions\n response = nil\n\n lambda do |reason, data|\n puts \"Execute block code with reason : #{reason}\"\n break response = data\n end\n\n response\n end", "def interrupt(ex)\n raise ex\n end", "def restart\n request('restart')\n end", "def exit\n raise ActionExit.new\n end", "def call(env)\n options_reload\n\n @watcher.call(@cooldown) do\n if @control\n instance_eval(&@control)\n elsif @thread\n Thread.exclusive{ cycle }\n else\n cycle\n end\n end\n\n @app.call(env)\n end", "def actions\n response = nil\n\n lambda do |_reason, data|\n puts \"[admin] Execute block code with reason : #{reason}\"\n case_events(data.to_hash)\n end\n\n response\n end", "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", "def down\n send_message('APP_DOWN')\n end", "def call(req)\n ThreadAccessor.clean_thread_context(logger: logger) { @app.call(req) }\n end", "def get_interrupt\n send_request(FUNCTION_GET_INTERRUPT, [], '', 2, 'S')\n end", "def call(env)\n notify_request_handlers(env)\n request = env.dup\n app.call(env).on_complete do |env|\n notify_response_handlers(request, env)\n end\n end", "def suspend\n action('suspend')\n end", "def run\n run_app\n adapter.run\n rescue Interrupt\n shut_down\n end", "def handle_interrupt\n # Ask for input.\n puts \"*** INTERRUPT RECEIVED: Are you sure you want to exit? [yes/no]\"\n \n # Wait until we get some actual text, resetting if we get more interrupts from\n # an over-zealous panicker.\n response = nil\n while( response.nil? )\n begin\n response = gets.chomp.to_s.downcase\n rescue Interrupt => i\n response = nil\n end\n end\n \n # Process the response.\n if( ['y', 'yes'].include?(response) )\n puts \"*** INTERRUPT: Exiting.\"\n exit(1)\n else\n puts \"*** INTERRUPT CANCELLED: Continuing.\"\n end\nend", "def action_stop\n proxy_action(:stop)\n end", "def process\n client.unreliable_activity_without_retry_options\n end", "def restart\n synchronize {\n if @app\n update_click_config\n else\n start\n end\n }\n end", "def call(env)\n\t\t\t\tbegin\n\t\t\t\t\tresponse = @app.call(env)\n\t\t\t\trescue Exception => ex\n\t\t\t\t\tnotify_riemann(ex, env)\n\t\t\t\t\traise ex\n\t\t\t\tend\n\n\t\t\t\t# The internal framework middlewares store exceptions inside the Rack\n\t\t\t\t# env. See: https://goo.gl/Kd694n\n\t\t\t\texception = env['action_dispatch.exception'] || env['sinatra.error']\n\t\t\t\tnotify_riemann(exception, env) if exception\n\n\t\t\t\tresponse\n\t\t\tend", "def stop_app(app_name, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n app_name.gsub!(/[^\\w\\d\\-]/, \"\")\n Djinn.log_info(\"Shutting down app named [#{app_name}]\")\n result = \"\"\n Djinn.log_run(\"rm -rf /var/apps/#{app_name}\")\n \n # app shutdown process can take more than 30 seconds\n # so run it in a new thread to avoid 'execution expired'\n # error messages and have the tools poll it \n Thread.new {\n # Tell other nodes to shutdown this application\n if @app_names.include?(app_name) and !my_node.is_appengine?\n @nodes.each { |node|\n next if node.private_ip == my_node.private_ip\n if node.is_appengine? or node.is_login?\n ip = node.private_ip\n acc = AppControllerClient.new(ip, @@secret)\n\n begin\n result = acc.stop_app(app_name)\n Djinn.log_debug(\"Removing application #{app_name} from #{ip} \" +\n \"returned #{result}\")\n rescue FailedNodeException\n Djinn.log_warn(\"Could not remove application #{app_name} from \" +\n \"#{ip} - moving on to other nodes.\")\n end\n end\n }\n end\n\n # Contact the soap server and remove the application\n if (@app_names.include?(app_name) and !my_node.is_appengine?) or @nodes.length == 1\n ip = HelperFunctions.read_file(\"#{CONFIG_FILE_LOCATION}/masters\")\n uac = UserAppClient.new(ip, @@secret)\n result = uac.delete_app(app_name)\n Djinn.log_debug(\"(stop_app) Delete app: #{ip} returned #{result} (#{result.class})\")\n end\n \n # may need to stop XMPP listener\n if my_node.is_login? \n pid_files = HelperFunctions.shell(\"ls #{CONFIG_FILE_LOCATION}/xmpp-#{app_name}.pid\").split\n unless pid_files.nil? # not an error here - XMPP is optional\n pid_files.each { |pid_file|\n pid = HelperFunctions.read_file(pid_file)\n Djinn.log_run(\"kill -9 #{pid}\")\n }\n\n result = \"true\"\n end\n stop_xmpp_for_app(app_name)\n end\n\n Djinn.log_debug(\"(stop_app) Maybe stopping taskqueue worker\")\n maybe_stop_taskqueue_worker(app_name)\n Djinn.log_debug(\"(stop_app) Done maybe stopping taskqueue worker\")\n\n APPS_LOCK.synchronize {\n if my_node.is_login?\n Nginx.remove_app(app_name)\n Nginx.reload\n HAProxy.remove_app(app_name)\n end\n\n if my_node.is_appengine?\n Djinn.log_debug(\"(stop_app) Calling AppManager for app #{app_name}\")\n app_manager = AppManagerClient.new(my_node.private_ip)\n if !app_manager.stop_app(app_name)\n Djinn.log_error(\"(stop_app) ERROR: Unable to stop app #{app_name}\")\n else\n Djinn.log_info(\"(stop_app) AppManager shut down app #{app_name}\")\n end\n\n ZKInterface.remove_app_entry(app_name, my_node.public_ip)\n end\n\n # If this node has any information about AppServers for this app,\n # clear that information out.\n if !@app_info_map[app_name].nil?\n @app_info_map.delete(app_name)\n end\n\n @apps_loaded = @apps_loaded - [app_name] \n @app_names = @app_names - [app_name]\n\n if @apps_loaded.empty?\n @apps_loaded << \"none\"\n end\n\n if @app_names.empty?\n @app_names << \"none\"\n end\n } # end of lock\n } # end of thread\n\n return \"true\"\n end", "def capture_internal_interaction(env)\n req = Rack::Request.new(env)\n transaction = Rack::VCR::Transaction.new(req)\n\n if @replay && transaction.can_replay?\n transaction.replay\n else\n status, headers, body = capture_external_interactions { @app.call(env) }\n res = Rack::Response.new(body, status, headers)\n transaction.capture(res)\n [status, headers, body]\n end\n end", "def suspend_vapp(vAppId)\n power_action(vAppId, 'suspend')\n end", "def event_terminate \n ScriptActionHandler::HandlerResult::terminate\n end", "def default_action req, endpoint\n return @app.call req.env if @app\n response HTTP_NO_CONTENT\n end", "def interrupt!\n @interrupted = true\n end", "def push_interrupt(e); end", "def call(env)\n return handle_logout(env) if is_logout_request?(env)\n\n set_auth_header(env)\n\n request_body = env[:body] # After failure env[:body] is set to the response body\n\n @app.call(env).on_complete do |response_env|\n if response_env[:status] == 401 # Unauthorized\n delete_token_store_key\n\n if @settings.autologin\n env[:body] = request_body\n set_auth_header(env)\n return @app.call(env)\n end\n end\n end\n end", "def shutdown(options)\n # TODO Nothing implemented yet for Provision call\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Shutdown NOT YET IMPLEMENTED\"\n end", "def power_off\n requires :id\n begin\n response = service.post_power_off_vapp(id)\n rescue Fog::VcloudDirector::Compute::BadRequest => ex\n Fog::Logger.debug(ex.message)\n return false\n end\n service.process_task(response.body)\n end", "def act\n exit 1\n end", "def act\n exit 1\n end", "def cmd_restart argv\n setup argv\n response = @api.restart\n msg response\n return response\n end", "def call env\n return @app.call(env) unless env['rails3amf.response']\n\n # Handle each method call\n req = env['rails3amf.request']\n res = env['rails3amf.response']\n res.each_method_call req do |method, args|\n begin\n handle_method method, args, env\n rescue Exception => e\n # Log and re-raise exception\n @logger.error e.to_s+\"\\n\"+e.backtrace.join(\"\\n\")\n raise e\n end\n end\n end", "def call(env)\n super\n perform_request env\n @app.call env\n end", "def call\n context.response ||= notify\n end", "def reenable_on_interrupt; end", "def signal_restart_graceful\n @signal_operation_queue << :restart_graceful\n interrupt_server_polling_sleep\n nil\n end", "def shutdown!\n running!(false)\n @apps << @current_app\n\n backup!\n upload!\n exit\n end", "def index\n permission_denied if !is_adm?\n @termination_requests = TerminationRequest.where(\"app_status = 0\")\n end", "def close_app\n @bridge.close_app\n end", "def destroy\n @app = App.find(params[:id].to_i) rescue nil\n respond_to do |format|\n if @app\n success = @app.try(:deactivate!) rescue false\n\n if success\n format.xml { head :accepted }\n format.json { head :accepted }\n else\n format.xml { render :xml => app_presenter, :status => :precondition_failed }\n format.json { render :json => app_presenter, :status => :precondition_failed }\n end\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end", "def app_restart\n return unless restart_required?\n callback(:app_restart) do\n notify(:app_restart)\n heroku.app_restart\n end\n end", "def reboot_vapp(vAppId)\n power_action(vAppId, 'reboot')\n end", "def restart\n invoke :stop, :all => input[:all], :apps => input[:apps]\n\n line unless quiet?\n\n input[:apps].each do |app|\n unless input[:command].nil?\n app.command = input[:command]\n end\n app.update!\n end\n\n invoke :start, :all => input[:all], :apps => input[:apps],\n :debug_mode => input[:debug_mode]\n end", "def call(env)\n Maglev.abort_transaction\n r = @app.call env\n ensure\n # Don't abort if ! committable? since next request will abort anyway\n Maglev.commit_transaction if committable? r[0]\n end", "def call_failure_app(env, opts = {})\n if env['warden'].custom_failure?\n opts[:original_response]\n else\n env[\"PATH_INFO\"] = \"/#{opts[:action]}\"\n env[\"warden.options\"] = opts\n\n # Call the before failure callbacks\n Warden::Manager._before_failure.each{|hook| hook.call(env,opts)}\n\n @failure_app.call(env).to_a\n end\n end", "def handled_requested_user_app_not_available\n return if app_type_requested_id\n\n msg = 'This app is not available'\n respond_to do |type|\n type.html do\n flash[:warning] = msg\n redirect_to '/'\n end\n type.json do\n render json: { message: msg }, status: 401\n end\n end\n true\n end", "def halt; end", "def halt; end", "def run\n # rubocop:disable Style/SignalException\n # Parameter 'id' should be of type String\n\n id = unsafe_params[:id]\n fail \"App ID is not a string\" unless id.is_a?(String) && id != \"\"\n\n # Name should be a nonempty string\n name = unsafe_params[:name]\n fail \"Name should be a non-empty string\" unless name.is_a?(String) && name != \"\"\n\n # Inputs should be a hash (more checks later)\n inputs = unsafe_params[\"inputs\"]\n fail \"Inputs should be a hash\" unless inputs.is_a?(Hash)\n\n job_limit = params[:job_limit].to_f.zero? ? current_user.job_limit : params[:job_limit].to_f\n fail \"Job limit exceeds maximum user setting - #{current_user.job_limit}\" if job_limit > current_user.job_limit\n\n run_instance_type = unsafe_params[:instance_type]\n\n fail I18n.t(\"app_instance_type_forbidden\") unless current_user.resources.include?(run_instance_type)\n\n # App should exist and be accessible and runnable by a user.\n @app = App.find_by!(uid: id)\n\n fail I18n.t(\"app_not_accessible_or_runnable\") unless @app.runnable_by?(current_user)\n\n # Check if asset licenses have been accepted\n unless @app.assets.all? { |a| a.license.blank? || a.licensed_by?(@context) }\n fail \"Asset licenses must be accepted\"\n end\n\n # Call JupiterLab service if https app is running\n if @app.https?\n https_apps_client = DIContainer.resolve(\"https_apps_client\")\n input_info = input_spec_preparer.run(@app, inputs)\n\n fail input_spec_preparer.first_error unless input_spec_preparer.valid?\n\n result =\n begin\n https_apps_client.app_run(\n @app.dxid,\n name: name,\n instanceType: run_instance_type,\n jobLimit: job_limit,\n scope: Scopes::SCOPE_PRIVATE,\n input: input_info.run_inputs,\n )\n rescue HttpsAppsClient::Error => e\n fail e.message\n end\n\n job = Job.find_by!(dxid: result[\"dxid\"])\n\n render(json: { id: job.uid }) && return\n end\n\n space_id = unsafe_params[:space_id]\n\n fail \"Invalid space_id\" if space_id && !@app.can_run_in_space?(@context.user, space_id)\n\n space = Space.find_by(id: space_id)\n # Inputs should be compatible\n # (The following also normalizes them)\n input_info = input_spec_preparer.run(@app, inputs, space&.accessible_scopes)\n\n fail input_spec_preparer.first_error unless input_spec_preparer.valid?\n\n if space\n project = space.project_for_user(@context.user)\n permission = space.have_permission?(project, @context.user)\n fail \"You don't have permissions to run app in space #{space.name}\" unless permission\n else\n project = @context.user.private_files_project\n end\n\n job = job_creator(project).create(\n app: @app,\n name: name,\n input_info: input_info,\n run_instance_type: run_instance_type,\n job_limit: job_limit,\n scope: space&.uid,\n )\n\n SpaceEventService.call(space_id, @context.user_id, nil, job, :job_added) if space&.review?\n # rubocop:enable Style/SignalException\n\n render json: { id: job.uid }\n end", "def reenable_on_interrupt=(_arg0); end", "def action_reload\n return if options['never_reload']\n notify_if_service do\n service_resource.run_action(:hup)\n end\n end", "def status\n @app = ThirdpartyService.get_app(@url, AUTH, @http, @body)\n if @app['code'] != nil\n session[:toast_type] = 'error'\n session[:toast_message] = @app['errors'][0]['message']\n redirect_to app_list_path\n return\n end\n # Display success message\n session[:toast_type] = 'status'\n session[:toast_message] = 'App ' + params[:status] + 'ed successfully'\n end", "def stop\n yield self if block_given?\n http.post('/__admin/shutdown', '')\n end", "def terminate_interaction(exit_code = 0)\n ui.terminate_interaction exit_code\n end", "def call(env)\n app.call(env)\n rescue => error\n render_exception(error)\n end", "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", "def hide app\n app.perform :hide\n end", "def halt\n end", "def stop\n action('stop')\n end", "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", "def signal_restart_forced\n @signal_operation_queue << :restart_forced\n interrupt_server_polling_sleep\n nil\n end", "def app_wired_actions\n @hash[I_AM_APP_NOT_A_MIDDLEWARE]\n end", "def stop_action\n action(:stop)\n end", "def pop_interrupt; end", "def respond_to_launch\r\n if Applications.light_on?\r\n response = turn_light_off\r\n else\r\n response = turn_light_on\r\n end\r\n end", "def action_reload\n return if options['never_reload']\n if !upstart_features[:reload_signal] && new_resource.reload_signal != 'HUP'\n if options[:reload_shim]\n Process.kill(new_resource.reload_signal, pid)\n else\n check_reload_signal!\n end\n else\n super\n end\n end", "def render_action(action, params)\n send(action, params)\n \n rescue RenderExit, ActionExit => e1\n # Just stop rendering. \n \n rescue ActionError => e2\n # Client Error family of errors, typically send 4XX\n # status code.\n handle_error(e2, 404)\n error e2.to_s\n \n rescue Object => e3\n # Server Error family of errors, typically send 5XX\n # status code. \n handle_error(e3, 500)\n error \"Error while handling #{self.class}##{action.to_s.gsub(/___super$/, '')}(#{params.join(', ')})\"\n error pp_exception(e3)\n end", "def intent_listen_stop\n\tbegin\n\t\tdata = { 'myData' => 'This is broadcast data 5!' }\n\t\tif @params['par']\n\t\t\tcase @params['par']\n\t\t\twhen '411'\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"com.rhomobile.BROADCAST\",[\"com.rhomobile.compliancetestruby\"],\"\",\"\",\"\",\"\",data)\n\t\t\twhen '412'\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"\",\"\",\"compliancetestruby\",\"\",\"\",\"\",data)\t\t\t\t\t\n\t\t\twhen '413'\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"\",\"\",\"rhomobile compliancetest_ruby/compliancetestruby.exe\",\"\",\"\",\"\",data)\n\t\t\telse\n\t\t\tend\n\t\tend\n\t\tRho::Intent.startListening(url_for(:action => :listen_callback))\n\t\tRho::Intent.stopListening()\n Rho::Intent.send(@result)\n\trescue => ex\n\t\tjsmethod = 'Ruby.sendValueToJS(\"' + ex.message + '\")'\n\t\tRho::WebView.executeJavascript(jsmethod)\n\tend\nend", "def cancel\n end", "def cancel\n end", "def call(env)\n begin\n @status, @headers, @response = @app.call(env)\n rescue => exception\n raise if configuration.raise_errors?\n\n error = Error.new(exception)\n\n unless error.ignore?\n $stderr.print error.formatted\n configuration.monitors.each { |monitor| monitor.report(exception) }\n end\n\n @status = error.status\n @response = Response.build(error)\n @headers = { \"Content-Type\" => \"application/json\" }\n end\n [@status, @headers, @response]\n end", "def call_cancel_handler; call_handler(:cancel); end", "def ask_for_action\n @response.gather(numDigits: 1) do |g|\n g.say('To call Julien directly, press 1. To leave a message, press 2.')\n end\n end", "def call(env)\n timeout = env.config[:timeout] || 30.0\n http = HTTP.timeout(\n write: timeout,\n connect: timeout,\n read: timeout\n )\n http = http.headers(env.headers)\n env.response = http.send(env.method, env.uri, body: env.body)\n @app.call(env)\n end", "def exit_application\n @view.close\n end", "def call(env)\n if @started || @attempts > MAX_ATTEMPTS\n @app.call(env)\n else\n attempt_to_start_agent\n @app.call(env)\n end\n end", "def call\n\n catch(:KenjiRespondControlFlowInterrupt) do\n path = @env['PATH_INFO']\n\n # deal with static files\n static = \"#{@root}public#{path}\"\n return Rack::File.new(\"#{@root}public\").call(@env) if File.file?(static)\n\n\n # new routing code\n method = @env['REQUEST_METHOD'].downcase.to_sym\n\n segments = path.split('/')\n # ensure existence of leading /'s empty segment\n segments = segments.unshift('') unless segments.first == ''\n\n out = ''; success = false\n catch(:KenjiPass404) do\n if @options[:root_controller]\n controller = controller_instance(@options[:root_controller])\n subpath = segments.join('/')\n out = controller.call(method, subpath).to_json\n success = true\n else\n acc = ''; out = ''; success = false\n while (head = segments.shift)\n acc = \"#{acc}/#{head}\"\n # if we have a valid controller\n if (controller = controller_for(acc))\n subpath = '/' + segments.join('/')\n out = controller.call(method, subpath).to_json\n success = true\n break\n end\n end\n end\n end\n\n return response_404 unless success\n\n [@status, @headers, [out]]\n end\n rescue => e\n raise e unless @options[:catch_exceptions]\n # log exceptions\n @stderr.puts(e.inspect)\n e.backtrace.each {|b| @stderr.puts \" #{b}\" }\n response_500(e)\n end" ]
[ "0.588825", "0.58818674", "0.5866574", "0.58584696", "0.5811454", "0.5787179", "0.559499", "0.5568169", "0.55119276", "0.5457707", "0.54421526", "0.5407973", "0.5385463", "0.5358723", "0.53414655", "0.5327235", "0.5316561", "0.5291737", "0.5286817", "0.5280862", "0.52734905", "0.5266986", "0.52625287", "0.5249671", "0.5249535", "0.5236922", "0.52288675", "0.5222344", "0.5214366", "0.52035004", "0.51904625", "0.5185414", "0.51576596", "0.515228", "0.51452655", "0.51245856", "0.51199585", "0.50938356", "0.50900275", "0.5089839", "0.508468", "0.5082049", "0.5065301", "0.5052082", "0.5050671", "0.5047999", "0.5045639", "0.5036759", "0.50354165", "0.50307935", "0.5026327", "0.5017139", "0.5017139", "0.5014338", "0.5013061", "0.5013013", "0.5008737", "0.50025743", "0.49999243", "0.49927184", "0.49896786", "0.49798843", "0.4979778", "0.49733156", "0.49670258", "0.4966946", "0.49603385", "0.49511606", "0.49508542", "0.49505538", "0.49505538", "0.4947291", "0.4936085", "0.49266005", "0.49204814", "0.4910462", "0.4894829", "0.4889454", "0.48874068", "0.48792085", "0.4875255", "0.4871659", "0.4867869", "0.48649845", "0.48617044", "0.48535568", "0.485326", "0.48515862", "0.48449245", "0.4844611", "0.48415732", "0.48357603", "0.48357603", "0.48290315", "0.4824653", "0.4824375", "0.4821778", "0.48167318", "0.48166117", "0.4815329" ]
0.5429343
11
Routes the request to different logic.
def reroute(path, method = nil) request.setup(path, method) call_stack(:before, :route) call_stack(:after, :match) @router.reroute(request) call_stack(:after, :route) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_http_request\n route_http_request\n end", "def route() request.route end", "def handle_routes\n instance_exec(@_roda_app.request, &self.class.router_block)\n end", "def run(req, res)\n # The #run method will figure out what URL was requested, match it to\n # the path regex of one Route object, and finally ask the Route to\n # instantiate the appropriate controller, and call the appropriate method.\n end", "def route\n #TODO\n end", "def process(context)\n request = context.request\n\n router = @processor_map[request.request_method.downcase.to_sym]\n return 404 unless router\n begin\n processor, params = router.routing(request.path)\n rescue FancyServer::PathRouter::NoRouteMatched\n return 404\n rescue FancyServer::PathRouter::DestinationDuplicated => ex\n return {:status => 503, :body => ex.message}\n end\n return 404 unless processor\n context.params.merge!(params)\n processor.respond_to?(:to_proc) ? context.instance_eval(&processor) : processor\n end", "def process(request); end", "def route_request\n env.logger.debug \"#{self.class} ROUTING - #{env[Goliath::Request::PATH_INFO]}\"\n if has_path = ( env[Goliath::Request::PATH_INFO] =~ /^\\/(\\w+)(\\/\\w+)*/ )\n env.logger.debug \"#{self.class} route_request:\\t pathinfo = #{$1} extended = #{$2}\"\n path_info = $1\n extended_path_info = $2\n has_path = true #it will be a number or nil - let's just make it a bool\n elsif params[:id]\n has_path = true\n end\n \n method = env[Goliath::Request::REQUEST_METHOD]\n action = case method\n when 'GET'\n has_path ? 'show' : 'index'\n when 'POST'\n has_path ? ( raise BadRequestError, \"can't post to this resource\" ) : 'create'\n when 'PUT'\n !has_path ? ( raise BadRequestError, \"no resource to PUT to\" ) : 'update'\n when 'DELETE'\n !has_path ? ( raise BadRequestError, \"no resource to DELETE\" ) : 'delete'\n else\n raise MethodNotAllowedError, \"unknown request method\"\n end\n env.logger.info \"#{self.class} route_request:\\t attempting to call #{action} action\"\n if self.respond_to?(action, true) #second param includes private methods\n env['params']['id'] = params[:id] || (path_info if has_path)\n self.send(action)\n else\n error_on MethodNotAllowedError, \"#{action} not supported for this resource\"\n end\n end", "def any(path, &block)\n route 'GET', path, &block\n route 'POST', path, &block\n end", "def process(request_hash)\n request = Request.new(request_hash)\n case request.path\n when '/'\n index_route(request)\n when %r{^/sleep/\\d+$}\n sleep_route(request)\n else\n Response.new(\n \"No route found for #{request.path}. Try '/' or '/sleep/3'.\",\n status: 404\n )\n end\n end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def handle(request, env)\n params = @params.dup\n path_info, script_name = env[\"PATH_INFO\"], env[\"SCRIPT_NAME\"]\n \n return unless request_conditions.all? do |method_name, condition|\n # TODO: Refactor this... it lacks awesome\n next true unless request.respond_to?(method_name)\n matched, captures = condition.match(request)\n if matched\n params.merge!(captures)\n if method_name == :path_info\n new_path_info = @path_info.dup if @path_info\n new_path_info ||= env[\"PATH_INFO\"].sub(/^#{Regexp.escape(matched)}/, '')\n new_path_info.gsub!(SEGMENT_REGEXP) { |s| params[$2.to_sym] }\n env[\"SCRIPT_NAME\"] = Utils.normalize(request.env[\"SCRIPT_NAME\"] + matched)\n env[\"PATH_INFO\"] = Utils.normalize(new_path_info)\n end\n true\n end\n end\n \n env[\"rack_router.route\"] = self\n env[\"rack_router.params\"].merge! params\n \n @app.call(env)\n ensure\n env[\"PATH_INFO\"], env[\"SCRIPT_NAME\"] = path_info, script_name\n end", "def call(request)\n compile! unless compiled?\n pattern, verb, params = *parse_request(request)\n pattern = pattern.encode(Encoding.default_external)\n candidacies = match_with(pattern)\n raise_exception(404) if candidacies.empty?\n candidacies, allows = *candidacies.partition{ |route| route.verb == verb }\n raise_exception(405, :verbs => allows.map(&:verb)) if candidacies.empty?\n candidacies.map{ |route| [route, route.params_for(pattern, params)] }\n end", "def routes(&block); end", "def routes(&block); end", "def run(req, res)\n parse_http_methods!(req)\n matching_route = match(req)\n if matching_route\n matching_route.run(req, res)\n else\n res.status = 404\n res.write \"404 route not found\"\n end\n end", "def route_index; end", "def dispatch(name, req, res); end", "def handle( request ) # note: all 'handle's return 'ml_response' in a chain\n\n ml_response =\n case\n when request.get? then handle_get_muffin(request)\n when request.post? then handle_post(request)\n end\n end", "def do_dispatch(env)\n path = env['PATH_INFO']\n\n # Try to serve a public file\n ret = dispatch_public(env, path)\n return ret if not ret.nil?\n\n log.debug \"Checking for routes that match: #{path}\"\n route = router.match(env)\n\n if route.has_key? :ok\n dispatch_controller(route, env)\n else\n [404, {\"Content-Type\" => \"text/plain\"}, [\"404 Not Found: #{path}\"]]\n end\n end", "def handle_request request, usecase=Usecase, &block\n usecase = build_usecase( request, usecase, &block )\n usecase.response\n end", "def match(req)\n end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def run(req, res)\n if req.body\n check_method_param(req)\n end\n route = match(req)\n if route.nil?\n res.status = 404\n res.body = \"Cannot find route for #{req.request_method} #{req.path}\"\n else\n route.run(req, res)\n end\n end", "def process_request(public_request_id) \n\n # parse the URL into verb, resources, options, and body\n @active_requests[public_request_id][:public_request].match /(GET|POST) \\/(\\S*)(.*)^(.*)\\Z/m\n parsed_requests, new_requests, request_resources = [$1, $2, $3, $4], {}, $2\n\n ## handle / (GENERIC) resource requests ##\n if request_resources.empty?\n new_requests = process_generic_request(parsed_requests, public_request_id)\n\n ## handle /TEST_POST/ resource request ##\n elsif request_resources.match /test_post/\n new_requests = process_form_request(parsed_requests, public_request_id)\n \n ## handle ALL OTHER requests ##\n else\n parsed_resources = parsed_requests[1].split(\"/\")\n device_match = ::ArduinoGateway::Model::ModelTemplates::ResourceDevice.find_by_name(parsed_resources[0])\n\n # handle requests for DEVICE-BASED SERVICES\n unless device_match.empty?\n new_requests = process_device_request(parsed_requests, parsed_resources, device_match, public_request_id) \n # handle requests for SERVICES ACCROSS DEVICES\n else \n new_requests = process_service_request(parsed_requests, parsed_resources, device_match, public_request_id)\n end\n\n end # else related to ALL OTHER requests\n\n new_requests.each { | name, request | make_request request }\n @active_requests[public_request_id][:arduino_requests] = new_requests\n end", "def routes\n raise NotImplementedError\n end", "def router; end", "def call(env)\n request = Rack::Request.new(env)\n if redirect_trailing_slash? && (request.head? || request.get?) && request.path_info[-1] == ?/\n response = Rack::Response.new\n response.redirect(request.path_info[0, request.path_info.size - 1], 302)\n response.finish\n else\n response = recognize(request)\n env['router'] = self\n if response.is_a?(RoutingResponse)\n [response.status, response.headers, []]\n elsif response && response.route.dest && response.route.dest.respond_to?(:call)\n process_params(env, response)\n consume_path!(request, response) if response.partial_match?\n response.route.dest.call(env)\n else\n @default_app.call(env)\n end\n end\n end", "def custom_routes; end", "def _routes; end", "def routes\n request :get, '/routes'\n end", "def run(req, res)\n first_matched_route = match(req)\n\n if first_matched_route\n first_matched_route.run(req, res)\n else\n res.status = 404\n res.write(\"No route matches for #{req.request_method} for #{req.path}\")\n end\n end", "def handle_request(request)\n if request =~ /^(\\w+)\\s+(.*)\\s+HTTP/ then\n r_type = $1.downcase.to_sym\n path = $2\n log(\"Request: [#{r_type}] '#{path}'\")\n found = false\n value = nil\n @handlers.each do |handler|\n if handler[:methods].index(r_type) != nil and handler[:expr].match(path) then\n found = true\n value = handler[:handler].call(self, path, Regexp.last_match)\n break\n end\n end\n (found and value) ? value : respond_resource_not_found(path)\n else\n make_response(type = \"text/html\", compressed = false, code = 400, msg = \"Bad Request\")\n end\n end", "def call env\r\n raw = nil\r\n self.class.env = env\r\n #\r\n # match route\r\n # support : String, Regexp\r\n # rel - nil| body| [status,{header},[bodys]]\r\n #\r\n req = Rack::Request.new env\r\n self.class.params = req.params\r\n method = env[\"REQUEST_METHOD\"].downcase\r\n settings[:route][method.to_sym].each do |p|\r\n case p[:path]\r\n when String\r\n if env[\"REQUEST_PATH\"] == p[:path]\r\n raw = p[:proc].call\r\n end\r\n when Regexp\r\n if env[\"REQUEST_PATH\"] =~ p[:path]\r\n if !p[:extend_key].nil? # analize extend_params like /hehe/:id\r\n req.params[p[:extend_key].to_sym] = $1\r\n end\r\n raw = p[:proc].call\r\n end\r\n else\r\n throw :illegal_route\r\n end\r\n end\r\n #\r\n # anaylize raw\r\n # nil - return not_found\r\n # Array - return raw if match [fixnum, hash, array]\r\n # other - return [200, {}, [other.to_s]]\r\n #\r\n status = 200\r\n header = {}\r\n bodys = \"\"\r\n if raw.nil?\r\n not_found\r\n else\r\n bodys = raw\r\n if Array === raw\r\n status = raw[0]\r\n header = raw[1]\r\n bodys = raw[2]\r\n end\r\n if settings[:json] == true\r\n bodys = bodys.to_json\r\n end\r\n if Array === bodys\r\n bodys = bodys.map{|e| e.to_s}\r\n [status, header, bodys]\r\n else\r\n [status, header, [bodys.to_s]]\r\n end\r\n end\r\n end", "def call(env)\n route = @routes.map do |exp, meta|\n next unless matches = env[\"PATH_INFO\"].match(exp)\n meta.merge(captures: matches)\n end.compact.first\n\n return Yokunai::ErrorsController.new(env).not_found unless route\n\n request_method = env[\"REQUEST_METHOD\"]\n if route[:methods].include?(request_method)\n Object.const_get(route[:class])\n .new(env, route[:captures])\n .public_send(request_method.downcase)\n else\n Yokunai::ErrorsController.new(env).unsupported_method\n end\n end", "def call(env)\n @request = Rack::Request.new(env)\n verb = @request.request_method\n requested_path = @request.path_info\n handler = @routes.fetch(verb, {}).fetch(requested_path, nil)\n\n if handler\n # give handler access to all of the methods, on the instance of Nancy::Base\n result = instance_eval(&handler)\n # If a handler returns a string, assume that it is a successful response, and so we construct a successful Rack response\n # otherwise, we return the result of the block as-is\n # [status, header, body]\n if result.class == String\n [200, {}, [result]]\n else\n result\n end\n else\n [404, {}, [\"Oops! No route for #{verb} #{requested_path}\"]]\n end\n end", "def call(env)\n # Grab the verb and requested path from the env parameter\n @request = Rack::Request.new(env)\n verb = @request.request_method\n requested_path = @request.path_info\n\n # Grab the handler block from @routes if it exists\n handler = @routes.fetch(verb, {}).fetch(requested_path, nil)\n\n if handler\n # Evaluate our route handler block in the context of that instance,\n # to give it access to all of the methods (Compare: handler.call)\n result = instance_eval(&handler)\n\n if result.class == String\n # For convenience, if a handler returns a string,\n # assume that it is a successful response.\n [200, {}, [result]]\n else\n # Otherwise, return the result of the block as-is.\n result\n end\n else\n # Return a 404 with a custom error message\n # instead of the default Internal Server Error\n [404, {}, [\"Oops! No routes for #{verb} #{requested_path}\"]]\n end\n end", "def request_and_handle http_method, path, options\n if http_method.is_a?(String) || http_method.is_a?(Symbol)\n http_method = HTTP_METHODS[http_method.to_s]\n raise \"Unknown http method: #{http_method}\" unless http_method\n end\n \n req_options = default_options.dup\n req_options = req_options.merge(options)\n \n raise ConfigurationError.new \"No endpoint defined\" if !path || path.empty?\n raise ConfigurationError.new \"No hostname defined\" if !req_options[:base_uri] || req_options[:base_uri].empty?\n \n # prepare request\n req = HTTParty::Request.new http_method, path, req_options\n\n # Sanitized request for logs\n safe_req_options = strip_unsafe_params(http_method, req_options)\n req_to_output = HTTParty::Request.new http_method, path, safe_req_options\n req_for_airbrake = { :method => http_method, :path => path, :options => safe_req_options }\n\n begin\n response = req.perform\n rescue => ex\n raise CityGridExceptions::RequestError.new req_for_airbrake, ex\n ensure\n if CityGrid.print_curls? \n if defined?(Rails.logger)\n Rails.logger.info req_to_output.to_curl\n else\n puts req_to_output.to_curl\n end\n end\n end\n\n \n begin \n # catch unparsable responses (html etc)\n if !response.parsed_response.is_a?(Hash)\n #pp \"[gem] the response was unparsable (response was not a hash)\"\n raise CityGridExceptions::ResponseParseError.new req_for_airbrake, response\n # catch responses not in new response format\n elsif response[\"errors\"]\n #pp \"[gem] An error in the old response format was caught. Raising a general response error...\"\n raise CityGridExceptions::ResponseError.new req_for_airbrake, response[\"errors\"], response\n\n # Parse and handle new response codes \n elsif (response[\"response\"] && response[\"response\"][\"code\"] != \"SUCCESS\") && \n (response[\"response\"] && response[\"response\"][\"code\"] != 200) && \n (response[\"response\"] && response[\"response\"][\"code\"] != 400) \n error_code = response[\"response\"][\"code\"]\n #pp \"[gem] The response was contained in the first level of the response hash. Below:\"\n #pp response\n #pp \"found error code: #{error_code}\"\n #pp \"****************************************************************************\"\n raise CityGridExceptions.appropriate_error(error_code).new req_for_airbrake, response, response[\"response\"][\"message\"].to_s #+ \" \" + CityGridExceptions.print_superclasses(error_code)\n # if the response is a nested hash/nested hash containing arrays\n elsif response[\"totalNumEntries\"] && response[\"response\"].nil?\n #pp \"[gem] now parsing a response with multiple entries: #{response}\"\n error_code = parse_multiple_responses(response)\n #pp \"the error code that came back is #{error_code}\"\n if error_code.nil? || error_code == []\n #pp \"[gem] passing over this for now\"\n return CityGrid::API::Response.new response # pass over for now\n elsif error_code[0] == \"SUCCESS\" || error_code[0] == 200 || error_code[0] == 400\n return CityGrid::API::Response.new response\n else \n #pp \"[gem] we found an error and it was #{error_code[1]}\"\n raise CityGridExceptions.appropriate_error(error_code[0]).new req_for_airbrake, response, error_code[1].to_s + \" \"# + CityGridExceptions.print_superclasses(error_code[0])\n end\n else\n return CityGrid::API::Response.new response\n end\n rescue => ex\n pp \"The gem threw an error: #{ex}\"\n raise ex if CityGrid.raise_errors?\n end\n end", "def primary(request, element)\n # TODO: see if it's faster to compare either\n # by `:java_class`, `:instance_of?` or `:code`\n case\n when request.instance_of?(Cf::GETRequest)\n @route.call(:get, request, element)\n when request.instance_of?(Cf::PUTRequest)\n @route.call(:put, request, element)\n when request.instance_of?(Cf::POSTRequest)\n @route.call(:post, request, element)\n when request.instance_of?(Cf::DELETERequest)\n @route.call(:delete, request, element)\n else\n request.respond(CR[:bad_request])\n end\n end", "def call(env)\n request = Rack::Request.new(env)\n\n # Return early if request is not a GET\n return @app.call(env) unless request.get?\n\n # Return early if request is within backend or Active Storage path directory\n backend_path = \"/#{Integral.backend_namespace}/\"\n return @app.call(env) if request.path_info.starts_with?(backend_path) || request.path_info.starts_with?(ActiveStorage.routes_prefix)\n\n # Rewrites path if the request linked to an Integral::Page or Integral::Category\n process_path(env, request)\n\n @app.call(env)\n end", "def request_method\n {:filter => :post,\n :sample => :get,\n :firehose => :get,\n :retweet => :get\n }.fetch(@path, :get)\n end", "def request_and_handle http_method, path, options\n if http_method.is_a?(String) || http_method.is_a?(Symbol)\n http_method = HTTP_METHODS[http_method.to_s]\n raise \"Unknown http method: #{http_method}\" unless http_method\n end\n \n req_options = default_options.dup\n req_options = req_options.merge(options)\n \n raise ConfigurationError.new \"No endpoint defined\" if !path || path.empty?\n raise ConfigurationError.new \"No hostname defined\" if !req_options[:base_uri] || req_options[:base_uri].empty?\n \n # prepare request\n req = HTTParty::Request.new http_method, path, req_options\n req.options[:timeout] = CityGrid.custom_timeout if req.options && CityGrid.custom_timeout_set?\n\n # Sanitized request for logs\n safe_req_options = strip_unsafe_params(http_method, req_options)\n req_to_output = HTTParty::Request.new http_method, path, safe_req_options\n req_for_airbrake = { :method => http_method, :path => path, :options => safe_req_options }\n\n begin\n response = req.perform\n rescue => ex \n if defined?(Rails.logger)\n Rails.logger.error safe_req_options\n Rails.logger.error req_to_output\n Rails.logger.error req_for_airbrake\n Rails.logger.error ex\n end\n raise CityGridExceptions::RequestError.new req_for_airbrake, nil, ex.message, req_to_output.to_curl\n ensure\n if CityGrid.print_curls? \n if defined?(Rails.logger)\n Rails.logger.info req_to_output.to_curl\n puts req_to_output.to_curl\n else\n puts req_to_output.to_curl\n end\n end\n end\n\n response_status = parse_response_status response\n \n begin \n # catch unparsable responses (html etc)\n if !response.parsed_response.is_a?(Hash)\n #pp \"[gem] the response was unparsable (response was not a hash)\"\n raise CityGridExceptions::ResponseParseError.new req_for_airbrake, response, \"the response was unparsable (response was not a hash)\", req_to_output.to_curl\n else\n # Parse and handle new response codes \n if !response_status.nil? && response_status[\"code\"] != \"SUCCESS\" && response_status[\"code\"] != 200\n raise CityGridExceptions.appropriate_error(response_status[\"code\"]).new req_for_airbrake, response, response_status[\"message\"].to_s, req_to_output.to_curl\n else\n return CityGrid::API::Response.new response\n end\n end\n rescue => ex\n pp \"API ERROR: #{ex}\"\n raise ex if CityGrid.raise_errors?\n end\n end", "def call(env)\n @request = Dolphy::Request.new(env)\n @response = Dolphy::Response.new\n\n router.find_route_for(request).each do |matcher, block|\n if match = router.find_match_data_for(request, with: matcher)\n response.body = [block.call(*match.captures)]\n end\n end\n\n response.status = 404 if response.body.empty?\n response.body << \"Page not found.\" if response.body.empty?\n response.finish\n end", "def perform(request, response); end", "def handle( request ) # note: all 'handle's return 'ml_response' in a chain\n\n# not yet request.record_arrival_time\n ml_response =\n case\n when request.get? then handle_get_muffin(request)\n when request.post? then handle_post(request)\n end\n# not yet request.record_completion_time\n ml_response\n end", "def run(req, res)\n @route_params = {}\n\n # I need to build route_params from the URL params\n # @pattern is the regexp\n match_data = @pattern.match(req.path)\n # * @pattern is the regexp given in the router.draw block in\n # p06_router_server.rb\n # * req.path is the url we are matching against\n # match_data gives us the MatchData object\n match_data.names.each do |name|\n @route_params[name] = match_data[name]\n end\n #this loop creates the params!\n\n controller_instance = @controller_class.new(req, res, @route_params)\n controller_instance.invoke_action(@action_name)\n end", "def run(req, res)\n match_data = pattern.match(req.path)\n # hash = {}\n # match_data.names.each do |name|\n # hash[name] = match_data[name]\n # end\n hash = match_data.names.each_with_object({}) do |name, h|\n h[name] = match_data[name]\n end\n controller_class.new(req, res, hash).invoke_action(action_name)\n end", "def call(env)\n route = self.route(env)\n if route\n env['params'] = route.match(env) || {}\n route.call(env)\n else\n env['params'] = {}\n not_found.call(env)\n end\n end", "def call(request); end", "def run(req, res)\n match_data = @pattern.match(req.path)\n\n route_params = {}\n match_data.names.each do |name|\n route_params[name] = match_data[name]\n end\n\n @controller_class.new(req, res, route_params).invoke_action(action_name)\n end", "def run(req, res)\n matched_route = match(req)\n if matched_route\n matched_route.run(req, res)\n else\n res.status = 404\n res.write(\"No route matches #{req.fullpath}\")\n end\n end", "def receive(request); end", "def call(env)\n request = Rack::Request.new(env)\n raise_exception(400) unless valid_verb?(request.request_method)\n recognize(request).each do |route, params|\n catch(:pass){ return invoke(route, params) }\n end\n rescue BadRequest, NotFound, MethodNotAllowed\n $!.call\n end", "def middleware; end", "def GET; end", "def _roda_handle_route\n catch(:halt) do\n @_request.block_result(yield)\n @_response.finish\n end\n end", "def conditions(host,port,verb,path,query)\n\t response=nil\n if path.include?(\"/blue/\") \n host=\"doom.zoom.com\"\n port=9141\n elsif port==9142\n host=\"doom2.zoom.com\"\n port=9141\n elsif path.match(/myregularexpression/)\n host=\"doom.zoom.com\"\n port=9134\n elsif port==443 and path.match(/myregularexpression/) and verb==\"POST\"\n host=\"doom.zoom.com\"\n port=9157\n\t #when adding autoresponses only the path and the verb can be used to select\t\n\t elsif path.include?(\"/cp/xala/\")\n\t\tresponse=[200, {'Content-Type' => 'application/json'}, \n\t\t { \n\t\t\tname: 'Peter Daily',\n\t\t\tcity: 'New York',\n\t\t\tisClient: false,\n\t\t\tcurrency: 'EUR',\n\t\t\tbalance: 4663\n\t\t }.to_json\n\t\t]\n\t #when adding autoresponses only the path and the verb can be used to select\t\n\t elsif path.include?(\"/cp/alabi/\")\n\t\tresponse=[200, {'Content-Type' => 'application/json'}, \n\t\t { \n\t\t\tname: 'Mario',\n\t\t\tcity: 'London',\n\t\t\tisClient: true,\n\t\t\tcurrency: 'EUR',\n\t\t\tbalance: 323\n\t\t }.to_json\n\t\t]\n end\n if !response.nil? #to use rack for autoresponses\n\t\thost=\"localhost\"\n\t\tport=9292\n\t end\n return host,port,verb,path,query,response\n \n end", "def run(request, response)\n\n match_data = @pattern.match(request.path)\n\n route_params = Hash[match_data.names.zip(match_data.captures)]\n\n @controller_class\n .new(request, response, route_params)\n .invoke_action(action_name)\n end", "def route_request_with(event_data, hold_request, timestamp)\n owner = \"\"\n\n if event_data == nil || event_data.count == 0 || event_data[\"owningInstitutionId\"] == nil\n $logger.error \"Request data missing key information. Cannot proceed. Malformed request. #{event_data}\"\n else\n owner = event_data[\"owningInstitutionId\"].downcase\n end\n\n if owner.scan('nypl').empty?\n $logger.info \"Processing partner hold\"\n\n response = SierraRequest.process_partner_item(event_data)\n\n RequestResult.process_response(response, 'AcceptItemRequest', event_data, hold_request, timestamp)\n\n elsif owner != \"\"\n $logger.info \"Processing NYPL hold\"\n\n response = SierraRequest.process_nypl_item(event_data)\n\n RequestResult.process_response(response, 'SierraRequest', event_data, hold_request, timestamp)\n end\n end", "def dispatch!\n \n # negotiates initial configuration\n @meta = self.negotiate!\n \n # dispatches hash set to the server\n self.dispatch_hashing!\n self.dispatch_hashset!\n \n # dispatches orders\n self.dispatch_orders!\n \n # dispatches messages\n self.handle_messages!\n \n end", "def _roda_handle_main_route\n catch(:halt) do\n r = @_request\n r.block_result(_roda_run_main_route(r))\n @_response.finish\n end\n end", "def call request, response\n\t\t\t\tbegin\n\t\t\t\t\thost = get_host(request[:host_name].to_s.downcase) || @hosts[:default]\n\t\t\t\t\treturn false unless host\n\t\t\t\t\trequest[:host_settings] = host.params\n\t\t\t\t\t# render any assets?\n\t\t\t\t\treturn true if render_assets request, response, host.params\n\t\t\t\t\t# send static file, if exists and root is set.\n\t\t\t\t\treturn true if Base::HTTPSender.send_static_file request, response\n\t\t\t\t\t# return if a route answered the request\n\t\t\t\t\thost.routes.each {|r| a = r.on_request(request, response); return a if a}\n\t\t\t\t\t#return error code or 404 not found\n\t\t\t\t\treturn Base::HTTPSender.send_by_code request, response, 404 unless ( @avoid_404 ||= ( Iodine::Http.on_http == ::Iodine::Http::Rack ? 1 : 0 ) ) == 1\n\t\t\t\trescue => e\t\t\t\t\n\t\t\t\t\t# return 500 internal server error.\n\t\t\t\t\tIodine.error e\n\t\t\t\t\tBase::HTTPSender.send_by_code request, response, 500\n\t\t\t\tend\n\t\t\tend", "def dispatch_request(req)\n # /calculator/add\n #\n # gets split into nil, calculator as prefix and add as method name\n # that is called on actor instance\n #\n # TODO: how about /math/calculator/add and handling namespaced\n # actors or methods with / in them? It may be an issue for a larger\n # nanites cluster :/\n _, prefix, meth = req.type.split('/')\n begin\n actor = @actors[prefix]\n res = actor.send((meth.nil? ? \"index\" : meth), req.payload)\n rescue Exception => e\n res = \"#{e.class.name}: #{e.message}\\n #{e.backtrace.join(\"\\n \")}\"\n end\n Result.new(req.token, req.reply_to, res, agent.identity) if req.reply_to\n end", "def run(req, res)\n route_params = {}\n\n match_data = @pattern.match(req.path)\n match_data.names.each do |key|\n route_params[key] = match_data[key]\n end\n\n controller = @controller_class.new(req, res, route_params)\n controller.invoke_action(@action_name)\n end", "def index\n info = ScheduleProcessor.headway_info\n query = params[:text]\n workspace = params[:enterprise_name] || params[:team_domain]\n user_id = params[:user_id]\n\n if query == 'help'\n result = help_response(info[:routes])\n elsif (data = info[:routes].find { |r| r[:id] == query})\n track_event('slash', \"route/#{query}\", user_id, workspace)\n result = route_response(data)\n elsif query == 'delays'\n track_event('slash', 'delays', user_id, workspace)\n result = delays_response(info[:routes])\n else\n track_event('slash', 'default', user_id, workspace)\n result = default_response(info)\n end\n \n render json: result\n end", "def run(req, res)\n route_to_run = self.match(req)\n if route_to_run.nil?\n res.status = 404\n else\n route_to_run.run(req, res)\n end\n end", "def request_and_handle http_method, path, options\n if http_method.is_a?(String) || http_method.is_a?(Symbol)\n http_method = HTTP_METHODS[http_method.to_s]\n raise \"Unknown http method: #{http_method}\" unless http_method\n end\n \n req_options = default_options.dup\n req_options = req_options.merge(options)\n \n raise ConfigurationError.new \"No endpoint defined\" if !path || path.empty?\n raise ConfigurationError.new \"No hostname defined\" if !req_options[:base_uri] || req_options[:base_uri].empty?\n \n req = HTTParty::Request.new http_method, path, req_options\n\n begin\n response = req.perform\n rescue => ex\n raise RequestError.new req, ex\n end\n \n if defined?(Rails.logger)\n Rails.logger.info req.to_curl\n else\n puts req.to_curl\n end\n \n if !response.parsed_response.is_a?(Hash)\n raise ResponseParseError.new req, response\n elsif response[\"errors\"]\n raise ResponseError.new req, response[\"errors\"], response\n elsif response[\"message\"] && response[\"message\"] == \"Invalid Token or Expired\"\n raise InvalidAuthToken.new\n else\n return CityGrid::API::Response.new response\n end\n \n rescue => ex\n raise ex if CityGrid.raise_errors?\n end", "def parse_routes!\n allowed_routes.each do |route|\n if (endpoint = endpoints.find_from_route(route))\n endpoint.merge_http_methods!(route[:http_methods])\n else\n controller = controllers.find_or_create_from_route(route)\n endpoint = endpoints.create_from_route(route, controller)\n\n controller.add_endpoint(endpoint)\n end\n end\n end", "def handle( request ) # note: all 'handle's return 'mlResponse' in a chain\n\n request.record_arrival_time\n mlResponse =\n case\n when request.get? then handle_get_muffin(request)\n when request.post? then handle_post(request)\n end\n request.record_completion_time\n mlResponse\n end", "def routes\n routes_method.call\n end", "def handle_requests(request)\r\n\tputs request\r\n\tdata = JSON.parse(request)\r\n\tif data['command'] == 'login'\r\n\t\treturn login(data)\r\n\telsif data['command'] == 'add_phone'\r\n\t\treturn add_phone(data)\r\n\telsif data['command'] == 'remove_phone'\r\n\t\treturn remove_phone(data)\t\t\t\r\n\telsif data['command'] == 'create_account'\r\n\t\treturn create_account(data)\r\n\telsif data['command'] == 'update_location'\r\n\t\treturn update_location(data)\r\n\telse\r\n\t\tputs \"Unknown command: #{data['command']}\"\r\n\t\treturn \"ERROR\"\r\n\tend\r\nend", "def try_route\n\t\t\t\thttp_method = request.http_method\n\t\t\t\thttp_method = :GET if http_method == :HEAD\n\t\t\t\treturn unless available_endpoint\n\n\t\t\t\troute = available_endpoint[http_method]\n\t\t\t\treturn unless route || available_endpoint.allow\n\n\t\t\t\thalt(405, nil, 'Allow' => available_endpoint.allow) unless route\n\t\t\t\tstatus 200\n\t\t\t\texecute_route route\n\t\t\t\ttrue\n\t\t\tend", "def match(request)\n path = String.normalize_path(request.path)\n method = request.method\n\n match, data = nil\n @sets.each { |set|\n match, data = set[1].match(path, method)\n break if match\n }\n\n fns = []\n if match\n fns = match[3]\n\n # handle route params\n #TODO where to do this?\n request.params.merge!(Hash.strhash(self.data_from_path(path, data, match[1])))\n\n #TODO where to do this?\n request.route_path = match[4]\n end\n\n fns\n end", "def route_for(name, *args); end", "def route14\n end", "def run(req, res)\n regex = Regexp.new(@pattern.to_s)\n match_data = regex.match(req.path)\n route_params = {}\n match_data.names.each do |key|\n route_params[key] = match_data[key]\n end\n control = @controller_class.new(req, res, route_params)\n control.invoke_action(@action_name)\n end", "def method_missing method, *opt\n method.to_s =~ /^do_[A-Z]+$/ ? process_request(*opt) : super\n end", "def call\n\n catch(:KenjiRespondControlFlowInterrupt) do\n path = @env['PATH_INFO']\n\n # deal with static files\n static = \"#{@root}public#{path}\"\n return Rack::File.new(\"#{@root}public\").call(@env) if File.file?(static)\n\n\n # new routing code\n method = @env['REQUEST_METHOD'].downcase.to_sym\n\n segments = path.split('/')\n # ensure existence of leading /'s empty segment\n segments = segments.unshift('') unless segments.first == ''\n\n out = ''; success = false\n catch(:KenjiPass404) do\n if @options[:root_controller]\n controller = controller_instance(@options[:root_controller])\n subpath = segments.join('/')\n out = controller.call(method, subpath).to_json\n success = true\n else\n acc = ''; out = ''; success = false\n while (head = segments.shift)\n acc = \"#{acc}/#{head}\"\n # if we have a valid controller\n if (controller = controller_for(acc))\n subpath = '/' + segments.join('/')\n out = controller.call(method, subpath).to_json\n success = true\n break\n end\n end\n end\n end\n\n return response_404 unless success\n\n [@status, @headers, [out]]\n end\n rescue => e\n raise e unless @options[:catch_exceptions]\n # log exceptions\n @stderr.puts(e.inspect)\n e.backtrace.each {|b| @stderr.puts \" #{b}\" }\n response_500(e)\n end", "def dispatch env\n raise Gin::NotFound,\n \"No route exists for: #{env[REQ_METHOD]} #{env[PATH_INFO]}\" unless\n env[GIN_TARGET]\n\n env[GIN_APP] = self\n env[GIN_TARGET][0].call(env)\n\n rescue ::Exception => err\n handle_error(err, env)\n end", "def run(request, response)\n matching_route = match(request)\n\n if matching_route.nil?\n response.status = 404\n\n response.write(\"Sorry! The requested URL #{request.path} was not not found!\")\n else\n matching_route.run(request, response)\n end\n end", "def perform(request, options); end" ]
[ "0.7307753", "0.72215366", "0.71324205", "0.6776593", "0.66673535", "0.65960157", "0.65585536", "0.65510994", "0.65025", "0.6495886", "0.6465326", "0.6465326", "0.6465326", "0.6465326", "0.6465326", "0.6465326", "0.6465326", "0.6465326", "0.6465326", "0.6465326", "0.6465326", "0.6460453", "0.6442972", "0.64377093", "0.64377093", "0.64336234", "0.62902236", "0.6274452", "0.62548095", "0.62464166", "0.6237763", "0.6222922", "0.6218792", "0.6218792", "0.6218792", "0.6218792", "0.6218792", "0.6218792", "0.6218792", "0.6218792", "0.6218792", "0.6218792", "0.6218792", "0.6204924", "0.61939687", "0.6182993", "0.6179643", "0.61549366", "0.6139647", "0.61358386", "0.61273474", "0.6106741", "0.6092488", "0.6071433", "0.6063128", "0.60483813", "0.6015845", "0.60120016", "0.6008826", "0.6002886", "0.60014534", "0.6000881", "0.5991008", "0.5975892", "0.59732175", "0.5959513", "0.5944624", "0.59440035", "0.5936153", "0.59241825", "0.5923154", "0.59230274", "0.589414", "0.58934253", "0.58774567", "0.5876337", "0.58705324", "0.5866559", "0.58605886", "0.5853155", "0.585063", "0.5849673", "0.5844612", "0.5841394", "0.5839075", "0.583457", "0.5832483", "0.5824052", "0.5817201", "0.58134645", "0.5811411", "0.5809554", "0.5809073", "0.580583", "0.58001393", "0.5788239", "0.57870483", "0.5786489", "0.578594", "0.5785712", "0.5785343" ]
0.0
-1
Sends data in the response (immediately). Accepts a string of data or a File, mimetype (autodetected; defaults to octetstream), and optional file name. If a File, mime type will be guessed. Otherwise mime type and file name will default to whatever is set in the response.
def send(file_or_data, type = nil, send_as = nil) if file_or_data.class == File data = file_or_data.read # auto set type based on file type type = Rack::Mime.mime_type("." + String.split_at_last_dot(file_or_data.path)[1]) else data = file_or_data end headers = {} headers["Content-Type"] = type if type headers["Content-disposition"] = "attachment; filename=#{send_as}" if send_as self.context = AppContext.new(request, Response.new(data, response.status, response.header.merge(headers))) halt end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(file_or_data, type: nil, name: nil)\n if file_or_data.is_a?(IO) || file_or_data.is_a?(StringIO)\n data = file_or_data\n\n if file_or_data.is_a?(File)\n type ||= Rack::Mime.mime_type(File.extname(file_or_data.path))\n end\n\n @connection.set_response_header(Rack::CONTENT_TYPE, type || DEFAULT_SEND_TYPE)\n elsif file_or_data.is_a?(String)\n @connection.set_response_header(Rack::CONTENT_TYPE, type) if type\n data = StringIO.new(file_or_data)\n else\n raise ArgumentError, \"Expected an IO or String object\"\n end\n\n @connection.set_response_header(CONTENT_DISPOSITION, name ? \"attachment; filename=#{name}\" : \"inline\")\n halt(data)\n end", "def send_data data, options = {}\n\t\t\t\traise 'Cannot use \"send_data\" after headers were sent' if response.headers_sent?\n\t\t\t\tif response.body && response.body.any?\n\t\t\t\t\tPlezi.warn 'existing response body was cleared by `#send_data`!'\n\t\t\t\t\tresponse.body.close if response.body.respond_to? :close\n\t\t\t\tend\n\t\t\t\tresponse.body = data\n\n\t\t\t\t# set headers\n\t\t\t\tcontent_disposition = options[:inline] ? 'inline' : 'attachment'\n\t\t\t\tcontent_disposition << \"; filename=#{::File.basename(options[:filename])}\" if options[:filename]\n\n\t\t\t\tresponse['content-type'] = (options[:type] ||= options[:filename] && MimeTypeHelper::MIME_DICTIONARY[::File.extname(options[:filename])])\n\t\t\t\tresponse['content-disposition'] = content_disposition\n\t\t\t\ttrue\n\t\t\tend", "def send_data(data, options = {}) #:doc:\n logger.info \"Sending data #{options[:filename]}\" if logger\n send_file_headers! options.merge(:length => data.size)\n @performed_render = false\n render :status => options[:status], :text => data\n end", "def send_data(data, options = {}) #:doc:\n send_file_headers! options.merge(:length => data.size)\n throw :halt, [options[:status] || 200, [data]]\n end", "def send_raw_data request, response, data, mime, status_code = 200, headers = {}\n\t\t\t\theaders.each {|k, v| response[k] = v}\n\t\t\t\tresponse.status = status_code if response.status == 200 # avoid resetting a manually set status \n\t\t\t\tresponse['content-type'.freeze] = mime\n\t\t\t\tresponse['cache-control'.freeze] ||= 'public, max-age=86400'.freeze\t\t\t\t\n\t\t\t\tresponse.body = data\n\t\t\t\t# response['content-length'] = data.bytesize #this one is automated by the server and should be avoided to support Range requests.\n\t\t\t\ttrue\n\t\t\tend", "def send_data(data)\n case data\n when nil\n put_string(\"NIL\")\n when String\n send_string_data(data)\n when Integer\n send_number_data(data)\n when Array\n send_list_data(data)\n when Time\n send_time_data(data)\n when Symbol\n send_symbol_data(data)\n when EM::IMAP::Command\n send_command(data)\n else\n data.send_data(self)\n end\n end", "def send_data(data)\n @impl.send_data data\n end", "def _send_data(data)\n send_data(data + \"\\r\\n\")\n end", "def send_data(data); nil; end", "def send_data(data)\n logdebug \"send_data:\", :data => data\n attempt_write(data)\n end", "def send_data(data, options = T.unsafe(nil)); end", "def send_data(data)\n case data\n when nil\n put_string(\"NIL\")\n when String\n send_string_data(data)\n when Integer\n send_number_data(data)\n when Array\n send_list_data(data)\n when Time\n send_time_data(data)\n when Symbol\n send_symbol_data(data)\n else\n data.send_data(self)\n end\nend", "def send_record_data(record)\n send_data record.content_string, :type => record.mime_type,\n :disposition => 'inline',\n :filename => record.location\n end", "def send\n if @accepted then\n # Calculate content length before sending\n \n @headers << \"Content-Length: #{@buffer.length}\\r\\n\"\n \n if !@content_type then\n @headers << \"Content-Type: text/html\\r\\n\"\n end\n\n # Send our data and close the connection\n @server.puts @headers\n @server.puts \"\\r\\n\"\n @server.puts @buffer\n @server.close\n else\n puts \"[Rsws] ERROR: Trying to send response without first accepting it\"\n end\n end", "def serve_file(path)\n @response.body << read_file(path)\n @response.headers[\"Content-Type\"] = get_mime_type path\n @response.status = 200\n end", "def send_file stream_id, file\n res_headers = { \"status\" => \"200 OK\", \"version\" => \"HTTP/1.1\" }\n res_headers[\"Content-Type\"] = Rack::Mime.mime_type File.extname(file)\n\n # File contents\n data = if File.exists? file\n File.binread(file)\n elsif File.exists? \"#{file}.erb\"\n Tilt.new(\"#{file}.erb\").render\n else\n res_headers[\"Content-Type\"] = \"text/plain\"\n res_headers[\"status\"] = \"404 Not Found\"\n\n \"404 Not Found\"\n end\n\n res_headers[\"Content-Length\"] = data.size.to_s\n\n # Create response stream.\n # See hello_world.rb for detailed SPDY protocol instructions.\n syn_reply = SPDY::Protocol::Control::SynReply.new zlib_session: @parser.zlib_session\n\n # Send headers.\n send_data syn_reply.create(stream_id: stream_id, headers: res_headers).to_binary_s\n\n # Send contents.\n send_data SPDY::Protocol::Data::Frame.new.create(stream_id: stream_id, data: data).to_binary_s\n\n # Finalize response.\n fin = SPDY::Protocol::Data::Frame.new\n send_data fin.create(stream_id: stream_id, flags: 1).to_binary_s\n end", "def send_data( data )\n @connection.register_data_request( self, data )\n end", "def render_file file, content_type=nil\n socket.print \"HTTP/1.1 200 OK\\r\\n\" +\n \"Content-Type: #{content_type || content_type(file)}\\r\\n\" +\n \"Content-Length: #{file.size}\\r\\n\" +\n \"Connection: close\\r\\n\"\n\n socket.print \"\\r\\n\"\n\n # write the contents of the file to the socket\n IO.copy_stream(file, socket)\n end", "def send_file_contents\n self.status = 200\n prepare_file_headers\n send_data(file.content)\n end", "def serve\n @photo = User.find(params[:user_id])\n send_data(@photo.data, :type => @photo.mime_type, \n :filename => \"#{@photo.filename}.jpg\",\n :disposition => \"inline\")\n\n\n # send_file(\"./public/uploads/#{@user.filename}\",\n # type: @user.mime_type,\n # disposition: 'inline' )\n end", "def send_file_with_mime_type file_path\n # more MIME types: http://de.selfhtml.org/diverses/mimetypen.htm\n kind_of_plain_text = %w{ txt php js css rb yml log }\n kind_of_html = %w{ htm html shtml }\n\n case split_to_filename_and_extension(file_path).last.downcase\n when /jp(e*)g/ then type = 'image/jpeg'\n when 'gif' then type = 'image/gif'\n when 'png' then type = 'image/png'\n when 'bmp' then type = 'image/bmp'\n when 'xml' then type = 'text/xml'\n when 'pdf' then type = 'application/pdf'\n when *kind_of_plain_text then type = 'text/plain'\n when *kind_of_html then type = 'text/html'\n else type = 'application/octet-stream'\n end\n\n if Settings.x_accel_redirect\n send_file_via_nginx_x_accel_redirect file_path, type\n else\n send_file File.expand_path(file_path), :disposition => 'inline', :type => type, :x_sendfile => Settings.x_sendfile\n end\n end", "def send_data(data, type = :text)\n pid = Thread.new do\n do_send(data, type)\n end\n end", "def send_uploaded_file_response(obj)\n request = I3.server.request\n if request.params[\"HTTP_USER_AGENT\"] =~ /MSIE/ # Internet Explorer\n obj = obj.to_shared if obj.is_a? I3::ServerException\n I3.server.send_object(obj, :type => \"text/html\")\n else\n I3.server.send_object(obj)\n end #if\n end", "def send_chunk(data)\n response.write('%x' % data.size + \"\\r\\n\")\n response.write(data + \"\\r\\n\")\n end", "def send_file_data filename\n\t\tEventMachine::send_file_data @signature, filename\n\tend", "def send_file request, response, filename, status_code = 200, headers = {}\n\t\t\t\tif Plezi.file_exists?(filename) && !::File.directory?(filename)\n\t\t\t\t\tdata = if Plezi::Cache::CACHABLE.include?(::File.extname(filename)[1..-1])\n\t\t\t\t\t\tPlezi.load_file(filename)\n\t\t\t\t\telse\n\t\t\t\t\t\t::File.new filename, 'rb'\n\t\t\t\t\tend\n\t\t\t\t\treturn send_raw_data request, response, data , MimeTypeHelper::MIME_DICTIONARY[::File.extname(filename)], status_code, headers\n\t\t\t\tend\n\t\t\t\treturn false\n\t\t\tend", "def receive_data(data)\n @buffer ||= StringScanner.new(\"\")\n @buffer << data\n\n while line = @buffer.scan_until(/\\n/)\n response.chunk renderer.render(line)\n flush\n end \n end", "def send_file(path, options = T.unsafe(nil)); end", "def send_data(data)\n super(data)\n puts \"#{self} send_data done: #{data.inspect}\"\n end", "def send_data(data)\n super(data)\n puts \"#{self} send_data done: #{data.inspect}\"\n end", "def send_file path, opts = {}\n\n file = ::Rack::File.new nil\n file.path = path\n (cache_control = opts[:cache_control]) && (file.cache_control = cache_control)\n response = file.serving env\n\n response[1]['Content-Disposition'] = opts[:attachment] ?\n 'attachment; filename=\"%s\"' % (opts[:filename] || ::File.basename(path)) :\n 'inline'\n\n (content_type = opts[:content_type]) &&\n (response[1]['Content-Type'] = content_type)\n\n (last_modified = opts[:last_modified]) &&\n (response[1]['Last-Modified'] = last_modified)\n\n halt response\n end", "def send_file(path); end", "def respond(request, data)\n return unless data\n request[\"result\"] = data\n @lock.synchronize do\n send_data(request.to_json + \"\\x00\")\n end\n end", "def send(data)\n debug [:send, data]\n send_data(\"\\x00#{data}\\xff\")\n end", "def send(data)\n debug [:send, data]\n send_data(\"\\x00#{data}\\xff\")\n end", "def send_disposable_file(path, opts = {})\n if opts[:type] || !response['Content-Type']\n content_type opts[:type] || File.extname(path), :default => 'application/octet-stream'\n end\n\n disposition = opts[:disposition]\n filename = opts[:filename]\n disposition = 'attachment' if disposition.nil? && filename\n filename = path if filename.nil?\n attachment(filename, disposition) if disposition\n\n last_modified opts[:last_modified] if opts[:last_modified]\n\n file = DisposableFile.new nil\n file.path = path\n result = file.serving env\n result[1].each { |k,v| headers[k] ||= v }\n headers['Content-Length'] = result[1]['Content-Length']\n halt opts[:status] || result[0], result[2]\n rescue Errno::ENOENT\n not_found\n end", "def send! data\n send_output_io! data if @output_io || host\n send_log_io! data if log_io\n self\n end", "def send_data data\n\t size = data.bytesize if data.respond_to?(:bytesize)\n\t size ||= data.size\n\t\tEventMachine::send_data @signature, data, size\n\tend", "def send(data: {}, headers: {})\n `#@native.open(#{method}, #{url})`\n @data = data\n self.headers = headers\n\n if method == :get || method == :delete\n `#@native.send()`\n elsif Hash === data\n `#@native.send(#{JSON.generate data})`\n elsif `!!data['native']`\n `#@native.send(data['native'])`\n else\n `#@native.send(data)`\n end\n\n self\n end", "def _send_message data\n response << data\n end", "def send_raw(data)\n # puts \"Sending data\"\n # puts_data(data)\n write(data)\n end", "def send_file(path, opts = OPTS)\n res = response\n headers = res.headers\n if opts[:type] || !headers[RodaResponseHeaders::CONTENT_TYPE]\n res.content_type(opts[:type] || ::File.extname(path), :default => 'application/octet-stream')\n end\n\n disposition = opts[:disposition]\n filename = opts[:filename]\n if disposition || filename\n disposition ||= 'attachment'\n filename = path if filename.nil?\n res.attachment(filename, disposition)\n end\n\n if lm = opts[:last_modified]\n last_modified(lm)\n end\n\n file = RACK_FILES.new nil\n s, h, b = if Rack.release > '2'\n file.serving(self, path)\n else\n file.path = path\n file.serving(@env)\n end\n\n res.status = opts[:status] || s\n headers.delete(RodaResponseHeaders::CONTENT_LENGTH)\n headers.replace(h.merge!(headers))\n res.body = b\n\n halt\n rescue Errno::ENOENT\n not_found\n end", "def swf_uploaded_data=(data)\n data.content_type = MIME::Types.type_for(data.original_filename).first.to_s\n self.file = data\n end", "def swf_uploaded_data=(data)\n data.content_type = MIME::Types.type_for(data.original_filename).first.to_s\n self.file = data\n end", "def send_file(reqfile, content_type)\n reqfile = File.join(@repo_dir, reqfile)\n return render_not_found if !File.exists?(reqfile)\n\n @res = Rack::Response.new\n @res.status = 200\n @res[\"Content-Type\"] = content_type\n @res[\"Last-Modified\"] = File.mtime(reqfile).httpdate\n\n yield\n\n if size = File.size?(reqfile)\n @res[\"Content-Length\"] = size.to_s\n @res.finish do\n File.open(reqfile, \"rb\") do |file|\n while part = file.read(8192)\n @res.write part\n end\n end\n end\n else\n body = [File.read(reqfile)]\n size = Rack::Utils.bytesize(body.first)\n @res[\"Content-Length\"] = size\n @res.write body\n @res.finish\n end\n end", "def stream_send(data)\n self[STREAM_SEND].call(data)\n end", "def handle_data(io, data)\n request = @parser.parse_request(data)\n env = request_to_env(io, request)\n status, header, body = @app.call(env)\n\n create_response(status, header, body.join)\n end", "def send_data(data)\n str_data = data.pack('C*')\n super(str_data)\n end", "def get_file\n \n @file = Datafile.find params[:file]\n send_file @file.full_filename,:type => @file.content_type,:disposition => 'inline'\n\n end", "def relay_from_backend(name, data)\r\n data = @on_response.call(name, data)\r\n send_data data unless data.nil?\r\n end", "def set_source_data(data,content_type='application/octet-stream')\n length = 0\n full_filename = short_filename = ''\n f = File.new(File.join(UPLOADED_FILES_PATH,\"upload_#{Time.now.usec}\"),\"w+\",0600)\n full_filename = f.path\n short_filename = full_filename.split('/').last\n length = f.write(data)\n Rails.logger.info \"Wrote #{length} of #{data.size} bytes to #{full_filename}\"\n Rails.logger.info data\n f.close\n io = open(full_filename)\n (class << io; self; end;).class_eval do\n define_method(:original_filename) { short_filename }\n define_method(:content_type) { content_type }\n define_method(:size) { length }\n end\n self.uploaded_data = io\n self.filename = short_filename\n end", "def send_data(data)\n jsonified_data = data.to_json\n log('sending', jsonified_data)\n super(jsonified_data)\n end", "def send_file(path, options = {}) #:doc:\n raise MissingFile, \"Cannot read file #{path}\" unless File.file?(path) and File.readable?(path)\n\n options[:length] ||= File.size(path)\n options[:filename] ||= File.basename(path) unless options[:url_based_filename]\n send_file_headers! options\n\n @performed_render = false\n\n if options[:x_sendfile]\n logger.info \"Sending #{X_SENDFILE_HEADER} header #{path}\" if logger\n head options[:status], X_SENDFILE_HEADER => path\n else\n if options[:stream]\n render :status => options[:status], :text => Proc.new { |response, output|\n logger.info \"Streaming file #{path}\" unless logger.nil?\n len = options[:buffer_size] || 4096\n File.open(path, 'rb') do |file|\n while buf = file.read(len)\n output.write(buf)\n end\n end\n }\n else\n logger.info \"Sending file #{path}\" unless logger.nil?\n File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }\n end\n end\n end", "def send_with_reply( type, data=nil )\n send_packet type, data\n read_packet\n end", "def send_file_full_rack(req_path, request, response,type=\"png\", header_only=false)\n\t stat = File.stat(req_path)\n\n # Set the last modified times as well and etag for all files\n\t mtime = stat.mtime\n # Calculated the same as apache, not sure how well the works on win32\n\t etag = ETAG_FORMAT % [mtime.to_i, stat.size, stat.ino]\n\n modified_since = request.env[HTTP_IF_MODIFIED_SINCE]\n\t none_match = request.env[HTTP_IF_NONE_MATCH]\n\n # test to see if this is a conditional request, and test if\n\t # the response would be identical to the last response\n same_response = case\n when modified_since && !last_response_time = Time.httpdate(modified_since) rescue nil then false\n when modified_since && last_response_time > Time.now then false\n when modified_since && mtime > last_response_time then false\n when none_match && none_match == '*' then false\n when none_match && !none_match.strip.split(/\\s*,\\s*/).include?(etag) then false\n else modified_since || none_match # validation successful if we get this far and at least one of the header exists\n end\n\n\t header = response.header\n header[ETAG] = etag\n\n\t if same_response\n\t response.status = 304\n\t else\n\n\t # First we setup the headers and status then we do a very fast send on the socket directly\n\n # Support custom responses except 404, which is the default. A little awkward. \n\t response.status = 200 if response.status == 404\n\t header[LAST_MODIFIED] = mtime.httpdate\n \n\t header[CONTENT_TYPE] = type\n\n \t # send a status with out content length\n \t #response.send_status(stat.size)\n\t #response.send_header\n\t #response.send_file(req_path, stat.size < 16*1024 * 2)\n\t response.body = Rack::File.new(req_path)\n\t return stat.size\n\t end\n end", "def send_data(data)\n super(data)\n @@log.warn \"#{self} send_data done: #{data.inspect}\"\n end", "def file_response(req)\n response = ::Rack::Response.new\n response['Last-Modified'] = req.stat.mtime.rfc822\n file_type = mime_map.mime_type_of(req.request_path)\n\n if highlighting? and req.highlighting? then\n if file_type && (file_type != 'text/html') then\n body = highlight_contents(req, file_type)\n response['Content-Type'] = 'text/html'\n response['Content-Length'] = body.length.to_s\n response.write( body )\n return response.finish\n end\n end\n\n # fall through to a default file return\n response['Content-Type'] = file_type.to_s\n File.open( req.request_path ) do |f|\n while p = f.read( 8192 ) do\n response.write( p )\n end\n end\n return response.finish\n end", "def do_data( channel, data )\n if @parsed_data\n @parsed_data[:content].append data\n return if @parsed_data[:length] > @parsed_data[:content].length\n\n type = @parsed_data[:type]\n content = @parsed_data[:content]\n @parsed_data = nil\n else\n reader = @buffers.reader( data )\n length = reader.read_long-1\n type = reader.read_byte\n content = reader.remainder_as_buffer\n\n if length > content.length\n @parsed_data = { :length => length,\n :type => type,\n :content => content }\n return\n end\n end\n\n if type == FXP_VERSION\n do_version content\n else\n assert_state :open\n @dispatcher.dispatch channel, type, content\n end\n end", "def kif_data_send\n if request.format.bod?\n text_body = KifuParser.new(source: current_record.kifu_body, to_format: \"bod\", turn: params[:turn]).to_xxx\n else\n text_body = current_record.to_xxx(params[:format])\n end\n\n if current_body_encode == \"Shift_JIS\"\n text_body = text_body.encode(current_body_encode)\n end\n\n # if boolean_for(params[:plain])\n # render plain: text_body\n # return\n # end\n\n if current_disposition == :inline\n headers[\"Content-Type\"] = current_type\n render plain: text_body\n return\n end\n\n # inline でこれを表示すると headers[\"Content-Transfer-Encoding\"] = \"binary\" になっているため Capybara でテキストが文字化けする\n # filename = current_filename.public_send(\"to#{current_filename_encode}\")\n send_data(text_body, type: current_type, filename: current_filename, disposition: current_disposition)\n end", "def send_extended_data( type, data )\n @connection.register_data_request( self, data, type )\n end", "def file=(file_data)\n return nil if file_data.nil? || file_data.size == 0 \n self.assign_type file_data.content_type\n self.location = file_data.original_filename if respond_to?(:location)\n if file_data.is_a?(StringIO)\n file_data.rewind\n self.temp_data = file_data.read\n else\n self.temp_path = file_data.path\n end\n @save_attachment = true\n end", "def send( data )\n # Final text data header:\n header = 0b10000001\n\n # Payload size to use (data will always be unmasked):\n size = \"#{data}\".size\n\n # Standard payload:\n if size < 126 then\n @connection.write [ header, size, \"#{data}\" ].pack \"C2A#{size}\"\n\n # 16-bit extended payload:\n elsif size <= 65535 then\n bytes = [ size ].pack( \"S\" ).unpack( \"C2\" ).reverse.map( &:to_i )\n @connection.write [ header, 126, *bytes, \"#{data}\" ]\n .pack \"C4A#{size}\"\n\n # 64-bit extended payload:\n else\n bytes = [ size ].pack( \"S\" ).unpack( \"C8\" ).reverse.map( &:to_i )\n @connection.write [ header, 127, *bytes, \"#{data}\" ]\n .pack \"C10A#{size}\"\n end\n end", "def receive_data data\n\n # First we get all the headers in to find out which resource\n # we are looking for.\n\n if @status == :header\n @buffer += data\n\n if @buffer =~ /\\r\\n\\r\\n/\n\n # Detected end of headers\n header_data = @buffer[0...($~.begin(0))]\n\n @web_config = WEBrick::Config::HTTP.clone\n @web_config[:HTTPVersion] = WEBrick::HTTPVersion.new(\"1.0\")\n\n # Try the webrick parser\n @req = WEBrick::HTTPRequest.new(@web_config)\n @res = WEBrick::HTTPResponse.new(@web_config)\n\n StringIO.open(header_data, 'rb') do |socket|\n @req.parse(socket)\n end\n\n # The rest of the incoming connection\n @buffer = @buffer[($~.end(0))..-1]\n\n # Compute the ID of the sought resource\n if @req.path =~ /\\/adhd\\/(.*)/\n @req.header[\"Filename\"] = $1\n @req.header[\"ID\"] = MD5.new($1).to_s\n else\n # TODO: return a 404 here\n send_error 404, \"Not Found\", \"The URL does not seem to contain /adhd/filename\"\n # raise \"Remember to have a url of the form /adhd/<filenname>.\"\n end\n\n # Change the status once headers are found\n @status = :find_node\n else\n # Avoid DoS via buffer filling\n close_connection if @buffer.length > 1000\n end\n end\n\n # Now we have the headers, but maybe not the full body, and we are looking\n # for the right node in our network to handle the call.\n if @status == :find_node\n # We want to tell the remote host to wait a bit\n # This would allow us to defer the execution of the calls to find\n # the right nodes, and extract the doc.\n\n # TODO: We need to push all the chit-chat with the remote servers to\n # A deferable object, or some other connection, not to block.\n # Right now we are blocking and it sucks.\n\n # Now get or write the document associated with this file\n\n if @req.request_method == \"GET\"\n\n @our_doc = @node_manager.srdb.get_doc_directly(@req.header[\"ID\"])\n\n # TODO: handle errors if file does not exist\n if @our_doc[:ok]\n @status == :get\n handle_get\n else\n send_error 500, \"Internal Server Error\", @our_doc[:reason]\n end\n end\n\n if @req.request_method == \"PUT\"\n # Define a Doc with the data so far\n @our_doc = StoredFile.new\n\n @our_doc._id = @req.header[\"ID\"]\n @our_doc.internal_id = @req.header[\"ID\"]\n @our_doc.size_bytes = @req.content_length\n @our_doc.filename = @req.header[\"Filename\"]\n @our_doc.mime_type = @req.content_type\n\n # Write to the right node\n @our_doc = @node_manager.srdb.write_doc_directly(@our_doc)\n\n # TODO: if an error is returned here, we cannot execute the query\n if @our_doc[:ok]\n @status = :put\n handle_put\n else\n send_error 410, \"Conflict\", @our_doc[:reason]\n end\n end\n end\n end", "def file=(file)\n self.data = file\n dis_set :content_type, file.content_type\n dis_set :filename, file.original_filename\n end", "def swf_uploaded_data=(data)\n data.content_type = MIME::Types.type_for(data.original_filename)\n self.uploaded_data = data\n end", "def send_file(path, opts={})\n opts[:disposition] = 'attachment' if !opts.key?(:disposition)\n attachment opts[:filename] || path if opts[:filename] || opts[:disposition]\n response['Content-Transfer-Encoding'] = 'binary' if opts[:disposition]\n super(path, opts)\n end", "def send_file(path, options = {}) #:doc:\n raise MissingFile, \"Cannot read file #{path}\" unless File.file?(path) and File.readable?(path)\n\n options[:length] ||= File.size(path)\n options[:filename] ||= File.basename(path)\n options[:type] ||= Rack::File::MIME_TYPES[File.extname(options[:filename])[1..-1]] || 'text/plain'\n options[:last_modified] ||= File.mtime(path).httpdate\n options[:stream] = true unless options.key?(:stream)\n options[:buffer_size] ||= DEFAULT_SEND_FILE_OPTIONS[:buffer_size]\n send_file_headers! options\n\n if options[:stream]\n throw :halt, [options[:status] || 200, FileStreamer.new(path, options)]\n else\n File.open(path, 'rb') { |file| throw :halt, [options[:status] || 200, [file.read]] }\n end\n end", "def send_file path, opts={}\n if opts[:type] || !@response[CNT_TYPE]\n content_type opts[:type] || File.extname(path),\n :default => 'application/octet-stream'\n end\n\n disposition = opts[:disposition]\n filename = opts[:filename]\n disposition = 'attachment' if disposition.nil? && filename\n filename = File.basename(path) if filename.nil?\n\n if disposition\n @response[CNT_DISPOSITION] =\n \"%s; filename=\\\"%s\\\"\" % [disposition, filename]\n end\n\n last_modified opts[:last_modified] || File.mtime(path).httpdate\n halt 200 if @request.head?\n\n @response[CNT_LENGTH] = File.size?(path).to_s\n halt 200, File.open(path, \"rb\")\n\n rescue Errno::ENOENT\n halt 404\n end", "def send_file_full(req_path, request, response,mime_type=\"image/png\", header_only=false )\n\t return send_file_xsendfile(request, response,req_path, mime_type)\n\tend", "def send_data( data )\n\t\tjson = data.to_json\n\t\tbytes = json.bytesize\n\t\tputs \"SEND %3i bytes to %s: %s\" % [bytes,name,json] if $DEBUG\n\t\tunless @socket.closed?\n\t\t\t@socket.write [bytes].pack('n')\n\t\t\tunless @socket.closed?\n\t\t\t\t@socket.write(json) == bytes\n\t\t\tend\n\t\tend\n\tend", "def set_response(response, result, status = 200)\n response.status = status\n unless result.is_a?(File)\n response.write result\n else\n response[\"Content-Length\"] = result.stat.size.to_s\n response.body = RackFile.new(result)\n end\n end", "def nginx_send_file(path, content_type = \"\")\n # Let Nginx detect content type unless it is explicitly set\n headers['Content-Type'] = content_type\n headers[\"Content-Disposition\"] ||= \"attachment; filename=#{path.split('/').last}\"\n \n headers['X-Accel-Redirect'] = path\n \n return ' '\n end", "def show\n send_data(@attachment.file_contents,\n type: @attachment.content_type,\n filename: @attachment.filename)\n end", "def finish_data\n if @headers.empty? and @data_written == 0\n @data.close(true) if @data.is_a?(Tempfile)\n \n self.reset_data\n return nil\n end\n \n if @data.is_a?(Tempfile)\n @data.close(false)\n @files_arr << @data.path if @data.respond_to?(:path)\n end\n \n raise \"No 'content-disposition' was given (#{@headers}) (#{@data}).\" if !@name\n \n if @fname\n obj = Hayabusa::Http_session::Post_multipart::File_upload.new(\n :fname => @fname,\n :headers => @headers,\n :data => @data\n )\n @return[@name] = obj\n else\n @return[@name] = @data\n end\n \n self.reset_data\n end", "def send_dat(*args)\n debug \"send_dat: args is #{args}\"\n opts = {}\n if args.length > 0 and args[0].class == 'Hash'\n opts = args[0]\n end\n\n unless opts.key?(:resend) and opts[:resend]\n blksize = @options[:blksize].to_i\n debug \"Reading #{blksize} bytes from file #{@filename}\"\n @buffer = @file.read(blksize)\n debug \"@buffer is now #{@buffer.class}\"\n debug \"Read #{@buffer.length} bytes into buffer\"\n if @file.eof\n info \"End of file #{@filename} detected.\"\n @file.close\n @state = :fin\n end\n\n @blocknumber += 1\n if @blocknumber > MaxBlockNum\n debug \"Blocknumber rolled over to zero\"\n @blocknumber = 0\n end\n else\n warn \"Resending block number #{@blocknumber}\"\n end\n\n dat = TftpPacketDAT.new\n dat.data = @buffer\n dat.blocknumber = @blocknumber\n debug \"Sending DAT packet #{@blocknumber}\"\n @sock.send(dat.encode.buffer, 0, @host, @port)\n @timesent = Time.now\n end", "def send(parameters = @parameters)\n raise 'the request has not been opened' unless opened?\n\n raise 'the request has already been sent' if sent?\n\n # try to circumvent caching setting an If-Modified-Since header with a very\n # old date\n unless cacheable?\n `#@native.setRequestHeader(\"If-Modified-Since\", \"Tue, 11 Sep 2001 12:46:00 GMT\")`\n end\n\n @headers.each {|name, value|\n `#@native.setRequestHeader(#{name.to_s}, #{value.to_s})`\n }\n\n if @content_type\n header = @content_type\n header += \"; charset=#{@encoding}\" if @encoding\n\n `#@native.setRequestHeader('Content-Type', header)`\n end\n\n if binary?\n if Buffer.supported?\n `#@native.responseType = 'arraybuffer'`\n else\n `#@native.overrideMimeType('text/plain; charset=x-user-defined')`\n end\n end\n\n if mime_type && !binary?\n `#@native.overrideMimeType(#@mime_type)`\n end\n\n @sent = true\n @response = Response.new(self)\n\n if String === parameters\n data = parameters\n elsif (Hash === parameters && !parameters.empty?) || FormData === parameters\n data = if Hash === parameters\n if FormData.contain_files?(parameters)\n FormData.build_form_data(parameters)\n else\n FormData.build_query(parameters)\n end\n else #if FormData === parameters\n parameters\n end\n\n unless @content_type\n if FormData === data\n # I thought it's done this way, but it isn't. It actually is\n # \"multipart/form-data; boundary=-----------.......\". Let's miss it\n # purposefully, because it's filled in automatically in this example.\n # `#@native.setRequestHeader('Content-Type', 'multipart/form-data')`\n else\n `#@native.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')`\n end\n end\n\n data = data.to_n\n else\n data = `null`\n end\n\n `#@native.send(#{data})`\n\n @response\n end", "def send_data data\n super \"#{data}\\n\"\n Events.dispatch(:raw_out, Message.new(self, data, true))\n\n @lines_sent += 1\n @bytes_sent += data.bytesize + 1\n\n $log.debug(\"IRCConnection.send_data #{@name}\") { data }\n end", "def received_file\n if env['rack.input']\n make_tempfile(env['rack.input'], :filename => env['HTTP_X_FILE_NAME'], :type => env[\"CONTENT_TYPE\"])\n end\n end", "def send_data(data)\n @lock.synchronize do\n\n @send_buffer += data\n limited_by_polling = (@last_send + @http_polling >= Time.now)\n limited_by_requests = (@pending_requests + 1 > @http_requests)\n\n # Can we send?\n if !limited_by_polling and !limited_by_requests\n data = @send_buffer\n @send_buffer = ''\n\n Thread.new do\n Thread.current.abort_on_exception = true\n post_data(data)\n end\n\n elsif !limited_by_requests\n Thread.new do\n Thread.current.abort_on_exception = true\n # Defer until @http_polling has expired\n wait = @last_send + @http_polling - Time.now\n sleep(wait) if wait > 0\n # Ignore locking, it's already threaded ;-)\n send_data('')\n end\n end\n\n end\n end", "def send(data, opt={:type => :text})\n puts \"send ***************\"\n return if !@handshaked or @closed\n puts \"after send************\"\n type = opt[:type]\n frame = ::WebSocket::Frame::Outgoing::Client.new(:data => data, :type => type, :version => @handshake.version)\n begin\n @socket.write frame.to_s\n rescue Errno::EPIPE => e\n @pipe_broken = true\n emit :__close, e\n end\n end", "def content_type!(ext)\n case ext.downcase\n when 'haml'; t = 'text/html'\n when 'erb'; t = 'text/html'\n# I believe all the rest are determined accurately by the Rack::Mime.mime_type call in the else clause below.\n# when 'html'; t = 'text/html'\n# when 'js'; t = 'text/javascript'\n# when 'css'; t = 'text/css'\n# when 'png'; t = 'image/png'\n# when 'gif'; t = 'image/gif'\n# when 'jpg'; t = 'image/jpeg'\n# when 'jpeg'; t = 'image/jpeg'\n else t = Rack::Mime.mime_type('.' + ext, 'text/plain')\n end\n #puts(\"----#{ext}:\" + t.inspect) # dbg\n (self.response[:headers]['Content-Type'] = t) if t\n end", "def proxy_receive_data data\n @proxystatus = :headers if !@proxystatus\n \n if @proxystatus == :headers\n # First gather the headers\n @proxybuffer += data\n if @proxybuffer =~ /\\r\\n\\r\\n/\n\n # Detected end of headers\n header_data = @proxybuffer[0...($~.begin(0))]\n @proxybuffer = @proxybuffer[($~.end(0))..-1]\n\n # Try the webrick parser\n headers = {}\n header_lines = header_data.split(/[\\r\\n]+/)\n status = header_lines[0]\n header_lines[1..-1].each do |line|\n h = line.split(/:\\s*/, 2)\n headers[h[0]] = h[1]\n end\n \n # The rest of the incoming connection \n @proxystatus = :stream\n end\n end\n \n if @proxystatus == :stream\n send_data header_lines[0] + \"\\r\\n\"\n send_data \"Content-Type: \" + headers['Content-Type'] + \"\\r\\n\"\n send_data \"Content-Length: \" + headers['Content-Length'] + \"\\r\\n\"\n send_data \"\\r\\n\"\n send_data @proxybuffer\n\n # Any further data is piped through \n EM::enable_proxy proxy_conn, self, 1024*10\n end\n end", "def send_data(data, url)\n content_type = :xml\n response = Requester.request(url, data, content_type)\n response.body\n end", "def send_file_method\n :default\n end", "def send_file(file, caption = nil, filename: nil, spoiler: nil)\n pm.send_file(file, caption: caption, filename: filename, spoiler: spoiler)\n end", "def send_file_xsendfile(request, response,path, mime_type)\n\t\n\t#Calculate etag, not sure if needed, perhaps apache does this already\n\tstat = File.stat(path)\n # Set the last modified times as well and etag for all files\n\tmtime = stat.mtime\n # Calculated the same as apache, not sure how well the works on win32\n\tetag = ETAG_FORMAT % [mtime.to_i, stat.size, stat.ino]\n\n modified_since = request.env[HTTP_IF_MODIFIED_SINCE]\n\tnone_match = request.env[HTTP_IF_NONE_MATCH]\n\n # test to see if this is a conditional request, and test if\n\t # the response would be identical to the last response\n\t # Not sure whats going on here - stole from mongrels dir handler, which probibly does everything correctly..\n same_response = case\n when modified_since && !last_response_time = Time.httpdate(modified_since) rescue nil then false\n when modified_since && last_response_time > Time.now then false\n when modified_since && mtime > last_response_time then false\n when none_match && none_match == '*' then false\n when none_match && !none_match.strip.split(/\\s*,\\s*/).include?(etag) then false\n else modified_since || none_match # validation successful if we get this far and at least one of the header exists\n end\n\n\tif same_response\n\t response.status = 304\n\telse\n\t #Status?\n\t response.header[ETAG] = etag\n\t response.header[\"X-Sendfile\"] = path\n\t response.headers[CONTENT_TYPE] = mime_type\n\t response.headers[CONTENT_LENGTH] = \"0\"\n\tend\n\t \n\tresponse.body = []\n\t\n\treturn stat.size\n end", "def show\n send_data(@document.file_content,\n type: @document.content_type,\n filename: @document.filename)\n end", "def send_file(path)\n\n @buffer = File.read(path)\n send\n end", "def send_data(s, data)\n\n if USE_MP3\n audio_data = `echo '#{data}' | base64 --decode | sox -r 8000 -c 1 -e mu-law -t raw - -r 48000 -c 1 -t mp3 -`\n else\n audio_data = `echo '#{data}' | base64 --decode | opusenc --quiet --raw --raw-bits 8 --raw-rate 8000 --raw-chan 1 --bitrate 96 - -`\n end\n m = ShoutMetadata.new\n m.add 'filename', \"e#{5}_#{SecureRandom.urlsafe_base64}.mp3\"\n m.add 'title', \"My episode\"\n m.add 'artist', \"Mo\"\n s.metadata = m\n s.send audio_data\n s.sync\n\nend", "def send_file_options\n st = stream_path\n opts = {type: MIME::Types.type_for(st).to_s, filename: @attachment.io_stream_file_name}\n\n case send_file_method\n when :apache then\n opts[:x_sendfile] = true\n when :nginx then\n head(:x_accel_redirect => st.gsub(Rails.root, \"\"), :content_type => opts[:type])\n else\n true\n end\n\n opts\n end", "def swfupload_file=(data)\n data.content_type = MIME::Types.type_for(data.original_filename).to_s\n self.file = data\n end", "def swfupload_file=(data)\n data.content_type = MIME::Types.type_for(data.original_filename).to_s\n self.file = data\n end", "def send(data)\n @client.send(data)\n end", "def download_file\n\n # Send it to the user\n filename = params[:filename]\n filepath = params[:filepath]\n data = File.read(filepath)\n send_data data, :filename => filename, :type => \"application/vnd.ms-excel\"\n\n end", "def extract_content_type\n if data_content_type == \"application/octet-stream\" && !data_file_name.blank?\n content_types = MIME::Types.type_for(data_file_name)\n self.data_content_type = content_types.first.to_s unless content_types.empty?\n end\n end", "def send_file(req_path, request, response, header_only=false)\n\n stat = File.stat(req_path)\n\n # Set the last modified times as well and etag for all files\n mtime = stat.mtime\n # Calculated the same as apache, not sure how well the works on win32\n etag = Mongrel::Const::ETAG_FORMAT % [mtime.to_i, stat.size, stat.ino]\n\n modified_since = request.params[Mongrel::Const::HTTP_IF_MODIFIED_SINCE]\n none_match = request.params[Mongrel::Const::HTTP_IF_NONE_MATCH]\n\n # test to see if this is a conditional request, and test if\n # the response would be identical to the last response\n same_response = case\n when modified_since && !last_response_time = Time.httpdate(modified_since) rescue nil : false\n when modified_since && last_response_time > Time.now : false\n when modified_since && mtime > last_response_time : false\n when none_match && none_match == '*' : false\n when none_match && !none_match.strip.split(/\\s*,\\s*/).include?(etag) : false\n else modified_since || none_match # validation successful if we get this far and at least one of the header exists\n end\n\n header = response.header\n header[Mongrel::Const::ETAG] = etag\n\n if same_response\n response.start(304) {}\n else\n # first we setup the headers and status then we do a very fast send on the socket directly\n response.status ||= 200\n header[Mongrel::Const::LAST_MODIFIED] = mtime.httpdate\n\n # set the mime type from our map based on the ending\n dot_at = req_path.rindex('.')\n if dot_at\n header[Mongrel::Const::CONTENT_TYPE] = MIME_TYPES[req_path[dot_at .. -1]] || @default_content_type\n else\n header[Mongrel::Const::CONTENT_TYPE] = @default_content_type\n end\n\n # send a status with out content length\n response.send_status(stat.size)\n response.send_header\n\n if not header_only\n response.send_file(req_path, stat.size < Mongrel::Const::CHUNK_SIZE * 2)\n end\n end\n end", "def set_content_type raw_type\n response_object.mime_raw raw_type\n end", "def convertRawData(data)\n @raw_data['file'] = data\n @helper.post(@fields, @files, @raw_data)\n end", "def convertRawData(data)\n @raw_data['file'] = data\n @helper.post(@fields, @files, @raw_data)\n end", "def convertRawData(data)\n @raw_data['file'] = data\n @helper.post(@fields, @files, @raw_data)\n end" ]
[ "0.7759746", "0.7507452", "0.73989993", "0.6897502", "0.64952874", "0.6389846", "0.6325512", "0.62787044", "0.6261842", "0.6208261", "0.614706", "0.60828394", "0.6068764", "0.6060857", "0.6048625", "0.60485697", "0.60435843", "0.6030396", "0.6025539", "0.6024027", "0.59408844", "0.5937188", "0.592451", "0.59217817", "0.588472", "0.58717746", "0.58293253", "0.58290786", "0.5815085", "0.5815085", "0.58078617", "0.579255", "0.5789875", "0.57883394", "0.57883394", "0.5780453", "0.57552207", "0.5740709", "0.57238936", "0.5697741", "0.56968224", "0.56929874", "0.56792545", "0.56792545", "0.56635416", "0.5597708", "0.5594636", "0.5576004", "0.55719477", "0.55699635", "0.556415", "0.5554254", "0.55483896", "0.5540149", "0.5538363", "0.55056727", "0.5501729", "0.5490312", "0.5489689", "0.54776233", "0.54626846", "0.5445903", "0.5444626", "0.5441581", "0.54297125", "0.5428471", "0.54212123", "0.5415609", "0.5401068", "0.5400747", "0.53963035", "0.5394942", "0.5394403", "0.53746283", "0.53415424", "0.5323191", "0.5314498", "0.53079045", "0.530143", "0.5295021", "0.5293698", "0.52926093", "0.52892035", "0.5281698", "0.52609485", "0.5260824", "0.525093", "0.524964", "0.5248676", "0.524011", "0.5230507", "0.5230507", "0.52271914", "0.52235526", "0.52205455", "0.5217616", "0.5196707", "0.5194771", "0.5194771", "0.5194771" ]
0.7656748
1
Redirects to location (immediately).
def redirect(location, status_code = 302) location = router.path(location) if location.is_a?(Symbol) headers = response ? response.header : {} headers = headers.merge({'Location' => location}) self.context = AppContext.new(request, Response.new('', status_code, headers)) halt end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect(location, status = '302'); request.redirect(location, status); end", "def redirect(url)\n headers['Location'] = url\n self.status = 302\n raise FinishRequest\n end", "def redirect(url); end", "def redirect_to(url)\n raise \"Already built response!\" if already_built_response?\n @res['Location'] = url\n @res.status = 302\n finalize_response(:redirect)\n end", "def redirect_to(url)\n prepare_response do\n res['location'] = url\n res.status = 302\n end\n end", "def redirect_to(url, options={})\n full_url = absolute_url(url, options)\n response[LOCATION] = full_url\n respond_with 302\n full_url\n end", "def redirect(uri)\n @response.status = 302\n @response.header['Location'] = uri\n @response.body = ''\n halt\n end", "def redirect_to(url)\n self.res.status = 302\n #how would I know about location\n self.res.header[\"location\"] = url\n session.store_session(self.res)\n\n #self.res.set_redirect(WEBrick::HTTPStatus::TemporaryRedirect, url)\n if already_rendered?\n raise \"Can't render/redirect twice\"\n end\n\n #following might be wrong b/c of no setter\n @already_built_response = true\n nil\n end", "def redirect_to(url, options={})\n full_url = absolute_url(url, options)\n response[LOCATION] = full_url\n respond_with 302\n full_url\n end", "def redirect(options = {})\r\n end", "def redirect(url)\n raise \"To be implemented by client application\"\n end", "def redirect(location, as: 302, **params)\n @connection.status = Rack::Utils.status_code(as)\n @connection.set_response_header(\"Location\", location.is_a?(Symbol) ? app.endpoints.path(location, **params) : location)\n halt\n end", "def redirect_to(url)\n unless already_built_response?\n @res[\"location\"] = url\n @res.status = 302\n @already_built_response = true\n else\n fail\n end\n session.store_session(res)\n end", "def redirect?; end", "def redirect_to(url)\n raise \"double render error\" if @already_built_response\n # Issuing a redirect consists of two parts, setting the 'Location'\n # field of the response header to the redirect url and setting the\n # response status code to 302\n @already_built_response = true\n res.location = url\n res.status = 302\n @session.store_session(res)\n end", "def location(url)\n headers \"Location\" => url\n end", "def redirect_to(url)\n raise DoubleRenderError if already_built_response?\n res.header['location'] = url\n res.status = 302\n @already_built_response = true\n session.store_session(res)\n end", "def redirect_to(path)\n render(:status => 302, \"Location\" => path) { p { text(\"You are redirected to \"); a(path, :href => path) } }\n end", "def redirect(path, status = 302)\n @headers[LOCATION] = path\n @status = status\n end", "def redirect_to(url)\n check_already_rendered\n session.store_session(response)\n response.status = 302\n response['Location'] = url\n @already_rendered = true\n end", "def redirect_to(url)\n raise \"double render error\" if constructed_response?\n\n @response.status = 302\n @response[\"Location\"] = url\n\n @constructed_response = true\n\n session.store_session(@response)\n\n nil\n end", "def redirect_to(url)\n raise 'Already responded' if already_built_response?\n flash.store_flash(res)\n res['Location'] = url\n res.status = 302\n @already_built_response = true\n session.store_session(res)\n end", "def redirect uri, *args\n if @env[HTTP_VERSION] == 'HTTP/1.1' && @env[REQ_METHOD] != 'GET'\n status 303\n else\n status 302\n end\n\n @response[LOCATION] = url_to(uri.to_s)\n halt(*args)\n end", "def redirect\n redirect_to @goto_url\n end", "def redirect_to(url)\n if !already_built_response?\n @res[\"location\"] = url\n @res.status = 302\n @already_built_response = true\n else\n raise \"exception\"\n end\n session.store_session(res)\n # storing the flash will fail the last spec\n flash.store_flash(res)\n end", "def redirect_to(url)\n raise \"Already delivered response\" if self.already_built_response?\n res.status = 302\n res['Location'] = url\n @already_built_response = true\n self.session.store_session(res)\n self.flash.store_flash(res)\n end", "def redirect_ok; end", "def redirect_ok; end", "def follow_redirection(&block); end", "def redirect(path)\n throw :redirect, path\n end", "def redirect_ok=(follow); end", "def redirects; end", "def redirect_to(url)\n raise \"Already built response!\" if already_built_response?\n @res[\"Location\"] = url\n @res.status = 302\n @already_built_response = true\n session.store_session(@res)\n flash.store_flash(@res)\n end", "def redirect_to(url)\n if already_built_response?\n raise\n else\n res.status = 302\n res.header[\"location\"] = url\n end\n @already_built_response = true\n @session.store_session(res) if @session\n @flash.store_flash(res) if @flash\n end", "def follow_redirect?; end", "def redirect_to(url)\n response = Rack::Response.new\n response.redirect(url, 301) # moved permanently\n response.finish\n response.to_a\n end", "def redirect!(url, opts = {})\n self.headers[\"Location\"] = url\n self.status = opts[:permanent] ? 301 : 302\n self.status = opts[:status] if opts[:status]\n self.body = opts[:message] || \"<div>You are being redirected to <a href='#{url}'>#{url}</a></div>\"\n halt!\n return true\n end", "def redirect_to(url)\n raise \"Double Render Error\" if already_built_response?\n\n # equiv to @res.redirect\n @res.status = 302\n @res.location = url\n\n @already_built_response = true\n\n session.store_session(@res)\n end", "def redirect_to(*arguments)\n unless try_redirecting_to(*arguments)\n render :nothing => true\n end\n end", "def redirect_to(url)\n if already_built_response?\n raise \"DoubleRenderError\" \n else \n @res.status = 302 \n # @res.set_header('Content-Type', content_type)\n @res.set_header('location', url)\n # @res.write(content) \n session.store_session(res)\n # debugger\n @already_built_response = true \n # debugger\n end \n end", "def gringotts_redirect_to(url)\n # save url for redirecting back after we verify\n flash[:gringotts_next_url] = request.original_url\n \n # keep other flash items (e.g., success messages)\n flash.keep\n \n # last but not least ... redirect\n redirect_to url\n end", "def redirect_to url, options = {}\n\t\t\t\treturn super() if defined? super\n\t\t\t\turl = full_url_for(url, params) unless url.is_a?(String) || url.nil?\n\t\t\t\t# redirect\n\t\t\t\tresponse.redirect_to url, options\n\t\t\tend", "def redirect_client(client, url)\n client.puts(\"HTTP/1.1 302 Found\\r\\nLocation: #{url}\\r\\n\\r\\n\")\nend", "def redirect_to(url)\n raise \"already built response\" if already_built_response?\n @res.status = 302\n @res[\"Location\"] = url\n @already_built_response = true\n self.session.store_session(@res)\n self.flash.store_flash(@res)\n end", "def redirect_ok\n @agent.redirect_ok\n end", "def after_anyway\n redirect redirection if redirection\n end", "def redirect_to(url)\n if self.already_built_response?\n raise \"Double render error!\"\n else\n @res.status = 302\n @res.location = url\n @already_built_response = true\n end\n end", "def follow_redirect(response)\n raise MalformedServerResponse.new(self, response) unless response.header.location\n if response.moved_permanently?\n new_uri = response.header.location\n logger.info(\" Permanently redirected to #{new_uri} - Storing new location.\")\n resource.update_uri new_uri\n @header.host = resource.host\n response = fetch_response\n elsif response.see_other? # Always use GET for this redirect, regardless of initial method\n redirected_resource = Resourceful::Resource.new(self.accessor, response.header['Location'])\n response = Request.new(:get, redirected_resource, body, header).fetch_response\n else\n redirected_resource = Resourceful::Resource.new(self.accessor, response.header['Location'])\n logger.info(\" Redirected to #{redirected_resource.uri} - Caching new location.\")\n response = Request.new(method, redirected_resource, body, header).fetch_response\n end\n end", "def redirect_to_path(path)\n redirect_to path\n end", "def redirect_to(route={}, opts={})\n path = url(route)\n # p \"Redirect to: #{path}\"\n raise Doozer::Redirect.new(path, opts)\n end", "def follow_redirect!(**args); end", "def go(location)\n browser.location = location\n browser.response\n end", "def store_location\n session[:redirect] = request.url\n end", "def redirect_permanently_to(url)\n redirect_to url, status: :moved_permanently\n end", "def my_redirect url \r\n session[:plugin_redirection] = true if is_request_from_plugin?()\r\n redirect_to(url)\r\n end", "def redirect(uri)\n [ 303, {'Content-Length'=>'0', 'Content-Type'=>'text/plain',\n 'Location' => uri},\n [] ]\n end", "def handle_redirect(response)\n redirect_href = response.http_header[\"Location\"]\n redirect_href = redirect_href.first unless !redirect_href.is_a? Array\n redirect_href = expand_path(redirect_href)\n store_link('redirect', redirect_href, @link_id)\n end", "def redirect(location, *args)\n unless request.path == request.path_info\n path = request.path.split('/')\n info = request.path_info.split('/')\n prefix = (path - info).join('/')\n location = File.join('/', prefix, location)\n end\n super(location, *args)\n end", "def redirect_away(*params)\n session[:original_uri] = request.fullpath\n redirect_to(*params)\n end", "def redirect_away(*params)\n session[:original_uri] = request.fullpath\n redirect_to(*params)\n end", "def redirect_to(uri_fragment)\n @headers['Status'] = '302 Moved'\n @headers['Location'] = @cgi.full_uri_for uri_fragment\n output\n end", "def redirect_to_index\n redirect_to locations_url\n end", "def redirect_ok= follow\n @agent.redirect_ok = follow\n end", "def redirect_away(*params)\n session[:original_uri] = request.request_uri\n redirect_to(*params)\n end", "def redirect_away(*params)\n session[:original_uri] = request.request_uri\n redirect_to(*params)\n end", "def redirect_to(url)\n raise Exception.new(\"Already Rendered Response\") if already_built_response?\n @response.status = 302\n @response[\"Location\"] = url\n @session.store_session(@response) if @session\n @flash.store_flash(@response) if @flash\n @already_built_response = true\n end", "def redirect_to_origin(opts = {})\n if params[:ret].present?\n redirect_to params[:ret], opts\n else\n redirect_to opts.merge!(action: :index)\n end\n end", "def redirect(target, status = 302)\n set_header 'Location', target\n @lunetas_redirect = [302, \"Moved to #{target}\"]\n end", "def redirect(*args)\n # If this is an ajax and/or rpc request skip the redirect.\n # Allows to write more reusable code.\n\n return if request.script?\n \n if args.last.is_a? Hash\n status = args.last.fetch(:status, 303)\n else\n status = 303\n end\n\n uri = encode_uri(*args)\n\n # gmosx, THINK: this may be unnecessary!\n\n unless uri =~ /^http/\n uri = \"#{@context.host_uri}/#{uri.gsub(/^\\//, '')}\"\n end\n\n @context.status = status\n @out = \"<html><a href=\\\"#{uri}\\\">#{uri}</a>.</html>\\n\"\n @context.response_headers['location'] = uri\n\n raise RenderExit\n end", "def redirect(uri, verb = T.unsafe(nil)); end", "def assert_redirect(res, location)\n assert_in_array [\"301\", \"302\", \"303\", \"307\"], res.code\n assert_header res, \"Location\", location\n end", "def redirect\n if !params[:redirect].blank? && redirection = Redirect.find_by_redirect_url(params[:redirect])\n query_string = URI.parse(request.url).query rescue nil\n redirect = query_string.blank? ? redirection.url : \"#{redirection.url}?#{query_string}\"\n redirect_to redirect\n elsif params[:redirect].blank?\n Rails.logger.warn \"Redirect with no parameter requested.\"\n head :status => 404\n else\n Rails.logger.warn \"Unknown redirection requested: #{params[:redirect]}\"\n head :status => 404\n end\n end", "def redirect_ok=(_arg0); end", "def redirect where, opts={}\n where = current.request.env['HTTP_REFERER'].or('/') if where == :back\n where = \"#{current.request.path}#{where}\" if where[0,1] == '?'\n where = current.host + where unless where.include?('://')\n\n # local redirect\n if where.include?(current.host)\n redirect_var = Lux.config.redirect_var || :_r\n\n url = Url.new where\n url[redirect_var] = current.request.params[redirect_var].to_i + 1\n\n where =\n if opts.delete(:silent)\n url.delete redirect_var\n url.to_s\n else\n url[redirect_var] > 3 ? '/' : url.to_s\n end\n end\n\n @status = opts.delete(:status) || 302\n opts.map { |k,v| flash.send(k, v) }\n\n @body = %[redirecting to #{where}\\n\\n#{opts.values.join(\"\\n\")}]\n\n @headers['location'] = where\n @headers['access-control-expose-headers'] ||= 'Location'\n\n throw :done\n end", "def be_redirected_to(path)\n BeRedirected.new(path)\nend", "def redirect_to(route)\n status = route[:status] || 302\n url = route[:redirect_to]\n options = self.request.params\n options.merge!(route)\n options - [:controller, :action, :redirect_to, :method, :status, :format]\n url = url_for_pattern(url, options)\n self.response.status = status\n self.response['Location'] = url\n self.response.write(redirect_html(self.request.path_info, url, status))\n end", "def follow_redirect!\n unless last_response.redirect?\n raise Error, 'Last response was not a redirect. Cannot follow_redirect!'\n end\n\n if last_response.status == 307\n request_method = last_request.request_method\n params = last_request.params\n else\n request_method = 'GET'\n params = {}\n end\n\n # Compute the next location by appending the location header with the\n # last request, as per https://tools.ietf.org/html/rfc7231#section-7.1.2\n # Adding two absolute locations returns the right-hand location\n next_location = URI.parse(last_request.url) + URI.parse(last_response['Location'])\n\n custom_request(\n request_method,\n next_location.to_s,\n params,\n 'HTTP_REFERER' => last_request.url,\n 'rack.session' => last_request.session,\n 'rack.session.options' => last_request.session_options\n )\n end", "def redirect_to options = {}\n @has_redirect = options\n end", "def redirect_url(immediate = false)\n moje_id_request.redirect_url(realm, return_to, immediate)\n end", "def redirect_to(options = {}, response_status = {}) #:doc:\n raise ActionControllerError.new(\"Cannot redirect to nil!\") unless options\n raise AbstractController::DoubleRenderError if response_body\n\n self.status = _extract_redirect_to_status(options, response_status)\n location = _compute_redirect_to_location(request, options)\n if ENV['DOJ_HOST'].present?\n location = replace_url_host(location, ENV['DOJ_HOST'])\n end\n self.location = location\n\n escaped_location = ERB::Util.unwrapped_html_escape(location)\n self.response_body = \"<html><body>You are being <a href=\\\"#{escaped_location}\\\">redirected</a>.</body></html>\"\n end", "def run(req, res)\n to_run = match(req)\n if to_run.nil?\n @res.status = 302\n @res.header[\"location\"] = url\n end\nend", "def follow_redirect\n get extract_redirection_url\n end", "def get_response_with_redirect(uri)\n r = Net::HTTP.get_response(uri)\n if r.code == \"301\"\n r = Net::HTTP.get_response(URI.parse(r.header['location']))\n end\n r\nend", "def redirect_away(*params)\n store_return_point\n redirect_to(*params)\n end", "def redirect(url)\n Merb.logger.info(\"Redirecting to: #{url}\")\n set_status(302)\n headers['Location'] = url\n \"<html><body>You are being <a href=\\\"#{url}\\\">redirected</a>.</body></html>\"\n end", "def redirect_to(location, status=302, flash: nil)\n #; [!xkrfk] sets flash message if provided.\n set_flash_message(flash) if flash\n #; [!ev9nu] sets response status code as 302.\n @resp.status = status\n #; [!spfge] sets Location response header.\n @resp.headers['Location'] = location\n #; [!k3gvm] returns html anchor tag.\n href = Util.h(location)\n return \"<a href=\\\"#{href}\\\">#{href}</a>\"\n end", "def give_301(response, url)\n\theaders = response.headers\n\tresponse.status = 301\n\tresponse.headers[\"Location\"] =url\n end", "def login_redirect(user, url)\n auto_login(user)\n redirect_to url\n end", "def force_login\n store_location\n redirect_to login_path, alert: \"Whups, you need to login for that!\"\n end", "def redirect_internal() redirect_to \"/nothing\"; end", "def permanent_redirect_to(location)\n \"<?php\\nheader(\\\"HTTP/1.1 301 Moved Permanently\\\");\\nheader(\\\"Location: #{NEW_DOMAIN}/#{location}\\\");\\necho \\\"redirecting...\\\"\\n ?>\"\nend", "def store_location\n session[:redirect_path] = request.path\n end", "def redirect path \n full = '/' + @prefix.to_s + @version.to_s + @namespace.to_s + path\n res = Rack::Response.new\n res.redirect(full)\n res.finish\n\n #$Utter.map(full) do\n #\tputs \"Redirect: #{full}\"\n #\trun lambda { |env| [200, {\"Content-Type\" => \"application/json\"}, [$Utter.instance_exec(&block)]] }\n #end\n end", "def redirect_to(url)\n raise \"double render error\" if already_built_response?\n \n res.status = 302\n res.location = url\n\n if @flash[:persist]\n flash.now # persist false\n flash.store_session(res)\n else\n res.delete_cookie[:flash]\n end\n\n session.store_session(res)\n flash.store_session(res)\n @already_built_response = true\n end", "def redirect_to(url_options = {}, response_options = {})\n response_options[:status] ||= :see_other unless request.get?\n super url_options, response_options\n end", "def get_location_or_redirect(options = {})\n redirect_to(options) if get_location() == nil\n end", "def permanent_redirect_to(options={})\r\n redirect_to options, :status => 301\r\n end", "def send_to_redirect\n redirect_to @short_url.redirect\n end", "def redirected(uri)\n @uris << uri.to_s\n update_code(:redirected, %i(unknown redirected))\n end", "def start\n unless params[:location].blank? or cookies[:origin].present?\n params[:location].slice!(0) if params[:location][0].upcase == \"R\" # Remove proceeding R if present\n start_location = params[:location].to_s.rjust(4, '0').prepend(\"R\") # Add zero padding and Prepend R\n cookies.permanent[:start_location] = start_location.upcase\n end\n\n redirect_to root_path\n end" ]
[ "0.82039726", "0.77350634", "0.7618645", "0.7556567", "0.75505304", "0.73555785", "0.7305238", "0.7295801", "0.72648895", "0.7264487", "0.725929", "0.7250029", "0.7210275", "0.71876", "0.7175976", "0.7165888", "0.7161535", "0.71038145", "0.70925283", "0.7065813", "0.7064427", "0.7025558", "0.6996668", "0.69791424", "0.697439", "0.6937257", "0.69329596", "0.69329596", "0.6911672", "0.69057226", "0.69029367", "0.68800175", "0.6866311", "0.6865894", "0.68645144", "0.686131", "0.6860665", "0.68537986", "0.6836367", "0.68331987", "0.68186533", "0.6795802", "0.679516", "0.6789304", "0.67675227", "0.67630243", "0.6737083", "0.6728011", "0.67095035", "0.66761076", "0.6663395", "0.665936", "0.6659127", "0.66551363", "0.6624886", "0.66168374", "0.66009283", "0.65935946", "0.65667427", "0.65667427", "0.6555335", "0.6552814", "0.65316004", "0.65248734", "0.65248734", "0.65243924", "0.6522467", "0.6521169", "0.6520011", "0.651202", "0.6508946", "0.65019536", "0.6501747", "0.648271", "0.644598", "0.6445328", "0.64423424", "0.64384484", "0.64304775", "0.6428037", "0.6405908", "0.63996416", "0.6396494", "0.6393175", "0.6379841", "0.63686097", "0.635243", "0.63521755", "0.6343004", "0.6341487", "0.6328827", "0.63282293", "0.63163185", "0.6313919", "0.6308733", "0.6305447", "0.63001186", "0.6294049", "0.6279088", "0.62476224" ]
0.6804894
41
Convenience method for defining routes on an app instance.
def routes(set_name = :main, &block) self.class.routes(set_name, &block) load_routes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def routes\n app_obj.routes\n end", "def generate_routes!\n Router.new(self).generate(@app)\n end", "def app\n routes = Routes\n routes.set :public_folder, 'public'\n routes.set :environment, :test\n routes\n end", "def route_for(options)\n ensure_that_routes_are_loaded\n ActionController::Routing::Routes.generate(options)\n end", "def routes(context={})\n \n routes = [ \n ]\n \n end", "def routes(context={})\n \n routes = [ \n ]\n \n end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes\n routes_method.call\n end", "def add_routes(&block)\n @router ||= Routes.new\n @router.define(&block)\n url.router = @router\n end", "def handle_routes\n instance_exec(@_roda_app.request, &self.class.router_block)\n end", "def _routes; end", "def custom_routes; end", "def routes\n raise NotImplementedError\n end", "def routes\n desc 'shows all routes'\n task routes: :environment do\n print_routes api_routes\n end\n end", "def method_missing(method, *args, &block)\n if (method.to_s.end_with?('_path') || method.to_s.end_with?('_url')) && main_app.respond_to?(method)\n main_app.send(method, *args, &block)\n else\n super\n end\n end", "def routes\n Resources::Routes.new(self)\n end", "def method_missing(method, *args, &block)\n if method.to_s.end_with?('_path', '_url')\n if main_app.respond_to?(method)\n main_app.send(method, *args)\n else\n super\n end\n else\n super\n end\n end", "def routes(path = nil, &blk)\n if path or block_given?\n @routes = Config::Routes.new(root, path, &blk)\n else\n @routes\n end\n end", "def method_missing method, *args, &block\n method.to_s.end_with?('_path', '_url') and main_app.respond_to?(method) ? main_app.send(method, *args) : super\n end", "def routes(&block)\n routes = Routes.new\n routes.instance_eval(&block) if block_given?\n @route_definition = routes\n end", "def routes\n @routes ||= Engine.routes.url_helpers\n end", "def routes(routes_def)\n RouterDefinition.new(routes_def)\n end", "def add_route(*args)\n custom_routes << args\n end", "def add_admin_and_users_routes # :nodoc:\n routes_content = load_template \"routes.rb\"\n inject_into_file \"config/routes.rb\",\n routes_content,\n after: %r{Application\\.routes\\.draw do$}\n end", "def add_routes(routes)\n \n return if skip_method(__method__)\n \n write_artifact(\"config/routes.rb\") do |file|\n file.puts(\"Rails.application.routes.draw do\")\n file.puts(\"\n concern :common_routes do\n get :range, on: :collection\n # handles requests where relation is a query param (RestAngularBuilder)\n # e.g. users/1/related.json?relation=department\n get :related \n post :search\n end\")\n \n if namespace\n file.puts(\" namespace :#{namespace} do\")\n end\n routes.each do |route|\n namespace.nil? ? file.puts(route) : file.puts(indent(route))\n end\n if namespace\n file.puts(\" end\")\n end\n file.puts(\"end\")\n end\n\n end", "def routes\n @routes ||= load_routes\n end", "def anchored_routes; end", "def define_routable_methods router_class\n define_method router_class.route_name_method_name do \n router_class.route_name self\n end\n \n define_method router_class.url_method_name do \n router_class.url self\n end\n \n define_method router_class.path_method_name do \n router_class.path self\n end\n end", "def route(&block)\n @route_block = block\n build_rack_app\n end", "def route_for(name, *args); end", "def route(*args)\n Route.new(self, *args)\n end", "def external_routes; end", "def route *args\n locked? || raise(\"`route' works only on mounted apps. Please consider to use `base_url' instead.\")\n return base_url if args.size == 0\n (route = self[args.first]) && args.shift\n build_path(route || base_url, *args)\n end", "def named_routes; end", "def rest_routes\n\t\t\t\t\t[\n\t\t\t\t\t\t{ method: :GET, path: '/', action: :index },\n\t\t\t\t\t\t{ method: :POST, path: '/', action: :create },\n\t\t\t\t\t\t{ method: :GET, path: '/', action: :show },\n\t\t\t\t\t\t{ method: :PUT, path: '/', action: :update },\n\t\t\t\t\t\t{ method: :DELETE, path: '/', action: :delete }\n\t\t\t\t\t]\n\t\t\t\tend", "def routes\n context[:routes]\n end", "def load_routes\n\n # get our routes\n routes = Rails.application.routes.routes.to_a\n\n # filter out internal routes, those outside our base context, and those with no name\n routes.reject!{ |r| r.internal or !r.defaults.key?( :controller ) or r.name.nil? }\n\n # finally, map everything to a simpler version\n self.routes = routes.map do |r|\n {\n controller: r.defaults[:controller],\n action: r.defaults[:action].to_sym,\n name: r.name,\n params: r.parts.reject{ |p| p == :format }\n }\n end\n\n end", "def routes(&block); end", "def routes(&block); end", "def route(pattern, options={})\n options[:builder] ||= GentleREST::RouteBuilder\n builder_class = options[:builder]\n begin\n builder = builder_class.new(pattern, options)\n rescue ArgumentError\n raise ArgumentError,\n \"A RouteBuilder class must take a pattern and an \" +\n \"options Hash as parameters in its initialize method.\" \n end\n if builder.respond_to?(:generate)\n new_routes = builder.generate\n new_routes.each do |route|\n if !route.kind_of?(GentleREST::Route)\n raise TypeError,\n \"Expected GentleREST::Route, got #{route.class.name}.\"\n end\n self.routes << route\n end\n new_routes\n else\n raise TypeError,\n \"An instantiated builder class must respond to the \" +\n \":generate message.\"\n end\n end", "def url_for(options)\n ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty?\n ActionController::Routing::Routes.generate(options, {})\n end", "def as_rack_app\n #routes = Rack::Mount::RouteSet.new_without_optimizations do |set|\n routes = Rack::Mount::RouteSet.new do |set|\n @set = set\n self.add_routes\n add_route %r{^.*$}, :action => \"render_static\"\n end\n return routes\n end", "def routes(context={})\n \n routes = [{:path => '/admin/worker-jobs',\n :regular_expression => /^\\/admin\\/worker-jobs/, \n :title => 'Delayed jobs', \n :description => 'Query delayed jobs',\n :fit => 1,\n :module => :system }]\n \n end", "def initialize app=nil\n @app = app\n\n self.class.endpoints.values.flatten.each do |endpoint|\n endpoint.action_handler ||= method :default_action\n endpoint.api_doc_handler ||= method :default_api_doc\n endpoint.error_handler ||= method :default_error\n endpoint.validation_error_handler ||= method :default_validation_error\n end\n end", "def route(*args)\n @app.log << \"route #{args.inspect[1..-2]}\"\n @app.route(*args)\nend", "def route(name = '/', *args)\n hash = {}\n hashes, names = args.partition{|arg| arg.respond_to?(:merge!) }\n hashes.each{|to_merge| hash.merge!(to_merge) }\n\n name = name.to_s.gsub(/__/, '/')\n\n location = route_location(self)\n front = Array[location, name, *names.map{|element|\n Rack::Utils.escape(element) }].join('/').squeeze('/')\n\n return URI(front) if hash.empty?\n\n query = Rack::Utils.build_query(hash)\n URI(\"#{front}?#{query}\")\n end", "def routes\n # /home is temporary\n ['login', 'logout', 'home', 'newuser', 'edituser']\n end", "def add_route(pattern, method, controller_class, action_name)\n @routes << Route.new(pattern, method, controller_class, action_name)\n end", "def add_route(pattern, method, controller_class, action_name)\n @routes << Route.new(pattern, method, controller_class, action_name)\n end", "def add_route(pattern, method, controller_class, action_name)\n @routes << Route.new(pattern, method, controller_class, action_name)\n end", "def add_route(pattern, method, controller_class, action_name)\n @routes << Route.new(pattern, method, controller_class, action_name)\n end", "def add_route(pattern, method, controller_class, action_name)\n @routes << Route.new(pattern, method, controller_class, action_name)\n end", "def add_route(pattern, method, controller_class, action_name)\n @routes << Route.new(pattern, method, controller_class, action_name)\n end", "def add_route(pattern, method, controller_class, action_name)\n @routes << Route.new(pattern, method, controller_class, action_name)\n end", "def routing(opts ={})\n stack Orange::Middleware::RestfulRouter, opts.dup\n orange.plugins.each{|p| p.middleware(:routing).each{|m| stack m, opts.dup} if p.has_middleware?}\n end", "def add_route(pattern, method, controller_class, action_name)\n new_route = Route.new(pattern, method, controller_class, action_name)\n @routes << new_route\n end", "def start!(roda_app)\n if Bridgetown::Current.preloaded_configuration.base_path == \"/\"\n load_all_routes roda_app\n return\n end\n\n # Support custom base_path configurations\n roda_app.request.on(\n Bridgetown::Current.preloaded_configuration.base_path.delete_prefix(\"/\")\n ) do\n load_all_routes roda_app\n end\n\n nil\n end", "def method_missing(method_name, *args, &block)\n app && app.respond_to?(method_name) ? app.send(method_name, *args, &block) : super\n end", "def merge(roda_app)\n return unless router_block\n\n new(roda_app).handle_routes\n end", "def routes(set_name = :main, &block)\n if set_name && block\n @@routes[set_name] = block\n else\n @@routes\n end\n end", "def load_all_routes(roda_app)\n roda_app.request.public\n\n if Bridgetown.env.development? &&\n !Bridgetown::Current.preloaded_configuration.skip_live_reload\n setup_live_reload roda_app\n end\n\n Bridgetown::Rack::Routes.sorted_subclasses&.each do |klass|\n klass.merge roda_app\n end\n end", "def create_notification_routes(options = {}, resources_options = [])\n self.resources options[:model], resources_options do\n collection do\n post :open_all unless ignore_path?(:open_all, options)\n end\n member do\n get :move unless ignore_path?(:move, options)\n put :open unless ignore_path?(:open, options)\n end\n end\n end", "def method_missing method, *args, &block\n if main_app_url_helper?(method)\n main_app.send(method, *args)\n else\n super\n end\n end", "def method_missing method, *args, &block\n if main_app_url_helper?(method)\n main_app.send(method, *args)\n else\n super\n end\n end", "def method_missing method, *args, &block\n if main_app_url_helper?(method)\n main_app.send(method, *args)\n else\n super\n end\n end", "def add_route(pattern, method, controller_class, action_name)\n @routes << Route.new(pattern, method, controller_class, action_name)\n end", "def add_route(pattern, method, controller_class, action_name)\n @routes << Route.new(pattern, method, controller_class, action_name)\n end", "def add_route(pattern, method, controller_class, action_name)\n @routes << Route.new(pattern, method, controller_class, action_name)\n end", "def add_route(pattern, method, controller_class, action_name)\n @routes << Route.new(pattern, method, controller_class, action_name)\n end", "def init_routes\n puts \"Adding the caboose store routes...\"\n \n filename = File.join(@app_path,'config','routes.rb')\n return if !File.exists?(filename)\n return if !@force\n \n str = \"\" \n str << \"\\t# Catch everything with caboose\\n\" \n str << \"\\tmount CabooseStore::Engine => '/'\\n\"\n \n file = File.open(filename, 'rb')\n contents = file.read\n file.close \n if (contents.index(str).nil?)\n arr = contents.split('end', -1)\n str2 = arr[0] + \"\\n\" + str + \"\\nend\" + arr[1]\n File.open(filename, 'w') {|file| file.write(str2) }\n end \n end", "def add_route(*args, &block)\n route = Route.new(*args, &block)\n @routes << route\n route\n end", "def routes\r\n RoutesController.instance\r\n end", "def get_routes\n raise \"Method not implemented\"\n end", "def setup_routes\n template('routes.rb.tt', 'config/routes.rb', force: true)\n end", "def routes\n request :get, '/routes'\n end", "def base_rack_app_callable(new_api=true)\n if new_api\n lambda{|env| new(env)._roda_handle_main_route}\n else\n block = @rack_app_route_block\n lambda{|env| new(env).call(&block)}\n end\n end", "def method_missing(method, *args)\n if main_app_url_helper?(method)\n main_app.send(method, *args)\n else\n super\n end\n end", "def route(&block)\n unless block\n RodaPlugins.warn \"no block passed to Roda.route\"\n return\n end\n\n @raw_route_block = block\n @route_block = block = convert_route_block(block)\n @rack_app_route_block = block = rack_app_route_block(block)\n public define_roda_method(:_roda_main_route, 1, &block)\n @app = nil\n end", "def route\n @base_controller.route if @base_controller\n end", "def route\n #TODO\n end", "def route(&block) # When Proc is used, &proc_name\n puts \"<router.rb> BlocWorks::Application#route(&block)\"\n # block = #<Proc:0x007fddc4af3da0@/.../bloc-books/config.ru:13>\n @router ||= Router.new\n @router.instance_eval(&block)\n # instance_eval runs the codes inside block.\n end", "def routes(set_name = :main, &block)\n return @routes ||= {} unless block_given?\n routes[set_name] = block\n self\n end", "def route *args\n mounted? || raise(\"`route' works only on mounted controllers. Please consider to use `base_url' instead.\")\n return base_url if args.size == 0\n (route = self[args.first]) && args.shift\n build_path(route || base_url, *args)\n end", "def routes(context={})\n \n routes = [{:path => '/admin/aspects',\n \t :regular_expression => /^\\/admin\\/config\\/aspects/, \n :title => 'Aspects' , \n :description => 'Configure the aspects.',\n :fit => 1,\n :module => :aspects},\n {:path => '/admin/aspect/:model_name/:aspect',\n :parent_path => \"/model-aspects\",\n :regular_expression => /^\\/admin\\/config\\/aspect\\/.+\\/.+/, \n :title => 'Model aspect configuration', \n :description => 'Edit the model/aspect configuration',\n :fit => 1,\n :module => :aspects\n }]\n \n end", "def mount(app, options = nil)\n if options\n path = options.delete(:at)\n elsif Hash === app\n options = app\n app, path = options.find { |k, _| k.respond_to?(:call) }\n options.delete(app) if app\n end\n\n raise ArgumentError, \"A rack application must be specified\" unless app.respond_to?(:call)\n raise ArgumentError, <<~MSG unless path\n Must be called with mount point\n\n mount SomeRackApp, at: \"some_route\"\n or\n mount(SomeRackApp => \"some_route\")\n MSG\n\n rails_app = rails_app? app\n options[:as] ||= app_name(app, rails_app)\n\n target_as = name_for_action(options[:as], path)\n options[:via] ||= :all\n\n match(path, { to: app, anchor: false, format: false }.merge(options))\n\n define_generate_prefix(app, target_as) if rails_app\n self\n end", "def routes\n routes = {}\n self.class.each_route do |route|\n #routes[:name] = route.app.name # \"SomeSinatraApp\"\n info = {}\n routes[route.path.to_s.to_sym] = info # that's the path given as argument to get and akin\n info[:verb] = route.verb # get / head / post / put / delete\n info[:file] = route.file # \"some_sinatra_app.rb\" or something\n info[:line] = route.line # the line number of the get/post/... statement\n info[:pattern] = route.pattern # that's the pattern internally used by sinatra\n info[:keys] = route.keys # keys given when route was defined\n info[:conditions] = route.conditions # conditions given when route was defined\n info[:block] = route.block # the route's closure\n end\n routes\n end", "def set_routes\n puts '- SCOOP - Setting Sessions routes'\n\n routes = [\n \"\\n get 'login', to: 'sessions#new', as: 'login'\",\n \"\\n post 'login', to: 'sessions#create', as: 'create_login'\",\n \"\\n get 'logout', to: 'sessions#destroy', as: 'logout'\\n\\n\",\n ]\n\n routes.each do |r|\n inject_into_file 'config/routes.rb', r, before: 'end'\n end\n end", "def route\n [namespace, path].reject(&:blank?).join('/').prepend('/')\n end", "def routes_map; end", "def route(path, opts = {}, &block)\n @@routes << [path, opts, block]\n end" ]
[ "0.70681816", "0.69596416", "0.6746275", "0.67258734", "0.66335446", "0.66335446", "0.65869254", "0.65869254", "0.65869254", "0.65869254", "0.65869254", "0.65869254", "0.65869254", "0.65869254", "0.65869254", "0.65869254", "0.65869254", "0.65612406", "0.65478563", "0.64950246", "0.6468407", "0.6441166", "0.64233464", "0.6347697", "0.6316855", "0.6303443", "0.6254049", "0.6249575", "0.6233622", "0.61901796", "0.6143882", "0.60914963", "0.60894024", "0.6057801", "0.60475445", "0.6038745", "0.60340935", "0.6024764", "0.6012595", "0.60030466", "0.6001026", "0.59840846", "0.59566337", "0.59428674", "0.5893024", "0.5875547", "0.5871866", "0.5862906", "0.5862906", "0.5856124", "0.58430755", "0.5834996", "0.5823521", "0.58189183", "0.5799536", "0.5783737", "0.5768399", "0.5752765", "0.5752765", "0.5752765", "0.5752765", "0.5752765", "0.5752765", "0.5752765", "0.57524675", "0.5745098", "0.57411975", "0.5733353", "0.57308257", "0.5726233", "0.57249814", "0.57089746", "0.5698438", "0.5698438", "0.5698438", "0.56919044", "0.56919044", "0.56919044", "0.56919044", "0.5687577", "0.5687081", "0.5669456", "0.5661269", "0.5651491", "0.56484723", "0.5648421", "0.5647746", "0.56417847", "0.56404155", "0.563706", "0.56257075", "0.5619696", "0.5618982", "0.5618906", "0.5617467", "0.5613065", "0.5593343", "0.5592435", "0.55895436", "0.5585186" ]
0.6005704
39
Reloads all application files in path and presenter (if specified).
def load_app call_stack(:before, :load) # load src files @loader = Loader.new @loader.load_from_path(config.app.src_dir) # load the routes load_routes call_stack(:after, :load) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload!\n reset_routes! # remove all existing user-defined application routes\n Padrino.load_dependency(self.app_file) # reload the app file\n load_paths.each { |path| Padrino.load_dependencies(File.join(self.root, path)) } # reload dependencies\n end", "def reload!(path)\n unload! path\n load! path if File.file?(path) # condition to avoid errors when a file is removed or renamed...\n end", "def reload\n Dir.glob('**/*').each { |file| reload_file(file) }\n end", "def reload\n # reload the app file\n load(config.app.path)\n\n # reset config\n envs = config.app.loaded_envs\n config.reset\n\n # reload config\n self.class.load_config(*envs)\n\n load_app\n end", "def reload\n browser_files\n end", "def reloadable_apps\n Padrino.mounted_apps.select do |app|\n next unless app.app_file.start_with?(Padrino.root)\n app.app_obj.respond_to?(:reload) && app.app_obj.reload?\n end\n end", "def reload_regular(file)\n apps = mounted_apps_of(file)\n if apps.empty?\n reloadable_apps.each do |app|\n app.app_obj.reload! if app.app_obj.dependencies.include?(file)\n end\n safe_load(file)\n else\n apps.each { |app| app.app_obj.reload! }\n update_modification_time(file)\n end\n end", "def reload_builder path\n load __FILE__\n end", "def reload!\n Padrino.before_load.each(&:call) # Run before hooks\n Padrino::Reloader.reload! # detects the modified files\n Padrino.after_load.each(&:call) # Run after hooks\n end", "def refresh\n @manifest = load_manifest\n end", "def reload(path, native)\n\tloop{\n\tsleep(20)\n\tputs \"reloafding!\"\n\treturn initial(path, native);\n\t}\nend", "def reload!\n reload_lock.write_sync do\n self.class.erase_dependencies!\n\n if File.extname(self.class.source_file) != \".ru\"\n self.class.erase! [self.class.source_file],\n [self.class.name.split(\"::\").last],\n self.class.namespace\n require self.class.source_file\n end\n\n @app = self.class.source_class.new @rack_app, @override_options\n end\n end", "def load!\n @apps = []\n @path.children.each do |item|\n if item.file?\n begin\n @apps << App.new(item)\n rescue App::Invalid; end\n end\n end\n\n # Sort alphabetically\n @apps.sort!\n\n self\n end", "def reload_app \n return if @klass and @mtime and mtime <= @mtime\n\n if @requires\n @requires.each { |req| $LOADED_FEATURES.delete(req) }\n end\n k = @klass\n Object.send :remove_const, k.name if k\n load_app\n end", "def run_on_change(paths = {})\n @reloaded = true\n restart_without_waiting\n end", "def reload; @data = File.read @path end", "def reload!\n rotation do |file|\n next unless file_changed?(file)\n reload_special(file) || reload_regular(file)\n end\n end", "def reload\n load __FILE__\nend", "def cold_load!\n components_pattern = File.join(@directory, '**', '*' + @suffix)\n info \"Cold loading: #{components_pattern}\"\n Dir.glob(components_pattern).each { |file| reload! file }\n end", "def mirror_app!\n mirror_files_for mirrored_app_components\n end", "def reload\n return false unless visible?\n call('app.reset')\n true\n end", "def reload!\n @paths = {}\n\n files.each do |file|\n @paths[file.path] = file\n @paths[file.path_without_extension] ||= file\n end\n\n @paths.freeze\n end", "def restart_app(app_name)\n app_type = get_app_type(app_name)\n app_ver = \"\"\n app_dir = get_app_dir(app_name,app_ver)\n case app_type\n when /prefPane/\n %x[pkill \"System Preferences\"]\n %x[open \"/Applications/System Preferences.app\"]\n when /app|util/\n %x[pkill \"#{app_name}\"]\n %x[open \"#{app_dir}\"]\n end\n return\nend", "def reload\n load @filename\n end", "def reload\n @reloaded = true\n restart\n end", "def reload(scopes = {})\n setup unless running\n\n within_preserved_state do\n ::Guard::UI.clear(force: true)\n ::Guard::UI.action_with_scopes('Reload', scopes)\n\n if scopes.empty?\n evaluator.reevaluate_guardfile\n else\n runner.run(:reload, scopes)\n end\n end\n end", "def reloader; end", "def reloader; end", "def run_on_changes(paths = [])\n @runner.reload\n end", "def reload\n run \"touch #{current_path}/rack/tmp/restart.txt\"\n end", "def run_on_change(paths)\n restart_guard\n end", "def reload\n restart\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def loadFiles( reload = false )\n\t\t\t\tfiles().each do |file|\n\t\t\t\t\tfile.load( reload )\n\t\t\t\tend\n\t\t\tend", "def reload\n jammit\n end", "def reload\n Dir.glob(\"lib/**/*.rb\").each { |file|\n load file\n }\nend", "def refresh_watchers()\r\n paths = []\r\n\r\n # A list of all file paths the user passed in.\r\n unresolved_paths = @path.split(',')\r\n unresolved_paths = unresolved_paths.size == 0 ? @path : unresolved_paths\r\n\r\n # Glob all file paths and keep all readable files.\r\n for unresolved_path in unresolved_paths\r\n paths += Dir.glob(unresolved_path.strip).select do |resource|\r\n File.file?(resource) && File.readable?(resource)\r\n end\r\n end\r\n\r\n watched = @watched_files.keys\r\n\r\n # Files we are not yet watching.\r\n new_files = paths - watched\r\n\r\n # Files we are watching that no longer exist.\r\n dead_files = watched - paths\r\n\r\n start_watches(new_files)\r\n stop_watches(dead_files, true)\r\n end", "def reload!\n @reloader.reload! if @reloader\n end", "def reloads\n load_page\n end", "def reload!\n load force: true\n end", "def reload\n end", "def reload\n end", "def reload!\n load_all './lib'\nend", "def run_on_changes(paths)\n restart\n end", "def reload!\n initialize(@file_root)\n end", "def reload!\n @manifests = {}\n @strings_hash = {}\n end", "def reload\n raise 'not implemented'\n end", "def reload\n Guard::Compat::UI.info \"[Guard::WebPacker] Restarting #{@bin} ...\"\n restart\n end", "def reload_image path, placement = {}\n show_loader\n @propeller.process_image path, placement unless path.nil?\n end", "def reload\n return unless @reloading_enabled\n\n reload_lock.with_write_lock do\n @loader.reload\n end\n end", "def reload!\n @boxes.clear\n\n Dir.open(@directory) do |dir|\n dir.each do |d|\n next if d == \".\" || d == \"..\" || !@directory.join(d).directory?\n @boxes << Box.new(d, @directory.join(d), @action_runner)\n end\n end\n end", "def reload(klass_name=nil)\n\t\t\tif klass_name\n\t\t\t\tunload(klass_name)\n\t\t\t\tload(klass_name)\n\t\t\t\tklass_name\n\t\t\telse\n\t\t\t\tloaded = []\n\t\t\t\tunloaded = []\n\t\t\t\tDir.glob(\"#{@opts[:search_path]}/*.rb\") do |f|\n\t\t\t\t\tklass_name = file2klass(File.basename(f, \".rb\").sub(/^\\d+/, \"\"))\n\t\t\t\t\tif @plugins.include?(klass_name)\n\t\t\t\t\t\tif File.mtime(f) > @plugins[klass_name][:loaded]\n\t\t\t\t\t\t\tloaded << reload(klass_name)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tloaded << reload(klass_name)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t[loaded, unloaded]\n\t\t\tend\n\t\tend", "def reload!\n load './lib/try-new-beers/beer_review.rb'\nend", "def reloaders; end", "def reloaders; end", "def reload(env, app)\n system \"ey ssh -e #{translate_env(env,app)} 'rm -rf /data/#{translate_app(env,app)}/current/tmp/cache/*'\" # clear out cache\n if env == 'production' # total hack to clear cache on app2\n system \"ssh deploy@ec2-50-18-83-188.us-west-1.compute.amazonaws.com 'rm -rf /data/#{translate_app(env,app)}/current/tmp/cache/*'\"\n end\n restart(env, app)\nend", "def reload!\n unload!\n versions\n get_json\n get_map\n last_updated\n third_party_links\n mappings\n end", "def restart\n synchronize {\n if @app\n update_click_config\n else\n start\n end\n }\n end", "def reload;end", "def reload!\n puts \"Reloading...\"\n files = $LOADED_FEATURES.select { |feat| feat =~ /\\/t_chatter\\// }\n files.each { |file| load file }\n ARGV.clear\n true\nend", "def reload\n do_url 'reload', :put\n end", "def setup_watcher\n this = self\n Handler.send(:define_method, :app) do\n this\n end\n\n @@load_paths.each do |name, path|\n Dir[\"#{self.app_path}/#{path}\"].each do |f|\n EM.watch_file(f, Handler)\n end\n end\n end", "def reload!\n Merb::BootLoader::ReloadClasses.reload\n end", "def reload!\n Merb::BootLoader::ReloadClasses.reload\n end", "def also_reload(*glob)\n Dir[*glob].each { |path| Watcher::List.for(self).watch_file(path) }\n end", "def run_on_change(paths)\n UI.info(\"change noted for #{paths.join(\", \")}\")\n perform\n reactor.reload_browser(paths)\n end", "def restart_dir; end", "def with_reloading &block\n Cove::Ext.use_reload\n block.call\n ensure\n Cove::Ext.use_require\n end", "def reload!; end", "def reload!; end", "def reload!; end", "def reload!; end", "def reload\n end", "def app_load_path(*paths)\n paths.each do |path|\n dir = app_path(path)\n $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir)\n end\nend", "def refresh(monitored_paths)\n raise AbstractMethod\n end", "def reload!\n require 'pathname'\n Pathname.new(File.expand_path(__FILE__)).parent.find do |path|\n if path.extname == '.rb' and path.mtime > reload_time\n puts path.to_s\n load path.to_s\n end\n end\n clear_plugin_cache\n @reload_time = Time.now\n end", "def load_watcher\n require 'doozer/watcher'\n \n puts \"=> Watching files for changes\"\n watcher = FileSystemWatcher.new()\n \n # watcher.addDirectory(File.join(File.dirname(__FILE__),'../doozer/'), \"*.rb\")\n watcher.addDirectory( app_path + '/app/', \"**/*\")\n watcher.addDirectory( app_path + '/app', \"**/**/*\")\n watcher.addDirectory( app_path + '/config/', \"*.*\")\n watcher.addDirectory( app_path + '/lib/', \"*.*\")\n watcher.addDirectory( app_path + '/static/', \"*.*\")\n watcher.addDirectory( app_path + '/static/', \"**/**/*\")\n\n watcher.sleepTime = 1\n watcher.start { |status, file|\n if(status == FileSystemWatcher::CREATED) then\n puts \"created: #{file}\"\n load_files\n Doozer::Partial.clear_loaded_partials\n Doozer::MailerPartial.clear_loaded_partials\n elsif(status == FileSystemWatcher::MODIFIED) then\n puts \"modified: #{file}\"\n load_files\n Doozer::Partial.clear_loaded_partials\n Doozer::MailerPartial.clear_loaded_partials\n Doozer::Configs.clear_static_files\n elsif(status == FileSystemWatcher::DELETED) then\n puts \"deleted: #{file}\"\n load_files\n Doozer::Partial.clear_loaded_partials\n Doozer::MailerPartial.clear_loaded_partials\n Doozer::Configs.clear_static_files\n end\n }\n #don't join the thread it messes up rackup threading watcher.join()\n # p watcher.isStarted?\n # p watcher.isStopped?\n # p watcher.foundFiles.inspect\n end", "def reload\n Merb::BootLoader::ReloadClasses.reload\n end", "def reload\n load 'config/environment.rb'\nend", "def reload!\n gem_files = $LOADED_FEATURES.select { |f| f =~ /\\/#{@gem_name}/ }\n gem_files.each { |f| load f }\n end", "def reload!\n $\".grep( /hudkins/ ).each do |f|\n load f\n end\n nil\n end", "def load_files\n # load models\n load_models\n puts \"=> Caching files\"\n @@controllers = {}\n @@mailers = {}\n @@layouts={}\n @@views={}\n @@errors={}\n \n # require helper files and include into Doozer::Partial\n helper_files = Dir.glob(File.join(app_path,'app/helpers/*_helper.rb')) \n helper_files.each {|f|\n require f\n key = f.split(\"helpers/\")[1].gsub(/.rb/,'')\n Doozer::Partial.include_view_helper(key)\n }\n \n # cache contoller classes\n controller_files = Dir.glob(File.join(app_path,'app/controllers/*_controller.rb'))\n # we need to load the application_controller first since this might not be the first in the list...\n if controller_files.length > 0\n i=0\n for f in controller_files\n break if i==0 and f.index('application_controller.rb')\n if f.index('application_controller.rb')\n controller_files.insert(0, controller_files.delete(f))\n break\n end\n i+=1\n end\n end\n \n controller_files.each { |f|\n require f \n key = f.split(\"controllers/\")[1].split(\"_controller.rb\")[0]\n if key.index(\"_\")\n value = key.split('_').each{ | k | k.capitalize! }.join('') \n else\n value = key.capitalize\n end\n klass_name = \"#{value}Controller\"\n @@controllers[key.to_sym] = klass_name\n # p \"cache controller: #{key.to_sym}\"\n \n # importing view helpers into controller\n controller_klass = Object.const_get(klass_name)\n # automatically ads the application helper to the class\n controller_klass.include_view_helper('application_helper')\n controller_klass.include_view_helpers\n }\n \n # cache layout erb's\n layout_files = Dir.glob(File.join(app_path,'app/views/layouts/*.erb'))\n layout_files.each {|f|\n key = f.split(\"layouts/\")[1].split(\".html.erb\")[0].gsub(/.xml.erb/, '_xml').gsub(/.json.erb/, '_json').gsub(/.js.erb/, '_js').gsub(/.rss.erb/, '_rss').gsub(/.atom.erb/, '_atom')\n results = []\n File.new(f, \"r\").each { |line| results << line }\n @@layouts[key.to_sym] = ERB.new(results.join(\"\"))\n }\n \n #lood 404 and 500 pages if they exist\n pnf = Doozer::Configs.page_not_found_url\n if pnf\n file = File.join(app_path,\"#{pnf}\")\n results = []\n File.new(file, \"r\").each { |line| results << line }\n @@errors[404] = results.join(\"\")\n else\n @@errors[404] = \"<html><body>Sorry, this page can't be found.</body></html>\"\n end\n ise = Doozer::Configs.internal_server_error_url\n if ise\n file = File.join(app_path,\"#{ise}\")\n results = []\n File.new(file, \"r\").each { |line| results << line }\n @@errors[500] = results.join(\"\")\n else\n @@errors[500] = \"<html><body>There was an internal server error which borked this request.</body></html>\"\n end\n \n @@controllers.each_key { | key |\n # p key.inspect\n files = Dir.glob(File.join(app_path,\"app/views/#{key.to_s}/*.erb\"))\n files.each { | f |\n #!!!don't cache partials here!!!\n view = f.split(\"#{key.to_s}/\")[1].split(\".erb\")[0].gsub(/\\./,'_')\n # p \"check view: #{view}\"\n if not /^_/.match( view )\n # p \"cache view: #{view}\"\n results = []\n File.new(f, \"r\").each { |line| results << line }\n @@views[key] = {} if @@views[key].nil?\n @@views[key][view.to_sym] = ERB.new(results.join(\"\"))\n end\n }\n }\n\n mailer_files = Dir.glob(File.join(app_path,'app/mailers/*_mailer.rb'))\n mailer_files.each { |f|\n require f \n key = f.split(\"mailers/\")[1].split(\"_mailer.rb\")[0]\n if key.index(\"_\")\n value = key.split('_').each{ | k | k.capitalize! }.join('') \n else\n value = key.capitalize\n end\n klass_name = \"#{value}Mailer\"\n @@mailers[key.to_sym] = klass_name\n # puts \"cache mailer: #{key.to_sym}\"\n # importing view helpers into controller\n mailer_klass = Object.const_get(klass_name)\n # automatically ads the application helper to the class\n mailer_klass.include_view_helper('application_helper')\n mailer_klass.include_view_helpers\n }\n \n mail_key = :mail\n mailer_files = Dir.glob(File.join(app_path,\"app/views/#{mail_key.to_s}/*.erb\"))\n mailer_files.each { | f |\n #!!!don't cache partials here!!!\n view = f.split(\"#{mail_key.to_s}/\")[1].split(\".erb\")[0].gsub(/\\./,'_')\n if not /^_/.match( view )\n # puts \"cache view: #{view}\"\n results = []\n File.new(f, \"r\").each { |line| results << line }\n @@views[mail_key] = {} if @@views[mail_key].nil?\n @@views[mail_key][view.to_sym] = ERB.new(results.join(\"\"))\n end\n }\n end", "def refresh!\n load_gems_in(self.class.installed_spec_directories)\n end", "def reload\n msg = \"guard-self_test is reloaded...\"\n UI.info msg\n Notifier.notify(msg)\n end", "def run_on_change(paths = {})\n restart\n end", "def reload( root: nil, path: nil, encode: nil, decode: nil )\n clear\n @root = root || Dir.pwd\n @paths = ( path || DEFAULT_PATH ).gsub('$ROOT', @root).split(':')\n @paths = @paths.map{|it| !it.nil? && !it.empty? ? it : nil}.compact\n @paths << \".\" if @paths.empty?\n\n @vardir = @paths.last\n Dir.mkdir( @vardir ) unless ::Dir.exist?( @vardir )\n\n @encode = DEFAULT_ENCODE.merge( encode || {} )\n @decode = DEFAULT_DECODE.merge( decode || {} )\n\n load_overlay( DEFAULT_MASK )\n end", "def reload_bundles!\n bundles.each { |b| b.reload! }\n end", "def reload!\n ivar_cache(\"_rack_reloader\") do\n Mack::Reloader.new(nil)\n end.reload!\n end", "def reload\n Howitzer::Log.info \"Reload '#{current_url}'\"\n visit current_url\n end", "def load_and_run!\n File.open(@pathfile, \"w\") { |f| f.write(@pathfile_contents) }\n Pathological.add_paths!(@load_path)\n end", "def reload\n stop\n start\n end", "def reload!\n @sources.each {|k,s,v| do_load_source(k,s,v)}\n end", "def reload(package)\n wait_until(\"Reloading package\") do\n get \"/invoke/wm.server.packages/packageReload?package=#{CGI.escape package.to_s}\"\n end\n end", "def cycle\n before_cycle\n\n rotation{|file| @watcher.watch(file) }\n @watcher.changed_files{|f| safe_load(f) }\n\n after_cycle\n end", "def unloadpath(*paths)\r\n paths.each {|path| $LOAD_PATH.delete File.expand_path(path) }\r\n $LOAD_PATH\r\n end" ]
[ "0.64404416", "0.6351961", "0.61802226", "0.61424196", "0.60830826", "0.6008444", "0.60047865", "0.57990235", "0.5782164", "0.5780358", "0.5761967", "0.57479936", "0.5731425", "0.5661288", "0.56530845", "0.5608185", "0.55942667", "0.55843276", "0.55688506", "0.55611724", "0.55412036", "0.5539436", "0.5478229", "0.54746544", "0.5471914", "0.54105866", "0.54018253", "0.54018253", "0.5381229", "0.53770334", "0.5356964", "0.53527135", "0.53045666", "0.53045666", "0.53045666", "0.53045666", "0.53045666", "0.53045666", "0.53045666", "0.5302666", "0.5292268", "0.52875924", "0.52825725", "0.52823776", "0.5278298", "0.5274334", "0.52729887", "0.52729887", "0.527099", "0.52674407", "0.5247434", "0.52418613", "0.51582325", "0.5144723", "0.5137586", "0.51328284", "0.5123708", "0.5110937", "0.51058424", "0.5105181", "0.5105181", "0.510376", "0.5102708", "0.5100286", "0.50998926", "0.50997573", "0.5098183", "0.5097378", "0.50934243", "0.50934243", "0.50910324", "0.5089311", "0.5083647", "0.5080221", "0.5077117", "0.5077117", "0.5077117", "0.5077117", "0.50759715", "0.50747925", "0.5062927", "0.50387806", "0.50286084", "0.5005289", "0.5002432", "0.498226", "0.49770036", "0.49696356", "0.49676308", "0.49610874", "0.4953855", "0.49515915", "0.49474412", "0.49466935", "0.49391147", "0.4936926", "0.49334893", "0.49305865", "0.49208814", "0.49094605", "0.49068078" ]
0.0
-1
Stores set cookies at beginning of request cycle for comparison at the end of the cycle
def set_initial_cookies @initial_cookies = {} request.cookies.each {|k,v| @initial_cookies[k] = v } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookies\n call_once\n @cookies\n end", "def cookies() @_cookies ||= ::Merb::Cookies.new(request.cookies, @_headers) end", "def cookies; @cookies ||= CookieJar.new; end", "def collect_cookies_from_response; end", "def set_cookie(response)\n\t\ttest_cookie = response.get_fields('set-cookie')\n\n\t\tif @cookie_array.include? test_cookie\n\t\t\t@cookies\n\t\telse\n\t\t\t@cookie_array << test_cookie\n \t\t\t@cookies = @cookie_array.join('; ')\n \t\tend\n\t\t#@cookies = response.get_fields('set-cookie')\n\tend", "def needs_new_cookie!\n @_new_cookie = true\n end", "def needs_new_cookie!\n @_new_cookie = true\n end", "def needs_new_cookie!\n @_new_cookie = true\n end", "def finish\n @cookies.delete(RACK_SESSION_KEY)\n @cookies.each do |k,v|\n next unless changed?(k)\n v.nil? ? delete_cookie(k) : set_cookie(k, _merge_default_values(v))\n end if changed?\n end", "def stash_cookie\n cookies[self.class.els_options['cookie']] = {\n :value => @els_identity.token_id,\n :domain => request.env[\"SERVER_NAME\"],\n :path => '/',\n :expires => Time.now + 24.hours\n }\n end", "def finish\n @cookies.delete(Action::RACK_SESSION)\n if changed?\n @cookies.each do |k, v|\n next unless changed?(k)\n\n v.nil? ? delete_cookie(k) : set_cookie(k, _merge_default_values(v))\n end\n end\n end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def request_cookies\n Util.except!(@request.cookies.dup, *@config.ignored_cookies)\n end", "def init_cookies\n cookies[:language] = @language.code unless cookies[:language]\n cookies[:logged_in] = (admin? ? 'admin' : logged_in?.to_s) unless cookies[:logged_in]\n cookies.delete( :dont_cache ) if cookies[:dont_cache] and flash.empty? and request.request_uri =~ /^#{cookies[:dont_cache]}/\n end", "def cookies\n test_cookies\n end", "def set_pickup_cookies!\n if @pickup\n cookies[:pickup_id] = @pickup.id\n cookies[:key] = @pickup.key\n elsif params[:pickup_id] && params[:key]\n cookies[:pickup_id] = params[:pickup_id]\n cookies[:key] = params[:key]\n end\n end", "def cookies(cookies); end", "def load_keyword_cookies\n unless @keyword_cookies\n cookie_keywords = load_cookie_keywords\n\n @keyword_cookies = {}\n cookie_keywords.each do |cookie, keywords|\n keywords.each do |keyword|\n cookies = (@keyword_cookies[keyword] ||= Set.new)\n cookies.add(cookie)\n end\n end\n end\n @keyword_cookies\nend", "def initialize( *cookies )\n\t\t@cookie_set = Set.new( cookies.flatten )\n\tend", "def cookies\n WEBrick::Cookie.parse_set_cookies(@headers['set-cookie']) rescue []\n end", "def set_cookies(response)\n cookie_str = response.header['set-cookie']\n return if cookie_str.nil?\n\n fields = cookie_str.split(\"; \").inject({}) { |h, field|\n key, value = field.split(\"=\")\n h[key] = value\n\n h\n }\n\n # This is obviously not a generalized cookie implementation. Heh.\n fields.delete('path')\n @cookies = fields\n end", "def add_cookies(response)\n return unless response.key?('set-cookie')\n response.get_fields('set-cookie').each do |cookie|\n (key, val) = cookie.split('; ')[0].split('=', 2)\n cookies[key] = val\n end\n end", "def set_cookie(env, headers, cookie)\n request = Rack::Request.new(env)\n if request.cookies[@key] != cookie[:value] || cookie[:expires]\n Utils.set_cookie_header!(headers, @key, cookie)\n end\n end", "def cookies\n WEBrick::Cookie.parse_set_cookies(headers['Set-Cookie']) rescue []\n end", "def add_cookies!(request)\n request['Cookie'] = @cookies.collect{|k, v| \"#{k}=#{v}\"}.join(\", \")\n end", "def add_set_cookie *ck\n\t\t\tif ck.length > 0\n\t\t\t\th = (@headers[\"Set-cookie\"] ||= [])\n\t\t\t\tck.each {|c| h << c}\n\t\t\tend\n\t\tend", "def create_accesses_cookie\n cookies[:accesses] = {}.to_json\n end", "def cookie_jar=(cookie_jar); end", "def set_cookie_watcher\n @cookie_watcher = CookieWatcher.find(params[:id])\n end", "def set_cookie!\n cookies[:user_session] = {\n :value => token,\n :secure => controller.request.ssl?,\n :httponly => true,\n :expires => self.expires_at\n }\n end", "def save_auth_cookies!\n page.driver.browser.manage.add_cookie(name: 'dashboard_asset_version', value: TestChamber.dashboard_asset_string) if TestChamber.dashboard_asset_string\n TestChamber.user_cookies = page.driver.browser.manage.all_cookies\n end", "def add_cookie_if_needed(req)\n req.headers = { \"Cookie\" => conn.headers[\"Cookie\"] } unless conn.headers[\"Cookie\"].nil?\n end", "def cookies_required\n\t\treturn true unless cookies[\"cookie_test\"].blank?\n\t\tcookies[\"cookie_test\"] = Time.now\n\t\tsession[:return_to] = request.original_url\n\t\tredirect_to(cookie_test_path)\n\tend", "def set_cookie\n puts \"hello\"\n # puts @order.as_json\n puts \"-==-=-=-\"\n puts \"-==-=-=-\"\n puts cookies[:name] = current_admin.name\n puts \"-==-=-=-\"\n puts \"-==-=-=-\"\n end", "def cookies_required\n return true unless cookies[\"cookie_test\"].blank?\n cookies[\"cookie_test\"] = Time.now\n session[:return_to] = request.request_uri\n redirect_to(cookies_test_path)\n end", "def set_api_cookie!\n return unless @session_object\n\n session.delete :value\n @session_object.to_hash.each { |k, v| session[k] = v }\n end", "def store_location\n\t\tif request.get?\n\t\t\tcookies[:previous_url] = request.url\n\t\tend\n\tend", "def cookies\n @cookies_proxy ||= Class.new do\n attr_reader :controller, :response\n\n def initialize controller\n @controller, @response = controller, controller.response\n end\n\n # set cookie header\n #\n # @param [String, Symbol] key\n # @param [String, Hash] val\n # @return [Boolean]\n def []= key, val\n return if readonly?\n response.set_cookie key, val\n end\n\n # get cookie by key\n def [] key\n controller.orig_cookies[key]\n end\n\n # instruct browser to delete a cookie\n #\n # @param [String, Symbol] key\n # @param [Hash] opts\n # @return [Boolean]\n def delete key, opts ={}\n return if readonly?\n response.delete_cookie key, opts\n end\n\n # prohibit further cookies writing\n #\n # @example prohibit writing for all actions\n # before do\n # cookies.readonly!\n # end\n #\n # @example prohibit writing only for :render and :display actions\n # before :render, :display do\n # cookies.readonly!\n # end\n def readonly!\n @readonly = true\n end\n\n def readonly?\n @readonly\n end\n\n def method_missing *args\n controller.orig_cookies.send *args\n end\n end.new @ctrl\n end", "def set_api_cookie!\n return unless @session_object\n\n @session_object.to_hash.each { |k, v| session[k] = v }\n end", "def cookies # :doc:\n request.cookie_jar\n end", "def perform\n add_request_if_new do |request|\n self.class.notify_if_cookies_cleared request do\n request.path_set(*arguments)\n end\n end\n end", "def set_cookie(response)\n response.set_cookie(Webmetrics::Config.cookie_name, {\n :value => self.id,\n :path => \"/\",\n :expires => Time.now+Webmetrics::Config.cookie_expiration\n })\n end", "def store_session(res)\n my_cookie = WEBrick::Cookie.new('_rails_lite_app', @cookies.to_json)\n res.cookies << my_cookie\n end", "def set_sorting_cookies(oldest, newest, more_progress, less_progress)\n if oldest\n cookies.permanent[:sort_param] = 'oldest'\n elsif newest\n cookies.permanent[:sort_param] = 'newest'\n elsif more_progress\n cookies.permanent[:sort_param] = 'more_progress'\n elsif less_progress\n cookies.permanent[:sort_param] = 'less_progress' \n else\n cookies.permanent[:sort_param] = 'newest' \n end\n end", "def cookies\n @request.cookies\n end", "def cookies # :doc:\n request.cookie_jar\n end", "def cookies\n request.cookies\n end", "def cookies\n rack_request.cookies\n end", "def reset(cookies)\n @cookies, @backend = {}, cookies\n end", "def setUser\n cookies[:user_id]=current_user.id\n cookies[:is_tech]=current_user.tech\n end", "def cookie_persistence_method\n super\n end", "def check_cookie(response)\n\t\t\t if response.get_fields('set-cookie')\n \t\t\tset_cookie(response)\n \t\t\tprint \"new cookie: \"\n \t\t\tputs response.get_fields('set-cookie')\n \t\t\tputs @cookies\n \t\tend\n\t\tend", "def cookies\n request.cookies\n end", "def cookies\n request.cookies\n end", "def cookie\n self[HttpClient::SET_COOKIE]\n end", "def cookie\n @cookie ||= Coca::AuthCookie.new(cookies, scope)\n end", "def store_location\n cookies[:return_to] = {:value => @request.request_uri, :expires => nil }\n end", "def cookies\n @cookies ||= (self.headers[:set_cookie] || \"\").split('; ').inject({}) do |out, raw_c|\n key, val = raw_c.split('=')\n unless %w(expires domain path secure).member?(key)\n out[key] = val\n end\n out\n end\n end", "def setCookies(cookies)\n @fields['cookies'] = cookies\n self\n end", "def setCookies(cookies)\n @fields['cookies'] = cookies\n self\n end", "def set_cookies\n session_key = request.session_options[:id]\n\n if(!session_key.nil?)\n # Set the cookie the standard way (Set-Cookie)\n response.set_cookie(MOBILE_KEY, session_key)\n # Set the cookie the way the Android client expects it (set-cookie)\n headers[\"set-cookie\"] = headers[\"Set-Cookie\"]\n end\n end", "def session_remember\n httpsession = Thread.current[:hayabusa][:httpsession]\n raise \"Could not figure out HTTP-session.\" if !httpsession\n session = httpsession.session\n raise \"Could not get session-variable from HTTP-session.\" if !session\n session[:remember] = 1\n \n self.cookie(\n \"name\" => \"HayabusaSession\",\n \"value\" => _httpsession.session_id,\n \"path\" => \"/\",\n \"expires\" => Time.now + 32140800 #add around 12 months\n )\n end", "def emulate_javascript_set_cookie\n @browser.get(HOST + \"Login.asp\")\n @browser.get(HOST + \"Search.asp\")\n end", "def set(resource)\n @cookies.signed[cookie_name] = {value: [resource.id, Time.now.to_i]}.merge(cookie_options)\n end", "def add_to_cookie key, value\n cookie_hash = get_accesses_cookie\n cookie_hash[key] = value\n cookies[:accesses] = cookie_hash.to_json\n end", "def delete_all_cookies; end", "def set_cookie\n self.current_user.remember\n cookies[:auth_token] = { \n :value => self.current_user.remember_token, \n :expires => self.current_user.remember_token_expires_at }\n end", "def cookies # :doc:\n request.cookie_jar\n end", "def store_session(res)\n cookie = WEBrick::Cookie.new('_rails_lite_app', @cookie.to_json)\n res.cookies << cookie\n end", "def finalize(request)\n if @_destroy\n request.destroy_session_cookie\n elsif _original_session_data != (new_session_data = self.to_cookie)\n request.set_session_cookie_value(new_session_data)\n end\n end", "def set_cookie(cookie=nil)\n self.headers[\"Cookie\"] = cookie\n end", "def setup(request)\n session = self.new(Merb::SessionMixin.rand_uuid,\n request.session_cookie_value, request._session_secret_key)\n session._original_session_data = session.to_cookie\n request.session = session\n end", "def store_session(response)\n attributes = { path: \"/\", value: @cookie.to_json }\n response.set_cookie(APP_NAME, attributes)\n end", "def register_cookie_access\n # setup accesses attr on the cookie if it is not created, else check if is it to clear the cookie\n if cookies[:accesses].nil? || !get_accesses_cookie.is_a?(Hash)\n create_accesses_cookie\n else\n # Retrieve the access, based on it expression\n @access_data = get_accesses_cookie[access_expression]\n\n # Check if the date is today, if not, clear his cookie\n unless @access_data.nil?\n access_date = Date.parse(@access_data+\"/#{Time.now.year}\")\n clear_cookie if access_date < Date.today\n end\n end\n\n # The cookie[:accesses] is a Hash, retriUsing unshift (push in the begging of the array because if the user is recurrent it is more probably to be the last access)\n add_to_cookie(access_expression, \"#{Time.now.strftime('%d/%m')}-#{Time.now.strftime('%H:%M:%S')}\")\n end", "def reset_cookies\n if !user_signed_in?\n cookies.delete(:truck)\n end\n end", "def store_session(res)\n res_cookie = WEBrick::Cookie.new(\n \"_rails_lite_app\",\n @value.to_json\n )\n\n res_cookie.path = \"/\"\n res.cookies << res_cookie\n end", "def set_position\n if @search_form.search_location == I18n.t('conf.current_location')\n # erase cookie so that next time the current location will be used again\n cookies[:last_search_location] = nil\n else\n # set cookie so that next time the same location will be prefilled\n cookies[:last_search_location] = {\n value: @search_form.location_for_cookie,\n expires: 3.months.from_now\n }\n end\n end", "def set_cookies\r\n @sec_cookie = SecureRandom.uuid\r\n @csrf_cookie = SecureRandom.uuid\r\n\r\n post_data = \"#{rand_text_alpha(5..12)},#{rand_text_alpha(5..12)},\" +\r\n \"#{@sec_cookie},#{@csrf_cookie}\"\r\n\r\n res = send_request_cgi({\r\n 'uri' => '/ForensicsAnalysisServlet/',\r\n 'method' => 'POST',\r\n 'ctype' => 'application/json',\r\n 'cookie' => \"SEC=#{@sec_cookie}; QRadarCSRF=#{@csrf_cookie};\",\r\n 'vars_get' =>\r\n {\r\n 'action' => 'setSecurityTokens',\r\n 'forensicsManagedHostIps' => \"#{rand(256)}.#{rand(256)}.#{rand(256)}.#{rand(256)}\"\r\n },\r\n 'data' => post_data\r\n })\r\n\r\n if res.nil? or res.code != 200\r\n fail_with(Failure::Unknown, \"#{peer} - Failed to set the SEC and QRadar CSRF cookies\")\r\n end\r\n end", "def initialize(req)\r\n\t\t@req = req\r\n\t\tcookie = @req.cookies.select { |cookie| cookie.name == COOKIE_NAME }.first\r\n\t\tunless cookie.nil?\r\n\t\t\tcookie_data = JSON.parse(cookie.value)\r\n\t\t\tself.merge(cookie_data)\r\n\t\tend\r\n\tend", "def cookie_jar; end", "def cookie_jar; end", "def cookie_jar; end", "def cookie_jar; end", "def store_session(res)\n res.cookies << WEBrick::Cookie.new('_rails_lite_app', @hash.to_json)\n end", "def index\n for i in 1..200\n #cookies[\"cookie \"+i.to_s] = { value: \"Guru \"+i.to_s, secure: true}\n end\n end", "def set_login_cookie(crawler_name=nil, crawler_password=nil, ip=nil, date=nil)\n crawler_name ||= @crawler_name\n crawler_password ||= @crawler_password\n ip ||= \"127.0.0.1\"\n date ||= 2.days.from_now\n\n cookie_jar = ActionDispatch::Request.new(Rails.application.env_config.deep_dup).cookie_jar\n cookie_jar.signed[AdsenseCrawlerForPrivate.cookie_name] =\n AdsenseCrawlerForPrivate.cookie_str(crawler_name, crawler_password, date, ip)\n\n cookies[AdsenseCrawlerForPrivate.cookie_name] = cookie_jar[AdsenseCrawlerForPrivate.cookie_name]\n end", "def needs_new_cookie?\n @_new_cookie\n end", "def server_cookies(response)\n raw_cookies = response.headers['Set-Cookie']\n return if raw_cookies.blank?\n\n raw_cookies.map { |ck| parse_server_cookie(ck) }\n end", "def refresh_expiration \n \t self.needs_new_cookie=true \n \tend", "def cookies_enabled\n return true unless cookies[\"cookieTest\"].blank?\n cookies[\"cookieTest\"] = Time.now\n session[:return_to] = request.fullpath\n if cookies[\"cookie_test\"].blank?\n return false\n end\n return true\n end", "def vary_page_caching_on_user\n response.headers['Vary'] = 'Cookie'\n end", "def refresh_credentials(cookies)\n cookies['dc_logged_in'] = {:value => 'true', :expires => 1.month.from_now, :httponly => true}\n end", "def use_cookies= bool\n if bool && (!@headers['Cookie'] || @headers['Cookie'].empty?)\n cookie = Kronk.cookie_jar.get_cookie_header @uri.to_s\n @headers['Cookie'] = cookie unless cookie.empty?\n\n else\n @headers.delete 'Cookie'\n end\n\n @use_cookies = bool\n end", "def store_session(res)\n res.set_cookie(cookie_key, { value: @cookie.to_json, path: '/' })\n end" ]
[ "0.747537", "0.7376184", "0.7074061", "0.6962543", "0.6907773", "0.6784072", "0.6784072", "0.6784072", "0.67754376", "0.67403436", "0.67327803", "0.66543406", "0.66543406", "0.66543406", "0.66543406", "0.66543406", "0.66543406", "0.66543406", "0.6635044", "0.66191334", "0.65368134", "0.653625", "0.65343237", "0.6532127", "0.65283215", "0.6508406", "0.6498911", "0.64785624", "0.64748305", "0.64713496", "0.64602005", "0.64454067", "0.6440746", "0.64282066", "0.63927156", "0.6375812", "0.6367263", "0.63574094", "0.63445646", "0.63424766", "0.633166", "0.63227075", "0.63077337", "0.63013905", "0.6297975", "0.6272527", "0.62645227", "0.6260466", "0.62595004", "0.62324333", "0.6230235", "0.622412", "0.62099385", "0.62060416", "0.61983204", "0.61880076", "0.6180475", "0.61799407", "0.6176621", "0.61755836", "0.61739373", "0.6169425", "0.6164905", "0.6164499", "0.6164337", "0.6164337", "0.61497825", "0.613647", "0.6122593", "0.61222523", "0.6118184", "0.60995716", "0.6084848", "0.6082259", "0.60631835", "0.6056982", "0.60564274", "0.6030905", "0.6016438", "0.601601", "0.601223", "0.6011045", "0.60062444", "0.60015106", "0.5985382", "0.5975873", "0.5975873", "0.5975873", "0.5975873", "0.5974508", "0.5961867", "0.5958615", "0.5957749", "0.5956833", "0.59482", "0.5945944", "0.5934882", "0.59337443", "0.5932229", "0.59283584" ]
0.75812143
0
Description/summary of the position.
def description data['Description'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def position\n end", "def position\n @position\n end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position\n return @position\n end", "def position\n return @position\n end", "def position\n\t\treturn \"#{@x} #{@y} #{PlanetModel::ORIENTATIONS.invert[@angle.abs % 360].to_s}#{if @lost == true then ' LOST' end}\"\t\n\tend", "def pos\n @pos\n end", "def pos()\n #This is a stub, used for indexing\n end", "def pos()\n #This is a stub, used for indexing\n end", "def pos() end", "def pos() end", "def pos() end", "def pos() end", "def position\n puts \"X: #{@x_coord}\"\n puts \"Y: #{@y_coord}\"\n puts \"Direction: #{@direction}\"\n end", "def display_position\n # Fill this in\n end", "def display_position\n # Fill this in\n end", "def pos\n end", "def pos\n end", "def pos\n end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def to_s\n \"Position <#{@row}, #{@col}>\"\n end", "def display_position(state)\n position = state[:position]\n puts \"Current position: \"\n position.each do |row|\n puts row.join(\" \")\n end\n end", "def position\n attributes.fetch(:position)\n end", "def pos\n @pos || uninitialized!\n end", "def text_position\n end", "def tip_position\n @tipPosition\n end", "def to_s\n @position.to_s\n end", "def position\n return [@x, @y, @heading]\n end", "def position\n @state[\"position\"]\n end", "def position_address\n \"#{@data['SIDO']} #{@data['L_SIGUN_GU']} #{@data['L_DONG']} #{@data['GIBUN']}\"\n end", "def pos()\n #This is a stub, used for indexing\n end", "def location\n\t\treturn \"line %s, column %s\" % [\n\t\t\tself.linenum || '??',\n\t\t\tself.colnum || '??',\n\t\t]\n\tend", "def pos\n @pos ||= node.attr('pos')\n end", "def inspect\n \"#<#{self.class} @index=#{index}, @position=#{position}>\"\n\t\n\tend", "def pos\n [posx, posy]\n end", "def pos=\n end", "def pos=\n end", "def position\n return default_position if dettached_resource?\n\n [\n subject_position, # subject\n resource_type_position, # resource_type\n resource.grades.average_number, # grades\n module_position, # module\n unit_position, # unit\n lesson_position, # lesson\n resource.grades.list.size # number of grades\n ].map { |v| v.to_s.rjust(2, '0') }.join(' ')\n end", "def position\n @entry.position\n end", "def position \n\t\treturn @y,@x\n\tend", "def position _args\n \"position _args;\" \n end", "def human_x_pos\n '%.2f' % points_to_human(x_pos) unless x_pos.nil?\n end", "def report\n check_placed\n \"#{position},#{facing}\"\n end", "def show_position(position, wearer = \"You\")\n\n if wearer == \"You\"\n eq = @equipment[position]\n eq = eq.compact if eq\n if eq and not eq.empty?\n eq = eq.collect {|o| @inventory[o].name }.simple_list\n \"\\t#{eq} on your #{nice(position)}.\"\n else\n nil\n end\n\n else\n eq = @equipment[position]\n if eq\n item = nil\n eq[1..-1].each do |o|\n if o\n item = o\n break\n end\n end\n\n if item and eq[0]\n \"\\t#{@inventory[eq[0]].name} over #{@inventory[item].name} on #{wearer.pronoun(:possessive)} #{nice(position)}.\"\n elsif item\n \"\\t#{@inventory[item].name} on #{wearer.pronoun(:possessive)} #{nice(position)}.\"\n elsif eq[0]\n\n \"\\t#{@inventory[eq[0]].name} on #{wearer.pronoun(:possessive)} #{nice(position)}.\"\n else\n nil\n end\n else\n nil\n end\n end\n\n end", "def future_position_summaries\n []\n end", "def name\n I18n.t(@position, scope: :\"models.position\")\n end", "def pos\n @position[:current]\n end", "def position\n pos = parent.atomic_position\n locator = document.new_record? ? \"\" : \".#{document._index}\"\n \"#{pos}#{\".\" unless pos.blank?}#{document._association.store_as}#{locator}\"\n end", "def position\n\t\t[ @x, @y ]\n\tend", "def report\n return unless placed?\n [@pos_x, @pos_y, @direction[:value]]\n end", "def screen_position\n position\n end", "def report\n return 'Not on table' if @position.nil? || @direction.nil?\n\n \"#{@position[:x]},#{@position[:y]},#{@direction.to_s.upcase}\"\n end", "def position\n first.position\n end", "def pos\n @layout[@pos - 1]\n end", "def pos_header\n @position - 2\n end", "def report\n return \"Not on board\" if @position.nil? or @direction.nil?\n\n \"#{@position[:x]},#{@position[:y]},#{@direction.to_s.upcase}\"\n end", "def report\n return \"Not on board\" if @position.nil? or @direction.nil?\n\n \"#{@position[:x]},#{@position[:y]},#{@direction.to_s.upcase}\"\n end", "def position\n [@x, @y]\n end", "def show\r\n @positions.each do |p|\r\n\t puts p.inspect\r\n\tend\r\n end", "def position\n [ @row_offset, @col_offset ]\n end", "def position\n current.position\n end", "def displayPosition\n print \"New rover position is (#{@currentPos.x}, #{@currentPos.y}) facing \"\n\n case @currentDir\n when :north\n print \"North\\n\"\n when :south\n print \"South\\n\"\n when :east\n print \"East\\n\"\n when :west\n print \"West\\n\"\n end\n end", "def inspect\n \"#<#{self.class}: #{at.inspect},#{@offset.inspect}>\"\n end", "def position\n _response_word.fetch(\"position\", nil)\n end", "def to_s\n \"#{position[0]} #{position[1]} #{@direction}\"\n end", "def getPos _args\n \"getPos _args;\" \n end", "def inspect\r\n \"#<#{self.class}: #{at.inspect},#{@offset.inspect}>\" \r\n end", "def visiblePosition _args\n \"visiblePosition _args;\" \n end", "def pos=(pos); end", "def position()\n @view__.position.toVector\n end", "def text_pos(pos = @pos)\t\n\t\treturn to_text(pos[0]) + (pos[1] + 1).to_s\n\tend", "def report_robot_details details\r\n\tprint(\"\\nCurrent position details\")\r\n\tprintf(\"\\nFORMAT : (X,Y) - Face Direction => (%d,%d) - %s\", details.x, details.y, DIRECTIONS[details.f])\r\nend", "def arguments\n [position.to_s]\n end", "def report_location\n return \"#{@coords_x} #{@coords_y} #{@orientation}\" if @alive\n return 'ROVER LOST' unless @alive\n end", "def position=(value)\n @position = value\n end", "def position=(value)\n @position = value\n end", "def absolute_position(position)\n position.move(row: current_comment_block.first.location.line - 1, column: current_comment_block.first.location.column)\n end", "def text_position=(pos)\n end", "def base_description(_)\n if style == brace_alignment_style\n 'the position of the opening parenthesis'\n else\n 'the start of the line where the left parenthesis is'\n end\n end", "def position_label\n $log.debug \"XXX: LABEL row #{@label.row}, #{@label.col} \"\n @label.row @row unless @label.row #if @label.row == -1\n @label.col @col-(@label.name.length+1) unless @label.col #if @label.col == -1\n @label.label_for(self) # this line got deleted when we redid stuff !\n $log.debug \" XXX: LABEL row #{@label.row}, #{@label.col} \"\n end", "def location\n \"#{@position} #{DIRECTIONS[@orientation]}\"\n end", "def inspect\n \"#<Piece pos: #{pos}, color: #{color}>\"\n end", "def position=(point); end", "def text_coordinate\n return 39, 5, 222, 16\n end", "def pos\n @read\n end", "def cur_pos\n @cursor.pos\n end", "def detail\n \"#{line}\\n#{' ' * line_offset}^\"\n end", "def location\n [@posX, @posY, @facing]\n end", "def position\n fetch('football.positions')\n end" ]
[ "0.75115", "0.7471844", "0.7220684", "0.7220684", "0.7220684", "0.7220684", "0.7220684", "0.7220684", "0.7220684", "0.7220684", "0.71404636", "0.71404636", "0.71396554", "0.71387583", "0.70974743", "0.70974743", "0.70482033", "0.70482033", "0.70482033", "0.70482033", "0.70340294", "0.7030761", "0.7030761", "0.7011646", "0.7011646", "0.7011646", "0.6983539", "0.6983539", "0.6983539", "0.6983539", "0.6983539", "0.6983539", "0.6950103", "0.69302523", "0.68819416", "0.6817651", "0.6764357", "0.669629", "0.66915154", "0.6682097", "0.66780806", "0.66751575", "0.66674495", "0.6647706", "0.6634367", "0.66127217", "0.65445834", "0.6535997", "0.6535997", "0.65264845", "0.65123665", "0.65110326", "0.6473174", "0.6461475", "0.6458887", "0.6446751", "0.644302", "0.64291626", "0.641183", "0.64057875", "0.64014953", "0.6387524", "0.6375099", "0.6337762", "0.63336813", "0.6328207", "0.6319823", "0.63197035", "0.63197035", "0.6318377", "0.6313724", "0.6307192", "0.63025326", "0.62818825", "0.62775636", "0.62703335", "0.6263603", "0.62459624", "0.6242733", "0.6240895", "0.622384", "0.6211072", "0.6207396", "0.61942184", "0.6181153", "0.6180749", "0.61712265", "0.61712265", "0.6152331", "0.6143242", "0.6141275", "0.6138469", "0.6130699", "0.6121038", "0.6107198", "0.60916245", "0.6090922", "0.60867953", "0.60768026", "0.6062661", "0.60614103" ]
0.0
-1
Array of Sovren position history job categories.
def categories data['JobCategory'] || [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories\n Category.position_sorted\n end", "def clil_categories_codes\n self.clil_categories.map{|c| c.code}.uniq\n end", "def clil_categories_codes\n self.clil_categories.map { |c| c.code }.uniq\n end", "def activity_log_student_time_categories_array\n activity_log_student_time_categories.try(:split, \"\\n\").try(:collect, &:strip).to_a\n end", "def activity_log_non_student_time_categories_array\n activity_log_non_student_time_categories.try(:split, \"\\n\").try(:collect, &:strip).to_a\n end", "def categories\n categories = Array.new\n unless self.category.nil?\n categories << self.category\n categories += self.category.ancestors\n end # unless\n categories.reverse\n end", "def categories\n category_keys.collect(&:to_s)\n end", "def categories\n return [] if @categories.blank?\n @categories.records.map {|c| c.display_name}\n end", "def categories\n categories = []\n @deck.cards.map do |turn|\n categories << turn.category\n end\n categories.uniq!\n end", "def getCategories()\n\t\tcat = Array.new\n\t\tcat.push(\"heroku\")\n\t\tcat.push(\"go\")\n\t\tcat.push(\"github\")\n\t\tcat.push(\"docker\")\n\t\tcat.push(\"css\")\n\t\tcat.push(\"apache\")\n\t\tcat.push(\"html\")\n\t\tcat.push(\"bootstrap\")\n\t\tcat.push(\"java ee\")\n\t\tcat.push(\"javafx\")\n\t\tcat.push(\"java\")\n\t\tcat.push(\"jquery\")\n\t\tcat.push(\"mips\")\n\t\tcat.push(\"c++\")\n\t\tcat.push(\"laravel\")\n\t\tcat.push(\"linux\")\n\t\tcat.push(\"opengl\")\n\t\tcat.push(\"sml\")\n\t\tcat.push(\"javascript\")\n\t\tcat.push(\"mongo db\")\n\t\tcat.push(\"c\")\n\t\tcat.push(\"yacc\")\n\t\tcat.push(\"circuit\")\n\t\tcat.push(\"php\")\n\t\tcat.push(\"mysql\")\n\t\tcat.push(\"node js\")\n\t\tcat.push(\"photoshop\")\n\t\tcat.push(\"rails\")\n\t\tcat.push(\"postgres\")\n\t\tcat.push(\"ruby\")\n\t\tcat.push(\"redis\")\n\t\tcat.push(\"mac osx\")\n\t\tcat.push(\"sass\")\n\t\tcat.push(\"ubuntu\")\n\t\tcat.push(\"bower\")\n\t\tcat.push(\"wordpress\")\n\t\tcat.push(\"css\")\n\t\tcat.push(\"hosted\")\n\t\tcat.push(\"python\")\n\t\tcat.push(\"maven\")\n\t\tcat.push(\"maven mojo\")\n\t\tcat.push(\"composer\")\n\t\tcat.push(\"mips\")\n\t\tcat.push(\"gulp\")\n\t\tcat.push(\"grunt\")\n\t\tcat.push(\"phpstorm\")\n\t\tcat.push(\"react\")\n\t\tcat.push(\"swift\")\n\t\tcat.push(\"wordpress\")\n\t\tcat.push(\"tomcat\")\n\t\tcat.push(\"redis\")\n\t\tcat.push(\"travis\")\n\t\treturn cat\n\tend", "def categories\n []\n end", "def categories\n return @todo_container.keys\n end", "def get_categories\n cats = []\n params.each do |k,v|\n if k.starts_with? \"category\"\n name = v\n num = cat_number(k) \n cats << [name,num]\n end\n end\n return cats\n end", "def category_names\n categories.map {|category| CategoryCode[category]}\n end", "def event_categories\n data.event_categories\n end", "def approved_sell_categories\n @approved = ApprovedSellCat.where(trader_id: current_trader.id, status: 1)\n @approved_cat = Array.new(@approved.length)\n count = 0\n @approved.each do |f|\n @approved_cat[count] = f.sell_cat\n count = count + 1\n end\n return @approved_cat\n end", "def categories\n return @categories\n end", "def category categories\n categories = categories.to_a if !categories.is_a? Array\n categories.collect { |i| calendars.find_by_title i.to_s }.compact\n end", "def categories\n @categories = response[\"categories\"] || []\n @categories.map!{|category| Foursquared::Response::Category.new(client, category)}\n end", "def categories\n return @categories\n end", "def categories\n return @categories\n end", "def categories\n return @categories\n end", "def categories\n return [] if @feed.channel.categories.empty? && @feed.channel.dc_subjects.empty?\n [@feed.channel.categories, ((@feed.channel.dc_subjects.empty?) ? nil : @feed.channel.dc_subjects)].flatten.uniq.compact.collect{|c| c.content}.reject{|c| c == '' || c.match(/^\\s+$/)}\n end", "def categories\n parsed_json['data']\n end", "def categories\n response[\"categories\"].map!{|category| Foursquared::Response::Category.new(client, category)} if response[\"categories\"]\n end", "def categories\n if @categories.nil?\n @categories = []\n category_nodes =\n FeedTools::XmlHelper.try_xpaths_all(self.channel_node, [\n \"category\",\n \"dc:subject\"\n ])\n unless category_nodes.nil?\n for category_node in category_nodes\n category = FeedTools::Category.new\n category.term = FeedTools::XmlHelper.try_xpaths(category_node, [\n \"@term\",\n \"text()\"\n ], :select_result_value => true)\n category.term.strip! unless category.term.blank?\n category.label = FeedTools::XmlHelper.try_xpaths(\n category_node, [\"@label\"],\n :select_result_value => true)\n category.label.strip! unless category.label.blank?\n category.scheme = FeedTools::XmlHelper.try_xpaths(category_node, [\n \"@scheme\",\n \"@domain\"\n ], :select_result_value => true)\n category.scheme.strip! unless category.scheme.blank?\n @categories << category\n end\n end\n end\n return @categories\n end", "def category_names\n self.categories.map do |category|\n category.name\n end\n end", "def get_tracking_categories\n response_xml = http_get(@client, \"#{xero_url}/TrackingCategories\")\n\n parse_response(response_xml, {}, {:request_signature => 'GET/TrackingCategories'})\n end", "def to_array\n [ self.company.name,\n self.invoice_num,\n self.invoice_date,\n self.operation_date,\n self.reporter,\n self.notes,\n self.status,\n self.categories.pluck(:name).join(\";\")\n ]\n end", "def categories_list\n self.categories.collect{|c| c.name}\n end", "def categories\n nodes = @doc.xpath(\"atom:feed/atom:category\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomCategory.new(node) }\n end", "def categories\n\t\t\t@cat_cache ||= @db.js('musicthoughts.all_categories()').map {|c| c.merge(category: c[@lang]) }\n\t\t\t@cat_cache\n\t\tend", "def array_for_stage(jobs)\n jobs, _ = jobs.to_a.first if jobs.is_a? Hash\n\n jobs.inject([]) do |arr, job|\n arr << if job.is_a? Hash\n # Take just the job class, without any dependents\n job.keys[0]\n else\n job\n end\n end\n end", "def crew_categories\n array = []\n full_credits.css('h4.dataHeaderWithBorder').reject{ |h| h['id'] == 'cast' }.map do |node|\n array << (node.children.size > 1 ? node.children.first.text.strip_whitespace : node.children.text.strip_whitespace)\n end\n\n array\n end", "def categories\n if self.channel.generator == 'Twitter'\n return @item.title.scan(/#([^#\\s]+)/).flatten\n end\n return [] if @item.categories.empty?\n @item.categories.collect{|c| c.content}.reject{|c| c == '' || c.match(/^\\s+$/)}\n end", "def categories(arg_)\n @config.lock\n\n objdata_ = _get_objdata(arg_)\n return nil unless objdata_\n hash_ = {}\n objdata_[2].each do |tup_, tupcats_|\n tupcats_.each do |cat_|\n hash_[cat_] = @categories[cat_][1].map{ |elem_| tup_[elem_] }\n end\n end\n hash_\n end", "def bisac_categories_codes\n self.bisac_categories.map{|c| c.code}.uniq\n end", "def updated_product_category_ids(pos)\n categories = pos.product_category_ids\n if pos.pos_type.zero?\n pos.market_stalls.each do |stall|\n categories.concat(stall.product_category_ids)\n end\n categories.uniq!\n end\n categories\n end", "def get_categories(row)\n categories = []\n cat = at_in(:category1 , row) # should invent some loop here\n categories << cat if cat\n cat = at_in(:category2 , row) # but we only support\n categories << cat if cat\n cat = at_in(:category3 , row) # three levels, so there you go\n categories << cat if cat\n categories\n end", "def bisac_categories_codes\n self.bisac_categories.map { |c| c.code }.uniq\n end", "def categories\n @categories ||= wayfinder.decorated_vocabularies.sort_by(&:label)\n end", "def to_categories(sub_context)\n Array(sub_context).map { |id|\n categories[id] \n }.compact\n end", "def parent_categories\n c = self\n categories = []\n until c.parent.blank? do\n c = c.parent\n categories.unshift c\n end\n categories\n end", "def job_history\n history = []\n record = nil\n\n command('llist jobs').split(\"\\n\").each do |line|\n next unless line.index ': '\n key, value = line.split(': ', 2)\n key.strip!\n value.chomp!\n\n if key == 'JobId'\n record = { key => value }\n history << record\n elsif record\n record[key] = value\n end\n end\n\n history\n end", "def tab_title_array(tab)\n category_name = tab.category.title.singularize\n tab.category.tabs.size > 1 ? [category_name, tab.title] : [category_name]\n end", "def category_names\n @category_names || categories.map(&:name).join(' ')\n end", "def categories\n if nodes = @node.xpath(\"category\")\n nodes.map { |node| RSSCategory.new(node) }\n end\n end", "def source_result_category_names\n category_names\n end", "def categories\n notify Category.all(:order => \"name ASC\").collect {|c| c.name_with_id }.join(\"\\n\")\n end", "def get_categories()\n\t\tzomoato_categories_url = @base_uri + \"categories\"\n\t\tresponse = HTTParty.get(zomoato_categories_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@categories = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\t\treturn @categories\n\tend", "def categories\n @transactions.empty? ? nil : @transactions.delete_if{ |t| t.category.nil? }.collect(&:category).uniq\n end", "def restore_categories\n\t\tlist = nil\n\t\tPStore.new(cache_file).transaction do |db|\n\t\t\tlist = db['category'] if db.root?('category')\n\t\t\tdb.abort\n\t\tend\n\t\tlist || []\n\tend", "def _tags\n tags = []\n categories.find_each do |category|\n tags << category.self_and_ancestors.pluck(:name)\n end\n tags.flatten.uniq\n end", "def categories_for_file(file)\n _, categories = CATEGORIES.find do |key, _|\n filename_regex, changes_regex = Array(key)\n\n found = filename_regex.match?(file)\n found &&= changed_lines(file).any? { |changed_line| changes_regex.match?(changed_line) } if changes_regex\n\n found\n end\n\n Array(categories || :unknown)\n end", "def ffck_categories_detailed()\n ['Pitchoun', 'Poussin 1', 'Poussin 2', 'Benjamin 1', 'Benjamin 2', 'Minime 1', 'Minime 2', 'Cadet 1', 'Cadet 2',\n 'Junior 1', 'Junior 2', 'Senior', 'Veteran 1', 'Veteran 2', 'Veteran 3', 'Veteran +', 'Inconnu']\n end", "def categories\n category\n end", "def series\n []\n end", "def channel_categories\n build :channel_categories, :using => data_for(:channel_categories)\n end", "def categories_list\n @categories = Category.all.collect { |p| [p.name, p.id] }\n end", "def categories_for(race)\n [ race.category ] + race.category.descendants\n end", "def categories(parent_id = nil)\n categories_data = Rails.cache.fetch('ebay_categories', expires_in: 10.day) do\n categories = client.call(:GetCategories, CategorySiteID: 0, ViewAllNodes: true, DetailLevel: 'ReturnAll')\n categories = categories.category_array.category.map do |c|\n {\n name: c[:category_name],\n id: c[:category_id].to_s,\n parent_id: c[:category_parent_id].to_s,\n level: c[:category_level],\n }\n end\n {\n by_parent_id: categories.group_by { |r| r[:parent_id] },\n by_level: categories.group_by { |r| r[:level] }\n }\n end\n categories_formatter(categories_data, parent_id)\n rescue\n []\n end", "def categories_for(item)\n return [] unless @items[item]\n\n @items[item].categories\n end", "def main_categories\n categories.to_a[0..3]\n end", "def getCategories\n @categories = []\n @categories << Category.new(name: \"All\", id: -1)\n @categories += Category.all\n end", "def categories\n @categories ||= (@doc/\"Category\").collect { |it| Element.new(it) }\n end", "def analyze\n @categories = Violation.unique_categories\n end", "def getCategoryList\n categoryDump = @course.assessment_categories\n categories = {}\n for cat in categoryDump do\n categories[cat.name] = cat.id\n end\n return categories\n end", "def categories\n stories.map(&:category).delete_if {|c| c.nil? or c.global}.uniq\n end", "def add_category_to_jobs(category,jobs)\n jobs.each {|j| j.categories = [category]}\n jobs\n end", "def categories\n rpg_shop.handled_categories\n end", "def categories_for_solution_search(category)\n [Sfcatnode.root] + category.children\n end", "def extract_categories cats\n cats.inject Hash.new do |hash, tag|\n\n # iterate through groups if the tag belongs to multiple\n tag[\"groups\"].each do |group|\n name = group[\"name\"]\n hash[name] ||= []\n hash[name] << tag[\"name\"]\n end\n hash\n end\n end", "def history\r\n []\r\n end", "def get_missions_in_cat\r\n missions = []\r\n \r\n return missions\r\n end", "def get_tracking_categories\n response_xml = http_get(\"#{xero_url}/tracking\")\n parse_response(response_xml) \n end", "def categories\n pages = page.children.all(\n :conditions => { :class_name => 'ShopCategoryPage' },\n :order => 'pages.position ASC'\n ).map(&:shop_category)\n end", "def categories\n document.css('#jumpto a').map(&:text)\n end", "def categories\n # {{{\n if !@categories then\n inherited_cats = []\n if respond_to?(:parent_groups) then\n inherited_cats = parent_groups.map { |g| g.categories }.flatten\n end\n own_cats = User_Category.all_with(User_Category.user_group_id == user_group_id).sort_by(:category_name, :asc)\n @categories = inherited_cats + own_cats.to_a\n end\n @categories\n end", "def categories\n Hash[self.class.catalogs.map { |fld, klass|\n name = fld.gsub(/_id$/, '_name');\n [fld, {:id => self.send(fld), :name => self.send(name)}] rescue nil\n }.reject {|cat| cat.nil?}]\n end", "def get_categories\n @cards.each do |card|\n if !@categories.include?(card.category)\n @categories << card.category\n end\n end\n @categories\n end", "def available_jobs\n details.at('#filmography').css(\"div[data-category$='Movie']\").map{ |job| job['data-category'].gsub('Movie', '') }\n end", "def categories\n raw_categories.to_hashugar\n end", "def class_tickers es\n class_names = es.map(&:class_name).uniq\n last_date = last_commit_month(es)\n class_names.map {|cn| [cn,class_lifeline_ticker(es, cn, last_date)] }\n .sort_by {|line| line.length }\n .reverse\nend", "def categories_from_hash(hash)\n cat = []\n (1..hash.size).each { |i|\n cat.push(Item_Category.new(hash[i][0], hash[i][1]))\n }\n cat\n end", "def category_titles\n categories.map(&:title)\n end", "def active_jobs\n result = Array.new\n self.jobs.each do |j|\n if j.private?\n result << j\n elsif j.active?\n result << j\n end\n end\n result\n end", "def get_cates_descs\n categoryDescArr = []\n categoriesRoot = Category.where(parent_id: 0).limit(6)\n categoriesRoot.each do |parentCate|\n cateInfo = []\n firstChildren = Category.where(parent_id: parentCate.id).limit(3)\n childrenNameStr = ''\n firstChildren.each do |child|\n childrenNameStr += child.name+\",\"# remove last ,\n \n end\n \n cateInfo << parentCate.id\n cateInfo << parentCate.name\n cateInfo << childrenNameStr\n \n categoryDescArr << cateInfo\n\n end \n \n return categoryDescArr\n end", "def get_known_categories\n rKnownCategories = {}\n\n @MySQLConnection.query('SELECT name, id, value_type FROM stats_categories').each do |iRow|\n iCategoryName, iCategoryID, iValueType = iRow\n rKnownCategories[iCategoryName] = [ iCategoryID.to_i, iValueType.to_i ]\n end\n\n return rKnownCategories\n end", "def ffck_categories()\n %w(Pitchoun Poussin Benjamin Minime Cadet Junior Senior Veteran Inconnu)\n end", "def categories_for(race)\n case race.name\n when \"Junior Men\", \"Junior Women\"\n [ Category.find_or_create_by(name: race.name) ]\n else\n super race\n end\n end", "def history\n @parent ? @parent.history + [@name] : []\n end", "def selected_categories\n list = []\n @browser.div(:id=>\"assignlocation_jstree_selected_container\").lis.each do |li|\n list << li.text\n end\n return list\n end", "def history_items\n return @history_items\n end", "def categories(metrics)\n cats = Set.new\n metrics.keys.each do |meta|\n next if meta.scope.nil? # ignore controller\n if match=meta.metric_name.match(/\\A([\\w|\\d]+)\\//)\n cats << match[1]\n end\n end # metrics.each\n cats\n end", "def getContexts(className)\n taggings = ActsAsTaggableOn::Tagging.where([\"taggable_type like ?\", className]).\n distinct(:context)\n \n contexts = Array.new\n\n # for each context get the set of tags (sorted), and add them to the collection for display on the page\n taggings.each do |tagging|\n contexts << tagging.context\n end\n \n return contexts\n end", "def all_categories\n @mutex.synchronize do\n @categories.keys\n end\n end", "def category_enum\n Category.all.collect {|p| [ p.name, p.id ] }\n end", "def category_key_value_pairs\n categories.collect{|k,v| [k,v['sCategory']]} rescue []\n end", "def jobs\n self.ListJobs.first.map { |j| map_job(j) }\n end", "def all_categories_to_top\n list = []\n # Never figured out inject\n current = self\n while current.present?\n list.prepend current\n current = current.nil? ? nil : current.parent_category\n end\n list.flatten!\n list\n end" ]
[ "0.60339916", "0.5817439", "0.57953984", "0.5772682", "0.57708603", "0.5763281", "0.5700613", "0.56918633", "0.56786466", "0.5661815", "0.5606624", "0.5605586", "0.5565057", "0.5564378", "0.55531037", "0.5551822", "0.5542173", "0.5536872", "0.54887426", "0.5434261", "0.5434261", "0.5434261", "0.5423962", "0.5423721", "0.54074794", "0.5400733", "0.53562605", "0.53560483", "0.5347518", "0.53414124", "0.5317089", "0.5314347", "0.5286845", "0.527782", "0.5277815", "0.5271743", "0.52677906", "0.5248411", "0.5248028", "0.52343273", "0.523118", "0.5223424", "0.5213091", "0.5199192", "0.51904196", "0.5181338", "0.5177027", "0.51617503", "0.5148574", "0.51389235", "0.5130945", "0.5123985", "0.51039135", "0.5095419", "0.5092909", "0.5086818", "0.50795895", "0.50762236", "0.5058869", "0.50549895", "0.50508356", "0.5047101", "0.5045898", "0.502765", "0.5011152", "0.49800742", "0.49799654", "0.49786776", "0.49746126", "0.4963994", "0.49633172", "0.49628392", "0.49571458", "0.4951327", "0.49504328", "0.49476105", "0.4937749", "0.49375883", "0.49351698", "0.49019298", "0.48951072", "0.48890054", "0.4885924", "0.48848888", "0.4882318", "0.48796353", "0.48730248", "0.48594555", "0.485568", "0.4849624", "0.48419365", "0.4838917", "0.4833417", "0.4827388", "0.48269287", "0.48218545", "0.48212212", "0.48154095", "0.4813268", "0.48111024" ]
0.7244381
0
Sovren specific position metadata.
def metadata data['UserArea'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metadata(pos)\n raise(ArgumentError,\"'pos' argument cannot be nil\") if pos.nil?\n return @interface.GetMetadata(pos).first\n end", "def custom_meta_data\n {\n position: 9\n }\n end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position_field_name meta\n self.class.determine_position_field_name meta\n end", "def position\n end", "def position\n attributes.fetch(:position)\n end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos_header\n @position - 2\n end", "def pos() end", "def pos() end", "def pos() end", "def pos() end", "def pos()\n #This is a stub, used for indexing\n end", "def pos()\n #This is a stub, used for indexing\n end", "def position\n @position\n end", "def save_pos; end", "def pos\n end", "def pos\n end", "def pos\n end", "def arguments\n [position.to_s]\n end", "def pos()\n #This is a stub, used for indexing\n end", "def metadata_start\n 2\n end", "def pos\n @pos\n end", "def position\n @position ||= begin\n row, column = filename_with_position.split(':').slice(1..2)\n Parsing::Location.new(row: row.to_i, column: column.to_i)\n end\n end", "def text_position=(pos)\n end", "def future_position_summaries\n []\n end", "def pos=(pos); end", "def position _args\n \"position _args;\" \n end", "def parse_position(info)\n ## FIXME: push into parse\n if RbConfig::CONFIG['target_os'].start_with?('mingw') and\n info =~ /^[A-Za-z]:/\n drive_letter = info[0..1]\n info = info[2..-1]\n else\n drive_leter = nil\n end\n info = parse_location(info) if info.kind_of?(String)\n case info.container_type\n when :fn\n if (meth = method?(info.container)) && meth.iseq\n return [meth, meth.iseq.source_container[1], info.position,\n info.position_type]\n else\n return [nil] * 4\n end\n when :file\n filename = canonic_file(info.container)\n # ?? Try to look up method here?\n frame =\n if @frame\n container = frame_container(@frame, false)\n try_filename = container[1]\n frame = (canonic_file(try_filename) == filename) ? @frame : nil\n else\n nil\n end\n # else\n # LineCache.compiled_method(filename)\n # end\n return frame, filename, info.position, info.position_type\n when nil\n if [:line, :offset].member?(info.position_type)\n if @frame\n container = frame_container(@frame, false)\n filename = container[1]\n else\n errmsg \"No stack\"\n return [nil] * 4\n end\n\n return @frame, canonic_file(filename), info.position, info.position_type\n elsif !info.position_type\n errmsg \"Can't parse #{arg} as a position\"\n return [nil] * 4\n else\n errmsg \"Unknown position type #{info.position_type} for location #{arg}\"\n return [nil] * 4\n end\n else\n errmsg \"Unknown container type #{info.container_type} for location #{arg}\"\n return [nil] * 4\n end\n end", "def markerPos _args\n \"markerPos _args;\" \n end", "def position=(_arg0); end", "def pos=\n end", "def pos=\n end", "def pos_index_header\n pos_page_body\n end", "def position\n return @position\n end", "def position\n return @position\n end", "def position\n _response_word.fetch(\"position\", nil)\n end", "def get_position_list\n\n end", "def position_description_subs\n {\n 'positions' =>\n PostingPosition.joins(:position).where(posting: @posting).order(\n :'positions.position_code'\n ).pluck(\n 'positions.position_code',\n 'positions.position_title',\n 'positions.duties',\n 'positions.qualifications',\n 'hours',\n 'num_positions'\n )\n .map do |(code, title, duties, qualifications, hours, num_positions)|\n {\n position_code: code,\n position_title: title,\n duties: duties,\n qualifications: qualifications,\n hours: hours,\n num_positions: num_positions\n }.stringify_keys\n end\n }\n end", "def position_address\n \"#{@data['SIDO']} #{@data['L_SIGUN_GU']} #{@data['L_DONG']} #{@data['GIBUN']}\"\n end", "def pos_fseg_header\n pos_index_header + size_index_header\n end", "def position\n pos = parent.atomic_position\n locator = document.new_record? ? \"\" : \".#{document._index}\"\n \"#{pos}#{\".\" unless pos.blank?}#{document._association.store_as}#{locator}\"\n end", "def s_coords(attrs)\n height = (attrs['HEIGHT'] || 0).to_i\n width = (attrs['WIDTH'] || 0).to_i\n hpos = (attrs['HPOS'] || 0).to_i\n vpos = (attrs['VPOS'] || 0).to_i\n [hpos, vpos, width, height]\n end", "def oxygen_pos\n @map.key(OXYGEN)\n end", "def pos\n @pos ||= node.attr('pos')\n end", "def seek(pos, rio = nil)\n if pos.kind_of?(DataHeader)\n unless io_index = @io.index(pos.io)\n raise \"#{pos} does not come from this log fileset\"\n end\n @rio = io_index\n @next_block_pos = pos.block_pos\n else\n\t\traise ArgumentError, \"need rio argument, if pos is not a DataHeader\" unless rio\n\t\t@rio = rio\n @next_block_pos = pos\n end\n nil\n end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def pos\n @pos || uninitialized!\n end", "def update_position\n xsub = find{ |n| n.respond_to?(:position) }\n position = xsub.position if xsub\n end", "def update_position\n end", "def update_position\n end", "def update_position\n end", "def pos\n file.pos\n end", "def series_position\n volume = series_volume&.then { |v| \"vol. #{v}\" }\n issue = series_issue&.then { |n| \"no. #{n}\" }\n [volume, issue].compact.join(', ') if volume || issue\n end", "def position\n @entry.position\n end", "def metadata=(_arg0); end", "def position\n return [@x, @y, @heading]\n end", "def getposname()\r\n return getvalue(SVTags::POS_NAME)\r\n end", "def load_position_data\n\n if @parameters[:precomputed_position_data] and FileInteraction.position_file_exists?(@parameters) then\n \n return FileInteraction.read_position_data(@parameters)\n\n end\n\n nil\n\n end", "def getPos _args\n \"getPos _args;\" \n end", "def pos_records\n size_fil_header +\n size_index_header +\n size_fseg_header\n end", "def pos=(pos)\n @pos = pos\n end", "def send_position_to_engine\n if @fen\n write_to_engine(\"position fen #{@fen}\")\n else\n position_str = \"position startpos\"\n position_str << \" moves #{@moves.join(' ')}\" unless @moves.empty?\n write_to_engine(position_str)\n end\n end", "def convert_position!\n trx = self[:TrX]\n try = self[:TrY]\n\n self[:TrX] = 0\n self[:TrY] = 0\n self[:TrZ] = 0\n\n # To fix an issue with pto reading files ignoring attributes that have a =0\n trx = '0.0' if trx == 0.0\n try = '0.0' if try == 0.0\n\n self[:d] = trx\n self[:e] = try\n self\n end", "def text_position\n end", "def metadata\n\t \"#{$0} #{@width} #{@height} #{@seed}\" \n\tend", "def position\n @state[\"position\"]\n end", "def pos\n @stream.pos\n end", "def pos= integer\n #This is a stub, used for indexing\n end", "def position(position)\n where(positions: { short_name: position })\n end", "def position\n fetch('football.positions')\n end", "def position(position=nil)\n @options[:position] = position unless position.nil?\n @options[:position]\n end", "def position_encoding\n attributes.fetch(:positionEncoding)\n end", "def metadata\n\t \"#{$0} #{@width} #{@height} #{@seed}\"\n\tend", "def metadata\n\t \"#{$0} #{@width} #{@height} #{@seed}\"\n\tend", "def show_position(position, wearer = \"You\")\n\n if wearer == \"You\"\n eq = @equipment[position]\n eq = eq.compact if eq\n if eq and not eq.empty?\n eq = eq.collect {|o| @inventory[o].name }.simple_list\n \"\\t#{eq} on your #{nice(position)}.\"\n else\n nil\n end\n\n else\n eq = @equipment[position]\n if eq\n item = nil\n eq[1..-1].each do |o|\n if o\n item = o\n break\n end\n end\n\n if item and eq[0]\n \"\\t#{@inventory[eq[0]].name} over #{@inventory[item].name} on #{wearer.pronoun(:possessive)} #{nice(position)}.\"\n elsif item\n \"\\t#{@inventory[item].name} on #{wearer.pronoun(:possessive)} #{nice(position)}.\"\n elsif eq[0]\n\n \"\\t#{@inventory[eq[0]].name} on #{wearer.pronoun(:possessive)} #{nice(position)}.\"\n else\n nil\n end\n else\n nil\n end\n end\n\n end", "def setStatsPos(stats_pos)\n @stats_pos = stats_pos\n end", "def pos_fsp_header\n pos_fil_header + size_fil_header\n end", "def pos_fil_header\n 0\n end", "def pos_data_dictionary_header\n pos_page_body\n end", "def pos=(_arg0); end", "def snv_position_in_site_1_pwm\n if orientation_1 == :direct\n - pos_1\n else\n pos_1 + length - 1\n end\n end", "def capturable_position(options)\n file = options[:file]\n rank = current_position.rank + capturing_pawn.rank_direction\n\n Coordinate.new(file, rank)\n end" ]
[ "0.6903077", "0.6537075", "0.62324804", "0.62324804", "0.62324804", "0.62324804", "0.62324804", "0.62324804", "0.62324804", "0.62324804", "0.6125764", "0.6054265", "0.6051254", "0.6010373", "0.6010373", "0.6010373", "0.6010373", "0.6010373", "0.6010373", "0.59558505", "0.5922976", "0.5922976", "0.5922976", "0.5922976", "0.58986604", "0.58986604", "0.58399236", "0.5806354", "0.57875913", "0.57875913", "0.57875913", "0.5785781", "0.5777511", "0.57473886", "0.5742169", "0.5711552", "0.5659243", "0.5655569", "0.563192", "0.56194955", "0.55775523", "0.5535073", "0.5527309", "0.5506926", "0.5506926", "0.55048096", "0.549945", "0.549945", "0.549118", "0.5490963", "0.5475956", "0.5473806", "0.54647064", "0.54598945", "0.54484093", "0.54406065", "0.5440423", "0.542785", "0.5424155", "0.5424155", "0.5424155", "0.5424155", "0.5424155", "0.5424155", "0.5424155", "0.54186165", "0.5405549", "0.54031086", "0.54031086", "0.54031086", "0.54004186", "0.5388842", "0.53883046", "0.53833", "0.5382122", "0.5382006", "0.5374722", "0.537457", "0.5369971", "0.53648126", "0.536291", "0.5358512", "0.53576434", "0.53499216", "0.5347668", "0.53475904", "0.5347559", "0.5344591", "0.5343481", "0.5342474", "0.5332765", "0.53282666", "0.53282666", "0.5321541", "0.53115696", "0.53095603", "0.53037715", "0.53020096", "0.52991456", "0.5289779", "0.52867436" ]
0.0
-1
Uses the dockercompose CLI to fetch the associated container IDs
def container_ids @container_ids ||= DockerCompose.new(project).container_ids end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def containers_ids\n containers(:response_format => :id_array)\n end", "def get_containers\n content = YAML::load(File.read(docker_compose_file))\n content.has_key?('version') ? content['services'].keys : content.keys\n end", "def start_all_containers\n system('docker compose -f docker-compose.yml up -d')\nend", "def docker_id(name)\n\t\treturn command_send(\"sudo docker ps -a --no-trunc -f name=#{name} | grep '\\\\s#{name}$' | tail -n 1 | awk '{ print $1 }'\")\n\tend", "def get_docker_instance_list(options)\n message = \"Information:\\tListing docker images\"\n command = \"docker ps\"\n output = execute_command(options,message,command)\n instances = output.split(/\\n/)\n return instances\nend", "def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n filters: { id: container_ids }.to_json\n ).map(&:json)\n end", "def containers_for_image(img = docker_image)\n `docker ps -aq -f ancestor=#{img}`.split(\"\\n\")\n end", "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", "def get_container_id(name)\n compose_execute(\"ps\", \"-q\", name).chomp\n end", "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", "def current_container_id\n cgroup_content = File.read(\"/proc/1/cgroup\")\n @running_in_container = cgroup_content.include? \"docker/\"\n if @running_in_container\n cgroup_content.split.each { |line|\n if line.include? \"docker/\" or line.include? \"kubepods/\"\n parts = line.split(\":\")\n res_parts = parts[2].split(\"/\")\n return res_parts[-1][0..12]\n end\n }\n end\n nil\nend", "def docker_compose_container\n get_config(:docker_compose_container).to_s\n end", "def shell(args)\n container=`docker-compose ps -q web`.strip\n system(\"docker exec -it #{container} bash\")\n end", "def container_instances\n instances = []\n @client.describe_tasks(cluster: @cluster, tasks: tasks)[0].each do |e|\n instances << e[:container_instance_arn]\n end\n instances\n end", "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", "def compose_cmd\n \"docker-compose -f #{specfile} --project-name #{compose_name} --project-directory #{approot}\"\n end", "def exec(args)\n container=`docker-compose ps -q web`.strip\n system \"docker exec -it #{container} #{args.join(' ')}\"\n end", "def exec(args)\n container=`docker-compose ps -q web`.strip\n system \"docker exec -it #{container} #{args.join(' ')}\"\n end", "def containers\n containers_exited(days_old: 1)\n containers_running(days_old: 1)\n end", "def running_container_count\n `#{setup_docker_env_vars_str} docker ps`.split(\"\\n\").size - 1\nend", "def docker_commands\n []\n end", "def up_ids\n with_fig(%w(ps -q)) do |exec_obj|\n exec_obj.run\n\n # parse stdout..\n re = Regexp.new '^[0-9a-zA-Z]+'\n res = []\n\n exec_obj.stdout.split(\"\\n\").each do |line|\n next unless line.match(re)\n res << line.chomp.strip\n end\n\n return res\n end\n nil\n end", "def id\n container.id\n end", "def get_running_containers\n\n containers = []\n running_tasks = get_list_tasks_result\n running_tasks.task_arns.each do |task_arn|\n containers << RaisEcs::Container.new({\n cloud: @cloud,\n cluster: @cluster,\n service: self,\n task_arn: task_arn\n })\n end\n\n return containers\n\n end", "def instance_for(challenge) \n instance_id = `docker run -P -d #{challenge['name']}`.chomp\n port = `docker port #{instance_id} #{challenge['port']}`.chomp.split(/:/)[1]\n [instance_id, port]\n end", "def containers\n TestLab::Container.all\n end", "def running_containers\n containers = ::Docker::Container.all(all: true, filters: { status: [\"running\"] }.to_json)\n return containers\n end", "def docker_console\n index = 0\n choice = '0'\n choices = []\n sentence = \"\"\n rootFolder = Dir.pwd\n\n index = 0\n @endpoints.each do |ep|\n containername = \"ep_#{ep[:path]}_#{@projectname}\"\n sentence << \"[#{index}] - #{containername} \\n\"\n choices << \"#{index}\"\n index = index + 1\n end\n\n # if only one endpoint, ssh into in without prompt\n choice = ask(\"Which endpoint ?\\n#{sentence}\", limited_to: choices) unless index == 1\n\n index = 0\n @endpoints.each do |ep|\n if choice.to_i == index\n Dir.chdir(\"#{rootFolder}/#{ep[:path]}\")\n framework = ep[:frameworkname]\n containername = \"ep_#{ep[:path]}_#{@projectname}\"\n cmd = ask(\"Which console command (#{framework}) ?\\nno need to specify binary, only parameters\\n\")\n cmd.gsub!('/usr/bin/', '')\n cmd.gsub!('/usr/local/bin/', '')\n cmd.gsub!('/bin/', '')\n cmd.gsub!(/php ?/, '')\n # execute framework specific updb\n case framework\n when /Symfony/\n cmd.gsub!('bin/console', '')\n cmd.gsub!('app/console', '')\n system \"docker pull nextdeploy/#{framework.downcase}console\"\n system \"docker run --net=#{@projectname}_default -v=#{Dir.pwd}:/var/www/html nextdeploy/#{framework.downcase}console #{cmd}\"\n when /Drupal/\n cmd.gsub!('drush', '')\n system \"docker pull nextdeploy/drush\"\n system \"docker run --net=#{@projectname}_default -v=#{Dir.pwd}:/app nextdeploy/drush -y #{cmd} 2>/dev/null\"\n when /Wordpress/\n cmd.gsub!('wp.phar', '')\n cmd.gsub!('wp', '')\n system \"docker pull nextdeploy/wp\"\n system \"docker run --net=#{@projectname}_default -v=#{Dir.pwd}:/app nextdeploy/wp #{cmd}\"\n end\n\n docker_reset_permissions(containername)\n end\n index = index + 1\n end\n\n Dir.chdir(\"#{rootFolder}\")\n end", "def docker_manifest_ids(id)\n criteria = {:type_ids => [Runcible::Extensions::DockerManifest.content_type],\n :fields => {:unit => [], :association => ['unit_id']}}\n\n unit_search(id, criteria).map { |i| i['unit_id'] }\n end", "def id\n container_info.ids[0] if container_info.entries.length == 1\n end", "def container_id\n @container_info[\"Id\"]\n end", "def docker_image_ids(id)\n criteria = {:type_ids => [Runcible::Extensions::DockerImage.content_type],\n :fields => {:unit => [], :association => ['unit_id']}}\n\n unit_search(id, criteria).map { |i| i['unit_id'] }\n end", "def find_container_by_commit_id(commit_id, opts={})\n logger = opts[:logger] || Logger.new(STDOUT)\n\n logger.info(\"Getting container id for commit id<#{commit_id}>\")\n \n containers = ::Docker::Container.all.map{|c| c.json}\n\n logger.info(\"Now number of running containers: #{containers.size}\")\n\n ids = Config.read_ids\n\n if ids.empty?\n logger.info(\"No ids in id file\")\n return nil\n end\n\n matched_images = ids.select{|i| i[0] == commit_id}.map{|i| i[1]}\n return nil if matched_images.empty?\n\n matched_container = containers.select{|c| matched_images.include?(c[\"Image\"])}.first\n return nil unless matched_container\n\n return \"#{matched_container[\"NetworkSettings\"][\"IPAddress\"]}:#{CONTAINER_PORT}\"\n end", "def status(args)\n system(\"docker-compose ps\")\n end", "def status(args)\n system(\"docker-compose ps\")\n end", "def shell(args)\n if(!args[0])\n target = 'web'\n to = 'bash'\n else\n target = args[0]\n to = args[1]\n end\n container=`docker-compose ps -q #{target}`.strip\n system(\"docker exec -it #{container} #{to}\")\n end", "def get_docker_image_list(options)\n message = \"Information:\\tListing docker images\"\n command = \"docker image list\"\n output = execute_command(options,message,command)\n images = output.split(/\\n/)\n return images\nend", "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", "def parse_args\n # Not using a proper option parse library, as it will get confused\n # by options for the command given. We use a simple parser.\n while /^-/ =~ ARGV[0]\n option = ARGV.shift\n case option\n when '-c', '--container'\n @container = ARGV.shift\n if !get_containers.include? @container\n abort \"Unknown container #{@container}\"\n end\n when '-v', '--verbose'\n @verbose = true\n when '-n', '--dry-run'\n @verbose = true\n @dry_run = true\n when '-?', '--print-service'\n @query = true\n when '-l', '--list-containers'\n @list_containers = true\n when '-h', '--help'\n STDERR.puts <<-HEREDOC\nUsage: #{File.basename($0)} [OPTIONS]... COMMAND\nRuns COMMAND in docker-compose container.\n\nOn first run, asks for the service container to use and saves it to .dce_container next\nto the docker-compose.yml file.\n\nIf no command given, opens a shell.\n\nOptions:\n -c, --container SERVICE use the container of the specified service\n replaces the selected container in the .dce_container\n -v, --verbose print exec'ed command\n -n, --dry-run only print exec'ed command, don't run\n -?, --print-service print the service saved\n -l, --list-containers print the containers available\n -h, --help print this help and exit\n\n HEREDOC\n exit\n else\n abort \"Unknown option #{option}\"\n end\n end\n\n @command = ARGV.join(' ')\n end", "def containers_path\n @containers_path ||= @cli.config('lxc.lxcpath')\n end", "def docker_tag_ids(id)\n criteria = {:type_ids => [Runcible::Extensions::DockerTag.content_type],\n :fields => {:unit => [], :association => ['unit_id']}}\n\n unit_search(id, criteria).map { |i| i['unit_id'] }\n end", "def container_names\n (@pod.dig(:spec, :containers) + self.class.init_containers(@pod)).map { |c| c.fetch(:name) }.uniq\n end", "def container\n return @container if defined? @container\n if @options[:reattach]\n all_containers = Docker::Container.all(all: true)\n all_containers.each do |container|\n if container.info['Image'] == @tag\n @container = Docker::Container.get(container.info['id'])\n end\n end\n begin\n @container = Docker::Container.create('Image' => @tag)\n rescue Docker::Error::NotFoundError\n puts \"Could not find an image with @tag #{@tag}\"\n return nil\n end\n elsif !ARGV.empty?\n @container = Docker::Container.create('Image' => @tag,\n 'Cmd' => ARGV,\n 'Env' => ['DISPLAY=:0'])\n elsif @options[:wayland]\n @container = Docker::Container.create('Image' => @tag,\n 'Env' => ['DISPLAY=:0'],\n 'Cmd' => ['startplasmacompositor'])\n else\n @container = Docker::Container.create('Image' => @tag,\n 'Env' => [\"DISPLAY=:#{xdisplay}\"])\n end\n @container\n end", "def docker_mongo\n containername = \"mongo_#{@projectname}\"\n exec \"docker exec -t -i #{containername} /usr/bin/mongo\"\n end", "def container_id\n if !params[:container_id].nil?\n return params[:container_id]\n else\n return params[:id]\n end\n end", "def compute_list_ids(mixins = nil)\n # TODO: impl filtering with mixins\n backend_compute_pool = ::OpenNebula::VirtualMachinePool.new(@client)\n rc = backend_compute_pool.info_all\n check_retval(rc, Backends::Errors::ResourceRetrievalError)\n\n compute = []\n backend_compute_pool.each do |backend_compute|\n compute << backend_compute['ID']\n end\n\n compute\n end", "def container_id\n return @container_id\n end", "def jenkins_id(opts)\n\tres = run_in_shell \"docker ps -aqf \\\"name=#{opts[:name]}\\\"\", true\n\tres.gsub( /\\n/, '' )\nend", "def get_ip_of_container(container_id)\n `docker inspect --format '{{ .NetworkSettings.IPAddress }}' #{container_id}`.chomp\n end", "def docker_getport(containername)\n %x{docker ps --filter name=#{containername} --format \"{{.Ports}}\" | sed \"s;->.*$;;\" | sed \"s;^.*:;;\" | head -n 1 | tr -d \"\\n\"}\n end", "def docker_start_command(container, command, options=\"\")\n\t\t# Check if running\n\t\t_id = command_send(\"sudo docker ps --no-trunc -f name=#{container} | grep -v Exited | grep '\\\\s#{container}$' | tail -n 1 | awk '{print $1}'\")\n\t\treturn _id if (_id && !(_id.eql? \"\"))\n\n\t\t# Start busybox container with command\n\t\t_id = command_send(\"([ \\\"$(sudo docker ps -a -f name=#{container} | grep '\\\\s#{container}$' | wc -l)\\\" -eq 0 ] || sudo docker rm -f #{container} &>/dev/null) && sudo docker run -d --name #{container} --security-opt seccomp=unconfined #{options} busybox #{command} | tail -n 1\")\n\t\tsleep(10)\n\t\treturn _id\n\tend", "def ephemeral_containers\n return @ephemeral_containers\n end", "def name_ids\n parse_pipelines_name_id(@http.pipelineConfigs.get)\n rescue StandardError => e\n puts \"Error getting all pipeline names and IDs from Spinnaker: #{e}\"\n Process.exit(1)\n end", "def docker_manifest_list_ids(id)\n criteria = {:type_ids => [Runcible::Extensions::DockerManifestList.content_type],\n :fields => {:unit => [], :association => ['unit_id']}}\n\n unit_search(id, criteria).map { |i| i['unit_id'] }\n end", "def determine_docker_host_for_container_ports\n\n begin\n docker_host = Resolv.getaddress('docker')\n puts \"Host alias for 'docker' found. Assuming container ports are exposed on ip '#{docker_host}'\"\n rescue\n docker_host = Resolv.getaddress(Socket.gethostname)\n puts \"No host alias for 'docker' found. Assuming container ports are exposed on '#{docker_host}'\"\n end\n\n docker_host\n\nend", "def build_environment_docker_images(environment, system_exec)\n system_exec.execute_docker_compose(environment, :build)\nend", "def docker_composersh(reset=false)\n rootFolder = Dir.pwd\n\n # get last container version\n system \"docker pull nextdeploy/composersh\"\n\n @endpoints.each do |ep|\n containername = \"ep_#{ep[:path]}_#{@projectname}\"\n Dir.chdir(\"#{rootFolder}/#{ep[:path]}\")\n system \"docker run --net=#{@projectname}_default -v=#{Dir.pwd}:/app -w /app nextdeploy/composersh --reset #{reset}\"\n\n docker_reset_permissions(containername)\n end\n\n Dir.chdir(rootFolder)\n end", "def docker_info()\n# changed cmd to use full path for security\n# cmd = 'docker info'\n cmd = which('docker') + \" info\"\n\tOpen3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|\n docker_info_stdout=stdout.read\n containers = docker_info_stdout.grep(/Containers/).to_s.split(':',2).last\n images = docker_info_stdout.grep(/Images/).to_s.split(':',2).last\n driver = docker_info_stdout.grep(/Driver/).to_s.split(':',2).last\n root_dir = docker_info_stdout.grep(/Root Dir/).to_s.split(':',2).last\n dirs = docker_info_stdout.grep(/Dirs/).to_s.split(':',2).last\n return \"Containers:#{containers.to_i} Images:#{images.to_i} Driver:#{driver.to_s.delete!(\"\\n\",\" \")} Root Dir:#{root_dir.to_s.delete!(\"\\n\")} Dirs:#{dirs.to_s.delete!(\"\\n\")}\"\nend\nend", "def describe_container_instances(params={})\n if instances = params.delete('containerInstances')\n params.merge!(Fog::AWS.indexed_param('containerInstances.member', [*instances]))\n end\n\n request({\n 'Action' => 'DescribeContainerInstances',\n :parser => Fog::Parsers::AWS::ECS::DescribeContainerInstances.new\n }.merge(params))\n end", "def query_container\n containers = get_containers\n STDERR.puts \"Please select container [#{containers.join(', ')}]\"\n choice = STDIN.gets.strip\n exit if choice.empty?\n if !containers.include?(choice)\n abort \"Illegal choice.\"\n end\n choice\n end", "def current_user_group_ids\n container.current_user_group_ids\n end", "def spawn_instances(challenges)\n challenges.map do |name, challenge|\n if challenge[\"launch_docker_per_user\"]\n instance_id, port = instance_for(challenge)\n [name, instance_id, port]\n else\n nil\n end\n end\n end", "def get_docker_port_mapping_state(docker)\n\t\tres = {}\n\t\tcont = docker.containers\n\t\tcont.list.each do |c|\n\n\t\t\te = cont.show(c[\"Id\"]) || {}\n\t\t\tkey = c[\"Id\"][0..11]\n\t\t\tnetwork_settings = e[\"NetworkSettings\"] || {}\n\t\t\tres.store(key, network_settings)\n\t\tend\n\t\tres\t\n\tend", "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", "def explotacion_local()\n puts \"[!] Starting a vulnerable local Portainer instance:\"\n `docker run -d -p \"#{$port}\":9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data_poc:/data portainer/portainer --no-auth`\n instances=`docker ps | grep portainer | awk '{print $1\" | \"$2\" | \"$3\" \"$4\" | \"$13}'`\n puts instances\n puts \"\\nYou should browse your local instance on port 9000, and click the 'Endpoints' menu under Settings.\"\n puts \"Configure the main endpoint as 'Local'.\"\n puts \"Configure yout Endpoint URL to your_network_address:2375\"\n puts \"Example using your current address: #{$myaddress}:2375\"\n puts \"To safely kill this vulnerable instance, invoke exorcist.rb. Avoid killing it manually.\"\n exit 0\nend", "def get_docker_image_id_from_name(options)\n image_id = \"none\"\n images = get_docker_image_list(options)\n images.each do |image|\n values = image.split(/\\s+/)\n image_name = values[0]\n image_id = values[2]\n if image_name.match(/#{options['name']}/)\n return image_id\n end\n end\n return image_id\nend", "def container_id=(value)\n @container_id = value\n end", "def jenkins_bash(opts)\n\tid = jenkins_id(opts)\n\tputs \"### Accessing bash ###\"\n\tif id and id.length > 0\n\t\trun_in_shell \"docker exec -it #{id} bash\"\n\telse\n\t\tputs \"container not found\"\n\tend\nend", "def docker_manifests(id)\n criteria = {:type_ids => [Runcible::Extensions::DockerManifest.content_type]}\n unit_search(id, criteria).map { |i| i['metadata'].with_indifferent_access }\n end", "def containers\n return @containers\n end", "def run_on(name, opts = {})\n @instances.select do |i|\n puts name, i\n filter(name, i)\n end.each do |i|\n build_cmd = yield\n puts \"\\n\\n>> Run on #{i.container_name}. Build cmd: #{build_cmd}\\n==================\\n\\n\"\n cmd = \"docker exec #{i.container_name} /bin/bash -c \\\"#{build_cmd}\\\"\"\n if opts[:silent]\n Open3.capture2(cmd, :stdin_data => \"\")\n else\n o, s = Open3.capture2(cmd, :stdin_data => \"\")\n puts \"\\n================\\nRun on #{i.name}:\\n#{build_cmd}\\n#{o}\\n================\\nOutput\\n\"\n end\n end\n end", "def read_containers\n []\n end", "def docker_port(internal_port, container_name = name)\n docker_runner = Fleetctl::Runner::SSH.new('docker', 'port', container_name, internal_port)\n docker_runner.run(host: ip)\n output = docker_runner.output\n if output\n output.rstrip!\n output.split(':').last\n end\n end", "def prepare_container\n exposed_ports = {}\n port_bindings = {}\n links = []\n\n # Build expose and port binding parameters\n if !@attributes[:ports].nil?\n @attributes[:ports].each do |port|\n exposed_ports[\"#{port.container_port}/tcp\"] = {}\n port_bindings[\"#{port.container_port}/tcp\"] = [{\n \"HostIp\" => port.host_ip || '',\n \"HostPort\" => port.host_port || ''\n }]\n end\n end\n\n # Build link parameters\n @dependencies.each do |dependency|\n links << \"#{dependency.stats['Id']}:#{dependency.attributes[:label]}\"\n end\n\n container_config = {\n Image: @attributes[:image],\n Cmd: @attributes[:command],\n Env: @attributes[:environment],\n Volumes: @attributes[:volumes],\n ExposedPorts: exposed_ports,\n HostConfig: {\n Links: links,\n PortBindings: port_bindings\n }\n }\n\n @container = Docker::Container.create(container_config)\n end", "def list_collections manifest\n list = []\n\n manifest.collections.each do |pid|\n pidparts = pid.split(':')\n pid = pidparts[0].downcase + ':' + pidparts[1]\n list.push pid\n end\n\n return list\n end", "def create_and_run_container args\n \t# update the timeout for the Excon Http Client\n \t# set the chunk size to enable streaming of log files\n ::Docker.options = {:chunk_size => 1, :read_timeout => 3600}\n container = ::Docker::Container.create(\n \t\t'Image' => args[:image],\n \t\t'Cmd' => args[:command],\n \t\t\"Binds\" => args[:volumes],\n \t\t\"Env\" => args[:environment],\n \t\t'WorkingDir' => args[:working_directory],\n 'NetworkMode' => @network,\n 'name' => args[:name],\n 'PublishAllPorts' => true\n )\n\n output = ''\n\n unless args[:deamon] == true\n thread = Thread.new do\n container.attach(:stream => true, :stdin => nil, :stdout => true, :stderr => true, :logs => false, :tty => false) do\n |stream, chunk|\n if chunk.index('[ERROR]') != nil # deal with hidden characters\n @logger.error chunk.gsub(/\\[.*\\]/,'')\n else\n output += chunk.gsub(/\\[.*\\]/,'') if output == ''\n output += chunk.gsub(/\\[.*\\]/,'').prepend(\" \") unless output == ''\n @logger.debug chunk.gsub(/\\[.*\\]/,'')\n end\n end\n end\n end\n\n \n\n container.start\n \n thread.join unless args[:deamon] == true\n\n success = (container.json['State']['ExitCode'] == 0) ? true: false \n \n @logger.error(output) unless success \n\n \treturn container, success\n end", "def load_container_test_data()\n # todo: cache this , maybe Thread.current for now...\n @id = nil\n test_container_id = ENV['TEST_CONTAINER_ID']\n test_instance_id = ENV['TEST_INSTANCE_ID']\n if test_container_id\n # use our test container\n @container = client.containers.get(test_container_id)['container']\n # rescue ::RestClient::Exception => e on 404\n assert_not_nil @container, \"Container #{test_container_id} was not found\"\n @id = @container['id']\n elsif test_instance_id\n # use the first container in our test instance\n @instance = client.instances.get(test_instance_id.to_i)['instance']\n # rescue ::RestClient::Exception => e on 404\n assert_not_nil @instance, \"Test instance #{test_instance_id} was not found!\"\n assert_not_nil @instance['containers'].first, \"Instance #{@instance['id']} does not have any containers\\nTry setting environment variable TEST_CONTAINER_ID=42\"\n @container = client.containers.get(@instance['containers'].first)['container']\n assert_not_nil @container, \"Container #{@instance['containers'].first} was not found\"\n @id = @container['id']\n end\n assert_not_nil @id, \"A test container must be specified to run this test.\\nTry setting environment variable TEST_CONTAINER_ID=42 or TEST_INSTANCE_ID=99\"\n end", "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", "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", "def start\n system 'docker-compose up -d'\n end", "def container\n @container ||= Docker::Container.get(@name)\n rescue Docker::Error::NotFoundError\n @container = nil\n end", "def docker_cmd(cmd, container)\n \"docker run -it --rm --name #{cmd} -v #{Dir.pwd}/src:/root -w /root #{container} #{cmd}\"\nend", "def setup_docker_env_vars_str\n \"eval \\\"$(docker-machine env #{project_config['docker-machine']['name']})\\\" && \"\nend", "def docker_sql\n containername = \"mysql_#{@projectname}\"\n exec \"docker exec -t -i #{containername} /usr/bin/mysql -u root -p8to9or1\"\n end", "def get_existing_docker_image()\n @image = Docker::Image.get(ENV['IMAGE_ID'])\n set :docker_image, @image.id\n\n docker_image = @image.id\n puts \"Using supplied image id: #{docker_image}\"\nend", "def get_containers_by_given_name(given_name)\n @containers.select { |label, container|\n container.attributes[:name].match(/#{ComposeUtils.dir_name}_#{given_name}_\\d+/)\n }.values\n end", "def service_ids\n services.collect { |s| s[\"id\"] }\n end", "def get_containers\n assert_not_nil @rdigg.info.get_containers\n end", "def ensure_docker_api(cmd_name, args)\n if Workbench.in_docker?\n return\n end\n Process.wait spawn(*(%W{docker-compose exec api ./project.rb #{cmd_name}} + args))\n unless $?.exited? and $?.success?\n Common.new.error \"command against docker-compose service 'api' failed, \" +\n \"please verify your local API server is running (dev-up \" +\n \"or run-api)\"\n end\n if $?.exited?\n exit $?.exitstatus\n end\n exit 1\nend", "def get_containers\n init_folder unless @init # have I been initialized?\n return @containers \n end", "def find_docker_files\n current_path = Dir.pwd\n matched_root = \"\"\n matched_services = []\n matched_docker_sync_pwd = \"\"\n matched_docker_compose_pwd = \"\"\n (config[\"workspaces\"] || {}).each_pair do |_workspace_name, value|\n root = value[\"root\"]\n next unless current_path.start_with?(root) && root.length >= matched_root.length\n matched_root = root\n matched_services = value[\"services\"]\n matched_docker_sync_pwd = value[\"docker-sync\"]\n matched_docker_compose_pwd = value[\"docker-compose\"]\n end\n if matched_docker_sync_pwd.empty? || matched_docker_compose_pwd.empty?\n raise \"Cannot find the workspace for #{current_path}\"\n end\n @root = matched_root\n @service = \"\"\n matched_service = \"\"\n matched_services.each_pair do |service_name, service_path|\n path = File.expand_path(File.join(@root, service_path))\n if current_path.start_with?(path) && path.length >= matched_service.length\n matched_service = path\n @service = service_name\n end\n end\n @docker_sync_file = matched_docker_sync_pwd.gsub(matched_root, \".\")\n @docker_compose_file = matched_docker_compose_pwd.gsub(matched_root, \".\")\n end", "def existing_docker_compose_path\n existing_docker_compose_path = Mixlib::ShellOut.new(\"which docker-compose\")\n\n existing_docker_compose_path.run_command\n\n existing_path = ''\n\n existing_path = existing_docker_compose_path.stdout.strip unless existing_docker_compose_path.stdout.empty?\n\n existing_path\nend", "def access_container_id\n return @access_container_id\n end", "def compose_execute(*cmd, **opts, &block)\n synchronized do\n execute(\"docker-compose\", \"-f\", composition_path.to_s,\n \"-p\", machine.env.cwd.basename.to_s, *cmd, **opts, &block)\n end\n end", "def init_containers\n return @init_containers\n end", "def get_primary_container_config\n task_arn = @describe_service.services[0].task_definition\n return self.get_container_config_by_task_arn(task_arn)\n end", "def id( )\n return @instances.map{ |i| i[:aws_instance_id] }\n end", "def configs\n @configuration.ids\n end", "def create_container_call\n # When CPU is under load we cannot create a healthy container\n CpuLoadHandler.wait_cpu_to_idle\n\n additional_env = ''\n environment_variables.each do |variable|\n additional_env += \" -e #{variable}\"\n end\n emulator_args = is_running_on_emulator ? \"-p #{no_vnc_port}:6080 -e DEVICE='#{device_name}'\" : ''\n emulator_args = \"#{emulator_args}#{additional_env}\"\n @docker_commander.start_container(emulator_args: emulator_args, docker_image: docker_image,\n core_amount: core_amount)\n end", "def container_id\n super.to_i rescue nil\n end" ]
[ "0.6735033", "0.66175115", "0.6551078", "0.63883233", "0.6343595", "0.6313978", "0.6284457", "0.6213802", "0.6208493", "0.6194415", "0.60851234", "0.6028195", "0.6002083", "0.5957767", "0.59456444", "0.59258276", "0.58273274", "0.58273274", "0.5811719", "0.57776004", "0.5776628", "0.5739118", "0.5710254", "0.5683023", "0.5680365", "0.5664642", "0.56595206", "0.56294966", "0.5622016", "0.56065816", "0.5600237", "0.5593205", "0.5575598", "0.5545689", "0.5545689", "0.54955953", "0.5490989", "0.5485389", "0.5474266", "0.54685694", "0.5462047", "0.5418939", "0.5405681", "0.53985876", "0.53909904", "0.53865594", "0.5382713", "0.53622216", "0.5358382", "0.5352973", "0.5337469", "0.53342164", "0.5328515", "0.5315608", "0.5260643", "0.52488786", "0.52404076", "0.5219807", "0.52045155", "0.5199581", "0.51800805", "0.5164161", "0.513556", "0.51212066", "0.5096656", "0.5077884", "0.506897", "0.50576854", "0.50538576", "0.5050352", "0.5026246", "0.50100636", "0.4999089", "0.4984908", "0.49770418", "0.49743173", "0.49738196", "0.4969305", "0.49678683", "0.49624673", "0.49619424", "0.4959691", "0.4956522", "0.49525943", "0.49523184", "0.49448475", "0.4944241", "0.49396998", "0.4935148", "0.49238363", "0.49236363", "0.49082518", "0.4904541", "0.4891268", "0.48867688", "0.48855266", "0.48832417", "0.48816404", "0.48763278", "0.48720258" ]
0.79320097
0
gets information about the containers from the Docker API
def containers @containers ||= Docker::Container.all( all: true, # include stopped containers filters: { id: container_ids }.to_json ).map(&:json) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info\n container.info\n end", "def containers\n TestLab::Container.all\n end", "def running_containers\n containers = ::Docker::Container.all(all: true, filters: { status: [\"running\"] }.to_json)\n return containers\n end", "def get_containers\n content = YAML::load(File.read(docker_compose_file))\n content.has_key?('version') ? content['services'].keys : content.keys\n end", "def containers_for_image(img = docker_image)\n `docker ps -aq -f ancestor=#{img}`.split(\"\\n\")\n end", "def docker_info()\n# changed cmd to use full path for security\n# cmd = 'docker info'\n cmd = which('docker') + \" info\"\n\tOpen3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|\n docker_info_stdout=stdout.read\n containers = docker_info_stdout.grep(/Containers/).to_s.split(':',2).last\n images = docker_info_stdout.grep(/Images/).to_s.split(':',2).last\n driver = docker_info_stdout.grep(/Driver/).to_s.split(':',2).last\n root_dir = docker_info_stdout.grep(/Root Dir/).to_s.split(':',2).last\n dirs = docker_info_stdout.grep(/Dirs/).to_s.split(':',2).last\n return \"Containers:#{containers.to_i} Images:#{images.to_i} Driver:#{driver.to_s.delete!(\"\\n\",\" \")} Root Dir:#{root_dir.to_s.delete!(\"\\n\")} Dirs:#{dirs.to_s.delete!(\"\\n\")}\"\nend\nend", "def containers\n containers_exited(days_old: 1)\n containers_running(days_old: 1)\n end", "def get_containers\n assert_not_nil @rdigg.info.get_containers\n end", "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", "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", "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", "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", "def describe_container_instances(params={})\n if instances = params.delete('containerInstances')\n params.merge!(Fog::AWS.indexed_param('containerInstances.member', [*instances]))\n end\n\n request({\n 'Action' => 'DescribeContainerInstances',\n :parser => Fog::Parsers::AWS::ECS::DescribeContainerInstances.new\n }.merge(params))\n end", "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", "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", "def containers\n return @containers\n end", "def container\n @container ||= Docker::Container.get(@name)\n rescue Docker::Error::NotFoundError\n @container = nil\n end", "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", "def get_docker_instance_list(options)\n message = \"Information:\\tListing docker images\"\n command = \"docker ps\"\n output = execute_command(options,message,command)\n instances = output.split(/\\n/)\n return instances\nend", "def 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", "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", "def jenkins_info(opts)\n\tid = jenkins_id(opts)\n\trunning = jenkins_running? opts\n\tstatus = running ? \"Running\" : \"Unknown\"\n\n\tputs \"### Container Info ###\"\n\tif id and id.length > 0\n\t\tputs \"ID: #{id}\"\n\t\tputs \"Name: #{opts[:name]}\"\n\t\tputs \"Status: #{status}\"\n\t\tputs \"Port: #{opts[:port]} (Web), #{opts[:sport]}\"\n\t\tputs \"Source: #{opts[:source]}\"\n\t\tputs \"Password: #{jenkins_password(opts)}\" if running and opts[:password]\n\telse\n\t\tputs \"container not found\"\n\tend\n\tputs \"######################\"\nend", "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", "def get_nvidia_docker_info(url)\n resp = Net::HTTP.get_response(URI.parse(url))\n buffer = resp.body\n json_result = JSON.parse(buffer)\n return json_result\nend", "def container_instances\n instances = []\n @client.describe_tasks(cluster: @cluster, tasks: tasks)[0].each do |e|\n instances << e[:container_instance_arn]\n end\n instances\n end", "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", "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", "def containers_ids\n containers(:response_format => :id_array)\n end", "def get_running_containers\n\n containers = []\n running_tasks = get_list_tasks_result\n running_tasks.task_arns.each do |task_arn|\n containers << RaisEcs::Container.new({\n cloud: @cloud,\n cluster: @cluster,\n service: self,\n task_arn: task_arn\n })\n end\n\n return containers\n\n end", "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", "def index\n @containers = Container.all\n end", "def read_containers\n []\n end", "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", "def container_names\n (@pod.dig(:spec, :containers) + self.class.init_containers(@pod)).map { |c| c.fetch(:name) }.uniq\n end", "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", "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", "def get_containers\n init_folder unless @init # have I been initialized?\n return @containers \n end", "def docker_version() ; info[:docker_version] ; end", "def index_containers(opts = {})\n data, _status_code, _headers = index_containers_with_http_info(opts)\n data\n end", "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", "def container_ids\n @container_ids ||= DockerCompose.new(project).container_ids\n end", "def docker_getport(containername)\n %x{docker ps --filter name=#{containername} --format \"{{.Ports}}\" | sed \"s;->.*$;;\" | sed \"s;^.*:;;\" | head -n 1 | tr -d \"\\n\"}\n end", "def running_container_count\n `#{setup_docker_env_vars_str} docker ps`.split(\"\\n\").size - 1\nend", "def container_id\n @container_info[\"Id\"]\n end", "def index\n @docker_cfgs = DockerCfg.all\n end", "def docker_inspect(image, format)\n res = Cheetah.run(\"docker\", \"inspect\", \"--format='{{#{format}}}'\", image, stdout: :capture)\n return nil if res == \"<nil>\\n\"\n res.strip\n end", "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", "def inspect\n tags = Array.new\n tags << \"name=#{self.name.inspect}\"\n tags = tags.join(' ')\n\n \"#<LXC::Container #{tags}>\"\n end", "def top_containers\n container_information.select do |container|\n container[\"label\"].to_s.downcase.include?(\"box\") || container[\"profile\"].include?(\"OS folder\")\n end\n end", "def get_container(container_name)\n assert_not_nil @rdigg.info.get_container(\"technology\")\n end", "def current_container_id\n cgroup_content = File.read(\"/proc/1/cgroup\")\n @running_in_container = cgroup_content.include? \"docker/\"\n if @running_in_container\n cgroup_content.split.each { |line|\n if line.include? \"docker/\" or line.include? \"kubepods/\"\n parts = line.split(\":\")\n res_parts = parts[2].split(\"/\")\n return res_parts[-1][0..12]\n end\n }\n end\n nil\nend", "def get_docker_port_mapping_state(docker)\n\t\tres = {}\n\t\tcont = docker.containers\n\t\tcont.list.each do |c|\n\n\t\t\te = cont.show(c[\"Id\"]) || {}\n\t\t\tkey = c[\"Id\"][0..11]\n\t\t\tnetwork_settings = e[\"NetworkSettings\"] || {}\n\t\t\tres.store(key, network_settings)\n\t\tend\n\t\tres\t\n\tend", "def get_docker_image_list(options)\n message = \"Information:\\tListing docker images\"\n command = \"docker image list\"\n output = execute_command(options,message,command)\n images = output.split(/\\n/)\n return images\nend", "def containers=(value)\n @containers = value\n end", "def get_requests_by_container(id, opts = {})\n data, _status_code, _headers = get_requests_by_container_with_http_info(id, opts)\n return data\n end", "def get_nodes\n nodes = []\n\n self.get_running_containers.each do |container|\n nodes << container.get_node\n end\n\n return nodes\n\n end", "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", "def ssh_info\n # If the Container is not created then we cannot possibly SSH into it, so\n # we return nil.\n return nil if state == :not_created\n\n network = @driver.inspect_container(@machine.id)['NetworkSettings']\n ip = network['IPAddress']\n\n # If we were not able to identify the container's IP, we return nil\n # here and we let Vagrant core deal with it ;)\n return nil unless ip\n\n {\n :host => ip,\n :port => @machine.config.ssh.guest_port\n }\n end", "def poll(container)\n info = Hash.new 0\n \n # state\n states = {'exist' => 'a', 'deleted' => 'd', 'suspended' => 'p'}\n states.default = '-'\n status = container.status\n # state can be either active or deleted\n info[:state] = states[status[0]]\n # however if there is additional status field then it may be also suspended (see vzctl status comamnd)\n info[:state] = states[status[3]] if status.size == 4\n\n # if ct is down there is nothing we can do here\n return info if info[:state] != 'a'\n\n # ONE requires usedcpu to be equal to cpu utilization on all processors\n # ex. usedcpu=200 when there are 2 fully loaded cpus\n # currently i get only average pcpu and multiply it by number of cpus\n out = (container.command \"cat /proc/cpuinfo\").split\n cpu_amount = out.find_all {|line| /processor/ =~ line}.size\n\n out = (container.command \"ps axo pcpu=\").split\n info[:usedcpu] = cpu_amount * out.inject(0.0) {|sum, current|sum + current.to_f}\n \n # net transmit & receive\n out = container.command \"cat /proc/net/dev\"\n # i'am wondering how long this shit will work\n out.each_line do |line|\n net = /\\s*(?<interface>\\w+)\\s*:\\s*(?<receive>\\d+)(\\s+\\d+){7}\\s+(?<transmit>\\d+)/.match(line)\n # omit loopback interface\n next if !net || net[:interface] == \"lo\" \n info[:netrx] += net[:receive].to_i\n info[:nettx] += net[:transmit].to_i\n end\n \n # computer container memory usage\n out = container.command \"free -k\"\n info[:usedmemory] = /Mem:\\s+\\d+\\s+(?<used>\\d+)/.match(out)[:used].to_i\n \n info\n rescue RuntimeError => e\n raise OpenVzDriverError, \"Can't get container #{container.ctid} status. Details: #{e.message}\"\n end", "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", "def containers_from_solr\n containers(:response_format => :load_from_solr)\n end", "def index\n @docker_instances = DockerInstance.all\n @docker_instance = DockerInstance.new\n end", "def ephemeral_containers\n return @ephemeral_containers\n end", "def docker_images(id)\n criteria = {:type_ids => [Runcible::Extensions::DockerImage.content_type]}\n unit_search(id, criteria).map { |i| i['metadata'].with_indifferent_access }\n end", "def list_ip(containers) # rubocop:disable Metrics/AbcSize\n @options[:container] = containers\n container\n instance_data = list.body\n instance_data = JSON.parse(instance_data)\n vcableid = instance_data['vcable_id']\n abort('Error network configuration is not present') if vcableid.nil?\n internalip = instance_data['ip']\n iputil = IPUtil.new(id_domain, user, passwd, restendpoint)\n basecontainer = containers.split('/')\n usercontainer = '/' + basecontainer[1] + '/' + basecontainer[2] + '/' \n vcabledetails = JSON.parse(iputil.discover(usercontainer, 'vcable', vcableid, 'association').body)\n vcabledetails = vcabledetails['result']\n vcabledetails = vcabledetails.at(0)\n extipaddress = vcabledetails['ip']\n return internalip, extipaddress\n end", "def container\n return @container if defined? @container\n if @options[:reattach]\n all_containers = Docker::Container.all(all: true)\n all_containers.each do |container|\n if container.info['Image'] == @tag\n @container = Docker::Container.get(container.info['id'])\n end\n end\n begin\n @container = Docker::Container.create('Image' => @tag)\n rescue Docker::Error::NotFoundError\n puts \"Could not find an image with @tag #{@tag}\"\n return nil\n end\n elsif !ARGV.empty?\n @container = Docker::Container.create('Image' => @tag,\n 'Cmd' => ARGV,\n 'Env' => ['DISPLAY=:0'])\n elsif @options[:wayland]\n @container = Docker::Container.create('Image' => @tag,\n 'Env' => ['DISPLAY=:0'],\n 'Cmd' => ['startplasmacompositor'])\n else\n @container = Docker::Container.create('Image' => @tag,\n 'Env' => [\"DISPLAY=:#{xdisplay}\"])\n end\n @container\n end", "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", "def info\n IbmCloudRest.get \"#{@uri}/\"\n end", "def docker_id(name)\n\t\treturn command_send(\"sudo docker ps -a --no-trunc -f name=#{name} | grep '\\\\s#{name}$' | tail -n 1 | awk '{ print $1 }'\")\n\tend", "def cpu_usage\n containers = []\n @hosts.each do |host|\n Docker.url = \"tcp://#{host}:#{@docker_port}/\"\n containers.concat Docker::Container.all(all: true, filters: { ancestor: [@ws_image],status:['running'] }.to_json)\n end\n \n cpuPercent = 0.0\n status = containers.first.stats\n \n cpuDelta = status['cpu_stats']['cpu_usage']['total_usage'] - status['precpu_stats']['cpu_usage']['total_usage']\n systemDelta = status['cpu_stats']['system_cpu_usage'] - status['precpu_stats']['system_cpu_usage']\n\n if systemDelta > 0.0 and cpuDelta > 0.0 \n cpuPercent = (cpuDelta.round(16) / systemDelta.round(16)).round(16) * status['cpu_stats']['cpu_usage']['percpu_usage'].size * 100.0\n end\n return cpuPercent.round(2)\n end", "def get_containers_by(params)\n @containers.values.select do |container|\n (params.to_a - container.attributes.to_a).empty?\n end\n end", "def container\n @container ||= Container.new(spec[:containers].first)\n end", "def get_ip_of_container(container_id)\n `docker inspect --format '{{ .NetworkSettings.IPAddress }}' #{container_id}`.chomp\n end", "def servers_detailed()\n return get_request(address(\"/servers/detail\"), @token)\n end", "def container\n namespace + '_container'\n end", "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", "def state\n if !defined?(@container) || @container.nil?\n :missing\n else\n begin\n _exit_status, stdout, _stderr = @cmd_runner.run_cmd \"#{podman_cmd} container inspect #{@container}\"\n status = JSON.parse(stdout).first['State']['Status'].to_sym\n status = :created if status == :configured\n status\n rescue\n log_warn \"Error while reading state of Podman container #{@container}: #{$ERROR_INFO}\"\n :error\n end\n end\n end", "def docker_compose_container\n get_config(:docker_compose_container).to_s\n end", "def load_container_test_data()\n # todo: cache this , maybe Thread.current for now...\n @id = nil\n test_container_id = ENV['TEST_CONTAINER_ID']\n test_instance_id = ENV['TEST_INSTANCE_ID']\n if test_container_id\n # use our test container\n @container = client.containers.get(test_container_id)['container']\n # rescue ::RestClient::Exception => e on 404\n assert_not_nil @container, \"Container #{test_container_id} was not found\"\n @id = @container['id']\n elsif test_instance_id\n # use the first container in our test instance\n @instance = client.instances.get(test_instance_id.to_i)['instance']\n # rescue ::RestClient::Exception => e on 404\n assert_not_nil @instance, \"Test instance #{test_instance_id} was not found!\"\n assert_not_nil @instance['containers'].first, \"Instance #{@instance['id']} does not have any containers\\nTry setting environment variable TEST_CONTAINER_ID=42\"\n @container = client.containers.get(@instance['containers'].first)['container']\n assert_not_nil @container, \"Container #{@instance['containers'].first} was not found\"\n @id = @container['id']\n end\n assert_not_nil @id, \"A test container must be specified to run this test.\\nTry setting environment variable TEST_CONTAINER_ID=42 or TEST_INSTANCE_ID=99\"\n end", "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", "def determine_docker_host_for_container_ports\n\n begin\n docker_host = Resolv.getaddress('docker')\n puts \"Host alias for 'docker' found. Assuming container ports are exposed on ip '#{docker_host}'\"\n rescue\n docker_host = Resolv.getaddress(Socket.gethostname)\n puts \"No host alias for 'docker' found. Assuming container ports are exposed on '#{docker_host}'\"\n end\n\n docker_host\n\nend", "def init_containers\n return @init_containers\n end", "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", "def show_container(container_id, opts = {})\n data, _status_code, _headers = show_container_with_http_info(container_id, opts)\n data\n end", "def get_container_id(name)\n compose_execute(\"ps\", \"-q\", name).chomp\n end", "def get_requests_by_container_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AsynchronousJobsBPMApi.get_requests_by_container ...\"\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 AsynchronousJobsBPMApi.get_requests_by_container\"\n end\n if @api_client.config.client_side_validation && opts[:'status'] && !opts[:'status'].all?{|item| ['QUEUED', 'DONE', 'CANCELLED', 'ERROR', 'RETRYING', 'RUNNING'].include?(item)}\n fail ArgumentError, 'invalid value for \"status\", must include one of QUEUED, DONE, CANCELLED, ERROR, RETRYING, RUNNING'\n end\n # resource path\n local_var_path = \"/server/jobs/containers/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'status'] = @api_client.build_collection_param(opts[:'status'], :multi) if !opts[:'status'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RequestInfoInstanceList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AsynchronousJobsBPMApi#get_requests_by_container\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def container_params\n params.require(:container).permit(:name, :image, :command, :exposed_port, :host_port, :server_id)\n end", "def info\n response = from_server \"api/info.json\"\n response.data\n end", "def containerize(\n project_name: '',\n project_id: 0,\n app: {}\n )\n\n puts \"#{__method__.to_s} enter\"\n\n # Where to push the docker image\n #docker_remote_registry_uri = \"\"\n #docker_remote_registry_uri = \"localhost:5000\" if server.compute_engine == 'minikube'\n #docker_remote_registry_uri = \"gcr.io/#{project_name}-#{project_id}\" if server.compute_engine == 'gce'\n\n\n app_name = \"#{project_name}-#{project_id}\"\n image_name = \"#{project_name}-#{project_id}\"\n\n\n docker_context_directory = docker_ready_context_directory(\n app_name: app_name,\n app_source_directory: app.source_url\n )\n\n passenger_prep(container_context_directory: docker_context_directory, app_types: app.type)\n\n dockerfile_contents = docker_ready_dockerfile(app_directory: app_name, app_types: app.type)\n\n make_file(\"#{docker_context_directory}/Dockerfile\", dockerfile_contents)\n\n\n\n docker_create_container_image(image_name: image_name, context_directory: docker_context_directory)\n\n container_info = { image_name: image_name }\n\n puts \"#{__method__.to_s} exit\"\n\n # Convert data structure (hashes and arrays) into a\n # dot notation accessable structure (ex. config.project.name)\n #\n return RecursiveOpenStruct.new(container_info, recurse_over_arrays: true )\n\nend", "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", "def get_remote_image_tags\n\n token = self.get_auth_token\n\n # https://docs.docker.com/registry/spec/api/#listing-image-tags\n tags_response = RestClient.get \"https://#{@registry_server}/v2/#{@repository_name}/tags/list\", { 'Authorization' => \"Bearer #{token}\" }\n tags_response_json = JSON.parse(tags_response)\n tags = tags_response_json['tags']\n\n return tags\n\n end", "def status(args)\n system(\"docker-compose ps\")\n end", "def status(args)\n system(\"docker-compose ps\")\n end", "def info\n get(\"/api-info\")\n end", "def docker_waiting_containers\n puts \"Waiting 40s for ensure that containers are up ...\"\n sleep 40\n end", "def container\n cache or raise RuntimeError, \"no container known.\"\n end", "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", "def summary\n res = description\n\n {\n in_service: res.instances.all?{ |e| e[:lifecycle_state] == 'InService' },\n healthy: res.instances.all?{ |e| e[:health_status] == 'Healthy' },\n size: res.instances.select { |e| e[:lifecycle_state] == 'InService' }.length\n }\n end", "def create_and_run_container args\n \t# update the timeout for the Excon Http Client\n \t# set the chunk size to enable streaming of log files\n ::Docker.options = {:chunk_size => 1, :read_timeout => 3600}\n container = ::Docker::Container.create(\n \t\t'Image' => args[:image],\n \t\t'Cmd' => args[:command],\n \t\t\"Binds\" => args[:volumes],\n \t\t\"Env\" => args[:environment],\n \t\t'WorkingDir' => args[:working_directory],\n 'NetworkMode' => @network,\n 'name' => args[:name],\n 'PublishAllPorts' => true\n )\n\n output = ''\n\n unless args[:deamon] == true\n thread = Thread.new do\n container.attach(:stream => true, :stdin => nil, :stdout => true, :stderr => true, :logs => false, :tty => false) do\n |stream, chunk|\n if chunk.index('[ERROR]') != nil # deal with hidden characters\n @logger.error chunk.gsub(/\\[.*\\]/,'')\n else\n output += chunk.gsub(/\\[.*\\]/,'') if output == ''\n output += chunk.gsub(/\\[.*\\]/,'').prepend(\" \") unless output == ''\n @logger.debug chunk.gsub(/\\[.*\\]/,'')\n end\n end\n end\n end\n\n \n\n container.start\n \n thread.join unless args[:deamon] == true\n\n success = (container.json['State']['ExitCode'] == 0) ? true: false \n \n @logger.error(output) unless success \n\n \treturn container, success\n end", "def index\n @serverhascontainers = Serverhascontainer.all\n end" ]
[ "0.7212993", "0.6938", "0.6898589", "0.67649084", "0.67344123", "0.6707264", "0.6643655", "0.6469227", "0.6409113", "0.63955414", "0.63950866", "0.6351381", "0.6338871", "0.6327768", "0.6321929", "0.63143736", "0.63027257", "0.62481797", "0.622766", "0.6213659", "0.6140169", "0.6120154", "0.6084258", "0.6066457", "0.60653144", "0.60556567", "0.60504025", "0.6050095", "0.60453147", "0.6007312", "0.6004349", "0.59978545", "0.5906583", "0.5858443", "0.58343405", "0.5825578", "0.5799124", "0.57562107", "0.5746999", "0.5700632", "0.5694573", "0.5690112", "0.5670282", "0.5656759", "0.56507266", "0.5635289", "0.5595795", "0.5583976", "0.5535316", "0.5532043", "0.55189025", "0.5511858", "0.55059683", "0.5498085", "0.5496641", "0.5493247", "0.548947", "0.54801613", "0.54719245", "0.54603213", "0.5458541", "0.5446568", "0.5443225", "0.543684", "0.5432371", "0.54302317", "0.5424818", "0.54214126", "0.541958", "0.54146314", "0.54025906", "0.5393812", "0.5376166", "0.5359582", "0.5350116", "0.53485745", "0.5347404", "0.5345263", "0.5341552", "0.531714", "0.5315884", "0.5311965", "0.53117037", "0.53106976", "0.5309837", "0.5305392", "0.5301809", "0.5297131", "0.52891517", "0.5285513", "0.5276315", "0.5258272", "0.5258272", "0.5257639", "0.52566284", "0.5253185", "0.52517253", "0.5250977", "0.5245648", "0.52349" ]
0.7293216
0
Returns that the remote host is always vulnerable
def check return Exploit::CheckCode::Vulnerable end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_host(ip)\n print_status(\"Checking #{peer} for DLSw exposure\")\n response = get_response\n\n if !response.blank? && (response =~ /IOS Software|cisco.com/)\n print_good(\"#{peer}: The target Cisco router appears vulnerable: parts of a Cisco IOS banner detected\")\n report_vuln(\n host: rhost,\n port: rport,\n name: name,\n refs: references,\n info: \"Module #{fullname} collected #{response.length} bytes\"\n )\n Exploit::CheckCode::Vulnerable\n else\n if response.blank?\n vprint_status(\"#{peer}: no response\")\n else\n vprint_status(\"#{peer}: #{response.size}-byte response didn't contain any leaked data\")\n end\n Exploit::CheckCode::Safe\n end\n end", "def host_allowed?(arg)\n true\n end", "def check\n\t\treturn Exploit::CheckCode::Vulnerable\n\tend", "def verify_host\n @j_del.isVerifyHost\n end", "def remote?\n !(url =~ /^https?/).nil?\n end", "def allowed_request\n !((request.remote_ip =~ /127\\.0\\.0\\.1/).nil? && (request.remote_ip =~ /128\\.128\\./).nil? && (request.remote_ip =~ /10\\.19\\./).nil?)\n end", "def check\r\n # Find a valid CGI target\r\n target_uri = find_target_cgi\r\n unless target_uri\r\n return Exploit::CheckCode::Unknown\r\n end\r\n return Exploit::CheckCode::Vulnerable\r\n end", "def ip_check\n logger.warn request.remote_addr.inspect\n if Rails.env == \"production\" && !request.remote_ip.include?(\"99.166.163.112\")\n render :text => \"GETTHEFUCKOUT\"\n end\n end", "def vulnerable?\n !@results.empty?\n end", "def attackable?\n true\n end", "def host_is_okay\n return false unless @report_data[:host]\n return false unless valid_ip(@report_data[:host])\n return false unless @report_data[:state] == Msf::HostState::Alive\n if @args[:blacklist]\n return false if @args[:blacklist].include?(@report_data[:host])\n end\n return true\n end", "def local?\r\nLOCALHOST =~ remote_addr && LOCALHOST =~ remote_ip\r\nend", "def allowHost\n end", "def has_required_host?\n true\n end", "def is_local_host\n require 'ipaddr'\n begin\n local = IPAddr.new(\"127.0.0.0/8\")\n private1 = IPAddr.new(\"10.0.0.0/8\")\n private2 = IPAddr.new(\"172.16.0.0/12\")\n private3 = IPAddr.new(\"192.168.0.0/16\")\n private4 = IPAddr.new(\"85.230.85.45\")\n private5 = IPAddr.new(\"94.234.170.18\")\n\n if local.include?(request.remote_ip)\n return true\n end\n if private1.include?(request.remote_ip)\n return true\n end\n if private2.include?(request.remote_ip)\n return true\n end\n if private3.include?(request.remote_ip)\n return true\n end\n if private4.include?(request.remote_ip)\n return true\n end\n if private5.include?(request.remote_ip)\n return true\n end\n return false\n rescue\n return false\n end\n end", "def verify_host_key_option\n current_net_ssh = Net::SSH::Version::CURRENT\n new_option_version = Net::SSH::Version[4, 2, 0]\n\n current_net_ssh >= new_option_version ? :verify_host_key : :paranoid\n end", "def check_ip; end", "def using_remoter?\n !@remote_base.nil?\n end", "def vulnerable?\n case vulnerable\n when \"BOTH\" then true\n when \"NONE\" then false\n else\n vulnerable.split(\"\").include?(declarer)\n end\n end", "def remote?\n true\n end", "def trusted?\n @trusted ||= IPs.list.any? { |range| range.include? cloudflare_ip }\n end", "def remote?\n false\n end", "def host?\n self.host\n end", "def display_result(response, host)\n if response.to_s.include? \"\\\"code\\\":0\"\n puts \"[+] #{host}: Vulnerable\"\n else\n puts \"[-] #{host}: Not Vulnerable\"\n end\nend", "def host_only\n return @host_only\n end", "def dev_host\n case Socket.gethostname\n when /romeo-foxtrot/i ; true\n else ; false\n end\nend", "def verify_host_key_option\n current_net_ssh = Net::SSH::Version::CURRENT\n new_option_version = Net::SSH::Version[4, 2, 0]\n\n current_net_ssh >= new_option_version ? :verify_host_key : :paranoid\n end", "def exploit_type\n Exploit::Type::Remote\n end", "def check\r\n\t\tconnect\r\n\t\tdisconnect\r\n\r\n\t\tcase banner\r\n\t\t\twhen /Serv-U FTP Server v4\\.1/\r\n\t\t\t\tprint_status('Found version 4.1.0.3, exploitable')\r\n\t\t\t\treturn Exploit::CheckCode::Vulnerable\r\n\r\n\t\t\twhen /Serv-U FTP Server v5\\.0/\r\n\t\t\t\tprint_status('Found version 5.0.0.0 (exploitable) or 5.0.0.4 (not), try it!');\r\n\t\t\t\treturn Exploit::CheckCode::Appears\r\n\r\n\t\t\twhen /Serv-U FTP Server v4\\.0/\r\n\t\t\t\tprint_status('Found version 4.0.0.4 or 4.1.0.0, additional check.');\r\n\t\t\t\tsend_user(datastore['USER'])\r\n\t\t\t\tsend_pass(datastore['PASS'])\r\n\t\t\t\tif (double_ff?())\r\n\t\t\t\t\tprint_status('Found version 4.0.0.4, exploitable');\r\n\t\t\t\t\treturn Exploit::CheckCode::Vulnerable\r\n\t\t\t\telse\r\n\t\t\t\t\tprint_status('Found version 4.1.0.0, exploitable');\r\n\t\t\t\t\treturn Exploit::CheckCode::Vulnerable\r\n\t\t\t\tend\r\n\r\n\t\t\twhen /Serv-U FTP Server/\r\n\t\t\t\tprint_status('Found an unknown version, try it!');\r\n\t\t\t\treturn Exploit::CheckCode::Detected\r\n\r\n\t\t\telse\r\n\t\t\t\tprint_status('We could not recognize the server banner')\r\n\t\t\t\treturn Exploit::CheckCode::Safe\r\n\t\tend\r\n\r\n\t\treturn Exploit::CheckCode::Safe\r\n\tend", "def remote_ip; end", "def yelp_blocked? ip\n\n curl_res = `ssh #{ip} 'curl http://www.yelp.com/biz/vip-oriental-santa-clara'` \n index = curl_res.index(\"VIP Oriental\")\n if index.nil?\n puts \"================================> #{ip}\"\n puts \"#{curl_res}\"\n return true\n end\n return false;\nend", "def attack?\n true\n end", "def check_host\n unless @game.host == current_user\n render( :status => :unauthorized,\n :text => \"Cannot %s a game you didn't create.\" % params[:action])\n return false\n end\n return true\n end", "def remotely_useful?\n plan&.remotely_useful? || super\n end", "def check\r\n\r\n # Connect to RHOST on PORT\r\n connect_login\r\n disconnect\r\n\r\n # Does Banner equal (===) to 220 PCMan's FTP Server 2.0?\r\n if /220 PCMan's FTP Server 2\\.0/ === banner\r\n Exploit::CheckCode::Appears\r\n else\r\n Exploit::CheckCode::Safe\r\n end\r\n end", "def remote_host\n @remote_host || ::REMOTE_HOST\n end", "def ssh?\n true\n end", "def check_cve_2013_0632\r\n if datastore['USERDS']\r\n # the vulnerability for CVE-2013-0632 is that if RDS is disabled during install but\r\n # subsequently *enabled* after install, the password is unset so we simply must\r\n # check that and only that.\r\n cf_cookies = adminapi_login 'foo', 'bar', true\r\n if cf_cookies.empty?\r\n print_status \"#{datastore['RHOST']} is not vulnerable to CVE-2013-0632\"\r\n else\r\n print_status \"#{datastore['RHOST']} is vulnerable to CVE-2013-0632\"\r\n return true\r\n end\r\n else\r\n print_error \"Cannot test #{datastore['RHOST']} CVE-2013-0632 with USERDS off\"\r\n end\r\n false\r\n end", "def insecure\n if query\n insecure_query = query.split('&').each.select do |q|\n q.start_with?('insecure=')\n end.first\n insecure_query == 'insecure=true'\n else\n false\n end\n end", "def checkPrivilegedHdr\n hdr = request.env['HTTP_PRIVILEGED'] or return false\n privKey = ENV['ESCHOL_PRIV_API_KEY'] or raise(\"missing env ESCHOL_PRIV_API_KEY\")\n hdr.strip == privKey or halt(403, \"Incorrect API key\")\n return true\n end", "def ip_restrict\n allow_ips = Settings.ip_addresses.monstarlab.to_h.values.flatten\n allow_ips << \"::1\" if Rails.env.development?\n remote_ip = request.remote_ip\n\n return render_404 unless allow_ips.include? remote_ip\n end", "def check_ip_integrity\n\t\tif @arry_ips.length == 0\n\t\t\t@arry_ips = Connections::SERVER_IP\n\t\telsif @arry_ips.length != Connections::SERVER_IP.length && @ip_integrity != \"m\"\n\t\t\t@arry_ips = Connections::SERVER_IP\n\t\tend\n\tend", "def remote?\n @remote\n end", "def check\r\n res = send_request_cgi({'uri'=>'/'})\r\n if res.nil?\r\n fail_with(Failure::Unreachable, 'Connection timed out.')\r\n end\r\n # Checks for the `WWW-Authenticate` header in the response\r\n if res.headers[\"WWW-Authenticate\"]\r\n data = res.to_s\r\n marker_one = \"Basic realm=\\\"NETGEAR \"\r\n marker_two = \"\\\"\"\r\n model = data[/#{marker_one}(.*?)#{marker_two}/m, 1]\r\n vprint_status(\"Router is a NETGEAR router (#{model})\")\r\n model_numbers = ['DGN2200v1', 'DGN2200v2', 'DGN2200v3', 'DGN2200v4']\r\n if model_numbers.include?(model)\r\n print_good(\"Router may be vulnerable (NETGEAR #{model})\")\r\n return CheckCode::Detected\r\n else\r\n return CheckCode::Safe\r\n end\r\n else\r\n print_error('Router is not a NETGEAR router')\r\n return CheckCode::Safe\r\n end\r\n end", "def remote?\n %w[http https].include? scheme\n end", "def local?(ip = remote_ip)\n # TODO: should check if requesting machine is the one the server is running\n return true if ip == '127.0.0.1'\n end", "def vip_required?\n !config.wordpress.vip.nil?\n end", "def block_unknown_hosts\n return if Rails.configuration.hosts.blank?\n raise UnsafeHostError, \"#{request.host} is not a safe host\" unless Rails.configuration.hosts.include?(request.host)\n end", "def secure?\n #debugger\n false\n end", "def consider_remote? # :nodoc:\n @domain == :both or @domain == :remote\n end", "def server_verified?\n !!@server_verified\n end", "def server?\n response = Net::HTTP.get_response(URI.parse('http://localhost:9533/'))\n raise unless response.class == Net::HTTPOK\nrescue\n skip 'Local server not detected'\nend", "def check_git_ssh_source(s)\n if git = s[:git]\n if git =~ %r{\\w+\\@(\\w|\\.)+\\:(/\\w+)*}\n results.add_warning('source', 'Git SSH URLs will NOT work for ' \\\n 'people behind firewalls configured to only allow HTTP, ' \\\n 'therefore HTTPS is preferred.', true)\n end\n end\n end", "def inventario_vulnerables()\n inventario_portainer() # Invoke a General Inventory.\n $portainer_hosts.each do | ip | \n uri = URI.parse(\"http://#{ip}:#{$port}/api/status\") \n response = Net::HTTP.get_response(uri) \n json_response = JSON.parse(response.body) \n auth = json_response[\"Authentication\"] # If no Auth is needed to access.\n if auth.to_s.chomp() == \"false\" \n $hosts_vulnerables += 1 \n $vulnerable_hosts.push(ip) \n end\n end\nend", "def secure?\n true\n end", "def is_online?\n #Uses a SYN ping vs ICMP to avoid firewall issues.\n #Tries likely ports to determine if computer is up\n tls = Net::Ping::TCP.new(remote_repository, 443, 1)\n http = Net::Ping::TCP.new(remote_repository, 80, 1)\n ssh = Net::Ping::TCP.new(remote_repository, 22, 1)\n tls.ping or http.ping or ssh.ping\n end", "def secure?\n false\n end", "def local_request? #:doc:\n @request.remote_addr == \"127.0.0.1\"\n end", "def local_request? #:doc:\n @request.remote_addr == \"127.0.0.1\"\n end", "def check_banner(ip, version)\n version =~ /libssh[_-]?([\\d.]*)$/ && $1 && (v = Gem::Version.new($1))\n\n if v.nil?\n vprint_error(\"#{ip}:#{rport} - #{version} does not appear to be libssh\")\n Exploit::CheckCode::Unknown\n elsif v.to_s.empty?\n vprint_warning(\"#{ip}:#{rport} - libssh version not reported\")\n Exploit::CheckCode::Detected\n elsif v.between?(Gem::Version.new('0.6.0'), Gem::Version.new('0.7.5')) ||\n v.between?(Gem::Version.new('0.8.0'), Gem::Version.new('0.8.3'))\n vprint_good(\"#{ip}:#{rport} - #{version} appears to be unpatched\")\n Exploit::CheckCode::Appears\n else\n vprint_error(\"#{ip}:#{rport} - #{version} appears to be patched\")\n Exploit::CheckCode::Safe\n end\n end", "def remote?\n !query.ran? || options.fetch(:remote, false)\n end", "def fetch?\n remote?\n end", "def allowed_ssh?\n port_protocol_allowed('22')\n end", "def valid_request?\n if env.include_all?(['SSH_CLIENT', 'SSH_CONNECTION', 'SSH_ORIGINAL_COMMAND'])\n if valid_command?(env['SSH_ORIGINAL_COMMAND'])\n return true\n end\n end\n false\n end", "def check_host\n # rubocop:disable Style/GuardClause\n if config[:host] == '0.0.0.0'\n logger.warn 'Will listen on all interfaces (0.0.0.0).' \\\n ' Consider using 127.0.0.1 (--host option).'\n end\n # rubocop:enable Style/GuardClause\n end", "def check_host\n # rubocop:disable Style/GuardClause\n if config[:host] == '0.0.0.0'\n logger.warn 'Will listen on all interfaces (0.0.0.0).' \\\n ' Consider using 127.0.0.1 (--host option).'\n end\n # rubocop:enable Style/GuardClause\n end", "def secure?\n false\n end", "def remote_ip\r\n@remote_ip ||= (@env[\"action_dispatch.remote_ip\"] || ip).to_s\r\nend", "def not_secure?\n !secure?\n end", "def is_local?\n !is_remote?\n end", "def verify_host_key_value(given)\n current_net_ssh = Net::SSH::Version::CURRENT\n new_value_version = Net::SSH::Version[5, 0, 0]\n if current_net_ssh >= new_value_version\n # 5.0+ style\n {\n # It's not a boolean anymore.\n \"true\" => :always,\n \"false\" => :never,\n true => :always,\n false => :never,\n # May be correct value, but strings from JSON config\n \"always\" => :always,\n \"never\" => :never,\n nil => :never,\n }.fetch(given, given)\n else\n # up to 4.2 style\n {\n \"true\" => true,\n \"false\" => false,\n nil => false,\n }.fetch(given, given)\n end\n end", "def remote_addr; end", "def remote?\n !@remote.nil?\n end", "def connected?()\n (self.remote_address rescue nil) ? true : false\n end", "def run\n super\n \n check_url = \"#{_get_entity_name}/vpn/login.js\"\n response = http_request(:get, check_url)\n\n # grab header\n last_modified_header = false\n response.each_header{|h| last_modified_header = response[h] if h =~ /Last-Modified/i}\n unless last_modified_header\n _log \"No Last-Modified Header! Failing\"\n return\n end\n\n # Get the date to see it's vuln\n date_string = last_modified_header.gsub(\"Last-Modified:\",\"\").strip\n _log \"Got Date String: #{date_string}\"\n # check that it matches our known vuln versions\n\n if Time.parse(date_string) < Time.parse(\"Sun, 17 Dec 2019 00:00:00 GMT\")\n _log \"Vulnerable, got date string: #{date_string}!\"\n _create_issue({\n name: \"Vulnerable Citrix Netscaler\",\n severity: 1,\n type: \"vulnerability_citrix_netscaler_rce_cve_2019_19871\",\n status: \"potential\",\n description: \"This server (#{check_url}) appears vulnerable to an unauthenticated RCE bug announced in December 2019. See references for more details.\" + \n \"\\n\\nProof: #{last_modified_header}. \\n\\nNote that a mitigation may be in place per instruction from Citrix provided shortly after the release of\" + \n \" the patch.\",\n references: self.class.metadata[\"references\"],\n details: {}\n })\n else\n _log \"Not Vulnerable! Proof: #{last_modified_header}\"\n end\n\n end", "def check\r\n if cmd_exec(\"sudo -V\") =~ /version\\s+([^\\s]*)\\s*$/\r\n sudo_vn = $1\r\n sudo_vn_parts = sudo_vn.split(/[\\.p]/).map(&:to_i)\r\n # check vn between 1.6.0 through 1.7.10p6\r\n # and 1.8.0 through 1.8.6p6\r\n if not vn_bt(sudo_vn, VULNERABLE_VERSION_RANGES)\r\n print_error \"sudo version #{sudo_vn} not vulnerable.\"\r\n return Exploit::CheckCode::Safe\r\n end\r\n else\r\n print_error \"sudo not detected on the system.\"\r\n return Exploit::CheckCode::Safe\r\n end\r\n\r\n if not user_in_admin_group?\r\n print_error \"sudo version is vulnerable, but user is not in the admin group (necessary to change the date).\"\r\n Exploit::CheckCode::Safe\r\n end\r\n # one root for you sir\r\n Exploit::CheckCode::Vulnerable\r\n end", "def is_url_secured(url)\n url = url.downcase\n if !url.include?(\"https\") && !url.include?(\"http\")\n Logger.warning(\"Using 'is_url_secured' on a url that doesn't have a http(s):// attachment.\")\n end\n return url.include? \"https\"\nend", "def local_request? #:doc:\n request.remote_addr == LOCALHOST && request.remote_ip == LOCALHOST\n end", "def local_request? #:doc:\n request.remote_addr == LOCALHOST && request.remote_ip == LOCALHOST\n end", "def authorized?\n !!@req.env['REMOTE_USER']\n end", "def remote_ip\n\t\tif request.remote_ip == '127.0.0.1'\n\t\t\t# Random remote address for testing on develop\n\t\t\t\"#{rand(255)}.#{rand(255)}.#{rand(255)}.#{rand(255)}\"\n\t\telse\n\t\t\trequest.remote_ip\n\t\tend\n\tend", "def connectable?\n ssl_context = OpenSSL::SSL::SSLContext.new\n ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n @http.head(URL_TO_CHECK, ssl_context: ssl_context).status.success?\n rescue StandardError\n false\n end", "def host_pairing_blocked\n return @host_pairing_blocked\n end", "def secure?\n false\n end", "def site_found(input)\n BEEP.check_platform if OPTIONS[:beep]\n success = 'Possible Vulnerability'\n puts <<-_END_\n [ x ] -----------------------------------------------\n\n [#{Time.now.strftime(\"%T\")} #{success}]\n\n [ X ] Injection Point :: #{input.cyan}\n [ X ] Server Specifications :: #{SiteInfo.capture_host(input).cyan}\n [ X ] Possible IP Address :: #{SiteInfo.capture_ip(input).cyan}\n\n _END_\n end", "def local?\n ip = server_ip.to_s\n is_localhost = ip == '127.0.0.1'\n is_in_ifconfig = `/sbin/ifconfig -a`.include? ip\n is_in_ip_addr = `/sbin/ip addr show`.include? ip\n is_localhost || is_in_ifconfig || is_in_ip_addr\n rescue => err\n (MorLog.my_debug '#{err.message}') && (return false)\n end", "def ssh_ip\n 5.times do\n ip = read_guest_ip_dhcp\n return ip unless ip.empty?\n\n ip = read_guest_ip_prlctl\n return ip unless ip.empty?\n\n sleep 2\n end\n\n # We didn't manage to determine IP - return nil and\n # expect SSH client to do a retry\n return nil\n end", "def local?\n !remote?\n end", "def proxied?\n return unless dns?\n return true if cloudflare_ip?\n return false if pointed_to_github_pages_ip? || pointed_to_github_user_domain?\n served_by_pages?\n end", "def check_host\n result = `ping -q -c 2 #{@conn[:host]}`\n # return true or false if exit status is 0\n $?.exitstatus == 0\n end", "def can_rest?\n return false if driver_options[:ssh_options] && driver_options[:ssh_user]\n\n _, host, port = driver_url.split \":\", 3\n host != \"localhost\" || port.to_i > 0\n end", "def host_agent_ready?\n # Localhost\n uri = URI.parse(\"http://#{LOCALHOST}:#{@port}/\")\n req = Net::HTTP::Get.new(uri)\n\n response = make_host_agent_request(req)\n\n if response && (response.code.to_i == 200)\n @host = LOCALHOST\n return true\n end\n\n return false unless @is_linux\n\n # We are potentially running on Docker in bridged networking mode.\n # Attempt to contact default gateway\n uri = URI.parse(\"http://#{@default_gateway}:#{@port}/\")\n req = Net::HTTP::Get.new(uri)\n\n response = make_host_agent_request(req)\n\n if response && (response.code.to_i == 200)\n @host = @default_gateway\n return true\n end\n false\n rescue => e\n Instana.logger.error \"#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}\"\n Instana.logger.debug e.backtrace.join(\"\\r\\n\")\n return false\n end", "def remote? # :nodoc:\n @remote\n end", "def do_ssl_verify?\n if target_hostname == \"localhost\" ||\n target_hostname == \"a2-dev.test\" ||\n target_hostname =~ /\\d+\\.\\d+\\.\\d+\\.\\d+/\n return false\n end\n return true\n end", "def tainted?() end", "def host_authorization; end", "def host_authorization; end", "def check\r\n\r\n res = send_request_cgi({\r\n 'method' => 'GET',\r\n 'uri' => normalize_uri(target_uri.path, \"#{datastore['CONTENT_DIR']}/\")\r\n })\r\n\r\n unless res\r\n vprint_error 'Connection failed'\r\n return CheckCode::Unknown\r\n end\r\n\r\n if res.code == 404\r\n return Exploit::CheckCode::Safe\r\n end\r\n return Exploit::CheckCode::Appears\r\n end", "def test_nonhero_is_vulnerable\n end", "def select_host_key_verifier(paranoid)\n case paranoid\n when true, nil\n ::Net::SSH::Verifiers::Lenient.new\n when false\n ::Net::SSH::Verifiers::Null.new\n when :very\n ::Net::SSH::Verifiers::Strict.new\n when :secure\n ::Net::SSH::Verifiers::Secure.new\n else\n if paranoid.respond_to?(:verify)\n paranoid\n else\n raise ArgumentError, \"argument to :paranoid is not valid: #{paranoid.inspect}\"\n end\n end\n end" ]
[ "0.68722624", "0.6610267", "0.6548351", "0.6417939", "0.6393129", "0.63112485", "0.6308762", "0.6188193", "0.60714716", "0.60561657", "0.60193527", "0.6011968", "0.5997984", "0.5971886", "0.59324974", "0.59300596", "0.59199405", "0.591743", "0.5915322", "0.59101534", "0.5904338", "0.5876575", "0.5875141", "0.58683187", "0.5861723", "0.5854727", "0.5852467", "0.5845109", "0.5822245", "0.579902", "0.5781465", "0.5760053", "0.573664", "0.5733956", "0.57261115", "0.57219553", "0.5718964", "0.57125455", "0.5711136", "0.5698932", "0.56919605", "0.56805354", "0.5677735", "0.5677086", "0.56744474", "0.56692225", "0.5667677", "0.5656298", "0.5642792", "0.5611719", "0.5611212", "0.5593405", "0.5543802", "0.5542937", "0.5539346", "0.5524803", "0.5518134", "0.55116403", "0.55116403", "0.55112225", "0.55096173", "0.5498629", "0.5490923", "0.54898256", "0.54858756", "0.54858756", "0.54839426", "0.5483934", "0.54753083", "0.547235", "0.54687685", "0.54671234", "0.5450516", "0.54490703", "0.54438406", "0.5438827", "0.54271644", "0.5425997", "0.5425997", "0.5421096", "0.5411065", "0.54080725", "0.53996074", "0.5398041", "0.53942543", "0.5390665", "0.5386746", "0.5377571", "0.5373534", "0.53731877", "0.5371884", "0.53674144", "0.5364909", "0.53611493", "0.53506285", "0.53426784", "0.53426784", "0.5334771", "0.5334383", "0.53244776" ]
0.6688242
1
return a vector of arguments
def arguments(model) result = OpenStudio::Ruleset::OSArgumentVector.new alternativeModelPath = OpenStudio::Ruleset::OSArgument::makePathArgument("alternativeModelPath",true,"osm") alternativeModelPath.setDisplayName("Alternative Model Path") result << alternativeModelPath measures_json = OpenStudio::Ruleset::OSArgument::makeStringArgument("measures_json", true) measures_json.setDisplayName("Alternative Measures") measures_json.setDefaultValue("[]") result << measures_json return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def arguments\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # this measure does not require any user arguments, return an empty list\n\n return args\n end", "def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n return args\r\n end", "def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n return args\r\n end", "def args() return @args end", "def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n \r\n return args\r\n end", "def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n # this measure does not require any user arguments, return an empty list\n return args\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # this measure does not require any user arguments, return an empty list\n\n return args\n end", "def args\n n = self.num_args\n a = []\n n.times { |i|\n a.push Arg::new(self, i)\n }\n return a\n end", "def args\n n = self.num_args\n a = []\n n.times { |i|\n a.push Arg::new(self, i)\n }\n return a\n end", "def args()\n #This is a stub, used for indexing\n end", "def args\n return [] unless options[\"args\"]\n options[\"args\"].map do |options|\n Argument.new options\n end\n end", "def arguments(workspace)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end", "def arguments(workspace)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n return args\n end", "def args\n @x.args.uniq\n end", "def args\n @args.args\n end", "def args\n @function.args\n end", "def extract_argument_lists(args, splittable_args); end", "def get_args\n <<-CODE\n stack_push(I2N(c->args));\n CODE\n end", "def args\n ret = []\n @x.each do |e|\n ret << e.args\n end\n ret.flatten.uniq\n end", "def args\n @args \n end", "def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n # todo - add bool arguments to decide what tables to generate, default all to true.\r\n\r\n return args\r\n end", "def args\n @args\n end", "def get_arg_list\n return nil if node_type != :call\n\n sons.each do |son|\n if son.node_type == :arglist\n return son.sons.map {|arg| arg.name}.join(', ')\n end\n end\n\n return nil\n end", "def arguments\n Properties[self.class] ||= {}\n return Properties[self.class][:args] || []\n end", "def args(*) end", "def _list_args args\n incl = []\n excl = []\n args.each do |e| \n if e[0] == '+'\n incl << e[1..-1]\n elsif e[0] == '-'\n excl << e[1..-1]\n else\n incl << e\n end\n end\n incl = nil if incl.empty?\n excl = nil if excl.empty?\n return incl, excl\n end", "def _list_args args\n incl = []\n excl = []\n args.each do |e| \n if e[0] == '+'\n incl << e[1..-1]\n elsif e[0] == '-'\n excl << e[1..-1]\n else\n incl << e\n end\n end\n incl = nil if incl.empty?\n excl = nil if excl.empty?\n return incl, excl\n end", "def arguments(model = nil)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def arguments; end", "def arguments; end", "def arguments; end", "def arguments\n return @arguments\n end", "def arglists\n if @call_seq then\n @call_seq\n elsif @params then\n \"#{name}#{param_seq}\"\n end\n end", "def arglists\n if @call_seq then\n @call_seq\n elsif @params then\n \"#{name}#{param_seq}\"\n end\n end", "def args\n raw_args\n end", "def g *args # accept multiple arguments as an array\n\targs # returns an array\nend", "def arrayize_arguments(args)\n # Go through trailing arguments and suck them in if they don't seem\n # to have an owner.\n array = []\n until args.empty? || args.first.match(/^-/)\n array << args.shift\n end\n array\n end", "def varargs(arg1,*rest)\n puts \"Got #{arg1} and #{rest.join(',')}\"\nend", "def arguments(model)\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n \r\n return args\r\n end", "def arguments\n @args ||= {}\n unless @args.size > 0\n ARGV.each_with_index do |arg, index|\n if arg.start_with?('-')\n if index + 1 < ARGV.size\n next_arg = ARGV[index + 1]\n if next_arg.start_with?('-') then\n @args.update(argument_present_or_direct(arg))\n else\n @args.update(arg => next_arg)\n end\n else\n @args.update(argument_present_or_direct(arg))\n end\n end\n end\n end\n @args\n end", "def arguments(_model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end", "def java_parameters\n\t\t\tif @args.nil? || @args.size < 1 then\n\t\t\t\treturn []\n\t\t\tend\n\t\t\t\n\t\t\toutput = []\n\t\t\t@args.each do |arg|\n\t\t\t\ttemp = @args.split OPERATOR_REGEX\n\t\t\t\tif !temp.nil? && temp.size > 1 then\n\t\t\t\t\toutput << temp[0]\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\treturn output\n\t\tend", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def arguments=(_arg0); end", "def argument_names\n @arguments.map { |a| a[:name] }\n end", "def arguments\n parsed {\n @arguments\n }\n end", "def arguments(model)\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n \r\n return args\r\n end", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n return args\n end", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n return args\n end", "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n return args\n end", "def to_args(arity)\n case arity\n when -1\n full_arguments\n when (min_argument_count..full_argument_count)\n full_arguments.slice(full_argument_count - arity, arity)\n else\n raise ArgumentError, \"Arity must be between #{min_argument_count} \"\\\n \"and #{full_argument_count}\"\n end\n end", "def to_args(arity)\n case arity\n when -1\n full_arguments\n when (min_argument_count..full_argument_count)\n full_arguments.slice(full_argument_count - arity, arity)\n else\n raise ArgumentError, \"Arity must be between #{min_argument_count} \"\\\n \"and #{full_argument_count}\"\n end\n end", "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end", "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments(model)\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n return args\r\n end", "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n return args\n end", "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n return args\n end", "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n return args\n end", "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n return args\n end", "def arguments(model)\n result = OpenStudio::Ruleset::OSArgumentVector.new\n return result\n end", "def arguments_method(*arguments)\n arguments.each do |argument|\n puts argument\n end\nend", "def args\n defined_args = []\n self.class.init_args.keys.each do | arg |\n if arg_val = send(arg)\n defined_args << \":#{arg} => #{arg_val}\"\n end\n end\n defined_args.join(\",\\n\")\n end", "def arguments(model)\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n \r\n return args\r\n end", "def arguments\n \"\"\n end", "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments\n ArgumentExpansion.new(arg_node)\n end", "def getArray _args\n \"getArray _args;\" \n end", "def varargs(arg1, *rest)\n puts \"Got #{arg1} and #{rest.join(', ')}\"\nend", "def xargs *args\r\n m = args.shift\r\n args.slice!(-1).each {|a|\r\n method(m).call(*(args + [a]))\r\n }\r\nend", "def lambdacall_args(sexp)\n__args_index(car(sexp)) + lambdacall_index(cadr(sexp), [])\n end", "def positional_args\n result = required_args + optional_args\n result << remaining_arg if remaining_arg\n result\n end" ]
[ "0.7716733", "0.7680186", "0.7602591", "0.75949585", "0.75949585", "0.75949585", "0.75949585", "0.75949585", "0.75949585", "0.75949585", "0.756971", "0.7555881", "0.7555881", "0.75543416", "0.75412905", "0.7516574", "0.7467498", "0.74142396", "0.74142396", "0.7276941", "0.718232", "0.7103484", "0.71033955", "0.7076671", "0.7052639", "0.70323455", "0.69990534", "0.6921279", "0.6874517", "0.6847061", "0.6816608", "0.6806152", "0.6737056", "0.6706403", "0.6703771", "0.6695555", "0.6695555", "0.66946524", "0.66915077", "0.66915077", "0.66915077", "0.6681999", "0.666704", "0.666704", "0.66358584", "0.6635679", "0.6635596", "0.6635165", "0.66272426", "0.6609786", "0.66094714", "0.6608231", "0.65727884", "0.65727884", "0.65727884", "0.65727884", "0.65727884", "0.65727884", "0.65727884", "0.65727884", "0.65727884", "0.65727884", "0.65727884", "0.65727884", "0.65727884", "0.65727884", "0.65660596", "0.6564941", "0.6559881", "0.6556757", "0.6555857", "0.6555857", "0.6555857", "0.6552332", "0.6551595", "0.65321463", "0.65321463", "0.65321463", "0.65321463", "0.65321463", "0.65275156", "0.65275156", "0.65218496", "0.6519899", "0.6519899", "0.6519899", "0.6519899", "0.6514634", "0.65139127", "0.65043396", "0.6501109", "0.6500986", "0.6477153", "0.6477153", "0.6477153", "0.64764094", "0.6470824", "0.6464853", "0.6438717", "0.64301085", "0.63873833" ]
0.0
-1
For example: calculate([1,2,3],[4,5,6]) will return an array containing 5, 7, and 9.
def calculate(arr1, arr2) result = [] arr1.each_with_index do |num, index| result << num + arr2[index] end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_array(numbers)\n return numbers.sum()\nend", "def calculate_doubles(arr)\n array = []\n arr.each {|x| array << x + x}\n array\n\nend", "def sum_array(integers)\n integers.sum\nend", "def my_function2(arr)\n final_arr = []\n first_half = []\n first_product = 1\n last_half = []\n arr.each_with_index do |n, i|\n first_half = arr[0...i]\n last_half = arr[i+1..-1]\n first_product = first_half.reduce(:*) || 1\n last_product = last_half.reduce(:*) || 1\n products = first_product * last_product\n final_arr.push(products)\n end\n return \"Products: #{final_arr}\"\nend", "def compute_squares(arr)\r\n\r\n # empty array created\r\n compute_squares = []\r\n\r\n # iterate using each loop method\r\n arr.each {|el| compute_squares << el**2}\r\n\r\n # returns result\r\n compute_squares\r\nend", "def find_product(nums)\n multiplication = 1\n\n new_array = []\n\n nums.each do |num|\n multiplication *= num\n end\n\n nums.each do |num|\n new_array << multiplication / num\n end\n\n return new_array\nend", "def sum(array_of_integers)\n # TODO\nend", "def calculate_doubles(arr)\n doubled_array = []\n arr.each {|int| doubled_array.push(int * 2)}\n doubled_array\nend", "def sum_array(numbers)\n total = 0\n for number in numbers\n total = total + number\n end\n return total\nend", "def sum_of_sums(array)\r\nend", "def product_method(array)\n array.reduce(:*)\nend", "def sum_array(array)\n # Your code here\nend", "def my_function3(arr)\n final_arr = []\n first_product = 1\n last_half = []\n arr.each_with_index do |n, i|\n last_half = arr[i+1..-1]\n first_product *= arr[i-1] unless i == 0\n last_product = last_half.reduce(:*) || 1\n products = first_product * last_product\n final_arr.push(products)\n end\n return \"Products: #{final_arr}\"\nend", "def compute_squares(array)\n arrayFinal = []\n array.each do |element|\n arrayFinal << element * element\n end\n return arrayFinal\nend", "def my_method(array)\n if array.empty?\n []\n elsif array.length == 1\n [7 * array.first]\n else\n array.map do |value|\n value * value\n end\n end\nend", "def my_method(array)\n if array.size == 1\n [7 * array.first]\n elsif array.size > 1\n array.map do |value|\n value * value\n end\n else\n []\n end\nend", "def square_array(numbers)\n new_arr = []\n numbers.each do |number|\n new_arr << (number**2)\n end\n return new_arr\nend", "def sum_array( numbers )\r\n numbers.inject(0, :+)\r\nend", "def sum_array(integers)\n integers.inject(0) { |result, element| result + element }\nend", "def square_array(numbers)\n numbers.map { |e| e ** 2 }\nend", "def arr_product(arr)\n product = arr.reduce(:*)\n arr.map { |el| product / el }\nend", "def calculate_doubles(arr)\n arr.map {|a|a*2}\n\nend", "def sum_array(integers)\n integers.inject {|sum, n| sum + n}\nend", "def my_method(array)\n if array.empty?\n []\n elsif array.size > 1\n array.map do |value|\n value * value\n end\n else\n [7 * array.first]\n end\nend", "def my_method(array)\n if array.empty?\n []\n elsif array.size > 1\n array.map do |value|\n value * value\n end\n else\n [7 * array.first]\n end\nend", "def my_method(array)\n if array.empty?\n []\n elsif array.size > 1\n array.map do |value|\n value * value\n end\n else\n [7 * array.first]\n end\nend", "def total(array_of_numbers)\n return array_of_numbers.reduce(:+)\nend", "def my_method(array)\n if array.empty?\n []\n elsif array.size >= 2\n array.map do |value|\n value * value\n end\n else\n [7 * array.first]\n end\nend", "def multi_dimensional_sum(array)\n array.flatten\nend", "def sum_array(array_num)\n\nend", "def square_array(numbers)\n new_numbers = []\n numbers.each do |num|\n new_numbers << (num ** 2)\n end\n return new_numbers\nend", "def square_array(some_array)\n array_squared = []\n some_array.each do |number|\n array_squared << number * number\n end \n return array_squared\nend", "def square_array(some_array)\n array_squared = []\n some_array.each do |item|\n array_squared << item*item\nend\n return array_squared\nend", "def func1(nums)\r\n ret = [nums[0]]\r\n for index in 1...nums.length\r\n ret += [ret[index-1]+nums[index]]\r\n end\r\n return ret \r\nend", "def square_array(array)\n numbers = []\n array.each do |number| numbers << number ** 2\n end\n numbers\nend", "def sum_array(array)\n array.sum\nend", "def array_sum(arr)\n arr.reduce(:+)\n\nend", "def basic_9 (array_iterate)\n square_array = array_iterate.collect { |n| n * n}\n return square_array\nend", "def sum_array(array)\n array.sum\nend", "def sum_upon_sums(array)\n\nend", "def total(array_of_numbers)\n sum = 0\n array_of_numbers.each do |num|\n sum += num\n end\n return sum\nend", "def sum(array)\n array.sum\nend", "def numbers_sum(input_array)\n output = input_array[0] + input_array[1] # Sums the first array's input with the second array's input\n return output\nend", "def part_sums(ls)\n array_of_sum = ls.sum\n return_sums = [array_of_sum]\n ls.each do |val|\n array_of_sum -= val\n return_sums << sum\n end\n sums\nend", "def calculate_doubles!(arr)\n\n arr.map! {|x| x + x}\n arr\n\nend", "def sum arr\n sum_array = 0 \n arr.each { |x| sum_array = sum_array + x } \n return sum_array\nend", "def sum(*array)\n i = 0\n sum = 0\n array=[]\n while i < array.length do\n sum += sum[i]\n #array.push\n i += 1\n# puts(\"Inside the loop sum = #{sum}\") \n end\n return sum\nend", "def sum_of_product(arr)\n sum = []\n arr.each_with_index {|element, index| sum << element * index}\n sum.sum\n end", "def productify_easy(arr)\n product = arr.inject(:*)\n new_arr = []\n arr.each do |num|\n new_arr << product / num\n end\n new_arr\nend", "def total_of_array(array)\n array.reduce(:+)\nend", "def sum_square_array(arr)\n arr.reduce(:+) ** 2\nend", "def square_array (array)\n\nnewarray = []\n\narray.each do |element|\n newarray.push(element**2) \nend\n\nnewarray\n\nend", "def sum_array(array)\n array.reduce(:+)\nend", "def products_except_me(numbers)\n\n result = []\n numbers.each_index do |i|\n subarr = numbers[0...i] + numbers[i+1..-1]\n result << subarr.reduce(:*)\n\n end\n result\nend", "def compute_sum(numbers)\n sum = 0\n numbers.each do |number|\n sum += number\n end\n return sum\nend", "def compute_sum(numbers)\n sum = 0\n numbers.each do |number|\n sum += number\n end\n return sum\nend", "def get_product_integers(array_of_integers)\n\n results = []\n array_of_integers.each_with_index do |num1,index1|\n product = 1\n array_of_integers.each_with_index do |num2,index2|\n next if index1 == index2\n product *= num2\n end\n results << product\n end\n p results\n\n end", "def my_function4(arr)\n products_arr = []\n products_so_far = 1\n i = 0\n while i < arr.length\n products_arr[i] = products_so_far\n products_so_far *= arr[i]\n i += 1\n end\n\n products_so_far = 1\n i = arr.length - 1\n while i >= 0\n products_arr[i] *= products_so_far\n products_so_far *= arr[i]\n i -= 1\n end\n\n return \"Products: #{products_arr}\"\nend", "def total(arr)\n x = arr.reduce(:+)\n return x\nend", "def square_array(array)\r\n solution = []\r\n array.each do |number|\r\n solution << number**2\r\n end\r\n solution \r\nend", "def parts_sums(input_array)\n total = input_array.sum\n output = [total]\n input_array.size.times do \n total = total - input_array.shift\n output << total\n end\n output\nend", "def square_the_values(array_of_integers)\n # TODO\nend", "def double_all(arr)\n doubles = []\n\n arr.each do |num|\n doubles.push(num * 2)\n end\n\n doubles\nend", "def square_array(some_array)\n some_array.collect {|num| num*num} \nend", "def array_sum(arr)\n arr.reduce(:+)\nend", "def array_sum(arr)\n arr.reduce(:+)\nend", "def sum_of_big_numbers(array_of_integers)\n # TODO\nend", "def multiply(array,mult)\n array.map{|num| num*mult}\nend", "def sum_array(add)\n add.inject {|num, n| num + n}\nend", "def multiply_all_by(array, num)\n\n result = []\n array.each do |elem|\n result << elem * num\n end\n result\nend", "def double_array(array)\n output_array = []\n\n array.each do |thing|\n output_array << thing * 2\n end\n\n return output_array\nend", "def total_of_array(array)\n array.inject(&:+)\nend", "def square_array(array)\n squared = []\n array.each { |element| squared << element ** 2 }\n squared\nend", "def squareSum(numbers) \r\n numbers.map{|num| num ** 2}.sum \r\n \r\nend", "def numbers_array\n num_array = Array.new\n input_as_array.each { |n| num_array << get_number(n) }\n\n return num_array\n end", "def multiply_list(array1, array2)\n result = []\n array1.each_with_index do |num, index|\n result.push(num * array2[index])\n end\n \nresult\n \n \n \nend", "def square_array(array) #build square_array method\r\n\r\n new_array = [] #new array of squared numbers\r\n\r\n array.each do |integer|#implement own logic\r\n new_array << integer ** 2 #shovel /push logic into array \r\n end\r\n return new_array #returns array of these squared numbers\r\nend", "def do_calculation\n index = 0\n total = 0.0\n\n num_list_length = num_list.length\n\n ( num_list_length - 1 ).times do | i |\n total = num_list[i].to_f if i == 0\n index = 0 if index == 4\n\n total = total.send(OPERATIONS[index], num_list[i+1].to_f)\n index = index + 1\n end\n\n total\n end", "def square_array(array)\n # your code here\n newArray = []\n array.each do |num|\n number = num**2\n newArray.push(number)\n end\n return newArray\nend", "def array_of_array_multi(array)\n # YOUR CODE HERE\n multiArr = array.map{ |arr| arr.map{ |num| num * num } }\n p multiArr\n p array\n # array\nend", "def square_array(array)\n new_array = []\n array.each{|a| new_array.push(a*a)}\n return new_array\nend", "def square_array(array)\n\n squared = []\n array.each do |num|\n squared.push(num * num)\n end\n\n squared\n \nend", "def square_array(array)\n # Use an Enumerable to square every element in the passed in array\n # Return a new array of the results\n array.map do |n|\n n*n\nend\nend", "def sum_of_sums(arr)\n multipliers_arr = (1..arr.length).to_a.reverse\n arr.zip(multipliers_arr).map { |a, b| a * b }.sum\nend", "def sum (array)\n y=array.inject(:+).to_i\nend", "def it_arr_sum(array)\r\n sum = 0\r\n array.each {|ele| sum += ele}\r\n return sum\r\nend", "def double_array(array)\n array*2\nend", "def total(array)\n array.sum\nend", "def sum array \n array.inject { |a,b| a + b }\nend", "def square_array(some_array)\n\tcontainer = []\n\tsome_array.each do |number|\n\t\tcontainer << number * number\n\tend\nend", "def sum_of_sums(array)\n results = []\n\n loop do \n break if array.empty?\n results << array.inject(:+)\n array.pop\n end\n\n results.inject(:+)\nend", "def mutiply_all_element_of_an_array_excep_itself2(array_n)\n total_mutiplication_value = 1\n result_array = []\n \n array_n.each do |elm|\n total_mutiplication_value = elm * total_mutiplication_value\n end\n \n puts \"Total mutiplication : #{total_mutiplication_value}\"\n \n array_n.each do |elm|\n result = divide_by_bit_shift(total_mutiplication_value, elm)\n result_array.push(result[0])\n end\n \n\n return result_array\nend", "def sum arr\n sum = arr.sum\n return sum\nend", "def sum_of_arr(arr)\n arr.inject(:+)\nend", "def sum(arr)\n output = 0\n arr.each do |num|\n output += num\n end\n return output\nend", "def calculate_doubles!(arr)\n arr.map! {|int| int * 2}\nend", "def total(an_array)\n an_array.reduce(:+)\nend", "def get_products(arr)\n front_products_arr = [] # => [1, 1*7, 1*7*3, 1*7*3*4]\n back_products_arr = [] # => [4, 3*4, 7*3*4, 1*7*3*4]\n front_product = 1\n\n arr.each do |el|\n front_product *= el\n front_products_arr << front_product\n end\n\n back_product = 1\n (arr.length - 1).downto(0) do |el|\n back_product *= arr[el]\n back_products_arr << back_product\n end\n\n final_products = [] # => [7*3*4, 1*3*4, 1*7*4, 1*7*3]\n final_index = arr.length - 2 # => 2\n 0.upto(final_index) do |el| # upto 2\n if el == 0\n final_products << back_products_arr[final_index]\n else\n final_products << front_products_arr[el - 1] * back_products_arr[final_index - el]\n end\n end\n final_products << front_products_arr[final_index]\n\n final_products\nend", "def multiply_by(array)\n return array.map { |el| el * 3}\nend", "def square_array_2(array)\n array.collect { |i| i**2 }\n array\nend" ]
[ "0.7028676", "0.6722159", "0.6701556", "0.6544974", "0.651017", "0.6476049", "0.6460304", "0.64402527", "0.6401669", "0.64008325", "0.63864166", "0.6361526", "0.63415176", "0.63150054", "0.63124365", "0.6305785", "0.6295036", "0.62896454", "0.62854373", "0.6277938", "0.62774104", "0.62610745", "0.6259361", "0.6254944", "0.6254944", "0.6254944", "0.62465113", "0.6235051", "0.62342215", "0.6226157", "0.62166613", "0.6205645", "0.6204333", "0.6201641", "0.6199684", "0.6192051", "0.61821103", "0.6177821", "0.6174721", "0.6153981", "0.61484015", "0.61210597", "0.61048895", "0.6093402", "0.60912555", "0.6083585", "0.6065438", "0.6060283", "0.6058301", "0.6055051", "0.6047651", "0.6041951", "0.60338885", "0.60322356", "0.6027889", "0.6027889", "0.60199845", "0.601417", "0.60125655", "0.60120237", "0.6008468", "0.60068697", "0.60015625", "0.59880996", "0.5984963", "0.5984963", "0.5983889", "0.5983498", "0.59833384", "0.59812903", "0.5968365", "0.5964075", "0.59629005", "0.5960215", "0.5957388", "0.5957332", "0.5954513", "0.5945867", "0.594196", "0.59404117", "0.59398466", "0.5933645", "0.59278274", "0.59271985", "0.59206414", "0.59175414", "0.59142435", "0.5906909", "0.5900621", "0.58998865", "0.5898262", "0.5890442", "0.58856386", "0.5885097", "0.587463", "0.5874116", "0.5869252", "0.5868925", "0.5868423", "0.5867886" ]
0.6393024
10