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 |
|---|---|---|---|---|---|---|
context_get_fgcolor: retrieves the current foreground color. This returns an integer, not an object
|
def context_get_fgcolor()
return $gimp_iface.gimp_context_get_foreground()[0]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fg(c)\n return self unless ANSI_COLORS[c]\n return colorize(ANSI_COLORS[c])\n end",
"def color\n @color || $def_fg_color\n end",
"def context_get_bgcolor()\n return $gimp_iface.gimp_context_get_background()[0]\nend",
"def foreground(fgcolor)\n fgcolor.split(/\\s+/).collect { |fg| names_to_code(fg) }.join(\"\")\n end",
"def get_fg(str)\n\treturn Color.get_t(\"fg\")[str]\nend",
"def _context_set_fgcolor!(rgb)\n $gimp_iface.gimp_context_set_foreground(rgb)\nend",
"def foreground_fill\n red = background_fill[1..2].to_i(16)\n green = background_fill[3..4].to_i(16)\n blue = background_fill[5..6].to_i(16)\n (red * 0.299 + green * 0.587 + blue * 0.114) > 186 ? '#000000' : '#FFFFFF'\n end",
"def foreground(color=nil)\n @options[:foreground] = color unless color.nil?\n @options[:foreground]\n end",
"def foreground\n instance.options[:foreground]\n end",
"def actual_color\n ColorCode.where(numeric_code: default_code.split(\"-\")[-2])[0]\n end",
"def calculate_foreground(background, foreground)\n nfg = nil\n # Loop through brighter and darker versions of the foreground color. The\n # numbers here represent the amount of foreground color to mix with\n # black and white.\n [100, 75, 50, 25, 0].each do |percent|\n dfg = foreground.darken_by(percent)\n lfg = foreground.lighten_by(percent)\n\n dbd = brightness_diff(background, dfg)\n lbd = brightness_diff(background, lfg)\n\n if lbd > dbd\n nfg = lfg\n nbd = lbd\n else\n nfg = dfg\n nbd = dbd\n end\n\n ncd = color_diff(background, nfg)\n\n break if nbd >= @minimum_brightness_diff and ncd >= @minimum_color_diff\n end\n nfg\n end",
"def foreground=(value)\n @foreground = Vedeu::Colours::Foreground.coerce(value)\n end",
"def foreground_color(index)\n \"\\e[38;5;#{index}m\"\nend",
"def get_color\n @color\n end",
"def detect_colour_mode\n case ENV['TERM']\n when /-truecolor$/ then 16_777_216\n when /-256color$/, 'xterm' then 256\n when /-color$/, 'rxvt' then 16\n else 256\n end\n end",
"def detect_colour_mode\n case ENV['TERM']\n when /-truecolor$/ then 16_777_216\n when /-256color$/, 'xterm' then 256\n when /-color$/, 'rxvt' then 16\n else 256\n end\n end",
"def background_colour\n @cr[0xf] >> 4\n end",
"def getColor(theColor, default = 'gray')\n preset = Proc.new do |color|\n case color\n when 'windowBackground' then return NSColor.windowBackgroundColor # 0.93\n when 'textColor' then return NSColor.textColor # 0.0\n when 'backgroundColor' then return NSColor.textBackgroundColor # 1.0\n when 'clear' then return NSColor.clearColor\n else color\n end\n end\n if preset.call(theColor) == 'box' # box fill color doesn't have a system color\n dark = !NSAppearance.currentAppearance.name.to_s.index('Dark').nil?\n rgb = dark ? [0.12, 0.12, 0.12] : [0.89, 0.89, 0.89]\n else # get the specified color or default - no dark mode swaps are performed\n rgb = COLORS[preset.call(default)] if (rgb = COLORS[theColor]).nil?\n end\n rgb = [0.5, 0.5, 0.5] if rgb.nil? # get gray if nothing else has worked\n NSColor.colorWithSRGBRed( rgb[0],\n green: rgb[1],\n blue: rgb[2],\n alpha: 1.0 )\n end",
"def blue\n (hex_color & BLUE) / MAX_RGB_VALUE * 100\n end",
"def fcolor(bgcolor = \"#000\", light = \"#fff\", dark = \"#000\")\n bg = bgcolor.gsub(/[^0-9a-f]/i, \"\")\n # convert 3 char to 6 char hex\n bg.gsub!(/./, '\\&\\&') if bg.length == 3\n sum = 0\n [0, 2, 4].each do |i|\n sum += bg[i..i+1].to_i(16)\n end\n return (sum/3 < 128) ? light : dark\n end",
"def Pager_GetBkColor(hwnd) send_pager_message(hwnd, :GETBKCOLOR) end",
"def on_49(_) { fg: fg_color(9) } end",
"def color\n @color ||= color_scope.first\n end",
"def getDrawColor()\n return @drawColor\n end",
"def color(color_code)\n colors = color_code.scan(/\\d+/)\n\n # Extended set foreground x-term color\n if colors[0] == \"38\" && colors[1] == \"5\"\n return @fg_color = \"term-fgx#{colors[2]}\"\n end\n\n # Extended set background x-term color\n if colors[0] == \"48\" && colors[1] == \"5\"\n return @bg_color = \"term-bgx#{colors[2]}\"\n end\n\n # If multiple colors are defined, i.e. \\e[30;42m\\e then loop through each\n # one, and assign it to @fg_color or @bg_color\n colors.each do |cc|\n c_integer = cc.to_i\n\n # Reset all styles\n if c_integer == 0\n @fg_color = nil\n @bg_color = nil\n @other_colors = []\n\n # Primary (default) font\n elsif c_integer == 10\n # no-op\n\n # Turn off bold / Normal color or intensity (21 & 22 essentially do the same thing)\n elsif c_integer == 21 || c_integer == 22\n @other_colors.delete(\"term-fg1\")\n @other_colors.delete(\"term-fg2\")\n\n # Turn off italic\n elsif c_integer == 23\n @other_colors.delete(\"term-fg3\")\n\n # Turn off underline\n elsif c_integer == 24\n @other_colors.delete(\"term-fg4\")\n\n # Turn off crossed-out\n elsif c_integer == 29\n @other_colors.delete(\"term-fg9\")\n\n # Reset foreground color only\n elsif c_integer == 39\n @fg_color = nil\n\n # Reset background color only\n elsif c_integer == 49\n @bg_color = nil\n\n # 30–37, then it's a foreground color\n elsif c_integer >= 30 && c_integer <= 37\n @fg_color = \"term-fg#{cc}\"\n\n # 40–47, then it's a background color.\n elsif c_integer >= 40 && c_integer <= 47\n @bg_color = \"term-bg#{cc}\"\n\n # 90-97 is like the regular fg color, but high intensity\n elsif c_integer >= 90 && c_integer <= 97\n @fg_color = \"term-fgi#{cc}\"\n\n # 100-107 is like the regular bg color, but high intensity\n elsif c_integer >= 100 && c_integer <= 107\n @fg_color = \"term-bgi#{cc}\"\n\n # 1-9 random other styles\n elsif c_integer >= 1 && c_integer <= 9\n @other_colors << \"term-fg#{cc}\"\n end\n end\n end",
"def colour_mode\n instance.options[:colour_mode]\n end",
"def colour_mode\n instance.options[:colour_mode]\n end",
"def font_color()\n validate_worksheet\n if @workbook.fonts[font_id()][:font][:color].nil?\n '000000' #black\n else\n @workbook.fonts[font_id()][:font][:color][:attributes][:rgb]\n end\n end",
"def system_color\n return Color.new(255,255,0)\n end",
"def get_color\n if @thread\n return CYCLING\n end\n\n pins = COLORS.select do |pin|\n get_pin pin\n end\n\n if pins.length == 0\n return nil\n elsif pins.length == 1\n return pins.first\n else\n return INVALID_STATE\n end\n end",
"def color( *val )\n if val.empty?\n return @color if @color\n return @form.color if @form\n return $def_fg_color\n else\n @color_pair = nil\n return property_set :color, val\n end\n end",
"def detect_mode\n if ENV['NO_COLOR'] # see https://no-color.org/\n 0\n elsif RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ # windows\n if ENV['ANSICON']\n 16\n elsif ENV['ConEmuANSI'] == 'ON'\n TRUE_COLOR\n else\n 0\n end\n elsif ENV['TERM_PROGRAM'] == 'Apple_Terminal'\n 256\n else\n case ENV['TERM']\n when /^rxvt-(?:.*)-256color$/\n 256\n when /-color$/, /^rxvt/\n 16\n else # optimistic default\n TRUE_COLOR\n end\n end\n end",
"def bgColor\n return @bg_color\n end",
"def auxiliary_colour\n @cr[0xe] >> 4\n end",
"def context_get_brush()\n return $gimp_iface.gimp_context_get_brush()[0]\nend",
"def textColor\n return @text_color\n end",
"def color_id\n object.calendar.get_color(user_context.id)\n end",
"def color\n return @color\n end",
"def color\n return @color\n end",
"def ListView_GetBkColor(hwnd) send_listview_message(hwnd, :GETBKCOLOR) end",
"def state_color\n result = nil\n states.each do |state|\n result = state.color if state.color\n end\n return result || EmptyColor\n end",
"def blue\n rgba & 0x0000FF\n end",
"def default_color\n return current_layout.default_color\n end",
"def colorize(str, foreground)\n if @color\n fore = FOREGROUND[foreground] or raise ArgumentError, \"Unknown foreground color #{foreground.inspect}\"\n \"#{fore}#{str}#{RESET}\"\n else\n str.to_s\n end\n end",
"def color\n return @color\n end",
"def system_color\n return Color.new(192, 224, 255)\n end",
"def backgroundColor\n if self.highest?\n \"#ff884d\"\n elsif self.high?\n \"#ffcc80\"\n else\n \"#ffefcc\"\n end\n end",
"def get_user_text_color(user)\n user_color = get_user_color(user).gsub(\"#\", \"\")\n\n # Get the hex color as red, green, blue\n r = user_color[0..1].hex\n g = user_color[2..3].hex\n b = user_color[4..5].hex\n\n if ((r * 0.299) + (g * 0.587) + (b * 0.114)) > 186\n \"#4a4a4a\"\n else\n \"#ffffff\"\n end\n end",
"def alt_heading_colour\n if self.theme.background_colour == Color::RGB::White.html\n self.palette.foreground_dark\n else\n self.palette.foreground_light\n end\n end",
"def color\n\t\treturn @color\n\t\t\n\tend",
"def content_colors fg, bg\n @color = fg\n @bgcolor = bg\n @color_pair = get_color($datacolor, fg, bg)\n end",
"def gauge_back_color\n return Color.new(120,120,120)\n end",
"def border_colour\n @cr[0xf] & 0x07\n end",
"def heading_colour\n palette.foreground\n end",
"def blue\n Color.new(80, 0, 67, 88)\n end",
"def get_color(key)\n if key.is_a? String\n color = key\n elsif Wirb::COLORS.key?(key)\n color = Wirb::COLORS[key]\n end\n\n color ? \"\\033[#{ color }m\" : ''\n end",
"def blue\n hsl_to_rgb!\n @attrs[:blue]\n end",
"def blue\n hsl_to_rgb!\n @attrs[:blue]\n end",
"def color_family_id\n data[:color_family_id]\n end",
"def red\n ((hex_color & RED) >> 16) / MAX_RGB_VALUE * 100\n end",
"def back_color2\n Color.new(0, 0, 0, 0)\n end",
"def TreeView_GetBkColor(hwnd) send_treeview_message(hwnd, :GETBKCOLOR) end",
"def bgcolor\n @bgcolor || $def_bg_color\n end",
"def chco\n (foreground || \"FFFFFF\") + \",\" + super\n end",
"def get_color default=$datacolor, color=color(), bgcolor=bgcolor()\n return default if color.nil? || bgcolor.nil?\n #raise ArgumentError, \"Color not valid: #{color}: #{ColorMap.colors} \" if !ColorMap.is_color? color\n #raise ArgumentError, \"Bgolor not valid: #{bgcolor} : #{ColorMap.colors} \" if !ColorMap.is_color? bgcolor\n acolor = ColorMap.get_color(color, bgcolor)\n return acolor\n end",
"def get_color(color) # :nodoc:\n # Convert a HTML style #RRGGBB color.\n if color and color =~ /^#[0-9a-fA-F]{6}$/\n color = color.sub(/^#/, '')\n return color.upcase\n end\n\n index = Format.get_color(color)\n\n # Set undefined colors to black.\n unless index\n index = 0x08\n raise \"Unknown color '#{color}' used in chart formatting.\"\n end\n\n get_palette_color(index)\n end",
"def foreground?\n !!self.foreground\n end",
"def rgb(red, green, blue, background = false)\n case @mode\n when 8\n \"#{background ? 4 : 3}#{rgb_to_ansi(red, green, blue, false)}\"\n when 16\n \"#{background ? 4 : 3}#{rgb_to_ansi(red, green, blue, true)}\"\n when 256\n \"#{background ? 48 : 38}#{rgb_to_256(red, green, blue)}\"\n when TRUE_COLOR\n \"#{background ? 48 : 38}#{rgb_true(red, green, blue)}\"\n end\n end",
"def hex_color\n return @hex_color\n end",
"def foreground\n server.remote_expr(\"foreground()\")\n end",
"def default_color\n return translate_color(current_layout.default_color)\n end",
"def color\n @attributes[:color]\n end",
"def foreground(*values); end",
"def foreground(*values); end",
"def get_color_code\n\t\t{ r: @term_hex[0], g: @term_hex[1], b: @term_hex[2], alpha: @term_hex[-1] }\n\tend",
"def background_color\n return @peer.background_color\n end",
"def _color\n\t\tcolor = Color.where(:inki_model_name => self.class.to_s, :model_id => self.id).first\n\t\tif color\n\t\t\tcolor.rgb_id\n\t\tend\n\tend",
"def _context_set_bgcolor!(rgb)\n $gimp_iface.gimp_context_set_background(rgb)\nend",
"def semantic_color()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.DeltaComponentState_semantic_color(@handle.ptr)\n result\n end",
"def receipt_bgcolor\n get_attribute(Yoti::Attribute::APPLICATION_RECEIPT_BGCOLOR)\n end",
"def rgb(red, green, blue, background = false)\n if mode == 8 || mode == 16\n \"#{background ? 4 : 3}#{rgb_like_value(red, green, blue, mode == 16)}\"\n else\n \"#{background ? 48 : 38}#{rgb_value(red, green, blue)}\"\n end\n end",
"def color_provider\n attributes.fetch(:colorProvider)\n end",
"def green\n ((hex_color & GREEN) >> 8) / MAX_RGB_VALUE * 100\n end",
"def color\n @data[:color]\n end",
"def ListView_GetTextBkColor(hwnd) send_listview_message(hwnd, :GETTEXTBKCOLOR) end",
"def ball_color\n return GameData::Item[@captured_with].ball_data&.color || Color.new(0, 0, 0)\n end",
"def get_hotel_color(hotel)\n HOTEL_COLORS[hotel]\n end",
"def get_color\n completed? ? 'info' : 'warning'\n end",
"def back_color2\n Color.new(0, 0, 0, 0)\n end",
"def back_color2\n Color.new(0, 0, 0, 0)\n end",
"def rgb_like_value(red, green, blue, use_bright = false)\n color_pool = RGB_COLORS_ANSI.values\n color_pool += RGB_COLORS_ANSI_BRIGHT.values if use_bright\n\n ansi_color_rgb = color_pool.min_by{ |col| distance([red, green, blue],col) }\n key_method = RUBY_VERSION < \"1.9\" ? :index : :key\n if ansi_color = RGB_COLORS_ANSI.send(key_method, ansi_color_rgb)\n ANSI_COLORS[ansi_color]\n else\n ansi_color = RGB_COLORS_ANSI_BRIGHT.send(key_method, ansi_color_rgb)\n \"#{ANSI_COLORS[ansi_color]};1\"\n end\n end",
"def colour\n @colour ||= Colour.new(attributes[:colour])\n end",
"def colorize txt, fg, bg, flags\n fgc = (fg.nil? || Color === fg ) ? fg : Color.parse(fg)\n bgc = (bg.nil? || Color === bg) ? bg : Color.parse(bg)\n esc = []\n esc << '01' if flags[:b]\n esc << '03' if flags[:i]\n esc << '04' if flags[:u]\n esc << '07' if flags[:r]\n esc << \"38;05;#{fgc.xterm256}\" if fgc\n esc << \"48;05;#{bgc.xterm256}\" if bgc\n \n esc.empty? ? txt : \"\\e[#{esc.join(';')}m#{txt}\\e[0m\" \n end",
"def GetColorFromEvaluation(evaluation)\n\t\tevaluation = evaluation.downcase\n\t\tcase evaluation\n\t\twhen \"pass\"\n\t\t\treturn \"5cb85c\"\n\t\twhen \"fail\"\n\t\t\treturn \"d9534f\"\n\t\twhen \"other\"\n\t\t\treturn \"800080\"\n\t\telse\n\t\t\treturn \"5bc0de\"\n\t\tend\n\tend",
"def display_color\n if @deleted\n return '#FF0000' # Red\n elsif !@enabled\n return '#AAAAAA' # Gray\n end\n \n '#000000'\n end",
"def background_color\n return @background_color\n end",
"def back_color1\n Color.new(0, 0, 0, 192)\n end",
"def color_top\n @attributes[:color_top]\n end",
"def last_color_output\n return @output_array[-2]\n end",
"def last_color_output\n return @output_array[-2]\n end"
] |
[
"0.7346399",
"0.6942602",
"0.69361687",
"0.69330835",
"0.6913224",
"0.66612613",
"0.6584758",
"0.62667686",
"0.6253607",
"0.62124634",
"0.61855555",
"0.61113816",
"0.60780895",
"0.6024602",
"0.5978909",
"0.5978909",
"0.58511955",
"0.58346057",
"0.582379",
"0.5733057",
"0.57024395",
"0.5700593",
"0.56926197",
"0.56898713",
"0.568688",
"0.5652392",
"0.5652392",
"0.5617925",
"0.56160986",
"0.56113964",
"0.55777717",
"0.5549979",
"0.5542809",
"0.55274427",
"0.5488851",
"0.5472534",
"0.54147214",
"0.54141015",
"0.54141015",
"0.5395906",
"0.5382085",
"0.53640616",
"0.5354093",
"0.5347762",
"0.5346593",
"0.53462476",
"0.5342404",
"0.53373593",
"0.53257805",
"0.5322091",
"0.5310479",
"0.5297012",
"0.5289487",
"0.5281842",
"0.52642703",
"0.5259637",
"0.5259084",
"0.5259084",
"0.5240519",
"0.5236571",
"0.52330685",
"0.52239496",
"0.5220041",
"0.5210686",
"0.52062505",
"0.5203536",
"0.5194962",
"0.5193508",
"0.5191741",
"0.51768273",
"0.5164486",
"0.5146252",
"0.51432663",
"0.51432663",
"0.51361936",
"0.5124609",
"0.510679",
"0.50969726",
"0.5089218",
"0.50856566",
"0.50818014",
"0.5068962",
"0.50525224",
"0.50489986",
"0.5048976",
"0.50488824",
"0.5048771",
"0.50353587",
"0.50318277",
"0.50318277",
"0.50231373",
"0.50217116",
"0.5021152",
"0.5018354",
"0.5018121",
"0.5011181",
"0.5003537",
"0.5002079",
"0.49966952",
"0.49966952"
] |
0.82968277
|
0
|
context_set_bgcolor: sets the background color to rgb. This does not change the color of existing images, but new images will be initialized with a layer filled with the background color
|
def _context_set_bgcolor!(rgb)
$gimp_iface.gimp_context_set_background(rgb)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def draw_background\n\t\tcolor = self.colour_scheme.background\t\n\t\t@canvas.new_image(@canvas_width, @canvas_height) { self.background_color = color }\n\tend",
"def change_bg_color(color)\n @bg_color = color\n self.bitmap.fill_rect(self.bitmap.rect,color)\n end",
"def setBackground(r,g,b,a)\n super(r,g,b,a) if @image == nil\n @imageAlignment.override_background_color(:normal,Gdk::RGBA.new(r,g,b,a))\n self\n end",
"def setBackground\r\n r = g = b = a = 0.0\r\n case $background\r\n when 0\r\n r = g = b = 0.0\r\n when 1\r\n r = g = b = 1.0\r\n when 2\r\n r = 0.1\r\n g = 0.3\r\n b = 0.6\r\n when 3\r\n r = g = b = 0.5\r\n else\r\n r = g = b = 0.0\r\n end\r\n a = 1.0\r\n glClearColor(r,g,b,a)\r\nend",
"def background_color(color); end",
"def background_color=(value)\n @background_color = value\n end",
"def solid_background(columns, rows, color)\n Magick::Image.new(columns, rows) do |img|\n img.background_color = color\n end\n end",
"def setCanvasBackgroundColor(color)\n unless /^[0-9a-fA-F]{6,8}$/.match(color)\n raise Error.new(Pdfcrowd.create_invalid_value_message(color, \"setCanvasBackgroundColor\", \"image-to-image\", \"The value must be in RRGGBB or RRGGBBAA hexadecimal format.\", \"set_canvas_background_color\"), 470);\n end\n \n @fields['canvas_background_color'] = color\n self\n end",
"def bgcolor\n @bgcolor || $def_bg_color\n end",
"def setBackgroundColor(color)\n unless /^[0-9a-fA-F]{6,8}$/.match(color)\n raise Error.new(Pdfcrowd.create_invalid_value_message(color, \"setBackgroundColor\", \"html-to-image\", \"The value must be in RRGGBB or RRGGBBAA hexadecimal format.\", \"set_background_color\"), 470);\n end\n \n @fields['background_color'] = color\n self\n end",
"def background(r=1, g=1, b=1, a=1.0)\n case r\n when Color\n g = r.g\n b = r.b\n a = r.a\n r = r.r\n end\n push\n CGContextSetRGBFillColor(@ctx, r, g, b, a) # RGBA\n rect(0,0,@width,@height)\n pop\n end",
"def render_gradiated_background(top_color='#4a465a', bottom_color='black')\n Image.new(@columns, @rows, GradientFill.new(0, 0, 100, 0, top_color, bottom_color))\n end",
"def background(bgcolor)\n names_to_code(\"on_\" + bgcolor)\n end",
"def mix_background element, opt, ctx\n\n # Background color of the image, if populated.\n bgcolor = detect_bgcolor(opt)\n\n # Set the background color if the element has one.\n element.style[BACKGROUND_COLOR] = bgcolor if bgcolor\n\n # Automatically include background gradient support when\n # mixing in background color.\n mix_background_gradient element, opt, ctx\n\n end",
"def background_color\n @background_color ||= [0, 0, 0]\n end",
"def backgroundColor=(color)\n self.layer.backgroundColor = case color.is_a?(UIColor)\n when true ; color.CGColor\n else ; color\n end\n end",
"def paint_background(options = HashWithIndifferentAccess.new)\n options.reverse_merge! theme[:background] if theme[:background]\n if options\n if image = options[:image]\n image = Textures::Texture.new(engine.find_file(image)).send(:image)#engine.image(options[:image]).image_list\n if options[:mode] == :tile or options[:mode].nil?\n graphics_context.composite_tiled!(image, OverCompositeOp)#AtopCompositeOp)\n else #scale\n image.resize!(width, height)\n graphics_context.composite!(image, 0, 0, OverCompositeOp)#AtopCompositeOp)\n end\n end\n if arr = options[:effect] || options[:effects]\n paint_effects! graphics_context, arr\n end\n end\n end",
"def bgcolor( *val )\n if val.empty?\n return @bgcolor if @bgcolor\n return @form.bgcolor if @form\n return $def_bg_color\n else\n @color_pair = nil\n return property_set :bgcolor, val\n end\n end",
"def backgroundcolor\n colors = {\n \"#E50914\" => \"#282581\", \"#FF0000\" => \"#0A0D44\", \"#00FF8F\" => \"#0A00A4\", \"#FFF300\" => \"#E80000\", \"#00E8C5\" => \"#5A009C\", \"#FF9E00\" => \"#5A009C\", \"#FFEC00\" => \"#FF00A6\", \"#51FF00\" => \"#7400BF\"}\n color1, color2 = colors.to_a.sample\n session[:color1] = color1\n session[:color2] = color2\n end",
"def draw_bitmap_bg\n self.bitmap.gradient_fill_rect(padding, padding, base_width,\n base_height, color1, color2)\n self.bitmap.blur\n self.bitmap.blur\n end",
"def draw_bitmap_bg\n self.bitmap.gradient_fill_rect(padding, padding, base_width,\n base_height, color1, color2)\n self.bitmap.blur\n self.bitmap.blur\n end",
"def ctrlSetBackgroundColor _obj, _args\n \"_obj ctrlSetBackgroundColor _args;\" \n end",
"def _context_set_fgcolor!(rgb)\n $gimp_iface.gimp_context_set_foreground(rgb)\nend",
"def create_background_bitmap\n @background.bitmap = Bitmap.new(@width, @height)\n @background.bitmap.fill_rect(0, 0, @width, @height, BORDER_COLOR)\n @background.bitmap.fill_rect(1, 1, @width - 2, @height - 2, BACK_COLOR)\n end",
"def background=(value)\n @background = Vedeu::Colours::Background.coerce(value)\n end",
"def context_get_bgcolor()\n return $gimp_iface.gimp_context_get_background()[0]\nend",
"def draw_background\n @background.draw\n end",
"def backgroundColor\n self.layer.backgroundColor\n end",
"def update!(**args)\n @background_color = args[:background_color] if args.key?(:background_color)\n @foreground_color = args[:foreground_color] if args.key?(:foreground_color)\n @solo_color = args[:solo_color] if args.key?(:solo_color)\n end",
"def setup\n super\n @background_colour = @colour\n @foreground_colour = Palette.white\n end",
"def setBackground(r,g,b,a)\n @textBox.override_background_color(:normal,Gdk::RGBA.new(r,g,b,a))\n self\n end",
"def background_color=(value)\n @peer.background_color = value.to_s\n end",
"def render_background\n case @theme_options[:background_colors]\n when Array\n @base_image = render_gradiated_background(*@theme_options[:background_colors])\n when String\n @base_image = render_solid_background(@theme_options[:background_colors])\n else\n @base_image = render_image_background(*@theme_options[:background_image])\n end\n end",
"def bgcolor!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 30 )\n\n type = BGCOLOR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 360:10: 'bgcolor'\n match( \"bgcolor\" )\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__, 30 )\n\n end",
"def set_background_color(name, slide_index, color, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = set_background_color_with_http_info(name, slide_index, color, password, folder, storage)\n data\n end",
"def make_bg(bg_size = nil)\n begin\n img = Magick::Image.from_blob(resize_thumb(bg_size))[0]\n img.quantize.colorize(COLORIZE_LEVEL, COLORIZE_LEVEL, COLORIZE_LEVEL, '#d2f0ff').to_blob\n ensure\n GC.start\n end\n end",
"def set_colors(fg, bg)\n cp = RubyText::Color.pair(fg, bg)\n @cwin.color_set(cp)\n end",
"def background_fill\n @background_fill ||= begin\n digest = \"0.#{Digest::MD5.hexdigest(@name).to_i(16).to_s}\".to_f\n index = (digest * (@background_colors.length - 1)).round\n @background_colors[index]\n end\n end",
"def background(color=nil)\n @options[:background] = color unless color.nil?\n @options[:background]\n end",
"def set_Background(value)\n set_input(\"Background\", value)\n end",
"def background_colour\n @cr[0xf] >> 4\n end",
"def setBackGround(o)\n if useHighLightOnCurrentElement\n begin \n @currentObjectBackGroundColor = o.style.backgroundColor\n #puts \"Current Back ground color is: #{@currentObjectBackGroundColor}\"\n @backGroundObject = o\n @backGroundObject.style.backgroundColor = \"red\"\n rescue\n\n end\n end\n end",
"def switch_background(color)\n color == [248,250,210] ? [215,188,149] : [248,250,210]\n end",
"def background(image)\n\t\tself.add(Background.new(image), self)\n\tend",
"def setcolorrep(*)\n super\n end",
"def titlebackground(bg)\n @f_title_pad['background'] = bg\n @title_list.each{|label| label['background'] = bg}\n self\n end",
"def setBackground(backgroundImageURL)\n if backgroundImageURL != nil\n @backgroundImage = backgroundImageURL\n self.backgroundColor = UIColor.colorWithPatternImage(UIImage.imageNamed(backgroundImageURL))\n else\n @backgroundImage = nil\n end\n end",
"def custom_background\n css = \"\"\n css += \"background-color: #{self.background_color};\" unless self.background_color.blank?\n if self.background_image_file_name.blank?\n css += \"background-image: none; \"\n else\n css += \"background-image: url('#{self.background_image.url(\"original\", false)}'); \"\n css += \"background-position: center top; \"\n css += \"background-repeat: repeat-y; \"\n end\n css\n end",
"def reset_background(colors, moves)\n moves.each do |move|\n (0..7).each do |row|\n (0..7).each do |col|\n @display[row][col].background = colors.shift if move == [row, col]\n end\n end\n end\n end",
"def setPageBackgroundColor(color)\n unless /^[0-9a-fA-F]{6,8}$/.match(color)\n raise Error.new(Pdfcrowd.create_invalid_value_message(color, \"setPageBackgroundColor\", \"image-to-pdf\", \"The value must be in RRGGBB or RRGGBBAA hexadecimal format.\", \"set_page_background_color\"), 470);\n end\n \n @fields['page_background_color'] = color\n self\n end",
"def draw_background\n options = translate( x: offsets.left, y: offsets.top ).merge( width: width, height: height, foreground: foreground, background: background )\n \n pencil.draw_rectangle( options )\n end",
"def bg_color=(v)\n DataTypeValidator.validate(:color, Color, Color.new(rgb: v))\n @bg_color = v\n end",
"def create_other_background\n @background = Sprite.new\n @background.bitmap = Cache.picture(BACKGROUND_PICTURE)\n @background.opacity = BACKGROUND_OPACITY\n @background.z = 10\n end",
"def render_background\n render_unvisited\n render_grid_lines\n end",
"def bgColor\n return @bg_color\n end",
"def render_background\n render_unvisited\n render_grid_lines\n render_labels\n end",
"def update!(**args)\n @background_color = args[:background_color] if args.key?(:background_color)\n @description = args[:description] if args.key?(:description)\n end",
"def background_color\n return @background_color\n end",
"def set_background\n @background = Background.find(params[:id])\n end",
"def no_bg_color\n reset_prev_formatting self, :bg_color\n end",
"def draw_background(windowskin)\r\n self.contents.clear\r\n bitmap = RPGCache.windowskin(windowskin)\r\n self.contents.blt(0, 0, bitmap, bitmap.rect)\r\n end",
"def change_quest_background(picture, opacity = $game_system.quest_bg_opacity,\n blend_type = $game_system.quest_bg_blend_type)\n $game_system.quest_bg_picture = picture\n $game_system.quest_bg_opacity = opacity\n $game_system.quest_bg_blend_type = blend_type\n end",
"def update!(**args)\n @background_attachment = args[:background_attachment] if args.key?(:background_attachment)\n @background_color_argb = args[:background_color_argb] if args.key?(:background_color_argb)\n @background_gradient_color_stop_argb = args[:background_gradient_color_stop_argb] if args.key?(:background_gradient_color_stop_argb)\n @background_gradient_repeat = args[:background_gradient_repeat] if args.key?(:background_gradient_repeat)\n @background_gradient_type = args[:background_gradient_type] if args.key?(:background_gradient_type)\n @background_image_repeat = args[:background_image_repeat] if args.key?(:background_image_repeat)\n @background_image_url = args[:background_image_url] if args.key?(:background_image_url)\n @background_image_x_pos = args[:background_image_x_pos] if args.key?(:background_image_x_pos)\n @background_image_y_pos = args[:background_image_y_pos] if args.key?(:background_image_y_pos)\n @background_size = args[:background_size] if args.key?(:background_size)\n @background_size_height = args[:background_size_height] if args.key?(:background_size_height)\n @background_size_width = args[:background_size_width] if args.key?(:background_size_width)\n @border_color_argb_bottom = args[:border_color_argb_bottom] if args.key?(:border_color_argb_bottom)\n @border_color_argb_left = args[:border_color_argb_left] if args.key?(:border_color_argb_left)\n @border_color_argb_right = args[:border_color_argb_right] if args.key?(:border_color_argb_right)\n @border_color_argb_top = args[:border_color_argb_top] if args.key?(:border_color_argb_top)\n @border_pixel_width_bottom = args[:border_pixel_width_bottom] if args.key?(:border_pixel_width_bottom)\n @border_pixel_width_left = args[:border_pixel_width_left] if args.key?(:border_pixel_width_left)\n @border_pixel_width_right = args[:border_pixel_width_right] if args.key?(:border_pixel_width_right)\n @border_pixel_width_top = args[:border_pixel_width_top] if args.key?(:border_pixel_width_top)\n @border_style_bottom = args[:border_style_bottom] if args.key?(:border_style_bottom)\n @border_style_left = args[:border_style_left] if args.key?(:border_style_left)\n @border_style_right = args[:border_style_right] if args.key?(:border_style_right)\n @border_style_top = args[:border_style_top] if args.key?(:border_style_top)\n @clip = args[:clip] if args.key?(:clip)\n @direction = args[:direction] if args.key?(:direction)\n @display_prop = args[:display_prop] if args.key?(:display_prop)\n @font_family = args[:font_family] if args.key?(:font_family)\n @font_size = args[:font_size] if args.key?(:font_size)\n @font_style = args[:font_style] if args.key?(:font_style)\n @font_weight = args[:font_weight] if args.key?(:font_weight)\n @foreground_color_argb = args[:foreground_color_argb] if args.key?(:foreground_color_argb)\n @has_background = args[:has_background] if args.key?(:has_background)\n @list_style_image_url = args[:list_style_image_url] if args.key?(:list_style_image_url)\n @list_style_type = args[:list_style_type] if args.key?(:list_style_type)\n @margin_bottom = args[:margin_bottom] if args.key?(:margin_bottom)\n @margin_left = args[:margin_left] if args.key?(:margin_left)\n @margin_right = args[:margin_right] if args.key?(:margin_right)\n @margin_top = args[:margin_top] if args.key?(:margin_top)\n @opacity = args[:opacity] if args.key?(:opacity)\n @overflow_x = args[:overflow_x] if args.key?(:overflow_x)\n @overflow_y = args[:overflow_y] if args.key?(:overflow_y)\n @padding_bottom = args[:padding_bottom] if args.key?(:padding_bottom)\n @padding_left = args[:padding_left] if args.key?(:padding_left)\n @padding_right = args[:padding_right] if args.key?(:padding_right)\n @padding_top = args[:padding_top] if args.key?(:padding_top)\n @position = args[:position] if args.key?(:position)\n @referenced_resource_index = args[:referenced_resource_index] if args.key?(:referenced_resource_index)\n @text_align = args[:text_align] if args.key?(:text_align)\n @text_decoration = args[:text_decoration] if args.key?(:text_decoration)\n @text_shadow_color_argb = args[:text_shadow_color_argb] if args.key?(:text_shadow_color_argb)\n @visibility = args[:visibility] if args.key?(:visibility)\n @z_index = args[:z_index] if args.key?(:z_index)\n end",
"def set_background\n @background = Background.find(params[:id])\n end",
"def set_background\n @background = Background.find(params[:id])\n end",
"def visit_background(background)\n tc_before_background(background)\n super\n tc_after_background(background)\n end",
"def draw_background\n\t\tGosu::draw_rect(@x,\n\t\t\t\t\t\t@y, \n\t\t\t\t\t\t@bg_width,\n\t\t\t\t\t\t@bg_height, \n\t\t\t\t\t\t@background_colour,\n\t\t\t\t\t\t@z)\n\tend",
"def updateBackground\n\t\tdrawMap()\n\tend",
"def background_color(color)\n self.class.color_codes[color] + 40 if self.class.color_codes[color]\n end",
"def background_color(color)\n self.class.color_codes[color] + 40 if self.class.color_codes[color]\n end",
"def background_bitmap\n bitmap = Bitmap.new(@width, @spr_h)\n bitmap.fill_rect(0, 0, bitmap.width, bitmap.height, Color::BLACK)\n bitmap\n end",
"def content_colors fg, bg\n @color = fg\n @bgcolor = bg\n @color_pair = get_color($datacolor, fg, bg)\n end",
"def draw_background\n Gosu.draw_rect(0, 0, 1000, 700, @background, ZOrder::BACKGROUND, mode=:default)\n\tend",
"def includeBackground=(value)\n\t\t\t@includeBackground = value\n\t\tend",
"def create_background\n add_disposable @background = UI::BlurScreenshot.new(@__last_scene)\n @background.opacity -= 255 / ENTERING_ANIMATION_DURATION * ENTERING_ANIMATION_DURATION\n end",
"def set_background_color(color)\n color = Wasko::Color.color_from_string(color)\n advanced_typing_apparatus.set_background_color(color.to_applescript)\n end",
"def lbSetColor _obj, _args\n \"_obj lbSetColor _args;\" \n end",
"def draw_background\n draw_quad( 0, 0, TOP_COLOR,\n @width, 0, TOP_COLOR,\n 0, @height, BOTTOM_COLOR,\n @width, @height, BOTTOM_COLOR,\n -1 )\n end",
"def set_bg\n STDOUT.write \"\\033[48;5;#{to_xterm}m\"\n end",
"def create_background\n @background = ShaderedSprite.new(@viewport).set_bitmap(name = background_name, :battleback)\n @grounds = Array.new(@battle_scene.logic.bank_count) do |bank|\n BattleUI::GroundSprite.new(@viewport, name, bank)\n end\n end",
"def foreground_fill\n red = background_fill[1..2].to_i(16)\n green = background_fill[3..4].to_i(16)\n blue = background_fill[5..6].to_i(16)\n (red * 0.299 + green * 0.587 + blue * 0.114) > 186 ? '#000000' : '#FFFFFF'\n end",
"def test_has_transparent_foreground_on_bright_green_background\n Waveform.generate(fixture_asset(\"sample.wav\"), output(\"background_color-#00ff00+color-transparent.png\"), :background_color => \"#00ff00\", :color => :transparent)\n\n image = open_png(output(\"background_color-#00ff00+color-transparent.png\"))\n\n assert_equal ChunkyPNG::Color.from_hex(\"#00ff00\"), image[0, 0]\n assert_equal ChunkyPNG::Color::TRANSPARENT, image[60, 120]\n end",
"def updateBackground\n\t\tif @redraw\n\t\t\t@map.updateBackground\n\t\t\t@map.sprites.each { |sprite|\n\t\t\t\tsprite.draw(@screen)\n\t\t\t}\n\t\t\t@boxPriority.each { |box|\n\t\t\t\tbox.draw\n\t\t\t}\n\t\t\t@redraw = false\n\t\tend\n\tend",
"def changeBackground(image)\n\t\t@mainGrid.remove(@background)\n\t\t@background = Gtk::Image.new(file: File.dirname(__FILE__) + \"/../Assets/\"+@assets.resolution+\"/\"+@assets.language+\"/Menus/\"+image+\".png\")\n\t\t@mainGrid.attach(@background,0,1,0,1)\n\t\tshow_all\n\tend",
"def add_bg_color(str, color)\n color = color.to_s.sub(\"bg_\", \"\").to_sym\n str = reset_prev_formatting str, :bg_color\n \"\\e[#{TC_CONFIG[:bg_colors][color].to_s}m#{str}\"\n end",
"def draw_background\r\n Gosu.draw_rect 0, 0, self.width, self.height, Gosu::Color::BLACK\r\n end",
"def update!(**args)\n @background_color = args[:background_color] if args.key?(:background_color)\n @header_theme = args[:header_theme] if args.key?(:header_theme)\n @landscape_background_image_url = args[:landscape_background_image_url] if args.key?(:landscape_background_image_url)\n @logo_url = args[:logo_url] if args.key?(:logo_url)\n @mask_color = args[:mask_color] if args.key?(:mask_color)\n @portrait_background_image_url = args[:portrait_background_image_url] if args.key?(:portrait_background_image_url)\n @primary_color = args[:primary_color] if args.key?(:primary_color)\n end",
"def setfillcolorind(*)\n super\n end",
"def obtain_main_image_colors\n pic = ImageList.new(@main_image.source)\n pic.resize!(0.20)\n #Reducing picture colors\n pic = pic.quantize(5, Magick::RGBColorspace, 0, 0, false) \n #By modulating them we get better colors\n pic = pic.modulate(1.2, 1.8, 1.0) #L S H\n #Background color will be the most used color in the picture\n color_pixels = pic.color_histogram\n \n max=0\n background_px = 0\n \n color_pixels.each do |k,v|\n if v >max\n max=v\n background_px = k\n end\n end \n \n @image_colors << Colour.new(background_px.red, background_px.green, background_px.blue) #image_colors[0] is the background\n \n color_pixels.each do |k,v|\n hsl = k.to_hsla\n if hsl[2]>=35 and hsl[2]<=75\n @image_colors << Colour.new(k.red, k.green, k.blue)\n end\n end\n \n puts '......'\n puts @image_colors[0].red\n puts @image_colors[0].green\n puts @image_colors[0].blue\n \n @image_colors[1] = @image_colors[1]==nil ? @image_colors[0] : @image_colors[1]\n @image_colors[2] = @image_colors[2]==nil ? @image_colors[0] : @image_colors[2]\n\n end",
"def setPageBackgroundColor(color)\n unless /^[0-9a-fA-F]{6,8}$/.match(color)\n raise Error.new(Pdfcrowd.create_invalid_value_message(color, \"setPageBackgroundColor\", \"html-to-pdf\", \"The value must be in RRGGBB or RRGGBBAA hexadecimal format.\", \"set_page_background_color\"), 470);\n end\n \n @fields['page_background_color'] = color\n self\n end",
"def render_transparent_background(columns, rows)\n Magick::Image.new(columns, rows) do |img|\n img.background_color = 'transparent'\n end\n end",
"def color_reset!(fill)\n save = background_color\n # Change the background color _outside_ the begin block\n # so that if this object is frozen the exeception will be\n # raised before we have to handle it explicitly.\n self.background_color = fill\n begin\n erase!\n ensure\n self.background_color = save\n end\n self\n end",
"def set_default_background_color_override(color: nil)\n {\n method: \"Emulation.setDefaultBackgroundColorOverride\",\n params: { color: color }.compact\n }\n end",
"def create_background\n @background = Sprite.new\n @background.bitmap = SceneManager.background_bitmap\n end",
"def draw_background\n Gosu.draw_rect(0, 0, 600, 800, @background, ZOrder::BACKGROUND, mode=:default)\n Gosu.draw_rect(40, 40, 510, 710, @player, ZOrder::PLAYER, mode=:default)\n #Gosu.draw_rect(40, 370, 200, 700, @u_background, ZOrder::U_BACKGROUND, mode=:default)\n display_track(@album.tracks[@present_track].name.chomp+ \" from album \" + @album.title)\n draw_albums()\n draw_buttons()\n\tend",
"def show\n @bg_gray = true\n\n end",
"def background; end",
"def update_background\n @background.x, @background.y, @background.z = 0,0,self.z - 1 #self.x, self.y, self.z - 1\n end",
"def ctrlSetForegroundColor _obj, _args\n \"_obj ctrlSetForegroundColor _args;\" \n end",
"def rgb_code(red, green, blue, background = T.unsafe(nil)); end"
] |
[
"0.69413316",
"0.69022894",
"0.68575335",
"0.6821368",
"0.6630635",
"0.6433094",
"0.6346172",
"0.6333049",
"0.623851",
"0.6236334",
"0.6205428",
"0.6161943",
"0.61124456",
"0.6087063",
"0.6041322",
"0.5976113",
"0.59546477",
"0.59286004",
"0.58972466",
"0.58885115",
"0.58885115",
"0.5888192",
"0.5879101",
"0.5878893",
"0.58694166",
"0.58632565",
"0.58384305",
"0.5822027",
"0.5813827",
"0.58134663",
"0.57956177",
"0.578789",
"0.57878447",
"0.5764924",
"0.5740496",
"0.5723911",
"0.56821007",
"0.5652152",
"0.5643006",
"0.5636963",
"0.5627834",
"0.56255007",
"0.56152356",
"0.5608671",
"0.5576649",
"0.55745703",
"0.5573974",
"0.55551803",
"0.55531895",
"0.5543861",
"0.5526376",
"0.5514166",
"0.5506758",
"0.55055404",
"0.5471953",
"0.5457073",
"0.54399633",
"0.54396623",
"0.54332215",
"0.5411502",
"0.54028267",
"0.5399429",
"0.5392159",
"0.537993",
"0.537993",
"0.5379341",
"0.53772795",
"0.533989",
"0.532886",
"0.532886",
"0.53183824",
"0.5310928",
"0.5304201",
"0.5301613",
"0.5293317",
"0.52839047",
"0.5268194",
"0.526676",
"0.5260432",
"0.5238033",
"0.5219553",
"0.5217688",
"0.52083266",
"0.52074623",
"0.51970065",
"0.5196109",
"0.51827055",
"0.51808304",
"0.5175465",
"0.5171493",
"0.51692367",
"0.51637304",
"0.5147914",
"0.51352817",
"0.5130517",
"0.5118163",
"0.50941485",
"0.5085009",
"0.5082343",
"0.50806475"
] |
0.77112925
|
0
|
context_set_fgcolor: sets the foreground color to rgb. This is the color that is used to fill selections and draw with gimp tools
|
def _context_set_fgcolor!(rgb)
$gimp_iface.gimp_context_set_foreground(rgb)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def _context_set_bgcolor!(rgb)\n $gimp_iface.gimp_context_set_background(rgb)\nend",
"def context_get_fgcolor()\n return $gimp_iface.gimp_context_get_foreground()[0]\nend",
"def set_colors(fg, bg)\n cp = RubyText::Color.pair(fg, bg)\n @cwin.color_set(cp)\n end",
"def foreground=(value)\n @foreground = Vedeu::Colours::Foreground.coerce(value)\n end",
"def foreground(color=nil)\n @options[:foreground] = color unless color.nil?\n @options[:foreground]\n end",
"def on_49(_) { fg: fg_color(9) } end",
"def color\n @color || $def_fg_color\n end",
"def set_fg\n STDOUT.write \"\\033[38;5;#{to_xterm}m\"\n end",
"def foreground_fill\n red = background_fill[1..2].to_i(16)\n green = background_fill[3..4].to_i(16)\n blue = background_fill[5..6].to_i(16)\n (red * 0.299 + green * 0.587 + blue * 0.114) > 186 ? '#000000' : '#FFFFFF'\n end",
"def fg(c)\n return self unless ANSI_COLORS[c]\n return colorize(ANSI_COLORS[c])\n end",
"def colorize!(fg, bg)\n set_colors(fg, bg)\n num = @cwin.maxx * @cwin.maxy\n self.home\n self.go(0, 0) { @cwin.addstr(' '*num) }\n @cwin.refresh\n end",
"def foreground(fgcolor)\n fgcolor.split(/\\s+/).collect { |fg| names_to_code(fg) }.join(\"\")\n end",
"def context_get_bgcolor()\n return $gimp_iface.gimp_context_get_background()[0]\nend",
"def color( *val )\n if val.empty?\n return @color if @color\n return @form.color if @form\n return $def_fg_color\n else\n @color_pair = nil\n return property_set :color, val\n end\n end",
"def setDrawColorViaRGB(r, g, b)\n while r > 255\n r -= 255\n end\n while g > 255\n g -= 255\n end\n while b > 255\n b -= 255\n end\n puts(\"draw color set to RGB values: (\" + r.to_s + \", \" + g.to_s + \", \" + b.to_s + \")\")\n @drawColor = FXRGB(r, g, b)\n end",
"def ctrlSetForegroundColor _obj, _args\n \"_obj ctrlSetForegroundColor _args;\" \n end",
"def foreground(*values); end",
"def foreground(*values); end",
"def set_bg\n STDOUT.write \"\\033[48;5;#{to_xterm}m\"\n end",
"def color(color_code)\n colors = color_code.scan(/\\d+/)\n\n # Extended set foreground x-term color\n if colors[0] == \"38\" && colors[1] == \"5\"\n return @fg_color = \"term-fgx#{colors[2]}\"\n end\n\n # Extended set background x-term color\n if colors[0] == \"48\" && colors[1] == \"5\"\n return @bg_color = \"term-bgx#{colors[2]}\"\n end\n\n # If multiple colors are defined, i.e. \\e[30;42m\\e then loop through each\n # one, and assign it to @fg_color or @bg_color\n colors.each do |cc|\n c_integer = cc.to_i\n\n # Reset all styles\n if c_integer == 0\n @fg_color = nil\n @bg_color = nil\n @other_colors = []\n\n # Primary (default) font\n elsif c_integer == 10\n # no-op\n\n # Turn off bold / Normal color or intensity (21 & 22 essentially do the same thing)\n elsif c_integer == 21 || c_integer == 22\n @other_colors.delete(\"term-fg1\")\n @other_colors.delete(\"term-fg2\")\n\n # Turn off italic\n elsif c_integer == 23\n @other_colors.delete(\"term-fg3\")\n\n # Turn off underline\n elsif c_integer == 24\n @other_colors.delete(\"term-fg4\")\n\n # Turn off crossed-out\n elsif c_integer == 29\n @other_colors.delete(\"term-fg9\")\n\n # Reset foreground color only\n elsif c_integer == 39\n @fg_color = nil\n\n # Reset background color only\n elsif c_integer == 49\n @bg_color = nil\n\n # 30–37, then it's a foreground color\n elsif c_integer >= 30 && c_integer <= 37\n @fg_color = \"term-fg#{cc}\"\n\n # 40–47, then it's a background color.\n elsif c_integer >= 40 && c_integer <= 47\n @bg_color = \"term-bg#{cc}\"\n\n # 90-97 is like the regular fg color, but high intensity\n elsif c_integer >= 90 && c_integer <= 97\n @fg_color = \"term-fgi#{cc}\"\n\n # 100-107 is like the regular bg color, but high intensity\n elsif c_integer >= 100 && c_integer <= 107\n @fg_color = \"term-bgi#{cc}\"\n\n # 1-9 random other styles\n elsif c_integer >= 1 && c_integer <= 9\n @other_colors << \"term-fg#{cc}\"\n end\n end\n end",
"def colorize txt, fg, bg, flags\n fgc = (fg.nil? || Color === fg ) ? fg : Color.parse(fg)\n bgc = (bg.nil? || Color === bg) ? bg : Color.parse(bg)\n esc = []\n esc << '01' if flags[:b]\n esc << '03' if flags[:i]\n esc << '04' if flags[:u]\n esc << '07' if flags[:r]\n esc << \"38;05;#{fgc.xterm256}\" if fgc\n esc << \"48;05;#{bgc.xterm256}\" if bgc\n \n esc.empty? ? txt : \"\\e[#{esc.join(';')}m#{txt}\\e[0m\" \n end",
"def pencolor args\n is_step\n stroke args\n @fg_color = args\n update_pen_info\n end",
"def colorize(*args)\n shell.set_color(*args)\n end",
"def foreground_color(index)\n \"\\e[38;5;#{index}m\"\nend",
"def set_draw_color_a(color = RFPDF::COLOR_PALETTE[:black])\n SetDrawColor(color[0], color[1], color[2])\n end",
"def titleforeground(fg)\n @title_list.each{|label| label['foreground'] = fg}\n self\n end",
"def chco\n (foreground || \"FFFFFF\") + \",\" + super\n end",
"def content_colors fg, bg\n @color = fg\n @bgcolor = bg\n @color_pair = get_color($datacolor, fg, bg)\n end",
"def update!(**args)\n @background_color = args[:background_color] if args.key?(:background_color)\n @foreground_color = args[:foreground_color] if args.key?(:foreground_color)\n @solo_color = args[:solo_color] if args.key?(:solo_color)\n end",
"def get_fg(str)\n\treturn Color.get_t(\"fg\")[str]\nend",
"def Pager_SetBkColor(hwnd, clr) send_pager_message(hwnd, :SETBKCOLOR, lparam: clr) end",
"def setBackground\r\n r = g = b = a = 0.0\r\n case $background\r\n when 0\r\n r = g = b = 0.0\r\n when 1\r\n r = g = b = 1.0\r\n when 2\r\n r = 0.1\r\n g = 0.3\r\n b = 0.6\r\n when 3\r\n r = g = b = 0.5\r\n else\r\n r = g = b = 0.0\r\n end\r\n a = 1.0\r\n glClearColor(r,g,b,a)\r\nend",
"def recolor(tag, color)\r\n @listarea.tag_configure(tag, 'foreground' => color)\r\n end",
"def TreeView_SetBkColor(hwnd, clr) send_treeview_message(hwnd, :SETBKCOLOR, lparam: clr) end",
"def setup\n super\n @background_colour = @colour\n @foreground_colour = Palette.white\n end",
"def foreground\n instance.options[:foreground]\n end",
"def setDrawColor(color)\n puts(\"draw color set to \" + color)\n @drawColor = color\n end",
"def bgcolor( *val )\n if val.empty?\n return @bgcolor if @bgcolor\n return @form.bgcolor if @form\n return $def_bg_color\n else\n @color_pair = nil\n return property_set :bgcolor, val\n end\n end",
"def SetDrawColor(r, g=-1, b=-1)\n\t\t#Set color for all stroking operations\n\t\tif ((r==0 and g==0 and b==0) or g==-1)\n\t\t\t@draw_color=sprintf('%.3f G', r/255.0);\n\t\telse\n\t\t\t@draw_color=sprintf('%.3f %.3f %.3f RG', r/255.0, g/255.0, b/255.0);\n\t\tend\n\t\tif (@page>0)\n\t\t\tout(@draw_color);\n\t\tend\n\tend",
"def lnbSetColor _args\n \"lnbSetColor _args;\" \n end",
"def colour(values)\n unless values.key?(:foreground) || values.key?(:background)\n fail InvalidSyntax, '#colour expects a Hash containing ' \\\n ':foreground or :background or both.'\n end\n\n attributes[:colour] = values\n end",
"def _context_set_brush!(brush_name)\n $gimp_iface.gimp_context_set_brush(brush_name)\nend",
"def ListView_SetBkColor(hwnd, clrBk) send_listview_message(hwnd, :SETBKCOLOR, lparam: clrBk) end",
"def detect_colour_mode\n case ENV['TERM']\n when /-truecolor$/ then 16_777_216\n when /-256color$/, 'xterm' then 256\n when /-color$/, 'rxvt' then 16\n else 256\n end\n end",
"def detect_colour_mode\n case ENV['TERM']\n when /-truecolor$/ then 16_777_216\n when /-256color$/, 'xterm' then 256\n when /-color$/, 'rxvt' then 16\n else 256\n end\n end",
"def validate_colors\n super\n validate_color(foreground) if foreground\n end",
"def set_colour(user_colour)\n @colour = user_colour\n end",
"def change_bg_color(color)\n @bg_color = color\n self.bitmap.fill_rect(self.bitmap.rect,color)\n end",
"def SetFillColor(r, g=-1, b=-1, storeprev=false)\n\t\t#Set color for all filling operations\n\t\tif ((r==0 and g==0 and b==0) or g==-1)\n\t\t\t@fill_color=sprintf('%.3f g', r/255.0);\n\t\telse\n\t\t\t@fill_color=sprintf('%.3f %.3f %.3f rg', r/255.0, g/255.0, b/255.0);\n\t\tend\n\t\t@color_flag=(@fill_color!=@text_color);\n\t\tif (@page>0)\n\t\t\tout(@fill_color);\n\t\tend\n\t\tif (storeprev)\n\t\t\t# store color as previous value\n\t\t\t@prevfill_color = [r, g, b]\n\t\tend\n\tend",
"def set_rgb_color(font_color)\n self.color = RubyXL::Color.new(:rgb => font_color.to_s)\n end",
"def setDrawColorViaRGBObject(color)\n @drawColor = color\n end",
"def colour(value)\n attributes[:colour] = value\n end",
"def paint(win, color)\r\n win.attron(Curses.color_pair(color))\r\n yield\r\n win.attroff(Curses.color_pair(color))\r\nend",
"def background_colour\n @cr[0xf] >> 4\n end",
"def bgcolor\n @bgcolor || $def_bg_color\n end",
"def create_color_pair(bgcolor, fgcolor)\n code = (bgcolor*10) + fgcolor\n FFI::NCurses.init_pair(code, fgcolor, bgcolor)\n return code\n end",
"def set_colour(r,g,b)\n\t\t@colour_r = LoopedArray.new [*r].map {|i| i % 256}\n\t\t@colour_g = LoopedArray.new [*g].map {|i| i % 256}\n\t\t@colour_b = LoopedArray.new [*b].map {|i| i % 256}\n\tend",
"def colorize(str, foreground)\n if @color\n fore = FOREGROUND[foreground] or raise ArgumentError, \"Unknown foreground color #{foreground.inspect}\"\n \"#{fore}#{str}#{RESET}\"\n else\n str.to_s\n end\n end",
"def colorize canvas, color\n canvas.itemconfigure tag, :fill => color\n rescue => ex\n if ex.message =~ /unknown option \"-fill\"/\n extend CarefulColorize\n colorize canvas, color\n else\n raise\n end\n end",
"def setcolorrep(*)\n super\n end",
"def disable_colorization=(value); end",
"def reset_colors\n @color_output = false\n\n #Term::ANSIColor.coloring = true\n c = Term::ANSIColor\n @color_app_info = c.intense_white + c.bold\n @color_app_exe = c.intense_green + c.bold\n @color_command = c.intense_yellow\n @color_description = c.intense_white\n @color_parameter = c.intense_cyan\n @color_usage = c.intense_black + c.bold\n \n @color_error_word = c.intense_black + c.bold\n @color_error_name = c.intense_red + c.bold\n @color_error_description = c.intense_white + c.bold\n \n @color_bold = c.bold\n @color_reset = c.reset\n end",
"def bg_dark_grey; use_code(100) end",
"def rgb(red, green, blue, background = false)\n case @mode\n when 8\n \"#{background ? 4 : 3}#{rgb_to_ansi(red, green, blue, false)}\"\n when 16\n \"#{background ? 4 : 3}#{rgb_to_ansi(red, green, blue, true)}\"\n when 256\n \"#{background ? 48 : 38}#{rgb_to_256(red, green, blue)}\"\n when TRUE_COLOR\n \"#{background ? 48 : 38}#{rgb_true(red, green, blue)}\"\n end\n end",
"def reset\n # color is enabled by default, can be turned of by switch --no-color\n Term::ANSIColor.coloring = true\n end",
"def determine_color_scheme\n @default_options.color_scheme = @highline.choose do |menu|\n menu.layout = :one_line\n menu.select_by = :name\n menu.header = nil\n menu.prompt = \"What color scheme would you like? \"\n menu.choice(\"none\") { :none }\n menu.choice(\"dark terminal background\") { :dark_bg }\n menu.choice(\"light terminal background\") { :light_bg }\n end\n end",
"def color_reset!(fill)\n save = background_color\n # Change the background color _outside_ the begin block\n # so that if this object is frozen the exeception will be\n # raised before we have to handle it explicitly.\n self.background_color = fill\n begin\n erase!\n ensure\n self.background_color = save\n end\n self\n end",
"def background_color(color); end",
"def reset_use_color\n @use_color = true\n end",
"def set_color(t,tcolor=\"green\",fcolor=\"gray\")\n if t\n tcolor\n else\n fcolor\n end\n end",
"def fcolor(bgcolor = \"#000\", light = \"#fff\", dark = \"#000\")\n bg = bgcolor.gsub(/[^0-9a-f]/i, \"\")\n # convert 3 char to 6 char hex\n bg.gsub!(/./, '\\&\\&') if bg.length == 3\n sum = 0\n [0, 2, 4].each do |i|\n sum += bg[i..i+1].to_i(16)\n end\n return (sum/3 < 128) ? light : dark\n end",
"def getDrawColor()\n return @drawColor\n end",
"def adjust_color(props = {foreground: \"red\", background: \"white\"})\n\tputs \"Foreground: #{props[:foreground]}\" if props[:foreground] ## if key is forground\n\tputs \"Background: #{props[:background]}\" if props[:background]\nend",
"def set(red, green, blue, alpha = nil); end",
"def hsla_color; end",
"def cyan; if @options[:colors]; \"\\e[1;36m\" else \"\" end end",
"def setBackGround(o)\n if useHighLightOnCurrentElement\n begin \n @currentObjectBackGroundColor = o.style.backgroundColor\n #puts \"Current Back ground color is: #{@currentObjectBackGroundColor}\"\n @backGroundObject = o\n @backGroundObject.style.backgroundColor = \"red\"\n rescue\n\n end\n end\n end",
"def ListView_SetTextBkColor(hwnd, clrTextBk) send_listview_message(hwnd, :SETTEXTBKCOLOR, lparam: clrTextBk) end",
"def auxiliary_colour\n @cr[0xe] >> 4\n end",
"def colorize txt, fg, bg, flags\n txt\n end",
"def TreeView_SetTextColor(hwnd, clr) send_treeview_message(hwnd, :SETTEXTCOLOR, lparam: clr) end",
"def color(*options)\n return '' if mode.zero? || options.empty?\n mix = []\n color_seen = false\n colors = ANSI_COLORS_FOREGROUND\n\n options.each{ |option|\n case option\n when Symbol\n if color = colors[option]\n mix << color\n color_seen = :set\n elsif ANSI_EFFECTS.key?(option)\n mix << effect(option)\n elsif option == :random\n mix << random(color_seen)\n color_seen = :set\n else\n raise ArgumentError, \"Unknown color or effect: #{ option }\"\n end\n\n when Array\n if option.size == 3 && option.all?{ |n| n.is_a? Numeric }\n mix << rgb(*(option + [color_seen])) # 1.8 workaround\n color_seen = :set\n else\n raise ArgumentError, \"Array argument must contain 3 numerals\"\n end\n\n when ::String\n if option =~ /^#?(?:[0-9a-f]{3}){1,2}$/i\n mix << hex(option, color_seen)\n color_seen = :set\n else\n mix << rgb_name(option, color_seen)\n color_seen = :set\n end\n\n when Numeric\n integer = option.to_i\n color_seen = :set if (30..49).include?(integer)\n mix << integer\n\n when nil\n color_seen = :set\n\n else\n raise ArgumentError, \"Invalid argument: #{ option.inspect }\"\n\n end\n\n if color_seen == :set\n colors = ANSI_COLORS_BACKGROUND\n color_seen = true\n end\n }\n\n wrap(*mix)\n end",
"def update!(**args)\n @color = args[:color] if args.key?(:color)\n end",
"def blue = \"\\e[36m#{self}\\e[0m\"",
"def bg_color=(v)\n DataTypeValidator.validate(:color, Color, Color.new(rgb: v))\n @bg_color = v\n end",
"def blue=(_); end",
"def reset_color\n \"\\e[#{COLORS[:reset]}m\"\n end",
"def color(options)\n set RGhost::Color.create(options)\n end",
"def std_colors\n FFI::NCurses.use_default_colors\n # 2018-03-17 - changing it to ncurses defaults\n FFI::NCurses.init_pair(0, FFI::NCurses::BLACK, -1)\n FFI::NCurses.init_pair(1, FFI::NCurses::RED, -1)\n FFI::NCurses.init_pair(2, FFI::NCurses::GREEN, -1)\n FFI::NCurses.init_pair(3, FFI::NCurses::YELLOW, -1)\n FFI::NCurses.init_pair(4, FFI::NCurses::BLUE, -1)\n FFI::NCurses.init_pair(5, FFI::NCurses::MAGENTA, -1)\n FFI::NCurses.init_pair(6, FFI::NCurses::CYAN, -1)\n FFI::NCurses.init_pair(7, FFI::NCurses::WHITE, -1)\n # ideally the rest should be done by application\n #FFI::NCurses.init_pair(8, FFI::NCurses::WHITE, -1)\n #FFI::NCurses.init_pair(9, FFI::NCurses::BLUE, -1)\n FFI::NCurses.init_pair(10, FFI::NCurses::BLACK, FFI::NCurses::CYAN)\n FFI::NCurses.init_pair(12, FFI::NCurses::BLACK, FFI::NCurses::BLUE)\n FFI::NCurses.init_pair(13, FFI::NCurses::BLACK, FFI::NCurses::MAGENTA)\n\n FFI::NCurses.init_pair(14, FFI::NCurses::WHITE, FFI::NCurses::CYAN)\n=begin\n FFI::NCurses.init_pair(8, FFI::NCurses::WHITE, FFI::NCurses::BLUE)\n FFI::NCurses.init_pair(9, FFI::NCurses::BLUE, FFI::NCurses::BLUE)\n FFI::NCurses.init_pair(10, FFI::NCurses::BLACK, FFI::NCurses::GREEN)\n FFI::NCurses.init_pair(11, FFI::NCurses::BLACK, FFI::NCurses::YELLOW)\n FFI::NCurses.init_pair(12, FFI::NCurses::BLACK, FFI::NCurses::BLUE)\n FFI::NCurses.init_pair(13, FFI::NCurses::BLACK, FFI::NCurses::MAGENTA)\n FFI::NCurses.init_pair(14, FFI::NCurses::BLACK, FFI::NCurses::CYAN)\n FFI::NCurses.init_pair(15, FFI::NCurses::BLACK, FFI::NCurses::WHITE)\n=end\n end",
"def colour_mode(value = nil)\n fail InvalidSyntax, '`colour_mode` must be `8`, `16`, `256`, ' \\\n '`16777216`.' unless valid_colour_mode?(value)\n\n Vedeu.log(\"Configuration::API colour_mode: #{value}\")\n\n options[:colour_mode] = value\n end",
"def output_color(text, color=text.to_i)\r\n # Color matches: 1 - Black; 2 - White; 3 - Red; 4 - Yellow; 5 - Green; 6 - Blue; 7 - Gold\r\n colors = { 1 => 30, 2 => 36, 3 => 31, 4 => 33, 5 => 35, 6 => 34, 7 => 220 }\r\n # \\e[47m Is for the grey foreground \\e[{color} is for picking the color and \\e[0m is for resetting the terminal.\r\n \"\\e[1m\\e[47m\\e[#{colors[color]}m#{text}\\e[0m\\e[22m\"\r\n end",
"def color_set(id)\n @display.color_set(id)\n end",
"def lbSetColor _obj, _args\n \"_obj lbSetColor _args;\" \n end",
"def color_fix\n cli = HighLine.new\n ft = HighLine::ColorScheme.new do |cs|\n cs[:headline] = [ :bold, :yellow, :on_black ]\n cs[:horizontal_line] = [ :bold, :yellow ]\n cs[:headline_1] = [ :bold, :black, :on_yellow ]\n cs[:horizontal_line_1] = [ :yellow ]\n cs[:warning] = [ :bold, :red, :on_white ]\n cs[:menu_choice] = [ :bold, :light_blue, :on_red]\n cs[:menu_line] = [ :bold, :light_blue]\n end\n HighLine.color_scheme = ft\nend",
"def SetTextColor(r, g=-1, b=-1, storeprev=false)\n\t\t#Set color for text\n\t\tif ((r==0 and :g==0 and :b==0) or :g==-1)\n\t\t\t@text_color=sprintf('%.3f g', r/255.0);\n\t\telse\n\t\t\t@text_color=sprintf('%.3f %.3f %.3f rg', r/255.0, g/255.0, b/255.0);\n\t\tend\n\t\t@color_flag=(@fill_color!=@text_color);\n\t\tif (storeprev)\n\t\t\t# store color as previous value\n\t\t\t@prevtext_color = [r, g, b]\n\t\tend\n\tend",
"def adjust_colors (props = {foreground: \"red\", background: \"white\"})\n\tputs \"Foreground: #{props[:foreground]}\" if props[:foreground]\n\tputs \"Background: #{props[:background]}\" if props[:background]\n\nend",
"def bgcolor!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 30 )\n\n type = BGCOLOR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 360:10: 'bgcolor'\n match( \"bgcolor\" )\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__, 30 )\n\n end",
"def set_Color(value)\n set_input(\"Color\", value)\n end",
"def blue=(value)\n end",
"def adjust_colors( props={foreground: \"red\", background: \"white\"} )\n puts \"Foreground: #{props[:foreground]}\" if props[:foreground]\n puts \"Background: #{props[:background]}\" if props[:background]\nend"
] |
[
"0.72037005",
"0.7117945",
"0.682541",
"0.65912384",
"0.6522317",
"0.6444266",
"0.6436844",
"0.64007425",
"0.63941514",
"0.63784206",
"0.62146825",
"0.6078303",
"0.60298216",
"0.59687364",
"0.59157544",
"0.5911042",
"0.5833632",
"0.5833632",
"0.5776536",
"0.5725411",
"0.5719562",
"0.5712639",
"0.5677797",
"0.5648482",
"0.56288356",
"0.55810666",
"0.5577825",
"0.55677617",
"0.5493855",
"0.5450469",
"0.5445721",
"0.5419834",
"0.53988576",
"0.5368911",
"0.5362492",
"0.53609926",
"0.5349976",
"0.53400445",
"0.533629",
"0.531144",
"0.5309244",
"0.5272855",
"0.5257413",
"0.5252145",
"0.5252145",
"0.5246325",
"0.5227331",
"0.5226679",
"0.5220291",
"0.52193695",
"0.52185243",
"0.5215115",
"0.5212499",
"0.5205188",
"0.5194245",
"0.51854265",
"0.5168232",
"0.5166527",
"0.51640046",
"0.5151703",
"0.5151084",
"0.5147635",
"0.5143414",
"0.51310354",
"0.51256317",
"0.5117847",
"0.51099306",
"0.50986016",
"0.50868654",
"0.5076295",
"0.50649077",
"0.5059512",
"0.50576246",
"0.50565696",
"0.50555825",
"0.5054649",
"0.5048748",
"0.5046438",
"0.50323683",
"0.50298184",
"0.5029033",
"0.5025546",
"0.50216615",
"0.50210035",
"0.50082445",
"0.5006483",
"0.50043327",
"0.4996713",
"0.4995441",
"0.49896222",
"0.49874327",
"0.49872702",
"0.49863824",
"0.49857438",
"0.4984574",
"0.49768203",
"0.49715278",
"0.49676386",
"0.49597606",
"0.49576983"
] |
0.84491634
|
0
|
context_get_brush: Returns the current brush as a string
|
def context_get_brush()
return $gimp_iface.gimp_context_get_brush()[0]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def _context_set_brush!(brush_name)\n $gimp_iface.gimp_context_set_brush(brush_name)\nend",
"def markerBrush _args\n \"markerBrush _args;\" \n end",
"def current_branch\n hg('branch').to_s.strip\n end",
"def context_list_brushes(pattern = nil)\n if pattern == nil\n return $gimp_iface.gimp_brushes_get_list(\"\")[1]\n elsif pattern.is_a? String\n return $gimp_iface.gimp_brushes_get_list(pattern)[1]\n else\n raise ArgumentError, \"context_list_brushes only accepts a string as an argument\"\n end\nend",
"def context_get_fgcolor()\n return $gimp_iface.gimp_context_get_foreground()[0]\nend",
"def context_get_bgcolor()\n return $gimp_iface.gimp_context_get_background()[0]\nend",
"def to_string\r\n \"#{colour}\"\r\n end",
"def currentbranch\n %x{git branch | grep \"*\" | sed \"s;* ;;\"}.squish\n end",
"def current_branch\n %x(git branch | grep '*' | cut -d' ' -f2).chomp\nend",
"def to_s\n return canvas.to_s\n end",
"def set_brush_holder\n @brush_holder = BrushHolder.find(params[:id])\n end",
"def getDrawColor()\n return @drawColor\n end",
"def current_branch\n ref = Rugged::Reference.lookup(@git, 'HEAD').resolve\n if not ref.branch?\n raise Error, \"Not currently on a branch.\"\n end\n ref.name.split('/').last\n end",
"def to_s\n @color\n end",
"def current_binding\n binding_stack.last\n end",
"def to_s\n \"#{foreground}#{background}\"\n end",
"def current_branch\n `git symbolic-ref --short HEAD`.strip\n end",
"def to_s\n \"#<Wx::Colour: (#{red}, #{green}, #{blue} *#{alpha})>\"\n end",
"def colorize_byte_bg(brush, dc, hX, aX, y)\n if brush.kind_of? Array\n hbrush, abrush = brush[0..1]\n else\n hbrush = abrush = brush\n end\n\n h_off = @hex_width /4\n\n dc.set_pen(Wx::TRANSPARENT_PEN)\n\n dc.set_brush(hbrush)\n dc.draw_rectangle(hX-h_off, y, @hex_width+h_off+h_off, @txt_height)\n dc.set_brush(abrush)\n dc.draw_rectangle(aX, y, @asc_width, @txt_height)\n\n return nil\n end\n\n # Called from the on_paint method to draw the editor cursor\n def paint_cursor(dc)\n return unless self.cur_pos and @selection.nil?\n\n pos = self.cur_pos\n\n if pos == 0\n row = col = 0\n else\n row = pos / @columns \n col = pos % @columns\n end",
"def getbegyx\n Ncurses.getbegyx(pointer)\n end",
"def current_branch\n git('branch')[/^\\* (.*)$/, 1]\n end",
"def current_branch\n git('branch')[/^\\* (.*)$/, 1]\n end",
"def current_branch\n `git symbolic-ref --short -q HEAD`.chomp\n end",
"def get_current_color(points, x, y)\n if points.key?(x.to_s.to_sym) && points[x.to_s.to_sym].key?(y.to_s.to_sym)\n points[x.to_s.to_sym][y.to_s.to_sym]\n else\n BLACK\n end\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{red branch}\"\n branch\nend",
"def get_current_branch_from_git\n %x{ git rev-parse --abbrev-ref HEAD }.chomp\nend",
"def get_git_branch()\n return `git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e \"s/* \\\\(.*\\\\)/\\\\1/\"`.strip\nend",
"def to_s\n case @color\n when :black then '♚'\n when :white then '♔'\n end\n end",
"def palette\n object.palette.to_s\n end",
"def git_get_current_branch()\n current_branch = `git branch`.split(/\\n/).find{ |l| l.start_with?(\"*\") }\n \n if current_branch\n current_branch =~ /\\*\\s+(.+)/\n $~[1]\n end \nend",
"def peek\n context.last\n end",
"def prnt_cursor; @cursor.selected ? \"#E56373\" : \"#FFD768\" end",
"def currentcommit\n %x{git rev-parse HEAD}.squish\n end",
"def to_s\n if self.color == :white\n \" ♜ \"\n else\n \" ♖ \"\n end\n end",
"def to_s\n \"#{@hex_color}\"\n end",
"def current_branch\n git.branch.name\n end",
"def current\n return @stack[-1]\n end",
"def colored_string\n color(to_bold_s)\n end",
"def painter_name\n # Return back the name of my painter\n self.painter.name\n end",
"def get_color(key)\n if key.is_a? String\n color = key\n elsif Wirb::COLORS.key?(key)\n color = Wirb::COLORS[key]\n end\n\n color ? \"\\033[#{ color }m\" : ''\n end",
"def current\n @stack.last\n end",
"def current_branch\n self.lib.branch_current\n end",
"def cop\n last_value = IRB.CurrentContext.last_value\n %x[echo '#{last_value}' | pbcopy]\n \"copied \\`#{last_value}' to your clipboard\"\nend",
"def cop\n last_value = IRB.CurrentContext.last_value\n %x[echo '#{last_value}' | pbcopy]\n \"copied \\`#{last_value}' to your clipboard\"\nend",
"def getvalue_for_paint\n getvalue\n end",
"def to_thing\n return GLYPHMAP[[char, color, style]] || :unknown\n end",
"def derive_branch_name\n @config[:git][:branch] == 'preview' ? preview_branches.last : @config[:git][:branch]\n end",
"def draw_current_value(x, y, width, current, color1)\n change_color(color1)\n draw_text(x, y, width, line_height, current, Bitmap::ALIGN_RIGHT)\n change_color(normal_color)\n end",
"def current_branch\n repo.branches.find(&:head?)\n end",
"def context\n @context_stack.last\n end",
"def current_branch\n Dir.chdir @root do\n cmd = \"git rev-parse --abbrev-ref HEAD\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n case stderr\n when /unknown revision/\n raise Error, \"could not determine branch of repo with no commits\"\n when /Not a git repository/\n raise NotARepositoryError\n else\n raise Error, stderr\n end\n end\n return stdout.strip\n end\n end",
"def current_branch\n repo.branches.find(&:head?)\n end",
"def chco\n (foreground || \"FFFFFF\") + \",\" + super\n end",
"def getvalue_for_paint\n getvalue\n end",
"def color_name\n COLOR[self.color.to_s]\n end",
"def draw_current_colour_indicator(context)\n @current_colour_image.drawInRect(CGRectMake(10, 10, *@current_colour_image.size))\n end",
"def get_color\n @color\n end",
"def getgraphics(*)\n super.to_s\n end",
"def current\n @stack.last\n end",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{branch}\"\n branch\nend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n puts \"Deploying branch #{branch}\"\n branch\nend",
"def branch_name\n $repo.current_branch\n end",
"def context_str\n a = @context.to_a.map{ |x| x.join(':') }.join(\", \")\n a.empty? ? \"\" : \"{#{a}} \"\n end",
"def pencil\n @application.pencil\n end",
"def line_uri\n branch.commit_uri.chomp(\"commit/$commit\")\n end",
"def inspect\n alpha? ? rgba_str : hex_str\n end",
"def inspect\n alpha? ? rgba_str : hex_str\n end",
"def get_branch_name\r\n\tputs IO.popen('git branch --no-abbrev').read.slice(2..-1)\r\nend",
"def to_s\n 'RicColor: ' + self.send(@color)\n end",
"def current_branch\n @current_branch ||= `git rev-parse --abbrev-ref HEAD`.strip\n end",
"def getToolBar\n return @tool_bar\n end",
"def bat\n return @character\n end",
"def colour_for(char)\n return '' if char.colour == @colour\n\n @colour = char.colour\n @colour.to_s\n end",
"def colour(name, text)\n if Pry.color\n str = Pry::Helpers::Text.send(name, text)\n unless str.start_with?(\"\\001\")\n str = \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n end\n str\n else\n text\n end\nend",
"def get_selection\n return `xclip -o` if RUBY_PLATFORM =~ /linux/\n return `pbpaste` if RUBY_PLATFORM =~ /darwin/\nend",
"def symbol\n @color \n end",
"def current_branch; end",
"def current_branch; end",
"def to_s\n render_colour do\n render_style do\n data\n end\n end\n end",
"def get_current_rev\n\t\t\tid = read_command_output( 'hg', '-q', 'identify' )\n\t\t\treturn id.chomp\n\t\tend",
"def current_git_branch\n branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\\/heads\\//, '')\n logger.info \"Deploying branch #{branch}\"\n branch\nend",
"def Pager_GetBkColor(hwnd) send_pager_message(hwnd, :GETBKCOLOR) end",
"def TreeView_GetBkColor(hwnd) send_treeview_message(hwnd, :GETBKCOLOR) end",
"def current\n branch = list.find{|b| b.match /\\*/ }\n branch.gsub(/\\* /, '')\n end",
"def getcurx\n Ncurses.getcurx(pointer)\n end",
"def get_active_buffer()\n Rula.log(Logger::DEBUG,\"Get active buffer: #{@active_buffer}\",self)\n @buffers[@active_buffer]\n end",
"def branch\n case @vcs\n when 'github'\n if @data.key? 'ref'\n @data['ref'].sub('refs/heads/', '')\n else\n @data['repository']['default_branch']\n end\n when 'gitlab'\n @data['ref'].sub('refs/heads/', '')\n when 'bitbucket-server'\n @data['changes'][0]['refId'].sub('refs/heads/', '')\n when 'bitbucket'\n return @data['push']['changes'][0]['new']['name'] unless deleted?\n\n @data['push']['changes'][0]['old']['name']\n when 'stash'\n @data['refChanges'][0]['refId'].sub('refs/heads/', '')\n when 'tfs'\n @data['resource']['refUpdates'][0]['name'].sub('refs/heads/', '')\n end\n end",
"def color_name\n fetch('color.name')\n end",
"def bleu_gras\n \"\\033[1;96m#{self}\\033[0m\"\n end",
"def draw\n @board.to_s\n end",
"def getvalue_for_paint\n ret = getvalue\n @text_offset = @surround_chars[0].length\n @surround_chars[0] + ret + @surround_chars[1]\n end",
"def getvalue_for_paint\n ret = getvalue\n @text_offset = @surround_chars[0].length\n @surround_chars[0] + ret + @surround_chars[1]\n end",
"def stencil\n @stencil\n end",
"def b\n\t\t\tColor.b(@color)\n\t\tend",
"def formatted_browser\r\n return \"*#{@current_browser}\"\r\n end"
] |
[
"0.61980766",
"0.55831283",
"0.5544273",
"0.55354285",
"0.5531942",
"0.5514982",
"0.54537123",
"0.5436998",
"0.5348929",
"0.52988863",
"0.5191989",
"0.5162451",
"0.5141147",
"0.5139729",
"0.5136548",
"0.51061976",
"0.5049303",
"0.50474876",
"0.5031778",
"0.5029652",
"0.4999032",
"0.4999032",
"0.49864992",
"0.49852765",
"0.49406588",
"0.49406588",
"0.49406588",
"0.49406588",
"0.49406588",
"0.49406588",
"0.49099892",
"0.4909335",
"0.4903887",
"0.48871434",
"0.48773688",
"0.48429424",
"0.48412904",
"0.48358718",
"0.4829396",
"0.47951472",
"0.47914708",
"0.47865212",
"0.47858912",
"0.4783759",
"0.4765206",
"0.47602266",
"0.47518107",
"0.47461835",
"0.47461835",
"0.47458494",
"0.47417843",
"0.47408462",
"0.47279003",
"0.47128952",
"0.4709288",
"0.46813396",
"0.46741453",
"0.4666982",
"0.46603554",
"0.46592996",
"0.46434078",
"0.4641714",
"0.46098667",
"0.46088502",
"0.4601271",
"0.4601271",
"0.4587947",
"0.45867276",
"0.45666993",
"0.45572695",
"0.45516026",
"0.45516026",
"0.45498604",
"0.45468003",
"0.45393127",
"0.45295194",
"0.4526208",
"0.45259452",
"0.45214012",
"0.45208076",
"0.45155883",
"0.4512446",
"0.4512446",
"0.45040894",
"0.4495219",
"0.4491548",
"0.4489578",
"0.44757462",
"0.44746408",
"0.44727764",
"0.4472215",
"0.4465961",
"0.44501314",
"0.444852",
"0.44481713",
"0.44418418",
"0.44418418",
"0.44399047",
"0.4437851",
"0.4435216"
] |
0.7975319
|
0
|
context_set_brush: Takes a brush name and sets the brush accordingly
|
def _context_set_brush!(brush_name)
$gimp_iface.gimp_context_set_brush(brush_name)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def setMarkerBrush _obj, _args\n \"_obj setMarkerBrush _args;\" \n end",
"def set_brush_holder\n @brush_holder = BrushHolder.find(params[:id])\n end",
"def setMarkerBrushLocal _obj, _args\n \"_obj setMarkerBrushLocal _args;\" \n end",
"def setBrushSize(size)\n puts(\"Brush size updated\") \n @brushSize = size\n end",
"def markerBrush _args\n \"markerBrush _args;\" \n end",
"def context_get_brush()\n return $gimp_iface.gimp_context_get_brush()[0]\nend",
"def spray_paint(new_color)\n self.color = new_color\n end",
"def pencolor args\n is_step\n stroke args\n @fg_color = args\n update_pen_info\n end",
"def active_set_name(name)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.RunEditor_active_set_name(@handle.ptr, name)\n end",
"def setRainbow _obj, _args\n \"_obj setRainbow _args;\" \n end",
"def colorize_byte_bg(brush, dc, hX, aX, y)\n if brush.kind_of? Array\n hbrush, abrush = brush[0..1]\n else\n hbrush = abrush = brush\n end\n\n h_off = @hex_width /4\n\n dc.set_pen(Wx::TRANSPARENT_PEN)\n\n dc.set_brush(hbrush)\n dc.draw_rectangle(hX-h_off, y, @hex_width+h_off+h_off, @txt_height)\n dc.set_brush(abrush)\n dc.draw_rectangle(aX, y, @asc_width, @txt_height)\n\n return nil\n end\n\n # Called from the on_paint method to draw the editor cursor\n def paint_cursor(dc)\n return unless self.cur_pos and @selection.nil?\n\n pos = self.cur_pos\n\n if pos == 0\n row = col = 0\n else\n row = pos / @columns \n col = pos % @columns\n end",
"def setDrawColorViaRGBObject(color)\n @drawColor = color\n end",
"def setDrawColor(color)\n puts(\"draw color set to \" + color)\n @drawColor = color\n end",
"def []=(name, value)\n set_namevalue_glob(name,value, :color => 42) # 42 - aqua-marin, 7-green\n end",
"def activate(x, y)\n @active = true\n @x = x\n @y = y\n @step_y = @step_y_ref\n @colour_count = 0\n @colour_ind = 0\n @colour_num = 0\n end",
"def setDrawColorViaRGB(r, g, b)\n while r > 255\n r -= 255\n end\n while g > 255\n g -= 255\n end\n while b > 255\n b -= 255\n end\n puts(\"draw color set to RGB values: (\" + r.to_s + \", \" + g.to_s + \", \" + b.to_s + \")\")\n @drawColor = FXRGB(r, g, b)\n end",
"def bob_code(options={}, &block)\n # if the only string is give, it must be filename by default\n if options.is_a? String\n f = options\n options = {}\n options[:filename] = f \n end\n if block_given?\n code = capture(&block)\n options[:brush] ||= :plain\n else\n unless options[:brush]\n # determine the brush from the filename\n if options[:filename]\n options[:brush] = case File.extname(options[:filename]).downcase\n when '.rb'\n :ruby\n when '.sh', '.ksh', '.csh'\n :shell\n when '.as3'\n :as3\n when '.cf'\n :cf\n when '.c#'\n :csharp\n when '.cpp', '.c'\n :cpp\n when '.css'\n :css\n when '.pas'\n :pascal\n when '.diff'\n :diff\n when '.erl'\n :elang\n when '.js'\n :javascript\n when '.java'\n :java\n when '.pl'\n :perl\n when '.php', '.php3'\n :php\n when '.txt'\n :plain\n when '.ps'\n :powershell\n when '.py', '.jy'\n :python\n when '.scala'\n :scala\n when '.sql'\n :sql\n when '.vb', '.vbs'\n :vb\n when '.xml', '.xhtml', '.xslt', '.html', '.xhtml'\n :xml\n else \n :plain # default value\n end\n end\n end\n code = raw File.read(Rails.root.join('code', options[:filename]))\n end\n s = raw \"<pre class=\\\"brush: #{options[:brush]}; highlight: #{options[:highlight_lines]}\\\">\"\n s += code\n s += raw '</pre>'\n end",
"def set_highlight(val)\n add_actions \"SetHighlight(#{val})\"\n end",
"def setMarkerColor _obj, _args\n \"_obj setMarkerColor _args;\" \n end",
"def set_focus(focused, selected)\n default_color = Gtk::Widget.default_style.bg(Gtk::STATE_NORMAL)\n self.modify_bg(Gtk::STATE_NORMAL, (\n selected ? (\n focused ? Gdk::Color.new(65535,65535,0) : Gdk::Color.new(65535,0,0)\n ) : (\n focused ? Gdk::Color.new(0,65535,0) : default_color\n )\n ))\n self.show\n end",
"def set_colour(user_colour)\n @colour = user_colour\n end",
"def set_region_name(name)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.RunEditor_set_region_name(@handle.ptr, name)\n end",
"def Pager_SetBkColor(hwnd, clr) send_pager_message(hwnd, :SETBKCOLOR, lparam: clr) end",
"def spray_paint(color)\n self.color = color\n puts \"Your new #{color} paint job looks great!\"\n end",
"def TreeView_SetInsertMarkColor(hwnd, clr) send_treeview_message(hwnd, :SETINSERTMARKCOLOR, lparam: clr) end",
"def change_color(color)\n self.font.color = color\n end",
"def set_bookmark(bm_name, value)\n raise_if_no_document\n bm_range = set_at_bookmark(bm_name, value)\n @doc.Bookmarks.Add bm_name, bm_range\n end",
"def colour(name, text)\n if Pry.color\n \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n else\n text\n end\nend",
"def highlight(box)\n @pieces[box[0]][box[1]].stroke = yellow\nend",
"def TreeView_SetBkColor(hwnd, clr) send_treeview_message(hwnd, :SETBKCOLOR, lparam: clr) end",
"def set_pen\n @pen = Pen.find(params[:id])\n end",
"def set_pen\n @pen = Pen.find(params[:id])\n end",
"def paint( color )\n self.update(color: color)\n end",
"def paint(win, color)\r\n win.attron(Curses.color_pair(color))\r\n yield\r\n win.attroff(Curses.color_pair(color))\r\nend",
"def []=( name, value )\n raise ArgumentError, \"Silly! That's not a ColorSchmeme!\" unless value.is_a?(ColorScheme)\n @color_schemes[name.to_s] = value\n end",
"def cset( q, r, color: nil, border: false, data: nil )\n @hexes[ [ q, r ] ] = AxialHex.new( q, r, color: color, border: border, data: data )\n end",
"def lbSetColor _obj, _args\n \"_obj lbSetColor _args;\" \n end",
"def draw_selected(x_position, y_position)\n $app.stroke($app.rgb(255,0,0))\n draw(x_position, y_position)\n $app.stroke($app.rgb(0,0,0))\n end",
"def set_draw_color_a(color = RFPDF::COLOR_PALETTE[:black])\n SetDrawColor(color[0], color[1], color[2])\n end",
"def set_stroke\n @stroke = Stroke.find(params[:id])\n end",
"def setDrawIcon _obj, _args\n \"_obj setDrawIcon _args;\" \n end",
"def colorize canvas, color\n canvas.itemconfigure tag, :fill => color\n rescue => ex\n if ex.message =~ /unknown option \"-fill\"/\n extend CarefulColorize\n colorize canvas, color\n else\n raise\n end\n end",
"def lnbSetColor _args\n \"lnbSetColor _args;\" \n end",
"def set_custom_color idx, red, green, blue\n raise 'Invalid format' if [red, green, blue].find { |c| ! (0..255).include?(c) }\n\n @palette[idx] = [red, green, blue]\n end",
"def paint(painted_map, x, y, brush_size)\n return if [x, y].max + brush_size > @size\n y.upto(y + brush_size - 1) do |yy|\n x.upto(x + brush_size - 1) do |xx|\n painted_map [yy][xx] = 1\n end\n end\n end",
"def change_font_color(font_color='000000')\n validate_worksheet\n #if arg is a color name, convert to integer\n Color.validate_color(font_color)\n # Get copy of font object with modified color\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_font(font)\n end",
"def undo!\n bb = @stack.pop\n set_black(bb[:black])\n set_white(bb[:white])\n end",
"def colour(name, text)\n if Pry.color\n str = Pry::Helpers::Text.send(name, text)\n unless str.start_with?(\"\\001\")\n str = \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n end\n str\n else\n text\n end\nend",
"def []=(x, y, *args)\n set_pixel_color(x, y, *args)\n end",
"def set(red, green, blue, alpha=255)\n self.red = red\n self.green = green\n self.blue = blue\n self.alpha = alpha\n end",
"def set_Color(value)\n set_input(\"Color\", value)\n end",
"def change_font_name(fontname)\n @font_name = fontname\n @text_entry.update_font\n self.redraw\n end",
"def highlighter=(_arg0); end",
"def set_custom_color(index, red = 0, green = 0, blue = 0)\n # Match a HTML #xxyyzz style parameter\n if red.to_s =~ /^#(\\w\\w)(\\w\\w)(\\w\\w)/\n red = ::Regexp.last_match(1).hex\n green = ::Regexp.last_match(2).hex\n blue = ::Regexp.last_match(3).hex\n end\n\n # Check that the colour index is the right range\n raise \"Color index #{index} outside range: 8 <= index <= 64\" if index < 8 || index > 64\n\n # Check that the colour components are in the right range\n if (red < 0 || red > 255) ||\n (green < 0 || green > 255) ||\n (blue < 0 || blue > 255)\n raise \"Color component outside range: 0 <= color <= 255\"\n end\n\n index -= 8 # Adjust colour index (wingless dragonfly)\n\n # Set the RGB value\n @palette[index] = [red, green, blue]\n\n # Store the custome colors for the style.xml file.\n @custom_colors << sprintf(\"FF%02X%02X%02X\", red, green, blue)\n\n index + 8\n end",
"def stylename=(new_stylename)\n @stylename = new_stylename\n if respond_to?(:'setStyleId:')\n setStyleId(new_stylename)\n end\n if respond_to?(:'setNuiClass:')\n setNuiClass(new_stylename)\n end\n restyle!\n end",
"def prnt_cursor; @cursor.selected ? \"#E56373\" : \"#FFD768\" end",
"def use_cairo(&block)\n @cairo_context.save\n block.yield(@cairo_context)\n @cairo_context.restore\n end",
"def []=(x, y, color)\n @modified[x, y] = color\n end",
"def colorize(*args)\n shell.set_color(*args)\n end",
"def color_set(id)\n @display.color_set(id)\n end",
"def set_selection(*args)\n # Check for a cell reference in A1 notation and substitute row and column\n if args[0] =~ /^\\D/\n args = substitute_cellref(*args)\n end\n @selection = args\n end",
"def set_color(color)\n @color = color\n end",
"def change_plant_name(new_color, id)\n CONNECTION.execute(\"UPDATE backyard SET flower_color = '#{new_color}' WHERE id = #{id};\")\nend",
"def SetCmykFillColor(c, m, y, k, storeprev=false)\n\t\t#Set color for all filling operations\n\t\t@fill_color=sprintf('%.3f %.3f %.3f %.3f k', c, m, y, k);\n\t\t@color_flag=(@fill_color!=@text_color);\n\t\tif (storeprev)\n\t\t\t# store color as previous value\n\t\t\t@prevtext_color = [c, m, y, k]\n\t\tend\n\t\tif (@page>0)\n\t\t\tout(@fill_color);\n\t\tend\n\tend",
"def stylename=(new_stylename)\n @stylename = new_stylename\n restyle!\n end",
"def set_at_bookmark(bm_name, value)\n raise_if_no_document\n # the easy version :\n bm_range = @doc.Bookmarks(bm_name).Range\n bm_range.Text = value\n return bm_range\n end",
"def ctrlSetTooltipColorShade _obj, _args\n \"_obj ctrlSetTooltipColorShade _args;\" \n end",
"def set_pixel( num, *args )\n self[num] = to_color(*args)\n self\n end",
"def setMarkerColorLocal _obj, _args\n \"_obj setMarkerColorLocal _args;\" \n end",
"def settextcolorind(*)\n super\n end",
"def set_beercolour\n @beercolour = Beercolour.find(params[:id])\n end",
"def _context_set_fgcolor!(rgb)\n $gimp_iface.gimp_context_set_foreground(rgb)\nend",
"def add_bright_color(str, color)\n color = color.to_s.sub(\"bright_\", \"\").to_sym\n str = reset_prev_formatting str, :color\n \"\\e[1m\\e[#{TC_CONFIG[:colors][color].to_s}m#{str}\"\n end",
"def _context_set_bgcolor!(rgb)\n $gimp_iface.gimp_context_set_background(rgb)\nend",
"def setlinecolorind(*)\n super\n end",
"def set(red, green, blue, alpha = nil); end",
"def set_color=(new_color)\n @@color = new_color\n end",
"def setcolorrep(*)\n super\n end",
"def draw_face(face_name, face_index, x, y, enabled = true)\n face_name = Revoked::Menu::Equip::FACE_NAME\n bitmap = Cache.face(face_name)\n rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)\n #drect = Rect.new(0, 0, 64, 64)\n contents.blt(x,y, bitmap, rect, enabled ? 255 : translucent_alpha)\n bitmap.dispose\n end",
"def set(data_set_name, x, y)\n data_set = @data[data_set_name]\n if data_set.nil? \n data_set = {}\n @data[data_set_name] = data_set\n end\n data_set[x] = y\n end",
"def ctrlSetForegroundColor _obj, _args\n \"_obj ctrlSetForegroundColor _args;\" \n end",
"def paint_job(new_color)\n @color = new_color\n puts \"The bike is now sporting the color #{@color}!\"\n end",
"def SetDrawColor(r, g=-1, b=-1)\n\t\t#Set color for all stroking operations\n\t\tif ((r==0 and g==0 and b==0) or g==-1)\n\t\t\t@draw_color=sprintf('%.3f G', r/255.0);\n\t\telse\n\t\t\t@draw_color=sprintf('%.3f %.3f %.3f RG', r/255.0, g/255.0, b/255.0);\n\t\tend\n\t\tif (@page>0)\n\t\t\tout(@draw_color);\n\t\tend\n\tend",
"def spray_paint(new_color)\n self.color = new_color\n puts \"Your car is sprayed with a new #{new_color} paint.\"\n end",
"def set_rgb_color(font_color)\n self.color = RubyXL::Color.new(:rgb => font_color.to_s)\n end",
"def shading_colour=(colour)\n self.each {|cell| cell.shading_colour = colour}\n end",
"def setBackground(r,g,b,a)\n @textBox.override_background_color(:normal,Gdk::RGBA.new(r,g,b,a))\n self\n end",
"def change_colour(colour)\n @colour = colour\n generate_image\n # need to change the angle back to zero as redrawn\n end",
"def set( setThis )\r\n assert_exists\r\n assert_enabled\r\n assert_not_readonly\r\n \r\n highlight(:set)\r\n @o.scrollIntoView\r\n @o.focus\r\n @o.select()\r\n @o.fireEvent(\"onSelect\")\r\n @o.value = \"\"\r\n @o.fireEvent(\"onKeyPress\")\r\n doKeyPress( setThis )\r\n highlight(:clear)\r\n @o.fireEvent(\"onChange\")\r\n @o.fireEvent(\"onBlur\")\r\n end",
"def set_palette(color_string)\n p = Wasko::Palette::Original.new(color_string)\n\n set_background_color p.colors[:base].html\n set_foreground_color p.colors[:foreground].html\n set_bold_color p.colors[:bold].html\n set_cursor_color p.colors[:cursor].html\n set_selected_text_color p.colors[:selected].html\n set_selection_color p.colors[:selection].html\n end",
"def set_piece\n if @color == \"green\"\n @piece = \"[X]\".colorize(:green)\n elsif @color == \"yellow\"\n @piece = \"[X]\".colorize(:yellow)\n elsif @color == \"blue\"\n @piece = \"[X]\".colorize(:blue)\n elsif @color == \"red\"\n @piece = \"[X]\".colorize(:red)\n elsif @color == \"magenta\"\n @piece = \"[X]\".colorize(:magenta)\n elsif @color == \"cyan\"\n @piece = \"[X]\".colorize(:cyan)\n end\n end",
"def set_selected(selected)\n default_color = Gtk::Widget.default_style.bg(Gtk::STATE_NORMAL)\n self.modify_bg(Gtk::STATE_NORMAL, selected ? Gdk::Color.new(65535,0,0) : default_color)\n self.show\n end",
"def set_supermarket_highlight\n @supermarket_highlight = SupermarketHighlight.find(params[:id])\n end",
"def mix_base_with(color_name, mix_value = 50, brightness = 30)\n @base.mix_with(Wasko::Color.color_from_string(color_name), mix_value).adjust_brightness(brightness)\n end",
"def change_font_name(font_name='Verdana')\n validate_worksheet\n # Get copy of font object with modified name\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_font(font)\n end",
"def setMarkerShape _obj, _args\n \"_obj setMarkerShape _args;\" \n end",
"def ctrlSetTooltipColorBox _obj, _args\n \"_obj ctrlSetTooltipColorBox _args;\" \n end",
"def setHighlight(highlight)\n @highlight = highlight\n end",
"def setHighlight(highlight)\n @highlight = highlight\n end",
"def setHighlight(highlight)\n @highlight = highlight\n end"
] |
[
"0.66233206",
"0.6411085",
"0.61420393",
"0.5755998",
"0.57285947",
"0.53350013",
"0.5073856",
"0.49332157",
"0.48792353",
"0.48563275",
"0.47966868",
"0.47849363",
"0.47437993",
"0.47134793",
"0.45473495",
"0.454404",
"0.45254093",
"0.45074755",
"0.44992483",
"0.44978228",
"0.4494876",
"0.44689816",
"0.44606724",
"0.4428287",
"0.4426895",
"0.44166747",
"0.44142175",
"0.4405427",
"0.43976066",
"0.43949595",
"0.43920866",
"0.43920866",
"0.43903908",
"0.43818036",
"0.43789202",
"0.43741453",
"0.43573198",
"0.4354647",
"0.43489227",
"0.434826",
"0.43420413",
"0.4329195",
"0.4322181",
"0.4319277",
"0.43096334",
"0.43050256",
"0.42979124",
"0.4297721",
"0.42964432",
"0.4295145",
"0.42917",
"0.42896333",
"0.4278951",
"0.42683458",
"0.42612222",
"0.42606106",
"0.42600748",
"0.42583174",
"0.4258148",
"0.42550743",
"0.42377082",
"0.4231704",
"0.4230622",
"0.4222413",
"0.42217222",
"0.42132297",
"0.42129898",
"0.42099398",
"0.42091286",
"0.42084026",
"0.41970596",
"0.41938108",
"0.4189315",
"0.41802537",
"0.41783354",
"0.41752455",
"0.41711405",
"0.41672996",
"0.41620633",
"0.41584355",
"0.41583234",
"0.41541865",
"0.41508314",
"0.41419438",
"0.41414735",
"0.41390145",
"0.41377065",
"0.41357985",
"0.41352206",
"0.41278338",
"0.41225168",
"0.41205394",
"0.41178918",
"0.4115432",
"0.4111489",
"0.41081652",
"0.41081354",
"0.41075036",
"0.41075036",
"0.41075036"
] |
0.81278855
|
0
|
contextlistcolors: returns an array of color names. If given a string, the array only contains the names that contain that string.
|
def context_list_colors(pattern = nil)
if pattern == nil
return $gimp_iface.ggimp_rgb_list()[1]
elsif pattern.is_a? String
names = $gimp_iface.ggimp_rgb_list()[1]
names.select!{|element| element.include?(pattern)}
return names
else
raise ArgumentError, "context_list_color_names only accepts a string as an argument"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def colorNames\n colors = [\"red\", \"orange\", \"yellow\", \"green\", \"mint\", \"navy\", \"light blue\", \"lavender\", \"plum\", \"pink\"]; \n return colors;\n end",
"def colors\n keys = []\n COLORS.each_key do | key |\n keys << key\n end\n keys\n end",
"def colors\n keys = []\n COLORS.each_key do |key|\n keys << key\n end\n keys\n end",
"def list_colors\n color_string = \"\\nThe available colors are \"\n COLORS.each_with_index do |color, index|\n if index%2 == 0\n color_string += \"\\n\"\n end\n color_string += color + \" \"\n end\n puts color_string\n end",
"def product_colors(product)\n return product.color.split(',').map(&:to_s)\n end",
"def colors\n color_codes.keys\n end",
"def possible_colors\n %w(R G B Y)\n end",
"def see_color(str)\n return 'red' if str.start_with?('red')\n return 'blue' if str.start_with?('blue')\n\n ''\n end",
"def get_color_list_name\n\t\t@availible_colors.keys[0]\n\tend",
"def color( string, *colors )\n colors.map! { |color|\n color_tag = to_key(color)\n @scheme.key?(color_tag) ? @scheme[color_tag] : to_constant(color)\n }\n\n colors.compact!\n return string if colors.empty?\n\n \"#{colors.join}#{string}#{CLEAR}\"\n end",
"def colors() = @colors ||= %i[blue green purple magenta cyan yellow red]",
"def colorsPrimary\n @color_rgb_strings_primary = []\n @color_rgb.each do |rgb|\n r = rgb[\"red\"]\n g = rgb[\"green\"]\n b = rgb[\"blue\"]\n @color_rgb_strings_primary << \"rgb(#{r},#{g},#{b})\"\n end\n end",
"def colors\n color1 = UIColor.colorWithWhite(1.0, alpha: 0.2).CGColor\n color2 = UIColor.colorWithWhite(1.0, alpha: 0.1).CGColor\n color3 = UIColor.clearColor().CGColor\n color4 = UIColor.colorWithWhite(0.0, alpha: 0.1).CGColor\n \n [color1, color2, color3, color4]\n end",
"def extract_context_names(options)\n context_names = [\n options.delete(:context),\n options.delete(:group),\n options.delete(:when),\n options.delete(:on)\n ].compact.first\n\n Array(context_names || :default)\n end",
"def parse_colors\n working = dup\n color_array = []\n\n scan(/(?<!\\\\)(%((?:[fb]g?)?#[a-fA-F0-9]{6}|[a-z]+))/).each do |color|\n valid_color = color[1].validate_color\n next unless valid_color\n\n idx = working.match(/(?<!\\\\)%#{valid_color}/).begin(0)\n color = Color.attributes.include?(valid_color.to_sym) ? Color.send(valid_color) : Color.rgb(valid_color)\n color_array.push({ name: valid_color, color: color, index: idx })\n working.sub!(/(?<!\\\\)%#{valid_color}/, '')\n end\n\n { string: working, colors: color_array }\n end",
"def scan_for_colors; end",
"def check_inside_Colors (string)\n Colors.include?(string)\n end",
"def find_color_codes\n color_codes.uniq(&:numeric_code)\n end",
"def pixels_color_list\n color_list = ['', '', '', '', '', '', '', '']\n image_name_list = get_image_name_list PIXELS_PATH\n image_name_list.each do |image_name|\n color_list = pixel_color_list(image_name, color_list)\n end\n color_list.each(&:chop!)\n color_list\n # => like this: ['hogehoge.jpg,foobar.jpg', ... 'last.jpg,final.jpg']\n end",
"def get_contexts_named( name )\n @context_list.values.map{ |context| context if context.name == name }.compact\n end",
"def request_color(string = nil)\n string = '#999' unless string.to_s.match(/#?[0-9A-F]{3,6}/i)\n color = string\n prefix, string = string.match(/(#?)([0-9A-F]{3,6})/i)[1,2]\n string = $1 * 2 + $2 * 2 + $3 * 2 if string =~ /^(.)(.)(.)$/\n \n _options = default_options_for_cocoa_dialog()\n _options[\"color\"] = string\n \n col = cocoa_dialog(\"colorselect\", _options)\n return nil unless col && col != \"\" # user cancelled\n col.delete! '#'\n\n color = prefix\n if /(.)\\1(.)\\2(.)\\3/.match(col) then\n color << $1 + $2 + $3\n else\n color << col\n end\n return color\n end",
"def colors\n @colors ||= parse_colors(color_properties)\n end",
"def list_colors\n colors_raw = search_colors_shopstyle\n colors = formats_colors_hash(colors_raw)\n render json: { status: 0, data: {colors: colors} }\n end",
"def colors\n colors = []\n @lines.each do |line|\n color = line.scan(/\\d{1,3},\\d{1,3},\\d{1,3}/).first\n next if color.blank?\n color = color.split(',')\n colors << rgb(color[0].to_i, color[1].to_i, color[2].to_i)\n end\n colors\n end",
"def html_colors(total)\n all_colors = [\"FF0000\", \"00FF00\", \"0000FF\", \"00FFFF\", \"FF00FF\", \"FFFF00\", \"000000\"]\n #return [] if total > all_colors.length\n return Array.new(total){|i| all_colors[i]}\n end",
"def colorized?\n scan_for_colors.inject([]) do |colors, match|\n colors << match.tap(&:pop)\n end.flatten.compact.any?\n end",
"def colorized?\n scan_for_colors.inject([]) do |colors, match|\n colors << match.tap(&:pop)\n end.flatten.compact.any?\n end",
"def colorize(* colors)\n buff = []\n colors.each{|color| buff << color_code(color)}\n buff << self << color_code(:off)\n buff.join\n end",
"def colors\n @wmiiconfig.read(\"/bar/#{@name}/colors\").split(/\\s+/).map do |txt|\n txt.scan(/[a-fA-F0-9]{2}/).map{|hex| hex.to_i(16)}\n end\n end",
"def process_options\n puts ScrumyChangeColor::ALLOWED_COLORS.join(', ') if @options.list_colors\n end",
"def scrub_colors(attribute_type)\n case(attribute_type)\n when 'color_indicator'\n colors_string = self.color_indicator.join(', ')\n when 'color_identity'\n colors_string = self.color_identity.join(', ')\n when 'colors'\n colors_string = self.colors.join(', ')\n end\n color_conversion_chart = {'B' => 'Black', 'G' => 'Green', 'U' => 'Blue', 'W' => 'White', 'R' => 'Red'}\n color_conversion_chart.each do |symbol, color|\n colors_string = colors_string.gsub(symbol, color) if colors.include?(symbol)\n end\n colors_string.split(', ')\n end",
"def hex_color_array color_scheme\n case color_scheme\n when 'YlOrRd' then\n [\"#FFFFB2\", \"#FED976\", \"#FEB24C\", \"#FD8D3C\", \"#FC4E2A\", \"#E31A1C\", \"#B10026\"]\n when 'RdPu' then\n [\"#FEEBE2\", \"#FCC5C0\", \"#FA9FB5\", \"#F768A1\", \"#DD3497\", \"#AE017E\", \"#7A0177\"]\n when 'YlGn' then\n [\"#FFFFCC\", \"#D9F0A3\", \"#ADDD8E\", \"#78C679\", \"#41AB5D\", \"#238443\", \"#005A32\"]\n when 'YlGnBu' then\n [\"#FFFFCC\", \"#C7E9B4\", \"#7FCDBB\", \"#41B6C4\", \"#1D91C0\", \"#225EA8\", \"#0C2C84\"]\n when 'YlOrBr' then\n [\"#FFFFD4\", \"#FEE391\", \"#FEC44F\", \"#FE9929\", \"#EC7014\", \"#CC4C02\", \"#8C2D04\"]\n end\n end",
"def iterate_colors(colors)\n res = Array.new\n\n colors.each do |color|\n res.push(color)\n end\n return res\nend",
"def optns_list\n @optns_list ||= Select2BikeBinder.configuration.color_option_keys.map do |k| \n [ColorNameI18n::Color.new(k).name.capitalize, k]\n end\n @optns_list \n end",
"def team_colors(team_name)\n # returns an array of team colors for team_name\n game_hash.each do |location, team_hash|\n team_hash.each do |team_keys, team_values|\n if team_hash[:team_name] == team_name && team_keys == :colors\n return team_values\n end\n end\n end\n end",
"def scan_for_colors\n scan(/\\033\\[([0-9;]+)m(.+?)\\033\\[0m|([^\\033]+)/m).map do |match|\n split_colors(match)\n end\n end",
"def scan_for_colors\n scan(/\\033\\[([0-9;]+)m(.+?)\\033\\[0m|([^\\033]+)/m).map do |match|\n split_colors(match)\n end\n end",
"def named_colors\n @named_colors ||= PdfK::NAMED_COLORS.dup\n end",
"def apply_colors(color_array)\n str = dup\n color_array.reverse.each do |color|\n c = color[:color].empty? ? Color.send(color[:name]) : color[:color]\n str.insert(color[:index], c)\n end\n str\n end",
"def team_colors(t_name)\n game_hash.collect do |key, value|\n value.collect do |key2, value2|\n\n if game_hash[key].values.include?(t_name)\n\n if key2 == :colors\n return value2\n end\n end\n end\n end\n end",
"def available_colors_translated\n colors_translated = {}\n Calendar::Event::COLORS.each do |color, hex|\n colors_translated[t(\"colors.#{color}\")] = hex;\n end\n colors_translated\n end",
"def suggestContextNames(username, contextname)\n\n # Put suggestions to resp and return it\n resp = Array.new\n \n sugg = contextname\n \n # Look for the context name for this user\n ctxName = ContextName.find_by_name_and_username(contextname, username )\n \n \n while resp.length < 3\n if ContextName.find_by_name_and_username(sugg, username) == nil\n resp.push(sugg)\n end\n sugg +=\"I\"\n end\n \n return resp\n end",
"def ls_colors ext_map, type_map\n ext_lst =\n ext_map.keys.map { |k|\n globs = ext_map[k]\n globs.map { |g| \"*.#{g}=#{k}\" }\n }\n type_lst =\n type_map.keys.map { |k|\n color = type_map[k]\n \"#{k}=#{color}\"\n }\n desc = (type_lst + ext_lst).join ':'\n export 'LS_COLORS', desc\n end",
"def team_colors(team_name)\n game_hash.each do |location, team_data|\n\t\tif team_data[:team_name] == team_name\n\t\t\treturn team_data[:colors]\n\t\tend\n\tend\nend",
"def find_all(parent_color = nil)\n rsp = if(parent_color.kind_of?(Fotolia::Color))\n @fotolia.remote_call('getColors', parent_color.id)\n elsif(parent_color)\n @fotolia.remote_call('getColors', parent_color.to_i)\n else\n @fotolia.remote_call('getColors')\n end\n\n ret = Array.new\n\n rsp['colors'].each_value do |color_response|\n ret << Fotolia::Color.new(:id => color_response['id'].to_i, :name => color_response['name'])\n end\n\n ret\n end",
"def colors\n @colors\n end",
"def colorHex\n hex = [\"#EC514A\", \"#F8BD28\", \"#FFEB65\", \"#8BC04F\", \"#5BC2A8\", \"#2458B7\", \"#97EDEC\", \"#8E7BB9\", \"#B23F73\", \"#E889B9\"];\n return hex;\n end",
"def colors?\n scan(/%([a-z]+)/).each do\n return true if Regexp.last_match(1).validate_color\n end\n false\n end",
"def color(*options)\n mix = []\n color_seen = false\n\n if options.empty?\n mix << random(false) # random foreground color\n else\n options.each{ |option|\n case option\n when Symbol\n if ANSI_EFFECTS.keys.include?(option)\n mix << effect(option)\n elsif ANSI_COLORS.keys.include?(option)\n mix << simple(option, color_seen)\n color_seen = true\n else\n raise ArgumentError, \"Unknown color or effect: #{ option }\"\n end\n\n when Array\n if option.size == 3 && option.all?{ |n| n.is_a? Numeric }\n mix << rgb(*(option + [color_seen])) # 1.8 workaround\n color_seen = true\n else\n raise ArgumentError, \"Array argument must contain 3 numerals\"\n end\n\n when ::String\n if option =~ /^#?(?:[0-9a-f]{3}){1,2}$/\n mix << hex(option, color_seen)\n color_seen = true\n else\n mix << name(option, color_seen)\n color_seen = true\n end\n\n when Numeric\n integer = option.to_i\n color_seen = true if (30..49).include?(integer)\n mix << integer\n\n when nil\n color_seen = true\n \n else\n raise ArgumentError, \"Invalid argument: #{ option.inspect }\"\n\n end\n }\n end\n\n wrap(*mix)\n end",
"def tokenize_color\n tokens = []\n matches = self.to_enum(:scan, /\\e\\[0;[39]\\d;49m(.*?[\\s]*)\\e\\[0m/).map{Regexp.last_match}\n\n i, istart, iend = 0, 0, 0\n match = matches[i]\n while istart < self.size\n color = \"39\"\n iend = self.size\n token = self[istart..iend]\n\n # Current token is not a match\n if match && match.begin(0) != istart\n iend = match.begin(0)-1\n token = self[istart..iend]\n istart = iend + 1\n\n # Current token is a match\n elsif match && match.begin(0) == istart\n iend = match.end(0)\n token = match.captures.first\n color = match.to_s[/\\e\\[0;(\\d+);49m.*/, 1]\n i += 1; match = matches[i]\n istart = iend\n\n # Ending\n else\n istart = iend\n end\n\n # Create token and advance\n tokens << ColorPair.new(token, color.to_i, ColorMap[color.to_i])\n end\n\n return tokens\n end",
"def code(*colors)\n validate(*colors)\n colors.map { |color| lookup(color) }\n end",
"def get_patterns\n patterns = BASE_PATTERNS\n # add the colour keywords. generate these from the colour wheel's constants\n colours = Yay::ColourWheel::all_names.join('|')\n patterns.unshift [:colour, Regexp.new(\"\\\\b(#{colours})\\\\b\", Regexp::IGNORECASE)]\n return patterns\n end",
"def encode_colors colors\n\t\tencoded_colors = []\n\t\tcolors.each do |color|\n\t\t\tencoded_color = encode_color color\n\t\t\treturn nil if encoded_color.nil?\n\t\t\tencoded_colors << encoded_color\n\t\tend\n\t\tencoded_colors\n\tend",
"def colors\n hex_values = @lines.map { |line| line[/#([0-9A-F]{6})/, 1] }.compact\n hex_values.map { |hex| Colour::RGB.from_html(hex) }\n end",
"def pixel_color_list(image_name, color_list)\n array = Array.new(color_list)\n img = Magick::ImageList.new(image_name)\n pixels = img.get_pixels(0, 0, img.columns, img.rows)\n pixel_l = pixels[0].to_hsla[2].to_i\n array[pattern(pixel_l)] += File.basename(image_name) + EXPORT_LIST_SEPARATOR\n img.destroy!\n array\n end",
"def is_valid_color?(color_string)\n COLORS.include?(color_string)\n end",
"def split_colors\n array = []\n remainder = @sha.split('') # Yes, it's not the remainder now, but it will be at the return statement.\n 6.times { array << remainder.slice!(0, 6).to_s }\n return array, remainder.to_s\n end",
"def formats_colors_hash(colors_hash)\n colors_hash['colors']\n end",
"def colored\n reparse\n parsed_colors[:string].apply_colors(parsed_colors[:colors])\n end",
"def target_color_list\n color_list = ''\n target_file = TARGET_FILE_NAME + NEW_TARGET_NAME_SUFFIX + JPG_FILE_SUFFIX\n img = Magick::ImageList.new(target_file)\n pixels = img.get_pixels(0, 0, img.columns, img.rows)\n pixels.each do |pixel|\n color_list = target_color_variation(pixel, color_list)\n end\n img.destroy!\n color_list.chop!\n color_list\n end",
"def red(string)\n colorize(string, 31)\n end",
"def choose_color\n all = self.class.shell(\"docker ps --format={{.Names}}\").compact\n\n if @project\n @prefix = \"#{@project}_\"\n all.reject! { |n| !n.start_with?(@prefix) }\n all = all.map { |cn| cn[@prefix.length..-1] }\n end\n\n # Find colors that are in use\n in_use = Set.new(all.map { |cn| cn.split('_')[0] }) & @palette\n\n # Find a color that isn't in use; default to the first color if\n # everything is already used\n @palette.detect { |c| !in_use.include?(c) } || @palette.first\n end",
"def colorQuest(color)\n color = color.downcase if color\n return \"7DC076EF\" if color == \"blue\"\n return \"089D5EBF\" if color == \"red\"\n return \"26CC4B56\" if color == \"green\"\n return \"6F697395\" if color == \"cyan\"\n return \"5CFA729D\" if color == \"magenta\"\n return \"135D47BF\" if color == \"yellow\"\n return \"56946F5A\" if color == \"gray\"\n return \"7FDE6B39\" if color == \"white\"\n return \"751272B7\" if color == \"purple\"\n return \"0E7F4F3F\" if color == \"orange\"\n return \"2D4A5694\" # Returns the default dark gray color if all other options are exhausted\nend",
"def computer_color\n\t valid_colors = [\"r\", \"y\", \"b\", \"w\", \"c\", \"g\"] \n\t return [valid_colors[rand(0..5)],valid_colors[rand(0..5)], valid_colors[rand(0..5)], valid_colors[rand(0..5)]]\n\tend",
"def colors_redish\n {\n :fillColor => '#ff4949',\n :strokeColor => '#365470',\n :pointColor => '#f7f7f1',\n :pointStrokeColor => '#fff'\n }\n end",
"def stopped_failed_colors\n { :light => \"F5D9C9\".to_color, :medium => \"F2F2E9\".to_color, :strong => \"AF3A00\".to_color }\n end",
"def bsd str\n str = str.dup.force_encoding 'US-ASCII' if str.respond_to? :force_encoding\n str.scan(/../).map do |colors|\n # Enumerator#with_index unavailable in 1.8.6\n acc = []\n colors.unpack('C*').each_with_index do |n, i|\n acc << case n\n when 65..72 then (n - 35 + (i*10)).to_s + ';1'\n when 97..104 then (n - 67 + (i*10)).to_s\n else (39 + (i*10)).to_s\n end\n end\n acc.join ';'\n end\n rescue\n []\n end",
"def named_colors\n @named_colors ||= YAML.load_file(File.expand_path('../data/colors.yml', __FILE__))\n end",
"def named\n [\"\\e[\", foreground_codes[colour], 'm'].join\n end",
"def correct_color?(array)\n @correct_colors = array & $code_strings\n end",
"def get_color(string)\n\tif $colors[string].nil?\n\t\t$colors[string] = $Colorfmt % $color\n unless $same_color\n $color += 1 \n end\n\tend\n\t$colors[string]\nend",
"def text_properties\n color_properties.select {|key, value| key == \"color\" }\n end",
"def context_list_brushes(pattern = nil)\n if pattern == nil\n return $gimp_iface.gimp_brushes_get_list(\"\")[1]\n elsif pattern.is_a? String\n return $gimp_iface.gimp_brushes_get_list(pattern)[1]\n else\n raise ArgumentError, \"context_list_brushes only accepts a string as an argument\"\n end\nend",
"def colors\n return\n end",
"def color\n @color ||= COLORS[label.length%COLORS.length].to_sym\n end",
"def color(color, str)\n raise \"[BUG] Unrecognized color #{color}\" unless COLORS[color]\n\n # Almost any real Unix terminal will support color,\n # so we just filter for Windows terms (which don't set TERM)\n # and not-real terminals, which aren't ttys.\n return str if ENV[\"TERM\"].nil? || ENV[\"TERM\"].empty? || !STDOUT.tty?\n return \"\\e[#{COLORS[color]}m#{str}\\e[0m\"\n end",
"def bright_color_methods\n color_methods.collect do |color|\n \"bright_#{color}\".to_sym\n end\n end",
"def get_colors_from_player(prompt)\n\t\twhile true\n\t\t\tcolors = encode_input Mastermind.get_user_input(prompt)\n\t\t\treturn colors unless colors.nil?\n\t\t\tputs Mastermind.color(INVALID_INPUT_MESSAGE, \"error\")\n\t\tend\n\tend",
"def colors_greenish\n {\n :fillColor => '#47a718',\n :strokeColor => '#365470',\n :pointColor => '#f7f7f1',\n :pointStrokeColor => '#fff'\n }\n end",
"def values\n [@red, @green, @blue]\n end",
"def generate_color\n colors= [\n \"#FF3AAE\",\n \"#B9D61A\",\n \"#952DE1\",\n \"#A4D789\",\n \"#51A3A3\",\n \"#D96C06\",\n \"#039be5\"\n ];\n\n @p_colors=[]\n cnt=Flavor.all.length\n colors.cycle(cnt) do |color|\n @p_colors.push(color)\n @cnt=1\n end\n end",
"def colors; end",
"def team_colors(teamName)\n teamSelect(teamName)[:colors]\n\n end",
"def random_colors\n color_array = []\n 4.times {color_array.push @colors.sample}\n color_array\n end",
"def get_col_colors\n col_colors = Hash.new \n col_colors[:throwing] = '#ccffff'\n col_colors[:hitting] = '#ffcccc'\n col_colors[:running] = '#ccccff'\n col_colors[:fielding] = '#ccffcc'\n col_colors[:none] = '#eeeeee'\n col_colors[:fundamentals] = '#C1C1C0'\n col_colors[:experience] = '#969696'\n col_colors\n end",
"def grep_color(regex, opts={} )\n deb \"string grep_color(regex: '#{regex}')\"\n color = opts[:color] || true # false\n verbose = opts[:verbose] || true # TODO false\n return red(self) if self.match(regex)\n return verbose ?\n self :\n ''\n end",
"def colors\n Hash[*resource_map.values.flatten.map {|h| [h.keys.first, h.values.first]}.flatten]\n end",
"def get_tags_for_user_for_contexts(user, contexts)\n contexts.map{|c| user.send c.to_sym }.flatten.map(&:name)\n end",
"def rgb_color\n [self.color_red, self.color_green, self.color_blue]\n end",
"def color_name\n fetch('color.name')\n end",
"def bg_color_methods\n color_methods.collect do |color|\n \"bg_#{color}\".to_sym\n end\n end",
"def color_schemes_for_select\n color_schemes = Settings.all_color_schemes + [('xmas' if is_holiday_season?)].compact\n color_schemes.map{ |s| [s.titleize.sub(/gray/,' Gray').sub(/Xmas/, \"Holidays\"), s] }\n end",
"def color(string, *colors)\n return string unless use_color?\n HighLine.Style(*colors).color(string)\n end",
"def names_to_code(colorname)\n \"\"\n end",
"def set_color(string, *colors)\n ansi_colors = colors.map { |color| lookup_color(color) }\n \"#{ansi_colors.join}#{string}#{CLEAR}\"\n end",
"def random_color\n String\n .colors\n .reject { |color| color == :default }\n .sample\n end",
"def highlights(field_name = nil)\n if field_name.nil?\n highlights_cache.values.flatten \n else\n highlights_cache[field_name.to_sym]\n end || []\n end",
"def much_green?(colors) ; colors[1] > 200 ; end",
"def decorate(string, *colors)\n return string if string.empty? || !enabled\n validate(*colors)\n ansi_colors = colors.map { |color| lookup(color) }\n ansi_string = \"#{ansi_colors.join}#{string}#{ANSI::CLEAR}\"\n if ansi_string =~ /(#{Regexp.quote(ANSI::CLEAR)}){2,}/\n ansi_string.gsub!(/(#{Regexp.quote(ANSI::CLEAR)}){2,}/, '')\n end\n matches = ansi_string.scan(/#{Regexp.quote(ANSI::CLEAR)}/)\n if matches.length >= 2\n ansi_string.sub!(/#{Regexp.quote(ANSI::CLEAR)}/, ansi_colors.join)\n end\n ansi_string\n end",
"def team_colors(team_name)\n game_hash.each do |location, team_data|\n if team_data[:team_name] == team_name\n return team_data[:colors].to_a \n end\n end\nend"
] |
[
"0.69695807",
"0.62754905",
"0.62739664",
"0.61538494",
"0.60605234",
"0.5847429",
"0.5790094",
"0.5787053",
"0.5745596",
"0.570813",
"0.56230557",
"0.55329263",
"0.5522375",
"0.5511621",
"0.54972005",
"0.5470148",
"0.5445049",
"0.54142094",
"0.5388828",
"0.5348647",
"0.5333352",
"0.5306555",
"0.53020716",
"0.52867347",
"0.52856153",
"0.5258508",
"0.5258508",
"0.5237788",
"0.5228869",
"0.5194887",
"0.5173346",
"0.51728225",
"0.51572376",
"0.51553065",
"0.5134079",
"0.5133646",
"0.5133646",
"0.5132075",
"0.5131562",
"0.5123382",
"0.5109749",
"0.50538206",
"0.50460035",
"0.50213385",
"0.50089353",
"0.49648345",
"0.49612322",
"0.49504766",
"0.49387494",
"0.49179378",
"0.49103522",
"0.49038565",
"0.4890639",
"0.48883468",
"0.48712757",
"0.4866347",
"0.4854798",
"0.48517507",
"0.484274",
"0.48390272",
"0.48385134",
"0.4832263",
"0.48234588",
"0.48216403",
"0.48201784",
"0.4817928",
"0.4811576",
"0.47859845",
"0.47827628",
"0.4780415",
"0.47711056",
"0.47660318",
"0.4764983",
"0.4764839",
"0.47617272",
"0.47601238",
"0.47455037",
"0.4741247",
"0.47392067",
"0.4727375",
"0.47222948",
"0.4715912",
"0.47131976",
"0.47120392",
"0.47110373",
"0.47091022",
"0.4692953",
"0.46870157",
"0.46841973",
"0.46784812",
"0.46749383",
"0.4674052",
"0.46728614",
"0.46725488",
"0.46684623",
"0.46641394",
"0.46525475",
"0.46510887",
"0.4650544",
"0.46503532"
] |
0.8192782
|
0
|
contextlistbrushes: returns an array of brush names. If given a string, the array only contains the names that contain that string.
|
def context_list_brushes(pattern = nil)
if pattern == nil
return $gimp_iface.gimp_brushes_get_list("")[1]
elsif pattern.is_a? String
return $gimp_iface.gimp_brushes_get_list(pattern)[1]
else
raise ArgumentError, "context_list_brushes only accepts a string as an argument"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def context_list_colors(pattern = nil)\n if pattern == nil\n return $gimp_iface.ggimp_rgb_list()[1]\n elsif pattern.is_a? String\n names = $gimp_iface.ggimp_rgb_list()[1]\n names.select!{|element| element.include?(pattern)}\n return names\n else\n raise ArgumentError, \"context_list_color_names only accepts a string as an argument\"\n end\nend",
"def has_boarder_with_name\n returnGroup = []\n group = query_root_node(\"fao:hasBorderWith/@rdf:resource\", @@NAMESPACES)\n if !group.nil?\n group.each do |entry|\n returnGroup << entry.to_s.split(\"/\")[7]\n end\n end\n returnGroup\n end",
"def colorNames\n colors = [\"red\", \"orange\", \"yellow\", \"green\", \"mint\", \"navy\", \"light blue\", \"lavender\", \"plum\", \"pink\"]; \n return colors;\n end",
"def context_get_brush()\n return $gimp_iface.gimp_context_get_brush()[0]\nend",
"def markerBrush _args\n \"markerBrush _args;\" \n end",
"def get_patterns\n patterns = BASE_PATTERNS\n # add the colour keywords. generate these from the colour wheel's constants\n colours = Yay::ColourWheel::all_names.join('|')\n patterns.unshift [:colour, Regexp.new(\"\\\\b(#{colours})\\\\b\", Regexp::IGNORECASE)]\n return patterns\n end",
"def deployed_stack_names\n stacks.map(&:name).compact\n end",
"def named\n [\"\\e[\", foreground_codes[colour], 'm'].join\n end",
"def branch_list\n raw_branches = `cd #{project_repo_path} && git branch -r`\n branches = raw_branches.split(/\\n/)\n return branches\n end",
"def blacklist *list\n @blacklist = (@blacklist + TinyPng::Path.get_all(list)).uniq\n end",
"def filter_branch_refs(refs)\n refs.select do |r|\n ref_name = r[\"ref\"]\n ref_name.start_with? \"refs/heads\"\n end\n end",
"def bsd str\n str = str.dup.force_encoding 'US-ASCII' if str.respond_to? :force_encoding\n str.scan(/../).map do |colors|\n # Enumerator#with_index unavailable in 1.8.6\n acc = []\n colors.unpack('C*').each_with_index do |n, i|\n acc << case n\n when 65..72 then (n - 35 + (i*10)).to_s + ';1'\n when 97..104 then (n - 67 + (i*10)).to_s\n else (39 + (i*10)).to_s\n end\n end\n acc.join ';'\n end\n rescue\n []\n end",
"def all_branches\n %x( git branch ).gsub!('*', '').gsub!(' ', '').split(\"\\n\")\nend",
"def names_list\n backend.queue_names\n end",
"def style_names\n styles.keys\n end",
"def pbPocketNames; return [\"\",\n _INTL(\"Items\"),\n _INTL(\"Medicine\"),\n _INTL(\"Jermo Balls\"),\n _INTL(\"TMs & HMs\"),\n _INTL(\"Bewwies\"),\n _INTL(\"Mail\"),\n _INTL(\"Battle Items\"),\n _INTL(\"Key Items\")\n]; end",
"def _context_set_brush!(brush_name)\n $gimp_iface.gimp_context_set_brush(brush_name)\nend",
"def get_color_list_name\n\t\t@availible_colors.keys[0]\n\tend",
"def branches\n zombie_check\n pattern = self.class.branch_pattern(:name => @name)\n @repo.branches.select{ |b| b.name =~ pattern }\n end",
"def report_breakpoints\n bps = Array.new\n @abnormal_chr.each_pair do |c, chr_list|\n chr_list.each do |chr|\n bps << chr.breakpoints\n end\n end\n bps.delete_if { |c| c.empty? }\n bps.flatten!\n bps = bps.uniq { |bp| bp.to_s }\n return bps\n end",
"def function_breakpoint_names\n result = @function_breakpoints.map(&:name)\n # Also add the debug::break function which mimics puppet-debug behaviour\n # https://github.com/nwops/puppet-debug#usage\n result << 'debug::break'\n end",
"def pixels_color_list\n color_list = ['', '', '', '', '', '', '', '']\n image_name_list = get_image_name_list PIXELS_PATH\n image_name_list.each do |image_name|\n color_list = pixel_color_list(image_name, color_list)\n end\n color_list.each(&:chop!)\n color_list\n # => like this: ['hogehoge.jpg,foobar.jpg', ... 'last.jpg,final.jpg']\n end",
"def all_breweries_in_us\n state_names.collect do |state|\n name_iterate_through_json(state)\n end\n end",
"def color_of_stack(stack)\n return stack.detect {|s| s != \"2\"}\nend",
"def names\n Tk.execute(:image, :names).to_a\n end",
"def product_colors(product)\n return product.color.split(',').map(&:to_s)\n end",
"def get_branch_names(repo)\n repo.heads.collect(&:name)\n end",
"def all_btypes_str\n services.map{|el| BILLING_TYPES.invert[el[:btype]].to_s}\n end",
"def remove_from_blacklist *list\n @blacklist = @blacklist - TinyPng::Path.get_all(list)\n end",
"def has_boarder_with_url\n returnGroup = []\n group = query_root_node(\"fao:hasBorderWith/@rdf:resource\", @@NAMESPACES)\n if !group.nil?\n group.each do |entry|\n returnGroup << entry.to_s\n end\n end\n returnGroup\n end",
"def possible_colors\n %w(R G B Y)\n end",
"def rated_styles\n beers.map{|b| b.style}.uniq\n end",
"def color_schemes_for_select\n color_schemes = Settings.all_color_schemes + [('xmas' if is_holiday_season?)].compact\n color_schemes.map{ |s| [s.titleize.sub(/gray/,' Gray').sub(/Xmas/, \"Holidays\"), s] }\n end",
"def excluded_brands(object)\n obs = order_brands(object)\n invalid_brand_sets.collect{|ibs| ibs if (ibs & obs).count == ibs.count}.flatten.compact\n end",
"def colors\n keys = []\n COLORS.each_key do | key |\n keys << key\n end\n keys\n end",
"def extract_branch_args(branch_args_str)\n branch_args_str.gsub(/\\[|\\]|\\\"/, \"\").split(\", \").map do |elm|\n elm.start_with?(\":\") ? elm.delete(\":\").to_sym : elm.to_i\n end\n end",
"def brands\n beers.collect{ |b| b.brand }\n end",
"def colors\n keys = []\n COLORS.each_key do |key|\n keys << key\n end\n keys\n end",
"def get_bcc_addresses\n\n return [] if self.bcc_addresses.nil?\n return self.bcc_addresses.split(Email::ADDRESS_SEPARATOR)\n end",
"def extract_branches(decorate, remove_head = true)\n return [] if decorate.blank?\n decorate.strip[1...-1].split(', ').\n reject { |b| remove_head && b == 'HEAD' || b =~ /^tag:\\s/ }\n end",
"def check_inside_Colors (string)\n Colors.include?(string)\n end",
"def all_branches\n @branches ||= git_call('branch -a').split(\"\\n\").collect { |s| s.strip }\n end",
"def bathing_water_names_json\n locations_as_json(all_bathing_waters.map { |bw| { label: bw.name, uri: bw.uri } })\n end",
"def retrieve_icon_theme_names(theme_location)\n pn_location = Pathname.new theme_location\n\n theme_dirs = pn_location.children.select { |d| d.directory? } # themes must be directory\n\n icon_themes = theme_dirs.select do |theme_dir|\n begin\n theme_dir unless theme_dir.children.any? { |c| c.basename.fnmatch \"cursors\" } # if there is a 'cursors' directory\n rescue\n puts \"Errors occurred while processing #{theme_dir}\"\n end\n end\n icon_themes.map! { |icon_theme_pn| icon_theme_pn.basename.to_s }\nend",
"def list\n Rugged::Branch.each_name(@git, :local).to_a\n end",
"def bright_color_methods\n color_methods.collect do |color|\n \"bright_#{color}\".to_sym\n end\n end",
"def get_bargraph()\n return(get_cmd('BG;',0.1,0.5,3).gsub(/^BG/,'').gsub(/;$/,'').to_i)\nend",
"def bwhere(arr)\nthose_b = []\n arr.each do |elem|\n if(elem.start_with?('B'))\n those_b.push(elem)\n end\n end\n those_b\nend",
"def find_named_objects(canvas)\n # Each object looks something like this\n # {\n # \"Bounds\": \"{{416, 66}, {320, 50}}\",\n # \"Class\": \"ShapedGraphic\",\n # \"ID\": 191531,\n # \"Layer\": 0,\n # \"Name\": \"ad1\",\n # },\n #\n # Groups have a \"Graphics\" sub-key.\n # Some objects have a GraphicsList subkey (Canvases do; not sure if others do).\n named_shapes = []\n to_visit = canvas[\"ExportShapes\"]\n to_visit = canvas[\"GraphicsList\"]\n until to_visit.empty? do\n current = to_visit.pop\n named_shapes << current if current[\"Name\"]\n to_visit.concat(current[\"Graphics\"]) if current[\"Graphics\"]\n to_visit.concat(current[\"GraphicsList\"]) if current[\"GraphicsList\"]\n end\n named_shapes\nend",
"def names()\n names = []\n names.push \"q-\"\n return names\n end",
"def highlights(field_name = nil)\n if field_name.nil?\n highlights_cache.values.flatten \n else\n highlights_cache[field_name.to_sym]\n end || []\n end",
"def get_patterns(pattern_string)\r\n split_and_strip(pattern_string, \";\").select do |name|\r\n name != \"\"\r\n end.map {|name| Regexp.new(name, true)}\r\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 blacklist\n Regexp.new \"(#{ BLACKLIST.join '|' })\"\n end",
"def desired_gems(list_of_gems)\n specified_gems = []\n list_of_gems.each do |g| \n if self.has_key? g\n specified_gems << self[g]\n else\n specified_gems << \"'#{g}' not found in any gemset\"\n end\n end\n\n specified_gems\n end",
"def bg_properties \n color_properties.select {|key, value| key.include?(\"background\") }\n end",
"def get_repository_project_branches(repoName)\n self.log(INFO, repoName, \"Searching for project branches...\")\n branches = []\n b=`git branch -r`\n b.each_line do |remoteBranch|\n remoteBranch.gsub!(/\\n/, \"\")\n if remoteBranch =~ /origin\\/project/\n localBranch = \"#{remoteBranch}\"\n localBranch.slice! \"origin/\"\n branches << localBranch.strip! || localBranch\n end\n end\n self.log(INFO, repoName, \"Project branches found : #{branches}\")\n self.log(INFO, repoName, \"Done.\")\n return branches\n end",
"def brands\n\t\t\tErp::Products::Brand.where(id: self.get_products_for_categories({}).select(:brand_id).where.not(brand_id: nil)).order(:name)\n\t\tend",
"def invalid_brand_set(brand_name_set)\n brand_name_set.collect do |brand_name|\n Spree::Taxon.where(name: brand_name, taxonomy_id: brand_taxonomy_id).limit(1).first\n end.flatten\n end",
"def bcc_addrs\n bcc ? [bcc].flatten : []\n end",
"def platform_font_paths\n fonts = find_os_font_files.reject do |f|\n f.downcase.include?('bold') ||\n f.downcase.include?('italic') ||\n f.downcase.include?('oblique') ||\n f.downcase.include?('narrow') ||\n f.downcase.include?('black')\n end\n fonts.sort_by { |f| f.downcase.chomp '.ttf' }\n end",
"def all_holidays_with_bbq(holiday_hash)\n # return an array of holiday names (as symbols) where supply lists\n # include the string \"BBQ\"\n holiday_names = []\n holiday_hash.each do |key, value|\n value.each do |key2, value2|\n holiday_names << key2 if value2.include?(\"BBQ\")\n end\n end\n holiday_names\nend",
"def foreground(fgcolor)\n fgcolor.split(/\\s+/).collect { |fg| names_to_code(fg) }.join(\"\")\n end",
"def filter property_blueprints, jobName\n imap = ignore_map jobName,true\n #STDERR.puts \"ignore map is:: \"+imap.to_s\n property_blueprints.select {|propblue|\n imap[propblue[\"name\"]].nil?\n }\n end",
"def colors\n color1 = UIColor.colorWithWhite(1.0, alpha: 0.2).CGColor\n color2 = UIColor.colorWithWhite(1.0, alpha: 0.1).CGColor\n color3 = UIColor.clearColor().CGColor\n color4 = UIColor.colorWithWhite(0.0, alpha: 0.1).CGColor\n \n [color1, color2, color3, color4]\n end",
"def snames(wb)\n return nil if (!wb.is_a?(WIN32OLE))\n result_a = Array.new\n wb.worksheets().each { |ws| result_a << ws.name }\n return result_a\nend",
"def colors_greenish\n {\n :fillColor => '#47a718',\n :strokeColor => '#365470',\n :pointColor => '#f7f7f1',\n :pointStrokeColor => '#fff'\n }\n end",
"def drawings\n Drawing.where(label: self)\n end",
"def list\n Dir.chdir @root do\n cmd = \"git branch\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n case stderr\n when /Not a git repository/\n raise NotARepositoryError\n else\n raise Error, stderr\n end\n end\n return stdout.split.map { |s|\n # Remove trailing/leading whitespace and astericks\n s.sub('*', '').strip\n }.reject { |s|\n # Drop elements created due to trailing newline\n s.size == 0\n }\n end\n end",
"def branches\n @branch_heads.keys\n end",
"def lyrical_themes(string)\n return nil if string.blank?\n\n string\n .split(\",\")\n .map(&:strip)\n end",
"def all_holidays_with_bbq(holiday_hash)\n # return an array of holiday names (as symbols) where supply lists\n # include the string \"BBQ\"\n bbq = []\n holiday_hash.each do |season, holidays|\n holidays.each do |event, gear|\n bbq << event if gear.include?(\"BBQ\")\n end\n end\n bbq\nend",
"def glyph_names(uri)\n images = files(uri).sort\n\n if images.empty?\n raise Compass::SpriteException, %Q{No glyph images were found matching \"#{uri}\" in the images path. Your current images path is: #{folder}}\n end\n\n images.map { |f| File.basename(f)[0..-5] }\n end",
"def local_branches(repo_path)\n result = []\n `(cd \"#{repo_path}\" && git branch | cut -c3-)`.split(\"\\n\").each do |branch|\n result << branch unless `(cd #{repo_path} && git log -1 --pretty=full #{branch})` =~ /git-svn-id:/\n end\n result\n end",
"def item_names\n @registry.keys\n end",
"def see_color(str)\n return 'red' if str.start_with?('red')\n return 'blue' if str.start_with?('blue')\n\n ''\n end",
"def all_holidays_with_bbq(holiday_supplies)\n holiday_supplies.map do |season, holiday_name|\n holiday_name.map do |holiday_name, supply_array|\n holiday_name if supply_array.include?(\"BBQ\")\n end\n end.flatten.compact\nend",
"def quoted_fonts\n quoted_fonts = @font_family.map do |font|\n if font.include?(' ') && font[0] != \"'\"\n \"'#{font}'\"\n else\n font\n end\n end\n\n quoted_fonts.join(', ')\n end",
"def not_green\n result = []\n status.each {|name, value|\n value[:name] = name\n result << value if value[:health] != :green\n }\n result\n end",
"def breweries_list \n Brewery.all.each.with_index(1) do |brewery, i|\n puts \"\"\n puts \"\"\n puts \"#{i}. #{brewery.name}\"\n end \n brewery_selection\n end",
"def theme_elements\n theme.split('-')\n end",
"def quote_names\n @feed_quote_map.values \n end",
"def bg_color_methods\n color_methods.collect do |color|\n \"bg_#{color}\".to_sym\n end\n end",
"def named_windows\n return [] unless children\n children.inject([]) do | names, child |\n names << child.name if child.name\n names += child.named_windows if child.kind_of?(Parent)\n names\n end\n end",
"def get_brands(opts = {})\n data, _status_code, _headers = get_brands_with_http_info(opts)\n return data\n end",
"def list_of_bays(string_of_bays)\n bays = string_of_bays.split(\", \")\n items = \"\"\n for x in bays\n items += item_at_bay(x) + \", \"\n end\n return items[0...-2]\nend",
"def provided_pools\n list = []\n @config[:pools].each do |pool|\n list << pool['name'] if pool['provider'] == name\n end\n list\n end",
"def pixel_color_list(image_name, color_list)\n array = Array.new(color_list)\n img = Magick::ImageList.new(image_name)\n pixels = img.get_pixels(0, 0, img.columns, img.rows)\n pixel_l = pixels[0].to_hsla[2].to_i\n array[pattern(pixel_l)] += File.basename(image_name) + EXPORT_LIST_SEPARATOR\n img.destroy!\n array\n end",
"def fonts_list\n initiate_library\n FONTS_LIBRARY.keys\n end",
"def all_themes\n Dir.chdir(wasko_directory) do |path|\n Dir[\"*.color\"].map do |filename|\n filename.gsub(/\\.color$/, \"\")\n end\n end\n end",
"def refs\n select_branches(git.grit.refs)\n end",
"def names\n fs = []\n %w( COARSE_GRAIN_BUFFER FINE_GRAIN_BUFFER FINE_GRAIN_SYSTEM ATOMICS ).each { |f|\n fs.push(f) if self.include?( self.class.const_get(f) )\n }\n return fs\n end",
"def bw_by_uri(uri)\n unless bws_by_uri[uri]\n options = { _properties: DETAILED_BW_PROPERTIES }\n url = relative_url(uri)\n bws_by_uri[uri] = api_get_resources(url, :item, BathingWater, options)\n end\n\n bws_by_uri[uri]\n end",
"def gem_tags\n exception.backtrace.map do |line|\n match = line.scan(%r{gems/[A-Za-z0-9\\-_.]+/gems/([A-Za-z\\-_]+)-([0-9.]+(\\.[a-z]+(\\.[0-9]+)?)?)/})\n match.empty? ? nil : match.flatten.compact.join(':')\n end.compact\n end",
"def all_name_strings\n names.collect { |a| a.name }\n end",
"def find_all_overriden_flavored_branches\n wrong_branch = Array.new\n Autoproj.manifest.each_package_definition do |pkg_def|\n pkg = pkg_def.autobuild\n next if !pkg.importer.kind_of?(Autobuild::Git)\n\n if package_in_flavor?(pkg, current_flavor.name) &&\n pkg.importer.branch != current_flavor.branch\n\n # We have to check whether it is expected to be using the flavor name as\n # its branch. Some packages are not ...\n #\n # To do so, we find the first package set that sets the branch to\n # ROCK_FLAVOR *and* verify that the same package set is not overriding\n # it to something else (to avoid false positives in case catch-all\n # entries apply)\n vcs = pkg_def.vcs.raw.group_by(&:first)\n branch_should_be_flavor_name = vcs.any? do |_, info|\n if !info.empty?\n info.all? do |entry|\n if entry.kind_of?(Array)\n vcs_options = entry[1]\n else\n vcs_options = entry.vcs\n end\n vcs_options['branch'] && vcs_options['branch'] =~ /ROCK_FLAVOR|ROCK_BRANCH/\n end\n end\n end\n if branch_should_be_flavor_name\n wrong_branch << pkg\n end\n end\n end\n wrong_branch\n end",
"def find_color_codes\n color_codes.uniq(&:numeric_code)\n end",
"def get_fg(str)\n\treturn Color.get_t(\"fg\")[str]\nend",
"def list_buzz\n url = \"#{@@request_url}/Biz.listBuzzBizs?appid=#{@@appid}\"\n data = get_xml(url)\n return [] unless data[\"status\"] == 'ok'\n return data[\"BizList\"][0][\"Biz\"]\n end",
"def get_pool_names(corpus = false)\n pool_name_array = []\n self.pools.each do |pool_name, pool|\n\tunless corpus == false && pool_name == '__Corpus__'\n\t pool_name_array.push(pool_name)\n\tend\n end\n return pool_name_array\n end"
] |
[
"0.59051013",
"0.49843502",
"0.49527097",
"0.48982787",
"0.48217726",
"0.47377667",
"0.471358",
"0.47100002",
"0.46386588",
"0.4580997",
"0.45541644",
"0.45173135",
"0.4503447",
"0.44865084",
"0.44663262",
"0.44300905",
"0.44162086",
"0.43835965",
"0.4378289",
"0.43639383",
"0.43544143",
"0.43518725",
"0.43509758",
"0.43253073",
"0.43102822",
"0.43039846",
"0.43026537",
"0.42871296",
"0.4273091",
"0.42728302",
"0.42599475",
"0.42591065",
"0.42550948",
"0.42520526",
"0.42373666",
"0.42152432",
"0.42101943",
"0.42068064",
"0.42017248",
"0.4196884",
"0.41926995",
"0.4185997",
"0.41850573",
"0.41830978",
"0.41807744",
"0.4173785",
"0.41699517",
"0.4161619",
"0.4150536",
"0.41497943",
"0.41437835",
"0.41340864",
"0.4120056",
"0.4116071",
"0.41048735",
"0.41014263",
"0.40962154",
"0.40957367",
"0.40947857",
"0.40697184",
"0.40633503",
"0.40608296",
"0.40597016",
"0.40590897",
"0.40588495",
"0.40571666",
"0.4047644",
"0.40399873",
"0.40346512",
"0.402602",
"0.4016782",
"0.4014426",
"0.39995843",
"0.3999534",
"0.39879358",
"0.39853743",
"0.39824417",
"0.39777827",
"0.39767206",
"0.3968121",
"0.3966386",
"0.39645073",
"0.396095",
"0.39609075",
"0.3957917",
"0.39506102",
"0.39466953",
"0.39317048",
"0.39286104",
"0.39203158",
"0.3919511",
"0.39194074",
"0.391673",
"0.39126495",
"0.3911551",
"0.39015508",
"0.3901434",
"0.38868693",
"0.38859522",
"0.38857573"
] |
0.7297061
|
0
|
This might want to be included in a Color subclass instead of being a normal method
|
def color_name_to_rgb(name)
return $gimp_iface.ggimp_rgb_parse(name)[0]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def color(color); end",
"def color_methods; end",
"def r; self.color.r end",
"def color; end",
"def color; end",
"def color; end",
"def rgb_color; end",
"def colorized?; end",
"def colors; end",
"def rgb\n raise NotImplementedError, 'Overwrite the method in a subclass'\n end",
"def setcolorrep(*)\n super\n end",
"def red; end",
"def red; end",
"def hsla_color; end",
"def normal_color; return Color.normal_color; end",
"def colorize!(color_code) \"#{COLORS[color_code]}#{self.to_s}\\e[0m\" ; end",
"def color\n Color.new\n end",
"def colors\n return\n end",
"def red\n end",
"def hex_color\n self.color_hex\n end",
"def green=(_); end",
"def rgb(*args); end",
"def rgb(*args); end",
"def blue=(_); end",
"def red=(_); end",
"def green; end",
"def green; end",
"def blue; end",
"def blue; end",
"def normal_color\n #return Color.new(255,255,255)\n end",
"def color\n return @color\n end",
"def color\n @color\n end",
"def color\n @color\n end",
"def symbol\n @color \n end",
"def color_field(object_name, method, options = T.unsafe(nil)); end",
"def background_color(color); end",
"def chco\n (foreground || \"FFFFFF\") + \",\" + super\n end",
"def blue = \"\\e[36m#{self}\\e[0m\"",
"def back_color1\n Color.new(0, 0, 0, 192)\n end",
"def back_color1\n Color.new(0, 0, 0, 192)\n end",
"def back_color2\n Color.new(0, 0, 0, 0)\n end",
"def back_color2\n Color.new(0, 0, 0, 0)\n end",
"def scan_for_colors; end",
"def color\n @color;\n end",
"def text_color(n)\n case n\n when Integer then super(n)\n when Array then Color.new(*n)\n when Color then n\n else super(0)\n end\n end",
"def color(*values); end",
"def color(*values); end",
"def rgb\n self\n end",
"def calculate_color\n\n self.color || color_by_title\n end",
"def red\n colorize(:red)\nend",
"def color_name\n COLOR[self.color.to_s]\n end",
"def lbColor _obj, _args\n \"_obj lbColor _args;\" \n end",
"def r\n\t\t\tColor.r(@color)\n\t\tend",
"def setfillcolorind(*)\n super\n end",
"def pintarBorde(color)\n raise NotImplementedError.new\n end",
"def colorize!; @colors = true; end",
"def rgb_color\n [self.color_red, self.color_green, self.color_blue]\n end",
"def color\n\t\treturn @color\n\t\t\n\tend",
"def red\n colorize(31)\n end",
"def text_color(param)\n begin \n colour = case param\n when Integer then super(param) rescue normal_color\n when Symbol then send(param) rescue normal_color\n when Array then Color.new(*param) rescue normal_color\n else\n normal_color\n end\n end\n colour.is_a?(Color) ? colour : normal_color\n end",
"def blue\n end",
"def color\n @color\nend",
"def inqcolormap\n inquiry_int { |pt| super(pt) }\n end",
"def auxiliary_colour\n @cr[0xe] >> 4\n end",
"def binary\n r, g, b, a = self.to_a\n sum = r + g + b\n return (sum < 382)? self.new_extended_color([0,0,0,a]) : self.new_extended_color([255,255,255,a])\n end",
"def color\n @red ? \"R\" : \"B\"\n end",
"def hex_color(args = T.unsafe(nil)); end",
"def new_extended_color(*color)\n Sketchup::Color.new(*color).extend(AE::Color) # TODO: test this, changed from AE::Color\n end",
"def g\n\t\t\tColor.g(@color)\n\t\tend",
"def getColor(c)\n if c == \"r\" then return :red\n elsif c == \"b\" then return :blue\n elsif c == \"g\" then return :green\n elsif c == \"y\" then return :yellow\n elsif c == \"c\" then return :cyan\n elsif c == \"m\" then return :magenta\n end\nend",
"def get_color\n @color\n end",
"def red\n\t\tlight COLOR_KEY_RED\n\tend",
"def green\n colorize(32)\n end",
"def green\n end",
"def bright; end",
"def bright; end",
"def inqfillcolorind\n inquiry_int { |pt| super(pt) }\n end",
"def inqfillcolorind\n inquiry_int { |pt| super(pt) }\n end",
"def getDrawColor()\n return @drawColor\n end",
"def purple\n colorize(35)\n end",
"def bg_red; use_code(41) end",
"def color\n @color ||= COLORS[label.length%COLORS.length].to_sym\n end",
"def cyan; if @options[:colors]; \"\\e[1;36m\" else \"\" end end",
"def color?\n false\n end",
"def get_color_code\n\t\t{ r: @term_hex[0], g: @term_hex[1], b: @term_hex[2], alpha: @term_hex[-1] }\n\tend",
"def fill_color(color)\n end",
"def color\n return @color\n end",
"def color\n return @color\n end",
"def inqlinecolorind\n inquiry_int { |pt| super(pt) }\n end",
"def color_type\n @src.color_model.has_alpha ? ARGB : RGB\n end",
"def color_type\n @src.color_model.has_alpha ? ARGB : RGB\n end",
"def initialize\r\n\t\t@color =\"platinum\"\r\n\tend",
"def method_missing(name, *args)\n if @colours.include? name\n \"#{@colours[name]}#{args[0]}\\033[0m\"\n else\n \"#{@default}#{args[0]}\\033[0m\"\n end\n end",
"def a\n\t\t\tColor.a(@color)\n\t\tend",
"def red?\n not black?\n end",
"def method_missing(method_name, *arguments, &block)\n if @@color_codes.keys.include? method_name.to_sym\n self.class.create_colors\n self.send(method_name.to_s)\n else\n super\n end\n end",
"def normal_color\n return Color.new(255, 255, 255)\n end",
"def rgb_code(red, green, blue, background = T.unsafe(nil)); end",
"def rgb_code(red, green, blue, background = T.unsafe(nil)); end",
"def initialize(red, green, blue, alpha = 1.0); end",
"def color_valid?(_clr)\n true\n end"
] |
[
"0.75766903",
"0.7499583",
"0.74536204",
"0.73777556",
"0.73777556",
"0.73777556",
"0.72055334",
"0.71997905",
"0.713372",
"0.7105647",
"0.6982597",
"0.6835049",
"0.6835049",
"0.67792726",
"0.6764322",
"0.66683996",
"0.6649232",
"0.66434807",
"0.6635852",
"0.6630204",
"0.6627703",
"0.6616356",
"0.6616356",
"0.6588561",
"0.65776503",
"0.6555488",
"0.6555488",
"0.65479743",
"0.65479743",
"0.6528833",
"0.65100205",
"0.6502945",
"0.6502945",
"0.6499391",
"0.6488961",
"0.64732134",
"0.6468546",
"0.646384",
"0.64633656",
"0.64633656",
"0.6446014",
"0.6446014",
"0.64388645",
"0.63823915",
"0.6381616",
"0.63796186",
"0.63796186",
"0.63777834",
"0.63774383",
"0.6361345",
"0.6360342",
"0.63569903",
"0.6352485",
"0.6346237",
"0.63436335",
"0.6318118",
"0.63165134",
"0.6306381",
"0.62962765",
"0.625973",
"0.6258436",
"0.62539935",
"0.62514865",
"0.62477183",
"0.623966",
"0.62317115",
"0.62159556",
"0.6185147",
"0.61828935",
"0.6168179",
"0.6164318",
"0.614438",
"0.61354715",
"0.6128766",
"0.61249447",
"0.61249447",
"0.6124705",
"0.6124705",
"0.6116883",
"0.60903",
"0.6082198",
"0.60733783",
"0.60612863",
"0.606119",
"0.60488254",
"0.6042835",
"0.60331213",
"0.60331213",
"0.6019546",
"0.6014449",
"0.6014449",
"0.60129756",
"0.60090375",
"0.6005725",
"0.6000001",
"0.599434",
"0.5989664",
"0.59890616",
"0.59890616",
"0.5977812",
"0.5972612"
] |
0.0
|
-1
|
assumes sha1 missing size checks
|
def pkcs1 m, length
# RFC 3447 / 9.2.
hash = Digest::SHA1.digest m.map(&:chr).join
# RFC 3447 / page 43
digest_info = [0x30, 0x21, 0x30, 0x09, 0x06,
0x05, 0x2b, 0x0e, 0x03, 0x02,
0x1a, 0x05, 0x00, 0x04, 0x14].map(&:chr).join
to_pad = digest_info + hash
to_pad = to_pad.bytes
[0, 1] + [0xff] * (length - to_pad.length - 3) + [0] + to_pad
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sha1; end",
"def sha1; end",
"def sha1?; @sha1; end",
"def 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 invalid_sha?(sha)\n sha.size != 40\n end",
"def sha1\n @sha1 ||= digest(path, :sha1)\n end",
"def to_sha1(length = 40)\n Digest::SHA1.hexdigest(self)[0,length]\n end",
"def findSmallHash(f)\r\n return Digest::SHA1.file(f).hexdigest()\r\nend",
"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 sha1(name)\n Digest::SHA1.file(path(name)).hexdigest\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 file_sha1\n Digest::SHA1.file(self).hexdigest\n end",
"def verify_sha1_hash(filename, hash)\n require 'digest/sha1'\n compare_hash(filename, Digest::SHA1, hash)\n end",
"def check_sha1(filename, sha1_hash)\n actual_hash = Digest::SHA1.hexdigest(::IO.binread(filename))\n return actual_hash == sha1_hash\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(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 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 sha2?; @sha2; end",
"def sha256; end",
"def checksums; end",
"def file_remote_digestsha1(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::SHA1.hexdigest(data)\n end\n return chksum\n end",
"def sha1(string)\n\tOpenSSL::Digest::SHA1.hexdigest(string)\nend",
"def generate_sha(file)\n\n sha1 = Digest::SHA1.file file\n return sha1\n\nend",
"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 needs_md5sums\n false\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 sha(str)\n Digest::SHA1.hexdigest(str)[0, 40]\n end",
"def hex_sha1(s)\n binb2hex(core_sha1(str2binb(s), s.length * $chrsz))\n end",
"def sha1(data)\n @connection.sha1(data)\n end",
"def sha512?; @sha512; end",
"def hash_file(name, length)\n pieces = String.new\n file = ::File.open(name, 'r')\n pieces << Digest::SHA1.digest(file.read(length)) until file.eof?\n file.close\n pieces\n end",
"def hex_sha1(s)\n return binb2hex(core_sha1(str2binb(s), s.length * $chrsz))\n end",
"def digest\n Digest::SHA1.hexdigest(self)\n end",
"def same_byte_length?(hash1, hash2)\n hash1.to_s.length == hash2.to_s.length\n end",
"def createSHAHash(data)\n\t\treturn Digest::SHA1.digest(data)\n\tend",
"def sha1_fingerprint\n @sha1_fingerprint ||= @node['sha1Fingerprint']\n end",
"def sha1_hex\n Digest::SHA1.hexdigest(salted_name)\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 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 upstream_sha1=( checksum )\n @digest = Crate::Digest.sha1( checksum )\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 findLargeHash(f)\r\n incr_digest = Digest::SHA1.new()\r\n file = File.open(f, \"rb\")\r\n count = 0\r\n file.each_line do |line|\r\n if count == 1\r\n incr_digest << line\r\n end\r\n count = count + 1\r\n if count >= 2\r\n break\r\n end\r\n end\r\n return incr_digest.hexdigest + File.size(f).to_s(16)\r\nend",
"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 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 sha1\n Digest::SHA1.hexdigest(subject.identification + 0.chr + source)\n end",
"def hashed_content\n @hashed_content ||= valid? ? Digest::SHA1.hexdigest(content) : nil \n end",
"def compute_hash( path )\n res = '0'\n autorelease_pool { res = NSData.sha1FromContentsOfFile(path) }\n res\n end",
"def path_from_sha1(sha1)\n raise NotImplementedError, 'Implemented in subclasses. See filesystem_pool for example.'\n end",
"def sha1\n RunLoop::Directory.directory_digest(path)\n end",
"def to_sha1(salt = \"\")\n hashsum(:sha1, salt)\n end",
"def hash(handle, offset, length, block_size=0)\n if block_size != 0 && block_size < 255\n block_size = 256\n end\n send_request(FXP_EXTENDED, :string, \"check-file-handle\", :string, handle, :string, \"md5,sha256,sha384,sha512\", :int64, offset, :int64, length, :long, block_size)\n end",
"def fedora_shasum\n \"urn:sha1:#{Digest::SHA1.file(file_path)}\"\n end",
"def hash_byte_size\n return 20\n end",
"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 hash_if_too_short(iv)\n return if iv.nil?\n iv.size < 16 ? Digest::SHA1.hexdigest(iv.to_s) : iv.to_s\n end",
"def checksum(path)\n FileChecksum.new(path, Digest::SHA1).checksum\n end",
"def checksum\n end",
"def validate_image_md5sum\n result = true\n if upload_md5sum.present? && save_to_temp_file\n sum = File.open(upload_temp_file) do |f|\n Digest::MD5.hexdigest(f.read)\n end\n if sum == upload_md5sum\n result = true\n else\n errors.add(:image, :validate_image_md5_mismatch.\n t(actual: sum.split.first, expect: upload_md5sum))\n result = false\n end\n end\n result\n end",
"def create_hash(user_pw)\n return Digest::SHA1.hexdigest(user_pw)\nend",
"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 digest( str )\n Digest::SHA1.hexdigest( str )\n end",
"def verify_checksum(filename)\n if options[:sha256]\n verify_sha256_hash(filename, options[:sha256])\n elsif options[:sha1]\n verify_sha1_hash(filename, options[:sha1])\n end\n end",
"def cram_md5_challenge; end",
"def checksum(hex)\n sha256(sha256(hex))[0...8]\nend",
"def check_for_duplicate_sha1\n # Generate the SHA1.\n self.sha1 = Digest::SHA1.hexdigest(raw_eml)\n\n old_mail_log = nil\n user_thread.schedule do\n old_mail_log = user.mail_logs.find_by_sha1(sha1)\n end\n\n if old_mail_log\n Log.librato(:count, \"system.process_uid.duplicate_sha1\", 1)\n return false\n else\n return true\n end\n end",
"def sha_hash (arg)\r\n Digest::SHA2.hexdigest(arg)\r\n end",
"def update!(**args)\n @sha1 = args[:sha1] unless args[:sha1].nil?\n end",
"def create_sha1_id\n self.sha1_id = Digest::SHA1.hexdigest(\"#{self.id}-#{self.contactable_type}-#{self.contactable_id}\")\n end",
"def md5?; @md5; end",
"def short_sha\n self.sha[0..6]\n end",
"def integrity(path)\n \"sha256-#{Base64.encode64(Digest::SHA256.digest(File.read(path))).chomp}\"\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 sha1\n Digest::SHA1.hexdigest self.record\n end",
"def check_signature(body)\n received_signature = request.env['HTTP_X_HUB_SIGNATURE'] || ''\n signature = 'sha1=' + hmac_sha1(settings.github_secret, body)\n\n if !Rack::Utils.secure_compare(signature, received_signature)\n build_failed('signature mismatch')\n end\nend",
"def empty_sha\n @empty_sha ||= git.set(:blob, '')\n end",
"def filehash(filepath)\n sha1 = Digest::SHA1.new\n File.open(filepath) do|file|\n buffer = ''\n # Read the file 512 bytes at a time\n while not file.eof\n file.read(512, buffer)\n sha1.update(buffer)\n end\n end\n return sha1.to_s\n end",
"def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end",
"def shortsha(n = 7)\n @sha.slice(0,n)\n end",
"def chkall\n (1..@@pow2_N).to_a.each do |i|\n h = sha32b(\"#{i}\")\n @allhash[h] = 0 if !@allhash[h]\n @allhash[h] += 1\n end\n @allhash.size\n end",
"def test_simpler_problem\n # the 'key' + the original message:\n d1 = SHA1.exec(\"AB\")\n state = [d1].pack(\"H*\").unpack(\"N5\")\n\n # at no point does the above `state` appear in this:\n # SHA1.exec(\"ABC\")\n\n # but, it does is this:\n m2 = \"AB\" + _md_padding(\"AB\") + \"C\"\n d2 = SHA1.exec(m2)\n\n # the trick here, it seems, is that if you start w/ your own state var\n # (instead of the magic numbers), then you need to take it upon yourself\n # to make sure that the overall padding works out correctly; otherwise,\n # the padding algorithm that normally runs at the start will have no idea\n # how to take into account the padding that is in the given state. so i'm\n # providing it manually\n # note how \"prepadded\" is set to true, and the overall padding is set\n # manually\n d3 = SHA1.exec(\"C\" + _md_padding(m2), state, true)\n\n assert_equal d2, d3\n end",
"def sha1_base64\n str = Base64.encode64(Digest::SHA1.digest(salted_name)).strip\n str.tr('+/', '-_').gsub(/=/,'')\n end",
"def calculate_unique_hash\n unique = ''\n unique += self.content if self.content.present?\n unique += self.summary if self.summary.present?\n unique += self.title if self.title.present?\n self.unique_hash = Digest::MD5.hexdigest unique\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 quick_verify\n cached_md5 == remote_md5 and remote_md5 == md5\n end",
"def hmac_sha1 key, signature\n\t\trequire 'openssl'\n\t\treturn OpenSSL::HMAC.hexdigest('sha1', key, signature)\n\tend",
"def create_hash(phrase = '')\n Digest::SHA2.hexdigest(phrase) unless phrase.blank?\n end",
"def verify_compact_signature(signature, hash)\n raise BTCError, \"Not implemented\"\n end",
"def hash_length\n super\n end",
"def hash\r\n # TODO what if file is empty?\r\n @hash ||= Digest::SHA1.file(File.join(@directory, @filename)).hexdigest\r\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 hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end"
] |
[
"0.7676289",
"0.7676289",
"0.74500436",
"0.7223365",
"0.7059129",
"0.7059129",
"0.7011747",
"0.6944613",
"0.67889655",
"0.67879575",
"0.6760845",
"0.6663173",
"0.6662913",
"0.6655506",
"0.6651407",
"0.6619044",
"0.6598691",
"0.6537724",
"0.6508755",
"0.6500629",
"0.6485158",
"0.6482486",
"0.6461454",
"0.6400867",
"0.638435",
"0.63733166",
"0.636459",
"0.6327249",
"0.6324717",
"0.631554",
"0.6304101",
"0.62874174",
"0.62615496",
"0.6249862",
"0.62137747",
"0.6188302",
"0.61420083",
"0.61362696",
"0.61040807",
"0.61006653",
"0.6086753",
"0.60741323",
"0.6061048",
"0.6046398",
"0.6011675",
"0.6001794",
"0.5993372",
"0.5991908",
"0.59910774",
"0.5936212",
"0.5931509",
"0.59279644",
"0.5901112",
"0.5881364",
"0.5865302",
"0.5838606",
"0.5830328",
"0.58285946",
"0.5825691",
"0.5813456",
"0.57986",
"0.5796331",
"0.5757632",
"0.57531184",
"0.5750529",
"0.5747391",
"0.5732557",
"0.57266676",
"0.5710586",
"0.5702011",
"0.57000077",
"0.5699548",
"0.5691928",
"0.5688808",
"0.5688114",
"0.5686609",
"0.5663745",
"0.5652517",
"0.56492096",
"0.56358594",
"0.56251514",
"0.5621774",
"0.561973",
"0.561863",
"0.5616577",
"0.5613998",
"0.56093925",
"0.56084645",
"0.5601631",
"0.55998576",
"0.558514",
"0.5584275",
"0.55759215",
"0.5565349",
"0.5559627",
"0.5559627",
"0.5559627",
"0.5559627",
"0.5559627",
"0.5559627",
"0.5559627"
] |
0.0
|
-1
|
RFC 3447 / 8.2.1. i assume SHA1 as the hash function used
|
def rsa_sign arr
# RFC 3447 / 9.2.
hash = Digest::SHA1.digest arr.map(&:chr).join
# RFC 3447 / page 43
digest_info = [0x30, 0x21, 0x30, 0x09, 0x06,
0x05, 0x2b, 0x0e, 0x03, 0x02,
0x1a, 0x05, 0x00, 0x04, 0x14].map(&:chr).join
# i don't do the padding, openssl does that for me
# i'll reimplement RSA later on
signature = HOST_KEY.private_encrypt(digest_info + hash)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sha1; end",
"def sha1; end",
"def sha1=(_); end",
"def hex_sha1(s)\n binb2hex(core_sha1(str2binb(s), s.length * $chrsz))\n end",
"def sha1?; @sha1; end",
"def digest( str )\n Digest::SHA1.hexdigest( str )\n end",
"def hex_sha1(s)\n return binb2hex(core_sha1(str2binb(s), s.length * $chrsz))\n end",
"def sha1(string)\n\tOpenSSL::Digest::SHA1.hexdigest(string)\nend",
"def sha256; end",
"def digest\n Digest::SHA1.hexdigest(self)\n end",
"def sha(str)\n Digest::SHA1.hexdigest(str)[0, 40]\n end",
"def sha1_hex\n Digest::SHA1.hexdigest(salted_name)\n end",
"def sha_hash (arg)\r\n Digest::SHA2.hexdigest(arg)\r\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\n @sha1 ||= digest(path, :sha1)\n end",
"def sha512; end",
"def createSHAHash(data)\n\t\treturn Digest::SHA1.digest(data)\n\tend",
"def to_sha1(length = 40)\n Digest::SHA1.hexdigest(self)[0,length]\n end",
"def secure_hash(string)\n\t Digest::SHA2.hexdigest(string)\n\tend",
"def short_sha1(length=7)\n sha1[0, length]\n end",
"def short_sha1(length=7)\n sha1[0, length]\n end",
"def sha1_fingerprint\n @sha1_fingerprint ||= @node['sha1Fingerprint']\n end",
"def sha1\n Digest::SHA1.hexdigest(subject.identification + 0.chr + source)\n end",
"def hash(message)\n return Digest::SHA1.hexdigest(message)\n end",
"def sha2?; @sha2; 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 create_hash(user_pw)\n return Digest::SHA1.hexdigest(user_pw)\nend",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def digest\n Digest::SHA2.new\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 hash(*) 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 digest_hash_function\n decode[:hash_function]\n end",
"def verify_sha1_hash(filename, hash)\n require 'digest/sha1'\n compare_hash(filename, Digest::SHA1, hash)\n end",
"def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end",
"def default_hash_function(plain_token)\n ::Digest::SHA256.hexdigest plain_token\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 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 sha1_base64\n str = Base64.encode64(Digest::SHA1.digest(salted_name)).strip\n str.tr('+/', '-_').gsub(/=/,'')\n end",
"def sha1(data)\n @connection.sha1(data)\n end",
"def hexdigest!()\n #This is a stub, used for indexing\n end",
"def digest\n Digest::SHA1.hexdigest(@pub.to_der)\n end",
"def to_sha1(salt = \"\")\n hashsum(:sha1, salt)\n end",
"def secure_hash(string)\n Digest::SHA2.hexdigest(string)\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 secure_hash(string)\n\t\t\tDigest::SHA2.hexdigest(string)\n\t\tend",
"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 digest(data); end",
"def hex(string)\n Digest::SHA1.hexdigest(string)\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 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 secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end",
"def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end",
"def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end",
"def identify_hash(hash)\n hash = hash.to_s.strip\n case\n # operating systems\n when hash.start_with?('$1$') && hash.length == 34\n return 'md5'\n when hash.start_with?('$2$') && hash.length == 59,\n hash.start_with?('$2a$') && hash.length == 60,\n hash.start_with?('$2b$') && hash.length == 60,\n hash.start_with?('$2x$') && hash.length == 60,\n hash.start_with?('$2y$') && hash.length == 60\n return 'bf' #bcrypt\n when hash.start_with?('$5$') && hash.split('$').last.length == 43\n # we dont check full length since it may have 'rounds=' in the [1] area or not with an arbitrary length number\n return 'sha256,crypt'\n when hash.start_with?('$6$') && hash.split('$').last.length == 86\n # we dont check full length since it may have 'rounds=' in the [1] area or not with an arbitrary length number\n return 'sha512,crypt'\n when hash.start_with?('@S@') && hash.length == 148\n return 'qnx,sha512'\n when hash.start_with?('@s@') && hash.length == 84\n return 'qnx,sha256'\n when hash.start_with?('@m@') && hash.length == 52\n return 'qnx,md5'\n when hash.start_with?('_') && hash.length == 20\n return 'des,bsdi,crypt'\n when hash =~ /^[\\.\\/\\dA-Za-z]{13}$/ # hash.length == 13\n return 'des,crypt'\n when hash =~ /^\\$dynamic_82\\$[\\da-f]{128}\\$HEX\\$[\\da-f]{32}$/ # jtr vmware ldap https://github.com/rapid7/metasploit-framework/pull/13865#issuecomment-660718108\n return 'dynamic_82'\n when hash.start_with?(/{SSHA}/i)\n return 'ssha'\n when hash.start_with?(/{SHA512}/i)\n return 'raw-sha512'\n when hash.start_with?(/{SHA}/i)\n return 'raw-sha1'\n when hash.start_with?(/{MD5}/i)\n return 'raw-md5'\n when hash.start_with?(/{SMD5}/i)\n return 'smd5'\n when hash.start_with?(/{SSHA256}/i)\n return 'ssha256'\n when hash.start_with?(/{SSHA512}/i)\n return 'ssha512'\n # windows\n when hash.length == 65 && hash =~ /^[\\da-fA-F]{32}:[\\da-fA-F]{32}$/ && hash.split(':').first.upcase == 'AAD3B435B51404EEAAD3B435B51404EE'\n return 'nt'\n when hash.length == 65 && hash =~ /^[\\da-fA-F]{32}:[\\da-fA-F]{32}$/\n return 'lm'\n # OSX\n when hash.start_with?('$ml$') && hash.split('$').last.length == 256\n return 'pbkdf2-hmac-sha512,osx' # 10.8+\n when hash =~ /^[\\da-fA-F]{48}$/ # hash.length == 48\n return 'xsha,osx' # 10.4-10.6\n # databases\n when hash.start_with?('0x0100') && hash.length == 54\n return 'mssql05'\n when hash.start_with?('0x0100') && hash.length == 94\n return 'mssql'\n when hash.start_with?('0x0200') && hash.length == 142\n return 'mssql12'\n when hash =~ /^[\\da-f]{16}$/ # hash.length == 16\n return 'mysql' # mysql323 (pre 4.1)\n when hash.start_with?('*') && hash.length == 41\n return 'mysql-sha1' # mysql 4.1+\n when hash.start_with?('md5') && hash.length == 35\n return 'postgres'\n when hash =~ /^[\\da-fA-F]{16}$/\n return 'des,oracle' # pre 11g\n when hash =~ /^S:[\\dA-F]{60}$/\n return 'raw-sha1,oracle11'\n when hash =~ /^S:[\\dA-F]{60};H:[\\dA-F]{32};T:[\\dA-F]{160}$/\n return 'raw-sha1,oracle'\n when hash =~ /^H:[\\dA-F]{32};T:[\\dA-F]{160}$/\n return 'pbkdf2,oracle12c'\n # webapps\n when hash.start_with?('$P$') && hash.length == 34,\n hash.start_with?('$H$') && hash.length == 34\n return 'phpass' # wordpress, drupal, phpbb3 (H not P)\n when hash.start_with?('$ml$') && hash.length == 203\n return 'PBKDF2-HMAC-SHA512'\n when hash.start_with?('{PKCS5S2}') && hash.length == 73\n return 'PBKDF2-HMAC-SHA1'\n when hash.start_with?('$B$') && hash.split('$').last.length == 32\n return 'mediawiki'\n # mobile\n when hash =~/^[A-F0-9]{40}:[a-f0-9]{16}$/\n return 'android-sha1'\n when hash =~/^[A-F0-9]{32}:[a-f0-9]{16}$/\n return 'android-md5'\n # other\n when hash =~ /^<\\d+@.+?>#[\\w]{32}$/\n return 'hmac-md5'\n when hash.length == 114 && hash.start_with?('$M$')\n return 'F5-Secure-Vault'\n when hash =~ /^M\\$[[:print:]]+#[\\da-fA-F]{32}(?:(?::[[:print:]]*$)|$)/\n return 'mscash'\n when hash =~ /^\\$DCC2\\$\\d+#[[:print:]]+#[\\da-fA-F]{32}(?:(?::[[:print:]]*$)|$)/\n return 'mscash2'\n end\n ''\nend",
"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 hash_from_payload(payload)\n Digest::SHA256.digest(Digest::SHA256.digest( payload )).reverse.unpack(\"H*\")[0]\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 findSmallHash(f)\r\n return Digest::SHA1.file(f).hexdigest()\r\nend",
"def sha1_fingerprint\n Digest::SHA1.hexdigest(ssh_public_key_conversion).gsub(/(.{2})(?=.)/, '\\1:\\2')\n end",
"def computed_sha(string)\n provider.computed_sha(string)\n end",
"def sha1(name)\n Digest::SHA1.file(path(name)).hexdigest\n end",
"def hexdigest\n @digest.unpack('H*'.freeze).first\n end",
"def digest_name(name)\n Digest::SHA2.hexdigest(short_name(name))[0..24]\n end",
"def dave(new_str)\r\n new_hash = Digest::SHA256.hexdigest new_str\r\n return new_hash\r\nend",
"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 digest\n OpenSSL::HMAC.digest(\n OpenSSL::Digest.new('sha1'),\n secret,\n document\n )\n end",
"def hash_file(name, length)\n pieces = String.new\n file = ::File.open(name, 'r')\n pieces << Digest::SHA1.digest(file.read(length)) until file.eof?\n file.close\n pieces\n end",
"def hash_secure\n # TODO: Use sha256 from openssl to create a cryptographically secure hash.\n # Credit cards with identical information should produce the same hash.\n\n sha256 = OpenSSL::Digest::SHA256.new\n sha256.digest(self.to_s).unpack('h*')\nend",
"def calculate_payload_hash\n\t\treturn Digest::SHA2.hexdigest( self.payload )\n\tend",
"def file_remote_digestsha1(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::SHA1.hexdigest(data)\n end\n return chksum\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 sha1_fingerprint(key)\n if key.match(/PRIVATE/)\n new(key).sha1_fingerprint\n else\n Digest::SHA1.hexdigest(decoded_key(key)).gsub(fingerprint_regex, '\\1:\\2')\n end\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 hash_secure\n # TODO: implement this method\n # - Use sha256 from openssl to create a cryptographically secure hash.\n # - Credit cards with identical information should produce the same hash\n OpenSSL::Digest::SHA256.digest(to_s).unpack(\"H*\")\n end",
"def gnu_hash(s)\n s.bytes.reduce(5381) { |acc, elem| (acc * 33 + elem) & 0xffffffff }\n end",
"def password_digest(password); end",
"def hash256(hex)\n binary = [hex].pack(\"H*\")\n hash1 = Digest::SHA256.digest(binary)\n hash2 = Digest::SHA256.digest(hash1)\n result = hash2.unpack(\"H*\")[0]\n return result\nend",
"def hexdigest\n DigestUtils.pack_hexdigest(digest)\n end",
"def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end",
"def generate_sha(file)\n\n sha1 = Digest::SHA1.file file\n return sha1\n\nend",
"def hash\n Digest::SHA2.hexdigest(self.id.to_s + self.password_hash.to_s + self.email.to_s).slice(0,10)\n end",
"def file_sha1\n Digest::SHA1.file(self).hexdigest\n end",
"def hash(tx)\n Digest::SHA256.hexdigest(Digest::SHA256.hexdigest(tx))\nend",
"def hmac_sha1 key, signature\n\t\trequire 'openssl'\n\t\treturn OpenSSL::HMAC.hexdigest('sha1', key, signature)\n\tend",
"def hmac_sha1(crypto, keyBytes, text)\n digest = OpenSSL::Digest::Digest.new(crypto)\n str2hex(OpenSSL::HMAC.digest(digest, keyBytes, text))\n end",
"def get_hash(input)\n return $hasher.reset.update(input).to_s\nend",
"def compute_hash( path )\n res = '0'\n autorelease_pool { res = NSData.sha1FromContentsOfFile(path) }\n res\n end",
"def fedora_shasum\n \"urn:sha1:#{Digest::SHA1.file(file_path)}\"\n end",
"def challenge29(mac, message)\n # Copy SHA1 padding code into a proc\n sha1_pad = proc do |s|\n bit_len = s.bytesize << 3\n s.force_encoding(Encoding::ASCII_8BIT)\n pad = 0x80.chr\n while ((s + pad).size % 64) != 56\n pad += \"\\x00\"\n end\n pad += [bit_len >> 32, bit_len & 0xffffffff].pack(\"N2\")\n end\n \n h = mac.unpack('N5')\n extension = ';admin=true'\n\n IO.readlines('/usr/share/dict/words', chomp: true).each do |key|\n glue = sha1_pad.call(key + message)\n forged_message = message + glue + extension\n forged_mac = CryptUtil::Digest::SHA1.digest(key.force_encoding(Encoding::ASCII_8BIT) + forged_message, h, [key, message, glue].map(&:bytesize).sum / 64)\n if CryptUtil::Digest::SHA1.authenticate_mac(forged_mac, key, forged_message)\n return forged_mac, forged_message\n end\n end\n end",
"def digest_class\n Digest::SHA256\n end",
"def digest_class\n Digest::SHA256\n end",
"def hash_secure\n sha256 = OpenSSL::Digest::SHA256.new\n enc64(sha256.digest)\n end",
"def hexdigest\n @authenticator.unpack(\"H*\").last\n end",
"def sha1\n Digest::SHA1.hexdigest self.record\n end"
] |
[
"0.795052",
"0.795052",
"0.7582409",
"0.739406",
"0.734597",
"0.7316757",
"0.7301439",
"0.7285193",
"0.7230592",
"0.72276086",
"0.71780634",
"0.7103556",
"0.7069997",
"0.7040778",
"0.7030737",
"0.70275545",
"0.7019483",
"0.7001822",
"0.6991911",
"0.69772255",
"0.69772255",
"0.69395554",
"0.6915287",
"0.6865691",
"0.68570113",
"0.68441296",
"0.6829343",
"0.6815587",
"0.6815587",
"0.6815587",
"0.6815587",
"0.6815587",
"0.6815587",
"0.6815587",
"0.6807158",
"0.67827344",
"0.67757785",
"0.6743675",
"0.6734778",
"0.6733187",
"0.6719111",
"0.67186785",
"0.67052627",
"0.6703717",
"0.67027444",
"0.6685754",
"0.6682619",
"0.66674715",
"0.6665161",
"0.66594094",
"0.66544515",
"0.6653014",
"0.6632879",
"0.66283196",
"0.6625913",
"0.6620545",
"0.66082",
"0.66065377",
"0.66065377",
"0.66065377",
"0.6606512",
"0.66059834",
"0.66006666",
"0.6594915",
"0.6585446",
"0.65771013",
"0.6572423",
"0.65718746",
"0.6533058",
"0.65206635",
"0.6516073",
"0.6511259",
"0.65010476",
"0.6489822",
"0.64894795",
"0.64659214",
"0.646487",
"0.6453254",
"0.64516366",
"0.6447767",
"0.6427982",
"0.64113945",
"0.640258",
"0.63982743",
"0.6386494",
"0.6375656",
"0.63737947",
"0.6372677",
"0.6371417",
"0.635319",
"0.6344972",
"0.6342996",
"0.6338223",
"0.6326785",
"0.6319275",
"0.63084257",
"0.63042295",
"0.63042295",
"0.63027406",
"0.62975544",
"0.62515"
] |
0.0
|
-1
|
byte array > byte array
|
def SHA256 arr
Digest::SHA256.digest(arr.map(&:chr).join).bytes
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_bytes; end",
"def to_bytes; end",
"def bytes(*args); data(1, *args); end",
"def byte_arr_to_string arr\n arr.pack(\"c*\")\nend",
"def bytes\n map { |e| e.bytes }.reduce(:+)\n end",
"def data_as_bytes\n raise \"subclass responsibility\"\n end",
"def data_as_bytes\n data = []\n data << @status\n data << @meta_type\n data << 4\n data << @data[0]\n data << @data[1]\n data << @data[2]\n data << @data[3]\n end",
"def data_as_bytes\n data = []\n data << @status\n data << @meta_type\n data << 2\n data << @data[0]\n data << (@data[1] ? 1 : 0)\n end",
"def as_bytes\n raise NotImplementedError\n end",
"def bytes\r\n @bytes.dup\r\n end",
"def bytes\n\t\tbin.unpack('C*')\n\tend",
"def bytes; end",
"def to_bytes(*args)\n messages = to_messages(*args)\n if !messages.nil?\n messages.map(&:to_bytes).flatten\n elsif args.all? { |arg| bytes?(arg)}\n args\n end\n end",
"def to_bytes()\n\t\treturn self.chars.map(&:ord)\n\tend",
"def bytes\n Base64.decode64(data)\n end",
"def all_bytes\n end",
"def bytes_to_bin(bytes)\n bytes.pack(\"C*\")\n end",
"def to_binary()\n return self.unpack('B*').join\n end",
"def byte(*bytes)\n return string(bytes.pack('C*')) \n end",
"def items_to_bytes\n bytes = []\n @items.each do |item|\n bytes << item.key\n bytes << item.value\n end\n bytes\n end",
"def bytes\n [self].pack(\"q>\").bytes.to_a.drop_while{|x| x == 0}\n end",
"def encode_to_array\n components = []\n components << [self.class.id, @channel, @payload.bytesize].pack(PACK_CHAR_UINT16_UINT32)\n components << self.class.encoded_payload(@payload)\n components << FINAL_OCTET\n components\n end",
"def to_bytes\n data = items_to_bytes\n all_data = [@data_size, @next_page, @max, @min, @id, 0] + data\n $logger.logs [:data_size, @data_size, :next_page , @next_page, :max, @max, :min, @min, :id, @id].join(\",\")\n $logger.logs \"data: #{data.join(\",\")}\"\n all_data.pack('L*')\n end",
"def int_to_byte_array( i )\n \n not_nil( i, :i )\n\n res = []\n\n begin\n res << ( i & 0xff )\n i >>= 8\n end until ( i == 0 || i == -1 ) && ( res[ -1 ][ 7 ] == i[ 7 ] )\n\n res\nend",
"def bytes\n self\n end",
"def bytesize(enc)\n end",
"def add_bytes(tag, value)\n value = value.to_s\n write_tag(tag, Type::BYTE_ARRAY)\n Varint.serialize(@io, value.bytesize)\n @io << value\n\n self\n end",
"def bytes\n contents.bytes\n end",
"def bytes\n contents.bytes\n end",
"def to_bin\n [\n \"data\",\n [body.size].pack(\"V\"),\n body\n ].join\n end",
"def bytes()\n #This is a stub, used for indexing\n end",
"def jbytes( *args )\n args.map { |arg| arg.to_s.to_java_bytes }\nend",
"def jbytes( *args )\n args.map{ |arg| arg.to_s.to_java_bytes }\nend",
"def encode\n return @_data unless @_data.nil?\n @_data = [@bin_data].pack( 'm' ).chomp if @bin_data \n @_data\n end",
"def sub_bytes\n # map{|i|i.sbox}\n map(&:sbox)\n end",
"def make_byte_string(char_array, encoding = 'BINARY')\n char_array.map do |char|\n char.chr.force_encoding('BINARY')\n end.join.force_encoding(encoding)\n end",
"def to_bytes input\n b = case input\n when String\n input.unpack(\"C*\")\n when Integer\n raise RangeError, \"Integer #{input} is to large to be a Byte\" unless input < 256\n [input]\n when Byte\n return [input]\n when Array\n input\n when NilClass\n []\n else\n raise TypeError, \"Unexpected type #{input.class} for ByteArray#to_bytes\"\n end\n b.map &Byte\n end",
"def read_data_byte(offset) [offset + 1, get_byte(offset)] end",
"def to_blob; end",
"def to_blob; end",
"def to_blob; end",
"def to_blob; end",
"def to_blob; end",
"def to_blob; end",
"def to_str\n bytes\n end",
"def to_str\n bytes\n end",
"def to_str\n bytes\n end",
"def reverse_byte_pairs!\n w = \"\"\n w.force_encoding(\"BINARY\") if w.respond_to?(:force_encoding)\n (0...@bytes.size).step(2) do |i|\n w << @bytes[i+1]\n w << @bytes[i]\n end\n @bytes = w\n __setobj__ @bytes\n self\n end",
"def bytea(value)\n \"'\\\\x#{value.unpack1('H*')}'::bytea\"\n end",
"def getbyte\n end",
"def getbyte\n end",
"def get_bytes()\n @value\n end",
"def from_array(array)\n array.pack('U*')\n end",
"def raw_bytes\n @raw_bytes ||= read_raw_bytes\n end",
"def to_a\n return [] unless @ready\n\n bytes = [OP_CODES[@op][@mode][:byte]]\n\n if [:a, :ar].include?(@mode) || (@arg && @arg > 255)\n bytes += [@arg.ls_byte, @arg.ms_byte]\n elsif @arg\n bytes += [@arg]\n else\n bytes\n end\n end",
"def encode(bytes)\n [bytes.to_s].pack(\"m\").gsub(\"\\n\", '')\n end",
"def hexbytes\n to_s.bytes.map { |b| sprintf(\"%02x\", b) }.join(\",\")\n end",
"def array_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"a\", val.value.size) # a is 1010, type indicator for arrays\n\n val.value.each do |v|\n bdata += Binary.pack_it_with_size(@object_ref_size, v.to_binary(self));\n end\n\n @object_table[saved_object_count] = bdata\n return saved_object_count\n end",
"def encode_bytes(*bytes)\n bytes.pack('C*')\n end",
"def to_byte\n self.chr\n end",
"def to_numeric_byte_array(options = {})\n to_a(options).flatten\n end",
"def gets_buffer_s(*a)\n @device.buffer.map { |msg| msg[:data] = TypeConversion.numeric_byte_array_to_hex_string(msg[:data]); msg }\n end",
"def convert_binary\n end",
"def getbyte()\n #This is a stub, used for indexing\n end",
"def bytesize\n self.data.bytesize\n end",
"def translate_to_binary(array_of_hex)\n array_of_binary = []\n array_of_hex.each do |num|\n array_of_binary << sprintf(\"%b\", num).rjust(32, '0')\n end\n array_of_binary\n end",
"def to_binary\n return '' unless @ready\n\n to_a.pack('C*') rescue binding.pry\n end",
"def dhcp_option_value_byte_array(data, value)\r\n data << value.length.chr\r\n value.each do |element| \r\n data << element.chr\r\n end\r\n end",
"def bytes\n @bytes ||= [ @timestamp >> 32,\n @timestamp & 0xFFFF_FFFF,\n @node_id >> 32,\n @node_id & 0xFFFF_FFFF ].pack(\"NNNN\")\n end",
"def var_bytes()\n len = self.uint32()\n self.bytes(len)\n end",
"def pack_bytes(byte_string)\n [byte_string].pack('H*')\n end",
"def to_bytes\n # set defaults\n self.sender ||= :pc\n self.receiver ||= 1\n\n bytes = []\n\n bytes.concat [0x00] * 5 # start of command\n bytes.concat [0x01] # <SOH>\n bytes.concat self.sender.to_bytes # Sender Address\n bytes.concat self.receiver.to_bytes # Reciver Address\n bytes.concat [0x02] # <STX>\n bytes.concat string_to_ascii_bytes(command_code) # Command Code\n bytes.concat command_payload_bytes # command specific payload\n bytes.concat [0x03] # <ETX>\n bytes.concat generate_checksum_bytes(bytes[10..-1]) # Checksum bytes (4)\n bytes.concat [0x04] # <EOT>\n\n bytes\n end",
"def bytes cols\n decode_values :byte, cols, true\n end",
"def encode_bytes(raw_bytes)\r\n\t\tencoded_bytes = \"\"\r\n\t\t0.step(raw_bytes.length-1, 2) { |i|\r\n\t\t\tencoded_bytes << raw_bytes[i+1]\r\n\t\t\tencoded_bytes << raw_bytes[i]\r\n\t\t}\r\n\t\treturn encoded_bytes\r\n\tend",
"def raw_to_base_64(byte_array)\n return \"\" if byte_array == []\n ((3 - (byte_array.length % 3)) % 3).times { byte_array << 0 }\n c1 = BASE_64_CHARS[byte_array[0] >> 2]\n c2 = BASE_64_CHARS[(byte_array[0] % 4) * 16 + (byte_array[1] >> 4)]\n c3 = BASE_64_CHARS[(byte_array[1] % 16) * 4 + (byte_array[2] >> 6)]\n c4 = BASE_64_CHARS[byte_array[2] % 64]\n c1 + c2 + c3 + c4 + raw_to_base_64(byte_array[3..-1])\nend",
"def to_bencode\n BEncode.dump(self)\n end",
"def shift_string_bytes parameter_bytes\n parameter = []\n while parameter_bytes.length > 0\n b = parameter_bytes.shift\n if b == 0\n break\n end\n parameter << b\n end\n return parameter.pack('c*')\nend",
"def readbyte\n end",
"def byte cols\n decode_values :byte, cols\n end",
"def each_byte\n\t\t@array.each { |a| yield a }\n\tend",
"def bytes(str)\n Simms::Bytes.new(str)\n end",
"def quartets_to_byte(quartetsToConvert)\n\tquartetsToConvert[1] | (quartetsToConvert[0] << 4)\nend",
"def to_buffer(item)\n\n #Try to convert the item to an array, and then to a string,\n #if it supports it. This allows us to easily get a byte string\n #from most Ruby types.\n #\n #Strings _shouldn't_ support either of these methods, and thus will\n #pass unaltered.\n # \n item = item.to_a if item.respond_to?(:to_a)\n item = item.pack(\"C*\") if item.respond_to?(:pack)\n \n #Create a new buffer, and fill it with our byte string.\n buffer = FFI::MemoryPointer.new(item.byte_size)\n buffer.put_bytes(0, item)\n\n #And return the filled buffer.\n return buffer\n \n end",
"def get_b\n n = self.get_i32\n OSC::Blob.new(self.get_data(n))\n end",
"def to_bytes(order=nil, siz=nil)\n to_chars(order,siz) {|c| c.chr }.join\n end",
"def bytes\n @lmdb.transaction do\n if ret = @dbs[:control]['bytes']\n ret.unpack1 'Q>'\n end\n end\n end",
"def write(bytes)\r\n end",
"def to_s\n [0xFF, 0xFF, 0xFF, 0xFF, @header_data, @content_data.string].pack('c5a*')\n end",
"def to_base64\n [self].pack(\"m\")\n end",
"def _byte_equal a, b\n a.zip(b).all? { |(l,r)| l.bytes.to_a == r.bytes.to_a }\n end",
"def unpack(binary)\n end",
"def byte\n Util.from_bytes :byte, value\n end",
"def build_binary_data(data={})\n buffer = [68, 65, 84, 65, 0] # D A T A\n elements_to_send = []\n keys_to_send = data.keys\n\n Xplane::XPLANE_DATA_MAPPER.each do |element_id, included_elements|\n element = nil\n included_elements.each_with_index do |element_name, index|\n if keys_to_send.include? element_name\n element ||= new_element(element_id)\n element[index + 1] = data[element_name]\n end\n end\n elements_to_send.push element unless element.nil?\n end\n\n elements_to_send.each do |element|\n buffer += element\n end\n buffer.pack binary_format(elements_to_send.length)\n end",
"def get_byte(offset) datap[offset].unpack('C*')[0] end",
"def to_b\r\n return self\r\n end",
"def read_byte; end",
"def puts_bytes(*a)\n @device.puts_bytes(*a)\n end",
"def get_byte\n byte = @connection.getbyte.to_s 2\n byte = \"0\" * (8 - byte.length) + byte\n end",
"def bytes() # added for 1.8.7\n return IoByteEnumerator.new(self, :each_byte)\n end",
"def to_bytes; @key; end"
] |
[
"0.7410019",
"0.7410019",
"0.7179154",
"0.7130532",
"0.7036203",
"0.6964688",
"0.6940595",
"0.693249",
"0.6807546",
"0.6786933",
"0.6786637",
"0.6755145",
"0.67078334",
"0.66804165",
"0.6674625",
"0.6661821",
"0.6655342",
"0.6614858",
"0.66146576",
"0.65629864",
"0.65432554",
"0.6540352",
"0.65276146",
"0.6514657",
"0.6510128",
"0.6480744",
"0.6433648",
"0.6430615",
"0.6430615",
"0.6411587",
"0.6408604",
"0.6402627",
"0.6401969",
"0.63594466",
"0.6351916",
"0.6331864",
"0.6305125",
"0.6274183",
"0.62276185",
"0.62276185",
"0.62276185",
"0.62276185",
"0.62276185",
"0.62276185",
"0.6211703",
"0.6211703",
"0.6211703",
"0.6185553",
"0.61563426",
"0.6129063",
"0.6129063",
"0.61080265",
"0.60896677",
"0.60838693",
"0.60611165",
"0.60551983",
"0.6049523",
"0.60450053",
"0.6032414",
"0.60290784",
"0.6022544",
"0.60135186",
"0.60032046",
"0.59812146",
"0.5979349",
"0.5978651",
"0.59594876",
"0.5924642",
"0.59061545",
"0.5898622",
"0.589416",
"0.58889335",
"0.5883477",
"0.5862577",
"0.5852578",
"0.5839907",
"0.5811832",
"0.5804474",
"0.5790353",
"0.5780654",
"0.577434",
"0.57725227",
"0.57566315",
"0.5740178",
"0.57352644",
"0.5719324",
"0.5718785",
"0.5702674",
"0.5698389",
"0.5692957",
"0.5683823",
"0.5679265",
"0.56769997",
"0.56765556",
"0.5668067",
"0.5666438",
"0.56650305",
"0.56420267",
"0.5641643",
"0.5640175"
] |
0.58854866
|
72
|
returns an infinite byte stream to xor against arguments are arrays
|
def AES256_ctr key, iv
cipher = OpenSSL::Cipher::AES.new(256, :ECB)
cipher.encrypt
cipher.padding = 0
cipher.key = key[..31].map(&:chr).join
counter = iv[..15]
f = Fiber.new do
loop do
enc = cipher.update(counter.map(&:chr).join)
enc.bytes.each {|b| Fiber.yield b}
counter.increment
end
end
Enumerator.produce {f.resume}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def xor(bytes1, bytes2)\n bytes1.zip(bytes2).map { |b1, b2| b1 ^ b2 }\nend",
"def crack_xor\n key_size = (2..40).to_a\n data = Tools.get_data6\n binding.pry\n \n end",
"def xor_a\n end",
"def xor_b\n end",
"def xor_c\n end",
"def xor(input)\n key = 128\n output = input.split(//).collect {|e| [e.unpack('C').first ^ (key & 0xFF)].pack('C') }.join\n output = output.split(//).collect {|e| [e.unpack('C').first ^ (key - 27 & 0xFF)].pack('C') }.join\n Base64.strict_encode64(output)\nend",
"def xor(x, y)\n\nend",
"def xor(b)\n r = []\n zip_bytes(b) { |i,j| r << (i ^ j) }\n Id.new r.length, false, r\n end",
"def __xor_byte(o)\n\t\treturn Buffer.__new__(@bytes.map { |b| b ^ o })\n\tend",
"def x_xor_y\n x = @x.content\n y = @y.content\n z = Array.new @z.length, 0\n\n @z.length.times { |i| z[i] = x[i] ^ y[i] }\n\n @z.content = z\n end",
"def __xor_buffer(o)\n\t\te = o.__bytes.cycle\n\t\treturn Buffer.__new__(@bytes.map { |b| b ^ e.next })\n\tend",
"def xor(codes, string)\n Array.new([codes.size, string.size].min) { |i| codes[i] ^ string[i].ord }.map(&:chr).join\nend",
"def xor_d8\n end",
"def xor_decrypt(bytes, password)\r\n decrypt = \"\"\r\n pw_index = 0 #keeps track of index to cycle password\r\n\r\n bytes.each do |i|\r\n decrypt += (i ^ password[pw_index]).to_s + \",\" #run xor operation\r\n pw_index += 1\r\n #loop over the password if it reaches its limit\r\n if pw_index > password.length - 1\r\n pw_index = 0\r\n end\r\n end\r\n #returns as a string of ascii values\r\n decrypt\r\nend",
"def xor(first, second)\n first.bytes.zip(second.bytes).map{ |(a,b)| (a ^ b).chr }.join('')\n end",
"def xor(left, right)\n res = Array.new\n 0.upto(3) do |i|\n temp = left[i] ^ right[i]\n res << temp\n end\n res\n end",
"def xor_byte_strings(s1, s2) # :doc:\n s2 = s2.dup\n size = s1.bytesize\n i = 0\n while i < size\n s2.setbyte(i, s1.getbyte(i) ^ s2.getbyte(i))\n i += 1\n end\n s2\nend",
"def output()\n a = 0xff & @s[0xff & (@j + @s[0xff & (@i + @s[0xff & (@z + @k)])])]\n b = 0xff & @s[0xff & (N - 1 - @i)]\n @z = a ^ b\n return @z\n end",
"def xor_n\n value = next_byte\n xor_to_a value\n @clock += 2\n end",
"def xor_l\n end",
"def xor(a, b)\n\tm = \"\"\n\tif a.length > b.length\n\t\tbig = a\n\t\tsmall = b\n\telse\n\t\tbig = b\n\t\tsmall = a\n\tend\n\t#a = a.to_i(16).to_s(2) # convert to binary\n\t#b = b.to_i(16).to_s(2) # convert to binary\n\t# xor each byte individually\n\tfor i in 0...(small.length)\n\t\tm << (a[i,1].to_i(16)^b[i,1].to_i(16)).to_s(16) # append to msg string in hex\n\tend\n\t# append the rest of the bigger string\n\t#for i in small.length...big.length\n\t#\tm << big[i].chr\n\t#end\n\treturn m\nend",
"def xor(*args)\n args.inject(self, :^)\n end",
"def xor_bytes(bytes1, bytes2)\n results_in_bytes = (0...bytes1.length).map { |i| bytes1[i] ^ bytes2[i] }\n bytes_to_hex(results_in_bytes)\nend",
"def xor_string key, str\n\tarr = str.unpack(\"C*\").each_with_index.map do |ch, i| ch^(key[i%key.length]) end\n\tarr.pack(\"C*\")\nend",
"def ^(obj)\n bytes1 = @value.bytes\n bytes2 = bytes(obj)\n\n bytes1, bytes2 = bytes2, bytes1 if bytes1.length < bytes2.length\n\n res = Array.new(bytes1.length) { |i| bytes1[i] ^ bytes2[i % bytes2.length] }\n res = str(res)\n res.to_raw\n end",
"def xor_h\n end",
"def xor_d\n end",
"def repeating_key_xor(string, key)\n counter = 0\n encrypted = []\n string.bytes.each do |byte|\n encrypted << (byte ^ key.bytes[counter])\n \n counter = counter == 2 ? 0 : counter += 1\n end\n # binding.pry\n encrypted.map{ |i| sprintf(\"%02x\", i) }.join.strip\n end",
"def xor_e\n end",
"def xor_hex(a, b)\n raise \"Unequal buffers passed.\" if a.length != b.length\n (a.hex ^ b.hex).to_s(16)\nend",
"def potential_strings_from_single_char_xor(encoded_string)\n # for all bytes...\n (0..255).map do |decoded_char|\n # Create a hex string equal in length to the target\n decoding_string = bytes_to_hex([decoded_char] * encoded_string.length)\n\n DecodedString.new(\n decoded_char,\n xor_hex(encoded_string, decoding_string)\n )\n end\nend",
"def odd_duplicates(array)\n xor = array.reduce(0, :^)\nend",
"def xor_cypher(str)\n # try rewrite using Array#pack 'H*' or String#unpack\n str_byte_arr = str.scan(/../).map { |h| h.to_i(16) }\n processed_buffers = []\n \n #instead of taking two arrays, take in 1\n string_xor_ascii(processed_buffers, str_byte_arr)\n find_plaintext(processed_buffers)\n end",
"def xor_missing_element array1, array2\n return nil if array1.length == 0 && array2.length == 0\n result = 0\n (array1 + array2).each do |number|\n result ^= number\n end\n return result\nend",
"def singleByteXOR(hexStr, keyChar)\n #ASCII character -> 1 byte of binary (8 bit) -> 2-digit hex\n hexKeyChar = binToHex(decToBin(keyChar.ord).rjust(8, '0'))\n \n #XOR output (hex)\n xorOutput = \"\"\n \n i = 0\n begin\n #Take 2 characters of hex from input stream\n hexStrChunk = hexStr[i..(i+1)]\n \n xorOutput.concat(hex_XOR(hexStrChunk, hexKeyChar))\n \n i = i + 2\n end until i > hexStr.length - 1\n \n return xorOutput\nend",
"def str_xor(s1, s2)\n if s1.length != s2.length:\n minlen = [s1, s2].map(&:length).min\n s1 = s1[0...minlen]\n s2 = s2[0...minlen]\n end\n s1.bytes.zip(s2.bytes).map{ |b1, b2| b1 ^ b2 }.map(&:chr).join\nend",
"def SHA256 arr\n Digest::SHA256.digest(arr.map(&:chr).join).bytes\nend",
"def xor_strings(s1, s2)\r\n s1.unpack('C*').zip(s2.unpack('C*')).map { |a, b| a ^ b }.pack('C*')\r\n end",
"def stream(num_of_bytes)\n array = []\n (num_of_bytes * 8).times do\n array.push(rand(2))\n end\n array\nend",
"def fixedXOR(a = 0x1c0111001f010100061a024b53535009181c, b = 0x686974207468652062756c6c277320657965)\n if a.to_s(16).length == b.to_s(16).length\n res = a ^ b\n else\n # TODO: raise error\n res = 0\n puts \"error: diff size arguments\"\n end\n res\nend",
"def xordecrypt\n return match(@payload,@prefix,@keys,@keywords)\n end",
"def xor\n x, y = stack.pop(2)\n push x ^ y\n end",
"def xor?(arg1, arg2)\r\n\r\nend",
"def calculate_doublepulsar_xor_key(s)\n x = (2 * s ^ (((s & 0xff00 | (s << 16)) << 8) | (((s >> 16) | s & 0xff0000) >> 8)))\n x & 0xffffffff # this line was added just to truncate to 32 bits\n end",
"def repeat_key_xor(text, key)\n\thex_text = text.unpack('H*').join\n\t#Unpack the key into its individual letters\n\tkey_array = key.unpack('H2H2H2')\n\tout = hex_text.scan(/../).map.with_index { |a, i| fixed_xor(a, key_array[i.modulo(3)]) }.join\nend",
"def xor(a,b)\n (a | b) - (a & b)\n end",
"def cipher(bytes, secret)\n ctext = Array.new(bytes)\n\n secret.each_index do |n|\n bytes.each_index do |i|\n ctext[i] = ctext[i] ^ secret[(n+secret[n]+i) % secret.length]\n end\n end\n\n return ctext\n end",
"def bytes(*args); data(1, *args); end",
"def byte_arr_to_string arr\n arr.pack(\"c*\")\nend",
"def unbinarize(block)\n block.map { |byte| byte.to_i(2).chr }.join\n end",
"def binary(output)\n if instructions.size == 0\n puts \"No instruction stream. Cannot create binary.\"\n exit 1\n end\n\n instructions.each do |instr|\n instr_bytes = instr.words\n encstr = pack_string(instr_bytes)\n output << instr_bytes.pack(encstr)\n end\n end",
"def reduce\n @reduce_secpack = Tem::Assembler.assemble do |s|\n s.label :_secret\n s.label :_key\n s.data :tem_ubyte, @query_key.to_tem_key\n s.label :_check\n s.data :tem_ubyte, @check_bytes\n \n s.label :_signed\n # User-provided comparison procedure (signed).\n s.label :_comparison_proc\n yield s\n s.ret\n \n s.entry\n s.ldbc :const => 24\n s.outnew \n # Decrypt inputs.\n s.ldwc :const => :_key\n s.rdk\n s.stw :_key_id\n [1, 2].each do |i|\n s.ldw :_key_id\n s.kdfxb :from => :\"_output#{i}\", :to => :\"_id#{i}\", :size => 24\n \n # Compare the check bytes and abort if the inputs were tampered with.\n s.mcmpfxb :op1 => :\"_check#{i}\", :op2 => :\"_check\",\n :size => @check_bytes.length\n s.jz :\"_check_#{i}_ok\"\n s.halt\n s.label :\"_check_#{i}_ok\"\n end\n \n # Compare and output.\n s.call :_comparison_proc\n s.ldw :comparison\n s.jae :_output1_wins\n s.mcfxb :from => :_id2, :to => :_id1, :size => 16\n s.jmp :_output\n s.label :_output1_wins\n # Still do a memcpy, to prevent timing attacks.\n s.mcfxb :from => :_id2, :to => :_id2, :size => 16\n s.jmp :_output\n # Refresh the nonce to prevent learning about the comparison criteria.\n s.label :_output\n s.ldbc 3\n s.ldwc :_nonce1\n s.rnd\n # Encrypt output.\n s.ldwc :const => :_key\n s.rdk\n s.kefxb :from => :_id1, :size => 23, :to => 0xFFFF\n s.halt\n \n s.label :_plain\n # The comparison result produced by the user comparison procedure.\n s.label :comparison\n s.zeros :tem_short, 1\n s.label :_key_id\n s.zeros :tem_short, 1\n \n # The two inputs to reduce.\n [1, 2].each do |i|\n # Encrypted map/reduce output.\n s.label :\"_output#{i}\" \n s.zeros :tem_ubyte, 24\n # Unencrypted input (decrypted inside TEM).\n s.label :\"_id#{i}\"\n s.zeros :tem_ubyte, 8\n s.label :\"score#{i}\"\n s.zeros :tem_short, 1\n s.label :\"_nonce#{i}\"\n s.zeros :tem_ubyte, 3 \n s.label :\"_check#{i}\"\n s.zeros :tem_ubyte, @check_bytes.length\n end\n s.stack 16\n end\n end",
"def crypt(message, key)\n repeated_key = key * ((message.length+2) / key.length)\n\n #puts message.length\n #puts repeated_key.length\n \n (0..message.length-1).map{|i|\n message[i] ^ repeated_key[i]\n }\n\nend",
"def DECODER2(x,y) \n\t#Sends out an array of decoded values\n\treturn AND(NOT(x),NOT(y)),AND(NOT(x),y),AND(x,NOT(y)),AND(x,y)\nend",
"def bit_flip(arr, n)\n #YOUR WORK HERE\nend",
"def generate_numbers\n (0...ARRAY_LENGTH).each do |i|\n y = ((1 << 31) & @mt[i]) + ((2**31 -1) & (@mt[(i+1)%ARRAY_LENGTH] % ARRAY_LENGTH))\n @mt[i] = @mt[(i + 397) % ARRAY_LENGTH] ^ (y >> 1)\n if (y % 2) != 0\n @mt[i] = @mt[i] ^ GENERATE_CONST\n end\n end\n end",
"def bit_xor(x, bits)\n bits.map{|b| x[b]}.reduce(:^)\n end",
"def p1(x, y, z)\n # x or y\n xor(x, y)\nend",
"def ^(o)\n\t\tcase o\n\t\twhen Integer\n\t\t\tBuffer.__assert_range(o)\n\t\t\treturn __xor_byte(o)\n\t\twhen Buffer\n\t\t\treturn __xor_buffer(o)\n\t\telse\n\t\t\traise TypeError.new\n\t\tend\n\tend",
"def boolean_to_binary(array)\nend",
"def xor_select(arr, prc_1, prc_2)\n new_arr = []\n\n arr.each do |ele|\n if prc_1.call(ele) && !prc_2.call(ele) || !prc_1.call(ele) && prc_2.call(ele)\n new_arr << ele\n end\n end\n\n new_arr\nend",
"def decoder_stub(state)\n\n\t\t# add one xor operation for the key (see comment below)\n\t\tnumber_of_passes=state.buf.length/4+1\n\t\traise InvalidPayloadSizeException.new(\"The payload being encoded is too long (#{state.buf.length} bytes)\") if number_of_passes > 10240\n\t\traise InvalidPayloadSizeException.new(\"The payload is not padded to 4-bytes (#{state.buf.length} bytes)\") if state.buf.length%4 != 0\n\t\t\n\t\t# 16-bits not (again, see below)\n\t\treg_14 = (number_of_passes+1)^0xFFFF\n\t\tdecoder = Metasm::Shellcode.assemble(Metasm::MIPS.new(:little), <<EOS).encoded.data\n;\n; MIPS nul-free xor decoder\n;\n; (C) 2006 Julien TINNES\n; <julien at cr0.org>\n;\n; The first four bytes in encoded shellcode must be the xor key\n; This means that you have to put the xor key right after\n; this xor decoder\n; This key will be considered part of the encoded shellcode\n; by this decoder and will be xored, thus becoming 4NULs, meaning nop\n;\n; This is Linux-only because I use the cacheflush system call\n;\n; You can use shellforge to assemble this, but be sure to discard all\n; the nul bytes at the end (everything after x01\\\\x4a\\\\x54\\\\x0c)\n;\n; change 2 bytes in the first instruction's opcode with the number of passes\n; the number of passes is the number of xor operations to apply, which should be\n; 1 (for the key) + the number of 4-bytes words you have in your shellcode\n; you must encode ~(number_of_passes + 1) (to ensure that you're nul-free)\n\n\n;.text\n;.align\t2\n;.globl\tmain\n;.ent\tmain\n;.type\t\t main,@function\n\nmain:\n\nli macro reg, imm\n;\tlui reg, ((imm) >> 16) & 0ffffh\n;\tori reg, reg, (imm) & 0ffffh\n\taddiu reg, $0, imm\t\t; sufficient if imm.abs <= 0x7fff\nendm\n\n\tli(\t$14, #{reg_14})\t\t; 4 passes\n\tnor\t$14, $14, $0\t\t; put number of passes in $14\n\n\tli(\t$11,-73)\t\t; addend to calculated PC is 73\n;.set noreorder\nnext:\n\tbltzal $8, next\n;.set reorder\n\tslti $8, $0, 0x8282\n\tnor $11, $11, $0\t\t; addend in $9\t\n\taddu\t$25, $31, $11\t\t; $25 points to encoded shellcode +4 \n;\taddu\t$16, $31, $11\t\t; $16 too (enable if you want to pass correct parameters to cacheflush\n\n;\tlui\t$2, 0xDDDD \t\t; first part of the xor (old method)\n\tslti\t$23, $0, 0x8282 \t; store 0 in $23 (our counter)\n;\tori\t$17, $2, 0xDDDD \t; second part of the xor (old method)\n\tlw\t$17, -4($25)\t\t; load xor key in $17 \n\n\n\tli(\t$13, -5)\n\tnor\t$13, $13, $0\t\t; 4 in $13\n\n\taddi\t$15, $13, -3\t\t; 1 in $15\nloop:\n\tlw\t$8, -4($25)\n\n\taddu\t$23, $23, $15\t\t; increment counter\n\txor\t$3, $8, $17\n\tsltu\t$30, $23, $14\t\t; enough loops?\n\tsw\t$3, -4($25)\n\taddi\t$6, $13, -1\t\t; 3 in $6 (for cacheflush)\n\tbne\t$0, $30, loop\n\taddu\t$25, $25, $13\t\t; next instruction to decode :)\n\n\n;\taddiu\t$4, $16, -4\t \t; not checked by Linux\n;\tli $5,40 \t; not checked by Linux\n;\tli $6,3 \t; $6 is set above\n\n;\t.set noreorder\n\tli( $2, 4147) ; cacheflush\n\t;.ascii \"\\\\x01JT\\\\x0c\"\t\t; nul-free syscall\n\tsyscall 0x52950\n;\t.set reorder\n\n\n\t\t\t\t\t; write last decoder opcode and decoded shellcode\n;\tli $4,1 \t; stdout\n;\taddi\t$5, $16, -8\n;\tli $6,40 \t; how much to write \n;\t.set noreorder\n;\tli $2, 4004 ; write\n;\tsyscall\n;\t.set reorder\n\t\n\n\tnop\t\t\t\t; encoded shellcoded must be here (xor key right here ;)\n; $t9 (aka $25) points here\n\nEOS\n\t\t# put the key at the end of the decoder\n\t\tstate.decoder_key_offset = decoder.length - 4\n\n\t\treturn decoder\n\tend",
"def xor_to_a(to_xor)\n @a ^= to_xor\n @f = 0x00\n @f |= Z_FLAG if @a == 0x00\n end",
"def encode integer_array\n integer_array = integer_array.clone\n bits = BitArray.new\n integer_array.each do |x|\n q = x/@M\n q.times {bits.push 1}\n bits.push 0\n r = x % @M\n (@b-1).downto(0){|i| bits.push r[i]}\n end\n bits\n end",
"def bitarray(n) \n b=Array::new \n i=0 \n v=n\n while v > 0\n b[i] = (0x1 & v)\n v = v/2\n i = i + 1\n end\n return b\n end",
"def xor(*others)\n self.class.xor(self, *others)\n end",
"def xor (keynum, pt, key)\n # get the individual key from the key schedule\n k = key[keynum,4]\n if $decrypt\n # reverse the reversed key to correct it\n k = k.reverse\n # run the key through the permputation if we are in the correct step\n if $permute\n k = permute(k, $perm)\n end\n end\n # xor the key and hex\n ret = k.hex ^ pt.hex\n # turn the number back into hex\n ret = ret.to_s(16)\n # pad the number with leading 0's\n while (ret.length < 4)\n ret.prepend(\"0\")\n end\n return ret\nend",
"def scan(buffer, source_offset)\n\n blen = buffer.length\n entropic(buffer, AES_KEYBLOCK_MIN, ENTROPIC_MIN) do |i|\n\n # Exit if we dont have at least 240 bytes left\n return if (i + 240) > blen\n\n # Create a byte map to work in both little and big endian formats\n #[\"V\", \"N\"].each do |endian|\n\n [\"V\"].each do |endian|\n bmap = buffer[i, 240].unpack(\"#{endian}*\")\n\n # Check distance from 256-bit AES key\n xor_count_256 = 0\n 1.upto(7) do |row|\n 0.upto(7) do |column|\n break if (row == 7 and column == 4)\n case column\n when 0\n xor_count_256 += aes_popcount( aes_key_core( bmap[8*row-1], row) ^ bmap[8*(row-1)] ^ bmap[8*row] )\n when 4\n xor_count_256 += aes_popcount( aes_sbox_bytes( bmap[8*row+3]) ^ bmap[8*(row-1)+4] ^ bmap[8*row+4])\n else\n xor_count_256 += aes_popcount( bmap[8*row+column-1] ^ bmap[8*(row-1)+column] ^ bmap[8*row + column])\n end\n end\n end\n\n # We found a possible AES-256 key\n unless xor_count_256 > AES_XOR_LIMIT\n report_hit(:type => \"Key(AES-256)\", :data => bmap[0, 256/32].pack(\"#{endian}*\").unpack(\"C*\").map{|x| \"%.2x\" % x }.join, :offset => source_offset + i)\n next\n end\n\n # Check distance from 128-bit AES key\n xor_count_128 = 0\n 1.upto(10) do |row|\n 0.upto(3) do |column|\n before_count = xor_count_128\n case column\n when 0 \n xor_count_128 += aes_popcount( aes_key_core( bmap[4*row-1],row) ^ bmap[4*(row-1)] ^ bmap[4*row])\n else\n xor_count_128 += aes_popcount( (bmap[4*row + column-1] ^ bmap[4*(row-1)+column]) ^ bmap[4*row + column])\n end\n end\n end\n\n # We found a possible AES-128 key\n unless xor_count_128 > AES_XOR_LIMIT\n report_hit(:type => \"Key(AES-128)\", :data => bmap[0, 128/32].pack(\"#{endian}*\").unpack(\"C*\").map{|x| \"%.2x\" % x }.join, :offset => source_offset + i)\n end\n end\n end\n\n end",
"def binary(array)\n @reactor.schedule { @driver.binary(array.to_a) }\n end",
"def inv_xor(str1, str2)\n #result = ''\n #for i in 0..(str1.size - 1) do\n # result += mod_sub(str1[i].chr, str2[i].chr)\n #end\n #result\n\n # Probably slower than above:\n str1.split(//).zip(str2.split(//)).inject('') do |acc, ch| \n acc += mod_sub(ch.first, ch.last) \n end\n end",
"def rev(target)\n res = Array(32)\n 16.times do |i|\n a = target[i].ord ^ i ^ (16 * i)\n res[2*i+1] = a & 0xf\n res[2*(15-i)] = a >> 4\n end\n res.map{|c|c.to_s(16)}.join\nend",
"def break_repeat_key_xor_data(data, key_size)\n blocks = transpose_blocks(data, key_size)\n\n # Solve each block as if it was single-character XOR. For each block, the\n # single-byte XOR key that produces the best looking histogram is the\n # repeating-key XOR key byte for that block. Put them together and you have\n # the key.\n key = blocks.map do |idx, block|\n best_result = single_byte_xor_cipher(encode_hex(block))[0]\n key_part = best_result[0]\n [idx, key_part]\n end.\n sort_by{ |i| i[0] }.\n map{ |i| i[1].chr }.\n join(\"\")\n\n puts \"Probable key: '#{key}'\"\n key\nend",
"def execute_XOR(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value ^= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend",
"def make_data\n Array.new(2**15) { |i| (i / 16 % 256) }\n end",
"def xor_mhl\n value = @mmu[hl]\n xor_to_a value\n @clock += 2\n end",
"def xor(argument1, argument2)\n argument1 && !argument2 || !argument1 && argument2\n end",
"def translate_to_binary(array_of_hex)\n array_of_binary = []\n array_of_hex.each do |num|\n array_of_binary << sprintf(\"%b\", num).rjust(32, '0')\n end\n array_of_binary\n end",
"def encode(s)\n len = s.length\n key_repeats = len / @keylen\n extended_key = @key * key_repeats\n if len % @keylen > 0\n partial_key = len % @keylen\n extended_key += @key[0..partial_key-1]\n end\n\n return XorEncryptor.xor_hex(s, extended_key)\n # xored = s.to_i(16) ^ extended_key.to_i(16)\n # decrypt = xored.to_s(16)\n # decrypt = \"0#{decrypt}\" if decrypt.length % 2 > 0 # hacky...\n # decrypt\n end",
"def encrypt_method(arg, index)\n while index < arg.length\n arg[index] = arg[index].next\n index -= 1\n end\n puts arg\nend",
"def each_byte\n\t\t@array.each { |a| yield a }\n\tend",
"def power_araray(array)\n ## recorrer el arreglo con map\n ## hacer la operatorio con ** 2\n ## map entrega un copia lista\nend",
"def xor_hl\n end",
"def encodeing(array)\n i = 0\n freq = 0\n value = 0\n encoding = []\n while i < array.length\n freq = array[i]\n value = array[i + 1]\n freq.times { encoding << value }\n i += 2\n end\n encoding\nend",
"def bit_xor\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 52 )\n return_value = BitXorReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal238 = nil\n bit_and237 = nil\n bit_and239 = nil\n\n tree_for_char_literal238 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 593:5: bit_and ( '^' bit_and )*\n @state.following.push( TOKENS_FOLLOWING_bit_and_IN_bit_xor_3918 )\n bit_and237 = bit_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_and237.tree )\n end\n # at line 593:13: ( '^' bit_and )*\n while true # decision 55\n alt_55 = 2\n look_55_0 = @input.peek( 1 )\n\n if ( look_55_0 == HAT )\n alt_55 = 1\n\n end\n case alt_55\n when 1\n # at line 593:16: '^' bit_and\n char_literal238 = match( HAT, TOKENS_FOLLOWING_HAT_IN_bit_xor_3923 )\n if @state.backtracking == 0\n\n tree_for_char_literal238 = @adaptor.create_with_payload( char_literal238 )\n root_0 = @adaptor.become_root( tree_for_char_literal238, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_bit_and_IN_bit_xor_3927 )\n bit_and239 = bit_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_and239.tree )\n end\n\n else\n break # out of loop for decision 55\n end\n end # loop for decision 55\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 52 )\n\n end\n \n return return_value\n end",
"def hex_XOR(hex1, hex2)\n bin1 = hexToBin(hex1)\n bin2 = hexToBin(hex2)\n \n #XOR result in binary\n xorBin = \"\"\n \n for i in 0..bin1.length-1 do\n xorBitResult = bin1[i].to_i ^ bin2[i].to_i\n xorBin.concat(xorBitResult.to_s)\n end\n \n return binToHex(xorBin)\nend",
"def bitwise_xor(num1, num2)\n bnum1 = num1.to_s(2)\n bnum2 = num2.to_s(2)\n band = (num1 | num2).to_s(2)\n puts \"num1 = \" + ( ' ' * bnum2.length ) + num1.to_s(2)\n puts \"num2 = \" + ( ' ' * bnum1.length ) + num2.to_s(2)\n puts \"b|& = \" + ( ' ' * ([bnum1.length, bnum2.length].min ) + band)\nend",
"def solve_cipher(input_array,shift)\n\toutput_array = []\n\tinput_array.each do |char|\n\t\tpos1 = char.ord\n\t\tpos2 = pos1 + shift\n\t\tif pos2 < 97\n\t\t\tpos3 = 123 - (97 - pos2) \n\t\t\toutput_array << pos3.chr\n\t\telsif pos2 > 122\n\t\t\tpos3 = 96 + (pos2 - 122) \n\t\t\toutput_array << pos3.chr\n\t\telse\n\t\t\toutput_array << pos2.chr\n\t\tend\n\tend\n\toutput_array\nend",
"def binary_pass\n binary = ''\n each do |e|\n case e\n when Align\n binary += ([0] * (e.addr - @chunks[e.addr])).pack('C*')\n when Label\n true\n when Data, Operand\n binary += e.to_binary\n when Block\n binary += e.binary_pass\n end\n end\n\n binary\n end",
"def xor(e1, e2)\n eval_ex(e1) ^ eval_ex(e2)\n end",
"def secure_compare(a, b)\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n\tputs l.class\n\n res = 0\n b.each_byte do |byte| \n\t k = l.shift\n\t res |= byte ^ k\n\t puts \"#{byte}-#{k}-#{res}\"\n\tend\n\tputs res\n res == 0\n end",
"def bphash( key, len=key.length )\n state = 0\n \n len.times{ |i|\n state = state << 7 ^ key[i]\n }\n return state\nend",
"def xor(other)\n @bits ^ bits_from_object(other)\n end",
"def reverse_byte_nibbles!\n w = \"\"\n w.force_encoding(\"BINARY\") if w.respond_to?(:force_encoding)\n @bytes.each_byte do |b|\n w << ((b >> 4)|((b&0xF)<<4))\n end\n @bytes = w\n __setobj__ @bytes\n self\n end",
"def compress\n return :input_too_short if buf.size < 2\n return :input_too_large if buf.size > 0xFFFFFF\n\n outstream = ArrayOStream.new\n .u8(0x11).u16(buf.size).u8(buf.size >> 16)\n\n outbuffer = [8 * 4 + 1] * 33\n outbuffer[0] = 0\n bufferlength = 1\n bufferedBlocks = 0\n readBytes = 0\n while readBytes < buf.size\n if bufferedBlocks == 8\n outstream.write(outbuffer[0, bufferlength])\n outbuffer[0] = 0\n bufferlength = 1\n bufferedBlocks = 0\n end\n\n oldLength = [readBytes, 0x1000].min\n disp, length = occurrence_length(readBytes,\n [buf.size - readBytes, 0x10110].min, readBytes - oldLength, oldLength)\n if length < 3\n outbuffer[bufferlength] = buf[readBytes]\n readBytes += 1\n bufferlength += 1\n else\n readBytes += length\n outbuffer[0] |= (1 << (7 - bufferedBlocks)) & 0xFF\n case\n when length > 0x110\n outbuffer[bufferlength] = 0x10\n outbuffer[bufferlength] |= ((length - 0x111) >> 12) & 0x0F\n bufferlength += 1\n outbuffer[bufferlength] = ((length - 0x111) >> 4) & 0xFF\n bufferlength += 1\n outbuffer[bufferlength] = ((length - 0x111) << 4) & 0xF0\n when length > 0x10\n outbuffer[bufferlength] = 0x00\n outbuffer[bufferlength] |= ((length - 0x111) >> 4) & 0x0F\n bufferlength += 1\n outbuffer[bufferlength] = ((length - 0x111) << 4) & 0xF0\n else\n outbuffer[bufferlength] = ((length - 1) << 4) & 0xF0\n end\n outbuffer[bufferlength] |= ((disp - 1) >> 8) & 0x0F\n bufferlength += 1\n outbuffer[bufferlength] = (disp - 1) & 0xFF\n bufferlength += 1\n end\n\n bufferedBlocks += 1\n end\n\n if bufferedBlocks > 0\n outstream.write(outbuffer[0, bufferlength])\n end\n\n outstream.buf\n end",
"def encrypt message\n raw = message.bytes.reverse!\n raw << raw.size\n # strip_leading_zero_bytes raw\n raw.each do |item|\n puts item\n end\nend",
"def cubes(array)\n array.map { |number| number ** 3}\n # Return array\nend",
"def encrypt_array(pt_array, seed = 2)\n pt_array.collect {|pw| encrypt(pw, seed)}\n end",
"def xor_strings(str1, str2)\n decoded_and_xor = str1.hex ^ str2.hex\n decoded_and_xor.to_s(16)\n end",
"def cifrar(mensaje,claveB)\n puts \"\\n\\n\"\n puts \"CIFRANDO MENSAJE\"\n puts \"----------------\"\n puts \"\\n\"\n #Si el tamaño de la clave y del mensaje son iguales se puede hacer\n \n mensajeB = pasarBinario(mensaje)\n \n if (mensajeB.length == claveB.length) then\n \n \n #xor se le pasara dos cadnas binarias devuelve Binario.\n resul = xor(mensajeB,claveB)\n \n puts \"Mensaje Original es: \" + mensaje\n puts \"Mensaje Original en binario: \" + mensajeB\n puts \"Longitud del mensaje en binario: \" + mensajeB.length.to_s\n \n \n puts \"---------------------------------------------\"\n \n puts \"Clave Original es: \" + pasar_cadena(claveB)\n puts \"Clave Original en binario: \" + claveB\n puts \"Longitud de la clave binario: \" + claveB.length.to_s\n \n puts \"---------------------------------------------\"\n \n \n puts \"Mensaje cifrado: \" \n puts pasar_cadena(resul)\n puts \"Mensaje cifrado en binario: \" + resul\n puts \"Longitud mensaje cifrado binario: \" + resul.length.to_s\n \n return resul\n \n else \n puts \"NO PODEMOS CIFRAR CLAVE Y EL MENSAJE NO ES DEL MISMO TAMAÑO\"\n end\n end",
"def xor?(arg1, arg2)\n if !!arg1 == !!arg2\n false\n else\n true\n end \nend",
"def subarray_bitwise_o_rs(a)\n result_set = Set.new()\n a.size.times do |i|\n (1..a.size-i).each do |length|\n subarray = a[i, length]\n #puts subarray.inspect\n result = subarray.reduce(0) do |bor, elem|\n bor | elem\n end\n #puts result\n result_set << result\n end\n end\n result_set.size\nend"
] |
[
"0.6570551",
"0.6509047",
"0.64560455",
"0.6447533",
"0.6433701",
"0.6433153",
"0.6394889",
"0.63559705",
"0.63147974",
"0.6279441",
"0.6270745",
"0.62522525",
"0.6231662",
"0.6217414",
"0.62136376",
"0.61891884",
"0.6142458",
"0.613171",
"0.6099784",
"0.60927254",
"0.6067247",
"0.5989886",
"0.5983592",
"0.59831357",
"0.5951575",
"0.59314585",
"0.59186983",
"0.5916784",
"0.5913873",
"0.59108734",
"0.59064186",
"0.589929",
"0.5897426",
"0.58922267",
"0.5843213",
"0.5824919",
"0.5809894",
"0.575559",
"0.5730884",
"0.57114303",
"0.5708401",
"0.56261367",
"0.56240076",
"0.56150836",
"0.5584403",
"0.55522686",
"0.5512541",
"0.5479295",
"0.5472713",
"0.5466117",
"0.54453444",
"0.53986335",
"0.5397235",
"0.5374467",
"0.5363592",
"0.5357446",
"0.53378206",
"0.53312194",
"0.53243685",
"0.53185606",
"0.5303756",
"0.5300612",
"0.52813375",
"0.52793795",
"0.5258906",
"0.52394253",
"0.52325696",
"0.52235967",
"0.52231544",
"0.5221496",
"0.5215156",
"0.5207799",
"0.52037525",
"0.520288",
"0.52004564",
"0.52002937",
"0.5200014",
"0.51921666",
"0.5190854",
"0.5180089",
"0.51694167",
"0.51674473",
"0.5158979",
"0.5158538",
"0.51559496",
"0.51370764",
"0.5129752",
"0.51249206",
"0.51207453",
"0.5110267",
"0.5105953",
"0.51051015",
"0.5096779",
"0.50870204",
"0.5085047",
"0.508249",
"0.5074266",
"0.50711715",
"0.50660425",
"0.50634784",
"0.50584257"
] |
0.0
|
-1
|
byte array > byte array RFC 2104
|
def HMAC_SHA2_256 key, msg
# skipping the key hashing step, as we can assume that it's small enough
blockSize = 512 / 8
key = key.ljust blockSize, 0
o_padded = key.xor ([0x5c] * blockSize).each
i_padded = key.xor ([0x36] * blockSize).each
o = SHA256(o_padded + SHA256(i_padded + msg))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_bytes; end",
"def to_bytes; end",
"def encode_to_array\n components = []\n components << [self.class.id, @channel, @payload.bytesize].pack(PACK_CHAR_UINT16_UINT32)\n components << self.class.encoded_payload(@payload)\n components << FINAL_OCTET\n components\n end",
"def byte_arr_to_string arr\n arr.pack(\"c*\")\nend",
"def bytesize(enc)\n end",
"def data_as_bytes\n data = []\n data << @status\n data << @meta_type\n data << 4\n data << @data[0]\n data << @data[1]\n data << @data[2]\n data << @data[3]\n end",
"def bytes(*args); data(1, *args); end",
"def bytes\n Base64.decode64(data)\n end",
"def data_as_bytes\n raise \"subclass responsibility\"\n end",
"def data_as_bytes\n data = []\n data << @status\n data << @meta_type\n data << 2\n data << @data[0]\n data << (@data[1] ? 1 : 0)\n end",
"def bytes; end",
"def bytes\n map { |e| e.bytes }.reduce(:+)\n end",
"def unpack\nraw_bytes.unpack \"NnnCCa6\"\nend",
"def bytes\n\t\tbin.unpack('C*')\n\tend",
"def to_s\n [0xFF, 0xFF, 0xFF, 0xFF, @header_data, @content_data.string].pack('c5a*')\n end",
"def as_bytes\n raise NotImplementedError\n end",
"def dhcp_option_value_byte_array(data, value)\r\n data << value.length.chr\r\n value.each do |element| \r\n data << element.chr\r\n end\r\n end",
"def byte(*bytes)\n return string(bytes.pack('C*')) \n end",
"def raw_to_base_64(byte_array)\n return \"\" if byte_array == []\n ((3 - (byte_array.length % 3)) % 3).times { byte_array << 0 }\n c1 = BASE_64_CHARS[byte_array[0] >> 2]\n c2 = BASE_64_CHARS[(byte_array[0] % 4) * 16 + (byte_array[1] >> 4)]\n c3 = BASE_64_CHARS[(byte_array[1] % 16) * 4 + (byte_array[2] >> 6)]\n c4 = BASE_64_CHARS[byte_array[2] % 64]\n c1 + c2 + c3 + c4 + raw_to_base_64(byte_array[3..-1])\nend",
"def bytes_to_bin(bytes)\n bytes.pack(\"C*\")\n end",
"def data\n identifier = @identifier || 0\n expiry = @expiry || 0\n size = [payload].pack(\"a*\").size\n data_array = [1, identifier, expiry, 32, token, size, payload]\n data_array.pack(\"cNNnH*na*\")\n end",
"def shift_string_bytes parameter_bytes\n parameter = []\n while parameter_bytes.length > 0\n b = parameter_bytes.shift\n if b == 0\n break\n end\n parameter << b\n end\n return parameter.pack('c*')\nend",
"def encode(bytes)\n [bytes.to_s].pack(\"m\").gsub(\"\\n\", '')\n end",
"def encode_bytes(*bytes)\n bytes.pack('C*')\n end",
"def to_bin\n [\n \"data\",\n [body.size].pack(\"V\"),\n body\n ].join\n end",
"def all_bytes\n end",
"def to_eiscp\n return [ @header[:magic], @header[:header_size], @header[:data_size], @header[:version], @header[:reserved], @iscp_message.to_s].pack(\"A4NNAa3A*\").encode(\"ascii\", :invalid => :replace, :undef => :replace)\n end",
"def to_bytes()\n\t\treturn self.chars.map(&:ord)\n\tend",
"def unpack(data); end",
"def decode\n @decode ||= Multihashes.decode([content_addressable].pack('H*'))\n end",
"def encode_bytes(raw_bytes)\r\n\t\tencoded_bytes = \"\"\r\n\t\t0.step(raw_bytes.length-1, 2) { |i|\r\n\t\t\tencoded_bytes << raw_bytes[i+1]\r\n\t\t\tencoded_bytes << raw_bytes[i]\r\n\t\t}\r\n\t\treturn encoded_bytes\r\n\tend",
"def to_bytes(*args)\n messages = to_messages(*args)\n if !messages.nil?\n messages.map(&:to_bytes).flatten\n elsif args.all? { |arg| bytes?(arg)}\n args\n end\n end",
"def pack_bytes(byte_string)\n [byte_string].pack('H*')\n end",
"def unpack\n @data.unpack('A4cN') \n end",
"def from_array(array)\n array.pack('U*')\n end",
"def items_to_bytes\n bytes = []\n @items.each do |item|\n bytes << item.key\n bytes << item.value\n end\n bytes\n end",
"def encode\n return @_data unless @_data.nil?\n @_data = [@bin_data].pack( 'm' ).chomp if @bin_data \n @_data\n end",
"def pack_data value\r\n [value].pack('l>').split('').map(&:ord)\r\nend",
"def bytes\n contents.bytes\n end",
"def bytes\n contents.bytes\n end",
"def sub_bytes\n # map{|i|i.sbox}\n map(&:sbox)\n end",
"def bytes\r\n @bytes.dup\r\n end",
"def to_flat_a\n addr = self.addr\n addr[0, addr.size].unpack(\"F*\")\n end",
"def bytea(value)\n \"'\\\\x#{value.unpack1('H*')}'::bytea\"\n end",
"def bytes cols\n decode_values :byte, cols, true\n end",
"def to_numeric_byte_array(options = {})\n to_a(options).flatten\n end",
"def hex_base64_convert(s)\n [[s].pack(\"H*\")].pack(\"M*\")\nend",
"def read_data_byte(offset) [offset + 1, get_byte(offset)] end",
"def bytes\n self\n end",
"def hexbytes\n to_s.bytes.map { |b| sprintf(\"%02x\", b) }.join(\",\")\n end",
"def add_bytes(tag, value)\n value = value.to_s\n write_tag(tag, Type::BYTE_ARRAY)\n Varint.serialize(@io, value.bytesize)\n @io << value\n\n self\n end",
"def make_byte_string(char_array, encoding = 'BINARY')\n char_array.map do |char|\n char.chr.force_encoding('BINARY')\n end.join.force_encoding(encoding)\n end",
"def to_s\n [0xFFFFFFFF, @content_data.string].pack('Va*')\n end",
"def to_bytes\n data = items_to_bytes\n all_data = [@data_size, @next_page, @max, @min, @id, 0] + data\n $logger.logs [:data_size, @data_size, :next_page , @next_page, :max, @max, :min, @min, :id, @id].join(\",\")\n $logger.logs \"data: #{data.join(\",\")}\"\n all_data.pack('L*')\n end",
"def to_str\n bytes\n end",
"def to_str\n bytes\n end",
"def to_str\n bytes\n end",
"def to_a\n return @array if @array\n decoded = decode_format ? string.unpack(decode_format)[0] : string\n if string.size == 0\n []\n else\n uncompressed = @compressed ? Zlib::Inflate.inflate(decoded) : decoded\n uncompressed.unpack(unpack_format)\n end\n end",
"def gets_buffer_s(*a)\n @device.buffer.map { |msg| msg[:data] = TypeConversion.numeric_byte_array_to_hex_string(msg[:data]); msg }\n end",
"def bytes()\n #This is a stub, used for indexing\n end",
"def _unpack(bytes)\n if bytes.is_a?(Array) then bytes = bytes.join end\n bytes.unpack('H*')[0].scan(/../).reverse.join.to_i(16)\nend",
"def bytes\n [self].pack(\"q>\").bytes.to_a.drop_while{|x| x == 0}\n end",
"def last_four_chars_of_encryption_into_array\n @message[-4..-1].chars\n end",
"def to_a\n return [] unless @ready\n\n bytes = [OP_CODES[@op][@mode][:byte]]\n\n if [:a, :ar].include?(@mode) || (@arg && @arg > 255)\n bytes += [@arg.ls_byte, @arg.ms_byte]\n elsif @arg\n bytes += [@arg]\n else\n bytes\n end\n end",
"def test_decode_streaming_array_1\n assert_decode(\"9f018202039f0405ffff\", [1, [2, 3], [4, 5]])\n end",
"def reverse_byte_pairs!\n w = \"\"\n w.force_encoding(\"BINARY\") if w.respond_to?(:force_encoding)\n (0...@bytes.size).step(2) do |i|\n w << @bytes[i+1]\n w << @bytes[i]\n end\n @bytes = w\n __setobj__ @bytes\n self\n end",
"def unpack(binary)\n end",
"def jbytes( *args )\n args.map{ |arg| arg.to_s.to_java_bytes }\nend",
"def bytes()\n\t\t\treturn [\n\t\t\t\t(@addr >> 40 & 0xff).to_s(16).rjust(2, \"0\"),\n\t\t\t\t(@addr >> 32 & 0xff).to_s(16).rjust(2, \"0\"),\n\t\t\t\t(@addr >> 24 & 0xff).to_s(16).rjust(2, \"0\"),\n\t\t\t\t(@addr >> 16 & 0xff).to_s(16).rjust(2, \"0\"),\n\t\t\t\t(@addr >> 8 & 0xff).to_s(16).rjust(2, \"0\"),\n\t\t\t\t(@addr & 0xff).to_s(16).rjust(2, \"0\"),\n\t\t\t\t]\n\t\tend",
"def prepare_source_array data\n return [] if data.empty?\n if (leading_2_bytes = (leading_bytes = (first = data[0]).unpack 'C3').slice 0, 2) == BOM_BYTES_UTF_16LE\n data[0] = first.byteslice 2, first.bytesize\n # NOTE you can't split a UTF-16LE string using .lines when encoding is UTF-8; doing so will cause this line to fail\n return data.map {|line| (line.encode UTF_8, ::Encoding::UTF_16LE).rstrip }\n elsif leading_2_bytes == BOM_BYTES_UTF_16BE\n data[0] = first.byteslice 2, first.bytesize\n return data.map {|line| (line.encode UTF_8, ::Encoding::UTF_16BE).rstrip }\n elsif leading_bytes == BOM_BYTES_UTF_8\n data[0] = first.byteslice 3, first.bytesize\n end\n if first.encoding == UTF_8\n data.map {|line| line.rstrip }\n else\n data.map {|line| (line.encode UTF_8).rstrip }\n end\n end",
"def encode_chunk(chunk); end",
"def packed()\n body = @action.chr + \n @priv_lvl.chr + \n @authen_type.chr + \n @service.chr + \n @user_len.chr + \n @port_len.chr + \n @rem_addr_len.chr + \n @data_len.chr\n\n body << @user if (@user)\n body << @port if (@port)\n body << @rem_addr if (@rem_addr)\n body << @data if (@data)\n return(body)\n end",
"def jbytes( *args )\n args.map { |arg| arg.to_s.to_java_bytes }\nend",
"def to_binary()\n return self.unpack('B*').join\n end",
"def test_decode_streaming_array_4\n assert_decode(\"83019f0203ff820405\", [1, [2, 3], [4, 5]])\n end",
"def content_string\n all_bytes.pack('C*') if(all_bytes)\n end",
"def unpack_u3be_ary(str)\n rv = []\n xofs = 0\n while xofs < str.size\n rv << (\"\\x00\"+str[xofs,3]).unpack1(\"N\")\n xofs += 3\n end\n rv\n end",
"def to_bytes\n # set defaults\n self.sender ||= :pc\n self.receiver ||= 1\n\n bytes = []\n\n bytes.concat [0x00] * 5 # start of command\n bytes.concat [0x01] # <SOH>\n bytes.concat self.sender.to_bytes # Sender Address\n bytes.concat self.receiver.to_bytes # Reciver Address\n bytes.concat [0x02] # <STX>\n bytes.concat string_to_ascii_bytes(command_code) # Command Code\n bytes.concat command_payload_bytes # command specific payload\n bytes.concat [0x03] # <ETX>\n bytes.concat generate_checksum_bytes(bytes[10..-1]) # Checksum bytes (4)\n bytes.concat [0x04] # <EOT>\n\n bytes\n end",
"def test_decode_streaming_array_3\n assert_decode(\"83018202039f0405ff\", [1, [2, 3], [4, 5]])\n end",
"def byte cols\n decode_values :byte, cols\n end",
"def test_decode_streaming_array_2\n assert_decode(\"9f01820203820405ff\", [1, [2, 3], [4, 5]])\n end",
"def int_to_byte_array( i )\n \n not_nil( i, :i )\n\n res = []\n\n begin\n res << ( i & 0xff )\n i >>= 8\n end until ( i == 0 || i == -1 ) && ( res[ -1 ][ 7 ] == i[ 7 ] )\n\n res\nend",
"def gets_data_s(*a)\n arr = gets_bytestr\n arr.map { |msg| msg[:data] }.join\n end",
"def bytes(str)\n Simms::Bytes.new(str)\n end",
"def prepare_source_array data\n return [] if data.empty?\n if (leading_2_bytes = (leading_bytes = (first = data[0]).unpack 'C3').slice 0, 2) == BOM_BYTES_UTF_16LE\n data[0] = first.byteslice 2, first.bytesize\n # NOTE you can't split a UTF-16LE string using .lines when encoding is UTF-8; doing so will cause this line to fail\n return data.map {|line| (line.encode ::Encoding::UTF_8, ::Encoding::UTF_16LE).rstrip}\n elsif leading_2_bytes == BOM_BYTES_UTF_16BE\n data[0] = first.byteslice 2, first.bytesize\n return data.map {|line| (line.encode ::Encoding::UTF_8, ::Encoding::UTF_16BE).rstrip}\n elsif leading_bytes == BOM_BYTES_UTF_8\n data[0] = first.byteslice 3, first.bytesize\n end\n if first.encoding == ::Encoding::UTF_8\n data.map {|line| line.rstrip}\n else\n data.map {|line| (line.encode ::Encoding::UTF_8).rstrip}\n end\n end",
"def build_binary_data(data={})\n buffer = [68, 65, 84, 65, 0] # D A T A\n elements_to_send = []\n keys_to_send = data.keys\n\n Xplane::XPLANE_DATA_MAPPER.each do |element_id, included_elements|\n element = nil\n included_elements.each_with_index do |element_name, index|\n if keys_to_send.include? element_name\n element ||= new_element(element_id)\n element[index + 1] = data[element_name]\n end\n end\n elements_to_send.push element unless element.nil?\n end\n\n elements_to_send.each do |element|\n buffer += element\n end\n buffer.pack binary_format(elements_to_send.length)\n end",
"def bytes\n @bytes ||= [ @timestamp >> 32,\n @timestamp & 0xFFFF_FFFF,\n @node_id >> 32,\n @node_id & 0xFFFF_FFFF ].pack(\"NNNN\")\n end",
"def bytesize\n self.data.bytesize\n end",
"def raw_bytes\n @raw_bytes ||= read_raw_bytes\n end",
"def to_base64\n [self].pack(\"m\")\n end",
"def hex_to_base64(s)\n [[s].pack(\"H*\")].pack('m*')\nend",
"def SHA256 arr\n Digest::SHA256.digest(arr.map(&:chr).join).bytes\nend",
"def encode\n encoded = buffer[1..-1].reduce([]) do |acc, byte|\n if byte == 0x7e or byte == 0x7d\n acc << 0x7d << (byte ^ 0x20)\n else\n acc << byte\n end\n end\n Packet.new([0x7e] + encoded + [0x7e])\n end",
"def test_decode_streaming_array_5\n assert_decode(\"9f0102030405060708090a0b0c0d0e0f101112131415161718181819ff\", [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])\n end",
"def pack(p0) end",
"def packed()\n body = TacacsPlus.pack_int_net(@user_msg_len,2) +\n TacacsPlus.pack_int_net(@data_len,2) +\n @flags.chr\n \n body << @user_msg if (@user_msg)\n body << @data if (@data)\n return(body)\n end",
"def crypt_keeper_payload_parse(payload)\n payload.encode('UTF-8', 'binary',\n invalid: :replace, undef: :replace, replace: '')\n end",
"def hex_to_bytes(hex)\n hex.scan(/../).map { |x| x.hex }\n end",
"def to_blob; end",
"def to_blob; end",
"def to_blob; end"
] |
[
"0.6551525",
"0.6551525",
"0.65276164",
"0.65038466",
"0.6476908",
"0.6394346",
"0.6358875",
"0.63072485",
"0.63044786",
"0.6251373",
"0.6187515",
"0.61515623",
"0.6135854",
"0.61159796",
"0.60198617",
"0.5997552",
"0.59442997",
"0.5931232",
"0.5930717",
"0.5905622",
"0.5883848",
"0.5874531",
"0.5873085",
"0.58316755",
"0.5826217",
"0.5824376",
"0.5820345",
"0.5797523",
"0.5795009",
"0.5768043",
"0.57650614",
"0.57615477",
"0.57551104",
"0.5746572",
"0.57460105",
"0.5731737",
"0.57278883",
"0.57266945",
"0.57215047",
"0.57215047",
"0.5708543",
"0.569957",
"0.5687267",
"0.5662005",
"0.56583077",
"0.5655648",
"0.5645403",
"0.56348145",
"0.56343615",
"0.5623115",
"0.5606792",
"0.5605226",
"0.5571318",
"0.5553315",
"0.55486983",
"0.55486983",
"0.55486983",
"0.55380106",
"0.5535236",
"0.5531621",
"0.551915",
"0.55033094",
"0.5498738",
"0.54932725",
"0.54764414",
"0.54758555",
"0.5469728",
"0.5468596",
"0.5467549",
"0.54655176",
"0.5464445",
"0.54638094",
"0.54587215",
"0.54547733",
"0.5449106",
"0.54329395",
"0.5432608",
"0.5431339",
"0.5425853",
"0.54137015",
"0.5399945",
"0.53754896",
"0.5372597",
"0.53723025",
"0.5369261",
"0.53577244",
"0.5352676",
"0.5345313",
"0.53353584",
"0.53169984",
"0.53023505",
"0.52948886",
"0.5294058",
"0.5292813",
"0.5290282",
"0.52794933",
"0.52769154",
"0.5269093",
"0.52679366",
"0.52679366",
"0.52679366"
] |
0.0
|
-1
|
Public: Underline a string (make it a title). string The String to underline. Examples StringHelper.underline('1234') => "" Returns the String underline.
|
def underline(string)
'-' * string.size
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def underline(str)\n str += \"\\n\" + \"-\"*str.length\n end",
"def underline(str)\n \"<u>#{str.to_s}</u>\"\n end",
"def underline_message(message)\n Format(:underline, message)\n end",
"def underline\n surround_with_ansi(ANSI_UNDERLINE)\n end",
"def underline(underline=nil)\n cur_page.underline(underline)\n end",
"def underline; end",
"def underline; end",
"def add_underline symbol\n ('_' + symbol.to_s).to_sym\nend",
"def underline(text, options = {})\n options = { at: [0, 0] }.merge(options || {})\n text ||= ''\n text = Prawn::Text::NBSP if text.empty?\n text_width = options[:width] || width_of(text)\n text_height = options[:height] || height_of(text, width: text_width)\n text_box text, at: options[:at], width: text_width, height: text_height\n stored_line_width = line_width\n stored_stroke_color = stroke_color\n self.line_width = 0.5\n self.stroke_color = '000000'\n y = options[:at][1] - text_height + 2.pt\n x = options[:at][0]\n stroke_line [x, y], [ x + text_width, y ]\n self.line_width = stored_line_width\n self.stroke_color = stored_stroke_color\n end",
"def remove_lower_underline(str)\n raise 'string is empty' if str.empty?\n\n str_to_array = str.to_s.downcase.split('_')\n srt_camel_case = str_to_array[0]\n str_to_array.each_with_index do |el, i|\n srt_camel_case << el.capitalize unless i.zero?\n end\n srt_camel_case\nend",
"def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\" #\"#{string.capitalize}\" \nend",
"def process(type, text, page)\n if type == \"Underline\"\n if @out[-1] && @out[-1].index(text.strip)\n @out << @out.pop.gsub(text.strip,\"::::#{text.strip}::::\")\n else\n type = \"Underline-standalone\"\n end\n end\n return type == \"Underline\" ? nil : format(type, text, page)\nend",
"def process(type, text, page)\n if type == \"Underline\"\n if @out[-1].index(text.strip)\n @out << @out.pop.gsub(text.strip,\"::::#{text.strip}::::\")\n else\n type = \"Underline-standalone\"\n end\n end\n return type == \"Underline\" ? nil : format(type, text, page) \nend",
"def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\n end",
"def capitalize(string) \r\n puts \"#{string[0].upcase}#{string[1..-1]}\"\r\nend",
"def heading (str)\n h1 = \"--------------------\"\n $h2 = h1 + h1 + h1 + h1\n len = str.length\n len2 = len % 2\n hlen = (79 - (len + 2))/2\n result = $h2.slice(0,hlen) + \" \" + str + \" \" + $h2.slice(0,hlen)\n if len2 == 0 then result = result + \"-\" end\n return result\nend",
"def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend",
"def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend",
"def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend",
"def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend",
"def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend",
"def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend",
"def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend",
"def capitalize(string)\n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend",
"def capitalize(string)\n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend",
"def pascalcase(string, acronyms: [], separator: \"\")\n acronyms = acronyms.empty? ? config.acronyms : Acronyms.from(acronyms)\n parsecase(string, acronyms: acronyms, sep: separator) do |word|\n acronyms.fetch(word) || word.capitalize\n end\n end",
"def emphasis(str, opts = { print: false })\n cyan(str, opts)\n end",
"def string_to_upper_case(string)\n return @prefix.capitalize.gsub('-', '_') + string.capitalize.gsub('-', '_')\n end",
"def title(string)\n puts\n puts yellow(string)\n puts \"-\" * 80\nend",
"def title(string)\n puts\n puts yellow(string)\n puts '-' * 80\nend",
"def title(string)\n puts\n puts yellow(string)\n puts '-' * 80\nend",
"def header_format; self.underline end",
"def titleize(string)\n ret = string.to_s.dup\n ret[0] = ret[0].capitalize\n ret\n end",
"def capitalLetter(string)\n\tputs \"#{string[0].upcase}#{string[1..-1]}\"\nend",
"def capitalize_words(string)\n\tindices = [0]\n\tidx = -1\n\n\twhile idx < string.length\n\t\tif string[idx] == \" \" || idx == -1\n\t\t\tstring[idx+1] = string[idx+1].to_s.upcase!\n\t\tend\n\t\tidx += 1\n\tend\t\n\n\treturn string\nend",
"def sentence_maker(string)\n string.join(\" \").capitalize << \".\"\nend",
"def shout(string)\n\treturn string.upcase\nend",
"def shout(str); str.upcase end",
"def string_in_line(string, length)\r\n puts '-'*((length/2)-(string.length/2))+\" #{string} \"+'-'*((length/2)-(string.length/2))\r\n end",
"def pascal_case(str)\n str\n .to_s\n .split('_')\n .collect(&:capitalize)\n .join\n end",
"def make_prompt_string( string )\n\t\t\treturn CLEAR_CURRENT_LINE + colorize( 'bold', 'green' ) { string + ' ' }\n\t\tend",
"def shout(phrase)\n return \"#{phrase.upcase} !!!!\"\n #return \"#{phrase}!!!!\".upcase\nend",
"def titlecase(string, acronyms: [], separator: \" \")\n acronyms = acronyms.empty? ? config.acronyms : Acronyms.from(acronyms)\n parsecase(string, acronyms: acronyms, sep: separator) do |word|\n acronyms.fetch(word) || word.capitalize\n end\n end",
"def string(food, dessert)\n puts \"#{food.upcase} & #{dessert.upcase} is my restaurant\"\nend",
"def urlify(string)\n\tif string.include?(' ') == true\n\t\tstring.gsub!(' ', '%20')\n\telse\n\t\tstring\n\tend\nend",
"def uncapitalize(string)\n str = string.dup\n str[0] = str[0].downcase\n str\n end",
"def titleize str\n\t\treturn str\n\tend",
"def capitalize_str(str)\r\n wrds = str.split(\" \")\r\n wrds.each {|w|\r\n w.capitalize!\r\n }\r\n wrds.join(\" \")\r\n end",
"def abbrevstring( string, length=30, ellipsis='…' )\n\t\treturn string if string.length < length\n\t\tlength -= ellipsis.length\n\t\treturn string[ 0, length ] + ellipsis\n\tend",
"def simple_string\n old_string = \"Ruby is cool\"\n new_string = old_string.reverse.upcase\n puts new_string\nend",
"def format_text(str)\n str = linebreaks(str)\n str = auto_link(str)\n end",
"def sentence_maker(string)\n\tstring[0] = string[0].capitalize\n\tphrase = ''\n\tstring.each do |word|\n\t\tphrase = phrase + word.to_s + ' '\n\tend\n\tphrase = phrase.chop\n\tphrase = phrase + '.'\n\treturn phrase\nend",
"def change_font_underline(underlined = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_underline(underlined)\n update_font_references(font)\n end",
"def change_font_underline(underlined = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_underline(underlined)\n update_font_references(font)\n end",
"def cyan(string)\n \"\\n\\033[0;36m#{string}\\033[0m\"\nend",
"def cyan(string)\n \"\\n\\033[0;36m#{string}\\033[0m\"\nend",
"def cyan(string)\n \"\\n\\033[0;36m#{string}\\033[0m\"\nend",
"def conceal(string)\n if string.length < 8\n '****'\n else\n front = string[0, 4]\n back = string[-4, 4]\n \"#{front}****#{back}\"\n end\n end",
"def shout(string)\n\t\t\tstring.upcase\t\t\n\t\tend",
"def amendTheSentence(s)\n s.gsub(/([A-Z])/, ' \\1').strip.downcase\nend",
"def indent_string!(string, *args)\n string.instance_exec(*args, &IMPLEMENTATION)\n end",
"def capitalize_string(input)\n\tif input.empty?\n\t\traise 'Oops! You did not enter anything.'\n\telse\n\t\tcapitalize_words(input.downcase.split(' '))\n\tend\nend",
"def capitals(string)\n if string.length > 10\n puts string.upcase\n else\n puts string\n end\n end",
"def shout(str)\n return str.upcase\nend",
"def indent_string(string, *args)\n string = string.dup\n indent_string!(string, *args)\n string\n end",
"def headercase(string, acronyms: [], separator: \"-\")\n acronyms = acronyms.empty? ? config.acronyms : Acronyms.from(acronyms)\n parsecase(string, acronyms: acronyms, sep: separator) do |word|\n (acronym = acronyms.fetch(word)) ? acronym : word.capitalize\n end\n end",
"def change_font_underline(underlined=false)\n validate_worksheet\n # Get copy of font object with modified underline settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_underline(font, underlined)\n # Update font and xf array\n change_font(font)\n end",
"def titleize(string)\n string.capitalize!\n space_indices = (0 ... string.length).find_all { |i| string[i,1] == \" \" }\n indices_to_upcase = space_indices.map { |i| i+= 1 }\n indices_to_upcase.map { |i| string[i] = string[i].upcase!}\n string\nend",
"def prepare_string(string)\n string.chomp.gsub(' ', '-').capitalize\nend",
"def snake_to_space(string)\n string.to_s.tr('_', ' ')\nend",
"def cyan(string)\n \"\\033[0;36m#{string}\\033[0m\"\nend",
"def titleize(string)\n if string.empty? || string == ' '\n \"This is an empty string!\" \n else\n string.split.map { |word| word.capitalize }.join(' ')\n end\nend",
"def capitalize(string)\n if string.length > 10\n puts string.upcase\n else \n puts string\n end\nend",
"def titleize_a_string(string)\n result = string.split.each do |x|\n if (x != 'a' && x != 'and' && x != 'the')\n x.capitalize!\n end\n end\n result[0].capitalize!\n result.join(' ')\nend",
"def american_string(string)\n\tputs string + \" only in america\"\nend",
"def upcase_string(string)\n if string.length > 10\n puts string.upcase\n else\n puts string\n end\nend",
"def pascalize(string)\n (string.split('_').map { |word| word.capitalize }).join\n end",
"def title(text)\n padding = \"#\" * (79 - (text.length + 1))\n puts \"#{padding} #{text}\"\nend",
"def stylize(string)\n CLI::UI.fmt string\n end",
"def yell (string)\n string.upcase + \"!\"\nend",
"def humanize(string)\n string = string.to_s\n string.respond_to?(:humanize) ? string.humanize : string.gsub(/_/, \" \").capitalize\n end",
"def titleize_a_string(string)\nend",
"def titleize_a_string(string)\nend",
"def displayLetter(str)\n underscore = \"_\"\n puts \"_\" * str.length\nend",
"def capitalize(s)\n s[0..0].upcase + s[1..-1]\n end",
"def center_me(string)\n puts string.center(50)\nend",
"def print_header(string)\n puts '*'.white * 80\n puts string.center(80)\n puts '*'.white * 80\nend",
"def banner_line(end_cap_string, center_string, fill_string, banner_width)\n end_cap_string + center_string.center(banner_width, fill_string) + end_cap_string\nend",
"def humanize_renderer(str)\n str.split(\"_\").map{ |split| split.capitalize }[0...-1].join(\" \")\n end",
"def titleize_a_string(string)\n exceptions = ['a', 'and', 'the']\n string.capitalize!\n array = string.split(' ')\n array.map do | str |\n exceptions.include?(str) ? str : str.capitalize\n end.join(' ')\nend",
"def formatting(str)\n puts str * 80\nend",
"def titleize(string)\n string = string.split(\" \")\n output = \"\"\n string.each do | word |\n output << word[0].upcase + word[1..-1].downcase + \" \"\n end\n output.chop\nend",
"def snake_to_space(string)\n string.to_s.gsub(/_/, ' ')\n end",
"def trailingslashit(string)\n untrailingslashit(string) + '/'\n end",
"def camel2underscores(s)\n return s if not s\n return s if s == ''\n def decapitilize(s)\n s[0,1].downcase + s[1,s.length-1].to_s\n end\n s = decapitilize s\n while s.match /([A-Z]+)/\n s = s.gsub /#{$1}/,'_'+ decapitilize($1)\n end\n s\n end",
"def shout(str)\n str.upcase\nend",
"def upcase(string)\n if string.length > 10\n puts string.upcase\n else\n puts string\n end\nend",
"def titleize_a_string(string)\n\t# split() turns the string into an array of word. Take the first element of the array and capitalize it\n\tfirst_word = string.split.first.capitalize\n\t# take the string, split it into an array and drop the second element of the first element of the array \n\twords_to_titleize = string.split.drop(1)\n\trejected_words = ['is','a','the','and']\n\twords_to_titleize.inject(first_word) do |acc, word| \n\t\tif rejected_words.include?(word)\n\t\t\tacc + ' ' + word\n\t\t\telse\n\t\t\t\tacc + ' ' + word.capitalize\n\t\t\tend\n\t\tend\nend",
"def capitalized string\n little_words = [\"a\", \"an\", \"the\", \"and\", \"in\", \"of\"]\n string = string.downcase\n string = string.split(\" \")\n if string.length > 1\n string.each_index do |i|\n if i == 0 || !little_words.include?(string[i])\n string[i] = string[i].capitalize\n end\n end\n else\n string[0] = string[0].capitalize\n end\n string.join(\" \").strip\n end",
"def upcase(string)\n if string.length > 10\n puts string.upcase\n else\n puts string\n end\nend"
] |
[
"0.7776272",
"0.761674",
"0.68934166",
"0.6820372",
"0.6599249",
"0.63962066",
"0.63962066",
"0.6216913",
"0.6161652",
"0.6155356",
"0.54567057",
"0.5362469",
"0.535676",
"0.53393173",
"0.5245526",
"0.52365553",
"0.5236024",
"0.5236024",
"0.5236024",
"0.5236024",
"0.5236024",
"0.5236024",
"0.52318734",
"0.5207343",
"0.5207343",
"0.52063334",
"0.5194528",
"0.5179254",
"0.5165862",
"0.5146141",
"0.5146141",
"0.5144249",
"0.5133437",
"0.5126499",
"0.50708497",
"0.5066203",
"0.5058799",
"0.5014112",
"0.5008026",
"0.50060755",
"0.4998109",
"0.4990907",
"0.49785534",
"0.49549273",
"0.49532792",
"0.49422047",
"0.49332535",
"0.4913712",
"0.49128944",
"0.4911989",
"0.4911291",
"0.49072054",
"0.49057513",
"0.49057513",
"0.4894156",
"0.4894156",
"0.4894156",
"0.48902106",
"0.48652837",
"0.48586527",
"0.48568127",
"0.4856509",
"0.48563057",
"0.48532972",
"0.4850839",
"0.4849369",
"0.4848321",
"0.4842457",
"0.48331666",
"0.48271185",
"0.48256093",
"0.4821691",
"0.48188686",
"0.48140606",
"0.48065174",
"0.48038775",
"0.48012745",
"0.4796347",
"0.47878537",
"0.47822607",
"0.4779811",
"0.47775298",
"0.47775298",
"0.47699937",
"0.47677365",
"0.47608483",
"0.47535",
"0.475078",
"0.47477135",
"0.47434318",
"0.4735488",
"0.47323164",
"0.47301722",
"0.47298607",
"0.47274914",
"0.4723583",
"0.4718464",
"0.47177738",
"0.4715584",
"0.47136402"
] |
0.77408844
|
1
|
Public: Check if a string represents a numeric value. string The String to check. Returns Boolean.
|
def numeric?(string)
Float(string) != nil rescue false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def is_numeric?(s)\n # input -> s: a string\n # output -> true if the string is a number value, false otherwise\n begin\n if Float(s)\n return true\n end\n rescue\n return false\n end\n end",
"def is_number?(string)\n true if Float(string) rescue false\n end",
"def is_number? string\n true if Float(string) rescue false\n end",
"def is_number? string\n true if Float(string) rescue false\n end",
"def is_number?(string)\n true if Float(string) rescue false\n end",
"def is_number? string\n true if Float(string) rescue false\n end",
"def is_number? string\n true if Float(string) rescue false\n end",
"def isNumeric(s)\n\t\tbegin\n\t\t\tFloat(s)\n\t\trescue\n\t\t\tfalse # not numeric\n\t\telse\n\t\t\ttrue # numeric\n\t\tend\n\tend",
"def is_numeric?(s)\n !!Float(s) rescue false\n end",
"def is_number?(str)\n true if Float(str) rescue false\n end",
"def is_numeric(str)\n Float(str) != nil rescue false\n end",
"def numeric?(str)\n !str.to_s.match(/^-?[\\d.]+$/).nil?\n # str.to_i.to_s == str\nend",
"def _is_numeric?(str)\n Float(str) != nil rescue false\n end",
"def number?(string)\n string.to_i.to_s == string\n end",
"def is_number?(string)\n true if Integer(string) && Integer(string) >= 0 rescue false\n end",
"def is_number? string\n \t\ttrue if Float(string) rescue false\n\tend",
"def is_numeric?(s)\n !!Float(s) rescue false\n end",
"def is_numeric?(s)\n begin\n Float(s)\n rescue\n false # not numeric\n else\n true # numeric\n end\nend",
"def numeric?(string)\n !!(string =~ /\\A\\d+\\Z/)\nend",
"def value_is_integer?(string)\n return string.strip.numeric?\n end",
"def is_number(str)\n str.to_f.to_s == str.to_s || str.to_i.to_s == str.to_s\n end",
"def is_num(str)\n\treturn true if str =~ /^\\d+$/\n true if Int(str) rescue false\nend",
"def can_be_number(string)\n forced_as_f = string.to_f # force string to be a float\n forced_as_i = string.to_i # force string to be an integer\n return string == forced_as_f.to_s || string == forced_as_i.to_s # see if either of the forced strings equal the original\nend",
"def is_numeric(str)\n true if Integer(str) rescue false\nend",
"def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n end",
"def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n end",
"def is_number?(str)\n return str == str.to_f.to_s || str == str.to_i.to_s\nend",
"def is_number(string)\r\n\ttrue if Float(string) rescue false\r\nend",
"def is_a_number?(s)\n \ts.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n\tend",
"def is_number? string\n true if Float(string) rescue false\nend",
"def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true \n end",
"def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true \n end",
"def is_number?(string)\n # catch and return false if it isn't an integer\n true if Float(string) rescue false \nend",
"def is_numeric_string(s, length)\n begin\n if s && s.length == length && Integer(s)\n return true\n end\n rescue\n # noop\n end\n return false\n end",
"def numeric?(numberInput)\n numberInput = numberInput.to_s\n if numberInput =~ /^[-+]?[0-9]*\\.?[0-9]+$/\n \n return true\n else\n return false\n end\nend",
"def is_numeric?(value)\n !!Float(value) rescue false \n end",
"def ValidNumber? (string)\t\t\t\t\t\t\t\t\n\t### Check if a non-numeric character ever appears in the string using /\\D/\n\t### If so, we know it's not a 'NUMBER' as defined\n\t### Also check if string is empty\n\treturn ( not(/\\D/ =~ string) && not(string.length.zero?) ), string.to_i\nend",
"def is_number?(string)\n true if Float(string) rescue false #need to understand this\nend",
"def numeric?(character)\n (character =~ /[0-9]/) == 0\n end",
"def is_a_number?(str)\n str.match(/\\d/)\nend",
"def number?\n\t\ttrue if Float(string) rescue false\n\tend",
"def is_number(str)\n true if Float(str)\nrescue StandardError\n false\nend",
"def is_numeric?(num)\n num == num.to_i.to_s || num == num.to_f.to_s\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\n end",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\n end",
"def is_numeric(num)\n\n if num.to_f.to_s == num || num.to_i.to_s == num\n return true\n else\n return false\n end\n\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def is_numeric?\n for c in self.gsub('.', '').gsub('-', '').scan(/./)\n return false unless (0..9).to_a.map { |n| n.to_s }.include?(c)\n end\n return true\n end",
"def value_is_float?(string)\n return false if string.scan(/\\./).length != 1\n sides = string.split('.')\n return sides[0].numeric? && sides[1].numeric? && sides[1].to_i >= 0\n end",
"def is_numeric?(val)\n Float val rescue false\n end",
"def is_numeric?(obj)\n obj.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\nend",
"def numeric?\n !!(self =~ /\\A[0-9]+\\.*[0-9]*\\z/)\n end",
"def numeric?(value, options = nil)\n return true if value.nil? and not required(options) \n return false unless value.is_a?(String)\n return false unless value.to_i.to_s == value\n return int?(value.to_i, options)\n end",
"def is_numeric?(i)\n # check if i is a number\n i.to_i.to_s == i || i.to_f.to_s == i\n end",
"def zero_or_positive_integer_string?(value)\n value.is_a?(String) && /^\\d+$/ =~ value ? true : false\n end",
"def contains_number (str)\n\n\treturn str =~ /\\d/\n\nend",
"def is_numeric?(obj)\n obj.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n end",
"def is_numeric?\n self.match(/^[0-9]+$/)\n end",
"def is_integer? string\n true if Integer(string) rescue false\n end",
"def is_integer(string)\n /\\A[+-]?\\d+\\Z/ === string\n end",
"def valid_looking_string?(str)\n str =~ /\\d/\n end",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string != 0\nend",
"def number?(str)\n !!Integer(str)\nrescue ArgumentError, TypeError\n false\nend",
"def valid_float_str?(str)\n str =~ /^[+\\-]?[\\d\\.]*$/ # optional sign, then only digits OR '.'\n end",
"def number?(value)\n value.is_a?(Numeric)\n end",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend"
] |
[
"0.88149136",
"0.8456672",
"0.84565103",
"0.8404366",
"0.8355209",
"0.8316461",
"0.8316461",
"0.83077365",
"0.82840705",
"0.82694274",
"0.8236443",
"0.82239604",
"0.8200847",
"0.8199362",
"0.81501245",
"0.8148475",
"0.8132889",
"0.8052711",
"0.80506104",
"0.79326266",
"0.78958637",
"0.78759384",
"0.7844243",
"0.7840513",
"0.77686733",
"0.77686733",
"0.7678951",
"0.76603645",
"0.76568425",
"0.76091325",
"0.7605702",
"0.7605702",
"0.75475276",
"0.7541445",
"0.74779546",
"0.7446512",
"0.74369204",
"0.73877734",
"0.7380031",
"0.73528343",
"0.733035",
"0.7323084",
"0.7282261",
"0.7224235",
"0.72232455",
"0.72232455",
"0.72232455",
"0.72232455",
"0.72232455",
"0.72232455",
"0.72232455",
"0.72232455",
"0.72232455",
"0.72232455",
"0.72232455",
"0.72232455",
"0.72232455",
"0.72232455",
"0.72232455",
"0.72232455",
"0.72232455",
"0.72232455",
"0.72232455",
"0.72232455",
"0.71830684",
"0.7176147",
"0.7175071",
"0.71453226",
"0.7130357",
"0.7112129",
"0.7108709",
"0.71002096",
"0.7074866",
"0.70625836",
"0.7057112",
"0.705695",
"0.7051051",
"0.7048435",
"0.7016926",
"0.7002591",
"0.6975859",
"0.69691175",
"0.69691175",
"0.69660825",
"0.69583",
"0.6948081",
"0.6944675",
"0.6944675",
"0.6944675",
"0.6944675",
"0.6944675",
"0.6944675",
"0.6944675",
"0.6944675",
"0.6944675",
"0.6944675",
"0.6944675",
"0.6944675",
"0.6944675",
"0.6944675"
] |
0.836634
|
4
|
Checks if the physattr is hidden
|
def is_hidden?
Skill.where(name: self.name).first.hidden
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hidden?\n not visible\n end",
"def hidden?()\n not visible?()\n end",
"def hidden?\n false\n end",
"def hidden?\n false\n end",
"def hidden?\n false\n end",
"def is_hidden?\n\t\tself.hidden\n\tend",
"def hidden?\n qattrs[:hidden] == '1'\n end",
"def invisible?\n false\n end",
"def not_hidden?\n not hidden\n end",
"def hidden?\n end",
"def hidden?\n self.privacy == HIDDEN\n end",
"def invisible?\n false\n end",
"def invisible?\n false\n end",
"def hidden?\n return @hidden\n end",
"def hidden?\n @hidden\n end",
"def hide?\n @hide\n end",
"def hidden?\n return @hidden\n end",
"def hidden?(*)\n false\n end",
"def invisible?(attribute=nil,current_user=nil)\n !visible?(attribute)\n end",
"def hidden?\n hidden_at?\n end",
"def hidden?\n hidden_at?\n end",
"def hidden?\n hidden_at?\n end",
"def hidden?\n classes.include?('hidden')\n end",
"def hidden?\n if object.respond_to? :menu_hidden\n object.menu_hidden\n end\n end",
"def hidden?\n @field.widget.hidden?\n end",
"def panel_hidden\n Panel.panel_hidden(pointer) == 0\n end",
"def hidden?()\n @view__.hidden?\n end",
"def is_visible?\n visibility && ( visibility > 0 )\n end",
"def hidden?; self[:hidden] ||= false; end",
"def visible?\n @style.display != 'none'\n end",
"def none?\n self.display_on == \"none\"\n end",
"def hidden?\n @params[:hidden] == true\n end",
"def hidden?\n return true if @state == STATE_HIDDEN\n ext = extent\n case(@anchor)\n when ANCHOR_TOP\n return @slide_offset <= -ext\n when ANCHOR_LEFT\n return @slide_offset <= -ext\n when ANCHOR_BOTTOM\n return @slide_offset >= 0\n when ANCHOR_RIGHT\n return @slide_offset >= 0\n end\n end",
"def hidden_name?\n @hidden_name\n end",
"def IsVisibleOnPortal # rubocop:disable Style/MethodName\n @attrs[:IsVisibleOnPortal] == 'True' ? true : false\n end",
"def invisible?\n resolved_rules.members.all? {|seq| seq.invisible?}\n end",
"def visible?\n model.respond_to?(:visibility) && model.visibility.include?(Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC)\n end",
"def check_visible(obj)\n return obj.gr_is_visible?\n end",
"def visible?\n @visible\n end",
"def visible?\n @visible\n end",
"def hidden_value?\n @hidden_value\n end",
"def make_hidden\n @linkage_vis = :hidden\n end",
"def visible?\n !value.nil?\n end",
"def visible?(check_ancestors = true) # rubocop:disable Style/OptionalBooleanParameter\n return false if (tag_name == 'input') && (native[:type] == 'hidden')\n return false if tag_name == 'template'\n\n if check_ancestors\n !find_xpath(VISIBILITY_XPATH)\n else\n # No need for an xpath if only checking the current element\n !(native.key?('hidden') ||\n /display:\\s?none/.match?(native[:style] || '') ||\n %w[script head style].include?(tag_name))\n end\n end",
"def visible?\n\t\t\t@visible\n\t\tend",
"def hidden?\r\n verb.to_s.start_with?('_')\r\n end",
"def panel_hidden\n FFI::NCurses.panel_hidden(@pointer) == 0\n end",
"def visible?\n wd_element.displayed?\n end",
"def visible?\n el.displayed?\n end",
"def visible?\n end",
"def isHidden _args\n \"isHidden _args;\" \n end",
"def wrapper_visibility\n @field_config[:hide_on_load] = !@field_config[:initially_visible] if @field_config&.key?(:initially_visible)\n return '' unless @field_config[:hide_on_load]\n\n ' hidden'\n end",
"def hide_edit_links?\n not @hide_edit_links.nil?\n end",
"def hide_edit_links?\n not @hide_edit_links.nil?\n end",
"def hide\n \tupdate_attribute(:hidden, true)\n end",
"def attribute?\n false\n end",
"def visibility?\n @visibility || true\n end",
"def hide_edit_links?\n !@hide_edit_links.nil? && @hide_edit_links == true \n end",
"def hide_edit_links?\n\tnot @hide_edit_links.nil?\nend",
"def showable?\n hidden? && hidden_origin.blank?\n end",
"def showable?\n hidden? && hidden_origin.blank?\n end",
"def xml_hidden_attributes # :nodoc:\n read_inheritable_attribute(\"attr_xml_hidden\")\n end",
"def hide_elements\n true\n end",
"def visible?\n true\n end",
"def is_showable\n return true unless self.is_hidden or self.is_deleted or self.status == \"tmp\"\n end",
"def hidden_field?(field_name); end",
"def has_no?(name, tag)\n element_is_visible(name, tag, @klass, false)\n end",
"def is_private?\n return true if visibility.nil?\n return( visibility == Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE && !is_under_embargo?)\n end",
"def visible?; \n\t\t@visible = true if @visible == nil\n\t\t@visible\n\tend",
"def visible?(record, *attributes)\n attributes.any? do |attribute|\n !CitizenBudgetModel.hidden_fields.fetch(record.class.model_name.param_key.to_sym, []).include?(attribute)\n end\n end",
"def hidden_field?(field_name)\n hiddens.find { |f| f.name == field_name }\n end",
"def hide_hid!\n @hide_hid = true\n end",
"def hidden?\n hooked? && currently_defined?\n end",
"def is_hidden?(path)\n parts = path.split(File::SEPARATOR)\n hidden = parts.collect do |f|\n f[0].chr == \"_\"\n end\n hidden.any?\n end",
"def test_invisible\n [@window, @sprite, @bitmap].each{|container|\n uc = UCCharacterGraphic.new(container, Rect.new(100, 40, 40, 40), $data_actors[1])\n uc.visible = false\n uc.draw()\n }\n return true\n end",
"def has_attributes?\n a = @context.attributes.find{|a| @options.show_all || a.visibility == :public || a.visibility == :protected}\n a ? true : false\n end",
"def visibility_changed?\n !(@old_visible_value == visible)\n end",
"def in_hidden_entrance\r\n\r\n # Determine the tile placement, as integers \r\n tile_x = (@player.get_x/16).to_i\r\n tile_y = (@player.get_y/16).to_i\r\n\r\n # Hidden tile is present, so return true\r\n if @level[1][tile_y-1][tile_x] > 0 then\r\n return true\r\n\r\n # Otherwise the player is no longer hidden\r\n else\r\n return false\r\n end\r\n end",
"def hideable?\n @hideable ||= [\"Task deferred\", \"Project deferred\", \"Waiting on\", \"Hanging\"].include?(status)\n end",
"def hide(val = true)\n show_in_details !val\n show_in_table !val\n editable !val\n end",
"def visible=(vis)\n if vis\n show\n else\n hide\n end\n end",
"def hidden=(hidden)\n end",
"def group_settings_hidden?\n settings = self.group_settings\n\n !('true' == settings['showInGroupDirectory'] &&\n ['ANYONE_CAN_JOIN', 'ALL_IN_DOMAIN_CAN_JOIN'].include?(settings['whoCanJoin']) &&\n ['ANYONE_CAN_VIEW', 'ALL_IN_DOMAIN_CAN_VIEW'].include?(settings['whoCanViewGroup']))\n end",
"def hide_billing\n @attributes[:hide_billing]\n end",
"def private?\n @attributes[\"access\"] ? @attributes[\"access\"] == \"private\" : false\n end",
"def hidden?(item)\n Versioned.versioned?(item) && !Versioned.current?(item[:repo_docs], @item_rep)\nend",
"def ishowu_hide\n ishowu_menu_item(\"iShowU\", \"Hide iShowU\")\n end",
"def visible?\n @a.nonzero?\n end",
"def visible?\n assert_exists\n @element.displayed?\n end",
"def visible?\n assert_exists\n @element.displayed?\n end",
"def check_if_can_be_set_to_visible_against_images\n return true if visibility_changed? && !visible\n if self.images.empty?\n errors.add(\"Can't update the product visibility because the product has no images\") \n false\n end\n end",
"def hide_contact_details?\n #hide for non-login and non-project-member\n if !logged_in? or !current_user.person.member?\n return true\n else\n Seek::Config.hide_details_enabled\n end\n end",
"def hidden?\n enabled = (@hidden_feature_set || []).any? do |feature|\n Feature.enabled?(feature)\n end\n @feature_hidden && !enabled\n end",
"def visible?\n !(self.created? || self.suspended? || self.deleted?)\n end",
"def visible?\n !(self.created? || self.suspended? || self.deleted?)\n end",
"def visible?\n !(self.created? || self.suspended? || self.deleted?)\n end",
"def negation\n attr_val('./@inversionInd') == \"true\"\n end",
"def hide_button?\n # returning false to maintain the original behavior\n return false unless self.repo_settings\n\n return true if self.repo_settings.fetch(:hide_request_button, false)\n return true if self.repo_settings.fetch(:hide_button_for_accessions, false) && record.is_a?(Accession)\n\n if (types = self.repo_settings.fetch(:hide_button_for_access_restriction_types, false))\n notes = (record.json['notes'] || []).select {|n| n['type'] == 'accessrestrict' && n.has_key?('rights_restriction')}\n .map {|n| n['rights_restriction']['local_access_restriction_type']}\n .flatten.uniq\n\n # hide if the record notes have any of the restriction types listed in config\n return true if (notes - types).length < notes.length\n end\n\n false\n end",
"def virtual?\n attributes[\"virtual\"] == \"1\"\n end",
"def hidden?\n basename.to_s.start_with?('.')\n end"
] |
[
"0.7418712",
"0.7338028",
"0.7306835",
"0.72635907",
"0.72635907",
"0.7178902",
"0.7159782",
"0.7098006",
"0.7090842",
"0.70641327",
"0.7064094",
"0.70607716",
"0.70607716",
"0.7032798",
"0.70238507",
"0.69995856",
"0.69824296",
"0.6973189",
"0.6926678",
"0.68714976",
"0.68714976",
"0.68714976",
"0.67556787",
"0.67285126",
"0.6647885",
"0.6626314",
"0.655391",
"0.64964926",
"0.64864606",
"0.6482969",
"0.6481856",
"0.645018",
"0.6445507",
"0.634861",
"0.6303849",
"0.6247966",
"0.624348",
"0.6228231",
"0.62030023",
"0.62030023",
"0.6185644",
"0.6177595",
"0.61735165",
"0.61705583",
"0.6167681",
"0.6161245",
"0.61602944",
"0.6159594",
"0.61497104",
"0.6142548",
"0.61388",
"0.61381805",
"0.613258",
"0.613258",
"0.6108291",
"0.6107391",
"0.60936385",
"0.6084515",
"0.6064731",
"0.60642356",
"0.60642356",
"0.60578746",
"0.60411626",
"0.60409456",
"0.598351",
"0.59420294",
"0.59335774",
"0.5920785",
"0.591648",
"0.588966",
"0.5864497",
"0.5858583",
"0.5847917",
"0.58443505",
"0.5843162",
"0.58393216",
"0.5813453",
"0.5793117",
"0.5780458",
"0.576732",
"0.5764746",
"0.5759991",
"0.575854",
"0.5756857",
"0.57511586",
"0.5742634",
"0.5731687",
"0.57056916",
"0.5698316",
"0.5698316",
"0.5695776",
"0.56936884",
"0.56771463",
"0.56764406",
"0.56764406",
"0.56764406",
"0.5671299",
"0.5669138",
"0.5659325",
"0.56579304"
] |
0.5999902
|
64
|
Default this to text/xml for now....
|
def content_type
"text/xml"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def xml; end",
"def xml?; end",
"def xml?; end",
"def content text\n @xml << text.to_s\n nil\n end",
"def render_xml(text, options={})\n render({:text => \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n#{text}\"}.merge(options))\n end",
"def xml!; @xml = true; end",
"def xml\n\t\theaders[\"Content-Type\"] = \"text/xml; charset=utf-8\"\n\t\trender :layout => false\n\tend",
"def render_xml\n end",
"def format\n return :text if text?\n return :html if html?\n end",
"def to_xml\n\t\t\ttext = \"\"\n\t\t\t@response.write(text, 1)\n\t\t\treturn text\n\t\tend",
"def xml_str # :nodoc:\n @writer.string\n end",
"def default\n :html\n end",
"def export_format\n :plain_text\n end",
"def data_xml\n headers[\"content-type\"]=\"text/html\";\n end",
"def basic_data_xml\n headers[\"content-type\"]=\"text/html\";\n end",
"def content_type\n 'text/plain'\n end",
"def new\n @txt = Txt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @txt }\n end\n end",
"def to_s\n document.xml? ? to_xml : to_html\n end",
"def to_s\n \"<#{@name}\" + @attrs.sort.map{|k,v| \" #{k}='#{v.xml_attr_escape}'\"}.join +\n if @contents.size == 0\n \"/>\"\n else\n \">\" + @contents.map{|x| if x.is_a? String then x.xml_escape else x.to_s end}.join + \"</#{name}>\"\n end\n end",
"def default_encoding; end",
"def default_encoding; end",
"def parser_type(x)\n 'libxml'\n end",
"def default_render\n response.content_type.blank? ? respond_to(:html) : super \n end",
"def rendered_format\n Mime[:text]\n end",
"def to_xml\n return self.to_s\n end",
"def initialize passerelle\n\t\tsuper passerelle, %w(plain/text)\n\tend",
"def default_encoding=(_arg0); end",
"def to_xml\n render_xml\n end",
"def force_default_encoding; end",
"def content_type\n self[:content_type] == 'haml' ? 'text/html' : self[:content_type]\n end",
"def default_encoding\n (@media_type == \"text\") ? \"quoted-printable\" : \"base64\"\n end",
"def set_default_format\n if request.format.symbol.nil? || request.format.to_s == '*/*'\n logger.debug \"[ApplicationController] Request format set to #{request.format.to_s.inspect}, forcing 'text/plain'\"\n request.format = :text\n end\n end",
"def default_format\n @default_format ||= :html\n end",
"def set_xml_output\n @xml_out = true\n end",
"def toxml\n\t\tend",
"def to_xml\n self.to_s\n end",
"def to_xml\n self.to_s\n end",
"def text_exporter\n self.class.exporter_by_type(:text)\n end",
"def new\n @plain_text = PlainText.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @plain_text }\n end\n end",
"def default_content; end",
"def to_str\n str = \"\"\n REXML::Formatters::Pretty.new(1).write(@xml,str)\n\n return str \n end",
"def result\n render_xml\n end",
"def escape_xml(text)\n text.encode(xml: :text)\n end",
"def to_xml\n return to_s\n end",
"def to_xml\n return to_s\n end",
"def to_str\n str = \"\"\n REXML::Formatters::Pretty.new(1).write(@xml,str)\n \n return str \n end",
"def text_exporter\n self.class.exporter_by_type(:text)\n end",
"def text_exporter\n self.class.exporter_by_type(:text)\n end",
"def force_default_encoding=(_arg0); end",
"def new\n @text_content = TextContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @text_content }\n end\n end",
"def rexml? ; false end",
"def to_xml\n output=\"\"\n self.to_rexml.write output\n end",
"def to_xml\n\t\tend",
"def to_xml\n\t\tend",
"def config\n respond_to { |format| format.xml }\n end",
"def to_xml(options = T.unsafe(nil)); end",
"def to_xml(options = T.unsafe(nil)); end",
"def mime_type\n \"text/plain\"\n end",
"def text\n res = \"\"\n @contents.each{|c|\n if c.is_a? XML\n res << c.text\n elsif c.is_a? String\n res << c\n end # Ignore XML_PI/XML_Comment\n }\n res\n end",
"def _to_xml(xml)\n end",
"def parser_type(x)\n 'rexml'\n end",
"def to_s\n\t\tstr = \"\\n<\" + @type\n\t\t@attributes.each{ |key,value|\n\t\t\tstr += \" \" + key.to_s + \" = \" + value.to_s\n\t\t}\n\t\tif @type == 'text'\n\t\t\tstr += \"> \" + @content[0] + \" </\" + @type + \">\"\n\t\telse\n\t\t\tstr += \"> \"\n\t\t\t@content.each { |c|\n\t\t\t\tstr += c.to_s\n\t\t\t}\n\t\t\tstr += \"\\n</\" + @type + \">\"\n\t\tend\n\t\tstr\n\tend",
"def text_type\n return @text_type\n end",
"def html_open; \"<html>\"; end",
"def resource_base_name\n 'XML'\n end",
"def to_xml\n if @xml_header.nil?\n xml = ''\n else\n xml = @xml_header.to_xml + \"\\n\"\n end\n self.document.__types.each do |t|\n xml += self.document.send(t).to_xml\n end\n return xml\n end",
"def attributes_to_docx; end",
"def to_xml(*args); end",
"def to_xml(*args); end",
"def to_xml(*args); end",
"def to_xml(*args); end",
"def to_xml(*args); end",
"def to_xml(*args); end",
"def xml_document\n @root_node.to_s\n end",
"def xml_document\n @root_node.to_s\n end",
"def xml_escape(input); end",
"def text text\n end",
"def to_xml\n return @doc.to_s\n end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def text\n to_s\n end",
"def fix_typewriter(text); end",
"def _render_\n document.to_s\n end",
"def generate_xml\n values = {\n 'charset' => @options.charset,\n 'files' => gen_into(@files),\n 'classes' => gen_into(@classes),\n 'title' => CGI.escapeHTML(@options.title),\n }\n\n # this method is defined in the template file\n write_extra_pages if defined? write_extra_pages\n\n template = RDoc::TemplatePage.new @template::ONE_PAGE\n\n if @options.op_name\n opfile = open @options.op_name, 'w'\n else\n opfile = $stdout\n end\n template.write_html_on(opfile, values)\n end",
"def generate_xml\n values = {\n :charset => @options.charset,\n :files => gen_into(@files),\n :classes => gen_into(@classes),\n :title => CGI.escapeHTML(@options.title),\n }\n\n template = RDoc::TemplatePage.new @template::ONE_PAGE\n\n opfile = if @options.op_name then\n open @options.op_name, 'w'\n else\n $stdout\n end\n template.write_html_on(opfile, values)\n end",
"def text; end",
"def text; end"
] |
[
"0.72100955",
"0.6977978",
"0.6977978",
"0.652412",
"0.651708",
"0.64425474",
"0.6409921",
"0.6361884",
"0.631413",
"0.630975",
"0.63049006",
"0.62018555",
"0.60868883",
"0.60678756",
"0.6060276",
"0.60105604",
"0.59240925",
"0.58743465",
"0.58397794",
"0.57994705",
"0.57994705",
"0.5795826",
"0.57920295",
"0.5788356",
"0.57738805",
"0.5759194",
"0.5743861",
"0.57326645",
"0.57034445",
"0.57012236",
"0.56981415",
"0.56962764",
"0.5684387",
"0.5676385",
"0.5660117",
"0.5646169",
"0.5646169",
"0.5632827",
"0.56328213",
"0.5632814",
"0.5628782",
"0.56261206",
"0.560336",
"0.5602659",
"0.5602659",
"0.5597526",
"0.5587284",
"0.5587284",
"0.558318",
"0.55734587",
"0.55726177",
"0.5569918",
"0.55546534",
"0.55546534",
"0.5545769",
"0.5543416",
"0.5543416",
"0.5539233",
"0.55381644",
"0.5535181",
"0.5535109",
"0.5529861",
"0.552867",
"0.5523479",
"0.5521163",
"0.55191565",
"0.55115956",
"0.5497234",
"0.5497234",
"0.5497234",
"0.5497234",
"0.5497234",
"0.5497234",
"0.5497169",
"0.5497169",
"0.5491403",
"0.5489294",
"0.5483737",
"0.5471445",
"0.5471445",
"0.5471445",
"0.5471445",
"0.5471445",
"0.5471445",
"0.5471445",
"0.5471445",
"0.5471445",
"0.5471445",
"0.5471445",
"0.5471445",
"0.5471445",
"0.5471445",
"0.5471445",
"0.5469578",
"0.54633605",
"0.5455151",
"0.5447469",
"0.54465324",
"0.54459345",
"0.54459345"
] |
0.6924334
|
3
|
Returns HTML ready to be used in the email body, HTML is generated by parsing the email.html template and applying realease_notes.md content
|
def parsed_body(opts)
file = File.open(File.dirname(__FILE__) + "/email.html", "r")
content = file.read
markdown = Yolo::Tools::Ios::ReleaseNotes.html
content = content.gsub("YOLO.TITLE",opts[:title])
content = content.gsub("YOLO.CONTENT",markdown)
if opts[:ota_password] and opts[:ota_password].length > 0
content = content.gsub("YOLO.PASSWORD","<h3>Password</h3><hr><p>#{opts[:ota_password]}</p>")
else
content = content.gsub("YOLO.PASSWORD","")
end
content = content.gsub("YOLO.LINK",opts[:ota_url])
content
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new_html_email(html, triggered_by_user_test)\n if triggered_by_user_test\n test_notice = create_test_notice_html()\n end\n <<-EOF\n<html>\n <head>\n <title>AppOptics Alert</title>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n </head>\n <body style=\"background-color: #ffffff; padding: 20px; margin: 0px;\">\n #{test_notice}\n <div id=\"headlogo\" style=\"text-align: left; padding-top:20px;\">\n <img src=\"https://s3.amazonaws.com/appoptics-email/dist/img/appoptics-logo@2x.png\" height=\"20\" alt=\"AppOptics\" />\n </div>\n <div style=\"background-color: #ffffff; font-family: Arial; font-size: 12px; color: #000000; text-align: left; vertical-align: top;\">\n <div id=\"content\">#{html}</div>\n </div>\n <div style=\"background-color: #ffffff; padding: 20px; font-family: Arial; font-size: 10px; line-height: 150%; color: #000000; text-align: center; vertical-align: top;\">\n You received this email because you set up alerts with the AppOptics app.\n </div>\n </body>\n</html>\n EOF\n end",
"def content_for_preview( layout_options )\r\n content = self.body.dup\r\n content.gsub!( /<%=\\s?(@[^%]+)\\s?%>/, '<code>\\1</code>' )\r\n mail = Mail.new( :token => \"\" )\r\n mail.content = Render::Base.new( content ).mail_content\r\n template = IO.read(\"#{RAILS_ROOT}/app/views/mail_tasks/mailer/this_mail.text.html.rhtml\")\r\n \r\n render = Render::Base.new( template, layout_options.merge( :mail => mail ) )\r\n render.mail_content\r\n end",
"def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_template.at_css('#env').content += env\n email_template.at_css(\"#circleci\")['href'] = view_build_link\n email_template.at_css(\"#allure\")['href'] = view_allure_link\n email_template.to_html\nend",
"def get_the_email_html(nline)\n\trecipient = @ws[nline, 1].to_s\n\t$mailsubject = \"A l'attention de la mairie de #{recipient}\"\n\t$html_content = \"<p> <b> A l'attention de la mairie de #{recipient} </b> </p>\n<p>Bonjour, </p>\n<p>Je m'appelle Thomas, je suis élève à une formation de code gratuite, ouverte à tous, sans restriction géographique, ni restriction de niveau. La formation s'appelle The Hacking Project (http://thehackingproject.org/). Nous apprenons l'informatique via la méthode du peer-learning : nous faisons des projets concrets qui nous sont assignés tous les jours, sur lesquel nous planchons en petites équipes autonomes. Le projet du jour est d'envoyer des emails à nos élus locaux pour qu'ils nous aident à faire de The Hacking Project un nouveau format d'éducation gratuite.\nNous vous contactons pour vous parler du projet, et vous dire que vous pouvez ouvrir une cellule à #{recipient}, où vous pouvez former gratuitement 6 personnes (ou plus), qu'elles soient débutantes, ou confirmées. Le modèle d'éducation de The Hacking Project n'a pas de limite en terme de nombre de moussaillons (c'est comme cela que l'on appelle les élèves), donc nous serions ravis de travailler avec #{recipient} ! </p>\n<p> Yann, Moussaillon de The Hacking Project</p>\" \n\nend",
"def carving_and_marking_part_4_email_body\n %(<div>VESSEL NAME: #{@submission.vessel}</div>\n <div>Please find enclosed the Carving and Marking Note for the above vessel.\n <br><br>A Commercial Bareboat Charter Carving and Marking Note must be\n signed by an Inspector of Marks/Authorised Measurer\n\n <br><br>Regulation 35 of the Merchant Shipping (Registration of Ships)\n Regulations 1993 states that a carving and marking note should be\n returned completed to the Registrar within three months.\n\n <br><br>[FREE TEXT]\n <br><br>We also require the following documents:\n <br><br>[FREE TEXT]\n <br><br>The documents can be emailed to:\n Commercial vessels: comm.registry@mcga.gov.uk\n <br><br>\n Alternatively, please post to:\n MCA\n Anchor Court\n Keen Road\n Cardiff\n CF24 5JW\n\n <br><br>\n Please do not hesitate to contact us you require any further assistance.\n </div>)\n end",
"def carving_and_marking_part_2_email_body\n %(<div>VESSEL NAME: #{@submission.vessel}</div>\n <div>Please find enclosed the Carving and Marking Note for the above vessel.\n <br><br>Please arrange for an MCA surveyor or Authorised Surveyor/Inspector\n of Marks to certify that the Carving and Markings are correct and return\n the form to this office.\n <br><br>Regulation 35 of the Merchant Shipping (Registration of Ships)\n Regulations 1993 states that a carving and marking note should be\n returned to the Registrar within three months.\n <br><br>We also require the following documents:\n\n <br>• Certificate of Measurement/Survey – Completed by a\n MCA Surveyor/Authorised Surveyor\n <br>• Valid Safety Certificate – Completed by a\n MCA surveyor\n <br>• [ITC 69 issued by Authorised Measurer] –\n [delete if not required (for over 24m only)]\n\n <br><br>\n Please do not hesitate to contact us you require any further assistance.\n </div>)\n end",
"def mailto_body_template\n Liquid::Template.parse(File.read(File.join(@options[:templates], \"mailto_body.liquid\")))\n end",
"def body\n render text: fetch_email(params[:id]).body, content_type: 'text/html'\n end",
"def cleaned_up_text_body(format = false)\n # http://stackoverflow.com/a/15098459\n caller = caller_locations(1,1)[0].label\n if caller == 'receive_issue' || caller == 'receive_issue_reply'\n html_body\n else\n super\n end\n rescue => e\n # log error\n RedmineHtmlMailHandler::HtmlMailHandlerLogger.write(:error, \"ERROR=#{e.message}\")\n RedmineHtmlMailHandler::HtmlMailHandlerLogger.write(:error, \"BACKTRACE=\\n#{e.backtrace.join(\"\\n\")}\")\n # raise error that can be catched by 'notify_invalid_mail_handler' plugin\n raise RedmineHtmlMailHandler::Error, e.message\n end",
"def body\n body = <<-eot\nECFS - Email Filing\n<PROCEEDING> #{DOCKET}\n<DATE> #{@comment[:date]}\n<NAME> #{@comment[:name]}\n<ADDRESS1> #{@comment[:street]}\n<ADDRESS2>\n<CITY> #{@comment[:city]}\n<STATE> #{@comment[:state]}\n<ZIP> #{@comment[:zip]}\n<LAW-FIRM>\n<ATTORNEY>\n<FILE-NUMBER>\n<DOCUMENT-TYPE> CO\n<PHONE-NUMBER>\n<DESCRIPTION> Brief Comment\n<CONTACT-EMAIL> #{contact_email}\n<TEXT> #{@comment[:date]}\n\nMs. Marlene H. Dortch, Secretary\nFederal Communications Commission\n445 12th Street SW\nWashington, DC 20554\n\nRe: A National Broadband Plan for Our Future, GN Docket No. 09-51\n\nDear Ms. Dortch,\n#{@comment[:text]}\n\n eot\n end",
"def preview_email\r\n invitation = Invitation.new(:user => current_user, :code => Code.new)\r\n mail = Mailers::Debate.create_invitation(current_user, @resource, invitation)\r\n @mail_body = mail.body.sub('No message provided', 'YOUR PERSONALIZED NOTE GOES HERE')\r\n\r\n render :inline => %Q{<%= simple_format(@mail_body, {:style => 'margin: 8px 0px'}) %>}\r\n end",
"def body(interpret_markdown=true)\n raise \"#{@filename} doesn't exist.\" if not File.exist?(@filename)\n if interpret_markdown\n @body ||= RDiscount.new(File.read(@filename)).to_html\n else\n @body ||= File.read(@filename)\n end\n @body\n end",
"def genHTMLMessage(title: \"\", headline: \"\", msg: \"\", template: $MU_CFG['html_template'], extra_vars: {})\n logo_url = \"/cloudamatic.png\"\n page = \"<img src='#{logo_url}'><h1>#{title}</h1>#{msg}\"\n vars = {\n \"title\" => title,\n \"msg\" => msg,\n \"headline\" => headline,\n \"logo\" => logo_url\n }.merge(extra_vars)\n if !template.nil? and File.exist?(template) and File.readable?(template)\n page = Erubis::Eruby.new(File.read(template)).result(vars)\n elsif $MU_CFG.has_key?('html_template') and\n File.exist?($MU_CFG['html_template']) and\n File.readable?($MU_CFG['html_template'])\n page = Erubis::Eruby.new(File.read($MU_CFG['html_template'])).result(vars)\n elsif File.exist?(\"#{$MU_CFG['libdir']}/modules/html.erb\") and\n File.readable?(\"#{$MU_CFG['libdir']}/modules/html.erb\")\n page = Erubis::Eruby.new(File.read(\"#{$MU_CFG['libdir']}/modules/html.erb\")).result(vars)\n end\n page\nend",
"def mk_email\n ps = \"P.S. Jeg har vedhæftet relevante dokumenter, så som eksamensbevis og CV i mailen.\"\n ps += \"\\nP.P.S Denne email var genereret med, og sendt fra et Ruby script :)\" if @skills and @skills.include? \"Ruby\"\n \"#{mk_intro}\\n#{mk_body}#{mk_outro}#{mk_sender}#{ps}\"\n end",
"def wrap_body_in_template(latex_body, document_title_plain_text, document_title_latex)\n # Assign l_vars not used in template\n git_repo = Repositext::Repository.new(@options[:source_filename])\n latest_commit = git_repo.latest_commit(@options[:source_filename])\n date_code = Repositext::Utils::FilenamePartExtractor.extract_date_code(\n @options[:source_filename]\n )\n language_code_3 = Repositext::Utils::FilenamePartExtractor.extract_language_code_3(\n @options[:source_filename]\n )\n # assign i_vars referenced in template file.\n @additional_footer_text = escape_latex_text(@options[:additional_footer_text])\n @body = latex_body\n @company_long_name = @options[:company_long_name]\n @company_phone_number = @options[:company_phone_number]\n @company_short_name = @options[:company_short_name]\n @company_web_address = @options[:company_web_address]\n @language_and_date_code = [language_code_3, date_code].join.upcase\n # Applies the settings for the first eagle indent and drop cap.\n @first_eagle = @options[:first_eagle]\n # Sets the starting page number.\n @first_page_number = @options[:first_page_number]\n @font_leading = @options[:font_leading]\n @font_name = @options[:font_name]\n @font_size = @options[:font_size]\n @footer_title = truncate_plain_text_title(\n @options[:footer_title_english], 43, 3\n ).unicode_upcase\n @has_id_page = @options[:has_id_page]\n @header_font_name = @options[:header_font_name]\n @header_text = compute_header_text_latex(\n @options[:header_text],\n @options[:header_footer_rules_present],\n @options[:language_code_3_chars]\n )\n @header_title = compute_header_title_latex(\n document_title_plain_text,\n document_title_latex,\n @options[:header_footer_rules_present],\n @options[:language_code_3_chars],\n @options[:truncated_header_title_length]\n )\n # Turns on hrules in title, header and footer.\n @header_footer_rules_present = @options[:header_footer_rules_present]\n # Sets the letter space for the headers.\n @header_letter_space = @options[:header_letter_space]\n @id_address_primary_latex_1 = @options[:id_address_primary_latex_1]\n @id_address_primary_latex_2 = @options[:id_address_primary_latex_2]\n @id_address_secondary_email = @options[:id_address_secondary_email]\n @id_address_secondary_latex_1 = @options[:id_address_secondary_latex_1]\n @id_address_secondary_latex_2 = @options[:id_address_secondary_latex_2]\n @id_address_secondary_latex_3 = @options[:id_address_secondary_latex_3]\n @id_copyright_year = @options[:id_copyright_year]\n @id_extra_language_info = @options[:id_extra_language_info]\n @id_paragraph_line_spacing = @options[:id_paragraph_line_spacing]\n @id_recording = @options[:id_recording] if @options[:include_id_recording]\n @id_series = @options[:id_series]\n @id_title_1_font_size = @options[:id_title_1_font_size]\n @id_title_font_name = @options[:id_title_font_name]\n @id_write_to_primary = @options[:id_write_to_primary]\n @id_write_to_secondary = @options[:id_write_to_secondary]\n @include_meta_info = include_meta_info\n @is_primary_repo = @options[:is_primary_repo]\n @language_code_3 = language_code_3.upcase\n @language_name = @options[:language_name]\n @last_eagle_hspace = @options[:last_eagle_hspace]\n @latest_commit_hash = latest_commit.oid[0,8]\n @linebreaklocale = @options[:language_code_2_chars]\n @magnification = magnification\n @metadata_additional_keywords = @options[:metadata_additional_keywords]\n @metadata_author = @options[:metadata_author]\n @page_number_command = compute_page_number_command(\n @options[:header_footer_rules_present],\n @options[:language_code_3_chars]\n )\n @page_settings = page_settings_for_latex_geometry_package\n # Force foreign languages to use Excelsior for paragraph numbers.\n @paragraph_number_font_name = @options[:paragraph_number_font_name]\n @pdf_version = @options[:pdf_version]\n @piid = Repositext::Utils::FilenamePartExtractor.extract_product_identity_id(@options[:source_filename])\n @polyglossia_default_language = polyglossia_default_language(@options[:language_code_3_chars])\n @primary_font_name = @options[:primary_font_name]\n @pv_id = @options[:pv_id]\n @question1_indent = @options[:question1_indent]\n @question2_indent = @options[:question2_indent]\n @question3_indent = @options[:question3_indent]\n @song_leftskip = @options[:song_leftskip]\n @song_rightskip = @options[:song_rightskip]\n @text_left_to_right = @options[:text_left_to_right]\n @title_font_name = @options[:title_font_name]\n @title_font_size = @options[:title_font_size]\n @title_vspace = @options[:title_vspace] # space to be inserted above title to align with body text\n @use_cjk_package = ['chn','cnt'].include?(@options[:language_code_3_chars])\n # Sets the vbadness_penalty limit for veritcal justification. This is the maximum penalty allowed.\n @vbadness_penalty = @options[:vbadness_penalty]\n @version_control_page = if @options[:version_control_page]\n compute_version_control_page(git_repo, @options[:source_filename])\n else\n ''\n end\n @vspace_above_title1_required = @options[:vspace_above_title1_required]\n @vspace_below_title1_required = @options[:vspace_below_title1_required]\n\n # dependency boundary\n @meta_info = include_meta_info ? compute_meta_info(git_repo, latest_commit) : ''\n\n erb = ERB.new(latex_template, nil, '>')\n r = erb.result(binding)\n r\n end",
"def html\n @resume = Resume.find(params[:id])\n\t @resume.fix_line_break_issue\n\t @html_resume = RDiscount.new(@resume.content).to_html\t\t\t\t# Markdown only. C binary. Fast\n render :layout => \"output\"\n end",
"def html\n @html ||= Template.new(\"#{@input_file}:body\", @body).\n render_with(template_ivar => self).to_html\n end",
"def plain_text_body\n\n return @plain_text_body unless @plain_text_body.nil?\n\n part = email.text_part || email.html_part || email\n @plain_text_body = Redmine::CodesetUtil.to_utf8(part.body.decoded, part.charset)\n\n # strip html tags and remove doctype directive\n @plain_text_body = ActionController::Base.helpers.strip_tags(@plain_text_body.strip) unless email.text_part\n @plain_text_body.sub! %r{^<!DOCTYPE .*$}, ''\n @plain_text_body\n\n end",
"def email_body\n sponsor_name = @config.plan.sponsor_name\n message = 'Hi there!'\\\n '<br />'\\\n '<br />'\\\n \"#{sponsor_name} has run their payroll. Please download the relevant reports below.\"\\\n '<br />'\\\n '<br />'\n message\n end",
"def get_the_email_html(message)\n # Addressage du fichier message\n message = File.read(message)\n return message\nend",
"def body_as_html\n markdown = MarkdownPresenter.new(body)\n markdown.convert_to_html\n end",
"def body\n HTML.render render_md, options\n end",
"def html_body(inline:false)\n html_body = Kramdown::Document.new(body).to_html\n html_body.gsub!(/<\\/?p>/,'') if inline\n html_body\n end",
"def content\n MarkdownService.new.render(body).html_safe \n end",
"def formatted_body\n body.gsub(/<tn>(.+?)<\\/tn>/m, '<br><p class=\"tn\">\\1</p>').gsub(/\\n/, \"<br>\")\n end",
"def body\n c = header + (\n message_formated +\n signature +\n footer\n ).in_div(id:'message_content')\n # Si le body style est défini, on met le code dans un div\n # contenant ce body style.\n c = c.in_div(style: SiteHtml::Mail.body_style) if SiteHtml::Mail.respond_to?(:body_style)\n return c\n end",
"def html\n process_message_body if !@html\n @html\n end",
"def to_html\n case content_type\n when 'text/html'\n content\n when 'text/rtf'\n MessageProcessor.make_html_from_rtf(content)\n when 'text/plain'\n if content.starts_with?(\"{\\\\rtf\")\n MessageProcessor.make_html_from_rtf(content)\n else\n #MessageProcessor.make_html_from_text(content)\n content\n end\n when 'application/x-pit'\n c = content.scan(/^301 (.*)$/).join(\"\\n\")\n if c.starts_with? \"{\\\\rtf\"\n # it's rtf inside PIT\n MessageProcessor.make_html_from_rtf(c)\n else\n MessageProcessor.make_html_from_text(c)\n end\n when 'text/x-clinical'\n c = MessageProcessor.make_html_from_text(content).gsub(/\\*(\\w+)\\*/,\"<b>\\\\1</b>\")\n c.gsub(/\\{([^\\{]+)\\}/) do |str|\n obj = Code.get_clinical_object($1,self)\n if obj\n obj.to_html\n else\n str\n end\n end\n else\n MessageProcessor.make_html_from_text(content)\n end\n \n end",
"def template_text\n self.to_html ? self.body_html : self.body\n end",
"def body\n if mail.multipart?\n mail.parts.map { |part| Nokogiri::HTML(part.body.decoded).text }.join(\"\\n\\n\")\n else\n Nokogiri::HTML(mail.body.decoded).text\n end\n end",
"def body\n parts = []\n parts <<\n if !name.blank?\n if url.blank?\n name\n else\n \"<a href='#{sanitize_url}'>#{name}</a>\"\n end\n elsif !url.blank?\n \"[<a href='#{sanitize_url}'>website</a>]\"\n end\n parts << \"[<a href='mailto:#{sanitize_email}'>email</a>]\" if email\n parts.join(' ')\n end",
"def full_content\n result = <<END\n Message from: #{@name}\n\n Phone: #{@phone}\n Email: #{@email}\n %=====================================%\n\n #{self.content}\nEND\n result\n end",
"def get_body_for_html_display\n text = self.body.strip\n text = CGI.escapeHTML(text)\n text = MySociety::Format.make_clickable(text, :contract => 1)\n text = text.gsub(/\\n/, '<br>')\n return text\n end",
"def plain_text_body\n return @plain_text_body unless @plain_text_body.nil?\n\n parts = if (text_parts = email.all_parts.select {|p| p.mime_type == 'text/plain'}).present?\n text_parts\n elsif (html_parts = email.all_parts.select {|p| p.mime_type == 'text/html'}).present?\n html_parts\n else\n [email]\n end\n\n parts.reject! do |part|\n part.attachment?\n end\n\n @plain_text_body = parts.map do |p|\n body_charset = Mail::RubyVer.respond_to?(:pick_encoding) ?\n Mail::RubyVer.pick_encoding(p.charset).to_s : p.charset\n\n body = Redmine::CodesetUtil.to_utf8(p.body.decoded, body_charset)\n # convert html parts to text\n p.mime_type == 'text/html' ? self.class.html_body_to_text(body) : self.class.plain_text_body_to_text(body)\n end.join(\"\\r\\n\")\n\n @plain_text_body\n end",
"def extract_mail_body(mail)\n if mail.multipart?\n # Try to find an HTML part.\n part = find_mail_part(mail, ['text/html', 'text/plain'])\n if part.nil?\n '<em>Nachricht kann leider nicht angezeigt werden.</em>'\n else\n mail_html = sanitize_mail part\n if part.content_type == 'text/plain'\n \"<div class='text-mail'>#{mail_html}</div>\"\n else\n mail_html\n end\n \n end\n else\n sanitize_mail mail\n end\n end",
"def as_eloqua_email\n subject = \"#{self.title}: #{self.abstracts.first.headline}\"\n\n {\n :html_body => view.render_view(\n :template => \"/editions/email/template\",\n :formats => [:html],\n :locals => { edition: self }).to_s,\n\n :plain_text_body => view.render_view(\n :template => \"/editions/email/template\",\n :formats => [:text],\n :locals => { edition: self }).to_s,\n\n :name => \"[scpr-edition] #{self.title[0..30]}\",\n :description => \"SCPR Short List\\n\" \\\n \"Sent: #{Time.now}\\nSubject: #{subject}\",\n :subject => subject,\n :email => \"theshortlist@scpr.org\"\n }\n end",
"def body_to_html\n self.body = self.body.gsub(\"\\n\", '<br />')\n end",
"def body_content(params, show_raw = false)\n p = PatientMedicareEligibilityInfo.new(\"9999999990\", \"Metro\", \"Praveen\", \"K\", Date.new(2014, 5, 19), \"123456789A\")\n #edi_content = p.medicare_eligibility_271_edi_content\n #hcpc_codes_file_path = File.join(Rails.root, 'static_data', 'hcpc_codes', 'hcpc_2013.csv')\n data_hash = p.generate_eligibility_xml\n debug_log data_hash\n if data_hash == {}\n %Q(\n <html><body style='font-color: red'><h1>Error fetching Eligibility Information. Possible Reasons: \n <br>\n <br>\n <h2>1. No matching Patient Information found in Medicare database.\n <h2>2. Temporary Error Contacting Medicare Servers.\n <br>\n <br> \n <h2> Please double check the information you entered and Try after sometime.\n <h2> If Error persists, please contact Fasternotes Support.</body></html>\n )\n else\n html_content = html_data_from_hash(data_hash)\n %Q(\n #{html_content}\n )\n end\n end",
"def mail_content_with_layout( mail, layout_options={} )\n tmail = Mailer.create_this_mail( mail, layout_options )\n tmail.parts.find{ |mail| mail.content_type == 'text/html' }.body\n end",
"def assemble_template body_file\n body = body_file.read\n return body if body =~ /<html/\n\n head_file = @template_dir + '_head.rhtml'\n footer_file = @template_dir + '_footer.rhtml'\n\n <<-TEMPLATE\n<!DOCTYPE html>\n\n<html>\n<head>\n#{head_file.read}\n\n#{body}\n\n#{footer_file.read}\n TEMPLATE\n end",
"def body\n @note.content\n end",
"def generate_error_email_body(email_type: :user)\n case email_type\n when :user\n error_contents = read_parse_logfile(user_error_filepath)\n message_body = \"<p>'#{study_file.upload_file_name}' has failed during parsing.</p>\"\n when :dev\n # only read first megabyte of error log to avoid email delivery failure\n error_contents = read_parse_logfile(dev_error_filepath, delete_on_read: false, range: 0..1.megabyte)\n message_body = \"<p>The file '#{study_file.upload_file_name}' uploaded by #{user.email} to #{study.accession} failed to ingest.</p>\"\n message_body += \"<p>A copy of this file can be found at #{generate_bucket_browser_tag}</p>\"\n message_body += \"<p>Detailed logs and PAPI events as follows:\"\n else\n error_contents = read_parse_logfile(user_error_filepath)\n message_body = \"<p>'#{study_file.upload_file_name}' has failed during parsing.</p>\"\n end\n\n if error_contents.present?\n message_body += \"<h3>Errors</h3>\"\n error_contents.each_line do |line|\n message_body += \"#{line}<br />\"\n end\n end\n\n if !error_contents.present? || email_type == :dev\n message_body += \"<h3>Event Messages</h3>\"\n message_body += \"<ul>\"\n event_messages.each do |e|\n message_body += \"<li><pre>#{ERB::Util.html_escape(e)}</pre></li>\"\n end\n message_body += \"</ul>\"\n end\n\n if study_file.file_type == 'Metadata'\n faq_link = \"https://singlecell.zendesk.com/hc/en-us/articles/360060610092-Metadata-Validation-Errors-FAQ\"\n message_body += \"<h3>Common Errors for Metadata Files</h3>\"\n message_body += \"<p>You can view a list of common metadata validation errors and solutions in our documentation: \"\n message_body += \"<a href='#{faq_link}'>#{faq_link}</a></p>\"\n end\n\n message_body += \"<h3>Job Details</h3>\"\n message_body += \"<p>Study Accession: <strong>#{study.accession}</strong></p>\"\n message_body += \"<p>Study File ID: <strong>#{study_file.id}</strong></p>\"\n message_body += \"<p>Ingest Run ID: <strong>#{pipeline_name}</strong></p>\"\n message_body += \"<p>Command Line: <strong>#{command_line}</strong></p>\"\n ingest_image_attributes = AdminConfiguration.get_ingest_docker_image_attributes\n message_body += \"<p>Ingest Pipeline Docker image version: <strong>#{ingest_image_attributes[:tag]}</strong></p>\"\n message_body\n end",
"def body\n content.gsub(/\\s*---\\s*/, \"\\n\\n\")\n end",
"def mailto_body\n URI.encode(mailto_body_template.render({\n 'amount' => amount,\n 'merchant_name' => @merchant_name}))\n end",
"def html\n Markdown.render(self.content)\n end",
"def html\n Markdown.render(self.content)\n end",
"def get_body_for_html_display(collapse_quoted_sections = true)\n # Find the body text and remove emails for privacy/anti-spam reasons\n text = get_main_body_text\n self.mask_special_emails!(text)\n self.remove_privacy_sensitive_things!(text)\n\n # Remove quoted sections, adding HTML. XXX The FOLDED_QUOTED_SECTION is\n # a nasty hack so we can escape other HTML before adding the unfold\n # links, without escaping them. Rather than using some proper parser\n # making a tree structure (I don't know of one that is to hand, that\n # works well in this kind of situation, such as with regexps).\n folded_quoted_text = self.remove_lotus_quoting(text, 'FOLDED_QUOTED_SECTION')\n folded_quoted_text = IncomingMessage.remove_quoted_sections(folded_quoted_text, 'FOLDED_QUOTED_SECTION')\n if collapse_quoted_sections\n text = folded_quoted_text\n end\n text = MySociety::Format.simplify_angle_bracketed_urls(text)\n text = CGI.escapeHTML(text)\n text = MySociety::Format.make_clickable(text, :contract => 1)\n text.gsub!(/\\[(email address|mobile number)\\]/, '[<a href=\"/help/about#mobiles\">\\1</a>]')\n if collapse_quoted_sections\n text = text.gsub(/(\\s*FOLDED_QUOTED_SECTION\\s*)+/m, \"FOLDED_QUOTED_SECTION\")\n text.strip!\n # if there is nothing but quoted stuff, then show the subject\n if text == \"FOLDED_QUOTED_SECTION\"\n text = \"[Subject only] \" + CGI.escapeHTML(self.mail.subject) + text\n end\n # and display link for quoted stuff\n text = text.gsub(/FOLDED_QUOTED_SECTION/, \"\\n\\n\" + '<span class=\"unfold_link\"><a href=\"?unfold=1#incoming-'+self.id.to_s+'\">show quoted sections</a></span>' + \"\\n\\n\")\n else\n if folded_quoted_text.include?('FOLDED_QUOTED_SECTION')\n text = text + \"\\n\\n\" + '<span class=\"unfold_link\"><a href=\"?#incoming-'+self.id.to_s+'\">hide quoted sections</a></span>'\n end\n end\n text.strip!\n\n text = text.gsub(/\\n/, '<br>')\n text = text.gsub(/(?:<br>\\s*){2,}/, '<br><br>') # remove excess linebreaks that unnecessarily space it out\n return text\n end",
"def get_email_html(file_path)\n # Create empty string \n data = ''\n # Open the file with read permission\n f = File.open(file_path, \"r\") \n # Iterate each line and add it to the data\n f.each_line do |line|\n data += line\n end\n # Return the data as a string\n return data\nend",
"def show_body\n I18n.with_locale @email_locale do\n @mail_body = mail_body(@preview, @part_type)\n render :show_body, layout: 'rails_email_preview/email'\n end\n end",
"def template\n return @email unless @email.nil?\n \n #if self[:email].blank?\n #@template = Liquid::Template.parse(email)\n #self[:email] = Marshal.dump(@template)\n # save\n #else\n @email = Marshal.load(self[:email])\n #end\n \n #@email\n end",
"def to_email_text\n semantics = to_semantic_values\n body = []\n [ \"title\", \"part_of\", \"author\", \"contributor\",\n \"date\", \"isbn\", \"issn\", \"doi\" ].each do |field|\n if !semantics[field.to_sym].blank?\n value = semantics[field.to_sym]\n label = \"blacklight.email.text.#{field}\"\n body << I18n.t(label, value: value.join(\" \"))\n end\n end\n\n return body.join(\"\\n\") unless body.empty?\n end",
"def get_main_body_text\n # Cached as loading raw_email can be quite huge, and need this for just\n # search results\n if self.cached_main_body_text.nil?\n text = self.get_main_body_text_internal\n self.cached_main_body_text = text\n self.save!\n end\n text = self.cached_main_body_text\n\n # Strip the uudecode parts from main text\n # - this also effectively does a .dup as well, so text mods don't alter original\n text = text.split(/^begin.+^`\\n^end\\n/sm).join(\" \")\n\n return text\n end",
"def html_content\n\t\t\treturn \"\" if content.blank? \n\t\t\tstr = content.gsub(/<(\\s*)(\\w+)(\\s*)>/){ |s| \"<\\#{$1}>\" }\n\t\t\tstr = str.gsub(/<\\/(\\s*)(\\w+)(\\s*)>/){ |s| \"<\\/>\" }\n\t\t\tstr = str.gsub(/\\r\\n/, \"<br/>\") \n\t\t\tstr = str.gsub(/(\\s)/, \" \")\n\t\t\tstr = str.gsub(/\\[bold\\]/, \"<b>\")\n\t\t\tstr = str.gsub(/\\[-bold\\]/, \"</b>\")\n\t\t\tstr = str.gsub(/\\[italic\\]/, \"<i>\")\n\t\t\tstr = str.gsub(/\\[-italic\\]/, \"</i>\")\n\t\t\tstr = str.gsub(/\\[color:(#.{6})\\]/){ |s| \"<span style=\\\"color:#{$1}\\\">\" }\n\t\t\tstr = str.gsub(/\\[-color\\]/, \"</span>\")\n\t\t\tstr = str.gsub(/\\[(\\w+)\\]/) do |s|\n\t\t\t\temotion = EMOTIONS.index($1)\n\t\t\t\temotion.nil? ? \"[#{$1}]\": \"<img src=\\\"/assets/emotions/#{emotion}.gif\\\" />\" \n\t\t\tend\n\t\t\treturn str\n\t\tend",
"def get_the_email_html(name_city)\n \"<p>Bonjour,<br><br> Je m'appelle Nicolas, je suis élève à une formation de code gratuite, ouverte à tous, sans restriction géographique, ni restriction de niveau. La formation s'appelle <strong>The Hacking Project</strong> (http://thehackingproject.org/).<br> Nous apprenons l'informatique via la méthode du peer-learning : nous faisons des projets concrets qui nous sont assignés tous les jours, sur lesquel nous planchons en petites équipes autonomes. Le projet du jour est d'envoyer des emails à nos élus locaux pour qu'ils nous aident à faire de The Hacking Project un nouveau format d'éducation gratuite.<br> Nous vous contactons pour vous parler du projet, et vous dire que vous pouvez ouvrir une cellule à #{name_city}, où vous pouvez former gratuitement 6 personnes (ou plus), qu'elles soient débutantes ou confirmées. Le modèle d'éducation de The Hacking Project n'a pas de limite en terme de nombre de moussaillons (c'est comme cela que l'on appelle les élèves) donc nous serions ravis de travailler avec #{name_city} !<br><br> Charles, co-fondateur de The Hacking Project pourra répondre à toutes vos questions : 06.95.46.60.80<br><br> Bien à vous<br><br> Nicolas</p>\"\nend",
"def html_body\n @html_body ||= reader_doc.content.strip\n end",
"def generateReleaseNote_HTML\r\n rSuccess = true\r\n\r\n logOp('Generating release note in HTML format') do\r\n lLastChangesLines = []\r\n getLastChangeLog.each do |iLine|\r\n lLastChangesLines << iLine.\r\n gsub(/\\n/,\"<br/>\\n\").\r\n gsub(/^=== (.*)$/, '<h3>\\1</h3>').\r\n gsub(/^\\* (.*)$/, '<li>\\1</li>').\r\n gsub(/Bug correction/, '<span class=\"Bug\">Bug correction</span>')\r\n end\r\n lStrWhatsNew = ''\r\n if (@ReleaseComment != nil)\r\n lStrWhatsNew = \"\r\n<h2>What's new in this release</h2>\r\n#{@ReleaseComment.gsub(/\\n/,\"<br/>\\n\")}\r\n \"\r\n end\r\n File.open(\"#{@DocDir}/ReleaseNote.html\", 'w') do |oFile|\r\n oFile << \"\r\n<html>\r\n <head>\r\n <link rel=\\\"shortcut icon\\\" href=\\\"#{@ReleaseInfo.project_info[:favicon_url]}%>\\\" />\r\n <style type=\\\"text/css\\\">\r\n body {\r\n background: #fdfdfd;\r\n font: 14px \\\"Helvetica Neue\\\", Helvetica, Tahoma, sans-serif;\r\n }\r\n img {\r\n border: none;\r\n }\r\n h1 {\r\n text-shadow: rgba(135,145,135,0.65) 2px 2px 3px;\r\n color: #6C8C22;\r\n }\r\n h2 {\r\n padding: 2px 8px;\r\n background: #ccc;\r\n color: #666;\r\n -moz-border-radius-topleft: 4px;\r\n -moz-border-radius-topright: 4px;\r\n -webkit-border-top-left-radius: 4px;\r\n -webkit-border-top-right-radius: 4px;\r\n border-bottom: 1px solid #aaa;\r\n }\r\n h3 {\r\n padding: 2px 32px;\r\n background: #ddd;\r\n color: #666;\r\n -moz-border-radius-topleft: 4px;\r\n -moz-border-radius-topright: 4px;\r\n -webkit-border-top-left-radius: 4px;\r\n -webkit-border-top-right-radius: 4px;\r\n border-bottom: 1px solid #aaa;\r\n }\r\n .Bug {\r\n color: red;\r\n font-weight: bold;\r\n }\r\n .Important {\r\n color: #633;\r\n font-weight: bold;\r\n }\r\n ul {\r\n line-height: 160%;\r\n }\r\n li {\r\n padding-left: 20px;\r\n }\r\n </style>\r\n </head>\r\n <body>\r\n <a href=\\\"#{@ReleaseInfo.project_info[:web_page_url]}\\\"><img src=\\\"#{@ReleaseInfo.project_info[:image_url]}\\\" align=\\\"right\\\" width=\\\"100px\\\"/></a>\r\n <h1>Release Note for #{@ReleaseInfo.project_info[:name]} - v. #{@ReleaseVersion}</h1>\r\n <h2>Development status: <span class=\\\"Important\\\">#{@ReleaseInfo.project_info[:dev_status]}</span></h2>\r\n#{lStrWhatsNew}\r\n <h2>Detailed changes with previous version</h2>\r\n#{lLastChangesLines.join}\r\n <h2>Useful links</h2>\r\n <ul>\r\n <li><a href=\\\"#{@ReleaseInfo.project_info[:web_page_url]}\\\">Project web site</a></li>\r\n <li><a href=\\\"https://sourceforge.net/projects/#{@ReleaseInfo.sf_info[:project_unix_name]}/files/#{@ReleaseVersion}/#{@GemName}/download\\\">Download</a></li>\r\n <li>Author: <a href=\\\"#{@ReleaseInfo.author_info[:web_page_url]}\\\">#{@ReleaseInfo.author_info[:name]}</a> (<a href=\\\"mailto://#{@ReleaseInfo.author_info[:email]}\\\">Contact</a>)</li>\r\n <li><a href=\\\"#{@ReleaseInfo.project_info[:web_page_url]}rdoc/#{@ReleaseVersion}\\\">Browse RDoc</a></li>\r\n <li><a href=\\\"#{@ReleaseInfo.project_info[:browse_source_url]}\\\">Browse source</a></li>\r\n <li><a href=\\\"#{@ReleaseInfo.project_info[:browse_source_url]}ChangeLog?view=markup\\\">View complete ChangeLog</a></li>\r\n <li><a href=\\\"#{@ReleaseInfo.project_info[:browse_source_url]}README?view=markup\\\">View README file</a></li>\r\n </ul>\r\n </body>\r\n</html>\r\n\"\r\n end\r\n end\r\n\r\n return rSuccess\r\n end",
"def body\n body = lyrics.gsub(/\\*(.*?)\\*/m, '<em>\\1</em>') # emph\n i = 1\n while body.match(SIDENOTE_REGEX) # colorize the sidenotes\n body.sub!(SIDENOTE_REGEX, \"<span class='sidenote'>[#{i}]</span>\")\n i += 1\n end\n body.gsub!(/\\n<span class='sidenote'>\\[\\d+\\]<\\/span>(\\r\\n|$)/m, \"\") # remove the notes on empty lines\n body.replace_newlines\n end",
"def wrap_body_in_template(latex_body, document_title_plain_text, document_title_latex)\n latex_body\n end",
"def body_for(template_name, attributes = {})\n template = EmailTemplate.body_for(template_name)\n template = default_template(template_name) if template.nil?\n Florrick.convert(template, add_default_attributes(attributes))\n end",
"def bio_html\n return nil unless bio.present?\n markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :no_links => true, :hard_wrap => true)\n markdown.render(bio).html_safe\n end",
"def body_as_html\n return '' if !body\n return body if content_type && content_type =~ %r{text/html}i\n\n body.text2html\n end",
"def general_email(addresses, subject_line, body_content, article_content=nil)\n \n if article_content != nil\n attachments.inline['attachment.txt'] = article_content\n end \n \n @content = body_content\n \n #TODO check that email is creatible, ie has valid addresses\n mail(:to => addresses, :subject => subject_line)\n \n end",
"def build_email_content\n txt = I18n.t(\"estimate_request.fltk.email_content\", :origin => self.origin_port.name, :destination => destination_port.name, :count => self.estimate_items.first.number_of_items, :description => self.estimate_items.first.description)\n txt\n end",
"def get_html_body(db, locale, version, name, ttl=settings.long_ttl)\n id = get_topic_or_image_id(locale, version, name)\n return get_from_db_or_cache(db, id, {:trx => CouchDBTransaction::GET, :field => 'body_content'}, ttl)\n end",
"def body\n doc = Nokogiri.parse(\"<html><body>#{description}</body></html>\")\n return doc.text\n end",
"def bio_to_html(filename = ENV[\"__SEANYEH_BIO_FILE\"])\n contents = IO.readlines(filename).join()\n paragraphs = contents.split(\"\\n\\n\").map{ |p|\n \"<p>#{p.gsub(\"\\n\", \" \")}</p>\\n\"\n }\n paragraphs.join()\n end",
"def get_body_for_quoting\n # Find the body text and remove emails for privacy/anti-spam reasons\n text = get_main_body_text\n self.mask_special_emails!(text)\n self.remove_privacy_sensitive_things!(text)\n\n # Remove existing quoted sections\n text = self.remove_lotus_quoting(text, '')\n text = IncomingMessage.remove_quoted_sections(text, \"\")\n end",
"def construct_body(template = @template)\n\t\t@body = ERB.new(template).result(binding)\n\t\tallowed_elements = ['a', 'h1', 'h2', 'h3', 'p', 'ul', 'li']\n\t\tallowed_attributes = {'a' => ['href']}\n\t\tallowed_link_protocols = {'a' => {'href' => ['http', 'https', 'mailto']}}\n\t\treturn Sanitize.clean(@body, :elements => allowed_elements, :attributes => allowed_attributes, :protocols => allowed_link_protocols)\n\tend",
"def clean_up_contents()\n # very minimal\n # elements = ['p', 'b', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'], attributes={})\n\n if self.contents?\n html = self.contents\n email_regex = /<p>Email:\\s+((\\w|\\-|\\_|\\.)+\\@((\\w|\\-|\\_)+\\.)+[a-zA-Z]{2,})/i\n\n html.gsub! /\\[endif\\]--/ , ''\n html.gsub! /[\\n|\\r]/ , ' '\n html.gsub! / / , ' '\n\n # this will convert UNICODE into ASCII. \n #It will also strip any possiblity of using a foreign language!\n #converter = Iconv.new('ASCII//IGNORE//TRANSLIT', 'UTF-8') \n #html = converter.iconv(html).unpack('U*').select{ |cp| cp < 127 }.pack('U*')\n # keep only the things we want.\n unless (Sanitize::Config::RELAXED[:attributes][\"table\"].include?(\"align\"))\n Sanitize::Config::RELAXED[:attributes][\"table\"] << \"align\"\n end\n\n config = Sanitize::Config::RELAXED\n if (html.encoding.name == 'ASCII-8BIT')\n config[:output_encoding] = 'ASCII'\n end\n html = Sanitize.clean( html, config)\n\n # butt up any tags\n html.gsub! />\\s+</ , '><'\n\n #remove email address lines\n html.gsub! email_regex , '<p>'\n\n # post sanitize cleanup of empty blocks\n # the order of removal is import - this is the way word stacks these elements\n html.gsub! /<i><\\/i>/ , ''\n html.gsub! /<b><\\/b>/ , ''\n html.gsub! /<\\/b><b>/ , ''\n html.gsub! /<p><\\/p>/ , ''\n html.gsub! /<p><b><\\/b><\\/p>/ , ''\n\n # misc - fix butted times\n html.gsub! /(\\d)am / , '\\1 am '\n html.gsub! /(\\d)pm / , '\\1 pm '\n # misc - remove multiple space that may cause doc specific regexs to fail (in dates for example)\n html.gsub! /\\s+/ , ' '\n\n # add new lines at the end of lines\n html.gsub! /<\\/(p|h\\d|dt|dd|dl)>/, '</\\1>' + \"\\n\"\n html.gsub! /<dl>/ , '<dl>' + \"\\n\"\n\n self.contents = html\n end\n end",
"def send_email_to_user(user, subject, body_template, template_locals)\n if user.get_preference(\"HTML_EMAIL\").value == 'true'\n email_body = haml(body_template, :locals => template_locals )\n type = 'text/html'\n else\n email_body = erb(body_template, :locals => template_locals)\n type = 'text/plain'\n end\n Pony.mail :to => user.email,\n :from => \"frank_test@davesag.com\",\n :subject => subject,\n :headers => { 'Content-Type' => type },\n :body => email_body\n end",
"def extract_body(file_path)\n text = File.open(file_path).read\n text.sub!(/---\\n.*?---\\n/m, '')\n Kramdown::Document.new(\n text,\n auto_ids: false,\n enable_coderay: true,\n coderay_line_numbers: nil\n ).to_html\n end",
"def deliver_rts email, documents, mail_to\n logger.info \"Sending response mail to #{mail_to}\"\n mail = Mail.new\n mail.from @cfg[:from]\n mail.to mail_to\n # CCs to the original email will get a copy of the converted files as well\n mail.cc (email.cc - email.to - (@cfg[:cc_blacklist]||[]) ) if email.cc # Prevent autoheathen infinite loop!\n # Don't prepend yet another Re:\n mail.subject \"#{'Re: ' unless email.subject.start_with? 'Re:'}#{email.subject}\"\n # Construct received path\n # TODO: is this in the right order?\n #rcv = \"by localhost(autoheathen); #{Time.now.strftime '%a, %d %b %Y %T %z'}\"\n #[email.received,rcv].flatten.each { |rec| mail.received rec.to_s }\n mail.return_path email.return_path if email.return_path\n mail.header['X-Received'] = email.header['X-Received'] if email.header['X-Received']\n documents.each do |doc|\n next if doc[:content].nil?\n mail.add_file filename: doc[:filename], content: doc[:content]\n end\n cfg = @cfg # stoopid Mail scoping\n me = self # stoopid Mail scoping\n mail.text_part do\n s = Haml::Engine.new( me.read_file cfg[:text_template] ).render(Object.new, to: mail_to, documents: documents, cfg: cfg)\n body s\n end\n mail.html_part do\n content_type 'text/html; charset=UTF-8'\n s = Haml::Engine.new( me.read_file cfg[:html_template] ).render(Object.new, to: mail_to, documents: documents, cfg: cfg)\n body s\n end\n mail.delivery_method :smtp, address: @cfg[:mail_host], port: @cfg[:mail_port]\n deliver mail\n end",
"def add_html_part!\n part = Mail::Part.new\n part.body = premailer.to_inline_css\n part.content_type = \"text/html; charset=#{@msg_charset}\"\n message.html_part = part\n end",
"def inline_html(text)\n # process simple inlines\n for inline in INLINES_HTML\n text.gsub!(/#{inline[0]}/m, inline[1]) if text.match(/#{inline[0]}/m)\n end\n # process link inlines\n if text.match(LINKS_REGEXP)\n text.gsub!(LINKS_REGEXP) do |string|\n match = string.match(LINKS_REGEXP)\n before = match[1]\n body = match[2]\n after = match[3]\n parts = body.split(' ')\n if parts.length > 1\n url = parts.first\n link = parts[1..-1].join(' ')\n else\n url = body\n link = body\n end\n \"#{before}<a href='#{url}'>#{link}</a>#{after}\"\n end\n end\n # process note inlines\n if text.match(NOTES_REGEXP)\n text.gsub!(NOTES_REGEXP) do |string|\n match = string.match(NOTES_REGEXP)\n before = match[1]\n body = match[2]\n after = match[3]\n @document.notes << body\n index = @document.notes.length\n \"#{before}<a href='#note#{index}' name='source#{index}'>\"+\n \"[#{index}]</a>#{after}\"\n end\n end\n # process escapes (that is \\x is replaced with x)\n text.gsub!(/\\\\(.)/, \"\\\\1\") if text.match(/\\\\(.)/)\n text\n end",
"def identifier_email(topic,identifiers,board_publication,receipients,attach_content,include_comments,message_content,message_subject=nil)\n # add attachments\n if (identifiers.length > 0 && attach_content)\n document_content = \"\"\n identifiers.each do |ec|\n unless ec.nil?\n document_content += Identifier.find(ec[:id]).content || \"\"\n end\n end\n attachments.inline['attachment.txt'] = document_content\n end\n if include_comments \n @comments = Comment.find_all_by_publication_id(identifiers[0].publication.origin.id) \n else\n @comments = [] \n end\n\n na_text = I18n.t(\"mailers.notapplicable\")\n @identifier_links = identifiers.length > 0 ? Hash[identifiers.map {|x| [x.title, preview_url(x)]}] : Hash[ na_text, dashboard_url ]\n\n # publication title and publication link should always give us the publication of origin\n @publication_links = identifiers.length > 0 ? Hash[identifiers.first.publication.origin.title, url_for(identifiers.first.publication.origin)] : Hash[ na_text, dashboard_url ]\n\n @board_publication_links = board_publication.nil? ? Hash[ na_text, dashboard_url ] : Hash[ board_publication.title , url_for(board_publication) ]\n\n if board_publication.nil?\n board_owner = na_text\n else\n board_owner = board_publication.owner.friendly_name\n end\n\n # we want to leave it to mailer view to be able to relace the IDENTIFIER_LINK and PUBLICATION_LINK placeholders with active links\n # to the identifiers and publications but first we need to do some weird string wrangling here to make sure that the user-entered \n # email message escapes any unsafe content \n # (see http://makandracards.com/makandra/2579-everything-you-know-about-html_safe-is-wrong for explaination)\n @message = \"\".html_safe \n @message << message_content.gsub(/!IDENTIFIER_TITLES/,identifiers.collect{|ei| ei.title}.join('; ')).gsub(/!PUBLICATION_TITLE/,identifiers[0].publication.origin.title).gsub(/!TOPIC/,topic) \n .gsub(/!PUBLICATION_CREATOR_NAME/,identifiers[0].publication.origin.creator.full_name).gsub(/!BOARD_OWNER/,board_owner)\n\n\n identifier_titles = identifiers.collect{|ei| ei.title}.join('; ')\n if message_subject.nil? || message_subject == ''\n message_subject = topic + ': ' + identifiers[0].publication.origin.title + \" \" + identifier_titles\n else\n message_subject = message_subject.gsub(/!TOPIC/,topic).gsub(/!PUBLICATION_TITLE/,identifiers[0].publication.origin.title).gsub(/!IDENTIFIER_TITLES/,identifier_titles)\n end\n # make sure we have a decent length for the subject\n message_subject = truncate(message_subject, length:75)\n mail(:to => receipients, :subject => message_subject)\n end",
"def contents()\n html = Nokogiri::HTML(@markdown_document.to_html())\n\n # Fixup refs to other markdown documents\n html.css(\"a\").each do |anchor|\n anchor[\"href\"] = anchor[\"href\"].sub(%r{\\.md$}, \".html\")\n end\n\n # Since we transform device-specific $device/README.md pages into\n # discrete $device.html, we need to fixup cross-linking into its namespace\n # This could be generalized some more, to be fixed once we have other internal links to mismatched README.md/index.html locations.\n if File.dirname(relative_output) == \"devices\"\n html.css(\"a\").each do |anchor|\n if anchor[\"href\"].match(%r{\\.\\./[^\\.]+$})\n anchor[\"href\"] = anchor[\"href\"].sub(%r{\\.\\./}, \"devices/\") + \".html\"\n end\n end\n end\n\n # Since Nokogiri produces a complete document from our fragment, we\n # have to pick only what's in the body; so strip the body added tags and higher-up tags.\n html\n .at_css(\"body\").to_s()\n .sub(%r{^<body>}, \"\").sub(%r{</body>$}, \"\")\n end",
"def build_text_mail(files, titles)\n data = \"\"\n files.each_with_index do |file, i|\n data += \"\\n\\n#{titles[i]}\\n\\n\"\n data += File.read(File.join(File.dirname(__FILE__), file))\n end\n # Add google file link with test coverage at the end of email\n data +=\"\\n\\n<a href='https://google.com'>Test Coverage</a>\\n\\n\"\n # attached screenshots\n pictures = Dir.glob(Rails.root.join('public', 'images', 'screenshots', '*.png'))\n #pictures = Dir.glob(Rails.root.join(\"/var/www/office/public/images/capybara/*.png\"))\n count = 0\n pictures.each do |p|\n count += 1\n data += \"<img src='#{ 'https://google.com' + p.split('/').last }'>\"\n break if count == 10\n end\n data\nend",
"def html_body\n self[:html_body]\n end",
"def build_message\n @subject = self.content[:short_subject]\n curate_text\n\n\n mail = Mail.new({\n :from => @replyto,\n :to => @recipients,\n :subject => @subject,\n :body => @text\n })\n\n if @no_send\n self.print\n return\n end\n\n\n return mail\n end",
"def to_html( *rules )\n rules = DEFAULT_RULES if rules.empty?\n # make our working copy\n text = self.dup\n \n @urlrefs = {}\n @shelf = []\n textile_rules = [:block_textile_table, :block_textile_lists,\n :block_textile_prefix, :inline_textile_image, :inline_textile_link,\n :inline_textile_code, :inline_textile_span, :glyphs_textile]\n markdown_rules = [:refs_markdown, :block_markdown_setext, :block_markdown_atx, :block_markdown_rule,\n :block_markdown_bq, :block_markdown_lists, \n :inline_markdown_reflink, :inline_markdown_link]\n @rules = rules.collect do |rule|\n case rule\n when :markdown\n markdown_rules\n when :textile\n textile_rules\n else\n rule\n end\n end.flatten\n\n # standard clean up\n incoming_entities text \n clean_white_space text \n\n # start processor\n @pre_list = []\n rip_offtags text\n no_textile text\n escape_html_tags text\n hard_break text \n unless @lite_mode\n refs text\n # need to do this before text is split by #blocks\n block_textile_quotes text\n blocks text\n end\n inline text\n smooth_offtags text\n\n retrieve text\n\n text.gsub!( /<\\/?notextile>/, '' )\n text.gsub!( /x%x%/, '&' )\n clean_html text if filter_html\n text.strip!\n text\n\n end",
"def body_clean\n text = \"\"\n\n # Iterate through each line\n body.split(/\\n/).each do |line|\n # Included replies \"> some text\"\n next if line.match(/^>+/) \n next if line.match(/On.*wrote:/)\n # Outlook reply style\n break if line.match(/-{4,}Original Message-{4,}/)\n # Signature break \"--\"\n break if line.match(/^\\s*\\-{2,}\\s*$/)\n # Lines with only whitespace - blank them\n line.gsub(/^\\s+$/, \"\")\n\n text += line + \"\\n\"\n end\n\n # Clean out multiple line breaks throughout (longer than one blank line)\n text.gsub!(/\\n{3,}/, \"\\n\\n\") \n # Clean up multiple line breaks at end (none)\n text.gsub!(/\\n{2,}$/, \"\\n\")\n\n return text\n end",
"def body\n if author\n \"**#{author}**: #{text}\"\n else\n text\n end\n end",
"def email(body)\n message = <<EOM\nFrom: #{FROM}\nTo: #{TO}\nDate: #{NOW.rfc822}\nMessage-Id: #{SecureRandom.uuid}@redhat.com\nSubject: Unassigned upcoming maintenances\n\nRegion Leads - please arrange coverage for these maintenances immediately:\n\n#{body}\n\n---\nThis message has been sent by the Unassigned Maintenance Broadcast System.\nThis utility runs in the #{NAMESPACE} namespace on #{CLUSTER}.\nThe source code for this utility can be found at #{REPO}.\nEOM\n\n Net::SMTP.start('smtp.corp.redhat.com', 25, FROM) do |smtp|\n smtp.send_message message, FROM, TO\n end\nend",
"def send_notification(mailFrom, mailTo, mailDomain, mailServer, noticeContent, debug)\n\n# Example Email Notification Template. Modify as needed. Sending HTML email by default because I like it.\n# Example Email Notification Template. Modify as needed. Sending HTML email by default because I like it.\nmessage = <<MESSAGE_END\nFrom: #{mailFrom} \nTo: #{mailTo}\nMIME-Version: 1.0\nContent-type: text/html\nSubject:#{noticeContent[:date]} - ISO IR Resolve - #{noticeContent[:vulnTitle]} (#{noticeContent[:ipAddress]})\n\n<h3>#{noticeContent[:date]} - ISO IR Resolve - #{noticeContent[:vulnTitle]} (#{noticeContent[:ipAddress]})</h3>\nLink to IDS or other system showing the vulnerability or compromise<br/>\nhttps://#{noticeContent[:console]}:#{noticeContent[:conPort]}/vulnerability/vuln-summary.jsp?vulnid=#{noticeContent[:vulnId]}&devid=#{noticeContent[:devId]}<br/>\n\n<p>\n<h3>Issue Summary:</h3>\nA recent scan of #{noticeContent[:ipAddress]} indicates a vulnerability on the system.<br/>\nThe following issue was detected: #{noticeContent[:vulnTitle]}\n<h3>Description of the issue:</h3>\n#{noticeContent[:description]}\n</p>\n\n<p>\n<h3>Event Type:</h3>\nVulnerable\n</p>\n<p>\n<h3>Host(s) Affected:</h3>\n#{noticeContent[:ipAddress]}:#{noticeContent[:port]} / #{noticeContent[:proto]}<br/>\nHostname: #{noticeContent[:hostName]}<br/>\n Detected Aliases: #{noticeContent[:otherNames]}<br/>\nMachine Address: #{noticeContent[:macAddress]}<br/>\n\n</p>\n<p>\nTime of Detection: #{noticeContent[:date]} <br/>\nLevel of Confidence: #{noticeContent[:confirmation]}<br/>\n</p>\n<h3>Evidence/Testing Results</h3>\n#{noticeContent[:proof]}\n#{noticeContent[:solText]}\n\n<br/>\n<i>#{noticeContent[:nexposeId]}</i>\n\n\nMESSAGE_END\n\n begin\n Net::SMTP.start(mailServer) do |smtp|\n smtp.send_message message, mailFrom, mailTo\n end\n\n rescue => err\n $stderr.puts(\"Fail: #{err}\")\n exit(1)\n end\nend",
"def generate_mail\n\t\t$stderr.puts \"Generating an announcement email.\"\n\t\tabort \"no email config in your ~/.hoerc\" unless defined?( @email_config )\n\n\t changes = self.changes\n\t subject = \"#{self.name} #{self.version} Released\"\n\t title = \"#{self.name} version #{self.version} has been released!\"\n\t body = \"#{self.description}\\n\\nChanges:\\n\\n#{self.changes}\"\n\t urls = self.urls.map do |url|\n\t\t\tcase url\n\t\t\twhen Array\n\t\t\t\t\"* <#{url[1].strip}> (#{url[0]})\"\n\t\t\twhen String\n\t\t\t\t\"* <#{url.strip}>\"\n\t\t\telse\n\t\t\t\t\"* %p\" % [ url ]\n\t\t\tend\n\t\tend\n\n\t\t$stderr.puts \" returning a new Mail::Message.\"\n\t\tmail = Mail.new\n\t\tmail.from = @email_config['from'] || \"%s <%s>\" % self.developer.first\n\t\tmail.to = @email_to.join(\", \")\n\t\tmail.subject = \"[ANN] #{subject}\"\n\t\tmail.body = [ title, urls.join($/), body ].join( $/ * 2 )\n\n\t\treturn mail\n\tend",
"def pretty_body\n Archiving.markdown.render(body).html_safe\n end",
"def html_markup_markdown(text); end",
"def template(reporttype, reportname, authorlist, emaillist, group, address,\n revdate, revnumber, docdate, description, legal, encoding, toc)\n \n sampledoc = <<-TEMPLATE\n:reporttype: #{reporttype || 'The type of report'}\n:reporttitle: #{reportname || 'The name of the report'}\n:author: #{authorlist || 'Author McList, Authorette OName'}\n:email: #{emaillist || 'someone@somehost.com, someoneelse@anotherhost.net'}\n:group: #{group || 'Marketing? Research? Edit me...'}\n:address: #{address || 'Company Address....'}\n:revdate: #{revdate || 'January 1, 2012'}\n:revnumber: #{revnumber || '0.0.1'}\n:docdate: #{docdate || 'January 1, 2012'}\n:description: #{description || 'Barebones Sample Document'}\n:legal: #{legal || '(C) Copyrighted by who?'}\n:encoding: #{encoding || 'iso-8859-1'}\n:toc: #{toc || 'true'}\n\n<<<\n== Introduction ==\nHi This is an introduction!\nTEMPLATE\n return sampledoc\n end",
"def substitute_markdown_inside_raw_html\n each_element(:raw_html) do |e|\n html = e.parsed_html\n next unless html\n\n html.process_markdown_inside_elements(self)\n end\n end",
"def prepare_content_for_email(content)\n doc = Nokogiri::HTML.fragment(content)\n doc.css('img').each do |image|\n id = parse_attachment_reference_uuid_from_url(image['src'])\n attachment = AttachmentReference.find_by_id(id)&.attachment if id\n image['src'] = attachment.url if attachment&.url\n end\n doc.to_html\n end",
"def message_body(subscription_count, presenters, batch_subscriptions, batch_emails)\n return @message_body if @message_body\n return nil unless subscription_count > BATCH_SIZE\n\n message = SubscriptionMailer.public_inspection_document_mailing_list(\n presenters,\n batch_subscriptions,\n nil,\n batch_emails\n )\n @message_body = {html: message.html_part.body, text: message.text_part.body}\n end",
"def plain_body\n mail&.plain_body\n end",
"def body\n @body ||= Page.convert_raw_to_html(raw_body)\n end",
"def description_html\n @description_html ||= RDiscount.new(original.body).to_html\n end",
"def parse_markdown\n self.body_html = markdown.render(body_markdown.to_s)\n self.summary_html = markdown.render(summary_markdown.to_s)\n end",
"def note_to_html(issue_id, note)\n html = \"\"\n if !note.notes.blank? then\n user = User.find(note.user_id)\n html += \"<table class=\\\"my-journal-table\\\">\"\n html += \"<tr>\"\n html += \"<th>\"\n html += \"<a href=\\\"./issues/\" + issue_id.to_s + \"#change-\" + note.id.to_s + \"\\\">\"\n html += note.created_on.strftime(\"%Y-%m-%d %H:%M:%S\")\n html += \"</a>\"\n html += \" \"\n html += user.name\n html += \"</th>\"\n html += \"</tr>\"\n html += \"<tr>\"\n html += \"<td>\"\n html += CGI.escapeHTML(trim_notes(note.notes))\n html += \"</td>\"\n html += \"</tr>\"\n html += \"</table>\"\n end\n return html\n end",
"def render_email(email_to_render, user)\n bin = binding()\n Email.email_variables(user).each { |key, value| Kernel.eval(\"#{key} = '#{value.gsub(\"'\", \"‘\")}'\", bin) }\n ERB.new(email_to_render.body).result(bin).to_s\n end",
"def markdown_body\n self[:markdown_body]\n end",
"def no_idea_added(user)\n begin\n m = Mandrill::API.new\n template = m.templates.render 'GetViable 2 weeks no idea added', [{:name => \"first_name\", :content => user.name}]\n mail_job = mail(:to => user.email, :subject => \"Remember to add your idea and get started\") do |format|\n format.html { template['html'] }\n #format.text { render \"test\" }\n end\n mail_job.deliver\n rescue Exception => e\n \n end\n end",
"def html\n if FUNCTION != 'none'\n if self.md.value != nil\n hm = self.md.value\n else\n hm = INDEX\n end\n @me = YAML.load(self.yaml.value)\n [\n ERB.new(HEAD).result(binding),\n Kramdown::Document.new(ERB.new(hm).result(binding)).to_html,\n \"</body></html>\"\n ].flatten.join('')\n end\n end"
] |
[
"0.7019986",
"0.6804039",
"0.6741336",
"0.6708741",
"0.6657069",
"0.66140777",
"0.6596342",
"0.65372205",
"0.6511521",
"0.6376375",
"0.6371209",
"0.6284104",
"0.6240819",
"0.6227364",
"0.6212095",
"0.61974335",
"0.6196765",
"0.61920637",
"0.6187838",
"0.6176927",
"0.6169199",
"0.616735",
"0.616118",
"0.61581993",
"0.61557674",
"0.60782576",
"0.6077344",
"0.60668933",
"0.60648507",
"0.6042075",
"0.60370344",
"0.6025712",
"0.6020714",
"0.59711343",
"0.5955053",
"0.59534657",
"0.59383225",
"0.5931041",
"0.59205943",
"0.5916538",
"0.59101206",
"0.5905449",
"0.5905143",
"0.58989006",
"0.58930355",
"0.58930355",
"0.5878277",
"0.586576",
"0.5856401",
"0.58374804",
"0.58353114",
"0.5828345",
"0.5822067",
"0.58103275",
"0.5809496",
"0.58014524",
"0.5800299",
"0.5776695",
"0.57762057",
"0.5773873",
"0.5750734",
"0.5745205",
"0.5744803",
"0.5744574",
"0.5740143",
"0.5735553",
"0.5734388",
"0.5731848",
"0.57317764",
"0.5731691",
"0.5718096",
"0.5716408",
"0.5710424",
"0.5703404",
"0.56942666",
"0.5652866",
"0.56502616",
"0.56480074",
"0.56337756",
"0.56232697",
"0.56181335",
"0.5608366",
"0.56080353",
"0.5606883",
"0.5605753",
"0.5589842",
"0.55884194",
"0.5576433",
"0.55741054",
"0.5567122",
"0.5566874",
"0.5563178",
"0.55439854",
"0.5543412",
"0.55417323",
"0.5541542",
"0.5540849",
"0.55253506",
"0.5520621",
"0.55162495"
] |
0.686195
|
1
|
tagging (only shows up when tags available)
|
def tagging_tag(tagging)
if tagging.tag_list.present?
content_tag :div, class: "row" do
content_tag :div, class: "article-tagging my-xs-20" do
(content_tag :span, "標籤:") +
(tagging.tag_list.map {|t| link_to t, tag_path(t), class: "btn btn-default ml-xs-10"}.inject(&:+))
# look up "join" method
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def tags; end",
"def tags; end",
"def tags; end",
"def tags; end",
"def tags; end",
"def _tagging\n t_tagging[:tag_id].in(self.tags) unless self.tags.length == 0\n end",
"def tagged?; end",
"def tagging_tags\n filtered_tags(:tagtype_x => [11, :Collection, :List])\n end",
"def complete_tags\n\n end",
"def tags() ; info[:tags] ; end",
"def tags() ; info[:tags] ; end",
"def tags() []; end",
"def research_acts_as_taggable\n research_acts_as_taggable_on :tags\n end",
"def tagged\n taggings.collect(&:taggable)\n end",
"def tags!\n @tags = nil\n tags\n end",
"def available_tags\n available_tags = []\n Tag.all.each do |t|\n available_tags << t.name\n end\n\n tags = []\n self.tags.each do |t|\n tags << t.name\n end\n\n available_tags - tags\n end",
"def find_tags\n @find_tags = true\n end",
"def show_tags\n tag_list = \"\"\n self.tags.each do |t|\n tag_list << \"#{t.name} \"\n end\n tag_list\n end",
"def tag\n @tag = params[:id]\n @personas = Persona.find_tagged_with(@tag,:order=>\"apepat,apemat,nombre\")\n @familias = Familia.find_tagged_with(@tag) \n @instituciones = Institucion.find_tagged_with(@tag,:order=>\"nombre\")\n @comentarios = Comentario.find_tagged_with(@tag,:order=>\"created_at desc\")\n end",
"def tagged\n @articles = Article.tagged_by(params[:tag], params[:page])\n @tag = params[:tag]\n end",
"def _get_tags(tag)\n tags = if tag.attr['tags'] && !tag.attr['tags'].blank?\n Tag.from_list(tag.attr['tags'], false) # false parameter -> not to create missing tags\n elsif tag.locals.page.respond_to?(:requested_tags)\n tag.locals.page.requested_tags\n elsif tag.locals.page\n tag.locals.page.attached_tags.visible\n else\n []\n end\n tag.locals.tags = tags.uniq.compact\n end",
"def tag; end",
"def tag; end",
"def tagged?(tag)\n @tags.include?(tag)\n end",
"def tags\n send_tags('tags', @handle, @security)\n end",
"def retrieve_tags\n # noop\n end",
"def show\n @tag_name = params[:id]\n @tag = Tag.find_by_name(@tag_name)\n if @tag\n # this is a hack and should be replaced with custom SQL queries\n @taggings = @tag.taggings.by_type('Post')\n @news_taggings = @taggings.select {|tagging| tagging.taggable.news? }\n @gossip_taggings = @taggings.select {|tagging| tagging.taggable.gossip? }\n @question_taggings = @taggings.select {|tagging| tagging.taggable.question? }\n end\n end",
"def tag\n end",
"def tag\n end",
"def is_tagged?\n ! @tags.empty?\n end",
"def create_tags\n\tend",
"def handle_adding_tag(tag, tags)\n if tags.include?(tag)\n puts \"Warning: duplicate tag #{tag} detected\"\n else\n tags.push(tag)\n end\n return tags\n end",
"def handle_adding_tag(tag, tags)\n if tags.include?(tag)\n puts \"Warning: duplicate tag #{tag} detected\"\n else\n tags.push(tag)\n end\n return tags\n end",
"def tags\n ['any'] + @tags\n end",
"def tags\n ['any'] + @tags\n end",
"def tag(tag); end",
"def tag(tag); end",
"def tags\n @tags ||= []\n end",
"def is_tagged?\n ! @tags.empty?\n end",
"def access_tags\n tags = []\n tags << 'admin' if admin?\n tags << 'speaker' if speaker?\n tags << 'staff' if staff?\n tags\n end",
"def tags\n taxonomies.all :conditions => { :classification => :tag }\n end",
"def see_tag(text); end",
"def tag_hot_spots\n @hot_spots = HotSpot.paginate :select => 'hot_spots.*',\n :include => :hot_spot_tags,\n :conditions => ['hot_spot_tags.tag = ? and hot_spots.city_id = ? and hot_spots.id <> ?', params[:tag], @hot_spot.city_id, @hot_spot.id],\n :per_page => 20,\n :order=>\"hot_spots.name_#{@current_lang}\",\n :page=>params[:page]\n unless @hot_spots.empty?\n @tag = params[:tag] if params[:tag]\n end\n end",
"def tags\n @tags ||= []\n end",
"def tags\n self.new_record? ? '' : Tag.get_friendly_tags(self)\n end",
"def research_acts_as_ordered_taggable\n research_acts_as_ordered_taggable_on :tags\n end",
"def set_tagged_bool\n self.tag.split(\" \").empty? ? self.tagged = false : self.tagged = true\n end",
"def tags\n @tags ||= tags_from_collection.merge(tags_from_item).values.select(&:release)\n end",
"def tags\n if new?\n @fake_tags || []\n else\n @tags ||= tags_dataset.all\n end\n end",
"def add_tags\n self.tag_list = 'bug, feature, improvement, feedback, discussion, help'\n end",
"def split_tags\n set_tagged_bool\n self.tagged ? self.tag.split(\" \") : []\n end",
"def has_tag?(tag)\n self.tags.include?(tag)\n end",
"def add_tags\n raise NotImplementedError\n end",
"def show\n @tag = Tag.find(params[:id])\n @projects = Project.tagged_with(@tag[:name], :on => 'proj_types') + Project.tagged_with(@tag[:name], :on => 'keywords')\n @users = User.tagged_with(@tag[:name], :on => 'proj_types') + User.tagged_with(@tag[:name], :on => 'keywords')\n end",
"def my_tag_list\n self.taggings.order('id ASC').map(&:tag).map(&:name)\n end",
"def apply_tag_filter\n return if params[:tag].blank?\n params[:tag].tap do |tag|\n @posts = @posts.tagged_with tag\n add_breadcrumb \"by tag \\\"#{tag}\\\"\"\n end\n end",
"def tag_cloud\n @tags = Post.tag_counts_on(:skill_tags)\n end",
"def visive_tags\n Tagging.visive_tags(self.tags)\n end",
"def tag_cloud\n @tags = Snippet.tag_counts_on(:tags)\n end",
"def tag\n require_admin_permissions\n @model = 'tag'\n @key = 'tag'\n @values = Tag.all.pluck(:tag)\n render 'tags'\n end",
"def collect_tags_indeed(text_to_scan, offer_object)\n puts \"Mining tags from posting\"\n tags = Tag.all.map(&:name)\n tags.each do |tag|\n offer_object[:tags] << tag if text_to_scan.include?(tag)\n end\n end",
"def popular_tags options={}\n tags(options)\n end",
"def popular_tags options={}\n tags(options)\n end",
"def tag(name); end",
"def taggables(label, list, title = nil, placeholder = nil)\n\t\trender :partial => \"shared/forms/panel/tag\", :locals => { :label => label, :title => title, :tagline => list.join(\";\"), :placeholder => placeholder }\n\tend",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def has_tag?(t)\n tags.include?(t)\n end",
"def set_tags\n @tags = Tag.all\n @time = Tag.all.to_a.slice(0..4)\n @place = Tag.all.to_a.slice(5..8)\n @feeling = Tag.all.to_a.slice(9..13)\n @tag = Tag.find_by(id: params[:id])\n end",
"def find_tags\n @tags = BlogPost.tag_counts_on(:tags)\n end",
"def tags\n @tags ||= tag_class.in_challenge(collection).group(:id)\n end",
"def allowed_tags; end",
"def allowed_tags; end",
"def tag\n @tags = Tag.tags_for_slugs(params[:slugs])\n @related_tags = Tag.related_for @tags\n @products = Product.normal_ordering.paginate_for_tags(@tags, params[:page])\n end",
"def has_tag?(tag)\n tags.include?(tag.to_s)\n end",
"def tags_on(context)\n scope = base_tags.where([\n \"#{ActsAsTaggableOn::Tagging.table_name}.context = ? AND #{ActsAsTaggableOn::Tagging.table_name}.tagger_id IS NULL\", context.to_s\n ])\n # when preserving tag order, return tags in created order\n # if we added the order to the association this would always apply\n scope = scope.order(\"#{ActsAsTaggableOn::Tagging.table_name}.id\") if self.class.preserve_tag_order?\n scope\n end",
"def related_taggings\n ActsAsTaggableOn::Tagging.where(:tag_id => tag_ids).\n where(\"taggable_id != ?\", id)\n end",
"def taggable?\n description['taggable'] == true\n end",
"def tagged(options={})\n options[:tagged] ||= []\n options[:tagged] = (options[:tagged] << options[:tags]).join(\", \")\n records(path + \"tagged\", options)\n end",
"def tag_cloud\r\n \t@tags = Post.tag_counts_on(:tags)\r\n end",
"def current_tags\n @tags||linked_tags\n end",
"def tasks_by_tags\n Task.tagged_with(selected_tags, {\n :company_id => @company.id,\n :project_ids => @project_ids, \n :filter_hidden => session[:filter_hidden], \n :filter_user => session[:filter_user], \n :filter_milestone => session[:filter_milestone], \n :filter_status => session[:filter_status], \n :filter_customer => session[:filter_customer] \n })\n end",
"def tags\n @values.fetch('tags') { \n @values['tags'] = {}\n }\n end",
"def show\n @tagname = params[:id].to_s\n @tags = Tag.name_is(@tagname).descend_by_updated_at.reject {|r| !r.tagable.read_allowed?(current_user) }.paginate(\n :page => params[:page], :per_page => POSTINGS_PER_PAGE)\n @tagables = @tags.map { |t| \n t.tagable\n }.sort { |b,a| a.updated_at <=> b.updated_at }\n end",
"def tag(*tags)\n attribute 'tags' do |existing_tags|\n existing_tags ||= []\n tags.each do |tag|\n if !existing_tags.include?(tag.to_s)\n existing_tags << tag.to_s\n end\n end\n existing_tags\n end\n end",
"def tag(taggable)\n Tagging.create :tag_id => id, :taggable => taggable\n taggings.reset\n end",
"def not_found\n super('Tags not found.')\n end",
"def tags\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n #@tags = Video.tag_counts(:limit => 50, :order => \"count desc\")\n #@tags = Video.tag_counts_on(:tag, :limit => 50, :order => \"count desc\")\n @out = @tags.map{|b| {:id => b.id, :name => b.name }}\n \n\n \n respond_to do |format|\n format.json { render :json => @out }\n end\n\n end",
"def tag_on(model, text)\n return if (text.length == 0)\n words = text.split(' ')\n taggings = []\n\n words.each do |word|\n tag = Tag.find_or_create_by(name: word)\n\n if Tagging.where(tagger: self, taggable: model, tag: tag).first \n return\n end\n\n tagging = self.taggings.create(tag: tag, taggable: model)\n if tagging\n tag.inc(:taggings_count, 1)\n else\n return\n end\n\n # taggings << tagging\n\n model_tag = model.model_tags.find_or_create_by(name: word)\n model_tag.user_ids << self.id unless model_tag.user_ids.include?(self.id)\n model_tag.inc(:taggings_count, 1)\n model_tag.save \n model.reload\n end\n\n # taggings\n\n # return if (text.length == 0)\n\n # tag = Tag.find_or_create_by(name: text)\n\n # if Tagging.where(tagger: self, taggable: model, tag: tag).first \n # return\n # end\n\n # if tagging = self.taggings.create(tag: tag, taggable: model)\n # tag.inc(:taggings_count, 1)\n # end\n\n # model_tag = model.model_tags.find_or_create_by(name: text)\n # model_tag.user_ids << self.id unless model_tag.user_ids.include?(self.id)\n # model_tag.inc(:taggings_count, 1)\n # model_tag.save \n # model.reload\n # tagging\n end",
"def tags\n @tags_with_count = Asset.tag_counts_on(:tags)\n \n @tags = @tags_with_count.map{|tag_hash| tag_hash = tag_hash.name }\n \n respond_to do |format|\n format.html\n format.json { render :json => @tags }\n end\n end",
"def tags=(_arg0); end",
"def tag\n tag_list = params[:id].split('+')\n @assignments = Assignment.find_tagged_with(tag_list, :conditions => { :published => true }, :match_all => true)\n @tag = tag_list.join(' + ')\n end",
"def tag_list\n #tags sie bierze z asocjacji\n tags.map { |t| t.name }.join(\",\")\n end",
"def filtering_by_tags?\n selected_tags\n end",
"def filtering_by_tags?\n selected_tags\n end",
"def tags(package)\n importer = package.importer\n all_tags = importer.run_git_bare(package, \"tag\")\n all_tags.find_all do |tag_name|\n end\n end",
"def tags\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n #@tags = Node.tag_counts(:limit => 50, :order => \"count desc\")\n #@tags = Node.tag_counts_on(:tag, :limit => 50, :order => \"count desc\")\n @out = @tags.map{|b| {:id => b.id, :name => b.name }}\n \n\n \n respond_to do |format|\n format.json { render :json => @out }\n end\n\n end"
] |
[
"0.77934104",
"0.77934104",
"0.77934104",
"0.77934104",
"0.77934104",
"0.770114",
"0.75382245",
"0.74043655",
"0.73565453",
"0.72566646",
"0.72566646",
"0.72316647",
"0.7219375",
"0.71820253",
"0.7165607",
"0.7120683",
"0.7071158",
"0.70288146",
"0.7021813",
"0.6999372",
"0.69637394",
"0.6961821",
"0.6961821",
"0.69604707",
"0.6900209",
"0.6897772",
"0.6893319",
"0.6887363",
"0.6887363",
"0.68848187",
"0.6879866",
"0.68525594",
"0.68525594",
"0.68357086",
"0.68357086",
"0.682815",
"0.682815",
"0.68073475",
"0.6798601",
"0.6771778",
"0.6769272",
"0.676167",
"0.67487645",
"0.6730952",
"0.67057705",
"0.6700718",
"0.6696266",
"0.66876245",
"0.6684422",
"0.6668724",
"0.6655972",
"0.6651606",
"0.66475534",
"0.6633821",
"0.6630104",
"0.66284597",
"0.66278696",
"0.6608401",
"0.6601044",
"0.65913594",
"0.65781665",
"0.65700144",
"0.65700144",
"0.6557254",
"0.6556164",
"0.65518576",
"0.65518576",
"0.65518576",
"0.65518576",
"0.65518576",
"0.6551774",
"0.6547786",
"0.6542627",
"0.65388924",
"0.65163404",
"0.65163404",
"0.65147984",
"0.65054166",
"0.6502832",
"0.6498334",
"0.64893246",
"0.64859307",
"0.648522",
"0.6479217",
"0.6477914",
"0.6474867",
"0.6472835",
"0.6467598",
"0.6463074",
"0.6462709",
"0.64621496",
"0.645802",
"0.6452025",
"0.64453995",
"0.6443698",
"0.64359754",
"0.6433298",
"0.6433298",
"0.6432169",
"0.642799"
] |
0.66332537
|
54
|
GET /syndromes GET /syndromes.json
|
def index
@syndromes = Syndrome.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @division_syns = DivisionSyn.all\n\n render json: @division_syns\n end",
"def create\n @syndrome = Syndrome.new(syndrome_params)\n\n respond_to do |format|\n if @syndrome.save\n format.html { redirect_to @syndrome, notice: 'Syndrome was successfully created.' }\n format.json { render :show, status: :created, location: @syndrome }\n else\n format.html { render :new }\n format.json { render json: @syndrome.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_syndrome\n @syndrome = Syndrome.find(params[:id])\n end",
"def index\n @syndics = Syndic.all\n end",
"def update\n respond_to do |format|\n if @syndrome.update(syndrome_params)\n format.html { redirect_to @syndrome, notice: 'Syndrome was successfully updated.' }\n format.json { render :show, status: :ok, location: @syndrome }\n else\n format.html { render :edit }\n format.json { render json: @syndrome.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api\n url = \"https://wagon-dictionary.herokuapp.com/#{@answer}\"\n response = URI.open(url).read\n json = JSON.parse(response)\n return json['found']\n end",
"def search\n terms = @authority.search(url_search)\n render json: terms\n end",
"def index\n @normas = Norma.all\n render json: @normas\n end",
"def index\n @symptoms = Symptom.all\n\n render json: @symptoms\n end",
"def show\n @meanings = Meaning.where(word_id: @word.id)\n @synonymous = Synonymou.all\n end",
"def show\n @sleuths = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @sleuth.ext_gene + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @sleuth.ext_gene,\n :headers =>{'Content-Type' => 'application/json'} )\n end",
"def destroy\n @syndrome.destroy\n respond_to do |format|\n format.html { redirect_to syndromes_url, notice: 'Syndrome was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @query = params[:query] || {\n search: '',\n }\n @theorems = Theorem.all.where(root: true).limit(50)\n @theorems = @theorems.order('views desc')\n @theorems = @theorems.where('text ILIKE ?', \"%#{@query[:search]}%\") if @query[:search] && @query[:search].length > 0\n respond_to do |f|\n f.html { render 'index' }\n f.json { render json: @theorems }\n end\n end",
"def rhyming\n if !params[:word].empty?\n rhymes = Rhymes.new\n \n begin \n rhyming_words = rhymes.rhyme(params[:word])\n rescue StandardError => e \n json_response({ err: e }, :not_found)\n else\n json_response({rhyming_words: rhyming_words}, :ok)\n end\n else\n json_response({ message: 'Sorry, we couldn\\'t process your submission' }, :unprocessable_entity)\n end\n end",
"def synonyms\n @synonyms ||= {\n /^awesome$/i => %w[great excellent cool awesome splendid],\n /^okay$/i => %w[okay great alright],\n /^hello$/i => %w[hello hi greetings],\n /^yes$/i => %w[yes affirmative definitely correct certainly],\n /^no$/i => %w[no negative incorrect false],\n /^update$/i => %w[update change modify revise alter edit adjust],\n /^updated$/i => %w[updated changed modified revised altered edited adjusted],\n /^add$/i => %w[add create],\n /^added$/i => %w[added created],\n /^what|how$/i => %w[how what]\n }\n end",
"def syndrome_params\n params.require(:syndrome).permit(:name, :description, :position)\n end",
"def index\n @synonymproteins = Synonymprotein.all\n end",
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html\n format.json do\n render json: @tutorials\n end\n end\nend",
"def synonyms; end",
"def index\n @talk_suggestions = TalkSuggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_suggestions }\n end\n end",
"def show\n @serach_word = SerachWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serach_word }\n end\n end",
"def index\n @searches = @website.searches.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @searches }\n end\n end",
"def english_word(attempt)\n url = \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n # Jason \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n raw_response = open(url).read\n JSON.parse(raw_response, symbolize_names: true)\n end",
"def get_words\n response = HTTParty.get('http://linkedin-reach.hagbpyjegb.us-west-2.elasticbeanstalk.com/words')\n converted_response = response.parsed_response\nend",
"def similar\n @property = Property.find(params[:id])\n @response = HTTParty.get(\"http://api.nestoria.co.uk/api?place_name=#{@property.postCode}&action=search_listings&pretty=1&encoding=json&listing_type=rent&country=uk\")\n @data = @response['response']['listings']\n respond_to do |format|\n format.js\n end\n end",
"def show\n @synonyme = @stoff.stoff_synonyms.pluck(:synonym)\n @transporte = Transport.where(\"stoff_id = ?\", @stoff).order(datum: :desc).paginate(page: params[:page], per_page: 20)\n end",
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tutorials }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @neuropsychologist }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @thought = Thought.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thought }\n end\n end",
"def index\n @words = Word.order(:word).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end",
"def index\n @verbs = Verb.all\n\n render json: @verbs\n end",
"def index\n @suggestions = Suggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @suggestions }\n end\n end",
"def suggest\n @result = Artist.search( params[:term] )\n \n respond_to do |format|\n format.html\n format.json { render :json => @result }\n end\n end",
"def show\n render json: @spellbook\n end",
"def index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end",
"def index\n @mirrors = Mirror.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mirrors }\n end\n end",
"def index\n @microroles = Microrole.includes(:verb_coding_frame_microroles).readonly(false).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microroles }\n end\n end",
"def random_roberto_speech\n skip_authorization\n respond_to do |format|\n format.json do\n render json: { roberto_speech: \"#{RobertoBarros.in_ingrish} #{direction_for_active_cell(@play)}\" }\n end\n end\n end",
"def client_search\n @conventions = Convention.where(\"lower(name) LIKE lower(?)\" , \"%\" + params[:query] + \"%\")\n\n if @conventions.empty?\n render json: {}\n else\n results = {}\n results[:conventions] = @conventions.as_json\n render json: results\n end\n end",
"def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"def twubbles\n @sad_tweets = WordTweet.recent_sad_tweets\n respond_to do |f|\n f.json { render :json => twubbles_json(@sad_tweets) }\n f.html\n end\n end",
"def index\n @words = Word.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end",
"def getRandomWord\n @word = Wordnik.words.get_random_word(\n includePartOfSpeech: \"noun\",\n minLength: 5,\n maxLength: 10\n )\n if request.xhr?\n render :json => @word\n end\n end",
"def wordValidator\n print params[:currentWord]\n\n # the api key didn't work need to register to rapidAPI link,is asking for credit card\n #HTTP.get(\"https://github.com\").to_s\n\n=begin\n uri = URI('https://webspellchecker-webspellcheckernet.p.rapidapi.com/ssrv.cgi')\n req = Net::HTTP::Get.new(uri)\n\n req['x-rapidapi-host'] = \"webspellchecker-webspellcheckernet.p.rapidapi.com\"\n req['x-rapidapi-key'] = \"46bca383efmsh1fdbe7cce97066ap1b3476jsn2dc7e69af91b\"\n req['Accept'] = 'application/json'\n req['Content-Type'] = 'application/json'\n\n res = Net::HTTP.start(uri.hostname, uri.port) {|http|\n http.request(req)\n }\n=end\n\n\n\n\n wordfound = 'false'\n score = 0\n if word\n wordfound = 'true'\n b = BoggleUtils.new\n score = b.wordScore(params[:currentWord])\n end\n\n render json: { value: wordfound, word: params[:currentWord], score: score}\n end",
"def retrieve_synonyms(country = nil, age_from = nil, age_to = nil, \n gender = nil, education = nil, is_formal = nil)\n return [], {} if !self.approved\n\n keyword_id = self.id\n\n filtered_data = Gamer\n filtered_data = filtered_data\n .filter_by_country(country) unless country.blank?\n filtered_data = filtered_data\n .filter_by_dob(age_from,age_to) unless age_from.blank? || age_to.blank?\n filtered_data = filtered_data\n .filter_by_gender(gender) unless gender.blank?\n filtered_data = filtered_data\n .filter_by_education(education) unless education.blank?\n filtered_data = filtered_data.joins(:synonyms)\n filtered_data = filtered_data\n .where(synonyms: { keyword_id: keyword_id, approved: true })\n\n votes_count = filtered_data.count(group: \"synonyms.id\")\n\n synonym_list = []\n filtered_data.each { |gamer| synonym_list += gamer.synonyms\n .where(keyword_id: keyword_id, approved: true) }\n synonym_list.uniq!\n\n synonym_list = synonym_list\n .reject { |synonym| synonym.is_formal != is_formal } if is_formal != nil\n\n synonym_list = synonym_list.sort_by { |synonym| votes_count[synonym.id] }\n .reverse!\n\n synonyms_with_no_votes = self.synonyms\n .where(synonyms: { approved: true }) - synonym_list\n synonyms_with_no_votes\n .reject! { |synonym| synonym.is_formal != is_formal } unless is_formal == nil\n synonym_list = synonym_list + synonyms_with_no_votes\n\n [synonym_list, votes_count]\n end",
"def index\n @studies = Study.all\n #render json: @studies\n end",
"def index\n @dteors = Dteor.all\n @thems = get_tem\n respond_to do |format|\n if get_tem\n format.html # index.html.erb\n format.json { render json: @dteors } \n else\n format.html { redirect_to new_student_path, notice: t(:vvedit_dani)}\n end\n \n end\n end",
"def index\n @word_pairs = WordPair.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @word_pairs }\n end\n end",
"def search_result\n @search = params[:search]\n query = params[:search] #Query variable is the string a user enters in the search bar.\n url = Addressable::URI.parse('https://api.themoviedb.org/3/search/tv?api_key=fb6a1d3f38c3d97f67df6d141f936f29&language=en-US')\n url.query_values = url.query_values.merge(query: query)\n response = HTTParty.get(url)\n @results = JSON.parse(response.body, symbolize_names: true) \n end",
"def index\n @studies = Study.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @studies }\n end\n end",
"def make_search(url)\n #make the web request\n data = RestClient.get url\n JSON.parse(data)\nend",
"def index\n @title = \"Studies\"\n\n respond_to do |format|\n format.html do\n @my_studies = Study.with_user(current_user.netid)\n end\n format.json do\n render :json => Study.with_user(current_user.netid).to_json\n end\n end\n end",
"def index\n #@verses = Verse.all\n @verses = Verse.paginate(page: params[:page]) \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verses }\n end\n end",
"def index\n @talks = Talk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talks }\n end\n end",
"def show\n @api_noun = Api::Noun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_noun }\n end\n end",
"def spells\n get_schools\n get_classes\n\n respond_to do |format|\n format.json {\n get_all_spells\n render json: @spells.sort_by {|k, v| v['name']}.to_json\n }\n format.html {}\n end\n end",
"def getToolsSyndicateThomsonlocal( entity_id, destructive)\n params = Hash.new\n params['entity_id'] = entity_id\n params['destructive'] = destructive\n return doCurl(\"get\",\"/tools/syndicate/thomsonlocal\",params)\n end",
"def similar artist\n url = \"http://developer.echonest.com/api/v4/artist/similar?api_key=#{ECHONEST_API_KEY}&bucket=years_active&name=#{artist}&format=json&start=0&results=#{RESULTS}\"\n parseURL url\n #also get their hotness?\nend",
"def web_request\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\nend",
"def index\n @litters = Litter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @litters }\n end\n end",
"def index\n @reloud_checks = ReloudCheck.search(params[:search])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reloud_checks }\n end\n end",
"def index\n respond_to do |format|\n format.json { render :json => Phrase.all }\n end\n end",
"def index\n @ramais = Ramal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ramais }\n end\n end",
"def get_nouns_from_parser_response(s)\n nouns = []\n noun = \"\"\n s.each_line do |line|\n (word, pos) = line.split\n next if word =~ /\\|/\n if pos =~ /NN/\n if noun == \"\"\n noun = word\n else\n noun += \" \" + word\n end\n else\n nouns.push(noun) unless noun == \"\"\n noun = \"\"\n end\n end\n nouns.map! { |n| n.downcase }\n # Remove the language versions of the title found in the wiki text page\n nouns.reject { |n| n =~ /\\saf$|\\sam$|\\sar$|\\sast$|\\saz$|\\sbn$|\\sbe$|\\sbg$|\\sbs$|\\sbr$|\\sca$|\\scs$|\\scy$|\\sda$|\\sde$|\\set$|\\sel$|\\ses$|\\seo$|\\seu$|\\sfa$|\\shif$|\\sfo$|\\sfr$|\\sfy$|\\sgl$|\\sgu$|\\sko$|\\shi$|\\shr$|\\sio$|\\sid$|\\sia$|\\sis$|\\sit$|\\shy$|\\she$|\\sjv$|\\skn$|\\ska$|\\skk$|\\ssw$|\\sku$|\\sky$|\\sla$|\\slv$|\\slb$|\\slt$|\\shu$|\\smk$|\\sml$|\\smr$|\\sms$|\\smn$|\\smy$|\\sml$|\\sne$|\\snew$|\\sja$|\\sno$|\\snn$|\\snl$|\\soc$|\\spnb$|\\snds$|\\spl$|\\spt$|\\sro$|\\squ$|\\sru$|\\ssa$|\\ssco$|\\ssq$|\\ssi$|\\ssimple$|\\ssk$|\\ssl$|\\ssr$|\\ssh$|\\sfi$|\\ssv$|\\stl$|\\sta$|\\ste$|\\sth$|\\str$|\\suk$|\\sur$|\\svi$|\\swar$|\\syo$|\\sbat$|\\szh$/ }\n end",
"def show\n @lost = Lost.find(params[:id])\n @matches = Found.tagged_with(@lost.tag_list, :any => true)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lost }\n end\n end",
"def index\n @whoarewes = Whoarewe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @whoarewes }\n end\n end",
"def show\n @special_word = SpecialWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @special_word }\n end\n end",
"def url_verification\n render json: { challenge: params[:challenge] }\n end",
"def show\n @torneo = Torneo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torneo }\n end\n end",
"def search_techcrunch\n response_string = RestClient.get\"https://newsapi.org/v2/top-headlines?sources=techcrunch&apiKey=45aee5b7c7584064ac1b1de6297f5137\"\n response_hash = JSON.parse(response_string.body)\n end",
"def search_for_active_towns\n q = params[:query].mb_chars.capitalize.to_s\n @towns = Town.get_central_authority_towns(q).order_by(:level => :asc)\n respond_to do |format|\n format.json { render 'search'}\n end\n end",
"def get_tweet(search,since_id = 0, throtle = 20)\n\turl = 'http://search.twitter.com/search.json?q='+search+'&rpp='+throtle.to_s+'&since_id='+since_id.to_s\n\tprint \"Asking with this url \" + url+ \"\\n\"\n\tresp = Net::HTTP.get_response(URI.parse(url))\n\tresponse_array = JSON.parse(resp.body)\nend",
"def show\n @sentence = Sentence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sentence }\n end\n end",
"def index\n @dog_walks = DogWalk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dog_walks }\n end\n \n end",
"def response(env)\n env.trace :response_beg\n\n result_set = fetch_twitter_search(env.params['q'])\n\n fetch_trstrank(result_set)\n \n body = JSON.pretty_generate(result_set)\n\n env.trace :response_end\n [200, {}, body]\n end",
"def index\n @concept_maps = ConceptMap.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@concept_maps }\n end\n end",
"def reverse\n if !params[:word].empty?\n reversed_word = params[:word].reverse\n json_response({ reversed_word: reversed_word }, :ok)\n else\n json_response({ message: 'Sorry, we couldn\\'t process your submission' }, :unprocessable_entity)\n end\n end",
"def stod2sport\n Apis.client.get('/tv/stod2sport')\n end",
"def index\n @socioeconomic_studies = SocioeconomicStudy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socioeconomic_studies }\n end\n end",
"def show\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rayon }\n end\n end",
"def index\n #since trainers is conncected to gym\n #find the gym where the id of gym is equal to the trainer\n #SO THIS WILL TARGET SPECEFIC PEOPLE WHOS GYM.ID IS EQUAL TO TRAINER gym_id\n @gym=Gym.find(params[:gym_id])\n @trainers=Trainer.where(gym_id: @gym.id)\n render json: @trainers, include: :clients, status: :ok\n end",
"def index\n @loves = Love.all\n render json: @loves\n end",
"def index\n\t\trespond_with( {:error => 'You must provide a word.' }, :status => 422 ) # http 422 is unprocessible entity / malformed request\n\tend",
"def show\n @corpus = Corpus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corpus }\n end\n end",
"def show\n @word_pair = WordPair.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_pair }\n end\n end",
"def wordnet_lookup_syns(lemma, pos)\n # Convert back to wordnet format\n lemma = lemma.tr(' ', '_')\n if (wordnet_lemma = WordNet::Lemma.find(lemma, pos))\n # Fetch all synonyms (combining all senses of the word)\n wordnet_lemma.synsets.flat_map(&:words).map do |w|\n # Clean up the output\n # - Adjectives can have an adjective marker at their end which needs be\n # stripped. Eg. beautiful(ip), beautiful(p), beautiful(a)\n # - Replace underscores with spaces\n w.gsub(/\\([a-z]*\\)$/, '').tr('_', ' ')\n end\n else\n []\n end\n end",
"def searchBySpeciality\n\t\turl = request.original_url\n\t\t\n\t\tbegin\n\n\t\t\tprms = CGI.parse(URI.parse(url).query)\n\n\n\t\t\tresults = Doctor.where(\"speciality LIKE ?\", \"%#{prms['speciality'][0]}%\")\n\t\t\trender json: results\n\t\trescue Exception => e\n\t\t\trender json: { errors: \"Some errors\" }, status: 422\n\t\tend\n\tend",
"def index\n @laws = Law.ordered_roots\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laws }\n end\n end",
"def index\n @conflict_illnesses = ConflictIllness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conflict_illnesses }\n end\n end",
"def index\n @talk = Talk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk }\n end\n end",
"def index\n @consents = Consent.all\n render json: @consents\n end",
"def my_students(query={})\n self.simple_client.get(\"/api/v1/students?#{query.to_query}\")\n end",
"def index\n render json: Story.all\n end",
"def mock_response_with_spellcheck\n %({'responseHeader'=>{'status'=>0,'QTime'=>9,'params'=>{'spellcheck'=>'true','spellcheck.collate'=>'true','wt'=>'ruby','q'=>'hell ultrashar'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'suggestion'=>['dell']},'ultrashar',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'suggestion'=>['ultrasharp']},'collation','dell ultrasharp']}})\n end",
"def index\n @phrasebooks = Phrasebook.all\n\n render json: @phrasebooks\n end",
"def synonyms(word, options = {})\r\n\t\t\tresponse = call(word)\r\n\t\t\tdoc = Nokogiri.HTML(response)\r\n\t\t\tsynonyms = Array.new\r\n\t\t\tdoc.css('#wordcloud1 > span').each do |synonym|\r\n\t\t\t\tscore = Integer(synonym.values[0])\r\n\r\n\t\t\t\tsynonyms.push({\r\n\t\t\t\t\tword: synonym.inner_html,\r\n\t\t\t\t\tscore: score\r\n\t\t\t\t}) unless score < 75\r\n\t\t\t\t# A minimum score of 75 is considered because educalingo\r\n\t\t\t\t# tends to have completely unrelated words around this score\r\n\t\t\tend\r\n\r\n\t\t\treturn synonyms\r\n\t\tend",
"def indexs\n\n\n #application/mixare-json \n\n \tslat = params[:slat]\n \tslon = params[:slon]\n \telat = params[:elat]\n \telon = params[:elon]\n\n \t# /hgt/_design/hgt/_view/tags?startkey=[-27,27]\\&endkey=[-25,28]\n #uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags?startkey=[#{slat},#{slon}]&endkey=[#{elat},#{elon}]\"\n uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags\"\n\n request = RestClient.get uri\n\n request = Yajl::Parser.parse(request)\n\n puts request.inspect\n\n response = {}\n response[:results] = []\n\n request[\"rows\"].each do |row|\n\n title = row[\"value\"][\"kind\"] == \"recommendation\" ? \"Go There - \" : \"Don't Go There - \"\n title = \"#{title}#{row['value']['description']}\"\n\n response[:results] << {\n id: row[\"id\"],\n lat: row[\"value\"][\"lat\"].to_s,\n lng: row[\"value\"][\"lon\"].to_s,\n elevation: \"0.0\",\n title: title,\n distance: \"1\",\n has_detail_page: \"0\",\n webpage: \"\"\n }\n end\n response[:status] = \"OK\"\n response[:num_results] = response[:results].length\n render json: response, :content_type => 'application/mixare-json'\n end"
] |
[
"0.61419743",
"0.6117845",
"0.59873486",
"0.5809191",
"0.5761091",
"0.56547326",
"0.56007016",
"0.550228",
"0.5498117",
"0.54955137",
"0.54951334",
"0.5492723",
"0.54742706",
"0.5458776",
"0.5454497",
"0.5419186",
"0.5365704",
"0.5357591",
"0.53476876",
"0.53193563",
"0.5307071",
"0.5289646",
"0.52849615",
"0.5281194",
"0.5276177",
"0.5273632",
"0.5254395",
"0.5253437",
"0.52415246",
"0.52415246",
"0.52415246",
"0.52389073",
"0.52297324",
"0.5225401",
"0.5225061",
"0.52131337",
"0.52048796",
"0.52000237",
"0.51982707",
"0.5195718",
"0.5191611",
"0.5187052",
"0.5181935",
"0.51747245",
"0.5172693",
"0.5166141",
"0.51610875",
"0.5159293",
"0.51506364",
"0.5148978",
"0.51472896",
"0.51410383",
"0.5138631",
"0.5135842",
"0.5135509",
"0.5124345",
"0.51157063",
"0.5110529",
"0.50871974",
"0.5085132",
"0.5083316",
"0.5079734",
"0.50780904",
"0.5075529",
"0.50749457",
"0.5070539",
"0.5068295",
"0.506802",
"0.5066813",
"0.5066601",
"0.5055457",
"0.50539887",
"0.5048055",
"0.5047825",
"0.50438344",
"0.503914",
"0.5036853",
"0.5033135",
"0.50328994",
"0.5029371",
"0.50284773",
"0.5028163",
"0.5028148",
"0.5019436",
"0.50130653",
"0.5011926",
"0.50092906",
"0.500897",
"0.5008307",
"0.50035834",
"0.4999655",
"0.49908844",
"0.49907106",
"0.49825364",
"0.49796015",
"0.49787584",
"0.49765408",
"0.49735737",
"0.49729317",
"0.49699047"
] |
0.6881174
|
0
|
GET /syndromes/1 GET /syndromes/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @syndromes = Syndrome.all\n end",
"def set_syndrome\n @syndrome = Syndrome.find(params[:id])\n end",
"def create\n @syndrome = Syndrome.new(syndrome_params)\n\n respond_to do |format|\n if @syndrome.save\n format.html { redirect_to @syndrome, notice: 'Syndrome was successfully created.' }\n format.json { render :show, status: :created, location: @syndrome }\n else\n format.html { render :new }\n format.json { render json: @syndrome.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @division_syns = DivisionSyn.all\n\n render json: @division_syns\n end",
"def index\n @syndics = Syndic.all\n end",
"def update\n respond_to do |format|\n if @syndrome.update(syndrome_params)\n format.html { redirect_to @syndrome, notice: 'Syndrome was successfully updated.' }\n format.json { render :show, status: :ok, location: @syndrome }\n else\n format.html { render :edit }\n format.json { render json: @syndrome.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @meanings = Meaning.where(word_id: @word.id)\n @synonymous = Synonymou.all\n end",
"def index\n @normas = Norma.all\n render json: @normas\n end",
"def destroy\n @syndrome.destroy\n respond_to do |format|\n format.html { redirect_to syndromes_url, notice: 'Syndrome was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def api\n url = \"https://wagon-dictionary.herokuapp.com/#{@answer}\"\n response = URI.open(url).read\n json = JSON.parse(response)\n return json['found']\n end",
"def index\n @symptoms = Symptom.all\n\n render json: @symptoms\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @serach_word = SerachWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serach_word }\n end\n end",
"def show\n @thought = Thought.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thought }\n end\n end",
"def show\n @api_noun = Api::Noun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_noun }\n end\n end",
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html\n format.json do\n render json: @tutorials\n end\n end\nend",
"def show\n @sleuths = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @sleuth.ext_gene + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @sleuth.ext_gene,\n :headers =>{'Content-Type' => 'application/json'} )\n end",
"def english_word(attempt)\n url = \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n # Jason \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n raw_response = open(url).read\n JSON.parse(raw_response, symbolize_names: true)\n end",
"def syndrome_params\n params.require(:syndrome).permit(:name, :description, :position)\n end",
"def show\n @special_word = SpecialWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @special_word }\n end\n end",
"def show\n @concept = Concept.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concept }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @neuropsychologist }\n end\n end",
"def show\n @corpus = Corpus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corpus }\n end\n end",
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tutorials }\n end\n end",
"def show\n @study = Study.find(params[:id])\n render json: @study\n end",
"def rhyming\n if !params[:word].empty?\n rhymes = Rhymes.new\n \n begin \n rhyming_words = rhymes.rhyme(params[:word])\n rescue StandardError => e \n json_response({ err: e }, :not_found)\n else\n json_response({rhyming_words: rhyming_words}, :ok)\n end\n else\n json_response({ message: 'Sorry, we couldn\\'t process your submission' }, :unprocessable_entity)\n end\n end",
"def index\n @synonymproteins = Synonymprotein.all\n end",
"def index\n @query = params[:query] || {\n search: '',\n }\n @theorems = Theorem.all.where(root: true).limit(50)\n @theorems = @theorems.order('views desc')\n @theorems = @theorems.where('text ILIKE ?', \"%#{@query[:search]}%\") if @query[:search] && @query[:search].length > 0\n respond_to do |f|\n f.html { render 'index' }\n f.json { render json: @theorems }\n end\n end",
"def search\n terms = @authority.search(url_search)\n render json: terms\n end",
"def show\n render json: @spellbook\n end",
"def show\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rayon }\n end\n end",
"def index\n @mirrors = Mirror.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mirrors }\n end\n end",
"def show\n @research = Research.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @research }\n end\n end",
"def show\n @rainbow = Rainbow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rainbow }\n end\n end",
"def index\n @microroles = Microrole.includes(:verb_coding_frame_microroles).readonly(false).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microroles }\n end\n end",
"def show\n @sentence = Sentence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sentence }\n end\n end",
"def show\n @synonyme = @stoff.stoff_synonyms.pluck(:synonym)\n @transporte = Transport.where(\"stoff_id = ?\", @stoff).order(datum: :desc).paginate(page: params[:page], per_page: 20)\n end",
"def getRandomWord\n @word = Wordnik.words.get_random_word(\n includePartOfSpeech: \"noun\",\n minLength: 5,\n maxLength: 10\n )\n if request.xhr?\n render :json => @word\n end\n end",
"def index\n @studies = Study.all\n #render json: @studies\n end",
"def index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end",
"def show\n @nlp = Nlp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nlp }\n end\n end",
"def index\n @studies = Study.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @studies }\n end\n end",
"def show\n @mistake = Mistake.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mistake }\n end\n end",
"def show\n @word_pair = WordPair.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_pair }\n end\n end",
"def index\n @verbs = Verb.all\n\n render json: @verbs\n end",
"def show\n @torneo = Torneo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torneo }\n end\n end",
"def index\n @searches = @website.searches.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @searches }\n end\n end",
"def show\n @nyan = Nyan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nyan }\n end\n end",
"def show\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torso }\n end\n end",
"def index\n @title = \"Studies\"\n\n respond_to do |format|\n format.html do\n @my_studies = Study.with_user(current_user.netid)\n end\n format.json do\n render :json => Study.with_user(current_user.netid).to_json\n end\n end\n end",
"def show\n @study = Study.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @study }\n end\n end",
"def index\n @talk_suggestions = TalkSuggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_suggestions }\n end\n end",
"def show\n @word_index = WordIndex.where(:word => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_index }\n end\n end",
"def show\n @irregular_verb = IrregularVerb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @irregular_verb }\n end\n end",
"def index\n @words = Word.order(:word).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end",
"def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"def wordValidator\n print params[:currentWord]\n\n # the api key didn't work need to register to rapidAPI link,is asking for credit card\n #HTTP.get(\"https://github.com\").to_s\n\n=begin\n uri = URI('https://webspellchecker-webspellcheckernet.p.rapidapi.com/ssrv.cgi')\n req = Net::HTTP::Get.new(uri)\n\n req['x-rapidapi-host'] = \"webspellchecker-webspellcheckernet.p.rapidapi.com\"\n req['x-rapidapi-key'] = \"46bca383efmsh1fdbe7cce97066ap1b3476jsn2dc7e69af91b\"\n req['Accept'] = 'application/json'\n req['Content-Type'] = 'application/json'\n\n res = Net::HTTP.start(uri.hostname, uri.port) {|http|\n http.request(req)\n }\n=end\n\n\n\n\n wordfound = 'false'\n score = 0\n if word\n wordfound = 'true'\n b = BoggleUtils.new\n score = b.wordScore(params[:currentWord])\n end\n\n render json: { value: wordfound, word: params[:currentWord], score: score}\n end",
"def random_roberto_speech\n skip_authorization\n respond_to do |format|\n format.json do\n render json: { roberto_speech: \"#{RobertoBarros.in_ingrish} #{direction_for_active_cell(@play)}\" }\n end\n end\n end",
"def index\n @words = Word.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end",
"def new\n @serach_word = SerachWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serach_word }\n end\n end",
"def similar\n @property = Property.find(params[:id])\n @response = HTTParty.get(\"http://api.nestoria.co.uk/api?place_name=#{@property.postCode}&action=search_listings&pretty=1&encoding=json&listing_type=rent&country=uk\")\n @data = @response['response']['listings']\n respond_to do |format|\n format.js\n end\n end",
"def show\n render json: @dna\n end",
"def synonyms; end",
"def synonyms\n @synonyms ||= {\n /^awesome$/i => %w[great excellent cool awesome splendid],\n /^okay$/i => %w[okay great alright],\n /^hello$/i => %w[hello hi greetings],\n /^yes$/i => %w[yes affirmative definitely correct certainly],\n /^no$/i => %w[no negative incorrect false],\n /^update$/i => %w[update change modify revise alter edit adjust],\n /^updated$/i => %w[updated changed modified revised altered edited adjusted],\n /^add$/i => %w[add create],\n /^added$/i => %w[added created],\n /^what|how$/i => %w[how what]\n }\n end",
"def show\n @reminder_phrase = ReminderPhrase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reminder_phrase }\n end\n end",
"def index\n @lessons = Lesson.all\n\n render 'index.json'\n end",
"def index\n #since trainers is conncected to gym\n #find the gym where the id of gym is equal to the trainer\n #SO THIS WILL TARGET SPECEFIC PEOPLE WHOS GYM.ID IS EQUAL TO TRAINER gym_id\n @gym=Gym.find(params[:gym_id])\n @trainers=Trainer.where(gym_id: @gym.id)\n render json: @trainers, include: :clients, status: :ok\n end",
"def index\n @ramais = Ramal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ramais }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def index\n @concept_maps = ConceptMap.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@concept_maps }\n end\n end",
"def index\n @suggestions = Suggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @suggestions }\n end\n end",
"def index\n @talks = Talk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talks }\n end\n end",
"def show\n # TODO: this is a placeholder for logic using Sentence\n render :json => { :index => params[:id],\n :contents => \"SERVER: this would be the contents of page \" + params[:id]\n }\n end",
"def show\n @familiar = Familiar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @familiar }\n end\n end",
"def get_synonym(property, key)\n return unless property[:synonyms] && property[:synonyms].include?(key)\n property[:synonyms][key]\n end",
"def index\n #@verses = Verse.all\n @verses = Verse.paginate(page: params[:page]) \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verses }\n end\n end",
"def index\n render json: Story.all\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial.to_hash(false) }\n end\n end",
"def getToolsSyndicateThomsonlocal( entity_id, destructive)\n params = Hash.new\n params['entity_id'] = entity_id\n params['destructive'] = destructive\n return doCurl(\"get\",\"/tools/syndicate/thomsonlocal\",params)\n end",
"def index\n @dog_walks = DogWalk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dog_walks }\n end\n \n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend",
"def get_handle\n logger.debug \"Hoo ha!\"\n s = Swimmer.find(:all, :conditions => \"last = '#{params[:last]} and first like '#{params[:first]}'\").map {er|x| x.id }\n respond_to do |format|\n json { render s.to_json }\n end\n end",
"def index\n @litters = Litter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @litters }\n end\n end",
"def show\n @conceptual_entity = ConceptualEntity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conceptual_entity }\n end\n end",
"def client_search\n @conventions = Convention.where(\"lower(name) LIKE lower(?)\" , \"%\" + params[:query] + \"%\")\n\n if @conventions.empty?\n render json: {}\n else\n results = {}\n results[:conventions] = @conventions.as_json\n render json: results\n end\n end",
"def index\n respond_to do |format|\n format.json { render :json => Phrase.all }\n end\n end",
"def show\n @spirit = Spirit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spirit }\n end\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_monster_info\n monster_string = RestClient.get('http://www.dnd5eapi.co/api/monsters/')\n monster_hash = JSON.parse(monster_string)\n monster_info = monster_hash[\"results\"]\n monster_info\nend",
"def show\n @lsa_test_word = LsaTestWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lsa_test_word }\n end\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def show\n @webling = Webling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @webling }\n end\n end",
"def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunes }\n end\n end",
"def show\n @lsa_training_unique_word = LsaTrainingUniqueWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lsa_training_unique_word }\n end\n end"
] |
[
"0.6833539",
"0.62292284",
"0.62258893",
"0.61689544",
"0.5827616",
"0.5798495",
"0.5562",
"0.55599284",
"0.5556239",
"0.555247",
"0.5533186",
"0.55324256",
"0.55324256",
"0.55324256",
"0.5519313",
"0.5498832",
"0.54689854",
"0.54041046",
"0.5384065",
"0.53797096",
"0.536672",
"0.5354106",
"0.5336973",
"0.53312856",
"0.5328559",
"0.53243357",
"0.53201056",
"0.5319367",
"0.53141946",
"0.530831",
"0.5307769",
"0.5301445",
"0.52940595",
"0.529115",
"0.5280314",
"0.52800894",
"0.5264848",
"0.52598864",
"0.5253544",
"0.5251118",
"0.52388734",
"0.5238008",
"0.5234778",
"0.5233671",
"0.5228708",
"0.52284575",
"0.5227182",
"0.52171385",
"0.5195534",
"0.5194307",
"0.5187104",
"0.51860833",
"0.5179907",
"0.51789504",
"0.51723176",
"0.516941",
"0.51611125",
"0.51590955",
"0.5157308",
"0.51564777",
"0.51564425",
"0.5155523",
"0.5140446",
"0.5140071",
"0.51366544",
"0.5132555",
"0.5129442",
"0.5127565",
"0.51246625",
"0.51244867",
"0.51218885",
"0.51218885",
"0.51218885",
"0.51218885",
"0.5115615",
"0.51129293",
"0.5111084",
"0.51036483",
"0.5101076",
"0.5099274",
"0.5096802",
"0.5092524",
"0.5089296",
"0.508831",
"0.5088263",
"0.5087815",
"0.5086119",
"0.5081968",
"0.50816053",
"0.5079985",
"0.5078721",
"0.5076674",
"0.50723267",
"0.5064185",
"0.5064185",
"0.50636935",
"0.5061744",
"0.50587404",
"0.50567955",
"0.5049511",
"0.50462115"
] |
0.0
|
-1
|
POST /syndromes POST /syndromes.json
|
def create
@syndrome = Syndrome.new(syndrome_params)
respond_to do |format|
if @syndrome.save
format.html { redirect_to @syndrome, notice: 'Syndrome was successfully created.' }
format.json { render :show, status: :created, location: @syndrome }
else
format.html { render :new }
format.json { render json: @syndrome.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def syndrome_params\n params.require(:syndrome).permit(:name, :description, :position)\n end",
"def synonymprotein_params\n params.require(:synonymprotein).permit(:synonymname)\n end",
"def set_syndrome\n @syndrome = Syndrome.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @syndrome.update(syndrome_params)\n format.html { redirect_to @syndrome, notice: 'Syndrome was successfully updated.' }\n format.json { render :show, status: :ok, location: @syndrome }\n else\n format.html { render :edit }\n format.json { render json: @syndrome.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @synonymprotein = Synonymprotein.new(synonymprotein_params)\n\n respond_to do |format|\n if @synonymprotein.save\n format.html { redirect_to @synonymprotein, notice: 'Synonymprotein was successfully created.' }\n format.json { render :show, status: :created, location: @synonymprotein }\n else\n format.html { render :new }\n format.json { render json: @synonymprotein.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @syndromes = Syndrome.all\n end",
"def create\n @syndic = Syndic.new(syndic_params)\n\n respond_to do |format|\n if @syndic.save\n format.html { redirect_to @syndic, notice: \"Syndic was successfully created.\" }\n format.json { render :show, status: :created, location: @syndic }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @syndic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def lesson_word_synonym_params\n params.require(:lesson_word_synonym).permit(:lesson_word_id, :synonym_id)\n end",
"def rhyming\n if !params[:word].empty?\n rhymes = Rhymes.new\n \n begin \n rhyming_words = rhymes.rhyme(params[:word])\n rescue StandardError => e \n json_response({ err: e }, :not_found)\n else\n json_response({rhyming_words: rhyming_words}, :ok)\n end\n else\n json_response({ message: 'Sorry, we couldn\\'t process your submission' }, :unprocessable_entity)\n end\n end",
"def destroy\n @syndrome.destroy\n respond_to do |format|\n format.html { redirect_to syndromes_url, notice: 'Syndrome was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def reverse\n if !params[:word].empty?\n reversed_word = params[:word].reverse\n json_response({ reversed_word: reversed_word }, :ok)\n else\n json_response({ message: 'Sorry, we couldn\\'t process your submission' }, :unprocessable_entity)\n end\n end",
"def create(input)\n @response = self.request(Net::HTTP::Post.new(\n \"/stikkits.atom?raw_text=#{CGI.escape(input)}\"\n ))\n #-- TODO: This should be processed and useful output presented\n #++\n puts @response.body\n end",
"def create\n\n\n\n @hydrometer = Hydrometer.new(hydrometer_params)\n\n respond_to do |format|\n if @hydrometer.save\n format.html { redirect_to @hydrometer, notice: 'Hydrometer was successfully created.' }\n format.json { render :show, status: :created, location: @hydrometer }\n else\n format.html { render :new }\n format.json { render json: @hydrometer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postCategorySynonym( category_id, synonym, language)\n params = Hash.new\n params['category_id'] = category_id\n params['synonym'] = synonym\n params['language'] = language\n return doCurl(\"post\",\"/category/synonym\",params)\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def molecule_synonym_params\n params.require(:molecule_synonym).permit(:molecule_id, :synonym)\n end",
"def synonyms\n @synonyms ||= {\n /^awesome$/i => %w[great excellent cool awesome splendid],\n /^okay$/i => %w[okay great alright],\n /^hello$/i => %w[hello hi greetings],\n /^yes$/i => %w[yes affirmative definitely correct certainly],\n /^no$/i => %w[no negative incorrect false],\n /^update$/i => %w[update change modify revise alter edit adjust],\n /^updated$/i => %w[updated changed modified revised altered edited adjusted],\n /^add$/i => %w[add create],\n /^added$/i => %w[added created],\n /^what|how$/i => %w[how what]\n }\n end",
"def change_synonyms # :prefetch: :norobots:\n pass_query_params\n if @name = find_or_goto_index(Name, params[:id].to_s)\n @list_members = nil\n @new_names = nil\n @synonym_name_ids = []\n @synonym_names = []\n @deprecate_all = true\n if request.method == :post\n list = params[:synonym][:members].strip_squeeze\n @deprecate_all = (params[:deprecate][:all] == '1')\n\n # Create any new names that have been approved.\n construct_approved_names(list, params[:approved_names], @deprecate_all)\n\n # Parse the write-in list of names.\n sorter = NameSorter.new\n sorter.sort_names(list)\n sorter.append_approved_synonyms(params[:approved_synonyms])\n\n # Are any names unrecognized (only unapproved names will still be\n # unrecognized at this point) or ambiguous?\n if !sorter.only_single_names\n dump_sorter(sorter)\n # Has the user NOT had a chance to choose from among the synonyms of any\n # names they've written in?\n elsif !sorter.only_approved_synonyms\n flash_notice :name_change_synonyms_confirm.t\n else\n now = Time.now\n\n # Create synonym and add this name to it if this name not already\n # associated with a synonym.\n if !@name.synonym_id\n @name.synonym = Synonym.create\n @name.save\n Transaction.post_synonym(\n :id => @name.synonym\n )\n Transaction.put_name(\n :id => @name,\n :set_synonym => @name.synonym\n )\n end\n\n # Go through list of all synonyms for this name and written-in names.\n # Exclude any names that have un-checked check-boxes: newly written-in\n # names will not have a check-box yet, names written-in in previous\n # attempt to submit this form will have checkboxes and therefore must\n # be checked to proceed -- the default initial state.\n proposed_synonyms = params[:proposed_synonyms] || {}\n for n in sorter.all_synonyms\n # Synonymize all names that have been checked, or that don't have\n # checkboxes.\n if proposed_synonyms[n.id.to_s] != '0'\n if n.synonym_id != @name.synonym_id\n @name.transfer_synonym(n)\n Transaction.put_name(\n :id => n,\n :set_synonym => @name.synonym\n )\n end\n end\n end\n\n # De-synonymize any old synonyms in the \"existing synonyms\" list that\n # have been unchecked. This creates a new synonym to connect them if\n # there are multiple unchecked names -- that is, it splits this\n # synonym into two synonyms, with checked names staying in this one,\n # and unchecked names moving to the new one.\n check_for_new_synonym(@name, @name.synonyms, params[:existing_synonyms] || {})\n\n # Deprecate everything if that check-box has been marked.\n success = true\n if @deprecate_all\n for n in sorter.all_names\n if !deprecate_synonym(n)\n # Already flashed error message.\n success = false\n end\n end\n end\n\n if success\n redirect_to(:action => 'show_name', :id => @name.id,\n :params => query_params)\n else\n flash_object_errors(@name)\n flash_object_errors(@name.synonym)\n end\n end\n\n @list_members = sorter.all_line_strs.join(\"\\r\\n\")\n @new_names = sorter.new_name_strs.uniq\n @synonym_name_ids = sorter.all_synonyms.map(&:id)\n @synonym_names = @synonym_name_ids.map {|id| Name.safe_find(id)}.reject(&:nil?)\n end\n end\n end",
"def create\n @serach_word = SerachWord.new(params[:serach_word])\n\n respond_to do |format|\n if @serach_word.save\n format.html { redirect_to @serach_word, notice: 'Serach word was successfully created.' }\n format.json { render json: @serach_word, status: :created, location: @serach_word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @serach_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_create_palindrome_message\n body = {\n \tdata: {\n \t\ttype: 'messages',\n \t\tattributes: {\n \t\t\tcontent: 'racecar'\n \t\t}\n \t}\n }\n\n post '/messages', body.to_json, 'CONTENT_TYPE' => AppConstants::CONTENT_TYPE\n assert last_response.created?\n assert_equal 'application/vnd.api+json', last_response.headers['Content-Type']\n\n response_body = JSON.parse last_response.body\n data = response_body['data']\n\n assert_equal 'messages', data['type']\n assert_equal body[:data][:attributes][:content], data['attributes']['content']\n assert data['attributes']['is_palindrome']\n assert_equal \"localhost:4567/messages/#{data['id']}\", last_response.headers['Location']\n end",
"def diseasesynonym_params\n params.require(:diseasesynonym).permit(:synonym)\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def syndic_params\n params.require(:syndic).permit(:start, :end, :user_id)\n end",
"def create_synonym_set(engine_name, body)\n post(\"engines/#{engine_name}/synonyms\", body)\n end",
"def create\n @tree = Tree.new(params[:tree])\n @tree.synclatlon\n respond_to do |format|\n if @tree.save\n format.html { redirect_to @tree, notice: 'Tree was successfully created.' }\n format.json { render json: @tree, status: :created, location: @tree }\n else\n format.html { render 'new' }\n format.json { render json: @tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stoff = Stoff.new(stoff_params)\n @redirect_params = (params[:redirect_params].blank?) ? @stoff : params[:redirect_params] \n \n respond_to do |format|\n if @stoff.save\n # Name als Synonm speichern\n synonym = StoffSynonym.find_by(synonym: @stoff.bezeichnung)\n if synonym.nil?\n synonym = StoffSynonym.new(synonym: @stoff.bezeichnung) \n end\n synonym.stoff = @stoff if synonym.stoff.nil?\n synonym.save \n File.open(\"log/anlagen.log\",\"a\"){|f| f.puts \"syn #{synonym}\"}\n if params[:synonym] && params[:synonym] != @stoff.bezeichnung\n synonym = StoffSynonym.find_by(synonym: params[:synonym])\n if synonym \n synonym.stoff = @stoff\n synonym.save \n end\n end\n flash[:success] = \"Stoff erstellt.\"\n format.html { redirect_to @redirect_params }\n format.json { render :show, status: :created, location: @stoff }\n else\n format.html { render :new }\n format.json { render json: @stoff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @molecule_synonym = MoleculeSynonym.new(molecule_synonym_params)\n\n respond_to do |format|\n if @molecule_synonym.save\n format.html { redirect_to @molecule_synonym, notice: 'Molecule synonym was successfully created.' }\n format.json { render :show, status: :created, location: @molecule_synonym }\n else\n format.html { render :new }\n format.json { render json: @molecule_synonym.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @word = Word.new(word_params)\n word_params[:meanings_attributes][:word_id] = @word.id\n\n if word_params[:synonymous_attributes]!=nil\n word_params[:synonymous_attributes][:word_id] = @word.id\n end\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_tags\n uri = URI.parse(\"https://api.thomsonreuters.com/permid/calais\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n post_body = []\n post_body << \"<Document><Body>\"\n # stip html\n post_body << ActionView::Base.full_sanitizer.sanitize(params[:desc])\n # no strip\n # post_body << params[:desc]\n post_body << \"</Body></Document>\"\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field(\"Content-Type\",\"text/xml\")\n request.add_field(\"outputFormat\",\"application/json\")\n #request.add_field(\"outputFormat\",\"text/n3\") \n request.add_field(\"x-ag-access-token\",\"fY7WUM3GGCXHm9ATOhtzhrvlWX8oPo5X\")\n request.body = post_body.join\n # request[\"Content-Type\"] = \"multipart/form-data, boundary=#{BOUNDARY}\"\n\n render :json => http.request(request).body\n end",
"def wynthought_params\n params.require(:wynthought).permit(:title, :body, :suggestion_id)\n end",
"def synonyms; end",
"def division_syn_params\n params.require(:division_syn).permit(:name, :email, :phone_number, :address)\n end",
"def create\n @api_noun = Api::Noun.new(params[:api_noun])\n\n respond_to do |format|\n if @api_noun.save\n format.html { redirect_to @api_noun, notice: 'Noun was successfully created.' }\n format.json { render json: @api_noun, status: :created, location: @api_noun }\n else\n format.html { render action: \"new\" }\n format.json { render json: @api_noun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wynthought = Wynthought.new(wynthought_params)\n\n respond_to do |format|\n if @wynthought.save\n format.html { redirect_to :back, notice: 'Wynthought was successfully created.' }\n format.json { render :show, status: :created, location: @wynthought }\n else\n format.html { render :new }\n format.json { render json: @wynthought.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @noun = Noun.new(noun_params)\n\n respond_to do |format|\n if @noun.save\n format.html { redirect_to @noun, notice: 'Noun was successfully created.' }\n format.json { render :show, status: :created, location: @noun }\n else\n format.html { render :new }\n format.json { render json: @noun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post operation, data={}\n body = case data\n when String\n body = data\n else\n Yajl::Encoder.encode(data)\n end\n\n request = new_request operation, body\n request.sign sts\n hydra.queue request\n hydra.run\n response = request.response\n puts response.inspect if @debug\n\n if response.code == 200\n Yajl::Parser.parse response.body\n else\n raise_error response\n end\n end",
"def add_snack\n response = RestClient.post SNACKS_URL, {name: @suggestion.name, location: @suggestion.location}.to_json, content_type: :json\n logger.debug \"web service response code => #{response.code}\"\n if response.code != 200\n flash[:notice] = \"Error: #{response.code} while communicating with services, please try again later.\"\n end\n parsed = JSON.parse(response) \n end",
"def create\n\n @verse = Verse.new(:text => params[:verse], :song_id => params[:song_id], :user_id => params[:user_id])\n\n @song = Song.find_by_id(params[:song_id])\n\n respond_to do |format|\n if @verse.save\n format.html { redirect_to @song, notice: 'Verse was successfully created.' }\n format.json { render json: @song, status: :created, location: @song }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @verse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n ### This one works. \n # @work = Work.friendly.find(params[:work_id])\n # @suggestion = @work.suggesteds.build(suggestion_params)\n # @suggestion.suggester_ip = request.remote_ip\n # @suggestion.user = current_user if current_user\n # respond_to do |format|\n # if @suggestion.save\n # format.html { redirect_to @work\n # flash[:success] = \"Your tag suggestion has been added!\" }\n # format.json { render json: @suggestion, status: :created, location: @suggestion } \n # else\n # format.html { redirect_to @work\n # flash[:warning] = \"Suggesting the suggestion failed. Probably either because you had weird characters in there, or the suggestion exists already.\" }\n # format.json { render json: @suggestion.errors, status: :unprocessable_entity }\n # end\n # end\n\n # This one parses the incoming suggestion(s). AND IT WORKS TOO. \n @work = Work.friendly.find(params[:work_id])\n suggestions = params[:suggested][:suggestion].split(',')\n @i = 0\n if current_user\n @current_user_id = current_user.id \n else \n @current_user_id = nil \n end\n\n suggestions.each do |s, index|\n new_suggestion = @work.suggesteds.build(\n suggester_ip: request.remote_ip,\n user_id: @current_user_id,\n suggestion: s)\n if new_suggestion.save\n @i += 1\n end \n if @i == suggestions.count\n @suggestions_saved = true\n else \n @suggestions_saved = false\n end\n end\n respond_to do |format|\n if @suggestions_saved\n format.html { redirect_to @work \n flash[:info] = \"Success.\"}\n format.json { }\n else\n format.html { redirect_to @work \n flash[:danger] = \"Suggested tags must be unique.\"}\n format.json { }\n end\n end \n end",
"def puf_syndrome\n \n end",
"def index\n @division_syns = DivisionSyn.all\n\n render json: @division_syns\n end",
"def noun_params\n params.require(:noun).permit(:name)\n end",
"def create\n @word = Word.find_or_create_by_text(params[:text])\n\n respond_to do |format|\n if @word.save\n format.json { render json: @word, status: :created,\n location: @word}\n else\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @syndic.update(syndic_params)\n format.html { redirect_to @syndic, notice: \"Syndic was successfully updated.\" }\n format.json { render :show, status: :ok, location: @syndic }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @syndic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rayon = Rayon.new(params[:rayon])\n\n respond_to do |format|\n if @rayon.save\n format.html { redirect_to @rayon, notice: 'Rayon was successfully created.' }\n format.json { render json: @rayon, status: :created, location: @rayon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rayon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def concept_params\n params.require(:concept).permit(:idea, :relevance, :speech_id)\n end",
"def POST; end",
"def index\n @synonymproteins = Synonymprotein.all\n end",
"def new\n @serach_word = SerachWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serach_word }\n end\n end",
"def create\n @trainbot = Trainbot.new(trainbot_params)\n @org = UttranceService.new\n @org.post_uttrance(trainbot_params[:message],trainbot_params[:intent],trainbot_params[:entity],trainbot_params[:start],trainbot_params[:end],trainbot_params[:body]\n )\n respond_to do |format|\n if @trainbot.save\n format.html { redirect_to @trainbot, notice: 'Trainbot was successfully created.' }\n format.json { render :show, status: :created, location: @trainbot }\n else\n format.html { render :new }\n format.json { render json: @trainbot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def survey\n expose Survey.create(@oauth_token, params[:challenge_id].strip, \n params[:data])\n end",
"def create\n @rphrase = Rphrase.new(rphrase_params)\n\n respond_to do |format|\n if @rphrase.save\n format.html { redirect_to @rphrase, notice: 'Rphrase was successfully created.' }\n format.json { render :show, status: :created, location: @rphrase }\n else\n format.html { render :new }\n format.json { render json: @rphrase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reminder_phrase = ReminderPhrase.new(params[:reminder_phrase])\n\n respond_to do |format|\n if @reminder_phrase.save\n format.html { redirect_to @reminder_phrase, notice: 'Reminder phrase was successfully created.' }\n format.json { render json: @reminder_phrase, status: :created, location: @reminder_phrase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reminder_phrase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @noun = Noun.new(params[:noun])\n\n respond_to do |format|\n if @noun.save\n format.html { redirect_to(@noun, :notice => 'Noun was successfully created.') }\n format.xml { render :xml => @noun, :status => :created, :location => @noun }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @noun.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @torneo = Torneo.new(params[:torneo])\n\n respond_to do |format|\n if @torneo.save\n format.html { redirect_to @torneo, notice: 'Torneo was successfully created.' }\n format.json { render json: @torneo, status: :created, location: @torneo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @torneo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sanvandong_params\n params.require(:sanvandong).permit(:soghe, :diachi, :doibong_id, :hinhanh, :ten, :hinanh1, :hinhanh2, :thongtin, :chitietthongtin, :thanhlap, :ve)\n end",
"def create\n\n\t\t\t\ttparams = params.require(:testimony).permit :quote,:author\n\n\t\t\t\t@testimony = Testimony.new tparams\n\n\t\t\t\tif @testimony.save\n\n\t\t\t\t\trender json: @testimony,status: 201\n\n\t\t\t\telse\n\n\t\t\t\t\trender json: {errors: @testimony.errors},status: 422\n\n\t\t\t\tend\n\n\t\t\tend",
"def index\n @syndics = Syndic.all\n end",
"def create\n @anagram = Anagram.new(anagram_params)\n word1 = anagram_params[:firstword]\n word2 = anagram_params[:secondword]\n matchingresult = AnagramsChecker.anagrams?(word1, word2)\n @anagram.matching = matchingresult\n\n # byebug\n\n respond_to do |format|\n if @anagram.save\n format.html { redirect_to @anagram, notice: 'Anagram was successfully created.' }\n format.json { render :show, status: :created, location: @anagram }\n else\n format.html { render :new }\n format.json { render json: @anagram.errors, status: :unprocessable_entity }\n end\n end\n end",
"def wordValidator\n print params[:currentWord]\n\n # the api key didn't work need to register to rapidAPI link,is asking for credit card\n #HTTP.get(\"https://github.com\").to_s\n\n=begin\n uri = URI('https://webspellchecker-webspellcheckernet.p.rapidapi.com/ssrv.cgi')\n req = Net::HTTP::Get.new(uri)\n\n req['x-rapidapi-host'] = \"webspellchecker-webspellcheckernet.p.rapidapi.com\"\n req['x-rapidapi-key'] = \"46bca383efmsh1fdbe7cce97066ap1b3476jsn2dc7e69af91b\"\n req['Accept'] = 'application/json'\n req['Content-Type'] = 'application/json'\n\n res = Net::HTTP.start(uri.hostname, uri.port) {|http|\n http.request(req)\n }\n=end\n\n\n\n\n wordfound = 'false'\n score = 0\n if word\n wordfound = 'true'\n b = BoggleUtils.new\n score = b.wordScore(params[:currentWord])\n end\n\n render json: { value: wordfound, word: params[:currentWord], score: score}\n end",
"def create\n @talk_suggestion = TalkSuggestion.new(params[:talk_suggestion])\n\n respond_to do |format|\n if @talk_suggestion.save\n format.html { redirect_to talk_suggestions_path, notice: 'Talk suggestion was successfully created.' }\n format.json { render json: @talk_suggestion, status: :created, location: @talk_suggestion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @talk_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def snipet_params\n params.require(:snipet).permit(:name, :url, :sentence)\n end",
"def update\n respond_to do |format|\n if @synonymprotein.update(synonymprotein_params)\n format.html { redirect_to @synonymprotein, notice: 'Synonymprotein was successfully updated.' }\n format.json { render :show, status: :ok, location: @synonymprotein }\n else\n format.html { render :edit }\n format.json { render json: @synonymprotein.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nlp = Nlp.new(params[:nlp])\n\n respond_to do |format|\n if @nlp.save\n format.html { redirect_to @nlp, notice: 'Nlp was successfully created.' }\n format.json { render json: @nlp, status: :created, location: @nlp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nlp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shout = Shout.new(params[:shout])\n\n# params[:tags].split(\" \").each do |tag_word|\n# \t @shout.tags.build(:tag_word => tag_word)\n# \tend\n\t\n respond_to do |format|\n if @shout.save\n format.html { redirect_to @shout, notice: 'Shout was successfully created.' }\n format.json { render json: @shout, status: :created, location: @shout }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_synonymprotein\n @synonymprotein = Synonymprotein.find(params[:id])\n end",
"def destroy\n @synonymprotein.destroy\n respond_to do |format|\n format.html { redirect_to synonymproteins_url, notice: 'Synonymprotein was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def mock_response_with_spellcheck\n %({'responseHeader'=>{'status'=>0,'QTime'=>9,'params'=>{'spellcheck'=>'true','spellcheck.collate'=>'true','wt'=>'ruby','q'=>'hell ultrashar'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'suggestion'=>['dell']},'ultrashar',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'suggestion'=>['ultrasharp']},'collation','dell ultrasharp']}})\n end",
"def senses\n brain = Brain.where(\"lower(address) = ?\", params[:address].downcase).first\n\n sensor = Sensor.where(\"lower(address) = ? and brain_id = ?\", params[:sensor_addr].downcase, brain.id).first\n params[:payload] &&= {message: params[:payload]} # This is a really stupid hack to work around my own stupidity but I'm far too tired to care\n sensor.save_data(params[:payload]) if sensor && params[:payload]\n\n head :ok # return empty 200 response\n end",
"def test_review_page__permalink_synonym\r\n permanent_redirect_test '/Ear-Force-X2-Wireless-Headphones-synonym-review-a1b2',\r\n '/Ear-Force-X2-Wireless-Headphones-for-Xbox-review-a1b2'\r\n end",
"def word_params\n params.require(:word).permit(:palavra1, :palavra2)\n end",
"def create\n @verse = Verse.new(params[:verse])\n\n respond_to do |format|\n if @verse.save\n format.html { redirect_to @verse, notice: 'Verse was successfully created.' }\n format.json { render json: @verse, status: :created, location: @verse }\n else\n format.html { render action: \"new\" }\n format.json { render json: @verse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @verse = Verse.new(params[:verse])\n\n respond_to do |format|\n if @verse.save\n format.html { redirect_to @verse, notice: 'Verse was successfully created.' }\n format.json { render json: @verse, status: :created, location: @verse }\n else\n format.html { render action: \"new\" }\n format.json { render json: @verse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ontology = Ontology.new(ontology_params)\n\n respond_to do |format|\n if @ontology.save\n format.html { redirect_to @ontology, notice: 'Ontology was successfully created.' }\n format.json { render :show, status: :created, location: @ontology }\n else\n format.html { render :new }\n format.json { render json: @ontology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @irregular_verb = IrregularVerb.new(params[:irregular_verb])\n\n respond_to do |format|\n if @irregular_verb.save\n format.html { redirect_to @irregular_verb, notice: 'Irregular verb was successfully created.' }\n format.json { render json: @irregular_verb, status: :created, location: @irregular_verb }\n else\n format.html { render action: \"new\" }\n format.json { render json: @irregular_verb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_lesson_word_synonym\n begin\n @course = Course.find(params[:course_id])\n @lesson = Lesson.find(params[:lesson_id])\n @lesson_word_synonym = LessonWordSynonym.find_by!(synonym_id: params[:synonym_id], lesson_word_id: params[:lesson_word_id])\n end\n end",
"def create\n @ontology = SYMPH::Ontology.save(params[:ontology])\n \n respond_to do |format|\n if @ontology\n flash[:notice] = 'Ontology was successfully created.'\n else\n flash[:notice] = 'Failed on create ontology.'\n end\n format.html { redirect_to :action => :edit, :id => @ontology }\n format.xml { render :xml => @ontology, :status => :created, :location => @ontology }\n end\n end",
"def index\n\t\trespond_with( {:error => 'You must provide a word.' }, :status => 422 ) # http 422 is unprocessible entity / malformed request\n\tend",
"def word_params\n params.require(:word).permit(:text, :meanings_attributes => [:id, :text, :word_id, :category_id, :_destroy], :synonymous_attributes => [:id, :word_2_id, :_destroy])\n end",
"def create\n @verb = Verb.new(verb_params)\n\n if @verb.save\n render json: @verb, status: :created, location: @verb\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def set_syndic\n @syndic = Syndic.find(params[:id])\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to root_path, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n \n parameters = {\n headers: {\n \"Accept\": \"application/json\",\n \"app_id\": \"#{ENV['oed_app_id']}\",\n \"app_key\": \"#{ENV['oed_app_key']}\",\n }\n }\n \n # response = HTTParty.get(\"https://od-api.oxforddictionaries.com:443/api/v1/entries/en/#{params[:word]}\", parameters)\n \n \n # @definition = response['results'][0]['lexicalEntries'][0]['entries'][0]['senses'][0]['definitions'][0]\n\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ref_sanatorium = Ref::Sanatorium.new(params[:ref_sanatorium])\n\n respond_to do |format|\n if @ref_sanatorium.save\n format.html { redirect_to ref_sanatoria_path, notice: I18n.t(:record_created) }\n format.json { render json: @ref_sanatorium, status: :created, location: @ref_sanatorium }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ref_sanatorium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def batch_synonyms(synonyms, forward_to_replicas = false, replace_existing_synonyms = false, request_options = {})\n client.post(\"#{Protocol.batch_synonyms_uri(name)}?forwardToReplicas=#{forward_to_replicas}&replaceExistingSynonyms=#{replace_existing_synonyms}\", synonyms.to_json, :batch, request_options)\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def validateword\n # read lines from text file\n lines = []\n File.open( \"dictionary.txt\" ) do |io|\n io.each {|line| line.chomp! ; lines << line}\n end\n response = []\n # make a binary search as array is sorted \n json_params = request[:body][:word]\n print request[:body].class\n isValid = binary_search(json_params,lines)\n if isValid\n response = {isValid:true,message:'is a valid word'}\n else\n response = {isValid:false,message:'is not a valid word'}\n end\n render json:response;\n end",
"def follow_artist\n relationship = Relationship.create(params.require(:relationship).permit(:follower_id, :followed_id))\n render json: relationship\n end",
"def destroy\n @syndic.destroy\n respond_to do |format|\n format.html { redirect_to syndics_url, notice: \"Syndic was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def test_send_string_in_form_with_r_n2()\n # Parameters for the API call\n body = TestRNstringEncoding.from_hash(APIHelper.json_deserialize(\n '{\"name\":\"farhan\",\"field\":\"QA&Dev\"}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.send_string_in_form_with_r_n(body)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def create\n if params[:format]==nil\n user=current_user\n else\n user= current_user\n deny_access if user.nil?\n end\n if params[:word].nil?\n return\n end\n userid = params[:user_id]\n single_word = params[:word][:word].strip()\n old_word = Word.find_by_word_and_user_id(single_word, userid)\n if old_word==nil\n @word = Word.create({:word=>single_word, :user_id => userid})\n @word.translate!\n operation_success=@word.save\n @word.add_tag_by_name('unfamiliar')\n else\n @word = old_word\n operation_success=@word.update_attribute(:updated_at, Time.now)\n @word.save\n end\n\n if operation_success\n respond_to do |format|\n format.json { render :json => @word, :status => :created }\n format.html { redirect_to(user_path(@word.user).to_s) }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_synonym!(objectID, synonym, forward_to_replicas = false, request_options = {})\n res = save_synonym(objectID, synonym, forward_to_replicas, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n res\n end",
"def tokenize\n post(\"token\")[\"token\"]\n end",
"def raw_post; end",
"def create\n @prepared_spell = PreparedSpell.new(prepared_spell_params)\n\n respond_to do |format|\n if @prepared_spell.save\n format.html { redirect_to @prepared_spell, notice: 'Prepared spell was successfully created.' }\n format.json { render :show, status: :created, location: @prepared_spell }\n else\n format.html { render :new }\n format.json { render json: @prepared_spell.errors, status: :unprocessable_entity }\n end\n end\n end",
"def data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end",
"def create\n @studnet = Studnet.new(params[:studnet])\n\n respond_to do |format|\n if @studnet.save\n format.html { redirect_to @studnet, notice: 'Studnet was successfully created.' }\n format.json { render json: @studnet, status: :created, location: @studnet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @studnet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_tparses (enju_accessor, sentence)\n raise \"An instance of RestClient::Resource has to be passed for the first argument.\" unless enju_accessor.instance_of? RestClient::Resource\n\n response = enju_accessor.get :params => {:sentence=>@sentence, :format=>'conll'}\n case response.code\n when 200 # 200 means success\n raise \"Empty input.\" if response =~/^Empty line/\n\n @tparses = []\n\n # response is a parsing result in CONLL format.\n response.split(/\\r?\\n/).each_with_index do |t, i| # for each token analysis\n dat = t.split(/\\t/, 7)\n tparse = Hash.new\n tparse[:idx] = i - 1 # use 0-oriented index\n tparse[:word] = dat[1]\n tparse[:base] = dat[2]\n tparse[:pos] = dat[3]\n tparse[:cat] = dat[4]\n tparse[:type] = dat[5]\n tparse[:args] = dat[6].split.collect{|a| type, ref = a.split(':'); [type, ref.to_i - 1]} if dat[6]\n @tparses << tparse # '<<' is push operation\n end\n\n @root = @tparses.shift[:args][0][1]\n\n # get span offsets\n i = 0\n @tparses.each do |p|\n i += 1 until sentence[i] !~ /[ \\t\\n]/\n p[:beg] = i\n p[:end] = i + p[:word].length\n i = p[:end]\n end\n else\n raise \"Enju CGI server dose not respond.\"\n end\n end"
] |
[
"0.656634",
"0.60592175",
"0.605054",
"0.5982213",
"0.5965555",
"0.58764756",
"0.5839133",
"0.5611199",
"0.5542197",
"0.549306",
"0.5409444",
"0.5406993",
"0.5356894",
"0.5338517",
"0.53040856",
"0.5303876",
"0.5290515",
"0.5289807",
"0.52886647",
"0.52757597",
"0.5252225",
"0.5243321",
"0.5231433",
"0.5214906",
"0.51950634",
"0.5188266",
"0.5154268",
"0.5145522",
"0.51222324",
"0.51219684",
"0.5099794",
"0.5089154",
"0.50404674",
"0.5023958",
"0.50233203",
"0.50082546",
"0.49808684",
"0.4885199",
"0.48754197",
"0.48741126",
"0.48739803",
"0.487303",
"0.48678237",
"0.4862484",
"0.48457825",
"0.48368484",
"0.4826095",
"0.4821473",
"0.48004714",
"0.4790894",
"0.47806206",
"0.47731984",
"0.47606215",
"0.475081",
"0.47504872",
"0.47441334",
"0.47415084",
"0.47358993",
"0.4720206",
"0.47133505",
"0.47077724",
"0.47075522",
"0.47051346",
"0.46995363",
"0.4695367",
"0.46945596",
"0.46911338",
"0.46788076",
"0.4673675",
"0.4673546",
"0.46658683",
"0.466423",
"0.466423",
"0.4660553",
"0.4658433",
"0.46433687",
"0.46419606",
"0.46417043",
"0.46347323",
"0.4630626",
"0.46247554",
"0.4624516",
"0.462313",
"0.46230337",
"0.46212384",
"0.46211988",
"0.46211988",
"0.46211445",
"0.46149457",
"0.46137798",
"0.46126854",
"0.46088985",
"0.46072292",
"0.46068743",
"0.46012342",
"0.45910057",
"0.4589483",
"0.458757",
"0.45852983",
"0.45848164"
] |
0.7169076
|
0
|
PATCH/PUT /syndromes/1 PATCH/PUT /syndromes/1.json
|
def update
respond_to do |format|
if @syndrome.update(syndrome_params)
format.html { redirect_to @syndrome, notice: 'Syndrome was successfully updated.' }
format.json { render :show, status: :ok, location: @syndrome }
else
format.html { render :edit }
format.json { render json: @syndrome.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @synonymprotein.update(synonymprotein_params)\n format.html { redirect_to @synonymprotein, notice: 'Synonymprotein was successfully updated.' }\n format.json { render :show, status: :ok, location: @synonymprotein }\n else\n format.html { render :edit }\n format.json { render json: @synonymprotein.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @syndic.update(syndic_params)\n format.html { redirect_to @syndic, notice: \"Syndic was successfully updated.\" }\n format.json { render :show, status: :ok, location: @syndic }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @syndic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @api_noun = Api::Noun.find(params[:id])\n\n respond_to do |format|\n if @api_noun.update_attributes(params[:api_noun])\n format.html { redirect_to @api_noun, notice: 'Noun was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_noun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n if @rayon.update_attributes(params[:rayon])\n format.html { redirect_to @rayon, notice: 'Rayon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rayon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @molecule_synonym.update(molecule_synonym_params)\n format.html { redirect_to @molecule_synonym, notice: 'Molecule synonym was successfully updated.' }\n format.json { render :show, status: :ok, location: @molecule_synonym }\n else\n format.html { render :edit }\n format.json { render json: @molecule_synonym.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end",
"def update\n @concept = Concept.find(params[:id])\n\n respond_to do |format|\n if @concept.update_attributes(params[:concept])\n format.html { redirect_to @concept, notice: 'Concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concept.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @concept = Concept.find(params[:id])\n\n respond_to do |format|\n if @concept.update_attributes(params[:concept])\n format.html { redirect_to @concept, notice: 'Concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concept.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @remodelings = args[:remodelings] if args.key?(:remodelings)\n @single_token = args[:single_token] if args.key?(:single_token)\n end",
"def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @noun.update(noun_params)\n format.html { redirect_to @noun, notice: 'Noun was successfully updated.' }\n format.json { render :show, status: :ok, location: @noun }\n else\n format.html { render :edit }\n format.json { render json: @noun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\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 respond_to do |format|\n if @ontology.update(ontology_params)\n format.html { redirect_to @ontology, notice: 'Ontology was successfully updated.' }\n format.json { render :show, status: :ok, location: @ontology }\n else\n format.html { render :edit }\n format.json { render json: @ontology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n respond_to_update({thing: @author})\n end",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n\n if @word.update_attributes(params[:word])\n format.json { head :no_content }\n else\n format.json { render :json => @word.errors,\n :status => :unprocessable_entity }\n end\n\n end\n end",
"def update\n @conceptual_entity = ConceptualEntity.find(params[:id])\n\n respond_to do |format|\n if @conceptual_entity.update_attributes(params[:conceptual_entity])\n format.html { redirect_to @conceptual_entity, notice: 'Conceptual entity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conceptual_entity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to things_path, notice: 'Your thing was successfully updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @hydrometer.update(hydrometer_params)\n format.html { redirect_to @hydrometer, notice: 'Hydrometer was successfully updated.' }\n format.json { render :show, status: :ok, location: @hydrometer }\n else\n format.html { render :edit }\n format.json { render json: @hydrometer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n @mistake = Mistake.find(params[:id])\n\n respond_to do |format|\n if @mistake.update_attributes(params[:mistake])\n format.html { redirect_to @mistake, notice: 'Mistake was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mistake.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n if @go_slim.update_attributes(params[:go_slim])\n format.html { redirect_to @go_slim, notice: 'Go slim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_slim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def update!(**args)\n @synonyms = args[:synonyms] if args.key?(:synonyms)\n @value = args[:value] if args.key?(:value)\n end",
"def update!(**args)\n @synonyms = args[:synonyms] if args.key?(:synonyms)\n @value = args[:value] if args.key?(:value)\n end",
"def update\n respond_to do |format|\n if @verb.update(verb_params)\n format.html { redirect_to @verb, notice: 'Verb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_syndrome\n @syndrome = Syndrome.find(params[:id])\n end",
"def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end",
"def update\n @stone = Stone.find(params[:id])\n\n respond_to do |format|\n if @stone.update_attributes(params[:stone])\n format.html { redirect_to @stone, notice: 'Stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @irregular_verb = IrregularVerb.find(params[:id])\n\n respond_to do |format|\n if @irregular_verb.update_attributes(params[:irregular_verb])\n format.html { redirect_to @irregular_verb, notice: 'Irregular verb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @irregular_verb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plate = Plate.find(params[:id])\n\n if @plate.update(params[:plate])\n head :no_content\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @key = args[:key] if args.key?(:key)\n @synonyms = args[:synonyms] if args.key?(:synonyms)\n end",
"def update!(**args)\n @key = args[:key] if args.key?(:key)\n @synonyms = args[:synonyms] if args.key?(:synonyms)\n end",
"def update\n authorize! :update, @theorem\n if @theorem.update(theorem_params)\n render json: @theorem, status: :ok, location: @theorem\n else\n render json: @theorem.errors, status: :unprocessable_entity\n end\n end",
"def update\n @symptom = Symptom.find(params[:id])\n\n if @symptom.update(symptom_params)\n render json: @symptom, status: :updated\n else\n render json: @symptom.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @concept.update(concept_params)\n format.html { redirect_to @concept, notice: 'Concept was successfully updated.' }\n format.json { render :show, status: :ok, location: @concept }\n else\n format.html { render :edit }\n format.json { render json: @concept.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pony = Pony.find(params[:id])\n\n respond_to do |format|\n if @pony.update_attributes(params[:pony])\n format.html { redirect_to @pony, notice: 'Pony was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pony.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @goody = Goody.find(params[:id])\n\n respond_to do |format|\n if @goody.update_attributes(params[:goody])\n format.html { redirect_to @goody, notice: 'Goody was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goody.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stuck.update(stuck_params)\n format.html { redirect_to @stuck, notice: 'Stuck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stuck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stable = Stable.find(params[:id])\n\n respond_to do |format|\n if @stable.update_attributes(params[:stable])\n format.html { redirect_to @stable, notice: 'Stable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @thought = Thought.find(params[:id])\n\n respond_to do |format|\n if @thought.update_attributes(params[:thought])\n format.html { redirect_to @thought, notice: 'Thought was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thought.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @interesting_thing.update(interesting_thing_params)\n format.html { redirect_to student_interesting_things_path(@student), notice: 'Interesting thing was successfully updated.' }\n format.json { render :show, status: :ok, location: @interesting_thing }\n else\n format.html { render :edit }\n format.json { render json: @interesting_thing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bottle.update(bottle_params)\n format.html { redirect_to user_path(current_user.id), notice: 'Bottle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bottle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end",
"def update\n @verse = Verse.find(params[:id])\n\n @song = @verse.song.id\n\n respond_to do |format|\n if @verse.update_attributes(params[:verse])\n format.html { redirect_to song_url(@song), notice: 'Verse was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @verse.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 respond_to do |format|\n if @standardkind.update(standardkind_params)\n format.html { redirect_to @standardkind, notice: 'Standardkind was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @standardkind.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @srticle.update(srticle_params)\n format.html { redirect_to @srticle, notice: 'Srticle was successfully updated.' }\n format.json { render :show, status: :ok, location: @srticle }\n else\n format.html { render :edit }\n format.json { render json: @srticle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n logger.info('PUT Update:')\n logger.info(request_body)\n new_pub = hashed_request\n old_pub = Publication.find_by(id: params[:id])\n if old_pub.blank?\n head :not_found\n return\n elsif old_pub.deleted?\n head :gone\n return\n end\n if old_pub.harvested_pub? # only manually entered (i.e. non-harvested) publications may be updated with this method\n render json: {\n error: \"This record SulPubID #{old_pub.id} may not be modified. If you had originally entered details for the record, \" \\\n 'it has been superceded by a central record.'\n },\n status: :forbidden, format: 'json'\n return\n elsif !validate_or_create_authors(new_pub[:authorship])\n render json: { error: 'You have not supplied a valid authorship record.' }, status: :not_acceptable,\n format: 'json'\n return\n end\n logger.info(\"Update manual publication #{old_pub.inspect} with BibJSON:\")\n logger.info(request_body)\n old_pub.update_manual_pub_from_pub_hash(new_pub, request_body)\n old_pub.save!\n old_pub.reload\n logger.debug(\"resulting pub hash: #{old_pub.pub_hash}\")\n render json: old_pub.pub_hash, status: :accepted\n end",
"def update\n respond_to do |format|\n if @atom.update_attributes(params[:atom])\n format.html { redirect_to @atom, notice: 'Atom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @atom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @ontology.update(ontology_params)\n\t\t\t\tformat.html { redirect_to @ontology, notice: 'Ontology was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.json { render json: @ontology.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end",
"def update\n @go_slim_sequence = GoSlimSequence.find(params[:id])\n\n respond_to do |format|\n if @go_slim_sequence.update_attributes(params[:go_slim_sequence])\n format.html { redirect_to @go_slim_sequence, notice: 'Go slim sequence was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_slim_sequence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n format.html { redirect_to @event, :notices => ['Hack was successfully updated.'] }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @hack.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end",
"def update\n # respond_to do |format|\n # if @thing.update(thing_params)\n # format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n # format.json { render :show, status: :ok, location: @thing }\n # else\n # format.html { render :edit }\n # format.json { render json: @thing.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update\n respond_to do |format|\n if @kota_stone.update(kota_stone_params)\n format.html { redirect_to kota_stones_url, notice: 'Kota stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kota_stone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trenton = Trenton.first\n\n respond_to do |format|\n if @trenton.update_attributes(params[:trenton])\n format.html { redirect_to about_path, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trenton.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @strain = Strain.find(params[:id])\n\n respond_to do |format|\n if @strain.update_attributes(params[:strain])\n format.html { redirect_to @strain, :notice => 'Strain was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @strain.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.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 @ruby = Ruby.find(params[:id])\n\n respond_to do |format|\n if @ruby.update_attributes(params[:ruby])\n format.html { redirect_to @ruby, notice: 'Ruby was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ruby.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @familiar = Familiar.find(params[:id])\n\n respond_to do |format|\n if @familiar.update_attributes(params[:familiar])\n format.html { redirect_to @familiar, notice: 'Familiar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @familiar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n head :ok\n end",
"def update\n @animal.update(animal_params)\n respond_with(@shelter)\n end",
"def update\n @noun = Noun.find(params[:id])\n\n respond_to do |format|\n if @noun.update_attributes(params[:noun])\n format.html { redirect_to(@noun, :notice => 'Noun was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @noun.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @serach_word = SerachWord.find(params[:id])\n\n respond_to do |format|\n if @serach_word.update_attributes(params[:serach_word])\n format.html { redirect_to @serach_word, notice: 'Serach word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serach_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @serving.update(serving_params)\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { render :show, status: :ok, location: @serving }\n else\n format.html { render :edit }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n if @tags_of_novel.update_attributes(params[:tags_of_novel])\n format.html { redirect_to @tags_of_novel, notice: 'Tags of novel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tags_of_novel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person.update_attributes(params[:person])\n respond_with(@person)\n end",
"def update\n @monkey = Monkey.find(params[:id])\n\n respond_to do |format|\n if @monkey.update_attributes(params[:monkey])\n format.html { redirect_to @monkey, notice: 'Monkey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monkey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @physician.update(survey_params)\n head :no_content\n else\n render json: @physician.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end",
"def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end",
"def update\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n if @verse.update_attributes(params[:verse])\n format.html { redirect_to @verse, notice: 'Verse was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @verse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n if @verse.update_attributes(params[:verse])\n format.html { redirect_to @verse, notice: 'Verse was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @verse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shorty = Shorty.find(params[:id])\n\n respond_to do |format|\n if @shorty.update_attributes(params[:shorty])\n format.html { redirect_to @shorty, notice: 'Shorty was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shorty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @analyst = Analyst.find(params[:id])\n\n if @analyst.update(params[:analyst])\n head :no_content\n else\n render json: @analyst.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @kristine_toy.update(kristine_toy_params)\n format.html { redirect_to @kristine_toy, notice: 'Kristine toy was successfully updated.' }\n format.json { render :show, status: :ok, location: @kristine_toy }\n else\n format.html { render :edit }\n format.json { render json: @kristine_toy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n end",
"def update\n @simthing = Simthing.find(params[:id])\n\n respond_to do |format|\n if @simthing.update_attributes(params[:simthing])\n flash[:notice] = 'Simthing was successfully updated.'\n format.html { redirect_to(@simthing) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @simthing.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @thirtyone.update(thirtyone_params)\n format.html { redirect_to @thirtyone, notice: 'Thirtyone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thirtyone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trick = Trick.find(params[:id])\n\n respond_to do |format|\n if @trick.update_attributes(params[:trick])\n format.html { redirect_to @trick, notice: 'Trick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @bottle = Bottle.find(params[:id])\n\n respond_to do |format|\n if @bottle.update_attributes(params[:bottle])\n format.html { redirect_to(@bottle, :notice => 'Bottle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bottle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @story.update(story_params)\n format.json { render json: @story, root: false, status: :ok, location: @story }\n else\n format.json { render json: @story.errors, root: false, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @net_rack.update(net_rack_params)\n format.html { redirect_to @net_rack, notice: 'Net rack was successfully updated.' }\n format.json { render :show, status: :ok, location: @net_rack }\n else\n format.html { render :edit }\n format.json { render json: @net_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n @slitter = Slitter.find(params[:id])\n\n respond_to do |format|\n if @slitter.update_attributes(params[:slitter])\n format.html { redirect_to @slitter, notice: 'Slitter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slitter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @squire.update(squire_params)\n format.html { redirect_to @squire, notice: 'Squire was successfully updated.' }\n format.json { render :show, status: :ok, location: @squire }\n else\n format.html { render :edit }\n format.json { render json: @squire.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6044321",
"0.5980634",
"0.59310615",
"0.58973354",
"0.58475137",
"0.5774499",
"0.57632846",
"0.57520026",
"0.57478845",
"0.5709029",
"0.568328",
"0.56721574",
"0.56721574",
"0.5634188",
"0.56287706",
"0.5614691",
"0.5603879",
"0.560066",
"0.55834323",
"0.5576043",
"0.55749494",
"0.5562419",
"0.55440325",
"0.554246",
"0.55378705",
"0.55358094",
"0.5516355",
"0.5515775",
"0.55084777",
"0.5506143",
"0.550244",
"0.550244",
"0.55005807",
"0.5497422",
"0.5496373",
"0.5490172",
"0.5489488",
"0.54866874",
"0.5486024",
"0.54806805",
"0.5479616",
"0.54747295",
"0.547435",
"0.5473789",
"0.5462877",
"0.54619294",
"0.5461221",
"0.54603285",
"0.5457965",
"0.5456194",
"0.545547",
"0.54532665",
"0.5451127",
"0.5437681",
"0.5434753",
"0.5433577",
"0.5430979",
"0.5428125",
"0.5422273",
"0.54208773",
"0.5416197",
"0.54153323",
"0.5409917",
"0.54095644",
"0.5408795",
"0.5406789",
"0.53971136",
"0.5392785",
"0.5392239",
"0.53912586",
"0.53877074",
"0.5387689",
"0.5382711",
"0.5378582",
"0.53783315",
"0.53776777",
"0.5377617",
"0.5372451",
"0.53704745",
"0.53664434",
"0.5366251",
"0.53642434",
"0.5362202",
"0.5361905",
"0.5360324",
"0.5360324",
"0.5360228",
"0.53598785",
"0.5358614",
"0.535696",
"0.53512377",
"0.53476703",
"0.53472114",
"0.53404444",
"0.5337024",
"0.5334994",
"0.53343874",
"0.5333323",
"0.5332834",
"0.53309625"
] |
0.68181163
|
0
|
DELETE /syndromes/1 DELETE /syndromes/1.json
|
def destroy
@syndrome.destroy
respond_to do |format|
format.html { redirect_to syndromes_url, notice: 'Syndrome was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @syndic.destroy\n respond_to do |format|\n format.html { redirect_to syndics_url, notice: \"Syndic was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @synonymprotein.destroy\n respond_to do |format|\n format.html { redirect_to synonymproteins_url, notice: 'Synonymprotein was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @noun.destroy\n\n respond_to do |format|\n format.html { redirect_to nouns_url }\n # format.json { head :no_content }\n end\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @api_noun = Api::Noun.find(params[:id])\n @api_noun.destroy\n\n respond_to do |format|\n format.html { redirect_to api_nouns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @molecule_synonym.destroy\n respond_to do |format|\n format.html { redirect_to molecule_synonyms_url, notice: 'Molecule synonym was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n\n @synonymous = Synonymou.all\n\n @synonymous.each do |synonymou|\n if synonymou.word_id==@word.id\n synonymou.destroy\n elsif synonymou.word_2_id==@word.id\n synonymou.destroy\n end\n end\n\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url, notice: 'Word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @moonwalk.destroy\n respond_to do |format|\n format.html { redirect_to moonwalks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @noun.destroy\n respond_to do |format|\n format.html { redirect_to nouns_url, notice: 'Noun was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @serach_word = SerachWord.find(params[:id])\n @serach_word.destroy\n\n respond_to do |format|\n format.html { redirect_to serach_words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mistake = Mistake.find(params[:id])\n @mistake.destroy\n\n respond_to do |format|\n format.html { redirect_to mistakes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @noun = Noun.find(params[:id])\n @noun.destroy\n\n respond_to do |format|\n format.html { redirect_to(nouns_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cord.destroy\n respond_to do |format|\n format.html { redirect_to cords_url, notice: t('cords.destroy.success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rayon = Rayon.find(params[:id])\n @rayon.destroy\n\n respond_to do |format|\n format.html { redirect_to rayons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spelling_test.destroy\n respond_to do |format|\n format.html { redirect_to spelling_tests_url, notice: 'Spelling test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @verse = Verse.find(params[:id])\n @verse.destroy\n\n respond_to do |format|\n format.html { redirect_to verses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @verse = Verse.find(params[:id])\n @verse.destroy\n\n respond_to do |format|\n format.html { redirect_to verses_url }\n format.json { head :no_content }\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def delete_pathway\n pathway = Pathway.find(params[:pathway_par])\n current_user.pathways.delete(pathway)\n if current_user.pathways.size < 1\n respond_to do |format|\n format.html { redirect_to '/saved#pathways' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @walk = Walk.find(params[:id])\n @walk.destroy\n\n respond_to do |format|\n format.html { redirect_to walks_url }\n format.json { head :no_content }\n end\n end",
"def delete_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by_id(params[:pathway_id])\n suggested_pathway.destroy\n render json: suggested_pathway\n end",
"def destroy\n @ruby = Ruby.find(params[:id])\n @ruby.destroy\n\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @verse = Verse.find(params[:id])\n @verse.destroy\n\n respond_to do |format|\n format.html { redirect_to :controller => 'songs', :action => 'show', :id => params[:song_id] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sentence = Sentence.find(params[:id])\n @sentence.destroy\n\n respond_to do |format|\n format.html { redirect_to sentences_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @urlshortner.destroy\n respond_to do |format|\n format.html { redirect_to urlshortners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subway = Subway.find(params[:id])\n @subway.destroy\n\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @verb.destroy\n respond_to do |format|\n format.html { redirect_to verbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stanza = Stanza.find_by_no(params[:id])\n @stanza.destroy\n\n respond_to do |format|\n format.html { redirect_to stanzas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @reminder_phrase = ReminderPhrase.find(params[:id])\n @reminder_phrase.destroy\n\n respond_to do |format|\n format.html { redirect_to reminder_phrases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tantosha.destroy\n # @tantosha.delete\n respond_to do |format|\n format.html { redirect_to tantoshas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n word = @meaning.word\n @meaning.destroy\n\n respond_to do |format|\n format.html { redirect_to word }\n format.json { head :no_content }\n end\n end",
"def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @headline.destroy\n respond_to do |format|\n format.html { redirect_to headlines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @headline.destroy\n respond_to do |format|\n format.html { redirect_to headlines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @verb.destroy\n\n head :no_content\n end",
"def destroy\n @lyric.destroy\n respond_to do |format|\n format.html { redirect_to lyrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @railway = Railway.find(params[:id])\n @railway.destroy\n\n respond_to do |format|\n format.html { redirect_to railways_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thirtythree.destroy\n respond_to do |format|\n format.html { redirect_to thirtythrees_url }\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 @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @simthing = Simthing.find(params[:id])\n @simthing.destroy\n\n respond_to do |format|\n format.html { redirect_to(simthings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @jedi = Jedi.find(params[:id])\n @jedi.destroy\n\n respond_to do |format|\n format.html { redirect_to jedis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ontology.destroy\n respond_to do |format|\n format.html { redirect_to ontologies_url, notice: 'Ontology was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stance.destroy\n respond_to do |format|\n format.html { redirect_to stances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stance.destroy\n respond_to do |format|\n format.html { redirect_to stances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @irregular_verb = IrregularVerb.find(params[:id])\n @irregular_verb.destroy\n\n respond_to do |format|\n format.html { redirect_to irregular_verbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ninja = Ninja.find(params[:id])\n @ninja.destroy\n\n respond_to do |format|\n format.html { redirect_to ninjas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lsa_test_word = LsaTestWord.find(params[:id])\n @lsa_test_word.destroy\n\n respond_to do |format|\n format.html { redirect_to lsa_test_words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @thought.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Thought was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unique_whiteline.destroy\n respond_to do |format|\n format.html { redirect_to unique_whitelines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @three.destroy\n respond_to do |format|\n format.html { redirect_to threes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dart = Dart.find(params[:id])\n @dart.destroy\n\n respond_to do |format|\n format.html { redirect_to darts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orphan.destroy\n respond_to do |format|\n format.html { redirect_to orphans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end",
"def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end",
"def destroy\n @uriy.destroy\n respond_to do |format|\n format.html { redirect_to uriys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @intake.destroy\n respond_to do |format|\n format.html { redirect_to intakes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @same.destroy\n respond_to do |format|\n format.html { redirect_to sames_url, notice: 'Same was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thirtyone.destroy\n respond_to do |format|\n format.html { redirect_to thirtyones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n check_access\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mostsmallroad = Mostsmallroad.find(params[:id])\n @mostsmallroad.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallroads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thing_to_do.destroy\n respond_to do |format|\n format.html { redirect_to thing_to_dos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @study = Study.find(params[:id])\n @study.destroy\n\n respond_to do |format|\n format.html { redirect_to studies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @research = Research.find(params[:id])\n @research.destroy\n\n respond_to do |format|\n format.html { redirect_to researches_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @asthenium.destroy\n respond_to do |format|\n format.html { redirect_to asthenia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @short_url.destroy\n render json: { status: \"Deleted\" }\n else\n render json: { head: \"no content\" }\n end \n end",
"def destroy\n @chronicle.destroy\n respond_to do |format|\n format.html { redirect_to chronicles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thesis.destroy\n respond_to do |format|\n format.html { redirect_to theses_url }\n format.json { head :no_content }\n end\n end",
"def deleteCategorySynonym( category_id, synonym, language)\n params = Hash.new\n params['category_id'] = category_id\n params['synonym'] = synonym\n params['language'] = language\n return doCurl(\"delete\",\"/category/synonym\",params)\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def destroy\n @thirtytwo.destroy\n respond_to do |format|\n format.html { redirect_to thirtytwos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expectation_stem = RiGse::ExpectationStem.find(params[:id])\n @expectation_stem.destroy\n\n respond_to do |format|\n format.html { redirect_to(expectation_stems_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ref_sanatorium = Ref::Sanatorium.find(params[:id])\n @ref_sanatorium.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_sanatoria_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @side_walk.destroy\n respond_to do |format|\n format.html { redirect_to side_walks_url, notice: 'Side walk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thought = Thought.find(params[:id])\n @quast = @thought.quastion\n @thought.destroy\n\n respond_to do |format|\n format.html { redirect_to quastion_path(@quast) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @yourstory = Yourstory.find(params[:id])\n @yourstory.destroy\n\n respond_to do |format|\n format.html { redirect_to yourstories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medium_road = MediumRoad.find(params[:id])\n @medium_road.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_roads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @botanist.destroy\n respond_to do |format|\n format.html { redirect_to botanists_url, notice: 'Botanist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word_praat.destroy\n respond_to do |format|\n format.html { redirect_to word_praats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @c_rodinny_stav.destroy\n respond_to do |format|\n format.html { redirect_to c_rodinny_stavs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @concept = Concept.find(params[:id])\n @concept.destroy\n\n respond_to do |format|\n format.html { redirect_to concepts_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.667361",
"0.6666594",
"0.6501036",
"0.64855397",
"0.6410822",
"0.6407785",
"0.6386162",
"0.6375737",
"0.6356847",
"0.6356513",
"0.6336847",
"0.6324983",
"0.63224137",
"0.63047963",
"0.6302607",
"0.6291801",
"0.62760407",
"0.6269153",
"0.6264207",
"0.626374",
"0.6256768",
"0.625299",
"0.62478304",
"0.62303436",
"0.6228547",
"0.6227814",
"0.6227814",
"0.6224076",
"0.62191707",
"0.62185174",
"0.6207515",
"0.62059104",
"0.6197991",
"0.61979336",
"0.61953056",
"0.6194078",
"0.619342",
"0.61906946",
"0.61906606",
"0.6167642",
"0.6165355",
"0.6165051",
"0.6160587",
"0.6160159",
"0.6160008",
"0.615777",
"0.615777",
"0.6157701",
"0.6154182",
"0.6153077",
"0.6153021",
"0.6151064",
"0.6150694",
"0.6147432",
"0.61463755",
"0.61315995",
"0.61197126",
"0.6117359",
"0.6112616",
"0.611194",
"0.611194",
"0.61091435",
"0.61040056",
"0.6101954",
"0.61012465",
"0.6099499",
"0.6091357",
"0.60896313",
"0.6089326",
"0.60887474",
"0.60866463",
"0.60839456",
"0.6083577",
"0.6082849",
"0.60826373",
"0.60822207",
"0.60788697",
"0.6075796",
"0.6075199",
"0.6071796",
"0.6069403",
"0.60689336",
"0.60649633",
"0.60631883",
"0.606229",
"0.60622865",
"0.60617095",
"0.6056379",
"0.6054168",
"0.60536367",
"0.6053342",
"0.6050929",
"0.6049313",
"0.60492647",
"0.60479295",
"0.6047076",
"0.60469687",
"0.6045054",
"0.60422695",
"0.6041023"
] |
0.7042794
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_syndrome
@syndrome = Syndrome.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 syndrome_params
params.require(:syndrome).permit(:name, :description, :position)
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
|
ok, that args is actually pointless, we can just do it like this
|
def puts_two_again(arg1, arg2)
puts "arg1: #{arg1}, arg2: #{arg2}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def args(*) end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def run(*args); end",
"def run(*args); end",
"def run(*args); end",
"def run(*args); end",
"def run(*args); end",
"def run(*args); end",
"def run(*args); end",
"def run(*args); end",
"def call(*args); end",
"def extra_args; end",
"def args()\n #This is a stub, used for indexing\n end",
"def arguments=(_arg0); end",
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def args() return @args end",
"def vest _args\n \"vest _args;\" \n end",
"def run(*args)\n end",
"def inflamed _args\n \"inflamed _args;\" \n end",
"def probers=(_arg0); end",
"def manage_args(*args)\n end",
"def perform(*args); end",
"def run(*args)\n end",
"def _perform(args); end",
"def args\n @args \n end",
"def deco_args; end",
"def standalone=(_arg0); end",
"def cmdarg=(_arg0); end",
"def cmdarg=(_arg0); end",
"def cmdarg=(_arg0); end",
"def validate_args (args)\n\t# todo\nend",
"def %(*args); end",
"def %(*args); end",
"def extra=(_arg0); end",
"def run(args = T.unsafe(nil)); end",
"def run(args = T.unsafe(nil)); end",
"def runs=(_arg0); end",
"def run(args)\n raise \"not implemented\"\n end",
"def pass=(_arg0); end",
"def transformed_argname; end",
"def subtrair(*args)\n end",
"def in_kwarg=(_arg0); end",
"def arg; end",
"def underwater _args\n \"underwater _args;\" \n end",
"def params=(_arg0); end",
"def params=(_arg0); end",
"def call(*args)\n __call__( args )\n end",
"def transformed_argname=(_); end",
"def PO114=(arg)",
"def wrapped_in=(_arg0); end",
"def returns=(_arg0); end",
"def PO104=(arg)",
"def ext=(_arg0); end",
"def ext=(_arg0); end",
"def ext=(_arg0); end",
"def argue(argument)\n argument\nend",
"def process(args)\n args\n end",
"def PO109=(arg)",
"def PO110=(arg)",
"def private _args\n \"private _args;\" \n end",
"def return_value=(_arg0); end",
"def always_run=(_arg0); end",
"def whiny=(_arg0); end",
"def called_from=(_arg0); end",
"def called_from=(_arg0); end",
"def application=(_arg0); end",
"def application=(_arg0); end",
"def parameters=(_arg0); end",
"def PO105=(arg)",
"def meth(\n\n\n\n *args)\n\nend",
"def isAbleToBreathe _args\n \"isAbleToBreathe _args;\" \n end",
"def in_kwarg; end",
"def postproc=(_arg0); end",
"def cmdarg; end",
"def cmdarg; end"
] |
[
"0.79374117",
"0.76918584",
"0.76918584",
"0.76918584",
"0.76918584",
"0.76918584",
"0.76918584",
"0.76918584",
"0.76918584",
"0.76918584",
"0.76918584",
"0.76918584",
"0.76918584",
"0.76918584",
"0.76918584",
"0.76918584",
"0.76918584",
"0.76918584",
"0.76918584",
"0.76918584",
"0.76918584",
"0.7554523",
"0.7554523",
"0.7554523",
"0.7554523",
"0.7554523",
"0.738886",
"0.738886",
"0.738886",
"0.738886",
"0.738886",
"0.738886",
"0.738886",
"0.738886",
"0.7281492",
"0.72724116",
"0.7187572",
"0.70955825",
"0.70928687",
"0.70928687",
"0.70928687",
"0.7031573",
"0.69852626",
"0.69503826",
"0.69248843",
"0.68983877",
"0.6864342",
"0.6843259",
"0.68069786",
"0.68035156",
"0.68004715",
"0.66533786",
"0.6638579",
"0.66241646",
"0.66241646",
"0.66241646",
"0.66228545",
"0.6617018",
"0.6617018",
"0.659866",
"0.6588532",
"0.6588532",
"0.65803105",
"0.65757716",
"0.6528248",
"0.6522296",
"0.6521808",
"0.64856786",
"0.64757043",
"0.64713997",
"0.6406297",
"0.6406297",
"0.63916516",
"0.6379197",
"0.6357286",
"0.63345957",
"0.6322492",
"0.63196635",
"0.6315392",
"0.6315392",
"0.6315392",
"0.6309804",
"0.630703",
"0.6298708",
"0.6294003",
"0.6285694",
"0.62784326",
"0.62580866",
"0.6257283",
"0.6254391",
"0.6254391",
"0.6253762",
"0.6253762",
"0.62422174",
"0.62281525",
"0.62214977",
"0.6219033",
"0.62133706",
"0.62067956",
"0.6197792",
"0.6197792"
] |
0.0
|
-1
|
this one takes one arguement
|
def puts_one(arg1)
puts "arg1: #{arg1}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def args(*) end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def param; end",
"def param; end",
"def arg; end",
"def probers=(_arg0); end",
"def parameters=(_arg0); end",
"def PO114=(arg)",
"def PO105=(arg)",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def PO104=(arg)",
"def PO115=(arg)",
"def PO109=(arg)",
"def in_kwarg; end",
"def params=(_arg0); end",
"def params=(_arg0); end",
"def argument?; end",
"def PO101=(arg)",
"def PO103=(arg)",
"def PO113=(arg)",
"def PO111=(arg)",
"def subtrair(*args)\n end",
"def PO110=(arg)",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def standalone=(_arg0); end",
"def argue(argument)\n argument\nend",
"def mech=(_arg0); end",
"def mech=(_arg0); end",
"def extra=(_arg0); end",
"def SE02=(arg)",
"def arguments=(_arg0); end",
"def PO102=(arg)",
"def PO108=(arg)",
"def in_kwarg=(_arg0); end",
"def whiny=(_arg0); end",
"def SE01=(arg)",
"def PRF02=(arg)",
"def ext=(_arg0); end",
"def ext=(_arg0); end",
"def ext=(_arg0); end",
"def call(*args); end",
"def extra_args; end",
"def SAC05=(arg)",
"def PO107=(arg)",
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def ITD07=(arg)",
"def pass=(_arg0); end",
"def agi; param(6); end",
"def PO112=(arg)",
"def SAC12=(arg)",
"def PO106=(arg)",
"def SAC02=(arg)",
"def ITD03=(arg)",
"def action args = {}\n\t\tend",
"def SAC07=(arg)",
"def suivre; end",
"def method(param1, options = {})\n\tend",
"def SAC06=(arg)",
"def PRF04=(arg)",
"def PRF01=(arg)",
"def AMT02=(arg)",
"def add_argument(arg); end",
"def add_argument(arg); end",
"def add_argument(arg); end",
"def quando_esteso(*args)\n end",
"def call; end"
] |
[
"0.692886",
"0.68909895",
"0.68909895",
"0.68909895",
"0.68909895",
"0.68909895",
"0.68909895",
"0.68909895",
"0.68909895",
"0.68909895",
"0.68909895",
"0.68909895",
"0.68909895",
"0.68909895",
"0.68909895",
"0.68909895",
"0.68909895",
"0.68909895",
"0.68909895",
"0.68909895",
"0.68909895",
"0.6849765",
"0.6849765",
"0.6849765",
"0.6817571",
"0.6817571",
"0.6737331",
"0.6469439",
"0.64647985",
"0.6455397",
"0.6441762",
"0.6429394",
"0.6429394",
"0.6429394",
"0.6429394",
"0.6429394",
"0.6426729",
"0.6417685",
"0.6379466",
"0.6372479",
"0.636864",
"0.636864",
"0.63676965",
"0.6365471",
"0.6360579",
"0.6359207",
"0.6351376",
"0.6334814",
"0.63237894",
"0.6314614",
"0.6314614",
"0.6314614",
"0.6314614",
"0.6314614",
"0.6314614",
"0.6314614",
"0.6314614",
"0.6294318",
"0.629275",
"0.62750673",
"0.62750673",
"0.62700576",
"0.6266343",
"0.62615585",
"0.6261507",
"0.62565887",
"0.62485677",
"0.6241869",
"0.62389386",
"0.62366235",
"0.62315375",
"0.62315375",
"0.62315375",
"0.62244153",
"0.62222373",
"0.62150663",
"0.6212866",
"0.61935145",
"0.61935145",
"0.61935145",
"0.61634326",
"0.6158366",
"0.61532503",
"0.6147171",
"0.6139288",
"0.61321855",
"0.61294985",
"0.6129219",
"0.6123821",
"0.6123712",
"0.61200607",
"0.6113999",
"0.6113171",
"0.61103594",
"0.6106772",
"0.60933614",
"0.6085595",
"0.6085595",
"0.6085595",
"0.608492",
"0.6082624"
] |
0.0
|
-1
|
this one takes no arguements
|
def puts_none()
puts "I got nothing."
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def probers=(_arg0); end",
"def standalone=(_arg0); end",
"def args(*) end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def whiny=(_arg0); end",
"def nothing(param1)\n end",
"def private; end",
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def extra=(_arg0); end",
"def params=(_arg0); end",
"def params=(_arg0); end",
"def parameters=(_arg0); end",
"def ignores; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def ext=(_arg0); end",
"def ext=(_arg0); end",
"def ext=(_arg0); end",
"def extra_args; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def arguments=(_arg0); end",
"def suivre; end",
"def pass=(_arg0); end",
"def autofinish=(_arg0); end",
"def isolated=(_arg0); end",
"def isolated=(_arg0); end",
"def initialize params = nil\n \n end",
"def param; end",
"def param; end",
"def in_kwarg=(_arg0); end",
"def arg; end",
"def nothing; end",
"def argument?; end",
"def returns=(_arg0); end",
"def always_run=(_arg0); end",
"def mech=(_arg0); end",
"def mech=(_arg0); end",
"def apply; nil; end",
"def custom; end",
"def custom; end",
"def skips=(_arg0); end",
"def application=(_arg0); end",
"def application=(_arg0); end",
"def nothing(p1=1,p2=2,p3=3)\nend",
"def runs=(_arg0); end",
"def base=(_arg0); end",
"def schubert; end",
"def optional; end",
"def params(*); {}; end",
"def return_value=(_arg0); end",
"def call(*) end",
"def call(*) end",
"def probers; end",
"def overload; end",
"def exclude=(_arg0); end",
"def checks=(_arg0); end",
"def call(*args); end",
"def none(data)\n end",
"def method(arg0)\n end",
"def method(arg0)\n end",
"def fallbacks=(_arg0); end",
"def processor=(_arg0); end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end"
] |
[
"0.6930524",
"0.69165355",
"0.6791324",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6773252",
"0.6744689",
"0.6744689",
"0.6744689",
"0.6744689",
"0.6744689",
"0.67267144",
"0.66618925",
"0.6637727",
"0.66243416",
"0.66243416",
"0.66243416",
"0.6561943",
"0.652484",
"0.652484",
"0.6508025",
"0.649476",
"0.64704555",
"0.64704555",
"0.64704555",
"0.64704555",
"0.64704555",
"0.64704555",
"0.64704555",
"0.64704555",
"0.6426027",
"0.6426027",
"0.6426027",
"0.6406199",
"0.6402594",
"0.6402594",
"0.6402594",
"0.6402594",
"0.63950247",
"0.6393181",
"0.63893396",
"0.63846844",
"0.638037",
"0.638037",
"0.63783264",
"0.6374363",
"0.6374363",
"0.6334373",
"0.63311315",
"0.63284993",
"0.6311479",
"0.6306027",
"0.6305863",
"0.6302319",
"0.6302319",
"0.62957525",
"0.62949497",
"0.62949497",
"0.6282805",
"0.62776124",
"0.62776124",
"0.6250423",
"0.6250232",
"0.62168133",
"0.62011445",
"0.61938626",
"0.61937225",
"0.6185951",
"0.6182795",
"0.6182795",
"0.6168451",
"0.615995",
"0.61524975",
"0.61422914",
"0.61386716",
"0.61348104",
"0.6133426",
"0.6133426",
"0.6130839",
"0.6130325",
"0.6125124",
"0.6125124",
"0.6125124",
"0.6125124"
] |
0.0
|
-1
|
Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Src: I'll have to look into optimizations for this one
|
def multi_array_median(*arrays)
combined = arrays.reduce(:concat).sort
combined[combined.length / 2]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def median_sorted_arrays_dc(arr1, arr2)\n size = arr1.size\n return -1 if size <= 0\n return (arr1.first+arr2.first)/2 if size == 1\n return ([arr1.first, arr2.first].max + [arr1[1], arr2[1]].min)/2 if size == 2\n pos_med1 = arr1.size/2\n pos_med2 = arr2.size/2\n # If both are equal even though we form a new array merging those two this would still be median of those two\n if arr1[pos_med1] == arr2[pos_med2]\n return arr1[pos_med1]\n elsif arr1[pos_med1] < arr2[pos_med2] # Median will be in right half of A1 and Left half of A2\n median_sorted_arrays_dc(arr1[pos_med1+1..arr1.size-1], arr2[0..pos_med2-1])\n else # Median will be in left half of A1 and right half of A2\n median_sorted_arrays_dc(arr1[0..pos_med1-1], arr2[pos_med2+1..arr2.size-1])\n end\nend",
"def find_median_sorted_arrays(nums1, nums2)\n # Find the left most nums in nums1 and nums2\n total = nums1.length + nums2.length\n half = total/2\n \n short, long = nums1, nums2\n \n if nums1.length > nums2.length\n short = nums2\n long = nums1\n end\n \n left, right = 0, short.length - 1\n \n if nums1.length > 0\n median = (0 + nums1.length) / 2\n nums2_leftmost = half - median\n while nums1[median] > nums2[nums2_leftmost + 1]\n median = (0 + nums1.length) / 2\n nums2_leftmost = left_most_values - median\n break if nums2_leftmost > nums2.length\n end\n end\n \n print median\n print nums2_leftmost\n \nend",
"def find_median(arr1, arr2)\n # determine index value of median element\n median_index = ((arr1.length + arr2.length) / 2.0).round\n \n stitched = []\n # merge in order until length of the merged and sorted array is enough to\n # calculate the median\n while arr1.length > 0 and arr2.length > 0 and stitched.length < median_index\n if arr1[0] <= arr2[0]\n stitched.push(arr1.shift)\n else\n stitched.push(arr2.shift)\n end\n end\n \n puts stitched\n # if the stitched array has an even number of elements, then we need to use the last two\n # otherwise just return the last element\n if stitched.length.even?\n return (stitched[-1] + stitched[-2]) / 2.0\n else\n return stitched[-1]\n end\nend",
"def median_sorted_arrays(array1, array2)\n result = []\n median_pos = (array1.size + array2.size)/2\n until array1.empty? || array2.empty?\n if array1.first < array2.first\n result << array1.first\n array1.shift\n else\n result << array2.first\n array2.shift\n end\n end\n result = result + array1 + array2\n return result[median_pos]\nend",
"def median\n sorted = @array.sort\n middle = ((@array.size + 1.0) / 2) - 1 # subscript of middle element of array, with .5 if there are two middle values\n if middle.floor == middle # middle is an integer\n sorted[middle]\n else\n (sorted[middle.floor] + sorted[middle.ceil]) / 2.0\n end\n end",
"def calculate_median(arr)\n arr.sort[arr.length / 2]\nend",
"def median(array)\n\tif array.include?(Integer)\n\treturn array.inject{|memo, i| memo + i} / array.size\nelse \n return array.sort_by{|x| x}.mid\nend\nend",
"def median_double(i = 0, j = self.size - 1, n1, n2)\n mi1, mi2 = self.index_of_sorted_median(i, j)\n m1, m2 = self[mi1], self[mi2]\n l = j - i + 1 \n if l.even?\n m1_prev = self.prev(mi1)\n m2_next = self.next(mi2)\n case\n when n2 <= m1\n [[n2, m1_prev].compact.max, m1]\n when m1 <= n1 && n2 <= m2\n [n1, n2]\n when n1 <= m1 && m1 <= n2 && n2 <= m2\n [m1, n2]\n when m1 <= n1 && n1 <= m2 && m2 <= n2\n [n1, m2]\n when n1 <= m1 && m2 <= n2\n [m1, m2]\n when m2 <= n1\n [m2, [n1, m2_next].compact.min]\n end\n else\n m, mi = m1, mi1\n m_prev = self.prev(mi)\n m_next = self.next(mi)\n case\n when n1 <= m && m <= n2\n [m, m]\n when n2 <= m\n [[m_prev, n2].compact.max] * 2\n when m <= n1\n [[m_next, n1].compact.min] * 2\n end\n end.reduce(0, &:+) / 2.0\n end",
"def median (an_array)\n an_array.sort!\n nums = an_array.length\n\n if nums % 2 != 0\n return an_array[nums / 2]\n else\n return (an_array[nums/2]+an_array[(nums/2)-1])/2.0\n end\nend",
"def median(array)\n sorted = array.sort\n return sorted[array.length / 2 - 1] if array.length.odd?\n p = array.length / 2 - 1\n Float(mean([sorted[p], sorted[p + 1]]))\nend",
"def median(array)\n sort_array = array.sort\n length = sort_array.length\n \n return(sort_array[(length-1)/2] + sort_array[length/2])/2.0\nend",
"def median(array)\n sorted = array.sort\n\n if array.length % 2 != 0\n array[array.length/2]\n else \n ((array[array.length/2] - array[(array.length/2)-2]).to_f / 2) + array[(array.length/2)-2]\n end\nend",
"def median(array)\n\tsorted = array.sort\n\tlength = array.length\n\tmiddle = sorted[length/2]\n\n\tif length.odd?\n\t\tmiddle\n\telse\n\t\t(middle + (middle - 1))/2.0\n\tend\nend",
"def median(numbers)\n\trange = numbers.sort!\n\tlength = range.length\n\tif length % 2 == 1\n\t\tmiddle = length/2\n\telsif length % 2 == 0\n\t\tmiddle = (range[(length/2) - 1].to_f + range[(length/2)].to_f)/2.0\n\t\treturn middle\n\tend\n\treturn range[middle]\nend",
"def median(ary)\n mid = ary.length / 2\n sorted = ary.sort\n ary.length.odd? ? sorted[mid] : 0.5 * (sorted[mid] + sorted[mid - 1])\n end",
"def median(arr, mean_med)\n\tsorted = arr.sort {|a,b| a <=> b}\n\tlength = sorted.length\n\n\tif length % 2 == 1 #odd\n\t\thalf_length = length/2\n\t\tmedian_position = half_length + 0.5\n\t\tmean_med << [median_position]\n\telse\n\t\thalf_length == length/2 #even\n\t\tlow_position = half_length.to_i - 1\n\t\thigh_postion = half_length.to_i + 1\n\t\tmedian = (high_postion + low_position)/2\n\t\tmean_med << median\n\tend\nend",
"def median (array)\n array.sort!\n mediana = array.length.to_f/2\n mediana = mediana % 1 == 0 ? (array[mediana]+array[mediana-1])/2.0 : array[mediana - 0.5]\n\nend",
"def median (array)\n\tordered_list = array.sort\n\tif ordered_list.length % 2 == 1\n\t\treturn ordered_list[ordered_list.length/2]\n\telsif ordered_list.length % 2 == 0\n\t\treturn (ordered_list[ordered_list.length/2] + ordered_list[ordered_list.length/2-1])/2.0\n\tend\n\nend",
"def median(array)\n\tarray.sort!\n\tmidVar = (array.length + 1) / 2\n\tif array.length.odd?\n\t\treturn array[midVar - 1]\n\telse\n\t\treturn (array[midVar - 1] + array[midVar])/2.to_f\n\tend\nend",
"def median\n sorted = self.dup.sort\n\n result = 0\n\n middle = length / 2\n if sorted.length.odd?\n return self.take(middle + 1).last\n else\n return (self.drop(middle).first + self.take(middle).last)/2.0\n end\n end",
"def median(input_array)\n\tord_arr = input_array.sort\n\tarr_length = input_array.length\n\tif arr_length%2 == 0\n\t\tmid_sum = ord_arr[arr_length/2]+ord_arr[(arr_length/2)-1]\n\t\tmed = mid_sum/2.0\n\telse\n\t\tmed = ord_arr[(arr_length-1)/2]\n\tend\n\tmed\nend",
"def median(array)\n array.sort!\n length = array.length\n if length % 2 == 1\n # odd length, return the middle number\n return array[length / 2]\n else\n # even number, average the two middle numbers\n item1 = array[length / 2 - 1]\n item2 = array[length / 2]\n return mean([item1, item2])\n end\nend",
"def median(array)\n\tarray.sort!\n\tlen = array.length\n\tlen % 2 == 0 ? ( array[(len-1)/2] + array[(len/2)] ) / 2.0 : array[(len/2)]\n\nend",
"def median(array)\n middle = nil\n array.sort!\n if array.length % 2 == 0\n middle = (array[array.length / 2] + array[array.length / 2 - 1]) / 2.0\n else\n middle = array[(array.length - 1) / 2]\n end\nend",
"def median\n\t\tsorted = self.sort\n\t\tmedian = 0\n\t\tif self.length % 2 == 0\n\t\t\t# we have an even number, average the two middle\n\t\t\tmedian_point_1 = self.length / 2\n\t\t\tmedian_point_2 = ((self.length + 1) / 2.to_f).round(0)\n\t\t\t# subtract 1 because our arrays are 0-based, not 1-based\n\t\t\tmedian_point_1 -= 1\n\t\t\tmedian_point_2 -= 1\n\t\t\tmedian = (sorted[median_point_1] + sorted[median_point_2]) / 2.to_f\n\t\telse\n\t\t\tmedian = sorted[self.length/2]\n\t\tend\n\t\treturn median\n\tend",
"def find_median()\n if @lo.size > @hi.size\n @lo.peek\n else\n (@lo.peek + @hi.peek)/2.0\n end\n end",
"def median(array)\n sorted = array.sort\n len = sorted.length\n (sorted[(len - 1) / 2] + sorted[len / 2]) / 2.0\n end",
"def median(array)\n middle = nil # defining the future median\n array.sort! # sorting the array. I used a destructive method for this, so that it goes to the if statement\n if array.length % 2 == 0 # if the array has an even amount, we need the average of the middle 2 elements\n middle = (array[array.length / 2] + array[array.length / 2 - 1]) / 2.0 # refer to the table below for a visual\n else\n middle = array[(array.length - 1) / 2] # if it's odd you just take the midle element\n end # don't forget to close your\nend",
"def median(array)\n sorted = array.sort\n length = array.length\n if length % 2 ==0\n place1 = length/2\n place2 = (length-2)/2\n sum =(sorted[place1] + sorted[place2])\n median = sum/2.0\n else\n place = (length-1)/2\n median = sorted[place]\n end\n return median\n\nend",
"def median (array)\n\tarray_sorted = array.sort\n\titems = array_sorted.length\n\tif items%2 == 0\n\t\tsum = array_sorted[items/2] + array_sorted[items/2 - 1]\n\t\treturn (sum.to_f/2)\n\telse\n\t\treturn array_sorted[items/2]\n\tend\nend",
"def median (array)\n\tarray.sort!\n\tif array.length % 2 == 0\n\t\te_middle = array.length / 2\n\t\tmedian = (array[e_middle].to_f + array[e_middle - 1].to_f) / 2\n\telse\n\t\to_middle = (array.length - 1)/2\n\t\tmedian = array[o_middle]\n\tend\nend",
"def median(array)\n\tarray.sort!\n\tif array.length % 2 == 1\n\t\treturn array[(array.length-1)/2]\n\telse\n\t\tmed1 = array[array.length/2]\n\t\tmed2 = array[(array.length/2)-1]\n\t\treturn (med1+med2)/2.to_f\n\tend\nend",
"def findMedian(arr)\n sortedArray = arr.sort\n length = sortedArray.length\n sortedArray[length/2]\n\n\nend",
"def median_finder(integers)\n if integers.count % 2 == 1\n integers.sort[(integers.count/2)]\n else\n [integers.sort[integers.count/2], \n integers.sort[(integers.count/2)-1]].inject(:+).fdiv(2)\n end\n end",
"def median(array)\n\t@array = array\n\t@sort = @array.sort\n\treturn (@sort[(@array.length - 1)/2] + @sort[@array.length / 2]) / 2.0\nend",
"def median_maintain(array)\n max_heap = []\n min_heap = []\n if array[0] > array[1]\n max_heap = [array[1]]\n min_heap = [array[0]]\n else\n max_heap = [array[0]]\n min_heap = [array[1]]\n end\n m = [array[0], max_heap[0]]\n (2..array.count - 1).each do |i|\n if array[i] > max_heap[0]\n min_heap << array[i]\n balance_min(min_heap, min_heap.count - 1)\n if min_heap.count > max_heap.count + 1\n max_heap << min_heap[0]\n extract_min(min_heap)\n balance_max(max_heap, max_heap.count - 1)\n end\n else\n max_heap << array[i]\n balance_max(max_heap, max_heap.count - 1)\n if max_heap.count > min_heap.count + 1\n min_heap << max_heap[0]\n extract_max(max_heap)\n balance_min(min_heap, min_heap.count - 1)\n end\n end\n m << if max_heap.count == min_heap.count\n max_heap[0]\n elsif max_heap.count > min_heap.count\n max_heap[0]\n else\n min_heap[0]\n end\n end\n sum = 0\n (0..m.count - 1).each do |i|\n sum += m[i]\n end\n sum % 10_000\nend",
"def median(array)\n\tarray = array.sort\n\tif array.size % 2 != 0\n\t\tarray[((array.size/2))]\n\telse\n\t\t(array[(array.size/2)-1] + array[(array.size/2)]) / 2.0\n\tend\nend",
"def calculation(nums) \n sum = 0\n max = nums[0]\n\n nums.each do |num| # O(n)\n sum += num\n\n if max < num\n max = num\n end\n end\n\n average = sum / nums.length\n\n sorted_nums = nums.sort # O(n log n)\n if sorted_nums.length % 2 == 0\n index_one = (sorted_nums.length / 2) - 1\n index_two = (sorted_nums.length / 2)\n median = (sorted_nums[index_one] + sorted_nums[index_two]) / 2\n else\n index = ((sorted_nums.length / 2) + 1) - 1\n median = sorted_nums[index]\n end\n\n return {max: max, sum: sum, average: average, median: median}\nend",
"def find_k(left_nums, left_start, left_end, right_nums, right_start, right_end, k)\n length_l = left_end - left_start + 1\n length_r = right_end - right_start + 1\n\n # force smaller array to be first\n return find_k(right_nums, right_start, right_end, left_nums, left_start, left_end, k) unless length_l <= length_r\n\n # smaller array is empty, get mean of larger array\n return right_nums[right_start + k - 1] unless length_l > 0\n\n # median is the lessor of the two remaining values\n return [right_nums[right_start], left_nums[left_start]].min unless k > 1\n\n\n # preview possible route for left and right median\n new_left_k = left_start + [length_l, k/2].min - 1\n new_right_k = right_start + [length_r, k/2].min - 1\n\n if left_nums[new_left_k] > right_nums[new_right_k]\n find_k(left_nums, left_start, left_end, right_nums, new_right_k + 1, right_end, k - (new_right_k - right_start + 1))\n else\n find_k(left_nums, new_left_k + 1, left_end, right_nums, right_start, right_end, k - (new_left_k - left_start + 1))\n end\n end",
"def median (array)\n\tarray.sort!\n\tlen = array.length\n\tif len % 2 == 1\n\t\tarray[len/2.0]\n\telse\n\t\t(array[len/2] + array[(len-1)/2])/2.0\n\tend\nend",
"def median(arr)\n\nend",
"def median(array)\n array_size = array.size\n midpoint = array_size / 2\n\n if array_size.odd?\n median = array[midpoint]\n else\n median = (array[midpoint] + array[midpoint - 1]) / 2.0\n end\n median\nend",
"def middle_way(list_1, list_2)\n meds = []\n med_1 = median(list_1)\n med_2 = median(list_2)\n meds[0] = med_1\n meds[1] = med_2\n return meds\nend",
"def find_median()\n mid = @array.length / 2\n return @array.length % 2 == 0 ? (@array[mid-1] + @array[mid]) / 2.0 : @array[mid] / 1.0\n end",
"def median(array)\n\tarray.sort!\n\tx = ((array.length - 1) / 2) \n\ty = (((array.length - 1)/2)+ 1)\n\tif array.length % 2 == 0\n\t\tmed = med.to_f\n\t\tmed = (array[y].to_f + array[x].to_f)\t/ 2.0\n\telse\n\t\tmed = array[x]\n\tend\n\treturn med\nend",
"def median(array)\n # mutate the array until the median is right in the\n # middle\n partition(array)\n # return the middle element of the array,\n # aka the median\n array[array.size / 2]\nend",
"def median(already_sorted=false)\n return nil if empty?\n a = already_sorted ? self : sort\n m_pos = size / 2\n size % 2 == 1 ? a[m_pos] : (a[m_pos-1] + a[m_pos]).to_f / 2\n end",
"def median(arr)\n arr.sort!\n if arr.length % 2 == 0\n median = (arr[arr.length / 2] + arr[arr.length / 2 - 1]) / 2.0\n return median\n else\n median = arr[arr.length / 2]\n return median\n end\nend",
"def median(array)\n\tmedian_even = (array[array.count/2].to_f + array[array.count/2 -1].to_f) / 2\n\tmedian_odd = array[array.count/2]\n\tif array.count % 2 == 0\n\t\tmedian_even.to_f\n\telse \n\t\tmedian_odd\n\tend\nend",
"def median(values)\n i = (values.size / 2) - 1\n values.sort[i]\n end",
"def median(arr = nil)\n arr ||= scores\n return nil if arr.empty?\n arr.sort!\n center = (count = arr.count) / 2\n count % 2 == 1 ? arr[center] : mean(arr[center-1..center])\n end",
"def median\n \n arr = self\n if arr.length <1\n return nil\n else\n sorted_array = median_sort(arr)\n if sorted_array.length.even?\n even_working_index = median_middle(sorted_array)\n # select the value of the 2 index\n median = (sorted_array[even_working_index[0]] + sorted_array[even_working_index[1]]) / 2.0\n # p \"its even\"\n # puts\n # p median\n return median\n \n else\n odd_index = median_middle(sorted_array)\n # p \"odd_index_ median\"\n # puts\n # p sorted_array[odd_index]\n return sorted_array[odd_index]\n \n end\n end\n end",
"def median(array)\nplace = array.sort\n #ordena el array de min a max\n\n size = place.length\n # te dice el numero de valores que ahi en el array\n #3\n #6\nmedia_parte1 = place[(size - 1)/2] \n #place[1]\n #5\n #place[2]\n #3\n media_parte2 = place[size / 2]\n # place[1]\n #5\n # place[3] \n #4\n media_parte3 = (media_parte1 + media_parte2) / 2.0\n # sumas el valor ( 5 + 5 ) / 2.0\n #5\n # suma el valor ( 3 + 4) / 2.0\n #3.5\nend",
"def median(already_sorted = false)\n return nil if empty?\n\n ret = already_sorted ? self : sort\n m_pos = size / 2 # no to_f!\n size.odd? ? ret[m_pos] : ret[m_pos - 1..m_pos].mean\n end",
"def gimme(input_array)\n sorted_arr = input_array.sort\n median = (sorted_arr.length / 2)\n middle_element_index = 0\n i = 0\n\n input_array.length.times do\n if sorted_arr[median] == input_array[i]\n middle_element_index = i\n end\n i += 1\n end\n\n return middle_element_index\nend",
"def merge_sort(array)\n# base case of array size 1\n return array if array.size == 1\n \n# first half array\n first_half = array[0..((array.size-1)/ 2)]\n \n# second half array\n second_half = array [(((array.size - 1) / 2) + 1)..array.size - 1]\n \n# idk which array is bigger, just make sure that one gets the median, the other gets below or above it\n \n# get the sorted first half by calling the method on the first half \n first_half = merge_sort(first_half)\n second_half = merge_sort(second_half)\n \n# merge the first & second half\n merge(first_half, second_half)\nend",
"def median(sorted)\n return sorted[0] if sorted.size == 1\n (sorted[(sorted.size - 1) / 2] + sorted[sorted.size / 2]) / 2.0\n end",
"def median(array)\n new_array = array.sort\n count = new_array.count\n if count % 2 != 0\n puts \"The Median is: #{new_array[count / 2]}\"\n else\n puts \"The Median is: #{(new_array[count / 2] + new_array[(count / 2) - 1] / 2)}\"\n end\nend",
"def find_median()\n l = @nums.length\n if l % 2 == 0\n return (@nums[l/2] + @nums[l/2 - 1])/2.0\n else\n return @nums[l/2]\n end\n end",
"def median\n\t\tif !self.numeric?\n\t\t\treturn false\n\t\tend\n\t\tnums = self.sort\n\t\t\n\t\tif nums.length.odd?\n\t\t\treturn nums[(nums.length/2).to_i]\n\t\tend\n\t\treturn (nums[nums.length/2] + nums[nums.length/2 -1]).to_f/2\n\tend",
"def median(list)\n sorted = list.sort\n #odd list\n if sorted.size % 2 == 1\n return sorted[sorted.size / 2]\n #even list\n else\n return (sorted[sorted.size / 2] + sorted[sorted.size / 2 - 1]) / 2.0\n end\nend",
"def median(already_sorted = false)\n return nil if empty?\n\n sort! unless already_sorted\n m_pos = size / 2 # no to_f!\n size.odd? ? self[m_pos] : self[m_pos - 1..m_pos].mean\n end",
"def calculate_median(values)\n count = values.count\n list_sort = values.sort\n\n # calculate the median position rounding up \n avg_position = (count / 2.0).ceil\n\n # returns the median value or a calculation between the middle 2\n if count.even?\n nice_calculation_median(list_sort[avg_position] + list_sort[avg_position - 1])\n else\n list_sort[avg_position - 1] \n end\n end",
"def median(data)\n data.sort!\n\n if(data.length % 2 != 0)\n p data[(data.length/2).to_i]\n else\n p ((data[data.length/2] + data[(data.length/2) - 1]).to_f / 2)\n end\nend",
"def median(values)\n values.sort![values.size/2-1]\n end",
"def median\n sorted = frequency.sort\n\n if sorted.length.odd?\n value = sorted[sorted.length/2]\n else\n value = (sorted[(sorted.length / 2) - 1] + sorted[sorted.length / 2]) / 2.0\n end\n end",
"def median\n\t\tif self.size == 0\n \t\t \tnil\n \t\telse\n\t\t\tsorted = self.sort\n\t\t\tif sorted.size % 2 == 0\n\t\t\t\t(sorted[sorted.size / 2] + sorted[(sorted.size / 2) - 1]) / 2.0\n\t\t\telse\n\t\t\t\tsorted[sorted.size / 2]\n\t\t\tend\n\t\tend\n\tend",
"def median\n size==0 ? nil : ((0==self.size%2) ? sort[size/2-1,2].mean : sort[self.size/2].to_f)\n end",
"def median_index(arr_size)\n (arr_size-1)/2\nend",
"def median(*list)\n return nil if list.empty?\n\n elements_count = list.count\n\n mid = elements_count / 2\n sorted_list = list.sort\n\n if elements_count.odd?\n sorted_list[mid]\n else\n (sorted_list[mid - 1] + sorted_list[mid]).to_f / 2.0\n end\n end",
"def pivot_on_median_of_three(sort_range, ary)\n fidx, midx, lidx = sort_range.first, sort_range.first + sort_range.count/2, sort_range.last\n midx -= 1 if sort_range.count.even?\n f, m, l = ary[fidx], ary[midx], ary[lidx]\n median = fidx if f < [m,l].max and f > [m,l].min\n median = midx if m < [f,l].max and m > [f,l].min\n median = lidx if l < [m,f].max and l > [m,f].min\n median = midx if median.nil? # fidx, midx, lidx are all the same element\n ary[fidx], ary[median] = ary[median], ary[fidx]\n fidx\nend",
"def median\n\t\tif self.length > 0\n\t\t\tsorted_values = self.digitize.sort\n\t\t\tlength = sorted_values.length\n\t\t\tif length.odd?\n\t\t\t\tsorted_values[length/2]\n\t\t\telse\n\t\t\t\t( sorted_values[length/2] + sorted_values[-1+length/2] ).to_f / 2\n\t\t\tend\n\t\telse\n\t\t\tnil\n\t\tend\n\tend",
"def get_median\n if @lowerhalf.size >= @higherhalf.size\n return @lowerhalf.max\n else\n return @higherhalf.min\n end\nend",
"def median\n return nil if self.length == 0 \n sorted = self.sort\n length = self.length\n if length % 2 != 0\n return sorted[length/2]\n else\n return (sorted[length/2] + sorted[(length/2) - 1])/2.0\n end\n end",
"def better_than_average(arr, points)\n\n a = arr.count\n b = arr.inject(:+)\n median = b/a\n\n if median < points\n return true\n else\n return false\n end\nend",
"def median_middle(arr)\n \n # p arr\n # puts\n \n even_arr = []\n \n if arr.length.odd?\n # p \"its odd\"\n # puts\n middle_index = (arr.length / 2)\n # p middle_index\n return middle_index\n else\n # p \"its even\"\n # puts\n middle1= (arr.length/2) - 1\n middle2= (arr.length/2)\n even_arr << middle1\n even_arr << middle2\n # p even_arr\n return even_arr\n \n #formula\n #middle_index = (middle1 + middle2) / 2\n end\n \n \n end",
"def find_median(nums)\n len = nums.length\n if len % 2 == 0\n median = (nums[(len)/2] + nums[(len)/2 - 1]).to_f/2\n else\n median = nums[(len)/2].to_f\n end\n\n return median\nend",
"def getMedian(alist)\n # return median of alist\n if alist == []\n return []\n end\n blist = alist.sort\n length = alist.length\n if length % 2 == 1\n # length of list is odd so return middle element\n return blist[( ((length + 1)/2) -1).to_i]\n else\n # length of list is even so compute midpoint\n v1 = blist[(length / 2).to_i]\n v2 = blist[((length / 2)-1).to_i]\n return (v1 + v2) / 2.0\n end\n end",
"def partition(array, start_index = 0, finish_index = (array.size - 1))\n # if there is no subarray to sort, return\n return if start_index >= finish_index\n\n # choose the pivot to be the last element of the array\n pivot = array[finish_index]\n # left and right are going to be indices,\n # left for the element at the left of the pivot,\n # and right for the element at the right of the\n # pivot by the moment the pivot is placed where it should be\n left, right = nil, nil\n\n # iterate from the start index to the finish index\n (start_index...finish_index).each do |i|\n # if the element is less than the pivot value\n if array[i] < pivot\n # if there is a right index\n if right\n # swap the elements at the right index and the\n # current index\n array[right], array[i] = array[i], array[right]\n # the left index is now the right index\n left = right\n # the right index is the next element after itself\n right += 1\n else\n # if there is no right index, left is going to be the\n # current index\n left = i\n end\n else\n # if the element's value is greater than or equal to\n # the pivot's value\n if !right\n # if there is no right index, the right index is\n # the current index\n right = i\n end\n end\n end\n # if there is a right index, swap the pivot with the element at the\n # right index\n array[finish_index], array[right] = array[right], array[finish_index] if right\n # if the median was found, return\n return if array[0...(array.size / 2)].all? {|n| n < array[array.size / 2]}\n # partition the from the start index to the left index if there is a left\n # index\n partition(array, start_index, left) if left\n # partition from right's next index to the finish index if there is a right\n # index\n partition(array, right + 1, finish_index) if right\nend",
"def find_median(arr)\n mid = arr.length / 2\n\n arr.sort_by { |obj| obj[:rating] }[mid][:name]\nend",
"def median_ceil\n\t\tif self.size == 0\n \t\t \tnil\n \t\telse\n\t\t\tsorted = self.sort\n\t\t\tif sorted.size % 2 == 0\n\t\t\t\tsorted[sorted.size / 2]\n\t\t\telse\n\t\t\t\tsorted[sorted.size / 2]\n\t\t\tend\n\t\tend\n\tend",
"def average_median(array)\n center = array.length / 2\n sum = 0\n\n if array.length.even?\n sum = array[center - 1] + array[center]\n return (sum.to_f / 2)\n else\n new_array = array[(center - 1).. (center + 1)]\n new_array.each do |num|\n sum += num\n end\n return ((sum.to_f / 3) * 100).to_i / 100.0\n end\nend",
"def median( grades ) \n grades.delete(nil) \n if grades == [] then\n return 0.0\n end \n grades.sort\n grades[ (grades.size / 2) ]\n end",
"def median\n\t sorted = @input.sort\n\t len = sorted.length\n\t result = (sorted[(len - 1) / 2] + sorted[len / 2]) / 2.0\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": [num, num]}'}, status: 400\n\tend",
"def median_budget(movies)\n movie_budgets = movies.collect {|cost| cost[:budget]}\n movie_budgets.sort!\n if movie_budgets.length % 2 != 0\n movie_budgets[movie_budgets.length / 2]\n else\n ((movie_budgets[(movie_budgets.length / 2) - 1]) + (movie_budgets[(movie_budgets.length / 2)])) / 2\n end\nend",
"def median(data)\n data = data.sort\n len = data.length\n\n if len % 2 == 1\n return data[len/2]\n else\n return ((data[(len / 2) - 1] + data[len / 2]).to_f) / 2\n end\n end",
"def get_median\r\n # checks if the length of all_donations is even (if) or odd (else)\r\n if @all_donations.length % 2 == 0 then\r\n # finds the middle index of the array\r\n mid = (@all_donations.length / 2)\r\n # calculates the median value as the average of the 2 middle values\r\n median = ((@all_donations[mid] + @all_donations[mid - 1]) / 2)\r\n else\r\n # finds the middle index of the array\r\n mid = (@all_donations.length / 2)\r\n # calculates median value as the middle value (due to index starting at 0 and truncated decimal after division)\r\n median = @all_donations[mid]\r\n end\r\n # rounds the median value\r\n return median.round\r\n end",
"def find_median()\n return nil if @list.empty?\n \n if @list.size.odd?\n @list[@list.size / 2].to_f\n else\n (@list[@list.size / 2] + @list[@list.size / 2 - 1]) / 2.0\n end\n end",
"def median_floor\n\t\tif self.size == 0\n \t\t \tnil\n \t\telse\n\t\t\tsorted = self.sort\n\t\t\tif sorted.size % 2 == 0\n\t\t\t\tsorted[(sorted.size / 2) - 1]\n\t\t\telse\n\t\t\t\tsorted[sorted.size / 2]\n\t\t\tend\n\t\tend\n\tend",
"def test_should_calculate_median\n assert_equal 6, TestSet.new(8, 10, 2, 6, 4).median\n assert_equal 4.5, TestSet.new(10, 0, 1, 9, 8, 1).median\n end",
"def merge(nums1, m, nums2, n)\n last = m + n - 1\n infinity = -2 ** (0.size * 8 - 1)\n m -= 1\n n -= 1\n while last >= 0\n first = m < 0 ? infinity : nums1[m]\n second = n < 0 ? infinity : nums2[n]\n if first > second\n nums1[last] = nums1[m]\n m -= 1\n else\n nums1[last] = nums2[n]\n n -= 1\n end\n \n last -= 1\n end\nend",
"def relative_sort_array(arr1, arr2)\n output = []\n arr1.sort!\n f1, f2 = {}, {}\n arr1.each do |num|\n f1[num] ? f1[num] += 1 : f1[num] = 1\n end\n arr2.each do |num|\n f2[num] ? f2[num] += 1 : f2[num] = 1\n end\n\n f2.each do |num, freq|\n if f1[num]\n f1[num].times do |i|\n output << num\n f1.delete(num)\n end\n end\n end\n\n f1.each do |num, freq|\n freq.times do |i|\n output << num\n end\n end\n\n output\nend",
"def median_coverage\n if @coverage_profile.nil? or @coverage_profile.empty?\n raise \"coverage_profile is empty, so cannot compute median\"\n end\n \n sorted = @coverage_profile.sort\n if sorted.length % 2 == 1 #if odd\n return sorted[(sorted.length-1)/2].to_f\n else # else must be even\n middle = sorted.length/2\n return (sorted[middle]+sorted[middle-1]).to_f/2\n end\n end",
"def merge_sort_two(array)\n size = array.size\n return array if size < 2\n\n ##Find the mid_point\n mid_point = size / 2\n\n ##Divide\n left = (array.slice(0, mid_point))\n right = (array.slice(mid_point, array.size)) ##the right part may be odd\n\n merge_two(merge_sort_two(left), merge_sort_two(right))\nend",
"def merge(nums1, m, nums2, n)\n p1 = m - 1\n p2 = n - 1\n last = m + n - 1\n \n while p1 >= 0 && p2 >= 0\n if nums1[p1] >= nums2[p2]\n nums1[last] = nums1[p1]\n p1 -= 1\n else\n nums1[last] = nums2[p2]\n p2 -= 1\n end\n last -= 1\n end\n \n while p2 >= 0\n nums1[last] = nums2[p2]\n last -= 1\n p2 -= 1\n end\nend",
"def bsearch(array, target)\n mid_idx = (array.length/2) # 2\n median = array[mid_idx] # 4\n left_array = array[0..(mid_idx - 1)]\n right_array = array[(mid_idx + 1)..-1]\n\n return mid_idx if median == target\n return nil if array.length <= 1\n\n if median < target\n result = bsearch(right_array,target)\n return nil if result.nil?\n (mid_idx + 1) + bsearch(right_array,target)\n elsif median > target\n bsearch(left_array,target)\n\n end\nend",
"def combine(a, b)\n #Do NOT call .sort\n #no .min, use .first\n # create a results array\n result_array = []\n # counters pointing to the index of the smallest elements in each array\n # check that we have elements to compare\n #return false if a.length != b.length\n until a.empty? || b.empty?\n\n a_min_index = a.first\n b_min_index = b.first\n\n if a_min_index < b_min_index\n result_array << a.shift\n\n else\n result_array << b.shift\n end\n\n # push the smaller element onto the result array\n end\n\n result_array += a if b.empty?\n result_array += b if a.empty?\n\n #if one array has more number than the other, i'll need to comtinue comparing those elements within the array\n return result_array\n # if there are elements left over in a, move them to result\n # if there are elements left over in b, move them to result\nend",
"def find_difference(a, m)\n a.sort!\n first = 0\n last = 0\n i = 0\n min_diff = 1000000\n while i+m-1 < a.length\n diff = a[i+m-1] - a[i]\n if diff < min_diff\n min_diff = diff\n first = i\n last = i+m-1\n end\n i += 1\n end\n result = a[last]-a[first]\n return result\nend",
"def mediana(array)\n if array.length % 2 == 1\n med = array[array.length.to_f / 2]\n else\n med = (array[array.length / 2].to_f + array[array.length / 2 - 1]) / 2\n end\n med\nend",
"def twoArrays(n, k, a, b)\n a_sorted = a.sort\n b_sorted = b.sort.reverse\n sum_ele = []\n n.times do |i|\n sum_ele << a_sorted[i] + b_sorted[i]\n end\n if sum_ele.min >= k\n return 'YES'\n else\n return 'NO'\n end\nend"
] |
[
"0.83698124",
"0.81998295",
"0.8184044",
"0.8148729",
"0.69370794",
"0.69354993",
"0.6915888",
"0.68452996",
"0.6818649",
"0.681785",
"0.6765613",
"0.6761636",
"0.67542034",
"0.6745006",
"0.6740559",
"0.6739193",
"0.6730339",
"0.67049545",
"0.669997",
"0.66981435",
"0.66971165",
"0.668466",
"0.66629875",
"0.66445655",
"0.6640138",
"0.6638559",
"0.6635928",
"0.6631522",
"0.6628232",
"0.6626433",
"0.66253793",
"0.662453",
"0.66238713",
"0.6617313",
"0.65992993",
"0.65864223",
"0.65801424",
"0.65781397",
"0.657375",
"0.65716285",
"0.65630656",
"0.6560679",
"0.65448266",
"0.6518196",
"0.64987016",
"0.6439517",
"0.64304346",
"0.64290464",
"0.64206827",
"0.64192134",
"0.6381486",
"0.6381184",
"0.63774395",
"0.6348008",
"0.6328188",
"0.6318566",
"0.6308609",
"0.63081855",
"0.6306786",
"0.63024974",
"0.6289751",
"0.6277522",
"0.62758476",
"0.6254133",
"0.62064844",
"0.6200532",
"0.6195708",
"0.6187399",
"0.6165843",
"0.61589587",
"0.61126643",
"0.60888684",
"0.6057485",
"0.60481155",
"0.60376453",
"0.6025439",
"0.6001117",
"0.5991438",
"0.59874284",
"0.5964553",
"0.59380674",
"0.59332573",
"0.5900376",
"0.58644384",
"0.5861994",
"0.58564574",
"0.5791204",
"0.57208997",
"0.5664155",
"0.5625376",
"0.5494779",
"0.545981",
"0.542858",
"0.5398296",
"0.5365776",
"0.5361732",
"0.53569525",
"0.5352995",
"0.5342708",
"0.5332546"
] |
0.7313573
|
4
|
Return `true` if a resource was not saved yet
|
def new?
id.nil?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def resource_saved?\n resource.save unless resource.validation_attempted?\n resource.saved?\n end",
"def saved?\n !new? && !@content\n end",
"def saved?\n res = uri.nil?\n !res\n end",
"def previously_existed?\n true\n end",
"def set_yet?\n !!@resource_lock.synchronize { defined? @resource }\n end",
"def dirty?\n false\n end",
"def save_without_revision\n save_without_revision!\n true\n rescue\n false\n end",
"def saved?\n return false if not self.valid?\n return self.saved \n end",
"def saved?\n saved_at != nil\n end",
"def already_persisted?\n false\n end",
"def saved?\n !!@saved\n end",
"def previously_persisted?\n !new_record? && destroyed?\n end",
"def saved_already?\n @id != \"\" && @id != nil\n end",
"def persisted?\n !new?\n end",
"def persisted?\n !new?\n end",
"def persisted?\n !new?\n end",
"def persisted?\n !new?\n end",
"def failed_resource?\n @failed_resource ||= false\n end",
"def new_record?\n !_persisted_obj\n end",
"def persisted?\n !new? && !destroyed?\n end",
"def saved?\n return !@realfile.nil?\n end",
"def able_to_save?\n unlocked? or state_was == 'pending'\n end",
"def new?\n\t\t\t!@saved\n\t\tend",
"def resource?\n !reference?\n end",
"def new_record?\n !persisted?\n end",
"def saved?\n !new_record? && attributes == saved_attributes\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n !new_record? && !changed?\n end",
"def persisted?\r\n false\r\n end",
"def persisted?\r\n false\r\n end",
"def new_record?\n !self.persisted?\n end",
"def new_record?\n !persisted?\n end",
"def new_record?\n !persisted?\n end",
"def dirty?\n @dirty || false\n end",
"def dirty?\n @dirty == true\n end",
"def dirty?\n !!culprit\n end",
"def saved?\n @saved\n end",
"def persisted?\n !(@new_record || @destroyed)\n end",
"def save?\n save == true\n end",
"def persisted?\n !self.id.nil?\n end",
"def new_document?; not saved?; end",
"def unborn?\n persisted? && commit.nil?\n end",
"def persisted?\n return false\n end",
"def persisted?\n !new_record?\n end",
"def submitted_resource?(question_id)\n !self.resources.find_by(question_id: question_id).nil?\n end",
"def persisted?\n !new_record?\n end",
"def persisted?\n !new_record?\n end",
"def saved?\n return @saved\n end",
"def persisted?\n not (new_record? || destroyed?)\n end",
"def persisted?\n !id.nil?\n end",
"def new?\n !exists?\n end",
"def saved?\n @saved\n end",
"def persisted?\n !new_record?\n end",
"def persisted?\n !new_record? && @destroyed != true\n end",
"def persisted?\n !(new_record? || destroyed?)\n end",
"def unsaved?\n @unsaved\n end",
"def unsaved?\n @unsaved\n end",
"def persisted?\n\t\t!(self.id.nil?)\n\tend",
"def stored?\n !@_id.nil?\n end",
"def persisted? \n false\n end",
"def persisted?\n\t\tfalse\n\tend",
"def resource_exists?\n reload!\n @exists = true\n rescue Google::Cloud::NotFoundError\n @exists = false\n end",
"def new_record?\n !attributes[:id]\n end",
"def store?\n false\n end",
"def can_save?\n @key != '1'\n end",
"def persisted?\n\t\t\t\tfalse\n\t\t\tend",
"def modified_existing?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end",
"def persisted?\n false\n end"
] |
[
"0.79856724",
"0.7720153",
"0.7577292",
"0.73096603",
"0.72937363",
"0.7253907",
"0.7228985",
"0.7175113",
"0.71051455",
"0.70759547",
"0.7072321",
"0.7069846",
"0.7060783",
"0.7060019",
"0.70591754",
"0.70591754",
"0.70591754",
"0.7041911",
"0.69808424",
"0.69708073",
"0.6967835",
"0.6960739",
"0.6953161",
"0.6949784",
"0.69464254",
"0.6944657",
"0.69377637",
"0.69377637",
"0.69377637",
"0.69377637",
"0.69377637",
"0.69377637",
"0.69377637",
"0.69377637",
"0.69377637",
"0.69377637",
"0.69377637",
"0.69377637",
"0.69377637",
"0.6930472",
"0.69239736",
"0.69239736",
"0.69073075",
"0.69061995",
"0.69061995",
"0.6872644",
"0.6857814",
"0.685644",
"0.6855529",
"0.6853995",
"0.6852739",
"0.68522596",
"0.685224",
"0.68489665",
"0.6842147",
"0.6824131",
"0.6820793",
"0.6813439",
"0.6813439",
"0.681309",
"0.68056667",
"0.6786326",
"0.67856604",
"0.6785161",
"0.6783934",
"0.6779378",
"0.6779292",
"0.6778277",
"0.6778277",
"0.67775655",
"0.67643",
"0.67538124",
"0.6753197",
"0.6751933",
"0.674581",
"0.6738684",
"0.67302835",
"0.67101854",
"0.67053074",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347",
"0.67048347"
] |
0.0
|
-1
|
Return `true` if a resource is not `new?`
|
def persisted?
!new?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new?\n !exists?\n end",
"def new?\n defined?(@new) ? @new : (@new = false)\n end",
"def new?\n defined?(@new) ? @new : (@new = false)\n end",
"def new?\n @is_new\n end",
"def new?\n !!@new\n end",
"def new?\n !!@new\n end",
"def resource?\n !reference?\n end",
"def nested_resource?(new_resource)\n @current_resource_report && @current_resource_report.new_resource != new_resource\n end",
"def new?\n @new\n end",
"def new?\n @new\n end",
"def new?\n !@object\n end",
"def new?\n !@object\n end",
"def new?\n status == STATUS_NEW\n end",
"def resource?\n true\n end",
"def new?\n false\n end",
"def new_record?\n !attributes[:id]\n end",
"def new?\n @new\n end",
"def new_record?\n !defined?(@new_record) || @new_record\n end",
"def new_record?\n new?\n end",
"def new?\n\t\t@new\n\tend",
"def new?\n true\n end",
"def new?\n true\n end",
"def new?\n true\n end",
"def new?\n !@id\n end",
"def action_class?\n instance_variable_defined?(:@new_resource)\n end",
"def new?\n !parent? || parent.new?\n end",
"def is_new?\n !File.exists? @filename\n end",
"def new?\n create?\n end",
"def new?\n create?\n end",
"def new?\n create?\n end",
"def new?\n create?\n end",
"def new?\n create?\n end",
"def is_new?\n\t\t\treturn false if !@id.nil?\n\t\t\tif Episodey::DB::MediaSet.find_by_u_id(@u_id)\n\t\t\t\treturn false\n\t\t\tend\n\n\t\t\treturn true\n\t\tend",
"def isnew?\n if Client.new\n return false \n else\n return true \n end \n end",
"def new_record?\n new?\n end",
"def new_record?\n new?\n end",
"def new_record?\n new?\n end",
"def new_record?\n new?\n end",
"def is_new?\n !self.new_bookmark.nil?\n end",
"def new?\n\t\tcreate?\n\tend",
"def new?\n @type == 'NEW'\n end",
"def creation?\n self.diff['attributes']['new'] && !self.diff['attributes']['old']\n end",
"def new_record?\n false\n end",
"def new_record?\n !rev\n end",
"def new?\n !defined?(@id)\n end",
"def new_entry?\n @new_entry\n end",
"def new_entry?\n @new_entry\n end",
"def new_record? \n new? \n end",
"def new_record?\n !@exists && ldp_source.new?\n end",
"def new?\n !persisted?\n end",
"def new_record?() true end",
"def new_record?\n @new_record ||= false\n end",
"def new_record?\n @new_record ||= false\n end",
"def new_record?\n !_id.present?\n end",
"def new_record?\n nil\n end",
"def new?\n\t\t\t!@saved\n\t\tend",
"def new_record?\n @new_record.nil? || @new_record\n end",
"def new?\n id == nil\n end",
"def new_status?\r\n status == 'new'\r\n end",
"def new_record?(object)\n false\n end",
"def new?\n !rev\n end",
"def new?\n !rev\n end",
"def new?\n id.nil?\n end",
"def new?\n id.nil?\n end",
"def new?\n id.nil?\n end",
"def new?\n not defined?@repository\n end",
"def new_record?\n self.internal_id == nil\n end",
"def new?\n id.nil?\n end",
"def new?\n id.nil?\n end",
"def exists?\n !new? && self.class.exists?(id)\n end",
"def failed_resource?\n @failed_resource ||= false\n end",
"def new_record?\n true\n end",
"def new_record?\n true\n end",
"def new_record?\n true\n end",
"def new_record?\n @new_record == 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 new?\r\n id.nil?\r\n end",
"def new?\n !rev\n end",
"def new?\n @id.nil?\n end",
"def new?\n blob.id.nil?\n end",
"def new_record?\n !self.persisted?\n end",
"def new_record?\n !_persisted_obj\n end",
"def new_file?\n @new_file\n end",
"def set_yet?\n !!@resource_lock.synchronize { defined? @resource }\n end",
"def new_record?\n !persisted?\n end",
"def new_record?\n end",
"def new_record?\n @new_record\n end",
"def new_record?\n @new_record\n end",
"def new_record?\n @new_record\n end",
"def new?\n id.nil? && created_at.nil?\n end",
"def new_record?\n !persisted?\n end",
"def new_record?\n !persisted?\n end",
"def isnew?\n if Admin.new\n return false \n else\n return true \n end \n end",
"def resource_saved?\n resource.save unless resource.validation_attempted?\n resource.saved?\n end",
"def modified?\n new?\n end",
"def new_record?\n @new_record\n end",
"def new_record?\n @new_record\n end",
"def modified_existing?\n false\n end",
"def singleton_resource?\n self.class.singleton_resource?\n end",
"def allow_new_records?\n self.permissions['new']\n end",
"def previously_new_record?\n @previously_new_record\n end"
] |
[
"0.78086364",
"0.7575181",
"0.7575181",
"0.74594814",
"0.74278754",
"0.74278754",
"0.73117465",
"0.7305351",
"0.7305234",
"0.7296279",
"0.72960484",
"0.72960484",
"0.7286046",
"0.72336954",
"0.7172941",
"0.7151889",
"0.7145354",
"0.71153754",
"0.7101874",
"0.7071991",
"0.70574886",
"0.70574886",
"0.70574886",
"0.70536286",
"0.7051002",
"0.70493406",
"0.7028258",
"0.699581",
"0.699581",
"0.699581",
"0.699581",
"0.699581",
"0.69905525",
"0.6989198",
"0.69839436",
"0.69839436",
"0.69839436",
"0.69839436",
"0.6983129",
"0.69658387",
"0.69561535",
"0.6924614",
"0.6916122",
"0.6900986",
"0.6895875",
"0.6854053",
"0.6854053",
"0.6836742",
"0.6832839",
"0.6832348",
"0.6826411",
"0.6821503",
"0.6821503",
"0.6813488",
"0.68125194",
"0.67990285",
"0.67754126",
"0.676573",
"0.67595685",
"0.67554516",
"0.6733439",
"0.6733439",
"0.671623",
"0.671623",
"0.671623",
"0.6714944",
"0.6710117",
"0.6694914",
"0.6694914",
"0.6690972",
"0.6684271",
"0.66763747",
"0.66763747",
"0.66763747",
"0.6665307",
"0.66636705",
"0.66294",
"0.6623172",
"0.662112",
"0.66208935",
"0.6619655",
"0.66181076",
"0.6609493",
"0.66050637",
"0.65988517",
"0.65968907",
"0.6593641",
"0.6593641",
"0.6593641",
"0.658126",
"0.65731627",
"0.65731627",
"0.6562474",
"0.6556438",
"0.65539265",
"0.6551029",
"0.6551029",
"0.65502506",
"0.65480626",
"0.6541938",
"0.6525456"
] |
0.0
|
-1
|
Return whether the object has been destroyed
|
def destroyed?
@destroyed == true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroyed?\n @destroyed == true\n end",
"def destroyed?\n @destroyed\n end",
"def destroyed?\n @destroyed\n end",
"def destroyed?\n @destroyed\n end",
"def destroyed?\n !!@destroyed\n end",
"def destroyed?\n !!destroyed\n end",
"def destroyed?\n @destroyed\n end",
"def destroyed?\n @destroyed ||= false\n end",
"def destroyed?\n @destroyed ||= false\n end",
"def destroyed?\n @destroyed ||= false\n end",
"def destroyed?\n @destroyed ||= false\n end",
"def destroyed?(obj)\n @destroyed && @destroyed[obj.object_id]\n end",
"def destroyed?\n @_deleted || (!new_record? && !exist?)\n end",
"def destroyed?\n return true if !@pid && !@io_out && !@io_in && !@io_err && @main == nil\n return false\n end",
"def destroy?\n attached? && !cached?\n end",
"def destroyed?\n super || !deleted_at.nil?\n end",
"def detached?\n @obj.nil?\n end",
"def detached?\n @obj.nil?\n end",
"def destroyed?()\n @_deleted || Neo4j::Node._load(id).nil?\n end",
"def _destroy\n marked_for_destruction?\n end",
"def destroy?\n event == 'destroy'\n end",
"def previously_persisted?\n !new_record? && destroyed?\n end",
"def can_be_destroyed?\n false\n end",
"def destroyable?\n @destroyable\n end",
"def can_destroyed?\n # list of associations to check (automatic)\n has_assocs = []\n self.class.reflections.each do |r_name, r|\n has_assocs << r_name if [:has_one, :has_many, :has_and_belongs_to_many].include? r.macro\n end\n\n # check for emptyness\n has_assocs.each do |r_name|\n assoc = self.send(r_name)\n nothing = assoc.respond_to?('empty?') ? assoc.empty? : assoc.nil?\n return false unless nothing\n end\n \n true\n end",
"def finalized?\n self.state != STATE_NEW\n end",
"def destroy?\n name == :destroy\n end",
"def can_destroyed?\n return !self.business_user\n # list of associations to check (automatic)\n #has_assocs = []\n #self.class.reflections.each do |r_name, r|\n # has_assocs << r_name if [:has_one, :has_many, :has_and_belongs_to_many].include? r.macro\n #end\n \n # check for emptyness\n #has_assocs.each do |r_name|\n # assoc = self.send(r_name)\n # nothing = assoc.respond_to?('empty?') ? assoc.empty? : assoc.nil?\n # return false unless nothing\n #end\n \n true\n end",
"def killed?\n @killed\n end",
"def can_destroyed?\n # return false unless self.modem_short_messages.any? { |short_message| %w(RECEIVED).include?(short_message.status) }\n \n=begin\n # list of associations to check (automatic)\n has_assocs = []\n self.class.reflections.each do |r_name, r|\n has_assocs << r_name if [:has_one, :has_many, :has_and_belongs_to_many].include? r.macro\n end\n\n # check for emptyness\n has_assocs.each do |r_name|\n assoc = self.send(r_name)\n nothing = assoc.respond_to?('empty?') ? assoc.empty? : assoc.nil?\n return false unless nothing\n end\n=end\n true\n end",
"def finalized?\n !!removed_at\n end",
"def room_information_destroyed?\n if RoomInformation.find_by_id(params[:id])\n return false\n else\n return true\n end\n end",
"def destroy\n return false if callback(:before_destroy) == false\n result = destroy_without_callbacks\n callback(:after_destroy)\n result\n end",
"def destroy\n return false if callback(:before_destroy) == false\n result = destroy_without_callbacks\n callback(:after_destroy)\n result\n end",
"def killed?\n false\n end",
"def terminated?\n self.state.name == \"terminated\"\n end",
"def destroyed=(destroyed)\n @destroyed = destroyed && true\n end",
"def destroyed(obj)\n (@destroyed ||= {})[obj.object_id] = true\n end",
"def killed?\n @killed\n end",
"def destroy?\n return false\n end",
"def terminated?\n terminated\n end",
"def destruction?\n self.diff['attributes']['old'] && !self.diff['attributes']['new']\n end",
"def persisted?\n !new_record? && @destroyed != true\n end",
"def destroyable?\n true\n end",
"def disposed?\n @_disposed\n end",
"def will_be_destroyed?(association_name, attributes)\n allow_destroy?(association_name) && has_destroy_flag?(attributes)\n end",
"def marked_for_destruction?\n @marked_for_destruction\n end",
"def erased?\n false\n end",
"def terminated?\n infobase.send(:infobase_wrapper).session_get(id).empty?\n end",
"def disposed?\n @disposed\n end",
"def disposed? \n @disposed\n end",
"def has_destroy_flag?(hash)\n Type::Boolean.new.cast(hash['_destroy'])\n end",
"def terminated?\n !! @status\n end",
"def alive?\n !(self.closed? || self.suspended? || self.deleted?)\n end",
"def destructible?\n false\n end",
"def destroy?\n false\n end",
"def destroy?\n false\n end",
"def detached?\n !attached?\n end",
"def released? \n self.released \n end",
"def destroy\n delete_object\n true\n end",
"def disposed?\n end",
"def is_destroyable?\n\t\tfalse\n\tend",
"def has_destroy_flag?( hash )\n ActiveFedora::Type::Boolean.new.cast( hash['_destroy'] )\n end",
"def detached?\n !self.attached?\n end",
"def released?\n released\n end",
"def persisted?\n !(@new_record || @destroyed)\n end",
"def terminated?\n !!@resource_lock.synchronize { @terminated }\n end",
"def persisted?\n !new? && !destroyed?\n end",
"def removed?\n @removed\n end",
"def exited?\n return true\n end",
"def destroy(object)\n object.destroy && true if valid_object?(object)\n end",
"def has_lifecycle?\n false\n end",
"def has_destroy_flag?(hash)\n ActiveFedora::Type::Boolean.new.cast(hash['_destroy'])\n end",
"def deleted_from_db?\n #Try to avoid db-query if object is already deleted.\n return true if self.deleted?\n\n #Try to reload data. Destroy object and return true if the row is gone from the database.\n begin\n self.reload\n return false\n rescue Errno::ENOENT\n self.destroy\n return true\n end\n end",
"def has_destroy_flag?(hash)\n ActiveFedora::Type::Boolean.new.cast(hash['_destroy'])\n end",
"def has_destroy_flag?(hash)\n ActiveFedora::Type::Boolean.new.cast(hash['_destroy'])\n end",
"def terminated?\n !emit_value?\n end",
"def stopped?\n synchronize { @stopped }\n end",
"def stopped?\n synchronize { @stopped }\n end",
"def unborn?\n persisted? && commit.nil?\n end",
"def destroyable?\n !new_record? and !immutable? and !modified_records?\n end",
"def persisted?\n !(new_record? || destroyed?)\n end",
"def dropped?\n return (@terminate_count != nil)\n end",
"def disposed?\n return @sprites[\"base\"].disposed? if @sprites[\"base\"]\n return true\n end",
"def destroy\n false\n end",
"def persisted?\n !(new_record? || destroyed?)\n end",
"def persisted?\n !(new_record? || destroyed?)\n end",
"def dead?\n @dead || false\n end",
"def dead?\n @dead\n end",
"def _delete\n marked_for_destruction?\n end",
"def dead?\n @dead\n end",
"def shutdown?\n stopped_event.set?\n end",
"def shutdown?\n stopped_event.set?\n end",
"def stopped?\n @stopped\n end",
"def stopped?\n @stopped\n end",
"def destructive?\n @destructive ||= !!(dependent && (dependent == :delete_all || dependent == :destroy))\n end",
"def disposed?\n @sprite.nil? || @sprite.disposed?\n end"
] |
[
"0.8661089",
"0.8644168",
"0.8644168",
"0.8644168",
"0.8640321",
"0.86078024",
"0.8572548",
"0.8566166",
"0.8566166",
"0.8566166",
"0.8566166",
"0.84974337",
"0.7910018",
"0.7479804",
"0.7394459",
"0.73555744",
"0.7239645",
"0.7239645",
"0.7232382",
"0.7103759",
"0.7088497",
"0.7044712",
"0.69968015",
"0.699379",
"0.6954539",
"0.6938908",
"0.6743878",
"0.67358005",
"0.67018884",
"0.6675212",
"0.66659087",
"0.66441303",
"0.663916",
"0.663916",
"0.6622507",
"0.6617124",
"0.66110873",
"0.6607303",
"0.66026604",
"0.6593356",
"0.65847915",
"0.6581231",
"0.6562024",
"0.65485215",
"0.65251577",
"0.6515252",
"0.6510794",
"0.6476687",
"0.6439113",
"0.64375293",
"0.64341104",
"0.641748",
"0.6416804",
"0.6416713",
"0.6410113",
"0.6406047",
"0.6406047",
"0.6404893",
"0.6403993",
"0.6403288",
"0.63890755",
"0.6380362",
"0.6379538",
"0.63746816",
"0.6366737",
"0.63510716",
"0.6339646",
"0.63347536",
"0.6334189",
"0.6330891",
"0.6329851",
"0.6299079",
"0.6297134",
"0.6295629",
"0.62926066",
"0.62926066",
"0.62888765",
"0.6287308",
"0.6287308",
"0.6285286",
"0.62838906",
"0.6279843",
"0.62717295",
"0.62701374",
"0.62631273",
"0.6255649",
"0.6255649",
"0.62526363",
"0.6252532",
"0.62521744",
"0.625111",
"0.6238953",
"0.6238953",
"0.62310517",
"0.62310517",
"0.62296104",
"0.6220724"
] |
0.86232984
|
8
|
Destroy an existing resource
|
def destroy_existing(id, params={})
request(params.merge(:_method => :delete, :_path => build_request_path(params.merge(primary_key => id)))) do |parsed_data, response|
new(parse(parsed_data[:data]).merge(:_destroyed => true))
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy_resource(resource)\n resource.destroy\n resource\n end",
"def destroy_resource object\n object.destroy\n end",
"def destroy\n destroy_resource(resource)\n head :no_content\n end",
"def destroy\n destroyer = ensure_destroyer\n destroyer.destroy(@resource).success?\n end",
"def destroy_resource(resource_name, resource_id)\n must_support! resource_name.to_s.pluralize\n result = connection.delete(\n api_uri([resource_name.to_s.pluralize, resource_id].join('/'))\n )\n result.status.is_no_content?\n end",
"def destroy_resource(object)\n object.destroy\n end",
"def delete!\n @resource.delete!\n end",
"def delete\n @resource.delete\n end",
"def semantic_destroy(resource)\n resource.destroy\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n flash[:notice] = 'Resource was successfully deleted.'\n redirect_to resources_url\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to(resources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to(resources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to(resources_url) }\n format.xml { head :ok }\n end\n end",
"def remove(resource)\n resource.delete\n end",
"def destroy\n File.unlink(@resource[:path])\n Puppet.debug \"deleted file #{@resource[:path]}\"\n end",
"def undestroy\n @resource = resource_proxy(true).find(params[:id])\n set_resource_instance\n\n @resource.deleted_at = nil\n @resource.save\n\n respond_with(@resource, location: { action: :index })\n\n # flash[:notice] = \"#{resource_name} has been undeleted\"\n # redirect_to action: :index\n end",
"def destroy\n debug \"Call: destroy on cs_resource '#{@resource[:name]}'\"\n pcs 'resource', 'disable', @resource[:name]\n pcs 'resource', 'cleanup', @resource[:name]\n pcs 'resource', 'delete', @resource[:name]\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n RubyLokaliseApi::Generics::DeletedResource.new(\n reinit_endpoint.do_delete.content\n )\n end",
"def destroy(context)\n set_resource(context)\n\n begin\n instance_variable_get(:\"@#{resource_name}\").destroy\n instance_variable_get(:\"@#{resource_name}\").to_json\n rescue StandardError => e\n context.halt(500, { status: 'error', message: e.message }.to_json)\n end\n end",
"def destroy\n after_destroy if instance_variable_get(resource).destroy\n\n respond_to do |format|\n format.html { redirect_to action: :index, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_resource.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_resources_url }\n format.json { head :no_content }\n end\n end",
"def delete\n if(resource.exist?)\n resource.lock_check if resource.supports_locking?\n resource.delete\n else\n NotFound\n end\n end",
"def delete(resource:)\n orm_object = resource_factory.from_resource(resource: resource)\n orm_object.delete\n resource\n end",
"def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n resource.destroy\n respond_to do |format|\n format.html { redirect_to self.send(\"#{resource_class_name.pluralize.underscore}_url\"), notice: \"#{resource_class_name} was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy; delete end",
"def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to @resource.host, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end",
"def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.deactivate!\n\n respond_to do |format|\n format.html { redirect_to(edit_admin_resource_url(@resource)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @resource_info = ResourceInfo.find(params[:id])\n @resource_info.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_infos_url }\n format.json { head :ok }\n end\n end",
"def destroy(resource_name)\n if ! advance? then return self end\n @@logger.debug \"Destroying resource: #{resource_name}.\"\n result = {:destroy => resource_name}\n args = {:action => :destroy}\n resource = @resourcer.get resource_name\n destroyed = @mutator.destroy(resource_name, resource)\n destroyed.harp_script = @harp_script\n if destroyed.output? (args)\n result[:output] = destroyed.make_output_token(args)\n result[:line] = @current_line\n end\n @events.push(result)\n return self\n end",
"def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n resource.destroy\n respond_with resource\n end",
"def destroy\n resource.destroy\n respond_with resource\n end",
"def destroy\n onetemplate('delete', resource[:name])\n @property_hash.clear\n end",
"def delete!\n connection.delete(\n path: resource_path,\n status: 204\n ).data\n end",
"def destroy\n resource.destroy\n respond_with(resource, location: i18n_keys_path)\n end",
"def destroyed!\n log('Deleted', resource_attributes)\n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n clear_cached_vars\n Regulate::Git::Interface.delete({\n :id => id,\n :commit_message => commit_message || \"Deleting resource #{title}\",\n :author_name => author_name,\n :author_email => author_email\n })\n end",
"def destroy\n\t\t@resource = Resource.find_by(id: params[:id],course_id: params[:course_id])\n\t\tunless @resource.nil?\n\t\t\tif @resource.destroy\n\t\t\t\trender nothing:true, status: :ok\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\t\trender nothing:true, status: :not_found\n\tend",
"def destroy\n @entry = @resource_finder.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to_resources }\n format.xml { head :ok }\n end\n end",
"def destroy\n onevnet('delete', resource[:name])\n @property_hash.clear\n end",
"def destroy\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n if @resource.destroy\n flash[:success] = 'Resource was removed'\n format.html { redirect_to admin_resources_path }\n format.json { head :ok }\n else\n flash[:error] = @resource.errors.full_messages.join('')\n format.html { redirect_to admin_resources_path(@resource.id) }\n format.json { render json: @resource.errors.full_messages.join(''), status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @asset = Resource.find(params[:id])\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to admin_resources_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource.destroy\n @myWorld = World.where(:title => @user[:email])\n worldID = @myWorld[0].id\n invoke(\"Resource destroyed: \" + @resource.title, @user[:email], \"admin\", worldID)\n respond_to do |format|\n format.html { redirect_to resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n \n respond_to do |format|\n format.html { redirect_to(resources_url) }\n format.xml { head :ok }\n format.js\n end\n end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy\n notice \"Removing #{@resource_copy[:path]}\"\n FileUtils.rm_rf(@resource_copy[:path])\n end",
"def destroy\r\n do_without_exception(:destroy!)\r\n end",
"def destroy_resource_content\n resource_content\n end",
"def destroy\n raise ReadOnlyRecord if readonly?\n # todo: callbacks?\n instance_resource.delete if persisted?\n @destroyed = true\n freeze\n end",
"def destroy\n authorize! :destroy, resource\n current_model_service.destroy resource, params\n yield if block_given? # after_destroy\n respond_with resource, location: helpers.index_path(current_model_class)\n end",
"def destroy\n @chef_resource.destroy\n respond_to do |format|\n format.html { redirect_to chef_resources_url, notice: 'Chef resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def clear_resource\n if self.delete_resource && (self.delete_resource == '1' || self.delete_resource == true)\n self.resource = nil\n end\n end",
"def delete(resource)\n finder_or_run(:delete, resource)\n end",
"def destroy\r\n end",
"def destroy\r\n end",
"def destroy(context={})\n self.class.rpc_execute('unlink', self.id, context)\n end",
"def destroy\n @stock_resource = StockResource.find(params[:id])\n @stock_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to stock_resources_url }\n format.json { head :ok }\n end\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\r\n end",
"def destroy\n if persisted?\n PROXY.delete(\"#{resources_name}/#{id}\")\n @persisted = false\n true\n else\n fail 'Cropio record is not persisted!'\n end\n end",
"def destroy\n # no op\n end",
"def remove_resource(name)\n self.resources.delete(name)\n end",
"def destroy\n @destroy_resource.destroy\n\n respond_to do |format|\n format.html do\n flash[flash_status_type] = flash_destroyed_message\n\n redirect_to location_after_destroy\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @temp_resource.destroy\n respond_to do |format|\n format.html { redirect_to temp_resources_url, notice: 'Temp resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cloud_resource.destroy\n respond_to do |format|\n format.html { redirect_to cloud_resources_url, notice: 'Cloud resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to challenge_resources_url(@resource.challenge_id), notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end",
"def destroy(context={})\n rpc_execute('unlink', [self.id], context)\n end",
"def destroy\n nil\n end",
"def destroy\n\n end",
"def destroy\n\n end",
"def destroy(options = {}, &block)\n object = get_resource_ivar || find_resource\n\n object.destroy\n options[:location] = collection_path\n\n respond_with(object, options, &block)\n end",
"def destroy!; end"
] |
[
"0.85614765",
"0.83236015",
"0.8292858",
"0.8229077",
"0.8185887",
"0.80896413",
"0.8079926",
"0.80237466",
"0.79857814",
"0.795946",
"0.79514825",
"0.79514825",
"0.79514825",
"0.7919955",
"0.788436",
"0.78483105",
"0.78188163",
"0.7815574",
"0.7815574",
"0.7815574",
"0.7815574",
"0.7811409",
"0.7807054",
"0.7641788",
"0.7638227",
"0.76341826",
"0.76170784",
"0.76128954",
"0.75974774",
"0.75974774",
"0.75974774",
"0.75974774",
"0.7570258",
"0.7561566",
"0.75487834",
"0.7544154",
"0.7544154",
"0.75424325",
"0.75198865",
"0.75154686",
"0.7485542",
"0.7485542",
"0.7483021",
"0.7483021",
"0.74640197",
"0.7443222",
"0.74182224",
"0.7398511",
"0.7398468",
"0.7398468",
"0.73805153",
"0.73798436",
"0.73713315",
"0.7352944",
"0.73404455",
"0.73389244",
"0.7334436",
"0.7330731",
"0.73098785",
"0.7301688",
"0.7301688",
"0.7301688",
"0.7301688",
"0.7301688",
"0.7301688",
"0.7301688",
"0.7301688",
"0.7301688",
"0.7301688",
"0.7298691",
"0.72936517",
"0.7287307",
"0.7272591",
"0.72633106",
"0.7247142",
"0.7244448",
"0.7220253",
"0.71909565",
"0.71909565",
"0.7189442",
"0.7178146",
"0.7166052",
"0.7166052",
"0.7166052",
"0.7166052",
"0.7166052",
"0.7164767",
"0.7163693",
"0.715997",
"0.71539104",
"0.7151578",
"0.71357936",
"0.7120031",
"0.71166974",
"0.7114776",
"0.71137726",
"0.7113699",
"0.71016705",
"0.71016705",
"0.7094672",
"0.70735013"
] |
0.0
|
-1
|
Computes the outputs based on the inputs and previous state
|
def tick
2.times.each do
sub_components.each(&:tick)
sub_components.each(&:tock)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def train(inputs, outputs)\n eval(inputs)\n backpropagate(outputs)\n calculate_error(outputs)\n end",
"def evaluate\n @output_value = Math.tanh(@input_value - @bias)\n #p \"output value #{@output_value}\"\n @forward_nodes.each do |node, weight|\n #p \"weight #{weight} old input #{node.input_value}\"\n node.input_value += @output_value * weight\n #p \"new input #{node.input_value}\"\n end\n @input_value = 0\n end",
"def backpropagate\n\t\t# calculate output errors\n\t\toutput_error = []\n\t\t@layers[2].neurons.each_with_index do |neuron, index|\n\t\t\terror = @expected_output[index] - neuron.value\n\t\t\toutput_error[index] = dtanh(neuron.value) * error\n\t\tend\n\n\t\t# calculate hidden errors\n\t\thidden_error = []\n\t\t@layers[1].neurons.each_with_index do |neuron, index|\n\t\t\terror = 0.0\n\t\t\tindex_helper = 0\n\t\t\tneuron.arrows.each do |arrow|\n\t\t\t\terror = error + output_error[index_helper] * arrow.weight\n\t\t\t\tindex_helper += 1\n\t\t\tend\n\t\t\thidden_error[index] = dtanh(neuron.value) * error\n\t\tend\n\n\t\t#update arrow weights going to outputs\n\t\t@layers[1].neurons.each do |neuron|\n\t\t\tneuron.arrows.each_with_index do |arrow, i|\n\t\t\t\tchange = output_error[i] * neuron.value\n\t\t\t\tarrow.weight = arrow.weight + change\n\t\t\tend\n\t\tend\n\t\t\n\t\t#update arrow weights going to hidden layer\n\t\t@layers[0].neurons.each do |neuron|\n\t\t\tneuron.arrows.each_with_index do |arrow, i|\n\t\t\t\tchange = hidden_error[i] * neuron.value\n\t\t\t\tarrow.weight = arrow.weight + change\n\t\t\tend\n\t\tend\n\tend",
"def backpropagate(expected_output_values)\n check_output_dimension(expected_output_values.length)\n calculate_output_deltas(expected_output_values)\n calculate_internal_deltas\n update_weights\n end",
"def train(input, expected_output)\n # binding.pry\n output = calculate_output(input)\n backpropogate(expected_output)\n update_weights_from_error\n calculate_error(output, expected_output)\n end",
"def converge(state) ; end",
"def run_backpropagate(backward_inputs)\n a_layer_outputs = nil\n a_layer_inputs = backward_inputs\n @layers.reverse[0..-2].each do |layer|\n a_layer_outputs = layer.backward_outputs(a_layer_inputs)\n a_layer_inputs = a_layer_outputs\n end\n a_layer_outputs\n end",
"def update_inputs_and_outputs\n\t\t\t\t@inputs = Files::State.new(@node.inputs)\n\t\t\t\t\n\t\t\t\tunless @node.inherit_outputs?\n\t\t\t\t\t@outputs = Files::State.new(@node.outputs)\n\t\t\t\tend\n\t\t\tend",
"def outputs\n inputs.map(&:output).compact\n end",
"def compute(*inputs)\n if inputs.length != number_of_inputs\n raise WrongNumberOfInputsError, \"Expected #{number_of_inputs} inputs, got #{inputs.length}\"\n end\n\n # Stash these in instance variables so we can use them for training later\n @medin = []\n @medout = []\n\n outputs = []\n\n number_of_medial_neurons.times do |i|\n @medin[i] = 0\n number_of_inputs.times do |j|\n @medin[i] += @synone[j][i] * inputs[j]\n end\n @medout[i] = Math.tanh(@medin[i])\n end\n\n number_of_outputs.times do |i|\n outputs[i] = 0\n number_of_medial_neurons.times do |j|\n outputs[i] += @syntwo[j][i] * @medout[j]\n end\n end\n\n outputs\n end",
"def feedforward(inputs)\n # Sum all values\n sum = @weights.zip(inputs).map { |a, b| a * b }.inject(0, :+)\n # Result is sign of the sum, -1 or 1\n activate(sum)\n end",
"def evolve\n # Prepare new next_state matrix same shape as current matrix\n @next_state=Array.new(@current_state.length){\n Array.new(@current_state[0].length){0}\n }\n\n # Run through algorithm\n @current_state.each_index{|row| \n @current_state[row].each_index{|col| calc_next_state(row,col)}}\n\n # Make next stage of life the current stage\n @current_state=@next_state\n end",
"def evaluate!(input_set)\n # FEED FORWARD\n # 1. Apply input vectors to input neurons\n input.each.with_index do |neuron, j|\n neuron.net_input = input_set[j]\n end\n\n # 2, 3, 4. Calculate the net input values to the hidden neurons\n # Calculate the outputs from the hidden layer neurons\n # Calculate the net input values for the output layer\n (hidden + [output]).each do |layer|\n layer.each do |neuron|\n sum = neuron.predecessors.inject(0) do |acc, pred|\n acc + pred.output * neuron.edge(pred)\n end\n neuron.net_input = neuron.bias_weight + sum\n end\n end\n\n # 5. Calculate the output values for the output layer\n output.map(&:output)\n end",
"def before_validate\n self.initial_output :alias => 'PREVOUT' unless self.initial_output\n self.previous_input :alias => 'PREVIN' unless self.previous_input\n self.previous_output :alias => 'PREVOUT' unless self.previous_output\n self.outputs<< output(0) if self.outputs.empty?\n super\n end",
"def compute(input)\n @inputs << input\n while step\n return @outputs.shift if @outputs.any?\n end\n nil\n end",
"def train(original_features, outputs)\n features = add_zero_feature polynomialize_features(original_features)\n @iterations = 0\n @old_thetas = Array.new features.first.size, 0\n @thetas = batch_descend @old_thetas, features, outputs\n while continue? @thetas, @old_thetas, features, outputs\n @old_thetas = @thetas\n @thetas = batch_descend @thetas, features, outputs\n end\n @iterations\n end",
"def total\n @state[0]*VALUES[0] + @state[1]*VALUES[1] + @state[2]*VALUES[2] + @state[3]*VALUES[3] + @state[4]*VALUES[4]\n end",
"def compute(*inputs)\n queue_input(*inputs)\n loop do\n result = step\n if result.nil?\n break\n elsif result.is_a?(Symbol)\n return result\n elsif @outputs.any?\n return @outputs.shift\n end\n end\n nil\n end",
"def calculate_internal_deltas\n prev_deltas = @deltas.last\n (@activation_nodes.length-2).downto(1) do |layer_index|\n layer_deltas = []\n @activation_nodes[layer_index].each_index do |j|\n error = 0.0\n @structure[layer_index+1].times do |k|\n error += prev_deltas[k] * @weights[layer_index][j][k]\n end\n layer_deltas[j] = (@derivative_propagation_function.call(\n @activation_nodes[layer_index][j]) * error)\n end\n prev_deltas = layer_deltas\n @deltas.unshift(layer_deltas)\n end\n end",
"def predict(input)\n # Perform forward propagation to predict output\n \n # Activation on input nodes should simply be the input\n @activation_input[-1] = 1 # set bias node's activation to 1\n @activation_input[0..-2] = input\n \n # Compute the weighted sum into each hidden node\n @hiddenNodes.times do |x|\n s = 0.0\n @inputNodes.times do |i|\n s = s + (@activation_input[i] * @w_1[i][x])\n end\n # update activation for the hidden layer\n @activation_hidden[x] = NeuralNetwork::activation(s)\n end\n \n # Now compute the weighted sum into each output node\n @outputNodes.times do |x|\n s = 0.0\n @hiddenNodes.times do |h|\n s = s + (@activation_hidden[h] * @w_2[h][x])\n end\n # update activations for the output layer\n @activation_output[x] = NeuralNetwork::activation(s)\n end\n\n @activation_output\n\n end",
"def back_propogate(targets, n = 0.5)\n # calculate errors for output\n output_deltas = url_ids.map { |e| 0.0 }\n url_ids.size.times do |k|\n error = targets[k] - all_out[k]\n output_deltas[k] = dtanh(all_out[k]) * error\n end\n\n # calculate errors for hidden layer\n hidden_deltas = hidden_ids.map { |e| 0.0 }\n hidden_ids.size.times do |j|\n error = 0.0\n url_ids.size.times do |k|\n error += output_deltas[k] * weights_out[j][k]\n end\n hidden_deltas[j] = dtanh(all_hidden[j]) * error\n end\n\n # update output weights\n hidden_ids.size.times do |j|\n url_ids.size.times do |k|\n change = output_deltas[k] * all_hidden[j]\n weights_out[j][k] += n * change\n end\n end\n\n # update input weights\n word_ids.size.times do |i|\n hidden_ids.size.times do |j|\n change = hidden_deltas[j] * all_in[i]\n weights_in[i][j] += n * change\n end\n end\n end",
"def predict(input)\n l_size = input.shape[0]\n az = Numo::DFloat.zeros(l_size,@nhidden)\n ar = Numo::DFloat.zeros(l_size,@nhidden)\n ahhat = Numo::DFloat.zeros(l_size,@nhidden)\n\tah = Numo::DFloat.zeros(l_size,@nhidden)\n\t\t\n a1 = tanh((input.dot @w1) + @b1)\n pp \"a1 is ============\"\n pp a1\n pp a1[1,0...a1.shape[1]]\n\t \n # (array slice view) http://ruby-numo.github.io/narray/narray/Numo/DFloat.html#[]-instance_method\t \n x = (Numo::DFloat.zeros(@nhidden)).concatenate(a1[1,0...a1.shape[1]])\n az[1,0...az.shape[1]] = sigm((x.dot @wz) + @bz)\n ar[1,0...ar.shape[1]] = sigm((x.dot @wr) + @br)\n ahhat[1,0...ahhat.shape[1]] = tanh((x.dot @wh) + @bh)\n\tah[1,0...ah.shape[1]] = az[1,0...az.shape[1]]*ahhat[1,0...ahhat.shape[1]]\n\n # for i in range(1,l_size):\n (1...l_size).each do |i|\n x = ah[i-1,0...ah.shape[1]].concatenate(a1[i,0...a1.shape[1]])\n az[i,0...az.shape[1]] = sigm((x.dot @wz) + @bz)\n ar[i,0...ar.shape[1]] = sigm((x.dot @wr) + @br)\n x = (ar[i,0...ar.shape[1]]*ah[i-1,0...ah.shape[1]]).concatenate(a1[i,0...a1.shape[1]])\n ahhat[i,0...ahhat.shape[1]] = tanh((x.dot @wh) + @bh)\n ah[i,0...ah.shape[1]] = (1-az[i,0...az.shape[1]])*ah[i-1,0...az.shape[1]] + az[i,0...az.shape[1]]*ahhat[i,0...ahhat.shape[1]]\n end\n \n a2 = tanh((ah.dot @w2) + @b2)\n\treturn a1,az,ar,ahhat,ah,a2\n end",
"def total_output\n @outputs.inject(:+)\n end",
"def get_outputs\n outputs = []\n last_layer_nodes = layer_n_nodes(num_layers - 1)\n loop_over_nodes(num_layers - 1) do |i|\n outputs << last_layer_nodes[i].output\n end\n outputs\n end",
"def compute(phase)\n input = 0\n total_thrust = 0\n\n phase.each do |p|\n clean_opcode = @opcode.clone\n inputs = [p, input]\n phase_setting = Intcode.new.runner(clean_opcode, 0, inputs)\n total_thrust = phase_setting[:out].last\n input = total_thrust\n end\n total_thrust\n end",
"def outputs\n @outputs || []\n end",
"def update_outputs!\n\t\t\t\tif @node.inherit_outputs?\n\t\t\t\t\t@outputs = Files::State.new(self.children_outputs)\n\t\t\t\telse\n\t\t\t\t\t# After the task has finished, we update the output states:\n\t\t\t\t\t@outputs.update!\n\t\t\t\tend\n\t\t\tend",
"def call(*inputs)\n inputs.compact!\n build(*inputs.map { |input| input.shape[1..-1] }) unless built?\n forward(*inputs)\n end",
"def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end",
"def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end",
"def update\n ones = Matrix.columns( [Array.new(@N) { 1.0 }] )\n (1..@L).each do |l|\n delta_W = ( MU*@delta_W_prev[l] ) -\n @learning_rate*( (@Delta[l] * @Z[l-1].t / @N) + LAMBDA*@layers[l].W )\n delta_b = ( MU*@delta_b_prev[l] ) -\n @learning_rate*( @Delta[l] * ones )\n\n @delta_W_prev[l] = Marshal.load(Marshal.dump(delta_W))\n @delta_b_prev[l] = Marshal.load(Marshal.dump(delta_b))\n\n @layers[l].W = @layers[l].W + delta_W\n @layers[l].b = @layers[l].b + delta_b\n end\n end",
"def train(inputs, desired)\n # Guess the result\n guess = feedforward(inputs)\n # Compute the factor for changing the weight based on the error\n # Error = desired output - guessed output\n # Note this can only be 0, -2, or 2\n # Multiply by learning constant\n error = desired - guess\n # Adjust weights based on weightChange * input\n @weights.collect!.with_index { |w, i| w + error * inputs[i] }\n end",
"def backup(next_state_ns)\n next_state_ns.map do |next_state_n, probability, reward|\n probability * (reward + @discount * @array_value[next_state_n])\n end.inject(:+)\n end",
"def board_to_nn_inputs(state)\n result = [0] * 27\n state.each.with_index {|v, i| result[3 * i + v + 1] = 1.0}\n result\n end",
"def outputs\n data[:outputs]\n end",
"def outputs\n [Graph::OperationOutput.from_index(self.value_handle, 0)]\n end",
"def calculate(nn)\n val = lambda do |curr, net, x, y|\n curr * 0.95 + 0.05 * (net.feed_forward([x, y]) * 280.0 - 140.0)\n end\n @z = (0...cols).map do |i|\n (0...rows).map do |j|\n val.call(z[i][j], nn, i * 1.0 / cols, j * 1.0 / cols)\n end\n end\n end",
"def feedforward(input_values)\n input_values.each_index do |input_index|\n @activation_nodes.first[input_index] = input_values[input_index]\n end\n @weights.each_index do |n|\n @structure[n+1].times do |j|\n sum = 0.0\n @activation_nodes[n].each_index do |i|\n sum += (@activation_nodes[n][i] * @weights[n][i][j])\n end\n @activation_nodes[n+1][j] = @propagation_function.call(sum)\n end\n end\n end",
"def calculate( input )\n update_with_vector( input )\n end",
"def calculate_in_state(state, *args)\r\n with_state_scope state do\r\n calculate(*args)\r\n end\r\n end",
"def activation_output(w, x)\n sum = (0..@feature_count-1).inject(0.0) { |sum, i| (sum + (w[i] * x[i])) }\n ((sum + @bias) >= @theta) ? 1 : 0\nend",
"def get_outputs()\n return @outputs\n end",
"def closure! \n cstart = new_state\n cend = new_state\n\n add_transition(cstart, cend, \"\")\n add_transition(cend, cstart, \"\")\n\n add_transition(cstart, @start, \"\")\n @final.keys.each { |key| add_transition(key, cend, \"\")}\n\n set_start(cstart)\n @final.keys.each { |key| set_final(key, false)}\n set_final(cend, true)\n\n\n end",
"def compute_state # {{{\n\n player_moves = []\n ki_moves = []\n\n player_moves = self.get_moves_as_hash true\n ki_moves = self.get_moves_as_hash false\n\n return WON if has_winning_combination player_moves\n return LOST if has_winning_combination ki_moves\n\n return DRAWN if player_moves.count + ki_moves.count == 3*3\n\n RUNNING\n end",
"def closure! \n\t\ttemp = new_state\n\t\tadd_transition(temp, @start, \"\")\n\t\t@start = temp\n\t\ttemp = new_state\n\t\t@final.keys.sort.each { |x| \n\t\tadd_transition(x, temp, \"\") \n\t\tset_final(x, false) }\n\t\t\n\t\t@final = {temp=>true}\n\t\tadd_transition(@start, temp, \"\")\n\t\tadd_transition(temp, @start, \"\")\n\t\t@state.delete(nil)\n\t\t@transition.delete(nil)\n end",
"def train\n @weights.each_index do |i| \n # alter weight and apply momentum\n @weights[i] = @weights[i] + (@rate * inputs[i] * @gradient)\n @weights[i] = @weights[i] + @momentum * @lastchange\n \n @lastchange = @rate * inputs[i] * @gradient\n end\n @weights\n end",
"def train(iterations=1)\n all_errors = []\n\n 1.upto(iterations) do |iteration|\n arguments = input_proc.call\n target_outputs = target_proc.call(*arguments)\n inputs = inputs_with_bias(arguments)\n actual_outputs = compute(*inputs)\n errors = actual_outputs.zip(target_outputs).map { |actual, target| target - actual }\n\n number_of_outputs.times do |i|\n number_of_medial_neurons.times do |j|\n @syntwo[j][i] += (learning_rate * @medout[j] * errors[i])\n end\n end\n\n sigma = []\n sigmoid = []\n\n number_of_medial_neurons.times do |i|\n sigma[i] = 0\n number_of_outputs.times do |j|\n sigma[i] = sigma[i] + errors[j] * @syntwo[i][j]\n end\n sigmoid[i] = 1 - @medout[i]**2\n end\n\n number_of_inputs.times do |i|\n number_of_medial_neurons.times do |j|\n delta = learning_rate * sigmoid[j] * sigma[j] * inputs[i]\n @synone[i][j] += delta\n end\n end\n\n overall_error = Math.sqrt(errors.map { |e| e**2 }.inject(:+))\n print \"\\r[#{iteration}] error: #{overall_error}\"\n\n all_errors << overall_error\n @training_iterations += 1\n end\n\n new_average_error = all_errors.inject(:+) / all_errors.length\n if @average_error.nil?\n puts \"\\rAverage error is now #{new_average_error}\"\n else\n better_or_worse = (@average_error - new_average_error) > 0 ? 'BETTER' : 'WORSE'\n puts \"\\rAverage error is #{better_or_worse} (#{@average_error} => #{new_average_error})\"\n end\n @average_error = new_average_error\n end",
"def output(input)\n result = input.zip(weights).inject(0) do |result, temp_array|\n result + temp_array[0] * temp_array[1]\n end\n (result > threshold)? 1 : 0\n end",
"def activate\n @output = (1.0 / (1.0 + Math.exp(-1 * self.weightedsum - @bias)))\n @output\n end",
"def before_validate\n self.previous_output :alias => 'PREVOUT' unless self.previous_output\n self.outputs<< output(0) if self.outputs.empty?\n super\n end",
"def evolve\n\n new_state = Array.new(height) {Array.new(width)}\n\n (0...@height).each do |row|\n (0...@width).each do |cell|\n neighbors_alive = calculate_living_neighbors(row, cell)\n cell_value = @state[row][cell]\n\n if cell_value == 1 and (neighbors_alive < 2 or neighbors_alive > 3)\n new_state[row][cell] = 0\n elsif cell_value == 0 and neighbors_alive == 3\n new_state[row][cell] = 1\n else\n new_state[row][cell] = cell_value\n end\n end\n end\n @state = new_state\n end",
"def initialize(inputNodes, hiddenNodes, outputNodes, learningRate=0.3, momentum=0.2)\n # Make sure we add the bias node to the input\n @inputNodes = inputNodes + 1\n @hiddenNodes = hiddenNodes\n @outputNodes = outputNodes\n\n @learningRate = learningRate\n @momentum = momentum\n\n @w_1 = NeuralNetwork::create_matrix(@inputNodes, @hiddenNodes, 0.0)\n @w_2 = NeuralNetwork::create_matrix(@hiddenNodes, @outputNodes, 0.0)\n \n # Randomize the values of Nthe nodes [-0.5, 0.5]\n @w_1.map! { |arr| arr.map { |v| rand(-0.5..0.5) } }\n @w_2.map! { |arr| arr.map { |v| rand(-0.5..0.5) } }\n\n # It helps to store the current state of node activations\n @activation_input = [1.0] * @inputNodes\n @activation_hidden = [1.0] * @hiddenNodes\n @activation_output = [1.0] * @outputNodes\n\n @din = NeuralNetwork::create_matrix(@inputNodes, @hiddenNodes, 0.0)\n @dout = NeuralNetwork::create_matrix(@hiddenNodes, @outputNodes, 0.0)\n\n puts \"\\n================================================================================================\\n[+]Weights from input to hidden nodes [#{@inputNodes}x#{@hiddenNodes}] has been initialized with small random values\"\n puts \"[+]Weights from hidden to output nodes [#{@hiddenNodes}x#{@outputNodes}] has been nitialized to small random values\\n================================================================================================\\n\"\n\n puts \"Neural network initialized with values \\n \\t Input Nodes:[{#{@inputNodes}]\\t Hidden Nodes: [#{@hiddenNodes}]\\t Output Nodes: [#{@outputNodes}]} \\n--------------------------------------------------------------------------------\\n\"\n puts \"\"\n\n end",
"def num_outputs\n Tensorflow::TF_OperationNumOutputs(c)\n end",
"def feed_forward(input)\n reset_all_nodes\n\n # Check for wrong number of inputs\n unless input.length == first_layer_nodes.length\n return \"ERROR - wrong number of inputs.\"\n end\n\n puts \"LAYER 1 INPUTS\"\n # Pass input values to first layer of nodes\n loop_over_nodes(0) do |i|\n node = first_layer_nodes[i]\n node.total_input = input[i]\n node.save\n end\n\n # For each layer but the last, pass activation down\n (num_layers - 1).times do |layer_num|\n cur_layer_nodes = layer_n_nodes(layer_num)\n # For each node in this layer, use the total input to calculate the output\n loop_over_nodes(layer_num) do |i|\n node = cur_layer_nodes[i]\n node.update_output\n #For each child of this node, add to that node's total input\n node.send_output_to_children\n end\n end\n\n # Once we've fed forward to the last layer, calculate last layer's output\n loop_over_nodes(num_layers - 1) do |i|\n node = last_layer_nodes[i]\n node.update_output\n end\n end",
"def finished_states\n states - transitive_states\n end",
"def feed_forward\n # light up the input nodes corresponding to the\n # words in our query\n word_ids.size.times do |i|\n all_in[i] = 1.0\n end\n \n # hidden activations\n hidden_ids.size.times do |j|\n sum = 0.0\n word_ids.size.times do |i|\n sum += all_in[i] * weights_in[i][j]\n end\n all_hidden[j] = Math.tanh(sum)\n end\n\n #output activations\n url_ids.size.times do |k|\n sum = 0.0\n hidden_ids.size.times do |j|\n sum += all_hidden[j] * weights_out[j][k]\n end\n all_out[k] = Math.tanh(sum)\n end\n\n all_out\n end",
"def calculateOutput(entradas)\n guardarEntradas(entradas)\n y = []\n for i in 0..(@numNeuronas-1)\n sum = 0\n for k in 0..(@entradas.length-1)\n sum = sum + matrixWeights[i][k] * @entradas[k]\n end\n sum = sigmoide(sum+@umbral[i], 30)\n y << sum\n end\n @salidas = y\n end",
"def feedback(eta, delta)\n @grad = delta * (B / A) * (A - @sigmoid) * (A + @sigmoid);\n eta_grad = eta * @grad;\n @wn.each_index {|i|\n @wn[i] += eta_grad * @xn[i];\n }\n end",
"def compute_values \n arr = inputs_matrix.map{|e| @evaluator.call(*e)}\n matrix = NArray[arr].reshape(@width, @height)\n end",
"def calculate\n @equations = self.class.permutate(@inputs, @operators)\n @results = {}\n @equations.each do |eq|\n @results[eq] = eval(eq)\n end\n end",
"def update\n @time+=1\n temp_map = {}\n @update_map.each { |k, v| temp_map[k-1] = v }\n @update_map = temp_map\n\n update_set = @update_map.delete(0)\n return unless update_set\n\n update_set.each do |component|\n component.update_inputs\n end\n\n yield if block_given?\n\n update_set.each do |component|\n component.update_outputs\n end\n\n self.changed = true\n end",
"def reqd_and_opt_params_combination_results\n if @r_output.empty?\n @o_output\n elsif @o_output.empty?\n @r_output\n else\n @r_output.product(@o_output) if !(@r_output.empty? && @o_output.empty?) \n end \n end",
"def run(inputs, outputs, targets)\n \tinputNames = Tensorflow::String_Vector.new\n \tinputValues = Tensorflow::Tensor_Vector.new\n if inputs != nil\n \t inputs.each do |key, value|\n \t\t inputValues.push(value)\n \t\t inputNames.push(key)\n \t end\n end\n\n \toutputNames = Tensorflow::String_Vector.new\n \toutputs.each do |name|\n \t\toutputNames.push(name)\n \tend\n\n \ttargetNames = Tensorflow::String_Vector.new\n if targets != nil\n \t targets.each do |name|\n \t\t targetNames.push(name)\n \t end\n end\n\n \toutputValues = Tensorflow::Tensor_Vector.new\n \tstatus = Tensorflow::TF_NewStatus()\n\t Tensorflow::TF_Run_wrapper(self.session , inputNames, inputValues, outputNames, outputValues, targetNames, self.status)\n raise (\"Incorrect specifications passed.\") if Tensorflow::TF_GetCode(status) != Tensorflow::TF_OK\n output_array = []\n (0..outputValues.size - 1).each do |i|\n size = Tensorflow::tensor_size(outputValues[i])\n type = Tensorflow::TF_TensorType(outputValues[i])\n\n case type\n when Tensorflow::TF_DOUBLE\n c_array = Tensorflow::Double.new(size)\n Tensorflow::double_reader(outputValues[i], c_array, size)\n when Tensorflow::TF_INT64\n c_array = Tensorflow::Long_long.new(size)\n Tensorflow::long_long_reader(outputValues[i], c_array, size)\n when Tensorflow::TF_INT32\n c_array = Tensorflow::Int.new(size)\n Tensorflow::int_reader(outputValues[i], c_array, size)\n when Tensorflow::TF_COMPLEX128\n c_array = Tensorflow::complex_reader(outputValues[i])\n else\n raise \"Data type not supported.\"\n end\n\n num_dimensions = Tensorflow::TF_NumDims(outputValues[i])\n out_dimension = []\n (0..num_dimensions - 1).each do |j|\n out_dimension.push(Tensorflow::TF_Dim(outputValues[i], j))\n end\n output = []\n (0..size - 1).each do |j|\n output.push(c_array[j])\n end\n out_dimension.reverse!\n (0..out_dimension.length - 2).each do |k|\n total_dim = output.length\n dim_array = []\n temp_array = []\n (0..total_dim - 1).each do |ind|\n temp_array.push(output[ind])\n dim_array.push(temp_array) if (temp_array.length == out_dimension[k])\n temp_array = [] if (temp_array.length == out_dimension[k])\n end\n output = dim_array\n end\n output_array.push(output)\n end\n output_array\n end",
"def evolve\n\n neighbors_array = Array.new\n\n next_state = @state.clone\n\n 0.upto(@state.length - 1){|row|\n neighbors_array << Array.new(size=@state.length)\n }\n\n 0.upto(@state.length - 1){|row|\n 0.upto(@state.length - 1){|col|\n neighbor_count = 0\n for i in (-1..1)\n (row + i > (@state.length - 1)) ? i = (0 - (@state.length - 1)) : nil\n for j in (-1..1)\n (col + j > (@state.length - 1)) ? j = (0 - (@state.length - 1)) : nil\n neighbor_count += @state[row+i][col+j] unless (row+i == row && col+j == col)\n end\n end\n neighbors_array[row][col] = neighbor_count\n }\n }\n\n 0.upto(@state.length - 1){|row|\n 0.upto(@state.length - 1){|col|\n if @state[row][col] == 1 # Current state is \"Life\"\n if neighbors_array[row][col] < 2 || neighbors_array[row][col] > 3\n @state[row][col] = 0\n end\n else # Current state is \"Dead\"\n if neighbors_array[row][col] == 3\n @state[row][col] = 1\n end\n end\n }\n }\n\n @state\n\n end",
"def output(i)\n out = Tensorflow::Output.new\n out.operation = self\n out.index = i\n out\n end",
"def input_of_loss\n if node.demand\n node.demand - node.inputs.reject(&:loss?).map(&:external_value).compact.sum\n else\n 0.0\n end\n end",
"def weight_adjustment_outputs(learning_rate,synapse,output_desired,neurons_array)\n\t\n\tfor i in 0...neurons_array.size\n\t\tdelta=Array.new\t\n\t\tfor j in 0...synapse.size \n\t\tdelta.push(-2*learning_rate*(synapse[j].print_value - output_desired[j])*synapse[j].print_value*(1-synapse[j].print_value)*neurons_array[i].print_value)\n\t\tend\n\t\tneurons_array[i].adjust_weight(delta)\n\tend\nend",
"def final_state(state)\n final_states(state)\n end",
"def total_input\n @inputs.inject(:+)\n end",
"def r2\n @n_predictors.times.inject(0) {|ac,i| ac+@coeffs_stan[i]* @matrix_y[i,0]} \n end",
"def predicted(prev_input)\n prev_input.each do |cell|\n if @distral.key?(cell.proximal)\n @distral[cell.proximal] += Config::SYNAPSE_INCR\n Config.strongest_connection = @distral[cell.proximal] if @distral[cell.proximal] > Config.strongest_connection\n else\n @distral.merge!({cell.proximal => 0.1})\n end\n end\n\n # Decays the relationships\n Thread.new {\n @distral.each do |syn, strength|\n strength -= Config::SYNAPSE_EXPIRE\n @distral.delete(syn) if strength < Config::SYNAPSE_DELETE\n end\n }\n nil\n end",
"def feed(data)\n input = []\n hidden = []\n @ilayer.each_index do |i|\n @ilayer[i].inputs = [data[i]]\n input[i] = @ilayer[i].activate\n end\n @hlayer.each_index do |h| \n @hlayer[h].inputs = input\n hidden[h] = @hlayer[h].activate\n end\n @olayer.each_index do |o| \n @olayer[o].inputs = hidden\n @output[o] = @olayer[o].activate\n end\n @output\n end",
"def predictor\n w = perceptron\n\n train_data = normalize_data(\"votes-test.csv\")\n actual_values = train_data.map { |x| x.last }\n predictions = train_data.map { |x| activation_output(x.first, w) }\n\n wrong = (0..actual_values.length-1).select { |i| actual_values[i] != predictions[i] }.count\n correct = actual_values.length - wrong\n\n p \"CORRECT: #{correct}\"\n p \"WRONG: #{wrong}\"\nend",
"def outputs\n @stack.outputs\n end",
"def output\n return nil if input_wires.any?\n\n case gate\n when \"AND\"\n values[0] & values[1]\n when \"OR\"\n values[0] | values[1]\n when \"NOT\"\n ~values[0]\n when \"LSHIFT\"\n values[0] << values[1]\n when \"RSHIFT\"\n values[0] >> values[1]\n else\n values[0]\n end\n end",
"def process(step)\n step.inputs.each do |key, val|\n @inputs[key] = val unless @inputs.key?(key) || @outputs.key?(key)\n end\n @outputs.merge!(step.outputs)\n end",
"def tabulate_outcomes(state)\n #return early if we have a cached solution for the given [state]\n if out = @TAB_CACHE[state.board_bits]\n return out\n end\n \n @iteration_count += 1\n out = {x: 0, o: 0, cat:0}\n \n #if this state has a winner, it's easy\n if w = state.winner\n out[w] = 1\n case w\n when @opponent\n out[:worst] = -1\n when @playing_mark\n out[:worst] = 1\n else\n out[:worst] = 0\n end\n \n return out\n end\n \n #loop through each possible move\n state.legal_moves.each do |q|\n outcomes = tabulate_outcomes q\n \n #raw counts\n [:x, :o, :cat].each {|k| out[k] += outcomes[k]}\n \n #if it's the other player's turn assume they make the best move they can, and vice versa\n if state.next_turn_taker == @opponent\n out[:worst] = outcomes[:worst] if (!out[:worst] || (outcomes[:worst] < out[:worst]))\n else\n out[:worst] = outcomes[:worst] if (!out[:worst] || (outcomes[:worst] > out[:worst]))\n end\n end\n \n cache_solution(state, out)\n \n return out\n end",
"def run\n inputA = 0\n ampA = Intcode::Computer.new(@program, [@phaseA, inputA])\n outputA = ampA.run\n\n inputB = outputA\n ampB = Intcode::Computer.new(@program, [@phaseB, inputB])\n outputB = ampB.run\n\n inputC = outputB\n ampC = Intcode::Computer.new(@program, [@phaseC, inputC])\n outputC = ampC.run\n\n inputD = outputC\n ampD = Intcode::Computer.new(@program, [@phaseD, inputD])\n outputD = ampD.run\n\n inputE = outputD\n ampE = Intcode::Computer.new(@program, [@phaseE, inputE])\n outputE = ampE.run\n end",
"def previous_output\n @prev_out.reverse.unpack(\"H*\")[0]\n end",
"def anneal\n step = 0\n self.start = Time.now\n\n # Precompute factor for exponential cooling from Tmax to Tmin\n if self.tmin <= 0.0\n raise 'Exponential cooling requires a minimum temperature greater than zero.'\n end\n t_factor = -Math.log(self.tmax.to_f / self.tmin)\n\n # Note initial state\n t = self.tmax\n e = self.energy\n\n prev_state = self.state.dup\n prev_energy = e\n best_state = self.state.dup\n best_energy = e\n\n trials, accepts, improves = 0, 0, 0\n if self.updates > 0\n update_wavelength = self.steps / self.updates\n self.update(step, t, e, nil, nil)\n end\n\n # Attempt moves to new states\n while step < self.steps\n step += 1\n t = self.tmax * Math.exp(t_factor * step / self.steps)\n self.move\n e = self.energy\n dE = e - prev_energy\n trials += 1\n\n if dE > 0.0 and Math.exp(-dE / t) < rand()\n # Restore previous state\n self.state = prev_state.dup\n e = prev_energy\n else\n # Accept new state and compare to best state\n accepts += 1\n if dE < 0.0\n improves += 1\n end\n\n prev_state = self.state.dup\n prev_energy = e\n\n if e < best_energy\n best_state = self.state.dup\n best_energy = e\n end\n end\n\n if self.updates > 1\n if step / update_wavelength > (step - 1) / update_wavelength\n self.update(step, t, e, accepts.to_f / trials, improves.to_f / trials)\n trials, accepts, improves = 0, 0, 0\n end\n end\n\n break if best_energy == 0.0\n end\n\n # line break after progress output\n puts\n\n self.state = best_state.dup\n\n # Return best state and energy\n return [best_state, best_energy]\n\n end",
"def run(inputs, normalize_outputs = true)\n outputs = fann.run(inputs)\n if normalize_outputs\n return outputs.map { |value| value / normalization_factor }\n else\n return outputs\n end \n end",
"def find_best(inputs, runner)\n best_settings, best_output = inputs, 0\n inputs.permutation.each do |p|\n amps = make_amps(p)\n amps[0].send_input(0)\n output = runner.call(amps)\n #output = amps.last.read_output\n if output && output > best_output\n best_output = output\n best_settings = p\n end\n end\n return best_settings, best_output\nend",
"def update_neural_network(outcome)\n # push the final reward onto the nextmax log from the point of view of the player\n recalc_next_q_max_log if @use_target_network\n @next_q_max_log << (@value * outcome + 1.0)/2.0\n index = @action_log.size - 1\n while index >= 0\n inputs = board_to_nn_inputs(@state_log[index])\n outputs = @q_values_log[index]\n # replace the q value of the move made with the discounted observation\n outputs[@action_log[index]] = DISCOUNT * @next_q_max_log[index]\n # do one training step\n @fann.train(inputs, outputs)\n index -= 1\n end\n # append the logs to the experience replay log and shift out if size is reached.\n @games_played += 1\n @experience_replay_log << {next_q_max: @next_q_max_log, state: @state_log, q_values: @q_values_log, actions: @action_log}\n @experience_replay_log.shift if @experience_replay_log.size > 100\n # reset the logs after one round of learning (so after each game)\n reset_logs\n experience_replay if @games_played.modulo(100) == 0 && @use_experience_replay\n update_target_network if @games_played.modulo(100) == 0 && @use_target_network\n end",
"def forward_prediction\n return @x + MOVE[@f][:x], @y + MOVE[@f][:y]\n end",
"def state\n case [@c2, @c1, @c0]\n when [0,0,0] then \"Z -> Z\"\n when [0,0,1] then \"X + Y\"\n when [0,1,0] then \"rotate x\"\n when [0,1,1] then \"x & y\"\n when [1,0,0] then \"x | y\"\n when [1,0,1] then \"x ^ y\"\n when [1,1,0] then \"~ x\"\n when [1,1,1] then \"x == y\"\n else raise RuntimeError.new \"wrong alu operation: #{ [@c2, @c1, @c0] }\"\n end\n end",
"def calculate\n\t\tplace_in_containers()\n\n\t\t# Checks for mismatch between the number of operands and operators.\n\t\t# The only valid number of operators for N operands is (N - 1).\n\t\tunless @operands.size - @operators.size == 1\n\t\t\t@valid = false\n\t\t\t@errors.push(\"Operand/Operator mismatch.\")\n\t\tend\n\n\t\t# Checks for operators present before the first two operands\n\t\t# are written. This is incorrect RPN syntax.\n\t\tif (@instructions[0..1] & [1010, 1011, 1100, 1101]).any?\n\t\t\t@valid = false\n\t\t\t@errors.push(\"Operator present before first two operands.\")\n\t\tend\n\n\t\t# Checks for an empty operand stack. In this case, there is\n\t\t# nothing more to do in the method.\n\t\tif @operands.empty?\n\t\t\t@errors.push(\"No operands.\")\n\t\t\treturn [0, false]\n\t\tend\n\n\t\t# Runs a loop until fewer than two operands or fewer than 1\n\t\t# operators are present in their respective containers.\n\t\tuntil @operands.size == 1 || @operators.size == 0 do\n\t\t\t# Pops the first operator from the front of the queue.\n\t\t\toperator = @operators.shift\n\n\t\t\t# Pops the top and second-to-top operands off of the stack.\n\t\t\topright = @operands.pop\n\t\t\topleft = @operands.pop\n\n\t\t\t# Returns prematurely before division by zero occurs.\n\t\t\tif operator == \"/\" && opright == 0\n\t\t\t\tputs \"division by zero\"\n\t\t\t\treturn [0, false]\n\t\t\tend\n\n\t\t\t# Sends the operator and the right operand to the left operand\n\t\t\t# and thereby invokes FixedNum#+, the method used for adding\n\t\t\t# integers.\n\t\t\t@operands.push(opleft.send(operator, opright))\n\t\tend\n\n\t\t# Returns the last element of @operands and the value of @valid.\n\t\t[@operands[-1], @valid]\n\tend",
"def initialize\n @x = Array.new\n @y = Array.new\n @output = Array.new\n @weights = [0.0001,0.0001,0.0001]\n end",
"def dj_dp0(p0, p1)\n raise \"Training set x,y array sizes are not equal\" if @x_t.length != @y_t.length\n sum = 0.0\n for i in 0...@m\n sum += (p0 + p1*@norm_x_t[i] - @norm_y_t[i])\n end\n sum/@m\n end",
"def input\n sleep 0.05 # to follow the computed actions\n\n if q_table.nil?\n initialize_random_q_table\n else\n calculate_q_table_state\n end\n\n # capture current stuff\n @old_score = game.score\n @old_state = x\n\n # maybe do something random (chance: epsilon)\n @action_taken_index =\n if r.rand > epsilon\n r.rand(actions.length).round\n else\n q_table[x].each_with_index.max[1]\n end\n\n actions[action_taken_index]\n end",
"def outlinks\n return @outputs\n end",
"def inputs_with_bias(inputs)\n result = inputs.dup\n result << bias_neuron if bias_neuron\n result\n end",
"def recalculate\n end",
"def forward\n new_x, new_y = forward_prediction\n reset(x: new_x, y: new_y, f: @f)\n end",
"def add_trans state1, input, state2\n @states << state1 << state2\n @inputs << input\n @transition[state1] ||= {}\n @transition[state1][input] ||= Set.new\n @transition[state1][input] << state2\n end",
"def mult_inputs\n array_element_mult(@input_weights, @input_layer.neuron).inject(1) {|product,n| product*n}\n end",
"def closure!\ns0 = new_state\ns1 = new_state\nadd_transition(s0, @start, \"\")\n# reset the final states of the current object\nkeys = @final.keys\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\nset_final(keys[i], false)\ni = i + 1\nend\nadd_transition(s0, s1, \"\")\nadd_transition(s1, s0, \"\")\nset_start(s0)\nset_final(s1, true)\nend",
"def process!\n # initialize values\n previous_state, previous_time = @input.readline.split(\" \")\n\n until @input.eof?\n state, time = @input.readline.split(\" \")\n\n # for the last state, always print the duration even if it hasn't flipped\n if @input.eof?\n duration = time.to_i - previous_time.to_i\n @output.puts \"#{previous_state} #{duration}\"\n break\n else\n # didn't flip in state, look ahead\n next if state == previous_state\n\n duration = time.to_i - previous_time.to_i\n @output.puts \"#{previous_state} #{duration}\"\n\n previous_state, previous_time = state, time\n end\n end\n rescue EOFError => e\n end",
"def y()\n val = @b;\n @n.times {|i|\n val += @wn[i] * @xn[i];\n }\n return val;\n end",
"def final_states(*states)\n @subject.final_states = states\n end",
"def recalculate\n\tend",
"def states\n is = (0...grid.size).to_a\n js = (0...grid.first.size).to_a\n is.product(js).select { |i, j| grid[i][j] } + [:stop]\n end"
] |
[
"0.6296793",
"0.6294282",
"0.623522",
"0.609978",
"0.60850793",
"0.5925469",
"0.5862122",
"0.58526295",
"0.5842642",
"0.58360034",
"0.574824",
"0.569011",
"0.5656981",
"0.56289864",
"0.5625252",
"0.56249505",
"0.56169045",
"0.55655867",
"0.5533506",
"0.5529095",
"0.54761755",
"0.5339735",
"0.5331232",
"0.53277504",
"0.5309061",
"0.5276099",
"0.52456564",
"0.52404946",
"0.5197497",
"0.5197497",
"0.5176037",
"0.5168809",
"0.5160523",
"0.5160044",
"0.51554954",
"0.51536137",
"0.5142011",
"0.5124105",
"0.5117348",
"0.5111032",
"0.5104947",
"0.5094296",
"0.5078331",
"0.5077988",
"0.50699097",
"0.50673705",
"0.5057712",
"0.5054737",
"0.5037843",
"0.5020407",
"0.4960605",
"0.49591663",
"0.49250758",
"0.4913513",
"0.49092618",
"0.49092332",
"0.48904648",
"0.48883867",
"0.4878642",
"0.48737347",
"0.486218",
"0.48503637",
"0.48485315",
"0.48411417",
"0.48347598",
"0.4830255",
"0.48251274",
"0.48241806",
"0.48138863",
"0.48073068",
"0.48048902",
"0.47979152",
"0.478874",
"0.4781781",
"0.47711802",
"0.47442394",
"0.4738042",
"0.47375134",
"0.47329828",
"0.47326356",
"0.47295806",
"0.4729545",
"0.47288358",
"0.47255883",
"0.47200555",
"0.47194263",
"0.4710764",
"0.4706266",
"0.47026283",
"0.47022572",
"0.46933556",
"0.4693234",
"0.46921316",
"0.46852982",
"0.4684415",
"0.46827832",
"0.4681311",
"0.46718577",
"0.46713218",
"0.46696532",
"0.4664676"
] |
0.0
|
-1
|
Initializes a Twitch client. client_id [String] The client ID. Used as the ClientID header in a request. access_token [String] An access token. Used as the Authorization header in a request. Any "Bearer " prefix will be stripped. with_raw [Boolean] Whether to include raw HTTP response Intended for testing/checking API results
|
def initialize(client_id: nil, access_token: nil, with_raw: false)
if client_id.nil? && access_token.nil?
raise "An identifier token (client ID or bearer token) is required"
elsif !!client_id && !!access_token
warn(%{WARNING:
It is recommended that only one identifier token is specified.
Unpredictable behavior may follow.})
end
headers = {
"User-Agent": "twitch-api ruby client #{Twitch::VERSION}"
}
unless client_id.nil?
headers["Client-ID"] = client_id
end
unless access_token.nil?
access_token = access_token.gsub(/^Bearer /, "")
headers["Authorization"] = "Bearer #{access_token}"
end
@conn = Faraday.new(API_ENDPOINT, { headers: headers }) do |faraday|
faraday.request :json
faraday.response :json
faraday.adapter Faraday.default_adapter
end
@with_raw = with_raw
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(options = {})\n client_id = options[:client_id]\n\n @oauth2_client = TwitchOAuth2::Client.new(\n client_id: client_id, **options.slice(:client_secret, :redirect_uri, :scopes)\n )\n\n @token_type = options.fetch(:token_type, :application)\n\n @tokens = @oauth2_client.check_tokens(\n **options.slice(:access_token, :refresh_token), token_type: @token_type\n )\n\n CONNECTION.headers['Client-ID'] = client_id\n\n renew_authorization_header if access_token\n end",
"def initialize(client_id, access_token=nil, callback=nil)\n @client_id = client_id\n @access_token = access_token\n @format = :json\n @callback = callback\n end",
"def initialize(client_id:, client_secret:, token:, refresh_token:, expires_at:)\n @basic_token = Base64.strict_encode64(\"#{client_id}:#{client_secret}\")\n\n @oauth2_client = OAuth2::Client.new(client_id, client_secret,\n authorize_url: 'https://www.fitbit.com/oauth2/authorize',\n token_url: 'https://api.fitbit.com/oauth2/token')\n\n opts = { refresh_token: refresh_token,\n expires_at: expires_at }\n @access_token = OAuth2::AccessToken.new(@oauth2_client, token, opts)\n end",
"def initialize\n self.http_client = HTTPClient.new(:base_url => Rdioid::BASE_URL, :force_basic_auth => true)\n\n http_client.set_auth(Rdioid::OAUTH_TOKEN_ENDPOINT, Rdioid.config.client_id, Rdioid.config.client_secret)\n end",
"def initialize(client_id=nil,client_secret=nil)\n @client_id = client_id\n @client_secret = client_secret\n req1 = RestClient.post(\"https://services.rdio.com/oauth2/token\",\n \"grant_type=client_credentials&client_id=#{@client_id}&client_secret=#{@client_secret}\")\n @access_token = JSON.parse(req1)[\"access_token\"]\n end",
"def init\n\t\tuser_credentials = {\n\t\t\t:access_token => access_token,\n\t\t\t:refresh_token => refresh_token,\n\t\t\t:expires_at => Time.now + expires_in\n\t\t}\n\n client_id = '694fc2f618facf30b3b41726ee6d0ac04c650669ca3d114cb0bae4223cecade3'\n client_secret = '3e7cfd07d829211ac50dd6486fe677ca76e965f25ad7d68e67e845e0d4a213e7'\n\t\tCoinbase::OAuthClient.new(client_id, client_secret, user_credentials)\n\tend",
"def initialize(client_id, client_secret, version='v4', base='https://platform.pokitdok.com')\n @client_id = client_id\n @client_secret = client_secret\n @version = version\n\n @api_url = \"#{base}/api/#{version}\"\n @client = OAuth2::Client.new(@client_id, @client_secret,\n site: @api_url, token_url: '/oauth2/token')\n\n\n @scopes = {}\n @scopes['default'] = { scope: refresh_token }\n scope 'default'\n end",
"def initialize(config)\n @config = config\n @api_client = ApiClient.new(config)\n @access_token = nil\n end",
"def initialize(config)\n @config = config\n @api_client = ApiClient.new(config)\n @access_token = nil\n end",
"def initialize\n @client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV['CONSUMER_KEY']\n config.consumer_secret = ENV['CONSUMER_SECRET']\n config.access_token = ENV['ACCESS_TOKEN']\n config.access_token_secret = ENV['ACCESS_TOKEN_SECRET']\n end\n end",
"def create_client(oauth)\n\t\t@client = Twitter::REST::Client.new(\n\t\t\tconsumer_key: oauth[\"consumer_key\"],\n\t\t\tconsumer_secret: oauth[\"consumer_secret\"],\n\t\t\taccess_token: oauth[\"access_token\"],\n\t\t\taccess_token_secret: oauth[\"access_token_secret\"]\n\t\t\t)\n\tend",
"def initialize(client_id:, client_secret:, access_token: nil, transport: Faraday)\n @client_id = client_id.to_s\n @client_secret = client_secret.to_s\n @access_token = access_token.to_s\n @transport = transport\n end",
"def initialize(client_id=nil, client_secret=nil, callback_url=nil, *args)\n opts = (args.last.is_a?(Hash) ? args.last : {}).with_indifferent_access\n\n opts.delete_if { |k, v| v.nil? }.reverse_merge!(default_tout_configuration)\n\n @client_id = client_id\n @client_secret = client_secret\n @access_token = opts[:access_token]\n @callback_url = callback_url\n @uri_scheme = opts[:uri_scheme]\n @uri_host = opts[:uri_host]\n @uri_port = opts[:uri_port]\n @uri_base_path = opts[:uri_base_path]\n @uri_version = opts[:uri_version]\n @auth_site = opts[:auth_site]\n @authorize_url = opts[:authorize_url]\n @token_url = opts[:token_url]\n @email = opts[:email]\n @password = opts[:password]\n end",
"def initialize(client_id, client_secret, opts={})\n self.options = opts.dup\n self.token_method = self.options.delete(:access_token_method) || :post\n adapter = self.options.delete(:adapter)\n ssl_opts = self.options.delete(:ssl) || {}\n connection_opts = ssl_opts ? {:ssl => ssl_opts} : {}\n self.id = client_id\n self.secret = client_secret\n self.site = self.options.delete(:site) if self.options[:site]\n self.connection = Faraday::Connection.new(site, connection_opts)\n self.json = self.options.delete(:parse_json)\n self.raise_errors = !(self.options.delete(:raise_errors) == false)\n\n if adapter && adapter != :test\n connection.build do |b|\n b.adapter(*[adapter].flatten)\n end\n end\n end",
"def initialize(client_id, application_secret, redirect_uri, access_token = nil)\n # The client_id must be a Integer\n raise PutioError::ClientIDInvalid unless client_id.to_s.is_i?\n\n # Store arguments as instance variables\n @client_id = client_id\n @application_secret = application_secret\n @redirect_uri = redirect_uri\n @access_token = access_token || nil\n end",
"def special_client\n @special_client ||= Twitter::REST::Client.new do |c|\n c.consumer_key = configure[:consumer_key]\n c.consumer_secret = configure[:consumer_secret]\n c.access_token = configure[:access_token]\n c.access_token_secret = configure[:access_token_secret]\n end\n end",
"def initialize(client_id, client_secret, refresh_token)\n merge!(\n {\n client_id: client_id,\n client_secret: client_secret,\n refresh_token: refresh_token,\n grant_type: \"refresh_token\"\n }\n )\n end",
"def build_client(access_token)\n begin\n client = Octokit::Client.new(access_token: access_token)\n client.user.login\n rescue Octokit::Unauthorized\n raise 'Please enter valid Personal Auth Token'\n end\n client\n end",
"def client\n @_client ||= Twitter::REST::Client.new do |config|\n config.consumer_key = CONSUMER_KEY\n config.consumer_secret = CONSUMER_SECRET\n config.access_token = ACCESS_TOKEN\n config.access_token_secret = ACCESS_TOKEN_SECRET\n end\n end",
"def client\n @client ||= Twitter::REST::Client.new do |config|\n config.consumer_key = ENV['TWITTER_API_KEY']\n config.consumer_secret = ENV['TWITTER_API_SECRET']\n config.access_token = session['token']\n config.access_token_secret = session['secret']\n end\n end",
"def initialize\n api_key = ENV[\"TWITTER_API_KEY_ID\"]\n api_secret = ENV[\"TWITTER_API_SECRET\"]\n ##will be current_user.access_token\n access_token = ENV[\"TWITTER_ACCESS_TOKEN\"]\n access_token_secret = ENV[\"TWITTER_ACCESS_SECRET_TOKEN\"]\n\n @twitter_client = Twitter::REST::Client.new do |config|\n config.consumer_key = api_key\n config.consumer_secret = api_secret\n config.access_token = access_token\n config.access_token_secret = access_token_secret\n end\n\n end",
"def initialize(config)\n $LOG.i('initializing client')\n @config = config\n @epoint = Upwork::Api::DEFAULT_EPOINT\n\t@url_auth, @url_rtoken, @url_atoken = URI_AUTH, URI_RTOKEN, URI_ATOKEN\n @tenant_id = nil\n\n\t@oauth2_client = OAuth2::Client.new(\n @config.client_id,\n @config.client_secret,\n\t :site => Upwork::Api::BASE_HOST,\n\t :authorize_url => @url_auth,\n\t :token_url => @url_atoken,\n\t :connection_opts => { :headers => {'User-Agent' => 'Github Upwork API Ruby Client' }}\n\t)\n end",
"def set_client\n p \"Fetching twitter client #{@client}\"\n @client ||= Twitter::REST::Client.new do |config|\n config.consumer_key = Rails.application.secrets.twitter_key\n config.consumer_secret = Rails.application.secrets.twitter_secret\n config.access_token = self.twitter_oauth_token\n config.access_token_secret = self.twitter_oauth_token_secret\n end\n end",
"def client\n Octokit::Client.new(:access_token => \"#{token}\")\n end",
"def client\n Twitter::Client.new(\n oauth_token: token,\n oauth_token_secret: token_secret\n )\n end",
"def create_client(oauth)\n\t\t@client = Twitter::Client.new(\n\t\t\t consumer_key: oauth[\"consumer_key\"],\n\t\t\t consumer_secret: oauth[\"consumer_secret\"],\n\t\t\t oauth_token: oauth[\"oauth_token\"],\n\t\t\t oauth_token_secret: oauth[\"oauth_token_secret\"]\n\t\t)\n\tend",
"def initialize(client, limit=RECV_LIMIT)\n @status = false\n @client = client\n @limit = limit\n @client_id = request(Util::MessageCode::GET_CLIENT_ID_REQUEST).client_id\n @set_client_id = Riakpb::RpbSetClientIdReq.new(:client_id => @client_id)\n\n # Request / Response Data\n @resp_message_codes = -1\n @resp_message = []\n @req_message_code = -1\n @req_message = ''\n @response = ''\n end",
"def initialize(client_id, client_secret, opts={})\n @id = client_id\n @secret = client_secret\n @site = opts.delete(:site)\n ssl = opts.delete(:ssl)\n @options = { :authorize_url => '/oauth/authorize',\n :access_token_url => '/oauth/access_token', \n :access_token_method => :post,\n :connection_opts => {},\n :parse_json => false,\n :raise_errors => true }.merge(opts)\n @options[:connection_opts][:ssl] = ssl if ssl\n end",
"def oauth2_client(token, params = {})\n @oauth2_client = RubyLokaliseApi::OAuth2Client.new token, params\n end",
"def twitter_client(access_token, access_token_secret)\n return Twitter::Client.new(\n oauth_token: access_token,\n oauth_token_secret: access_token_secret\n )\n end",
"def client\n @client ||= Twitter::REST::Client.new(client_params)\n end",
"def setup_client(token)\n client = Octokit::Client.new(access_token: token)\n client.auto_paginate = true\n client\n end",
"def initialize(credentials = {})\n self.client_id = credentials[:client_id]\n self.client_secret = credentials[:client_secret]\n self.access_token = credentials[:access_token]\n self.access_token_secret = credentials[:access_token_secret]\n end",
"def initialize(from, to, client_secret)\n @from = from\n @to = to\n @client_secret = client_secret\n @access_token = fetch_access_token\n end",
"def initialize(options)\n required_arguments = %i(client_id client_secret refresh_token)\n raise ArgumentError if required_arguments & options.keys != required_arguments\n\n @client_id = options[:client_id]\n @client_secret = options[:client_secret]\n @access_token = options[:access_token]\n @refresh_token = options[:refresh_token]\n end",
"def setup_client\n @client = Viddler::Client.new(@api_key)\n @client.authenticate!(@username, @password)\n end",
"def octokit_client\n # Check if we already have the octokit client stored in an instance variable else fetch it using\n # the user's access token to authenticate.\n @client ||= Octokit::Client.new :access_token => token\n @client\n end",
"def initialize(client_key, client_secret)\n @client_key = client_key\n @client_secret = client_secret\n end",
"def initialize(api_key)\n @client = HTTPClient.new(\n default_header: {\n 'X-Auth-Token' => api_key,\n 'Content-Type' => 'application/json'\n }\n )\n end",
"def init\n init_oauth_access_token\n end",
"def auth_client(client_id, client_secret, params = {})\n RubyLokaliseApi::OAuth2::Auth.new client_id, client_secret, params\n end",
"def init_client\n client.credentials?\n end",
"def initialize(tokens_and_secrets = {})\n @oauth = KynetxAmApi::Oauth.new(tokens_and_secrets)\n end",
"def client\r\n @client ||= Twitter::REST::Client.new do |config|\r\n config.consumer_key = \"6Qp2jNoS9qOVZMpVNjpBNw\"\r\n config.consumer_secret = \"fm7Xplz3ndNsLgMrBRwHaT6oiaBE78wYO8K013dN8\"\r\n config.access_token = \"1256486036-PoyKFmiz3VtVchgbip875A57HZ5AA3cMxbgWfOk\"\r\n config.access_token_secret = \"N4MehECNc3x658xZb674Ev8TnD5doh5v8sFGYdL0t5J94\"\r\n end\r\nend",
"def initialize(api_key, secret_key, base_url='https://api.att.com')\n\t\t@api_key \t\t = api_key\n\t\t@secret_key = secret_key\n\t\t@base_url = base_url\n\t\t@grant_type = 'client_credentials'\n\t\t@scope = 'SPEECH'\n\t\t@access_token = ''\n\t\t@refresh_token = ''\n\t\t\n\t\tcreate_connection\n\t\tget_tokens\n\t\t\n\t\tself\n\tend",
"def twitter_client\n #Dotenv.load\n @client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV[ 'twitter_api_public']\n config.consumer_secret = ENV[ 'twitter_api_secret' ]\n config.access_token = self.token\n config.access_token_secret = self.secret\n end\n end",
"def init_client; end",
"def initialize(config, user = nil)\n @config = config\n @user = user\n\n options = {\n :consumer_key => config['consumer_key'],\n :consumer_secret => config['consumer_secret'],\n :access_token => user ? user.access_token : config['client_access_token'],\n :access_token_secret => user ? user.secret_token : config['client_secret_token']\n }\n\n super(options)\n end",
"def request_wiz_api_token(client_id, client_secret)\n # Retrieve an OAuth access token to be used against Wiz API\"\n headers = { \"content-type\" => \"application/x-www-form-urlencoded\" }\n payload = \"grant_type=client_credentials&client_id=#{client_id}&client_secret=#{client_secret}&audience=beyond-api\"\n auth_url = \"#{@auth_endpoint}.wiz.io/oauth/token\"\n access_code_call = http_post(auth_url, headers, payload)\n JSON.parse(access_code_call)[\"access_token\"]\n end",
"def client #:nodoc:\n Thread.current[:twitter_client] ||= Twitter::Client.new(\n :consumer_key => oauth[\"consumer_key\"],\n :consumer_secret => oauth[\"consumer_secret\"],\n :oauth_token => oauth[\"oauth_token\"],\n :oauth_secret => oauth[\"oauth_secret\"]\n )\n end",
"def initialize(options = {})\n options = { :access_token => options } if options.is_a? String\n options = self.class.options.merge(options)\n\n # Parse `api_url` option\n if url = options.delete(:api_url)\n uri = URI.parse(url)\n options[:api_scheme] = uri.scheme\n options[:api_host] = uri.host + (uri.port != 80 && uri.port != 443 ? \":#{uri.port}\" : '')\n end\n\n @access_token = options[:access_token] if options[:access_token]\n @api_scheme = options[:api_scheme]\n @api_host = options[:api_host]\n @api_version = options[:api_version]\n @api_prefix = options[:api_prefix]\n @client_token = options[:client_token] if options[:client_token]\n @transport = options[:transport]\n @result_format = options[:result_format]\n\n # Include transport\n transport_module = Lapse::Transport::TRANSPORT_MAP[@transport]\n raise 'Invalid transport' unless transport_module\n self.extend transport_module\n end",
"def twitter\n @client ||= Twitter::REST::Client.new do |config|\n config.consumer_key = Rails.application.secrets.twitter_api_key\n config.consumer_secret = Rails.application.secrets.twitter_api_secret\n config.access_token = token\n config.access_token_secret = secret\n end\n end",
"def client\n @client ||= ::OAuth2::Client.new(\n @consumer_token,\n @consumer_secret,\n :site => 'https://api-ssl.bitly.com',\n :token_url => '/oauth/access_token'\n )\n end",
"def client\n @client ||= Twitter::Client.new(client_config)\n end",
"def twitter\n @client ||= Twitter::REST::Client.new do |config|\n config.consumer_key = Rails.application.secrets.twitter_api_key\n config.consumer_secret = Rails.application.secrets.twitter_api_secret\n config.access_token = token\n config.access_token_secret = secret\n end\n end",
"def initialize(client_id, client_secret, options = {})\n @client_id = client_id.to_s\n @client_secret = client_secret.to_s\n\n options = {\n :self_key => 'WePay',\n :hash_algo => 'sha512',\n }.merge(options)\n\n @self_key = options[:self_key].to_s\n @hash_algo = options[:hash_algo].to_s\n end",
"def set_basic_auth(client, secret)\n FHIR.logger.info 'Configuring the client to use HTTP Basic authentication.'\n token = Base64.encode64(\"#{client}:#{secret}\")\n value = \"Basic #{token}\"\n @security_headers = { 'Authorization' => value }\n @use_oauth2_auth = false\n @use_basic_auth = true\n @client = RestClient\n @client.proxy = proxy unless proxy.nil?\n @client\n end",
"def initialize(client)\n configuration = Configuration.new\n\n uri = URI.parse(client.options[:url])\n # base URL\n configuration.scheme = uri.scheme\n configuration.host = uri.to_s\n # SSL\n configuration.verify_ssl = client.options[:use_ssl].nil? ? true : client.options[:use_ssl]\n # Token\n configuration.api_key_prefix['api_key'] = 'Token'\n configuration.api_key['api_key'] = client.options[:token]\n # Debugging\n configuration.debugging = client.options[:debugging]\n configuration.logger = client.options[:logger]\n\n @api_client = ApiClient.new(configuration)\n # User Agent\n @api_client.user_agent = \"influxdb-client-ruby/#{InfluxDB2::VERSION}\"\n end",
"def client\n Twitter::REST::Client.new(consumer_key: Settings.consumer.key,\n consumer_secret: Settings.consumer.secret,\n access_token: oauth_token,\n access_token_secret: oauth_token_secret)\n end",
"def twitter_client\n @twitter_client ||= Twitter::REST::Client.new do |config|\n config.consumer_key = twitter_config(:consumer_key)\n config.consumer_secret = twitter_config(:consumer_secret)\n config.access_token = twitter_config(:access_token)\n config.access_token_secret = twitter_config(:access_token_secret)\n end\n end",
"def initialize(config)\n options = Hash[config.map { |(k, v)| [k.to_sym, v] }]\n\n @client_id = options[:client_id]\n @client_secret = options[:client_secret]\n @region = options[:region] || 'us'\n @max_results = options[:max_results] || 1000\n\n if options[:timeout] and defined? self.class.default_timeout\n self.class.default_timeout options[:timeout]\n end\n\n if options[:proxy_host]\n self.class.http_proxy options[:proxy_host], options[:proxy_port], options[:proxy_user], options[:proxy_pass]\n end\n\n self.class.default_options.update(verify: false)\n\n validate_config\n\n @user_agent = DEFAULT_USER_AGENT\n end",
"def twitter_rest_client\n @twitter_rest_client ||= Twitter::REST::Client.new do |config|\n config.consumer_key = ENV[\"TWITTER_CONSUMER_KEY\"]\n config.consumer_secret = ENV[\"TWITTER_CONSUMER_SECRET\"]\n config.access_token = access_token\n config.access_token_secret = access_token_secret\n end\n end",
"def authenticate\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV['CONSUMER_KEY']\n config.consumer_secret = ENV['CONSUMER_SECRET']\n config.access_token = ENV['ACCESS_TOKEN']\n config.access_token_secret = ENV['ACCESS_TOKEN_SECRET']\n end\n return client\n end",
"def initialize(client_secret = nil, client_id = nil, base_url = 'api-qa.aspose.cloud', api_version = 'v3.0', debug = false)\n @api_client = ApiClient.new(client_secret, client_id, base_url, api_version, debug)\n end",
"def initialize(params)\n\n @client_id = params[:client_id]\n @client_token_id = params[:client_token_id]\n @token_symbol = params[:token_symbol]\n\n end",
"def initialize(config, client = nil)\n @host = config[:host]\n\n raise ArgumentError, 'No API host is provided.' if @host.nil?\n\n if client.nil? # rubocop:disable Style/ConditionalAssignment\n @client = ArkEcosystem::Client::HTTP::Client.new(config)\n else\n @client = client.new(config)\n end\n end",
"def client\n Octokit::Client.new(access_token: decrypt(@user.github_token))\n end",
"def initialize(options = nil)\n @options = options || @@default_options\n @api_key = @options[:api_key] || @options[:oauth_consumer_key]\n @shared_secret = @options[:shared_secret]\n @rest_endpoint = @options[:rest_endpoint] || REST_ENDPOINT\n @auth_endpoint = @options[:auth_endpoint] || AUTH_ENDPOINT\n \n if @options[:oauth_access_token] && @options[:oauth_access_token_secret]\n @access_token = OAuth::AccessToken.new(oauth_customer, @options[:oauth_access_token], @options[:oauth_access_token_secret])\n end\n end",
"def login\n @client = Octokit::Client.new(login: username, oauth_token: token)\n end",
"def mk_twit_client(creds)\n Twitter.configure do |config|\n config.consumer_key = creds[:consumer_key]\n config.consumer_secret = creds[:consumer_secret]\n config.oauth_token = creds[:oauth_token]\n config.oauth_token_secret = creds[:oauth_token_secret]\n end\n # Do this to try and work around a bug in the twitter api, I believe it has\n # been fixed\n middleware = Proc.new do |builder|\n builder.use Twitter::Request::MultipartWithFile\n builder.use Faraday::Request::Multipart\n builder.use Faraday::Request::UrlEncoded\n builder.use Twitter::Response::RaiseError, Twitter::Error::ClientError\n builder.use Twitter::Response::ParseJson\n builder.use Twitter::Response::RaiseError, Twitter::Error::ServerError\n builder.adapter :typhoeus\n end\n return Twitter::Client.new(:middleware => Faraday::Builder.new(&middleware))\nend",
"def initialize(options={})\n # Client auth configuration\n @flow = options[:flow] || options.keys.first.to_s || 'web'\n fdata = options[@flow.to_sym] || options[@flow]\n @client_id = fdata[:client_id] || fdata[\"client_id\"]\n @client_secret = fdata[:client_secret] || fdata[\"client_secret\"]\n @redirect_uris = fdata[:redirect_uris] || fdata[\"redirect_uris\"]\n @redirect_uris ||= [fdata[:redirect_uri] || fdata[\"redirect_uri\"]].compact\n @javascript_origins = (\n fdata[:javascript_origins] ||\n fdata[\"javascript_origins\"]\n )\n @javascript_origins ||= [fdata[:javascript_origin] || fdata[\"javascript_origin\"]].compact\n @authorization_uri = fdata[:auth_uri] || fdata[\"auth_uri\"]\n @authorization_uri ||= fdata[:authorization_uri]\n @token_credential_uri = fdata[:token_uri] || fdata[\"token_uri\"]\n @token_credential_uri ||= fdata[:token_credential_uri]\n\n # Associated token info\n @access_token = fdata[:access_token] || fdata[\"access_token\"]\n @refresh_token = fdata[:refresh_token] || fdata[\"refresh_token\"]\n @id_token = fdata[:id_token] || fdata[\"id_token\"]\n @expires_in = fdata[:expires_in] || fdata[\"expires_in\"]\n @expires_at = fdata[:expires_at] || fdata[\"expires_at\"]\n @issued_at = fdata[:issued_at] || fdata[\"issued_at\"]\n end",
"def initialize(client)\n\t\tself.client = client\n\tend",
"def initialize(client)\n\t\tself.client = client\n\tend",
"def client\n # Merge in authorize url if supplied\n options.authorize_params[:clientId] = options.client_id\n options.authorize_params[:redirect] = callback_url\n options.client_options[:authorize_url] = options.authorize_url if options.authorize_url.present?\n options.client_options[:site] = options.site if options.site.present?\n\n ::OAuth2::Client.new(\n options.client_id,\n options.client_secret,\n deep_symbolize(options.client_options)\n )\n end",
"def authenticate\n if @client_id.length < 1 || @client_secret.length < 1\n raise SdkException.new('missing parameters: client_id, client_secret')\n end\n url_with_params = @@auth_endpoint + '?grant_type=client_credentials&scope=data'\n response = RestClient::Request.execute(\n url: url_with_params,\n user: @client_id,\n password: @client_secret,\n method: :post\n )\n body = JSON.parse(response.body)\n @access_token = body['access_token']\n self\n end",
"def client\n @client ||= Faraday.new(api_host) do |faraday|\n faraday.headers[\"Authorization\"] = \"Bearer #{access_token}\"\n faraday.response :logger if Rails.env.test?\n faraday.adapter Faraday.default_adapter\n end\n end",
"def app_client\n @app_client ||= Octokit::Client.new :client_id => CLIENT_ID, :client_secret => CLIENT_SECRET\nend",
"def initialize(user, password)\n @user = user\n @password = password\n\n # In the constructor, try to authenticate and get the access_token and\n # client_id\n authenticate\n end",
"def initialize(client_or_api_key, &client_setup)\n if client_or_api_key.kind_of?(Orchestrate::Client)\n @client = client_or_api_key\n @api_key = client.api_key\n else\n @api_key = client_or_api_key\n @client = Client.new(api_key, &client_setup)\n end\n client.ping\n end",
"def initialize(app, name, client_id=nil, client_secret=nil, client_options={}, options={}, &block)\n self.client_id = client_id\n self.client_secret = client_secret\n self.client_options = client_options\n super\n end",
"def initialize(klass = nil)\n @klass = klass\n if @klass.present?\n @client = OAuth::AccessToken.new(consumer, @klass.access_token, @klass.access_secret)\n end\n end",
"def get_token(params, access_token_opts = {}, access_token_class = OmniAuth::Slack::OAuth2::AccessToken) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength\n rslt = super(params, access_token_opts, access_token_class)\n debug{\"Client #{self} using AccessToken #{rslt}\"}\n rslt\n end",
"def initialize(*args)\n @client ||= Betaface::REST::Client.new(*args) \n end",
"def initialize(key, client=nil)\n @api_key = key\n @client = client\n end",
"def api\n # Don't cache instance for now because of a ruby marshaling bug present\n # in MRI 1.9.3 (Bug #7627) that causes instance variables to be\n # marshaled even when explicitly specifying #marshal_dump.\n Octokit::Client.new(:login => login, :access_token => token)\n end",
"def start_client\n @client = Client.new(@configure.apis)\n @client.run\n end",
"def api_client\n @api_client ||= ::Lokalise.client LokaliseRails.api_token, {enable_compression: true}.merge(LokaliseRails.timeouts)\n end",
"def initialize(options={})\n @access_token = options[:access_token]\n @connection = Faraday.new(url: Behance::Client::API_URL) do |b|\n b.adapter Faraday.default_adapter\n b.use FaradayMiddleware::ParseJson\n end\n end",
"def initialize(client)\n\t self.client=client\n end",
"def client\n @client ||= Github::ApiProxy.new(@options[:access_token])\n end",
"def initialize(client)\n @client = client\n end",
"def initialize\n self.client = Octokit::Client.new(\n login: \"tamouse\",\n password: WatchMyStuff::Configuration.two_fa\n )\n self.client.auto_paginate = true\n end",
"def initialize\n @wsdl = Reuters::Wsdls.const_get client_name\n @namespace = Reuters::Namespaces.const_get client_name\n @token = Reuters::Client::Token.new\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end"
] |
[
"0.7119859",
"0.6726576",
"0.6346222",
"0.6262825",
"0.6262037",
"0.6226952",
"0.622132",
"0.60878927",
"0.60878927",
"0.6076046",
"0.60646445",
"0.60483915",
"0.6046482",
"0.6039473",
"0.6015484",
"0.60124874",
"0.6011871",
"0.5992625",
"0.59925216",
"0.59692603",
"0.593184",
"0.5868067",
"0.5856246",
"0.58458936",
"0.58441955",
"0.58307743",
"0.58173186",
"0.5810155",
"0.5805604",
"0.579382",
"0.5787599",
"0.5774909",
"0.57714015",
"0.5766509",
"0.5761067",
"0.57594675",
"0.5758172",
"0.5736642",
"0.5729528",
"0.5709276",
"0.56880575",
"0.56827754",
"0.56743133",
"0.5673195",
"0.5669472",
"0.5666802",
"0.5663939",
"0.56499594",
"0.5640814",
"0.5640414",
"0.56306344",
"0.56166506",
"0.5599304",
"0.55729353",
"0.55711764",
"0.55682206",
"0.55641055",
"0.5555395",
"0.55547374",
"0.5546301",
"0.5506323",
"0.5505871",
"0.5502988",
"0.5501078",
"0.54857045",
"0.54854906",
"0.54800546",
"0.54783154",
"0.5469594",
"0.5466307",
"0.54647094",
"0.54541737",
"0.54541737",
"0.5452345",
"0.5452092",
"0.5449924",
"0.54280114",
"0.54270935",
"0.5426495",
"0.54174596",
"0.54141724",
"0.5411872",
"0.54118294",
"0.54080826",
"0.5404128",
"0.5399045",
"0.53969806",
"0.53968567",
"0.53896016",
"0.53883564",
"0.53787273",
"0.5378389",
"0.53752434",
"0.53660554",
"0.5365905",
"0.5365905",
"0.5365905",
"0.5365905",
"0.5365905",
"0.5365905"
] |
0.84234625
|
0
|
hack to generate yajl_version.h without using cmake
|
def generate_yajl_version
build_path = File.expand_path("../ext/libyajl2", __FILE__)
vendor_path = File.expand_path("../ext/libyajl2/vendor/yajl", __FILE__)
yajl_major = yajl_minor = yajl_micro = nil
File.open("#{vendor_path}/CMakeLists.txt").each do |line|
if (m = line.match(/YAJL_MAJOR (\d+)/))
yajl_major = m[1]
end
if (m = line.match(/YAJL_MINOR (\d+)/))
yajl_minor = m[1]
end
if (m = line.match(/YAJL_MICRO (\d+)/))
yajl_micro = m[1]
end
end
File.open("#{build_path}/api/yajl_version.h", "w+") do |out| # FIXME: relative path
File.open("#{vendor_path}/src/api/yajl_version.h.cmake").each do |line|
line.gsub!(/\$\{YAJL_MAJOR\}/, yajl_major)
line.gsub!(/\$\{YAJL_MINOR\}/, yajl_minor)
line.gsub!(/\$\{YAJL_MICRO\}/, yajl_micro)
out.write(line)
end
end
FileUtils.cp "#{build_path}/api/yajl_version.h", "#{build_path}/yajl/yajl_version.h"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def make_version_header(app_name, pkgname, dir = \"src\")\n version = PKGConfig.modversion(pkgname).split(/\\./)\n (0..2).each do |v|\n version[v] = \"0\" unless version[v]\n end\n filename = \"rb#{app_name.downcase}version.h\"\n\n puts \"creating #{filename}\"\n\n add_distcleanfile(filename)\n\n FileUtils.mkdir_p(dir)\n out = File.open(File.join(dir, filename), \"w\")\n\n out.print %Q[/* -*- c-file-style: \"ruby\"; indent-tabs-mode: nil -*- */\n/************************************************\n\n #{filename} -\n\n This file was generated by mkmf-gnome2.rb.\n\n************************************************/\n\n#ifndef __RB#{app_name}_VERSION_H__\n#define __RB#{app_name}_VERSION_H__\n\n#define #{app_name}_MAJOR_VERSION (#{version[0]})\n#define #{app_name}_MINOR_VERSION (#{version[1]})\n#define #{app_name}_MICRO_VERSION (#{version[2]})\n\n#define #{app_name}_CHECK_VERSION(major,minor,micro) \\\\\n (#{app_name}_MAJOR_VERSION > (major) || \\\\\n (#{app_name}_MAJOR_VERSION == (major) && #{app_name}_MINOR_VERSION > (minor)) || \\\\\n (#{app_name}_MAJOR_VERSION == (major) && #{app_name}_MINOR_VERSION == (minor) && \\\\\n #{app_name}_MICRO_VERSION >= (micro)))\n\n\n#endif /* __RB#{app_name}_VERSION_H__ */\n]\n out.close\nend",
"def iyyov_install_gem\n jruby_install_gem( 'iyyov', :version => \"=#{iyyov_version}\",\n :check => true )\n end",
"def target_version=(_arg0); end",
"def target_version; end",
"def get_version_suffix(linker, bb)\n \"#{major_suffix bb}#{[bb.major, bb.minor].compact.join('.')}\"\n end",
"def version_helper=(_arg0); end",
"def version_helper=(_arg0); end",
"def version_helper=(_arg0); end",
"def version_helper; end",
"def version_helper; end",
"def version_helper; end",
"def version_helper; end",
"def build_gem; end",
"def major_version; end",
"def def_version; end",
"def carray_version\n\n io = open(File.join(File.dirname(__FILE__), \"version.h\"))\n while line = io.gets\n case line \n when /^#define CA_VERSION (.*)$/\n ca_version = $1.strip[1..-2]\n when /^#define CA_VERSION_CODE (.*)$/\n ca_version_code = $1.to_i\n when /^#define CA_VERSION_MAJOR (.*)$/\n ca_version_major = $1.to_i\n when /^#define CA_VERSION_MINOR (.*)$/\n ca_version_minor = $1.to_i\n when /^#define CA_VERSION_TEENY (.*)$/\n ca_version_teeny = $1.to_i\n when /^#define CA_VERSION_DATE (.*)$/\n ca_version_date = $1.strip[1..-2]\n end\n end\n io.close\n\n ca_version2 = format(\"%i.%i.%i\", \n ca_version_major, ca_version_minor, ca_version_teeny)\n ca_version_code2 = \n 100 * ca_version_major + 10*ca_version_minor + ca_version_teeny\n\n if ca_version != ca_version2 or ca_version_code != ca_version_code2\n raise \"invalid version.h\"\n end\n \n return [ca_version, ca_version_date]\nend",
"def minor_version; end",
"def to_ruby\n mark_version\n result = []\n result << \"# -*- encoding: utf-8 -*-\"\n result << \"#{Gem::StubSpecification::PREFIX}#{name} #{version} #{platform} #{raw_require_paths.join(\"\\0\")}\"\n result << \"#{Gem::StubSpecification::PREFIX}#{extensions.join \"\\0\"}\" unless\n extensions.empty?\n result << nil\n result << \"Gem::Specification.new do |s|\"\n\n result << \" s.name = #{ruby_code name}\"\n result << \" s.version = #{ruby_code version}\"\n unless platform.nil? or platform == Gem::Platform::RUBY\n result << \" s.platform = #{ruby_code original_platform}\"\n end\n result << \"\"\n result << \" s.required_rubygems_version = #{ruby_code required_rubygems_version} if s.respond_to? :required_rubygems_version=\"\n\n if metadata and !metadata.empty?\n result << \" s.metadata = #{ruby_code metadata} if s.respond_to? :metadata=\"\n end\n result << \" s.require_paths = #{ruby_code raw_require_paths}\"\n\n handled = [\n :dependencies,\n :name,\n :platform,\n :require_paths,\n :required_rubygems_version,\n :specification_version,\n :version,\n :has_rdoc,\n :default_executable,\n :metadata,\n :signing_key,\n ]\n\n @@attributes.each do |attr_name|\n next if handled.include? attr_name\n current_value = self.send(attr_name)\n if current_value != default_value(attr_name) || self.class.required_attribute?(attr_name)\n result << \" s.#{attr_name} = #{ruby_code current_value}\"\n end\n end\n\n if String === signing_key\n result << \" s.signing_key = #{signing_key.dump}.freeze\"\n end\n\n if @installed_by_version\n result << nil\n result << \" s.installed_by_version = \\\"#{Gem::VERSION}\\\" if s.respond_to? :installed_by_version\"\n end\n\n unless dependencies.empty?\n result << nil\n result << \" if s.respond_to? :specification_version then\"\n result << \" s.specification_version = #{specification_version}\"\n result << \" end\"\n result << nil\n\n result << \" if s.respond_to? :add_runtime_dependency then\"\n\n dependencies.each do |dep|\n req = dep.requirements_list.inspect\n dep.instance_variable_set :@type, :runtime if dep.type.nil? # HACK\n result << \" s.add_#{dep.type}_dependency(%q<#{dep.name}>.freeze, #{req})\"\n end\n\n result << \" else\"\n dependencies.each do |dep|\n version_reqs_param = dep.requirements_list.inspect\n result << \" s.add_dependency(%q<#{dep.name}>.freeze, #{version_reqs_param})\"\n end\n result << \" end\"\n end\n\n result << \"end\"\n result << nil\n\n result.join \"\\n\"\n end",
"def bump_minor_version; end",
"def version=(_arg0); end",
"def version=(_arg0); end",
"def version=(_arg0); end",
"def version=(_arg0); end",
"def version=(_arg0); end",
"def write_version(major, minor, patch, build, _options = T.unsafe(nil)); end",
"def xy\n \"python#{version.major}.#{version.minor}\"\n end",
"def version_file\n \"lib/#{repo_name}/common/version.rb\"\nend",
"def binary_version; end",
"def bootstrap\n write_repo_file('bootstrap.h',<<EOF)\n#!/bin/sh\n\nphp_version=$(php -v | head -1 | awk '{print $2}' | sed 's/\\\\.//g')\ncomposer_version=5320\n\nif [[ $php_version -gt $composer_version ]]; then\n curl -sS https://getcomposer.org/installer | php\n mv composer.phar composer\n chmod 755 composer\n ./composer install\n export PATH=vendor/bin:$PATH\nelse\n curl -O https://phar.phpunit.de/phpunit.phar\n mv phpunit.phar phpunit\n chmod 755 phpunit\nfi\nEOF\n end",
"def versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend",
"def build_version\n @semver.to_s '%M.%m.%p'\n end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def lib_path=(_arg0); end",
"def lib_path=(_arg0); end",
"def lib_path=(_arg0); end",
"def bump_major_version; end",
"def generate\n result = <<-eos.strip_heredoc\n framework module #{target.product_module_name} {\n umbrella header \"#{target.umbrella_header_path.basename}\"\n\n export *\n module * { export * }\n eos\n\n result << \"\\n#{generate_private_header_exports}\" unless private_headers.empty?\n result << \"}\\n\"\n end",
"def version_tag(text); end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def version\n build_string\n end",
"def API_version(options={})\n return \"#{@major}.#{@minor}\"\n end",
"def osx_version_txt t\n create_version_file t\nend",
"def osx_version_txt t\n create_version_file t\nend",
"def test_huia\n err = assert_compile 'huia.y'\n assert_warnings err, sr_conflicts: 285\n assert_parser_unchanged 'huia.y'\n end",
"def jamm_version(version)\n case version.to_s.strip\n when /^0.[0-7]/\n '0.2.5'\n when /^0.8/\n '0.2.2'\n when /^1|^2.0/\n '0.2.5'\n when /^2.1.[0-1]$/\n '0.2.6'\n when /^2.1.[2-3]$/\n '0.2.8'\n when /^2.1/\n '0.3.1'\n when /^2.2/\n '0.3.1'\n when /^3.[0-9]/\n '0.3.1'\n end\nend",
"def version_path\n @version_path ||= \"lib/#{namespaced_path}/version.rb\"\n end",
"def install\n # ENV.deparallelize # if your formula fails when building in parallel\n system \"make\", \"CC=clang\"\n bin.install 'lz4mt'\n end",
"def palladius_version\n\t:TODO\nend",
"def get_api_version\n :v201502\n end",
"def target_mysql_version=(_arg0); end",
"def default_version; end",
"def yocto\n big_self * YOCTO\n end",
"def semantic_version(major: T.unsafe(nil), minor: T.unsafe(nil), patch: T.unsafe(nil)); end",
"def koi_version\n version_file_path = self.rails_template[/.*(?=templates)/]\n version_file_path += 'koi/version.rb'\n version_data = open(version_file_path) {|f| f.read }\n\n version = version_data.split(\"\\n\")[1].split('=').last.strip.gsub(/\\\"/, '')\nend",
"def lib_path; end",
"def lib_path; end",
"def lib_path; end",
"def has_version?; end",
"def major=(_arg0); end",
"def build_jar\n `rm framework/local.properties` if File.exists? 'framework/local.properties'\n `rm framework/phonegap.jar` if File.exists? 'framework/phonegap.jar'\n `rm framework/phonegap.js` if File.exists? 'framework/phonegap.js'\n `ECHO 'sdk-location=#{ @android_sdk_path }' > framework/local.properties`\n `cd framework; ant jar`\n end",
"def xlate_minor_version()\n return MIN_VERSION_XLATES[@minor_version] if (MIN_VERSION_XLATES.has_key?(@minor_version))\n return(@minor_version.to_s) \n end",
"def yardoc_file_for_gem(gem, ver_require = T.unsafe(nil), for_writing = T.unsafe(nil)); end",
"def get_api_version()\n return :v201502\n end",
"def version_number\n \"#{self.major}.#{self.minor}\"\n end",
"def gen_fullname(gem)\n \"#{gem[0]}-#{gem[1].version}#{\"-#{gem[2]}\" if gem[2] != \"ruby\"}\"\nend",
"def version_const\n \"Version_\" + @__version.upcase.gsub(\".\", \"_\")\n end",
"def framework_language\n\n lang = \"{\"\n lang += \"fileTypes = (as);\"\n lang += \"\\tcomment = '#{@framework.capitalize} Framework.';\\n\"\n lang += \"\\tfoldingStartMarker = '\\{\\s*$';\\n\"\n lang += \"\\tfoldingStopMarker = '^\\s*\\}';\\n\"\n lang += \"keyEquivalent = \\\"^~A\\\";\"\n lang += \"name = #{@framework.capitalize};\\n\"\n lang += \"scopeName = 'source.actionscript.3.#{@framework}';\\n\"\n lang += \"\\tpatterns = (\\n\"\n\n all_elements = { \"support.class\" => @class_names,\n \"support.function\" => @method_names,\n \"support.function.protected\" => @protected_method_names,\n \"support.constant\" => @constant_names,\n \"support.property\" => @property_names,\n \"support.property.protected\" => @protected_properties }\n\n all_elements.each do |key, value|\n\n next if value.empty?\n\n lang += \"\\t{\\n\"\n lang += \"\\t\\tname = '#{key}.#{@framework}';\\n\"\n lang += \"\\t\\tmatch = '\\\\b\"\n lang += ListToRegexp.process_list(value.sort.uniq)\n lang += \"\\\\b';\\n\"\n lang += \"\\t},\\n\"\n\n end\n\n lang += \");\\nuuid = '\" + `uuidgen`.chomp + \"'; }\"\n\n end",
"def dev_minor() end",
"def patch_version; end",
"def target_mariadb_version=(_arg0); end",
"def create\n\n # Let's get a few things straight\n @work_dir = \"#{@resource[:cache_dir]}/#{@resource[:extension]}\"\n @php_version_prefix = \"#{@resource[:phpenv_root]}/versions/#{@resource[:php_version]}\"\n @resource[:compiled_name] ||= \"#{@resource[:extension]}.so\"\n\n # Update the repository\n fetch @resource[:version], @resource[:extension]\n\n # Prepare for building\n prep_build @resource[:version]\n\n # PHPize, build & install\n phpize\n configure\n make\n install\n end",
"def common_build\n puts \"common_build dir=#{pwd} #{SHOES_TGT_ARCH}\"\n #mkdir_p \"#{TGT_DIR}/ruby\"\n #cp_r \"#{EXT_RUBY}/lib/ruby/#{RUBY_V}\", \"#{TGT_DIR}/ruby/lib\"\n %w[req/ftsearch/lib/* req/rake/lib/*].each do |rdir|\n FileList[rdir].each { |rlib| cp_r rlib, \"#{TGT_DIR}/lib/ruby/#{TGT_RUBY_V}\" }\n end\n %w[req/ftsearch/ext/ftsearchrt req/chipmunk/ext/chipmunk].\n #%w[req/binject/ext/binject_c req/ftsearch/ext/ftsearchrt req/bloopsaphone/ext/bloops req/chipmunk/ext/chipmunk].\n each { |xdir| copy_ext xdir, \"#{TGT_DIR}/lib/ruby/#{TGT_RUBY_V}/#{SHOES_TGT_ARCH}\" }\n\n gdir = \"#{TGT_DIR}/lib/ruby/gems/#{RUBY_V}\"\n {'hpricot' => 'lib', 'sqlite3' => 'lib'}.each do |gemn, xdir|\n #{'hpricot' => 'lib', 'json' => 'lib/json/ext', 'sqlite3' => 'lib'}.each do |gemn, xdir|\n spec = eval(File.read(\"req/#{gemn}/gemspec\"))\n mkdir_p \"#{gdir}/specifications\"\n mkdir_p \"#{gdir}/gems/#{spec.full_name}/lib\"\n FileList[\"req/#{gemn}/lib/*\"].each { |rlib| cp_r rlib, \"#{gdir}/gems/#{spec.full_name}/lib\" }\n mkdir_p \"#{gdir}/gems/#{spec.full_name}/#{xdir}\"\n FileList[\"req/#{gemn}/ext/*\"].each { |elib| copy_ext elib, \"#{gdir}/gems/#{spec.full_name}/#{xdir}\" }\n cp \"req/#{gemn}/gemspec\", \"#{gdir}/specifications/#{spec.full_name}.gemspec\"\n end\n end",
"def configure_ivy(ivy_config)\n ivy.compile_conf('compile').\n compile_type('jar').\n test_conf('unit-test').\n test_type('jar')\nend"
] |
[
"0.607159",
"0.56491",
"0.5541313",
"0.53789246",
"0.5327139",
"0.5255877",
"0.5255877",
"0.5255877",
"0.52176255",
"0.52176255",
"0.52176255",
"0.52176255",
"0.52155167",
"0.5198248",
"0.51929784",
"0.5165983",
"0.51187086",
"0.51185787",
"0.5116837",
"0.5098749",
"0.5098749",
"0.5098749",
"0.5098749",
"0.5098749",
"0.50937396",
"0.4996298",
"0.49748087",
"0.49614644",
"0.49412262",
"0.49201286",
"0.4908504",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48997337",
"0.48435166",
"0.48435166",
"0.48435166",
"0.4829733",
"0.48288202",
"0.48268396",
"0.48158768",
"0.48158768",
"0.48158768",
"0.48158768",
"0.48158768",
"0.48158768",
"0.48135167",
"0.48116288",
"0.48056132",
"0.48056132",
"0.4790755",
"0.47876278",
"0.4786451",
"0.4767",
"0.47622067",
"0.47607988",
"0.4753379",
"0.47444093",
"0.47306013",
"0.4728105",
"0.47252056",
"0.47204643",
"0.47204643",
"0.47204643",
"0.4702738",
"0.46906906",
"0.46866024",
"0.46835297",
"0.46820992",
"0.46812043",
"0.46692696",
"0.466028",
"0.4657838",
"0.46513596",
"0.46463773",
"0.4643728",
"0.4643334",
"0.4640976",
"0.4639249",
"0.4627628"
] |
0.89106363
|
0
|
Copied/pasted/adapted from puppetlabs_spec_helper's lib/puppetlabs_spec_helper/rake_tasks.rb
|
def fixtures(host, category)
begin
fixtures = YAML.load_file(".fixtures.yml")["fixtures"]
rescue Errno::ENOENT
return {}
end
if not fixtures
abort("malformed fixtures.yml")
end
result = {}
if fixtures.include? category and fixtures[category] != nil
fixtures[category].each do |fixture, opts|
if opts.instance_of?(String)
source = opts
target = "#{host['distmoduledir']}/#{fixture}"
real_source = eval('"'+source+'"')
result[real_source] = target
elsif opts.instance_of?(Hash)
target = "#{host['distmoduledir']}/#{fixture}"
real_source = eval('"'+opts["repo"]+'"')
result[real_source] = { "target" => target, "ref" => opts["ref"], "scm" => opts["scm"] }
end
end
end
return result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rake_tasks(&block); end",
"def rake_tasks(&block); end",
"def define_tasks!\n\n define_test_tasks! if has_tests?\n define_rspec_tasks! if has_specs?\n\n namespace(@task_namespace) do\n desc \"Updates the filelist in the gemspec file\"\n task(:manifest) { manifest_task }\n\n desc \"Builds the .gem package\"\n task(:build => :manifest) { build_task }\n\n desc \"Sets the version of the gem in the gemspec\"\n task(:set_version => [:check_version, :check_current_branch]) { version_task }\n task(:check_version => :fetch_origin) { check_version_task }\n\n task(:fetch_origin) { fetch_origin_task }\n task(:check_current_branch) { check_current_branch_task }\n task(:check_clean_status) { check_clean_status_task }\n task(:check_not_diverged => :fetch_origin) { check_not_diverged_task }\n\n checks = [:check_current_branch, :check_clean_status, :check_not_diverged, :check_version]\n checks.unshift('spec:basic') if has_specs?\n checks.unshift('test:basic') if has_tests?\n # checks.push << [:check_rubyforge] if gemspec.rubyforge_project\n\n desc \"Perform all checks that would occur before a release\"\n task(:release_checks => checks)\n\n release_tasks = [:release_checks, :set_version, :build, :github_release, :gemcutter_release]\n # release_tasks << [:rubyforge_release] if gemspec.rubyforge_project\n\n desc \"Release a new version of the gem using the VERSION environment variable\"\n task(:release => release_tasks) { release_task }\n \n namespace(:release) do\n desc \"Release the next version of the gem, by incrementing the last version segment by 1\"\n task(:next => [:next_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a patch increment (0.0.1)\"\n task(:patch => [:next_patch_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a minor increment (0.1.0)\"\n task(:minor => [:next_minor_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a major increment (1.0.0)\"\n task(:major => [:next_major_version] + release_tasks) { release_task }\n end\n\n # task(:check_rubyforge) { check_rubyforge_task }\n # task(:rubyforge_release) { rubyforge_release_task }\n task(:gemcutter_release) { gemcutter_release_task }\n task(:github_release => [:commit_modified_files, :tag_version]) { github_release_task }\n task(:tag_version) { tag_version_task }\n task(:commit_modified_files) { commit_modified_files_task }\n\n task(:next_version) { next_version_task }\n task(:next_patch_version) { next_version_task(:patch) }\n task(:next_minor_version) { next_version_task(:minor) }\n task(:next_major_version) { next_version_task(:major) }\n \n desc \"Updates the gem release tasks with the latest version on Github\"\n task(:update_tasks) { update_tasks_task }\n end\n end",
"def describe_rake_task(task_name, filename, &block)\n require \"rake\"\n\n describe \"Rake task #{task_name}\" do\n attr_reader :task\n\n before(:all) do\n @rake = Rake::Application.new\n Rake.application = @rake\n load filename\n @task = Rake::Task[task_name]\n end\n\n after(:all) do\n Rake.application = nil\n end\n\n def invoke!\n for action in task.instance_eval { @actions }\n instance_eval(&action)\n end\n end\n\n def tmppath(*paths)\n parts = [File.dirname(__FILE__), \"tmp\"]\n parts << (@root_time ||= Time.now.to_i.to_s)\n parts += paths\n # parts << rand().to_s.split(\".\").last\n parts.collect! {|path| path.to_s}\n path = File.join(*parts)\n attempts = 10\n while File.exists?(path)\n path.succ!\n attempts -= 1\n raise \"Unable to find a good temp pathname: #{path.inspect}\" if attempts.zero?\n end\n\n File.expand_path(path)\n end\n\n def cleanup\n path = File.expand_path(File.join(File.dirname(__FILE__), \"tmp\"))\n FileUtils.rm_rf(path)\n end\n\n instance_eval(&block)\n end\nend",
"def make_tasks\n make_clean_task\n make_wix_folder_task\n make_copy_file_tasks\n make_sourcery_wxs_file_task\n make_sourcery_wixobj_file_task\n make_product_wxs_file_task\n make_product_wixobj_file_task\n make_msi_file_task\n make_msi_task\n make_test_task\n end",
"def configure_tasks\n end",
"def rakefile_test_tasks\n ''\n end",
"def ruby_rake_task(task)\n Rake::Task[task].invoke\nend",
"def define_tasks\n # Task definitions are taken from Rake::TestTask\n # https://github.com/ruby/rake/blob/e644af3/lib/rake/testtask.rb#L98-L112\n namespace :ttnt do\n namespace name do\n define_run_task\n define_anchor_task\n end\n end\n end",
"def create_tasks\n Application.features[self].each{ |f|\n extend Rake::DSL\n taskname = \"#{f.to_s.split('::').last}\"\n desc \"Feature\"\n task taskname => [\"#{taskname}:install\"] do\n end\n namespace taskname do\n desc \"install #{taskname}\"\n task :install do\n puts \"----> installing #{taskname}\"\n puts \"#{self} | #{f}\"\n Application.install[f.name].each{ |c|\n puts \"#{c}\"\n }\n end\n end \n } if Application.features[self]\n end",
"def define_default_tasks\n\n\t\t# task used to indicate that rake-deveiate has already been setup once; for\n\t\t# global rakefiles.\n\t\ttask :deveiate do\n\t\t\t# no-op\n\t\tend\n\n\t\tdesc \"The task that runs by default\"\n\t\ttask( :default => :spec )\n\n\t\tdesc \"Check in the current changes\"\n\t\ttask :checkin => [ :precheckin, :check, :test ]\n\t\ttask :commit => :checkin\n\t\ttask :ci => :checkin\n\t\ttask :precheckin\n\n\t\tdesc \"Sanity-check the project\"\n\t\ttask :check\n\n\t\tdesc \"Update the history file\"\n\t\ttask :update_history\n\n\t\tdesc \"Package up and push a release\"\n\t\ttask :release => [ :prerelease, :gem, :release_gem, :postrelease ]\n\t\ttask :prerelease\n\t\ttask :release_gem\n\t\ttask :postrelease\n\n\t\tdesc \"Run all the project's tests\"\n\t\ttask :test\n\t\ttask :spec\n\t\ttask :integration\n\n\t\tdesc \"Set up the project for development\"\n\t\ttask :setup do\n\t\t\tself.install_dependencies\n\t\tend\n\n\t\tdesc \"Turn on maintainer mode: build with extra warnings and debugging\"\n\t\ttask :maint do\n\t\t\tENV['MAINTAINER_MODE'] = 'yes'\n\t\tend\n\n\tend",
"def define_test_tasks\n default_tasks = []\n\n if File.directory? \"test\" then\n desc 'Run the test suite. Use FILTER or TESTOPTS to add flags/args.'\n task :test do\n ruby make_test_cmd\n end\n\n desc 'Run the test suite using multiruby.'\n task :multi do\n ruby make_test_cmd(:multi)\n end\n\n desc 'Show which test files fail when run alone.'\n task :test_deps do\n tests = Dir[\"test/**/test_*.rb\"] + Dir[\"test/**/*_test.rb\"]\n\n paths = ['bin', 'lib', 'test'].join(File::PATH_SEPARATOR)\n null_dev = Hoe::WINDOZE ? '> NUL 2>&1' : '&> /dev/null'\n\n tests.each do |test|\n if not system \"ruby -I#{paths} #{test} #{null_dev}\" then\n puts \"Dependency Issues: #{test}\"\n end\n end\n end\n\n default_tasks << :test\n end\n\n if File.directory? \"spec\" then\n begin\n require 'spec/rake/spectask'\n\n desc \"Run all specifications\"\n Spec::Rake::SpecTask.new(:spec) do |t|\n t.libs = self.rspec_dirs\n t.spec_opts = self.rspec_options\n end\n rescue LoadError\n # do nothing\n end\n default_tasks << :spec\n end\n\n desc 'Run the default task(s).'\n task :default => default_tasks\n\n desc 'Run ZenTest against the package.'\n task :audit do\n libs = %w(lib test ext).join(File::PATH_SEPARATOR)\n sh \"zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(' ')}\"\n end\n end",
"def define_packaging_tasks\n\n\t\t### Task: prerelease\n\t\tunless Rake::Task.task_defined?( :pre )\n\t\t\tdesc \"Append the package build number to package versions\"\n\t\t\ttask :pre do\n\t\t\t\trev = get_numeric_rev()\n\t\t\t\ttrace \"Current rev is: %p\" % [ rev ]\n\t\t\t\t$hoespec.spec.version.version << \"pre#{rev}\"\n\t\t\t\tRake::Task[:gem].clear\n\n\t\t\t\tGem::PackageTask.new( $hoespec.spec ) do |pkg|\n\t\t\t\t\tpkg.need_zip = true\n\t\t\t\t\tpkg.need_tar = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tnamespace :deps do\n\n\t\t\tif RVM_GEMSET.exist?\n\t\t\t\tdesc \"Update the project's RVM gemset\"\n\t\t\t\ttask :gemset do\n\t\t\t\t\tdeps = make_gemset_recommendations( $hoespec.spec )\n\t\t\t\t\tupdates = deps.values.compact\n\n\t\t\t\t\tif !updates.empty?\n\t\t\t\t\t\t$stderr.puts \"%d gems in the current gemset have newer matching versions:\" %\n\t\t\t\t\t\t\t [ updates.length ]\n\t\t\t\t\t\tdeps.each do |old, newer|\n\t\t\t\t\t\t\tnext unless newer\n\t\t\t\t\t\t\t$stderr.puts \" #{old} -> #{newer}\"\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tif ask( \"Update? \" )\n\t\t\t\t\t\t\tupdate_rvm_gemset( deps )\n\t\t\t\t\t\t\trun 'rvm', 'gemset', 'import', RVM_GEMSET.to_s\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\tend\n\n\t\t### Make the ChangeLog update if the repo has changed since it was last built\n\t\tfile '.hg/branch'\n\t\tfile 'ChangeLog' => '.hg/branch' do |task|\n\t\t\t$stderr.puts \"Updating the changelog...\"\n\t\t\tcontent = make_changelog()\n\t\t\tFile.open( task.name, 'w', 0644 ) do |fh|\n\t\t\t\tfh.print( content )\n\t\t\tend\n\t\tend\n\n\tend",
"def define_tasks\r\n define_clobber_task\r\n define_build_task\r\n end",
"def define_tasks\r\n define_repeat_task\r\n define_clobber_task\r\n define_build_task\r\n end",
"def simple_rake_task(task_name = 'test_task', indent: '', task_body: \"\\n\")\n \"\\n\" + indent +\n \"desc 'task named #{task_name}'\\n\" +\n indent + \"task :#{task_name} do\\n\" +\n indent + \" \" + task_body +\n indent + \"end\\n\\n\"\n\n end",
"def define_sanitycheck_tasks\n\n\t\ttask 'hg:precheckin' => [:spec] if File.directory?( 'spec' )\n\t\ttask 'hg:prep_release' => [ :check_manifest, :check_history ]\n\n\t\t# Rebuild the ChangeLog immediately before release\n\t\ttask :check_manifest => 'ChangeLog'\n\t\ttask :prerelease => 'ChangeLog'\n\n\tend",
"def define_specs_task\n require 'active_record/version'\n\n if ActiveRecord::VERSION::MAJOR > 2\n # rspec 2\n require \"rspec/core/rake_task\"\n RSpec::Core::RakeTask.new(:specs) do |spec|\n spec.pattern = \"spec/*_spec.rb\"\n end\n else\n # rspec 1\n require 'spec/rake/spectask'\n Spec::Rake::SpecTask.new(:specs) do |spec|\n spec.libs << 'lib' << 'spec'\n spec.spec_files = FileList['spec/**/*_spec.rb']\n end\n end\nend",
"def declare_rake_tasks\n @flavor.class.do_declare_resources do\n if snippet?('cookbook_base')\n rake_tasks['foodcritic'] = <<'END'\nrequire 'foodcritic'\nrequire 'foodcritic/rake_task'\n\nFoodCritic::Rake::LintTask.new(:foodcritic)\ntask style: :foodcritic\nEND\n end\n end\n end",
"def build_rake_step(b, tasks)\n b.tag! \"hudson.plugins.rake.Rake\" do\n b.rakeInstallation \"(Default)\"\n b.rakeFile\n b.rakeLibDir\n b.rakeWorkingDir\n b.tasks tasks\n b.silent false\n end\n end",
"def define_newgem_tasks\n unless self.extra_dev_deps.find { |dep| dep.first == 'newgem' }\n require File.dirname(__FILE__) + '/../newgem'\n self.extra_dev_deps ||= []\n self.extra_dev_deps << ['newgem', \">= #{::Newgem::VERSION}\"] unless name == 'newgem'\n end\n \n return if Rake::Task.tasks.find { |t| t.name == 'gemspec' }\n desc \"Generate a #{name}.gemspec file\"\n task :gemspec do\n File.open(\"#{name}.gemspec\", \"w\") do |file|\n file.puts spec.to_ruby\n end\n end\n \n task :release do\n puts <<-EOS.gsub(/^ /,'')\n Remember to create tag your release; eg for Git:\n git tag REL-#{$hoe.version}\n\n Announce your release on RubyForge News:\n rake post_news\n EOS\n end\n\n task :check_version do\n unless ENV['VERSION']\n puts 'Must pass a VERSION=x.y.z release version'\n exit\n end\n unless ENV['VERSION'] == $hoe.version\n puts \"Please update your lib/#{$hoe.name}.rb to match the release version, currently #{$hoe.version}\"\n exit\n end\n end\n\n desc 'Install the package as a gem, without generating documentation(ri/rdoc)'\n task :install_gem_no_doc => [:clean, :package] do\n sh \"#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri\"\n end\n \n task :ruby_env do\n $ruby_app = if RUBY_PLATFORM =~ /java/\n \"jruby\"\n else\n \"ruby\"\n end\n end\n \n end",
"def test_pour nom, description\n desc description\n task nom do\n sh %{rake tous_les_tests TEST=spec/#{nom.to_s}_spec.rb}\n end\nend",
"def build_default_tasks\n @rake_task << self.step_template # get General Configuration information\n end",
"def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend",
"def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend",
"def generate_rake_tasks\n @rake_tasks = outputs.map do |output, inputs|\n additional_paths = []\n inputs.each do |input|\n\n create_file_task(input.fullpath).dynamic do\n additional_paths += additional_dependencies(input)\n end\n end\n additional_paths.each { |path| create_file_task(path) }\n\n create_file_task(output.fullpath, inputs.map(&:fullpath)) do\n output.create { generate_output(inputs, output) }\n end\n end\n end",
"def define_tasks\n # Run the command on the local system\n def run(cmd)\n Kernel.system(cmd.runnable)\n end\n # Basic setup action\n def setup_application\n @options ||= PoolParty.options(ARGV.dup)\n end\n \n # Require the poolparty specific tasks\n compiled_rakefile\n \n desc \"Reload the static variables\"\n task :reload do\n reload!\n end\n true\n end",
"def build_rake_step\n @rake_task << self.global_config # Open the rake Stek and get General Configuration information\n @rake_task << (self.render self.get_config_template) # get Specific Configuration. Defined in the [tool].rb module file (erb)\n @opt_parser.check_error # stop here if errors found in the configuration\n @rake_task << self.test_validation # step is already done ? Defined in the tool_template.rb file\n @rake_task << (self.render self.tool_template) # get specific Task Code. Defined in the [tool].rb module file (erb)\n @rake_task << self.write_validation # write the check file Defined in the tool_template.rb file\n @rake_task << self.close_step # To close the rake Step Defined in the tool_template.rb file\n end",
"def build_tasks\n all_output.split(\"\\n\").map do |task|\n next unless task.start_with? 'rake'\n task.split(\"#\").map{|t| t.strip.sub(/^rake /, '')}\n end.compact\n end",
"def create_rake_files(base_dir)\n\n one_task_fn = File.join(base_dir, 'one_task.rake')\n make_tasks_in_file(['one_task'], one_task_fn) if ok_to_create?(one_task_fn)\n\n another_task_fn = File.join(base_dir, 'another_task.rake')\n make_tasks_in_file(['another_task'], another_task_fn) if ok_to_create?(another_task_fn)\n\n my_tasks_mine_fn = File.join(base_dir, 'my_tasks_all_mine.rake')\n make_tasks_in_file(['task1', 'task2', 'task3', 'task4'], my_tasks_mine_fn, namespace: 'mine') if ok_to_create?(my_tasks_mine_fn)\n\n tasks_run_all_fn = File.join(base_dir, 'other_tasks_run_all.rake')\n make_tasks_in_file(['other_task1_run_me', 'other_task2_run_me', 'other_task3_run_me', 'other_task_not_run_yet'], tasks_run_all_fn) if ok_to_create?(tasks_run_all_fn)\n\n tasks_mixed_duplicates_fn = File.join(base_dir, 'other_tasks_mixed_duplicates.rake')\n make_tasks_in_file(['other_task2_run_me', 'other_task3_run_me'], tasks_mixed_duplicates_fn) if ok_to_create?(tasks_mixed_duplicates_fn)\n\n task2_duplicate_fn = File.join(base_dir, 'task2_duplicate.rake')\n make_tasks_in_file(['task2'], task2_duplicate_fn, namespace: 'mine') if ok_to_create?(task2_duplicate_fn)\n\n task4_duplicate_fn = File.join(base_dir, 'task4_duplicate.rake')\n make_tasks_in_file(['task4'], task4_duplicate_fn, namespace: 'mine') if ok_to_create?(task4_duplicate_fn)\n end",
"def collect_tasks\n tasks = []\n $sake_op = {}\n ARGV.each do |arg|\n if arg =~ /^(\\w+)=(.*)$/\n ENV[$1] = $2\n $sake_op[$1.to_sym] = $2\n else\n tasks << arg\n end\n end\n tasks.push(\"default\") if tasks.size == 0\n tasks\n end",
"def load_tasks\n end",
"def install_tasks\n load 'falkorlib/tasks/git.rake'\n load 'falkorlib/tasks/gitflow.rake'\n end",
"def prepare_task\n end",
"def define_clean_tasks\n require 'rake/clean'\n end",
"def define_publish_tasks\n if need_rdoc then\n task :isolate # ensure it exists\n\n desc \"Generate rdoc\"\n task :docs => [:clobber_docs, :isolate] do\n sh(*make_rdoc_cmd)\n end\n\n desc \"Generate rdoc coverage report\"\n task :dcov => :isolate do\n sh(*make_rdoc_cmd(\"-C\"))\n end\n\n desc \"Remove RDoc files\"\n task :clobber_docs do\n rm_rf local_rdoc_dir\n end\n\n task :clobber => :clobber_docs\n\n desc \"Generate ri locally for testing.\"\n task :ridocs => [:clean, :isolate] do\n sh(*make_rdoc_cmd(\"--ri\", \"-o\", \"ri\"))\n end\n end\n\n desc \"Publish RDoc to wherever you want.\"\n task :publish_docs => [:clean, :docs] do\n publish_docs_task\n end\n\n # no doco for this one\n task :publish_on_announce do\n publish_on_announce_task\n end\n\n desc \"Generate email announcement file.\"\n task :debug_email do\n puts generate_email ENV[\"FULL\"]\n end\n\n desc 'Post announcement to blog. Uses the \"blogs\" array in your hoerc.'\n task :post_blog do\n post_blog_task\n end\n\n desc \"Announce your release.\"\n task :announce => [:post_blog, :publish_on_announce ]\n end",
"def define_publish_tasks\n Rake::RDocTask.new(:docs) do |rd|\n rd.main = readme_file\n rd.options << '-d' if (`which dot` =~ /\\/dot/) unless\n ENV['NODOT'] || Hoe::WINDOZE\n rd.rdoc_dir = 'doc'\n\n rd.rdoc_files += spec.require_paths\n rd.rdoc_files += spec.extra_rdoc_files\n\n title = \"#{name}-#{version} Documentation\"\n title = \"#{rubyforge_name}'s \" + title if rubyforge_name != name\n\n rd.options << \"-t\" << title\n end\n\n desc 'Generate ri locally for testing.'\n task :ridocs => :clean do\n sh %q{ rdoc --ri -o ri . }\n end\n\n desc 'Publish RDoc to RubyForge.'\n task :publish_docs => [:clean, :docs] do\n config = YAML.load(File.read(File.expand_path(\"~/.rubyforge/user-config.yml\")))\n host = \"#{config[\"username\"]}@rubyforge.org\"\n\n remote_dir = \"/var/www/gforge-projects/#{rubyforge_name}/#{remote_rdoc_dir}\"\n local_dir = 'doc'\n\n sh %{rsync #{rsync_args} #{local_dir}/ #{host}:#{remote_dir}}\n end\n\n # no doco for this one\n task :publish_on_announce do\n with_config do |config, _|\n Rake::Task['publish_docs'].invoke if config[\"publish_on_announce\"]\n end\n end\n\n desc 'Generate email announcement file.'\n task :email do\n require 'rubyforge'\n subject, title, body, urls = announcement\n\n File.open(\"email.txt\", \"w\") do |mail|\n mail.puts \"Subject: [ANN] #{subject}\"\n mail.puts\n mail.puts title\n mail.puts\n mail.puts urls\n mail.puts\n mail.puts body\n mail.puts\n mail.puts urls\n end\n puts \"Created email.txt\"\n end\n\n desc 'Post announcement to blog.'\n task :post_blog do\n require 'xmlrpc/client'\n\n with_config do |config, path|\n break unless config['blogs']\n\n subject, title, body, urls = announcement\n body += \"\\n\\n#{urls}\"\n\n config['blogs'].each do |site|\n server = XMLRPC::Client.new2(site['url'])\n content = site['extra_headers'].merge(:title => title,\n :description => body,\n :categories => blog_categories)\n\n result = server.call('metaWeblog.newPost',\n site['blog_id'],\n site['user'],\n site['password'],\n content,\n true)\n end\n end\n end\n\n desc 'Post announcement to rubyforge.'\n task :post_news do\n require 'rubyforge'\n subject, title, body, urls = announcement\n\n rf = RubyForge.new.configure\n rf.login\n rf.post_news(rubyforge_name, subject, \"#{title}\\n\\n#{body}\")\n puts \"Posted to rubyforge\"\n end\n\n desc 'Create news email file and post to rubyforge.'\n task :announce => [:email, :post_news, :post_blog, :publish_on_announce ]\n end",
"def schedule_task taskname, feature\r\n file_momonga = \"#{RELEASE_DIRECTORY}momonga.#{taskname}.js\"\r\n file_release = \"#{RELEASE_DIRECTORY}AzureaVim#{taskname === 'default' ? '' : '.' + taskname}.js\"\r\n feature.each do |key, value|\r\n \r\n task \"#{taskname}__#{key}\" => value.collect{|item| \"#{taskname}__#{item}\"} do |tsk|\r\n puts \"#{file_momonga} << #{key}\"\r\n open file_momonga, 'a' do |momonga_js|\r\n open(\"../src/#{key}.js\"){|key_js| momonga_js.puts key_js.read}\r\n end\r\n end\r\n \r\n end\r\n \r\n desc file_momonga\r\n task \"momonga_#{taskname}\" => feature.keys.collect{|item| \"#{taskname}__#{item}\"} do\r\n paste_parts file_momonga, taskname\r\n end\r\n \r\n desc file_release\r\n task \"build_#{taskname}\" => \"momonga_#{taskname}\" do |tsk|\r\n compile_js file_momonga, file_release\r\n write_metainfo file_release\r\n end\r\n \r\n $DEBUG_TASKS.push \"momonga_#{taskname}\"\r\n $RELEASE_TASKS.push \"build_#{taskname}\"\r\n CLEAN.include file_momonga\r\n CLOBBER.include file_release\r\nend",
"def list_available_build_tasks\n cd 'cookbooks/example'\n unset_bundler_env_vars\n run_simple 'bundle exec rake -T'\n end",
"def connect_common_tasks\n desc \"Build the code narrative HTML\"\n ::Rake::Task.define_task(:codnar => \"codnar_weave\")\n desc \"Remove woven HTML documentation\"\n ::Rake::Task.define_task(\"clobber_codnar\") { rm_rf(@output) }\n ::Rake::Task.define_task(:clobber => \"clobber_codnar\")\n end",
"def rake(*tasks)\n \"rake #{tasks.join(' ')}\"\n end",
"def rake *args\n ruby \"-S\", \"rake\", *args\nend",
"def define\r\n\t\t\ttask :foo do\r\n\t\t\t\tputs 'foo!'\r\n\t\t\tend\r\n\t\tend",
"def declare_rakefile\n @flavor.class.do_declare_resources do\n # :nocov:\n lazy_vars = Chef::DelayedEvaluator.new do\n { tasks: rake_tasks }\n end\n # :nocov:\n add_templates(%w(Rakefile), :create, variables: lazy_vars)\n end\n end",
"def define_test_tasks\n default_tasks = []\n\n task :test\n\n if File.directory? \"test\" then\n case testlib\n when :minitest then\n require \"minitest/test_task\" # in minitest 5.16+\n\n test_prelude = self.test_prelude\n self.test_task = Minitest::TestTask.create :test do |t|\n t.test_prelude = test_prelude\n t.libs.prepend Hoe.include_dirs.uniq\n end\n when :none then\n # do nothing\n else\n warn \"Unsupported? Moving to Minitest::TestTask. Let me know if you use this!\"\n end\n\n desc \"Run the test suite using multiruby.\"\n task :multi do\n skip = with_config do |config, _|\n config[\"multiruby_skip\"] + self.multiruby_skip\n end\n\n ENV[\"EXCLUDED_VERSIONS\"] = skip.join(\":\")\n system \"multiruby -S rake\"\n end\n\n default_tasks << :test\n end\n\n desc \"Run the default task(s).\"\n task :default => default_tasks\n\n desc \"Run ZenTest against the package.\"\n task :audit do\n libs = %w[lib test ext].join(File::PATH_SEPARATOR)\n sh \"zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(\" \")}\"\n end\n end",
"def define_all_task\n define_desc_task(\"Version, verify, document, package\", :all => [ :version, :verify, :doc, :package ])\n define_verify_task\n define_doc_task\n define_commit_task\n # This is a problem. If the version number gets updated, Gem::PackageTask\n # fails. This is better than if it used the old version number, I\n # suppose, but not as nice as if it just used @spec.version everywhere.\n # The solution for this is to do a dry run before doing the final +rake+\n # +commit+, which is a good idea in general.\n Gem::PackageTask.new(@spec) { |package| }\n end",
"def convert_to_rake()\n object_multitask = prepare_tasks_for_objects()\n\n res = typed_file_task get_rake_task_type(), get_task_name => object_multitask do\n cmd = calc_command_line\n Dir.chdir(@project_dir) do\n mapfileStr = @mapfile ? \" >#{@mapfile}\" : \"\"\n rd, wr = IO.pipe\n cmdLinePrint = cmd\n printCmd(cmdLinePrint, \"Linking #{executable_name}\", false) #OK\n cmd << {\n :out=> @mapfile ? \"#{@mapfile}\" : wr, # > xy.map\n :err=>wr\n }\n sp = spawn(*cmd)\n cmd.pop\n # for console print\n cmd << \" >#{@mapfile}\" if @mapfile\n consoleOutput = ProcessHelper.readOutput(sp, rd, wr)\n\n process_result(cmdLinePrint, consoleOutput, @tcs[:LINKER][:ERROR_PARSER], nil)\n check_config_file()\n post_link_hook(@tcs[:LINKER])\n end\n end\n res.tags = tags\n res.immediate_output = true\n res.enhance(@config_files)\n res.enhance([@project_dir + \"/\" + @linker_script]) if @linker_script\n\n add_output_dir_dependency(get_task_name, res, true)\n add_grouping_tasks(get_task_name)\n setup_rake_dependencies(res, object_multitask)\n\n # check that all source libs are checked even if they are not a real rake dependency (can happen if \"build this project only\")\n begin\n libChecker = task get_task_name+\"LibChecker\" do\n if File.exists?(get_task_name) # otherwise the task will be executed anyway\n all_dependencies.each do |bb|\n if bb and StaticLibrary === bb\n f = bb.get_task_name # = abs path of library\n if not File.exists?(f) or File.mtime(f) > File.mtime(get_task_name)\n def res.needed?\n true\n end\n break\n end\n end\n end\n end\n end\n rescue\n def res.needed?\n true\n end\n end\n libChecker.transparent_timestamp = true\n res.enhance([libChecker])\n\n return res\n end",
"def remove_desc_for_task( names )\n Array(names).each do |task_name|\n task = Rake.application.tasks.find {|t| t.name == task_name}\n next if task.nil?\n task.instance_variable_set :@comment, nil\n end\nend",
"def define_package_tasks\n prerelease_version\n\n Gem::PackageTask.new spec do |pkg|\n pkg.need_tar = @need_tar\n pkg.need_zip = @need_zip\n end\n\n desc \"Install the package as a gem. (opt. NOSUDO=1)\"\n task :install_gem => [:clean, :package, :check_extra_deps] do\n install_gem Dir[\"pkg/*.gem\"].first\n end\n\n desc \"Package and upload; Requires VERSION=x.y.z (optional PRE=a.1)\"\n task :release => [:prerelease, :release_to, :postrelease]\n\n # no doco, invisible hook\n task :prerelease do\n abort \"Fix your version before you release\" if spec.version.to_s =~ /borked/\n end\n\n # no doco, invisible hook\n task :release_to\n\n # no doco, invisible hook\n task :postrelease\n\n desc \"Sanity checks for release\"\n task :release_sanity do\n v = ENV[\"VERSION\"] or abort \"Must supply VERSION=x.y.z\"\n\n pre = ENV[\"PRERELEASE\"] || ENV[\"PRE\"]\n v += \".#{pre}\" if pre\n\n c = changes[/\\d\\S+/]\n\n abort \"Versions don't match: %s vs %s\" % [v, version] if v != version\n abort \"Versions don't match %s: %s vs %s\" % [history_file, v, c] if v != c\n end\n end",
"def define_perforce_tasks\n warn :define_perforce_tasks if $DEBUG\n\n desc \"branch the project from dev to version dir\"\n task :branch do\n original_dir = File.basename(Dir.pwd)\n\n Dir.chdir \"..\"\n\n target_dir = File.directory?(version) ? version : original_dir\n branching = target_dir == original_dir && target_dir != version\n pkg = File.basename(Dir.pwd)\n\n begin\n p4_integrate original_dir, version if branching\n validate_manifest_file version\n p4_submit \"Branching #{pkg} to version #{version}\" if branching\n rescue => e\n warn e\n p4_revert version\n raise e\n end\n\n Dir.chdir version\n end\n\n task :prerelease => :branch\n\n task :postrelease => :announce do\n system 'rake clean'\n end\n\n desc \"Generate historical flog/flay data for all releases\"\n task :history do\n p4_history\n end\n end",
"def define_extension_tasks\n\t\tENV['RUBY_CC_VERSION'] ||= RUBY_VERSION[ /(\\d+\\.\\d+)/ ]\n\n\t\trequire 'rake/extensiontask'\n\t\tself.extensions.each do |extconf|\n\t\t\tRake::ExtensionTask.new( extconf.pathmap('%{ext/,}d') )\n\t\tend\n\n\t\ttask :spec => :compile\n\n\t\ttask :maint do\n\t\t\tENV['V'] = '1'\n\t\t\tENV['MAINTAINER_MODE'] = 'yes'\n\t\tend\n\tend",
"def simpleTasks _args\n \"simpleTasks _args;\" \n end",
"def custom_configure_tasks_for(a=nil)\n []\n end",
"def define_test_tasks!\n require 'rake/testtask'\n\n namespace(:test) do\n Rake::TestTask.new(:basic) do |t|\n t.pattern = test_pattern\n t.verbose = true\n t.libs << 'test'\n end\n end\n\n desc \"Run all unit tests for #{gemspec.name}\"\n task(:test => ['test:basic'])\n end",
"def rake(task,*args)\n run 'rake', rake_task(task,*args)\n end",
"def remove_desc_for_task( names )\n Array(names).each do |task_name|\n task = Rake.application.tasks.find {|t| t.name == task_name}\n next if task.nil?\n task.instance_variable_set :@comment, nil\n end\nend",
"def rake_task task_name\n @rake.invoke_task task_name\n end",
"def make_test_task\n return if Rake::Task.task_defined? :test\n test = Rake::Task.define_task :test do\n wix_run 'smoke', \"-nologo wix/#{name}.msi\"\n end\n test.comment = 'Validate the MSI'\n end",
"def execute_task\n create_test_files\n commands = rake_result[:commands] = []\n allow(task).to receive(:sh) do |command, _|\n commands << command\n end\n Rake::Task[:default].invoke\n end",
"def taskOpts\nend",
"def define\n\t\ttask :foo do\n\t\t\tputs 'foo!'\n\t\tend\n\tend",
"def define_tasks\n private_methods.grep(/^define_(\\w+)_tasks$/).each do |meth| \n namespace_name = meth.match(/^define_(\\w+)_tasks$/)[1]\n send(meth)\n end\n end",
"def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend",
"def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend",
"def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend",
"def rake(*args) run_command('rake', args) end",
"def build_package_tasks(config)\n # The name of the task to build the package\n package_task_name = \"build_#{config[:package_name]}\"\n\n # Add task name to the list of dependencies for the :deb_packages task\n task :deb_packages => package_task_name\n\n # The path to the package source directory\n pkg_src_dir = File.join(PACKAGE_CONSTRUCTION_DIR, source_dir_name(config))\n\n # Directory task to ensure the existence of the directory\n directory pkg_src_dir\n\n # Create the tarball task\n orig_source_tarball_path = File.join(PACKAGE_CONSTRUCTION_DIR, \"#{orig_tar_ball_name(config)}.orig.tar.gz\")\n\n # The File task to construct the original source tarball.\n file orig_source_tarball_path => PACKAGE_CONSTRUCTION_DIR do\n system \"tar zcf #{orig_source_tarball_path} --directory #{PACKAGE_CONSTRUCTION_DIR} #{source_dir_name(config)}\"\n end\n\n # The path to the debian directory within the extracted source directory\n package_debian_path = File.join(pkg_src_dir, 'debian')\n\n # Directory task to the package debian path to ensure existence.\n directory package_debian_path\n\n # The task that actually constructs the debian package\n task package_task_name => orig_source_tarball_path do\n # Build the spanky little thing.\n debuild_flag = ENV['debuild'] || 'true'\n if debuild_flag == 'true'\n system \"cd #{pkg_src_dir}; debuild -us -uc\"\n else\n puts \"Skipping build; debug flag was set\"\n end\n end\n\n # Ensure we have set up the tasks for all the files to be included\n # in the package.\n config[:exes].each do | exe_name |\n exe_path = File.join(pkg_src_dir, exe_name.split('.').first)\n file exe_path => pkg_src_dir do\n cp exe_name, exe_path\n end\n\n # Add the file path as a dependency of the source tarball\n task orig_source_tarball_path => exe_path\n end\n\n # Create the task to populate the debian directory\n debian_task = \"populate_#{config[:package_name]}_debian_files\"\n task debian_task => package_debian_path do\n cp_r \"package_source/#{config[:package_name]}/debian\", pkg_src_dir\n end\n\n # Finally add the debian task as a dependency for the package task.\n task package_task_name => debian_task\nend",
"def updateDeps(rakeTask)\n\t\t#no-op\n\tend",
"def rake_task_name\n ENV['RAKE_TASK'].to_s.sub(/(?:r?spec|cucumber):?(.*)/, '\\1').upcase\n end",
"def custom_configure_tasks_for(a=nil)\n []\n end",
"def define\n desc @description\n task @name => Array(deps) do\n FileUtilsExt.verbose(@verbose) do\n puts \"Use TESTOPTS=\\\"--verbose\\\" to pass --verbose\" \\\n \", etc. to runners.\" if ARGV.include? \"--verbose\"\n args =\n \"#{ruby_opts_string} #{run_code} \" +\n \"#{file_list_string} #{option_list}\"\n ruby args do |ok, status|\n if !ok && status.respond_to?(:signaled?) && status.signaled?\n raise SignalException.new(status.termsig)\n elsif !ok\n status = \"Command failed with status (#{status.exitstatus})\"\n details = \": [ruby #{args}]\"\n message =\n if Rake.application.options.trace or @verbose\n status + details\n else\n status\n end\n\n fail message\n end\n end\n end\n end\n self\n end",
"def load_dummy_tasks(app_root)\n @target_extension_path = Pathname.new(app_root.to_s)\n load 'refinery/tasks/testing.rake'\n end",
"def configure_tasks\n super\n all_object_files = []\n all_object_folders = []\n @toolchains.each do |toolchain, sources|\n toolchain.add_include_paths(@api_headers+@configuration_headers)\n object_files, object_folders = toolchain.create_compile_tasks(sources)\n all_object_files |= object_files\n all_object_folders |= object_folders\n end\n\n project_filename = @parent_project.project_name.to_s.gsub(':','-')\n library_files, library_folders = @default_toolchain.create_static_library_tasks(all_object_files, project_filename)\n dependencies = @dependencies+all_object_folders+library_folders+library_files\n\n desc \"Build library '#{@parent_project.project_name}' with configuration '#{@configuration_name}'\"\n new_task = static_library_task @configuration_name => dependencies do |t|\n @post_build.call if @post_build.respond_to? :call\n puts \"built library #{t.name}.\"\n @tests.each do |test|\n if Rake::Task.task_defined? test\n Rake::Task[test].invoke\n else\n $stderr.puts \"warning: Skipping unknown test '#{test}'\"\n end\n end\n end\n new_task.api_headers = @api_headers\n new_task.configuration_headers = @configuration_headers\n new_task.library_files = library_files\n end",
"def tasks() []; end",
"def setup_tests\n Rake::TestTask.new do |t|\n t.libs << \"test\"\n t.test_files = FileList['test/test*.rb']\n t.verbose = true\n end\nend",
"def handle_rake_test_task\n test_task = @target\n all_tests = test_task.file_list\n\n @target = test_task.name\n @globs << test_task.file_list\n @options[:force] = true\n\n lambda do |changed|\n tests = all_tests & changed\n\n basenames = (changed - tests).collect do |f|\n File.basename(f).split(\".\").first\n end\n\n tests.concat all_tests.\n select { |t| basenames.any? { |b| t =~ /#{b}/ } }\n\n tests = all_tests.dup if tests.empty?\n\n # Nice API, Rake::TestTask.\n ENV[\"TEST\"] = \"{#{tests.uniq.join(',')}}\"\n end\n end",
"def define_asciidoc_tasks\n if defined?(AsciiDocTasks) && File.exist?(\"#{doc_dir}/asciidoc.conf\") && asciidoc_available?\n man_pages = FileList[\"#{doc_dir}/*.[0-9].txt\"]\n articles = FileList[\"#{doc_dir}/*.txt\"] - man_pages\n desc \"Build AsciiDoc under #{doc_dir}\"\n AsciiDocTasks.new('doc:asciidoc') do |t|\n t.source_dir = doc_dir\n t.source_files = articles\n t.doc_type = :article\n t.config_file = \"#{doc_dir}/asciidoc.conf\"\n t.attributes = asciidoc_attributes\n end\n AsciiDocTasks.new('doc:asciidoc') do |t|\n t.source_dir = doc_dir\n t.source_files = man_pages\n t.doc_type = :manpage\n t.config_file = \"#{doc_dir}/asciidoc.conf\"\n t.attributes = asciidoc_attributes\n end\n else\n desc \"Build AsciiDoc (disabled)\"\n task 'asciidoc'\n task 'asciidoc:build'\n task 'asciidoc:clean'\n task 'asciidoc:rebuild'\n end\n task 'doc:build' => 'doc:asciidoc:build'\n task 'doc:clean' => 'doc:asciidoc:clean'\n task 'doc:rebuild' => 'doc:asciidoc:rebuild'\n end",
"def rake_functionals(opts=nil)\n if ENV['RUBYOPT']\n # remove bundler/setup require that prematurely checks for gems and crashes\n ENV['RUBYOPT'] = ENV['RUBYOPT'].gsub(%r{-r\\s*bundler/setup}, '')\n end\n # runs all the tests for each ruby version in each rails dir\n system(\"bash test/test.sh #{opts}\")\nend",
"def execute_tasks(tasks,template_path)\n \n if File.exists?(File.expand_path(File.join(template_path,'tasks.rb')))\n load File.expand_path(File.join(template_path,'tasks.rb'))\n end\n \n tasks.each{\n |task|\n \n puts 'Running Task: ' + task\n \n task = replace_tags(task);\n \n options = task.split(', ')\n action = options.slice!(0)\n \n if(Tasks.respond_to?(action))\n Tasks.send action, options.join(', ')\n else\n send action, options.join(', ')\n end\n \n }\n \n end",
"def description\n \"This task converts a netblock into host records\"\nend",
"def displayRakeTasks\n Rake.application.tasks.each do |iTask|\n log_info \"+-#{iTask.name}: #{iTask.comment}\"\n iTask.prerequisites.each do |iPrerequisiteTaskName|\n log_info \"| +-#{iPrerequisiteTaskName}\"\n end\n log_info '|'\n end\n end",
"def define_tasks\n @defines.each { |sym| send( sym ) }\n end",
"def jeweler_tasks; end",
"def load_tasks(tasks)\n load File.join(File.dirname(__FILE__), 'tasks', \"#{tasks}.rb\")\nend",
"def define_announce_tasks\n\n\t\t# Avoid broken Hoe 3.0 task\n\t\tRake::Task[:announce].clear if Rake::Task.task_defined?( :announce )\n\t\tRake::Task[:send_email].clear if Rake::Task.task_defined?( :send_email )\n\n\t\tdesc \"Announce a new release\"\n\t\ttask :announce => :send_email\n\n\t\tdesc \"Send a release announcement to: %p\" % [ @email_to ]\n\t\ttask :send_email do\n\t\t\tmail = generate_mail()\n\n\t\t\tsay \"<%= color 'About to send this email:', :subheader %>\"\n\t\t\tsay( mail.to_s )\n\n\t\t\tsmtp_host = @email_config['host'] || ask( \"Email host: \" )\n\t\t\tsmtp_port = @email_config['port'] || 'smtp'\n\t\t\tsmtp_port = Socket.getservbyname( smtp_port.to_s )\n\t\t\tsmtp_user = @email_config['user']\n\n\t\t\tif agree( \"\\n<%= color 'Okay to send it?', :warning %> \")\n\t\t\t\trequire 'socket'\n\t\t\t\trequire 'net/smtp'\n\t\t\t\trequire 'etc'\n\n\t\t\t\tusername = smtp_user || ask( \"Email username: \" ) do |q|\n\t\t\t\t\tq.default = Etc.getlogin # default to the current user\n\t\t\t\tend\n\t\t\t\tpassword = ask( \"Email password for #{username}: \" ) do |q|\n\t\t\t\t\tq.echo = color( '*', :yellow ) # Hide the password\n\t\t\t\tend\n\n\t\t\t\tsay \"Creating SMTP connection to #{smtp_host}:#{smtp_port}\"\n\t\t\t\tsmtp = Net::SMTP.new( smtp_host, smtp_port )\n\t\t\t\tsmtp.set_debug_output( $stdout )\n\t\t\t\tsmtp.esmtp = true\n\n\t\t\t\tssl_context = OpenSSL::SSL::SSLContext.new\n\t\t\t\tsmtp.enable_starttls( ssl_context )\n\n\t\t\t\thelo = Socket.gethostname\n\t\t\t\tsmtp.start( helo, username, password, :plain ) do |smtp|\n\t\t\t\t\tmail.delivery_method( :smtp_connection, :connection => smtp )\n\t\t\t\t\tmail.deliver\n\t\t\t\tend\n\n\n\t\t\telse\n\t\t\t\tabort \"Okay, aborting.\"\n\t\t\tend\n\t\tend\n\n\tend",
"def tasks\n ProjectConfiguration.templates[template]::TASKS\n end",
"def tasks\n ProjectConfiguration.templates[template]::TASKS\n end",
"def pre_task\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def define_run_task\n desc @run_description\n task 'run' do\n target_sha = ENV['TARGET_SHA']\n ts = TTNT::TestSelector.new(repo, target_sha, expanded_file_list)\n tests = ts.select_tests!\n\n if tests.empty?\n STDERR.puts 'No test selected.'\n else\n if ENV['ISOLATED']\n tests.each do |test|\n args = \"#{ruby_opts_string} #{test} #{option_list}\"\n run_ruby args\n break if @failed && ENV['FAIL_FAST']\n end\n else\n args =\n \"#{ruby_opts_string} #{run_code} \" +\n \"#{tests.to_a.join(' ')} #{option_list}\"\n run_ruby args\n end\n end\n end\n end",
"def define_debug_tasks\n desc \"Create a fresh ~/.hoerc file.\"\n task :config_hoe do\n with_config do |config, path|\n File.open(path, \"w\") do |f|\n YAML.dump(Hoe::DEFAULT_CONFIG.merge(config), f)\n end\n\n editor = ENV[\"EDITOR\"] || \"vi\"\n system \"#{editor} #{path}\" if ENV[\"SHOW_EDITOR\"] != \"no\"\n end\n end\n\n desc \"Verify the manifest.\"\n task :check_manifest => :clean do\n check_manifest\n end\n\n desc \"Show information about the gem.\"\n task :debug_gem do\n puts spec.to_ruby\n end\n\n task :isolate # stub\n task :irb => :isolate do\n name = spec.name.gsub(\"-\", \"/\")\n file = (spec.files.grep(/^lib\\/#{name}\\.rb$/).first ||\n spec.files.grep(/^lib\\/[^\\/]*\\.rb$/).first)\n\n require = File.basename(file, \".rb\") if file\n require &&= \"-r#{require}\"\n\n ruby \"#{Hoe::RUBY_FLAGS} -S irb #{require}\"\n end\n end",
"def pre_generation_hook(task)\n end",
"def alias_task(aliases)\n aliases.each do |alias_name,task_name|\n t = Rake::Task[task_name]\n task alias_name, *t.arg_names do |_, args|\n args = t.arg_names.map { |a| args[a] }\n t.invoke(args)\n end\n end\nend",
"def test_desc_dyn1\n r = `#{@minirake} -f fixtures/desc_dyn_task1.rb -T`\n assert r\n\n expected = <<EOF\ndynamicTest\n test task\nEOF\n\n assert_equal expected.rstrip, r.split(\"\\n\").join(\"\\n\")\n end",
"def task_warning( task )\n warn \"WARNING: '#{task}' tasks are not defined. Please run 'rake develop'\"\n end",
"def rake(app_name, cmd)\n # deprecated by virtue of start deprecation 08/02/2012\n start(app_name, \"rake #{cmd}\", :attached).to_s\n end",
"def exec_setup\n exec_task_traverse 'setup'\n end",
"def define_clean_tasks\n task :clobber_docs # no-op, just in case\n task :clobber_package # no-op, just in case\n\n desc \"Clean up all the extras.\"\n task :clean => [ :clobber_docs, :clobber_package ] do\n clean_globs.each do |pattern|\n files = Dir[pattern]\n rm_rf files, :verbose => true unless files.empty?\n end\n end\n end",
"def rakefiles\n @rakefiles ||= ['merb-core/test/tasks/spectasks']\n end",
"def cucumber_task(target,environment,url,prefix=\"\")\n cuke_task = CapyBrowser::Rake::CucumberTask.new(target,environment,url,prefix)\n desc cuke_task.description\n task( cuke_task.target, [:command_line_arguments] => CapyBrowser::Rake.dependencies) do |task,args|\n args.with_defaults(:command_line_arguments => \"\")\n puts CapyBrowser::Rake.cucumber(cuke_task.command_line( args.command_line_arguments)).invoke!\n end\nend",
"def run_a_rake_command(rake_task_and_args)\n cmd_helper = CtlCommandHelper.new('spdx-<command>')\n cmd_helper.must_run_as 'supermarket'\n\n command_text = cmd_helper.rails_env_cmd(\"bin/rake #{rake_task_and_args}\")\n shell_out = Mixlib::ShellOut.new(command_text)\n shell_out.run_command\n $stdout.puts shell_out.stdout\n $stderr.puts shell_out.stderr\n exit shell_out.exitstatus\nend"
] |
[
"0.75969243",
"0.75969243",
"0.72945106",
"0.7291641",
"0.7223362",
"0.7075083",
"0.70284677",
"0.68751985",
"0.6829137",
"0.68237686",
"0.6822566",
"0.6819488",
"0.6792991",
"0.67732215",
"0.6745635",
"0.6741048",
"0.67355126",
"0.66731876",
"0.66634905",
"0.66278875",
"0.66211647",
"0.6610979",
"0.6598377",
"0.6565146",
"0.6565146",
"0.6553478",
"0.6549773",
"0.65445524",
"0.6512204",
"0.64822346",
"0.6454393",
"0.64511484",
"0.6435939",
"0.64326113",
"0.64076704",
"0.64066935",
"0.63532734",
"0.63495016",
"0.6339352",
"0.6331503",
"0.63264066",
"0.63234574",
"0.62976986",
"0.62677044",
"0.6264888",
"0.6259155",
"0.6256932",
"0.6255271",
"0.6251242",
"0.6236004",
"0.62333184",
"0.62282807",
"0.62242645",
"0.61954254",
"0.6194561",
"0.6192274",
"0.61874646",
"0.6179217",
"0.6177206",
"0.6174328",
"0.6172268",
"0.61713797",
"0.6169779",
"0.6169779",
"0.6169779",
"0.61618227",
"0.6159645",
"0.61538655",
"0.61537135",
"0.6153567",
"0.6149132",
"0.61478436",
"0.614212",
"0.6131864",
"0.61315536",
"0.6127704",
"0.6111024",
"0.6081891",
"0.6077033",
"0.6070259",
"0.6067647",
"0.60553986",
"0.60542697",
"0.60540426",
"0.6042783",
"0.6041828",
"0.6041828",
"0.6037325",
"0.60348386",
"0.60151684",
"0.6012154",
"0.5993914",
"0.59921503",
"0.5991896",
"0.59847367",
"0.59840524",
"0.59750414",
"0.5974844",
"0.59742147",
"0.59708565",
"0.59671986"
] |
0.0
|
-1
|
def revision(scm, target, ref)
|
def revision(host, scm, target, ref)
args = []
case scm
when 'hg'
args.push('update', 'clean', '-r', ref)
when 'git'
args.push('reset', '--hard', ref)
else
fail "Unfortunately #{scm} is not supported yet"
end
on host, "cd #{target} && #{scm} #{args.flatten.join ' '}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fetch_revision\n end",
"def ref\n reference(@id, @revision)\n end",
"def get_revision(rev = 'HEAD')\n unless @resource.value(:source)\n status = at_path { git_with_identity('status') }\n is_it_new = status =~ %r{Initial commit|No commits yet}\n if is_it_new\n status =~ %r{On branch (.*)}\n branch = Regexp.last_match(1)\n return branch\n end\n end\n current = at_path { git_with_identity('rev-parse', rev).strip }\n if @resource.value(:revision) == current\n # if already pointed at desired revision, it must be a SHA, so just return it\n return current\n end\n if @resource.value(:source)\n update_references\n end\n if @resource.value(:revision)\n canonical = if tag_revision?\n # git-rev-parse will give you the hash of the tag object itself rather\n # than the commit it points to by default. Using tag^0 will return the\n # actual commit.\n at_path { git_with_identity('rev-parse', \"#{@resource.value(:revision)}^0\").strip }\n elsif local_branch_revision?\n at_path { git_with_identity('rev-parse', @resource.value(:revision)).strip }\n elsif remote_branch_revision?\n at_path { git_with_identity('rev-parse', \"#{@resource.value(:remote)}/#{@resource.value(:revision)}\").strip }\n else\n # look for a sha (could match invalid shas)\n at_path { git_with_identity('rev-parse', '--revs-only', @resource.value(:revision)).strip }\n end\n raise(\"#{@resource.value(:revision)} is not a local or remote ref\") if canonical.nil? || canonical.empty?\n current = @resource.value(:revision) if current == canonical\n end\n current\n end",
"def revision_from_ref(repo_path, ref)\n begin\n show_ref(repo_path, ref)\n rescue GitError\n begin\n git('rev-parse', ref)\n ref\n rescue GitError\n raise InvalidGitRef, ref\n end\n end\n end",
"def fetch_revision\n context.capture \"cat #{repo_path}/#{release_timestamp}_REVISION\"\n end",
"def query_revision(reference)\n raise ArgumentError, \"Deploying remote branches is no longer supported. Specify the remote branch as a local branch for the git repository you're deploying from (ie: '#{reference.gsub('origin/', '')}' rather than '#{reference}').\" if reference =~ /^origin\\//\n sha_hash = '[0-9a-f]{40}'\n return reference if reference =~ /^#{sha_hash}$/ # it's already a sha\n command = scm('ls-remote', configuration[:repository], reference)\n result = nil\n begin\n result = yield(command)\n rescue ChefDeployFailure => e\n raise obvious_error(\"Could not access the remote Git repository. If this is a private repository, please verify that the deploy key for your application has been added to your remote Git account.\", e)\n end\n unless result =~ /^(#{sha_hash})\\s+(\\S+)/\n raise \"Unable to resolve reference for '#{reference}' on repository '#{configuration[:repository]}'.\"\n end\n newrev = $1\n newref = $2\n return newrev\n end",
"def revision\n # HEAD is the default, but lets just be explicit here.\n get_revision('HEAD')\n end",
"def revision(revision)\n revision = 'HEAD' if revision =~ /head/i\n \"`#{git_cmd} rev-parse #{revision}`\"\n end",
"def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={}, &block)\r\n logger.debug \"<cvs> revisions path:'#{path}',identifier_from #{identifier_from}, identifier_to #{identifier_to}\"\r\n \r\n path_with_project=\"#{url}#{with_leading_slash(path)}\"\r\n cmd = \"#{CVS_BIN} -d #{root_url} rlog\"\r\n cmd << \" -d\\\">#{time_to_cvstime(identifier_from)}\\\"\" if identifier_from\r\n cmd << \" #{shell_quote path_with_project}\"\r\n shellout(cmd) do |io|\r\n state=\"entry_start\"\r\n \r\n commit_log=String.new\r\n revision=nil\r\n date=nil\r\n author=nil\r\n entry_path=nil\r\n entry_name=nil\r\n file_state=nil\r\n branch_map=nil\r\n \r\n io.each_line() do |line| \r\n \r\n if state!=\"revision\" && /^#{ENDLOG}/ =~ line\r\n commit_log=String.new\r\n revision=nil\r\n state=\"entry_start\"\r\n end\r\n \r\n if state==\"entry_start\"\r\n branch_map=Hash.new\r\n if /^RCS file: #{Regexp.escape(root_url_path)}\\/#{Regexp.escape(path_with_project)}(.+),v$/ =~ line\r\n entry_path = normalize_cvs_path($1)\r\n entry_name = normalize_path(File.basename($1))\r\n logger.debug(\"Path #{entry_path} <=> Name #{entry_name}\")\r\n elsif /^head: (.+)$/ =~ line\r\n entry_headRev = $1 #unless entry.nil?\r\n elsif /^symbolic names:/ =~ line\r\n state=\"symbolic\" #unless entry.nil?\r\n elsif /^#{STARTLOG}/ =~ line\r\n commit_log=String.new\r\n state=\"revision\"\r\n end \r\n next\r\n elsif state==\"symbolic\"\r\n if /^(.*):\\s(.*)/ =~ (line.strip) \r\n branch_map[$1]=$2\r\n else\r\n state=\"tags\"\r\n next\r\n end \r\n elsif state==\"tags\"\r\n if /^#{STARTLOG}/ =~ line\r\n commit_log = \"\"\r\n state=\"revision\"\r\n elsif /^#{ENDLOG}/ =~ line\r\n state=\"head\"\r\n end\r\n next\r\n elsif state==\"revision\"\r\n if /^#{ENDLOG}/ =~ line || /^#{STARTLOG}/ =~ line \r\n if revision\r\n \r\n revHelper=CvsRevisionHelper.new(revision)\r\n revBranch=\"HEAD\"\r\n \r\n branch_map.each() do |branch_name,branch_point|\r\n if revHelper.is_in_branch_with_symbol(branch_point)\r\n revBranch=branch_name\r\n end\r\n end\r\n \r\n logger.debug(\"********** YIELD Revision #{revision}::#{revBranch}\")\r\n \r\n yield Revision.new({ \r\n :time => date,\r\n :author => author,\r\n :message=>commit_log.chomp,\r\n :paths => [{\r\n :revision => revision,\r\n :branch=> revBranch,\r\n :path=>entry_path,\r\n :name=>entry_name,\r\n :kind=>'file',\r\n :action=>file_state\r\n }]\r\n }) \r\n end\r\n \r\n commit_log=String.new\r\n revision=nil\r\n \r\n if /^#{ENDLOG}/ =~ line\r\n state=\"entry_start\"\r\n end\r\n next\r\n end\r\n \r\n if /^branches: (.+)$/ =~ line\r\n #TODO: version.branch = $1\r\n elsif /^revision (\\d+(?:\\.\\d+)+).*$/ =~ line\r\n revision = $1 \r\n elsif /^date:\\s+(\\d+.\\d+.\\d+\\s+\\d+:\\d+:\\d+)/ =~ line\r\n date = Time.parse($1)\r\n author = /author: ([^;]+)/.match(line)[1]\r\n file_state = /state: ([^;]+)/.match(line)[1]\r\n #TODO: linechanges only available in CVS.... maybe a feature our SVN implementation. i'm sure, they are\r\n # useful for stats or something else\r\n # linechanges =/lines: \\+(\\d+) -(\\d+)/.match(line)\r\n # unless linechanges.nil?\r\n # version.line_plus = linechanges[1]\r\n # version.line_minus = linechanges[2]\r\n # else\r\n # version.line_plus = 0\r\n # version.line_minus = 0 \r\n # end \r\n else \r\n commit_log << line unless line =~ /^\\*\\*\\* empty log message \\*\\*\\*/\r\n end \r\n end \r\n end\r\n end\r\n end",
"def revision(revision)\n \"`#{p4_cmd} changes -s submitted -m 1 ...#{rev_no(revision)} | cut -f 2 -d\\\\ `\"\n end",
"def revision(revision)\n raise NotImplementedError\n end",
"def revision\n return changeset.rev if @changeset || @change_id\n link_rev\n end",
"def revision\r\n @revision\r\n end",
"def revision(version)\n revision_with audit_changes(version)\n end",
"def query_revision(revision)\n fast_remote_double_cache_remote_repository = variable(:fast_remote_double_cache_remote_repository)\n raise ArgumentError, \"Deploying remote branches is no longer supported. Specify the remote branch as a local branch for the git repository you're deploying from (ie: '#{revision.gsub('origin/', '')}' rather than '#{revision}').\" if revision =~ /^origin\\//\n return revision if revision =~ /^[0-9a-f]{40}$/\n command = scm('ls-remote', fast_remote_double_cache_remote_repository, revision)\n result = yield(command)\n revdata = result.split(/[\\t\\n]/)\n newrev = nil\n revdata.each_slice(2) do |refs|\n rev, ref = *refs\n if ref.sub(/refs\\/.*?\\//, '').strip == revision.to_s\n newrev = rev\n break\n end\n end\n raise \"Unable to resolve revision for '#{revision}' on repository '#{fast_remote_double_cache_remote_repository}'.\" unless newrev =~ /^[0-9a-f]{40}$/\n return newrev\n end",
"def revision\n if @new_resource.revision == 'HEAD'\n ['-A']\n else\n ['-r', @new_resource.revision]\n end\n end",
"def fetch_revision(commit)\n `git rev-parse #{commit}`.tr(\"\\n\", '')\n end",
"def revision=(v)\r\n @revision = v\r\n end",
"def revision\n 99\n end",
"def current_revision\n @svninfo.current_revision\n end",
"def exchange_real_revision(config)\n \n # check if the scm_command exists if it is set\n if config[:scm_command] && !File.file?(config[:source].local.command)\n logger.important(\"Local scm command not found: #{config[:source].local.command}\")\n throw :abort_called_by_capistrano, :capistrano_abort\n end\n \n config.set(:real_revision) do\n config[:source].local.query_revision(config[:revision]) do |cmd| \n config.with_env(\"LC_ALL\", \"C\") do\n \n stdout_output = ''\n stderr_output = ''\n \n status = Open4::popen4(cmd) do |pid, stdin, stdout, stderr|\n stdin.close\n stdout_output = stdout.read.strip\n stderr_output = stderr.read.strip\n #logger.trace(\"LOCAL SCM OUT: #{stdout_output}\") unless stdout_output.blank?\n logger.important(\"LOCAL SCM ERROR: #{stderr_output}\") unless stderr_output.blank?\n end\n\n if status.exitstatus != 0 # Error\n logger.important(\"Local scm command failed\")\n \n # exit deployment in a hard way as no rollback is need (we never read the revision to deploy)\n # an alternative would be to raise Capistrano::Error, this would trigger a rollback\n throw :abort_called_by_capistrano, :capistrano_abort\n else # OK\n stdout_output\n end\n \n end\n end \n end\n\n end",
"def file_revision_at(file, ref)\n file = file.gsub(%r{^/}, '')\n content = sh_string(\"git show #{ref}:#{ShellTools.escape(file)}\")\n tmp_path = File.expand_path(File.basename(file), Dir.tmpdir)\n File.open(tmp_path, 'w') { |f| f.puts content }\n tmp_path\n end",
"def rev_parse(ref)\n commit = git \"rev-parse #{ref}^{commit}\", :path => @full_path\n commit.chomp\n rescue R10K::ExecutionFailure => e\n logger.error \"Could not resolve ref #{ref.inspect} for git repo #{@full_path}\"\n raise\n end",
"def revision\n @handler.revision_info['commit']\n end",
"def start_revision(revision)\n end",
"def rev_parse_target(revspec)\n obj = rugged.rev_parse(revspec)\n Ref.dereference_object(obj)\n end",
"def query_revision(revision)\n return revision if revision =~ /^\\d+$/\n result = yield(scm(:info, repository, authentication, \"-r#{revision}\"))\n YAML.load(result)['Revision']\n end",
"def revision\n @revision ||= if token.nil? || relevant_packages.empty?\n 1\n else\n relevant_packages.map do |p|\n p['release'].to_i\n end.sort.last + 1\n end\n end",
"def revision\n return @changeset.revision if @changeset\n file_log[@file_rev].link_rev\n end",
"def revision(number=nil)\n return nil if number.nil? || @user.nil? || @repo.nil?\n info = execute( \"commit/#{number}\" )\n return nil unless info\n YAML.load(info)['commit'] rescue nil\n end",
"def current_revision\n raise NotImplementedError\n end",
"def mark\n \"(echo #{revision} > #{configuration[:release_path]}/REVISION)\"\n end",
"def revision\n @commit.id_abbrev\n end",
"def set_revision\n @revision = find_revision(params[:id])\n end",
"def revision\n self.major_rev_number.to_s + '.' + self.minor_rev_number.to_s\n end",
"def initial_ref\n %x[git rev-parse #{branch}].chomp\nend",
"def revision_file\n @root.join('REVISION')\n end",
"def commit_ref(ref, repo_param)\n ref_class = ref.class.to_s.split(\"::\")[1].to_s\n \"<a class=\\\"ref #{ref_class}\\\" href=\\\"\" + prefix_url(\"#{repo_param}/#{ref.name}\") + \"\\\">#{ref.name}</a>\"\n end",
"def mark\n \"(echo #{revision} > #{destination}/REVISION)\"\n end",
"def current_revision\n invoke(Request.new(:verb => Request::Verb::REV)).rev\n end",
"def revision\n @job = Mugen::Job.find(params[:job_id]) \n @revision = Mugen::Job.revision(params[:job_id], params[:id])\n \n respond_to do |format|\n format.html {}\n format.xml { render :xml => @job }\n end\n end",
"def revision\n revisions.first\n end",
"def query_revision(revision)\n return revision if revision =~ /^\\d+$/\n command = scm(:info, repository, authentication, \"-r#{revision}\")\n result = yield(command)\n yaml = YAML.load(result)\n raise \"tried to run `#{command}' and got unexpected result #{result.inspect}\" unless Hash === yaml\n yaml['Last Changed Rev'] || yaml['Revision']\n end",
"def checkout(revision, destination)\n scm :checkout, config[:arguments], verbose, authentication, \"-r#{revision}\", repository, destination\n end",
"def logical_revision\n @logical_revision || \"rev-\" + self.rev \n end",
"def next_revision(revision)\n revision.to_i + 1\n end",
"def mark\n \"echo #{revision} > #{configuration[:deploy_release]}/REVISION\"\n end",
"def set_safe_revision\n case repository_type\n when 'git'\n %x[git rev-list --max-parents=0 HEAD].chomp\n when 'git-svn', 'svn'\n 0\n end\nend",
"def author_check(revision,repo)\n `svnlook author -r #{revision} #{repo}`\n end",
"def checkout(revision, destination)\n scm :checkout, verbose, authentication, \"-r#{revision}\", repository, destination\n end",
"def ref_into_url(base, project, ref)\n\t\tcase ref\n\t\t\twhen /\\[(\\b[0-9a-f]{5,40}\\b)\\]/:\n\t\t\t\t[rev_url(base, project, $1), :changeset]\n\n\t\t\twhen /r(\\d+)/:\n\t\t\t\t[rev_url(base, project, $1), :changeset]\n\n when /changeset:(\\w+)/:\n [rev_url(base, project, $1), :changeset]\n\n when /commit:(\\w+)/:\n [rev_url(base, project, $1), :changeset]\n\n\t\t\twhen /\\#(\\d+)/:\n\t\t\t\t[bug_url(base, project, $1), :ticket]\n\n when /wiki:(\\S+\\#?\\S+)/:\n [wiki_url(base, project, $1), :wiki]\n\t\tend\n\tend",
"def test_revision\n get :revision, :id => 1, :rev => 2\n assert_response :success\n assert_template 'revision'\n\n assert_select 'ul' do\n assert_select 'li' do\n # link to the entry at rev 2\n assert_select 'a[href=?]', '/projects/ecookbook/repository/revisions/2/entry/test/some/path/in/the/repo', :text => 'repo'\n # link to partial diff\n assert_select 'a[href=?]', '/projects/ecookbook/repository/revisions/2/diff/test/some/path/in/the/repo'\n end\n end\n end",
"def recent_revision(repo, branch = nil)\n branch ||= default_branch(repo)\n api.branch(repo, branch).commit.sha\n end",
"def set_revision\n @revision = Revision.find(params[:id])\n end",
"def test_revision_with_repository_pointing_to_a_subdirectory\n r = Project.find(1).repository\n # Changes repository url to a subdirectory\n r.update_attribute :url, (r.url + '/test/some')\n\n get :revision, :id => 1, :rev => 2\n assert_response :success\n assert_template 'revision'\n\n assert_select 'ul' do\n assert_select 'li' do\n # link to the entry at rev 2\n assert_select 'a[href=?]', '/projects/ecookbook/repository/revisions/2/entry/path/in/the/repo', :text => 'repo'\n # link to partial diff\n assert_select 'a[href=?]', '/projects/ecookbook/repository/revisions/2/diff/path/in/the/repo'\n end\n end\n end",
"def check_ref(ref, revision)\n # First check that revision is present\n begin\n git.show(revision)\n rescue Git::GitExecuteError => e\n STDERR.puts \"[#{DateTime.now} #{to}] Issue when checking revision #{revision}: #{e}\".yellow\n return false\n end\n\n # TODO: check that branch and tags contains the change\n return true\n end",
"def revisions\n raise NotImplementedError\n end",
"def commit\n @commit ||= $repo.log.object(@rev || 'master').path(@name).first\n end",
"def git_revision\n puts \"Fetching the git revision\"\n\n _stdin, stdout, stderr, wait_thread = Open3.popen3(\"git rev-parse HEAD\")\n\n success = wait_thread.value.success?\n\n status = success ? Rack::ECG::Check::Status::OK : Rack::ECG::Check::Status::ERROR\n\n value = success ? stdout.read : stderr.read\n value = value.strip\n\n { name: :git_revision, status: status, value: value }\nend",
"def get_last_changed_revision(repo, fname)\n case repository_type\n when 'git'\n %x[git log -n 1 -- \"#{fname}\"].split(\"\\n\").first[7..-1]\n when 'git-svn', 'svn'\n begin\n svn_info = %x[svn info -r head \"#{repo}/#{fname}\"]\n rescue\n puts 'we have an error in the svn info line'\n end\n begin\n svn_info.match('Last Changed Rev: ([0-9]*)').to_a[1]\n rescue\n puts 'We have an error in getting the revision'\n end\n end\nend",
"def wf_revision; h.wf_revision; end",
"def sync(revision, destination)\n scm :update, config[:arguments], verbose, authentication, \"-r#{revision}\", destination\n end",
"def revision\n raise NotImplementedError.new(\"revision() must be implemented by subclasses of AbstractVersionedFile.\")\n end",
"def sub_wf_revision; h.sub_wf_revision; end",
"def parseRevision()\r\n pieces=@complete_rev.split(\".\")\r\n @revision=pieces.last.to_i\r\n baseSize=1\r\n baseSize+=(pieces.size/2)\r\n @base=pieces[0..-baseSize].join(\".\")\r\n if baseSize > 2\r\n @branchid=pieces[-2]\r\n end \r\n end",
"def release_hashref\n @release_hashref ||= `git rev-parse HEAD`.chomp\n end",
"def build_git_revision(val = NULL)\n if null?(val)\n @build_git_revision ||= get_local_revision\n else\n @build_git_revision = val\n end\n end",
"def commit\n\t$VP.join('.git/refs/heads/master').read[0..8] rescue nil\nend",
"def get_latest_revision\n @current_revision\n end",
"def target_version=(_arg0); end",
"def get_latest_revision\n raise NotImplementedError\n end",
"def checkout(revision)\n str = content revision\n\n # write str to current directory\n File.open(@fname, \"w\") do |f|\n f.write str\n end\n end",
"def revision_class #:nodoc:\n self\n end",
"def revision_class #:nodoc:\n self\n end",
"def get_revision(revision_identifier)\n raise NotImplementedError\n end",
"def fetch_svn_commit(rev)\n url_str = bot.config['svn_root_url']\n commit = []\n begin\n @log.info \"checking #{url_str} for new commit...\"\n\n # https://username:password@svn.host.com:8080/svn/path/in/repo/\n url = Addressable::URI.parse(url_str)\n\n @log.debug PP.singleline_pp(url.to_hash, '')\n xmldata = `svn log --xml -v -r #{rev} #{url.omit(:user, :password)}`\n doc = REXML::Document.new(xmldata)\n \n doc.elements.inject('log/logentry', commit) do |commit, element|\n commit.push({:url => url}.merge(parse_entry_info(element)))\n end\n @log.debug PP.singleline_pp(commit, '')\n\n rescue Exception => e\n @log.error \"error connecting to svn: #{e.message}\"\n end\n return commit\n end",
"def do_revision\n @record = find_if_allowed(params[:id], :read)\n @current_revision_number = @record.current_revision_number\n @revision_number ||= @current_revision_number\n @rev_record_1 = @record.restore_revision(@revision_number) if @revision_number\n @rev_record_2 = @record.restore_revision(@revision_number - 1) if @revision_number > 1\n end",
"def extract_git_revision\n path = File.expand_path('../..', File.dirname(__FILE__))\n `git --git-dir #{path}/.git rev-parse --short HEAD`.strip\n end",
"def revision=(desired)\n # just checkout tags and shas; fetch has already happened so they should be updated.\n checkout(desired)\n # branches require more work.\n if local_branch_revision?(desired)\n # reset instead of pull to avoid merge conflicts. assuming remote is\n # updated and authoritative.\n # TODO might be worthwhile to have an allow_local_changes param to decide\n # whether to reset or pull when we're ensuring latest.\n if @resource.value(:source)\n at_path { git_with_identity('reset', '--hard', \"#{@resource.value(:remote)}/#{desired}\") }\n else\n at_path { git_with_identity('reset', '--hard', desired.to_s) }\n end\n end\n # TODO: Would this ever reach here if it is bare?\n if !ensure_bare_or_mirror? && @resource.value(:submodules) == :true\n update_submodules\n end\n update_owner_and_excludes\n end",
"def delta(rev)\n $repo.diff(commit, rev).path(@name).patch\n end",
"def rev_parse(rev)\n git.exec(\"rev-parse\",\"--verify\",rev).chomp\n end",
"def last_revision\n get_revision('REVISION')\n end",
"def call\n clone_revision\n end",
"def file_revert(file, ref)\n if file_revisions(file).map { |r| r[:commit] }.include? ref\n file = file.gsub(%r{^/}, '')\n full_path = File.expand_path(file, @root)\n content = File.read(file_revision_at(file, ref))\n File.open(full_path, 'w') { |f| f.puts content }\n end\n end",
"def sync(revision, destination)\n scm :update, verbose, authentication, \"-r#{revision}\", destination\n end",
"def scm_version(ref)\n return nil unless File.exist?(git_dir)\n\n version = `git --git-dir=#{safe_git_dir} describe --tags #{ref}`\n\n if $CHILD_STATUS.to_i.positive?\n # HEAD is not a tagged version, get the short SHA1 instead\n version = `git --git-dir=#{safe_git_dir} show #{ref} --format=format:\"%h\" -s`\n else\n # HEAD is a tagged version, if version is prefixed with \"v\" it will be stripped off\n version.gsub!(/^v/, \"\")\n end\n\n version.strip!\n rescue RuntimeError\n nil\n end",
"def query_revision(revision)\n revision\n end",
"def target\n \"#{target_repo}/#{target_branch}\"\n end",
"def revision(version)\n revision_with ActsAsAuditable::Audit.reconstruct_attributes(audits_to(version))\n end",
"def revision(name, msg, options = {}, &block)\n r = Revision.new(name, msg, options, &block)\n @revisions << r\n r\n end",
"def get_svn_rev( dir='.' )\n\tinfo = get_svn_info( dir )\n\treturn info['Revision']\nend",
"def revision_name\n \n if revision\n revision = self.revision.name\n # revision += self.numeric_revision > 0 ? self.numeric_revision.to_s : ''\n else\n NOT_SET\n end\n \n end",
"def set_current_revision\n raise NotImplementedError\n end",
"def next_revision_number\n # Need to retrieve existing revision numbers to sort them as integers\n sql = \"SELECT revision FROM #{Changeset.table_name} \" \\\n \"WHERE repository_id = #{id} AND revision NOT LIKE 'tmp%'\"\n @current_revision_number ||= (self.class.connection.select_values(sql).collect(&:to_i).max || 0)\n @current_revision_number += 1\n end",
"def revisions(path, rev_limit=1000)\n\n params = {\n 'rev_limit' => rev_limit.to_s\n }\n\n response = @session.do_get build_url(\"/revisions/#{@root}#{format_path(path)}\", params)\n parse_response(response)\n\n end",
"def commit_new_cb_version\n shellout('git add metadata.rb')\n @gitrepo.commit_index(\"release v#{@target_version}\")\n end",
"def current_version\n version_number rev\n end",
"def revision(version)\n if version == :previous || audits.last.version >= version\n revision_with Audited.audit_class.reconstruct_attributes(audits_to(version))\n end\n end",
"def revision(version)\n revision_with Audited.audit_class.reconstruct_attributes(audits_to(version))\n end",
"def update_changed_rev(file_safety, repo, fnames = nil)\n fnames = file_safety.keys if fnames.nil?\n # TODO: Use svn info --xml instead\n # TODO: Is it possible to get %x[] syntax to accept variable arguments?\n #all_info = %x[svn info -r HEAD \"#{fnames.join(' ')}\"]\n #repo = %x[svn info].split(\"\\n\").select{|x| x =~ /^URL: /}.collect{|x| x[5..-1]}.first\n # Filename becomes too long, and extra arguments get ignored\n #all_info = Kernel.send(\"`\", \"svn info -r HEAD #{fnames.sort.join(' ')}\").split(\"\\n\\n\")\n # Note: I'd like to be able to use svn -u status -v instead of svn info,\n # but it seems to refer only to the local working copy...\n f2 = fnames.sort # Sorted copy is safe to change\n all_info = []\n while f2 && !f2.empty?\n blocksize = 10\n extra_info = svn_info_entries(f2.first(blocksize), repo)\n #if extra_info.size != [blocksize, f2.size].min\n # puts \"Mismatch (got #{extra_info.size}, expected #{[blocksize, f2.size].min})\"\n #end\n all_info += extra_info\n f2 = f2[blocksize..-1]\n end\n fnames.each{|f|\n #puts \"Checking for URL: #{repo}/#{f}\"\n #puts all_info[0].inspect\n info = all_info.find{|x| x.include?(\"URL: #{repo}/#{f}\")}\n if info\n info = info.split(\"\\n\")\n else\n #puts \"Unknown: #{f}\"\n end\n #info = %x[svn info -r HEAD \"#{f}\"].split(\"\\n\")\n if info.nil? || info.empty?\n # svn writes to stderr: \"svn: '#{f}' has no URL\", or\n # \"#{f}: (Not a versioned resource)\"\n file_safety[f][\"last_changed_rev\"] = -1 # Flag as non-existent\n else\n file_safety[f][\"last_changed_rev\"] = info.\n select{|x| x =~ /^Last Changed Rev: /}.collect{|x| x[18..-1]}[0].to_i\n end\n }\nend"
] |
[
"0.7230082",
"0.72139263",
"0.69580775",
"0.6917695",
"0.6915714",
"0.68644476",
"0.6816542",
"0.67362523",
"0.6699058",
"0.66314906",
"0.6587015",
"0.65758854",
"0.64748067",
"0.6471422",
"0.6403111",
"0.6387499",
"0.63868743",
"0.63727075",
"0.63588274",
"0.6343399",
"0.62908876",
"0.62732124",
"0.6239569",
"0.623102",
"0.6227724",
"0.61996585",
"0.61974543",
"0.6192715",
"0.61833054",
"0.6177308",
"0.6176597",
"0.61664665",
"0.6161835",
"0.614742",
"0.61428696",
"0.6133652",
"0.61322635",
"0.61088586",
"0.61013746",
"0.60915595",
"0.6084512",
"0.6026725",
"0.59957045",
"0.5986963",
"0.59845454",
"0.5980729",
"0.59536",
"0.5940809",
"0.5938091",
"0.5934482",
"0.5918355",
"0.5914995",
"0.5912788",
"0.590875",
"0.5893893",
"0.5892854",
"0.5882455",
"0.58794063",
"0.5879292",
"0.5876285",
"0.58583564",
"0.5851481",
"0.58478606",
"0.5836751",
"0.5833451",
"0.5825562",
"0.58237964",
"0.5809355",
"0.58080846",
"0.5800566",
"0.57962877",
"0.5795338",
"0.57933646",
"0.57933646",
"0.5778546",
"0.5778541",
"0.5776942",
"0.5772079",
"0.5765065",
"0.5762868",
"0.57606274",
"0.57540715",
"0.5746911",
"0.57407063",
"0.57374",
"0.5707947",
"0.570367",
"0.5699428",
"0.56818706",
"0.5678468",
"0.56705314",
"0.56658286",
"0.565056",
"0.56382775",
"0.5633058",
"0.56315607",
"0.56264293",
"0.5615557",
"0.56152785",
"0.56082284"
] |
0.8321204
|
0
|
A Receipt is considered editable even when the status is deleted. The reason for that is because if there was something wrong with the Expense Claim that was not discovered until after it was approved, then it can be deleted from Xero, edited here and then resubmitted again with minimum amount of work needed.
|
def editable?
(status == STATUS_NOT_SUBMITTED || status == STATUS_DELETED)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def check_receipt_state\n\t\tunless account_movement.nil? || account_movement.receipt.nil?\n\t\t\terrors.add(\"Recibo confirmado\", \"Los pagos de un recibo confirmado no pueden ser modificados.\") unless account_movement.receipt.editable?\n\t\tend\n\tend",
"def editable?\n (self.entry_ts.to_date == Date.today && self.billing_ref.blank?) || ![BILLED,PAID,CANCELLED].include?(self.status)\n end",
"def process_receipt_user\n raise LogicViolation unless changes[:status][0] == 'pending'\n\n if status_changed?(to: 'declined')\n ReceiptUser.find_by(receipt_id: reference_id, user_id: user_id).destroy\n end\n end",
"def update\n @receipt = Receipt.find(params[:id])\n params[:receipt][:receipt_lines_attributes] = @receipt.process_removed_lines(params[:receipt][:receipt_lines_attributes])\n\n respond_to do |format|\n if @receipt.update_attributes(receipt_params)\n deposit_check = DepositCheck.find_by_receipt_id(@receipt.id)\n @receipt.update_attributes(:deposit_check_id => deposit_check.id) if deposit_check\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n set_params\n @restaurant = Restaurant.find(params[:id])\n authorize! :update, @restaurant\n if (params[:restaurant][:status] == \"Exclusive\" &&\n @restaurant.owned_by != current_user.id)\n params[:restaurant][:status] = \"Pending Approval\"\n send_request\n @restaurant.mark_pending(current_user.id)\n end\n MenuItem.destroy_all(:restaurant_id => params[:id])\n set_menu_items_and_file\n super\n end",
"def update\n \n if receipt_params[:receipt_date].present? && receipt_params[:form_receipt].blank?\n flash[:warning] = 'Selecione uma forma de recebimento!'\n redirect_to edit_receipt_path(@receipt) and return\n end\n \n #se informou a data da baixa e não alterou para RECEBIDA o status\n if receipt_params[:receipt_date].present? && receipt_params[:status] == 'Á RECEBER'\n flash[:warning] = 'Altere o Status para RECEBIDA, já que você informou a data de recebimento!'\n redirect_to edit_receipt_path(@receipt) and return\n end\n \n #se alterou para RECEBIDA o status e não informou a data do pagamento\n if receipt_params[:status] == 'RECEBIDA' && receipt_params[:receipt_date].blank?\n flash[:warning] = 'Informe a data de recebimento, já que você alerou o status para RECEBIDA!'\n redirect_to edit_receipt_path(@receipt) and return\n end\n \n #verifica se foi marcado como recebida e se foi atualiza a invoice amarrada á essa conta\n if @receipt.status == \"Á RECEBER\" \n @invoice = Invoice.where(id: @receipt.invoice_id)\n if @invoice.present?\n @novostatus = 'RECEBIDA'\n Invoice.update(@invoice, status: @novostatus)\n end\n end\n \n respond_to do |format|\n \n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Recebimento atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @receipt }\n else\n format.html { render :edit }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reason_not_to_edit\n d = @data_object\n if d.order_amount_paid > 0.0\n return \"Cannot edit an order after it has been partially paid\"\n end\n\n pays = Pays.for_order(self)\n unless pays.empty?\n return \"Cannot edit an order after payments have been applied\"\n end\n\n each_line do |line|\n if line.li_date_shipped\n return \"Cannot edit: '#{line.li_desc}' has been shipped\"\n end\n end\n\n nil\n end",
"def unapproveReceipt\n render json: Approved.unapproveReceipt(params[\"id\"], params[\"order\"])\n end",
"def is_editable\n not is_default_cash_gift\n end",
"def test_editability(model_instance)\n return unless fee_classes.include?(model_instance.class)\n model_instance.errors.add(:base, 'uneditable_state') unless model_instance.claim.editable?\n rescue StandardError\n true\n end",
"def revokable?\n\t\tstatus == \"pending\" && created_at >= Donation.revoke_time.ago\n\tend",
"def order_status\n unless order.draft?\n errors.add(:order_status, 'An line_item can only be edited while in the DRAFT status')\n end\n end",
"def is_allowed_to_edit?(person)\n if person.id == item_owner.id && status.eql?(\"pending_owner\")\n return true\n elsif person.id != item_owner.id && status.eql?(\"pending_reserver\")\n return true\n end\n return false \n end",
"def reconcile_receipt\n self.class.transaction do\n captain = self.captain.rider\n captain.fetch_ride_receipts\n receipt = find_receipt\n unless receipt.blank?\n self.update!(receipt_id: receipt.id)\n captain.credit(cost)\n\n self.requests.available.billable.map(&:user).each do |rider|\n request = rider.request_for(self)\n charges = self.cost_of(rider)\n fees = request.lone_rider? ? 0 : fee\n charges += fees\n final_cost = request.coupon.present? ? request.coupon.apply(charges) : charges\n charged, credits_used, charge_ref = rider.charge(final_cost.round(2), request)\n request.create_payment!(amount: final_cost, credits_used: credits_used, credit_card_charge: charged, fee: fees, reference: charge_ref)\n rider.save!\n end\n end\n end\n end",
"def update\n @receipt = current_user.receipts.find(params[:id])\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_charge\n expense = Expense.find(params[:expense_id])\n\n if OutStanding.where(at_date: expense.at_date).count > 0 \n respond_to do |format|\n format.json { render json: {success: false, msg: \"Can't edit. This item has been audited\"} }\n end\n return\n end\n \n if expense.update_attributes(params[:echarge])\n respond_to do |format|\n format.json { render json: {success: true} }\n end\n else\n respond_to do |format|\n format.json { render json: {success: false} }\n end\n end\n end",
"def update\n @fundamental_retention_mail = Fundamental::RetentionMail.find_by_identifier(params[:id])\n\n respond_to do |format|\n if !@fundamental_retention_mail.nil? && !@fundamental_retention_mail.redeem_credit_reward\n format.html { redirect_to @fundamental_retention_mail, notice: 'Retention mail was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fundamental_retention_mail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def read_only\n if !(@restaurant.creator_id == @review.user_id) \n \"readonly\"\n end\n end",
"def update\n\n if is_adm? && params[:type] == 'terminate'\n request = TerminationRequest.find_by_t_req_no(termination_request_params[:ticket_no])\n the_lease = SignedLease.find_by_lease_no(request.lease_no)\n\n if the_lease.end_date > request.termination_date\n the_lease.end_date = request.termination_date\n\n #redo invoice\n diff = (the_lease.end_date - request.termination_date).to_i\n if diff < 30\n #remaining has to be paid, don't do anything\n elsif diff < 60\n invoice = get_current_invoice\n amount = (invoice.bill_end_date - request.termination_date).to_i/(invoice.bill_end_date - invoice.bill_start_date).to_i*0.6\n invoice.payment_due = amount\n invoice.save\n end\n\n end\n\n # redo removal when time comes\n\n the_lease.save\n request.app_status = 2\n request.save\n\n redirect_to termination_requests_url\n return\n else\n @termination_request = TerminationRequest.find(params[:id])\n end\n\n respond_to do |format|\n if @termination_request.update(termination_request_params)\n format.html { redirect_to @termination_request, notice: 'Termination request was successfully updated.' }\n format.json { render :show, status: :ok, location: @termination_request }\n else\n format.html { render :edit }\n format.json { render json: @termination_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def authorized_to_edit_records\n scope.none\n end",
"def disapprove\n self.approved = false\n end",
"def set_receipt_detail\n @receipt_detail = ReceiptDetail.find(params[:id])\n @receipt_detail.expense = Expense.new unless @receipt_detail.expense\n end",
"def cannot_edit(_offer)\n !session[:is_administrator] && _offer.unbilled_balance <= 0\n end",
"def ensure_editable; return false unless editable? end",
"def receipt\n @cart = Cart.find(params[:id], :readonly => true)\n\n # only superuser or owner can see the receipt\n unless (@customer and @cart.customer == @customer) \\\n or (respond_to?(:current_user) and current_user and current_user.admin?)\n flash[:warning] = \"You cannot view your receipts without logging in.\"\n redirect_to :controller => 'customer', :action => 'login'\n return\n end\n end",
"def editable?\n new_record? || (Spree::Order.complete.where(\"bill_address_id = ? OR\n ship_address_id = ? AND\n state != 'complete' AND\n shipment_state != 'shipped'\", id, id).count == 0)\n end",
"def reauthorize\n @order.reauthorize\n end",
"def delete_charge\n expense = Expense.find(params[:expense_id])\n if OutStanding.where(at_date: expense.at_date).count > 0 \n respond_to do |format|\n format.json { render json: {success: false, msg: \"Can't edit. This item has been audited\"} }\n end\n return\n end\n\n if expense.destroy\n respond_to do |format|\n format.json { render json: {success: true} }\n end\n else\n respond_to do |format|\n format.json { render json: {success: false} }\n end\n end\n end",
"def credit_receipt(receipt)\n inv_map = receipt.inventory_lines.map { |i| [i.product_id, i.quantity_present] }.to_h\n # fullfill orders for recipes first\n orders_for_receipts.assigned.find_each do |order|\n order.inventory_lines.each do |o_line|\n next unless o_line.product.product_recipes.any?\n\n o_line.product.credit_to_line(o_line, inv_map)\n end\n order.complete! if order.can_complete?\n end\n\n orders_for_receipts.assigned.find_each do |order|\n order.inventory_lines.each do |o_line|\n o_line.product.credit_to_line(o_line, inv_map)\n end\n order.complete! if order.can_complete?\n end\n end",
"def edit\n respond_with @recurring_transaction\n end",
"def edit\n respond_with(invoice)\n end",
"def update_and_approve\n refill_response_xml = \"\"\n previous_refill_quantity = @refill_request.medications.first.refill_quantity.to_i\n medication_details_changed, medication_errors = @refill_request.update_medications(params)\n\n\t note = !@refill_request.note.blank? ? \"<Note>#{@refill_request.note.strip}</Note>\" : \"\"\n\n if previous_refill_quantity != 0 && medication_details_changed\n refill_response_xml = \"<ApprovedWithChanges>#{note}</ApprovedWithChanges>\"\n else\n refill_response_xml = \"<Approved>#{note}</Approved>\"\n end\n\n if medication_errors.compact.blank?\n status_code = generate_refreq_xml(@refill_request, refill_response_xml)\n if Prescription::SUCCESS_STATUSES.include?(status_code)\n medication = @refill_request.medications.first\n medication.update_attributes(:status => status_code)\n @refill_request.update_status MedicationRefill::REFILL_STATUSES[:approved_with_changes]\n render :update do |page|\n page << \"RedBox.close()\"\n page.replace_html \"medication_status_#{medication.id}\", \"<div class='status_#{medication.display_status.downcase}'>#{medication.display_status}</div>\"\n page.replace_html \"refill_status_#{@refill_request.id}\", \"Approved with changes\"\n page.replace_html \"actions_#{@refill_request.id}\", \"<td align='center' colspan='10' id='status_#{@refill_request.id}'>Refill Response sent Successfully.</td>\"\n page.visual_effect :highlight, \"status_#{@refill_request.id}\", :duration => 2.0\n end\n else\n render :update do |page|\n page.replace_html \"redbox_errors\", \"Request failed, please try again or contact support\"\n end\n end\n else\n render :update do |page|\n page.replace_html \"redbox_errors\", medication_errors.uniq.join(\"<br />\")\n end\n end\n end",
"def deny\n self.granted = -1\n restaurant = Restaurant.find(self.restaurant_id)\n restaurant.mark_collaborative\n end",
"def decline\n order = current_user.restaurant.orders.find(params[:id])\n order.update(status: 2)\n render json: {is_success: true}, status: :ok\n end",
"def mark_as_not_deleted(options = {})\n update_receipts({ deleted: false }, options)\n end",
"def toggle_status\n respond_to do |format|\n status = @invoice.pending? ? Invoice.statuses[:paid] : Invoice.statuses[:pending]\n if @invoice.update(status: status)\n format.html { render partial: 'invoices/invoice_actions', layout: false }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def editable_by?(user)\n !shipped? && !delivered?\n end",
"def update\n respond_to do |format|\n if @review.update(review_params) && @review.revoke_approval!\n format.json { render :show, status: :ok, location: @review }\n else\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mark_as_read(participant)\n return unless participant\n self.receipts.recipient(participant).mark_as_read\n end",
"def mark_as_not_deleted(options={})\n update_receipts({:deleted => false}, options)\n end",
"def mark_as_not_deleted(options={})\n update_receipts({:deleted => false}, options)\n end",
"def destroy\n @retailorder = Retailorder.find(params[:id])\n begin\n @retailorder.destroy \n rescue ActiveRecord::DeleteRestrictionError => e\n @retailorder.errors.add(:base, e)\n end \n respond_to do |format|\n\n if e.nil?\n\n format.html { redirect_to(\"/retailorderview\", :notice => 'retail order was successfully deleted.') }\n format.xml { head :ok }\n else \n format.html { render :action => \"edit\" }\n end\n\n\n end\n end",
"def status_changed(expense)\n @expense = expense\n mail to: @expense.user.email, subject: 'Expense Report Notification: The status of your expense has been changed'\n end",
"def update_payment_invoice_status\n if self.invoice.present?\n if self.status == 'confirmed'\n self.invoice.update(status: 'paid')\n elsif self.status == 'paid partially' && self.amount != self.invoice.grand_total\n self.invoice.update(status: 'paid partially')\n elsif self.status == 'paid partially' && self.amount == self.invoice.grand_total\n self.invoice.update(status: 'paid off (paid partially)')\n elsif self.status == 'pending'\n self.invoice.update(status: 'pending')\n elsif self.status == 'cancel'\n self.invoice.update(status: 'cancel')\n end\n end\n end",
"def mark_as_deleted(participant)\n return if participant.nil?\n return receipt_for(participant).mark_as_deleted\n end",
"def is_deletable\n not is_default_cash_gift\n end",
"def read_only_disabled\n if !(@restaurant.creator_id == @review.user_id) \n \"disabled\"\n end\n end",
"def update\n respond_to do |format|\n if @activity_receipt.update(activity_receipt_params)\n format.html { redirect_to @activity_receipt, notice: 'Activity receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity_receipt }\n else\n format.html { render :edit }\n format.json { render json: @activity_receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @purchase_receipt = PurchaseReceipt.find(params[:id])\n\n respond_to do |format|\n if @purchase_receipt.update_attributes(params[:purchase_receipt])\n format.html { redirect_to @purchase_receipt, notice: 'Purchase receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchase_receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mark_as_deleted(options={})\n update_receipts({:deleted => true}, options)\n end",
"def mark_as_deleted(options={})\n update_receipts({:deleted => true}, options)\n end",
"def update\n \n @purchase_requisition = PurchaseRequisition.find(params[:id])\n @cu = current_user\n #puts \"+++++++++++REEOLD\" + @purchase_requisition.re_materials.count.to_s + \"**********************\"\n rem = []\n\n respond_to do |format|\n \n if ( @purchase_requisition.update_attributes(params[:purchase_requisition]) )\n \n # @purchase_requisition.calculate_status NO CALCULES ESTATUS HASTAQ EU NO SEPAMOS BIEN Q ONDA!!\n\n #-------------------Esta parte es un poco rara pero enserio funciona para ver cuales eliminaron---------------------\n @purchase_requisition.re_materials.each do |reM|\n rem << reM if ! ReMaterial.exists?(reM.id)\n end\n\n @purchase_requisition.re_services.each do |reS|\n rem << reS if ! ReService.exists?(reS.id)\n end\n\n #-------------------Fin de la parte que es un poco rara pero enserio funciona para ver cuales eliminaron---------------------\n\n #-------------------Correos por default y los involucrados---------------------\n \n destinatarios = params[:destinatarios] || []\n destinatarios << User.where(username:\"Compradores\")[0]\n destinatarios << @purchase_requisition.creator_id if @purchase_requisition.creator_id\n\n if @purchase_requisition.buyer\n destinatarios << @purchase_requisition.buyer_id\n end\n\n if destinatarios.count >0 && (@purchase_requisition.has_changed? || rem.count > 0 )\n \n mail = UserMailer.update_email(current_user,destinatarios,@purchase_requisition,rem)\n send_email(mail, destinatarios)\n\n end\n\n #-------------------- FIN Correos por default y los involucrados FIN------------------\n\n #-------------------Correo para Responsables---------------------\n\n re_resp = @purchase_requisition.re_changed_resp\n mail_responsibles = re_resp\n\n if mail_responsibles.count >0 && (@purchase_requisition.has_changed? || rem.count > 0 )\n #implica que hubo un cambio\n mail = UserMailer.update_email(current_user,mail_responsibles,@purchase_requisition,rem)\n send_email(mail, mail_responsibles,:notice_mail2,\"Correo electrónico enviado a responsables: <br />\" )\n\n end\n\n #------------------- FIN Correo para Responsables--------------------- \n\n notice_mail = @purchase_requisition.has_changed? || rem.count > 0 ? 'Solicitud de Compra Actualizada.' : \"No hubo cambios.\"\n\n #puts \"+++++++++++\" + @purchase_requisition.requisition_entries.count.to_s + \"**********************\"\n\n format.html { redirect_to @purchase_requisition, notice: notice_mail }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchase_requisition.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def can_be_modified?\n self.offerings.each do |o|\n return false if o.can_be_deleted? == false\n end\n return true\n end",
"def refund!\n response = credit_card.credit!(total_amount_in_cents, payment.authorization)\n self.response = response\n self.description = response.message\n self.authorization = response.authorization\n if response.success?\n invoice.update_attribute(:status, \"closed\")\n self.status = \"cleared\"\n self.save!\n return true\n else\n self.status = \"failed\"\n for item in self.line_items\n item.amount = 0\n end\n self.save!\n return false\n end\n end",
"def mark_as_deleted(options = {})\n update_receipts({ deleted: true }, options)\n end",
"def auto_delete_receipts\n #get user id from params or as a method parameter\n user = params[:id]\n\n user.receipts.each do |receipt|\n #check if receipt is three months old\n receipt.remove_receiptFile!\n receipt.save\n #end\n end\n end",
"def update\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @email = Email.find(params[:id])\n if @email.read === true\n @email.update(read: false)\n else \n @email.update(read: true)\n end\n \n end",
"def update\n @receipt = Receipt.find(params[:id])\n\n respond_to do |format|\n if @receipt.update_attributes(params[:receipt])\n format.html { redirect_to(@receipt, :notice => 'Receipt was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @receipt.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def disbursed?\n @disbursement_details.valid?\n end",
"def approve\n if self.status == \"pending_presenter\" || self.status == \"pending_admin\"\n \n #move edit columns to permanent columns\n self.bio = self.bio_edit\n if self.picture_edit_stored?\n self.picture = self.picture_edit\n end\n\n #clear edit columns\n self.bio_edit = ''\n self.picture_edit = nil\n \n #update status to approved\n self.status = :approved\n return self.save\n else\n return false\n end\n end",
"def destroy\n @receipt.making_credit\n respond_to do |format|\n format.html { redirect_to customized_url, notice: 'Receipt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def pending_edits\n \tself.edits.where(:is_approved => nil)\n end",
"def update\n respond_to do |format|\n if @receipt_detail.update(receipt_detail_params)\n format.html { redirect_to @receipt_detail, notice: 'Receipt detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt_detail }\n else\n format.html { render :edit }\n format.json { render json: @receipt_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def redeem_admin\n # @voucher set from the filter\n @voucher.status = params[:status]\n if Voucher::REDEEMED == params[:status]\n @voucher.redemption_date = Time.zone.now\n else\n # Unusual if another status, so record\n @voucher.notes += \"\\nStatus changed to #{params[:status]} on #{Time.zone.now.try(:strftime, ApplicationHelper::DATE_FORMAT)}\"\n end\n \n if @voucher.save\n flash[:notice] = I18n.t('voucher_success')\n \n # Send survey on redemption, and a notice on unredemption (saying they can still use the voucher)\n # Do nothing on return; presumably the customer has handed it in\n if Voucher::REDEEMED == @voucher.status\n UserMailer.delay.survey_email(@voucher.order)\n elsif Voucher::AVAILABLE == @voucher.status\n UserMailer.delay.unredeem_email(@voucher)\n elsif Voucher::RETURNED == @voucher.status\n # Credit Macho Bucks\n bucks = @voucher.build_macho_buck(:user_id => @voucher.order.user.id, :amount => @voucher.order.amount, :notes => params[:notes])\n if !bucks.save\n flash[:alert] = 'Unable to credit macho bucks!'\n end\n UserMailer.delay.macho_bucks_voucher_email(bucks)\n end\n else\n flash[:alert] = I18n.t('voucher_failure')\n end\n \n @vouchers = []\n # Calculate gift certificates that they have given\n @pending_gifts = GiftCertificate.pending.where('user_id = ?', current_user.id)\n @redeemed_gifts = GiftCertificate.redeemed.where('user_id = ?', current_user.id)\n \n render 'index'\n end",
"def approval_of_admin\n status = params[:status]\n @order = Order.find(params[:id])\n @order.update_attributes!(:status => status)\n @order_email = Order.find(params[:id])\n if status == \"5\"\n @reviewer = @order.reviews.last.user\n OrderMailer.admin_review_approved(@order_email, @reviewer).deliver_now\n elsif status == \"6\"\n @reviewer = @order.reviews.last.user\n OrderMailer.admin_review_rejected(@order_email,@reviewer).deliver_now\n user = User.find(@order.user_id)\n user_orders_count = user.orders.count\n if user_orders_count == 1\n @order.update_attributes!(:status => 7)\n end\n end\n redirect_to admin_reviewed_by_reviewer_path , :notice => \"Order successfully updated.\"\n end",
"def permission_revoked note, user\n @note = note\n @user = user\n\n mail(to: @user.email, subject: 'Você recebeu um convite para editar uma nota')\n end",
"def locked?\n self.invoiced? && self.invoice.issued?\n end",
"def destroy\n # @invoice.destroy\n @invoice.update_attributes(is_deleted: true,status_id: 4)\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n @money_receipt = MoneyReceipt.find(params[:id])\n\n respond_to do |format|\n if @money_receipt.update_attributes(params[:money_receipt])\n format.html { redirect_to @money_receipt, notice: 'Money receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @money_receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_is_editable_success\n editable_statuses = [\n order_status_codes(:cart), \n order_status_codes(:to_charge), \n order_status_codes(:on_hold_payment_failed),\n order_status_codes(:on_hold_awaiting_payment), \n order_status_codes(:ordered_paid_to_ship)\n ]\n OrderStatusCode.find(:all).each do |stat|\n @order.order_status_code = stat\n \n assert_equal(\n editable_statuses.include?(stat),\n @order.is_editable?,\n \"Fail for #{stat.inspect}\"\n )\n end\n end",
"def check_if_deleted\n raise ActiveRecord::ReadOnlyRecord unless deleted?\n end",
"def approve!\n inventory.restock!(self, Time.current, inventory_check)\n update!(adjustment: difference)\n end",
"def check_for_invoice\n unless self.invoice_id.blank?\n errors.add(:amount, \"This bill is invoiced and cannot be deleted\")\n throw :abort\n end\n end",
"def destroy\n @receipt = current_user.receipts.find(params[:id])\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url }\n format.json { head :no_content }\n end\n end",
"def mark_as_read(item)\n receipts_for_item(item).update_all(read: true)\n end",
"def cannot_edit(_t)\n !session[:is_administrator] && !_t.approver_id.blank?\n end",
"def mark_as_not_deleted(participant)\n return if participant.nil?\n return receipt_for(participant).mark_as_not_deleted\n end",
"def set_invoice_paid\n @invoice.status == 'paid'\n end",
"def delete\n authorize!(:delete,current_user) unless current_user.role?:lawfirm_admin or current_user.role?:livia_admin\n @invoice = Invoice.find(params[:id])\n if @invoice.payments.empty?\n InvoiceDetail.delete_all(:invoice_id=>params[:id])\n @invoice.delete\n flash[:notice] = \"#{t(:text_invoices)} \" \"#{t(:flash_was_successful)} \" \"#{t(:text_deleted)}\"\n else\n flash[:error] = t(:flash_invoice_cannot_deleted)\n end\n respond_to do |format|\n format.html { redirect_to :action=>'index'}\n format.xml { head :ok }\n end\n end",
"def set_expense_is_billable\n data=params\n @tne_invoice_expense_entry = TneInvoiceExpenseEntry.find(data[:id])\n @previous_final_billed_amount = @tne_invoice_expense_entry.final_expense_amount\n if @tne_invoice_expense_entry.billing_method_type.to_i == 1\n @tne_invoice_expense_entry.update_attributes({:is_billable => data[:billing_type], :is_internal => data[:is_internal], :billing_percent => ''})\n else\n @tne_invoice_expense_entry.update_attributes({:is_billable => data[:billing_type], :is_internal => data[:is_internal]})\n end\n\n if data[:is_internal].to_s.eql?(\"true\")\n @tne_invoice_expense_entry.update_attributes({:contact_id => '', :matter_id => ''})\n end\n @billed_amount = @tne_invoice_expense_entry.calculate_final_expense_amount\n# flash[:error]= t(:flash_enter_valid_expense_amt)\n end",
"def notify_status_denied(user, redemption)\n @reward = redemption.reward\n @denier = redemption.denier\n notify_redeemer_status_change(user, redemption, t(\"rewards.redemption_was_denied\", reward_title: redemption.reward.title))\n end",
"def update_review_status(status, user)\n \n if status && status.id != self.review_status_id &&\n (self.review_status.name == 'Review On-Hold' ||\n self.review_status.name == 'In Review')\n\n self.record_update('Review Status', \n self.review_status.name, \n status.name,\n user)\n\n if self.review_status.name == 'Review On-Hold'\n self.remove_from_hold(status.id)\n elsif self.review_status.name == 'In Review'\n self.place_on_hold\n end\n self.save\n \n true\n else\n false\n end \n \n end",
"def update\n respond_to do |format|\n if current_user.is_recepcion?\n if @contract.update(contract_params)\n format.html { redirect_to :back, notice: 'Contract was successfully updated.' }\n else\n format.html { redirect_to :back, notice: 'was ocurred a problem try again.' }\n end\n else\n if @contact.status.present? and @contact.status != \"Process\"\n format.html { redirect_to :back, notice: 'You do not have permission to edit a closed sale' }\n else\n if @contract.update(contract_params_normal)\n format.html { redirect_to :back, notice: 'Contract was successfully updated.' }\n else\n format.html { redirect_to :back, notice: 'was ocurred a problem try again.' }\n end\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt }\n else\n format.html { render :edit }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt }\n else\n format.html { render :edit }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt }\n else\n format.html { render :edit }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mark_as_read(participant)\n return unless participant\n receipts_for(participant).mark_as_read\n end",
"def re_edit_qc_inspection_test\n id = params[:id]\n if id && @qc_inspection_test = QcInspectionTest.find(id)\n @qc_inspection_type_code = @qc_inspection_test.qc_inspection.qc_inspection_type.qc_inspection_type_code\n return if authorise_for_web(program_name(@qc_inspection_type_code),'edit')== false\n\n @qc_inspection_test.set_status QcInspectionTest::STATUS_CREATED\n edit_qc_inspection_test\n end\n end",
"def cannot_edit(_order)\n !session[:is_administrator] && _order.id < 6\n end",
"def update\n @breadcrumb = 'update'\n @supplier_invoice = SupplierInvoice.find(params[:id])\n\n master_changed = false\n # Should use attachment from drag&drop?\n if $attachment != nil && !$attachment.avatar.blank? && $attachment.updated_at > @supplier_invoice.updated_at\n @supplier_invoice.attachment = $attachment.avatar\n end\n if @supplier_invoice.attachment.dirty? || $attachment_changed\n master_changed = true\n end\n\n items_changed = false\n if params[:supplier_invoice][:supplier_invoice_approvals_attributes]\n params[:supplier_invoice][:supplier_invoice_approvals_attributes].values.each do |new_item|\n current_item = SupplierInvoiceApproval.find(new_item[:id]) rescue nil\n if ((current_item.nil?) || (new_item[:_destroy] != \"false\") ||\n ((current_item.approver_id.to_i != new_item[:approver_id].to_i) ||\n (current_item.approval_date != new_item[:approval_date].to_date) ||\n (current_item.approved_amount.to_f != new_item[:approved_amount].to_f) ||\n (current_item.remarks != new_item[:remarks])))\n items_changed = true\n break\n end\n end\n end\n if !items_changed && params[:supplier_invoice][:supplier_invoice_items_attributes]\n params[:supplier_invoice][:supplier_invoice_items_attributes].values.each do |new_item|\n current_item = SupplierInvoiceItem.find(new_item[:id]) rescue nil\n if ((current_item.nil?) || (new_item[:_destroy] != \"false\") ||\n ((current_item.product_id.to_i != new_item[:product_id].to_i) ||\n (current_item.description != new_item[:description]) ||\n (current_item.code != new_item[:code]) ||\n (current_item.quantity.to_f != new_item[:quantity].to_f) ||\n (current_item.price.to_f != new_item[:price].to_f) ||\n (current_item.discount_pct.to_f != new_item[:discount_pct].to_f) ||\n (current_item.discount.to_f != new_item[:discount].to_f) ||\n (current_item.tax_type_id.to_i != new_item[:tax_type_id].to_i) ||\n (current_item.receipt_note_id.to_i != new_item[:receipt_note_id].to_i) ||\n (current_item.receipt_note_item_id.to_i != new_item[:receipt_note_item_id].to_i) ||\n (current_item.project_id.to_i != new_item[:project_id].to_i) ||\n (current_item.work_order_id.to_i != new_item[:work_order_id].to_i) ||\n (current_item.charge_account_id.to_i != new_item[:charge_account_id].to_i)))\n items_changed = true\n break\n end\n end\n end\n if ((params[:supplier_invoice][:organization_id].to_i != @supplier_invoice.organization_id.to_i) ||\n (params[:supplier_invoice][:project_id].to_i != @supplier_invoice.project_id.to_i) ||\n (params[:supplier_invoice][:invoice_no].to_s != @supplier_invoice.invoice_no) ||\n (params[:supplier_invoice][:invoice_date].to_date != @supplier_invoice.invoice_date) ||\n (params[:supplier_invoice][:supplier_id].to_i != @supplier_invoice.supplier_id.to_i) ||\n (params[:supplier_invoice][:receipt_note_id].to_i != @supplier_invoice.receipt_note_id.to_i) ||\n (params[:supplier_invoice][:work_order_id].to_i != @supplier_invoice.work_order_id.to_i) ||\n (params[:supplier_invoice][:charge_account_id].to_i != @supplier_invoice.charge_account_id.to_i) ||\n (params[:supplier_invoice][:payment_method_id].to_i != @supplier_invoice.payment_method_id.to_i) ||\n (params[:supplier_invoice][:withholding].to_f != @supplier_invoice.withholding.to_f) ||\n (params[:supplier_invoice][:discount_pct].to_f != @supplier_invoice.discount_pct.to_f) ||\n (params[:supplier_invoice][:internal_no].to_s != @supplier_invoice.internal_no) ||\n (params[:supplier_invoice][:payday_limit].to_s != @supplier_invoice.payday_limit) ||\n (params[:supplier_invoice][:posted_at].to_s != @supplier_invoice.posted_at) ||\n (params[:supplier_invoice][:remarks].to_s != @supplier_invoice.remarks))\n master_changed = true\n end\n\n respond_to do |format|\n if master_changed || items_changed\n @supplier_invoice.updated_by = current_user.id if !current_user.nil?\n $attachment_changed = false\n if @supplier_invoice.update_attributes(params[:supplier_invoice])\n destroy_attachment\n $attachment = nil\n format.html { redirect_to @supplier_invoice,\n notice: (crud_notice('updated', @supplier_invoice) + \"#{undo_link(@supplier_invoice)}\").html_safe }\n format.json { head :no_content }\n else\n destroy_attachment\n $attachment = Attachment.new\n @projects = projects_dropdown_edit(@supplier_invoice.project)\n # @search_projects = @projects.map{ |p| p.id }.map(&:inspect).join(',')\n @work_orders = @supplier_invoice.project.blank? ? work_orders_dropdown : @supplier_invoice.project.work_orders.order(:order_no)\n @charge_accounts = work_order_charge_account(@supplier_invoice)\n # @stores = work_order_store(@supplier_invoice)\n @suppliers = suppliers_dropdown\n @payment_methods = @supplier_invoice.organization.blank? ? payment_methods_dropdown : payment_payment_methods(@supplier_invoice.organization_id)\n @receipt_notes = @supplier_invoice.supplier.blank? ? receipts_dropdown : receipts_dropdown_by_supplier(@supplier_invoice.supplier)\n @purchase_orders = @supplier_invoice.supplier.blank? ? unbilled_purchase_orders_dropdown : unbilled_purchase_orders_dropdown_by_supplier(@supplier_invoice.supplier)\n @note_items = []\n @order_items = []\n @products = []\n # @note_items = @supplier_invoice.receipt_note.blank? ? [] : note_items_dropdown(@supplier_invoice.receipt_note)\n # if @note_items.blank?\n # @products = @supplier_invoice.organization.blank? ? products_dropdown : @supplier_invoice.organization.products(:product_code)\n # else\n # @products = @note_items.first.receipt_note.products.group(:product_code)\n # end\n # Special to approvals\n @invoice_debt = number_with_precision(@supplier_invoice.debt.round(4), precision: 4)\n @invoice_not_yet_approved = number_with_precision(@supplier_invoice.amount_not_yet_approved.round(4), precision: 4)\n @users = User.where('id = ?', current_user.id)\n @is_approver = company_approver(@supplier_invoice, @supplier_invoice.project.company, current_user.id) ||\n office_approver(@supplier_invoice, @supplier_invoice.project.office, current_user.id) ||\n (current_user.has_role? :Approver)\n @companies = @supplier_invoice.organization.blank? ? companies_dropdown : companies_dropdown_edit(@supplier_invoice.organization)\n format.html { render action: \"edit\" }\n format.json { render json: @supplier_invoice.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to @supplier_invoice }\n format.json { head :no_content }\n end\n end\n end",
"def mark_as_read(participant)\n return if participant.nil?\n return self.receipts_for(participant).mark_as_read\n end",
"def payment_revert\n invoice = Invoice.find(params[:id])\n invoice.payment_received = false\n invoice.save!\n redirect_to root_path\n end",
"def revoke!(revoker)\n update(\n :ends_at => Time.now.getutc,\n :revoker_id => revoker.id,\n :needs_view => false\n )\n end",
"def editable_from_card?\n true\n end",
"def can_revoke_review_request\n if rule.review_requestor_id.nil?\n errors.add(:base, 'Control is not currently under review')\n elsif !(user.id == rule.review_requestor_id || project_permissions == 'admin')\n errors.add(:base, 'Only the requestor or an admin can revoke a review request')\n end\n end",
"def showReceipt\n render json: Approved.findReceipt(params[\"id\"])\n end",
"def update\n @deposit = current_user.family.transactions.find(params[:id], :readonly => false)\n @deposit.user = current_user\n\n respond_to do |format|\n if @deposit.update_attributes(params[:deposit])\n flash[:notice] = 'Deposit was successfully updated.'\n format.html { redirect_to(@deposit) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @deposit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @contract = Contract.find(params[:id])\n begin\n @contract.destroy \n rescue ActiveRecord::DeleteRestrictionError => e\n @contract.errors.add(:base, e)\n end \n respond_to do |format|\n\n if e.nil?\n \n format.html { redirect_to(\"/contractview\", :notice => 'Contract was successfully deleted.') }\n format.xml { head :ok }\n else \n format.html { render :action => \"edit\" }\n end\n \n \n end\n end",
"def cannot_edit(_order)\n !session[:is_administrator] && _order.id < 5\n end"
] |
[
"0.6356451",
"0.5944015",
"0.59429604",
"0.59206223",
"0.59204054",
"0.591077",
"0.5811107",
"0.5808448",
"0.5806186",
"0.5763809",
"0.57299495",
"0.56966436",
"0.56752115",
"0.5652189",
"0.5633896",
"0.5601607",
"0.55788404",
"0.5544041",
"0.5518178",
"0.550741",
"0.55018026",
"0.54986244",
"0.54872435",
"0.5478645",
"0.5467225",
"0.5458012",
"0.5453889",
"0.5448066",
"0.5426056",
"0.5421361",
"0.5404057",
"0.54008347",
"0.5397104",
"0.53932124",
"0.53779846",
"0.5365201",
"0.53651375",
"0.5359227",
"0.53589356",
"0.5357687",
"0.5357687",
"0.53434926",
"0.5342708",
"0.532915",
"0.5315764",
"0.529063",
"0.5285204",
"0.52777606",
"0.5275732",
"0.52696806",
"0.52696806",
"0.5268",
"0.5266738",
"0.5266112",
"0.5264119",
"0.5253157",
"0.5246637",
"0.5243234",
"0.5240448",
"0.52399856",
"0.52369666",
"0.5233728",
"0.52327996",
"0.5230311",
"0.5228464",
"0.52281755",
"0.5225108",
"0.5222708",
"0.52221024",
"0.52128035",
"0.52046543",
"0.5203125",
"0.5194936",
"0.5194875",
"0.51922977",
"0.5191384",
"0.518982",
"0.51815087",
"0.51793724",
"0.5175903",
"0.51727235",
"0.51552165",
"0.5149277",
"0.5148576",
"0.51460165",
"0.51460165",
"0.5145286",
"0.5141967",
"0.51387525",
"0.51383376",
"0.5131208",
"0.51300913",
"0.5129103",
"0.51286256",
"0.51274073",
"0.51273996",
"0.51195973",
"0.5110921",
"0.51044273",
"0.5103567"
] |
0.59331185
|
3
|
define regular methods here
|
def initialize
@provider = AmqpSource
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def methods() end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def custom; end",
"def custom; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def operations; end",
"def operations; end",
"def methods=(_arg0); end",
"def method\n\t\t# code code\n\tend",
"def implementation; end",
"def implementation; end",
"def overrides; end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def extended(*) end",
"def internal; end",
"def functions\n\n end",
"def private; end",
"def internal_methods; end",
"def wrapper; end",
"def methods\n super + DELEGATED_METHODS\n end",
"def operation; end",
"def special\n override\n end",
"def method\r\nend",
"def set_functions\n super\n end",
"def method_one; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def who_we_are\r\n end",
"def extra; end",
"def apis; end",
"def delegating_method; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def method_one\n end",
"def method_one\n end",
"def public_method; end",
"def weber; end",
"def plain; end",
"def method2() end",
"def suivre; end",
"def actions; end",
"def public; end",
"def public; end",
"def probers; end",
"def handlers; end",
"def handlers; end",
"def handlers; end",
"def private_method\n end",
"def calls; end",
"def calls; end",
"def helper_method(*methods); end",
"def stuff\n end",
"def api; end",
"def api; end",
"def respond(); end",
"def overload; end",
"def call\n # implement in subclasses\n end",
"def dispatch\n raise NotImplementedError\n end",
"def invoke\r\n # TODO: rename to more appropriate one 2007/05/10 by shino\r\n raise 'must be implemented in subclasses'\r\n end",
"def normal\n end",
"def normal\n end",
"def define_helpers; end",
"def method1; end",
"def call\n\n\tend",
"def call\n\n\tend",
"def call() end",
"def zuruecksetzen()\n end",
"def initialize(*)\n super\n if as != :button_to\n extend NfgUi::Components::Utilities::Methodable\n end\n end",
"def method=(_); end",
"def mathtex(*)\n super\n end",
"def common\n \n end",
"def call(*) end",
"def call(*) end",
"def do()\r\n\tend",
"def code_of_conduct; end",
"def troop; end",
"def abstract!; end"
] |
[
"0.82294893",
"0.7993455",
"0.7993455",
"0.7993455",
"0.7993455",
"0.767023",
"0.767023",
"0.7415533",
"0.7415533",
"0.7415533",
"0.7415533",
"0.7415533",
"0.7415533",
"0.7415533",
"0.7415533",
"0.7415533",
"0.7415533",
"0.7415533",
"0.7415533",
"0.7258611",
"0.7258611",
"0.7071402",
"0.70069045",
"0.6999735",
"0.6999735",
"0.6921877",
"0.6875824",
"0.6875824",
"0.6875824",
"0.68271065",
"0.6802471",
"0.6795507",
"0.6778659",
"0.676284",
"0.6660242",
"0.6624902",
"0.6589516",
"0.658498",
"0.65621716",
"0.65337116",
"0.64853746",
"0.64421636",
"0.64421636",
"0.64421636",
"0.64421636",
"0.64421636",
"0.64421636",
"0.64421636",
"0.64421636",
"0.6424147",
"0.64072424",
"0.63979256",
"0.63886654",
"0.6385739",
"0.6385739",
"0.6385739",
"0.6385739",
"0.63786024",
"0.63786024",
"0.6368163",
"0.63535887",
"0.6329196",
"0.6314239",
"0.63119096",
"0.63075465",
"0.629713",
"0.629713",
"0.62858456",
"0.6275609",
"0.6275609",
"0.6275609",
"0.62653446",
"0.62597543",
"0.62597543",
"0.6253751",
"0.6252624",
"0.6246634",
"0.6246634",
"0.6239625",
"0.62313586",
"0.6225723",
"0.62117124",
"0.61953944",
"0.6187723",
"0.6187723",
"0.61789364",
"0.61753684",
"0.61714303",
"0.61714303",
"0.6167758",
"0.6162925",
"0.6152835",
"0.6152179",
"0.6141861",
"0.61399317",
"0.6127998",
"0.6127998",
"0.61263734",
"0.6122545",
"0.61124223",
"0.60988873"
] |
0.0
|
-1
|
Additional method for TestAdapter to allow easy queue inspection with JobQueue.adapter.queue('foo')
|
def queue(queue = 'default')
get_queue(queue)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def queue_job; end",
"def mock_queue(queue_name)\n data[queue_name]\n end",
"def mock_queue!(queue_name)\n mock_queue(queue_name) or raise NotFound.new\n end",
"def queue( name )\n Qup::Adapter::Kestrel::Queue.new( @addr, name )\n end",
"def queue(queue, klass, **options)\n check_exists\n SideJob.queue(queue, klass, options.merge({parent: self, by: \"job:#{id}\"}))\n end",
"def work_queue(queue)\n if job = Riaque.reserve(queue)\n if klass = self.qualified_const_get(job.klass)\n klass.send(:perform, *job.payload)\n end\n\n job.dequeue\n end\n end",
"def queue(_); end",
"def queue(_); end",
"def test_prepare_job_descriptor_queue\n sm_uuid = 'sm_uuid'\n time_limit = 1000\n\n PlGridJob.expects(:queue_for_minutes).never\n\n desc = @qsub.prepare_job_descriptor('sm_uuid',\n 'queue_name' => 'some_queue',\n 'time_limit' => time_limit\n )\n\n assert_match /#PBS -q some_queue\\s*\\n/, desc\n end",
"def queue(message); end",
"def add_queue(queue_name)\n queue = MockQueue.new(queue_name)\n data[queue_name] = queue\n queue\n end",
"def queue; end",
"def queue; end",
"def queue( name, &block )\n destination( name, :queue, @queues, &block )\n end",
"def mock_queue(name=nil)\n MockQueue.new(name || \"anonymous-#{rand(2**32).to_s(16)}\")\n end",
"def queue(queue_name)\n @queues[queue_name]\n end",
"def queued_method_queue(method)\n nice_queued_method queued_method_queued_key(method), false do\n queued_method_job_queue method\n end\n end",
"def queue() = @queue ||= CommandQueue.new",
"def queue_for(method, queue_name)\n @_queue_names ||= {}\n @_queue_names[method] = queue_name\n end",
"def queue(queue)\n @configuration.queue = queue\n end",
"def queue\n @queue ||= produce_queue\n end",
"def queue\n\n @queue ||= channel.queue(*(opt('queue') || [ '' ]))\n end",
"def queue\n @queue ||= QueueManager.fetch(@name,@visibility)\n end",
"def setup_queue\n queue = Queue.find self.queue_name\n unless queue\n queue = Queue.create _id: self.queue_name\n end\n end",
"def queue(\n queue_name,\n url: nil,\n method: nil,\n reservation_sid: nil,\n post_work_activity_sid: nil,\n **keyword_args\n )\n append(Queue.new(\n queue_name,\n url: url,\n method: method,\n reservation_sid: reservation_sid,\n post_work_activity_sid: post_work_activity_sid,\n **keyword_args\n ))\n end",
"def with_queue_control\n TorqueBox::ServiceRegistry.lookup(\"jboss.messaging.default\") do |server|\n yield server.management_service.get_resource(\"jms.queue.#{_dump(nil)}\")\n end\n end",
"def job_class\n SingleInstanceQueueJob\n end",
"def queue(*queues)\n end",
"def build_queue(queue_name)\n QC::Queue.new(queue_name)\n end",
"def queue\n @queue ||= channel.queue(queue_name)\n end",
"def name\n @queue_string\n end",
"def queue_name\n raise 'queue_name must be ovewritten by the child class'\n end",
"def queue_name\n raise 'queue_name must be ovewritten by the child class'\n end",
"def enqueue_to(queue, klass, *args); end",
"def command_queue; end",
"def queue(queue_name, &block)\n q = create_queue(queue_name)\n block.call(q) if block\n q\n end",
"def test_orderOfElements\n @queue.enqueue(100)\n @queue.enqueue(200)\n assert_equal( 100, @queue.dequeue )\n assert_equal( 200, @queue.dequeue )\n end",
"def queue\n @handle.queue_name if @handle\n end",
"def queue\n @queue ||= Queue.new\n end",
"def test_dequeueOnNonEmptyStack\n @queue.enqueue(100)\n assert_equal( 100 , @queue.dequeue )\n end",
"def test_isEmptyOnNonEmptyQueue\n @queue.enqueue(100)\n assert_equal( false , @queue.empty? )\n end",
"def queueable(queue = nil)\n scope = where(state: :created).order('jobs.id')\n scope = scope.where(queue: queue) if queue\n scope\n end",
"def setup(*)\n super\n @queue = Array.new\n end",
"def queue\n @queue.pending\n end",
"def simple_queue\n make_json_request('qstatus')\n end",
"def queue(options={})\n# puts 'in queue'\n set_auto_attributes\n upload_if_needed\n\n response = SimpleWorker.service.queue(self.class.name, sw_get_data, options)\n# puts 'queue response=' + response.inspect\n# @task_set_id = response[\"task_set_id\"]\n @task_id = response[\"task_id\"]\n response\n end",
"def test_dequeueOnEmptyStack\n assert_equal( nil , @queue.dequeue )\n end",
"def test_peekOnNonEmptyQueue\n @queue.enqueue(100)\n assert_equal( 100 , @queue.peek )\n end",
"def _q\n @queue||=[]\n end",
"def queue(*args)\n @queue = args.first unless args.empty?\n (@queue || :default).to_s\n end",
"def enqueue_to(queue, job_class, *args)\n with_error_handling(\"Unable to enqueue #{job_class} job\", args: args) do\n Ladon.q.enqueue_to(queue, job_class, *args)\n end\n end",
"def stub_retrieving_named_queues\n allow_any_instance_of(AWS::SQS::QueueCollection).to receive(:named).with(an_instance_of(String)).and_return(mocked_queue)\n end",
"def job_queue_name\n 'email'\n end",
"def job_queue_name\n 'email'\n end",
"def sqs_queue(queue_name)\n SQSQueue.new(queue_name)\n end",
"def blocking_queue_handler queues, meth, timeout=Stella::Worker.queuetimeout\n queues << timeout # We do it this way to support Ruby 1.8\n queue, jobid = *(Stella::SmartQueue.redis.send(meth, *queues) || [])\n return nil if jobid.nil?\n #Stella.ld \"FOUND #{jobid} in #{queue}\"\n jobid\n end",
"def get_current_queue\n log_everything(\"Get current queue\")\n craft_firebase_command(\"minesweeper/queue.json\")\nend",
"def queued_method_job_queue(method)\n self.send_later :queued_method_job, method\n end",
"def queue\n # Probably should be a UUID in the real world\n @queue ||= channel.queue(self.object_id.to_s)\n end",
"def queue(&b)\n @queue << b\n end",
"def queue\n JenkinsApi::Client::BuildQueue.new(self)\n end",
"def queue\n JenkinsApi::Client::BuildQueue.new(self)\n end",
"def enqueue(queueKey, workUnit)\n self.queues[queueKey].send_message(workUnit)\n end",
"def enqueue(job_id)\n create_job_record(job_id)\n BEANSTALK_QUEUE.yput(:job_id => job_id)\n @last_queried[job_id] = Time.now\n end",
"def initialize\n @queue_options = {}\n @queue_configs = []\n end",
"def enqueue(job)\n sqs.send_message(\n queue_url: get_queue_url(job),\n message_body: MultiJson.dump(job.serialize)\n )\n end",
"def queue(origin, framework_name=DEFAULT_FRAMEWORK)\n Queue.new(origin, FRAMEWORKS[framework_name])\n end",
"def queue_url(*_)\n if Settings.active_job_queue.url\n Settings.active_job_queue.url\n else\n super\n end\n end",
"def queue_test(test,\n target,\n project,\n machine,\n pool,\n sup = nil,\n ipv6 = nil)\n handle_action_exceptions(__method__) do\n cmd_line = [\n \"queuetest '#{test}' '#{target}' '#{project}' '#{machine}' '#{pool}'\"\n ]\n cmd_line << 'json' if @json\n cmd_line << \"-sup '#{sup}'\" unless sup.nil?\n cmd_line << \"-IPv6 '#{ipv6}'\" unless ipv6.nil?\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end",
"def action_mailer_job_must_be_enqueued(mailer_class, mailer_method, *args)\n assert_includes enqueued_jobs, action_mailer_job(mailer_class, mailer_method, *args)\n end",
"def enqueue(queueKey, work_unit)\n queues[queueKey].send_message(work_unit)\n end",
"def queue\n @queue ||= channel.queue(generate_queue_name, exclusive: true)\n end",
"def name\n @queue.name\n end",
"def test_peek\n assert_equal(nil, @queue.peek, \"Diese Eissorte ist falsch!\")\nend",
"def enqueue(job)\n enqueue_at(job, nil)\n end",
"def setup_queue\n Thread.current[:carrot] = Carrot.new(:host=>'mediashelf1.dtic.dk')\n @q = Carrot.queue(@queue_name)\n end",
"def queue(job_id)\n redis do |conn|\n conn.lpush(key.queued, job_id)\n end\n end",
"def enqueue(*args); end",
"def enqueue_task(task)\n default_queue << task\n end",
"def create_queues\n queue\n exchange\n end",
"def get_queues\n @gem_queue = get_queue 'gem'\n @md5_queue = get_queue 'md5'\n @sha512_queue = get_queue 'sha512'\n end",
"def get_queue\n return @queue unless @queue.nil?\n\n Domo::Queue::Redis::JobQueue.active_queue(@redis_client, @dataset_id, @stream_id, pipeline_id)\n end",
"def queue_key\n queue_name.is_a?(Proc) ? default_queue_key : queue_name.to_sym\n end",
"def on_queue(url)\n true\n end",
"def queue\n @queue ||= []\n end",
"def setup_amqp\n @channel = TomQueue.bunny.create_channel\n @channel.prefetch(0)\n\n @exchange = channel.fanout(\"#{prefix}.work.deferred\",\n :durable => true,\n :auto_delete => false)\n\n @queue = channel.queue(\"#{prefix}.work.deferred\",\n :durable => true,\n :auto_delete => false).bind(exchange.name)\n end",
"def action(queue_name)\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n -f #{[Conn[:host_api], 'queues', Conn[:vhost], queue_name].join('/')} | jq '.messages_ready'`\n end",
"def queue\n pending_duplicate_job || Delayed::Job.enqueue(self)\n end",
"def task_retry_queue\n queue = channel.queue(TASK_RETRY_QUEUE, arguments: { 'x-dead-letter-exchange': TASK_EXCHANGE })\n queue.bind(task_retry_exchange) # done this way due to bug on the testing library where bind does not return self.\n queue\n end",
"def schedule_queue_bill(*args)\n self.class.schedule_queue_bill(*args)\n end",
"def queue\n @queue ||= SizedQueue.new @queue_size\n end",
"def name\n @queue.queue_name\n end",
"def before_queue(urls)\n # stub\n end",
"def get_queue_url(job)\n sqs.create_queue(queue_name: job.queue_name)[:queue_url]\n end",
"def test_peekOnEmptyQueue\n assert_equal( nil, @queue.peek )\n end",
"def requeue(queue, opts = {})\n queue_name = case queue\n when String, Symbol then queue\n else queue.name\n end\n\n note_state_change :requeue do\n @client.call('requeue', @client.worker_name, queue_name, @jid, @klass_name,\n JSON.dump(opts.fetch(:data, @data)),\n opts.fetch(:delay, 0),\n 'priority', opts.fetch(:priority, @priority),\n 'tags', JSON.dump(opts.fetch(:tags, @tags)),\n 'retries', opts.fetch(:retries, @original_retries),\n 'depends', JSON.dump(opts.fetch(:depends, @dependencies))\n )\n end\n end",
"def queue(options = {})\n\n # This should queue and save this class\n command_object.status = Command::Status::QUEUED\n command_object.save\n\n if (options[:user].is_a?(User)) then\n command_object.user = options[:user]\n command_object.save\n end\n\n ## We'll try and do it ourselves.\n unless (options[:defer] && options[:defer] == true) then\n CommandController.do_queued_commands\n end\n\n ## And just to be safe, we'll tickle the others as well (but to\n ## try avoid ickling ourself).\n me = Socket.gethostname\n Workers.get_workers.each do |worker| \n logger.info \"queue: tickling: #{worker.name}\"\n if (not me.eql? worker.name) and (not me.eql? worker.ip)\n CommandController.tickle(worker.name, worker.ip)\n end\n end\n end",
"def queue_receive(queue, options = {})\n raise NotImplementedError\n end",
"def queue_key\n super || default_queue_key\n end",
"def work_job(queue = :job)\n worker = Resque::Worker.new(queue)\n worker.perform(worker.reserve)\n end"
] |
[
"0.74436754",
"0.73498684",
"0.7149486",
"0.6999552",
"0.6965126",
"0.6910257",
"0.69025743",
"0.69025743",
"0.68443596",
"0.6798437",
"0.67608315",
"0.67347974",
"0.67347974",
"0.6711454",
"0.67095786",
"0.6693022",
"0.66871697",
"0.6686356",
"0.66680217",
"0.6608542",
"0.655553",
"0.6552331",
"0.65329474",
"0.6524403",
"0.6523261",
"0.64879584",
"0.6482627",
"0.64783907",
"0.645899",
"0.6457174",
"0.6444867",
"0.64401144",
"0.64401144",
"0.6430839",
"0.6424132",
"0.64230114",
"0.6399611",
"0.6391105",
"0.6381378",
"0.6370146",
"0.63619846",
"0.63580704",
"0.63431126",
"0.6337144",
"0.63268214",
"0.6302587",
"0.62960726",
"0.62861097",
"0.627175",
"0.62655944",
"0.6246475",
"0.62410265",
"0.62397414",
"0.62397414",
"0.6211622",
"0.62022036",
"0.61971223",
"0.61926794",
"0.6188707",
"0.6187819",
"0.61820865",
"0.61820865",
"0.61783093",
"0.6168431",
"0.6156649",
"0.61544675",
"0.6152726",
"0.6149264",
"0.61452067",
"0.61347574",
"0.6128183",
"0.61212355",
"0.61189824",
"0.6103853",
"0.60932374",
"0.6090734",
"0.60760355",
"0.60474664",
"0.60339785",
"0.60195804",
"0.6014281",
"0.60131705",
"0.6012613",
"0.60054445",
"0.6002221",
"0.60011774",
"0.59996545",
"0.59958774",
"0.59947705",
"0.5989022",
"0.5970787",
"0.5960421",
"0.5953759",
"0.5948152",
"0.5940885",
"0.5939846",
"0.5926397",
"0.59244335",
"0.59240276",
"0.59211254"
] |
0.7147574
|
3
|
Override current_resouce to the current order for authorization.
|
def current_resource
@current_resource ||= BroOrder.find_by(guid: params[:guid])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def current_order\n @current_order ||= Order.find_by(id: user_id)\n end",
"def current_order\n @current_order ||= load_order_from_session unless @current_order == false\n end",
"def current_resource\n @current_resource ||= KwkOrder.find_by(guid: params[:guid])\n end",
"def current_orders\n @current_orders ||= OrderDecorator.decorate_collection(\n object.\n orders.\n includes(:order_items).\n from_current_month.\n limit(CURRENT_ORDERS_LIMIT).\n order(:created_at))\n end",
"def current_order\n \torders = self.orders\n \t@current_order = nil\n \tfor order in orders\n \t\t@current_order = order if order.current?\n \tend\n \t\n \tif @current_order == nil\n \t\t@current_order = self.orders.create\n \t\t@current_order.current = true\n \t\t@current_order.save\n \tend\n \t@current_order\n end",
"def simple_current_order\n @order ||= Spree::Order.find_by(id: session[:order_id], currency: current_currency)\n end",
"def flexmock_current_order=(value)\n @flexmock_current_order = value\n end",
"def original_order\n end",
"def my_account\n @orders = current_customer.orders.includes(:product).in_order || []\n end",
"def set_current_user\n Authorization.current_user = current_user\n end",
"def set_current_user\n Authorization.current_user = current_user\n end",
"def index\n authorize Order\n super\n end",
"def set_authed_order\n @order = current_user.orders.find(params[:id])\n end",
"def simple_current_order\n return @simple_current_order if @simple_current_order\n\n @simple_current_order = find_order_by_token_or_user\n\n if @simple_current_order\n @simple_current_order.last_ip_address = ip_address\n return @simple_current_order\n else\n @simple_current_order = current_store.orders.new\n end\n end",
"def order=(newlocal_order)\n # clear any previous custom order\n @custom_order = nil\n oldlocal_order = order.dup\n order = []\n newlocal_order.each do |name|\n key = name.to_sym\n if oldlocal_order.include?(key)\n oldlocal_order.delete(key)\n order << key\n end\n end\n order += oldlocal_order\n @custom_order = order\n end",
"def set_authorization\n Authorization.current_user = current_user\n end",
"def set_current_user\n current_user\n authorize\n end",
"def current_order(options = {})\n options[:create_order_if_necessary] ||= false\n options[:lock] ||= false\n\n return @current_order if @current_order\n\n if session[:order_id]\n current_order = Spree::Order.includes(:adjustments).lock(options[:lock]).find_by(id: session[:order_id], currency: current_currency)\n @current_order = current_order unless current_order.try(:completed?)\n end\n\n if options[:create_order_if_necessary] and (@current_order.nil? or @current_order.completed?)\n @current_order = Spree::Order.new(currency: current_currency)\n @current_order.user ||= try_spree_current_user\n # See issue #3346 for reasons why this line is here\n @current_order.created_by ||= try_spree_current_user\n @current_order.save!\n\n # make sure the user has permission to access the order (if they are a guest)\n if try_spree_current_user.nil?\n session[:access_token] = @current_order.token\n end\n end\n\n if @current_order\n @current_order.last_ip_address = ip_address\n session[:order_id] = @current_order.id\n return @current_order\n end\n end",
"def my_order\n @orders = Order.where(user: current_user)\n end",
"def set_order\n @order = Order.find_for_user(params[:id], current_user)\n end",
"def current_order\n current_customer.incomplete_order\n end",
"def current_order(options = {})\n options[:create_order_if_necessary] ||= false\n options[:includes] ||= true\n\n if @current_order\n @current_order.last_ip_address = ip_address\n return @current_order\n end\n\n @current_order = find_order_by_token_or_user(options, true)\n\n if options[:create_order_if_necessary] && (@current_order.nil? || @current_order.completed?)\n @current_order = current_store.orders.create!(current_order_params)\n @current_order.associate_user! try_spree_current_user if try_spree_current_user\n @current_order.last_ip_address = ip_address\n end\n\n @current_order\n end",
"def current_order=(new_order)\n session[order_session_param] = new_order ? new_order.id : nil\n @current_order = new_order || false\n end",
"def orders\n super.complete.order('completed_at DESC, id DESC')\n end",
"def load_order!\n @order = current_user.orders.find params[:id]\n # @order = @cookbook.get_active_reorder(params[:id]) if @cookbook.is_owner? current_user\n end",
"def set_order_and_authorize\n @order = Order.find(params[:id])\n if !(current_user.admin or current_user.is_provider) and current_user != @order.user\n render json: {\"error\":\"You are not authorized for this action\"}, :status => 401 and return\n end\n end",
"def current_reorder\n inventory_reorders.active.first\n end",
"def set_current_user_for_auth\n Authorization.current_user = current_user\n end",
"def reauthorize\n @order.reauthorize\n end",
"def current_resource_owner\n return @current_resource_owner if defined?(@current_resource_owner)\n\n super\n end",
"def current_order\n if session[:order_id]\n Order.find(session[:order_id])\n else\n Order.new\n end\n end",
"def current_order\n if session[:order_id]\n Order.find(session[:order_id])\n else\n Order.new\n end\n end",
"def cur_ordering\r\n @orderings\r\n end",
"def flexmock_current_order\n @flexmock_current_order ||= 0\n end",
"def current_order(create_order_if_necessary = false)\n return @current_order if @current_order\n if session[:order_id]\n @current_order = Spree::Order.find_by_id(session[:order_id], :include => :adjustments)\n end\n if create_order_if_necessary and (@current_order.nil? or @current_order.completed?)\n @current_order = Spree::Order.new\n before_save_new_order\n @current_order.save!\n after_save_new_order\n end\n session[:order_id] = @current_order ? @current_order.id : nil\n @current_order\n end",
"def set_order\n if admin_user?\n @order = Order.find(params[:id])\n else\n @order = current_user.orders.find(params[:id])\n end\n end",
"def begin_of_association_chain\n self.action_name != 'index' ? current_user : super\n end",
"def edit\n @order = current_order(true)\n associate_user\n end",
"def edit\n @order = current_order(true)\n associate_user\n end",
"def increment_order!\n @current += 1\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def current_order\n order = current_user.customer.orders.last\n render json: order.as_json(include: [:restaurant, {order_details: {include: :meal}}]), status: :ok\n end",
"def set_order\n @order = Order.find(params[:id])\n authorize @order\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def order\n order = \"#{@rules[:s]}\".split(' ')\n @resource = order.blank? ? @resource : @resource.order_by(order)\n end",
"def set_order\n @order = @company.orders.find(params[:id])\n authorize @order\n end",
"def order\n @order ||= detect_order(params[:order]) || default_order\n end",
"def set_current_user\n AuthorizationData.current_user = current_user\n yield\n ensure\n AuthorizationData.current_user = nil\n end",
"def set_aux_user\n Authorization.current_user = current_aux_user\n end",
"def edit\n @order = current_order || Spree::Order.incomplete.find_or_initialize_by(guest_token: cookies.signed[:guest_token])\n associate_user\n end",
"def authenticate_scope!\r\n send(:\"authenticate_#{resource_name}!\")\r\n self.resource = resource_class.find(send(:\"current_#{resource_name}\").id)\r\n end",
"def index\n if params[:company_id]\n @company = Company.find(params[:company_id])\n @orders = @company.orders\n @account_managers = @current_agency.account_managers if @current_agency.present?\n @order = @company.orders.new if @company.present?\n \n else\n # @orders = @current_company.orders.active.order(created_at: :desc) if @current_company.present?\n @orders = @current_agency.orders.active.order(created_at: :desc) if @current_agency.present?\n end\n \n \n authorize @orders\n\n end",
"def set_order\n\n @order = Order.find(params[:id])\n authorize @order\n end",
"def reprocess_ordering\n orderable_scope.each_with_index do |resource, index|\n resource.update_column(:position, index)\n end\n end",
"def scope_current_account\n Account.current = Account.find_account(request.host)\n #--- set the current request site url for use where request object is not avail,\n # like in ActionMailer\n Account.current.set_url_parts(request.protocol, request.host_with_port)\n yield\n ensure\n # Ensure that once this request is done, the Account.current (which\n # is stored in thread storage) is cleared.\n # When testing, it's better *not* to clear it, since expectations\n # after the controller call may need the current account\n Account.current = nil unless Rails.env.test?\n end",
"def set_order\n @order = current_user.orders.find(params[:id])\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\")\n self.resource = resource_class.find(send(:\"current_#{resource_name}\").id)\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\")\n self.resource = resource_class.find(send(:\"current_#{resource_name}\").id)\n end",
"def authenticate_scope!\r\n send(:\"authenticate_user!\", :force => true)\r\n self.resource = send(:\"current_user\")\r\n end",
"def logging_in\n guest_order = guest_user.current_order_in_progress\n current_order = current_user.current_order_in_progress\n current_order.merge guest_order\n end",
"def index\n\n if current_user.superadmin_role? \n @orders = Order.all.order(:id)\n else\n @orders = Order.where(\"user_id = ?\", current_user).or(Order.where(\"owner_id = ?\", current_user))\n end\n\n\n end",
"def edit\r\n @order = current_order(true)\r\n end",
"def current_resource\n @current_resource ||= @item\n end",
"def edit\n @order = current_order || Order.incomplete.find_or_initialize_by(guest_token: cookies.signed[:guest_token])\n associate_user\n end",
"def edit\n @order = current_order || Order.incomplete.find_or_initialize_by(guest_token: cookies.signed[:guest_token])\n associate_user\n end",
"def my_orders\n @orders = current_user.orders.all\n end",
"def current_resource\n [ @address,\n @admin,\n @category,\n @change,\n @task,\n @email_address,\n @image,\n @option,\n @option_group,\n @order,\n @order_group,\n @variation,\n @product,\n @user,\n @shop,\n @product_template ].compact.first\n end",
"def current_user\n return @current_user if @current_user\n \n @current_user = super.decorate if super\n @current_user\n end",
"def completion_route\n return order_path(@order) unless @order.user.anonymous?\n token_order_path(@order, @order.user.token)\n end",
"def set_authorization\n @user ||= current_user\n authorize @user\n end",
"def make_current\n Account.current_account = self\n end",
"def pundit_user\n CurrentAuthority.new(current_user, current_right)\n end",
"def current_user\n @_decorated_current_user ||= super&.decorate\n end",
"def current\n respond_with current_user\n end",
"def edit\n@order = current_order || Order.incomplete.find_or_initialize_by(guest_token: cookies.signed[:guest_token])\nassociate_user\nend",
"def set_order\n @order = current_order\n\n if @order.new_record?\n @order.save!\n session[:order_id] = @order.id\n end\n end",
"def default; return DefaultOrder; end",
"def associate_user\n if current_order.user.anonymous? and current_user\n current_order.associate_user!(current_user)\n end\n end",
"def index# not :post order. this is a :get index of previous orders.\n @orders = current_refinery_user.orders.order('created_at DESC')\n end",
"def set_order\n @order = check_owner_user_id(Order.find(params[:id]))\n end",
"def complete_order\n # Get the current user's last order (i.e. the current order)\n @order = @current_user.orders.last\n\n # Invoke an action in order.rb that 'moves' items from a user's cart to the current order\n @order.add_line_items_from_cart @cart\n\n # Invoke action in order.rb that updates stock levels\n @order.update_inventory\n\n # Destroy the user's cart\n @cart.destroy\n\n # Set a flash notification that the order was successful\n flash[:notification] = \"Order successful!!!\"\n\n # Redirect to orders#show\n redirect_to order_path(@order)\n end",
"def current_user\n @current_user ||= authorize_request\n end",
"def current_user\n @current_user ||= authorize_request\n end",
"def resource_base\n @resource_base ||= model_of_controller.respond_to?(:authorized) ?\n model_of_controller.authorized(current_permission) :\n model_of_controller.scoped\n end",
"def with_current_admin(admin)\n return yield unless new(admin).admin_mode?\n\n Gitlab::SafeRequestStore[CURRENT_REQUEST_ADMIN_MODE_USER_RS_KEY] = admin\n\n Gitlab::AppLogger.debug(\"Admin mode active for: #{admin.username}\")\n\n yield\n ensure\n Gitlab::SafeRequestStore.delete(CURRENT_REQUEST_ADMIN_MODE_USER_RS_KEY)\n end",
"def index # see model > order.rb\n # if current_user\n @orders = current_user.orders\n render \"index.json.jb\"\n # else\n # render json: [], status: :unauthorized\n # end\n end",
"def order\n end",
"def order\n return @order\n end",
"def current_role\n \treturn @current_role if defined? @current_role\n \t@current_role = current_user && current_user.role_symbol\n end",
"def me_order_pending\n object_from_response(self, Artsy::Client::Domain::Order, :get, \"/api/v1/me/order/pending\", {})\n end",
"def apply_custom_scope\n each_sort do |attribute, direction|\n @scope = custom_scope\n .call(@scope, attribute, direction, resource.context)\n end\n @scope\n end"
] |
[
"0.6241206",
"0.6219094",
"0.6215107",
"0.59539175",
"0.5824193",
"0.5820312",
"0.58148664",
"0.5811597",
"0.57556367",
"0.5738723",
"0.5738723",
"0.5711391",
"0.56935304",
"0.5681626",
"0.56672984",
"0.5638636",
"0.56313795",
"0.5567969",
"0.5542376",
"0.5526105",
"0.55094385",
"0.5500058",
"0.5495328",
"0.5476538",
"0.5472524",
"0.5472496",
"0.54689384",
"0.54492265",
"0.5447193",
"0.54411113",
"0.5438226",
"0.5438226",
"0.543202",
"0.5426749",
"0.5417488",
"0.54025936",
"0.5400779",
"0.5399511",
"0.5399511",
"0.53916436",
"0.536407",
"0.536407",
"0.536407",
"0.536407",
"0.53523815",
"0.5345285",
"0.5335086",
"0.5335086",
"0.5335086",
"0.5335086",
"0.5335086",
"0.5335086",
"0.5335086",
"0.533461",
"0.5321993",
"0.53153116",
"0.5310287",
"0.5307634",
"0.53071856",
"0.53071135",
"0.52913004",
"0.52604544",
"0.5249117",
"0.52216256",
"0.52141297",
"0.52108955",
"0.52108955",
"0.52042603",
"0.5197384",
"0.5184716",
"0.5169978",
"0.51677215",
"0.51170814",
"0.51170814",
"0.5115013",
"0.5109058",
"0.5108578",
"0.5093206",
"0.50818264",
"0.50783503",
"0.50713843",
"0.5051803",
"0.5049518",
"0.504441",
"0.504171",
"0.50322104",
"0.5031857",
"0.50255036",
"0.50027716",
"0.49706316",
"0.49700245",
"0.49700245",
"0.4968771",
"0.496773",
"0.49669173",
"0.49584538",
"0.49564528",
"0.49542323",
"0.49443454",
"0.4944311"
] |
0.6118802
|
3
|
setters and getters for world foreign key
|
def world_name=(name)
self.world = World.find_or_create_by(name: name)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def stores_foreign_key?; true; end",
"def foreign_key\n meta(foreign_key: true)\n end",
"def stores_foreign_key?; false; end",
"def stores_foreign_key?; false; end",
"def foreign_key\n association.foreign_key \n end",
"def foreign_key\n self.name + \"_id\"\n end",
"def using_key(foreign_key)\n @column = foreign_key\n self\n end",
"def foreign_key\n association ? association.foreign_key : name\n end",
"def set_foreign_key\n @foreign_key = ForeignKey.find(params[:id])\n end",
"def foreign_key\n @foreign_key ||= (@options[:foreign_key] || \"#{@name}_id\").to_s\n end",
"def key\n stores_foreign_key? ? foreign_key : primary_key\n end",
"def foreign_key\n @resource_options.fetch :foreign_key,\n :\"#{tools.string.singularize association_name}_id\"\n end",
"def hash_fk_model\n raise NotImplementedError\n end",
"def hash_fk_model\n raise NotImplementedError\n end",
"def foreign_key_setter\n # note: You can't check if this association stores foreign key\n # See HasOne and HasMany binding, they referenced foreign_key_setter\n @foreign_key_setter ||= \"#{foreign_key}=\" if foreign_key\n end",
"def foreign_key\n @foreign_key ||= @options[:foreign_key] ? @options[:foreign_key].to_s :\n default_foreign_key_field\n end",
"def foreign_key(separate_class_name_and_id_with_underscore = true)\n MotionSupport::Inflector.foreign_key(self, separate_class_name_and_id_with_underscore)\n end",
"def foreign_key_for assoc_name\n raise NotImplementedError\n end",
"def foreign_key_for assoc_name\n raise NotImplementedError\n end",
"def foreign_key(class_name, separate_class_name_and_id_with_underscore = true)\n Geode::FastInflector.foreign_key(class_name, separate_class_name_and_id_with_underscore)\n end",
"def owner_key_name\n reflection.join_foreign_key\n end",
"def owner_key_name\n reflection.join_foreign_key\n end",
"def stores_foreign_key?\n false\n end",
"def child_foreign_key\n @child_hierarchy_relationship.foreign_key\n end",
"def id\n self[:id]\n end",
"def child_relation; end",
"def foreign_key?\n true\n end",
"def id\n return self[:id]\n end",
"def foreign_key(*args)\n # get the name\n name = String===args[0] ? args.shift : \"fk_#{@relvar.name}_#{@relvar.foreign_keys.size}\"\n \n # get the attribute => key mapping\n raise \"Invalid foreign key definition #{args.inspect}\" unless \\\n args.size==1 and Hash===args[0] and \\\n args[0].size == 1\n mapping = args[0]\n \n # get the attributes now\n attributes = args[0].keys.flatten.collect{|a| @relvar.attribute(a, true)}\n \n # get the target now\n target = mapping.values[0]\n target = target.primary_key if Relvar === target\n raise \"Invalid foreign key #{name} for #{@relvar.name} (#{target.inspect})\" unless Key===target\n\n @relvar.add_foreign_key(name, attributes, target)\n end",
"def foreign_key(clazz=nil)\n @foreign_key || begin\n if @type == :t_belongs_to\n belongs_to_foreign_key\n elsif @type == :t_has_one || @type == :t_has_many\n has_x_foreign_key(clazz)\n end\n end\n end",
"def belongs_to(*names)\n options = names.last.is_a?(Hash) ? names.pop : {}\n raise ArgumentError, 'invalid foreign key' if options.key?(:foreign_key)\n\n key_gen = ->(name,l) { :\"#{name.to_s.split('_').map {|part| part[0..l] }.join}_id\" }\n\n names.each do |name|\n key = key_gen.(name, 0)\n key = key_gen.(name, 1) if self.method_defined?(key)\n\n value = :\"#{name}_id\"\n\n Helpers.add_field(self, key, :type => BSON::ObjectId, :as => value)\n super name, options.merge(:foreign_key => key)\n end\n end",
"def foreign_key(class_name, key = \"id\")\n underscore(demodulize(class_name.to_s)) << \"_\" << key.to_s\n end",
"def foreign_key(separate_class_name_and_id_with_underscore = true)\n ActiveSupport::Inflector.foreign_key(self, separate_class_name_and_id_with_underscore)\n end",
"def association_id_method\n self.class.foreign_key_name(@options[\"name\"])\n end",
"def id\n self[:id]\n end",
"def primary_key\n self[:primary_key] ||= associated_class.primary_key\n end",
"def get_origin_foreign_key\n if @origin_class\n return [@origin_class.revisionary_options[:polymorphic]].map { |p| [ \"#{p}_type\", \"#{p}_id\" ] }.flatten\n foreign_key = self.class.reflect_on_all_associations.find { |a| a.klass == @origin_class }.options[:foreign_key].to_s\n @foreign_key ||= foreign_key.blank? ? [@origin_class.name.downcase + '_id'] : [foreign_key]\n end\n end",
"def inverse_foreign_key_setter\n @inverse_foreign_key_setter ||= \"#{inverse_foreign_key}=\" if inverse_foreign_key\n end",
"def key\n id\n end",
"def foreign_key(separate_class_name_and_id_with_underscore = true)\n # TODO\n # Inflector.foreign_key(self, separate_class_name_and_id_with_underscore)\n end",
"def save_primary_key_grip; end",
"def db_key\n\t\t\tself.class.db_key\n end",
"def primary_key\n send( self.class.primary_key )\n end",
"def default_right_key\n :\"#{singularize(self[:name])}_id\"\n end",
"def id\n key\n end",
"def default_right_key\n :\"#{self[:name]}_id\"\n end",
"def real_id\n @id\n end",
"def real_id\n @id\n end",
"def normalized_foreign_key\n @normalized_foreign_key ||= attribute.singularize\n end",
"def id\n attributes[self.class.primary_key]\n end",
"def primary_key\n self[:primary_key] ||= self[:model].primary_key\n end",
"def foreign_properties\n to_h.slice(*foreign_keys + foreign_objects)\n end",
"def default_right_key\n :\"#{self[:name].to_s.singularize}_id\"\n end",
"def entityID\n end",
"def entityID\n end",
"def foreign_key_for(association)\n model_instance[association.foreign_key_column_name]\n end",
"def foreign_key(class_name, separate_class_name_and_id_with_underscore = true)\n underscore(demodulize(class_name)) + (separate_class_name_and_id_with_underscore ? \"_id\" : \"id\")\n end",
"def foreign_key(class_name, separate_class_name_and_id_with_underscore = true)\n underscore(demodulize(class_name)) + (separate_class_name_and_id_with_underscore ? \"_id\" : \"id\")\n end",
"def id\n object_id\n end",
"def foreign_key_default\n nil\n end",
"def key\n self.id\n end",
"def key\n self.id\n end",
"def key\n self.id\n end",
"def primary_key\n self[:primary_key]\n end",
"def foreign_key?\n index == entity.key_column && !entity.is_core\n end",
"def foreign_key?\n false\n end",
"def key\n @entity.key\n end",
"def getId\n @id\n end",
"def foreign_key(relation)\n detect { |attr| attr.foreign_key? && attr.target == relation }\n end",
"def property\n id\n end",
"def get_id_from_model(model_instance)\n model_instance[foreign_key_column_name]\n end",
"def update_foreign_keys_to_point_another_translation record\n record.without_current_locale do\n associated = record.send(name)\n associated.update_all({foreign_key => record.translations.first.id})\n end\n end",
"def primary_key\n 'id'\n end",
"def define_set_field_method(field)\n define_method \"#{field.name}=\" do |object|\n if object.nil?\n self.send \"#{field.foreign_key}=\", nil\n elsif object.is_a?(Symbol)\n self.send \"#{field.foreign_key}=\", self.class.send(field.name, object).id\n elsif object.kind_of?(ActsAsEnumField::InstanceMethods)\n self.send \"#{field.foreign_key}=\", object.id\n else\n raise \"BUG: invalid argument \" + object.class.name\n end\n end\n end",
"def set_id_on_model(model_instance, new_id)\n model_instance[foreign_key_column_name] = new_id\n end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id\n self['id']\n end",
"def id\n self['id']\n end",
"def update_foreign_key!(model_instance)\n return unless foreign_key_column_exists?\n\n hash = { }\n\n low_card_object = model_instance._low_card_objects_manager.object_for(self)\n\n low_card_class.low_card_value_column_names.each do |value_column_name|\n hash[value_column_name] = low_card_object[value_column_name]\n end\n\n new_id = low_card_class.low_card_find_or_create_ids_for(hash)\n\n unless get_id_from_model(model_instance) == new_id\n set_id_on_model(model_instance, new_id)\n end\n end",
"def derive_foreign_key\n result = super\n result = ActiveSupport::Inflector.pluralize(result) \\\n if collection? && connected_through_array?\n result\n end",
"def id\n __id\n end",
"def foreign_key_present?\n false\n end",
"def foreign_key_present?\n false\n end",
"def [](primary_key_value)\n entity = odata_entity_set[primary_key_value]\n return entity if entity.nil?\n model = self.new\n model.instance_variable_set(:@odata_entity, entity)\n model\n end",
"def fk_to_meth(fk)\n public_send(fk.remove(\"_id\"))\n end",
"def id; self['_id']; end",
"def relation_foreign_key(relation)\n relation_reflect(relation).foreign_key\n end",
"def associated_key_column\n self[:left_key]\n end",
"def macro\n :belongs_to_related\n end",
"def primary_key_attribute\n :id\n end"
] |
[
"0.7319596",
"0.70148623",
"0.6951776",
"0.6951776",
"0.6680756",
"0.6590722",
"0.6469656",
"0.6399574",
"0.6371084",
"0.633225",
"0.6325647",
"0.63089234",
"0.62374896",
"0.62374896",
"0.6200924",
"0.61363125",
"0.60799956",
"0.60461015",
"0.60461015",
"0.6024619",
"0.5992729",
"0.5992729",
"0.59800243",
"0.5963194",
"0.5954943",
"0.5894759",
"0.5891156",
"0.58862835",
"0.5860493",
"0.58406216",
"0.581843",
"0.5806704",
"0.5799566",
"0.57782143",
"0.5778121",
"0.57665014",
"0.5743385",
"0.5739639",
"0.57374823",
"0.5693086",
"0.56897444",
"0.5689246",
"0.56781006",
"0.5674179",
"0.5673045",
"0.5672989",
"0.56630826",
"0.56630826",
"0.56519514",
"0.5646296",
"0.5634076",
"0.5629529",
"0.56270707",
"0.5625505",
"0.5625505",
"0.5618832",
"0.5614394",
"0.5614394",
"0.5607392",
"0.5598934",
"0.5573095",
"0.5573095",
"0.5573095",
"0.5567163",
"0.5555584",
"0.555409",
"0.5551212",
"0.5546324",
"0.5543838",
"0.5540566",
"0.5517523",
"0.55067384",
"0.5504285",
"0.5502315",
"0.54992",
"0.54980004",
"0.54980004",
"0.54980004",
"0.54980004",
"0.54980004",
"0.54980004",
"0.54980004",
"0.54980004",
"0.54980004",
"0.54980004",
"0.54980004",
"0.54980004",
"0.54723585",
"0.54723585",
"0.54653895",
"0.5462023",
"0.5461481",
"0.54555935",
"0.54555935",
"0.5452058",
"0.5447768",
"0.54442185",
"0.5440115",
"0.5435204",
"0.54278",
"0.54219556"
] |
0.0
|
-1
|
setters and getters for user foreign key
|
def user_name=(name)
self.user = User.find_or_create_by(name: name)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user_id=(new_id)\n if allow_editing?\n @user_id = ForeignKey.new(id: new_id, class_name: User)\n @user_name = user.name\n end\n end",
"def user_id\n self.user.id\n end",
"def user_id\n self.title_and_name\n end",
"def user\n User.find(self[:user_id])\n end",
"def user\n User.find_by_id self.user_id \n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n user.id\n end",
"def id\n self.user_id\n end",
"def user=(_user)\n self.user_id = _user.id\n\n _user\n end",
"def user_id=(value)\n @user_id = value\n end",
"def user_id=(value)\n @user_id = value\n end",
"def user_id=(value)\n @user_id = value\n end",
"def user_id=(value)\n @user_id = value\n end",
"def user_id=(value)\n @user_id = value\n end",
"def user_id=(value)\n @user_id = value\n end",
"def user\n User.load(self.user_id)\n end",
"def set_user_id\n @user_id = UserId.find(params[:id])\n end",
"def set_field\n @user = User.find(params[:id])\n end",
"def user_column\n IdMethods::USER_COLUMN\n end",
"def user_id\n self.user.id unless user.nil?\n end",
"def user\n User.find_by(id: self.object.user_id)\n end",
"def get_user \n\t\treturn User.find(self.user_id)\n\tend",
"def user_id\n self.person.user.id if self.person\n end",
"def user_id\n self.person.user.id if self.person\n end",
"def user_id\n self.person.user.id if self.person\n end",
"def set_user\n @user = User.select('first_name, last_name, email, username, id').find(params[:id])\n end",
"def set_user_field\n @user_field = UserField.find(params[:id])\n end",
"def set_user_field\n @user_field = UserField.find(params[:id])\n end",
"def user\n UserRepository.find(user_id)\n end",
"def user=(user)\n self.update_attributes(:user_id => user.id)\n end",
"def user\n user_id.get_object\n end",
"def set_user_id\n self.user_id = User.current_user.id\n end",
"def set_user_user\n @user_user = User::User.find(params[:id])\n end",
"def set_user_attribute\n @user_attribute = UserAttribute.find(params[:id])\n end",
"def set_user\n @user = User.find(params[:id]).decorate\n\n end",
"def user\n # 自インスタンスのuser_idの値に紐付くuserインスタンスを戻り値として返す\n return User.find(self.user_id)\n end",
"def set_user\n # @user = User.find(params[:id])\n @user = User.find_by_sql(['SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" = ? LIMIT 1', params[:id]])[0]\n end",
"def user_id\n return @user_id\n end",
"def user_id\n return @user_id\n end",
"def user_id\n return @user_id\n end",
"def user_id\n return @user_id\n end",
"def user_id\n return @user_id\n end",
"def user_id\n return @user_id\n end",
"def set_user\n @user = User.select(\"*\").where(userId: params[:id])\n end",
"def set_user\n @field = Field.find(params[:id])\n end",
"def set_user; end",
"def user_id=(id)\n @@user_id= id\n end",
"def user; User.find_by_id(user_id); end",
"def user\n User.get user_id || User.new\n end",
"def set_user\n @user = user.find(params[:id])\n end",
"def user_key=(key)\n @user_key = key\n self.user ||= ::User.find_by(user_key: key)\n user&.user_key = key\n end",
"def set_user\n user = User.find(params[:id])\n end",
"def set_user\n user = User.find(params[:id])\n end",
"def set_user\n user = User.find(params[:id])\n end",
"def change_user\n if self.id.present?\n self.user_id = Comment.find(self.id).user_id\n end\n\n end",
"def set_user\n @user = User.find(params[:id]) #:id\n end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end",
"def created_by; User.get(self.created_by_id); end"
] |
[
"0.72426915",
"0.69237536",
"0.6887277",
"0.6855067",
"0.6830635",
"0.6801619",
"0.6801619",
"0.6801619",
"0.6801619",
"0.6801619",
"0.6801619",
"0.6801619",
"0.6801619",
"0.6801619",
"0.6801619",
"0.6743075",
"0.6726641",
"0.6701809",
"0.6619238",
"0.6619238",
"0.6619238",
"0.6619238",
"0.6619238",
"0.6619238",
"0.6589363",
"0.65692127",
"0.656405",
"0.6561126",
"0.65357685",
"0.6484611",
"0.6483731",
"0.6481214",
"0.6481214",
"0.6481214",
"0.64737254",
"0.6448544",
"0.6448544",
"0.64436823",
"0.6426794",
"0.64163405",
"0.6411313",
"0.6408926",
"0.6408002",
"0.6396236",
"0.6379554",
"0.6378182",
"0.63688314",
"0.63688314",
"0.63688314",
"0.63688314",
"0.63688314",
"0.63688314",
"0.63477767",
"0.63475776",
"0.6345851",
"0.63377196",
"0.6336344",
"0.633113",
"0.6329564",
"0.63181937",
"0.6305537",
"0.6305537",
"0.6305537",
"0.6299732",
"0.6293502",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625",
"0.62921625"
] |
0.0
|
-1
|
Returns the intervals precision. Mixed precisions are currently not supported; in that case, the start date's precision takes precedence.
|
def precision
min.precision || max.precision
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def precision\n self['precision']\n end",
"def precision\n @precision = self.class::MAX_PRECISION unless @precision\n return @precision\n end",
"def precision\n @precision ||= cells.map(&:to_f).map { |n| n.round(3) }.map { |n| n.to_s.split(\".\").last.gsub(/0+$/, \"\").length }.max\n end",
"def conversion_precision; end",
"def precision\n @values.fetch(:tp) / Float(@values.fetch(:tp) + @values.fetch(:fp))\n end",
"def precision; end",
"def precision(f)\n return (f * GeoRecord::SCALE).round.to_f / GeoRecord::SCALE\n end",
"def field_precision(key)\n IBM_DB.field_precision(@stmt, key)\n end",
"def precision_axis\n precision_axis_and_area.precision_axis\n end",
"def precision=(val)\n self['precision'] = val\n end",
"def round_prec(digits)\n #This is a stub, used for indexing\n end",
"def precision_at_fraction_recall val\n @p.each_index do |i|\n return actual_precision(i) if tpr(i) < val\n end\n 0.0\n end",
"def extract_precision(sql_type)\n if sql_type == 'money'\n self.class.money_precision\n else\n super\n end\n end",
"def prec_i() end",
"def approx_1(precision)\n if precision < 1 && precision.positive?\n k = 2\n values_r = []\n values_f = []\n loop do\n curr_value = Rational(k - 1, faculty(k))\n values_r << curr_value\n values_f << curr_value.to_f\n break if (1 - sum(values_r)) <= precision\n\n k += 1\n end\n return { 'values_f' => values_f,\n 'values_r' => values_r,\n 'sum_f' => sum(values_f).to_f,\n 'sum_r' => sum(values_r),\n 'index' => k - 2 }\n end\n nil\n end",
"def precision_axis_and_area\n prec = Array.new(@p.size)\n area = 0.0\n i = @p.size - 1\n max = prec[i] = actual_precision(i); i -= 1\n\n while i >= 0\n max = prec[i] = [max, actual_precision(i)].max\n area += ( tpr(i+1).to_f - tpr(i).to_f ) * max\n\n i -= 1\n end\n prec[0] = 1.0\n\n OpenStruct.new({:precision_axis => prec, :area => area})\n end",
"def extract_precision(sql_type)\n if sql_type == 'money'\n self.class.money_precision\n else\n super\n end\n end",
"def decimal_places\n return @decimal_places\n end",
"def extract_precision(sql_type)\n if sql_type == 'money'\n self.class.money_precision\n elsif sql_type =~ /timestamp/i\n $1.to_i if sql_type =~ /\\((\\d+)\\)/\n else\n super\n end\n end",
"def ar_precision\n precision || 6\n end",
"def ar_precision\n precision || 6\n end",
"def prec(*) end",
"def to_precision(num)\n self.class.new(a, b, c, precision: num)\n end",
"def set_precision(precision)\n @precision = precision\n end",
"def round(precision = 0)\n return 0 if @numerator == 0\n return @numerator if @denominator == 1\n\n adj = (10 ** precision.abs).to_i\n adj = Rational(1, adj) if precision < 0\n\n value = self * adj\n\n value = if self > 0\n (value + Rational(1,2)).floor\n else\n (value - Rational(1,2)).ceil\n end\n\n result = Rational(value, adj)\n\n return result.numerator if result.denominator == 1\n result\n end",
"def conversion_precision=(_arg0); end",
"def round_to_precision(iPrecisionX, iPrecisionY)\n case @Function[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n @Function[:Points] = @Function[:Points].map do |iPoint|\n next [ (Rational((iPoint[0]*iPrecisionX).round, 1))/iPrecisionX, (Rational((iPoint[1]*iPrecisionY).round, 1))/iPrecisionY ]\n end\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n optimize\n end",
"def precision(currency)\n (Mint::Currency.precisions || {}).fetch(to_key(currency), 2)\n end",
"def actual_precision(i)\n return 1 if @p[i] == 0 # Prevents ZeroDivisionError.\n begin\n [ @tp[i].quo(@p[i]), 1 ].min\n rescue ZeroDivisionError => e\n STDERR.puts \"TP axis: #{tp_axis.inspect}\"\n STDERR.puts \"P axis: #{p_axis.inspect}\"\n STDERR.puts \"TN axis: #{tn_axis.inspect}\"\n STDERR.puts \"N axis: #{n_axis.inspect}\"\n raise ZeroDivisionError, \"i=#{i}, p[i]=#{@p[i]}, tp[i]=#{@tp[i]}, tn[i]=#{@tn[i]}\"\n end\n end",
"def prec_f() end",
"def decimal_places; end",
"def prec\r\n has_prec? ? parms[1].to_i : 0\r\n end",
"def display_in_time_periods(num,options={})\n format = options[:format] || '%.1f'\n precision = options[:precision]\n raise \"precision must be an integer\" if precision && precision.to_i != precision\n\n period = options[:period]\n case period\n when :seconds,:minutes,:hours,:days,:weeks,:months,:years \n t_unit = period.to_s.chomp('s')\n format_period(format % (num / TIME_IN_SECONDS[t_unit.to_sym] ), t_unit,options[:short])\n else\n text = []\n accounted = 0\n first = nil\n # makes the math eaiser ....\n precision -= 1 if precision\n [:year,:month,:week,:day,:hour,:minute,:second].each_with_index { |unit,i| \n p = TIME_IN_SECONDS[unit]\n n = (num - accounted)/ p \n if n > 1\n accounted += (n.floor)*p\n if precision\n first ||= i\n if i - first < precision\n n = n.floor.to_s\n elsif i - first == precision\n n = format % n\n else\n break\n end\n else\n n = n.floor\n end\n text << format_period(n, unit,options[:short])\n end\n }\n text*' '\n end \n end",
"def round_to(precision=0)\n mulitplier = 10.0 ** (precision)\n (((((self)*mulitplier).round).to_f)/mulitplier)\n end",
"def precision_timestamp\n Time.now.strftime(\"%Y%m%d%H%M%S%L\")\n end",
"def format(precision) # :nodoc:\r\n (precision == nil || precision == 0) ? \"%s\" : \"%.#{precision}f\"\r\n end",
"def precision_for amount, currency\n defined_minor_precision = definitions[currency][:minor_unit]\n match = amount.to_s.match(/^-?(\\d*)\\.?(\\d*)e?(-?\\d+)?$/).to_a[1..3]\n given_major_precision, given_minor_precision = precision_from_match *match\n\n given_major_precision + [defined_minor_precision, given_minor_precision].max\n end",
"def get_precision(*params); raise('Stub or mock required.') end",
"def mixed_precision?\n min.precision != max.precision\n end",
"def supports_datetime_with_precision?\n false\n end",
"def supports_datetime_with_precision?\n false\n end",
"def get_precision\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/precision'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n _response.raw_body.to_f\n end",
"def deviation_start_in_days\n (real_start_date - planned_start_date).to_i.abs if real_start_date\n end",
"def to_d\n BigDecimal(cents.to_s) / 10 ** precision\n end",
"def round(precision = nil)\n\t\tif precision\n\t\t\tmagnitude = 10.0 ** precision\n\t\t\t(self * magnitude).round / magnitude\n\t\telse\n\t\t\tprecisionless_round\n\t\tend\n\tend",
"def precision_from_match major, minor, rational=nil\n if rational\n leftover_minor_precision = minor.eql?('0') ? 0 : minor.size\n rational_precision = rational.delete('-').to_i\n [major.size, leftover_minor_precision.send(rational.start_with?('-') ? :+ : :-, rational_precision)]\n else\n [major, minor].map(&:size)\n end\n end",
"def round(precision = nil)\n if precision\n magnitude = 10.0 ** precision\n (self * magnitude).round / magnitude\n else\n super()\n end\n end",
"def get_precision\n # the base uri for api requests\n _query_builder = Configuration.base_uri.dup\n\n # prepare query string for API call\n _query_builder << '/response/precision'\n\n # validate and preprocess url\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'user-agent' => 'Stamplay SDK'\n }\n\n # Create the HttpRequest object for the call\n _http_request = @http_client.get _query_url, headers: _headers\n \n # Call the on_before_request callback\n @http_call_back.on_before_request(_http_request) if @http_call_back\n\n # Invoke the API call and get the response\n _response = @http_client.execute_as_string(_http_request)\n\n # Call the on_after_response callback\n @http_call_back.on_after_response(_response) if @http_call_back\n\n # Endpoint error handling using HTTP status codes.\n if _response.status_code == 404\n return nil\n end\n\n # Global error handling using HTTP status codes.\n validate_response(_response)\n\n # Return appropriate response type\n return _response.raw_body.to_f\n end",
"def prize\n return nil if self.performance.category.kimu?\n\n # Try to match points to a prize range for the contest round\n JUMU_PRIZE_POINT_RANGES[self.performance.contest.round - 1].each do |prize, point_range|\n if point_range.include?(self.points)\n return prize\n end\n end\n # Points not found in any prize range\n return nil\n end",
"def get_precision_of(num)\n str_num = num.to_s\n str_num.include?('.') ? str_num.length - str_num.index('.') - 1 : 0\nend",
"def precision= (f)\n\n raise 'precision must be 0.0 < p <= 1.0' \\\n if f <= 0.0 or f > 1.0\n\n @precision = f\n end",
"def interval_in_cents(other_note=nil)\n (1200*Math.log2(Rational(1.0, interval(other_note)))).abs\n end",
"def min_amount_by_precision\n 0.1.to_d**amount_precision\n end",
"def min_amount_by_precision\n 0.1.to_d**amount_precision\n end",
"def supported_payment_intervals\n HashWithIndifferentAccess.new(\n weekly: 1,\n fortnightly: 2,\n monthly: 3,\n quarterly: 4,\n halfyearly: 5,\n annually: 6\n )\n end",
"def compute_latitude_precision\n if code_length <= 10\n return 20**(code_length/-2.0 + 2).floor\n end\n\n (20**-3).to_f/GRID_ROWS**(code_length - 10)\n end",
"def decimal_places=(value)\n @decimal_places = value\n end",
"def precio\n\t\t@precio\n\tend",
"def calc_interval(number_events)\n\tprng = 60.00/number_events # temporal solution, IMPROVE\n\n\treturn (interval)\nend",
"def fractional\n value = to_d * currency.subunit_to_unit\n if self.class.infinite_precision\n value\n else\n value.round(0, self.class.rounding_mode).to_i\n end\n end",
"def coarse_precision(date_year, interval)\n\n date_year = date_year.to_i\n interval = interval.to_i\n\n year_diff = date_year - ::Date.today.year\n return \"Within the last #{number_with_delimiter(interval)} years\" if (-(interval - 1)..0).include? year_diff\n return \"Within the next #{number_with_delimiter(interval)} years\" if (1..(interval - 1)).include? year_diff\n\n rounded = (year_diff.to_f / interval.to_f).round * interval\n return \"in #{number_with_delimiter(rounded.abs)} years\" if rounded > 0\n return \"#{number_with_delimiter(rounded.abs)} years ago\" if rounded < 0\n\n nil\n end",
"def decimal_places\n self.class.decimal_places_cache[subunit_to_unit]\n end",
"def prec_str\r\n has_prec? ? parms[1] : \"\"\r\n end",
"def decimal\n @decimal ||= implied_probability.decimal\n end",
"def decimal\n @decimal ||= implied_probability.decimal\n end",
"def decimals; num_dec; end",
"def golden_ratio(precision)\n x = fib(99)/fib(98).to_f\n x.round(precision)\n end",
"def round!(prec)\n bounds = [@min, @max].map { |bound| bound.round(prec) }\n initialize(*bounds)\n return self\n end",
"def span\n ((end_date - start_date)*Numeric::DAYS).to_f\n end",
"def decimal_limit; end",
"def length\n difference = (self.end_time.to_datetime - self.begin_time.to_datetime).to_f\n if difference.approx( HALF_DAY, 0.01)\n 0.5\n elsif difference.approx( WHOLE_DAY, 0.01)\n 1.0\n else\n included_dates.reject {|d| black_out?(d)}.length.to_f\n end\n end",
"def decimal_places\n if subunit_to_unit == 1\n 0\n elsif subunit_to_unit % 10 == 0\n Math.log10(subunit_to_unit).to_s.to_i\n else\n Math.log10(subunit_to_unit).to_s.to_i+1\n end\n end",
"def get_occurrences(start_date, interval, end_date)\n\n start_date = Date.new(start_date.year,start_date.month,start_date.mday)\n end_date = Date.new(end_date.year,end_date.month,end_date.mday)\n raise ArgumentError, \"Start date (#{start_date}) should be less than or equal to end date (#{end_date})\" if (start_date>end_date)\n\n i_length, i_unit = parse_interval(interval)\n\n if i_length == 0.5 && ![:m, :y].include?(i_unit)\n raise ArgumentError, \"Semi- interval is not supported to this units (#{i_unit.to_s})\"\n end\n\n new_interval = case i_unit\n when :d then {:length=>i_length, :unit=>:days}\n when :w then {:length=>i_length*7, :unit=>:days}\n when :m then {:length=>i_length, :unit=>:months}\n when :y then {:length=>i_length*12, :unit=>:months}\n end\n\n if new_interval[:unit] == :days\n new_occurrences = 1 + ((end_date - start_date)/new_interval[:length]).to_i\n elsif new_interval[:unit] == :months\n new_occurrences = 1 + (months_between(end_date, start_date)/new_interval[:length]).to_i \n end\n return new_occurrences\n end",
"def review_interval\n @sbProject.reviewInterval\n end",
"def confidence_interval\n return @confidence_interval if @confidence_interval\n @confidence_interval = []\n @confidence_interval << @mean - (1.96 * Math.sqrt(@stddev) / Math.sqrt(@t))\n @confidence_interval << @mean + (1.96 * Math.sqrt(@stddev) / Math.sqrt(@t))\n end",
"def round(n, precision)\n factor = 10**precision.to_i\n (n * factor).round.to_f / factor\n end",
"def get_mpset_prec( mpset1, mpset2 )\n stat = Hash.new(0)\n result = mpset_calc( mpset1, mpset2 ){|mp1,mp2|\n stat[mp1.max_pair[0]] += 1\n ((mp1.max_pair[0] == mp2.max_pair[0])? 1 : 0 ).to_f}\n p stat\n result\n end",
"def test_ranked_precision\n \n add_test_judgements\n add_ranked_query_result\n expected_precision = [\n 1,\n 1,\n 0.6666666666666666,\n 0.75,\n 0.6,\n 0.6666666666666666,\n 0.5714285714285714,\n 0.5,\n 0.4444444444444444,\n 0.4\n ]\n @query_result.statistics.each_with_index do |rank, index|\n assert_equal(expected_precision[index], rank[:precision])\n end\n \n end",
"def pm_ratio_value\n return 1 if end_date.nil?\n num_days = (end_date - start_date).to_i + 1\n num_days == 3 ? 0 : num_days\n end",
"def valid_intervals\n VALID[:interval]\n end",
"def test_formatting_time_according_to_precision_coerced\n skip unless @connection # Avoids arunit2 suite run errors.\n @connection.create_table(:foos, force: true) do |t|\n t.time :start, precision: 0\n t.time :finish, precision: 4\n end\n time = ::Time.utc(2000, 1, 1, 12, 30, 0, 999999)\n Foo.create!(start: time, finish: time)\n assert foo = Foo.find_by(start: time)\n assert_equal 1, Foo.where(finish: time).count\n assert_equal time.to_s, foo.start.to_s\n assert_equal time.to_s, foo.finish.to_s\n assert_equal 000000, foo.start.usec\n assert_equal 999000, foo.finish.usec\n end",
"def round(number, precision)\n ((number * 10**precision).round.to_f) / (10**precision)\n end",
"def __list_unary_round__(precision)\n if self.complex_dtype?\n self.__list_map_stored__(nil) { |l| Complex(l.real.round(precision), l.imag.round(precision)) }\n .cast(stype, dtype)\n else\n self.__list_map_stored__(nil) { |l| l.round(precision) }.cast(stype, dtype)\n end\n end",
"def pro_rated_days\n _date_begin = pro_rata_start_date\n _date_end = subscription_start_date\n if _date_begin.blank? || _date_end.blank?\n 0\n else\n ((_date_end - _date_begin) / 1.day).round(0).to_i # n days\n end\n end",
"def cover?(other)\n return false unless other.respond_to?(:day_precision)\n other = other.day_precision\n min.day_precision! <= other && other <= max.day_precision!\n end",
"def intervals\n parts = {}\n [:minute, :hour, :day, :month, :day_of_week].each do |granularity|\n if times = times_for(granularity)\n parts[granularity] = times\n end\n end\n\n merged_product parts\n # interval_list.concat times.map {|t| {granularity => t} }\n # m = expression[:minute]\n # m.split(\",\").each do |part|\n # time, divisor = part.split(\"/\")\n # start_time, end_time = time.split \"-\"\n\n # interval_list << {:minute => start_time.to_i}\n # end\n end",
"def interval_units\n if interval.parts.is_a? Array\n interval.parts[0][0]\n else\n interval.parts.keys[0]\n end\n end",
"def prolificness\n # prolificness = num_paintings / years_experience\n paintings.size / years_experience.to_f\n end",
"def precisiontype_params\n params.require(:precisiontype).permit(:user_id, :precision_type_name, :precision_type_description, :has_range)\n end",
"def interval(other_note=nil)\n other_note ||= self.class.new(@fundamental_frequency, @factor, 0)\n # Handle the octave\n # If the frequencies are the same we're either dealing with\n # the same note or the note in a different octave. Either way \n # let's just deal with the raw frequencies, not the octave adjusted\n # factors. If they're the same, it'll just be 1, so no harm,\n # no foul. If they're different, this should give us the proper\n # interval.\n Rational(other_note.octave_adjusted_factor, self.octave_adjusted_factor)\n end",
"def get_precision_in_exception\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/error/precisionInException'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 444\r\n raise ExceptionWithPrecisionException.new(\r\n 'precision in Exception',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def actual_periods(length)\n from = Date.today\n to = from + length\n periods.select do |p|\n from < p.end_date && p.start_date <= to\n end\n end",
"def starting_interval_size\n (10 ** ((@max - @min) / @maximum_intervals).order_of_magnitude)\n end",
"def res_ptn(kcal)\n (tee(kcal) * 0.15).round(2)\n end",
"def fppr(num_target, num_decoy, pi_not=1.0)\n 1.0 - precision(num_target, num_decoy, pi_not=1.0)\n end",
"def set_boundaries\n return \"Calculated interval for week from input:\" \\\n \" #{@values[:start_time]} - #{@values[:end_time]}\"\n end",
"def initialize(options = {})\n @precision = options[:precision] || :none\n @separator = options[:separator] || '.'\n @delimiter = options[:delimiter] || ','\n @precision_limit = options[:precision_limit] || 4\n end",
"def fractional\n self\n end",
"def precision category,a\n x=getValue category\n y=getValue category\n return a[x][y]/colsum(a,y).to_f\nend",
"def precision_as_optional(precision,\n precision1: nil)\n # Validate required parameters.\n validate_parameters(\n 'precision' => precision\n )\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/query/precisionAsOptional'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'precision' => precision,\n 'precision1' => precision1\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n ServerResponse.from_hash(decoded)\n end"
] |
[
"0.6552927",
"0.64642155",
"0.6390553",
"0.62247926",
"0.61783713",
"0.6112884",
"0.6036813",
"0.60146314",
"0.6004275",
"0.5877995",
"0.58046436",
"0.57315046",
"0.57246745",
"0.5688037",
"0.5683462",
"0.5671486",
"0.562912",
"0.55948746",
"0.55886495",
"0.5549376",
"0.5549376",
"0.5544967",
"0.5492072",
"0.5483656",
"0.5419573",
"0.5375419",
"0.53218126",
"0.53071207",
"0.5300853",
"0.5295738",
"0.52758944",
"0.5263287",
"0.5248209",
"0.52476764",
"0.5233712",
"0.5200664",
"0.5196394",
"0.51922005",
"0.51716864",
"0.5164266",
"0.5164266",
"0.51100534",
"0.5020028",
"0.5006686",
"0.49857214",
"0.49543437",
"0.49353787",
"0.49345496",
"0.48879147",
"0.48794734",
"0.48604986",
"0.48458555",
"0.4845786",
"0.4845786",
"0.4838484",
"0.48369446",
"0.48002705",
"0.47754607",
"0.47729003",
"0.47621015",
"0.47587374",
"0.47284526",
"0.4681017",
"0.4665245",
"0.4665245",
"0.4638849",
"0.463834",
"0.46364105",
"0.46304107",
"0.46225515",
"0.46188262",
"0.4607172",
"0.46034953",
"0.46026358",
"0.4590693",
"0.45854184",
"0.45745036",
"0.45516932",
"0.4548973",
"0.4536346",
"0.4529565",
"0.45060018",
"0.44934815",
"0.4492361",
"0.4482209",
"0.4465607",
"0.44504163",
"0.44462016",
"0.44449547",
"0.44444627",
"0.44359788",
"0.4423229",
"0.44108537",
"0.44102767",
"0.4404084",
"0.44014287",
"0.43973947",
"0.43923193",
"0.43892983",
"0.43850005"
] |
0.6828826
|
0
|
Returns true if the precisions of start and end date are not the same.
|
def mixed_precision?
min.precision != max.precision
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def valid_start_and_end_dates?\n return false unless start.present? && self.end.present?\n start <= self.end\n end",
"def cover?(other)\n return false unless other.is_a?(Date)\n\n other = other.day_precision\n\n case\n when unknown_start?\n max.day_precision! == other\n when unknown_end?\n min.day_precision! == other\n when open_end?\n min.day_precision! <= other\n else\n min.day_precision! <= other && other <= max.day_precision!\n end\n end",
"def dates_not_same\n if start_date == end_date\n errors.add(:start_date, 'start date can not equal end date')\n errors.add(:end_date, 'end date can not equal start date')\n end\n end",
"def correct?\n starts_at < ends_at && starts_at.to_date == ends_at.to_date\n end",
"def cover?(other)\n return false unless other.respond_to?(:day_precision)\n other = other.day_precision\n min.day_precision! <= other && other <= max.day_precision!\n end",
"def valid_end_date\n self.end_date - self.start_date > 0 ? true : false\n end",
"def check_dates\n if start_end_dates.count > 0 && !start_end_dates.nil?\n start_end_dates.each do |d|\n return true if d.check_date_ranges\n end\n\n false\n else\n true\n end\n end",
"def overlaps?(another)\n (start_date - another.end_date) * (another.start_date - end_date) >= 0\n end",
"def overlaps?(other)\n \t((start_date - other.end_date) * (other.start_date - end_date)) >= 0\n \tend",
"def one_day?\n @start_date == @end_date\n end",
"def date_range_overlap?(start_date_one, end_date_one, start_date_two, end_date_two)\n if start_date_one < end_date_two && start_date_two < end_date_one\n return true\n else\n return false\n end\n end",
"def same_day?\n start_date == end_date\n end",
"def conflicts_with_date?(date)\n date.between(self.start_date, self.end_date)\n end",
"def overlap?(new_start_date, new_end_date)\n return(start_date <= new_end_date && end_date >= new_start_date) \n end",
"def same_date\n return unless start_at? && end_at?\n return unless start_at.to_date != end_at.to_date\n\n errors.add(:start_at, :same_date)\n errors.add(:end_at, :same_date)\n end",
"def date_overlap?(date_range)\n #(@checkin_date - end_date) * (start_date - @checkout_date) >= 0\n # Will this method work?\n start_date = date_range.checkin_date\n end_date = date_range.checkout_date\n\n if (start_date <= @checkout_date) && (end_date > @checkin_date)\n return true\n else\n return false\n # raise ArgumentError.new(\"#{start_date} and #{end_date} are outside the date range\")\n end\n end",
"def operational?\n if start_date.blank?\n true\n else\n if end_date.blank? or end_date < start_date\n false\n else\n today = Date.today\n (start_date <= today and end_date >= today)\n end\n end\n end",
"def date_start_before_end?(start_date, end_date)\n return true if start_date.blank? || end_date.blank?\n return true unless date_parsable?(end_date) && date_parsable?(start_date)\n\n Date.parse(end_date) >= Date.parse(start_date)\n end",
"def date_consistency\n\t\treturn if [start_date.blank?, end_date.blank?].any?\n\t\terrors.add(:end_date, 'must be after start_date') if start_date > end_date\n\tend",
"def dates_valid?\n date_check(params[:start_date]) && date_check(params[:end_date]) && dates_sequential?\n end",
"def date_consistency\n\t\treturn if [start_time.blank?, end_time.blank?].any?\n\t\terrors.add(:start_time, 'must be after end_time') if start_time > end_time\n\tend",
"def date_consistency\n\t\treturn if [start_time.blank?, end_time.blank?].any?\n\t\terrors.add(:start_time, 'must be after end_time') if start_time > end_time\n\tend",
"def overlaps?(other)\n\t\tself.start_date < other.end_date && other.start_date < self.end_date\n\tend",
"def overlaps?(other)\n start <= other.end_date && other.start <= self.end_date\n end",
"def virtually_over?\n end_date < Date.today\n end",
"def is_date_range?\n start_time.present? && end_time.present?\n end",
"def check_date_ranges\n today = Date.today\n !!today.between?(start_date.to_date, end_date.to_date)\n end",
"def correct_dates?(object)\n object.date_from <= object.date_to\n end",
"def cover?(other_period)\n inside?(other_period.starts_at) || inside?(other_period.ends_at)\n end",
"def dates_within_conference_dates\n return unless start_date && end_date && program.try(:conference).try(:start_date) && program.try(:conference).try(:end_date)\n\n errors.add(:start_date, \"can't be outside of the conference's dates (#{program.conference.start_date}-#{program.conference.end_date})\") unless (program.conference.start_date..program.conference.end_date).cover?(start_date)\n errors.add(:end_date, \"can't be outside of the conference's dates (#{program.conference.start_date}-#{program.conference.end_date})\") unless (program.conference.start_date..program.conference.end_date).cover?(end_date)\n end",
"def start_and_end_set?\n [start, self.end].map(&:present?).uniq.length == 1\n end",
"def crossed_day_change_boundary?(start_time, end_time)\n start_time.hour < 4 && end_time.hour >= 4\n end",
"def valid_dates?\n if enddate && startdate && enddate <= startdate\n errors.add(:enddate, \"is before startdate\")\n end\n end",
"def price_range?\n !(price_range.first == price_range.last)\n end",
"def price_range?\n !(price_range.first == price_range.last)\n end",
"def validate_date?(start_date,end_date)\n\t\tstart_date <= end_date\n\tend",
"def ==(other)\n other.class == self.class &&\n other.start_date == @start_date &&\n other.end_date == @end_date\n end",
"def between_dates(sd, es)\n return true if sd <= self.start_date && es >= self.end_date \n return false\n end",
"def date_range_valid?(start_date, end_date)\n\tif start_date > end_date\n\t\tputs \"Start date must be before end date\"\n\t\treturn false\n\telsif start_date + MAX_DAYS < end_date\n\t\tputs \"\\n No more than #{MAX_DAYS}. Be nice to the remote server.\"\n\t\treturn false\n\tend\n\treturn true\nend",
"def check_dates\n # TODO the init_time must be less then the end_time\n true\n end",
"def end_date_is_bigger?\n return if [endDate.blank?, startDate.blank?].any?\n\n errors.add(:base, 'The end time must be later than the start time') if endDate < startDate\n end",
"def start_date_before_end_date\n begin\n date_start = USDateParse(self.start_date)\n date_end = USDateParse(self.end_date)\n rescue\n errors.add(:start_date, 'Could not verify that the start date is before the end date because the start and/or end dates are not parsable.')\n return\n end\n if date_start >= date_end\n errors.add(:start_date, \"Start date must be before end date.\")\n end\n end",
"def valid_changeover?\n season = self.season\n changeover = Season.find(season).changeover\n days = self.start_date.wday + self.end_date.wday\n # date.wday returns a value (0-6), sunday is 0, saturday = 6\n # if start_date.wday + end_date.wday = 12 both days are saturday\n if (changeover == false) || (days == 12)\n return true\n else\n return false\n end\n end",
"def same_day?\r\n start_date? && event_start_date == event_end_date\r\n end",
"def overlap?(input_range)\n a = self.start_date >= input_range.end_date\n b = self.end_date <= input_range.start_date\n return a || b ? false : true \n end",
"def begin_date_cannot_be_greater_than_end_date\n if effective_end_date.present? && effective_end_date > Date.civil(1900, 1, 1) && effective_begin_date.present? && effective_begin_date > Date.civil(1900, 1, 1)\n if (effective_begin_date > effective_end_date)\n local_message = \"Begin date can't be before end date.\"\n errors[:base] << local_message\n return false\n else\n return true\n end\n else\n return true\n end\n end",
"def start_date_or_end_date_changed?\n self.previous_changes.include?(\"start_date\") || self.previous_changes.include?(\"end_date\")\n end",
"def same_day_for_datetimes?\n\t\tdays[start_datetime.wday] == days[end_datetime.wday]\n\tend",
"def date_verify\n if end_date && start_date.nil?\n errors.add(:end_date, \"cannot only specify end date\")\n elsif all_day && start_date.nil?\n errors.add(:all_day, \"cannot specify without date\")\n elsif (start_date && end_date) && (start_date > end_date)\n errors.add(:start_date, \"cannot larger than end date\")\n end\n end",
"def meeting_conflict?(other)\n return false if self.start_time.nil? or other.start_time.nil?\n section_days = other.days.split(\"\")\n section_days.each do |day|\n if( self.days.include?(day) )\n if (self.start_time.to_i >= other.start_time.to_i and self.start_time.to_i <= other.end_time.to_i) or \n (other.start_time.to_i >= self.start_time.to_i and other.start_time.to_i <= self.end_time.to_i)\n return true\n end \n end\n end\n return false\n end",
"def check_times\n if start_end_times.count > 0 && !start_end_times.nil?\n start_end_times.each do |t|\n return true if t.check_time_ranges\n end\n\n false\n else\n true\n end\n end",
"def more_than_a_day_passed?(start_time, end_time)\n end_time - start_time > 60 * 60 * 24\n end",
"def valid_end_date?\n if @end_date >= @start_date\n return true\n else\n return [false, \"Start date must be before end date\"]\n end\nend",
"def check_dates_are_valid\n if @start_date.present? && @end_date.present?\n errors.add(:end_date, \"can't be before the start date\") if @end_date < @start_date\n end\n end",
"def check_dates_are_valid\n if @start_date.present? && @end_date.present?\n errors.add(:end_date, \"can't be before the start date\") if @end_date < @start_date\n end\n end",
"def availability?(start_date, end_date)\n start_date = Date.parse(start_date)\n end_date = Date.parse(end_date)\n bookings = self.get_bookings(id: self.id)\n if bookings.length > 0\n bookings.each do |booking|\n if (start_date > booking.start_date && start_date < booking.end_date) || (end_date > booking.start_date && end_date < booking.end_date)\n false\n end\n end\n true\n end\n end",
"def right_date_scope(arr)\n return false unless arr[0].to_i.between?(2000, 2100)\n return false unless arr[1].to_i.between?(1, 12)\n return false unless arr[2].to_i.between?(1, 31)\n true\n end",
"def ==(another_date)\n return false if self.precision != another_date.precision\n self.to_datetime == another_date.to_datetime\n end",
"def reservation_dates_must_make_sense\n\t if end_date <= start_date\n\t\t errors.add(:start_date, \"has to be before the end date\")\n\t end\n\tend",
"def dates_equal?(date1, date2)\n return true if date1.blank? || date2.blank?\n return true unless date_parsable?(date1) && date_parsable?(date2)\n\n Date.parse(date1) == Date.parse(date2)\n end",
"def inconsistent?(x)\n if @date_added > @date_modified or\n x.date_added > x.date_modified\n# @date_added != x.date_added or\n# @date_modified > x.date_modified\n\n return true\n end\n false\n end",
"def current?\n validity_end_date.blank? || validity_end_date >= point_in_time\n end",
"def dates_in_order?(date1, date2)\n return true if date1.nil? or date2.nil? or date2 >= date1\n false\n end",
"def validate_dates\n if start_at && end_at\n errors.add(:end_at, 'should be greater than start date') if end_at <= start_at\n end\n end",
"def available?(span_start, span_end)\n if span_start.class != Date \n start_date = Date.parse(span_start) \n else \n start_date = span_start\n end\n if span_end.class != Date\n end_date = Date.parse(span_end)\n else\n end_date = span_end\n end\n if self.reservations.any?{ |reservation| reservation.checkout > start_date && reservation.checkout < end_date || reservation.checkin > start_date && reservation.checkout < end_date || reservation.checkin > start_date && reservation.checkin < end_date } === false\n return true\n else \n false\n end\n end",
"def end_date_is_valid?\n begin\n date = USDateParse(self.end_date)\n self.end_date = date.strftime(\"%m/%d/%y\")\n rescue\n return false\n end\n return true\n end",
"def is_target_date? ( date ) \n d = date.to_date\n check = false\n if d >= @dStart.to_date && d <= @dEnd.to_date\n check = true\n end\n return check\n end",
"def overlaps(other_date_range)\n if contains(other_date_range.start_date) || contains(other_date_range.end_date)\n true\n elsif other_date_range.contains(@start_date) && other_date_range.contains(@end_date)\n true\n else\n false\n end\n end",
"def include?(new_date)\n return start_date <= new_date && end_date > new_date\n end",
"def dates_are_correct\n errors.add(:begins, _(\"%{fn} can't be blank\")) if begins.nil?\n errors.add(:finishes, _(\"%{fn} can't be blank\")) if finishes.nil?\n\n dates_in_order?(begins, finishes) or\n errors.add(:begins, _('Conference must end after its start date'))\n\n dates_in_order?(cfp_open_date, cfp_close_date) or\n errors.add(:cfp_open_date, _('Call for papers must end after its ' +\n 'start date'))\n dates_in_order?(cfp_close_date, begins) or\n errors.add(:cfp_close_date, _('Call for papers must finish before ' +\n 'the conference begins'))\n\n dates_in_order?(reg_open_date, reg_close_date) or\n errors.add(:reg_open_date, _('Registration must end after its ' +\n 'start date'))\n dates_in_order?(reg_close_date, finishes) or\n errors.add(:reg_close_date, _('Registration must finish before the ' +\n 'conference ends'))\n end",
"def start_and_end_date_range\n unless self.start_datetime.nil? || self.end_datetime.nil?\n oldest_start_datetime = self.active_sale_events.not_blank_and_sorted_by(:start_datetime).first\n latest_end_datetime = self.active_sale_events.not_blank_and_sorted_by(:end_datetime).last\n errors.add(:start_datetime, I18n.t('spree.active_sale.event.validation.errors.invalid_root_dates')) if (oldest_start_datetime.nil? && latest_end_datetime.nil?) ? false : (self.start_datetime > oldest_start_datetime || self.end_datetime < latest_end_datetime)\n end\n end",
"def check_end_date\n # if self.category.eql?(\"appointment\")\n unless self.start_date.nil? or self.end_date.nil?\n if (self.end_date < self.start_date)\n self.category.eql?(\"appointment\")? self.errors.add(' ', 'End Date can\\'t be before Start Date') : self.errors.add(' ', 'Due Date can\\'t be before Start Date')\n end\n if self.end_date == self.start_date\n self.errors.add(' ', 'End Time can not be before start time') if (self.end_date.to_time < self.start_date.to_time)\n end\n end\n # end\n end",
"def expired?(range: :now)\n return false unless persisted?\n return false if cancelled? || archived? || complete?\n case range\n when :all\n !!(start_date <= Time.now && end_date <= Time.now)\n else\n !!(start_date <= Time.now)\n end\n end",
"def period_ended_after_start\n invalid = false\n if period_started_at.present? and period_ended_at.present? and not period_ended_at > period_started_at\n errors.add( :period_ended_at, :end_before_start )\n invalid = true\n end\n invalid\n end",
"def overlap?(interval_start, interval_end, ride)\n raise \"Invalid interval\" if interval_start>=interval_end\n if (ride.start_time > interval_end) || (ride.end_time<interval_start)\n return false \n else \n return true\n end \n\n end",
"def start_date_before_end_date\n return unless start_date && end_date\n\n errors.add(:start_date, 'can\\'t be after the end date') if start_date > end_date\n end",
"def is_target_date?(date) \n d = date.to_date\n check = false\n if d >= @dStart && d <= @dEnd\n check = true\n end\n return check\n end",
"def relevant_time?\n\t\tself.start < Time.now && self.end >Time.now \n\tend",
"def end_date_cannot_be_before_start_date\n\t\tif start_date.present? && end_date.present? && end_date < start_date\n\t\t\terrors.add(:end_date, \"cannot be before start date\")\n\t\tend\n\tend",
"def date_in_range?(first, date, last)\n first <= date && date <= last\n end",
"def date_validation\n\t\tif start_date >= end_date\n \t\terrors.add(:end_date, \"must be greater than start date\")\n \tend\n end",
"def date_within(d)\n\t\treturn (start_date <= d) && (d <= stop_date)\n\tend",
"def date_combination_valid\n\n # just make sure we work on something valid and existing\n\n return false unless date_from?\n\n set_nil_default( :date_until, date_from )\n\n if date_until < date_from\n errors.add( :date_until, I18n.t( 'holidays.msg.bad_period' ))\n return false\n end\n\n if date_from.year != date_until.year\n errors.add( :date_until, I18n.t( 'holidays.msg.bad_years' ))\n return false\n end\n\n # all tests passed\n\n write_attribute( :year_period, date_from.year )\n return true\n end",
"def different_days\n time_out.present? && time_in.to_date != time_out.to_date\n end",
"def valid_promotion_length?\n\t\tend_date = self.current_price_date + 30\n\t\tif end_date > DateTime.now\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\t\tself.current_price = self.original_price\n\t\tend \n\tend",
"def dates_in_span_valid?(date_string)\n dates_array = date_string.split(\"-\")\n start_range = dates_array[0]\n begin\n start_range = USDateParse(start_range)\n self.individual_dates_with_no_classes += [start_range]\n rescue\n errors.add(:dates_with_no_classes_day, 'Could not verify the date range because the date is not parsable.')\n return false\n end\n #also need to check if startdate is before enddate\n if dates_array.length == 2\n end_range = dates_array[1]\n begin\n end_range = USDateParse(end_range)\n if end_range < start_range\n errors.add(:dates_with_no_classes_day, 'Could not add the date range because end date is before start date.')\n return false\n end\n date = start_range\n while date < end_range\n date += 1\n self.individual_dates_with_no_classes += [date]\n end\n rescue\n errors.add(:dates_with_no_classes_day, 'Could not verify the date range because the date is not parsable.')\n return false\n end\n elsif dates_array.length > 2\n errors.add(:dates_with_no_classes_day, 'Could not verify the date range because the range is not parsable.')\n return false\n end\n return true\n end",
"def valid?\n (start_at - CLOCK_SKEW_TOLERANCE).past? && (end_at + CLOCK_SKEW_TOLERANCE).future?\n end",
"def begins_and_ends_are_valid\n errors.add(:begins, 'must be present unless this is a label entry') if (begins.nil? && product_num.downcase != 'label')\n errors.add(:ends, 'must be present unless this is a label entry') if (ends.nil? && product_num.downcase != 'label')\n errors.add(:begins, 'must be 1900-01-01 or later.') if (!begins.nil? && begins < Date.parse('1900-01-01'))\n errors.add(:ends, 'must be 1900-01-01 or later') if (!ends.nil? && ends < Date.parse('1900-01-01'))\n end",
"def start_datetime_should_be_less_than_finish_datetime\n errors.add(:start_date, \"をfinish_dateより前に入力してください\") unless start_datetime <= finish_datetime\n end",
"def check_overlapping_dates\n # compare this new reservation againsts existing reservations\n if start_date.present? and end_date.present?\n listing.reservations.each do |old_reservation|\n if overlap?(self, old_reservation)\n return errors.add(:The_dates_are_not_available, \"\")\n end\n end\n end\n end",
"def one_off?\n # TODO@cs: There are various problematic edge-cases in the system, because\n # +#one_off?+ is not 100% reliable. We have to fix this ASAP.\n count == 1 || starts_at == ends_at\n end",
"def now?\n start_date <= Time.now and end_date >= Time.now\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 validate_start_date_before_end_date\n\t\tif end_time <= start_time\n\t\t\terrors.add(:end_time, \"must be after start time\")\n\t\tend\n\tend",
"def start_time_before_end_time\n return true unless start_time && end_time\n\n errors.add(:start_time, 'must be before end time') unless start_time < end_time\n end",
"def validate_date_range(record, start_date_attr, start_date, end_date_attr)\n # retrieve end_date value\n end_date = record.send(end_date_attr)\n\n return if date_start_before_end?(start_date, end_date)\n\n record.errors.add(start_date_attr, :before_date_error)\n record.errors.add(end_date_attr, :after_date_error)\n end",
"def available_date_range?\n return false if import_date.nil? || export_date.nil?\n\n unless calculate_date_range > 0\n errors.add(:export_date, \"must be after the import_date\")\n end\n end",
"def validate_end_date\n start = Date.parse(start_date.to_s)\n last = Date.parse(end_date.to_s)\n puts \"is date #{last} before #{start}\"\n errors.add(:end_date, \"can't be before the start date\") if last < start\n end",
"def ensure_end_date_is_valid\n return true if end_date.blank?\n unless start_date.blank?\n return true if end_date > start_date\n end\n\n errors.add(:end_date, :invalid)\n end",
"def overlap(dates)\n (out_date <= dates.in_date || in_date >= dates.out_date)\n end"
] |
[
"0.72415555",
"0.72097874",
"0.7136664",
"0.68430495",
"0.68407065",
"0.6772591",
"0.6712651",
"0.66333264",
"0.65966237",
"0.6589843",
"0.6576496",
"0.6552405",
"0.6498005",
"0.6468503",
"0.64682806",
"0.6449605",
"0.64308965",
"0.64213395",
"0.6388777",
"0.6361986",
"0.63317937",
"0.63317937",
"0.63180846",
"0.6314705",
"0.62755644",
"0.6267181",
"0.623866",
"0.62183917",
"0.6203795",
"0.61635864",
"0.6161248",
"0.6156934",
"0.61567545",
"0.61453736",
"0.61453736",
"0.6143271",
"0.61361074",
"0.6112701",
"0.6110253",
"0.6101331",
"0.6094798",
"0.6090099",
"0.6058814",
"0.6054622",
"0.6031706",
"0.600553",
"0.59936273",
"0.5986866",
"0.5984146",
"0.59646374",
"0.595777",
"0.5942654",
"0.59403783",
"0.59401983",
"0.59401983",
"0.59383816",
"0.5932281",
"0.5923688",
"0.59236664",
"0.58875364",
"0.5887383",
"0.5883998",
"0.5881381",
"0.5875819",
"0.58731204",
"0.58588284",
"0.58394593",
"0.5834528",
"0.58324677",
"0.581824",
"0.58153844",
"0.58073753",
"0.5797133",
"0.57806903",
"0.5780207",
"0.5778768",
"0.5774844",
"0.5768103",
"0.5760415",
"0.57482916",
"0.5746117",
"0.57447636",
"0.57417417",
"0.57397145",
"0.57253355",
"0.57118016",
"0.5710076",
"0.5703329",
"0.56898993",
"0.568865",
"0.56871855",
"0.5686891",
"0.5682371",
"0.5677571",
"0.5675352",
"0.56714725",
"0.5666959",
"0.5663648",
"0.5660997",
"0.56471664"
] |
0.5757493
|
79
|
This method always returns false for Range compatibility. EDTF intervals always include the last date.
|
def exclude_end?
false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def valid_end_date\n self.end_date - self.start_date > 0 ? true : false\n end",
"def correct?\n starts_at < ends_at && starts_at.to_date == ends_at.to_date\n end",
"def exclude_end?\n @ranges.size == 1 ? @ranges[0].exclude_end? : nil\n end",
"def valid_start_and_end_dates?\n return false unless start.present? && self.end.present?\n start <= self.end\n end",
"def is_date_range?\n start_time.present? && end_time.present?\n end",
"def empty?\n\t interval.first == interval.last && interval.exclude_end?\n end",
"def range_finished?\n with_missing_days\n .select { |day| !day.is_day_off }\n .all? do |day|\n return false if day.is_missing\n day.is_finished\n end\n end",
"def valid?\n return false if @range_start_index.nil?\n return false if @range_end_index.nil?\n true\n end",
"def date_in_range?(first, date, last)\n first <= date && date <= last\n end",
"def end_at_later_than_start_at\n\t\t\tif self.is_active == true and self.start_at > self.end_at\n\t\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def check_dates\n if start_end_dates.count > 0 && !start_end_dates.nil?\n start_end_dates.each do |d|\n return true if d.check_date_ranges\n end\n\n false\n else\n true\n end\n end",
"def ends_before_it_begins?\n end_on? && end_on <= start_on\n end",
"def expired?(range: :now)\n return false unless persisted?\n return false if cancelled? || archived? || complete?\n case range\n when :all\n !!(start_date <= Time.now && end_date <= Time.now)\n else\n !!(start_date <= Time.now)\n end\n end",
"def virtually_over?\n end_date < Date.today\n end",
"def in_time_range?(start, ending)\n effective_trigger = effective_trigger_time\n\n if key?('DURATION')\n duration = DateTimeParser.parse_duration(self['DURATION'])\n repeat = self['REPEAT'].to_s.to_i\n repeat = 1 if repeat == 0\n\n occurrence = effective_trigger\n return true if start <= occurrence && ending > occurrence\n\n repeat.times do |_i|\n occurrence += duration\n return true if start <= occurrence && ending > occurrence\n end\n return false\n else\n start <= effective_trigger && ending > effective_trigger\n end\n end",
"def date_range_overlap?(start_date_one, end_date_one, start_date_two, end_date_two)\n if start_date_one < end_date_two && start_date_two < end_date_one\n return true\n else\n return false\n end\n end",
"def one_day?\n @start_date == @end_date\n end",
"def out_of_bounds?(date)\n date < @available_date_range[:min] || date > @available_date_range[:max]\n end",
"def valid?\n return false if !@period.nil? && @period > 2147483647\n return false if !@until_occurrences.nil? && @until_occurrences > 2147483647\n true\n end",
"def in_renewal_span?\n (0..7).include?(end_date.to_date - Time.zone.now.to_date)\n end",
"def end_date_is_valid?\n begin\n date = USDateParse(self.end_date)\n self.end_date = date.strftime(\"%m/%d/%y\")\n rescue\n return false\n end\n return true\n end",
"def reiwa?\n Date.new(2019, 5, 1) <= self\n end",
"def last_iter?(from, to)\n from.day == to.day && from.hour == to.hour\n end",
"def future?\n start_date.future?\n end",
"def conflicts_with_date?(date)\n date.between(self.start_date, self.end_date)\n end",
"def has_range?\n !self.domain_ranges.nil?\n end",
"def date_range_valid?(start_date, end_date)\n\tif start_date > end_date\n\t\tputs \"Start date must be before end date\"\n\t\treturn false\n\telsif start_date + MAX_DAYS < end_date\n\t\tputs \"\\n No more than #{MAX_DAYS}. Be nice to the remote server.\"\n\t\treturn false\n\tend\n\treturn true\nend",
"def tt_forever?\n ttend_at == InfinityValue\n end",
"def overlap?(input_range)\n a = self.start_date >= input_range.end_date\n b = self.end_date <= input_range.start_date\n return a || b ? false : true \n end",
"def current?\n end_date.nil?\n end",
"def include?(new_date)\n return start_date <= new_date && end_date > new_date\n end",
"def check_date_ranges\n today = Date.today\n !!today.between?(start_date.to_date, end_date.to_date)\n end",
"def right_date_scope(arr)\n return false unless arr[0].to_i.between?(2000, 2100)\n return false unless arr[1].to_i.between?(1, 12)\n return false unless arr[2].to_i.between?(1, 31)\n true\n end",
"def check_dates\n # TODO the init_time must be less then the end_time\n true\n end",
"def touching?(range)\n range.end == self.start || self.end == range.start\n end",
"def open_ended?\n OPEN_ENDED =~ range\n end",
"def between?(first_day, last_day)\n ((self.ends_at.to_date >= first_day) && (self.ends_at.to_date <= last_day)) || ((self.starts_at.to_date >= first_day) && (self.starts_at.to_date <= last_day))\n end",
"def valid_end_date?\n\t\tif effective_end_date.present?\n\t\t\tif effective_end_date < Date.civil(1900,1,1)\n\t\t\t\terrors.add(:effective_end_date, \"must be after 1900.\")\n return false\n else\n \t return true\n end\n\t\telse\n\t\t\t return true\n\t\tend\n\tend",
"def price_range?\n !(price_range.first == price_range.last)\n end",
"def price_range?\n !(price_range.first == price_range.last)\n end",
"def expand_service_range\n self.service_start_date ||= (service_except_dates + service_added_dates).min\n self.service_end_date ||= (service_except_dates + service_added_dates).max\n true\n end",
"def exclude_begin?\n @ranges.size == 1 ? @ranges[0].exclude_begin? : nil\n end",
"def has_ended?\n Date.current > end_date\n end",
"def interval?() triangulated? and complement.comparability?; end",
"def now?\n start_date <= Time.now and end_date >= Time.now\n end",
"def end_of_monitoring_period?\n return false if continuous_exposure\n\n monitoring_period_days = ADMIN_OPTIONS['monitoring_period_days'].days\n\n # If there is a last date of exposure - base monitoring period off of that date\n monitoring_end_date = if !last_date_of_exposure.nil?\n last_date_of_exposure.beginning_of_day + monitoring_period_days\n else\n # Otherwise, if there is no last date of exposure - base monitoring period off of creation date\n created_at.beginning_of_day + monitoring_period_days\n end\n\n # If it is the last day of or past the monitoring period\n # NOTE: beginning_of_day is used as monitoring period is based of date not the specific time\n curr_date_in_timezone.beginning_of_day >= monitoring_end_date\n end",
"def open?\n (start_date..end_date).cover?(Date.current)\n end",
"def has_future_exchange_dates\n now = Time.now.utc.to_i\n self.exchange_dates.each do |availability_date|\n if availability_date.latest_date.to_i > now\n return true\n end\n end\n return false\n end",
"def meeting_conflict?(other)\n return false if self.start_time.nil? or other.start_time.nil?\n section_days = other.days.split(\"\")\n section_days.each do |day|\n if( self.days.include?(day) )\n if (self.start_time.to_i >= other.start_time.to_i and self.start_time.to_i <= other.end_time.to_i) or \n (other.start_time.to_i >= self.start_time.to_i and other.start_time.to_i <= self.end_time.to_i)\n return true\n end \n end\n end\n return false\n end",
"def crossed_day_change_boundary?(start_time, end_time)\n start_time.hour < 4 && end_time.hour >= 4\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 include_range? other_range\n case other_range\n when Range\n if other_range.first >= self.first && other_range.last <= self.last\n return true\n else\n return false\n end\n else\n raise \"unsupported type\"\n end\n end",
"def operational?\n if start_date.blank?\n true\n else\n if end_date.blank? or end_date < start_date\n false\n else\n today = Date.today\n (start_date <= today and end_date >= today)\n end\n end\n end",
"def end_date_is_bigger?\n return if [endDate.blank?, startDate.blank?].any?\n\n errors.add(:base, 'The end time must be later than the start time') if endDate < startDate\n end",
"def is_closed_at?(evaluation_date = Date.today)\n get_end_date < evaluation_date\n end",
"def in_time_window?\n self.starts_at <= Time.now && self.ends_at >= Time.now\n end",
"def current?\n validity_end_date.blank? || validity_end_date >= point_in_time\n end",
"def cover?(other)\n return false unless other.is_a?(Date)\n\n other = other.day_precision\n\n case\n when unknown_start?\n max.day_precision! == other\n when unknown_end?\n min.day_precision! == other\n when open_end?\n min.day_precision! <= other\n else\n min.day_precision! <= other && other <= max.day_precision!\n end\n end",
"def on_grace_period\n !!(ends_at && ends_at.future?)\n end",
"def past?\n end_on.past?\n end",
"def is_target_date? ( date ) \n d = date.to_date\n check = false\n if d >= @dStart.to_date && d <= @dEnd.to_date\n check = true\n end\n return check\n end",
"def test_Range_InstanceMethods_exclude_end?\n\t\t# TODO, need add some testcases.\n\tend",
"def past?\n (end_date < Date.today)\n end",
"def check_times\n if start_end_times.count > 0 && !start_end_times.nil?\n start_end_times.each do |t|\n return true if t.check_time_ranges\n end\n\n false\n else\n true\n end\n end",
"def exclude_end?\n @exclude_end\n end",
"def empty?\n if exclude_end?\n self.end <= self.begin\n else\n self.end < self.begin\n end\n end",
"def past_all_due_dates?\n # If no section due dates /!\\ do not check empty? it could be wrong\n return false if !due_date.nil? && Time.current < due_date\n return false if section_due_dates.any? { |sec| !sec.due_date.nil? && Time.current < sec.due_date }\n\n true\n end",
"def is_target_date?(date) \n d = date.to_date\n check = false\n if d >= @dStart && d <= @dEnd\n check = true\n end\n return check\n end",
"def current?\n (start_date..end_date).cover?(Date.today)\n end",
"def vt_forever?\n vtend_at == InfinityValue\n end",
"def is_a_3_dot_range?(range)\n\trange.exclude_end?\nend",
"def between_dates(sd, es)\n return true if sd <= self.start_date && es >= self.end_date \n return false\n end",
"def available_date_range?\n return false if import_date.nil? || export_date.nil?\n\n unless calculate_date_range > 0\n errors.add(:export_date, \"must be after the import_date\")\n end\n end",
"def available?(date_range)\n if reservations.length == 0\n return true\n end\n if reservations.any? {|r| r.overlap?(date_range)}\n return false\n else\n return true\n end\n end",
"def finished\n if self.end_date < Date.today\n return true\n else\n return false\n end\nend",
"def in_range?(point)\n #point = TimeCode.new(point)\n if point < @place.milliseconds\n return false\n elsif point > (@place.milliseconds + @end_point.milliseconds)\n return false\n else \n return true\n end\n end",
"def enforce_future_date_for_lease?\n false\n end",
"def active?\n starts_at < Time.now && Time.now < ends_at\n end",
"def same_day?\n start_date == end_date\n end",
"def arbejdsdag?\n !weekend? && !helligdag?\n end",
"def overlaps?(other)\n\t\tself.start_date < other.end_date && other.start_date < self.end_date\n\tend",
"def overlap?(new_start_date, new_end_date)\n return(start_date <= new_end_date && end_date >= new_start_date) \n end",
"def start_and_end_set?\n [start, self.end].map(&:present?).uniq.length == 1\n end",
"def correct_dates?(object)\n object.date_from <= object.date_to\n end",
"def exclude_end?() end",
"def within_time_period?\n return true unless start_time || end_time\n\n if start_time && end_time\n (start_time..end_time).cover? Time.current\n elsif start_time\n Time.current >= start_time\n elsif end_time\n Time.current <= end_time\n end\n end",
"def within_deadline?\n deadline = init_deadline Time.now.getlocal(\"+08:00\")\n self < deadline && self >= (deadline - SECONDS_DAY)\n end",
"def ended?\n return(self.ends_at < Time.now)\n end",
"def overlaps?(other)\n start <= other.end_date && other.start <= self.end_date\n end",
"def overlaps?(another)\n (start_date - another.end_date) * (another.start_date - end_date) >= 0\n end",
"def override_all_day_based_on_duration\n starts_on = starts_at.to_date\n ends_on = ends_at.to_date\n if starts_on != ends_on\n self.all_day = true\n end\n true\n end",
"def is_season_ended_at(evaluation_date = Date.today)\n if end_date\n end_date <= evaluation_date\n else\n false\n end\n end",
"def passed?\n (self.ends_at < Time.zone.now) && !((self.ends_at.to_date.eql?(Time.zone.now.to_date)) && self.ends_at.strftime('%H%M').eql?(\"0000\"))\n end",
"def is_end?(cell)\n @end_cell.eql?(cell)\n end",
"def has_valid_date?\n self.time_event < Time.now.advance(days: 1)\n end",
"def weekend?\n [0, 6].include?(date.wday)\n end",
"def match?(freetime)\n freetime.start.between?(self.start, self.end) || freetime.end.between?(self.start, self.end)\n end",
"def date_overlap?(date_range)\n #(@checkin_date - end_date) * (start_date - @checkout_date) >= 0\n # Will this method work?\n start_date = date_range.checkin_date\n end_date = date_range.checkout_date\n\n if (start_date <= @checkout_date) && (end_date > @checkin_date)\n return true\n else\n return false\n # raise ArgumentError.new(\"#{start_date} and #{end_date} are outside the date range\")\n end\n end",
"def include?(tod)\n second = tod.to_i\n second += TimeOfDay::NUM_SECONDS_IN_DAY if second < @range.first\n @range.cover?(second)\n end",
"def later?(timestamp)\n ends_at && timestamp > ends_at\n end"
] |
[
"0.6826846",
"0.68126994",
"0.6682911",
"0.66601926",
"0.66404355",
"0.6564398",
"0.6509268",
"0.6475329",
"0.6443535",
"0.64317834",
"0.64152664",
"0.6412874",
"0.63919675",
"0.6391525",
"0.63859105",
"0.63032305",
"0.62968814",
"0.6291337",
"0.62858886",
"0.626494",
"0.62597823",
"0.6246177",
"0.6217887",
"0.62073123",
"0.6199555",
"0.61775625",
"0.61741954",
"0.61671746",
"0.6137915",
"0.613144",
"0.61280274",
"0.6125938",
"0.61244595",
"0.61238015",
"0.6113158",
"0.6103411",
"0.6099932",
"0.6093818",
"0.60834664",
"0.60834664",
"0.60700274",
"0.60552406",
"0.605289",
"0.6043532",
"0.60345143",
"0.60338026",
"0.60297126",
"0.60147643",
"0.60063493",
"0.5997636",
"0.5990854",
"0.5988184",
"0.5987841",
"0.59827197",
"0.59750915",
"0.59716034",
"0.5970983",
"0.5964713",
"0.59617573",
"0.59601164",
"0.59540147",
"0.5950323",
"0.59477067",
"0.5938503",
"0.5934382",
"0.5929949",
"0.59263796",
"0.5925043",
"0.59220624",
"0.5920455",
"0.5908609",
"0.5907488",
"0.5903729",
"0.5900809",
"0.5898954",
"0.58920103",
"0.58901733",
"0.5887984",
"0.5869653",
"0.58691394",
"0.58454025",
"0.58423424",
"0.5835928",
"0.58304495",
"0.5825597",
"0.58236",
"0.58150905",
"0.58150154",
"0.58069825",
"0.58045936",
"0.5804073",
"0.58033854",
"0.58032054",
"0.58026135",
"0.5799015",
"0.5795461",
"0.57946134",
"0.5781807",
"0.5777663",
"0.57727903"
] |
0.5890706
|
76
|
TODO how to handle +/ Infinity for Dates? TODO we can't delegate to Ruby range for mixed precision intervals Returns the Interval as a Range.
|
def to_range
case
when open?, unknown?
nil
else
Range.new(unknown_start? ? Date.new : @from, max)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_range\n Range.new(self.start, self.end)\n end",
"def unbounded\n ::Unbounded::Range.new(self.min, self.max, exclude_end?)\n end",
"def to_a\n get_range('-inf', '+inf', include_boundaries: true)\n end",
"def to_range\n min .. max\n end",
"def to_range\n start_date..end_date\n end",
"def to_range\n (@start_date..@end_date)\n end",
"def to_interval_set\n interval_set = IntervalSet.new.add\n merge_eq_interval_set(interval_set)\n merge_not_interval_set(interval_set)\n interval_set.intersect IntervalSet.new(to: lt) if lt\n interval_set.intersect IntervalSet.new(to: [lte]) if lte\n interval_set.intersect IntervalSet.new(from: gt) if gt\n interval_set.intersect IntervalSet.new(from: [gte]) if gte\n interval_set\n end",
"def day_range(rng=self)\n if rng.respond_to?(:exclude_end?) && rng.exclude_end?\n Range.new(rng.begin.to_date, rng.end.to_date, true)\n else\n Range.new(rng.begin.to_date, rng.end.to_date + 1, true)\n end\n end",
"def range_from_interval(interval, number = 1, timezone = nil)\n timezone ||= 'UTC'\n now = ActiveSupport::TimeZone.new(timezone).now\n\n end_point = now.send(\"end_of_#{interval}\").round\n start_point = end_point - number.send(interval)\n\n start_point..end_point\n end",
"def to_range_within(range)\n nb_weeks_offset = self.weekly_recurring ? ((range.end - self.starts_at.to_datetime) / 7).to_i : 0\n r = Range.new(self.starts_at + nb_weeks_offset.week, self.ends_at + nb_weeks_offset.week)\n range.cover?(r.begin)&&range.cover?(r.end) ? r : nil\n end",
"def range \n Range.new(@first, @last)\n end",
"def range *p\n a, d, b = nil\n if p.size == 2\n a, b = p\n d = 1\n else\n a, d, b = p\n end\n\n tol = 2.0*Float::EPSILON*[a.abs,b.abs].max;\n sig = signum(d)\n\n # exceptional cases\n # ignoring the infinite cases... breaks with Fixnums.\n #return [0.0/0.0] unless a.finite? && d.finite? && b.finite?\n return [] if d == 0 || a < b && d < 0 || b < a && d > 0\n\n # n = number of intervals = length(v) - 1.\n n = nil\n if a == a.floor && d == 1\n # Consecutive integers.\n n = b.floor - a;\n elsif a == a.floor && d == d.floor\n # Integers with spacing > 1.\n q = (a/d).floor;\n r = a - q*d;\n n = ((b-r)/d).floor - q;\n else\n # General case.\n n = ((b-a)/d).round;\n n -= 1 if sig*(a+n*d - b) > tol\n end\n\n # c = right hand end point.\n c = a + n*d;\n if sig*(c-b) > -tol\n c = b;\n end\n\n # v should be symmetric about the mid-point.\n v = Array.new(n+1, 0);\n for k in 0..(n/2).floor\n v[k] = a + k*d\n v[n-k] = c - k*d\n end\n if n % 2 == 0\n # Keep the mp as an integer if we can\n mp = (a+c)/2.0\n mp = mp.floor if mp.floor == mp && (a+c).is_a?(Fixnum)\n v[n / 2] = mp\n end\n\n return v\n end",
"def range\n min, max = span\n min..max\n end",
"def interval(from, to)\n return EmptyList if from > to\n interval_exclusive(from, to.next)\n end",
"def interval\n if @interval\n @interval\n elsif !self[Incident.interval_predicate].empty?\n @interval = Interval.find(self[Incident.interval_predicate].first)\n else\n nil\n end\n end",
"def intervals_in_range\n @user.intervals\n .where('DATE(time_in) BETWEEN ? AND ?', @date_range.begin.to_date, @date_range.end.to_date)\n .order(:time_in)\n end",
"def boundaries\n [intervals.first[0], intervals.last[1]]\n end",
"def value_to_range(value)\n case value.to_s\n when /\\A(\\-?\\d+)\\z/\n Range.new($1.to_i, $1.to_i)\n when /\\A(-?\\d+?)(\\.\\.\\.?|-|,)(-?\\d+)\\z/\n Range.new($1.to_i, $3.to_i, $2 == '...')\n else\n if @slop.strict?\n raise InvalidArgumentError, \"#{value} could not be coerced into Range\"\n else\n value\n end\n end\n end",
"def upper_bound_inclusive\n result = upper_bound\n\n # Some special cases:\n # - return a semver \"off-the-charts\" if the upper bound is 0.0.0\n # - deal with ranges that are not really ranges (like =v1.2.3)\n # - The \"biggest semver\" is its own upper bound\n return IMPOSSIBLY_SMALLEST_SEMVER if result.to_a[0...3] == [0, 0, 0]\n return result if upper_bound == lower_bound\n return result if result == XSemVer::BIGGEST_SEMVER\n\n # Figure out the part to decrement, taking care that we can't decrement\n # a part that is already at 0\n index_to_decrement = 2\n while result.to_a[index_to_decrement] == 0 do\n index_to_decrement -= 1\n end\n\n part_to_decrement = [:major, :minor, :patch][index_to_decrement]\n\n # Dynamically decrement the specified part\n value = result.send(part_to_decrement) - 1\n result.send \"#{part_to_decrement}=\", value\n\n # All the parts following the decremented one will be set to infinity\n parts_to_set_to_infinity = [:major, :minor, :patch][index_to_decrement + 1...3]\n\n parts_to_set_to_infinity.each do |part|\n result.send \"#{part}=\", FIXNUM_MAX\n end\n\n result\n end",
"def interval\n @to.to_i - @from.to_i\n end",
"def parse_range\n val = super || return\n val.begin == val.end ? val.begin : val\n end",
"def date_range\n @date_range ||= start_at..end_at\n end",
"def extract_range(options)\n (options[:range] || (options[:since]..options[:until]))\n .to_time_range.round(options[:granularity]).utc\n end",
"def to_ranges\n array = self.compact.uniq.sort\n ranges = []\n if !array.empty?\n # Initialize the left and right endpoints of the range\n left, right = array.first, nil\n array.each do |obj|\n # If the right endpoint is set and obj is not equal to right's successor \n # then we need to create a range.\n if right && obj != right.succ\n ranges << Range.new(left,right)\n left = obj\n end\n right = obj\n end\n ranges << Range.new(left,right)\n end\n ranges\n end",
"def range\n @range ||= set_range\n end",
"def intersect(other_interval)\n if self.end <= other_interval.start || other_interval.end <= start\n nil\n else\n Interval.new([start, other_interval.start].max, [self.end, other_interval.end].min)\n end\n end",
"def range; end",
"def range; end",
"def range; end",
"def interval(column)\n max(column) - min(column)\n rescue NoMethodError\n end",
"def get_interval(interval)\n case interval\n when :custom\n return {}\n when :hourly\n @start = (@run_time - 1.hour).beginning_of_hour\n @end = (@run_time - 1.hour).end_of_hour\n return {@field => @start..@end}\n when :daily\n @start = @run_time.yesterday.beginning_of_day\n @end = @run_time.yesterday.end_of_day\n return {@field => @start..@end}\n when :weekly\n @start = @run_time.yesterday.beginning_of_week\n @end = @run_time.yesterday.end_of_week\n return {@field => @start..@end}\n when :monthly\n @start = @run_time.yesterday.beginning_of_month\n @end = @run_time.yesterday.end_of_month\n return {@field => @start..@end}\n when :yearly\n @start = @run_time.yesterday.beginning_of_year\n @end = @run_time.yesterday.end_of_year\n return {@field => @start..@end}\n end\n end",
"def range_start=( value ); @range_start = value; rationalise_dates(); end",
"def find_cvs_interval\n max = -1.0 / 0\n min = 1.0 / 0\n current = 0\n\n self.each do |elt|\n current += elt\n if current < min\n min = current\n end\n if current > max\n max = current\n end\n end\n [min, max]\n end",
"def range\n (start_date...end_date) #exclusive date range\n end",
"def range(min, max)\n # # return [] if end < start\n # if its the last one, 1, using start and end\n\n return [] if max <= min\n\n range(min, max - 1) << max - 1\n # ^ treat it like it is the same data type as base case, so treat it like an array, <<, .map\n\n # [min] + range(min + 1, max - 1)\n # ^ num ^ same data type our base case\nend",
"def rationalise_dates\n default_range = date_range()\n\n begin\n if ( not @range_month_start.blank? )\n year, month = unpack_string( @range_month_start )\n range_start = Date.new( year, month )\n elsif ( not @range_week_start.blank? )\n year, week = unpack_string( @range_week_start )\n range_start = Timesheet.date_for( year, week, TimesheetRow::FIRST_DAY, true )\n else\n range_start = Date.parse( @range_start )\n end\n rescue\n range_start = default_range.min\n end\n\n begin\n if ( not @range_month_end.blank? )\n year, month = unpack_string( @range_month_end )\n range_end = Date.new( year, month ).at_end_of_month()\n elsif ( not @range_week_end.blank? )\n year, week = unpack_string( @range_week_end )\n range_end = Timesheet.date_for( year, week, TimesheetRow::LAST_DAY, true )\n else\n range_end = Date.parse( @range_end )\n end\n rescue\n range_end = default_range.max\n end\n\n if ( range_end < range_start )\n @range = range_end..range_start\n else\n @range = range_start..range_end\n end\n\n # Hard-coded range throttle to 32 days (just over a \"longest month\") for\n # daily reports to avoid excessive server load.\n\n if ( @frequency_data[ :generator ] == :daily_report )\n @range = ( @range.last - 32.days )..( @range.last ) if ( @range.last.to_time - @range.first.to_time > 32.days )\n end\n end",
"def range(range_start, range_end)\n return [] if range_end < range_start\n return [range_end] if range_end == range_start\n result = [range_end]\n range(range_start, range_end - 1) + result\nend",
"def to_ranges args = Hash.new\n min = args[:min] || -Infinity\n max = args[:max] || Infinity\n collapse = args[:collapse]\n \n ranges = Array.new\n self.split(%r{\\s*,\\s*}).each do |section|\n md = section.match(RANGE_REGEXP)\n next unless md\n \n from = _matchdata_to_number md, 1, min\n to = _has_matchdata?(md, 2) ? _matchdata_to_number(md, 3, max) : from\n\n prevrange = ranges[-1]\n\n if collapse && prevrange && prevrange.include?(from - 1) && prevrange.include?(to - 1)\n ranges[-1] = (prevrange.first .. to)\n else\n ranges << (from .. to)\n end\n end\n\n ranges\n end",
"def to_range\n\t\tIP.parse(self.start_ip)..IP.parse(self.end_ip)\n\tend",
"def range(arr)\n arr.max - arr.min\nend",
"def range(arr)\n arr.max - arr.min\nend",
"def in_range(*args)\n opts = args.last.kind_of?(Hash) ? args.pop : {}\n limit = opts[:limit]\n count = 1\n t_start, t_end = args.first.kind_of?(Range) ? [args.first.first, args.first.last] : [args.first,args.last]\n\n raise ArgumentError, \"must be a range or two date/time objects\" unless t_start and t_end\n\n self.start = t_start\n\n @in_range ||= begin\n result = []\n loop do\n next!\n break if count > limit if limit\n break if to_date > t_end\n result << to_date\n count += 1\n end\n\n result\n end\n end",
"def age_range\n 18..99\n end",
"def range_for period \n (period / ( 60 * 60 * 24 ) * -1)..-1\n end",
"def range(data)\n return (minimum(data)..maximum(data))\n end",
"def validate_range(value)\n classname = value.class.to_s\n case classname\n when \"Range\" \n then value\n when \"Array\"\n then value\n else\n return (value..value)\n end\n end",
"def range\n\t\t\t#(@end > @start) ? (@start .. @end) : (@end .. @start)\n\t\t\t(start .. self.end)\n\t\tend",
"def to_bc(date_range)\n if date_range.present?\n return [-date_range[1], -date_range[0]]\n else\n return [nil, nil]\n end\n end",
"def range(arr)\narr.max - arr.min\nend",
"def create_range(num)\n (1..num).to_a\nend",
"def active_range(region)\n start = [earliest_patient_recorded_at_period[region.slug], periods.begin].compact.max\n (start..periods.end)\n end",
"def active_range(region)\n start = [earliest_patient_recorded_at_period[region.slug], periods.begin].compact.max\n (start..periods.end)\n end",
"def span\r\n if @range.none?\r\n 0\r\n else\r\n @range.max - @range.min + 1\r\n end\r\n end",
"def interval=(val)\n attribute_set(:interval,val.kind_of?(Numeric) ? val : INTERVALS_MAP[val.to_s])\n end",
"def range\n unless value.is_a? Range\n errors.add(:value, :range)\n end\n end",
"def add(min, max)\n if intervals.empty?\n intervals << [min, max]\n return\n end\n\n new_list = []\n while interval = intervals.shift\n if interval[1] < min\n new_list << interval\n elsif interval[0] > min\n if interval[0] > max\n new_list << [min, max] << interval\n break\n else\n new_list << [min, [max, interval[1]].max]\n end\n break\n else\n new_list << [interval[0], [max, interval[1]].max]\n break\n end\n end\n\n if intervals.empty? && new_list.last[1] < min\n new_list << [min, max]\n\n elsif new_list.last[1] <= max\n while interval = intervals.shift\n last_interval = new_list.last\n\n # It is guaranteed that interval[0] > last_interval[0].\n # We therefore only need to check if interval[0] is\n # included in last_interval\n if interval[0] <= last_interval[1]\n if last_interval[1] < interval[1]\n last_interval[1] = interval[1]\n break\n end\n else\n new_list << interval\n break\n end\n end\n end\n\n # We now know that the last interval in new_list has an upper\n # bound that comes from an already existing interval. We are\n # therefore sure that there are no overlaps.\n new_list.concat(intervals)\n @intervals = new_list\n self\n end",
"def within(range: 1.00..5000.00)\n between(from: range.min, to: range.max)\n end",
"def range(start, ending_value)\n return [] if start > ending_value\n result = [start] + range(start + 1, ending_value)\nend",
"def include_with_range?(value)\n if value.is_a?(::Range)\n operator = exclude_end? ? :< : :<=\n end_value = value.exclude_end? ? last.succ : last\n include?(value.first) && (value.last <=> end_value).send(operator, 0)\n else\n include_without_range?(value)\n end\n end",
"def range(start_num, end_num)\n # one line version\n # (start_num...end_num).to_a\n\n # version 2\n exclusive_range = []\n (start_num...end_num).each do |num|\n exclusive_range << num\n end\n exclusive_range\nend",
"def r(range)\n range.to_a\nend",
"def to_r\n array = self.gsub('..',',').gsub(/[\\. ]/,'').split(',').sort\n Range.new(array.first, array.last) if array\n end",
"def breakable_range; end",
"def in(*args)\n if args.size == 1 && (range = args.first).is_a?(Range)\n return Between.new(self, range)\n end\n\n In.new(self, *args)\n end",
"def query_range(left, right)\n \n end",
"def query_range(left, right)\n \n end",
"def report_period_to_range\n daily_report = false\n range = case self\n when 'this_month'\n daily_report = true\n (Date.today.beginning_of_month..Date.today)\n when 'last_month'\n daily_report = true\n (1.month.ago.to_date.beginning_of_month..1.month.ago.to_date.end_of_month)\n when 'last_6_months'\n (5.months.ago.to_date.beginning_of_month..Date.today).select {|d| d.day == 1}\n when 'this_year'\n (Date.today.beginning_of_year..Date.today).select {|d| d.day == 1}\n end\n [range, daily_report]\n end",
"def valid_intervals\n VALID[:interval]\n end",
"def range1d?(o)\n o.int_range?\nend",
"def range\n DEFAULT_RANGE\n end",
"def range\n DEFAULT_RANGE\n end",
"def range\n DEFAULT_RANGE\n end",
"def bounds(arr)\n min, max = arr.min(), arr.max()\n range = max - min\n # how many figures in the range\n range_digits = Math.log10(range).ceil()\n range_scale = 10.0**(range_digits-1)\n min_bound = ((min / range_scale) - 1) * range_scale\n max_bound = ((max / range_scale) + 1) * range_scale\n return min_bound, max_bound, range_scale\n end",
"def range(arr)\n max = arr.max\n min = arr.min\n\n max - min\nend",
"def range(range)\n opts[:min] = range.begin\n opts[:max] = range.end\n end",
"def __evolve_range__(serializer: nil)\n __evolve_range_naive__.transform_values! do |value|\n if serializer\n serializer.evolve(value)\n else\n case value\n when Time, DateTime then value.__evolve_time__\n when Date then value.__evolve_date__\n else value\n end\n end\n end\n end",
"def range(range)\n assert_range range\n schema do |s|\n s.type range.begin.is_a?(Integer) ? 'integer' : 'number'\n s.minimum range.begin\n s.maximum range.end, exclusive: range.exclude_end? unless range.end.nil?\n end\n end",
"def parse_range\n args[:range] = true\n str = clean_param(leave_slashes: true)\n return args[:default] if str.blank?\n\n match = str.match(/^((\\\\.|[^\\\\-]+)+)-((\\\\.|[^\\\\-]+)+)$/)\n if match\n @val = match[1]\n from = parse_scalar\n @val = match[3]\n to = parse_scalar\n else\n from = to = parse_scalar\n end\n ordered_range(from, to)\n end",
"def range_start; range.first; end",
"def interval_value(current_value, max_value, value)\n if current_value - value < 0\n return max_value + current_value - value\n elsif current_value - value >= max_value\n return current_value - value - max_value\n else\n return current_value - value\n end\nend",
"def range\n @cached_range ||= get_range\n end",
"def date_range( start_date, end_date )\n d_range = []\n cur_date = start_date \n\n until cur_date == end_date\n d_range << cur_date\n cur_date = Calendar.next_day( cur_date )\n end\n \n d_range << end_date\n end",
"def range_value\n string_value\n end",
"def range(input); end",
"def merge_intervals(intervals)\n intervals.sort_by!(&:start)\n\n merged = []\n\n intervals.each do |interval|\n if merged.empty?\n merged << interval\n elsif merged.last.end >= interval.start\n merged.last.end = [merged.last.end, interval.end].max\n else\n merged << interval\n end\n end\n\n merged\nend",
"def intersection_with(other)\n r1,r2 = matched_range_types(self, other)\n max_begin = [r1.begin,r2.begin].max\n min_end = [r1.end, r2.end ].min\n excl = ( r1.end == min_end && \n r1.respond_to?(:exclude_end?) && r1.exclude_end?\n ) ||\n ( r2.end == min_end && \n r2.respond_to?(:exclude_end?) && r2.exclude_end?\n )\n unless max_begin > min_end\n Range.new(max_begin, min_end, excl).extend(DateTimeRange)\n end\n end",
"def range(start_val, end_val)\n return [] if start_val + 1 == end_val\n nums = [start_val + 1]\n nums + range(start_val + 1, end_val)\nend",
"def range\n object.range + DEFAULT_MAX_DISTANCE\n end",
"def range(arr)\n\nend",
"def range(column)\n min(column)..max(column)\n end",
"def get_occurrences(start_date, interval, end_date)\n\n start_date = Date.new(start_date.year,start_date.month,start_date.mday)\n end_date = Date.new(end_date.year,end_date.month,end_date.mday)\n raise ArgumentError, \"Start date (#{start_date}) should be less than or equal to end date (#{end_date})\" if (start_date>end_date)\n\n i_length, i_unit = parse_interval(interval)\n\n if i_length == 0.5 && ![:m, :y].include?(i_unit)\n raise ArgumentError, \"Semi- interval is not supported to this units (#{i_unit.to_s})\"\n end\n\n new_interval = case i_unit\n when :d then {:length=>i_length, :unit=>:days}\n when :w then {:length=>i_length*7, :unit=>:days}\n when :m then {:length=>i_length, :unit=>:months}\n when :y then {:length=>i_length*12, :unit=>:months}\n end\n\n if new_interval[:unit] == :days\n new_occurrences = 1 + ((end_date - start_date)/new_interval[:length]).to_i\n elsif new_interval[:unit] == :months\n new_occurrences = 1 + (months_between(end_date, start_date)/new_interval[:length]).to_i \n end\n return new_occurrences\n end",
"def union(range)\n # Return self if nil (nothing new to add) or if it matches the other range (they are equivalent)\n return self.clone if range.nil?\n return self.clone if eql?(range)\n\n # Figure out which range starts earlier (to capture the most time)\n if low <= range.low\n earlier_start = self\n later_start = range\n else\n earlier_start = range\n later_start = self\n end\n \n # Figure out which ranges ends earlier (the more restrictive one)\n if high >= range.high\n earlier_end = self\n later_end = range\n else\n earlier_end = range\n later_end = self\n end\n \n result = []\n # We have continuous Ranges so we can return one Range to encapsulate both\n if earlier_start.contains?(later_start.low)\n result << Range.new(\"TS\", earlier_start.low.clone, later_end.high.clone, nil)\n else\n # The Ranges are disjoint, so we'll need to return two arrays to capture all of the potential times\n result << Range.new(\"TS\", earlier_start.low.clone, earlier_start.high.clone, nil)\n result << Range.new(\"TS\", later_start.low.clone, later_start.high.clone, nil)\n end\n end",
"def conjunctionRangeExtd(r1, r2)\n\n [r1, r2].each do |er|\n return er if er.is_none?\n end\n\n r = *( sort_ranges_core([RangeExtd(r1), RangeExtd(r2)]) )\t# => Rangeary.sort_ranges\n\n ## Note: the end product will be (cBeg(:stBeg), cEnd(:stEnd))\n # where :stBeg and :stEnd mean exclude_(begin|end)?\n\n # Set the candidate begin value.\n cBeg = r[1].begin\n if r[0].begin == r[1].begin\n stBeg = (r[1].exclude_begin? || r[0].exclude_begin?)\n else\n stBeg = r[1].exclude_begin?\n end\n\n # Set the candidate end value. (Rangeary.comparable_end() for Ruby-2.6 Endless Range)\n # Note: this comparison ignores @infinities even if set,\n # because @infinities may not be defined in the arguments!\n # Anyway, nothing should be larger than the upper limit\n # and so this should be fine.\n if comparable_beginend_core(r[0]).end == comparable_beginend_core(r[1]).end\n cEndOrig = r[1].end\n cEnd = comparable_beginend_core(r[1]).end\n stEnd = (r[0].exclude_end? || r[1].exclude_end?)\n else\n a = [[comparable_beginend_core(r[0]).end, 0, r[0].end], [comparable_beginend_core(r[1]).end, 1, r[1].end]].min\n cEnd = a[0]\n cEndIndex = a[1]\t# r[cEndIndex] == RangeExtd obj that gives the end of the resultant range.\n cEndOrig = a[2]\n stEnd = nil\n end\n\n case cBeg <=> cEnd\n when 1\t# cBeg > cEnd\n RangeExtd::NONE\n\n when 0\t# cBeg == cEnd\n stEnd = r[0].exclude_end?\n if (!stBeg) && (!stEnd)\n RangeExtd(cBeg..cBeg)\t# Point range\n else\n RangeExtd::NONE\n end\n\n when -1\t# cBeg < cEnd\n # Now, the range must be (cBeg, cEnd). May need adjustment of the exclude status.\n if stEnd.nil?\n stEnd = r[cEndIndex].exclude_end?\n # else\n # # Already defined.\n end\t# if stEnd.nil?\n\n RangeExtd(cBeg, cEndOrig, :exclude_begin => stBeg, :exclude_end => stEnd)\n else\n raise\n end\t\t# case cBeg <=> cEnd\n\n end",
"def effective_range\n @opts[:effective_range] ||= [nil, nil]\n @opts[:effective_range][0] ||= x.min\n @opts[:effective_range][1] ||= x.max\n @opts[:effective_range]\n end",
"def event_range events\n [events.map(&:date).min.to_date, events.map(&:date).max.to_date]\nend",
"def range(min, max)\n\trange = []\n\n\ti = min\n\twhile i <= max\n\t\trange << i\n\t\ti += 1\n end\n \n\treturn range\nend",
"def build_range(key, val, negate)\n if val.exclude_end?\n # begin...end range\n if negate\n \"#{key} < #{quoted(val.begin, key)} or #{key} >= #{quoted(val.end, key)}\"\n else\n \"#{key} >= #{quoted(val.begin, key)} and #{key} < #{quoted(val.end, key)}\"\n end\n else\n # begin..end range\n if negate\n \"#{key} < #{quoted(val.begin, key)} or #{key} > #{quoted(val.end, key)}\"\n else\n \"#{key} >= #{quoted(val.begin, key)} and #{key} <= #{quoted(val.end, key)}\"\n end\n end\n end",
"def restrict(value, range)\n [[value, range.first].max, range.last].min\n end",
"def allocation_range\n (@iprange or @subnet).to_range\n end",
"def range_rc(start_num, end_num)\n\n return [] if end_num <= start_num\n range_rc(start_num, end_num - 1) + [end_num - 1]\nend"
] |
[
"0.6671649",
"0.6599144",
"0.6597801",
"0.6468024",
"0.64024574",
"0.6245468",
"0.6215531",
"0.61930454",
"0.6171799",
"0.61442727",
"0.6117625",
"0.60772216",
"0.6051633",
"0.60105985",
"0.6000623",
"0.59989506",
"0.59437037",
"0.59286714",
"0.58351845",
"0.5833981",
"0.5825228",
"0.5818205",
"0.57790416",
"0.5765344",
"0.57583094",
"0.5738788",
"0.5714014",
"0.5714014",
"0.5714014",
"0.56873137",
"0.5672543",
"0.5667521",
"0.5655737",
"0.56490153",
"0.56468433",
"0.5643279",
"0.5621478",
"0.5615068",
"0.56062245",
"0.56048226",
"0.56048226",
"0.56016785",
"0.5591549",
"0.5580942",
"0.55747545",
"0.5564217",
"0.5557434",
"0.554916",
"0.5544285",
"0.5542809",
"0.5535215",
"0.5535215",
"0.55270183",
"0.55163145",
"0.551104",
"0.5506156",
"0.5491198",
"0.54895926",
"0.5487587",
"0.5485643",
"0.54819566",
"0.54758877",
"0.5472485",
"0.54692227",
"0.54668075",
"0.54668075",
"0.5466607",
"0.5459589",
"0.5454925",
"0.5437547",
"0.5437547",
"0.5437547",
"0.54302067",
"0.5430061",
"0.54281086",
"0.54097027",
"0.5406657",
"0.5397914",
"0.53946763",
"0.53734076",
"0.53473496",
"0.53450835",
"0.5337761",
"0.53363246",
"0.5335",
"0.5333537",
"0.5330004",
"0.5320411",
"0.5319613",
"0.5317271",
"0.5311383",
"0.53104794",
"0.53083247",
"0.530503",
"0.5304909",
"0.5301395",
"0.52976024",
"0.52956355",
"0.52942574",
"0.5283925"
] |
0.6807673
|
0
|
Returns true if other is an element of the Interval, false otherwise. Comparision is done according to the Interval's min/max date and precision.
|
def include?(other)
cover?(other) && precision == other.precision
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cover?(other)\n return false unless other.is_a?(Date)\n\n other = other.day_precision\n\n case\n when unknown_start?\n max.day_precision! == other\n when unknown_end?\n min.day_precision! == other\n when open_end?\n min.day_precision! <= other\n else\n min.day_precision! <= other && other <= max.day_precision!\n end\n end",
"def ==(other)\n (other.is_a? Interval) && (@start == other.start && @end == other.end)\n end",
"def cover?(other)\n return false unless other.respond_to?(:day_precision)\n other = other.day_precision\n min.day_precision! <= other && other <= max.day_precision!\n end",
"def ==(other)\n if other.is_a?(IntervalSet)\n intervals.sort == other.intervals.sort\n else\n false\n end\n end",
"def ==(other)\n @intervals == other.intervals\n end",
"def overlaps?(other)\n \t((start_date - other.end_date) * (other.start_date - end_date)) >= 0\n \tend",
"def overlaps?(another)\n (start_date - another.end_date) * (another.start_date - end_date) >= 0\n end",
"def overlaps?(other)\n\t\tself.start_date < other.end_date && other.start_date < self.end_date\n\tend",
"def within?(other)\n range_within_other?(self,other)\n end",
"def overlaps?(other)\n start <= other.end_date && other.start <= self.end_date\n end",
"def covers?(*args)\n other = coerce_range(*args)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n self.begin <= other.begin and other.end <= self.end\n end\n end",
"def during?(other)\n if other.is_a? Numeric\n other_begin = other_end = other\n else\n other_begin, other_end = other.begin, other.end\n end\n\n self_begin, self_end = self.begin, self.end\n\n # Check if either of the two items begins during the\n # span of the other\n other_begin <= self_begin && self_begin <= other_end ||\n self_begin <= other_begin && other_begin <= self_end\n end",
"def cover?(other_period)\n inside?(other_period.starts_at) || inside?(other_period.ends_at)\n end",
"def interval?() triangulated? and complement.comparability?; end",
"def ==(other)\n return true if equal? other\n\n other.kind_of?(Range) and\n self.first == other.first and\n self.last == other.last and\n self.exclude_end? == other.exclude_end?\n \n end",
"def overlaps?(other)\n # overlap == start < finish' AND start' < finish\n self.first <= other.actual_last and other.first <= self.actual_last\n end",
"def intersects?(other)\n @origin.keys.each do |axis|\n return false unless min_lte_max(axis, other) && max_gte_min(axis, other)\n end\n true\n end",
"def include_range? other_range\n case other_range\n when Range\n if other_range.first >= self.first && other_range.last <= self.last\n return true\n else\n return false\n end\n else\n raise \"unsupported type\"\n end\n end",
"def intersect(other_interval)\n if self.end <= other_interval.start || other_interval.end <= start\n nil\n else\n Interval.new([start, other_interval.start].max, [self.end, other_interval.end].min)\n end\n end",
"def correct?\n starts_at < ends_at && starts_at.to_date == ends_at.to_date\n end",
"def ==(another_date)\n return false if self.precision != another_date.precision\n self.to_datetime == another_date.to_datetime\n end",
"def >(other)\n return true if self.hour > other.hour\n return false if self.hour < other.hour\n\n self.minute > other.minute\n end",
"def subsume?(other)\n range_within_other?(other,self)\n end",
"def intersect?(o)\n self.class == o.class && !(@to < o.numeric_from || o.numeric_to < @from)\n end",
"def same?(other)\n (from_end == other.from_end and\n to_end == other.to_end and\n overlap == other.overlap)\n end",
"def same?(other)\n (from_end == other.from_end and\n to_end == other.to_end and\n overlap == other.overlap)\n end",
"def include?(other_period)\n inside?(other_period.starts_at) && inside?(other_period.ends_at)\n end",
"def intersects?(*args)\n other = coerce_range(*args)\n raise ArgumentError, \"#{self.begin.class} expected, received #{other.begin.class}\" unless other.begin.kind_of?(self.begin.class)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n other.begin < self.end and self.begin < other.end\n end\n end",
"def include?(new_date)\n return start_date <= new_date && end_date > new_date\n end",
"def ==(other)\n other.class == self.class &&\n other.start_date == @start_date &&\n other.end_date == @end_date\n end",
"def same_time?(other)\n return false unless self.b == other.b\n return true if self.n.zero? && other.n.zero?\n self_div = Rational(self.n, self.d)\n other_div = Rational(other.n, other.d)\n self_div == other_div\n end",
"def within?(other_slice)\r\n if ! other_slice.class == Slice\r\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\r\n end\r\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\r\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\r\n end\r\n\r\n self_range = self.start .. self.stop\r\n other_range = other_slice.start .. other_slice.stop\r\n\r\n if other_range.include?(self.start) and other_range.include?(self.stop)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def contains?(other)\n (other.begin_pos <=> @begin_pos) + (@end_pos <=> other.end_pos) >= (other.empty? ? 2 : 1)\n end",
"def approx_same_values_as?(other)\n delta = s_copy.sub(other).to_a.inject(0.0) do |result, element|\n result + element**2.0\n end\n delta < EPSILON\n end",
"def within?(other_slice)\n if ! other_slice.class == Slice\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\n end\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\n end\n\n self_range = self.start .. self.stop\n other_range = other_slice.start .. other_slice.stop\n\n if other_range.include?(self.start) and other_range.include?(self.stop)\n return true\n else\n return false\n end\n end",
"def eql?(other)\n return false unless other.respond_to?(:coords)\n equal = true\n self.coords.each_with_index do |c, i|\n if (c - other.coords.to_a[i])**2 > PRECISION\n equal = false\n break\n end\n end\n equal\n end",
"def overlap?(interval_start, interval_end, ride)\n raise \"Invalid interval\" if interval_start>=interval_end\n if (ride.start_time > interval_end) || (ride.end_time<interval_start)\n return false \n else \n return true\n end \n\n end",
"def <=>(other)\n return false unless other.is_a?(Interval)\n @seconds <=> other.seconds\n end",
"def ==(other)\n # If lexically invalid, use regular literal testing\n return super unless self.valid?\n\n case other\n when Literal::Time\n return super unless other.valid?\n # Compare as strings, as time includes a date portion, and adjusting for UTC\n # can create a mismatch in the date portion.\n self.object.new_offset.strftime('%H%M%S.%L') == other.object.new_offset.strftime('%H%M%S.%L')\n when Literal::DateTime, Literal::Date\n false\n else\n super\n end\n end",
"def nearly?(other); end",
"def overlaps?(other); end",
"def overlaps?(other); end",
"def overlaps?(other); end",
"def ==(other)\r\n @range == other.range\r\n end",
"def overlaps(other_date_range)\n if contains(other_date_range.start_date) || contains(other_date_range.end_date)\n true\n elsif other_date_range.contains(@start_date) && other_date_range.contains(@end_date)\n true\n else\n false\n end\n end",
"def meets?(*args)\n other = coerce_range(*args)\n self.begin == other.end or other.begin == self.end\n end",
"def >=(other_list)\n return false if self.list.empty?\n return true if other_list.list.empty?\n\n return (\n self.min_item[1] >= other_list.min_item[1] &&\n self.max_item[1] >= other_list.max_item[1]\n )\n end",
"def ===(instant)\n (instant >= self.begin) and (instant < self.end)\n end",
"def overlap?(input_range)\n a = self.start_date >= input_range.end_date\n b = self.end_date <= input_range.start_date\n return a || b ? false : true \n end",
"def touching?(range)\n range.end == self.start || self.end == range.start\n end",
"def <=(other_list)\n return false if other_list.list.empty?\n return true if self.list.empty?\n\n return (\n self.max_item[1] <= other_list.max_item[1] &&\n self.min_item[1] <= other_list.min_item[1]\n )\n end",
"def valid_start_and_end_dates?\n return false unless start.present? && self.end.present?\n start <= self.end\n end",
"def ===(other)\n case other\n when Date\n @days.include? Date.jd(other.jd) #in case it's a DateTime\n when Time\n @days.include? Date.civil(other.year, other.month, other.day)\n else\n super\n end\n end",
"def date_range_overlap?(start_date_one, end_date_one, start_date_two, end_date_two)\n if start_date_one < end_date_two && start_date_two < end_date_one\n return true\n else\n return false\n end\n end",
"def within_time_period?\n return true unless start_time || end_time\n\n if start_time && end_time\n (start_time..end_time).cover? Time.current\n elsif start_time\n Time.current >= start_time\n elsif end_time\n Time.current <= end_time\n end\n end",
"def overlap?(new_start_date, new_end_date)\n return(start_date <= new_end_date && end_date >= new_start_date) \n end",
"def after?(other)\n time = other.is_a?(Numeric) ? other : other.end\n self.begin >= time\n end",
"def overlaps?\n self.class.all.any? do |other|\n (start_hour > other.start_hour && start_hour < other.end_hour) ||\n (end_hour > other.start_hour && end_hour < other.end_hour)\n end\n end",
"def ==(other)\n return false unless other\n return false unless other.respond_to?(:frequency) && other.frequency == frequency\n return false unless other.respond_to?(:day_of_week) && other.day_of_week == day_of_week\n return false unless time_attribute_equal(other, :start_at)\n return false unless time_attribute_equal(other, :end_on)\n true\n end",
"def ==(other)\n return false unless other.is_a?(Point)\n (x - other.x).abs < EQUITY_TOLERANCE && (y - other.y).abs < EQUITY_TOLERANCE\n end",
"def overlaps?(other)\n a, b = [self, other].map(&:range)\n #\n # Although a Shift which passes through midnight is stored\n # internally as lasting more than TimeOfDay::NUM_SECONDS_IN_DAY\n # seconds from midnight, that's not how it is meant to be\n # handled. Rather, it consists of two chunks:\n #\n # range.first => Midnight\n # Midnight => range.last\n #\n # The second one is *before* the first. None of it is more than\n # TimeOfDay::NUM_SECONDS_IN_DAY after midnight. We thus need to shift\n # each of our ranges to cover all overlapping possibilities.\n #\n one_day = TimeOfDay::NUM_SECONDS_IN_DAY\n ashifted =\n Range.new(a.first + one_day, a.last + one_day, a.exclude_end?)\n bshifted =\n Range.new(b.first + one_day, b.last + one_day, b.exclude_end?)\n #\n # For exclusive ranges we need:\n #\n # a.ending > b.beginning && b.ending > a.beginning\n #\n # and for inclusive we need:\n #\n # a.ending >= b.beginning && b.ending >= a.beginning\n #\n aop = a.exclude_end? ? :> : :>=\n bop = b.exclude_end? ? :> : :>=\n #\n (a.last.send(aop, b.first) && b.last.send(bop, a.first)) ||\n (ashifted.last.send(aop, b.first) && b.last.send(bop, ashifted.first)) ||\n (a.last.send(aop, bshifted.first) && bshifted.last.send(bop, a.first))\n end",
"def after?(other)\n if other.hour < @hour\n return true\n elsif other.hour == @hour\n if other.minute < @minute\n return true\n elsif other.minute == @minute\n if other.second < @second\n return true\n elsif other.second == @second\n return other.millis < @millis\n end\n end\n end\n false\n end",
"def <=>(other)\n self_start = self.start_date\n other_start = other.start_date\n self_end = self.end_date \n other_end = other.end_date\n return self_start <=> other_start if self_start && other_start\n return self_end <=> other_end if self_end && other_end\n return self_start <=> other_end if self_start && other_end\n return self_end <=> other_start if self_end && other_start\n return 0\n end",
"def eql?(other)\n\t if other.is_a?(Array)\n\t\t@elements.eql? other\n\t elsif other.is_a?(PointIso)\n\t\tvalue = other.value\n\t\t@elements.all? {|e| e.eql? value }\n\t elsif other.is_a?(PointOne)\n\t\t@elements.all? {|e| e.eql? 1 }\n\t elsif other.is_a?(PointZero)\n\t\t@elements.all? {|e| e.eql? 0 }\n\t else\n\t\tsuper other\n\t end\n\tend",
"def similarTo?( otherObj )\n\t\t\treturn false unless otherObj.is_a?( self.class )\n\t\t\totherAry = otherObj.to_ary\n\t\t\trval = true\n\t\t\tself.to_ary.each_with_index {|elem,i|\n\t\t\t\tif (elem - otherAry[i]).abs > 1e-10\n\t\t\t\t\trval = false\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t}\n\t\t\treturn rval\n\t\tend",
"def matches?(other)\n operable_values == other.operable_values\n end",
"def ==(y)\n Interval.intervals_to_halfsteps[@interval] == Interval.intervals_to_halfsteps[y.interval] \n end",
"def crossing?(other)\n return false unless overlaps?(other)\n (@begin_pos <=> other.begin_pos) * (@end_pos <=> other.end_pos) == 1\n end",
"def overlaps_with(other_billing_record, min_proximity = 0)\n return true if start_time == other_billing_record.start_time\n first, second = nil, nil # Which record started first?\n if start_time < other_billing_record.start_time\n first, second = self, other_billing_record\n else\n first, second = other_billing_record, self\n end\n second.start_time - first.stop_time <= min_proximity\n end",
"def == other\n return true if equal?(other) # save some time\n return false unless other.respond_to?(:to_a)\n e1s = to_a\n e2s = other.to_a\n e1s.size == e2s.size && e1s.all? { |e1| e2s.include? e1 }\n end",
"def overlap?(self_range, other_range)\n return true if self_range == other_range \n overlap_helper(self_range, other_range) || overlap_helper(other_range, self_range)\n end",
"def range_include?(zelf, other)\n # 1...10 includes 1..9 but it does not include 1..10.\n operator = zelf.exclude_end? && !other.exclude_end? ? :< : :<=\n zelf.include?(other.first) && other.last.send(operator, zelf.last)\nend",
"def intersects?(other)\n raise \"NOT A CUBOID\" unless other.is_a? Cuboid \n self_range = range_finder\n other_range = other.range_finder\n\n self_range.each do |k,_|\n return false unless overlap?(self_range[k], other_range[k])\n end \n\n true \n end",
"def meeting_conflict?(other)\n return false if self.start_time.nil? or other.start_time.nil?\n section_days = other.days.split(\"\")\n section_days.each do |day|\n if( self.days.include?(day) )\n if (self.start_time.to_i >= other.start_time.to_i and self.start_time.to_i <= other.end_time.to_i) or \n (other.start_time.to_i >= self.start_time.to_i and other.start_time.to_i <= self.end_time.to_i)\n return true\n end \n end\n end\n return false\n end",
"def between?(min, max)\n utc.between?(min, max)\n end",
"def ==(other)\n @floor == other.floor && @ceiling == other.ceiling\n end",
"def <=>(other) range_start <=> other.range_start end",
"def eql?(other)\n return self.to_i == other.to_i && self.usec == other.usec\n end",
"def before?(other)\n time = other.is_a?(Numeric) ? other : other.begin\n self.end <= time\n end",
"def overlaps?(other)\n (self.check_in - other.check_out) * (other.check_in - self.check_out) >= 0\n end",
"def <(other)\n return true if self.hour < other.hour\n return false if self.hour > other.hour\n\n self.minute < other.minute\n end",
"def contains?(value)\n start_time = low.to_time_object\n end_time = high.to_time_object\n time = value.to_time_object\n \n time.between?(start_time, end_time)\n end",
"def within?(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#within? not defined.\"\n end",
"def ==(other)\n case other\n when Point\n float_equal(x, other.x) && float_equal(y, other.y)\n when Array\n self == Geom2D::Point(other)\n else\n false\n end\n end",
"def overlaps?(other_slice)\r\n if ! other_slice.class == Slice\r\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\r\n end\r\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\r\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\r\n end\r\n\r\n self_range = self.start .. self.stop\r\n other_range = other_slice.start .. other_slice.stop\r\n\r\n if self_range.include?(other_slice.start) or other_range.include?(self.start)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def >(other_list)\n return false if self.list.empty?\n return true if other_list.list.empty?\n\n return self.min_item[1] > other_list.max_item[1]\n end",
"def ==(other)\n if other.is_a?(Saulabs::Reportable::ReportingPeriod)\n @date_time == other.date_time && @grouping.identifier == other.grouping.identifier\n elsif other.is_a?(Time) || other.is_a?(DateTime)\n @date_time == parse_date_time(other)\n else\n raise ArgumentError.new(\"Can only compare instances of #{self.class.name}\")\n end\n end",
"def in_range?\n return self.range.include?([@x, @y])\n end",
"def overlap? range\n !(self & range).nil?\n end",
"def overlaps?(other_slice)\n if ! other_slice.class == Slice\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\n end\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\n end\n\n self_range = self.start .. self.stop\n other_range = other_slice.start .. other_slice.stop\n\n if self_range.include?(other_slice.start) or other_range.include?(self.start)\n return true\n else\n return false\n end\n end",
"def >= other\n #This is a stub, used for indexing\n end",
"def ==(other)\n self.begin == other.begin && self.end == other.end\n rescue NoMethodError\n false\n end",
"def overlaps?(other)\n cover?(other.begin) || other.cover?(first)\n end",
"def ===(ts)\n ts >= start && ts < finish\n end",
"def date_in_range?(first, date, last)\n first <= date && date <= last\n end",
"def contained?(other)\n center.distance(other.center) < (@r - other.r).abs\n end",
"def eql?(other)\n if ! other.is_a?(self.class)\n false\n else\n [@mean, @variance] == [other.mean, other.variance]\n end\n end",
"def ==(other)\n return false unless other.is_a?(Decimal128)\n @high == other.instance_variable_get(:@high) &&\n @low == other.instance_variable_get(:@low)\n end",
"def separate?(other)\n center.distance(other.center) > @r + other.r\n end",
"def include?(value)\n candidate = intervals\n .find { |min, max| max >= value }\n candidate && (candidate[0] <= value)\n end"
] |
[
"0.77499694",
"0.7744611",
"0.76978505",
"0.7147485",
"0.70140666",
"0.6868986",
"0.67598075",
"0.6632069",
"0.6616678",
"0.6601479",
"0.65801495",
"0.6495526",
"0.6428735",
"0.64255106",
"0.64043224",
"0.63713986",
"0.6345631",
"0.633576",
"0.63173443",
"0.62924457",
"0.6278471",
"0.6234424",
"0.6206819",
"0.6200997",
"0.6199399",
"0.6199399",
"0.6198517",
"0.6184733",
"0.61464906",
"0.61330074",
"0.61271083",
"0.6121662",
"0.6118245",
"0.6085385",
"0.6081146",
"0.6075707",
"0.6052617",
"0.60516435",
"0.6048168",
"0.6046554",
"0.6025985",
"0.6025985",
"0.6025985",
"0.6024735",
"0.6014578",
"0.60125875",
"0.600748",
"0.6006773",
"0.59936315",
"0.59926206",
"0.5983871",
"0.59792525",
"0.59565",
"0.5944816",
"0.59394735",
"0.59367627",
"0.59340274",
"0.592884",
"0.5917561",
"0.59122753",
"0.59085",
"0.59001946",
"0.5899507",
"0.5892409",
"0.5890236",
"0.58667916",
"0.58660966",
"0.5863649",
"0.58563024",
"0.58538455",
"0.58529884",
"0.5839647",
"0.583906",
"0.5835327",
"0.5830881",
"0.5830878",
"0.5830838",
"0.5826932",
"0.5824908",
"0.58113456",
"0.5809639",
"0.580412",
"0.5774599",
"0.57666534",
"0.57632214",
"0.5757924",
"0.5748887",
"0.57445836",
"0.57267",
"0.5722507",
"0.57071185",
"0.570061",
"0.569796",
"0.5697736",
"0.56952727",
"0.56942064",
"0.5685508",
"0.5671079",
"0.5664811",
"0.56583786"
] |
0.64916754
|
12
|
Returns true if other is an element of the Interval, false otherwise. In contrast to include? and member? this method does not take into account the date's precision.
|
def cover?(other)
return false unless other.is_a?(Date)
other = other.day_precision
case
when unknown_start?
max.day_precision! == other
when unknown_end?
min.day_precision! == other
when open_end?
min.day_precision! <= other
else
min.day_precision! <= other && other <= max.day_precision!
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ==(other)\n (other.is_a? Interval) && (@start == other.start && @end == other.end)\n end",
"def include?(other_period)\n inside?(other_period.starts_at) && inside?(other_period.ends_at)\n end",
"def overlaps?(other)\n \t((start_date - other.end_date) * (other.start_date - end_date)) >= 0\n \tend",
"def cover?(other)\n return false unless other.respond_to?(:day_precision)\n other = other.day_precision\n min.day_precision! <= other && other <= max.day_precision!\n end",
"def cover?(other_period)\n inside?(other_period.starts_at) || inside?(other_period.ends_at)\n end",
"def overlaps?(another)\n (start_date - another.end_date) * (another.start_date - end_date) >= 0\n end",
"def ==(other)\n if other.is_a?(IntervalSet)\n intervals.sort == other.intervals.sort\n else\n false\n end\n end",
"def overlaps?(other)\n start <= other.end_date && other.start <= self.end_date\n end",
"def within?(other)\n range_within_other?(self,other)\n end",
"def include?(new_date)\n return start_date <= new_date && end_date > new_date\n end",
"def overlaps?(other)\n\t\tself.start_date < other.end_date && other.start_date < self.end_date\n\tend",
"def covers?(*args)\n other = coerce_range(*args)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n self.begin <= other.begin and other.end <= self.end\n end\n end",
"def during?(other)\n if other.is_a? Numeric\n other_begin = other_end = other\n else\n other_begin, other_end = other.begin, other.end\n end\n\n self_begin, self_end = self.begin, self.end\n\n # Check if either of the two items begins during the\n # span of the other\n other_begin <= self_begin && self_begin <= other_end ||\n self_begin <= other_begin && other_begin <= self_end\n end",
"def include_range? other_range\n case other_range\n when Range\n if other_range.first >= self.first && other_range.last <= self.last\n return true\n else\n return false\n end\n else\n raise \"unsupported type\"\n end\n end",
"def include?(other)\n cover?(other) && precision == other.precision\n end",
"def ==(other)\n @intervals == other.intervals\n end",
"def interval?() triangulated? and complement.comparability?; end",
"def ==(other)\n return true if equal? other\n\n other.kind_of?(Range) and\n self.first == other.first and\n self.last == other.last and\n self.exclude_end? == other.exclude_end?\n \n end",
"def within?(other_slice)\r\n if ! other_slice.class == Slice\r\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\r\n end\r\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\r\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\r\n end\r\n\r\n self_range = self.start .. self.stop\r\n other_range = other_slice.start .. other_slice.stop\r\n\r\n if other_range.include?(self.start) and other_range.include?(self.stop)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def subsume?(other)\n range_within_other?(other,self)\n end",
"def within?(other_slice)\n if ! other_slice.class == Slice\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\n end\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\n end\n\n self_range = self.start .. self.stop\n other_range = other_slice.start .. other_slice.stop\n\n if other_range.include?(self.start) and other_range.include?(self.stop)\n return true\n else\n return false\n end\n end",
"def include?(object)\n object.start >= @start && object.end <= @end\n end",
"def range_include?(zelf, other)\n # 1...10 includes 1..9 but it does not include 1..10.\n operator = zelf.exclude_end? && !other.exclude_end? ? :< : :<=\n zelf.include?(other.first) && other.last.send(operator, zelf.last)\nend",
"def overlaps(other_date_range)\n if contains(other_date_range.start_date) || contains(other_date_range.end_date)\n true\n elsif other_date_range.contains(@start_date) && other_date_range.contains(@end_date)\n true\n else\n false\n end\n end",
"def intersects?(*args)\n other = coerce_range(*args)\n raise ArgumentError, \"#{self.begin.class} expected, received #{other.begin.class}\" unless other.begin.kind_of?(self.begin.class)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n other.begin < self.end and self.begin < other.end\n end\n end",
"def overlap?(interval_start, interval_end, ride)\n raise \"Invalid interval\" if interval_start>=interval_end\n if (ride.start_time > interval_end) || (ride.end_time<interval_start)\n return false \n else \n return true\n end \n\n end",
"def within_time_period?\n return true unless start_time || end_time\n\n if start_time && end_time\n (start_time..end_time).cover? Time.current\n elsif start_time\n Time.current >= start_time\n elsif end_time\n Time.current <= end_time\n end\n end",
"def overlaps?(other)\n # overlap == start < finish' AND start' < finish\n self.first <= other.actual_last and other.first <= self.actual_last\n end",
"def include?(date)\n unless date.instance_of?(Date)\n raise ArgumentError, \"Parameters must be of class Date\"\n end\n\n return date >= @start_date && date < @end_date\n end",
"def overlaps?(other); end",
"def overlaps?(other); end",
"def overlaps?(other); end",
"def contains?(other)\n (other.begin_pos <=> @begin_pos) + (@end_pos <=> other.end_pos) >= (other.empty? ? 2 : 1)\n end",
"def intersects?(other)\n @origin.keys.each do |axis|\n return false unless min_lte_max(axis, other) && max_gte_min(axis, other)\n end\n true\n end",
"def ===(other)\n case other\n when Date\n @days.include? Date.jd(other.jd) #in case it's a DateTime\n when Time\n @days.include? Date.civil(other.year, other.month, other.day)\n else\n super\n end\n end",
"def include?(tod)\n second = tod.to_i\n second += TimeOfDay::NUM_SECONDS_IN_DAY if second < @range.first\n @range.cover?(second)\n end",
"def correct?\n starts_at < ends_at && starts_at.to_date == ends_at.to_date\n end",
"def within?(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#within? not defined.\"\n end",
"def contains?(other)\n other.corners.all? { |corner| includes_point?(corner) }\n end",
"def contains?(date_or_time)\n starts_on <= date_or_time && date_or_time < ends_on\n end",
"def contained?(other); end",
"def contained?(other); end",
"def contained?(other); end",
"def meeting_conflict?(other)\n return false if self.start_time.nil? or other.start_time.nil?\n section_days = other.days.split(\"\")\n section_days.each do |day|\n if( self.days.include?(day) )\n if (self.start_time.to_i >= other.start_time.to_i and self.start_time.to_i <= other.end_time.to_i) or \n (other.start_time.to_i >= self.start_time.to_i and other.start_time.to_i <= self.end_time.to_i)\n return true\n end \n end\n end\n return false\n end",
"def contained?(other)\n center.distance(other.center) < (@r - other.r).abs\n end",
"def valid_start_and_end_dates?\n return false unless start.present? && self.end.present?\n start <= self.end\n end",
"def intersect?(o)\n self.class == o.class && !(@to < o.numeric_from || o.numeric_to < @from)\n end",
"def include?(other)\n `#{@el}.contains(#{DOM::NODE.get_element(other)})` || other == self\n end",
"def intersects?(other)\n raise \"NOT A CUBOID\" unless other.is_a? Cuboid \n self_range = range_finder\n other_range = other.range_finder\n\n self_range.each do |k,_|\n return false unless overlap?(self_range[k], other_range[k])\n end \n\n true \n end",
"def ==(other)\n # If lexically invalid, use regular literal testing\n return super unless self.valid?\n\n case other\n when Literal::Time\n return super unless other.valid?\n # Compare as strings, as time includes a date portion, and adjusting for UTC\n # can create a mismatch in the date portion.\n self.object.new_offset.strftime('%H%M%S.%L') == other.object.new_offset.strftime('%H%M%S.%L')\n when Literal::DateTime, Literal::Date\n false\n else\n super\n end\n end",
"def in_range?\n return self.range.include?([@x, @y])\n end",
"def same?(other)\n (from_end == other.from_end and\n to_end == other.to_end and\n overlap == other.overlap)\n end",
"def same?(other)\n (from_end == other.from_end and\n to_end == other.to_end and\n overlap == other.overlap)\n end",
"def overlap? range\n !(self & range).nil?\n end",
"def overlaps?\n self.class.all.any? do |other|\n (start_hour > other.start_hour && start_hour < other.end_hour) ||\n (end_hour > other.start_hour && end_hour < other.end_hour)\n end\n end",
"def ==(other)\n other.class == self.class &&\n other.start_date == @start_date &&\n other.end_date == @end_date\n end",
"def intersect(other_interval)\n if self.end <= other_interval.start || other_interval.end <= start\n nil\n else\n Interval.new([start, other_interval.start].max, [self.end, other_interval.end].min)\n end\n end",
"def overlap?(new_start_date, new_end_date)\n return(start_date <= new_end_date && end_date >= new_start_date) \n end",
"def fully_includes?(other)\n overlaps?(other) && other == intersection(other)\n end",
"def contains?(date_or_time)\n \t# TODO We need to make sure time zones are properly handled, probably!\n\n \tstarts_on <= date_or_time && date_or_time < ends_on\n end",
"def empty?\n\t interval.first == interval.last && interval.exclude_end?\n end",
"def overlap?(input_range)\n a = self.start_date >= input_range.end_date\n b = self.end_date <= input_range.start_date\n return a || b ? false : true \n end",
"def contains(date)\n if (date >= @start_date) && (date < @end_date)\n return true\n else\n date < @start_date || date >= @end_date\n return false\n end\n end",
"def date_range_overlap?(start_date_one, end_date_one, start_date_two, end_date_two)\n if start_date_one < end_date_two && start_date_two < end_date_one\n return true\n else\n return false\n end\n end",
"def overlaps?(other)\n cover?(other.begin) || other.cover?(first)\n end",
"def contained?(other)\n other.contains?(self)\n end",
"def same_time?(other)\n return false unless self.b == other.b\n return true if self.n.zero? && other.n.zero?\n self_div = Rational(self.n, self.d)\n other_div = Rational(other.n, other.d)\n self_div == other_div\n end",
"def contains?(_other)\n true\n end",
"def touching?(range)\n range.end == self.start || self.end == range.start\n end",
"def ===(instant)\n (instant >= self.begin) and (instant < self.end)\n end",
"def overlaps?(other)\n a, b = [self, other].map(&:range)\n #\n # Although a Shift which passes through midnight is stored\n # internally as lasting more than TimeOfDay::NUM_SECONDS_IN_DAY\n # seconds from midnight, that's not how it is meant to be\n # handled. Rather, it consists of two chunks:\n #\n # range.first => Midnight\n # Midnight => range.last\n #\n # The second one is *before* the first. None of it is more than\n # TimeOfDay::NUM_SECONDS_IN_DAY after midnight. We thus need to shift\n # each of our ranges to cover all overlapping possibilities.\n #\n one_day = TimeOfDay::NUM_SECONDS_IN_DAY\n ashifted =\n Range.new(a.first + one_day, a.last + one_day, a.exclude_end?)\n bshifted =\n Range.new(b.first + one_day, b.last + one_day, b.exclude_end?)\n #\n # For exclusive ranges we need:\n #\n # a.ending > b.beginning && b.ending > a.beginning\n #\n # and for inclusive we need:\n #\n # a.ending >= b.beginning && b.ending >= a.beginning\n #\n aop = a.exclude_end? ? :> : :>=\n bop = b.exclude_end? ? :> : :>=\n #\n (a.last.send(aop, b.first) && b.last.send(bop, a.first)) ||\n (ashifted.last.send(aop, b.first) && b.last.send(bop, ashifted.first)) ||\n (a.last.send(aop, bshifted.first) && bshifted.last.send(bop, a.first))\n end",
"def ==(other)\n return false unless other\n return false unless other.respond_to?(:frequency) && other.frequency == frequency\n return false unless other.respond_to?(:day_of_week) && other.day_of_week == day_of_week\n return false unless time_attribute_equal(other, :start_at)\n return false unless time_attribute_equal(other, :end_on)\n true\n end",
"def overlaps?(other_slice)\r\n if ! other_slice.class == Slice\r\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\r\n end\r\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\r\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\r\n end\r\n\r\n self_range = self.start .. self.stop\r\n other_range = other_slice.start .. other_slice.stop\r\n\r\n if self_range.include?(other_slice.start) or other_range.include?(self.start)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def includes?(date)\n false\n end",
"def overlaps?(other_slice)\n if ! other_slice.class == Slice\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\n end\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\n end\n\n self_range = self.start .. self.stop\n other_range = other_slice.start .. other_slice.stop\n\n if self_range.include?(other_slice.start) or other_range.include?(self.start)\n return true\n else\n return false\n end\n end",
"def ==(another_date)\n return false if self.precision != another_date.precision\n self.to_datetime == another_date.to_datetime\n end",
"def nearly?(other); end",
"def one_day?\n @start_date == @end_date\n end",
"def contains?(value)\n start_time = low.to_time_object\n end_time = high.to_time_object\n time = value.to_time_object\n \n time.between?(start_time, end_time)\n end",
"def overlaps_with?(other_meeting) \n if day == other_meeting.day\n if (other_meeting.start_time < end_time) && (other_meeting.end_time > start_time)\n return true\n end\n end\n return false\n end",
"def overlap?(self_range, other_range)\n return true if self_range == other_range \n overlap_helper(self_range, other_range) || overlap_helper(other_range, self_range)\n end",
"def intersects?(other)\n !!intersection_with(other)\n end",
"def matches? invoice\n invoice.order_date.between?(time_range.first, time_range.last)\n end",
"def relevant_time?\n\t\tself.start < Time.now && self.end >Time.now \n\tend",
"def meets?(*args)\n other = coerce_range(*args)\n self.begin == other.end or other.begin == self.end\n end",
"def include?(tod)\n if ending >= beginning\n tod >= beginning && tod <= ending\n else\n start_of_day = TimeOfDay.new(0,0,0)\n end_of_day = TimeOfDay.new(23,59,59)\n (tod >= beginning && tod <= end_of_day) || (tod >= start_of_day && tod <= ending)\n end\n end",
"def overlaps_with?(other_obj) \n self.meetings.each do |self_meeting|\n other_obj.meetings.each do |other_meeting|\n return true if self_meeting.overlaps_with? other_meeting\n end\n end\n return false\n end",
"def overlaps_with?(other_obj) \n self.meetings.each do |self_meeting|\n other_obj.meetings.each do |other_meeting|\n return true if self_meeting.overlaps_with? other_meeting\n end\n end\n return false\n end",
"def date_in_range?(first, date, last)\n first <= date && date <= last\n end",
"def overlaps?(other)\n !disjoint?(other)\n end",
"def overlaps?(other)\n !disjoint?(other)\n end",
"def intersects?(other)\n return false if self.equal?(other)\n !(above?(other) || below?(other) || right_of?(other) || left_of?(other) || behind?(other) || in_front_of?(other))\n end",
"def after?(other)\n time = other.is_a?(Numeric) ? other : other.end\n self.begin >= time\n end",
"def == other\n return true if equal?(other) # save some time\n return false unless other.respond_to?(:to_a)\n e1s = to_a\n e2s = other.to_a\n e1s.size == e2s.size && e1s.all? { |e1| e2s.include? e1 }\n end",
"def whole?\n floor == self\n end",
"def disjoint?(other)\n if empty? && other.empty?\n @begin_pos != other.begin_pos\n else\n @begin_pos >= other.end_pos || other.begin_pos >= @end_pos\n end\n end",
"def >(other)\n return true if self.hour > other.hour\n return false if self.hour < other.hour\n\n self.minute > other.minute\n end",
"def include?(x)\n inf <= x && x <= sup\n end",
"def date_include?(date_range)\n # if date >= @checkin_date && date <= @checkout_date\n start_date = date_range.checkin_date\n end_date = date_range.checkout_date\n\n if start_date >= @checkin_date && end_date <= @checkout_date\n return true\n else\n return false\n end\n end",
"def included_in?(other_rect)\n self == self.intersects(other_rect)\n end"
] |
[
"0.7302837",
"0.69987863",
"0.67549866",
"0.67513996",
"0.6725566",
"0.66782063",
"0.6575283",
"0.6541723",
"0.65208596",
"0.64751375",
"0.64416236",
"0.63693357",
"0.63570666",
"0.6341641",
"0.62857884",
"0.6276853",
"0.6181933",
"0.6176552",
"0.6151782",
"0.614197",
"0.6127959",
"0.61259776",
"0.6123379",
"0.6057886",
"0.60394293",
"0.60308874",
"0.6020248",
"0.6016657",
"0.6008916",
"0.6005743",
"0.6005743",
"0.6005743",
"0.599131",
"0.5978839",
"0.5975032",
"0.5964105",
"0.5904697",
"0.5896061",
"0.5881336",
"0.5870926",
"0.58584833",
"0.58584833",
"0.58584833",
"0.58497536",
"0.58496404",
"0.58451587",
"0.5843351",
"0.58419764",
"0.5837459",
"0.5831634",
"0.58290315",
"0.5815896",
"0.5815896",
"0.58113",
"0.5810428",
"0.58090526",
"0.58072734",
"0.58008564",
"0.5797087",
"0.5796404",
"0.5792727",
"0.57759404",
"0.57725984",
"0.576964",
"0.5767364",
"0.5765259",
"0.5762921",
"0.57613426",
"0.57509255",
"0.5745011",
"0.5744079",
"0.574116",
"0.5735277",
"0.5714072",
"0.5711099",
"0.56954455",
"0.5691696",
"0.5685235",
"0.5679667",
"0.566",
"0.563403",
"0.561287",
"0.5601803",
"0.5595896",
"0.5595881",
"0.55820996",
"0.558035",
"0.558035",
"0.557555",
"0.55696774",
"0.55696774",
"0.55648273",
"0.55625236",
"0.5548035",
"0.55380654",
"0.55375165",
"0.5529112",
"0.55282444",
"0.5519501",
"0.5512868"
] |
0.6979866
|
2
|
callseq: interval.first > Date or nil interval.first(n) > Array Returns the first date in the interval, or the first n dates.
|
def first(n = 1)
if n > 1
(ds = Array(min)).empty? ? ds : ds.concat(ds[0].next(n - 1))
else
min
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def first_date\n events.order(:date).first.date.to_date rescue nil\n end",
"def first_occurrence_on_or_after(date)\n raise NotImplementedError\n end",
"def min\n dates.first\n end",
"def first(*n) end",
"def first(*args)\n find_first_or_last(:first, *args)\n end",
"def first\n limit(1).to_a.first\n end",
"def first(start, fin)\n start ||= Time.at(0)\n fin ||= Time.now\n self.reports.start(start,fin).first\n end",
"def first(*args)\n argv = to_pointer([\"first\"] + args)\n date = rrd_first(args.size+1, argv)\n return false if date == -1\n date\n ensure\n free_pointers\n end",
"def first_day\n @date - @date.mday + 1\n end",
"def find_first\n Period.order(\"begins_at ASC\").first\n end",
"def first(n = nil)\n if n\n apply_scope(:first, n)\n else\n self[0]\n end\n end",
"def first\n @range.first\n end",
"def first_period\n return @first_period\n end",
"def first_day\n if self.attendances.any? \n Service.find(self.attendances.map {|a| a.service_id }).min_by { |s| s.service_date }.service_date.to_date\n else\n nil\n end\n end",
"def first list, n=nil\n n ? list.first(n) : list.first\nend",
"def first_day\n if @freq == :weekly || (@freq == :monthly && @by_day)\n days = decode_by_day\n first_day = days.sort {|x,y| x[1] <=> y[1] }.first\n days.index(first_day)\n end\n end",
"def first list, n = 1\n n == 1 ? list.first : list.first(n)\nend",
"def first_day\n @first_day ||= months.first.first_day\n end",
"def first(n = nil)\n if n\n self[0,n]\n else\n self[0]\n end\n end",
"def first(n = 1)\n return self.clone if n >= self.size\n return self[0] if n == 1\n return self[0...n]\n end",
"def first_day\n @first_day ||= Date.new(year_number, month_number, 1)\n end",
"def first_event_date\n events.blank? ? start_date : events.first.date\n end",
"def first(numbers, int)\n numbers.first(int)\nend",
"def between(first_date, last_date)\n return [] if first_date > last_date\n current_date = first_date\n active_dates = []\n until current_date >= last_date\n active_dates << current_date if active?(current_date)\n current_date = current_date.next_day\n end\n\n active_dates\n rescue NoMethodError\n p 'provided date is not of valid type'\n nil\n end",
"def first(series, control, count=1)\n slice(series, control, 0, count-1)\n end",
"def first() end",
"def first(*args)\n all.send(:first, *args)\n end",
"def get_periods(first_start, first_end) \n\t\tperiods = []\n\n\t\tnot_ends = \n\t\t\t(@until.is_a? Fixnum) ?\n\t\t\tlambda {|i,d| i < @until} :\n\t\t\tlambda {|i,d| d < @until}\n\n\t\tduration = first_end - first_start\n\t\tcurrent_start = first_start\n\n\t\ti = 0\n\t\tcount = 0\n\t\twhile not_ends.call(count, current_start)\n\t\t\tperiods << [current_start, current_start + duration]\n\n\t\t\ti += 1\n\t\t\t# get first month that has given day number\n\t\t\ti+=1 while (first_start << -(i * @period_duration)).day != first_start.day\n\n\t\t\tcurrent_start = (first_start << -(i * @period_duration))\n\t\t\tcount += 1 \n\t\tend\n\n\t\tperiods\n\tend",
"def first(limit = 1)\n take(limit)\n end",
"def range_start; range.first; end",
"def first\n self.take(1)[0]\n end",
"def first\n all[0]\n end",
"def using_first(array)\n array.first\nend",
"def using_first(array)\n array.first\nend",
"def using_first(array)\n array.first\nend",
"def using_first(array)\n array.first\nend",
"def first(n=1)\n return values[0] if self.class == BaseRelation && loaded && n == 1\n result = limit(n).load\n result.length == 1 ? result[0] : result\n end",
"def start_date\n @records.min { |a,b| a[:date] <=> b[:date] }[:date]\n end",
"def first(limit = 1)\n self[0..(limit - 1)]\n end",
"def custom_first(arr,num=0)\n return arr[0] if num==0\n arr[0...num]\nend",
"def find_first(*args)\n id = get_range(:count => 1, *args).first\n id && find_one(id, *args)\n end",
"def get_first\n raise NotImplementedError, \"Please implement get_first\"\n end",
"def first\n to_a.first\n end",
"def using_first(array)\narray.first\nend",
"def custom_first(arr, num= 0)\n arr[0..num]\nend",
"def select_first!\n limit(1).select!.first\n end",
"def first_event(array)\n array.first\nend",
"def first(n = 1, after: nil, &block)\n return super(n, &block) unless after\n\n if include? after\n first_item_after after, n\n else\n super(n) { |item| item.after? after }\n end\n end",
"def first(*args)\n find(:first, *args)\n end",
"def first(*args)\n find(:first, *args)\n end",
"def bound_first(first)\n if first < 1 then 1 else first end\n end",
"def [](n)\n # TODO: check bounds like year.day[400] should fail\n # but this is difficult because day won't know it came from year\n \n # TODO: allow indexing from 'last', eg year.day[-1] => <Dec 31 year>\n # which hass similar problem: how does day know it came from year?\n self.duration.new(n-1).after(self)\n end",
"def get_first_element(arr)\n return arr.first()\nend",
"def using_first(array)\n first_element=array.first\nend",
"def gen_date(documents, events)\n today = Date.today\n dates = (documents + events).map { |doc|\n # For each item, parse it's last value into a date\n begin\n Date.parse doc.last\n rescue\n nil\n end\n # Reject any dates that are nil\n # Select those dates that are before today (have already happened)\n }.reject { |date| date.nil? }.select { |date| date <= today }.reverse\n\n # Choose the most recent date\n dates.last\nend",
"def first(*args)\n find(:first, *args)\n end",
"def first(*args)\n query = scoped_query(args.last.respond_to?(:merge) ? args.pop : {})\n\n if args.any?\n new_collection(query).first(*args)\n else\n query.repository.read(query.update(:limit => 1)).first\n end\n end",
"def second_timerange(first)\n case @conditions[:breakdown_type]\n when \"Weekly\"\n first + 6\n when \"Quarterly\"\n Date.parse(increase_arr(first.to_s.split(\"-\").map{|x| x.to_i}).join(\"-\")) - 1\n when \"Daily\"\n first\n when \"Yearly\"\n Date.parse(first.year.to_s + \"-12-31\")\n when \"Monthly\"\n month = first.month\n year = first.year\n month += 1\n if month > 12\n year += 1\n month -= 12\n end\n Date.parse(\"#{year}-#{month}-01\") - 1\n else\n raise NoMethodError\n end\n end",
"def first(n = T.unsafe(nil)); end",
"def first(n = T.unsafe(nil)); end",
"def custom_first(arr,num=0)\n l = arr.length\n if num==0\n arr[0]\n else\n (num<l)? arr[0...num] : arr[0...l]\n end\nend",
"def find_first(value,start,stop)\n return start if time_at(start) > value\n find(:first,value,start,stop)\n end",
"def first_of(arr)\n return arr[0]\nend",
"def first_of(arr)\n return arr[0]\nend",
"def first_of(arr)\n return arr[0]\nend",
"def first ; list.first ; end",
"def slice(start_x, end_x)\n if start_x.class == Fixnum\n if end_x.class == Fixnum\n dates[(start_x-1)..(end_x-1)]\n else\n dates[start_x-1..-1].select{|d| d <= end_x}\n end\n elsif start_x.class ==Date \n if end_x.class == Date\n dates.select{|d| d >= start_x and d <= end_x}\n else\n dates.select{|d| d >= start_x}[0..end_x-1]\n end\n end\n end",
"def default_range\n\t\t(measurements.first.date..Date.today)\n\tend",
"def first; end",
"def first; end",
"def first(arr)\n return arr[0]\nend",
"def custom_first(arr, num_of_elements = 0)\n return arr[0] if num_of_elements == 0\n arr[0, num_of_elements]\nend",
"def first_xday( x )\n\t\to = offset( first_day.cwday )\n i = ( x - o ) + ( ( x < o ) ? Month::DPW : 0 )\n\n\t\t(first_day + i)\n end",
"def first\n end",
"def on(date)\n between(date, date).first\n end",
"def first_of_month\n Date.new(self.year, self.month)\n end",
"def first_of(array)\n return array[0]\nend",
"def first_of(array)\n return array[0]\nend",
"def first(options = {})\n opts = options.dup\n opts.merge!(:limit => [0, 1])\n\n if opts[:by]\n sort_by(opts.delete(:by), opts).first\n else\n sort(opts).first\n end\n end",
"def getFirstSundays(d1,d2)\n d1 += 1 while (d1.mday != 1) unless d1.mday == 1\n firstSundays = []\n while d1 < d2\n d1 = d1 >> 1 # add a month\n firstSundays .push d1 if d1.wday == 0\n end\n firstSundays\nend",
"def get_this_one(number)\n case @conditions[:breakdown_type]\n when \"Weekly\"\n @start_date + (7*number)\n when \"Quarterly\"\n d = @start_date.to_s.split(\"-\").map{|x| x.to_i}\n number.times{|x|\n d = increase_arr(d)\n }\n Date.parse(d.map{|x| x.to_s}.join(\"-\"))\n when \"Daily w/weekends\" # NOT ACTUALLY used.\n @start_date + number\n when \"Daily\"\n date = @start_date + number\n if [0,1].include?(date.wday) # MEEP. the hard coded sunday and monday are *HORRIBLE*\n return nil\n else\n return date\n end\n when \"Yearly\"\n Date.parse((@start_date.year + number).to_s + \"-01-01\")\n when \"Monthly\"\n month = @start_date.month\n year = @start_date.year\n month += number\n while month > 12\n year += 1\n month -= 12\n end\n Date.parse(\"#{year}-#{month}-01\")\n else\n raise NoMethodError\n end\n end",
"def first\n result ? all.first : limit(1).all.first\n end",
"def nth_from_array_or_range\n C.curry.(\n ->(xs, n) {\n xs.is_a?(Range) ? xs.first(n) : S.take.(xs, n)\n }\n )\n end",
"def find_next_non_specific(date)\n values = ['first', 'second', 'third', 'fourth']\n\n case @schedule.days_month\n when 'last'\n d = Date.new(date.year, date.month, -1)\n\n return d if @schedule.days_month_day == nil\n\n d -= ((d.wday - @schedule.days_month_day) % 7)\n\n if d < date\n d = d.at_beginning_of_month\n\n months_since_startdate = (d.year * 12 + d.month) - (@schedule.start_date.year * 12 + @schedule.start_date.month)\n \n months_to_add = @schedule.period_num\n if (months_since_startdate % @schedule.period_num) > 0\n months_to_add = @schedule.period_num - (months_since_startdate % @schedule.period_num)\n end\n\n d += months_to_add.months\n return find_next_non_specific(d)\n end\n\n return d\n else\n if @schedule.days_month_day == nil\n if values.index(@schedule.days_month) + 1 < date.day\n months_to_add = @schedule.period_num\n months_since_startdate = (date.year * 12 + date.month) - (@schedule.start_date.year * 12 + @schedule.start_date.month)\n if (months_since_startdate % @schedule.period_num) > 0\n months_to_add = @schedule.period_num - (months_since_startdate % @schedule.period_num)\n end\n date += months_to_add.months\n end\n \n return Date.new(date.year, date.month, values.index(@schedule.days_month)+1) if @schedule.days_month_day == nil\n end\n \n d = Date.new(date.year, date.month, 1)\n d += (@schedule.days_month_day - d.wday) % 7\n d += (7 * values.index(@schedule.days_month))\n\n if d < date\n d = d.at_beginning_of_month\n\n months_since_startdate = (d.year * 12 + d.month) - (@schedule.start_date.year * 12 + @schedule.start_date.month)\n \n months_to_add = @schedule.period_num\n if (months_since_startdate % @schedule.period_num) > 0\n months_to_add = @schedule.period_num - (months_since_startdate % @schedule.period_num)\n end\n\n d += months_to_add.months\n\n d = Date.new(d.year, d.month, 1)\n d += (@schedule.days_month_day - d.wday) % 7\n d += (7 * values.index(@schedule.days_month))\n end\n\n return d\n end\n end",
"def get_first_element(arr)\n arr.first\nend",
"def is_first_for_day?\n Entry.for_date(self.date).first == self\n end",
"def first\n enumerator(:limit => 1).first \n end",
"def first\n @values.first\n end",
"def first!(list)\n list.last\n end",
"def first(*args)\n last_arg = args.last\n\n limit = args.first if args.first.kind_of?(Integer)\n with_query = last_arg.respond_to?(:merge) && !last_arg.blank?\n\n query = with_query ? last_arg : {}\n query = scoped_query(query.merge(:limit => limit || 1))\n\n if !with_query && (loaded? || lazy_possible?(head, limit || 1))\n if limit\n new_collection(query, super(limit))\n else\n super()\n end\n else\n if limit\n all(query)\n else\n relate_resource(query.repository.read_one(query))\n end\n end\n end",
"def first\n all.first\n end",
"def first\n all.first\n end",
"def first\n all.first\n end",
"def first\n all.first\n end",
"def first\n self.slice(0)\n end",
"def series(start,count=1)\n o=object=nil\n Array.new(count){o=o.blank? ? start : o.succ}\n end",
"def pick_first?(day1, day2)\n if day1[:days] * day2[:fee] < day1[:fee] * day2[:days]\n return 1\n elsif day1[:days] * day2[:fee] == day1[:fee] * day2[:days]\n return 0\n else\n return -1\n end\nend",
"def first\n @charts.first\n end",
"def first\r\n self[0]\r\n end",
"def first(*vars)\n result = Query.get params(:size => 1), *vars\n docs = result.get_docs\n docs.is_a?(Array) ? docs.first : docs\n end"
] |
[
"0.63344866",
"0.6168862",
"0.5958597",
"0.59546506",
"0.5951028",
"0.5939679",
"0.58875775",
"0.58778036",
"0.5875005",
"0.5864412",
"0.58169186",
"0.5789508",
"0.5772541",
"0.57531565",
"0.5743028",
"0.5708742",
"0.5708482",
"0.5685088",
"0.56689173",
"0.56489146",
"0.5588898",
"0.55688787",
"0.5533611",
"0.54650426",
"0.54506177",
"0.544523",
"0.54191434",
"0.5417756",
"0.5384667",
"0.5337135",
"0.5331322",
"0.53149736",
"0.5295844",
"0.5295844",
"0.5295844",
"0.5295844",
"0.5294786",
"0.52886975",
"0.52642494",
"0.5253161",
"0.52529234",
"0.5241506",
"0.5230378",
"0.52205825",
"0.52193916",
"0.52105594",
"0.5203353",
"0.5185892",
"0.5184615",
"0.5184615",
"0.51792425",
"0.51770955",
"0.51751757",
"0.51731324",
"0.51705474",
"0.5169581",
"0.5126437",
"0.51238185",
"0.5102013",
"0.5102013",
"0.5098285",
"0.5093965",
"0.50913954",
"0.50913954",
"0.50913954",
"0.50897765",
"0.50893414",
"0.50795853",
"0.50774515",
"0.50774515",
"0.50733274",
"0.5068626",
"0.5064475",
"0.50621486",
"0.5060972",
"0.5049626",
"0.50402826",
"0.50402826",
"0.50394326",
"0.50268614",
"0.50266474",
"0.5020271",
"0.501848",
"0.5015173",
"0.5007617",
"0.50020885",
"0.49828577",
"0.49823824",
"0.4980187",
"0.49770963",
"0.49652556",
"0.49652556",
"0.49652556",
"0.49652556",
"0.495806",
"0.4952333",
"0.4948653",
"0.494067",
"0.4933608",
"0.4923323"
] |
0.5797969
|
11
|
callseq: interval.last > Date or nil interval.last(n) > Array Returns the last date in the interval, or the last n dates.
|
def last(n = 1)
if n > 1
(ds = Array(max)).empty? ? ds : ds.concat(ds[0].prev(n - 1))
else
max
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def last(*n) end",
"def last(n = nil)\n if n\n self[-n..-1]\n else\n self[-1]\n end\n end",
"def last(*args)\n find_first_or_last(:last, *args)\n end",
"def last(*args)\n all.send(:last, *args)\n end",
"def last(*args)\n find(:last, *args)\n end",
"def last(*args)\n find(:last, *args)\n end",
"def last(*args)\n find(:last, *args)\n end",
"def last(n=nil)\n return self[-1] if n.nil?\n \n start = length-n\n start = 0 if start < 0\n self[start, n]\n end",
"def using_last(array)\n array.last\n# returns last item in array \nend",
"def last(*args)\n argv = to_pointer([\"last\"] + args)\n date = rrd_last(args.size+1, argv)\n return false if date == -1\n date\n ensure\n free_pointers\n end",
"def last(options={})\r\n find(:last, options)\r\n end",
"def max\n dates.last \n end",
"def last(n = 1)\n return self.clone if n >= self.size\n return self[-1] if n == 1\n return self.reverse[0...n].reverse\n end",
"def last n=nil\n if n.nil? or n == 1\n return the_last\n elsif n <= 0\n return Cons[]\n else\n return nthcdr length-n\n end\n end",
"def last(list)\n list[-1]\nend",
"def last(options={})\n get(\"last\", options)\n end",
"def last_date\n events.order(:date).last.date.to_date rescue nil\n end",
"def last\n to_a.last\n end",
"def together_last(index = nil)\n if_not_contain_array_rails_type_error\n each_return = index == 0 ? '[]' : index.nil? ? 'list.last' : 'list.last(index)'\n reduce([]) { |ret, list|ret << eval(each_return, binding) }\n end",
"def last\n all[all.size - 1]\n end",
"def last(numbers, int)\n numbers.last(int)\nend",
"def using_last(array)\n array.last\nend",
"def using_last(array)\n array.last\nend",
"def last(series, control, count=1)\n slice(series, control, count * -1, -1)\n end",
"def last\n @range.last\n end",
"def last(array)\n array[-1]\nend",
"def last_period_dates(period_type)\n send(\"last_#{period_type}_dates\")\n end",
"def using_last(array)\narray.last\nend",
"def using_last(array)\n last_element=array.last\nend",
"def last\n at(-1)\n end",
"def last\r\n self[-1]\r\n end",
"def last(now = @time_source.now, num=1)\n t = InternalTime.new(now,@time_source)\n\n unless time_specs[:month][0].include?(t.month)\n nudge_month(t, :last)\n t.day = 32\n end\n\n if t.day == 32 || !interpolate_weekdays(t.year, t.month)[0].include?(t.day)\n nudge_date(t, :last)\n t.hour = 24\n end\n\n unless time_specs[:hour][0].include?(t.hour)\n nudge_hour(t, :last)\n t.min = 60\n end\n\n # always nudge the minute\n nudge_minute(t, :last)\n t = t.to_time\n if num > 1\n recursive_calculate(:last,t,num)\n else\n t\n end\n end",
"def last; end",
"def last; end",
"def last; end",
"def last\n @tail.val\n end",
"def last\n end",
"def last\n out = nil\n\n each {|i| out = i }\n\n out\n end",
"def last(num = nil)\n return @all.last num if num\n @all.last\n end",
"def last\n self[-1]\n end",
"def last\n result ? all.last : limit(1).descending.all.last\n end",
"def last\n self[-1]\n end",
"def last\n all.last\n end",
"def last_of(arr)\n return arr[arr.length-1]\nend",
"def last() end",
"def last_of(arr)\n return arr[-1]\nend",
"def last(gauges)\n gauges.values.last\n end",
"def last_of(array)\n return array[-1]\nend",
"def last\n @tail\n end",
"def last(*vars)\n result = Query.get params(:from => count-1, :size => 1), *vars\n docs = result.get_docs\n docs.is_a?(Array) ? docs.first : docs\n end",
"def last(n = 1)\n return @history[-n] ;\n end",
"def last\n @rarray.reverse.first \n end",
"def last_element(array)\n array[-1]\nend",
"def last_of(arr)\n output = arr[-1]\n return output\nend",
"def get_last_item(arr)\n\treturn arr[-1]\nend",
"def last\n @values.last\n end",
"def lastElement(arr)\n return arr[arr.length - 1]\nend",
"def last\n self.slice(self.size - 1)\n end",
"def last_element_with_array_methods(array)\n array.last\nend",
"def get_last\n raise NotImplementedError, \"Please implement get_last\"\n end",
"def retrieve_last_element_from_array(array)\n return array[-1]\nend",
"def retrieve_last_element_from_array(array)\n array[array.length-1]\nend",
"def last_interval_length\n entries.select(\"DISTINCT(date)\").where(day_or_night: 'day', interval_position: entries.maximum(:interval_position)).count\n end",
"def last(*args)\n last_arg = args.last\n\n limit = args.first if args.first.kind_of?(Integer)\n with_query = last_arg.respond_to?(:merge) && !last_arg.blank?\n\n query = with_query ? last_arg : {}\n query = scoped_query(query.merge(:limit => limit || 1)).reverse\n\n # tell the Query to prepend each result from the adapter\n query.update(:add_reversed => !query.add_reversed?)\n\n if !with_query && (loaded? || lazy_possible?(tail, limit || 1))\n if limit\n new_collection(query, super(limit))\n else\n super()\n end\n else\n if limit\n all(query)\n else\n relate_resource(query.repository.read_one(query))\n end\n end\n end",
"def last(limit = 1)\n reverse.take(limit).reverse\n end",
"def last\n all.last\n end",
"def last\n all.last\n end",
"def last\n all.last\n end",
"def last\n all.last\n end",
"def last(limit = 1)\n from(-limit) || self\n end",
"def last_day\n @last_day ||= months.last.last_day\n end",
"def retrieve_last_element_from_array(array)\n array.last\nend",
"def last_of(array)\n return array[array.length - 1]\nend",
"def last_of(array)\n return array[array.length - 1]\nend",
"def last_day\n @last_day ||= Date.new(year_number, month_number, -1)\n end",
"def lastof(arr)\n return arr[arr.length - 1]\nend",
"def end_date\n @records.max { |a,b| a[:date] <=> b[:date] }[:date]\n end",
"def last\n\t\t\t@last\n\t\tend",
"def last\n all.last\n end",
"def last\n all.last\n end",
"def last\n return each\n end",
"def last\n all.last\n end",
"def last_of(arr)\n index = arr.length\n return arr[index -1]\nend",
"def last\n self[*Array.new(self.dim, -1)]\n end",
"def last_item(elective_array)\n return elective_array[-1]\nend",
"def last\n list.first\n end",
"def last\n list = self\n list = list.tail until list.tail.empty?\n list.head\n end",
"def last_two(array)\n array.last(2)\nend",
"def last!\n last || raise_record_not_found_exception!\n end",
"def determine_latest_date(times, last_changed)\n # Sort with latest date first\n return nil unless last_changed\n changes_sorted = last_changed.sort.reverse\n changes_sorted.each do |c|\n # all changes_sorted have to be equal or greater than times[:first], otherwise Solr would have had\n # zero results for this, we just want the first one earlier than :last\n return c if c <= times[:last] && c >= times[:first]\n end\n # If we get down here we have a big problem, because there should have been at least one date earlier than times[:last]\n raise 'Error finding latest changed date, failed to find one'\n end",
"def last\n return [] unless @init\n @init.last\n end",
"def last *a; self.child(*a) + ':last-child' end",
"def get_last\n return @tail ? @tail.data : nil\n end",
"def tail\n @values[1..-1]\n end",
"def values\n map(&:last)\n end",
"def last?; end",
"def last\r\n\t\t@set.last\r\n\tend",
"def last_index\n @last_index\n end",
"def recent(n)\n\t \tin_order.endmost(n)\n\t end",
"def last(*input) \n input[-1].is_a?(String) ? input[-1][-1] : input.flatten[-1]\nend"
] |
[
"0.67980504",
"0.65723825",
"0.65369636",
"0.64085746",
"0.6367736",
"0.6367736",
"0.6355523",
"0.6320057",
"0.6226933",
"0.6207914",
"0.61871874",
"0.6175754",
"0.61752117",
"0.6169291",
"0.6168634",
"0.61500865",
"0.6137273",
"0.61318827",
"0.61221385",
"0.61212575",
"0.61205286",
"0.6103357",
"0.6103357",
"0.6089534",
"0.60880023",
"0.6072683",
"0.60686815",
"0.60665816",
"0.604896",
"0.602351",
"0.6008875",
"0.59733355",
"0.5972255",
"0.5972255",
"0.5972255",
"0.5939967",
"0.5935261",
"0.59296024",
"0.59250253",
"0.59237444",
"0.5907747",
"0.59058136",
"0.5900174",
"0.58845586",
"0.5883587",
"0.58822286",
"0.5873674",
"0.5861454",
"0.5861182",
"0.58518547",
"0.58441377",
"0.5835033",
"0.5830081",
"0.5818594",
"0.58167183",
"0.58142346",
"0.5812605",
"0.5804997",
"0.5793036",
"0.57926303",
"0.57896733",
"0.5780684",
"0.57759917",
"0.577536",
"0.5769049",
"0.57665",
"0.57665",
"0.57665",
"0.57665",
"0.5759771",
"0.57588154",
"0.57567656",
"0.57521975",
"0.57521975",
"0.5744357",
"0.5734037",
"0.5732348",
"0.5720249",
"0.5710325",
"0.5710325",
"0.5695016",
"0.56629026",
"0.5658782",
"0.5634252",
"0.561144",
"0.5608741",
"0.5562285",
"0.54975176",
"0.548707",
"0.5479695",
"0.5477761",
"0.54481435",
"0.5447573",
"0.5440297",
"0.5438343",
"0.5433131",
"0.54201925",
"0.5388732",
"0.5371176",
"0.5355427"
] |
0.65094006
|
3
|
Returns the Interval as an EDTF string.
|
def edtf
[
from.send(from.respond_to?(:edtf) ? :edtf : :to_s),
to.send(to.respond_to?(:edtf) ? :edtf : :to_s)
] * '/'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def tir_f\n format_f(self.tir)\n end",
"def toString\n sprintf('%6.2f', @value) + \" \" + @unit\n end",
"def to_s\n @value.to_f.to_s\n end",
"def to_s ; format ; end",
"def to_s\n [\"#<Timeloop period=#{period}\",\n max < Float::INFINITY ? \", max=#{max}\" : \"\",\n \">\"].join\n end",
"def interval_string\n str = 'None'\n str = 'Weekly' if interval == 7 \n str = '2 Weeks' if interval == 14\n str = '3 Weeks' if interval == 21\n str = '4 weeks' if interval == 28\n str\n end",
"def to_s\n \"#{symbol.name}#{range.to_string(0)}\"\n end",
"def to_s\n return \"#{fraction.to_s}\"\n end",
"def interval_as_time_string\n hms = interval_as_hours_minutes_seconds\n hms.shift if hms.first == 0\n #make sure seconds column is zero-padded and, if there are\n #hours, do the same to the minutes column\n (1 - hms.count .. -1).each{|i| hms[i] = hms[i].to_s.rjust(2, '0') }\n hms.join(\":\")\n end",
"def to_s\n format\n end",
"def to_s\n \"#{xnow},#{ynow}\"\n end",
"def to_s\n if self.is_blank_interval\n #is blank interval --> <% 17>\n stimulusText='<% '+self.duration.to_s+'>'\n else\n #is not blank interval\n stimulusText='\"'+self.text+'\"'\n if self.stimulus_type==\"wav\"\n #is sound\n if self.synchronise_with_next==true\n stimulusText='<svp start> '+stimulusText\n end\n stimulusText='<'+self.stimulus_type+'> '+stimulusText\n \n else \n if self.stimulus_type==\"bmp\"||self.stimulus_type==\"jpg\"\n #is image\n stimulusText=' <'+self.stimulus_type+' '+self.top_possition.to_s+', '+self.left_possition.to_s+'> '+stimulusText \n else\n #is text\n #add line\n stimulusText=\"<Line \"+self.present_in_line.to_s+\"> \"+stimulusText\n end\n #add the duration of the stimulus (NOT FOR AUDIO STIMULUS?????)\n stimulusText=stimulusText+' <% '+self.duration.to_s+'>'\n end\n if self.not_erase_previous\n stimulusText=\"!\"+stimulusText\n end\n \n \n #add symbol \"/\" at the end of the stimulus or not\n if self.clear_screen\n stimulusText=stimulusText+\" /\"\n else\n stimulusText=stimulusText+\",\"\n end\n end\n stimulusText\n end",
"def to_s\n @string || @object.strftime(FORMAT)\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n \"ARGF\"\n end",
"def to_s\n \"FiscalYear #{ year }: #{ fd(days.first) } to #{ fd(days.last) }\"\n end",
"def to_s\n \"#{symbol} #{local_range.begin}-#{local_range.end} #{timevec.length}\"\n end",
"def to_s\n \"time sig #{@data[0]}/#{2**@data[1]}\"\n end",
"def to_s(reference_note=Note.new(c4, 4))\n [ times_segment,\n fraction,\n tuplet_opening_tag,\n tuplet_contents(reference_note),\n tuplet_closing_tag\n ].join(\" \")\n end",
"def to_s\n @string || @object.strftime(FORMAT).sub(\"+00:00\", 'Z').sub('.000', '')\n end",
"def to_s\n @string || @object.strftime(FORMAT).sub(\"+00:00\", 'Z').sub('.000', '')\n end",
"def to_s\n \"#{( \"%.f\" % @value )}#{'%'} \"\n end",
"def to_s\n s = @display.strftime(time_format)\n case @display_granularity\n when :ten_minute\n s.chop!\n s << \"~\"\n when :one_hour\n s.chop!\n s.chop!\n s << \"~~\"\n end\n return s\n end",
"def to_s\n\t\treturn \"#@num/#@den\"\n\tend",
"def estr\n s = int? ? num : \"#{num},#{den}\"\n \"#{self.class.name}(#{s})\"\n end",
"def to_s\n @expression.to_s\n end",
"def to_s\n sprintf(FORMAT,*to_a)\n end",
"def to_s\n @_range\n end",
"def to_s()\n \"\\#<TimeDuration %s>\" % timestr() ;\n end",
"def to_s\n @g.to_s\n end",
"def to_s\n '(' << self.begin.to_s << '..' << self.end.to_s << ')'\n end",
"def to_str() @value.to_s end",
"def to_s\n\n s = \"\\n\\n==== #{self.class} ====\"\n\n find_expressions.each do |fexp|\n\n s << \"\\n\"\n if fexp.kind_of?(RawExpression)\n s << \"*raw\"\n else\n s << \" \"\n end\n s << fexp.fei.to_s\n end\n s << \"\\n==== . ====\\n\"\n\n s\n end",
"def to_s\n @unit.s_for(value)\n end",
"def to_s\n if (framerate_in_delta(fps, 24))\n WITH_FRAMES_24 % value_parts\n else\n WITH_FRAMES % value_parts\n end\n end",
"def to_s\n if (framerate_in_delta(fps, 24))\n WITH_FRAMES_24 % value_parts\n else\n WITH_FRAMES % value_parts\n end\n end",
"def to_s\n Formatter::ToString.format(self)\n end",
"def to_s(*) end",
"def to_s(*) end",
"def to_s(*) end",
"def to_s\n \"#{@floor}..#{@ceiling}\"\n end",
"def to_s\n\t\t\treturn \"|%s|\" % @elements.collect {|e| \"%0.2f\" % e}.join(\", \")\n\t\tend",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s\n inflection_diffs = [-swath_width_rad / 2, 0, swath_width_rad / 2]\n inflections = inflection_diffs.map {|d| ((max_orbit_phi + d) * 180 / PI).round(3)}\n\n \"Orbit with inflections #{inflections.inspect}\"\n end",
"def to_s\n \n \"#{@n}/#{@d}\" \n end",
"def to_s\n \"(%g, %g)\" % parts\n end",
"def to_s\n granularity.to_s\n end",
"def to_s\n @epc.to_s\n end",
"def sigfig_to_s(numero,digits) \n f = sprintf(\"%.#{digits - 1}e\", numero).to_f\n i = f.to_i\n (i == f ? i : f).to_s\n end",
"def to_s \n return \"%s/%s\" % [@num.to_s, @den.to_s]\n end",
"def to_s\n full\n end",
"def to_s\n \"#{name} orbital: x^#{ang_moment.l} y^#{ang_moment.m} z^#{ang_moment.n}, #{basis_functions.length} function(s):\\n\" + \n basis_functions.map{|function| \"\\t\\t\" + function.to_s}.join(\",\\n\")\n end",
"def to_s()\n @value.to_s\n end",
"def to_s()\n @value.to_s\n end",
"def to_s\n return @value.to_s\n end",
"def to_s\n \"#{@value}\"\n end",
"def to_str() end",
"def to_str() end",
"def to_s\n \"Energy: #{@cur_energy}/#{@max_energy}\"\n end",
"def to_str()\n @value.to_s\n end",
"def to_str()\n @value.to_s\n end",
"def to_s()\n \"#{get_grasas()}\\n#{get_saturadas()}\\n#{get_monoin()}\\n#{get_poli()}\\n#{get_hidratos()}\\n#{get_azucares()}\\n#{get_alco()}\\n#{get_almidon()}\\n#{get_fibra()}\\n#{get_proteinas()}\\n#{get_sal()}\"\n end",
"def to_s\n \"#{@begin}#{@excl ? \"...\" : \"..\"}#{@end}\"\n end",
"def to_s\n \"sin(#{@x})\"\n end",
"def to_s\n @literal\n end",
"def to_s\n \"<e: #{epoch.to_s}, f: #{@freshness}>\"\n end",
"def to_s(fmt = nil)\n if fmt\n # needs work to include distance as well as angle fmt.\n return \"#{@bearing.strf(fmt)} #{distance.round(4)}m\"\n else\n return \"#{@bearing.strf} #{distance.round(4)}m\"\n end\n end",
"def to_s\n return @exp\n end",
"def to_str\n @value.to_s\n end",
"def to_s\n val.to_s\n end",
"def to_s\n second_format = (second % 1).zero? ? '%02d' : '%04.1f'\n\n format(\"%04d-%02d-%02dT%02d:%02d:#{second_format}%s\", *atoms)\n end",
"def to_s\n \"(%5.4f, %5.4f)\" % [x, y]\n end",
"def to_s\n value.to_s\n end",
"def to_str\n value.to_s\n end",
"def to_s\n @value.to_s\n end",
"def to_s\n @value.to_s\n end",
"def to_s\n @value.to_s\n end",
"def to_s\n @value.to_s\n end",
"def to_s\n value.to_s\n end",
"def to_s\n value.to_s\n end",
"def to_s\n @source_string || format\n end",
"def to_s\n val.to_s\n end",
"def to_s\n val.to_s\n end"
] |
[
"0.6234685",
"0.61635303",
"0.610204",
"0.606274",
"0.60272425",
"0.6010317",
"0.5987284",
"0.5946015",
"0.5942576",
"0.5886726",
"0.58804196",
"0.5876405",
"0.5868276",
"0.5859085",
"0.5859085",
"0.58400834",
"0.58214617",
"0.5807573",
"0.57885754",
"0.5781998",
"0.578085",
"0.578085",
"0.57741123",
"0.57594305",
"0.5752348",
"0.5743055",
"0.57389",
"0.57284933",
"0.5720069",
"0.57025504",
"0.56826675",
"0.56739604",
"0.5652507",
"0.5648764",
"0.56445163",
"0.56252414",
"0.56252414",
"0.5615194",
"0.5606107",
"0.5606107",
"0.5606107",
"0.5601069",
"0.5597548",
"0.558874",
"0.558874",
"0.558874",
"0.558874",
"0.558874",
"0.558874",
"0.558874",
"0.558874",
"0.558874",
"0.558874",
"0.558874",
"0.558874",
"0.558874",
"0.558874",
"0.558874",
"0.558874",
"0.558874",
"0.558874",
"0.5588326",
"0.5585462",
"0.5572108",
"0.55575573",
"0.5553871",
"0.55408466",
"0.5539737",
"0.5539426",
"0.5529916",
"0.55210346",
"0.55210346",
"0.5516317",
"0.55160224",
"0.55151165",
"0.55151165",
"0.5510149",
"0.55090773",
"0.55090773",
"0.55037105",
"0.54939604",
"0.54929996",
"0.549228",
"0.548929",
"0.5488667",
"0.5480293",
"0.5478582",
"0.5468594",
"0.5460419",
"0.545902",
"0.54538846",
"0.5450817",
"0.54489857",
"0.5448296",
"0.5443889",
"0.5443889",
"0.54435796",
"0.54435796",
"0.5430301",
"0.54292077",
"0.54292077"
] |
0.0
|
-1
|
creates persistent session for given user
|
def remember(user)
user.remember
cookies.permanent.signed[:user_id] = user.id
cookies.permanent[:remember_token] = user.remember_token
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_session_for(user)\n UserSession.create(user)\n end",
"def create_session\n @user = User.new(nickname: User.temp_user_name)\n @user.save\n session[:user_id] = @user.id\n @user\n end",
"def new_user_session(user)\n session = new_session\n session.login!(user)\n return session\n end",
"def start_session(user)\n session[:user] = User.find(user).id\n end",
"def create_session user_id\n @state.user_id = user_id\n end",
"def generate_session(user)\n AuthController.clear_user_info(session, nil)\n session[:original_user] = @original_user\n session[:impersonate] = true\n session[:user] = user\n end",
"def create\n unless session[:user_id].present?\n user = User.create_user\n session[:user_id] = user.id\n end\n end",
"def login_as(user)\n Session.create(users(user))\n end",
"def login_as(user)\n UserSession.create(users(user))\n end",
"def user_session\n @user_session ||= UserSession.new(session, cookies)\n end",
"def set_session user\n session[:user_id] = user.id\n session[:user_fullname] = user.fullname\n session[:user_email] = user.email\n session[:user_access] = user.access\n session[:company_id] = user.company_id\n end",
"def create_user_session\n password = '12345678'\n user = User.make!(\n password: password,\n password_confirmation: password\n )\n UserSession.create!(\n email: user.email,\n password: password\n )\n end",
"def store(user)\n @session[:user_id] = user.id\n end",
"def create\n options = {:remember_me => true}.merge(params[:user_session])\n @user_session = UserSession.new(options)\n if @user_session.save\n redirect_back_or_default root_url\n else\n @failed = true\n render :action => :new\n end\n end",
"def login_user\n\t @user_session = UserSession.new\t \n\tend",
"def create\n user = User.create!(user_params)\n session[:user_id] = user.id\n redirect_to root_path\n end",
"def user_session\n\t\t@user_session ||= UserSession.new(session)\n\tend",
"def create_session_with(user)\n @logged_in_recently = false\n self.current_user = user\n \n # store remember me in token\n if logged_in?\n @logged_in_recently = true\n if params[:user][:remember_me] == \"1\"\n current_user.remember_me unless current_user.remember_token?\n cookies[cookie_auth_token] = {\n :value => self.current_user.remember_token, :expires => self.current_user.remember_token_expires_at\n }\n end\n \n # callback :after_authentication_success\n self.send(:after_authentication_success, self.current_user) if self.respond_to?(:after_authentication_success)\n \n if !performed? && request.xhr?\n if return_to_url\n flash[:xhr_redirect] = true\n @return_to_url = return_to_url\n session[return_to_param] = nil\n end\n render :update do |page|\n page << close_modal_javascript\n page.replace status_dom_id, :partial => 'layouts/front/status_navigation'\n page << \"document.fire('authentication:success')\"\n page << \"document.fire('authentication:complete')\"\n page.redirect_to @return_to_url if @return_to_url\n end\n elsif !performed?\n flash[:notice] = MESSAGE_LOGIN_SUCCESS.t\n redirect_back_or_default('/')\n end\n else\n flash[:error] = MESSAGE_LOGIN_ERROR.t\n if request.xhr?\n render :update do |page|\n page.replace session_dom_id, :partial => 'new'\n page << \"document.fire('authentication:failure')\"\n page << \"document.fire('authentication:complete')\"\n end\n else\n render :action => 'new'\n end\n end\n end",
"def create\n user = User.create!(user_params)\n session[:user_id] = user.id\n redirect_to '/'\n end",
"def create_session\n req_params = params[:user]\n unless req_params\n @msg = \"Login details not found\"\n render \"objects/msg.json\", status: :unauthorized and return\n end\n @user = User.find_by_email(req_params[:email])\n if @user && @user.authenticate(req_params[:password])\n session[:user_id] = @user.id\n render 'objects/user.json'\n else\n @msg = \"Email or password is invalid\"\n render \"objects/msg.json\", status: :unauthorized\n end\n end",
"def create\n @user = User.find_or_create_from_auth_hash(auth_hash)\n # self.current_user = @user\n session[:user] = @user.id\n redirect_to '/'\n end",
"def set_user_session(user)\n session[:logged_in_users_id] = user.id\n end",
"def create_session\n # byebug\n user = User.find_by(\n email: params[:email],\n password: params[:password]\n )\n\n if (user.nil?)\n redirect_to action: \"sign_in\"\n else\n session[:user_id] = user.id\n\n redirect_to \"/users/#{user.id}\"\n end\n\n end",
"def create_session\n login, password = get_login_and_password\n create_session_with authenticate_user(login, password, :trace => true)\n end",
"def login(user)\n session[:user_id] = user.id\n end",
"def create \n @user = User.find(params[:user])\n session[:user_id] = @user.uid\n redirect_to user_path(@user)\n end",
"def create_dev_session\n\t\t# redirect to root if not in dev environment\n\t\tredirect_to root_path unless Rails.env == 'development'\n\n\t\t# Get user name from .env file\n\t\tusername = ENV['DEV_USER']\n\n\t\t# if user with username doesn't exist, create one\n\t\tuser = User.find_by(name: username)\n\t\tunless user.present?\n\t\t\tuser = User.new(name: username)\n\t\t\tuser.save!\n\t\tend\n\n\t\t# sign in user and redirect to notes\n\t\tsession[:user_id] = user.id\n\t\tredirect_to user_notes_path(current_user)\n\tend",
"def login_as(user)\n session[:user_id] = user.id\n end",
"def create\n reset_session\n params[:user] ||= {}\n username = params[:user][:username].to_s\n password = params[:user][:password].to_s\n user = User.where('username = ? and crypted_password = ?', username, User.encrypt(password)).first\n\n params[:client_uid] = 'Web Platform' if request.format.html?\n \n if user && params[:client_uid]\n session_obj = Session.create(user_id:user.id, client_uid:params[:client_uid])\n session[:app_session_id] = session_obj.id\n session[:user_id] = user.id\n\n if request.format.html?\n redirect_to controller: 'main'\n elsif request.format.json?\n render json: {success: true, session: session_obj.to_json}\n end\n else\n if request.format.html?\n flash[:alert] = \"Cannot login, please try again\"\n render action: 'new'\n elsif request.format.json?\n render json: {success: false, message: 'Cannot login, please try again'}\n end\n end\n end",
"def login user\n session[:user_id] = user.id\n end",
"def create_session\n session[:who_is_this] = \"admin\"\n end",
"def set_user_session\n @user_session = UserSession.find\n end",
"def login(user)\n session[:user_id] = user.id\n end",
"def login_as(user)\n session[:user_id] = users(user).id\n end",
"def create\n user = User\n .find_by(email: params[\"user\"][\"email\"])\n .try(:authenticate, params[\"user\"][\"password\"])\n # if the user was created, i.e., found an email password match, set session\n if user\n # sets an encrypted session cookie on the client side\n session[:user_id] = user.id\n render json: {\n status: :created,\n logged_in: true,\n user: user\n }\n else\n render json: { status: 401 }\n end\n end",
"def create\n #gets the user\n user = User.find_by_credentials(params[:user][:email], params[:user][:password])\n \n # if we found it, generate a new session token, change it on the user\n # instance as well as the cookie\n if !user.nil?\n log_in_user!(user)\n flash.now[:success] = \"Login successful\"\n redirect_to user_url(user)\n else\n flash.now[:error] = \"Invalid email/password combo\"\n redirect_to :new\n end\n end",
"def login(user)\n \tsession[:user_id] = user.id\n end",
"def set_user_session\n user_session = UserSession.find(params[:id])\n end",
"def log_in_user_session_only(user_id)\n session[USER_SESSION_KEY] = user_id\n end",
"def create\n\t\tuser = User.from_sso(cookies[:UTEP_SE], cookies[:UTEP_SA])\n\t\tlog_in(user) if user\n\t\tredirect_to root_url\n\tend",
"def user_session\n @user_session ||= UserSession.find\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def create\n puts \"\\n\\n users_controller create: running \\n\\n\"\n # Create a new user\n @user = User.new(params_user)\n if @user.save\n # Change ID session login to true\n @session = Session.new\n # need to make shure there arent more then one\n # need a timmer to delete automaticly in a day or 2\n id = SecureRandom.hex(64)\n key = SecureRandom.hex(64)\n @session.session_id = id\n @session.key = key\n @session.user_id = @user.id\n @session.save\n # Save ID and random temp hash in cookie\n cookies[:session_id] = id\n cookies[:key] = key\n # go to homepage\n redirect_to '/Events/homepage'\n end\n end",
"def create\n @user = User.find_by(name: params[:username])\n if @user.authenticate(params[:password])\n session[:current_user_id] = @user.id\n end\n end",
"def login_as(user)\n @request.session[:user_id] = users(user).id # obtained from fixture\n end",
"def set_user_session\n @user_session = User_session.find(params[:id])\n end",
"def login!(user, options = {})\n session[:session_token] = user.persistence_token\n session[:active_at] = Time.now\n @current_user = user\n end",
"def create\n reset_session\n u = User.authenticate(params[:session][:login], params[:session][:password])\n \n if u\n reset_session\n session[:user_id] = u.id\n session[:user_login] = u.login\n @current_user = User.find(session[:user_id])\n flash[:notice] = 'hi, again!'\n redirect_to dashboard_url\n else\n flash[:error] = 'Invalid login or password.'\n redirect_to root_url\n end\n end",
"def login_user(user = gen_user)\n session[:user_id] = user.id\n return user\n end",
"def login_user(user)\n session[\"app_user\"] = user\n end",
"def set_user_session\n @user = user_session.find(params[:id])\n end",
"def create_session\n @connection.create_session(@config || {})\n end",
"def login( user )\n session[:user_id] = user ? user.id : nil\n end",
"def log_in(user)\n session[:user_id] \t = user.id\n session[:user_name] = user.name\n session[:user_email] = user.email\n end",
"def create\n @user_session = UserSession.new(user_session_params.to_h)\n if @user_session.save\n flash[:notice] = \"Login successfully!\"\n redirect_back_or root_path\n else\n redirect_to login_path,\n alert: \"A problem's occured while logging in, please try again.\"\n end\n end",
"def create\n @user = User.new(user_params)\n return redirect_to controller: 'users', action: 'new' unless @user.save\n session[:user_id] = @user.id\n redirect_to user_path(@user)\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def login_as(user)\n @request.session[:user] = user ? users(user).id : nil\n end",
"def create\n action = LogUserIn.new :web\n @session = Session.new params[:session]\n\n if user = action.run(@session.login, @session.password)\n previous_path = session[:login_redirect_to]\n set_new_user_session user, @session.remember_me\n\n redirect_to previous_path || root_path\n else\n flash.now[:login_error] = true\n render action: \"new\"\n end\n end",
"def create\n # AR model which will interact with our database and create a new user\n user = User.new(user_params)\n saveUser = user.save\n \n if saveUser\n session[:user_id] = user.id\n redirect_to '/'\n else\n redirect_to '/signup'\n end\n end",
"def create \n user = User.find_by(username: params[:user][:username])\n if user && user.authenticate(params[:user][:password])\n session[:user_id] = user.id \n redirect_to user_path(user)\n else\n redirect_to '/login'\n end\n end",
"def set_user_session\n @user_session = UserSession.find(params[:id])\n end",
"def create\n u = params[:username]\n p = params[:password]\n user_session = UserSession.new(:login => u, :password => p, :remember_me => true)\n if not user_session.save then\n return render :text => \"error\", :status => 401\n end\n\n ret = { :user => User.find_by_username_or_email(user_session.login) }\n ret[:redir] = URI.parse(session.delete(:return_to)).path if session.include? :return_to\n restful ret\n end",
"def sign_in user\n \t# takes the user object and sets session data using said object\n \tsession[:user_id] = user.id\n \tself.current_user = user\n end",
"def create\n @user = User.find(params[:user][:id])\n if !@user.nil?\n session[:user_id] = @user.id\n redirect_to user_path(@user), notice: \"logged in successfully \"\n else\n redirect_to signin_path\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n session[:user_id] = @user.id\n redirect_to user_path(@user)\n else\n render :new\n end\n end",
"def create_new_user\n session[:user_id] = nil\n user = User.create_new(:remote_ip => request.remote_ip)\n user.language_abbr= session[:language] if session[:language] # Recalls language from previous session.\n user\n end",
"def create\n @user_session = current_conference.user_sessions.new(params[:user_session])\n if @user_session.save\n flash[:notice] = t(\"error_messages.login_succeeded\")\n else\n flash[:error] = t(\"error_messages.login_failed\")\n end\n # Set the user_id in the cookie.\n # This normally runs as a :before_filter, but\n # in the current case, we have to rerun it because\n # we have changed the user_id in this action.\n # user_id_in_cookie(@user_session.record)\n respond_with @user_session, :location => \"/\"\n\n # if @user_session.save\n # flash[:notice] = \"Successfully logged in.\"\n # redirect_to root_path\n # else\n # if smartphone?\n # render \"new.s\", :layout => \"layouts/smartphone\"\n # elsif galapagos?\n # render_sjis \"new.g\", :layout => \"layouts/galapagos\"\n # else\n # render \"new\"\n # end\n # end\n end",
"def user_log_in(user)\n session[:user_id] = user.id\n end",
"def create\n @user = User.find_or_create_with_omniauth auth_hash\n session[:user_id] = @user.id\n redirect_to auth_path\n end",
"def create_session_without_render_with(user)\n @logged_in_recently = false\n self.current_user = user\n\n # store remember me in token\n if logged_in?\n @logged_in_recently = true\n if params[:user][:remember_me] == \"1\"\n current_user.remember_me unless current_user.remember_token?\n cookies[cookie_auth_token] = {\n :value => self.current_user.remember_token, :expires => self.current_user.remember_token_expires_at\n }\n end\n \n # callback :after_authentication_success\n self.send(:after_authentication_success, self.current_user) if self.respond_to?(:after_authentication_success)\n\n flash[:notice] = MESSAGE_LOGIN_SUCCESS.t\n else\n flash[:error] = MESSAGE_LOGIN_ERROR.t\n end\n return self.current_user\n end",
"def set_user\n @user = User.find_by(username: params[:user][:username])\n session[:user_id] = @user.id\n end",
"def login_as(user)\n @request.session[:user_id] = user ? users(user).id : nil\n @request.session[:online_at] = Time.now.utc\n end",
"def set_session\n @session = session[:user_id]\n end",
"def set_user\n require_logged_in\n @user = User.find_by(id: session[:user_id])\n end",
"def create\n if user = User.find_by_login(params[:login])\n # Save the user ID in the session so it can be used in subsequent requests\n session[:current_user_id] = user.id\n redirect_to root_url\n end\n end",
"def create \n #finds whatever user that is in the system with the email you pass up\n #then it tries to run the authenticate method with whatever password got sent up and if...\n #it all works, store in the variable\n user = User\n .find_by(email: params[\"user\"][\"email\"])\n .try(:authenticate, params[\"user\"][\"password\"])\n\n #if a user is created want to communicate with the session and set the user ID equal to the User ID you just found \n #okay so the user is successfully authenticated, want to make sure they now have a cookie on their system\n if user \n #says store the user id, and it goes encrypted into their client(browser/mobile device)\n session[:user_id] = user.id\n render json: {\n status: :created,\n logged_in: true,\n user: user #pass back the entire user that you have in the database and you can show/use anything\n }\n #if user not able to log in successfully\n #status 401 is the unauthorized code, the universal HTTP code want to use if a user is not authenticated\n else \n render json: {\n status: 401\n }\n end \n end",
"def create\n @user = User.new(user_params)\n if @user.save\n session[:user_id] = @user.id\n redirect_to user_path(@user.id)\n else\n render 'new'\n end \n end",
"def app_user\n return SpUser.new unless current_user\n @sp_user ||= SpUser.find_by_ssm_id(current_user.id)\n if @sp_user.nil? && current_person.isStaff?\n @sp_user = SpGeneralStaff.create(ssm_id: current_user.id, created_by_id: current_user.id, person_id: current_person.id)\n end\n unless session[:login_stamped] || @sp_user.nil?\n @sp_user.update_attribute(:last_login, Time.now)\n session[:login_stamped] = true\n end\n @sp_user ||= SpUser.new\n end",
"def create\n if user = User.authenticate_with_credentials(params_for_login)\n # a session cookie is assigned to logged users\n session[:user_id] = user.id\n redirect_to session[:return_to]\n else\n redirect_to session[:return_to], flash: { error: \"Invalid email address\" }\n end\n end",
"def create\n\t\t# method interacts with session > new.html.erb view\n\t\tuser = User.where(email: params[:user_email]).first\n\t\tif user && user.authenticate(params[:password])\n\t\t\tsession[:user_id] = user.id.to_s\n\t\t\tredirect_to '/'\n\t\telse\n\t\t\tredirect_to :back\n\t\tend\n\tend",
"def create\n user = User.create!(user_params)\n session[:user_id] = user.id\n render json: user, status: :created\n end",
"def create\n user = User.find_by_email(params[:session][:email])\n respond_to do |format|\n if user && user.authenticate(params[:session][:password])\n sign_in user # create a cookie\n format.json { render json: user.active_model_serializer.new(user, {}) }\n format.html { redirect_back_or user }\n else\n #raise SessionsController::InvalidAuth\n render 'new'\n end\n end\n end",
"def login_as(user)\n @request.session[:user_id] = user.id\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n session[:user] = {id: @user.id, auth_token: @user.generate_auth_token!}\n format.html { redirect_to main_welcome_url, notice: 'User was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def signin(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n reset_session\n set_user_id_in_session(user.id)\n # Guard against session replay attacks\n session[:session_token] = user.session_token\n end",
"def new\n @user_session = UserSession.new\n end"
] |
[
"0.81041664",
"0.7942089",
"0.7805226",
"0.77348983",
"0.765083",
"0.7588374",
"0.75141686",
"0.7512605",
"0.7475589",
"0.7440537",
"0.7440537",
"0.7344929",
"0.7251861",
"0.72108424",
"0.7203846",
"0.7164451",
"0.7147566",
"0.711701",
"0.71148765",
"0.7099773",
"0.70872307",
"0.7072091",
"0.70633817",
"0.70106566",
"0.69675183",
"0.6946594",
"0.69387215",
"0.69327366",
"0.6924507",
"0.6921458",
"0.69192237",
"0.6902708",
"0.688023",
"0.68680745",
"0.6854908",
"0.6845458",
"0.6843379",
"0.68344325",
"0.68315524",
"0.6825527",
"0.6805776",
"0.6805669",
"0.6801354",
"0.6795898",
"0.67936146",
"0.67906624",
"0.6788502",
"0.6783247",
"0.6781207",
"0.6775124",
"0.6768095",
"0.6765355",
"0.67652977",
"0.6757964",
"0.67567545",
"0.6756578",
"0.67539245",
"0.67539245",
"0.67539245",
"0.67539245",
"0.67539245",
"0.67539245",
"0.67539245",
"0.67539245",
"0.67539245",
"0.67539245",
"0.67539245",
"0.67539245",
"0.67539245",
"0.67539245",
"0.67520297",
"0.67503434",
"0.67435884",
"0.67414945",
"0.6739932",
"0.6739931",
"0.6735741",
"0.6734931",
"0.67271554",
"0.67260724",
"0.6721115",
"0.67178816",
"0.67082053",
"0.6701223",
"0.66893375",
"0.66835636",
"0.6683187",
"0.6681332",
"0.6675074",
"0.6670781",
"0.666721",
"0.6662407",
"0.66567636",
"0.665389",
"0.66464674",
"0.66460544",
"0.664404",
"0.6641367",
"0.66333693",
"0.66329175",
"0.66286707"
] |
0.0
|
-1
|
returns current loggedin user (if any)
|
def current_user
@current_user = temporary_session? ? temporary_user : remembered_user
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_logged_in_user\n if logged_in?\n user = User.find(session[:current_user_id])\n if user\n return user\n else\n return nil\n end\n end\n \n #default return nil\n nil\n end",
"def getLoggedInUser\n if session[:user_id]\n return User.find(session[:user_id])\n else\n return nil\n end\n end",
"def current_user\n User.find_by(uid: session[:user]) if logged_in?\n end",
"def current_user\n if session[:user_id]\n return User.find(session[:id])\n else\n return nil\n end\n end",
"def current_user\n return unless session[:user_id]\n User.find(session[:user_id])\n end",
"def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n end\n end",
"def get_current_user\n @current_user ||= User.find(session[:user_id]) unless session[:user_id].blank?\n return @current_user\n end",
"def get_current_user\n if session[:authenticated]\n return User.find_by_id(session[:user_id])\n end\n return nil\n end",
"def get_current_user\n if @current_user\n return @current_user\n else\n @current_user = User.find_by(id: session[:user_id])\n end\n end",
"def current_user(id = session[:user_id])\n User.get_one id\n end",
"def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n nil\n end\n end",
"def current_user\n if valid_session?\n User.find(session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n user = User.find(session[:user_id])\n else\n nil\n end\n end",
"def current_user\n if session[:user_id]\n User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n User.get_user(session[:user_id]) if session[:user_id]\n end",
"def current_user\n\t\tif session[:user_id].present?\n\t\t\tUser.find(session[:user_id])\n\t\tend\n\tend",
"def current_user\n\n sql = \"SELECT * FROM users WHERE id = $1;\"\n \n results = run_sql(sql, [session[:user_id]]) \n return results.first\n end",
"def current_user\n User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n @current_user if logged_in?\n end",
"def current_user\n @current_user if logged_in?\n end",
"def current_user\n begin\n unless @current_user.nil?\n return @current_user\n else\n if session[:user_id]\n return @current_user = User.find(session[:user_id])\n else\n return nil\n end\n end\n rescue\n return nil\n end\nend",
"def current_user\n if session[:user_id]\n return User.find(session[:user_id])\n end\nend",
"def current_user\n logged_in? ? User.find_by_id(session[:user_id]) : nil\n end",
"def current_user\n if !session[:user_id] then nil else User.find(session[:user_id]) end\n end",
"def return_current_user\n @current_user ||= User.find(session[:id_of_current_user]) if session[:id_of_current_user]\n end",
"def current_user\n begin \n User.find(session[:user_id])\n rescue ActiveRecord::RecordNotFound\n nil\n end\n end",
"def get_current_user\n unless session[:user_id]\n @current_user = nil\n return\n end\n @current_user = User.first(:conditions => {:id => session[:user_id] })\n end",
"def current_user\n\tif session[:user_id].present?\n\t\tUser.find(session[:user_id])\t\n\tend\nend",
"def get_current_user\n unless session[:user_id].blank?\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n end",
"def current_user\n # User.find would throw an error if we cannot find the user\n User.find_by({ id: session[:user_id] })\n end",
"def current_user\r\n\tif(session[:user_id])\r\n\t\t@u ||= User.first(id: session[:user_id])\r\n\t\treturn @u\r\n\telse\r\n\t\treturn nil\r\n\tend\r\nend",
"def find_current_user\n if is_logged_in?\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n end",
"def current_user\n @user ||= User.find_by_id(session[:user_id])if logged_in?\n end",
"def current_user\n \n # Normally we would look in the session to see if there is a user_id \n # to figure out if the user is loggged in.\n # For demo purposes this app randomly picks if the user is logged in\n if rand(100) > 20 \n User.last\n else\n nil\n end\n end",
"def current_user\n if session[:user_id]\n return @user ||= User.find(session[:user_id]['$oid'])\n else\n return nil\n end\n end",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n return @current_user\n end",
"def current_user\n \t# If the session contains the user_id with non-nil, we have ID of some user\n \t# Return the user object for ID\n \t\n \t# Using instance variable helps limit calls\n \t# \"Or equals\" means \n \t\t# if nil, set it -- if not, return it\n \tif session[:user_id]\n \t@current_user ||= User.find(session[:user_id])\n end\n end",
"def current_user\n return nil unless session[:user_id]\n User.get(session[:user_id])\nend",
"def find_current_user\n user_id = session[:user_id]\n if user_id\n user = Marty::User.active.find(user_id) rescue nil\n else\n user = try_to_autologin\n end\n\n user\n end",
"def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend",
"def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #return current user or set to this if there isnt a current user\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #return current user if @current_user already exists.\n #if there's no current user, return the user with ID == session user ID, if there is one.\n end",
"def current_user\n \t@current_user || User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n\n \tif session[:user_id].present?\n \t\tUser.find(session[:user_id])\n\n \tend\n\n end",
"def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend",
"def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend",
"def get_current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[\"user_id\"])\n end\n end",
"def current_user\n return @current_user if @current_user.present?\n\n if session[:uid]\n @current_user = User.from_session(session)\n end\n\n @current_user\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #this way so if no session we don't .find nil\n end",
"def current_user\n user_id = get_log_in_session\n if user_id\n get_user(user_id)\n else\n user = get_user(cookies.signed['user_id'])\n if user&.authenticated?(:remember, cookies[:remember_token])\n set_log_in_session user\n user\n end\n end\n end",
"def current_user\n @current_user || User.find(session[:user_id]) if session[:user_id]\n \tend",
"def current_user\n if @current_user.nil?\n @current_user = User.find_by(id: session[:user_id])\n else\n @current_user\n end\n end",
"def current_user\n User.find_by(id: session[:user_id])\n end",
"def current_user\n User.find_by(id: session[:user_id])\n end",
"def current_user\n User.find session[:user_id] if user_signed_in?\n end",
"def current_user\n User.where(id: session[:user_id]).first\n end",
"def current_user\n if session[:user_id] # if there is a session id, the current user is the one whose session id is the same as the user id \n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n @current_user ||= begin\n if session[:user_id]\n user = User.where(id: session[:user_id])\n user[0] if user.any?\n end\n end\n # @current_user ||= User.find session[:user_id] if session[:user_id]\n end",
"def current_user\n return @current_user ||= User.find(session[:user_id]) unless session[:user_id].nil?\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.first(:id => session[:user_id])\n end",
"def current_user\n if session[:user_id].present?\n @current_user = User.find_by(uid: session[:user_id])\n # session.clear if @current_user.nil?\n return @current_user\n end\n end",
"def current_user\n if !@current_user.nil?\n @current_user\n elsif !session[:current_user_id].nil?\n begin\n @current_user = User.find(session[:current_user_id])\n rescue ActiveRecord::RecordNotFound\n @current_user = nil\n end\n end\n end",
"def logged_in_user\n if (!logged_in?)\n return User.logged_out_user\n end\n #return nil if !logged_in?\n return session[\"app_user\"]\n end",
"def current_user\n @current_user ||= find_logged_in_user\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end",
"def current_user #used in many methods to pull in the current user stored in sessions. \n \tUser.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n User.find_by_id(session[:user_id]) if session[:user_id].present?\n end",
"def current_user\n if Rails.application.config.use_omniauth\n return nil unless session[:user_info]\n @current_user ||= User.find_user_from_omniauth(session[:user_info])\n else\n @current_user ||= User.where(username: request.env['aker.check'].user.username).first\n end\n end",
"def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end",
"def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end",
"def current_user\n User.find(session[:user])\n end",
"def current_user\n User.find session[:id] if session[:id]\n end",
"def current_user\n return current_session && current_session.user\n end",
"def current_user\n @usys_logged_in_user ||= lookup_user\n end",
"def current_user\n\t\tUser.find_by(:id => session[:user_id])\n\tend",
"def current_user\n if logged_in?\n return User.get(session['user'])\n end\n AnonymousUser.new\n end",
"def current_user\n\t\t\tUser.find_by_id(session[:user_id])\n\t\tend",
"def current_user\n login_from_session || login_from_basic_auth\n end",
"def current_user\n \treturn @current_user if defined? @current_user\n \t@current_user = User.first\n end",
"def current_user\n\t\tif !@current_user\n\t\t\t@current_user = User.find_by(id: session[:user_id])\n\t\tend\n\t\t@current_user\n\tend",
"def current_user\n User.find(session[:user_id])\n end",
"def current_user\n User.find(session[:user_id])\n end",
"def current_user\n if logged_in?\n session[:user] = nil\n return temporary_logged_in_user ? temporary_logged_in_user :\n set_temporary_logged_in_user(cached_user)\n else\n session[:user] ||= create_new_user # if there wasn't one\n session[:user] = create_new_user unless session[:user].respond_to?(:stale?)\n session[:user] = create_new_user if session[:user].stale?\n return session[:user]\n end\n end",
"def current_user\n core_id = Origen::Users::User.current_user_id\n user = app_users.find { |user| user.core_id == core_id }\n user || User.new(core_id)\n end",
"def current_user\n get_from_options_or_controller(:current_user)\n end",
"def current_user\n return nil unless session[:user_id] \n @current_user ||= User.find(session[:user_id])\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n # return current user or set it to what is found in cookie, only if there is one to begin with\n end",
"def current_user\n User.find(current_user_id)\n end",
"def current_user\n return @current_user if @current_user.present?\n\n session_user_id = session[:user_id]\n @current_user = if session_user_id.present?\n User.find_by(id: session_user_id) || AdminUser.find_by(id: session_user_id)\n end\n end",
"def current_user\n @current_user ||= User.where(:id => session[:user_id]).first if session[:user_id]\n end",
"def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end"
] |
[
"0.85378116",
"0.8533479",
"0.8528703",
"0.8504354",
"0.8497467",
"0.84962934",
"0.84654593",
"0.8452448",
"0.8442996",
"0.8440423",
"0.84145063",
"0.8402872",
"0.8398498",
"0.8389775",
"0.8387313",
"0.8366064",
"0.83572143",
"0.83554316",
"0.83554316",
"0.83504933",
"0.83504933",
"0.83379024",
"0.83310723",
"0.8328756",
"0.8311863",
"0.83080703",
"0.83052695",
"0.83003306",
"0.8293638",
"0.8287823",
"0.828269",
"0.82778937",
"0.8276791",
"0.82719445",
"0.8267366",
"0.82658815",
"0.826005",
"0.826005",
"0.826005",
"0.826005",
"0.825458",
"0.825458",
"0.82458675",
"0.82443357",
"0.82321393",
"0.8226436",
"0.8214296",
"0.8214296",
"0.8204995",
"0.819335",
"0.81884855",
"0.81835544",
"0.8180653",
"0.8180653",
"0.8178147",
"0.817548",
"0.81754136",
"0.8172026",
"0.8162902",
"0.81623477",
"0.81623137",
"0.81623137",
"0.81538594",
"0.81519794",
"0.8151011",
"0.8148846",
"0.8148839",
"0.8148289",
"0.81471455",
"0.813246",
"0.81315655",
"0.8129988",
"0.81270933",
"0.81270933",
"0.81234914",
"0.8123473",
"0.81219566",
"0.81185126",
"0.81185126",
"0.81160223",
"0.8115088",
"0.8110904",
"0.811023",
"0.8102902",
"0.8093587",
"0.8088555",
"0.80833244",
"0.80810225",
"0.8079011",
"0.80758226",
"0.80758226",
"0.8071752",
"0.80705136",
"0.8067337",
"0.8065383",
"0.8063017",
"0.8062807",
"0.8061866",
"0.8061343",
"0.80603105",
"0.80603105"
] |
0.0
|
-1
|
true/ false user is logged in
|
def logged_in?
!current_user.nil?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end",
"def logged_in?\n @logged_in ? true : false\n end",
"def logged_in?\n @logged_in == true\n end",
"def logged_in?\n @logged_in == true\n end",
"def logged_in?()\n if session[:user_id]\n return true\n else \n return false\n end\n end",
"def logged_in?\n !!logged_user\n end",
"def logged_in?\n if current_user\n true\n else\n false\n end\n end",
"def logged_in?\n current_user != :false \n end",
"def logged_in?\n if current_user\n true\n else \n false\n end\n end",
"def logged_in?\n if session[:username]\n if session[:logged_in?]\n return true\n end\n else\n return false\n end\n end",
"def logged_in?\n current_user ? true : false;\n end",
"def logged_in?\r\n current_user != :false\r\n end",
"def logged_in?\n\n if session[:current_user_id]\n return true\n end\n \n #Default return false\n false\n \n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n current_user.present? # True neu user login\n end",
"def _is_login\n p session[:user]\n session[:user] ? true : false\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n if !session[:user_id].nil?\n return true\n else\n return false\n end\n end",
"def loggedin?\n @session.nil? ? false : (return true)\n end",
"def logged_in?\n !!logged_in_user \n end",
"def logged_in?\n return true if self.current_user\n return false\n end",
"def user_is_logged_in?\n !!session[:user_id]\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n current_user != nil ? true : false\n end",
"def logged_in?\n (current_user ? login_access : false).is_a?(User)\n end",
"def logged_in?\n\t\t !!current_user\n end",
"def logged_in?\n if session[:int_key].nil? || session[:email].nil? || session[:password].nil? || session[:logged_in].nil?\n false\n else\n true\n end\n end",
"def logged_in?\n\t\tcurrent_user.present?\n\tend",
"def logged_in?\n user._logged_in?\n end",
"def logged_in?\n return false unless session[:user_id]\n\n User.find_by_id(session[:user_id]).present?\n end",
"def is_user_logged_in?\n\tlogged_in = false\n\t if logged_in\n then true\n else\n redirect_to root_path\n end\n end",
"def user_is_logged_in?\n !!session[:user_id]\n end",
"def is_logged_in_user?\n session[:user_authenticated]\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n\t\t#if currentuser.nil returns true then logedin is false\n\t\t!current_user.nil?\n\tend",
"def logged_in\n logged_in_user != nil\n end",
"def logged_in?\n #boolean return\t\n \tcurrent_user != nil\n end",
"def logged_in?\n\t\t\tcurrent_user.is_a? User\n\t\tend",
"def logged_in?\t\t\t\n\n \t\t return true if current_user\t\n\n \tend",
"def logged_in?\n !!current_ma_user\n end",
"def logged_in?\n end",
"def logged_in?\n return session[:user_id].present?\n end",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n session[:authorized] == true\n end",
"def logged_in\n current_user != nil\n end",
"def logged_in?\n ## to query if the logged in, call the current_user with !! preceeded, this turns it to true or false\n # TRUE or FALSE\n !!current_user\n end",
"def logged_in?\n \t!current_user.nil? && session[:user_id]\n\tend",
"def logged_in?\n !!session[:logged_in]\n end",
"def logged_in?\n !!current_user #return true or false if current_user is exist\n end",
"def logged_in?\n\t\tif not current_user.present? then redirect_to \"/unauthorized\" and return false\n\t\tend\n\t\treturn true\n\tend",
"def logged_in?\n current_user_id.to_i > 0\n end",
"def logged_in?\n\t\t!current_user.nil?\n \tend",
"def logged_in?\n return false unless @auth_header\n true\n end",
"def user_logged_in?\n current_user.present?\n end",
"def user_logged_in?\n current_user.present?\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n return session['current_user']\n end",
"def loggedIn?\n return @logged_in\n end",
"def logged_in?\n if request.cookies['userid']\n true\n else\n false\n end\n end",
"def logged_in?\n !!session[:user_id]\n # !!@current_user\n end",
"def logged_in\n\t \t!current_user.nil?\n\t end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n current_user.present?\n end",
"def logged_in?\n current_user\n end",
"def logged_in?\n current_user\n end",
"def logged_in?\n \t!current_user.nil?\n \tend",
"def logged_in?\n \t\t!current_user.nil?\n \tend",
"def user_logged_in?\n session[:user]\n end",
"def logged_in?\r\n\t\t!current_user.nil?\r\n\tend",
"def logged_in?\n !!logged_in_user\n end",
"def logged_in?\n !!logged_in_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n session[:user_id]\n end",
"def logged_in?\n current_authuser\n end",
"def is_logged_in?\n session[:user_id].present?\n end",
"def user_logged_in?\n session[:user_id].present?\n end",
"def logged_in?\r\n !!current_user\r\n end",
"def is_logged_in?\n\t\t!session[:user_id].nil?\n\tend",
"def logged_in?\n current_user\n end",
"def logged_in?\n\t !current_user.nil?\n\t end",
"def logged_in?\n if session[:username].blank? or\n session[:authenticated].blank? or\n !session[:authenticated]\n return false\n end\n\n return true\n end"
] |
[
"0.8855731",
"0.8685554",
"0.86697656",
"0.86697656",
"0.8665673",
"0.86593056",
"0.8654078",
"0.8639121",
"0.8636279",
"0.8622163",
"0.86220586",
"0.8599811",
"0.85873973",
"0.8578747",
"0.8578747",
"0.85547245",
"0.854973",
"0.8540216",
"0.8540216",
"0.8540216",
"0.8540216",
"0.8539358",
"0.8523315",
"0.85152316",
"0.8514823",
"0.8504714",
"0.8447354",
"0.8444044",
"0.84438205",
"0.8428395",
"0.8427047",
"0.84082013",
"0.84033793",
"0.8400528",
"0.8396585",
"0.839615",
"0.8394994",
"0.8391334",
"0.8391334",
"0.8388356",
"0.8386469",
"0.83745277",
"0.8372005",
"0.83713657",
"0.8370753",
"0.8369661",
"0.8366669",
"0.8364543",
"0.8364543",
"0.8364543",
"0.8364543",
"0.8360356",
"0.8360295",
"0.8356979",
"0.8355605",
"0.8354015",
"0.83481824",
"0.8340835",
"0.8328548",
"0.8324351",
"0.832297",
"0.8318685",
"0.8318685",
"0.8315678",
"0.8315678",
"0.8315678",
"0.8315678",
"0.8315678",
"0.8315678",
"0.8315678",
"0.8315678",
"0.8315678",
"0.83153653",
"0.8314828",
"0.8314691",
"0.83105445",
"0.8310184",
"0.8309522",
"0.8309522",
"0.830801",
"0.8304462",
"0.8304462",
"0.8294738",
"0.8294312",
"0.8292069",
"0.8286916",
"0.8286841",
"0.8286841",
"0.8282026",
"0.8282026",
"0.8282026",
"0.8282026",
"0.82805663",
"0.82802784",
"0.82780445",
"0.8273254",
"0.8272533",
"0.82694733",
"0.826398",
"0.82581353",
"0.82571214"
] |
0.0
|
-1
|
redirects to stored location or default
|
def redirect_back_or(default)
redirect_to(session[:forwarding_url] || default)
session.delete(:forwarding_url)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def redirect_to_stored_location_or(default)\n redirect_to(session[:forward_url] || default)\n session.delete(:forward_url)\n end",
"def redirect_to_stored(default='/')\n return_to = session[:return_to] || default\n session[:return_to] = nil\n redirect return_to\n end",
"def redirect_back_or_default(default)\n redirect_to(pop_stored_location || default)\n end",
"def redirect_back_or_default(default)\n redirect_to(pop_stored_location || default)\n end",
"def redirect_back_or_default(default)\n redirect_to(location_stored? ? session[:return_to] : default)\n session[:return_to] = nil\n end",
"def redirect_to_stored_or_default(default)\n if session['return-to'].nil?\n redirect_to default\n else\n redirect_to_url session['return-to']\n session['return-to'] = nil\n end\nend",
"def redirect_back_or_default(default)\n redirect_to url_for_redirect(default)\n end",
"def redirect?; end",
"def restore_location_or(default)\n redirect_to(session[:return_to] || default)\n session.delete(:return_to)\n end",
"def redirect_back_or_default(default)\n redirect_to(default)\n end",
"def redirect(options = {})\r\n end",
"def redirect_back_or_default(default, options = {})\n target = url_to_store(session[:return_to])\n (target = logged_in? ? home_url(current_user) : nil) if target == '{home}'\n #target = nil if target == APP_CONFIG.hostname || target == APP_CONFIG.hostname + '/'\n target = default unless target\n target = safe_redirect(target)\n session[:return_to] = nil\n return target if options[:find_target_only]\n redirect_to(target)\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url) # Delete the stored URL for next log in\n end",
"def redirect_back_or( default )\n\t\tredirect_to( session[:forwarding_url] || default )\n\t\tsession.delete( :forwarding_url )\n\tend",
"def redirect_back_or(default)\n #send back to what was stored in\n #\"session[:return_to] or default location\n redirect_to(session[:return_to] || default)\n #deletes saved return location\n session.delete(:return_to)\n end",
"def redirect_back_or_default(default)\n loc = session[:return_to] || default\n session[:return_to] = nil\n redirect loc\n end",
"def redirect_back_or_default(default = root_url(:protocol => \"http\"))\n # be sure we aren't returning the login, register or logout page\n if valid_return_to_url\n url = CGI.unescape(return_to_url)\n url = {:controller => url, :protocol => \"http\"} unless url.match(\"://\")\n redirect_to(url)\n else\n redirect_to(default)\n end\n store_location(nil)\n return false\n end",
"def redirect_back_or_to(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n # The following deletion happens even though the redirect stastement is written first.\n # This is because the redirect doesn't actually happen until an explicit\n # return statement or until the end of a method.\n session.delete(:forwarding_url)\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url) #delete what is stored.\n end",
"def redirect(location, status = '302'); request.redirect(location, status); end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarind_url)\n end",
"def redirect_back_or(default)\n\n\t\t# redirects user to page stored in session symbol or the\n\t\t# dafault location if return_ to is not set.\n\t\tredirect_to(session[:return_to] || default)\n\n\t\t# Deletes the session symbol return_to\n\t\tsession.delete(:return_to)\n\tend",
"def redirect_back_or(default)\n \tredirect_to(session[:forwarding_url] || default)\n\t session.delete(:forwarding_url)\n\tend",
"def redirect_path(name, default = nil)\n stored_redirect_path(name) || default || root_path\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default )\n session.delete(:forwarding_url)\n end",
"def redirect_back_or_default(default=nil)\n default = self.default_route\n redirect_to(session[:return_to] || default)\n session[:return_to] = nil\n end",
"def redirect_back_or(default)\n # Redirects don’t happen until an explicit return or the end of the method, \n # so any code appearing after the redirect is still executed.\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end",
"def redirect_back_or(default)\n redirect_to session[:forwarding_url] || default\n session.delete(:forwarding_url)\n end",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url]||default)\n\t\tsession.delete(:forwarding_url)\n\tend",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default )\n\t\tsession.delete(:forwarding_url)\n\tend",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end",
"def redirect_back_or(default)\n\t redirect_to(session[:forwarding_url] || default)\n\t session.delete(:forwarding_url)\n\tend",
"def redirect_to_forwarding_url_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || root_path)\n session.delete(:forwarding_url)\n end",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend",
"def redirects; end",
"def redirect_back_or(default)\n \tredirect_to(session[:forwarding_url] || default)\n \tsession.delete(:forwarding_url)\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default )\n session.delete(:forwarding_url)\n end",
"def redirect_back_or_default(default)\n redirect_to(session[:return_to] || default)\n session[:return_to] = nil\n end",
"def get_default_or_back_to path = nil\n # TODO: Should redirect to user feed\n path ||= root_path\n redirect_to path\n end",
"def redirect_to_target(default=nil)\n \n goto_url=params[:return_to] || session[:return_to] || default || \"/\"\n \n session[:return_to] = nil\n redirect_to(goto_url)\n end",
"def redirect_back_or_default(default=root_path)\n redirect_to back_url(default)\n end",
"def default\n lambda { res.redirect('/', 301) }\n end",
"def redirect_back_or(default)\n redirect_url = session[:forwarding_url] || default\n session.delete :forwarding_url\n redirect_to redirect_url\n end",
"def redirect_back_or_default(default)\n redirect_to(session[:request_uri] || default)\n session[:request_uri] = nil\n end",
"def redirect_back_or(default)\n \tredirect_to(session[:forwarding_url] || default)\n \tsession.delete(:forwarding_url)\n end"
] |
[
"0.809772",
"0.8053922",
"0.77915525",
"0.7788125",
"0.7561743",
"0.75439",
"0.7450235",
"0.74379057",
"0.74101406",
"0.7312566",
"0.7272844",
"0.7264558",
"0.72588974",
"0.7244659",
"0.72379357",
"0.7237905",
"0.72314495",
"0.7227404",
"0.7223874",
"0.7214233",
"0.7202999",
"0.71993816",
"0.7198996",
"0.719391",
"0.71895164",
"0.7184775",
"0.718081",
"0.71722984",
"0.71610695",
"0.71603703",
"0.71549815",
"0.71518505",
"0.71518505",
"0.71514094",
"0.7143749",
"0.7141249",
"0.71394676",
"0.71365213",
"0.71365213",
"0.71365213",
"0.71365213",
"0.71365213",
"0.71365213",
"0.71365213",
"0.7134171",
"0.7132278",
"0.71310824",
"0.71296746",
"0.7127168",
"0.712079",
"0.7120735",
"0.71169317",
"0.7115659",
"0.71139413",
"0.7104314"
] |
0.7098507
|
98
|
returns user_id/ or nil
|
def temporary_session?
session[:user_id]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user_id\n unless @user_id.nil? || @user_id == 0\n @user_id\n else\n read_attribute(:user_id) # TODO: Might need to cache result\n end\n end",
"def user_id\n self.user.id unless user.nil?\n end",
"def user_id\n return nil unless success?\n\n @user_id\n end",
"def user_id\n\t\t@user_id || nil\n\tend",
"def user_id\n @user_id ||= self.user ? self.user.to_global_id : nil\n end",
"def user_id\n user.id\n end",
"def user_id\n return @user_id\n end",
"def user_id\n return @user_id\n end",
"def user_id\n return @user_id\n end",
"def user_id\n return @user_id\n end",
"def user_id\n return @user_id\n end",
"def user_id\n return @user_id\n end",
"def find_user_id\n if (params[:user_id])\n return params[:user_id].to_i\n else\n return params[:id].to_i\n end\n end",
"def get_user_id\n if current_user\n @user = User.find(current_user.id)\n end\nend",
"def extract_user_id(params)\n User.find_by_id(params[:user_id]) || User.find_by_email(params[:email]) || nil\n end",
"def user_id; 1; end",
"def user_id\n @current_user.id if !@current_user.nil? && users.include?(@current_user)\n users.first.id\n end",
"def user_id_for(user)\n find(user.id, user.login)\n end",
"def user_id\n if (id = (@opts[:user_id] || @opts['user_id'])) && id.respond_to?(:to_s)\n if (id = id.to_s).size > 0 && id != '0'\n return id\n end\n end\n end",
"def get_user_id\n # TODO: #6. Complete the function to return your user id\n user_id = 'Put your user ID here'\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @attributes[:user_id]\n end",
"def user_id\n @logged_in_user = User.find_by(id: params[:id])\n @user_id = @logged_in_user.id\n end",
"def user_id\n raise \"Implement in Client or Advocate\"\n end",
"def hubssolib_get_user_id\n user = self.hubssolib_current_user\n user ? user.user_id : nil\n end",
"def user_id\n username\n end",
"def user_id\n @current_user.id\n end",
"def user_id\n @raw['user']['id']\n end",
"def userid\n userids&.first\n end",
"def user_id\n instance_variable_get(:@prepared_arguments).dig(:user_id)\n end",
"def user; User.find_by_id(user_id); end",
"def getUserID\n if signed_in? \n if params[:id].empty?\n uid = current_user.id\n else\n uid = params[:id]\n end\n @user = User.find(uid)\n else\n redirect_to pages_home_path\n end\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 user_id(transition)\n user_id = transition.args.last[:user_id] if transition.args.present?\n user_id ||= 0\n end",
"def user_id(user)\n # noinspection RubyMismatchedReturnType\n user.is_a?(Integer) ? user : User.id_value(user)&.to_i\n end",
"def user_id\n self.user.id\n end",
"def get_user_id(username)\n # .........\n end",
"def id\r\n return @user.id\r\n end",
"def id_from_user(u)\n u.is_a?(Twitter::User) ? u.id : u\n end",
"def user_id\n case @params.event\n when 'conversation_started', 'subscribed'\n @params.user.id\n when 'unsubscribed', 'delivered', 'seen', 'failed'\n @params.user_id\n when 'message'\n @params.sender.id\n else\n @params.dig(:user, :id)\n end\n end",
"def user_id\n self.person.user.id if self.person\n end",
"def user_id\n self.person.user.id if self.person\n end",
"def user_id\n self.person.user.id if self.person\n end",
"def user\n User.get user_id || User.new\n end",
"def current_user_id\n info['user']['id']\n end",
"def current_user_id\n 1\n end",
"def id\n @data[:user_id]\n end",
"def user_id\n query_params&.dig(:user_id)\n end",
"def get_user_id(reaktoruser_id)\n IdStore.get(:reaktoruser, reaktoruser_id)\n end",
"def user_id\n @message[:user][:id]\n end",
"def user_id\n config.present? ? config[:user_id] : ''\n end",
"def user\n user_id.get_object\n end",
"def check_user_id\n if self.user_id.nil?\n set_user_id\n end\n end",
"def user_id\n @values.fetch('userId') { \n @values['userId'] = nil\n }\n end",
"def user_id\n # The user id can't be handled by the method_missing magic from\n # OctocatHerder::Base, since the id method returns the object\n # id.\n @raw['id']\n end",
"def auth_user_id\n auth[:user_id]\n end",
"def user\n @user ||= User.find(user_id)\n end",
"def get_id(user_name)\n return get_value_of(user_name, :id)\n end",
"def id\n self.user_id\n end",
"def user\n if users.size == 1\n users.first\n else\n nil\n end\n end",
"def user_for_draftsman\n return unless defined?(current_user)\n ActiveSupport::VERSION::MAJOR >= 4 ? current_user.try!(:id) : current_user.try(:id)\n rescue NoMethodError\n current_user\n end",
"def get_user_or_current_user(id)\n id = params[:id]\n if id == current_user.id\n return current_user\n end\n user = User.find_by_id(id)\n if user.nil?\n return current_user\n else\n return user\n end\n\n end",
"def user\n user ||= User.find(self.user_id)\n end",
"def get_user_from_id\n #convert URL id to integer and set into instance var user_id\n @user_id = params[:id].to_i\n #look up the user based on id and cast into instance var\n @user = User.find_by_id(@user_id)\n #if no user found redirect back to previous page with error\n if !@user\n flash[:error] = \"User does not exist\"\n custom_redirect_back\n end\n end",
"def auth_user_id\n session[:current_user_id] unless session[:current_user_id].nil?\n end",
"def user\n User.find_by_id self.user_id \n end",
"def other_user(user_id)\n if user_1_id == user_id\n user_2_id\n else\n user_1_id\n end\n end",
"def user_id; config[:user_id]; end",
"def user\n return User.current unless user_id\n user = User.get_from_cache(user_id)\n user || User.first({:id => user_id})\n end",
"def get_user \n\t\treturn User.find(self.user_id)\n\tend",
"def user\n User.find(self[:user_id])\n end",
"def current_user_id\n session[:user_id]\n end",
"def user_id\n item.jid.node if item\n end",
"def current_user_unique_id\n return current_user.id unless current_user.nil?\n request.session_options[:id]\n end",
"def current_user\n return nil if current_user_id.nil?\n User.find(current_user_id)\nend",
"def get_account_id\n if user\n return user.get_account_id\n end\n end",
"def user_id\n Reddit::Base.user_id\n end",
"def get_user_from_id(user_id)\n \t\tuser = nil\n \t\tunless user_id.blank?\n\t \t\tcol = :email\n\t \t\tif CONFIG[:enable_username?]\n\t \t\t\tunless is_email(user_id)\n\t \t\t\t\tcol = :username\n\t \t\t\tend\n\t \t\tend\n#\t \t\tp \"Finding user by col: #{col}, user_id = #{user_id}\"\n\t \t\tuser = User.find_by(col => user_id.downcase)\n\t \tend\n\t \tuser\n \tend",
"def user_param\n params[:user_id]\n end",
"def user_param\n params[:user_id]\n end",
"def user_id\n decoded_token.first['user_id']\n end",
"def user\n Webmetrics.users.find_one('_id' => id)\n end",
"def userid\n \treturn session[:userid]\n \tend",
"def find_user(user_id)\n user = User.find(user_id)\n user\n end",
"def user\n UserRepository.find(user_id)\n end",
"def store_user_id(user)\n\t\t@id = user\n\tend",
"def user\n find_user params._id\n end",
"def current_user(id = session[:user_id])\n User.get_one id\n end",
"def user(id:)\n User.find(id)\n end",
"def identify_the_user\n \t@current_user = User.find_by_id(session[\"user_id\"])\n end",
"def actual_user\n User.find_by_id(session[:user_id])\n end",
"def user_id\n self.title_and_name\n end"
] |
[
"0.84042346",
"0.83615744",
"0.8283566",
"0.82630193",
"0.8099813",
"0.8027429",
"0.8005031",
"0.8005031",
"0.8005031",
"0.8005031",
"0.8005031",
"0.8005031",
"0.79956925",
"0.7982825",
"0.7980895",
"0.79615223",
"0.79567003",
"0.79311407",
"0.7925186",
"0.79176104",
"0.7895318",
"0.7895318",
"0.7895318",
"0.7895318",
"0.7895318",
"0.7895318",
"0.7895318",
"0.7895318",
"0.7895318",
"0.7895318",
"0.7759336",
"0.76925606",
"0.7680941",
"0.76726043",
"0.7654257",
"0.7653825",
"0.7648287",
"0.7646225",
"0.7641769",
"0.7632941",
"0.75989383",
"0.75989383",
"0.75816905",
"0.75764084",
"0.7576166",
"0.7569456",
"0.75423837",
"0.7535709",
"0.75301796",
"0.75266993",
"0.75266993",
"0.75266993",
"0.7513835",
"0.75096285",
"0.75016737",
"0.7474266",
"0.74608594",
"0.7441673",
"0.74106985",
"0.7408506",
"0.739258",
"0.7386278",
"0.7374906",
"0.73165965",
"0.7314407",
"0.73020524",
"0.7292722",
"0.7263609",
"0.725999",
"0.7254665",
"0.72209173",
"0.7216089",
"0.72102594",
"0.71917146",
"0.71834713",
"0.7180032",
"0.71620816",
"0.7155353",
"0.71498144",
"0.7133738",
"0.7127167",
"0.7126701",
"0.7107601",
"0.7107301",
"0.70952356",
"0.7074075",
"0.7073749",
"0.7072038",
"0.7072038",
"0.706427",
"0.7062596",
"0.7057672",
"0.7057322",
"0.70556986",
"0.70478207",
"0.70474184",
"0.7036839",
"0.7029191",
"0.70227104",
"0.70172364",
"0.7008776"
] |
0.0
|
-1
|
returns user based on permanent session cookies
|
def remembered_user#(user_id)
user = User.find_by_id(cookies.signed[:user_id])
if user && user.authenticated?(:remember, cookies[:remember_token])
log_in user
return user
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cookied_user\n cookies[:auth] and User.find_by_auth_token(cookies[:auth])\n end",
"def current_user\n # find a user by id based on the stored :user_id cookie\n User.find_by_id(session[:user_id])\n end",
"def get_user_from_session\r\n return User.find(session[:user_id]) if session[:user_id]\r\nend",
"def logged_in_user\n @current_user = User.find_by_id(session[:cookie])\n end",
"def user_from_session\n if session[:user] && session[:user][:id]\n User.find_by_id(session[:user][:id])\n else\n nil\n end\n end",
"def current_user\n #wenn es eine temp session gibt wird die user id von der temp session genommen\n if (user_id = session[:user_id])\n @current_user ||= User.find_by(id: user_id)\n #wenn es keine temp session gibt wird nach einer persistent session gesucht also nach dem cookie mit user_id und der lokalen Variablen user_id übergeben \n elsif (user_id = cookies.signed[:user_id])\n #wenn die id vorhanden ist wird mit ihr dieser user in der Datenbank gesucht und zurückgegeben und in user gespeichert \n user = User.find_by(id: user_id) \n if user && user.authenticated?(:remember, cookies[:remember_token]) #wenn der user nicht nil ist und der remember token zum digest passt wird der user eingeloggt, wenn nicht gibt die methode nil zurück.\n log_in user\n @current_user = user\n end\n end\n end",
"def get_user\n \n # Retrieve user id if stored in a cookies\n # @TODO Secure ID when stored in cookies\n if cookies[:user]\n return User.find(cookies[:user])\n\n # Retrieve user id if stored in session\n elsif session[:user]\n return User.find(session[:user])\n\n # No user logged in\n else\n return nil\n end\n\n end",
"def current_user\n if (user_id = session[:user_id]) #Retrieving the user from the temprary sessions\n @current_user ||= User.find_by(id: user_id) \n elsif (user_id = cookies.signed[:user_id]) #Retrieving the user from the cookies sessions\n user = User.find_by(id: user_id)\n if user && user.authenticated?(:remember, cookies[:remember_token])\n log_in user\n @current_user = user\n end\n end\n end",
"def actual_user\n User.find_by_id(session[:user_id])\n end",
"def current_user\n if (user_id = session[:user_id])\n @current_user ||= User.find_by(id:user_id)\n elsif (user_id = cookies.signed[:user_id])\n user = User.find_by(id:user_id)\n if user && user.authenticated?(cookies[:remember_token])\n sign_in user\n @current_user = user\n end\n end\n @current_user ||= User.find_by_remember_token(cookies[:remember_token])\n #added \n end",
"def current_user\n\t\t#checks if session id cookie is nil\n\t\tif session[:user_id]\n\t\t\t# if it isnt it assigns the user to the instace variable current user if it doesn't have a value\n\t\t\t@current_user||= User.find_by(id: session[:user_id])\n\t\t#checks out if permanent cookies id is nil \n\t\telsif cookies.signed[:user_id]\n\t\t\t#if not it finds the user by that id\n\t\t\tuser = User.find_by(id: cookies.signed[:user_id])\n\t\t\t#checks if the user is nil and uses the user method authentic? to compare the cookie remember_token to the remember_digest\n\t\t\tif user && user.authentic?(:remember, cookies[:remember_token])\n\t\t\t\t#if user is not nil and the permanent cookie match the token it creates a new session based\n\t\t\t\tlogin(user)\n\t\t\t\t#and it assigns the current user\n\t\t\t\t@current_user||= user\n\t\t\tend\n\t\tend\n\tend",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n # return current user or set it to what is found in cookie, only if there is one to begin with\n end",
"def current_user\n @current_user ||= User.where(:id => cookies[:user_id]).first if cookies[:user_id]\n end",
"def getLoggedInUser\n if session[:user_id]\n return User.find(session[:user_id])\n else\n return nil\n end\n end",
"def get_cur_user\n @user = nil\n if is_logged_in session\n @user = User.find_by_sunet(session[:user_hash][\"username\"])\n end\n render json: @user\n end",
"def get_cur_user\n @user = nil\n if is_logged_in session\n @user = User.find_by_sunet(session[:user_hash][\"username\"])\n end\n render json: @user\n end",
"def current_user\n\t\tif (user_id = session[:user_id]) #if you are able to assign this var\n\t\t\t@current_user ||= User.find_by(id: user_id) \n\t\telsif (user_id = cookies.signed[:user_id])\n\t\t\tuser = User.find_by(id: user_id)\n\t\t\t# check the token in the cookie against the user's digest \n\t\t\tif user && user.authenticated?(cookies[:remember_token]) # see user.rb\n\t\t\t\tlog_in user\n\t\t\t\t@current_user = user\n\t\t\tend\n\t\tend\n\tend",
"def find_user(req, cookies_hash)\n user = nil\n user_ip_adress = req.remote_ip\n user_agent = req.user_agent\n user_cookie = cookies_hash[\"user_id\"]\n #ap \"cookie detected: #{user_cookie}\"\n \n #Attempt to find the user by its user_cookie\n user = User.find_by(user_cookie: user_cookie, is_registered: false)\n if user_cookie.blank? || user.blank?\n #If not found by user_cookie, attempt to find the user by its IP & user_agent\n user = User.find_by(ip_adress: user_ip_adress, user_agent: user_agent, is_registered: false)\n #If user found, stores the user_cookie in the cookies of the client\n cookies.permanent[\"user_id\"] = { value: user.user_cookie } if user.present?\n else\n #If the user is found by user_cookie, then update his IP & user_agent\n user.update(user_agent: user_agent) if user_agent != user.user_agent\n user.update(ip_adress: user_ip_adress) if user_ip_adress != user.ip_adress\n end\n return user\n end",
"def current_user\nif (user_id = session[:user_id])\n@current_user ||= User.find_by(id: user_id)\nelsif (user_id = cookies.signed[:user_id])\nuser = User.find_by(id: user_id)\nif user && user.authenticated?(:remember, cookies[:remember_token])\nlog_in user\n@current_user = user\nend\nend\nend",
"def logged_in_user\n return nil if !logged_in?\n return session[\"app_user\"]\n end",
"def current_person_in_cookies\n return current_user if user_signed_in?\n\n person = User.find_by(id: cookies.signed[:guild_hall_user_id])\n return nil if person.nil?\n return nil unless person.authenticated?(cookies[:remember_token])\n\n sign_in person\n @current_user = person\n end",
"def current_user\nif (user_id = session[:user_id])\n@current_user ||= User.find_by(id: user_id)\nelsif (user_id = cookies.signed[:user_id])\nuser = User.find_by(id: user_id)\nif user && user.authenticated?(cookies[:remember_token])\nlog_in user\n@current_user = user\nend\nend\nend",
"def find_current_user\n user_id = session[:user_id]\n if user_id\n user = Marty::User.active.find(user_id) rescue nil\n else\n user = try_to_autologin\n end\n\n user\n end",
"def current_user\n if cookies[:session_id]\n @current_user ||= User.where(session_id: cookies[:session_id])[0]\n else\n nil\n end\n end",
"def user_from_session\n Admin::User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n \tremember_token = User.encript_token(cookies[:remember_token]) #retrieve stored token\n \t@current_user ||= User.find_by(remember_token: remember_token)\n end",
"def current_user\n #return the current logged-in user (temporary session)\n if (user_id = session[:user_id])\n @current_user ||= User.find_by(id: user_id)\n\n #check cookie (permanent session)\n elsif (user_id = cookies.signed[:user_id])\n user = User.find_by(id: user_id)\n if user && user.authenticated?(:remember, cookies[:remember_token])\n log_in user\n @current_user = user\n end\n end\n end",
"def current_user(session = nil, cookies = nil)\n return @env[CURRENT_USER_KEY] if @env.key?(CURRENT_USER_KEY)\n\n request = Rack::Request.new(@env)\n\n id = request.cookies[TOKEN_COOKIE]\n\n current_user = nil\n\n if id && id.length == 40\n current_user = User.find_by_id(id)\n end\n\n if current_user.nil?\n current_user = User.new\n cookies.permanent[TOKEN_COOKIE] = { value: current_user.id, httponly: true }\n end\n\n @env[CURRENT_USER_KEY] = current_user\n end",
"def current_user\n # Look up the current user based on user_id in the session cookie:\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n # Look up the current user based on user_id in the session cookie:\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n user_id = get_log_in_session\n if user_id\n get_user(user_id)\n else\n user = get_user(cookies.signed['user_id'])\n if user&.authenticated?(:remember, cookies[:remember_token])\n set_log_in_session user\n user\n end\n end\n end",
"def current_user\n if session[:user_id] == nil\n return {}\n end\n\n # ruby - implicit return\n return run_sql(\"SELECT * FROM users WHERE id = #{session[:user_id]};\")[0]\nend",
"def logged_in_user\n if (!logged_in?)\n return User.logged_out_user\n end\n #return nil if !logged_in?\n return session[\"app_user\"]\n end",
"def client_side_current_user\n if session[:user_id]\n User.select([:first_name, :last_name, :email]).find session[:user_id]\n end\n end",
"def current_user\n remember_digest = User.digest(cookies[:remember_token])\n @current_user ||= User.find_by(remember_digest: remember_digest)\n end",
"def current_user\n if (user_id = session[:user_id])\n @current_user ||= User.find_by(id: user_id)\n elsif (user_id = cookies.signed[:user_id])\n user = User.find_by(id: user_id)\n # If a user is found AND the cookies remember_token (if exists) matches the unhashed remember_digest of \"user\", then the current_user will be set\n if user && user.authenticated?(:remember, cookies[:remember_token])\n session[:user_id] = user.id\n @current_user ||= user\n end\n end\n end",
"def current_user\n # Look up the current user based on user_id in the session cookie:\n @current_user ||= User.find(session[:id]) if session[:id]\n end",
"def current_user\n\t if session[:user_id]\t#if a session exists, use that\n \t@current_user ||= User.find_by(id: session[:user_id])\n elsif cookies.signed[:user_id] #otherwise use a cookie if it exists\n \tuser = User.find_by(id: cookies.signed[:user_id]) #find the corresponding user\n \tif user && user.authenticated?(:remember, cookies[:remember_token]) #if found and token mathches, login and return\n \t\tlog_in user \n \t\t@current_user = user\n \tend\n end\n end",
"def current_user\n if !get_cookie(\"username\").nil? && !get_cookie(\"password\").nil?\n @user ||= User.find_by(username: get_cookie(\"username\"))\n if @user.nil? || @user.password != decrypt_password(get_cookie(\"password\"))\n @user = nil\n set_cookie(\"username\", \"\")\n set_cookie(\"password\", \"\")\n end\n else\n @user = nil\n end\n @user\n end",
"def current_user\n if session[:user_id]\n @current_user||= User.find_by(id: session[:user_id])\n elsif cookies.signed[:user_id]\n user = User.find_by(id: cookies.signed[:user_id])\n if user && user.user_authenticated?(:remember, cookies[:remember_token])\n log_in user\n @current_user = user\n end\n end\n end",
"def current_user\n if session[:user_id]\n @current_user||= User.find_by(id: session[:user_id])\n elsif cookies.signed[:user_id]\n user = User.find_by(id: cookies.signed[:user_id])\n if user && user.user_authenticated?(:remember, cookies[:remember_token])\n log_in user\n @current_user = user\n end\n end\n end",
"def current_user\n if session[:user_id]\n @current_user||= User.find_by(id: session[:user_id])\n elsif cookies.signed[:user_id]\n user = User.find_by(id: cookies.signed[:user_id])\n if user && user.user_authenticated?(:remember, cookies[:remember_token])\n log_in user\n @current_user = user\n end\n end\n end",
"def current_user\n # this is not ==, its assignment, if user_id exists\n if (user_id=session[:user_id])\n @current_user||=User.find_by(id: session[:user_id])\n elsif (user_id=cookies.signed[:user_id])\n user=User.find_by(id: user_id)\n # :remember here is a symbol, not hash\n if user && user.authenticated?(:remember, cookies[:remember_token])\n log_in user\n @current_user=user\n end\n end\n end",
"def current_user\n User.find_by(id: session[:user_id])\n # takes coordination between your user’s browser and your Rails app to make everything connect up\n # it all starts with cookies\n end",
"def current_user\n\t\t# The following is actually an assignment and not a comparison\n\t\t# If 'session[:user_id]' exists, assign it into user_id and perform the following\n\t\tif (user_id = session[:user_id])\n \t\t@current_user ||= User.find_by(id: user_id)\n \telsif (user_id = cookies.signed[:user_id])\n \t\tuser = User.find_by(id: user_id)\n\n \t\tif user && user.authenticated?(:remember, cookies[:remember_token])\n \t\tlog_in user\n \t\t@current_user = user\n \t\tend\n \tend\n\tend",
"def current_user(id = session[:user_id])\n User.get_one id\n end",
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def current_user\n @current_user ||= User.find_by_id(session[:user_id])\n @current_user ||= User.find_by_remember_me(cookies[:remember_me]) if cookies[:remember_me] && @current_user.nil?\n @current_user\n end",
"def current_user\n remember_token = User.digest(cookies[:remember_token])\n @current_user ||= User.find_by(remember_token: remember_token)\n end",
"def current_user\n remember_token = User.digest(cookies[:remember_token])\n @current_user ||= User.find_by(remember_token: remember_token)\n end",
"def current_user\n if (user_id = session[:user_id]) #if session exists then asssign user id.\n @current_user ||= User.find_by(id: user_id) #assign to current user with found user with user_id\n elsif (user_id = cookies.signed[:user_id]) #if session exists then asssign user id. \n user = User.find_by(id: user_id) #assign user matched with user id\n if user && user.authenticated?(:remember, cookies[:remember_token]) #check if user exists and user authenticated with the cookies remember token\n log_in user #log in as user\n @current_user = user #store user into current user variable\n end\n end\n end",
"def current_user\n if (user_id = session[:user_id])\n @current_user ||= User.find_by(id: user_id)\n elsif (user_id = cookies.signed[:user_id])\n user = User.find_by(id: user_id)\n if user && user.authenticated?(:remember, cookies[:remember_token])\n user_id = session[:user_id] # create a session without login form. ie use the cookie infos\n @current_user = user\n end\n end\n end",
"def current_user\n\t\tremember_token = User.digest(cookies[:remember_token])\n\t\t@current_user ||= User.find_by(remember_token: remember_token)\n\tend",
"def current_user\n# Look up the current user based on user_id in the session cookie:\n#TIP: The ||= part ensures this helper doesn't hit the database every time a user hits a web page. It will look it up once, then cache it in the @current_user variable.\n#This is called memoization and it helps make our app more efficient and scalable.\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\nend",
"def current_user\n\t\t#if there is a session object, use it. otherwise look at the cookie\n\t\tif (user_name = session[:user_name])#This is not comparing with user_name. it is assigning to it\n\t\t\t#if currentuser has someone it returns him. if it is the first call it will be empty in which case\n\t\t\t#we check the cookie and get the id of the guy who is logged in\n\t\t\t#@current_user ||= AdminUser.find_by(username: user_name)\n\t\t\t@current_user ||= find_user(username: user_name)\n\n\t\t#if there was no session id it means either nothing is saved or browser was closed. check for cookie\n\t\telsif (user_name = cookies.signed[:user_name])\t#The signed function will decrypt the id and give\n\t\t\t#find the user in db whose id is stored in cookie\n\t\t\t#user = AdminUser.find_by(username: user_name)\t\n\t\t\tuser = find_user(username: user_name)\t\n\n\t\t\t #The authenticated? method is defined in AdminUser model and authenticates this against what is saved in db using remember token\n\t\t\t #So that way it comes to know if the id belongs to the same guy who was logged in prevoiusly\n\t\t\tif user && user.authenticated?(cookies[:remember_token])\n\t\t\t\t#log in the user\n\t\t\t\tlog_in user\n\t\t\t\t#update the variable so that next time it doesnt have to execute this elseif statement\n\t\t\t\t@current_user = user\n\t\t\tend\n\t\tend\n\tend",
"def current_user\n\t\t@current_user || User.find(cookies[:remember_token])\n\tend",
"def authenticated_user\n if session[:user_id].nil?\n return nil\n else\n return User.find(session[:user_id])\n end\n end",
"def current_user\n \t# get the remember token from the browser. We do this so we identify the current user.\n \t# We also need to encrypt it because it was encrypted in the database\n remember_token = User.encrypt(cookies[:remember_token])\n\n #find_by is only called once when @current_user is nil. Once it\n #has the value of the current_user it will just be the\n #value. Therefore, it only searches through the database once.\n # @current_user = @current_user || User.find_by(remember_token: remember_token)\n @current_user ||= User.find_by(remember_token: remember_token)\n end",
"def current_user\n remember_token = User.encrypt(cookies[:remember_token])\n @current_user ||= User.find_by(remember_token: remember_token)\n end",
"def current_user\n\t\tremember_token = User.encrypt(cookies[:remember_token])\n\t\t@current_user ||= User.find_by(remember_token: remember_token)\n\tend",
"def current_user\n\t\tremember_token = User.encrypt(cookies[:remember_token])\n\t\t@current_user ||= User.find_by(remember_token: remember_token)\n\tend",
"def current_user\n\t\tremember_token = User.encrypt(cookies[:remember_token])\n\t\t@current_user ||= User.find_by(remember_token: remember_token)\n\tend",
"def current_user\n if ( user_id = session[:user_id])\n @current_user ||= User.find_by(id: user_id)\n elsif ( user_id = cookies.signed[:user_id])\n user = User.find_by(id: user_id)\n if user && user.authenticated?(:remember, cookies[:remember_token])\n log_in user\n @current_user = user\n end \n end \n end",
"def current_user\n if (user_id = session[:user_id])\n if @current_user != nil\n @current_user\n elsif session[:user_type_string] == \"UserAdmin\"\n @current_user = UserAdmin.find_by(id: session[:user_id])\n elsif session[:user_type_string] == \"UserProfessore\"\n @current_user = UserProfessore.find_by(id: session[:user_id])\n elsif session[:user_type_string] == \"UserStudente\"\n @current_user = UserStudente.find_by(id: session[:user_id])\n else\n nil\n end\n elsif (user_id = cookies.signed[:user_id])\n if cookies.signed[:user_type_string] == \"UserAdmin\"\n user = UserAdmin.find_by(id: user_id)\n elsif cookies.signed[:user_type_string] == \"UserProfessore\"\n user = UserProfessore.find_by(id: user_id)\n elsif cookies.signed[:user_type_string] == \"UserStudente\"\n user = UserStudente.find_by(id: user_id)\n end\n if user && user.authenticated?(:remember, cookies[:remember_token])\n log_in user\n @current_user = user\n end\n end\n end",
"def guest_user\n User.find_by_lazy_id(cookies[:uuid])\n end",
"def current_user\n remember_token = User.encrypt(cookies[:remember_token])\n @current_user ||= User.where(remember_token: remember_token)[0]\n end",
"def current_user\n @current_user ||= User.find_by_remember_token(cookies[:remember_token]) \n end",
"def get_userid\n request.cookies['userid']\n end",
"def current_user\n if (user_id = session[:user_id])\n @current_user ||= User.find_by(id: user_id)\n elsif (user_id = cookies.signed[:user_id])\n user = User.find_by(id: user_id)\n if user && user.correct_token?(:remember, cookies[:remember_token])\n sign_in user\n @current_user = user\n end\n end\n end",
"def get_user_from_session\n authorize()\n @user = @current_user\n end",
"def current_user\n\t\tif (user_id = session[:user_id])\n\t\t\t@current_user ||= User.find_by(id: user_id)\n\t\telsif (user_id = cookies.signed[:user_id]) # when user closes browser session expires\n\t\t\tuser = User.find_by(id: user_id)\n\t\t\tif user && user.authenticated?(:remember, cookies[:remember_token])\n\t\t\t\tlog_in user # user who comes with cookie does not need to go login page\n\t\t\t\t@current_user = user\n\t\t\tend\n\t\tend\n\tend",
"def current_user\n User.find_by(uid: session[:user]) if logged_in?\n end",
"def current_user\n if session[:user_id]\n return User.find(session[:user_id])\n end\nend",
"def current_user\n \tif id=session[:user_id]\n \t\t@current_user ||= User.find_by(id: id)\n \telsif id=cookies.signed[:user_id]\n \t\tuser=User.find_by(id: id)\n \t\tif user && user.authenticate?(cookies[:remember_token])\n \t\t\tlog_in user\n \t\t\t@current_user=user\n \t\tend\n end\n end",
"def current_user\n return @current_user ||= User.first(token: request.cookies['user']) if request.cookies['user']\n\n @current_user ||= User.first(token: session[:user]) if session[:user]\n end",
"def current_user\n if valid_session?\n User.find(session[:user_id])\n end\n end",
"def current_user\n remember_token = cookies[:remember_token]\n @current_user ||= User.find_by(remember_digest: remember_token)\n end",
"def current_user\n\t\tif logged_in?\n\t\t\t@current_user ||= User.find(cookies[cookie_id])\n\t\telse\n\t\t\tnil\n\t\tend\n\tend",
"def current_user\n if logged_in?\n session[:user] = nil\n return temporary_logged_in_user ? temporary_logged_in_user :\n set_temporary_logged_in_user(cached_user)\n else\n session[:user] ||= create_new_user # if there wasn't one\n session[:user] = create_new_user unless session[:user].respond_to?(:stale?)\n session[:user] = create_new_user if session[:user].stale?\n return session[:user]\n end\n end",
"def current_user\n session[:name] #all i need here (looked at some other solutions to get this)\n end",
"def login_from_cookie\n User.find_by_token!(cookies[:token]) if cookies[:token]\n end",
"def current_user\n session[:usr_id]\n end",
"def current_user\n @current_user ||= User.find_by_remember_token(cookies[:remember_token]) if cookies[:remember_token]\n end",
"def current_user\n @current_user ||= User.find_by_remember_token(cookies[:remember_token]) if cookies[:remember_token]\n end",
"def current_user\n @user_session ||= TimetablesOnRails::UserSession.new session, cookies\n @user_session.current_user\n end",
"def current_user\n remember_token = User.digest(cookies[:remember_token])\n @current_user ||= User.find_by(remember_token: remember_token)\n #set the @current_user instance variable to the user corresponding to the remember token, \n #but only if @current_user is undefined.\n end",
"def current_user\n if (person_id = session[:person_id])\n # If a temporary session exists, use that.\n @current_user ||= Person.find_by(id: person_id)\n elsif (person_id = cookies.signed[:person_id])\n # If cookies exist, use them.\n person = Person.find_by(id: person_id)\n # Extract id from the database.\n if person && person.authenticated?(:remember, cookies[:remember_token])\n # Verify that the cookie matches the remember digest in the database.\n log_in person\n @current_user = person\n end\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n elsif cookies.signed[:user_id]\n user = User.find_by(id: cookies.signed[:user_id])\n if user && user.user_authenticated?(:remember, cookies[:remember_token])\n user_log_in user\n @current_user = user\n end\n end\n end",
"def current_user\n if (user_id = session[:user_id])\n @current_user ||= User.find(user_id)\n elsif (user_id = cookies.signed[:user_id])\n user = User.find(user_id)\n log_in_user_from_cookies(user)\n end\n end",
"def current_user\n if (user_id = session[:user_id])\n @current_user ||= User.find_by(id: user_id)\n elsif (user_id = cookies.signed[:user_id])\n user = User.find_by(id: user_id)\n if user && user.authenticated?(cookies[:remember_token])\n login user\n @current_user = user\n end\n end\n end",
"def current_user\n @current_user ||= User.find_by_auth_token(cookies[:auth_token]) if cookies[:auth_token]\n end",
"def current_user\n\t\tif (user_id=session[:user_id])\n\t\t\t@current_user||=User.find_by(id: user_id)\n\t\telsif (user_id=cookies.signed[:user_id])\n\t\t\t\tuser=User.find_by(id: user_id)\n\t\t\tif user && user.authenticated?(:remember, cookies[:remember_token])\n\t\t\t\tlog_in user\n\t\t\t\t@current_user=user\n\t\t\tend\n\t\tend\n\t\t\t\n\tend",
"def current_user\n User.where(id: session[:user_id]).first\n end",
"def current_user\n if (user_id = session[:user_id])\n @current_user ||= User.find_by(id: user_id)\n elsif (user_id = cookies.signed[:user_id])\n user = User.find_by(id: user_id)\n if user && user.authenticated?(:remember, cookies[:remember_token])\n login(user)\n @current_user = user\n end\n end\n end",
"def temporary_logged_in_user\n @logged_in_user\n end",
"def current_user\n User.where(email: session[:email]).first\n end",
"def current_user\n\t\t@current_user ||= User.find_by_remember_token(cookies[:remember_token])\n\tend",
"def current_user\n\t\t@current_user ||= User.find_by_remember_token(cookies[:remember_token])\n\tend",
"def current_user\n\t\t@current_user ||= User.find_by_remember_token(cookies[:remember_token])\n\tend"
] |
[
"0.79544765",
"0.764715",
"0.7608881",
"0.7574507",
"0.7559167",
"0.7539138",
"0.75350547",
"0.7530476",
"0.7515576",
"0.74733514",
"0.74686813",
"0.7416135",
"0.7379336",
"0.7378661",
"0.7346001",
"0.7346001",
"0.73415256",
"0.73374075",
"0.7321593",
"0.73120236",
"0.7306595",
"0.7302822",
"0.7296963",
"0.72967315",
"0.7291155",
"0.7290742",
"0.728332",
"0.7270241",
"0.7266622",
"0.7266622",
"0.72612405",
"0.72566485",
"0.72499186",
"0.7249151",
"0.7249115",
"0.7226033",
"0.7224406",
"0.7223778",
"0.7214097",
"0.72124517",
"0.72124517",
"0.72124517",
"0.7211223",
"0.7193814",
"0.71856415",
"0.71843493",
"0.71790165",
"0.71790165",
"0.71790165",
"0.717472",
"0.71574795",
"0.71574795",
"0.7153595",
"0.7152461",
"0.7148201",
"0.71439147",
"0.7142252",
"0.71414393",
"0.7141232",
"0.7139076",
"0.7131317",
"0.7124976",
"0.7124976",
"0.7124976",
"0.7122904",
"0.7121979",
"0.7120287",
"0.7119829",
"0.71174437",
"0.71164566",
"0.7115552",
"0.7115275",
"0.7113424",
"0.7113025",
"0.711267",
"0.7111287",
"0.71063554",
"0.71054435",
"0.71052635",
"0.7104229",
"0.7104035",
"0.7099664",
"0.709905",
"0.7096862",
"0.7094112",
"0.7094112",
"0.70905215",
"0.7090388",
"0.7089451",
"0.70862055",
"0.70857584",
"0.70842165",
"0.70816946",
"0.7074499",
"0.7073599",
"0.7072541",
"0.706261",
"0.70560145",
"0.7054251",
"0.7054251",
"0.7054251"
] |
0.0
|
-1
|
GET /availability_products GET /availability_products.json
|
def index
@availability_products = AvailabilityProduct.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def available\n @products = Product.where.not(inventory_count: 0)\n json_response(@products)\n end",
"def index\n limit = params[:limit]&.to_i || 10\n page = params[:page]&.to_i || 0\n if params[:available] == \"1\"\n @products = Product.paginate(page, limit).available\n else\n @products = Product.paginate(page, limit)\n end\n render json: @products\n end",
"def availability(product_id)\n response, status = BeyondApi::Request.get(@session,\n \"/products/#{product_id}/availability\")\n\n handle_response(response, status)\n end",
"def index\n @products = policy_scope(Product).order(created_at: :desc)\n @products = Product.where(availability: true)\n end",
"def getKind\n @products = Product.where(\"kind = ?\", params[:kind]).available.PriceOrder.paginate(page: params[:page], per_page: 5)\n render json: @products\n end",
"def products\n run(:get,\"/school_products\", [200])\n end",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def index\n @api_v1_products = Product.all\n json_response(@api_v1_products)\n end",
"def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n render json: @products\n end\n end",
"def show\n json_response(@api_v1_product)\n end",
"def products\n request :public, :get, :products\n end",
"def product(name)\n get(\"/apiproducts/#{name}\")\n end",
"def all\n @products = Product.get_list_active_products.page(params[:page]).per(10)\n if @products.present?\n @products\n else\n @object = 'product'\n render \"api/v1/errors/404\", status: 401\n end\n end",
"def availability(*args)\n @client.get \"#{@path}/availability\", Hash[*args]\n end",
"def index\n @logical_products = LogicalProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @logical_products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventories }\n end\n end",
"def set_availability_product\n @availability_product = AvailabilityProduct.friendly.find(params[:id])\n end",
"def index\n b_admin = current_user.admin? rescue false\n @products = Product.filter_by_params(b_admin, params)\n #@products = Product.available\n \n @title = Product.page_description(params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def show\n render json: @product, status: 200\n end",
"def show\n @products = Product.find_by_id(params[:id])\n msg = { status: 200 , product: @products }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end",
"def get_products\n products = response['products']\n products_ops = []\n products.each_value do |value|\n product = {}\n product[:sku] = value['sku']\n product[:product_family] = value['productFamily']\n product[:pricing_list_id] = pricing_list.id\n attributes = value['attributes']\n product[:service_code] = attributes['servicecode']\n product[:location] = attributes['location']\n product[:location_type] = attributes['locationType']\n product[:usage_type] = attributes['usagetype']\n product[:operation] = attributes['operation']\n product[:request_description] = attributes['requestDescription']\n product[:request_type] = attributes['requestType']\n product[:service_name] = attributes['servicename']\n product[:pricing_list_id] = pricing_list.id\n product[:created_at] = Time.zone.now.utc\n product[:updated_at] = Time.zone.now.utc\n products_ops << product\n end\n products_ops\n end",
"def index\n @products = Spree::Product.not_deleted.includes(:variants).page(params[:page]).per(Spree::Config[:orders_per_page])\n respond_with @products\n end",
"def user_products\n @products = current_user.products\n\n respond_to do |format|\n format.html\n format.json { render json: @products }\n end\n end",
"def show\n @accessories = @availability_product.accessories.order(\"created_at ASC\").paginate(:page => params[:page], :per_page => 9)\n @cameras = @availability_product.cameras.order(\"created_at ASC\").paginate(:page => params[:page], :per_page => 9)\n @lensas = @availability_product.lensas.order(\"created_at ASC\").paginate(:page => params[:page], :per_page => 9)\n end",
"def available\n @available ||= product.available(inventory, lot_code)\n end",
"def get_products_support_data\n @client.raw('get', '/ecommerce/products/support-data')\n end",
"def show\n @online_store = OnlineStore.find(params[:id])\n @products = @online_store.products\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_store }\n end\n end",
"def get_listings(product_ids)\n get_api_response(\"/api/products/#{product_ids}/listings\")\n end",
"def show\n @home_searches_product = Home::Searches::Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_searches_product }\n end\n end",
"def index\n @lighting_products = LightingProduct.all\n end",
"def index\n @lighting_products = LightingProduct.all\n end",
"def index\n @products = Product.all\n msg = { status: 200 , product: @products }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end",
"def list\n offers = []\n if params[:product_id]\n product = Product.find(params[:product_id])\n if product && (product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n if product.user.id == @current_user.id && params[:include_offers_made_by_other_users] == \"true\"\n product.offers.each do |offer|\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n elsif product.user.id != @current_user.id && params[:include_offers_made_by_current_user] == \"true\"\n offer = Offer.find_by(product_id: product.id, user_id: @current_user.id)\n if offer\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id,\n\t\t\t\t username: product.user.username\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n else\n render status: 404, json: {error: true}\n end\n else\n if params[:include_offers_made_by_current_user] == \"true\"\n @current_user.offers.each do |offer|\n if (offer.product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: offer.product.user.id,\n\t\t\t\t username: offer.product.user.username\n },\n thumbnail: offer.product.thumbnail,\n product_id: offer.product.id,\n product_name: offer.product.product_name,\n product_price: offer.product.price\n },\n product_name: offer.product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n end\n if params[:include_offers_made_by_other_users] == \"true\"\n @current_user.products.each do |product|\n if (product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n product.offers.each do |offer|\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id,\n username: product.user.username\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n end\n end\n end\n render status: 200, json: {offers: offers}\n end",
"def index\n @products = Product.all\n render json: {is_success: true, error_code: 200, message: \"Products Found Successfully\", result: @products}, status: 200\n end",
"def index_approved\n if params[:approved] == 'true'\n @products = Product.where(approved: true)\n elsif params[:approved] == 'false'\n @products = Product.where(approved: false)\n end\n json_response(@products, :ok)\n end",
"def create\n @availability_product = AvailabilityProduct.new(availability_product_params)\n\n respond_to do |format|\n if @availability_product.save\n format.html { redirect_to @availability_product, notice: 'Availability product was successfully created.' }\n format.json { render :show, status: :created, location: @availability_product }\n else\n format.html { render :new }\n format.json { render json: @availability_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n begin\n @products = Product.all\n render json: @products, status: 200\n rescue => exception\n render json: { errors: exception }\n end\n end",
"def index\n @products = Product.all\n render json: @products\n end",
"def get_price\n available_room_response = hotel_service.get_available_room(params)\n service_available_room = process_response(available_room_response, 'HotelRoomAvailabilityResponse')\n rooms = []\n if service_available_room[\"status\"] == OK\n available_rooms = JSON.parse(service_available_room[\"response\"])\n bookings = available_rooms[\"HotelRoomAvailabilityResponse\"]\n if bookings && bookings[\"@size\"].to_i == 1\n rooms = []\n rooms << bookings[\"HotelRoomResponse\"]\n elsif bookings && bookings[\"@size\"].to_i > 1\n rooms = bookings[\"HotelRoomResponse\"]\n end\n end\n render :json => {:result=> rooms}\n end",
"def show\n render json: @product_management\n end",
"def show\n if @product.present?\n render json: {is_success: true, error_code: 200, message: \"Found Successfully\", result: @product}, status: 200\n end\n end",
"def get_product\n json_response({ message: 'NOT IMPLEMENTED' })\n end",
"def show\n render json: @product\n end",
"def show\n @product = Product.find(params[:id])\n json_response(params)\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 user_product_listings\n render json: @user.product_listings\n end",
"def index\r\n @product_machines = ProductMachine.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @product_machines }\r\n end\r\n end",
"def show\n # is_my_resource(params[:id])\n\n # prossumerProductsIds = Prossumer.find(params[:id]).products.ids\n render json: ProductAuth.where({product_id: params[:id], group_id: params[:group_id]}).first.as_json(:include => :product)\n end",
"def show\n \n @product = Product.find(params[:id])\n @vendors = @product.vendor(:all)\n #@vendors = Vendor.find(params[:id])\n #@vendors = Vendor.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def availability_product_params\n params.require(:availability_product).permit(:name)\n end",
"def show\n render json: @product\n end",
"def index\n @user_interactive_products = UserInteractiveProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_interactive_products }\n end\n end",
"def index\n @products = Product.all\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n end",
"def show\n result = Product.find(params[:id])\n render json: {\n status: :ok,\n product: result\n } \n end",
"def index\n @products = @user.products\n # was @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def index\n\n # get the gauges to choose from\n @gauges = Product.gauges\n\n @device = detect_browser()\n\n # get the applications to choose from\n @applications = Product.applications\n\n @products = Product.all\n\n prod_params = params[:product]\n @selected_app = \"\"\n @selected_awg = \"\"\n\n if prod_params != nil\n if prod_params[\"selected_app\"] != nil\n @selected_app = prod_params[\"selected_app\"]\n @products = @products.single_application(@selected_app)\n logger.debug \"products single app: #{@products.inspect}\"\n end\n if prod_params[\"selected_awg\"] != nil\n @selected_awg = prod_params[\"selected_awg\"]\n @products = @products.single_gauge(@selected_awg)\n logger.debug \"products single gauge: #{@products.inspect}\"\n end\n\n #params[:page] = prod_params[\"page\"] if params[:page] == nil\n\n end\n\n @search_terms = params[\"search_terms\"] unless params[\"search_terms\"] == nil\n\n if params[:page] == nil\n @products = @products.search(params[\"search_terms\"], 1)\n @page = 1\n else\n @products = @products.search(params[\"search_terms\"], params[:page])\n @page = params[:page]\n end\n end",
"def find_available_products(options={})\n defaults = {\n :country_code => Utility.country_code,\n :sku_type => '%',\n :active => true,\n :internal => true\n }\n options = defaults.merge(options).symbolize_keys\n\n query = \"topics.sku_type LIKE ?\"\n query += sanitize_sql([\" AND topics.status = ?\", 'active']) if options[:active] == true\n query += sanitize_sql([\" AND topics.internal = ?\", true]) if options[:internal] == true\n if options[:language_code] && options[:country_code]\n query += \" AND ((topics.language_code LIKE ? OR topics.language_code IS NULL)\" +\n \" AND (topics.country_code LIKE ? OR topics.country_code IS NULL))\"\n conditions = [query, options[:sku_type], options[:language_code].to_s.downcase, options[:country_code].to_s.upcase]\n elsif options[:country_code]\n query += \" AND (topics.country_code LIKE ? OR topics.country_code IS NULL)\"\n conditions = [query, options[:sku_type], options[:country_code].to_s.upcase]\n else\n conditions = [query, options[:sku_type]]\n end\n order = \"#{sanitize_sql([\"topics.country_code IN (?) DESC, topics.country_code IS NULL ASC\", [options[:country_code]]])}\"\n group = \"topics.sku_type, topics.sku_id, topics.sku_variant_id\"\n \n find(:all, :include => :prices, :conditions => conditions, :order => order, :group => group)\n end",
"def index\n @ordered_products = OrderedProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordered_products }\n end\n end",
"def index\n @specific_availabilities = SpecificAvailability.all\n end",
"def index\n @product = Product.find(params[:product_id])\n @product_stocks = @product.product_stocks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_stocks }\n end\n end",
"def index\n @product_delivereds = ProductDelivered.where(:subscription_id => @subscription.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_delivereds }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def show\n @product_solution = ProductSolution.new(solution: @solution)\n @all_products = [[website.brand.name, website.products]]\n Brand.where(live_on_this_platform: true).where.not(id: website.brand_id).order(Arel.sql(\"UPPER(name)\")).each do |brand|\n if Product.where(brand_id: brand.id).count > 0\n @all_products << [brand.name, Product.where(product_status_id: ProductStatus.current_ids, brand_id: brand.id).order(\"name\")]\n end\n end\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @solution }\n end\n end",
"def index\n \t\t# if params[:search].present? # check if somebody typed into searchbar\n # \t\t@products = Product.search(params[:search])\n \t\t# else # if not show all active products\n\n \t\t# Show all active products and suffle them to always show a different view\n\t\t\t@products = Product.where(active: true)\n\t\t\t@products.shuffle\n \t\t# end\n\t\tjson_response(@products)\n\tend",
"def show\n @product = Product.find(params[:id])\n render json: @product, status: :ok\n end",
"def index\n @product_managements = ProductManagement.all\n\n render json: @product_managements\n end",
"def index\n if current_user.admin?\n @products = Product.all\n else\n if current_user.private?\n @products = Product.where(owner_id: current_user.private_id)\n elsif current_user.business?\n @products = Product.where(owner_id: current_user.business_id)\n end\n\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def show\n if (params[:rnpa])\n @product = Product.find_by_rnpa(params[:rnpa])\n elsif (params[:barcode])\n @products = Product.search_by_barcode(params[:barcode])\n end\n\n respond_to do |format|\n if @product\n format.html # show.html.erb\n format.json { render json: @product }\n elsif @products\n format.json { render json: @products }\n else\n format.json { render json: \"Not found!\", status: :ok }\n end\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end",
"def index\n @floor_plans = @product.floor_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @floor_plans }\n end\n end",
"def products\n Product.find_all_by_vendor_id(@id)\n end",
"def bring_products_from_wardrobe\n wardrobe_products = []\n current_user.products.order(:created_at => 'ASC').each do |product|\n wardrobe_products << search_by_id(product.id)\n end\n\n render json: {status: 0, data:{wardrobe_products: wardrobe_products}}\n end",
"def index\n\t@products = Product.where(:inventory => true).order(:category_id).page(params[:page])\n @donors = Donor.all\n @categories = Category.all\n @products2 = Product.where(:inventory => false).order(:category_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n render json: @product\n end",
"def index\n @pe_exchange_products = PeExchangeProduct.all.page(params[:page]).per(params[:per_page])\n respond_to do |format|\n format.html\n format.json { render json:\n list_json(@pe_exchange_products, :include => [:pe_product])\n }\n end\n end",
"def get_enterable_products\n return call('Product.get_enterable_products')\n end",
"def index\n\t\t@products = Product.page(params[:page])\n respond_with(@products)\n end",
"def show\n @product = ProductProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def index\n begin\n \n products = Product.all\n render json: {\n success: true,\n totalRecords: products.length,\n data: (ActiveModel::ArraySerializer.new(products, each_serializer: ProductSerializer))\n }, status: 200\n rescue ActiveRecord::RecordNotFound => e\n render json: {\n success: false,\n errors: e.message\n }, status: 404\n rescue Exception => e\n render json: {\n success: false,\n errors: e.message\n }, status: 500\n end\n end",
"def index\n @food_products = FoodProduct.all\n render json: @food_products\n end",
"def index\n @site_plans = @product.site_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_plans }\n end\n end",
"def show\n @products = @vendor.products\n end",
"def load_item_data\n\n \n @product = CurrentInventory.find_by(product_id: params[:product_id])\n \n \n render :json => [@product.product.price, @product.current_quantity,@product.product.unit]\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n end",
"def show\n @product = Product.eager_loading.find_by_uuid(params[:id])\n\n respond_to do |format|\n format.html { redirect_to edit_shop_product_path(@product.shop_id, @product)}\n format.json { render json: @product.as_json(:include => {:product_variants => {:include => [:option_types,:pictures]}, :shipping_category => {}}, :methods => [:taxon_ids]) }\n end\n end",
"def show\n @listings_products = @listing.listings_products.includes(:product)\n end",
"def get_products_by_category\n json_response({ message: 'NOT IMPLEMENTED' })\n end",
"def index\n \tproducts = Product.all\n \trender json: products\n \tend",
"def show\n @supplier = Supplier.find(params[:supplier_id])\n @product = @supplier.products.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product }\n end\n end",
"def index\n get_sparepart\n get_data\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n format.js\n end\n end",
"def index\n @stocking_products = StockingProduct.all\n end",
"def show\n @supplier = Supplier.find(params[:id])\n @products = Product.where(:supplier_id => @supplier.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @supplier }\n end\n end",
"def get_variant\n @product = Spree::Product.find_by :slug => params[:product_id]\n @variant = @product.find_variant_by_options(params[:ids].split(','))\n if @variant\n respond_to do |format|\n format.json {render json: {variant_id: @variant.id, image_ids: @variant.image_ids}}\n end\n end\n end",
"def show\n render json: @product_buy_click\n end"
] |
[
"0.7711631",
"0.7450315",
"0.73196596",
"0.68163335",
"0.6724529",
"0.66865385",
"0.6612116",
"0.65708023",
"0.65629584",
"0.6531176",
"0.6524272",
"0.65159017",
"0.6507209",
"0.64764553",
"0.6461579",
"0.6419418",
"0.6414017",
"0.64119",
"0.6383029",
"0.63594824",
"0.63302684",
"0.63258153",
"0.6321549",
"0.6310161",
"0.6302283",
"0.6298076",
"0.62901056",
"0.627956",
"0.624688",
"0.62436604",
"0.62436604",
"0.6232119",
"0.623078",
"0.62241834",
"0.6222585",
"0.6221009",
"0.62176895",
"0.6214063",
"0.6212683",
"0.62093025",
"0.6207056",
"0.61953294",
"0.61807156",
"0.6165286",
"0.616357",
"0.6155866",
"0.61556095",
"0.61511517",
"0.61460775",
"0.6133656",
"0.6132346",
"0.6121374",
"0.6118706",
"0.611262",
"0.61078197",
"0.610464",
"0.6104566",
"0.6097102",
"0.6056419",
"0.6047346",
"0.6044259",
"0.6042029",
"0.60419613",
"0.60419613",
"0.60419613",
"0.6027701",
"0.60274297",
"0.6027332",
"0.6026723",
"0.6022464",
"0.6005441",
"0.6003639",
"0.6003639",
"0.6003639",
"0.6003639",
"0.5992874",
"0.5988447",
"0.59856826",
"0.5976389",
"0.59730685",
"0.59705865",
"0.5969571",
"0.5968515",
"0.5966277",
"0.5965513",
"0.5958626",
"0.5957796",
"0.5952152",
"0.59520596",
"0.5950715",
"0.594401",
"0.5943788",
"0.5936467",
"0.59345996",
"0.59281373",
"0.59254444",
"0.5924745",
"0.5922212",
"0.5919517",
"0.5917158"
] |
0.760284
|
1
|
GET /availability_products/1 GET /availability_products/1.json
|
def show
@accessories = @availability_product.accessories.order("created_at ASC").paginate(:page => params[:page], :per_page => 9)
@cameras = @availability_product.cameras.order("created_at ASC").paginate(:page => params[:page], :per_page => 9)
@lensas = @availability_product.lensas.order("created_at ASC").paginate(:page => params[:page], :per_page => 9)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @availability_products = AvailabilityProduct.all\n end",
"def available\n @products = Product.where.not(inventory_count: 0)\n json_response(@products)\n end",
"def index\n limit = params[:limit]&.to_i || 10\n page = params[:page]&.to_i || 0\n if params[:available] == \"1\"\n @products = Product.paginate(page, limit).available\n else\n @products = Product.paginate(page, limit)\n end\n render json: @products\n end",
"def availability(product_id)\n response, status = BeyondApi::Request.get(@session,\n \"/products/#{product_id}/availability\")\n\n handle_response(response, status)\n end",
"def show\n json_response(@api_v1_product)\n end",
"def index\n @api_v1_products = Product.all\n json_response(@api_v1_products)\n end",
"def getKind\n @products = Product.where(\"kind = ?\", params[:kind]).available.PriceOrder.paginate(page: params[:page], per_page: 5)\n render json: @products\n end",
"def product(name)\n get(\"/apiproducts/#{name}\")\n end",
"def show\n render json: @product, status: 200\n end",
"def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n render json: @products\n end\n end",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def show\n @products = Product.find_by_id(params[:id])\n msg = { status: 200 , product: @products }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end",
"def index\n @products = policy_scope(Product).order(created_at: :desc)\n @products = Product.where(availability: true)\n end",
"def index\n @logical_products = LogicalProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @logical_products }\n end\n end",
"def show\n @home_searches_product = Home::Searches::Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_searches_product }\n end\n end",
"def set_availability_product\n @availability_product = AvailabilityProduct.friendly.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n json_response(params)\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventories }\n end\n end",
"def show\n result = Product.find(params[:id])\n render json: {\n status: :ok,\n product: result\n } \n end",
"def show\n if @product.present?\n render json: {is_success: true, error_code: 200, message: \"Found Successfully\", result: @product}, status: 200\n end\n end",
"def show\n @product = Product.find(params[:id])\n render json: @product, status: :ok\n end",
"def show\n render json: @product_management\n end",
"def show\n @online_store = OnlineStore.find(params[:id])\n @products = @online_store.products\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_store }\n end\n end",
"def show\n render json: @product\n end",
"def get_product\n json_response({ message: 'NOT IMPLEMENTED' })\n end",
"def index\n b_admin = current_user.admin? rescue false\n @products = Product.filter_by_params(b_admin, params)\n #@products = Product.available\n \n @title = Product.page_description(params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def show\n render json: @product\n end",
"def products\n run(:get,\"/school_products\", [200])\n end",
"def index\n @products = Product.all\n msg = { status: 200 , product: @products }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end",
"def show\n # is_my_resource(params[:id])\n\n # prossumerProductsIds = Prossumer.find(params[:id]).products.ids\n render json: ProductAuth.where({product_id: params[:id], group_id: params[:group_id]}).first.as_json(:include => :product)\n end",
"def show\n @product = Product.find(params[:id])\n\n render json: @product\n end",
"def products\n request :public, :get, :products\n end",
"def show\n @product = ProductProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n \n @product = Product.find(params[:id])\n @vendors = @product.vendor(:all)\n #@vendors = Vendor.find(params[:id])\n #@vendors = Vendor.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n product = Product.find_by_id(params[:id])\n\n render json: product\n end",
"def index\r\n @product_machines = ProductMachine.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @product_machines }\r\n end\r\n end",
"def get_products\n products = response['products']\n products_ops = []\n products.each_value do |value|\n product = {}\n product[:sku] = value['sku']\n product[:product_family] = value['productFamily']\n product[:pricing_list_id] = pricing_list.id\n attributes = value['attributes']\n product[:service_code] = attributes['servicecode']\n product[:location] = attributes['location']\n product[:location_type] = attributes['locationType']\n product[:usage_type] = attributes['usagetype']\n product[:operation] = attributes['operation']\n product[:request_description] = attributes['requestDescription']\n product[:request_type] = attributes['requestType']\n product[:service_name] = attributes['servicename']\n product[:pricing_list_id] = pricing_list.id\n product[:created_at] = Time.zone.now.utc\n product[:updated_at] = Time.zone.now.utc\n products_ops << product\n end\n products_ops\n end",
"def show\n @product = Product.eager_loading.find_by_uuid(params[:id])\n\n respond_to do |format|\n format.html { redirect_to edit_shop_product_path(@product.shop_id, @product)}\n format.json { render json: @product.as_json(:include => {:product_variants => {:include => [:option_types,:pictures]}, :shipping_category => {}}, :methods => [:taxon_ids]) }\n end\n end",
"def index\n @products = Product.all\n render json: {is_success: true, error_code: 200, message: \"Products Found Successfully\", result: @products}, status: 200\n end",
"def create\n @availability_product = AvailabilityProduct.new(availability_product_params)\n\n respond_to do |format|\n if @availability_product.save\n format.html { redirect_to @availability_product, notice: 'Availability product was successfully created.' }\n format.json { render :show, status: :created, location: @availability_product }\n else\n format.html { render :new }\n format.json { render json: @availability_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @user_interactive_products = UserInteractiveProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_interactive_products }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n end",
"def index\n @products = Product.all\n render json: @products\n end",
"def index\n @products = Product.all\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n end",
"def show\n @magento_product = MagentoProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @magento_product }\n end\n end",
"def load_item_data\n\n \n @product = CurrentInventory.find_by(product_id: params[:product_id])\n \n \n render :json => [@product.product.price, @product.current_quantity,@product.product.unit]\n end",
"def show\n @product = Product.find(params[:id])\n\n render json: @product\n end",
"def index\n begin\n @products = Product.all\n render json: @products, status: 200\n rescue => exception\n render json: { errors: exception }\n end\n end",
"def all\n @products = Product.get_list_active_products.page(params[:page]).per(10)\n if @products.present?\n @products\n else\n @object = 'product'\n render \"api/v1/errors/404\", status: 401\n end\n end",
"def show\n @product2 = Product2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product2 }\n end\n end",
"def show\n render json: @product_buy_click\n end",
"def index\n @site_plans = @product.site_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_plans }\n end\n end",
"def user_products\n @products = current_user.products\n\n respond_to do |format|\n format.html\n format.json { render json: @products }\n end\n end",
"def show\n @ordered_product = OrderedProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ordered_product }\n end\n end",
"def availability(*args)\n @client.get \"#{@path}/availability\", Hash[*args]\n end",
"def index\n @product = Product.find(params[:product_id])\n @product_stocks = @product.product_stocks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_stocks }\n end\n end",
"def show\n @supplier = Supplier.find(params[:supplier_id])\n @product = @supplier.products.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def index\n @floor_plans = @product.floor_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @floor_plans }\n end\n end",
"def show\n @breadcrumb = 'read'\n @product_type = ProductType.find(params[:id])\n @products = @product_type.products.paginate(:page => params[:page], :per_page => per_page).order('product_code')\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_type }\n end\n end",
"def get_variant\n @product = Spree::Product.find_by :slug => params[:product_id]\n @variant = @product.find_variant_by_options(params[:ids].split(','))\n if @variant\n respond_to do |format|\n format.json {render json: {variant_id: @variant.id, image_ids: @variant.image_ids}}\n end\n end\n end",
"def show\n @product_price = ProductPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_price }\n end\n end",
"def show\n @product_stock = ProductStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_stock }\n end\n end",
"def index\n @products = Spree::Product.not_deleted.includes(:variants).page(params[:page]).per(Spree::Config[:orders_per_page])\n respond_with @products\n end",
"def index\n @product_images = ProductImage.where(product_uuid: params[:product_id])\n render json: @product_images, status: 200\n end",
"def index\n @ordered_products = OrderedProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordered_products }\n end\n end",
"def set_api_v1_product\n begin\n @api_v1_product = Product.find(params[:id])\n rescue => ex\n json_response({error: ex.message}, :not_found)\n end\n end",
"def show\n @pro_wmall_product = Wmall::Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pro_wmall_product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product_stock = ProductStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product_stock }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def list\n offers = []\n if params[:product_id]\n product = Product.find(params[:product_id])\n if product && (product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n if product.user.id == @current_user.id && params[:include_offers_made_by_other_users] == \"true\"\n product.offers.each do |offer|\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n elsif product.user.id != @current_user.id && params[:include_offers_made_by_current_user] == \"true\"\n offer = Offer.find_by(product_id: product.id, user_id: @current_user.id)\n if offer\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id,\n\t\t\t\t username: product.user.username\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n else\n render status: 404, json: {error: true}\n end\n else\n if params[:include_offers_made_by_current_user] == \"true\"\n @current_user.offers.each do |offer|\n if (offer.product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: offer.product.user.id,\n\t\t\t\t username: offer.product.user.username\n },\n thumbnail: offer.product.thumbnail,\n product_id: offer.product.id,\n product_name: offer.product.product_name,\n product_price: offer.product.price\n },\n product_name: offer.product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n end\n if params[:include_offers_made_by_other_users] == \"true\"\n @current_user.products.each do |product|\n if (product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n product.offers.each do |offer|\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id,\n username: product.user.username\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n end\n end\n end\n render status: 200, json: {offers: offers}\n end",
"def index\n @product_delivereds = ProductDelivered.where(:subscription_id => @subscription.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_delivereds }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def show\n @product_subscription = ProductSubscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product_subscription }\n end\n end",
"def get_products_support_data\n @client.raw('get', '/ecommerce/products/support-data')\n end"
] |
[
"0.74479944",
"0.73081756",
"0.72781324",
"0.7073272",
"0.7060082",
"0.6904925",
"0.68826896",
"0.68689483",
"0.67799497",
"0.6720815",
"0.6701322",
"0.6668789",
"0.6647533",
"0.66358507",
"0.66000247",
"0.6592173",
"0.6584175",
"0.6576891",
"0.6572918",
"0.65121067",
"0.6493119",
"0.64927775",
"0.64918125",
"0.6485654",
"0.6465719",
"0.645519",
"0.6431213",
"0.64231133",
"0.6422227",
"0.6420982",
"0.6416557",
"0.6396474",
"0.63599426",
"0.6348309",
"0.63332844",
"0.6317577",
"0.6316168",
"0.63116884",
"0.6309307",
"0.6306301",
"0.6296785",
"0.629244",
"0.6288067",
"0.6288037",
"0.6283749",
"0.62812734",
"0.6279874",
"0.62789047",
"0.627592",
"0.6270015",
"0.62629616",
"0.6257433",
"0.6257005",
"0.6251461",
"0.62514025",
"0.6251396",
"0.6250628",
"0.6250097",
"0.624522",
"0.6244562",
"0.6238906",
"0.62315106",
"0.623026",
"0.6225077",
"0.62245977",
"0.6208225",
"0.6200852",
"0.6195542",
"0.6192158",
"0.61899817",
"0.6189141",
"0.618882",
"0.6188642",
"0.6188642",
"0.6188642",
"0.6188642",
"0.6188642",
"0.6188642",
"0.6188642",
"0.6188642",
"0.6188642",
"0.6188642",
"0.6188642",
"0.6188642",
"0.6188642",
"0.6188642",
"0.6188642",
"0.6188642",
"0.6188642",
"0.6188642",
"0.6188642",
"0.6188642",
"0.618527",
"0.6182722",
"0.61771315",
"0.6177061",
"0.6177061",
"0.6177061",
"0.61718005",
"0.6167485"
] |
0.63380986
|
34
|
POST /availability_products POST /availability_products.json
|
def create
@availability_product = AvailabilityProduct.new(availability_product_params)
respond_to do |format|
if @availability_product.save
format.html { redirect_to @availability_product, notice: 'Availability product was successfully created.' }
format.json { render :show, status: :created, location: @availability_product }
else
format.html { render :new }
format.json { render json: @availability_product.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def availability_product_params\n params.require(:availability_product).permit(:name)\n end",
"def index\n @availability_products = AvailabilityProduct.all\n end",
"def create\n if params[:products]\n params[:products].each do |product|\n @product = Product.new(name: product[:name],\n brand: product[:brand],\n model: product[:model],\n sku: product[:sku],\n price: product[:price],\n desc: product[:desc])\n if !@product.save\n render json: @product.errors.full_messages, status: 422\n end\n end\n render 'api/products/index'\n else\n @product = Product.new(product_params)\n if @product.save\n render 'api/products/show'\n else\n render json: @product.errors.full_messages, status: 422\n end\n end\n end",
"def create\n\n product_details = params.permit(:title, :inventory_count, :price)\n success = Product.create(product_details)\n\n render json: { success: success }\n end",
"def create\n newProduct = Product.new(products_params)\n if newProduct.save\n msg = { status: 201 , product: newProduct }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n else\n msg = { status: 422 }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end\n end",
"def create\n @product = @collection.products.build(product_params)\n\n if @product.save\n render json: @product, status: :created#, location: @collection\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @specific_availability = SpecificAvailability.new(specific_availability_params)\n\n respond_to do |format|\n if @specific_availability.save\n format.html { redirect_to @specific_availability, notice: 'Specific availability was successfully created.' }\n format.json { render :show, status: :created, location: @specific_availability }\n else\n format.html { render :new }\n format.json { render json: @specific_availability.errors, status: :unprocessable_entity }\n end\n end\n end",
"def available\n @products = Product.where.not(inventory_count: 0)\n json_response(@products)\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created, location: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.new(product_args)\n\n if @product.save\n render json: Product.all, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def set_availability_product\n @availability_product = AvailabilityProduct.friendly.find(params[:id])\n end",
"def create\n @product = @productable.products.find(params[:product_id])\n ids = params[:products]\n reals = @productable.products.map(&:id) # Make a lambda with this\n present_prod = ids.select { |n| reals.include?(n) } # And this\n if @product.update(product_relations: present_prod)\n render json: @product, status: 200\n else\n render json: @product.errors, status: 422\n end\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def availability(product_id)\n response, status = BeyondApi::Request.get(@session,\n \"/products/#{product_id}/availability\")\n\n handle_response(response, status)\n end",
"def create\n @product = Product.create!(product_params)\n json_response(@product, :created)\n end",
"def index\n limit = params[:limit]&.to_i || 10\n page = params[:page]&.to_i || 0\n if params[:available] == \"1\"\n @products = Product.paginate(page, limit).available\n else\n @products = Product.paginate(page, limit)\n end\n render json: @products\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created, location: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n if @product.save\n \n respond_with(@product, :location=>products_url)\n else\n respond_with(@product, :head=>:bad_request)\n end\n end",
"def create\n if @product.save\n render :show, status: :created, location: api_v1_product_path(@product)\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def reserve_inventory\n begin\n @product_reserved_stock = @product.reserved_stock_availabilty_in_distribution_center(\n @distribution_center.id, inventory_stock_params[:items_count]).first\n unless @product_reserved_stock.present?\n @product_reserved_stock = @product.stock_inventories.create!(available: false,\n items_count: 0,\n distribution_center_id:\n @distribution_center.id)\n end\n if @product_available_stock.update_attribute(:items_count,\n @product_available_stock.items_count -\n inventory_stock_params[:items_count]) &&\n @product_reserved_stock.update_attribute(:items_count,\n @product_reserved_stock.items_count +\n inventory_stock_params[:items_count])\n\n response = {message: 'Inventory has been reserved of particular product stock in specified distribution center.'}\n status_code = 200\n else\n response = {errors:\n [{detail: \"We can't apply this operation at this time, please try later.\"}]}\n status_code = 403\n end\n rescue => ex\n response = {errors: [{detail: ex.message}]}\n status_code = 403\n end\n render json: response, status: status_code\n end",
"def create\n @product = current_user.products.new(name: product_params[:name],description:product_params[:description],price:product_params[:price])\n @product.brand = Brand.find_by(brandName: product_params[:brand])\n @product.categories = Category.where(category:product_params[:category])\n respond_to do |format|\n if @product.save \n format.html { redirect_to new_product_location_path(@product), notice: \"Product was successfully created.\"}\n format.json { render json: @product}\n \n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = current_vendor.vendor_products.new(vendor_product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to vendor_products_url, notice: 'product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n ActiveRecord::Base.transaction do\n begin\n @api_v1_product = Product.create!(api_v1_product_params)\n\n json_response @api_v1_product, :created\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n raise ActiveRecord::Rollback\n end\n end\n end",
"def create\n @requests_devolutions_product = Requests::Devolutions::Product.new(params[:requests_devolutions_product])\n @requests_devolutions_product.status = @default_status\n @requests_devolutions_product.user = current_user\n respond_to do |format|\n if @requests_devolutions_product.save\n format.js { render action: 'show' }\n else\n format.js {\n render action: \"new\"}\n end\n end\n end",
"def create\n return unless product_params\n render json: Product.create_product(\n @product_params,\n category_list,\n @current_user.id\n ).simple_info, status: :created\n rescue => e\n render json: { error: e }, status: :bad_request\n end",
"def create\n unread\n\n @product = Product.new(params[:product])\n @sellers = Seller.all\n @branches = Branch.all\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n @product.save\n set_products\n end",
"def update\n respond_to do |format|\n if @availability_product.update(availability_product_params)\n format.html { redirect_to @availability_product, notice: 'Availability product was successfully updated.' }\n format.json { render :show, status: :ok, location: @availability_product }\n else\n format.html { render :edit }\n format.json { render json: @availability_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_management = ProductManagement.new(product_management_params)\n\n if @product_management.save\n render json: @product_management, status: :created, location: @product_management\n else\n render json: @product_management.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.new(params[:product])\n @product.shop = Shop.find_by_uuid params[:shop_id]\n\n respond_to do |format|\n if @product.save!\n format.html { redirect_to shop_products_path(@product.shop.uuid), notice: 'Product was successfully created.' }\n format.json { render json: @product.to_json(:include => {:product_variants => {:include => [:option_types,:pictures]}})}\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inventory_product = InventoryProduct.new(inventory_product_params)\n\n respond_to do |format|\n if @inventory_product.save\n format.html { redirect_to @inventory_product, notice: 'Inventory product was successfully created.' }\n format.json { render action: 'show', status: :created, location: @inventory_product }\n else\n format.html { render action: 'new' }\n format.json { render json: @inventory_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n product = Product.new(\n name: params[:name],\n net_price: params[:net_price]\n )\n\n if product.save\n format_response({ success: true, message: \"Product '#{product.name}' has been created\" }) and return\n else\n format_response({ success: false, message: product.errors.full_messages.to_sentence }) and return\n end\n end",
"def create\n trim_name = product_params[:name].strip\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n @product.update_attributes(:name => trim_name)\n ProductVariant.create(:product_id => @product.id, :price => 0)\n format.html { redirect_back_or(admin_merchandise_products_url, notice: 'Product was successfully created.') }\n format.json { render action: 'show', status: :created, location: @product }\n else\n format.html { render action: 'new' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_product_with_api\n user = User.find_by(authentication_token: params[:authentication_token])\n if user.present?\n product = user.products.new(product_params)\n if product.save\n json_response({success: true,data: {:product => product},message: \"Product is created successfully\"\n }, 201)\n else\n json_response({success: false,data: {:product => product},errors: product.errors.messages,message: \"Validation faild\"}, 422)\n end\n else\n json_response({\n success: false,\n message: \"Token is invalid\"\n }, 400)\n end\n end",
"def create\n @product = Product.new(product_params)\n @product.user = current_api_v1_user\n respond_to do |format|\n if @product.save\n params[:product][:properties].try(:each) do |k,v|\n @product.product_properties.create(property: Property.find(k), value: v)\n end\n params[:product][:colors].try(:each) do |c|\n @product.colors.create(name: c[:name].downcase, code: c[:code])\n end\n params[:product][:photos].try(:each) do |c|\n @product.photos.create(image: c)\n end\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created}\n else\n format.html { render :new }\n format.json { render json: @product.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @home_searches_product = Home::Searches::Product.new(params[:home_searches_product])\n\n respond_to do |format|\n if @home_searches_product.save\n format.html { redirect_to @home_searches_product, notice: 'Product was successfully created.' }\n format.json { render json: @home_searches_product, status: :created, location: @home_searches_product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @home_searches_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_inventory\n begin\n if product_params[:sku].present? && inventory_stock_params[:items_count].present?\n\n # SKU will remain unique through out the course of application\n @product = Product.find_by_sku(product_params[:sku])\n if @product.present?\n # In case of existing product with provided SKU, product will get updated with\n # parameters of name and price if provided .\n @product.update_attributes!(product_params) if product_params[:name] ||\n product_params[:price]\n else\n # In case of no product found with provided SKU, then new product will be created\n @product = Product.create!(product_params)\n end\n @product_stock = @product.stock_inventories\n .available_stock_for_specific_distribution_center(@distribution_center.id).first\n\n # If there isn't any stock entry for such product in specified distribution center.\n @product_stock = @product.stock_inventories.create!(available: true,\n items_count: 0,\n distribution_center_id:\n @distribution_center.id) unless @product_stock.present?\n\n # Update the inventory count.\n if @product_stock.update_attribute(:items_count,\n @product_stock.items_count +\n inventory_stock_params[:items_count].to_i)\n response = {message: \"Inventory has been updated successfully.\"}\n status_code = 200\n else\n response = {errors:\n [{detail: \"We can't apply this operation at this time, please try later.\"}]}\n status_code = 403\n end\n else\n response = {errors:\n [{detail: \"Required parameters are missing.\"}]}\n status_code = 400\n end\n rescue => ex\n response = {errors: [{detail: ex.message}]}\n status_code = 403\n end\n render json: response, status: status_code\n end",
"def create\n @logical_product = LogicalProduct.new(params[:logical_product])\n\n respond_to do |format|\n if @logical_product.save\n format.html { redirect_to @logical_product, notice: 'Logical product was successfully created.' }\n format.json { render json: @logical_product, status: :created, location: @logical_product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @logical_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n product = Product.new(product_params)\n if product.save\n render json: ProductSerializer.new(product).serialized_json\n end\n end",
"def product_params\n params.require(:product).permit(:delivery_time, :name, :sku, :price_cents, :short_description, :picturable, :barcode, :price, :is_aggregatable, :description, :image, :category_id, :supplier_category_id, :storefront_option, :unit, :amazon_id, :sku, :brand, :image, :inventory_count, :inventory_policy, :barcode_value, :barcode_value1, :barcode_value2, aggregation_rounds_attributes: [:id, :start_date, :end_date, :qty_limit, :_destroy])\n end",
"def create\n @product = Product.new(product_params)\n @product.user_id = current_user.id\n @product.location = current_user.location\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n\n if current_user.products.count == 5 && current_user.badges(name: \"Super Producer\").blank?\n Badge.create(user_id: current_user.id, name: \"Super Producer\")\n end\n\n if current_user.products.where(perishables: true).count == 5 && current_user.badges(name: \"Green Thumb\").blank?\n Badge.create(user_id: current_user.id, name: \"Green Thumb\")\n end\n end",
"def create\n @availability = Availability.new(availability_params)\n @availability.user_id = session[:user_id]\n\n respond_to do |format|\n if @availability.save\n format.html { redirect_to @availability, notice: 'Availability was successfully created.' }\n format.json { render :show, status: :created, location: @availability }\n else\n format.html { render :new }\n format.json { render json: @availability.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inavailability = Inavailability.new(inavailability_params)\n\n respond_to do |format|\n if @inavailability.save\n format.html { redirect_to @inavailability, notice: 'Inavailability was successfully created.' }\n format.json { render :show, status: :created, location: @inavailability }\n else\n format.html { render :new }\n format.json { render json: @inavailability.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.find(params[:product_id])\n \n @product_option = ProductOption.new(params[:product_option])\n product_option_instance = ProductOptionInstance.new(:product => @product, \n :product_option => @product_option)\n @product_option_selection = ProductOptionSelection.new\n @available_options = ProductOption.find(:all, :order => 'name')\n \n if product_option_instance.save\n flash[:notice] = 'New Product Option Saved'\n else \n flash[:notice] = 'Product Option Not Saved'\n end\n end",
"def create\n @product = Product.new(params[:product])\n #@product = Product.create(vendor_id: @vendor.id)\n #@vendor = Vendor.all\n #@product = @vendor.products.create(product_date :Time.now, vendor_id: @vendor.id)\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n if @product.save\n render json: {id: @product.id}\n else\n render json: {msg: @product.errors.full_messages.first}, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.new(product_params)\n @product.user_id = current_user.id\n @product.status = 0\n respond_to do |format|\n if @product.save\n \n send_emails_for_alerts(@product)\n\n format.html { redirect_to @product, notice: \"Has creado un producto. Ojalá encuentre un nuevo hogar pronto :)\" }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n offer = Offer.where(user_id: @current_user.id, product_id: params[:product_id]).first\n if offer\n render status: 471, json: {error: true}\n else\n product = Product.find(params[:product_id])\n if product\n if product.user.id != @current_user.id\n if product.sold_status != Product.SOLD_SOLD\n offer = Offer.new\n offer.user = @current_user\n offer.price = params[:price]\n offer.offer_status = Offer.OFFER_OFFERED\n offer.product = product\n if offer.save()\n\n notify(\"NOTIF_NEW_OFFER\", {\n user: {\n id: @current_user.id,\n username: @current_user.username,\n first_name: @current_user.first_name,\n last_name: @current_user.last_name,\n },\n offer: {\n id: offer.id,\n price: offer.price,\n created_at: offer.created_at.strftime('%-l:%M%P')\n },\n product: {\n id: product.id,\n product_name: product.product_name\n }\n }, product.user_id)\n\n OfferMailer.new_offer_email(product.user, offer, product, @current_user).deliver_later!(wait: 15.seconds)\n\n payload = {\n error: false,\n id: offer.id\n }\n render status: 200, json: payload\n else\n errors = []\n offer.errors.keys.each do |key|\n errors << {field: key, message: offer.errors.full_messages_for(key).first}\n end\n payload = {\n error: true,\n errors: errors\n }\n render status: 200, json: payload\n end\n else\n render status: 473, json: {error: true}\n end\n else\n render status: 472, json: {error: true}\n end\n else\n render status: 404, json: {error: true}\n end\n end\n end",
"def create\n @lighting_product = LightingProduct.new(lighting_product_params)\n\n respond_to do |format|\n if @lighting_product.save\n format.html { redirect_to @lighting_product, notice: 'Lighting product was successfully created.' }\n format.json { render :show, status: :created, location: @lighting_product }\n else\n format.html { render :new }\n format.json { render json: @lighting_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n\n # find a product against incoming barcode\n # now link that product with incoming invoice ID\n # incoming barcode might not match with any product in our system\n\n\n @product = InvoiceProduct.new(params[:invoice_product])\n\n p = Product.find_by_bar_code(params[:bar_code])\n shop_id = params[:shop_id]\n array = ProductShop.get_shop_products(p.id, shop_id)\n\n if p\n @product.product_id= p.id\n end\n\n respond_to do |format|\n if !p.nil? and !\n array.empty? and @product.save\n format.html { redirect_to invoice_invoice_products_path, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created}\n else\n puts \"******************error******************\"\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n #permitted_columns = params[:products_purposes_relations].permit(:product_id, :purpose_id, :stars)\n # @products_purposes_relation = @product.products_purposes_relations.create(permitted_columns)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: t('create_success') }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def inventory_product_params\n params.require(:inventory_product).permit(:name, :available_count, :unit_price)\n end",
"def index\n @products = policy_scope(Product).order(created_at: :desc)\n @products = Product.where(availability: true)\n end",
"def create\n authorize! :create, @product\n @brands = Brand.all\n @categories = Category.all\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to products_path, notice: 'El producto fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_in_order = ProductInOrder.new(product_in_order_params)\n\n respond_to do |format|\n if @product_in_order.save\n format.html { redirect_to @product_in_order, notice: 'Product in order was successfully created.' }\n format.json { render :show, status: :created, location: @product_in_order }\n else\n format.html { render :new }\n format.json { render json: @product_in_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:stage] == '1'\n if params[:variants] == 'ONE SIZE' \n @products = ProductProduct.create(\n name: params[:name],\n cost_method: 'standard',\n description: params[:description],\n procure_method: 'make_to_order',\n supply_method: 'buy',\n sale_ok: 'true', #Cand be Purchased\n purchase_ok: 'true', #Can be Sold\n weight: params[:weight],\n company_id: 3,\n default_code: params[:default_code], #ref\n list_price: params[:list_price], #sale_price\n standard_price: params[:standard_price], #cost\n property_account_income: 197, #income_account\n property_account_expense: 205, #cogs_account\n type: 'product' #product_type ('product' = stockable_product)\n )\n else \n @products = ProductProduct.create(\n name: params[:name],\n cost_method: 'standard',\n description: params[:description],\n procure_method: 'make_to_order',\n supply_method: 'buy',\n sale_ok: 'true', #Cand be Purchased\n purchase_ok: 'true', #Can be Sold\n weight: params[:weight],\n variants: params[:variants],\n company_id: 3,\n default_code: params[:default_code], #ref\n list_price: params[:list_price], #sale_price\n standard_price: params[:standard_price], #cost\n property_account_income: 197, #income_account\n property_account_expense: 205, #cogs_account\n type: 'product' #product_type ('product' = stockable_product)\n )\n end\n elsif params[:stage] == '2'\n @products = ProductSupplierinfo.create(\n name: params[:name],\n min_qty: params[:min_qty],\n product_id: params[:product_id],\n company_id: params[:company_id]\n )\n else\n @products = ProductProduct.create(\n name: params[:name],\n cost_method: 'standard',\n description: params[:description],\n procure_method: 'make_to_order',\n supply_method: 'buy',\n sale_ok: 'true', #Cand be Purchased\n purchase_ok: 'true', #Can be Sold\n weight: params[:weight],\n variants: params[:variants],\n company_id: 3,\n default_code: params[:default_code], #ref\n list_price: params[:list_price], #sale_price\n standard_price: params[:standard_price], #cost\n property_account_income: 197, #income_account\n property_account_expense: 205, #cogs_account\n type: 'product', #product_type ('product' = stockable_product)\n product_tmpl_id: params[:product_tmpl_id].to_i\n ) \n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def enable_purchasability(product_id)\n response, status = BeyondApi::Request.post(@session,\n \"/products/#{product_id}/availability/enable-purchasability\")\n\n handle_response(response, status, respond_with_true: true)\n end",
"def product_params\n params.require(:product).permit(:products)\n end",
"def create\n userID = session[:user_id]\n editionID = params[:edition_id]\n price = params[:price]\n\n uri = URI(\"http://107.170.7.58:4567/api/create/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"edition_id\" => editionID, \"price\" => price, \"start_date\" => Time.now, \"end_date\" => 90.days.from_now}\n response = Net::HTTP.post_form(uri, parameters)\n list = JSON.parse(response.body)\n\n @response = list[0][\"kind\"]\n end",
"def create\n @admin_product = Admin::Product.new(admin_product_params)\n\n respond_to do |format|\n if @admin_product.save\n format.html { redirect_to admin_products_url }\n format.json { render :show, status: :created, location: @admin_product }\n else\n format.html { render :new }\n format.json { render json: @admin_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to products_url, notice: \"Product was successfully created.\" }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @prd_attribute = PrdAttribute.new\n\n @prd_attribute.bill_type_id = params[:prd_attribute]['bill_type'].to_i\n @prd_attribute.name = params[:prd_attribute]['name']\n @prd_attribute.rollover = params[:prd_attribute]['rollover']\n @prd_attribute.code = params[:prd_attribute]['code']\n @prd_attribute.prd_type = params[:prd_attribute]['prd_type']\n @prd_attribute.description = params[:prd_attribute]['description']\n @prd_attribute.status_id = params[:prd_attribute]['status'].to_i\n\n @prd_attribute.service_type_id = params[:prd_attribute]['service_type'].to_i\n @prd_attribute.monthly_fee = params[:prd_attribute]['monthly_fee'].to_i\n @prd_attribute.subscription_fee = params[:prd_attribute]['subscription_fee'].to_i\n @prd_attribute.target_user = params[:prd_attribute]['target_user']\n @prd_attribute.start_date = params[:prd_attribute]['start_date']\n @prd_attribute.end_date = params[:prd_attribute]['end_date']\n\n respond_to do |format|\n if @prd_attribute.save\n format.html { redirect_to(@prd_attribute, :notice => 'PrdAttribute was successfully created.') }\n format.xml { render :xml => @prd_attribute, :status => :created, :location => @prd_attribute }\n format.json {\n\t\t\tproduct = Product.new\n product.prd_attribute_id = @prd_attribute.id\n product.save!\n\n # bundle일 때에는 해당하는 product id들을 저장\n #\n if params[:prd_attribute]['prd_type'].upcase == 'BUNDLE'\n product_ids = []\n\t\t\t params[:prd_attribute]['ref_products'].each do |product_id|\n\t\t\t product_ids << product_id['product_id'].to_s\n\t\t end\n\t\t @prd_attribute.ref_products = product_ids.join(\",\")\n end \n\t\t @prd_attribute.save\n\n # product devices 저장\n #\n if not params[:prd_attribute]['devices'].blank?\n params[:prd_attribute]['devices'].each do |device|\n prd_attribute_device = PrdAttributeDevice.new\n prd_attribute_device.code_factor_id = device['device'].to_i\n prd_attribute_device.prd_attribute_id = @prd_attribute.id\n prd_attribute_device.product_id = product.id\n prd_attribute_device.save!\n end\n end\n\n # product에 대한 기본 conditions 설정\n #\n product.set_default_conditions(@prd_attribute, product)\n\n\t\t\trender :json => mapping_to_hash(@prd_attribute, PrdAttribute.json_mapping_table), :status => :created, :location => @prd_attribute \n\t\t}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @prd_attribute.errors, :status => :unprocessable_entity }\n format.json { \n\t\t\trender :json => @prd_attribute.errors, :status => :unprocessable_entity \t}\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to products_url, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: products_url }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: t(:product_created) }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sales_upsale_product = SalesUpsaleProduct.new(sales_upsale_product_params)\n\n respond_to do |format|\n if @sales_upsale_product.save\n format.html { redirect_to sales_upsale_products_url, notice: 'Sales upsale product was successfully created.' }\n format.json { render :show, status: :created, location: @sales_upsale_product }\n else\n format.html { render :new }\n format.json { render json: @sales_upsale_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @os_product = OsProduct.new(os_product_params)\n\n respond_to do |format|\n if @os_product.save\n format.html { redirect_to @os_product, notice: 'Os product was successfully created.' }\n format.json { render :show, status: :created, location: @os_product }\n else\n format.html { render :new }\n format.json { render json: @os_product.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 create\n @scheduled_product = ScheduledProduct.new(scheduled_product_params)\n\n respond_to do |format|\n if @scheduled_product.save\n format.html { redirect_to list_scheduled_product_url(@scheduled_product.schedule_id), notice: \"Scheduled product was successfully created.\" }\n format.json { render :show, status: :created, location: @scheduled_product }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @scheduled_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n collect_and_assign_product_attributes\n collect_and_assign_new_categories\n\n respond_to do |format|\n if @product.save\n flash[:notice] = 'Product was successfully created.'\n format.html { redirect_to(admin_product_path(@product)) }\n format.xml { render :xml => @product, :status => :created, :location => @product }\n else\n assign_lovs\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to products_url, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @local_product = LocalProduct.new(local_product_params)\n\n respond_to do |format|\n if @local_product.save\n format.html { redirect_to @local_product, notice: 'Local product was successfully created.' }\n format.json { render :show, status: :created, location: @local_product }\n else\n format.html { render :new }\n format.json { render json: @local_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n \n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: \"Product was successfully created.\" }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_to_newgistics\n document = Spree::Newgistics::DocumentBuilder.build_product([self])\n response = Spree::Newgistics::HTTPManager.post('/post_products.aspx', document)\n\n if response.status == 200\n errors = Nokogiri::XML(response.body).css('errors').children.any?\n update_column(:posted_to_newgistics, true) unless errors\n end\n\n end",
"def create\n @variant = @product.variants.new(params.require(:variant).permit!)\n @variant.price = params[:variant][:price]\n respond_to do |format|\n if @variant.save\n format.html { redirect_to admin_product_variants_url(@product), notice: 'Variant was successfully created.' }\n format.json { render action: 'show', status: :created, location: @variant }\n else\n format.html { render action: 'new' }\n format.json { render json: @variant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to products_path, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_buy_click = ProductBuyClick.new(product_buy_click_params)\n @product_buy_click.user = current_user if is_client_app?\n\n if @product_buy_click.save\n render json: @product_buy_click, status: :created, location: @product_buy_click\n else\n render json: @product_buy_click.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.new(params[:product])\n @category = @product.category\n \n if @product.category.wishlist?\n \t@product.status = \"0\"\n \t@product.status_date = Time.now\n \t\n \t#we are a wish list item... check to see if anybody is looking for us.\n \t#maybe we ignore this step here and leave it to daily processing.\n end\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, :notice => 'Product was successfully created.' }\n format.json { render :json => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, :notice => 'Product was successfully created.' }\n format.json { render :json => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, :notice => 'Product was successfully created.' }\n format.json { render :json => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product,\n :notice=> 'Product was successfully created.' }\n format.json { render :json=> @product, :status=> :created,\n :location=> @product }\n else\n format.html { render :action=> \"new\" }\n format.json { render :json=> @product.errors,\n :status=> :unprocessable_entity }\n end\n end\n end",
"def product_params\n params.require(:product).permit(:title, :description, :stock, :status, :primary_image, :supporting_images=>[])\n end",
"def create\n @product = Product.create(product_params)\n if @product.save\n # Respond to html with a redirect and json\n respond_to do |format|\n format.html do\n flash[:notice] = 'Product added'\n redirect_to products_path\n end\n format.json do\n render json: product.to_json\n end\n end\n else\n # Respond to html with a redirect and json\n respond_to do |format|\n format.html do\n flash.now[:error] = 'Error adding product'\n render :new\n end\n format.json do\n render json: { errors: @product.errors.full_messages }, status: 422\n end\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6918476",
"0.6472128",
"0.6329468",
"0.6292604",
"0.6284863",
"0.6228448",
"0.6216361",
"0.62088215",
"0.6200017",
"0.61845714",
"0.61789376",
"0.6147109",
"0.6144949",
"0.61317223",
"0.6118531",
"0.60875213",
"0.6084217",
"0.605357",
"0.6046187",
"0.60458016",
"0.6043235",
"0.6025163",
"0.60230815",
"0.6018207",
"0.5977389",
"0.5972633",
"0.5969765",
"0.59656674",
"0.5962441",
"0.59519136",
"0.58903223",
"0.58666617",
"0.5862229",
"0.5853415",
"0.5848983",
"0.58456683",
"0.5820945",
"0.5811388",
"0.58112234",
"0.580981",
"0.58097667",
"0.58079237",
"0.5804851",
"0.5804311",
"0.5803209",
"0.57997465",
"0.5795643",
"0.5795455",
"0.5770569",
"0.5763345",
"0.57612187",
"0.5761045",
"0.57605654",
"0.57578707",
"0.5756844",
"0.57551634",
"0.5747982",
"0.57310337",
"0.57270396",
"0.5724066",
"0.5723838",
"0.5722679",
"0.57149124",
"0.5714511",
"0.5710945",
"0.5692457",
"0.5690889",
"0.569",
"0.56834424",
"0.5680721",
"0.56785554",
"0.5677891",
"0.5672827",
"0.5671397",
"0.5671365",
"0.5668475",
"0.565686",
"0.5655704",
"0.56556255",
"0.56539655",
"0.5650322",
"0.5650322",
"0.5650322",
"0.56498873",
"0.56433016",
"0.56370753",
"0.5635383",
"0.5634893",
"0.5631648",
"0.5631648",
"0.5631648",
"0.5631648",
"0.5631648",
"0.5631648",
"0.5631648",
"0.5631648",
"0.5631648",
"0.5631648",
"0.5631648",
"0.5631648"
] |
0.74523354
|
0
|
PATCH/PUT /availability_products/1 PATCH/PUT /availability_products/1.json
|
def update
respond_to do |format|
if @availability_product.update(availability_product_params)
format.html { redirect_to @availability_product, notice: 'Availability product was successfully updated.' }
format.json { render :show, status: :ok, location: @availability_product }
else
format.html { render :edit }
format.json { render json: @availability_product.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def update\n if @product.update(product_params)\n render json: @product, status: :ok#, location: @collection\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def update\n updateProduct = Product.find_by_id(params[:id])\n updateProduct.update(products_params)\n if updateProduct != nil\n msg = { status: 200 , product: updateProduct }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n else\n msg = { status: 422 }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end\n end",
"def update\n product = Product.find(params[:id])\n product_details = params.permit(:title, :inventory_count, :price)\n\n product.update(product_details)\n\n render json: product\n end",
"def update\n #raise \"Cannot create product application buy, not enough product available.\" if check_if_product_is_available == true \n respond_to do |format|\n if @product_application_buy.update(product_application_buy_params)\n format.html { redirect_to @product_application_buy, notice: 'Product application buy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product_application_buy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @product.update(product_params)\n render json: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def update\n return unless product_params\n render json: @product.simple_info, status: :ok if @product.update!(@product_params)\n rescue => e\n render json: { error: e }, status: :ok\n end",
"def update\n @product.update(product_params)\n set_products\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to admin_products_path, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n rescue StandardError => e\n Airbrake.notify(e)\n end",
"def update\n @product.assign_attributes object_params.reject{|_, v| v.blank?}\n # In a normal app we have a pre filled form of the object to update,\n # so when we do a PATCH (or PUT) we send all the attributes again,\n # in the API we permit to send any field to update, so we need to remove\n # all the blank params of the object to prevent validations triggers of\n # attributes that we don't send to update\n if @product.save\n render json: @product.to_json\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def update\n @product_option = ProductOption.find(params[:product_option][:id])\n @product = Product.find(params[:product_id])\n @product_option.update_attributes(params[:product_option])\n \n @available_options = ProductOption.find(:all, :order => 'name')\n end",
"def update\n @product = Product.find(params[:id])\n\n if @product.update(product_params)\n head :no_content\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def update\n render json: @sub_product.errors unless @sub_product.update(sub_product_params)\n end",
"def update\n render json: @sub_product.errors unless @sub_product.update(sub_product_params)\n end",
"def update\n if @my_product.update(my_product_params)\n render :show, status: :ok\n else\n render json: @my_product.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @product.update(product_params)\n render :show, status: :ok, location: api_v1_product_path(@product)\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def update\n @product = Product.find(params[:id])\n if @product\n if @product.update(price: params[:price])\n render 'api/products/show'\n else\n render json: [\"Can only update price\"], status: 422\n end\n else\n render json: [\"Product not found\"], status: 422\n end\n end",
"def update\n unread\n\n @product = Product.find(params[:id])\n @sellers = Seller.all\n @branches = Branch.all\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def product_updates\n if params[\"product_id\"] == \"new\"\n @product = Product.new\n @product.florist_id = session[\"found_florist_id\"] \n else\n @product = Product.where(id: params[\"product_id\"]).first\n end\n @product.product_type= params[\"product_type\"]\n @product.name = params[\"product_name\"]\n if params[\"items_per_bunch\"] && params[\"items_per_bunch\"].to_f > 0\n @product.items_per_bunch = params[\"items_per_bunch\"].to_f * 100\n if params[\"cost_per_bunch\"] && params[\"cost_per_bunch\"].to_f > 0\n @product.cost_per_bunch = params[\"cost_per_bunch\"].to_f * 100.round(2)\n numerator = params[\"cost_per_bunch\"].to_f * 100.0.round(2)\n denominator = params[\"items_per_bunch\"].to_f * 100.0.round(2)\n \n @product.cost_for_one = (numerator / denominator).round(2)*100\n end\n end\n if params[\"markup\"] && params[\"markup\"].to_f >= 0 \n @product.markup = params[\"markup\"].to_f * 100\n end\n @product.status = params[\"status\"]\n if params[\"display_name\"] == \"\" || params[\"display_name\"] == nil\n @product.display_name = @product.name\n else\n @product.display_name = params[\"display_name\"]\n end\n @product.updated_by = Employee.where(id: session[\"found_user_id\"]).first.name\n @product.florist_id = session[\"found_florist_id\"]\n if @product.save\n redirect_to \"/product/#{@product.id}\" and return\n else\n render(:product_updates) and return\n end \n end",
"def update\n @product = Product.eager_loading.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to shop_products_path(@product.shop.uuid), notice: 'Product was successfully updated.' }\n format.json { render json: @product.to_json(:include => {:product_variants => {:include => [:option_types,:pictures]}})}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_product_info\n update_info = params[:product]\n market = Market.find(params[:place_id])\n product = market.products.find(update_info[:id])\n if product.update(update_info)\n response = {status: \"OK\", code: 200}\n else\n response = { status: \"Not Ok\", code: 201}\n end\n respond_to do |format|\n format.json{render json: response.to_json }\n end\n end",
"def update\n respond_to do |format|\n if @product.update!(product_params)\n format.html { redirect_to products_url, notice: 'Product was successfully updated.' }\n format.json { render json: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @logical_product = LogicalProduct.find(params[:id])\n\n respond_to do |format|\n if @logical_product.update_attributes(params[:logical_product])\n format.html { redirect_to @logical_product, notice: 'Logical product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @logical_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product1.update(product1_params)\n format.html { redirect_to @product1, notice: \"Product1 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product1 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @product1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @os_product.update(os_product_params)\n format.html { redirect_to @os_product, notice: 'Os product was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_product }\n else\n format.html { render :edit }\n format.json { render json: @os_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Продукт успешно обновлен.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @angular = Product.find(params[:id])\n \n @angular.update_attributes(title: params[:products][:title], description: params[:products][:description])\n respond_to do |format|\n if @angular.valid?\n format.html { redirect_to store_index_path, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @angular.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product_spec.update(product_spec_params)\n format.html { redirect_to @product_spec, notice: 'Product spec was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_spec }\n else\n format.html { render :edit }\n format.json { render json: @product_spec.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @availability.update(availability_params)\n format.html { redirect_to @availability, notice: 'Availability was successfully updated.' }\n format.json { render :show, status: :ok, location: @availability }\n else\n format.html { render :edit }\n format.json { render json: @availability.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @availability.update(availability_params)\n format.html { redirect_to @availability, notice: 'Availability was successfully updated.' }\n format.json { render :show, status: :ok, location: @availability }\n else\n format.html { render :edit }\n format.json { render json: @availability.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n #@product.accessible = :all if admin?\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to quick_list_path, :notice => 'Product was successfully updated.' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock_product.update_attributes(stock_product_params)\n format.html { redirect_to @stock_product, notice: 'Stock product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventory_product.update(inventory_product_params)\n format.html { redirect_to @inventory_product, notice: 'Inventory product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inventory_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @record = Product.find(params[:id])\n @record.update_attributes(params[:product])\n \n respond_to do |format|\n format.json {\n render json: {}\n }\n end\n end",
"def update\n respond_to do |format|\n if @specific_availability.update(specific_availability_params)\n format.html { redirect_to @specific_availability, notice: 'Specific availability was successfully updated.' }\n format.json { render :show, status: :ok, location: @specific_availability }\n else\n format.html { render :edit }\n format.json { render json: @specific_availability.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_product\n begin\n @api_v1_product = Product.find(params[:id])\n rescue => ex\n json_response({error: ex.message}, :not_found)\n end\n end",
"def update\n respond_to do |format|\n product_type = params[:product][:product_type]\n if product_type\n url = product_type.to_s == 'balo' ? balo_products_path : purge_products_path\n else\n url = products_path\n end\n if @product.update(product_params)\n format.html { redirect_to url, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = TempProduct.find(params[:id])\n @product.qty = params[:qty]\n # save product\n if @product.save\n # success\n render :json => { :success => true }\n else\n # failed\n render :json => { :success => false }\n end\n end",
"def update\n respond_to do |format|\n if @admin_product.update(admin_product_params)\n format.html { redirect_to admin_products_url }\n format.json { render :show, status: :ok, location: @admin_product }\n else\n format.html { render :edit }\n format.json { render json: @admin_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: \"Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html do\n redirect_to @product, notice: 'Product was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit , status: :unprocessable_entity }\n format.json do\n render json: @product.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: t('update_success') }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n params[:product_attr].to_a.each do |key, attr|\n product = Product.find(key)\n product.update_attributes(attr)\n end\n redirect_to(harman_employee_pricing_admin_products_path, notice: \"Pricing updated successfully.\")\n end",
"def update\n product_params = params.require(:product).\n permit(:id, :value)\n\n if product = Product.find_by(external_id: product_params[:id])\n product.value = product_params[:value]\n product.save\n render json: {}, status: :ok\n else\n\n render json: {\n errors: {\n message: \"product not found\",\n product_id: product_params[:id]\n }\n }, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Your product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Изделие успешно обновлено.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tb_product.update(tb_product_params)\n format.html { redirect_to @tb_product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tb_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok}\n else\n format.html { render :edit }\n format.json { render json: @product.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food_product.update(food_product_params)\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stocking_product.update(stocking_product_params)\n format.html { redirect_to @stocking_product, notice: 'Stocking product was successfully updated.' }\n format.json { render :show, status: :ok, location: @stocking_product }\n else\n format.html { render :edit }\n format.json { render json: @stocking_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @local_product.update(local_product_params)\n format.html { redirect_to @local_product, notice: 'Local product was successfully updated.' }\n format.json { render :show, status: :ok, location: @local_product }\n else\n format.html { render :edit }\n format.json { render json: @local_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product_specification.update(product_specification_params)\n format.html { redirect_to @product_specification, notice: 'Product specification was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_specification }\n else\n format.html { render :edit }\n format.json { render json: @product_specification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product_management = ProductManagement.find(params[:id])\n\n if @product_management.update(product_management_params)\n head :no_content\n else\n render json: @product_management.errors, status: :unprocessable_entity\n end\n end",
"def update\n if (!product_params[:is_removal] && @product.update(product_args)) ||\n (product_params[:is_removal] && @product.destroy)\n render json: Product.all, status: :ok\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def update\n params[:product][:price] = format_float params[:product][:price]\n @product = Product.find(params[:id])\n\n respond_to do |format|\n params[:product][:price] = format_float params[:product][:price]\n if @product.update_attributes(params[:product])\n format.html { redirect_to admin_product_path(@product), notice: t(:'products.edited') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to products_url, notice: \"Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: \"Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n if params[:category_ids].present?\n @product.categories.clear\n params[:category_ids].each do |id| \n @product.categories << Category.find(id)\n end\n end\n \n @product.areas.clear\n if params[:area_ids].present?\n @product.areas.clear\n params[:area_ids].each do |id| \n @product.areas << Area.find(id)\n end\n end\n \n if params[:article_ids].present?\n @product.articles.clear\n params[:article_ids].each do |id| \n @product.articles << Article.find(id)\n end\n end\n \n # update status\n @product.status = nil if params[:product][:status].present?\n @product.status = params[:product][:status].join(\",\") if params[:product][:status].present?\n \n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to edit_admin_product_path(@product.id), notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7196018",
"0.69728374",
"0.689465",
"0.6746116",
"0.6716206",
"0.6709353",
"0.6709279",
"0.6705631",
"0.66779226",
"0.66370094",
"0.6625007",
"0.6588894",
"0.65620744",
"0.65620744",
"0.6561498",
"0.6557892",
"0.6527632",
"0.6521966",
"0.64918685",
"0.6450863",
"0.6444042",
"0.64419174",
"0.64364976",
"0.6434946",
"0.64253336",
"0.64161795",
"0.64056194",
"0.6404252",
"0.64020455",
"0.63983005",
"0.63983005",
"0.6396408",
"0.63831276",
"0.6376501",
"0.6375548",
"0.6372077",
"0.6361848",
"0.63571817",
"0.6349597",
"0.63479924",
"0.6338074",
"0.6331481",
"0.63301826",
"0.63256085",
"0.6325015",
"0.6323664",
"0.6322124",
"0.6319933",
"0.63119143",
"0.6311269",
"0.6309216",
"0.6308777",
"0.6308777",
"0.6308777",
"0.6308777",
"0.6308777",
"0.6308709",
"0.63064605",
"0.6303949",
"0.63021934",
"0.6301437",
"0.6299916",
"0.6298994",
"0.62969726",
"0.62967384",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744",
"0.6295744"
] |
0.7322962
|
0
|
DELETE /availability_products/1 DELETE /availability_products/1.json
|
def destroy
@availability_product.destroy
respond_to do |format|
format.html { redirect_to availability_products_url, notice: 'Availability product was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @product.destroy\n\n render json: @product, status: :ok#, location: @collection\n end",
"def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end",
"def destroy\n begin\n @api_v1_product.destroy!\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def destroy\n @logical_product = LogicalProduct.find(params[:id])\n @logical_product.destroy\n\n respond_to do |format|\n format.html { redirect_to logical_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_product.destroy\n respond_to do |format|\n format.html { redirect_to inventory_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n render json: {}\n end",
"def destroy\n Inventory.where(product: @product).delete_all\n @product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_path, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n p @product.destroy!\n render json: { result: 'deleted' }, status: :ok\n end",
"def destroy\n unread\n\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_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 product = Product.find(params[:id])\n product.destroy\n\n render json: { deleted: params[:id] }\n end",
"def destroy\n @magento_product = MagentoProduct.find(params[:id])\n @magento_product.destroy\n\n respond_to do |format|\n format.html { redirect_to magento_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @onecompany_product = Onecompany::Product.find(params[:id])\n @onecompany_product.destroy\n\n respond_to do |format|\n format.html { redirect_to onecompany_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n render json: {is_success: true, error_code: 200, message: \"Deleted Successfully\", result: @product}, status: 200\n end",
"def destroy\n @hqproduct.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def delete_product(id)\n @client.raw('delete', \"/ecommerce/products/#{id}\")\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.delete!\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @os_product.destroy\n respond_to do |format|\n format.html { redirect_to os_products_url, notice: 'Os product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @specific_availability.destroy\n respond_to do |format|\n format.html { redirect_to specific_availabilities_url, notice: 'Specific availability was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @home_searches_product = Home::Searches::Product.find(params[:id])\n @home_searches_product.destroy\n\n respond_to do |format|\n format.html { redirect_to home_searches_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @core_stock_product.destroy\n # respond_to do |format|\n # format.html { redirect_to core_stock_products_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 products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product1.destroy\n respond_to do |format|\n format.html { redirect_to product1s_url, notice: \"Product1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n\n head :no_content\n end",
"def destroy\n @stock_product.destroy\n\n respond_to do |format|\n format.html { redirect_to stock_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_path, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n rescue StandardError => e\n Airbrake.notify(e)\n end",
"def destroy\n @groceryproduct.destroy\n respond_to do |format|\n format.html { redirect_to groceryproducts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @availability.destroy\n respond_to do |format|\n format.html { redirect_to availabilities_url, notice: 'Availability was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @availability.destroy\n respond_to do |format|\n format.html { redirect_to availabilities_url, notice: 'Availability was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :ok }\n end\n end",
"def delete(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"\"\n data = {\n\n }\n\n response = Response.new(request.delete(path, data, options))\n return_values = Array.new\n \n return_values.push(response.success)\n\n \n return_values[0]\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @zorgproduct = Zorgproduct.find(params[:id])\n @zorgproduct.destroy\n\n respond_to do |format|\n format.html { redirect_to zorgproducts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @physical_data_product = PhysicalDataProduct.find(params[:id])\n @physical_data_product.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_data_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_management.destroy\n\n head :no_content\n end",
"def destroy\n @product = Product.find(params[:id])\n drop_rs(current_user.id, params[:id], \"uploaded\")\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to uploaded_products_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sold_product.destroy\n\n respond_to do |format|\n format.html { redirect_to sold_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n puts(\"you are in destroy \")\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stashed_inventory = StashedInventory.find(params[:id])\n @stashed_inventory.destroy\n\n respond_to do |format|\n format.html { redirect_to @stashed_inventory.product }\n format.json { head :no_content }\n end\n end",
"def deleteProductProvisioning( product_id, gen_id)\n params = Hash.new\n params['product_id'] = product_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/product/provisioning\",params)\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\nend",
"def destroy\n @product_maintenance = ProductMaintenance.find(params[:id])\n @product_maintenance.destroy\n\n respond_to do |format|\n format.html { redirect_to product_maintenances_url }\n format.json { head :no_content }\n end\n end",
"def deleteProd()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n p = Product.find(params[:id])\n status = p.destroy\n error = \"\"\n if(p.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: true, reason: error, data: \"\"}\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: t('destroy_success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to my_board_path, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to root_url(:item => 3), notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lighting_product.destroy\n respond_to do |format|\n format.html { redirect_to lighting_products_url, notice: 'Lighting product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @record = Product.find(params[:id])\n @record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_name.destroy\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path) }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@product = Product.find(params[:id]) #하단에서 미리 선언\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @info_product.destroy\n respond_to do |format|\n format.html { redirect_to info_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n product = Product.find(params[:id])\n product.destroy\n render json: {id: product.id}\n end",
"def destroy\n @so_product.destroy\n respond_to do |format|\n format.html { redirect_to so_products_url, notice: 'So product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item_product.destroy\n respond_to do |format|\n format.html { redirect_to line_item_products_url, notice: 'Line item product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:product_id]) \n @product_option = ProductOption.find(params[:id])\n @product.product_options.delete(@product_option)\n \n @available_options = ProductOption.find(:all, :order => 'name') \n end",
"def destroy\n @sc_product.destroy\n respond_to do |format|\n format.html { redirect_to sc_products_url, notice: 'Sc product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to admin_merchandise_products_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.72155315",
"0.71297914",
"0.710702",
"0.7095869",
"0.7094918",
"0.7064186",
"0.7033315",
"0.7018584",
"0.69936174",
"0.69714177",
"0.69658566",
"0.69491524",
"0.69387835",
"0.69240564",
"0.690999",
"0.6898615",
"0.68963456",
"0.6893211",
"0.6885956",
"0.6884188",
"0.6878266",
"0.6872453",
"0.6863101",
"0.6863101",
"0.6863101",
"0.6863101",
"0.6863101",
"0.6863101",
"0.68604577",
"0.6846436",
"0.6839981",
"0.6828566",
"0.6827068",
"0.6826959",
"0.68249017",
"0.68098223",
"0.67979723",
"0.67979723",
"0.67955357",
"0.67955357",
"0.67809135",
"0.6776872",
"0.6776872",
"0.6776872",
"0.67732334",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688906",
"0.67688805",
"0.6768346",
"0.67664665",
"0.67624897",
"0.67605096",
"0.67537344",
"0.67495435",
"0.67420614",
"0.6737301",
"0.67358226",
"0.6735685",
"0.67346597",
"0.672411",
"0.6721678",
"0.6717638",
"0.6714384",
"0.6706268",
"0.67050356",
"0.6697234",
"0.6697015",
"0.6695709",
"0.6692008",
"0.6689339",
"0.6685892",
"0.66770816",
"0.667428",
"0.66738665",
"0.66696477"
] |
0.7531934
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_availability_product
@availability_product = AvailabilityProduct.friendly.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 availability_product_params
params.require(:availability_product).permit(:name)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Helper methods used to assist through the template building => similar to the functions used in Rails::Generators::AppBase Method required when processing the gemfile
|
def gemfile_requirement(name)
@original_gemfile ||= IO.read('Gemfile')
req = @original_gemfile[/gem\s+['"]#{name}['"]\s*(,[><~= \t\d\.\w'"]*)?.*$/, 1]
req && req.tr("'", %(")).strip.sub(/^,\s*"/, ', "')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def generate_from_templates\r\n %w{package.json _config.yml}.each do |file|\r\n template file\r\n end\r\n end",
"def apply_rails_new_template\n assert_generator_use_postgresql\n skip_libraries_installation\n\n apply_template 'LICENSE'\n apply_template 'README.md'\n apply_template 'gitignore', '.gitignore'\n\n apply_template 'ruby-version', '.ruby-version'\n apply_template 'Gemfile'\n\n apply_template 'env.example'\n apply_template 'env.example', '.env'\n\n run_with_clean_bundler_env 'bundle install'\n run_with_clean_bundler_env 'bin/rails webpacker:install:typescript'\n\n apply_template 'docker-compose.yml'\n run_with_clean_bundler_env 'docker-compose up -d'\n\n apply_file 'config/database.yml'\n run_with_clean_bundler_env 'bin/rails db:create'\n\n run_with_clean_bundler_env 'bin/rails generate rspec:install'\n\n setup_git\n\n setup_heroku\nend",
"def template_for(file); end",
"def generate\n template = Template.new\n template.add('timestamp', Time.now.to_s)\n template.add('lib_dir', @lib_dir)\n template.add('bin_dir', @bin_dir)\n template.parse(TEMPLATE)\n end",
"def templates_for(file); end",
"def gen_templates(options = {})\n\t\t\n\t\tif @has_run\n\t\t\treturn\n\t\tend\n\n\t\t@has_run = true\n\t\tputs \"running generate_templates with #{options.inspect}\".colorize(:light_blue)\n\n\t\tdefaults = {\n\t\t\trepo: 'https://github.com/elerch/bootstrap.git', # using elerchs branch because I just need collapse / accordion to work for now\n\t\t\tbranch: 'bootstrap3_bis2',\n\t\t\tctx: 'app'\n\t\t}\n\n\t\t# if the app developer specified a repo, check to see if it's the default repo\n\t\tneed_clone = false\n\t\toptions = options.to_hash\n\t\tif options.has_key?(:repo)\n\t\t\tif options[:repo] != defaults[:repo]\n\t\t\t\t# clone this repo into tmp\n\t\t\t\tneed_clone = true\n\t\t\telse\n\t\t\t\tif options.has_key?(:branch) && options[:branch] != defaults[:branch]\n\t\t\t\t\t# different branch, clone repo\n\t\t\t\t\tneed_clone = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# remove old templates\n\t\t`rm -rf #{ options[:ctx] }/assets/javascripts/templates/rails-angularui-bootstrap`\n\n\t\t# merge with default options\n\t\toptions = defaults.merge!(options)\n\t\t\n\t\tgem_js_directory = \"#{ options[:ctx] }/assets/javascripts/rails-angularui-bootstrap\"\n\t\t\n\n\t\t# ensure javascripts dir\n\t\tif !File.directory?(\"#{ gem_js_directory }\")\n\t\t\t`mkdir -p #{ gem_js_directory }`\n\t\tend\n\n\t\t# make sure the app has a templates / rails-angularui-bootstrap dir\n\t\tif !File.directory?(\"#{ options[:ctx] }/assets/javascripts/templates/rails-angularui-bootstrap\")\n\t\t\t`mkdir -p #{ options[:ctx] }/assets/javascripts/templates/rails-angularui-bootstrap`\n\t\tend\n\n\t\tif need_clone || options[:ctx] == 'vendor'\n\t\t\tputs \"Either you're the gem maintainer or you chose a different branch and repo, i'll have to try to clone and build it ...\".colorize(:yellow)\n\n\t\t\tif File.directory?('tmp/bootstrap')\n\t\t\t\t# remove the old git if it was there from previous run\n\t\t\t\t`rm -rf tmp/bootstrap`\n\n\t\t\t\t# remove any old bootstrap files\n\t\t\t\t`rm -rf #{options[:ctx]}/assets/javascripts/templates/rails-angularui-bootstrap/*`\n\t\t\tend\n\t\t\t\n\t\t\t# clone the repo of angular ui\n\t\t\t`git clone -b #{options[:branch]} #{options[:repo]} tmp/bootstrap`\n\t\t\t\n\t\t\t# get the node settings / version\n\t\t\tnpm_settings = JSON.parse( File.read(\"tmp/bootstrap/package.json\"))\n\t\t\tjs_version = npm_settings[\"version\"]\n\t\t\t\n\t\t\tDir.chdir('tmp/bootstrap')\n\n\t\t\t# install dependencies, make use of the tmp directory\n\t\t\t`npm install`\n\n\t\t\t# build the angular ui repo, even if tests fail.\n\t\t\tputs \"Running Grunt...\".colorize(:light_blue)\n\t\t\t`grunt --force`\n\n\t\t\t# write a version comment to this file so it's easy to know whence this file came\n\t\t\twrite_version(\"dist/ui-bootstrap-#{ js_version }.js\", \n\t\t\t\t[\"// generated from #{options[:repo]}:#{options[:branch]} version: #{ js_version } on #{Time.new().strftime(\"%m-%d-%Y %H:%M:%S\")} \\n\"\n\t\t\t\t], 0)\n\t\t\t\n\t\t\t# now copy the built version of the js in dist, without the templates\n\t\t\t`cp dist/ui-bootstrap-#{ js_version }.js ../../#{ gem_js_directory }`\n\n\t\t\t# remove all the old templates\n\t\t\t`rm -rf #{options[:ctx]}/assets/javascripts/templates/rails-angularui-bootstrap/*`\n\n\t\t\t# pull the templates out into our <ctx>/assets/javascripts/templates/rails-angularui-bootstrap dir\n\t\t\t`cp -r template/* ../../#{options[:ctx]}/assets/javascripts/templates/rails-angularui-bootstrap/`\n\n\t\t\t# move to the parent directory\n\t\t\tDir.chdir('../..')\n\t\t\t\n\t\t\t# convert templates to haml, suppress warnings\n\t\t\tputs 'Converting to hamlc...'.colorize(:light_blue)\n\t\t\t`for file in #{options[:ctx]}/assets/javascripts/templates/rails-angularui-bootstrap/**/*.html; do html2haml -e $file ${file%html}hamlc 2>&1 && rm $file; done`\n\n\t\t\t# clean up\n\t\t\t# remove all js files\n\t\t\tputs 'Removing temp files...'\n\t\t\t`rm #{options[:ctx]}/assets/javascripts/templates/rails-angularui-bootstrap/**/*.js`\n\t\t\t# remove the bootstrap dir\n\t\t\t`rm -rf tmp/bootstrap`\n\t\t\t\n\t\tend\n\n\t\tif options[:ctx] == \"app\"\n \tif need_clone\n\t\t\t\tsource = File.join(Gem.loaded_specs[\"rails_angularui_bootstrap\"].full_gem_path, \"vendor/assets/javascripts/rails-angularui-bootstrap\", \"rails_angularui_bootstrap.coffee\")\n\t \ttarget = File.join(Rails.root, \"app/assets/javascripts/rails-angularui-bootstrap\", \"rails_angularui_bootstrap.coffee\")\n\t \t`cp #{source} #{target}`\n\n \t\t# write version into rails_angularui_bootstrap\n\t\t\t\twrite_version(\"#{options[:ctx]}/assets/javascripts/rails-angularui-bootstrap/rails_angularui_bootstrap.coffee\",[\n\t\t\t\t\t\"# require the ui-bootstrap module, in case the user wants to selectively load \\n\",\n\t\t\t\t\t\"#= require rails-angularui-bootstrap/ui-bootstrap-#{ js_version }.js \\n\"\n\t\t\t\t],2)\n\t\t\telse\n\t\t\t\tputs \"Generating files\".colorize(:cyan)\n\t\t\t\t# same repo and branch, no need to clone, just copy from gem\n\t\t\t\tjs_source = File.join(Gem.loaded_specs[\"rails_angularui_bootstrap\"].full_gem_path, \"vendor/assets/javascripts/rails-angularui-bootstrap\")\n\t \tjs_target = File.join(Rails.root, \"app/assets/javascripts/\")\n\t \t\n\t \t`cp -r #{js_source} #{js_target}`\n\n\t \t# index file not needed\n\t \t`rm #{js_target}rails-angularui-bootstrap/index.js`\n\n\t \ttemplate_source = File.join(Gem.loaded_specs[\"rails_angularui_bootstrap\"].full_gem_path, \"vendor/assets/javascripts/templates/rails-angularui-bootstrap\") \n\t \ttemplate_target = File.join(Rails.root, \"app/assets/javascripts/templates\")\n\n\t \t`cp -r #{template_source} #{template_target}`\n\t\t\tend\n\n\t\t\tputs \"Overrode rails_angularui_bootstrap.coffee from gem by placing it in #{gem_js_directory}\".colorize(:yellow)\n\t\tend\n\n\t\t\n\t\tputs \"Templates were generated in #{options[:ctx]}/assets/javascripts/templates/rails-angularui-bootstrap\".colorize(:green)\n\t\tputs \"Options: #{options.inspect}\".colorize(:light_blue)\n \tend",
"def templates; end",
"def run\n # the safe_create_module_files will render every file under the templates/module_files\n # folder in your gem and copy them to the destination.\n safe_create_module_files(template_dir, module_path, context)\n # Should you need to change the file name of the copied file you will have to move\n # the file outside of the module_files directory and\n # render it using: safe_create_template_file(file_path, template, context)\n cleanup(module_path, context.plugin_name)\n end",
"def render_and_write_templates\n clean_build_dir()\n\n yard_file_hash = {}\n\n Dir.glob(\"#{Dir.pwd}/projects/*\").select { |f| File.directory? f }.each do|project_dir|\n yard_file = \"#{project_dir}/yard.yaml\"\n\n unless yard_file.empty?\n yard = YAML::load_file(yard_file)\n next if yard['disabled']\n\n apps = yard['apps']\n project_name = yard['project']['name']\n project_pipelines = yard['pipelines']\n\n Dir.mkdir \"#{BUILD_DIR}/#{project_name}\"\n puts project_name\n\n apps.each do |app_name, app_config|\n Dir.mkdir(\"#{BUILD_DIR}/#{project_name}/#{app_name}/\")\n app_pipelines = Hash.new({})\n\n project_pipelines.each do |pipeline|\n app_pipelines[pipeline['name']] = app_pipelines[pipeline['name']].merge(pipeline)\n end\n\n unless app_config.nil? || app_config['pipelines'].nil?\n app_config['pipelines'].each do |pipeline|\n app_pipelines[pipeline['name']] = app_pipelines[pipeline['name']].merge(pipeline)\n end\n end\n\n # puts app_pipelines\n\n base_files = Dir[\"#{Dir.pwd}/base/*\"]\n project_base_files = Dir[\"#{project_dir}/base/*\"]\n app_files = Dir[\"#{project_dir}/#{app_name}/*\"]\n\n app_pipelines.each do|pipeline_name, pipeline_config|\n template_name = pipeline_config['templateName'] ? pipeline_config['templateName'] : \"#{pipeline_name}.json\"\n\n app_files.each do|path|\n render_and_write(\n pipeline_config: pipeline_config,\n path: path,\n template_name: template_name,\n app_name: app_name,\n project_name: project_name,\n app_template_vars: app_config['template_vars']\n )\n end\n project_base_files.each do|path|\n render_and_write(\n pipeline_config: pipeline_config,\n path: path,\n template_name: template_name,\n app_name: app_name,\n project_name: project_name,\n app_template_vars: app_config['template_vars']\n )\n end\n\n base_files.each do|path|\n render_and_write(\n pipeline_config: pipeline_config,\n path: path,\n template_name: template_name,\n app_name: app_name,\n project_name: project_name,\n app_template_vars: app_config['template_vars']\n )\n end\n end\n end\n end\n end\n end",
"def initialize_generate\n super\n add_accessors\n @flavor.class.do_declare_resources do\n templates_if_missing << 'metadata.rb'\n templates_if_missing << 'README.md'\n templates_if_missing << 'CHANGELOG.md'\n end\n declare_gemfile\n declare_berksfile\n declare_rakefile\n declare_chefignore_patterns\n end",
"def determine_template(options); end",
"def templated_build(name, opts={})\r\n short = name.downcase\r\n source = File.join(\"wrappers\", short)\r\n dependencies = [\"mustache.js\"] + Dir.glob(\"#{source}/*.tpl.*\")\r\n target_js = opts[:location] ? \"mustache.js\" : \"#{short}.mustache.js\"\r\n\r\n CLEAN.include(opts[:location] ? opts[:location] : target_js)\r\n\r\n desc \"Package for #{name}\"\r\n task short.to_sym => dependencies do\r\n puts \"Packaging for #{name}\"\r\n\r\n mkdir_p opts[:location] if opts[:location]\r\n\r\n files = [\r\n \"#{source}/mustache.js.pre\",\r\n 'mustache.js',\r\n \"#{source}/mustache.js.post\"\r\n ]\r\n\r\n open(\"#{opts[:location] || '.'}/#{target_js}\", 'w') do |f|\r\n files.each {|file| f << File.read(file) }\r\n end\r\n\r\n puts \"Done, see #{opts[:location] || '.'}/#{target_js}\"\r\n end\r\nend",
"def generate_packaging_artifacts(workdir, name, binding, project)\n [\"pkginfo\", \"depend\", \"preinstall\", \"preremove\", \"postinstall\", \"proto\"].each do |template|\n target_dir = File.join(workdir, 'packaging')\n FileUtils.mkdir_p(target_dir)\n erb_file(File.join(VANAGON_ROOT, \"resources/solaris/10/#{template}.erb\"), File.join(target_dir, template), false, { :binding => binding })\n end\n end",
"def templated_build(name, opts={})\n short = name.downcase\n source = File.join(\"wrappers\", short)\n dependencies = [\"mustache.js\"] + Dir.glob(\"#{source}/*.tpl.*\")\n target_js = opts[:location] ? \"mustache.js\" : \"#{short}.mustache.js\"\n\n CLEAN.include(opts[:location] ? opts[:location] : target_js)\n\n desc \"Package for #{name}\"\n task short.to_sym => dependencies do\n puts \"Packaging for #{name}\"\n\n mkdir_p opts[:location] if opts[:location]\n\n files = [\n \"#{source}/mustache.js.pre\",\n 'mustache.js',\n \"#{source}/mustache.js.post\"\n ]\n\n open(\"#{opts[:location] || '.'}/#{target_js}\", 'w') do |f|\n files.each {|file| f << File.read(file) }\n end\n\n puts \"Done, see #{opts[:location] || '.'}/#{target_js}\"\n end\nend",
"def gemspec_building_block; end",
"def setup_override\n spec = Gem::Specification.find_by_name 'yard'\n erb = File.join(spec.gem_dir,\"templates\",\"default\",\"fulldoc\",\"html\",ERB)\n # Create the subdirectory structure\n subdir = File.join(tmpdir,\"default\",\"fulldoc\",\"html\")\n FileUtils.mkdir_p subdir\n # Copy the erb\n target_file = File.join(subdir,ERB)\n FileUtils.cp(erb,target_file)\n # Open the file and add the anchors\n open(target_file,'a') do |file|\n file.write \"<% do_dash %>\\n\"\n end\n end",
"def expand_template_files\n rails_host = config['bind-address'] || `hostname`.chomp\n rails_port = config['port-number'].to_s\n rails_url = \"http://#{rails_host}:#{rails_port}\"\n Dir[File.join(install_directory,'installer','*.template')].each do |template_file|\n output_file = template_file.gsub(/\\.template/,'')\n next if File.exists?(output_file) # don't overwrite files\n\n message \"expanding #{File.basename(output_file)} template\"\n \n text = File.read(template_file).gsub(/\\$RAILS_URL/,rails_url).gsub(/\\$RAILS_HOST/,rails_host).gsub(/\\$RAILS_PORT/,rails_port)\n \n File.open(output_file,'w') do |f|\n f.write text\n end\n end\n end",
"def generate force_build = false\n blog_template = Template::Blog.new self\n\n skipped_files = []\n new_files = []\n updated_files = []\n old_files = Dir.glob('public/**/*.html')\n\n blog_template.modes.each {\n |mode|\n\n blog_template.mode = mode\n\n (1..blog_template.pages).each { |page|\n blog_template.page = page\n path = blog_template.local_path\n pretty_path = Pathname.new(path).relative_path_from(Pathname.new(@spec.blog_root)).to_s\n\n if old_files.include? pretty_path\n old_files.delete pretty_path\n end\n\n mtime = File.exists?(path) ? File.mtime(path) : nil\n needs_update = force_build || mtime.nil?\n\n if ! needs_update\n needs_update = blog_template.posts.any? {\n |post|\n mtime < File.mtime(post.post_data.source_path)\n }\n\n if ! needs_update\n skipped_files << path\n next\n end\n end\n\n dir = File.dirname(path)\n FileUtils.mkdir_p dir unless File.directory? dir\n\n if File.exists? path\n updated_files << pretty_path\n else\n new_files << pretty_path\n end\n\n r = nil\n File.open(path, 'w') {\n |io|\n io.write blog_template.render\n }\n }\n }\n\n updated_files.each { |path| puts \"* #{path}\" }\n\n new_files.each { |path| puts \"+ #{path}\"}\n\n old_files.each {\n |path|\n puts \"- #{path}\"\n File.unlink path\n dir = File.dirname path\n if Dir.entries(dir) == @@EMPTY_DIR_ENTRIES\n Dir.unlink dir\n end\n }\n end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template_name; end",
"def template_name; end",
"def cli_execute_make_transform_scaffold\n File.open(File.dirname(__FILE__)+'/data/transform_template.rb.tmpl','r') do |f|\n body = f.readlines.join('')\n body.gsub!('%%timestamp%%',Time.now.strftime(\"%a, %d %b %Y\"));\n body.gsub!('%%app name%%',cli_program_name);\n STDOUT.syswrite body\n end\n end",
"def generate_file_files\n setup\n\n page_file = @template_dir + 'page.rhtml'\n fileinfo_file = @template_dir + 'fileinfo.rhtml'\n\n # for legacy templates\n filepage_file = @template_dir + 'filepage.rhtml' unless\n page_file.exist? or fileinfo_file.exist?\n\n return unless\n page_file.exist? or fileinfo_file.exist? or filepage_file.exist?\n\n debug_msg \"Generating file documentation in #{@outputdir}\"\n\n out_file = nil\n current = nil\n\n @files.each do |file|\n current = file\n\n if file.text? and page_file.exist? then\n generate_page file\n next\n end\n\n template_file = nil\n out_file = @outputdir + file.path\n debug_msg \" working on %s (%s)\" % [file.full_name, out_file]\n rel_prefix = @outputdir.relative_path_from out_file.dirname\n search_index_rel_prefix = rel_prefix\n search_index_rel_prefix += @asset_rel_path if @file_output\n\n asset_rel_prefix = rel_prefix + @asset_rel_path\n\n unless filepage_file then\n if file.text? then\n next unless page_file.exist?\n template_file = page_file\n @title = file.page_name\n else\n next unless fileinfo_file.exist?\n template_file = fileinfo_file\n @title = \"File: #{file.base_name}\"\n end\n end\n\n @title += \" - #{@options.title}\"\n template_file ||= filepage_file\n\n render_template template_file, out_file do |io|\n here = binding\n # suppress 1.9.3 warning\n here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)\n here.local_variable_set(:current, current)\n here\n end\n end\n rescue => e\n error =\n RDoc::Error.new \"error generating #{out_file}: #{e.message} (#{e.class})\"\n error.set_backtrace e.backtrace\n\n raise error\n end",
"def generate_project_file\n template_file = @template_dir + 'hhp_file.hhp.rhtml'\n\n @values = { :title => @options.title, :opname => @outputdir.basename }\n \n static_files = ['index.html', 'classindex.html', 'fileindex.html']\n @values[:html_files] = static_files + (@generated_files+@classes).map{|f| f.path}.uniq\n \n out_file = @outputdir + @project_name\n debug_msg \" rendering #{out_file}\"\n render_template template_file, out_file do |io| binding end\n end",
"def app_generators; end",
"def build_view \n \n return if skip_method(__method__)\n \n # build edit _form index new show\n \n ['_form','edit','new','index','show'].each do |file|\n \n \n template = File.read(template(\"rails/views/#{file}.html.erb\"))\n \n # need to use ERB for these templates\n text = ERB.new(template, nil, '-').result(binding)\n\n filename = \"#{file}.html.erb\"\n # #puts \"build Rails view\"\n \n path = namespaced_path(\"app/views\",\"#{plural_table_name}/\"+filename)\n puts \"build Rails #{file} view for #{model_name} in #{path}\"\n write_artifact(path,text)\n \n end\n \n # build the json views\n ['index','show'].each do |file|\n \n template = File.read(template(\"rails/views/#{file}.json.jbuilder\"))\n text = ERB.new(template, nil, '-').result(binding)\n \n filename = \"#{file}.json.jbuilder\"\n # #puts \"build Rails JSON view \"\n \n path = namespaced_path(\"app/views\",\"#{plural_table_name}/\"+filename)\n puts \"build Rails #{file} JSON view for #{model_name} in #{path}\"\n write_artifact(path,text)\n \n end\n \n end",
"def generate\n\t\t\t\tbegin\n\t\t\t\t\ttemplate = @template\n\t\t\t\t\ttemplate_manager = @template_manager\n\n\t\t\t\t\tt = template_manager.find_template_by_name(template)\n\t\t\t\t\tt = t.class.new\n\n\t\t\t\t\tif t.template_info[:renderer] == \"CSV\"\n\t\t\t\t\t\tRisu::Renderers::CSVRenderer.generate(@output_file) do |output|\n\t\t\t\t\t\t\tt = template_manager.find_template_by_name(template)\n\t\t\t\t\t\t\tt = t.class.new\n\t\t\t\t\t\t\tt.output = output\n\t\t\t\t\t\t\tt.render(output) unless t == nil\n\t\t\t\t\t\tend\n\t\t\t\t\telsif t.template_info[:renderer] == \"PDF\"\n\t\t\t\t\t\tPrawn::Document.generate(@output_file, :margin => [75, 50, 75, 50]) do |output|\n\t\t\t\t\t\t\toutput.font_size 10\n\t\t\t\t\t\t\tt = template_manager.find_template_by_name(template)\n\t\t\t\t\t\t\tt = t.class.new\n\t\t\t\t\t\t\tt.output = output\n\t\t\t\t\t\t\tt.render(output) unless t == nil\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\trescue => e\n\t\t\t\t\traise unless Rails.env.production?\n\t\t\t\t\tputs \"Templater Error: #{e.message} \\n #{e.backtrace.join(\"\\n\\t\")}\\n\"\n\t\t\t\tend\n\t\t\tend",
"def build_script(hook_type)\n ERB.new(DEFAULT_TEMPLATE).result(binding)\n end",
"def template(name); end",
"def templates_path\n expanded_path_for('/generators')\nend",
"def generate_html\n # the individual descriptions for files and classes\n gen_into(@files)\n gen_into(@classes)\n # and the index files\n gen_file_index\n gen_class_index\n gen_method_index\n gen_main_index\n\n # this method is defined in the template file\n write_extra_pages if defined? write_extra_pages\n end",
"def render_template(opts={})\n template_file_path = @bootstrap_template_path || File.expand_path(TEMPLATE_PATH, __FILE__)\n template_file = File.read(template_file_path)\n erb_template = ERB.new(template_file)\n last_bootstrap_line = LAST_BOOTSTRAP_LINE\n generated_template = erb_template.result(binding)\n @log.debug \"generated template is #{generated_template}\"\n return generated_template\n end",
"def build_task_template\n b = binding\n ERB.new(Woro::TaskHelper.read_template_file).result(b)\n end",
"def template(name)\n File.join TemplatePath, \"#{name}.rb\"\nend",
"def manifest(m)\r\n load_paths = load_paths('lazydoc', 'configurable', 'tap')\r\n bin_path = File.join(load_paths.last.chomp('lib'), 'bin/tapexe')\r\n \r\n m.template name, 'tap.erb', {\r\n :load_paths => load_paths,\r\n :bin_path => bin_path\r\n }\r\n \r\n m.on(:generate) do \r\n log :chmod, \"0755 #{name}\"\r\n FileUtils.chmod(0755, name)\r\n end\r\n \r\n m.template profile, 'profile.erb', {\r\n :generator => self.class,\r\n :filename => profile\r\n }\r\n end",
"def compile_templates\n dir = File.join(Frank.root, Frank.dynamic_folder)\n\n Dir[File.join(dir, '**{,/*/**}/*')].each do |path|\n if File.file?(path) && !File.basename(path).match(/^(\\.|_)/)\n path = path[ (dir.size + 1)..-1 ]\n ext = File.extname(path)\n new_ext = ext_from_handler(ext)\n name = File.basename(path, ext)\n\n # No suitable handler found\n if not new_ext.is_a? String\n next\n end\n\n if Frank.production? && \"#{name}.#{new_ext}\" != 'index.html' && new_ext == 'html'\n new_file = File.join(Frank.export.path, path.sub(/(\\/?[\\w-]+)\\.[\\w-]+$/, \"\\\\1/index.#{new_ext}\"))\n else\n new_file = File.join(Frank.export.path, path.sub(/\\.[\\w-]+$/, \".#{new_ext}\"))\n end\n\n create_dirs(new_file)\n File.open(new_file, 'w') {|f| f.write render(path) }\n puts \" - \\033[32mCreating\\033[0m '#{new_file}'\" unless Frank.silent_export?\n end\n end\n end",
"def create_source_files\n empty_directory(File.join(target_dir, \"lib/kitchen/driver\"))\n\n create_template(\n \"version.rb.erb\",\n \"lib/kitchen/driver/#{name}_version.rb\"\n )\n create_template(\n \"driver.rb.erb\",\n \"lib/kitchen/driver/#{name}.rb\"\n )\n end",
"def compile_templates(production)\n dir = File.join(@proj_dir, @dynamic_folder)\n \n Dir[File.join(dir, '**/*')].each do |path|\n if File.file?(path) && !File.basename(path).match(/^(\\.|_)/)\n path = path[ (dir.size + 1)..-1 ]\n ext = File.extname(path)\n new_ext = ext_from_handler(ext) \n name = File.basename(path, ext)\n \n if production == true && \"#{name}.#{new_ext}\" != 'index.html' && new_ext == 'html'\n new_file = File.join(@output_folder, path.sub(/(\\/?[\\w-]+)\\.[\\w-]+$/, \"\\\\1/index.#{new_ext}\"))\n else\n new_file = File.join(@output_folder, path.sub(/\\.[\\w-]+$/, \".#{new_ext}\")) \n end\n \n create_dirs(new_file)\n File.open(new_file, 'w') {|f| f.write render(path) }\n puts \" - \\033[32mCreating\\033[0m '#{new_file}'\"\n end\n end\n end",
"def get_renderer_template\n File.read(\"#{@azure_sdk_for_ruby_location}/generators/requirefilegen/src/resources/templates/require_file_template.template\")\n end",
"def build(wrap = true)\n h = []\n\n h << self.class.start_component_template if wrap\n h << template\n h << self.class.end_component_template if wrap\n\n h = h.join(\"\\n\")\n\n ERB.new(h).result(binding)\n end",
"def create_base_project\n raise GeneratorArgumentsError if app_path.nil?\n puts \"creating base project\"\n directory \"templates\", \"#{app_path}\"\n end",
"def generate_pkg_contents\n shellout!(\"pkgsend generate #{source_dir} | pkgfmt > #{pkg_manifest_file}.1\")\n shellout!(\"pkgmogrify -DARCH=`uname -p` #{pkg_manifest_file}.1 #{pkg_metadata_file} #{transform_file} | pkgfmt > #{pkg_manifest_file}.2\")\n end",
"def create_view_templates\n unless @check_migration\n template 'views/images.html.erb', File.join(file_path, \"_images.html.erb\")\n template 'views/image.html.erb', File.join(file_path, \"_image.html.erb\")\n template 'views/images_field.html.erb', File.join(file_path, \"_images_field_#{@chunk}.html.erb\")\n else\n unless File.exists?(\"#{file_path}/_images_field_#{@chunk}.html.erb\")\n template 'views/images_field.html.erb', File.join(file_path, \"_images_field_#{@chunk}.html.erb\")\n end\n end\n end",
"def gemspec_helper; end",
"def gemspec_helper; end",
"def gemspec_helper; end",
"def gemspec_helper; end",
"def gemspec_helper; end",
"def gemspec_helper; end",
"def build_gem; end",
"def regenerate_helpers!; end",
"def replace_gemfile\n # Gemfile template needs to be 'Gemfile.erb' otherwise it attempts to fetch Gemfile template from the Rails gem\n # https://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/app/templates/Gemfile.tt#L9\n template 'Gemfile.erb', 'Gemfile', force: true\n end",
"def generate_all\n copy_template_dir('layouts', 'layouts')\n copy_template_dir('content/bootstrap', 'content/bootstrap')\n copy_template_dir('content/content', 'content/content')\n delete_target_file('lib/default.rb')\n copy_template_dir('lib', 'lib')\n delete_target_file('Rules')\n copy_template_file('Rules', 'Rules')\n copy_template_file('.gitignore', '.gitignore')\n copy_template_file('cg_config.rb', 'cg_config.rb')\n copy_template_file('cg_config.rb_sample', 'cg_config.rb_sample')\n delete_target_file('content/stylesheet.css')\n delete_target_file('content/index.html')\n delete_target_file('layouts/default.html')\n create_empty_dir('content/images')\n end",
"def generate\n\t\ttemplate('service.tt', \"lib/services/#{name.underscore}_service.rb\")\n\tend",
"def common_generator\n if name.to_s.downcase == 'install'\n cp_config\n cp_models\n cp_controllers\n else\n puts 'Try to use: rails g the_banners install'\n end\n end",
"def convert_template!\n tag! \"template\" do\n convert_s! \"name?\"\n if @version >= 119\n convert_id!\n end\n\n convert_array! \"subtemplates\" do\n convert_subtemplate!\n end\n\n convert_array! \"children\" do\n convert_uientry_gen2!\n end\n\n out_ofs! \"end of template?\"\n end\n end",
"def process_and_build_components \n end",
"def generate_template(datestamp, entrytext, starred, uuid)\n ERB.new <<-XMLTEMPLATE\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n <plist version=\"1.0\">\n <dict>\n <key>Creation Date</key>\n <date><%= datestamp %></date>\n <key>Entry Text</key>\n <string><%= entrytext %></string>\n <key>Starred</key>\n <<%= starred %>/>\n <key>Tags</key>\n <array>\n <string>daily logs</string>\n </array>\n <key>UUID</key>\n <string><%= uuid %></string>\n </dict>\n </plist>\n XMLTEMPLATE\n end",
"def generate_html\n @main_url = main_url\n @sorted_files = @files.sort\n @sorted_classes = @classes.sort\n @sorted_methods = RDoc::Generator::Method.all_methods.sort\n\n # the individual descriptions for files and classes\n gen_into(@files)\n gen_into(@classes)\n\n # and the index files\n gen_file_index\n gen_class_index\n gen_method_index\n gen_main_index\n\n # this method is defined in the template file\n values = {\n :title_suffix => CGI.escapeHTML(\"[#{@options.title}]\"),\n :charset => @options.charset,\n :style_url => style_url('', @options.css),\n }\n\n @template.write_extra_pages(values) if\n @template.respond_to?(:write_extra_pages)\n end",
"def template_name=(_arg0); end",
"def template_name=(_arg0); end",
"def template(_template_name)\n \"This is a dummy template! <%= dummy %> \\n \"\\\n 'Here is a global value <%= dummy_global %>'\n end",
"def template_module_name(path); end",
"def initialize(template_text,options={})\n @renderer_extension_modules=[]\n\n @name=options[:template_name]\n @templates_root_dir= options[:templates_directory]# || \"#{::Rails.root.to_s}/app/views\"\n\n @output_buffer=\"\"\n #unique tag for escaping post and pre processing tags\n @ltag=\"!@@@##$$1212\"\n @rtag=\"!723465hjf3!@#\"\n\n @default_language=options[:default_language] || \"en\"\n\n\n @escape_tags= options[:tags_to_escape] || []\n @runtime_tags= options[:runtime_tags] || []\n\n\n #escape blocks that will be run at view time\n @template_text=template_text.clone\n @escape_tags.each do |etag|\n escape_tag_content( etag,@template_text)\n\n \n end\n\n# raise \"need templates directory\" unless options[:templates_directory]\n\n #escape all normal dynamic blocks for preprocessing\n @template_text=@template_text.gsub(\"<%\",@ltag).gsub(\"%>\",@rtag).gsub(\"<$\",\"<%\").gsub(\"$>\",\"%>\")\n \n #turn the setup block into a proc <## ##> into executable blocks\n @template_text=@template_text.gsub(\"<##\",\"<% set_setup_proc{ \").gsub(\"##>\",\"} %>\")\n\n #turn the key block into a proc <## ##> into executable blocks\n @template_text=@template_text.gsub(\"<!!KEY\",\"<% set_key_proc{ \").gsub(\"!!KEY>\",\"} %>\")\n\n\n @raw_template=compile(@template_text)\n #this hold variations of the template after it has been localized\n #into different languages, but before rendering\n @localized_templates={}\n @setup_proc=nil\n @key_proc=nil\n @render_base=options[:render_base]\n @template_name=options[:template_name]\n #this tag will be used to create non cachable dynamic blocks\n\n\n if options.has_key?(:helpers) && options[:helpers]!=nil\n options[:helpers].each do |helper|\n include helper\n end\n end\n \n end",
"def add_handlers\n template 'templates/dry/app.tt', \"#{name}/app.rb\"\n end",
"def generate!\n info \"GENERATE\"\n\n f = Generator.new @dbi, @settings, @logger\n xslt = XML::XSLT.new\n xslt.xml = f.generate_root.to_s\n\n default_template_dir = File.dirname(__FILE__) + '/../../data/templates'\n template_dir = @settings['templates'] || default_template_dir\n output_dir = @settings['output']\n\n task \"copy static files\" do\n FileUtils.mkdir_p output_dir\n FileUtils.cp_r Dir[File.join( template_dir, 'static', '*' )], output_dir\n end\n\n begin\n Dir.foreach(template_dir) { |template_file|\n next if template_file =~ /^\\./ || template_file == 'static'\n\n task \"process #{template_file}\" do\n xslt.xsl = File.join( template_dir, template_file )\n File::open( File.join( output_dir, template_file ), 'w') { |f| f.write(xslt.serve) }\n end\n }\n rescue Errno::ENOENT\n warn \"Couldn't find templates directory, fallback to default templates!\"\n template_dir = default_template_dir\n retry\n end\n end",
"def generate_project\n @writer.make_project_root\n\n project_dirs = %w(docs lib spec bin)\n @writer.create_dirs(project_dirs)\n\n files = {\n :executable => \"bin/#{@project_name}\",\n :gemspec => '',\n :gitignore => '.gitignore',\n :gitattributes => '.gitattributes',\n :gemspec => \"#{@project_name}.gemspec\",\n }\n @writer.copy_templates_for(files)\n end",
"def default_template_file\n File.join(__dir__, '..', '..', '..', '..', '..', 'vendor', 'AdditionalConfiguration.php.erb')\n end",
"def gemspec_building_block=(_arg0); end",
"def generate_class klass, template_file = nil\n setup\n\n current = klass\n\n template_file ||= @template_dir + 'class.rhtml'\n\n debug_msg \" working on %s (%s)\" % [klass.full_name, klass.path]\n out_file = @outputdir + klass.path\n rel_prefix = @outputdir.relative_path_from out_file.dirname\n search_index_rel_prefix = rel_prefix\n search_index_rel_prefix += @asset_rel_path if @file_output\n\n asset_rel_prefix = rel_prefix + @asset_rel_path\n svninfo = get_svninfo(current)\n\n @title = \"#{klass.type} #{klass.full_name} - #{@options.title}\"\n\n debug_msg \" rendering #{out_file}\"\n render_template template_file, out_file do |io|\n here = binding\n # suppress 1.9.3 warning\n here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)\n here.local_variable_set(:svninfo, svninfo)\n here\n end\n end",
"def build_environment_resources(environment, system_exec)\n puts \"Building all required resources for environment '#{environment.environment_name}'\"\n\n if environment.is_drupal_environment?\n build_css_and_js_for_drupal\n environment.create_template_resources\n end\n\n copy_project_dependencies_for_awestruct_image\n build_base_docker_images(environment, system_exec)\n build_environment_docker_images(environment, system_exec)\n\nend",
"def generate_merging(template, binding, path, tag_prefix)\n new_content = TemplateManager.new.generate(template, binding)\n @project.merge_new_content(new_content, path, \"Spec generated\", tag_prefix)\n end",
"def uses_of_yield_in_templates\n path_to_templates = \"#{PROJECT_ROOT}/app/**/*.erb\"\n templates = Dir.glob(path_to_templates)\n\n templates.reduce([]) do |accumulator, filename|\n accumulator | UsesOfYieldInTemplate.new(filename).call\n end\nend",
"def create_base_project\n puts \"creating base project\"\n directory \"templates\", \"#{app_path}\"\n end",
"def setup\n templates = ['default']\n templates << @opts[:testkitchen] if @opts[:testkitchen]\n\n templates.each { |type| create_file(type) }\n end",
"def generate\n template_dir = File.join(File.dirname(__FILE__), \"../templates\")\n proxy_hpp = Generation.render_template template_dir, \"proxies\", \"Task.hpp\", binding\n proxy_cpp = Generation.render_template template_dir, \"proxies\", \"Task.cpp\", binding\n file_proxy_hpp = Generation.save_automatic(project.name, \"/proxies\", \"#{task.basename}.hpp\", proxy_hpp)\n file_proxy_cpp = Generation.save_automatic(project.name, \"/proxies\", \"#{task.basename}.cpp\", proxy_cpp)\n\n forward_hpp = Generation.render_template template_dir, \"proxies\", \"Forward.hpp\", binding\n file_forward_hpp = Generation.save_automatic(project.name, \"proxies\", \"#{task.basename}Forward.hpp\", forward_hpp)\n\n cmake = Generation.render_template template_dir, 'proxies', 'CMakeLists.txt', binding\n Generation.save_automatic(project.name, 'proxies', \"CMakeLists.txt\", cmake)\n \n pc = Generation.render_template template_dir, \"proxies\", \"proxies.pc\", binding\n Generation.save_automatic(project.name, \"proxies\", \"#{project.name}-proxies.pc.in\", pc)\n end",
"def generate_layout\n if options.sass?\n directory 'app'\n gem 'compass', '>=0.10.5'\n gem 'compass-960-plugin', '>=0.10.0'\n directory 'config'\n else\n copy_file \"stylesheet.css\", \"public/stylesheets/#{file_name}.css\" if options.stylesheet?\n copy_file \"handheld.css\", \"public/stylesheets/handheld.css\" if options.stylesheet?\n end\n copy_file \"modernizr-1.5.min.js\", \"public/javascripts/modernizr-1.5.min.js\"\n copy_file \"jquery-1.4.2.min.js\", \"public/javascripts/jquery-1.4.2.min.js\"\n copy_file \"dd_belatedpng.js\", \"public/javascripts/dd_belatedpng.js\"\n\n template \"layout.html.erb\", \"app/views/layouts/#{file_name}.html.erb\"\n copy_file 'layout_helper.rb', 'app/helpers/layout_helper.rb'\n end",
"def generate_post\n return if @spec.extensions.empty?\n @rpm_post = \"echo \\\"Building native extensions. This could take a while...\\\"\\n\"\n # initialize make command string\n build_cmd = StringIO.new\n # start building make command\n dest_path = File.join @os_install_dir, \"gems\", \"#{name}-#{version}\", @spec.require_paths.first\n ran_rake = false # only run rake once\n\n @spec.extensions.each do |extension|\n break if ran_rake\n\n builder = case extension\n when /extconf/ then\n RGem2Rpm::Ext::ExtConfBuilder\n when /configure/ then\n RGem2Rpm::Ext::ConfigureBuilder\n when /rakefile/i, /mkrf_conf/i then\n ran_rake = true\n RGem2Rpm::Ext::RakeBuilder\n else\n nil\n end\n # get build\n build_cmd << builder.build(extension, dest_path)\n end\n # set rpm no arch to false\n @rpm_no_arch = false\n # return set post install\n @rpm_post = \"#{@rpm_post}#{build_cmd.string}\"\n end",
"def create_template_dot_rb\n\tsystem('touch template.rb')\n\tfile = File.open('template.rb', 'w')\n\tfile.puts(\"require 'pry'\")\n\tfile.puts(\"require 'dotenv'\")\n\tfile.puts('')\n\tfile.puts(\"Dotenv.load('.env')\")\n\tfile.close\nend",
"def build()\n \n #check dir exists, if not, make it\n if(!File.exists?(@path))\n Dir.mkdir(@path)\n end\n \n #build directory structure\n puts 'Building directory structure'\n build_skeleton(@template.directory_structure)\n \n #execute build tasks\n puts 'Running build tasks'\n execute_tasks(@template.tasks,@template.path)\n \n puts 'Skeleton built'\n \n end",
"def built_in_template_for(template_name)\n File.join( File.dirname(__FILE__), 'templates', template_name )\n end",
"def generate template, file\n if file.kind_of? String then # one file\n write_template(file, ERB.new(load_template(template)).result(binding))\n else # multiple files\n file.each do |f|\n write_template(f, ERB.new(load_template(template)).result(binding))\n end\n end\n end",
"def template(*path); end",
"def generate_ansible_files\n \n # Helper to decide whether or not to generate/update a given file\n update = Proc.new do |fn, mtime|\n !(File.exists?(fn) && File.stat(fn).mtime >= mtime)\n true\n end\n\n Dir.glob('./templates/ansible.*').each do |template|\n\n # Get a template's last modified date\n source_mtime = File.stat(template).mtime \n\n # Get a destination's potential file name & path \n target_file = File.basename(template).split('.').slice(1...-1).join('.') \n target_paths = target_file.start_with?('inventory') ? ['inventory/'] : ['', 'plays/*/']\n\n # Walk destination path(s)\n target_paths.each do |target_path|\n \n Dir.glob(\"./ansible/#{target_path}\").each do |path|\n\n # Build a potential real path\n fn = File.join(File.expand_path(path), target_file) \n\n # Yield source (template file) & target if the target needs to be generated/updated\n yield template, fn if update.call(fn, source_mtime) && block_given?\n end\n end\n end\nend",
"def pack_template\n selfclass.pack_template\n end",
"def create_plugin_gemspec\n template(\"extension.gemspec\",\n \"#{extension_name}/#{extension_name}.gemspec\")\n end",
"def create_templates\n files = %w(_filter _form index admin edit show new)\n files.each do |file|\n template \"assets/templates/#{file}.html.haml.erb\", \"app/assets/templates/#{class_name.tableize}/#{file}.html.haml\"\n end\n end",
"def add_template_pages; end",
"def install\n template 'Guardfile'\n end",
"def template_source\n raise NotImplementedError\n end",
"def makefile\n my_binding = MakefileBinding.new(self).get_binding\n ERB.new(project_type.makefile_template).result(my_binding)\n end",
"def generate\n <<-MODULE_MAP.strip_heredoc\n framework module #{target.product_module_name} {\n umbrella header \"#{target.umbrella_header_path.basename}\"\n\n export *\n module * { export * }\n }\n MODULE_MAP\n end",
"def template_path\n return File.join(File.dirname(__FILE__), \"../../../templates\", platform)\n end",
"def setup_template_details\n template_extension = @template_path.scan(/\\.(\\w+)\\.?(.*)?/)[0][0]\n get_extension_and_name_from_file(@template_path).merge(\n template_extension: template_extension\n )\n end",
"def copy_template_files\n output \"This installs sass variable files you can modify to customize the appearance of your Bootstrap installation.\", :magenta\n template \"stylesheets/colors.css.scss\", \"app/assets/stylesheets/customizable_bootstrap/colors.css.scss\"\n template \"stylesheets/font.css.scss\", \"app/assets/stylesheets/customizable_bootstrap/font.css.scss\"\n template \"stylesheets/spacing.css.scss\", \"app/assets/stylesheets/customizable_bootstrap/spacing.css.scss\"\n template \"stylesheets/index.css.scss\", \"app/assets/stylesheets/customizable_bootstrap/index.css.scss\"\n template \"stylesheets/overrides.css.scss\", \"app/assets/stylesheets/customizable_bootstrap/overrides.css.scss\"\n template \"javascripts/index.js\", \"app/assets/javascripts/customizable_bootstrap/index.js\"\n end"
] |
[
"0.70179504",
"0.67612237",
"0.67544407",
"0.6639642",
"0.65970767",
"0.6446824",
"0.64013726",
"0.6371176",
"0.6362017",
"0.63538295",
"0.63208544",
"0.63165605",
"0.62692034",
"0.6253167",
"0.62327856",
"0.62133837",
"0.6210422",
"0.62089837",
"0.62018234",
"0.62018234",
"0.62018234",
"0.62018234",
"0.62018234",
"0.62018234",
"0.62018234",
"0.61821383",
"0.61821383",
"0.61446446",
"0.61423296",
"0.612856",
"0.61205167",
"0.61129725",
"0.6086459",
"0.6084228",
"0.60770667",
"0.6060041",
"0.603674",
"0.60296136",
"0.60269004",
"0.60138154",
"0.599649",
"0.5994103",
"0.59841585",
"0.59765863",
"0.5945413",
"0.59287137",
"0.5921792",
"0.5900992",
"0.5898139",
"0.5897772",
"0.5897772",
"0.5897772",
"0.5897772",
"0.5897772",
"0.5897772",
"0.5895283",
"0.5895258",
"0.58940876",
"0.5891639",
"0.58876437",
"0.58792424",
"0.5861396",
"0.5858924",
"0.5858245",
"0.5857623",
"0.58575577",
"0.58575577",
"0.58570755",
"0.5846478",
"0.5844098",
"0.5841131",
"0.5832507",
"0.58312774",
"0.58291036",
"0.5826214",
"0.5808538",
"0.58027077",
"0.57903045",
"0.5780999",
"0.57779646",
"0.57716054",
"0.5771465",
"0.5770448",
"0.57580745",
"0.57473093",
"0.574158",
"0.5731354",
"0.5727875",
"0.57235837",
"0.57202244",
"0.5715634",
"0.5714205",
"0.5711481",
"0.5702722",
"0.5702241",
"0.569442",
"0.56921065",
"0.56891453",
"0.5687994",
"0.56845975",
"0.5680587"
] |
0.0
|
-1
|
Determine which gem will be used for the projects CSS framework
|
def template_engine_gem_str(css_framework = '')
case css_framework.to_s
when 'semantic'
'semantic_ui'
else
'bootstrap'
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def gems_for_testing_framework(testing_framework)\n testing_framework == :rspec ? '' : %Q{gem \"#{testing_framework}\", :group => :test} \n end",
"def stylesheet\n @stylesheet ||= Dir.glob(root+'/**/parts.*css').first\n end",
"def target_frameworks\n if netcore?\n tfw = @proj_xml_node.css('Project PropertyGroup TargetFramework').inner_text\n tfws = @proj_xml_node.css('Project PropertyGroup TargetFrameworks').inner_text\n nfws = if tfw.nil? || tfw == '' then tfws else tfw end\n fws = nfws.split(';')\n else\n [ target_framework ]\n end\n end",
"def gems; end",
"def gems; end",
"def gems; end",
"def require_theme_deps; end",
"def gem_and_require_rails\n gem_rails\n require_rails\n display_rails_gem_used\n end",
"def find_project_type_by_gemfile_location\n # If tagging an application or Gem that uses Rails\n if defined? Rails\n if File.file?(File.expand_path(Rails.root.join \"Gemfile\"))\n puts \"-- determined that project type is a Rails application --\"\n return :rails_application\n end\n if File.file?(File.expand_path(Rails.root.join \"../../Gemfile\"))\n puts \"-- determined that project type is a Rails Gem --\"\n return :rails_gem\n end\n else\n if File.file?(File.join(File.dirname(File.expand_path(__FILE__)),\n \"../../Gemfile\"))\n puts \"-- determined that project type is a Gem without Rails --\"\n return :non_rails_gem\n end\n end\n puts \"FATAL: unable to determine project type based on Gemfile location!\"\n abort(\"aborting tagging process\")\n end",
"def gems_for_testing_framework(testing_framework)\n %Q{gem \"#{testing_framework}\", :group => :test}\n end",
"def rails_extension\n case format\n when 'css'\n 'css.erb'\n when 'scss'\n 'scss'\n end\n end",
"def gemfile; end",
"def gemfile; end",
"def gemfile; end",
"def gemfile; end",
"def gemfile; end",
"def gemfile; end",
"def build_framework?; build.include? 'framework'; end",
"def using_gem(klass)\n case klass\n when \"Api::AwsSes\"\n \"aws-sdk-ses\"\n when \"Api::SparkPost::Transmissions\"\n \"simple_spark\"\n else\n \"unknown\"\n end\n end",
"def display_rails_gem_used\n puts %[#{MultiRails::BAR}\\nUsing rails gem: #{Config.rails_load_path}\\n]\n end",
"def dev_gems\n\n # Dev mode has to explicitly include every needed gem dependency in the project in order to\n # be properly (i.e. recursively) loaded from source by Bundler\n gem 'task_runner', :path => 'gems/task_runner'\n gem 'tef-worker', :path => 'gems/tef-worker'\n gem 'tef-core', :path => 'gems/tef-core'\n gem 'res_man', git: 'https://github.com/grange-insurance/res_man.git', branch: 'master'\n gem 'tef-manager', :path => 'gems/tef-manager'\n gem 'tef-keeper', :path => 'gems/tef-keeper'\n gem 'tef', :path => '.'\n gem 'tef-development', :path => 'gems/tef-development'\nend",
"def get_framework_cartridge\n web_cart = nil\n self.requires.each do |feature|\n cart = CartridgeCache.find_cartridge(feature, self)\n next unless cart.categories.include? \"web_framework\"\n web_cart = cart\n break\n end\n web_cart\n end",
"def project_type\n toplevel = `git rev-parse --show-toplevel`.strip\n gemfile = File.join(toplevel, 'Gemfile')\n return 'ruby' if File.exist?(gemfile)\n package_json = File.join(toplevel, 'package.json')\n return 'node' if File.exist?(package_json)\n return nil\nend",
"def active_scaffold_ie_stylesheets(frontend = :default)\r\n ActiveScaffold::Config::Core.asset_path(\"stylesheet-ie.css\", frontend)\r\n end",
"def gemspec?; end",
"def css_path; end",
"def css_path; end",
"def platform\n @new_platform ||= Gem::Platform::RUBY\n end",
"def framework\n\t\treturn self.class.framework\n\tend",
"def platform\n (RUBY_PLATFORM == \"java\") ? 'java' : Gem::Platform::RUBY\n end",
"def platform_gemspec\n gemspecs.fetch(platform) { This.ruby_gemspec }\n end",
"def gemspecs; end",
"def gems_for_template_engine(template_engine)\n gems = ''\n if template_engine != :erb\n if template_engine.in?(:haml, :builder)\n template_engine_plugin = \"merb-#{template_engine}\"\n else\n template_engine_plugin = \"merb_#{template_engine}\"\n end\n gems = %Q{gem \"#{template_engine_plugin}\"}\n end\n gems\n end",
"def framework\n return :rails if defined?(Rails)\n return :padrino if defined?(Padrino)\n return :sinatra if defined?(Sinatra)\n return :nanoc if defined?(Nanoc3)\n fail 'simple_navigation currently only works for Rails, Sinatra and ' \\\n 'Padrino apps'\n end",
"def name\n @name ||= if !OS.windows? && ruby?\n MRI\n elsif ruby? && engine? && engine == 'rbx'\n Rubinius\n elsif ruby? && engine? && engine == 'maglev'\n MagLev\n elsif engine? && engine == 'jruby'\n JRuby\n end\n end",
"def framework\n @framework\n end",
"def syntax\n :sass\n end",
"def theme_css(name)\n \"themes/#{name}/style\"\n end",
"def platform_gems\n array = package_config[:gemfile]\n return [] if array.blank?\n path = vendor? ? \"./#{vendor_path}/vendor\" : source_vendor_path\n new_erb.erb_array(array, vendor_path: path)\n end",
"def friendly_path\n case type\n when :gem then\n parent = File.expand_path '..', @path\n \"gem #{File.basename parent}\"\n when :home then RDoc.home\n when :site then 'ruby site'\n when :system then 'ruby core'\n else @path\n end\n end",
"def style_sheet\n browser_arr = ['Firefox','Chrome','Safari','Explorer','Opera']\n css = \"Firefox.css\"\n browser_arr.each do |brow|\n if((request.user_agent.match(/#{brow}/i)))\n css = brow + \".css\"\n break\n elsif((request.user_agent.match(/MSIE/i)))\n css = 'Explorer' + \".css\"\n end\n end\n return stylesheet_link_tag(css)\n end",
"def detect_os\n os = RUBY_PLATFORM.split('-')\n @class_name = if os.size == 2\n if os[1] == 'mingw32'\n 1\n else\n 0\n end\n else\n 0\n end\n end",
"def platform_name; non_framework_platforms.first; end",
"def gems_for_template_engine(template_engine)\n gems = ''\n if template_engine != :erb\n if [:haml, :builder].include? template_engine\n template_engine_plugin = \"merb-#{template_engine}\"\n else\n template_engine_plugin = \"merb_#{template_engine}\"\n end\n gems = %Q{gem \"#{template_engine_plugin}\"}\n end\n gems\n end",
"def active_scaffold_stylesheets(frontend = :default)\r\n ActiveScaffold::Config::Core.asset_path(\"stylesheet.css\", frontend)\r\n end",
"def determine_style(m)\n begin\n case m[:source].to_s\n when m.start_with?('Carnivore::Source::Http')\n :http\n else\n m[:source].class.to_s.split('::').last.downcase.to_sym\n end\n rescue\n :unknown\n end\n end",
"def framework_package_name\n if lumen?\n \"laravel/lumen-framework\"\n else\n \"laravel/framework\"\n end\n end",
"def gem_name\n @gem_name ||= \"sprout-#{clean_name}-library\"\n end",
"def libs; end",
"def syntax\n :scss\n end",
"def gem_name\n @specification.name\n end",
"def version_specified_gem?(node); end",
"def conscientious_require\n require_theme_deps if site.theme\n require_plugin_files\n require_gems\n deprecation_checks\n end",
"def template_linter_gems(engine)\n return '' if engine.blank?\n\n case engine.to_s\n when 'haml'\n \"gem 'haml_lint'#{gemfile_requirement('haml_lint')}, require: false\"\n when 'slim'\n \"gem 'slim_lint'#{gemfile_requirement('slim_lint')}, require: false\"\n else\n \"gem 'erb_lint', github: 'Shopify/erb-lint', require: false\"\n end\n end",
"def framework_name; registered_framework_name; end",
"def get_commandline_tool\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n @command_line_tool = \"ccollab.exe\"\n when /linux/\n @command_line_tool = \"ccollab\" \n when /darwin|mac os/\n @command_line_tool = \"ccollab\"\n end\n end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gem_name\n @gem_name ||= @source_path.sub_ext(\"\").basename.to_s\n end",
"def require_gems; end",
"def lib name\n name = name.to_sym\n type = $VHOST.libraries[name][:type]\n libhome = $VHOST.liburi\n if type == :js\n echo \"<script type='text/javascript' src='/#{libhome}/#{name}'></script>\"\n elsif type == :css\n echo \"<link rel='stylesheet' href='/#{libhome}/#{name}'></link>\"\n end\n end",
"def gemspec_helper; end",
"def gemspec_helper; end",
"def gemspec_helper; end",
"def gemspec_helper; end",
"def gemspec_helper; end",
"def gemspec_helper; end",
"def css_font(theme)\n\t\tcase theme\n\t\t\twhen \"snowpurple\"\n\t\t\t\treturn \"http://fonts.googleapis.com/css?family=Lato:300,400,700,900\"\n\t\t\twhen \"citrus\"\n\t\t\t\treturn \"http://fonts.googleapis.com/css?family=Permanent+Marker\"\n\t\t\twhen \"darkness\"\n\t\t\t\treturn \"http://fonts.googleapis.com/css?family=Old+Standard+TT\"\n\t\tend\n\tend",
"def sass_file?; end",
"def sass_file?; end",
"def feature_spec_stylesheet_file(interface:)\n \"nfg_ui/network_for_good/#{interface}/application\"\n end",
"def current_framework\n @current_framework ||= self.default_framework\n return @current_framework\n end",
"def set_browser_os()\r\n browsers = Array['chrome']\r\n $os = 'Mac'\r\n if (RUBY_PLATFORM =~ /w32/) # windows\r\n $os = 'Windows'\r\n browsers = Array['chrome']\r\n elsif (RUBY_PLATFORM =~ /darwin/) # mac\r\n $os = 'Mac'\r\n browsers = Array['chrome','safari']\r\n end\r\nend",
"def add_gem_component_stylesheet(gem_component)\n add_stylesheet_path(\"govuk_publishing_components/components/_#{gem_component}.css\")\n end",
"def gem_path?(file); end",
"def gemspec(platform = 'ruby')\n Gem::Specification.load(File.expand_path('../../redcloth.gemspec', __FILE__))\nend",
"def file_path\n 'main.css'\n end",
"def css\n project_file_read(\"all.css\")\nend",
"def ruby_platform\n case RUBY_PLATFORM\n when /win32|mswin|mingw/\n # Works on Windows XP, 2003, 7, 8 running Ruby 1.8.6 & 1.8.7, 1.9.2, 1.9.3 & 2.0.0 installed from RubyInstaller\n # Can't match for just 'win' cause it will match darwin as well.\n 'windows'\n when /linux/\n # Works on Debian Sarge, Lenny & Wheezy and Ubuntu 9.10 running REE 1.8.7 & MRI 2.0.0 32-bit & 64-bit, don't have anything else to test on.\n 'linux'\n when /darwin/\n # Works on my MacBook Pro OS 10.6 running Ruby 1.8.7 and .rbenv version of 1.9.3 & 2.0.0 , don't have anything else to test on,\n 'mac'\n else\n nil\n end\nend",
"def runtime_specific_gems\n []\n end",
"def add_gems\n gem 'data-confirm-modal', '~> 1.6.2'\n gem 'devise', '~> 4.4.3'\n gem 'devise-bootstrapped', github: 'excid3/devise-bootstrapped', branch: 'bootstrap4'\n gem 'devise_masquerade', '~> 0.6.0'\n gem 'font-awesome-sass', '~> 4.7'\n gem 'gravatar_image_tag', github: 'mdeering/gravatar_image_tag'\n gem 'jquery-rails', '~> 4.3.1'\n gem 'bootstrap', '~> 4.0.0.beta'\n gem 'webpacker', '~> 3.0'\n gem 'foreman', '~> 0.84.0'\n gem_group :development, :test do\n gem 'rspec-rails', '~> 3.6.0'\n gem \"factory_bot_rails\", \"~> 4.10.0\"\n gem 'spring-commands-rspec'\n end\n\n gem_group :test do\n gem 'shoulda-matchers', '~> 3.1'\n end\nend",
"def stylesheets_from_plugins\n Dir.glob(\"vendor/plugins/*/assets/stylesheets/*.css\").select{|s| !s.include? \"vendor/plugins/alchemy\"}.inject(\"\") do |acc, s|\n filename = File.basename(s)\n plugin = s.split(\"/\")[2]\n acc << stylesheet_link_tag(filename, :plugin => plugin)\n end\n end",
"def win_or_mac\r\n os = RUBY_PLATFORM\r\n if os.include? 'darwin'\r\n puts \"+ <lib><webdriver_helper> OS: Mac OSX\"\r\n return 'mac'\r\n elsif os.include? 'mingw32'\r\n puts \"+ <lib><webdriver_helper> OS: Windows\"\r\n return 'win'\r\n else\r\n puts \"+ <lib><webdriver_helper> Sorry, we do not support your Operating-System right now\"\r\n end\r\n end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def name\n RUBY_PLATFORM\n end",
"def stylesheet\n @stylesheet.nil? ? 'gimli.css' : @stylesheet\n end",
"def require( gem_name_or_path ) \n \n did_load = ::Development.require( gem_name_or_path )\n\n if did_load.nil?\n did_load = super\n end\n\n if gem_name_or_path == 'bundler'\n ::Development::Require::BundlerSupport.call\n end\n \n return did_load\n \n end",
"def framework_name\n self.name.split(\"::\").last.downcase\n end",
"def framework_name\n self.name.split(\"::\").last.downcase\n end"
] |
[
"0.5801476",
"0.5783976",
"0.5718329",
"0.56976354",
"0.56976354",
"0.56976354",
"0.56912494",
"0.5659007",
"0.56516767",
"0.5620703",
"0.5543281",
"0.55301464",
"0.55301464",
"0.55301464",
"0.55301464",
"0.55301464",
"0.55301464",
"0.55103683",
"0.54837906",
"0.5422308",
"0.54037535",
"0.5395174",
"0.53947383",
"0.5387212",
"0.53810734",
"0.5360917",
"0.5360917",
"0.535694",
"0.5351151",
"0.5317159",
"0.53112847",
"0.52882946",
"0.5284437",
"0.52806824",
"0.5278559",
"0.5265772",
"0.52624846",
"0.5244114",
"0.5234232",
"0.52303135",
"0.5218873",
"0.5215111",
"0.52143455",
"0.52095884",
"0.52052",
"0.5198664",
"0.51934206",
"0.5171266",
"0.51697683",
"0.5152375",
"0.5150871",
"0.5145446",
"0.51350975",
"0.51349247",
"0.51284975",
"0.5125766",
"0.5121064",
"0.5121064",
"0.5121064",
"0.5121064",
"0.5121064",
"0.5121064",
"0.5121064",
"0.5121064",
"0.51174587",
"0.5113958",
"0.5083112",
"0.5080708",
"0.5080708",
"0.5080708",
"0.5080708",
"0.5080708",
"0.5080708",
"0.50762755",
"0.5071573",
"0.5071573",
"0.50702167",
"0.5067162",
"0.5065726",
"0.50611705",
"0.50600827",
"0.5053782",
"0.5051723",
"0.5046853",
"0.50466037",
"0.5044556",
"0.5033832",
"0.50254244",
"0.50204086",
"0.5013646",
"0.5013646",
"0.5013646",
"0.5013646",
"0.5013646",
"0.5013646",
"0.5012516",
"0.5008297",
"0.5005856",
"0.5001642",
"0.5001642"
] |
0.74732846
|
0
|
Add a gem to the Gemfile
|
def gem_to_gemfile(gem)
gem_str = <<~GEM
#{gem.comment ? "# #{gem.comment}" : ''}
#{(gem.commented_out ? '#' : '')}gem '#{gem.name}'#{gem_version_str(gem)}#{gem_options(gem)}
GEM
gem_str.strip
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def gem(name, requirement = nil)\n gems << Gem.new(name, requirement)\n end",
"def add_gemfile\n copy_file 'static/dry/Gemfile.default', \"#{name}/Gemfile\"\n say 'Add Gemfile', :green\n end",
"def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end",
"def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end",
"def gem(name, args = {})\n add_command(:gem, name, args)\n end",
"def add_gem(gem_name, gem_options={}, generator_command=nil, &block)\n message = \"Installed\"\n gem gem_name, gem_options\n\n run_install\n\n if generator_command || block_given?\n message += ' and configured.'\n end\n\n if generator_command\n message += \"\\n\\n- #{generator_command}\"\n generate generator_command\n end\n\n yield if block_given?\n\n git add: \".\"\n git commit: %Q{ -m \"#{gem_name}: #{message}\" }\n end",
"def add_gems\n Bundler.with_clean_env do\n run 'bundle install'\n end\n end",
"def add(gemspec)\n @specs << gemspec\n end",
"def add_hardcoded_gem(path)\n # make sure gem dir has a gemspec\n gemspec = File.join path, File.basename(path) + '.gemspec'\n return unless File.exists? gemspec\n # make sure gem dir has a lib dir\n libpath = File.join path, 'lib'\n return unless File.exists? libpath\n # all is ok, so add to loadpath\n @paths << libpath\n end",
"def add_spec(gem_spec)\n @gems[gem_spec.full_name] = gem_spec\n end",
"def gem( name, *requirements, **options )\n\t\tif options[:group] == :development ||\n\t\t\toptions[:groups]&.include?( :development ) ||\n\t\t\tself.current_groups.include?( :development )\n\n\t\t\trequirements.push( :development )\n\t\tend\n\n\t\tdependency = Gem::Dependency.new( name, *requirements )\n\n\t\tself.dependencies.add( dependency )\n\tend",
"def gem(name, version = Gem::Requirement.default)\n @gems ||= {}\n @gems[name] = version\n end",
"def add_gem(gem)\n @gems << gem\n @gems = @gems.uniq\n true\n end",
"def add_gem_paths; end",
"def install_gem; end",
"def require!\n super do\n gem @gem_name, @version if @version\n end\n end",
"def gem(name, *reqs)\n if dep = @dependency_names[name]\n dep.requirement.concat reqs\n else\n dep = Gem::Dependency.new name, *reqs\n @dependency_names[name] = dep\n @dependencies << dep\n end\n end",
"def install_gem\n Juwelier::Commands::InstallGem.build_for(self).run\n end",
"def append_to_gem_group(gem_group_definition, new_line)\n append_to_block_in_file \"Gemfile\", new_line, gem_group_definition, \"end\"\nend",
"def install_gem(gemname)\n if !Gem::Specification::find_all_by_name(gemname).any?\n gemfile(true) do\n source 'https://rubygems.org'\n gem gemname\n end\n end\n require gemname\nend",
"def gem(name, *requirements)\n self.class.gems.activate(name, *requirements)\n end",
"def merge_gem(gem_name, version=nil)\n gem_info = {:name=>gem_name}\n if version.is_a?(Hash)\n gem_info.merge!(version)\n else\n gem_info[:version] = version\n end\n @merged_gems << gem_info\n require gem_info[:require] || gem_name\n end",
"def install_gem(gem_name, options = {})\n if options[:group]\n gem gem_name, group: options[:group]\n else\n gem gem_name\n end\n run_command \"gem install #{gem_name}\"\n run_command 'bundle install --local'\nend",
"def gemfile; end",
"def gemfile; end",
"def gemfile; end",
"def gemfile; end",
"def gemfile; end",
"def gemfile; end",
"def require_gem gem, name = nil\n name = gem if name.nil?\n if !BBLib.gem_installed? name\n return false unless Gem.install gem\n end\n require name\n end",
"def add_spec(gem_spec, name = T.unsafe(nil)); end",
"def add_vendor_gem(name, directory) # :nodoc:\n gemspec = File.join directory, \"#{name}.gemspec\"\n\n spec = Gem::Specification.load gemspec\n\n raise Gem::GemNotFoundException,\n \"unable to find #{gemspec} for gem #{name}\" unless spec\n\n spec.full_gem_path = File.expand_path directory\n\n @specs[spec.name] = spec\n @directories[spec] = directory\n\n spec\n end",
"def add\n configure_addon('Adding') do |addon, config|\n heroku.install_addon(app, addon, config)\n end\n end",
"def add\n configure_addon('Adding') do |addon, config|\n heroku.install_addon(app, addon, config)\n end\n end",
"def require_gem(gem)\n dep = fetch(:required_gems)\n dep ||= []\n if gem.respond_to?(:each)\n dep += gem\n else\n dep << gem\n end\n set(:required_gems, dep)\n end",
"def install_gem(gem)\n Gem.manage_gems\n installer = Gem::Installer.new(gem)\n format = Gem::Format.from_file_by_path(gem)\n dir = File.join(RAILS_ROOT, 'vendor', 'gems',\n format.spec.extensions.empty? ? 'ruby' : canonical_arch)\n FileUtils.mkdir_p(dir)\n installer.install(false, dir)\n end",
"def add_package(package)\n return if @git_resolver.package?(package) && @cache.key?(package)\n\n @git_resolver\n .repository(package)\n .tags\n .map(&:name)\n .each do |version|\n @cache.ensure_version(package, version)\n add_version(package, version)\n end\n end",
"def register_dependency(dep, version)\n GemDependency.create!(\n laser_gem: self,\n dependency: dep,\n version: version,\n )\n self.reload\n end",
"def add_gems\n gem 'sorbet-rails', path: '../../../.'\n\n sorbet_version = ENV[\"SORBET_VERSION\"]\n if sorbet_version\n # mostly used to test against a stable version of Sorbet in Travis.\n gem 'sorbet', sorbet_version\n gem 'sorbet-runtime', sorbet_version\n else\n # prefer to test against latest version because sorbet is updated frequently\n gem 'sorbet'\n gem 'sorbet-runtime'\n end\nend",
"def add_gem_facts\n unless @path.directory?\n @result.is_gem = false\n return\n end\n \n path = gemspec_path\n \n if path.nil?\n @result.is_gem = false\n return\n end\n \n @result.is_gem = true\n @result.package.types << 'gem'\n \n gem = @result.gem = Result.new\n \n gem.gemspec_path = gemspec_path.to_s\n \n spec = Gem::Specification::load(gemspec_path.to_s)\n gem.name = spec.name\n gem.version = QB::Package::Version.from_gem_version spec.version\n end",
"def inject_gem(name, version = nil)\n gemfile = facts['app_code'] + '/Gemfile'\n if File.exists?(gemfile)\n return if File.read(gemfile)[/^gem ('|\")#{name}('|\")/]\n File.open(gemfile, \"a\") do |f|\n f.puts ''\n if version\n f.puts \"gem '#{name}', '#{version}' # injected by platform\"\n else\n f.puts \"gem '#{name}' # injected by platform\"\n end\n end\n else\n @injected_gems ||= []\n @injected_gems << [name, version]\n end\n end",
"def depends_on(package, *version)\n dependencies << [ package, *version ]\n end",
"def install(gem)\n version = gem['version'] == '> 0' ? '' : \"#{gem['version']} \"\n Utils.message \"\\n\"\n if preinstalled?(gem)\n Utils.message \"-----> Skipping #{gem['name']} #{version} - this gem is installed by default on Heroku\\n\"\n else\n proxy = Utils.slot =~ /codex/ ? \"--http-proxy http://localhost:3128\" : \"\"\n command = [\n \"export PATH=#{@slug.ruby_path};\",\n \"export GEM_HOME=#{@slug.gems_build_dir};\",\n \"gem install\",\n escape(gem['name']),\n proxy,\n \"--no-ri\",\n \"--no-rdoc\",\n \"--version=#{escape(gem['version'])}\",\n gem['source'].map {|s| \"-s #{escape(s)}\"}.join(\" \"),\n (\"--ignore-dependencies\" if gem[\"ignore-dependencies\"])\n ].compact.join(\" \")\n Utils.message \"-----> Installing gem #{gem['name']} #{version}from #{gem['source'].join(\", \")}#{\" and ignoring dependencies\" if gem['ignore-dependencies']}\\n\"\n exec_gem_install_command(command)\n end\n end",
"def setup_gem(name, options)\n version = [options[:version]].compact\n lib_name = options[:lib] || name\n\n log \"activating #{name}\"\n\n Gem.activate(name, *version)\n require(lib_name)\n\n rescue LoadError\n\n install_gem(name, options)\n Gem.activate(name, *version)\n require(lib_name)\n end",
"def add_version(package, version)\n @git_resolver\n .repository(package)\n .checkout(version)\n\n add_package_dependencies(package, version)\n end",
"def add(pkg)\n packages_by_name[pkg.name] = pkg\n end",
"def gem(*args)\n options = args.extract_options!\n name, version = args\n\n # Set the message to be shown in logs. Uses the git repo if one is given,\n # otherwise use name (version).\n parts, message = [ name.inspect ], name\n if version ||= options.delete(:version)\n parts << version.inspect\n message << \" (#{version})\"\n end\n message = options[:git] if options[:git]\n\n log :gemfile, message\n\n parts_without_group = parts.clone\n options.each do |option, value|\n str = \"#{option}: #{value.inspect}\"\n parts << str\n parts_without_group << str unless option == :group\n end\n\n in_root do\n if options.key?(:group)\n # remove brackets if any and prepend colon if missing\n group = options[:group].inspect.scan(/[[^\\[\\]]]/).join.to_sym\n\n group_definition = \"group #{group} do\"\n str = \"gem #{parts_without_group.join(\", \")}\"\n return if append_to_gem_group(group_definition, str.gsub(/\\\"/, '\\''))\n end\n\n str = \"gem #{parts.join(\", \")}\"\n str = \" \" + str if @in_group\n str = \"\\n\" + str\n append_file \"Gemfile\", str.gsub(/\\\"/, '\\'')\n end\nend",
"def util_bake_gem(name = \"a\", *extra, &block)\n files = [\"lib/#{name}.rb\"].concat(extra)\n\n spec = new_spec name, \"1\", nil, files, &block\n\n File.join @tempdir, \"gems\", \"#{spec.full_name}.gem\"\n end",
"def add_ddtrace_to_gemfile(path)\n File.write(path, <<-GEMFILE, mode: 'a+')\n gem 'ddtrace', path: '#{Pathname.new(DDTRACE_PATH).relative_path_from(Dir.pwd).to_s}'\n GEMFILE\n end",
"def add_development_dependency(gem, *requirements)\n add_dependency_with_type(gem, :development, requirements)\n end",
"def add_specs(*gem_specs); end",
"def add(dependency)\n @dependencies[cookbook_name(dependency)] = dependency\n end",
"def git_add\n `git add package.json npm-shrinkwrap.json`\n end",
"def add(*gemspecs)\n @specs.push(*gemspecs)\n end",
"def gem name, *requirements\n options = Hash === requirements.last ? requirements.pop : {}\n\n requirement = requirements.empty? ?\n Gem::Requirement.default :\n Gem::Requirement.new(requirements)\n\n entry = Entry.new name, requirement, @environments.dup, options\n\n @entries << entry\n entry\n end",
"def add_gem_with_query(gem_name, gem_options={}, generator_command=nil, &block)\n if yes?(\"Would you like to install #{gem_name}? (y/n)\")\n add_gem(gem_name, gem_options, generator_command, &block)\n end\n end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def gemspec; end",
"def dependency(dep, ver = nil)\n @dep_loader.add_dependency dep, ver\n end",
"def gemfile_creation\n\tsystem('touch Gemfile')\n\tfile = File.open('Gemfile', 'w')\n\tfile.puts(\"source 'https://rubygems.org'\")\n\tfile.puts(\"ruby '2.5.1'\")\n\tfile.puts(\"gem 'rspec'\")\n\tfile.puts(\"gem 'dotenv'\")\n\tfile.puts(\"gem 'pry'\")\n\tfile.puts(\"gem 'rubocop', '~> 0.57.2'\")\n\tfile.close\n\tsystem('bundle install')\nend",
"def require_gems; end",
"def create_initialize_gemfile()\n file=File.open(\"Gemfile\", \"w\")\n file.puts('source \"https://rubygems.org\"')\n file.puts(\"ruby '2.7.1'\")\n file.puts(\"\")\n file.puts(\"#### Basics Gem ####\")\n file.puts(\"gem 'pry'\")\n file.puts(\"gem 'rubocop'\")\n file.puts(\"gem 'rspec'\")\n file.puts(\"gem 'dotenv'\")\n file.close\n system(\"bundle install\")\n create_app()\nend",
"def setup_gem(name, options)\n version = [options[:version]].compact\n lib_name = options[:lib] || name\n\n log \"activating #{name}\"\n\n Gem.activate(name, *version)\n rescue Gem::LoadError\n log \"activating #{name} failed, try to install\"\n\n install_gem(name, version, options)\n end",
"def custom_gem(name, options = Hash.new)\n local_path = File.expand_path \"../vendor/#{name}\", __FILE__\n\n if File.exist? local_path\n options = options.merge :path => local_path\n options.delete_if do |key, _|\n [:github, :branch].include? key\n end\n end\n\n gem name, options\nend",
"def install_gem(name, opts = {})\n defaults = {}\n defaults[:cache] = false unless gem_dir\n defaults[:install_dir] = gem_dir if gem_dir\n Merb.install_gem(name, defaults.merge(opts))\n end",
"def gem(*args)\n options = args.extract_options!\n name, *versions = args\n\n # Set the message to be shown in logs. Uses the git repo if one is given,\n # otherwise use name (version).\n parts, message = [ quote(name) ], name.dup\n\n if versions = versions.any? ? versions : options.delete(:version)\n _versions = Array(versions)\n _versions.each do |version|\n parts << quote(version)\n end\n message << \" (#{_versions.join(\", \")})\"\n end\n message = options[:git] if options[:git]\n\n log :gemfile, message\n\n parts << quote(options) unless options.empty?\n\n in_root do\n str = \"gem #{parts.join(\", \")}\"\n str = indentation + str\n str = \"\\n\" + str\n append_file \"Gemfile\", str, verbose: false\n end\n end",
"def util_bake_gem(name = \"a\", *extra, &block)\n files = [\"lib/#{name}.rb\"].concat(extra)\n\n spec = if Gem::VERSION >= \"3.0.0\"\n util_spec name, \"1\", nil, files, &block\n else\n new_spec name, \"1\", nil, files, &block\n end\n\n util_build_gem spec\n\n spec.cache_file\n end",
"def add_package(package)\n [package_handler(File.extname(package).tr(\".\", \"\")).add(content, package)].flatten.compact\n end",
"def add_artifact(artifact)\n unless has_artifact?(artifact)\n @dep_graph.package(artifact.name).add_version(DepSelector::Version.new(artifact.version.to_s))\n @artifacts[artifact.to_s] = artifact\n end\n\n artifact\n end",
"def add_runtime_dependency(gem, *requirements)\n if requirements.uniq.size != requirements.size\n warn \"WARNING: duplicated #{gem} dependency #{requirements}\"\n end\n\n add_dependency_with_type(gem, :runtime, requirements)\n end",
"def add_or_update_gemfile(update_gemfile_if_needed: false)\n if gemfile_exists?\n ensure_gemfile_valid!(update_gemfile_if_needed: update_gemfile_if_needed)\n else\n if update_gemfile_if_needed || UI.confirm(\"It is recommended to run fastlane with a Gemfile set up, do you want fastlane to create one for you?\")\n setup_gemfile!\n end\n end\n return gemfile_path\n end",
"def gemspec?; end",
"def build_gem; end",
"def gem(options=\"\")\n cmd = \"#{Gem.ruby} #{@ruby_options} #{@gem_path} #{options}\"\n system cmd\n end",
"def install\n install_gems(dependencies)\n end",
"def gem(name, version, options = {})\n # Set the message to be shown in logs. Uses the git repo if one is given,\n # otherwise use name (version).\n parts, message = [quote(name)], name\n if version ||= options.delete(:version)\n parts << quote(version)\n message << \" (#{version})\"\n end\n message = options[:git] if options[:git]\n\n log :gemfile, message\n\n options.each do |option, value|\n parts << \"#{option}: #{quote(value)}\"\n end\n\n in_root do\n str = \"gem #{parts.join(', ')}\"\n str = ' ' + str if @in_group\n str = \"\\n\" + str\n append_file 'Gemfile', str, verbose: false\n end\n end",
"def install(path)\n gem 'install', '-q', path\n end",
"def gem(name, options = {})\r\n log 'gem', name\r\n env = options.delete(:env)\r\n\r\n gems_code = \"config.gem '#{name}'\"\r\n\r\n if options.any?\r\n opts = options.inject([]) {|result, h| result << [\":#{h[0]} => #{h[1].inspect.gsub('\"',\"'\")}\"] }.sort.join(\", \")\r\n gems_code << \", #{opts}\"\r\n end\r\n\r\n environment gems_code, :env => env\r\n end",
"def gem name, *requirements\n entry = entries.find { |e| e.name == name }\n return entry.update(*requirements) if entry\n\n entries << entry = Entry.new(self, name, *requirements)\n entry\n end",
"def private_gem(name)\n gem name, '0.3.0', git: \"https://#{ENV['GITHUB_TOKEN']}:x-oauth-basic@github.com/mharris717/#{name}.git\", branch: :master\nend",
"def activate_gem(gem_name, library_name = nil)\n if !defined?(::Gem)\n begin\n require 'rubygems'\n rescue LoadError\n end\n end\n if Kernel.respond_to?(:gem, true)\n begin\n gem(gem_name)\n rescue Gem::LoadError\n end\n end\n require(library_name || gem_name)\n end",
"def install\n bin.install \"src/tagit\"\n bin.install \"src/bumpit\"\n end",
"def set_gem_version_and_file line, file, line_num\n if line =~ @gem_name_version\n @tracker.config.add_gem $1, $2, file, line_num\n end\n end",
"def plugin_gem(name, options = {})\n lib, version = options.values_at(:lib, :version)\n begin\n Kernel.send :gem, name, version\n rescue Gem::LoadError\n dir = File.dirname(caller.first.split(':').first)\n $: << File.expand_path(\"#{dir}/../vendor/gems/#{name}-#{version.gsub(/[^\\d\\.]*/, '')}/lib\")\n end\n require(lib || name)\n end",
"def add_package(pkg = '')\n return false if pkg.blank?\n\n system(\"bin/yarn add #{pkg}\")\n end",
"def add_package(package)\n unless package\n raise ArgumentError,\n 'package must be specified'\n end\n unless package.is_a?(::Composer::Package::Package)\n raise TypeError,\n 'package must be a class or superclass of \\\n Composer::Package::Package'\n end\n\n initialize_repository unless @packages\n\n package.repository = self\n\n @packages << package\n\n if package.instance_of?(::Composer::Package::AliasPackage)\n aliased_package = package.alias_of\n if aliased_package.repository === nil\n add_package(aliased_package)\n end\n end\n end",
"def rubygem_push(path)\n puts(\">>> #{path}\")\n sh(\"gem inabox '#{path}'\")\n Bundler.ui.confirm \"Pushed #{name} #{version} to http://gems.idg.primedia.com/\"\n end",
"def add_gem_names\n add_gem_names_mutex = get_mutex 'add_gem_names'\n\n add_gem_names_mutex.synchronize do\n break unless @gem_name_queue.empty?\n\n get_gem_names.each do |name|\n @gem_name_queue.enq name\n end\n end\n end",
"def gem(gemname)\n if Gem.loaded_specs[gemname]\n require gemname.gsub(/-/, '/')\n path = \"#{Gem.loaded_specs[gemname].lib_dirs_glob.split(':')[0]}/\" \\\n \"#{gemname.gsub(/-/, '/')}/plugin.rb\"\n if File.exist? path\n pl = pluginr(path)\n raise ProtonBot::PluginError, \"`#{path}` did not return plugin!\" unless\n pl.instance_of? ProtonBot::Plugin\n @parr << pl\n else\n raise IOError, \"No such file or directory: #{path}\"\n end\n else\n raise ArgumentError, \"No such gem: #{gemname}\"\n end\n self\n end",
"def gem(*args)\n @gems << args unless args.empty?\n @gems\n end",
"def gem_install_command\n \"sudo gem install #{gem_name} -s http://gems.github.com\"\n end",
"def carrega_gem(nome, versao = nil)\n begin\n gem nome, versao\n rescue LoadError\n puts \"Instalando gem '#{nome}'...\"\n versao = \"-- version '#{versao}'\" unless versao.nil?\n system \"gem install #{nome} #{versao}\"\n Gem.clear_paths\n retry\n end\n\n require nome\nend",
"def add_view_language_gem\n return if view_language == \"erb\"\n add_gems %(gem \"#{view_language}\")\n end",
"def gem_version(version)\n Gem::Version.create(version)\n end",
"def install_gem(gem_built_name)\n execute(:install_gem, \"gem install #{gem_built_name}\")\n end"
] |
[
"0.7209957",
"0.7183405",
"0.67059696",
"0.67059696",
"0.65652823",
"0.65378886",
"0.65094405",
"0.6487968",
"0.6486245",
"0.6472643",
"0.6436112",
"0.6394159",
"0.6323169",
"0.6317796",
"0.63075083",
"0.6249739",
"0.6232772",
"0.6221473",
"0.62034845",
"0.62024826",
"0.61900616",
"0.61527747",
"0.6147708",
"0.6124507",
"0.6124507",
"0.6124507",
"0.6124507",
"0.6124507",
"0.6124507",
"0.6052657",
"0.6035596",
"0.60147333",
"0.5981598",
"0.5981598",
"0.5952366",
"0.594345",
"0.59307677",
"0.5922917",
"0.59228617",
"0.5917204",
"0.59081674",
"0.5888896",
"0.58618027",
"0.585825",
"0.585456",
"0.584287",
"0.5838745",
"0.58380485",
"0.5830299",
"0.5829277",
"0.58126456",
"0.5793192",
"0.5769324",
"0.576032",
"0.57431275",
"0.5727253",
"0.57246387",
"0.57246387",
"0.57246387",
"0.57246387",
"0.57246387",
"0.57246387",
"0.57246387",
"0.57246387",
"0.5720564",
"0.570509",
"0.5690825",
"0.5674729",
"0.56689656",
"0.5653106",
"0.5650741",
"0.5649028",
"0.56475776",
"0.5638186",
"0.5628646",
"0.5624158",
"0.56089944",
"0.56016016",
"0.5589361",
"0.5580334",
"0.5556012",
"0.55532974",
"0.5546261",
"0.5545851",
"0.5542496",
"0.5540783",
"0.5525933",
"0.5505621",
"0.55052274",
"0.5503073",
"0.5496715",
"0.5489853",
"0.54841673",
"0.54701453",
"0.54614663",
"0.5456387",
"0.54552215",
"0.54514325",
"0.54509604",
"0.5448129",
"0.54478383"
] |
0.0
|
-1
|
If the gem requires a specific version, determine it
|
def gem_version_str(gem)
return '' unless gem.version
# "#{gem.version ? ", '#{gem.version}'" : ''}"
", '#{gem.version}'"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend",
"def gem_version_more?(name, version)\n Gem.loaded_specs[name].version >= Gem::Version.new(version)\n end",
"def version_specified_gem?(node); end",
"def has_version?; end",
"def restrictive_version_specified_gem?(node); end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def version\n @dependency.requirement\n end",
"def latest_version?\n @requirement.none?\n end",
"def latest_version?\n @requirement.none?\n end",
"def required_rubygems_version\n spec.required_rubygems_version || Gem::Requirement.default\n end",
"def version_constraint(gem_name); end",
"def gem_if_necessary(gem)\n grep = args = nil\n if gem =~ /(.*)-(\\d+\\.\\d+\\.\\d+)$/\n gem, version = $1, $2\n grep = \"^#{gem}.*#{version}\"\n args = \" --version #{version}\"\n else\n grep = \"^#{gem}\"\n end\n if fails?(\"gem list #{gem} | grep '#{grep}'\")\n banner \"#{gem}...\"\n run \"gem install #{gem} #{args} --no-rdoc --no-ri\"\n return true\n end\n false\n end",
"def check_version_or_latest_version(version = nil)\n version ||= latest_version\n raise Ajaxlibs::Exception::VersionNotFound unless self.class::Versions.include?(version)\n version\n end",
"def required_rubygems_version\n spec.required_rubygems_version\n end",
"def satisfied_by?(version)\n raise ArgumentError, \"Need a Gem::Version: #{version.inspect}\" unless\n Gem::Version === version\n requirements.all? {|op, rv| OPS[op].call version, rv }\n end",
"def required_ruby_version\n spec.required_ruby_version || Gem::Requirement.default\n end",
"def version\n @gemspec.version || @version_helper.to_s\n end",
"def activated?\n loaded = Gem.loaded_specs[name]\n loaded && loaded.version == version\n end",
"def required_version\n versions.find { |v| dependency.match?(name, v) } ||\n raise(Informative, \"Required version (#{dependency}) not found for `#{name}'.\\nAvailable versions: #{versions.join(', ')}\")\n end",
"def get_version(gem)\n lockfile_specs.find { |s| s.name == gem }&.version\n end",
"def check_version(version, requirement)\n Gem::Requirement.new( requirement ).satisfied_by? Gem::Version.new( version )\n end",
"def version_from_gem_lock_file\n shell_return = run_shell(\"grep -A 1 RUBY Gemfile.lock\")\n shell_return.nil? ? nil : shell_return.stdout.split(\"\\n\")[1].strip.split(\" \")[1]\n end",
"def gem_available?(name)\n Gem::Specification.find_by_name(name)\nrescue Gem::LoadError\n false\nend",
"def earliest_version_matching(dep)\n version = versions_matching(dep).collect { |v| ::Gem::Version.new v }.min\n version.nil? ? nil : version.to_s\n end",
"def meets_requirements?\n if dirname = Micro.installed_gem_dirnames(name).last\n Gem::Version.from_gem_dirname(dirname) >= @version_requirements.version\n end\n end",
"def requirement\n Gem::Requirement.new('~>' + pharos_version.segments.first(2).join('.') + (pharos_version.prerelease? ? '.0-a' : '.0'))\n end",
"def gem_installed?(gem)\n begin\n old_stderr, $stderr = $stderr, StringIO.new\n if defined?(::Gem::Specification) && ::Gem::Specification.respond_to?(:find_by_name)\n gem_spec = ::Gem::Specification.find_by_name(gem)\n else\n gem_spec = ::Gem::GemPathSearcher.new.find(gem)\n end\n gem_spec.nil? ? nil : gem_spec.version.to_s\n rescue LoadError\n nil\n ensure\n $stderr = old_stderr\n end\n end",
"def latest_version(gem_name, pre: false)\n return versions(gem_name).first if pre\n versions(gem_name).find { |version| !version.prerelease? }\n end",
"def gem_available?(name)\n Gem::Specification.find_by_name(name)\nrescue Gem::LoadError\n false\nrescue\n Gem.available?(name) #for backwards compatibility\nend",
"def require_matched_dependency_version\n false\n end",
"def gem_version\n ::Gem::Version.new(VERSION::STRING)\n end",
"def need_inspec_core_bin?(gem_version)\n return true if gem_version.nil? # latest version\n Gem::Requirement.new('>= 4').satisfied_by?(Gem::Version.new(gem_version))\n end",
"def parse_gem_version(gem_version)\n return if gem_version.blank? || gem_version == 'stable'\n Versionomy.parse(gem_version)\nrescue Versionomy::Errors::ParseError\n return nil\nend",
"def find_recommended_require_version(package)\n version = package.version\n unless package.is_dev?\n return transform_version(version, package.pretty_version, package.stability)\n end\n\n loader = ::Composer::Package::Loader::HashLoader.new(parser)\n dumper = ::Composer::Package::Dumper::HashDumper.new\n\n extra = loader.get_branch_alias(dumper.dump(package))\n if extra =~ /^(\\d+\\.\\d+\\.\\d+)(\\.9999999)-dev$/\n extra = \"#{$1}.0\"\n extra.gsub!('.9999999', '.0')\n return transform_version(extra, extra, 'dev')\n end\n\n package.pretty_version\n end",
"def installed_version\n logger.trace(\"#{new_resource} checking package version\")\n current_installed_version\n end",
"def has_gem(name, version = nil)\n version = version ? \"--version '#{version}'\" : '' \n @commands << \"gem list '#{name}' --installed #{version} > /dev/null\"\n end",
"def version\n @version ||= if token.nil? || Array(packages).empty?\n '0.1.0'\n else\n packages.map do |p|\n Gem::Version.new(p['version'])\n end.sort.last.bump.to_s << '.0'\n end\n end",
"def require!\n super do\n gem @gem_name, @version if @version\n end\n end",
"def installed?(name, req = Gem::Requirement.default)\n Gem::Specification.any? { |s| s.name =~ name and req =~ s.version }\n end",
"def latest_version?\n if (rval = super)\n Gem.unversioned(@name)\n end\n rval\n end",
"def check_version_of(gem_name, version)\n requirement = Gem::Requirement.new(version)\n current_version = Gem.loaded_specs[gem_name].version\n\n requirement.satisfied_by?(current_version)\n end",
"def have_gem? name\n Gem::Specification.find_by_name name.to_s\n rescue Gem::LoadError\n false\n end",
"def gem(name, version)\n version = version.to_s\n\n begin\n json = open(\"https://rubygems.org/api/v1/versions/#{name}.json\") {|f| f.read}\n gems = JSON.parse(json)\n\n gem = gems.detect do |g|\n g[\"number\"] == version && g[\"platform\"] == \"ruby\"\n end\n\n if gem && gem[\"sha\"]\n # Rubygems.org was _supposed_ to provide base64 encoded SHA-256 hashes,\n # but as of now the hashes are base16 encoded...\n base16 = gem[\"sha\"]\n base32 = exec(\"nix-hash --type sha256 --to-base32 #{base16.shellescape}\")\n assert_length!(base32, 52)\n assert_format!(base32, /^[a-z0-9]+$/)\n\n base32\n end\n rescue Exception => ex\n #puts ex.message\n #puts ex.backtrace\n nil\n end\n end",
"def latest_version_matching(dep)\n version = versions_matching(dep).collect { |v| ::Gem::Version.new v }.max\n version.nil? ? nil : version.to_s\n end",
"def retrieve_version(name, version)\n path = downloaded_gem_path name, version\n parse :gem => path\n end",
"def has_build_satisfying?(name, version)\n dep = ::Gem::Dependency.new name, version\n versions_for(name).any? { |v| dep.match?(name, v) }\n end",
"def satisfied_by?(req_vers, new_vers)\n req = LibGems::Requirement.new(req_vers)\n req_vers.sub(/^= /,'') == new_vers.sub(/^= /,'') ||\n req.satisfied_by?(LibGems::Version.new(new_vers))\n end",
"def version_available?(package_name, desired_version, arch = nil)\n version(package_name, arch, true, false) do |v|\n return true if desired_version == v\n end\n\n false\n end",
"def get_version_req(dep)\n req = get_key_or_sym(dep, :version_requirement)\n req ||= get_key_or_sym(dep, :version_range)\n req\n end",
"def gem_dep_matches?(what, version, *deps)\n # always match if we have no chef_version at all\n return true unless deps.length > 0\n\n # match if we match any of the chef_version lines\n deps.any? { |dep| dep.match?(what, version) }\n end",
"def required_version\n fetch(:chef_version) || nil\n end",
"def installed_by_version # :nodoc:\n @installed_by_version ||= Gem::Version.new(0)\n end",
"def installed_version_matches?(version)\n installed_version? == version\n end",
"def find_name(gem_name, version_requirement=Version::Requirement.new(\">= 0\"))\n search(/^#{gem_name}$/, version_requirement)\n end",
"def find_name(gem_name, version_requirement=Version::Requirement.new(\">= 0\"))\n search(/^#{gem_name}$/, version_requirement)\n end",
"def detect_installed_version\n return @installed_version unless self.class.method_defined?(:installed_version_file)\n\n version_match = find_first_match(:matching => installed_version_regexp, :in_file => installed_version_file)\n\n # if multiple parts are matched, join them back\n version = version_match.captures.reject(&:nil?).join(\".\")\n\n # convert commas into dots so Versionomy can parse them too\n version = version.gsub(',', '.')\n\n if version\n @installed_version_text = version.strip\n @installed_version = Versionomy.parse(@installed_version_text).change({}, :optional_fields => [:tiny])\n end\n end",
"def parse_gem_version(gem_version)\n return if gem_version.blank? || gem_version == 'stable'\n Versionomy.parse(gem_version)\n rescue Versionomy::Errors::ParseError\n nil\n end",
"def update_necessary?\n load_mixlib_versioning\n cur_version = Mixlib::Versioning.parse(current_version)\n # we have to \"resolve\" partial versions like \"12\" through mixlib-install before comparing them here\n des_version =\n if new_resource.download_url_override\n # probably in an air-gapped environment.\n Mixlib::Versioning.parse(desired_version)\n else\n Mixlib::Versioning.parse(Array(mixlib_install.artifact_info).first.version)\n end\n Chef::Log.debug(\"The current chef-client version is #{cur_version} and the desired version is #{desired_version}\")\n new_resource.prevent_downgrade ? (des_version > cur_version) : (des_version != cur_version)\nend",
"def version(gem)\n Dir.chdir(@path)\n lockfile = Bundler::LockfileParser.new(\n Bundler.read_file('Gemfile.lock')\n )\n\n lockfile.specs.each do |s|\n if s.name == gem\n return s.version\n end\n end\n raise \"Gem #{gem} not found in #{@path}\"\n end",
"def installed_version\n lines = powershell_out!('Get-WmiObject -Class win32_product')\n .stdout.lines\n idx = lines.index do |l|\n l.match(/^\\W*Name\\W+:\\W+Chef Development Kit/)\n end\n return false if idx.nil?\n ver = lines[idx + 2].match(/:\\W+([0-9]+\\.[0-9]+\\.[0-9]+)\\.[0-9]+/)[1]\n ver == package_metadata[:version] ? 'latest' : ver\n end",
"def has_gem?(str)\n name, version = parse_gem_line(str)\n begin\n gem(name, version || '>=0')\n true\n rescue Gem::LoadError\n false\n end\n end",
"def has_gem(name, version=nil)\n version = version.nil? ? '' : version.gsub('.', '\\.')\n @commands << \"sudo gem list | grep -e '^#{name} (.*#{version}.*)$'\"\n end",
"def version_mismatch_detected\n end",
"def gem?\n @gem\n end",
"def find_gem(name, version)\n spec = source_index.find_name(name, version).last\n unless spec and (spec.installation_path rescue nil)\n alert_error \"Could not find gem #{name} (#{version})\"\n raise Gem::GemNotFoundException, \"Could not find gem #{name}, (#{version})\"\n end\n\n return spec\n end",
"def required_ruby_version\n spec.required_ruby_version\n end",
"def version_with_support(feature)\n case feature.to_sym\n when :oidc\n Gem::Version.new('0.16.19')\n else\n Gem::Version.new('0.0.0')\n end\n end",
"def installed_version\n sh = shell_out('pkgutil --pkg-info com.getchef.pkg.chefdk')\n return false if sh.exitstatus.nonzero?\n ver = sh.stdout.match(/^version:\\W+([0-9]+\\.[0-9]+\\.[0-9]+)$/)[1]\n ver == package_metadata[:version] ? 'latest' : ver\n end",
"def current_version?\n true\n end",
"def get_version_info\n version_file = Rails.root.join('lib', 'version.json')\n\n File.exist?(version_file) ? read_version_file(version_file) : development_version_info\nend",
"def installed?\n case @spec\n when Gem::Resolver::VendorSpecification then\n true\n else\n this_spec = full_spec\n\n Gem::Specification.any? do |s|\n s == this_spec\n end\n end\n end",
"def gem_version\n Gem::Version.new VERSION\n end",
"def specification\n Gem::Specification.find_by_name(name, requirement)\n rescue Gem::LoadError\n nil\n end",
"def available_version(package_name, arch = nil)\n version(package_name, arch, true, false)\n end",
"def latest_version?\n if (res = _latest_version?)\n Gem.unversioned(@name)\n end\n res\n end",
"def installed_version\n res = Chef::Resource::Package.new('chefdk', run_context)\n prov = Chef::Provider::Package::Dpkg.new(res, run_context)\n ver = prov.load_current_resource.version.first\n return false if ver.nil?\n ver = ver.split('-').first\n ver == package_metadata[:version] ? 'latest' : ver\n end",
"def required_version\n normalize_version(@required_version ||= nil)\n end",
"def require_version(name, current, required)\n print \"Checking for #{name} >= #{required}... \"\n\n if version_greater_than(current, required)\n puts 'yes'\n else\n abort 'no'\n end\n end",
"def from_dependency?\n source_options && version_dependency\n end",
"def available?\n !!version\n end",
"def gem_installed?(gem_name)\n found_gem = false\n begin\n found_gem = Gem::Specification.find_by_name(gem_name)\n rescue Gem::LoadError\n return false \n else\n return true \n end\nend",
"def requires_version(cmd, version_)\n v = check_version(version_)\n unless v[0]\n raise NoMethodError, format('%s is not supported in Bugzilla %s', cmd, v[1])\n end\n end",
"def stable_gem_versions(http_response)\n http_response.blank? ? [] : http_response.select { |val| val['prerelease'] == false }\nend",
"def outdated?\n cloudversion && Gem::Version.new(cloudversion) > Gem::Version.new(version)\n rescue\n nil\n end",
"def installed_version\n capture(\"#{chef_solo} -v || true\") =~ /Chef: (\\d+\\.\\d+\\.\\d+)/ ? $1 : nil\n end",
"def version\n content = File.read(File.join(@path, 'Gemfile.lock'))\n content.match(REGEX_VERSION)[1]\n rescue\n raise Pbtd::Error::FileNotFound, \"Your Gemfile.lock not found for this environment\"\n end",
"def detect\n @version ? id(@version) : nil\n end",
"def detect\n @version ? id(@version) : nil\n end",
"def detect\n @version ? id(@version) : nil\n end",
"def detect\n @version ? id(@version) : nil\n end",
"def pre_0_12?\n VersionRequirement.new('< 0.12.0-alpha').satisfied_by?(version)\n end",
"def current_version?\n version == FirmwareUpgrade.current_software_version\n end",
"def gem_available_old_rubygems?(gemname)\n\tGem.available?(gemname)\nend",
"def update_necessary?\n load_mixlib_versioning\n cur_version = Mixlib::Versioning.parse(current_version)\n des_version = Mixlib::Versioning.parse(desired_version)\n Chef::Log.debug(\"The current chef-client version is #{cur_version} and the desired version is #{desired_version}\")\n new_resource.prevent_downgrade ? (des_version > cur_version) : (des_version != cur_version)\nend",
"def gem_spec(name, version)\n if spec = spec(name, version)\n BareSpecification.new(self, name, spec[1]).gem_spec\n end\n end",
"def spec(name, version)\n specs.select { |spec| spec[0] == name && (version.any? || spec[1] == version) }.last\n end"
] |
[
"0.77554524",
"0.76980346",
"0.76972544",
"0.7496754",
"0.7459695",
"0.7408123",
"0.7408123",
"0.7408123",
"0.7408123",
"0.7408123",
"0.7408123",
"0.73400265",
"0.7304826",
"0.7304826",
"0.7276781",
"0.72616047",
"0.717571",
"0.7159915",
"0.71543235",
"0.7144789",
"0.71398294",
"0.7059416",
"0.70283175",
"0.70002764",
"0.6991791",
"0.6984348",
"0.6928258",
"0.6919312",
"0.69164485",
"0.6915816",
"0.68964666",
"0.68962544",
"0.6890883",
"0.68835014",
"0.68759644",
"0.6871242",
"0.68427825",
"0.68306917",
"0.67662156",
"0.67446643",
"0.6730709",
"0.6724216",
"0.67161435",
"0.6712066",
"0.66950256",
"0.66887075",
"0.66885686",
"0.66885",
"0.6687682",
"0.6683954",
"0.66814554",
"0.66803354",
"0.6679274",
"0.6655238",
"0.664756",
"0.6644379",
"0.6643887",
"0.6626171",
"0.66230357",
"0.66230357",
"0.66107035",
"0.6609209",
"0.66022617",
"0.6573004",
"0.6568849",
"0.656243",
"0.6561185",
"0.6559964",
"0.6558124",
"0.65478307",
"0.65473497",
"0.65365",
"0.65347326",
"0.6529417",
"0.6517413",
"0.6516535",
"0.6514555",
"0.6494926",
"0.6493673",
"0.648938",
"0.6481681",
"0.64782465",
"0.6477139",
"0.64763",
"0.64673805",
"0.64638156",
"0.6461811",
"0.6459593",
"0.6459218",
"0.64506143",
"0.6429533",
"0.6410009",
"0.6410009",
"0.6410009",
"0.6410009",
"0.64046997",
"0.6403576",
"0.64018726",
"0.6392866",
"0.63895327",
"0.6383858"
] |
0.0
|
-1
|
If the requested gem requires additional options (ie: require: false) return this
|
def gem_options(gem)
return '' unless gem.options.any?
options_str = gem.options.map { |k, v| "#{k}: #{v.inspect}" }.join(', ')
", #{options_str}" unless options_str.blank?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def require!\n super do\n gem @gem_name, @version if @version\n end\n end",
"def disabled?\n super || !gemfile.exist?\n end",
"def required(gem_name, gem_install_name = nil)\n Required::required gem_name, gem_install_name\nend",
"def custom_gem(name, options = Hash.new)\n local_path = File.expand_path \"../vendor/#{name}\", __FILE__\n\n if File.exist? local_path\n options = options.merge :path => local_path\n options.delete_if do |key, _|\n [:github, :branch].include? key\n end\n end\n\n gem name, options\nend",
"def gemspec?; end",
"def require_gems; end",
"def custom_gem(name, options = Hash.new)\n local_path = File.expand_path(\"../../#{name}\", __FILE__)\n if ENV[\"USE_JSUS_CUSTOM_GEMS\"] && File.directory?(local_path)\n gem name, options.merge(:path => local_path).delete_if { |key, _| [:git, :branch].include?(key) }\n else\n gem name, options\n end\nend",
"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 gem_requires(name, options) # :nodoc:\n if options.include? :require\n if requires = options.delete(:require)\n @requires[name].concat Array requires\n end\n else\n @requires[name] << name\n end\n raise ArgumentError, \"Unhandled gem options #{options.inspect}\" unless options.empty?\n end",
"def assert_option_supported(option, gem_name = option.to_s)\n if options[option]\n begin\n Gem::Specification.find_by_name(gem_name)\n rescue Gem::LoadError\n Berkshelf.ui.warn \"This cookbook was generated with --#{option}, however, #{gem_name} is not installed.\"\n Berkshelf.ui.warn \"To make use of --#{option}: gem install #{gem_name}\"\n return false\n end\n end\n true\n end",
"def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend",
"def gem(gem_name, *version_requirements)\n if gem_name =='i18n'\n puts \"skipping loading the i18n gem ...\"\n return\n end\n super(gem_name, *version_requirements)\nend",
"def gem?\n @gem\n end",
"def gem_if_necessary(gem)\n grep = args = nil\n if gem =~ /(.*)-(\\d+\\.\\d+\\.\\d+)$/\n gem, version = $1, $2\n grep = \"^#{gem}.*#{version}\"\n args = \" --version #{version}\"\n else\n grep = \"^#{gem}\"\n end\n if fails?(\"gem list #{gem} | grep '#{grep}'\")\n banner \"#{gem}...\"\n run \"gem install #{gem} #{args} --no-rdoc --no-ri\"\n return true\n end\n false\n end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def from_dependency?\n source_options && version_dependency\n end",
"def assert_default_supported(option, gem_name = option.to_s)\n unless options[option]\n begin\n Gem::Specification.find_by_name(gem_name)\n rescue Gem::LoadError\n Berkshelf.ui.warn \"By default, this cookbook was generated to support #{gem_name}, however, #{gem_name} is not installed.\"\n Berkshelf.ui.warn \"To skip support for #{gem_name}, use --#{option.to_s.gsub('_', '-')}\"\n Berkshelf.ui.warn \"To install #{gem_name}: gem install #{gem_name}\"\n return false\n end\n end\n true\n end",
"def required_if_used(*args)\n unless @required_gems\n [:included, :extended, :inherited].each do |method_name|\n define_method(method_name) do |klass|\n super if defined?(super)\n @required_gems.each { |gem| require gem.to_s }\n end\n end\n end\n @required_gems ||= []\n @required_gems |= args\n end",
"def require( gem_name_or_path ) \n \n did_load = ::Development.require( gem_name_or_path )\n\n if did_load.nil?\n did_load = super\n end\n\n if gem_name_or_path == 'bundler'\n ::Development::Require::BundlerSupport.call\n end\n \n return did_load\n \n end",
"def option_req(option_name)\n throw :notimpl\n end",
"def lookup_and_execute_require_option(args)\n args.each_with_index do |v, i|\n if %w(-r --require).include?(v)\n require args[i+1]\n end\n end\n end",
"def valid_gemspec?; end",
"def platform_require\n fail NotImplementedError,\n 'Abstract method must returns `Gem::Requirement`'\n end",
"def bootstrap_require\n def RC.required(feature)\n config = RC.configuration[feature]\n if config\n config.each do |config|\n next unless config.apply_to_feature?\n config.call\n end\n end\n super(feature) if defined?(super)\n end\n end",
"def call(fname, options={})\n return unless apply?(fname, options)\n\n gem_name = options[:gem] || options[:from]\n\n if vers = options[:version]\n spec = ::Gem::Specification.find_by_name(gem_name, vers)\n else\n spec = ::Gem::Specification.find_by_name(gem_name)\n end\n\n if options[:gem]\n raise_load_error(fname) unless spec\n else\n return unless spec\n end\n\n file = spec.find_requirable_file(fname)\n file = spec.find_requirable_file(File.join(gem_name, fname)) unless file\n\n if file\n super(file, options)\n else\n raise_load_error(fname)\n end\n end",
"def requirements\n options[:requirements] || {}\n end",
"def require!\n @required = true\n end",
"def require!\n @required = true\n end",
"def initialize_package\n self.need_tar ||= false\n self.need_zip ||= false\n end",
"def default_install_options\n GemManager.default_install_options\n end",
"def local_or_remote_gem(name, options = Hash.new)\n local_path = File.expand_path(\"../vendor/#{name}\", __FILE__)\n if File.exist?(local_path)\n gem name, options.merge(:path => local_path).delete_if { |key, _| [:git, :branch].include?(key) }\n else\n gem name, options\n end\nend",
"def required? #:nodoc:\n options[:required]\n end",
"def supports_options?\n return true\n end",
"def restrictive_version_specified_gem?(node); end",
"def optionally\n begin\n yield\n rescue LoadError; end\nend",
"def method_missing(m)\n\n case m\n when :createproj\n @args[:projectdir] = @options[m]\n @args[m] = true\n \n when :quickpkg\n # raise BoilerMakerErr.new(\"Option -Q: This option is unimplemented.\") \n @args[m] = @options[:quickpkg]\n \n when :projectdir\n unless @options[:createproj] or @options[:tconvert] or @options[:fetch] or @options[:package] or @options[:boil] or @options[:rollup]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -C, -t, -f or -p\") \n end\n @args[m] = File.expand_path(@options[m])\n unless @options[:createproj]\n raise BoilerMakerErr.new(\"No such file or dir: #{@args[m]}\") unless File.exists?(@args[m])\n end\n \n when :ktcheck\n if @options[:createproj] or @options[:projectdir] or @options[:tconvert] or @options[:fetch]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -c, -h or -w\") \n end\n raise BoilerMakerErr.new(\"Option --#{m}: Use the -h to specify a Radmind server host\") unless @options[:radhost]\n @args[m] = @options[m]\n \n when :tconvert\n @args[m] = File.expand_path(@options[m])\n raise BoilerMakerErr.new(\"No such file or dir: #{@args[m]}\") unless File.exists?(@args[m])\n \n when :fetch\n raise BoilerMakerErr.new(\"Option --#{m}: Use the -h to specify a Radmind server host\") unless @options[:radhost]\n @args[m] = File.expand_path(@options[m])\n raise BoilerMakerErr.new(\"No such file or dir: #{@args[m]}\") unless File.exists?(@args[m])\n \n when :radhost\n unless @options[:ktcheck] or @options[:fetch]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -K or -f\") \n end\n @args[m] = @options[m]\n\n when :boil\n @args[m] = @options[m]\n \n when :package\n @args[m] = @options[m]\n\n when :rollup\n @args[m] = @options[m]\n \n when :secure\n unless @options[:ktcheck] or @options[:fetch]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -K or -f\")\n end\n @args[m] = @options[m]\n\n when :cksum\n unless @options[:ktcheck] or @options[:fetch]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -K or -f\")\n end\n @args[m] = @options[m]\n \n end\n \n end",
"def apply?(fname, options={})\n return true if options[:gem]\n return true if options[:from] && (\n ::Gem::Specification.find{ |s| options[:from].to_s == s.name }\n )\n return false\n end",
"def pluggable!\n abort \"update rubygems to >= 1.3.1\" unless Gem.respond_to? :find_files\n require_rubygems_version \">= 1.3.1\"\n end",
"def gem(options=\"\")\n cmd = \"#{Gem.ruby} #{@ruby_options} #{@gem_path} #{options}\"\n system cmd\n end",
"def requirement\n return @requirement if defined?(@requirement) and @requirement\n end",
"def plugin_gem(name, options = {})\n lib, version = options.values_at(:lib, :version)\n begin\n Kernel.send :gem, name, version\n rescue Gem::LoadError\n dir = File.dirname(caller.first.split(':').first)\n $: << File.expand_path(\"#{dir}/../vendor/gems/#{name}-#{version.gsub(/[^\\d\\.]*/, '')}/lib\")\n end\n require(lib || name)\n end",
"def version_specified_gem?(node); end",
"def install_options\n collect_options(resource[:install_options])\n end",
"def build_gem; end",
"def final_options(library, paths); end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def gemspec=(_arg0); end",
"def get_options(name)\n if $array_modules.key? name\n return $array_modules[name]\n else\n puts \"The module doesn't exist\"\n return false\n end\nend",
"def setup_gem(name, options)\n version = [options[:version]].compact\n lib_name = options[:lib] || name\n\n log \"activating #{name}\"\n\n Gem.activate(name, *version)\n require(lib_name)\n\n rescue LoadError\n\n install_gem(name, options)\n Gem.activate(name, *version)\n require(lib_name)\n end",
"def check_pkg_info\n return false if options['package_url'].nil? ||\n options['package_name'].nil?\n true\nend",
"def requires_liberty_extensions?\n false\n end",
"def requires_liberty_extensions?\n false\n end",
"def requires_liberty_extensions?\n false\n end",
"def require_gem gem, name = nil\n name = gem if name.nil?\n if !BBLib.gem_installed? name\n return false unless Gem.install gem\n end\n require name\n end",
"def required_rubygems_version\n spec.required_rubygems_version || Gem::Requirement.default\n end",
"def check_options_requirements(runtime_options)\n required_options = options[:requires] || options[:require]\n return true unless required_options\n\n ([required_options].flatten - runtime_options.keys).size == 0\n end",
"def check_for_gems\n\n OPTIONAL_GEMS.each do |gem_name|\n method_name = \"has_#{gem_name.underline}?\".to_sym\n\n (class << self; self; end).class_eval do\n instance_variable_name = \"@has_#{gem_name.underline}\".to_sym\n\n define_method method_name do\n if instance_variable_get(instance_variable_name).nil?\n gem_installed = SystemChecks.gem_available?(gem_name)\n instance_variable_set(instance_variable_name, gem_installed)\n end\n instance_variable_get(instance_variable_name)\n end # define_method\n\n end # class_eval\n\n end # OPTIONAL_GEMS\n end",
"def required_options\n self.class.required_options\n end",
"def required_by_default?; end",
"def with_optional_dependency\n yield if block_given?\nrescue LoadError # rubocop:disable Lint/SuppressedException\nend",
"def with_optional_dependency\n yield if block_given?\nrescue LoadError # rubocop:disable Lint/SuppressedException\nend",
"def required(options)\n default = true\n return default unless options.is_a?(Hash)\n return default unless options.key?(:required)\n return options[:required]\n end",
"def flag_options\n request('flags/options').auth_required!\n end",
"def has_gem(name, version = nil)\n version = version ? \"--version '#{version}'\" : '' \n @commands << \"gem list '#{name}' --installed #{version} > /dev/null\"\n end",
"def allow_missing?(dependency)\n false\n end",
"def gemspec_helper=(_arg0); end",
"def gemspec_helper=(_arg0); end",
"def gemspec_helper=(_arg0); end",
"def gemspec_helper=(_arg0); end",
"def gemspec_helper=(_arg0); end",
"def gemspec_helper=(_arg0); end",
"def gemspec_helper=(_arg0); end",
"def needs_rebundle?\n # Right now compression is the only option that requires rebundling\n @options_hash != options_hash.hash\n end",
"def integrated\n File.exist?(gemfile)\n end",
"def requirement\n @dependency.requirement\n end",
"def rubyment_gem_defaults args=ARGV\n running_dir = @memory[:running_dir]\n basic_version = @memory[:basic_version]\n major_version = @memory[:major_version]\n\n gem_name,\n gem_version,\n gem_dir,\n gem_ext,\n gem_hifen,\n gem_date,\n gem_summary,\n gem_description,\n gem_authors,\n gem_email,\n gem_files,\n gem_homepage,\n gem_license,\n gem_validate_class,\n gem_validate_class_args,\n gem_validate_class_method,\n gem_is_current_file,\n gem_bin_generate,\n gem_bin_contents,\n gem_bin_executables,\n reserved = args\n\n\n gem_name ||= \"rubyrooomy\"\n gem_version ||= (version [])\n gem_dir ||= running_dir\n gem_ext ||= \".gem\"\n gem_hifen ||= \"-\"\n gem_ext ||= \"date\"\n gem_date ||= \"2018-07-13\"\n gem_summary ||= \"roOomy open tools for Ruby\"\n gem_description ||= \"a set of ruby helpers we use mostly in the backend testing environment of roOomy\"\n gem_authors ||= [\"roOomy backend development team\", \"Ribamar Santarosa\"]\n gem_email ||= 'ribamar.santarosa@rooomy.com'\n gem_files ||= [\"lib/#{gem_name}.rb\"]\n gem_homepage ||=\n \"http://rubygems.org/gems/#{gem_name}\"\n gem_license ||= 'MIT'\n gem_validate_class ||= self.class.to_s\n gem_validate_class_args ||= {:invoke => [\"puts\", \"rubyrooomy gem installation validated\"] }\n gem_validate_class_method ||= \"new\"\n gem_is_current_file = __FILE__ # this enables the possibility of building\n # a gem for the calling file itself, but be aware that lib/gem_file.rb\n # is supposed to be overriden later.\n gem_bin_generate = \"bin/#{gem_name}\" # generate a bin file\n gem_bin_contents =<<-ENDHEREDOC\n#!/usr/bin/env ruby\nrequire '#{gem_name}'\n#{gem_validate_class}.new({:invoke => ARGV})\n ENDHEREDOC\n gem_executables = [ gem_bin_generate && \"#{gem_name}\" ]\n\n [\n gem_name,\n gem_version,\n gem_dir,\n gem_ext,\n gem_hifen,\n gem_date,\n gem_summary,\n gem_description,\n gem_authors,\n gem_email,\n gem_files,\n gem_homepage,\n gem_license,\n gem_validate_class,\n gem_validate_class_args,\n gem_validate_class_method,\n gem_is_current_file,\n gem_bin_generate,\n gem_bin_contents,\n gem_bin_executables,\n ]\n end",
"def gem?\n #return true if Dir[File.join(location, '*.gemspec')].first\n pkgname = File.basename(location)\n gemsdir = File.dirname(location)\n specdir = File.join(File.dirname(gemsdir), 'specifications')\n Dir[File.join(specdir, \"#{pkgname}.gemspec\")].first\n end",
"def yardopts_options(opts)\n opts.on('--[no-]yardopts [FILE]',\n \"If arguments should be read from FILE\",\n \" (defaults to yes, FILE defaults to .yardopts)\") do |use_yardopts|\n if use_yardopts.is_a?(String)\n self.options_file = use_yardopts\n self.use_yardopts_file = true\n else\n self.use_yardopts_file = (use_yardopts != false)\n end\n end\n\n opts.on('--[no-]document', \"If arguments should be read from .document file. \",\n \" (defaults to yes)\") do |use_document|\n self.use_document_file = use_document\n end\n end",
"def option_missing(opt, argv)\n raise NoOptionError, opt\n end",
"def install_gem; end",
"def accepts_optional_argument?\n config[:optional_argument] || config[:argument] == :optional\n end",
"def setup_gem(name, options)\n version = [options[:version]].compact\n lib_name = options[:lib] || name\n\n log \"activating #{name}\"\n\n Gem.activate(name, *version)\n rescue Gem::LoadError\n log \"activating #{name} failed, try to install\"\n\n install_gem(name, version, options)\n end",
"def required_rubygems_version\n spec.required_rubygems_version\n end"
] |
[
"0.6645214",
"0.6431551",
"0.63915014",
"0.63156474",
"0.62942594",
"0.62696654",
"0.62361085",
"0.62329763",
"0.62329763",
"0.62329763",
"0.62329763",
"0.62329763",
"0.62329763",
"0.62329763",
"0.62329763",
"0.62329763",
"0.6148358",
"0.6086342",
"0.6011555",
"0.59961396",
"0.59913194",
"0.5977257",
"0.597307",
"0.597307",
"0.597307",
"0.597307",
"0.597307",
"0.597307",
"0.5964201",
"0.5925135",
"0.591983",
"0.5912558",
"0.59100705",
"0.59010905",
"0.5899816",
"0.5890577",
"0.5839893",
"0.5826191",
"0.58218557",
"0.57863116",
"0.57863116",
"0.57747406",
"0.57704073",
"0.5761007",
"0.5713407",
"0.56783074",
"0.56508034",
"0.5632312",
"0.56183445",
"0.55949175",
"0.5593881",
"0.55927",
"0.5589182",
"0.55784106",
"0.55588096",
"0.55587596",
"0.5552084",
"0.5535694",
"0.55265045",
"0.55265045",
"0.55265045",
"0.55265045",
"0.55265045",
"0.55265045",
"0.55265045",
"0.55092037",
"0.54949826",
"0.54809344",
"0.54753315",
"0.54753315",
"0.54753315",
"0.5467878",
"0.5462027",
"0.54619056",
"0.5454841",
"0.54495335",
"0.5445502",
"0.543454",
"0.543454",
"0.5428078",
"0.54215956",
"0.541979",
"0.54194945",
"0.54135555",
"0.54135555",
"0.54135555",
"0.54135555",
"0.54135555",
"0.54135555",
"0.54135555",
"0.541162",
"0.54044116",
"0.53776765",
"0.5371453",
"0.5370948",
"0.5370876",
"0.53627074",
"0.5361927",
"0.5361663",
"0.5358883",
"0.53521323"
] |
0.0
|
-1
|
Make a directory in the applications directory path
|
def mk_appdir(dir)
path = Rails.root.join(dir)
FileUtils.mkdir(path) unless File.directory?(path)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def make_app_directories\n @shell.call \"mkdir -p #{self.directories.join(\" \")}\"\n end",
"def make_directory(path)\n mkdir(path)\n chown(path, user)\n path\n end",
"def make_dir(path)\n FileUtils.mkdir_p( path )# unless File.exists?(path)\n end",
"def make_dir_for_path(path)\n dir_name = File.dirname(path)\n Dir.mkdir(dir_name) if !File.directory?(dir_name)\n end",
"def make_dir(dir_path)\n FileUtils.mkdir_p(dir_path) unless File.directory?(dir_path)\n end",
"def mk_dir(path)\n FileUtils.mkdir_p(path) unless File.directory?(path)\n end",
"def makePath\n\t\t\tbuildMgr.effective(filename).dirname.mkpath\n\t\tend",
"def create_directory(path)\n FileUtils.mkdir_p(path)\n path\n end",
"def set_dir(new_dir)\n # checking for / at the end of the env variable\n new_dir = '' unless new_dir\n new_dir += '/' unless new_dir[-1, 1] == '/'\n @dir = new_dir\n end",
"def makedir(dir)\n FileUtils.mkdir_p dir\n end",
"def make_directory\n FileUtils.mkdir_p output_directory unless File.exist? output_directory\n end",
"def mkpath(directory)\n FileUtils.mkdir_p(directory.to_s, :mode => @permissions[:dir], :verbose => true)\n end",
"def make_dir (dirname)\n begin\n unless File.exists?(dirname)\n puts \"[add] making directory '#{dirname}'\"\n FileUtils.mkdir(dirname)\n end\n rescue Exception => e\n puts \"An error occurred when trying to create the directory '#{dirname}', exception found was: \"+ e.message\n exit 1\n end\n end",
"def create_directories\n directory '.', './'\n end",
"def create_directory(path)\n clean_path = File.expand_path(path.gsub(/ /, '_'))\n Dir.mkdir(clean_path)\n clean_path\n end",
"def ensure_directory\n FileUtils.mkdir_p(to_s)\n self\n end",
"def create_dir(filename)\n expanded_filename = \"#{working_dir}/#{filename}\"\n FileUtils.mkdir_p expanded_filename\n expanded_filename\n end",
"def create_dir(path)\n FileUtils.mkdir_p(path, { mode: 0775 }) unless File.exists?(path)\n end",
"def make_home_directory( username, skeldir=SKELDIR )\n\t\tself.log.info \"Making home directory for %p, cloned from %s\" % [ username, skeldir ]\n\t\thomedir = HOMEDIR_BASE + username\n\t\traise \"%s: already exists\" % [ homedir ] if homedir.exist?\n\t\traise \"%s: already has an archived homedir\" % [ username ] if\n\t\t\t( ARCHIVE_BASE + username ).exist?\n\n\t\tFileUtils.cp_r( skeldir.to_s, homedir )\n\t\tFileUtils.chown_R( username, nil, homedir )\n\n\t\treturn homedir.to_s\n\tend",
"def mkdir(name=newname)\n dir = path(name)\n Dir.mkdir(dir)\n return dir\n end",
"def mkpath path\n end",
"def destination\n File.join(cwd, 'Applications')\nend",
"def make_directory(directory)\n self.exec!(\"mkdir #{directory}\") unless directory_exists?(directory)\n end",
"def create_directory\n remove_dir(@name) if Dir.exist?(@name)\n Dir.mkdir(@name)\n end",
"def create_dir(dirName)\r\n\tif !File.directory?(dirName)\r\n\t\tFileUtils.mkdir(dirName) #creates the /build directory\r\n\tend\r\nend",
"def create_dir(dirName)\r\n\tif !File.directory?(dirName)\r\n\t\tFileUtils.mkdir(dirName) #creates the /build directory\r\n\tend\r\nend",
"def create_directory\n return if File.directory?(DIRECTORY_PATH)\n\n FileUtils.mkdir_p(DIRECTORY_PATH)\n end",
"def mkpath\n @path.mkpath\n end",
"def create_dir(dir)\n dir = \"#{@dir}/#{dir}\"\n puts \"... Creating directory '#{dir}'\"\n Dir.mkdir(dir)\n end",
"def create_dir path\n path = with_root path\n path = fix_path path\n sftp.mkdir! path\n end",
"def mkdir path\n parent = lookup_single! File.dirname(path), RbVmomi::VIM::Folder\n parent.CreateFolder(:name => File.basename(path))\nend",
"def create_directory path\n unless File.exists?(path)\n FileUtils::mkdir_p path\n Puppet.notice \"Created directory #{path}\"\n end\n end",
"def create_dirs(path)\n FileUtils.makedirs path.split('/').reverse[1..-1].reverse.join('/')\n end",
"def mkdir( *args ) Dir.mkdir( expand_tilde, *args ) end",
"def create_directory(directory)\n Dir.chdir(path)\n Dir.mkdir(directory) unless File.directory?(directory)\n end",
"def ensure_dir(path)\n directory path do\n action :create\n recursive true\n end\nend",
"def build_dir_path(dir_path)\r\n dir_builder = \"\"\r\n dir_path.split(\"/\").each { |dir|\r\n unless Dir.exists?(dir_builder + dir)\r\n Dir.mkdir(dir_builder + dir)\r\n end\r\n dir_builder += dir + \"/\"\r\n }\r\n end",
"def mkpath(path)\n FileUtils.mkpath\n end",
"def create_dirs(path)\n FileUtils.makedirs path.split('/').reverse[1..-1].reverse.join('/')\n end",
"def create_moab_dirs()\n target_path = manifest_path(self.object.id, self.version)\n if File.directory?(target_path)\n err_string = \"The Moab directory #{target_path} for \"\\\n \"#{self.object.id} version #{self.version} already exists\"\n Rails.logger.error(err_string)\n raise DRI::Exceptions::InternalError, err_string\n end\n\n make_dir(\n [\n version_path(self.object.id, self.version),\n metadata_path(self.object.id, self.version),\n content_path(self.object.id, self.version)\n ]\n )\n end",
"def mkpath\n FileUtils.mkpath( expand_tilde )\n end",
"def create_dir(path, property)\n FileUtils.mkdir_p(path)\n insert_property(property, path)\n end",
"def ensureDir(dir)\n\tdir = File.expand_path(dir)\n\tif !File.directory? dir\n\t\tFileUtils::mkpath(dir)\n\tend\n\treturn dir\nend",
"def location(dir)\n\tdir = File.expand_path(dir)\n\tif !File.directory? dir\n\t\tFileUtils::mkpath(dir)\n\tend\n\treturn dir\nend",
"def mkdirs\n if (not exists?)\n parent.mkdirs\n factory.system.mkdir @path\n end\n end",
"def bootstrap_folder\n FileUtils.mkdir_p folder_path\n end",
"def ensure_directory_exists\r\n dir = File.dirname(full_path_from_current_attributes)\r\n FileUtils.mkdir_p(dir) unless File.exists?(dir)\r\n end",
"def controll_root\n root = '/'\n if defined?(\"::Rails\")\n if Rails.respond_to?(:root)\n root = ::Rails.root\n end\n end\n root = File.join(root, PATH)\n unless File.exist?(root)\n Dir.mkdir(root)\n end\n Dir.open(root)\n end",
"def directory(dir)\n last_remote = Rake.application.last_remote\n Rake.each_dir_parent(dir) do |d|\n Rake.application.last_remote = last_remote\n file_create d do |t|\n mkdir_p t.name if ! File.exist?(t.name)\n end\n end\n end",
"def create_dir(dir)\n unless File.directory?(dir)\n FileUtils.mkdir_p(dir)\n end\nend",
"def create_dir path\n sftp.mkdir! path\n end",
"def make_directories!\n @sprites_path.mkpath unless @sprites_path.directory?\n @sources_path.mkpath unless @sources_path.directory?\n end",
"def app_dir\n File.join(home_dir, \"#{sanitized_app_name}.#{name}\")\n end",
"def create_in_current_directory?\n is_current_directory?(@path)\n end",
"def create_moab_dirs\n target_path = manifest_path(object.alternate_id, version)\n if File.directory?(target_path)\n err_string = \"The Moab directory #{target_path} for \"\\\n \"#{object.alternate_id} version #{version} already exists\"\n Rails.logger.error(err_string)\n raise DRI::Exceptions::InternalError, err_string\n end\n\n make_dir(\n [\n version_path(object.alternate_id, version),\n metadata_path(object.alternate_id, version),\n content_path(object.alternate_id, version)\n ]\n )\n end",
"def set_directory(path)\n if File.exists? path and File.directory? path\n @directory = path.reverse.index(\"/\") == 0 ? path.chop : path\n else\n raise Error, \"Invalid path name\"\n end \n end",
"def gen_app\n unless File.exists?(app_dir)\n original_dir = FileUtils.pwd\n Dir.mkdir(root_dir) unless (!root_dir or File.exists?(root_dir))\n FileUtils.cd(root_dir) if root_dir\n `#{rails_str}`\n FileUtils.cd(original_dir)\n true\n end\n end",
"def mk_repo_dir(path)\n dir_path = File.join(@full_path, path)\n return dir_path if (File.exist?dir_path) and (File.directory? dir_path)\n FileUtils.mkdir_p(dir_path)\n dir_path\n end",
"def workdir\n result = base.join('cache')\n result.mkpath\n result\n end",
"def create_directory\n return if File.exist? config_directory\n\n begin\n FileUtils.mkdir config_directory\n rescue Errno::EEXIST\n end\n end",
"def make_app_structure where\n %w(releases shared/config shared/system).each do |dir|\n mkdir File.join(where, dir), :owner => DEFAULT_IDENTITY\n end\n end",
"def directory(from, to = nil)\n @directories[from.chomp('/')] = to\n end",
"def ensureDir(filename)\n dir = File::dirname(filename) ;\n system(\"mkdir -p #{dir}\") ;\n end",
"def make_dirs\r\n FileUtils.rm_rf @dirs[:tmp]\r\n @dirs.each do |k, dir|\r\n FileUtils.mkdir_p dir\r\n end\r\n end",
"def CreateDir(aDir):\n FileUtils.mkdir_p(aDir)\n end",
"def add_directory(name)\n full_path = File.join(path, name)\n\n Dir.mkdir(full_path) unless File.directory?(full_path)\n\n self.class.new(full_path)\n end",
"def mkpath(path)\n FileUtils.mkpath(abspath(path))\n exist?(path) ? dir(path) : false\n end",
"def mkdir(path)\n Dir.mkdir path unless exists? path\n end",
"def home_path\n result = tmp_path.join(\"home\")\n FileUtils.mkdir_p(result)\n result\n end",
"def create_folder_if_needed path; Dir.mkdir(path) unless File.exists?(path) end",
"def touch_directory(path, opt={})\n unless File.exists? path\n FileUtils.mkdir_p path\n STDOUT.write \"Created #{path.relative_to_project_root}\\n\".color(:green) unless opt[:quiet]\n end\n nil\n end",
"def mkdirs(folders, enter=false)\n oldCWD = FileUtils.pwd\n path = folders.join(\"/\")\n folders.delete_at(folders.size - 1)\n folders.each do |f|\n mkfolder(f, true)\n end\n FileUtils.chdir(oldCWD) unless enter\nend",
"def make_my_dir (dirname, state)\n\n if Dir.exists?(dirname) && state == DIR_NEW\n puts \"ERROR-01: Directory already exists; name=<#{dirname}>\\n\"\n exit\n end\n\n if Dir.exists?(dirname)\n return\n else\n Dir.mkdir (dirname)\n if ! Dir.exists?(dirname)\n puts \"ERROR-02: Could not create directory; name=<#{dirname}>\\n\"\n exit\n end\n end\nend",
"def create_dir(dir)\n\t\tif !FileTest::directory?(dir)\n\t\t\tDir::mkdir(dir)\n\t\tend\n\tend",
"def create_folders_for full_path\n full_path = File.dirname(full_path)\n\n return if File.directory?(full_path) || [\"/\", \".\"].include?(full_path)\n create_folders_for(full_path)\n Dir::mkdir(full_path)\n end",
"def ensure_directory(path)\n FileUtils.mkdir_p(path) unless File.directory?(path)\n end",
"def register_dir(key, path)\n @dirs[key] = File.join @dirs[:scratch], path\n FileUtils.mkdir_p(@dirs[key])\n end",
"def mkdir(path)\n FileUtils.mkdir_p(path)\n end",
"def create\n FileUtils.mkdir_p(directory) unless exist?\n end",
"def mkpath(*args)\n args[0] = {} unless args[0]\n args[0] = args[0].merge(mode: 0700) unless args[0][:mode]\n FileUtils.mkpath(self.to_s, *args)\n end",
"def new_dirs; end",
"def generate_install_folder\n folder='./EdenApps'\n unless File.exist?(folder)\n Console.show \"Creating folder #{folder}\", 'info'\n FileUtils.mkdir_p(folder)\n FileUtils.chown_R('EdenManager','EdenManager',folder)\n FileUtils.chmod_R(0775, folder)\n end\n installFolder = \"./EdenApps/#{self.type}/#{self.name}\"\n unless File.exist?(installFolder)\n Console.show \"Creating folder #{installFolder}\", 'info'\n FileUtils.mkdir_p(installFolder)\n FileUtils.chown_R('EdenManager','EdenManager',installFolder)\n end\n installFolder\n end",
"def create_folder(name)\n Dir.mkdir(\"#{name}\")\nend",
"def create_path path\n if path.include? 'public' # path is absolute\n FileUtils.mkdir_p(\"#{path}\")\n else # path is relative\n FileUtils.mkdir_p(\"#{PUBLIC_IMAGES_ROOT}/#{path}\")\n end\n end",
"def mkdir(path)\n vprint_status(\"Creating directory #{path}\")\n if session.type == 'meterpreter'\n vprint_status(\"Meterpreter Session\")\n result = session.fs.dir.mkdir(path)\n else\n if session.platform == 'windows'\n result = cmd_exec(\"mkdir \\\"#{path}\\\"\")\n else\n result = cmd_exec(\"mkdir -p '#{path}'\")\n end\n end\n vprint_status(\"#{path} created\")\n register_dir_for_cleanup(path)\n result\n end",
"def mkdir( dir )\n dir = dir.empty? ? project : ::File.join( project, dir )\n unless File.directory?( dir )\n creating dir\n FileUtils.mkdir_p dir\n end\n end",
"def make_folder(path:, mode: \"644\", owner: nil, group: nil )\n @output.item @i18n.t('setup.mkdir', path: path)\n FileUtils::mkdir_p path unless File::exist? path\n FileUtils.chmod mode.to_i(8), path\n FileUtils.chown owner, group, path if owner and group\n end",
"def create_physical_directory(directory)\n # Use file Utils and create the directory.\n FileUtils.mkdir_p(directory) unless File.directory?(directory)\n end",
"def create_dir(path)\n is_file = File.file?(path)\n is_dir = File.directory?(path)\n\n # Check for existing file/dir, and offer to overwrite\n if is_file || is_dir\n puts \"File #{path} already exists.\" if is_file\n puts \"Directory #{path} already exists.\" if is_dir\n\n if prompt(\"WARNING: Existing #{path} will be deleted. Continue?\")\n puts \"Removing existing #{path} ...\"\n FileUtils.rm_rf(path)\n else\n puts \"Please use another directory.\"\n Process.exit\n end\n end\n\n puts \"Creating directory #{path} ...\"\n FileUtils.mkdir_p(path)\n end",
"def install!\n\t\t\traise \"Target exists\" if target.present?\n\n\t\t\t# Directory entry - create the directory\n\t\t\ttarget.mkpath\n\t\tend",
"def creatFolder(path)\n Dir.mkdir(path) unless File.exists?(path)\n end",
"def ensure_dir(dir_name)\n FileUtils::mkdir_p(dir_name)\n end",
"def create_directory\n components_dir = if shakapacker?\n Pathname.new(javascript_dir).parent.to_s\n else\n javascript_dir\n end\n empty_directory File.join(components_dir, \"components\")\n return if options[:skip_git]\n\n create_file File.join(components_dir, \"components/.keep\")\n end",
"def create_dir(dir)\n Dir.mkdir(dir) unless File.exists?(dir)\n end",
"def make_output_directory\n puts \"Making output directory\"\n # Double check that we don't clobber an existing dir\n if File.exists? @output_dir\n puts \"\\nSORRY! '#{ @output_dir }' directory already exists. Please try again.\\n\\n\"\n exit\n end\n FileUtils.mkdir_p @output_dir\n end",
"def mkdir(path)\n dir = File.dirname(path)\n if !File.directory?(dir)\n FileUtils.mkdir_p(dir)\n end\n end",
"def mkdir_p(path)\n FileUtils.mkdir_p(path)\n end",
"def mkdir_p(path)\n if !Dir::exist? path\n Dir::mkdir path\n end\nend",
"def make_directory(rev, full_path)\n if rev.path_exists?(full_path)\n raise Repository::FolderExistsConflict, full_path # raise conflict if path exists\n end\n creation_time = Time.current\n dir = Repository::RevisionDirectory.new(rev.revision_identifier, {\n name: File.basename(full_path),\n path: File.dirname(full_path),\n last_modified_revision: rev.revision_identifier,\n last_modified_date: creation_time,\n submitted_date: creation_time,\n changed: true,\n user_id: rev.user_id\n })\n rev.__add_directory(dir)\n rev\n end",
"def get_apk_dir\r\n url_dir = \"/apks/#{Time.now.strftime('%Y%m%d')}\"\r\n dir = \"public\" + url_dir\r\n Dir.mkdir(dir) if Dir[dir].size == 0\r\n url_dir\r\n end"
] |
[
"0.762671",
"0.7165527",
"0.7157186",
"0.7153562",
"0.71301025",
"0.7121114",
"0.7038211",
"0.69959074",
"0.68819857",
"0.6864578",
"0.6857136",
"0.68466306",
"0.6843986",
"0.6774119",
"0.6727233",
"0.6706691",
"0.67018026",
"0.6681632",
"0.6656103",
"0.6647229",
"0.6645504",
"0.66375744",
"0.6609971",
"0.65810144",
"0.65743655",
"0.65743655",
"0.6567592",
"0.656056",
"0.6559181",
"0.65343755",
"0.65247655",
"0.651916",
"0.6505439",
"0.6491339",
"0.6486254",
"0.648095",
"0.64768",
"0.6474224",
"0.6464299",
"0.64387375",
"0.6431724",
"0.6431042",
"0.63734525",
"0.63699853",
"0.6369098",
"0.6365317",
"0.63595897",
"0.63513124",
"0.6347394",
"0.6332804",
"0.63195616",
"0.63122",
"0.6310332",
"0.6307519",
"0.63065857",
"0.6305597",
"0.6300714",
"0.6289388",
"0.6265374",
"0.62546706",
"0.62466097",
"0.6246218",
"0.6242977",
"0.6242069",
"0.62289774",
"0.6223726",
"0.6216712",
"0.6215542",
"0.62087464",
"0.62079686",
"0.6202775",
"0.6171348",
"0.61663604",
"0.61658674",
"0.61613697",
"0.6158653",
"0.6156331",
"0.6152975",
"0.614242",
"0.6142136",
"0.61344784",
"0.6133002",
"0.6116801",
"0.6114897",
"0.6107789",
"0.6092789",
"0.60891855",
"0.6074744",
"0.60739535",
"0.606952",
"0.6065069",
"0.6061222",
"0.60570127",
"0.60525006",
"0.60502785",
"0.60455936",
"0.60420537",
"0.6039858",
"0.6027883",
"0.60278803"
] |
0.74310064
|
1
|
If you want all lines of the string to be indented a specific amount
|
def indent_all_lines(str, spaces = 2)
return '' if str.nil? || str.blank?
str.strip.split(/\n/).map { |line| optimize_indentation(line, spaces.to_i) }.join('')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def indent_for(line); end",
"def indent(str, amount=2)\n i = (\" \"*amount)\n (i + str.gsub(/\\n/, \"\\n#{i}\")).rstrip\n end",
"def indent(string, amt)\n string.gsub /\\n *([^\\n]+)/m, \"\\n#{' ' * amt}\\\\1\"\n end",
"def indent(str, count = 2)\n str = require_string! str\n pre = ' ' * count\n\n map_lines(str) { |line| \"#{pre}#{line}\" }\n end",
"def indent(string, n)\n tabs = \"\\t\" * n\n wrap = screen_width - (n * 8) - 1\n\n tabs + string.gsub(/(.{1,#{wrap}})(\\s+|\\Z)/, \"\\\\1\\n#{tabs}\").rstrip\n end",
"def indent string, amount\n indent_string = ' ' * amount * INDENT_DEPTH\n string.gsub(/^/, indent_string)\n end",
"def indent(str, depth=2)\n space = \" \"*depth\n str.split(\"\\n\").join(\"\\n#{space}\").gsub(/^ *$/, \"\")\n end",
"def write_indented_lines(where, lines_string, indent_amount)\n lines_as_array = lines_string.split(/\\r|\\n|\\r\\n/)\n lines_as_array.each do |line|\n where << \" \" * indent_amount\n where.puts line\n end\n end",
"def indent!(amount, indent_string = nil, indent_empty_lines = false)\n indent_string = indent_string || self[/^[ \\t]/] || ' '\n re = indent_empty_lines ? /^/ : /^(?!$)/\n gsub!(re, indent_string * amount)\n end",
"def indentation; end",
"def indentation; end",
"def indentize!(count, char = ' ')\n tap do |s|\n s.gsub!(/([^\\n]*)(\\n|$)/) do\n s1 = Regexp.last_match(1)\n s2 = Regexp.last_match(2)\n not_empty = s1 != '' || s2 != ''\n \"#{char * count}#{s1}#{s2}\" if not_empty\n end\n end\n end",
"def indent!(amount, indent_string=nil, indent_empty_lines=false)\n indent_string = indent_string || self[/^[ \\t]/] || ' '\n re = indent_empty_lines ? /^/ : /^(?!$)/\n gsub!(re, indent_string * amount)\n end",
"def indent_string(level = 0)\n INDENT * level\n end",
"def indent(str, indent=' ')\n str.split(\"\\n\").collect do |frag|\n \"#{indent}#{frag}\"\n end.join(\"\\n\")\n end",
"def optimize_indentation(value, amount = 0)\n return \"#{value}\\n\" unless value.is_a?(String)\n \"#{value.strip_heredoc.indent(amount).chomp}\\n\"\n end",
"def optimize_indentation(value, amount = 0)\n return \"#{value}\\n\" unless value.is_a?(String)\n \"#{value.strip_heredoc.indent(amount).chomp}\\n\"\n end",
"def indent_string\n s = \"\"\n @indentCount += 1\n s += \" \" * @indentCount\n end",
"def indent; end",
"def indent; end",
"def indent; end",
"def indent; end",
"def indent; end",
"def indent_each_line!(indent_sequence=\"\\t\")\n\t\treturn self.collect!{ |line|\t\"#{indent_sequence}#{line}\" }\n\tend",
"def indent(txt, n = 2)\n \"#{' ' * n}#{txt}\"\n end",
"def with_indent ()\n thread[:indent] += 1\n yield\n ensure\n thread[:indent] -= 1\n end",
"def indent(amount, indent_string=nil, indent_empty_lines=false)\n dup.tap {|_| _.indent!(amount, indent_string, indent_empty_lines)}\n end",
"def indent(str,n)\n return '' unless str\n if n >= 0\n str.gsub(/^/, ' ' * n)\n else\n str.gsub(/^ {0,#{-n}}/, \"\")\n end\n end",
"def indented_puts(string, indent_level)\n puts \"#{INDENT * indent_level}#{string}\"\n end",
"def optimize_indentation(value, amount = 0) # :doc:\n return \"#{value}\\n\" unless value.is_a?(String)\n\n if value.lines.size > 1\n value.strip_heredoc.indent(amount)\n else\n \"#{value.strip.indent(amount)}\\n\"\n end\n end",
"def indent(n)\n indent = \" \" * n\n gsub '\\n', \"\\n#{indent}\"\n end",
"def _outdent str, rexp\n return if %r(\\A \\r?\\n )x.match str\n return if str.sub! rexp, ''\n raise \"line not indented at #{str[0..20].inspect}\"\n end",
"def indent(amount, indent_string = nil, indent_empty_lines = false)\n dup.tap { |_| _.indent!(amount, indent_string, indent_empty_lines) }\n end",
"def indent1\n ' ' * 2\n end",
"def indentation\n \" \" * @indent_size * @indent_level\n end",
"def indent2(str, count)\n if str\n char = ' '\n #(char * count) + gsub(/(\\n+)/) { $1 + (char * count) }\n str.gsub(/(\\n+)/) { $1 + (char * count) }\n end\n end",
"def puts_indent(level, text)\n print \" \"*level, text, \"\\n\"\nend",
"def format_lines(lines, indentation)\n lines.gsub(/\\n/, \"\\n\" + indentation)\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 indent( text, spaces=4 )\n\t\tprefix = ' ' * spaces\n\t\treturn text.gsub( /(?<=\\A|\\n)/m, prefix )\n\tend",
"def indent(str, spaces)\n str.split(\"\\n\").map { |s| (' ' * spaces) + s }.join(\"\\n\")\n end",
"def indent()\n #This is a stub, used for indexing\n end",
"def indent_string(string, *args)\n string = string.dup\n indent_string!(string, *args)\n string\n end",
"def insert_indentation(line, indentation)\n line ? \" \" * indentation + line.to_s : \"\"\n end",
"def formatIndents(theLines)\n\n\ttheLines.each do |theLine|\n\t\n\t\tif (theLine[:text] =~ /^(\\s+)(.*)/)\n\t\t\ttextPrefix = $1;\n\t\t\ttextSuffix = $2;\n\t\t\t\n\t\t\tnumTabs = textPrefix.size / CONFIG_TAB_WIDTH;\n\t\t\tnumSpaces = textPrefix.size % CONFIG_TAB_WIDTH;\n\n\t\t\ttheLine[:text] = (\"\\t\" * numTabs) + (\" \" * numSpaces) + textSuffix;\n\t\tend\n\n\tend\n\t\n\treturn theLines;\n\nend",
"def indent_text( text, mod, first_line = true )\n\t\t\treturn \"\" if text.to_s.empty?\n spacing = indent( mod )\n text = text.gsub( /\\A([^\\n])/, \"#{ spacing }\\\\1\" ) if first_line\n\t\t\treturn text.gsub( /\\n^([^\\n])/, \"\\n#{spacing}\\\\1\" )\n\t\tend",
"def outdent(str)\n str =~ /\\A(?:\\s*?\\n)( *)(.*)\\z/m ? $2.gsub!(/^ {0,#{$1.length}}/, '') : str\n end",
"def indented\n \"#{INDENTATION * indents}#{original}\"\n end",
"def normalize_indentation text\n lines = text.split(\"\\n\")\n return text if lines.empty?\n\n indent = if lines[0] =~ /^(\\s+)(.+?)$/\n $1.length\n else\n 0\n end\n lines.map{|l| l[indent..-1]}.join \"\\n\"\n end",
"def indent(leader)\n leader =\n Numeric === leader ? ' ' * leader.to_i : leader.to_s\n str = self.gsub \"\\n\", \"\\n\"+leader\n str.insert 0, leader\n str\n end",
"def indent(n)\n if n >= 0\n gsub(/^/, ' ' * n)\n else\n gsub(/^ {0,#{-n}}/, \"\")\n end\n end",
"def indent(n)\n if n >= 0\n gsub(/^/, ' ' * n)\n else\n gsub(/^ {0,#{-n}}/, \"\")\n end\n end",
"def looper\r\n for i in 1..10\r\n puts i #Should be indented.\r\n end\r\nend",
"def indent(amount, indent_string = nil, indent_empty_lines = false)\n dup.tap { |d| d.indent!(amount, indent_string, indent_empty_lines) }\n end",
"def indent( mod = nil )\n #p [ self.id, level, mod, :INDENT ]\n if level <= 0\n mod ||= 0\n else\n mod ||= options(:Indent)\n mod += ( level - 1 ) * options(:Indent)\n end\n return \" \" * mod\n\t\tend",
"def word_wrap(text, indent=0)\n chars = text.split(//)\n unless text.length < 80\n count = 1\n last_space = 80\n chars.each_with_index do |char, index|\n count += 1\n last_space = index if char.match(/ /)\n if char == \"\\n\"\n count = indent\n elsif count == 80\n chars[last_space] = \"\\n#{\" \" * indent}\"\n count = indent + index - last_space\n end\n end\n end\n chars.join\n end",
"def outdent(text)\n lines = text.split(\"\\n\")\n indented_with = /^ +/.match(lines.first)[0]\n lines.map { |line| line.gsub(/^#{indented_with}/, '') }.join(\"\\n\") + \"\\n\"\n end",
"def indentation_pattern()\n return /^(?: \\t)+/\n end",
"def indent\n @__indent__ ||= 0\n @__indent__ += indentation\n end",
"def indent(n)\n if n >= 0\n gsub(/^/, ' ' * n)\n else\n gsub(/^ {0,#{-n}}/, \"\")\n end\n end",
"def wrap(s, width=80)\n s.gsub(/(.{1,#{width}})(\\s+|\\Z)/, \"\\\\1\\n\")\nend",
"def indent str\n if @format == :markdown\n ' ' + CGI.escapeHTML(str)\n else\n if str.end_with?(\"</li>\")\n str\n else\n \"<br />\" + str\n end\n end\nend",
"def _IndentedLine\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_Indent)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_Line)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_IndentedLine unless _tmp\n return _tmp\n end",
"def level_of_indent\n self.scan(/^ *(?=\\S)/).map { |space| space.length }.min || 0\n end",
"def level_of_indent\n self.scan(/^ *(?=\\S)/).map { |space| space.length }.min || 0\n end",
"def unindent str\n lines = str.split(\"\\n\")\n spaces = minimum_leading_spaces lines\n lines.collect do |line|\n line.slice(spaces, line.length).rstrip\n end.join(\"\\n\")\n end",
"def indentation_level\n spaces = (@source.size - @stripped_source.size)\n spaces == 0 ? 0 : spaces / 2\n end",
"def line_wrap(strs, first_indent, rest_indent, max_len)\n\n # First, tokenize the strings\n words = []\n strs.each do |str|\n if str =~ /\\A</\n # String is a tag; treat as atomic unit and don't split\n words << str\n else\n # String of white and non-white tokens.\n # Tokenize into white and non-white tokens.\n str.scan(/\\S+|\\s+/).each { |word| words << word }\n end\n end\n\n # Now merge tokens that are not separated by whitespace tokens. For\n # example, \"<i>\", \"word\", \"</i>\" gets merged to \"<i>word</i>\". But\n # \"<i>\", \" \", \"word\", \" \", \"</i>\" gets left as separate tokens.\n\n words2 = []\n words.each do |word|\n # If there is a previous word that does not end with whitespace,\n # and the currrent word does not begin with whitespace, concatenate\n # current word to previous word. Otherwise append current word to\n # end of list of words.\n if words2.last && words2.last !~ /\\s\\z/ && word !~ /\\A\\s/\n words2.last << word\n else\n words2 << word\n end\n end\n\n lines = [ ]\n line = \"\"\n llen = 0\n # set the indent for the first line\n indent = first_indent\n # saved-up whitespace to put before next non-white word\n white = \"\"\n \n words2.each do |word| # ... while words remain to wrap\n # If word is whitespace, save it. It gets added before next\n # word if no line-break occurs.\n if word =~ /\\A\\s/\n white << word\n next\n end\n wlen = word.size\n if llen == 0\n # New output line; it gets at least one word (discard any\n # saved whitespace)\n line = \" \" * indent + word\n llen = indent + wlen\n indent = rest_indent\n white = \"\"\n next\n end\n if llen + white.length + wlen > max_len\n # Word (plus saved whitespace) won't fit on current line.\n # Begin new line (discard any saved whitespace).\n lines << line\n line = \" \" * indent + word\n llen = indent + wlen\n indent = rest_indent\n white = \"\"\n next\n end\n # add word to current line with saved whitespace between\n line << white + word\n llen += white.length + wlen\n white = \"\"\n end\n \n # push remaining line, if any\n lines << line unless line.empty?\n \n return lines\n end",
"def outdent( str )\n\t\t\tstr.gsub( /^(\\t|[ ]{1,#{TabWidth}})/, '')\n\t\tend",
"def indent=(_arg0); end",
"def indent!(num)\n replace( ' ' * num + self.gsub(\"\\n\", \"\\n\"+' '*num))\n self\n end",
"def indent(code, level = 2)\n lines = case code\n when String then code.split(\"\\n\")\n when BlocklyInterpreter::Block then start_block_to_dsl(code).split(\"\\n\")\n when Array then deep_flatten(code).compact.flat_map { |code| code.split(\"\\n\") }\n else code\n end\n\n lines.map { |line| (\" \" * level) + line }.join(\"\\n\")\n end",
"def outdent(n)\n indent(-n)\n end",
"def outdent(n)\n indent(-n)\n end",
"def indentation(indent_str)\n puts \" indentation #{indent_str.inspect}\" if @debug\n puts \" block_indentation: #{@block_indentation.inspect}\" if @debug\n @last_indentation = indent_str\n\n # if it's an indent and we know where to go next,\n # push that state. otherwise, push content and\n # clear the block state.\n if @block_state &&\n indent_str.start_with?(@block_indentation) &&\n indent_str != @block_indentation\n\n push @block_state\n else\n @block_state = @block_indentation = nil\n push :content\n end\n end",
"def unindent(text)\n lines = text.split(\"\\n\")\n lines.shift while lines.first =~ /^\\s*$/ && !lines.empty?\n lines.pop while lines.last =~ /^\\s*$/ && !lines.empty?\n min_indent = lines.reject { |ln| ln =~ /^\\s*$/ }\n .map { |ln| ln.scan(/^\\s*/) }.flatten.map(&:length).min\n lines.map { |ln| ln.sub(/^\\s{#{min_indent}}/, '') }.join(\"\\n\")\nend",
"def align(input_strings, type)\n\tindents = [];\n\tfor i in 0..input_strings.size-1 do\n\t\tinput_strings[i] ||= \"\";\n\tend\n\n\tinput_strings.each {|str| indents.push(get_indent(str)); }\n\tgroups = [];\n\tindent_by_group = [];\n\n\tgroups.push([input_strings[0]]);\n\tindent_by_group.push(indents[0]);\n\tprev_indent = indents[0];\n\n\tfor i in 1..indents.size-1 do\n\t\tif input_strings[i].strip.size == 0 then\n\t\t\t\tgroups.push([\"\"]);\n\t\t\t\tindent_by_group.push(indents[i]);\n\t\t\t\tprev_indent = nil;\n\t\telse\n\t\t\tif prev_indent == indents[i] then\n\t\t\t\tgroups.last.push(input_strings[i]);\n\t\t\telse\n\t\t\t\tgroups.push([input_strings[i]]);\n\t\t\t\tindent_by_group.push(indents[i]);\n\t\t\t\tprev_indent = indents[i]\n\t\t\tend\n\t\tend\n\tend\n\n\tputs \"groups.size: #{groups.size}\"if $DEBUG_project > 0\n\tresult = [];\n\tgroups.each_with_index do |group, i|\n\t\tif group.size > 1 then\n\t\t\tgroup_res = align_group(group, type);\n\t\t\tresult += group_res.map{|x| indent_by_group[i] + x }\n\t\telse\n\t\t\tresult.push(indent_by_group[i] + group[0].strip)\n\t\tend\n\tend\n\treturn result\n\nend",
"def indented\n buffer = buffer()\n buffer.indent\n nl\n yield\n nl\n buffer.unindent\n end",
"def summary_indent(i_string=nil)\n if i_string\n @summary_indent = i_string\n else\n @summary_indent ||= ' ' * 4\n @summary_indent\n end\n end",
"def indent_width(txt)\n txt.match(/\\A\\s*/).to_s.length\n end",
"def resource_indentation(depth)\n indent_str = ''\n (depth - 2).times do | i |\n indent_str << content_tag(:span, '',\n { :class => 'indent' })\n end\n if depth > 1\n indent_str << content_tag(:span, image_tag('/shapes/images/list/tab.png'),\n { :class => 'indent' })\n end\n indent_str\n end",
"def indent(line, index)\n unless line.match(/(^$|^\\S|^( )+\\S)/)\n add_spacing_issue\n @final_spacing_string += \"indentation spacing issue at line #{index} \\n\"\n return \"indentation spacing issue at line #{index} \\n\"\n end\n nil\n end",
"def code_format_print(code)\n indent = 0\n l = 1\n code.each_line do |ln|\n ln = ln.strip\n if(ln.match(/^end/))\n indent -= 4\n end\n indent = 0 if indent < 0\n ll = \" \"\n if(l<10)\n ll = \"00#{l} \"\n elsif(l<100)\n ll = \"0#{l} \"\n else\n ll = \"#{l} \"\n end\n l += 1\n\n puts ll + \" \"*indent + ln\n\n if(ln.match(/^class/))\n indent += 4\n elsif(ln.match(/^def/))\n indent += 4\n elsif(ln.match(/do$/))\n indent += 4\n end\n\n if(ln.match(/end$/) && !ln.match(/^end/))\n indent -= 4\n end\n end\nend",
"def indent_atom; \" \"; end",
"def level_print(message, count)\n\n if count > 0\n indention = \"\"\n indention += \" \" until indention.length() == 2*count\n print indention\n end\n\n puts message\nend",
"def indentation(indent_str)\n puts \" indentation: #{indent_str.inspect}\" if @debug\n puts \" block_indentation: #{@block_indentation.inspect}\" if @debug\n @last_indentation = indent_str\n\n # if it's an indent and we know where to go next,\n # push that state. otherwise, push content and\n # clear the block state.\n if (@block_state &&\n indent_str.start_with?(@block_indentation) &&\n indent_str != @block_indentation\n )\n push @block_state\n else\n @block_state = @block_indentation = nil\n push :content\n end\n end",
"def tidy(data)\n indent = 0\n data.split(/\\n/).map do |line|\n line.gsub!(/^\\s*/, '')\n next if line.empty?\n indent -= 1 if line =~ /^\\s*\\}\\s*$/\n line = (' ' * (indent * 2)) + line\n indent += 1 if line =~ /\\{\\s*$/\n line\n end.compact.join(\"\\n\") + \"\\n\"\n end",
"def fixed_indent(n)\n self.outdent(self.level_of_indent).indent(n)\n end",
"def indent\n\t\tif @marked\n\t\t\tmark_row,row = ordered_mark_rows\n\t\t\tblock_indent(mark_row,row)\n\t\telse\n\t\t\taddchar(?\\t)\n\t\tend\n\tend",
"def haml_indent\n ' ' * haml_buffer.tabulation\n end",
"def unindent(txt, n = 2)\n txt.gsub /^[ ]{#{n}}/, ''\n end",
"def _OptionallyIndentedLine\n\n _save = self.pos\n while true # sequence\n _save1 = self.pos\n _tmp = apply(:_Indent)\n unless _tmp\n _tmp = true\n self.pos = _save1\n end\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_Line)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_OptionallyIndentedLine unless _tmp\n return _tmp\n end",
"def wrap_text(s, width=78) # {{{\n return nil unless s\n\ts.gsub(/(.{1,#{width}})(\\s+|\\Z)/, \"\\\\1\\n\").split(\"\\n\")\nend",
"def unindent(s)\n s.gsub(/^#{s.scan(/^[ \\t]+(?=\\S)/).min}/, \"\")\n end",
"def increment_indent\n\t\t\t@indent[-1] += 1\n\t\tend",
"def test_2_tabs_indent_level_should_be_4\n @buffer = Buffer.new ' hello world'\n assert_eq @buffer.indent_level, 4\n end",
"def set_default_indent(line)\n $default_indent = count_indent(line)\nend",
"def indent(indent, *s)\n \"#{\" \" * indent}#{s.join('')}\"\n end",
"def break_lines! hanging_indent=0\n @lines= ['']\n @sentences.each do |sentence|\n sentence.split(/ /).each do |term|\n # term is a single word that either contains hyphens or doesn't\n term.scan(/[^-]+-+|[^-]+|-+/) do |word|\n # word either contains no hyphens, ends in hyphens, or is only\n # hyphens\n width= @screenplay.text_width(@lines.last + word)\n # new line needed\n if width > self.width\n @lines.last.rstrip!\n indent_str= (' ' * hanging_indent)\n # if word is just hyphens, it shouldn't start a line. chop the\n # tail of the last line, move it to the front of the new line.\n if /^-+$/ =~ word\n tail= nil\n @lines.last.sub!(/\\s*[^\\s]+$/) do |match|\n tail= \"#{match} \"\n ''\n end\n @lines.pop if @lines.last.empty?\n @lines << indent_str + tail.lstrip\n else\n @lines << indent_str\n end\n end\n @lines.last << word\n end\n @lines.last << ' '\n end\n @lines.last << ' '\n end\n @lines.last.rstrip!\n if self.limit_to_one_line && @lines.size > 1\n raise \"pagination error: line too long: attempted to break #{self}\"\n end\n @lines\n end",
"def undent\n indent = split(\"\\n\").select { |line| !line.strip.empty? }.map { |line| line.index(/[^\\s]/) }.compact.min || 0\n gsub(/^[[:blank:]]{#{indent}}/, '').chomp\n end"
] |
[
"0.77238977",
"0.7602694",
"0.75793684",
"0.756106",
"0.74707",
"0.74628",
"0.7175614",
"0.7165967",
"0.71657765",
"0.71310896",
"0.71310896",
"0.71276176",
"0.7124178",
"0.7118115",
"0.70990145",
"0.706853",
"0.706853",
"0.70585597",
"0.6992529",
"0.6992529",
"0.6992529",
"0.6992529",
"0.6992529",
"0.6906145",
"0.69000363",
"0.68803066",
"0.6856174",
"0.6852416",
"0.68069094",
"0.6792576",
"0.6755869",
"0.67301124",
"0.6716734",
"0.6708983",
"0.670323",
"0.66985893",
"0.66879",
"0.66797644",
"0.6661145",
"0.6644482",
"0.6641786",
"0.66281164",
"0.6598514",
"0.6572696",
"0.65249354",
"0.65234745",
"0.64966524",
"0.6484362",
"0.6469595",
"0.646533",
"0.6460601",
"0.6459584",
"0.6449265",
"0.64436626",
"0.64312714",
"0.6429932",
"0.6393855",
"0.6382118",
"0.6378492",
"0.6358108",
"0.63512784",
"0.6302928",
"0.62978053",
"0.6297141",
"0.6297141",
"0.62863266",
"0.62737864",
"0.62677324",
"0.6265553",
"0.62547374",
"0.6250711",
"0.62489134",
"0.62404066",
"0.62404066",
"0.6235371",
"0.62332135",
"0.62302047",
"0.621727",
"0.62095016",
"0.6196061",
"0.6192383",
"0.6189535",
"0.6183699",
"0.6181429",
"0.6171263",
"0.6163112",
"0.61623216",
"0.61556137",
"0.61464334",
"0.61358225",
"0.61324656",
"0.612744",
"0.6065272",
"0.60540646",
"0.6044836",
"0.60378337",
"0.60365415",
"0.6010737",
"0.6007219",
"0.6004118"
] |
0.7347949
|
6
|
Used to add additional assets to be considered when compiling your assets
|
def add_to_assets(asset_str)
append_to_file('config/initializers/assets.rb', "Rails.application.config.assets.precompile += %w( #{asset_str} )\n") unless asset_str.blank?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def precompile_assets; end",
"def precompile_assets=(_arg0); end",
"def add_assets(paths)\n copy_assets(paths)\n characterize_assets\n create_or_update_assets\n end",
"def extra_asset_links\n lines = []\n if item.attributes.has_key?(:css)\n for stylesheet in item.attributes[:css]\n lines.push(\"<link href='/assets/css/#{stylesheet}.css'\"+\n \" type='text/css' rel='stylesheet'>\")\n end\n end\n if item.attributes.has_key?(:js)\n for script in item.attributes[:js]\n lines.push(\"<script type='text/javascript'\" +\n \" src='/assets/js/#{script}.js'></script>\")\n end\n end\n lines.join(\"\\n\")\nend",
"def extra_asset_links\n lines = []\n if item.attributes.has_key?(:css)\n for stylesheet in item.attributes[:css]\n lines.push(\"<link href='/assets/css/#{stylesheet}.css'\"+\n \" type='text/css' rel='stylesheet'>\")\n end\n end\n if item.attributes.has_key?(:js)\n for script in item.attributes[:js]\n lines.push(\"<script type='text/javascript'\" +\n \" src='/assets/js/#{script}.js'></script>\")\n end\n end\n lines.join(\"\\n\")\nend",
"def assets; end",
"def assets; end",
"def assets; end",
"def build_assets\n end",
"def set_assets\n\n @custom_csses = []\n @custom_javascripts = []\n\n\n action_hash = {\"create\" => \"new\", \"update\" => \"edit\"}\n file_name = action_hash[action_name] ? action_hash[action_name] : action_name\n root = Rails.root.to_s\n\n @custom_csses << \"compiled/application.css\" # always include the layout css\n @custom_csses << \"compiled/#{controller_name}/#{file_name}.css\" if File.exist?(\"#{root}/public/stylesheets/compiled/#{controller_name}/#{file_name}.css\")\n @custom_csses << \"compiled/#{controller_name}/all.css\" if File.exist?(\"#{root}/public/stylesheets/compiled/#{controller_name}/all.css\")\n\n\n @custom_javascripts << \"#{controller_name}/#{file_name}.js\" if File.exist?(\"#{root}/public/javascripts/#{controller_name}/#{file_name}.js\") # && !(\"#{file_name}.js\" == \"consumer_index.js\")\n @custom_javascripts << \"#{controller_name}/all.js\" if File.exist?(\"#{root}/public/javascripts/#{controller_name}/all.js\")\n\n # a trick to include facebox in the (devise-owned) registrations controller\n include_facebox if controller_name == 'registrations' && action_name == 'edit'\n\n end",
"def assets\n @assets ||= Dir[File.join(@resources_path, \"assets\", \"*.{js,css,ttf,eot,svg,woff,png,jpeg}\")]\n @assets << Dir[File.join(Emoji.images_path, \"emoji\", \"*.png\")]\n @assets\n end",
"def assets\n unless IO.read(\"app/assets/stylesheets/application.css\").include?(\"Required by SULChrome\")\n insert_into_file \"app/assets/stylesheets/application.css\", :after => \"/*\" do\n %q{\n * Required by SULChrome:\n *= require sul_chrome/sul_chrome_base\n *}\n end\n end\n unless IO.read(\"app/assets/javascripts/application.js\").include?(\"Required by SULChrome\")\n insert_into_file \"app/assets/javascripts/application.js\", :before => \"//= require_tree .\" do\n%q{// Required by SULChrome:\n//= require sul_chrome/sul_chrome_base\n}\n end\n end\n end",
"def precompile_assets\n if rails? && defined?(Rake)\n ::Rake::Task['assets:precompile'].enhance do\n svgs.map(&:build)\n end\n end\n end",
"def load_assets\n AssetManager.include_local_library [:application, :admin_layout_data_table]\n AssetManager.include_css [:application, :admin_layout, :colorbox]\n AssetManager.include_contrib_library [:colorbox]\n end",
"def assets_manifest; end",
"def assets_manifest; end",
"def assets_to_compile \n return @assets_to_compile if @assets_to_compile \n files = Dir.glob(prefix + \"**/*\").select {|f| File.file?(f)}\n files.collect! { |f| f.gsub(/^#{prefix}\\//, \"\") }\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 assets\n {\n css: css_assets,\n js: js_assets,\n image: image_assets\n }\n end",
"def load_assets\n\n # class method call to include js files\n Asset.include_local_library [:application, :pageFormAdmin, \"ckeditor/init\"]\n\n # class method call to include css files\n Asset.include_css [\"mcms_pages/pages\", \"mcms_pages/page_form\", \"mcms_pages/tabs\"]\n\n end",
"def project_assets\n assets = [\n ['style.css'],\n ['plugin.css'],\n ['admin.css'],\n ['javascripts', 'theme.js'],\n ['javascripts', 'plugin.js'],\n ['javascripts', 'admin.js']\n ]\n\n if project_config[:additional_assets]\n assets = assets | project_config[:additional_assets]\n end\n\n return assets\n end",
"def make_assets_relative!\n @style.gsub! \"url(/assets\", \"url(assets\"\n @style.gsub! \"url(../\", \"url(assets/\"\n end",
"def precompiled_assets(clear_cache = T.unsafe(nil)); end",
"def precompiled_assets(clear_cache = T.unsafe(nil)); end",
"def copy_assets; end",
"def add_vendor_files\n say_quietly \"Copying files...\"\n\n %w[auth backend frontend].each do |section|\n template \"vendor/assets/javascripts/archangel/#{section}.js\"\n template \"vendor/assets/stylesheets/archangel/#{section}.css\"\n end\n end",
"def assets=(_arg0); end",
"def assets=(_arg0); end",
"def assets=(_arg0); end",
"def assets\n\n javascript={}\n css={}\n\n Dir.glob(bower_asset_path+'/production/*.html').each { |path|\n next if files_omit.include?(File.basename(path))\n page = Nokogiri::HTML(open(path))\n javascript[path]=[]\n css[path]=[]\n page.css('script').each { |st|\n javascript[path] << st.attr('src').sub('../vendors/', '') if st.attr('src') && st.attr('src').start_with?('../')\n }\n page.css('link').each { |st|\n css[path] << st.attr('href').sub('../vendors/', '') if st.attr('rel') && st.attr('rel') == 'stylesheet'\n }\n }\n\n# Merge the lists of script and css references using array union\n javascript_src=[]\n javascript.values.map { |s| javascript_src = javascript_src | s }\n javascript_src.uniq!\n\n# Omit the references that we won't include in the gem\n javascript_omit.each { |s| javascript_src.delete(s) }\n\n css_src=[]\n css.values.map { |s| css_src = css_src | s }\n css_src.uniq!\n\n css_omit.each { |s| css_src.delete(s) }\n\n {\n javascript: javascript_src,\n css: css_src,\n }\n\nend",
"def asset_handler\n tags = String.new\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/icons.css\")\n if controller_name == \"rich_subscriptions\"\n tags << content_tag(:script, \"\", src: \"/javascripts/#{fingerprinted_asset('map')}.js\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/leaflet/leaflet.css\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/leaflet/leaflet-slider.css\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/leaflet/L.Control.Locate.min.css\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/#{fingerprinted_asset('map')}.css\")\n else\n tags << content_tag(:script, \"\", src: \"/javascripts/#{fingerprinted_asset('application')}.js\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/#{fingerprinted_asset('application')}.css\")\n end\n tags.html_safe\n end",
"def add_favicon_to_asset_path\n say_status(\"warning\", \"ADDING FAVICON TO ASSET PATH\", :yellow)\n\n append_to_file 'config/initializers/assets.rb' do\n 'Rails.application.config.assets.precompile += %w( favicon.ico )'\n end\n end",
"def add_assetfile\n create_file \"Assetfile\", <<-RUBY.strip_heredoc\n # NOTE: The Assetfile will eventually be replaced with an asset-pipeline\n # compatible API. This is mostly important so that plugins can easily\n # inject into the pipeline.\n #\n # Depending on demand and how the API shakes out, we may retain the\n # Assetfile API but pull in the information from the Rails API.\n\n input \"app/assets\"\n output \"public\"\n\n match \"*.js\" do\n concat \"application.js\"\n end\n\n match \"*.css\" do\n concat \"application.css\"\n end\n\n # copy any remaining files\n concat\n RUBY\n end",
"def precompile_app_assets\n puts 'Precompiling assets...'.yellow\n # make sure the Rails environment is loaded\n Rake.application['assets:environment'].invoke\n\n set_assets_path\n\n # once the assets have been cleared, recompile them into the tmp directory\n Rake.application['assets:precompile'].reenable\n Rake.application['assets:precompile'].invoke\n end",
"def assets\n if @assets.nil?\n @assets = AssetsTask.define_task(project._(:target, :main, :assets) => [])\n @assets.project = self\n project.task('assets').enhance([@assets])\n project.build.enhance([@assets])\n end\n @assets\n end",
"def asset_precompiled?(logical_path); end",
"def asset_precompiled?(logical_path); end",
"def assets_manifest=(_arg0); end",
"def assets_manifest=(_arg0); end",
"def webpack_assets_tag\n capture do\n concat javascript_pack_tag('manifest')\n concat javascript_pack_tag('lib')\n concat javascript_pack_tag('vendor')\n concat javascript_pack_tag('coursemology')\n end\n end",
"def should_compile_assets?\n diff.has_asset_changes? || !File.exist?('public/assets')\n end",
"def asset_modified(path)\n @task.say 'Recompiling assets'\n @builder.compile_assets\n end",
"def known_assets\n assets = Rails.application.config.assets.digests.to_a.flatten.map do |asset|\n [asset, \"#{asset}.gz\"]\n end.flatten\n assets + %w(manifest.yml sources_manifest.yml)\n end",
"def add_file_from_files(files, format)\n return false if files == []\n @@minified_files.concat files\n # return false if files.collect(&:error) != []\n contents = []\n\n key = files.join(':') + \":#{format}\"\n return @@cached_files[key] if @@cached_files[key]\n\n files.each do |file|\n # TODO: We need a better way of getting the compiled contents of a file.\n contents << parse_file(file, format)\n\n if format == :js\n contents << \";\"\n end\n end\n contents = contents.join(\"\\n\\n\\n\\n\")\n if format == :css\n engine = Sass::Engine.new(contents, syntax: :scss, style: :compressed)\n contents = engine.render\n elsif format == :js\n contents = Uglifier.compile(contents, mangle: false)\n end\n filename = Digest::MD5.hexdigest(contents)\n assets_directory = \"#{output_directory}/assets\"\n Dir.mkdir(assets_directory) unless Dir.exist?(assets_directory)\n file = add_file(\"assets/#{filename}.#{format}\", contents, files)\n # file.source_files = files # TODO\n\n @@cached_files[key] = file\n\n file\n end",
"def concatenate_and_tag_images(paths)\n stylesheets = [paths].flatten.map do |css_path|\n File.read(css_path).gsub(IMAGE_DETECTOR) do |url|\n image_path = public_path($1, css_path)\n valid_image(image_path) ? \"url(__EMBED__#{image_path})\" : url\n end\n end\n stylesheets.join(\"\\n\")\n end",
"def request_debug_assets?; end",
"def request_debug_assets?; end",
"def generate_assets\n raise NotImplementedError\n end",
"def asset_file?; end",
"def asset_file?; end",
"def asset_include(assets=[\"js\", \"css\"])\n assets.each do |el|\n case el\n when \"js\"\n tag = \"javascript_include_tag\"\n when \"css\"\n tag = \"stylesheet_link_tag\"\n else\n raise \"Bad Asset Type. Must be CSS or JS.\"\n end\n eval <<-EOL\n def #{el}_include(files)\n return if files.nil?\n buffer = []\n files.each do |f|\n buffer << #{tag}(f)\n end\n buffer.join(\"\\n\")\n end\n EOL\n end\n end",
"def precompile_assets?\n !File.exist? \"public/assets/manifest.yml\"\n end",
"def run\n app, config = @app, @app.config\n return unless app.assets\n\n config.assets.paths.each { |path| app.assets.append_path(path) }\n\n if config.assets.compress\n # temporarily hardcode default JS compressor to uglify. Soon, it will work\n # the same as SCSS, where a default plugin sets the default.\n unless config.assets.js_compressor == false\n js_compressor = config.assets.js_compressor || :uglifier\n app.assets.js_compressor = LazyCompressor.new { Sprockets::Rails::Compressors.registered_js_compressor(js_compressor) }\n end\n\n unless config.assets.css_compressor == false\n css_compressor = config.assets.css_compressor\n app.assets.css_compressor = LazyCompressor.new { Sprockets::Rails::Compressors.registered_css_compressor(css_compressor) }\n end\n end\n\n if config.assets.compile\n app.routes.prepend do\n mount app.assets => config.assets.prefix\n end\n end\n\n if config.assets.digest\n app.assets = app.assets.index\n end\n end",
"def precompile_app_assets\n puts \"Precompiling assets...\"\n\n # make sure the Rails environment is loaded\n ::Rake.application['environment'].invoke\n\n # temporarily set the static assets location from public/assets to our spec directory\n ::Rails.application.assets.static_root = Rails.root.join(\"spec/javascripts/generated/assets\")\n\n # rake won't let you run the same task twice in the same process without re-enabling it\n\n # once the assets have been cleared, recompile them into the spec directory\n ::Rake.application['assets:precompile'].reenable\n ::Rake.application['assets:precompile'].invoke\n end",
"def load_css\n AssetManager.include_css [:blog_home, :home]\n end",
"def asset_paths\n @asset_paths ||= [prefix] \n end",
"def load_assets *assets_and_opts\n opts = assets_and_opts.last.is_a?(Hash) ? assets_and_opts.pop : {}\n if base = opts[:from]\n # using base URL only if given path does not start with a protocol or a slash\n base = assets_url(base) unless base =~ /\\A[\\w|\\d]+\\:\\/\\/|\\A\\//\n else\n base = assets_url\n end\n html = ''\n assets_and_opts.each do |asset|\n ext = ::File.extname(asset)\n src = base + asset\n # passing URL as :src opt instead of first argument\n # to avoid redundant `assets_url` calling\n html << script_tag(:src => src ) if ext == '.js'\n html << style_tag( :src => src ) if ext == '.css'\n end\n html\n end",
"def inline_asset(*names)\n old = sprockets.css_compressor, sprockets.js_compressor\n sprockets.js_compressor = :uglifier\n sprockets.css_compressor = :scss\n dat = names.map { |name| sprockets[name].to_s }.reduce(:+)\n sprockets.css_compressor, sprockets.js_compressor = old\n dat.gsub(' !important', '')\n end",
"def assets\n []\n end",
"def local_compiled_assets \n @manifest.files.keys.map {|f| File.join(@prefix, f)} \n end",
"def add_static_files(site, assets_dir)\n relative_assets_dir = assets_dir.relative_path_from(site.source).to_s\n vite_static_files = Dir.chdir(assets_dir.to_s) {\n Dir.glob('**/*').select { |f| File.file?(f) }\n }.map { |file|\n ViteAssetFile.new(site, site.source, relative_assets_dir, file)\n }\n site.static_files.concat(vite_static_files)\n end",
"def run\n app, config = @app, @app.config\n return unless app.assets\n\n config.assets.paths.each { |path| app.assets.append_path(path) }\n\n if config.assets.compress\n # temporarily hardcode default JS compressor to uglify. Soon, it will work\n # the same as SCSS, where a default plugin sets the default.\n unless config.assets.js_compressor == false\n app.assets.js_compressor = LazyCompressor.new { expand_js_compressor(config.assets.js_compressor || :uglifier) }\n end\n\n unless config.assets.css_compressor == false\n app.assets.css_compressor = LazyCompressor.new { expand_css_compressor(config.assets.css_compressor) }\n end\n end\n\n if config.assets.compile\n app.routes.prepend do\n mount app.assets => config.assets.prefix\n end\n end\n\n if config.assets.digest\n app.assets = app.assets.index\n end\n end",
"def assets\n content_mappings.collect{|mapping| mapping.asset }\n end",
"def add_extra_files(*files); end",
"def compile_sprockets_assets\n manifest.compile(*self.assets_to_compile)\n end",
"def ignore_assets\n ret = []\n ret << [\"assets/styles/atoms/flex\", \"assets/styles/atoms/flex/*\"]\n ret << [\"assets/styles/styleguide\", \"assets/styles/styleguide/**/*\"]\n ret << \"assets/styles/**/*.liquid\"\n ret << \"assets/styles/**/*.css\"\n ret << \"assets/styles/*.scss\"\n ret\n end",
"def assets\n @assets ||= begin\n Sass.load_paths << File.join(site_root, 'assets/stylesheets')\n Sprockets::Environment.new.tap do |environment|\n environment.register_engine '.sass', Sprockets::Sass::SassTemplate\n environment.register_engine '.scss', Sprockets::Sass::ScssTemplate\n environment.append_path File.join site_root, 'assets/images'\n environment.append_path File.join site_root, 'assets/javascripts'\n environment.append_path File.join site_root, 'assets/stylesheets'\n environment.context_class.class_eval { include AssetExtensions }\n end\n end\n end",
"def addStaticLibFile(fileName)\n Makr.cleanPathName(fileName)\n @extraStaticLibs.push(fileName) if not @extraStaticLibs.include?(fileName)\n end",
"def copy_public_assets \n generate \"blacklight:assets\"\n end",
"def assets\n @assets ||= []\n end",
"def precompiled_assets(clear_cache = false)\n @precompiled_assets = nil if clear_cache\n @precompiled_assets ||= assets_manifest.find(config.assets.precompile).map(&:logical_path).to_set\n end",
"def add_asset(asset)\n @al_asset_group.addAsset(asset.al_asset)\n end",
"def assets\n @assets = nil unless production?\n\n @assets ||= Sprockets::Environment.new(@root) do |env|\n env.version = ENV[\"RACK_ENV\"]\n\n env.append_path(File.join(\"app\", \"assets\"))\n env.append_path(File.join(\"vendor\", \"assets\"))\n\n # compress everything in production\n if production?\n env.js_compressor = YUI::JavaScriptCompressor.new(:munge => true)\n env.css_compressor = YUI::CssCompressor.new\n end\n end\n end",
"def add_post_deploy_resources\n if new_resource.precompile_assets\n app_local = app\n username = user_username\n ruby_block 'precompile assests' do\n block do\n require 'bundler'\n bundle_precompile_command = \"sudo su - #{username} -c 'cd #{app_local.release_path} \"\\\n \"&& source ./.env && #{app_local.bundle_binary} exec rake #{new_resource.precompile_command}'\"\n\n Bundler.clean_system(bundle_precompile_command)\n raise('Bundle pre-compile failed') unless $CHILD_STATUS.exitstatus.zero?\n end\n action :nothing\n subscribes :run, \"deploy_revision[#{new_resource.name}]\", :immediate\n end\n end\n\n super\n end",
"def _assets path, domain = '/'\n\t\t\"#{domain}_assets/#{path}\"\n\tend",
"def include_individual_stylesheets(bundles=[])\n tags = []\n bundles.each do |bundle| \n tags.concat bundle.files.map { |css| stylesheet_link_tag(css.path) }\n end\n tags.join(\"\\n\")\n end",
"def push_assets\n PUSH_ASSETS\n end",
"def asset_files\n asset_files = []\n Find.find(assets_path).each do |path|\n next if File.directory?(path)\n next if path.include?(stylesheets_path) || path.include?(images_path)\n asset_files << path.sub(assets_path, 'assets')\n end\n asset_files\n end",
"def load_js\n AssetManager.include_contrib_library [:core_ui, :jquery_tab]\n AssetManager.include_local_library [ 'ckeditor/init']\n\n AssetManager.include_css [:blog_global]\n end",
"def assets_path\n @assets_path ||= 'assets'\n end",
"def g_apply_includes\n g = Guilded::Guilder.instance\n g.generate_asset_lists\n\n # JavaScript\n if g.production? && g.use_remote_jquery\n js_groups = g.combined_js_srcs.partition { |src| src == g.jquery_js }\n output = javascript_include_tag( g.jquery_remote_url )\n output << javascript_include_tag( js_groups[1], :cache => \"cache/#{g.js_cache_name}\" ) unless js_groups[1].nil?\n else\n output = javascript_include_tag( g.combined_js_srcs, :cache => \"cache/#{g.js_cache_name}\" )\n end\n output\n end",
"def compile_assets\n self.class.boot_rails\n return false unless self.class.rails_booted\n begin\n clean\n precompile\n true\n rescue => e\n puts \"An error occurred compiling assets: #{e}\"\n false\n ensure\n ::Rails.application.assets.instance_eval { expire_index! }\n end\n end",
"def compile_assets\n boot_rails\n run_compiler\n \n !failed?\n end",
"def compile_assets\n boot_rails\n run_compiler\n \n !failed?\n end",
"def recompile_assets!(compiler)\n compiler.reset!\n compiler.compile!\n compiler.assets.each do |a|\n path_and_name = a.path == '' ? a.name : \"#{a.path}/#{a.name}\"\n @@asset_hashes[path_and_name] = a.current_hash\n end\n end",
"def required_assets\n @required_assets ||= []\n end",
"def prepare_asset(assets, asset, name, subname = nil)\n return if asset.start_with?(asset_root)\n\n if subname.nil?\n assets[name] = \"#{asset_root}/#{asset}\"\n else\n assets[name][subname] = \"#{asset_root}/#{asset}\"\n end\n end",
"def add_icons\n icon_path = 'assets/images/icons/'\n s = add_apple_icons(icon_path)\n b = '<link rel=\"icon\" type=\"image/png\" sizes=\"'; j = %(\" href=\"#{icon_path})\n s + %(\n #{b}192x192#{j}android-icon-192x192.png\">\n #{b}32x32#{j}favicon-32x32.png\">\n #{b}96x96#{j}favicon-96x96.png\">\n #{b}16x16#{j}favicon-16x16.png\">\n <link rel=\"manifest\" href=\"#{icon_path}manifest.json\">\n <meta name=\"msapplication-TileColor\" content=\"#ffffff\">\n <meta name=\"msapplication-TileImage\" content=\"#{icon_path}ms-icon-144x144.png\">)\nend",
"def asset_precompiled?(logical_path)\n if precompiled_assets.include?(logical_path)\n true\n elsif !config.cache_classes\n # Check to see if precompile list has been updated\n precompiled_assets(true).include?(logical_path)\n else\n false\n end\n end",
"def ext\n respond_to do |format|\n format.js {\n render :text => Netzke::Core::DynamicAssets.ext_js\n }\n\n format.css {\n render :text => Netzke::Core::DynamicAssets.ext_css\n }\n end\n end",
"def precompile_app_assets\n puts \"Precompiling assets...\"\n\n # Hack: needed to preserve the 'app' namespace, else\n # actionpack-3.1.0.rc6/lib/sprockets/assets.rake would run \"rake assets:precompile\"\n # see :precompile task therein\n ENV[\"RAILS_GROUPS\"] = 'assets'\n ENV[\"RAILS_ENV\"] = 'development'\n \n # In the mountable engine, all app rake tasks have been namespaced under \"app\"\n # make sure the Rails environment is loaded\n ::Rake.application['environment'].invoke\n\n # Rails 3.1 final stores the precompiled assets in the following path:\n # target = Pathname.new(File.join(Rails.public_path, config.assets.prefix))\n # (code taken from actionpack-3.1.0/lib/sprockets/assets.rake)\n # In the gem, Rails.public_path will point to the dummy_app's public path.\n # We need to set this such that the precompiled assets wind up in our spec directory.\n ::Rails.application.config.assets.prefix = \"../spec/javascripts/generated/assets\"\n ::Rails.application.config.assets.manifest = Rails.root.join(\"spec/javascripts/generated/assets\")\n # Note: we use 'execute' rather than 'invoke' for the following commands,\n # because invoke will only run once, but execute runs every time.\n ::Rake.application['assets:clean'].execute\n \n # once the assets have been cleared, recompile them into the spec directory\n ::Rake.application['assets:precompile'].execute \n end",
"def append_tenant_theme_to_assets(*assets)\n assets.map! do |asset|\n if should_add_tenant_theme_to_asset?(asset) && current_tenant\n \"#{current_tenant.themes.first}/#{asset}\"\n else\n asset\n end\n end\n assets\n end",
"def assets\n \n if !params[:path].blank? or !params[:format].blank?\n if get_from_asset_folder\n return\n else\n render_404 and return\n end\n end\n end",
"def asset_resolver_strategies; end",
"def asset_resolver_strategies; end",
"def init_config\n config('asset_dest', 'assets')\n config('keep_files', []).push(config('asset_dest'))\n end",
"def _precompiled_asset_metadata(file)\n CompiledAssetsHash.new.replace(super)\n end",
"def add_compressed_routes!\n assets.packages.each do |name, package|\n get package.route_regex do\n if defined?(settings.assets.app.clear_tilt_cache) && settings.assets.app.clear_tilt_cache\n AssetPack.clear_tilt_cache!(@template_cache, settings.assets.app)\n end\n\n mtime, contents = @template_cache.fetch(package.path) {\n [ package.mtime, package.minify ]\n }\n\n content_type package.type\n last_modified mtime\n assets_expires\n contents\n end\n end\n end",
"def copy_assets\r\n FileUtils.cd('view') do\r\n %w[style.css napoli.png ferraro.svg].each do |name|\r\n FileUtils.cp(name, File.join('..', 'output', name))\r\n end\r\n end\r\nend",
"def update_asset_settings!\n AssetSettings[:development].files[@file_id] = @sfiles.map(&:local_url)\n return unless AssetMapper.compile?\n\n AssetSettings[:production].files[@file_id] = @cloud_files.map(&:production_url)\n AssetSettings[:production].files[@file_id] << @tfile.production_url if @tfile.production_url\n\n AssetSettings[:local_assets].files[@file_id] = @cloud_files.map(&:local_url)\n AssetSettings[:local_assets][@file_id] << @tfile.local_url if @tfile.local_url\n end"
] |
[
"0.7377304",
"0.72177356",
"0.7204855",
"0.71728927",
"0.7171373",
"0.714031",
"0.714031",
"0.714031",
"0.69778085",
"0.6976124",
"0.6918127",
"0.69025934",
"0.69012356",
"0.6818183",
"0.68151057",
"0.6813914",
"0.67877734",
"0.6784348",
"0.6774915",
"0.6630029",
"0.66153955",
"0.6613085",
"0.6570443",
"0.6570443",
"0.6560118",
"0.652567",
"0.6424171",
"0.6424171",
"0.6424171",
"0.64236754",
"0.63511044",
"0.6306788",
"0.62665546",
"0.6262015",
"0.62469316",
"0.62454283",
"0.62454283",
"0.62177503",
"0.62177503",
"0.6211945",
"0.6187616",
"0.61855584",
"0.6183175",
"0.61766464",
"0.6145552",
"0.61289006",
"0.61289006",
"0.6107697",
"0.6084487",
"0.6084487",
"0.6066533",
"0.60441875",
"0.60280895",
"0.60201484",
"0.60182244",
"0.6014135",
"0.59986645",
"0.59963804",
"0.59939677",
"0.59870976",
"0.59456325",
"0.59440196",
"0.5932916",
"0.5903176",
"0.58968246",
"0.58650666",
"0.5864088",
"0.5860319",
"0.58311224",
"0.58151835",
"0.58100516",
"0.5800101",
"0.5799412",
"0.5798673",
"0.5787137",
"0.57795763",
"0.57775813",
"0.57680136",
"0.5767389",
"0.5747432",
"0.5745811",
"0.57435215",
"0.57373273",
"0.57373273",
"0.5731093",
"0.5724023",
"0.5716469",
"0.5705662",
"0.5696602",
"0.56917095",
"0.56910294",
"0.5689219",
"0.5668305",
"0.56565213",
"0.56565213",
"0.56458676",
"0.56456345",
"0.5636148",
"0.5632399",
"0.5626432"
] |
0.7250944
|
1
|
Add a specific line to the config/routes.rb file
|
def add_to_routes(route_str = '')
inject_into_file('config/routes.rb', optimize_indentation("#{route_str.strip}\n", 2), after: "\s# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html\n")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_to_routes m\n file_to_update = 'config/routes.rb'\n line_to_add = \"map.resources :casein_#{controller_file_name}\"\n insert_sentinel = 'CaseinAddRoutes::mapper map'\n gsub_add_once m, file_to_update, \" \" + line_to_add, insert_sentinel\n logger.route line_to_add\n end",
"def add_route(*args)\n custom_routes << args\n end",
"def inject_routes\n routing_code = \"Hydra::BatchEdit.add_routes(self)\"\n sentinel = /HydraHead.add_routes\\(self\\)/\n inject_into_file 'config/routes.rb', \"\\n #{routing_code}\\n\", { :after => sentinel, :verbose => false }\n\n routing_code = \"\\n # This must be the very last route in the file because it has a catch all route for 404 errors.\n # This behavior seems to show up only in production mode.\n mount Sufia::Engine => '/'\\n\"\n sentinel = /devise_for :users/\n inject_into_file 'config/routes.rb', routing_code, { :after => sentinel, :verbose => false }\n \n end",
"def add_route(route={})\n request :post, '/routes', route\n end",
"def add_route_with_a_vengeance(route) #:nodoc:\n last_route = routes.pop\n raise \"the default route is not the last route in config/routes.rb\" unless last_route.to_s == \"ANY /:controller/:action/:id/ {}\"\n routes << route << last_route\n end",
"def add_route(route)\n @routes << route\n route\n end",
"def add_route path, controller, &block\n\t\t\t\t@active_host ||= add_host :default\n\t\t\t\t@active_host.routes << ::Plezi::Base::Route.new(path, controller, &block)\n\t\t\tend",
"def 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 custom_routes; end",
"def add_route(*args)\n route = super\n @named_routes[route.name] = route if route.name\n @generation_key_analyzer << route.generation_keys\n route\n end",
"def update_routes\n inject_into_file 'config/routes.rb', after: \"devise_for :users\" do <<-'RUBY'\n, controllers: { omniauth_callbacks: \"omniauth_callbacks\" }\n RUBY\n end\n\n puts 'Check out your config/routes.rb where the devise OAuth route was created'.colorize(:light_green)\n end",
"def route(routing_code)\r\n log 'route', routing_code\r\n sentinel = 'ActionController::Routing::Routes.draw do |map|'\r\n\r\n in_root do\r\n gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|\r\n \"#{match}\\n #{routing_code}\\n\"\r\n end\r\n end\r\n end",
"def add_devise_route # :nodoc:\n devise_route = <<-ROUTE\n\n devise_for :users,\n path: '',\n path_names: {\n :sign_in => 'login',\n :sign_out => 'logout',\n :sign_up => 'create',\n :password => 'reset_password',\n :confirmation => 'confirm_user',\n :registration => 'account'\n }\n ROUTE\n inject_into_file \"config/routes.rb\",\n devise_route,\n after: %r{Application\\.routes\\.draw do\\n}\n end",
"def add_route( verb, path, route )\n\t\tre = Regexp.compile( '^' + path.join('/') + '$' )\n\n\t\t# Make the Hash for the specified HTTP verb if it hasn't been created already\n\t\tself.routes[ re ][ verb ] = route\n\tend",
"def add_route(*p, &b)\n @routes ||= routes.dup\n @routes.route(*p, &b)\n end",
"def inject_routes\n routing_code = \"\\n Hydra::BatchEdit.add_routes(self)\\n\" +\n \" # This must be the very last route in the file because it has a catch-all route for 404 errors.\n # This behavior seems to show up only in production mode.\n mount Sufia::Engine => '/'\\n\"\n\n sentinel = /devise_for :users/\n inject_into_file 'config/routes.rb', routing_code, { :after => sentinel, :verbose => false }\n end",
"def inject_routes\n gsub_file 'config/routes.rb', /root (:to =>|to:) \"catalog#index\"/, ''\n gsub_file 'config/routes.rb', /'welcome#index'/, \"'sufia/homepage#index'\" # Replace the root path injected by CurationConcerns\n\n routing_code = \"\\n Hydra::BatchEdit.add_routes(self)\\n\" \\\n \" # This must be the very last route in the file because it has a catch-all route for 404 errors.\\n\" \\\n \" # This behavior seems to show up only in production mode.\\n\" \\\n \" mount Sufia::Engine => '/'\\n\"\n\n sentinel = /devise_for :users/\n inject_into_file 'config/routes.rb', routing_code, after: sentinel, verbose: false\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 setup_routes\n template('routes.rb.tt', 'config/routes.rb', force: true)\n end",
"def inject_vlr_routes\n unless IO.read(\"config/routes.rb\").include?('CommonwealthVlrEngine::Engine')\n marker = 'Rails.application.routes.draw do'\n insert_into_file \"config/routes.rb\", :after => marker do\n %q{\n\n root :to => 'pages#home'\n\n # routes for CommonwealthVlrEngine\n mount CommonwealthVlrEngine::Engine => '/commonwealth-vlr-engine'\n\n # user authentication\n devise_for :users, :controllers => {:omniauth_callbacks => \"users/omniauth_callbacks\", :registrations => \"users/registrations\", :sessions => \"users/sessions\"}\n}\n end\n\n bl_root_marker = 'root to: \"catalog#index\"'\n gsub_file(\"config/routes.rb\", bl_root_marker, \"\")\n\n end\n end",
"def route(routing_code)\n log :route, routing_code\n sentinel = /\\.routes\\.draw do\\s*\\n/m\n\n in_root do\n inject_into_file \"config/routes.rb\", optimize_indentation(routing_code, 2), after: sentinel, verbose: false, force: false\n end\n end",
"def add_route(*args, &block)\n route = Route.new(*args, &block)\n @routes << route\n route\n end",
"def build_route \n # #puts \"build Rails route for #{@model_name} in config/routes.rb\"\n \n template = File.read(template(\"rails/route.erb\"))\n text = Erubis::Eruby.new(template).evaluate( self )\n\n @@rails_routes << text\n end",
"def add(new)\n @routes << new\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 add(entry)\n _check_open!\n ::Dnet.route_add(@handle, entry)\n end",
"def add_rexval_routes\n # rexval_route = \"rex_route :#{plural_name}\"\n # route rexval_route\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 inject_mei_routes\n unless IO.read(\"config/routes.rb\").include?('Mei::Engine')\n marker = 'Rails.application.routes.draw do'\n insert_into_file \"config/routes.rb\", :after => marker do\n %q{\n mount Mei::Engine => '/'\n}\n end\n\n end\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 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_routes(&block)\n @router ||= Routes.new\n @router.define(&block)\n url.router = @router\n end",
"def add_shared_route path, controller, &block\n\t\t\t\tadd_host :default if @hosts.empty?\n\t\t\t\t@hosts.each {|n, h| h.routes << ::Plezi::Base::Route.new(path, controller, &block) }\n\t\t\tend",
"def external_routes; end",
"def anchored_routes; end",
"def _routes; end",
"def add_resource_route( resource, info)\n\n namespaces = resource.split('::')\n resource_name = namespaces.pop\n h = @resources_routes\n namespaces.each do |namespace|\n h[namespace] ||= {}\n h = h[namespace]\n end\n h[resource_name] ||= []\n h[resource_name].push(info)\n\n# @resources_routes[resource.to_sym] ||= []\n# @resources_routes[resource.to_sym].push( info )\n end",
"def setup_route\n route \"resources :tooltips do\\n\" +\n \" collection do\\n\" +\n \" get 'tooltip_content'\\n\" +\n \" end\\n\" +\n \" end\"\n end",
"def route(path, opts = {}, &block)\n @@routes << [path, opts, block]\n end",
"def route_name; end",
"def route_name; end",
"def add(verb, path, options = {}, &block)\n routes << (route = Route.new(path, verb, options, &block))\n route.router = self\n route\n end",
"def routes(context={})\n \n routes = [ \n ]\n \n end",
"def routes(context={})\n \n routes = [ \n ]\n \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 routes_map; end",
"def route\n #TODO\n end",
"def route14\n end",
"def update_routes\n insert_into_file 'config/routes.rb', %(\n root :to => 'portal#page'\n DrgCms.routes\n\n put '/portal/process_login'\n post '/reports/diary'\n\n resources :init # remove after initial run\n\n get '*path' => 'portal#page'\n\n),\n after: 'Rails.application.routes.draw do'\nend",
"def add(path, options = nil)\n add_route route(path.dup).with_options(options)\n end",
"def add(pattern, dest, options)\n options[:prio]=255 unless options[:prio] # default\n @route[pattern]=RouteEntry.new(dest, options)\n end",
"def map(path, options = {})\n @@routes[path] = options\n end",
"def add_route(station, line)\n Neo4j::Transaction.run do\n rel = Neo4j::Relationship.create(:route, self, station)\n rel[:distance] = 1.0\n rel[:line] = line\n end\n\n self\n end",
"def add_location(path, line); end",
"def add_swagger_route http_method, path, opts = {}\n full_path = path.gsub(/{(.*?)}/, ':\\1')\n match full_path, to: \"#{opts.fetch(:controller_name)}##{opts[:action_name]}\", via: http_method\n end",
"def alter_regex_for_custom_routes(node); end",
"def add(verb, path, options = {}, &block)\n route = Route.new(path, verb, options, &block)\n route.router = self\n @routes << route\n route\n end",
"def add_extension_routes(options)\n ext_routes = \"#{database_route(options[:database])}#{mailer_route(options[:skip_mailer])}#{sidekiq_route(options)}\"\n routes_str = if options[:noauth]\n <<~ROUTES\n # If authentication has not been used; only allow this routes to be used in development to prevent authorized access\n if Rails.env.development?\n #{ext_routes.squeeze(\"\\n\").strip}\n end\n ROUTES\n else\n <<~ROUTES\n # Require the person hitting this page ot be an application admin\n authenticate :user, -> (user) { user.admin? } do\n #{ext_routes.squeeze(\"\\n\").strip}\n end\n ROUTES\n end\n optimize_indentation(routes_str, 2)\n end",
"def for(path, *args)\n arg = args[0]\n log.debug \"Adding route, path: #{path}, args: #{args.inspect}\"\n\n match = get_regex_for_route(path, arg)\n hash = get_to_hash(arg)\n route_info = {:regex => match[:regex], :args => arg, :vars => match[:vars], :hash => hash}\n \n # Add the HTTP methods for this route if they exist in options\n route_info[:methods] = arg[:methods] if not arg.nil? and arg.has_key? :methods\n \n self.routes.push(route_info)\n end",
"def add_item_routing_rule(rule)\n @item_routing_rules << rule\n end",
"def route() request.route 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 inform_user_about_routes\n unless options.skeleton?\n puts %Q{\nPlease update your routes with the following\n\n # inside namespace :import_via_csv\"\n resources :#{model_plural_file_name}, only: [] do\n concerns :importable\n end\n}\n end\n end",
"def add_admin_routes\n ['sidebar','users','pages','documents','settings'].each do |file|\n template \"config/admin/#{file}.yml\", \"config/admin/#{file}.yml\"\n end\n end",
"def assert_added_route_for(name)\n assert_generated_file(\"config/routes.rb\") do |body|\n assert_match /map.resources :#{name.to_s.underscore}/, body,\n \"should add route for :#{name.to_s.underscore}\"\n end\n end",
"def process_route(args, file_path)\n File.open(file_path, 'a') do |f|\n # write to file\n str = \"`#{args[0].upcase} #{args[1]}`\"\n f << str\n f << \"\\n\"\n end\n end",
"def route( key, &block )\n @routes[key] = compile!(\"route_#{key}\", &block)\n end",
"def handle(pattern, &block)\n @routes << [pattern, block]\n end",
"def add_route(url_string, rack_app)\n @mount_points = @mount_points || []\n @mount_points << {url_string: url_string, rack_app: rack_app}\n end",
"def route_for_sinatra(env)\n env['newrelic.last_route']\n end",
"def generate_routes m\n # routes\n unless command_has_resources\n # add routes like unnested scaffold \n # eg. map.resources books\n m.route_resources controller_file_name\n else\n resource_list = controller_file_name.map { |r| r.to_sym.inspect }.join(', ')\n parent_resource = parent_resource_name\n \n path = destination_path('config/routes.rb')\n content = File.read(path)\n \n logger.route \"resources #{resource_list}\"\n \n # map.resources :parents do |parent|\n # parent.resources :parents do |parent|\n sentinel = \"\\.resources(.*)?:#{parent_resource.pluralize}(.*)do(.*)\\\\|#{parent_resource}\\\\|\"\n \n if content =~ /#{sentinel}/\n gsub_file 'config/routes.rb', sentinel do |match|\n \"#{match}\\n #{parent_resource}.resources :#{table_name}\"\n end\n else\n # without do block\n # map.resources :parents \n # parent.resources :parents\n sentinel = \"\\.resources(.*):#{parent_resource.pluralize}\"\n if content =~ /#{sentinel}/\n gsub_file 'config/routes.rb', sentinel do |match|\n \"#{match} do |#{parent_resource}|\\n #{parent_resource}.resources :#{table_name}\\n end\"\n end\n end\n end\n end\n end",
"def routing(&block)\n @routing_config = block\n end",
"def route(routing_code, namespace: nil, sentinel: nil, indentation: 2)\n routing_code = Array(namespace).reverse.reduce(routing_code) { |code, ns|\n \"namespace :#{ns} do\\n#{indent(code, 2)}\\nend\"\n }\n\n log :route, routing_code\n sentinel ||= /\\.routes\\.draw do\\s*\\n/m\n\n in_root do\n inject_into_file \"config/routes.rb\", optimize_indentation(routing_code, indentation), after: sentinel, verbose: false, force: false\n end\n end",
"def short_route\n @short_route ||= begin\n sr = \"#{objet}\" # sinon, passage par référence avec '<<' ci-dessous\n method && sr << \"/#{method}\"\n sr\n end\n end",
"def named_route; end",
"def ensure_route(route)\n unless self.routes.member?(route) or route.blank?\n self.routes << route\n end\n end",
"def named_routes; end",
"def routing_number; end",
"def route(verb, path, &block)\n signature = compile!(verb, path, block, {})\n (routes[verb] ||= []) << signature\n end",
"def add_route( rule, output_channel )\n validate_arguments( binding() )\n routes.push( RouteSpecification.new( rule, output_channel ) )\n end",
"def addRoute(route)\n @routes.push route\n addRouteValue(@fromNodeMap, route.startStation, route)\n addRouteValue(@toNodeMap, route.endStation, route)\n end"
] |
[
"0.74240524",
"0.6807506",
"0.66621584",
"0.6560786",
"0.6524357",
"0.6517764",
"0.64951235",
"0.64284015",
"0.6424449",
"0.6383891",
"0.63717604",
"0.63510203",
"0.63503414",
"0.63451463",
"0.62634265",
"0.62113035",
"0.620693",
"0.61696994",
"0.61264646",
"0.60574025",
"0.604621",
"0.6013354",
"0.6008434",
"0.5995803",
"0.59865385",
"0.59865385",
"0.59865385",
"0.59865385",
"0.59865385",
"0.59865385",
"0.59865385",
"0.59711426",
"0.5959154",
"0.5956026",
"0.5956026",
"0.5956026",
"0.5956026",
"0.5956026",
"0.5956026",
"0.5956026",
"0.5956026",
"0.5956026",
"0.5956026",
"0.5956026",
"0.59349835",
"0.593223",
"0.59164155",
"0.59164155",
"0.59164155",
"0.59164155",
"0.59117216",
"0.5907382",
"0.5896982",
"0.5894142",
"0.5873178",
"0.5862495",
"0.5846347",
"0.580899",
"0.5794289",
"0.5794289",
"0.57685894",
"0.5764298",
"0.5764298",
"0.5758853",
"0.57549787",
"0.5749199",
"0.5733367",
"0.57238305",
"0.5720364",
"0.5715149",
"0.5699057",
"0.5697196",
"0.56341916",
"0.56222224",
"0.56083727",
"0.56048656",
"0.5592731",
"0.55917346",
"0.5569931",
"0.5566138",
"0.5543454",
"0.5542009",
"0.5528423",
"0.55235916",
"0.55095524",
"0.5505236",
"0.5485333",
"0.5484503",
"0.5480456",
"0.54778856",
"0.5452267",
"0.54520726",
"0.5443202",
"0.5434449",
"0.5430355",
"0.5426524",
"0.5411411",
"0.54100883",
"0.54093206",
"0.54015744"
] |
0.7298145
|
1
|
Used to create highlights when running `kowl h` (usage summary displayed by the binstub) Highlight the specific string
|
def highlight(str = '')
return '' if str.blank?
str = str.split('=')
str.count > 1 ? "\e[32m#{str[0]}=\e[33m#{str[1]}\e[0m" : "\e[32m#{str[0]}\e[0m"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def highlights; end",
"def highlights; end",
"def highlights; end",
"def highlighter_prefix=(_arg0); end",
"def highlighter_prefix; end",
"def highlighter_prefix; end",
"def highlighter=(_arg0); end",
"def highlight(text,relations,places)\n highlight = String.new(text)\n relations.each do |relation|\n highlight.gsub!(/(#{relation[\"name\"]})/) {\"\\033[7m#{$1}\\033[0m\"}\n end\n places.each do |place|\n highlight.gsub!(/(#{place})/) {\"\\033[4m#{$1}\\033[0m\"}\n end\n\n highlight\nend",
"def highlighter; end",
"def highlighter; end",
"def highlight text\n color_code = 7\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend",
"def highlighter_suffix; end",
"def highlighter_suffix; end",
"def highlighter_suffix=(_arg0); end",
"def highlight(hl)\n raise \"highlight requires a String.\" unless hl.is_a? String\n @highlight = hl\n self\n end",
"def highlight(string)\n string.gsub @terms, \"<b>#{@terms}</b>\"\n end",
"def highlight(text, phrases, *args)\n options = extract_options_from_args!(args) || {}\n unless args.empty?\n options[:highlighter] = args[0] || '<strong class=\"highlight\">\\1</strong>'\n end\n options.reverse_merge!(:highlighter => '<strong class=\"highlight\">\\1</strong>')\n\n if text.blank? || phrases.blank?\n text\n else\n match = Array(phrases).map { |p| Regexp.escape(p) }.join('|')\n text.gsub(/(#{match})/i, options[:highlighter])\n end\n end",
"def highlight_line(string)\n\t$targets.each do |t|\n\t\n\t\t# match case insensitive if asked nicely\n\t\tif $options.match(/i/)\n\t\t\tre = Regexp.compile(t, true)\n\t\telse\n\t\t\tre = Regexp.compile(t, false)\n\t\tend\n\n\t\t# surround each match with terminal color control chars\n\t\tstring.gsub!(re) do |s|\n\t\t\t\"%s%s%s\" % [get_color(t), $&, $Normal]\n\t\tend\n\tend\n\n\tstring\nend",
"def highlight(search_str, text)\n text.gsub!(search_str, \"<strong>#{search_str}</strong>\")\n end",
"def highlight(text, options = {})\n options = translate(DEFAULT.merge(options))\n args = options.values_at(:output, :syntax, :line_numbers, :style, :headers)\n \n Uv.parse(text, *args)\n rescue => ex\n \"<pre>#{Rack::Utils.escape(text)}</pre>\"\n end",
"def highlight(keyword)\n Rainbow.enabled = true\n regexp = Regexp.new(keyword,@options['ignore-case'] ? Regexp::IGNORECASE : nil)\n ARGF.each_line do |line|\n puts highlight_matches(regexp,line)\n end\n end",
"def highlight locator\r\n command 'highlight', locator\r\n end",
"def highlight!\r\n highlights_on proc { true }\r\n end",
"def highlight_words(t, words, html = true)\n if html\n t = h(t)\n end\n if html\n t = highlight(t, words, '<span class=\"highlight\">\\1</span>')\n else\n t = highlight(t, words, '*\\1*')\n end\n return t\n end",
"def goHighlight (h, s)\n # if (!h) return\n # hLen = h.size\n #\n # for (var i=0; i<hLen; i++) {\n # var para = this.paragraphList().list[h[i]-1] || false;\n # if (para) {\n # var sntns = s[h[i].toString()] || false;\n # var multi = !sntns || sntns.length==0; #// Individual sentences, or whole paragraphy?\n # var lines = this.getSentences(para);\n # var jLen = lines.length;\n #\n # /* First pass. Add SPAN tags to all lines. */\n # for (var j=0; j<jLen; j++) {\n # var k = (multi) ? j : sntns[j]-1;\n # lines[j] = \"<span data-num='\" + (j+1) + \"'>\" + lines[j] + \"</span>\";\n # # // lines[j] = \"<a name='\" + (j+1) + \"' /><span data-num='\" + (j+1) + \"'>\" + lines[j] + \"</span>\";\n # }\n #\n # /* Second pass, update span to Highlight selected lines */\n # for (var j=0; j<jLen; j++) {\n # var k = (multi) ? j : sntns[j]-1;\n # var line = lines[k] || false;\n # if (line) {\n # lines[k] = lines[k].replace(\"<span\", \"<span class='\" + this.classHighlight + \"'\");\n # # // trying to create absolute links for sentences here\n # # // lines[k] = lines[k].replace(\"<span\", \"<a name='\" + + \"'><span class='\" + this.classHighlight + \"'\");\n # }\n # }\n #\n # para.setAttribute(\"data-sentences\", jLen);\n # para.innerHTML = lines.join('. ').replace(/__DOT__/g, \".\").replace(/<\\/span>\\./g, \".<\\/span>\");\n # para.addClassName('emReady'); /* Mark the paragraph as having SPANs */\n # }\n # }\n end",
"def welcome_explainer\n name = \" Legislature Information on Bills and Sponsors \"\n print ColorizedString[\"_/\\\\_\"].white.on_blue \n puts ColorizedString[name.center(name.length)].black.on_white\n print ColorizedString[\"\\\\/\\\\/\"].white.on_blue \n puts ColorizedString[\"(from Open States API v1)\".center(name.length)].white.on_red\nend",
"def handle_highlight_tags(str)\n str = BentoSearch::Util.handle_highlight_tags(\n str,\n :start_tag => @@highlight_start,\n :end_tag => @@highlight_end,\n :enabled => configuration.highlighting\n )\n end",
"def handle_highlight_tags(str)\n\n str = BentoSearch::Util.handle_highlight_tags(\n str,\n :start_tag => @@highlight_start,\n :end_tag => @@highlight_end,\n :enabled => configuration.highlighting\n )\n\n end",
"def highlight_word(word)\n return if word.empty?\n @info.tag_remove('search', '1.0', 'end')\n _highlight_word(word.downcase, @info.get('1.0', 'end').downcase, 'search')\n end",
"def highlight(code, options = T.unsafe(nil)); end",
"def add_tool_tip_span(text)\n text_array = text.split(' ')\n p text_array\n words_to_replace = {}\n text_array.each do |word|\n search_word = word.chomp(',').chomp('.').chomp(')').chomp(';').downcase\n if Glossary.where(word: search_word)[0]\n words_to_replace[word] = search_word\n elsif Glossary.where(word: search_word.chomp('s'))[0]\n words_to_replace[word] = search_word.chomp('s')\n end\n end\n words_to_replace.each do |word , search_word|\n entry = Glossary.find_by(word: search_word)\n text_array.each_with_index do |array_word, index|\n if array_word == word\n text_array[index] = \"<a href='' data-toggle='tooltip' title='#{entry.definition}'>#{word}</a>\"\n end\n end\n end\n return text_array.join(\" \")\nend",
"def highlight_code(text, lang, type, opts = T.unsafe(nil)); end",
"def highlight(code, lang, options = T.unsafe(nil)); end",
"def highlight(code, lang, options = T.unsafe(nil), format = T.unsafe(nil)); end",
"def highlight_codes\n #@content.gsub!(/%(.*?){(.*?)}%/m) do # %{ some code }%\n @content.gsub!(/^```(.*?)\\n(.*?)\\n```/m) do # github like: http://github.github.com/github-flavored-markdown/\n lang = :text\n lang = $1 if $1 != \"\"\n Albino.colorize($2, lang)\n end\n end",
"def hl(type=:bold,word=nil)\n if word\n self.gsub(/(\\s|\\A|[[:punct:]])#{word}(\\s|\\Z|[[:punct:]])/,\n \"\\\\1\" + HIGHLIGHT[type] + word.to_s + HIGHLIGHT[:end] + \"\\\\2\")\n else\n HIGHLIGHT[type] + self.to_s + HIGHLIGHT[:end]\n end\n end",
"def highlight\n return unless Config.live_highlight\n\n code = CodeRay.scan(line, :ruby).html\n\n cursor = text_cursor\n\n pos = cursor.position\n cursor.move_position Qt::TextCursor::End\n cursor.set_position @min_position, Qt::TextCursor::KeepAnchor\n cursor.remove_selected_text\n\n cursor.insert_html \"<code>#{code}</code>\"\n cursor.position = pos\n\n self.text_cursor = cursor\n end",
"def assign_highlighter_options!; end",
"def h(text); end",
"def h(text); end",
"def colorize(text, color_code); \"\\e[#{color_code}m#{text}\\e[0m\"; end",
"def green(text)\n colorize(text, 32)\nend",
"def bold(output)\n color('1', output)\n end",
"def add_highlighting(solr_params)\n solr_params['hl'] = true\n solr_params['hl.fl'] = CatalogController.blacklight_config.highlight_field\n solr_params['hl.snippets'] = 3\n solr_params\n end",
"def hsay(output,color_scheme)\n @highline.say(\"<%= color(%Q{#{output}},'#{color_scheme}') %>\")\n end",
"def highlight_by_language(text, language)\n ::CodeRay.scan(text, language).html(:line_numbers => :inline, :wrap => :span)\n end",
"def insert_highlighting(new_code, vars)\n string_indexes = scan_for_index_start_and_end(new_code, regex_find_strings) +\n scan_for_index_start_and_end(new_code, /\\d+\\.\\d+/)\n # scan also for floating point numbers to prevent wrong\n # handling of the \".\"\n string_indexes\n operation_indexes = scan_for_index_start_and_end(new_code, regex_find_operations)\n # Set the array of tracing variables to empty, if there only is\n # the underscore, which by default in erlang is undefined.\n vars = [] if vars.length == 1 && vars[0] == '_'\n\n unless vars.empty?\n # fill array for operation_indexes with indexes of given variables\n vars.each do |var|\n if var != '_'\n operation_indexes += scan_for_index_start_and_end(new_code, Regexp.new(\"\\\\b#{var}\\\\b\"))\n end\n end\n operation_indexes = operation_indexes.sort_by { |hsh| hsh[:starts] }\n end\n\n unless string_indexes.empty? && operation_indexes.empty?\n new_code = insert_prefix(new_code, operation_indexes, string_indexes)\n end\n\n # insert information of line numbers\n new_code = change_prefix_2_line_number(new_code)\n\n # insert debugging functionality\n new_code = change_prefix_2_debug(new_code, vars) unless vars.empty?\n\n # delete all for processing inserted prefixes\n new_code.gsub!(regex_lineprefix, '')\n\n new_code\nend",
"def highlight(code)\n CodeRay.scan(code, :ruby).div(:css => :class)\n end",
"def highlight_gap_marks_in_red!(lb)\n # gap_marks: Skip certain characters and find characters to highlight in red\n gap_mark_complete_regex = Regexp.new(Regexp.escape(tmp_gap_mark_complete))\n l_ch = @options[:language].chars\n chars_to_skip = [\n l_ch[:d_quote_open],\n l_ch[:em_dash],\n l_ch[:s_quote_open],\n ' ',\n '(',\n '[',\n '\"',\n \"'\",\n '}',\n '*',\n '[', # chinese bracket\n '(', # chinese parens\n '一', # chinese dash\n '《', # chinese left double angle bracket\n ].join\n lb.gsub!(\n /\n #{ gap_mark_complete_regex } # find tmp gap mark number and text\n ( # capturing group for first group of characters to be colored red\n (?: # non capturing group\n #{ l_ch[:elipsis] } # elipsis\n (?!#{ l_ch[:elipsis] }) # not followed by another elipsis so we exclude chinese double elipsis\n )? # optional\n )\n ( # capturing group for characters that are not to be colored red\n (?: # find one of the following, use non-capturing group for grouping only\n [#{ Regexp.escape(chars_to_skip) }]+ # special chars or delimiters\n | # or\n …… # chinese double elipsis\n | # or\n \\\\[[:alnum:]]+\\{ # latex command with opening {\n | # or\n \\s+ # eagle followed by whitespace\n )* # any of these zero or more times to match nested latex commands\n )\n ( # capturing group for second group of characters to be colored red\n #{ l_ch[:elipsis] }? # optional elipsis\n [[:alpha:][:digit:]#{ l_ch[:apostrophe] }\\-\\?,]* # words and some punctuation\n )\n /x,\n # we move the tmp_gap_mark_number to the very beginning so that if we\n # have an ellipsis before a latex command, the gap_mark_number will be\n # in front of the entire section that is colored red.\n # \\1: an optional ellipsis (colored red)\n # \\2: an optional latex command or characters not to be colored red\n # \\3: the text to be colored red\n # OPTIMIZATION: We could skip the first \\RtGapMarkText if \\1 is blank\n tmp_gap_mark_number + \"\\\\RtGapMarkText\" + '{\\1}' + '\\2' + \"\\\\RtGapMarkText\" + '{\\3}'\n )\n # If in the gap_mark processing above regex ref \\1 is empty, we end up\n # with empty `\\RtGapMarkText{}` fragments. We remove them in this step:\n lb.gsub!(\"\\\\RtGapMarkText{}\", '')\n # Move tmp_gap_mark_number to outside of quotes, parentheses and brackets\n if !['', nil].include?(tmp_gap_mark_number)\n gap_mark_number_regex = Regexp.new(Regexp.escape(tmp_gap_mark_number))\n chars_to_move_outside_of = [\n l_ch[:apostrophe],\n l_ch[:d_quote_open],\n l_ch[:s_quote_open],\n '(',\n '[',\n ].join\n lb.gsub!(\n /\n ( # capturing group for characters to move outside of\n [#{ Regexp.escape(chars_to_move_outside_of) }]*\n )\n #{ gap_mark_number_regex } # find tmp gap mark number\n /x,\n tmp_gap_mark_number + '\\1' # Reverse order\n )\n # Move tmp_gap_mark_number to after leading eagle\n lb.gsub!(\n /\n (#{ gap_mark_number_regex }) # capture group for tmp gap mark number\n \\s? # followed by eagle and optional space\n /x,\n '\\1' # Reverse order\n )\n # Convert tmp_gap_mark_number to latex command\n lb.gsub!(gap_mark_number_regex, \"\\\\RtGapMarkNumber{}\")\n end\n # Make sure no tmp_gap_marks are left\n if(ltgm = lb.match(/.{0,20}#{ Regexp.escape(tmp_gap_mark_text) }.{0,20}/))\n raise(LeftoverTempGapMarkError.new(\"Leftover temp gap mark: #{ ltgm.to_s.inspect }\"))\n end\n if !['', nil].include?(tmp_gap_mark_number)\n if(ltgmn = lb.match(/.{0,10}#{ Regexp.escape(tmp_gap_mark_number) }.{0,10}/))\n raise(LeftoverTempGapMarkNumberError.new(\"Leftover temp gap mark number: #{ ltgmn.to_s.inspect }\"))\n end\n end\n end",
"def search_highlights\n @search_highlights ||= begin\n highlights = HIGHLIGHT_SOLR_FIELDS.collect {|field| get_highlights(field) }.flatten.slice(0, MAX_HIGHLIGHT_SNIPPETS)\n if highlights.present?\n \"…\".html_safe + safe_join(highlights, \" …\") + \"…\".html_safe\n else\n \"\"\n end\n end\n end",
"def highlight_search_res(sentence, word)\n count = sentence.split.count{ |matched| matched.downcase.include?('can') }\n capital_word = word.dup.capitialize()\n s = \"\"\n s += sentence.gsub(\"#{word}\", \"(#{word})\").gsub(\"#{capital_word}\", \"(#{capital_word})\")\n s += \"\\n\"\n s += \"Total occurence found : #{count}\"\nend",
"def highlight(*args)\n options = args.last.kind_of?(Hash) ? args.pop : {}\n fields = []\n args.each { |field_name| fields.concat(@setup.text_fields(field_name)) }\n\n @query.set_highlight(fields, options)\n end",
"def highlightSpaceUI()\n\t\t#Not implemented due to ui\n\tend",
"def set_highlight(val)\n add_actions \"SetHighlight(#{val})\"\n end",
"def green(string)\n \"\\033[0;32m#{string}\\e[0m\"\nend",
"def green(string)\n \"\\033[0;32m#{string}\\e[0m\"\nend",
"def green(string)\n \"\\033[0;32m#{string}\\033[0m\"\nend",
"def green(string)\n \"\\033[0;32m#{string}\\033[0m\"\nend",
"def colorize(text, color_code); \"#{color_code}#{text}\\033[0m\"; end",
"def highlight(key, content, language, formatter, options)\n require 'pygments'\n options = JSON.parse('{' + options.to_s + '}')\n if options['linenos'] && formatter == 'html'\n # Inline numbers look much better in HTML but are invalid in LaTeX.\n options['linenos'] = 'inline'\n end\n if (lines = options['hl_lines'])\n content_lines = content.split(\"\\n\")\n if lines.max > content_lines.length\n err = \"\\nHighlight line(s) out of range: #{lines.inspect}\\n\"\n err += content\n raise err\n end\n end\n highlight_cache[key] ||= Pygments.highlight(content, lexer: language,\n formatter: formatter,\n options: options)\n end",
"def hit_highlight(text, hits = [])\n if hits.empty?\n return text\n end\n \n chunks = text.split(\"<\").map do |item|\n item.blank? ? item : item.split(\">\")\n end.flatten\n\n tags = [\"<\" + DEFAULT_HIGHLIGHT_TAG + \">\", \"</\" + DEFAULT_HIGHLIGHT_TAG + \">\"]\n \n result = \"\"\n chunk_index, chunk = 0, chunks[0]\n prev_chunks_len = 0\n chunk_cursor = 0\n start_in_chunk = false\n for hit, index in hits.flatten.each_with_index do\n tag = tags[index % 2]\n \n placed = false\n until chunk.nil? || hit < prev_chunks_len + chunk.length do\n result << chunk[chunk_cursor..-1] \n if start_in_chunk && hit == prev_chunks_len + chunk.length\n result << tag\n placed = true\n end\n result << \"<#{chunks[chunk_index+1]}>\"\n prev_chunks_len += chunk.length\n chunk_cursor = 0\n chunk_index += 2\n chunk = chunks[chunk_index]\n start_in_chunk = false\n end\n \n if !placed && !chunk.nil?\n hit_spot = hit - prev_chunks_len\n result << chunk[chunk_cursor...hit_spot] + tag\n chunk_cursor = hit_spot\n if index % 2 == 0\n start_in_chunk = true\n end\n end\n end\n \n if !chunk.nil?\n result << chunk[chunk_cursor..-1]\n for index in chunk_index+1..chunks.length-1\n result << (index.even? ? chunks[index] : \"<#{chunks[index]}>\")\n end\n end\n \n result\n end",
"def highlighter_suffix(highlighter_suffix = T.unsafe(nil)); end",
"def colorize(text)\n Albino.new(text, self).colorize(:O => 'stripnl=false')\n end",
"def enable_syntax_highlighting_as_you_type\n raise 'Syntax highlighting only supported on 1.9.3+' unless RUBY_VERSION >= '1.9.3'\n\n # Use coolline with CodeRay for syntax highlighting as you type.\n # Only works on >= 1.9.3 because coolline depends on io/console.\n\n require 'coolline'\n require 'coderay'\n\n Pry.config.input = Coolline.new do |c|\n c.transform_proc = proc do\n CodeRay.scan(c.line, :ruby).term\n end\n\n c.completion_proc = proc do\n word = c.completed_word\n Object.constants.map(&:to_s).select { |w| w.start_with? word }\n end\n end\n end",
"def colour(name, text)\n if Pry.color\n str = Pry::Helpers::Text.send(name, text)\n unless str.start_with?(\"\\001\")\n str = \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n end\n str\n else\n text\n end\nend",
"def color(str, color)\n interactive? ? interaction_highline.color(str, color) : str\n end",
"def highlight(text, lexer, formatter, &b)\n lexer = Lexer.find(lexer) unless lexer.respond_to? :lex\n raise \"unknown lexer #{lexer}\" unless lexer\n\n formatter = Formatter.find(formatter) unless formatter.respond_to? :format\n raise \"unknown formatter #{formatter}\" unless formatter\n\n formatter.format(lexer.lex(text), &b)\n end",
"def method_missing(name, *args)\n if @colours.include? name\n \"#{@colours[name]}#{args[0]}\\033[0m\"\n else\n \"#{@default}#{args[0]}\\033[0m\"\n end\n end",
"def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend",
"def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend",
"def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend",
"def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend",
"def colorize(text, color_code)\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend",
"def syntax_highlight_class(content_type)\n case content_type\n when JSON\n \"highlight json\"\n when XML\n \"highlight xml\"\n end\n end",
"def glossarize_string(text, *args, &block)\n\t\t\tdoc = Hpricot(text)\n\t\t\tdoc.traverse_element(*args[0].dup) do |e|\n\t\t\t\tif !glossary.nil? and [Hpricot::Doc, Hpricot::Elem,Hpricot::Text].include?(e.class)\n #glossary.sort{|a, b| a[0].length <=> b[0].length}.each do |k,v|\n\t\t\t\t\tglossary.each do |k, v|\n\t\t\t\t\t\te.text_sub!(Regexp.new(\"([^-<>])(\\\\b#{k.to_s}\\\\b)([^-<>])(?![^<]*>|[^<]*<\\/(span|a|b|em|strong)>|[^<]*<br\\/>|[^<]*<(sup|em|strong)>)\"), '\\1<a class=\"info\" href=\"javascript:void(0);\">\\2<span>' + word_wrap(v) + '</span></a>\\3')\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tdoc.to_s\n\t\tend",
"def colour(name, text)\n if Pry.color\n \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n else\n text\n end\nend",
"def highlight_problems( line, re )\n\t\tline \\\n\t\t\t.gsub( re ) { color $&, :on_red } \\\n\t\t\t.gsub( /\\t+/ ) { color \"\\u{21e5} \" * $&.length, :dark, :white }\n\tend",
"def highlight_description\n desc = ''\n desc = self.description['highlight'] if self.description\n if desc then\n return desc.content if desc.class.name != \"String\"\n return desc\n else\n return <<-c\nThis show has no highlight description.\n c\n end\n end",
"def highlight(code, opts={})\n # If the caller didn't give us any code, we have nothing to do,\n # so return right away.\n return code if code.nil? || code.empty?\n\n # Callers pass along options in the hash\n opts[:options] ||= {}\n\n # Default to utf-8 for the output encoding, if not given.\n opts[:options][:outencoding] ||= 'utf-8'\n\n # Get back the string from mentos and force encoding if we can\n str = mentos(:highlight, nil, opts, code)\n str.force_encoding(opts[:options][:outencoding]) if str.respond_to?(:force_encoding)\n str\n end",
"def red(text)\n colorize(text, 31)\nend",
"def c(text, colors)\n text = \"%{B#{colors[:bg]}}#{text}%{B-}\" if colors[:bg]\n text = \"%{F#{colors[:fg]}}#{text}%{F-}\" if colors[:fg]\n text\nend",
"def highlight(text, lexer, formatter, &b)\n lexer = Lexer.find(lexer) unless lexer.respond_to? :lex\n raise \"unknown lexer #{lexer}\" unless lexer\n\n # XXX: maybe opal bug, `string.respond_to? :format` returns true in Opal.\n # formatter = Formatter.find(formatter) unless formatter.respond_to? :format\n formatter = Formatter.find(formatter)\n raise \"unknown formatter #{formatter}\" unless formatter\n\n formatter.format(lexer.lex(text), &b)\n end",
"def bold_red(output)\n color('1;31', output)\n end",
"def hipsterfy(word)\n\nend",
"def text_search(target_string)\n\t\t# NOTE: always search all entities, not just the ones that are on screen\n\t\t# (not sure how you should let the user know that there are entities that have been found, but which are not currently on the screen)\n\t\ttext_objects = @space.entities.select{|x| x.is_a? ThoughtTrace::Text }\n\t\t\n\t\thighlight_mapping = \n\t\t\ttext_objects.map do |text|\n\t\t\t\ti = text.string.index target_string\n\t\t\t\t\n\t\t\t\t[text, i, i+target_string.size] if i\n\t\t\tend\n\t\thighlight_mapping.compact!\n\t\t\n\t\t\n\t\t\n\t\t# highlight the portions of the string the match the search query\n\t\tcolor = Gosu::Color.argb(0x99FF0000)\n\t\t\n\t\thighlight_mapping.each do |text, start_i, end_i|\n\t\t\t# NOTE: width_of_first may break for i=1, because it handles conversion weird. need to totally overhaul that\n\t\t\tax = text.width_of_first(start_i)\n\t\t\tbx = text.width_of_first(end_i)\n\t\t\t\n\t\t\theight = text[:physics].shape.height\n\t\t\toffset = height / 2\n\t\t\t\n\t\t\tp = text[:physics].body.p\n\t\t\ta = CP::Vec2.new(ax, offset) + p\n\t\t\tb = CP::Vec2.new(bx, offset) + p\n\t\t\t\n\t\t\tThoughtTrace::Drawing.draw_line(\n\t\t\t\t$window, a,b, \n\t\t\t\tcolor:color, thickness:height, line_offset:0.5, z_index:0\n\t\t\t)\n\t\tend\n\tend",
"def highlight_text(text, terms, start_tag)\r\n\t\t\tquery_params = %(text=#{text}&highlight_expression=#{terms}&start_tag=#{start_tag}).tr(\" \", \"+\")\r\n\t\t\turl = construct_target_url(:highlighttext, query_params)\r\n\t\t\t\r\n\t\t\tURI.parse(url).read\r\n\t\tend",
"def handle_snippet_value(str) \n # primo doesn't put elipses tags on ends of snippet usually, which is\n # confusing. let's add them ourselves.\n str = \"\\u2026#{str}\\u2026\" if str\n\n return handle_highlight_tags str\n end",
"def sql_to_highlight(sql)\n # wrap sql @ 120\n width = 120\n ar = sql.gsub(/from /i, \"\\nFROM \").gsub(/where /i, \"\\nWHERE \").gsub(/(left outer join |left join |inner join |join )/i, \"\\n\\\\1\").split(\"\\n\")\n wrapped_sql = ar.map { |a| a.scan(/\\S.{0,#{width - 2}}\\S(?=\\s|$)|\\S+/).join(\"\\n\") }.join(\"\\n\")\n\n theme = Rouge::Themes::Github.new\n formatter = Rouge::Formatters::HTMLInline.new(theme)\n lexer = Rouge::Lexers::SQL.new\n formatter.format(lexer.lex(wrapped_sql))\n end",
"def highlights_for(unique_id, field)\n raw_response['highlighting'] ||= {}\n raw_response['highlighting'][unique_id] ||= {}\n raw_response['highlighting'][unique_id][field]\n end",
"def extract_highlights_from(code, options)\n code.gsub!(%r[\\{% highlight (.+) %\\}]) do\n enumerable = eval($1.strip)\n enumerable = (Enumerable === enumerable)? enumerable : nil\n options.merge!({:highlight_lines => enumerable}) if enumerable\n ''\n end\n [code.strip, options]\n end",
"def syntax_highlighter(html)\n doc = Nokogiri::HTML(html)\n doc.search(\"//pre[@lang]\").each do |pre|\n pre.replace Albino.colorize(pre.text.rstrip, pre[:lang])\n end\n doc.to_s\n end",
"def colorize(string, code)\n \"\\e[#{code}m#{string}\\e[0m\"\n end",
"def highlight_code(options={})\n require 'uv'\n\n wrap_with = options[:wrap_with] || ['','']\n text = @modified_string\n\n languages_syntax_list = File.readlines(\n File.expand_path(File.dirname(__FILE__) + '/../config/languages_syntax_list')\n ).map { |l| l.chomp }\n\n text.gsub!(/<code(\\s*?lang=[\"']?(.*?)[\"']?)?>(.*?)<\\/code>/) do\n if languages_syntax_list.include?($2)\n lang = $2\n else\n lang = 'ruby'\n end\n unless $3.blank?\n result = Uv.parse($3.gsub('<br/>', \"\\n\").gsub('<', '<').gsub('>', '>').gsub('"', '\"'), 'xhtml', lang, false, 'active4d')\n \"#{wrap_with[0].gsub('$lang', lang)}#{result}#{wrap_with[1]}\"\n end\n end\n\n # TODO: split string longer than 80 characters\n\n @modified_string = text\n self\n\n end",
"def highlight(text, lexer, formatter)\n lexer = Lexer.find(lexer) unless lexer.respond_to?(:lex)\n fail \"unknown lexer #{lexer}\" unless lexer\n\n formatter = Formatter.find(formatter) unless formatter.respond_to?(:render)\n fail \"unknown formatter #{formatter}\" unless formatter\n\n formatter.render(lexer.lex(text))\n end",
"def green(text)\n colorize text, \"\\033[1;32m\"\n end",
"def colorize(text, color_code)\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend",
"def colorize(text, color_code)\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend",
"def colorize(text, color_code)\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend",
"def syntax_highlight(html)\n line_numbers = config.line_numbers ? :table : nil\n opts = { css: :style, wrap: nil, line_numbers: line_numbers }\n html.gsub(/\\<code class=\"(.+?)\"\\>(.+?)\\<\\/code\\>/m) do\n lang, code = $1, $2\n code = CGI.unescapeHTML code\n CodeRay.scan(code, lang).html opts\n end\n end",
"def html\n HtmlFormatter.new(self, options.merge(:highlight_words => true)).to_s\n end"
] |
[
"0.70313466",
"0.70313466",
"0.70313466",
"0.69726485",
"0.6970006",
"0.6970006",
"0.6834523",
"0.67985183",
"0.67622113",
"0.67622113",
"0.669139",
"0.6682478",
"0.6682478",
"0.65246737",
"0.65224403",
"0.6496896",
"0.6410336",
"0.6401165",
"0.6374932",
"0.6358086",
"0.63084453",
"0.62696624",
"0.61924845",
"0.6183138",
"0.61739814",
"0.61589485",
"0.6145596",
"0.61026645",
"0.6062061",
"0.6024826",
"0.5933146",
"0.5929512",
"0.59197813",
"0.5897577",
"0.5886112",
"0.5861363",
"0.5850799",
"0.58288246",
"0.57841986",
"0.57841986",
"0.5768722",
"0.57642627",
"0.5735984",
"0.5710826",
"0.5705816",
"0.57014376",
"0.56787723",
"0.56749284",
"0.5663818",
"0.5653278",
"0.5652585",
"0.5605709",
"0.5579663",
"0.55652845",
"0.5563467",
"0.5563467",
"0.55614746",
"0.55614746",
"0.5553719",
"0.55433536",
"0.5539155",
"0.5534933",
"0.55307776",
"0.5525632",
"0.5521095",
"0.5512805",
"0.5512447",
"0.55069244",
"0.55056155",
"0.55056155",
"0.55056155",
"0.55056155",
"0.54916286",
"0.5487809",
"0.54778713",
"0.54713833",
"0.5469894",
"0.54618233",
"0.5457014",
"0.54556364",
"0.5454768",
"0.54510754",
"0.5445963",
"0.5445401",
"0.54392064",
"0.54382145",
"0.54282135",
"0.5427308",
"0.54266673",
"0.5424162",
"0.5424025",
"0.54217964",
"0.5419799",
"0.54194653",
"0.5416968",
"0.5411767",
"0.5411767",
"0.5411767",
"0.5408386",
"0.5398492"
] |
0.6204986
|
22
|
Highlight the default values for specified flag
|
def dh(str = '')
return '' if str.blank?
str = str.split(': ')
str.count > 1 ? "\e[36m#{str[0]}: \e[31m#{str[1]}\e[0m" : "\e[34m#{str[0]}\e[0m"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def default_flags\n flags.select &:default\n end",
"def flag_color(flag)\n if flag.name == \"important\" # important\n \"bl_bookmarks__item--flag__important ion-record\"\n elsif flag.name == \"very important\" # very important\n \"bl_bookmarks__item--flag__very-important ion-record\"\n elsif flag.name == \"normal\" # normal\n \"bl_bookmarks__item--flag__normal ion-record\"\n end\n end",
"def feature_flags_with_defaults\n flag_names = FeatureFlag.pluck(:name).sort\n FeatureFlag.default_flag_hash.merge(feature_flags_for(*flag_names)).with_indifferent_access\n end",
"def default_values\n\t\tself.done ||= 'false'\n\t\tself.flag ||= 'false'\n\tend",
"def flagging\n @title = 'Flags and their meaning'\n @css = 'flags.css'\n end",
"def set_highlight(val)\n add_actions \"SetHighlight(#{val})\"\n end",
"def default_values\n \t self.status ||= '0'\n \tend",
"def set_default_annotation\n return if study.default_options[:annotation].present?\n\n cell_metadatum = study.cell_metadata.keep_if(&:can_visualize?).first || study.cell_metadata.first\n cluster = study.cluster_groups.first\n if cluster.present?\n cell_annotation = cluster.cell_annotations.select { |annot| cluster.can_visualize_cell_annotation?(annot) }\n .first || cluster.cell_annotations.first\n else\n cell_annotation = nil\n end\n annotation_object = cell_metadatum || cell_annotation\n return if annotation_object.nil?\n\n if annotation_object.is_a?(CellMetadatum)\n study.default_options[:annotation] = annotation_object.annotation_select_value\n is_numeric = annotation_object.annotation_type == 'numeric'\n elsif annotation_object.is_a?(Hash) && cluster.present?\n study.default_options[:annotation] = cluster.annotation_select_value(annotation_object)\n is_numeric = annotation_object[:type] == 'numeric'\n end\n study.default_options[:color_profile] = 'Reds' if is_numeric\n end",
"def colorised(enable)\n return ->(x) {\n if (OPTIONS.key?(x))\n OPTIONS[x][:key] + ' ' +\n ((enable and OPTIONS[x][:modified]) ?\n OPTIONS[x][:arg].red.underline :\n OPTIONS[x][:arg])\n else\n enable ? x.red : x\n end\n }\nend",
"def use_default_style!\n @use_default_style = true\n end",
"def default_labels\n labels = { 'user-story' => 'magenta', 'tech-story' => 'green' }\n %w{ bug issue }.each { |k| labels[k] = 'red' }\n %w{ improvement enhancement }.each { |k| labels[k] = 'yellow' }\n %w{ documentation docs }.each { |k| labels[k] = 'cyan' }\n labels['other'] = 'blue'\n return labels\n end",
"def vary_colors=(v) Axlsx.validate_boolean(v); @vary_colors = v; end",
"def flag_def\n @@flag_def||=reset_flag_def\n @@flag_def[self.to_s]||[]\n end",
"def __strval_optkeys\n super() << 'selectcolor' << 'title'\n end",
"def flag_name_and_value\n \"#{self.name}-#{self.value}\"\n end",
"def s(val); @style = val; end",
"def default_style\n return 0\n end",
"def flag index=nil\n index ||= @cursor\n @flags[index] = !@flags[index]\n display\n end",
"def highlights_on\n @highlights_on ||= options[:highlights_on]\n end",
"def default_format(*value)\n set_format(@entry_format_default, *value)\n end",
"def disable_colorization=(value); end",
"def display_flags=(value)\n @children['display-flags'][:value] = value\n end",
"def use_default_customizations!\n DEFAULT_CUSTOMIZATIONS.each_pair do |field, default_value|\n send(\"#{field}=\".to_sym, default_value)\n end\n DEFAULT_COLORS.each_key do |field|\n send(\"color_#{field}=\".to_sym, nil)\n end\n save\n end",
"def default_values\n\t\tself.status = false\n\tend",
"def default_values\n self.active ||= false\n end",
"def red=(value)\n end",
"def check_light_defaults(defs, global_defaults)\n # global_defaults :: (property -> (default -> [[release,job]...]))\n\n defs.each do |prop, opinion|\n # Ignore specials\n next if Common.special_property(prop)\n # Ignore more specials\n next unless prop.start_with? 'properties.'\n prop = prop.sub(/^properties./, '')\n # Ignore unknown/undefined\n next unless global_defaults.include? prop\n # Ignore if default is not unambigous\n if global_defaults[prop].size > 1\n STDOUT.puts \"light opinion #{prop.yellow} ignored, #{\"ambiguous default\".yellow}\"\n next\n end\n\n # Get the unambigous default\n default = global_defaults[prop].keys[0]\n\n next unless opinion == default\n\n # Ok, the opinion matches an unambigous default in the releases.\n # That is noteworthy.\n\n STDOUT.puts \"light opinion #{prop.red} matches default of #{stringify(opinion).red}\"\n @has_errors += 1\n end\nend",
"def flag(name,aliases,desc,long_desc,default_value,arg_name,must_match,type)\n abstract!\n end",
"def enable_highlight(align)\n @highlight[align] = true\n end",
"def highlights; end",
"def highlights; end",
"def highlights; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def green=(_); end",
"def adjust_colors (props = {foreground: \"red\", background: \"white\"})\n\tputs \"Foreground: #{props[:foreground]}\" if props[:foreground]\n\tputs \"Background: #{props[:background]}\" if props[:background]\n\nend",
"def default_values\n if self.status.nil?\n self.status = 1\n end\n end",
"def flag; end",
"def _builtin_xf_description(value)\n {\n 0 => :'Normal style', # fStyle value == 1\n 1 => :'Row outline level 1', # 1\n 2 => :'Row outline level 2', # 1\n 3 => :'Row outline level 3', # 1\n 4 => :'Row outline level 4', # 1\n 5 => :'Row outline level 5', # 1\n 6 => :'Row outline level 6', # 1\n 7 => :'Row outline level 7', # 1\n 8 => :'Column outline level 1', # 1\n 9 => :'Column outline level 2', # 1\n 10 => :'Column outline level 3', # 1\n 11 => :'Column outline level 4', # 1\n 12 => :'Column outline level 5', # 1\n 13 => :'Column outline level 6', # 1\n 14 => :'Column outline level 7', # 1\n 15 => :'Default cell format', # 0\n }[value]\n end",
"def default_values\n self.avg_rating ||= -1\n end",
"def default!\n self.severity = :DEFAULT\n end",
"def default_values\n\t\tself.status = 0\n\tend",
"def setfillintstyle(*)\n super\n end",
"def initial_flag_description\n case initial_flag\n when :normal_operation then 'Normal operation'\n when :set_initialization_data then 'Set initialization data'\n when :initialization_data_complete then 'Initialization data complete'\n end\n end",
"def select_default_values\n return if @default_value.nil?\n # NOTE list not yet created\n raise \"list has not yet been created\" unless @list\n index = node_to_row @default_value\n raise \"could not find node #{@default_value}, #{@list} \" unless index\n return unless index\n @current_index = index\n toggle_row_selection\n @default_value = nil\n end",
"def green=(value)\n end",
"def foreground(*values); end",
"def foreground(*values); end",
"def default_options\n { \n :x => 20,\n :y => 20,\n :gauge_color => \"ff0000\",\n :legend_color => \"cc0000\",\n }\n end",
"def default_options\n { \n \"Created Date Range\" => {:field_type => :date_range, :for => \"created_at\", :from => \"2012-03-01\".to_date, :to => Time.current},\n \"Account Status\" => {:field_type => :check_box_tag, :for => 'approved', :multiple => {1 => \"Active/Approved\", 0 => \"Deactivated\"},\n :selected => [\"Active/Approved\"]},\n }\n end",
"def flags; end",
"def flag!\n @flagged = values.keys\n end",
"def theme=(_arg0); end",
"def setup_defaults\n validate_defaults\n @selected = @choices.values_at(*@default.map { |d| d - 1 })\n @active = @default.last unless @selected.empty?\n end",
"def flags=(value)\n if value == @defaults['flags']\n @values.delete 'flags' if @values.key? 'flags'\n else\n @values['flags'] = value\n end\n end",
"def colorized?; end",
"def red=(_); end",
"def blue=(value)\n end",
"def blue=(_); end",
"def set_default\n end",
"def set_defaults\n self.featured ||= 1\n end",
"def setDefaultColor\n self.changeColor A_NORMAL, COLOR_WHITE, COLOR_BLACK\n end",
"def set_defaults\n\t\tself.badge ||= Placeholder.image_generator(height: '150', width: '150')\n\tend",
"def color\n if not @title\n 'blank'\n elsif @warnings\n 'missing'\n elsif @missing\n 'missing'\n elsif @approved\n if @approved.length < 5\n 'ready'\n elsif @comments\n 'commented'\n else\n 'reviewed'\n end\n elsif @text or @report\n 'available'\n elsif @text === undefined\n 'missing'\n else\n 'reviewed'\n end\n end",
"def generate_flags_flat overrides = {}\n generate_flags(overrides).map { |k, v| [k, v] }.concat(%w|--force .|).flatten\n end",
"def method_missing(name, *args)\n if @colours.include? name\n \"#{@colours[name]}#{args[0]}\\033[0m\"\n else\n \"#{@default}#{args[0]}\\033[0m\"\n end\n end",
"def flags=(val)\n @val = val\n end",
"def styles=(_arg0); end",
"def setfillstyle(*)\n super\n end",
"def set_defaults\n end",
"def set_defaults\n end",
"def default_values\n\t\tself.status = 0 unless self.status\n\t\tself.tagged = 0 unless self.tagged\n\t\tself.searched = 0 unless self.searched\n\tend",
"def reset_is_default_flags\n if self.is_default == true\n self.time_series.weights.get_all_but(self.id).update_all(is_default: false)\n end\n end",
"def set_study_default_options\n @default_cluster = @study.default_cluster\n @default_cluster_annotations = {\n 'Study Wide' => @study.viewable_metadata.map {|metadata| metadata.annotation_select_option }\n }\n unless @default_cluster.nil?\n @default_cluster_annotations['Cluster-based'] = @default_cluster.cell_annotations\n .keep_if {|annot| @default_cluster.can_visualize_cell_annotation?(annot)}\n .map {|annot| @default_cluster.formatted_cell_annotation(annot)}\n end\n end",
"def adjust_colors( props={foreground: \"red\", background: \"white\"} )\n puts \"Foreground: #{props[:foreground]}\" if props[:foreground]\n puts \"Background: #{props[:background]}\" if props[:background]\nend",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def defaults!; end",
"def defaults!; end",
"def settextcolorind(*)\n super\n end",
"def style=(_); end",
"def highlighter=(_arg0); end",
"def inplace_editable_default_display_with(value); value; end",
"def setfillcolorind(*)\n super\n end",
"def default_value(value); value; end",
"def feature_flag_for(flag_name)\n opt = get_flag_option(flag_name)\n opt.present? ? opt.value : FeatureFlag.find_by(name: flag_name)&.default_value\n end",
"def flag(short_name, long_name, description, &block)\n\t\t\treturn define_value(short_name, long_name, description, true, false, block)\n\t\tend",
"def default_args(a,b,c=1)\n puts \"\\nValues of variables: \",a,b,c\nend",
"def initialize_defaults\n %w(show_first_column show_last_column show_row_stripes show_column_stripes).each do |attr|\n send(\"#{attr}=\", 0)\n end\n end"
] |
[
"0.6422909",
"0.6186971",
"0.6046564",
"0.5976",
"0.5908239",
"0.5669702",
"0.5654317",
"0.5652902",
"0.56326693",
"0.56317955",
"0.5616121",
"0.5602403",
"0.55953825",
"0.557259",
"0.5559409",
"0.552648",
"0.5511145",
"0.55029476",
"0.5502667",
"0.5475839",
"0.5444285",
"0.5443557",
"0.5443209",
"0.5433951",
"0.54232144",
"0.54192764",
"0.5392181",
"0.5376415",
"0.53695065",
"0.53503305",
"0.53503305",
"0.53503305",
"0.53459173",
"0.53459173",
"0.53459173",
"0.53459173",
"0.53459173",
"0.53459173",
"0.53459173",
"0.53459173",
"0.53459173",
"0.53459173",
"0.5339756",
"0.53204274",
"0.53132993",
"0.5313116",
"0.52880156",
"0.52831686",
"0.52827346",
"0.5281677",
"0.52776885",
"0.5273996",
"0.52679884",
"0.5267447",
"0.5259696",
"0.5259696",
"0.52575284",
"0.5246937",
"0.5246468",
"0.52455354",
"0.5243665",
"0.5230835",
"0.5227067",
"0.5206947",
"0.5203559",
"0.51980203",
"0.5188693",
"0.5179039",
"0.5171305",
"0.51677805",
"0.5160311",
"0.5156753",
"0.51501834",
"0.51474327",
"0.5146598",
"0.5145769",
"0.51452965",
"0.5142543",
"0.5142543",
"0.51384425",
"0.51378495",
"0.51325184",
"0.5130602",
"0.51296335",
"0.51296335",
"0.51296335",
"0.51296335",
"0.51296335",
"0.51296335",
"0.5128299",
"0.5128299",
"0.5123659",
"0.5115807",
"0.51150405",
"0.51118135",
"0.5105594",
"0.5105504",
"0.5100839",
"0.50982326",
"0.5096084",
"0.5088211"
] |
0.0
|
-1
|
Used to create and return the .env file database configuration for the specific environment
|
def dotfile_databases(database, env)
return '' if database == 'sqlite3'
db = { username: "DB_USER=appUser123\n",
password: "DB_PASSWORD=App($)Password\n",
sid: '',
host: '' }
case database
when 'oracle'
db = { username: "DB_USER=system\n",
password: "DB_PASSWORD=oracle\n",
sid: "DB_SID=xe\n" }
when 'sqlserver'
db[:username] = "DB_USER=SA\n"
db[:password] = "DB_PASSWORD=yourStrong(!)Password\n"
end
db[:host] = "DB_HOST=localhost\n" unless env == 'docker'
"#{db[:username]}#{db[:password]}#{db[:host]}#{db[:sid]}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def db_file\n env_config['db_file'] || raise('environment problem:environment information not loaded')\n end",
"def read_config\n db_config = YAML.load_file('config/database.yml.production')\n set :db_user, db_config[rails_env][\"username\"]\n set :db_password, db_config[rails_env][\"password\"] \n set :db_name, db_config[rails_env][\"database\"]\nend",
"def read_config\n db_config = YAML.load_file('config/database.yml.production')\n set :db_user, db_config[rails_env][\"username\"]\n set :db_password, db_config[rails_env][\"password\"] \n set :db_name, db_config[rails_env][\"database\"]\nend",
"def env_file\n dir['env.rb']\n end",
"def get_db_conf(env='development')\n Rails.configuration.database_configuration[env]\nend",
"def db_config\n @db_config ||= begin \n raise \"ENV['#{env_prefix}_DATABASE_URL'] expected but not found!\" unless ENV[\"#{env_prefix}_DATABASE_URL\"]\n config = parse_db_uri(ENV[\"#{env_prefix}_DATABASE_URL\"])\n \n if ENV[\"#{env_prefix}_DATABASE_CA\"]\n config.merge!(db_configuration({\n :sslca => ENV[\"#{env_prefix}_DATABASE_CA\"],\n :sslcert => ENV[\"#{env_prefix}_DATABASE_CERT\"],\n :sslkey => ENV[\"#{env_prefix}_DATABASE_KEY\"],\n }))\n end\n \n config\n end\n end",
"def create_database_config_file(db = nil)\n fpath = db ? \"/multiple_dbs/#{db}_database.yml\" : \"/database.yml\"\n db ||= databases.first\n copy_file \"config_db.yml\", \"config#{fpath}\"\n\n insert_into_file \"config#{fpath}\",\n %Q{#{options.development[\"adapter\"] ? options.development[\"adapter\"] : @@default_db_config[\"adapter\"] } },\n before: \"#development_adapter\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.development[\"encoding\"] ? options.development[\"encoding\"] : @@default_db_config[\"encoding\"] } },\n before: \"#development_encoding\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.development[\"pool\"] ? options.development[\"pool\"] : @@default_db_config[\"pool\"] } },\n before: \"#development_pool\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{db}_development },\n before: \"#development_database\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.development[\"username\"] ? options.development[\"username\"] : @@default_db_config[\"username\"] } },\n before: \"#development_username\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.development[\"password\"] ? options.development[\"password\"] : @@default_db_config[\"password\"] } },\n before: \"#development_psw\", verbose: false, force: true\n\n insert_into_file \"config#{fpath}\",\n %Q{#{options.production[\"adapter\"] ? options.production[\"adapter\"] : @@default_db_config[\"adapter\"] } },\n before: \"#production_adapter\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.production[\"encoding\"] ? options.production[\"encoding\"] : @@default_db_config[\"encoding\"] } },\n before: \"#production_encoding\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.production[\"pool\"] ? options.production[\"pool\"] : @@default_db_config[\"pool\"] } },\n before: \"#production_pool\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{db}_production },\n before: \"#production_database\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.production[\"username\"] ? options.production[\"username\"] : @@default_db_config[\"username\"] } },\n before: \"#production_username\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.production[\"password\"] ? options.production[\"password\"] : @@default_db_config[\"password\"] } },\n before: \"#production_psw\", verbose: false, force: true\n\n insert_into_file \"config#{fpath}\",\n %Q{#{options.test[\"adapter\"] ? options.test[\"adapter\"] : @@default_db_config[\"adapter\"] } },\n before: \"#test_adapter\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.test[\"encoding\"] ? options.test[\"encoding\"] : @@default_db_config[\"encoding\"] } },\n before: \"#test_encoding\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.test[\"pool\"] ? options.test[\"pool\"] : @@default_db_config[\"pool\"] } },\n before: \"#test_pool\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{db}_test },\n before: \"#test_database\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.test[\"username\"] ? options.test[\"username\"] : @@default_db_config[\"username\"] } },\n before: \"#test_username\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.test[\"password\"] ? options.test[\"password\"] : @@default_db_config[\"password\"] } },\n before: \"#test_psw\", verbose: false, force: true\n end",
"def default_database; ENV['APP_DB'] end",
"def remote_database_config(db)\n env = rails_env || db\n config = capture \"cat #{latest_release}/config/database.yml\"\n database = YAML::load(config)\n return database[\"#{env}\"]['username'], database[\"#{env}\"]['password'], database[\"#{env}\"]['database'], database[\"#{env}\"]['host']\n end",
"def env_table\n ENV\n end",
"def config_file\n env_config['config_file'] || raise('environment problem:environment information not loaded')\n end",
"def database\n config[\"database\"]\n end",
"def db_log_file\n env_config['db_log_file'] || raise('environment problem:environment information not loaded')\n end",
"def env_config; end",
"def env_config; end",
"def env_config; end",
"def env_config; end",
"def setup_db\n return unless File.exist?(\"#{Jets.root}/config/database.yml\")\n\n db_configs = Jets.application.config.database\n # DatabaseTasks.database_configuration for db:create db:migrate tasks\n # Documented in DatabaseTasks that this is the right way to set it when\n # using ActiveRecord rake tasks outside of Rails.\n ActiveRecord::Tasks::DatabaseTasks.database_configuration = db_configs\n\n current_config = db_configs[Jets.env]\n if current_config.blank?\n abort(\"ERROR: config/database.yml exists but no environment section configured for #{Jets.env}\")\n end\n # Using ActiveRecord rake tasks outside of Rails, so we need to set up the\n # db connection ourselves\n ActiveRecord::Base.establish_connection(current_config)\n end",
"def env\n config.env\n end",
"def env\n config.env\n end",
"def create_database_yml\n return unless File.directory?(\"/app/#{ENV['app_dir']}/config\")\n topic \"Writing config/database.yml to read from DATABASE_URL\"\n File.open(\"/app/#{ENV['app_dir']}/config/database.yml\", \"w\") do |file|\n file.puts <<-DATABASE_YML\n<%\n\nrequire 'cgi'\nrequire 'uri'\n\nbegin\nuri = URI.parse(ENV[\"DATABASE_URL\"])\nrescue URI::InvalidURIError\nraise \"Invalid DATABASE_URL\"\nend\n\nraise \"No RACK_ENV or RAILS_ENV found\" unless ENV[\"RAILS_ENV\"] || ENV[\"RACK_ENV\"]\n\ndef attribute(name, value, force_string = false)\nif value\nvalue_string =\nif force_string\n '\"' + value + '\"'\nelse\n value\nend\n\"\\#{name}: \\#{value_string}\"\nelse\n\"\"\nend\nend\n\nadapter = uri.scheme\nadapter = \"postgresql\" if adapter == \"postgres\"\n\ndatabase = (uri.path || \"\").split(\"/\")[1]\n\nusername = uri.user\npassword = uri.password\n\nhost = uri.host\nport = uri.port\n\nparams = CGI.parse(uri.query || \"\")\n\n%>\n\ntest:\n<%= attribute \"adapter\", adapter %>\n<%= attribute \"database\", database %>\n<%= attribute \"username\", username %>\n<%= attribute \"password\", password, true %>\n<%= attribute \"host\", host %>\n<%= attribute \"port\", port %>\n\n<% params.each do |key, value| %>\n<%= key %>: <%= value.first %>\n<% end %>\n DATABASE_YML\n end\nend",
"def modify_database_yml_as_needed!\n require 'yaml'\n\n db_yaml_file = File.join('config', 'database.yml')\n db_yaml = YAML.load_file(db_yaml_file)\n\n unless db_yaml[rails_env]\n notify(\"adding environment '#{rails_env}' to database.yml\") do\n test_content = db_yaml['test']\n raise \"No default database.yml entry for 'test'?!?\" unless test_content\n\n db_yaml[rails_env] = test_content.dup\n new_yaml = YAML.dump(db_yaml)\n # Get rid of the silly '---' line that YAML.dump puts at the start.\n new_yaml = new_yaml.split(\"\\n\").map { |l| l unless l =~ /^\\-+$/i }.compact.join(\"\\n\")\n File.open(db_yaml_file, 'w') { |f| f.puts new_yaml }\n end\n end\n end",
"def config\n @config ||=\n begin\n raise(ConfigError, \"Cannot find config file: #{file_name}\") unless File.exist?(file_name)\n\n env_config = self.class.load_yaml(ERB.new(File.new(file_name).read).result)[env]\n raise(ConfigError, \"Cannot find environment: #{env} in config file: #{file_name}\") unless env_config\n\n env_config = self.class.send(:deep_symbolize_keys, env_config)\n self.class.send(:migrate_old_formats!, env_config)\n end\n end",
"def setup_databases\n postgres_user = app_name\n postgres_pass = SecureRandom.urlsafe_base64\n postgres_port = find_open_port\n redis_port = find_open_port\n\n add_env \"REDIS_URL\",\n \"redis://localhost:#{redis_port}\"\n\n add_env \"DATABASE_URL\",\n \"postgres:///#{postgres_user}:#{postgres_pass}@localhost:#{postgres_port}\",\n skip_secrets: true\n\n template \"database.yml\",\n \"#{app_name}/config/database.yml\",\n force: true\n\n template \"docker-compose.yml\",\n \"#{app_name}/docker-compose.yml\",\n postgres_user: postgres_user,\n postgres_pass: postgres_pass,\n postgres_port: postgres_port,\n redis_port: redis_port\n end",
"def setup_database_url_env\n ENV[\"DATABASE_URL\"] ||= begin\n # need to use a dummy DATABASE_URL here, so rails can load the environment\n scheme =\n if gem_is_bundled?(\"pg\")\n \"postgres\"\n elsif gem_is_bundled?(\"mysql\")\n \"mysql\"\n elsif gem_is_bundled?(\"mysql2\")\n \"mysql2\"\n elsif gem_is_bundled?(\"sqlite3\") || gem_is_bundled?(\"sqlite3-ruby\")\n \"sqlite3\"\n end\n \"#{scheme}://user:pass@127.0.0.1/dbname\"\n end\n end",
"def database_config\n TemplateWriter.process(\n \"database.yml.erb\",\n \"/srv/Portus/config/database.yml\",\n binding\n )\n FileUtils.chown(\"root\", \"www\", \"/srv/Portus/config/database.yml\")\n FileUtils.chmod(0o640, \"/srv/Portus/config/database.yml\")\n end",
"def env_config\n @env_config ||= {}\n end",
"def patch_database_config(path)\n db_config_path = File.expand_path('config/database.yml', path)\n content = <<-YML\ndevelopment:\n url: <%= ENV['DATABASE_URL'] %>\ntest:\n url: <%= ENV['DATABASE_URL'] %>\n YML\n open(db_config_path, 'w').write(content)\n end",
"def config\n root.join('config', 'environment.rb')\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 initialize_database\n config = YAML::load(IO.read(Antfarm::Helpers.defaults_file))\n # Database setup based on adapter specified\n if config && config[ANTFARM_ENV] && config[ANTFARM_ENV].has_key?('adapter')\n if config[ANTFARM_ENV]['adapter'] == 'sqlite3'\n config[ANTFARM_ENV]['database'] = Antfarm::Helpers.db_file(ANTFARM_ENV)\n elsif config[ANTFARM_ENV]['adapter'] == 'postgres'\n config[ANTFARM_ENV]['database'] = ANTFARM_ENV\n else\n # If adapter specified isn't one of sqlite3 or postgresql,\n # default to SQLite3 database configuration.\n config = nil\n end\n else\n # If the current environment configuration doesn't specify a\n # database adapter, default to SQLite3 database configuration.\n config = nil\n end\n # Default to SQLite3 database configuration\n config ||= { ANTFARM_ENV => { 'adapter' => 'sqlite3', 'database' => Antfarm::Helpers.db_file(ANTFARM_ENV) } }\n if config[ANTFARM_ENV]['adapter'] == 'postgres'\n DataMapper.setup(:default, \"postgres:///#{config[ANTFARM_ENV]['database']}\")\n else\n DataMapper.setup(:default, \"sqlite3://#{config[ANTFARM_ENV]['database']}\")\n end\n end",
"def update_env_file!\n present_env = ssh_read_file(app_username, \"#{ app_name }/.env\").to_s\n\n env = {\n \"RAILS_ENV\" => \"production\",\n \"PATH\" => \"/home/#{ app_username }/.rvm/wrappers/#{ app_name }:$PATH\",\n \"SECRET_KEY_BASE\" => SecureRandom.hex(64),\n }.merge(\n Dotenv::Parser.call(present_env)\n ).merge(\n options[:env] || {}\n ).map { |k, v|\n \"export #{ k }=#{ v.inspect }\\n\"\n }.join(\"\")\n\n ssh_write_file(app_username, \"#{ app_name }/.env\", env)\n end",
"def database_config(db)\n database = YAML::load_file('config/database.yml')\n # return database[\"#{db}\"]['username'], database[\"#{db}\"]['password'], database[\"#{db}\"]['database']\n return database[\"#{db}\"].nil? ? nil : database[\"#{db}\"]['database']\nend",
"def database_yml_file\n raise(\":deploy_to in your app/config/deploy/#{fetch(:rails_env)}.rb file cannot contain ~\") if shared_path.to_s.include?('~') # issues/27\n shared_path.join('config/database.yml')\n end",
"def to_env\n CONFIGURABLE_WITH_ENV.each_with_object({}) do |option, env|\n unless (value = @config[option]).nil?\n env[\"#{ ViteRuby::ENV_PREFIX }_#{ option.upcase }\"] = value.to_s\n end\n end.merge(ViteRuby.env)\n end",
"def database_config(db)\n database = YAML::load_file('config/database.yml')\n return database[\"#{db}\"]['username'], database[\"#{db}\"]['password'], database[\"#{db}\"]['database'], database[\"#{db}\"]['host']\n end",
"def config(environment: :development)\n @config ||=\n YAML.safe_load(File.open(File.join(db_dir, \"config.yml\")))\n .fetch(environment.to_s)\n end",
"def create_database_configuration_file\n FileUtils.cp(database_configuration_sample, database_configuration_file)\n end",
"def database_yml\n # Application will be defaulted to using sqlite3, until ready\n # => Application will also have a database[database].yml file to replace and run once the application is read\n template 'config/db/sqlite3.yml', 'config/database.yml', force: true\n\n # The directory config/databases/** is already used by Rails. We don't want to override this, because it won't pull from the gems template files, because they already exist in the rails gem\n # /Users/username/.rvm/gems/ruby-2.6.2/gems/railties-6.0.0/lib/rails/generators/rails/app/templates/config/databases\n if %w[mysql oracle postgresql sqlite3 sqlserver].include? options[:database]\n template \"config/db/#{options[:database]}.yml\", \"config/database[#{options[:database]}].yml\" unless options[:database] == 'sqlite3'\n else\n template \"config/databases/#{options[:database]}.yml\", \"config/database[#{options[:database]}].yml\"\n end\n end",
"def get_env(format, app, node = self.node)\n return '' unless node.attribute?(app)\n\n if node[app]['env'].nil?\n Chef::Log.info(\"Attribute 'env' for application '#{app}' is not defined!\")\n return ''\n end\n\n appenv = streamline_appenv(node[app]['env'])\n generate_config_part(format, 'settings', appenv)\n end",
"def env\n\t\t@rootDir = Dir.new( @rootDir )\n\n\t\t# config file exist\n\t\tif Dir.exist?( @configDir )\n\t\t\t@configDir = Dir.new( @configDir )\n\t\telse\n\t\t\t@configDir = Dir.mkdir( @configDir )\n\t\tend\n\n\t\t@configFile = File.join( @configDir, @configFile )\n\n\t\t# parse config file\n\t\t@configFile = File.new( @configFile ) unless !File.exist?( @configFile )\n\n\t\t@configFile = JSON.parse( @configFile )\n\n\t\tif @configFile['webroot'] == nil\n\t\t\t@configFile['webroot'] = @@webroot\n\t\tend\n\n\t\tif @configFile['port'] == nil\n\t\t\t@configFile['port'] = @@port\n\t\tend\n\tend",
"def database_config( db )\n database = local_database_config_hash\n return database[\"#{db}\"]['username'], database[\"#{db}\"]['password'], database[\"#{db}\"]['database'], database[\"#{db}\"]['host']\n end",
"def add_database_url_config()\n str = ENV['DATABASE_URL']\n if str.blank?\n puts \"no ENV['DATABASE_URL'] found; skip adding DATABASE_URL config\"\n return\n end\n\n ####\n # fix/todo:\n # for config key (now db)\n # use RACK_ENV or RAILS_ENV if present?? why? why not?\n # only if not already in config? possible?\n\n db = URI.parse( str )\n\n ### use spec instead of config ???\n\n if db.scheme == 'postgres'\n config = {\n adapter: 'postgresql',\n host: db.host,\n port: db.port,\n username: db.user,\n password: db.password,\n database: db.path[1..-1],\n encoding: 'utf8'\n }\n else\n config = {\n adapter: db.scheme, # sqlite3\n database: db.path[1..-1] # pluto.db (NB: cut off leading /, thus 1..-1)\n }\n end\n\n puts 'db settings:'\n pp config\n\n if ActiveRecord::Base.configurations.nil?\n puts \"ActiveRecord configurations nil - set to empty hash\"\n ActiveRecord::Base.configurations = {} # make it an empty hash\n end\n\n puts 'ar configurations (before):'\n pp ActiveRecord::Base.configurations\n\n ActiveRecord::Base.configurations['db'] = config\n\n puts 'ar configurations (after):'\n pp ActiveRecord::Base.configurations\nend",
"def database_configuration\n require 'erb'\n YAML::load(ERB.new(IO.read(database_configuration_file)).result) if File.exists?(database_configuration_file)\n end",
"def remote_database_config(db = rails_env)\n remote_config = capture(\"cat #{sync_db_remote_config}\")\n database = YAML::load(remote_config)\n database and database[\"#{db}\"]\n end",
"def determine_url\n ENV[\"DATABASE_URL\"] || database_url_from_database_yml\n end",
"def database_settings\n database_settings_file = \"config/database.yml\"\n valid_file?(database_settings_file) ? YAML::load_file(database_settings_file) : {}\n end",
"def connect_to(env)\n ActiveRecord::Base.establish_connection YAML.safe_load(File.open(Rails.root.join(\"config/database.yml\")).read)[env.to_s]\n end",
"def database_config\n unless defined?(@db_config) && @db_config\n @db_config = Configuration.load_yaml_config(\n Configuration.base_path, 'database.yml')\n end\n\n @db_config\n end",
"def archetype_database_yml_file\n raise(\":deploy_to in your app/config/deploy/#{fetch(:rails_env)}.rb file cannot contain ~\") if shared_path.to_s.include?('~') # issues/27\n deploy_path.join('db/database.yml')\n end",
"def to_a\n to_load = []\n # Dotenv values for your local development environment only\n to_load << File.join(app_root, \".env.custom\") if app_env.development?\n\n # Dotenv values for the local computer\n to_load << File.join(app_root, \".env.local\")\n\n # Dotenv values specific to the current Rails.env\n if app_env\n app_env_dotenv = File.join(app_root, \".env.#{app_env}\")\n protect_against_missing_app_env_dotenv(app_env_dotenv)\n to_load << app_env_dotenv\n end\n\n # Last, but not least, the good 'ol .env file\n to_load << File.join(app_root, \".env\")\n\n to_load\n end",
"def read_env(file = '.env')\n if !ENV['ENV']\n File.open(file, \"r\").each_line do |line|\n a = line.chomp(\"\\n\").split('=',2)\n a[1].gsub!(/^\"|\"$/, '') if ['\\'','\"'].include?(a[1][0])\n eval \"ENV['#{a[0]}']='#{a[1] || ''}'\"\n end\n end\n end",
"def database_configuration\n require 'erb'\n database_configurations = IO.read(database_configuration_file)\n\n client_config_path = \"/#{client_folder}/#{env_client_code}\\\\1\"\n client_database_configuration_file = database_configuration_file.gsub(/(\\/config\\/)/, client_config_path)\n database_configurations << IO.read(client_database_configuration_file) if File.exists?(client_database_configuration_file)\n \n YAML::load(ERB.new(database_configurations).result)\n end",
"def read_env\n dir_path = Dir.pwd\n DataCache.env_hash ||= {}\n loop do\n path = File.join dir_path, TddDeploy::Environ::ENV_FNAME\n if File.exists? TddDeploy::Environ::ENV_FNAME\n line_no = 0\n if f = File.new(path, 'r')\n begin\n f.each do |line|\n line_no += 1\n if line =~ /^\\s*(\\w+)\\s*=\\s*(.*?)\\s*$/\n key = $1.downcase\n if self.env_types.keys.include? key\n self.send \"#{key}=\".to_sym, $2\n # self.env_hash[key] = self.env_types[key] == :list ? self.str_to_list($2) : $2.to_s\n else\n raise ::ArugmentError.new(\"TddDeploy::Environ#read_env: Error in #{TddDeploy::Error::ENV_FNAME}: #{line_no}: Illegal Key: #{key}\")\n end\n else\n raise ::ArugmentError.new(\"TddDeploy::Environ#read_env: Error in #{TddDeploy::Error::ENV_FNAME}: #{line_no}: Unmatched Line: #{line}}\")\n end\n end\n ensure\n f.close\n end\n # add any missing env keys\n (self.env_types.keys - self.env_hash.keys).each do |key|\n case self.env_types[key]\n when :pseudo then next\n when :capfile then next\n when :list\n self.env_hash[key] = str_to_list(self.env_defaults[key])\n else\n self.env_hash[key] = self.env_defaults[key]\n end\n end\n return self.env_hash\n else\n raise ::RuntimeError.new(\"Unable to open #{path} for reading\")\n end\n elsif dir_path.length <= 1\n # reached root level, so initialize to defaults and exit\n return nil\n else\n # move to parent directory\n dir_path = File.expand_path('..', dir_path)\n end\n end\n nil\n end",
"def remote_database_config( db )\n remote_config = capture(\"cat #{shared_path}/config/database.yml\")\n database = YAML::load( remote_config )\n return database[\"#{db}\"]['username'], database[\"#{db}\"]['password'], database[\"#{db}\"]['database'], database[\"#{db}\"]['host']\n end",
"def get_env_data(env)\n config_path = \"#{File.expand_path(\"../../\", __FILE__).gsub('features', '')}config/config.yml\"\n yml = YAML::load(File.read(config_path))\n yml[env.downcase]\nend",
"def write_database_yaml(binding)\n data = database_config_for(binding)\n conf = File.join(destination_directory, 'app', 'config', 'database.yml')\n File.open(conf, 'w') do |fh|\n fh.write(YAML.dump('production' => data))\n end\n binding\n end",
"def app_env\n return @app_env if @app_env\n\n global_app_env = YAML::load_file(\"#{ENV['WARDEN_CONFIG_DIR']}/app_env.yaml\")\n project_app_env_file_path = \"#{Warden::project_path}/etc/app_env.yaml\"\n\n if File.exists?(project_app_env_file_path)\n project_app_env = YAML::load_file(\"#{Warden::project_path}/etc/app_env.yaml\")\n global_app_env.deep_merge!(project_app_env)\n end\n\n @app_env = global_app_env['app_environment']\n end",
"def config_filename\n @config_filename || 'config/database.yml'\n end",
"def create_database_yml\n print_title('Creating database configuration')\n\n @database = Database.create_config(self)\n logger.info(\"Database initialized #{@database}\")\n end",
"def default_database_url\n instrument \"rails3.setup_database_url_env\" do\n # need to use a dummy DATABASE_URL here, so rails can load the environment\n scheme =\n if bundler.has_gem?(\"pg\") || bundler.has_gem?(\"jdbc-postgres\")\n \"postgres\"\n elsif bundler.has_gem?(\"mysql\")\n \"mysql\"\n elsif bundler.has_gem?(\"mysql2\")\n \"mysql2\"\n elsif bundler.has_gem?(\"sqlite3\") || bundler.has_gem?(\"sqlite3-ruby\")\n \"sqlite3\"\n end\n \"#{scheme}://user:pass@127.0.0.1/dbname\"\n end\n end",
"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 db\r\n @db ||= PG.connect(\r\n host: ENV['HOST'],\r\n user: ENV['USER_NAME'],\r\n password: ENV['PASSWORD'],\r\n dbname: ENV['DATABASE']\r\n )\r\nend",
"def fetch_username_and_database\n conf = YAML::load_file(File.expand_path('../../../config/database.yml', __FILE__))\n dbenv = conf[Rails.env]\n [dbenv['username'], dbenv['database']]\n end",
"def create_default_config_files\n create_default_database_yml\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 default_database_configuration_file_with_test_helper\n database_file = default_database_configuration_file_without_test_helper\n File.exists?(database_file) ? database_file : File.join(HELPER_RAILS_ROOT, 'config', 'database.yml')\n end",
"def database_config(db)\n database = YAML::load_file(\"config/#{fetch(:db_file, 'mongoid.yml')}\")\n return database[\"#{db}\"]['clients']['default']['username'], database[\"#{db}\"]['clients']['default']['password'], database[\"#{db}\"]['clients']['default']['database'], database[\"#{db}\"]['clients']['default']['hosts'][0]\n end",
"def database_yml_config\n path = File.expand_path(configuration_path) \n return unless File.exists?(path) \n config = YAML.load(ERB.new(File.read(path)).result)\n\n config[\"development\"] rescue nil\n end",
"def save_env\n f = File.new(TddDeploy::Environ::ENV_FNAME, \"w\")\n self.env_types.keys.sort.each do |k|\n v = self.env_hash[k] || ''\n case self.env_types[k]\n when :int then f.write \"#{k}=#{v}\\n\"\n when :string then f.write \"#{k}=#{v}\\n\"\n when :list then\n f.write \"#{k}=#{self.list_to_str(k)}\\n\" unless k == 'hosts'\n when :pseudo then next\n when :capfile then next\n else\n raise ::RuntimeError.new(\"unknown key: #{k}\")\n end\n end\n f.close\n end",
"def database_config(db)\n puts \"database config called for #{db}\"\n database = YAML::load_file('config/database.yml')\n return (database[\"#{db}\"]['username'] || database[\"#{db}\"]['user']), database[\"#{db}\"]['password'], database[\"#{db}\"]['database'], database[\"#{db}\"]['host']\nend",
"def database_name\n ENV['LEIHS_DATABASE_NAME'].presence || \n ENV['DB_NAME'].presence || \n ENV['PGDATABASE'].presence ||\n 'leihs'\nend",
"def retrieve_file_value(env)\n env['FILE'] || 'db/seeds.rb'\n end",
"def database\n if File.exists? \"#{RAILS_ROOT}/config/idf2chadoxml_database.yml\" then\n db_definition = open(\"#{RAILS_ROOT}/config/idf2chadoxml_database.yml\") { |f| YAML.load(f.read)\n }\n dbinfo = Hash.new\n dbinfo[:dsn] = db_definition['ruby_dsn']\n dbinfo[:user] = db_definition['user']\n dbinfo[:password] = db_definition['password']\n return dbinfo\n else\n raise Exception.new(\"You need an idf2chadoxml_database.yml file in your config/ directory with at least a Ruby DBI dsn.\")\n end\n end",
"def postgresql_database\n # FIXME work in progress\n #encoding = \"-E #{configuration[:postgresql][:encoding]}\" if configuration[:postgresql][:encoding]\n encoding = ''\n template = \"-T #{configuration[:postgresql][:template_database]}\" if configuration[:postgresql][:template_database]\n\n exec \"postgresql_database\",\n :command => \"/usr/bin/createdb -O #{database_environment[:username]} #{encoding} #{template} #{database_environment[:database]}\",\n :unless => \"/usr/bin/psql -l | grep #{database_environment[:database]}\",\n :user => 'postgres',\n :require => exec('postgresql_user'),\n :before => exec('rake tasks')#,\n # :notify => exec('rails_bootstrap') # TODO make this configurable to work with multi_server\n end",
"def pe_environment(certname)\n environment = catalog_environment(certname)\n if environment\n @environment = environment\n else\n Puppet.debug(\"No Environment found in PuppetDB using: #{certname}\")\n Puppet.debug(\"Querying 'puppet config print environment' for Environment\")\n @environment = Puppet::Util::Execution.execute('/opt/puppetlabs/puppet/bin/puppet config print environment --section master', 'combine' => false).chomp\n end\n @environmentpath = Puppet::Util::Execution.execute('/opt/puppetlabs/puppet/bin/puppet config print environmentpath --section master', 'combine' => false).chomp\n end",
"def env_defaults\n DataCache.env_defaults\n end",
"def config\n @config ||= YAML.load_file(config_file)[environment]\n end",
"def prepare_from_yaml\n set(:db_file) { \"#{application}-dump.sql.bz2\" }\n set(:db_remote_file) { \"#{shared_path}/backup/#{db_file}\" }\n set(:db_local_file) { \"tmp/#{db_file}\" }\n set(:db_user) { db_config[rails_env][\"username\"] }\n set(:db_password) { db_config[rails_env][\"password\"] }\n set(:db_host) { db_config[rails_env][\"host\"] }\n set(:db_name) { db_config[rails_env][\"database\"] }\n end",
"def _save_env\n require 'yaml'\n w_var = @var.dup\n @var[:blacklist_env].each { |b| w_var.delete b } if @var[:blacklist_env]\n _open_sefile('env3.yml', 'w') { |f| YAML.dump(w_var, f) }\nend",
"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 prepare_from_yaml\n set(:db_file) { \"#{application}-dump.sql.bz2\" }\n set(:db_remote_file) { \"#{shared_path}/backup/#{db_file}\" }\n set(:db_local_file) { \"tmp/#{db_file}\" }\n set(:db_user) { db_config[rails_env][\"username\"] }\n set(:db_pass) { db_config[rails_env][\"password\"] }\n set(:db_host) { db_config[rails_env][\"host\"] }\n set(:db_name) { db_config[rails_env][\"database\"] }\n end",
"def db\n self.config[:db]\n end",
"def storage_config\n YAML.load_file(Rails.root.join('config', 'storage.yml'))[Rails.env]\n end",
"def build_db_name\n return Cfg.database_dir+DB_FILE_NAME\n end",
"def prepare_from_yaml\n set(:db_file) { \"#{application}-dump.sql.bz2\" }\n set(:db_remote_file) { \"#{current_path}/backup/#{db_file}\" }\n set(:db_local_file) { \"tmp/#{db_file}\" }\n set(:db_user) { db_config[rails_env][\"username\"] }\n set(:db_pass) { db_config[rails_env][\"password\"] }\n set(:db_host) { db_config[rails_env][\"host\"] }\n set(:db_name) { db_config[rails_env][\"database\"] }\n end",
"def environment\n verify_environment\n ENV['ENV']\nend",
"def save_env; end",
"def create_config_base\n # Create keys directory for environment\n FileUtils.cd(self.project_root) { FileUtils.mkdir_p \"config/environments/#{self.name}\" }\n FileUtils.cd(\"#{project_root}/config/environments/#{self.name}\") { FileUtils.mkdir_p %w{steps keys} }\n # Create ssh key for puppet user if environment is vagrant\n generate_puppet_user_keys('vagrant') if self.name == 'vagrant'\n end",
"def load_environment_file(f)\n do_or_die(File.exists?(f),\"Loading environments from #{f}\",\n \"Environment file #{f} does not exist\")\n supp_envs = YAML.load_file(f)\n supp_envs.each_with_object([]) do |(name,options),envs|\n\n # store the environment name inside its configuration hash\n options[:name] = name\n \n # translate alternative keywords for export filters\n %w(filter filters export-filters).each do |f|\n if options.include?(f) \n options[:export_filters] = options[f].split(/[ ,]/)\n options.delete(f) \n end \n end \n\n options = options.each_with_object({}){|(k,v),h| h[k.to_sym] = v} # symbolise keys\n\n # convert arrays into comma-delimited strings\n options = options.each_with_object({}) do |(k,v),h|\n h[k] = v.is_a?(Array) ? v.join(',') : v\n end\n\n # convert space-delimited into comma-delimited strings\n %i(destination with_tags without_tags).each do |f|\n options[f] = options[f].split(/[ ,]/).join(',') if options.include?(f)\n end\n\n envs << options # add hash to environments array\n end\n end",
"def prepare_from_yaml\n set(:db_backup_path) { \"#{shared_path}/backup/\" }\n\n set(:db_local_file) { \"tmp/\" }\n set(:db_user) { db_config[rails_env.to_s][\"username\"] }\n set(:db_pass) { db_config[rails_env.to_s][\"password\"] }\n set(:db_host) { db_config[rails_env.to_s][\"host\"] }\n set(:db_port) { db_config[rails_env.to_s][\"port\"] }\n set(:db_name) { db_config[rails_env.to_s][\"database\"] }\n\n set(:db_remote_backup) { \"#{db_backup_path}/#{db_name}\" }\n end",
"def env_path\n @bin_resolver.env_path\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 exec_env_filepath\n filename.to_s\n end",
"def env\n image = options[:image] || app\n config = api.get_config_vars(app).body\n\n config.keys.sort.each do |key|\n puts \"#{key}=#{config[key]}\"\n end\n end",
"def env_key; end",
"def create_default_database_yml\n db_class = RailsInstaller::Database.dbs[config['database']]\n db_class.database_yml(self)\n end",
"def env\n unless defined?(@environment)\n self.env = DEFAULT_ENVIRONMENT\n end\n\n @environment\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 configure_rails(app_name, instance_name)\n app_config = RailsPwnerer::Config[app_name, instance_name]\n db_name, db_user, db_pass = app_config[:db_name], app_config[:db_user], app_config[:db_pass]\n \n config_file = File.join app_config[:app_path], 'config', 'database.yml'\n configuration = File.open(config_file, 'r') { |f| YAML.load f }\n configuration['production'] ||= {}\n if !configuration['production']['adapter'] or\n !(/mysql/ =~ configuration['production']['adapter'])\n configuration['production']['adapter'] = 'mysql2'\n end\n configuration['production']['encoding'] ||= 'utf8'\n configuration['production'].merge! 'database' => db_name, 'username' => db_user, 'password' => db_pass\n configuration['production'].merge! mysql_host_info() \n File.open(config_file, 'w') { |f| YAML.dump(configuration, f) }\n \n # bonus: lock down the database so only the right user can access it\n pwnerer_user = app_config[:pwnerer_user]\n File.chmod(0600, config_file)\n File.chown(uid_for_username(pwnerer_user), gid_for_username(pwnerer_user), config_file)\n end"
] |
[
"0.75751454",
"0.71477467",
"0.71477467",
"0.6964805",
"0.6949988",
"0.68352944",
"0.678837",
"0.6621911",
"0.66208017",
"0.64604884",
"0.64507",
"0.6421874",
"0.64140874",
"0.64098334",
"0.64098334",
"0.64098334",
"0.64098334",
"0.6398488",
"0.63963884",
"0.63963884",
"0.638698",
"0.6385347",
"0.6345361",
"0.6336688",
"0.6328898",
"0.6321061",
"0.6316037",
"0.63032883",
"0.6301587",
"0.6294228",
"0.62662715",
"0.622584",
"0.6223373",
"0.62110716",
"0.6194427",
"0.6189231",
"0.61765647",
"0.6173956",
"0.6167001",
"0.615661",
"0.61414105",
"0.6137111",
"0.61104536",
"0.6109984",
"0.60997915",
"0.609662",
"0.6082113",
"0.6067693",
"0.6061408",
"0.6010364",
"0.59975314",
"0.5997138",
"0.59949267",
"0.5982924",
"0.59796256",
"0.5965497",
"0.5955385",
"0.5940296",
"0.59216404",
"0.5907453",
"0.59042925",
"0.5901526",
"0.58910316",
"0.5855425",
"0.5851203",
"0.58490807",
"0.58415157",
"0.5836288",
"0.58359265",
"0.5828806",
"0.5822944",
"0.582133",
"0.58089757",
"0.58076286",
"0.5790431",
"0.5783306",
"0.57830745",
"0.57652485",
"0.5761035",
"0.5758325",
"0.5753608",
"0.575306",
"0.5751705",
"0.5751266",
"0.5748293",
"0.57396626",
"0.5737538",
"0.5736421",
"0.57351536",
"0.572961",
"0.5726115",
"0.5723994",
"0.57160175",
"0.5705337",
"0.5702685",
"0.5700328",
"0.5696943",
"0.569506",
"0.5693922",
"0.5685081"
] |
0.7089949
|
3
|
Provide a user friendly representation
|
def to_s
'#<Twilio.Conversations.V1.ConfigurationList>'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_display\n raise NotImplementedError\n end",
"def to_s; description end",
"def to_s\n super\n end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n super\n end",
"def to_s\n \"#{@name}, \" \\\n \"#{model.upcase}: \" \\\n \"#{data.values.join(\"/\")}, \" \\\n \":#{@type}\"\n end",
"def to_s\n\t\tsuper\n\tend",
"def to_s\r\n \"<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}\"\r\n end",
"def render\n inspect\n end",
"def to_s\n pieces = []\n pieces << self.class.name\n pieces << \"id:##{id.inspect}\"\n pieces << \"standardized:\" + (is_standard? ? 'standard' : (standard_id.nil? ? 'no' : \"copy-of-#{standard_id}\"))\n pieces << \"mission:#{mission_id.inspect}\"\n pieces.join(', ')\n end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def rendered_format; end",
"def rendered_format; end",
"def to_s\n render\n end",
"def to_s\n return super\n end",
"def display_string\n display = [self.name]\n display << self.description if self.description && self.type == 'StorageType'\n display << self.software if self.software && self.type == 'DatabaseType'\n cpu = self.cpu_values_string\n display << \"CPU: #{cpu}\" unless cpu.blank? || self.type == 'StorageType'\n display << \"RAM: #{self.memory} GB\" if self.memory && self.type != 'StorageType'\n hdd = self.hdd_values_string\n display << \"HDD: #{hdd}\" unless hdd.blank?\n display << self.operating_system if self.operating_system && self.type != 'StorageType'\n display.join(', ')\n end",
"def to_s\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\n end",
"def humanize\n # TODO\n # Inflector.humanize(self)\n end",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n %(<#{ @name }#{attributes}>)\n end",
"def to_s\n %w( name display_name uuid ).collect { |k| \"#{k}=#{ self.send(k) }\" }.join(' | ') + \" | types=#{ types.join(',') }\"\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n self.name.to_s || super\n end",
"def to_s\n descr\n end",
"def to_s\n self.name.humanize\n end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s ; format ; end",
"def formatted_name\n \"#{self.id} - #{self.name}\"\n #This is used to bring value on each page.\n end",
"def to_s\n\t\t\"#{self.name}\"\n\tend",
"def to_s\n \n end",
"def to_s\n self.name || super\n end",
"def to_s\n self.name || super\n end",
"def to_s\n return \"#{@name} - #{@description} : #{@rating}\"\n end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def to_s\n raise NotImplementedError\n end",
"def short_inspect\n attrs = []\n attrs << [\"id\", id || \"new_record\"]\n\n string_attr = proc { |value| '\"' + TextHelpers.truncate(value, :length => 10) + '\"' }\n\n if respond_to?(:name) && name.present?\n attrs << [\"name\", string_attr[name]]\n elsif respond_to?(:title) && title.present?\n attrs << [\"title\", string_attr[title]]\n end\n\n \"#<#{ self.class } #{ attrs.map { |name, value| \"#{ name }: #{ value }\" }.join(\", \") }>\"\n end"
] |
[
"0.70447654",
"0.7025946",
"0.70086724",
"0.7008141",
"0.69449997",
"0.691802",
"0.6843895",
"0.6797355",
"0.6655898",
"0.6622141",
"0.66182053",
"0.66182053",
"0.66182053",
"0.66182053",
"0.66182053",
"0.66182053",
"0.66182053",
"0.66182053",
"0.6610882",
"0.6610882",
"0.6586841",
"0.657413",
"0.6566269",
"0.6539553",
"0.6538853",
"0.651945",
"0.651945",
"0.651676",
"0.6501867",
"0.6501771",
"0.6501771",
"0.6501771",
"0.6501771",
"0.6486658",
"0.6478414",
"0.6459342",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6443162",
"0.643225",
"0.6429404",
"0.64213824",
"0.6419917",
"0.6419917",
"0.64185613",
"0.64119405",
"0.64119405",
"0.64119405",
"0.64119405",
"0.64119405",
"0.64080113",
"0.63943845"
] |
0.0
|
-1
|
Provide a user friendly representation
|
def to_s
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
"#<Twilio.Conversations.V1.ConfigurationContext #{context}>"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_display\n raise NotImplementedError\n end",
"def to_s; description end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n super\n end",
"def to_s\n super\n end",
"def to_s\n \"#{@name}, \" \\\n \"#{model.upcase}: \" \\\n \"#{data.values.join(\"/\")}, \" \\\n \":#{@type}\"\n end",
"def to_s\n\t\tsuper\n\tend",
"def to_s\r\n \"<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}\"\r\n end",
"def render\n inspect\n end",
"def to_s\n pieces = []\n pieces << self.class.name\n pieces << \"id:##{id.inspect}\"\n pieces << \"standardized:\" + (is_standard? ? 'standard' : (standard_id.nil? ? 'no' : \"copy-of-#{standard_id}\"))\n pieces << \"mission:#{mission_id.inspect}\"\n pieces.join(', ')\n end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def rendered_format; end",
"def rendered_format; end",
"def to_s\n render\n end",
"def to_s\n return super\n end",
"def display_string\n display = [self.name]\n display << self.description if self.description && self.type == 'StorageType'\n display << self.software if self.software && self.type == 'DatabaseType'\n cpu = self.cpu_values_string\n display << \"CPU: #{cpu}\" unless cpu.blank? || self.type == 'StorageType'\n display << \"RAM: #{self.memory} GB\" if self.memory && self.type != 'StorageType'\n hdd = self.hdd_values_string\n display << \"HDD: #{hdd}\" unless hdd.blank?\n display << self.operating_system if self.operating_system && self.type != 'StorageType'\n display.join(', ')\n end",
"def to_s\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\n end",
"def humanize\n # TODO\n # Inflector.humanize(self)\n end",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n %(<#{ @name }#{attributes}>)\n end",
"def to_s\n %w( name display_name uuid ).collect { |k| \"#{k}=#{ self.send(k) }\" }.join(' | ') + \" | types=#{ types.join(',') }\"\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n self.name.to_s || super\n end",
"def to_s\n descr\n end",
"def to_s\n self.name.humanize\n end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s ; format ; end",
"def formatted_name\n \"#{self.id} - #{self.name}\"\n #This is used to bring value on each page.\n end",
"def to_s\n\t\t\"#{self.name}\"\n\tend",
"def to_s\n \n end",
"def to_s\n self.name || super\n end",
"def to_s\n self.name || super\n end",
"def to_s\n return \"#{@name} - #{@description} : #{@rating}\"\n end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def to_s\n raise NotImplementedError\n end",
"def short_inspect\n attrs = []\n attrs << [\"id\", id || \"new_record\"]\n\n string_attr = proc { |value| '\"' + TextHelpers.truncate(value, :length => 10) + '\"' }\n\n if respond_to?(:name) && name.present?\n attrs << [\"name\", string_attr[name]]\n elsif respond_to?(:title) && title.present?\n attrs << [\"title\", string_attr[title]]\n end\n\n \"#<#{ self.class } #{ attrs.map { |name, value| \"#{ name }: #{ value }\" }.join(\", \") }>\"\n end"
] |
[
"0.70430577",
"0.7025487",
"0.7008232",
"0.7007793",
"0.69441473",
"0.6917163",
"0.68431",
"0.6797009",
"0.6655106",
"0.66227216",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.660979",
"0.660979",
"0.6585346",
"0.65730983",
"0.65662885",
"0.65404147",
"0.65379703",
"0.651875",
"0.651875",
"0.6516385",
"0.6501134",
"0.65010244",
"0.65010244",
"0.65010244",
"0.65010244",
"0.64861107",
"0.6478101",
"0.64581114",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6442197",
"0.64329034",
"0.64289695",
"0.64203346",
"0.6419349",
"0.6419349",
"0.6418417",
"0.64115626",
"0.64115626",
"0.64115626",
"0.64115626",
"0.64115626",
"0.64071685",
"0.63947713"
] |
0.0
|
-1
|
Provide a detailed, user friendly representation
|
def inspect
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
"#<Twilio.Conversations.V1.ConfigurationContext #{context}>"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def details; end",
"def to_s; description end",
"def get_detail\n return self.inspect\n end",
"def to_display\n raise NotImplementedError\n end",
"def formatted_info\n \"#{self.name} - #{self.description}\"\n end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def inspect\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\n end",
"def short_inspect\n attrs = []\n attrs << [\"id\", id || \"new_record\"]\n\n string_attr = proc { |value| '\"' + TextHelpers.truncate(value, :length => 10) + '\"' }\n\n if respond_to?(:name) && name.present?\n attrs << [\"name\", string_attr[name]]\n elsif respond_to?(:title) && title.present?\n attrs << [\"title\", string_attr[title]]\n end\n\n \"#<#{ self.class } #{ attrs.map { |name, value| \"#{ name }: #{ value }\" }.join(\", \") }>\"\n end",
"def render\n inspect\n end",
"def overview\n\n end",
"def record_display\n string = \"#{id}. Title: #{title}\\n Author: #{author}\\n ISBN: #{isbn}\\n\"\n if library.nil?\n string += \" Library: None\\n\"\n else\n string += \" Library: #{library.branch_name}\\n\"\n end\n if patron.nil?\n string += \" Checked Out: Available\"\n else\n string += \" Checked Out: #{patron.name}\"\n end\n string\n end",
"def render_plain\n short_category(object.action) << \"\\n\" << instance_attributes\n end",
"def details\n\n return @description + \": \" + \"#{@infection}\" + \". \" + @patient.details\n\n end",
"def to_s\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\n end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def display_string\n display = [self.name]\n display << self.description if self.description && self.type == 'StorageType'\n display << self.software if self.software && self.type == 'DatabaseType'\n cpu = self.cpu_values_string\n display << \"CPU: #{cpu}\" unless cpu.blank? || self.type == 'StorageType'\n display << \"RAM: #{self.memory} GB\" if self.memory && self.type != 'StorageType'\n hdd = self.hdd_values_string\n display << \"HDD: #{hdd}\" unless hdd.blank?\n display << self.operating_system if self.operating_system && self.type != 'StorageType'\n display.join(', ')\n end",
"def to_s\r\n \"<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}\"\r\n end",
"def full_description\n \"#{self.class.description} #{self.description}\"\n end",
"def to_s\n descr\n end",
"def details\r\n return @description + \"; \" + @vPatients + \"; \" + @vProfiles + \": \" + @vAppointments\r\n end",
"def display\n to_h.fetch(:display)\n end",
"def display\n to_h.fetch(:display)\n end",
"def inspect_details\n\t\treturn \"ID=%s (%s)\" % [\n\t\t\tself.id,\n\t\t\tself.components.keys.map( &:name ).sort.join( '+' )\n\t\t]\n\tend",
"def to_s\n\t\tres = \"\\nname: \" + name.to_s + \"\\nid: \" + id.to_s + \"\\nservice: \" + service.to_s + \"\\ntitle: \" + title.to_s + \"\\nthumbnail: \" + thumbnail.to_s + \"\\nhref: \" + href.to_s\n\t\tres\n\tend",
"def details\n\t\t\"#{name}---#{status}-----#{start_date}----#{description}---- #{Client.find(client_id).name}---#{Client.find(client_id).email}\"\n\tend",
"def show\n @title = @user.complete_name\n @description = \"Informations relatives à #{@user.complete_name}\"\n @jsonld = @user.to_jsonld\n end",
"def details\n end",
"def to_s\n \"#{represent_status} : #{description}\"\n end",
"def details\n format_description(@description) + \"site name: \" + format_name\n end",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n\t\tdescription\n\tend",
"def to_s_details\n ''\n end",
"def details\n\n end",
"def descriptions\n return @detail + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end",
"def show\n\t\t@attrib_keys = [\"desc\", \"higher_level\", \"range\", \"components\", \"material\", \"ritual\", \"duration\", \"concentration\", \"casting_time\", \"level\", \"school\", \"class_names\", \"archetype\", \"domains\", \"oaths\", \"circles\", \"patrons\"]\n\tend",
"def to_s\n \"#{@name}, \" \\\n \"#{model.upcase}: \" \\\n \"#{data.values.join(\"/\")}, \" \\\n \":#{@type}\"\n end",
"def inspect_details\n ''\n end",
"def inspect\n \"#<#{self.class} ##{id} #{name} (#{slug})>\"\n end",
"def display_quick\r\n s = ''\r\n for i in @me.keys\r\n s << \" <b>#{i}.</b><br/>\" # country\r\n for j in @me[i].keys\r\n s << \" <b>#{j}:</b><br/>\" if not j == 'unknown' # state\r\n for k in @me[i][j].keys\r\n s << \" #{k}<br/>\" if not k == 'unknown' # county\r\n for l in @me[i][j][k].keys\r\n s << (\" \" + (l == 'unknown' ? \"<i>repository not given</i>\" : \" #{l}\") + \"<br/>\") if not l == nil # repository\r\n s << \" \" + @me[i][j][k][l].keys.collect{|m| \r\n (\"#{@me[i][j][k][l][m]} \" +\r\n case m # the count\r\n when 'female'\r\n \"♀\"\r\n when 'male'\r\n \"♂\"\r\n when 'gynadropmorph'\r\n \"[♀♂]\"\r\n else\r\n \"unknown sex\"\r\n end)}.join(\",\") \r\n s << \"<br/>\" \r\n end\r\n end\r\n end\r\n end\r\n s.html_safe\r\n end",
"def details\n return @description + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end",
"def to_s\n super\n end",
"def to_s\n pieces = []\n pieces << self.class.name\n pieces << \"id:##{id.inspect}\"\n pieces << \"standardized:\" + (is_standard? ? 'standard' : (standard_id.nil? ? 'no' : \"copy-of-#{standard_id}\"))\n pieces << \"mission:#{mission_id.inspect}\"\n pieces.join(', ')\n end",
"def rendered_format; end",
"def rendered_format; end",
"def to_s\n\t\t\tstr = super() + \"\\n\"\n\t\t\tstr += \"\\tAppaleable? #{appaleable}\\n\" if appaleable\n\t\t\tstr += \"\\tDisapproved text: #{disapproved_text}\\n\" if disapproved_text\n\t\t\tstr += \"\\tLocation: #{location}\\n\" if location\n\t\t\tstr += \"\\tDisapproved text: #{disapproved_text}\\n\" if disapproved_text\n\t\t\tstr += \"\\tReason code: #{reason_code} (see: http://msdn.microsoft.com/en-US/library/bing-ads-editorialfailurereasoncodes.aspx)\\n\" if reason_code\n\n\t\tend",
"def display_data\n\t\t\t\"#{@model} #{@color} #{@horsepower} #{@year} #{@brand} #{@mpg}\"\n\t\tend",
"def to_s\n \"\\n\\tTitle: #{@title}\\n\n \\tAuthor: #{@author}\\n\n \\tUrl: #{@url}\\n\\n\"\n end",
"def inspect\n to_s.inspect\n end",
"def details\n data()\n end",
"def details\n\n return @description + \"; \" + @firstname + \"; \" + @lastname + \": \" + @dob + \": \"+ @address + \": \"+ @phone + \": \" + \"#{@infection}\"\n\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def show\n raise NotImplementedError\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def inspect\n\t\tparts = []\n\t\tparts << self.one_of_description\n\t\tparts << self.all_of_description\n\t\tparts << self.none_of_description\n\t\tparts.compact!\n\n\t\tstr = \"#<%p:%#0x matching entities\" % [ self.class, self.object_id * 2 ]\n\t\tif parts.empty?\n\t\t\tstr << \" with any components\"\n\t\telse\n\t\t\tstr << parts.join( ', ' )\n\t\tend\n\t\tstr << \">\"\n\n\t\treturn str\n\tend",
"def inspect\n to_s\n end",
"def description\n return summary\n end",
"def details\n return @description + \"; \" + @doctorname + \"; \" + @medicine + \": \" + \"#{@cost}\"\n end",
"def details\n return \"ID = #{@id}\\n\" + \n \"Name = #{@name}\\n\" + \n \"Topic = #{@topic}\\n\" + \n \"Member Count = #{@member_count}\"\n end",
"def description\n name + ': ' + resource_type.to_s + ' | Sueldo: ' + salary.to_s +\n ' | Experiencia: ' + experience.to_s + ' años'\n end",
"def show\n\t\traise NotImplementedError, \"FIXME: Implement showing comments.\"\n\tend",
"def to_s\n return \"#{@name} - #{@description} : #{@rating}\"\n end",
"def inspect\n \"#{self.class}<#{@description.inspect}>\"\n end",
"def description\n end",
"def description\n end",
"def details\n return \" #{@description}, #{@lastname}, #{@date}. #{@start}, #{@hours}, #{@players}, #{@zone}. #{@cost}\"\n end",
"def display\n\t\tname\n\tend",
"def display\n\t\tname\n\tend",
"def display\n\t\tname\n\tend",
"def display\n\t\tname\n\tend",
"def details\n return @description + \"; \" + @manufacturer + \"; \" + @color + \": \" + \"#{@cost}\"\n end",
"def to_s\n \"#{self.title} - #{self.author} - #{self.date}\"\n end",
"def details\r\n return @description + \": \" + \". \" + @basic_profile.details\r\n end",
"def show\n #not needed for our implementation\n end",
"def to_s\n super\n end",
"def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end",
"def details_partial_for(o)\n \"#{o.class.name.underscore}s/details\"\n end",
"def display\n puts \"Personal Details\"\n puts \" Name : #{self.name}\"\n puts \" Date of Birth : #{self.dob}\"\n puts \" Marital Status : #{self.marital_status}\"\n puts \" Mobile Number : #{self.mobile_number}\"\n puts \" Email : #{self.email}\"\n end",
"def detail\n attributes.fetch(:detail)\n end",
"def detail\n attributes.fetch(:detail)\n end"
] |
[
"0.68170065",
"0.68142146",
"0.6758589",
"0.6718451",
"0.66697186",
"0.6655344",
"0.6632312",
"0.66273594",
"0.6550127",
"0.65188134",
"0.6497969",
"0.6480078",
"0.6477721",
"0.6472211",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64367676",
"0.6434794",
"0.63974625",
"0.6391661",
"0.6385164",
"0.63826483",
"0.63826483",
"0.63621265",
"0.63584715",
"0.6352767",
"0.6347243",
"0.6345342",
"0.63338625",
"0.6325844",
"0.6320725",
"0.6320725",
"0.6316434",
"0.6311974",
"0.6311425",
"0.63111603",
"0.6307294",
"0.63050634",
"0.6301272",
"0.62848294",
"0.627871",
"0.6277492",
"0.62770176",
"0.6274702",
"0.6274702",
"0.62604547",
"0.62543267",
"0.6251651",
"0.625114",
"0.62487584",
"0.62225854",
"0.6214293",
"0.6214293",
"0.6212906",
"0.62095803",
"0.62095803",
"0.62095803",
"0.62095803",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6200787",
"0.6198166",
"0.61830676",
"0.6179759",
"0.617746",
"0.61753553",
"0.61619484",
"0.6157944",
"0.61527485",
"0.615132",
"0.615132",
"0.61505795",
"0.6144682",
"0.6144682",
"0.6144682",
"0.6144682",
"0.61351794",
"0.6133033",
"0.61300874",
"0.61294436",
"0.61242044",
"0.6121309",
"0.61148214",
"0.61109483",
"0.6108956",
"0.6108956"
] |
0.0
|
-1
|
Build an instance of ConfigurationInstance
|
def get_instance(payload)
ConfigurationInstance.new(@version, payload)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def instantiate_configuration(options={}) #:nodoc:\n Capistrano::Configuration.new(options)\n end",
"def configuration\n @configuration ||= configuration_type.new\n end",
"def initialize\n @configuration = Configuration.new\n end",
"def build(&block)\n # provide access to 'this' in configuration block\n self.instance_exec(&block)\n end",
"def instantiate_configuration #:nodoc:\n config = Webistrano::Configuration.new\n config.logger = logger\n config\n end",
"def configuration\n instance\n end",
"def configuration\n instance\n end",
"def get_instance(payload)\n ConfigurationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid])\n end",
"def configuration\n @configuration ||= Configuration.new()\n end",
"def config\n self.class.configuration_builder.configuration\n end",
"def config\n @configuration ||= Configuration.new\n end",
"def config\n @configuration ||= Configuration.new\n end",
"def build_config(config, allow_missing=false)\n all_definitions = config_meta.map {|p, l| l }.flatten\n Config.new(all_definitions, config, allow_missing)\n end",
"def configuration\n @configuration ||= Configuration.new\n end",
"def configuration\n @configuration ||= Configuration.new\n end",
"def configuration\n @configuration ||= Configuration.new\n end",
"def configuration\n @configuration ||= Configuration.new\n end",
"def configuration\n @configuration ||= Configuration.new\n end",
"def configuration\n @configuration ||= Configuration.new\n end",
"def configuration\n @configuration ||= Configuration.new\n end",
"def configuration\n @configuration ||= Configuration.new\n end",
"def configuration\n @configuration ||= Configuration.new\n end",
"def configuration\n @configuration ||= Configuration.new\n end",
"def configuration\n @configuration ||= Configuration.new(self)\n end",
"def configuration\n return self\n end",
"def configuration\n @configuration ||= Configuration.new\n end",
"def build\n klass = create_class(@class_name, @options)\n klass.new\n end",
"def config\n @config ||= Config.create ConfigLoader.new(root, CONFIG_FILE).to_hash, options.merge_config\n end",
"def configuration\n @configuration ||= Configuration.new\n end",
"def configuration\n @configuration ||= Configuration.new\n end",
"def configuration\n @configuration ||= Configuration.new\n end",
"def configuration\n @configuration ||= Configuration.new\n end",
"def configuration\n @_configuration ||= Configuration.new\n end",
"def configuration\n @_configuration ||= Configuration.new\n end",
"def build\n { logging: @config }\n end",
"def configure_from_options\n if @options[:config]\n config = Configuration.new(@path, @options[:config])\n config.from_options\n end\n end",
"def configuration\n\t\t\t\tconfiguration = Configuration.new\n\t\t\t\t\n\t\t\t\tself.resolved_paths.each do |path|\n\t\t\t\t\tpath = File.expand_path(path)\n\t\t\t\t\t\n\t\t\t\t\tconfiguration.load_file(path)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn configuration\n\t\t\tend",
"def build\n { database: @config }\n end",
"def load_config!\n if(options[:config])\n config_inst = config_class.new(options[:config])\n elsif(self.class.const_defined?(:DEFAULT_CONFIGURATION_FILES))\n path = self.class.const_get(:DEFAULT_CONFIGURATION_FILES).detect do |check|\n full_check = File.expand_path(check)\n File.exists?(full_check)\n end\n config_inst = config_class.new(path) if path\n end\n if(config_inst)\n options.delete(:config)\n @options = config_class.new(\n defaults.to_smash.deep_merge(\n config_inst.to_smash.deep_merge(\n options.to_smash\n )\n )\n ).to_smash\n else\n @options = config_class.new(\n defaults.to_smash.deep_merge(\n options.to_smash\n )\n ).to_smash\n end\n options\n end",
"def configure\n # Create a new configuration and yield it to a block\n self.configuration ||= Configuration.new\n\n yield(configuration)\n\n return configuration\n end",
"def instantiate_configuration(options={})\n config = Capistrano::Configuration.new(options)\n config.logger = logger\n config\n end",
"def config\n @config ||= Configuration.new\n end",
"def configuration\n @configuration ||= RecursiveOpenStruct.new\n end",
"def build_config\n file = [options[:config_file], DEFAULT_CONFIG_FILE_LOCATION].\n compact.find {|f| File.exists?(f) }\n\n hash =\n if file\n YAML.load_file(file).each do |key, value|\n stderr.puts(\"Warn: Unknown key in config file: #{key}\") unless\n self.class.configs.find {|opt| opt.first.to_s == key.to_s }\n end\n else\n {}\n end\n\n options[:config_option].map {|str| str.split('=') }.\n inject(hash) {|m, (k,v)| m.merge(k.to_sym => v) }\n end",
"def instance_by_config(config)\n klass = config[:klass] || config[:class_name].constantize\n klass.new(config)\n end",
"def configuration\n @configuration ||= deep_merge(default_configuration, @factory_config)\n end",
"def configuration(name, &block)\n config = Configuration.new\n config.instance_eval(&block)\n @configurations[name] = config\n end",
"def load_config!\n if options[:config]\n config_inst = Config.new(options[:config])\n elsif self.class.const_defined?(:DEFAULT_CONFIGURATION_FILES)\n path = self.class.const_get(:DEFAULT_CONFIGURATION_FILES).detect do |check|\n full_check = File.expand_path(check)\n File.exists?(full_check)\n end\n config_inst = Config.new(path) if path\n end\n if config_inst\n options.delete(:config)\n defaults_inst = Smash[\n config_class.new(\n defaults.to_smash\n ).to_smash.find_all do |key, value|\n defaults.key?(key)\n end\n ]\n config_data = config_inst.data\n config_inst = Smash[\n config_inst.to_smash.find_all do |key, value|\n config_data.key?(key)\n end\n ]\n options_inst = Smash[\n config_class.new(\n options.to_smash\n ).to_smash.find_all do |key, value|\n options.key?(key)\n end\n ]\n @options = config_class.new(\n defaults_inst.to_smash.deep_merge(\n config_inst.to_smash.deep_merge(\n options_inst.to_smash\n )\n )\n ).to_smash\n else\n @options = config_class.new(\n defaults.to_smash.deep_merge(\n options.to_smash\n )\n ).to_smash\n end\n options\n end",
"def config\n @config ||= Smartgen::Configuration.new\n end",
"def config(&block)\n @config ||= Configuration.new\n instance_exec(@config, &block) if block_given?\n @config\n end",
"def config\n @config ||= OpenStruct.new(YAML.load_file(self.config_path))\n end",
"def create_configuration(configuration_name, configuration)\n StaticLibraryConfiguration.new(self, effective_output_folder, configuration_name, configuration, @api_headers)\n end",
"def initialize\n @config = DEFAULT_CONFIG.deep_dup\n end",
"def build(klass)\n deep_copy.tap do |conf|\n conf.klass = klass\n end\n end",
"def configuration\n self\n end",
"def initialize(configuration = {})\n @config = configuration\n end",
"def initialize(configuration = {})\n @config = configuration\n end",
"def configuration\n @configuration ||= Clever::Configuration.new\n end",
"def config\n unless @config\n @config = Configuration.new\n @config.reset\n end\n @config\n end",
"def as_config\n Configureasy::Config.new self.parse\n end",
"def load_config\n @configuration = Configuration.find :first\n end",
"def initialize\n @configurations = {}\n end",
"def configure\n self.configuration ||= Configuration.new\n yield(configuration)\n end",
"def configuration\n self.class.configuration\n end",
"def configuration\n self.class.configuration\n end",
"def config\r\n Configuration\r\n end",
"def config\r\n Configuration\r\n end",
"def config\r\n Configuration\r\n end",
"def config\r\n Configuration\r\n end",
"def config\r\n Configuration\r\n end",
"def config\r\n Configuration\r\n end",
"def new\n @config_value = ConfigValue.new\n end",
"def load_config\n # Nothing in base class. This should be used to load the configuration from\n # disk if saved to a file.\n configuration || {}\n end",
"def configuration\n @configuration ||= Configuration.new\n if block_given?\n yield @configuration\n else\n @configuration\n end\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 configuration\n @config ||= setup\n end",
"def initialize(configuration={})\n @configuration = configuration\n end",
"def create_config\n self.config = {} if !self.config\n end",
"def create_config\n self.config = {} if !self.config\n end",
"def initialize(options = {})\n application_configuration.merge!(options)\n configuration_options.each do |key|\n send(\"#{key}=\", application_configuration[key])\n end\n end",
"def get_instance(payload)\n DomainConfigInstance.new(@version, payload, )\n end",
"def configure\n self.configuration = Configuration.new\n yield(configuration)\n end",
"def configuration\n self[:configuration] || {}\n end",
"def initialize(config={})\n @configuration = config\n end",
"def create_configuration(configuration_name, configuration)\n ApplicationConfiguration.new(self, effective_output_folder, configuration_name, configuration)\n end",
"def initialize\n @config = OpenStruct.new\n end",
"def configure\n self.configuration ||= Configuration.new\n yield(configuration)\n end",
"def configure\n if self.configuration.nil?\n unless self.load_configuration\n self.configuration = Configuration.new\n end\n end\n yield(configuration) if block_given?\n end",
"def configuration\n @configuration ||= begin\n config = {}\n\n if protoc_options[:configuration]\n require \"yaml\"\n\n config = YAML.load_file protoc_options[:configuration]\n config.merge! config\n end\n\n config\n end\n end",
"def config\n @config ||= Config.new\n end",
"def config\n @config ||= Config.new\n end",
"def create_configuration\n Configuration.new(\n access_token: ENV.fetch('SQUARE_SANDBOX_TOKEN', 'AccessToken'),\n environment: 'sandbox', http_callback: HttpResponseCatcher.new\n )\n end",
"def configure\n self.configuration ||= Configuration.new\n yield(configuration) if block_given?\n end",
"def initialize_without_internal_array( configuration_instance = nil )\n\n @configuration_instance = configuration_instance\n\n end",
"def configuration\n self[:configuration]\n end",
"def configure\n self.configuration ||= Configuration.new\n yield(configuration) if block_given?\n end",
"def build_worker\n worker = WorkerConfig.new\n yield worker\n worker\n end",
"def configuration\n self.class.configuration\n end",
"def configuration\n self.class.configuration\n end"
] |
[
"0.672848",
"0.66624016",
"0.6656234",
"0.643264",
"0.6399296",
"0.63736844",
"0.63736844",
"0.6367376",
"0.63276356",
"0.6311111",
"0.6302225",
"0.6302225",
"0.6297931",
"0.62911105",
"0.62911105",
"0.62911105",
"0.62911105",
"0.62911105",
"0.62911105",
"0.62911105",
"0.62911105",
"0.62911105",
"0.62911105",
"0.6288426",
"0.6256531",
"0.6237076",
"0.620944",
"0.62086666",
"0.6200182",
"0.6200182",
"0.6200182",
"0.6200182",
"0.6185971",
"0.6185971",
"0.6172028",
"0.6160118",
"0.6126072",
"0.6105408",
"0.6100927",
"0.6092155",
"0.60482186",
"0.6044665",
"0.6024701",
"0.59888625",
"0.5954692",
"0.59501976",
"0.59356886",
"0.58905333",
"0.5884374",
"0.5883284",
"0.58831245",
"0.5875135",
"0.5874816",
"0.5872086",
"0.58687574",
"0.58569556",
"0.58569556",
"0.58534724",
"0.58412385",
"0.58258975",
"0.5815967",
"0.5793787",
"0.5793535",
"0.57851624",
"0.57851624",
"0.57842207",
"0.57842207",
"0.57842207",
"0.57842207",
"0.57842207",
"0.57842207",
"0.577029",
"0.5769207",
"0.575963",
"0.5750735",
"0.5750735",
"0.5749331",
"0.5744467",
"0.5729499",
"0.5729499",
"0.57112116",
"0.5706916",
"0.57000107",
"0.5676799",
"0.5666808",
"0.56531465",
"0.5651839",
"0.5643461",
"0.5633236",
"0.5631192",
"0.5620789",
"0.5620789",
"0.560241",
"0.5599543",
"0.55864483",
"0.5576735",
"0.5568869",
"0.5565265",
"0.5563516",
"0.5563516"
] |
0.6783076
|
0
|
Provide a user friendly representation
|
def to_s
'<Twilio.Conversations.V1.ConfigurationPage>'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_display\n raise NotImplementedError\n end",
"def to_s; description end",
"def to_s\n super\n end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n super\n end",
"def to_s\n \"#{@name}, \" \\\n \"#{model.upcase}: \" \\\n \"#{data.values.join(\"/\")}, \" \\\n \":#{@type}\"\n end",
"def to_s\n\t\tsuper\n\tend",
"def to_s\r\n \"<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}\"\r\n end",
"def render\n inspect\n end",
"def to_s\n pieces = []\n pieces << self.class.name\n pieces << \"id:##{id.inspect}\"\n pieces << \"standardized:\" + (is_standard? ? 'standard' : (standard_id.nil? ? 'no' : \"copy-of-#{standard_id}\"))\n pieces << \"mission:#{mission_id.inspect}\"\n pieces.join(', ')\n end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def rendered_format; end",
"def rendered_format; end",
"def to_s\n render\n end",
"def to_s\n return super\n end",
"def display_string\n display = [self.name]\n display << self.description if self.description && self.type == 'StorageType'\n display << self.software if self.software && self.type == 'DatabaseType'\n cpu = self.cpu_values_string\n display << \"CPU: #{cpu}\" unless cpu.blank? || self.type == 'StorageType'\n display << \"RAM: #{self.memory} GB\" if self.memory && self.type != 'StorageType'\n hdd = self.hdd_values_string\n display << \"HDD: #{hdd}\" unless hdd.blank?\n display << self.operating_system if self.operating_system && self.type != 'StorageType'\n display.join(', ')\n end",
"def to_s\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\n end",
"def humanize\n # TODO\n # Inflector.humanize(self)\n end",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n %(<#{ @name }#{attributes}>)\n end",
"def to_s\n %w( name display_name uuid ).collect { |k| \"#{k}=#{ self.send(k) }\" }.join(' | ') + \" | types=#{ types.join(',') }\"\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n self.name.to_s || super\n end",
"def to_s\n descr\n end",
"def to_s\n self.name.humanize\n end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s ; format ; end",
"def formatted_name\n \"#{self.id} - #{self.name}\"\n #This is used to bring value on each page.\n end",
"def to_s\n\t\t\"#{self.name}\"\n\tend",
"def to_s\n \n end",
"def to_s\n self.name || super\n end",
"def to_s\n self.name || super\n end",
"def to_s\n return \"#{@name} - #{@description} : #{@rating}\"\n end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def to_s\n raise NotImplementedError\n end",
"def short_inspect\n attrs = []\n attrs << [\"id\", id || \"new_record\"]\n\n string_attr = proc { |value| '\"' + TextHelpers.truncate(value, :length => 10) + '\"' }\n\n if respond_to?(:name) && name.present?\n attrs << [\"name\", string_attr[name]]\n elsif respond_to?(:title) && title.present?\n attrs << [\"title\", string_attr[title]]\n end\n\n \"#<#{ self.class } #{ attrs.map { |name, value| \"#{ name }: #{ value }\" }.join(\", \") }>\"\n end"
] |
[
"0.70447654",
"0.7025946",
"0.70086724",
"0.7008141",
"0.69449997",
"0.691802",
"0.6843895",
"0.6797355",
"0.6655898",
"0.6622141",
"0.66182053",
"0.66182053",
"0.66182053",
"0.66182053",
"0.66182053",
"0.66182053",
"0.66182053",
"0.66182053",
"0.6610882",
"0.6610882",
"0.6586841",
"0.657413",
"0.6566269",
"0.6539553",
"0.6538853",
"0.651945",
"0.651945",
"0.651676",
"0.6501867",
"0.6501771",
"0.6501771",
"0.6501771",
"0.6501771",
"0.6486658",
"0.6478414",
"0.6459342",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6449786",
"0.6443162",
"0.643225",
"0.6429404",
"0.64213824",
"0.6419917",
"0.6419917",
"0.64185613",
"0.64119405",
"0.64119405",
"0.64119405",
"0.64119405",
"0.64119405",
"0.64080113",
"0.63943845"
] |
0.0
|
-1
|
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
|
def context
unless @instance_context
@instance_context = ConfigurationContext.new(@version )
end
@instance_context
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def context\n unless @instance_context\n @instance_context = ApplicationContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = SimContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = InteractionContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = TriggerContext.new(@version, @params['account_sid'], @params['sid'],)\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CallContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CpsContext.new(@version, )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CallContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def proxy_context\n @context\n end",
"def context\n unless @instance_context\n @instance_context = CallContext.new(@version, @params['account_sid'], @params['sid'],)\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CurrentCallContext.new(@version, )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = AnonymizeContext.new(@version , @params['room_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = DomainContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"def contextify\n self.class.monadic_context.new self\n end",
"def context\n unless @instance_context\n @instance_context = SandboxContext.new(\n @version,\n @params['account_sid'],\n )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = TrunkContext.new(@version , @params['sip_trunk_domain'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CompositionHookContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"def context\n init\n @context\n end",
"def context\n unless @instance_context\n @instance_context = InteractionChannelContext.new(\n @version,\n @params['interaction_sid'],\n @params['sid'],\n )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = UserInfoContext.new(@version )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = EngagementContextContext.new(@version , @params['flow_sid'], @params['engagement_sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CampaignContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"def initialize(*args, &block)\n super(*args)\n instance_exec(_context, &block)\n end",
"def context\n unless @instance_context\n @instance_context = EsimProfileContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def execution_context\n initialize_context!(Object.new)\n end",
"def context\n unless @instance_context\n @instance_context = BulkEligibilityContext.new(@version , @params['request_id'])\n end\n @instance_context\n end",
"def setup_context\n context_methods.each do |m|\n @context.add_method m, self\n end\n\n @context.define_klass\n end",
"def context\n unless @instance_context\n @instance_context = RecordingContext.new(@version , @params['trunk_sid'])\n end\n @instance_context\n end",
"def context\n Context.instance\n end",
"def context\n unless @instance_context\n @instance_context = ReservationContext.new(@version , @params['workspace_sid'], @params['worker_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CountryContext.new(@version , @params['iso_code'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CompositionContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"def context_methods\n super + [:context]\n end",
"def context\n unless @instance_context\n @instance_context = TaskContext.new(@version , @params['workspace_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = TranscriptContext.new(@version , @params['sid'])\n end\n @instance_context\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 context\n unless @instance_context\n @instance_context = ChannelContext.new(@version , @params['service_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n @context ||= Context.new(self)\n end",
"def context\n unless @instance_context\n @instance_context = TaskContext.new(@version, @params['workspace_sid'], @params['sid'], )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CallSummaryContext.new(@version , @params['call_sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = NumberContext.new(@version, @params['destination_number'], )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = SummaryContext.new(\n @version,\n @params['call_sid'],\n )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = RatePlanContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"def context\n @context ||= new_context_mock(context_options, &finalize_proc)\n end",
"def context\n unless @instance_context\n @instance_context = OauthContext.new(@version )\n end\n @instance_context\n end",
"def context\n @context ||= Context.new(self)\n end",
"def context\n unless @instance_context\n @instance_context = DeactivationsContext.new(@version )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = SipDomainContext.new(@version , @params['sip_domain'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = PhoneNumberContext.new(@version , @params['phone_number'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = PhoneNumberContext.new(@version , @params['phone_number'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = MediaProcessorContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = ChannelContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = IntentStatisticsContext.new(\n @version,\n @params['assistant_sid'],\n @params['intent_sid'],\n )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = DomainConfigContext.new(@version, @params['domain_sid'], )\n end\n @instance_context\n end",
"def context_methods; end",
"def call(*args)\n @ctx.instance_exec(args, &action)\n end",
"def context\n unless @instance_context\n @instance_context = ConfigurationContext.new(@version , @params['chat_service_sid'])\n end\n @instance_context\n end",
"def initialize\n self.context = Context.new\n end",
"def context\n unless @instance_context\n @instance_context = InteractionChannelParticipantContext.new(@version , @params['interaction_sid'], @params['channel_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = WorkflowRealTimeStatisticsContext.new(@version , @params['workspace_sid'], @params['workflow_sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = LinkshorteningMessagingServiceDomainAssociationContext.new(@version , @params['messaging_service_sid'])\n end\n @instance_context\n end",
"def context(klass, options={}, &blk)\n assoc = options.delete(:as) || self.name.demodulize.underscore\n assoc = assoc.to_sym\n\n nk = options[:name_key] ||= get_name_key\n\n self.hook_instance(\"change_#{nk}\") do |inst, old, new|\n inst.context.indices[assoc].update_membership(inst)\n end\n\n klass.index(assoc, options) do |name, target|\n inst = new(target, name)\n yield(inst, target) if block_given?\n inst\n end\n end",
"def context\n unless @instance_context\n @instance_context = ExportAssistantContext.new(@version, @params['assistant_sid'], )\n end\n @instance_context\n end",
"def method_missing(method_name, *args, &blk)\n @context.__send__(method_name, *args, &blk)\n end",
"def context\n unless @instance_context\n @instance_context = DialogueContext.new(@version , @params['assistant_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = WorkspaceContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = TaskStatisticsContext.new(@version , @params['assistant_sid'], @params['task_sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = RoomContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = WorkflowStatisticsContext.new(\n @version,\n @params['workspace_sid'],\n @params['workflow_sid'],\n )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = WorkflowRealTimeStatisticsContext.new(\n @version,\n @params['workspace_sid'],\n @params['workflow_sid'],\n )\n end\n @instance_context\n end",
"def method_missing(method, *args, &block)\n context.send(method, *args, &block)\n end",
"def method_missing(method, *args, &block)\n context.send(method, *args, &block)\n end",
"def initialize(context)\n super()\n self.context = context\n end",
"def context\n unless @instance_context\n @instance_context = DomainCertsContext.new(@version , @params['domain_sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = SettingsContext.new(@version, )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = DomainCertsContext.new(@version, @params['domain_sid'], )\n end\n @instance_context\n end",
"def context\n @context ||= {}\n end",
"def context\n @context ||= {}\n end",
"def context\n unless @instance_context\n @instance_context = SecondaryAuthTokenContext.new(@version )\n end\n @instance_context\n end",
"def context\n return @target if @target.is_a?(Module) && !@options[:class_methods]\n\n @target.singleton_class\n end",
"def _prepare_context; end",
"def context\n unless @instance_context\n @instance_context = InsightsQuestionnairesContext.new(@version , @params['questionnaire_sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = NotificationContext.new(@version, @params['chat_service_sid'], )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = FeedbackSummaryContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = FeedbackSummaryContext.new(@version, @params['account_sid'], @params['sid'],)\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = ParticipantContext.new(@version , @params['account_sid'], @params['conference_sid'], @params['call_sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = UserDefinedMessageSubscriptionContext.new(@version , @params['account_sid'], @params['call_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = NotificationContext.new(@version , @params['chat_service_sid'])\n end\n @instance_context\n end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end"
] |
[
"0.68387127",
"0.6803425",
"0.6797454",
"0.6772821",
"0.67694455",
"0.67694455",
"0.6732738",
"0.6683487",
"0.66793",
"0.66790885",
"0.6678002",
"0.66416395",
"0.6627958",
"0.66104096",
"0.66007036",
"0.65932024",
"0.65719074",
"0.65685713",
"0.6557029",
"0.65504694",
"0.6547924",
"0.6505842",
"0.6496822",
"0.6489991",
"0.64647996",
"0.6448793",
"0.6410091",
"0.64050674",
"0.63679165",
"0.63514435",
"0.6332286",
"0.6319397",
"0.63138926",
"0.6299037",
"0.6277056",
"0.626909",
"0.6260328",
"0.6259104",
"0.62584233",
"0.6236928",
"0.621686",
"0.6214959",
"0.6212979",
"0.61968285",
"0.61941373",
"0.6192687",
"0.6187435",
"0.6170158",
"0.61668056",
"0.6160464",
"0.6160375",
"0.6159213",
"0.61471516",
"0.613917",
"0.61329484",
"0.612762",
"0.6126368",
"0.61230445",
"0.61117816",
"0.60831285",
"0.6078565",
"0.6055728",
"0.60416424",
"0.60396445",
"0.60334235",
"0.6017421",
"0.60124314",
"0.6011976",
"0.6011757",
"0.60113055",
"0.59791136",
"0.59754676",
"0.59754676",
"0.59658414",
"0.5953672",
"0.59491056",
"0.59407634",
"0.5931351",
"0.5931351",
"0.59014696",
"0.59012437",
"0.58897644",
"0.5882958",
"0.5880748",
"0.5868429",
"0.5850207",
"0.5830738",
"0.58269054",
"0.5820322",
"0.58167243",
"0.58167243",
"0.58167243",
"0.58167243",
"0.58167243",
"0.58167243",
"0.58167243",
"0.58167243",
"0.58167243",
"0.58167243",
"0.58167243"
] |
0.656113
|
18
|
Provide a user friendly representation
|
def to_s
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
"<Twilio.Conversations.V1.ConfigurationInstance #{values}>"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_display\n raise NotImplementedError\n end",
"def to_s; description end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n super\n end",
"def to_s\n super\n end",
"def to_s\n \"#{@name}, \" \\\n \"#{model.upcase}: \" \\\n \"#{data.values.join(\"/\")}, \" \\\n \":#{@type}\"\n end",
"def to_s\n\t\tsuper\n\tend",
"def to_s\r\n \"<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}\"\r\n end",
"def render\n inspect\n end",
"def to_s\n pieces = []\n pieces << self.class.name\n pieces << \"id:##{id.inspect}\"\n pieces << \"standardized:\" + (is_standard? ? 'standard' : (standard_id.nil? ? 'no' : \"copy-of-#{standard_id}\"))\n pieces << \"mission:#{mission_id.inspect}\"\n pieces.join(', ')\n end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def rendered_format; end",
"def rendered_format; end",
"def to_s\n render\n end",
"def to_s\n return super\n end",
"def display_string\n display = [self.name]\n display << self.description if self.description && self.type == 'StorageType'\n display << self.software if self.software && self.type == 'DatabaseType'\n cpu = self.cpu_values_string\n display << \"CPU: #{cpu}\" unless cpu.blank? || self.type == 'StorageType'\n display << \"RAM: #{self.memory} GB\" if self.memory && self.type != 'StorageType'\n hdd = self.hdd_values_string\n display << \"HDD: #{hdd}\" unless hdd.blank?\n display << self.operating_system if self.operating_system && self.type != 'StorageType'\n display.join(', ')\n end",
"def to_s\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\n end",
"def humanize\n # TODO\n # Inflector.humanize(self)\n end",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n %(<#{ @name }#{attributes}>)\n end",
"def to_s\n %w( name display_name uuid ).collect { |k| \"#{k}=#{ self.send(k) }\" }.join(' | ') + \" | types=#{ types.join(',') }\"\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n self.name.to_s || super\n end",
"def to_s\n descr\n end",
"def to_s\n self.name.humanize\n end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s ; format ; end",
"def formatted_name\n \"#{self.id} - #{self.name}\"\n #This is used to bring value on each page.\n end",
"def to_s\n\t\t\"#{self.name}\"\n\tend",
"def to_s\n \n end",
"def to_s\n self.name || super\n end",
"def to_s\n self.name || super\n end",
"def to_s\n return \"#{@name} - #{@description} : #{@rating}\"\n end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def to_s\n raise NotImplementedError\n end",
"def short_inspect\n attrs = []\n attrs << [\"id\", id || \"new_record\"]\n\n string_attr = proc { |value| '\"' + TextHelpers.truncate(value, :length => 10) + '\"' }\n\n if respond_to?(:name) && name.present?\n attrs << [\"name\", string_attr[name]]\n elsif respond_to?(:title) && title.present?\n attrs << [\"title\", string_attr[title]]\n end\n\n \"#<#{ self.class } #{ attrs.map { |name, value| \"#{ name }: #{ value }\" }.join(\", \") }>\"\n end"
] |
[
"0.70430577",
"0.7025487",
"0.7008232",
"0.7007793",
"0.69441473",
"0.6917163",
"0.68431",
"0.6797009",
"0.6655106",
"0.66227216",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.660979",
"0.660979",
"0.6585346",
"0.65730983",
"0.65662885",
"0.65404147",
"0.65379703",
"0.651875",
"0.651875",
"0.6516385",
"0.6501134",
"0.65010244",
"0.65010244",
"0.65010244",
"0.65010244",
"0.64861107",
"0.6478101",
"0.64581114",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6448988",
"0.6442197",
"0.64329034",
"0.64289695",
"0.64203346",
"0.6419349",
"0.6419349",
"0.6418417",
"0.64115626",
"0.64115626",
"0.64115626",
"0.64115626",
"0.64115626",
"0.64071685",
"0.63947713"
] |
0.0
|
-1
|
Provide a detailed, user friendly representation
|
def inspect
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
"<Twilio.Conversations.V1.ConfigurationInstance #{values}>"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def details; end",
"def to_s; description end",
"def get_detail\n return self.inspect\n end",
"def to_display\n raise NotImplementedError\n end",
"def formatted_info\n \"#{self.name} - #{self.description}\"\n end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def inspect\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\n end",
"def short_inspect\n attrs = []\n attrs << [\"id\", id || \"new_record\"]\n\n string_attr = proc { |value| '\"' + TextHelpers.truncate(value, :length => 10) + '\"' }\n\n if respond_to?(:name) && name.present?\n attrs << [\"name\", string_attr[name]]\n elsif respond_to?(:title) && title.present?\n attrs << [\"title\", string_attr[title]]\n end\n\n \"#<#{ self.class } #{ attrs.map { |name, value| \"#{ name }: #{ value }\" }.join(\", \") }>\"\n end",
"def render\n inspect\n end",
"def overview\n\n end",
"def record_display\n string = \"#{id}. Title: #{title}\\n Author: #{author}\\n ISBN: #{isbn}\\n\"\n if library.nil?\n string += \" Library: None\\n\"\n else\n string += \" Library: #{library.branch_name}\\n\"\n end\n if patron.nil?\n string += \" Checked Out: Available\"\n else\n string += \" Checked Out: #{patron.name}\"\n end\n string\n end",
"def render_plain\n short_category(object.action) << \"\\n\" << instance_attributes\n end",
"def details\n\n return @description + \": \" + \"#{@infection}\" + \". \" + @patient.details\n\n end",
"def to_s\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\n end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def display_string\n display = [self.name]\n display << self.description if self.description && self.type == 'StorageType'\n display << self.software if self.software && self.type == 'DatabaseType'\n cpu = self.cpu_values_string\n display << \"CPU: #{cpu}\" unless cpu.blank? || self.type == 'StorageType'\n display << \"RAM: #{self.memory} GB\" if self.memory && self.type != 'StorageType'\n hdd = self.hdd_values_string\n display << \"HDD: #{hdd}\" unless hdd.blank?\n display << self.operating_system if self.operating_system && self.type != 'StorageType'\n display.join(', ')\n end",
"def to_s\r\n \"<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}\"\r\n end",
"def full_description\n \"#{self.class.description} #{self.description}\"\n end",
"def to_s\n descr\n end",
"def details\r\n return @description + \"; \" + @vPatients + \"; \" + @vProfiles + \": \" + @vAppointments\r\n end",
"def display\n to_h.fetch(:display)\n end",
"def display\n to_h.fetch(:display)\n end",
"def inspect_details\n\t\treturn \"ID=%s (%s)\" % [\n\t\t\tself.id,\n\t\t\tself.components.keys.map( &:name ).sort.join( '+' )\n\t\t]\n\tend",
"def to_s\n\t\tres = \"\\nname: \" + name.to_s + \"\\nid: \" + id.to_s + \"\\nservice: \" + service.to_s + \"\\ntitle: \" + title.to_s + \"\\nthumbnail: \" + thumbnail.to_s + \"\\nhref: \" + href.to_s\n\t\tres\n\tend",
"def details\n\t\t\"#{name}---#{status}-----#{start_date}----#{description}---- #{Client.find(client_id).name}---#{Client.find(client_id).email}\"\n\tend",
"def show\n @title = @user.complete_name\n @description = \"Informations relatives à #{@user.complete_name}\"\n @jsonld = @user.to_jsonld\n end",
"def details\n end",
"def to_s\n \"#{represent_status} : #{description}\"\n end",
"def details\n format_description(@description) + \"site name: \" + format_name\n end",
"def to_s\n\t\tdescription\n\tend",
"def to_s\n\t\tdescription\n\tend",
"def to_s_details\n ''\n end",
"def details\n\n end",
"def descriptions\n return @detail + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end",
"def show\n\t\t@attrib_keys = [\"desc\", \"higher_level\", \"range\", \"components\", \"material\", \"ritual\", \"duration\", \"concentration\", \"casting_time\", \"level\", \"school\", \"class_names\", \"archetype\", \"domains\", \"oaths\", \"circles\", \"patrons\"]\n\tend",
"def to_s\n \"#{@name}, \" \\\n \"#{model.upcase}: \" \\\n \"#{data.values.join(\"/\")}, \" \\\n \":#{@type}\"\n end",
"def inspect_details\n ''\n end",
"def inspect\n \"#<#{self.class} ##{id} #{name} (#{slug})>\"\n end",
"def display_quick\r\n s = ''\r\n for i in @me.keys\r\n s << \" <b>#{i}.</b><br/>\" # country\r\n for j in @me[i].keys\r\n s << \" <b>#{j}:</b><br/>\" if not j == 'unknown' # state\r\n for k in @me[i][j].keys\r\n s << \" #{k}<br/>\" if not k == 'unknown' # county\r\n for l in @me[i][j][k].keys\r\n s << (\" \" + (l == 'unknown' ? \"<i>repository not given</i>\" : \" #{l}\") + \"<br/>\") if not l == nil # repository\r\n s << \" \" + @me[i][j][k][l].keys.collect{|m| \r\n (\"#{@me[i][j][k][l][m]} \" +\r\n case m # the count\r\n when 'female'\r\n \"♀\"\r\n when 'male'\r\n \"♂\"\r\n when 'gynadropmorph'\r\n \"[♀♂]\"\r\n else\r\n \"unknown sex\"\r\n end)}.join(\",\") \r\n s << \"<br/>\" \r\n end\r\n end\r\n end\r\n end\r\n s.html_safe\r\n end",
"def details\n return @description + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end",
"def to_s\n super\n end",
"def to_s\n pieces = []\n pieces << self.class.name\n pieces << \"id:##{id.inspect}\"\n pieces << \"standardized:\" + (is_standard? ? 'standard' : (standard_id.nil? ? 'no' : \"copy-of-#{standard_id}\"))\n pieces << \"mission:#{mission_id.inspect}\"\n pieces.join(', ')\n end",
"def rendered_format; end",
"def rendered_format; end",
"def to_s\n\t\t\tstr = super() + \"\\n\"\n\t\t\tstr += \"\\tAppaleable? #{appaleable}\\n\" if appaleable\n\t\t\tstr += \"\\tDisapproved text: #{disapproved_text}\\n\" if disapproved_text\n\t\t\tstr += \"\\tLocation: #{location}\\n\" if location\n\t\t\tstr += \"\\tDisapproved text: #{disapproved_text}\\n\" if disapproved_text\n\t\t\tstr += \"\\tReason code: #{reason_code} (see: http://msdn.microsoft.com/en-US/library/bing-ads-editorialfailurereasoncodes.aspx)\\n\" if reason_code\n\n\t\tend",
"def display_data\n\t\t\t\"#{@model} #{@color} #{@horsepower} #{@year} #{@brand} #{@mpg}\"\n\t\tend",
"def to_s\n \"\\n\\tTitle: #{@title}\\n\n \\tAuthor: #{@author}\\n\n \\tUrl: #{@url}\\n\\n\"\n end",
"def inspect\n to_s.inspect\n end",
"def details\n data()\n end",
"def details\n\n return @description + \"; \" + @firstname + \"; \" + @lastname + \": \" + @dob + \": \"+ @address + \": \"+ @phone + \": \" + \"#{@infection}\"\n\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def show\n raise NotImplementedError\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def to_s\n long_display\n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def inspect\n\t\tparts = []\n\t\tparts << self.one_of_description\n\t\tparts << self.all_of_description\n\t\tparts << self.none_of_description\n\t\tparts.compact!\n\n\t\tstr = \"#<%p:%#0x matching entities\" % [ self.class, self.object_id * 2 ]\n\t\tif parts.empty?\n\t\t\tstr << \" with any components\"\n\t\telse\n\t\t\tstr << parts.join( ', ' )\n\t\tend\n\t\tstr << \">\"\n\n\t\treturn str\n\tend",
"def inspect\n to_s\n end",
"def description\n return summary\n end",
"def details\n return @description + \"; \" + @doctorname + \"; \" + @medicine + \": \" + \"#{@cost}\"\n end",
"def details\n return \"ID = #{@id}\\n\" + \n \"Name = #{@name}\\n\" + \n \"Topic = #{@topic}\\n\" + \n \"Member Count = #{@member_count}\"\n end",
"def description\n name + ': ' + resource_type.to_s + ' | Sueldo: ' + salary.to_s +\n ' | Experiencia: ' + experience.to_s + ' años'\n end",
"def show\n\t\traise NotImplementedError, \"FIXME: Implement showing comments.\"\n\tend",
"def to_s\n return \"#{@name} - #{@description} : #{@rating}\"\n end",
"def inspect\n \"#{self.class}<#{@description.inspect}>\"\n end",
"def description\n end",
"def description\n end",
"def details\n return \" #{@description}, #{@lastname}, #{@date}. #{@start}, #{@hours}, #{@players}, #{@zone}. #{@cost}\"\n end",
"def display\n\t\tname\n\tend",
"def display\n\t\tname\n\tend",
"def display\n\t\tname\n\tend",
"def display\n\t\tname\n\tend",
"def details\n return @description + \"; \" + @manufacturer + \"; \" + @color + \": \" + \"#{@cost}\"\n end",
"def to_s\n \"#{self.title} - #{self.author} - #{self.date}\"\n end",
"def details\r\n return @description + \": \" + \". \" + @basic_profile.details\r\n end",
"def show\n #not needed for our implementation\n end",
"def to_s\n super\n end",
"def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end",
"def details_partial_for(o)\n \"#{o.class.name.underscore}s/details\"\n end",
"def display\n puts \"Personal Details\"\n puts \" Name : #{self.name}\"\n puts \" Date of Birth : #{self.dob}\"\n puts \" Marital Status : #{self.marital_status}\"\n puts \" Mobile Number : #{self.mobile_number}\"\n puts \" Email : #{self.email}\"\n end",
"def detail\n attributes.fetch(:detail)\n end",
"def detail\n attributes.fetch(:detail)\n end"
] |
[
"0.68170065",
"0.68142146",
"0.6758589",
"0.6718451",
"0.66697186",
"0.6655344",
"0.6632312",
"0.66273594",
"0.6550127",
"0.65188134",
"0.6497969",
"0.6480078",
"0.6477721",
"0.6472211",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64502096",
"0.64367676",
"0.6434794",
"0.63974625",
"0.6391661",
"0.6385164",
"0.63826483",
"0.63826483",
"0.63621265",
"0.63584715",
"0.6352767",
"0.6347243",
"0.6345342",
"0.63338625",
"0.6325844",
"0.6320725",
"0.6320725",
"0.6316434",
"0.6311974",
"0.6311425",
"0.63111603",
"0.6307294",
"0.63050634",
"0.6301272",
"0.62848294",
"0.627871",
"0.6277492",
"0.62770176",
"0.6274702",
"0.6274702",
"0.62604547",
"0.62543267",
"0.6251651",
"0.625114",
"0.62487584",
"0.62225854",
"0.6214293",
"0.6214293",
"0.6212906",
"0.62095803",
"0.62095803",
"0.62095803",
"0.62095803",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6205272",
"0.6200787",
"0.6198166",
"0.61830676",
"0.6179759",
"0.617746",
"0.61753553",
"0.61619484",
"0.6157944",
"0.61527485",
"0.615132",
"0.615132",
"0.61505795",
"0.6144682",
"0.6144682",
"0.6144682",
"0.6144682",
"0.61351794",
"0.6133033",
"0.61300874",
"0.61294436",
"0.61242044",
"0.6121309",
"0.61148214",
"0.61109483",
"0.6108956",
"0.6108956"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def image_params
params.require(:project_image).permit(:screenshot, :project_id, :unique_token)
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 valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def 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 url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def url_whitelist; 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 admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\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 origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\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 maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\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.6981537",
"0.67835593",
"0.6748275",
"0.67436063",
"0.6736311",
"0.65937173",
"0.6503359",
"0.6498499",
"0.6482832",
"0.6478776",
"0.645703",
"0.6439998",
"0.63802195",
"0.6377008",
"0.6366287",
"0.632018",
"0.63016284",
"0.63011277",
"0.62932974",
"0.62919617",
"0.62905645",
"0.6289235",
"0.6283876",
"0.62425834",
"0.62410337",
"0.6218672",
"0.62151134",
"0.62096137",
"0.6192354",
"0.6178057",
"0.6177618",
"0.61727077",
"0.6162073",
"0.6152049",
"0.61515594",
"0.61458135",
"0.6122875",
"0.61165285",
"0.6107696",
"0.6104097",
"0.6091097",
"0.6080201",
"0.60699946",
"0.6063739",
"0.60206395",
"0.60169303",
"0.60134894",
"0.601003",
"0.6007347",
"0.6007347",
"0.6001054",
"0.59997267",
"0.5997844",
"0.5991826",
"0.5991213",
"0.59911627",
"0.5980111",
"0.5967009",
"0.59597385",
"0.5958542",
"0.595787",
"0.5957425",
"0.59522784",
"0.5951228",
"0.59423685",
"0.5939385",
"0.5939122",
"0.5939122",
"0.59325653",
"0.5930178",
"0.59248054",
"0.59243476",
"0.59164625",
"0.59106",
"0.59101933",
"0.59084356",
"0.5905666",
"0.58975077",
"0.58974737",
"0.5895128",
"0.58946574",
"0.589308",
"0.58916",
"0.5885987",
"0.58838505",
"0.58792",
"0.58723736",
"0.58684355",
"0.58677715",
"0.5865701",
"0.5865538",
"0.5865288",
"0.586385",
"0.5862139",
"0.58614355",
"0.58593005",
"0.5857459",
"0.58541363",
"0.58536613",
"0.58520085",
"0.585011"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def set_first_baseman_stat
@first_baseman_stat = FirstBasemanStat.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a trusted parameter "white list" through.
|
def first_baseman_stat_params
params.require(:first_baseman_stat).permit(:position_name, :shorthand, :sport_id, :position_id, :sport_name, :event, :games_started, :games_played, :win, :loss, :wins, :losses, :plate_appearances, :at_bats, :hits, :runs_scored, :runs_batted_in, :walks, :strike_outs, :stolen_bases, :doubles, :triples, :home_runs, :score, :opponent_score, :user_id, :stat_id, :sport_id, :position_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end"
] |
[
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.63804525",
"0.6373396",
"0.6360051",
"0.6355191",
"0.62856233",
"0.627813",
"0.62451434",
"0.6228103",
"0.6224965",
"0.6222941",
"0.6210244",
"0.62077755",
"0.61762565",
"0.61711127",
"0.6168448",
"0.6160164",
"0.61446255",
"0.6134175",
"0.6120522",
"0.6106709",
"0.60981655",
"0.6076113",
"0.60534036",
"0.60410434",
"0.6034582",
"0.6029977",
"0.6019861",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.60184896",
"0.60157263",
"0.6005857",
"0.6003803",
"0.60012573",
"0.59955895",
"0.5994598",
"0.5993604",
"0.5983824",
"0.5983166",
"0.5977431",
"0.597591",
"0.5968824",
"0.5965953",
"0.59647584",
"0.59647584",
"0.59566855",
"0.59506303",
"0.5950375",
"0.59485626",
"0.59440875",
"0.5930872",
"0.5930206",
"0.5925668",
"0.59235454",
"0.5917905",
"0.59164816",
"0.5913821",
"0.59128743",
"0.5906617",
"0.59053683",
"0.59052664",
"0.5901591",
"0.58987755",
"0.5897456",
"0.58970183",
"0.58942604"
] |
0.0
|
-1
|
Reads a single byte from the pipe.
|
def getbyte
char = getc
char ? char.getbyte(0) : nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def getbyte\n read(1)\n end",
"def read_byte\n buf = read_all(1)\n return Bytes.get_string_byte(buf, 0)\n end",
"def readbyte\n getbyte || raise(EOFError)\n end",
"def getbyte\n read(1).ord\n end",
"def read_byte\n read('C', 1)\n end",
"def read_byte\n @buffer.shift(BYTE_LENGTH).join.to_i(2) if @buffer.length >= BYTE_LENGTH\n end",
"def getbyte\n while true # Performance\n return nil unless __advance!\n stream = @_st_stream\n if val = stream.getc\n return val\n end\n\n return nil if stream._equal?(File.__stdin)\n stream.close unless stream.closed?\n @_st_advance = true\n end\n end",
"def read_and_unpack_byte\n byte = @sock.read(1)\n raise SocketReadError if byte.nil?\n byte = byte.unpack('C')[0]\n end",
"def read_byte; end",
"def readbyte\n map_exceptions do\n @socket.readbyte\n end\n end",
"def read_byte(signed = false, mut = :STD)\n val = 0\n val |= mutate(@payload.next_byte, mut)\n signed ? val : val & 0xff\n end",
"def readbyte\n end",
"def read_bit\n @buffer.shift if @buffer.length >= 1\n end",
"def read\n read_object(read_byte)\n end",
"def read_byte(data, offset)\n out = data[offset,1].unpack('C').first rescue 0\n return out\n end",
"def read(byte_count)\n buffer = @current_io.read(byte_count)\n if !buffer\n select_next_io\n @current_io.read(byte_count)\n else\n buffer\n end\n end",
"def shell_read(length = nil)\n if length.nil?\n rv = rstream.get\n else\n rv = rstream.read(length)\n end\n return rv\n end",
"def read\n @io.write(?r) # Read command\n sleep(0.1) until !@io.eof?\n\n @io.readbyte\n end",
"def read(length = 65535)\n if length < 0\n length = 65535\n end\n return sysread(length)\n end",
"def shell_read(length = nil)\n return rstream.read(length)\n end",
"def get_byte(close_after_single_read=false)\n end",
"def read()\r\n return @socket.read(1)\r\n end",
"def get_byte\n get(1).ord\n end",
"def read(bytes)\n read_file(@reader, bytes) unless peek_named_pipe(@reader).zero?\n end",
"def read\n @socket.read(1)\n end",
"def next_byte(io)\n io.readbytes(1).unpack(\"C\")[0]\n end",
"def pull(io)\n lenbytes = io.read LEN_BYTES\n\n # this showed up in early testing ...\n raise \"BUG! - read from a pipe should never EOF\" if lenbytes.nil?\n\n cmdlen = lenbytes.unpack(LEN_PACK)[0]\n packet = io.read cmdlen\n if packet.bytesize == cmdlen\n Marshal.load packet\n else\n raise \"Corrupt/truncated packet!: #{packet.inspect}\"\n end\n end",
"def getbyte(index, signed=false)\n if @offset+index >= @read_buffer.bytesize\n swap_buffers\n end\n b = @read_buffer.getbyte(@offset+index)\n (signed && b >= 0x80) ? b - 0x100 : b\n end",
"def read(bytes)\n @reader.read_nonblock(bytes)\n rescue Errno::EAGAIN\n # it simply means that there's nothing in\n # the output buffer.\n rescue Errno::EIO => msg\n @pid = nil\n rescue EOFError => msg\n @pid = nil\n end",
"def read\n @socket.gets\n end",
"def getc\n @port.read_byte.chr\n end",
"def peek\n @b.each_byte {|b| return b }\n end",
"def prim_read length\n buf = \"\".encode Encoding::BINARY\n if length.nil?\n buf << b until (b = _read_byte).nil?\n else\n until length.zero? || (b = _read_byte).nil?\n buf << b\n length -= 1\n end\n end\n return buf\n end",
"def read_u1\n read(1).first & 0xff\n end",
"def getc\n @bytes_to_be_read -= 1\n @io.readbyte()\n end",
"def read\n data = @handle.availableData\n return data\n end",
"def readchar\n getc || raise(EOFError)\n end",
"def read(length = bytes_remaining)\n value = @data.byteslice(@pos, length)\n @pos += length\n value\n end",
"def sysread(len = 1)\n @sock.sysread(len)\n end",
"def read(len)\r\n buf = \"\\0\" * len\r\n Win32API.new(\"msvcrt\", \"_read\", \"lpl\", \"l\").call(@fd, buf, len)\r\n buf\r\n end",
"def getc\n return nil if @read >= @size\n ret = @io.getc\n @read += 1 if ret\n ret\n end",
"def getc\n read(1)\n end",
"def read_bytes_full\n @_io.read\n end",
"def shell_read(length = nil)\n raise NotImplementedError\n end",
"def gets(*arg)\n @stream.gets(*arg)\n end",
"def read(bytes)\n raise \"read(bytes) must be overridden\"\n end",
"def read\n serial_port.read_nonblock(4096)\n rescue EOFError\n end",
"def getbyte\n end",
"def getbyte\n end",
"def read(bytes = @length)\n return nil if @pos >= @length\n bytes = @length - @pos if bytes.nil?\n bytes = @length - @pos if @pos + bytes > @length\n\n out = @data[@pos, bytes] if @data.kind_of?(String)\n out = @data.read(bytes) if @data.kind_of?(NTFS::DataRun)\n\n @pos += out.size\n out\n end",
"def getc\n system \"/bin/stty raw -echo\"\n if STDIN.respond_to?(:getbyte)\n STDIN.getbyte\n else\n STDIN.getc\n end\n ensure\n system \"/bin/stty -raw echo\"\n end",
"def read= r\n @read = (r == 1) ? 1 : 0\n end",
"def read_from_pipe(pipe, timeout = 0.1, &_block)\n if self.class.readable?(pipe, timeout)\n l = pipe.readpartial(4096)\n # TODO: Log a debug for \"#{Time.now} PIPE> #{l}\"\n # Since readpartial may return a nil at EOF, skip returning that value\n yield l unless l.nil?\n end\n\n nil\n end",
"def read(meta = @meta)\n buffer, size = next_read(meta)\n size == 0 ? nil : buffer.get_bytes(size)\n end",
"def read\n @serial_port.read()\n end",
"def read\n @buffer\n end",
"def get_byte\n scan(/./mn)\n end",
"def read_command(cmd, synth=SYNTH_A)\n # Make sure cmd is valid\n raise \"unknown command #{cmd}\" unless LENGTH.has_key?(cmd)\n # Make sure synth has no stray bits set\n synth &= (SYNTH_A|SYNTH_B)\n # Get length of data to read\n length = LENGTH[cmd]\n\n serialport do |sp|\n cmd = RD|synth|cmd\n sp.write(cmd.chr)\n data = sp.read(length)\n csum = sp.read(1)\n if @debug\n print\"data\"\n data.each_char {|c| print \" %02x\" % c.ord}\n puts csum ? \"\\ncsum %02x\" % csum.ord : \"\\ncsum --\"\n end\n if !csum || !Valon.checksum_ok?(csum, data)\n #p \"data=#{data.inspect} (len #{data.length})\"\n #p \"csum=#{csum.inspect}\"\n raise 'checksum error'\n end\n return data\n end\n end",
"def receive()\r\n complete = \"\"\r\n while (t = read) != 0.chr\r\n if t == @char_lead_byte then\r\n t = read\r\n end\r\n complete << t\r\n end\r\n return complete\r\n end",
"def read()\n data = @sock.recv(8192)\n return data\n end",
"def head(bytes)\n read(bytes)\n end",
"def read(len = nil)\n return nil if @read >= @size\n len ||= @size - @read\n max_read = [len, @size - @read].min\n ret = @io.read(max_read)\n @read += bytesize(ret)\n ret\n end",
"def read\n @mutex.synchronize {\n if(!@reading)\n @reading = 1\n begin\n str = @sock.gets\n rescue\n end\n\n @reading = nil\n return str\n else\n return nil\n end\n }\n end",
"def getc\n read(1).unpack('c')[0]\n end",
"def getbyte\n warn \"StringScanner#getbyte is obsolete; use #get_byte instead\" if $VERBOSE\n get_byte\n end",
"def sysread( length )\n\t\tresult = self.recvfrom( length )\n\t\treturn result[0]\n\tend",
"def get\n @io.gets\n end",
"def recv(number_of_bytes, flags = nil)\n @in.read(number_of_bytes.to_i) || \"\"\n end",
"def read() end",
"def getc\n return @serial_port.getc\n end",
"def read(maxbytes=1024)\n \"\"\"Buffered read from node, non-blocking.\n maxbytes: maximum number of bytes to return\"\"\"\n count = @readbuf.length\n if count < maxbytes\n data = File.new(@stdout.fileno(), \"r\").sysread(maxbytes - count)\n puts data\n @readbuf += data\n end \n\n if maxbytes >= @readbuf.length\n result = @readbuf\n @readbuf = ''\n else\n puts 'entered'\n result = @readbuf[0..maxbytes]\n @readbuf = @readbuf[maxbytes..@readbuf.length]\n end\n\n return result\n end",
"def read_character\n unless @input.empty?\n result(@input.at(0), advance(1))\n else\n failure(\"less than one character available\")\n end\n end",
"def read_available(length = nil)\n input.read(length || available)\n end",
"def peek\n input.byteslice(0, 1)\n end",
"def gets\n\t\t\t\tif @buffer.nil?\n\t\t\t\t\treturn read_next\n\t\t\t\telse\n\t\t\t\t\tbuffer = @buffer\n\t\t\t\t\t@buffer = nil\n\t\t\t\t\treturn buffer\n\t\t\t\tend\n\t\t\tend",
"def get_byte(offset) datap[offset].unpack('C*')[0] end",
"def get_char\n\tbegin\n\t\tsystem(\"stty raw -echo\")\n\t\tchar = STDIN.getc\n\tensure\n\t\tsystem(\"stty -raw echo\")\n\tend\n\treturn char\nend",
"def readchar() end",
"def readchar() end",
"def readchar() end",
"def read__UI8\r\n readbyte\r\n end",
"def read_chr\n @file.getc unless @file.eof?\n end",
"def read\n @handle.read\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\"\n begin\n input << STDIN.read_nonblock(3)\n rescue StandardError\n nil\n end\n begin\n input << STDIN.read_nonblock(2)\n rescue StandardError\n nil\n end\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def shell_read(length = -1, timeout = 1)\n rv = rstream.read_buffered(length, timeout)\n framework.events.on_session_output(self, rv) if rv\n return rv\n rescue ::Rex::SocketError, ::EOFError, ::IOError, ::Errno::EPIPE => e\n # print_error(\"Socket error: #{e.class}: #{e}\")\n shell_close\n raise e\n end",
"def read(offset, len)\n _isource.read(offset, len)\n end",
"def read_available(length = nil)\n @input.read(length || available)\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def read\n return if @read_flag\n\n process_reading\n end",
"def read(*args)\n sync\n io.read *args\n end",
"def read(len=nil)\n read_len = len ? compute_decode_read_len(len) : nil\n generic_read(len, read_len) { |data| Krypt::Hex.decode(data) }\n end",
"def peek\r\n @buffer ||= @io.gets\r\n @buffer\r\n end",
"def read(length=99, buf=\"buffer\") end",
"def read(handle, offset, length)\n send_request(FXP_READ, :string, handle, :int64, offset, :long, length)\n end",
"def get_byte(pos=nil)\n if pos.class == Fixnum && !block_given?\n return @j_del.java_method(:getByte, [Java::int.java_class]).call(pos)\n end\n raise ArgumentError, \"Invalid arguments when calling get_byte(pos)\"\n end",
"def read_uint8(position = nil)\n seek(position)\n data = read_and_advance(1)\n BinData::Uint8.read(data).to_i\n end",
"def read(size)\n ret = @io.read(size)\n raise EOFError if ret.nil? || size && ret.bytesize < size\n\n ret\n end"
] |
[
"0.77859414",
"0.7745722",
"0.7700225",
"0.75909054",
"0.7552271",
"0.74231297",
"0.7261125",
"0.7206362",
"0.7189144",
"0.7021475",
"0.69872725",
"0.6914632",
"0.68667674",
"0.6799037",
"0.67268455",
"0.6679358",
"0.665139",
"0.66294235",
"0.660685",
"0.65898794",
"0.65832543",
"0.6576558",
"0.6572636",
"0.6539987",
"0.6539804",
"0.6485315",
"0.6467032",
"0.63715583",
"0.6352018",
"0.6343479",
"0.63036895",
"0.6290337",
"0.6284302",
"0.62575996",
"0.6242643",
"0.6234617",
"0.61350733",
"0.61194444",
"0.60918516",
"0.6070677",
"0.60607547",
"0.6025681",
"0.6021262",
"0.6010196",
"0.5975544",
"0.595477",
"0.5944641",
"0.5932764",
"0.5932764",
"0.5914589",
"0.5892413",
"0.5883682",
"0.5882667",
"0.5873593",
"0.58623105",
"0.58547425",
"0.5807452",
"0.5799127",
"0.5774049",
"0.5769706",
"0.57372266",
"0.5728703",
"0.57085586",
"0.56857383",
"0.56667846",
"0.5658359",
"0.5648383",
"0.56472135",
"0.5643676",
"0.5641648",
"0.5628487",
"0.5628208",
"0.5619077",
"0.56160533",
"0.56151086",
"0.5613602",
"0.5610327",
"0.56088555",
"0.56088555",
"0.56088555",
"0.56030107",
"0.5601212",
"0.5598558",
"0.5582029",
"0.55776966",
"0.55731636",
"0.5564665",
"0.55511034",
"0.55511034",
"0.55511034",
"0.55511034",
"0.55501825",
"0.55402327",
"0.55318546",
"0.552739",
"0.55220115",
"0.55163336",
"0.548651",
"0.5482842",
"0.5476652"
] |
0.6313997
|
30
|
Reads a single character from the pipe.
|
def getc
return @read_buffer.slice!(0) if @read_buffer && !@read_buffer.empty?
@read_buffer ||= +''
Polyphony.backend_read(self, @read_buffer, 8192, false, -1)
return @read_buffer.slice!(0) if !@read_buffer.empty?
nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def readchar\n getc || raise(EOFError)\n end",
"def read_byte\n read('C', 1)\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\"\n begin\n input << STDIN.read_nonblock(3)\n rescue StandardError\n nil\n end\n begin\n input << STDIN.read_nonblock(2)\n rescue StandardError\n nil\n end\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def read_char\n raw_tty! do\n input = $stdin.getc.chr\n return input unless input == \"\\e\"\n\n input << begin\n $stdin.read_nonblock(3)\n rescue\n ''\n end\n input << begin\n $stdin.read_nonblock(2)\n rescue\n ''\n end\n input\n end\n rescue IOError\n \"\\e\"\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def readchar() end",
"def readchar() end",
"def readchar() end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n input\n ensure\n STDIN.echo = true\n STDIN.cooked!\n end",
"def read_character\n unless @input.empty?\n result(@input.at(0), advance(1))\n else\n failure(\"less than one character available\")\n end\n end",
"def read_char\n\tSTDIN.echo = false\n\tSTDIN.raw!\n\tinput = STDIN.getc.chr\n\tif input == \"\\e\" then\n \tinput << STDIN.read_nonblock(3) rescue nil\n \tinput << STDIN.read_nonblock(2) rescue nil\n \tend\nensure\n \tSTDIN.echo = true\n \tSTDIN.cooked!\n \treturn input\nend",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def readChar\n\tinput = STDIN.read_nonblock(1) rescue nil\n\tif input == \"\\e\" then\n\t\tinput << STDIN.read_nonblock(1) rescue nil\n\t\tinput << STDIN.read_nonblock(1) rescue nil\n\tend\n\t\n\treturn input\nend",
"def get_char\n\tbegin\n\t\tsystem(\"stty raw -echo\")\n\t\tchar = STDIN.getc\n\tensure\n\t\tsystem(\"stty -raw echo\")\n\tend\n\treturn char\nend",
"def readbyte\n getbyte || raise(EOFError)\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\nend",
"def read_char\n\tSTDIN.echo = false\n\tSTDIN.raw!\n\tinput = STDIN.getc.chr\n\tif input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n return input\nend",
"def read_char\n STDIN.raw!\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n return input\nend",
"def get_character( input = STDIN )\n raw_no_echo_mode\n\n begin\n input.getc\n ensure\n restore_mode\n end\n end",
"def getbyte\n while true # Performance\n return nil unless __advance!\n stream = @_st_stream\n if val = stream.getc\n return val\n end\n\n return nil if stream._equal?(File.__stdin)\n stream.close unless stream.closed?\n @_st_advance = true\n end\n end",
"def readchar\n end",
"def read_chr\n @file.getc unless @file.eof?\n end",
"def read_byte\n buf = read_all(1)\n return Bytes.get_string_byte(buf, 0)\n end",
"def getc\n read(1)\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n \n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n \n return input\nend",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n \n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n \n return input\nend",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n \n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n \n return input\nend",
"def read\n @io.write(?r) # Read command\n sleep(0.1) until !@io.eof?\n\n @io.readbyte\n end",
"def shell_read(length = nil)\n return rstream.read(length)\n end",
"def getc\n system \"/bin/stty raw -echo\"\n if STDIN.respond_to?(:getbyte)\n STDIN.getbyte\n else\n STDIN.getc\n end\n ensure\n system \"/bin/stty -raw echo\"\n end",
"def getbyte\n read(1)\n end",
"def read_char\n begin\n # save previous state of stty\n old_state = `stty -g`\n # disable echoing and enable raw (not having to press enter)\n system \"stty raw -echo\"\n c = STDIN.getc.chr\n # gather next two characters of special keys\n if(c==\"\\e\")\n extra_thread = Thread.new{\n c = c + STDIN.getc.chr\n c = c + STDIN.getc.chr\n }\n # wait just long enough for special keys to get swallowed\n extra_thread.join(0.00001)\n # kill thread so not-so-long special keys don't wait on getc\n extra_thread.kill\n end\n rescue => ex\n puts \"#{ex.class}: #{ex.message}\"\n puts ex.backtrace\n ensure\n # restore previous state of stty\n system \"stty #{old_state}\"\n end\n return c\nend",
"def read_char\nSTDIN.echo = false\nSTDIN.raw!\ninput = STDIN.getc.chr\nif input == \"\\e\" then\ninput << STDIN.read_nonblock(3) rescue nil\ninput << STDIN.read_nonblock(2) rescue nil\nend\nensure\nSTDIN.echo = true\nSTDIN.cooked!\nreturn input\nend",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n begin\n input = STDIN.read_nonblock(1)\n if input == \"\\e\"\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n rescue\n retry\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\nend",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n exit(1) if input == \"\\u0003\"\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.cooked!\n STDIN.echo = true\n \n\n return input\nend",
"def shell_read(length = nil)\n if length.nil?\n rv = rstream.get\n else\n rv = rstream.read(length)\n end\n return rv\n end",
"def getc\n return nil if @read >= @size\n ret = @io.getc\n @read += 1 if ret\n ret\n end",
"def read characters\n forward characters\n end",
"def getbyte\n read(1).ord\n end",
"def peek()\n lookaheadChar = @source_io.getc\n @source_io.ungetc(lookaheadChar)\n return lookaheadChar.chr\n end",
"def getc\n read(1).unpack('c')[0]\n end",
"def read_character\n lit = read_literal\n\n return \" \" if lit.empty? && peek_char == \" \"\n CHARACTERS.fetch(lit.downcase) do\n # Return just the first character\n unread(lit[1..-1])\n lit[0,1]\n end\n end",
"def read_char &block\n STDIN.noecho do\n # as long as the block doen't return falsy,\n # read the user input key and sned it to the block\n while block.( IOHelper.get_char )\n end\n end\n end",
"def get_char\n begin\n # save previous state of stty\n old_state = `stty -g`\n # disable echoing and enable raw (not having to press enter)\n system 'stty raw -echo'\n char = STDIN.getc.chr\n # gather next two characters of special keys\n if char == \"\\e\"\n char << STDIN.read_nonblock(3) rescue nil\n char << STDIN.read_nonblock(2) rescue nil\n end\n\n # restore previous state of stty\n system \"stty #{old_state}\"\n end\n\n key = IOChar.char_to_key(char)\n\n if key == 'ctrl-c' or key == 'ctrl-d'\n raise Interrupt\n end\n\n char\n end",
"def getc\n @port.read_byte.chr\n end",
"def read_byte\n @buffer.shift(BYTE_LENGTH).join.to_i(2) if @buffer.length >= BYTE_LENGTH\n end",
"def read\n buf = \"\"\n term = [\"\\r\\n\"]\n\n while true do\n char = @sp.getc\n \n # die if we couldn't read\n # (nil signifies an error)\n raise StandardError if char.nil?\n \n # convert the character to ascii,\n # and append it to the tmp buffer\n buf << sprintf(\"%c\", char)\n\n # if a terminator was just received,\n # then return the current buffer\n term.each do |t|\n len = t.length\n if buf[-len, len] == t\n return buf.strip\n end\n end\n end\n end",
"def read(length = 65535)\n if length < 0\n length = 65535\n end\n return sysread(length)\n end",
"def read_char()\n STDIN.getch()\nend",
"def shell_read(length = nil)\n raise NotImplementedError\n end",
"def read_byte; end",
"def read()\r\n return @socket.read(1)\r\n end",
"def read\n @socket.gets\n end",
"def receive()\r\n complete = \"\"\r\n while (t = read) != 0.chr\r\n if t == @char_lead_byte then\r\n t = read\r\n end\r\n complete << t\r\n end\r\n return complete\r\n end",
"def getchar\n @key_reader.getchar\n end",
"def read_command\n $stdin.noecho do |noecho|\n noecho.raw do |raw|\n raw.getc.tap do |command|\n # Consume PageUp or PageDown if present. No other ANSI escape sequence is\n # supported so a blind 3.times getc is enough.\n 3.times { command << raw.getc } if command == \"\\e\"\n end\n end\n end\nend",
"def read_and_unpack_byte\n byte = @sock.read(1)\n raise SocketReadError if byte.nil?\n byte = byte.unpack('C')[0]\n end",
"def read\n @socket.read(1)\n end",
"def getc\n return @serial_port.getc\n end",
"def getc\n if @c\n c = @c\n @c = nil\n c\n else\n @io.getc\n end\n end",
"def read_user_char\n char = nil\n # Don't read keyboard more than x times per second\n time = Time.new\n if !@prev_time || time - @prev_time >= 0.25\n @prev_time = time\n begin\n system('stty raw -echo') # => Raw mode, no echo\n char = (STDIN.read_nonblock(1) rescue nil)\n ensure\n system('stty -raw echo') # => Reset terminal mode\n end\n end\n char\n end",
"def read_byte(data, offset)\n out = data[offset,1].unpack('C').first rescue 0\n return out\n end",
"def read(bytes)\n read_file(@reader, bytes) unless peek_named_pipe(@reader).zero?\n end",
"def getc\n @bytes_to_be_read -= 1\n @io.readbyte()\n end",
"def getc\n # Read c\n c = @input.getc\n\n # Maintain counters\n if c == \"\\n\"\n @line += 1\n @pos = 1\n else\n @pos += 1\n end\n\n # Return char\n return c\n end",
"def get_char\n c = Curses.getch\n c if (0..255) === c.ord\n end",
"def getchar\n state = `stty -g`\n `stty raw -echo -icanon isig`\n STDIN.getc.chr\nensure\n `stty #{state}`\nend",
"def rl_read_key()\r\n @rl_key_sequence_length+=1\r\n\r\n if (@rl_pending_input!=0)\r\n c = @rl_pending_input\r\n rl_clear_pending_input()\r\n else\r\n # If the user has an event function, then call it periodically.\r\n if (@rl_event_hook)\r\n while (@rl_event_hook && (c=rl_get_char()).nil?)\r\n\r\n send(@rl_event_hook)\r\n if (@rl_done) # XXX - experimental\r\n return (\"\\n\")\r\n end\r\n if (rl_gather_tyi() < 0) # XXX - EIO\r\n @rl_done = true\r\n return (\"\\n\")\r\n end\r\n end\r\n\r\n else\r\n\r\n if (c=rl_get_char()).nil?\r\n c = send(@rl_getc_function,@rl_instream)\r\n end\r\n end\r\n end\r\n\r\n return (c)\r\n end",
"def read\n read_object(read_byte)\n end",
"def get_char(options)\n if options[:raw] && options[:echo]\n if options[:nonblock]\n get_char_echo_non_blocking\n else\n get_char_echo_blocking\n end\n elsif options[:raw] && !options[:echo]\n options[:nonblock] ? get_char_non_blocking : get_char_blocking\n elsif !options[:raw] && !options[:echo]\n options[:nonblock] ? get_char_non_blocking : get_char_blocking\n else\n @input.getc\n end\n end",
"def readkey\n system('stty raw -echo') # => Raw mode, no echo\n c = (STDIN.read_nonblock(1).ord rescue nil)\n system('stty -raw echo') # => Reset terminal mode\n c\nend",
"def read(term=nil)\n\t\tterm = \"\\r\\n\" if term==nil\n\t\tterm = [term] unless term.is_a? Array\n\t\tbuf = \"\"\n\t\t\n\t\t# include the terminator in the traffic dump,\n\t\t# if it's anything other than the default\n\t\t#suffix = (term != [\"\\r\\n\"]) ? \" (term=#{term.inspect})\" : \"\"\n\t\t#log_incr \"Read\" + suffix, :traffic\n\t\t\n\t\tbegin\n\t\t\ttimeout(@read_timeout) do\n\t\t\t\twhile true do\n\t\t\t\t\tchar = @device.getc\n\t\t\t\t\t\n\t\t\t\t\t# die if we couldn't read\n\t\t\t\t\t# (nil signifies an error)\n\t\t\t\t\traise Gsm::ReadError\\\n\t\t\t\t\t\tif char.nil?\n\t\t\t\t\t\n\t\t\t\t\t# convert the character to ascii,\n\t\t\t\t\t# and append it to the tmp buffer\n\t\t\t\t\tbuf << sprintf(\"%c\", char)\n\t\t\t\t\n\t\t\t\t\t# if a terminator was just received,\n\t\t\t\t\t# then return the current buffer\n\t\t\t\t\tterm.each do |t|\n\t\t\t\t\t\tlen = t.length\n\t\t\t\t\t\tif buf[-len, len] == t\n\t\t\t\t\t\t\tlog \"Read: #{buf.inspect}\", :traffic\n\t\t\t\t\t\t\treturn buf.strip\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\n\t\t# reading took too long, so intercept\n\t\t# and raise a more specific exception\n\t\trescue Timeout::Error\n\t\t\tlog = \"Read: Timed out\", :warn\n\t\t\traise TimeoutError\n\t\tend\n\tend",
"def gets(*arg)\n @stream.gets(*arg)\n end",
"def readbyte\n map_exceptions do\n @socket.readbyte\n end\n end",
"def get_char(options)\n if options[:raw]\n WinAPI.getch.chr\n else\n options[:echo] ? @input.getc : WinAPI.getch.chr\n end\n end",
"def read\n @mutex.synchronize {\n if(!@reading)\n @reading = 1\n begin\n str = @sock.gets\n rescue\n end\n\n @reading = nil\n return str\n else\n return nil\n end\n }\n end",
"def get_char(echo: true, raw: false, nonblock: false)\n if raw && echo\n if nonblock\n get_char_echo_non_blocking\n else\n get_char_echo_blocking\n end\n elsif raw && !echo\n nonblock ? get_char_non_blocking : get_char_blocking\n elsif !raw && !echo\n nonblock ? get_char_non_blocking : get_char_blocking\n else\n @input.getc\n end\n end",
"def read(byte_count)\n buffer = @current_io.read(byte_count)\n if !buffer\n select_next_io\n @current_io.read(byte_count)\n else\n buffer\n end\n end",
"def read(len)\r\n buf = \"\\0\" * len\r\n Win32API.new(\"msvcrt\", \"_read\", \"lpl\", \"l\").call(@fd, buf, len)\r\n buf\r\n end",
"def next_byte(io)\n io.readbytes(1).unpack(\"C\")[0]\n end",
"def getbyte\n char = getc\n char ? char.getbyte(0) : nil\n end",
"def read_one\n read_console_input.shift\n end",
"def rl_get_char()\r\n if (@push_index == @pop_index)\r\n return nil\r\n end\r\n key = @ibuffer[@pop_index]\r\n @pop_index += 1\r\n\r\n if (@pop_index >= @ibuffer_len)\r\n @pop_index = 0\r\n end\r\n\r\n return key\r\n end",
"def get_single_char\n printf \"> \"\n tty_param = `stty -g`\n system 'stty raw'\n input_single_char = IO.read '/dev/stdin', 1\n system \"stty #{tty_param}\"\n# print \"#{input_single_char}\\n\"\n\nreturn input_single_char\n\nend",
"def consume_character\n unless @input.empty?\n success(advance(1))\n else\n failure(\"less than one character available\")\n end\n end",
"def read_input\n begin\n @in.flush\n chars = @in.sysread(255)\n rescue EOFError, IOError, Errno::ECONNRESET, Errno::ENOTSOCK\n chars = nil\n end\n if chars.nil?\n stop\n else\n mutex.synchronize { @buffer.concat chars }\n changed\n notify_observers self\n end\n end",
"def get_character( input = STDIN )\n Win32API.new(\"crtdll\", \"_getch\", [ ], \"L\").Call\n end",
"def sysread(len = 1)\n @sock.sysread(len)\n end",
"def readline\n @handle.gets\n end",
"def callback_read_char\n rl_callback_read_char\n end",
"def readbyte\n end",
"def receive\n complete = \"\"\n while (t = read) != 0.chr\n if t == @char_lead_byte then\n t = read\n end\n\n attempt_to_reconnect if t.nil?\n\n complete << t\n end\n\n complete\n end",
"def getch\n return nil if eos?\n\n do_scan(/./u, true, true, true)\n end",
"def shell_read(length = nil, shell = nil)\n\t\traise NotImplementedError\n\tend",
"def read() end",
"def read\n serial_port.read_nonblock(4096)\n rescue EOFError\n end",
"def next_line\n $stdin.tty? ?\n Readline.readline('> ', true) :\n $stdin.gets\n end",
"def shell_read(length = -1, timeout = 1)\n rv = rstream.read_buffered(length, timeout)\n framework.events.on_session_output(self, rv) if rv\n return rv\n rescue ::Rex::SocketError, ::EOFError, ::IOError, ::Errno::EPIPE => e\n # print_error(\"Socket error: #{e.class}: #{e}\")\n shell_close\n raise e\n end"
] |
[
"0.76599306",
"0.74723554",
"0.7373208",
"0.73564684",
"0.7319815",
"0.7319815",
"0.7319815",
"0.7319815",
"0.7250056",
"0.7250056",
"0.7250056",
"0.7235716",
"0.72354627",
"0.71929145",
"0.71705866",
"0.71625173",
"0.70387477",
"0.69764125",
"0.69060206",
"0.6903406",
"0.6888439",
"0.6854671",
"0.68497175",
"0.6834064",
"0.67646044",
"0.6711165",
"0.67098224",
"0.66977423",
"0.66977423",
"0.6697637",
"0.669132",
"0.66803926",
"0.6668001",
"0.6634585",
"0.6629014",
"0.6606247",
"0.6583068",
"0.65467614",
"0.65390337",
"0.6537814",
"0.65142965",
"0.6504914",
"0.6503526",
"0.65030414",
"0.6498662",
"0.6498022",
"0.64870924",
"0.64551383",
"0.6428511",
"0.64125293",
"0.6364278",
"0.6354358",
"0.6307873",
"0.62960845",
"0.6286489",
"0.62818426",
"0.6270365",
"0.6258821",
"0.6241028",
"0.6227903",
"0.62221843",
"0.6145836",
"0.61184",
"0.6117017",
"0.6094645",
"0.60540074",
"0.605231",
"0.6050168",
"0.60455453",
"0.6044799",
"0.6029523",
"0.60057604",
"0.5996924",
"0.5996307",
"0.5975836",
"0.59738857",
"0.5959185",
"0.5956562",
"0.5955644",
"0.595407",
"0.594213",
"0.59336334",
"0.59188056",
"0.59111243",
"0.5905988",
"0.58993196",
"0.58922994",
"0.5869044",
"0.586879",
"0.586686",
"0.58639604",
"0.58566874",
"0.5856334",
"0.58541507",
"0.58319575",
"0.58263975",
"0.5820608",
"0.5816753",
"0.58047545",
"0.57951003",
"0.5793024"
] |
0.0
|
-1
|
Reads from the pipe.
|
def read(len = nil, buf = nil, buffer_pos = 0)
return Polyphony.backend_read(self, buf, len, true, buffer_pos) if buf
@read_buffer ||= +''
result = Polyphony.backend_read(self, @read_buffer, len, true, -1)
return nil unless result
already_read = @read_buffer
@read_buffer = +''
already_read
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def read(*args)\n sync\n io.read *args\n end",
"def read\n @handle.read\n end",
"def read\n return if @read_flag\n\n process_reading\n end",
"def shell_read(length = nil)\n if length.nil?\n rv = rstream.get\n else\n rv = rstream.read(length)\n end\n return rv\n end",
"def shell_read(length = nil)\n return rstream.read(length)\n end",
"def read\n data = @handle.availableData\n return data\n end",
"def read() end",
"def read_from_pipe(pipe, timeout = 0.1, &_block)\n if self.class.readable?(pipe, timeout)\n l = pipe.readpartial(4096)\n # TODO: Log a debug for \"#{Time.now} PIPE> #{l}\"\n # Since readpartial may return a nil at EOF, skip returning that value\n yield l unless l.nil?\n end\n\n nil\n end",
"def shell_read(length = nil)\n raise NotImplementedError\n end",
"def read(*args)\n io.read(*args)\n end",
"def read\n _read\n end",
"def shell_read(length = -1, timeout = 1)\n rv = rstream.read_buffered(length, timeout)\n framework.events.on_session_output(self, rv) if rv\n return rv\n rescue ::Rex::SocketError, ::EOFError, ::IOError, ::Errno::EPIPE => e\n # print_error(\"Socket error: #{e.class}: #{e}\")\n shell_close\n raise e\n end",
"def read\n @socket.gets\n end",
"def read\n @io.rewind\n @io.read\n end",
"def process_pipe\n # We want to open this pipe in non-blocking read mode b/c\n # otherwise this process becomes hard to kill.\n f = File.new(settings['pipe'], (File::RDONLY | File::NONBLOCK))\n while true\n process_file_handle(f)\n # In non-blocking mode, an EOFError from f.readline doesn't mean\n # there's no more data to read, just that there's no more data\n # right *now*. If we sleep for a bit there might be more data\n # coming down the pipe.\n sleep settings['pipe_read_sleep']\n end\n f.close\n end",
"def pull(io)\n lenbytes = io.read LEN_BYTES\n\n # this showed up in early testing ...\n raise \"BUG! - read from a pipe should never EOF\" if lenbytes.nil?\n\n cmdlen = lenbytes.unpack(LEN_PACK)[0]\n packet = io.read cmdlen\n if packet.bytesize == cmdlen\n Marshal.load packet\n else\n raise \"Corrupt/truncated packet!: #{packet.inspect}\"\n end\n end",
"def readline\n @handle.gets\n end",
"def shell_read(length = nil, shell = nil)\n\t\traise NotImplementedError\n\tend",
"def read(bytes)\n @reader.read_nonblock(bytes)\n rescue Errno::EAGAIN\n # it simply means that there's nothing in\n # the output buffer.\n rescue Errno::EIO => msg\n @pid = nil\n rescue EOFError => msg\n @pid = nil\n end",
"def read\n @io.write(?r) # Read command\n sleep(0.1) until !@io.eof?\n\n @io.readbyte\n end",
"def read\n end",
"def read\n with_flock(File::LOCK_SH) do\n # File was opened\n unless @pos\n @fd.pos = 0\n @format.read_header(@fd)\n @size = 0\n @emit.call(nil)\n else\n @fd.pos = @pos\n end\n buf = @fd.read\n @pos = @fd.pos\n buf\n end\n end",
"def read; @connection.readline end",
"def shell_read(length=-1, timeout=1)\n begin\n rv = rstream.get_once(length, timeout)\n framework.events.on_session_output(self, rv) if rv\n return rv\n rescue ::Rex::SocketError, ::EOFError, ::IOError, ::Errno::EPIPE => e\n #print_error(\"Socket error: #{e.class}: #{e}\")\n shell_close\n raise e\n end\n end",
"def read(bytes)\n read_file(@reader, bytes) unless peek_named_pipe(@reader).zero?\n end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read_and_process\n process(read)\n end",
"def shell_read(buf, shell = nil)\n\t\traise NotImplementedError\n\tend",
"def read\n @buffer\n end",
"def get\n @io.gets\n end",
"def read_stdin\n open_connection\n $stdin.each_line { |l| call_write(process_line(l.strip), false) }\n close_connection\n rescue SystemExit, Interrupt\n puts 'ctrl-c. Exiting.'\n wf.close\n exit 0\n end",
"def read(entry)\n get_input_stream(entry, &:read)\n end",
"def read(length = 65535)\n if length < 0\n length = 65535\n end\n return sysread(length)\n end",
"def sysread(len = 1)\n @sock.sysread(len)\n end",
"def read(length = nil, opts = {})\n synchronize_access {\n begin\n return fd.read_nonblock( length )\n rescue ::Errno::EAGAIN, ::Errno::EWOULDBLOCK\n return nil if self.close_resource\n # Sleep for a half a second, or until we can read again\n Rex::ThreadSafe.select( [ fd ], nil, nil, 0.5 )\n # Decrement the block size to handle full sendQs better\n retry\n rescue ::IOError, ::Errno::EPIPE\n return nil\n end\n }\n end",
"def read!\n\t\t\t\t\tread\n\t\t\trescue\n\t\t\t\tnil\n\t\t\tend",
"def read(io)\n io = BinData::IO.new(io) unless BinData::IO === io\n\n do_read(io)\n done_read\n self\n end",
"def read\n if active?\n res = nil\n\n while res.nil?\n @queue_lock.synchronize {\n @queue.each { |item|\n # Find next data\n if item.type == :data and item.seq == @seq_recv.to_s\n res = item\n break\n # No data? Find close\n elsif item.type == :close and res.nil?\n res = item\n end\n }\n\n @queue.delete_if { |item| item == res }\n }\n\n # No data? Wait for next to arrive...\n @pending.wait unless res\n end\n\n if res.type == :data\n @seq_recv += 1\n @seq_recv = 0 if @seq_recv > 65535\n res.data\n elsif res.type == :close\n deactivate\n nil # Closed\n end\n else\n nil\n end\n end",
"def read(byte_count)\n buffer = @current_io.read(byte_count)\n if !buffer\n select_next_io\n @current_io.read(byte_count)\n else\n buffer\n end\n end",
"def read\n end",
"def read\n end",
"def read\n end",
"def read\n end",
"def shell_read(length=nil, timeout=1)\n\t\tshell_init\n\n\t\tlength = nil if length < 0\n\t\tbegin\n\t\t\trv = nil\n\t\t\t# Meterpreter doesn't offer a way to timeout on the victim side, so\n\t\t\t# we have to do it here. I'm concerned that this will cause loss\n\t\t\t# of data.\n\t\t\tTimeout.timeout(timeout) {\n\t\t\t\trv = @shell.channel.read(length)\n\t\t\t}\n\t\t\tframework.events.on_session_output(self, rv) if rv\n\t\t\treturn rv\n\t\trescue ::Timeout::Error\n\t\t\treturn nil\n\t\trescue ::Exception => e\n\t\t\tshell_close\n\t\t\traise e\n\t\tend\n\tend",
"def read_available(length = nil)\n @input.read(length || available)\n end",
"def read\n read_object(read_byte)\n end",
"def read\n @read ||= read_from(closest)\n end",
"def gets\n\t\t\t\tif @buffer.nil?\n\t\t\t\t\treturn read_next\n\t\t\t\telse\n\t\t\t\t\tbuffer = @buffer\n\t\t\t\t\t@buffer = nil\n\t\t\t\t\treturn buffer\n\t\t\t\tend\n\t\t\tend",
"def read\n serial_port.read_nonblock(4096)\n rescue EOFError\n end",
"def read_available(length = nil)\n input.read(length || available)\n end",
"def read\n raise NotImplementedError\n end",
"def gets(*arg)\n @stream.gets(*arg)\n end",
"def read(length = nil)\n #This is a stub, used for indexing\n end",
"def read(length=99, buf=\"buffer\") end",
"def read_data\n unpacker.read\n end",
"def read(len)\r\n buf = \"\\0\" * len\r\n Win32API.new(\"msvcrt\", \"_read\", \"lpl\", \"l\").call(@fd, buf, len)\r\n buf\r\n end",
"def read\n @socket.read(1)\n end",
"def read(meta = @meta)\n buffer, size = next_read(meta)\n size == 0 ? nil : buffer.get_bytes(size)\n end",
"def read(length = bytes_remaining)\n value = @data.byteslice(@pos, length)\n @pos += length\n value\n end",
"def read\n throw '\"read\" called before \"execute\"' unless @master\n # The result of read operation when pty slave is closed is platform dependent.\n begin\n @master.gets # FreeBSD returns nil.\n rescue Errno::EIO # GNU/Linux raises EIO.\n nil\n end\n end",
"def sysread(*args)\n\t\tif Fiber.current[:neverblock]\n\t\t\tres = read_neverblock(*args)\r\n else\n res = read_blocking(*args)\r\n end\n\t\tres\r\n end",
"def read(pos)\n end",
"def close_read() end",
"def close_read() end",
"def close_read() end",
"def read()\r\n return @socket.read(1)\r\n end",
"def stdin_pipe\n @stdin\n end",
"def read_streams\n pipe_done_reading = Mutex.new\n pipe_done_reading.lock\n # TODO: Uncomment again when implementing logging\n # start_time = Time.now\n\n stdout_reader = Thread.new { drain_pipe_until_signaled(@stdout, pipe_done_reading) }\n stderr_reader = Thread.new { drain_pipe_until_signaled(@stderr, pipe_done_reading) }\n\n pipe_reader = Thread.new(@pipe) do |pipe|\n # Read a Little Endian 32-bit integer for length of response\n expected_response_length = pipe.sysread(4).unpack1('V')\n\n next nil if expected_response_length.zero?\n\n # Reads the expected bytes as a binary string or fails\n buffer = ''\n # sysread may not return all of the requested bytes due to buffering or the\n # underlying IO system. Keep reading from the pipe until all the bytes are read.\n loop do\n buffer.concat(pipe.sysread(expected_response_length - buffer.length))\n break if buffer.length >= expected_response_length\n end\n buffer\n end\n\n # TODO: Log a debug for \"Waited #{Time.now - start_time} total seconds.\"\n\n # Block until sysread has completed or errors\n begin\n output = pipe_reader.value\n output = self.class.ps_output_to_hash!(output) unless output.nil?\n ensure\n # Signal stdout / stderr readers via Mutex so that\n # Ruby doesn't crash waiting on an invalid event.\n pipe_done_reading.unlock\n end\n\n # Given redirection on PowerShell side, this should always be empty\n stdout = stdout_reader.value\n\n [\n output,\n stdout == [] ? nil : stdout.join, # native stdout\n stderr_reader.value # native stderr\n ]\n ensure\n # Failsafe if the prior unlock was never reached / Mutex wasn't unlocked\n pipe_done_reading.unlock if pipe_done_reading.locked?\n # Wait for all non-nil threads to see mutex unlocked and finish\n [pipe_reader, stdout_reader, stderr_reader].compact.each(&:join)\n end",
"def sysread( length )\n\t\tresult = self.recvfrom( length )\n\t\treturn result[0]\n\tend",
"def prepare\n self[:in].read\n end",
"def __read(buffer_length, buffer = nil)\n @io.read_nonblock(buffer_length, buffer)\n rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR\n Minx.yield\n retry\n end",
"def get\n socket.readline\n end",
"def read\n @lines.shift\n end",
"def read(*args)\n @io.read(*args).tap {|r| backup.write r unless r.nil? }\n end",
"def close_read(*) end",
"def read(*rest) end",
"def read(*rest) end",
"def read!(handle, offset, length, &callback)\n wait_for(read(handle, offset, length, &callback), :data)\n end",
"def read(offset, len)\n _isource.read(offset, len)\n end",
"def read\n\t\t\t\t\t@stream.readpartial(BLOCK_SIZE)\n\t\t\t\trescue EOFError, IOError\n\t\t\t\t\t# I noticed that in some cases you will get EOFError, and in other cases IOError!?\n\t\t\t\t\treturn nil\n\t\t\t\tend",
"def read\n @serial_port.read()\n end",
"def quick_read (io_or_path, mode='r')\n\t\t\t\trdr = Reader.new(io_or_path, mode)\n\t\t\t\tdata = rdr.hndl.read()\n\t\t\t\trdr.close()\n\t\t\t\treturn data\n\t\t\tend",
"def reads\n (1..read_count).to_a\n end",
"def read_io io\n handle_client io\n end",
"def read()\n\tloop {\n\t\t#puts (\"read list in : #{$reading}\")\n\t\trs, ws, es = IO.select($reading, nil, nil, 1)\n\t\tif (rs != nil)\n\t\t\trs.each { |r|\n\t\t\t\tmsg = r.gets\n\t\t\t\t#only reads in messages sent from a socket\n\t\t\t\tif (!(msg == nil))\n\t\t\t\t\tmsg_info = msg.split(\" \")\n\t\t\t\t\t#if msg_info[0] != \"LSP\"\n\t\t\t\t\t#puts(\"just recieved a message #{msg}\")\n\t\t\t\t\t#end\n\t\t\t\t\t#puts (\"just recieved a message #{msg}\")\n\t\t\t\t\tparseMsg(msg)\t\t\t\n\t\t\t\tend\n\t\t\t}\n\t\tend\n\t\t\n\t}\nend",
"def read()\n return @reader.call(@address)\n end",
"def read()\n data = @sock.recv(8192)\n return data\n end",
"def from_pipe(stream)\n # implement get_records and/or other consuming app stuff\n throw NotImplementedError\n end",
"def read\n @mutex.synchronize {\n if(!@reading)\n @reading = 1\n begin\n str = @sock.gets\n rescue\n end\n\n @reading = nil\n return str\n else\n return nil\n end\n }\n end",
"def read(*args)\n #This is a stub, used for indexing\n end",
"def gets(*args)\n map_exceptions do\n @socket.gets(*args)\n end\n end",
"def read\n connection.open(full_remote_path).read\n end",
"def read(&block)\n @read_block = block\n end",
"def cmd_read(*args)\n\t\tif (args.length == 0)\n\t\t\tprint_line(\n\t\t\t\t\"Usage: read channel_id [length]\\n\\n\" +\n\t\t\t\t\"Reads data from the supplied channel.\")\n\t\t\treturn true\n\t\tend\n\n\t\tcid = args[0].to_i\n\t\tlength = (args.length >= 2) ? args[1].to_i : 16384\n\t\tchannel = client.find_channel(cid)\n\n\t\tif (!channel)\n\t\t\tprint_error(\"Channel #{cid} is not valid.\")\n\t\t\treturn true\n\t\tend\n\n\t\tdata = channel.read(length)\n\n\t\tif (data and data.length)\n\t\t\tprint(\"Read #{data.length} bytes from #{cid}:\\n\\n#{data}\\n\")\n\t\telse\n\t\t\tprint_error(\"No data was returned.\")\n\t\tend\n\n\t\treturn true\n\tend"
] |
[
"0.72086924",
"0.7187916",
"0.71058846",
"0.7086703",
"0.7077615",
"0.70185566",
"0.700214",
"0.69456565",
"0.6814137",
"0.68033916",
"0.6787313",
"0.6758005",
"0.6689138",
"0.66554356",
"0.6643333",
"0.6617766",
"0.659195",
"0.6582097",
"0.6581534",
"0.6571048",
"0.6552094",
"0.64991075",
"0.6490887",
"0.64879704",
"0.6477475",
"0.6475504",
"0.6475504",
"0.6475504",
"0.6475504",
"0.6475504",
"0.6475504",
"0.6475504",
"0.6412077",
"0.6381162",
"0.6345003",
"0.6339829",
"0.63376987",
"0.6326475",
"0.6325359",
"0.6323305",
"0.6315373",
"0.6286026",
"0.6277919",
"0.62749994",
"0.6270734",
"0.62514406",
"0.62514406",
"0.62514406",
"0.62514406",
"0.62274617",
"0.62241584",
"0.6219661",
"0.62009555",
"0.6196296",
"0.6189675",
"0.618756",
"0.6179721",
"0.6174106",
"0.6153267",
"0.6140101",
"0.612373",
"0.6122246",
"0.61083436",
"0.609262",
"0.60925555",
"0.6087121",
"0.60868466",
"0.6080587",
"0.60754323",
"0.60754323",
"0.60754323",
"0.6057707",
"0.605281",
"0.6040826",
"0.6034802",
"0.60281163",
"0.6016754",
"0.60086113",
"0.59990716",
"0.5996345",
"0.5985354",
"0.5958723",
"0.5958723",
"0.59572756",
"0.5954253",
"0.5942045",
"0.5939051",
"0.59325886",
"0.5927209",
"0.5925821",
"0.5918794",
"0.5915084",
"0.59053314",
"0.5901627",
"0.5896356",
"0.58893454",
"0.5888625",
"0.5878718",
"0.5861924",
"0.5859881"
] |
0.5921749
|
90
|
Reads from the pipe.
|
def readpartial(len, buf = +'', buffer_pos = 0, raise_on_eof = true)
result = Polyphony.backend_read(self, buf, len, false, buffer_pos)
raise EOFError if !result && raise_on_eof
result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def read(*args)\n sync\n io.read *args\n end",
"def read\n @handle.read\n end",
"def read\n return if @read_flag\n\n process_reading\n end",
"def shell_read(length = nil)\n if length.nil?\n rv = rstream.get\n else\n rv = rstream.read(length)\n end\n return rv\n end",
"def shell_read(length = nil)\n return rstream.read(length)\n end",
"def read\n data = @handle.availableData\n return data\n end",
"def read() end",
"def read_from_pipe(pipe, timeout = 0.1, &_block)\n if self.class.readable?(pipe, timeout)\n l = pipe.readpartial(4096)\n # TODO: Log a debug for \"#{Time.now} PIPE> #{l}\"\n # Since readpartial may return a nil at EOF, skip returning that value\n yield l unless l.nil?\n end\n\n nil\n end",
"def shell_read(length = nil)\n raise NotImplementedError\n end",
"def read(*args)\n io.read(*args)\n end",
"def read\n _read\n end",
"def shell_read(length = -1, timeout = 1)\n rv = rstream.read_buffered(length, timeout)\n framework.events.on_session_output(self, rv) if rv\n return rv\n rescue ::Rex::SocketError, ::EOFError, ::IOError, ::Errno::EPIPE => e\n # print_error(\"Socket error: #{e.class}: #{e}\")\n shell_close\n raise e\n end",
"def read\n @socket.gets\n end",
"def read\n @io.rewind\n @io.read\n end",
"def process_pipe\n # We want to open this pipe in non-blocking read mode b/c\n # otherwise this process becomes hard to kill.\n f = File.new(settings['pipe'], (File::RDONLY | File::NONBLOCK))\n while true\n process_file_handle(f)\n # In non-blocking mode, an EOFError from f.readline doesn't mean\n # there's no more data to read, just that there's no more data\n # right *now*. If we sleep for a bit there might be more data\n # coming down the pipe.\n sleep settings['pipe_read_sleep']\n end\n f.close\n end",
"def pull(io)\n lenbytes = io.read LEN_BYTES\n\n # this showed up in early testing ...\n raise \"BUG! - read from a pipe should never EOF\" if lenbytes.nil?\n\n cmdlen = lenbytes.unpack(LEN_PACK)[0]\n packet = io.read cmdlen\n if packet.bytesize == cmdlen\n Marshal.load packet\n else\n raise \"Corrupt/truncated packet!: #{packet.inspect}\"\n end\n end",
"def readline\n @handle.gets\n end",
"def shell_read(length = nil, shell = nil)\n\t\traise NotImplementedError\n\tend",
"def read(bytes)\n @reader.read_nonblock(bytes)\n rescue Errno::EAGAIN\n # it simply means that there's nothing in\n # the output buffer.\n rescue Errno::EIO => msg\n @pid = nil\n rescue EOFError => msg\n @pid = nil\n end",
"def read\n @io.write(?r) # Read command\n sleep(0.1) until !@io.eof?\n\n @io.readbyte\n end",
"def read\n end",
"def read\n with_flock(File::LOCK_SH) do\n # File was opened\n unless @pos\n @fd.pos = 0\n @format.read_header(@fd)\n @size = 0\n @emit.call(nil)\n else\n @fd.pos = @pos\n end\n buf = @fd.read\n @pos = @fd.pos\n buf\n end\n end",
"def read; @connection.readline end",
"def shell_read(length=-1, timeout=1)\n begin\n rv = rstream.get_once(length, timeout)\n framework.events.on_session_output(self, rv) if rv\n return rv\n rescue ::Rex::SocketError, ::EOFError, ::IOError, ::Errno::EPIPE => e\n #print_error(\"Socket error: #{e.class}: #{e}\")\n shell_close\n raise e\n end\n end",
"def read(bytes)\n read_file(@reader, bytes) unless peek_named_pipe(@reader).zero?\n end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read_and_process\n process(read)\n end",
"def shell_read(buf, shell = nil)\n\t\traise NotImplementedError\n\tend",
"def read\n @buffer\n end",
"def get\n @io.gets\n end",
"def read_stdin\n open_connection\n $stdin.each_line { |l| call_write(process_line(l.strip), false) }\n close_connection\n rescue SystemExit, Interrupt\n puts 'ctrl-c. Exiting.'\n wf.close\n exit 0\n end",
"def read(entry)\n get_input_stream(entry, &:read)\n end",
"def read(length = 65535)\n if length < 0\n length = 65535\n end\n return sysread(length)\n end",
"def sysread(len = 1)\n @sock.sysread(len)\n end",
"def read(length = nil, opts = {})\n synchronize_access {\n begin\n return fd.read_nonblock( length )\n rescue ::Errno::EAGAIN, ::Errno::EWOULDBLOCK\n return nil if self.close_resource\n # Sleep for a half a second, or until we can read again\n Rex::ThreadSafe.select( [ fd ], nil, nil, 0.5 )\n # Decrement the block size to handle full sendQs better\n retry\n rescue ::IOError, ::Errno::EPIPE\n return nil\n end\n }\n end",
"def read!\n\t\t\t\t\tread\n\t\t\trescue\n\t\t\t\tnil\n\t\t\tend",
"def read(io)\n io = BinData::IO.new(io) unless BinData::IO === io\n\n do_read(io)\n done_read\n self\n end",
"def read\n if active?\n res = nil\n\n while res.nil?\n @queue_lock.synchronize {\n @queue.each { |item|\n # Find next data\n if item.type == :data and item.seq == @seq_recv.to_s\n res = item\n break\n # No data? Find close\n elsif item.type == :close and res.nil?\n res = item\n end\n }\n\n @queue.delete_if { |item| item == res }\n }\n\n # No data? Wait for next to arrive...\n @pending.wait unless res\n end\n\n if res.type == :data\n @seq_recv += 1\n @seq_recv = 0 if @seq_recv > 65535\n res.data\n elsif res.type == :close\n deactivate\n nil # Closed\n end\n else\n nil\n end\n end",
"def read(byte_count)\n buffer = @current_io.read(byte_count)\n if !buffer\n select_next_io\n @current_io.read(byte_count)\n else\n buffer\n end\n end",
"def read\n end",
"def read\n end",
"def read\n end",
"def read\n end",
"def shell_read(length=nil, timeout=1)\n\t\tshell_init\n\n\t\tlength = nil if length < 0\n\t\tbegin\n\t\t\trv = nil\n\t\t\t# Meterpreter doesn't offer a way to timeout on the victim side, so\n\t\t\t# we have to do it here. I'm concerned that this will cause loss\n\t\t\t# of data.\n\t\t\tTimeout.timeout(timeout) {\n\t\t\t\trv = @shell.channel.read(length)\n\t\t\t}\n\t\t\tframework.events.on_session_output(self, rv) if rv\n\t\t\treturn rv\n\t\trescue ::Timeout::Error\n\t\t\treturn nil\n\t\trescue ::Exception => e\n\t\t\tshell_close\n\t\t\traise e\n\t\tend\n\tend",
"def read_available(length = nil)\n @input.read(length || available)\n end",
"def read\n read_object(read_byte)\n end",
"def read\n @read ||= read_from(closest)\n end",
"def gets\n\t\t\t\tif @buffer.nil?\n\t\t\t\t\treturn read_next\n\t\t\t\telse\n\t\t\t\t\tbuffer = @buffer\n\t\t\t\t\t@buffer = nil\n\t\t\t\t\treturn buffer\n\t\t\t\tend\n\t\t\tend",
"def read\n serial_port.read_nonblock(4096)\n rescue EOFError\n end",
"def read_available(length = nil)\n input.read(length || available)\n end",
"def read\n raise NotImplementedError\n end",
"def gets(*arg)\n @stream.gets(*arg)\n end",
"def read(length = nil)\n #This is a stub, used for indexing\n end",
"def read(length=99, buf=\"buffer\") end",
"def read_data\n unpacker.read\n end",
"def read(len)\r\n buf = \"\\0\" * len\r\n Win32API.new(\"msvcrt\", \"_read\", \"lpl\", \"l\").call(@fd, buf, len)\r\n buf\r\n end",
"def read\n @socket.read(1)\n end",
"def read(meta = @meta)\n buffer, size = next_read(meta)\n size == 0 ? nil : buffer.get_bytes(size)\n end",
"def read(length = bytes_remaining)\n value = @data.byteslice(@pos, length)\n @pos += length\n value\n end",
"def read\n throw '\"read\" called before \"execute\"' unless @master\n # The result of read operation when pty slave is closed is platform dependent.\n begin\n @master.gets # FreeBSD returns nil.\n rescue Errno::EIO # GNU/Linux raises EIO.\n nil\n end\n end",
"def sysread(*args)\n\t\tif Fiber.current[:neverblock]\n\t\t\tres = read_neverblock(*args)\r\n else\n res = read_blocking(*args)\r\n end\n\t\tres\r\n end",
"def read(pos)\n end",
"def close_read() end",
"def close_read() end",
"def close_read() end",
"def read()\r\n return @socket.read(1)\r\n end",
"def stdin_pipe\n @stdin\n end",
"def read_streams\n pipe_done_reading = Mutex.new\n pipe_done_reading.lock\n # TODO: Uncomment again when implementing logging\n # start_time = Time.now\n\n stdout_reader = Thread.new { drain_pipe_until_signaled(@stdout, pipe_done_reading) }\n stderr_reader = Thread.new { drain_pipe_until_signaled(@stderr, pipe_done_reading) }\n\n pipe_reader = Thread.new(@pipe) do |pipe|\n # Read a Little Endian 32-bit integer for length of response\n expected_response_length = pipe.sysread(4).unpack1('V')\n\n next nil if expected_response_length.zero?\n\n # Reads the expected bytes as a binary string or fails\n buffer = ''\n # sysread may not return all of the requested bytes due to buffering or the\n # underlying IO system. Keep reading from the pipe until all the bytes are read.\n loop do\n buffer.concat(pipe.sysread(expected_response_length - buffer.length))\n break if buffer.length >= expected_response_length\n end\n buffer\n end\n\n # TODO: Log a debug for \"Waited #{Time.now - start_time} total seconds.\"\n\n # Block until sysread has completed or errors\n begin\n output = pipe_reader.value\n output = self.class.ps_output_to_hash!(output) unless output.nil?\n ensure\n # Signal stdout / stderr readers via Mutex so that\n # Ruby doesn't crash waiting on an invalid event.\n pipe_done_reading.unlock\n end\n\n # Given redirection on PowerShell side, this should always be empty\n stdout = stdout_reader.value\n\n [\n output,\n stdout == [] ? nil : stdout.join, # native stdout\n stderr_reader.value # native stderr\n ]\n ensure\n # Failsafe if the prior unlock was never reached / Mutex wasn't unlocked\n pipe_done_reading.unlock if pipe_done_reading.locked?\n # Wait for all non-nil threads to see mutex unlocked and finish\n [pipe_reader, stdout_reader, stderr_reader].compact.each(&:join)\n end",
"def sysread( length )\n\t\tresult = self.recvfrom( length )\n\t\treturn result[0]\n\tend",
"def prepare\n self[:in].read\n end",
"def __read(buffer_length, buffer = nil)\n @io.read_nonblock(buffer_length, buffer)\n rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR\n Minx.yield\n retry\n end",
"def get\n socket.readline\n end",
"def read\n @lines.shift\n end",
"def read(*args)\n @io.read(*args).tap {|r| backup.write r unless r.nil? }\n end",
"def close_read(*) end",
"def read(*rest) end",
"def read(*rest) end",
"def read!(handle, offset, length, &callback)\n wait_for(read(handle, offset, length, &callback), :data)\n end",
"def read(offset, len)\n _isource.read(offset, len)\n end",
"def read\n\t\t\t\t\t@stream.readpartial(BLOCK_SIZE)\n\t\t\t\trescue EOFError, IOError\n\t\t\t\t\t# I noticed that in some cases you will get EOFError, and in other cases IOError!?\n\t\t\t\t\treturn nil\n\t\t\t\tend",
"def read\n @serial_port.read()\n end",
"def quick_read (io_or_path, mode='r')\n\t\t\t\trdr = Reader.new(io_or_path, mode)\n\t\t\t\tdata = rdr.hndl.read()\n\t\t\t\trdr.close()\n\t\t\t\treturn data\n\t\t\tend",
"def reads\n (1..read_count).to_a\n end",
"def read_io io\n handle_client io\n end",
"def read(len = nil, buf = nil, buffer_pos = 0)\n return Polyphony.backend_read(self, buf, len, true, buffer_pos) if buf\n\n @read_buffer ||= +''\n result = Polyphony.backend_read(self, @read_buffer, len, true, -1)\n return nil unless result\n\n already_read = @read_buffer\n @read_buffer = +''\n already_read\n end",
"def read()\n\tloop {\n\t\t#puts (\"read list in : #{$reading}\")\n\t\trs, ws, es = IO.select($reading, nil, nil, 1)\n\t\tif (rs != nil)\n\t\t\trs.each { |r|\n\t\t\t\tmsg = r.gets\n\t\t\t\t#only reads in messages sent from a socket\n\t\t\t\tif (!(msg == nil))\n\t\t\t\t\tmsg_info = msg.split(\" \")\n\t\t\t\t\t#if msg_info[0] != \"LSP\"\n\t\t\t\t\t#puts(\"just recieved a message #{msg}\")\n\t\t\t\t\t#end\n\t\t\t\t\t#puts (\"just recieved a message #{msg}\")\n\t\t\t\t\tparseMsg(msg)\t\t\t\n\t\t\t\tend\n\t\t\t}\n\t\tend\n\t\t\n\t}\nend",
"def read()\n return @reader.call(@address)\n end",
"def read()\n data = @sock.recv(8192)\n return data\n end",
"def from_pipe(stream)\n # implement get_records and/or other consuming app stuff\n throw NotImplementedError\n end",
"def read\n @mutex.synchronize {\n if(!@reading)\n @reading = 1\n begin\n str = @sock.gets\n rescue\n end\n\n @reading = nil\n return str\n else\n return nil\n end\n }\n end",
"def read(*args)\n #This is a stub, used for indexing\n end",
"def gets(*args)\n map_exceptions do\n @socket.gets(*args)\n end\n end",
"def read\n connection.open(full_remote_path).read\n end",
"def read(&block)\n @read_block = block\n end",
"def cmd_read(*args)\n\t\tif (args.length == 0)\n\t\t\tprint_line(\n\t\t\t\t\"Usage: read channel_id [length]\\n\\n\" +\n\t\t\t\t\"Reads data from the supplied channel.\")\n\t\t\treturn true\n\t\tend\n\n\t\tcid = args[0].to_i\n\t\tlength = (args.length >= 2) ? args[1].to_i : 16384\n\t\tchannel = client.find_channel(cid)\n\n\t\tif (!channel)\n\t\t\tprint_error(\"Channel #{cid} is not valid.\")\n\t\t\treturn true\n\t\tend\n\n\t\tdata = channel.read(length)\n\n\t\tif (data and data.length)\n\t\t\tprint(\"Read #{data.length} bytes from #{cid}:\\n\\n#{data}\\n\")\n\t\telse\n\t\t\tprint_error(\"No data was returned.\")\n\t\tend\n\n\t\treturn true\n\tend"
] |
[
"0.72086924",
"0.7187916",
"0.71058846",
"0.7086703",
"0.7077615",
"0.70185566",
"0.700214",
"0.69456565",
"0.6814137",
"0.68033916",
"0.6787313",
"0.6758005",
"0.6689138",
"0.66554356",
"0.6643333",
"0.6617766",
"0.659195",
"0.6582097",
"0.6581534",
"0.6571048",
"0.6552094",
"0.64991075",
"0.6490887",
"0.64879704",
"0.6477475",
"0.6475504",
"0.6475504",
"0.6475504",
"0.6475504",
"0.6475504",
"0.6475504",
"0.6475504",
"0.6412077",
"0.6381162",
"0.6345003",
"0.6339829",
"0.63376987",
"0.6326475",
"0.6325359",
"0.6323305",
"0.6315373",
"0.6286026",
"0.6277919",
"0.62749994",
"0.6270734",
"0.62514406",
"0.62514406",
"0.62514406",
"0.62514406",
"0.62274617",
"0.62241584",
"0.6219661",
"0.62009555",
"0.6196296",
"0.6189675",
"0.618756",
"0.6179721",
"0.6174106",
"0.6153267",
"0.6140101",
"0.612373",
"0.6122246",
"0.61083436",
"0.609262",
"0.60925555",
"0.6087121",
"0.60868466",
"0.6080587",
"0.60754323",
"0.60754323",
"0.60754323",
"0.6057707",
"0.605281",
"0.6040826",
"0.6034802",
"0.60281163",
"0.6016754",
"0.60086113",
"0.59990716",
"0.5996345",
"0.5985354",
"0.5958723",
"0.5958723",
"0.59572756",
"0.5954253",
"0.5942045",
"0.5939051",
"0.59325886",
"0.5927209",
"0.5925821",
"0.5921749",
"0.5918794",
"0.5915084",
"0.59053314",
"0.5901627",
"0.5896356",
"0.58893454",
"0.5888625",
"0.5878718",
"0.5861924",
"0.5859881"
] |
0.0
|
-1
|
Writes to the pipe.
|
def write(buf, *args)
Polyphony.backend_write(self, buf, *args)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def write_pipe(input)\n written = @pipe.write(input)\n @pipe.flush\n\n if written != input.length # rubocop:disable Style/GuardClause\n msg = \"Only wrote #{written} out of #{input.length} expected bytes to PowerShell pipe\"\n raise Errno::EPIPE.new, msg\n end\n end",
"def shell_write(buf)\n rstream.write(buf)\n end",
"def shell_write(buf)\n rstream.write(buf)\n end",
"def write data\n _data[:out].write data\n _data[:out].flush\n end",
"def shell_write(buf)\n raise NotImplementedError\n end",
"def write\n command :write\n self\n end",
"def write(data)\n\n max_write = self.options['pipe_write_max_size'] || data.length\n min_write = self.options['pipe_write_min_size'] || max_write\n\n if(min_write > max_write)\n max_write = min_write\n end\n\n idx = 0\n\n if (self.socket.class == Rex::Proto::SMB::SimpleClient::OpenPipe)\n while(idx < data.length)\n bsize = (rand(max_write-min_write)+min_write).to_i\n len = self.socket.write(data[idx, bsize])\n idx += bsize\n end\n else\n self.socket.write(data)\n end\n\n data.length\n end",
"def write(buf); end",
"def write(p0) end",
"def write(p0) end",
"def write(p0) end",
"def write(data)\n @handle.writeData(data)\n end",
"def write\n end",
"def write(data)\n end",
"def outgoing=(pipe)\n\t\t\t@outgoing = MsgpackIoWriter.new(pipe)\n\t\tend",
"def write(data); end",
"def write(data); end",
"def write(data); end",
"def write(data); end",
"def write; end",
"def write; end",
"def on_body(env, data)\n # append data to the write end of the pipe if open, otherwise do nothing\n env[\"tus.input-writer\"].write(data) unless env[\"tus.input-writer\"].closed?\n rescue Errno::EPIPE\n # read end of the pipe has been closed, so we close the write end as well\n env[\"tus.input-writer\"].close\n end",
"def on_writable\n @being_written = nil\n return unless res = responses.first\n if res.finished?\n responses.shift\n if res.last \n FFI::connection_schedule_close(self) \n return\n end\n end \n write\n end",
"def syswrite(p0) end",
"def syswrite(p0) end",
"def syswrite(p0) end",
"def write(*data); end",
"def write(data)\n # black hole, because we don't actually care about what gets written\n end",
"def puts data\n\t\t@write_semaphore.synchronize do\n\t\t\t@write_data = data\n\t\t\t@write_cv.signal\n\t\tend\n\tend",
"def write(io)\n io = BinData::IO.new(io) unless BinData::IO === io\n\n do_write(io)\n io.flush\n self\n end",
"def write\n write_data\n end",
"def write(data)\r\n Win32API.new(\"msvcrt\", \"_write\", \"lpl\", \"l\").call(@fd, data, 1)\r\n end",
"def send_data(pipe, data)\n pipe.write(data, \"\\n#{MSG_ENDI}\\n\")\nend",
"def write(input)\n @stdin.write input\n end",
"def write\n w = Writer.new(self)\n yield w\n w.write(stdout)\n end",
"def write(data)\n @mutex.synchronize { @buffer = @buffer.dup.concat(data) }\n pump_buffer\n Reactor.selector.wakeup unless monitor.interests == :r\n end",
"def send(message)\n pipe_to.puts(message)\n end",
"def write(chunk)\n # dummy\n end",
"def write(*args)\n args.each do |a|\n @serial.write a.chr\n end\n end",
"def close_write() end",
"def close_write() end",
"def close_write() end",
"def write\n raise \"Writers must implement #write\"\n end",
"def write(data)\n ret = io.write data\n @receivers.each do |r|\n Fiber.new { r.call data }.resume\n end\n ret\n end",
"def write_to_socket bytes\n socket.write_nonblock bytes\n rescue IO::WaitWritable\n :wait_writable\n end",
"def syswrite(args)\n\t lsock.write(*args)\n end",
"def write(value)\n # pass\n end",
"def write(&block)\n @write_block = block\n end",
"def write(data)\n @write_buffer << data\n post do\n begin\n @monitor&.interests = :rw\n rescue EOFError => e\n # Monitor is closed\n logger.error \"Error when writing: #{e.message}\"\n end\n end\n end",
"def write(dest); end",
"def write(dest); end",
"def write(dest); end",
"def syswrite( buf )\n\t\treturn _write( buf )\n\tend",
"def write(*args)\n @pager_io ||= spawn_pager\n @pager_io.write(*args)\n self\n end",
"def close_write(*) end",
"def syswrite(buffer)\n\t\t\t\tremaining = buffer.bytesize\n\t\t\t\t\n\t\t\t\t# Fast path:\n\t\t\t\twritten = @io.write(buffer)\n\t\t\t\treturn if written == remaining\n\t\t\t\t\n\t\t\t\t# Slow path:\n\t\t\t\tremaining -= written\n\t\t\t\t\n\t\t\t\twhile remaining > 0\n\t\t\t\t\twrote = @io.write(buffer.byteslice(written, remaining))\n\t\t\t\t\t\n\t\t\t\t\tremaining -= wrote\n\t\t\t\t\twritten += wrote\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn written\n\t\t\tend",
"def write(data, *args, **kwd); end",
"def _do_write(io)\n raise NotImplementedError\n end",
"def write(data)\n @data << data\n end",
"def write(data)\n reset_timer\n\n begin\n return socket.write_nonblock(data)\n rescue IO::WaitWritable\n IO.select(nil, [socket], nil, time_left)\n log_time\n retry\n end\n rescue EOFError\n :eof\n end",
"def do_write(*args)\n # This method used to forward arguments to @socket.write in a\n # single call like so:\n #\n # @socket.write(*args)\n #\n # Turns out, when each buffer to be written is large (e.g. 32 MiB),\n # this write call would take an extremely long time (20+ seconds)\n # while using 100% CPU. Splitting the writes into chunks produced\n # massively better performance (0.05 seconds to write the 32 MiB of\n # data on the same hardware). Unfortunately splitting the data,\n # one would assume, results in it being copied, but this seems to be\n # a much more minor issue compared to CPU cost of writing large buffers.\n args.each do |buf|\n buf = buf.to_s\n i = 0\n while i < buf.length\n chunk = buf[i...i+WRITE_CHUNK_SIZE]\n @socket.write(chunk)\n i += WRITE_CHUNK_SIZE\n end\n end\n end",
"def write(bytes)\r\n end",
"def shell_write(buf)\n return unless buf\n\n begin\n framework.events.on_session_command(self, buf.strip)\n rstream.write(buf)\n rescue ::Rex::SocketError, ::EOFError, ::IOError, ::Errno::EPIPE => e\n #print_error(\"Socket error: #{e.class}: #{e}\")\n shell_close\n raise e\n end\n end",
"def write_to(io)\n end",
"def write_to(io)\n end",
"def write(data)\n outfile.write(data)\n outfile.close unless outfile.tty?\n end",
"def close_write; end",
"def write(input)\r\n target.write input\r\n self\r\n end",
"def send_cmd(cmd)\n # Write the command plus a newline to the input\n @pipe.write_input(cmd + \"\\n\")\n end",
"def send_cmd(cmd)\n # Write the command plus a newline to the input\n @pipe.write_input(cmd + \"\\n\")\n end",
"def write(*args)\n @writer.<<(*args) if @writer\n end",
"def write(string)\n @handle.write(string)\n end",
"def write(data)\n rescue_writable do\n socket.write_nonblock(data)\n end\n end",
"def write_to(stream)\n end",
"def on_write &block\n signal_connect \"write\" do |p, len|\n chunk = p.get_bytes(0, len)\n bytes_written = block.call chunk\n chunk.clear\n\n bytes_written\n end\n end",
"def on_write &block\n signal_connect \"write\" do |p, len|\n chunk = p.get_bytes(0, len)\n bytes_written = block.call chunk\n chunk.clear\n\n bytes_written\n end\n end",
"def write!\n ensure_mode(:privileged)\n exec('write memory')\n end",
"def __emit(str)\n __writer.flush\n end",
"def write(bytes)\n @io.write(bytes)\n\n nil\n end",
"def buffer &writes\n begin\n buffer_on!\n writes.call\n ensure\n buffer_off!\n end\n flush_buffer!\n end",
"def write(data)\n reset_timer\n\n loop do\n result = socket.write_nonblock(data, :exception => false)\n return result unless result == :wait_writable\n\n IO.select(nil, [socket], nil, time_left)\n log_time\n end\n end",
"def write(arg0)\n end",
"def send_cmd(cmd)\n # What time is it ?\n # update_access\n\n # Write the command plus a newline to the input\n @pipe.write_input(cmd + \"\\n\")\n end",
"def write_output\n\t\tbytes = self.socket.syswrite( self.obuffer )\n\t\tself.obuffer.slice!( 0, bytes ) if bytes.nonzero?\n\n\t\treturn self.obuffer.length\n\tend",
"def syswrite(arg0)\n end",
"def write( &block )\n compile!( :write!, &block )\n end",
"def write(msg)\n @handle.puts(msg)\n end",
"def flush\n\t\t\t\tsyswrite(@write_buffer)\n\t\t\t\t@write_buffer.clear\n\t\t\tend",
"def write!(handle, offset, data, &callback)\n wait_for(write(handle, offset, data, &callback))\n end",
"def write( event )\n add_to_buffer event\n self\n end",
"def flush\n @out.flush if @out.is_a?(IO)\n end",
"def write!(_)\n raise NotImplementedError, 'Implement #write! in child class'\n end",
"def write_line data\n _data[:out].puts data\n _data[:out].flush\n end",
"def write(io)\n each do |chunk|\n io << chunk\n end\n\n self\n end",
"def write(path)\n # TODO: should start locking write process\n Writer.new(self, path).write\n end",
"def write(io)\n io.write [@value].pack(format)\n end",
"def close_write\n io.close_write\n succeed\n end",
"def close_write\n if @output.respond_to?(:close)\n @output&.close\n end\n\n @output = nil\n end",
"def do_write(s)\n @wbuffer << s\n @wbuffer.force_encoding(Encoding::BINARY)\n @sync ||= false\n\n if @sync or @wbuffer.size > BLOCK_SIZE or idx = @wbuffer.rindex($/)\n remain = idx ? idx + $/.size : @wbuffer.length\n nwritten = 0\n\n while remain > 0\n str = @wbuffer[nwritten,remain]\n begin\n nwrote = syswrite(str)\n rescue Errno::EAGAIN\n retry\n end\n remain -= nwrote\n nwritten += nwrote\n end\n\n @wbuffer[0,nwritten] = \"\"\n end\n end",
"def write_cmd(buf)\n\tend"
] |
[
"0.71435106",
"0.69128627",
"0.69128627",
"0.68805027",
"0.6700958",
"0.6525963",
"0.6524989",
"0.65169924",
"0.6514245",
"0.6513196",
"0.6513196",
"0.6472097",
"0.64622104",
"0.6407786",
"0.64072704",
"0.6406832",
"0.6406832",
"0.6406832",
"0.6406832",
"0.63598424",
"0.63598424",
"0.6347182",
"0.6344991",
"0.6283212",
"0.6283212",
"0.6282854",
"0.62826365",
"0.6268785",
"0.6220361",
"0.6210997",
"0.6165034",
"0.6144074",
"0.61306626",
"0.61250496",
"0.6101582",
"0.60998684",
"0.6077105",
"0.60632527",
"0.6057216",
"0.604341",
"0.604341",
"0.604341",
"0.60425305",
"0.6005581",
"0.6004468",
"0.60018045",
"0.5996118",
"0.5986968",
"0.59793794",
"0.5952978",
"0.5952978",
"0.5952978",
"0.5945804",
"0.59446526",
"0.5935725",
"0.59259236",
"0.5921327",
"0.5919224",
"0.59129506",
"0.59054303",
"0.58998716",
"0.58874977",
"0.58784187",
"0.58647174",
"0.58647174",
"0.58491087",
"0.58394104",
"0.5832496",
"0.5828767",
"0.58286893",
"0.58119935",
"0.5808993",
"0.5797374",
"0.57854664",
"0.5757677",
"0.5757677",
"0.5752281",
"0.5746799",
"0.5732178",
"0.5730911",
"0.57196474",
"0.5715234",
"0.5711808",
"0.5705498",
"0.5704554",
"0.56858367",
"0.5680921",
"0.56800354",
"0.5678092",
"0.567679",
"0.56654304",
"0.5664851",
"0.56355774",
"0.5611512",
"0.55751556",
"0.5542791",
"0.55414385",
"0.5536982",
"0.55367374",
"0.5534604"
] |
0.6072355
|
37
|
Writes to the pipe.
|
def <<(buf)
Polyphony.backend_write(self, buf)
self
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def write_pipe(input)\n written = @pipe.write(input)\n @pipe.flush\n\n if written != input.length # rubocop:disable Style/GuardClause\n msg = \"Only wrote #{written} out of #{input.length} expected bytes to PowerShell pipe\"\n raise Errno::EPIPE.new, msg\n end\n end",
"def shell_write(buf)\n rstream.write(buf)\n end",
"def shell_write(buf)\n rstream.write(buf)\n end",
"def write data\n _data[:out].write data\n _data[:out].flush\n end",
"def shell_write(buf)\n raise NotImplementedError\n end",
"def write(data)\n\n max_write = self.options['pipe_write_max_size'] || data.length\n min_write = self.options['pipe_write_min_size'] || max_write\n\n if(min_write > max_write)\n max_write = min_write\n end\n\n idx = 0\n\n if (self.socket.class == Rex::Proto::SMB::SimpleClient::OpenPipe)\n while(idx < data.length)\n bsize = (rand(max_write-min_write)+min_write).to_i\n len = self.socket.write(data[idx, bsize])\n idx += bsize\n end\n else\n self.socket.write(data)\n end\n\n data.length\n end",
"def write\n command :write\n self\n end",
"def write(buf); end",
"def write(p0) end",
"def write(p0) end",
"def write(p0) end",
"def write(data)\n @handle.writeData(data)\n end",
"def write\n end",
"def outgoing=(pipe)\n\t\t\t@outgoing = MsgpackIoWriter.new(pipe)\n\t\tend",
"def write(data)\n end",
"def write(data); end",
"def write(data); end",
"def write(data); end",
"def write(data); end",
"def write; end",
"def write; end",
"def on_body(env, data)\n # append data to the write end of the pipe if open, otherwise do nothing\n env[\"tus.input-writer\"].write(data) unless env[\"tus.input-writer\"].closed?\n rescue Errno::EPIPE\n # read end of the pipe has been closed, so we close the write end as well\n env[\"tus.input-writer\"].close\n end",
"def on_writable\n @being_written = nil\n return unless res = responses.first\n if res.finished?\n responses.shift\n if res.last \n FFI::connection_schedule_close(self) \n return\n end\n end \n write\n end",
"def syswrite(p0) end",
"def syswrite(p0) end",
"def syswrite(p0) end",
"def write(*data); end",
"def write(data)\n # black hole, because we don't actually care about what gets written\n end",
"def puts data\n\t\t@write_semaphore.synchronize do\n\t\t\t@write_data = data\n\t\t\t@write_cv.signal\n\t\tend\n\tend",
"def write(io)\n io = BinData::IO.new(io) unless BinData::IO === io\n\n do_write(io)\n io.flush\n self\n end",
"def write\n write_data\n end",
"def write(data)\r\n Win32API.new(\"msvcrt\", \"_write\", \"lpl\", \"l\").call(@fd, data, 1)\r\n end",
"def send_data(pipe, data)\n pipe.write(data, \"\\n#{MSG_ENDI}\\n\")\nend",
"def write(input)\n @stdin.write input\n end",
"def write\n w = Writer.new(self)\n yield w\n w.write(stdout)\n end",
"def write(data)\n @mutex.synchronize { @buffer = @buffer.dup.concat(data) }\n pump_buffer\n Reactor.selector.wakeup unless monitor.interests == :r\n end",
"def send(message)\n pipe_to.puts(message)\n end",
"def write(buf, *args)\n Polyphony.backend_write(self, buf, *args)\n end",
"def write(chunk)\n # dummy\n end",
"def write(*args)\n args.each do |a|\n @serial.write a.chr\n end\n end",
"def close_write() end",
"def close_write() end",
"def close_write() end",
"def write\n raise \"Writers must implement #write\"\n end",
"def write(data)\n ret = io.write data\n @receivers.each do |r|\n Fiber.new { r.call data }.resume\n end\n ret\n end",
"def write_to_socket bytes\n socket.write_nonblock bytes\n rescue IO::WaitWritable\n :wait_writable\n end",
"def syswrite(args)\n\t lsock.write(*args)\n end",
"def write(value)\n # pass\n end",
"def write(&block)\n @write_block = block\n end",
"def write(data)\n @write_buffer << data\n post do\n begin\n @monitor&.interests = :rw\n rescue EOFError => e\n # Monitor is closed\n logger.error \"Error when writing: #{e.message}\"\n end\n end\n end",
"def write(dest); end",
"def write(dest); end",
"def write(dest); end",
"def write(*args)\n @pager_io ||= spawn_pager\n @pager_io.write(*args)\n self\n end",
"def syswrite( buf )\n\t\treturn _write( buf )\n\tend",
"def close_write(*) end",
"def syswrite(buffer)\n\t\t\t\tremaining = buffer.bytesize\n\t\t\t\t\n\t\t\t\t# Fast path:\n\t\t\t\twritten = @io.write(buffer)\n\t\t\t\treturn if written == remaining\n\t\t\t\t\n\t\t\t\t# Slow path:\n\t\t\t\tremaining -= written\n\t\t\t\t\n\t\t\t\twhile remaining > 0\n\t\t\t\t\twrote = @io.write(buffer.byteslice(written, remaining))\n\t\t\t\t\t\n\t\t\t\t\tremaining -= wrote\n\t\t\t\t\twritten += wrote\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn written\n\t\t\tend",
"def write(data, *args, **kwd); end",
"def _do_write(io)\n raise NotImplementedError\n end",
"def write(data)\n @data << data\n end",
"def write(data)\n reset_timer\n\n begin\n return socket.write_nonblock(data)\n rescue IO::WaitWritable\n IO.select(nil, [socket], nil, time_left)\n log_time\n retry\n end\n rescue EOFError\n :eof\n end",
"def do_write(*args)\n # This method used to forward arguments to @socket.write in a\n # single call like so:\n #\n # @socket.write(*args)\n #\n # Turns out, when each buffer to be written is large (e.g. 32 MiB),\n # this write call would take an extremely long time (20+ seconds)\n # while using 100% CPU. Splitting the writes into chunks produced\n # massively better performance (0.05 seconds to write the 32 MiB of\n # data on the same hardware). Unfortunately splitting the data,\n # one would assume, results in it being copied, but this seems to be\n # a much more minor issue compared to CPU cost of writing large buffers.\n args.each do |buf|\n buf = buf.to_s\n i = 0\n while i < buf.length\n chunk = buf[i...i+WRITE_CHUNK_SIZE]\n @socket.write(chunk)\n i += WRITE_CHUNK_SIZE\n end\n end\n end",
"def write(bytes)\r\n end",
"def shell_write(buf)\n return unless buf\n\n begin\n framework.events.on_session_command(self, buf.strip)\n rstream.write(buf)\n rescue ::Rex::SocketError, ::EOFError, ::IOError, ::Errno::EPIPE => e\n #print_error(\"Socket error: #{e.class}: #{e}\")\n shell_close\n raise e\n end\n end",
"def write_to(io)\n end",
"def write_to(io)\n end",
"def write(data)\n outfile.write(data)\n outfile.close unless outfile.tty?\n end",
"def close_write; end",
"def write(input)\r\n target.write input\r\n self\r\n end",
"def send_cmd(cmd)\n # Write the command plus a newline to the input\n @pipe.write_input(cmd + \"\\n\")\n end",
"def send_cmd(cmd)\n # Write the command plus a newline to the input\n @pipe.write_input(cmd + \"\\n\")\n end",
"def write(*args)\n @writer.<<(*args) if @writer\n end",
"def write(string)\n @handle.write(string)\n end",
"def write(data)\n rescue_writable do\n socket.write_nonblock(data)\n end\n end",
"def write_to(stream)\n end",
"def on_write &block\n signal_connect \"write\" do |p, len|\n chunk = p.get_bytes(0, len)\n bytes_written = block.call chunk\n chunk.clear\n\n bytes_written\n end\n end",
"def on_write &block\n signal_connect \"write\" do |p, len|\n chunk = p.get_bytes(0, len)\n bytes_written = block.call chunk\n chunk.clear\n\n bytes_written\n end\n end",
"def write!\n ensure_mode(:privileged)\n exec('write memory')\n end",
"def __emit(str)\n __writer.flush\n end",
"def write(bytes)\n @io.write(bytes)\n\n nil\n end",
"def buffer &writes\n begin\n buffer_on!\n writes.call\n ensure\n buffer_off!\n end\n flush_buffer!\n end",
"def write(data)\n reset_timer\n\n loop do\n result = socket.write_nonblock(data, :exception => false)\n return result unless result == :wait_writable\n\n IO.select(nil, [socket], nil, time_left)\n log_time\n end\n end",
"def write(arg0)\n end",
"def send_cmd(cmd)\n # What time is it ?\n # update_access\n\n # Write the command plus a newline to the input\n @pipe.write_input(cmd + \"\\n\")\n end",
"def write_output\n\t\tbytes = self.socket.syswrite( self.obuffer )\n\t\tself.obuffer.slice!( 0, bytes ) if bytes.nonzero?\n\n\t\treturn self.obuffer.length\n\tend",
"def syswrite(arg0)\n end",
"def write( &block )\n compile!( :write!, &block )\n end",
"def flush\n\t\t\t\tsyswrite(@write_buffer)\n\t\t\t\t@write_buffer.clear\n\t\t\tend",
"def write(msg)\n @handle.puts(msg)\n end",
"def write( event )\n add_to_buffer event\n self\n end",
"def write!(handle, offset, data, &callback)\n wait_for(write(handle, offset, data, &callback))\n end",
"def flush\n @out.flush if @out.is_a?(IO)\n end",
"def write!(_)\n raise NotImplementedError, 'Implement #write! in child class'\n end",
"def write_line data\n _data[:out].puts data\n _data[:out].flush\n end",
"def write(io)\n each do |chunk|\n io << chunk\n end\n\n self\n end",
"def write(path)\n # TODO: should start locking write process\n Writer.new(self, path).write\n end",
"def write(io)\n io.write [@value].pack(format)\n end",
"def close_write\n io.close_write\n succeed\n end",
"def close_write\n if @output.respond_to?(:close)\n @output&.close\n end\n\n @output = nil\n end",
"def write_cmd(buf)\n\tend",
"def do_write(s)\n @wbuffer << s\n @wbuffer.force_encoding(Encoding::BINARY)\n @sync ||= false\n\n if @sync or @wbuffer.size > BLOCK_SIZE or idx = @wbuffer.rindex($/)\n remain = idx ? idx + $/.size : @wbuffer.length\n nwritten = 0\n\n while remain > 0\n str = @wbuffer[nwritten,remain]\n begin\n nwrote = syswrite(str)\n rescue Errno::EAGAIN\n retry\n end\n remain -= nwrote\n nwritten += nwrote\n end\n\n @wbuffer[0,nwritten] = \"\"\n end\n end"
] |
[
"0.7143897",
"0.6910266",
"0.6910266",
"0.6877188",
"0.66990054",
"0.6524685",
"0.6524225",
"0.65143454",
"0.6513033",
"0.65119785",
"0.65119785",
"0.6469712",
"0.6460922",
"0.6408532",
"0.64054483",
"0.640441",
"0.640441",
"0.640441",
"0.640441",
"0.63587666",
"0.63587666",
"0.63487023",
"0.63446575",
"0.628187",
"0.628187",
"0.6281511",
"0.6280589",
"0.6267378",
"0.6220205",
"0.62083864",
"0.6163094",
"0.61412215",
"0.61311674",
"0.6124152",
"0.61007285",
"0.60990965",
"0.6077792",
"0.6069471",
"0.6062501",
"0.60551697",
"0.6042132",
"0.6042132",
"0.6042132",
"0.60413677",
"0.6003298",
"0.6002123",
"0.59991485",
"0.59942526",
"0.59850687",
"0.5977452",
"0.5950433",
"0.5950433",
"0.5950433",
"0.5943656",
"0.59428763",
"0.59343284",
"0.5923817",
"0.5919046",
"0.5917698",
"0.591033",
"0.5902278",
"0.5897076",
"0.5885687",
"0.5876491",
"0.5862626",
"0.5862626",
"0.5845459",
"0.5838236",
"0.5831198",
"0.58293855",
"0.5829316",
"0.58100015",
"0.58071154",
"0.57944196",
"0.578365",
"0.5758",
"0.5758",
"0.57501787",
"0.57470304",
"0.57305366",
"0.5730349",
"0.5716874",
"0.5713849",
"0.5712827",
"0.570374",
"0.57028425",
"0.5684",
"0.5679528",
"0.5678627",
"0.56765807",
"0.5675648",
"0.56648254",
"0.5663662",
"0.5633376",
"0.5610264",
"0.55711436",
"0.5539914",
"0.5539088",
"0.5535241",
"0.5533783",
"0.553363"
] |
0.0
|
-1
|
Writes a line with line feed to the pipe.
|
def puts(*args)
if args.empty?
write LINEFEED
return
end
idx = 0
while idx < args.size
arg = args[idx]
args[idx] = arg = arg.to_s unless arg.is_a?(String)
if arg =~ LINEFEED_RE
idx += 1
else
args.insert(idx + 1, LINEFEED)
idx += 2
end
end
write(*args)
nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def line_feed\n write_raw \"\\n\"\n end",
"def write_line data\n _data[:out].puts data\n _data[:out].flush\n end",
"def putline(line)\n @socket.puts(line.chomp)\n end",
"def write(line)\n begin\n @sock.puts line\n rescue\n end\n puts \">> #{line}\"\n end",
"def put_line(line = nil)\n commit_status()\n puts line\n STDOUT.flush\n end",
"def send_line(line)\n @socket.write(line.to_s + \"\\r\\n\")\n @socket.flush\n end",
"def send_raw_line(line)\n @logger.debug \"<< #{line}\" if @logger\n @socket.puts(line)\n end",
"def write_line(data); end",
"def send_line(line)\n connect unless connected?\n warn \"-> #{line}\" if @options[:debug]\n @socket.write(line.to_s + \"\\n\")\n @socket.flush\n self\n end",
"def writeLine( length=75, char=\"-\" )\n\t\t\t$stderr.puts \"\\r\" + (char * length )\n\t\tend",
"def begin_of_line\n write_raw \"\\r\"\n end",
"def send_line (line)\n send_data line.to_s\n end",
"def append_line\n File.open(path, 'w') do |fh|\n lines.each do |l|\n fh.puts(l)\n end\n fh.puts line\n end\n end",
"def send_line(line = '')\n reset_timeout!\n\n send_data(line + CRLF)\n\n debug_notification(:send, line.inspect)\n end",
"def writeline(str)\n writing { write0 str + \"\\r\\n\" }\n end",
"def receive_line line\n super(line)\n write_output\n end",
"def append_newline\n buffer << \"\\n\"\n @current_line_length = 0\n end",
"def enter(line)\n @standard_output.advance\n @standard_error.advance\n @stdin.puts line\n end",
"def sendline(obj)\n s = obj.to_s + context.newline\n write(s)\n end",
"def writeline(dst_path, line)\n FileUtils.mkdir_p(File.dirname(dst_path))\n File.open(dst_path, 'w') do |f|\n f.write line\n end\n end",
"def writeln(text)\n write \"\\n\" if @buf.last && @buf.last[-1] != ?\\n\n write text\n write \"\\n\"\n end",
"def append_line(line)\n @entries.last.line << line\n end",
"def flush\n return if @current_line.nil?\n\n @stream << @current_line\n @current_line = nil\n end",
"def receive_line(line)\n line.strip!\n @channel << line unless line.empty?\n end",
"def write_line(string, filename)\n Util::FileMutation.write_line(string, filename)\n end",
"def put_a_line\n puts \"\\n\"\n puts \"/\\\\\" * 40\n puts \"\\n\"\n end",
"def append_line(line)\n @lines.push(line)\n @current = false\n @current_pos = 0\n end",
"def add_line_to_file file_path,line\n return \"echo #{line} >> #{file_path}\"\n end",
"def writeln(string)\n write string.end_with?(\"\\n\") ? string : \"#{string}\\n\"\n end",
"def append_line_to_file(path, line)\n run \"echo '#{line}' | #{sudo} tee -a #{path}\", options\n end",
"def fancy_newline\n @results += '|'\n newline\n end",
"def here_with_pipe(linefeeds = false)\n lines = self.split(\"\\n\")\n lines.map! {|c| c.sub!(/\\s*\\|/, '')}\n new_string = lines.join(linefeeds ? \"\\n\" : \" \")\n self.replace(new_string)\n end",
"def line_break\n append '(?:\\n|(?:\\r\\n))'\n end",
"def feed(lines = 1)\n @lines_used += lines\n @output.write(\"#{ESC}d#{lines.chr}\")\n end",
"def writelinebinary(dst_path, line)\n FileUtils.mkdir_p(File.dirname(dst_path))\n File.open(dst_path, 'wb') do |f|\n f.write line\n end\n end",
"def status_line(line)\n @status_line = line\n unless @ping_from\n # Display this status line.\n STDOUT.write \"\\r\" # Move to the start of this line.\n STDOUT.write line # Write over it.\n STDOUT.flush\n end\n end",
"def postcmd(line)\n line\n end",
"def append_new_line(new_line)\n # Append 'line' into position 'line_number'\n puts ' append_new_line ...' if $verbose > 1\n @lines << new_line\n @line_count += 1\n end",
"def add_line(line)\n @lines << line\n line\n end",
"def send_cmd(cmd)\n # Write the command plus a newline to the input\n @pipe.write_input(cmd + \"\\n\")\n end",
"def send_cmd(cmd)\n # Write the command plus a newline to the input\n @pipe.write_input(cmd + \"\\n\")\n end",
"def hear_line *args\n raise \"must give arguments\" if args.size == 0\n args << nil if (args.size%2) == 1\n hear *args\n @pending_output += \"\\n\\r\"\n end",
"def writeln(input)\r\n target.puts input\r\n self\r\n end",
"def rl_crlf()\r\n if (@_rl_term_cr)\r\n @_rl_out_stream.write(@_rl_term_cr)\r\n end\r\n @_rl_out_stream.write(\"\\n\")\r\n return 0\r\n end",
"def newline()\n @file.write(\"\\n\")\n end",
"def line_ending=(value)\n @line_ending = value || \"\\r\\n\"\n end",
"def line_feed_size=(n)\n write(BrotherEscp::Sequence.line_feed_size(n))\n end",
"def process_new_line\n @status.line += 1\n\n @skip_next = true if ((@cur_char == \"\\n\" && @next_char == \"\\r\") ||\n (@cur_char == \"\\r\" && @next_char == \"\\n\"))\n end",
"def submit_line\n line = self.line\n return unless line\n\n self.read_only = true\n\n change_cursor do |c|\n c.move_position Qt::TextCursor::End\n c.merge_char_format ANSIToQt::Styles[:clear]\n c.insert_text \"\\n\"\n end\n\n enter_line(line)\n end",
"def accept_blank_line blank_line\n @res << \"\\n\"\n end",
"def send_to_printer(line_to_send)\n synchronize do\n ui.log :printer, :sending, line_to_send\n\n @can_send -= 1\n @sp.write(line_to_send)\n end\n end",
"def send_response(line)\n @logger.info(self.class) { line }\n @socket.puts(line)\n end",
"def shell_write(buf)\n rstream.write(buf)\n end",
"def shell_write(buf)\n rstream.write(buf)\n end",
"def rl_extend_line_buffer(len)\r\n while (len >= @rl_line_buffer.length)\r\n @rl_line_buffer << 0.chr * DEFAULT_BUFFER_SIZE\r\n end\r\n @the_line = @rl_line_buffer\r\n end",
"def writeline(str)\n\t\t\tputs(\"writing #{(str+\"\\r\\n\").inspect}\") if $DEBUG\n\t\t\t@connection.write(str + \"\\r\\n\")\n\t\tend",
"def add_line(line)\n\t\t@lines << line\n\tend",
"def cmd(str)\n\t\t@pipe.puts str\n\tend",
"def write_basic_line(io, line_key, line_value, validators)\n return if !line_value || line_value.empty?\n line_value.strip!\n valid = validate_line_value(line_value, validators)\n if valid || !@raise_on_invalid_data\n io.puts \"#{line_key}: #{line_value}\"\n elsif validators && !validators.empty? && @raise_on_invalid_data\n raise InvalidDataError, \"Invalid value: `#{line_value}` given for key `#{line_key}`\"\n end\n end",
"def add_line(line)\n @entries << line\n end",
"def readline(sep=\"\\n\")\n @port.new_line = sep\n @port.read_line\n end",
"def add_line_to_file(file, line)\n File.open(file, \"a\") {|f| f.puts(\"#{line}\")}\n end",
"def next_line\n return nil if @input.eof?\n line, ch, @pos, @line_no = '', '', 0, @line_no + 1\n until ch == \"\\r\" || ch == \"\\n\" || ch.nil?\n ch = @input.getc\n line += ch unless ch.nil?\n end\n if ch == \"\\r\"\n ch = @input.getc\n @input.ungetc(ch) unless ch == \"\\n\" || ch.nil?\n end\n line.chomp << \"\\n\"\n end",
"def append_to_block(line)\n @block_buffer = (@block_buffer || '') + line\n end",
"def readline\n buffer = ''\n loop do\n begin\n buffer << @input.read_nonblock(1)\n return writeline buffer if buffer[-1] == \"\\n\"\n rescue IO::EAGAINWaitReadable\n sleep 0.1\n rescue EOFError\n return done\n end\n end\n end",
"def on_newline(p); end",
"def line\n\t\t\t@line.set(buffer.line.start, buffer.line.end)\n\t\tend",
"def enter_line(line)\n handle_fiber(line.chomp)\n end",
"def write(data)\n super(data + \"\\n\")\n end",
"def print_line(line)\n @maxlinelength = line.length if line.length > @maxlinelength\n print line.ljust(@maxlinelength) << \"\\r\"\n $stdout.flush\nend",
"def <<(line)\n @extra << line\n end",
"def output( line )\n puts( line ) \n end",
"def emit_ln(input)\n emit(input)\n print \"\\n\"\nend",
"def log(line)\n\t\tfile=File.open(@output_file,\"a+\")\n\t\tfile.puts(line)\n\t\tfile.close\n\tend",
"def next_line\n prompt = TTY::Prompt.new\n prompt.keypress\n # puts \" \\r\"\n end",
"def receive_line line\n child.on_output line\n end",
"def addOutput( string )\n\t\t@obuffer << string.chomp << EOL\n\t\t@server.reactor.enableEvents( @socket, :write )\n\tend",
"def append_mode(line)\n File.open(\"#{file}\",\"a\") {|file| file.puts line}\n end",
"def new_line\n puts \"\\n\"\nend",
"def new_line\n puts \"\\n\"\nend",
"def write(input)\n @stdin.write input\n end",
"def sendln(cmd)\n puts \"Send: #{cmd}\"\n if cmd.size <= 510\n @socket.write(\"#{cmd}\\r\\n\")\n STDOUT.flush\n else\n end\n end",
"def line_ending\n @line_ending ||= \"\\r\\n\"\n end",
"def puts(string=\"\\n\")\n io.puts(string)\n end",
"def receive_line(line)\n Invoker::Logger.puts \"#{@command_label.color(color)} : #{line}\"\n end",
"def linebreak(amount=1)\n $stdout.print \"\\n\" * amount\n end",
"def storlines(cmd, file, &block) # :yield: line\n synchronize do\n voidcmd(\"TYPE A\")\n conn = transfercmd(cmd)\n loop do\n buf = file.gets\n break if buf == nil\n if buf[-2, 2] != CRLF\n buf = buf.chomp + CRLF\n end\n conn.write(buf)\n yield(buf) if block\n end\n conn.close # closes the SSL\n conn.io.close # closes the TCP below it\n voidresp\n end\n end",
"def puts(string)\n self.buffer += (string + \"\\n\")\n Kernel.puts string\n end",
"def send_data(pipe, data)\n pipe.write(data, \"\\n#{MSG_ENDI}\\n\")\nend",
"def setLine (line)\n @line = line\n end",
"def send(message)\n pipe_to.puts(message)\n end",
"def add_output( string )\n\t\tself.obuffer << string.chomp << EOL\n\t\tself.server.reactor.enable_events( self.socket, :write )\n\tend",
"def line_break(character)\n quickly do\n character * 150\n end\n puts \"\"\n end",
"def newline\n log('')\n end",
"def newline\n log('')\n end",
"def rl_replace_line(text, clear_undo)\r\n len = text.delete(0.chr).length\r\n @rl_line_buffer = text.dup + 0.chr\r\n @rl_end = len\r\n if (clear_undo)\r\n rl_free_undo_list()\r\n end\r\n _rl_fix_point(true)\r\n end",
"def io_buf_line\n index = @io_buf.index \"\\n\"\n return unless index\n\n @io_buf.slice!(0..index)\n end",
"def newline\n log\n end",
"def flush\n @inside_input = false\n str = \"#{END_MARKER}\\n#{FLUSH_SENTENCE}\\n\"\n @pipe.print(str)\n # Here invoke the reader thread to ensure\n # the whole output has been read.\n #@reader.run\n end",
"def to_next_line\n @history.save_line(line || \"\")\n\n if @history.to_next_line and line = @history.current_line\n replace_line line\n end\n end",
"def waitForR(rpipe)\n rpipe.puts %{cat(\"\\\\n\")}\n rpipe.gets\n end"
] |
[
"0.7411366",
"0.72201765",
"0.68373525",
"0.6804227",
"0.66175056",
"0.66020316",
"0.6593629",
"0.6549847",
"0.65201336",
"0.6438959",
"0.63316953",
"0.62997234",
"0.628438",
"0.6271037",
"0.61744744",
"0.6134378",
"0.61178654",
"0.61083484",
"0.6078873",
"0.5939412",
"0.5826404",
"0.5802167",
"0.577826",
"0.5773786",
"0.57677156",
"0.57637167",
"0.5762063",
"0.57609975",
"0.5756207",
"0.57466835",
"0.5726691",
"0.5698407",
"0.568574",
"0.5668914",
"0.56255734",
"0.56104934",
"0.5598938",
"0.55733275",
"0.5569942",
"0.55675733",
"0.5566601",
"0.55660206",
"0.5547755",
"0.5543947",
"0.5533923",
"0.55187505",
"0.5478165",
"0.54723346",
"0.5469457",
"0.5465384",
"0.5444338",
"0.5439487",
"0.5435234",
"0.5435234",
"0.5412103",
"0.5410721",
"0.54070294",
"0.54007757",
"0.5397264",
"0.5373095",
"0.5367194",
"0.5367032",
"0.53438866",
"0.53411883",
"0.5329454",
"0.5320799",
"0.52932554",
"0.5285392",
"0.5279111",
"0.5273852",
"0.5272582",
"0.52690256",
"0.52577126",
"0.52549857",
"0.5249997",
"0.5244889",
"0.5240585",
"0.5232828",
"0.5230513",
"0.5230513",
"0.5230234",
"0.522645",
"0.5221625",
"0.52165216",
"0.52119786",
"0.5207963",
"0.52059186",
"0.5193644",
"0.51901793",
"0.5189875",
"0.51818603",
"0.51575303",
"0.51472914",
"0.5144508",
"0.5144508",
"0.51432306",
"0.51344377",
"0.5129444",
"0.51244277",
"0.51207244",
"0.5119171"
] |
0.0
|
-1
|
def readbyte end def readchar end def readline(sep = $/, limit = nil, chomp: nil) end def readlines(sep = $/, limit = nil, chomp: nil) end
|
def write_nonblock(string, _options = {})
write(string)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def read() end",
"def readchar() end",
"def readchar() end",
"def readchar() end",
"def read_byte; end",
"def readline\n end",
"def readchar\n end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read characters\n forward characters\n end",
"def read; @connection.readline end",
"def readline(sep=$/, limit=nil)\n gets(sep, limit) || raise(EOFError)\n end",
"def readbyte\n end",
"def gets seps=[\"\\n\"]\n if @writecount > @readcount\n line = \"\"\n begin\n c = @buffer[@readcount]\n if !c.nil?\n @readcount = @readcount+1\n line += c\n if seps.include?(c)\n break\n end\n end\n end while !@eof\n line\n elsif @eof\n \"EOF\\n\"\n else\n nil\n end\n end",
"def gets( sep_string = $/ )\n # \n # If we have more than one line in the buffer or we have reached the\n # beginning of the file, send the last line in the buffer to the caller. \n # (This may be +nil+, if the buffer has been exhausted.)\n # \n return @line_buffer.pop if @line_buffer.size > 2 or @current_pos.zero?\n \n # \n # If we made it this far, we need to read more data to try and find the \n # beginning of a line or the beginning of the file. Move the file pointer\n # back a step, to give us new bytes to read.\n # \n @current_pos -= @read_size\n @file.seek(@current_pos, IO::SEEK_SET)\n \n # \n # Read more bytes and prepend them to the first (likely partial) line in the\n # buffer.\n # \n @line_buffer[0] = \"#{@file.read(@read_size)}#{@line_buffer[0]}\"\n @read_size = MAX_READ_SIZE # Set a size for the next read.\n \n # \n # Divide the first line of the buffer based on +sep_string+ and #flatten!\n # those new lines into the buffer.\n # \n @line_buffer[0] = @line_buffer[0].scan(/.*?#{Regexp.escape(sep_string)}|.+/)\n @line_buffer.flatten!\n \n # We have move data now, so try again to read a line...\n gets(sep_string)\n end",
"def readline(*rest) end",
"def readline(*rest) end",
"def readbyte\n getbyte || raise(EOFError)\n end",
"def read(pos)\n end",
"def readchar\n getc || raise(EOFError)\n end",
"def readline(sep=$/) end",
"def readline(sep=$/) end",
"def readline\n str = \"\"\n while ($_ = self.read(1)) != \"\\n\"\n str << $_\n end\n str << \"\\n\"\n end",
"def read_buffer; end",
"def readline\n @handle.gets\n end",
"def readline_internal()\r\n readline_internal_setup()\r\n eof = readline_internal_charloop()\r\n readline_internal_teardown(eof)\r\n end",
"def readlines(*rest) end",
"def readlines(*rest) end",
"def readline(p); Readline.readline(p); end",
"def read(n)\n end",
"def read\n serial_port.read_nonblock(4096)\n rescue EOFError\n end",
"def readline( sep_string = $/ )\n gets(sep_string) || raise(EOFError, \"end of file reached\")\n end",
"def readlines(sep=$/) end",
"def readlines(sep=$/) end",
"def readlines(eol=$/)\n ary = []\n ary << line while line = self.gets(eol)\n ary\n end",
"def read_string; end",
"def read(bytes)\n raise \"read(bytes) must be overridden\"\n end",
"def read(length=99, buf=\"buffer\") end",
"def read(_lines)\n raise NotImplementedError\n end",
"def readlines\n return nil unless __advance!\n\n lines = []\n while line = gets()\n lines << line\n end\n\n lines\n end",
"def gets(eol=$/, limit=nil)\n idx = @rbuffer.index(eol)\n\n until @eof\n break if idx\n fill_rbuff\n idx = @rbuffer.index(eol)\n end\n\n if eol.is_a?(Regexp)\n size = idx ? idx+$&.size : nil\n else\n size = idx ? idx+eol.size : nil\n end\n\n if limit and limit >= 0\n size = [size, limit].min\n end\n\n consume_rbuff(size)\n end",
"def readline(prompt); end",
"def read\n @lines.shift\n end",
"def read_line\n begin\n line = @socket.recv(@buffer_size)\n # An empty line signals a closed connection on the client side\n @closing = true if line == \"\"\n \n # Process each incoming character to filter out trash.\n line.each_byte do |ch|\n # Accept any printable characters, and the newline character.\n if (ch >= 32 and ch <= 126) or ch.chr == \"\\n\"\n @in_buffer << ch\n # Just treat carriage returns as newlines on input.\n # This will detect line endings like \\r \\n\\r, \\r\\n, etc.\n elsif ch.chr == \"\\r\"\n @in_buffer << \"\\n\"\n # Handle a backspace character in case the client doesn't.\n elsif ch.chr == \"\\x08\"\n @in_buffer.delete_at(-1)\n end\n end\n # Characters processed. Now split up the lines.\n n = @in_buffer.index(\"\\n\")\n # Go until we run out of newlines in the buffer.\n until n.nil?\n # Append this line to the line list, and chop the \\n off the end.\n line = @in_buffer.slice!(0..n)\n line.chop!\n # Skip empty lines.\n @in_lines << line if line != \"\"\n # Look for the next newline.\n n = @in_buffer.index(\"\\n\")\n end\n # Return the first line in the queue (nil if there are none). \n return @in_lines.shift\n rescue EOFError, Errno::ECONNRESET, Errno::ECONNABORTED\n @closing = true;\n return nil\n end\n end",
"def read_input; end",
"def reader; end",
"def readline\n @sp.readline.strip\n rescue EOFError\n nil\n rescue IOError # Stream was closed during readline call\n disconnect\n nil\n end",
"def read\n \n end",
"def readlines(sep=$/)\n return [] unless advance!\n\n lines = []\n while line = gets(sep)\n lines << line\n end\n\n lines\n end",
"def read\n @io.write(?r) # Read command\n sleep(0.1) until !@io.eof?\n\n @io.readbyte\n end",
"def read(size) # raise EOFError\n raise NotImplementedError.new('Method read must be defined in a derived class.')\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n \n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n \n return input\nend",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n \n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n \n return input\nend",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n \n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n \n return input\nend",
"def read\n end",
"def read\n end",
"def read\n end",
"def read\n end",
"def read_byte\n read('C', 1)\n end",
"def read_chr\n @file.getc unless @file.eof?\n end",
"def read(bytes)\n @reader.read_nonblock(bytes)\n rescue Errno::EAGAIN\n # it simply means that there's nothing in\n # the output buffer.\n rescue Errno::EIO => msg\n @pid = nil\n rescue EOFError => msg\n @pid = nil\n end",
"def read\nend",
"def read\n @index += 1\n line = @last ? @last : @lines[@index]\n @last = nil\n line\n end",
"def stdin; end",
"def read_char\n STDIN.raw!\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n return input\nend",
"def readline(sep=\"\\n\")\n @port.new_line = sep\n @port.read_line\n end",
"def readlines(*args, **kwd); end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n exit(1) if input == \"\\u0003\"\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.cooked!\n STDIN.echo = true\n \n\n return input\nend",
"def read_char\nSTDIN.echo = false\nSTDIN.raw!\ninput = STDIN.getc.chr\nif input == \"\\e\" then\ninput << STDIN.read_nonblock(3) rescue nil\ninput << STDIN.read_nonblock(2) rescue nil\nend\nensure\nSTDIN.echo = true\nSTDIN.cooked!\nreturn input\nend",
"def read(maxlen = nil, buf = nil, buffer_pos = 0)\n return readpartial(maxlen, buf, buffer_pos) if buf\n\n buf = +''\n return readpartial(maxlen, buf) if maxlen\n\n readpartial(4096, buf, -1) while true\n rescue EOFError\n buf\n end",
"def read(byte_count)\n buffer = @current_io.read(byte_count)\n if !buffer\n select_next_io\n @current_io.read(byte_count)\n else\n buffer\n end\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end",
"def read_packet; end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n input\n ensure\n STDIN.echo = true\n STDIN.cooked!\n end",
"def readlines(sep=$/, limit=nil)\n result = []\n loop do\n if (line = gets(sep, limit))\n break\n else\n result << line\n end\n end\n result\n end",
"def read(*rest) end",
"def read(*rest) end",
"def read(*args, **kwd); end",
"def read_output(bytes=4086)\n output = \"\"\n raw_output = nil\n if @tail != \"\"\n raw_output = @tail\n else\n begin\n raw_output = @io_read.read_nonblock(bytes)\n rescue Errno::EAGAIN\n end\n end\n if raw_output\n @tail = \"\"\n raw_output.gsub!(/\\r/, '')\n Vorax.debug(\"read_output: #{raw_output.inspect}\")\n scanner = StringScanner.new(raw_output)\n while not scanner.eos?\n if @look_for == @start_marker\n if text = scanner.scan_until(/#{@look_for}/)\n if text !~ /pro #{@look_for}/\n # Only if it's not part of a PROMPT sqlplus command.\n # This might happen when the \"echo\" sqlplus option\n # is ON and the begin marker is included into the\n # sql pack file. Because we are using big chunks to\n # read data it's very unlikely that the echoing of the\n # prompt command to be split in the middle.\n @look_for = @end_marker\n end\n else\n scanner.terminate\n end\n end\n if @look_for == @end_marker\n output = scanner.scan(/[^#{@look_for}]*/)\n if scanner.scan(/#{@look_for}/)\n # end of output reached?\n # There's no perfect method to figure out, but we can\n # employ some heuristics: \n # 1) if \"set echo on\", expected tail is:\n #\n # \\n<SQL_PROMPT>#pro .EOF\n # .EOF\n #\n # 2) if \"set echo off\", expected tail is:\n #\n # EOF\n #\n Vorax.debug(\"read_output: end_marker detected\")\n @tail = scanner.rest\n Vorax.debug(\"read_output: @tail=#{@tail.inspect}\")\n if @tail =~ /^#{EOF}/ || @tail =~ /^\\n[^\\n]*?#{EOF}/ || @tail =~ /^\\n<br>\\n[^\\n]*?#{EOF}/\n Vorax.debug(\"read_output: end_marker confirmed\")\n @busy = false\n @tail = \"\"\n else\n Vorax.debug(\"read_output: end_marker NOT confirmed\")\n end\n scanner.terminate\n end\n end\n end\n end\n chunk = output.force_encoding('UTF-8')\n if @current_funnel && !chunk.empty?\n # nokogiri may be confused about those unclosed <p> tags\n # sqlplus emits, so it's better to get rid of them and use\n # <br> instead. \n @current_funnel.write(br_only(chunk))\n chunk = @current_funnel.read\n end\n return chunk\n end",
"def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\nend",
"def read_char\n\tSTDIN.echo = false\n\tSTDIN.raw!\n\tinput = STDIN.getc.chr\n\tif input == \"\\e\" then\n \tinput << STDIN.read_nonblock(3) rescue nil\n \tinput << STDIN.read_nonblock(2) rescue nil\n \tend\nensure\n \tSTDIN.echo = true\n \tSTDIN.cooked!\n \treturn input\nend",
"def stdin(*); end",
"def stdin(*); end",
"def read(bytes = @length)\n return nil if @pos >= @length\n bytes = @length - @pos if bytes.nil?\n bytes = @length - @pos if @pos + bytes > @length\n\n out = @data[@pos, bytes] if @data.kind_of?(String)\n out = @data.read(bytes) if @data.kind_of?(NTFS::DataRun)\n\n @pos += out.size\n out\n end",
"def shell_read(buf, shell = nil)\n\t\traise NotImplementedError\n\tend",
"def readlines( sep_string = $/ )\n lines = Array.new\n while line = gets(sep_string)\n lines << line\n end\n lines\n end",
"def readline sep_string=$/\n buffer = \"\"\n until buffer[-1..-1] == sep_string || @io.eof?\n buffer << read(1)\n end\n\n buffer\n end",
"def read_char\n\tSTDIN.echo = false\n\tSTDIN.raw!\n\tinput = STDIN.getc.chr\n\tif input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n return input\nend",
"def getline\n return @socket.gets\n end",
"def readlines(arg0, arg1, *rest)\n end",
"def readline(arg0, arg1, *rest)\n end",
"def read_cmd(length = nil)\n\tend",
"def sysread(amt=99) end",
"def read\n buf = \"\"\n term = [\"\\r\\n\"]\n\n while true do\n char = @sp.getc\n \n # die if we couldn't read\n # (nil signifies an error)\n raise StandardError if char.nil?\n \n # convert the character to ascii,\n # and append it to the tmp buffer\n buf << sprintf(\"%c\", char)\n\n # if a terminator was just received,\n # then return the current buffer\n term.each do |t|\n len = t.length\n if buf[-len, len] == t\n return buf.strip\n end\n end\n end\n end",
"def shell_read(length = nil)\n raise NotImplementedError\n end",
"def prim_read_until delim, limit\n buf = \"\"\n if limit.nil?\n until buf.end_with? delim || (b = _read_byte).nil?\n buf << c\n end\n else\n until limit.zero? || buf.end_with?(delim) || (b = _read_byte).nil?\n buf << c\n limit -= 1\n end\n end\n return buf unless buf == \"\" && limit != 0\n end"
] |
[
"0.73357",
"0.72734344",
"0.72734344",
"0.72734344",
"0.70016277",
"0.69181913",
"0.68951607",
"0.6892259",
"0.6892259",
"0.6892259",
"0.6892259",
"0.6892259",
"0.6892259",
"0.6892259",
"0.6805932",
"0.6778989",
"0.6756082",
"0.6752847",
"0.67195666",
"0.66845185",
"0.6677803",
"0.6677803",
"0.66215414",
"0.6596884",
"0.6583904",
"0.6565462",
"0.6565462",
"0.65462375",
"0.6537952",
"0.65287757",
"0.6519864",
"0.6435241",
"0.6435241",
"0.64279497",
"0.6419174",
"0.6418475",
"0.6404534",
"0.63849056",
"0.63833255",
"0.6382738",
"0.6381788",
"0.6356789",
"0.6352605",
"0.6306991",
"0.6296405",
"0.6267207",
"0.6245971",
"0.6242995",
"0.62314576",
"0.621975",
"0.62184894",
"0.6212668",
"0.61601233",
"0.61374784",
"0.61352795",
"0.6134296",
"0.61248934",
"0.61248934",
"0.612466",
"0.6118764",
"0.6118764",
"0.6118764",
"0.6118764",
"0.6094537",
"0.60852057",
"0.6076369",
"0.6069972",
"0.6068229",
"0.60653436",
"0.60632896",
"0.6063255",
"0.6058451",
"0.60363775",
"0.603319",
"0.60291517",
"0.60260665",
"0.6019863",
"0.6013837",
"0.5982826",
"0.598018",
"0.5971611",
"0.5971611",
"0.59687847",
"0.5968007",
"0.5965599",
"0.59569067",
"0.59526247",
"0.59526247",
"0.5950546",
"0.5948216",
"0.5948197",
"0.5943891",
"0.5942299",
"0.5935272",
"0.59340197",
"0.5928276",
"0.59241855",
"0.5923139",
"0.5922518",
"0.5918395",
"0.5916551"
] |
0.0
|
-1
|
Runs a read loop.
|
def read_loop(maxlen = 8192, &block)
Polyphony.backend_read_loop(self, maxlen, &block)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def read_loop\n loop do\n msg = connection.read_msg\n msg.received_at = Time.now\n handle(msg)\n end\n rescue StandardError => e\n self << [:raise_error, e]\n end",
"def read_loop\n loop do\n begin\n should_bail = synchronize do\n # FIXME: In case of reconnect as well?\n @status == CLOSED or @status == RECONNECTING\n end\n if !@io or @io.closed? or should_bail\n return\n end\n\n # TODO: Remove timeout and just wait to be ready\n data = @io.read(MAX_SOCKET_READ_BYTES)\n @parser.parse(data) if data\n rescue Errno::ETIMEDOUT\n # FIXME: We do not really need a timeout here...\n retry\n rescue => e\n # In case of reading/parser errors, trigger\n # reconnection logic in case desired.\n process_op_error(e)\n end\n end\n end",
"def loop\n data = read\n if data && data.length > 0\n\n type = data.getbyte(0)\n data = data[1..-1]\n\n input_hook(type).call(self, type, data)\n\n end\n\n loop_hook.each { |hook| hook.call(self) }\n\n self\n end",
"def read\n return if @read_flag\n\n process_reading\n end",
"def read_loop(maxlen = 8192)\n while (data = sysread(maxlen))\n yield data\n end\n end",
"def read_loop\n read until @driver.state == :closed\n rescue SystemCallError => e\n LOGGER.error { \"(#{e.class.name.split('::').last}) #{e.message}\" }\n rescue EOFError => e\n LOGGER.error { 'EOF in websocket loop' }\n end",
"def start_read_loop\n @thread = Thread.new do\n begin\n read_loop\n $stderr.puts \"php_process: Read-loop stopped.\" if @debug\n rescue => e\n unless @php_process.destroyed?\n $stderr.puts \"Error in read-loop-thread.\"\n $stderr.puts e.inspect\n $stderr.puts e.backtrace\n end\n end\n end\n end",
"def read(*args)\n sync\n io.read *args\n end",
"def run\n action = @io_proxy.read_action\n while action do\n process_action(action)\n action = @io_proxy.read_action\n end\n end",
"def each\n loop do\n yield read\n end\n end",
"def read_worker_loop\n Thread.new do\n begin\n data = {}\n while @running\n upstream_data = @data_source_block.call\n if data_changed?(upstream_data, data[:upstream_data])\n data = wrap_data(upstream_data)\n @current_upstream = data\n if @no_wrap\n @send_queue << [upstream_data]\n else\n @send_queue << data\n end\n end\n sleep(@read_worker_delay)\n end\n rescue => e\n logger.error \"Read worker error:\"\n logger.error e\n end\n end\n end",
"def loop; end",
"def run\n while true; async.handle_message @socket.read; end\n end",
"def loop\n end",
"def loop\n end",
"def loop\n end",
"def read_and_process\n process(read)\n end",
"def read\n @io.write(?r) # Read command\n sleep(0.1) until !@io.eof?\n\n @io.readbyte\n end",
"def run\n\t\t\t\tbegin\n\t\t\t\t\twhile true\n\t\t\t\t\t\tcommand = read_object\n\t\t\t\t\t\t\n\t\t\t\t\t\tresult = yield command\n\t\t\t\t\t\t\n\t\t\t\t\t\twrite_object(result)\n\t\t\t\t\tend\n\t\t\t\trescue EOFError\n\t\t\t\t\t# Finish...\n\t\t\t\tend\n\t\t\tend",
"def run!\n loop do\n begin\n alerter.read_nonblock(WAKEUP.length)\n rescue IO::WaitReadable\n interval = current_self.next_interval if current_self\n IO.select([alerter], [], [], interval)\n end\n begin\n run_ready\n reset(false)\n rescue DeadException => e\n if(e.origin_object_id == object_id)\n Zoidberg.logger.debug \"<#{self}> Terminated state encountered. Falling out of run loop!\"\n raise\n else\n current_self.raise e\n end\n rescue => e\n Zoidberg.logger.error \"<#{self}> Unexpected error in runner: #{e.class.name} - #{e}\"\n Zoidberg.logger.debug \"<#{self}> #{e.class.name}: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n current_self.raise e\n end\n end\n end",
"def run\n\t\n\t\twhile true \t\t\t\t\t\t# run forever\n\t\t\n\t\t\tready2read = sockets_ready_for_reading()\n\t\t\t\n\t\t\tnext if not ready2read \t\t\t# if nil, loop again\n\t\n\t\t\tputs \"<Debug> ready2read=#{ready2read.inspect}\" if $DEBUG\n\n\t\t\tready2read.each do |socket|\t\t\n\t\t\t\n\t\t\t\tif socket == @server_socket then\t# we have a new client\n\n\t\t\t\t\taccept_new_connection\n\n\t\t\t\telse \t\t\t\t\t\t\t# a client has a message\n\n\t\t\t\t\tconn = get_connection_by_socket(socket)\n\n\t\t\t\t\tif socket.eof? then \t# the socket was closed\n\n\t\t\t\t\t\tmessage = sprintf(\"190 %s@%s:%s now disconnected\\n\", \n\t\t\t\t\t\t\tconn.username, conn.host, conn.port)\n\t\t\t\t\t\tlog_message(message)\n\t\t\t\t\t\tbroadcast_message(message, conn)\n\t\t\t\t\t\tsocket.close\n\t\t\t\t\t\t@connection_array.delete(conn)\n\t\t\t\t\t\tlog_socket_info\n\n\t\t\t\t\telse\t\t\t\t\t# we have a message to process\n\t\t\t\t\t\n\t\t\t\t\t\tmessage = socket.gets.chomp!\n\t\t\t\t\t\tlog_string = sprintf(\"<log>:Message From: %s@%s:%s %s\", \n\t\t\t\t\t\t conn.username, conn.host, conn.port, message.inspect)\n\t\t\t\t\t\tlog_message(log_string)\n\t\t\t\t\t\tprocess_message(message, conn)\n\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend \n\t\tend\n\tend",
"def readir\n\t\tputs '>>> Reading IR data from lirc...'\n\t\tlirc = LIRC::Client.new\n\t\twhile true\n\t\t\tdo_action(lirc.next.name)\n\t\tend\n\tend",
"def read(&block)\n @read_block = block\n end",
"def read_loop\n line_number = 1\n full_buffer = \"\"\n while buf = Readline.readline(\"#{line_number}:#{extra_prompt}>> \", true)\n begin\n full_buffer += buf\n # unless this is puppet code, otherwise skip repl keywords\n unless PuppetDebugger::InputResponders::Commands.command_list_regex.match(buf)\n line_number = line_number.next\n begin\n parser.parse_string(full_buffer)\n rescue Puppet::ParseErrorWithIssue => e\n if multiline_input?(e)\n out_buffer.print \" \"\n full_buffer += \"\\n\"\n next\n end\n end\n end\n handle_input(full_buffer)\n full_buffer = \"\"\n end\n end\n end",
"def read() end",
"def run_read_code\n return nil if finished?\n prepare unless prepared?\n @read_code[@context].tap { |this_read| finish if this_read.nil? }\n end",
"def loop_forever; end",
"def loop( &block )\n sanity_check\n @connection.loop(&block)\n end",
"def sysread(*args)\n\t\tif Fiber.current[:neverblock]\n\t\t\tres = read_neverblock(*args)\r\n else\n res = read_blocking(*args)\r\n end\n\t\tres\r\n end",
"def def_read_loop_timeout\n 0.1\n end",
"def read()\n\tloop {\n\t\t#puts (\"read list in : #{$reading}\")\n\t\trs, ws, es = IO.select($reading, nil, nil, 1)\n\t\tif (rs != nil)\n\t\t\trs.each { |r|\n\t\t\t\tmsg = r.gets\n\t\t\t\t#only reads in messages sent from a socket\n\t\t\t\tif (!(msg == nil))\n\t\t\t\t\tmsg_info = msg.split(\" \")\n\t\t\t\t\t#if msg_info[0] != \"LSP\"\n\t\t\t\t\t#puts(\"just recieved a message #{msg}\")\n\t\t\t\t\t#end\n\t\t\t\t\t#puts (\"just recieved a message #{msg}\")\n\t\t\t\t\tparseMsg(msg)\t\t\t\n\t\t\t\tend\n\t\t\t}\n\t\tend\n\t\t\n\t}\nend",
"def inner_loop\n return if @stop\n\n data = @socket.readpartial 4096\n driver.parse data unless data.nil? or data.empty?\n end",
"def run\n raise NotImplementedError, 'Generic loop has nothing to do'\n end",
"def read maxlen = DEFAULT_MAXLEN\n main = Thread.current\n @reader = Thread.new do\n @read_gate.block!\n begin\n _read maxlen\n rescue => e\n main.raise e\n end\n end\n end",
"def process_input_loop\n lines = nil\n while true\n # Only synchronize long enough to copy and clear the input buffer.\n @input_buffer_mutex.synchronize do\n lines = @input_buffer.dup\n @input_buffer.clear\n end\n\n if (lines)\n # Now actually handle the data we copied, secure in the knowledge\n # that our reader thread is no longer going to wait on us.\n while lines.empty? == false\n process_input(lines.shift)\n end\n\n lines = nil\n end\n\n sleep 0.05\n end\n end",
"def read_all\n return enum_for :read_all unless block_given?\n\n loop do\n yield read\n rescue EOFError\n break\n end\n self\n end",
"def readline_internal()\r\n readline_internal_setup()\r\n eof = readline_internal_charloop()\r\n readline_internal_teardown(eof)\r\n end",
"def read(&callback)\n reader = read_stream(@stream)\n workers = dispatch_workers(&callback)\n reader.join\n workers.each { |t| t.join }\n :ok\n end",
"def io_loop\n while true\n # if no data is coming in, don't block the socket!\n read_incoming_data if Kernel.select([@socket], nil, nil, 0)\n\n # Check for dead socket\n @dead_socket = true if @socket.eof?\n\n sleep 0.05\n end\n end",
"def each\n until end_of_stream?\n sleep(@interval)\n output = read\n yield output unless output.empty?\n end\n end",
"def process_reading\n\t\t\t# open a thread\n\t\t\t@reading_thread = Thread.new do\n\t\t\t\tbegin\n\t\t\t\t\t# session handshake (see section 4.1)\n\t\t\t\t\t# gets the 'ClientFirstByte'\n\t\t\t\t\tf_byte = read(1)\n\t\t\t\t\t\n\t\t\t\t\t# gets the 'ClientHandcheckReceiving'\n\t\t\t\t\tc_handcheck = read(1536)\n\t\t\t\t\t\n\t\t\t\t\t# generates 'SERVER_HANDCHECK'\n\t\t\t\t\ts_handcheck = \"a\"*1536\n\t\t\t\t\t\n\t\t\t\t\t# sends 'ServerFirstByte', 'ServerHandcheckSending' and 'ClientHandcheckSending'\n\t\t\t\t\twrite ( \"\\3\" << s_handcheck << c_handcheck )\n\t\t\t\t\t\n\t\t\t\t\t# get the 'ServerHandcheckReceiving'\n\t\t\t\t\tread(1536)\n\t\t\t\t\t# handshake done\n\t\t\t\t\t\n\t\t\t\t\t# get the 'CONNECTION_PACKET'\n\t\t\t\t\t@first_packet = get_packet\n\t\t\t\t\t@connected = true\n\t\t\t\t\t# starts the writing loop\n\t\t\t\t\tprocess_writing\n\t\n\t\t\t\t\t# process the 'CONNECTION_PACKET' and notice the server\n\t\t\t\t\t@server.on_session(self)\n\t\t\t\t\t\n\t\t\t\t\t# enter the reading loop\n\t\t\t\t\twhile @connected do\n\t\t\t\t\t\t# fires an event each time the session receives a packet\n\t\t\t\t\t\ton_packet(get_packet)\n\t\t\t\t\tend\n\t\t\t\trescue Exception => obj\n\t\t\t\t\tdisconnect(obj)\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def run_loop\n end",
"def read(*args)\n io.read(*args)\n end",
"def read(i)\r\n\t\t\tres = @innerStream.read(i)\r\n\t\t\t@transferred += res.respond_to?(:length) ? res.length : 0\r\n\t\t\tnow = Time.new\r\n\t\t\tif(now - @last > 1) # don't do this oftener than once per second\r\n\t\t\t\t@printed = true\r\n\t\t\t\t$stdout.printf(\"\\rProgress: %db %db/s %s \", @transferred, (@transferred/(now - @start)).floor, \r\n\t\t\t\t\t@total > 0? (100 * @transferred/@total).floor.to_s + \"%\" : \"\" \r\n\t\t\t\t) \r\n\t\t\t\t$stdout.flush\r\n\t\t\t\t@last = now\r\n\t\t\tend\r\n\t\t\tres\r\n\t\tend",
"def read_all(&block); end",
"def run_input_thread\n Thread.new do\n read_input until stopped?\n end\n end",
"def __read(buffer_length, buffer = nil)\n @io.read_nonblock(buffer_length, buffer)\n rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR\n Minx.yield\n retry\n end",
"def background_read\n @log.debug \"Background read start\"\n begin\n while true\n dat = @socket_srv.gets\n if dat.nil?\n @log.debug \"data nil, terminate read\"\n break\n elsif dat.empty?\n @log.debug \"data empty, try to continue\"\n next\n end \n @log.debug \"<server> #{dat.chomp}\" if @server_msg_aredebugged\n parse_server_message(dat)\n end\n rescue\n @log.warn \"socket read end: (#{$!})\"\n ensure\n @log.debug \"Background read terminated\"\n @socket_srv = nil\n @model_net_data.event_cupe_raised(:ev_client_disconnected)\n end\n end",
"def run()\n #Keep track of time so the periodic things can be done\n lastTime = Time.now().to_i\n\n while (true)\n selectRes = IO.select([@@socket, $stdin], nil, nil, SELECT_TIMEOUT)\n if (selectRes)\n # Check the read ios\n selectRes[0].each{|ioStream|\n if (ioStream.eof)\n # Got an eof? Stop the thread\n stop()\n return\n end\n\n if (ioStream == @@socket)\n data = ''\n @@lock.synchronize{\n data = @@socket.gets()\n }\n\n InputHandler::queueTask(InputHandler::SERVER_INPUT, data)\n elsif (ioStream == $stdin)\n InputHandler::queueTask(InputHandler::STDIN_INPUT, $stdin.gets())\n else\n # Got some crazy io stream\n log(ERROR, \"Got bad io stream #{ioStream}\")\n end\n }\n end\n\n now = Time.now().to_i\n if (now - lastTime >= SELECT_TIMEOUT)\n #Do periodic stuff\n lastTime = now\n InputHandler::queueTask(InputHandler::PERIODIC_ACTIONS, nil)\n end\n end\n end",
"def each_remote_read\n return enum_for(:each_remote_read) unless block_given?\n begin\n loop do\n resp = remote_read\n break if resp.nil? # the last response was received\n yield resp\n end\n ensure\n set_input_stream_done\n end\n end",
"def read(n)\n end",
"def _read maxlen = DEFAULT_MAXLEN\n begin\n data = nil\n\n loop do\n data = read_from_socket maxlen\n case data\n when :wait_readable\n IO.select selector\n when NilClass\n break\n else\n begin\n @client << data\n rescue HTTP2::Error::ProtocolError => pe\n STDERR.puts \"protocol error: #{pe.message}\"\n STDERR.puts pe.backtrace.map {|l| \"\\t\" + l}\n end\n end\n end\n\n rescue IOError, Errno::EBADF\n close\n ensure\n unblock!\n end\n end",
"def read_blocking(count)\n bytes = ''\n while bytes.length < count\n bytes += read_non_blocking(count).to_s\n sleep 0.001\n end\n bytes\n end",
"def init_messaging\n @read_thread = Thread.new { read_loop }\n end",
"def read(io)\n io = BinData::IO.new(io) unless BinData::IO === io\n\n do_read(io)\n done_read\n self\n end",
"def read_action\n 10.times do\n accept_one\n end\n end",
"def read_io io\n handle_client io\n end",
"def read!(handle, offset, length, &callback)\n wait_for(read(handle, offset, length, &callback), :data)\n end",
"def start(reader)\n dispatch Event::BasicEvent.new 'startup'\n parser = Event::Parser.new\n\n while line = reader.gets\n Torkify.logger.debug { \"Read line: #{line}\" }\n events = parser.parse line\n dispatch(*events)\n end\n\n dispatch Event::BasicEvent.new 'shutdown'\n end",
"def each\n return enum_for unless block_given?\n\n while (chunk = read)\n yield chunk\n end\n end",
"def run_gets(conn)\n return if not @need_gets\n @log.debug \"run_gets starts\"\n received_count = 0\n conn.get_data_received do |msg|\n received_count += 1\n @log.debug(\"-\" * 20)\n @log.debug \"Message Number #{received_count}:\"\n #\n @log.debug(\"Type: #{msg.class}\")\n @log.debug(\"Command: #{msg.command}\")\n @log.debug(\"Header Information:\")\n msg.header.each {|k,v|\n @log.debug(\"#{k}=#{v}\")\n }\n @log.debug(\"Body:\")\n @log.debug(\"#{msg.body}\")\n end\n @log.debug \"run_gets done\"\n if received_count > 0\n #\n # We are done!\n #\n conn.disconnect()\n EventMachine::stop_event_loop() \n end\n # Otherwise, wait for message arrival.\nend",
"def read_all(&block)\n seek_at 0\n i = -1\n yield *([i += 1] + read) until eof?\n end",
"def finish_reading!\n @finished_read = true\n end",
"def run\n reader, writer = IO.pipe\n\n pid = fork do\n reader.close\n @write_block.call(writer)\n writer.close\n exit!(0)\n end\n\n writer.close\n @read_block.call(reader)\n Process.wait(pid)\n\n raise UnsuccessfulExit unless $CHILD_STATUS.success?\n end",
"def read\n \n end",
"def run\n raise Pants::Error, \"No readers added yet\" if @readers.empty?\n\n starter = proc do\n puts \"Pants v#{Pants::VERSION}\"\n puts \">> Reading from #{@readers.size} readers\"\n\n @readers.each_with_index do |reader, i|\n puts \">> reader#{i}: Starting read on: #{reader.read_object}\"\n puts \">> reader#{i}: Writing to #{reader.writers.size} writers\"\n\n reader.writers.each_with_index do |writer, j|\n puts \">> reader#{i}writer#{j}: #{writer.write_object}\"\n end\n end\n\n EM::Iterator.new(@readers).each do |reader, iter|\n reader.start\n iter.next\n end\n end\n\n if EM.reactor_running?\n log \"Joining reactor...\"\n starter.call\n else\n log \"Starting reactor...\"\n EM.run(&starter)\n end\n end",
"def read( transfer_until: )\n\t\t\tif !@pending_read\n\t\t\t\t@pending_read = true\n\t\t\t\t@transfer_until = transfer_until\n\n\t\t\t\tFiber.schedule do\n\t\t\t\t\tconnect\n\n\t\t\t\t\tbegin\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\t# 140 bytes transfer is required to trigger an error in spec \"can cancel a query\", when get_last_error doesn't wait for readability between PQgetResult calls.\n\t\t\t\t\t\t\t# TODO: Make an explicit spec for this case.\n\t\t\t\t\t\t\tread_str = @external_io.read_nonblock(140)\n\t\t\t\t\t\t\tprint_data(\"read-transfer #{read_fds}\", read_str)\n\t\t\t\t\t\t\t@internal_io.write(read_str)\n\t\t\t\t\t\trescue IO::WaitReadable, Errno::EINTR\n\t\t\t\t\t\t\t@external_io.wait_readable\n\t\t\t\t\t\t\tretry\n\t\t\t\t\t\trescue EOFError, Errno::ECONNRESET\n\t\t\t\t\t\t\tputs \"read_eof from #{read_fds}\"\n\t\t\t\t\t\t\t@internal_io.close_write\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend while @transfer_until\n\t\t\t\t\t@pending_read = false\n\t\t\t\tend\n\t\t\telsif transfer_until == :eof\n\t\t\t\t@transfer_until = transfer_until\n\t\t\tend\n\t\tend",
"def communication_loop\n while connected? && line = readline\n ui.log :printer, :received, line\n\n line.downcase!\n if line.starts_with?(*greetings)\n @can_send = 1\n elsif line.starts_with?(\"ok\")\n # TODO: Implement Q: parameter from \n # http://reprap.org/wiki/GCODE_buffer_multiline_proposal\n @can_send = 1\n # eg: Error:Line Number is not Last Line Number+1, Last Line:15\n # Resend:16\n elsif line.starts_with?(\"rs\", \"resend\")\n # TODO: extract line number from response.\n line = @lines.length - 1 # Last command. \n\n @send_queue.unshift(@lines[line])\n @can_send = 1\n end\n\n send_commands_from_queue\n end\n rescue => e\n puts \"Got exception in event communication thread!\"\n puts \"#{e.class}: #{e}\\n #{e.backtrace.join(\"\\n \")}\"\n disconnect\n raise(e)\n end",
"def each_remote_read_then_finish\n return enum_for(:each_remote_read_then_finish) unless block_given?\n loop do\n resp = remote_read\n break if resp.nil? # the last response was received\n yield resp\n end\n\n receive_and_check_status\n ensure\n set_input_stream_done\n end",
"def run\n while @current_state != @final_state do\n #if the reading head is at a new cell, create the cell\n unless @tape.has_key? @reading_head.to_s\n @tape[@reading_head.to_s] = Cell.new({value: \"e\", being_read: false})\n end\n\n #set the variable that is being read (for display purposes)\n @tape[@reading_head.to_s].being_read = true\n\n print_tape\n\n #get instructions for the current state\n state = @transition_table[@current_state]\n puts \"Current state is #{@current_state}\" if @verbose\n\n #read\n read_value = @tape[@reading_head.to_s].value.to_s\n read_value = 2 if read_value == \"e\"\n\n state = state[read_value.to_i]\n\n puts \"Just read a(n) #{read_value}\" if @verbose\n\n #write\n @tape[@reading_head.to_s].value = state[\"write\"]\n\n puts \"Just wrote a(n) #{state[\"write\"]}\" if @verbose\n\n #The value is no longer being read\n @tape[@reading_head.to_s].being_read = false\n\n #move\n if state[\"direction\"] == \"R\"\n move_right\n puts \"Just moved right\" if @verbose\n else\n move_left\n puts \"just moved left\" if @verbose\n end\n\n #update state\n @current_state = state[\"next_state\"]\n puts \"Just updated state to #{@current_state}\" if @verbose\n puts \"-------------------------------------------\" if @verbose\n end\n end",
"def run\n @event_loop.run do |data|\n @unpacker.feed_each(data) do |msg|\n debug(\"received #{msg.inspect}\")\n yield msg if block_given?\n end\n end\n rescue => e\n fatal(\"got unexpected error #{e.inspect}\")\n debug(e.backtrace.join(\"\\n\"))\n end",
"def read\n _read\n end",
"def each\n\t\t\t\t\twhile chunk = self.read\n\t\t\t\t\t\tyield chunk\n\t\t\t\t\tend\n\t\t\t\tensure\n\t\t\t\t\tself.close($!)\n\t\t\t\tend",
"def read\n end",
"def test_reader_blocking\n rd, wr = IO.pipe\n node_out = nil\n t = Thread.start do\n reader = Nokogiri::XML::Reader(rd, \"UTF-8\")\n reader.each do |node|\n node_out = node\n break\n end\n rd.close\n end\n sleep(0.1) # sleep to make sure the reader will actually block for input\n begin\n wr.puts \"<foo>\"\n wr.puts \"<bar/>\" * 10000\n wr.flush\n rescue Errno::EPIPE # rubocop:disable Lint/SuppressedException\n end\n res = t.join(1) # give the thread a moment to finish\n wr.close\n refute_nil(node_out, \"Didn't read any nodes, exclude the trivial case\")\n refute_nil(res, \"Reader blocks trying to read the entire stream\")\n end",
"def message_loop\n while (line = STDIN.gets)\n msg = IRC.parse_message(line)\n replier = Replier.new msg\n begin\n yield msg, replier\n rescue => e\n report_exception e, 'from message loop block'\n end\n end\nend",
"def read; @connection.readline end",
"def read!\n\t\t\t\t\tread\n\t\t\trescue\n\t\t\t\tnil\n\t\t\tend",
"def read\n @io.rewind\n @io.read\n end",
"def myloop\n while true\n yield\n end\nend",
"def while(&block)\n\t\t\t\t\trepeat &block\n\t\t\t\tend",
"def run\r\n while true do\r\n begin\r\n msg = $stdin.gets\r\n if msg.to_s.include? \"exit\"\r\n break\r\n else\r\n set_socket() #must do it in every run\r\n send_data(msg)\r\n com = msg.to_s.split\r\n if (com[0] == \"add\" or com[0] == \"set\" or com[0] == \"cas\" or com[0] == \"append\" or com[0] == \"prepend\") #must send value\r\n value = read_msg(com[4].to_i) #com[4] -> size of the value to read\r\n send_data(value)\r\n end\r\n retrieve_data()#prints data\r\n #while next_line_readable?(@socket)\r\n # puts @socket.gets.chop #puts every line that the socket sends as response\r\n #end\r\n end\r\n rescue => exception\r\n puts exception.message\r\n puts \"A server failure has been encountered\"\r\n puts \"Closing...\"\r\n sleep(2)\r\n break\r\n end\r\n end\r\n end",
"def run\n @running = true\n begin\n while running?\n self.ir = decode(ram.read(self.pc))\n self.pc += 1\n exec(ir[0], ir[1])\n end\n end \n end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def read; end",
"def run\n begin\n each { |d| d.process }\n end while (IO.select(self, [], [], 0) rescue nil)\n end",
"def run()\n while(true)\n cycle() ;\n sleep(2) ;\n end\n end",
"def run\n Thread.start do\n begin\n while true\n main_loop\n end\n ensure\n @protocol.close if @protocol\n end\n end\n end",
"def run\n while @running\n step\n end\n end",
"def start_read\n return self if @closed\n error = check_result ::Libuv::Ext.read_start(handle, callback(:on_allocate), callback(:on_read))\n reject(error) if error\n self\n end",
"def read\n end",
"def read\n end",
"def read\n end",
"def read\n end"
] |
[
"0.76309735",
"0.75791323",
"0.7382309",
"0.71994543",
"0.7107027",
"0.70232934",
"0.69116163",
"0.6820503",
"0.68150806",
"0.6780663",
"0.6777606",
"0.6720959",
"0.6704854",
"0.66279614",
"0.65968657",
"0.65968657",
"0.6536133",
"0.65192527",
"0.6489128",
"0.63981324",
"0.63953584",
"0.6371453",
"0.63590914",
"0.63575035",
"0.6345612",
"0.6318942",
"0.62922704",
"0.62830496",
"0.6270497",
"0.6261266",
"0.6260543",
"0.6247742",
"0.6240424",
"0.62390774",
"0.62377894",
"0.6190884",
"0.61847585",
"0.6181212",
"0.61770403",
"0.6141061",
"0.61397743",
"0.61374754",
"0.6094268",
"0.60913265",
"0.60896665",
"0.60833734",
"0.6051441",
"0.60475475",
"0.60404426",
"0.60365564",
"0.5978801",
"0.5962089",
"0.59573936",
"0.593269",
"0.5925382",
"0.59222466",
"0.5916697",
"0.59165025",
"0.5910854",
"0.59045565",
"0.58943623",
"0.5893653",
"0.58872706",
"0.5880963",
"0.58673406",
"0.58660394",
"0.58606625",
"0.58601445",
"0.58600456",
"0.5855786",
"0.5844143",
"0.58440685",
"0.583705",
"0.58276355",
"0.58193636",
"0.58180165",
"0.5814958",
"0.5814142",
"0.58083653",
"0.5801738",
"0.5798156",
"0.5796854",
"0.5782526",
"0.57825077",
"0.57825077",
"0.57825077",
"0.57825077",
"0.57825077",
"0.57825077",
"0.57825077",
"0.57657623",
"0.5760334",
"0.5747128",
"0.5746139",
"0.57291454",
"0.5728402",
"0.5728402",
"0.5728402",
"0.5728402"
] |
0.73402953
|
4
|
Waits for pipe to become readable.
|
def wait_readable(timeout = nil)
if timeout
move_on_after(timeout) do
Polyphony.backend_wait_io(self, false)
self
end
else
Polyphony.backend_wait_io(self, false)
self
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def wait_readable(io)\n wait io do |monitor|\n monitor.wait_readable\n end\n end",
"def wait_readable(io)\n wait_for_io io, @readers\n end",
"def wait_readable\n ::IO.select([@io], [], [])\n true\n rescue IOError\n false\n end",
"def wait_readable\n if evented?\n Celluloid.current_actor.wait_readable(self.to_io)\n else\n Kernel.select([self.to_io])\n end\n end",
"def wait_readable\n if evented?\n Celluloid.current_actor.wait_readable(@socket)\n else\n Kernel.select([@socket])\n end\n end",
"def read_from_pipe(pipe, timeout = 0.1, &_block)\n if self.class.readable?(pipe, timeout)\n l = pipe.readpartial(4096)\n # TODO: Log a debug for \"#{Time.now} PIPE> #{l}\"\n # Since readpartial may return a nil at EOF, skip returning that value\n yield l unless l.nil?\n end\n\n nil\n end",
"def wait_readable(timeout = nil)\n return self if @read_buffer && !@read_buffer.empty?\n\n if timeout\n move_on_after(timeout) do\n Polyphony.backend_wait_io(self, false)\n self\n end\n else\n Polyphony.backend_wait_io(self, false)\n self\n end\n end",
"def wait_for_reader\n @reader.wait if @reader\n end",
"def wait_readable_or_timeout; end",
"def process_pipe\n # We want to open this pipe in non-blocking read mode b/c\n # otherwise this process becomes hard to kill.\n f = File.new(settings['pipe'], (File::RDONLY | File::NONBLOCK))\n while true\n process_file_handle(f)\n # In non-blocking mode, an EOFError from f.readline doesn't mean\n # there's no more data to read, just that there's no more data\n # right *now*. If we sleep for a bit there might be more data\n # coming down the pipe.\n sleep settings['pipe_read_sleep']\n end\n f.close\n end",
"def sync_wait\n if IO.select([sync_read], nil, nil, 20).nil?\n # timeout reading from the sync pipe.\n send_side_channel_error(\"Error syncing processes in run lock test (timeout)\")\n exit!(1)\n else\n sync_read.getc\n end\n end",
"def read_wait(timeout: nil)\n !!IO.select([io], [], [], timeout)\n end",
"def waitForR(rpipe)\n rpipe.puts %{cat(\"\\\\n\")}\n rpipe.gets\n end",
"def wait_writable(io)\n wait io do |monitor|\n monitor.wait_writable\n end\n end",
"def wait_writable\n if evented?\n Celluloid.current_actor.wait_writable(self.to_io)\n else\n Kernel.select([], [self.to_io])\n end\n end",
"def wait(timeout: nil)\n\t\t\t\tif timeout\n\t\t\t\t\tread_ready, _, _ = IO.select([@output], [], [], timeout)\n\t\t\t\t\t\n\t\t\t\t\treturn false unless read_ready and read_ready.any?\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t@signalled or @output.read(1)\n\t\t\t\t\n\t\t\t\t# Just in case that this was split across multiple processes.\n\t\t\t\t@signalled = true\n\t\t\tend",
"def test_reader_blocking\n rd, wr = IO.pipe\n node_out = nil\n t = Thread.start do\n reader = Nokogiri::XML::Reader(rd, \"UTF-8\")\n reader.each do |node|\n node_out = node\n break\n end\n rd.close\n end\n sleep(0.1) # sleep to make sure the reader will actually block for input\n begin\n wr.puts \"<foo>\"\n wr.puts \"<bar/>\" * 10000\n wr.flush\n rescue Errno::EPIPE # rubocop:disable Lint/SuppressedException\n end\n res = t.join(1) # give the thread a moment to finish\n wr.close\n refute_nil(node_out, \"Didn't read any nodes, exclude the trivial case\")\n refute_nil(res, \"Reader blocks trying to read the entire stream\")\n end",
"def wait\n\t\t\t\twrapper = Async::IO::Generic.new(@input)\n\t\t\t\twrapper.read(1)\n\t\t\tensure\n\t\t\t\t# Remove the wrapper from the reactor.\n\t\t\t\twrapper.reactor = nil\n\t\t\tend",
"def wait(seq)\n nseq = nil\n while not nseq\n nseq,data = read_data(seq)\n select\n end\n end",
"def readchar_nonblock io, &block\n begin\n done = false\n until done do\n ch = io.read_nonblock(1)\n done = block.call(ch)\n end\n rescue IO::WaitReadable\n logger.trace \"got WaitReadable exception\"\n t1 = Time.now\n IO.select([io], [io], [io])\n logger.trace \"got event, waited #{Time.now - t1}\"\n retry\n end\n end",
"def wait_writeable(io)\n wait_for_io io, @writers\n end",
"def read\n return if @read_flag\n\n process_reading\n end",
"def read(length = nil, opts = {})\n synchronize_access {\n begin\n return fd.read_nonblock( length )\n rescue ::Errno::EAGAIN, ::Errno::EWOULDBLOCK\n return nil if self.close_resource\n # Sleep for a half a second, or until we can read again\n Rex::ThreadSafe.select( [ fd ], nil, nil, 0.5 )\n # Decrement the block size to handle full sendQs better\n retry\n rescue ::IOError, ::Errno::EPIPE\n return nil\n end\n }\n end",
"def drain_pipe_until_signaled(pipe, signal)\n output = []\n\n read_from_pipe(pipe) { |s| output << s } while signal.locked?\n\n # There's ultimately a bit of a race here\n # Read one more time after signal is received\n read_from_pipe(pipe, 0) { |s| output << s } while self.class.readable?(pipe)\n\n # String has been binary up to this point, so force UTF-8 now\n output == [] ? [] : [output.join.force_encoding(Encoding::UTF_8)]\n end",
"def read_until(timeout=@session.timeout)\n start = Time.now\n loop do\n if block_given?\n result = yield and\n return result\n end\n\n return if @eof_found\n\n # select treats 0 as infinity, so clamp it just above 0\n timeout_remaining = [timeout - (Time.now - start), 0.00001].max\n IO.select([@stream], [], [], timeout_remaining) or\n raise Timeout, \"timeout exceeded\"\n\n read_chunk\n end\n end",
"def read_from_socket maxlen\n socket.read_nonblock maxlen\n rescue IO::WaitReadable\n :wait_readable\n end",
"def consume_readable(&callback)\n synchronize do\n bool = callback.call\n if @nonblock_readable != bool\n @nonblock_readable = bool\n readable_resource.signal\n end\n end\n end",
"def read_streams\n pipe_done_reading = Mutex.new\n pipe_done_reading.lock\n # TODO: Uncomment again when implementing logging\n # start_time = Time.now\n\n stdout_reader = Thread.new { drain_pipe_until_signaled(@stdout, pipe_done_reading) }\n stderr_reader = Thread.new { drain_pipe_until_signaled(@stderr, pipe_done_reading) }\n\n pipe_reader = Thread.new(@pipe) do |pipe|\n # Read a Little Endian 32-bit integer for length of response\n expected_response_length = pipe.sysread(4).unpack1('V')\n\n next nil if expected_response_length.zero?\n\n # Reads the expected bytes as a binary string or fails\n buffer = ''\n # sysread may not return all of the requested bytes due to buffering or the\n # underlying IO system. Keep reading from the pipe until all the bytes are read.\n loop do\n buffer.concat(pipe.sysread(expected_response_length - buffer.length))\n break if buffer.length >= expected_response_length\n end\n buffer\n end\n\n # TODO: Log a debug for \"Waited #{Time.now - start_time} total seconds.\"\n\n # Block until sysread has completed or errors\n begin\n output = pipe_reader.value\n output = self.class.ps_output_to_hash!(output) unless output.nil?\n ensure\n # Signal stdout / stderr readers via Mutex so that\n # Ruby doesn't crash waiting on an invalid event.\n pipe_done_reading.unlock\n end\n\n # Given redirection on PowerShell side, this should always be empty\n stdout = stdout_reader.value\n\n [\n output,\n stdout == [] ? nil : stdout.join, # native stdout\n stderr_reader.value # native stderr\n ]\n ensure\n # Failsafe if the prior unlock was never reached / Mutex wasn't unlocked\n pipe_done_reading.unlock if pipe_done_reading.locked?\n # Wait for all non-nil threads to see mutex unlocked and finish\n [pipe_reader, stdout_reader, stderr_reader].compact.each(&:join)\n end",
"def wait_for_io_eof(timeout)\n start = Time.now\n Timeout.timeout(timeout) do\n sleep(0.1) until @process.eof?\n end\n FFMPEG.logger.debug \"IO#eof? #{@process.eof?}\"\n Time.now - start\n end",
"def readable?(timeout)\n readable, writable, errors = IO.select([@socket], nil, nil, timeout)\n return !readable.nil?\n end",
"def shell_read(length = -1, timeout = 1)\n rv = rstream.read_buffered(length, timeout)\n framework.events.on_session_output(self, rv) if rv\n return rv\n rescue ::Rex::SocketError, ::EOFError, ::IOError, ::Errno::EPIPE => e\n # print_error(\"Socket error: #{e.class}: #{e}\")\n shell_close\n raise e\n end",
"def wait_until_available\n return unless @locked\n\n @mutex.lock\n @mutex.unlock\n end",
"def wait_until_available\n return unless locked?\n\n @mutex.synchronize {}\n end",
"def monitor_pipe(name, pipe)\n @threads << Thread.new() do\n begin\n while true do\n s = pipe.readline.chomp\n call_observer(name.to_s.upcase, s)\n end\n rescue EOFError\n # do nothing\n rescue => err\n logger.error \"monitorApp(#{@id}): #{err}\"\n logger.debug \"#{err}\\n\\t#{err.backtrace.join(\"\\n\\t\")}\"\n ensure\n pipe.close\n end\n end\n end",
"def read(io, size)\n io.read_nonblock(size)\n rescue IO::WaitReadable\n IO.select([io])\n retry\n rescue EOFError\n nil\n end",
"def wait_until_done\n return if !running?\n send_eof\n\n # TODO: handle case where command doesn't exit.\n start = Time.now\n @standard_output.read_until_eof(timeout)\n @standard_error.read_until_eof(timeout - (Time.now - start))\n pid, @status = Process::waitpid2(@pid)\n @pid = nil\n end",
"def timed_read(length = nil, wait = def_read_timeout, opts = {})\n if (wait and wait > 0)\n Timeout.timeout(wait) {\n return read(length, opts)\n }\n else\n return read(length, opts)\n end\n end",
"def __read(buffer_length, buffer = nil)\n @io.read_nonblock(buffer_length, buffer)\n rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR\n Minx.yield\n retry\n end",
"def timed_read(length = 65535, timeout=def_read_timeout)\n begin\n if ((rv = ::IO.select([ fd ], nil, nil, timeout)) and\n (rv[0]) and (rv[0][0] == fd)\n )\n return read(length)\n else\n return ''\n end\n rescue Exception\n return ''\n end\n end",
"def wait\n config.ui.logger.debug { \"wait\" }\n pid, status = (Process.wait2(@pid) rescue nil)\n if !pid.nil? && !status.nil?\n data = (Marshal.load(Base64.decode64(@parent_reader.read.to_s)) rescue nil)\n config.ui.logger.debug { \"read(#{data.inspect})\" }\n !data.nil? and @result = data\n\n @parent_reader.close\n @parent_writer.close\n\n return [pid, status, data]\n end\n nil\n end",
"def notify_readable\n logdebug \"notify_readable\", :state => @state\n case @state\n when :initialized\n attempt_connection\n when :ready_to_read\n attempt_read\n when :write_needs_to_read\n attempt_write\n end\n end",
"def readable?\n return false if @socket.closed?\n r,_,_ = Kernel.select([@socket], nil, nil, @timeout) rescue nil\n return !(r.nil? or r.empty?)\n end",
"def do_on_interactive_process\n until @reader.closed? || @reader.eof?\n @reader.expect(expect_regexp, @timeout) do |match|\n yield match\n end\n end\n rescue Errno::EIO => error\n # on linux, PTY raises Errno::EIO when spawned process closed.\n @logger.debug \"PTY raises Errno::EIO, #{error.message}\"\n end",
"def wait_for_signal\n signal_read, signal_write = IO.pipe\n\n %w[INT TERM].each do |signal|\n Signal.trap(signal) do\n signal_write.puts signal\n end\n end\n\n # Adapted from Sidekiq:\n # https://github.com/mperham/sidekiq/blob/e634177/lib/sidekiq/cli.rb#L94-L97\n while io = IO.select([signal_read])\n readables = io.first\n signal = readables.first.gets.strip\n\n Fluffle.logger.info \"Received #{signal}; shutting down...\"\n\n # First stop the consumers from receiving messages\n @consumers.each &:cancel\n\n # Then wait for worker pools to finish processing their active jobs\n @handler_pool.shutdown\n unless @handler_pool.wait_for_termination(@shutdown_timeout)\n # `wait_for_termination` returns false if it didn't shut down in time,\n # so we need to kill it\n @handler_pool.kill\n end\n\n # Finally close the connection\n @channel.close\n\n return\n end\n end",
"def read_data_available?(timeout = 0)\n (rh, wh, eh) = IO::select([@io], nil, nil, timeout)\n ! rh.nil?\n end",
"def shell_read(length=-1, timeout=1)\n begin\n rv = rstream.get_once(length, timeout)\n framework.events.on_session_output(self, rv) if rv\n return rv\n rescue ::Rex::SocketError, ::EOFError, ::IOError, ::Errno::EPIPE => e\n #print_error(\"Socket error: #{e.class}: #{e}\")\n shell_close\n raise e\n end\n end",
"def wait(timeout=nil)\n return false if closed?\n return self if IO.select([self], nil, nil, timeout)\n end",
"def wait_for_data(timeout)\n return if timeout == -1\n\n ready = false\n begin\n ready = IO.select([self], nil, [self], timeout)\n rescue IOError => exception\n logger.warn \"#read Connection failure while waiting for data: #{exception.class}: #{exception.message}\"\n close if close_on_error\n raise Net::TCPClient::ConnectionFailure.new(\"#{exception.class}: #{exception.message}\", address.to_s, exception)\n rescue Exception\n # Close the connection on any other exception since the connection\n # will now be in an inconsistent state\n close if close_on_error\n raise\n end\n\n unless ready\n close if close_on_error\n logger.warn \"#read Timeout after #{timeout} seconds\"\n raise Net::TCPClient::ReadTimeout.new(\"Timedout after #{timeout} seconds trying to read from #{address}\")\n end\n end",
"def non_blocking_gets\n loop do\n result, _, _ = IO.select( [@socket], nil, nil, 0.2 )\n next unless result\n return result[0].gets\n end\n end",
"def fill\n begin\n @buffer << @io.read_nonblock(@buffer_size)\n rescue ::IO::WaitReadable\n IO.select([@io], nil, nil, @read_timeout) ? retry : (raise ::Timeout::Error)\n rescue ::IO::WaitWritable\n IO.select(nil, [@io], nil, @read_timeout) ? retry : (raise ::Timeout::Error)\n end\n end",
"def fill\n begin\n @buffer << @io.read_nonblock(@buffer_size)\n rescue ::IO::WaitReadable\n IO.select([@io], nil, nil, @read_timeout) ? retry : (raise ::Timeout::Error)\n rescue ::IO::WaitWritable\n IO.select(nil, [@io], nil, @read_timeout) ? retry : (raise ::Timeout::Error)\n end\n end",
"def ready_for_read?\n begin\n connected? && IO.select([socket], nil, nil, 0.1)\n rescue Exception\n triggered_close $!.message, :terminated\n raise\n end\n end",
"def attempt_read\n # Return false if we have nothing else to read\n return false if @native_channel.eof\n\n # Attempt to read from stdout/stderr\n @session.blocking_call { read_stream(STREAM_DATA) }\n @session.blocking_call { read_stream(STREAM_EXTENDED_DATA) }\n\n # Return true always\n true\n end",
"def start\n flags = ::Win32::Pipe::ACCESS_DUPLEX | ::Win32::Pipe::OVERLAPPED\n pipe = PipeServer.new(@pipe_name, 0, flags)\n res = true\n begin\n options = {:target => self,\n :request_handler => :request_handler,\n :request_query => :request_query,\n :pipe => pipe}\n @pipe_eventable = EM.watch(pipe, PipeServerHandler, options)\n @pipe_eventable.notify_readable = true\n rescue Exception => e\n pipe.close rescue nil\n RightScale::Log.error(\"Failed to start pipe server\", e, :trace)\n res = false\n end\n res\n end",
"def read_loop(maxlen = 8192)\n while (data = sysread(maxlen))\n yield data\n end\n end",
"def wait_writable(timeout = nil)\n if timeout\n move_on_after(timeout) do\n Polyphony.backend_wait_io(self, true)\n self\n end\n else\n Polyphony.backend_wait_io(self, true)\n self\n end\n end",
"def wait_writable(timeout = nil)\n if timeout\n move_on_after(timeout) do\n Polyphony.backend_wait_io(self, true)\n self\n end\n else\n Polyphony.backend_wait_io(self, true)\n self\n end\n end",
"def readpartial(maxlen, outbuf=nil)\n read_nonblock(maxlen, outbuf)\n rescue IO::WaitReadable\n block_until_readable\n retry\n end",
"def read_till(prompt: current_prompt, timeout: read_till_timeout, hard_timeout: read_till_hard_timeout, hard_timeout_factor: read_till_hard_timeout_factor, **_opts)\n raise Error::UndefinedMatch, 'no prompt given or default_prompt defined' unless prompt\n hard_timeout = (read_till_hard_timeout_factor * timeout) if timeout and hard_timeout == true\n hard_timeout = nil if hard_timeout == true\n\n with_prompt(prompt) do\n ::Timeout.timeout(hard_timeout, Error::ReadTillTimeout, \"#{current_prompt.inspect} didn't match on #{stdout.inspect} within #{hard_timeout}s\") do\n soft_timeout = Time.now + timeout if timeout\n until prompt_in_stdout? do\n if timeout and soft_timeout < Time.now\n raise Error::ReadTillTimeout, \"#{current_prompt.inspect} didn't match on #{stdout.inspect} within #{timeout}s\"\n end\n process\n sleep 0.01 # don't race for CPU\n end\n end\n end\n read\n end",
"def admiral_sleep(sec)\n IO.select([ SELF_PIPE[0] ], nil, nil, sec) or return\n SELF_PIPE[0].kgio_tryread(11)\n end",
"def read!(handle, offset, length, &callback)\n wait_for(read(handle, offset, length, &callback), :data)\n end",
"def verify_channel\n while ! self.channel\n raise EOFError if ! self.thread.alive?\n ::IO.select(nil, nil, nil, 0.10)\n end\n end",
"def wait_while\n while yield\n wait\n end\n end",
"def wait(io)\n # zomg ugly type conversion :(\n unless io.is_a?(::IO) or io.is_a?(OpenSSL::SSL::SSLSocket)\n if io.respond_to? :to_io\n io = io.to_io\n elsif ::IO.respond_to? :try_convert\n io = ::IO.try_convert(io)\n end\n\n raise TypeError, \"can't convert #{io.class} into IO\" unless io.is_a?(::IO)\n end\n\n unless monitor = @monitors[io]\n monitor = Monitor.new(@selector, io)\n @monitors[io] = monitor\n end\n\n yield monitor\n end",
"def wait\n\t\t\t\t@available.wait\n\t\t\tend",
"def start\n catch(:stop) do\n @poll_waiter.poll do\n read_events\n end\n end\n end",
"def start_read\n return self if @closed\n error = check_result ::Libuv::Ext.read_start(handle, callback(:on_allocate), callback(:on_read))\n reject(error) if error\n self\n end",
"def wait_while\n while yield\n\twait\n end\n end",
"def non_blocking_gets\n loop do\n result, _, _ = IO.select([@socket], nil, nil, 0.2)\n next unless result\n return result[0].gets\n end\n end",
"def wait_while\n while yield\n wait\n end\n end",
"def wait_until\n until yield\n wait\n end\n end",
"def readline\n buffer = ''\n loop do\n begin\n buffer << @input.read_nonblock(1)\n return writeline buffer if buffer[-1] == \"\\n\"\n rescue IO::EAGAINWaitReadable\n sleep 0.1\n rescue EOFError\n return done\n end\n end\n end",
"def wait_until\n until yield\n wait\n end\n end",
"def timedout_read(duration)\n begin \n timeout(duration) do\n @sock.wait_readable\n end\n rescue Celluloid::TaskTimeout\n return true\n end\n false\n end",
"def wait_writable_or_timeout; end",
"def wait(timeout = nil)\n event.wait(timeout) if timeout != 0 && incomplete?\n self\n end",
"def wait\n assert !@waited\n pid, status = Process.waitpid2(@pid)\n @waited = true\n status\n end",
"def wait\n @process.waitFor\n end",
"def wait\n done = @ractor.take\n yield(self) if block_given?\n done\n end",
"def wait\n byte = @receiver.read(1)\n raise DeadWakerError, \"can't wait on a dead waker\" unless byte == PAYLOAD\n rescue IOError, RuntimeError\n raise DeadWakerError, \"can't wait on a dead waker\"\n end",
"def read_available(length = nil)\n @input.read(length || available)\n end",
"def try_P\n begin\n @mutex.synchronize do\n @count_pout.read_nonblock 1\n end\n return true\n rescue Errno::EAGAIN\n return false\n end\n end",
"def pread_pass_through(nbytes:, offset:, buffer:, timeout:)\n invalidate!\n @io.__pread__(nbytes: nbytes, offset: offset, buffer: buffer, timeout: timeout)\n end",
"def readpartial(size, buffer = nil)\n timeout = false\n loop do\n result = @socket.read_nonblock(size, buffer, :exception => false)\n\n return :eof if result.nil?\n return result if result != :wait_readable\n\n raise TimeoutError, \"Read timed out after #{@read_timeout} seconds\" if timeout\n\n # marking the socket for timeout. Why is this not being raised immediately?\n # it seems there is some race-condition on the network level between calling\n # #read_nonblock and #wait_readable, in which #read_nonblock signalizes waiting\n # for reads, and when waiting for x seconds, it returns nil suddenly without completing\n # the x seconds. In a normal case this would be a timeout on wait/read, but it can\n # also mean that the socket has been closed by the server. Therefore we \"mark\" the\n # socket for timeout and try to read more bytes. If it returns :eof, it's all good, no\n # timeout. Else, the first timeout was a proper timeout.\n # This hack has to be done because io/wait#wait_readable doesn't provide a value for when\n # the socket is closed by the server, and HTTP::Parser doesn't provide the limit for the chunks.\n timeout = true unless @socket.to_io.wait_readable(@read_timeout)\n end\n end",
"def read\n @io.write(?r) # Read command\n sleep(0.1) until !@io.eof?\n\n @io.readbyte\n end",
"def read_available(length = nil)\n input.read(length || available)\n end",
"def wait_until\n until yield\n\twait\n end\n end",
"def wait_for(seq,timeout=1)\n begin\n ::Timeout.timeout(timeout) do\n wait(seq)\n end\n rescue ::Timeout::Error\n end\n end",
"def monitor_for(options = {})\n # Loop and wait till event is detected.\n lcnt = 0\n scount = 0\n while true\n while line = @rchan.gets\n if yield(line, lcnt)\n return true\n end\n lcnt += 1\n end\n sleep 1\n if fptimer = options[:filepos]\n scount += 1\n if scount >= fptimer\n send \"get\"\n scount = 0\n end\n end\n end\n false\n end",
"def wait(timeout = nil)\n @mu.synchronize do\n next @pstate unless @pstate.nil?\n\n @cond.wait(@mu, timeout)\n @pstate\n end\n end",
"def read maxlen = DEFAULT_MAXLEN\n main = Thread.current\n @reader = Thread.new do\n @read_gate.block!\n begin\n _read maxlen\n rescue => e\n main.raise e\n end\n end\n end",
"def read_blocking(count)\n bytes = ''\n while bytes.length < count\n bytes += read_non_blocking(count).to_s\n sleep 0.001\n end\n bytes\n end",
"def timed_read( length=65535, timeout=def_read_timeout )\n\t\tresult = ''\n\n\t\tbegin\n\t\t\tTimeout.timeout( timeout ) {\n\t\t\t\twhile( true )\n\t\t\t\t\tif( @datagrams.empty? )\n\t\t\t\t\t\tRex::ThreadSafe.sleep( 0.2 )\n\t\t\t\t\t\tnext\n\t\t\t\t\tend\n\t\t\t\t\tresult = self.read( length )\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t}\n\t\trescue Timeout::Error\n\t\t\tresult = ''\n\t\tend\n\n\t\treturn result\n\tend",
"def _read maxlen = DEFAULT_MAXLEN\n begin\n data = nil\n\n loop do\n data = read_from_socket maxlen\n case data\n when :wait_readable\n IO.select selector\n when NilClass\n break\n else\n begin\n @client << data\n rescue HTTP2::Error::ProtocolError => pe\n STDERR.puts \"protocol error: #{pe.message}\"\n STDERR.puts pe.backtrace.map {|l| \"\\t\" + l}\n end\n end\n end\n\n rescue IOError, Errno::EBADF\n close\n ensure\n unblock!\n end\n end",
"def status_pipe\n r_pipe, w_pipe = ::IO.pipe\n\n w_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)\n\n [r_pipe, w_pipe]\n end",
"def wait(term=nil)\n\t\tbuffer = []\n\t\tlog_incr \"Waiting for response\"\n\t\t\n\t\twhile true do\n\t\t\tbuf = read(term)\n\t\t\tbuffer.push(buf)\n\t\t\t\n\t\t\t# some errors contain useful error codes,\n\t\t\t# so raise a proper error with a description\n\t\t\tif m = buf.match(/^\\+(CM[ES]) ERROR: (\\d+)$/)\n\t\t\t\tlog_then_decr \"!! Raising Gsm::Error #{$1} #{$2}\"\n\t\t\t\traise Error.new(*m.captures)\n\t\t\tend\n\t\t\n\t\t\t# some errors are not so useful :|\n\t\t\tif buf == \"ERROR\"\n\t\t\t\tlog_then_decr \"!! Raising Gsm::Error\"\n\t\t\t\traise Error\n\t\t\tend\n\t\t\n\t\t\t# most commands return OK upon success, except\n\t\t\t# for those which prompt for more data (CMGS)\n\t\t\tif (buf==\"OK\") or (buf==\">\")\n\t\t\t\tlog_decr \"=#{buffer.inspect}\"\n\t\t\t\treturn buffer\n\t\t\tend\n\t\t\n\t\t\t# some commands DO NOT respond with OK,\n\t\t\t# even when they're successful, so check\n\t\t\t# for those exceptions manually\n\t\t\tif m = buf.match(/^\\+CPIN: (.+)$/)\n\t\t\t\tlog_decr \"=#{buffer.inspect}\"\n\t\t\t\treturn buffer\n\t\t\tend\n\t\tend\n\tend",
"def next_line_readable?(socket)\n readfds, writefds, exceptfds = select([socket], nil, nil, 0.1)\n readfds \n end",
"def next_line_readable?(socket)\n readfds, writefds, exceptfds = select([socket], nil, nil, 0.1)\n readfds \n end",
"def command(command)\n IO.pipe do |read_io, write_io|\n pid = Process.spawn(command, :in => \"/dev/tty\", :out => write_io)\n Process.wait(pid)\n raise \"Command failed: #{command.inspect}\" unless $?.success?\n write_io.close\n read_io.read\n end\n end",
"def read_stdin\n open_connection\n $stdin.each_line { |l| call_write(process_line(l.strip), false) }\n close_connection\n rescue SystemExit, Interrupt\n puts 'ctrl-c. Exiting.'\n wf.close\n exit 0\n end"
] |
[
"0.7701357",
"0.75098085",
"0.7406789",
"0.7372095",
"0.7165727",
"0.6778609",
"0.67585456",
"0.66534966",
"0.6579845",
"0.644817",
"0.6432459",
"0.6431126",
"0.6200218",
"0.6163383",
"0.61552364",
"0.60915303",
"0.60728115",
"0.6064045",
"0.6020764",
"0.5953828",
"0.59264684",
"0.5899176",
"0.58688366",
"0.57263476",
"0.5725228",
"0.56994915",
"0.56531924",
"0.5641755",
"0.56358004",
"0.5634481",
"0.56277466",
"0.5562066",
"0.55599755",
"0.5537772",
"0.55367845",
"0.5520755",
"0.5520317",
"0.54830104",
"0.5466915",
"0.5461872",
"0.54468787",
"0.54286194",
"0.54060274",
"0.539968",
"0.53897023",
"0.5379861",
"0.53748304",
"0.53740263",
"0.5365588",
"0.5352886",
"0.5352886",
"0.5345339",
"0.53357637",
"0.5311583",
"0.528427",
"0.52841794",
"0.52841794",
"0.52792597",
"0.5277441",
"0.52749234",
"0.5260454",
"0.5251874",
"0.52477276",
"0.52454394",
"0.524539",
"0.52422386",
"0.5241048",
"0.5227474",
"0.52193594",
"0.5216267",
"0.52045155",
"0.5204118",
"0.5185658",
"0.5176448",
"0.5173008",
"0.5166185",
"0.51600593",
"0.5125359",
"0.50914687",
"0.5084796",
"0.5071035",
"0.5071014",
"0.5067913",
"0.50623304",
"0.505882",
"0.505124",
"0.5049302",
"0.5046479",
"0.5046314",
"0.5046046",
"0.504428",
"0.50434476",
"0.5039411",
"0.5036417",
"0.5026223",
"0.5013838",
"0.5012106",
"0.5012106",
"0.5010416",
"0.50049007"
] |
0.678638
|
5
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.