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
Same as parse, but removes switches destructively. Nonoption arguments remain in +argv+.
def parse!(argv = default_argv, into: nil) if ENV.include?('POSIXLY_CORRECT') order!(argv, into: into) else permute!(argv, into: into) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse!(argv=ARGV)\n argv = Shellwords.shellwords(argv) if argv.kind_of?(String)\n\n registry.each do |option|\n if assign_defaults && option.respond_to?(:assign_default)\n option.assign_default(config)\n end\n end\n\n args = []\n while !argv.empty?\n arg = argv.shift\n\n ...
[ "0.751653", "0.74333805", "0.7245755", "0.71549284", "0.7139481", "0.71022", "0.7030276", "0.6927415", "0.6918313", "0.69045794", "0.68068457", "0.67831933", "0.67828834", "0.6777425", "0.6754134", "0.672355", "0.6721309", "0.67183137", "0.6700075", "0.660499", "0.66008794", ...
0.6222116
42
Wrapper method for getopts.rb. params = ARGV.getopts("ab:", "foo", "bar:", "zot:Z;zot option") params["a"] = true a params["b"] = "1" b1 params["foo"] = "1" foo params["bar"] = "x" bar x params["zot"] = "z" zot Z
def getopts(*args) argv = Array === args.first ? args.shift : default_argv single_options, *long_options = *args result = {} single_options.scan(/(.)(:)?/) do |opt, val| if val result[opt] = nil define("-#{opt} VAL") else result[opt] = false define("-#{opt}"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getopt opt, hash, default = nil\n keys = opt.respond_to?('each') ? opt : [opt]\n keys.each do |key|\n return hash[key] if hash.has_key? key\n key = \"#{ key }\"\n return hash[key] if hash.has_key? key\n key = key.intern\n return hash[key] if hash.has_key? key\n end\n return...
[ "0.6676291", "0.66298413", "0.6414089", "0.64138854", "0.638759", "0.6335752", "0.6288161", "0.6258516", "0.62449837", "0.62435794", "0.623418", "0.6154629", "0.61481524", "0.6147901", "0.6147876", "0.6137944", "0.60984474", "0.6073474", "0.6071354", "0.60497797", "0.60497797...
0.70423025
0
Completes shortened long style option switch and returns pair of canonical switch and switch descriptor OptionParser::Switch. +typ+:: Searching table. +opt+:: Searching key. +icase+:: Search case insensitive if true. +pat+:: Optional pattern for completion.
def complete(typ, opt, icase = false, *pat) # :nodoc: if pat.empty? search(typ, opt) {|sw| return [sw, opt]} # exact match or... end ambiguous = catch(:ambiguous) { visit(:complete, typ, opt, icase, *pat) {|o, *sw| return sw} } exc = ambiguous ? AmbiguousOption : InvalidOption raise ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_switch(opts, block = nil)\n short, long, nolong, style, pattern, conv, not_pattern, not_conv, not_style = [], [], []\n ldesc, sdesc, desc, arg = [], [], []\n default_style = Switch::NoArgument\n default_pattern = nil\n klass = nil\n q, a = nil\n has_arg = false\n\n opts.each do |o|...
[ "0.55609876", "0.5510767", "0.5509886", "0.542947", "0.53476846", "0.53328186", "0.5272271", "0.52307534", "0.5202989", "0.51624274", "0.5137935", "0.5129821", "0.5128212", "0.51022255", "0.50918645", "0.5068705", "0.5052963", "0.50065815", "0.49242082", "0.48897457", "0.4886...
0.6456555
0
Loads options from file names as +filename+. Does nothing when the file is not present. Returns whether successfully loaded. +filename+ defaults to basename of the program without suffix in a directory ~/.options, then the basename with '.options' suffix under XDG and Haiku standard places.
def load(filename = nil) unless filename basename = File.basename($0, '.*') return true if load(File.expand_path(basename, '~/.options')) rescue nil basename << ".options" return [ # XDG ENV['XDG_CONFIG_HOME'], '~/.config', *ENV['XDG_CONFIG_DIRS']&.split(File:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(filename)\n run \"load #{OptArg.quote(filename)}\"\n nil\n end", "def load(filename)\n\t\t\traise ArgumentError.new unless filename\n\n\t\t\toptions = YAML::load(IO.read(filename))\n\t\t\tif(options)\n\t\t\t\tself.configure(options)\n\t\t\tend\n\t\tend", "def load_from_file filename\n fnm ...
[ "0.6218516", "0.6195196", "0.58840376", "0.56723547", "0.56194276", "0.5599081", "0.5444047", "0.5426183", "0.5408027", "0.54078394", "0.52471626", "0.52313673", "0.5186956", "0.51639146", "0.51284593", "0.5119041", "0.5117115", "0.511607", "0.5092046", "0.5090767", "0.508545...
0.78831553
0
Parses environment variable +env+ or its uppercase with splitting like a shell. +env+ defaults to the basename of the program.
def environment(env = File.basename($0, '.*')) env = ENV[env] || ENV[env.upcase] or return require 'shellwords' parse(*Shellwords.shellwords(env)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(env); env; end", "def parse_value(value)\n if value.include?('$env')\n fetch_environment_variable(value)\n else\n value\n end\n end", "def parse envfile\n path = Pathname.new envfile\n update case path.extname\n when '.pl', '.perl' th...
[ "0.6786925", "0.61393636", "0.61368906", "0.5974364", "0.5894615", "0.5892998", "0.5890102", "0.58080816", "0.5790187", "0.5769671", "0.57656485", "0.5754641", "0.57510203", "0.5736807", "0.56981593", "0.56699747", "0.5661017", "0.56565493", "0.5647486", "0.559767", "0.559278...
0.7786997
0
Pushes back erred argument(s) to +argv+.
def recover(argv) argv[0, 0] = @args argv end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse argv\n parse_args argv do |argv, remaining_args, arg|\n remaining_args << arg\n end\n end", "def parse_argv(argv)\n filtered_argv = argv.dup\n fix_flag = !!filtered_argv.delete(\"--fix\")\n [filtered_argv, fix_flag]\n end", "def empty_argv\n ARGV.length.times{...
[ "0.6925846", "0.63638705", "0.6352455", "0.62748057", "0.6230409", "0.6150947", "0.61313516", "0.61313516", "0.61207604", "0.60999423", "0.6089191", "0.5997583", "0.59785193", "0.59750634", "0.5918367", "0.59120506", "0.58846563", "0.58667487", "0.58368164", "0.5833433", "0.5...
0.7721275
0
Returns error reason. Override this for I18N.
def reason @reason || self.class::Reason end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_string\n # This method should be overridden\n end", "def error_message\n error.message\n end", "def error_message\n self[:error_message]\n end", "def error_message(e)\n fail e\n end", "def error_message\n @response.reason_phrase\n end", "def error...
[ "0.77662235", "0.7641049", "0.7553903", "0.75092304", "0.74909246", "0.74128157", "0.74027973", "0.7274143", "0.72655153", "0.72068226", "0.7077923", "0.69328505", "0.6915105", "0.6883174", "0.6877715", "0.68567115", "0.68236417", "0.6815045", "0.6810386", "0.6808076", "0.680...
0.0
-1
Default stringizing method to emit standard error message.
def message "#{reason}: #{args.join(' ')}#{additional[@arg0] if additional}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_string\n # This method should be overridden\n end", "def error(string); end", "def error(string); end", "def error msg\n puts \"#{self.class} error: #{msg}\"\n end", "def error_msg\n ERROR_MSG[upcase_class_sym]\n end", "def error_message(msg)\n STDERR.puts msg\n end"...
[ "0.75990915", "0.7016242", "0.7016242", "0.6755934", "0.6749126", "0.67140675", "0.66042846", "0.6598663", "0.65916353", "0.653014", "0.6516384", "0.6476828", "0.6469571", "0.64386624", "0.6433043", "0.6415915", "0.6408712", "0.64054084", "0.64035237", "0.6402567", "0.6400968...
0.0
-1
Parses +self+ destructively in order and returns +self+ containing the rest arguments left unparsed.
def order!(&blk) options.order!(self, &blk) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(args)\n rest = args.clone\n rest.delete_at(0)\n return args[0], rest\n end", "def parse(*args, &block)\n options = ParamsHash.new(args.extract_options!)\n normalize! options\n\n if args.size.zero? # Arguments are inside the parameters hash\n parse_hash(options)\...
[ "0.6402822", "0.5755839", "0.56893945", "0.56778246", "0.56245786", "0.546799", "0.53575003", "0.53399944", "0.53119963", "0.52921116", "0.5269492", "0.5240386", "0.52109635", "0.5207168", "0.5191662", "0.51786256", "0.5167004", "0.51510197", "0.51378894", "0.5131379", "0.511...
0.0
-1
Parses +self+ destructively in permutation mode and returns +self+ containing the rest arguments left unparsed.
def permute!() options.permute!(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse!() options.parse!(self) end", "def permutation(length = size, &block)\n return enum_for(:permutation, length) if not block_given?\n if length == 0\n yield EmptyList\n elsif length == 1\n each { |obj| yield Cons.new(obj, EmptyList) }\n elsif not empty?\n if lengt...
[ "0.54724807", "0.5245947", "0.5156036", "0.51125264", "0.51104295", "0.50676125", "0.5003365", "0.49922934", "0.49726915", "0.4964913", "0.4964592", "0.4944442", "0.49052712", "0.48825756", "0.48782533", "0.48518455", "0.48501295", "0.48280427", "0.4827518", "0.48118022", "0....
0.56920624
0
Parses +self+ destructively and returns +self+ containing the rest arguments left unparsed.
def parse!() options.parse!(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(args)\n rest = args.clone\n rest.delete_at(0)\n return args[0], rest\n end", "def parse!\n raise NotImplementedError, \"this class is intended to be a top class, not a useful parser\"\n end", "def parse(params) new(params).parse end", "def parse(*args, &block)\n options...
[ "0.63102263", "0.59766847", "0.5943735", "0.5776534", "0.5710856", "0.56482065", "0.5495527", "0.5476988", "0.53972375", "0.5375297", "0.53571194", "0.5334666", "0.5332088", "0.5327553", "0.53050715", "0.5300075", "0.5287645", "0.5285267", "0.525879", "0.5230065", "0.52273935...
0.5898263
3
Skips the current file or directory, restarting the loop with the next entry. If the current file is a directory, that directory will not be recursively entered. Meaningful only within the block associated with Find::find. See the +Find+ module documentation for an example.
def prune throw :prune end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _skip_next\n @index += 1\n\n self\n end", "def skip\n @skip = true\n end", "def skip\n end", "def skip\n end", "def skip!\n @skip ||= true\n end", "def skip(name)\n puts pretty_console_block(\"DIR ALREADY EXISTS; SKIPPING: #{name}\", :yellow)\n end", "...
[ "0.62877464", "0.61647594", "0.59729266", "0.59729266", "0.5962011", "0.59328353", "0.5922986", "0.5903545", "0.5629473", "0.5535084", "0.5525504", "0.5368416", "0.53614265", "0.5356788", "0.534783", "0.5338255", "0.52613807", "0.5255619", "0.5238425", "0.52239436", "0.520654...
0.0
-1
Return the number of seconds the specified time zone differs from UTC. Numeric time zones that include minutes, such as 10:00 or +1330 will work, as will simpler houronly time zones like 10 or +13. Textual time zones listed in ZoneOffset are also supported. If the time zone does not match any of the above, +zone_offset...
def zone_offset(zone, year=self.now.year) off = nil zone = zone.upcase if /\A([+-])(\d\d)(:?)(\d\d)(?:\3(\d\d))?\z/ =~ zone off = ($1 == '-' ? -1 : 1) * (($2.to_i * 60 + $4.to_i) * 60 + $5.to_i) elsif zone.match?(/\A[+-]\d\d\z/) off = zone.to_i * 3600 elsif ZoneOffset.inclu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zone_offset_hours\n zone = ActiveSupport::TimeZone.new(self.time_zone || \"UTC\")\n (zone.utc_offset / 60) / 60\n end", "def tz\n # logger.debug(\"CHC: customer tz called from #{caller.join(\"\\n\")}\")\n if tzb = time_zone_binary\n tzb.to_r / MINS_PER_DAY\n else\n nil\n ...
[ "0.58454907", "0.5754296", "0.57294285", "0.5691968", "0.56908816", "0.5504384", "0.54935616", "0.54814625", "0.54525197", "0.5448478", "0.543611", "0.5382855", "0.5382855", "0.5244128", "0.52332234", "0.5230662", "0.51669186", "0.5141454", "0.51241815", "0.5086632", "0.50552...
0.63999885
0
class "Wed, 05 Oct 2011 22:26:12 0400" You must require 'time' to use this method.
def rfc2822 strftime('%a, %d %b %Y %T ') << (utc? ? '-0000' : strftime('%z')) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_class; end", "def time_class\n puts \"BEGIN: #{__method__}\"\n # There are two time classes:\n # time in the core library\n # time in the standard library\n # require 'time' loads the standard library version which adds useful methods\n # such as parse and strptime\n require 'time'\n\n # Time.ne...
[ "0.73627216", "0.71279603", "0.69459456", "0.66690105", "0.66386926", "0.6576414", "0.6559422", "0.6559422", "0.6559422", "0.6559422", "0.6559422", "0.6559422", "0.6559422", "0.6559422", "0.6559422", "0.655536", "0.6475464", "0.6473607", "0.6473037", "0.6419413", "0.64019144"...
0.0
-1
Returns a string which represents the time as RFC 1123 date of HTTPdate defined by RFC 2616: dayofweek, DD monthname CCYY hh:mm:ss GMT Note that the result is always UTC (GMT). require 'time' t = Time.now t.httpdate => "Thu, 06 Oct 2011 02:26:12 GMT" You must require 'time' to use this method.
def httpdate getutc.strftime('%a, %d %b %Y %T GMT') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_date\n tp = Time.now.gmtime.to_s.split\n \"#{tp[0]}, #{tp[2]} #{tp[1]} #{tp[5]} #{tp[3]} GMT\"\n end", "def httpdate\n return \"#{self.day_name[0, 3]}, #{@t_day} #{self.month_name[0, 3]} #{@t_year} #{\"%02d\" % @t_hour}:#{\"%02d\" % @t_min}:#{\"%02d\" % @t_sec} GMT\"\n end", "def rfc1123dat...
[ "0.80195236", "0.79092747", "0.7463001", "0.7454923", "0.7252712", "0.68696547", "0.6802883", "0.67482907", "0.66780514", "0.65020555", "0.64966834", "0.6444225", "0.6385547", "0.63574046", "0.63463646", "0.6332134", "0.62134755", "0.62118274", "0.61519164", "0.6139661", "0.6...
0.7555609
2
Returns a string which represents the time as a dateTime defined by XML Schema: CCYYMMDDThh:mm:ssTZD CCYYMMDDThh:mm:ss.sssTZD where TZD is Z or [+]hh:mm. If self is a UTC time, Z is used as TZD. [+]hh:mm is used otherwise. +fractional_digits+ specifies a number of digits to use for fractional seconds. Its default value...
def xmlschema(fraction_digits=0) fraction_digits = fraction_digits.to_i s = strftime("%FT%T") if fraction_digits > 0 s << strftime(".%#{fraction_digits}N") end s << (utc? ? 'Z' : strftime("%:z")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_iso_8601\n htime = self.decompose_as_time\n iso = \"P\"\n htime[:days] && iso += \"#{htime[:days]}D\"\n iso += \"T\"\n htime[:hours] && iso += \"#{htime[:hours]}H\"\n htime[:minutes] && iso += \"#{htime[:minutes]}M\"\n htime[:seconds] && iso += \"#{htime[:seconds]}S\"\n return i...
[ "0.6831859", "0.6741933", "0.67172015", "0.6640138", "0.65570974", "0.6540716", "0.6454242", "0.64344054", "0.64230436", "0.63996005", "0.63996005", "0.6371853", "0.63220644", "0.619213", "0.6189706", "0.61720437", "0.61636907", "0.6154033", "0.61243975", "0.6098903", "0.6086...
0.0
-1
Compiles an ERB template into Ruby code. Returns an array of the code and encoding like ["code", Encoding].
def compile(s) enc = s.encoding raise ArgumentError, "#{enc} is not ASCII compatible" if enc.dummy? s = s.b # see String#b magic_comment = detect_magic_comment(s, enc) out = Buffer.new(self, *magic_comment) self.content = +'' scanner = make_scanner(s) scanner.scan do |to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_template_into_ruby_code(template)\n #ERB.new(template, nil, @@erb_trim_mode).src\n return _convert_template(template)\n end", "def compile(template_source)\n # if RUBY_VERSION >= '1.9'\n # template_source=template_source.sub(/\\A#coding:.*\\n/, '') \n # end\n # ::ERB.new(\"<%...
[ "0.7383237", "0.70483184", "0.63087505", "0.6122683", "0.6098005", "0.6067769", "0.6034186", "0.60240597", "0.6023772", "0.5982528", "0.59548664", "0.5862211", "0.58480936", "0.5843957", "0.5782488", "0.57044804", "0.5661033", "0.5651478", "0.55993074", "0.5588052", "0.555879...
0.54096097
39
Construct a new compiler using the trim_mode. See ERB::new for available trim modes.
def initialize(trim_mode) @percent, @trim_mode = prepare_trim_mode(trim_mode) @put_cmd = 'print' @insert_cmd = @put_cmd @pre_cmd = [] @post_cmd = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_compiler(trim_mode)\n ERB::Compiler.new(trim_mode)\n end", "def mkcompiler source=''\n VishCompiler.new source\nend", "def compile!\n @directives.freeze unless @directives.frozen?\n\n @result ||= compile.freeze\n end", "def compile_to_c\n \"\"\n end", "def compile template\n ...
[ "0.829398", "0.59218204", "0.56017953", "0.5446053", "0.54417044", "0.5274105", "0.523954", "0.517439", "0.5134185", "0.5134185", "0.5123159", "0.50780165", "0.50760233", "0.5028568", "0.50181895", "0.49657172", "0.49619314", "0.49351308", "0.4932213", "0.49297455", "0.491147...
0.5363901
5
Creates a new compiler for ERB. See ERB::Compiler.new for details
def make_compiler(trim_mode) ERB::Compiler.new(trim_mode) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile(template_source)\n # if RUBY_VERSION >= '1.9'\n # template_source=template_source.sub(/\\A#coding:.*\\n/, '') \n # end\n # ::ERB.new(\"<% __in_erb_template=true %>#{template_source}\", nil, \"-\", '@output_buffer')\n\n Erubis::Eruby.new(template_source.utf_or_die!)\n \n end"...
[ "0.7513646", "0.6739932", "0.6686884", "0.64661425", "0.6177359", "0.6149217", "0.6123137", "0.6051923", "0.60382164", "0.6025728", "0.60178554", "0.5968117", "0.5962552", "0.5944193", "0.5944193", "0.5921926", "0.58986515", "0.5822394", "0.58032817", "0.58021635", "0.5797114...
0.8396333
0
Sets optional filename and line number that will be used in ERB code evaluation and error reporting. See also filename= and lineno= erb = ERB.new('') erb.render undefined local variable or method `some_x' from (erb):1 erb.location = ['file.erb', 3] All subsequent error reporting would use new location erb.render undefi...
def location=((filename, lineno)) @filename = filename @lineno = lineno if lineno end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lineno= integer\n #This is a stub, used for indexing\n end", "def set_line(line_number)\n @line_number = line_number\n end", "def line_number\n raise \"This loader doesn't support line_number\"\n end", "def initialize(file, line_number, &block)\n @file = file\n @line_numbe...
[ "0.6253298", "0.61157", "0.6053122", "0.603184", "0.6029857", "0.592822", "0.5871038", "0.5862419", "0.5861707", "0.5861707", "0.5794178", "0.5794178", "0.5794178", "0.5751751", "0.57465106", "0.5743826", "0.5727532", "0.57115465", "0.57115465", "0.57115465", "0.57115465", ...
0.7101459
0
Can be used to set _eoutvar_ as described in ERB::new. It's probably easier to just use the constructor though, since calling this method requires the setup of an ERB _compiler_ object.
def set_eoutvar(compiler, eoutvar = '_erbout') compiler.put_cmd = "#{eoutvar}.<<" compiler.insert_cmd = "#{eoutvar}.<<" compiler.pre_cmd = ["#{eoutvar} = +''"] compiler.post_cmd = [eoutvar] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _erbout=(input)\n @_erbout = input\n end", "def eoutvar=(eoutvar)\n # ignore\n end", "def set_eoutvar compiler, io_variable\n compiler.put_cmd = \"#{io_variable}.write\"\n compiler.insert_cmd = \"#{io_variable}.write\"\n compiler.pre_cmd = []\n compiler.post_cmd = []...
[ "0.6932281", "0.65887284", "0.64703804", "0.60149986", "0.60149986", "0.60149986", "0.56361884", "0.56361884", "0.5585257", "0.55798995", "0.5403127", "0.5400695", "0.5374122", "0.5374122", "0.5324011", "0.5296825", "0.5196551", "0.5105647", "0.5067624", "0.5060976", "0.50545...
0.8055668
0
Generate results and print them. (see ERBresult)
def run(b=new_toplevel) print self.result(b) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def results\r\n print_books\r\n print_toys\r\n print_classes\r\n end", "def print_results\n Report::print(@result_set)\n end", "def print_result(result)\n puts result.solutions\n result.fragments.each do |fragment|\n puts fragment\n end\n end", "def display_results\...
[ "0.7380357", "0.7085622", "0.6946072", "0.6927966", "0.6666455", "0.66294944", "0.6627371", "0.65266496", "0.65213895", "0.64999205", "0.64969456", "0.6451493", "0.6432485", "0.6432485", "0.6432485", "0.6394726", "0.6365052", "0.63549674", "0.6329629", "0.63129866", "0.630891...
0.0
-1
Executes the generated ERB code to produce a completed template, returning the results of that code. (See ERB::new for details on how this process can be affected by _safe_level_.) _b_ accepts a Binding object which is used to set the context of code evaluation.
def result(b=new_toplevel) unless @_init.equal?(self.class.singleton_class) raise ArgumentError, "not initialized" end eval(@src, b, (@filename || '(erb)'), @lineno) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute _binding = get_binding\n foo = 'local_erbout'\n erb = ERB.new compile, nil, nil, 'local_erbout'\n erb.result _binding\n end", "def thru_erb aBinding = Kernel.binding\n ERB.new(self).result(aBinding)\n end", "def _erb_buffer( the_binding )\n eval(\"_erbout\", the_binding...
[ "0.66148883", "0.63187295", "0.60346633", "0.60346633", "0.59809333", "0.5959172", "0.5945006", "0.5913318", "0.58442646", "0.58442646", "0.57966626", "0.5718852", "0.56427896", "0.56281126", "0.56130105", "0.5543727", "0.54768026", "0.5473536", "0.5436829", "0.5414206", "0.5...
0.6444401
1
Render a template on a new toplevel binding with local variables specified by a Hash object.
def result_with_hash(hash) b = new_toplevel(hash.keys) hash.each_pair do |key, value| b.local_variable_set(key, value) end result(b) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_template_with_locals(abs_name, locals = {})\r\n template = File.read(File.join( abs_name) )\r\n ERB.new(template, nil, \"-\").result(OpenStruct.new(locals).send(:binding))\r\nend", "def render(hash)\n render_with_binding(Env.new(hash, self).get_binding)\n end", "def render(scope, locals = ...
[ "0.67275095", "0.65913165", "0.6370167", "0.63375705", "0.6335299", "0.6332433", "0.6321617", "0.6316862", "0.62735575", "0.62392867", "0.62311465", "0.6211217", "0.61155003", "0.61002165", "0.60941434", "0.60916597", "0.6077009", "0.60568845", "0.6018464", "0.6010358", "0.60...
0.0
-1
Returns a new binding each time near TOPLEVEL_BINDING for runs that do not specify a binding.
def new_toplevel(vars = nil) b = TOPLEVEL_BINDING if vars vars = vars.select {|v| b.local_variable_defined?(v)} unless vars.empty? return b.eval("tap {|;#{vars.join(',')}| break binding}") end end b.dup end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_binding\n return binding()\n end", "def get_binding\n return binding()\n end", "def get_binding\n return binding()\n end", "def get_binding\r\n binding()\r\n end", "def get_binding\n @binding ||= binding\n end", "def get_binding\n return binding()\n end", ...
[ "0.6756185", "0.67536896", "0.67536896", "0.6743345", "0.6742707", "0.67049986", "0.67049986", "0.67000955", "0.6675815", "0.66679347", "0.66679347", "0.66679347", "0.66251546", "0.66251546", "0.6545125", "0.6545125", "0.6545125", "0.6545125", "0.6545125", "0.6545125", "0.654...
0.53851014
89
Define _methodname_ as instance method of _mod_ from compiled Ruby source. example: filename = 'example.rhtml' 'arg1' and 'arg2' are used in example.rhtml erb = ERB.new(File.read(filename)) erb.def_method(MyClass, 'render(arg1, arg2)', filename) print MyClass.new.render('foo', 123)
def def_method(mod, methodname, fname='(ERB)') src = self.src.sub(/^(?!#|$)/) {"def #{methodname}\n"} << "\nend\n" mod.module_eval do eval(src, binding, fname, -1) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def def_method(object, method_name, filename=nil)\n\t\t\t\tm = object.is_a?(Module) ? :module_eval : :instance_eval\n\t\t\t\tobject.__send__(m, \"def #{method_name}; #{@src}; end\", filename || @filename || '(eruby)')\n\t\t\t\t#erb.rb: src = self.src.sub(/^(?!#|$)/) {\"def #{methodname}\\n\"} << \"\\nend\\n\" #Thi...
[ "0.74895006", "0.6679102", "0.6436445", "0.6385952", "0.637193", "0.63585263", "0.6182029", "0.6127031", "0.610618", "0.6076055", "0.6057213", "0.60086745", "0.6007743", "0.6004422", "0.59930307", "0.59674746", "0.592258", "0.5920425", "0.59059453", "0.5860289", "0.58428496",...
0.7543274
0
Create unnamed module, define _methodname_ as instance method of it, and return it. example: filename = 'example.rhtml' 'arg1' and 'arg2' are used in example.rhtml erb = ERB.new(File.read(filename)) erb.filename = filename MyModule = erb.def_module('render(arg1, arg2)') class MyClass include MyModule end
def def_module(methodname='erb') mod = Module.new def_method(mod, methodname, @filename || '(ERB)') mod end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def def_method(mod, methodname, fname='(ERB)')\n src = self.src.sub(/^(?!#|$)/) {\"def #{methodname}\\n\"} << \"\\nend\\n\"\n mod.module_eval do\n eval(src, binding, fname, -1)\n end\n end", "def def_method(object, method_name, filename=nil)\n\t\t\t\tm = object.is_a?(Module) ? :module_eval : :inst...
[ "0.722944", "0.6663259", "0.6219347", "0.61565894", "0.6136905", "0.61054415", "0.6016721", "0.5996979", "0.5982731", "0.5982073", "0.5978761", "0.59472334", "0.5942898", "0.5942898", "0.5925268", "0.5925268", "0.5917955", "0.5903924", "0.5870049", "0.5820539", "0.5791641", ...
0.789236
0
Define unnamed class which has _methodname_ as instance method, and return it. example: class MyClass_ def initialize(arg1, arg2)
def def_class(superklass=Object, methodname='result') cls = Class.new(superklass) def_method(cls, methodname, @filename || '(ERB)') cls end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_def(name, &blk)\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, ...
[ "0.6944779", "0.6934301", "0.6934301", "0.6926659", "0.6926659", "0.69212914", "0.69116235", "0.68998325", "0.6850939", "0.6811758", "0.6794139", "0.67939013", "0.67939013", "0.67939013", "0.67939013", "0.67939013", "0.67939013", "0.67594135", "0.6743631", "0.674308", "0.6702...
0.63222694
32
A utility method for escaping HTML tag characters in _s_. require "erb" include ERB::Util puts html_escape("is a > 0 & a < 10?") _Generates_ is a &gt; 0 &amp; a &lt; 10?
def html_escape(s) CGI.escapeHTML(s.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_escape(s)\n s.to_s.gsub(/&/, \"&amp;\").gsub(/\\\"/, \"&quot;\").gsub(/>/, \"&gt;\").gsub(/</, \"&lt;\")\n end", "def html_escape(s)\n s = s.to_s\n if s.html_safe?\n s\n else\n s.to_s.gsub(/&/, \"&amp;\").gsub(/\\\"/, \"&quot;\").gsub(/>/, \"&gt;\").gsub(/</, \"&lt;\").h...
[ "0.8249601", "0.80647695", "0.7969033", "0.7727192", "0.7621913", "0.7618261", "0.7602838", "0.7479259", "0.7426793", "0.73949414", "0.73753756", "0.7260989", "0.7248294", "0.7185849", "0.7155205", "0.7121019", "0.7121019", "0.7002374", "0.69945765", "0.69683766", "0.6948912"...
0.7611464
6
A utility method for encoding the String _s_ as a URL. require "erb" include ERB::Util puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide") _Generates_ Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
def url_encode(s) s.to_s.b.gsub(/[^a-zA-Z0-9_\-.~]/n) { |m| sprintf("%%%02X", m.unpack1("C")) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_encode(s)\n s.to_s.b.gsub(/[^a-zA-Z0-9_\\-.]/n) { |m|\n sprintf(\"%%%02X\", m.unpack(\"C\")[0])\n }\n end", "def url_encode(string) \r\n encoded_string = ''\r\n string.each_char do |char|\r\n char = (\"%%%02X\" % char.ord) if char.match(/[A-Za-z0-9]/) == nil\r\n ...
[ "0.7961184", "0.7566714", "0.7566714", "0.75646317", "0.7430787", "0.7289542", "0.708165", "0.6974303", "0.69395185", "0.68875843", "0.67828596", "0.67765355", "0.6671567", "0.6658511", "0.6646043", "0.6629647", "0.6577558", "0.65659684", "0.6549913", "0.65313715", "0.6530638...
0.80334055
0
define _methodname_ as instance method of current module, using ERB object or eRuby file
def def_erb_method(methodname, erb_or_fname) if erb_or_fname.kind_of? String fname = erb_or_fname erb = ERB.new(File.read(fname)) erb.def_method(self, methodname, fname) else erb = erb_or_fname erb.def_method(self, methodname, erb.filename || '(ERB)') end en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def def_method(object, method_name, filename=nil)\n\t\t\t\tm = object.is_a?(Module) ? :module_eval : :instance_eval\n\t\t\t\tobject.__send__(m, \"def #{method_name}; #{@src}; end\", filename || @filename || '(eruby)')\n\t\t\t\t#erb.rb: src = self.src.sub(/^(?!#|$)/) {\"def #{methodname}\\n\"} << \"\\nend\\n\" #Thi...
[ "0.7151157", "0.70752853", "0.6940441", "0.66943043", "0.6388017", "0.63741094", "0.6313083", "0.6282258", "0.6251159", "0.6204735", "0.6202992", "0.6096849", "0.6074681", "0.6074226", "0.60593355", "0.603294", "0.60284466", "0.59722376", "0.5909879", "0.58930683", "0.5883503...
0.70629907
2
Create a new CGI::Cookie object. :callseq: Cookie.new(name_string,value) Cookie.new(options_hash) +name_string+:: The name of the cookie; in this form, there is no domain or expiration. The path is gleaned from the +SCRIPT_NAME+ environment variable, and secure is false. value:: value or list of values of the cookie +o...
def initialize(name = "", *value) @domain = nil @expires = nil if name.kind_of?(String) @name = name @path = (%r|\A(.*/)| =~ ENV["SCRIPT_NAME"] ? $1 : "") @secure = false @httponly = false return super(value) end options = name unless options....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize( name, value, options={} )\n\t\toptions ||= {}\n\t\t# self.log.debug \"New cookie: %p = %p (%p)\" % [ name, value, options ]\n\n\t\t@name = name\n\t\t@value = value\n\n\t\t@domain = nil\n\t\t@path = nil\n\t\t@secure = false\n\t\t@httponly = false\n\t\t@max_age = nil\n\t\t@expires = ...
[ "0.802181", "0.7495746", "0.68280315", "0.67845005", "0.6684771", "0.6610947", "0.6596272", "0.6529733", "0.64026445", "0.6277", "0.62711537", "0.6251475", "0.6221343", "0.6211791", "0.61639243", "0.6042315", "0.5990072", "0.59520525", "0.5950367", "0.58960205", "0.58888906",...
0.6050491
15
Returns the value or list of values for this cookie.
def value self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def [](name)\n @cookies[name.to_s].value.first if @cookies[name.to_s] && @cookies[name.to_s].respond_to?(:value)\n end", "def [](name)\n name = name.to_s\n @cookies.each do |cookie|\n return cookie.value if cookie.name == name\n end\n nil\n end", "def cookie_va...
[ "0.69168466", "0.6869825", "0.6647633", "0.66315454", "0.65867126", "0.6440206", "0.64001435", "0.63834614", "0.63426775", "0.6334806", "0.63240373", "0.62678605", "0.6216437", "0.6216437", "0.6216437", "0.6204336", "0.6176919", "0.6176919", "0.6163213", "0.6161334", "0.61609...
0.5757176
67
Replaces the value of this cookie with a new value or list of values.
def value=(val) replace(Array(val)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def []=(name, value)\n if value.is_a?(Hash)\n value = value.collect {|key, val| \"#{key}=#{val.gsub('=', '^^')}\" }.join('|')\n end\n options = { :value => value }\n\n options[:path] = \"/\" unless options.has_key?(:path)\n super(name.to_s, options[:value])\n @controller.respon...
[ "0.6354556", "0.63366926", "0.6259929", "0.61927414", "0.61927414", "0.6156407", "0.6015712", "0.59448093", "0.5840992", "0.5790867", "0.5778789", "0.5759763", "0.5697713", "0.5680441", "0.56501496", "0.56279755", "0.56273323", "0.5624849", "0.56189626", "0.56189626", "0.5612...
0.6056156
6
Set whether the Cookie is a secure cookie or not. +val+ must be a boolean.
def secure=(val) @secure = val if val == true or val == false @secure end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def secure=(secure)\n\t\t# {{{\n\t\tunless secure == true || secure == false\n\t\t\traise TypeError, \"The secure field of a cookie must be true or false\", caller\n\t\tend\n\t\t@secure = secure\n\t\t# }}}\n\tend", "def secure(flag)\n @secure = (flag == true)\n end", "def secure= value\n @secure=v...
[ "0.8185261", "0.7390669", "0.6675288", "0.64855474", "0.6434443", "0.63581806", "0.6321277", "0.61706555", "0.6146447", "0.6058886", "0.59992045", "0.5968114", "0.58963305", "0.58501035", "0.5801945", "0.57935625", "0.57629424", "0.57629424", "0.5727194", "0.5670256", "0.5647...
0.842373
0
Set whether the Cookie is a httponly cookie or not. +val+ must be a boolean.
def httponly=(val) @httponly = !!val end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def secure=(val)\n @secure = val if val == true or val == false\n @secure\n end", "def secure=(secure)\n\t\t# {{{\n\t\tunless secure == true || secure == false\n\t\t\traise TypeError, \"The secure field of a cookie must be true or false\", caller\n\t\tend\n\t\t@secure = secure\n\t\t# }}}\n\tend", ...
[ "0.6497962", "0.6159892", "0.6061666", "0.5971495", "0.58423495", "0.5785945", "0.5767894", "0.56817794", "0.5654102", "0.55480516", "0.55368257", "0.55110294", "0.54696864", "0.5423542", "0.5364524", "0.5364413", "0.5300802", "0.5227713", "0.52268976", "0.52021074", "0.51673...
0.77794486
0
Convert the Cookie to its string representation.
def to_s val = collect{|v| CGI.escape(v) }.join("&") buf = "#{@name}=#{val}".dup buf << "; domain=#{@domain}" if @domain buf << "; path=#{@path}" if @path buf << "; expires=#{CGI.rfc1123_date(@expires)}" if @expires buf << "; secure" if @secure buf << "; HttpOnly...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookie_string\n cookies.collect { |name, val| \"#{name}=#{val}\" }.join(', ')\n end", "def cookie_header_to_s(cookies)\n str = \"\"\n cookies.each {|cookie|\n str += cookie.split(';')[0] + ';'\n }\n return str\n end", "def cookie_header_to_s(cookies)\n str = \"\"\n cookies.each ...
[ "0.74313897", "0.7031362", "0.7031362", "0.6964949", "0.6788984", "0.66287094", "0.6424832", "0.63132524", "0.6303549", "0.6269116", "0.62607557", "0.62607557", "0.6234819", "0.6098932", "0.59976435", "0.59218574", "0.5875138", "0.5776988", "0.57541096", "0.57140774", "0.5711...
0.56065196
26
A summary of cookie string.
def inspect "#<CGI::Cookie: #{self.to_s.inspect}>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def details\n \"This cookie has #{@sugar}g of sugar and #{@flour}g of flour.\"\n end", "def cookie_string\n cookies.collect { |name, val| \"#{name}=#{val}\" }.join(', ')\n end", "def cookie_value\n \"#{@name}=#{Scanner.quote(@value.to_s)}\"\n end", "def details\n \"This Oreo Cookie has...
[ "0.68584734", "0.6794239", "0.6705295", "0.6579574", "0.6307592", "0.62017953", "0.6136269", "0.6101851", "0.6101851", "0.60128695", "0.60128695", "0.5980573", "0.5974618", "0.59462094", "0.59264165", "0.5926338", "0.592462", "0.59239054", "0.5906849", "0.5896438", "0.5881615...
0.68565625
1
:startdoc: Synonym for ENV.
def env_table ENV end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env_doc\n env = Environment.new\n env.faas? ? env.to_h : nil\n end", "def env_config; end", "def env_config; end", "def env_config; end", "def env_config; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end...
[ "0.6783973", "0.5945597", "0.5945597", "0.5945597", "0.5945597", "0.591327", "0.591327", "0.591327", "0.591327", "0.591327", "0.591327", "0.591327", "0.591327", "0.591327", "0.591327", "0.591327", "0.591327", "0.591327", "0.591327", "0.591327", "0.591327", "0.591327", "0....
0.4948756
78
Print an argument or list of arguments to the default output stream cgi = CGI.new cgi.print default: cgi.print == $DEFAULT_OUTPUT.print
def print(*options) stdoutput.print(*options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print(*args)\n s = \"\"\n args.each { |arg| s << arg.to_s }\n do_write(s)\n nil\n end", "def print( *args )\n @output.print(*args)\n end", "def print(*args)\n args.each do |a|\n io << a\n end\n end", "def print(*args,**opts)\n stdout = o...
[ "0.65428954", "0.65107137", "0.6238257", "0.6074103", "0.6039606", "0.6023251", "0.6023251", "0.59720767", "0.5924527", "0.59195393", "0.5900206", "0.57951844", "0.57802707", "0.57769305", "0.5738435", "0.57328117", "0.57066697", "0.5677297", "0.5677297", "0.5677297", "0.5677...
0.6343366
2
Get the raw cookies as a string.
def raw_cookie env_table["HTTP_COOKIE"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookie_string\n cookies.collect { |name, val| \"#{name}=#{val}\" }.join(', ')\n end", "def raw_cookie\n @raw_cookie ||= controller.cookies[\"fbs_#{self.facebook_api_key}\"]\n end", "def cookie_header_to_s(cookies)\n str = \"\"\n cookies.each {|cookie|\n str += cookie.split(';')[0...
[ "0.7309453", "0.69780445", "0.6956709", "0.6956709", "0.6575112", "0.6575112", "0.65339303", "0.6165811", "0.61543703", "0.608009", "0.60545325", "0.6020619", "0.6019566", "0.59288055", "0.58731115", "0.58005446", "0.57908434", "0.57015646", "0.5678372", "0.5677528", "0.56711...
0.7356465
0
Get the raw RFC2965 cookies as a string.
def raw_cookie2 env_table["HTTP_COOKIE2"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_cookie\n env_table[\"HTTP_COOKIE\"]\n end", "def cookie_header_to_s(cookies)\n str = \"\"\n cookies.each {|cookie|\n str += cookie.split(';')[0] + ';'\n }\n return str\n end", "def cookie_header_to_s(cookies)\n str = \"\"\n cookies.each {|cookie|\n str += cookie.spl...
[ "0.71738625", "0.68604064", "0.68604064", "0.68382144", "0.66842765", "0.65215683", "0.65215683", "0.6187844", "0.60572636", "0.60280424", "0.59769535", "0.5965953", "0.5956996", "0.59229857", "0.5898181", "0.56902623", "0.5555988", "0.5555352", "0.55507964", "0.5489217", "0....
0.66181564
5
Set all the parameters.
def params=(hash) @params.clear @params.update(hash) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(params = {})\n self.params.merge!(params)\n end", "def set_params(params)\n @params = params\n end", "def set_all **kwargs\n kwargs.each { |name, value|\n set_var(name.to_s, value)\n }\n end", "def set(params = {})\n params.each do |k,v|\n self.clas...
[ "0.749913", "0.70992297", "0.70523095", "0.69754386", "0.6858434", "0.66991603", "0.66991603", "0.66336536", "0.6620256", "0.6615852", "0.6501299", "0.64913434", "0.6459276", "0.6453237", "0.6415091", "0.6399326", "0.63758796", "0.63492334", "0.63335276", "0.6328197", "0.6292...
0.0
-1
Parses multipart form elements according to Returns a hash of multipart form parameters with bodies of type StringIO or Tempfile depending on whether the multipart form element exceeds 10 KB params[name => body]
def read_multipart(boundary, content_length) ## read first boundary stdin = stdinput first_line = "--#{boundary}#{EOL}" content_length -= first_line.bytesize status = stdin.read(first_line.bytesize) raise EOFError.new("no content body") unless status raise EOFError.new("bad co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multipart_request_body( body )\n request_body = []\n body.files.each do |k, v|\n request_body.push :content => v.content,\n 'Content-Type' => v.content_type,\n 'Content-Disposition' => \"form-data; name=\\\"#{k}\\\"; filename=\\\"#{v....
[ "0.66871583", "0.65156645", "0.64215314", "0.63051367", "0.6282678", "0.6243648", "0.621248", "0.6137382", "0.6100265", "0.6093242", "0.59763426", "0.592909", "0.58662665", "0.58616054", "0.5815501", "0.57536143", "0.5739362", "0.5719999", "0.57159895", "0.5697721", "0.564218...
0.63131255
3
offline mode. read name=value pairs on standard input.
def read_from_cmdline require "shellwords" string = unless ARGV.empty? ARGV.join(' ') else if STDIN.tty? STDERR.print( %|(offline mode: enter name=value pairs on standard input)\n| ) end array = readlines rescue nil if not array....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_from_cmdline\n require \"shellwords.rb\"\n words = Shellwords.shellwords(\n if not ARGV.empty?\n ARGV.join(' ')\n else\n STDERR.print \"(offline mode: enter name=value pairs on standard input)\\n\" if STDIN.tty?\n readlines.join(...
[ "0.6641626", "0.5891284", "0.5681103", "0.5437479", "0.53467816", "0.5344785", "0.5288161", "0.5244986", "0.5169377", "0.50879675", "0.5078587", "0.5077073", "0.50572914", "0.5048511", "0.5045034", "0.5045034", "0.5045034", "0.5045034", "0.5045034", "0.5045034", "0.5045034", ...
0.6944499
0
A wrapper class to use a StringIO object as the body and switch to a TempFile when the passed threshold is passed. Initialize the data from the query. Handles multipart forms (in particular, forms that involve file uploads).
def initialize_query() if ("POST" == env_table['REQUEST_METHOD']) and %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?| =~ env_table['CONTENT_TYPE'] current_max_multipart_length = @max_multipart_length.respond_to?(:call) ? @max_multipart_length.call : @max_multipart_length raise Standar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_stream\n\t\t\t\t# Form input field name for the file path must be set to file.\n\t\t\t\t# Any other field name will not be picked up by the upload server.\n\t\t\t\tname = 'file'\n\t\t\t\tcontent_length = File.size(@data_path)\n\t\t\t\tcontent_type = mime_type_for(@data_path)\n\n\t\t\t\t@stream = Tempfile...
[ "0.58618665", "0.58068216", "0.55828226", "0.55362785", "0.55018026", "0.5473751", "0.5292129", "0.52921045", "0.51992226", "0.5083689", "0.50679046", "0.50559324", "0.5045811", "0.50426835", "0.5031759", "0.5027053", "0.5001779", "0.4934453", "0.4907478", "0.4901367", "0.489...
0.6202523
0
Returns whether the form contained multipart/formdata
def multipart? @multipart end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multipart?\n http.headers[\"content-type\"] =~ /^multipart/\n end", "def multipart?\n\t true\n\tend", "def multipart?\n has_content_type? ? !!(main_type =~ /^multipart$/i) : false\n end", "def multipart?\n false\n end", "def multipart?\n message.multipart?\n e...
[ "0.80963", "0.779439", "0.7783617", "0.7733707", "0.75874746", "0.7510171", "0.73989934", "0.705255", "0.6932479", "0.69128203", "0.68784183", "0.6760717", "0.6618014", "0.6561295", "0.64662695", "0.63710475", "0.6289094", "0.6187988", "0.6173284", "0.6173284", "0.6173284", ...
0.7702367
4
Get the value for the parameter with a given key. If the parameter has multiple values, only the first will be retrieved; use params to get the array of values.
def [](key) params = @params[key] return '' unless params value = params[0] if @multipart if value return value elsif defined? StringIO StringIO.new("".b) else Tempfile.new("CGI",encoding: Encoding::ASCII_8BIT) end else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getvalue(key)\r\n return @@params[key] if (key != nil)\r\n return nil\r\n end", "def value_for(key)\n return '' unless self.param_values && self.param_values[key]\n self.param_values[key]\n end", "def param_value(key)\n @obj[key]\n end", "def get(key)\n ...
[ "0.80062246", "0.78477263", "0.7731282", "0.759642", "0.75852036", "0.75434065", "0.75434065", "0.7539177", "0.7497613", "0.7497613", "0.7430963", "0.7418772", "0.7392385", "0.7381369", "0.73541063", "0.71385527", "0.70962167", "0.7043983", "0.7033346", "0.70191866", "0.70149...
0.0
-1
Return all query parameter names as an array of String.
def keys(*args) @params.keys(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameter_names\n @parameters.map { |info| info.name }.join(', ')\n end", "def pnames\n @params.keys\n end", "def parameters_as_array\n @parameters.to_s.split(' ')\n end", "def get_reqd_param_names\n rparams = []\n i = 1\n while !params[:rparams_.to_s + \"#{i}\"].nil?...
[ "0.7455908", "0.7075505", "0.70450956", "0.69892985", "0.6914982", "0.6814753", "0.66892135", "0.6624321", "0.6342819", "0.6326613", "0.6322115", "0.6318928", "0.6226365", "0.6182524", "0.61770546", "0.6175571", "0.61601716", "0.6144554", "0.6090019", "0.6037255", "0.5967752"...
0.0
-1
Returns true if a given query string parameter exists.
def has_key?(*args) @params.has_key?(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def param_exists?(param_name)\n params[param_name] and not params[param_name].empty? ? true : false\n end", "def exists?(param_name)\n return !@params[param_name].nil?\n end", "def has_param(name) \n return (@params.has_key? name)\n end", "def has_param?(key)\n params[key]...
[ "0.83258086", "0.77794397", "0.7549106", "0.74478406", "0.7307101", "0.7130766", "0.7077073", "0.7053737", "0.7037911", "0.7027659", "0.6995117", "0.699339", "0.6794517", "0.67627925", "0.66998166", "0.664792", "0.6647419", "0.664444", "0.6641933", "0.66291976", "0.65981126",...
0.6631355
19
Generate code for an empty element. O EMPTY
def nOE_element(element, attributes = {}) attributes={attributes=>nil} if attributes.kind_of?(String) s = "<#{element.upcase}".dup attributes.each do|name, value| next unless value s << " " s << CGI.escapeHTML(name.to_s) if value != true s << '="' s ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_element(*args, &block)\n __empty_element__(*args, &block)\n end", "def empty_element(*args, &block)\n __empty_element__(*args, &block)\n end", "def empty()\n \n end", "def empty!; end", "def ___\n Blank.()\n end", "def empty\n each { |x| x.inner_html =...
[ "0.7370079", "0.7370079", "0.6876241", "0.656264", "0.6529559", "0.6528176", "0.6367981", "0.6268717", "0.6240342", "0.6240342", "0.6240342", "0.6240342", "0.6240342", "0.6240342", "0.6240342", "0.6240342", "0.6240342", "0.6240342", "0.6240342", "0.6240342", "0.6230788", "0...
0.0
-1
Generate code for an element for which the end (and possibly the start) tag is optional. O O or O
def nO_element(element, attributes = {}) s = nOE_element(element, attributes) if block_given? s << yield.to_s s << "</#{element.upcase}>" end s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def element_init\n extend TagMaker\n methods = \"\"\n # - -\n for element in %w[ A TT I B U STRIKE BIG SMALL SUB SUP EM STRONG\n DFN CODE SAMP KBD VAR CITE FONT ADDRESS DIV center MAP\n APPLET PRE XMP LISTING DL OL UL DIR MENU SELECT table TITLE\n STYLE SCRIPT H1 H2 H...
[ "0.586459", "0.5854519", "0.5761808", "0.5620773", "0.56186974", "0.5502027", "0.5502027", "0.5474398", "0.54058456", "0.5392004", "0.5392004", "0.53403264", "0.5306479", "0.52873194", "0.5267601", "0.5228064", "0.5210975", "0.51959306", "0.5184021", "0.5181024", "0.5137337",...
0.5977435
0
Generate a Document Base URI element as a String. +href+ can either by a string, giving the base URL for the HREF attribute, or it can be a has of the element's attributes. The passedin noargument block is ignored. base(" => "<BASE HREF=\"
def base(href = "") # :yield: attributes = if href.kind_of?(String) { "HREF" => href } else href end super(attributes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_href\n parsed.search('base').first.attributes['href'].value rescue nil\n end", "def base_href\n parsed_search('base').first.attributes['href'].value rescue nil\n end", "def base\n @base = if doc\n href = doc.search('//head/base/@href')\n URI(href.to_s) unless hre...
[ "0.72643787", "0.72265214", "0.71575606", "0.707444", "0.7006683", "0.694146", "0.6910097", "0.67799217", "0.67578155", "0.6752138", "0.67321956", "0.67115694", "0.6646596", "0.6565939", "0.65603864", "0.6483247", "0.6409316", "0.63664705", "0.6356823", "0.62394375", "0.62279...
0.72456306
1
Generate a Checkbox Input element as a string. The attributes of the element can be specified as three arguments, +name+, +value+, and +checked+. +checked+ is a boolean value; if true, the CHECKED attribute will be included in the element. Alternatively, the attributes can be specified as a hash. checkbox("name") = che...
def checkbox(name = "", value = nil, checked = nil) attributes = if name.kind_of?(String) { "TYPE" => "checkbox", "NAME" => name, "VALUE" => value, "CHECKED" => checked } else name["TYPE"] = "checkbox" name ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_checkbox\n @attr[:type] = :checkbox\n @attr[:checked] = :checked if @opts[:checked]\n if @attr[:name] && !@opts[:no_hidden]\n attr = {:type=>:hidden}\n unless attr[:value] = @opts[:hidden_value]\n attr[:value] = CHECKBOX_MAP[@attr[:value]]\n end\n attr...
[ "0.7323248", "0.7228705", "0.7228705", "0.70131487", "0.68676025", "0.6814274", "0.6594769", "0.6519699", "0.6519699", "0.6513654", "0.6397639", "0.638394", "0.62257737", "0.6194321", "0.6017218", "0.60146827", "0.59980714", "0.5941149", "0.5901145", "0.5893334", "0.58710486"...
0.8072612
0
Generate a sequence of checkbox elements, as a String. The checkboxes will all have the same +name+ attribute. Each checkbox is followed by a label. There will be one checkbox for each value. Each value can be specified as a String, which will be used both as the value of the VALUE attribute and as the label for that c...
def checkbox_group(name = "", *values) if name.kind_of?(Hash) values = name["VALUES"] name = name["NAME"] end values.collect{|value| if value.kind_of?(String) checkbox(name, value) + value else if value[-1] == true || value[-1] == false c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_checkbox_group(name, options = [])\n field = field_content(name)\n field_name = prop(field, 'name') || name\n group = {}\n unless field.nil?\n group[:question] = prop(field, 'question')\n group[:name] = field_name\n group[:checkboxes] = options.presence || options_group(prop(fi...
[ "0.7089998", "0.6233252", "0.60971934", "0.60971934", "0.6021644", "0.60025364", "0.60025364", "0.5775891", "0.574008", "0.57211554", "0.5668478", "0.5639797", "0.5596264", "0.55638766", "0.543695", "0.54254824", "0.54132855", "0.5345845", "0.5335888", "0.53032607", "0.529864...
0.80067456
0
Generate an File Upload Input element as a string. The attributes of the element can be specified as three arguments, +name+, +size+, and +maxlength+. +maxlength+ is the maximum length of the file's _name_, not of the file's _contents_. Alternatively, the attributes can be specified as a hash. See multipart_form() for ...
def file_field(name = "", size = 20, maxlength = nil) attributes = if name.kind_of?(String) { "TYPE" => "file", "NAME" => name, "SIZE" => size.to_s } else name["TYPE"] = "file" name end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_field_tag(name, options = T.unsafe(nil)); end", "def file_field_tag_v2(title, name, options = {})\n\t\t<<-html\n\t\t\t<div class=\"input-field file-field\">\n\t\t\t\t<div class=\"btn\">\n\t\t\t\t\t<span>#{title}</span>\n\t\t\t\t\t#{if options[:form_builder] then options[:form_builder].file_field(name) e...
[ "0.6554374", "0.6546485", "0.65224385", "0.64491487", "0.6303109", "0.62546486", "0.6155036", "0.609605", "0.6056608", "0.59976864", "0.59976864", "0.59759486", "0.59244716", "0.5811862", "0.5789277", "0.5768187", "0.5691422", "0.55364037", "0.54496336", "0.5390727", "0.53634...
0.8001322
0
Generate a Hidden Input element as a string. The attributes of the element can be specified as two arguments, +name+ and +value+. Alternatively, the attributes can be specified as a hash. hidden("name") hidden("name", "value") hidden("NAME" => "name", "VALUE" => "reset", "ID" => "foo")
def hidden(name = "", value = nil) attributes = if name.kind_of?(String) { "TYPE" => "hidden", "NAME" => name, "VALUE" => value } else name["TYPE"] = "hidden" name end input(attributes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hidden(name, value)\n# opts = options.collect { |k, v| %[#{k}=\"#{v}\"] }.join(' ')\n %[<input type=\"hidden\" name=\"#{name}\" value=\"#{value}\" />]\n end", "def input_hidden(name, value = nil, args = {})\n args = args.merge(:type => :hidden, :name => name)\n \n if !value a...
[ "0.79536647", "0.72654754", "0.72423446", "0.6993274", "0.69085175", "0.6891279", "0.6888906", "0.68865716", "0.66319066", "0.6482999", "0.6482999", "0.6437255", "0.63778365", "0.6368103", "0.6268356", "0.62581056", "0.6156249", "0.612359", "0.60329986", "0.5990972", "0.59408...
0.8126692
0
Generate an Image Button Input element as a string. +src+ is the URL of the image to use for the button. +name+ is the input name. +alt+ is the alternative text for the image. Alternatively, the attributes can be specified as a hash. image_button("url") image_button("url", "name", "string") image_button("SRC" => "url",...
def image_button(src = "", name = nil, alt = nil) attributes = if src.kind_of?(String) { "TYPE" => "image", "SRC" => src, "NAME" => name, "ALT" => alt } else src["TYPE"] = "image" src["SRC"] ||= "" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xf_image_tag (src, attrs = {})\n attrs = attrs.symbolize_keys()\n content = \"\"\n caption = attrs.delete(:caption)\n unless caption.nil?\n content += typeWithAttrs(\"caption\", caption, nil, xhtml2prefix)\n end\n width = attrs.de...
[ "0.619511", "0.59897447", "0.59310037", "0.5922439", "0.59032834", "0.58742887", "0.5838179", "0.5772639", "0.57436895", "0.5736142", "0.5697239", "0.5695586", "0.56899196", "0.56778723", "0.56175464", "0.55939597", "0.55729824", "0.55585456", "0.5557887", "0.55450684", "0.55...
0.87621325
0
Generate an Image element as a string. +src+ is the URL of the image. +alt+ is the alternative text for the image. +width+ is the width of the image, and +height+ is its height. Alternatively, the attributes can be specified as a hash. img("src", "alt", 100, 50) img("SRC" => "src", "ALT" => "alt", "WIDTH" => 100, "HEIG...
def img(src = "", alt = "", width = nil, height = nil) attributes = if src.kind_of?(String) { "SRC" => src, "ALT" => alt } else src end attributes["WIDTH"] = width.to_s if width attributes["HEIGHT"] = height.to_s if height...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xf_image_tag (src, attrs = {})\n attrs = attrs.symbolize_keys()\n content = \"\"\n caption = attrs.delete(:caption)\n unless caption.nil?\n content += typeWithAttrs(\"caption\", caption, nil, xhtml2prefix)\n end\n width = attrs.de...
[ "0.762136", "0.73805237", "0.7358765", "0.72589713", "0.7213051", "0.7213051", "0.72035867", "0.6935407", "0.67954", "0.67529464", "0.6736561", "0.67344046", "0.67262244", "0.6699926", "0.663617", "0.66294605", "0.6599927", "0.6561907", "0.6547832", "0.6473628", "0.6472326", ...
0.77851534
0
Generate a Password Input element as a string. +name+ is the name of the input field. +value+ is its default value. +size+ is the size of the input field display. +maxlength+ is the maximum length of the inputted password. Alternatively, attributes can be specified as a hash. password_field("name") password_field("name...
def password_field(name = "", value = nil, size = 40, maxlength = nil) attributes = if name.kind_of?(String) { "TYPE" => "password", "NAME" => name, "VALUE" => value, "SIZE" => size.to_s } else name["TYPE"] = "password" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password_field_tag(name = T.unsafe(nil), value = T.unsafe(nil), options = T.unsafe(nil)); end", "def password_field_tag(name = \"password\", value = nil, options = {})\n text_field_tag(name, value, options.merge(type: :password))\n end", "def input_password(label, name, args = {})\n # ...
[ "0.7205547", "0.7162336", "0.7113221", "0.70827746", "0.70596194", "0.6944796", "0.68500525", "0.67871183", "0.6732901", "0.6732622", "0.6670234", "0.6660285", "0.663388", "0.6553759", "0.6484317", "0.6474116", "0.6468676", "0.64670205", "0.6454711", "0.63929486", "0.6329219"...
0.881931
0
Generate a Select element as a string. +name+ is the name of the element. The +values+ are the options that can be selected from the Select menu. Each value can be a String or a one, two, or threeelement Array. If a String or a oneelement Array, this is both the value of that option and the text displayed for it. If a ...
def popup_menu(name = "", *values) if name.kind_of?(Hash) values = name["VALUES"] size = name["SIZE"].to_s if name["SIZE"] multiple = name["MULTIPLE"] name = name["NAME"] else size = nil multiple = nil end select({ "NAME" => name, "SIZE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apphelp_menu( values, method, options = {} )\n form = options.delete( :form )\n vals = values.dup # Don't alter passed-by-reference array from caller\n vals.unshift( options.delete( :include_blank ) ) if ( options.has_key?( :include_blank ) )\n\n if ( form.nil? )\n return select_tag(\n ...
[ "0.5985814", "0.58232677", "0.5810535", "0.5439666", "0.54309744", "0.54221845", "0.53610134", "0.52694035", "0.5268078", "0.5201427", "0.5017423", "0.4956491", "0.49512833", "0.49046066", "0.48942077", "0.48384628", "0.48171672", "0.48109457", "0.48104078", "0.48023072", "0....
0.8197121
0
Generates a radiobutton Input element. +name+ is the name of the input field. +value+ is the value of the field if checked. +checked+ specifies whether the field starts off checked. Alternatively, the attributes can be specified as a hash. radio_button("name", "value") radio_button("name", "value", true) radio_button("...
def radio_button(name = "", value = nil, checked = nil) attributes = if name.kind_of?(String) { "TYPE" => "radio", "NAME" => name, "VALUE" => value, "CHECKED" => checked } else name["TYPE"] = "radio" name ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def radio_button_tag(name, value, checked = T.unsafe(nil), options = T.unsafe(nil)); end", "def format_radio\n @attr[:checked] = :checked if @opts[:checked]\n @attr[:type] = :radio\n tag(:input)\n end", "def input_radio(name, options = [])\n field = field_content(name)\n input = {}\n ...
[ "0.7177225", "0.6881859", "0.6750287", "0.64764094", "0.6331701", "0.63217276", "0.6296717", "0.62560445", "0.61614287", "0.61113703", "0.60042155", "0.6002448", "0.59284914", "0.59172106", "0.58314705", "0.57881314", "0.56821346", "0.5662277", "0.56493413", "0.5620226", "0.5...
0.8720713
0
Generate a sequence of radio button Input elements, as a String. This works the same as checkbox_group(). However, it is not valid to have more than one radiobutton in a group checked. radio_group("name", "foo", "bar", "baz") foo bar baz radio_group("name", ["foo"], ["bar", true], "baz") foo bar baz radio_group("name",...
def radio_group(name = "", *values) if name.kind_of?(Hash) values = name["VALUES"] name = name["NAME"] end values.collect{|value| if value.kind_of?(String) radio_button(name, value) + value else if value[-1] == true || value[-1] == false ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkbox_group(name = \"\", *values)\n if name.kind_of?(Hash)\n values = name[\"VALUES\"]\n name = name[\"NAME\"]\n end\n values.collect{|value|\n if value.kind_of?(String)\n checkbox(name, value) + value\n else\n if value[-1] == true || value[-1] ==...
[ "0.6532655", "0.6492025", "0.64386904", "0.6341667", "0.6195178", "0.6157647", "0.59901124", "0.5905829", "0.5861261", "0.5809014", "0.5807229", "0.5762533", "0.57378715", "0.5670104", "0.5646596", "0.56459844", "0.5645337", "0.56312454", "0.5545888", "0.5532955", "0.54454726...
0.77860266
0
Generate a reset button Input element, as a String. This resets the values on a form to their initial values. +value+ is the text displayed on the button. +name+ is the name of this button. Alternatively, the attributes can be specified as a hash. reset reset("reset") reset("VALUE" => "reset", "ID" => "foo")
def reset(value = nil, name = nil) attributes = if (not value) or value.kind_of?(String) { "TYPE" => "reset", "VALUE" => value, "NAME" => name } else value["TYPE"] = "reset" value end input(attributes) e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def button(value = nil, options = {})\n field = options[:name] || 'button'\n value = 'Button' if value.nil? || value == ''\n options[:value] ||= value\n single_tag(:input, set_options(:button, field, options))\n end", "def get_reset_button(path)\n <<-HEREDOC\n<form class=\"inline reset\" method=\...
[ "0.5914937", "0.5808056", "0.5403087", "0.540196", "0.53258234", "0.5116419", "0.50972766", "0.5058082", "0.50206196", "0.50169134", "0.49919134", "0.4973222", "0.49487507", "0.49442795", "0.49442795", "0.49442795", "0.4943904", "0.4943904", "0.4943904", "0.4943904", "0.49423...
0.752262
0
Generate a submit button Input element, as a String. +value+ is the text to display on the button. +name+ is the name of the input. Alternatively, the attributes can be specified as a hash. submit submit("ok") submit("ok", "button1") submit("VALUE" => "ok", "NAME" => "button1", "ID" => "foo")
def submit(value = nil, name = nil) attributes = if (not value) or value.kind_of?(String) { "TYPE" => "submit", "VALUE" => value, "NAME" => name } else value["TYPE"] = "submit" value end input(attributes) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit(label, options = nil)\n str = ''\n \n label = options.delete(:value) unless label \n \n str << '<input type=\"submit\"'\n str << %[ value=\"#{label}\"] if label\n\n unless options.empty?\n opts = options.collect { |k, v| %[#{k}=\"#{v}\"] }.join(' ')\n str << %[ #{opts} ]\n...
[ "0.72324884", "0.6811858", "0.68087995", "0.67594063", "0.66888595", "0.6632438", "0.65599245", "0.6445122", "0.64059955", "0.62364274", "0.620779", "0.6163161", "0.6095796", "0.6061293", "0.6029878", "0.6022229", "0.5968004", "0.58784574", "0.5872482", "0.58671653", "0.58173...
0.79623896
0
Generate a text field Input element, as a String. +name+ is the name of the input field. +value+ is its initial value. +size+ is the size of the input area. +maxlength+ is the maximum length of input accepted. Alternatively, the attributes can be specified as a hash. text_field("name") text_field("name", "value") text_...
def text_field(name = "", value = nil, size = 40, maxlength = nil) attributes = if name.kind_of?(String) { "TYPE" => "text", "NAME" => name, "VALUE" => value, "SIZE" => size.to_s } else name["TYPE"] = "text" n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text_field(name, value, options = {})\n options.merge!(:type => \"text\", :name => name, :value => value)\n tag(:input, options)\n end", "def text_field_tag(name, value = nil, options = {})\n tag :input, { \"type\" => \"text\", \"name\" => name, \"id\" => sanitize_to_id(name), \"val...
[ "0.74092746", "0.69114846", "0.67664677", "0.661869", "0.6468076", "0.6457424", "0.6339296", "0.6331223", "0.63296974", "0.63126457", "0.6152792", "0.61006415", "0.60833687", "0.60763", "0.606042", "0.6056124", "0.6027113", "0.59969485", "0.5989468", "0.59662044", "0.5944987"...
0.86916465
0
Generate a TextArea element, as a String. +name+ is the name of the textarea. +cols+ is the number of columns and +rows+ is the number of rows in the display. Alternatively, the attributes can be specified as a hash. The body is provided by the passedin noargument block textarea("name") = textarea("NAME" => "name", "CO...
def textarea(name = "", cols = 70, rows = 10) # :yield: attributes = if name.kind_of?(String) { "NAME" => name, "COLS" => cols.to_s, "ROWS" => rows.to_s } else name end super(attributes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xf_text_area (object_name, method, label = nil, attrs = {})\n attrs = attrs.symbolize_keys()\n text (\"textarea\", object_name, method, label, attrs)\n end", "def text_area(name, value, options = {})\n options.merge!(:name => name)\n tag(:textarea, options) { value ...
[ "0.7281976", "0.72749865", "0.6841871", "0.68410337", "0.6824593", "0.67898595", "0.6758425", "0.66992307", "0.6600509", "0.63396287", "0.62827575", "0.6264034", "0.6143565", "0.6085938", "0.6079559", "0.6038266", "0.60324204", "0.6023879", "0.6001292", "0.57934874", "0.55151...
0.80104846
0
The DOCTYPE declaration for this version of HTML
def doctype %|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">| end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doctype\n %|<!DOCTYPE HTML>|\n end", "def doctype\n %|<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">|\n end", "def doctype\n %|<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">|\n ...
[ "0.81602895", "0.79795134", "0.7955958", "0.79180044", "0.7628742", "0.7577214", "0.7452681", "0.686177", "0.67711955", "0.6476241", "0.6290543", "0.6290543", "0.62250876", "0.61684376", "0.61684376", "0.61684376", "0.61684376", "0.613154", "0.61291826", "0.6124602", "0.60843...
0.80897146
1
The DOCTYPE declaration for this version of HTML
def doctype %|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">| end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doctype\n %|<!DOCTYPE HTML>|\n end", "def doctype\n %|<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">|\n end", "def doctype\n %|<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">|\n end", "def doctype_\n start_ht...
[ "0.81602895", "0.80897146", "0.79795134", "0.79180044", "0.7628742", "0.7577214", "0.7452681", "0.686177", "0.67711955", "0.6476241", "0.6290543", "0.6290543", "0.62250876", "0.61684376", "0.61684376", "0.61684376", "0.61684376", "0.613154", "0.61291826", "0.6124602", "0.6084...
0.7955958
3
The DOCTYPE declaration for this version of HTML
def doctype %|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">| end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doctype\n %|<!DOCTYPE HTML>|\n end", "def doctype\n %|<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">|\n end", "def doctype\n %|<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">|\n end", "def doctype_\n start_ht5\n ht5 <...
[ "0.81602895", "0.80897146", "0.7955958", "0.79180044", "0.7628742", "0.7577214", "0.7452681", "0.686177", "0.67711955", "0.6476241", "0.6290543", "0.6290543", "0.62250876", "0.61684376", "0.61684376", "0.61684376", "0.61684376", "0.613154", "0.61291826", "0.6124602", "0.60843...
0.79795134
2
The DOCTYPE declaration for this version of HTML
def doctype %|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">| end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doctype\n %|<!DOCTYPE HTML>|\n end", "def doctype\n %|<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">|\n end", "def doctype\n %|<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">|\n end", "def doctype\n %|<!DOC...
[ "0.81602895", "0.80897146", "0.79795134", "0.7955958", "0.79180044", "0.7628742", "0.7577214", "0.686177", "0.67711955", "0.6476241", "0.6290543", "0.6290543", "0.62250876", "0.61684376", "0.61684376", "0.61684376", "0.61684376", "0.613154", "0.61291826", "0.6124602", "0.6084...
0.7452681
7
The DOCTYPE declaration for this version of HTML
def doctype %|<!DOCTYPE HTML>| end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doctype\n %|<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">|\n end", "def doctype\n %|<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">|\n end", "def doctype\n %|<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"htt...
[ "0.80897146", "0.79795134", "0.7955958", "0.79180044", "0.7628742", "0.7577214", "0.7452681", "0.686177", "0.67711955", "0.6476241", "0.6290543", "0.6290543", "0.62250876", "0.61684376", "0.61684376", "0.61684376", "0.61684376", "0.613154", "0.61291826", "0.6124602", "0.60843...
0.81602895
0
Create a new session id. The session id is a secure random number by SecureRandom if possible, otherwise an SHA512 hash based upon the time, a random number, and a constant string. This routine is used internally for automatically generated session ids.
def create_new_id require 'securerandom' begin # by OpenSSL, or system provided entropy pool session_id = SecureRandom.hex(16) rescue NotImplementedError # never happens on modern systems require 'digest' d = Digest('SHA512').new now = Time::now ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_new_id\n @new_session = true\n self.class.generate_unique_id\n end", "def generate_id\n synchronize do\n n = (get_random() % @@MOD_LEN) + @@MOD_LEN\n time_val = Time.now.to_i\n t = ((time_val / 2) % @@MAX_TICKS) + @@MAX_TICKS\n if ...
[ "0.74428064", "0.7158494", "0.70212233", "0.7017356", "0.7004584", "0.69245386", "0.69158626", "0.68960184", "0.67133677", "0.6689227", "0.6687422", "0.6652072", "0.66475606", "0.66415054", "0.6614792", "0.65839237", "0.65818447", "0.65812254", "0.6553709", "0.65468025", "0.6...
0.8801155
0
Create a new file to store the session data. This file will be created if it does not exist, or opened if it does. This path is generated under _tmpdir_ from _prefix_, the digested session id, and _suffix_. +option+ is a hash of options for the initializer. The following options are recognised: tmpdir:: the directory t...
def new_store_file(option={}) # :nodoc: dir = option['tmpdir'] || Dir::tmpdir prefix = option['prefix'] suffix = option['suffix'] require 'digest/md5' md5 = Digest::MD5.hexdigest(session_id)[0,16] path = dir+"/" path << prefix if prefix path << md5 path << suffix if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_temporary_file(prefix, extension='', tmpdir=Dir::tmpdir)\n\tmax_tries=10\n\n\tfailure=0\n\tbegin\n\t\t# Make a filename which does not yet exist\n\t\tn=0\n\t\tbegin\n\t\t\tt=Time.now.strftime(\"%Y%m%d\")\n\t\t\tfilename=\"#{prefix}-#{t}-#{$$}-#{rand(0x100000000).to_s(36)}-#{n}#{extension}\"\n\t\t\ttmpnam...
[ "0.5796433", "0.56222594", "0.5618888", "0.55348074", "0.5526181", "0.5494634", "0.5481609", "0.54754347", "0.5355321", "0.531112", "0.52733284", "0.52321774", "0.5182228", "0.5181096", "0.5152064", "0.5143583", "0.5126931", "0.51173824", "0.50775963", "0.5065626", "0.5031591...
0.8237829
0
Retrieve the session data for key +key+.
def [](key) @data ||= @dbman.restore @data[key] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def [](key)\r\n session[key]\r\n end", "def get_data(key)\n Storage.find(cookies[key]).data\n end", "def get_data(key) \n return @data[key]\n end", "def [](key)\n sess_hash[key.to_sym]\n end", "def read(key)\n _key = Digest::SHA1.hexdigest key\n\n unless @me...
[ "0.71929955", "0.7021602", "0.6852632", "0.6836704", "0.67263615", "0.67085475", "0.66953915", "0.6681407", "0.66199523", "0.6615012", "0.65579647", "0.6553397", "0.6412429", "0.63643414", "0.62984693", "0.623023", "0.61990774", "0.6197169", "0.61853707", "0.6167906", "0.6133...
0.0
-1
Set the session data for key +key+.
def []=(key, val) @write_lock ||= true @data ||= @dbman.restore @data[key] = val end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_session_key(key) \n @session_key=key\n self.decrypt_attributes if self.class.include? Encrypted\n end", "def session_key=(key)\n @session_key = key\n end", "def []=(key, value)\r\n session[key] = value\r\n end", "def set_session_key(key) \n if self....
[ "0.7501966", "0.7470383", "0.7361827", "0.7358799", "0.7276574", "0.723382", "0.70010597", "0.6861877", "0.6830088", "0.6812196", "0.67944115", "0.6774048", "0.67710954", "0.6724083", "0.6674871", "0.6621797", "0.6606198", "0.65894556", "0.6535074", "0.6524219", "0.6512495", ...
0.0
-1
Store session data on the server. For some session storage types, this is a noop.
def update @dbman.update end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_session(session_id, data)\n set(\"session:#{session_id}\", data)\n end", "def store_session(session_id, data)\n @mutex.synchronize {\n @timestamps[session_id] = Time.now\n @sessions[session_id] = data\n }\n end", "def store(key, data)\n store = Storage.new\n store...
[ "0.7908105", "0.7610362", "0.74180543", "0.7341212", "0.7286288", "0.712901", "0.6933036", "0.68671995", "0.6779523", "0.6769395", "0.66980094", "0.6550046", "0.652547", "0.6445544", "0.64128333", "0.6409652", "0.6403993", "0.6382516", "0.63733375", "0.63719547", "0.6365815",...
0.0
-1
Store session data on the server and close the session storage. For some session storage types, this is a noop.
def close @dbman.close @dbprot.clear end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_session(session_id, data)\n set(\"session:#{session_id}\", data)\n end", "def save\n if @data && @data.length > 0\n File.write( session_path, @data.to_yaml )\n @request.response.set_cookie( 'session_id',\n :value => session_id, :path => '/',\n :expires => Time.n...
[ "0.7377565", "0.7182812", "0.7174661", "0.6942777", "0.69325566", "0.6899669", "0.6839077", "0.67223793", "0.66679925", "0.65353924", "0.6390254", "0.63416445", "0.6293617", "0.6241871", "0.6209677", "0.6191714", "0.6184781", "0.6164945", "0.6140884", "0.61308026", "0.612564"...
0.0
-1
Delete the session from storage. Also closes the storage. Note that the session's data is _not_ automatically deleted upon the session expiring.
def delete @dbman.delete @dbprot.clear end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n if @session\n @session.destroy\n @session = nil\n end\n end", "def delete\n return unless @session\n @session.destroy\n @session = nil\n end", "def destroy\n @session.clear\n end", "def delete #:nodoc:#\n Cachetastic::Caches::RailsSessionCach...
[ "0.7679713", "0.7609069", "0.7338591", "0.7330908", "0.7160286", "0.70521194", "0.69942164", "0.69146", "0.6911068", "0.6871369", "0.68459177", "0.6822292", "0.6822292", "0.6822292", "0.6822292", "0.6812972", "0.6765201", "0.6760577", "0.67396677", "0.6733883", "0.67311084", ...
0.0
-1
Restore session state from the session's FileStore file. Returns the session state as a hash.
def restore unless @hash @hash = {} begin lockf = File.open(@path+".lock", "r") lockf.flock File::LOCK_SH f = File.open(@path, 'r') for line in f line.chomp! k, v = line.split('=',2) @hash[CGI.unescape(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore\n GLOBAL_HASH_TABLE[@session_id]\n end", "def restore #:nodoc:#\n @session_data = Cachetastic::Caches::RailsSessionCache.get(@session_key) do\n {}\n end\n end", "def restore\n return unless @session\n @data = @session.data\n end", "def re...
[ "0.66808546", "0.65809333", "0.6447351", "0.61778486", "0.60129267", "0.59242", "0.58040327", "0.5744319", "0.57087225", "0.56912774", "0.55578446", "0.54913414", "0.5378024", "0.5337655", "0.53320235", "0.5331937", "0.5222219", "0.52126515", "0.5185247", "0.5168767", "0.5130...
0.62541825
3
Save session state to the session's FileStore file.
def update return unless @hash begin lockf = File.open(@path+".lock", File::CREAT|File::RDWR, 0600) lockf.flock File::LOCK_EX f = File.open(@path+".new", File::CREAT|File::TRUNC|File::WRONLY, 0600) for k,v in @hash f.printf "%s=%s\n", CGI.escape(k), CG...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n if @data && @data.length > 0\n File.write( session_path, @data.to_yaml )\n @request.response.set_cookie( 'session_id',\n :value => session_id, :path => '/',\n :expires => Time.now + Waves.config.session[:duration] )\n end\n end", "def save_session\n\t\tif s...
[ "0.72322", "0.701622", "0.69620985", "0.65181524", "0.65181524", "0.64755744", "0.64750874", "0.6462995", "0.6400434", "0.6318839", "0.62723345", "0.62715626", "0.62439346", "0.6223877", "0.6212226", "0.61829036", "0.6161858", "0.61486346", "0.6137452", "0.6133628", "0.612223...
0.0
-1
Update and close the session's FileStore file.
def close update end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n return unless @session\n update\n @session = nil\n end", "def update\n return unless @session\n @session.data = @data\n @session.save\n end", "def close(filename)\n clearpath = clear_filepath(filename)\n check_file_is_in_safe_dir(clearpa...
[ "0.6882856", "0.61584896", "0.6104573", "0.5939231", "0.5909125", "0.5862611", "0.58570826", "0.58524466", "0.5850679", "0.5821446", "0.581565", "0.5805954", "0.5773355", "0.57210785", "0.57193905", "0.5682229", "0.5679377", "0.56778616", "0.56541735", "0.56496", "0.5636452",...
0.5421968
43
Close and delete the session's FileStore file.
def delete File::unlink @path+".lock" rescue nil File::unlink @path+".new" rescue nil File::unlink @path rescue nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete!\n safe_close\n File.delete(@file_path)\n end", "def on_session_filedelete(session, path)\n\tend", "def delete_session_file(file)\n File::delete(file[:filename]) if File::exist?(file[:filename])\n File::delete(file[:original_tmp_filename]) if file[:original_tmp_filename] && Fi...
[ "0.693455", "0.67609984", "0.6627296", "0.6579976", "0.6557331", "0.6504391", "0.6489574", "0.6423355", "0.6386805", "0.6348347", "0.63434625", "0.6342473", "0.633315", "0.6299884", "0.6295158", "0.62537086", "0.6251832", "0.62482727", "0.6232022", "0.61956555", "0.6195108", ...
0.5654315
88
:nodoc: Create a new MemoryStore instance. +session+ is the session this instance is associated with. +option+ is a list of initialisation options. None are currently recognized.
def initialize(session, option=nil) @session_id = session.session_id unless GLOBAL_HASH_TABLE.key?(@session_id) unless session.new_session raise CGI::Session::NoSession, "uninitialized session" end GLOBAL_HASH_TABLE[@session_id] = {} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(session, option=nil)\n @session = Session.find_first([\"sessid = '%s'\", session.session_id])\n if @session\n @data = @session.data\n else\n @session = Session.new(\"sessid\" => session.session_id, \"data\" => {})\n end\n end", "def store options ...
[ "0.59254783", "0.5821921", "0.57854134", "0.56197274", "0.56197274", "0.5612605", "0.5536337", "0.5346418", "0.5280085", "0.5280085", "0.5280085", "0.5280085", "0.5280085", "0.5280085", "0.5280085", "0.52611303", "0.522389", "0.522386", "0.52126807", "0.5120803", "0.5094422",...
0.5116369
20
Restore session state. Returns session data as a hash.
def restore GLOBAL_HASH_TABLE[@session_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore\n return unless @session\n @data = @session.data\n end", "def restore #:nodoc:#\n @session_data = Cachetastic::Caches::RailsSessionCache.get(@session_key) do\n {}\n end\n end", "def restore\n if @session\n @data = unmarshalize(@session.data)\n ...
[ "0.7772444", "0.7677039", "0.7621625", "0.7134936", "0.6644192", "0.6362102", "0.6342922", "0.62846583", "0.62256503", "0.62047017", "0.6018881", "0.59876317", "0.5935616", "0.58126855", "0.5778431", "0.5766417", "0.57498", "0.5739737", "0.5731905", "0.5707035", "0.56507194",...
0.7667289
2
Update session state. A noop.
def update # don't need to update; hash is shared end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update #:nodoc:#\n Cachetastic::Caches::RailsSessionCache.set(@session_key, @session_data)\n end", "def update\n\t\tself.log.debug \"Updating session data for key %s\" % @id\n\t\tyield( self.serialized_data )\n\t\t@modified = false\n\tend", "def update\n return unless @session\n @...
[ "0.72163904", "0.71289957", "0.710975", "0.7095867", "0.70491266", "0.68524224", "0.68316287", "0.67994547", "0.67780024", "0.67611134", "0.6737845", "0.6609135", "0.65801406", "0.6571926", "0.6555338", "0.6447914", "0.6334233", "0.6331274", "0.6322011", "0.6269379", "0.62261...
0.0
-1
Close session storage. A noop.
def close # don't need to close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_session\n @session.close unless @session.nil?\n @session = nil\n end", "def close\n @repo.request_http(:post, path('session/close'),\n :expected_status_code => 204)\n end", "def close\n ensure_session!\n\n session.release!\n end", ...
[ "0.7725088", "0.7474154", "0.7406297", "0.7134702", "0.7058684", "0.69954145", "0.692108", "0.6915006", "0.6912474", "0.6758633", "0.66986465", "0.6680292", "0.65930283", "0.6525926", "0.6496872", "0.6476471", "0.6455942", "0.6444236", "0.64212394", "0.64057654", "0.63987017"...
0.0
-1
Delete the session state.
def delete GLOBAL_HASH_TABLE.delete(@session_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @session.clear\n end", "def delete\n if @session\n @session.destroy\n @session = nil\n end\n end", "def delete\n return unless @session\n @session.destroy\n @session = nil\n end", "def destroy\n\t\treset_session\n\t\tredirect_to new_session_path\n\...
[ "0.78243273", "0.7766828", "0.7692732", "0.7465078", "0.7436253", "0.7369602", "0.73009217", "0.7286544", "0.7225492", "0.7166277", "0.71371293", "0.7123021", "0.7100739", "0.70954245", "0.70954245", "0.70857275", "0.7081701", "0.7081701", "0.7081701", "0.7081701", "0.7053225...
0.74786276
3
Restore (empty) session state.
def restore {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_session!\n raw_session.clear\n end", "def restore\n return unless @session\n @data = @session.data\n end", "def restore\n GLOBAL_HASH_TABLE[@session_id]\n end", "def reset!\n @sess_hash = {}\n end", "def restore\n if @session\n @data = un...
[ "0.7971496", "0.77302843", "0.75367343", "0.75331277", "0.744317", "0.73644626", "0.73450685", "0.71701103", "0.70459294", "0.6924379", "0.6918629", "0.690334", "0.68946046", "0.68778104", "0.6727778", "0.6684876", "0.6684876", "0.66541064", "0.6613228", "0.65906817", "0.6580...
0.6541786
23
Update session state. A noop.
def update end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update #:nodoc:#\n Cachetastic::Caches::RailsSessionCache.set(@session_key, @session_data)\n end", "def update\n\t\tself.log.debug \"Updating session data for key %s\" % @id\n\t\tyield( self.serialized_data )\n\t\t@modified = false\n\tend", "def update\n return unless @session\n @...
[ "0.72163904", "0.71289957", "0.710975", "0.7095867", "0.70491266", "0.68524224", "0.68316287", "0.67994547", "0.67780024", "0.67611134", "0.6737845", "0.6609135", "0.65801406", "0.6571926", "0.6555338", "0.6447914", "0.6334233", "0.6331274", "0.6322011", "0.6269379", "0.62261...
0.0
-1
Close session storage. A noop.
def close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_session\n @session.close unless @session.nil?\n @session = nil\n end", "def close\n @repo.request_http(:post, path('session/close'),\n :expected_status_code => 204)\n end", "def close\n ensure_session!\n\n session.release!\n end", ...
[ "0.7725088", "0.7474154", "0.7406297", "0.7134702", "0.7058684", "0.69954145", "0.692108", "0.6915006", "0.6912474", "0.6758633", "0.66986465", "0.6680292", "0.65930283", "0.6525926", "0.6496872", "0.6476471", "0.6455942", "0.6444236", "0.64212394", "0.64057654", "0.63987017"...
0.0
-1
Delete the session state. A noop.
def delete end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @session.clear\n end", "def delete\n return unless @session\n @session.destroy\n @session = nil\n end", "def delete\n if @session\n @session.destroy\n @session = nil\n end\n end", "def delete_session\n session[:userid] = nil\n session[:attrib...
[ "0.75575435", "0.7529402", "0.7482093", "0.7424127", "0.7307181", "0.7288609", "0.7274953", "0.7242016", "0.71307147", "0.7077796", "0.705877", "0.7044526", "0.70212233", "0.699413", "0.69806415", "0.6904803", "0.68895537", "0.68895537", "0.68895537", "0.68895537", "0.6885810...
0.0
-1
Restore session state from the session's PStore file. Returns the session state as a hash.
def restore unless @hash @p.transaction do @hash = @p['hash'] || {} end end @hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore\n GLOBAL_HASH_TABLE[@session_id]\n end", "def restore\n return unless @session\n @data = @session.data\n end", "def restore\n if @session\n @data = unmarshalize(@session.data)\n end\n end", "def restore #:nodoc:#\n @session_data = Cachetastic::Cac...
[ "0.693954", "0.6804496", "0.6562167", "0.6549644", "0.62880254", "0.6087012", "0.60584044", "0.57814574", "0.5745715", "0.5738671", "0.5650746", "0.55697715", "0.5559875", "0.5551269", "0.55151093", "0.54923767", "0.548746", "0.54739696", "0.54571855", "0.54236203", "0.542076...
0.65363246
4
Save session state to the session's PStore file.
def update @p.transaction do @p['hash'] = @hash end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_session()\n @store\n end", "def save_session\n\t\tif self.session_loaded?\n\t\t\tself.log.debug \"Saving session: %p\" % [ self.session ]\n\t\t\tself.session.save( self )\n\t\telse\n\t\t\tself.log.debug \"No session to save.\"\n\t\tend\n\tend", "def save\n if @data && @data.length > 0\n ...
[ "0.73163325", "0.7161676", "0.7086988", "0.67198133", "0.65951174", "0.65643805", "0.655693", "0.65134954", "0.6457433", "0.64248455", "0.638988", "0.6334806", "0.63338304", "0.62735116", "0.62714857", "0.62560034", "0.62246364", "0.6169449", "0.6160025", "0.6136866", "0.6136...
0.0
-1
Update and close the session's PStore file.
def close update end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n return unless @session\n update\n @session = nil\n end", "def update\n return unless @session\n @session.data = @data\n @session.save\n end", "def update\n if @session\n @session.update_session(marshalize(@data))\n end\n end", "def s...
[ "0.69693625", "0.63319635", "0.6271856", "0.6139957", "0.6135642", "0.5872196", "0.583062", "0.58127135", "0.5807481", "0.5726923", "0.56996673", "0.5615149", "0.5579706", "0.55086493", "0.546059", "0.5457192", "0.5380691", "0.53720874", "0.53670067", "0.53668153", "0.5334475...
0.5423557
18
Close and delete the session's PStore file.
def delete path = @p.path File::unlink path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n if self.class.exists?(handle.address, handle.use_ssl?, handle.port)\n self.class.session_store.delete(self.class.key(handle.address, handle.use_ssl?, handle.port))\n end\n end", "def close\n persistent.close\n @_persistent = nil\n end", "def delete\n return unless @...
[ "0.67214847", "0.653992", "0.6444937", "0.637155", "0.63514817", "0.6338041", "0.6337477", "0.6261056", "0.61842686", "0.61630005", "0.6160988", "0.6148429", "0.61223364", "0.6111608", "0.60510755", "0.5983575", "0.59593827", "0.5947716", "0.59471804", "0.59386337", "0.590850...
0.5809977
28
URLencode a string. url_encoded_string = CGI.escape("'Stop!' said Fred") => "%27Stop%21%27+said+Fred"
def escape(string) encoding = string.encoding string.b.gsub(/([^ a-zA-Z0-9_.\-~]+)/) do |m| '%' + m.unpack('H2' * m.bytesize).join('%').upcase end.tr(' ', '+').force_encoding(encoding) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_encode(string)\n string = CGI.escape string\n end", "def url_encode(string) \r\n encoded_string = ''\r\n string.each_char do |char|\r\n char = (\"%%%02X\" % char.ord) if char.match(/[A-Za-z0-9]/) == nil\r\n encoded_string << char\r\n end\r\n return encoded_string\r\n end", "de...
[ "0.8403502", "0.78862077", "0.78862077", "0.7710511", "0.7710088", "0.7705552", "0.7658491", "0.7638895", "0.761869", "0.75710917", "0.7469094", "0.733245", "0.72852665", "0.72419274", "0.7220474", "0.71433353", "0.7117831", "0.7082062", "0.70736516", "0.6974523", "0.69566154...
0.67786455
28
URLdecode a string with encoding(optional). string = CGI.unescape("%27Stop%21%27+said+Fred") => "'Stop!' said Fred"
def unescape(string,encoding=@@accept_charset) str=string.tr('+', ' ').b.gsub(/((?:%[0-9a-fA-F]{2})+)/) do |m| [m.delete('%')].pack('H*') end.force_encoding(encoding) str.valid_encoding? ? str : str.force_encoding(string.encoding) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_unescape(s)\n #Added this to make cadaver work\n s = s.gsub(\"%28\", \"(\").gsub(\"%29\", \")\")\n URI.unescape(s)\n end", "def urldecode\n _rfc2396_parser.unescape(self)\n end", "def decode_uri(string)\n string.split(/%2F|%2f/, -1).map { |part| Rack::Utils.unescape(part) }...
[ "0.7371077", "0.717268", "0.7109424", "0.6875324", "0.68552226", "0.68247485", "0.67870665", "0.6688467", "0.66119283", "0.65836215", "0.6474788", "0.6418078", "0.6325713", "0.6311604", "0.6304871", "0.62987137", "0.6271173", "0.6257794", "0.62517446", "0.6226347", "0.6221404...
0.66890603
7
Escape special characters in HTML, namely '&\" CGI.escapeHTML('Usage: foo "bar" ') => "Usage: foo &quot;bar&quot; &lt;baz&gt;"
def escapeHTML(string) enc = string.encoding unless enc.ascii_compatible? if enc.dummy? origenc = enc enc = Encoding::Converter.asciicompat_encoding(enc) string = enc ? string.encode(enc) : string.b end table = Hash[TABLE_FOR_ESCAPE_HTML__.map {|pair|pair.map {|s|s.enco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_escape(html)\n html.to_s.gsub(/[&\"><]/) { |special| HTML_ESCAPE[special] }\n end", "def html_escape(s)\n CGI.escapeHTML(s.to_s)\n end", "def escape_html(html)\n html.to_s.gsub(/&/n, '&amp;').gsub(/\\\"/n, '&quot;').gsub(/>/n, '&gt;').gsub(/</n, '&lt;').gsub(/\\//, '&#47;')\n ...
[ "0.81405926", "0.8038787", "0.79745686", "0.7828822", "0.7769324", "0.77648234", "0.7717338", "0.7672521", "0.7595332", "0.75934166", "0.7549065", "0.7536679", "0.752834", "0.7481699", "0.7481699", "0.7447829", "0.734167", "0.7338354", "0.7169645", "0.71542", "0.71542", "0....
0.7024509
25
Unescape a string that has been HTMLescaped CGI.unescapeHTML("Usage: foo &quot;bar&quot; &lt;baz&gt;") => "Usage: foo \"bar\" "
def unescapeHTML(string) enc = string.encoding unless enc.ascii_compatible? if enc.dummy? origenc = enc enc = Encoding::Converter.asciicompat_encoding(enc) string = enc ? string.encode(enc) : string.b end string = string.gsub(Regexp.new('&(apos|amp|quot|gt|lt|#[0-9]+|#x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unescape(html)\n CGI.unescapeHTML(html)\n end", "def unescapeHTML(string)\n\tstr = string.dup\n\tstr.gsub!(/&(.*?);/n) {\n\t\tmatch = $1.dup\n\t\tcase match\n\t\t\twhen /\\Aamp\\z/ni then '&'\n\t\t\twhen /\\Aquot\\z/ni then '\"'\n\t\t\twhen /\\Agt\\z/ni then '>'\n\t\t\twhen /\\Alt\\z/ni then '<'\n\t\t\tw...
[ "0.7789908", "0.77700764", "0.7726395", "0.7451506", "0.7374243", "0.7291198", "0.71770966", "0.71642077", "0.7080308", "0.70532495", "0.67029506", "0.66930723", "0.66928506", "0.6610399", "0.6590944", "0.6563746", "0.6505194", "0.64554805", "0.64393485", "0.6438432", "0.6403...
0.7278943
6