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
Checks the number of parameters in the given method.
def examine_context(ctx) @max_allowed_params = value(MAX_ALLOWED_PARAMS_KEY, ctx, DEFAULT_MAX_ALLOWED_PARAMS) num_params = ctx.exp.arg_names.length return [] if num_params <= @max_allowed_params smell = SmellWarning.new(SMELL_CLASS, ctx.full_name, [ctx.exp.line], "has #{num_params} parameters", @source, SMELL_SUBCLASS, {PARAMETER_COUNT_KEY => num_params}) [smell] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_arguments_count(input_params)\n return if input_params.count >= declared_params.count\n raise ArgumentError, \"#{declared_params.count} parameters expected.\"\n end", "def acceptable_argument_count\n parameters = @object.method(@method).parameters\n min_args = parameters.select{ |arg| arg[0] == :req }.count\n if parameters.any? { |arg| arg[0] == :rest }\n max_args = Float::INFINITY\n else\n max_args = parameters.count\n end\n (min_args..max_args)\n end", "def check_parameter_count!( num )\n expected = @stmt_api.parameter_count\n if num != expected then \n raise Amalgalite::Error, \"#{sql} has #{expected} parameters, but #{num} were passed to bind.\"\n end\n return expected\n end", "def wrong_num_parameters?\n (ARGV.size != 1)\n end", "def invalid_arguments?(arguments, count)\n\t\targuments.length != count\n\tend", "def verify_args(method, args)\n matches = Chassis.signatures[method].select do |key|\n args[key]\n end\n \n misses = Chassis.signatures[method] - matches\n \n unless misses.empty?\n raise \"Required arguments missing for '#{method}': #{misses.join(\", \")}\"\n end\n end", "def arity_check(args, opt, splat, kwargs, block_name, mid)\n meth = mid.to_s.inspect\n\n arity = args.size - 1\n arity -= (opt.size)\n\n arity -= 1 if splat\n\n arity -= (kwargs.size)\n\n arity -= 1 if block_name\n arity = -arity - 1 if !opt.empty? or !kwargs.empty? or splat\n\n # $arity will point to our received arguments count\n aritycode = \"var $arity = arguments.length;\"\n\n if arity < 0 # splat or opt args\n aritycode + \"if ($arity < #{-(arity + 1)}) { Opal.ac($arity, #{arity}, this, #{meth}); }\"\n else\n aritycode + \"if ($arity !== #{arity}) { Opal.ac($arity, #{arity}, this, #{meth}); }\"\n end\n end", "def number_of_arguments(method_sexp)\n arguments = method_sexp[2]\n arguments = arguments[1] if arguments.first == :paren\n\n arguments[1] == nil ? 0 : arguments[1].size\n end", "def method (*args)\n\t\tif args.length > 2\n\t\t\tputs \"More than two\"\n\t\tend\n\tend", "def arity_check(args, opt, splat, block_name, mid)\n meth = mid.to_s.inspect\n\n arity = args.size - 1\n arity -= (opt.size - 1) if opt\n arity -= 1 if splat\n arity = -arity - 1 if opt or splat\n\n # $arity will point to our received arguments count\n aritycode = \"var $arity = arguments.length;\"\n\n if arity < 0 # splat or opt args\n aritycode + \"if ($arity < #{-(arity + 1)}) { $opal.ac($arity, #{arity}, this, #{meth}); }\"\n else\n aritycode + \"if ($arity !== #{arity}) { $opal.ac($arity, #{arity}, this, #{meth}); }\"\n end\n end", "def check_params; true; end", "def verify_params\n Validate::params_match @func, @current_param\n end", "def validate_params(method_name, params)\n errors = []\n\n # fetch method rulesets\n method = @methods_loaded[method_name.to_sym]\n \n if method.nil?\n # TODO enable devel or prod mode to raise or not an exception\n errors.push \"Unable to validate method #{method_name} with (#{@methods_loaded.keys.length}) keys #{@methods_loaded.keys}\"\n raise ArgumentError, errors\n end\n\n # fetch all params (optional and mandatory)\n check_params = method.parameters\n\n self.class.validate_ruleset(check_params, params)\n\n end", "def argc! count, syntax = nil\n @params = @params_str.split(/\\s/, count)\n\n return true if @params.length >= count\n\n if syntax\n raise \"At least #{count} parameters required: #{syntax}\"\n else\n raise \"At least #{count} parameters required.\"\n end\n end", "def argument_size? \n if @cmd[:arguments].size != @instruction.args_number\n Error::message( 5, \n @line, \n @cmd[:name], \n @cmd[:arguments].size, \n @instruction.args_number )\n end\n end", "def arguments_valid?\n true if @arguments.size >= 1 \n end", "def arity_checks\n return @arity_checks if @arity_checks\n\n arity = args.size - 1\n arity -= (opt_args.size)\n\n arity -= 1 if rest_arg\n\n arity -= (keyword_args.size)\n\n arity = -arity - 1 if !opt_args.empty? or !keyword_args.empty? or rest_arg\n\n # $arity will point to our received arguments count\n aritycode = \"var $arity = arguments.length;\"\n\n @arity_checks = []\n\n if arity < 0 # splat or opt args\n min_arity = -(arity + 1)\n max_arity = args.size - 1\n @arity_checks << \"$arity < #{min_arity}\" if min_arity > 0\n @arity_checks << \"$arity > #{max_arity}\" if max_arity and not(rest_arg)\n else\n @arity_checks << \"$arity !== #{arity}\"\n end\n\n @arity_checks\n end", "def validate_args_count(expected, got)\n if (expected.is_a?(Numeric) and expected != got) or\n (expected.is_a?(Range) and !(expected === got))\n raise ArgumentError, \"wrong number of arguments for '#{name}' (#{got} for #{expected})\"\n end\n end", "def arguments_valid?\n # TO DO - implement your real logic here\n true if (1..2).include? @arguments.length \n end", "def check_params\n # For each key,value in GLOBAL VAR **PARAMS**.\n PARAMS.each do |param, method|\n # Next if there isn't param in the request of client\n next unless params[param]\n # Check the *param* with *method*\n unless send(method, params[param])\n @error_object = \"Param #{param} is wrong, #{method} failed\"\n return false\n end\n end\n true\n end", "def arguments_valid?\n # TO DO - implement your real logic here\n true if @arguments.length == 2\n end", "def check_params\n true\n end", "def exact_parameters(n, options={:level=>:error})\n\t\t\t\tvalidate(\"Macro '#{@name}' takes exactly #{n} parameter(s) (#{@node.params.length} given)\", options) do\n\t\t\t\t\tif n == 0 then\n\t\t\t\t\t\tno_parameters options\n\t\t\t\t\telse\n\t\t\t\t\t\t@node.params.length == n \n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend", "def check_arity(obj, n_args)\n ary = obj.arity\n\n if ary >= 0\n n_args == ary\n else\n n_args >= (ary+1).abs \n end\n end", "def num_parameters\n @parameters.size\n end", "def arguments_valid?\n true if @arguments.size > 1\n end", "def arguments_valid?\n # TO DO - implement your real logic here\n true if @arguments.length == 1 \n end", "def numerical_arg_size?\n !has_splat_args? && arg_size\n end", "def arguments_valid?\n # TODO - implement your real logic here\n true # if @arguments.length == 1\n end", "def validate_parameters?\n opts = OptionParser.new\n opts.parse!(@parameters) rescue return false\n @parameters.length >= 2\n end", "def arguments_valid?\n true if @arguments.length == 4\n end", "def incorrect_arg_size?(args)\n return false if has_splat_args?\n required_arg_size = @args.take_while {|e| e[1].nil? }.size\n args.size < required_arg_size || args.size > required_arg_size\n end", "def variableNumberOfArguments (*test)\n puts \"Number of parameters #{test.length}\"\n for i in test\n puts \"The parameters are #{i}\"\n end\n end", "def number_of_arguments(*args)\n puts \"The number of parameters is #{args.length}\"\n for i in 0...args.length\n puts \"The parameters are #{args[i]}\"\n end\nend", "def check_param_values\n self.class.get_parameters_info.each do |k, v|\n if is_a_checkable_class?(v) && !v[:check].call(self.send(k))\n raise ParameterizableValueIncorrect.new(v[:check], self.send(k))\n end\n end\n end", "def arity\n parameters.size\n end", "def test_check_num_args_valid\n args = CheckNumArgs.new\n assert_equal true, args.check_args([1,1,1])\n end", "def arguments_valid?\n true \n # to do\n end", "def required_splat_no_block(required, *params)\n return 1 + params.size\n end", "def check_params\n params['message'].to_i > 30\n end", "def examine_context(method)\n num = method.num_statements\n return false if num <= value(MAX_ALLOWED_STATEMENTS_KEY, method, DEFAULT_MAX_STATEMENTS)\n found(method, \"has approx #{num} statements\", SUBCLASS_TOO_MANY_STATEMENTS, {'statement_count' => num})\n end", "def arguments_valid?\n # TO DO - implement some real logic here\n true if @arguments.length == 1 \n end", "def validate_params\n @calls << [:validate_params]\n end", "def validate_unarity(proc, method_name)\n if ![1, -1].include?(proc.arity)\n raise ConfigError, \"Proc for #{@name.inspect}'s ##{method_name} has an \" +\n \"arity of #{proc.arity} when it should be 1.\"\n end\n end", "def arguments_valid?\n true \n end", "def params_size\n accum = 0\n @params.each do |p|\n accum += 1 if p.needs_word?\n end\n accum\n end", "def check_arguments(exp_num, args, cond=nil)\n cond = Proc.new{|n| !n.nil?} if cond.nil?\n return exp_num == args.select{|n| cond.call(n)}.size\n end", "def size\n 1 + params_size\n end", "def q1 *rest\n puts \"The number of parameters is #{rest.length}.\"\n puts rest\nend", "def arguments_valid?\n\t\t # TO DO - implement your real logic here\n\t\t true if @arguments.length == 1\n\t\tend", "def test_check_num_args_valid2\n args = CheckNumArgs.new\n args.check_args([1,1,1])\n assert_kind_of Integer, 1\n end", "def check!\n self.normalize!\n __check_method\n __check_params\n end", "def arguments_valid?\n true\n end", "def min_parameters(n, options={:level=>:error})\n\t\t\t\tvalidate(\"Macro '#{@name}' takes at least #{n} parameter(s) (#{@node.params.length} given)\", options) { @node.params.length >= n }\n\t\t\tend", "def validate_paramters\n raise Scorekeeper::MissingParameterException if @income.nil? || @zipcode.nil? || @age.nil?\n end", "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "def check_arguments(params, *args)\n contains = true\n args.each do |arg|\n contains = false unless params.key? arg.to_sym\n end\n contains\n end", "def length; @args.length end", "def arguments_valid?\n num = 0\n num += 1 if @options.stats\n num += 1 if @options.attach\n num += 1 if @options.detach\n return false if num > 1\n return true\n end", "def validate_parameters\n check_for_valid_filepath if (@repository.parameters[:file])\n\n check_number_of_parameters(:coord, 2)\n check_number_of_parameters(:delta, 2)\n check_number_of_parameters(:time, 2)\n check_number_of_parameters(:range, 2)\n check_number_of_parameters(:section, 2)\n end", "def arity\n\t\t\tif @arity.nil?\n\t\t\t\t@arity = method.parameters.count{|type, name| type == :req}\n\t\t\tend\n\t\t\t\n\t\t\treturn @arity\n\t\tend", "def sizeOf _args\n \"sizeOf _args;\" \n end", "def examine_context(method)\n num = method.num_statements\n return false if num <= value(MAX_ALLOWED_STATEMENTS_KEY, method, DEFAULT_MAX_STATEMENTS)\n found(method, \"has approx #{num} statements\")\n end", "def test_check_num_args_invalid3\n args = CheckNumArgs.new\n assert_equal false, args.check_args([1, 2])\n end", "def arguments_valid?\n true\n end", "def test_Method_InstanceMethods_parameters\n\t\tdef m(a,b=1,*c,&d); end\n\t\t# TODO, assert_equal([[:req,:a],[:opt,:b],[:rest,:c],[:block,:d]], method(:m).parameters)\n\tend", "def how_many_args *args\n args.length\n # accepts any number of arguments without complaint\n # returns the total number of arguments passed to the function\n # Hint: google ruby *args\nend", "def _define_roda_method_arg_numbers(callable)\n optional_args = 0\n rest = false\n keyword = false\n callable.parameters.map(&:first).each do |arg_type, _|\n case arg_type\n when :opt\n optional_args += 1\n when :rest\n rest = true\n when :keyreq\n keyword = :required\n when :key, :keyrest\n keyword ||= true\n end\n end\n arity = callable.arity\n if arity < 0\n arity = arity.abs - 1\n end\n required_args = arity\n arity -= 1 if keyword == :required\n\n if callable.is_a?(Proc) && !callable.lambda?\n optional_args -= arity\n end\n\n [required_args, optional_args, rest, keyword]\n end", "def validate!(call_name)\n params = self.methods\n params.select { | method | call_name.include?(call_name) }\n end", "def valid_params?(name, size)\n return raise TypeError.new(\"A 'name' should be a string\") if name.class != String\n return raise TypeError.new(\"A 'size' should be an integer\") if size.class != Integer\n\n true\n end", "def validate_params!\n self.params ||= Hash.new\n self.class.instance_variable_get(:@__required_params).each do |e|\n raise ArgumentError, \"Insufficient parameters set (#{e} not supplied)\" if self.params[e].nil?\n end\n end", "def how_many_args(*args)\n args.length\nend", "def how_many_args(*args)\n args.count\nend", "def how_many_args(*arg)\n arg.length\nend", "def method_name_with_different_number_of_arguments(*arguments)\n puts(arguments)\nend", "def test_check_num_args_invalid2\n args = CheckNumArgs.new\n assert_equal false, args.check_args([1])\n end", "def how_many_args *args\n args.count\nend", "def arg_size; end", "def arity\n method(:call).arity\n end", "def sniff\n # TODO: Only checks instance methods!\n actual = context.node_instance_methods.length\n return [] if actual <= max_allowed_methods\n\n [smell_warning(\n lines: [source_line],\n message: \"has at least #{actual} methods\",\n parameters: { count: actual })]\n end", "def how_many_args *args\n args.length\nend", "def max_parameters(n, options={:level=>:error})\n\t\t\t\tvalidate(\"Macro '#{@name}' takes up to #{n} parameter(s) (#{@node.params.length} given)\", options) do\n\t\t\t\t\tif n == 0 then\n\t\t\t\t\t\tno_parameters options\n\t\t\t\t\telse\n\t\t\t\t\t\t@node.params.length <= n \n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend", "def size(*args); end", "def arguments_valid?\n # Should be no remaining arguments\n true if @arguments.length == 0\n end", "def has_param?(name)\n\n end", "def lock_args_method_valid?\n [NilClass, TrueClass, FalseClass].none? { |klass| lock_args_method.is_a?(klass) }\n end", "def test_exercise_1113\n verify_method :exercise_1113,\n :with => [{param: [[0]], expect: [[0]]},\n {param: [[0, 1]],\n expect: [[0],\n [1]]},\n {param: [[0, 1],\n [2, 3]],\n expect: [[0, 2],\n [1, 3]]}]\n\n end", "def expects?(param)\n expected_params.include? param.to_s\n end", "def validate_args (args)\n\t# todo\nend", "def valid_arguments?\n arguments_passed? && right_type?\n end", "def count_method\n @method_count += 1\n end", "def how_many_args(*args)\n\targs.length\nend", "def long_planeteer_calls(planateer_calls)# code an argument here\n # Your code here\n planateer_calls.any? { |call| call.length >= 5 }\n \nend", "def check_method_formals(ast_class_name, method, class_lut)\n\n\tformals = method.formals\n\tmethod_name = method.name\n\n\t# Check that no formal is named 'self' in this method\n\tfor formal in formals\n\t\tcheck_formal_self(ast_class_name, method_name, formal)\n\tend\n\n\t# Check that formals are uniquely defined in this method\n\tfor formal in formals\n\t\tcheck_formal_redefined(ast_class_name, method_name, formals, formal)\n\tend\n\n\t# Check that formals have valid types in this method\n\tfor formal in formals\n\t\tcheck_formal_type(ast_class_name, method_name, formal, class_lut)\n\tend\nend", "def check_method_formals(ast_class_name, method, class_lut)\n\n\tformals = method.formals\n\tmethod_name = method.name\n\n\t# Check that no formal is named 'self' in this method\n\tfor formal in formals\n\t\tcheck_formal_self(ast_class_name, method_name, formal)\n\tend\n\n\t# Check that formals are uniquely defined in this method\n\tfor formal in formals\n\t\tcheck_formal_redefined(ast_class_name, method_name, formals, formal)\n\tend\n\n\t# Check that formals have valid types in this method\n\tfor formal in formals\n\t\tcheck_formal_type(ast_class_name, method_name, formal, class_lut)\n\tend\nend", "def cnt; xparam(6); end", "def arguments_valid?\n true # no required arguments\n end", "def arguments_valid?\n return false if @arguments.length != 2\n @number = @arguments[0].to_i\n @value = @arguments[1].to_i\n true if (@number > 0 && @value > (@number-1) && @value < (@number*6+1)) \n end", "def valid_params?; end", "def has_arg name\n raise \"has_arg #{name}.#{name.class}\" unless name.is_a? Symbol\n max = self.arguments.get_length\n counter = 1\n while( counter <= max )\n if( self.arguments.get(counter).name == name)\n return counter\n end\n counter = counter + 1\n end\n return nil\n end", "def long_planeteer_calls(calls) # code an argument here\n # Your code here\n calls.any? { |call| call.length > 4 }\nend" ]
[ "0.73268956", "0.6971698", "0.6959385", "0.67857915", "0.67684084", "0.67091495", "0.6694818", "0.6630791", "0.65810245", "0.6559625", "0.6551332", "0.6443914", "0.6334756", "0.6323206", "0.63135165", "0.62619144", "0.62471783", "0.62385625", "0.62341255", "0.61937433", "0.6191491", "0.6177368", "0.61496586", "0.6134571", "0.61255777", "0.6081932", "0.6069257", "0.60515887", "0.6048613", "0.6047628", "0.60430026", "0.60336226", "0.6031984", "0.602842", "0.60071695", "0.6003695", "0.596526", "0.59623116", "0.59524477", "0.5949501", "0.5936077", "0.5934619", "0.59315866", "0.59278977", "0.591551", "0.5890633", "0.5880094", "0.58635974", "0.58615613", "0.58405185", "0.5823664", "0.5823631", "0.58221793", "0.5819073", "0.58181214", "0.58142334", "0.58108443", "0.5810384", "0.5809937", "0.580321", "0.5801458", "0.57987416", "0.5789695", "0.5775603", "0.57712895", "0.5761573", "0.57603437", "0.57511514", "0.5744725", "0.57341814", "0.57273996", "0.5714782", "0.57132894", "0.5701151", "0.56937844", "0.5691862", "0.56872696", "0.5684709", "0.5678876", "0.5652075", "0.56455404", "0.56415874", "0.5631794", "0.56202126", "0.5617757", "0.5615117", "0.5610915", "0.55906206", "0.5585613", "0.55631167", "0.5560441", "0.5550638", "0.55384684", "0.55248255", "0.55248255", "0.55189127", "0.5516587", "0.5509573", "0.55061823", "0.5505744", "0.550235" ]
0.0
-1
Render inline css Source:
def inline_css(name) sprockets["#{name}.css"].to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inline_stylesheet source\n \"<style type='text/css'>\" +\n File.read(\"#{RAILS_ROOT}/public/stylesheets/#{source}\") +\n \"</style>\"\n end", "def css_render\n css_list.join(\"\\n\")\n end", "def css; end", "def css; end", "def css; end", "def css_code\n '<style type=\"text/css\">' <<\n asset('webconsole.css') <<\n '</style>'\n end", "def css\n @css ||= assemble_css\n end", "def css(*args); end", "def css(*args); end", "def css(*args); end", "def css(*args); end", "def render\n result, extends = Visitors::Cssize.visit(Visitors::Perform.visit(self))\n result = result.do_extend(extends) unless extends.empty?\n result.to_s\n end", "def compile(css, include_paths, settings)\n\tcss\nend", "def run(filename, css); end", "def assemble_css\n renderer = Liquid::Template.parse(@stylesheet.data)\n renderer.render(global_template_data, :filters => liquid_filters)\n end", "def css(file)\n\t\t\t\"<link rel='stylesheet' type='text/css' href='#{file}'>\"\n\t\tend", "def render_css\r\n @css\r\nend", "def render_style(text, mediatype=\"all\")\n [\"<style type='text/css' media='#{mediatype}' >\",\n text,\n \"</style>\\n\"].join(\"\\n\") \n end", "def render\n perform(Environment.new).cssize.to_s\n end", "def CssHeredoc()\n css = <<-CSS\n# ^^^ meta.string.heredoc.ruby punctuation.definition.heredoc.ruby\n# ^^ meta.string.heredoc.ruby meta.tag.heredoc.ruby entity.name.tag.ruby\n\n .class[att=#{@ruby_sel}] {\n# ^^^^^^^^^^^^ meta.string.heredoc.ruby source.css.embedded.ruby meta.selector.css meta.interpolation.ruby\n\n font-family: #{@ruby_font};\n# ^^^^^^^^^^^^^ meta.string.heredoc.ruby source.css.embedded.ruby meta.property-list.css meta.property-value.css meta.interpolation.ruby\n }\n CSS\n# ^^^ meta.string.heredoc.ruby meta.tag.heredoc.ruby entity.name.tag.ruby\nend", "def render_style\n \"#{style}#{yield}\"\n end", "def make_css\n template = ERB.new TEMPLATE\n result = template.result binding\n (0..3).each { result.gsub!(/\\n;\\n/m, \";\\n\") }\n @result = result.gsub /^$\\n/, ''\n end", "def url_to_stylesheet(source, options = T.unsafe(nil)); end", "def css_path; end", "def css_path; end", "def printCSS\r\n css=\"<style type=\\\"text/css\\\">\\n\" \r\n @concreteInterfaceIds.each do\r\n |concrete_interface|\r\n concrete_interface = SWUI::ConcreteInterface.find_by.interface_name(concrete_interface).execute.first.concrete_interface_code.first\r\n css << concrete_interface\r\n css << \"\\n\"\r\n end\r\n @ajaxcontrolIds.each do\r\n |ajaxcontrolId|\r\n ajaxcontrol = SWUI::RichControl.find_by.concrete_widget_name(ajaxcontrolId).execute.first\r\n cssCode = ajaxcontrol.cssCode.first\r\n css << \"#{cssCode}\\n\"\r\n end\r\n css << \"</style>\\n\"\r\n return css\r\n end", "def to_html\n %(<link href=\"#{href}\" rel=\"stylesheet\">)\n end", "def css(url=\"\")\n self.style_sheet(url)\n end", "def path_to_stylesheet(source, options = T.unsafe(nil)); end", "def compile_css(ios, mark_source=false)\n header = \"/*** %s ***/\\n\"\n Dir.glob(File.join(@ctx_app_root, \"**/*#{STYLESHEET_EXT}\")) do |file|\n if File.file? file\n ios << header % file.sub(\"#{@ctx_app_root}/\", '') if mark_source\n ios << File.read(file) << \"\\n\"\n end\n end\n ios\n end", "def css_inline_config\n {\n css: {\n properties: %w(font-style font-weight text-decoration)\n }\n }\n end", "def stylesheet; end", "def escape_css(string); end", "def css_styles\n end", "def link_css(srcs,options={})\n srcs_length = srcs.split(\",\").length\n options[:media] ||= \"screen\"\n options[:type] ||= \"text/css\"\n options[:rel] ||= \"stylesheet\"\n content = \"\"\n if srcs_length == 1\n options[:href] = \"/css/#{srcs}.css\"\n content = single_tag(:link, options)\n else\n srcs.split(\",\").each do |src|\n options[:href] = \"/css/#{src.strip}.css\"\n content << single_tag(:link, options)\n content << \"\\n\"\n end\n end\n content\n end", "def netzke_css\n %{\n <style type=\"text/css\" media=\"screen\">\n #{content_for(:netzke_css)}\n </style>} if content_for(:netzke_css).present?\n end", "def css=(_arg0); end", "def post_compile(css, settings)\n\tcss\nend", "def render_list_css\n\t\tresponse = Rack::Response.new\n\t\tFile.open(\"list.css\", \"rb\") { |css| response.write(css.read) }\n\t\tresponse.finish\n\tend", "def render_list_css\n\t\tresponse = Rack::Response.new\n\t\tFile.open(\"list.css\", \"rb\") { |css| response.write(css.read) }\n\t\tresponse.finish\n\tend", "def css(href)\n link :rel => 'stylesheet', :type => 'text/css', :href => href\n end", "def css(href)\n link :rel => 'stylesheet', :type => 'text/css', :href => href\n end", "def clean_inline_css(url)\n premailer = Premailer.new(url, :adapter => :nokogiri, :escape_url_attributes => false)\n premailer.to_inline_css.gsub(\"Drop Content Blocks Here\", \"\")\n end", "def generate_css\n needs = affected_files.map { |m| File.extname(m)[1..-1].to_sym }\n \n original_ext = File.extname(@original_file)[1..-1]\n needs << original_ext.to_sym unless needs.include? original_ext\n\n WebifyRuby::Css.link_to = @link_to\n \n if should_write_css?\n WebifyRuby::Css.relative_from = @link_to ? nil : @css\n end\n \n css = WebifyRuby::Css.new(File.basename(@file, \".*\"), @file, *needs)\n @styles = css.result\n\n @css_file = css.write @css if should_write_css?\n end", "def css_tags\n css.map do |url|\n \"<link href=\\\"#{url}\\\" media=\\\"all\\\" rel=\\\"stylesheet\\\" type=\\\"text/css\\\" />\"\n end.join(\"\\n\")\n end", "def stylesheet_url(source, options = T.unsafe(nil)); end", "def inline_styles\n parser.css(\"style\").to_a\n end", "def compile(name, source)\n runtime.call('HamlCoffeeAssets.compile',\n namespace, name, source, format,\n escapeHtml, escapeAttributes, customHtmlEscape, context)\n end", "def at_css(*args); end", "def at_css(*args); end", "def webpack_stylesheet_tag(source)\n tag(\n :link,\n rel: 'stylesheet',\n media: 'all',\n href: path_to_webpack_asset(source, :css)\n )\n end", "def inline(options = {})\n keep_uninlinable_css = options.fetch(:keep_uninlinable_css, true)\n keep_uninlinable_in = options.fetch(:keep_uninlinable_in, :head)\n merge_media_queries = options.fetch(:merge_media_queries, true)\n\n style_map, extra_blocks = consume_stylesheets\n\n apply_style_map(style_map)\n\n if keep_uninlinable_css\n add_uninlinable_styles(keep_uninlinable_in, extra_blocks, merge_media_queries)\n end\n\n nil\n end", "def inline_code; end", "def sg_usemin_css(path, options={})\n usemin = SlimGruntHelpers::Models::UseminCss.new\n options = { alt: nil, absolute: false }.merge!(options)\n\n alt = ''\n alt = \"(#{ options[:alt] })\" unless options[:alt].nil?\n\n text = \"\\n<!-- build:css#{ alt } #{ path } -->\\n\"\n yield(usemin)\n usemin.each(options) do |link|\n text << \"#{ link }\\n\"\n end\n text << \"<!-- endbuild -->\\n\"\n end", "def render_css\n @menu ? \"#{@menu.css}\\n #{@selected ? @selected.css : ''}\\n\" : ''\nend", "def concat_css(filename, mode)\n result = \"\"\n CssSplitter.split_file(filename).each do |part|\n if part[:type] == :source\n result += part[:value] if mode == :css\n else\n if mode == :css\n result += \"url('\" + part[:value].sub(/^.*?([^\\/]+)$/, '\\1') + \"')\"\n else\n result += filename.sub(/[^\\/]*$/, '') + part[:value] + \"\\n\"\n end\n end\n end\n return result\n end", "def stylesheet_link_tag(*sources)\n options = sources.extract_options!.stringify_keys\n if options[\"debug\"] != false && request_debug_assets?\n sources.map { |source|\n check_errors_for(source, :type => :stylesheet)\n if asset = lookup_asset_for_path(source, :type => :stylesheet)\n asset.to_a.map do |a|\n super(path_to_stylesheet(a.logical_path, :debug => true), options)\n end\n else\n super(source, options)\n end\n }.flatten.uniq.join(\"\\n\").html_safe\n else\n sources.push(options)\n super(*sources)\n end\n end", "def inline_stylesheet( stylesheet, options = {} )\n\n # add the extension, if not already present\n stylesheet += \".css\" unless stylesheet.match(/\\.css$/)\n\n # look for the file, and bail if it doesn’t exist\n filename = asset_path_for( stylesheet )\n return unless File.exists?( filename )\n\n # read the file in, bail if it’s empty\n content = File.read( filename ).strip\n return if content.empty?\n\n # rewrite our content\n content.gsub!( /url\\(\"(.*?)\"\\)/ ){ |match| \"url(\\\"#{asset_url_for( $1 )}\\\")\" }\n\n # return a <STYLE> tag\n options[:media] ||= :screen\n tag(:style, options, true) + content.html_safe + '</style>'.html_safe\n end", "def stylesheet src, attributes = {}\n link({:rel => \"stylesheet\", :href => src}.merge(attributes))\n end", "def process(css, opts = T.unsafe(nil)); end", "def process(css, opts = T.unsafe(nil)); end", "def render(src)\n src = embed_lines(src, '/*** CONSTS ***/', gen_consts)\n src = embed_lines(src, '/*** DCLS ***/', gen_decls)\n embed_lines(src, '/*** INPUTS ***/', gen_inputs)\n end", "def css\n project_file_read(\"all.css\")\nend", "def custom_css\n File.read file_path(\"#{name}.css\") if custom_css?\n end", "def render\n render_to_string(:inline => '<%= render_grid(grid) %>', :locals => {:grid => self})\n end", "def css(page_css) \n page_css.split(' ').each do |item|\n content_for(:css) do\n \"<link href=\\\"/stylesheets/#{page_css}.css\\\" rel='stylesheet' type='text/css'/>\\n\" \n end \n end\n end", "def style\n `$q(this.__native__.style.cssText)`\n end", "def css\n puts 'Compiling LESS files to CSS...'\n `lessc ./less/main.less ../www/_res/css/uncompressed/main.css`\n puts 'Compressing CSS files...'\n `java -jar ./_scripts/yuicompressor-2.4.2.jar ../www/_res/css/uncompressed/main.css -o ../www/_res/css/main.css`\nend", "def render_plain_styleblock(name)\n @block_html.gsub('$modifier_class', '').gsub(' class=\"\"', '').prepend('<div class=\"styleguide-styleblock\">') << '</div>'\n end", "def render_inline_javascripts\n #write out any inline javascript\n return '' if @content_for_inline_javascripts.blank?\n js_code = \"\\n<!-- Inline Javascripts -->\\n#{@content_for_inline_javascripts}\"\n end", "def css_for_doc(doc)\n css_urls_in_doc(doc).map { |url| css_for_url(url) }.join(\"\\n\")\n end", "def style\n File.read(@folder + \"/data/style.css\")\n end", "def css name, version='', options={}\n component name, version, options.merge(css: true)\n end", "def style\n \"#{width}px;height:#{height}px;#{@style}\"\n end", "def render(source)\n ERB.new(source, nil, '-').result(binding)\n end", "def styles; end", "def styles; end", "def styles; end", "def css\n%Q(\n <style>\n body {\n font-family: arial;\n }\n table.unprefixed, table.cbprefixed {\n min-width: 90%;\n border-width: 1px;\n border-style: solid;\n border-color: black;\n border-collapse: collapse;\n }\n\n table.unprefixed th, table.cbprefixed th {\n background-color: #cccccc;\n border-width: 1px;\n\t\t\tborder-style: solid;\n\t\t\tborder-color: black;\n\t\t\tborder-collapse: collapse;\n padding: 10px;\n }\n\n table.unprefixed td, table.cbprefixed td {\n text-align: center;\n\t\t\tborder-width: 1px;\n\t\t\tborder-style: solid;\n\t\t\tborder-color: black;\n\t\t\tborder-collapse: collapse;\n font-size: 10pt;\n\t\t}\n td.x8-lsm { background-color: #ccccff; }\n td.x16-lsm { background-color: #ccffcc; }\n td.x8-alu { background-color: #ffff99; }\n td.x16-alu { background-color: #ffcccc; }\n td.x8-rsb { background-color: #80ffff; }\n td.control-br { background-color: #ffcc99; }\n td.control-misc { background-color: #ff99cc; }\n </style>\n)\nend", "def c_raw src, options = {}\n self.generate src, options\n end", "def set_css_code(css)\n return '' if css.blank?\n\n css.gsub!('# ',\"#td_record_#{@yaml['name']} \") if css.match('# ')\n css\nend", "def code(env)\n html_code <<\n css_code <<\n render(js_code,\n :TOKEN => Webconsole::Repl.token,\n :KEY_CODE => Webconsole.key_code,\n :CONTEXT => env['SCRIPT_NAME'] || \"\")\n end", "def rcss\n # :rcssfile is defined in routes.rb\n if @stylefile = params[:rcssfile]\n #prep stylefile with relative path and correct extension\n @stylefile.gsub!(/.css$/, '')\n \n @color = \"#EBC2AF\" \n @wrapper_width = ConstValues::WIDTH_OF_WRAPPER\n @header_height = ConstValues::HEIGHT_OF_HEADER\n @footer_height = ConstValues::HEIGHT_OF_FOOTER\n @board_size = ConstValues::SIZE_OF_BOARD\n @leftpanel_width = ConstValues::WIDTH_OF_LEFTPANEL\n @rightpanel_width = ConstValues::WIDTH_OF_RIGHTPANEL\n @element_size = ConstValues::SIZE_OF_ELEMENT\n \n \n \n #---Maciek----------------------------------------------------------------------\n @arrow_up = ConstValues::POS_ARROW_UP\n @arrow_down = ConstValues::POS_ARROW_DOWN\n @arrow_left = ConstValues::POS_ARROW_LEFT\n @arrow_right = ConstValues::POS_ARROW_RIGHT\n @size_of_arrows = ConstValues::SIZE_OF_ARROWS\n \n @color_ecru = \"#C2B280\" #jakiś taki biało żółty\n @color_yellow_mist = \"#FFFFE0\"\n @color_old_lace = \"#F5F5DC\"\n @color_light_khaki = \"#F0E68C\"\n @color_desert_sand = \"#EDC9AF\"\n @color_light_red =\"#FF0000\"\n \n @SHOW_USER_WIDTH = ConstValues::SHOW_USER_WIDTH\n @DEFAULT_BORDER = 5\n @SHOW_USER_RIGHT_WIDTH = @DEFAULT_BORDER * 2 + @SHOW_USER_WIDTH \n @AVATAR_SIZE_X = ConstValues::AVATAR_SIZE_X\n @TABS_HEIGHT = 35\n #-------------------------------------------------------------------------------\n\n @LEFT_S_PANEL_WIDTH = @SHOW_USER_WIDTH - @DEFAULT_BORDER * 4 + 1\n @AVA_PROFILE_SIZE_X = ConstValues::AVA_PROFILE_SIZE_X\n \n @stylefile = @stylefile = \"/rcss/\" + @stylefile + \".rcss.erb\"\n render(:file => @stylefile, :use_full_path => true, :content_type => \"text/css\")\n else #no method/action specified\n render(:nothing => true, :status => 404)\n end #if @stylefile..\n end", "def link_css(path, media = \"screen\")\n path = \"/#{path}\" unless path =~ %r{^/}\n path = \"#{path}.css\" unless path =~ %r{\\.css$}\n %{<link href=\"#{timestamp_asset(path)}\" media=\"#{media}\" rel=\"Stylesheet\" type=\"text/css\" />}\n end", "def stylesheet_path(source, options = T.unsafe(nil)); end", "def render(src)\n src = embed_lines(src, '### CONSTS ###', gen_consts)\n embed_lines(src, '### DCLS ###', gen_decls)\n end", "def rcss\n # :rcssfile is defined in routes.rb\n if @stylefile = params[:rcssfile]\n #prep stylefile with relative path and correct extension\n @stylefile.gsub!(/.css$/, '')\n @stylefile = File.join(\"vendor\", \"plugins\", \"template_derby\", \"app\", \"views\", \"rcss\", @stylefile + \".rcss\")\n\n #check for existence of @stylefile on filesystem - raise system error if not found\n if not(File.exists?(@stylefile))\n raise CoreERR_CSSFileNotFound\n end\n\n # set caching because we have a good css file to ship\n expires_in 4.hours unless (($prevent_layout_caching==true) rescue true)\n render(:file => @stylefile, :use_full_path => false, :content_type => \"text/css\")\n else #no method/action specified\n render(:nothing => true, :status => 404)\n end #if @stylefile..\n end", "def wrap_preview(preview_html)\n output_file_content =<<CONTENT\n <head>\n <meta charset=\"utf-8\">\n <meta http-equiv=\"refresh\" content=\"#{@refresh_rate}\">\n <style type=\"text/css\">\n #{IO.read(Resources.expand_path(File.join('css','github.css')))}\n #{IO.read(Resources.expand_path(File.join('css','github2.css')))}\n\n html, .markdown-body {\n overflow: inherit;\n }\n .markdown-body h1 {\n margin-top: 0;\n }\n .readme-content {\n width: #{@preview_width}px;\n }\n\n /* hack in an anchor icon */\n .markdown-body h1:hover a.anchor, .markdown-body h2:hover a.anchor, .markdown-body h3:hover a.anchor, .markdown-body h4:hover a.anchor, .markdown-body h5:hover a.anchor, .markdown-body h6:hover a.anchor {\n padding: 8px 13px;\n margin: 0px 0px 12px -27px;\n background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAdCAIAAADU74AfAAAYHWlDQ1BJQ0MgUHJvZmlsZQAAWAmtWWdYFEuz7pmNwC45ZyTnnCXnnKOoLDmDS0YJIiJJAQmigCgggigYSSIgiCgiSYKiIAoKKCoGQJLcgaPnnO/57v1353lm5t3qt6urq3p6pmoBYL9NCgsLgmkBCA6JINsa6fI6u7jy4qYABDCAgJw8JM/wMB1ra3Pwfx4rYwgbOZ5J7uj6P2n/ewOdl3e4JwCQNdLs4RXuGYzg2wCgmjzDyBEAYHb0CURHhO3gHAQzkhEDEVy5g33/wk072OMv3LfLsbfVQzjTAOAJJBLZFwDiIiLnjfL0RfRQEwDA0od4+Ycg3XgRrOnpR/ICgN0d4UgEB4fu4CwEi3j8S4/vvzCJ5PG3ThLJ92/811yQnsjA+v7hYUGk2N0f/5+X4KBIxF+7BzdyJYQH2pkhd2bEbzGeJAM7BLMi+JSft4n5b3lVWISu7W95q3+EiT2CGRHOiF+kscNvPB8Z6KCDYE5EvhkYarbDR/wEs4Z4WFohmB7BAp7heojvd8aCleL87J1+c8y9vPUNEIysItiZHGr7h+8XHmX3Rx4X56dn+YcfQDLdiTc1ws8gkRG0aw9c5B1ktDPuHkR+NSzCesfOnbH6Q4Isf88FnvUhG+5wduTr3uG7892xzS/Cz94YkSM2o2gjyPY7HGSOKE4ff0MTBCO2oWT8yMZ/5NphQbtrGumLsidH2u74QQDBPt4hDjs+3JFneJH0d3yL+ARVAgwBCZCBN/AAIWAB8AJzoAf0f195EXkIIvMEoSAIOcm8NH9aMO8xQ5i3mFHMNObFHxnS8zcP+AMvBP+l61/9EbkdiAOfEK3eIPzPaGh2tCZaHW2OXLWRUw6tglb909a/2Lj4B/+21RfpK/lbt+5v66MQjVt/eAf9k8l/8O8+Hn/3+G+bDMEs4gHfPwyZWpkFmc0//f+ZMdYAq481xhpiRVFpqFuoHtR91GNUK6oR8KLaUU2oPtS9Hfzbrj+jkBDJjld2PBwOzBAveoPI3V8hf8b7Dy9F/s34rYFajFoR2CK9QkAg0ub/9wiOu1b7/5eWSIThgYwYgHDN/o7Hb7vQQoh3FdG6aA3Ez4iP0cxodiCJVkA8roPWQmKgiEj/ieJ/zkYS+Ox6O2p3LoHgPTKP4AjvmAhkLQG90LBYsr+vXwSvDrJbekvwmoR4SknwysnIKoCdvXeHA8B32909FWIe+EdGCgJARQ4ASt1/ZKHI2qwrQB6Hs//IhJDnjE0VgJu2npHkqL/0oXduGEAJaJCngg1wA34ggnhEDigBdaANDIApsAL2wAUcQNawHwhGLI4GR8BRkAoyQQ4oAOdAGagA1eAauAkaQSu4Dx6CJ2AQjIKXYBq8Ax/BElgBGxAE4SAixACxQTyQICQOyUEqkCZkAJlDtpAL5A75QiFQJHQEOgZlQqehc9BFqAa6ATVD96HH0BD0AnoDLUDfoHUYBRNgRpgLFoKlYRVYBzaD7eH9sC98CI6DU+BTcBFcDl+FG+D78BN4FJ6GP8LLKICiQjGj+FCSKBWUHsoK5YryQZFRCagMVCGqHFWHakHW4jPUNGoRtYbGohnQvGhJJJLGaAe0J/oQOgGdhT6HrkY3oB+gn6HfoJfQvzBEDCdGHKOGMcE4Y3wx0ZhUTCGmCnMH0408z+8wK1gslhkrjFVGVrsLNgB7GJuFLcXWYzuwQ9gZ7DIOh2PDieM0cFY4Ei4Cl4o7i7uKa8cN497hfuKp8Dx4Obwh3hUfgk/GF+Kv4Nvww/g5/AYFLYUghRqFFYUXRSxFNkUlRQvFAMU7ig1KOkphSg1Ke8oAyqOURZR1lN2Uryi/U1FR7aFSpbKh8qdKoiqiuk71iOoN1RqBniBG0CO4ESIJpwiXCR2EF4TvRCJRiKhNdCVGEE8Ra4hdxCniT2oGailqE2ov6kTqYuoG6mHqzzQUNII0OjQHaOJoCmlu0QzQLNJS0ArR6tGSaBNoi2mbacdpl+kY6GTprOiC6bLortA9ppunx9EL0RvQe9Gn0FfQd9HPMKAY+Bn0GDwZjjFUMnQzvGPEMgozmjAGMGYyXmPsZ1xiomdSYHJkimEqZrrHNM2MYhZiNmEOYs5mvsk8xrzOwsWiw+LNks5SxzLMssrKwarN6s2awVrPOsq6zsbLZsAWyJbL1sg2yY5mF2O3YY9mP8/ezb7IwcihzuHJkcFxk2OCE+YU47TlPMxZwdnHuczFzWXEFcZ1lquLa5GbmVubO4A7n7uNe4GHgUeTx58nn6ed5wMvE68ObxBvEe8D3iU+Tj5jvki+i3z9fBt7hPc47EneU79nkp+SX4Xfhz+fv5N/SYBHwELgiECtwIQghaCKoJ/gGcEewVUhYSEnoRNCjULzwqzCJsJxwrXCr0SIIloih0TKRUZEsaIqooGipaKDYrCYopifWLHYgDgsriTuL14qPiSBkVCVCJEolxiXJEjqSEZJ1kq+kWKWMpdKlmqU+iwtIO0qnSvdI/1LRlEmSKZS5qUsvaypbLJsi+w3OTE5T7liuRF5oryhfKJ8k/xXBXEFb4XzCs8VGRQtFE8odipuKSkrkZXqlBaUBZTdlUuUx1UYVaxVslQeqWJUdVUTVVtV19SU1CLUbqp9UZdUD1S/oj6/V3iv997KvTMaezRIGhc1pjV5Nd01L2hOa/FpkbTKtd5q82t7aVdpz+mI6gToXNX5rCujS9a9o7uqp6YXr9ehj9I30s/Q7zegN3AwOGcwZbjH0New1nDJSNHosFGHMcbYzDjXeNyEy8TTpMZkyVTZNN70gRnBzM7snNlbczFzsnmLBWxhapFn8cpS0DLEstEKWJlY5VlNWgtbH7K+a4O1sbYptnlvK2t7xLbHjsHuoN0VuxV7Xfts+5cOIg6RDp2ONI5ujjWOq076Tqedpp2lneOdn7iwu/i7NLniXB1dq1yX9xnsK9j3zk3RLdVtbL/w/pj9jw+wHwg6cO8gzUHSwVvuGHcn9yvumyQrUjlp2cPEo8RjyVPP84znRy9tr3yvBW8N79Pecz4aPqd95n01fPN8F/y0/Ar9Fv31/M/5fw0wDigLWA20CrwcuB3kFFQfjA92D24OoQ8JDHkQyh0aEzoUJh6WGjZ9SO1QwaElshm5KhwK3x/eFMGIfOT2RYpEHo98E6UZVRz1M9ox+lYMXUxITF+sWGx67FycYdylw+jDnoc7j/AdOXrkTbxO/MUEKMEjoTORPzEl8V2SUVL1UcqjgUefJsskn07+cczpWEsKV0pSysxxo+O1qdSp5NTxE+onytLQaf5p/eny6WfTf2V4ZfRmymQWZm5meWb1npQ9WXRy+5TPqf5spezzOdickJyxXK3c6tN0p+NOz+RZ5DXk8+Zn5P8oOFjwuFChsOwM5ZnIM9NF5kVNZwXO5pzdPOd3brRYt7i+hLMkvWS11Kt0+Lz2+boyrrLMsvUL/heeXzS62FAuVF5Yga2Iqnhf6VjZc0nlUk0Ve1Vm1dblkMvT1bbVD2qUa2qucF7JroVrI2sXrrpdHbymf62pTrLuYj1zfeZ1cD3y+ocb7jfGbprd7LylcqvutuDtkjsMdzIaoIbYhqVGv8bpJpemoWbT5s4W9ZY7d6XuXm7lay2+x3Qvu42yLaVtuz2ufbkjrGPxvu/9mc6DnS+7nLtGHtg86O8263700PBhV49OT/sjjUetj9UeN/eq9DY+UXrS0KfYd+ep4tM7/Ur9DQPKA02DqoMtQ3uH2oa1hu8/03/2cMRk5Mmo5ejQmMPY83G38ennXs/nXwS9+DoRNbHxMukV5lXGJO1k4RTnVPlr0df100rT997ov+l7a/f25YznzMfZ8NnNdynvie8L53jmaubl5lsXDBcGP+z78O5j2MeNxdRPdJ9KPot8vv1F+0vfkvPSu6/kr9vfsr6zfb/8Q+FH57L18tRK8MrGasZPtp/VayprPetO63Mb0Zu4zaIt0a2WX2a/Xm0Hb2+Hkcik3W8BFHKFfXwA+HYZyYtcAGAYRL4pqP/KjXYZyOcuhHAQ7AhJQR/hB6hjaDuMNlYYx45npeCh1KCyJAQSc6ibaRbpJOm9GSoYZ5jFWGJZ29lpOJw4K7m+8+zlTeF7yk8nYCt4UuiJCBCVF/MRPyPRK7kqLSJjI5skVys/qggrySrvV8lQbVB7s5eooaLprpWufUPnlR5eX8nA0zDHqMl4yhQyEzA3sgiwzLa6bf3c5qcds728g5VjsNNJ5zqXJ65v9i25re7fOAjcKUlsHpKeOl623gd9vH1Jfnb+ewN4A6HA6aD24Ashx0L9wqwPqZB5w/HhXyLGItuiqqPzYhJig+JcDpsc0YhXTlBKVE3SOWqW7HTMOyXi+PHU/BOVabfSOzL6MseyXp+cO/Up+1vOcu7K6eW85fz1QvQZpiKJs0bnPIsTS4pK6863lz25MHJxony6YqHyRxXqMlO1WI3uFbfa6Kv5127WDdV/vUF3U/6W3e3wOzkNNY0tTfebu1o67t5tvXOvvq2mvaKj9H5BZ0bXkQcB3XYPlXpYe9YeTT8e6H34pKvv/tPW/vqBosHwIb1h4vCzZ8UjPqOKY5ix8fHq51EvtCewEz3I+lJ8NTeZO6U+NfP65LT69Mc3ZW9tZ1Az9bMOs2vv8t9LvG+fs52bnT++IL0w+6H6Y8ii/OLyp/rPnl/ovtxZsl56//XIN5ZvD79n/whZJq34IOtodr17S2p7ezf+/NB1OAAlh5pH38AkYZ1xGnhJCmFKYao9BBmiGrUNjSdtAl0ZfRvDAhMtswoLiTWN7Tb7FCcVlzz3Pp4k3ot87Xte8i8LUgnxCCuKmIi6i8WK50nckOyTmpdBy/LJ7ZV3VYhQzFSqVG5Wear6Vu3HXqwGh6asloV2kE627nW9Qf1PhngjLmM5EwNTBzNP8xCLGMsEq2PWx21SbdPsMuyzHDIcU5xinf1c7F3192m5Ge53PRB9sMD9OqnTo9ez2+uOd4nPYV8nPxl/gv9iwGBgS1BNcHFIdmhyGPmQG1k7nCd8I2I08lpUarRHjEGsTJzAYa4jbPFMCbSJ2MSVpLdHe5NvHCtIiT6+P9X0hH6aeTop42jmpayHJ6dOfc5ezlnNXT79PW8p/1PBYuHnMz/P0p5TLQ4pqSrtPz9TtnDh3cXX5S8qhiofXWqrar3cW/3pCl/t/qsl117UM163vJGG7F5rd6QavBqLm4ZbMHcVWg/eO95W1d7a0Xb/SmdOV/yD6O6kh9k9pY8qHp/vPfUkss/uqWQ/un9i4OZg5lDAsM0zgxGDUZsxj/HI5ykvTkzEv/R5pTfJPrk41fz6xLTzG8m3+LfvZ7pmS98deq89R5gbma9YSPzg/9Fr0e9T8OewL2FLYV/J36K+x/6IXvZfMVqlWb310+DnkzXXtU/rg5uErYnd+IuDB5AZ9Bz2RmFR2Whx9AAmDiuNXcBdwvtRSFOsUfZSlRGiibbUcjTUNCu0L+g66GsY8hjjmXyZbVk0WEXZmNg22ec5hjnbuOq4K3iKeQv58vdk86cKRAmShAyEeYV/ivSJlomFixtL8EnCkgtS49KPZFpkr8gVyScpuCuqKmGVBpQLVJxV2VRfqJWqe+2V08BqTGk2aGVr++no6wrp0eoD/e8Gc4ZjRneNC028TQVNp82KzK0scBZdlsesTKxZrT/YtNnm2fnZqzsQHaYcrzkdcTZ1YXJ57Vq9LxR5/6/tv3cg6aCeO959iFTiEei514vgNeF92eeQr4rvpl+7f1KAdiAI7Ag6GqwXgg7pDj0ephP281At2QV5Z9dEWEX8iCyK2hs1FZ0UwxVzL9Y9jjlu4nDtkWPxzgkiCSuJXUl5R32T9Y+JpbAep0oFqT9OzKQ9Ta/PyMokZSmcxJ2cOHU9OyMnMNfoNP3ph3n78hbz4wp0CnXPpJ3Fn8soni1lOy9XpnpB9aJiuXSFSCXfJbYqusuU1RQ1NMhK0rjqfu1E3bX6Z9c3b4rccr19+s5QI2OTS3NJy3gr5p5om1G7R0fi/fOdbV2vH2w/5OvRe+T7OKv3xpOxvq1+0YF9g2eGpp7JjZwc/Txu97x5gu9lwaT0a+o30bOZ87GfLL+trNnsxP+vGtnOOwGrBEAekmc6nkTOBQByGwEQugsACyUA1kQA7FUBfKIOwEZ1AAo8/vf7AwJogEdyTmbAA0SBApJpmgNXJN+OAelIRnkVtIFhJDvehOghUUgbyQ/DoZNIPtgNzcAQzAfrwl7wCSTLG4bXUfwoC1Qcqho1jsaj1dDB6Ar0Cww9xgzJyLqwEFYbm4TtxGFwprgc3HM8Hz4I30yBo3CiqKZYp7SgvEi5SmVJVU1AEzwIXURBYjrxM7U9dSuS6eTSAtpDtLN0LnQD9Ib09xhUGBoY1Ri7mGyZZpgjWbAshaxCrE1slmzz7GkcshwznGVcHtzi3D95HvIW8HntUeDH8r8UuCWYLRQkbCYiLkoUXRIbFb8rcV4yQcpNWlWGUWZJ9qncFfl0BT9FUyUpZSblbZVPqlNqw+q9e7s1Hmj2aPVrT+jM667oAwMsss/hjfEmFKYEM0ZzPgsFS0urEOt8m1bbd/ZEBwVHF6d45wsuD1zn3Kj2yxxwPHjEvZLU7/HTS8Dbzue4b6vfeoBe4NmgtRDP0OFDhuTWCIXI+mjJmBtxew8PxocmciaNJeenmB9fOZGfLpHRneV9iin7de7TvMmC7SLec6ol5ucPXogtv1A5cVmy5sJVmbrpGxdvH2ikaq5r3d8u3snTbfiovI8wIDK0MpI7LvJi6NX512feDr93X1j7RP/l6jfwQ2ZFdXV7LWO9aWNk8+5Wxa+wbeXd/WOnikyJ1NI4gBBSa9ACFsANqS0kgFxQCZrBAFI32IKYIWnIFPJBKgLlSBXgLYyGhWFzmAyfg7vgLyhOlBnqCKoeNYvUvmzRmehuDITRwBzG3MVsYrWwx7CPcbQ4F9wl3De8Dj4P/55CnSKPYpHSEIn5JpUz1W0kEyYTRoiqxAvUVNQx1HM0LjT9tIa0HXSadO30evS9DHYMk0hmus6UzSzG/ITlECszawObDdt79lgOIkclpzbnLFcutykPNc8k7y2+U3v8+XUFWAU+Ct4TyhH2EdEVFRSjF8dLYCTxUtTS9DJ0snjZNbl5+XGFXsX7SveVe1Veqn5Tp94ro2Gj6a8VoU3W8dN11jPSVzVQMFQxMjI+aJJgetGsx3zJksPKwDoQeafl252xL3DId7zg1O781VVxX5Lb0wPcByPcBzz4PX28Crzv+PT7zvptBDAHygfZB0eFnAvtCPtAZgk3jIiKvBw1EUMbaxGXffh5vFBCfOLMUd9jtCm9qRFp2PQTmeistFMc2V25yXnOBXpn1M+qF6uXqpaJXkSXP6yMquK4fK/Go5bp6mRd9/WBm8t3ZBuPND9ppWnT7yB3Vj1Y6NF9fLNPtr9kcHL4x8jXsbnnMxPzr368ht5QzjC+E5gzXihcVP6S8b1qNWitfyNls2vrx6+13fjDyNNPh1SbJIEmsEGqYvGgEFwHfeADRIHUhiwgMlQEdUAfYGZYH46Aq+AJFB3KBJWC6kBtIZWZOHQLehOjg8nAjGNFsUexkzhNXDkejw/Fj1CoUpRSwkgtZJRKn+ouQZVwn2hNfE+dTMNH00HrRrtCl0MvSf+UIYSRyFjNpMv0ijmWhZuln/UUmwe7LocYJyPnBtckdxPPad5gPvM9MvysAliBNcGvQl+Ev4tsiVGLC0hoS7pLJUmXyjTJPpP7rsCuaKKUrNylSlBzU7+ugUO+Vdt09ujm6TMb1Bm5mtCZDpmfswy1drCVs5twcHXsczZ2ebbPx+3ngWPuECnMY9RL2bvEl8LvaABlYEWwRSgIaySHRnBHdkVHxnod/pxQmRR7dCx5MwU+jk+lPSGfFp4+kumQtXAqLUcq90VeWoF64deimnMHSihLL5cpX7hXrlXRcUm/qrfaumak1v7qYJ1hffMNkZtnbuPvxDdsNqW3CN0dvJfcrtSx0FnywOohuufu4/An4n2z/ecHnYcZnw2PZo+bPt+euPrKanL+deT01tvkWdS75Dl4/tgH9MfExc+fDb/ELpV+Pfkt8rv+99UfV5Ytl1+u+K2srEatLvx0+zmwprdWu05cD1sf3lDcKNr4ummyWb65sWW/de0X6pfzr6vb0LbD9pWd+If7yCP1SuSACLpI+XFqe/u7EAC40wBs5W5vb5Rvb29VIMnGKwA6gv7632WHjEVq9SWvd1Cv2GjSzv3fx/8ACJO/f7b+X80AAAGbaVRYdFhNTDpjb20uYWRvYmUueG1wAAAAAAA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJYTVAgQ29yZSA1LjEuMiI+CiAgIDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOmV4aWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vZXhpZi8xLjAvIj4KICAgICAgICAgPGV4aWY6UGl4ZWxYRGltZW5zaW9uPjI3PC9leGlmOlBpeGVsWERpbWVuc2lvbj4KICAgICAgICAgPGV4aWY6UGl4ZWxZRGltZW5zaW9uPjI5PC9leGlmOlBpeGVsWURpbWVuc2lvbj4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+Ck5zsgcAAAEqSURBVEgN7VS7joNADEz4AR6ClpI/gQIJGgqgpqRDfCYFlLzhB2jo4YazsiKrKHe6rK7CBRqvxyPveMV93/eb0JCEqh1il6IYSy8fLx//7sC/vJ6+7+M41jTt/ghVVcMwrOsak/u+jxIIoL2+CP5m56iqyjCMl1QIFUXRNA1VQQP53Ev4xh2laYoGz/OGYWClaZqCIMB5kiQ4RAkEpCAzDgO8omVZoOKCxJBlGek4jvM8A5imSefkAMhMiIEfNqPrOoQkSdq2DWBZFnzfB69o2zYa8jzHXACO4+CbZRmWhCnWdUWKEggARAZ4CjYtgfNmsM2yLGnMp57v5LebgW7XdVEU4cW4rou0bVs8HUVRmChKIIDGTUPpcRdGFQJ4Hz8XvRQ/9/BQEO/jF3oLKusHZ04pAAAAAElFTkSuQmCC')\n no-repeat\n left center;\n }\n .markdown-body h1:hover a.anchor .octicon-link, .markdown-body h2:hover a.anchor .octicon-link, .markdown-body h3:hover a.anchor .octicon-link, .markdown-body h4:hover a.anchor .octicon-link, .markdown-body h5:hover a.anchor .octicon-link, .markdown-body h6:hover a.anchor .octicon-link {\n display: none;\n }\n </style>\n </head>\n <body class=\"markdown-body\" style=\"padding:10px 40px;\">\n <div class=\"readme-content\">\n #{preview_html}\n </div>\n </body>\nCONTENT\n output_file_content\n end", "def stylesheet_path(source, options={})\n path = compute_public_path(source, 'assets', options.merge(:ext => 'css'))\n options[:body] ? path + \"?body=1\" : path\n end", "def render_stylesheet_includes\n return \"\".html_safe unless respond_to?(:stylesheet_links)\n \n stylesheet_links.uniq.collect do |args|\n stylesheet_link_tag(*args)\n end.join(\"\\n\").html_safe\n end", "def css_proc_evaluate(record)\n @css_proc and @css_proc.call(record) or \"\"\n end", "def stylesheet_link_tag(*sources)\n html = []\n sources.each do |stylesheet|\n if is_uri?(stylesheet)\n path = stylesheet\n else\n path = url(\"/css/#{stylesheet}.css\")\n end\n html << \"<link href=\\\"#{path}\\\" type=\\\"text/css\\\" rel=\\\"stylesheet\\\" />\"\n end\n return html.join(\"\\n\")\n end", "def render_style(&block)\n [ style.to_s, yield, parent_style ].join\n end", "def initialize_css_style_conversion; end", "def layout_4print\n return '' if @parent.params[:renderer].blank?\n opts = @opts.dup\n opts[:method] = @parent.params[:method]\n klass = (@parent.params[:renderer] + '_renderer').classify\n obj = Kernel.const_get(klass, Class.new).new(@parent, opts)\n# \n html = obj.render_html\n @css << obj.render_css.to_s\n html\nend", "def rewrite_inline_code(code)\n # chance_files refer, usually, to sprites.\n code.gsub!(/chance_file\\([\"'](.*?)['\"]\\)/) {|match|\n path = entry[:resource_name] + \"-\" + $1\n \"static_url('#{path}')\"\n }\n\n code.gsub!(/external_file\\([\"'](.*?)['\"]\\)/) {|match|\n \"static_url('#{$1}')\"\n }\n\n # look for sc_require, require or sc_resource. wrap in comment\n code.gsub!(/((sc_require|require|sc_resource)\\(\\s*['\"].*[\"']\\s*\\)\\s*\\;)/, '/* \\1 */')\n replace_static_url(code)\n code\n end", "def compile_inline(file, options = {})\n initial_options = options.merge({})\n options = {\n check_for_changes: false,\n sub_template: false,\n collect_stats: false,\n initial_options: initial_options\n }.merge(options)\n @scope = options[:scope]\n file = Pathname.new(file) unless options[:string]\n run_erb(file, options).strip\n end", "def stylesheet(*sources)\n options = sources.extract_options!.symbolize_keys\n options.reverse_merge!(media: 'screen', rel: 'stylesheet', type: 'text/css')\n sources.collect do |source|\n tag(:link, options.reverse_merge(href: asset_path(source, :css)))\n end.join(\"\\n\")\n end", "def file_path\n 'main.css'\n end", "def css(name, *args) #path, files=[])\n js_or_css :css, name, *args\n end" ]
[ "0.73388714", "0.7177927", "0.7145281", "0.7145281", "0.7145281", "0.69604695", "0.6903996", "0.68207973", "0.68207973", "0.68207973", "0.68207973", "0.67115486", "0.65801316", "0.6567717", "0.65592366", "0.65117866", "0.6504101", "0.64504164", "0.642595", "0.6414162", "0.63959014", "0.6264648", "0.62044054", "0.6152426", "0.6152426", "0.6147256", "0.6134091", "0.61144894", "0.6111068", "0.6105587", "0.6005675", "0.59795904", "0.5973061", "0.5919396", "0.5916959", "0.59135973", "0.58776146", "0.58568877", "0.5854829", "0.5854829", "0.5854209", "0.5854209", "0.5847449", "0.5828478", "0.5813488", "0.5808219", "0.5801493", "0.57948023", "0.57817566", "0.57817566", "0.5776305", "0.5769232", "0.5756101", "0.57415015", "0.5732081", "0.5716347", "0.5709856", "0.57089984", "0.5694824", "0.5662245", "0.5662245", "0.56541103", "0.5651753", "0.5650478", "0.5649459", "0.56463027", "0.56423074", "0.56339204", "0.562369", "0.56056416", "0.5603833", "0.56032324", "0.5598878", "0.5590413", "0.5589485", "0.5589357", "0.5589357", "0.5589357", "0.55838454", "0.55765915", "0.55762917", "0.55732524", "0.5567381", "0.55660814", "0.5554889", "0.55515707", "0.5551501", "0.55111", "0.5511068", "0.55025387", "0.54972196", "0.5490731", "0.54900575", "0.5487941", "0.54871607", "0.5470943", "0.5470209", "0.54669297", "0.5459963", "0.5451324" ]
0.64273715
18
Converts any volume unit to fluid ounces
def convert_to_fl_oz(amount, unit) case unit when 'gallon' then amount * 128 when 'quart' then amount * 32 when 'pint' then amount * 16 when 'cup' then amount * 8 when 'fl_oz' then amount when 'Tbsp' then amount * 0.5 when 'tsp' then amount * 0.1666666666667 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_volume_cuft\n self.volume_cuft = (self.length_ins/12) * (self.width_ins/12) * (self.height_ins/12)\n end", "def unit \n\t\t\tunitq = self.dup\n\t\t\tmagnitude = self.abs\n\t\t\tunitq[0] /= magnitude\n\t\t\tunitq[1] /= magnitude\n\t\t\tunitq[2] /= magnitude\n\t\t\tunitq[3] /= magnitude\n\t\t\treturn unitq\n\t\tend", "def calculate_volume(units)\n units.reduce(0) do |sum, unit|\n volume = unit.volume\n raise GameLogicError.new(\"#{unit} does not have volume!\") \\\n if volume.nil?\n\n sum + volume\n end\n end", "def si_unit\n return Unit.steridian if describe == 'solid angle'\n return Unit.radian if describe == 'plane angle'\n\n val = si_base_units\n return nil unless val\n return val[0] if val.length == 1\n val = val.inject(Unit.unity) do |compound,unit|\n compound * unit\n end\n val = val.or_equivalent unless val.acts_as_equivalent_unit\n end", "def volume\n return nil if dimension_u.nil? || dimension_v.nil? || dimension_w.nil?\n (dimension_u * dimension_v * dimension_w) / 1_000_000_000.0\n end", "def convert_to(unit)\n unit = Unit.get(unit) if unit.is_a?(Symbol)\n self.normalize + unit.denormalize\n end", "def converted_value(other_unit)\n if other_unit.special?\n other_unit.magnitude scalar\n else\n scalar / other_unit.scalar\n end\n end", "def total_volume(with_unit)\n if with_unit\n (quantity * volume.to_d).to_s + unit\n else\n quantity * volume.to_d\n end\n end", "def volume (l, w, h)\n\tl * w * h\nend", "def volume\n @length * @width * @depth\n end", "def volume_calc(length,width,height)\n volume = length * width * height\n end", "def unit\n parts[3]\n end", "def volume\n return (4.0/3.0) * Math::PI * self.radius**3\n end", "def handle_u\n @unit = @tokens[@index].get_tag(Unit).type\n @index += 1\n @precision = :unit\n end", "def convert_to_emu(dim_str)\n value, unit = dim_str.match(/(^\\.?\\d+\\.?\\d*)(\\w+)/).to_a[1..-1]\n value = value.to_f\n\n if unit == \"cm\"\n value = value * 360000\n elsif unit == \"in\"\n value = value * 914400\n else\n throw ArgumentError, \"Unsupported unit '#{unit}', only 'cm' and 'in' are permitted.\"\n end\n\n value.round()\n end", "def quarts\n Measurements::USVolume.new(self, :quart)\n end", "def units\n @units = SQF.units @this\n @units\n end", "def volume_ft3\n self.volume\n end", "def fl_oz\n Measurements::USVolume.new(self, :fl_oz)\n end", "def ref_to_unit(value)\n result = nil\n if self.uom_type == 'big'\n result = value/self.ratio\n elsif self.uom_type == 'small'\n result = value * self.ratio\n elsif self.uom_type == 'ref'\n result = value\n end\n result.to_f\n end", "def convert_to(unit, value_in_unit)\n target_unit = UnitOfMeasure.find_by(name: unit)\n\n if target_unit.uom_category != self.uom_category\n return value_in_unit\n #raise StandardError, \"Can only convert to measurment units in the same category\"\n end\n\n incoming_ref_value = target_unit.to_ref(value_in_unit)\n\n result_unit_value = self.ref_to_unit(incoming_ref_value) \n result_unit_value.to_f\n end", "def volume(amount: T.unsafe(nil)); end", "def liquid_cube(volume_cuft, equiptype)\n return number_to_percentage(volume_cuft.to_f / Equipment.where(:equip_name => equiptype).first.cb_limit_cuft * 100, precision: 2)\n end", "def Kelvin(intemp, inunit)\n if inunit == 'f'\n (((intemp - F_TO_K_CONVERSION1) / F_TO_K_CONVERSION2) + F_TO_K_CONVERSION3)\n elsif inunit == 'c'\n intemp + C_TO_K_CONVERSION\n elsif inunit == 'r'\n intemp / R_TO_K_CONVERSION\n end\n end", "def convertUnitValue(value,unit)\n if (unit.present?)\n unit.strip!\n else\n return value\n end\n unitRegEx=/^([afpnu\\xC2\\xB5\\316\\274mcdhkMGTPE]?)[ ]*(.+)/\n matchSet=unitRegEx.match(unit)\n if (matchSet.nil?)\n return value\n else\n prefix=matchSet[1]\n baseUnit=matchSet[2]\n case prefix\n when \"a\"\n mult=1.0E-18\n when \"f\"\n mult=1.0E-15\n when \"p\"\n mult=1.0E-12\n when \"n\"\n mult=1.0E-9\n when \"u\",\"\\316\\274\",\"\\xC2\\xB5\"\n mult=1.0E-6\n when \"m\"\n mult=1.0E-3\n when \"c\"\n mult=1.0E-2\n when \"d\"\n mult=1.0E-1\n when \"\"\n mult=1.0\n when \"h\"\n mult=1.0E2\n when \"k\"\n mult=1.0E3\n when \"M\"\n mult=1.0E6\n when \"G\"\n mult=1.0E9\n when \"T\"\n mult=1.0E12\n when \"P\"\n mult=1.E15\n when \"E\"\n mult=1.0E18\n else\n mult=1.0\n end\n return value*mult\n end\n end", "def falcon (vol)\r\n if vol < 50\r\n return 1\r\n else\r\n tubes = vol / 50\r\n if vol % 50 > 1\r\n return tubes + 1\r\n end\r\n end\r\n end", "def unit_converter(value, input_unit, output_unit)\n\t\treturn 0 if value == 0\n\t\treturn value if input_unit.downcase == output_unit.downcase\n\n\t\tif input_unit.downcase == 'gb'\n\t\t\tif output_unit.downcase == 'mb'\n\t\t\t\treturn value * 1024\n\t\t\tend\n\t\telse\n\t\t\tif input_unit.downcase == 'mb'\n\t\t\t\tif output_unit.downcase == 'gb'\n\t\t\t\t\treturn value / 1024\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif input_unit.downcase == 'tb'\n\t\t\t\t\tif output_unit.downcase == 'gb'\n\t\t\t\t\t\treturn value * 1024\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def cups\n Measurements::USVolume.new(self, :cup) \n end", "def inventory_for_superficie_presentation_unit_type_measurement\n surface = packing_material.presentation_unit_type_measure.side_dimension_x * packing_material.presentation_unit_type_measure.side_dimension_y\n inventories.map(& :quantity).inject(0) { |s,v| s += v } * surface\n end", "def volume\n return @width * @height / @depth\n end", "def cVolume r,l,m\n return 0 if r == 0\n z = r-m\n l*(r*r * Math.acos(z/r)-z*(2*r*m - m*m)**0.5)\nend", "def base_unit\n units[0]\n end", "def autosizedPlantLoopVolume\n\n result = OpenStudio::OptionalDouble.new()\n\n name = self.name.get.upcase\n \n model = self.model\n \n sql = model.sqlFile\n \n if sql.is_initialized\n sql = sql.get\n \n query = \"SELECT Value \n FROM tabulardatawithstrings \n WHERE ReportName='ComponentSizingSummary' \n AND ReportForString='Entire Facility' \n AND TableName='PlantLoop' \n AND RowName='#{name}' \n AND ColumnName='Plant Loop Volume'\n AND Units='m3'\"\n \n val = sql.execAndReturnFirstDouble(query)\n \n if val.is_initialized\n result = OpenStudio::OptionalDouble.new(val.get)\n end\n \n end\n\n return result\n \n end", "def convert_temp(value,unit)\n if unit.chomp == \"f\"\n puts \"fahrenheit: #{value}\"\n puts \"to Celcius: #{((value.to_i - 32) / 1.8).round(2)}\"\n puts \"to Kelvin: #{((value.to_i + 459.67) / 1.8).round(2)}\"\n elsif unit.chomp == \"C\"\n puts \"Celcius: #{value}\"\n puts \"to fahrenheit: #{(value.to_i * 1.8 + 32).round(2)}\"\n puts \"to Kelvin: #{(value.to_i + 273.15).round(2)}\"\n else\n puts \"Kelvin: #{value}\"\n puts \"to fahrenheit: #{(value.to_i * 1.8 - 459.67).round(2)}\"\n puts \"to Celcius: #{(value.to_i - 273.15).round(2)}\"\n end\nend", "def volume(options)\n options[:width] * options[:height] * options[:depth]\nend", "def unit_helper(number, from_unit_string, to_unit_string)\n OpenStudio.convert(OpenStudio::Quantity.new(number, OpenStudio.createUnit(from_unit_string).get), OpenStudio.createUnit(to_unit_string).get).get.value\n end", "def series_volume\n end", "def toF\n if @unit == 'C' then\n @unit = 'F'\n @value = 1.8 * @value + 32.0\n elsif @unit == 'R' then\n @unit = 'F'\n @value -= 459.67\n elsif @unit == 'K' then\n @unit = 'F'\n @value = 1.8 * @value - 459.67\n end\n self\n end", "def volume_calculations ops\n ops.each do |op|\n p = op.input(INPUT).item.get :passage\n op.temporary[:passage] = p + 1 if p\n op.temporary[:passage] ||= 1\n op.temporary[:req_cells] = op.required_cells\n op.temporary[:cell_vol] = (op.temporary[:req_cells] / op.input(INPUT).item.cell_density)\n op.temporary[:media_vol] = working_volume_of(op.output(OUTPUT).object_type) - op.temporary[:cell_vol] || 0.0\n op.temporary[:media_vol] = 0 if op.temporary[:media_vol] < 0\n op.temporary[:volume] = op.temporary[:cell_vol] + op.temporary[:media_vol]\n\n in_plate = op.input(INPUT).item\n from_plate_id = in_plate.get :from\n\n op.error :from_plate_id_not_defined, \":from not defined\" if from_plate_id.nil?\n from_plate = Item.find_by_id(from_plate_id)\n op.error :cannot_find_original_plate, \"Could not find original plate with id #{from_plate_id}.\" if from_plate.nil?\n op.temporary[:from_plate] = from_plate if from_plate\n end\n end", "def volume; self.class.volume; end", "def floor\n Quantity.new(@value.floor, @unit)\n end", "def vu(value=1)\n @music.vu(value.to_i)\n end", "def pints\n Measurements::USVolume.new(self, :pint)\n end", "def get_volume\n return get_floor_height.to_f * get_area.to_f\n end", "def swap_units(unit)\n case unit\n when 'imperial'\n 'metric'\n when 'metric'\n 'imperial'\n end\n end", "def get_volume_of_cuboid(length, width, height)\n return length * width * height\nend", "def sfx_volume=(value)\n value = value.to_i.abs\n @sfx_volume = value < 101 ? value : 100\n end", "def convert_bytes_to_unit(data:, unit:)\n case unit\n when 'kb' then @usage = data.to_i / 1024\n when 'mb' then @usage = data.to_i / 1024 / 1024\n when 'gb' then @usage = data.to_i / 1024 / 1024 / 1024\n end\n end", "def convert_temp(value, fromUnits)\t\n\t\tif fromUnits == \"F\"\n\t\t\tconverted_value = (value - 32) / 1.8\n\t\telsif fromUnits == \"C\"\n\t\t\tconverted_value = (1.8 * value) + 32\n\t\tend\t\t\n\t\treturn converted_value.round\n\tend", "def get_volume\n @volume\n end", "def sfx_volume\n return @sfx_volume\n end", "def volume\n a, b, c, d = @points\n ((a - d) % ((b - d) * (c - d))) / 6\n end", "def unit_helper(number, from_unit_string, to_unit_string)\n converted_number = OpenStudio.convert(OpenStudio::Quantity.new(number, OpenStudio.createUnit(from_unit_string).get), OpenStudio.createUnit(to_unit_string).get).get.value\n end", "def unit_helper(number, from_unit_string, to_unit_string)\n converted_number = OpenStudio.convert(OpenStudio::Quantity.new(number, OpenStudio.createUnit(from_unit_string).get), OpenStudio.createUnit(to_unit_string).get).get.value\n end", "def UNIT(*values)\n first, second = values\n Unit.convert_to(first, second)\n end", "def standard\n # lookup system unit of same kind and is base unit\n conv = type.conversions.find do |c|\n c.base? &&\n c.kind == kind &&\n c.system == Stick.default\n end\n #unit = Unit.register.find do |u|\n # u.base? &&\n # u.type == self.type &&\n # u.system == Stick.default\n #end\n # convert to univesral and from universal to standard\n #unit.from_universal(universal)\n conv.call(universal)\n end", "def unit_vector\n len = self.r\n raise Vector::ZeroOperationError if (len == 0.0)\n self * (1.0/len)\n # Mageo::Vector3D.new(@x*(1.0/len), @y*(1.0/len), @z*(1.0/len))\n end", "def volume_m3\n ft3_to_m3(self.volume)\n end", "def units\n self.ListUnits.first.map { |u| map_unit(u) }\n end", "def unit\n return @units[@index]\n end", "def unit\n return @units[@index]\n end", "def calc_input_vol(ops)\n input_vol_arr = ops.map {|op|\n op.input_array(INPUT).items.map {|i|\n if i.object_type.name == \"Fragment Stock\"\n conc = i.get('concentration').to_f\n if debug # In production fragments will be nanodropped and concentration will be associated before this calculation\n (conc.nil? || conc == 0) ? conc = 42 : conc\n end\n vol = (FRAG_CONC / conc).round(2)\n else\n conc = i.get('concentration_uM').to_f\n (conc.nil? || conc == 0) ? conc = 10 : conc # Primer Aliquots are always diluted to 10uM in Rehydrate Primer\n vol = (PRIMER_CONC / conc).round(2)\n end\n }\n }\n return input_vol_arr\n end", "def unit\n self.dup.unit!\n end", "def unit_conversion\n if user.metric_system?\n self.distance = Goal.kms_to_miles(distance) if distance.present?\n self.vertical_gain = Goal.meters_to_feet(vertical_gain) if vertical_gain.present?\n end\n end", "def volume(x, y, z)\r\n x * y * z\r\nend", "def normalize\n @value = case @kind\n when 'fixed' then @value*1024\n when 'enum', 'range' then @value.map{ |v| v*1024 }\n end if @unit == 'GB'\n end", "def unit=(value)\n @unit = value\n end", "def uomd\n @framework_rate = @framework_rates[@service_ref].to_f\n\n # benchmark rate set here\n @benchmark_rate = @benchmark_rates[@service_ref].to_f\n\n @uomd =\n if @supplier_name && @rate_card.data['Discounts'][@supplier_name][@service_ref]\n (1 - @rate_card.data['Discounts'][@supplier_name][@service_ref]['Disc %'].to_f) * @uom_vol * @rate_card.data['Prices'][@supplier_name][@service_ref][@building_data['fm-building-type']].to_f\n else\n @uom_vol * @framework_rate\n end\n rescue StandardError => e\n raise e\n end", "def metric_volume(amount: T.unsafe(nil)); end", "def work_in unit, from = \"g\"\n (work.to_s + from).to_unit.convert_to(unit).scalar.to_f\n end", "def volume \n puts \"The volume is #{@length * @width * @height}\"\n end", "def vol_decr\n %x[pactl set-sink-input-volume #{self.input_id} -- -5%]\n new_vol = vol_perc - 5\n new_vol = 0 if new_vol < 0\n @args[:props][\"volume\"] = \"0: #{new_vol}% 1: #{new_vol}%\"\n return nil\n end", "def definition=(unit)\n base = unit.to_base\n @scalar = base.scalar\n @kind = base.kind\n @numerator = base.numerator\n @denominator = base.denominator\n self\n end", "def volume(x, y, z)\n x * y * z\nend", "def rescale\r\n unless self.is_si?\r\n return self.to_base_unit.rescale\r\n end\r\n scale=Math.log10(self.value)+self.unit.scale\r\n\r\n unit_scales=self.class.si_unit_scales.sort\r\n\r\n if scale<unit_scales[0][0]\r\n return self.send unit_scales[0][1].name\r\n end\r\n if scale>=unit_scales.last[0]\r\n return self.send unit_scales.last[1].name\r\n end\r\n unit_scales.each_cons(2) do |us|\r\n if us[0][0]<=scale && us[1][0]>scale\r\n return self.send us[0][1].name\r\n end\r\n end\r\n end", "def volume_size\n # If not user-specified, I'm using a fudge factor of 1.5 on the volume size -- arbitrarily chosen\n @volume_size || (`du -x #{volume_to_bundle}`.split(/\\n/)[-1].split[0].to_f * 1.5 / 1024).ceil\n end", "def volume\n @cr[0xe] & 0x0f\n end", "def unit_s\n self.unit.to_s if self.unit\n end", "def si_unit\n return self if self.dimensions.is_dimensionless?\n @dimensions.si_unit\n end", "def inventory_for_longitudinal_presentation_unit_type_measurement\n inventories.map(& :quantity).inject(0) { |s,v| s += v } * packing_material.quantity\n end", "def normalize\n divide(magnitude)\n end", "def set_volume(volume)\n puts \"Setting volume to #{volume}\" if $verbose\n v='AG'+(('000'+volume.to_s)[-3..-1])+';'\n puts v if $verbose\n ret=send_cmd(v,'AG;',v,0.5,1.5,3)\n if(ret)\n return(ret.gsub(/^AG/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend", "def to_unit(other = nil)\n other ? RubyUnits::Unit.new(self).convert_to(other) : RubyUnits::Unit.new(self)\n end", "def normalize(measurement)\n group_name = Alchemist.conversion_table.keys.find do |k|\n Alchemist.conversion_table[k].include?(measurement.unit_name)\n end\n group = Alchemist.conversion_table[group_name]\n base_unit = BASE_UNITS.find { |u| group.include?(u) }\n measurement.to.send(base_unit).to_s\n end", "def update_unit_price\n return if @packs.empty?\n lowest = @packs.min_by{|pack| pack.quantity}\n @unit_price = (lowest.price / lowest.quantity).to_f.round(2)\n end", "def toC\n if @unit == 'F' then\n @unit = 'C'\n @value = 5.0 / 9.0 * (@value - 32.0)\n elsif @unit == 'R' then\n @unit = 'C'\n @value = 5.0 / 9.0 * @value - 273.15\n elsif @unit == 'K' then\n @unit = 'C'\n @value -= 273.15\n end\n self\n end", "def reciprocalize\n Unit.unity / self\n end", "def as unit\n check_unit! unit\n dist = self.dup\n dist.number = convert_to_meters * meters_map[unit]\n dist.unit = unit\n dist \n end", "def unstationUnit(unit)\n\t\t@db.srem('sgt-structure:' + @id + ':units', unit.id)\n\tend", "def unit_vector\n\t\tlen = self.r\n\t\traise Vector::ZeroOperation if (len == 0)\n\t\tself * (1/len)\n\t\t# Vector3D.new(@x*(1.0/len), @y*(1.0/len), @z*(1.0/len))\n\tend", "def volume_adjustment\n @ole.VolumeAdjustment\n end", "def compute_fuel(element)\n (element/3).floor - 2\n end", "def ensure_volume_stored_in_ft3\n if self.moving.unit == \"metric\"\n self.volume = m3_to_ft3(self.volume)\n end\n end", "def toK\n if @unit == 'F' then\n @unit = 'K'\n @value = 5.0 / 9.0 * (@value + 459.67)\n elsif @unit == 'C' then\n @unit = 'K'\n @value += 273.15\n elsif @unit == 'R' then\n @unit = 'K'\n @value *= 5.0 / 9.0\n end\n self\n end", "def hollow_cube_volume(length_inner,length_outer)\n\n volume_cube(lentgh_outer)-volume_cube(length_outer)\n \n end", "def convertCelsius\r\n case self.myScale\r\n when 'K'\r\n self.myDegrees = (self.myDegrees - 273.15)\r\n self.myScale = 'C'\r\n when 'F'\r\n self.myDegrees = ((self.myDegrees - 32.0) * (5.0/9.0))\r\n self.myScale = 'C'\r\n end\r\n end", "def revolution_per_meter? = unit == 'revolution-per-meter'", "def unit!(x=1,y=1,z=1)\n scale!(1/modulus)\n end", "def apply_unit(v, col_scale)\n\t\ta, b = /(.*\\d)\\s*_?\\s*([mnul]{,3})\\s*$/.match(v)[1..2]\n\t\t#raise \"invalid size unit\" unless b\n\t\ts = Dim_Hash[b] || col_scale\n\t\treturn Float(a) * s # may raise exception if a is not a valid float\n\tend", "def inch_to_feet_converter\n\t \n\t end" ]
[ "0.63185173", "0.62543666", "0.619648", "0.61569655", "0.6132664", "0.61048853", "0.6023394", "0.5948282", "0.57917583", "0.5787916", "0.5677867", "0.56621045", "0.5655582", "0.56539744", "0.565364", "0.5649837", "0.56407523", "0.5622799", "0.56084067", "0.56078565", "0.55997956", "0.5585004", "0.5573653", "0.55461943", "0.5544484", "0.5530875", "0.5522048", "0.55209845", "0.5520917", "0.5520862", "0.55143565", "0.54992807", "0.5497195", "0.54941744", "0.549008", "0.5488065", "0.5484844", "0.54633886", "0.5450138", "0.5444528", "0.5439891", "0.54136145", "0.54078025", "0.5378661", "0.53699785", "0.5369356", "0.5358334", "0.5345765", "0.5342209", "0.53421634", "0.5328786", "0.5327862", "0.53195673", "0.53195673", "0.5319049", "0.5313375", "0.5308926", "0.52898353", "0.52848834", "0.52841985", "0.52841985", "0.5276541", "0.52745533", "0.52701813", "0.526562", "0.52459395", "0.52456963", "0.5242201", "0.5241874", "0.5239328", "0.52370995", "0.523504", "0.5232243", "0.52211463", "0.521264", "0.521167", "0.52080166", "0.51896995", "0.5185826", "0.5170714", "0.5161036", "0.51595616", "0.51473564", "0.51440895", "0.51424664", "0.5132728", "0.51320547", "0.51243776", "0.5122683", "0.5120818", "0.51148975", "0.5113819", "0.50932163", "0.50908", "0.50843775", "0.5082955", "0.5079464", "0.5072592", "0.5067819", "0.5060637" ]
0.5966355
7
< for display, saves 2 lines
def initialize(name) # All tech has a name, no? @name = name @labs = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n \"\\t#{@line}: #{first_line}\"\n end", "def show_line\n say \"=\" * 25\nend", "def show\n\t puts \"\t#{@spaces[0]} #{@spaces[1]} #{@spaces[2]}\"\n\t puts \"\t#{@spaces[3]} #{@spaces[4]} #{@spaces[5]}\"\n\t puts \"\t#{@spaces[6]} #{@spaces[7]} #{@spaces[8]}\"\n\tend", "def hline_top\n\tputs \"__________________________________________________________\"\nend", "def h_line\n puts \"-\" * 80\n nil\nend", "def h_line\n puts \"-\" * 50\n nil\nend", "def drawTop\n attron(color_pair(1))\n addstr(\"< \")\n attroff(color_pair(1))\n attron(color_pair(2))\n addstr(\"^ \")\n attroff(color_pair(2))\n attron(color_pair(3))\n addstr(\"> \")\n attroff(color_pair(3))\n attron(color_pair(4))\n addstr(\"v \")\n attroff(color_pair(4))\nend", "def render_spacer\n puts \"\\n\"\n end", "def display\n to_s.split(\"\\n\")\n .map { |line| line.split('').join(' ') }\n .join(\"\\n\")\n end", "def line(length)\r\n puts '-'*length\r\n end", "def line\n\tputs \"-\" * 100\nend", "def d(data)\n data.send :display \n \"\\n\".send :display\nend", "def short_vertical_line\n html = <<-eol\n <div class=\"short-line-container\">\n <div class=\"fam-tree-marked-right\"></div>\n <div class=\"fam-tree-unmarked\"></div>\n </div>\n eol\n html.html_safe\n end", "def hor_line\n\tfor i in 1..40\n\t\tprint \"-\"\n\tend\n\tputs ''\nend", "def print_horizontal_line(length)\n print '+'\n (length - 2).times do |index|\n print '-'\n end\n print '+'\n print \"\\n\"\n end", "def pline(left, right)\n %{<li><font size=\"+1\"><b>#{left}</b> over #{right}</font>\n }\nend", "def display\n puts @o\n puts @a\n puts @b\n puts @c\n puts @d\n puts @e\n puts @f\n puts @g\n puts @h\n puts @i\n puts \" \"\n end", "def opening_lines \n puts \"What would you like to do?\"\n puts \"(C)reate, (L)ist, (U)pdate, (D)elete, (Q)uit\"\n end", "def show()\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs (@@board[7] + '\t|\t' + @@board[8] + '\t|\t' + @@board[9])\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[4] + '\t|\t' + @@board[5] + '\t|\t' + @@board[6])\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[1] + '\t|\t' + @@board[2] + '\t|\t' + @@board[3])\n\t\tputs (' \t|\t' + ' \t|\t')\n\tend", "def line_to_wrap; end", "def begin_of_line\n write_raw \"\\r\"\n end", "def put_a_line\n puts \"\\n\"\n puts \"/\\\\\" * 40\n puts \"\\n\"\n end", "def display(line, column=0) #:yield:\n result = \"\\e[s\"\n result << \"\\e[#{line.to_i};#{column.to_i}H\"\n if block_given?\n result << yield\n result << \"\\e[u\"\n #elsif string\n # result << string\n # result << \"\\e[u\"\n end\n result\n end", "def inspect\n original_inspect = super\n original_inspect.split( ' ' ).first << '>'\n end", "def inspect\n original_inspect = super\n original_inspect.split( ' ' ).first << '>'\n end", "def inspect\n original_inspect = super\n original_inspect.split( ' ' ).first << '>'\n end", "def prev_line; end", "def display(line, column=0)\n result = \"\\e[s\"\n result << \"\\e[#{line.to_i};#{column.to_i}H\"\n result << to_s\n result << \"\\e[u\"\n result\n end", "def floor_separation\r\n\t\tprint \"|\"\r\n\t\tprint \"-\" * 40\r\n\t\tputs \"|\"\r\n\tend", "def tagline; end", "def insert_landscape\n puts (\"\\u{1f4b5}\" + \" \" + \"\\u{1f4b4}\" + \" \" + \"\\u{1f4b6}\" + \" \" + \"\\u{1f4b7}\" + \" \") * 8 # line of cash?\n end", "def line\n\t\tl = @name\n\t\t(1..25).each do |i|\n\t\t\tl += \" &\"\n\t\t\tif i <= @number then\n\t\t\t\tl += \" \\\\!$\\\\times$\"\n\t\t\tend\n\t\tend\n\t\tl += \" \\\\\\\\\\n\"\n\t\treturn l\n\tend", "def render\n\t\tprint \"cl1 cl2 cl3 cl4 cl5 cl6 cl7 cl8 cl9 c10\\n\"\n\t\t(0..9).each do |row|\n\t\t\t(0..9).each do |col|\n\t\t\t\tif @grid[row][col].is_flagged\n\t\t\t\t\tprint \"FLG\"\n\t\t\t\telsif @grid[row][col].is_hidden\n\t\t\t\t\tprint \" \"\n\t\t\t\telsif @grid[row][col].surrounding_bombs > 0\n\t\t\t\t\tprint \" #{@grid[row][col].surrounding_bombs} \"\n\t\t\t\telsif @grid[row][col].has_bomb\n\t\t\t\t\tprint \"POW\"\t\t\t\t\t\n\t\t\t\telse print \"xxx\"\n\t\t\t\tend\n\t\t\t\tprint \"|\" unless col == 9\n\t\t\t\tprint \"row#{row + 1}\\n\" if col == 9\n\t\t\tend\n\t\tend\n\tend", "def render\n out = HighLine.new\n out.wrap_at = 78\n out.say <<-RENDER\n<%=color(\"#{@name}\", :bold)%> [#{@category.upcase}]\n<%='-'*#{@name.length}%>\n#{@description}\nRENDER\n end", "def show_blank(p)\r\n set_cursor p\r\n print Normal\r\n print \" \"*@disks + \"|\" + \" \"*@disks\r\n update\r\n end", "def display(line, column = T.unsafe(nil)); end", "def display(line, column = T.unsafe(nil)); end", "def display(line, column = T.unsafe(nil)); end", "def stamp\n @output.write(\"#{ESC}o\")\n end", "def display_over(msg)\n msg = \"\\r#{msg}\"\n stdout.print msg\n return msg\n end", "def line(text, length=20)\n puts \"-\" * length\n puts text \nend", "def taph\n tap {\n puts \"<pre>\" +\n \"#{File.basename caller[2]}: #{self.inspect}\".gsub('&', '&amp;').gsub('<', '&lt;') +\n \"</pre>\"\n }\n end", "def display_lines(min, max, lines)\n puts \"\\n[#{min}, #{max}] in #{@state.file}\"\n\n (min..max).to_a.zip(lines[min-1..max-1]).map do |l|\n mark = l[0] == @state.line ? '=> ' : ' '\n puts format(\"#{mark}%#{max.to_s.size}d: %s\", l[0], l[1])\n end\n end", "def dump\r\n super + \"##{@first_index};\\t// #{to_s}\"\r\n end", "def detail\n \"#{line}\\n#{' ' * line_offset}^\"\n end", "def draw_line\n print H_SEP * columns\n end", "def display\n puts \" #{self.cells[0]} | #{self.cells[1]} | #{self.cells[2]} \"\n puts \"-----------\"\n puts \" #{self.cells[3]} | #{self.cells[4]} | #{self.cells[5]} \"\n puts \"-----------\"\n puts \" #{self.cells[6]} | #{self.cells[7]} | #{self.cells[8]} \"\n end", "def br\n output \"\"\n end", "def perform_v2\n @n.downto(1) do |i|\n @line.insert(i-1, 'X')\n puts @line\n end\n reset\n end", "def single_line?; end", "def display\n puts \" #{@cells[0]} \" + \"|\" + \" #{@cells[1]} \" + \"|\" + \" #{@cells[2]} \"\n puts \"-----------\"\n puts \" #{@cells[3]} \" + \"|\" + \" #{@cells[4]} \" + \"|\" + \" #{@cells[5]} \"\n puts \"-----------\"\n puts \" #{@cells[6]} \" + \"|\" + \" #{@cells[7]} \" + \"|\" + \" #{@cells[8]} \"\n end", "def educate stream=$stdout\n width # just calculate it now; otherwise we have to be careful not to\n # call this unless the cursor's at the beginning of a line.\n\n left = {}\n @specs.each do |name, spec| \n left[name] = \"--#{spec[:long]}\" +\n (spec[:short] ? \", -#{spec[:short]}\" : \"\") +\n case spec[:type]\n when :flag; \"\"\n when :int; \" <i>\"\n when :string; \" <s>\"\n when :float; \" <f>\"\n end\n end\n\n leftcol_width = left.values.map { |s| s.length }.max || 0\n rightcol_start = leftcol_width + 6 # spaces\n\n unless @order.size > 0 && @order.first.first == :text\n stream.puts \"#@version\\n\" if @version\n stream.puts \"Options:\"\n end\n\n @order.each do |what, opt|\n if what == :text\n stream.puts wrap(opt)\n next\n end\n\n spec = @specs[opt]\n stream.printf \" %#{leftcol_width}s: \", left[opt]\n desc = spec[:desc] + \n if spec[:default]\n if spec[:desc] =~ /\\.$/\n \" (Default: #{spec[:default]})\"\n else\n \" (default: #{spec[:default]})\"\n end\n else\n \"\"\n end\n stream.puts wrap(desc, :width => width - rightcol_start - 1, :prefix => rightcol_start)\n end\n end", "def lineBreak \n \"lineBreak\" \n end", "def spacer\n puts \"\\n----------------------------\\n\"\nend", "def newline; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def line; end", "def escape\n puts \"\"\n puts \" \" + \"_\" * 40\n puts \"\"\n end", "def separator\n puts \" \"\n puts pastel.bright_magenta(\"======================================================\")\n puts \" \"\n end", "def separator\n puts \" \"\n puts pastel.bright_magenta(\"======================================================\")\n puts \" \"\n end", "def separator\n puts \" \"\n puts pastel.bright_magenta(\"======================================================\")\n puts \" \"\n end", "def print_head\n system \"clear\"\n puts $line_break\n puts \"## ___ ___ ______________ __________ _________ ##\"\n puts \"## / _ )/ _ /_ __/_ __/ / / __/ __/ // / _/ _ \\\\ ##\"\n puts \"## / _ / __ |/ / / / / /__/ _/_\\\\ \\\\/ _ // // ___/ ##\"\n puts \"##/____/_/ |_/_/ /_/ /____/___/___/_//_/___/_/ ##\"\n puts \"## ##\"\n end", "def draw_eol\n print \"\\r\\e[#{columns - 1}C#{V_SEP}\\n\"\n end", "def display\n\t\tputs \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n\t\tputs \"-----------\"\n\t\tputs \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n\t\tputs \"-----------\"\n\t\tputs \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n\tend", "def print_divider\n\t\tputs \"------------------------------------------------------------\"\n\tend", "def erase_line_to_both\n ConsoleGlitter.escape('2K')\n end", "def draw\n\t\tputs \"\\n\"\n\t\tmid = (@height/2.0).ceil\n\t\tfor line in 1..@height\n\t\t\tspace0 = (mid - (mid-line).abs).abs\n\t\t\tspace1 = (mid - line).abs * 2 - 1\n\t\t\tputs space1 > 0 ?\n\t\t\t\t \" \" * space0 + \"X \" + \" \" * space1 + \"X\" :\n\t\t\t\t \" \" * space0 + \"X\"\n\t\tend\n\tend", "def empty_line\n puts\" \" * 70\nend", "def display_position\n side = \" \\u2551\"\n puts \" \\u2554\" + \"\\u2550\" * 16 + \"\\u2557\"\n current_position.each do |row|\n row_string = row.join(\" \")\n puts side + row_string + side\n end\n puts \" \\u255A\" + \"\\u2550\" * 16 + \"\\u255D\"\n if @current_state[:check]\n puts\n puts \"Check!\"\n end\n end", "def display_lines(min, max); end", "def show\n data, format = [], []\n \n update(:elapsed, (Time.now - @start_time).to_i)\n \n sorted = @data.sort { |a,b| a[1][:order]<=>b[1][:order] }\n sorted.each do |item|\n format << \"#{item[0].to_s.capitalize}: #{item[1][:format]}\"\n data << item[1][:value] \n end\n \n $stdout.printf(format.join(' | ') + \"\\r\", *data)\n $stdout.flush\n end", "def display_header\n puts \" 1 2 3 4 5 6 7 8 9 10\"\n puts \" -----------------------------------------\"\n end", "def display_commandes\n puts <<-EOT\n\n(Taper 'aide' pour obtenir de l'aide)\n\n EOT\n end", "def display_commandes\n puts <<-EOT\n\n(Taper 'aide' pour obtenir de l'aide)\n\n EOT\n end", "def lines; end", "def lines; end", "def show_cursor; puts \"\\e[?25h\" end", "def edit\n p \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n p \"-----------------------\"\n super\n end", "def left(times=1)\n write_raw \"\\b\" * times\n end", "def new_line\n biggest = @biggest_text_height > WLH ? @biggest_text_height : WLH\n @contents_x = 0 \n @contents_y += biggest\n @biggest_text_height = WLH\n end", "def render\n @board.each.with_index do |row, y|\n row.each.with_index do |item, x|\n chr = item.nil? ? \" \" : item\n print \" #{chr} \"\n print \"|\" unless x == row.size - 1\n end\n print \"\\n-----------\\n\" unless y == @board.size - 1\n end\n print \"\\n\"\n end", "def draw_current \t \n \t\" #{@spaces[:space_1]} | #{@spaces[:space_2]} | #{@spaces[:space_3]}\\n\" +\n \t\t\t\t\t \" _____|_____|____\\n\" +\n \t\" #{@spaces[:space_4]} | #{@spaces[:space_5]} | #{@spaces[:space_6]}\\n\" +\n \t\t\t\t\t \" _____|_____|____\\n\" +\n \t\" #{@spaces[:space_7]} | #{@spaces[:space_8]} | #{@spaces[:space_9]}\\n\" +\n \t\t\t\t\t\t \" | | \\n\\n\"\n end", "def draw_both\n \t\" #{@spaces[:space_1]} | #{@spaces[:space_2]} | #{@spaces[:space_3]}\\t\\t\" +\n \t\" #{@sample[:space_1]} | #{@sample[:space_2]} | #{@sample[:space_3]}\\n\" +\n \t\t\t\t\t \" _____|_____|____\\t\\t\" + \" _____|_____|____\\n\" + \t\n \t\" #{@spaces[:space_4]} | #{@spaces[:space_5]} | #{@spaces[:space_6]}\\t\\t\" +\n \t\" #{@sample[:space_4]} | #{@sample[:space_5]} | #{@sample[:space_6]}\\n\" +\n \t\t\t\t\t \" _____|_____|____\\t\\t\" + \" _____|_____|____\\n\" +\n \t\" #{@spaces[:space_7]} | #{@spaces[:space_8]} | #{@spaces[:space_9]}\\t\\t\" +\n \t\" #{@sample[:space_7]} | #{@sample[:space_8]} | #{@sample[:space_9]}\\n\" +\n \t\t\t\t\t \" | | \\t\\t\" + \" | | \\n\\n\"\n end", "def format(lines, cur_no)\n lastno = lines.keys.max\n lines.map do |num, line|\n sign = num + 1 == cur_no ? '=> ' : ' ' * 3\n super('%s%*d: %s', sign, lastno.to_s.size, num + 1, line)\n end.join(\"\\n\")\n end", "def render\n puts \" #{(0..7).to_a.join(' ')}\"\n (0..7).each do |row|\n puts \"#{row} #{print_row(@board.grid[row] , row).join('|')}\"\n puts\n end\n end", "def display\n\t\tbreakline = \"---- --- ----\"\n\t\tputs breakline.center(@linewidth)\n\t\tputs \"| #{@board[:one]} | #{@board[:two]} | #{@board[:three]} |\".center(@linewidth)\n\t\tputs breakline.center(@linewidth)\n\t\tputs \"| #{@board[:four]} | #{@board[:five]} | #{@board[:six]} |\".center(@linewidth)\n\t\tputs breakline.center(@linewidth)\n\t\tputs \"| #{@board[:seven]} | #{@board[:eight]} | #{@board[:nine]} |\".center(@linewidth)\n\t\tputs breakline.center(@linewidth)\n\t\tputs \"\".center(@linewidth)\n\tend", "def draw_blank\n puts \"[ o ] [ o ] [ o ] [ o ]\\n\\n\"\n end", "def line\n 1\n end" ]
[ "0.6524168", "0.6281164", "0.620696", "0.6149297", "0.6138587", "0.6100393", "0.6074554", "0.6027136", "0.6015493", "0.60114795", "0.6003745", "0.59653664", "0.59642315", "0.59380025", "0.5906678", "0.58989495", "0.58560777", "0.5827698", "0.5815967", "0.58006495", "0.5786588", "0.5761648", "0.57340014", "0.57286507", "0.57286507", "0.57286507", "0.5707272", "0.5685277", "0.5673455", "0.5671032", "0.5656191", "0.56497186", "0.5638382", "0.56199837", "0.5616865", "0.56150055", "0.56150055", "0.56150055", "0.55863726", "0.55696017", "0.55663157", "0.5565561", "0.5564484", "0.5550763", "0.5536354", "0.5536132", "0.55336696", "0.55287725", "0.55180204", "0.5510824", "0.5505734", "0.5503469", "0.550229", "0.5501349", "0.5491408", "0.54887795", "0.54887795", "0.54887795", "0.54887795", "0.54887795", "0.54887795", "0.54887795", "0.54887795", "0.54887795", "0.54887795", "0.54887795", "0.54887795", "0.54887795", "0.54887795", "0.54887795", "0.5488477", "0.54865044", "0.54865044", "0.54865044", "0.5485038", "0.5479526", "0.54770046", "0.54737335", "0.5471752", "0.54685485", "0.5464315", "0.5461571", "0.5460089", "0.5459743", "0.5448515", "0.54452646", "0.54452646", "0.54446805", "0.54446805", "0.54416424", "0.5436675", "0.5434265", "0.5433891", "0.5432478", "0.54235137", "0.5423459", "0.5422749", "0.5421399", "0.5414959", "0.5402909", "0.54013985" ]
0.0
-1
Executes a command in the Heroku Toolbelt
def heroku(command) system("GEM_HOME='' BUNDLE_GEMFILE='' GEM_PATH='' RUBYOPT='' /usr/local/heroku/bin/heroku #{command}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heroku(command)\n s = system(\"GEM_HOME='' BUNDLE_GEMFILE='' GEM_PATH='' RUBYOPT='' /usr/local/heroku/bin/heroku #{command}\")\nend", "def heroku(cmd)\n Bundler.with_clean_env { system(\"heroku #{cmd}\") }\nend", "def run(cmd_type, command = nil, options = {}, &block)\n command = cmd_type.to_s if command.nil?\n heroku_options = (options.delete(:heroku) || {}).map {|k,v| \"--#{k.to_s.shellescape}=#{v.to_s.shellescape}\"}.join(\" \")\n heroku_command = \"heroku run #{command.to_s.shellescape} -a #{name} #{ heroku_options }\"\n bundle_exec do\n if block_given?\n ReplRunner.new(cmd_type, heroku_command, options).run(&block)\n else\n `#{heroku_command}`\n end\n end\n end", "def heroku(command = {})\n in_root do\n if command.is_a?(Symbol)\n log 'running', \"heroku #{command}\"\n run \"heroku #{command}\"\n else\n command.each do |command, options|\n log 'running', \"heroku #{command} #{options}\"\n run(\"heroku #{command} #{options}\")\n end\n end\n end\n end", "def deploy!\n puts \"Adding and committing compiled output for deployment..\"\n puts %x[git add .]\n puts %x[git commit -a -m \"temporary commit for deployment\"]\n puts 'Deploying to Heroku..'\n puts %x[git push heroku HEAD:master --force]\nend", "def deploy!\n puts \"Adding and committing compiled output for deployment..\"\n puts %x[git add .]\n puts %x[git commit -a -m \"temporary commit for deployment\"]\n puts 'Deploying to Heroku..'\n puts %x[git push heroku HEAD:master --force]\nend", "def show_usage\n puts 'paroku environment heroku_command'\nend", "def deploy_heroku(name, app_url)\n deploy_loader = loader(\"Deploying and running installation of app...\", nil)\n branch_name = \"#{name}#{Time.now.strftime(\"%d-%m-%Y-%H-%M\")}\"\n url = get_stripped_url(app_url, false)\n stripped_url = get_stripped_url(app_url, true)\n @cmd.run(\"rm -rf .git\")\n @cmd.run(\"git init\")\n @cmd.run(\"heroku git:remote -a #{name}\")\n @cmd.run(\"heroku config:set SECRET_KEY_BASE=$(rake secret)\") rescue TTY::Command::ExitError\n @cmd.run(\"heroku config:set APP_URL=#{url}\") rescue TTY::Command::ExitError\n @cmd.run(\"heroku config:set APP_STRIPPED_URL=#{stripped_url}\") rescue TTY::Command::ExitError\n unless @cmd.run(\"heroku addons\").out.include? \"heroku-redis\"\n begin\n @cmd.run(\"heroku addons:create heroku-redis:hobby-dev\")\n rescue TTY::Command::ExitError\n error_box(\"App #{name} failed. Please ensure that you are on the Hobby Dev payment tier or above.\")\n raise ArgumentError\n end\n end\n unless @cmd.run(\"heroku domains -a #{name}\").out.include? stripped_url\n begin\n @cmd.run(\"heroku domains:add #{stripped_url} -a #{name}\")\n rescue TTY::Command::ExitError\n error_box(\"Setting custom URL #{stripped_url} failed.\")\n raise ArgumentError\n end\n end\n unless @cmd.run(\"heroku buildpacks -a #{name}\").out.include? \"apt\"\n begin\n @cmd.run(\"heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt.git -a #{name}\")\n @cmd.run(\"heroku buildpacks:add --index 2 heroku/ruby -a #{name}\")\n @cmd.run(\"heroku config:set GI_TYPELIB_PATH=/app/.apt/usr/lib/x86_64-linux-gnu/girepository-1.0\") rescue TTY::Command::ExitError\n rescue TTY::Command::ExitError\n error_box(\"Setting buildpacks failed.\")\n raise ArgumentError\n end\n end\n\n @cmd.run(\"git config --global core.autocrlf true\")\n @cmd.run(\"git checkout -b #{branch_name}\")\n @cmd.run(\"git add .\")\n @cmd.run(\"git add -f config\")\n @cmd.run(\"git commit -m '#{name}'\")\n @cmd.run(\"git push -f heroku #{branch_name}:main\")\n deploy_loader.stop\n stripped_url\nend", "def run_console_command(url, command, prefix=nil)\n output = post(url, { :command => command }, :accept => \"text/plain\").to_s\n return output unless prefix\n if output.include?(\"\\n\")\n lines = output.split(\"\\n\")\n (lines[0..-2] << \"#{prefix}#{lines.last}\").join(\"\\n\")\n else\n prefix + output\n end\n rescue RestClient::RequestFailed => e\n if e.http_code == 422\n Heroku::Command.extract_error(e.http_body, :raw => true)\n else\n raise e\n end\n end", "def git command, *args\n run 'git', command.to_s, *args\nend", "def exec\n binding.pry\n # command.run(*service.exec(args.command))\n end", "def rake\n deprecate(\"`heroku #{current_command}` has been deprecated. Please use `heroku run rake` instead.\")\n command = \"rake #{args.join(' ')}\"\n run_attached(command)\n end", "def heroku\n name = shift_argument || options[:app] || ENV['HEROKU_APP']\n validate_arguments!\n no_remote = !options[:no_remote].nil?\n remote = options[:remote]\n remote = \"heroku\" if remote == nil\n addons = options[:addons]\n password = options[:password]\n password = newpass if password == nil\n info = api.post_app({\n \"name\" => name,\n \"stack\" => \"cedar\"\n }).body\n begin\n action(\"Creating #{info['name']}\") do\n if info['create_status'] == 'creating'\n Timeout::timeout(options[:timeout].to_i) do\n loop do\n break if api.get_app(info['name']).body['create_status'] == 'complete'\n sleep 1\n end\n end\n end\n if info['region']\n status(\"region is #{info['region']}\")\n else\n status(\"stack is #{info['stack']}\")\n end\n end\n \n (addons || \"\").split(\",\").each do |addon|\n addon.strip!\n action(\"Adding #{addon} to #{info[\"name\"]}\") do\n api.post_addon(info[\"name\"], addon)\n end\n end\n\n api.put_config_vars(info[\"name\"], \"BUILDPACK_URL\" => \"http://github.com/heathprovost/openbd-heroku.git\")\n api.put_config_vars(info[\"name\"], \"OPENBD_PASSWORD\" => password)\n hputs([ info[\"web_url\"], info[\"git_url\"] ].join(\" | \"))\n \n rescue Timeout::Error\n \n hputs(\"Timed Out! Run `heroku status` to check for known platform issues.\")\n \n end\n\n unless no_remote\n create_git_remote(remote, info[\"git_url\"])\n end\n\n feature = api.get_features.body.detect { |f| f[\"name\"] == \"user-env-compile\" }\n throw \"Heroku labs feature \\\"user-env-compile\\\" is not available\" unless feature\n api.post_feature(\"user-env-compile\", info['name'])\n\n end", "def execute(command)\n end", "def golang_exec(command)\n DeliveryGolang::Helpers.golang_exec(command, node)\n end", "def console\n puts \"`heroku #{current_command}` has been removed. Please use: `heroku run` instead.\"\n puts \"For more information, please see:\"\n puts \" * https://devcenter.heroku.com/articles/one-off-dynos\"\n puts \" * https://devcenter.heroku.com/articles/rails3#console\"\n puts \" * https://devcenter.heroku.com/articles/console-bamboo\"\n end", "def run_app(command, arguments)\nend", "def execute_command(command)\n end", "def execute_command(command)\n end", "def run(cmd)\n shell_out! \"#{jboss_cli} '#{cmd}'\", cli_options\n end", "def execute(command) # rubocop:disable Lint/UnusedMethodArgument\n end", "def run_command\n # this should probably be run without bundle exec, I guess\n 'git status --porcelain'\n end", "def execute(command)\n system(command)\n end", "def execute(command)\n sh('-c',command)\n end", "def run_cmd(cmd)\n Dir.chdir(Rails.root) {\n #@output = `cd #{CTMWEB_PATH} && #{cmd} 2>&1`\n cmd = \"#{cmd}\"\n @output = `#{cmd}`\n }\n result = $?.success?\n if result\n print \"OK\\n\".green\n else\n print \"ERROR\\n\".red\n puts \"#{@output.to_s.red}\"\n send_to_flowdock(\"CTMWEB\", \"Deployment for #{Rails.env.upcase} failed. (CMD: #{cmd})\", @tags)\n abort \"Deployment Halted.\".red\n end\nend", "def deploy!\n puts \"Adding and committing compiled output for deployment..\"\n puts %x[git add .]\n puts %x[git commit -a -m \"temporary commit for deployment\"]\n puts 'Deploying to Github pages..'\n puts %x[git push origin HEAD:gh-pages --force]\nend", "def run_locally(cmd)\n logger.trace \"executing locally: #{cmd.inspect}\" if logger\n `#{cmd}`\n end", "def execute(command)\n system \"#{command}\" # rubocop:disable UnneededInterpolation\nend", "def run_command\n cmd = case params[:button_id]\n when \"run-jsdoc\" then \"npm run jsdoc --silent\"\n when \"run-js-unit-tests\" then \"npm run teaspoon --silent\"\n when \"run-js-acceptance-tests\" then \"rails test:system RAILS_ENV=test\"\n when \"run-rails-unit-tests\" then \"rails test RAILS_ENV=test\"\n end\n\n task_id = Tasky.run cmd\n render json: params.merge(task_id: task_id)\n rescue Tasky::CommandError => e\n render json: params.merge(cmd_error: e.inspect)\n end", "def execute(command)\n if remote?\n @remote.exec(command)\n else\n rays_exec(command)\n end\n end", "def command(command, *args)\n @shell.command(command, *args)\n end", "def run_command(command)\n `#{command}`\nend", "def execute\n parse_command\n run_command(command)\n end", "def exec(command)\n #logger.debug { \"Github: Executing command: '#{command}'\" }\n #p \"Github: Executing command: '#{command}'\"\n \n # Get a path to a temp file\n #logfile = Tempfile.new('github__exec')\n #logfile.close\n \n #success = system(\"#{command} > #{logfile.path} 2>&1\")\n #output_from_command = File.readlines(logfile.path)\n #output_from_command = %x[command]\n shell = Shell.new(command)\n shell.run\n success = (shell.exitstatus == 0)\n output_from_command = shell.output\n if success\n #logger.debug { \"Github: Command output: #{output_from_command.inspect}\"}\n #p \"Github: Command output: #{output_from_command.inspect}\"\n return output_from_command\n else\n #logger.error { \"Github: Command '#{command}' didn't exit properly. Full output: #{output_from_command.inspect}\"}\n p \"Github: Command failed '#{command}' didn't exit properly. Full output: #{output_from_command.inspect}\"\n end\n \n #ensure\n #logfile.unlink\n end", "def run(host, command, options = {})\n execute(__method__, host, command, options)\n end", "def call( env )\n\n if env[ 'remote.heroku' ] && env[ 'branch' ] != 'master'\n env[ 'branch' ] = '%s:master' % [ env[ 'branch' ] ]\n end\n\n @app.call env\n end", "def execute(command)\n invoke_command(command, nil)\n end", "def exec(command, options={})\n return destination_server.run(command, options)\n end", "def run_a_rake_command(rake_task_and_args)\n command_text = \"cd /opt/supermarket/embedded/service/supermarket && \\\n RAILS_ENV=\\\"production\\\" env PATH=/opt/supermarket/embedded/bin \\\n bin/rake #{rake_task_and_args}\"\n\n shell_out = Mixlib::ShellOut.new(command_text)\n shell_out.run_command\n $stdout.puts shell_out.stdout\n $stderr.puts shell_out.stderr\n exit shell_out.exitstatus\nend", "def run(cmd)\n #logger.trace \"executing locally: #{cmd.inspect}\" if logger\n run_locally cmd\n # puts `#{cmd}`\nend", "def run\n raise \"`#{ real_command }' failed\" unless Kernel.system( real_command )\n end", "def run_installer_command(cmd)\n `#{cmd}`\n end", "def run( args=nil )\n console.error 'Running the generic command!!! WAT? https://www.destroyallsoftware.com/talks/wat'\n end", "def cmd(*args)\n exec_env = env(:dev, 'dev')\n exec_env.cmd(*args)\n ensure\n exec_env.stop!\n end", "def run_command(command)\n ENV['THOR_SHELL'] = 'HTML'\n FileUtils.cd ENV['TM_PROJECT_DIRECTORY'] do\n begin\n EY::CLI.start([command])\n rescue EY::Error => e\n EY.ui.print_exception(e)\n exit(1)\n rescue Interrupt => e\n puts\n EY.ui.print_exception(e)\n EY.ui.say(\"Quitting...\")\n exit(1)\n end\n end\n end", "def run(command, *args)\n send(command, *args)\n end", "def exec(cmd, *rest) end", "def run(command, log_action = true)\r\n log 'executing', \"#{command} from #{Dir.pwd}\" if log_action\r\n `#{command}`\r\n end", "def run\n # Pure git-feats command\n case @args[0]\n when \"feats\"\n run_feats_cmd\n\n # Overriden git command\n when \"version\" || \"--version\"\n version\n\n # Pure git command\n else\n exec_args\n end\n end", "def execute_command(command)\n system(command)\n end", "def remote_command(command, password = nil)\n Net::SSH.start(remote_ip, 'git', :password => password) do |ssh|\n output = ssh.exec!(\"cd #{remote_app_name}\")\n unless output =~ /No such file or directory/\n ssh.exec(\"cd #{remote_app_name} && #{command}\")\n else\n puts \"Your application has not yet been deployed to your Webby.\"\n puts \"To issue remote commands from the Webby, you must first push your application.\"\n end\n end\n end", "def execute(cmd)\n @log.info(\"Executing command '#{cmd}'...\")\n Kernel.system(cmd)\n end", "def process_command\n # Make sure we are running from the correct directory\n puts \"Running from .. \" + Dir.pwd if $DEBUG\n\n # determing which action and forward accordingly\n method = \"cmd_\" + @arguments.shift\n if !respond_to? method\n puts \"do not have `#{method}' in my reportoire ..\"\n output_usage\n end\n send(method, *@arguments)\n rescue ArgumentError\n output_usage\n end", "def git_exec(command, *args)\n Dir.chdir(@grit_repo.working_dir) do\n %x{git #{command} #{args.join(' ')}}\n end\n end", "def execute_command(command)\n raw(*command)\n end", "def call\n Karafka.logger.error('No command provided')\n exit 1\n end", "def exec(cmd, args, opts)\n # lazy-load dependencies to make the plugin as fast as possible\n require 'bolt/target'\n require 'logging'\n\n # opts can contain 'tty', 'stdin', and 'elevate'. If tty is set, apply it\n # to the target for this exec.\n target_opts = @target.transform_keys(&:to_s)\n target_opts['tty'] = true if opts[:tty]\n target = Bolt::Target.new(@target[:uri], target_opts)\n\n logger = Logging.logger($stderr)\n logger.level = :warn\n\n transport = target.transport || 'ssh'\n case transport\n when 'ssh'\n require_relative 'transport_ssh.rb'\n connection = BoltSSH.new(target, logger)\n when 'winrm'\n require_relative 'transport_winrm.rb'\n connection = BoltWinRM.new(target, logger)\n when 'docker'\n require_relative 'transport_docker.rb'\n connection = BoltDocker.new(target)\n else\n raise \"#{transport} unsupported\"\n end\n\n begin\n connection.connect\n # Returns exit code\n connection.execute(cmd, args, stdin: opts[:stdin])\n ensure\n begin\n connection&.disconnect\n rescue StandardError => e\n logger.info(\"Failed to close connection to #{target}: #{e}\")\n end\n end\n end", "def command_exec(name, *args)\n shell_exec command_for(name, *args)\n end", "def run(command)\n result = connection.exec!(command)\n puts \"[BEGIN #{@host}: #{command}]\"\n puts \" #{result}\"\n puts \"[END #{@host}: #{command}]\"\n end", "def exec; end", "def exec; end", "def original_run_command; end", "def exec(cmd)\n puts cmd\n `#{cmd}`\nend", "def script(subcommand, *args); end", "def script(subcommand, *args); end", "def run_command(command, *args)\n `#{command} #{args.join(' ')} 2>/dev/null`\n end", "def execute(command)\n begin\n puts \"* Executing command '#{command}' for the Github API\"\n Timeout.timeout(35) do\n http = Net::HTTP.new(\"github.com\", 80)\n response, content = http.get(\"/api/v1/yaml/#{@user}/#{@repo}/#{command}\")\n content\n end\n rescue Exception => e\n puts \"[!] Error when connecting to Github API (Message: #{e.message})\"\n nil\n end\n end", "def execute(command)\r\n system \"#{command}\"\r\nend", "def execute(cmd)\n send(*cmd)\n end", "def run(cmd)\n result = `#{cmd}`\n raise Castanaut::Exceptions::ExternalActionError if $?.exitstatus > 0\n result\n end", "def execute(cmd)\n Util.execute(cmd)\n end", "def after_release_email(tag, note, type, selector, options) \n command = \"origen web compile --remote --api\" \n Dir.chdir Origen.root do \n system command \n end \n end", "def plugin(command)\n command(command)\n end", "def exe(cmd)\n puts \"executing: #{cmd}\"\n out = `#{cmd}`\n puts out\n out\n end", "def `(cmd) #`\n\t\tRAILS_DEFAULT_LOGGER.debug(\"Running #{cmd}\")\n\t\tKernel.`(cmd) #`\n\tend", "def call(*command); end", "def execute_command(command)\n %x{#{command}}\n end", "def execute command\n log command\n system(command) unless @options[:test]\n end", "def execute(command)\n return if command.empty?\n action_name = command.split(' ').first\n unless @context.action?(action_name)\n @context.puts \"unknown action \\\"#{action_name}\\\"\"\n return Cliqr::Executor::ExitCode.code(nil)\n end\n @context.forward(\"#{@base_command} #{command}\", environment: @context.environment)\n rescue StandardError => e\n @context.puts e.message\n end", "def execute(command)\n system \"#{command}\"\nend", "def execute(command)\n system \"#{command}\"\nend", "def execute(command, options = {})\n options.merge! timeout: 3600, cwd: staging_dir\n shellout!(command, options)\n end", "def exec(command, &block); end", "def execute(command)\n @command = command\n self\n end", "def run\n raise Error, \"Unknown command `#{command_name}`\"\n end", "def run_assets_precompile_rake_task\n # We want to make sure we have all the migrations ready to run, but we\n # don't actually want to run them now because we don't have a database yet.\n sh \"bundle exec rails g spree:install --auto-accept --user_class=Spree::User --enforce_available_locales=true --migrate=false --seed=false --sample=false\"\n\n # We use this instead of solidus_auth:install because this won't run\n # migrations.\n sh \"bundle exec rake railties:install:migrations\"\n\n # Okay, now we want to run whatever heroku normally does for a rails app\n # This includes:\n # * bundle install\n # * install node.js\n # * rake asset:precompile\n super\n end", "def execute_local_command(cmd)\n Bundler.clean_system(cmd)\n end", "def exec(cmd)\n puts g(cmd)\n\n Process.exec(cmd)\n end", "def shell_commands(cmd, args); end", "def exec(cmd)\n container.exec(cmd) { |_, chunk| puts \"#{fqdn.purple}: #{chunk}\" }\n end", "def execute(thing)\n shell.execute(thing)\n $last_res\n end", "def run_cmd(cmd)\n\tend", "def run_cmd(cmd)\n req = JsonRequest.new(\"exec\", cmd.to_hash)\n return req.exec(agent_uri)\n end", "def heroku\n puts Rainbow(\"Step 1. Create new Heroku application\").foreground(:green)\n\n puts \"Please enter the name of the new Heroku application:\"\n name = STDIN.gets.gsub(\"\\n\", \"\")\n\n createapp = nil\n Bundler.with_clean_env do\n createapp = `heroku create #{name}`\n end\n\n if !createapp.include?(\"done, stack is cedar\")\n puts createapp\n choose do |menu|\n menu.prompt = \"Continue?\"\n\n menu.choice \"Yes\" do \n end\n \n menu.choice \"No\" do\n return\n end\n end\n end\n\n environment(name)\n collaborators(name)\n database(name)\n domains(name)\n email(name)\n asset_sync(name)\n end", "def command(args = {}, escape = true)\n SSH.command compile(args), escape\n end", "def execute_hook(command); end", "def execute\n Tools.public_send(command, options.configuration_path)\n end", "def do_action(cmd, options = {})\n # XXX Finish this\n end", "def bundle_exec(command)\n sh \"bundle exec #{command}\"\nend", "def git_fetch\n Command.new(\"git\", \"fetch\", \"--tags\").run!.raise!\nend" ]
[ "0.77212226", "0.72314775", "0.69322175", "0.6915362", "0.68885267", "0.68885267", "0.67473763", "0.64000255", "0.6346544", "0.6271409", "0.62036175", "0.6161484", "0.6151011", "0.6119241", "0.6067952", "0.6039589", "0.60343295", "0.6012852", "0.6012852", "0.5965465", "0.5927666", "0.59273154", "0.5915203", "0.58968294", "0.58966917", "0.58882976", "0.5876646", "0.5873313", "0.5867614", "0.5867456", "0.58559036", "0.585004", "0.58336085", "0.57866526", "0.57748246", "0.577222", "0.5755429", "0.5747703", "0.57449424", "0.5736642", "0.57285625", "0.57228523", "0.5721972", "0.5700579", "0.5687776", "0.56831604", "0.5681341", "0.5673042", "0.56720597", "0.5671394", "0.5660509", "0.5656743", "0.56551445", "0.56452274", "0.56361634", "0.5626666", "0.5623489", "0.5620125", "0.5619195", "0.5618476", "0.5618476", "0.56107473", "0.55911016", "0.5588771", "0.5588771", "0.5586459", "0.5585954", "0.5584094", "0.5573857", "0.55699116", "0.55695677", "0.5558655", "0.5558021", "0.55548644", "0.55448866", "0.5542367", "0.55343205", "0.5524149", "0.5521861", "0.55212563", "0.55212563", "0.5519599", "0.55182713", "0.5517789", "0.5514078", "0.5508507", "0.5507325", "0.5507089", "0.55051184", "0.5499339", "0.54961747", "0.54961467", "0.5489219", "0.5486477", "0.54742664", "0.5472468", "0.54714763", "0.5463653", "0.5460283", "0.54595566" ]
0.7632713
1
GET /ches GET /ches.json
def index @ches = Ch.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @chargers = Charger.all\n render json: @chargers\n end", "def index\n @user_catches = getUserCatches()\n @keepers = getKeepers()\n\n @type_totals = getTypeTotals()\n logger.debug \"user_catches=\" + @user_catches.to_s\n\n @fish_types = FishType.all if @fish_type.nil?\n @users = User.all\n respond_to do |format|\n format.html\n format.json { render json: @user_catches }\n end\n end", "def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend", "def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end", "def show\n @cheer = Cheer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cheer }\n end\n end", "def show\n @he = He.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @he }\n end\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def show\n @cheque = Cheque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cheque }\n end\n end", "def index\n champions = Champion.all\n render json: champions\n end", "def show\n @cherup = Cherup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cherup }\n end\n end", "def get_reading\n\t\turi = URI.parse('http://localhost:5000/thermometers.json')\n\t\tthermo_response = Net::HTTP.get_response(uri)\n\t\tcheck = thermo_response.body\n\t\tj = JSON.parse(check)\n\tend", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chore }\n end\n end", "def show\n @chuyen = Chuyen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chuyen }\n end\n end", "def index\n @frais_hebergements = FraisHebergement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_hebergements }\n end\n end", "def index\n @clues = Clue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clues }\n end\n end", "def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end", "def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end", "def show\n @catch = Catch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @catch }\n end\n end", "def show\n @habit = Habit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @habit }\n end\n end", "def get_all\n hitches = ::Hitch.where(shared?: true).where(\"submit_time > now()\").near([params[:user_latitude],params[:user_longitude]], 20)\n\n serializer = HitchSerializer.new(hitches, { params: { user_latitude: params[:user_latitude], user_longitude: params[:user_longitude] } })\n render json: serializer.serializable_hash\n end", "def index\n @heroes = Hero.all\n\n render json: @heroes\n end", "def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end", "def index\n weathers = Weather.all\n render json: weathers, status: 200\n end", "def index\n @electors = Elector.all\n\n render json: @electors\n end", "def index\n @teaches = Teach.all\n\t\trespond_to do |format|\n\t\t\tformat.html { render :index }\n\t\t\tformat.json { render json: Oj.dump(@teaches) }\n\t\tend\n\n end", "def index\n @teaches = Teach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end", "def show\n @what = What.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @what }\n end\n end", "def get_all\n\t\trender json: {quests: Quest.all.as_json(include: :images)}\n\tend", "def index\n @heights = Height.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heights }\n end\n end", "def show\n @story = Story.find(params[:id])\n @epics = Epic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end", "def show\n @chaine = Chaine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chaine }\n end\n end", "def index\n @you_owe_mes = YouOweMe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @you_owe_mes }\n end\n end", "def index\n @hours = Hour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hours }\n end\n end", "def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end", "def index\n @chairs = Chair.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chairs }\n end\n end", "def index\n @foodhampers = Foodhamper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodhampers }\n end\n end", "def show\n @cue = Cue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cue }\n end\n end", "def index\n @coches = Coche.all\n end", "def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend", "def index\n @economy_hands = EconomyHand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @economy_hands }\n end\n end", "def show\n @hetong = Hetong.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hetong }\n end\n end", "def champs\n conn = Faraday.new(url, request: {open_timeout: 5, timeout: 5}) do |c|\n c.response :json, :content_type => /\\bjson$/\n c.use Faraday::Response::Logger # log request & response to STDOUT\n c.adapter Faraday.default_adapter\n end\n response = conn.get url\n #@hash = response.body['data']\n response.body['data']\n end", "def index\n @kraje = Kraj.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kraje }\n end\n end", "def show\n respond_with @celeb.to_json(:include => :items)\n end", "def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def query\n\n JSON.parse(Net::HTTP.get(self.build_uri))\n\n end", "def index\n sanitized_params = parse_params(client_where_params)\n clients = Client.find_all(sanitized_params)\n render json: clients\n end", "def show\n @heli_kit = HeliKit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heli_kit }\n end\n end", "def emergencias_en_curso\n @emergencies = Emergency.where(:estado => 'f')\n render json: @emergencies\n end", "def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end", "def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end", "def show\n\n respond_to do |format|\n format.json { render json: @cage }\n end\n end", "def index\n @guys = Guy.all\n respond_to do |format|\n format.json { render json: @guys }\n end\n end", "def show\n @chair = Chair.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chair }\n end\n end", "def show\n @chair = Chair.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chair }\n end\n end", "def find\n response = Codeclimate::Api.client.get(@path)\n json = JSON.parse(response.body, :symbolize_names => true)\n @handler.call(json)\n end", "def index\n @jsons = Json.all\n end", "def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end", "def index # public\n if params[:shelter_id]\n set_shelter\n render json: @shelter.animals\n else\n @animals = Animal.includes(:shelter).all\n render 'index.json.jbuilder'\n end\n end", "def index\n respond_to do |format|\n format.html { @chefs = Chef.all }\n format.json { @chefs = Chef.order(:name) }\n end\n end", "def index\n chapters = @project.chapters.all\n render json: { chapters: chapters }\n end", "def index\n @qus = Qu.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @qus }\n end\n end", "def index\n @decks = Deck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decks }\n end\n end", "def index\n @decks = Deck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decks }\n end\n end", "def show\n @meuble = Meuble.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meuble }\n end\n end", "def show\n coach = Coach.find(params[:id])\n json = coach.to_json({:image_url => ActionController::Base.helpers.asset_path(coach.image_url)})\n\n respond_to do |format|\n format.json {render :json => json}\n end\n end", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n\n result\nend", "def index\n @whoarewes = Whoarewe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @whoarewes }\n end\n end", "def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end", "def show\n @huerto = Huerto.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @huerto }\n end\n end", "def show\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gotcha }\n end\n end", "def show\n render json: @elector\n end", "def get_json\n response = @api.request(:get, @location)\n response.body if response.status == 200\n end", "def show\n @messege = Messege.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @messege }\n end\n end", "def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n end\n end", "def index\n @messies = Messy.all\n\n render json: @messies\n end", "def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\n end", "def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend", "def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chore }\n end\n end", "def show\n @gethotel = Gethotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotel }\n end\n end", "def show\n \t\n @json_data = Cause.find(params[:id])\n render_json\n end", "def index\n @enzymes = Enzyme.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enzymes }\n end\n end", "def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end", "def show\n @beer = Beer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beer }\n end\n end", "def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @chore }\n end\n end", "def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @chore }\n end\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def get_data(path)\n begin\n res = RestClient.get(path, headers=@header)\n rescue RestClient::BadRequest\n return {\"error\" => \"Unknown user\"}\n end\n\n return {\"error\" => \"Unknown error\"} if !res or res.code != 200\n\n JSON.load res.body\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish }\n end\n end", "def index\n @hostel_rooms = HostelRoom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hostel_rooms }\n end\n end", "def index\n @jsons = Json.all\n\n\n end", "def index\n @somethings = Something.all\n render json: @somethings\n end", "def index\n @specialties = Specialty.all\n\n render json: @specialties\n end", "def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end", "def show\n render json: @hero\n end" ]
[ "0.6391525", "0.6302974", "0.6247824", "0.62257326", "0.62257326", "0.6216089", "0.6168992", "0.6163543", "0.60941756", "0.6071223", "0.606733", "0.606733", "0.6050587", "0.60294646", "0.6027431", "0.6020038", "0.5995045", "0.5990741", "0.59866554", "0.5961891", "0.5956739", "0.5950131", "0.5931434", "0.5930751", "0.59184057", "0.5909743", "0.589675", "0.5881345", "0.5875672", "0.58727044", "0.5868302", "0.58451504", "0.58351064", "0.58347356", "0.58346003", "0.5833225", "0.58232975", "0.5823095", "0.5817581", "0.58137625", "0.58125514", "0.58120126", "0.5808966", "0.5802393", "0.5798028", "0.57900083", "0.57775974", "0.5770712", "0.5765768", "0.5764048", "0.57363594", "0.5734883", "0.5731854", "0.57313395", "0.5730839", "0.5730839", "0.5730539", "0.57300884", "0.57288754", "0.57288754", "0.5720727", "0.57198864", "0.57182926", "0.5717314", "0.57157046", "0.57135105", "0.57087845", "0.57050216", "0.57050216", "0.5702384", "0.5699669", "0.5699378", "0.5698265", "0.5692868", "0.5687907", "0.5685932", "0.5685059", "0.568163", "0.56777", "0.566841", "0.5667871", "0.5667056", "0.5662569", "0.56603706", "0.56566596", "0.5654131", "0.5653263", "0.56527966", "0.56502634", "0.56502604", "0.56502604", "0.56502324", "0.56501645", "0.5647753", "0.5641995", "0.56366754", "0.5631807", "0.56298393", "0.56294346", "0.5629307" ]
0.5781259
46
GET /ches/1 GET /ches/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @he = He.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @he }\n end\n end", "def show\n @cheer = Cheer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cheer }\n end\n end", "def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end", "def show\n @cherup = Cherup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cherup }\n end\n end", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def show\n @chuyen = Chuyen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chuyen }\n end\n end", "def index\n @chargers = Charger.all\n render json: @chargers\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def show\n @what = What.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @what }\n end\n end", "def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end", "def show\n @heli_kit = HeliKit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heli_kit }\n end\n end", "def show\n @habit = Habit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @habit }\n end\n end", "def show\n @cheque = Cheque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cheque }\n end\n end", "def show\n @hetong = Hetong.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hetong }\n end\n end", "def show\n @huerto = Huerto.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @huerto }\n end\n end", "def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end", "def show\n @chaine = Chaine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chaine }\n end\n end", "def get_one\n test_data = @test.get_one\n return render json: test_data\n end", "def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end", "def show\n client= Client.find_by_id params[:id]\n if client != nil\n render(json: client, status: 200) \n else\n head 404\n end \n end", "def show\n @story = Story.find(params[:id])\n @epics = Epic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end", "def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end", "def show\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gotcha }\n end\n end", "def show\n @hijo = Hijo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hijo }\n end\n end", "def get_reading\n\t\turi = URI.parse('http://localhost:5000/thermometers.json')\n\t\tthermo_response = Net::HTTP.get_response(uri)\n\t\tcheck = thermo_response.body\n\t\tj = JSON.parse(check)\n\tend", "def get_thing(query_hash)\n query = {\"type\" => \"/type/edition\"}.merge(query_hash)\n response = open(@api_url + \"/things?query=\" + CGI.escape(query.to_json) ).read\n JSON.parse(response)\n end", "def show\n @hotele = Hotele.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hotele }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chore }\n end\n end", "def show\n @cue = Cue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cue }\n end\n end", "def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\n end", "def show\n @catch = Catch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @catch }\n end\n end", "def show\n @route = Route.find(params[:id])\n @driver = Hitchhiker.find(@route.hitchhiker_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @route }\n end\n end", "def show\n @meuble = Meuble.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meuble }\n end\n end", "def index # public\n if params[:shelter_id]\n set_shelter\n render json: @shelter.animals\n else\n @animals = Animal.includes(:shelter).all\n render 'index.json.jbuilder'\n end\n end", "def show\n @guitar = Guitar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guitar }\n end\n end", "def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chore }\n end\n end", "def show\n @chair = Chair.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chair }\n end\n end", "def show\n @chair = Chair.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chair }\n end\n end", "def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @chore }\n end\n end", "def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @chore }\n end\n end", "def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end", "def show\n @human = Human.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @human }\n end\n end", "def show\n @human = Human.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @human }\n end\n end", "def show\n @humanidades1 = Humanidades1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades1 }\n end\n end", "def show\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @koti }\n end\n end", "def show\n @gethotel = Gethotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotel }\n end\n end", "def show\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @specie }\n end\n end", "def index\n @hours = Hour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hours }\n end\n end", "def show\n @joy = Joy.find(params[:id])\n render json: @joy\n end", "def show\n \t\n @json_data = Cause.find(params[:id])\n render_json\n end", "def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end", "def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end", "def show\n @herb = Herb.find_by_permalink(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @herb }\n end\n end", "def get(path, params={})\n params = merge_set_up_params(params)\n JSON.parse(Typhoeus::Request.get(API_URL + path, :params => params).body)[\"response\"]\n end", "def show\n @jetty = Jetty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jetty }\n end\n end", "def get\n @dish = Dish.find_by_id(params[:id]) || Dish.find_or_create_by_name(params[:name])\n respond_to do |format|\n format.json { render json: @dish.id }\n end\n end", "def show\n begin\n @fucker = Fucker.find(params[:id])\n respond_to do |format|\n format.json { render json: @fucker }\n end\n rescue => err\n $log.warn(err)\n respond_to do |format|\n format.json { render json: err, status: :internal_server_error }\n end\n end\n end", "def index\n @teaches = Teach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end", "def show\n @beer = Beer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beer }\n end\n end", "def show\n story = Story.find(params[:id])\n render json: story\n end", "def index\n @heroes = Hero.all\n\n render json: @heroes\n end", "def get_handle\n logger.debug \"Hoo ha!\"\n s = Swimmer.find(:all, :conditions => \"last = '#{params[:last]} and first like '#{params[:first]}'\").map {er|x| x.id }\n respond_to do |format|\n json { render s.to_json }\n end\n end", "def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end", "def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end", "def show\n @heat_log = HeatLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heat_log }\n end\n end", "def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end", "def show\n @get = Get.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @get }\n end\n end", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n\n result\nend", "def show\n @joke = Joke.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @joke }\n end\n end", "def show\n @humanidades3 = Humanidades3.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades3 }\n end\n end", "def show\n @lei = Lei.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lei }\n end\n end", "def show\n @kitchen = Kitchen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitchen }\n end\n end", "def show\n @trecho = Trecho.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trecho }\n end\n end", "def index\n champions = Champion.all\n render json: champions\n end", "def index\n weathers = Weather.all\n render json: weathers, status: 200\n end", "def show\n @jam = Jam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jam }\n end\n end", "def show\n @shichoson = Shichoson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shichoson }\n end\n end", "def index\n @frais_hebergements = FraisHebergement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_hebergements }\n end\n end", "def show\n @heat_type = HeatType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heat_type }\n end\n end", "def show\n @qu = Qu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @qu }\n end\n end", "def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def show\n @jugador = Jugador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jugador }\n end\n end", "def show\n @historial = Historial.find(params[:id])\n @receta = Recete.histori(@historial.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial }\n end\n end", "def show\n @beat = Beat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beat }\n end\n end", "def index\n @foodhampers = Foodhamper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodhampers }\n end\n end", "def show\n @bilhete = Bilhete.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bilhete }\n end\n end", "def show\n @hetero24h_r2_fold_change = Hetero24hR2FoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hetero24h_r2_fold_change }\n end\n end", "def show\n @sleuths = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @sleuth.ext_gene + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @sleuth.ext_gene,\n :headers =>{'Content-Type' => 'application/json'} )\n end", "def show\n @cerveja = Cerveja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cerveja }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish }\n end\n end", "def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home }\n end\n end", "def index\n @user_catches = getUserCatches()\n @keepers = getKeepers()\n\n @type_totals = getTypeTotals()\n logger.debug \"user_catches=\" + @user_catches.to_s\n\n @fish_types = FishType.all if @fish_type.nil?\n @users = User.all\n respond_to do |format|\n format.html\n format.json { render json: @user_catches }\n end\n end", "def show\n @qu = Qu.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @qu }\n end\n end", "def show\n @kolegiji = Kolegiji.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegiji }\n end\n end", "def show\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thing }\n end\n end", "def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end" ]
[ "0.6355792", "0.6195883", "0.61624986", "0.6125565", "0.6115646", "0.6105024", "0.60832334", "0.6082654", "0.6069918", "0.6069918", "0.605923", "0.60553277", "0.605386", "0.60398036", "0.6012151", "0.5993252", "0.5975535", "0.5966247", "0.59573203", "0.59573203", "0.5927208", "0.59211975", "0.5905082", "0.58947974", "0.589302", "0.5886533", "0.58849466", "0.5873332", "0.5861411", "0.5859442", "0.58469856", "0.5845913", "0.58440614", "0.5840551", "0.58265847", "0.58165234", "0.58124554", "0.5782456", "0.5757657", "0.57554454", "0.5753783", "0.57496345", "0.57496345", "0.57485485", "0.57485485", "0.5746117", "0.5745752", "0.5745752", "0.57441413", "0.5740772", "0.573476", "0.57320946", "0.5731373", "0.5726573", "0.572378", "0.57218015", "0.5715759", "0.5713892", "0.5711053", "0.5710106", "0.57092327", "0.57050896", "0.5704344", "0.5698034", "0.56980133", "0.5697334", "0.5693958", "0.56876564", "0.56876564", "0.56828195", "0.5677779", "0.5677574", "0.5676668", "0.5671571", "0.5670539", "0.5670259", "0.56702536", "0.5668051", "0.5667398", "0.5654467", "0.5648423", "0.5643545", "0.56432116", "0.5629309", "0.56277317", "0.56269217", "0.56259114", "0.5625781", "0.5621262", "0.5620801", "0.5620141", "0.56182903", "0.56181115", "0.5616674", "0.56142586", "0.56130224", "0.56126714", "0.56090957", "0.560725", "0.56041896", "0.560062" ]
0.0
-1
POST /ches POST /ches.json
def create @ch = Ch.new(ch_params) respond_to do |format| if @ch.save # format.html { redirect_to @ch, notice: 'Ch was successfully created.' } format.js# { redirect_to @ch, notice: 'Ch was successfully created.' } # format.json# { render :show, status: :created, location: @ch } else format.html { render :new } format.json { render json: @ch.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def create\n render json: Post.create(params[\"post\"])\n end", "def create\n @cheque = Cheque.new(params[:cheque])\n\n respond_to do |format|\n if @cheque.save\n format.html { redirect_to @cheque, notice: 'Cheque was successfully created.' }\n format.json { render json: @cheque, status: :created, location: @cheque }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cheque.errors, status: :unprocessable_entity }\n end\n end\n end", "def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end", "def create\n @hoge = Hoge.new(params[:hoge])\n\n respond_to do |format|\n if @hoge.save\n format.html { redirect_to @hoge, notice: 'Hoge was successfully created.' }\n format.json { render json: @hoge, status: :created, location: @hoge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hoge.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end", "def create\n @mechon = Mechon.new(mechon_params)\n\n respond_to do |format|\n if @mechon.save\n format.html { redirect_to @mechon, notice: 'Mechon was successfully created.' }\n format.json { render :show, status: :created, location: @mechon }\n else\n format.html { render :new }\n format.json { render json: @mechon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cheer = Cheer.new(params[:cheer])\n\n respond_to do |format|\n if @cheer.save\n format.html { redirect_to @cheer, notice: 'Cheer was successfully created.' }\n format.json { render json: @cheer, status: :created, location: @cheer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cheer.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n #puts \"🤖 POST #{path}\"\n #puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n #puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n #puts result[:result]\n result\nend", "def post(path, data = {})\n request 'POST', path, body: data.to_json\n end", "def create\n \n\n respond_to do |format|\n if @huati.save\n format.html { redirect_to @huati, notice: 'Huati was successfully created.' }\n format.json { render json: @huati, status: :created, location: @huati }\n else\n format.html { render action: \"new\" }\n format.json { render json: @huati.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @chamado = Chamado.new(params[:chamado])\n\n respond_to do |format|\n if @chamado.save\n #fmt = '/chamados/%s.json'\n #response = fmt % [@chamado.id]\n format.html { redirect_to @chamado, notice: 'Chamado was successfully created.' }\n format.html { render json: @chamado, status: :created, location: @chamado }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chamado.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sach = Sach.new(sach_params)\n\n respond_to do |format|\n if @sach.save\n format.html { redirect_to @sach, notice: \"Sach was successfully created.\" }\n format.json { render :show, status: :created, location: @sach }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sach.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @survey = Survey.find(params[:survey_id])\n emoji = params[:emoji]\n mood = params[:mood]\n @feeling = Feeling.new(mood: mood, emoji: emoji)\n @survey.feelings << @feeling\n\n if @feeling.save\n render :ok, json: @feeling\n else\n @errors = @feelings.error.full_messages\n render json: {message: @errors}, status: :unprocessable_entity\n end\n\n if !@survey\n render json: {message: [\"Survey is Required!\"] }, status: :unprocessable_entity\n end\n end", "def create\n @chemical = Chemical.new(chemical_params)\n if @chemical.save!\n render json: @chemical\n else\n render json: {errors: @chemical.errors.full_messages}\n end\n end", "def create\n @cheque = Cheque.new(cheque_params)\n\n respond_to do |format|\n if @cheque.save\n format.html { redirect_to @cheque, notice: 'Cheque was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cheque }\n else\n format.html { render action: 'new' }\n format.json { render json: @cheque.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(path, json, params = {})\n if path.include?('covid19')\n request = Net::HTTP::Post.new(path, @headers)\n else\n request = Net::HTTP::Post.new('/v2' + path, @headers)\n end\n request.add_field('Content-Type', 'application/json')\n request.body = json\n params.each do |k, v|\n request[k] = v\n end\n send_request(request)\n end", "def post_check(excon, body)\n excon.request(\n method: :post,\n path: '/check',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend", "def create\n @gotcha = Gotcha.new(params[:gotcha])\n\n respond_to do |format|\n if @gotcha.save\n format.html { redirect_to gotchas_url, notice: 'Gotcha was successfully created.' }\n format.json { render json: @gotcha, status: :created, location: @gotcha }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gotcha.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @meuble = Meuble.new(params[:meuble])\n\n respond_to do |format|\n if @meuble.save\n format.html { redirect_to @meuble, notice: 'Meuble was successfully created.' }\n format.json { render json: @meuble, status: :created, location: @meuble }\n else\n format.html { render action: \"new\" }\n format.json { render json: @meuble.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cherup = Cherup.new(params[:cherup])\n\n respond_to do |format|\n if @cherup.save\n format.html { redirect_to @cherup, notice: 'Cherup was successfully created.' }\n format.json { render json: @cherup, status: :created, location: @cherup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cherup.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @my_room = MyRoom.find(params[:my_room_id])\n @my_rack = @my_room.my_racks.new(my_rack_params)\n respond_to do |format|\n if @my_rack.save\n format.html { redirect_to my_room_my_rack_path(@my_room, @my_rack), notice: 'Стелаж успешно создан.' }\n format.json { render :show, status: :created, location: @my_rack }\n else\n format.html { render :new }\n format.json { render json: @my_rack.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cheep = Cheep.new(cheep_params)\n\n respond_to do |format|\n if @cheep.save\n format.html { redirect_to @cheep, notice: 'Cheep was successfully created.' }\n format.json { render :show, status: :created, location: @cheep }\n else\n format.html { render :new }\n format.json { render json: @cheep.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fact = @cat.facts.create!({ fact: api_request })\n if @fact.save\n render json: @fact\n else\n render error: { message: \"Não foi possível criar esse fato para este gatinho! :(\" }, status: 400\n end\n end", "def create\n render json: Dish.create(dish_params)\n end", "def create\n @dish = @cafeteria.dishes.new(dish_params)\n\n respond_to do |format|\n if @dish.save\n format.html { redirect_to @cafeteria, notice: 'El plato se ha creado.' }\n format.json { render :show, status: :created, location: @dish }\n else\n format.html { redirect_to @cafeteria, alert: 'No se pudo crear el plato.' }\n format.json { render json: @dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hero = Hero.new(hero_params)\n\n if @hero.save\n render json: @hero, status: :created, location: @hero\n else\n render json: @hero.errors, status: :unprocessable_entity\n end\n end", "def create\n @onske = Onske.new(params[:onske])\n\n respond_to do |format|\n if @onske.save\n format.html { redirect_to @onske, notice: 'Onske was successfully created.' }\n format.json { render json: @onske, status: :created, location: @onske }\n else\n format.html { render action: \"new\" }\n format.json { render json: @onske.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @chuyen = Chuyen.new(params[:chuyen])\n\n respond_to do |format|\n if @chuyen.save\n format.html { redirect_to @chuyen, notice: 'Chuyen was successfully created.' }\n format.json { render json: @chuyen, status: :created, location: @chuyen }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chuyen.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @chaine = Chaine.new(params[:chaine])\n\n respond_to do |format|\n if @chaine.save\n format.html { redirect_to @chaine, notice: 'Chaine was successfully created.' }\n format.json { render json: @chaine, status: :created, location: @chaine }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chaine.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def create\n @niche = current_user.niches.new(processed_params)\n if @niche.save\n render json: { status: 'ok' }\n else\n render json: { status: @niche.errors.to_a.join('base') }\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def create\n @quete = Quete.new(quete_params)\n\n respond_to do |format|\n if @quete.save\n format.html { redirect_to @quete, notice: 'quete was successfully created.' }\n format.json { render :show, status: :created, location: @quete }\n else\n format.html { render :new }\n format.json { render json: @quete.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend", "def create\n\n\t\t\t\ttparams = params.require(:testimony).permit :quote,:author\n\n\t\t\t\t@testimony = Testimony.new tparams\n\n\t\t\t\tif @testimony.save\n\n\t\t\t\t\trender json: @testimony,status: 201\n\n\t\t\t\telse\n\n\t\t\t\t\trender json: {errors: @testimony.errors},status: 422\n\n\t\t\t\tend\n\n\t\t\tend", "def create\n if @mission.torched_by? current_user\n return respond_to do |format|\n format.html { redirect_to mission_path(@mission) }\n format.json { head :no_content }\n end\n end\n @mission.torches.create torcher: current_user\n respond_to do |format|\n # TODO: notification and activity\n format.html { redirect_to mission_path(@mission), notice: t('missions.torch_awarded_successfully') }\n format.json { render json: { count: @mission.torches.count } }\n end\n end", "def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end", "def create\n @tack = Tack.new(tack_params)\n\n if @tack.save\n render json: @tack, status: :created, location: @tack\n else\n render json: @tack.errors, status: :unprocessable_entity\n end\n end", "def post(json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name].compact.join('/')\n url += \"/\"\n return HTTParty.post(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def post(*args)\n super(*wrap_for_json_api(*args))\n end", "def create\n @cha = Cha.new(cha_params)\n\n respond_to do |format|\n if @cha.save\n format.html { redirect_to @cha, notice: 'Cha was successfully created.' }\n format.json { render :show, status: :created, location: @cha }\n else\n format.html { render :new }\n format.json { render json: @cha.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cheque = Cheque.new(cheque_params)\n @cheque.save\n render :nothing => true\n #respond_to do |format|\n #if \n #format.html { redirect_to @cheque, notice: 'Cheque was successfully created.' }\n #format.json { render '#', status: :created, location: @cheque }\n #else\n #format.html { render '#' }\n #format.json { render json: @cheque.errors, status: :unprocessable_entity }\n #end\n #end\n end", "def create\n deck_name = params[:name]\n @deck = Deck.create(:name => deck_name)\n\n SUITS.each do |suit| \n VALUES.each do |value| \n Card.create(:deck_id => @deck.id, :suit => suit, :value => value)\n end\n end\n\n render json: [@deck, @deck.cards] \n end", "def new\n @cheque = Cheque.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cheque }\n end\n end", "def create\n @post = Post.new(params[:post])\n respond_to do |format|\n if @post.save\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with Post.create(params[:post])\n end", "def create\n @keiyaku = Keiyaku.new(keiyaku_params)\n\n respond_to do |format|\n if @keiyaku.save\n format.html { redirect_to @keiyaku, notice: 'Keiyaku was successfully created.' }\n format.json { render :show, status: :created, location: @keiyaku }\n else\n format.html { render :new }\n format.json { render json: @keiyaku.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @detalhe = Detalhe.new(detalhe_params)\n\n respond_to do |format|\n if @detalhe.save\n format.html { redirect_to @detalhe, notice: 'Detalhe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @detalhe }\n else\n format.html { render action: 'new' }\n format.json { render json: @detalhe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n dive = Dive.new(dive_params)\n if dive.save\n render json: dive\n else\n render json: {message: dive.errors}, status: 400\n end\n end", "def create\n @jeon = Jeon.new(jeon_params)\n\n respond_to do |format|\n if @jeon.save\n format.html { redirect_to @jeon, notice: 'Jeon was successfully created.' }\n format.json { render :show, status: :created, location: @jeon }\n else\n format.html { render :new }\n format.json { render json: @jeon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quetion = Quetion.new(params[:quetion])\n\n respond_to do |format|\n if @quetion.save\n format.html { redirect_to @quetion, notice: 'Quetion was successfully created.' }\n format.json { render json: @quetion, status: :created, location: @quetion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quetion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @estoque = Estoque.new(params[:estoque])\n\n respond_to do |format|\n if @estoque.save\n format.html { redirect_to @estoque, notice: 'Estoque was successfully created.' }\n format.json { render json: @estoque, status: :created, location: @estoque }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estoque.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @heel = Heel.new(heel_params)\n\n respond_to do |format|\n if @heel.save\n format.html { redirect_to @heel, notice: 'Heel was successfully created.' }\n format.json { render :show, status: :created, location: @heel }\n else\n format.html { render :new }\n format.json { render json: @heel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.create(post_params)\n render json: @post, serializer: PostSerializer\n end", "def create\n @agente = Agente.find(params[:agente_id])\n @hijo = @agente.hijos.build(hijo_params)\n\n respond_to do |format|\n if @hijo.save\n format.html { redirect_to agente_hijos_path(@agente), notice: 'El hijo fué creado exitosamente.' }\n format.json { render :show, status: :created, location: @hijo }\n else\n format.html { render :new }\n format.json { render json: @hijo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @messege = Messege.new(params[:messege])\n\n respond_to do |format|\n if @messege.save\n format.html { redirect_to @messege, notice: 'Messege was successfully created.' }\n format.json { render json: @messege, status: :created, location: @messege }\n else\n format.html { render action: \"new\" }\n format.json { render json: @messege.errors, status: :unprocessable_entity }\n end\n end\n end", "def POST; end", "def create\n @post = Post.create(post_params)\n puts \"LLLLLOOOOOOOLLLLLL\"\n puts current_usuario.to_json\n @post = current_usuario.posts.create(post_params)\n \n @post.sangre = current_usuario.tipoDeSangre\n\n\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def postJSON(path, data)\n response = self.class.post(path, body: data.to_json)\n @response_class ? @response_class.parse(response) : response\n end", "def create\n @frais_hebergement = FraisHebergement.new(params[:frais_hebergement])\n\n respond_to do |format|\n if @frais_hebergement.save\n format.html { redirect_to @frais_hebergement, :notice => 'Le frais d\\'hébergement a bien été créé' }\n format.json { render :json => @frais_hebergement, :status => :created, :location => @frais_hebergement }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @frais_hebergement.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n result = JSON.parse(response.body)\n puts result\n result\nend", "def json_entry_params\n params.require(:json_entry).permit(:area_id, :data, :name, :verb, :post_body)\n end", "def create\n @cheerup = Cheerup.new(cheerup_params)\n\n respond_to do |format|\n if @cheerup.save\n format.html { redirect_to @cheerup, notice: 'Cheerup was successfully created.' }\n format.json { render :show, status: :created, location: @cheerup }\n else\n format.html { render :new }\n format.json { render json: @cheerup.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end", "def post(path, **args); end", "def transmit(path, data)\n http_post (host + path),\n {'Content-Type' => 'application/json'},\n [data.to_json]\n end", "def create\n @bilhete = Bilhete.new(params[:bilhete])\n\n respond_to do |format|\n if @bilhete.save\n format.html { redirect_to @bilhete, notice: 'Bilhete was successfully created.' }\n format.json { render json: @bilhete, status: :created, location: @bilhete }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bilhete.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @habit = Habit.new(habit_params)\n\n respond_to do |format|\n if @habit.save\n format.html { redirect_to @habit, notice: 'Habit was successfully created.' }\n format.json { render :show, status: :created, location: @habit }\n else\n format.html { render :new }\n format.json { render json: @habit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @readie = Readie.new\n\n respond_to do |format|\n if @readie.save\n format.json { render @readie, status: :created }\n else\n format.json { render json: @readie.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end", "def create\n @huerto = Huerto.new(params[:huerto])\n\n respond_to do |format|\n if @huerto.save\n format.html { redirect_to @huerto, notice: 'Huerto was successfully created.' }\n format.json { render json: @huerto, status: :created, location: @huerto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @huerto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hotele = Hotele.new(params[:hotele])\n\n respond_to do |format|\n if @hotele.save\n format.html { redirect_to @hotele, notice: 'Hotele was successfully created.' }\n format.json { render json: @hotele, status: :created, location: @hotele }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hotele.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params.permit(:intitule, :estObligatoire, :nombreDeCaractere, :ordre, :sondage_id)\n ajout = QuestionOuverteService.instance.creerQuestionOuverte(params[:intitule], params[:estObligatoire], params[:nombreDeCaractere], params[:ordre], params[:sondage_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end", "def post\n Rentlinx.client.post(self)\n end", "def post_json(path, body)\n url = [base_url, path].join\n resp = HTTParty.post(url, headers: standard_headers, body: body.to_json)\n parse_json(url, resp)\n end", "def create\n @cerc = Cerc.new(params[:cerc])\n\n if @cerc.save\n render json: @cerc, status: :created, location: @cerc\n else\n render json: @cerc.errors, status: :unprocessable_entity\n end\n end", "def create\n @selfie_post = SelfiePost.new(selfie_post_params)\n\n respond_to do |format|\n if @selfie_post.save\n format.html { redirect_to @selfie_post, notice: 'Selfie post was successfully created.' }\n format.json { render :show, status: :created, location: @selfie_post }\n else\n format.html { render :new }\n format.json { render json: @selfie_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end", "def create\n @ty = Tie.new(ty_params)\n\n respond_to do |format|\n if @ty.save\n format.html { redirect_to @ty, notice: 'Tie was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ty }\n else\n format.html { render action: 'new' }\n format.json { render json: @ty.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @geocach = Geocach.new(params[:geocach])\n\n respond_to do |format|\n if @geocach.save\n format.html { redirect_to @geocach, notice: 'A Geocache was successfully created.' }\n format.json { render json: @geocach, status: :created, location: @geocach }\n else\n format.html { render action: \"new\" }\n format.json { render json: @geocach.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_evaluate(excon, body)\n excon.request(\n method: :post,\n path: '/evaluate',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend", "def create\n @sinh_vien = SinhVien.new(params[:sinh_vien])\n\n respond_to do |format|\n if @sinh_vien.save \n format.json { render json: @sinh_vien, status: :created, location: @sinh_vien }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload\n @mote = mote.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mote }\n end\n end", "def create\n @houmon = Houmon.new(houmon_params)\n\n\n\n respond_to do |format|\n \n #測定値(漏洩電流、絶縁抵抗)がnilの場合0を代入\n if @houmon.tenkenkekka.sokutei.roueidenryu_ikkatsu.nil? then\n @houmon.tenkenkekka.sokutei.roueidenryu_ikkatsu=0\n end\n if @houmon.tenkenkekka.sokutei.zetsuenteikou_ikkatsu.nil? then\n @houmon.tenkenkekka.sokutei.zetsuenteikou_ikkatsu=0\n end\n #調査結果を判定して格納\n #絶縁一括が0<0.02のとき、絶縁不良0.02未満とし、絶縁一括が0<0.1のとき絶縁不良0.1未満とする。その他は良好\n if @houmon.tenkenkekka.sokutei.zetsuenteikou_ikkatsu !=0 && @houmon.tenkenkekka.sokutei.zetsuenteikou_ikkatsu < 0.1 then\n if @houmon.tenkenkekka.sokutei.zetsuenteikou_ikkatsu !=0 && @houmon.tenkenkekka.sokutei.zetsuenteikou_ikkatsu < 0.02 then\n @houmon.tenkenkekka.chosakekka_code = 3\n else \n @houmon.tenkenkekka.chosakekka_code = 2\n end\n else\n @houmon.tenkenkekka.chosakekka_code = 1\n end\n \n #調査実績を判定して格納\n #在宅かつ問診未実施なら終了、以外完了\n #不在のとき、絶縁一括のみ入力があればメガ終了とする。漏洩一括に入力があればリーク終了とする\n\n @fuga = @houmon.tenkenkekka.monshin.jisshi_umu\n if @houmon.zaitakufuzai.id == 1\n if @houmon.tenkenkekka.monshin.jisshi_umu == '2' \n @houmon.tenkenkekka.chosajisseki_code = 2\n else\n @houmon.tenkenkekka.chosajisseki_code = 1\n end\n else\n if @houmon.tenkenkekka.sokutei.roueidenryu_ikkatsu == 0 && @houmon.tenkenkekka.sokutei.zetsuenteikou_ikkatsu != 0\n @houmon.tenkenkekka.chosajisseki_code = 4\n else\n @houmon.tenkenkekka.chosajisseki_code = 3\n end\n end\n #なおかつ最新実績として交付モデルにも更新する\n @kofu_for_newestjisseki = Kofu.find(params[:houmon][:kofu_id])\n @kofu_for_newestjisseki.newest_chosajisseki_code = @houmon.tenkenkekka.chosajisseki_code\n \n \n \n \n if @houmon.save && @kofu_for_newestjisseki.save\n\n # Season2用暫定 ここから -->\n @@h = {}\n @@h.store(:chosa_ym, session[:when_year]+session[:when_month]) # セッション内の年月を調査年月とする\n @@h.store(:chosain_id, session[:whoami_id]) # セッション内のログインIDを調査員IDとする\n @@h.store(:kofu_kensu, # 調査年月+調査員IDで交付の件数をカウント\n Kofu.where(chosa_ym: session[:when_year]+session[:when_month]).where(chosain_id: session[:whoami_id]).count)\n @@h.store(:datetime_now, DateTime.now.in_time_zone)\n STDOUT.puts(\"Rails2Unicage:\"+@@h.to_json) # Unicageへの引き渡しのため標準出力にJSONで出す\n\n # 確認用にLV1フォルダ内にファイルを作って出力\n f = File.open(\"./LV1/#{Time.now.strftime(\"%Y%m%d_%H%M%S\")}.txt\", 'a')\n f.puts(\"Rails2Unicage:\"+@@h.to_json)\n f.close\n # <-- Season2用暫定 ここまで\n\n format.html { redirect_to @houmon, notice: '点検結果が正常に登録されました。' }\n format.json { render :show, status: :created, location: @houmon }\n else\n \n format.html { redirect_to :back }\n format.json { render json: @houmon.errors, status: :unprocessable_entity }\n end\n end\n end", "def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend", "def create\n @clocher = Clocher.new(clocher_params)\n\n respond_to do |format|\n if @clocher.save\n format.html { redirect_to @clocher, notice: 'Clocher was successfully created.' }\n format.json { render :show, status: :created, location: @clocher }\n else\n format.html { render :new }\n format.json { render json: @clocher.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hoho = Hoho.new(hoho_params)\n\n respond_to do |format|\n if @hoho.save\n format.html { redirect_to @hoho, notice: 'Hoho was successfully created.' }\n format.json { render :show, status: :created, location: @hoho }\n else\n format.html { render :new }\n format.json { render json: @hoho.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end", "def create\n @trecho = Trecho.new(params[:trecho])\n\n respond_to do |format|\n if @trecho.save\n format.html { redirect_to @trecho, notice: 'Trecho was successfully created.' }\n format.json { render json: @trecho, status: :created, location: @trecho }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trecho.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @habitacion = Habitacion.new(habitacion_params)\n\n respond_to do |format|\n if @habitacion.save\n format.html { redirect_to @habitacion, notice: 'Habitacion creada.' }\n format.json { render :show, status: :created, location: @habitacion }\n else\n format.html { render :new }\n format.json { render json: @habitacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n workout = Workout.find params[:workout_id]\n result = Question.create(workout, { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n @question = result[:question]\n\n respond_to do |format|\n unless @question.persisted?\n format.json { render :json => @question.errors.full_messages, :status => :unprocessable_entity }\n else\n format.json { render :json => @question.as_json({:include => :answers}) }\n end\n \n end\n\n end", "def create\n @elector = Elector.new(elector_params)\n\n if @elector.save\n render json: @elector, status: :created, location: @elector\n else\n render json: @elector.errors, status: :unprocessable_entity\n end\n end", "def create\n @diet = Diet.new(diet_params)\n @diet.user = @current_user\n\n if @diet.save\n render json: @diet, status: 201, location: @diet, root: true\n else\n render json: @diet.errors, status: 422\n end\n end", "def create\n @etiquetum = Etiquetum.new(etiquetum_params)\n\n respond_to do |format|\n if @etiquetum.save\n format.html { redirect_to @etiquetum, notice: 'Etiqueta creada!' }\n format.json { render :show, status: :created, location: @etiquetum }\n else\n format.html { render :new }\n format.json { render json: @etiquetum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n redirect_to root_url\n\n # @fluke = Fluke.new(fluke_params)\n\n # respond_to do |format|\n # if @fluke.save\n # format.html { redirect_to @fluke, notice: 'Fluke was successfully created.' }\n # format.json { render :show, status: :created, location: @fluke }\n # else\n # format.html { render :new }\n # format.json { render json: @fluke.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def add_cheer_up\n new_cheer_up = current_user.cheer_ups.new(cheer_up_params)\n if new_cheer_up.save\n render json:\n {\n status: 200,\n user: current_user,\n cheer_up: current_user.cheer_ups\n }\n else\n render json:\n {\n status: 400,\n user: current_user,\n cheer_up: cheer_up.errors\n }\n end\n end", "def create\n @etymon = Etymon.new(etymon_params)\n\n respond_to do |format|\n if @etymon.save\n format.html { redirect_to @etymon, notice: 'Etymon was successfully created.' }\n format.json { render :show, status: :created, location: @etymon }\n else\n format.html { render :new }\n format.json { render json: @etymon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n case raw_json\n when Array then handle_many_logs\n when Hash then handle_single_log\n else; sorry \"Post a JSON array or object.\", 422\n end\n end", "def create\n @betraege = Betraege.new(params[:betraege])\n\n respond_to do |format|\n if @betraege.save\n format.html { redirect_to @betraege, :notice => 'Betraege was successfully created.' }\n format.json { render :json => @betraege, :status => :created, :location => @betraege }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @betraege.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @quake = Quake.new(quake_params)\n d = @quake.device\n respond_to do |format|\n if d.nil?\n format.json { render json: \"device not found. id=#{@quake.device_id}\", status: :unprocessable_entity }\n elsif d.token != params[:token]\n format.json { render json: \"token not match. id=#{@quake.device_id}\", status: :unprocessable_entity }\n elsif @quake.save\n format.html { redirect_to @quake, notice: 'Quake was successfully created.' }\n format.json { render :show, status: :created, location: @quake }\n send_notify if Quake.happen?\n else\n format.html { render :new }\n format.json { render json: @quake.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tieu_chi = TieuChi.new(params[:tieu_chi])\n\n respond_to do |format|\n if @tieu_chi.save\n format.html { redirect_to admin_tieu_chis_url, notice: 'Tieu chi was successfully created.' }\n format.json { render json: @tieu_chi, status: :created, location: @tieu_chi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tieu_chi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hail = current_user.hails.new(hail_params)\n\n respond_to do |format|\n if @hail.save\n format.json { render :show, status: :created, location: @hail }\n else\n format.json { render json: @hail.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.580525", "0.5652079", "0.5647341", "0.5640353", "0.56358874", "0.55906767", "0.5568264", "0.5546088", "0.55171293", "0.55073017", "0.55027014", "0.5501485", "0.5481896", "0.5471889", "0.5470683", "0.5464687", "0.5436024", "0.54274267", "0.5426603", "0.54229856", "0.5419781", "0.541418", "0.5379373", "0.5371949", "0.5369188", "0.5361877", "0.5361001", "0.5356344", "0.53528744", "0.5348028", "0.5333077", "0.5328267", "0.53003216", "0.5295178", "0.52850187", "0.52805483", "0.52782625", "0.527462", "0.5265684", "0.52625054", "0.52618575", "0.5261264", "0.5254346", "0.52542686", "0.5250272", "0.5249285", "0.52449644", "0.5242901", "0.52324575", "0.52294105", "0.522617", "0.521545", "0.5203487", "0.52032423", "0.5194508", "0.51940036", "0.5191275", "0.5187406", "0.51870674", "0.51771826", "0.51763505", "0.51758397", "0.5171266", "0.5166747", "0.5166431", "0.5163789", "0.516229", "0.51617664", "0.5155285", "0.5154985", "0.51532495", "0.51531065", "0.5150074", "0.5147489", "0.5145416", "0.5143257", "0.5140019", "0.51370424", "0.5136018", "0.51308733", "0.51284814", "0.5121764", "0.5119631", "0.5116322", "0.5115321", "0.5110048", "0.51086086", "0.5108175", "0.5107336", "0.51055807", "0.5105551", "0.51046133", "0.51034117", "0.50976974", "0.50961524", "0.5095178", "0.5094086", "0.5093628", "0.50885284", "0.50852805", "0.50839967" ]
0.0
-1
PATCH/PUT /ches/1 PATCH/PUT /ches/1.json
def update respond_to do |format| if @ch.update(ch_params) format.html { redirect_to @ch, notice: 'Ch was successfully updated.' } format.json { render :show, status: :ok, location: @ch } else format.html { render :edit } format.json { render json: @ch.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def patch!\n request! :patch\n end", "def update # PATCH\n raise NotImplementedError\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, **args); end", "def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def put!\n request! :put\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end", "def patch\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { render :show, status: :ok, location: @patch }\n else\n format.html { render :edit }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end", "def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, opts = {})\n request(:patch, path, opts).body\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def update\n respond_with []\n end", "def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end", "def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end", "def update(path)\n output { patch(path, params) }\n end", "def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end", "def update\n put :update\n end", "def update\n respond_to do |format|\n format.json { render json: { status: :not_implemented } }\n end\n end", "def update\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n if @gotcha.update_attributes(params[:gotcha])\n format.html { redirect_to @gotcha, notice: 'Gotcha was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gotcha.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n format.html { redirect_to @event, :notices => ['Hack was successfully updated.'] }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @hack.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # respond_to do |format|\n # if @thing.update(thing_params)\n # format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n # format.json { render :show, status: :ok, location: @thing }\n # else\n # format.html { render :edit }\n # format.json { render json: @thing.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n respond_to do |format|\n if @anything.update(anything_params)\n format.html { redirect_to @anything, notice: 'Anything was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @anything.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to things_path, notice: 'Your thing was successfully updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = {\n 'op' => operation,\n 'path' => path,\n 'value' => value\n }\n response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version)\n @client.response_handler(response)\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to [:admin, @chef], notice: t('messages.updated', model:Chef.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chef.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end", "def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @something = Something.find(params[:id])\n\n respond_to do |format|\n if @something.update_attributes(params[:something])\n format.html { redirect_to @something, notice: 'Something was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @something.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kickoff = Kickoff.find(params[:id])\n\n respond_to do |format|\n if @kickoff.update_attributes(params[:kickoff])\n format.html { redirect_to @kickoff, notice: 'Kickoff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kickoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instrument_patch.update(instrument_patch_params)\n format.html { redirect_to @instrument_patch, notice: 'Instrument patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instrument_patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def update\n @one = One.find(params[:id])\n\n respond_to do |format|\n if @one.update_attributes(params[:one])\n format.html { redirect_to @one, notice: 'One was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n# respond_to do |format|\n# if @req.update(req_params)\n format.json { render :json => {:status => 'success'}}\n# format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n# format.json { render :show, status: :ok, location: @req }\n# else\n format.json { render :json => {:status => 'failed'}}\n# format.html { render :edit }\n# format.json { render json: @req.errors, status: :unprocessable_entity }\n# end\n# end\n end", "def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sheep.update(sheep_params)\n format.html { redirect_to @sheep, notice: 'Sau ble oppdatert.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sheep.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def update\n respond_to_update({thing: @author})\n end", "def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def update\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n if @koti.update_attributes(params[:koti])\n format.html { redirect_to @koti, notice: 'Koti was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @koti.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @six.update(six_params)\n format.html { redirect_to @six, notice: 'Six was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @six.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n #respond_to do |format|\n # if @request.update(request_params)\n # format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @request.errors, status: :unprocessable_entity }\n # end\n #end\n end", "def update\n respond_to do |format|\n if @bottle.update(bottle_params)\n format.html { redirect_to user_path(current_user.id), notice: 'Bottle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bottle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stuff = Stuff.find(params[:id])\n\n respond_to do |format|\n if @stuff.update_attributes(params[:stuff])\n format.html { redirect_to @stuff, :notice => 'Stuff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stuff.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @what = What.find(params[:id])\n\n respond_to do |format|\n if @what.update_attributes(params[:what])\n format.html { redirect_to @what, notice: 'What was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @what.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "def update\n respond_to do |format|\n if @lunch.update(lunch_params)\n format.html { redirect_to @lunch, notice: 'Lunch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lunch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @hoge = Hoge.find(params[:id])\n\n respond_to do |format|\n if @hoge.update_attributes(params[:hoge])\n format.html { redirect_to @hoge, notice: 'Hoge was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hoge.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cheque.update(cheque_params)\n format.html { redirect_to @cheque, notice: 'Cheque was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cheque.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bla = Bla.find(params[:id])\n\n respond_to do |format|\n if @bla.update_attributes(params[:bla])\n format.html { redirect_to @bla, :notice => 'Bla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bla.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(*args)\n put(*args)\n end", "def update(*args)\n put(*args)\n end", "def patch; end", "def patch; end", "def update\n respond_to do |format|\n if @api_v1_resource.update(api_v1_resource_params)\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_resource }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hey.update(hey_params)\n format.html { redirect_to @hey, notice: 'Hey was successfully updated.' }\n format.json { render :show, status: :ok, location: @hey }\n else\n format.html { render :edit }\n format.json { render json: @hey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @monkey = Monkey.find(params[:id])\n\n respond_to do |format|\n if @monkey.update_attributes(params[:monkey])\n format.html { redirect_to @monkey, notice: 'Monkey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monkey.errors, status: :unprocessable_entity }\n end\n end\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def fire_patch(url_or_path, entity, options = {}, &block)\n url = absolute_url(url_or_path)\n headers = {:Accept => MEDIA_TYPE_JSON, :'Content-type' => ENCODED_MEDIA_TYPE_JSON_PATCH}.\n merge(options.fetch(:headers, {}))\n headers = merge_log_weasel_header(headers)\n timeout = options.fetch(:timeout, Ladon.default_request_timeout)\n body = encode_entity(entity)\n response = Typhoeus::Request.run(url, headers: headers, timeout: timeout, body: body, method: :patch)\n handle_response(response, method: :patch, url: url, default_data: options[:default_data],\n raise_on_error: options[:raise_on_error], &block)\n end", "def update(data = :object || :json)\n end", "def update\n @cheer = Cheer.find(params[:id])\n\n respond_to do |format|\n if @cheer.update_attributes(params[:cheer])\n format.html { redirect_to @cheer, notice: 'Cheer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cheer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @http_request.update(http_request_params)\n format.html { redirect_to @http_request, notice: 'Http request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @http_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n respond_to do |format|\n if @http_request.update(http_request_params)\n format.html { redirect_to @http_request, notice: 'Http request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @http_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end", "def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end", "def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end", "def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end" ]
[ "0.6837156", "0.67145294", "0.66698986", "0.6571805", "0.64935595", "0.644392", "0.6434816", "0.642178", "0.6314157", "0.62710685", "0.62710685", "0.62637913", "0.6223215", "0.6181328", "0.61676913", "0.6158628", "0.6150577", "0.6123661", "0.6122252", "0.61221886", "0.61221886", "0.60890454", "0.6063217", "0.60432494", "0.60376954", "0.60331815", "0.60331815", "0.60218173", "0.59994173", "0.59839505", "0.59839505", "0.5983867", "0.5983262", "0.59554714", "0.5948517", "0.5941355", "0.5927874", "0.59172016", "0.5915456", "0.5914524", "0.5907972", "0.59025484", "0.5884345", "0.5879471", "0.5871875", "0.58512026", "0.5851126", "0.5848319", "0.5834059", "0.58296007", "0.582784", "0.5827814", "0.5824008", "0.5822413", "0.58084923", "0.5802249", "0.57999134", "0.57966703", "0.57907313", "0.5790484", "0.57878655", "0.5786309", "0.5781316", "0.57810277", "0.57755667", "0.57728374", "0.5765274", "0.576035", "0.57459104", "0.57377404", "0.5736415", "0.57312673", "0.573113", "0.5727623", "0.5726051", "0.5723806", "0.5723616", "0.5721339", "0.57204413", "0.57203555", "0.57157063", "0.5714599", "0.5714599", "0.5713971", "0.5713971", "0.571375", "0.5710233", "0.5706469", "0.57043374", "0.5703804", "0.5701363", "0.57011837", "0.5695021", "0.5690756", "0.56906015", "0.5690543", "0.56903106", "0.56903106", "0.56903106", "0.56903106", "0.56891435" ]
0.0
-1
DELETE /ches/1 DELETE /ches/1.json
def destroy @ch.destroy respond_to do |format| format.html { redirect_to ches_url, notice: 'Ch was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def delete\n request(:delete)\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def delete(path)\n request 'DELETE', path\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @he = He.find(params[:id])\n @he.destroy\n\n respond_to do |format|\n format.html { redirect_to hes_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete!\n request! :delete\n end", "def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete(*rest) end", "def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end", "def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end", "def destroy\n @one = One.find(params[:id])\n @one.destroy\n\n respond_to do |format|\n format.html { redirect_to ones_url }\n format.json { head :no_content }\n end\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def delete(*args)\n request(:delete, *args)\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @six.destroy\n respond_to do |format|\n format.html { redirect_to sixes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @htc.destroy\n respond_to do |format|\n format.html { redirect_to htcs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hoge = Hoge.find(params[:id])\n @hoge.destroy\n\n respond_to do |format|\n format.html { redirect_to hoges_url }\n format.json { head :ok }\n end\n end", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @three.destroy\n respond_to do |format|\n format.html { redirect_to threes_url }\n format.json { head :no_content }\n end\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def destroy\n @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end", "def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end", "def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete\n api_client.delete(url)\n end", "def delete\n api(\"Delete\")\n end", "def destroy\n @thirtyone.destroy\n respond_to do |format|\n format.html { redirect_to thirtyones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uginuce.sheep.update status:'na farmi'\n @uginuce.destroy\n respond_to do |format|\n format.html { redirect_to uginuces_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete\n delete_from_server single_url\n end", "def destroy\n @jedi = Jedi.find(params[:id])\n @jedi.destroy\n\n respond_to do |format|\n format.html { redirect_to jedis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidades3.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades3s_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def delete(path, params)\n request(:delete, path, {})\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end", "def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end", "def destroy\n @chronicle.destroy\n respond_to do |format|\n format.html { redirect_to chronicles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Like.delete(params[\"id\"])\n end", "def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n head :no_content\n end", "def destroy\n @anything.destroy\n respond_to do |format|\n format.html { redirect_to anythings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couche was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @thirtythree.destroy\n respond_to do |format|\n format.html { redirect_to thirtythrees_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end", "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hotele = Hotele.find(params[:id])\n @hotele.destroy\n\n respond_to do |format|\n format.html { redirect_to hoteles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def destroy\n @test1.destroy\n respond_to do |format|\n format.html { redirect_to test1s_url, notice: \"Test1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end", "def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end", "def destroy\n @himalaya = Himalaya.find(params[:id])\n @himalaya.destroy\n\n respond_to do |format|\n format.html { redirect_to himalayas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sub1_line_item.destroy\n respond_to do |format|\n format.html { redirect_to sub1_line_items_url, notice: 'Sub1 line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @three60.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@good, anchor: \"three60\") }\n format.json { head :no_content }\n end\n end" ]
[ "0.7354419", "0.7047876", "0.70007014", "0.6952419", "0.68707776", "0.6869762", "0.6826888", "0.6826266", "0.6811647", "0.68045557", "0.6798212", "0.67636836", "0.6760846", "0.6760846", "0.6760846", "0.6760846", "0.6747369", "0.6741525", "0.67351866", "0.67297924", "0.67297924", "0.6721184", "0.67018723", "0.6697467", "0.66960883", "0.6682068", "0.6680316", "0.6677618", "0.66719186", "0.6670724", "0.66638213", "0.6660236", "0.6659355", "0.6653503", "0.66516715", "0.6650871", "0.6648362", "0.66436595", "0.66390103", "0.6631674", "0.6621166", "0.6621166", "0.66148144", "0.6609863", "0.6606654", "0.6600346", "0.65795445", "0.65618706", "0.655792", "0.65523523", "0.65388495", "0.65346795", "0.65242106", "0.65104496", "0.65096414", "0.65081316", "0.6507188", "0.6502647", "0.6502647", "0.6502647", "0.6502647", "0.6502647", "0.6502647", "0.6502647", "0.6496292", "0.64955294", "0.6491552", "0.64905345", "0.6486527", "0.6484893", "0.6484793", "0.6484003", "0.64775574", "0.6476951", "0.6476516", "0.64764917", "0.64754796", "0.6475188", "0.64750004", "0.6469875", "0.646959", "0.6467871", "0.6466398", "0.6465181", "0.64649004", "0.64649004", "0.64649004", "0.6464601", "0.6464594", "0.6464095", "0.6461433", "0.64560336", "0.64557964", "0.6455029", "0.64524233", "0.64510196", "0.6450389", "0.6439264", "0.64365834", "0.64342564", "0.64308375" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_ch @ch = Ch.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def ch_params params.require(:ch).permit(:content) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
GET /flickr_accounts GET /flickr_accounts.json
def index @flickr_accounts = FlickrAccount.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_accounts()\n http_get(accounts_url)\n end", "def accounts\n get('/accounts')['accounts']\n end", "def set_flickr_account\n @flickr_account = FlickrAccount.find(params[:id])\n end", "def social_accounts_for_a_project\n uri = \"#{@api_url}/#{@project_id}/accounts?access_token=#{@access_token}\"\n get uri\n end", "def all_accounts\n puts params[:id]\n accounts = []\n user = User.find params[:id]\n user.accounts.each do |f|\n accounts << {id:f.id, title: f.title}\n end\n render json: accounts\n end", "def get_account\n as_json(get_results('/account'))\n end", "def list_accounts\n HTTP.headers(:accept => @@accept).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\"#{@@base_url}/users/#{self.guid}/accounts\").parse[\"accounts\"]\n end", "def auth\n # A short howto for web flow authentication on the flickr website.\n # This would live inside a rails controller or alternative framework equivalent\n # Error handling left out for clarity :-)\n # Added by Darren Greaves (https://github.com/boncey/)\n #\n # You need an API key first, see http://www.flickr.com/services/api/keys/\n # This is the URL Flickr will redirect your users to once they agree to access\n @callback_url = 'http://localhost:3000/callback'\n\n FlickRaw.api_key=API_KEY\n FlickRaw.shared_secret=SHARED_SECRET\n flickr = FlickRaw::Flickr.new\n token = flickr.get_request_token(:oauth_callback => URI.escape(@callback_url))\n # You'll need to store the token somewhere for when the user is returned to the callback method\n # I stick mine in memcache with their session key as the cache key\n session[:token] = token\n\n @auth_url = flickr.get_authorize_url(token['oauth_token'])\n # Stick @auth_url in your template for users to click\n end", "def index\n @accounts = current_user.person.blackberry_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end", "def list\n token = SocialService::Facebook.renew_token(token_params)\n\n accounts =\n SocialService::Facebook\n .accounts(token)\n .reject { |a| a[:id].in?(facebook_account_ids) }\n\n render json: { accounts: accounts }\n end", "def show\n authorize @accounts\n render json: @account\n end", "def get_folio_data\n netid = params['netid']\n url = ENV['OKAPI_URL']\n tenant = ENV['OKAPI_TENANT']\n account = CUL::FOLIO::Edge.patron_account(url, tenant, folio_token, { username: netid })\n # Rails.logger.debug(\"mjc12test: Got FOLIO account #{account.inspect}\")\n render json: account\n end", "def index\n @accounts = current_user.person.gmail_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end", "def index\n\t\t@accounts = Account.all\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @accounts }\n\t\tend\n\tend", "def get_list_acc\n JSON.parse(curl_get(\"accounts\").body_str)\n end", "def get_flickr_pics (photoset)\n\n api_key = '0dd1537c46575cf8b7b2a2df94156fd9'\n method = 'flickr.photosets.getPhotos'\n format = 'json'\n\n #for testing\n user_id = '128529405@N05'\n photoset_id = '72157648179656437' #ladder pics\n\n base_url = 'https://api.flickr.com/services/rest/'\n\n response = RestClient.get base_url, {\n :params => {\n 'api_key' => api_key,\n 'photoset_id' => photoset,\n 'method' => method,\n 'format' => format,\n 'nojsoncallback' => 1,\n 'extras' => 'original_format'\n }\n }\n\n return response\n\n end", "def flickr_url\n get_url(:flickr)\n end", "def portfolio_accounts\n data = call_api(method: \"get\", url: \"/portfolio/accounts\" )\n @accountId = data.first[\"accountId\"]\n @accountId\n end", "def index\n @accounts = current_user.person.linked_in_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end", "def auth\n\n @user = current_user\n puts @user.email\n Rails.cache.write(\"user_id\", @user.id)\n flickr = FlickRaw::Flickr.new\n token = flickr.get_request_token(:oauth_callback => (\n \"http://localhost:3000/mob/flickr/callback\"))\n Rails.cache.write(\"oauth_token_secret\",token['oauth_token_secret'])\n auth_url = flickr.get_authorize_url(token['oauth_token'], :perms => 'read')\n redirect_to(auth_url)\n end", "def get_accounts(page = 1, \r\n limit = 10, \r\n filter = nil, \r\n sort = nil)\r\n\r\n # prepare query url\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/accounts'\r\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\r\n 'page' => page,\r\n 'limit' => limit,\r\n 'filter' => filter,\r\n 'sort' => sort\r\n }\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'Content-Type' => Configuration.content_type\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n _request = @http_client.get _query_url, headers: _headers\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) if not (_context.response.raw_body.nil? or _context.response.raw_body.to_s.strip.empty?)\r\n return decoded\r\n end", "def get_accounts(page = 1, limit = 10, filter = nil)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts'\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\r\n 'page' => if page.nil? then 1 else page end,\r\n 'limit' => if limit.nil? then 10 else limit end,\r\n 'filter' => filter\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.get query_url, headers: headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def create\n @flickr_account = FlickrAccount.new(flickr_account_params)\n\n if @flickr_account.save\n redirect_to flickr_accounts_path\n else\n render :new\n end\n\n # respond_to do |format|\n # if @flickr_account.save\n # format.html { redirect_to @flickr_account, notice: 'Flickr account was successfully created.' }\n # format.json { render :show, status: :created, location: @flickr_account }\n # else\n # format.html { render :new }\n # format.json { render json: @flickr_account.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def get_accounts\n response_xml = http_get(\"#{xero_url}/accounts\")\n parse_response(response_xml)\n end", "def get_accounts\n response_xml = http_get(@client, \"#{xero_url}/Accounts\")\n parse_response(response_xml, {}, {:request_signature => 'GET/accounts'})\n end", "def list\n oauth_check_authorization\n \n @friends = facebook_client.friends_with_pictures\n end", "def index\n @accounts = Account.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accounts }\n end\n end", "def index\n @account = Account.new\n limit = params[:limit] || Account.count\n @page = { page: params[:page], per_page: limit.to_i }\n @order = params[:order] || \"name\"\n\n @accounts = Account.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accounts, callback: params[:callback] }\n format.xml { render xml: @accounts }\n format.rss { render 'feed' }\n end\n end", "def index\n index = json_account_params[:json_id].to_i if !index \n if admin_signed_in?\n @accounts = Account.all\n else\n @accounts = Account.tri(@current_user.id).all[(index)..(index + 5)]\n end\n index = index + 1\n respond_to do |format|\n format.html\n format.json { render json: @accounts, locals: {last: \"@last\"} }\n end\n end", "def accounts\n request = request(method: :get, path: \"/Account.json\")\n response = request.perform\n instantiate(response[\"Account\"], Lightspeed::Account)\n end", "def flickr_auth\n # Just for fast testing it will be public,\n # in production it will be hidden in ENV VARS\n #\n FlickRaw.api_key = '142c9f2ece1cadf0771cec9aca1740fe'\n FlickRaw.shared_secret = '12f66489ef933ebb'\n end", "def account(id)\n make_json_api_request :get, \"v2/accounts/#{id}\"\n end", "def all\n @account = Account.new\n @page[:per_page] = Account.count\n @accounts = Account.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html { render 'index' }\n format.json { render json: @accounts, callback: params[:callback] }\n format.xml { render xml: @accounts }\n format.rss { render 'feed' }\n end\n end", "def index\n @accounts = current_user.person.phone_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end", "def index\n #@accounts = Account.all\n redirect_to root_path\n #respond_to do |format|\n #format.html # index.html.erb\n #format.json { render json: @accounts }\n #end\n end", "def index\n @oauth_accounts = OauthAccount.all\n end", "def index\n @photos = Flickr.get_photos(params[:flickr_id], params[:n].to_i, PAGESIZE)\n @total_photos = @photos.total.to_i\n @photos_per_request = @photos.perpage.to_i\n end", "def show\n @account = current_user.person.gmail_accounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @account }\n end\n end", "def index\n response = @account_api.find_all\n if response[:status].to_i == 403\n redirect_to home_index_path\n flash[:alert] = \"You are not allowed to access this page\"\n end\n\n @accounts = response[:accounts]\n end", "def index\n @account = Account.find(params[:account_id])\n @users = @account.users\n respond_to do |format|\n format.json { render json: @account.users.paginate(page: @page, per_page: @per_page) }\n end\n end", "def flickr_api\n @flickr_api ||= Flickr.new(FLICKR.merge(:token => flickr_token))\n end", "def account\n get('account')\n end", "def index\n @accounts = current_user.person.iphone_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end", "def index\n email = AuthenticationHelper::Auth.instance.getEmailFromJWT( request )\n if ( email == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n user = User.find_by(email: email)\n if ( user )\n accounts = Account.where(user_id: user[\"id\"])\n render json: accounts, status: :ok\n else\n render json: :nothing, status: :unprocessable_entity\n end\n end", "def accounts_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AccountsApi.accounts_get ...\"\n end\n # resource path\n local_var_path = \"/api/Accounts\"\n\n # query parameters\n query_params = {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AccountPage')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountsApi#accounts_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_accounts\n @accounts = Account.all\n end", "def show\n @account_photos = @account.photos.all\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def index\n auth_response = plaid_client.auth.get(access_token)\n render json: auth_response.to_json\n end", "def index\n # Get user\n host = AuthorizeApiRequest.call(params).result\n\n # Get image uri\n if host\n render json: { profile: host[:profileImage] }, status: :ok\n else\n render json: { status: 'error' }, status: :unprocessable_entity\n end\n end", "def index\n @accounts = policy_scope(Account)\n\n render json: @accounts, include: [:user]\n end", "def get_photos_from_flickr(args = {})\n args = GET_PHOTOS_DEFAULT_OPTIONS.merge(args)\n response = client.people.getPhotos(args)\n return nil if response.page > response.pages\n\n normalize(response:)\n end", "def listaccounts(minconf = 1)\n @api.request 'listaccounts', minconf\n end", "def callback \n begin\n user_id = Rails.cache.read(\"user_id\")\n @user = User.find(user_id)\n oauth_token_secret = Rails.cache.read(\"oauth_token_secret\")\n\n flickr = FlickRaw::Flickr.new\n oauth_token = params[:oauth_token]\n oauth_verifier = params[:oauth_verifier]\n\n raw_token = flickr.get_access_token(params[:oauth_token], oauth_token_secret, params[:oauth_verifier])\n oauth_token = raw_token[\"oauth_token\"]\n oauth_token_secret = raw_token[\"oauth_token_secret\"]\n\n flickr.access_token = oauth_token\n flickr.access_secret =oauth_token_secret\n\n if User.find(user_id).flickr_account\n User.find(user_id).flickr_account.delete\n end\n\n flickr_account = FlickrAccount.create(consumer_key: oauth_token , secret_key: oauth_token_secret)\n User.find(user_id).flickr_account = flickr_account\n\n unless flickr_account.new_record?\n flash[:notice] = 'Flickr account created $green'\n l = Log.new\n l.loggingtype =0\n l.user_id_1 = @user.id\n name_1 = if @user.name.nil? then @user.email.split('@')[0] else @user.name end\n l.message = \"#{name_1} is now connected to flickr account\"\n l.save\n else \n flash[:notice] = 'Flickr account couldn\\'t be created $red'\n end \n\n redirect_to controller: 'users', action: 'connect_social_accounts'\n \n rescue\n flash[:notice] = 'Couldn\\'t connect to flickr $red'\n redirect_to controller: 'users', action: 'connect_social_accounts'\n end\n end", "def show\n\t\treturn status 404 if @account.nil?\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @account }\n\t\tend\n\tend", "def index\n @accounts = Account.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accounts }\n end\n end", "def index\n @api_v1_accounts = Api::V1::Account.all\n end", "def match_flickr(frob, params = {})\n require 'open-uri'\n\t begin\n\t require 'simpleflickr'\n\t rescue MissingSourceFile\n\t puts \"Please install simpleflickr\"\n\t return nil\n\t end\n begin\n require 'hpricot'\n rescue MissingSourceFile\n puts \"Please install Hpricot\"\n return []\n end\n \n\t unless params.key?(:api_key) && params.key?(:secret)\n\t raise ArgumentError.new(\"Params should contain at least :api_key and :secret\")\n\t end\n \n\t params = {\n\t :perms => 'read',\n\t :method => 'flickr.contacts.getList'\n\t }.merge(params)\n\t \n\t flickr_api = SimpleFlickr::WebAuthentication.new(params)\n\t params[:auth_token] = flickr_api.get_token_from_frob(frob)\n\t \n\t contact_list_url = \"http://flickr.com\" + flickr_api.url_for(params)\n\t doc = Hpricot.XML(open(contact_list_url))\n\t # there are no errors\n\t if (doc/'err').empty?\n contacts = (doc/\"contact\")\n realnames = contacts.map {|c| c.attributes['realname']}.uniq - [\"\"]\n usernames = contacts.map {|c| c.attributes['username']}.uniq\n\n users = (self.send(\"find_all_by_#{self.im_options[:nickname_field]}\", realnames) + \n self.send(\"find_all_by_#{self.im_options[:username_field]}\", usernames)).uniq\n return [users, []]\n # ERROR!\n else\n # TODO: do something nicer with the error\n puts error_msg = \"Flickr API ERROR: \" + (doc/'err').first.attributes['msg']\n return error_msg\n\t end\n end", "def get_favourite_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.favourites\n\n render status: 200, json: @restaurants\n end", "def flickr_account_params\n params.require(:flickr_account).permit(:username)\n end", "def show\n @account = current_user.person.blackberry_accounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @account }\n end\n end", "def authorize(flickr) # :yields: url\n unless flickr.auth.token\n flickr.auth.getFrob\n url = flickr.auth.login_link\n yield url\n flickr.auth.getToken\n flickr.auth.cache_token\n end\n end", "def index\n\n begin\n\n @accounts = Account.active\n render json: @accounts.to_json(:except=>:password, :methods => [:subdomains, :template] )\n\n rescue => e\n render :json => e.message, :status => :unprocessable_entity\n end\n\n end", "def accounts\n end", "def index\n respond_with(accounts)\n end", "def index\n @accounts = @user.accounts.sort\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accounts }\n end\n end", "def getAccounts\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n http = broker_url + \"/resources/accounts\"\n res = httpGETRequest(http)\n return res\n end", "def fetch_accounts\n log 'fetch_accounts'\n\n custom_headers = {\n 'Content-Type' => 'application/json; charset=UTF-8',\n 'Contexto' => get_context\n }\n\n params = {\n \"peticionCuentasKYOSPaginadas\" => {\n \"favoritos\" => false,\n \"paginacion\" => \"0\"\n }\n }\n\n response = with_headers(custom_headers) do\n post(BASE_ENDPOINT + ACCOUNTS_ENDPOINT, fields: params.to_json)\n end\n\n json = JSON.parse(response)\n\n if json['respuestacuentas']['cuentas'].is_a? Array\n # TODO: test this with a user with multiple accounts\n json['respuestacuentas']['cuentas'].map { |data| build_account(data) }\n else\n [build_account(json['respuestacuentas']['cuentas'])]\n end\n end", "def accounts\n response = query_api(\"/rest/accounts\")\n return response[\"accounts\"].map {|account| Account.new(self, account)}\n end", "def index\n @oauth_client = OauthClient.new\n limit = params[:limit] || OauthClient.count\n @page = { page: params[:page], per_page: limit.to_i }\n @order = params[:order] || \"name\"\n\n @oauth_clients = OauthClient.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @oauth_clients, callback: params[:callback] }\n format.xml { render xml: @oauth_clients }\n format.rss { render 'feed' }\n end\n end", "def account(params = {})\n make_get_request('/account', params)\n end", "def index\n @accounts = Account.all\n Rabl.render(@accounts, 'api/accounts/index', view_path: 'app/views')\n end", "def get_accounts_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AccountsApi.get_accounts ...'\n end\n # resource path\n local_var_path = '/v1/accounts'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/links+json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n return_type = opts[:return_type] || 'InlineResponse20011' \n\n auth_names = opts[:auth_names] || ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountsApi#get_accounts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show_account(id)\n get(\"accounts/#{id}\")\n end", "def find_facebook_friends_with_accounts\n load_facebook_api\n friends = @facebook_api.get_connections('me', 'friends')\n \n friend_ids = []\n friends.each { |friend| friend_ids << friend['id'] }\n\n auths = Authorization.where(:provider => 'facebook', :uid => friend_ids)\n\n output = []\n auths.each { |auth| output << auth.user }\n\n output\n end", "def accounts\n return [] if self.id.nil?\n @accounts ||= \n OrgSync::Base.request(\"#{self.class.endpoint}/#{self.id}/accounts\", {}, @api_key).map { |json| \n OrgSync::Account.new(json, @api_key) \n }\n end", "def show\n account = resource\n if params[:id].present?\n account = User.find_by_id(params[:id])\n end\n render json: account, status: 200\n end", "def get_accounts_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AccountsApi.get_accounts ...'\n end\n # resource path\n local_var_path = '/accounts'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AccountListResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountsApi#get_accounts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @pt_accounts = current_user.pt_accounts.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pt_accounts }\n end\n end", "def show\n\t\t@account = Account.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @account }\n\t\tend\n\tend", "def account_info(options = {})\n request :account, :get, 'account', options\n end", "def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end", "def index\n @user = User.find(params[:user_id])\n @user_accounts = @user.user_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_accounts }\n format.xml { render xml: @user_accounts }\n end\n end", "def get_friends( id, page=0, type='json', login=@login, password=@password )\n http = Net::HTTP.new('twitter.com', 80)\n json_data = http.start do |http_inst|\n path = \"/statuses/friends/#{id}.#{type}?page=#{page}\"\n req = Net::HTTP::Get.new(path)\n \n # we make an HTTP basic auth by passing the\n # username and password\n req.basic_auth login, password\n \n resp, data = http_inst.request(req)\n data\n end\n hash_data = JSON.parse( json_data )\n \n end", "def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end", "def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end", "def show\n user= params[:user]\n repo= params[:repo]\n puts user\n puts repo\n url = BASE_URL + \"repos/\" + user + \"/\" + repo + \"/collaborators\"+ \"?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\"\n # url = BASE_URL + \"repos/rails/rails/collaborators\"\n # url = BASE_URL + \"repositories\"\n @repo = JSON.parse(open(url).read)\n @results = []\n\n\n @repo.each do |doc|\n ids = doc['login']\n url_people = BASE_URL + \"users/\" + ids + \"?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\"\n @results << JSON.parse(open(url_people).read)\n end\n\n end", "def update\n # respond_to do |format|\n # if @flickr_account.update(flickr_account_params)\n # format.html { redirect_to @flickr_account, notice: 'Flickr account was successfully updated.' }\n # format.json { render :show, status: :ok, location: @flickr_account }\n # else\n # format.html { render :edit }\n # format.json { render json: @flickr_account.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def list_accounts(client, options)\n accounts = get_accounts(client, options)\n if accounts.nil?\n return\n end\n\n accounts.each do |acc|\n print_account(acc)\n end\nend", "def index\n head 404\n # @api_v1_followers = Api::V1::Follower.all\n\n # render json: @api_v1_followers\n end", "def show_accounts(search = nil, **params)\n params[:search] = search\n\n get('accounts', params)\n end", "def get_rest_authentication()\n reader = CSV.open('keys/sf_key.csv')\n client_id = reader.shift[0]\n client_secret = reader.shift[0]\n username = reader.shift[0]\n password = reader.shift[0]\n auth_payload = \"grant_type=password&client_id=#{client_id}\" \\\n \"&client_secret=#{client_secret}\" \\\n \"&username=#{username}&password=#{password}\"\n params = {:accept => 'application/json'}\n @auth_response = RestClient.post $oauth_token_endpoint, auth_payload, params\n auth_json = JSON.parse(@auth_response)\n auth_vals = {\"access_token\" => auth_json[\"access_token\"],\n \"instance_url\" => auth_json[\"instance_url\"]}\n end", "def get_followers\n HTTParty.post(\"#{@api_path}/users/followers/#{@handle}/#{@password}\")\n end", "def index\n render json: set_photo(current_user.friends), status: :ok\n end", "def index\n @accounts = current_user.accounts\n end", "def index\n @accounts = current_user.accounts\n end", "def authorize\n Flickr.authorize(ENV['FRESH_AUTH'])\nend", "def all\n @oauth_client = OauthClient.new\n @page[:per_page] = OauthClient.count\n @oauth_clients = OauthClient.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html { render 'index' }\n format.json { render json: @oauth_clients, callback: params[:callback] }\n format.xml { render xml: @oauth_clients }\n format.rss { render 'feed' }\n end\n end", "def show\n @account = current_user.person.linked_in_accounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @account }\n end\n end", "def show\n @account = Account.find_by_id(params[:id])\n if (@account)\n Rabl.render(@account, 'api/accounts/show', view_path: 'app/views')\n else\n render status: 401, json: {error: \"Invalid account\"}\n end\n end" ]
[ "0.6776277", "0.66489214", "0.66225606", "0.66021496", "0.6461425", "0.6384925", "0.6365791", "0.6320858", "0.62570953", "0.62461966", "0.6241318", "0.62353927", "0.61798775", "0.6128891", "0.6116205", "0.60819024", "0.6067792", "0.6064186", "0.60636634", "0.60282004", "0.5982136", "0.5946742", "0.59403807", "0.5933949", "0.5923056", "0.59171665", "0.5863779", "0.5858643", "0.58552855", "0.58238673", "0.58150375", "0.5810792", "0.5794393", "0.579434", "0.5766951", "0.5763252", "0.574845", "0.5747803", "0.5741633", "0.57070744", "0.5704421", "0.5699503", "0.5680046", "0.56756294", "0.5667517", "0.56594765", "0.5653334", "0.5651545", "0.5641101", "0.564092", "0.56405896", "0.56276125", "0.5624149", "0.56208926", "0.5605775", "0.55732", "0.55706114", "0.5566588", "0.5565174", "0.5558798", "0.5557628", "0.555696", "0.5540785", "0.5537634", "0.55295616", "0.55192614", "0.55183816", "0.5512392", "0.5508955", "0.5503694", "0.55021554", "0.54843485", "0.5484127", "0.548059", "0.5480494", "0.5470922", "0.54581517", "0.54579884", "0.54577917", "0.54528797", "0.5452452", "0.5446155", "0.543851", "0.5426358", "0.5416654", "0.5416654", "0.5396766", "0.5396576", "0.53914833", "0.5390622", "0.5389277", "0.5380475", "0.5371173", "0.536879", "0.5363272", "0.5363272", "0.53618467", "0.5353226", "0.5347662", "0.53440386" ]
0.7629078
0
GET /flickr_accounts/1 GET /flickr_accounts/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @flickr_accounts = FlickrAccount.all\n end", "def set_flickr_account\n @flickr_account = FlickrAccount.find(params[:id])\n end", "def get_account\n as_json(get_results('/account'))\n end", "def get_accounts()\n http_get(accounts_url)\n end", "def get_flickr_pics (photoset)\n\n api_key = '0dd1537c46575cf8b7b2a2df94156fd9'\n method = 'flickr.photosets.getPhotos'\n format = 'json'\n\n #for testing\n user_id = '128529405@N05'\n photoset_id = '72157648179656437' #ladder pics\n\n base_url = 'https://api.flickr.com/services/rest/'\n\n response = RestClient.get base_url, {\n :params => {\n 'api_key' => api_key,\n 'photoset_id' => photoset,\n 'method' => method,\n 'format' => format,\n 'nojsoncallback' => 1,\n 'extras' => 'original_format'\n }\n }\n\n return response\n\n end", "def social_accounts_for_a_project\n uri = \"#{@api_url}/#{@project_id}/accounts?access_token=#{@access_token}\"\n get uri\n end", "def all_accounts\n puts params[:id]\n accounts = []\n user = User.find params[:id]\n user.accounts.each do |f|\n accounts << {id:f.id, title: f.title}\n end\n render json: accounts\n end", "def auth\n # A short howto for web flow authentication on the flickr website.\n # This would live inside a rails controller or alternative framework equivalent\n # Error handling left out for clarity :-)\n # Added by Darren Greaves (https://github.com/boncey/)\n #\n # You need an API key first, see http://www.flickr.com/services/api/keys/\n # This is the URL Flickr will redirect your users to once they agree to access\n @callback_url = 'http://localhost:3000/callback'\n\n FlickRaw.api_key=API_KEY\n FlickRaw.shared_secret=SHARED_SECRET\n flickr = FlickRaw::Flickr.new\n token = flickr.get_request_token(:oauth_callback => URI.escape(@callback_url))\n # You'll need to store the token somewhere for when the user is returned to the callback method\n # I stick mine in memcache with their session key as the cache key\n session[:token] = token\n\n @auth_url = flickr.get_authorize_url(token['oauth_token'])\n # Stick @auth_url in your template for users to click\n end", "def show\n authorize @accounts\n render json: @account\n end", "def index\n @accounts = current_user.person.blackberry_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end", "def get_folio_data\n netid = params['netid']\n url = ENV['OKAPI_URL']\n tenant = ENV['OKAPI_TENANT']\n account = CUL::FOLIO::Edge.patron_account(url, tenant, folio_token, { username: netid })\n # Rails.logger.debug(\"mjc12test: Got FOLIO account #{account.inspect}\")\n render json: account\n end", "def auth\n\n @user = current_user\n puts @user.email\n Rails.cache.write(\"user_id\", @user.id)\n flickr = FlickRaw::Flickr.new\n token = flickr.get_request_token(:oauth_callback => (\n \"http://localhost:3000/mob/flickr/callback\"))\n Rails.cache.write(\"oauth_token_secret\",token['oauth_token_secret'])\n auth_url = flickr.get_authorize_url(token['oauth_token'], :perms => 'read')\n redirect_to(auth_url)\n end", "def flickr_url\n get_url(:flickr)\n end", "def accounts\n get('/accounts')['accounts']\n end", "def index\n @accounts = current_user.person.gmail_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end", "def create\n @flickr_account = FlickrAccount.new(flickr_account_params)\n\n if @flickr_account.save\n redirect_to flickr_accounts_path\n else\n render :new\n end\n\n # respond_to do |format|\n # if @flickr_account.save\n # format.html { redirect_to @flickr_account, notice: 'Flickr account was successfully created.' }\n # format.json { render :show, status: :created, location: @flickr_account }\n # else\n # format.html { render :new }\n # format.json { render json: @flickr_account.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def list_accounts\n HTTP.headers(:accept => @@accept).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\"#{@@base_url}/users/#{self.guid}/accounts\").parse[\"accounts\"]\n end", "def account(id)\n make_json_api_request :get, \"v2/accounts/#{id}\"\n end", "def flickr_api\n @flickr_api ||= Flickr.new(FLICKR.merge(:token => flickr_token))\n end", "def index\n\t\t@accounts = Account.all\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @accounts }\n\t\tend\n\tend", "def portfolio_accounts\n data = call_api(method: \"get\", url: \"/portfolio/accounts\" )\n @accountId = data.first[\"accountId\"]\n @accountId\n end", "def index\n index = json_account_params[:json_id].to_i if !index \n if admin_signed_in?\n @accounts = Account.all\n else\n @accounts = Account.tri(@current_user.id).all[(index)..(index + 5)]\n end\n index = index + 1\n respond_to do |format|\n format.html\n format.json { render json: @accounts, locals: {last: \"@last\"} }\n end\n end", "def flickr_auth\n # Just for fast testing it will be public,\n # in production it will be hidden in ENV VARS\n #\n FlickRaw.api_key = '142c9f2ece1cadf0771cec9aca1740fe'\n FlickRaw.shared_secret = '12f66489ef933ebb'\n end", "def show\n @account = current_user.person.gmail_accounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @account }\n end\n end", "def index\n # Get user\n host = AuthorizeApiRequest.call(params).result\n\n # Get image uri\n if host\n render json: { profile: host[:profileImage] }, status: :ok\n else\n render json: { status: 'error' }, status: :unprocessable_entity\n end\n end", "def show\n account = resource\n if params[:id].present?\n account = User.find_by_id(params[:id])\n end\n render json: account, status: 200\n end", "def index\n @accounts = current_user.person.linked_in_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end", "def list\n token = SocialService::Facebook.renew_token(token_params)\n\n accounts =\n SocialService::Facebook\n .accounts(token)\n .reject { |a| a[:id].in?(facebook_account_ids) }\n\n render json: { accounts: accounts }\n end", "def get_list_acc\n JSON.parse(curl_get(\"accounts\").body_str)\n end", "def show\n @account = current_user.person.blackberry_accounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @account }\n end\n end", "def index\n @accounts = Account.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accounts }\n end\n end", "def index\n @photos = Flickr.get_photos(params[:flickr_id], params[:n].to_i, PAGESIZE)\n @total_photos = @photos.total.to_i\n @photos_per_request = @photos.perpage.to_i\n end", "def show\n\t\treturn status 404 if @account.nil?\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @account }\n\t\tend\n\tend", "def callback \n begin\n user_id = Rails.cache.read(\"user_id\")\n @user = User.find(user_id)\n oauth_token_secret = Rails.cache.read(\"oauth_token_secret\")\n\n flickr = FlickRaw::Flickr.new\n oauth_token = params[:oauth_token]\n oauth_verifier = params[:oauth_verifier]\n\n raw_token = flickr.get_access_token(params[:oauth_token], oauth_token_secret, params[:oauth_verifier])\n oauth_token = raw_token[\"oauth_token\"]\n oauth_token_secret = raw_token[\"oauth_token_secret\"]\n\n flickr.access_token = oauth_token\n flickr.access_secret =oauth_token_secret\n\n if User.find(user_id).flickr_account\n User.find(user_id).flickr_account.delete\n end\n\n flickr_account = FlickrAccount.create(consumer_key: oauth_token , secret_key: oauth_token_secret)\n User.find(user_id).flickr_account = flickr_account\n\n unless flickr_account.new_record?\n flash[:notice] = 'Flickr account created $green'\n l = Log.new\n l.loggingtype =0\n l.user_id_1 = @user.id\n name_1 = if @user.name.nil? then @user.email.split('@')[0] else @user.name end\n l.message = \"#{name_1} is now connected to flickr account\"\n l.save\n else \n flash[:notice] = 'Flickr account couldn\\'t be created $red'\n end \n\n redirect_to controller: 'users', action: 'connect_social_accounts'\n \n rescue\n flash[:notice] = 'Couldn\\'t connect to flickr $red'\n redirect_to controller: 'users', action: 'connect_social_accounts'\n end\n end", "def index\n auth_response = plaid_client.auth.get(access_token)\n render json: auth_response.to_json\n end", "def list\n oauth_check_authorization\n \n @friends = facebook_client.friends_with_pictures\n end", "def index\n @accounts = current_user.person.phone_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end", "def get_favourite_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.favourites\n\n render status: 200, json: @restaurants\n end", "def login\n rsp = @flickr.send_request('flickr.test.login')\n rsp.user.username.to_s\n end", "def index\n @accounts = current_user.person.iphone_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end", "def get_accounts(page = 1, \r\n limit = 10, \r\n filter = nil, \r\n sort = nil)\r\n\r\n # prepare query url\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/accounts'\r\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\r\n 'page' => page,\r\n 'limit' => limit,\r\n 'filter' => filter,\r\n 'sort' => sort\r\n }\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'Content-Type' => Configuration.content_type\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n _request = @http_client.get _query_url, headers: _headers\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) if not (_context.response.raw_body.nil? or _context.response.raw_body.to_s.strip.empty?)\r\n return decoded\r\n end", "def index\n #@accounts = Account.all\n redirect_to root_path\n #respond_to do |format|\n #format.html # index.html.erb\n #format.json { render json: @accounts }\n #end\n end", "def get_accounts(page = 1, limit = 10, filter = nil)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts'\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\r\n 'page' => if page.nil? then 1 else page end,\r\n 'limit' => if limit.nil? then 10 else limit end,\r\n 'filter' => filter\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.get query_url, headers: headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def update\n # respond_to do |format|\n # if @flickr_account.update(flickr_account_params)\n # format.html { redirect_to @flickr_account, notice: 'Flickr account was successfully updated.' }\n # format.json { render :show, status: :ok, location: @flickr_account }\n # else\n # format.html { render :edit }\n # format.json { render json: @flickr_account.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end", "def show\n\t\t@account = Account.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @account }\n\t\tend\n\tend", "def index\n render json: set_photo(current_user.friends), status: :ok\n end", "def flickr\n @flickr_object ||= Flickr.new(FLICKR_CACHE, FLICKR_KEY, FLICKR_SECRET)\n end", "def flickr\n if self.url =~ %r(/p/(\\w+))\n photo_id = Base58.base58_to_int($1)\n else\n photo_id = self.url.scan(%r(/photos/[\\w@-]+/(\\d+))).flatten.last\n end\n return [nil, nil] unless photo_id\n \n flickr_with_photo_id(photo_id)\n end", "def flickr\n if self.url =~ %r(/p/(\\w+))\n photo_id = Base58.base58_to_int($1)\n else\n photo_id = self.url.scan(%r(/photos/[\\w@-]+/(\\d+))).flatten.last\n end\n return [nil, nil] unless photo_id\n \n flickr_with_photo_id(photo_id)\n end", "def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end", "def show\n @account_photos = @account.photos.all\n end", "def get_photos_from_flickr(args = {})\n args = GET_PHOTOS_DEFAULT_OPTIONS.merge(args)\n response = client.people.getPhotos(args)\n return nil if response.page > response.pages\n\n normalize(response:)\n end", "def get_friends( id, page=0, type='json', login=@login, password=@password )\n http = Net::HTTP.new('twitter.com', 80)\n json_data = http.start do |http_inst|\n path = \"/statuses/friends/#{id}.#{type}?page=#{page}\"\n req = Net::HTTP::Get.new(path)\n \n # we make an HTTP basic auth by passing the\n # username and password\n req.basic_auth login, password\n \n resp, data = http_inst.request(req)\n data\n end\n hash_data = JSON.parse( json_data )\n \n end", "def authorized\n photo_obj = API.get_one(params[:id], true, params[:access_token], params[:token_secret])\n if photo_obj['error'].nil?\n photo = PhotoPresenter.new(photo_obj['photo'])\n render :json => photo.as_json\n else\n render :json => photo_obj\n end\n end", "def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end", "def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end", "def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end", "def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end", "def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end", "def index\n @api_v1_accounts = Api::V1::Account.all\n end", "def account\n get('account')\n end", "def index\n @account = Account.new\n limit = params[:limit] || Account.count\n @page = { page: params[:page], per_page: limit.to_i }\n @order = params[:order] || \"name\"\n\n @accounts = Account.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accounts, callback: params[:callback] }\n format.xml { render xml: @accounts }\n format.rss { render 'feed' }\n end\n end", "def accounts\n request = request(method: :get, path: \"/Account.json\")\n response = request.perform\n instantiate(response[\"Account\"], Lightspeed::Account)\n end", "def show_account(id)\n get(\"accounts/#{id}\")\n end", "def show\r\n @account = Account.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @account }\r\n end\r\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def authorize\n Flickr.authorize(ENV['FRESH_AUTH'])\nend", "def index\n @account = Account.find(params[:account_id])\n @users = @account.users\n respond_to do |format|\n format.json { render json: @account.users.paginate(page: @page, per_page: @per_page) }\n end\n end", "def index\n email = AuthenticationHelper::Auth.instance.getEmailFromJWT( request )\n if ( email == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n user = User.find_by(email: email)\n if ( user )\n accounts = Account.where(user_id: user[\"id\"])\n render json: accounts, status: :ok\n else\n render json: :nothing, status: :unprocessable_entity\n end\n end", "def raw_info\n # This is a public API and does not need signing or authentication\n request = \"/services/rest/?format=json&method=flickr.people.getInfo&nojsoncallback=1&user_id=#{uid}\"\n @raw_info ||= MultiJson.decode(access_token.get(request).body)\n rescue ::Errno::ETIMEDOUT\n raise ::Timeout::Error\n end", "def show\n @credito = Credito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credito }\n end\n end", "def get_photos(arg)\n response_str = RestClient.get(\"#{arg}.json\")\n response_hash = JSON.parse(response_str)\n return response_hash\nend", "def index\n @accounts = policy_scope(Account)\n\n render json: @accounts, include: [:user]\n end", "def index\n response = @account_api.find_all\n if response[:status].to_i == 403\n redirect_to home_index_path\n flash[:alert] = \"You are not allowed to access this page\"\n end\n\n @accounts = response[:accounts]\n end", "def flickr_account_params\n params.require(:flickr_account).permit(:username)\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def index\n @oauth_accounts = OauthAccount.all\n end", "def get_rest_authentication()\n reader = CSV.open('keys/sf_key.csv')\n client_id = reader.shift[0]\n client_secret = reader.shift[0]\n username = reader.shift[0]\n password = reader.shift[0]\n auth_payload = \"grant_type=password&client_id=#{client_id}\" \\\n \"&client_secret=#{client_secret}\" \\\n \"&username=#{username}&password=#{password}\"\n params = {:accept => 'application/json'}\n @auth_response = RestClient.post $oauth_token_endpoint, auth_payload, params\n auth_json = JSON.parse(@auth_response)\n auth_vals = {\"access_token\" => auth_json[\"access_token\"],\n \"instance_url\" => auth_json[\"instance_url\"]}\n end", "def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @account }\n end\n end", "def index\n head 404\n # @api_v1_followers = Api::V1::Follower.all\n\n # render json: @api_v1_followers\n end", "def get_accounts\n response_xml = http_get(@client, \"#{xero_url}/Accounts\")\n parse_response(response_xml, {}, {:request_signature => 'GET/accounts'})\n end", "def get_accounts\n response_xml = http_get(\"#{xero_url}/accounts\")\n parse_response(response_xml)\n end", "def show\n user= params[:user]\n repo= params[:repo]\n puts user\n puts repo\n url = BASE_URL + \"repos/\" + user + \"/\" + repo + \"/collaborators\"+ \"?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\"\n # url = BASE_URL + \"repos/rails/rails/collaborators\"\n # url = BASE_URL + \"repositories\"\n @repo = JSON.parse(open(url).read)\n @results = []\n\n\n @repo.each do |doc|\n ids = doc['login']\n url_people = BASE_URL + \"users/\" + ids + \"?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\"\n @results << JSON.parse(open(url_people).read)\n end\n\n end", "def match_flickr(frob, params = {})\n require 'open-uri'\n\t begin\n\t require 'simpleflickr'\n\t rescue MissingSourceFile\n\t puts \"Please install simpleflickr\"\n\t return nil\n\t end\n begin\n require 'hpricot'\n rescue MissingSourceFile\n puts \"Please install Hpricot\"\n return []\n end\n \n\t unless params.key?(:api_key) && params.key?(:secret)\n\t raise ArgumentError.new(\"Params should contain at least :api_key and :secret\")\n\t end\n \n\t params = {\n\t :perms => 'read',\n\t :method => 'flickr.contacts.getList'\n\t }.merge(params)\n\t \n\t flickr_api = SimpleFlickr::WebAuthentication.new(params)\n\t params[:auth_token] = flickr_api.get_token_from_frob(frob)\n\t \n\t contact_list_url = \"http://flickr.com\" + flickr_api.url_for(params)\n\t doc = Hpricot.XML(open(contact_list_url))\n\t # there are no errors\n\t if (doc/'err').empty?\n contacts = (doc/\"contact\")\n realnames = contacts.map {|c| c.attributes['realname']}.uniq - [\"\"]\n usernames = contacts.map {|c| c.attributes['username']}.uniq\n\n users = (self.send(\"find_all_by_#{self.im_options[:nickname_field]}\", realnames) + \n self.send(\"find_all_by_#{self.im_options[:username_field]}\", usernames)).uniq\n return [users, []]\n # ERROR!\n else\n # TODO: do something nicer with the error\n puts error_msg = \"Flickr API ERROR: \" + (doc/'err').first.attributes['msg']\n return error_msg\n\t end\n end", "def show \n @user = User.find_by_id(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @user.to_json(:methods => [:avatar_url]) }\n end\n end", "def show \n @user = User.find_by_id(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @user.to_json(:methods => [:avatar_url]) }\n end\n end", "def show\n @account = Account.find_by_id(params[:id])\n if (@account)\n Rabl.render(@account, 'api/accounts/show', view_path: 'app/views')\n else\n render status: 401, json: {error: \"Invalid account\"}\n end\n end", "def accounts_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AccountsApi.accounts_get ...\"\n end\n # resource path\n local_var_path = \"/api/Accounts\"\n\n # query parameters\n query_params = {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AccountPage')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountsApi#accounts_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n\n begin\n\n @accounts = Account.active\n render json: @accounts.to_json(:except=>:password, :methods => [:subdomains, :template] )\n\n rescue => e\n render :json => e.message, :status => :unprocessable_entity\n end\n\n end", "def home\n \tif !params[:user_id].blank?\n\n \t\t@user_id = flickr.people.getInfo(:user_id => params[:user_id])\n \n \t \tget_pics_by_id\n\n \tend\t\n end", "def get_author\n id = params[:ID]\n puts \"ID:#{id}\"\n request = Net::HTTP::Get.new(\"/personality-api/1/author.json?ID=#{id}\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n response = @http.request(request)\n render :text => response.body\n\n end", "def profile cached_token=token\n uri = URI.parse(\"https://anypoint.mulesoft.com/accounts/api/me\")\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = true\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field(\"Authorization\", \"Bearer #{cached_token}\")\n\n response = client.request(request)\n\n return JSON.parse(response.body)\n end", "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def get_acc_info\n JSON.parse(curl_get(\"/api2/account/info/\").body_str)\n end", "def authorize(flickr) # :yields: url\n unless flickr.auth.token\n flickr.auth.getFrob\n url = flickr.auth.login_link\n yield url\n flickr.auth.getToken\n flickr.auth.cache_token\n end\n end", "def all\n @account = Account.new\n @page[:per_page] = Account.count\n @accounts = Account.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html { render 'index' }\n format.json { render json: @accounts, callback: params[:callback] }\n format.xml { render xml: @accounts }\n format.rss { render 'feed' }\n end\n end", "def get_me\n response = self.class.get(api_url(\"users/me\"),\n headers: { \"authorization\" => @auth_token })\n\n # Parse the JSON document returned in the response into a Ruby hash\n JSON.parse(response.body)\n end", "def index\n @accounts = Account.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accounts }\n end\n end", "def get_friends(cookie)\n \n # rescue is commented out to spot the error cases more clearly\n \n # begin\n friend_hash = PersonConnection.get_friends(self.id, cookie)\n # rescue RestClient::ResourceNotFound => e\n # #Could not find person with that id in COS Database!\n # return nil\n # end\n \n return friend_hash\n end", "def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end" ]
[ "0.7354691", "0.6772144", "0.63543683", "0.63428825", "0.6262356", "0.6249365", "0.62468874", "0.6238941", "0.61278594", "0.611957", "0.61042225", "0.6096055", "0.60798055", "0.6052219", "0.5967909", "0.5954868", "0.5938985", "0.5938434", "0.59004855", "0.5883806", "0.58812", "0.58549064", "0.5852268", "0.58369243", "0.5775777", "0.57721645", "0.5749123", "0.574822", "0.5733426", "0.57235974", "0.5720362", "0.571487", "0.5703315", "0.56571925", "0.5647849", "0.5637602", "0.5635009", "0.5618668", "0.56105995", "0.5602304", "0.55978024", "0.5597569", "0.5585204", "0.55833185", "0.55747306", "0.5571628", "0.5563532", "0.555864", "0.5557872", "0.5557872", "0.55557716", "0.5554691", "0.55530596", "0.55214876", "0.5516142", "0.55117774", "0.55117774", "0.55117774", "0.55117774", "0.55117774", "0.55103195", "0.55025405", "0.5498905", "0.54953164", "0.549524", "0.5488157", "0.54868317", "0.54715896", "0.5464316", "0.5460593", "0.546026", "0.5456388", "0.5452096", "0.54508674", "0.54444885", "0.54430115", "0.5442996", "0.5439891", "0.54342973", "0.5428823", "0.54270977", "0.54258776", "0.54230046", "0.5419157", "0.54190356", "0.54121464", "0.54121464", "0.54068524", "0.5404965", "0.5398855", "0.5398851", "0.53957814", "0.5385272", "0.53811514", "0.5375445", "0.53624916", "0.5356546", "0.53538084", "0.53519773", "0.5341497", "0.53402776" ]
0.0
-1
POST /flickr_accounts POST /flickr_accounts.json
def create @flickr_account = FlickrAccount.new(flickr_account_params) if @flickr_account.save redirect_to flickr_accounts_path else render :new end # respond_to do |format| # if @flickr_account.save # format.html { redirect_to @flickr_account, notice: 'Flickr account was successfully created.' } # format.json { render :show, status: :created, location: @flickr_account } # else # format.html { render :new } # format.json { render json: @flickr_account.errors, status: :unprocessable_entity } # end # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n megam_rest.post_accounts(to_hash)\n end", "def save\n Account.create!(account_params.map do |data|\n {\n type: :facebook,\n user: current_user,\n name: data[:name],\n data: data\n }\n end)\n\n render json: success\n end", "def set_flickr_account\n @flickr_account = FlickrAccount.find(params[:id])\n end", "def post_accounts(json_hash)\n @options = {:path => '/users.json',\n :body => json_hash[:json]}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n :body => @options[:body]\n )\n end", "def flickr_account_params\n params.require(:flickr_account).permit(:username)\n end", "def index\n @flickr_accounts = FlickrAccount.all\n end", "def create\n @oauth_account = OauthAccount.new(oauth_account_params)\n\n respond_to do |format|\n if @oauth_account.save\n format.html { redirect_to login_oauth_accounts_url(redirect_uri: params[:redirect_uri]) }\n format.json { render :show, status: :created, location: @oauth_account }\n else\n format.html { render :new }\n format.json { render json: @oauth_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_accounts\n end", "def add_account(payload)\n post(url_, payload)\n end", "def create_account(account_form)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts'\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.post query_url, headers: headers, parameters: account_form.to_json\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def create\n @account = BlackberryAccount.new(params[:blackberry_account])\n current_user.person.blackberry_accounts << @account\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to( accounts_path, :notice => 'Account was successfully created.') }\n format.json { render :json => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @account.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @account = current_user.accounts.build params[:account]\n \n account_array = accounts_from_credentials @account.api_email, @account.api_password\n \n accounts = account_array.map do |account_info|\n account = current_user.accounts.build params[:account]\n \n account.api_id = account_info.accountID\n account.api_name = account_info.accountName\n account.api_user_id = account_info.userID\n \n account\n end\n\n respond_to do |format|\n if !accounts.blank? && accounts.map(&:valid?).all? && accounts.map(&:save).all?\n flash[:notice] = \"#{accounts.size == 1 ? 'Account was' : \"#{accounts.size} accounts were\"} successfully created.\"\n format.html { redirect_to(@account) }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to root_path, success: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @account = Account.new(params[:account])\n respond_to do |format|\n if @account.save\n \n format.html { redirect_to \"http://#{@account.name}.#{request.domain}#{request.port_string}/login\", notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def all_accounts\n puts params[:id]\n accounts = []\n user = User.find params[:id]\n user.accounts.each do |f|\n accounts << {id:f.id, title: f.title}\n end\n render json: accounts\n end", "def create_account\n unless authenticated?\n payload = encode( { :user => { :github_account => github_user } } )\n response = site['users.json'].post payload, :content_type => :json\n !response.nil?\n end\n end", "def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n set_default = 0\n params[:acc_photos]['photo'].each do |a|\n @acc_photo = @account.photos.create!(:photo => a, :account_id => @account.id)\n @acc_photo.save\n end\n format.html { redirect_to [:admin, :accounts], notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def callback \n begin\n user_id = Rails.cache.read(\"user_id\")\n @user = User.find(user_id)\n oauth_token_secret = Rails.cache.read(\"oauth_token_secret\")\n\n flickr = FlickRaw::Flickr.new\n oauth_token = params[:oauth_token]\n oauth_verifier = params[:oauth_verifier]\n\n raw_token = flickr.get_access_token(params[:oauth_token], oauth_token_secret, params[:oauth_verifier])\n oauth_token = raw_token[\"oauth_token\"]\n oauth_token_secret = raw_token[\"oauth_token_secret\"]\n\n flickr.access_token = oauth_token\n flickr.access_secret =oauth_token_secret\n\n if User.find(user_id).flickr_account\n User.find(user_id).flickr_account.delete\n end\n\n flickr_account = FlickrAccount.create(consumer_key: oauth_token , secret_key: oauth_token_secret)\n User.find(user_id).flickr_account = flickr_account\n\n unless flickr_account.new_record?\n flash[:notice] = 'Flickr account created $green'\n l = Log.new\n l.loggingtype =0\n l.user_id_1 = @user.id\n name_1 = if @user.name.nil? then @user.email.split('@')[0] else @user.name end\n l.message = \"#{name_1} is now connected to flickr account\"\n l.save\n else \n flash[:notice] = 'Flickr account couldn\\'t be created $red'\n end \n\n redirect_to controller: 'users', action: 'connect_social_accounts'\n \n rescue\n flash[:notice] = 'Couldn\\'t connect to flickr $red'\n redirect_to controller: 'users', action: 'connect_social_accounts'\n end\n end", "def create\n\t\t@account = Account.new(params[:account])\n\n\t\trespond_to do |format|\n\t\t\tif @account.save\n\t\t\t\t# If we provide tokens (manually)\n\t\t\t\tif !@account.tokens?\n\t\t\t\t\tredirect_to '/auth/twitter?screen_name=' + @account.username\n\t\t\t\t\treturn\n\t\t\t\telse\n\t\t\t\t\tformat.html { redirect_to @account, notice: 'Account was successfully created.' }\n\t\t\t\t\tformat.json { render json: @account, status: :created, location: @account }\t\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @account.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @account = Account.new(params[:account])\n @account.owner = current_user\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n\n # sign in user\n user = @account.users.first\n sign_in(:user, user)\n @account.update_attributes(user_id: user.id)\n\n format.html { redirect_to prism_root_path(@account), notice: 'Welcome to Satiisfy!' }\n format.json { render action: 'show', status: :created, location: @account }\n else\n format.html { render action: 'new' }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_albums\n url = 'https://stg-resque.hakuapp.com/albums.json'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n albums = JSON.parse(response)\n\n albums.each do |album|\n Album.create!(album.except('id'))\n end\nend", "def create_account(options)\n form_data = options.merge({ 'action' => 'createaccount' })\n res, dummy = make_api_request(form_data)\n res\n end", "def create\n @account = Account.new(account_params)\n @account.zip = Account.random_zip\n @account.user_id = @current_user.id if @current_user\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_account_data\n \n render :json => {\n :csrf => form_authenticity_token,\n :burntAfter => Time.now + 30.days, # Current recommended max life\n :canPost => user_signed_in?,\n :signedIn => user_signed_in?\n }, \n :callback => params[:callback]\n end", "def add_favorite username, password, slideshow_id\n do_request 'add_favorite', username: username, password: password, slideshow_id: slideshow_id\n end", "def create\n @account = Account.new(account_params.merge({ user_id: @current_user.id }))\n\n if @account.save\n render :show, status: :created, location: @account\n else\n render json: @account.errors, status: :unprocessable_entity\n end\n end", "def auth\n # A short howto for web flow authentication on the flickr website.\n # This would live inside a rails controller or alternative framework equivalent\n # Error handling left out for clarity :-)\n # Added by Darren Greaves (https://github.com/boncey/)\n #\n # You need an API key first, see http://www.flickr.com/services/api/keys/\n # This is the URL Flickr will redirect your users to once they agree to access\n @callback_url = 'http://localhost:3000/callback'\n\n FlickRaw.api_key=API_KEY\n FlickRaw.shared_secret=SHARED_SECRET\n flickr = FlickRaw::Flickr.new\n token = flickr.get_request_token(:oauth_callback => URI.escape(@callback_url))\n # You'll need to store the token somewhere for when the user is returned to the callback method\n # I stick mine in memcache with their session key as the cache key\n session[:token] = token\n\n @auth_url = flickr.get_authorize_url(token['oauth_token'])\n # Stick @auth_url in your template for users to click\n end", "def create\n @account = PhoneAccount.new(params[:phone_account])\n current_user.person.phone_accounts << @account\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to( accounts_path, :notice => 'Account was successfully created.') }\n format.json { render :json => @account, :status => :created, :location => @account }\n else\n format.html { render :action => 'new' }\n format.json { render :json => @account.errors, :status => :unprocessable_entity }\n end\n end\n end", "def get_folio_data\n netid = params['netid']\n url = ENV['OKAPI_URL']\n tenant = ENV['OKAPI_TENANT']\n account = CUL::FOLIO::Edge.patron_account(url, tenant, folio_token, { username: netid })\n # Rails.logger.debug(\"mjc12test: Got FOLIO account #{account.inspect}\")\n render json: account\n end", "def update\n # respond_to do |format|\n # if @flickr_account.update(flickr_account_params)\n # format.html { redirect_to @flickr_account, notice: 'Flickr account was successfully updated.' }\n # format.json { render :show, status: :ok, location: @flickr_account }\n # else\n # format.html { render :edit }\n # format.json { render json: @flickr_account.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n\t\t@account = Account.new(:name => params[:name])\n\t\trespond_to do |format|\n\t\t\tif @account.save\n\t\t\t\tformat.json { render json: @account, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: @account.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n\n @grant = Grant.new(params[:grant])\n @grant.owner = current_user.id unless current_user.nil?\n\n respond_to do |format|\n if @grant.save\n\n cookies.delete :grant_image unless cookies[:grant_image].nil?\n\n format.html { render json: true }\n format.json { render json: @grant, status: :created, location: @grant }\n else\n format.html { render json: @grant.errors }\n format.json { render json: @grant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @account = GmailAccount.new(params[:gmail_account])\n current_user.person.gmail_accounts << @account\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to( accounts_path, :notice => 'Account was successfully created.') }\n format.json { render :json => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @account.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_account\n\n end", "def create\n response = @account_api.create(params)\n\n respond_to do |format|\n if response[:status] == 201\n format.html { redirect_to accounts_path , notice: 'Account successfully created.' }\n format.json { render :show, status: :created, location: user_path(response[:body]) }\n else\n format.html { redirect_to new_account_path, alert: formatted_error_message(response).join(\"<br/>\").html_safe }\n format.json { render json: response[:body], status: :unprocessable_entity }\n end\n end\n end", "def create\n current_account.follow(@account)\n # TODO: Set up a mailer for notifying accounts of new followers\n respond_to do |format|\n format.html { redirect_to account_url }\n format.json { render :status }\n end\n\n end", "def create\n resp = Faraday.post('https://api.github.com/user/repos') do |req|\n req.body = {'name': params[:name]}.to_json\n req.headers['Authorization'] = 'token ' + session[:token]\n req.headers['Accept'] = 'application/json'\n end\n redirect_to '/'\n end", "def create\n # Get the credit card details submitted by the form\n @account = Account.new\n authorize @account\n @account.user_id = account_params[:user_id]\n @account.package_id = account_params[:package_id];\n @user = User.find(account_params[:user_id])\n @account.users << @user\n @account.active = FALSE\n\n if @account.save\n render json: {status: :created, account: @account}\n else\n render json: { error: @account.errors, status: :unprocessable_entity }\n end\n end", "def update_photo_identities\n return unless token\n return unless provider_name == \"flickr\"\n return unless ( fi = user.flickr_identity )\n\n fi.token = token\n secret = auth_info.try( :[], \"credentials\" ).try( :[], \"secret\" )\n fi.secret = secret unless secret.blank?\n fi.save\n true\n end", "def social_accounts_for_a_project\n uri = \"#{@api_url}/#{@project_id}/accounts?access_token=#{@access_token}\"\n get uri\n end", "def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to accounts_path, notice: 'account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_account_link\n render json: Stripe::AccountLink.create(account_params.to_h), status: :created\n end", "def create\n @account = Account.new(params[:account])\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_photo\n if !params[:photo]\n @show_form = true;\n else\n @show_form = false;\n # set the particulars\n flickr_id = params[:photo][:flickrid];\n flickr_url = 'http://api.flickr.com/services/rest/'\n flickr_method = 'flickr.photos.getInfo'\n secret = 'xxxxx' # :NOTE: replace with your API secret\n api_key = 'xxxxx' # :NOTE: replace with your API key\n auth_token = 'xxxxx' # :NOTE: replace with your auth token\n \n # get information about this photo from flickr\n # generate the api signature\n sig_raw = secret + 'api_key' + api_key + 'auth_token' + auth_token + 'method' + flickr_method + 'photo_id' + flickr_id\n api_sig = MD5.hexdigest(sig_raw)\n page_url = flickr_url + '?method=' + flickr_method +\n '&api_key=' + api_key + '&auth_token=' + auth_token +\n '&api_sig=' + api_sig + '&photo_id=' + flickr_id\n # get the data and parse it\n page_xml = Net::HTTP.get_response(URI.parse(page_url)).body\n full_flickr_page = XmlSimple.xml_in(page_xml)\n # if we didn't get an error from flickr...\n if full_flickr_page['stat'] == 'ok'\n flickr_page = full_flickr_page['photo'][0]\n # create the new photo object and fill it up\n photo = Photo.new\n photo.flickrid = flickr_id\n photo.farm = flickr_page['farm']\n photo.secret = flickr_page['secret']\n photo.server = flickr_page['server']\n photo.dateadded = Time.at(flickr_page['dateuploaded'].to_i)\n photo.lastupdate = Time.at(flickr_page['dates'][0]['lastupdate'].to_i)\n photo.seen_at = Time.now\n photo.flickr_status = \"not in pool\"\n photo.mapped = (!flickr_page['location']) ? 'false' : 'true'\n \n # now try and get a record for the owner of this photo\n owner = Person.find_by_flickrid(flickr_page['owner'][0]['nsid'])\n # if the owner doesn't exist, create it\n if !owner\n owner = Person.new\n end\n # set the details\n owner.flickrid = flickr_page['owner'][0]['nsid']\n owner.username = flickr_page['owner'][0]['username']\n owner.flickr_status = \"active\"\n \n # save the owner\n owner.save\n # attach the owner to the photo\n photo.person = owner\n \n # we got an error from flickr\n else\n photo = Photo.new\n photo.flickrid = flickr_id\n photo.dateadded = Time.at(0)\n photo.lastupdate = Time.at(0)\n photo.seen_at = Time.now\n photo.flickr_status = \"missing\"\n end\n\n # save the photo\n photo.save\n \n # redirect to the photo's show page\n redirect_to :action => 'show', :id => photo\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create\n @personal_account = PersonalAccount.new(params[:personal_account])\n\n respond_to do |format|\n if @personal_account.save\n format.html { redirect_to @personal_account, :notice => 'Personal account was successfully created.' }\n format.json { render :json => {:data => @personal_account , :success => true }, :status => :created, :location => @personal_account }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => {:msg => @personal_account.errors, :status => :unprocessable_entity} }\n end\n end\n end", "def create\r\n @account = Account.new(params[:account])\r\n\r\n respond_to do |format|\r\n if @account.save\r\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\r\n format.json { render json: @account, status: :created, location: @account }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @account.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @account = Account.new(params[:account])\n \n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_post\n begin\n #asks the user for the title, body, and whether it should be anonymous\n print \"Title: \"\n title = STDIN.gets.chomp\n print \"Body: \"\n body = STDIN.gets.chomp\n print \"Post as Anonymous? (y/n): \"\n anonymous = STDIN.gets.chomp.upcase == 'Y' ? true : false\n # check user information from login\n\n # Rails will reject this unless you configure the cross_forgery_request check to\n # a null_session in the receiving controller. This is because we are not sending\n # an authenticity token. Rails by default will only send the token with forms /users/new and\n # /users/1/edit and REST clients don't get those.\n # We could perhaps arrange to send this on a previous\n # request but we would then have to have an initial call (a kind of login perhaps).\n # This will automatically send as a multi-part request because we are adding a\n # File object.\n response = RestClient.post \"#{@@DOMAIN}/api/posts.json\",\n\n {\n post: {\n title: title,\n body: body,\n anonymous: anonymous\n },\n }, authorization_hash\n\n if (response.code == 201)\n puts \"Created successfully\"\n end\n puts \"URL for new resource: #{response.headers[:location]}\"\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end", "def create\n\t\n\t\t @ranks = Rank.all\n\t\t u = URI.parse('https://rpxnow.com/api/v2/auth_info')\n\t\t req = Net::HTTP::Post.new(u.path)\n\t\t req.set_form_data({'token' => params[:token],\n\t\t 'apiKey' => 'bcc2de236838231be15aad6d81751f1cc63e642a', # <-- your RPX api key here.\n\t\t 'format' => 'json'})\n\t\t\n\t\t http = Net::HTTP.new(u.host,u.port)\n\t\t http.use_ssl = true if u.scheme == 'https'\n\t\t res = http.request(req)\n\t\t\n\t\t json_resp = res.body\n\t\t json = JSON.parse(json_resp)\n\t\t\n\t\t if json['stat'] == 'ok'\n\t\t unique_identifier = json['profile']['identifier']\n\t\t username = json['profile']['preferredUsername']\n\t\t nickname = json['profile']['displayName'] if nickname.nil?\n\t\t email = json['profile']['email']\n\t\t photo_url = json['profile']['photo']\n\t\t\n\t\t \n\t\t\n\t\t # implement your own do_success method which signs the user in\n\t\t # to your website\n\t\t #do_success(unique_identifier,email,nickname,photo_url)\n\t\t #TODO: have to hardcode because a pw is required by the model. Figure out a better way\n\t\t data = {:name => username, :email => email, :identifier => unique_identifier, :password=> 'defaultsupersecret'}\n\t\t \n\t\t self.current_user = User.find_by_identifier(data[:identifier]) || User.create!(data)\n\t\t redirect_to '/'\n\t\t else\n\t\t flash[:notice] = 'Log in failed'\n\t\t redirect_to '/'\n\t\t end\n \nend", "def create\n @account = IphoneAccount.new(params[:iphone_account])\n current_user.person.iphone_accounts << @account\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to( accounts_path, :notice => 'Account was successfully created.') }\n format.json { render :json => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @account.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n \n @account = Account.new(params[:account])\n\n respond_to do |format|\n \n if @account.save\n sign_in(@account)\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n \n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @heroku_account = Heroku::Account.new(heroku_account_params)\n\n respond_to do |format|\n if @heroku_account.save\n format.html { redirect_to @heroku_account, notice: 'Account was successfully created.' }\n format.json { render action: 'show', status: :created, location: @heroku_account }\n else\n format.html { render action: 'new' }\n format.json { render json: @heroku_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n author = Author.create!(author_params)\n auth_token = AuthenticateAuthor.new(author.email, author.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end", "def create\n @fact = @cat.facts.create!({ fact: api_request })\n if @fact.save\n render json: @fact\n else\n render error: { message: \"Não foi possível criar esse fato para este gatinho! :(\" }, status: 400\n end\n end", "def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def add\r\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:recipe_id]}/information\")\r\n\r\n http = Net::HTTP.new(url.host, url.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request = Net::HTTP::Get.new(url)\r\n request[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"] #hidden API key\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response = http.request(request)\r\n recipe_data = JSON.parse response.read_body\r\n recipe = Recipe.create :title => recipe_data[\"title\"], :image => recipe_data[\"image\"]\r\n @current_user.recipes << recipe # add recipe to My Recipes\r\n\r\n redirect_to my_recipes_path\r\n end", "def post(url)\n response = RestClient::Request.new(\n method: :post,\n url: \"#{ENDPOINT_URL}/#{url}\",\n verify_ssl: false,\n headers: {\n 'Content-Type' => 'application/json',\n 'Authorization' => \"Basic #{authorization_hash}\"\n },\n payload: {user: user, pwd: password}.to_json\n ).execute\n\n # Parse the response to Ruby objects\n JSON.parse(response)\n end", "def account_create(uid,display_name)\n user_hash = @client.user_create(\"#{uid}\",\"#{display_name}\")\n Rails.logger.debug '> Radosgw: Account create'\n user_json = user_hash.to_json\n storage = Storage.new(STORAGES_BUCKET)\n storage.upload(uid, user_json, 'application/json')\n user_hash\n end", "def destroy\n # @flickr_account.destroy\n # respond_to do |format|\n # format.html { redirect_to flickr_accounts_url, notice: 'Flickr account was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end", "def add_cameras(brand)\n full_url = \"https://api.flickr.com/services/rest/?method=flickr.cameras.getBrandModels&api_key=#{FLICKR_KEY}&brand=#{brand}\"\n raw_response = HTTParty.get(full_url)\n data = raw_response.to_hash\n brand_array = data[\"rsp\"][\"cameras\"][\"camera\"]\n\n brand_array.each do |camera|\n Camera.create(\n brand: brand,\n name: camera[\"name\"],\n small_image_url: camera[\"images\"][\"small\"],\n large_image_url: camera[\"images\"][\"large\"],\n megapixels: camera[\"details\"][\"megapixels\"],\n lcd_screen_size: camera[\"details\"][\"lcd_screen_size\"],\n memory_type: camera[\"details\"][\"memory_type\"]\n )\n end\n\nend", "def create\n @account = Current.book.accounts.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @saving_account = current_user.portfolios.default.saving_accounts.build(saving_account_params)\n\n respond_to do |format|\n if @saving_account.save\n format.html { redirect_to root_path, notice: 'Saving Account was successfully added.' }\n format.json { render :show, status: :created, location: @saving_account }\n else\n format.html { render :new }\n format.json { render json: @saving_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @house_account = HouseAccount.new(house_account_params)\n puts \"got params #{house_account_params}\"\n if @house_account.save\n render json: @house_account, status: :created, location: @house_account\n else\n render json: @house_account.errors, status: :unprocessable_entity\n end\n end", "def auth\n\n @user = current_user\n puts @user.email\n Rails.cache.write(\"user_id\", @user.id)\n flickr = FlickRaw::Flickr.new\n token = flickr.get_request_token(:oauth_callback => (\n \"http://localhost:3000/mob/flickr/callback\"))\n Rails.cache.write(\"oauth_token_secret\",token['oauth_token_secret'])\n auth_url = flickr.get_authorize_url(token['oauth_token'], :perms => 'read')\n redirect_to(auth_url)\n end", "def create\n @person = @account.people.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n # TODO validar atributos?\n response = Http.post(\"/organizations/api/identities/#{self.identity.uuid}/accounts/\", create_body)\n raise \"unexpected response: #{response.code} - #{response.body}\" unless response.code == 201\n attributes_hash = MultiJson.decode(response.body)\n set_attributes(attributes_hash)\n @persisted = true\n @errors = {}\n true\n rescue *[RestClient::BadRequest] => e\n @persisted = false\n @errors = MultiJson.decode(e.response.body)\n false\n end", "def create\n @account = Account.new(account_params)\n @account.user_created_id = current_user.id\n respond_to do |format|\n if @account.save\n format.html { redirect_to accounts_path, notice: I18n.t('account.controller.create') }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload_to_flickr!\n # download image to tmp/\n photo_path = download_from_instagram\n @log.debug(\"Path is #{photo_path}\")\n # upload to flickr\n flickr.access_token = @params['flickr_access_token']\n flickr.access_secret = @params['flickr_access_secret']\n response = flickr.upload_photo photo_path, :title => @payload['title'], :description => @payload['caption'] \n @log.debug(\"Flickr Response = #{response}\")\n # push it into the Redii and delete local version.\n add_to_storage\n File.delete(photo_path)\n end", "def create\n @account = MasterData::Account.new(account_params_with_author)\n authorize @account, :create?\n\n respond_to do |format|\n if @account.update_aliases(@aliases) && @account.save\n # keep @account.save at the end of the condition bellow to ensure the right object is returned during rendering\n\n format.html do\n render :show, notice: \"Account was successfully created.\"\n end\n format.json do\n render json: @account, status: :created, location: :api_v2_accounts\n end\n else\n format.html { render :new }\n format.json do\n render json: @account.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def stub_flickr_method(name, res_opts = {}, req_opts = {})\n req_opts.reverse_merge!(format: 'json',\n nojsoncallback: '1',\n method: name)\n\n req = stub_request(:post, 'https://api.flickr.com/services/rest/')\n res = res_opts.to_json\n\n req.with(body: hash_including(req_opts)).to_return(body: res)\n end", "def create\n user = AuthenticationManager.new(\n params.slice(%i[email first_name last_name password]).merge(is_profile_owner: true, password_confirmation: params[:password], tos_accepted: params.bool(:tos_accepted))\n ).register\n user = session_manager.login(user.email, params[:password], use_api_token: true)\n json_success user: api_response.current_user_data(user)\n end", "def create\n @account = Account.new(account_params)\n @account.user = @user\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @api_v1_account = Api::V1::Account.new(api_v1_account_params)\n\n respond_to do |format|\n if @api_v1_account.save\n format.html { redirect_to @api_v1_account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_account }\n else\n format.html { render :new }\n format.json { render json: @api_v1_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_curl\n `curl -X \"POST\" -H \"Authorization: Basic #{_encode}\" -d grant_type=client_credentials https://accounts.spotify.com/api/token`\n end", "def proxy\n authorize! :account\n user = User.create_with(password: SecureRandom.urlsafe_base64)\n .find_or_create_by(email: params[:to])\n render json: make_token_response(user), status: :ok\n end", "def profiles_post(options = {})\n\n=begin\n #add access token if it exists\n url = \"\"\n if options[:access_token]\n url = \"https://api.meetup.com/2/profile.json?access_token=#{options[:access_token]}\"\n #url = \"https://api.meetup.com/2/profile.json\"\n else\n url = \"https://api.meetup.com/2/profile.json\"\n end\n=end\n\n url = \"https://api.meetup.com/2/profile.json\"\n\n puts \"profiles post url #{url}\"\n\n response = post_response(url,options)\n\n if response == \"OK\"\n puts \"OK\"\n else\n puts response.to_yaml\n end\n end", "def create\n # Get user\n host = AuthorizeApiRequest.call(params).result\n image = '' + parse_string(params[:profileImage]) + '&token=' + params[:token]\n # Update their profile image\n if host.update(profileImage: image)\n render json: { status: 'success' }, status: :ok\n else\n render json: { status: 'error' }, status: :unprocessable_entity\n end\n rescue Exception => e # Never do this!\n render json: { status: 'error' }, status: :unprocessable_entity\n end", "def create\r\n @account = Account.new(params[:account])\r\n @account.updating_password = true\r\n\r\n\r\n @family_type = FamilyType.find(params[:family_type])\r\n @account.family_type = @family_type\r\n\r\n\r\n if @account.save\r\n sign_in @account\r\n flash[:success] = \"Account created successfully!\"\r\n redirect_to @account\r\n else\r\n @account.creating_account = true\r\n @family_types = FamilyType.all\r\n @family_type = FamilyType.find(params[:family_type])\r\n render 'new'\r\n end\r\n end", "def create\n flash[:notice] = 'The account was successfully created.' if account.save\n respond_with(account)\n end", "def create\n @account = Account.new(params[:account])\n @account.member = current_member\n logger.info @account.inspect\n \n respond_to do |format|\n if @account.save\n flash[:notice] = 'Thanks for signing up!' \n format.html { \n redirect_back_or_default('/')\n }\n format.xml do\n headers[\"Location\"] = account_url(@account)\n render :nothing => true, :status => \"201 Created\"\n end\n else\n flash[:notice] = 'There was a problem creating your account, but we can address that later. If you need to sell something right now, please contact support.'\n redirect_back_or_default('/')\n format.xml { render :xml => @account.errors.to_xml }\n end\n end\n end", "def create\n feed = Feed.new(:user_id => params[:user_id], :name => params[:name])\n if feed.save\n render :json => feed, :status => :created\n else\n render :json => {:ok => false, :message => feed.errors}, :status => :unprocessable_entity\n end\n end", "def create\n account = Account.find_by(email: params[:email].downcase)\n if !account.nil? && account.authenticate(params[:password])\n render json: { auth: auth_token(account), activated: account.activated }\n else\n render json: { errors: \"Password does not match\" }, status: 400\n end\n end", "def create\n @insta_account = InstaAccount.new(insta_account_params)\n\n respond_to do |format|\n if @insta_account.save\n format.html { redirect_to @insta_account, notice: 'Insta account was successfully created.' }\n format.json { render :show, status: :created, location: @insta_account }\n else\n format.html { render :new }\n format.json { render json: @insta_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @account = Account.new(account_params)\n @account.user_id = current_user.id\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def accounts\n end", "def create\n @account = Account.new(params[:account])\n\n respond_to do |format|\n if @account.save\n #format.html { redirect_to(@account, :notice => 'Account was successfully created.') }\n format.json { render :json => @account, :status => :created, :location => @account }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n #format.html { render :action => \"new\" }\n format.json { render :json => @account.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to accounts_url, notice: 'Account was successfully created.' }\n format.json { render action: 'show', status: :created, location: @account }\n else\n format.html { render action: 'new' }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @account = Account.new(params[:account])\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: t('common.created', model: human_name) }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(\n username: user_params[:username],\n password: user_params[:password])\n if user.save\n create_example_collection(user)\n render json: user, except: [:password_digest, :created_at, :updated_at]\n else\n render json: {errors: user.errors.full_messages}\n end\n end", "def show\n authorize @accounts\n render json: @account\n end" ]
[ "0.66967624", "0.62125397", "0.6038969", "0.6014178", "0.5993962", "0.58316964", "0.58119494", "0.57744527", "0.5771591", "0.5614921", "0.5611416", "0.5591132", "0.5576551", "0.5562358", "0.55380666", "0.5530687", "0.55035764", "0.54898775", "0.5480192", "0.5462454", "0.5446217", "0.54230356", "0.5419157", "0.54180485", "0.539682", "0.5391144", "0.53876096", "0.5377792", "0.53767484", "0.53744996", "0.53726304", "0.5354446", "0.53498816", "0.5337027", "0.53225356", "0.5310818", "0.529471", "0.5290846", "0.5286869", "0.52702564", "0.5268899", "0.5265943", "0.5263113", "0.526278", "0.52571166", "0.52459866", "0.5228977", "0.52289534", "0.5223487", "0.5216529", "0.52128536", "0.5212531", "0.5210855", "0.52021885", "0.52014613", "0.52007", "0.51885784", "0.51885784", "0.51885784", "0.51885784", "0.51885784", "0.51885784", "0.51885784", "0.51885784", "0.51885784", "0.51781636", "0.5174188", "0.5172646", "0.51645637", "0.51639515", "0.51492417", "0.5143524", "0.51418567", "0.51366735", "0.5125754", "0.5118129", "0.50913465", "0.5086072", "0.50845367", "0.50840384", "0.50775063", "0.5076954", "0.507446", "0.5061259", "0.5057263", "0.505582", "0.5049046", "0.5046291", "0.50433445", "0.5040894", "0.50388783", "0.50377023", "0.5035563", "0.5025736", "0.5024082", "0.5019318", "0.5018971", "0.5007126", "0.4999552", "0.4999319" ]
0.6866553
0
PATCH/PUT /flickr_accounts/1 PATCH/PUT /flickr_accounts/1.json
def update # respond_to do |format| # if @flickr_account.update(flickr_account_params) # format.html { redirect_to @flickr_account, notice: 'Flickr account was successfully updated.' } # format.json { render :show, status: :ok, location: @flickr_account } # else # format.html { render :edit } # format.json { render json: @flickr_account.errors, status: :unprocessable_entity } # end # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def set_flickr_account\n @flickr_account = FlickrAccount.find(params[:id])\n end", "def update_photo_identities\n return unless token\n return unless provider_name == \"flickr\"\n return unless ( fi = user.flickr_identity )\n\n fi.token = token\n secret = auth_info.try( :[], \"credentials\" ).try( :[], \"secret\" )\n fi.secret = secret unless secret.blank?\n fi.save\n true\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update \n begin\n @resource = Account.find(params[:id])\n @resource.update_attributes!(params[:account])\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end", "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "def modify(name: nil, avatar: nil, channel_id: nil)\n RestClient.patch(@url, { name: name, avatar: avatarise(avatar), channel_id: channel_id }.compact.to_json, content_type: :json)\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def put!\n request! :put\n end", "def test_update\n #Again the delete feature from ActiveResource does not work out of the box.\n #Using custom delete function\n puts \"--create a new account--\"\n new_acct = Salesforce::Rest::Account.new(:Name => \"test numero uno\", :BillingStreet=> \"Fairway Meadows\",\n :BillingState => \"NY\", :ShippingCity => \"New York\")\n resp = new_acct.save()\n\n assert (resp.code == 201)\n j = ActiveSupport::JSON\n @sf_oid = j.decode(resp.body)[\"id\"]\n puts \"New Object created: id -> \" + @sf_oid\n\n puts \"--update that new account--\"\n serialized_json = '{\"BillingState\":\"WA\"}'\n #http = Net::HTTP.new(@rest_svr_url, 443)\n http = Net::HTTP.new('na7.salesforce.com', 443)\n http.use_ssl = true\n \n class_name = \"Account\"\n path = \"/services/data/v21.0/sobjects/#{class_name}/#{@sf_oid}\"\n headers = {\n 'Authorization' => \"OAuth \"+ @oauth_token,\n \"content-Type\" => 'application/json',\n }\n code = serialized_json\n\n \n req = Net::HTTPGenericRequest.new(\"PATCH\", true, true, path, headers)\n\n resp = http.request(req, code) { |response| }\n assert !resp.nil?\n\n puts resp.to_s\n end", "def update\n account = current_organization.accounts.find(params[:id])\n return forbidden unless account && current_account.allowed_to_edit_account?(account, current_organization)\n return json(account) unless account.update_attributes pick(params, :first_name, :last_name, :email,:language, :document_language)\n\n role = pick(params, :role)\n #account.update_attributes(role) if !role.empty? && current_account.admin?\n membership = current_organization.role_of(account)\n membership.update_attributes(role) if !role.empty? && current_account.admin?\n password = pick(params, :password)[:password]\n if (current_account.id == account.id) && password\n account.update(password: password)\n end\n json account.canonical(membership: membership)\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update_current_logged_in_users_password(args = {}) \n id = args['id']\n temp_path = \"/users.json/current/password\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch!\n request! :patch\n end", "def update\n @account = Account.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n format.html { redirect_to quick_launch_path, notice: 'Account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_profile(body={})\n perform_post(\"/account/update_profile.json\", :body => body)\nend", "def update\n head :unauthorized\n end", "def update\n authorize @account\n if @account.update(account_params)\n render json: { status: :ok, account: @account }\n else\n render json: {error: @account.errors, status: :unprocessable_entity }\n end\n end", "def update\n @account = Account.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n #current_user.twitter.update(@account.content) if params[:twitter] == 'yes'\n #if params[:facebook] == 'yes'\n # current_user.facebook.feed!(:message => \"test\",\n # :link => \"http://moonkey.jp\",\n # :name => \"TEST\",\n # :description => \"test\")\n #end\n format.html { redirect_to accounts_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(args)\n builder.update_rest(type, ref, args, username, password)\n self.elements(true)\n end", "def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single family based on the id\n family = Family.find_by(id: the_id)\n\n # update it\n if family.update!(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end", "def update\n respond_to do |format|\n if @oauth_account.update(oauth_account_params)\n format.html { redirect_to @oauth_account, notice: 'Oauth account was successfully updated.' }\n format.json { render :show, status: :ok, location: @oauth_account }\n else\n format.html { render :edit }\n format.json { render json: @oauth_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end", "def update\n respond_to do |format|\n if @api_v1_account.update(api_v1_account_params)\n format.html { redirect_to @api_v1_account, notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_account }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def put options\n rest_request({ method: :put }.merge(options))\n end", "def put options\n rest_request({ method: :put }.merge(options))\n end", "def update\n errors = {}\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n if params[:person]\n begin\n if @person.json_update_attributes(params[:person])\n render_json :entry => @person.to_hash(@user, @client) and return\n end\n rescue NoMethodError => e\n errors = e.to_s\n end\n end\n\n render_json :status => :bad_request, :messages => @person.errors.full_messages\n @person = nil\n end", "def update\n respond_to do |format|\n if @account.update(account_params)\n if params[:acc_photos]\n params[:acc_photos]['photo'].each do |a|\n @acc_photo = @account.photos.create!(:photo => a, :account_id => @account.id)\n end\n end \n format.html { redirect_to [:admin, :accounts], notice: 'Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @account }\n else\n format.html { render :edit }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :manage, @flock\n\n respond_to do |format|\n if @flock.update(flock_params)\n format.html { redirect_to @flock, notice: \"Flock was successfully updated.\" }\n format.json { render :show, status: :ok, location: @flock }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @flock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rest.update(rest_params)\n format.html { redirect_to @rest, notice: 'Rest was successfully updated.' }\n format.json { render :show, status: :ok, location: @rest }\n else\n format.html { render :edit }\n format.json { render json: @rest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end", "def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n respond_to do |format|\n require 'rest-client'\n response = RestClient.put('localhost:3001/colores/'+@color.id.to_s, color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n\n format.html { redirect_to @color, notice: \"Color was successfully updated.\" }\n format.json { render :show, status: :ok, location: @color }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize [:api, :v1, @requesting_object]\n ticket = ServiceTicket.where(\n client_key: params['avatar_key'],\n id: params['id']\n ).first\n if params['comment_text']\n ticket.comments << Comment.new(author: params['avatar_name'],\n text: params['comment_text'])\n end\n ticket.update(status: params['status']) if params['status']\n render json: { message: 'OK' }, status: :ok\n end", "def update\n get_credentials\n begin\n response = resource[\"/update/#{app}\"].post(:apikey => @credentials[1], :frequency => options[:frequency])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end", "def update_account\n @user.update(user_params)\n if @user.errors.any?\n render json: @user.errors.messages, status: 400\n else\n image_url = \"\"\n image_url = url_for(@user.profile_photo) if @user.profile_photo.attached?\n render json: { first_name: @user.first_name, last_name: @user.last_name, email: @user.email, profile_photo: image_url }, status: 200\n end\n rescue StandardError => e\n render json: { message: \"Error: Something went wrong... \" }, status: :bad_request\n end", "def update\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n if @resource.update(resource_params)\n render json: @resource, status: :ok\n else\n render json: @resource.errors, status: :unprocessable_entity\n end\n end", "def update\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n if @fabric.update_attributes(params[:fabric])\n format.html { redirect_to @fabric, notice: 'Fabric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fabric.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end", "def update_users_password_by_e_mail(args = {}) \n put(\"/users.json/backoffice/email/#{args[:email]}/password/#{args[:password]}\", args)\nend", "def update_users_password_by_e_mail(args = {}) \n put(\"/users.json/backoffice/email/#{args[:email]}/password/#{args[:password]}\", args)\nend", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end", "def update\n @fred = Fred.find(params[:id])\n\n respond_to do |format|\n if @fred.update_attributes(params[:fred])\n format.html { redirect_to @fred, notice: 'Fred was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fred.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = current_user.photos.find_by_id(params[:id])\n if @photo.nil?\n render json: {error: 'foto no encontrada'}, status: :not_found\n elsif @photo.update(photo_params)\n render json: @photo\n else\n render json: @photo.errors, status: :unprocessable_entity\n end\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def update_current_logged_in_user(args = {}) \n id = args['id']\n temp_path = \"/users.json/current\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @account = current_user.person.blackberry_accounts.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:blackberry_account])\n format.html { redirect_to( accounts_path, :notice => 'Account was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @account.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_infos\n skip_authorization\n respond_to do |format|\n format.json do\n render json: hashing_infos\n end\n end\n end", "def update_resource(resource, params)\n if [\"facebook\", \"github\", \"google_oauth2\"].include? current_user.provider\n params.delete(\"email\")\n params.delete(\"avatar\")\n resource.update_without_password(params)\n else\n resource.update_with_password(params)\n end\n end", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update # PATCH\n raise NotImplementedError\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def contact_updated(freshdesk_data,contact_id)\n\t\t#Rails.logger.info \"Update method id and data\"\n\t\t#Rails.logger.debug \"#{@api_domain}-#{contact_id}-#{@api_key}\"\n\t\t#Rails.logger.debug \"#{freshdesk_data.to_json}\"\n\t response = HTTParty.put(\n\t \"#{@api_domain}contacts/#{contact_id}\", \n\t\t basic_auth: { username: @api_key, password: \"password\" },\n\t\t headers: { 'Content-Type' => 'application/json' },\n\t\t body: freshdesk_data.to_json\n\t )\n\tend", "def update\n @pictures = Picture.all.order(created_at: :desc)\n @picture.update(picture_params)\n render json: @pictures\n # head :no_content\n end", "def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end", "def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end", "def update\n\t\t\t\ttoken = params[:auth_token]\n\t\t\t\tid = params[:id].to_i\n\n\t\t\t\tif token.nil?\n\t\t\t\t\trender :status => 400,\n\t\t\t\t\t\t:json => { :message => \"The request must contain an auth token.\"}\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\t@user = User.find_by_authentication_token(token)\n\t\t\t\taccount = JSON.parse params[:account]\n\n\t\t\t\tif account[\"username\"].nil?\n\t\t\t\t\trender :status => 400,\n\t\t\t\t\t\t:json => { :message => \"'username' cannot be null.\"}\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\tif account[\"computer_id\"].nil?\n\t\t\t\t\trender :status => 400,\n\t\t\t\t\t\t:json => { :message => \"The request must contain a 'computer_id'.\"}\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\t@accounts = Account.where computer_id: @user.computer_ids\n\t\t\t\tif id != 0\n\t\t\t\t\tunless @accounts.pluck(:id).include? id\n\t\t\t\t\t\trender :status => 401,\n\t\t\t\t\t\t\t:json => { :message => \"Access Denied, check account Id.\"}\n\t\t\t\t\t\treturn\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tputs \n\t\t\t\tputs account\n\t\t\t\tputs \n\t\t\t\tputs account[\"account_process_attrubutes\"]\n\t\t\t\tputs \n\t\t\t\tputs \n\t\t\t\t@account = Account.find(id)\n\t\t\t\tif Account.update(id, account)\n\t\t\t\t\trender json: {account: @account}\n\t\t\t\telse\n\t\t\t\t\trender :json => { :message => \"Something went wrong with saving the entity.\"}\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\tend", "def test_update_successful\n data = {\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"anh@gmallds.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def user_update_me(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: UserApi#user_update_me ... opts: #{opts}\"\n end\n\n # resource path\n path = \"/user\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n form_params[\"firstname\"] = opts[:'firstname'] if opts[:'firstname']\n form_params[\"lastname\"] = opts[:'lastname'] if opts[:'lastname']\n form_params[\"oldPassword\"] = opts[:'old_password'] if opts[:'old_password']\n form_params[\"newPassword\"] = opts[:'new_password'] if opts[:'new_password']\n form_params[\"newPasswordConfirm\"] = opts[:'new_password_confirm'] if opts[:'new_password_confirm']\n form_params[\"country\"] = opts[:'country'] if opts[:'country']\n form_params[\"pgpPubKey\"] = opts[:'pgp_pub_key'] if opts[:'pgp_pub_key']\n\n # http body (model)\n post_body = nil\n\n\n auth_names = []\n result = @api_client.call_api(:PUT, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'User')\n if Configuration.debugging\n Configuration.logger.debug \"API called: UserApi#user_update_me. Result: #{result.inspect}\"\n end\n return result\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update\n authorize @account, :edit?\n respond_to do |format|\n if @account.update_aliases(@aliases) &&\n @account.update(account_params_with_author)\n # keep @account.save at the end of the condition bellow to ensure the right object is returned during rendering\n\n format.html do\n render :show, notice: \"Account was successfully updated.\"\n end\n format.json do\n render json: @account, status: :ok, location: :api_v2_account\n end\n else\n format.html { render :edit }\n format.json do\n render json: @account.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update!(**args)\n @account = args[:account] if args.key?(:account)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @profile = args[:profile] if args.key?(:profile)\n @redirect_uri = args[:redirect_uri] if args.key?(:redirect_uri)\n @webproperty = args[:webproperty] if args.key?(:webproperty)\n end", "def update\n email = AuthenticationHelper::Auth.instance.getEmailFromJWT( request )\n if ( email == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n user = User.find_by(email: email)\n if ( user )\n account = Account.find_by(user_id: user[\"id\"], id: params[:id])\n \n if ( account == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n if account.update(account_params)\n render json: account, status: :ok\n else\n render json: account.errors, status: :unprocessable_entity\n end\n else\n render json: :nothing, status: :unprocessable_entity\n end\n end", "def update\n @fridge = Fridge.find(params[:id])\n\n respond_to do |format|\n if @fridge.update_attributes(params[:fridge])\n format.html { redirect_to @fridge, notice: 'Fridge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fridge.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n recipe = Recipe.find(params[:id])\n\n if recipe.user == current_user\n recipe.update(recipe_params)\n render json: { recipe: params[:id], deleted: true }\n else\n render json: { recipe: params[:id], deleted: false }\n end\n end", "def update\n respond_to do |format|\n if @admin_company_profile.update(admin_company_profile_params)\n unless params[:admin_company_profile][:photo].blank?\n loaded = Cloudinary::Uploader.destroy(\"company/#{@admin_company_profile.id}\", :public_id => \"company/#{@admin_company_profile.id}\", :invalidate => true)\n preloaded = Cloudinary::Uploader.upload(params[:admin_company_profile][:photo], :use_filename => true, :public_id => \"company/#{@admin_company_profile.id}\")\n rand = RandCloud.generated_rand(\"company\",@admin_company_profile.id,\"/v2#{Random.rand(11)}\")\n end\n format.html { redirect_to admin_root_url, notice: 'Company profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_company_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @account = current_user.person.iphone_accounts.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:iphone_account])\n format.html { redirect_to( accounts_path, :notice => 'Account was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @account.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_account(client, options)\n accounts = get_accounts(client, options)\n if accounts.nil?\n return\n end\n\n account = find_account(accounts, options[:email])\n if !account.nil?\n if !options[:firstname].nil?\n account.given_name = options[:firstname]\n end\n if !options[:surname].nil?\n account.surname = options[:surname]\n end\n if !options[:username].nil?\n account.username = options[:username]\n end \n if !options[:password].nil?\n account.password = options[:password]\n end\n if !options[:status].nil?\n account.status = (options[:status] == \"disabled\" ? Stormpath::Resource::Status::DISABLED : Stormpath::Resource::Status::ENABLED)\n end\n\n begin\n account.save\n puts \"Account updated.\"\n rescue Stormpath::Error => e\n print_error(e)\n end\n else\n puts \"Account not found\"\n return\n end\nend", "def update\n @personal_account = PersonalAccount.find(params[:id])\n\n respond_to do |format|\n if @personal_account.update_attributes(params[:personal_account])\n format.html { redirect_to @personal_account, :notice => 'Personal account was successfully updated.' }\n # format.json { head :ok }\n format.json {render :json => {:data => @personal_account , :success => true } }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @personal_account.errors, :status => :unprocessable_entity }\n end\n end\n end", "def mf_api_user_update_tags\n\n # Get User From DB with client_id\n user = User.where(clientid: params[:client_id]).first\n\n # If user not found, return error response\n if user.empty?\n response = {\n success: false,\n message: 'User with ClientID not found'\n }\n\n render json: response\n end\n\n # Get the Infusionsoft contact info\n contact = Infusionsoft.data_load('Contact', user.clientid, [:Groups])\n\n # Update User Tags\n user.put('', {\n :client_tags => contact['Groups']\n })\n\n\n response = {\n success: true,\n message: 'User Tags Updated'\n }\n\n render json: response\n\n end", "def update\n respond_to do |format|\n if @rest_api.update(rest_api_params)\n format.html { redirect_to @rest_api, notice: 'Rest api was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rest_api.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update\n @account = Account.find(params[:id])\n authorize! :update, @account\n respond_to do |format|\n if @account.update_attributes(params[:account])\n format.html { redirect_to @account, notice: 'Account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_photos\n @client.get_photos(flickr_photoset_id) do |p|\n photo = Photo.find_or_create_by_flickr_photo_id(p[:id])\n photo.update_attributes(:farm => p[:farm], :server => p[:server], :secret => p[:secret])\n photo.save\n set_photo = photoset_photos.find_or_initialize_by_photo_id(photo.id)\n set_photo.update_attributes(:primary => p[:primary])\n end\n end", "def update\n #@service is already loaded and authorized\n\n respond_to do |format|\n @service.user_id = current_user.account_id\n if @service.update_attributes(params[:service])\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_photos\n # set the particulars\n flickr_url = 'http://api.flickr.com/services/rest/'\n flickr_method = 'flickr.groups.pools.getPhotos'\n secret = 'xxxxx' # :NOTE: replace with your API secret\n api_key = 'xxxxx' # :NOTE: replace with your API key\n auth_token = 'xxxxx' # :NOTE: replace with your auth token\n gwsf_id = '32053327@N00'\n extras = 'geo,last_update'\n per_page = 500\n get_page = 1\n photo_count = 0\n user_count = 0 \n # booleans\n reached_end = false\n found_existing = false\n \n # record the time of this update\n this_update = FlickrUpdate.new\n this_update.updated_at = Time.now\n this_update.save\n \n while !reached_end && !found_existing\n # generate the api signature\n sig_raw = secret + 'api_key' + api_key + 'auth_token' + auth_token +\n 'extras' + extras + 'group_id' + gwsf_id + 'method' +\n flickr_method + 'page' + get_page.to_s + 'per_page' + per_page.to_s\n api_sig = MD5.hexdigest(sig_raw)\n # grab the next page of photos in the pool\n #page_url = 'http://localhost:3001/flickr_groups_pools_getPhotos.xml'\n page_url = flickr_url + '?method=' + flickr_method +\n '&api_key=' + api_key + '&auth_token=' + auth_token +\n '&api_sig=' + api_sig + '&group_id=' + gwsf_id +\n '&per_page=' + per_page.to_s + '&page=' + get_page.to_s +\n '&extras=' + extras\n page_xml = Net::HTTP.get_response(URI.parse(page_url)).body\n flickr_page = XmlSimple.xml_in(page_xml)['photos'][0]\n\n # step through the returned photos\n flickr_page['photo'].each do |new_photo|\n # try to get a record for this photo\n photo = Photo.find_by_flickrid(new_photo['id'])\n # if it doesn't exist, create it\n if !photo\n photo_count = photo_count + 1\n photo = Photo.new\n photo.game_status = \"unfound\"\n else\n # check for a guess on this photo\n guess = Guess.find_by_photo_id(photo[:id])\n if guess then photo.game_status = \"found\" end\n end\n photo.flickrid = new_photo['id']\n photo.secret = new_photo['secret']\n photo.server = new_photo['server']\n photo.farm = new_photo['farm']\n photo.dateadded = Time.at(new_photo['dateadded'].to_i)\n photo.lastupdate = Time.at(new_photo['lastupdate'].to_i)\n photo.seen_at = Time.now\n photo.flickr_status = \"in pool\"\n photo.mapped = (new_photo['latitude'] == '0') ? 'false' : 'true'\n\n # try and get a record for the owner of this photo\n person = Person.find_by_flickrid(new_photo['owner'])\n # if the person doesn't exist, create it\n if !person\n user_count = user_count + 1\n person = Person.new\n end\n person.flickrid = new_photo['owner']\n person.username = new_photo['ownername']\n person.flickr_status = \"active\"\n\n # save the person\n person.save\n # attach the person to the photo\n photo.person = person\n # save the photo\n photo.save\n end\n # check to see if we've reached the end\n if get_page >= flickr_page['pages'].to_i\n reached_end = :true\n end\n # up the page\n get_page = get_page + 1\n\n end\n # let them know we're done\n flash[:notice] = 'created ' + photo_count.to_s + ' new photos and ' +\n user_count.to_s + ' new users. Got ' + (get_page - 1).to_s +\n ' pages out of ' + flickr_page['pages'] + '.</br>'\n redirect_to :action => 'index'\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n puts y params['photo'].keys\n params['photo'].keys.each do |photo_id|\n photo = Photo.find(photo_id)\n photo.update_attributes(params['photo'][photo_id])\n end\n respond_to do |format|\n if true \n format.html { redirect_to photos_path, notice: 'Photos were successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"index\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @user_trick = UserTrick.find(params[:id])\n @user_trick.update(user_trick_params)\n render json: UserTrickSerializer.new(@user_trick).serialized_json\n end", "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'FOAF was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n populate_attributes(@person, params[:person])\n respond_to do |format|\n \n if @person.save && @person.identifiable_entries.each(&:save!)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end", "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @star_fact = Star::Fact.find(params[:id])\n\n respond_to do |format|\n if @star_fact.update_attributes(params[:star_fact])\n format.html { redirect_to @star_fact, notice: 'Fact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @star_fact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n\n @client.redirect_urls << client_params[:add_redirect_url] if client_params[:add_redirect_url]\n \n @client.app_ids << BSON::ObjectId.new.to_s if client_params[:add_app_id]\n \n \n @client.versioned_update({\"redirect_urls\" => 1, \"app_ids\" => 1})\n\n if @client.op_success?\n render \"show\"\n else\n render \"edit\"\n end\n \n end", "def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end" ]
[ "0.6163037", "0.6163037", "0.6143675", "0.6103595", "0.6045521", "0.6026423", "0.6009034", "0.59985757", "0.59904814", "0.59378904", "0.59052396", "0.59001744", "0.58787555", "0.58690876", "0.58534294", "0.58274466", "0.57986957", "0.5784053", "0.5784053", "0.5772434", "0.5732158", "0.57227725", "0.571325", "0.5712868", "0.5697627", "0.5697444", "0.5692271", "0.56882083", "0.5672733", "0.56602883", "0.56589586", "0.56589586", "0.5655314", "0.5651191", "0.56294465", "0.5624413", "0.5621004", "0.5617557", "0.56102985", "0.56096524", "0.5601995", "0.56002575", "0.5599852", "0.5590541", "0.5585325", "0.5577654", "0.5577654", "0.5576366", "0.55740845", "0.55719656", "0.5563194", "0.55462897", "0.55419356", "0.5530541", "0.5530397", "0.5523948", "0.55147684", "0.55108863", "0.55102605", "0.55102605", "0.5508562", "0.5506903", "0.5505839", "0.5503426", "0.5500728", "0.54866177", "0.54827017", "0.54821634", "0.5481388", "0.5472763", "0.5469261", "0.5461484", "0.54531056", "0.5452284", "0.54469335", "0.5446224", "0.5442552", "0.5433408", "0.5431373", "0.54258126", "0.54253954", "0.542376", "0.54141355", "0.54140073", "0.54099435", "0.54055595", "0.5401448", "0.5401086", "0.54002297", "0.5398634", "0.53948265", "0.5390238", "0.53881204", "0.53848845", "0.53845286", "0.5377758", "0.5368286", "0.5368267", "0.53640276", "0.53629416" ]
0.7124585
0
DELETE /flickr_accounts/1 DELETE /flickr_accounts/1.json
def destroy # @flickr_account.destroy # respond_to do |format| # format.html { redirect_to flickr_accounts_url, notice: 'Flickr account was successfully destroyed.' } # format.json { head :no_content } # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete photo_id\n @flickr.photos.delete(photo_id: photo_id)\n end", "def delete_account\n @user = current_user\n if @user.flickr_account.destroy\n flash[:notice] = 'You are not connected to flickr anymore $green'\n else \n flash[:notice] = 'Something went wrong. Please try again $red'\n end \n redirect_to controller: 'users', action: 'connect_social_accounts'\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end", "def delete\n api_client.delete(url)\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @oauth_account.destroy\n respond_to do |format|\n format.html { redirect_to oauth_accounts_url, notice: 'Oauth account was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(photo)\n photo = photo.id if photo.class == Flickr::Photo\n res = @flickr.call_method('flickr.photos.delete',\n 'photo_id'=>photo)\n end", "def destroy\n @account = current_user.person.gmail_accounts.find(params[:id])\n @account.destroy\n\n respond_to do |format|\n format.html { redirect_to accounts_path }\n format.json { head :ok }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @api_v1_account.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_accounts_url, notice: 'Account was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @account = current_user.person.blackberry_accounts.find(params[:id])\n @account.destroy\n\n respond_to do |format|\n format.html { redirect_to accounts_path }\n format.json { head :ok }\n end\n end", "def destroy\n @account = Account.find(params[:id])\n @account.destroy\n\n respond_to do |format|\n format.html { redirect_to accounts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @account = Account.find(params[:id])\n @account.destroy\n\n respond_to do |format|\n format.html { redirect_to accounts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @avatar.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @social_account = SocialAccount.find(params[:id])\n @social_account.destroy\n\n respond_to do |format|\n format.html { redirect_to social_accounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @account = Account.find(params[:id])\n @account.destroy\n\n respond_to do |format|\n format.html { redirect_to accounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @account = Account.find(params[:id])\n @account.destroy\n\n respond_to do |format|\n format.html { redirect_to accounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @account = Account.find(params[:id])\n @account.destroy\n\n respond_to do |format|\n format.html { redirect_to accounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @account = Account.find(params[:id])\n @account.destroy\n\n respond_to do |format|\n format.html { redirect_to accounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @account = Account.find(params[:id])\n @account.destroy\n\n respond_to do |format|\n format.html { redirect_to accounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @account = Account.find(params[:id])\n @account.destroy\n\n respond_to do |format|\n format.html { redirect_to accounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @account.destroy\n respond_to do |format|\n format.html { redirect_to accounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @account.destroy\n respond_to do |format|\n format.html { redirect_to accounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @account.destroy\n respond_to do |format|\n format.html { redirect_to accounts_url }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n @photo_album = PhotoAlbum.find(params[:id])\n @photo_album.favorites.destroy_all\n del_post_wall(@photo_album)\n @photo_album.destroy\n\n respond_to do |format|\n format.html { redirect_to(photo_albums_url) }\n format.xml { head :ok }\n end\n end", "def delete_account\n @connection.request({\n :method => 'DELETE'\n }) \n end", "def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'+@color.id.to_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n img_del = AccountPhoto.where(\"account_id = ?\", @account.id)\n img_del.each do |d|\n d.destroy\n d.save\n end\n @account.destroy\n respond_to do |format|\n format.html { redirect_to [:admin, :accounts], notice: 'Account was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \t@album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :ok }\n end\n end", "def destroy\n @avatar.destroy\n respond_to do |format|\n format.html { redirect_to avatars_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @personal_account = PersonalAccount.find(params[:id])\n @personal_account.destroy\n\n respond_to do |format|\n format.html { redirect_to personal_accounts_url }\n format.json { head :ok }\n end\n end", "def destroy\r\n @account = Account.find(params[:id])\r\n @account.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to accounts_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\r\n @account = Account.find(params[:id])\r\n @account.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to accounts_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def delete(user)\n Rails.logger.debug \"Call to photo.delete\"\n if !self.file.blank?\n Util.delete_image(self.file) #Delete the image file from the image server\n end\n reqUrl = \"/api/photo/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password'])#Make the DELETE request to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n return true, rest_response #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n end", "def destroy\n @auth = Auth.find(params[:id])\n @auth.destroy\n\n respond_to do |format|\n format.html { redirect_to auths_url }\n format.json { head :no_content }\n end\n end", "def delete(photo_id)\r\n Net::Flickr.instance().request('flickr.photos.delete',\r\n 'photo_id' => photo_id)\r\n true\r\n end", "def destroy\n @photo = @allbum.photos.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to allbum_photos_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @foto = Foto.find(params[:id])\n @foto.destroy\n\n respond_to do |format|\n format.html { redirect_to fotos_url }\n format.json { head :ok }\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def delete_accounts\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def destroy\n logout\n render json: {:ok => true}\n end", "def destroy\n @fridge = Fridge.find(params[:id])\n @fridge.destroy\n\n respond_to do |format|\n format.html { redirect_to fridges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @credential.destroy\n # respond_to do |format|\n # format.html { redirect_to credentials_url, notice: 'Credential was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\r\n @social_account.destroy\r\n respond_to do |format|\r\n format.html { redirect_to root_url, notice: 'Social account was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @api_user.destroy\n\n head :no_content\n end", "def destroy\n @account = current_user.person.iphone_accounts.find(params[:id])\n @account.destroy\n\n respond_to do |format|\n format.html { redirect_to accounts_path }\n format.json { head :ok }\n end\n end", "def destroy\n @fabric = Fabric.find(params[:id])\n @fabric.destroy\n\n respond_to do |format|\n format.html { redirect_to fabrics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :manage_account, current_account\n @food = current_account.foods.find(params[:id])\n @food.destroy\n respond_with @food, :location => foods_url\n end", "def destroy\n @rest_api.destroy\n respond_to do |format|\n format.html { redirect_to rest_apis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = current_account.albums.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n Feed.find(params[:id]).destroy\n render :json => {:ok => true}, :head => :no_content\n end", "def destroy\n @photoalbum = Photoalbum.find(params[:id])\n @photoalbum.destroy\n\n respond_to do |format|\n format.html { redirect_to photoalbums_url }\n format.json { head :ok }\n end\n end", "def destroy\n @oauth_client = OauthClient.find(params[:id])\n @oauth_client.destroy\n\n respond_to do |format|\n format.html { redirect_to oauth_clients_url }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end", "def destroy\n @heroku_account.destroy\n respond_to do |format|\n format.html { redirect_to heroku_accounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end", "def destroy\n @picture = Picture.find(params[:id])\n @picture.destroy\n render :json => true\n end", "def delete\n delete_from_server single_url\n end", "def destroy\n @account = Account.find(params[:id])\n @account.destroy\n\n respond_to do |format|\n format.html { redirect_to accounts_url }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def delete\n request('delete').auth_required!\n end", "def destroy\n @photo1 = Photo1.find(params[:id])\n @photo1.destroy\n\n respond_to do |format|\n format.html { redirect_to photo1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @foto.destroy\n respond_to do |format|\n format.html { redirect_to fotos_url }\n format.json { head :no_content }\n end\n end", "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def destroy\n @insta_account.destroy\n respond_to do |format|\n format.html { redirect_to insta_accounts_url, notice: 'Insta account was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def delete\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n @person.destroy\n @application_session.destroy\n session[:cos_session_id] = nil\n render_json :status => :ok\n end", "def destroy\n id = @photos.id\n if !@photos.nil? && @photos.destroy\n result = { message: 'Deleted successfully', status: true, id: id }\n else\n result = { message: 'Please try again later', status: false }\n end\n render json: result\n end", "def destroy\n\n @album = @user.albums.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resto.destroy\n respond_to do |format|\n format.html { redirect_to restos_url, notice: 'Entry was deleted.' }\n format.json { head :no_content }\n end\n end", "def delete\n api(\"Delete\")\n end", "def destroy\n @gallery.pics.each do |pic|\n Cloudinary::Uploader.destroy(pic.public_id.split(\"/\").last.split(\".\")[0] ,@auth) if pic.public_id.present?\n pic.delete\n end\n @gallery.delete\n respond_to do |format|\n format.html { redirect_to galleries_url, notice: 'Gallery was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :manage, @flock\n\n @flock.destroy\n respond_to do |format|\n format.html { redirect_to flocks_url, notice: \"Flock was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def http_delete(opts={})\n ret=http_delete_low(opts)\n if ret.is_a?(Hash) and ret.has_key?('error') and ret['error']=='Invalid Credentials' then\n\tauthdefault\n\tret=http_delete_low(opts)\n\treturn ret\n else\n\treturn ret\n end\n end", "def destroy\n @picture = @album.pictures.find(params[:id]) #JRD111115\n @picture.destroy\n respond_to do |format|\n format.html { redirect_to album_pictures_url(@album), notice: 'Picture was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\n end", "def destroy\n @social_account.destroy\n respond_to do |format|\n format.html { redirect_to social_accounts_url, notice: 'Social account was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @curso.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @credito = Credito.find(params[:id])\n @credito.destroy\n\n respond_to do |format|\n format.html { redirect_to creditos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @social = Social.find(params[:id])\n @social.destroy\n\n respond_to do |format|\n format.html { redirect_to '/' }\n format.json { head :no_content }\n end\n end", "def delete_account\n @connection.request({\n :method => 'DELETE'\n })\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n @gist.destroy\n respond_to do |format|\n format.html { redirect_to gists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end", "def destroy\n @grant = Grant.find(params[:id])\n @grant.destroy\n\n respond_to do |format|\n format.html { redirect_to grants_url }\n format.json { head :ok }\n end\n end" ]
[ "0.67956614", "0.6630035", "0.66133296", "0.6531147", "0.6523471", "0.6443541", "0.6432054", "0.6431538", "0.6367408", "0.6355235", "0.6355235", "0.6355235", "0.6355235", "0.6354484", "0.63486004", "0.63327396", "0.63327396", "0.6329291", "0.63243115", "0.6323775", "0.6323775", "0.6323775", "0.6323775", "0.6323775", "0.6323775", "0.63222307", "0.63222307", "0.63222307", "0.6318347", "0.6318347", "0.6315338", "0.63068336", "0.63058853", "0.6304526", "0.63024306", "0.6301762", "0.6301309", "0.6292867", "0.6292867", "0.6290413", "0.62831086", "0.627987", "0.62758434", "0.6269569", "0.62659967", "0.62589306", "0.62570524", "0.62467015", "0.6245569", "0.6240969", "0.62360054", "0.6234524", "0.6233573", "0.6233438", "0.6232013", "0.6229344", "0.62233794", "0.6223349", "0.6218709", "0.6218339", "0.6213063", "0.6212513", "0.6212232", "0.62104", "0.620623", "0.6205684", "0.6199428", "0.619419", "0.6182411", "0.61813974", "0.6179547", "0.617812", "0.61778784", "0.6175969", "0.61620486", "0.61620486", "0.61620486", "0.61620486", "0.61620486", "0.61620486", "0.61610353", "0.6160302", "0.6156221", "0.61539185", "0.6151879", "0.615137", "0.61497235", "0.6144982", "0.6144848", "0.61447656", "0.6143804", "0.6139015", "0.61376846", "0.61353415", "0.61340386", "0.6124944", "0.6124944", "0.61241513", "0.6120764", "0.6118985" ]
0.77141327
0
Use callbacks to share common setup or constraints between actions.
def set_flickr_account @flickr_account = FlickrAccount.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def flickr_account_params params.require(:flickr_account).permit(:username) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
Writes a lot of crap to stdout and stderr
def start(boxname="mmsbox", method="simple_fork") raise "Box with #{boxname} is already running" unless @proc[boxname].nil? if method == "simple_fork" @proc[boxname] = MbuniProc.new(nil,nil,nil, fork { exec "#{@path}/bin/#{boxname} #{@config}" } ) elsif method == "custom_popen" @proc[boxname] = MbuniProc.new(*custom_popen("#{@path}/bin/#{boxname} #{@config}")) end puts "Started #{boxname} with pid=#{@proc[boxname].pid} using method #{method}" @proc[boxname].pid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def without_stderr; end", "def stdouts; end", "def stderr(command, data)\n # called when the process writes to STDERR\n end", "def stderr; end", "def stderr; end", "def stderr; end", "def stderr; end", "def streams_after(out_,err_)\n $stdout = out_\n $stderr = err_\nend", "def all_output\n all_stdout << all_stderr\n end", "def report_error(error, out: $output)\n out.puts\n out.puts \"Error: #{error}.\"\nend", "def report_error(error, out: $output)\n out.puts\n out.puts \"Error: #{error}.\"\nend", "def report_error(error, out: $output)\n out.puts\n out.puts \"Error: #{error}.\"\nend", "def err(message)\n stderr.puts message\n end", "def write_error(message)\n STDERR.puts(message)\n end", "def capture_error_output\n puts \"Capturing error output...\"\n\n @stderr.flush\n error_catching_thread = Thread.new {\n @out = \"\"\n thread = Thread.start do\n @stderr.each_line do |line|\n @out << line\n end\n end\n }\n @stderr.sync = false\n\n line = \"\"\n while c = @stdout.read(1)\n line += c\n if line =~ /\\(fcsh\\)/\n puts \"Done....\"\n return @out\n end\n next if c != \"/n\"\n\n puts \"(out) \" + line.inspect if $DEBUG\n if line =~ /Nothing has changed/\n puts \"Nothing has changed\" if $DEBUG\n return @out\n end\n\n if line =~ /Files changed:/\n puts \"Filed changed:\" if $DEBUG\n return @out\n end\n\n if line =~ /Error: (.*)/\n raise CompileError.new(line)\n end\n\n if line =~ /.+\\.swf/\n puts \"\" if $DEBUG\n return @out\n end\n\n line = \"\"\n end\n end", "def dump_failures(*args)\n lock_output do\n super\n end\n @output.flush\n end", "def stdout; end", "def stdout; end", "def stdout; end", "def stdout; end", "def stdout; end", "def stdout; end", "def output\n @stdout + \"\\n\" + @stderr\n end", "def error(message)\n STDERR.puts message\nend", "def capture_stderr\n previous_stdout, $stdout = $stdout, StringIO.new\n yield\n $stdout.string\nensure\n $stdout = previous_stdout\nend", "def process_unknown_output(line)\n @@log.warn {\"Unexpected output line on stdout: '#{line}'. Verify that the scripts are not broken.\"}\n end", "def stderr\n run unless ran?\n\n @stderr\n end", "def oops str\n STDERR.puts str\n exit\nend", "def error_io\n exit_code == -1 ? $stderr : $stdout\n end", "def error(msg) $stderr.puts(\"Error: #{msg}\") end", "def log_standard_outputs\n [STDOUT, STDERR].each do |output|\n (class << output; self; end).class_eval do\n alias __write__ write\n\n def write string\n Wmiirc::LOG << string\n __write__ string\n end\n\n alias << write\n end\n end\n end", "def map_error_output(filename)\r\n\tDir.mkdir(\"#{settings.root}/tmp\") unless File.exists?(\"#{settings.root}/tmp\")\r\n\tfile = File.new(\"#{settings.root}/tmp/#{filename}\", 'a+')\r\n\tfile.sync = true\r\n\t$stderr.reopen file\r\nend", "def puts(*strs); $stdout.puts(*strs) if ENV['DEBUG'] end", "def redirect_io\n stdout = config.options[:redirect_stdout]\n stderr = config.options[:redirect_stderr] || stdout\n append = config.options[:redirect_append]\n\n if stdout\n STDOUT.reopen stdout, (append ? \"a\" : \"w\")\n STDOUT.sync = true\n STDOUT.puts \"=== puma startup: #{Time.now} ===\"\n end\n\n if stderr\n STDERR.reopen stderr, (append ? \"a\" : \"w\")\n STDERR.sync = true\n if stdout != stderr then\n # no need to dupe\n STDERR.puts \"=== puma startup: #{Time.now} ===\"\n end\n end\n end", "def consume_stderr(text)\n @@log.warn {\"Unexpected line on stderr: '#{text}'. Verify that scripts are not broken.\"}\n end", "def safe_each\n [$stderr, $stdout].each { |io| safely { yield io } }\n end", "def msg(message)\n stdout.puts message\n rescue Errno::EPIPE => e\n raise e if @config[:verbosity] >= 2\n\n exit 0\n end", "def stdout_redirect(stdout = T.unsafe(nil), stderr = T.unsafe(nil), append = T.unsafe(nil)); end", "def stderr(*msgs)\n STDERR.puts(*msgs)\n end", "def all_stderr\n registered_commands.each(&:stop)\n\n registered_commands.each_with_object(\"\") { |e, a| a << e.stderr }\n end", "def puts (msg)\n $stderr.puts msg\n end", "def fatal!(message)\n # Not using safe_each in case that caused an error.\n safely { $stdout.reopen(@stdout, 'a+'); $stdout.puts message }\n safely { $stderr.reopen(@stderr, 'a+'); $stderr.puts message }\n exit 1\n end", "def enable_output\n $stderr = @original_stderr\n $stdout = @original_stdout\n @original_stderr = nil\n @original_stdout = nil\n `rm #{log_file} && touch #{log_file}`\nend", "def handle_error(cmd, stderr)\n summary = \"\\rError running \\`#{cmd}\\`\"\n details = readable_curr_time << \"\\n\\n\"\n details << \"**************************************************************\\n\"\n details << \"#{summary}\\n\"\n details << \"**************************************************************\\n\"\n details << stderr << \"\\n\\n\"\n File.open(@err_path, 'a') { |file| file.write(details) }\n summary\nend", "def redirect_java_err\n err = Java.java.io.ByteArrayOutputStream.new\n original_err = Java.java.lang.System.err\n begin\n printStream = Java.java.io.PrintStream\n print = printStream.new(err)\n Java.java.lang.System.setErr(print)\n yield\n ensure\n Java.java.lang.System.setErr(original_err)\n end\n err.toString\n end", "def silence_output\n @orig_stderr = $stderr\n @orig_stdout = $stdout\n \n # redirect stderr and stdout to /dev/null\n $stderr = File.new('/dev/null', 'w')\n $stdout = File.new('/dev/null', 'w')\nend", "def silence_output\n # Store the original stderr and stdout in order to restore them later\n @original_stderr = $stderr\n @original_stdout = $stdout\n\n # Redirect stderr and stdout\n $stderr = File.new('/dev/null', 'w')\n $stdout = File.new('/dev/null', 'w')\nend", "def silence_output\n @orig_stderr = $stderr\n @orig_stdout = $stdout\n $stderr = File.new('/dev/null', 'w')\n $stdout = File.new('/dev/null', 'w')\nend", "def enable_output\n $stderr = @orig_stderr\n $stdout = @orig_stdout\n @orig_stderr = nil\n @orig_stdout = nil\nend", "def enable_output\n $stderr = @orig_stderr\n $stdout = @orig_stdout\n @orig_stderr = nil\n @orig_stdout = nil\nend", "def silence_output\n # Store the original stderr and stdout in order to restore them later\n @original_stderr = $stderr\n @original_stdout = $stdout\n\n # Redirect stderr and stdout\n $stderr = File.new(log_file, 'w')\n $stdout = File.new(log_file, 'w')\nend", "def printerr *s\n s.each do |_|\n Lib.g_application_command_line_printerr self.ffi_pointer, _.to_s+\"\\n\"\n end\n end", "def test_verbose_mode_server_prints_received_contents_to_stdout\n skip(msg='Do not know how to capture STDOUT without implementing custom output stream variable')\n end", "def error(message) puts(message) || exit end", "def error(delayed_job, exception)\n STDERR.putc 'E'\n STDERR.flush\n end", "def clear_stderr\n $stderr.string = '' if $stderr.is_a?(StringIO)\n end", "def re_stderr\n @logdev.re_stderr\n self\n end", "def enable_output\n $stderr = @original_stderr\n $stdout = @original_stdout\n @original_stderr = nil\n @original_stdout = nil\nend", "def err(message = '')\n @out_sections = [] unless defined?(@out_sections)\n message = \"#{' ' * @out_sections.size}#{message}\"\n # log_debug \"<Output> - #{message}\"\n message = \"#{message}\\n\" unless message.end_with?(\"\\n\")\n @logger_stderr << message\n end", "def fake_stderr\n original_stderr = $stderr\n $stderr = StringIO.new\n yield\n $stderr.string\n ensure\n $stderr = original_stderr\n end", "def out\n # {{{\n @output_allowed = true\n @buffer = []; # We use an array as buffer, because it's more performant :)\n\n begin\n yield\n rescue Exception => exception\n $stderr.puts \"Ruby exception rescued (#{exception.class}): #{exception.message}\"\n $stderr.puts exception.backtrace.join(\"\\n\")\n\n unless @output_started\n self.setstatus(500)\n @header = {}\n end\n\n unless (@settings.has_key?(\"hide errors\") and @settings[\"hide errors\"] == true)\n unless @output_started\n self.header(\"Content-Type: text/html\")\n self.puts \"<!DOCTYPE HTML PUBLIC \\\"-//W3C//DTD HTML 4.01 Strict//EN\\\" \\\"http://www.w3.org/TR/html4/strict.dtd\\\">\"\n self.puts \"<html>\"\n self.puts \"<head>\"\n self.puts \"<title>500 Internal Server Error</title>\"\n self.puts \"</head>\"\n self.puts \"<body>\"\n end\n if @header.has_key?(\"content-type\") and (@header[\"content-type\"] =~ /^text\\/html/i) == 0\n self.puts \"<h1>Internal Server Error</h1>\"\n self.puts \"<p>The server encountered an exception and was unable to complete your request.</p>\"\n self.puts \"<p>The exception has provided the following information:</p>\"\n self.puts \"<pre style=\\\"background: #FFCCCC; border: black solid 2px; margin-left: 2cm; margin-right: 2cm; padding: 2mm;\\\"><b>#{exception.class}</b>: #{exception.message} <b>on</b>\"\n self.puts\n self.puts \"#{exception.backtrace.join(\"\\n\")}</pre>\"\n self.puts \"</body>\"\n self.puts \"</html>\"\n else\n self.puts \"The server encountered an exception and was unable to complete your request\"\n self.puts \"The exception has provided the following information:\"\n self.puts \"#{exception.class}: #{exception.message}\"\n self.puts\n self.puts exception.backtrace.join(\"\\n\")\n end\n end\n end\n\n if @settings[\"cache\"]\n buffer = @buffer.join\n\n unless @output_started\n unless @header.has_key?(\"content-length\")\n self.header(\"content-length: #{buffer.length}\")\n end\n\n sendHeaders\n end\n $stdout.print(buffer)\n elsif !@output_started\n sendHeaders\n end\n @output_allowed = false;\n # }}}\n end", "def handle_errors(output)\n if $? != 0\n puts output\n puts \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n puts \"~ FATAL: Command failed with status #{$?}\"\n exit 1\n end\nend", "def silence_output\n # @orig_stderr = $stderr\n @orig_stdout = $stdout\n \n # redirect stderr and stdout to /dev/null\n # $stderr = File.new('/dev/null', 'w')\n $stdout = File.new('/dev/null', 'w')\nend", "def log(msg)\r\n STDERR.puts msg\r\n end", "def output_terminal_errors\n errors.each { |error| plain_output(error.to_s, 'red') }\n plain_output(\"\\nPlease go to https://rails-bestpractices.com to see more useful Rails Best Practices.\", 'green')\n if errors.empty?\n plain_output(\"\\nNo warning found. Cool!\", 'green')\n else\n plain_output(\"\\nFound #{errors.size} warnings.\", 'red')\n end\n end", "def write_fatal_error message\n puts \"Error: #{message}. See spritemaster -h for usage\"\n exit\n end", "def enable_output\n # $stderr = @orig_stderr\n $stdout = @orig_stdout\n # @orig_stderr = nil\n @orig_stdout = nil\nend", "def to_console(lines, stderr = false)\n return if quiet\n lines.each {|line| stderr ? Kernel.warn(line) : puts(line) }\n end", "def silence\n old_o, old_e = $stdout, $stderr\n $stdout = StringIO.new\n $stderr = StringIO.new\n\n yield\nensure\n $stdout = old_o if old_o\n $stderr = old_e if old_e\nend", "def stream_out(msg)\n if ($gTest_params[\"verbosity\"] != \"quiet\")\n print msg\n end\n if ($gTest_params[\"logfile\"])\n $fLOG.write(msg)\n end\nend", "def stream_out(msg)\n if ($gTest_params[\"verbosity\"] != \"quiet\")\n print msg\n end\n if ($gTest_params[\"logfile\"])\n $fLOG.write(msg)\n end\nend", "def recoverable_error e, msg = \"Error\", bt = []\n puts \"#{msg} at time #{clock}\"\n puts \"From \" + bt[0..2].join(\"\\n \") unless bt.empty\n puts \" ...\" if bt.length > 3\n shell.run\n end", "def suppress_output\n original_stdout, original_stderr = $stdout.clone, $stderr.clone\n $stderr.reopen File.new('/dev/null', 'w')\n $stdout.reopen File.new('/dev/null', 'w')\n yield\nensure\n $stdout.reopen original_stdout\n $stderr.reopen original_stderr\nend", "def redirect_stdout\n if Capybara::Chromefoil.mri?\n yield\n else\n begin\n prev = STDOUT.dup\n $stdout = @write_io\n STDOUT.reopen(@write_io)\n yield\n ensure\n STDOUT.reopen(prev)\n $stdout = STDOUT\n prev.close\n end\n end\n end", "def puts(msg)\n @out.puts msg unless @silent\n end", "def err(message)\n STDERR.puts(message)\n exit 1\n end", "def stupid_program\n puts \"HI I AM A STUPID PROGRAM BECAUSE I WRITE TO STDOUT LOL\" # always writes to $stdout\nend", "def silent_out\n stdout = $stdout\n $stdout = StringIO.new\n begin\n yield if block_given?\n ensure\n $stdout = stdout\n end\nend", "def suppress_output\n $stderr.reopen(\"/dev/null\", \"a\")\n $stdout.reopen($stderr)\n end", "def warning(msg) $stderr.puts(\"Warning: #{msg}\") end", "def warning(msg) $stderr.puts(\"Warning: #{msg}\") end", "def warning(msg) $stderr.puts(\"Warning: #{msg}\") end", "def handle_error(stdout)\n while (line = stdout.gets)\n puts line\n end\n end", "def redirect_stdio!\n inn, out, err = open(@stdin), open(@stdout, 'a+'), open(@stderr, 'a+')\n no_warn do\n $stdin = Object.const_set(:STDIN, inn)\n $stdout = Object.const_set(:STDOUT, out)\n $stderr = Object.const_set(:STDERR, err)\n end\n end", "def stderr_received(data); end", "def capture_stds(&block)\n real_stderr, $stderr = $stderr, StringIO.new\n real_stdout, $stdout = $stdout, StringIO.new\n yield\n [ $stderr.string, $stdout.string ]\n ensure\n $stdout, $stderr = real_stdout, real_stderr\n end", "def print_output(up_result)\n puts \"################# STDOUT #####################\"\n puts up_result.stdout\n puts \"################# STDERR #####################\"\n puts up_result.stderr\n puts \"################# END #####################\"\n end", "def all_stderr\n aruba.command_monitor.all_stderr\n end", "def streams_before\n out_ = $stdout\n err_ = $stderr\n $stdout = StringIO.new\n $stderr = StringIO.new\n return out_,err_\nend", "def stderr_log(lines)\n Array(lines).each do |line|\n $stderr.puts(Core::Color.colorize(\">>>>>> #{line}\", :red))\n end\n end", "def capture_error\n begin\n yield\n @error = all_output unless last_exit_status == 0\n rescue => @error\n end\n end", "def puts_err(msg)\n STDERR.puts(msg.to_s.red)\n end", "def print_stderr(msg)\n puts \" #{color(msg, 31)}\"\n end", "def _err_text(ary)\n ary[0] = __make_head + ary[0] unless $stderr.tty?\n ary.join(\"\\n \")\n end", "def error_message(msg)\n STDERR.puts msg\n end", "def suppress_output\n original_stdout = $stdout.clone\n original_stderr = $stderr.clone\n $stderr.reopen File.new('/dev/null', 'w')\n $stdout.reopen File.new('/dev/null', 'w')\n yield\nensure\n $stdout.reopen original_stdout\n $stderr.reopen original_stderr\nend", "def format_redirect_stderr(cmd, target = NULL_OUTPUT_NAME)\n return cmd + \" 2>#{target}\"\n end", "def reroute_stdio\n $stdout = log.file\n $stderr = log.file\n end", "def setup_fail(message)\n puts '-'*50\n message.each { |line| puts line }\n puts '-'*50\n exit\n end", "def start_listen_errors\n return nil unless @io_err\n\n @thr_err = Thread.new do\n begin\n @io_err.each_line do |str|\n $stderr.print str if @debug\n end\n rescue => e\n @listen_err_err = e\n end\n end\n end", "def redirect\n $stdin.reopen '/dev/null'\n $stdout.reopen File.new(out, \"a\")\n $stderr.reopen File.new(err, \"a\")\n $stdout.sync = $stderr.sync = true\n end" ]
[ "0.6732157", "0.67065907", "0.66776115", "0.65869904", "0.65869904", "0.65869904", "0.65869904", "0.6583778", "0.64355755", "0.639698", "0.639698", "0.639698", "0.62969524", "0.6253272", "0.62522674", "0.62485886", "0.6241416", "0.6241416", "0.6241416", "0.6241416", "0.6241416", "0.6241416", "0.6237476", "0.6219981", "0.62146354", "0.62126666", "0.6192816", "0.6183623", "0.61588466", "0.61465627", "0.61434865", "0.6142613", "0.61376977", "0.6096725", "0.608879", "0.6086864", "0.60771006", "0.6041807", "0.60397685", "0.60336506", "0.60302126", "0.60282016", "0.6017489", "0.60006523", "0.5993792", "0.5992391", "0.5970221", "0.5953797", "0.5919172", "0.5919172", "0.58975494", "0.5893008", "0.58827776", "0.58773184", "0.58749175", "0.5866183", "0.58535814", "0.58498746", "0.58454186", "0.58442515", "0.58420044", "0.58389235", "0.5836526", "0.58315873", "0.58226615", "0.58195525", "0.58148575", "0.5800881", "0.579167", "0.5790216", "0.5790087", "0.5780933", "0.57796156", "0.57742184", "0.576453", "0.5761107", "0.57525414", "0.5751968", "0.5750514", "0.575051", "0.575051", "0.575051", "0.57409143", "0.5740236", "0.5735654", "0.57299805", "0.572909", "0.5718729", "0.5708632", "0.5700202", "0.56904066", "0.5690361", "0.5686644", "0.5680152", "0.56786954", "0.567864", "0.566624", "0.56611234", "0.5661077", "0.56603855", "0.5660076" ]
0.0
-1
This is a special version of popen which captures stdout, stdin and stdout and the PID of the executing process
def custom_popen(*cmd) pw = IO::pipe # pipe[0] for read, pipe[1] for write pr = IO::pipe pe = IO::pipe pid_pipe = IO::pipe # pipe for communicating the process id of the started process executing_proc_pid = nil pid = fork{ # child executing_proc_pid = fork{ # grandchild pw[1].close STDIN.reopen(pw[0]) pw[0].close pr[0].close STDOUT.reopen(pr[1]) pr[1].close pe[0].close STDERR.reopen(pe[1]) pe[1].close exec(*cmd) } pid_pipe[1].write(executing_proc_pid.to_s + "\n") pid_pipe[1].close exit!(0) } pw[0].close pr[1].close pe[1].close executing_proc_pid = pid_pipe[0].gets.to_i puts "from pipe: executing_proc_pid=#{executing_proc_pid}" pid_pipe[0].close Process.waitpid(pid) pi = [pw[1], pr[0], pe[0], executing_proc_pid] pw[1].sync = true if defined? yield begin return yield(*pi) ensure pi.each{|p| p.close unless p.closed?} end end pi end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_popen2(cmd)\n stdin_reader, stdin_writer = IO.pipe\n stdout_reader, stdout_writer = IO.pipe\n\n pid = fork {\n stdin_writer.close\n $stdin.reopen(stdin_reader)\n\n stdout_reader.close\n $stdout.reopen(stdout_writer)\n\n exec(cmd)\n }\n\n stdin_reader.close\n stdout_writer.close\n\n yield stdin_writer, stdout_reader\n\n Process.wait(pid)\nend", "def popen\n # You can't wait for the PID returned by JRuby's IO.popen4, so\n # this is necessary.\n cmd = @command_and_args.collect(&:to_s).to_java(:string)\n @process = Java::JavaLang::ProcessBuilder.new(\n cmd\n ).start\n\n [\n # java.util.Process flips the meanings of \"in\" and \"out\"\n # relative to popen3\n @process.output_stream.to_io,\n @process.input_stream.to_io,\n @process.error_stream.to_io\n ]\n end", "def popen4(cmd, args={}, &b)\n \n # Waitlast - this is magic. \n # \n # Do we wait for the child process to die before we yield\n # to the block, or after? That is the magic of waitlast.\n #\n # By default, we are waiting before we yield the block.\n args[:waitlast] ||= false\n \n args[:user] ||= nil\n unless args[:user].kind_of?(Integer)\n args[:user] = Etc.getpwnam(args[:user]).uid if args[:user]\n end\n args[:group] ||= nil\n unless args[:group].kind_of?(Integer)\n args[:group] = Etc.getgrnam(args[:group]).gid if args[:group]\n end\n args[:environment] ||= {}\n\n # Default on C locale so parsing commands output can be done\n # independently of the node's default locale.\n # \"LC_ALL\" could be set to nil, in which case we also must ignore it.\n unless args[:environment].has_key?(\"LC_ALL\")\n args[:environment][\"LC_ALL\"] = \"C\"\n end\n \n pw, pr, pe, ps = IO.pipe, IO.pipe, IO.pipe, IO.pipe\n\n verbose = $VERBOSE\n begin\n $VERBOSE = nil\n ps.last.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)\n\n cid = fork {\n pw.last.close\n STDIN.reopen pw.first\n pw.first.close\n\n pr.first.close\n STDOUT.reopen pr.last\n pr.last.close\n\n pe.first.close\n STDERR.reopen pe.last\n pe.last.close\n\n STDOUT.sync = STDERR.sync = true\n\n if args[:group]\n Process.egid = args[:group]\n Process.gid = args[:group]\n end\n\n if args[:user]\n Process.euid = args[:user]\n Process.uid = args[:user]\n end\n \n args[:environment].each do |key,value|\n ENV[key] = value\n end\n\n if args[:umask]\n umask = ((args[:umask].respond_to?(:oct) ? args[:umask].oct : args[:umask].to_i) & 007777)\n File.umask(umask)\n end\n \n begin\n if cmd.kind_of?(Array)\n exec(*cmd)\n else\n exec(cmd)\n end\n raise 'forty-two' \n rescue Exception => e\n Marshal.dump(e, ps.last)\n ps.last.flush\n end\n ps.last.close unless (ps.last.closed?)\n exit!\n }\n ensure\n $VERBOSE = verbose\n end\n\n [pw.first, pr.last, pe.last, ps.last].each{|fd| fd.close}\n\n begin\n e = Marshal.load ps.first\n raise(Exception === e ? e : \"unknown failure!\")\n rescue EOFError # If we get an EOF error, then the exec was successful\n 42\n ensure\n ps.first.close\n end\n\n pw.last.sync = true\n\n pi = [pw.last, pr.first, pe.first]\n\n if b \n begin\n if args[:waitlast]\n b[cid, *pi]\n Process.waitpid2(cid).last\n else\n # This took some doing.\n # The trick here is to close STDIN\n # Then set our end of the childs pipes to be O_NONBLOCK\n # Then wait for the child to die, which means any IO it\n # wants to do must be done - it's dead. If it isn't,\n # it's because something totally skanky is happening,\n # and we don't care.\n o = StringIO.new\n e = StringIO.new\n\n pi[0].close\n \n stdout = pi[1]\n stderr = pi[2]\n\n stdout.sync = true\n stderr.sync = true\n\n stdout.fcntl(Fcntl::F_SETFL, pi[1].fcntl(Fcntl::F_GETFL) | Fcntl::O_NONBLOCK)\n stderr.fcntl(Fcntl::F_SETFL, pi[2].fcntl(Fcntl::F_GETFL) | Fcntl::O_NONBLOCK)\n \n stdout_finished = false\n stderr_finished = false\n \n results = nil\n\n while !stdout_finished || !stderr_finished\n begin\n channels_to_watch = []\n channels_to_watch << stdout if !stdout_finished\n channels_to_watch << stderr if !stderr_finished\n ready = IO.select(channels_to_watch, nil, nil, 1.0)\n rescue Errno::EAGAIN\n results = Process.waitpid2(cid, Process::WNOHANG)\n if results\n stdout_finished = true\n stderr_finished = true \n end\n end\n\n if ready && ready.first.include?(stdout)\n line = results ? stdout.gets(nil) : stdout.gets\n if line\n o.write(line)\n else\n stdout_finished = true\n end\n end\n if ready && ready.first.include?(stderr)\n line = results ? stderr.gets(nil) : stderr.gets\n if line\n e.write(line)\n else\n stderr_finished = true\n end\n end\n end\n results = Process.waitpid2(cid).last unless results\n o.rewind\n e.rewind\n b[cid, pi[0], o, e]\n results\n end\n ensure\n pi.each{|fd| fd.close unless fd.closed?}\n end\n else\n [cid, pw.last, pr.first, pe.first]\n end\n end", "def test_s_pid\n assert_instance_of(Fixnum, Process.pid)\n assert_equal($$, Process.pid)\n IO.popen(\"-\") do |pipe|\n if !pipe\n puts Process.pid\n puts Process.ppid\n exit\n end\n assert_equal(pipe.pid, pipe.gets.to_i)\n assert_equal(Process.pid, pipe.gets.to_i)\n pipe.close\n end\n end", "def subprocess\n\tif not pid = Process.fork\n\t\tyield\n\t\texit!\n\tend\n\tpid\nend", "def popen(cmd, path = nil, vars = {}, &block)\n result = popen_with_detail(cmd, path, vars, &block)\n\n [\"#{result.stdout}#{result.stderr}\", result.status&.exitstatus]\n end", "def pipe(*cmd, stdin: nil)\n IO.popen(cmd, \"r+\", err: %i[child out]) do |io|\n io.write stdin if stdin\n io.close_write\n io.read\n end\nend", "def exec!\n # spawn the process and hook up the pipes\n pid, stdin, stdout, stderr = popen4(@env, *(@argv + [@options]))\n @pid = pid\n\n # async read from all streams into buffers\n read_and_write(@input, stdin, stdout, stderr, @timeout, @max)\n\n # grab exit status\n @status = waitpid(pid)\n rescue Object\n [stdin, stdout, stderr].each { |fd| fd.close rescue nil }\n if @status.nil?\n if !@pgroup_kill\n ::Process.kill('TERM', pid) rescue nil\n else\n ::Process.kill('-TERM', pid) rescue nil\n end\n @status = waitpid(pid) rescue nil\n end\n raise\n ensure\n # let's be absolutely certain these are closed\n [stdin, stdout, stderr].each { |fd| fd.close rescue nil }\n end", "def exec!\n # The signal handler MUST be installed before spawning a new process\n SignalHandler.setup!\n\n if RUBY_PLATFORM =~ /linux/i && @options.delete(:close_others)\n @options[:in] = :in\n @options[:out] = :out\n @options[:err] = :err\n\n ::Dir.glob(\"/proc/%d/fd/*\" % Process.pid).map do |file|\n fd = File.basename(file).to_i\n\n if fd > 2\n @options[fd] = :close\n end\n end\n end\n\n @pid, stdin, stdout, stderr = popen4(@env, *(@argv + [@options]))\n @start = Time.now\n\n # Don't leak into processes spawned after us.\n [stdin, stdout, stderr].each { |io| io.close_on_exec = true }\n\n # watch fds\n @cin = EM.watch stdin, WritableStream, (@input || \"\").dup, \"stdin\"\n @cout = EM.watch stdout, ReadableStream, @prepend_stdout, \"stdout\"\n @cerr = EM.watch stderr, ReadableStream, @prepend_stderr, \"stderr\"\n\n # register events\n @cin.notify_writable = true\n @cout.notify_readable = true\n @cerr.notify_readable = true\n\n # keep track of open fds\n in_flight = [@cin, @cout, @cerr].compact\n in_flight.each { |io|\n # force binary encoding\n io.force_encoding\n\n # register finalize hook\n io.callback { in_flight.delete(io) }\n }\n\n failure = nil\n\n # keep track of max output\n max = @max\n if max && max > 0\n check_buffer_size = lambda { |listener, _|\n if !terminated? && !listener.closed?\n if @cout.buffer.size + @cerr.buffer.size > max\n failure = MaximumOutputExceeded\n in_flight.each(&:close)\n in_flight.clear\n request_termination\n end\n end\n }\n\n @cout.after_read(&check_buffer_size)\n @cerr.after_read(&check_buffer_size)\n end\n\n # request termination of process when it doesn't terminate\n # in time\n timeout = @timeout\n if timeout && timeout > 0\n @sigterm_timer = Timer.new(timeout) {\n failure = TimeoutExceeded\n in_flight.each(&:close)\n in_flight.clear\n request_termination\n }\n end\n\n # run block when pid is reaped\n SignalHandler.instance.pid_callback(@pid) {\n @sigterm_timer.cancel if @sigterm_timer\n @sigkill_timer.cancel if @sigkill_timer\n @runtime = Time.now - @start\n @status = SignalHandler.instance.pid_to_process_status(@pid)\n\n in_flight.each do |io|\n # Trigger final read to make sure buffer is drained\n if io.respond_to?(:notify_readable)\n io.notify_readable\n end\n\n io.close\n end\n\n in_flight.clear\n\n @out = @cout.buffer\n @err = @cerr.buffer\n\n if failure\n set_deferred_failure failure\n else\n set_deferred_success\n end\n }\n end", "def read_output(pid)\n access_processes do |processes|\n File.read(processes[pid].io.stdout.path) rescue nil \n end\n end", "def get_from_shell_cmd(cmd, proc_id)\n stdout, stderr, status = Open3.capture3(cmd)\n if not status.success?\n cancel_job(\"error executing command '#{cmd}' - #{stderr}\", proc_id)\n end\n return stdout.strip!\nend", "def execute\n begin\n rout, wout = IO.pipe\n rerr, werr = IO.pipe\n stdout, stderr = nil\n\n pid = Process.spawn(command_line, :pgroup => true, :out => wout, :err => werr)\n Timeout.timeout(timeout) do\n Process.wait(pid)\n\n wout.close\n werr.close\n\n stdout = rout.readlines.join\n stderr = rerr.readlines.join\n end\n rescue Timeout::Error\n Process.kill(-9, pid)\n Process.detach(pid)\n ensure\n wout.close unless wout.closed?\n werr.close unless werr.closed?\n\n rout.close\n rerr.close\n end\n stdout\n end", "def extract_childprocess\n original.io.stdout.rewind\n original.io.stderr.rewind\n @stdout = original.io.stdout.read\n @stderr = original.io.stderr.read\n original.io.stdout.delete\n original.io.stderr.delete\n end", "def spawn_process(args = nil)\n #Used for printing debug-stuff.\n @main = true\n\n if args && args[:exec]\n cmd = \"#{args[:exec]}\"\n else\n if RbConfig::CONFIG[\"bindir\"]\n cmd = \"#{RbConfig::CONFIG[\"bindir\"]}/ruby\"\n else\n cmd = \"ruby\"\n end\n end\n\n cmd << \" \\\"#{File.realpath(File.dirname(__FILE__))}/../scripts/ruby_process_script.rb\\\" --pid=#{@my_pid}\"\n cmd << \" --debug\" if @args[:debug]\n cmd << \" \\\"--title=#{@args[:title]}\\\"\" unless @args[:title].to_s.strip.empty?\n\n #Start process and set IO variables.\n require \"open3\"\n @io_out, @io_in, @io_err = Open3.popen3(cmd)\n @io_out = Tsafe::Proxy.new(obj: @io_out)\n @io_out.sync = true\n @io_in.sync = true\n @io_err.sync = true\n\n started = false\n @io_in.each_line do |str|\n if str == \"ruby_process_started\\n\"\n started = true\n break\n end\n\n debug \"Ruby-process-debug from stdout before started: '#{str}'\\n\" if @debug\n end\n\n raise \"Ruby-sub-process couldnt start: '#{@io_err.read}'.\" unless started\n self.listen\n\n #Start by getting the PID of the process.\n begin\n @pid = self.static(:Process, :pid).__rp_marshal\n raise \"Unexpected PID: '#{@pid}'.\" if !@pid.is_a?(Fixnum) && !@pid.is_a?(Integer)\n rescue => e\n self.destroy\n raise e\n end\n\n if block_given?\n begin\n yield(self)\n ensure\n self.destroy\n end\n\n return self\n else\n return self\n end\n end", "def capture_subprocess_io; end", "def capture(input)\n Open3.popen3(*command.split(\" \")) {|i, o, e, t|\n out_reader = Thread.new { o.read }\n err_reader = Thread.new { e.read }\n i.write input\n i.close\n [out_reader.value, err_reader.value, t.value]\n }\n end", "def capture(input)\n Open3.popen3(*command.split(\" \")) {|i, o, e, t|\n out_reader = Thread.new { o.read }\n err_reader = Thread.new { e.read }\n i.write input\n i.close\n [out_reader.value, err_reader.value, t.value]\n }\n end", "def capture(input)\n Open3.popen3(*command.split(\" \")) {|i, o, e, t|\n out_reader = Thread.new { o.read }\n err_reader = Thread.new { e.read }\n i.write input\n i.close\n [out_reader.value, err_reader.value, t.value]\n }\n end", "def popen_with_timeout(cmd, timeout=DEFAULT_PROCESS_TIMEOUT, path=\"/tmp\")\n raise \"Commands must be provided as an array of strings\" unless cmd.is_a?(Array)\n\n # inherit our environment\n vars = ENV\n\n # save the current working directory\n vars['PWD'] = path\n \n FileUtils.mkdir_p(path) unless File.directory?(path)\n\n begin\n # Create pipes we can read \n rout, wout = IO.pipe\n rerr, werr = IO.pipe\n\n pid = Process.spawn(vars, *cmd, out: wout, err: werr, chdir: path, pgroup: true)\n # stderr and stdout pipes can block if stderr/stdout aren't drained: https://bugs.ruby-lang.org/issues/9082\n # Mimic what Ruby does with capture3: https://github.com/ruby/ruby/blob/1ec544695fa02d714180ef9c34e755027b6a2103/lib/open3.rb#L257-L273\n out_reader = Thread.new { rout.read }\n err_reader = Thread.new { rerr.read }\n \n # close write ends so we could read them\n wout.close\n werr.close\n \n # wait for completion\n status = process_wait_with_timeout(pid, timeout)\n\n # Don't copy `popen` which merges stderr into output\n cmd_output = out_reader.value\n err_output = err_reader.value \n \n # return stdout, stderr and exit status\n [cmd_output, err_output, status.exitstatus]\n \n rescue Errno::ENOENT => e\n raise SystemResourceMissing, e\n\n rescue TimeoutError => e\n kill_process_group_for_pid(pid)\n raise e\n \n ensure\n wout.close unless wout.closed?\n werr.close unless werr.closed?\n\n # rout is shared with out_reader. To prevent an exception in that\n # thread, kill the thread before closing rout. The same goes for rerr\n # below.\n out_reader.kill if out_reader\n rout.close\n\n err_reader.kill if err_reader\n rerr.close\n end\n end", "def capture(input)\n Open3.popen3(*command.split(\" \")) {|i, o, e, t|\n out_reader = Thread.new { o.read }\n err_reader = Thread.new { e.read }\n i.write input\n i.close\n [out_reader.value, err_reader.value, t.value]\n }\n end", "def new_pipe\n IO.popen(@cmdline, 'r+')\n end", "def mock_popen4_with(options)\n stdout = StringIO.new(options[:stdout] || '')\n stderr = StringIO.new(options[:stderr] || '')\n stdin = StringIO.new\n Open4.expects(:popen4).with(*options[:expected_command]).returns([options[:pid], stdin, stdout, stderr])\n end", "def run(*args)\n stdin, stdout, stderr, process = Open3.popen3(*args)\n out = stdout.read.strip\n err = stderr.read.strip\n\n [stdin, stdout, stderr].each(&:close)\n [process.value, out + err]\n end", "def start(command_and_args = [], output_to_wait_for = nil, wait_timeout = nil, env = {}, opts = {})\n out_r, out_w = IO.pipe\n @out_log = ProcessLog.new(out_r, @opts).start\n if opts[:stderr]\n err_r, err_w = IO.pipe\n @err_log = ProcessLog.new(err_r, @opts).start\n else\n err_w = out_w\n end\n @pid = spawn(env, *command_and_args, :out => out_w, :err => err_w)\n out_w.close\n err_w.close if opts[:stderr]\n @out_log.wait_for_output(output_to_wait_for, :timeout => wait_timeout) unless output_to_wait_for.nil?\n end", "def startShell(mnopts=nil)\n \"Start a shell process for running commands\"\n if @shell\n error(\"%s: shell is already running\\n\" % @name)\n return\n end \n\n # mnexec: (c)lose descriptors, (d)etach from tty,\n # (p)rint pid, and run in (n)amespace\n if !mnopts\n opts='-cd'\n else\n opts=mnopts \n end \n #opts = '-cd' if !mnopts else mnopts\n if @inNamespace\n opts += 'n'\n end \n # bash -i: force interactive\n # -s: pass $* to shell, and make process easy to find in ps\n # prompt is set to sentinel chr( 127 )\n cmd = ['mnexec', opts, 'env', 'PS1=' + 127.chr,\n 'bash', '--norc', '-is', 'mininet:' + @name]\n # Spawn a shell subprocess in a pseudo-tty, to disable buffering\n # in the subprocess and insulate it from signals (e.g. SIGINT)\n # received by the parent\n master, slave = PTY.open\n #master=IO.try_convert(master) \n @shell = _popen(cmd, stdin=slave, stdout=slave, stderr=slave,\n close_fds=false)\n puts @shell\n #master=master.to_s\n @stdin = File.new(master.fileno, \"r+\")\n puts @stdin\n #@stdin = os.fdopen( master, 'rw' )\n @stdout = @stdin\n @pid = @shell.pid\n #@pollOut = select.poll()\n\n #@pollOut.register( @stdout )\n # Maintain mapping between file descriptors and nodes\n # This is useful for monitoring multiple nodes\n # using select.poll()\n @@outToNode[@stdout.fileno()] = self\n @@inToNode[@stdin.fileno()] = self\n @execed = false\n @lastCmd = nil\n @lastPid = nil\n @readbuf = ''\n cmd('unset HISTFILE; stty -echo; set +m')\n end", "def get_pid\n\t\tEventMachine::get_subprocess_pid @signature\n\tend", "def remote_process\n start_r, start_w = IO.pipe\n quit_r, quit_w = IO.pipe\n remote_pid = fork do\n begin\n start_r.close\n yield\n rescue Exception => e\n puts e.full_message\n end\n\n start_w.write(\"OK\")\n quit_r.read(2)\n end\n start_w.close\n result = start_r.read(2)\n\n remote_processes << [remote_pid, quit_w]\n remote_pid\n ensure\n start_r.close\n end", "def start\n if not @pid.nil?\n raise \"Command already running!\"\n end\n\n # Reset everything\n reset\n\n # Capture options; pipes for stdout and stderr\n @stdout, @wout = IO.pipe\n @stderr, @werr = IO.pipe\n opts = {\n out: @wout,\n err: @werr,\n }\n\n @pid = spawn({}, *@command, opts)\n return @pid\n end", "def run_command(cmd, *args)\n r,w = IO.pipe\n\n pid = fork do\n r.close\n STDIN.close\n STDOUT.reopen(w)\n STDERR.reopen(w)\n\n exec(cmd, *args)\n end\n\n w.close\n output = r.read.force_encoding('binary')\n pid, status = Process::wait2(pid)\n\n [output, status]\n end", "def capture_stdout(cmd, err: STDERR)\n if err.nil?\n err = \"/dev/null\"\n end\n output, _ = Open3.capture2(*cmd, :err => err)\n output\n end", "def remote_process\n\t start_r, start_w= IO.pipe\n\t quit_r, quit_w = IO.pipe\n\t remote_pid = fork do\n begin\n start_r.close\n yield\n rescue Exception => e\n puts e.full_message\n end\n\n start_w.write('OK')\n quit_r.read(2)\n\t end\n\t start_w.close\n\t result = start_r.read(2)\n\n\t remote_processes << [remote_pid, quit_w]\n\t remote_pid\n\n\tensure\n\t # start_r.close\n\tend", "def run(input)\n stdout, stderr, process = capture(input)\n\n raise stderr unless process.success?\n\n return stdout\n end", "def capture_stdout(cmd, err = STDERR)\n if err.nil?\n err = \"/dev/null\"\n end\n output, _ = Open3.capture2(*cmd, :err => err)\n output\n end", "def get_children_process(pid)\n\t`ps --ppid #{pid} | grep -v PID | awk '{print $1}'`.split(\"\\n\")\n\t#Could not find a Ruby way to do this\nend", "def stdout_pipe\n @stdout\n end", "def run(input)\n stdout, stderr, process = capture(input)\n\n raise stderr unless process.success?\n\n return stdout\n end", "def pid; ::Process.pid end", "def remote_processes\n stdout = ''\n self.exec!(\"ps -o pid,ppid,cmd -u #{self.options[:user]}\") do |_channel, stream, data|\n stdout << data if stream == :stdout\n end\n # Sample output:\n # PID PPID CMD\n # 2202 1882 /bin/sh /usr/bin/startkde\n # 2297 2202 /usr/bin/ssh-agent /usr/bin/gpg-agent --daemon --sh --write-env-file=/home/sa\n # 2298 2202 /usr/bin/gpg-agent --daemon --sh --write-env-file=/home/sayantamd/.gnupg/gpg-\n # 2301 1 /usr/bin/dbus-launch --exit-with-session /usr/bin/startkde\n # 2302 1 /bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session\n\n @remote_processes = []\n ps_line_rexp = Regexp.compile('^(\\d+)\\s+(\\d+)\\s+(.+?)$')\n stdout.split(\"\\n\").each do |line|\n line.strip!\n next if line.blank? || line.match(/^PID/i)\n matcher = ps_line_rexp.match(line)\n process = OpenStruct.new\n process.pid = matcher[1].to_i\n process.ppid = matcher[2].to_i\n process.cmd = matcher[3]\n @remote_processes.push(process.freeze)\n end\n\n @remote_processes\n end", "def run(cmd, cin, cout)\n pid = fork do\n STDIN.reopen(cin) if cin\n STDOUT.reopen(cout)\n\n exec(*cmd)\n end\n\n cin.close if cin\n cout.close\n\n Process::wait2(pid)[1]\nend", "def parent_command\n # When run in Docker containers, there may be no parent process.\n return if Process.ppid.zero?\n\n if OS.windows?\n `wmic process where ProcessId=#{Process.ppid} get CommandLine /FORMAT:VALUE`.\n strip.\n slice(/(?<=CommandLine=).+/)\n elsif OS.cygwin?\n # Cygwin's `ps` command behaves differently than the traditional\n # Linux version, but a comparable `procps` is provided to compensate.\n `procps -ocommand= -p #{Process.ppid}`.chomp\n else\n `ps -ocommand= -p #{Process.ppid}`.chomp\n end\n end", "def xe_open(cmd)\n a = Array.new\n popen4(cmd) do |pid, stdin, stdout, stderr|\n stdin.close\n stdout.each {|line| a << line.chomp}\n end\n return a\nend", "def stdin\n return if @process.nil?\n\n @process.io.stdin\n end", "def stdout(command, data)\n # called when the process writes to STDOUT\n end", "def launch(*commands)\n output = Tempfile.new('cps-out')\n output.sync = true\n\n process = ChildProcess.build(*commands)\n process.io.stdout = process.io.stderr = output\n process.duplex = true\n process.start\n\n pid = process.pid\n access_processes do |processes|\n processes[pid] = process\n end\n pid\n end", "def get_ps_info args={}, &block\n return if OS.windows?\n\n pid = args[:pid]\n\n EM.system('sh', proc{ |process|\n process.send_data \"ps auxw | grep \" + pid.to_s + \" | grep -v 'grep'\\n\"\n process.send_data \"exit\\n\"\n }) { |output, status|\n if status.exitstatus == 0\n format args, output, &block\n else\n block.call status, nil if block\n end\n }\n end", "def capture_stdout\n output = StringIO.new\n $stdout = output\n yield\n $stdout = STDOUT\n output\nend", "def create_process(command, stdin, stdout, stderror)\n params = [\n 'L', # IN LPCSTR lpApplicationName\n 'P', # IN LPSTR lpCommandLine\n 'L', # IN LPSECURITY_ATTRIBUTES lpProcessAttributes\n 'L', # IN LPSECURITY_ATTRIBUTES lpThreadAttributes\n 'L', # IN BOOL bInheritHandles\n 'L', # IN DWORD dwCreationFlags\n 'L', # IN LPVOID lpEnvironment\n 'L', # IN LPCSTR lpCurrentDirectory\n 'P', # IN LPSTARTUPINFOA lpStartupInfo\n 'P'] # OUT LPPROCESS_INFORMATION lpProcessInformation\n\n startupInfo = [STARTUP_INFO_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW, 0,\n 0, 0, stdin, stdout, stderror].pack('IIIIIIIIIIIISSIIII')\n\n processInfo = [0, 0, 0, 0].pack('IIII')\n command << 0\n\n createProcess = Win32API.new(\"kernel32\", \"CreateProcess\", params, 'I')\n raise_last_win_32_error if createProcess.call(0,\n command, 0, 0, 1, 0, 0, 0, startupInfo, processInfo).zero?\n\n hProcess, hThread, dwProcessId, dwThreadId = processInfo.unpack('LLLL')\n\n close_handle(hProcess)\n close_handle(hThread)\n\n [dwProcessId, dwThreadId]\n end", "def run(client)\n with_child do\n child.send_io client\n child.gets\n end\n\n pid = child.gets\n pid = pid.chomp.to_i if pid\n log \"got worker pid #{pid}\"\n pid\n rescue Errno::ECONNRESET, Errno::EPIPE => e\n log \"#{e} while reading from child; returning no pid\"\n nil\n ensure\n client.close\n end", "def popen4( _except = nil, _all_streams = nil )\n _except = true unless _except == false\n _all_streams ||= false\n _in_str = self\n _out_str, _err_str = []\n\n _status = Open4.popen4(_in_str) do |_pid, _stdin, _stdout, _stderr|\n _out_str = _stdout.read\n _err_str = _stderr.read\n end\n\n _exit_status = _status.exitstatus\n\n if _exit_status != 0 and\n _except == true\n\n Mobilize::Log.write _err_str, \"FATAL\"\n\n elsif _all_streams == false\n\n return _out_str.strip\n\n else\n\n return { in: _in_str.strip,\n out: _out_str.strip,\n err: _err_str.strip }\n\n end\n end", "def getpid\n @resource.fail \"Either stop/status commands or a pattern must be specified\" unless @resource[:pattern]\n ps = Facter[\"ps\"].value\n @resource.fail \"You must upgrade Facter to a version that includes 'ps'\" unless ps and ps != \"\"\n regex = Regexp.new(@resource[:pattern])\n self.debug \"Executing '#{ps}'\"\n IO.popen(ps) { |table|\n table.each_line { |line|\n if regex.match(line)\n ary = line.sub(/^\\s+/, '').split(/\\s+/)\n return ary[1]\n end\n }\n }\n\n nil\n end", "def execute_and_handle(command, outpipe, errpipe)\n Open3.popen3(command) do |_, stdout, stderr|\n if (outpipe)\n outpipe.call(stdout)\n end\n if (errpipe)\n errpipe.call(stderr)\n end\n end\nend", "def process\n pid = spawn(@args.command, %i[out err] => '/dev/null')\n Process.detach pid\n metadata[@args.command] = pid\n end", "def capture_stdout\n out = StringIO.new\n $stdout = out\n yield\n return out.string\n ensure\n $stdout = STDOUT\n end", "def capture_stdout\n out = StringIO.new\n $stdout = out\n yield\n return out.string\n ensure\n $stdout = STDOUT\n end", "def capture_stdout\n out = StringIO.new\n $stdout = out\n yield\n return out.string\n ensure\n $stdout = STDOUT\n end", "def call_command_local_popen(cmd, query = nil)\n str = make_command_line(cmd)\n IO.popen(str, \"w+\") do |io|\n if block_given? then\n io.sync = true\n yield io, io\n else\n io.sync = true\n io.print query if query\n io.close_write\n io.read\n end\n end\n end", "def write_pid; end", "def ppid\n Process.ppid\n end", "def run(cmd)\n puts \"=== running: #{cmd} \".ljust(terminal_columns, '=').cyan\n pid, _, stdout, stderr = Open4::popen4 cmd\n _, status = Process::waitpid2 pid\n puts \"===\".ljust(terminal_columns, '=').cyan\n {:status => status, :stdout => stdout.read.strip, :stderr => stderr.read.strip}\n end", "def run_locally(stdin_text = nil, &block)\n raise ArgumentError.new('block required') unless block_given?\n\n cmd = block.call\n # cmd = \"echo '#{stdin_text}' | #{cmd}\" if stdin_text\n\n raise \"Unable to run_locally - fork method not useable\" unless Process.respond_to? :fork\n\n # preload stdin if there is input to avoid a race condition\n if stdin_text\n stdin_pipe, child_stdin = IO.pipe if stdin_text\n count = child_stdin.write(stdin_text.to_s)\n child_stdin.close\n end\n\n child_stdout, stdout_pipe = IO.pipe\n child_stderr, stderr_pipe = IO.pipe\n unless (pid = Process.fork)\n if stdin_text\n STDIN.reopen(stdin_pipe)\n else\n STDIN.close\n end\n STDOUT.reopen(stdout_pipe)\n STDERR.reopen(stderr_pipe)\n begin\n Process.exec ENV, cmd\n rescue SystemCallError => e\n STDERR.write(\"Unable to execute command '#{cmd}'\\n #{e}\")\n ensure\n exit\n end\n end\n\n Process.wait\n\n stdout = ''\n stderr = ''\n loop do\n reads, writes, obands = IO.select([child_stdout, child_stderr], [], [], 1)\n break if reads.nil?\n stdout += child_stdout.read_nonblock(1024) if reads.include? child_stdout\n stderr += child_stderr.read_nonblock(1024) if reads.include? child_stderr\n end\n stdout = nil if stdout.empty?\n stderr = nil if stderr.empty?\n\n [stdout, stderr, cmd]\n end", "def pid\n @pid ||= Process.pid\n end", "def run_program(cmd, input = \"\")\n stdout, = Open3.capture2e(shell_out_env, *cmd, stdin_data: input)\n\n stdout\n end", "def pid\n @sock.cmd(\"String\" => \"pid\", \"Match\" => /(SUCCESS:.*\\n|ERROR:.*\\n|END.*\\n)/)\n end", "def sh_out(cmd, fail = true, stdin = '')\n r_in, w_in = IO.pipe\n r_out, w_out = IO.pipe\n r_err, w_err = IO.pipe\n w_in.write(stdin)\n w_in.close\n pid = Process.spawn(cmd, in: r_in, out: w_out, err: w_err)\n Process.wait(pid)\n\n r_in.close\n w_out.close\n w_err.close\n stdout = r_out.read\n r_out.close\n stderr = r_err.read\n r_err.close\n\n if fail && $CHILD_STATUS.exitstatus != 0\n raise CommandError, \"`#{cmd}` exited #{$CHILD_STATUS.exitstatus}\\n\" \\\n \"stdout:\\n\" \\\n \"#{stdout}\\n\" \\\n \"stderr:\\n\" \\\n \"#{stderr}\\n\"\n end\n stdout\n end", "def run(cmd)\n rtn = nil\n\n Open3.popen3(cmd) do |_, o, e, t|\n out_reader = Thread.new { o.read }\n err_reader = Thread.new { e.read }\n\n rtn = [out_reader.value, err_reader.value, t.value]\n end\n\n rtn\nend", "def system(cmd_str, args=[], opts={})\n unless EventMachine.reactor_running?\n raise \"has to prepare EventMachine context\"\n end\n\n cmd = quote_args(cmd_str, args, (opts[:quote_char] || '\\''))\n\n capture_io = opts[:io] || StringIO.new\n stdin_buf = opts[:stdin_input]\n \n evmsg = {:cmd => cmd}\n wait_q = ::Queue.new\n if opts[:timeout] && opts[:timeout].to_f > 0.0\n EventMachine.add_timer(opts[:timeout].to_f) {\n wait_q.enq(RuntimeError.new(\"timeout child process wait: #{opts[:timeout].to_f} sec(s)\"))\n }\n evmsg[:timeout] = opts[:timeout].to_f \n end\n popenobj = EventMachine.popen(cmd, EmSystemCb, capture_io, stdin_buf, proc { |exit_stat|\n wait_q.enq(exit_stat)\n })\n pid = EventMachine.get_subprocess_pid(popenobj.signature)\n evmsg[:pid] = pid\n if self.respond_to? :logger\n logger.debug(\"Exec command (pid=#{pid}): #{cmd}\")\n end\n\n stat = wait_q.deq\n evmsg = {}\n \n case stat\n when Process::Status\n evmsg[:exit_code] = stat.exitstatus\n if stat.exited? && stat.exitstatus == 0\n else\n raise \"Unexpected status from child: #{stat}\"\n end\n when Exception\n raise stat\n else\n raise \"Unknown signal from child: #{stat}\"\n end\n \n end", "def ps_cmd(pid)\n case RbConfig::CONFIG['arch']\n when /solaris|bsd/\n `ps -o comm,ppid -p #{pid}`\n when /linux/\n `ps -o cmd,ppid #{pid}`\n else\n raise 'UnknownOS'\n end.split(\"\\n\").last.split\nend", "def cmd_from_pid(pid)\n\tcmd = File.open(\"/proc/#{pid}/cmdline\") { |i| i.read }.split(/\\0/)\nend", "def run(input)\n stdout, stderr, process = capture(input)\n\n raise stderr unless process.success?\n\n return stdout.strip\n end", "def pexec(cmd)\n `#{cmd} 2>&1`\n $?\nend", "def run input, params\n stdout, stderr, process = capture(input)\n\n raise stderr unless process.success?\n puts stderr if ENV['DEBUG']\n\n return stdout\n end", "def do_in_child\n read, write = IO.pipe\n pid = fork do\n read.close\n result = yield\n Marshal.dump(result, write)\n exit!(0)\n end\n\n write.close\n result = read.read\n Process.wait(pid)\n raise \"Child fork failed\" if result.empty?\n Marshal.load(result)\nend", "def execute(command, *argN)\n command = replace_command(command)\n\n # Setup the options that will be passed to the ``popen4``\n # method.\n argN << {} if !argN.last.is_a?(Hash)\n options = argN.last\n options[:chdir] ||= @workdir.to_s\n\n # Execute in a separate process, wait for it to complete, and\n # return the IO streams.\n @logger.info(\"Executing: #{command} #{argN.inspect}. Output will stream in...\")\n pid, stdin, stdout, stderr = popen4(@env, command, *argN)\n status = nil\n\n io_data = {\n stdout => \"\",\n stderr => \"\"\n }\n\n while results = IO.select([stdout, stderr], [stdin], nil, 5)\n # Check the readers first to see if they're ready\n readers = results[0]\n if !readers.empty?\n begin\n readers.each do |r|\n data = r.readline\n io_data[r] += data\n\n io_name = r == stdout ? \"stdout\" : \"stderr\"\n @logger.debug(\"[#{io_name}] #{data.chomp}\")\n yield io_name.to_sym, data if block_given?\n end\n rescue EOFError\n # Process exited, so break out of this while loop\n break\n end\n end\n\n # Check here if the process has exited, and if so, exit the\n # loop.\n exit_pid, status = Process.waitpid2(pid, Process::WNOHANG)\n break if exit_pid\n\n # Check the writers to see if they're ready, and notify any\n # listeners...\n if !results[1].empty?\n yield :stdin, stdin if block_given?\n end\n end\n\n # Only load the exit status if we don't already have it, since\n # it is possible that it could've been obtained in the above\n # while loop.\n _pid, status = Process.waitpid2(pid) if !status\n @logger.debug(\"Exit status: #{status.exitstatus}\")\n\n return ExecuteProcess.new(status.exitstatus, io_data[stdout], io_data[stderr])\n end", "def get_child_pids(parent_pid)\n processes = Sys::ProcTable.ps.select{ |pe| pe.ppid == parent_pid }\n processes.map {|process| [process.pid, process.ppid]}.flatten - [parent_pid]\n end", "def run_shell(command, env: {}, stdin_data: '')\n # If we're passed a string, convert it to an array beofre passing to capture3\n command = command.split unless command.is_a?(Array)\n\n stdout, stderr, exit_status = Open3.capture3(env, *command, stdin_data: stdin_data)\n { stdout: stdout, stderr: stderr, exit_status: exit_status }\n end", "def streamed_api_command(command, stdin = nil, *args, &block)\n command, args = prepare_command_args(command, args)\n i, o, t = Open3.popen2(command, *args)\n i.puts(stdin) unless stdin.blank? # If we have any input, send it to the child\n i.close # Afterwards we can close child's stdin\n if block_given?\n o.each_line do |line|\n yield line\n end\n o.close\n raise \"#{command} failed\" unless t.value.success?\n else\n return o, t # The caller has to close o and wait for t\n end\n end", "def capture_stdout\n old_stdout, $stdout = $stdout, StringIO.new\n begin\n yield\n $stdout.string\n ensure\n $stdout = old_stdout\n end\n end", "def pipe_reader(*args)\n # avoid shell expansion using fork/exec\n reader, writer = IO.pipe\n pid = fork\n if pid\n writer.close\n yield(reader)\n Process.waitpid(pid)\n else\n begin\n reader.close\n STDIN.reopen(\"/dev/null\")\n STDOUT.reopen(writer)\n exec(*args)\n rescue => e\n # prevent child from jumping out of this scope and continuing main program\n STDERR.puts(e.to_s)\n end\n exit! # will only reach here if exec() failed\n end\n end", "def _pid\n @@_pid ||= Process.pid\n end", "def pid\n @pid ||= Process.pid\n end", "def pid\n @pid ||= Process.pid\n end", "def run(command)\n wait_until_done if running?\n setup_environment\n begin\n @command = command.dup\n @status = nil\n words = Shellwords.shellwords(command)\n @pid, @stdin, stdout, stderr = Open4.popen4(*words)\n @standard_output = Stream.new(self, 'standard output', stdout)\n @standard_error = Stream.new(self, 'standard error' , stderr)\n self\n ensure\n teardown_environment\n end\n end", "def spawn_process(drb_uri, persistent_worker)\n # FIXME : make this work under Window$\n my_out, its_out = IO.pipe()\n my_err, its_err = IO.pipe()\n\n its_out.sync = true\n its_err.sync = true\n\n if persistent_worker\n @adept_process_id = Process.spawn(RUN_ADEPT_SCRIPT, '--persistent',\n drb_uri,\n {:out => its_out, :err => its_err})\n else\n @adept_process_id = Process.spawn(RUN_ADEPT_SCRIPT, drb_uri,\n {:out => its_out, :err => its_err})\n end\n\n its_out.close()\n its_err.close()\n\n @reader_thread = Thread.new() do\n while !my_out.eof?() || !my_err.eof?()\n out_to_read = false\n err_to_read = false\n\n begin\n my_out.ungetbyte(my_out.read_nonblock(1))\n out_to_read = true\n rescue Errno::EAGAIN, EOFError\n end\n\n begin\n my_err.ungetbyte(my_err.read_nonblock(1))\n err_to_read = true\n rescue Errno::EAGAIN, EOFError\n end\n\n prefix = \"[PID ##{@adept_process_id.to_i()}] \"\n Spawner.jobs_logger.debug(prefix + my_out.readline() + \"\\n\") if out_to_read\n Spawner.jobs_logger.error(prefix + my_err.readline() + \"\\n\") if err_to_read\n\n IO.select([my_out, my_err]) unless out_to_read || err_to_read\n end\n end\n\n Process.detach(@adept_process_id)\n end", "def pid(*args)\n result = self.info(\"--pid\", *args).collect{ |str| str.scan(REGEX_PID) }\n result.flatten!.compact!\n\n result.first.strip.to_i\n end", "def popen3(cmd, callback)\n old_stderr = $stderr.dup\n rd, wr = IO.pipe\n $stderr.reopen(wr)\n\n popen_stdin = EM.popen(cmd, Process)\n popen_stdin.callback = callback\n\n popen_stderr = EM.attach(rd, Stderr, rd)\n popen_stderr.callback = callback\n\n yield(popen_stdin) if block_given?\n\n $stderr.reopen old_stderr\n end", "def stream_output(command)\n puts command\n exit_status = nil\n Open3.popen3(command) do |stdin, stdout, stderr, wait_thread|\n stdout.each { |line| puts line }\n stderr.each { |line| puts line }\n exit_status = wait_thread.value.to_i\n end\n raise %Q(The command \"#{command}\" failed.) unless exit_status == 0\nend", "def fork_exec(command, *args)\n # Remove empty args\n args.select! { |arg| arg != \"\" }\n args.flatten!\n pid = fork do\n Kernel.exec(command, *args)\n end\n Process.wait(pid)\nend", "def fork_exec(command, *args)\n # Remove empty args\n args.select! { |arg| arg != \"\" }\n args.flatten!\n pid = fork do\n Kernel.exec(command, *args)\n end\n Process.wait(pid)\nend", "def run_in_pty(cmd, dir)\n result = ''\n PTY.spawn(\"cd #{dir.realpath}; #{cmd}\") do |stdout, stdin, pid|\n begin\n stdout.each { |line| result += line }\n rescue Errno::EIO #Done getting output\n result\n end\n end\n result\n end", "def exec_with_timeout(cmd, timeout)\n begin\n # stdout, stderr pipes\n rout, wout = IO.pipe\n rerr, werr = IO.pipe\n stdout, stderr = nil\n status = false\n\n pid = Process.spawn(*cmd, pgroup: true, :out => wout, :err => werr)\n\n Timeout.timeout(timeout) do\n Process.waitpid(pid)\n # close write ends so we can read from them\n wout.close\n werr.close\n\n stdout = rout.readlines.join\n stderr = rerr.readlines.join\n status = true\n end\n\n rescue Timeout::Error\n # Try to determine why the kill does not tidy the chrome processes\n # Also whether a kill was actually issued!\n puts \"WARN: timeout scanning #{cmd[-1]} #{pid}\"\n $stderr.puts \"WARN: #{Time.now} timeout scanning #{cmd[-1]} #{pid}\"\n stderr = 'Timeout'\n # try using less drastic kill\n Process.kill(-2, pid) # INT\n Process.kill(-15, pid) # TERM\n Process.detach(pid)\n ensure\n wout.close unless wout.closed?\n werr.close unless werr.closed?\n # dispose the read ends of the pipes\n rout.close\n rerr.close\n end\n return stdout, stderr, status\nend", "def initialize(*args)\n @env, @argv, options = extract_process_spawn_arguments(*args)\n @options = options.dup\n @input = @options.delete(:input)\n @timeout = @options.delete(:timeout)\n @max = @options.delete(:max)\n @prepend_stdout = @options.delete(:prepend_stdout) || \"\"\n @prepend_stderr = @options.delete(:prepend_stderr) || \"\"\n @options.delete(:chdir) if @options[:chdir].nil?\n\n exec!\n end", "def raw_stdout\n if $stdout.respond_to?(:__getobj__)\n $stdout.__getobj__\n else\n $stdout\n end\n end", "def subshell(pid)\n\tkids = child_pids(pid)\n\tkids.each do |kid|\n\t\treturn kid if cmd_from_pid(kid)[0] =~ /sh$/\n\tend\n\tkids[0]\nend", "def pid\n @pid ||= metadata.fetch(@args.command, nil)\n end", "def command(command)\n IO.pipe do |read_io, write_io|\n pid = Process.spawn(command, :in => \"/dev/tty\", :out => write_io)\n Process.wait(pid)\n raise \"Command failed: #{command.inspect}\" unless $?.success?\n write_io.close\n read_io.read\n end\n end", "def |(cmd)\n IO.popen(cmd.to_s, 'r+') do |pipe|\n pipe.write(self)\n pipe.close_write\n pipe.read.strip\n end\n end", "def run\n child = fork do\n self[:out].write result\n \n close_all\n end\n \n close_all\n reset\n \n @pid = child\n\n self\n end", "def capture_stdout\n # The output stream must be an IO-like object. In this case we capture it in\n # an in-memory IO object so we can return the string value. You can assign any\n # IO object here.\n previous_stdout, $stdout = $stdout, StringIO.new\n yield\n $stdout.string\nensure\n # Restore the previous value of stderr (typically equal to STDERR).\n $stdout = previous_stdout\nend", "def execute(cmd)\n captured_stdout = ''\n captured_stderr = ''\n exit_status = Open3.popen3(ENV, cmd) do |stdin, stdout, stderr, wait_thr|\n stdin.close\n captured_stdout = stdout.read\n captured_stderr = stderr.read\n wait_thr.value\n end\n [exit_status, captured_stdout, captured_stderr]\n end", "def capture_command_output(*command, **kwargs, &block)\n # Default block returns what's passed in\n block ||= -> line { line }\n IO.popen(command.flatten, **kwargs) { |io| io.each_line { |line| print block.call(line) } }\n end" ]
[ "0.6945913", "0.6926403", "0.6560002", "0.65075195", "0.63351536", "0.6281145", "0.6250021", "0.6241206", "0.62267417", "0.6038773", "0.6036861", "0.60131353", "0.59852", "0.59559953", "0.5927879", "0.58659935", "0.58659935", "0.58659935", "0.5864546", "0.5846288", "0.5798707", "0.57765925", "0.5756244", "0.5748419", "0.5727763", "0.5727333", "0.57005554", "0.5695747", "0.5639764", "0.5633773", "0.5622586", "0.5613044", "0.5612865", "0.56057054", "0.5594256", "0.556016", "0.5529516", "0.5524817", "0.5494412", "0.54710746", "0.547079", "0.54618555", "0.54589087", "0.5443402", "0.5432136", "0.54308957", "0.5426239", "0.54100746", "0.5408521", "0.5392223", "0.53860945", "0.5380372", "0.53707963", "0.53707963", "0.53707963", "0.53707695", "0.5367186", "0.5361256", "0.53576314", "0.5347994", "0.53454524", "0.53394043", "0.53270966", "0.53211343", "0.53073406", "0.53040403", "0.53026134", "0.529977", "0.52809805", "0.52648556", "0.5259068", "0.5254427", "0.5253482", "0.52296454", "0.52132684", "0.52109295", "0.5208318", "0.5207523", "0.52063096", "0.5204631", "0.5204631", "0.51989585", "0.5191112", "0.517667", "0.5175011", "0.51741475", "0.5163385", "0.5163385", "0.5162789", "0.51599705", "0.51527816", "0.5148327", "0.514297", "0.51295555", "0.5129222", "0.51175207", "0.5116724", "0.5108852", "0.51085854", "0.51029265" ]
0.7112495
0
supports default parameters values
def nothing(p1=1,p2=2,p3=3) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supports_default_values?\n true\n end", "def required_defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults!; end", "def defaults!; end", "def default_parameters\n {}\n end", "def default=(_arg0); end", "def param_default( param, value )\n param = value unless ( param && param.length > 0 )\n end", "def default_params\n {}\n end", "def with_defaults(defaults); end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n end", "def set_defaults\n end", "def defaults(defaults = T.unsafe(nil)); end", "def default_value(value); value; end", "def default(a = 10, b) # it's possible in ruby to have default value as first parameter\n return a, b\nend", "def apply_parameter_defaults(parameters)\n parameters.each do |k, v|\n if v.empty?\n parameters[k] = Parameter.new(v.default)\n $stderr.puts \"Using default parameter value \" +\n \"'#{k}=#{parameters[k]}'.\"\n end\n end\nend", "def default_params(default_params=nil)\n default_params and @default_params = default_params or @default_params or {}\n end", "def method (number, default1 = 1, default2 = 2)\nend", "def set_default_params params\n set_default_params_status(params)\n set_default_params_type(params)\n set_default_params_content(params)\n return params\n end", "def set_default\n end", "def default_args(a,b,c=1)\n puts \"\\nValues of variables: \",a,b,c\nend", "def default=(value); end", "def default(value = nil)\r\n self.default_params = default_params.merge(value).freeze if value\r\n default_params\r\n end", "def method_missing(*args)\n default\n end", "def defaults(arg=nil)\n arg.nil? ? @defaults : (@defaults = arg)\n end", "def foo(param = \"no\") #this is default param\n \"yes\"\nend", "def default_params_encoder=(_arg0); end", "def default(a,b,c=2)\n puts \"c should equal 3 now: \"\n puts c\nend", "def default; end", "def default; end", "def default_options; end", "def default_options; end", "def default_options; end", "def missing_data_params\n default_params\n end", "def defaultArguments (x = 22, y = x + 20, z = 50)\n puts \"x = \" + x.to_s\n puts \"y = \" + y.to_s\n puts \"z = \" + z.to_s\n end", "def defaults\n super\n end", "def default(options = T.unsafe(nil)); end", "def create_defaults\n @parameters[:date] = Time.parse(\"00:00\").to_s\n @parameters[:period] = \"24\"\n @parameters[:default] = true\n end", "def set_default_options\n end", "def defVals(par1, opt1 = \"optional one applied\", opt2 = \"optional two applied\") \n puts \"First parameter => #{par1}\"\n puts \"Second parameter => #{opt1}\"\n puts \"Third parameter => #{opt2}\"\nend", "def default\n end", "def test_set_defaults09a\n assert_raise ( RuntimeError ) {\n ArgumentManager.set_defaults(\n {\n :df_str => 0\n }\n )\n } \n end", "def defaults(params)\n @defaults = @defaults.merge(params)\n end", "def set_defaults(options = T.unsafe(nil)); end", "def default_params\n @default_params ||= {}\n end", "def default(value = nil)\n self.default_params = default_params.merge(value).freeze if value\n default_params\n end", "def start_with_default_params!\n default_params = upper(:@@default_params) || {}\n @params.reverse_merge!(default_params)\n end", "def test_set_defaults07b\n assert_raise ( RuntimeError ) {\n ArgumentManager.set_defaults(\n {\n :df_int => 999\n }\n )\n } \n end", "def optional default_return_value = NoParameterMarker.instance\n if default_return_value == NoParameterMarker.instance\n repeat 0, 1 # default behaviour\n else\n repeat_with_default 0, 1, default_return_value\n end\n end", "def default=(_); end", "def test_set_defaults07a\n assert_raise ( RuntimeError ) {\n ArgumentManager.set_defaults(\n {\n :df_int => 'i am an invalid default integer'\n }\n )\n } \n end", "def initialize(default)\n @value = @default = default\n end", "def default_argument(argname)\n if (arg = find_argument(argname)) && arg.has_default?\n [true, arg.default]\n end\n end", "def initialize(value)\r\n @value = value\r\n @changeable = true\r\n default_value?\r\nend", "def default_options; {} end", "def default_values\n\t\tself.done ||= 'false'\n\t\tself.flag ||= 'false'\n\tend", "def default_values\n self.subtype ||= \"registered\"\n self.status ||= \"NEW\"\n end", "def default_parameter_for(options)\n default, allow_nil = options.values_at(:default, :allow_nil)\n return ' nil' if default.nil? && allow_nil\n return '' if default.nil? && !allow_nil\n\n \" #{prefix(default)}#{default}#{suffix(default)}\"\n end", "def param(name, type = nil, **opts, &block)\n raise ArgumentError, \"Default value for param not allowed - #{name}\" if opts.key? :default\n raise ArgumentError, \"Optional params not supported - #{name}\" if opts.fetch(:optional, false)\n\n super\n end", "def default_args\n args.select &:default\n end", "def default_values\n self.video_quality ||= %w[HD SD].sample\n self.price ||= (5.0...11.0)\n end", "def set_default(attr)\n return unless klass = self.class.attrclass(attr)\n return unless klass.method_defined?(:default)\n return if @parameters.include?(klass.name)\n\n return unless parameter = newattr(klass.name)\n\n if value = parameter.default and ! value.nil?\n parameter.value = value\n else\n @parameters.delete(parameter.name)\n end\n end", "def add_default_values\n ensure_license\n ensure_publisher\n ensure_resource_type\n end", "def test_set_defaults06\n assert_nothing_raised( Exception ) {\n ArgumentManager.set_defaults(\n {\n :min => 20,\n :max => 30\n }\n )\n } \n end", "def defaults\n {}\n end", "def defaults\n {}\n end", "def default_data\n end", "def default(values, default_value)\n if values.present?\n values\n else\n default_value\n end\n end", "def default_if_not_specified(opt,default_opt)\n opt ? opt : default_opt\nend", "def set_default_values\n # set_new_record_default_values\n set_attr_accessor_default_values\n end", "def method (a=3, b)\r\nend", "def default _args\n \"default _args;\" \n end", "def default_values\n @query = \"default values\"\n end", "def evaluate_default_proc(doc)\n serialize_default(default_val[])\n end", "def default!\n @value = default\n end", "def set_defaults\n super\n end", "def set_defaults\n super\n end", "def required_by_default?; end", "def default_configuration=(_arg0); end", "def defaults(hash)\n default_params.update(hash)\n end", "def configure_default(defaults, key, *args)\n defaults[key] = args[0] unless args.empty?\n end", "def default_values\n\t\tself.status = 0 unless self.status\n\t\tself.tagged = 0 unless self.tagged\n\t\tself.searched = 0 unless self.searched\n\tend", "def default_values\n self.deleted ||= '0'\n end", "def defaults\n {}\n end", "def default_values\n \t self.status ||= '0'\n \tend", "def default(key) end" ]
[ "0.7779235", "0.77535194", "0.77522457", "0.77522457", "0.77522457", "0.77522457", "0.77522457", "0.77522457", "0.77522457", "0.77522457", "0.77522457", "0.77522457", "0.7709063", "0.7709063", "0.756093", "0.7439553", "0.74073225", "0.73950726", "0.723264", "0.72222656", "0.72222656", "0.72222656", "0.72222656", "0.72222656", "0.72222656", "0.72197074", "0.72197074", "0.7208048", "0.7189662", "0.71663594", "0.7157283", "0.7155221", "0.7101109", "0.7025009", "0.70002115", "0.700003", "0.6973338", "0.69126904", "0.6901814", "0.6893042", "0.68274367", "0.6794165", "0.6786799", "0.67804873", "0.67804873", "0.67698663", "0.67698663", "0.67698663", "0.67299664", "0.6718081", "0.6708818", "0.66814774", "0.6679135", "0.6672064", "0.667043", "0.66568184", "0.66502416", "0.66492164", "0.66458917", "0.6637609", "0.66192424", "0.66166764", "0.6615068", "0.65948874", "0.6592923", "0.658781", "0.6573015", "0.65703887", "0.6558472", "0.6550131", "0.65365756", "0.65224594", "0.6510327", "0.65103114", "0.65089756", "0.64676744", "0.6466679", "0.64652485", "0.6463686", "0.64633507", "0.6462885", "0.6456678", "0.64544064", "0.64507234", "0.6448141", "0.64454114", "0.6442799", "0.6441376", "0.6427866", "0.64203805", "0.6418445", "0.6418445", "0.6415049", "0.64072615", "0.64009076", "0.6398466", "0.6391754", "0.6380495", "0.63784134", "0.6374123", "0.63714325" ]
0.0
-1
tell me the biggest renvoyer le plus grand entre 3 chiffres
def who_is_bigger(a, b, c) if (a == nil or b == nil or c == nil) return "nil detected" else if (a > b and a > c ) return "a is bigger" elsif (b > a and b > c ) return "b is bigger" else return "c is bigger" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player_w_biggest_feet\n all_players[1].max_by { |stats| stats[:shoe] }\n end", "def franchise_with_highest_profit\n company = get_company\n no_franchises(company)\n big_earner = company.franchises.max_by { |franchise| franchise.profit }\n puts \"Franchise #{big_earner.id} has the highest profit, having earned $#{big_earner.profit}.\"\n menu\n end", "def personal_top_three\n scores.max([scores.length, 3].min)\n end", "def renter_with_highest_rent\n units.map {|unit| unit.values[1]}\n end", "def largest(restaurant_menu)\n mas_caro = restaurant_menu.max_by{|k,v| v}\n puts \"El plato mas caro es el #{mas_caro[0]}\"\nend", "def big_shoe_rebounds_2\n\nhighest_rebounds = 0\nbiggest_shoe = 0\n\n\n game_hash.dig(:home, :players).each do |player_name, stats|\n stats.each do |stat, number|\n if stat == :shoe\n if number > biggest_shoe\n biggest_shoe = number\n stats.each do |stat, number|\n if stat == :rebounds\n highest_rebounds = number\n\n end\n end\n end\n end\n end\nend\n\n puts highest_rebounds\n return highest_rebounds\nend", "def most_steals(game)\nmax_steals = 0\nmax_steals_player = \"\"\ngame.each do |team, team_contents|\n team_contents[:roster].each do |player, player_contents| \n if player_contents[:steals] == max_steals\n max_steals_player = max_steals_player + \" and #{player_contents[:player_name]}\"\n elsif player_contents[:steals] > max_steals\n max_steals = player_contents[:steals]\n max_steals_player = player_contents[:player_name]\n end\n end\nend\nmax_steals_player\nend", "def most_points(game)\nmax_points = 0\nmax_points_player = \"\"\ngame.each do |team, team_contents|\n team_contents[:roster].each do |player, player_contents| \n if player_contents[:points] == max_points\n max_points_player = max_points_player + \" and #{player_contents[:player_name]}\"\n elsif player_contents[:points] > max_points\n max_points = player_contents[:points]\n max_points_player = player_contents[:player_name]\n end\n end\nend\nputs \"#{max_points_player} scored #{max_points}\"\nend", "def big_shoe_rebounds\n all_players = game_hash[:home][:players].merge(game_hash[:home][:players])\n big_object = all_players.max_by do |key,value|\n value[:shoe]\n end \n big_object[1][:rebounds]\nend", "def biggestShoes\n players.max_by do|name, stats|\n stats[:shoe]\n end\nend", "def player_with_most_steal\n most_steals = nil\n most_steal_player = nil\n\n all_players(game_hash).each do |player|\n if most_steals == nil || player[:steals] > most_steals\n most_steals = player[:steals]\n most_steal_player = player[:player_name]\n end\n end\n\n most_steal_player\nend", "def maximo()\n\t\tmaximo = 0;\n\t\t@hash_no_nulos.each do |key,valor|\n\t\t\tif (valor > maximo)\n\t\t\t\tmaximo = valor\n\t\t\tend\n end\n\t\treturn maximo\n\tend", "def largest_shoes(game)\nmax_shoes = 0\nrebounds = 0\nmax_shoes_player = \"\"\ngame.each do |team, team_contents|\n team_contents[:roster].each do |player, player_contents| \n if player_contents[:shoe_size] == max_shoes\n max_shoes_player = max_shoes_player + \" and #{player_contents[:player_name]}\"\n rebounds = player_contents[:rebounds]\n elsif player_contents[:shoe_size] > max_shoes\n max_shoes = player_contents[:shoe_size]\n max_shoes_player = player_contents[:player_name]\n rebounds = player_contents[:rebounds]\n end\n end\nend\nputs \"#{max_shoes_player} has size #{max_shoes} shoes and #{rebounds} rebounds\"\nend", "def best_tipper\n meal_with_highest_tip = meals.max do |meal_a, meal_b|\n meal_a.tip <=> meal_b.tip\n end\n\n meal_with_highest_tip.customer \n end", "def most_points_scored\nplayer_with_most(:points)\nend", "def big_shoe_rebounds\n max_shoe = 0 \n max_rebounds = 0 \n game_hash.each do |place, team|\n # team.each do |attribute, data|\n team[:players].each do |player|\n if player[:shoe] > max_shoe\n max_shoe = player[:shoe]\n max_rebounds = player[:rebounds]\n # if attribute == :players\n # data.each do |player|\n #this gives me the player hashes\n # data.max_by{|player| player[:shoe] }\n # data.max_by{|player| player[:shoe] }[:rebounds]\n # player.max_by{|player| player[:shoe] \n # player.max_by{|player| player[:shoe] }[:rebounds]\n end\n end\n end\n return max_rebounds\n end", "def personal_best\n personal_top_three.first\n end", "def max_of_three(term1, term2, term3)\n\n small = term2\n if term1 > small\n small = term1\n end\n \n if small < term3\n small = term3\n end\n return small\nend", "def most_points_scored\n max = nil\n name = nil \n game_hash.each do |team, team_values|\n team_values[:players].each do |player|\n if max == nil || player[:points] > max\n max = player[:points]\n name = player[:player_name]\n end\n end\n end\n name\nend", "def houseRobber(arr)\n \toldBest = 0\n \tnewBest = 0\n \tsteal = 0\n\n \tfor loot in arr\n \t\tsteal = loot + oldBest\n \t\toldBest = newBest\n \t\tnewBest = [steal,oldBest].max \n \tend\n \n return newBest\nend", "def rejeterHypothese()\n\t\t@grillesHypothese.pop\n\n\t\tif @grillesHypothese.empty?\n\t\t\treturn @grillePrim\n\t\telse\n\t\t\treturn @grillesHypothese.last\n\t\tend\n\tend", "def max3nb(nb1, nb2, nb3)\n if((nb1.is_a? Float) && (nb2.is_a? Float) && (nb3.is_a? Float))\n if(nb1 == nb2 && nb1 == nb3)\n puts \"Le maximum entre ces 3 nombres #{nb1}, #{nb2} et #{nb3} est #{nb3}.\"\n else if (nb1 <= nb2)\n if(nb2 <= nb3)\n puts \"Le maximum entre ces 3 nombres #{nb1}, #{nb2} et #{nb3} est #{nb3}.\"\n else puts \"Le maximum entre ces 3 nombres #{nb1}, #{nb2} et #{nb3} est #{nb2}.\"\n end\n else if(nb1 <= nb3)\n puts \"Le maximum entre ces 3 nombres #{nb1}, #{nb2} et #{nb3} est #{nb3}.\"\n else puts \"Le maximum entre ces 3 nombres #{nb1}, #{nb2} et #{nb3} est #{nb1}.\"\n end\n end\n end\n else puts \"Un ou des paramètres ne sont pas de type float.\"\n end\nend", "def jugada_max\r\n movimiento.max_by{|x| x.nivel} #Devuelve el objeto de enumeración que da el valor máximo\r\n end", "def big_shoe_rebounds\n game_hash.values.each do |attribute|\n hash = attribute[:players]\n hash.values.each do |h|\n h.select { |k, v| k == :shoe }.sort.max\n return h[:rebounds]\n end\n end\nend", "def player_with_most_of(statistic)\r\n player_name = \"\"\r\n amount_of_stat = 0\r\n\r\n game_hash.each do |team, stats|\r\n stats[:players].each do |players|\r\n if players[statistic].is_a? String\r\n if players[statistic].length > player_name.length\r\n player_name = players[:player_name]\r\n end\r\n elsif players[statistic] > amount_of_stat\r\n amount_of_stat = players[statistic]\r\n player_name = players[:player_name]\r\n end\r\n end\r\n end\r\n\r\n player_name\r\nend", "def max_of_three num1, num2, num3\n\tif num1 > num2 && num1 > num3\n\t\treturn num1\n\telsif num2 > num1 && num2 > num3\n\t\treturn num2\n\telsif num3 > num1 && num3 > num2\n\t\treturn num3\n\tend\n\nend", "def most_points_scored\n big_score_player = player_collection.reduce { |memo, next_player|\n memo[:points] > next_player[:points] ? memo : next_player; \n }\n big_score_player[:player_name];\nend", "def getNombreGrille\n @mesGrilles.size - 1\n end", "def player_with_most_of(statistic)\n player_name = nil\n amount_of_stat = 0\n\n game_hash.each do |team, game_data|\n game_data[:players].each do |player|\n if player[statistic].is_a? String\n if player[statistic].length > amount_of_stat\n amount_of_stat = player[statistic].length\n player_name = player[:player_name]\n end\n elsif player[statistic] > amount_of_stat\n amount_of_stat = player[statistic]\n player_name = player[:player_name]\n end\n end\n end\n\n player_name\nend", "def get_most_radlib_fillins_by_others(num_users = 5)\n get_most_generic_for_users(DOCS[:most_prolific], num_users)\n end", "def mostSteals\n players.max_by do|name, stats|\n stats[:steals]\n end\nend", "def maximum\n\t\tif 2 < course.users.length and 0 < worth\n\t\t\tmaximum = 0\n\t\t\t\n\t\t\tcourse.users.each do |user|\n\t\t\t\tgrade = self.user_grade(user)\n\t\t\t\t\n\t\t\t\tif grade and maximum < grade\n\t\t\t\t\tmaximum = grade\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn maximum\n\t\tend\n\tend", "def big_shoe_rebounds\n players[player_with_most(:shoe)][:rebounds]\nend", "def get_highest_for(turn)\n\t\tif @highs[1][turn] > @highs[2][turn] then 1 else 2 end\n\tend", "def big_shoe_rebounds\n\nhighest_rebounds = 0\nbiggest_shoe = 0\n\n game_hash.each do |location, team_info|\n game_hash.dig(location, :players).each do |player_name, stats|\n stats.each do |stat, number|\n if stat == :shoe\n if number > biggest_shoe\n biggest_shoe = number\n stats.each do |stat, number|\n if stat == :rebounds\n highest_rebounds = number\n end\n end\n end\n end\n end\n end\n end\n puts highest_rebounds\n return highest_rebounds\nend", "def most_points_scored\n stat_by_player = collect_stat_by_name(:points)\n player_with_max_stat = find_max_stat_by_player(stat_by_player)\n player_with_max_stat\nend", "def clever_octopus(fishes)\r\n biggest_fish = fishes.first\r\n \r\n fishes.each do |fish|\r\n if fish.length > biggest_fish.length\r\n biggest_fish = fish\r\n end\r\n end\r\n \r\n biggest_fish\r\n \r\n end", "def who_is_bigger(a,b,c)\n\ttab = [a,b,c]\n\tif tab.include?nil\n\t\t\"nil detected\"\n\n\telse \n\ttab.max \n\n\t\tif tab.max == a\n\t\t\t\"a is bigger\"\n\n\t\telsif tab.max == b\n\t\t\t\"b is bigger\"\n\n\t\telse \n\t\t\t\"c who_is_bigger bigger\"\n\t\tend\n\tend\n\t\nend", "def max_rob(houses)\n houses.each_with_index.reduce(0) do |robbed_money, (house_money, index)|\n next robbed_money if !index.zero? && index % 2 == 0\n\n robbed_money += house_money\n end\nend", "def biggest_bust(seasonasstring)\n #get all teams in data\n #find all games played by team in season - given by arg\n #get subset of 95 where p is in season marker\n #count games won in subset on 95 / total games in subset on 95\n #get subset of 85 where r is in season marker\n #count games won in subset on 98 / total games in subset on 98\n #result of line 97 - line 99\n #find highest number\n #return team name of result of line 101\n end", "def big_shoe_rebounds\nans = 0\nshoe_arr = []\nbig = 0\n\n game_hash.collect do |where, stats| \n \n game_hash[where][:players].collect do |p_name,p_stats|\n p_stats.collect do |stat_name,info|\n puts \n if stat_name == :shoe\n shoe_arr << info\n # puts shoe_arr.max_by{|x| x}\n big = shoe_arr.sort.last\n \n if game_hash[where][:players][p_name][:shoe] == big\n \n ans = game_hash[where][:players][p_name][:rebounds]\n\n end\n end\n end\n end\n end\nans \nend", "def best_cruise_column_for_query(query, col_multiplier={})\n cur_max = 0\n best_column = nil\n for column in @@cruise_columns\n next if column == 'id'\n ncruises = Cruise.count(:all, :conditions => [\"`#{column}` regexp ?\", query])\n multiplier = col_multiplier[column] || 1\n if ncruises * multiplier > cur_max\n cur_max = ncruises\n best_column = column\n end\n end\n contacts = Contact.find(:all, :conditions => [\"LastName LIKE ?\", query])\n for contact in contacts\n count = contact.cruises.length\n if count > cur_max\n cur_max = count\n best_column = 'Chief_Scientist'\n end\n end\n\n best_column || 'Group'\n end", "def max_of_three(num1,num2,num3)\n return num1 if num1 > num2 && num1 > num3\n return num2 if num2 > num1 && num1 > num3 \n return num3\nend", "def clever_octopus(fishes)\n largest = fishes.first\n\n fishes.each { |fish| largest = fish if largest.length < fish.length }\n\n largest\nend", "def min_of_three(num1, num2, num3)\n \n biggest = 0\n if num1 < num2 \n biggest = num2\n else \n biggest = num1\n end\n\n if biggest < num3\n return num3\n else \n return biggest\n end\nend", "def player_with_most(stat)\n value = nil\n owner = nil\n players.each do |player, stats|\n if value == nil || stats[stat] > value\n value = stats[stat]\n owner = player\n end\n end\n owner\nend", "def max_of_three(n1, n2, n3)\n largest = n1\n if n1 < n2\n largest = n2\n end\n if largest < n3\n largest = n3\n end\n return largest\nend", "def find_largest_company companies\n companies.reduce() do |largest_company, company|\n company.size > largest_company.size ? company : largest_company\n end\nend", "def most_rooms\n has_info = 0\n has_info = $postings.select{|p| p.to_s.downcase[/\\d+(?=bedroom|br)/]}\n max_post = has_info.max{|a,b| a.to_s.downcase[/\\d+(?=bedroom|br)/].to_i <=> b.to_s.downcase[/\\d+(?=bedroom|br)/].to_i}\n max_room = max_post.to_s.downcase[/\\d+(?=bedroom|br)/].to_i\n max_room_ads = has_info.select{|p| p.to_s.downcase[/\\d+(?=bedroom|br)/].to_i == max_room}\n list_apt(max_room_ads)\nend", "def max_of_three(num1, num2, num3)\n return num1 if num1 > num2 && num1 > num3\n return num2 if num2 > num3 && num2 > num1\n return num3\nend", "def best_tipper\n best_tipped_meal = meals.max do |meal_a, meal_b|\n meal_a.tip <=> meal_b.tip\n end \n best_tipped_meal.customer\n end", "def max_of_three(num1,num2,num3)\n if max_of_two(num1,num2) <= num3\n return num3\n end\n return max_of_two(num1,num2)\nend", "def max\n\t\tm = self.valor[0]\n\t\tfor i in (0...self.valor.size.to_i)\n\t\t\t\tif (self.valor[i]> m)\n\t\t\t\t\tm = self.valor[i]\n\t\t\t\tend\n\t\tend\n\t\treturn m\n\tend", "def problem_three\n find_factors(600_851_475_143).max\n end", "def max(num1,num2,num3)\n if num1>num2 and num1>num3\n return num1\n elsif num2>num1 and num2>num3\n return num2\n elsif num3>num1 and num3>num2\n return num3\n end\nend", "def largest companies \n size = 0\n biggest = companies.each do |company|\n if company.size > size \n size = company.size\n end \n end \nend", "def max_of_three num1, num2,num3\n if num1>num2 && num1> num3\n num1\n elsif num2>num1 && num2>num3\n num2\n end\n num3\nend", "def biggest_suprise(seasonasstring)\n #as above, but change line 100 to reverse operations, regular percentage - postseason percentage\n end", "def porcentaje_glucidos\n auxNodo1 = @lista_alimentos.head\n auxNodo2 = @gramos.head\n porcentaje_gluc = 0\n while(auxNodo1 != nil && auxNodo2 != nil)\n porcentaje_gluc += (auxNodo1.value.glucidos * auxNodo2.value) / 100\n auxNodo1 = auxNodo1.next\n auxNodo2 = auxNodo2.next\n end\n return porcentaje_gluc.round(1)\n end", "def biggest_shoe\r\n player_name= []\r\n game_hash.each do |team, data|\r\n data.each do |team_info, value|\r\n if team_info == \"players\".to_sym\r\n obj=value.max_by {|key, value| value[:shoe]}\r\n player_name<< obj.first\r\n end\r\n end\r\n end\r\n player_name.first\r\nend", "def maxValue(fred)\n\tputs fred.sort.last\nend", "def getMostAwesomePerson\n return @persons.max\n end", "def highest_fitness(sample_group)\n best_fitness = 0\n best_person = nil\n sample_group.each do |person|\n if person.get_energy_level > best_fitness\n best_person = person\n best_fitness = person.get_energy_level\n end\n end\n best_person\n end", "def long_name_steals_a_ton?\n\t # returns true if the player with the longest name had the most steals\n\tlongest_name_length = 0\n\tlongest_name_name = []\n\tmost_steals = 0\n\tmost_steals_name = []\n\tmy_array = []\n\ttrue_flag = nil\n\n\n\tgame_hash.each do |h_or_a, team_infos|\n\t\tteam_infos.collect do |info_type, stats|\n\t\t\tif (info_type == :players)\n\t\t\t\tstats.each do |stat, stat_value|\n\t\t\t\t\tif game_hash[h_or_a][:players][stat][:steals] > most_steals\n\t\t\t\t\t\tmost_steals = game_hash[h_or_a][:players][stat][:steals]\n\t\t\t\t\t\t#most_steals_name = game_hash[h_or_a][:players].keys \t#> [:\"Alan Anderson\", :\"Reggie Evans\", :\"Brook Lopez\", :\"Mason Plumlee\", :\"Jason Terry\"]\n\t\t\t\t\t\tmost_steals_name << stat\n\t\t\t\t\t\tputs(\"Most steals name : #{most_steals_name}\")\n\t\t\t\t\tend\t\t\t\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\n\n\n\n\tgame_hash.each do |h_or_a, team_infos|\n\t\tteam_infos.collect do |info_type, stats|\n\t\t\tif (info_type == :players)\n\t\t\t\tstats.each do |stat, stat_value|\n\t\t\t\t\t most_steals = game_hash[h_or_a][:players][stat][:steals].max_by {|stat2, statval2 | stat2.to_s.to_f <=> statval2 }\n\n\t\t\t\t\t\t#most_steals = game_hash[h_or_a][:players][stat][:steals]\n\t\t\t\t\t\t#most_steals_name = game_hash[h_or_a][:players].keys \t#> [:\"Alan Anderson\", :\"Reggie Evans\", :\"Brook Lopez\", :\"Mason Plumlee\", :\"Jason Terry\"]\n\t\t\t\t\t\tmost_steals_name << stat\n\t\t\t\t\t\tputs(\"Most steals V2** name : #{most_steals_name}\")\n\t\t\t\t\t#end\t\t\t\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\n\n\n\n\n\n\n\n\n\n\n\tgame_hash[:home][:players].each do |k, v|\n\t\t#puts (\"v.flatten is -- #{k.to_s}\")\n\t\tmy_array << k.to_s \t\t\t#v.flatten \n\tend\n\tgame_hash[:away][:players].each do |k, v|\n\t\tmy_array << k.to_s\n\tend\n\n\tputs (\"my_array is : #{my_array}\")\n\n\n\tmy_array.each do |name|\n\t\tputs(\"Name.length is #{name.length}, name is- #{name}\")\t\t\n\t\tif name.length > longest_name_length\n\t\t\tlongest_name_length = name.length\n\t\t\tlongest_name_name << name\n\t\tend\n\tend\n\n\n\t#### NEED TO DO SORT BY LENGTH, THEN CALC LENGTH OF EACH, RETURN ALL MAX TIES TO NEW ARRAY\n\tlongest_name_name = my_array.max(2) { |name, b| name.length <=> b.length}\n\tlongest_name_length = longest_name_name.length\n\n\tprint \"Longest Name Length Is : \"\n\tputs longest_name_length\n\n\tprint \"Final Longest Name Is : \"\n\tputs longest_name_name\n\n\tprint \" Most Steals Is : \"\n\tputs most_steals_name\n\n\tlongest_name_name.each do |name|\n\t\tif most_steals_name.include?(name)\n\t\t\ttrue_flag = true\n\n\t\tend\n\tend\n\tputs true_flag\n\treturn true_flag\nend", "def third_greatest(nums)\n\t\n\tnums.sort!\n\treturn nums[-3]\nend", "def best_fans\n @teams.max_by { |team| team.home_minus_away_percentage }.team_name\n end", "def most_points_scored\n most_points = 0\n leading_scorer = \"\"\n\n game_hash.values.each do |roster|\n roster[:players].each do |player|\n if player[:points] > most_points\n most_points = player[:points]\n leading_scorer = player[:player_name]\n end\n end\n end\n return leading_scorer\nend", "def eqp_r_max(item)\n end", "def max_of_three(num1, num2, num3)\n output = 0\n if num1 > num2 and num1 > num3\n output = num1\n elsif num2 > num3 and num2 > num1\n output = num2\n else\n output = num3\n end\n return output\nend", "def max_of_three(max,num2, num3)\n if max < num2\n max = num2\n end\n if max < num3\n max = num3\n end\n return max\nend", "def highest_scoring_visitor\n @teams.max_by { |team| team.average_away_goals }.team_name\n end", "def highest_possibility_price( possibilities )\n highest_price_index = 0\n highest_total = Money.new(0)\n\n initial = Money.new(0)\n possibilities.each_with_index do |possibility, index|\n\n total = possibility.inject(initial) { |sum, n| sum + n.price }\n if total > highest_total\n highest_total = total\n highest_price_index = index\n end\n\n end\n return highest_total, possibilities[ highest_price_index ]\n end", "def most_points_scored\n\tpoints_array = []\n\tgame_hash.each do |location, team_data|\n\t\tteam_data[:players].each do |attribute, data|\t\n\t\t\tdata.each do |type, amount|\n\t\t\t\tif type == :points\n\t\t\t\t\tpoints_array << amount\n\t\t\t\tend \n\t\t\tend\n\t\tend\n\tend\n\tgame_hash.each do |l, data|\n\t\tdata[:players].each do |a, d|\n\t\t\td.each do |t, amt|\n\t\t\t\tif t == :points && points_array.max == amt\n\t\t\t\t\treturn a\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend", "def clever_octopus(fishes)\n biggest_fish = fishes.first\n\n fishes.each do |fish|\n\n if fish.length > biggest_fish.length\n biggest_fish = fish\n end\n end\n\n biggest_fish\nend", "def most_popular\n\n # Recipecard.all.select {|rc| rc.recipe ==self}\n # most_popular.map {|rc| rc.users}\n recipe_hash = {}\n RecipeCard.all.each do |recipecard|\n if recipe_hash[recipecard.name]==nil\n recipe_hash[recipecard.name]=1\n else\n recipe_hash[recipecard.name]+= 1\n end\n end\n recipe_hash.max_by{|k,v| v}[0]\n end", "def best_tipper\n best_tipped_meal = meals.max do | meal_a, meal_b |\n meal_a.tip <=> meal_b.tip\n end\n best_tipped_meal.customer\n end", "def most_rebound(player_name)\r\n game_hash.each do |team, data|\r\n data.each do |team_info, value|\r\n if team_info == \"players\".to_sym\r\n value.each do |player, detail|\r\n if player == player_name\r\n return detail[:rebounds]\r\n end\r\n end\r\n end\r\n end\r\n end\r\nend", "def maximum\n\t\tif course.users.length > 2 and worth > 0\n\t\t\treturn (grades.maximum(:grade).to_f / worth) * 100\n\t\tend\n\tend", "def third_greatest(arr)\n third_longest = arr.max_by(3, &:size).last\n arr.select { |word| word.size == third_longest.size }.last\nend", "def analyze_most_prolific(user)\n\n # calculate score\n prolific_score = 1\n prolific_score *= (val = user.num_radlibs_created) > 0 ? val : 1 # loads value from db *once*, then compares, and uses 1 instead of 0\n prolific_score *= (val = user.num_radlibs_filled_by_me) > 0 ? val : 1\n prolific_score *= (val = user.num_comments_made) > 0 ? val : 1\n\n # scale it down to avoid too big a number, using 10000.1 (with decimal ensures that we extend the value's significant digits)\n prolific_score /= 100.1\n\n analyze_most_generic(user.uid, prolific_score.to_f, DOCS[:most_prolific])\n self\n end", "def item_max() @item_max end", "def most_points_scored\n points = 0\n result = \"\"\n game_hash.each do |team, about|\n about[:players].each do |name , stats|\n if points < stats[:points]\n points = stats[:points]\n result = name\n end\n end\n end\n result\nend", "def winningest_team\n @teams.max_by { |team| team.total_win_percentage }.team_name\n end", "def top_three_recipes\n recipe_cards.max_by(3) {|recipe_cards| recipe_cards.rating}\n end", "def get_most_radlibs_created(num_users = 5)\n get_most_generic_for_users(DOCS[:most_prolific], num_users)\n end", "def most_steals\r\n result={}\r\n game_hash.each do |k, v|\r\n v.each do| p, d|\r\n if p==:players\r\n d.each do |t, s|\r\n result[t]=s[:steals]\r\n end\r\n end\r\n end\r\n end \r\n result.max_by {|name, steal| steal}[0]\r\nend", "def minimumBribes(q)\n bribe_count = 0\n # q.each_with_index do |person,i|\n i = q.size-1\n while i >= 0 do\n person = q[i]\n position = i+1\n offset = person - position\n\n if offset > 2\n puts \"Too chaotic\"\n return\n else\n j=[0,person-2].max\n while j < i do\n if q[j] > person\n bribe_count += 1\n else\n # break if j+1 == person\n end\n j+=1\n end\n end\n i-=1\n end\n puts bribe_count\nend", "def mostPoints\n players.max_by do|name, stats|\n stats[:points]\n end\nend", "def best_euros p\n euros(p)\n end", "def most_expensive_player_on_team \n\n the_club = choose_club #user chooses club they want to see most expensive player for\n my_club = Club.find_by(name: the_club) #use class instance find_by to find the instance of club with the name provided by user (the_club)\n club_players = my_club.players.sort_by do |player| #loops through instance of club and sorts the players by their market value (remember to change market_value from string to integer)\n player.market_value.to_i\n end\n\n most_expensive_player = club_players.last #in ascending order the last item of the sorted array is the player with the highest market value\n puts \"#{the_club}'s most expensive player is #{most_expensive_player.name}. He is worth £#{most_expensive_player.market_value}M\"\n #the_club --> user choice of club name\n #most_expensive_player.name --> use the_club name to find the specific instance of Club class. \n #Use \".players\" method to find all player instances of that specifc club (the instances of players that \n #belong to that instance of club). Use \".name\" method to retrieve attribute \"name\" of player instance. \n #Use \".market_value\" to retrieve attribute \"market_value\" of the player instance. \n\nend", "def highest_player_score\n players.max_by{|player| player.score}.score\n end", "def youngest_person_retirement_age\n self.persons.min_by { |p| p[:age] }[:retirement_age]\n end", "def les_50_handles_les_plus_courts(journaliste)\n\tputs \" les 50 handles les plus courts sont: #{journaliste.sort_by(&:length)[0...50]}\"\n \tputs \" \"\nend", "def max_of_three(num1, num2, num3)\n largest = 0\n if num1 > num2\n largest = num1\n else \n largest = num2\n end\n\n if num3 > largest\n return num3\n else\n return largest\n end\nend", "def largest_company(companies)\n values = companies.map do |company|\n company.size\n end\n max = values.max\n companies.find do |company|\n if max == company.size\n return company.name\n end\n end\nend", "def ThirdGreatest(strArr)\n size = strArr.sort_by(&:length)[-3].length\n strArr.group_by(&:size)[size].last \nend", "def item_max\n $game_party.members.size\n end", "def item_max\n $game_party.members.size\n end", "def max_buy\n max = $game_party.max_item_number(@item) - $game_party.item_number(@item) \n max_crafts = HudellBazaar::get_max_crafts(@item)\n max = [max, max_crafts].min\n\n buying_price == 0 ? max : [max, money / buying_price].min\n end", "def output_driver_with_most_money(earned_per_each_driver)\n max_earned = earned_per_each_driver.max_by do |current_driver|\n current_driver[:driver_earned]\n end\n\n puts \"\\nDriver #{max_earned[:driver_id]} earned the most money $#{max_earned[:driver_earned]}.\"\nend", "def best_tipper\n best_tipped_meal = meals.max do |meal_a, meal_b|\n meal_a.tip <=> meal_b.tip\n end\n\n best_tipped_meal.customer\n end" ]
[ "0.64992267", "0.64488393", "0.6439659", "0.6297523", "0.6264678", "0.6111586", "0.6091082", "0.6048619", "0.6039138", "0.6015173", "0.60057515", "0.6004748", "0.5990877", "0.59683", "0.5959214", "0.595757", "0.5947033", "0.59277046", "0.59276193", "0.5884559", "0.58829105", "0.5882841", "0.5877614", "0.58774805", "0.58687735", "0.5868593", "0.586197", "0.5854189", "0.58532643", "0.58454245", "0.58449155", "0.5839895", "0.58316946", "0.58312684", "0.5825511", "0.5823407", "0.5813909", "0.5804107", "0.57867724", "0.5786499", "0.5780836", "0.57773465", "0.57733315", "0.5771941", "0.5771211", "0.5767023", "0.5763653", "0.5746476", "0.57416344", "0.57401365", "0.5735721", "0.57270706", "0.5724586", "0.57226443", "0.57209873", "0.57123816", "0.5711985", "0.5704905", "0.57047856", "0.56958544", "0.5689997", "0.56815004", "0.5678143", "0.5670464", "0.5669872", "0.5668672", "0.56643987", "0.5662896", "0.56617266", "0.565829", "0.56560457", "0.56554884", "0.5655072", "0.56448436", "0.56429344", "0.5638539", "0.5632338", "0.5630596", "0.56300086", "0.5628185", "0.5626893", "0.5626559", "0.5621012", "0.56206745", "0.5620086", "0.5616965", "0.5611801", "0.5610789", "0.56066364", "0.56062466", "0.5604379", "0.55957973", "0.5595374", "0.5593656", "0.55926377", "0.55917054", "0.5584036", "0.5584036", "0.55819434", "0.5578938", "0.5572682" ]
0.0
-1
does crazy things on strings :Reverse, upcase then removes all L, T and A.
def reverse_upcase_noLTA(p1) p1.reverse.upcase.delete "LTA" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_upcase_noLTA(string)\n string = string.downcase\n string = string.delete \"a\"\n string = string.delete \"l\"\n string = string.delete \"t\"\n string = string.upcase\n string = string.reverse\n return string\nend", "def reverse_upcase_noLTA(string)\n\tstring.reverse.upcase.tr('A','').tr('L', '').tr('T','')\nend", "def reverse_upcase_noLTA(string)\n\treturn string.reverse.upcase.delete!'AaTtLl'\nend", "def reverse_upcase_noLTA(s1)\n\n\n\ts1 = s1.upcase.reverse\n\ts1 = s1.tr('T', '')\n\ts1 = s1.tr('A', '')\n\ts1 = s1.tr('L', '') \n\n\treturn s1\n\nend", "def reverse_upcase_noLTA(str)\n str.upcase.reverse.delete\"LTA\"\nend", "def reverse_upcase_noLTA(string)\n nouveaustring = string.reverse.upcase.tr(\"LTA\", \"\")\n p nouveaustring\nend", "def reverse_upcase_noLTA(a)\n a = a.reverse.upcase.gsub /[LTA]/, \"\"\n return a\nend", "def reverse_upcase_noLTA(str)\n new_str = str.upcase.reverse.delete('TLA')\n \n new_str\nend", "def reverse_upcase_noLTA(phrase)\n\tcapital = phrase.upcase\n\treverse = capital.reverse\n\treturn reverse.delete \"T\" + \"A\" + \"L\"\t\nend", "def rearranger(str)\nstr = str.split(' ')\nfinal = str.reverse.join(' ')\nfinal = final.downcase\nend", "def downcase!() end", "def downcase() end", "def do_magic(str)\n str.gsub!(/[^A-Z]/, '').to_s #delete small leters and uprinted sumbols\n str.downcase.to_s #make all leters small\nend", "def reverse_letter(string)\n #your code here\n string.gsub(/[^A-Za-z]/, '').reverse\nend", "def downcase; end", "def normalize(str) return str.upcase end", "def StringSwapForUs str\n swap_str = []\n str.split(\"\").each do |val|\n if val == val.upcase\n swap_str << val.downcase\n elsif val == val.downcase\n swap_str << val.upcase\n end\n end\n\n swap_str.join(\"\")\nend", "def downcase(input); end", "def destructive_uppercase(str)\n str.each_char {|x| str.delete!(x) if x == x.downcase}\n str\nend", "def reverse_words_refactor(string)\n jumbled_letters = string.split(\" \").each {|word| word.reverse!}.join(\" \")\nend", "def upcase!() end", "def simple_string\n old_string = \"Ruby is cool\"\n new_string = old_string.reverse.upcase\n puts new_string\nend", "def change_me(string)\n result = []\n words = string.split\n iterator = 0\n loop do\n break if iterator == words.size\n word = words[iterator]\n if word.reverse == word\n result << word.upcase\n else\n result << word\n end\n iterator += 1\n end\n result.join(' ')\nend", "def destructive_uppercase(str)\n upcase_only = \"\"\n str.each_char do |char|\n upcase_only += char unless char.downcase == char\n end\n upcase_only\nend", "def letter_reverse(sentence)\n # sentence.split(\" \").map(&:reverse).join(\" \")\n # sentence.gsub(/\\w+/) { |word| word.reverse }\n sentence.gsub(/\\w+/, &:reverse)\nend", "def destructive_uppercase(str)\n new_string = str.chars.select {|el| el == el.upcase}\n new_string.join(\"\")\nend", "def downer2(string)\n string.downcase!\nend", "def destructive_uppercase(str)\r\n # your code goes here\r\n temp = \"\"\r\n i = 0\r\n while i < str.length\r\n if str[i].upcase.include?(str[i]) == false\r\n temp << str[i]\r\n end\r\n i += 1\r\n end\r\n temp\r\nend", "def destructive_uppercase(str)\n result = \"\"\n (0...str.length).each do |idx|\n result << str[idx] if str[idx] != str[idx].downcase\n end\n result\nend", "def upcase() end", "def reverse_only_letters(s)\n i = 0\n j = s.length - 1\n while i < j\n if !s[i].match(/[[:alpha:]]/)\n i += 1\n elsif !s[j].match(/[[:alpha:]]/)\n j -= 1\n else\n s[i], s[j] = s[j], s[i]\n i += 1\n j -= 1\n end\n end\n return s\nend", "def destructive_uppercase(str)\n str.each_char do |c|\n str.delete!(c) if c == c.downcase\n end\nend", "def LetterChanges(str)\r\n str = str.split(\"\")\r\n str.each do |x|\r\n x.next! if x =~ /[a-z]/\r\n x.upcase! if x =~ /[aeiou]/\r\n end\r\n return str.join(\"\")\r\nend", "def weirdcase(str)\n new_str = \"\"\n str.chars.each_with_index do |c, i|\n if i%2==0 #reverse because odd characters have even indices\n new_str += c.downcase\n else\n new_str += c.upcase\n end\n end\n return new_str\nend", "def destructive_uppercase(str)\n output_str = ''\n\n str.each_char do |char|\n if char.upcase == char\n output_str += char\n end\n end\n output_str\nend", "def swapcase(str)\n str.chars.map do |el|\n if el =~ /[a-z]/\n el.upcase\n elsif el =~ /[A-Z]/\n el.downcase\n else\n el\n end\n end.join\nend", "def destructive_uppercase(str)\n str.delete(\"abcdefghijklmnopqrstuvwxyz\")\nend", "def reverse_words(string)\n string.gsub(/\\w+/) { |word| word.reverse! } \n end", "def destructive_uppercase(str)\n\t(str.split(\"\").select { |c| (\"a\"..\"z\").include?(c) == false } ).join\nend", "def shout(str); str.upcase end", "def destructive_uppercase(str)\n str.each_char do |chr|\n if chr == chr.downcase\n str.delete!(chr)\n end\n end\nend", "def sanitize(string)\n downcase_string = string.chars.sort.join.downcase\n result = string_to_characters(downcase_string) #returns a sanitized string\nend", "def destructive_uppercase(str)\n my_str = \"\"\n str.chars{|ch| my_str += ch if ch.upcase == ch}\n my_str\nend", "def letterReverse (str)\n str.split('').reverse.join('')\nend", "def palindrome(str)\n sanitized = str.scan(/[a-zA-Z0-9]/).map!(&:downcase)\n sanitized == sanitized.reverse\nend", "def cleanup(string)\n switch = 0\n clean_string = []\n string\n .downcase\n .chars\n .map do |char|\n case ('a'..'z').cover?(char)\n when true\n clean_string << char\n switch = 0\n when false\n next if switch == 1\n clean_string << ' '\n switch = 1\n end\n end\n clean_string.join\nend", "def letter_reverse (str)\n str.split(' ').map { |each| each.reverse }.join(' ')\nend", "def LetterChanges(str)\n\n str=str.tr('a-y','b-z')\n str=str.tr('aeiou','AEIOU')\n return str \n \nend", "def upcase; end", "def LetterChanges(str)\n str = str.split(\"\")\n \n str.each do |c|\n c.next! if c =~ /[a-z]/\n c.upcase! if c =~ /[aeiou]/\n end\n \n return str.join\nend", "def remove_capital_letters_from_string(string)\n string.gsub(/[A-Z]/,\"\") \nend", "def weirdcase(str)\n is_upcase = false\n new_str = ''\n str.chars.each do |ch|\n if is_upcase\n new_str += ch.upcase\n else\n new_str += ch.downcase\n end\n is_upcase = !is_upcase\n end\n new_str\nend", "def swapcase(str)\n uppercase = (\"A\"..\"Z\").to_a\n lowercase = (\"a\"..\"z\").to_a\n letters = uppercase + lowercase\n \n str.chars.map do |el|\n if !letters.include?(el)\n el\n elsif uppercase.include?(el)\n el.downcase\n else\n el.upcase\n end\n end.join\nend", "def cleanup(str)\n str.gsub(/[^a-z]/i, '')\nend", "def weirdcase(str)\n (0...str.length).each do |idx|\n if idx % 2 == 0\n str[idx] = str[idx].downcase\n else\n str[idx] = str[idx].upcase\n end\n end\n str\nend", "def swapcase(string)\n string.chars.map do |char|\n if char.match(/[a-z]/)\n char.upcase\n else\n char.downcase\n end\n end.join(\"\")\nend", "def swapcase(str)\ncharacters = str.chars.map do |char|\n\tif char =~ /[a-z]/\n\t\tchar.upcase\n\telsif char =~ /[A-Z]/\n\t\tchar.downcase\n\telse\n\t\tchar\n\tend\nend\ncharacters.join\nend", "def weirdcase(str)\n for i in 0..str.length-1\n if i % 2 != 0\n str[i] = str[i].upcase\n else\n str[i] = str[i].downcase\n end\n end\n str\nend", "def destructive_uppercase(str)\n letters = (\"a\"..\"z\").to_a\n our_str = str.chars\n x = our_str.select {|x| !letters.include?(x)}\n x.join\nend", "def swapcase(str)\n str.chars.map { |chr| (/[a-z]/.match(chr))? chr.upcase : chr.downcase }.join('')\nend", "def vowel string\n # string = string.split(\"\")\n # string = string.downcase\n string = string.delete 'AaEeIiOoUu'\n # string = string.capitalize\n\nend", "def upcase(input); end", "def swapcase(str)\n result_str = ''\n str.each_char do |char|\n if char.count('a-z') > 0\n result_str += char.upcase\n else\n result_str += char.downcase\n end\n end\n result_str\nend", "def cleanup(str)\n str.chars.map { |char| ('a'..'z').include?(char.downcase) ? char : ' ' }.join.squeeze(' ')\nend", "def remove_capital_letters_from_string(string)\n string.gsub(/[A-Z]/, \"\")\nend", "def swapcase(str)\n str.chars.map do |el|\n if el == el.upcase\n el.downcase\n elsif el == el.downcase\n el.upcase\n else\n el\n end\n end.join\nend", "def snakify\n return downcase if match(/\\A[A-Z]+\\z/)\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z])([A-Z])/, '\\1_\\2').\n downcase\n end", "def letterReverse(string)\n p string.reverse.split(/\\W+/).reverse.join(',')\nend", "def swapcase_bk(str)\n str.gsub(/([a-z]|[A-Z])/) { |letter| letter =~ /[a-z]/ ? letter.upcase : letter.downcase}\n\nend", "def letter_reverse(str)\n p str.reverse.split(' ').reverse.join(' ')\nend", "def swapcase(string)\n characters = string.split('').map do |char|\n if char =~ /[A-Z]/\n char.downcase\n elsif char =~ /[a-z]/\n char.upcase\n else\n char\n end\n end\n characters.join\n\n # new_string = ''\n # string.each_char do |char|\n # if UPPERCASE.include?(char)\n # new_string += char.downcase\n # else\n # new_string += char.upcase\n # end\n # end\n # p new_string\nend", "def palindrome?(string)\n string = string.gsub(/[^a-z]/i, '')\n string.downcase == string.downcase.reverse\nend", "def swapcase(string)\n string.split('').map do |char|\n if char =~ /[a-z]/\n char.upcase!\n elsif char =~ /[A-Z]/\n char.downcase!\n else\n char\n end\n end.join('')\nend", "def name_reverser(string)\r\n name_array = string.split(' ').reverse\r\n modified_name = name_array.join(' ')\r\nend", "def real_palindrome?(string)\n # clean_string = string.downcase.delete(\"^a-z0-9\")\n clean_string = string.downcase.gsub(/[^a-z0-9]/, '')\n puts clean_string\n clean_string == clean_string.reverse\nend", "def your_name_reversed(x)\r\n x.to_str\r\n x.downcase! # Ensure all down-case for easier future coding\r\n x = x.split(' ')\r\n return x.reverse # Returns the swapped last and first name\r\nend", "def remove_capital_letters_from_string(string)\n string.gsub!(/[A-Z]/,'')\nend", "def palindrome string #func param: string, name: palindrome\n string = string.downcase.scan(/\\w/) #make sure the value is lower case\n string == string.reverse #see if it equals its reverse, and return as boolean statement \nend", "def reverse_words(string)\n string.gsub(/\\w+/) { |match| match.reverse }\nend", "def letterReverse(aString)\n return aString.reverse!.split.reverse.join(\" \")\nend", "def swapcase(str)\n new_str =\n str.chars.map do |element|\n if element =~ /[a-z]/\n element.upcase\n elsif element =~ /[A-Z]/\n element.downcase\n else\n element\n end\n end\n new_str.join\nend", "def weirdcase(str)\n arr = str.split('')\n arr.each_index do |i|\n (i % 2).zero? ? arr[i].downcase! : arr[i].upcase!\n end.join\nend", "def palindrome?(str)\n str = str.gsub /[^0-9A-Za-z]/, ''\n return str.reverse.upcase == str.upcase\nend", "def real_palindrome?(string)\n arr = []\n string.chars.each do |char| arr << char if ('a'..'z').include?(char) || ('A'..'Z').include?(char)\n end\n clean_str = arr.join\n clean_str.downcase == clean_str.downcase.reverse\nend", "def swapcase(string)\n string.chars.map { |char| char.upcase == char ? char.downcase : char.upcase }\n .join\nend", "def destructive_uppercase(str)\n result = \"\"\n str.each_char {|ch| result << ch if ch < \"a\"}\n result\nend", "def normalize(str) \n str.gsub(/\\W/, '').upcase #.gsub(/\\s(\\d+)\\s/, '')\n end", "def swapcase(string)\n string.chars.map do |char|\n case char\n when /[a-z]/\n char.upcase\n when /[A-Z]/\n char.downcase\n else\n char\n end\n end.join\nend", "def reverse(s)\nend", "def swapcase() end", "def compare_and_remove_chars(string)\n index_array = []\n char_array = string.split(\"\")\n index = 0\n until index >= string.length\n char = char_array[index]\n next_char = char_array[index + 1]\n # can't just make case equal and compare chars like this\n # next_char_match = next_char.upcase == char.downcase\n # match is if the cases are opposite so `aA` is a match\n next_char_match =\n next_char == (char.match?(/[[:lower:]]/) ? char.upcase : char.downcase)\n if next_char_match\n index_array << index\n index_array << index + 1\n index += 2\n else\n index += 1\n end\n end\n index_array.reverse_each { |i| char_array.delete_at(i) }\n new_string = char_array.join\n if new_string.length == string.length\n new_string\n else\n compare_and_remove_chars(new_string)\n end\nend", "def swapcase(string)\n arr = string.chars.map do |char|\n if char.match(/[A-Z]/)\n char.downcase \n elsif char.match(/[a-z]/)\n char.upcase\n else \n char\n end \n end \n arr.join\nend", "def downer(string)\n string.downcase\nend", "def swapcase(string)\n string.chars.map { |c| c.upcase == c ? c.downcase : c.upcase }.join\nend", "def swapcase!() end", "def acronomyzer(sentence)\n words = sentence.split\n letters = []\n\n words.each do |word|\n letter = word[0]\n letters << letter\n end\n\n letters.join.upcase\nend", "def palindrome?(str)\n # YOUR CODE HERE\n str.gsub(/([^a-z])/i, \"\").downcase == str.gsub(/([^a-z])/i, \"\").downcase.reverse\nend", "def swapcase(str)\n str.chars.map { |c| c == c.upcase ? c.downcase : c.upcase }.join\nend", "def upcase(s)\n s.upcase!\n true\nend", "def solution(str)\n str.gsub(/([A-Z])/, ' \\1')\nend" ]
[ "0.822985", "0.8116307", "0.8110973", "0.8029478", "0.80043536", "0.79709655", "0.77776587", "0.76370937", "0.76366425", "0.74138504", "0.7260429", "0.7232456", "0.7211708", "0.71999097", "0.7154291", "0.71219426", "0.71135026", "0.70961386", "0.70859414", "0.70524883", "0.70405835", "0.696223", "0.6959569", "0.695796", "0.69505847", "0.6942187", "0.6939542", "0.69252014", "0.6924422", "0.69112325", "0.690602", "0.6905999", "0.689556", "0.6868467", "0.68490547", "0.6843982", "0.6833852", "0.682876", "0.68223387", "0.68147373", "0.6814032", "0.6788506", "0.6780949", "0.6767062", "0.6752811", "0.67501235", "0.6732655", "0.67135644", "0.6713554", "0.6710205", "0.67097247", "0.67015976", "0.67001003", "0.6692773", "0.668776", "0.66867673", "0.6686219", "0.6685183", "0.6682557", "0.6682252", "0.66800356", "0.6673932", "0.66703355", "0.66589695", "0.6639454", "0.66389316", "0.66339266", "0.6624567", "0.66245484", "0.6621509", "0.66209835", "0.6619988", "0.6619906", "0.6611919", "0.660967", "0.66096526", "0.6609146", "0.65964913", "0.6592472", "0.658939", "0.6582894", "0.6581481", "0.6577773", "0.6577032", "0.6564484", "0.6564225", "0.65637743", "0.6554191", "0.65424496", "0.65392315", "0.653848", "0.65359294", "0.6534411", "0.6533053", "0.65322083", "0.6531535", "0.6527262", "0.65252674", "0.6520825", "0.6519002" ]
0.7668304
7
finds 42 : array_42 takes an array as parameter and returns: true if there's a 42 in the array items false otherwise
def array_42(array) a = false array.each {|i| if i == 42 then a = true end} return a end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_42(a)\n\ta.any?{|x| x == 42}\nend", "def array_42(z)\n if z.include? 42\n return true\n else\n return false\n end\n\nend", "def array_42(arr)\n arr.map{|x| x== 42}.count{|x| x == true} == 1 ? true : false\nend", "def exists?(number, array)\n array.include?(number)\nend", "def number_in_array?(number, array)\n check = false\n array.each do |num| \n if num==number \n check = true\n end \n end\n return check\n end", "def include?(ary, number)\n return false if ary.size == 0\n result = ary.detect do |item|\n item == number\n end\n !!(result == number)\nend", "def innit?(array, item_to_look_for)\n\tresult = false\n\tarray.each do |list_item|\n\t\tif list_item == item_to_look_for\n\t\t\tresult = true\t\n\t\tend\n\tend\n\treturn result\nend", "def existsinarray arr, number\n len = arr.length\n idx = 0\n while idx <= len - 1\n if number == arr[idx]\n return true\n end\n idx = idx + 1\n \n end\n return false \nend", "def include?(array, value)\n array.each do |integer|\n return true if integer == value\n end\n return false\nend", "def array_42(argument)\n\n\tresultat = false\n\ti=0\n\twhile i<=argument.length\n\t\tif argument[i]==42 then\n\t\t\tresultat= true\n\t\telse \n\t\t\t\tend\n\t\ti+=1\n\tend\n\t\n#\tputs resultat\n\t\treturn resultat\n\t\t\nend", "def array_includes?(array, given_thing)\n answer = false\n\n array.each do |thing|\n if thing == given_thing\n answer = true\n end\n end\n\n return answer\nend", "def is_item_in_array(array,item)\n return array.include?(item)\nend", "def include?(array, integer)\r\n array.each do |element|\r\n return true if element == integer\r\n end\r\n\r\nfalse\r\nend", "def include?(arr, search_value)\n arr.each do |num|\n if num == search_value\n return true\n end\n end\n false\nend", "def include?(arr, number)\n arr.any? { |num| num == number }\nend", "def include_array?(array)\n array.any? { |member| array?(member) }\n end", "def include?(array, search_value)\n if array.count(search_value) == 1\n return true\n else\n return false\n end\nend", "def belongs_in_array(arr, num)\n arr.each do |thing|\n if thing == num\n puts true\n return\n end\n end\n puts false\n # or puts arr.include?(num)\nend", "def include?(array, search_element)\n array.each do |array_element|\n if array_element == search_element\n return true\n end\n false\n end\nend", "def include?(array, search_element)\n array.each do |array_element|\n if array_element == search_element\n return true\n end\n end\n false\nend", "def include?(arr, search)\n result = false\n arr.each { |num| result = true if num == search }\n result\nend", "def include?(arr, num)\n arr.each{ |element| return true if element == num}\n return false\nend", "def in_array(array, check_value)\n\tarray.each do |value|\n\t\tif value == check_value\n\t\t\treturn true\n\t\tend\n\tend\n\treturn false\nend", "def include?(array, search_value)\n array.count(search_value) > 0\nend", "def in_array(array, check_value)\n\tarray.each do |value|\n\t\tif value == check_value\n\t\t\treturn true\n\t\tend\n\tend\n\n\treturn false\nend", "def include?(array, search_value)\n # array.each do |element|\n # return true if element == search_value\n # end\n # false\n array.count(search_value) > 0\nend", "def array_of_fixnums?(array)\n array.all? { |x| x.is_a? Integer } \nend", "def check_array(array,target)\n if array.include?(target)\n return true\n else\n return false\n end\nend", "def include?(array, search)\n array.each do |value|\n return true if value == search\n end\n false\nend", "def array_of_fixnums?(array)\n for element in array\n unless element.is_a? Fixnum\n return false\n end\n end\n return true\nend", "def include?(arr, search_val)\n # arr.each { |e| return true if e == search_val }\n # false\n arr.count(search_val) > 0\n # or:\n # arr.any? { |i| i == val }\nend", "def include?(array, value)\r\n array.count(value) > 0\r\nend", "def include? (array, search)\n array.each { |item| return true if search == item }\n return false\nend", "def include?(array, value)\n # https://ruby-doc.com/core-2.7.2/Array.html#method-i-find_index\n !!array.find_index(value)\nend", "def include?(arr, search)\n arr.any? { |i| i == search }\nend", "def true_for_ravenclaw(array, item)\n for i in array\n status= i.include?(item)\n end\n return status\nend", "def include?(array, value)\n !!array.find_index(value)\nend", "def include?(array, value)\n !!array.find_index(value)\nend", "def is_integer_array? array\n\t\treturn array.all? {|a| a.is_a? Integer}\n\tend", "def array_of_fixnum?(array)\n\tarray.all?{|x| x.is_a?Fixnum}\nend", "def array_of_fixnums?(array)\n array.all? {|x| x.is_a? Fixnum}\nend", "def search(array, length, value_to_find)\n length.times do |i|\n if array[i] == value_to_find\n return true\n end\n end\n return false\nend", "def array_of_fixnums?(array)\n array.all? { |x| x.is_a? Fixnum }\nend", "def array_of_fixnums?(array)\n array.all? { |x| x.is_a? Fixnum }\nend", "def include?(array, value)\n array.each do |elem|\n return true if elem == value\n end\n false\nend", "def include?(arr, search)\n arr.each do |element|\n if element == search\n return true\n end\n end\n false\nend", "def include?(array, search_value)\n array.any? { |element| element == search_value }\nend", "def array_of_fixnums2?(array)\n array.all? { |x| x.is_a? Fixnum }\nend", "def array_of_fixnums?(array)\n array.all? {|a| a.is_a?(Fixnum)}\nend", "def search(array, length, value_to_find)\r\n # loop through array based on i which starts at 0\r\n i = 0;\r\n # have loop stop at array length\r\n while i < array.length\r\n # at each part in loop look to see if the element matches value_to_find\r\n if array[i] == value_to_find\r\n # if it does, then return true\r\n return true\r\n else\r\n # if it does not, increase i + 1\r\n i += 1;\r\n end\r\n end\r\n # if get through loop and has not returned true, return false\r\n return false\r\nend", "def include?(array, value)\n array.each { |element| return true if value == element }\n false\nend", "def search(array, length, value_to_find)\n\n length.times do |index|\n if array[index] == value_to_find\n return true\n end\n end\n\n return false\nend", "def includ?(array, value)\n\tarray.each do |element|\n\t\tif element == value\n\t\t\treturn true\n\t\tend\n\tend\n\tfalse\nend", "def search(array, length, value_to_find)\n length.times do |index|\n return true if array[index] == value_to_find\n end\n return false\nend", "def include?(array, arg)\n boolean_return = false\n array.each {|value| return boolean_return = true if value == arg}\n boolean_return\nend", "def array_of_fixnums?(array)\n #array.select { |e| e.is_a?(Fixnum) } == array\n array.all?{|e| e.is_a?(Fixnum)}\nend", "def include?(array, target)\n matches = array.select { |element| element == target }\n !matches.empty?\nend", "def find_the_cheese(array)\n cheeses = %w(gouda cheddar camembert)\n array.find {|cheese| cheeses.include?(cheese)}\nend", "def check_for (array, thing_to_find )\n array.select { |word| word.include? thing_to_find }\n end", "def search(array, length, value_to_find)\n length.times do |index|\n if array[index] == value_to_find\n return true\n end\n end\n return false\n # raise NotImplementedError\nend", "def include?(arr, search_value)\n new_arr = arr.select { |element| element == search_value}\n !new_arr.empty?\nend", "def include?(array, search_value)\n !array.select{|element| element == search_value}.empty?\nend", "def search_array (array, integer)\n\tarray.length.times do |index|\n\t if array[index] == integer\n\t return index\n\t end\n\tend\n\tnil\nend", "def find_socks_in_array(array)\n array.include? \"socks\"\n puts \"Found #{num_socks} socks!\"\nend", "def search_array(array, interger)\n\t index = 0 \n while index < array.length\n\n \tif array[index] == interger\n p index\n end \n index += 1\n end\nend", "def search(array, length, value_to_find)\n length.times do |i|\n if array[i] == value_to_find\n return true\n end\n end\n return false # if \"do\" loop never returns true, value doesn't exist\n # raise NotImplementedError\nend", "def find_the_cheese(array)\n cheeses = %w[gouda cheddar camembert]\n\n array.find do |cheese_flavor|\n cheeses.include?(cheese_flavor)\n end\nend", "def include?(array, query)\n array.each do |el|\n return true if el == query\n end\n false\nend", "def check_arr(item, arr, key)\n\tarr.each do |hash|\n\t\tif hash[key] === item\n\t\t\treturn true\n\t\tend\n\tend\n\treturn false\nend", "def include?(array, search_value)\n array.select { |value| value == search_value }.empty? ? false : true\nend", "def in_ranged_array?(ranged_ary, num)\n !!ranged_ary.find {|n| n === num }\n end", "def include?(arr, search)\n arr.any? { |elem| elem == search }\nend", "def find_the_cheese(array)\n\tcheeses = [\"cheddar\", \"gouda\", \"camembert\"]\n\tarray.find {|item| cheeses.include? item}\nend", "def include?(arr, value)\n includes = false\n arr.each { |n| includes = true if n == value }\n includes\nend", "def search_array(num)\n arr = [ 52, 30, 25, 4 ]\n i = 0\n while i < arr.length\n if arr[i] == num\n p arr[i]\n else\n arr[i] == nil\n end\n i += 1\n end\nend", "def search_array(array, int)\n\ti = 0\n\twhile i < array.length\n\t\tif array[i] == int\n\t\t\treturn i\n\t\tend\n\t\ti += 1\n\tend\n\n\treturn nil\nend", "def find_the_cheese(array)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n\n array.find do |item| #aka detect\n cheese_types.include?(item)\n end\nend", "def include?(array,search_value)\n included = false\n array.each do |x|\n included = true if x == search_value\n break if x == search_value\n end\n \n included\nend", "def include?(array, value)\n array.any?(value)\nend", "def find_the_cheese(array)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n array.find do |item|\n cheese_types.include?(item)\n end\nend", "def number_included(number)\n arr = [1, 3, 5, 7, 9, 11]\n puts \"number\": number\n puts arr.include? number\nend", "def exactly?(arr, num, &prc)\n count = 0\n\n arr.each do |ele|\n count += 1 if prc.call(ele)\n end\n\n count == num\nend", "def get_the_cheese(arr)\n cheeses = ['cheddar', 'gouda', 'cambert']\n arr.find { |x| cheeses.include?(x) }\n end", "def include? array, item\n array.include?(item)\nend", "def search_array(integers,search)\r\n\tintegers.each{|x|\r\n\t\tif x == search\r\n\t\t\treturn x\r\n\t\tend\r\n }\r\n\t return nil\r\nend", "def has?(arr, e)\n end", "def array_of(array, klass)\n array.any? { |i| i.class == klass }\n end", "def element(num)\n a = ['10', '2', '30', '5']\n if (a.include?(num) == true)\n puts \"#{num} is Present in the array\"\n else\n puts \"#{num} is not present in the array\"\n end\nend", "def contain_a (array)\n\tarray.select {|element| element.include?(\"a\")}\nend", "def search(array, value)\n return false if array.length == 0\n\n return search_helper(array, value)\nend", "def array_search(array, value)\n array.find(value)\nend", "def int_array_check(arr)\n arr.each do |element|\n Integer(element) != nil rescue return false\n end\n return true\n end", "def contain_a(array)\n array.select do |element|\n element.include?('a')\n end\nend", "def include?(arr, val)\n arr.any? { |element| element == val }\nend", "def find_the_cheese( array )\n # the array below is here to help\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n array.find { |chez| cheese_types.include?( chez ) }\nend", "def find_the_cheese(array)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n array.find { |cheese| cheese_types.include?(cheese) }\nend", "def my_array_finding_method(i_want_pets, thing_to_find)\n p i_want_pets.select { |value| value.to_s.include? thing_to_find }\nend", "def find_the_cheese(arr)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n arr.find do |cheese|\n cheese_types.include?(cheese)\n end\n \nend", "def exactly?(arr, n, &prc)\n count = 0\n arr.each do |ele| \n if prc.call(ele)\n count += 1\n end\n end\n count == n\nend", "def in_array(array, string)\n array.each do |object|\n if object == string\n return true\n else\n return false\n end\n end\nend" ]
[ "0.8160264", "0.7756425", "0.755894", "0.73001885", "0.70582676", "0.6964451", "0.689427", "0.6845245", "0.6833183", "0.6805238", "0.67821777", "0.67721444", "0.67507297", "0.67411923", "0.6711384", "0.6670097", "0.66320175", "0.66298974", "0.6609166", "0.6603252", "0.65815735", "0.65562844", "0.65532005", "0.6545003", "0.65342104", "0.65318745", "0.6509861", "0.64877135", "0.6482174", "0.6478117", "0.64703196", "0.64292055", "0.64244413", "0.64192206", "0.6418517", "0.640061", "0.639657", "0.639657", "0.63843226", "0.6359135", "0.6350334", "0.6345562", "0.63356847", "0.63356847", "0.63153", "0.6304615", "0.6298594", "0.62644315", "0.62614626", "0.6258398", "0.62459624", "0.62402254", "0.6237098", "0.6232912", "0.6230914", "0.62238926", "0.62103784", "0.62026227", "0.6202157", "0.6193294", "0.61873543", "0.6167471", "0.61550933", "0.6154509", "0.6152854", "0.6145388", "0.6144144", "0.61378646", "0.612999", "0.6118126", "0.6110108", "0.6110077", "0.61055887", "0.6099893", "0.60968447", "0.60856616", "0.6085054", "0.60811967", "0.6075187", "0.6068164", "0.60632205", "0.60587764", "0.6055404", "0.6041391", "0.603397", "0.6014198", "0.6013036", "0.60089797", "0.5998861", "0.59957254", "0.5978474", "0.59778446", "0.5973145", "0.5971275", "0.5967109", "0.5960463", "0.5959515", "0.5958951", "0.5947569", "0.5942966" ]
0.7682839
2
does crazy things on arrays : The magic_array function takes an array of number or an array of array of number as parameter and return the same array : flattened (i.e. no more arrays in array) reversed with each number multiplicated by 2 with each multiple of 3 removed with each number duplicate removed (any number should appear only once) sorted
def magic_array(array) array.flatten.reverse.map! {|i| i = i*2}.delete_if {|i| i.modulo(3) == 0}.uniq.sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magic_array(ma)\nma.flatten.sort.map{|n|n*2}.uniq.delete_if{|n|n%3==0}\nend", "def magic_array(a)\n a.flatten.sort.map{|x| x*2}.reject{|x| x%3==0}.uniq\n end", "def magic_array(arr)\n arr.flatten.sort.uniq.map{|x| x*2}\nend", "def magic_array(long)\n\tless_long = long.flatten\n\treversed = less_long.reverse\n\t\n\teven_numbers = reversed.map{ |i| i * 2 }\n\t\n\tmultiple_three = even_numbers.delete_if {|m| m % 3 == 0}\n\t\n\tno_duplicate = multiple_three.uniq\n\n\tsorted = no_duplicate.sort\n\treturn sorted\n\nend", "def magic_array (liste)\n\treturn liste.flatten.collect {|x| x * 2} .delete_if { |x| x%3 == 0 } .uniq .sort\nend", "def unflatten(flat_array)\n result = []\n x = 0\n\n while x < flat_array.length do \n if flat_array[x] < 3 \n result.push flat_array[x]\n x += 1\n else\n temp = [*flat_array[x...x + flat_array[x]]]\n result.push temp \n x += flat_array[x]\n end\n end\n result \nend", "def duplicates_subarray3(arr)\n arr.uniq.map { |elm| [elm] * arr.count(elm)}.sort_by {|subarr| subarr[0].ord }\nend", "def products_of_all_other_nums(array)\n\n\tresult = Array.new() { [] }", "def array_translate(array)\n new_arr = []\n \n array.each_with_index do |subArray, idx|\n if idx % 2 == 1\n subArray = ele\n else\n subArray = num\n \n #num.times { new_arr << ele }\n end\n end\n\n #return new_arr\nend", "def double_array(array)\n output_array = []\n\n array.each do |thing|\n output_array << thing * 2\n end\n\n return output_array\nend", "def spiral_rearrange1 array\n\t#rearrange 2d array of arrays square into a single spiral order arranged array. \n\tif array.flatten.length == 1\n\t\tresult = []\n\t\treturn result << array.flatten[0]\n\tend\n\n\tordered_array = []\n\tn = array.length - 1\n\tx = 0; y = 0\n while true\n\twhile true\n\t\tif array[x][y] != []\n\t\t\tordered_array << array[x][y]\n\t\t\tarray[x][y] = []\n\t\telse\n\t\t\tbreak\n\t\tend\t\n\t\tif y < n && array[x][y+1] != []\n\t\t\ty += 1\n\t\tend\n\tend\n\n\tx += 1\n\t\n\twhile true\n\t\tif array[x][y] != []\n\t\t\tordered_array << array[x][y]\n\t\t\tarray[x][y] = []\n\t\telse\n\t\t\tbreak\n\t\tend\n\t\tif x < n && array[x+1][y] != []\n\t\t\tx += 1\n\t\tend\n\tend\n\n\ty -= 1\n\n\twhile true\n\t\tif array[x][y] != []\n\t\t\tordered_array << array[x][y]\n\t\t\tarray[x][y] = []\n\t\telse\n\t\t\tbreak\n\t\tend\n\t\tif y > 0 && array[x][y-1] != []\n\t\t\ty -= 1\n\t\tend\t\n\tend\n\n\tx -= 1\n\n\twhile true\n\t\tif array[x][y] != []\n\t\t\tordered_array << array[x][y]\n\t\t\tarray[x][y] = []\n\t\telse\n\t\t\tbreak\n\t\tend\n\t\tif x > 0 && array[x-1][y] != []\n\t\t\tx -= 1\n\t\tend\t\n\tend\n\n\ty += 1\n\n\tif array[x][y] == []\n\t\tbreak\n\tend \n end\n\n\treturn ordered_array\nend", "def all_elements_except_first_3(num_array)\n 3.times {\n num_array.shift\n }\n return num_array\nend", "def mod_three my_array\n\t@my_array = my_array\n\tto_return = []\n\tto_return = @my_array.map { |nr| nr % 3 }\n\tto_return = to_return.reject { |nr| nr == 0 }\n\tp to_return\nend", "def rotate_array(numbers)\n new_numbers = []\n new_numbers << numbers[1,numbers.size] << numbers[0]\n new_numbers.flatten\nend", "def create_inner_arrays(array)\n size = array.size\n array = [array.first((size + 1) / 2), array.last(size / 2)]\nend", "def array_2(array2)\n array2.sort!\n return array2\nend", "def sub_arrays(arr)\n sub_arr = []\n i_arr = []\n arr.length.times do |x|\n arr.map do |ele1|\n i_arr += [ele1]\n sub_arr << i_arr\n end\n i_arr = []\n arr.shift\n end\n sub_arr\nend", "def transpose(array)\n result = []\n number = array.count\n if array.empty?\n single_array = array\n else\n single_array = [array[0]]\n end\n single_array.each do |val|\n val.each do |v|\n new_array = []\n number.times do\n new_array << v\n end\n result << new_array\n end\n end\n result\nend", "def double_array(input_array)\n \n double_array = []\n \n input_array.each do |number|\n double_array << number *= 2\n end\n return double_array\n\nend", "def triplify(array)\n \t \n \t new_array = array.map { |i| i * 3 }\n \t p new_array\n end", "def double_array(array)\n array*2\nend", "def bitonic_sort(array)\n return array if array.length <= 1\n\n length = array.length\n num = nearest_power_of_2(array.length)\n\n # add place holder values\n array << Float::INFINITY until array.length == num\n\n array = bitonic_recurse(array, 0, array.length, 1)\n\n # remove place holder values\n array.pop until array.length == length\n\n array\nend", "def cubed_values (array)\n\n cubed_array = array.map { | number | number ** 3 }\n return cubed_array\n\nend", "def array_permutations(arr)\n return [arr] if arr.length <= 1\n removed = arr.last\n sliced_arr = arr.slice(0...-1)\n new_arrays = array_permutations(sliced_arr)\n res = []\n new_arrays.each{|new_array|res += insert_num(new_array, removed)}\n res\nend", "def name_array(array)\n group_size = 2\n # number_of_elements = array.length\n # number_of_arrays = number_of_elements / group_size.to_i\n shuffled = array.shuffle\n sliced = shuffled.each_slice(group_size).to_a\n if shuffled.length % 2 == 1\n sliced[-2] << sliced[-1][0]\n sliced.delete_at(-1)\n else\n sliced\n end\n sliced\nend", "def sorted_triples(array)\n sort_array = []\n array.each_slice(3) do |group|\n sort_array << group.sort\n end\n return sort_array\nend", "def resolve_array(array)\n pot_o_data = [] #Holds the previously seen values\n \n array.each do |item|\n i = 0\n \n # Removes duplicate values\n while i < item[1].length\n if pot_o_data.include? item[1][i]\n item[1].delete_at(i)\n else\n pot_o_data << item[1][i]\n i += 1\n end\n end\n end\n \n # Removes items with empty values and removes the uniq values counter\n i = 0\n while i < array.length\n if array[i][1].empty?\n array.delete_at(i)\n else\n array[i] = [array[i][0], array[i][1]]\n i += 1\n end\n end\n end", "def improvement_four(*arrays)\n arrays.flatten.sort\nend", "def rotate_array(arr, num)\n num.times do \n ele = arr.pop \n arr.unshif(ele)\n end\n return arr \nend", "def double_array(array)\n\tn = [1, 2, 3]\n\tn * 2\nend", "def flat(a)\n\tnew_arr = []\n\ta.each do |el|\n\t\tif el.is_a? Array\n\t\t\tel.each do |n|\n\t\t\t\tif el.is_a? Array\n\t\t\t\t\ta << n\n\t\t\t\telse\n\t\t\t\t\tnew_arr << n\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tnew_arr << el\t\n\t\tend\n\tend\n\tp new_arr\nend", "def using_flatten (array)\n return array.flatten!\nend", "def make_pattern(array = [], number) # Define a method with two paremeter one array which will be the output and another one which is the given number.\r\n if number <= 0 # This is our base case it will stop if the number is 0 or less than that.\r\n array << number #Then we will push the number in to the array.\r\n\t\tarray << array.reverse #Now we will push the array in to it self, But in reverse order.\r\n\t\tarray.flatten! # At this two point we have a nested array it should be turn to one array.\r\n array.delete_at(array.length / 2) # Now there is a problem in our array the middle element of the array is repeated twice.So we delete one.\r\n return array # The array is ready to be called.\r\n end\r\n array << number # It pushes the number in to array \r\n make_pattern(array , number - 5) # This will make our method recursive.It will deduct 5 from our number at each time the method execute.\r\nend", "def array_of_array_multi(array)\n # YOUR CODE HERE\n multiArr = array.map{ |arr| arr.map{ |num| num * num } }\n p multiArr\n p array\n # array\nend", "def deeper_dup(arr)\n duper_deeper_arr = arr.dup.map do |item|\n if item.kind_of?(Array)\n deeper_dup(item)\n else\n item = item * 1\n end\n end\n duper_deeper_arr \nend", "def double_array(array)\n array.concat(array)\nend", "def groupCreator(array)\n\t3.times do\n\t\tarray.shuffle!\n\t\t\tnewArray=array.each_slice(4).to_a\n\t\t\tnewArray.each do |x|\n\t\t\t\tif(x.length<4)\n\t\t\t\t\ti=0\n\t\t\t\t\tuntil x.length<=0\t\n\t\t\t\t\t\tnewArray[i]<<x.pop\n\t\t\t\t\t\ti+=1\n\t\t\t\t\tend\n\t\t\t\t\tnewArray.pop\n\t\t\t\tend\n\t\t\tend\n\t\t\tp newArray\n\tend\nend", "def using_flatten(array)\n array.flatten()\nend", "def double_numbers(array)\n new_array = []\n\n array.each do |number|\n new_array << number *= 2\n end\n return new_array\nend", "def double_numbers(input_array)\n doubled_array =[]\n input_array.each {|num| doubled_array << num*2} \n doubled_array\nend", "def array_product_bruteforce(a)\r\n\tprod = Array.new(a.size)\r\n\ti = 0\r\n\r\n\twhile i < a.size\r\n\t\tc = a[0..a.size]\r\n\t\tc.delete_at(i)\r\n\t\tprod[i] = c.inject(:*)\r\n\t\ti += 1\r\n\tend\r\n\treturn prod\r\nend", "def manipulating_arrays(array)\n puts array.reverse\n puts array.sort\n return array.sort.reverse\nend", "def permutations(array)\n #base case\n return [[]] if array.empty?\n\n results = []\n prev_perm = permutations(array[0...-1]) # permutations([1,2]) == [[1, 2], [2, 1]]\n last_ele = array[-1] # 3\n prev_perm.each do |sub_arr|\n (0...array.length).each do |idx|\n # temp = Array.new(array.length) [nil, nil, nil]\n # temp = sub_arr[0...idx] + [last_ele] + sub_arr[idx..-1]\n results << temp\n end\n end\n results\nend", "def doubler(array)\r\n res = []\r\n array.each do |ele|\r\n res << ele * 2\r\n end\r\n res\r\nend", "def rotate_array(array)\n results = []\n results << array\n results = results.flatten\n last = results.shift \n results << last\nend", "def flatt(arr, flat_arr = [])\n arr.each do |element|\n if element.is_a?(Array)\n flatt(element, flat_arr)\n else\n flat_arr << element\n end\n end\n flat_arr\nend", "def sort2(num_array)\n return num_array if num_array.empty?\n pivot = num_array.pop\n left = []\n right = []\n\n num_array.each do |x|\n if x < pivot\n left << x\n else\n right << x\n end\n end\n return (sort(left) << pivot << sort(right)).flatten\nend", "def array_permutation(array)\n return array[0] if array.size == 1\n first = array.shift\n return first.product( array_permutation(array) )\nend", "def two_d_translate(array)\n new_array = []\n array.each do |sub_array|\n num = sub_array[1]\n ele = sub_array[0]\n num.times { new_array << ele }\n end\n\n new_array\nend", "def rotate_array(array_of_numbers)\n rotated_array = array_of_numbers.clone\n rotated_array << rotated_array.shift\n\n rotated_array\nend", "def sorted_squared_array_n_nlogn(values)\n values.collect!{|val| val*val}\n merge_sort(values)\nend", "def two_d_translate(array)\n new_arr = []\n array.each do |arr|\n arr[1].times {new_arr << arr[0]}\n end\n new_arr\nend", "def s_unfold(arrays)\n arrays.reduce([]) { |memo, obj|\n memo.concat(obj.is_a?(Array) ? p_unfold(obj) : [[obj]])\n }\n end", "def permutation(array)\n answer_arr = []\n return array if array.length == 1\n array.each_index do |i|\n perm = permutation(array - [array[i]])\n perm.each do |el|\n answer_arr << ([array[i]] + [el]).flatten\n end\n perm.each do |el|\n answer_arr << ([el] + [array[i]]).flatten\n end\n end\n answer_arr.uniq\nend", "def array_of_ints(arr)\n return arr[0] * arr[1] * arr[2] if arr.length == 3\n\n comp_arr = arr.pop(3).sort\n\n arr.each do |num|\n if num > comp_arr[2]\n comp_arr.push(num)\n comp_arr.shift\n elsif num > comp_arr[1]\n comp_arr[0] = comp_arr[1]\n comp_arr[1] = num\n elsif num > comp_arr[0]\n comp_arr[0] = num\n end\n end\n comp_arr[0] * comp_arr[1] * comp_arr[2]\n\nend", "def permutations(array)\n\n ret = []\n return [array] if array.length < 2\n sub = permutations(array[1..-1])\n sub.each do |sub_array|\n (0..sub_array.length).each do |idx|\n ret << sub_array[0...idx] + [array.first] + sub_array[idx..-1]\n end\n end\n ret\nend", "def three(array)\n array.sort!.shift\n array << 6\nend", "def flip_horizontally(array)\n\tif array[1].kind_of?(Array)\n\t\tfor item in array\n\t\t\titem.reverse!\n\t\tend\n\telse \n\t\tarray.reverse!\n\tend\n\treturn array\nend", "def cubes(array)\n array.map { |number| number ** 3}\n # Return array\nend", "def stretch(array)\n\n stretched_array = []\n\n for element in array\n if element % 2 == 0\n stretched_array << element/2\n stretched_array << element/2\n else\n stretched_array << element/2 + 1\n stretched_array << element/2\n end\n end\n\n return stretched_array\n\nend", "def rearrange_array(array)\n # size of an array\n n = array.size\n # iterate \n (0...n).each do |iter|\n array[iter] = array[iter]+(array[array[iter]]%n)*n\n end\n p array, n\n (0...n).each do |iter|\n p array[iter]\n array[iter] = (array[iter]/n)\n end\n array\nend", "def permutations(array)\n if array.empty?\n return [[]]\n end\n if array.count == 1\n return [array.clone]\n end\n arr = []\n array.each_with_index do |ele, idx|\n cpy = array.clone\n cpy.delete_at(idx)\n permutations(cpy).each do |perm|\n arr << [ele] + perm\n end\n end\n return arr\nend", "def transform_array(array)\n i = 0\n array2 = []\n while i < array.length\n num1 = array[i]\n array2.push(square(num1))\n i += 1\n end\n return array2\n end", "def rotate_array(arr)\n results = arr.map { |n| n }\n results << results.shift\nend", "def compress(array)\n\tarray.uniq\nend", "def transpose(array)\n return [] if array.empty?\n result = []\n array.first.length.times do |i|\n array.each_with_index do |inner, inner_index|\n result[i] ||= []\n result[i] << array[inner_index][i]\n end\n end\n result\nend", "def double_all array\n array.map { |i| i*2 }\nend", "def find_unsorted_subarray(nums)\n \nend", "def double_array(array)\n # your code here\nend", "def nums_only arr\n # found built in metods and chained them together. Took some time to figure out that the sort needed to go after the select. The select finds and returns items in the array that are integers. After that the sort organizes the numbers. then the delete method deletes the even numbers.\n arr.select { |element| element.is_a?(Integer)}.sort.delete_if &:even?\nend", "def get_squares(array)\n array.map! do |x|\n if (x**(1/2)).class == Fixnum\n x\n end\n end\n array.compact.uniq.sort!\nend", "def using_flatten(arr)\n arr.flatten\nend", "def flatten_array(arr)\n arr.flatten\nend", "def two_d_translate(arr)\n new_arr = []\n\n arr.each do |subArray|\n ele = subArray[0]\n num = subArray[1]\n\n num.times { new_arr << ele }\n end\n\n return new_arr\nend", "def repa(array, x)\n result = []\n (1..x).each do\n result.concat(array)\n end\n return result\nend", "def deep_dup(arr)\n duper_arr = arr.dup.map { |item| item * 1 }\nend", "def reverse_array(array_int)\n array_int.reverse!\nend", "def square_array(some_array)\n\tcontainer = []\n\tsome_array.each do |number|\n\t\tcontainer << number * number\n\tend\nend", "def array_transform(array)\n\tb = []\n\tarray.each_index do |i|\n\t\tb.push(array[i]+array[i-1])\tif i > 0\n\tend\n\treturn b.unshift(1).push(1)\nend", "def long_subarrays(arr)\n res =[]\n window = arr.length\n while window>=1\n idx = 0\n while idx+window<=arr.length\n sub_arr = arr.slice(idx, window)\n p sub_arr\n res << sub_arr\n idx += 1\n end\n window -= 1\n end\n res.map{|el| el.inject(0){|acc, el2| acc+el2}}.sort.last\nend", "def permutations(array)\n \nend", "def using_flatten(array)\n array.flatten\nend", "def using_flatten(array)\n array.flatten\nend", "def flatten(array)\n array.flatten(1)\nend", "def flatten(array)\n array.flatten(1)\nend", "def triplify(arr)\n arr.map do |num|\n num * 3\n end\nend", "def permutations(array)\n results = []\n results[0] = [[array.first]]\n (1..array.length - 1).each do |i|\n new_perms = []\n old_perms = results[i-1].deep_dup\n old_perms.each do |perm|\n perm.each_with_index do |value, index|\n new_perms << perm.splice(index, i + 1)\n end\n new_perms << perm.push(i + 1)\n end\n results[i] = new_perms\n end\n results[array.length - 1]\nend", "def flatten(array)\n a = []\n array.each do |n|\n if n.is_a? Array\n b = flatten(n)\n b.each { |x| a << x }\n else\n a << n\n end\n end\n a\nend", "def mutiply_all_element_of_an_array_excep_itself2(array_n)\n total_mutiplication_value = 1\n result_array = []\n \n array_n.each do |elm|\n total_mutiplication_value = elm * total_mutiplication_value\n end\n \n puts \"Total mutiplication : #{total_mutiplication_value}\"\n \n array_n.each do |elm|\n result = divide_by_bit_shift(total_mutiplication_value, elm)\n result_array.push(result[0])\n end\n \n\n return result_array\nend", "def cross_array(*enumerables)\n # return to_a.product(*enumerables.map{|e| e.to_a})\n enumerables.unshift self\n result = [[]]\n while !enumerables.empty?\n t, result = result, []\n b, *enumerables = enumerables\n t.each do |a|\n b.each do |n|\n result << a + [n]\n end\n end\n end\n result\n end", "def test_fix_nested_array\n array = [1, [2], [3, [4,[5]]], 6]\n array = array.flatten\n assert_equal [1,2,3,4,5,6], array\n end", "def square_array(array)\n array.map! { |ele| ele ** 2 }\nend", "def using_flatten(array)\n \n array.flatten\n \nend", "def duplicates_subarray2(arr)\n arr_srt = arr.sort {|a, b| a.ord <=> b.ord}\n new_arr = [[arr_srt[0]]]\n arr_srt.each_with_index do |elm, idx|\n next if idx == 0\n if new_arr[-1].include? elm\n new_arr[-1] << elm\n else\n new_arr << [elm]\n end\n end\n new_arr\nend", "def reverse!(array)\n reversed_array = []\n array.size.times { reversed_array << array.pop }\n reversed_array.size.times { array << reversed_array.shift }\n array\nend", "def double_numbers(array)\n doubled_numbers = []\n array.each do |number|\n doubled_numbers << number * 2\n end\n return doubled_numbers\nend", "def get_squares array\n\tnew_array = []\n\tarray.each do |number|\n\tif array.include? number**2 \n\tnew_array << number\n\tend\nend \n\treturn new_array.sort \nend", "def shuffler(a)\n a.flatten.shuffle.each_slice(2).to_a\nend", "def buy_fruit(array_of_arrays)\n result = []\n array_of_arrays.each { |array| array[1].times{ |i| result << array[0] } }\n result\nend", "def using_flatten(array)\n array.flatten\nend" ]
[ "0.8331963", "0.8118887", "0.7783273", "0.7496129", "0.74763614", "0.67675245", "0.64840126", "0.6378727", "0.6306332", "0.6258576", "0.6254475", "0.6165096", "0.6147559", "0.6125871", "0.6123693", "0.61127734", "0.6112463", "0.60992086", "0.6096679", "0.6093359", "0.60905343", "0.6062864", "0.60601217", "0.60478735", "0.6046214", "0.6043142", "0.60413563", "0.6032137", "0.6015873", "0.60031664", "0.59984887", "0.59972817", "0.5975867", "0.5964695", "0.5944584", "0.5941062", "0.59349763", "0.59326655", "0.5918118", "0.591722", "0.59115267", "0.5911506", "0.5901544", "0.5898484", "0.5884694", "0.5878881", "0.58777416", "0.5871639", "0.5870747", "0.58685386", "0.58684695", "0.5861604", "0.5859058", "0.58527696", "0.5837695", "0.5836972", "0.58337766", "0.5828146", "0.58125883", "0.58085054", "0.58030546", "0.57958007", "0.57953835", "0.57937884", "0.5792484", "0.5788985", "0.57745063", "0.5773606", "0.57710963", "0.5767798", "0.5767782", "0.57663906", "0.5761828", "0.5761061", "0.5760007", "0.5758149", "0.57550263", "0.5752867", "0.5749261", "0.5746881", "0.574446", "0.57419276", "0.57419276", "0.5741825", "0.5741825", "0.57407516", "0.57387656", "0.5736856", "0.5735688", "0.5733822", "0.573183", "0.57277334", "0.5726638", "0.57219476", "0.5718932", "0.57181764", "0.57157594", "0.57073045", "0.57070255", "0.5703434" ]
0.8487766
0
Test that data structure is made correctly
def test_format data = analyse_log(@filename,@keywords, @start, Time.parse("31.12.3000"), @output_file) data_hist = prepare_data(data, @keywords, @start, 3600) assert_equal(true, data_hist.keys[0].class == String) assert_equal(true, data_hist[@keywords[0]].keys[0].class == Time) assert_equal(true, data_hist[@keywords[0]][0].class == Fixnum) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_initialize_objects\n\t# assert_equal @w.nodes, 0\n\t# assert_equal @w.validWordList, 0\n\tassert_kind_of Graph, @w \n\tassert_kind_of Node, @n\n end", "def test_construct_map\n create_single_locations\n val = construct_the_map\n assert_equal val.size, 7 # pass\n end", "def test_trivial\n @game.state=[]\n assert_equal [],@game.evolve\n @game.state=[[0]]\n assert_equal [[0]],@game.evolve\n end", "def test_array\n\t\tassert_equal(\"Alex\", @students[0].first_name, \"The first student's name is not Alex.\")\n\t\tassert_equal(5, @students[0].scores.length, \"The first student does not have exactly 5 scores.\")\n\t\tassert_not_equal(@students[0].scores[0], @students[0].scores[4], \"The first student's first and third score aren't different.\")\n\t\tassert_equal(88, @students[0].scores[3], \"The first student's forth score is not 88\")\n\tend", "def test_initialize\n assert @bv.balances.is_a?(Hash)\n assert @bv.balances.empty?\n end", "def test_initialize_node\n \tassert_equal @n.id, 0\n \tassert_equal @n.neighbors, []\n \tassert_equal @n.string, \"a\"\n end", "def test_truth\n assert_kind_of AssessedElementDatum, @assessed_element_datum\n end", "def test_shovel \r\n new_todo = Todo.new('Walk the dog')\r\n @list << new_todo# TodoList object\r\n @todos << new_todo # array of Todo objects\r\n\r\n assert_equal(@todos, @list.to_a)\r\n end", "def test_06\n @dg = DiGraph.new([5,9],[0,3],[3,8],[8,9],[9,0])\n @paths = Hash.new\n @paths[5] = [9]\n @paths[0] = [3]\n @paths[3] = [8]\n @paths[8] = [9]\n @paths[9] = [0]\n @nodes = @paths.keys\n received_dg = @dg.strongly_connected_component_including_node(0);\n filled_dg = DiGraph.new(*fill(0));\n if (not filled_dg.equal?(received_dg))\n puts \"test_06 failed...\"\n puts \"DiGraph => #{@dg.to_s}\"\n puts \"node => 0\"\n puts \"expected => #{filled_dg.to_s}\"\n puts \"received => #{received_dg.to_s}\"\n end\n assert_equal(true,filled_dg.equal?(received_dg))\n end", "def test_candidate_key\n arr = [@obj]\n obj = @obj.clone\n obj.outpulsemapid = nil\n refute arr.any? &obj.candidate_key\n\n obj = @obj.clone\n obj.digitpattern = nil\n refute arr.any? &obj.candidate_key\n\n obj = @obj.clone\n obj.inputnoa = nil\n refute arr.any? &obj.candidate_key\n\n obj = @obj.clone\n obj.mindigitcount = nil\n refute arr.any? &obj.candidate_key\n\n obj = @obj.clone\n obj.maxdigitcount = nil\n refute arr.any? &obj.candidate_key\n\n obj = @obj.clone\n obj.members.each { |attribute| obj.public_send \"#{attribute}=\", nil }\n obj.outpulsemapid = @obj.outpulsemapid\n obj.digitpattern = @obj.digitpattern \n obj.inputnoa = @obj.inputnoa\n obj.mindigitcount = @obj.mindigitcount\n obj.maxdigitcount = @obj.maxdigitcount\n assert arr.any? &obj.candidate_key\n end", "def test_dict_to_hash_not_empty\n assert_raises \"Error: Invalid integer in wordlist.txt\" do\n @grapher.dict_to_hash(Set.new([1]))\n end\n end", "def test_first_table_has_correct_length\n assert_equal( 1, @result.values.first.size )\n end", "def test_create_dict_set_is_a_set\n assert_kind_of Set, @grapher.create_dict_set('wordlist.txt')\n end", "def test_cont\n @m4[0,0]=1\n @m1[0,0]=1\n #insercion\n assert_equal(@m4.to_s,'[[1,0],[0,5]]')\n assert_equal(@m1.to_s,'[[1,1],[1,0]]')\n #obtencion\n assert_equal(@m4[1,1],5)\n assert_equal(@m1[0,0],1)\n end", "def test_07\n @dg = DiGraph.new([0,0],[6,0],[6,8],[2,6],[8,8],[3,4],[3,2],[3,9],[9,4],[9,6],[4,3],[4,8])\n @paths = Hash.new\n @paths[0] = [0]\n @paths[6] = [0,8]\n @paths[2] = [6]\n @paths[8] = [8]\n @paths[3] = [4,2,9]\n @paths[9] = [4,6]\n @paths[4] = [3,8]\n @nodes = @paths.keys\n received_dg = @dg.strongly_connected_component_including_node(6);\n filled_dg = DiGraph.new(*fill(6));\n if (not filled_dg.equal?(received_dg))\n puts \"test_07 failed...\"\n puts \"DiGraph => #{@dg.to_s}\"\n puts \"node => 6\"\n puts \"expected => #{filled_dg.to_s}\"\n puts \"received => #{received_dg.to_s}\"\n end\n assert_equal(true,filled_dg.equal?(received_dg))\n end", "def test_101_empty_to_sparse\n\n tchain = Methodicate.new(TDatum01)\n assert(tchain.methodicated?,\n 'Testing that \"methodicate.new(complex)\" is chained')\n assert_equal(TDatum01['A'],\t\ttchain.A,\n 'Testing that \"methodicate(complex).A == hash[\"A\"]\"')\n assert_equal(TDatum01['A'],\t\ttchain['A'],\n 'Testing that \"methodicate(complex)[\"A\"] == hash[\"A\"]\"')\n assert_equal(TDatum01['B'],\t\ttchain.B,\n 'Testing that \"methodicate(complex).B == hash[\"B\"]\"')\n assert_equal(TDatum01['B'],\t\ttchain['B'],\n 'Testing that \"methodicate(complex)[\"B\"] == hash[\"B\"]\"')\n\n #\n # Note that the following assertions *must* reverse the\n # 'expected' and 'actual' arguments so that the #== method will\n # be called on the *methodicated* value (which will pass it along),\n # and not the *reference* value (which will try to compare to a\n # hash).\n #\n assert_equal(tchain.a,\t\t\tTDatum01[:a],\n 'Testing that \"methodicate(complex).a == hash[:a]\"')\n assert_equal(tchain[:a],\t\t\tTDatum01[:a],\n 'Testing that \"methodicate(complex)[:a] == hash[:a]\"')\n assert_equal(tchain['a'],\t\t\tTDatum01['a'],\n 'Testing that \"methodicate(complex)[\"a\"] == hash[\"a\"]\"')\n\n #\n # Revert to 'expected, actual' order.\n #\n assert_equal(TDatum01['a'].first,\t\ttchain['a'].first)\n assert_equal(TDatum01['a'][0],\t\ttchain['a'][0])\n assert_equal(TDatum01['a'][1],\t\ttchain['a'][1])\n assert_equal(TDatum01['a'].last,\t\ttchain['a'].last)\n\n assert_equal(TDatum01[:a]['h1'],\t\ttchain.a['h1'])\n assert_equal(TDatum01[:a]['h1'],\t\ttchain.a.h1)\n #\n # More reversals\n #\n assert_equal(tchain.a[:h2],\t\tTDatum01[:a][:h2])\n assert_equal(tchain.a[:h2][0],\t\tTDatum01[:a][:h2][0])\n assert_equal(tchain.a[:h2][1],\t\tTDatum01[:a][:h2][1])\n assert_equal(tchain.a[:h2][2],\t\tTDatum01[:a][:h2][2])\n\n assert_equal(tchain.a.h2,\t\t\tTDatum01[:a][:h2])\n assert_equal(tchain.a.h2[0],\t\tTDatum01[:a][:h2][0])\n assert_equal(tchain.a.h2[1],\t\tTDatum01[:a][:h2][1])\n assert_equal(tchain.a.h2[2],\t\tTDatum01[:a][:h2][2])\n\n assert_equal(tchain.a['H3'],\t\tTDatum01[:a]['H3'])\n assert_equal(tchain.a['H3'][0],\t\tTDatum01[:a]['H3'][0])\n assert_equal(tchain.a['H3'][0][0],\tTDatum01[:a]['H3'][0][0])\n assert_equal(tchain.a['H3'][0][1],\tTDatum01[:a]['H3'][0][1])\n assert_equal(tchain.a['H3'][0][2],\tTDatum01[:a]['H3'][0][2])\n assert_equal(tchain.a['H3'][1],\t\tTDatum01[:a]['H3'][1])\n assert_equal(tchain.a['H3'][1].keys,\tTDatum01[:a]['H3'][1].keys)\n assert_equal(tchain.a['H3'][1][:deeper],\tTDatum01[:a]['H3'][1][:deeper])\n assert_equal(tchain.a['H3'][1].deeper,\tTDatum01[:a]['H3'][1][:deeper])\n\n assert_equal(tchain.a.H3,\t\t\tTDatum01[:a]['H3'])\n assert_equal(tchain.a.H3[0],\t\tTDatum01[:a]['H3'][0])\n assert_equal(tchain.a.H3[0][0],\t\tTDatum01[:a]['H3'][0][0])\n assert_equal(tchain.a.H3[0][1],\t\tTDatum01[:a]['H3'][0][1])\n assert_equal(tchain.a.H3[0][2],\t\tTDatum01[:a]['H3'][0][2])\n assert_equal(tchain.a.H3[1],\t\tTDatum01[:a]['H3'][1])\n assert_equal(tchain.a.H3[1].keys,\t\tTDatum01[:a]['H3'][1].keys)\n assert_equal(tchain.a.H3[1][:deeper],\tTDatum01[:a]['H3'][1][:deeper])\n assert_equal(tchain.a.H3[1].deeper,\tTDatum01[:a]['H3'][1][:deeper])\n end", "def test_05\n @dg = DiGraph.new([0,7],[1,9],[1,4],[7,4],[7,0],[7,9],[3,7],[9,4],[9,7],[9,9],[4,1],[4,4],[4,7])\n @paths = Hash.new\n @paths[0] = [7]\n @paths[1] = [9,4]\n @paths[7] = [4,0,9]\n @paths[3] = [7]\n @paths[9] = [4,7,9]\n @paths[4] = [1,4,7]\n @nodes = @paths.keys\n received_dg = @dg.strongly_connected_component_including_node(0);\n filled_dg = DiGraph.new(*fill(0));\n if (not filled_dg.equal?(received_dg))\n puts \"test_05 failed...\"\n puts \"DiGraph => #{@dg.to_s}\"\n puts \"node => 0\"\n puts \"expected => #{filled_dg.to_s}\"\n puts \"received => #{received_dg.to_s}\"\n end\n assert_equal(true,filled_dg.equal?(received_dg))\n end", "def test_invalid_empty_dict_to_hash\n assert @grapher.dict_to_hash(Set.new([])).size.zero?\n end", "def test_flatten_model\r\n assert_equal( { \"ident\"=>1, \"name\"=>\"rubylicious\", \"commentary\"=>\"\", \"description\"=>\"\"},\r\n @mymodel.flatten_data)\r\n end", "def test_empty_dict\r\n assert @dict .empty?\r\n end", "def test_values_are_arrays_of_hashes\n @result.values.each do |table|\n assert_instance_of( Array, table )\n table.each do |entry|\n assert_instance_of( Hash, entry )\n end\n end\n end", "def test_robust\n # expected result\n expected=[[0,0,0],[0,0,0],[0,0,0]]\n\n # A non-rectangular game\n @game.state=[[0,0,0],[0,0],[0,0,0]]\n assert_equal expected,@game.evolve\n\n # A game with illegal values\n @game.state=[[0,0,'fred'],[0,nil,0],[0,43,0]]\n assert_equal expected,@game.evolve\n end", "def test_create_all_locations\n\t\ttest_main = Main.new(3, 4, 6)\n\t\ttest_graph = Graph.new(10)\n\t\ttest_main.create_all_locations(test_graph)\n\t\tassert_equal test_main.num_locations(test_graph), 7\n\tend", "def test_typecheck\n\t\tassert_raise( RuntimeError ) { Room.new(\"1\", \"2\", \"3\", 4, [], [], [], {}, {}) }\n\t\tassert_raise( RuntimeError ) { Room.new(1, 2, \"3\", 4, [], [], [], {}, {}) }\n\t\tassert_raise( RuntimeError ) { Room.new(1, \"2\", 3, 4, [], [], [], {}, {}) }\n\t\tassert_raise( RuntimeError ) { Room.new(1, \"2\", \"3\", \"4\", [], [], [], {}, {}) }\n\t\tassert_raise( RuntimeError ) { Room.new(1, \"2\", \"3\", 4, {}, [], [], {}, {}) }\n\t\tassert_raise( RuntimeError ) { Room.new(1, \"2\", \"3\", 4, [], {}, [], {}, {}) }\n\t\tassert_raise( RuntimeError ) { Room.new(1, \"2\", \"3\", 4, [], [], {}, {}, {}) }\n\t\tassert_raise( RuntimeError ) { Room.new(1, \"2\", \"3\", 4, [], [], [], [], {}) }\n\t\tassert_raise( RuntimeError ) { Room.new(1, \"2\", \"3\", 4, [], [], [], {}, []) }\n\t\tassert_raise( RuntimeError ) { @room.connect(\"2\", Direction::NORTH, Door.new(0)) }\n\t\tassert_raise( RuntimeError ) { @room.connect(2, \"Direction::NORTH\", Door.new(0)) }\n\t\tassert_raise( RuntimeError ) { @room.connect(2, Direction::NORTH, \"Door.new(0)\") }\n\tend", "def check_data_structur(data)\n data.each do |id, values|\n count = values.size\n if count.odd? or count > 2\n puts \"+%s+\" % [\"-\" * 57]\n puts \"|%32s%26s\" % [\"WARNING\", \"|\"]\n puts \"+%s+\" % [\"-\" * 57]\n end\n if count.odd?\n last = values.keys.last\n puts \"%s%17s\" % [\"| Sample #{id} was not returned to store!\", \"|\"]\n puts \"%s%30s%8s\" % [\"| Measured output PDE\", \"#{dose_unit_text(values[last])}/day in #{last}.\", \"|\"]\n values.delete(last)\n data.delete(id) if values.empty?\n puts \"+%s+\" % [\"-\" * 57]\n count = values.size\n end\n # if sample left store more times -- new data record is created for data pair\n # due to using get_integrate method\n correction = {}\n if count > 2\n puts \"%s%6s%16s\" % [\"| Sample #{id} left store more times\", \"(#{count / 2})!\", \"|\"]\n print \"| Original sample name #{id} was renamed to:\"\n n = 0\n values.each_slice(2) do |pair|\n n += 1\n correction[id + \"_m#{n}\"] = pair.to_h\n if n == 1\n puts \"%10s%4s \" % [\"#{id}_m#{n}\", \"|\"]\n else\n puts \"|%54s%4s \" % [\"#{id}_m#{n}\", \"|\"]\n end\n end\n puts \"+%s+\" % [\"-\" * 57]\n data = data.merge(correction)\n data.delete(id)\n end\n end\n data\n end", "def test_create_dict_set_initialized\n refute_nil @grapher.create_dict_set('wordlist.txt')\n end", "def test_10a\r\n db = build\r\n assert_equal [],db.groups\r\n end", "def test_db_is_not_directly_mutable_from_the_outside\n school.add(\"Jennifer\", 4)\n school.db.delete(4)\n school.db[4] << \"Voldemort\"\n assert_equal({ 4 => [\"Jennifer\"] }, school.db)\n end", "def test_create_graph\n val = create_graph(1234, 5)\n locations_count = val[0].count\n prospectors_count = val[1].count\n assert_equal 7, locations_count\n assert_equal 5, prospectors_count\n end", "def test_ab\n A.ary = []\n A.new.do_ab\n #p A.ary\n assert_equal([0,1,0,2,0,3], A.ary) \n end", "def test_build_from_hash\n graph = DirectedGraph.new\n graph.build({'a'=>nil,'b'=>'c','c'=>nil})\n\n assert(graph.to_s == 'a=>,b=>c,c=>')\n end", "def test_empty_spaces_some_empty\n result = @sudoku_1.empty_spaces(@sudoku_1.squares[1])\n assert_equal([[0, 5], [1, 3], [1, 5], [2, 4]], result)\nend", "def test_empty_0\n # Changes: had to rewrite arrays as @cls\n # assert_equal true, [].empty?\n # assert_equal false, [1].empty?\n # assert_equal false, [1, 1, 4, 2, 5, 4, 5, 1, 2].empty?\n assert_equal true, @cls[].empty?\n assert_equal false, @cls[1].empty?\n assert_equal false, @cls[1, 1, 4, 2, 5, 4, 5, 1, 2].empty?\n end", "def test_empty_0\n # Changes: had to rewrite arrays as @cls\n # assert_equal true, [].empty?\n # assert_equal false, [1].empty?\n # assert_equal false, [1, 1, 4, 2, 5, 4, 5, 1, 2].empty?\n assert_equal true, @cls[].empty?\n assert_equal false, @cls[1].empty?\n assert_equal false, @cls[1, 1, 4, 2, 5, 4, 5, 1, 2].empty?\n end", "def test_empty_dict\n assert @dict .empty?\n end", "def test_library_has_standards\n library = Library.new 'San Francisco Public Library'\n book = Book.new 'Cat in the Hat', 'Dr. Seuss', 61\n library.add book\n assert_equal library.books, []\n end", "def test_append_method\n list = LinkedList.new\n\n list.append(\"West\", {\"pounds of food\" => 200})\n\n assert_instance_of Node, list.head\n assert_equal \"West\", list.head.surname\n end", "def test_creac\n #Matriz densa\n assert_equal(@m1.rows, 2)\n assert_equal(@m1.cols, 2)\n \n #Matriz dispersa\n assert_equal(@m4.rows, 2)\n assert_equal(@m4.cols, 2)\n \n #Creacion\n assert_equal(Matriz.vector(2,2,[1,1,1,1]).to_s,@m2.to_s)\n assert_equal(Matriz.nula.to_s,@m3.to_s)\n end", "def test_add_book\n @library = Library.new(@books_array)\n new_book = {\n title: \"lord_of_the_fading_lands\",\n rental_details: {\n student_name: \"\",\n date: \"\"\n }\n }\n\n @library.add_book(\"lord_of_the_fading_lands\")\n\n assert_equal(new_book, @library.book_info(\"lord_of_the_fading_lands\"))\n assert_equal(4, @books_array.count)\n end", "def test_lists\r\n nodelist = @mymodel.node_list\r\n linklist = @mymodel.link_list\r\n \r\n assert(nodelist.size == 0)\r\n assert(linklist.size == 0)\r\n end", "def test_indexed_access\n setup_test_tree\n\n assert_equal(@child1, @root[0], \"Should be the first child\")\n assert_equal(@child4, @root[2][0], \"Should be the grandchild\")\n assert_nil(@root[\"TEST\"], \"Should be nil\")\n assert_nil(@root[99], \"Should be nil\")\n assert_raise(ArgumentError) { @root[nil] }\n end", "def test_return_sorted_array_two_nodes\n @tree.insert(\"b\")\n @tree.insert(\"a\")\n assert_equal [\"ab\"], @tree.sort\n end", "def test_create_dict_initialize\n refute_nil @grapher.create_dict 'wordlist.txt'\n end", "def test_initialize\n rm = [@g.ruby_mines['Enumerable Canyon'].name, @g.ruby_mines['Monkey Patch City'].name, @g.ruby_mines['Nil Town'].name, @g.ruby_mines['Matzburg'].name, @g.ruby_mines['Hash Crossing'].name, @g.ruby_mines['Dynamic Palisades'].name]\n assert_equal [1, 1, ['Enumerable Canyon', 'Monkey Patch City', 'Nil Town', 'Matzburg', 'Hash Crossing', 'Dynamic Palisades'], 1, 0], [@g.seed, @g.num_prospectors, rm, @g.num_turns, @g.done]\n end", "def _test_recursive_list\n assert_raise BEncode::EncodeError do\n list = []\n list << list\n list.bencode\n end\n\n assert_raise BEncode::EncodeError do\n list = [[]]\n list.first << list\n list.bencode\n end\n end", "def test_same_tv_show\n result = same_tv_show(@people)\n assert_equal({\"Pokemon\" => [\"Keith\", \"Val\"]}, result)\nend", "def test_return_array_root_node\n @tree.insert(\"f\")\n assert_equal [\"f\"], @tree.sort\n end", "def test_create_collection\n with_a_collection do\n assert_instance_of QualityCenter::Defect::Collection, @coll\n refute @coll.empty?\n end\n end", "def test_dict_to_hash_not_empty\n assert @grapher.dict_to_hash(Set.new(['a', 'bd'])).size > 0\n end", "def test_book_info__book_in_library\n @library = Library.new(@books_array)\n book_details = @library.book_info(\"lord_of_the_dance\")\n\n expected = {\n title: \"lord_of_the_dance\",\n rental_details: {\n student_name: \"Jack\",\n date: \"21/12/17\"\n }\n }\n\n assert_equal(expected, book_details)\n\n end", "def test_it_can_create_a_board_of_one_peg\n\n board = Board.new(1)\n\n assert_equal 1, board.size\n\n end", "def test_old\n assert_equal({\n \"shiva\"=>\"Shiva\",\n \"ganesha\"=>\"Ganesha\",\n \"surya\"=>\"Surya\",\n \"ganga\"=>\"Ganga\",\n \"shakti\"=>\"Shakti\",\n \"vishnu\"=>\"Vishnu\",\n \"shiva_desc\"=>\"Shiva is the god of transformation through destruction and the Lord of Dance.\",\n \"ganesha_desc\"=>\"Ganesha is the god of knowledge and beginnings, the Lord of Obstacles.\",\n \"surya_desc\"=>\"Surya is the god of the sun, courage and will.\",\n \"ganga_desc\"=>\"Ganga is the goddess of the sacred river, Ganges, who purifies and redeems.\",\n \"shakti_desc\"=>\"Shakti is the goddess of power and dynamic energy.\",\n \"vishnu_desc\"=>\"Vishnu is the all-pervading god who sustains the world.\",\n \"RV_NO_DEITY_TITLE\"=>\"No Current Deity.\",\n \"RV_NO_DEITY_DESC\"=>\"Hinduism allows you to select which god to follow as your main deity. Each deity will come with its own effects and last until your monarch changes.\",\n \"RV_PICK_DEITY_THIS\"=>\"Follow $NAME|Y$\",\n \"RV_PICK_DEITY\"=>\"Select Deity\",\n }, FakeYaml.load(sample(\"religion_l_english\")))\n end", "def test_build_from_hash\n graph = Graph.new\n graph.build({'a'=>'b','c'=>'b'})\n\n assert(graph.to_s == 'a=>b,b=>a,b=>c,c=>b')\n end", "def test_acts_of_homonymy\n create_some_test_data\n assert_equal 0, @s1.acts_of_homonymy_for_ref.size \n assert_equal 1, @s5.acts_of_homonymy_for_ref.size\n assert_equal [[@ontology_classes[3], @ontology_classes[4]]], @s5.acts_of_homonymy_for_ref\n end", "def test_initializing_new_privilege_set\n assert_difference(\"PrivilegeSet.sets.length\", 1, \"Adding test PrivilegeSet\") do\n assert_difference(\"Cbac::PrivilegeSetRecord.find(:all).length\", 1, \"Record should not be added to table - record already exists\") do\n PrivilegeSet.add :test_initializing_new_privilege_set, \"Something\"\n end\n end\n end", "def test_initalize_with_one_argument\n assert_equal \"Liger\", @cat.name\n assert_nil @cat.species\n assert_equal 0, @cat.speed\n assert_equal 0, @cat.legs\n end", "def testInitialize_1SW_2NW_3NE_0SE_depth2\n ps = [UniquePoint3.new(0,0,0), UniquePoint3.new(1,7,2),\n UniquePoint3.new(3,5,2), UniquePoint3.new(5,7,2), UniquePoint3.new(5,5,2),\n UniquePoint3.new(7,5,2), UniquePoint3.new(8,8,8)]\n q = QuadTreeAccelerator.new(ps)\n assert_equal(\n\"(0,[[0,0,0],[8,8,8]],[])\n SW\n (1,[[0,0,0],[4.0,4.0,8]],[[0,0,0]])\n NE\n (1,[[4.0,4.0,0],[8,8,8]],[])\n SW\n (2,[[4.0,4.0,0],[6.0,6.0,8]],[[5,5,2]])\n SE\n (2,[[6.0,4.0,0],[8,6.0,8]],[[7,5,2]])\n NE\n (2,[[6.0,6.0,0],[8,8,8]],[[8,8,8]])\n NW\n (2,[[4.0,6.0,0],[6.0,8,8]],[[5,7,2]])\n NW\n (1,[[0,4.0,0],[4.0,8,8]],[])\n SE\n (2,[[2.0,4.0,0],[4.0,6.0,8]],[[3,5,2]])\n NW\n (2,[[0,6.0,0],[2.0,8,8]],[[1,7,2]])\n\", q.to_s)\n end", "def test_content\n pers = Person::new(\"John\", \"Doe\")\n @root.content = pers\n assert_same(pers, @root.content, \"Content should be the same\")\n end", "def test_second_table_has_correct_length\n assert_equal( 2, @result.values.last.size )\n end", "def test_accessors\n assert_not_nil @wiki\n assert_kind_of Wiki, @wiki\n assert_equal \"Wikipedia (en)\", @wiki.name\n assert_equal \"http://en.wikipedia.org\", @wiki.homepage \n assert_equal \"http://en.wikipedia.org/wiki/\", @wiki.base_url\n assert_not_nil @wiki.wiki_pages\n assert_kind_of Array, @wiki.wiki_pages\n assert_equal 1, @wiki.wiki_pages.length\n assert_kind_of WikiPage, @wiki.wiki_pages[0]\n end", "def test_valid\n italian = RecipeType.new\n\n assert_equal(false, italian.valid?)\n\n italian.name = \"\"\n assert_equal(false, italian.valid?)\n\n italian.name = \"Italian\"\n assert_equal(true, italian.valid?)\n end", "def test_it_can_create_rows\n neos = NearEarthObjects.new('2019-03-30')\n format = FormatData.new(neos.formatted_astroid_data)\n\n expected = [{:name=>\"(2019 GD4)\", :diameter=>\"61 ft\", :miss_distance=>\"911947 miles\"},\n {:name=>\"(2019 GN1)\", :diameter=>\"147 ft\", :miss_distance=>\"9626470 miles\"},\n {:name=>\"(2019 GN3)\", :diameter=>\"537 ft\", :miss_distance=>\"35277204 miles\"},\n {:name=>\"(2019 GB)\", :diameter=>\"81 ft\", :miss_distance=>\"553908 miles\"},\n {:name=>\"(2019 FQ2)\", :diameter=>\"70 ft\", :miss_distance=>\"2788140 miles\"},\n {:name=>\"(2011 GE3)\", :diameter=>\"123 ft\", :miss_distance=>\"35542652 miles\"},\n {:name=>\"(2019 FT)\", :diameter=>\"512 ft\", :miss_distance=>\"5503325 miles\"},\n {:name=>\"(2019 FS1)\", :diameter=>\"134 ft\", :miss_distance=>\"6241521 miles\"},\n {:name=>\"141484 (2002 DB4)\", :diameter=>\"10233 ft\", :miss_distance=>\"37046029 miles\"},\n {:name=>\"(2011 GK44)\", :diameter=>\"147 ft\", :miss_distance=>\"10701438 miles\"},\n {:name=>\"(2012 QH8)\", :diameter=>\"1071 ft\", :miss_distance=>\"37428269 miles\"},\n {:name=>\"(2019 UZ)\", :diameter=>\"51 ft\", :miss_distance=>\"37755577 miles\"}]\n assert_equal expected, format.create_rows\n end", "def check_integrity(list)\n complete = list.to_a\n 1.upto(list.level) do |l|\n #if anything in the higher layer wasn't in layer 0\n difference = list.to_a(nil,nil,nil,l) - complete\n puts \"stray node found in level: #{l} which is #{list.to_a(nil,nil,nil,l)}\" if !difference.empty? \n expect(difference).to match_array([])\n end\nend", "def test_create_empty_word\n assert true,@newTileGroup.tiles.empty?\n end", "def test_manipulation()\n t = Turn.new([1,2,3,4])\n\n t.black_hits = 1\n t.white_hits = 1\n\n # Testen des ueberschreiben\n assert_raise(RuleViolationError) do\n t.black_hits = 2\n end\n assert_raise(RuleViolationError) do\n t.white_hits = 2\n end\n assert_equal(1, t.black_hits)\n assert_equal(1, t.white_hits)\n\n # Testen ob der Code geandert werden darf\n t.code.push(1)\n assert_equal([1,2,3,4], t.code)\n\n end", "def test_valid_maps\r\n test = Prospect.new(0)\r\n assert_equal test.loc.name, 'Matzburg'\r\n end", "def test_new\n assert_equal({\n \"drylands\"=>\"Drylands\",\n \"savannah\"=>\"Savanna\",\n }, FakeYaml.load(sample(\"terrain_stuff_l_english\")))\n end", "def test_top_left_one_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'None'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 6, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 1 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def test_setup_map\n map = [\n ['Enumerable Canyon', 'Duck Type Beach', 'Monkey Patch City'],\n ['Duck Type Beach', 'Matzburg', 'Enumerable Canyon'],\n ['Monkey Patch City', 'Nil Town', 'Matzburg'],\n ['Nil Town', 'Hash Crossing', 'Monkey Patch City'],\n ['Matzburg', 'Hash Crossing', 'Dynamic Palisades', 'Duck Type Beach', 'Monkey Patch City'],\n ['Hash Crossing', 'Dynamic Palisades', 'Matzburg', 'Nil Town'],\n ['Dynamic Palisades', 'Hash Crossing']\n ]\n sim = Simulator.new(1, 2, 1)\n assert_equal map, sim.setup_map\n end", "def test_hash_crossing_neighbors\n assert_equal ['Matzburg', 'Nil Town', 'Dynamic Palisades'], @l.hash_crossing['neighbors']\n end", "def test_typecheck\n\t\tassert_raise( RuntimeError ) { Player.new(\"1\", \"2\", \"3\", \"4\", 5, 6, 7, {}, 9, []) }\n\t\tassert_raise( RuntimeError ) { Player.new(1, 2, \"3\", \"4\", 5, 6, 7, {}, 9, []) }\n\t\tassert_raise( RuntimeError ) { Player.new(1, \"2\", 3, \"4\", 5, 6, 7, {}, 9, []) }\n\t\tassert_raise( RuntimeError ) { Player.new(1, \"2\", \"3\", 4, 5, 6, 7, {}, 9, []) }\n\t\tassert_raise( RuntimeError ) { Player.new(1, \"2\", \"3\", \"4\", \"5\", 6, 7, {}, 9, []) }\n\t\tassert_raise( RuntimeError ) { Player.new(1, \"2\", \"3\", \"4\", 5, \"6\", 7, {}, 9, []) }\n\t\tassert_raise( RuntimeError ) { Player.new(1, \"2\", \"3\", \"4\", 5, 6, \"7\", {}, 9, []) }\n\t\tassert_raise( RuntimeError ) { Player.new(1, \"2\", \"3\", \"4\", 5, 6, 7, \"{}\", 9, []) }\n\t\tassert_raise( RuntimeError ) { Player.new(1, \"2\", \"3\", \"4\", 5, 6, 7, {}, \"9\", []) }\n\t\tassert_raise( RuntimeError ) { Player.new(1, \"2\", \"3\", \"4\", 5, 6, 7, {}, 9, \"[]\") }\n\tend", "def test_build_line_items_from_hash\n # Create a new order and put just one line item.\n setup_new_order()\n @o.order_line_items << @li\n \n # Now try to feed it with others.\n @o.line_items = {\n items(:red_lightsaber).id => {'quantity' => 2},\n items(:towel).id => {'quantity' => 1},\n items(:blue_lightsaber).id => {'quantity' => \"\"}\n }\n \n assert_equal @o.items.size, 2\n end", "def test_0020_size\n @@log.debug \"test_0020_size starts\" if @@log.debug?\n assert_equal(4, @list.size)\n @list << Person.new(\"Robert\", \"NMN\", \"Zimmerman\", 5)\n assert_equal(5, @list.size)\n @@log.debug \"test_0020_size ends\" if @@log.debug?\n end", "def verify!\n @lock.synchronize do\n left_to_right = Array.new\n begin\n node = @leftmost\n while node\n left_to_right << node\n node = node.right\n end\n end\n right_to_left = Array.new\n begin\n node = @rightmost\n while node\n right_to_left << node\n node = node.left\n end\n end\n begin\n raise \"leftmost has a left node\" if @leftmost && @leftmost.left\n raise \"rightmost has a right node\" if @rightmost && @rightmost.right\n raise \"leftmost pointer mismatch\" unless @leftmost == left_to_right.first\n raise \"rightmost pointer mismatch\" unless @rightmost == right_to_left.first\n raise \"list size mismatch\" unless right_to_left.length == left_to_right.length\n raise \"list order mismatch\" unless left_to_right.reverse == right_to_left\n raise \"node missing from list\" if left_to_right.length < @store.size\n raise \"node missing from store\" if left_to_right.length > @store.size\n raise \"store size exceeds capacity\" if @store.size > @capacity\n rescue\n $stderr.puts \"Store: #{@store}\"\n $stderr.puts \"L-to-R: #{left_to_right}\"\n $stderr.puts \"R-to-L: #{right_to_left}\"\n raise\n end\n end\n end", "def test_new_list\n ll = List::LinkedList.new\n assert_equal(nil, ll.head, \"Head should be nil for a new list\")\n end", "def test_exercise_1128\n verify_method :exercise_1128,\n :with => [{param: [0, 0, 1, 2, 3, 3], expect: [0, 1, 2, 3]},\n {param: [0, 1, 2, 3], expect: [0, 1, 2, 3]},\n {param: [0, 0], expect: [0]},\n {param: [0], expect: [0]}]\n end", "def test_creation\n up = UnitPosition.create(:x => 60, :y => 70)\n assert up.valid?\n end", "def test_content\n assert_respond_to(@table, :content)\n assert_respond_to(@table, :content=)\n assert_nothing_raised{ @table.content = 'foo' }\n assert_nothing_raised{ @table.content = 123 }\n assert_nothing_raised{ @table.content = ['one',2,'three'] }\n assert_nothing_raised{ @table.content = [['foo','bar'],[1,2,3]] }\n assert_nothing_raised{ @table.content = Table::Row.new }\n assert_nothing_raised{ @table.content = Table::Row::Data.new }\n assert_nothing_raised{ @table.content = Table::Row::Header.new }\n assert_nothing_raised{ @table.content = Table::Head.create }\n assert_nothing_raised{ @table.content = Table::Foot.create }\n assert_nothing_raised{ @table.content = Table::Body.new }\n end", "def test_array\n x = [1, \"two\", 3.0]\n assert_equal x, Marshal.load(Marshal.dump(x))\n end", "def test_initialize\n assert_equal(@vertex.edges.length, 0)\n assert_instance_of(Vertex, @vertex)\n end", "def test_create_an_empty_honeybadger_hash\n # create and empty hash with name honeybadger\n\n assert_equal ({}), honeybadger\n assert_equal true, honeybadger.empty?\n end", "def test_0930_flat_map\n @@log.debug \"test_0930_flat_map starts\" if @@log.debug?\n assert_respond_to(@list, :flat_map, \"test_0930_flat_map_respond\")\n # Need some arrays for this test .....\n part_one = [@aen, @bsb]\n part_two = [@cab, @dad]\n ary_all = [ part_one, part_two ]\n # This should be the orignal list\n cc_res = ary_all.flat_map {|pers| pers }\n 0.upto(cc_res.size-1) do |n|\n # Each element should be the same\n assert(cc_res[n] == @list[n], \"test_0930_flat_map_eltck_#{n}\")\n end\n #\n assert(cc_res == @list.to_a, \"test_0930_flat_map_eltck_all\")\n @@log.debug \"test_0930_flat_map ends\" if @@log.debug?\n end", "def test_initializing_existing_privilege_set\n assert_difference(\"PrivilegeSet.sets.length\", 1, \"Adding test PrivilegeSet\") do\n assert_difference(\"Cbac::PrivilegeSetRecord.find(:all).length\", 0, \"Record should have been added to table\") do\n PrivilegeSet.add :existing_privilege_set, \"Something\"\n end\n end\n end", "def valid?\n expected = {}\n\n count = 0\n self.each_unsafe do |k,v|\n return false if @data[k][2] != v\n count += 1\n end\n count == @data.count\n end", "def build_struct_tree data\n data.to_hashugar\n end", "def test_total_codings\n assert_equal 25, @mk.codings.size\n # assert_equal 25, @mk.codings_old.size\n # assert_equal @mk.codings.size, @mk.codings_old.size\n end", "def test_nested_quote3\n t = build_tree_on('t022-3.txt')\n assert_equal 3, t.array.size\n assert_equal 1, t.array[2].array.size\n end", "def structure_dump() end", "def test_truth\n assert_kind_of Listmember, listmembers(:first)\n end", "def test_intialize\r\n\tassert_equal 0, @test_prospector.current_gold\r\n\tassert_equal 0, @test_prospector.current_silver\r\n\tassert_equal 0, @test_prospector.total_gold\r\n\tassert_equal 0, @test_prospector.total_silver\r\n\tassert_equal 0, @test_prospector.move_count\r\n\tassert_nil @test_prospector.previous_location\r\n\tassert_equal 0, @test_prospector.num_days\r\n\tassert_equal 'Sutter Creek', @test_prospector.current_location\r\n end", "def test_truth\r\n assert_kind_of CptCategory, @categories\r\n assert_not_equal @mycategory.id, @categories.id\r\n assert_not_equal @mycategory.description, @categories.description\r\n assert_not_equal @mycategory.level, @categories.level\r\n end", "def test_4\n b = ArrayThing.new\n c = b.calcIt\n v = {\"1\"=>1, \"5\"=>1, \"2\"=>1, \"3\"=>1, \"4\"=>1}\n assert_equal c, v\n end", "def test_angel_camp_connections\n map = Map.new\n # checking if Angel camp on index @cities[1]\n # is connected with......\n #\n # First: with Nevada, it should be on index 0 of array connections\n # checking Angel camp is connected with Nevada\n # checking by name\n assert_equal 'Nevada City', map.cities[1].connections[0].name\n #\n # checking by ID\n assert_equal 0, map.cities[1].connections[0].id\n #\n # Second:\n # Checking Angel camp is connected with Sutter Creek\n assert_equal 'Sutter Creek', map.cities[1].connections[1].name\n # checking by id\n assert_equal 2, map.cities[1].connections[1].id\n #\n # Third:\n # checking Angel camp is connected with Virgina City\n # checking by name\n assert_equal 'Virginia City', map.cities[1].connections[2].name\n # checking by id\n assert_equal 3, map.cities[1].connections[2].id\n end", "def test_truth\n assert_kind_of Sample, @sample\n end", "def test_to_a\r\n assert_equal(@todos, @list.to_a)\r\n end", "def test_index # Test the [] method\n assert_raise(ArgumentError) {@root[nil]}\n\n @root << @child1\n @root << @child2\n assert_equal(@child1.name, @root['Child1'].name, \"Child 1 should be returned\")\n assert_equal(@child1.name, @root[0].name, \"Child 1 should be returned\")\n assert_equal(@child1.name, @root[-2].name, \"Child 1 should be returned\") # Negative access also works\n assert_equal(@child1.name, @root[-(@root.children.size)].name, \"Child 1 should be returned\") # Negative access also works\n\n assert_equal(@child2.name, @root['Child2'].name, \"Child 2 should be returned\")\n assert_equal(@child2.name, @root[1].name, \"Child 2 should be returned\")\n assert_equal(@child2.name, @root[-1].name, \"Child 2 should be returned\") # Negative access also works\n\n assert_nil(@root['Some Random Name'], \"Should return nil\")\n assert_nil(@root[99], \"Should return nil\")\n assert_nil(@root[-(@root.children.size+1)], \"Should return nil\")\n assert_nil(@root[-3], \"Should return nil\")\n end", "def test_make_graph\n\t\ttest_main = Main.new(3, 4, 6)\n\t\ttest_graph = Graph.new(10)\n\t\ttest_graph = test_main.make_graph(test_graph)\n\t\tassert_equal test_graph.get_loc(\"Matzburg\").paths.length, 4\n\tend", "def test_add_node_invalid\r\n reader = GraphReader.new('whatever')\r\n assert_nil reader.add_node(nil, nil, [])\r\n end", "def test_creating_public_description\n # We want to create an empty, default public description for a name that\n # doesn't have any descriptions yet -- simplest possible case.\n @name = Name.find_by(text_name: \"Strobilurus diminutivus\")\n assert_equal([], @name.descriptions)\n @description_data = {\n source_type: \"public\",\n source_name: nil,\n readable: true,\n writable: true,\n notes: \"I like this mushroom.\"\n }\n @group_expectations = {\n admins: [UserGroup.reviewers],\n writers: [UserGroup.all_users],\n readers: [UserGroup.all_users],\n authors: [],\n editors: [mary]\n }\n\n admin = open_admin_session(dick)\n reviewer = open_normal_session(rolf)\n owner = open_normal_session(mary)\n random_user = open_normal_session(katrina)\n lurker = open_lurker_session\n\n reviewer.should_be_reviewer\n owner.should_not_be_reviewer\n random_user.should_not_be_reviewer\n\n # sets (not checks) the abilities\n admin.should_be_able_to_do_anything\n reviewer.should_be_able_to_do_anything_but_change_permissions\n owner.should_be_able_to_edit_and_change_name\n random_user.should_be_able_to_edit_text_only\n lurker.should_be_able_to_see_but_needs_to_login\n\n owner.create_name_description\n owner.check_name_description\n\n admin.check_abilities\n reviewer.check_abilities\n owner.check_abilities\n random_user.check_abilities\n lurker.shouldnt_be_able_to_do_anything\n end", "def test_Hash_InstanceMethods_ElementAssignment\n\t\th = { 'a'=>100, 'b'=>200 }\n\t\th['a'] = 9; h['c'] = 4\n\t\tassert_equal({'a'=>9, 'b'=>200, 'c'=>4}, h)\n\tend", "def test_top_left_two_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'None'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 6, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end" ]
[ "0.65104234", "0.63730216", "0.63249815", "0.61823374", "0.611165", "0.6097847", "0.6084529", "0.6073607", "0.6031902", "0.60246754", "0.59982497", "0.59356844", "0.5931726", "0.5930787", "0.5921885", "0.59156555", "0.58674955", "0.5853445", "0.5841735", "0.58274615", "0.5818369", "0.5818147", "0.58168554", "0.58085114", "0.579929", "0.5792281", "0.57803154", "0.5757204", "0.57477087", "0.5746878", "0.5733414", "0.5730972", "0.57300496", "0.57300496", "0.5719828", "0.57169867", "0.57169354", "0.57149005", "0.57137084", "0.5700237", "0.5699236", "0.5697738", "0.56866896", "0.5682236", "0.5650246", "0.5629863", "0.56219506", "0.5616685", "0.5606429", "0.56055737", "0.5601617", "0.55979705", "0.55859965", "0.5583835", "0.5579405", "0.5577714", "0.5577666", "0.5565698", "0.5564304", "0.55625683", "0.5553285", "0.5552584", "0.5552574", "0.5550808", "0.5526553", "0.5526187", "0.55258894", "0.55156046", "0.55054533", "0.5504397", "0.55042523", "0.5499976", "0.5499545", "0.54915994", "0.548649", "0.5483265", "0.54816055", "0.5481487", "0.54808235", "0.54738307", "0.54693514", "0.54671395", "0.5461162", "0.5459834", "0.5458223", "0.5458147", "0.5457269", "0.5452168", "0.5452031", "0.5450934", "0.54481524", "0.54468113", "0.5446306", "0.54409766", "0.54334754", "0.54300547", "0.5429713", "0.5429326", "0.54248816", "0.5420303", "0.5408691" ]
0.0
-1
method below). Let's review how the splat operator works: The splat operator is used to create methods that have a variable parameter list i.e., they can take any number of parameters. This parameter list is, in fact, a list, and what the splat operator does is it converts that list into an array. (This is according to Ruby Monk I was under the impression that, in Ruby, a list is an array). After conversion, the array is referenced without the splat operator. But the key, again, is that it converts the parameters into an array!
def translate(string) output = Array.new # turn our string into an array words = string.split(' ') # run each element in the array through our single-world translator method words.each do |single_word| output << translate_single_word(single_word) end return output.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splat_mth(*mult_arg)\n p mult_arg #it's array :) !\n p mult_arg.class\n p mult_arg.object_id\n mult_arg.map {|arg| }\n end", "def __splat(x) end", "def roster_splat(*players)\n # Gets treated as an array\n puts players\nend", "def method_with_splat_parameter(*names)\n end", "def method_with_splat_parameter2(*names)\n end", "def *(arg0)\n end", "def *(arg0)\n end", "def not_just_splat(x, *args, y)\n puts x\n puts y\n puts args.inspect\nend", "def method(*\r\n\ta)\r\nend", "def method(*a)\r\n\ta\r\nend", "def my_function(argument_a, argument_b, *args)\n puts argument_a\n puts argument_b\n p args.class.name # this is now an array\n puts args\nend", "def parse_splat_args\n unless self.empty?\n args = self#.flatten\n case args.size\n when 1\n return args.first # if there was only one arg passed, return just that, without the array\n when 0\n return nil # if no args were passed return nil\n else\n return args # else return the array back, cause chances are that's what they passed you!\n end\n end\n end", "def splat(thing)\n (thing.is_a?(Array) ? thing : [thing]).compact\n end", "def method(*p1)\n\nend", "def varargs(arg1,*rest)\n puts \"Got #{arg1} and #{rest.join(',')}\"\nend", "def c(*list)\n list\nend", "def function(argument1, argument2, *splat)\n puts argument1\n puts argument2\n #Is there a better way to detect an empty splat argument?\n if splat == []\n puts \"empty splat!\"\n else\n #Iterate over a variable number of arguments.\n splat.each { |splat_n| puts splat_n }\n end\nend", "def sample(*a)\n a\nend", "def params(*); {}; end", "def list(*friends) # Splat (*) turns the friends parameter into an array\n p friends\nend", "def hello(name1, *name2)\n puts \"name1: #{name1}\"\n puts \"name2: #{name2.to_a}\"\nend", "def meth(arg, *args)\n [arg, args]\nend", "def f(x,*y)\nend", "def getArray _args\n \"getArray _args;\" \n end", "def mutliplied(array)\nend", "def **(arg0)\n end", "def **(arg0)\n end", "def *(mat)\n end", "def bar(arg1, arg2)\n [arg1, arg2]\nend", "def extract_argument_lists(args, splittable_args); end", "def g *args # accept multiple arguments as an array\n\targs # returns an array\nend", "def splat(*numeros)\n\tnumeros.max #devuelve el maximo de muchos parametros, los almacena en un arreglo\nend", "def varargs(arg1, *rest)\n \"arg1=#{arg1}. rest=#{rest.inspect}\"\nend", "def varargs(arg1, *rest)\n puts \"Got #{arg1} and #{rest.join(', ')}\"\nend", "def arbitrary_params( *args)\n args.each do |arg|\n puts arg\n end\n # other method of iterating through array\n # args.each { |arg| puts arg }\nend", "def mt(*p)\n puts p \nend", "def generic_method(a, b, c, *d)\n p [a, b, c]\n p d\nend", "def method(**a)\r\nend", "def my_args(first, *args, last)\n # Use the splat (i.e. *) in front of an \n # argument to take in any number of args\n # into an array (like gather in JS i.e. ...).\n # Unlike gather, it can be placed at the beginning,\n # the middle, or the end of a list of args\n puts(\"first: #{first}\")\n puts(\"args: #{args}\")\n puts(\"last: #{last}\")\nend", "def test_parallel_assignments_with_splat_operator\n first_name, *last_name = [\"John\", \"Smith\", \"III\"]\n assert_equal \"John\", first_name\n assert_equal [\"Smith\",\"III\"], last_name\n end", "def method(*a, b)\r\nend", "def tricky_method!(a_string_param, an_array_param)\n a_string_param << \", rutabega\"\n an_array_param << \"rutabega\"\nend", "def someMethod(*p)\n puts p\nend", "def someMethod(*p)\n puts p\nend", "def p(*rest) end", "def method(a, *b)\r\n\tb\r\nend", "def foo2(arg1, arg2, *other_arg) \n print arg1 \n print other_arg \n p other_arg[0]\nend", "def explore_array(method, *arguments)\n ['a', 'b', 'c'].send(method, *arguments)\nend", "def args(*) end", "def roster *players\n puts players\nend", "def *(vector)\n end", "def method(arg_1, arg_2, *other_args)\n p arg_1 # \"a\"\n p arg_2 # \"b\"\n p other_args # [\"c\", \"d\", \"e\"]\nend", "def baiseball_team *players\n puts players\nend", "def **(p0) end", "def method(arg1, arg2, *other_args)\n p arg1 # 'a'\n p arg2 # 'b'\n p other_args # []\nend", "def tricky_method!(a_string_param, an_array_param)\n a_string_param << \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def roster2 *players\n puts players\nend", "def get_arg_list\n return nil if node_type != :call\n\n sons.each do |son|\n if son.node_type == :arglist\n return son.sons.map {|arg| arg.name}.join(', ')\n end\n end\n\n return nil\n end", "def arglists\n if @call_seq then\n @call_seq\n elsif @params then\n \"#{name}#{param_seq}\"\n end\n end", "def arglists\n if @call_seq then\n @call_seq\n elsif @params then\n \"#{name}#{param_seq}\"\n end\n end", "def followers(*users)\n p users\nend", "def []=(*args); end", "def call\n @func[*@args]\n end", "def meth(\n\n\n\n *args)\n\nend", "def my_args(first, *args, last)\n # Use the splat '*' in front of an argument to take any number of args into\n # an array, just like gather (i.e. '...') in JavaScript. Unlike gather,\n # it can be placed at the beginning, middle, or end of a list of arguments.\n puts \"first: #{first}\"\n puts \"args: #{args}\"\n puts \"last: #{last}\"\nend", "def split_apart(first, *splat, last)\n puts \"First: #{first}, splat: #{splat}, last: #{last}\"\nend", "def %(*args); end", "def %(*args); end", "def preprocess_args(*a)\n a\n end", "def array_converter(*args)\n \nend", "def method(arg_1, arg_2, *other_args)\n p arg_1 # \"a\"\n p arg_2 # \"b\"\n p other_args # []\nend", "def split_apart(first, *splat, last)\n puts \"First: #{first.inspect}, splat: #{splat.inspect}, \" +\n \"last: #{last.inspect}\"\nend", "def split_apart(first, *splat, last)\n puts \"First: #{first.inspect}, splat: #{splat.inspect}, \" +\n \"last: #{last.inspect}\"\nend", "def *(x); end", "def squeeze!(*rest) end", "def xargs *args\r\n m = args.shift\r\n args.slice!(-1).each {|a|\r\n method(m).call(*(args + [a]))\r\n }\r\nend", "def hello(v1, *v2)\n p v1\n p v2 \nend", "def a(b:, **c)\nend", "def cast_array_for_args\n <<-CODE\n next_int;\n c->args = _int;\n t1 = stack_pop();\n if(REFERENCE_P(t1) && object_kind_of_p(state, t1, global->tuple)) {\n t1 = array_from_tuple(state, t1);\n } else if(!REFERENCE_P(t1) || !object_kind_of_p(state, t1, global->array)) {\n t2 = array_new(state, 1);\n array_set(state, t2, 0, t1);\n t1 = t2;\n }\n stack_push(t1);\n c->args += N2I(array_get_total(t1));\n CODE\n end", "def call(*args); end", "def varargs(arg1, *args)\n # \"arg1=#{arg1}, args=#{args.inspect}\"\n \"arg1 = #{arg1}, arg2 = #{args}\"\nend", "def foo(*a)\r\n puts a.object_id\r\n puts a.inspect\r\nend", "def *(other)\n end", "def sample (*test)\nputs \"The number of parameters is #{test.length}\"\n for i in 0...test.length\n puts \"The parameters are #{test[i]}\"\n end\nend", "def list2(*param)\n param.each do |x|\n puts x\n end\nend", "def param_list\n if @call_seq then\n params = @call_seq.split(\"\\n\").last\n params = params.sub(/.*?\\((.*)\\)/, '\\1')\n params = params.sub(/(\\{|do)\\s*\\|([^|]*)\\|.*/, ',\\2')\n elsif @params then\n params = @params.sub(/\\((.*)\\)/, '\\1')\n\n params << \",#{@block_params}\" if @block_params\n elsif @block_params then\n params = @block_params\n else\n return []\n end\n\n if @block_params then\n # If this method has explicit block parameters, remove any explicit\n # &block\n params = params.sub(/,?\\s*&\\w+/, '')\n else\n params = params.sub(/\\&(\\w+)/, '\\1')\n end\n\n params = params.gsub(/\\s+/, '').split(',').reject(&:empty?)\n\n params.map { |param| param.sub(/=.*/, '') }\n end", "def roster(*players)\n puts players\nend", "def concat(*args)\n args.flatten\nend", "def mixed_args(a,b,*c,d)\n puts \"\\nArguments:\"\n p a,b,c,d\nend", "def params_array_from(raw_params); end", "def extra_args; end", "def slice_args(out)\n out.shape.map {:*}\n end", "def args() return @args end", "def lcts(array)\nend", "def strip_arguments\n []\n end", "def my_method4(**args)\r\n p args\r\nend", "def [](*rest) end", "def [](*rest) end", "def double_array(array)\n # your code here\nend", "def method2(a, b, c)\n\tx = []\n\tx << a\n\tx << b\n\tx << c\nend", "def ld(arg0, arg1, *rest)\n end" ]
[ "0.80446965", "0.78312504", "0.72756314", "0.6953247", "0.68313026", "0.6747671", "0.6747671", "0.6741617", "0.6656025", "0.6627306", "0.6626141", "0.65842354", "0.65366507", "0.6451319", "0.64242405", "0.6413034", "0.64074194", "0.64009", "0.6341768", "0.63211316", "0.63146925", "0.6303925", "0.6277163", "0.62680244", "0.6261148", "0.62336546", "0.62336546", "0.62150484", "0.621315", "0.621311", "0.6211023", "0.61592376", "0.6135889", "0.6134437", "0.611392", "0.6107223", "0.61066717", "0.60977155", "0.6092055", "0.6075657", "0.606597", "0.6030858", "0.6026547", "0.6026547", "0.60205066", "0.6018498", "0.601754", "0.5982985", "0.5959139", "0.5946993", "0.5928452", "0.5897644", "0.58902633", "0.58874196", "0.58858174", "0.5876458", "0.58569735", "0.5853185", "0.58488", "0.58488", "0.58440065", "0.58426625", "0.5840516", "0.58328515", "0.5829952", "0.5825851", "0.58234626", "0.58234626", "0.5814875", "0.5795136", "0.57869357", "0.57681483", "0.5758501", "0.5750427", "0.5746977", "0.57467335", "0.5743278", "0.57190055", "0.57107925", "0.5710221", "0.5699602", "0.569505", "0.56884557", "0.56848115", "0.56832254", "0.56732136", "0.5672426", "0.5670656", "0.5667925", "0.5666255", "0.56607133", "0.5640818", "0.56219566", "0.5614108", "0.56130797", "0.559772", "0.5593499", "0.5593499", "0.55782115", "0.55621773", "0.5561427" ]
0.0
-1
can maybe remove this?
def routing_fraction_to_percentage(fraction) "#{(fraction * 100).to_i}%" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove; end", "def remove; end", "def remove; end", "def remove; end", "def private; end", "def remove!; end", "def cleanup\n super\n end", "def celebration; end", "def cleanup\n super\n end", "def placebo?; false end", "def delelte\n\n end", "def finalized; end", "def discard; end", "def discard; end", "def suivre; end", "def _after_update\n # SEQUEL5: Remove\n @this = nil\n end", "def ignores; end", "def refutal()\n end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def method_removed(*) end", "def schubert; end", "def isolated; end", "def isolated; end", "def delete_local\n super\n end", "def unrealize_self\n raise NotImplementedError\n end", "def delete_front()\n \n end", "def extra; end", "def used?; end", "def delete_variable\n super\n end", "def probers; end", "def ignore; end", "def internal; end", "def referenced; end", "def original; end", "def process_fix\n super\n end", "def surge; end", "def prepareForReuse; end", "def unquiesce \n raise NotImplementedError.new\n end", "def custom; end", "def custom; end", "def escaper=(_); end", "def escaper; end", "def offences_by; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def clear; end", "def clear; end", "def clear; end", "def clear; end", "def clear; end", "def clear; end", "def clear; end", "def remove_generic_traps\n super\n end", "def remove\n __flag__ :remove\n end", "def exclude; end", "def incomplete\r\n\r\n end", "def desist\n self.class.delete self\n end", "def dematerialize ; end", "def deletedaysedit\n end", "def cleanup!; end", "def cleanup!; end", "def delete_snat\n super\n end", "def reset\n super\n end", "def hijacked; end", "def clear\n # self\n end", "def cleanup!\n # This method may be left unimplemented if that is applicable\n end", "def remove_generic_traps_v2\n super\n end", "def delete_last()\n \n end", "def reap; end", "def private_method\n end", "def dead?; end", "def culprit\n @culprit\n end", "def discard!\n # This should be overridden by concrete adapters.\n end", "def final; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def clean_up\n end", "def clean_up\n end", "def clear!; end", "def clear!; end" ]
[ "0.6930688", "0.6930688", "0.6930688", "0.6930688", "0.6925786", "0.65174705", "0.6447831", "0.639615", "0.6348028", "0.6294986", "0.62202114", "0.61737627", "0.61397004", "0.61397004", "0.60979104", "0.608522", "0.6022501", "0.59868556", "0.59837806", "0.59837806", "0.59837806", "0.59837806", "0.597513", "0.5947621", "0.59150356", "0.59150356", "0.59006536", "0.58973646", "0.58806", "0.5876434", "0.58643967", "0.5851244", "0.58395344", "0.5835709", "0.5835563", "0.58298856", "0.5804198", "0.58032453", "0.57949156", "0.5794737", "0.5788327", "0.57879794", "0.57879794", "0.57840943", "0.5767394", "0.57502365", "0.574435", "0.574435", "0.574435", "0.574435", "0.574435", "0.574435", "0.574435", "0.574435", "0.574435", "0.574435", "0.574435", "0.574435", "0.574435", "0.574435", "0.574435", "0.574435", "0.574435", "0.574435", "0.5739512", "0.5739512", "0.5739512", "0.5739512", "0.5739512", "0.5739512", "0.5739512", "0.57374895", "0.5734545", "0.572899", "0.5727793", "0.5719554", "0.571808", "0.56987447", "0.56762505", "0.56762505", "0.5676243", "0.5667153", "0.566553", "0.56631315", "0.56597775", "0.56566274", "0.5647821", "0.5638154", "0.5633517", "0.56322336", "0.56271315", "0.562407", "0.5622863", "0.5616431", "0.5616431", "0.5616431", "0.5616431", "0.5614881", "0.5614881", "0.56080824", "0.56080824" ]
0.0
-1
0111 1100 with bit of 1 would return index of 2 0111 0011 with bit of 0 would return index of 2
def last_non_trailing(bit, n) bits = count_trailing_bits(bit, n) return nil unless bits complement_bits = count_trailing_bits(complement(bit), n, bits) return nil unless complement_bits bits + complement_bits end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pattern_indexes\n self.bits ||= 0\n array = bits.to_s(2).rjust(self.step_count, '0').chars.each_with_index.map do |value, index|\n index if value == '1'\n end\n array.compact\n end", "def bit_at_position(i)\n reg = regs.find { |reg| reg_contains_position?(reg, i) }\n if reg\n reg[i - bit_shift_for_reg(reg)]\n else\n dummy_bit\n end\n end", "def find_bit(data, idx_bit_begin_search)\n data_32bits = data.unpack('N*')\n # Mask the ignored bits with 0\n data_32bits[0] = data_32bits[0] & ((1 << (32-idx_bit_begin_search))-1) if (idx_bit_begin_search > 0)\n idx_not_null = data_32bits.find_index { |v| v != 0 }\n return nil if (idx_not_null == nil)\n not_null = data_32bits[idx_not_null]\n position_in_32bits = 0\n mask = (1 << 31)\n while ((not_null & mask) == 0)\n position_in_32bits += 1\n mask = mask >> 1\n end\n return idx_not_null*32 + position_in_32bits\n end", "def bitmap\n bit_table.flatten.each_with_index.map do |bit, index|\n [index, bit_table.transpose.flatten.index(bit)]\n end.to_h\nend", "def bitpos(key, bit, start = T.unsafe(nil), stop = T.unsafe(nil)); end", "def [](index)\n @bits[index/@@wordBits] & @bitMask[index % @@wordBits] > 0 ? 1 : 0\n end", "def bitPos2Int( b )\n (0..7).select { |i| \n true if checkBitSet(i, b)>0 \n }\n end", "def find_next_in_bitmask(bits, day, mask_length=nil, reverse=false)\n return 0 if bits == 0\n\n mask = bitmask(bits)\n\n if mask_length != nil\n while mask.length < mask_length do\n mask.push('0')\n end\n end\n\n if reverse\n day = mask.length - day\n mask = mask.reverse\n end\n\n mask.each_with_index do |_b, idx|\n if mask[(idx + day) % mask.length] == '1'\n return idx\n end\n end\n end", "def [](i)\n bit_at_position(i)\n end", "def magic_index_binary(array)\n low = 0\n high = array.length #6\n mid = (low + high) / 2 #3\n loop do\n # if array[mid] == 0 && array[0] != 0\n # return \"no magic array\"\n if array[mid] > mid\n # value at array[mid] is 5. 5 is greater than 3. So nothing to the right can be a magic index. We could still have one to the left.\n high = mid #1\n mid = (low + high) / 2 #0\n elsif array[mid] < mid\n # Nothing to the left can be a magic index. We could still have one to the right.\n low = mid\n mid = (low + high) / 2\n elsif array[mid] == mid\n return mid\n else\n break\n end\n end\nend", "def [](position)\n (@field.getbyte(position >> 3) & (1 << (byte_position(position) % 8))) > 0 ? 1 : 0\n end", "def [](j)\n\t\tif ((@bits >> j) & 1) == 1\n\t\t\treturn 1\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend", "def binary_index(array, target)\n upper = array.size - 1\n lower = 0\n\n while upper >= lower\n center = lower + (upper - lower) / 2\n\n case @comparator.call(target, array[center])\n when 0\n return center\n when 1\n lower = center + 1\n when -1\n upper = center - 1\n end\n end\n lower\n end", "def Bitwise(arr)\n output_num = ''\n arr[0].split(//).each_with_index {|char,idx| char == arr[1][idx] ? output_num << '0' : output_num << '1'}\n output_num.to_i\nend", "def [](i)\n raise ArgumentError, 'Invalid bit index' unless i >= 0 && i < size\n byte_i = i / 8\n bit_i = i % 8\n @bytes[byte_i] & (0x80 >> bit_i) > 0 ? 1 : 0\n end", "def test_007_indexing()\n TestVals.each do |sVal|\n lVal = sVal.length\n iVal_a_r = sVal.reverse.split(//).map { |bit| bit.to_i }\n bs = BitString.new(sVal)\n #\n # Let's try fetching each bit.\n #\n lVal.times do |i|\n assert_equal(iVal_a_r[i],\n bs[i],\n \"Test fetching index [#{i}] => #{iVal_a_r[i]}\")\n end\n\n #\n # Try setting each bit to its value.\n #\n bs = BitString.new(sVal)\n lVal.times do |i|\n bs[i] = iVal_a_r[i]\n assert_equal(iVal_a_r[i],\n bs[i],\n \"Test setting bit to itself \" +\n \"[#{i}] = #{iVal_a_r[i]}; [#{i}] => #{iVal_a_r[i]}\")\n end\n\n #\n # Try setting each bit to its complement.\n #\n bs = BitString.new(sVal)\n lVal.times do |i|\n pre = bs.to_s\n bs[i] = ~ bs[i]\n post = bs.to_s\n assert_not_equal(iVal_a_r[i],\n bs[i],\n \"Test setting bit to its complement \" +\n \"[#{i}] = ~[#{i}] != #{iVal_a_r[i]}\\n\" +\n \"pre=[#{pre}] post=[#{post}] sVal=[#{sVal}]\")\n end\n\n #\n # Try fetching with indices beyond the bounds.\n #\n msg = \"Test no exception from unbounded '#{sVal}'[#{lVal + 10}]\"\n assert_nothing_raised(msg) do\n bs[lVal + 10]\n end\n msg = \"Test IndexError exception from unbounded '#{sVal}'[-1]\"\n assert_raise(IndexError, msg) do\n bs[-1]\n end\n bs = BitString.new(sVal, lVal)\n msg = \"Test IndexError exception from bounded '#{sVal}'[#{lVal + 10}]\"\n assert_raise(IndexError, msg) do\n bs[lVal + 10]\n end\n msg = \"Test IndexError exception from bounded '#{sVal}'[-1]\"\n assert_raise(IndexError, msg) do\n bs[-1]\n end\n end\n end", "def get(index, numBits)\n andMask = 2**numBits - 1 # 000000001111\n andMask = andMask << (index % @@wordBits) # 000011110000\n value = @bits[index/@@wordBits] & andMask # 0000vvvv0000\n value = value >> (index % @@wordBits) # 00000000vvvv\n value\n end", "def getbit(key, offset); end", "def getbit(key, offset); end", "def [] i\n @array[i/32] & (0x80000000 >> (i + @start_bit)) != 0 ? 1 : 0\n end", "def [](pos)\n index = pos.to_int\n raise IndexError unless (1..8).cover? index\n \n @bits[8 - index]\n end", "def bitpos(key, bit, start = nil, stop = nil)\n node_for(key).bitpos(key, bit, start, stop)\n end", "def to_i\n bitmask\n end", "def [](position)\n @field[position / ELEMENT_WIDTH] & 1 << (position % ELEMENT_WIDTH) > 0 ? 1 : 0\n end", "def [](position)\n @field[position / ELEMENT_WIDTH] & 1 << (position % ELEMENT_WIDTH) > 0 ? 1 : 0\n end", "def pos_to_index(position)\n position[1] * 8 + position[0]\n end", "def input_to_index(input)\n position = input.to_i - 1 \n # ^ used gets again here, was wrong.. did gets in bin\n\n # position = position - 1\n return position\n \nend", "def [](i)\n (@v >> i) & 1\n end", "def mipsHasShiftedBaseIndexAddress(instruction)\n instruction.operands.each_with_index {\n | operand, index |\n if operand.is_a? BaseIndex and operand.scaleShift != 0\n return index\n end\n }\n -1\nend", "def checkBitSet( i, bitfield )\n bitfield & (1<<i)\n end", "def index_position_value(position)\n i=((position)/MaxBits.to_f).ceil\n p=((position-1)%MaxBits)\n v=2**p\n [i,p,v]\n end", "def compare_to_bits(section, numero)\n bits_array = [128, 64, 32, 16, 8, 4, 2, 1]\n bits_array.each do |bit|\n if section >= bit\n numero << 1\n section = section - bit\n else\n numero << 0\n end\n end\n return numero\nend", "def number_to_set_bit_positions_array(number)\n assert_non_negative(number)\n array = []\n position = 0\n while number > 0\n array << position if number & 1 == 1\n position += 1\n number >>= 1\n end\n array\n end", "def extract_bit_from_characters(characters)\n characters[@character_index][@bit_number]\n end", "def point_to_index(x,y)\n return (x*(bpp >> 3))+(y*((bpp >> 3)*(width)))\n end", "def to_i\n bitmask\n end", "def position\n # 2 ** 3 - 1\n @number & 7\n end", "def pattern_bits\n str = bits.to_s(2)\n str = str.rjust(self.step_count, '0')\n str.chars.collect{|x|x=='1'}\n end", "def binary_search(ary, value); end", "def binary_search(value)\n search_result = binary_search_internal(value)\n return search_result[0] ? search_result[1] : -1\n end", "def binary_array_to_number(arr)\n arr.reverse!\n sum = 0\n arr.map.with_index do |item, index|\n if item == 1\n if index.zero?\n sum += 1 if item == 1\n else\n sum += (index * 2)\n end\n end\n end\n sum\nend", "def aes_bit(vector, n)\n (vector >> n) & 1\n end", "def find_complement(num)\n result = 0\n\n num_bits = num.to_s(2).chars.map(&:to_i) # Convert to binary (base 2) and map to integers\n\n num_bits.reverse.each_with_index do |n, idx|\n n = n == 0 ? 1 : 0\n result += 2 ** idx * (n) # Convert to base 10\n end\n\n result\nend", "def test_big_offset_for_index\n expected = 0x0000bbbb00000000\n assert_equal expected, @index.offset_for_index(8)\n expected = 0x0000ffff00000000\n assert_equal expected, @index.offset_for_index(9)\n end", "def set_bits(n, m, i, j)\n #Reset N's bits to zero from i to j(backwards starting with 0)\n #Set M's bit to N starting from j\n\n max = ~0\n #1's till position j, then zeroes\n left_bits = max - ((1<<j)-1)\n right_bits = ((1<<i)-1)\n mask = left_bits | right_bits\n (n & mask) | (m << i)\nend", "def test(i)\n raise ArgumentError, \"argument (#{i}) should be between 0 and #{@size}\" if i < 0 or i >= @size\n (@array[get_index(i)] & (1 << (get_shift(i))))>>(get_shift(i))\n end", "def hexagonal_index\n (1 + Math.sqrt(1 + 8 * self)) / 4\n end", "def onemax(bitstring)\n sum = 0\n bitstring.size.times {|i| sum+=1 if bitstring[i].chr=='1'}\n return sum\nend", "def magic_index(array)\n array.each_with_index do |val, index|\n return index if val == index\n end\n \"no magic index\"\nend", "def calcIndex(inFields)\n index = 0\n field = 0\n @inMask.each_index do |i|\n index += inFields[i] << field\n field += @inMask[i] \n end\n index\n end", "def find_even_index(array)\n array.size.times do |i|\n left_array = array[0...i]\n right_array = array[(i+1)..-1]\n return i if left_array.sum == right_array.sum\n end\n -1\nend", "def to_set_bit_position_array\n BitMapping.number_to_set_bit_positions_array(number)\n end", "def magic_slow(arr)\n arr.each_with_index do |val, index|\n return index if val === index\n end\nend", "def onemax(bitstring)\n sum = 0 \n bitstring.size.times { |i| sum += 1 if bitstring[i].chr == '1' }\n return sum\n end", "def binary_to_int(n)\n bitset = Array.new()\n while (n > 0) do\n x = largest_power_of_2(n)\n if (x != nil)\n bitset[x] = 1\n n -= BASE ** x\n end\n end\n bitset.map! { |x| \n if (x == nil) \n x = 0\n else\n x = 1\n end\n }\n return bitset\nend", "def magic_slow(arr)\n arr.each_with_index do |val, index|\n if val === index\n return index\n end\n end\nend", "def bit(index, name, attrs = {})\n if index.is_a?(Range)\n msb = index.first\n lsb = index.last\n msb, lsb = lsb, msb if lsb > msb\n pos = lsb\n bits = (msb - lsb).abs + 1\n elsif index.is_a?(Numeric)\n pos = index\n bits = 1\n else\n fail 'No valid index supplied when defining a register bit!'\n end\n\n # Traynor, this could be more elegant\n # its just a dirty way to make the value of the\n # key in @new_reg_atts hash array (ie name) tie to\n # a value that is an array of hashes describing\n # data for each scrambled bit\n attrs = attrs.merge(pos: pos, bits: bits)\n temparray = []\n if @new_reg_attrs[name].nil?\n @new_reg_attrs[name] = attrs\n else\n if @new_reg_attrs[name].is_a? Hash\n temparray.push(@new_reg_attrs[name])\n else\n temparray = @new_reg_attrs[name]\n end\n temparray.push(attrs)\n # added the sort so that the order the registers bits is described is not important\n @new_reg_attrs[name] = temparray.sort { |a, b| b[:pos] <=> a[:pos] }\n\n end\n end", "def bit(y)\n bit?(y) ? ONE : ZERO\n end", "def find_even_index(arr)\n arr.length.times do |i|\n if arr[0...i].reduce(0, :+) == arr[i+1..-1].reduce(0, :+)\n return i\n end\n end\n -1\nend", "def getbit(key, offset)\n node_for(key).getbit(key, offset)\n end", "def input_to_index(input)\n return input.to_i - 1\n #idx = [inpu - 1]\n # return idx\nend", "def find_even_index(arr)\n return 0 if arr[1..-1].sum == 0\n for n in 1..arr.size - 1\n right = arr[n + 1..-1]\n left = arr[0..n - 1]\n return n if left.sum == right.sum\n end\n -1\nend", "def []=(index, value)\n if value == 1\n @bits[index/@@wordBits] |= @bitMask[index % @@wordBits]\n else\n @bits[index/@@wordBits] &= (@bitMask[index % @@wordBits] ^ @xorMask)\n end\n end", "def [](position)\n raise(RangeError, 'out of range') if position >= @size\n @field[position / ELEMENT_WIDTH] & 1 << (position % ELEMENT_WIDTH) > 0 ? 1 : 0\n end", "def two_sum_indices(arr, target_sum)\n complements = {}\n arr.each_with_index do |el, i|\n complement, j = complements[target_sum - el] # these will both be nil if the complement doesn't exist\n return [i, j] if complement\n\n complements[el] = [el, i]\n end\n nil\nend", "def to_i\n\t\tbits.map(&:to_s).join.to_i(2)\n\tend", "def two_sum_indices(arr, target_sum)\n complements = {}\n arr.each_with_index do |el, i|\n complement, j = complements[target_sum - el] # these will both be nil if the complement doesn't exist\n return [i, j] if complement\n \n complements[el] = [el, i]\n end\n nil\nend", "def onemax(bitstring)\n sum = 0\n bitstring.each_char {|x| sum+=1 if x=='1'}\n return sum\nend", "def index(p0) end", "def index(p0) end", "def set(index, numBits, value)\n andMask = 2**numBits - 1 # 000000001111\n andMask = andMask << (index % @@wordBits) # 000011110000\n andMask = andMask ^ @xorMask # 111100001111\n @bits[index/@@wordBits] &= andMask # bbbb0000bbbb\n valMask = value << (index % @@wordBits) # 0000vvvv0000\n @bits[index/@@wordBits] |= valMask # bbbbvvvvbbbb\n end", "def findIndex(a, x)\n\tn = a.length\n\ti = n - 1\n\tj = 0\n\twhile a[i][j] != x do\n\t\tif a[i][j + 1] <= x then\n\t\t\tj += 1\n\t\telse\n\t\t\ti -= 1\n\t\tend\n\tend\n\treturn i, j\nend", "def slow_dance(tile, tiles_array)\n tiles_array.each_with_index do |direction, idx|\n return idx if direction == tile\n end\nend", "def two_sum_binary(numbers, target)\n numbers.each_with_index do |num, i|\n j = binary_search(numbers, target - num, i+1)\n\n # +1 because we do both index1 and index2 are not zero-based\n return [i+1, j+1] unless j == -1\n end\n\n raise ArgumentError.new(\"No two sum solution\")\nend", "def find_even_index(array)\n array.length.times do |middle_idx|\n part1 = [0] \n part2 = [0]\n array.each_with_index do |num, idx|\n part1 << num if idx < middle_idx\n part2 << num if idx > middle_idx\n end\n return middle_idx if part1.reduce(:+) == part2.reduce(:+)\n end\n -1\nend", "def bam_seqi(s, i)\n (s[i >> 1].read_uint8 >> ((~i & 1) << 2)) & 0xf\n end", "def mask_bits\n mask_bits = 0\n shifted_mask = @mask_addr\n (1..32).each do |_i|\n mask_bits += 1 if (shifted_mask & 0x1) == 1\n shifted_mask = shifted_mask >> 1\n end\n return mask_bits\n end", "def bitarray(n) \n b=Array::new \n i=0 \n v=n\n while v > 0\n b[i] = (0x1 & v)\n v = v/2\n i = i + 1\n end\n return b\n end", "def index_match(array)\n # write your code here\n array.each_with_index do |num, index|\n if num == index \n return num\n end\n end\n -1\nend", "def numberOf1Bits(n)\n res = 0\n while n != 0\n n &= (n - 1)\n res += 1\n end\n return res\nend", "def binmode()\n #This is a stub, used for indexing\n end", "def changing_sequence(arr)\n pattern = arr[1] - arr[0]\n arr.each_cons(2).with_index do |(num1, num2), idx|\n return idx if (num2 - num1) * pattern < 0\n end\n -1\nend", "def count_bits(n)\r\n n.to_s(2).count \"1\"\r\nend", "def radix_mask\n (\"1\"*self.class.bit_density).to_i(2)\n end", "def binary_to_int(bitstring)\n\tint = 0\n\t#-- Loop through the chars\n\tbitstring.reverse.each_char.with_index do |char, index|\n\t\tif char != '0' && char != '1'\n\t\t\tputs \"This is not a valid binary representation. Bye.\"\n\t\t\tbreak\n\t\tend\n if char == '1'\n \tint += pow_of_2(index)\n end\n\tend\n\treturn int\nend", "def find_even_index(arr)\n i = 0\n a = 0\n b = 1\n for i in 0...arr.length\n a = arr.slice(0, i).sum\n b = arr.slice(i + 1, arr.length - 1).sum\n if a != b && i == arr.length - 1\n return -1\n elsif a != b\n i += 1\n else\n return i\n end\n end\nend", "def flag(arg_index)\n flags = opflags\n flag = nil\n # 10.divmod(10) => [1, 0] => position mode\n # 1.divmod(10) => [0,1] => immediate mode\n # 0.divmod(10) => [0,0] => all unspecified flags are position mode\n arg_index.times do\n flags, flag = flags.divmod(10)\n end\n\n FLAG_CODES[flag] || :position\n end", "def shift_bits(buffer)\n buffer.slice!(0...1).unpack('b8').first.split('').map {|b| b == '1'}\n end", "def bit_odd?(n)\n n&1 == 1\nend", "def bit\n self\n end", "def each_with_index\n\t\t@array.each_with_index do |v,i|\n\t\t\tyield v & 0x0F, i * 2 #Bottom Nibble\n\t\t\tyield (v >> 4) & 0x0F, i * 2 + 1#Top Nibble\n\t\tend\n\tend", "def ifind_magic(arr)\n return false if arr.size == 0\n s = arr[0]\n e = arr[-1]\n magic_arr = []\n i = 0\n while s < e\n return magic_arr if arr[i] != i\n if arr[i] == i\n magic_arr[i] = i\n end\n i += 1\n end\nend", "def msb\n # To find the position of\n # the most significant\n # set bit\n k = Integer(Math.log(to_i, 2))\n\n # To return the value\n # of the number with set\n # bit at k-th position\n 1 << k\n end", "def bitSwapRequired(a, b)\n\tcount = 0\n\t(a ^ b).to_s(2).split('').each do |x|\n\t\tcount += 1 if x == '1'\n\tend\n\tputs count\nend", "def check(m, nm, c1, c2)\n zero_candi = [(c1 + m) & 3, (c1 + m + 1) & 3]\n one_candi = [(c1 + nm) & 3, (c1 + nm + 1) & 3]\n # p [zero_candi, one_candi]\n if zero_candi.include?(c2) && one_candi.include?(c2)\n return -1\n elsif zero_candi.include?(c2)\n return 0\n elsif one_candi.include?(c2)\n return 1\n else\n return nil\n end\nend", "def setbit(key, offset, value); end", "def setbit(key, offset, value); end", "def count_bits(n)\r\n # TODO: Program me\r\n binary_array = []\r\n while n >= 2\r\n reminder = n % 2\r\n binary_array.unshift(reminder)\r\n n = n / 2\r\n end\r\n binary_array.unshift(n)\r\n \r\n sum = 0\r\n binary_array.each do |num|\r\n if num == 1\r\n sum += 1\r\n end\r\n end\r\n\r\n return sum\r\nend", "def input_to_index(input)\n offset = input.to_i - 1\n return offset\nend", "def count_bits(n)\n n.to_s(2).count('1')\nend", "def count_bits(n)\n n.to_s(2).count('1')\nend" ]
[ "0.70988", "0.6930983", "0.6872229", "0.67634785", "0.6759612", "0.670406", "0.66382736", "0.6523926", "0.6456194", "0.6429997", "0.63993186", "0.6375294", "0.6370808", "0.63482577", "0.63168657", "0.62618595", "0.6240477", "0.617995", "0.617995", "0.61487263", "0.6103801", "0.6059868", "0.6037408", "0.603022", "0.603022", "0.60244495", "0.6005029", "0.60031736", "0.59870595", "0.59562606", "0.5945359", "0.59402657", "0.5911739", "0.5892354", "0.58641165", "0.58395255", "0.58379924", "0.58288133", "0.5827371", "0.58035684", "0.579779", "0.5755038", "0.5752516", "0.5740098", "0.57167876", "0.57016987", "0.5696587", "0.5644465", "0.5629567", "0.5627418", "0.56039923", "0.5591491", "0.5582999", "0.55825216", "0.5577821", "0.5571891", "0.55635715", "0.55445063", "0.55298835", "0.5525698", "0.55179805", "0.5500134", "0.5490934", "0.5478389", "0.54782337", "0.54779387", "0.5470151", "0.5463583", "0.5452432", "0.5452432", "0.544805", "0.54464805", "0.5441932", "0.5440728", "0.543532", "0.5433146", "0.5430571", "0.54217684", "0.5421018", "0.54127413", "0.5412309", "0.5409452", "0.5408568", "0.5406495", "0.5400443", "0.5394518", "0.5391866", "0.53910184", "0.5389199", "0.5382976", "0.53825545", "0.53813595", "0.537601", "0.5375209", "0.5363455", "0.53574246", "0.53574246", "0.53570265", "0.5356798", "0.53564435", "0.53564435" ]
0.0
-1
1 > 0 0 > 1
def complement(bit) bit.succ % 2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AND(x,y); \tif x==1 && y==1 \tthen 1 else 0 end; end", "def >=(p0) end", "def >=(p0) end", "def >=(p0) end", "def test_bool_comparison() \n assert_equal(true, @@parser.test_run(\"\n bool chief():\n return 15 < 10^2 and 20 != 15*3\n end\"))\n\n assert_equal(false, @@parser.test_run(\"\n bool chief():\n return 100 < 10*2 or 15 + 25 < 30\n end\"))\n end", "def scalar?\n lhs == 0 and rhs == 0\n end", "def vampire_test(a,b)\n if a <= 0 and b <= 0\n false\n elsif \n \n else\n arr = (a*b).to_s.chars.map(&:to_i)\n [arr.include?(a), arr.include?(b), (arr.last != 0)].include?(false)\n end\nend", "def exercise_1111 (bool_values)\n end", "def _reduce_54(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def d(n)\n return [true, 0] if n.nil?\n return [true, 1] if n.right.nil? && n.left.nil?\n\n rb, rh = n.right ? d(n.right) : [true, 0]\n lb, lh = n.left ? d(n.left) : [true, 0]\n\n [\n rb && lb && (rh - lh).abs <= 1,\n [rh, lh].max + 1\n ]\nend", "def positive?() @positive==true end", "def temp(temp1, temp2)\n return ( temp1 < 0 && temp2 > 100 ) || ( temp1 > 100 && temp2 < 0 );\nend", "def _reduce_58(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def nonzero?\n return !zero?\n #return pvr!=0 || pbr!=0 || ppr!=0 || mrs!=0 || idr!=0 || mid!=0 || ifr!=0 || other!=0\n end", "def logical(input)\n if @invert\n if input == 0\n return true\n else\n return false\n end\n else\n if input == 0\n return false\n else\n return true\n end\n end\n end", "def nonpositive?\n return self <= 0\n end", "def _reduce_53(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_53(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_53(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def equal?(p0) end", "def _reduce_36(val, _values, result)\n result = logical_op :and, val[0], val[2]\n \n result\nend", "def _reduce_36(val, _values, result)\n result = logical_op :and, val[0], val[2]\n \n result\nend", "def from_binary(n)\n# puts \"\\n\\n#{n} => #{n && n!=0}\\n\\n\"\n n && n!=0\nend", "def from_binary(n)\n# puts \"\\n\\n#{n} => #{n && n!=0}\\n\\n\"\n n && n!=0\nend", "def _reduce_51(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_51(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_51(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def test\n\t\t@a+@b > @c && @a+@c > @b && @b+@c > @a\n\tend", "def truthiness(x, y)\r\n puts \"AND: \", x && y\r\n puts \"OR: \", x || y\r\n puts \"!AND: \", !(x && y)\r\n puts \"!OR: \", !(x || y)\r\nend", "def nonzero?() end", "def OF_CHECKING(a,b,sum) \n\tAND(XOR(sum,a),NOT(XOR(a,b)))\nend", "def <=(p0) end", "def _reduce_52(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_52(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_52(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_52(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_52(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_52(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_52(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def all_negatives?(nums)\n nums.each { |element| return false if element >= 0 }\n true\nend", "def test_compound_branch_w_3_terms_t_t_assign\n assert interpret('var=0; true && true || var=99; :var').zero?\n end", "def pure? \r\n\t\tif self.positives == 0 && self.negatives != 0\r\n\t\t\treturn true\r\n\t\telsif self.negatives == 0 && self.positives != 0\r\n\t\t\treturn true\r\n\t\telse return false\r\n\t\tend\r\n\tend", "def same_sign?(number, number2)\n return (number * number2 > 0 or (number >= 0 and number2 >= 0))\nend", "def power_of_two?(x)\n x > 0 && x & (x - 1) == 0\nend", "def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def abundant?(num)\nend", "def =~(p0) end", "def =~(p0) end", "def =~(p0) end", "def ===(p0) end", "def ===(p0) end", "def ===(p0) end", "def ===(p0) end", "def value?(p0) end", "def triple_expression?; false; end", "def true_comparitons\n ['be','is','are','were','=','>','>=','==','<=','<','=<','gt','lt','eq','bigger','greater','equals','identical to',\n 'smaller','less','equal to','more','less','the same as','same as','similar']\n end", "def _reduce_41(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_41(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def all_zeros?(numbers = [])\n # numbers.none? { |number| !number.zero? }\n numbers.all?(&:zero?)\nend", "def _reduce_47(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_47(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend", "def truthTest\r\n truth = [true, false]\r\n truth.each do |t|\r\n if (t)\r\n return true\r\n end\r\n end\r\n return false\r\nend", "def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def func1(val) # adds brackets - good practice\r\n if val == 1 # uses == comparator\r\n return true\r\n else\r\n return false\r\n end\r\nend", "def _reduce_34(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def ayarla(toplam)\n if toplam > 0\n return 1\n else\n return 0\n end\n end", "def trueish?\n %w(1 t).include? self\n end", "def >=(arg0)\n end", "def >=(arg0)\n end", "def _reduce_41(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend", "def _reduce_48(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_48(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def exprand()\n -1 * $gap * Math.log(ran01())\nend", "def _reduce_53(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def ==(p0) end", "def ==(p0) end", "def ==(p0) end", "def ==(p0) end", "def ==(p0) end", "def ==(p0) end", "def ==(p0) end", "def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend", "def _reduce_34(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend", "def torf(n)\n if n==0 or n==false\n return false\n else\n return true\n end\nend", "def abundant?(num)\n\nend", "def abundant?(num)\n\nend", "def pitagoric_triplet?(a,b,c)\n (a**2 + b**2) == c**2\nend", "def And(a, b)\n return a && b\nend", "def _reduce_53(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend", "def check_de_morgan_law_1\n a = Z3.Bool(\"a\")\n b = Z3.Bool(\"b\")\n solver = Z3::Solver.new\n puts \"Proving ~(a & b) == (~a | ~b)\"\n solver.prove!(~(a & b) == (~a | ~b))\nend", "def strictly_regular?\n left_regular? || right_regular?\n end", "def to_bool\n if (self.to_bool == 1)\n puts \"TRUE\"\n elsif (self.to_bool == 0)\n puts \"FALSE\"\n elsif (self.to_bool == -1)\n puts \"NaN\"\n end\nend", "def all_same?(first_operand, arglist)\n if arglist.empty?\n boolean(true)\n else\n first_value = first_operand.value\n all_equal = arglist.all? { |elem| first_value == elem.value }\n boolean(all_equal)\n end\n end", "def process_true(exp)\n return \"1\"\n end", "def negetive?(number) #the arguement number is whats in the bracket and it represents that negetive? accepts number\n puts number < 0 #rememeber you want the booleans true to be written when you have a - number and a number less than 0\nend" ]
[ "0.68845797", "0.6681568", "0.6681568", "0.6681568", "0.6445873", "0.6403389", "0.63838816", "0.62224865", "0.62165505", "0.61382884", "0.6125198", "0.61182415", "0.61098206", "0.6108412", "0.6105042", "0.61028147", "0.6076946", "0.6076946", "0.6076946", "0.6061469", "0.6039375", "0.6039375", "0.6032232", "0.6032232", "0.60234606", "0.60234606", "0.60234606", "0.60203576", "0.59790736", "0.5970618", "0.5945318", "0.59408814", "0.59389037", "0.59389037", "0.59389037", "0.59389037", "0.59389037", "0.59389037", "0.59389037", "0.5881053", "0.5876338", "0.5873903", "0.5859905", "0.5857434", "0.58489144", "0.58489144", "0.58489144", "0.5848814", "0.5844823", "0.5844823", "0.5844823", "0.58393395", "0.58393395", "0.58393395", "0.58393395", "0.58350307", "0.5825692", "0.58252674", "0.5823811", "0.5823811", "0.58234864", "0.5818905", "0.5818905", "0.58168066", "0.58145493", "0.5813128", "0.5813128", "0.5813128", "0.5813128", "0.5812351", "0.5807885", "0.5804102", "0.5801121", "0.5799802", "0.5799802", "0.578966", "0.5784326", "0.5784326", "0.57841945", "0.5776802", "0.5776629", "0.5776629", "0.5776629", "0.5776629", "0.5776629", "0.5776629", "0.5776629", "0.5773938", "0.57696563", "0.5763179", "0.5734937", "0.5734937", "0.5731083", "0.57300586", "0.57292336", "0.5721368", "0.5713899", "0.571162", "0.57012445", "0.5696707", "0.56913805" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_episode @episode = Episode.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Execute the right command depending on the :command parameter passed in +options+. If the command does not exit, throw an error.
def run(options) raise ArgumentError, 'Please give a name to the project.' unless options[:name] case options[:command] when 'new' project_details = define_project(options) project_command = Mvnizer::Command::ProjectFactory.create(project_details.type) project_command.run(project_details) out.puts("Project #{project_details.artifact_id} created successfully.") when 'search' search_command = Command::SearchArtefact.new search_command.run(options) when 'add' add_command = Command::AddDependency.new add_command.run(options) else raise ArgumentError, "#{options[:command]} is not a valid command." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_option_or_command(options, command, args)\n options[:execute] ? eval_execute_option(options[:execute]) :\n execute_command(command, args)\n end", "def run_command(command, options = {})\n status = run(command, options)\n fail \"#{command} failed\" unless status\nend", "def run_command(command, options = {})\n status = run(command, options)\n fail \"#{command} failed\" unless status\nend", "def execute(opt, argv)\n fail \"#{self.class.command} not implemented\"\n end", "def cmd!(cmd, options={})\r\n fail\r\n end", "def run(options={})\n formatter = get_formatter(options)\n @output, success = run_command(cmd(options), formatter)\n\n return false unless success\n return check_for_output(formatter)\n end", "def execute_command(command, options = {})\n executor = options[:execpipe] || method(:execpipe)\n args = [command]\n args << options[:failonfail] if options.include?(:failonfail)\n executor.call(*args) { |pipe| yield pipe }\n end", "def execute command\n log command\n system(command) unless @options[:test]\n end", "def run(_options)\n raise \"command '#{name}' is not implemented\"\n end", "def execute!(command, options)\n # Build up the arguments to pass to connection.execute!\n arguments = [command, name, *arguments_for(command)]\n arguments << \"--color\" if options[:color]\n if options[:provider]\n arguments << \"--provider\"\n arguments << options[:provider]\n end\n\n if options[:log_mode]\n arguments << {:mode => options[:log_mode]}\n end\n\n # Set up the block to use when executing -- if logging is\n # enabled, use a block that logs the output; otherwise no block.\n block = options[:log] ? shell_log_block : nil\n\n # Execute the command\n connection.execute! *arguments, &block\n end", "def exec!(cmd, options={})\n exit_status, stdout, stderr, cmd = exec(cmd, options)\n error_msg = options[:error_msg] || \"The following command exited with an error\"\n raise Appd::RemoteError.new(stdout, stderr, exit_status, cmd), error_msg if exit_status != 0\n return stdout\n end", "def execute_command_from_command_line\n cmd = ARGV[0]\n if not cmd\n puts CMD_LINE_HELP\n elsif OPERATION_NAMES.include?(cmd) && !options.force_command\n begin\n self.send(*ARGV)\n rescue ArgumentError => ex\n $stderr.puts \"Wrong number of arguments (#{ARGV.size-1}) for operation: #{cmd}\"\n end\n else\n send_roku_command cmd\n end\n end", "def run\n if parsed_options? && arguments_valid? \n process_arguments \n process_command\n else\n output_options\n end\n end", "def execute_command!(*argv)\n execute_command(argv)\n raise Error.new(\"Command failed!\") unless $?.success?\n end", "def execute_with_exit(command) # rubocop:disable Lint/UnusedMethodArgument\n end", "def run!\n if self.class.commands.include?(@command)\n run_command\n elsif @command.nil?\n puts \"Command required\"\n puts @parser\n exit 1\n else\n abort \"Unknown command: #{@command}. Use one of #{self.class.commands.join(', ')}\"\n end\n end", "def run(command, options = {:desc => '', :get_output_string => false})\n puts options[:desc]\n puts \"Executing: #{command}\"\n\n if options[:get_output_string]\n result = `#{command}`\n else\n command << \" > /dev/null\" if command # Not show output details to stdout\n result = system(command)\n end\n\n report(result)\n end", "def execute(command)\n if valid_command?(command)\n apply_command(command)\n else\n return 'Invalid command.'\n end\n end", "def plain_command cmd, options={}\n system(cmd)\n exitstatus = $?.exitstatus == 0 || $?.exitstatus == 1\n show_output(exitstatus, options)\n exitstatus\n end", "def execute(cmd, options = T.unsafe(nil)); end", "def run\n \n if parsed_options?\n \n process_command\n end\n \n end", "def run\n\n if parsed_options? && arguments_valid? \n process_arguments \n process_command\n else\n output_usage\n end\n\n end", "def run!\n trace = false\n require_program :version, :description\n\n global_option('-h', '--help', 'Help on any command', :hide => true)\n global_option('--version', 'Display version information', :hide => true)\n\n # special case --debug so all commands can output relevant info on it\n $terminal.debug = options_parse_debug\n\n # special case --trace because we need to use it in the runner\n trace = options_parse_trace\n\n # special case --version so it is processed before an invalid command\n options_parse_version\n\n # help is a special branch prior to command execution\n options_parse_help\n\n unless trace\n begin\n run_active_command\n rescue InvalidCommandError => e\n run_help(provided_arguments)\n rescue \\\n OptionParser::InvalidOption => e\n RHC::Helpers.error e.message\n 1\n rescue \\\n ArgumentError,\n OptionParser::ParseError => e\n\n help_bindings = CommandHelpBindings.new(active_command, commands, self)\n usage = RHC::HelpFormatter.new(self).render_command_syntax(help_bindings)\n message = case e\n when OptionParser::AmbiguousOption\n \"The option #{e.args.join(' ')} is ambiguous. You will need to specify the entire option.\"\n else\n e.message\n end\n\n RHC::Helpers.error message\n say \"#{usage}\"\n 1\n rescue RHC::Exception, RHC::Rest::Exception => e\n RHC::Helpers.error e.message\n e.code.nil? ? 128 : [1, (e.code || 1).to_i].max\n end\n else\n run_active_command\n end\n end", "def run\n if parsed_options? && arguments_valid? \n process_arguments \n process_command\n else\n output_usage\n end\n end", "def run\n if options_valid? && option_combinations_valid? \n process_arguments \n process_command\n else\n output_usage\n end\n end", "def remote\n log_and_exit read_template('help') if options.empty?\n \n # Attempts to run the specified command\n run_remote_command(options[0])\n end", "def cmd(options={})\n env = merge_option(:environment, options)\n spawn_options = merge_option(:spawn_options, options)\n mk_cmd(env, arguments, spawn_options)\n end", "def execute_command(target, command, options, *args)\n context = CommandContext.new\n\n # set some useful methods to be used by the action blocks\n context.opts = options\n context.target = target\n context.output = output\n context.command_set = commands\n\n context.command_processor = self\n\n ret = commands.run_command(context, command, *args)\n\n # Tick, tock, im getting rid of this shit soon.\n options[:val].clear\n\n ret\n end", "def execute(options = {})\n \n ah = argument_hash.clone\n ah.store(:data, data) if data\n\n begin\n unless class_name.classify.constantize.send(method_name.to_sym, ah)\n self.status = STATUS_ERROR\n self.error_message = \"called method returned false\"\n end\n rescue Exception => e\n self.status = STATUS_ERROR\n self.error_message = \"class or method does not exist\" + e.to_s\n end\n \n # If we have an error, do not run anything in this group (halt the chain)\n if error?\n self.status = STATUS_SKIPPED if skip_on_error\n else\n self.status = STATUS_COMPLETED\n self.data = nil unless !!options[:keep_data]\n end\n end", "def run_command(cmd, options={})\n FudgeMatchers::Run.new cmd, options\nend", "def run\n if @options['file']\n execute_script @options['file']\n elsif @options['command']\n execute @options['command']\n else\n interactive_shell\n puts \n end\n end", "def exec(command, options = {})\n output = nil\n errors = options[:errors]\n verbose = self.verbose || options[:verbose]\n command = \"sudo -n #{command}\" if options[:sudo]\n\n puts command if verbose\n Open3.popen3(command) do |i,o,e,t|\n if t.value.success?\n output = o.read\n else\n error = e.read\n warn \"Warning: #{error}\" if verbose\n raise Errors::InterfaceOperationError, error if errors\n end\n end\n output\n end", "def exec_command(cmd, output=nil, options={})\n # Local map has precedence.\n set_options(options)\n Scutil.exec_command(@hostname, @username, cmd, output, @options)\n end", "def sh(command,options={},&block)\n sh_logger.debug(\"Executing '#{command}'\")\n\n stdout,stderr,status = execution_strategy.run_command(command)\n process_status = OptparsePlus::ProcessStatus.new(status,options[:expected])\n\n sh_logger.warn(\"stderr output of '#{command}': #{stderr}\") unless stderr.strip.length == 0\n\n if process_status.success?\n sh_logger.debug(\"stdout output of '#{command}': #{stdout}\") unless stdout.strip.length == 0\n call_block(block,stdout,stderr,process_status.exitstatus) unless block.nil?\n else\n sh_logger.info(\"stdout output of '#{command}': #{stdout}\") unless stdout.strip.length == 0\n sh_logger.warn(\"Error running '#{command}'\")\n end\n\n process_status.exitstatus\n rescue *exception_meaning_command_not_found => ex\n sh_logger.error(\"Error running '#{command}': #{ex.message}\")\n 127\n end", "def exec(command, options={})\n return destination_server.run(command, options)\n end", "def run\n # puts arguments_valid?\n if parsed_options?\n puts \"Start at #{DateTime.now}\" if verbose?\n\n output_options if verbose?\n\n process_command\n\n puts \"\\nFinished at #{DateTime.now}\" if verbose?\n else\n puts 'The options passed are not valid!'\n end\n end", "def run(options)\n fail_if_right_agent_is_not_running\n check_privileges\n set_logger(options)\n missing_argument unless options.include?(:action)\n # Don't use send_command callback as it swallows exceptions by design\n res = send_command(build_cmd(options), options[:verbose], options[:timeout])\n\n case options[:action]\n when :get_tags\n get_tags(res, options)\n when :query_tags\n query_tags(res, options)\n when :add_tag\n add_tag(res, options)\n when :remove_tag\n remove_tag(res, options)\n else\n write_error(res)\n end\n rescue SystemExit => e\n raise e\n rescue Exception => e\n fail(e)\n end", "def exec_shell(command, error_message, options = {})\n puts \"Running command: #{command}\" unless options[:silent] == true\n result = `#{command}`\n if options[:dont_fail_on_error] == true\n puts error_message unless $?.success?\n else\n fail_script_unless($?.success?, \"#{error_message}\\nShell failed: #{command}\\n#{result}\")\n end\n\n return result\n end", "def start_exec(command, options)\n all_args = command.args\n all_args << options\n self.send(command.name, *all_args)\n end", "def start_exec(command, options)\n all_args = command.args\n all_args << options\n self.send(command.name, *all_args)\n end", "def exec(command, options={})\n ssh.exec(command, options)\n end", "def run\n raise \"`#{ real_command }' failed\" unless Kernel.system( real_command )\n end", "def run\n _cmd = built_in_command( options[:args] )\n _cmd ||= options[:command] ? CommandRunner.new(options[:command]) : 0\n if _cmd.class == CommandRunner\n _cmd.run do |item|\n puts \"%s:\\n %s\\n\\n\" % [ item.class, item.desc ] if item.is_a?(UseCase) && ENV['ENVIRONMENT'] != 'test'\n end\n else\n _cmd\n end\n end", "def assert_command_ran_with(expected_command,options)\n lambda {\n global_options = options[:global_options] || { :help => false }\n @run_results.each do |command,results|\n if command == expected_command\n assert_equal(indifferent_hash(global_options),results[0])\n assert_equal(indifferent_hash(options[:command_options]),results[1])\n assert_equal(options[:args],results[2])\n else\n assert_nil results\n end\n end\n }\n end", "def run\n raise Error, \"Unknown command `#{command_name}`\"\n end", "def execute(command)\n system command\n code = $?.exitstatus\n if code > 0\n LOGGER.warn \"Failed to execute command `#{command}` with code #{code}.\"\n false\n else\n true\n end\n end", "def check_for_errors(options)\n # Check that user is root.\n if Process.uid != 0\n puts(\"xlxc-execute.rb must be run as root.\")\n exit\n end\n\n # Check that there are no conflicts with the container name.\n name = options[:name]\n\n if name == nil\n puts(\"Specify name for container using -n or --name.\")\n exit\n end\n\n if ARGV.length <= 0\n puts(\"Specify a command to run in the container.\")\n exit\n end\nend", "def system (*command_and_options)\n if command_and_options[-1].respond_to?(:has_key?)\n command = command_and_options[0...-1]\n options = command_and_options[-1]\n else\n command = command_and_options\n options = {}\n end\n\n raise ArgumentError.new('wrong number of arguments') if command.empty?\n\n if options[:verbose]\n if command.size == 1\n $stderr.puts command[0]\n else\n $stderr.puts command.collect { |word|\n Escape.shell_single_word word\n }.join(' ')\n end\n end\n\n if not options[:noop]\n Kernel.system(*command)\n end\n end", "def run(host, command, options = {})\n execute(__method__, host, command, options)\n end", "def execute_multipass_command(options)\n command = options['command'].to_s \n\texists = check_multipass_vm_exists(options)\n\tif exists == true\n command = \"multipass exec #{options['name']} -- bash -c \\\"#{command}\\\"\"\n\t\toutput = %x[#{command}]\n\t\thandle_output(options,output)\n\telse\n\t\thandle_output(options,\"Information:\\tMultipass instance #{options['name']} does not exist\")\n\tend\n return\nend", "def execute_command(target, command, options, *args)\n context = CommandContext.new\n\n # set some useful methods to be used by the action blocks\n context.opts = options\n context.target = target\n context.target_self = target.eval('self')\n context.output = output\n context.captures = options[:captures]\n context.eval_string = options[:eval_string]\n context.arg_string = options[:arg_string]\n context.command_set = commands\n context._pry_ = @pry_instance\n\n context.command_processor = self\n\n ret = commands.run_command(context, command, *args)\n\n options[:val].replace(\"\")\n\n ret\n end", "def run!(**options)\n interaction = run(options)\n raise error_class.new(interaction.error) unless interaction.success?\n interaction.result\n end", "def exec?(cmd, options={})\n exit_status, stdout, stderr, cmd = exec(cmd, options)\n return (exit_status == 0)\n end", "def run\n if !options_parsed?() || !options_valid?()\n @stderr.puts(\"\")\n output_usage(@stderr)\n return 1\n end\n return run_real()\nend", "def process(options = {})\n command = command_line(options)\n Kernel.system(command)\n end", "def process; raise CommandError, \"command '#{command_name}' not implemented\" end", "def run_command(cmd, *options, **shellout_options)\n so = Mixlib::ShellOut.new(create_command(cmd, *options), shellout_options)\n so.run_command\n so.error!\n so\n rescue Mixlib::ShellOut::ShellCommandFailed => e\n # Knife commands can include the password, so show a redacted version\n # of the command line along with the exit code, instead of the mixlib output\n pwd_index = options.index(\"--ssh-password\")\n options[pwd_index+1] = \"(hidden)\" if pwd_index && options.length > pwd_index+1\n redacted_cmd = create_command(cmd, options)\n message = \"#{redacted_cmd} returned #{so.exitstatus}\"\n if so.stderr\n message += \"\\n***********\\n\"\n message += so.stderr\n message += \"***********\\n\"\n end\n raise Runner::Exceptions::KnifeCommandFailed.new(message)\n end", "def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end", "def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end", "def run_command(arguments)\n raise \"Specified command did not implement 'run_command' method.\"\n end", "def invoke_command(cmd, options={}, &block)\n options = options.dup\n via = options.delete(:via) || :run\n send(via, cmd, options, &block)\n end", "def execute_command(cmd, options = {})\n if options[:in]\n options[:in].write(:text => \"#{cmd}\")\n else\n active_window.write(:text => \"#{cmd}\")\n end\n end", "def execute_subcommand(subcommand_name, arguments, options)\n subcommand = to_command(subcommand_name).new\n do_with_interrupt_handling { subcommand.command(arguments, options) }\n end", "def cmd(command, options = {})\n options[:sudo] = options[:sudo] != false\n errors = options[:errors]\n options[:errors] = true\n begin\n exec(\"/sbin/ip #{command}\", options)\n rescue Errors::InterfaceOperationError => e\n case e.message\n when /operation not permitted/i, /password is required/i\n raise Errors::InterfacePermissionError, \"Operation not permitted\"\n else\n raise if errors\n end\n end\n end", "def exec(cmd, options = {})\n Git.invoke :before_read\n\n options = {\n '-f' => @file\n }.merge(options)\n\n params = ''\n options.each do |key, val|\n params << \" #{key} #{Escape.shell_single_word(val)}\"\n end\n\n command = \"#{bin} #{params} #{cmd}\"\n\n `#{command}`.rstrip\n end", "def run_cmd(cmd)\n puts blue(cmd)\n raise unless system cmd\n end", "def process_command(cmd, args)\n commands.each do |command, options|\n if (options[:case_sensitive] && cmd == command) ||\n (!options[:case_sensitive] && cmd.downcase == command.downcase)\n #return options[:block].call(args)\n return instance_exec(args, &options[:block])\n end\n end\n throw :command_not_found\n end", "def execute\n\n if @main_args.include?(\"-h\") || @main_args.include?(\"--help\")\n # Print the help for all the box commands.\n return help\n end\n\n # Currently we can only work with a single VM environment\n raise Errors::SingleVMEnvironmentRequired if @env.multivm?\n\n # Run the appropriate subcommand\n case @sub_command\n when 'sync'\n return execute_sync\n when 'monitor'\n return execute_monitor\n when nil\n return execute_monitor\n else\n return help\n end\n end", "def run_command(command)\n if command and respond_to?(command)\n send(command)\n else\n log_and_exit read_template('help')\n end\n end", "def run\n\t\tif parsed_options? && arguments_valid?\n\t\t\toutput_options if @options[:verbose]\n\t\t\toutput_arguments if @options[:verbose]\n\t\t\tprocess_arguments\n\t\t\tprocess_command\n\t\telse\n\t\t\toutput_usage\n\t\tend\n\tend", "def execute(command, opts=nil)\n end", "def run_command(command, options={})\n timeout = options[:timeout] || 7200\n\n # default to adding a nice 13 if nothing specified\n nice = if options.key?(:nice)\n (options[:nice] == 'n') ? '' : \"nice -n #{options[:nice]} \"\n else\n 'nice -n 19 '\n end\n\n echo_return = (options.key?(:echo_return) && !options[:echo_return]) ? '' : '; echo $?'\n\n cmd = \"#{nice}#{command}#{echo_return}\"\n\n logger.info \"run_command: #{cmd}\"\n begin\n result = Timeout::timeout(timeout) {\n Open3::popen3(cmd) do |i,o,e|\n out_str = \"\"\n err_str = \"\"\n i.close # important!\n o.sync = true\n e.sync = true\n o.each{|line|\n out_str << line\n line.chomp!\n logger.debug \"stdout: #{line}\"\n }\n e.each { |line|\n err_str << line\n line.chomp!\n logger.debug \"stderr: #{line}\"\n }\n return out_str, err_str\n end\n }\n rescue Timeout::Error => toe\n logger.error \"run_command:Timeout Error - running command, took longer than #{timeout} seconds to execute: '#{cmd}'\"\n raise toe\n end\n end", "def run_command(command)\n args = command [1..-1]\n case command[0]\n when 'q', 'quit' then @running = false\n when 'help', '?' then puts HELP\n when 'create' then create_object(args)\n when 'add-station' then add_station(args)\n when 'remove-station' then remove_station(args)\n when 'add-wagon' then add_wagon(args)\n when 'remove-wagon' then remove_wagon(args)\n when 'stations' then stations\n when 'assign' then assign(args)\n when 'trains' then trains(args)\n when 'move' then move(args)\n when 'require' then occupy(args)\n when 'take-seat' then take_seat(args)\n when 'wagons' then wagons(args)\n when 'producer' then producer(args)\n else\n raise TUIException, \"There is no command '#{command[0]}'\"\n end\n end", "def execute(command, options = { })\n defaults = { :out_console => true }\n options = defaults.merge(options)\n # open a new channel and configure a minimal set of callbacks, then run\n # the event loop until the channel finishes (closes)\n last_exit = -1\n channel = session.open_channel do |ch|\n\n #request pty for sudo stuff and so\n ch.request_pty do |ch, success|\n raise \"Error requesting pty\" unless success\n end\n \n ch.exec \"#{command}\" do |ch, success|\n raise \"could not execute command\" unless success\n\n\n # \"on_data\" is called when the process writes something to stdout\n ch.on_data do |c, data|\n STDOUT.print data if options[:out_console]\n\n end\n\n # \"on_extended_data\" is called when the process writes something to stderr\n ch.on_extended_data do |c, type, data|\n STDOUT.print data if options[:out_console]\n end\n\n channel.on_request(\"exit-signal\") do |ch, data|\n last_exit = data.read_long\n end\n\n channel.on_request(\"exit-status\") do |ch,data|\n last_exit = data.read_long\n end\n\n end\n end\n channel.wait\n last_exit\n end", "def execute_command(*args)\n if args.size < 2\n display_help\n exit(1)\n end\n \n command_class = Command.commands[args.first]\n \n if command_class\n command_class.command(self,*(args[2..-1]))\n else\n display_help\n exit(1)\n end\n end", "def run_command(*command)\n print_command command\n result = system *command\n if result.nil?\n puts \"Failed to run command.\"\n exit 255\n elsif !result\n exit $?.exitstatus\n end\nend", "def run_ssh(options, command)\n return false, '' if options[:user].nil?\n return false, '' if options[:server].nil?\n return false, '' if options[:user].empty?\n return false, '' if options[:server].empty?\n return false, '' if options[:user].match(/^deny/)\n return false, '' if options[:server].match(/^deny/)\n\n if options[:user].match(/^allow/) and options[:server].match(/^allow/)\n success, output = run_external(command, options, SETTINGS[:project])\n return success, output\n end\n\n raise ArgumentError.new(\"Invalid settings or code - this shouldn't happen.\")\n end", "def execute_command(executor, command, options = {}) # :doc:\n log executor, command\n env = options[:env] || ENV[\"RAILS_ENV\"] || \"development\"\n sudo = options[:sudo] && !Gem.win_platform? ? \"sudo \" : \"\"\n config = { verbose: false }\n\n config[:capture] = options[:capture] if options[:capture]\n\n in_root { run(\"#{sudo}#{extify(executor)} #{command} RAILS_ENV=#{env}\", config) }\n end", "def option_command?\n options || @option_command\n end", "def exec(_cmd, _args = {})\n false\n end", "def execute(*command)\n UI.say \"=> #{command.join(' ')}\".color(:green)\n success = system(*command)\n unless success\n UI.error(command.join(' '))\n exit 1\n end\n end", "def execute\n cli_options = OptionManager.new.execute\n argv = parse_options(cli_options[:parser])\n \n return unless argv\n \n if [nil, ''].include? cli_options[:values][:cmd]\n env.ui.info cli_options[:parser]\n else\n with_target_vms(argv) do |machine|\n manage_machine(machine, cli_options) \n end\n end\n 0\n end", "def parse_options!(args)\n option_parser.parse!(args)\n\n if args.empty?\n abort(\"You must give exactly one command to execute.\")\n else\n @options.command = args.join(\" \")\n end\n end", "def run command\n # unless command\n # command = \" \\\"#{@args.join(\"\\\" \\\"\")}\\\"\" if args.any?\n # @switches.each{ |opt| command += \" --#{opt.to_s}\" }\n # @options.each { |opt, val| command += \" --#{opt.to_s} \\\"#{val}\\\"\" }\n # end\n return if command.nil? || command.strip.empty?\n command += \" 2>&1\"\n command += \" >/dev/null\" unless @capture || @output\n\n output = `#{self.path} #{command}`.strip\n puts output.gsub(/^/, \" -- \") if @output\n\n self.reset_for_next_command\n output\n end", "def cleanup\n options = []\n options += ['-q', '--no-verbose'] unless Kontena.debug?\n command.handle_options options\n command.execute\n true\n rescue Gem::SystemExitException => e\n raise unless e.exit_code.zero?\n true\n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n if process_arguments == false\n return\n end\n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def execute command\n if command_exists?\n eval \"Command::#{command}.new.init\"\n else\n raise UnknownCommand, \"Error: unknown command '#{command.downcase.to_s}'.\\nTry --help for help.\"\n end\n end", "def execute(command) # rubocop:disable Lint/UnusedMethodArgument\n end", "def log_command(status, options = {})\n command = options[:command] || status.command\n \n log_command_line(command, status.success?)\n log_command_status(status)\n \n overall_error! if current_host && !status.success?\n end", "def interpret_command(*args)\n format = nil\n command = nil\n if args.last.is_a? Hash\n options = args.last\n ca = (options[:args] || []).join(' ')\n command = \"#{options[:command]} #{ca}\".strip.to_sym\n format = options[:format]\n else\n command = args.last.to_sym\n end\n\n if %i[exit quit].include?(command)\n if (@exit_command_counter == 0) && !exit_ok?\n @exit_command_counter += 1\n logger.warn { \"You have running load agents: terminate first or #{command} again\" }\n else\n puts 'Bye'\n @exit_command_counter = -1 # \"express\" exit\n end\n\n else\n @exit_command_counter = 0 # reset exit intention\n match_data = nil\n grammar.each do |rule|\n match_data = rule.match(command.to_s)\n break unless match_data.nil?\n end\n\n if match_data\n method_name = match_data[1].to_sym\n method_args = match_data.to_a\n .slice(2, match_data.length - 1)\n .collect { |e| e.blank? ? nil : e }.compact.collect(&:strip)\n if (method_args.length == 1) && (method_args.first == 'help')\n help(method_name)\n else\n # defer to application for further processing\n method_args.push(format) unless format.nil?\n send(method_name, *method_args)\n return method_name\n end\n else\n raise(UnknownCommandException, \"#{command} is unknown\")\n end\n end\n end", "def run_command(cmd, options = {})\n base_options = {\n :use_sudo => config[:use_sudo],\n :log_subject => Thor::Util.snake_case(self.class.to_s)\n }.merge(options)\n super(cmd, base_options)\n end", "def exec!(object, options)\n mark_as_failure! # going to execute! set to failure initially\n @options = options\n if object.method(name.to_sym).arity > 1\n mark_as_success! if object.public_send(name.to_sym, options, **options) != false\n else\n mark_as_success! if object.public_send(name.to_sym, options) != false\n end\n \n @block.(options) if success? && @block\n\n self.executed = true\n\n self\n \n rescue => e\n @error = e.message\n\n self.executed = false\n \n mark_as_failure!\n \n self\n end", "def run(*params)\n opts = params.extract_options!\n command = Array.wrap(params).join(' ')\n info command unless opts[:quiet]\n\n begin\n cmdrunner = Mixlib::ShellOut.new(command, timeout: opts[:timeout] || Conveyor::Foreman.instance.config[:command_timeout] || 600)\n cmdrunner.run_command()\n\n info cmdrunner.stdout.chomp unless cmdrunner.stdout.chomp.length == 0\n\n \t\t\t\tif cmdrunner.error!\n \terror \"Error running: `#{command}`\", cmdrunner.stderr.chomp\n \t@status.fail!\n \t\t\t\telse\n \t\t\t\t\tif cmdrunner.stderr.chomp.length > 0\n \t\t\t\t\t\twarning \"Error output recieved, but no error code recieved\"\n \t\t\t\t\t\twarning cmdrunner.stderr.chomp\n \t\t\t\t\tend\n \t\t\t\tend\n\n return !cmdrunner.error!\n rescue Mixlib::ShellOut::CommandTimeout => e\n error e.class, e.message, \"Command: #{command}\"\n # raise e unless opts[:ignore_error]\n rescue => e\n error e.class, e.message, e.backtrace.join(\"\\n\")\n # raise e unless opts[:ignore_error]\n end\n end", "def run_command cmd, silent=false\n puts \"Running command: #{cmd}\" unless silent\n\n if silent\n `#{cmd}`\n else\n puts `#{cmd}`\n end\n\n return true if $?.exitstatus == 0\n\n puts \"Error running command '#{cmd}'\" unless silent\n false\nend", "def run\n if parsed_options? && arguments_valid?\n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n output_options if @options.verbose\n\n process_command\n\n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n else\n output_usage\n end\n end", "def run(command_builder)\n command = command_builder.command\n\n sub = Subexec.run(command, timeout: options[:timeout])\n\n if sub.exitstatus != 0\n\n # Raise the appropriate error\n if sub.output =~ /no decode delegate/i || sub.output =~ /did not return an image/i\n raise MiniMagick::Invalid, sub.output\n else\n # TODO: should we do something different if the command times out ...?\n # its definitely better for logging.. otherwise we dont really know\n raise MiniMagick::Error, \"Command (#{command.inspect.gsub(\"\\\\\", \"\")}) failed: #{{:status_code => sub.exitstatus, :output => sub.output}.inspect}\"\n end\n else\n sub.output\n end\n end", "def execute\n if options[:version]\n self.console.puts \"traject version #{Traject::VERSION}\"\n return true\n end\n if options[:help]\n self.console.puts slop.to_s\n return true\n end\n\n\n (options[:load_path] || []).each do |path|\n $LOAD_PATH << path unless $LOAD_PATH.include? path\n end\n\n arg_check!\n\n self.indexer = initialize_indexer!\n\n ######\n # SAFE TO LOG to indexer.logger starting here, after indexer is set up from conf files\n # with logging config.\n #####\n\n indexer.logger.info(\"traject (#{Traject::VERSION}) executing with: `#{orig_argv.join(' ')}`\")\n\n # Okay, actual command process! All command_ methods should return true\n # on success, or false on failure.\n result =\n case options[:command]\n when \"process\"\n (io, filename) = get_input_io(self.remaining_argv)\n indexer.settings['command_line.filename'] = filename if filename\n indexer.process(io)\n when \"marcout\"\n (io, filename) = get_input_io(self.remaining_argv)\n indexer.settings['command_line.filename'] = filename if filename\n command_marcout!(io)\n when \"commit\"\n command_commit!\n else\n raise ArgumentError.new(\"Unrecognized traject command: #{options[:command]}\")\n end\n\n return result\n rescue Exception => e\n # Try to log unexpected exceptions if possible\n indexer && indexer.logger && indexer.logger.fatal(\"Traject::CommandLine: Unexpected exception, terminating execution: #{Traject::Util.exception_to_log_message(e)}\") rescue nil\n raise e\n end", "def run_command( cmd, args )\n begin\n load_plugins if ((cmd.requires_plugins?) && ! @plugins_loaded)\n # TODO: any additional, optional services (e.g GitDS) should be loaded\n cmd.invoke(args) ? 0 : 1\n rescue Bgo::Application::CommandError => e\n # Error raised by the command itself (usually bad arguments)\n puts e.message\n -2\n end\n end", "def do_action(cmd, options = {})\n # XXX Finish this\n end", "def command_safe(debug, cmd = :command, *args)\n # Commands can overwrite start_time to skip time used in some kind of setup.\n # See count.rb for example.\n @start_time = Time.now\n # send is internal ruby method to call 'cmd' with *args\n # (everything is a message, so this is just the formal semantics to support that idiom)\n translate_hbase_exceptions(*args) { send(cmd, *args) }\n rescue => e\n rootCause = e\n\n # JRuby9000 made RubyException respond to cause, ignore it for back compat\n while !rootCause.is_a?(Exception) && rootCause.respond_to?(:cause) && !rootCause.cause.nil?\n rootCause = rootCause.cause\n end\n if @shell.interactive?\n puts\n puts \"ERROR: #{rootCause}\"\n puts \"Backtrace: #{rootCause.backtrace.join(\"\\n \")}\" if debug\n puts\n puts \"For usage try 'help \\\"#{command_name}\\\"'\"\n puts\n else\n raise rootCause\n end\n ensure\n # If end_time is not already set by the command, use current time.\n @end_time ||= Time.now\n formatter.output_str(format('Took %.4f seconds', @end_time - @start_time))\n end", "def invoke_repositext_command(main_command, command_spec, options)\n method_name = \"#{ main_command }_#{ command_spec }\"\n if respond_to?(method_name, true)\n with_timer do\n self.send(method_name, options)\n end\n else\n raise(\"The command you entered is not implemented. Missing method: #{ method_name.inspect }\")\n end\n end" ]
[ "0.7303946", "0.7101694", "0.7101694", "0.69247967", "0.6789272", "0.67156017", "0.6634948", "0.6525825", "0.6492968", "0.64752483", "0.64611644", "0.6424441", "0.6402135", "0.6398663", "0.6346378", "0.63411754", "0.6326523", "0.63187397", "0.6297001", "0.6294885", "0.6277559", "0.6234388", "0.6216362", "0.6205401", "0.6192436", "0.61611176", "0.61377454", "0.61230457", "0.61137235", "0.60808897", "0.60748154", "0.6054581", "0.6050153", "0.6032089", "0.6032045", "0.6004638", "0.60021853", "0.5999386", "0.5994049", "0.5994049", "0.5972403", "0.5958001", "0.5948497", "0.59387267", "0.59371394", "0.5930183", "0.59192586", "0.5911881", "0.5905648", "0.59007883", "0.5900018", "0.5888927", "0.58871555", "0.58855116", "0.5880088", "0.58633393", "0.5861154", "0.58584344", "0.58584344", "0.5852148", "0.5847347", "0.5835607", "0.58332986", "0.58235115", "0.58097154", "0.5809472", "0.5808029", "0.5803756", "0.57991505", "0.5790512", "0.5788046", "0.5787258", "0.5783083", "0.57776564", "0.5776033", "0.577378", "0.577327", "0.57723516", "0.57650244", "0.5761035", "0.5742378", "0.57365686", "0.5735443", "0.57134616", "0.5682148", "0.56790775", "0.5675371", "0.56640285", "0.56514144", "0.56495225", "0.56398755", "0.56335634", "0.5632021", "0.5622711", "0.5619402", "0.5618914", "0.5609249", "0.5606981", "0.5600661", "0.55874515", "0.5585003" ]
0.0
-1
Returns the float associated with the given string if it is a currency. If the given string is not a currency, this returns nil.
def getCurrencyValue(entry) # if entry is formatted as currency if isEntryCurrency?(entry) # ignore the initial $ entry = entry[1..] # get rid of commas entry.gsub!(/,/, "") # convert to a number and return. We will convert everything to # a float for simplicity return entry.to_f() # if it is not formatted as currency, returns nil as an error value else return nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def float_or_nil(str)\n return nil if IGNORE_LIST.include?(str)\n return nil if str == -1\n Float(str || '')\n rescue ArgumentError\n nil\n end", "def to_float(string)\n string.to_f\n rescue\n 0.0\n end", "def checkCurrency(string_variable)\n # returns string_variable as a float\n # else returns false and error msg if string_variable can't be a number or a valid dollar amount \n \n if checkNum?(string_variable) == false\n return false\n end\n \n # check for max 2 places past decimal point\n decimalIndex = string_variable.index('.')\n if decimalIndex != nil\n if string_variable.length - decimalIndex > 3\n puts \"\\t#{string_variable} is NOT a valid dollar amount\"\n return false\n end\n end\n \n float_variable = string_variable.to_f\n if float_variable >= 0\n return float_variable\n else\n return false\n end\n end", "def convert_float(str)\n return nil if !str\n str.gsub! /[^0-9.]/, \"\"\n neg = str.match /\\((.*?)\\)/\n float = str.to_f\n neg ? -float : float\n end", "def float?(str)\n true if Float(str) rescue false\n end", "def parse_float(value)\n Float(value.to_s.gsub(',','.'))\n rescue ArgumentError\n nil\n end", "def atof(string_float)\n sum = 0\n float_sum = 0\n decimal_split = string_float.split('.')\n if (decimal_split[0] != nil)\n sum = atoi(decimal_split[0])\n end\n\n if (decimal_split[1] != nil)\n decimal_split[1].each_byte.reverse_each do |char|\n float_sum = (float_sum * 0.1) + ((char - ZERO_ASCII_CODE)*0.1)\n end\n end\n\n return sum + float_sum\nend", "def float?(string)\n b = Float(string.tr(',', '.'))\n return b\nrescue ArgumentError\n return false\nend", "def numeric?(string)\n Float(string) != nil rescue false\n end", "def match_float( val )\n\t\treturn Float( val ) rescue nil\n\tend", "def to_decimal(string)\n d = BigDecimal.new(string)\n d.to_f\n rescue\n 0.0\n end", "def parse_currency(currency)\n BigDecimal.new(currency.gsub(/[^0-9.-]/, ''))\n end", "def parse(string)\n string = string.tr(\",\", \".\").delete(\"~\")\n if (match = string.match(/^(\\d*\\.?\\d*)$/))\n match[1].to_f\n elsif (match = string.match(/^(\\d*\\.?\\d*)%$/))\n match[1].to_f / 100\n elsif (match = string.match(/^(\\d*\\.?\\d*)[:\\/](\\d*\\.?\\d*)$/))\n match[1].to_f / match[2].to_f\n elsif (match = string.match(/^(.+)\\=(.+)$/))\n match[1].strip.to_l / match[2].strip.to_l\n end\n rescue ArgumentError\n # to_l raises when string isn't a valid length.\n nil\n end", "def to_float_or_int str\n Integer(str) rescue Float(str) rescue nil\n end", "def float(key, default=0.0)\n\t\tstr = self.fetch(key.downcase, nil)\n\t\tif not str.nil?\n\t\t\treturn str.to_f\n\t\tend\n\t\treturn default\n\tend", "def parse_amount amount_string\n if amount_str.index(\".\") == 0\n amount_str = \"0\"+amount_str.to_s\n end\n amount_string.gsub(/[^\\d\\.]/, \"\").scan(/\\d+\\.?\\d*/)[0].to_f rescue nil\n end", "def parse_amount amount_string\n if amount_string.index(\".\") == 0\n amount_str = \"0\"+amount_str.to_s\n end\n amount_string.gsub(/[^\\d\\.]/, \"\").scan(/\\d+\\.?\\d*/)[0].to_f rescue nil\n end", "def pull_currency( amount, &block )\n amount_str = Float( amount ).to_s\n idx = amount_str.index( \".\" )\n currency = block.call( amount_str, idx )\n currency.to_i\n end", "def currency_symbol\n if self.yard.present?\n self.yard.facility.address.country.currency rescue \"\"\n elsif self.facility.present?\n self.facility.address.country.currency rescue \"\"\n else\n \"\"\n end\n end", "def check_value(text)\n\n #this method recieves a string representing a payment value in the format 19,470.99\n #Then it takes off the comma (\",\") and parse it to float format as 19470.99\n begin\n return text.gsub(\",\",\"\").to_f\n rescue\n return nil\n end\n\n end", "def extract_decimal_from_default(default)\n Float(default).to_s\n rescue\n nil\n end", "def no_float(str)\n\t(str.to_f) == 0\ntotal_cents = ((str).to_f * 100).to_i\nend", "def number_from_string(string)\n bd = BigDecimal.new(string)\n if @style == :btc || @style == :btc_long\n return (bd * BTC::COIN).to_i\n else\n # TODO: support other styles\n raise \"Not Implemented\"\n end\n end", "def to_non_shorthand(value_string)\n return_float = 0\n if !value_string.nil? && value_string != \"N/A\"\n if value_string.include?(\"B\")\n return_float = value_string.delete(\"B\").to_f * 1000000000\n elsif value_string.include?(\"M\")\n return_float = value_string.delete(\"M\").to_f * 1000000\n elsif value_string.include?(\"K\")\n return_float = value_string.delete(\"K\").to_f * 1000000\n end\n end\n return_float\n end", "def frac_to_float(str)\n numerator, denominator = str.split(\"/\").map(&:to_f)\n denominator ||= 1\n numerator/denominator\n end", "def value_is_float?(string)\n return false if string.scan(/\\./).length != 1\n sides = string.split('.')\n return sides[0].numeric? && sides[1].numeric? && sides[1].to_i >= 0\n end", "def parse_money_to_float(money)\n return -1 unless valid_money?(money)\n\n money_result = standardizes_money_input(money)\n\n return money_result.to_f unless part_decimal?(money_result)\n return money_result.tr('.', '').to_f if ends_with_thousand?(money_result)\n\n money_parts = money_result.split('.')\n integer_part = money_parts[0..-2].join('')\n decimal_part = money_parts[-1]\n\n [integer_part, decimal_part].join('.').to_f\n end", "def convertToNum(price)\n \treturn Float(price.gsub(/\\s+/, \"\").gsub(\"USD \",\"\"))\n end", "def number_from_string(string)\n bd = BigDecimal.new(string)\n if @style == :dash || @style == :dash_long\n return (bd * Dash::COIN).to_i\n else\n # TODO: support other styles\n raise \"Not Implemented\"\n end\n end", "def format_to_float(str)\n return str.to_f if !str.include?(\":\")\n \n array = str.split(\":\").reverse!\n total = 0.0\n array.each_with_index do |x, i|\n if i == 0\n total += x.to_f\n else\n total += (x.to_f * (60 ** i))\n end\n end\n \n total\n end", "def convert_money(currency)\n return currency.to_f / 100\n # if currency.to_s.include?(\".\")\n # return currency\n # else\n # return currency.to_f / 100\n # end\n end", "def get_float(node)\n node.content.squish.gsub(/[^\\d\\.]+/, '').to_f if node.present? && node.content.present?\n end", "def float_or_interger(str)\n if str.include?\".\"\n num =str.to_f\n else\n num = str.to_i\n end\n return num\nend", "def to_float(value)\n return value.to_f if value.is_a?(Numeric)\n value = value.to_s if value.is_a?(Symbol)\n value.to_f if value.is_a?(String) && value.match?(NUMBER_PATTERN)\n end", "def _floatify(str, increment = true)\n if (( inf = str.to_s.match(/^([+-])?inf/i) ))\n (inf[1] == \"-\" ? -1.0 : 1.0) / 0.0\n elsif (( number = str.to_s.match(/^\\((-?\\d+)/i) ))\n number[1].to_i + (increment ? 1 : -1)\n else\n Float str.to_s\n end\n rescue ArgumentError\n raise Redis::CommandError, \"ERR value is not a valid float\"\n end", "def parse_number(string)\n if string.include? \".\"\n string.to_f\n elsif string.include? \"E\"\n Complex(string).to_f\n else\n string.to_i\n end\n end", "def parse_price(e)\n # prices can be restricted\n begin\n return e.css('span')[1].content.gsub(',', '.').to_f\n rescue\n return 0.0\n end\n end", "def _is_numeric?(str)\n Float(str) != nil rescue false\n end", "def is_number? string\n true if Float(string) rescue false\n end", "def valid_float_str?(str)\n str =~ /^[+\\-]?[\\d\\.]*$/ # optional sign, then only digits OR '.'\n end", "def is_number? string\n true if Float(string) rescue false\n end", "def euro_from_cents(float_amount)\n if float_amount\n euro(float_amount / 100.0)\n else\n \"undefined\"\n end\n end", "def perc_to_f(str)\n str.gsub(/%/, \"\").to_f / 100.0\n end", "def float?\n !!strip.match(/^-?\\d+\\.\\d+$/)\n end", "def is_number? string\n \t\ttrue if Float(string) rescue false\n\tend", "def is_number? string\n true if Float(string) rescue false\n end", "def is_number? string\n true if Float(string) rescue false\n end", "def is_number?(string)\n true if Float(string) rescue false\n end", "def is_currency?\n self =~ /\\A[+-]?[0-9]{1,3}(?:[0-9]*(?:[.,][0-9]{2})?|(?:,[0-9]{3})*(?:\\.[0-9]{2})?|(?:\\.[0-9]{3})*(?:,[0-9]{2})?)\\z/i\n end", "def is_number(string)\r\n\ttrue if Float(string) rescue false\r\nend", "def string_to_number(string)\n case string\n when /^\\d+$/\n string.to_i\n when /^\\d+.\\d$/\n string.to_f\n else \n string\n end\n end", "def clean_price(input)\n input[0] == \"$\" ? input[1..-1].to_f : input.to_f\n end", "def string_to_number(string)\n case string\n when /^\\d+$/\n string.to_i\n when /^\\d+.\\d$/\n string.to_f\n else\n string\n end\n end", "def is_number? string\n true if Float(string) rescue false\nend", "def rate_to_f(rate)\n rate ? rate.to_f : raise(CurrencyNotSupported)\n end", "def currency\n 'usd'\n end", "def currency_symbol(currency_or_holder)\n currency = currency_or_holder\n if (!currency_or_holder.is_a?(String) &&\n currency_or_holder.respond_to?(:currency))\n currency = currency_or_holder.currency\n end\n case currency\n when 'GBP' then '£'\n when 'EUR' then '€'\n else '$'\n end\n end", "def is_number?(string)\n true if Float(string) rescue false\n end", "def is_numeric(str)\n Float(str) != nil rescue false\n end", "def get_float(key)\n get(key, \"f\")\n end", "def convert_to_numeric(val)\n return BigDecimal(val, Float::DIG) if val.is_a?(Float)\n return val if val.is_a?(Numeric)\n # Eliminate any commas, $'s (or other currency symbol), or _'s.\n cursym = Regexp.quote(FatTable.currency_symbol)\n clean_re = /[,_#{cursym}]/\n val = val.to_s.clean.gsub(clean_re, '')\n return nil if val.blank?\n case val\n when /(\\A[-+]?\\d+\\.\\d*\\z)|(\\A[-+]?\\d*\\.\\d+\\z)/\n BigDecimal(val.to_s.clean)\n when /\\A[-+]?[\\d]+\\z/\n val.to_i\n when %r{\\A([-+]?\\d+)\\s*[:/]\\s*([-+]?\\d+)\\z}\n Rational($1, $2)\n end\n end", "def get_price_of_bitcoin\n data = get_data_from_website(BLOCKCHAIN_WEBSITE)\n price = get_price_in_usd(data)\n # This converts the string to a floating point number\n # Another conversion instruction is to_i (integer)\n price.to_f\nend", "def get_float_from_yahoo\n url = \"http://finance.yahoo.com/q/ks?s=#{ticker}\"\n doc = open_url_or_nil(url)\n\n begin\n shares = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first.text.match(/Shares Outstanding/) }.xpath('./td').last.text\n puts shares\n shares = case shares.last\n when \"B\"\n sales.chop.to_f * BILLION\n when \"M\"\n sales.chop.to_f * MILLION\n else\n sales.chop.first.to_f * BILLION\n end\n\n rescue\n end\n shares.to_i\n end", "def currency(input)\n\t(/\\$?[+-]?[0-9]{1,3}((\\,)?[0-9]{3})*(\\.[0-9]{2})?/i =~ input)? \"true\" : \"false\"\nend", "def jeff_parse_float(val)\n if val.nil?\n Float(0)\n else\n val.to_s.gsub(\",\", \"\").to_f\n end\n end", "def string_to_value(string)\n case string\n when '1p'\n 1\n when '2p'\n 2\n when '5p'\n 5\n when '10p'\n 10\n when '20p'\n 20\n when '50p'\n 50\n when '£1'\n 100\n when '£2'\n 200\n end\n end", "def to_float_or_int(v)\n v.match('\\.').nil? ? Integer(v) : Float(v)\n end", "def format_amount_as_float(amount, currency)\n units = CURRENCY_SPECIAL_MINOR_UNITS[currency] || 2\n divisor = 10**units\n return ((amount || 0).to_d / divisor.to_d)\n end", "def currency\n nil\n end", "def currency\n nil\n end", "def detect_currency value\n case value.to_s.strip\n when /\\$|USD|dollar[s]?|бакс[а-я]{0,2}|доллар[а-я]{0,2}|грин[а-я]?/i\n :USD\n when /€|EUR[a-z]{0,2}|евро/i\n :EUR\n when /₽|RUB{0,4}|руб[a-zа-я]{0,4}|деревян[a-zа-я]{0,3}/i\n :RUB\n when /CAD/i\n :CAD\n else\n :not_expected\n end\nend", "def is_numeric?(s)\n !!Float(s) rescue false\n end", "def get_USD (num_string)\n if num_string == nil || num_string.to_i == 0\n return num_string\n end\n\n num_string = num_string.to_s.split(\"\")\n\n usd = [\"$\"]\n\n num_string.each_with_index do |num, index|\n if index == ((num_string.length) -1)\n usd << \"#{num}.00\"\n elsif index != 0 && index % 3 == 0\n usd << \",#{num}\"\n else\n usd << num.to_s\n end\n end\n return usd.join(\"\")\n end", "def is_number?(str)\n true if Float(str) rescue false\n end", "def cast_to_num(str)\n Integer(str)\n rescue ArgumentError\n Float(str)\n rescue ArgumentError\n nil\n end", "def atof(s)\n sep = s.split('.')\n\n integer = atoi(sep[0]) # convert integer to int\n mantissa = atoi(sep[1]) # convert mantissa to int\n neg = false\n\n # Remember if float is negative\n if integer < 0 \n neg = true\n integer = integer.abs\n end\n\n mantissaLength = sep[1].length\n place = 10.0 ** mantissaLength\n\n sum = integer / 1.0 # convert integer to float\n\n # Add the mantissa to the integer\n for i in 0..mantissaLength-1\n tmp = (mantissa % 10)/place\n sum += tmp\n place /= 10.0\n mantissa /= 10\n end\n\n sum = neg ? -sum : sum # Make number negative if necessary\n\n # Fix funky float operations\n return (sum*(10**mantissaLength)).round / (10.0 ** mantissaLength)\nend", "def is_number?(string)\n true if Float(string) rescue false #need to understand this\nend", "def numeric?; float?; end", "def extract_price(text)\n text.gsub('£', '').to_d\n end", "def numberfy(input_string)\n if input_string.include?(\".\")\n input_string.to_f\n else input_string.to_i\n end\nend", "def get_base_price(base_price)\n value = base_price.gsub('$', '').gsub('.', '').gsub(',', '')\n price_nil?(value)\n non_digits_price?(value)\n base_price.gsub('$', '').gsub(',', '').to_f\n\n end", "def extract_fraction ( string )\n match_fraction = /(\\d{1,})([\\/\\+])(\\d{1,})+/\n # m = string.match(match_fraction)[0]\n m = string.match(match_fraction)\n value = nil\n if m != nil\n value = Rational m[0]\n end\n return value\n end", "def string_to_number(string)\n string.to_f\nend", "def post_process_float( val )\n\t\t\treturn Float( val.to_s )\n\t\tend", "def is_numeric?(s)\n !!Float(s) rescue false\n end", "def price\n basic = Spree::Currency.basic.char_code\n price = prices.where(currency: basic).limit(1)[0]\n if price\n amount = price.amount\n else\n amount = read_attribute(:price) || 0\n end\n Spree::Currency.conversion_to_current(amount)\n end", "def number?\n\t\ttrue if Float(string) rescue false\n\tend", "def convert_string_to_number(str); end", "def number_or_nil(string)\n num = string.to_i\n num if num.to_s == string\n end", "def string_to_point(string)\n # TODO: Does this method belong in SketchPageLoader?\n return nil unless /\\{([+-]?(?:[0-9]*[.])?[0-9]+), ([+-]?(?:[0-9]*[.])?[0-9]+)\\}/ === string\n Core::Point.new($1.to_f, $2.to_f)\n end", "def parse(input, currency, strict: false, decimal_separator: decimal_separator_resolver&.call)\n raise ArgumentError, \"decimal separator cannot be nil\" unless decimal_separator\n\n currency = Money::Helpers.value_to_currency(currency)\n return unless currency\n\n normalized_input = input\n .tr('-0-9.,、、', '-0-9.,,,')\n .gsub(/[^\\d\\-#{Regexp.escape(decimal_separator)}]/, '')\n .gsub(decimal_separator, '.')\n amount = BigDecimal(normalized_input, exception: false)\n if amount\n Money.new(amount, currency)\n elsif strict\n raise ArgumentError, \"unable to parse input=\\\"#{input}\\\" currency=\\\"#{currency}\\\"\"\n end\n end", "def parse_price(price)\n return price unless price.is_a?(String)\n\n separator, delimiter = I18n.t([:'number.currency.format.separator', :'number.currency.format.delimiter'])\n non_price_characters = /[^0-9\\-#{separator}]/\n price.gsub!(non_price_characters, '') # strip everything else first\n price.gsub!(separator, '.') unless separator == '.' # then replace the locale-specific decimal separator with the standard separator if necessary\n\n price.to_d\n end", "def transaction_amount(currency_and_amount)\n currency = parse(currency_and_amount).first\n if currency == 'USD'\n amount = parse(currency_and_amount).last.to_f\n else\n amount = currency.to_f unless amount == 0.0\n end\n# self.amount = amount \n end", "def currency_format string\n while string.sub!(/(\\d+)(\\d\\d\\d)/,'\\1,\\2'); end\n string\n end", "def format_price(price)\n price.gsub!(\"€\",\"\")\n price.gsub!(\".\",\"\")\n price.gsub!(\",\",\".\").to_f\n end", "def xml2value(content_string) Float(content_string.strip) end", "def parse_string string\n string.split(separator).map(&:to_f)\n end", "def tobeamount(obj)\n\t\tif obj.to_s =~ /(\\d+)([.]\\d{1,2})?/\n\t\t\tamt = $1 + ($2 || '.00')\n\t\t\treturn amt.to_f\n\t\tend\n\t\treturn nil\n\tend", "def coerce_float(value, options = {})\n Float(value) rescue nil\n end", "def coerce_float(value, options = {})\n Float(value) rescue nil\n end" ]
[ "0.7168318", "0.7000558", "0.667799", "0.6604937", "0.6387225", "0.6341188", "0.63182855", "0.62951326", "0.62250614", "0.61820513", "0.6181934", "0.61327237", "0.61095124", "0.60725164", "0.60678107", "0.60370904", "0.60061556", "0.59182566", "0.59127975", "0.5879886", "0.5870373", "0.5855226", "0.58354497", "0.5717366", "0.57026845", "0.5672481", "0.567221", "0.5667111", "0.56485254", "0.56191057", "0.56114554", "0.5609386", "0.55723447", "0.55608374", "0.5544955", "0.5530652", "0.55050254", "0.54966575", "0.54765683", "0.5468319", "0.54654765", "0.54642123", "0.5445303", "0.54388785", "0.5430048", "0.54296994", "0.54296994", "0.541225", "0.53939164", "0.53876084", "0.5371867", "0.53716385", "0.53715724", "0.53704935", "0.53697604", "0.53693664", "0.5366546", "0.5363216", "0.5361387", "0.5348892", "0.53314114", "0.5313657", "0.5313282", "0.5308657", "0.5306064", "0.52921355", "0.52689713", "0.52574515", "0.5257332", "0.5257332", "0.52500415", "0.5249765", "0.5244917", "0.5243075", "0.5240855", "0.5235134", "0.52341336", "0.5232222", "0.5215898", "0.52040124", "0.52039915", "0.51989734", "0.5193132", "0.51912147", "0.518521", "0.51773524", "0.5162406", "0.5143029", "0.51379293", "0.51341593", "0.51279396", "0.5113411", "0.5106734", "0.510305", "0.5095613", "0.5083237", "0.5051138", "0.5050342", "0.50495327", "0.50495327" ]
0.647746
4
merges sections by prefering other's attributes FIXME: needs specing
def +(other) fail "Unmergable sections:\n1) #{self.inspect}\n2) #{other.inspect}\nReason: values must differ." unless self.value == other.value @attrs.each do |a| case a when Attribute other.attrs << a unless other.attrs.map(&:name).include?(a.name) when Section other.attrs << a end end other end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(with); end", "def merge_attributes\n attrs = self.attributes.dup.reject{ |k,v| ignored_merge_attributes.include?(k) }\n attrs.merge!(address_attributes) # we want addresses to be shown in the UI\n sorted = attrs.sort do |a,b|\n (ordered_merge_attributes.index(a.first) || 1000) <=> (ordered_merge_attributes.index(b.first) || 1000)\n end\n sorted.inject({}) do |h, item|\n h[item.first] = item.second\n h\n end\n end", "def merge; end", "def merge_sections cm # :nodoc:\n my_sections = sections.group_by { |section| section.title }\n other_sections = cm.sections.group_by { |section| section.title }\n\n other_files = cm.in_files\n\n remove_things my_sections, other_files do |_, section|\n @sections.delete section.title\n end\n\n other_sections.each do |group, sections|\n if my_sections.include? group\n my_sections[group].each do |my_section|\n other_section = cm.sections_hash[group]\n\n my_comments = my_section.comments\n other_comments = other_section.comments\n\n other_files = other_section.in_files\n\n merge_collections my_comments, other_comments, other_files do |add, comment|\n if add then\n my_section.add_comment comment\n else\n my_section.remove_comment comment\n end\n end\n end\n else\n sections.each do |section|\n add_section group, section.comments\n end\n end\n end\n end", "def merge_attributes(data)\n data.fetch(\"default\", {})\n .merge(data.fetch(\"normal\", {}))\n .merge(data.fetch(\"override\", {}))\n .merge(data.fetch(\"automatic\", {}))\n end", "def merge(opts); end", "def merge!(other)\n return self if other.nil?\n\n my_keys = @ini.keys\n other_keys = case other\n when IniFile\n other.instance_variable_get(:@ini).keys\n when Hash\n other.keys\n else\n raise Error, \"cannot merge contents from '#{other.class.name}'\"\n end\n\n (my_keys & other_keys).each do |key|\n case other[key]\n when Hash\n @ini[key].merge!(other[key])\n when nil\n nil\n else\n raise Error, \"cannot merge section #{key.inspect} - unsupported type: #{other[key].class.name}\"\n end\n end\n\n (other_keys - my_keys).each do |key|\n @ini[key] = case other[key]\n when Hash\n other[key].dup\n when nil\n {}\n else\n raise Error, \"cannot merge section #{key.inspect} - unsupported type: #{other[key].class.name}\"\n end\n end\n\n self\n end", "def merge_attrs\n REXML::XPath.first(node, \".//*[@merge|@merge-attrs]\")._?.name\n end", "def merge_from(other)\n @title = other.title unless other.title.to_s.empty?\n @descriptions[:default] = other.descriptions[:default] unless other.descriptions[:default].to_s.empty?\n @impact = other.impact unless other.impact.nil?\n other.tags.each do |ot|\n tag = @tags.detect { |t| t.key == ot.key }\n tag ? tag.value = ot.value : @tags.push(ot)\n end\n self\n end", "def merge_attributes(child, parent_attributes); end", "def merge!; end", "def groupbysection()\n merge(notgroupbysection: 'true')\n end", "def merge_attributes(block, attributes) # :nodoc:\n defaults = DEFAULT_ATTRIBUTES[nil].dup\n defaults.merge!(DEFAULT_ATTRIBUTES[block]) if block\n defaults.merge!(attributes)\n \n # register with Lazydoc\n defaults[:desc] ||= Lazydoc.register_caller(Lazydoc::Trailer, 2)\n \n defaults\n end", "def merge(source); end", "def merge_configurations cfg,cfg2\n cfg['prefix']||=cfg2['prefix']\n raise \"Attempting to merge configurations with differing prefixes: '#{cfg['prefix']}' vs. '#{cfg2['prefix']}' \" if cfg['prefix']!=cfg2['prefix']\n cfg['include']||=[]\n cfg['depend']||=[]\n cfg['interface']||=[]\n cfg['include']+=cfg2['include'] if cfg2['include']\n cfg['depend']+=cfg2['depend'] if cfg2['depend']\n cfg['interface']+=cfg2['interface'] if cfg2['interface']\n return cfg\nend", "def merge_node_properties(node, tag, parent_properties); end", "def merge class_module\n @parent = class_module.parent\n @parent_name = class_module.parent_name\n\n other_document = parse class_module.comment_location\n\n if other_document then\n document = parse @comment_location\n\n document = document.merge other_document\n\n @comment = @comment_location = document\n end\n\n cm = class_module\n other_files = cm.in_files\n\n merge_collections attributes, cm.attributes, other_files do |add, attr|\n if add then\n add_attribute attr\n else\n @attributes.delete attr\n @methods_hash.delete attr.pretty_name\n end\n end\n\n merge_collections constants, cm.constants, other_files do |add, const|\n if add then\n add_constant const\n else\n @constants.delete const\n @constants_hash.delete const.name\n end\n end\n\n merge_collections includes, cm.includes, other_files do |add, incl|\n if add then\n add_include incl\n else\n @includes.delete incl\n end\n end\n\n @includes.uniq! # clean up\n\n merge_collections extends, cm.extends, other_files do |add, ext|\n if add then\n add_extend ext\n else\n @extends.delete ext\n end\n end\n\n @extends.uniq! # clean up\n\n merge_collections method_list, cm.method_list, other_files do |add, meth|\n if add then\n add_method meth\n else\n @method_list.delete meth\n @methods_hash.delete meth.pretty_name\n end\n end\n\n merge_sections cm\n\n self\n end", "def merge_params(params)\n params = form_params(params)\n self.each do |section|\n if params.key?(section.key)\n section.merge_params(params[section.key])\n end\n end\n end", "def merge(other); end", "def merge(headers_or_env); end", "def merge_with other\n m_next = @metadata.merge_with other.metadata\n files_res = {}\n\n # my files\n @files.each { |f| files_res[f.src] = f }\n\n # overrides\n other.files.each { |f| files_res[f.src] = f }\n\n # result\n f_next = files_res.collect { |k, v| v }\n\n Package.new m_next, f_next\n end", "def combined_hash\n y = if @process_global\n normalize(global_yaml).rmerge(normalize(yaml))\n else\n normalize(yaml)\n end\n @process_local ? y.rmerge(normalize(local_yaml)) : y\n end", "def merge(other)\n attributes = @attributes.merge(other.attributes)\n excluded = @excluded.dup.concat(other.excluded)\n self.class.new(prefix, attributes, excluded)\n end", "def merge!(metadata)\n raise \"Merging non-equivalent metadata types: #{self.class} vs #{metadata.class}\" unless self.class == metadata.class\n\n depth do\n # Merge filenames\n if @filenames || metadata.filenames\n @filenames = Array(@filenames) | Array(metadata.filenames)\n end\n\n @dialect = nil # So that it is re-built when needed\n # Merge each property from metadata into self\n metadata.each do |key, value|\n case key\n when :\"@context\"\n # Merge contexts\n @context = @context ? metadata.context.merge(@context) : metadata.context\n\n # Use defined representation\n this_ctx = self[key].is_a?(Array) ? self[key] : [self[key]].compact\n metadata_ctx = metadata[key].is_a?(Array) ? metadata[key] : [metadata[key]].compact\n this_object = this_ctx.detect {|v| v.is_a?(Hash)} || {}\n this_uri = this_ctx.select {|v| v.is_a?(String)}\n metadata_object = metadata_ctx.detect {|v| v.is_a?(Hash)} || {}\n metadata_uri = metadata_ctx.select {|v| v.is_a?(String)}\n merged_object = metadata_object.merge(this_object)\n merged_object = nil if merged_object.empty?\n self[key] = this_uri + (metadata_uri - this_uri) + ([merged_object].compact)\n self[key] = self[key].first if self[key].length == 1\n when :@id, :@type then self[key] ||= value\n else\n begin\n case @properties[key]\n when :array\n # If the property is an array property, the way in which values are merged depends on the property; see the relevant property for this definition.\n self[key] = case self[key]\n when nil then []\n when Hash then [self[key]] # Shouldn't happen if well formed\n else self[key]\n end\n\n value = [value] if value.is_a?(Hash)\n case key\n when :resources\n # When an array of table descriptions B is imported into an original array of table descriptions A, each table description within B is combined into the original array A by:\n value.each do |t|\n if ta = self[key].detect {|e| e.id == t.id}\n # if there is a table description with the same @id in A, the table description from B is imported into the matching table description in A\n ta.merge!(t)\n else\n # otherwise, the table description from B is appended to the array of table descriptions A\n t = t.dup\n t.instance_variable_set(:@parent, self)\n self[key] << t\n end\n end\n when :templates\n # SPEC CONFUSION: differing templates with same @id?\n # When an array of template specifications B is imported into an original array of template specifications A, each template specification within B is combined into the original array A by:\n value.each do |t|\n if ta = self[key].detect {|e| e.targetFormat == t.targetFormat && e.templateFormat == t.templateFormat}\n # if there is a template specification with the same targetFormat and templateFormat in A, the template specification from B is imported into the matching template specification in A\n ta.merge!(t)\n else\n # otherwise, the template specification from B is appended to the array of template specifications A\n t = t.dup\n t.instance_variable_set(:@parent, self) if self\n self[key] << t\n end\n end\n when :columns\n # When an array of column descriptions B is imported into an original array of column descriptions A, each column description within B is combined into the original array A by:\n Array(value).each_with_index do |t, index|\n ta = self[key][index]\n if ta && ta.name == t.name\n debug(\"merge!: columns\") {\"index: #{index}, name=name\"}\n # if there is a column description at the same index within A and that column description has the same name, the column description from B is imported into the matching column description in A\n ta.merge!(t)\n elsif ta &&\n !(Array(ta.title) & Array(t.title)).empty? &&\n t.context.default_language == ta.context.default_language\n debug(\"merge!: columns\") {\"index: #{index}, title=title\"}\n # SPEC SUGGESTION:\n # if there is a column description at the same index within A and that column description has a title, is also in A, the column description from B is imported into the matching column description in A\n ta.merge!(t)\n elsif ta.nil?\n debug(\"merge!: columns\") {\"index: #{index}, nil\"}\n # SPEC SUGGESTION:\n # If there is no column description at the same index within A, then the column description is taken from that index of B.\n t = t.dup\n t.instance_variable_set(:@parent, self) if self\n self[key][index] = t\n else\n debug(\"merge!: columns\") {\"index: #{index}, ignore\"}\n # otherwise, the column description is ignored\n end\n end\n when :foreignKeys\n # When an array of foreign key definitions B is imported into an original array of foreign key definitions A, each foreign key definition within B which does not appear within A is appended to the original array A.\n # SPEC CONFUSION: If definitions vary only a little, they should probably be merged (e.g. common properties).\n self[key] = self[key] + (metadata[key] - self[key])\n end\n when :link\n # If the property is a link property, then if the property only accepts single values, the value from A overrides that from B, otherwise the result is an array of links: those from A followed by those from B that were not already a value in A.\n # SPEC CONFUSION: What is an example of such a property?\n self[key] ||= value\n when :uri_template, :column_reference then self[key] ||= value\n when :object\n case key\n when :notes\n # If the property accepts arrays, the result is an array of objects or strings: those from A followed by those from B that were not already a value in A.\n a = case self[key]\n when Array then self[key]\n when Hash then [self[key]]\n else Array(self[key])\n end\n b = case value\n when Array then value\n when Hash then [value]\n else Array(value)\n end\n self[key] = a + b\n else\n # if the property only accepts single objects\n if self[key].is_a?(String) || value.is_a?(String)\n # if the value of the property in A is a string or the value from B is a string then the value from A overrides that from B\n self[key] ||= value\n elsif self[key].is_a?(Hash)\n # otherwise (if both values as objects) the objects are merged as described here\n self[key].merge!(value)\n else\n value = value.dup\n value.instance_variable_set(:@parent, self) if self\n self[key] = value\n end\n end\n when :natural_language\n # If the property is a natural language property, the result is an object whose properties are language codes and where the values of those properties are arrays. The suitable language code for the values is either explicit within the existing value or determined through the default language in the metadata document; if it can't be determined the language code und should be used. The arrays should provide the values from A followed by those from B that were not already a value in A.\n a = case self[key]\n when Hash then self[key]\n when Array then {(context.default_language || \"und\") => self[key]}\n when String then {(context.default_language || \"und\") => [self[key]]}\n else {}\n end\n b = case value\n when Hash then value\n when Array then {(metadata.context.default_language || \"und\") => value}\n when String then {(metadata.context.default_language || \"und\") => [value]}\n else {}\n end\n debug(\"merge!: natural_language\") {\n \"A: #{a.inspect}, B: #{b.inspect}\"\n }\n b.each do |k, v|\n vv = Array(a[k]) + (Array(b[k]) - Array(a[k]))\n a[k] = vv.length == 1 ? vv.first : vv\n end\n self[key] = a\n else\n # If the property is an atomic property, then\n case key.to_s\n when \"predicateUrl\", \"null\"\n # otherwise the result is an array of values: those from A followed by those from B that were not already a value in A.\n self[key] = Array(self[key]) + (Array[value] - Array[self[key]])\n when /:/\n # SPEC SUGGESTION: common property\n a = case self[key]\n when nil then []\n when Array then self[key]\n else [self[key]]\n end\n\n b = case metadata[key]\n when nil then []\n when Array then metadata[key]\n else [metadata[key]]\n end\n\n self[key] = a + (b - a)\n self[key] = self[key].first if self[key].length == 1\n else\n # if the property only accepts single values, the value from A overrides that from B;\n self[key] ||= value\n end\n end\n end\n end\n end\n end\n\n debug(\"merge!\") {self.inspect}\n self\n end", "def codegen_merge\n header, body, footer = \"function merge(results, data)\\n\", [], \"end\\n\"\n\n # Open group loops.\n groups.each_with_index do |group, index|\n data_item = \"data\" + (0...index).to_a.map {|i| \"[k#{i}]\"}.join('')\n results_item = \"results\" + (0..index).to_a.map {|i| \"[k#{i}]\"}.join('')\n body << \"#{' ' * index}for k#{index},v#{index} in pairs(#{data_item}) do\"\n body << \"#{' ' * index} if #{results_item} == nil then #{results_item} = {} end\"\n end\n\n indent = ' ' * groups.length\n body << \"#{indent}a = results\" + (0...groups.length).to_a.map {|i| \"[k#{i}]\"}.join('')\n body << \"#{indent}b = data\" + (0...groups.length).to_a.map {|i| \"[k#{i}]\"}.join('')\n\n # Generate the merge for each field.\n fields.each do |field|\n alias_name = field.target_name\n \n case field.aggregation_type\n when nil\n body << \"#{indent}a.#{alias_name} = b.#{alias_name}\"\n when :count\n body << \"#{indent}a.#{alias_name} = (a.#{alias_name} or 0) + (b.#{alias_name} or 0)\"\n when :sum\n body << \"#{indent}a.#{alias_name} = (a.#{alias_name} or 0) + (b.#{alias_name} or 0)\"\n when :min\n body << \"#{indent}if(a.#{alias_name} == nil or a.#{alias_name} > b.#{alias_name}) then\"\n body << \"#{indent} a.#{alias_name} = b.#{alias_name}\"\n body << \"#{indent}end\"\n when :max\n body << \"#{indent}if(a.#{alias_name} == nil or a.#{alias_name} < b.#{alias_name}) then\"\n body << \"#{indent} a.#{alias_name} = b.#{alias_name}\"\n body << \"#{indent}end\"\n else\n raise StandardError.new(\"Invalid aggregation type: #{field.aggregation_type}\")\n end\n end\n\n # Close group loops.\n groups.reverse.each_with_index do |group, index|\n body << \"#{' ' * (groups.length-index-1)}end\"\n end\n\n # Indent body and return.\n body.map! {|line| \" \" + line}\n return header + body.join(\"\\n\") + \"\\n\" + footer\n end", "def merge_data!(other, source: \"YAML front matter\")\n merge_categories!(other)\n Utils.deep_merge_hashes!(data, other)\n merge_date!(source)\n data\n end", "def merge_headers(*headers)\r\n hdr = {}\r\n headers.each do |h|\r\n hdr.merge!(h) do |k, v1, v2|\r\n v1.merge!(v2) if k == :attributes!\r\n end\r\n end\r\n hdr\r\n end", "def merge(element)\n if !documentation\n self.documentation = element.documentation\n elsif documentation != element.documentation\n documentation.merge(element.documentation)\n end\n element.properties.each do |property|\n unless properties.find { |my_prop| my_prop.property_definition.name == property.property_definition.name && my_prop.value == property.value}\n properties << property\n end\n end\n end", "def merge_headers(*headers)\n hdr = {}\n headers.each do |h|\n hdr.merge!(h) do |k,v1,v2|\n v1.merge!(v2) if k == :attributes!\n end\n end\n hdr\n end", "def iiif_manifest_attributes\n super.merge imported_attributes\n end", "def iiif_manifest_attributes\n super.merge imported_attributes\n end", "def merge_attributes(attrs={})\n # copy attributes from the parent module fields array\n @attributes = self.class.attributes_from_module\n # populate the attributes with values from the attrs provided to init.\n @attributes.keys.each do |name|\n write_attribute name, attrs[name] if attrs[name]\n end\n # If this is an existing record, blank out the modified_attributes hash\n @modified_attributes = {} unless new?\n end", "def merge!(with); end", "def merge_metadata(existing_metadata, section, new_metadata)\n return unless new_metadata.is_a?(Hash)\n\n existing_metadata[section] ||= {}\n data = existing_metadata[section]\n\n new_metadata.each do |key, value|\n if value.nil?\n data.delete(key)\n else\n data[key] = value\n end\n end\n end", "def merge_headers(*headers)\r\n hdr = {}\r\n headers.each do |h|\r\n hdr.merge!(h) do |k,v1,v2|\r\n v1.merge!(v2) if k == :attributes!\r\n end\r\n end\r\n hdr\r\n end", "def merge_attributes\n %w( price area paragraph bullet file ).map(&:to_sym)\n end", "def merge_params\n REXML::XPath.first(node, \".//*[@merge|@merge-params]\")._?.name\n end", "def merge_rpr_tags(node, props); end", "def merge! other_feed\n [:id, :title, :subtitle, :updated, :rights, :logo, :icon].each do |p|\n if (v = other_feed.get(p))\n set p, v\n end\n end\n\n [:links, :categories, :authors, :contributors].each do |p|\n other_feed.get(p).each do |e|\n get(p) << e\n end\n end\n\n @extensions = other_feed.extensions\n\n merge_entries! other_feed\n end", "def merge(new_scopes); end", "def merge_into(r)\n if !self.metadata[:add].nil?\n if !r.metadata[:add].nil?\n r.metadata[:add] |= self.metadata[:add]\n else\n r.metadata[:add] = self.metadata[:add]\n end\n end\n\n if !self.metadata[:remove].nil?\n if !r.metadata[:remove].nil?\n r.metadata[:remove] |= self.metadata[:remove]\n else\n r.metadata[:remove] = self.metadata[:remove]\n end\n end\n\n if !r.metadata[:todos].nil?\n r.metadata[:todos] |= r.metadata[:add] - r.metadata[:remove]\n else\n r.metadata[:todos] = r.metadata[:add] - r.metadata[:remove]\n end\n\n if !r.metadata[:tags].nil?\n r.metadata[:tags] |= self.metadata[:tags] if !self.metadata[:tags].nil?\n else\n r.metadata[:tags] = self.metadata[:tags]\n end\n\n if !self.metadata[:tags]\n self.metadata[:tags].each do |tag|\n r.add_tags(tag)\n end\n end\n\n r.sector_tag_list |= self.sector_tag_list\n r.type_tag_list |= self.type_tag_list\n r.input_method_list |= self.input_method_list\n r.PFO_statu_list |= self.PFO_statu_list\n r.organizer_list |= self.organizer_list\n\n r.email << (\", \" + self.email) if r.email.blank? && !self.email.blank?\n r.phone = self.phone if r.phone.blank? && !self.phone.blank?\n r.organization = self.organization if r.organization.blank? && !self.organization.blank?\n r.position = self.position if r.position.blank? && !self.position.blank?\n r.address = self.address if r.address.blank? && !self.address.blank?\n\n r.street_address = self.street_address if r.street_address.nil? && !self.street_address.nil?\n r.user = self.user if r.user.nil? && !self.user.nil?\n\n if !self.notes.nil? && !self.notes.empty?\n if r.notes.nil?\n r.notes = self.notes\n else\n new_notes = r.notes << \", \" << self.notes\n r.notes = nil\n r.save\n r.notes = new_notes\n end\n end\n\n r.manually_added ||= self.manually_added\n r.save\n end", "def section_properties; end", "def merge!( other )\n my_keys = @ini.keys\n other_keys =\n case other\n when IniFile; other.instance_variable_get(:@ini).keys\n when Hash; other.keys\n else raise \"cannot merge contents from '#{other.class.name}'\" end\n\n (my_keys & other_keys).each do |key|\n @ini[key].merge!(other[key])\n end\n\n (other_keys - my_keys).each do |key|\n @ini[key] = other[key]\n end\n\n self\n end", "def perform_additional_merge_operations!(other)\n end", "def _section_fields\n {\n 'article' => ['r:Title', 'o:Author', 'o:DOI'],\n 'journal' => ['r:Title', 'o:ISSN', 'r:Volume', 'o:Issue', 'r:Year', 'r:Pages'],\n 'host' => ['o:Title', 'o:ISSN or ISBN', 'o:Volume', 'o:Issue', 'r:Year', 'o:Pages'],\n 'auto-cancel' => ['o:Automatic cancellation'],\n 'notes' => ['o:Notes'],\n 'conference' => ['r:Title', 'o:Location', 'r:Year', 'o:ISSN or ISBN', 'r:Pages'],\n 'book' => ['r:Title', 'o:Author', 'o:Edition', 'o:DOI', 'o:ISBN', 'r:Year', 'o:Publisher'],\n 'thesis' => ['r:Title', 'r:Author', 'o:Affiliation', 'o:Publisher', 'o:Type', 'r:Year', 'o:Pages'],\n 'report' => ['r:Title', 'o:Author', 'o:Publisher', 'o:DOI', 'o:Report Number'],\n 'standard' => ['r:Title', 'o:Subtitle', 'o:Publisher', 'o:DOI', 'o:Standard Number', 'o:ISBN', 'r:Year', 'o:Pages'],\n 'patent' => ['r:Title', 'o:Inventor', 'o:Patent Number', 'r:Year', 'o:Country'],\n 'other' => ['r:Title', 'o:Author', 'o:Publisher', 'o:DOI']\n }\nend", "def merge_end_use!(other)\n @heating = add_values(@heating, other.heating)\n @cooling = add_values(@cooling, other.cooling)\n @interior_lighting = add_values(@interior_lighting, other.interior_lighting)\n @exterior_lighting = add_values(@exterior_lighting, other.exterior_lighting)\n @interior_equipment = add_values(@interior_equipment, other.interior_equipment)\n @exterior_equipment = add_values(@exterior_equipment, other.exterior_equipment)\n @electric_vehicles = add_values(@electric_vehicles, other.electric_vehicles)\n @fans = add_values(@fans, other.fans)\n @pumps = add_values(@pumps, other.pumps)\n @heat_rejection = add_values(@heat_rejection, other.heat_rejection)\n @humidification = add_values(@humidification, other.humidification)\n @heat_recovery = add_values(@heat_recovery, other.heat_recovery)\n @water_systems = add_values(@water_systems, other.water_systems)\n @refrigeration = add_values(@refrigeration, other.refrigeration)\n @generators = add_values(@generators, other.generators)\n\n return self\n end", "def merge(node, attrs, except: [])\n other = self.class.new(node, attrs)\n\n other.attributes = other.attributes.except(*except)\n\n other.attributes.each do |k, v|\n value = attributes[k]\n if value && value != v\n raise \"unexpected overwite of #{k} from #{value} to #{v}\"\n end\n end\n\n update_attributes(other.attributes)\n end", "def merge( attributes )\n\t\tattributes.each do |attrname, value|\n\t\t\tself[ attrname ] = value\n\t\tend\n\tend", "def wonkofile_merge(old, new)\n res = old.merge new\n # changing versions is not allowed by adding another version index (we might end up with a version in the index that\n # we don't have an actual version file for)\n res['versions'] = old['versions']\n res\nend", "def merge_attributes(child, parent_attributes)\n parent_attributes.each do |name, par_attr|\n child_attr = child[name] ? child[name].split(';') : []\n child[name] = par_attr.value.split(';').concat(child_attr).join('; ')\n end\n end", "def initialize_combined_fields\n # For each of the files in the batch, set the attributes to be the concatenation of all the attributes\n batch_document_ids.each_with_object({}) do |doc_id, combined_attributes|\n work = Hyrax.query_service.find_by(id: doc_id)\n terms.each do |field|\n combined_attributes[field] ||= []\n combined_attributes[field] = (combined_attributes[field] + work[field].to_a).uniq\n end\n names << work.to_s\n end\n end", "def merge!(other)\n other.read_present.each do |k, v|\n write(k, v)\n end\n\n self\n end", "def merge_conflict?; end", "def merge!(other)\n other.config.each do |key, value|\n case key\n when 'clusters', 'contexts', 'users'\n value.each do |other_value|\n own_value = config[key].find { |c| c['name'] == other_value['name'] }\n config[key].delete(own_value) if own_value\n config[key] << other_value\n end\n when 'current-context', 'preferences'\n config[key] = value\n else\n config[key] ||= value\n end\n end\n\n self\n end", "def merge(other_hash); end", "def merge_components(c1, c2)\n\nend", "def common_tags_to_add\n common_tags = []\n common_tags << self.merger\n common_tags << self if self.canonical\n common_tags << self.parents\n common_tags.flatten.uniq.compact\n end", "def extend!(other)\n # Any image_registries entry in |self| should take precedence\n # over any identical key in |other|. The behavior of merge is that\n # the 'other' hash wins.\n @image_registries = other.image_registries.merge(@image_registries)\n\n # Same behavior as above for #default_flags.\n @default_flags = other.default_flags.merge(@default_flags)\n\n # artifacts should be merged by 'name'. In other words, if |self| and |other|\n # specify the same 'name' of a registry, self's config for that registry\n # should win wholesale (no merging of flags.)\n @artifacts = (@artifacts + other.artifacts).uniq { |h| h.fetch('name') }\n\n # Same behavior as for flags and registries, but the flags within the flavor\n # are in a Hash, so we need a deep merge.\n @flavors = other.flavors.deep_merge(@flavors)\n\n # A break from the preceding merging logic - Dependent hooks have to come\n # first and a given named hook can only be run once. But seriously, you\n # probably don't want to make a library that specifies hooks.\n @hooks = (other.hooks + @hooks).uniq\n\n @expiration = (@expiration + other.expiration).uniq { |h| h.fetch('repository') }\n end", "def section_metadata\n [section_metadata_one, section_metadata_two, section_metadata_three]\n end", "def merge(other)\n @options[:last_received_time] ||= other.last_received_time\n @options[:idle] ||= other.idle\n @options[:next_directive] ||= other.next_directive\n @options[:next_method] ||= other.next_method\n @options[:data] ||= other.data\n @options[:parse_next] ||= other.parse_next\n end", "def merged_result; end", "def merge_existing_meta_hash(meta)\n return unless (original_meta = instance.send(\"#{name}_meta\"))\n meta.reverse_merge! meta_decode(original_meta)\n end", "def merged_source_properties\n if @raw_name.is_a?(Array) && @raw_name[1]\n source_properties.merge(@raw_name[1])\n else\n source_properties\n end\n end", "def merge(other)\n self.class[Utils.merge(to_h, other)]\n end", "def process_sections\n @tag_selection.attributes = {'section_ids' => []}.merge(params[:tag_selection] || {})\n end", "def merge(other_spec)\n super if defined? super\n\n frame_mappings.merge!(other_spec.frame_mappings) do |frame_name, sel0, sel1|\n if !sel0 then sel1\n elsif !sel1 then sel0\n elsif sel0 != sel1\n raise ArgumentError, \"cannot merge #{self} and #{other_spec}: frame mapping for #{frame_name} differ (resp. #{sel0.inspect} and #{sel1.inspect})\"\n else\n sel0\n end\n end\n\n transform_producers.merge!(other_spec.transform_producers) do |(from, to), sel0, sel1|\n if sel0 != sel1\n raise ArgumentError, \"cannot merge #{self} and #{other_spec}: producer for #{from} => #{to} differ (resp. #{sel0} and #{sel1})\"\n end\n sel0\n end\n end", "def associate_components \n #associate internals and resources with parts\n @parts.each do |name, data|\n data[:internals] = associate_component(data[:file], @internals)\n data[:resources] = associate_component(data[:file], @resources)\n data.delete(:file) #remove the raw file data as it's no longer needed and would waste space if written to file\n end\n #associate props with internals\n @internals.each do |name, data| \n data[:props] = associate_component(data[:file], @props) \n data.delete(:file) #remove the raw file data\n end\n end", "def deep_merge_hashes!(target, overwrite); end", "def _merge_hash(other)\n clazz = _class_to_sym(other.values.first)\n @known_classes[clazz][:pipeline_group].merge!(other)\n end", "def merge!(headers_or_env); end", "def merge!(config)\n self.compiled = false\n self.resource_class ||= config.resource_class\n transforms_from.merge! config.transforms_from\n transforms_to.merge! config.transforms_to\n custom_serializers.merge! config.custom_serializers\n namespaces.merge! config.namespaces\n facets.merge! config.facets #TODO --jdc change to a deep_merge!\n extensions.merge! config.extensions\n\n self\n end", "def merge( parent_attributes, force=false )\n attributes_for(self).each do |attr|\n unless parent_attributes.send(attr).nil?\n send(\"#{attr}=\", parent_attributes.send(attr)) \n end\n end\n end", "def merge other_entry\n options = {\n :extracted_comment => merge_string(@extracted_comment,\n other_entry.extracted_comment),\n :translator_comment => merge_string(@translator_comment,\n other_entry.translator_comment),\n :references => merge_array(@references,\n other_entry.references),\n :flags => merge_array(@flags,\n other_entry.flags),\n }\n self.class.new(@msgid, options)\n end", "def ordered_merge_attributes\n ORDERED_ATTRIBUTES\n end", "def deep_merge(source, hash); end", "def deep_merge(source, hash); end", "def merge!(other)\n @options[:last_received_time] = other.last_received_time\n @options[:idle] = other.idle\n @options[:next_directive] = other.next_directive\n @options[:next_method] = other.next_method\n @options[:data] = other.data\n @options[:parse_next] = other.parse_next\n end", "def merge(other)\n super.tap do |result|\n other_networks = other.instance_variable_get(:@__networks)\n\n result.instance_variable_set(:@__networks, @__networks.merge(other_networks))\n\n # Merge defined VMs by first merging the defined VM keys,\n # preserving the order in which they were defined.\n other_defined_vm_keys = other.instance_variable_get(:@__defined_vm_keys)\n other_defined_vm_keys -= @__defined_vm_keys\n new_defined_vm_keys = @__defined_vm_keys + other_defined_vm_keys\n\n # Merge the actual defined VMs.\n other_defined_vms = other.instance_variable_get(:@__defined_vms)\n new_defined_vms = {}\n\n @__defined_vms.each do |key, subvm|\n new_defined_vms[key] = subvm.clone\n end\n\n other_defined_vms.each do |key, subvm|\n if !new_defined_vms.key?(key)\n new_defined_vms[key] = subvm.clone\n else\n new_defined_vms[key].config_procs.concat(subvm.config_procs)\n new_defined_vms[key].options.merge!(subvm.options)\n end\n end\n\n # Merge the providers by prepending any configuration blocks we\n # have for providers onto the new configuration.\n other_providers = other.instance_variable_get(:@__providers)\n new_providers = @__providers.dup\n other_providers.each do |key, blocks|\n new_providers[key] ||= []\n new_providers[key] += blocks\n end\n\n # Merge the provider ordering. Anything defined in our CURRENT\n # scope is before anything else.\n other_order = other.instance_variable_get(:@__provider_order)\n new_order = @__provider_order.dup\n new_order = (new_order + other_order).uniq\n\n # Merge the provider overrides by appending them...\n other_overrides = other.instance_variable_get(:@__provider_overrides)\n new_overrides = @__provider_overrides.dup\n other_overrides.each do |key, blocks|\n new_overrides[key] ||= []\n new_overrides[key] += blocks\n end\n\n # Merge provisioners. First we deal with overrides and making\n # sure the ordering is good there. Then we merge them.\n new_provs = []\n other_provs = other.provisioners.dup\n @provisioners.each do |p|\n other_p = other_provs.find { |o| p.id == o.id }\n if other_p\n # There is an override. Take it.\n other_p.config = p.config.merge(other_p.config)\n other_p.run ||= p.run\n next if !other_p.preserve_order\n\n # We're preserving order, delete from other\n p = other_p\n other_provs.delete(other_p)\n end\n\n # There is an override, merge it into the\n new_provs << p.dup\n end\n other_provs.each do |p|\n new_provs << p.dup\n end\n result.instance_variable_set(:@provisioners, new_provs)\n\n # Merge synced folders.\n other_folders = other.instance_variable_get(:@__synced_folders)\n new_folders = {}\n @__synced_folders.each do |key, value|\n new_folders[key] = value.dup\n end\n\n other_folders.each do |id, options|\n new_folders[id] ||= {}\n new_folders[id].merge!(options)\n end\n\n result.instance_variable_set(:@__defined_vm_keys, new_defined_vm_keys)\n result.instance_variable_set(:@__defined_vms, new_defined_vms)\n result.instance_variable_set(:@__providers, new_providers)\n result.instance_variable_set(:@__provider_order, new_order)\n result.instance_variable_set(:@__provider_overrides, new_overrides)\n result.instance_variable_set(:@__synced_folders, new_folders)\n end\n end", "def merge(other)\n unless identifier == other.identifier\n raise ArgumentError,\n \"#{self} and #{other} have different identifiers\"\n end\n\n default = FoobarMod::Requirement.default\n self_req = self.requirement\n other_req = other.requirement\n\n return self.class.new identifier, self_req if other_req == default\n return self.class.new identifier, other_req if self_req == default\n\n self.class.new identifier, self_req.as_list.concat(other_req.as_list)\n end", "def merge!(*other_hashes, &blk); end", "def merge(*other_hashes, &blk); end", "def package_updates(a, b)\n common_keys = a.keys & b.keys\n common_keys = a.keys & b.keys\n common_keys.inject({}) { |result, p| result.merge({p => a[p]}) }\n end", "def merge!( otherstate )\n\t\t@scopes.push( @scopes.pop + otherstate.scope )\n\t\t# self.attributes.merge!( otherstate.attributes )\n\t\tself.options.merge!( otherstate.options )\n\t\treturn self\n\tend", "def iiif_manifest_attributes\n super.merge iiif_manifest_exhibit\n end", "def iiif_manifest_attributes\n super.merge iiif_manifest_exhibit\n end", "def merge_cells(row1=0,col1=0,row2=0,col2=0)\n validate_workbook\n @merged_cells << {\n :attributes => {\n :ref => ''\n }\n }\n cell1 = Cell.convert_to_cell(row1,col1)\n cell2 = Cell.convert_to_cell(row2,col2)\n @merged_cells.last[:attributes][:ref] = cell1+':'+cell2\n end", "def generate_merging(template, binding, path, tag_prefix)\n new_content = TemplateManager.new.generate(template, binding)\n @project.merge_new_content(new_content, path, \"Spec generated\", tag_prefix)\n end", "def merge_comps( original, override )\n override.each do |k,v|\n if original.has_key? k\n original[k] = v\n else\n original << [k,v]\n end\n end\n end", "def merge(doc)\n src = open_pdoc(doc)\n merge_pdoc(src)\n end", "def each_section # :yields: section, constants, attributes\n return enum_for __method__ unless block_given?\n\n constants = @constants.group_by do |constant| constant.section end\n attributes = @attributes.group_by do |attribute| attribute.section end\n\n constants.default = []\n attributes.default = []\n\n sort_sections.each do |section|\n yield section, constants[section].select(&:display?).sort, attributes[section].select(&:display?).sort\n end\n end", "def use_merging(use = T.unsafe(nil)); end", "def about_section_B\n OpenStruct.new(\n :header => \"About section B\",\n :context => [\n \"The purpose of this section is to collect specific information about your organisation. It is important that the details are accurate as they cannot be changed after the submission deadline.\",\n \"This information will help us to identify your organisation and will also enable us to undertake due diligence checks with other Government Departments and Agencies if your application is shortlisted.\",\n ]\n )\n end", "def deep_merge!(other_hash, &block); end", "def merge_extent(old, new)\n old.dig(:extent, 0, :locality) and\n old[:extent] = [{ locality_stack: old[:extent] }]\n new.dig(:extent, 0, :locality) and\n new[:extent] = [{ locality_stack: new[:extent] }]\n ret = merge_by_type(old.dig(:extent, 0),\n new.dig(:extent, 0), :locality_stack,\n %i[locality type])\n (ret && !old.dig(:extent, 0)) or return\n old[:extent] ||= []\n old[:extent][0] ||= {}\n old[:extent][0][:locality_stack] = ret\n end", "def sections(*args); end", "def deep_merge!(*other_hashes, &blk); end", "def extend_other(other)\n other.extend(Hash[removed_attributes.zip])\n end", "def merge(other)\n schema(other.keys)\n end", "def deep_merge(*other_hashes, &blk); end", "def merge_attributes\n %w(updated_at\n created_at\n deleted_at\n id).inject(self.attributes) do |r, n|\n r.delete(n)\n r\n end\n end" ]
[ "0.64014214", "0.6200959", "0.61221826", "0.6073041", "0.6031088", "0.5989343", "0.5943767", "0.5878308", "0.584094", "0.57912856", "0.5758747", "0.57207125", "0.5687047", "0.5637179", "0.560761", "0.5605013", "0.55937785", "0.5565393", "0.5541474", "0.5535425", "0.55179334", "0.5507631", "0.5496629", "0.5494905", "0.5494006", "0.54488283", "0.5425097", "0.5419702", "0.54129714", "0.5392836", "0.5392836", "0.5391352", "0.53902376", "0.5383802", "0.53713566", "0.5353275", "0.5337155", "0.53348887", "0.53148043", "0.53078073", "0.5301952", "0.52976865", "0.5285241", "0.5249554", "0.524595", "0.52162933", "0.5205234", "0.5184874", "0.5180748", "0.51628375", "0.5155585", "0.5132087", "0.5129337", "0.5122771", "0.5121058", "0.511742", "0.511518", "0.51116353", "0.5108663", "0.510205", "0.51018333", "0.5101088", "0.50942546", "0.5089754", "0.5088389", "0.5087324", "0.5085649", "0.5083279", "0.50784945", "0.5061494", "0.5050895", "0.5043012", "0.50418043", "0.5036729", "0.5029918", "0.5029918", "0.502584", "0.5021815", "0.50217605", "0.50154114", "0.5013574", "0.5005015", "0.50012875", "0.500026", "0.500026", "0.49920532", "0.49876872", "0.49869025", "0.4978054", "0.497638", "0.49677607", "0.49667096", "0.49613532", "0.49539936", "0.4951325", "0.49512523", "0.4950199", "0.4948749", "0.49452475", "0.49450982" ]
0.6673078
0
Use callbacks to share common setup or constraints between actions.
def set_nodetest @node_test = Nodetest.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def nodetest_params params.require(:nodetest).permit! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def parameters\n nil\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7122858", "0.70540553", "0.69476545", "0.6902004", "0.6735809", "0.671776", "0.668886", "0.66776645", "0.66611695", "0.6555913", "0.6527077", "0.64584446", "0.64516115", "0.64500964", "0.64474493", "0.6435065", "0.6413185", "0.6413185", "0.6391701", "0.6380101", "0.6380101", "0.6375428", "0.63607097", "0.63550794", "0.62854564", "0.6279767", "0.6246839", "0.6227533", "0.62248623", "0.62241435", "0.62108195", "0.6207854", "0.61778766", "0.6171899", "0.61687297", "0.6159957", "0.6144725", "0.6136328", "0.6122536", "0.6108904", "0.60992044", "0.6075602", "0.6053279", "0.60402286", "0.60354996", "0.60304064", "0.60196084", "0.60180986", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.6016556", "0.60057056", "0.6004592", "0.60022795", "0.5997011", "0.5995432", "0.59948206", "0.59846616", "0.59845465", "0.5977865", "0.5975251", "0.59699106", "0.5967482", "0.5966506", "0.5966506", "0.595741", "0.59520626", "0.59505886", "0.594777", "0.59441733", "0.59313565", "0.5930838", "0.59271175", "0.592483", "0.59186137", "0.5917785", "0.5914208", "0.59137684", "0.590802", "0.5905818", "0.5904141", "0.59019583", "0.59004456", "0.5897177", "0.5896937", "0.5894958" ]
0.0
-1
get a copy of the db from remote host
def get_backup tar_file = get_tempfile safe_run "tar -cf #{tar_file} #{tar_dir}" tar_file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_database(from, to, from_host=\"localhost\")\n oh = OrderedHash.new\n oh[:copydb] = 1\n oh[:fromhost] = from_host\n oh[:fromdb] = from\n oh[:todb] = to\n self[\"admin\"].command(oh)\n end", "def copy_database\n options = {\n :query => { 'ZOHO_ACTION' => 'COPYDATABASE' }\n }\n\n send_request get_db_uri, 'post', options\n end", "def get_remote_database(print_to_stdout)\n cleardb = api.get_config_vars(app).body[\"CLEARDB_DATABASE_URL\"]\n jawsdb = api.get_config_vars(app).body[\"JAWSDB_URL\"]\n\n if @@db == 'cleardb'\n puts \"Using ClearDB\" if print_to_stdout\n return cleardb\n elsif @@db == 'jawsdb'\n puts \"Using JawsDB\" if print_to_stdout\n return jawsdb\n elsif jawsdb && cleardb\n puts \"Error. Both CLEARDB_DATABASE_URL and JAWSDB_URL config vars are found. Please indicate which database to use with the --db parameter (values accepted: cleardb or jawsdb)\"\n return nil\n elsif cleardb\n puts \"Using ClearDB\" if print_to_stdout\n return cleardb\n elsif jawsdb\n puts \"Using JawsDB\" if print_to_stdout\n return jawsdb\n end\n\n return nil\n end", "def import_remote_database env = \"development\"\n settings = database_settings\n if database_settings.empty?\n shell.say \"ERROR: Unable to load database setings for current app. Are you within the root folder of a Rails project?\"\n else\n answer = shell.yes? \"You are about to perminently override all data in the local \\\"#{env}\\\" database. Do you wish to continue (y/n)?\"\n if answer\n begin\n heroku = Heroku::Client.new @heroku_credentials.login, @heroku_credentials.password\n pg = PGBackups::Client.new heroku.config_vars(application)[\"PGBACKUPS_URL\"]\n database = \"latest.dump\"\n shell_with_echo \"curl -o #{database} '#{pg.get_latest_backup[\"public_url\"]}'\"\n shell_with_echo \"pg_restore --verbose --clean --no-acl --no-owner -h #{settings[env]['host']} -U #{settings[env]['username']} -d #{settings[env]['database']} #{database}\"\n shell_with_echo \"rm -f #{database}\"\n rescue URI::InvalidURIError\n shell.say \"ERROR: Invalid database URI. Does the backup exist?\"\n end\n else\n shell.say \"Import aborted.\"\n end\n end\n end", "def pull\n check_dependencies('mysqldump', 'mysql', '/bin/sh')\n target = parse_db_location(args.shift || 'development')\n\n display \"This will erase all data in the #{target['database'].inspect} database\" +\n (target['host'].empty? ? '' : \" on #{target['host']}\") + \"!\"\n exit unless dangerous_prompt\n\n copy_db_to_db(database_uri, target)\n end", "def load_database(app_name, instance_name)\n app_config = RailsPwnerer::Config[app_name, instance_name]\n db_name, db_user, db_pass = app_config[:db_name], app_config[:db_user], app_config[:db_pass]\n \n Dir.chdir app_config[:backup_path] do\n # find the latest dump and load it in\n dump_file = Dir.glob(\"db/#{app_name}.#{instance_name}_*\").max\n unless dump_file\n dump_file = Dir.glob(\"db/#{app_name}.*\").max\n end\n Kernel.system \"mysql -u#{db_user} -p#{db_pass} #{db_name} < #{dump_file}\"\n end\n end", "def dest_get\n db_select 'destination'\n end", "def allow_remote_database_url; end", "def remote_database_config(db = rails_env)\n remote_config = capture(\"cat #{sync_db_remote_config}\")\n database = YAML::load(remote_config)\n database and database[\"#{db}\"]\n end", "def remote\n run_in_environment(remote_database) { yield }\n end", "def ship_db\n result = `ssh -t #{USERNAME}@#{STAGING_SERVER} 'rsync /tmp/#{SITECODE}.sql #{USERNAME}@#{PRODUCTION_SERVER}:/tmp/#{SITECODE}.sql'`\n if $?.success?\n puts 'Database shipped to prod.'\n else\n puts 'FAILED shipping database to prod.'\n puts result\n exit(3)\n end\nend", "def get_db_conn\n mongo = nil\n configure :development do\n mongo = Mongo::MongoClient.new('localhost', 27017).db('ddp')\n end\n configure :production do\n mongo = get_remote_connection\n end\n\n #retun connection\n mongo\n end", "def get_backup\n safe_run \"scp #{user}@#{host}:#{remote_path} #{local_path}\"\n local_path\n end", "def get_copy_db_key\n # payLoad = ReportClientHelper.getAsPayLoad([config],None,None)\n options = {\n :query => { 'ZOHO_ACTION' => 'GETCOPYDBKEY' }\n } \n\n send_request get_db_uri, 'post', options\n end", "def connect_remote\n #ENV['DATABASE_URL'] ||= \"postgres://glue.pumpingstationone.org/?pool=5\"\n #ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'])\n ActiveRecord::Base.establish_connection(\n :adapter => 'postgresql',\n :encoding => 'unicode',\n :database => ENV['DB_NAME'], # accessmon\n :username => ENV['DB_USERNAME'], # accessmon\n :password => ENV['DB_PASSWORD'],\n :pool => POOL_COUNT,\n :port => PORT_NUMBER,\n :host => ENV['DB_HOST'])\n end", "def push\n check_dependencies('mysqldump', 'mysql', '/bin/sh')\n source = parse_db_location(args.shift || 'development')\n\n display \"This will replace the #{app} database with the #{source['database'].inspect} database\" +\n (source['host'].empty? ? '' : \" on #{source['host']}\") + \"!\"\n exit unless dangerous_prompt\n\n copy_db_to_db(source, database_uri)\n end", "def allow_remote_database_url=(_arg0); end", "def remote_database_config(db)\n env = rails_env || db\n config = capture \"cat #{latest_release}/config/database.yml\"\n database = YAML::load(config)\n return database[\"#{env}\"]['username'], database[\"#{env}\"]['password'], database[\"#{env}\"]['database'], database[\"#{env}\"]['host']\n end", "def prep_command\n \"mysqldump #{dump_options} -u #{db_user} --password=#{db_password} #{database} > #{remote_backup_path}\"\n end", "def get_db\n manif = Project.miga_online_manif\n @downloadable = manif[:databases].map do |name, i|\n local = Project.find_by(path: name)\n local_v = (local.miga.metadata[:release] || 'unknown') if local && local.miga\n latest = i[:versions][i[:latest].to_sym]\n file = File.join(Settings.miga_projects, latest[:path])\n downloading = File.size(file) * 100 / latest[:size] if File.exist?(file)\n i.merge(name: name, local: local_v, downloading: downloading)\n end\n end", "def import_db\n result = `ssh -t #{USERNAME}@#{STAGING_SERVER} 'mysql -u#{USERNAME} -p#{MYSQL_PASSWORD} #{SITECODE} < /tmp/#{SITECODE}.sql'`\n if $?.success?\n puts 'Database imported into prod.'\n else\n puts 'FAILED importing db on prod.'\n puts result\n exit(5)\n end\nend", "def bare_local_couch_database_url\n \"#{local_couch_host_url}/#{config['couchdb']['local']['database']}\"\n end", "def remote_database_config( db )\n remote_config = capture(\"cat #{shared_path}/config/database.yml\")\n database = YAML::load( remote_config )\n return database[\"#{db}\"]['username'], database[\"#{db}\"]['password'], database[\"#{db}\"]['database'], database[\"#{db}\"]['host']\n end", "def connect_remote_admin\n ActiveRecord::Base.establish_connection(\n :adapter => 'postgresql',\n :schema_search_path => 'public',\n :encoding => 'unicode',\n :database => 'postgres',\n :username => ENV['DB_USERNAME'], # accessmon\n :password => ENV['DB_PASSWORD'],\n :pool => POOL_COUNT,\n :port => PORT_NUMBER,\n :host => ENV['DB_HOST'])\n end", "def db\n \n ActiveRecord::Base.establish_connection(:adapter => \"mysql2\",\n :database => \"prod1\",\n :user => \"root\",\n :password=>\"Sector@123\",\n :local_infile => true).connection()\n \n end", "def master_db; machine_by_role('master_db'); end", "def clone_conn(args = {})\r\n conn = Knj::Db.new(@opts.clone.merge(args))\r\n \r\n if block_given?\r\n begin\r\n yield(conn)\r\n ensure\r\n conn.close\r\n end\r\n \r\n return nil\r\n else\r\n return conn\r\n end\r\n end", "def remote_database_config(db)\n remote_config = capture(\"cat #{shared_path}/config/#{fetch(:db_file, 'mongoid.yml')}\")\n database = YAML::load(remote_config)\n return database[\"#{db}\"]['clients']['default']['username'], database[\"#{db}\"]['clients']['default']['password'], database[\"#{db}\"]['clients']['default']['database'], database[\"#{db}\"]['clients']['default']['hosts'][0]\n end", "def getDB\n @db\n end", "def download_distant_base\n distant_local_path.remove if distant_local_path.exist?\n cmd = \"scp -p #{serveur_ssh_boa}:#{base_distant_path_boa} #{distant_local_path.expanded_path}\"\n res = `#{cmd}`\n if distant_local_path.exist?\n @suivi << \"Download du fichier analyse.db distant OK\"\n else\n raise \"Impossible de ramener le fichier analyse.db distant… (#{res.inspect})\"\n end\n end", "def get_local_customer_databases(options)\n conn = PG.connect(options)\n all_customer_databases = []\n conn.exec(@@db_suite_query).each { |row|\n database = {}\n database[:server_name] = row['server_name']\n database[:db_name] = row['db_name']\n\n all_customer_databases.push(database)\n }\n conn.close\n\n local_customer_databases = all_customer_databases.select { |database|\n is_local_server?(database[:server_name])\n }\n local_customer_databases\n end", "def get_db(dbname)\n Database.new(dbname, @socket, self)\n end", "def new_db(options = {})\n cached = find_cached(options)\n return cached if cached && !options[:force_new]\n @cache[options] = ConnectionMaker.new(options).connection\n end", "def backup_database\n #todo handle db prefix\n #todo proper error handling\n\n dbuser = @attributes[:dbuser]\n dbhost = @attributes[:dbhost]\n dbpass = @attributes[:dbpass]\n dbname = @attributes[:dbname]\n\n # see https://docs.moodle.org/20/en/Site_backup\n\n cmd = %Q{mysqldump -u #{dbuser} -h'#{dbhost}' -p'#{dbpass}' -C -Q -e --create-options '#{dbname}' | gzip -9 > '#{mk_backup_filename('database')}'}\n system cmd\n\n nil\n end", "def get_database\n\t\tdb = Mysql2::Client(:host => 'localhost',:user => 'root',:password => 'abcd0311')\n\n\t\tbegin\n\t\t\tdb.query(\"DROP DATABASE #{@month}_#{@year}_clients\")\n\t\t\tdb.query(\"CREATE DATABASE #{@month}_#{@year}_clients\")\n\t\trescue Exception => e\n\t\t\tdb.query(\"CREATE DATABASE #{@month}_#{@year}_clients\")\n\t\tend\n\n\t\tdb.query(\"USE #{@month}_#{@year}_clients\")\n\t\tdb.query(\"CREATE TABLE users(cID integer, name varchar(50), address varchar(50), prov varchar(50), postal varchar(50), email varchar(50), cost float);\")\n\t\tdb\n\tend", "def extract_db_content(version)\n # Only compare tables with meaningful data. Tables\n # containing temporary state, e.g., db_mutex, are not relevant here.\n # TODO: re-add other tables to check.\n include_tables = %w[master_accounts accounts positions partners partner_users]\n\n client = startup\n\n # db_columns is a temporary structure - it holds all columns for db, by table.\n # It will be merged with rows into a single data structure to facilitate\n # comparison between the 2 DBs.\n db_columns = build_columns_hash(client)\n\n # build the structure which will be used for table comparisons.\n db_columns_and_rows = build_columns_and_rows_hash(db_columns, client, include_tables)\n\n store = initialize_store('mg_db.' + version)\n persist_data(db_columns_and_rows, store)\nend", "def remote_database_url\n raise \"You must override `remote_database_url' in your class\"\n end", "def opendb\n db = Rho::Database.new(Rho::Application.databaseFilePath('local'), 'local')\n render :json => db.to_s\n return db.to_s\n end", "def databases\n get '_all_dbs'\n end", "def query_dblink_connect\n #Get connection string from database url\n connection_string = get_connection_string(remote_database_url)\n #Ensure that we use an existing connection if we run within the same session\n <<-SQL.strip\n -- Connect to remote db\n DO $$\n DECLARE\n -- Get existing connections\n conns text[] := dblink_get_connections();\n BEGIN\n -- Check if connection already exists\n IF conns @> ARRAY['#{connection_name}'::text] THEN\n raise notice 'Using existing connection: %', conns;\n ELSE\n -- Make connection\n PERFORM dblink_connect('#{connection_name}', '#{connection_string}');\n END IF;\n END$$;\n SQL\n end", "def db_info\n @conn.query({url_path: \"#{database}\", method: :get})\n end", "def database! url\n parsed = parse url\n cr = CouchRest.new(parsed[:host])\n cr.database!(parsed[:database])\n end", "def export_db\n result = `ssh -t #{USERNAME}@#{STAGING_SERVER} 'mysqldump -u#{MYSQL_USER} -p#{MYSQL_PASSWORD} #{SITECODE} > /tmp/#{SITECODE}.sql'`\n if $?.success?\n puts 'Database exported from staging.'\n else\n puts 'FAILED exporting database from staging'\n puts result\n exit(2)\n end\nend", "def db_path\n @db\n end", "def database\n @@db\n end", "def local\n db_dump\n sync_local\n system_lists\n commit_git_repo(\"~/backup\")\n end", "def dump_database(app_name, instance_name)\n app_config = RailsPwnerer::Config[app_name, instance_name]\n db_name, db_user, db_pass = app_config[:db_name], app_config[:db_user], app_config[:db_pass]\n\n pwnerer_user = app_config[:pwnerer_user]\n pwnerer_uid = uid_for_username(pwnerer_user)\n pwnerer_gid = gid_for_username(pwnerer_user)\n \n timestamp = Time.now.strftime '%Y%m%d%H%M%S'\n dump_file = \"db/#{app_name}.#{instance_name}_#{timestamp}.sql\"\n Dir.chdir app_config[:backup_path] do\n system(\"mysqldump --add-drop-database --add-drop-table\" +\n \" --skip-extended-insert --single-transaction\" +\n \" -u#{db_user} -p#{db_pass} #{db_name} > #{dump_file}\")\n # lockdown the file\n File.chmod(0400, dump_file)\n File.chown(pwnerer_uid, pwnerer_gid, dump_file)\n end\n end", "def connect_to_old_db\n ActiveRecord::Base.establish_connection(\n :adapter => \"postgresql\",\n :host => \"localhost\",\n :username => \"postgres\",\n :password => \"vegpuf\",\n :database => \"affluence_staging_25_june\"\n )\nend", "def db\n return @args[:db]\n end", "def launch_get_db\n name = params[:name]\n version = params[:version]\n Thread.new do\n require 'miga/cli'\n\n # Get current registered version\n project = Project.find_by(path: name)\n if project && project.miga\n project.miga.metadata[:release] =\n \"#{project.miga.metadata[:release]} (currently updating)\"\n project.miga.save\n end\n\n # Download\n error =\n MiGA::Cli.new([\n 'get_db', '-n', name, '--db-version', version,\n '--local-dir', Settings.miga_projects, '--no-progress'\n ]).launch\n raise(error) if error.is_a? Exception\n\n # Register in the database\n project ||= current_user.projects.create(path: name)\n project.update(reference: true)\n f = File.join(Settings.miga_projects, \"#{name}_#{version}.tar.gz\")\n File.unlink(f) if File.exist? f\n ActiveRecord::Base.connection.close\n end\n\n sleep(10) # <- Hopefully this is enough to start the download\n flash[:success] = 'Downloading database in the background'\n redirect_to get_db_path\n end", "def prod_db2dev\n exit_if_production\n prod_db_backup\n prod_db_pull\n prod_db_load\n end", "def openDB\n db =Rho::Database.new(Rho::Application.databaseFilePath('local'), \"local\");\n puts \"#{db.to_s}\"\n data = db\n data\n end", "def mysql\n return @db if @db\n @db = Sequel.connect(\n :adapter => 'mysql2',\n :host => @ip,\n :port => @port,\n :user => @user || Jetpants.app_credentials[:user],\n :password => Jetpants.app_credentials[:pass],\n :database => Jetpants.mysql_schema,\n :max_connections => Jetpants.max_concurrency)\n end", "def select_db(db)\n query \"use #{db}\"\n self\n end", "def connect_to_database\n config = Rails.configuration.database_configuration\n host = config[Rails.env][\"host\"]\n dbname = config[Rails.env][\"database\"]\n username = config[Rails.env][\"username\"]\n password = config[Rails.env][\"password\"]\n \n client = Mysql2::Client.new(:host => host, :username => username, :password => password, :flags => Mysql2::Client::MULTI_STATEMENTS)\n \n if client.query(\"SHOW DATABASES LIKE '#{dbname}'\").count == 0\n print \"Database '#{dbname}' not found, creating...\"\n client.query(\"CREATE DATABASE #{dbname}\")\n print \"\\n\" + File.open(SETUP_FILE,\"r\").read\n client.select_db(dbname)\n client.query(File.open(SETUP_FILE,\"r\").read)\n end\n \n finalClient = Mysql2::Client.new(:host => host, :username => username, :password => password, :database => dbname)\n \n return finalClient\n \n end", "def replicate_to(local_db, other_node, remote_db, now = true)\n replicate_to_or_from_async(local_db, other_node, remote_db, true, now)\n end", "def get_couch_db(url)\n if !url.end_with?('/')\n url = url + '/'\n end\n url = url + 'mydb'\n\n puts 'Using URL: ' + url\n #This will create the DB if it does not exist, however it will fail if you do not have permissions\n CouchRest.database!(url)\n end", "def get_legacy_db_conn\n Mysql2::Client.new(:host => ENV[\"SDBMSS_LEGACY_DB_HOST\"],\n :username => ENV[\"SDBMSS_LEGACY_DB_USER\"],\n :database => ENV[\"SDBMSS_LEGACY_DB_NAME\"],\n :password => ENV[\"SDBMSS_LEGACY_DB_PASSWORD\"],\n )\n end", "def capture\n db = resolve_db(:allow_default => true)\n\n from_url = db[:url]\n from_name = db[:name]\n to_url = nil # server will assign\n to_name = \"BACKUP\"\n opts = {:expire => extract_option(\"--expire\")}\n\n backup = transfer!(from_url, from_name, to_url, to_name, opts)\n\n to_uri = URI.parse backup[\"to_url\"]\n backup_id = to_uri.path.empty? ? \"error\" : File.basename(to_uri.path, '.*')\n display \"\\n#{db[:pretty_name]} ----backup---> #{backup_id}\"\n\n backup = poll_transfer!(backup)\n\n if backup[\"error_at\"]\n message = \" ! An error occurred and your backup did not finish.\"\n message += \"\\n ! The database is not yet online. Please try again.\" if backup['log'] =~ /Name or service not known/\n message += \"\\n ! The database credentials are incorrect.\" if backup['log'] =~ /psql: FATAL:/\n abort(message)\n end\n end", "def get_db(**db_conn_info)\n Sequel.mysql2(db_conn_info)\nend", "def get(remote, options)\n log.warn{ \"Getting a dump from #{remote}\" }\n @shell.run(commands.fetch(remote, options))\n end", "def database\n @database\n end", "def database\n @database\n end", "def remote_backup_path\n remote_path\n end", "def db_to_file(src, dest)\n pool = Connections.init_pool src\n query_stream = QueryStream.new pool\n file_writer = FileWriter.new dest\n\n Pipe.new from: query_stream, to: file_writer\n end", "def db\n @db ||= new_connection\n end", "def website_connection(subdomain)\n\t default_connection.dup.update(:database => (\"db/\" + subdomain + \".sqlite3\"))\n\tend", "def connect_to_target_db\n ActiveRecord::Base.establish_connection(Rails.env.to_sym)\n end", "def db\r\n @db ||= PG.connect(\r\n host: ENV['HOST'],\r\n user: ENV['USER_NAME'],\r\n password: ENV['PASSWORD'],\r\n dbname: ENV['DATABASE']\r\n )\r\nend", "def get_database(db_name)\n Monga::Database.new(@client, db_name)\n end", "def db_export_cmd(server)\n raise \"No server given\" if !server\n env = \"RAILS_ENV=#{fetch(:rails_env, 'production')}\"\n import_cmd = \"cd #{release_path} && #{rake_cmd} alchemy:db:import #{env}\"\n ssh_cmd = \"#{ssh_command(server)} '#{import_cmd}'\"\n \"#{database_dump_command(database_config['adapter'])} | #{ssh_cmd}\"\n end", "def prepare_from_yaml\n set(:db_file) { \"#{application}-dump.sql.bz2\" }\n set(:db_remote_file) { \"#{shared_path}/backup/#{db_file}\" }\n set(:db_local_file) { \"tmp/#{db_file}\" }\n set(:db_user) { db_config[rails_env][\"username\"] }\n set(:db_pass) { db_config[rails_env][\"password\"] }\n set(:db_host) { db_config[rails_env][\"host\"] }\n set(:db_name) { db_config[rails_env][\"database\"] }\n end", "def config_master_from_scratch_from_dumpfile(server)\n create_stripe_from_dumpfile(server)\n run_query(\"CREATE DATABASE i_heart_monkey\", server)\n set_master_dns(server)\n # This sleep is to wait for DNS to settle - must sleep\n sleep 120\n run_script(\"backup\", server)\n end", "def db\n @db ||= find_or_create_database\n end", "def pqdb(planet)\n log_if_missing(planet, 'pqdb')\n\n server = find_server(planet)\n value = server.connection(:ssh)\n\n errors = Logger.instance.errors(server.id)\n log(planet.id, errors) if errors.any?\n\n \"#{planet['pqdb']&.split('@')&.last}:#{value}\"\n end", "def copy_remote_shared_cache_to_release_path\n logger.debug \"Copying the remote shared cache to release path\"\n run \"mkdir -p #{configuration[:release_path]} && cp -RPp #{revision_cache_dir}/* #{configuration[:release_path]}\"\n end", "def prepare_from_yaml\n set(:db_file) { \"#{application}-dump.sql.bz2\" }\n set(:db_remote_file) { \"#{shared_path}/backup/#{db_file}\" }\n set(:db_local_file) { \"tmp/#{db_file}\" }\n set(:db_user) { db_config[rails_env][\"username\"] }\n set(:db_password) { db_config[rails_env][\"password\"] }\n set(:db_host) { db_config[rails_env][\"host\"] }\n set(:db_name) { db_config[rails_env][\"database\"] }\n end", "def restore \n # pg_restore -c -U postgres -d dataslam -1 /tmp/out.dump\n begin\n check_if_db_exists\n is_allowed = @conn.exec(\"select datallowconn from pg_catalog.pg_database where datname='#{@options[:database]}'\")[0]['datallowconn']\n if is_allowed == 'f'\n # unquiece temporarily\n set_dataallowcon_to true\n end\n\n fn = get_latest_backup_fn\n\n if fn == \"\"\n raise NoBackupsAvailableException.new \"There are no backups available at the specified location or in the default location (/tmp/postgresbk)\"\n end\n\n # The below system call assumes you have passwordless access as the user passed into the executable tool\n # either due to ~/.pgpass or pg_hba.conf has your user as a 'trust' auth method\n `pg_restore -c -U #{@options[:user]} -d #{@options[:database]} -1 #{@options[:bkdir]}/#{fn}`\n\n rescue Exception => e\n raise e\n ensure\n if is_allowed == 'f'\n # re quiesce \n set_dataallowcon_to false\n end\n end\n end", "def database! url\n parsed = parse url\n cr = Sova.new(parsed[:host])\n cr.database!(parsed[:database])\n end", "def get_remote_connection\n retun db_connection if db_connection\n db = URI..parse(ENV['MONGOHQ_URl'])\n db_name = db.path.gsub(/^\\//, '')\n db_connection = Mongo::Connection.new(db.host, db.port).db(db_name)\n db_connection.authenticate(db.user, db.password) unless db.user.nil?\n db_connection\n #check incoming message\n end", "def getToolsSyndicateLocaldatabase( entity_id, destructive)\n params = Hash.new\n params['entity_id'] = entity_id\n params['destructive'] = destructive\n return doCurl(\"get\",\"/tools/syndicate/localdatabase\",params)\n end", "def database\n \"--db='#{ name }'\"\n end", "def connection\n @db = Connection.client\nend", "def prepare_from_yaml\n set(:db_file) { \"#{application}-dump.sql.bz2\" }\n set(:db_remote_file) { \"#{current_path}/backup/#{db_file}\" }\n set(:db_local_file) { \"tmp/#{db_file}\" }\n set(:db_user) { db_config[rails_env][\"username\"] }\n set(:db_pass) { db_config[rails_env][\"password\"] }\n set(:db_host) { db_config[rails_env][\"host\"] }\n set(:db_name) { db_config[rails_env][\"database\"] }\n end", "def do_get_server_dump(address, table_name)\n return nil unless Module.const_get(table_name)\n # call the remote server sending the table that we want to import\n req = http_open_post(address, $SYNC_CONFIG[:dump_uri]) do |request|\n start_id = current_client.last_synced || -1\n form_data = { 'table_name' => table_name }\n request.set_form_data form_data\n end\n\n result ||= ActsAsReplica::Structs::SyncDumpResult.new\n result.status = case req\n when Net::HTTPSuccess\n fix_model_loading\n package = YAML.load(expand(req.body))\n result.last_synced = package.last_synced\n result.total = package.total.to_i\n \n # unpacks the received CSV package into a temporary file\n tmp_file = File.join(RAILS_ROOT, 'tmp', \"#{UUID.timestamp_create().to_s}.csv\")\n begin\n File.open(tmp_file, 'w') { |f| f.write package.payload } \n if Replica.compare_version(package.version)\n result.errors << \"Remote #{package.version} and Local #{Replica.version} versions are different.\"\n 500\n else\n if result.total > 0\n # loads the CSV file into the table\n model_class = Module.const_get(table_name)\n model_class.import_from_csv(tmp_file)\n result.result_message = \"Loaded #{model_class.count} rows from #{File.size(tmp_file)} csv file.\"\n end\n 200\n end\n ensure\n File.delete(tmp_file) if File.exists?(tmp_file)\n end\n else\n result.errors << \"Unknown error #{req.to_yaml}.\"\n 500\n end \n result\n end", "def get_gzipped_backup\n safe_run \"ssh #{user}@#{host} gzip -c #{remote_path} > #{local_path}\"\n local_path\n end", "def get_db\n # we want to check a couple levels 2011-09-28 \n unless @db\n unless File.exists? @file\n 3.times do |i|\n @file = \"../#{@file}\"\n break if File.exists? @file\n end\n end\n end\n @db ||= DB.new @file\n end", "def db\n unless @db # not connected\n @db = Sequel.connect(self.db_uri, :logger => self.log)\n end\n @db\n end", "def on_db_host(host)\n\tend", "def cloned_conn(args = nil, &block)\r\n clone_conn_args = {\r\n :threadsafe => false\r\n }\r\n \r\n clone_conn_args.merge!(args[:clone_args]) if args and args[:clone_args]\r\n dbconn = self.clone_conn(clone_conn_args)\r\n \r\n begin\r\n yield(dbconn)\r\n ensure\r\n dbconn.close\r\n end\r\n end", "def create_database!(name=nil)\n db = if name\n self.server.database!(db_name_with_prefix(name))\n else\n self.database!\n end\n create_rotation_filter(db)\n if self.respond_to?(:design_doc)\n design_doc.sync!(db)\n # or maybe this?:\n #self.design_docs.each do |design|\n # design.migrate(to_db)\n #end\n end\n return db\n end", "def db\n @connection.pg rescue nil\n end", "def connect_local\n ActiveRecord::Base.establish_connection(\n :adapter => 'postgresql',\n :encoding => 'unicode',\n :database => ENV['DB_NAME'], # accessmon\n :username => ENV['DB_USERNAME'], # accessmon\n :password => ENV['DB_PASSWORD'],\n :pool => POOL_COUNT,\n :port => PORT_NUMBER,\n :host => 'localhost')\n end", "def new_connection\n old_db_id = @db.nil? ? 0 : @db.object_id\n @db.disconnect! unless @db.nil?\n\n @db = ActiveRecord::Base.mysql2_connection(@db_config)\n\n new_db_id = @db.object_id\n logger.info(\"New cache db connection - old db id was: #{old_db_id} -- new db id is: #{new_db_id}\")\n\n return @db\n end", "def db\n @db ||= finder_result.connection\n end", "def db\n return @client if @client\n @client = Mysql2::Client.new(\n host: 'localhost',\n port: nil,\n username: 'root',\n password: nil,\n database: 'isucon5q',\n reconnect: true,\n )\n @client.query_options.merge!(symbolize_keys: true)\n @client\nend", "def prepare_env(load_stage = stage)\n \n load_stage = load_stage.to_s\n \n if !db_config \n Wpcap::Utility.error(\"No Database Configurations Found\")\n abort \n end\n \n if remote_config(:db_priv_pass).nil?\n Wpcap::Utility.error \"This no privileged user for this server found in servers ssh environment profile (did you set it up with wpcap?)\" \n abort\n end\n \n set(:local_dump) { \"/tmp/#{application}.sql.bz2\" }\n \n if db_config[load_stage]\n \n set(:db_priv_user) { remote_config(:db_priv_user).nil? ? db_config[load_stage][\"username\"] : remote_config(:db_priv_user) }\n set(:db_priv_pass) { remote_config(:db_priv_pass).nil? ? db_config[load_stage][\"password\"] : remote_config(:db_priv_pass) }\n set(:db_host) { db_config[load_stage][\"host\"] }\n set(:db_database) { db_config[load_stage][\"database\"] }\n set(:db_username) { db_config[load_stage][\"username\"] }\n set(:db_password) { db_config[load_stage][\"password\"] }\n set(:db_encoding) { db_config[load_stage][\"encoding\"] }\n set(:db_prefix) { db_config[load_stage][\"prefix\"] } \n \n else\n\n set :db_priv_user , remote_config(:db_priv_user) \n set :db_priv_pass , remote_config(:db_priv_pass) \n set :db_username , \"#{application.split(\".\").first}_#{stage}\"\n set :db_database , \"#{application.split(\".\").first}_#{stage}\"\n set :db_password , random_password(16)\n set :db_prefix , \"wp_\" || db_config[\"development\"][\"prefix\"]\n \n run \"mkdir -p #{shared_path}/config\"\n template \"mysql.yml.erb\", \"#{shared_path}/config/database.yml\"\n server_yaml = capture \"cat #{shared_path}/config/database.yml\"\n server_mysql_config_yaml = YAML.load(server_yaml)\n update_db_config(server_mysql_config_yaml)\n db_config(true)\n end\n \n end", "def db\n \n ActiveRecord::Base.establish_connection(:adapter => \"mysql2\",\n :database => \"prod1\",\n :user => \"root\",\n :password=>\"Sector@123\").connection()\n \n end", "def db\n self.class.db\n end", "def copy(source, destination, db: nil, replace: false)\n command = [:copy, source, destination]\n command << \"DB\" << db if db\n command << \"REPLACE\" if replace\n\n send_command(command, &Boolify)\n end", "def db\n return self.class.db\n end" ]
[ "0.72718006", "0.7223119", "0.6435807", "0.639212", "0.634865", "0.6223213", "0.6178505", "0.60673386", "0.6047757", "0.60119694", "0.6010364", "0.5994275", "0.59720045", "0.59632635", "0.5943177", "0.59012204", "0.5879574", "0.5877699", "0.5876134", "0.5868596", "0.58518296", "0.5842148", "0.58408", "0.58282995", "0.582748", "0.58180475", "0.57957715", "0.5788061", "0.57171935", "0.5670086", "0.5624059", "0.562254", "0.56188303", "0.56088907", "0.56018597", "0.559614", "0.5569369", "0.5569029", "0.5552855", "0.5547966", "0.55465126", "0.55337906", "0.553163", "0.55276036", "0.55208594", "0.5514739", "0.55132735", "0.5509305", "0.5490684", "0.5482941", "0.54764104", "0.54749167", "0.54494023", "0.5448819", "0.5448008", "0.54457474", "0.54445773", "0.5436303", "0.54350936", "0.54336774", "0.54336286", "0.5433057", "0.5433057", "0.5427438", "0.54263186", "0.540753", "0.53993666", "0.5398699", "0.53896683", "0.53728783", "0.5372218", "0.53603923", "0.53520936", "0.53482354", "0.5347434", "0.53433734", "0.5342006", "0.53414744", "0.5340594", "0.53398985", "0.53357345", "0.5327817", "0.53270555", "0.5297084", "0.5291795", "0.5291417", "0.52906615", "0.5289958", "0.52887636", "0.5286632", "0.5277936", "0.5277542", "0.527398", "0.5273037", "0.5270755", "0.52697957", "0.52668744", "0.5256981", "0.5256575", "0.52512854", "0.5250819" ]
0.0
-1
get a zipped copy of the db from remote host
def get_gzipped_backup tar_file = get_tempfile safe_run "tar -czf #{tar_file} #{tar_dir}" tar_file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_gzipped_backup\n safe_run \"ssh #{user}@#{host} gzip -c #{remote_path} > #{local_path}\"\n local_path\n end", "def zip_dump\n\t system(\"mongodump --host localhost --db #{@mongo_database} --out #{@base_path}\")\n\t Dir[@base_path + '*.zip'].select { |e| File.delete(e) }\n\t Zip::File.open(@zipfile_name, Zip::File::CREATE) do |zipfile|\n\t Dir[File.join(@directory, '**', '**')].each do |file|\n\t\t zipfile.add(file.sub(@directory + '/', ''), file)\n\t end\n\t end\n\t end", "def zipfile metadata\n cmd = \"cd #{Myreplicator.configs[@export_obj.source_schema][\"export_stg_dir\"]}; gzip #{@export_obj.filename}\"\n\n puts cmd\n\n zip_result = metadata.ssh.exec!(cmd)\n\n unless zip_result.nil?\n raise Exceptions::ExportError.new(\"Export Error\\n#{zip_result}\") if zip_result.length > 0\n end\n\n metadata.zipped = true\n\n return zip_result\n end", "def ship_db\n result = `ssh -t #{USERNAME}@#{STAGING_SERVER} 'rsync /tmp/#{SITECODE}.sql #{USERNAME}@#{PRODUCTION_SERVER}:/tmp/#{SITECODE}.sql'`\n if $?.success?\n puts 'Database shipped to prod.'\n else\n puts 'FAILED shipping database to prod.'\n puts result\n exit(3)\n end\nend", "def get_backup(to_gzip = false)\n gzip_str = to_gzip ? '| gzip' : ''\n begin\n f = Tempfile.new(host, '/tmp')\n f.write(\"[client]\\npassword=#{password}\")\n f.close\n safe_run \"mysqldump \" \\\n \"--defaults-file=#{f.path} \" \\\n \"--host=#{host} \" \\\n \"--user=#{user} \" \\\n \"--all-databases \" \\\n \"--ignore-table=mysql.slow_log_backup \" \\\n \"--ignore-table=mysql.slow_log \" \\\n \"--single-transaction \" \\\n \"#{gzip_str} > #{local_path}\"\n ensure\n f.unlink\n end\n local_path\n end", "def db_to_file(src, dest)\n pool = Connections.init_pool src\n query_stream = QueryStream.new pool\n file_writer = FileWriter.new dest\n\n Pipe.new from: query_stream, to: file_writer\n end", "def download_backup(host,port,user,password,name,path,format)\n connect_to_host(host,port,user,password,true)\n if format == 'binary'\n local_file = path+name+\".backup\"\n remote_file = name+\".backup\"\n elsif format== 'script'\n local_file = path+name+\".rsc\"\n remote_file = name+\".rsc\"\n end\n download_file(remote_file,local_file)\n @ssh_connect.close(@ssh_connect)\n end", "def import_remote_database env = \"development\"\n settings = database_settings\n if database_settings.empty?\n shell.say \"ERROR: Unable to load database setings for current app. Are you within the root folder of a Rails project?\"\n else\n answer = shell.yes? \"You are about to perminently override all data in the local \\\"#{env}\\\" database. Do you wish to continue (y/n)?\"\n if answer\n begin\n heroku = Heroku::Client.new @heroku_credentials.login, @heroku_credentials.password\n pg = PGBackups::Client.new heroku.config_vars(application)[\"PGBACKUPS_URL\"]\n database = \"latest.dump\"\n shell_with_echo \"curl -o #{database} '#{pg.get_latest_backup[\"public_url\"]}'\"\n shell_with_echo \"pg_restore --verbose --clean --no-acl --no-owner -h #{settings[env]['host']} -U #{settings[env]['username']} -d #{settings[env]['database']} #{database}\"\n shell_with_echo \"rm -f #{database}\"\n rescue URI::InvalidURIError\n shell.say \"ERROR: Invalid database URI. Does the backup exist?\"\n end\n else\n shell.say \"Import aborted.\"\n end\n end\n end", "def copy_database\n options = {\n :query => { 'ZOHO_ACTION' => 'COPYDATABASE' }\n }\n\n send_request get_db_uri, 'post', options\n end", "def make_mysql_backup\n if @all_databases\n options = {\n :name => \"--all-databases\",\n :dump_options => \"\",\n :append_name => \"\"\n }\n file_name = mysqldump(options)\n compress_file(file_name)\n end\n if @databases && !@databases.empty?\n @databases.each do |db|\n options = {\n :name => db[:name].to_s,\n :dump_options => db[:dump_options].to_s,\n :append_name => db[:append_name].to_s\n }\n file_name = mysqldump(options)\n compress_file(file_name)\n end\n end\nend", "def remote_backup_path\n remote_path\n end", "def download_distant_base\n distant_local_path.remove if distant_local_path.exist?\n cmd = \"scp -p #{serveur_ssh_boa}:#{base_distant_path_boa} #{distant_local_path.expanded_path}\"\n res = `#{cmd}`\n if distant_local_path.exist?\n @suivi << \"Download du fichier analyse.db distant OK\"\n else\n raise \"Impossible de ramener le fichier analyse.db distant… (#{res.inspect})\"\n end\n end", "def backup_database\n #todo handle db prefix\n #todo proper error handling\n\n dbuser = @attributes[:dbuser]\n dbhost = @attributes[:dbhost]\n dbpass = @attributes[:dbpass]\n dbname = @attributes[:dbname]\n\n # see https://docs.moodle.org/20/en/Site_backup\n\n cmd = %Q{mysqldump -u #{dbuser} -h'#{dbhost}' -p'#{dbpass}' -C -Q -e --create-options '#{dbname}' | gzip -9 > '#{mk_backup_filename('database')}'}\n system cmd\n\n nil\n end", "def get_db\n manif = Project.miga_online_manif\n @downloadable = manif[:databases].map do |name, i|\n local = Project.find_by(path: name)\n local_v = (local.miga.metadata[:release] || 'unknown') if local && local.miga\n latest = i[:versions][i[:latest].to_sym]\n file = File.join(Settings.miga_projects, latest[:path])\n downloading = File.size(file) * 100 / latest[:size] if File.exist?(file)\n i.merge(name: name, local: local_v, downloading: downloading)\n end\n end", "def prep_command\n \"mysqldump #{dump_options} -u #{db_user} --password=#{db_password} #{database} > #{remote_backup_path}\"\n end", "def pull\n check_dependencies('mysqldump', 'mysql', '/bin/sh')\n target = parse_db_location(args.shift || 'development')\n\n display \"This will erase all data in the #{target['database'].inspect} database\" +\n (target['host'].empty? ? '' : \" on #{target['host']}\") + \"!\"\n exit unless dangerous_prompt\n\n copy_db_to_db(database_uri, target)\n end", "def get_backup\n safe_run \"scp #{user}@#{host}:#{remote_path} #{local_path}\"\n local_path\n end", "def remote_backup_path #:nodoc:\n full_tarfile+\".gz\"\n end", "def archive\n @archive ||= RestClient.get info['link'] + '/zip'\n end", "def local\n db_dump\n sync_local\n system_lists\n commit_git_repo(\"~/backup\")\n end", "def remote_backup_path\n [remote_directory, Confluence.filename].join('/')\n end", "def backup(id)\n server = @connection.servers.get(id)\n ssh(server,'~/backup.sh')\n server.scp_download('backup/current.tar.gz','backup.tar.gz')\n end", "def backup_sqlite3 (prefix)\n bkfilename = Rails.root.join(\"db\",\"backups\",\"#{prefix}-backup-\" + Time.now.strftime(\"%Y%m%d%H%M%S\") + \".tar.gz\").to_s\n `tar -zcvf \"#{addslashes(bkfilename)}\" db/*.sqlite3`\n bkfilename\nend", "def export_db\n result = `ssh -t #{USERNAME}@#{STAGING_SERVER} 'mysqldump -u#{MYSQL_USER} -p#{MYSQL_PASSWORD} #{SITECODE} > /tmp/#{SITECODE}.sql'`\n if $?.success?\n puts 'Database exported from staging.'\n else\n puts 'FAILED exporting database from staging'\n puts result\n exit(2)\n end\nend", "def copy_database(from, to, from_host=\"localhost\")\n oh = OrderedHash.new\n oh[:copydb] = 1\n oh[:fromhost] = from_host\n oh[:fromdb] = from\n oh[:todb] = to\n self[\"admin\"].command(oh)\n end", "def import_db\n result = `ssh -t #{USERNAME}@#{STAGING_SERVER} 'mysql -u#{USERNAME} -p#{MYSQL_PASSWORD} #{SITECODE} < /tmp/#{SITECODE}.sql'`\n if $?.success?\n puts 'Database imported into prod.'\n else\n puts 'FAILED importing db on prod.'\n puts result\n exit(5)\n end\nend", "def db_export_cmd(server)\n raise \"No server given\" if !server\n env = \"RAILS_ENV=#{fetch(:rails_env, 'production')}\"\n import_cmd = \"cd #{release_path} && #{rake_cmd} alchemy:db:import #{env}\"\n ssh_cmd = \"#{ssh_command(server)} '#{import_cmd}'\"\n \"#{database_dump_command(database_config['adapter'])} | #{ssh_cmd}\"\n end", "def best_dumps_path\n if database.via_ssh?\n return main_storage.path if same_ssh_as_database?(main_storage)\n else\n return main_storage.path if main_storage.local?\n end\n Dir.tmpdir\n end", "def backup \n begin\n check_if_db_exists\n is_allowed = @conn.exec(\"select datallowconn from pg_catalog.pg_database where datname='#{@options[:database]}'\")[0]['datallowconn']\n if is_allowed == 'f'\n # unquiece temporarily\n set_dataallowcon_to true\n end\n\n # Check to see if the directory for backups exists and if not, create it with parents\n unless File.exist?(@options[:bkdir])\n FileUtils.mkdir_p @options[:bkdir]\n end\n filename = \"postgresbk_#{@options[:database]}_#{Time.new.strftime(\"%m%d%y%H%M%S\")}.dump\"\n\n # The below system call assumes you have passwordless access as the user passed into the executable tool\n # either due to ~/.pgpass or pg_hba.conf has your user as a 'trust' auth method\n `pg_dump -U #{@options[:user]} #{@options[:database]} -F c -f #{@options[:bkdir]}/#{filename}`\n\n rescue Exception => e\n raise e\n ensure\n if is_allowed == 'f'\n # re quiesce \n set_dataallowcon_to false\n end\n end\n end", "def dump\n check_dependencies('mysqldump', 'bzip2', '/bin/sh')\n options = {}\n while arg = args.shift\n case arg\n when '-f', '--force'\n options[:force] = true\n when /^[^-]/\n raise CommandFailed, \"too many arguments passed\" if options[:filename]\n options[:filename] = arg\n else\n raise CommandFailed, \"unsupported option: #{arg}\"\n end\n end\n\n options[:filename] ||= \"#{app}-#{Time.now.strftime('%Y-%m-%d')}.sql.bz2\"\n options[:filename] += '.sql.bz2' unless options[:filename] =~ /\\.sql(\\.bz2)?$/\n options[:filename] += '.bz2' unless options[:filename] =~ /\\.bz2$/\n\n if File.exists?(options[:filename]) && !options[:force]\n raise CommandFailed, \"file already exists. use --force to override.\"\n end\n\n exec('/bin/sh', '-c',\n \"mysqldump --compress --single-transaction #{args_to_s(mysql_args(database_uri))}\" +\n pv_pipe +\n %{| bzip2 > '#{options[:filename]}'})\n end", "def csv_dump(addr, root_dir)\n filename = \"full.csv\"\n dump_dir = File.join(root_dir)\n filepath = File.join(dump_dir, filename)\n\n cmd = \"psql -c '\\\\copy (SELECT * FROM outdoor_env WHERE (apogee_w_m2 IS NOT NULL AND address=#{addr}) ORDER BY db_time DESC) To #{filepath} With CSV header\\'\"\n run_command(cmd)\nend", "def compress(path)\n Monsove.logger.info(\"Compressing database #{path}\")\n\n system(\"cd #{path} && tar -cjpf #{path}.tar.bz2 .\")\n raise \"Error while compressing #{path}\" if $?.to_i != 0\n end", "def local_export_and_copy_remote_shared_cache\n logger.debug \"Performing a local :export of revision #{revision} to #{destination}\"\n system(command)\n File.open(File.join(destination,\"REVISION\"), \"w\") { |f| f.puts(revision) }\n logger.debug \"Compressing #{destination} to #{filename}\"\n Dir.chdir(tmpdir) { system(compress(File.basename(destination), File.basename(filename)).join(\" \")) }\n content = File.open(filename, \"rb\") { |f| f.read }\n put content, remote_filename\n run \"umask 02 && mkdir -p #{revision_cache_dir}\"\n uncompress_and_move_command = \"cd #{remote_dir} && #{decompress(remote_filename).join(\" \")} && \" + \n \"cp -RPp #{remote_tmp_release_dir}/* #{revision_cache_dir} && \" +\n \"rm #{remote_filename} && rm -rf #{remote_tmp_release_dir}\"\n run(uncompress_and_move_command)\n ensure\n FileUtils.rm filename rescue nil\n FileUtils.rm_rf destination rescue nil\n end", "def load_database(app_name, instance_name)\n app_config = RailsPwnerer::Config[app_name, instance_name]\n db_name, db_user, db_pass = app_config[:db_name], app_config[:db_user], app_config[:db_pass]\n \n Dir.chdir app_config[:backup_path] do\n # find the latest dump and load it in\n dump_file = Dir.glob(\"db/#{app_name}.#{instance_name}_*\").max\n unless dump_file\n dump_file = Dir.glob(\"db/#{app_name}.*\").max\n end\n Kernel.system \"mysql -u#{db_user} -p#{db_pass} #{db_name} < #{dump_file}\"\n end\n end", "def dump_database(app_name, instance_name)\n app_config = RailsPwnerer::Config[app_name, instance_name]\n db_name, db_user, db_pass = app_config[:db_name], app_config[:db_user], app_config[:db_pass]\n\n pwnerer_user = app_config[:pwnerer_user]\n pwnerer_uid = uid_for_username(pwnerer_user)\n pwnerer_gid = gid_for_username(pwnerer_user)\n \n timestamp = Time.now.strftime '%Y%m%d%H%M%S'\n dump_file = \"db/#{app_name}.#{instance_name}_#{timestamp}.sql\"\n Dir.chdir app_config[:backup_path] do\n system(\"mysqldump --add-drop-database --add-drop-table\" +\n \" --skip-extended-insert --single-transaction\" +\n \" -u#{db_user} -p#{db_pass} #{db_name} > #{dump_file}\")\n # lockdown the file\n File.chmod(0400, dump_file)\n File.chown(pwnerer_uid, pwnerer_gid, dump_file)\n end\n end", "def dump_and_download_to!(local_working_dir)\n dump!\n download_to!(local_working_dir)\n ensure\n clean_dump_if_needed!\n end", "def zip_download\n require 'zip'\n require 'tempfile'\n\n tmp_dir = ENV['TMPDIR'] || \"/tmp\"\n tmp_dir = Pathname.new tmp_dir\n # Deepblue::LoggingHelper.debug \"Download Zip begin tmp_dir #{tmp_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download begin\", \"tmp_dir=#{tmp_dir}\" ]\n target_dir = target_dir_name_id( tmp_dir, curation_concern.id )\n # Deepblue::LoggingHelper.debug \"Download Zip begin copy to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"target_dir=#{target_dir}\" ]\n Dir.mkdir( target_dir ) unless Dir.exist?( target_dir )\n target_zipfile = target_dir_name_id( target_dir, curation_concern.id, \".zip\" )\n # Deepblue::LoggingHelper.debug \"Download Zip begin copy to target_zipfile #{target_zipfile}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"target_zipfile=#{target_zipfile}\" ]\n File.delete target_zipfile if File.exist? target_zipfile\n # clean the zip directory if necessary, since the zip structure is currently flat, only\n # have to clean files in the target folder\n files = Dir.glob( (target_dir.join '*').to_s)\n Deepblue::LoggingHelper.bold_debug files, label: \"zip_download files to delete:\"\n files.each do |file|\n File.delete file if File.exist? file\n end\n Deepblue::LoggingHelper.debug \"Download Zip begin copy to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"begin copy target_dir=#{target_dir}\" ]\n Zip::File.open(target_zipfile.to_s, Zip::File::CREATE ) do |zipfile|\n metadata_filename = curation_concern.metadata_report( dir: target_dir )\n zipfile.add( metadata_filename.basename, metadata_filename )\n export_file_sets_to( target_dir: target_dir, log_prefix: \"Zip: \" ) do |target_file_name, target_file|\n zipfile.add( target_file_name, target_file )\n end\n end\n # Deepblue::LoggingHelper.debug \"Download Zip copy complete to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"download complete target_dir=#{target_dir}\" ]\n send_file target_zipfile.to_s\n end", "def extract_db_content(version)\n # Only compare tables with meaningful data. Tables\n # containing temporary state, e.g., db_mutex, are not relevant here.\n # TODO: re-add other tables to check.\n include_tables = %w[master_accounts accounts positions partners partner_users]\n\n client = startup\n\n # db_columns is a temporary structure - it holds all columns for db, by table.\n # It will be merged with rows into a single data structure to facilitate\n # comparison between the 2 DBs.\n db_columns = build_columns_hash(client)\n\n # build the structure which will be used for table comparisons.\n db_columns_and_rows = build_columns_and_rows_hash(db_columns, client, include_tables)\n\n store = initialize_store('mg_db.' + version)\n persist_data(db_columns_and_rows, store)\nend", "def get_backup\n tar_file = get_tempfile\n safe_run \"tar -cf #{tar_file} #{tar_dir}\"\n tar_file\n end", "def download_prepared_dump id\n name = \"trunk-#{id}.dump\"\n target_path = File.expand_path(\"../../fixtures/#{name}\", __FILE__)\n \n puts \"Accessing prepared DB test snapshot #{id} from S3.\"\n \n require 's3'\n service = S3::Service.new(:access_key_id => access_key_id, :secret_access_key => secret_access_key)\n bucket = service.buckets.find(\"cocoapods-org-testing-dumps\")\n \n # Due to a bug in the s3 gem we are searching for the object via iterating.\n bucket.objects.each do |obj|\n if obj.key == name\n puts \"Downloading prepared DB test snapshot #{id} from S3.\"\n File.open(target_path, 'w') do |file|\n file.write(obj.content)\n end\n break\n end\n end\n \n puts \"Prepared DB test snapshot #{id} downloaded to #{target_path}\"\n end", "def zip_app_export_migrations\n temp_file = Tempfile.new([ZipTempFilePrefix, '.zip'])\n # This is the tricky part\n # Initialize the temp file as a zip file\n Zip::OutputStream.open(temp_file) { |zos| }\n\n # Add files to the zip file as usual\n Zip::File.open(temp_file.path, Zip::File::CREATE) do |zip|\n Dir.glob(\"#{app_export_dir}/*.rb\").each do |path|\n filename = path.split('/').last\n zip.add(filename, path)\n end\n end\n temp_file\n end", "def import\n check_dependencies('mysql', '/bin/sh')\n source = args.shift or raise CommandFailed, \"You must specify a file to import from\"\n File.readable?(source) or raise CommandFailed, \"#{source.inspect} is not readable\"\n command = case source\n when /\\.bz2$/\n check_dependencies('bzcat')\n 'bzcat'\n when /\\.gz$/\n check_dependencies('gunzip')\n 'gunzip -c'\n else\n check_dependencies('cat')\n 'cat'\n end\n\n display \"This will replace the #{app} database with #{source}!\"\n exit unless dangerous_prompt\n\n exec('/bin/sh', '-c',\n \"#{command} #{args_to_s(source)}\" +\n pv_pipe +\n %{| mysql --compress } + args_to_s(mysql_args(database_uri)))\n end", "def execute(sql)\n tmp = Digest::MD5.hexdigest(sql)\n tmp_path = \"#{TMP_DIR}/#{tmp}\"\n File.write tmp_path, sql \n scp_upload! tmp_path, tmp_path \n result = C.exec! \"psql -A -t -d #{TMP_DB} -f #{tmp_path}\"\n C.exec! \"rm #{tmp_path}\"\n File.delete tmp_path\n result\nend", "def download\n @config.each do |config|\n download_backup(config[:host],config[:port],config[:user],config[:password],config[:name],config[:path],config[:format])\n end\n return true\n end", "def zip_contents; end", "def zip_url; end", "def extract_data\n cmd = \"unzip -d #{DATA_DIR} -o #{DATA_PATH}\"\n system cmd\n end", "def push\n check_dependencies('mysqldump', 'mysql', '/bin/sh')\n source = parse_db_location(args.shift || 'development')\n\n display \"This will replace the #{app} database with the #{source['database'].inspect} database\" +\n (source['host'].empty? ? '' : \" on #{source['host']}\") + \"!\"\n exit unless dangerous_prompt\n\n copy_db_to_db(source, database_uri)\n end", "def zipfile; end", "def remote\n run_in_environment(remote_database) { yield }\n end", "def dest_get\n db_select 'destination'\n end", "def zip\n @zip\n end", "def sync_archive_resource(resource, version)\n fetch_resource(resource, version) do |archive|\n dest_dir = %W(#{@datadir} #{resource} #{version}).join('/')\n log.debug \"exploding fetched archive #{archive} into data dir: #{dest_dir}\"\n # process the tar.gz\n Gem::Package::TarReader.new(Zlib::GzipReader.open(archive)) do |targz|\n dest = nil\n targz.each do |entry|\n dest = File.join dest_dir, entry.full_name\n # check if any old data exists, could happen if same resource name reused with different format\n if File.directory? dest\n log.debug \"removing existing directory (#{dest} before extracting archive there\"\n FileUtils.rm_rf dest\n elsif File.file? dest.chomp('/')\n log.debug \"removing existing file (#{dest.chomp}) before extracting archive there\"\n File.delete dest.chomp('/')\n end\n # extract\n if entry.directory?\n FileUtils.mkdir_p dest, mode: entry.header.mode\n elsif entry.file?\n # ensure extraction directory exists\n d_dir = File.dirname(dest)\n FileUtils.mkdir_p d_dir unless File.exist? d_dir\n\n File.open dest, 'wb' do |f|\n f.print entry.read\n end\n FileUtils.chmod entry.header.mode, dest\n elsif entry.header.typeflag == '2' # symlink\n File.symlink entry.header.linkname, dest\n end\n dest = nil\n end\n end\n end\n end", "def mirror(incremental = false)\n # First, make sure the source file classes exist in the destination mogile\n mirror_class_entries\n\n begin\n # Clear out data from previous runs unless we are doing a full mirror\n ActiveRecord::Base.connection.execute(\"TRUNCATE TABLE #{MirrorFile.table_name}\") unless incremental\n\n # Scan all files greater than max_fid in the source mogile database and copy over any\n # which are missing from the dest mogile database.\n mirror_missing_destination_files unless SignalHandler.instance.should_quit\n\n # This is only run when incremental is not set because it requires the mirror_files db to express\n # exactly the same state as the remote mogile db. Otherwise this would effectively do nothing.\n remove_superfluous_destination_files unless SignalHandler.instance.should_quit\n\n ensure\n # Print the overall summary\n final_summary\n end\n end", "def launch_get_db\n name = params[:name]\n version = params[:version]\n Thread.new do\n require 'miga/cli'\n\n # Get current registered version\n project = Project.find_by(path: name)\n if project && project.miga\n project.miga.metadata[:release] =\n \"#{project.miga.metadata[:release]} (currently updating)\"\n project.miga.save\n end\n\n # Download\n error =\n MiGA::Cli.new([\n 'get_db', '-n', name, '--db-version', version,\n '--local-dir', Settings.miga_projects, '--no-progress'\n ]).launch\n raise(error) if error.is_a? Exception\n\n # Register in the database\n project ||= current_user.projects.create(path: name)\n project.update(reference: true)\n f = File.join(Settings.miga_projects, \"#{name}_#{version}.tar.gz\")\n File.unlink(f) if File.exist? f\n ActiveRecord::Base.connection.close\n end\n\n sleep(10) # <- Hopefully this is enough to start the download\n flash[:success] = 'Downloading database in the background'\n redirect_to get_db_path\n end", "def zip_path\n \"/tmp/play-zips/#{zip_name}\"\n end", "def backup_and_download\n @config.each do |config|\n connect_to_host(config[:host],config[:port],config[:user],config[:password])\n backup_config(config[:name],config[:format])\n download_backup(config[:host],config[:port],config[:user],config[:password],config[:name],config[:path],config[:format])\n end\n return true\n end", "def download_dbs\n Dir.chdir('./nifa-docker-env/data/mysql/dev-dbs') do\n puts \"Please download the database dump from https://drive.google.com/drive/folders/1xF8YdBb9MtKw2zeOnnF3DUHY4cP5PhXk\"\n puts \"and place it in #{Pathname('.').realpath}\"\n puts \"Press return when ready to continue...\"\n gets\n end\nend", "def do_get_server_dump(address, table_name)\n return nil unless Module.const_get(table_name)\n # call the remote server sending the table that we want to import\n req = http_open_post(address, $SYNC_CONFIG[:dump_uri]) do |request|\n start_id = current_client.last_synced || -1\n form_data = { 'table_name' => table_name }\n request.set_form_data form_data\n end\n\n result ||= ActsAsReplica::Structs::SyncDumpResult.new\n result.status = case req\n when Net::HTTPSuccess\n fix_model_loading\n package = YAML.load(expand(req.body))\n result.last_synced = package.last_synced\n result.total = package.total.to_i\n \n # unpacks the received CSV package into a temporary file\n tmp_file = File.join(RAILS_ROOT, 'tmp', \"#{UUID.timestamp_create().to_s}.csv\")\n begin\n File.open(tmp_file, 'w') { |f| f.write package.payload } \n if Replica.compare_version(package.version)\n result.errors << \"Remote #{package.version} and Local #{Replica.version} versions are different.\"\n 500\n else\n if result.total > 0\n # loads the CSV file into the table\n model_class = Module.const_get(table_name)\n model_class.import_from_csv(tmp_file)\n result.result_message = \"Loaded #{model_class.count} rows from #{File.size(tmp_file)} csv file.\"\n end\n 200\n end\n ensure\n File.delete(tmp_file) if File.exists?(tmp_file)\n end\n else\n result.errors << \"Unknown error #{req.to_yaml}.\"\n 500\n end \n result\n end", "def restore \n # pg_restore -c -U postgres -d dataslam -1 /tmp/out.dump\n begin\n check_if_db_exists\n is_allowed = @conn.exec(\"select datallowconn from pg_catalog.pg_database where datname='#{@options[:database]}'\")[0]['datallowconn']\n if is_allowed == 'f'\n # unquiece temporarily\n set_dataallowcon_to true\n end\n\n fn = get_latest_backup_fn\n\n if fn == \"\"\n raise NoBackupsAvailableException.new \"There are no backups available at the specified location or in the default location (/tmp/postgresbk)\"\n end\n\n # The below system call assumes you have passwordless access as the user passed into the executable tool\n # either due to ~/.pgpass or pg_hba.conf has your user as a 'trust' auth method\n `pg_restore -c -U #{@options[:user]} -d #{@options[:database]} -1 #{@options[:bkdir]}/#{fn}`\n\n rescue Exception => e\n raise e\n ensure\n if is_allowed == 'f'\n # re quiesce \n set_dataallowcon_to false\n end\n end\n end", "def prepare_from_yaml\n set(:db_file) { \"#{application}-dump.sql.bz2\" }\n set(:db_remote_file) { \"#{shared_path}/backup/#{db_file}\" }\n set(:db_local_file) { \"tmp/#{db_file}\" }\n set(:db_user) { db_config[rails_env][\"username\"] }\n set(:db_pass) { db_config[rails_env][\"password\"] }\n set(:db_host) { db_config[rails_env][\"host\"] }\n set(:db_name) { db_config[rails_env][\"database\"] }\n end", "def zip_result_directory\n end", "def allow_remote_database_url; end", "def prepare_from_yaml\n set(:db_file) { \"#{application}-dump.sql.bz2\" }\n set(:db_remote_file) { \"#{current_path}/backup/#{db_file}\" }\n set(:db_local_file) { \"tmp/#{db_file}\" }\n set(:db_user) { db_config[rails_env][\"username\"] }\n set(:db_pass) { db_config[rails_env][\"password\"] }\n set(:db_host) { db_config[rails_env][\"host\"] }\n set(:db_name) { db_config[rails_env][\"database\"] }\n end", "def backup(dest_dir)\n logger.info \"Dumping MySQL#{db.db_and_table_names}\"\n @db.backup dest_dir\n end", "def prepare_from_yaml\n set(:db_file) { \"#{application}-dump.sql.bz2\" }\n set(:db_remote_file) { \"#{shared_path}/backup/#{db_file}\" }\n set(:db_local_file) { \"tmp/#{db_file}\" }\n set(:db_user) { db_config[rails_env][\"username\"] }\n set(:db_password) { db_config[rails_env][\"password\"] }\n set(:db_host) { db_config[rails_env][\"host\"] }\n set(:db_name) { db_config[rails_env][\"database\"] }\n end", "def restore(id)\n server = @connection.servers.get(id)\n # copy the local backup file to remote id\n server.scp('backup.tar.gz','backup.tar.gz')\n # run the remote script to do the restore. \n ssh(server,'~/restore.sh')\n end", "def db_path\n @db\n end", "def local_backup_path\n local_path\n end", "def ext_db_path; end", "def ext_db_path; end", "def compress(path, compress_tar_file)\n Mongolicious.logger.info(\"Compressing database #{path}\")\n\n system(\"cd #{path} && tar -cpf#{compress_tar_file ? 'j' : ''} #{path}.tar.bz2 .\")\n raise \"Error while compressing #{path}\" if $?.to_i != 0\n\n # Remove mongo dump now that we have the bzip\n FileUtils.rm_rf(path)\n\n return \"#{path}.tar.bz2\"\n end", "def export_database(server)\n puts \"Exporting the database. Please wait...\"\n system db_export_cmd(server)\n end", "def project_archive(archive_path)\n # Set variables for options\n project_name = framework.db.workspace.name\n project_path = ::File.join(Msf::Config.log_directory, 'projects', project_name)\n archive_name = \"#{project_name}_#{::Time.now.strftime('%Y%m%d.%H%M%S')}.zip\"\n db_export_name = \"#{project_name}_#{::Time.now.strftime('%Y%m%d.%H%M%S')}.xml\"\n db_out = ::File.join(project_path, db_export_name)\n format = 'xml'\n print_line(\"Exporting DB Workspace #{project_name}\")\n exporter = Msf::DBManager::Export.new(framework.db.workspace)\n exporter.send(\"to_#{format}_file\".intern, db_out) do |mtype, mstatus, mname|\n if mtype == :status\n if mstatus == 'start'\n print_line(\" >> Starting export of #{mname}\")\n end\n if mstatus == 'complete'\n print_line(\" >> Finished export of #{mname}\")\n end\n end\n end\n print_line(\"Finished export of workspace #{framework.db.workspace.name} to #{db_out} [ #{format} ]...\")\n print_line(\"Disabling spooling for #{project_name}\")\n driver.init_ui(driver.input, Rex::Ui::Text::Output::Stdio.new)\n print_line('Spooling disabled for archiving')\n archive_full_path = ::File.join(archive_path, archive_name)\n make_console_rc\n make_sessions_rc\n make_sessions_logs\n compress(project_path, archive_full_path)\n print_line(\"MD5 for archive is #{digestmd5(archive_full_path)}\")\n # Spool\n spool_path = ::File.join(Msf::Config.log_directory, 'projects', framework.db.workspace.name)\n spool_file = ::File.join(spool_path, \"#{project_name}_spool.log\")\n print_line('Spooling re-enabled')\n # Start spooling for new workspace\n driver.init_ui(driver.input, Rex::Ui::Text::Output::Tee.new(spool_file))\n\n # Restore the prompt so we don't get \"msf > >\".\n #prompt = framework.datastore['Prompt'] || Msf::Ui::Console::Driver::DefaultPrompt\n #prompt_char = framework.datastore['PromptChar'] || Msf::Ui::Console::Driver::DefaultPromptChar\n #if active_module # if there is an active module, give them the fanciness they have come to expect\n # driver.update_prompt(\"#{prompt} #{mod.type}(%bld%red#{mod.shortname}%clr) \", prompt_char, true)\n #else\n # driver.update_prompt(\"#{prompt} \", prompt_char, true)\n #end\n print_line(\"Spooling to file #{spool_file}...\")\n return true\n end", "def download_archive_to_temp\n return @temp_archive_path if !@temp_archive_path.nil?\n\n Chef::Config[:verify_api_cert] = false # FIXME\n Chef::Config[:ssl_verify_mode] = :verify_none # FIXME\n\n rest = Chef::ServerAPI.new(@target, Chef::Config)\n archive = with_http_rescue do\n rest.streaming_request(@target)\n end\n @archive_type = '.tar.gz'\n Inspec::Log.debug(\"Archive stored at temporary location: #{archive.path}\")\n @temp_archive_path = archive.path\n end", "def download_package\n path = download_path\n remote_file path do\n source URL\n action :create\n only_if { !::File.exist?(PATH) }\n end\n end", "def get_copy_db_key\n # payLoad = ReportClientHelper.getAsPayLoad([config],None,None)\n options = {\n :query => { 'ZOHO_ACTION' => 'GETCOPYDBKEY' }\n } \n\n send_request get_db_uri, 'post', options\n end", "def execute_export cmd, metadata\n metadata.store!\n result = \"\"\n\n # Execute Export command on the source DB server\n result = metadata.ssh.exec!(cmd)\n\n return result\n end", "def extract\n begin_connection\n\n entries.map do |entry|\n local_file = File.join(@local_path, entry.name)\n logger.info \"Downloading #{entry.name} to #{local_file}\"\n sftp_retry { sftp_session.download!(File.join(@remote_path, entry.name), local_file) }\n local_file\n end\n ensure\n end_connection\n end", "def load_database(filename)\n \n handle = File.open(filename)\n uncompressed = Zlib::GzipReader.new(handle)\n records = DnaIO.new(uncompressed)\n records.to_a\nend", "def prod_db2dev\n exit_if_production\n prod_db_backup\n prod_db_pull\n prod_db_load\n end", "def upgrade_direct!\n remote_file local_path do\n source package_metadata[:url]\n checksum package_metadata[:sha256]\n end\n dpkg_package local_path\n end", "def opendb\n db = Rho::Database.new(Rho::Application.databaseFilePath('local'), 'local')\n render :json => db.to_s\n return db.to_s\n end", "def zip\n if !FileTest::directory?(\"/mnt/filebox/assets/zipfile_repository\")\n Dir::mkdir(\"/mnt/filebox/assets/zipfile_repository\")\n end\n if self.zipped_file.nil? or !File.file?(self.zipped_file)\n logger.info(\"[ZIP] Creating zipfile for #{self.name}\")\n self.zipped_file = \"/mnt/filebox/assets/zipfile_repository/#{SecureRandom.hex(32)}.zip\"\n self.zipped_at = Time.now\n self.save!\n self._zip\n else\n # Check for modifications and rebuild if newer\n unless self.updated_at >= self.zipped_at\n logger.info(\"[ZIP] Rebuilding zipfile for #{self.name}\")\n self._zip\n end\n end\n \n return self.zipped_file\n end", "def download_and_unzip(base_url, system_id, filename, save_to_dir)\n download_url = File.join(base_url, system_id, filename)\n LibertyBuildpack::Util.download_zip('3.+', download_url, 'DynamicPULSE Agent', save_to_dir)\n rescue => e\n raise \"[DynamicPULSE] Can't download #{filename} from #{download_url}. Please check dynamicpulse-remote.xml. #{e.message}\"\n end", "def absolute_db_path\n pn = Pathname.new(__FILE__)\n install_dir = pn.dirname.parent.parent.to_s + Pathname::SEPARATOR_LIST\n install_dir + @storage_location + @database_name\n end", "def xDumpAllDatabase()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongodump.bat')\n end", "def remote_repository\n \"http://www.aQute.biz/repo\"\n end", "def zip_url\n @zip_url ||= Addressable::URI.new(\n :scheme => theme.scheme,\n :host => \"codeload.#{theme.host}\",\n :path => [theme.owner, theme.name, \"zip\", theme.git_ref].join(\"/\")\n ).normalize\n end", "def current_data\n start_ssh do |ssh|\n return ssh.scp.download!(full_filename)\n end\n end", "def db_dumps__sample_example *args\n [\n \"install/10.0_to_10.1.sql\",\n \"/root/hack_10.0_to_10.1.sql\",\n ]\n\n end", "def download(url='http://download.openvz.org/template/precreated/')\n\t\ttemplate = ostemplate\n\t\tfile = @@vzcache + template + '.tar.gz'\n if !File.file? file or File.zero? file\n\t\t\trequire 'open-uri'\n\t\t\tdebug \"Downloading template '\" + template + \"' to directory: '\" + @@vzcache + \"'\"\n\t\t\twriteOut = open(file, \"wb\")\n\t\t\twriteOut.write(open(url + '/' + template + '.tar.gz').read)\n\t\t\twriteOut.close\n\t\tend\n\tend", "def wDumpAllDatabase()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongodump.bat')\n end", "def downloadRemotefiles\n logger.debug(\"DOWNLOADING FILES.\")\n #sftp= Net::SFTP.start('belkuat.workhorsegroup.us', 'BLKUATUSER', :password => '5ada833014a4c092012ed3f8f82aa0c1')\n #ENV.fetch(\"WORKHORSE_HOST_SERVER\"), ENV.fetch(\"WORKHORSE_HOST_USERNAME\"), :password => ENV.fetch(\"WORKHORSE_HOST_PASSWORD\")\n Net::SFTP.start(ENV.fetch(\"WORKHORSE_HOST_SERVER\"), ENV.fetch(\"WORKHORSE_HOST_USERNAME\"), :password => ENV.fetch(\"WORKHORSE_HOST_PASSWORD\")) do |sftp|\n sftp.dir.glob(WORKHORSE_TO_SALSIFY, \"*\").each do |file|\n fileName = file.name\n sftp.download(File.join(WORKHORSE_TO_SALSIFY, \"/\", fileName), File.join(LOCAL_DIR, fileName))\n if File.extname(fileName).eql?(\".zip\")\n zipFiles.push(fileName)\n end\n end\n end\n logger.debug(\"FILES DOWNLOADED.\")\n end", "def create_zipped_moab_versions!\n storage_location = moab_replication_storage_location\n return nil unless storage_location\n\n params = (1..current_version).map do |v|\n ZipEndpoint.which_need_archive_copy(druid, v).map { |zep| { version: v, zip_endpoint: zep } }\n end.flatten.compact.uniq\n\n zipped_moab_versions.create!(params).tap do |zmvs|\n zmvs.pluck(:version).uniq.each { |version| Replication::ZipmakerJob.perform_later(druid, version, storage_location) }\n end\n end", "def download_remotefiles\n logger.debug('DOWNLOADING FILES.')\n # sftp= Net::SFTP.start('belkuat.workhorsegroup.us', 'BLKUATUSER', :password => '5ada833014a4c092012ed3f8f82aa0c1')\n # ENV.fetch('WORKHORSE_HOST_SERVER'), ENV.fetch('WORKHORSE_HOST_USERNAME'), :password => ENV.fetch('WORKHORSE_HOST_PASSWORD')\n begin\n Net::SFTP.start(ENV.fetch('WORKHORSE_HOST_SERVER'), ENV.fetch('WORKHORSE_HOST_USERNAME'), :password => ENV.fetch('WORKHORSE_HOST_PASSWORD')) do |sftp|\n sftp.dir.glob(WORKHORSE_TO_SALSIFY, '*').each do |file|\n file_name = file.name\n sftp.download!(File.join(WORKHORSE_TO_SALSIFY, '/', file_name), File.join(LOCAL_DIR, file_name), :progress => CustomDownloadHandler.new)\n zip_files.push(file_name) if File.extname(file_name).eql?('.zip')\n end\n end\n rescue Exception => e\n logger.debug('Error is download file ' + e.message)\n end\n\n logger.debug('FILES DOWNLOADED.')\n end", "def create_database(db_name)\n config = Rails.configuration.database_configuration[Rails.env]\n password = Shellwords.escape(config['password'])\n new_db = \"mysqldump -u#{config['username']} -p#{password} -h#{config['host']} #{config['database']} > /home/rails/current/tmp/backup.sql;\n mysqladmin -u#{config['username']} -p#{password} create #{db_name};\n mysql -u#{config['username']} -p#{password} -h#{config['host']} #{db_name} < /home/rails/current/tmp/backup.sql\"\n system new_db\n end", "def get_local_customer_databases(options)\n conn = PG.connect(options)\n all_customer_databases = []\n conn.exec(@@db_suite_query).each { |row|\n database = {}\n database[:server_name] = row['server_name']\n database[:db_name] = row['db_name']\n\n all_customer_databases.push(database)\n }\n conn.close\n\n local_customer_databases = all_customer_databases.select { |database|\n is_local_server?(database[:server_name])\n }\n local_customer_databases\n end", "def mysqldump(namespace, database_name = nil)\n puts 'Starting migration...'\n open_database_connection do\n database_uri = build_database_uri(namespace)\n database_name ||= database_uri.path.split('/')[1]\n output_file = \"#{database_name}-#{Time.now.strftime('%Y%m%d-%H%M%S')}.sql\"\n compress_cmd = compress_command(output_file)\n puts '-> Running the mysqldump'\n puts `mysqldump -h #{database_uri.host} -P #{database_uri.port} -u #{database_uri.user} --password=#{database_uri.password} #{database_name} | #{compress_cmd}`\n end\n end", "def dump_prod id\n target_path = File.expand_path(\"../../fixtures/trunk-#{id}.dump\", __FILE__)\n puts \"Dumping production database from Heroku (works only if you have access to the database)\"\n command = \"curl -o #{target_path} \\`heroku pg:backups public-url #{id} -a cocoapods-trunk-service\\`\"\n puts \"Executing command:\"\n puts command\n result = system command\n if result\n puts \"Production database snapshot #{id} dumped into #{target_path}\"\n else\n raise \"Could not dump #{id} from production database.\"\n end\n end" ]
[ "0.67106456", "0.6460594", "0.62325513", "0.61934775", "0.610401", "0.6000042", "0.59972733", "0.5969691", "0.59509355", "0.58878964", "0.5878682", "0.5867056", "0.5853542", "0.58366483", "0.58193576", "0.58115554", "0.5695404", "0.5691284", "0.5689631", "0.56643236", "0.56349915", "0.5620023", "0.56071144", "0.5565886", "0.55600923", "0.5505095", "0.5489976", "0.5468889", "0.5453256", "0.5446517", "0.54450905", "0.54225", "0.53949183", "0.5394511", "0.538394", "0.53692734", "0.5340012", "0.5322095", "0.5306059", "0.52959967", "0.5272628", "0.5262341", "0.52508414", "0.52370715", "0.5224899", "0.52178687", "0.51875603", "0.5186099", "0.51852417", "0.5179791", "0.51648694", "0.51580065", "0.5153568", "0.5153394", "0.5152661", "0.51497257", "0.51454693", "0.51419026", "0.51413256", "0.5136861", "0.51366353", "0.5131077", "0.5119764", "0.5114191", "0.51135325", "0.5112108", "0.51055235", "0.51029915", "0.5098202", "0.5095859", "0.5095859", "0.5095843", "0.5070024", "0.5046321", "0.5031176", "0.5015787", "0.49954593", "0.49819413", "0.49753428", "0.4974491", "0.4967512", "0.49610978", "0.49583554", "0.49576795", "0.49544406", "0.49539942", "0.49495333", "0.4943076", "0.49420938", "0.49371544", "0.49313405", "0.4931314", "0.4927854", "0.49272108", "0.49263912", "0.49183398", "0.4911996", "0.49111965", "0.4901554", "0.48942938" ]
0.545991
28
GET /facility_items GET /facility_items.json
def index @facility_items = FacilityItem.where("true").order(:facility_name).page params[:page] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if facility_params[:facility_id]\n @facility_items = FacilityItem.where(facility_id: @facility.id).order(:name).page params[:page]\n else \n @facility_items = [] \n for value in @template.template_facility_item do\n @facility_items.push(FacilityItem.find(value.facility_item_id))\n end \n end\n end", "def set_facility_item\n @facility_item = FacilityItem.find(params[:id])\n end", "def items\n \tbegin\n \t@categories = Category.all.includes(items: [:dimensions])\n \t@ingredients = Ingredient.actives\n \trender 'api/v1/home/items', status: :ok\n \trescue Exception => e\n \t\terror_handling_bad_request(e)\n \tend\n\n\tend", "def index\n @facility_cost_items = FacilityCostItem.all\n end", "def show\n @facility = Facility.find(params[:id])\n respond_with @facility\n end", "def set_facility_item\n @facility_item = FacilityItem.find(params[:id]) \n end", "def show\n @facility_total = FacilityTotal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @facility_total }\n end\n end", "def index\n @facilities = Facility.all\n respond_with @facilities\n end", "def get_facilities\n list = organizations.map { |org| org.resource.identifier.last.value }\n facilities_ids = list.join(',')\n\n facilities_request.get(facilities_ids)\n end", "def create\n @facility_item = FacilityItem.new(facility_item_params)\n\n respond_to do |format|\n if @facility_item.save\n format.html { redirect_to @facility_item, notice: 'Facility item was successfully created.' }\n format.json { render :show, status: :created, location: @facility_item }\n else\n format.html { render :new }\n format.json { render json: @facility_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_facility(facility_id)\n params = {}\n with_monitoring do\n response = perform(:get, facilities_url_with_id(facility_id), params, headers)\n OpenStruct.new(response[:body])\n end\n end", "def facility_item_params\n params.require(:facility_item).permit(:name, :facility_id)\n end", "def index\n @facilities = Facility.all\n end", "def create\n @facility_item = FacilityItem.new(facility_item_params)\n\n respond_to do |format|\n if @facility_item.save\n format.html { redirect_to '/facilities/'+@facility_item.facility_id.to_s+'/facility_items', notice: 'Facility item was successfully created.' }\n format.json { render :show, status: :created, location: @facility_item }\n else\n format.html { render :new }\n format.json { render json: @facility_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @facility = Facility.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @facility }\n end\n end", "def index\n @facility_totals = FacilityTotal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @facility_totals }\n end\n end", "def get_industry_facilities_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IndustryApi.get_industry_facilities ...\"\n end\n if opts[:'datasource'] && !['tranquility', 'singularity'].include?(opts[:'datasource'])\n fail ArgumentError, 'invalid value for \"datasource\", must be one of tranquility, singularity'\n end\n # resource path\n local_var_path = \"/industry/facilities/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'datasource'] = opts[:'datasource'] if !opts[:'datasource'].nil?\n query_params[:'user_agent'] = opts[:'user_agent'] if !opts[:'user_agent'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-User-Agent'] = opts[:'x_user_agent'] if !opts[:'x_user_agent'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<IndustryFacility>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IndustryApi#get_industry_facilities\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @other_facilities = OtherFacility.all\n end", "def index\n @facility_types = FacilityType.all\n end", "def faculties\n @faculties = Faculty.where(university_id: params[:university_id]).order(:name)\n @courses = []\n respond_to do |format|\n format.json { render json: @faculties }\n end\n end", "def update\n respond_to do |format|\n if @facility_item.update(facility_item_params)\n format.html { redirect_to facility_facility_items_path(@facility_item.facility_id), notice: 'Facility item was successfully updated.' }\n format.json { render :show, status: :ok, location: @facility_item }\n else\n format.html { render :edit }\n format.json { render json: @facility_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def facility_item_params\n params.require(:facility_item).permit(:facility_name, :available_quantity, :meeting_room_id)\n end", "def update\n respond_to do |format|\n if @facility_item.update(facility_item_params)\n format.html { redirect_to @facility_item, notice: 'Facility item was successfully updated.' }\n format.json { render :show, status: :ok, location: @facility_item }\n else\n format.html { render :edit }\n format.json { render json: @facility_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @faculties = Faculty.all\n json_response(@faculties)\n end", "def index\n @home_facilities = HomeFacility.all\n end", "def items\n @backlog = Backlog.find(params[:id])\n if cannot? :read, @backlog\n deny_access\n end\n render :json => @backlog.backlog_items\n end", "def index\n @scheduled_facilities = ScheduledFacility.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scheduled_facilities }\n end\n end", "def index\n json_response(current_restaurant.restaurant_food_items)\n end", "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "def index\n @room_facilities = RoomFacility.all\n end", "def getItems()\n return mergeWithAPI(@item_json)['data']\n end", "def show\n @scheduled_facility = ScheduledFacility.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scheduled_facility }\n end\n end", "def item(uuid)\n http.get \"/items/#{uuid}\"\n end", "def index\n if current_user\n @flats = Flat.all\n else\n @flats = Flat.where('displayed=? and approved=?', true, true).all\n end\n\n @facilities=Facility.where(\"is_building=?\", true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @flats }\n end\n end", "def show\n json_response(@food_item)\n end", "def request_facilities(location)\n url = \"#{root_url}/ivs-ippaas-api/IPPRest/resources/rest/getIppFacilityList\"\n body = {\n sponsorID: sponsor_id,\n streetAddress: location.address,\n city: location.city,\n state: location.state,\n zipCode: location.zip_code,\n }.to_json\n\n response = faraday.post(url, body, dynamic_headers) do |req|\n req.options.context = { service_name: 'usps_facilities' }\n end.body\n\n facilities = parse_facilities(response)\n dedupe_facilities = dedupe_facilities(facilities)\n sort_by_ascending_distance(dedupe_facilities)\n end", "def item_from_fridge_id\n @items = Item.where(:fridge_id => params[:fridge_id])\n render :json => @items.to_json(:include => :product)\n end", "def fetch\n result = WebApi.json!('ITFItems_440', 'GetPlayerItems', 1, { :SteamID => @steam_id64 })\n\n @items = []\n result[:items][:item].each do |item_data|\n unless item_data.nil?\n item = TF2Item.new(item_data)\n @items[item.backpack_position - 1] = item\n end\n end\n end", "def index\n @section = Section.find(params[:section_id])\n @items = @section.items\n render json: ItemSerializer.new(@items)\n end", "def show\n @trait = api_resource.find(params[:id], \n :root => :trait\n )\n @items = Vger::Resources::Mrf::Item.where(query_options: {\n trait_type: \"Mrf::Trait\",\n trait_id: @trait.id\n }).all.to_a\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def show\n @item_feature = ItemFeature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_feature }\n end\n end", "def index\n ota = Array.new\n if params[:facility].nil?\n # 自分の施設情報だけを返す\n facilities = current_user.facilities\n facilities.each do |facility|\n ota.concat(\n facility.ota.select do |otum|\n otum.provider != 'default'\n end\n )\n end\n else\n # facility=[facility_id]\n facility = Facility.find_by(id: params[:facility].to_i)\n # 施設IDが存在しない場合\n if facility.nil?\n response = {\n status: 'NotFound',\n message: 'ota not found'\n }\n return render json: response, status: 404\n end\n # ユーザーの施設IDでない場合\n if facility.user_id != current_user.id\n response = {\n status: 'NotFound',\n message: 'ota not found'\n }\n return render json: response, status: 404\n end\n\n ota.concat(\n facility.ota.select do |otum|\n otum.provider != 'default'\n end\n )\n end\n\n render json: {\n status: 'Success',\n message: '',\n ota: ota.as_json(except: [\n :password,\n :token,\n :created_at,\n :updated_at\n ], include: [\n :ota_rooms\n ])\n }, status: 200\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def index\n @items = Admin::Item.by_agency(@current_agency.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_items }\n end\n end", "def index\n @items = current_user.items\n respond_to do |format|\n format.html\n format.json { render json: @items }\n end\n end", "def item\n # Url generated from Js script function => getitem() of _form.html.erb file under Views of different controllers\n @item = Report.where(\"user_id = ?\" , current_user.id).pluck(:item_name )\n # send item_names' in form of json\n render json: @item\n end", "def get_hotel_facility_types(request_parameters)\r\n http_service.request_get(\"/json/bookings.getHotelFacilityTypes\", request_parameters)\r\n end", "def show\n @fridge = Fridge.find(params[:id])\n @items = @fridge.fridge_items # for _item_list.html.erb\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fridge }\n end\n end", "def index\n @facility_managers = FacilityManager.paginate(page: params[:page])\n end", "def show\n @recipe = Recipe.find(params[:id])\n @nutrition_info = NutritionInfo.where( \"recipe_id = ?\", @recipe.id ).first\n @inventory_items = []\n @recipe.inventory_items.each do |inventory_item|\n @inventory_items << inventory_item\n end\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end", "def index\n @insurance_facilities = InsuranceFacility.all\n end", "def index\n @furniture_items = FurnitureItem.all\n end", "def show\n @filial = Filial.find(params[:id])\n @instructors = @filial.instructors\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filial }\n end\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def create\n @facility = Facility.new(params[:facility])\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to @facility, notice: 'Facility was successfully created.' }\n format.json { render json: @facility, status: :created, location: @facility }\n else\n format.html { render action: \"new\" }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n id = params[:id]\n r = /[^0-9]+/\n \n if r =~ id # if id contains non-digits\n showGroupForType id\n else\n @facility = Facility.find(id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @facility }\n end\n end\n end", "def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def items\n @items ||= items_from_response\n end", "def show\n @fooditem = Fooditem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @fooditem }\n end\n end", "def update\n @facility = Facility.find(params[:id])\n @facility.update_attributes(facility_params)\n respond_with @facility\n end", "def create\n @facility = Facility.new(facility_params)\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to edit_facility_path(@facility), notice: 'Facility was successfully created.' }\n format.json { render :edit, status: :created, location: @facility }\n else\n format.html { render :new }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @item = Item.all.where(collection_id: params[:id])\n render :json => @item\n end", "def get_items\n @items\n end", "def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend", "def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end", "def set_facility\n @facility = Facility.find(params[:facility_id])\n end", "def index\n recipe_items = current_user.recipes.includes(recipe_items: :ingredient).find(params[:recipe_id]).recipe_items\n render json: { recipe_items: recipe_items}.to_json(include: :ingredient), status: :ok\n end", "def index\n @foil_items = FoilItem.all\n end", "def index\n # @faculties = Faculty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@faculties, mode: :compat) }\n end\n end", "def index\n @place_facilities = PlaceFacility.all\n end", "def get_facilities(location)\n facilities = []\n location.location_facilities.each do |fac|\n facilities << fac.facility.name\n end\n\n facilities\n end", "def index\n #@items = Item.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\n end", "def activities_for_facility(fac_id, params = {})\n path = \"#{ROOT_FACILITIES}/#{fac_id}#{ROOT_ACTIVITIES}\"\n\n pagination_loop(params) do |p, c|\n api_call(path, params)\n end\n end", "def facility_params\n params.require(:facility).permit(:facility_type_id, :producing_trade_good_id, :producing_equipment_type_id, :levels)\n end", "def my\n items = current_user.items\n render json: items\n end", "def create\n @facility = Facility.new(facility_params)\n @facility.save\n respond_with @facility\n end", "def show\n\n params[:category_id] = params[:id]\n params[:school_id] = auth_user.current_school_id\n\n @items_search = Item.build_search(params, auth_user)\n @items_search.execute\n @items = @items_search.results\n\n logger.info \"-------------------- #{@items_search.inspect}\"\n logger.info \" Page #{params[:page]}: #{@items.size} out of total #{@items_search.total}\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {items: @items_search.results, page: (params[:page] || 1), per_page: Item.per_page, total_count: @items_search.total} }\n end\n end", "def create\n @facility = Facility.new(facility_params)\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to @facility, notice: 'Facility was successfully created.' }\n format.json { render :show, status: :created, location: @facility }\n else\n format.html { render :new }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_levels\n if params[:levels_by_nf] == 'true'\n @foundation = Foundation.find_by(name: params[:name])\n if @foundation\n render json: {levels: @foundation.levels.pluck(:name)}, status: 200\n else\n render json: {\n levels: []\n }, status: 200\n end\n return\n end\n\n @foundation = Foundation.find_by(id: params[:id])\n if @foundation\n render template: 'levels/get_levels.json', status: 200\n else\n render json: {\n levels: []\n }, status: 200\n end\n end", "def new\n @facility_total = FacilityTotal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @facility_total }\n end\n end", "def index\n @swiper = Facility.all\n @facility_layouts = ['U-Shape', 'Classroom', 'Theatre', 'Lawn', 'Board-Room', 'Round-Table', 'Cocktail']\n # Last x facilities to be added\n end", "def get_item_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UniverseApi.get_item_categories ...\"\n end\n if opts[:'datasource'] && !['tranquility', 'singularity'].include?(opts[:'datasource'])\n fail ArgumentError, 'invalid value for \"datasource\", must be one of tranquility, singularity'\n end\n # resource path\n local_var_path = \"/universe/categories/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'datasource'] = opts[:'datasource'] if !opts[:'datasource'].nil?\n query_params[:'user_agent'] = opts[:'user_agent'] if !opts[:'user_agent'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-User-Agent'] = opts[:'x_user_agent'] if !opts[:'x_user_agent'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Integer>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UniverseApi#get_item_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n require 'net/http'\n require 'json'\n\n response = Net::HTTP.get_response( URI.parse( \"http://freeshit.firebaseio.com/items/%s.json\" % [ params[:id] ] ) );\n\n begin\n @fb_item = JSON.parse(response.body)\n rescue\n render :status => 404, :text => 'Item not found.'\n return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fb_item }\n end\n end", "def show\n render json: @faculty\n end", "def create\n @facility = Facility.new(facility_params)\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to @facility, notice: \"Facility was successfully created.\" }\n format.json { render :show, status: :created, location: @facility }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @fnf_items = FnfItem.all\n end", "def index\n @filials = Filial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filials }\n end\n end", "def destroy\n @facility_item.destroy\n respond_to do |format|\n format.html { redirect_to facility_facility_items_path(facility_params), notice: 'Facility item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @food_items = FoodItem.all\n end", "def show\n render json: @request_item\n end", "def update\n respond_to do |format|\n if @facility.update(facility_params)\n format.html { redirect_to edit_facility_path(@facility), notice: 'Facility was successfully updated.' }\n format.json { render :edit, status: :ok, location: @facility }\n else\n format.html { render :edit }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @universities = University.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @universities }\n end\n end" ]
[ "0.6908514", "0.6566139", "0.64723986", "0.64697", "0.64472127", "0.643034", "0.6387884", "0.63350093", "0.6324776", "0.6298998", "0.62669265", "0.6260958", "0.6191614", "0.61812186", "0.61637247", "0.61539084", "0.6118062", "0.6109231", "0.60649705", "0.60556024", "0.604473", "0.60273623", "0.59827244", "0.59821075", "0.5976587", "0.5908565", "0.5902915", "0.59018415", "0.5892804", "0.58775914", "0.5868023", "0.5849813", "0.5836395", "0.5832073", "0.58105606", "0.5802965", "0.5799761", "0.57650185", "0.5732879", "0.57296515", "0.5722113", "0.57212317", "0.5709459", "0.5708449", "0.5697307", "0.5676067", "0.5668579", "0.5665894", "0.566155", "0.5654978", "0.5653569", "0.565192", "0.56493443", "0.56463975", "0.56463975", "0.56463975", "0.56463975", "0.56463975", "0.56463975", "0.56463975", "0.56463975", "0.56463975", "0.5643634", "0.5640717", "0.56301594", "0.5628695", "0.562826", "0.56262845", "0.5622632", "0.5616726", "0.5616684", "0.56050116", "0.5580995", "0.5576741", "0.5558167", "0.5556402", "0.5555764", "0.55540186", "0.55459994", "0.5534247", "0.55322343", "0.5528265", "0.5521472", "0.5515966", "0.55120313", "0.5510801", "0.5508232", "0.5503516", "0.55015844", "0.54917914", "0.54866296", "0.5484561", "0.54828686", "0.54788566", "0.54741275", "0.547323", "0.5459159", "0.5458998", "0.5446474", "0.5445631" ]
0.6690664
1
GET /facility_items/1 GET /facility_items/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_facility_item\n @facility_item = FacilityItem.find(params[:id])\n end", "def set_facility_item\n @facility_item = FacilityItem.find(params[:id]) \n end", "def index\n if facility_params[:facility_id]\n @facility_items = FacilityItem.where(facility_id: @facility.id).order(:name).page params[:page]\n else \n @facility_items = [] \n for value in @template.template_facility_item do\n @facility_items.push(FacilityItem.find(value.facility_item_id))\n end \n end\n end", "def show\n @facility = Facility.find(params[:id])\n respond_with @facility\n end", "def show\n @facility_total = FacilityTotal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @facility_total }\n end\n end", "def get_facility(facility_id)\n params = {}\n with_monitoring do\n response = perform(:get, facilities_url_with_id(facility_id), params, headers)\n OpenStruct.new(response[:body])\n end\n end", "def new\n @facility = Facility.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @facility }\n end\n end", "def index\n @facility_items = FacilityItem.where(\"true\").order(:facility_name).page params[:page]\n end", "def create\n @facility_item = FacilityItem.new(facility_item_params)\n\n respond_to do |format|\n if @facility_item.save\n format.html { redirect_to @facility_item, notice: 'Facility item was successfully created.' }\n format.json { render :show, status: :created, location: @facility_item }\n else\n format.html { render :new }\n format.json { render json: @facility_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @facility_cost_items = FacilityCostItem.all\n end", "def create\n @facility_item = FacilityItem.new(facility_item_params)\n\n respond_to do |format|\n if @facility_item.save\n format.html { redirect_to '/facilities/'+@facility_item.facility_id.to_s+'/facility_items', notice: 'Facility item was successfully created.' }\n format.json { render :show, status: :created, location: @facility_item }\n else\n format.html { render :new }\n format.json { render json: @facility_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def facility_item_params\n params.require(:facility_item).permit(:name, :facility_id)\n end", "def show\n @scheduled_facility = ScheduledFacility.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scheduled_facility }\n end\n end", "def update\n respond_to do |format|\n if @facility_item.update(facility_item_params)\n format.html { redirect_to facility_facility_items_path(@facility_item.facility_id), notice: 'Facility item was successfully updated.' }\n format.json { render :show, status: :ok, location: @facility_item }\n else\n format.html { render :edit }\n format.json { render json: @facility_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @facilities = Facility.all\n respond_with @facilities\n end", "def update\n respond_to do |format|\n if @facility_item.update(facility_item_params)\n format.html { redirect_to @facility_item, notice: 'Facility item was successfully updated.' }\n format.json { render :show, status: :ok, location: @facility_item }\n else\n format.html { render :edit }\n format.json { render json: @facility_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def items\n \tbegin\n \t@categories = Category.all.includes(items: [:dimensions])\n \t@ingredients = Ingredient.actives\n \trender 'api/v1/home/items', status: :ok\n \trescue Exception => e\n \t\terror_handling_bad_request(e)\n \tend\n\n\tend", "def index\n @facility_totals = FacilityTotal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @facility_totals }\n end\n end", "def item(uuid)\n http.get \"/items/#{uuid}\"\n end", "def show\n @item_feature = ItemFeature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_feature }\n end\n end", "def get_facilities\n list = organizations.map { |org| org.resource.identifier.last.value }\n facilities_ids = list.join(',')\n\n facilities_request.get(facilities_ids)\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def index\n @facilities = Facility.all\n end", "def show\n @item = Item.all.where(collection_id: params[:id])\n render :json => @item\n end", "def show\n id = params[:id]\n r = /[^0-9]+/\n \n if r =~ id # if id contains non-digits\n showGroupForType id\n else\n @facility = Facility.find(id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @facility }\n end\n end\n end", "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "def index\n @other_facilities = OtherFacility.all\n end", "def get_industry_facilities_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IndustryApi.get_industry_facilities ...\"\n end\n if opts[:'datasource'] && !['tranquility', 'singularity'].include?(opts[:'datasource'])\n fail ArgumentError, 'invalid value for \"datasource\", must be one of tranquility, singularity'\n end\n # resource path\n local_var_path = \"/industry/facilities/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'datasource'] = opts[:'datasource'] if !opts[:'datasource'].nil?\n query_params[:'user_agent'] = opts[:'user_agent'] if !opts[:'user_agent'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-User-Agent'] = opts[:'x_user_agent'] if !opts[:'x_user_agent'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<IndustryFacility>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IndustryApi#get_industry_facilities\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @fooditem = Fooditem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @fooditem }\n end\n end", "def index\n @scheduled_facilities = ScheduledFacility.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scheduled_facilities }\n end\n end", "def show\n @trait = api_resource.find(params[:id], \n :root => :trait\n )\n @items = Vger::Resources::Mrf::Item.where(query_options: {\n trait_type: \"Mrf::Trait\",\n trait_id: @trait.id\n }).all.to_a\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def index\n @faculties = Faculty.all\n json_response(@faculties)\n end", "def show\n json_response(@food_item)\n end", "def faculties\n @faculties = Faculty.where(university_id: params[:university_id]).order(:name)\n @courses = []\n respond_to do |format|\n format.json { render json: @faculties }\n end\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def facility_item_params\n params.require(:facility_item).permit(:facility_name, :available_quantity, :meeting_room_id)\n end", "def index\n @facility_types = FacilityType.all\n end", "def item_from_fridge_id\n @items = Item.where(:fridge_id => params[:fridge_id])\n render :json => @items.to_json(:include => :product)\n end", "def show\n @research_item = ResearchItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @research_item }\n end\n end", "def set_facility\n @facility = Facility.find(params[:facility_id])\n end", "def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end", "def update\n @facility = Facility.find(params[:id])\n @facility.update_attributes(facility_params)\n respond_with @facility\n end", "def create\n @facility = Facility.new(params[:facility])\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to @facility, notice: 'Facility was successfully created.' }\n format.json { render json: @facility, status: :created, location: @facility }\n else\n format.html { render action: \"new\" }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @items = Admin::Item.by_agency(@current_agency.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_items }\n end\n end", "def show\n require 'net/http'\n require 'json'\n\n response = Net::HTTP.get_response( URI.parse( \"http://freeshit.firebaseio.com/items/%s.json\" % [ params[:id] ] ) );\n\n begin\n @fb_item = JSON.parse(response.body)\n rescue\n render :status => 404, :text => 'Item not found.'\n return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fb_item }\n end\n end", "def new\n @facility_total = FacilityTotal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @facility_total }\n end\n end", "def index\n json_response(current_restaurant.restaurant_food_items)\n end", "def show\n item = Item.find(params[:id])\n render json: item\n end", "def item\n # Url generated from Js script function => getitem() of _form.html.erb file under Views of different controllers\n @item = Report.where(\"user_id = ?\" , current_user.id).pluck(:item_name )\n # send item_names' in form of json\n render json: @item\n end", "def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def create\n @facility = Facility.new(facility_params)\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to edit_facility_path(@facility), notice: 'Facility was successfully created.' }\n format.json { render :edit, status: :created, location: @facility }\n else\n format.html { render :new }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @home_facilities = HomeFacility.all\n end", "def items\n @backlog = Backlog.find(params[:id])\n if cannot? :read, @backlog\n deny_access\n end\n render :json => @backlog.backlog_items\n end", "def show\n render json: @request_item\n end", "def show\n @filial = Filial.find(params[:id])\n @instructors = @filial.instructors\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filial }\n end\n end", "def set_facility_cost_item\n @facility_cost_item = FacilityCostItem.find(params[:id])\n end", "def fetch\n result = WebApi.json!('ITFItems_440', 'GetPlayerItems', 1, { :SteamID => @steam_id64 })\n\n @items = []\n result[:items][:item].each do |item_data|\n unless item_data.nil?\n item = TF2Item.new(item_data)\n @items[item.backpack_position - 1] = item\n end\n end\n end", "def index\n if current_user\n @flats = Flat.all\n else\n @flats = Flat.where('displayed=? and approved=?', true, true).all\n end\n\n @facilities=Facility.where(\"is_building=?\", true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @flats }\n end\n end", "def show\n @recipe = Recipe.find(params[:id])\n @nutrition_info = NutritionInfo.where( \"recipe_id = ?\", @recipe.id ).first\n @inventory_items = []\n @recipe.inventory_items.each do |inventory_item|\n @inventory_items << inventory_item\n end\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end", "def new\n @scheduled_facility = ScheduledFacility.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scheduled_facility }\n end\n end", "def show\n @fridge = Fridge.find(params[:id])\n @items = @fridge.fridge_items # for _item_list.html.erb\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fridge }\n end\n end", "def create\n @facility = Facility.new(facility_params)\n @facility.save\n respond_with @facility\n end", "def show\n render json: Item.find(params[:id])\n end", "def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end", "def show\n render json: Item.find(params[\"id\"])\n end", "def create\n @facility = Facility.new(facility_params)\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to @facility, notice: 'Facility was successfully created.' }\n format.json { render :show, status: :created, location: @facility }\n else\n format.html { render :new }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render json: @faculty\n end", "def destroy\n @facility_item.destroy\n respond_to do |format|\n format.html { redirect_to facility_facility_items_path(facility_params), notice: 'Facility item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def get_facility_with_cache(facility_id)\n Rails.cache.fetch(\"vaos_facility_#{facility_id}\", expires_in: 12.hours) do\n get_facility(facility_id)\n end\n end", "def getItems()\n return mergeWithAPI(@item_json)['data']\n end", "def create\n @facility = Facility.new(facility_params)\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to @facility, notice: \"Facility was successfully created.\" }\n format.json { render :show, status: :created, location: @facility }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @room_facilities = RoomFacility.all\n end", "def update\n respond_to do |format|\n if @facility.update(facility_params)\n format.html { redirect_to edit_facility_path(@facility), notice: 'Facility was successfully updated.' }\n format.json { render :edit, status: :ok, location: @facility }\n else\n format.html { render :edit }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @facility = Facility.find(params[:id])\n\n respond_to do |format|\n if @facility.update_attributes(params[:facility])\n format.html { redirect_to @facility, notice: 'Facility was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @facility.update(facility_params)\n format.html { redirect_to @facility, notice: \"Facility was successfully updated.\" }\n format.json { render :show, status: :ok, location: @facility }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @facility.update(facility_params)\n format.html { redirect_to @facility, notice: 'Facility was successfully updated.' }\n format.json { render :show, status: :ok, location: @facility }\n else\n format.html { render :edit }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @homework_item = HomeworkItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @homework_item }\n end\n end", "def show\n @items_location = ItemsLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @items_location }\n end\n end", "def show\n @item_unit = ItemUnit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_unit }\n end\n end", "def update\n\n respond_to do |format|\n if @facility.update(facility_params)\n format.html { redirect_to @facility, notice: 'Facility was successfully updated.' }\n format.json { render :show, status: :ok, location: @facility }\n else\n format.html { render :edit }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @ball_flight_item = BallFlightItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ball_flight_item }\n end\n end", "def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end", "def index\n @section = Section.find(params[:section_id])\n @items = @section.items\n render json: ItemSerializer.new(@items)\n end", "def index\n ota = Array.new\n if params[:facility].nil?\n # 自分の施設情報だけを返す\n facilities = current_user.facilities\n facilities.each do |facility|\n ota.concat(\n facility.ota.select do |otum|\n otum.provider != 'default'\n end\n )\n end\n else\n # facility=[facility_id]\n facility = Facility.find_by(id: params[:facility].to_i)\n # 施設IDが存在しない場合\n if facility.nil?\n response = {\n status: 'NotFound',\n message: 'ota not found'\n }\n return render json: response, status: 404\n end\n # ユーザーの施設IDでない場合\n if facility.user_id != current_user.id\n response = {\n status: 'NotFound',\n message: 'ota not found'\n }\n return render json: response, status: 404\n end\n\n ota.concat(\n facility.ota.select do |otum|\n otum.provider != 'default'\n end\n )\n end\n\n render json: {\n status: 'Success',\n message: '',\n ota: ota.as_json(except: [\n :password,\n :token,\n :created_at,\n :updated_at\n ], include: [\n :ota_rooms\n ])\n }, status: 200\n end", "def show\n json_response(@faculty)\n end", "def get_item\n @item = Item.find_by_id(params[:id])\n if @item\n return @item\n else \n render json: {\"message\": {\"type\": \"error\", \"content\": \"The item could not be found!\"}}\n end\n end", "def show\n\n params[:category_id] = params[:id]\n params[:school_id] = auth_user.current_school_id\n\n @items_search = Item.build_search(params, auth_user)\n @items_search.execute\n @items = @items_search.results\n\n logger.info \"-------------------- #{@items_search.inspect}\"\n logger.info \" Page #{params[:page]}: #{@items.size} out of total #{@items_search.total}\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {items: @items_search.results, page: (params[:page] || 1), per_page: Item.per_page, total_count: @items_search.total} }\n end\n end", "def get_item(iid)\n params = {'pio_iid' => iid}.merge(default_params)\n response = @connection.get(:items, iid, params).body\n if response[\"pio_latlng\"]\n latlng = response[\"pio_latlng\"]\n response[\"pio_latitude\"] = latlng[0]\n response[\"pio_longitude\"] = latlng[1]\n end\n if response[\"pio_startT\"]\n startT = Rational(response[\"pio_startT\"], 1000)\n response[\"pio_startT\"] = Time.at(startT)\n end\n if response[\"pio_endT\"]\n endT = Rational(response[\"pio_endT\"], 1000)\n response[\"pio_endT\"] = Time.at(endT)\n end\n response\n end", "def index\n # @faculties = Faculty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@faculties, mode: :compat) }\n end\n end", "def destroy\n @facility_item.destroy\n respond_to do |format|\n format.html { redirect_to facility_items_url, notice: 'Facility item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @items = current_user.items\n respond_to do |format|\n format.html\n format.json { render json: @items }\n end\n end", "def show\n @unit = Unit.find(params[:id])\n @item = Item.find(@unit.item_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unit }\n end\n end", "def index\n @facility_managers = FacilityManager.paginate(page: params[:page])\n end" ]
[ "0.68201524", "0.6728097", "0.6720837", "0.6673039", "0.6627221", "0.64779985", "0.64721787", "0.6467768", "0.6401196", "0.6343353", "0.6338596", "0.622633", "0.6197486", "0.617875", "0.61400723", "0.61322236", "0.6103467", "0.608422", "0.6084042", "0.60323477", "0.60050935", "0.5986679", "0.59835666", "0.59754384", "0.5973726", "0.59616816", "0.59323347", "0.59168535", "0.5916794", "0.59108865", "0.5908154", "0.58894503", "0.58882153", "0.5884147", "0.5882991", "0.5882991", "0.5882991", "0.5882991", "0.5882991", "0.5882991", "0.5882991", "0.5882991", "0.5882991", "0.58808386", "0.58508664", "0.58343947", "0.58332133", "0.582383", "0.5817566", "0.58085734", "0.5800158", "0.5796657", "0.5796512", "0.5790951", "0.5789257", "0.5787464", "0.57621986", "0.5758427", "0.575132", "0.5738961", "0.5737442", "0.57359415", "0.5732256", "0.5724807", "0.57188463", "0.5718195", "0.5692636", "0.56715393", "0.5664698", "0.565831", "0.56501895", "0.56458175", "0.5643182", "0.56325805", "0.5630111", "0.5629555", "0.5626266", "0.5618933", "0.56079197", "0.56068367", "0.5595041", "0.5591611", "0.5589149", "0.55755645", "0.55718786", "0.5561092", "0.55554885", "0.55554336", "0.55509454", "0.55502945", "0.5549834", "0.5542004", "0.55410695", "0.553843", "0.5536638", "0.5536395", "0.5532261", "0.5532244", "0.5530719", "0.5518827", "0.5515861" ]
0.0
-1
POST /facility_items POST /facility_items.json
def create @facility_item = FacilityItem.new(facility_item_params) respond_to do |format| if @facility_item.save format.html { redirect_to @facility_item, notice: 'Facility item was successfully created.' } format.json { render :show, status: :created, location: @facility_item } else format.html { render :new } format.json { render json: @facility_item.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @facility_item = FacilityItem.new(facility_item_params)\n\n respond_to do |format|\n if @facility_item.save\n format.html { redirect_to '/facilities/'+@facility_item.facility_id.to_s+'/facility_items', notice: 'Facility item was successfully created.' }\n format.json { render :show, status: :created, location: @facility_item }\n else\n format.html { render :new }\n format.json { render json: @facility_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def facility_item_params\n params.require(:facility_item).permit(:name, :facility_id)\n end", "def facility_item_params\n params.require(:facility_item).permit(:facility_name, :available_quantity, :meeting_room_id)\n end", "def create\n @facility = Facility.new(params[:facility])\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to @facility, notice: 'Facility was successfully created.' }\n format.json { render json: @facility, status: :created, location: @facility }\n else\n format.html { render action: \"new\" }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @facility = Facility.new(facility_params)\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to edit_facility_path(@facility), notice: 'Facility was successfully created.' }\n format.json { render :edit, status: :created, location: @facility }\n else\n format.html { render :new }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_facility_item\n @facility_item = FacilityItem.find(params[:id])\n end", "def create\n @facility = Facility.new(facility_params)\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to @facility, notice: \"Facility was successfully created.\" }\n format.json { render :show, status: :created, location: @facility }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @facility = Facility.new(facility_params)\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to @facility, notice: 'Facility was successfully created.' }\n format.json { render :show, status: :created, location: @facility }\n else\n format.html { render :new }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @facility = Facility.new(facility_params)\n @facility.save\n respond_with @facility\n end", "def set_facility_item\n @facility_item = FacilityItem.find(params[:id]) \n end", "def create\n @facility_cost_item = FacilityCostItem.new(facility_cost_item_params)\n\n respond_to do |format|\n if @facility_cost_item.save\n format.html { redirect_to @facility_cost_item, notice: 'Facility cost item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @facility_cost_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @facility_cost_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n json_response(current_restaurant.restaurant_food_items.create!(food_item_params), :created)\n end", "def create\n @facility = Facility.new(facility_params)\n if @facility.save\n redirect_to facilities_path, notice: 'Facility was successfully created.'\n else\n render :new\n end\n end", "def update\n respond_to do |format|\n if @facility_item.update(facility_item_params)\n format.html { redirect_to facility_facility_items_path(@facility_item.facility_id), notice: 'Facility item was successfully updated.' }\n format.json { render :show, status: :ok, location: @facility_item }\n else\n format.html { render :edit }\n format.json { render json: @facility_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def facility_cost_item_params\n params.require(:facility_cost_item).permit(:name, :facility_id)\n end", "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def facility_params\n params.require(:facility).permit(:name, :description, :location)\n end", "def create\n @facility_type = FacilityType.new(facility_type_params)\n\n respond_to do |format|\n if @facility_type.save\n format.html { redirect_to @facility_type, notice: \"Facility type was successfully created.\" }\n format.json { render :show, status: :created, location: @facility_type }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @facility_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @other_facility = OtherFacility.new(other_facility_params)\n\n respond_to do |format|\n if @other_facility.save\n format.html { redirect_to @other_facility, notice: 'Other facility was successfully created.' }\n format.json { render :show, status: :created, location: @other_facility }\n else\n format.html { render :new }\n format.json { render json: @other_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def facility_params\n params.require(:facility).permit(:facility_type_id, :producing_trade_good_id, :producing_equipment_type_id, :levels)\n end", "def facility_params\n params.require(:facility).permit(:name)\n end", "def update\n respond_to do |format|\n if @facility_item.update(facility_item_params)\n format.html { redirect_to @facility_item, notice: 'Facility item was successfully updated.' }\n format.json { render :show, status: :ok, location: @facility_item }\n else\n format.html { render :edit }\n format.json { render json: @facility_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @facility = Facility.new(facility_params)\n @facility.citizen = current_citizen\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to @facility, notice: 'Facility was successfully built.' }\n format.json { render :show, status: :created, location: @facility }\n else\n format.html { render :new }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def facility_params\n params.require(:facility).permit(:name, :hotel_id, :price, :internet, :parking, :accomodation, :swimming_pool, :pa_system, :bar, :area, :capacity => [], :facility_layouts => [])\n end", "def facility_params\n params.require(:facility).permit(:name)\n end", "def index\n if facility_params[:facility_id]\n @facility_items = FacilityItem.where(facility_id: @facility.id).order(:name).page params[:page]\n else \n @facility_items = [] \n for value in @template.template_facility_item do\n @facility_items.push(FacilityItem.find(value.facility_item_id))\n end \n end\n end", "def create\n @request_item = RequestItem.new(request_item_params)\n @request_item.item = Item.new(name: params[:request_item][:item][:name])\n\n if @request_item.save\n render json: @request_item \n else\n render json: @request_item.errors, status: :bad_request\n end\n end", "def facility_params\n params.require(:facility).permit(:name, :category_id, :designation, :phone, :email, :address, :shift, :active)\n end", "def new\n @facility = Facility.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @facility }\n end\n end", "def create\n @faculties = Faculty.create!(faculty_params)\n json_response(@faculties, :created)\n end", "def create\n @facility_total = FacilityTotal.new(params[:facility_total])\n\n respond_to do |format|\n if @facility_total.save\n format.html { redirect_to @facility_total, notice: 'Facility total was successfully created.' }\n format.json { render json: @facility_total, status: :created, location: @facility_total }\n else\n format.html { render action: \"new\" }\n format.json { render json: @facility_total.errors, status: :unprocessable_entity }\n end\n end\n end", "def facility_params\n params.require(:facility).permit(:title, :desctription)\n end", "def create\n @room_facility = RoomFacility.new(room_facility_params)\n\n respond_to do |format|\n if @room_facility.save\n format.html { redirect_to @room_facility, notice: 'Room facility was successfully created.' }\n format.json { render :show, status: :created, location: @room_facility }\n else\n format.html { render :new }\n format.json { render json: @room_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n if @item.save\n render json: ItemSerializer.new(@item)\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end", "def create\n @scheduled_facility = ScheduledFacility.new(params[:scheduled_facility])\n\n respond_to do |format|\n if @scheduled_facility.save\n format.html { redirect_to @scheduled_facility, notice: 'Scheduled facility was successfully created.' }\n format.json { render json: @scheduled_facility, status: :created, location: @scheduled_facility }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scheduled_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @facility = Facility.new(facility_params)\n # byebug\n @facility.facility_layouts = facility_params[:facility_layouts].join(\" \")\n @facility.capacity = facility_params[:capacity].join(\" \")\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to new_photo_path(@facility), notice: 'Please add photo to complete.' }\n format.json { render :show, status: :created, location: @facility }\n else\n format.html { render :new }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item_feature = ItemFeature.new(params[:item_feature])\n\n respond_to do |format|\n if @item_feature.save\n format.html { redirect_to @item_feature, notice: 'Item feature was successfully created.' }\n format.json { render json: @item_feature, status: :created, location: @item_feature }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def facility_params\n params.require(:facility).permit(:client_id, :name, :address, :phone, :poc_name, :poc_phone, :poc_email, :inactive, :comments, :latitude, :longitude, :last_geocoded)\n end", "def create\n @fnf_item = FnfItem.new(fnf_item_params)\n\n respond_to do |format|\n if @fnf_item.save\n format.html { redirect_to @fnf_item, notice: 'Fnf item was successfully created.' }\n format.json { render :show, status: :created, location: @fnf_item }\n else\n format.html { render :new }\n format.json { render json: @fnf_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @insurance_facility = InsuranceFacility.new(insurance_facility_params)\n\n respond_to do |format|\n if @insurance_facility.save\n format.html { redirect_to @insurance_facility, notice: 'Insurance facility was successfully created.' }\n format.json { render :show, status: :created, location: @insurance_facility }\n else\n format.html { render :new }\n format.json { render json: @insurance_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n create_params = item_params\n item = Item.new(\n name: create_params[:name], \n is_complete: false, #create_params[:is_complete], \n list_id: create_params[:list_id])\n\n item.save!\n render json: item\n end", "def create\n @facility = TreatmentFacility.new(params[:treatment_facility])\n \n if @facility.save\n # Set roles for new users\n @facility.users.each do |user|\n if user.role.nil?\n user.role = Role.find_by_name(Role::TECHNICIAN)\n user.save!\n end\n end\n # Create timers for new treatment areas\n @facility.treatment_areas.each do |area|\n if area.process_timer.nil?\n area.build_process_timer(:duration_seconds => area.duration_minutes * 60)\n area.save!\n end\n end\n \n redirect_to @facility, :notice => I18n.t('facility_created')\n else\n render 'new'\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n category_field_values = []\n params[:item_field].each do |key, value|\n category_field_values << { item_id: @item.id, category_field_id: key, value: value }\n end\n CategoryFieldValue.create(category_field_values)\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place_facility = PlaceFacility.new(place_facility_params)\n\n respond_to do |format|\n if @place_facility.save\n format.html { redirect_to @place_facility, notice: 'Place facility was successfully created.' }\n format.json { render :show, status: :created, location: @place_facility }\n else\n format.html { render :new }\n format.json { render json: @place_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n 'currency_code' => 'USD',\n 'amount' => 400\n }\n }\n ]\n }\n\n response = Unirest.post CONNECT_HOST + '/v1/' + LOCATION_ID + '/items',\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully created item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item creation failed'\n puts response.body\n return nil\n end\nend", "def create\n @food_item_add_on = FoodItemAddOn.new(food_item_add_on_params)\n\n\n\n#Todo: can select multiple items for a sinfle addons\n respond_to do |format|\n if @food_item_add_on.save\n format.html { redirect_to :controller => 'home', :action => 'dashboard' }\n format.json { render :show, status: :created, location: @food_item_add_on }\n else\n format.html { render :new }\n format.json { render json: @food_item_add_on.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item_tier = ItemTier.new(item_tier_params)\n\n respond_to do |format|\n if @item_tier.save\n format.html { redirect_to @item_tier, notice: 'Item tier was successfully created.' }\n format.json { render :show, status: :created, location: @item_tier }\n else\n format.html { render :new }\n format.json { render json: @item_tier.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @furniture_item = FurnitureItem.new(furniture_item_params)\n\n respond_to do |format|\n if @furniture_item.save\n format.html { redirect_to @furniture_item, notice: 'Furniture item was successfully created.' }\n format.json { render :show, status: :created, location: @furniture_item }\n else\n format.html { render :new }\n format.json { render json: @furniture_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diagnosis_facility = DiagnosisFacility.new(diagnosis_facility_params)\n\n respond_to do |format|\n if @diagnosis_facility.save\n format.html { redirect_to @diagnosis_facility, notice: 'Diagnosis facility was successfully created.' }\n format.json { render :show, status: :created, location: @diagnosis_facility }\n else\n format.html { render :new }\n format.json { render json: @diagnosis_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fooditem = Fooditem.new(params[:fooditem])\n\n respond_to do |format|\n if @fooditem.save\n format.html { redirect_to @fooditem, :notice => 'Fooditem was successfully created.' }\n format.json { render :json => @fooditem, :status => :created, :location => @fooditem }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @fooditem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @foil_item = FoilItem.new(foil_item_params)\n\n respond_to do |format|\n if @foil_item.save\n format.html { redirect_to @foil_item, notice: 'Foil item was successfully created.' }\n format.json { render :show, status: :created, location: @foil_item }\n else\n format.html { render :new }\n format.json { render json: @foil_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_item = Admin::Item.new(params[:admin_item])\n @admin_item.agency_id = @current_agency.id\n fields = params[:item][:field]\n\n respond_to do |format|\n if @admin_item.save\n \n fields.each do |key, value|\n Admin::FieldValue.create(:item_id => @admin_item.id, :field_id => key, :value => value)\n end\n \n format.html { redirect_to edit_admin_item_path(@admin_item), notice: 'Item was successfully created.' }\n format.json { render json: @admin_item, status: :created, location: @admin_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @home_facility = HomeFacility.new(home_facility_params)\n\n respond_to do |format|\n if @home_facility.save\n format.html { redirect_to @home_facility, notice: 'Home facility was successfully created.' }\n format.json { render :show, status: :created, location: @home_facility }\n else\n format.html { render :new }\n format.json { render json: @home_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @curriculumID = Curriculum.find(params[:curriculum_id])\n @item = @curriculumID.items.build(params[:item])\n respond_to do |format|\n if @item.save\n format.html { redirect_to @curriculumID, notice: \"Lehrplaninhalt #{@item.title} wurde erfolgreich angelegt.\" }\n format.json { render action: 'show', status: :created, location: @item } \n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(budget_params)\n respond_to do |format|\n if @budget.save\n \n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: @budget.id)\n end\n end\n \n format.html { redirect_to budgets_path, notice: \"Budget was successfully created.\" }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_item(iid, itypes, params={})\n params.merge!(default_params)\n params['pio_iid'] = iid\n format_itypes(itypes, params)\n extract_latlng(params)\n extract_startend(params)\n @connection.post(:items, params).body\n end", "def create\n @placed_furniture_item = PlacedFurnitureItem.new(placed_furniture_item_params)\n\n respond_to do |format|\n if @placed_furniture_item.save\n format.html { redirect_to @placed_furniture_item, notice: 'Placed furniture item was successfully created.' }\n format.json { render :show, status: :created, location: @placed_furniture_item }\n else\n format.html { render :new }\n format.json { render json: @placed_furniture_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def facility_params\n params.require(:facility).permit(:name, :capacity, :whiteboard, :conferencing)\n end", "def update\n @facility = Facility.find(params[:id])\n @facility.update_attributes(facility_params)\n respond_with @facility\n end", "def create\n @item = Item.create(item_params)\n current_company.locations.where(id:params[:locationId]).first.items << @item\n # Delete the thing below this untrustworthy piece of crap made me rewrite this so much just to find out this was the problem\n # respond_to do |format|\n # if @item.save\n # format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n # format.json { render :show, status: :created, location: @item }\n # else\n # format.html { render :new, status: :unprocessable_entity }\n # format.json { render json: @item.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n item = Item.new(item_params)\n item.user = current_user\n if item.save\n render json: item\n else\n render json: {errors: item.errors}, status: :unprocessable_entity\n end\n end", "def create\n @itemtipo = Itemtipo.new(itemtipo_params)\n\n if @itemtipo.save\n render json: @itemtipo, status: :created, location: @itemtipo\n else\n render json: @itemtipo.errors, status: :unprocessable_entity\n end\n end", "def create\n @form_item = @template.form_items.build(form_item_params)\n\n respond_to do |format|\n if @form_item.save\n format.html { redirect_to template_path(@template, anchor: :additem), notice: 'Form item was successfully created.' }\n format.json { render :show, status: :created, location: @form_item }\n else\n format.html { render :new }\n format.json { render json: @form_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n item = Item.new(item_params)\n item.done = \"0\"\n item.trash = \"0\"\n\n if item.save\n render json: {data:item}, status: :created\n else\n render json: {data:item}, status: :unprocessable_entity\n end\n end", "def destroy\n @facility_item.destroy\n respond_to do |format|\n format.html { redirect_to facility_facility_items_path(facility_params), notice: 'Facility item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @hotels_facility = HotelsFacility.new(params[:hotels_facility])\n\n respond_to do |format|\n if @hotels_facility.save\n format.html { redirect_to(@hotels_facility, :notice => 'Hotels facility was successfully created.') }\n format.xml { render :xml => @hotels_facility, :status => :created, :location => @hotels_facility }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @hotels_facility.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully added.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n if @item.save\n @items = Item.all\n render status: 201, :json => @item\n \n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n \n \n end", "def create\n @item_collection = ItemCollection.new(item_collection_params)\n\n respond_to do |format|\n if @item_collection.save\n format.html { redirect_to @item_collection, notice: \"La collection a été correctement créée\" }\n format.json { render :show, status: :created, location: @item_collection }\n else\n format.html { render :new }\n format.json { render json: @item_collection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @requirement_item = RequirementItem.new(requirement_item_params)\n\n respond_to do |format|\n if @requirement_item.save\n format.html { redirect_to @requirement_item, notice: 'Requirement item was successfully created.' }\n format.json { render :show, status: :created, location: @requirement_item }\n else\n format.html { render :new }\n format.json { render json: @requirement_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n @item.budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to after_save_redirection_path, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #api_key = \"cb8d3966-e1c6-4429-a8cf-b615523481c4\"\n\n @item = Item.new(item_params)\n\n @swift_api_key = SwiftApiKey.first\n\n api_key = @swift_api_key.key\n\n HTTParty.post(\"https://app.getswift.co/api/v2/deliveries\",\n {\n :body => {\n \"apiKey\": api_key,\n \"booking\":{\n \"items\": [{\n \"quantity\": @item.quantity,\n \"sku\": @item.sku,\n \"description\": @item.description,\n \"price\": @item.price\n }],\n \"pickupDetail\": {\n \"name\": \"Marko\",\n \"phone\": \"604 356 8259\",\n \"address\": \"301 Maude Road, Port Moody, V3H5B1\"\n },\n \"dropoffDetail\": {\n \"name\": @item.name,\n \"phone\": @item.phone,\n \"address\": @item.address\n }\n }\n }.to_json,\n :headers => { 'Content-Type' => 'application/json' }\n }\n )\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def facility_params\n params.require(:facility).permit(:name, :role_id, :user_id, \n address_attributes: [:street, :city, :country, :zip_code])\n # facility_static_measure_attributes: [:name, :value, :start_date, :end_date, :user_id, :facility_id])\n end", "def post(payload, request_opts={})\n if payload.is_a?(Hash)\n payload = self.class.item_class.new(payload) # apply data type conversion\n end\n qs = payload.query_string_params\n payload = payload.as_hash\n response = http(request_opts).post(resolved_path + qs, payload)\n new_item = self.class.item_class.new\n new_item.store_result(response)\n new_item\n end", "def create\n\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend", "def create\n @food_item = FoodItem.new(food_item_params)\n @food_item.category = Category.find(params[:food_item][:category_id])\n respond_to do |format|\n if @food_item.save\n format.html { redirect_to @food_item, notice: \"Food item was successfully created.\" }\n format.json { render :show, status: :created, location: @food_item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @food_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def facilities_params\n params.require(:facility).permit(:abbrev)\n end", "def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend", "def create\n @item_datum = ItemData.new(params[:item_datum])\n\n respond_to do |format|\n if @item_datum.save\n format.html { redirect_to @item_datum, notice: 'Item datum was successfully created.' }\n format.json { render json: @item_datum, status: :created, location: @item_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @backlog_item = BacklogItem.new(backlog_item_all_params)\n \n if @backlog_item.item_type == \"sprint\"\n if params.has_key?(\"start_date\") && params.has_key?(\"end_date\")\n @backlog_item.info = {start_date: params[:start], end_date: params[:end]}.to_json\n end\n end\n\n respond_to do |format|\n if @backlog_item.save\n format.html { redirect_to @backlog_item, notice: 'Backlog item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @backlog_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @backlog_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_facility\n @facility = Facility.find(params[:id])\n end", "def create\n @research_item = ResearchItem.new(params[:research_item])\n\n respond_to do |format|\n if @research_item.save\n format.html { redirect_to @research_item, :notice => 'Research item was successfully created.' }\n format.json { render :json => @research_item, :status => :created, :location => @research_item }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @research_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_facility\n @facility = Facility.find(params[:facility_id])\n end", "def set_facility_cost_item\n @facility_cost_item = FacilityCostItem.find(params[:id])\n end", "def create\n @tipo_item = TipoItem.new(params[:tipo_item])\n\n respond_to do |format|\n if @tipo_item.save\n format.html { redirect_to @tipo_item, notice: 'Tipo item was successfully created.' }\n format.json { render json: @tipo_item, status: :created, location: @tipo_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @facility_review = FacilityReview.new(facility_review_params)\n\n respond_to do |format|\n if @facility_review.save\n format.html { redirect_to @facility_review, notice: 'Facility review was successfully created.' }\n format.json { render :show, status: :created, location: @facility_review }\n else\n format.html { render :new }\n format.json { render json: @facility_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.find(current_user.id)\n @item = @user.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/items', notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @facility_item.destroy\n respond_to do |format|\n format.html { redirect_to facility_items_url, notice: 'Facility item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @part_types = Constants::PART_TYPES\n @item = Item.new(item_params.merge(user_id: current_user.id))\n \n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n if @item.save\n render json: @item\n else\n render json: { error: t('story_create_error') }, status: :unprocessable_entity\n end\n end", "def new\n @facility_total = FacilityTotal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @facility_total }\n end\n end", "def add_multiple_food_items(items)\n items.each do |item|\n item['_id'] = FoodItem.create_id item[:api_key], item[:item_id]\n FoodItem.new_item item\n end\n items\n end", "def facility_params\n params.require(:facility).permit(:active, :id, :phone, :fax, :email, :facility_id_number, :name, :short_name, :active_flag, :address1, :address2, :city, :state, :zip_code, :account_number, :internal_id_number, :state_id_number, :npi_number, :price_schedule, :universal_fee, :unit_dose_fee, :control_drug_fee, :narcotic_fee, :allow_customer_discount, :label_type, :spool_labels, :label_default, :use_expiration_date, :expiration_default, :use_lot_number, :use_doc_u_dose, :default_to_primary_plan, :use_valid_division_codes, :use_form_flags, :use_start_date, :post_zero_copay, :use_auto_fill, :use_patient_counseling, :print_patient_counseling, :select_counseling, :check_dur, :print_monograph, :log_dur_results, :require_hippa_privacy_notice, :print_medication_administration_form, :print_physician_order_form, :print_treatment_form, :print_delivery_receipt, :medication_administration_form, :physician_orders_form, :treatment_form, :print_order, :print_pass_times, :print_other_allergy, :med_administration_routine_heading, :med_administration_prn_heading, :treatment_heading, :print_fill_date, :print_original_date, :print_in_frequency_order, :require_rx_copy_in_facility, :type_of_facility,\n wings_attributes:[:id, :company_id,:pharmacy_id,:facility,:pass_times_id,:active,:name,:contact,:price_schedules,:universal_fee,:unit_dose_fee,:control_drug_fee \\\n ,:narcotic_fee,:allow_customer_discount,:label_type,:spool_labels,:label_default,:expiration_date,:expiration_default,:lot_number,:doc_u_dose\\\n ,:default_to_primary_plan,:valid_division_codes,:form_flags,:start_date,:post_zero_copay,:frequency_auto_fill,:anniversary_auto_fill,:procycle_auto_fill\\\n ,:print_monograph,:log_dur_results,:require_hippa_privacy_notice,:print_medication_guide,:print_medication_administration_form,:print_physician_order_form,:print_treatment_form\\\n ,:print_delivery_receipt,:medication_administration_form,:physician_orders_form,:treatment_form,:print_order,:print_pass_times,:print_other_allergy,:med_administration_routine_heading\\\n ,:med_administration_prn_heading,:treatment_heading,:print_fill_date,:print_original_date,:print_in_frequency_order,:require_rx_copy_in_facility,:expand_sig_codes,:standing_orders\\\n ,:type_of_facility,:emr_interface,:emr_interface_type],\n beds_attributes:[:id,:company_id,:pharmacy_id,:facility_id,:wing_id,:residency_id,:customer_id,:legacy_customer_id_number,:active,:pass_order,:bed,:bed_type,:occupancy_date])\n end", "def create\n @item = current_user.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @facility_items = FacilityItem.where(\"true\").order(:facility_name).page params[:page]\n end", "def facility_type_params\n params.require(:facility_type).permit(:code, :name)\n end", "def other_facility_params\n params.require(:other_facility).permit(:name)\n end", "def create\n @training_facility = TrainingFacility.new(params[:training_facility])\n\n respond_to do |format|\n if @training_facility.save\n format.html { redirect_to(@training_facility, :notice => 'Training facility was successfully created.') }\n format.xml { render :xml => @training_facility, :status => :created, :location => @training_facility }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @training_facility.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = build_item\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'アップロードしたでー' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @facility_cost_items = FacilityCostItem.all\n end" ]
[ "0.7530436", "0.72076565", "0.6937627", "0.6723996", "0.6638696", "0.6614608", "0.66044796", "0.65928334", "0.6577001", "0.6502905", "0.64931077", "0.6305512", "0.61998236", "0.6138269", "0.6123877", "0.6118823", "0.61153483", "0.6102799", "0.61004335", "0.60927486", "0.6086413", "0.6070438", "0.6063536", "0.60583365", "0.60357326", "0.6016902", "0.59886867", "0.5983633", "0.59663457", "0.59629774", "0.5952681", "0.5942555", "0.5932201", "0.5929502", "0.5915848", "0.5909389", "0.59066105", "0.5879923", "0.58727986", "0.58510774", "0.5844515", "0.5842698", "0.5814358", "0.5795047", "0.5783487", "0.5778094", "0.5772915", "0.57720006", "0.5771042", "0.57604235", "0.5748387", "0.5725615", "0.5708936", "0.5690297", "0.5686695", "0.56590194", "0.5655743", "0.5650816", "0.56436473", "0.56402665", "0.5633205", "0.5622897", "0.5613075", "0.5607653", "0.55978173", "0.559082", "0.55873257", "0.5572672", "0.5562636", "0.55517274", "0.55511385", "0.55494523", "0.5544867", "0.5529364", "0.55144453", "0.5503504", "0.54913104", "0.5485612", "0.5484306", "0.54842305", "0.54823637", "0.548039", "0.5474419", "0.5461393", "0.5460897", "0.54542166", "0.5454148", "0.54481536", "0.5445951", "0.5443656", "0.5431989", "0.5430804", "0.5421166", "0.54179287", "0.541386", "0.54137033", "0.5408337", "0.5406267", "0.5402348", "0.5392328" ]
0.7639089
0
PATCH/PUT /facility_items/1 PATCH/PUT /facility_items/1.json
def update respond_to do |format| if @facility_item.update(facility_item_params) format.html { redirect_to @facility_item, notice: 'Facility item was successfully updated.' } format.json { render :show, status: :ok, location: @facility_item } else format.html { render :edit } format.json { render json: @facility_item.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @facility_item.update(facility_item_params)\n format.html { redirect_to facility_facility_items_path(@facility_item.facility_id), notice: 'Facility item was successfully updated.' }\n format.json { render :show, status: :ok, location: @facility_item }\n else\n format.html { render :edit }\n format.json { render json: @facility_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @facility = Facility.find(params[:id])\n @facility.update_attributes(facility_params)\n respond_with @facility\n end", "def update\n respond_to do |format|\n if @facility.update(facility_params)\n format.html { redirect_to facilities_path, notice: 'Facility was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @facility.update(facility_params)\n format.html { redirect_to edit_facility_path(@facility), notice: 'Facility was successfully updated.' }\n format.json { render :edit, status: :ok, location: @facility }\n else\n format.html { render :edit }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @facility = Facility.find(params[:id])\n\n respond_to do |format|\n if @facility.update_attributes(params[:facility])\n format.html { redirect_to @facility, notice: 'Facility was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @facility.update(facility_params)\n format.html { redirect_to @facility, notice: 'Facility was successfully updated.' }\n format.json { render :show, status: :ok, location: @facility }\n else\n format.html { render :edit }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @facility.update(facility_params)\n format.html { redirect_to @facility, notice: 'Facility was successfully updated.' }\n format.json { render :show, status: :ok, location: @facility }\n else\n format.html { render :edit }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @facility.update(facility_params)\n format.html { redirect_to @facility, notice: \"Facility was successfully updated.\" }\n format.json { render :show, status: :ok, location: @facility }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @facility_cost_item.update(facility_cost_item_params)\n format.html { redirect_to @facility_cost_item, notice: 'Facility cost item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @facility_cost_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @other_facility.update(other_facility_params)\n format.html { redirect_to @other_facility, notice: 'Other facility was successfully updated.' }\n format.json { render :show, status: :ok, location: @other_facility }\n else\n format.html { render :edit }\n format.json { render json: @other_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n json_response(@food_item.update!(food_item_params))\n end", "def set_facility_item\n @facility_item = FacilityItem.find(params[:id]) \n end", "def set_facility_item\n @facility_item = FacilityItem.find(params[:id])\n end", "def update\n @item_feature = ItemFeature.find(params[:id])\n\n respond_to do |format|\n if @item_feature.update_attributes(params[:item_feature])\n format.html { redirect_to @item_feature, notice: 'Item feature was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update\n respond_to do |format|\n if @facility_type.update(facility_type_params)\n format.html { redirect_to @facility_type, notice: \"Facility type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @facility_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @facility_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n #update the item of request_item\n if (params[:request_item].present?)\n @request_item.item = params[:request_item][:item].present? ? Item.new(name: params[:request_item][:item][:name]) : @request_item.item\n end\n #update all other parameters\n if @request_item.update(request_item_params)\n render json: @request_item\n else\n render json: @request_item.errors, status: :bad_request\n end\n\n end", "def update\n respond_to do |format|\n if @place_facility.update(place_facility_params)\n format.html { redirect_to @place_facility, notice: 'Place facility was successfully updated.' }\n format.json { render :show, status: :ok, location: @place_facility }\n else\n format.html { render :edit }\n format.json { render json: @place_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @scheduled_facility = ScheduledFacility.find(params[:id])\n\n respond_to do |format|\n if @scheduled_facility.update_attributes(params[:scheduled_facility])\n format.html { redirect_to @scheduled_facility, notice: 'Scheduled facility was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scheduled_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @room_facility.update(room_facility_params)\n format.html { redirect_to @room_facility, notice: 'Room facility was successfully updated.' }\n format.json { render :show, status: :ok, location: @room_facility }\n else\n format.html { render :edit }\n format.json { render json: @room_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @requirement_item.update(requirement_item_params)\n format.html { redirect_to @requirement_item, notice: 'Requirement item was successfully updated.' }\n format.json { render :show, status: :ok, location: @requirement_item }\n else\n format.html { render :edit }\n format.json { render json: @requirement_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @facility.update(facility_params)\n if @facility.levels && @facility.levels.to_i > 0\n notice = 'Facility was successfully upgraded.'\n else\n notice = 'Facility was successfully managed.'\n end\n format.html { redirect_to @facility, notice: notice }\n format.json { render :show, status: :ok, location: @facility }\n else\n format.html { render :edit }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fertigation_item.update(fertigation_item_params)\n update_fertigation_and_costs\n format.html { redirect_to @fertigation_item, notice: 'Fertigation item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fertigation_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @facility_total = FacilityTotal.find(params[:id])\n\n respond_to do |format|\n if @facility_total.update_attributes(params[:facility_total])\n format.html { redirect_to @facility_total, notice: 'Facility total was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @facility_total.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n Item.where([\"budget_id = #{params[:id]}\"]).update_all(budget_id: nil)\n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: params[:id])\n end\n end\n format.html { redirect_to budgets_path, notice: \"Budget was successfully updated.\" }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@food_item automatically set to FoodItem.find(params[:id])\n\n respond_to do |format|\n if @food_item.update_attributes(params[:food_item])\n if request.xhr?\n format.html { render partial: 'row', locals: {food_item: @food_item, index: 0}}\n else\n format.html { redirect_to @food_item, notice: 'Food item was successfully updated.' }\n end\n format.json { head :no_content }\n else\n if request.xhr?\n format.html { render partial: 'row_form', locals: {food_item: @food_item}, status: :unprocessable_entity }\n else\n format.html { render action: \"edit\" }\n end\n format.json { render json: @food_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def facility_item_params\n params.require(:facility_item).permit(:name, :facility_id)\n end", "def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end", "def update\n if @item.update(item_params)\n render status: 201, :json => @item, :include =>[{:location =>{:except=>[:id, :created_at, :updated_at]}}, {:food =>{:except =>[:id, :created_at, :updated_at]}}], :except => [:created_at, :updated_at, :food_id, :location_id]\n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n\n \n end", "def update\n respond_to do |format|\n if @fnf_item.update(fnf_item_params)\n format.html { redirect_to @fnf_item, notice: 'Fnf item was successfully updated.' }\n format.json { render :show, status: :ok, location: @fnf_item }\n else\n format.html { render :edit }\n format.json { render json: @fnf_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fooditem = Fooditem.find(params[:id])\n\n respond_to do |format|\n if @fooditem.update_attributes(params[:fooditem])\n format.html { redirect_to @fooditem, :notice => 'Fooditem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @fooditem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @insurance_facility.update(insurance_facility_params)\n format.html { redirect_to @insurance_facility, notice: 'Insurance facility was successfully updated.' }\n format.json { render :show, status: :ok, location: @insurance_facility }\n else\n format.html { render :edit }\n format.json { render json: @insurance_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @hotels_facility = HotelsFacility.find(params[:id])\n\n respond_to do |format|\n if @hotels_facility.update_attributes(params[:hotels_facility])\n format.html { redirect_to(@hotels_facility, :notice => 'Hotels facility was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @hotels_facility.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @home_facility.update(home_facility_params)\n format.html { redirect_to @home_facility, notice: 'Home facility was successfully updated.' }\n format.json { render :show, status: :ok, location: @home_facility }\n else\n format.html { render :edit }\n format.json { render json: @home_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lunch_item.update(lunch_item_params)\n format.html { redirect_to @lunch_item, notice: 'Lunch item was successfully updated.' }\n format.json { render :show, status: :ok, location: @lunch_item }\n else\n format.html { render :edit }\n format.json { render json: @lunch_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @furniture_item.update(furniture_item_params)\n format.html { redirect_to @furniture_item, notice: 'Furniture item was successfully updated.' }\n format.json { render :show, status: :ok, location: @furniture_item }\n else\n format.html { render :edit }\n format.json { render json: @furniture_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @foil_item.update(foil_item_params)\n format.html { redirect_to @foil_item, notice: 'Foil item was successfully updated.' }\n format.json { render :show, status: :ok, location: @foil_item }\n else\n format.html { render :edit }\n format.json { render json: @foil_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @item.update_attributes(item_params)\n render json: @item, status: :ok\n else\n render_error(@item, :unprocessable_entity)\n end\n end", "def update\n respond_to do |format|\n if @ticket_item.update(ticket_item_params)\n format.html { redirect_to [:admin, @ticket_item], notice: 'Ticket item was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket_item }\n else\n format.html { render :edit }\n format.json { render json: @ticket_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { respond_with_bip(@item) }\n else\n format.html { render action: 'edit' }\n format.json { respond_with_bip(@item) }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n @item = @client.items.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_fee_with_http_info(location_id, fee_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1ItemsApi.update_fee ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling V1ItemsApi.update_fee\" if location_id.nil?\n # verify the required parameter 'fee_id' is set\n fail ArgumentError, \"Missing the required parameter 'fee_id' when calling V1ItemsApi.update_fee\" if fee_id.nil?\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling V1ItemsApi.update_fee\" if body.nil?\n # resource path\n local_var_path = \"/v1/{location_id}/fees/{fee_id}\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'fee_id' + '}', fee_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'V1Fee')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1ItemsApi#update_fee\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def facility_item_params\n params.require(:facility_item).permit(:facility_name, :available_quantity, :meeting_room_id)\n end", "def update\n if @item.update(item_params)\n render json: @item, status: :ok\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "def UpdateField params = {}\n \n APICall(path: 'ticket_fields.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @item = Item.find(params[:id])\n @item.update_attributes(params[:item])\n respond_with @item\n end", "def update\n respond_to do |format|\n if @item_tier.update(item_tier_params)\n format.html { redirect_to @item_tier, notice: 'Item tier was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_tier }\n else\n format.html { render :edit }\n format.json { render json: @item_tier.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @research_item = ResearchItem.find(params[:id])\n\n respond_to do |format|\n if @research_item.update_attributes(params[:research_item])\n format.html { redirect_to @research_item, :notice => 'Research item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @research_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @financing_item.update(financing_item_params)\n format.html { redirect_to @financing_item, notice: 'Financing item was successfully updated.' }\n format.json { render :show, status: :ok, location: @financing_item }\n else\n format.html { render :edit }\n format.json { render json: @financing_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n Rails.logger.debug params.inspect\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n respond_with(@items)\n end\n end\n end", "def update\n respond_to do |format|\n if @diagnosis_facility.update(diagnosis_facility_params)\n format.html { redirect_to @diagnosis_facility, notice: 'Diagnosis facility was successfully updated.' }\n format.json { render :show, status: :ok, location: @diagnosis_facility }\n else\n format.html { render :edit }\n format.json { render json: @diagnosis_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'FOAF was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ball_flight_item = BallFlightItem.find(params[:id])\n\n respond_to do |format|\n if @ball_flight_item.update_attributes(params[:ball_flight_item])\n format.html { redirect_to @ball_flight_item, notice: 'Ball flight item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ball_flight_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @feature_request.update(feature_request_params)\n format.html { redirect_to @feature_request, notice: 'Feature request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feature_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @facility_review.update(facility_review_params)\n format.html { redirect_to @facility_review, notice: 'Facility review was successfully updated.' }\n format.json { render :show, status: :ok, location: @facility_review }\n else\n format.html { render :edit }\n format.json { render json: @facility_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = \"Vger::Resources::#{params[:item][:item_type]}\".constantize.find(params[:id])\n respond_to do |format|\n if @item.class.save_existing(params[:id], params[:item])\n format.html { redirect_to suitability_item_path(params[:id]), notice: 'Suitability Item was successfully updated.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_item(item_id)\n request_body = {\n 'name' => 'Malted Milkshake'\n }\n\n response = Unirest.put CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully updated item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item update failed'\n puts response.body\n return nil\n end\nend", "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n item = @list.list_items.find(params[:id])\n\n if item.update_attributes(params[:list_item])\n render json: item\n else\n error(t('messages.list_item.errors.update'))\n end\n end", "def update\n respond_to do |format|\n if @equipment_line_item.update(equipment_line_item_params)\n format.html { redirect_to @equipment_line_item, notice: 'Equipment line item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @equipment_line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to items_path, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @operation_item.update(operation_item_params)\n format.html { redirect_to :action => :index, notice: 'Operation item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @operation_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @training_facility = TrainingFacility.find(params[:id])\n\n respond_to do |format|\n if @training_facility.update_attributes(params[:training_facility])\n format.html { redirect_to(@training_facility, :notice => 'Training facility was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @training_facility.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sub1_line_item.update(sub1_line_item_params)\n format.html { redirect_to @sub1_line_item, notice: 'Sub1 line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @sub1_line_item }\n else\n format.html { render :edit }\n format.json { render json: @sub1_line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n item = Item.find(params[:id])\n if item.user == current_user\n if item.update(item_params)\n render json: item\n else\n render json: {errors: item.errors}, status: :unprocessable_entity\n end\n else\n render json: {errors: \"you can't do it\"}, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @defected_item.update(defected_item_params)\n format.html { redirect_to @defected_item, notice: 'Defected item was successfully updated.' }\n format.json { render :show, status: :ok, location: @defected_item }\n else\n format.html { render :edit }\n format.json { render json: @defected_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = @collection.items.get(params[:id])\n @collection.schema.each do |field|\n if params[:item][field.to_s].blank? && !field.is_file\n @item[field.name]=nil\n elsif field.is_file\n #do nothing\n unless params[:item][field.to_s].nil?\n new_file = @file_collection.items.new()\n new_file.file =params[:item][field.to_s]\n new_file.save\n @item[field.name]='{\"project\":{\"id\": \"'+@project.id+'\"}, \"collection\":{\"id\": \"'+@file_collection.id+'\"},\"item\":{\"id\": \"'+new_file.id.to_s+'\", \"display\": \"'+new_file.original_filename+'\"}}'\n end\n else\n @item[field.name] = params[:item][field.to_s]\n end\n end\n if @item.save\n update_associated_fields(@item, @collection, @project)\n respond_to do |format|\n format.html do\n flash[:notice] = \"Item Updated Successfully!\"\n end\n #format.json { render json: @item.to_json, status: :updated}\n format.js { render :js => '$(\"#message\").html(\"<h2>Item updated. Close window and refresh your page.</h2>\").attr(\"class\",\"message notice\"); $(\"html, body\").animate({scrollTop: \"0px\"})' }\n end\n else\n respond_to do |format|\n format.html do\n flash[:error] = [\"Item failed to save! Errors:\", @item.errors.full_messages].flatten.join(' ')\n end\n format.json { render json: @item.to_json, status: :error}\n format.js { render :js => '$(\"#message\").html(\"<h2>Item failed update.</h2>\").attr(\"class\",\"message error\").scrollTop(0); $(\"html, body\").animate({scrollTop: \"0px\"})' }\n end\n end\n redirect_to :back\n end", "def update\n respond_to do |format|\n if @needed_item.update(needed_item_params)\n format.html { redirect_to @needed_item, notice: 'Needed item was successfully updated.' }\n format.json { render :show, status: :ok, location: @needed_item }\n else\n format.html { render :edit }\n format.json { render json: @needed_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to '/items', notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @placed_furniture_item.update(placed_furniture_item_params)\n format.html { redirect_to @placed_furniture_item, notice: 'Placed furniture item was successfully updated.' }\n format.json { render :show, status: :ok, location: @placed_furniture_item }\n else\n format.html { render :edit }\n format.json { render json: @placed_furniture_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def change_multiple_items\n @items = params[:items]\n\n @items.each do |item|\n @current_item = Item.find(item[:id])\n @current_item.update(quantity: item[:quantity])\n end\n\n render :json => @items.to_json\n end", "def update\n respond_to do |format|\n if @apiv1_item.update(apiv1_item_params)\n format.html { redirect_to @apiv1_item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @apiv1_item }\n else\n format.html { render :edit }\n format.json { render json: @apiv1_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @convenience_item.update(convenience_item_params)\n format.html { redirect_to @convenience_item, notice: 'Convenience item was successfully updated.' }\n format.json { render :show, status: :ok, location: @convenience_item }\n else\n format.html { render :edit }\n format.json { render json: @convenience_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @staff_request\n respond_to do |format|\n if @staff_request.update(staff_request_params)\n format.html do\n redirect_to @staff_request,\n notice: \"Staff request for #{@staff_request.description} was successfully updated.\"\n end\n format.json { render :show, status: :ok, location: @staff_request }\n else\n format.html do\n assign_selectable_departments_and_units(@staff_request)\n render :new\n end\n format.json { render json: @staff_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @backlogitem.update(backlogitem_params)\n format.html {redirect_to backlogitems_path(:project => @backlogitem.project_id), notice: 'BacklogItem was successfully updated.'}\n format.json {render :show, status: :ok, location: @backlogitem}\n else\n format.html {redirect_to backlogitems_path(:project => @backlogitem.project_id), alert: @backlogitem.errors}\n format.json {render json: @backlogitem.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n @item = @user.items.find(params[:id])\n\n @item.update(:type_list => \"\", :tag_list => \"\")\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to [@user, @item], notice: 'item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n\n\n end", "def update\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n if @item.update(params[:item])\n format.html { redirect_to({action: :show, id: @item}, notice: 'Item was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to lists_path, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = current_user.items.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: \"#{@item.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html do\n flash[:alert] = 'Something went wrong while updating an item.'\n render action: \"edit\"\n end\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\r\n @item = Item.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @item.update_attributes(params[:item])\r\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @item.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end" ]
[ "0.7439538", "0.7114478", "0.7021754", "0.6973534", "0.6972735", "0.6950552", "0.69238806", "0.6923682", "0.6654412", "0.65743184", "0.6570628", "0.65443194", "0.6532439", "0.651008", "0.6402472", "0.639943", "0.6386934", "0.6349682", "0.6348803", "0.63340867", "0.6306759", "0.6299761", "0.62797856", "0.6274885", "0.6211707", "0.6180963", "0.6179456", "0.61695606", "0.6160408", "0.61603695", "0.61493695", "0.6089864", "0.60836", "0.6077006", "0.60698795", "0.60652053", "0.6047781", "0.6041585", "0.6039628", "0.6023016", "0.6017744", "0.59947103", "0.598193", "0.5959484", "0.5956406", "0.59439135", "0.59311205", "0.59234613", "0.59194434", "0.5909794", "0.59001416", "0.58920234", "0.5889277", "0.5887533", "0.58871204", "0.58869076", "0.5886472", "0.58776015", "0.5874822", "0.5873463", "0.5870367", "0.58684736", "0.58614695", "0.5855798", "0.58554244", "0.5843613", "0.58423454", "0.5836797", "0.5832093", "0.58235884", "0.58153987", "0.58153987", "0.58153987", "0.58153987", "0.58153987", "0.58153987", "0.58153987", "0.58153987", "0.58153987", "0.58153987", "0.58153987", "0.5808426", "0.58068115", "0.5806726", "0.580057", "0.57932097", "0.57881653", "0.57851976", "0.57842445", "0.5783032", "0.5782557", "0.5782557", "0.5781817", "0.57783127", "0.5764113", "0.576367", "0.5756809", "0.57560974", "0.575577", "0.5753803" ]
0.7419252
1
DELETE /facility_items/1 DELETE /facility_items/1.json
def destroy @facility_item.destroy respond_to do |format| format.html { redirect_to facility_items_url, notice: 'Facility item was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @facility_item.destroy\n respond_to do |format|\n format.html { redirect_to facility_facility_items_path(facility_params), notice: 'Facility item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @facility = Facility.find(params[:id])\n @facility.destroy\n\n respond_to do |format|\n format.html { redirect_to facilities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @facility_cost_item.destroy\n respond_to do |format|\n format.html { redirect_to facility_cost_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @facility.destroy\n respond_to do |format|\n format.html { redirect_to facilities_url, notice: \"Facility was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @facility.destroy\n respond_to do |format|\n format.html { redirect_to facilities_url, notice: 'Facility was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @facility = Facility.find(params[:id])\n @facility.destroy\n respond_with @facility \n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @facility.destroy\n respond_to do |format|\n format.html { redirect_to \"/citizens/#{@facility.citizen.id}?tab=facilities\", notice: 'Facility was successfully sold.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @facility.destroy\n respond_to do |format|\n format.html { redirect_to success_page_url, notice: 'Facility was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @facility_total = FacilityTotal.find(params[:id])\n @facility_total.destroy\n\n respond_to do |format|\n format.html { redirect_to facility_totals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @facility_type.destroy\n respond_to do |format|\n format.html { redirect_to facility_types_url, notice: \"Facility type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @scheduled_facility = ScheduledFacility.find(params[:id])\n @scheduled_facility.destroy\n\n respond_to do |format|\n format.html { redirect_to scheduled_facilities_url }\n format.json { head :no_content }\n end\n end", "def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body\n return nil\n end\nend", "def delete_item\n item_id = params[\"item_id\"]\n\n item = TextItem.find_by_id(item_id)\n item = Image.find_by_id(item_id) if item.nil?\n item = Collection.find_by_id(item_id) if item.nil?\n render_json :status => :not_found, :messages => \"Could not find the item with id #{item_id}.\" and return if item.nil?\n\n if item.class == Collection\n if params[\"id\"].nil?\n render_json :status => :bad_request, :messages => \"Can't delete a collection reference without providing the parent collection id. Please use the longer url for item deletion.\" and return\n end\n collection = Collection.find_by_id(params[\"id\"])\n else\n collection = Ownership.find_by_item_id(item_id).parent\n end\n;\n render_json :status => :not_found, :messages => \"Could not find parent collection for the item.\" and return if (collection.nil?)\n render_json :status => :forbidden, :messages => \"The user is not allowed to delete from this collection.\" and return if (!collection.delete?(@user, @client))\n\n collection.delete_item(item_id)\n render_json :entry => {} and return\n end", "def destroy\n @backlog_item.destroy\n respond_to do |format|\n format.html { redirect_to backlog_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n render status: 200, json: @request_item.destroy\n end", "def destroy\n @other_facility.destroy\n respond_to do |format|\n format.html { redirect_to other_facilities_url, notice: 'Other facility was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n item = FormTemplate.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end", "def destroy\n @item_feature = ItemFeature.find(params[:id])\n @item_feature.destroy\n\n respond_to do |format|\n format.html { redirect_to item_features_url }\n format.json { head :ok }\n end\n end", "def destroy\n @insurance_facility.destroy\n respond_to do |format|\n format.html { redirect_to insurance_facilities_url, notice: 'Insurance facility was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fooditem = Fooditem.find(params[:id])\n @fooditem.destroy\n\n respond_to do |format|\n format.html { redirect_to fooditems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hotels_facility = HotelsFacility.find(params[:id])\n @hotels_facility.destroy\n\n respond_to do |format|\n format.html { redirect_to(hotels_facilities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @diagnosis_facility.destroy\n respond_to do |format|\n format.html { redirect_to diagnosis_facilities_url, notice: 'Diagnosis facility was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @room_facility.destroy\n respond_to do |format|\n format.html { redirect_to room_facilities_url, notice: 'Room facility was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @equipment_line_item.destroy\n respond_to do |format|\n format.html { redirect_to equipment_line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = @client.items.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully removed from Inventory.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @place_facility.destroy\n respond_to do |format|\n format.html { redirect_to place_facilities_url, notice: 'Place facility was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def destroy\n @accident_item.destroy\n respond_to do |format|\n format.html { redirect_to accident_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end", "def destroy\n @ball_flight_item = BallFlightItem.find(params[:id])\n @ball_flight_item.destroy\n\n respond_to do |format|\n format.html { redirect_to ball_flight_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @facility.hotel == current_hotel\n @facility.destroy\n respond_to do |format|\n format.html { redirect_to facilities_url, notice: 'Facility was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n redirect_to @facility, notice: 'Sorry, only the owner can delete this facility :('\n end\n end", "def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @faafacility = Faafacility.find(params[:id])\n @faafacility.destroy\n\n respond_to do |format|\n format.html { redirect_to faafacilities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fnf_item.destroy\n respond_to do |format|\n format.html { redirect_to fnf_items_url, notice: 'Fnf item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def destroy\n\t\tif Rails.env.production?\n\t\t\tRestClient.patch(\"https://lensshift-drive.firebaseio.com/resources_deleted/#{@resource_item.google_doc_id}.json\", @resource_item.to_json)\n\t\t\tRestClient.delete(\"https://lensshift-drive.firebaseio.com/resources/#{@resource_item.google_doc_id}.json\")\n\t\tend\n\t\t@resource_item.destroy\n\t respond_to do |format|\n\t format.html { redirect_to fellow_resource_items_url, notice: 'Resource item was successfully destroyed.' }\n\t format.json { head :no_content }\n\t end\n\tend", "def delete\n client.delete(\"/#{id}\")\n end", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @sub1_line_item.destroy\n respond_to do |format|\n format.html { redirect_to sub1_line_items_url, notice: 'Sub1 line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @home_facility.destroy\n respond_to do |format|\n format.html { redirect_to home_facilities_url, notice: 'Home facility was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @defected_item.destroy\n respond_to do |format|\n format.html { redirect_to defected_items_url, notice: 'Defected item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @research_item = ResearchItem.find(params[:id])\n @research_item.destroy\n\n respond_to do |format|\n format.html { redirect_to research_items_url }\n format.json { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(params[:budget_id]) }\n format.json { head :no_content }\n end\n end", "def destroy\n #@items_location = ItemsLocation.find(params[:id])\n #@items_location.destroy\n\n respond_to do |format|\n format.html { redirect_to items_locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @apiv1_item.destroy\n respond_to do |format|\n format.html { redirect_to apiv1_items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_datum = ItemData.find(params[:id])\n @item_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to item_datum_url }\n format.json { head :ok }\n end\n end", "def destroy\n @lineitem.destroy\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = @user.items.find(params[:id])\n @item.destroy\n\n\n respond_to do |format|\n format.html { redirect_to user_items_path(@user) }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_adicional.destroy\n respond_to do |format|\n format.html { redirect_to item_adicionals_url, notice: 'Item adicional was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def destroy\n @resource_item.destroy\n respond_to do |format|\n format.html { redirect_to resource_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @requirement_item.destroy\n respond_to do |format|\n format.html { redirect_to requirement_items_url, notice: 'Requirement item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n @items = Item.all\n render :json => @items, :include =>[{:location =>{:except=>[:id, :created_at, :updated_at]}}, {:food =>{:except =>[:id, :created_at, :updated_at]}}], :except => [:created_at, :updated_at, :food_id, :location_id]\n \n \n end", "def destroy\n @foil_item.destroy\n respond_to do |format|\n format.html { redirect_to foil_items_url, notice: 'Foil item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @furniture_item.destroy\n respond_to do |format|\n format.html { redirect_to furniture_items_url, notice: 'Furniture item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lineitem = Lineitem.find(params[:id])\n @lineitem.destroy\n\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :ok }\n end\n end", "def destroy\n @backlogitem.destroy\n respond_to do |format|\n format.html {redirect_to backlogitems_path(:project => @backlogitem.project_id), notice: 'Backlogitem was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_path }\n format.json { head :no_content }\n end\n end", "def destroy\n self.auth_admin\n @hall = Hall.where(name: @item.location)\n @item.destroy\n respond_to do |format|\n format.html { redirect_to halls_path(@hall), notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@line_item.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to line_items_url, notice: \"Req ID: #{@line_item.id} removed.\" }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def destroy\n @lunch_item.destroy\n respond_to do |format|\n format.html { redirect_to lunch_items_url, notice: 'Lunch item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @food_item.destroy\n respond_to do |format|\n format.html { redirect_to food_items_url, notice: \"Food item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_collection.destroy\n respond_to do |format|\n format.html { redirect_to item_collections_url, notice: 'La collection a été détruite' }\n format.json { head :no_content }\n end\n end", "def destroy\n @financing_item.destroy\n respond_to do |format|\n format.html { redirect_to financing_items_url, notice: 'Financing item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_unit = ItemUnit.find(params[:id])\n @item_unit.destroy\n\n respond_to do |format|\n format.html { redirect_to item_units_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @itemstable = Itemstable.find(params[:id])\n @itemstable.destroy\n\n respond_to do |format|\n format.html { redirect_to itemstables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = current_user.items.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7655816", "0.73253876", "0.73086375", "0.7104393", "0.7102174", "0.70010686", "0.69382125", "0.69306666", "0.69006467", "0.6890064", "0.68247855", "0.6793187", "0.6783173", "0.6767782", "0.6740683", "0.67321223", "0.67216706", "0.66904354", "0.6689707", "0.6678089", "0.6657087", "0.66550446", "0.6643018", "0.6631847", "0.6619385", "0.6616574", "0.6605282", "0.65840125", "0.6580984", "0.6567699", "0.6547349", "0.6547264", "0.654334", "0.65392226", "0.65385604", "0.65352285", "0.65289336", "0.65102106", "0.6509732", "0.6493275", "0.6489892", "0.6480662", "0.64641744", "0.64593226", "0.64445275", "0.6441234", "0.6441037", "0.6439507", "0.6438796", "0.643559", "0.6430328", "0.6425641", "0.6425581", "0.64179295", "0.64135104", "0.64091885", "0.6404231", "0.6404231", "0.6402497", "0.6399685", "0.6386801", "0.63842434", "0.6382406", "0.63776505", "0.63764924", "0.6375821", "0.63732785", "0.6371776", "0.63608277", "0.6358463", "0.6354798", "0.63515925", "0.6344779", "0.6341487", "0.6341487", "0.6341487", "0.6341487", "0.6341487", "0.6341487", "0.6341487", "0.6341487", "0.6341487", "0.6341487", "0.63389814", "0.63388944", "0.63382524", "0.63382524", "0.63382524", "0.63382524", "0.63382524", "0.63382524", "0.63382524", "0.63382524", "0.63382524", "0.63382524", "0.63382524", "0.63382524", "0.63382524", "0.63382524", "0.63382524" ]
0.76135737
1
Use callbacks to share common setup or constraints between actions.
def set_facility_item @facility_item = FacilityItem.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup_handler\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def action\n end", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def after_set_callback; end", "def initialize(*args)\n super\n @action = :set\nend", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def around_hooks; end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def setup(&blk)\n @setup_block = blk\n end", "def default_action; end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def call\n setup_context\n super\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.61637366", "0.60446453", "0.59452957", "0.591511", "0.58885515", "0.5834122", "0.57761765", "0.5702554", "0.5702554", "0.5652102", "0.5619581", "0.5423898", "0.5409782", "0.5409782", "0.5409782", "0.5394745", "0.53780794", "0.5356209", "0.5338898", "0.53381324", "0.5328622", "0.5309231", "0.5296901", "0.529641", "0.5296097", "0.5258364", "0.5242683", "0.5236372", "0.5236372", "0.5236372", "0.5236372", "0.5236372", "0.52346426", "0.52320486", "0.5225926", "0.52210605", "0.52171826", "0.52138335", "0.5207914", "0.52069265", "0.5176269", "0.5174653", "0.51730466", "0.51650184", "0.5161409", "0.5156175", "0.5154185", "0.5151096", "0.5151089", "0.51452935", "0.5138662", "0.51339483", "0.5113475", "0.51132", "0.51132", "0.5108031", "0.51075375", "0.5090693", "0.50892115", "0.5081523", "0.5081454", "0.5064919", "0.50545585", "0.50531805", "0.50501585", "0.50501585", "0.50329936", "0.5024674", "0.50203156", "0.50156844", "0.50149846", "0.50011337", "0.4999346", "0.49984375", "0.4988749", "0.4988749", "0.49842322", "0.49800175", "0.4979922", "0.49791628", "0.49666047", "0.49655434", "0.49559638", "0.49557537", "0.49554902", "0.4953974", "0.49519545", "0.49449277", "0.49440357", "0.49329734", "0.49315402", "0.49261367", "0.4925912", "0.4925598", "0.4924306", "0.49202663", "0.49167567", "0.49164373", "0.4915191", "0.49145022", "0.49140996" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def facility_item_params params.require(:facility_item).permit(:facility_name, :available_quantity, :meeting_room_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
wrap values which can be nil into maybe and then match to avoid nil errors
def add(value) @sum ||= 0 match value, None >> @sum, Some.(~any) >-> int { @sum += int } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def missings_to_nil(values)\n values.collect{|v| is_missing?(v) ? nil : v}\n end", "def or_nil\n get_or_else(nil)\n end", "def maybe(*args, **opts, &block)\n extract_type_spec(*args, nullable: true) do |*predicates, type_spec:, type_rule:|\n append_macro(Macros::Maybe) do |macro|\n macro.call(*predicates, type_spec: type_spec, type_rule: type_rule, **opts, &block)\n end\n end\n end", "def maybe; end", "def detect_nulls(value = nil)\n @detect_nulls = value if !value.nil?\n @detect_nulls\n end", "def _reduce_none(val, _values, _result)\n val[0]\n end", "def replace_nil\n lambda { |val| val.nil? ? 'NULL' : val }\n end", "def _reduce_none( val, _values)\n val[0]\n end", "def _reduce_none( val, _values)\n val[0]\n end", "def maybe(f)\n ->(value) { value.nil? ? nil : f.call(value) }\n end", "def _reduce_507(val, _values, result)\n result = s(:nil) \n result\nend", "def _reduce_507(val, _values, result)\n result = s(:nil) \n result\nend", "def _reduce_507(val, _values, result)\n result = s(:nil) \n result\nend", "def _reduce_507(val, _values, result)\n result = s(:nil) \n result\nend", "def _reduce_507(val, _values, result)\n result = s(:nil) \n result\nend", "def _reduce_none(val, _values)\r\n val[0]\r\nend", "def _reduce_none(val, _values)\n val[0]\nend", "def _reduce_none(val, _values)\n val[0]\nend", "def _reduce_none(val, _values)\n val[0]\nend", "def _reduce_none(val, _values)\n val[0]\nend", "def nil_value?\n casted_value.nil?\n end", "def _reduce_444(val, _values, result)\n result = s(:nil) \n result\nend", "def _reduce_444(val, _values, result)\n result = s(:nil) \n result\nend", "def _reduce_none(val, _values, result); end", "def _reduce_none(val, _values, result); end", "def process_nil(exp)\n return \"NULL\"\n end", "def refute_nil(obj, msg = T.unsafe(nil)); end", "def allow_null\n allow = opts[ :null ]\n allow.nil? || allow\n end", "def _reduce_509(val, _values, result)\n result = s(:nil) \n result\nend", "def _reduce_509(val, _values, result)\n result = s(:nil) \n result\nend", "def _reduce_509(val, _values, result)\n result = s(:nil) \n result\nend", "def _reduce_443(val, _values, result)\n result = s(:nil) \n result\nend", "def _reduce_508(val, _values, result)\n result = s(:nil) \n result\nend", "def _reduce_508(val, _values, result)\n result = s(:nil) \n result\nend", "def _reduce_508(val, _values, result)\n result = s(:nil) \n result\nend", "def _reduce_508(val, _values, result)\n result = s(:nil) \n result\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_none(val, _values, result)\n val[0]\nend", "def _reduce_486(val, _values, result)\n result = s(:nil) \n result\nend", "def maybe so, maybe: self\n maybe\n end", "def meta_or keys, default\n keys.as_array.map(&:to_s).each do |key|\n return meta[key] unless meta[key].nil?\n end\n \n # We didn't find anything (that wasn't explicitly or implicitly `nil`)\n default\n end", "def if_nil(val, default)\n if val.nil?\n return default\n end\n return val\n end", "def _reduce_697(val, _values, result)\n result = :\"**nil\"\n\n result\nend", "def get_if_kind value, kind\n value.kind_of?(kind) && value || nil\n end", "def get_if_kind value, kind\n value.kind_of?(kind) && value || nil\n end", "def getValue(value)\n return nil if value==nil \n return value\nend", "def maybe! so, maybe: -> {}\n so.call\n end", "def maybe(value)\n append \"(?:#{sanitize value})?\"\n end", "def assert_no_nils_or_0s_in_att reclist, att \n assert_no_0_values reclist, att\n assert_no_nils reclist, att\n end", "def prefer_non_nil_variables(pins); end", "def optionalize\n without_values(nil)\n end", "def null?(record)\n type.nullable? && record[:header][:field_nulls][position]\n end", "def _reduce_485(val, _values, result)\n result = s(:nil) \n result\nend", "def assert_not_all_nils reclist, att \n values = get_values reclist, att\n log_v \" There are nils in #{reclist.first.class}'s #{att} \" if values.values.uniq == [nil]\n end", "def match(str = T.unsafe(nil)); end", "def match(str = T.unsafe(nil)); end", "def _reduce_none( val, _values, result )\r\n result\r\n end", "def parse_to_null_not_null_string(only_yes = false)\n raise MissingValueError.new(var: var) if vals.empty?\n raise TooManyValuesError.new(var: var) if vals.length > 1\n\n val = vals.first\n return \"NOT NULL\" if /^(1|yes|true)$/i.match?(val)\n return \"NULL\" if /^(0|no|false)$/i.match?(val) && !only_yes\n raise BadYesError.new(var: var, val: val) if only_yes\n\n raise BadBooleanError.new(var: var, val: val)\n end", "def _reduce_none( val, _values, result )\n result\n end", "def _reduce_none( val, _values, result )\n result\n end", "def parse_to_null_not_null_string(only_yes = false)\n raise MissingValueError.new(var: var) if vals.empty?\n raise TooManyValuesError.new(var: var) if vals.length > 1\n val = vals.first\n return \"NOT NULL\" if /^(1|yes|true)$/i.match?(val)\n return \"NULL\" if /^(0|no|false)$/i.match?(val) && !only_yes\n raise BadYesError.new(var: var, val: val) if only_yes\n raise BadBooleanError.new(var: var, val: val)\n end", "def set_null(params)\n params == \"NA\" ? \"null\" : params\n end", "def fr2r(v)\n (v.equal?(:undefined) or v == '') ? nil : v\n end", "def replace_null(value)\n return 'U' if value.nil?\n\n value\nend", "def valid_or_optional?(value)\n value.nil? ? ! required? : yield\n end", "def not_nil!(*args)\n if args.any?{|arg| arg.nil?}\n coercion_error!\n end\n args\n end", "def null_value\n match = /((\\w*) NULL)/i.match(definition)\n return true unless match\n\n match[2].downcase == 'not' ? false : true\n end", "def assert_no_nils reclist, att \n values = get_values reclist, att\n outliers = values.reject{|x,y| !y.nil? }\n log_v \" There are #{outliers.size} nils in #{reclist.first.class}'s #{att} \" if outliers.size > 0\n log_v \"Outliers: #{outliers.collect{|x,y| x}*', '}\" if outliers.size > 0 and outliers.size < 10\n end", "def empty2nil(value)\n value unless value.is_a?(String) && value.empty? && !value.nil?\n end", "def Maybe object, null_object_signature=nil\n object.nil? ? NullObject.new( null_object_signature ) : object\n end", "def func_none(hash)\n hash.none? {|key, value| value.nil?}\nend", "def maybe! so, maybe: -> { self }\n maybe.call\n end", "def nullable(entity)\n return entity unless entity[:nullable]\n\n entity.merge(nullable: nil, any_of: [{ type: 'null' }]) do |k, old, new|\n next unless k == :any_of\n\n old + new\n end\n end", "def optional?(field)\n field.type.type_sym == :union &&\n field.type.schemas.first.type_sym == :null\n end", "def netrc_nil(value = nil)\n\t\t\tif value && value != \"\"\n\t\t\t\tif value == \"nothing-here\"\n\t\t\t\t\treturn nil\n\t\t\t\telse\n\t\t\t\t\treturn value\n\t\t\t\tend\n\t\t\telse\n\t\t\t\treturn \"nothing-here\"\n\t\t\tend\n\t\tend", "def nil?\n @matches.nil?\n end", "def process_row_or_nil(row)\n # match student\n fuzzy_match = @fuzzy_student_matcher.match_from_full_name(row['Student Name (eg, Sofia Alonso Martinez)'])\n if fuzzy_match.nil?\n @invalid_student_name_count += 1\n @invalid_student_names_list << student_name\n return nil\n end\n student_id = fuzzy_match[:student_id]\n\n # match educator\n educator_id = @matcher.find_educator_id(row['Email Address'])\n\n # timestamp\n recorded_at = @matcher.parse_sheets_est_timestamp(row['Timestamp'])\n\n # flatten the rest of the fields\n {\n student_id: student_id,\n educator_id: educator_id,\n recorded_at: recorded_at,\n is_restricted: false,\n event_note_type_id: 304,\n text: flattened_note_text(row)\n }\n end", "def my_all_any_none_helper(sub_param, value)\n return value ? true : false if sub_param.nil? && !block_given?\n return sub_param.match?(value) if sub_param.class == Regexp\n return value.class <= sub_param if sub_param.is_a?(Class)\n return sub_param == value unless sub_param.nil?\n\n yield(value) ? true : false\n end", "def weed_nils\n subject.reject! { |s| s == \"\" } if subject.present?\n end", "def process_nil(exp)\n return \"Qnil\"\n end", "def values_blank?(name, values=nil)\n values ||= values_for(name)\n values.blank? || values.first.blank?\n end" ]
[ "0.5950411", "0.5765343", "0.5734313", "0.56238383", "0.5546334", "0.55024797", "0.5483861", "0.546333", "0.546333", "0.5429069", "0.53822875", "0.53822875", "0.53822875", "0.53822875", "0.53822875", "0.5369995", "0.5368835", "0.5368835", "0.5368835", "0.5368835", "0.5353917", "0.5329678", "0.5329678", "0.5328621", "0.5328621", "0.5328541", "0.5319799", "0.52950054", "0.5290779", "0.5290779", "0.5290779", "0.52875215", "0.5283352", "0.5283352", "0.5283352", "0.5283352", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.52564794", "0.5229634", "0.5217272", "0.5210214", "0.5205726", "0.5205449", "0.5204398", "0.5204398", "0.5178068", "0.51641774", "0.5132717", "0.5125897", "0.5122863", "0.51219183", "0.5116873", "0.5114224", "0.5108456", "0.5105672", "0.5105672", "0.5096349", "0.508923", "0.5068066", "0.5068066", "0.50674367", "0.5047692", "0.5047642", "0.50426525", "0.5020731", "0.5007223", "0.49960497", "0.49727193", "0.49649128", "0.49632668", "0.4963253", "0.49439517", "0.49356207", "0.49316758", "0.49250945", "0.49238575", "0.49233842", "0.49193206", "0.49115846", "0.4902634", "0.48977777" ]
0.0
-1
display popup selected date range
def show_popup @pop_up_manager = Spree::PopUpManager.find(params[:id]) if request.xhr? if @pop_up_manager.show_daily == true cookies[:active_popup] = session[:active_popup] = true else start_date = @pop_up_manager.start_date end_date = @pop_up_manager.end_date if Time.zone.now > start_date and Time.zone.now < end_date cookies[:active_popup] = session[:active_popup] = true end end render :json => :nothing else redirect_to '/' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dateselection\nend", "def select_custom_date_filter(from_date, to_date)\n date_option_custom.click\n custom_date_from.text = from_date\n custom_date_to.text = to_date\n end", "def show\n @begin_date = Date.today - 5\n @end_date = Date.today + 5\n end", "def reporthelp_start_time( form )\n return form.calendar_date_select(\n :range_start,\n {\n :embedded => false,\n :year_range => Timesheet.used_range()\n }\n )\n end", "def date_select(method, options = {})\n options[:include_blank] ||= false\n options[:start_year] ||= 1801\n options[:end_year] ||= Time.now.year\n options[:label_for] = \"#{object_name}_#{method}_1i\"\n\t\t build_shell(method, options) { super }\n end", "def report_range(start_date, end_date)\n @start_date = start_date\n @end_date = end_date\n end", "def booked_date_range\n { from: :start_date, to: :end_date }\n end", "def date_range_select_tag(name_prefix, field, options = {})\n html = []\n [:start, :end].each do |part|\n html << calendar_date_select_tag(\n \"#{name_prefix}[#{field}][#{part}]\",\n (options[name_prefix][field][part] rescue ''),\n :size => 10\n )\n end\n\n return html.join(' ~ ')\n end", "def range\n (start_date...end_date) #exclusive date range\n end", "def is_date_range_visible(from_date, to_date)\n found = false\n if (date_from.text.include? from_date) && (date_to.text.include? to_date)\n found = true\n end\n found\n end", "def date_range(pennkey = nil)\n output = Consultation::Interaction\n output = output.where(staff_pennkey: pennkey) unless pennkey.nil?\n\n [\n output.minimum(:event_date),\n output.maximum(:event_date)\n ]\n end", "def display_date_ranges(values: [], **_args)\n values = Array(values).filter_map do |value|\n gregorian_dates = roll_up_date_range_values(value[:gregorian] || [], :'date.bce')\n hijri_dates = roll_up_date_range_values(value[:hijri] || [], :'date.bh')\n\n display_date_range(gregorian_dates: gregorian_dates, hijri_dates: hijri_dates)\n end\n\n safe_join(values, '<br />'.html_safe) if values.any?\n end", "def by_date\n @page_title = \"Expenses [by Date]\"\n @expenses = @current_user.expenses.find(:all)\n\n # attempt to find expenses by a date range\n if !(params[:start].nil? and params[:finish].nil?)\n begin\n @expenses = @current_user.expenses.find(:all, :conditions => {\n :created_at => params[:start].to_date .. params[:finish].to_date\n })\n # capture invalid or nil date ranges\n rescue\n flash[:error] = \"Invalid dates in date range.\"\n @expenses = nil\n end\n end\n\n respond_to do |format|\n format.html # by_date.html.erb\n format.xml { render :xml => @expenses }\n format.iphone do # by_date.iphone.erb\n @panel_title = @page_title\n render :layout => false\n end\n end\n end", "def specified_period\n @range = [@start_date, @end_date]\n end", "def reporthelp_week_selection( form, method )\n start_or_end = ( method == :range_week_start ) ? :start : :end\n\n form.grouped_collection_select(\n method,\n get_year_array(), # Use years for groups\n :weeks, # A years's \"weeks\" method returns its week list\n :title, # Use the year 'title' for the group labels\n :id, # A week's \"id\" method returns the value for an option tag\n start_or_end, # A week's \"start\" or \"end\" method is used for the option contents\n {\n :include_blank => '-'\n }\n )\n end", "def date_range\n @date_range ||= start_at..end_at\n end", "def range_box query_params, field\n #value=[1] or value=[1,2] or value=nil\n value = value = query_params.filter_value(field) || []\n form_tag(query_params.url, :method=>:get, :class=>\"form-inline\",:style=>\"margin-left:10px\"){\n input_options = {\n :placeholder=>field_name(field),\n :class=>\"input-small datepicker\",\n :readonly=>true,\n :\"data-format\"=>\"yyyy/mm/dd\"\n }\n concat hidden_fields(query_params.filter(field).params)\n concat text_field_tag(\"f[#{field}][]\", value[0], input_options)\n concat content_tag(:span,\"-\")\n concat text_field_tag(\"f[#{field}][]\", value[1], input_options)\n concat submit_tag(t(\"act_as_admin.actions.range\"), :class=>\"btn\")\n concat link_to(t(\"act_as_admin.actions.clear\"), query_params.filter(field).url, :class=>\"btn\") unless value.blank?\n }\n end", "def semantic_date_range_tag(date_from, date_to, options = {})\n SemanticDateTimeTags::Tag::DateRange.new(date_from, date_to, options).to_html\n end", "def declare_beg_range\n\t\t@beg_range = @beg_range.to_date \n\t\t@end_range = @end_range.to_date \n\tend", "def mate_date_range\n it 'should match since and until' do\n get :show, params: { id: 'amura-assignment' }\n expect(page).to have_selector(\"input[value=\\'#{date_range}\\']\")\n end\n end", "def select_day(date, options = T.unsafe(nil), html_options = T.unsafe(nil)); end", "def dates\n start_s = start_date ? start_date.to_s : '?'\n end_s = end_date ? end_date.to_s : '?'\n \"#{start_s} to #{end_s}\"\n end", "def retrieve_date_range\n \t@all = false\n \tif params[:daily_summary][:from].nil? && params[:daily_summary][:to].nil?\n\t @free_period = false\n\t @from, @to = nil, nil\n\t if params[:daily_summary][:period_type] == '1' || (params[:daily_summary][:period_type].nil? && !params[:daily_summary][:period].nil?)\n\t case params[:daily_summary][:period].to_s\n\t when 'today'\n\t @from = @to = Date.today\n\t when 'yesterday'\n\t @from = @to = Date.yesterday\n\t when 'current_week'\n\t @from = Date.today.beginning_of_week(:sunday)\n\t @to = @from + 6\n\t when 'last_week'\n\t @from = Date.today - 7 - (Date.today.cwday - 1)%7\n\t @to = @from + 6\n\t when 'last_2_weeks'\n\t @from = Date.today - 14 - (Date.today.cwday - 1)%7\n\t @to = @from + 13\n\t when '7_days'\n\t @from = Date.today - 7\n\t @to = Date.today\n\t when 'current_month'\n\t @from = Date.civil(Date.today.year, Date.today.month, 1)\n\t @to = (@from >> 1) - 1\n\t when 'last_month'\n\t @from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t @to = (@from >> 1) - 1\n\t when '30_days'\n\t @from = Date.today - 30\n\t @to = Date.today\n\t when 'current_year'\n\t @from = Date.civil(Date.today.year, 1, 1)\n\t @to = Date.civil(Date.today.year, 12, 31)\n\t when 'all'\n\t @all = true\n\t end\n\t elsif params[:free_period] || params[:daily_summary][:period_type] == '2' || (params[:daily_summary][:period_type].nil? && (!params[:daily_summary][:date_from].nil? || !params[:daily_summary][:date_to].nil?))\n\t begin; @from = params[:daily_summary][:date_from].to_s.to_date unless params[:daily_summary][:date_from].blank?; rescue; end\n\t begin; @to = params[:daily_summary][:date_to].to_s.to_date unless params[:daily_summary][:date_to].blank?; rescue; end\n\t @free_period = true\n\t else\n\t # default\n\t end\n\n\t @from, @to = @to, @from if @from && @to && @from > @to\n\telse\n \t @from = params[:daily_summary][:from]\n \t @to = params[:daily_summary][:to]\n end\n end", "def simple_date_select(caption, options)\n month_value, day_value, year_value = object.send(options[:month]), object.send(options[:day]), object.send(options[:year])\n end_year = Time.now.year - 10\n html = @template.content_tag(\"dt\", \"#{caption}:\")\n html << @template.content_tag(\"dd\") do\n @template.select_month(month_value, :field_name => options[:month], :prefix => object_name.to_s, :include_blank => options[:include_blank]) + \"\\n\" +\n @template.select_day(day_value, :field_name => options[:day], :prefix => object_name.to_s, :include_blank => options[:include_blank]) + \"\\n\" +\n @template.select_year(year_value, :field_name => options[:year], :prefix => object_name.to_s, :start_year => end_year, :end_year => options[:start_year], :include_blank => options[:include_blank])\n end\n end", "def readings\n\tstart_date, end_date = query_user_for_date_range\nend", "def date_select_html(val)\n %(<option value=\"#{val}\" selected=\"selected\">#{val}</option>)\n end", "def date_select(method, options = T.unsafe(nil), html_options = T.unsafe(nil)); end", "def get_date_range(project_id, query_id, date_range_id)\n get \"projects/#{project_id}/queries/#{query_id}/date-range/#{date_range_id}\"\n end", "def form_partial_locals(args)\n output = super\n output[:date_options] = { \n :start_year => Time.now.year - 70,\n :default => get_date_or_today(args[:value])\n }\n return output\n end", "def display_date dt, dFlg=true\r\n ListingDataProcessor.new(self).display_date dt, dFlg\r\n end", "def form_partial_locals(args)\n output = super\n output[:date_options] = { \n :start_year => Time.now.year - 70,\n :default => get_datetime_or_today(args[:value])\n }\n return output\n end", "def range_start=( value ); @range_start = value; rationalise_dates(); end", "def show\n if @widgetStart.nil?\n @widgetStart = 1.month.ago.strftime(\"%d/%m/%Y\")\n @widgetEnd = Date.today.strftime(\"%d/%m/%Y\")\n @period = 30\n end\n end", "def enter_foundation_date(test_data)\n test_date = test_data[Org::FOUNDING_DATE.name]\n hide_notifications_bar\n enter_simple_date(foundation_date_input, test_date)\n end", "def set_work_search_blog\n @event = Event.find(params[:id]) \n @event.date_range = @event.start.to_date.to_s + \" To \"+ (@event.end.to_date - 1.day).to_s \n end", "def calendar_date_select_process_options(options)\n options, javascript_options = CalendarDateSelect.default_options.merge(options), {}\n image = options.delete(:image)\n callbacks = [:before_show, :before_close, :after_show, :after_close, :after_navigate]\n for key in [:time, :valid_date_check, :embedded, :buttons, :clear_button, :format, :year_range, :month_year, :popup, :hidden, :minute_interval] + callbacks\n javascript_options[key] = options.delete(key) if options.has_key?(key)\n end\n\n # if passing in mixed, pad it with single quotes\n javascript_options[:time] = \"'mixed'\" if javascript_options[:time].to_s==\"mixed\"\n javascript_options[:month_year] = \"'#{javascript_options[:month_year]}'\" if javascript_options[:month_year]\n\n # if we are forcing the popup, automatically set the readonly property on the input control.\n if javascript_options[:popup].to_s == \"force\"\n javascript_options[:popup] = \"'force'\"\n options[:readonly] = true\n end\n\n if (vdc=javascript_options.delete(:valid_date_check))\n if vdc.include?(\";\") || vdc.include?(\"function\")\n raise ArgumentError, \":valid_date_check function is missing a 'return' statement. Try something like: :valid_date_check => 'if (date > new(Date)) return true; else return false;'\" unless vdc.include?(\"return\");\n end\n\n vdc = \"return(#{vdc})\" unless vdc.include?(\"return\")\n vdc = \"function(date) { #{vdc} }\" unless vdc.include?(\"function\")\n javascript_options[:valid_date_check] = vdc\n end\n\n javascript_options[:popup_by] ||= \"this\" if javascript_options[:hidden]\n\n # surround any callbacks with a function, if not already done so\n for key in callbacks\n javascript_options[key] = \"function(param) { #{javascript_options[key]} }\" unless javascript_options[key].include?(\"function\") if javascript_options[key]\n end\n\n javascript_options[:year_range] = format_year_range(javascript_options[:year_range] || 10)\n [image, options, javascript_options]\n end", "def date_range\n errors.add(:start_date, 'can not be greater than end date') if start_date > end_date\n end", "def update_dates\n if params[:financial_year].present?\n # puts params.inspect\n # puts params[:financial_year].inspect\n @start_date, @end_date = FinancialYear.fetch_dates(params[:financial_year])\n render :update do |page|\n page.replace_html \"date_range_section\", :partial => \"finance_reports/filters/date_range\"\n end\n end\n end", "def input_date_range(name, from, to)\n field = field_content(name)\n id = field_id(name)\n {\n id: id,\n name: name,\n description: prop(field, 'description'),\n label: prop(field, 'label'),\n from: input_date_month_year(value_by_key(from, 'name'), value_by_key(from, 'date')),\n to: input_date_month_year(value_by_key(to, 'name'), value_by_key(to, 'date')),\n }\n end", "def select_date_filter(timeframe)\n case timeframe.downcase\n when 'today'\n date_option_today.click\n when 'yesterday'\n date_option_yesterday.click\n when 'last 7 days'\n date_option_last_seven.click\n when 'last 30 days'\n date_option_last_thirty.click\n else\n fail(ArgumentError.new(timeframe + ' was not found. use select_custom_date_filter for custom dates'))\n end\n end", "def to_range\n (@start_date..@end_date)\n end", "def set_display_range_details\n\t\t\n\t\tself.display_normal_biological_interval = ''\n\n\t\tif r = get_applicable_range\n\t\t\tif self.print_all_ranges_in_report == NO\n\t\t\t\tself.display_normal_biological_interval = r.get_normal_biological_interval\n\t\t\telse\n\t\t\t\tr.tags.each do |tag|\n\t\t\t\t\t#prefix = tag.is_normal? ? \"Normal\" : tag.name\n\t\t\t\t\tprefix = tag.is_history_tag? ? tag.name : tag.range_type\n\t\t\t\t\tself.display_normal_biological_interval += (prefix + \" : \" + tag.get_biological_interval)\n\t\t\t\t\tself.display_normal_biological_interval += \"\\n\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t## finalize order should work.\n\t\t\t## if you finalize it will run generate_receipts.\n\t\t\n\t\t\tif k = r.get_picked_tag\n\t\t\t\tself.display_count_or_grade = k.count.to_s || k.grade.to_s\n\t\t\t\tif k.is_abnormal?\n\t\t\t\t\tself.display_comments_or_inference = k.get_biological_interval + \" \" + k.inference\n\t\t\t\telse\n\t\t\t\t\tself.display_comments_or_inference = k.inference\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tself.display_comments_or_inference = DEFAULT_ABNORMAL_INFERNECE\n\t\t\tend\n\t\tend\n\tend", "def determine_date_range\n case @time_frame\n when 'week' then (@date.beginning_of_week..@date.end_of_week)\n when 'month' then (@date.beginning_of_month..@date.end_of_month)\n end\n end", "def show_date_condition\n false\n end", "def show\n @ponto = Ponto.find(params[:id])\n @range_dias = @ponto.data.at_beginning_of_month..@ponto.data.at_end_of_month\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ponto }\n end\n end", "def query_user_for_date_range\n start_date, end_date = nil\n\n # untill we have both dates\n until start_date && end_date\n puts \"\\nFirst, we need a start date:\"\n start_date = query_user_for_date\n\n puts \"\\nNext, we need an end date:\"\n end_date = query_user_for_date\n\n if !date_range_valid?(start_date, end_date)\n puts \"Let's start again!\"\n start_date = end_date = nil\n end\n end\n return start_date, end_date # retunr both values as an array\nend", "def calendar_date_select_process_options(options)\r\n calendar_options = {}\r\n callbacks = [:before_show, :before_close, :after_show, :after_close, :after_navigate]\r\n for key in [:time, :valid_date_check, :embedded, :buttons, :format, :year_range, :month_year, :popup, :hidden, :minute_interval] + callbacks\r\n calendar_options[key] = options.delete(key) if options.has_key?(key)\r\n end\r\n \r\n # if passing in mixed, pad it with single quotes\r\n calendar_options[:time] = \"'mixed'\" if calendar_options[:time].to_s==\"mixed\"\r\n calendar_options[:month_year] = \"'#{calendar_options[:month_year]}'\" if calendar_options[:month_year]\r\n \r\n # if we are forcing the popup, automatically set the readonly property on the input control.\r\n if calendar_options[:popup].to_s == \"force\"\r\n calendar_options[:popup] = \"'force'\"\r\n options[:readonly] = true \r\n end\r\n \r\n if (vdc=calendar_options.delete(:valid_date_check))\r\n if vdc.include?(\";\") || vdc.include?(\"function\")\r\n throw \":valid_date_check function is missing a 'return' statement. Try something like: :valid_date_check => 'if (date > new(Date)) return true; else return false;'\" unless vdc.include?(\"return\");\r\n end\r\n \r\n vdc = \"return(#{vdc})\" unless vdc.include?(\"return\")\r\n vdc = \"function(date) { #{vdc} }\" unless vdc.include?(\"function\")\r\n calendar_options[:valid_date_check] = vdc\r\n end\r\n \r\n calendar_options[:popup_by] ||= \"this\" if calendar_options[:hidden]\r\n \r\n # surround any callbacks with a function, if not already done so\r\n for key in callbacks\r\n calendar_options[key] = \"function(param) { #{calendar_options[key]} }\" unless calendar_options[key].include?(\"function\") if calendar_options[key]\r\n end\r\n \r\n calendar_options[:year_range] = format_year_range(calendar_options[:year_range] || 10)\r\n calendar_options\r\n end", "def reporthelp_end_time( form )\n return form.calendar_date_select(\n :range_end,\n {\n :embedded => false,\n :year_range => Timesheet.used_range()\n }\n )\n end", "def datetime_select_jp(form, method, options ={})\n options[:use_month_numbers].nil? and options[:use_month_numbers] = true\n options[:end_year] ||= (form.object.send(method) || @show_time).year + 10 \n form.datetime_select(method, options)\n end", "def list\n handle_start_and_end_date\n @heading = \"Publication Listing by Org \"\n @heading = @heading + \" for #{@year} \" if params[:start_date].blank?\n @heading = @heading + \" from #{@start_date} \" if !params[:start_date].blank?\n @heading = @heading + \" to #{@end_date}\" if !params[:end_date].blank?\n render :layout => 'printable'\n end", "def to_range\n start_date..end_date\n end", "def query_user_for_date_range\n start_date = nil\n end_date = nil\n\n puts \"\\nFirst, we need a start date.\"\n start_date = query_user_for_date\n\n puts \"\\nNext, we need an end date.\"\n end_date = query_user_for_date\n\n return start_date, end_date\nend", "def new\n if @organism.periods.any?\n @disable_start_date = true\n start_date = (@organism.periods.order(:close_date).last.close_date) +1\n # begin_year and end_year limit the select in the the view\n @begin_year = start_date.year\n @end_year = @begin_year + 2 #\n else\n @disable_start_date = false\n @begin_year = @end_year = nil\n start_date = Date.today.beginning_of_year # on propose une date d'ouverture par défaut\n end\n close_date = start_date.years_since(1)-1 # et une date de clôture probable\n @period = @organism.periods.new(:start_date=>start_date, :close_date=>close_date)\n \n end", "def default_range\n\t\t(measurements.first.date..Date.today)\n\tend", "def calendar_date_select(method, options={})\n options[:class] = \"field text icon \"\n options[:class] << (options.delete(:length) || \"medium\")\n build_shell(method, options) do\n super\n end\n end", "def query_user_for_date_range\n\tstart_date = nil\n\tend_date = nil\n\n\tuntil start_date && end_date\n\t\tputs \"\\n First, we need a start date.\"\n\t\tstart_date = query_user_for_date\n\n\t\tputs \"Next, we need an end date.\"\n\t\tend_date = query_user_for_date\n\n\t\tif !date_range_valid?(start_date, end_date)\n\t\t\tputs \"Let's try again\"\n\t\t\tstart_date = end_date = nil\n\t\tend\n\tend\n\n\treturn start_date, end_date\nend", "def reporthelp_month_selection( form, method )\n start_or_end = ( method == :range_month_start ) ? :start : :end\n\n form.grouped_collection_select(\n method,\n get_year_array(), # Use years for groups\n :months, # A years's \"months\" method returns its month list\n :title, # Use the year 'title' for the group labels\n :id, # A month's \"id\" method returns the value for an option tag\n start_or_end, # A month's \"start\" or \"end\" method is used for the option contents\n {\n :include_blank => '-'\n }\n )\n end", "def retrieve_date_range_14\n @free_period = false\n @from, @to = nil, nil\n\n if params[:period_type] == '1' || (params[:period_type].nil? && !params[:period].nil?)\n case params[:period].to_s\n when 'today'\n @from = @to = Date.today\n when 'yesterday'\n @from = @to = Date.today - 1\n when 'current_week'\n @from = Date.today - (Date.today.cwday - 1)%7\n @to = @from + 6\n when 'last_week'\n @from = Date.today - 7 - (Date.today.cwday - 1)%7\n @to = @from + 6\n when '7_days'\n @from = Date.today - 7\n @to = Date.today\n when 'current_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1)\n @to = (@from >> 1) - 1\n when 'last_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n @to = (@from >> 1) - 1\n when '30_days'\n @from = Date.today - 30\n @to = Date.today\n when 'current_year'\n @from = Date.civil(Date.today.year, 1, 1)\n @to = Date.civil(Date.today.year, 12, 31)\n end\n elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?))\n begin; @from = params[:from].to_s.to_date unless params[:from].blank?; rescue; end\n begin; @to = params[:to].to_s.to_date unless params[:to].blank?; rescue; end\n @free_period = true\n else\n # default\n end\n\n @from, @to = @to, @from if @from && @to && @from > @to\n end", "def range\n Renderer.render :partial => 'shared/price/range', :locals => { :price => single, :range => @range, :gross => format(@gross_price) }, :format => [:html]\n end", "def index\n user = User.find params[:user_id]\n @events = !params.has_key?(:show_all) ? user.event : Event.scoped\n @events = @events.between(Days.firstDay(params[:curDate]), Days.lastDay(params[:curDate])) unless\n params[:curDate].nil?\n @events = @events.opened if params[:showClosed].nil? || !params[:showClosed]\n if !params[:show_date].nil?\n date = params[:show_date].is_a?(String) ? DateTime.parse(params[:show_date]) : params[:show_date]\n date_start = date.beginning_of_day\n date_finish = date.end_of_day\n @events = @events.between(date_start, date_finish) unless params[:show_date].nil?\n end\n #puts @events[1].start unless params[:show_date].nil?\n respond_to do |format|\n format.html {render :html => @events}\n format.json {render :json => @events}\n format.xml {render :xml => @events}\n end\n end", "def showdates_with_urls\n year = Time.now.year\n showdates = Showdate.all_showdates_for_seasons(year-1, year+1)\n choices = showdates.map do |sd|\n [sd.name_and_date_with_capacity_stats, walkup_sale_path(sd)]\n end\n options_for_select(choices, walkup_sale_path(@showdate))\n end", "def reporthelp_one_selection( form, method )\n now = DateTime.now.utc\n\n if ( method == :range_one_week )\n strings = [\n apphelp_view_hint( :last_week, SavedReportsController ),\n apphelp_view_hint( :this_week, SavedReportsController ),\n apphelp_view_hint( :two_weeks_ago, SavedReportsController ),\n ]\n dates = [\n now - 1.week,\n now,\n now - 2.weeks\n ]\n objects = dates.map do | date |\n ReportWeek.new( date.year, date.cweek )\n end\n else\n strings = [\n apphelp_view_hint( :last_month, SavedReportsController ),\n apphelp_view_hint( :this_month, SavedReportsController ),\n apphelp_view_hint( :two_months_ago, SavedReportsController ),\n ]\n dates = [\n now - 1.month,\n now,\n now - 2.months\n ]\n objects = dates.map do | date |\n ReportMonth.new( date.year, date.month )\n end\n end\n\n keys = [ \"last\", \"this\", \"two\" ]\n array = strings.map.with_index do | string, index |\n o = OpenStruct.new\n o.value = keys[ index ]\n o.text = string % objects[ index ].all # The \"all\" method on a ReportWeek or ReportMonth gives its name/date in a suitable format\n o\n end\n\n form.collection_select(\n method,\n array,\n :value,\n :text,\n {\n :include_blank => '-'\n }\n )\n end", "def date_range_to_string(date_range)\n \"%s - %s\" % [date_range[0], date_range[1]] rescue nil \n end", "def filter_events\n frm.button(:name=>\"eventSubmit_doCustomdate\").click\n Calendar.new(@browser)\n end", "def display_back_start_day\n display_start_day_of_week(period)\n end", "def dpShow(rangeopt = \"\", styles = DfltPlotStyle) \n styles = \"using 1:2 \" + styles if(@timeMode) ;\n datafile = @workfile ;\n if(saveScript?())\n datafile = '-' ;\n end\n com = sprintf(\"plot %s \\\"%s\\\" %s\",rangeopt,datafile,styles) ;\n\n @hline.each{|line|\n label = line[0] ;\n value = line[1] ;\n style = (line[2].nil?) ? \"dots\" : line[2] ;\n\n com += (\", %s title '%s' with %s\" % [value.to_s, label, style]) ; \n \n }\n\n command(com) ;\n\n if(saveScript?())\n open(@workfile){|strm|\n strm.each{|line|\n @strm << line\n }\n }\n @strm << \"e\\n\" ;\n end\n end", "def change_dates start_date, finish_date\n set_dates start_date, finish_date\n\n set_calendar\n end", "def retrieve_date_range_11\n @free_period = false\n @from, @to = nil, nil\n\n if params[:period_type] == '1' || (params[:period_type].nil? && !params[:period].nil?)\n case params[:period].to_s\n when 'today'\n @from = @to = Date.today\n when 'yesterday'\n @from = @to = Date.today - 1\n when 'current_week'\n @from = Date.today - (Date.today.cwday - 1)%7\n @to = @from + 6\n when 'last_week'\n @from = Date.today - 7 - (Date.today.cwday - 1)%7\n @to = @from + 6\n when '7_days'\n @from = Date.today - 7\n @to = Date.today\n when 'current_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1)\n @to = (@from >> 1) - 1\n when 'last_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n @to = (@from >> 1) - 1\n when '30_days'\n @from = Date.today - 30\n @to = Date.today\n when 'current_year'\n @from = Date.civil(Date.today.year, 1, 1)\n @to = Date.civil(Date.today.year, 12, 31)\n end\n elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?))\n begin; @from = params[:from].to_s.to_date unless params[:from].blank?; rescue; end\n begin; @to = params[:to].to_s.to_date unless params[:to].blank?; rescue; end\n @free_period = true\n else\n # default\n end\n \n @from, @to = @to, @from if @from && @to && @from > @to\n @from ||= (TimeEntry.earilest_date_for_project(@project) || Date.today)\n @to ||= (TimeEntry.latest_date_for_project(@project) || Date.today)\n end", "def booking_range\n ary = [I18n.localize(begin_date, format: DATE_AND_TIME)]\n if same_day?(begin_date, end_date)\n ary << I18n.localize(end_date, format: '%R') # example: 09:00\n else\n ary << I18n.localize(end_date, format: DATE_AND_TIME)\n end\n ary.join ' - '\n end", "def date_range( start_date, end_date )\n d_range = []\n cur_date = start_date \n\n until cur_date == end_date\n d_range << cur_date\n cur_date = Calendar.next_day( cur_date )\n end\n \n d_range << end_date\n end", "def show\n @month = @event.start\n end", "def friendly_date_range\n sessions.first.start.month == sessions.last.start.month ?\n \"#{sessions.first.start.strftime('%B %-d')}-#{sessions.last.start.strftime('%-d, %Y')}\" :\n \"#{sessions.first.start.strftime('%B %-d')} - #{sessions.last.start.strftime('%B %-d, %Y')}\"\n end", "def date_range\n self.errors.add(:start_date, I18n.t('tournament.date_mismatch')) if start_date > end_date\n end", "def setup_range(date)\n diff = date.wday - self.class.windex(start_wday)\n @first = date - (diff + ((diff < 0) ? DAYS : 0))\n @last = @first + DAYS - 1\n end", "def open_slots_for_select(date)\n open_slots(date).map do |slot|\n [\"#{slot.starts_at.strftime('%d/%m/%Y, %H:%M ')}\", slot.starts_at]\n end\n end", "def setAvailableFrom(date)\n EnziUIUtility.wait(@driver, :id, 'Available_From__c', 60)\n @driver.find_element(:name, 'Available_From__c').click\n arr_date = date.split('-')\n year_to_select = arr_date[0]\n @driver.find_element(:class, 'year').find_elements(:tag_name, \"option\").each do |option|\n if option.text == year_to_select\n option.click\n break\n end\n end\n\n next_button = nil\n prev_button = nil\n @driver.find_elements(:tag_name, 'button').each do |button|\n if button.attribute('title') == 'Next Month'\n next_button = button\n elsif button.attribute('title') == 'Previous Month'\n prev_button = button\n end\n end\n\n hash_month = {\"January\" => 1, \"February\" => 2, \"March\" => 3, \"April\" => 4, \"May\" => 5, \"June\" => 6, \"July\" => 7, \"August\" => 8, \"September\" => 9, \"October\" => 10, \"November\" => 11, \"December\" => 12}\n month_to_select = arr_date[1].to_i\n\n while true do\n if hash_month[@driver.find_element(:id, 'month').text] == month_to_select\n break\n elsif hash_month[@driver.find_element(:id, 'month').text] > month_to_select\n prev_button.click\n else\n next_button.click\n end\n end\n\n day_to_select = arr_date[2]\n @driver.find_element(:class, 'slds-datepicker__month').find_elements(:class, 'slds-day').each do |day|\n if day.text == day_to_select then\n #submitButtonEnability = @driver.find_element(:id, \"btnSubmit\").enabled?\n #puts \"day.Id is: #{day.attribute('id')}\"\n if day.attribute('id').empty? != true then\n puts \"Day id empty?: #{day.attribute('id').empty?}\"\n day.click\n return true\n else\n #puts \"Day id empty?: #{day.attribute('id').empty?}\"\n @driver.find_element(:link, 'Close').click\n return false\n end\n end\n end\n end", "def display_time_range(from,to)\n if from || to \n \"From \" + (from ? display_in_ca_time(from) : 'beginning') + \" to \" + (to ? display_in_ca_time(to) : 'now')\n else\n \"\"\n end\n end", "def show_date_suggestions\n if @conversation.date_suggestions.blank?\n common = @conversation.initiator.date_preferences & @conversation.responder.date_preferences\n union = (@conversation.initiator.date_preferences + @conversation.responder.date_preferences).uniq\n preferred = common.present? ? common : union\n # TBD: for post-launch\n # this way of collecting date suggestions is not ideal. it gets a separate list of NUM_SUGGESTIONS for each type,\n # merges them, de-dups, and randomly samples NUM_SUGGESTIONS\n # a better way would be to just check in the db if the array elem date_types contains ANY of \"preferred\" and then order/limit in the db\n suggested = preferred.map { |type| DatePlace.date_types_contains(type)\n .order(\"RANDOM()\")\n .limit(DateSuggestion::NUM_SUGGESTIONS)\n }.flatten.uniq{ |place| place.id}.sample(DateSuggestion::NUM_SUGGESTIONS)\n @conversation.date_suggestions = suggested.map { |place|\n type_of_date = place.date_types[rand(place.date_types.size)]\n day_of_week = DateSuggestion.weekend_days(DateTime.now.in_time_zone(@current_profile.time_zone)).sample\n DateSuggestion.new(day_of_week: day_of_week, type_of_date: type_of_date, date_place_id: place.id)\n }\n end\n\n render status: 200\n end", "def date_select(field, options={}, &block)\n format_with_label(field, options.merge(:field_type => \"date\"), super(field, purge_custom_tags(options)), &block)\n end", "def show ; showdate ? showdate.show : nil ; end", "def date_range\n earliest = WorkPacket.find_earliest_by_tasks( @task_ids )\n latest = WorkPacket.find_latest_by_tasks( @task_ids )\n\n # If the earliest or latest work packet value is nil, both should be\n # nil (obviously) and this means there are no work packets for the\n # tasks. In that case we just span 'all of time' so that the user\n # can see explicitly there's no booked time. Generating a report over\n # some single day range just looks odd (user thinks \"why hasn't it\n # covered all dates\"). The hide-zero-columns option can be employed\n # to clear up the report.\n\n end_of_range = latest.nil? ? Date.current : latest.date.to_date\n start_of_range = earliest.nil? ? Date.new( Timesheet.allowed_range().min, 1, 1 ) : earliest.date.to_date\n\n return ( start_of_range..end_of_range )\n end", "def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = session[controller_name][:period_type]\n\t\tperiod = session[controller_name][:period]\n\t\tfromdate = session[controller_name][:from]\n\t\ttodate = session[controller_name][:to]\n\t\t\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t\t when 'today'\n\t\t\t\t@from = @to = Date.today\n\t\t\t when 'yesterday'\n\t\t\t\t@from = @to = Date.today - 1\n\t\t\t when 'current_week'\n\t\t\t\t@from = getStartDay(Date.today - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when 'last_week'\n\t\t\t\t@from =getStartDay(Date.today - 7 - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when '7_days'\n\t\t\t\t@from = Date.today - 7\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when 'last_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when '30_days'\n\t\t\t\t@from = Date.today - 30\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_year'\n\t\t\t\t@from = Date.civil(Date.today.year, 1, 1)\n\t\t\t\t@to = Date.civil(Date.today.year, 12, 31)\n\t end\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = fromdate.to_s.to_date unless fromdate.blank?; rescue; end\n\t\t begin; @to = todate.to_s.to_date unless todate.blank?; rescue; end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t end \n\t\t\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\tend", "def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = session[controller_name][:period_type]\n\t\tperiod = session[controller_name][:period]\n\t\tfromdate = session[controller_name][:from]\n\t\ttodate = session[controller_name][:to]\n\t\t\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t\t when 'today'\n\t\t\t\t@from = @to = Date.today\n\t\t\t when 'yesterday'\n\t\t\t\t@from = @to = Date.today - 1\n\t\t\t when 'current_week'\n\t\t\t\t@from = getStartDay(Date.today - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when 'last_week'\n\t\t\t\t@from =getStartDay(Date.today - 7 - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when '7_days'\n\t\t\t\t@from = Date.today - 7\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when 'last_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when '30_days'\n\t\t\t\t@from = Date.today - 30\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_year'\n\t\t\t\t@from = Date.civil(Date.today.year, 1, 1)\n\t\t\t\t@to = Date.civil(Date.today.year, 12, 31)\n\t end\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = fromdate.to_s.to_date unless fromdate.blank?; rescue; end\n\t\t begin; @to = todate.to_s.to_date unless todate.blank?; rescue; end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t end \n\t\t\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\tend", "def invoice_date_display\n\n end", "def show;\n @date_opened_string = \"N/A\"\n @date_closed_string = \"N/A\"\n\n if (@item.date_opened != nil)\n @date_opened_string = format('%04d', @item[:date_opened].year) + \"-\" + format('%02d', @item[:date_opened].month) + \"-\" + format('%02d', @item[:date_opened].day)\n end\n if (@item.date_closed != nil)\n @date_closed_string = format('%04d', @item[:date_closed].year) + \"-\" + format('%02d', @item[:date_closed].month) + \"-\" + format('%02d', @item[:date_closed].day)\n end\n end", "def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = session[:wkattendance][:period_type]\n\t\tperiod = session[:wkattendance][:period]\n\t\tfromdate = session[:wkattendance][:from]\n\t\ttodate = session[:wkattendance][:to]\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t when 'today'\n\t\t\t@from = @to = Date.today\n\t\t when 'yesterday'\n\t\t\t@from = @to = Date.today - 1\n\t\t when 'current_week'\n\t\t\t@from = getStartDay(Date.today - (Date.today.cwday - 1)%7)\n\t\t\t@to = Date.today #@from + 6\n\t\t when 'last_week'\n\t\t\t@from =getStartDay(Date.today - 7 - (Date.today.cwday - 1)%7)\n\t\t\t@to = @from + 6\n\t\t when '7_days'\n\t\t\t@from = Date.today - 7\n\t\t\t@to = Date.today\n\t\t when 'current_month'\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = Date.today #(@from >> 1) - 1\n\t\t when 'last_month'\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t@to = (@from >> 1) - 1\n\t\t when '30_days'\n\t\t\t@from = Date.today - 30\n\t\t\t@to = Date.today\n\t\t when 'current_year'\n\t\t\t@from = Date.civil(Date.today.year, 1, 1)\n\t\t\t@to = Date.today #Date.civil(Date.today.year, 12, 31)\n\t\t end\n\t\t#elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?))\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = fromdate.to_s.to_date unless fromdate.blank?; rescue; end\n\t\t begin; @to = todate.to_s.to_date unless todate.blank?; rescue; end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = Date.today #(@from >> 1) - 1\n\t\tend \n\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\tend", "def show\n @days_filled = days_filled\n end", "def dates_box\n strings = []\n strings << \"#{@labels[:issue_date]}\"\n strings << @document.issue_date\n strings << \"#{@labels[:due_date]}\"\n strings << @document.due_date\n strings\n end", "def enter_dissolution_date(test_data)\n test_date = test_data[Org::DISSOLUTION_DATE.name]\n hide_notifications_bar\n enter_simple_date(dissolution_date_input, test_date)\n end", "def reporthelp_start_date( report )\n if ( report.range_start_cache.class != Date )\n apphelp_view_hint( \"date_start_#{ report.range_start_cache }\" )\n else\n apphelp_date( report.range_start_cache )\n end\n end", "def retrieve_date_range\n @free_period = false\n @from, @to = nil, nil\n\n if params[:period_type] == '1' || (params[:period_type].nil? && !params[:period].nil?)\n case params[:period].to_s\n when 'today'\n @from = @to = Date.today\n when 'yesterday'\n @from = @to = Date.today - 1\n when 'current_week'\n @from = Date.today - (Date.today.cwday - 1)%7\n @to = @from + 6\n when 'last_week'\n @from = Date.today - 7 - (Date.today.cwday - 1)%7\n @to = @from + 6\n when '7_days'\n @from = Date.today - 7\n @to = Date.today\n when 'current_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1)\n @to = (@from >> 1) - 1\n when 'last_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n @to = (@from >> 1) - 1\n when '30_days'\n @from = Date.today - 30\n @to = Date.today\n when 'current_year'\n @from = Date.civil(Date.today.year, 1, 1)\n @to = Date.civil(Date.today.year, 12, 31)\n end\n elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?))\n begin; @from = params[:from].to_s.to_date unless params[:from].blank?; rescue; end\n begin; @to = params[:to].to_s.to_date unless params[:to].blank?; rescue; end\n @free_period = true\n else\n # default\n end\n \n @from, @to = @to, @from if @from && @to && @from > @to\n\n end", "def related_views_core(first, date, last)\n [first, date - 7, date - 1, date + 1, date + 7, last].map do |date|\n yield(date) if date_in_range?(first, date, last)\n end\n end", "def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = params[:period_type]\n\t\tperiod = params[:period]\n\t\tfromdate = params[:from]\n\t\ttodate = params[:to]\n\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t when 'current_month'\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t\t when 'last_month'\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t@to = (@from >> 1) - 1\n\t\t end\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = Date.civil((fromdate.to_s.to_date).year,(fromdate.to_s.to_date).month, 1) unless fromdate.blank?; rescue; end\n\t\t begin; @to = (@from >> 1) - 1 unless @from.blank?; rescue; end\n\t\t if @from.blank?\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t\t end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t\tend \n\t\t\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\t end", "def between(date_range)\n merge(between: date_range)\n end", "def between(date_range)\n merge(between: date_range)\n end", "def find_every options={}\n if(options[:invisible])\n options[:from] = \"get_days(true) days_view\"\n options[:select] = \"days_view AS scheduled_for\"\n end\n super(options)\n end", "def choose_dates\n # Not multiple dates - just return the From date.\n return [@from] unless @multiple_dates\n\n # Multiple dates - return the array, adjusted as per input\n all_days = (@from..@to).to_a\n\n case @select\n when 'days'\n days = @dates.gsub(/\\s/, '').split(',')\n all_days.select { |date| days.include?(date.mday.to_s) }\n when 'specific_days'\n days = @specific_dates.gsub(/\\s/, '').split(',')\n days.map(&:to_date)\n when 'weekdays'\n raise DateChooserException, 'No days of the week selected' if @weekdays.weekdays.empty?\n raise DateChooserException, 'No weekly interval selected' if @interval&.empty?\n\n all_days.select do |date|\n next unless @weekdays.has_day?(date.wday)\n\n case @interval[:unit]\n when 'week'\n # 0 = first week, 1 = second week, 2 = third week, etc.\n nth_week = (date - @from).to_i / 7\n # true every 2nd week (0, 2, 4, 6, etc.)\n (nth_week % @interval[:level].to_i).zero?\n when 'week_of_month'\n week = @interval[:level].to_i\n (date.mday > (week - 1) * 7 && date.mday <= week * 7)\n end\n end\n else\n all_days\n end\n end", "def dates\n end", "def show\n\tredirect_to new_availability_calendar_path\n end", "def enter_date_requested(test_data)\n hide_notifications_bar\n wait_for_element_and_type(date_requested_input, test_data[UseOfCollections::DATE_REQUESTED.name])\n hit_enter\n end", "def choose_dates\n authorize! :choose_dates, :Reservation\n\n if(session[:rental_category_id].nil?)\n redirect_to shopping_path\n end\n\n @start_date = Date.today.next_month.beginning_of_month\n\n # pick_up_dates is the first full week of next month starting from the first weekday\n @pick_up_start_date = @start_date\n @pick_up_start_date += 1.days until @pick_up_start_date.wday == 1 # wday 1 is monday, etc.\n @pick_up_dates = @pick_up_start_date..(@pick_up_start_date + 5.days)\n\n # return_dates is the last full week of next month ending on the last weekday\n @return_end_date = Date.today.next_month.end_of_month\n @return_end_date -= 1.days until @return_end_date.wday == 1 # wday 1 is monday, etc.\n @return_dates = (@return_end_date)..(@return_end_date + 5.days)\n @end_date = @return_dates.last\n end" ]
[ "0.6623924", "0.63970107", "0.6284262", "0.6208174", "0.6147926", "0.6049865", "0.5903949", "0.58392566", "0.5820125", "0.581356", "0.58009446", "0.57831097", "0.5773008", "0.57005906", "0.5687396", "0.56592786", "0.56587034", "0.5617456", "0.5566251", "0.5555173", "0.5551245", "0.55452526", "0.55260944", "0.5517326", "0.5515751", "0.5501428", "0.55003256", "0.54872316", "0.54869306", "0.5482305", "0.54801977", "0.5478231", "0.5477638", "0.5464185", "0.5462756", "0.54606014", "0.54495764", "0.54479873", "0.54398745", "0.5438133", "0.5435369", "0.5433763", "0.5430325", "0.5424513", "0.5422907", "0.54213184", "0.5417678", "0.54102707", "0.53984976", "0.53848743", "0.53728145", "0.5358271", "0.5356777", "0.5347923", "0.53328395", "0.5330862", "0.53242975", "0.53188854", "0.5318677", "0.53165954", "0.5305915", "0.52950466", "0.52932364", "0.5288243", "0.5285076", "0.52809167", "0.52788126", "0.52700084", "0.526773", "0.52649486", "0.52525705", "0.52521724", "0.52492905", "0.5245677", "0.5241533", "0.5239891", "0.5239736", "0.52335614", "0.5215008", "0.5214399", "0.5210004", "0.52068895", "0.52068895", "0.5201426", "0.5201248", "0.51994324", "0.51969266", "0.51914936", "0.5189049", "0.51827544", "0.5181378", "0.5177369", "0.51695114", "0.5165813", "0.5165813", "0.51635635", "0.5163284", "0.5163222", "0.5155417", "0.5154656", "0.51546127" ]
0.0
-1
puts "this is a debug message"
def solution(a) return 0 if a.uniq.size != a.size max = a.size sum = (1 + max) * max / 2 array_sum = a.inject(0, &:+) sum == array_sum ? 1 : 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug(msg)\n #puts msg\n end", "def debug(s)\n\t#puts \"DEBUG: #{s}\"\nend", "def print_debug(msg)\n puts msg if (@debug) \n STDOUT.flush\n end", "def debug(message)\n puts message if debug?\n end", "def debug(s) if $DEBUG then $stderr.print(\"#{s}\\n\") end end", "def debug_msg( str )\n puts str if @debug == true\n end", "def debug string\n puts string if $DEBUG\nend", "def debug(text)\n\t\t\tputs text\n\t\t\tnil\n\t\tend", "def debug(msg)\n $stderr.puts(\"DEBUG: #{msg}\") if $options['verbose']\nend", "def debug(msg)\n $stderr.puts(\"DEBUG: #{msg}\") if $options['verbose']\nend", "def debug(msg)\n $stderr.puts(\"DEBUG: #{msg}\") if $options['verbose']\nend", "def debug(message)\n $stderr.puts(message) if @options[:debug]\nend", "def debug(msg = \"\")\n puts \"\\n\\n\\n\"\n puts \" DEBUGGING \".white.on_red\n puts msg\n puts \"\\n\\n\\n\"\n exit\n end", "def dprint(s)\n print s if $DEBUG\nend", "def debug_msg msg\n puts msg if @options[:debug]\n end", "def puts_debug(msg)\r\n if (self.debug) \r\n puts msg\r\n end # end debug\r\n end", "def puts_debug(msg)\r\n if (self.debug) \r\n puts msg\r\n end # end debug\r\n end", "def debug(msg)\n STDERR.puts msg if @debug\n end", "def debug(message)\n puts \"#{Time.now.strftime(\"%H:%M:%S.%L\")} - \\t#{message}\" if DEBUG\nend", "def debug1(text) debug text, 1 end", "def say(word)\n require 'debug'\n puts word + ' to begin debugging.'\nend", "def debug(stuff)\n puts \"DEBUG: #{stuff}\"\nend", "def print_debug(s)\n config = BeEF::Core::Configuration.instance\n if config.get('beef.debug') || BeEF::Core::Console::CommandLine.parse[:verbose]\n puts Time.now.localtime.strftime(\"[%k:%M:%S]\")+'[>]'.yellow+' '+s.to_s\n end\nend", "def debug_msg(msg=\"\")\n if(@config.debug)\n puts(\"Debug: #{msg}\")\n @file.puts(\"Debug: #{msg}\")\n end\n end", "def debug(message)\n $stdout.puts \"D #{message}\" if @debug\n end", "def debug(message)\n stdout.print(\"#{message}\\n\") if ENV['DEBUG']\n end", "def debug(str)\n $stderr.puts(str) if @debug\n end", "def debug_msg(msg)\n if(@options[:debug])\n @log.puts(msg)\n puts msg\n end\nend", "def say_debug(message)\n puts yellow(message) if self.debug\n end", "def puts(*strs); $stdout.puts(*strs) if ENV['DEBUG'] end", "def debug_log( arg )\r\n print('DEBUG: ')\r\n puts (arg)\r\nend", "def log(s)\n puts \"[Debug]: #{s}\"\nend", "def log(s)\n puts \"[Debug]: #{s}\"\nend", "def debug(msg)\n STDERR.puts msg if options.key? :debug\n end", "def output_debug(string)\n if Command.ui\n Command.ui.debug string\n else\n $stderr.puts \"DEBUG: #{string}\"\n end\n end", "def dputs str=\"\"\n\t\tputs str if debug?\n\tend", "def debug(message)\n ostream.puts message if $DEBUG\n end", "def debug (msg = \"\")\n if Object.const_defined?('Puppet')\n Puppet.debug msg\n else\n if ENV['FACTER_DEBUG'] == 'true'\n $stdout.puts msg\n $stdout.flush\n end\n end\nend", "def dprint(str)\n if ANSIBLE_DEBUG\n print str\n end\nend", "def debug(message)\n logger.debug(PROG_NAME) { message }\n end", "def debug_msg( *msg )\n\t\treturn unless $DEBUG\n\t\t$stderr.puts( *msg )\n\tend", "def debug_msg( *msg )\n\t\treturn unless $DEBUG\n\t\t$stderr.puts( *msg )\n\tend", "def debug(*args); puts(*args) if $test; end", "def debug(message) ; @log.debug(message) ; end", "def debug(info)\n puts(info) if @debug\n end", "def debug(message)\n return if quiet?\n say('[DEBUG] ' + message, :yellow) if $DEBUG\n end", "def debug(msg)\n puts \"[watchr debug] #{msg}\" if options.debug\n end", "def debugMsg( msg )\n\treturn unless $DEBUG\n\t$stderr.print \"#{msg}\\n\"\nend", "def dmsg(msg)\n if $DEBUG\n case msg\n when String\n puts msg\n else\n puts msg.inspect\n end\n end\n end", "def dmsg(msg)\n if $DEBUG\n case msg\n when String\n puts msg\n else\n puts msg.inspect\n end\n end\n end", "def dmsg(msg)\n if $DEBUG\n case msg\n when String\n puts msg\n else\n puts msg.inspect\n end\n end\n end", "def debug(msg) log(7, msg); end", "def dputs(message)\n puts message\nend", "def debug; end", "def debug; end", "def debug; end", "def debug; end", "def debug (what)\n ap what\n exit 2\nend", "def dbg(msg, msgLevel = 1)\n\tif $options['debug'] >= msgLevel then\n\t\tputs \"#{msg}\"\n\tend\nend", "def dbg(msg, msgLevel = 1)\n\tif $options['debug'] >= msgLevel then\n\t\tputs \"#{msg}\"\n\tend\nend", "def debug(message)\n if DEBUG\n log message\n end\nend", "def debug(msg)\n end", "def puts_debug(*print_string)\n debug_code = true\n puts *print_string if debug_code\n end", "def debug_out(debmsg)\n if $gDebug \n puts debmsg\n end\n if ($gTest_params[\"logfile\"])\n $fLOG.write(debmsg)\n end\nend", "def debug(message)\n log(0, message)\n end", "def debug_out(debmsg)\n if $gDebug\n puts debmsg\n end\n if ($gTest_params[\"logfile\"])\n $fLOG.write(debmsg)\n end\nend", "def debug (msg = \"\")\n if Object.const_defined?('Puppet')\n Puppet.debug 'facter(extra_modulepath):'+msg\n else\n if ENV['FACTER_DEBUG'] == 'true'\n $stdout.puts msg\n $stdout.flush\n end\n end\nend", "def debug!\n @client.debug_dev = STDOUT\n end", "def debug(message)\n warn \"==== VLO DEBUG: \" + message if ENV[\"VLO_DEBUG\"] == 'true'\nend", "def debug(text)\n puts \"#{text}\".foreground(:yellow)\n end", "def debug_puts(puts_text)\n if Debug_Mode == true\n puts \"#{puts_text}\"\n end\n end", "def debug(message = nil, progname = nil, &block)\n add(DEBUG, message, progname, &block)\n end", "def debug( msg )\n puts Time.now.strftime(\"- %I:%M%p: \") + msg if @debug\nend", "def debug(d)\n ap d\n puts\n exit 2\nend", "def debug(msg)\n log.debug msg\n end", "def debug(*args); end", "def debug(*args); end", "def debug(*args); end", "def INFO(msg)\n if DEBUG\n puts \"INFO: \" + msg\n end\nend", "def debug(*info)\n puts(info) if debug_mode?\n end", "def debug_print(output, debug)\n\tif debug\n\t\tputs \"[*] #{output}\".red\n\tend\nend", "def debug(*text)\n if configuration.debug\n channel.write(\"command\" => \"debug\", \"text\" => text.join, \"on\" => on)\n end\n end", "def debug(str, ret = false)\r\n puts str if @debug\r\n return ret\r\n end", "def debug(message = \"\", level = 5)\n if $config[:global][:verboselevel] and $config[:global][:verboselevel] >= level\n puts message \n\t\t#logger.info(message)\n Syslog.info(message)\n end\nend", "def debug_print(returnedData, debug=\"false\")\n if debug == \"true\" then\n puts \"\\r\\n[DEBUG]\\r\\n\"\n pp(returnedData) \n end\nend", "def debug(msg)\n return unless Fizzy::CFG.debug\n caller_info = caller\n .map { |c| c[/`.*'/][1..-2].split(\" \").first }\n .uniq[0..2]\n .join(\" → \")\n tell \"{m{⚫}}#{✏ caller_info, %w({b{<}} {b{>}})}{w{: #{msg}}}\"\n end", "def debug(msg=nil)\n log \"DEBUG: #{msg}\" if $debug\n end", "def debug_message(message)\n logger.debug \"**** - #{message}\"\n end", "def debug(msg); @logger.debug(msg); end", "def debug(msg, &block)\n result = yield\n puts \"-- #{msg} #{'-' * (74 - msg.length)}\" if $debug\n result\n end", "def debug(msg) #:doc:\r\n if have_hook?(:on_debug)\r\n sync { self.class.debug msg }\r\n end\r\n end", "def debug( msg )\n puts Time.now.strftime(\"- %I:%M%p: \") + msg\nend", "def debug(msg, thread = nil)\n return nil unless $opt[:debug]\n function = (thread ? \"#{thread}.\" : '') + \\\n (caller[0][/`.*'/] ? caller[0][/`.*'/][1..-2].split(' ').last : 'core');\n puts \"#{function}#{(function.split(/\\.([^.]*)$/).last == 'core' ? '' : '()')}: #{msg}\".white\nend", "def debug(msg) log(DEBUG, \"DEBUG \" << format(msg) << \", \" << caller[0][caller[0].rindex(\"/\").nil? ? 0 : caller[0].rindex(\"/\") + 1 .. -1]); end", "def debug message; write DEBUG, message, caller[0] unless level > @level end", "def debug(*args)\n $stderr.puts(sprintf(*args)) if @debug\n end", "def debug(message)\n Edurange.logger.debug message\n end", "def debug()\n # =========================================\n # DEBUG CODE FOR STEPPING\n # =========================================\n puts \"Curr char is: #{@curr_char}\"\n puts \"PC direction is: #{@curr_direction}\"\n puts \"Stack contents are: #{@stack}\"\n puts \"Skip is: #{@skip}\"\n puts \"Ascii_Mode is: #{@ascii_mode}\"\n prompt()\n STDIN.gets\n\n # =========================================\n # END DEBUG CODE\n # =========================================\n\n end", "def write_debug( f )\n f.puts( $debug_buf )\n $debug_buf = \"\"\nend", "def log_debug(message)\n Rails.logger.debug message\n puts message\n end", "def debug?; end" ]
[ "0.8404423", "0.8266837", "0.82102925", "0.8136153", "0.8106155", "0.8065727", "0.8002759", "0.79972893", "0.7974082", "0.7974082", "0.7974082", "0.792677", "0.7856124", "0.78472453", "0.78355575", "0.7820573", "0.7820573", "0.77906436", "0.77715087", "0.7740855", "0.7739872", "0.77374077", "0.77113837", "0.7704893", "0.77004313", "0.76719147", "0.7640076", "0.7634102", "0.7610972", "0.7609202", "0.7595496", "0.75672543", "0.75672543", "0.75609607", "0.7560808", "0.7530788", "0.7512849", "0.74853426", "0.74465185", "0.7396133", "0.7390704", "0.7390704", "0.7388477", "0.73843104", "0.7376328", "0.7367725", "0.73444676", "0.73145723", "0.7306631", "0.7306631", "0.7306631", "0.72817266", "0.72583324", "0.72482795", "0.72482795", "0.72482795", "0.72482795", "0.72167844", "0.72145206", "0.72145206", "0.721108", "0.7195207", "0.7160283", "0.7155036", "0.7146374", "0.7126931", "0.7124279", "0.7104398", "0.7093438", "0.709274", "0.7091287", "0.70889246", "0.7088084", "0.70787615", "0.70712686", "0.70641345", "0.70641345", "0.70641345", "0.70516086", "0.703287", "0.70019", "0.7001543", "0.6996923", "0.6987162", "0.695505", "0.69481385", "0.6947167", "0.6933798", "0.6929701", "0.6928567", "0.6918319", "0.691687", "0.6912733", "0.69096226", "0.6908143", "0.6899511", "0.6891499", "0.68756604", "0.68716055", "0.6861551", "0.68388236" ]
0.0
-1
Initialize the request to api, should be used in children classes only
def call(*, &blk) socket.print "#{format(self.class.const_get(:TEMPLATE), combined_options)}\r\n" pull_socket(&blk) return result_accumulator unless block_given? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize base_url, api_key\n\t\t\t\t\t@connection = Freshdesk::Api::Client::Request.new base_url, api_key\n\t\t\t\tend", "def initialize\n @api_user = \"\"\n @api_key = \"\"\n end", "def post_init\n @request = Request.new\n @response = Response.new\n end", "def initialize(api_key, api_url = 'https://api.telerivet.com/v1')\n @api_key = api_key\n @api_url = api_url\n @num_requests = 0\n @session = nil\n end", "def initialize(api_url)\n\t\turi = URI(api_url)\n\t\tcall_api(uri)\n\tend", "def initialize(request)\n @request = request\n end", "def initialize(api_obj)\n @api_obj = api_obj\n end", "def initialize(api)\n @api = api\n end", "def initialize(params={})\r\n # Initiate a new request object with given query params.\r\n #\r\n # Each request must have at least one searchable parameter, meaning\r\n # a name (at least first and last name), email, phone or username.\r\n # Multiple query params are possible (for example querying by both email\r\n # and phone of the person).\r\n #\r\n # Args:\r\n #\r\n # api_key -- str, a valid API key (use \"samplekey\" for experimenting).\r\n # Note that you can set a default API key\r\n # (PiplApi::SearchApi.default_api_key = '<your_key>') instead of\r\n # passing it to each request object.\r\n # first_name -- unicode, minimum 2 chars.\r\n # middle_name -- unicode.\r\n # last_name -- unicode, minimum 2 chars.\r\n # raw_name -- unicode, an unparsed name containing at least a first name\r\n # and a last name.\r\n # email -- unicode.\r\n # phone -- int/long. If a unicode/str is passed instead then it'll be\r\n # striped from all non-digit characters and converted to int.\r\n # IMPORTANT: Currently only US/Canada phones can be searched by\r\n # so country code is assumed to be 1, phones with different\r\n # country codes are considered invalid and will be ignored.\r\n # username -- unicode, minimum 4 chars.\r\n # country -- unicode, a 2 letter country code from:\r\n # http://en.wikipedia.org/wiki/ISO_3166-2\r\n # state -- unicode, a state code from:\r\n # http://en.wikipedia.org/wiki/ISO_3166-2%3AUS\r\n # http://en.wikipedia.org/wiki/ISO_3166-2%3ACA\r\n # city -- unicode.\r\n # raw_address -- unicode, an unparsed address.\r\n # from_age -- int.\r\n # to_age -- int.\r\n # person -- A PiplApi::Person object (available at containers.rb).\r\n # The person can contain every field allowed by the data-model\r\n # (fields.rb) and can hold multiple fields of\r\n # the same type (for example: two emails, three addresses etc.)\r\n # query_params_mode -- str, one of \"and\"/\"or\" (default \"and\").\r\n # Advanced parameter, use only if you care about the\r\n # value of record.query_params_match in the response\r\n # records.\r\n # Each record in the response has an attribute\r\n # \"query_params_match\" which indicates whether the\r\n # record has the all fields from the query or not.\r\n # When set to \"and\" all query params are required in\r\n # order to get query_params_match=True, when set to\r\n # \"or\" it's enough that the record has at least one\r\n # of each field type (so if you search with a name\r\n # and two addresses, a record with the name and one\r\n # of the addresses will have query_params_match=true)\r\n # exact_name -- bool (default false).\r\n # If set to True the names in the query will be matched\r\n # \"as is\" without compensating for nicknames or multiple\r\n # family names. For example \"Jane Brown-Smith\" won't return\r\n # results for \"Jane Brown\" in the same way \"Alexandra Pitt\"\r\n # won't return results for \"Alex Pitt\".\r\n #\r\n # Each of the arguments that should have a unicode value accepts both\r\n # unicode objects and utf8 encoded str (will be decoded automatically).\r\n\r\n fparams = { :query_params_mode => 'and', :exact_name => false }.merge(params)\r\n\r\n if not(fparams[:person].nil?)\r\n person = fparams[:person]\r\n else\r\n person = PiplApi::Person.new()\r\n end\r\n\r\n if fparams[:first_name] || fparams[:middle_name] || fparams[:last_name]\r\n name = Name.new({:first=>fparams[:first_name], :middle=>fparams[:middle_name], :last=>fparams[:last_name]})\r\n person.add_fields([name])\r\n end\r\n\r\n person.add_fields([PiplApi::Name.new({:raw=>fparams[:raw_name]})]) unless fparams[:raw_name].nil?\r\n person.add_fields([PiplApi::Email.new({:address=>fparams[:email]})]) unless fparams[:email].nil?\r\n\r\n if not(fparams[:phone].nil?)\r\n if fparams[:phone].is_a?(String)\r\n person.add_fields([PiplApi::Phone.from_text(fparams[:phone])])\r\n else\r\n person.add_fields([PiplApi::Phone.new({:number=>fparams[:phone]})])\r\n end\r\n end\r\n\r\n person.add_fields([PiplApi::Username.new({:content=>fparams[:username]})]) unless fparams[:username].nil?\r\n\r\n if fparams[:country] || fparams[:state] || fparams[:city]\r\n address = PiplApi::Address.new({:country=>fparams[:country], :state=>fparams[:state], :city=>fparams[:city]})\r\n person.add_fields([address])\r\n end\r\n\r\n person.add_fields([PiplApi::Address.new({:raw=>fparams[:raw_address]})]) unless fparams[:raw_address].nil?\r\n\r\n if fparams[:from_age] || fparams[:to_age]\r\n dob = PiplApi::DOB.from_age_range(fparams[:from_age] || 0, fparams[:to_age] || 1000)\r\n person.add_fields([dob])\r\n end\r\n\r\n @api_key = fparams[:api_key]\r\n @person = person\r\n @query_params_mode = fparams[:query_params_mode]\r\n @exact_name = fparams[:exact_name]\r\n @_filter_records_by = []\r\n @_prioritize_records_by = []\r\n end", "def initialize\n begin\n @api_methods = Api_methods\n @api_version = Api_version\n rescue StandardError => e\n $log.error(sprintf(\"%s: %s\", __method__, e.message))\n raise\n end\n end", "def set_request; end", "def initialize(options)\n initialize_options(options)\n initialize_headers\n http_request\n end", "def initialize\n self.api_root = BASE_URL\n end", "def initialize(key, proxy = nil)\n\n ##\n # Setting initial options for the request\n\n @options = {\n user: key,\n password: \"\",\n method: :post,\n url: \"#{API_URL}/#{@type}\",\n ssl_ca_file: File.dirname(__FILE__) + '/../data/cacert.pem'\n }\n\n @proxy = proxy\n\n ##\n # Request data, which will be sent do API server\n\n @data = {}\n end", "def initialize(request, response, body = nil)\n @request = request\n @response = response\n @body = body\n end", "def initialize\n super()\n @params = {}\n end", "def initialize(apikey='f47a72ab00afe64aab78b9919ee3d427')\n\t\t@api_key = apikey\n\t\t@headers = {\"Accept\" => \"application/JSON\", \"user-key\" => @api_key}\n\t\t@base_uri = \"https://developers.zomato.com/api/v2.1/\"\n\tend", "def initialize(request, response)\n @request = request\n @response = response\n end", "def initialize(options={})\n @api_key = options[:api_key] || config.api_key\n @path = options[:path]\n @params = options[:params]\n @http_request_options = options[:http_request_options] || {}\n end", "def initialize(initial_params = {})\n raise \"Cannot directly instantiate a #{self.class}.\" if\n self.class == Request\n @params = initial_params\n end", "def initialize( api_key )\n @api_key = api_key\n @cached_requests = {}\n end", "def initialize(attributes = {})\n super\n self.api_endpoint ||= Orias.configuration.api_endpoint\n self.per_request ||= Orias.configuration.per_request\n self.private_key ||= Orias.configuration.private_key\n end", "def initialize(api_key)\n @api_key = api_key \n end", "def initialize(base_url: BASE_URL, api_version: API_VERSION, api_key: API_KEY)\n @base_url = base_url\n @api_version = api_version\n @api_key = api_key\n end", "def initialize(params)\n\n fail 'missing API Base URL' if params[:api_base_url].nil?\n fail 'missing API Key' if params[:api_key].nil?\n fail 'missing API Secret' if params[:api_secret].nil?\n\n params[:api_base_url] = params[:api_base_url].gsub(/\\/$/, '') # remove trailing slash\n params[:api_spec] = false if params[:api_spec].nil?\n\n set_manifest(params)\n\n end", "def initialize(model, request)\n @model = model\n @request = request\n end", "def initialize(api_key = nil)\n @api_key = api_key\n @api_key ||= Songkickr.api_key\n \n self.class.default_params :apikey => @api_key\n end", "def initialize\n @format = 'json'\n @scheme = 'https'\n @host = 'api.taxamo.com'\n @base_path = ''\n @user_agent = \"ruby-swagger\"\n @inject_format = true\n @force_ending_format = false\n @camelize_params = false\n end", "def initialize(attrs, api_params, headers = {})\n # Check API parameters hash\n raise \"API parameters must be Hash\" unless api_params.kind_of? Hash\n ['server', 'port', 'path'].each do |param_name|\n unless api_params[param_name]\n raise \"'#{param_name}' is not defined in API parameters hash\"\n end\n end\n\n @server = api_params['server']\n @port = api_params['port']\n \n @headers = if headers.kind_of? Hash\n { 'Connection' => 'close' }.merge!(headers)\n else\n { 'Connection' => 'close' }\n end\n \n super attrs.merge({ 'api_url' => make_api_url(api_params) })\n end", "def initialize(options = {})\n @options = options\n @request_options = {}\n end", "def initialize(api_key)\n @api_key = api_key\n self.class.headers({\n \"X-API-Key\" => @api_key,\n \"Accept\" => \"application/json\"\n })\n end", "def initialize_connection\n self.send(Response.new(action: 'init'))\n end", "def setup_request\n return Typhoeus::Request.new(\n endpoint_url,\n method: @method,\n params: @params,\n body: @body,\n headers: @headers)\n end", "def initialize(request:, response: nil)\n @request = request\n @response = response\n end", "def initialize(*args)\n @body = nil\n @headers = {}\n @http_version = '1.1'\n\n super\n end", "def request_setup()\n Proc.new do |request|\n request.headers[:authorization] = basic_auth_header\n request.headers[:content_type] = 'application/json; charset=UTF-8'\n request.headers[:accept] = 'application/json; charset=UTF-8'\n end\n end", "def initialize( api_key )\n @api_key = api_key\n end", "def initialize (api_key)\n\t\t@params = {\n\t\t\t\"key\" => api_key,\n\t\t\t\"wrapper\" => \"cleverbotrb\"\n\t\t}\n\t\t@endpoint = ENDPOINT\n\tend", "def initialize(api_key)\n @options = { headers: { 'Authorization' => \"token #{api_key}\" } }\n end", "def initialize(api_key)\n @api_key = api_key\n end", "def initialize\n @url = 'http://api.preachingcentral.com/'\n end", "def initialize(server, api_version, api_key)\n self.class.base_uri \"http://#{server}/api/#{api_version}\"\n self.class.headers 'Accept' => 'application/json', \"X-CCApiKey\" => api_key\n end", "def initialize\n @format = 'json'\n @scheme = 'https'\n @host = 'api.simplyrets.com'\n @base_path = '/'\n @user_agent = \"ruby-#{SimplyRets::VERSION}\"\n @inject_format = false\n @force_ending_format = false\n @camelize_params = true\n end", "def initialize(body: \"\", debug: false, headers: {}, request:)\n @body = body\n @debug = debug\n @headers = headers\n @request = request\n @requested_url = request.path\n end", "def initialize(api_method = 'getallusers')\n Imified.validate_configuration!\n super(URL.path)\n\n self.basic_auth Imified.email_address, Imified.password\n self.add_field 'apimethod', api_method\n self.add_field 'botkey', Imified.botkey\n end", "def initialize(response, request)\n @response = response\n @request = request\n end", "def initialize(api_key:)\n @api_key = api_key\n end", "def initialize\n @params = {}\n end", "def initialize(request, params)\n @request = request\n @params = params\n end", "def initialize api_key, api_secret\n @api_key = api_key\n @api_secret = api_secret\n end", "def initialize(request_info)\n @action = request_info[:action]\n @path = request_info[:path]\n @metadata = request_info[:metadata]\n @params = request_info[:params]\n @request = request_info[:request]\n\n # publishing actions\n @users_to_notify = []\n\n @response = nil\n end", "def initialize\n @response_format = 'json'\n @scheme = 'http'\n @host = 'api.wordnik.com'\n @hosts = []\n @load_balancer = nil\n @base_path = '/v4'\n @user_agent = \"ruby-#{Wordnik::VERSION}\"\n # Build the default set of resource names from the filenames of the API documentation\n begin\n api_docs_path = File.join(File.dirname(__FILE__), '../../api_docs')\n @resource_names = Dir.glob(File.join(api_docs_path, '*.json')).map {|f| f.split('/').last.sub('.json', '') }.sort\n true\n rescue\n raise 'Problem loading the resource files in ./api_docs/'\n end\n end", "def initialize()\n\t\t@url = \"http://lcboapi.com/products\"\n\t\t@id = 0\n\t\t@term = \"\"\n\t\t@result = []\n\t\t@single = {}\n\tend", "def initialize(api_key)\n @api_key = api_key\n end", "def initialize(api_key)\n @api_key = api_key\n end", "def initialize(api_key)\n @api_key = api_key\n end", "def initialize(base_url,model_data)\n @base_url = base_url\n @model_data = model_data\n\n\n unless @requester_id = model_data[REQUESTER_ID]\n raise ArgumentError, \"Cannot create a #{self.class} without a requester_id\"\n end\n\n @authz_client = AuthzClient.new(resource, @requester_id, base_url)\n @id = model_data[OBJECT_ID]\n end", "def request\n @request ||= Request.new(::Minfraud::HTTPService.configuration)\n end", "def initialize(request, **_options)\n @request = request\n @params = request.query_parameters\n end", "def initialize\n @action = :get\n @headers = {}\n @timeout = 0\n @connect_timeout = 0\n @max_redirects = -1\n end", "def initialize(msg, api_response = nil)\n super(msg)\n\n # Automatically use included response object if possible\n @api_response = api_response.respond_to?(:response) ? api_response.response : api_response\n\n # Parse response and set instance vars\n parse_response unless @api_response.nil?\n end", "def initialize(api, conditions = {}, data = nil)\n super(api, conditions, data)\n end", "def initialize(api_key = Payable.api_key, path = Payable.current_rest_api_path, timeout = API_TIMEOUT, company_id = Payable.company_id)\n raise(\"api_key must be a non-empty string\") if !api_key.is_a?(String) || api_key.empty?\n raise(\"path must be a non-empty string\") if !path.is_a?(String) || path.empty?\n @api_key = api_key\n @path = path\n @timeout = timeout\n @company_id = company_id\n end", "def initialize(request_adapter)\n super(Hash.new, request_adapter, \"{+baseurl}\")\n MicrosoftKiotaAbstractions::ApiClientBuilder.register_default_serializer(MicrosoftKiotaSerializationJson::JsonSerializationWriterFactory)\n MicrosoftKiotaAbstractions::ApiClientBuilder.register_default_deserializer(MicrosoftKiotaSerializationJson::JsonParseNodeFactory)\n if @request_adapter.get_base_url.nil? || @request_adapter.get_base_url.empty?\n @request_adapter.set_base_url('https://graph.microsoft.com/v1.0')\n end\n @path_parameters['baseurl'] = @request_adapter.get_base_url\n end", "def initialize(api, location, from_data = nil)\n @api = api\n @location = location\n\n update(from_data)\n end", "def initialize(params)\n @api = params.fetch(:api)\n @id = params.fetch(:id)\n @date = params.fetch(:date)\n end", "def initialize(env)\n @env = env\n @request = ActionDispatch::Request.new(env)\n end", "def initialize\n raise NotImplementedError, 'need to implement #intialize and set @url'\n end", "def initialize\n @format = 'json'\n @scheme = 'https'\n @host = 'api.imagga.com:443'\n @base_path = '/v2'\n @user_agent = 'Swagger/Ruby/0.1.0/beta'\n @inject_format = false\n @force_ending_format = false\n @camelize_params = false\n # for API key/token authentication\n @api_key = '';\n @api_key_type = '';\n @api_key_name = '';\n @api_key_prefix = '';\n # for http basic authentication\n @username = ''\n @password = ''\n @user_agent = 'Swagger/Ruby/0.1.0/beta'\n end", "def initialize api_key=ENV['b2w_api_key'], api_url=\"http://api.born2win.local/v2/events\"\n @api_url = api_url\n @api_key = api_key\n end", "def initialize(adress, geonames_request)\n response = Net::HTTP.get_response(adress, geonames_request)\n jsonDoc = JSON.parse(response.body)\n @body = jsonDoc\n end", "def initialize(login:)\n @login = login\n @req = generate_request\n end", "def initialize(request_id)\n super request_id, SERVERDATA_RESPONSE_VALUE, nil\n end", "def initialize\n\t\t@zomato = Zomato::Base.new(@@api_key)\n\tend", "def initialize(options = {}, &block)\n @api_key = options.fetch(:api_key)\n @url = options.fetch(:url)\n @method = options.fetch(:method)\n @body = options[:body]\n @request = typhoeus_request\n @block = block\n end", "def initialize(client, api_model, query_params = {})\n @client = client\n @api_model = api_model\n @uri = \"#{Lexile.api_version}/#{api_model.api_path}\"\n @query_params = query_params\n end", "def initialize(api_key, region = 'na')\n @api_key = api_key\n @region = region\n @http = Hurley::Client.new\n @http.header[:content_type] = 'application/json'\n @http.query['api_key'] = api_key\n end", "def post_init\n @current = nil\n @requests = []\n @pending = []\n @parser = Http::Parser.new(self)\n end", "def initialize\n @settings = Settings.instance\n @options = {\n base_uri: @settings.get('api_endpoint'),\n timeout: @settings.get('timeout').to_i / 1000\n }\n end", "def initialize(api_client_id = nil, api_secret = nil, tenancy_code = nil, api_root: nil, api_root_auth: nil,\n api_version: nil, logger: nil, tenancy_root: nil, timeout: nil)\n\n self.api_root = api_root || 'https://rl.talis.com'\n self.api_root_auth = api_root_auth || 'https://users.talis.com/1/oauth/tokens'\n self.api_version = api_version || 2\n self.logger = logger\n self.rate_limit = nil\n self.rate_remaining = nil\n self.rate_reset = nil\n self.tenancy_code = tenancy_code\n self.tenancy_root = tenancy_root\n self.timeout = timeout.to_i\n\n @api_client_id = api_client_id\n @api_secret = api_secret\n @api_token = nil\n\n RestClient.log = self.logger if self.logger\n\n end", "def initialize(http_response, request)\n @http_response = http_response\n @request = request\n end", "def initialize(api_url)\n\t\t# Convert to URI\n\t\turi = URI(api_url)\n\t\t# Call Canvas API\n\t\tcall_api(uri)\n\tend", "def initialize(name)\n self.name = name\n self.data = self.class.get \"#{ BASE_URL }/#{ name }\"\n\n raise ArgumentError if data.response.code == '404'\n self.body = JSON.parse(self.data.body)\n end", "def request\n self.response = prepare_response(http_communication.content)\n end", "def request(api_method, params = {}, request_method = :get)\n self.params = params.merge(method: api_method, format: 'json')\n self.request_method = request_method\n self.header = new_header\n self.typhoeus_request = new_typhoeus_request\n self.response = typhoeus_request.run\n self.body = Oj.load(response.body, OJ_OPTIONS)\n check_response!\n body\n end", "def init_from_response_body!\n return unless self.response_body\n self.objects. init_from_hal(self.response_body);\n self.links. init_from_hal(self.response_body);\n self.attributes.init_from_hal(self.response_body);\n self.loaded = true\n self\n end", "def initialize(level_api_token, level_auth_token, uid, debug = false)\n default_json_options = { 'json-strict-mode' => false, 'json-verbose-response' => false}\n auth_options = {'api-token': level_api_token, 'token': level_auth_token, 'uid': uid.to_i}\n @default_params = default_json_options.merge(auth_options)\n end", "def initialize(apikey)\n @apikey = apikey\n end", "def initialize\n @headers = {\n \"Authorization\" => \"token #{ENV[\"AUTH_TOKEN\"]}\",\n \"User-Agent\" => \"HTTParty\"\n }\n end", "def initialize\n @headers = {\n \"Authorization\" => \"token #{ENV[\"AUTH_TOKEN\"]}\",\n \"User-Agent\" => \"HTTParty\"\n }\n end", "def initialize\n @headers = {\n \"Authorization\" => \"token #{ENV[\"AUTH_TOKEN\"]}\",\n \"User-Agent\" => \"HTTParty\"\n }\n end", "def initialize\n @headers = {\n \"Authorization\" => \"token #{ENV[\"AUTH_TOKEN\"]}\",\n \"User-Agent\" => \"HTTParty\"\n }\n end", "def initialize\n @headers = {\n \"Authorization\" => \"token #{ENV[\"AUTH_TOKEN\"]}\",\n \"User-Agent\" => \"HTTParty\"\n }\n end", "def initialize(api_key)\n @client = HTTPClient.new(\n default_header: {\n 'X-Auth-Token' => api_key,\n 'Content-Type' => 'application/json'\n }\n )\n end", "def initialize(http)\n @http = http\n end", "def api\n @http ||= Http.new(config)\n end", "def initialize(api_key)\n @api_key = api_key\n check_api_key!\n end", "def initialize\n\n\t\t#@dm = ApiRequest.new('../../config/accounts_private.yaml') #this context does not work within Sinatra app...?\n\n\t\t@dm = ApiOauthRequest.new\n\n\t\t@dm.uri_path = '/1.1/direct_messages'\n\t\t@dm.get_api_access\n\n\t\t@content = GenerateDirectMessageContent.new\n\t\t\n\t\t#puts \"In SEND: APP_ROOT: #{APP_ROOT}\"\n\n\t\tbegin\n\t\t\tlocations = CSV.read(File.join(APP_ROOT, 'data', 'placesOfInterest.csv'))\n\t\trescue #Running outside of Sinatra?\n\t\t\tlocations = CSV.read('../../data/placesOfInterest.csv')\n\t\tend\n\n\t\t@location_list = []\n\n\t\tlocations.each do |location|\n\t\t\t@location_list << location[0] #Load just the location name.\n\t\tend\n\tend", "def init_request(url)\n request = Typhoeus::Request.new(\n url,\n method: :get,\n headers: {'User-Agent' => user_agent}, \n followlocation: true\n # proxy: ...,\n # proxyuserpwd: ...\n )\n\n request.on_complete do |response|\n if response.success?\n # do nothing here\n elsif response.timed_out?\n raise Hubberlyzer::ResponseError, \"Time out when requesting: #{url}\"\n elsif response.code != 200\n raise Hubberlyzer::ResponseError, \"Response code #{response.code}, #{response.return_message} when requesting: #{url}\"\n else\n # Received a non-successful http response.\n raise Hubberlyzer::ResponseError, \"HTTP request failed. Response code #{response.code} when requesting: #{url}\"\n end\n end\n\n request\n end", "def initialize username, apikey\n\t\t@username = username\n\t\t@apikey = apikey\n\tend", "def post_init\n send_data @init_request\n end" ]
[ "0.7823221", "0.7229663", "0.7228181", "0.7166057", "0.7159453", "0.71229446", "0.70804787", "0.7078406", "0.70059055", "0.69910705", "0.698945", "0.6977771", "0.6966062", "0.69285816", "0.6910492", "0.6847841", "0.6827392", "0.68182236", "0.67984337", "0.67605996", "0.67496586", "0.674824", "0.6740993", "0.6723031", "0.67182165", "0.6716587", "0.6715062", "0.66919976", "0.6683466", "0.6666571", "0.6657442", "0.66429424", "0.66396046", "0.66358244", "0.6626041", "0.66122055", "0.66070694", "0.6603056", "0.6591801", "0.65831566", "0.65743023", "0.6554622", "0.6539646", "0.653915", "0.6529748", "0.65269685", "0.652678", "0.65098214", "0.6508713", "0.6508285", "0.6505997", "0.6484966", "0.6481625", "0.647372", "0.647372", "0.647372", "0.64668226", "0.6463661", "0.6460151", "0.6459326", "0.64590687", "0.64553875", "0.6451372", "0.64511025", "0.6448505", "0.6446385", "0.64461887", "0.6442667", "0.6442348", "0.64406854", "0.6426123", "0.642425", "0.642319", "0.6422559", "0.6420807", "0.6420758", "0.64172184", "0.6412178", "0.64080447", "0.63973105", "0.63893956", "0.638822", "0.6370107", "0.6364131", "0.6363975", "0.63582", "0.6351356", "0.63465935", "0.6345748", "0.6345748", "0.6345748", "0.6345748", "0.6345748", "0.6344224", "0.63440114", "0.6334324", "0.6333051", "0.6322615", "0.6320968", "0.6320712", "0.6319746" ]
0.0
-1
This should contain expected class of the returning message. Might be overwritten in child class
def expected_messages_class self.class.name.sub("Lookups", "Messages").constantize end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expect_message(type); end", "def message; Message.new; end", "def message_class\n return Scene_Battle::Message\n end", "def to_message\n fail NotImplementedError\n end", "def message_class\n Yuki::Message\n end", "def message\n @message || super\n end", "def message\n raise \"Override #message in the service class\"\n end", "def test_message_type\n @main = <<HERE\nMessage m = self.next_message\nm = m.next_message\nWord w = m.get_class_name()\nw.putstring()\nHERE\n @stdout = \"Message\"\n check\n end", "def message; end", "def message; end", "def message; end", "def message; end", "def message; end", "def message; end", "def message(message) end", "def class_type_for_message(key)\n case key\n when :success\n return 'success'\n when :notice\n return 'info'\n when :alert\n return 'warning'\n when :error\n return 'error'\n else\n return 'info'\n end\n end", "def get_message_types; end", "def get_message_types; end", "def message\n \"#{super}: #{response.body}\"\n end", "def message() end", "def message_for(test); end", "def message_for(test); end", "def validates_type_error_message(m, klass)\n # SEQUEL6: Make this the default behavior in validation_helpers\n if OVERRIDE_PROC.equal?(m)\n TYPE_ERROR_STRINGS[klass]\n else\n super\n end\n end", "def to_s; message; end", "def inspect\n \"#<#{self.class.name}: #{message}>\"\n end", "def message\n __getobj__\n end", "def message\n __getobj__\n end", "def message\n __getobj__\n end", "def message_template; end", "def parent_message\n end", "def get_message\n raise NotImplementedError.new(\"#{self.class.name}#get_message() is not implemented.\")\n end", "def get_message\n raise NotImplementedError.new(\"#{self.class.name}#get_message() is not implemented.\")\n end", "def message\n to_s\n end", "def message\n to_s\n end", "def message\n end", "def getMsgClass(message)\r\n return isMyMessage(message) ? \"userMessage-Me\" : \"userMessage-Them\"\r\n end", "def get_message_specifications\n\t\tend", "def msg(message)\n end", "def inspect; message; end", "def expected_message(*phrases) new_message.expected(*phrases); end", "def message=(_); end", "def message( message )\n\tend", "def message\n @_message\n end", "def message\n @_message\n end", "def human_msg_type\n self[:msg_type].to_human\n end", "def message\n MESSAGE\n end", "def message\n MESSAGE\n end", "def message\n MESSAGE\n end", "def message\n MESSAGE\n end", "def message\n \n end", "def new_message\n end", "def personal_message(msg, cl, state)\n respond(msg, cl, \"Hi. Your message was: #{msg.inspect}\")\n respond(msg, cl, \"Body: #{msg.body.to_s}\")\nend", "def message\n @message\n end", "def messageType\n return \"myNamespace:PingResponse\" \n end", "def error_message; end", "def human_message_type\n self[:message_type].to_human\n end", "def to_message\n self\n end", "def not_valid_message; nil; end", "def not_valid_message; nil; end", "def validate(fatal = false)\n if fatal\n ec = self.method(:ensure_class\n end\n \n # called by validate to actually check internal variables\n def validate_sub(check_element, check_class)\n raise NotImplementedError, \"Attempt to validate an abstract WireElement\" \n end\n\n private :ensure_element, :ensure_class, :validate_sub\n end\n\n # message header, common to all message types\n class MessageHeader < WireElement\n # TODO - class names instead?\n REQUEST_OPCODES = {\n :OP_REPLY => 1, \n :OP_UPDATE => 2001,\n :OP_INSERT => 2002,\n :OP_RESERVED => 2003,\n :OP_QUERY => 2004,\n :OP_GET_MORE => 2005,\n :OP_DELETE => 2006,\n :OP_KILL_CURSORS => 2007\n }\n\n chainable_setter\n ( :message_length,\n :request_id,\n :response_to,\n :opcode\n )\n\n def initialize\n # override parent\n end\n\n def validate(fatal = false)\n if fatal\n ee = self.method(:ensure_element_fatal)\n else\n ee = self.method(:ensure_element_boolean)\n end\n return ( ee.call(:message_length, :bson_int32?, \"message length is not an int32\")\n and ee.call(:request_id, :bson_int32?, \"request ID is not an int32\")\n and ee.call(:response_to, :bson_int32?, \"response ID of original request is not an int32\")\n and ee.call(:opcode, :bson_int32?, \"opcode is not an int32\")\n and ee.call(:class, [:const_get, :RequestOpcodes], :values, [:member?, opcode], \"invalid opcode\"))\n end\n\n def to_wire()\n validate true\n\n out = \"\"\n out << message_length.to_bson\n out << request_id.to_bson\n out << response_to.to_bson\n out << opcode.to_bson\n out\n end\n end\n\n # describe various types of request messages\n module RequestMessage\n class Update < WireElement\n OPCODE = 2001\n \n attr_accessor :header\n attr_accessor :full_collection_name\n attr_accessor :flags\n attr_accessor :selector\n attr_accessor :update\n\n def initialize\n # override parent\n end\n\n def validate(fatal = false)\n if fatal\n ec = self.method(:ensure_class_fatal)\n else\n ec = self.method(:ensure_class_boolean)\n end\n\n return ( ensure_class(header, MessageHeader, \"header is not a MessageHeader\")\n and ensure_class(full_collection_name, String, \"full collection name is not a String\")\n and ensure_class(flags, RequestFlags, \"flags is not a RequestFlags\")\n and ensure_class(selector, Hash, \"selector is not a Hash\")\n and ensure_class(update, Hash, \"update is not a Hash\"))\n end\n\n def to_wire\n validate true\n\n out = \"\"\n out << header.to_wire\n out << 0.to_bson\n out << full_collection_name.to_bson\n out << flags.to_wire\n out << selector.to_bson\n out << update.to_bson\n out\n end\n end\n\n class Insert < WireElement\n Opcode = 2002\n\n attr_accessor :header\n attr_accessor :flags\n attr_accessor :full_collection_name\n attr_accessor :documents\n\n def initialize ()\n # override parent\n end\n\n def to_wire()\n validate\n\n out = \"\"\n out << header.to_wire\n out << flags.to_wire\n out << full_collection_name.to_bson\n documents.each do |doc|\n out << doc.to_bson\n end\n out\n end\n end\n\n class Query < WireElement\n Opcode = 2004\n\n # represent the 32-bit \"flags\" bitvector that appears in messages\n class RequestFlags < WireElement\n # user-settable flags, in the order they occur in the bitvector\n attr_accessor :tailable_cursor # is cursor left open after retrieving all data?\n attr_accessor :slave_ok # allow queries on replica slave?\n attr_accessor :no_cursor_timeout # kill idle cursors?\n attr_accessor :await_data # block when data unavailable?\n attr_accessor :exhaust # pull all data at once? (TODO: is this correct?)\n attr_accessor :partial # try to get results even if some shards are down\n\n def initialize()\n # override parent\n end\n\n def validate(fatal = false)\n if fatal\n ec = self.method(:ensure_class_fatal)\n else\n ec = self.method(:ensure_class_boolean)\n end\n \n return ( ec.call(tailable_cursor, [TrueClass, FalseClass], \"tailable_cursor is not true or false\")\n and ec.call(slave_ok, [TrueClass, FalseClass], \"slave_ok is not true or false\")\n and ec.call(no_cursor_timeout [TrueClass, FalseClass], \"no_cursor_timeout is not true or false\")\n and ec.call(await_data, [TrueClass, FalseClass], \"await_data is not true or false\")\n and ec.call(exhaust, [TrueClass, FalseClass], \"exhaust is not true or false\")\n and ec.call(partial, [TrueClass, FalseClass], \"partial is not true or false\"))\n end\n end\n end\n\n def to_wire()\n validate true\n \n # first byte\n b0 = 0\n # bit 0: reserved\n b0 = b0 | 0b00000010 if tailable_cursor\n b0 = b0 | 0b00000100 if slave_ok\n # bit 3: internal use only\n b0 = b0 | 0b00010000 if no_cursor_timeout\n b0 = b0 | 0b00100000 if await_data\n b0 = b0 | 0b01000000 if exhaust\n b0 = b0 | 0b10000000 if partial\n # the next 3 bytes are reserved\n\n out = \"\"\n out << b0.to_bson # conveniently, will serialize as an int32\n out\n end\n end", "def message(type, *args)\n end", "def create_message(data); end", "def create_message(data); end", "def failure_message; end", "def failure_message; end", "def failure_message; end", "def failure_message; end", "def failure_message; end", "def failure_message; end", "def failure_message; end", "def message( *args )\n raise NotImplementedError, \"You must implement #message in your driver.\"\n end", "def attribute_to_check_message_against; end", "def get_message_template\n return @msg_st.get_instance_of\n end", "def description\n self[:message]\n end", "def message\n @message ||= Interface::Message.new(self)\n end", "def content_type; @message_impl.getContentType; end", "def initialize\n super(MESSAGE)\n end", "def message=(_arg0); end", "def message=(_arg0); end", "def instructions_return_valid_class(achieved_return, message_return)\n if (achieved_return.class != TrueClass && achieved_return.class != FalseClass)\n errors.add(:achieved_instructions, \"Achieved must be True or False\")\n else\n # nothing to do\n end\n\n if message_return.class != String\n errors.add(:message_instructions, \"Message must be String\")\n else\n # nothing to do\n end\n end", "def msg\n self['msg']||{}\n end", "def test_return_error_is_default\n _response, error = resolver_returning_error.query_raw(Dnsruby::Message.new)\n assert error.is_a?(CustomError)\n end", "def msg; end", "def msg; end", "def msg; end", "def message_type\n @message_type ||= \"message\"\n end", "def status_message; end", "def result_class\n expect :result\n\n self[2]\n end", "def assertKindOfWithMessageTest klass, object, message\n assertKindOf klass, object, message\n end", "def expected_operation_message2\n _undefined\n end", "def message_name message\n message.class\n end", "def msg=(_); end", "def msg=(_); end", "def return_type; end", "def return_type; end", "def return_type; end", "def message\n if not @message then\n [HTTPLogMessage, TCPLogMessage, StringLogMessage].each do |klass|\n @message = klass.parse(raw_message)\n break if @message\n end\n end\n return @message\n end", "def lookup_message(name)\n\t\tend", "def messages\n self\n end", "def message\n @message\n end" ]
[ "0.7179703", "0.6744682", "0.6650263", "0.66481745", "0.6565897", "0.64626825", "0.6453455", "0.64412063", "0.6376764", "0.6376764", "0.6376764", "0.6376764", "0.6376764", "0.6376764", "0.63290435", "0.6311117", "0.627904", "0.627904", "0.62737465", "0.62347186", "0.62238055", "0.62238055", "0.6221721", "0.6193987", "0.61816144", "0.61721456", "0.61721456", "0.61721456", "0.6163622", "0.61626863", "0.612907", "0.612907", "0.61135405", "0.61135405", "0.6110583", "0.60670304", "0.60457593", "0.6012238", "0.60114586", "0.5977758", "0.5976021", "0.5961389", "0.5940262", "0.5940262", "0.5928138", "0.592398", "0.592398", "0.592398", "0.592398", "0.59112334", "0.5901546", "0.59012246", "0.5873287", "0.5856314", "0.5854295", "0.5850339", "0.5835449", "0.5833065", "0.5833065", "0.58222616", "0.5801821", "0.57481694", "0.57481694", "0.5742954", "0.5742954", "0.5742954", "0.5742954", "0.5742954", "0.5742954", "0.5742954", "0.5734475", "0.5725489", "0.57141125", "0.5710283", "0.57096064", "0.5694152", "0.5684977", "0.56696725", "0.56696725", "0.5667082", "0.56644195", "0.5664065", "0.56633234", "0.56633234", "0.56633234", "0.5657987", "0.565579", "0.56512463", "0.565106", "0.56427467", "0.56419873", "0.5638523", "0.5638523", "0.5637836", "0.5637836", "0.5637836", "0.5633122", "0.5589119", "0.55864984", "0.5583855" ]
0.6789119
1
Tests for the default values when ExceptionNotifiable is included in a controller
def test_default_http_status_codes assert(BasicController.http_status_codes == HTTP_STATUS_CODES, "Default http_status_codes is incorrect") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch_default_exception(klass, request, response, e)\n controller = klass.build(request, response, e.class::STATUS)\n if e.is_a? ControllerExceptions::Redirection\n controller.headers.merge!('Location' => e.message)\n controller.instance_variable_set(\"@_body\", %{ }) #fix\n else\n @exception = e # for ERB\n controller.instance_variable_set(\"@_body\", DEFAULT_ERROR_TEMPLATE.result(binding))\n end\n [controller, e.name]\n end", "def exceptions_app; end", "def exceptions_app; end", "def exceptions\n end", "def test_exception_notification\n raise NotImplementedError.new('Exceptions aren\\'t implemented yet.')\n end", "def show_detailed_exceptions?; end", "def exceptions\n @exceptions ||= key[:exceptions]\n end", "def in_exception_context?; end", "def failsafe_action\n super\n end", "def exceptions_app=(_arg0); end", "def exceptions_app=(_arg0); end", "def fail_on_unevaluated\n fail_on_unevaluated_overrides\n fail_on_unevaluated_resource_collections\n end", "def set_throwable\n @throwable = Throwable.find(params[:id])\n end", "def bypass_rescue\n @controller.extend(BypassRescue)\n end", "def rescue_with_handler(exception)\n to_return = super\n if to_return\n verbose = self.class.exception_notifiable_verbose && respond_to?(:logger) && !logger.nil?\n logger.info(\"[RESCUE STYLE] rescue_with_handler\") if verbose\n data = get_exception_data\n status_code = status_code_for_exception(exception)\n #We only send email if it has been configured in environment\n send_email = should_email_on_exception?(exception, status_code, verbose)\n #We only send web hooks if they've been configured in environment\n send_web_hooks = should_web_hook_on_exception?(exception, status_code, verbose)\n the_blamed = ExceptionNotification::Notifier.config[:git_repo_path].nil? ? nil : lay_blame(exception)\n rejected_sections = %w(request session)\n # Debugging output\n verbose_output(exception, status_code, \"rescued by handler\", send_email, send_web_hooks, nil, the_blamed, rejected_sections) if verbose\n # Send the exception notification email\n perform_exception_notify_mailing(exception, data, nil, the_blamed, verbose, rejected_sections) if send_email\n # Send Web Hook requests\n ExceptionNotification::HooksNotifier.deliver_exception_to_web_hooks(ExceptionNotification::Notifier.config, exception, self, request, data, the_blamed) if send_web_hooks\n pass_it_on(exception, ENV, verbose)\n end\n to_return\n end", "def exceptions; end", "def render_exception(ex)\n error_code = ex.respond_to?(:code) ? ex.code : 1\n message = ex.message\n internal_error = true\n field = ex.respond_to?(:field) ? ex.field : nil\n\n case ex\n when OpenShift::ValidationException\n return render_error(:unprocessable_entity, nil, nil, nil, nil, get_error_messages(ex.resource))\n\n when Mongoid::Errors::Validations\n field_map =\n case ex.document\n when Domain then requested_api_version <= 1.5 ? {\"namespace\" => \"id\"} : {\"namespace\" => \"name\"}\n end\n messages = get_error_messages(ex.document, field_map || {})\n return render_error(:unprocessable_entity, nil, nil, nil, nil, messages)\n\n when Mongoid::Errors::InvalidFind\n status = :not_found\n message = \"No resource was requested.\"\n internal_error = false\n\n when Mongoid::Errors::DocumentNotFound\n status = :not_found\n model = ex.klass\n\n target =\n if ComponentInstance >= model then target = 'Cartridge'\n elsif CartridgeInstance >= model then target = 'Cartridge'\n elsif CartridgeType >= model then target = 'Cartridge'\n elsif GroupInstance >= model then target = 'Gear group'\n else model.to_s.underscore.humanize\n end\n\n message =\n if ex.unmatched.length > 1\n \"The #{target.pluralize.downcase} with ids #{ex.unmatched.map{ |id| \"'#{id}'\"}.join(', ')} were not found.\"\n elsif ex.unmatched.length == 1\n \"#{target} '#{ex.unmatched.first}' not found.\"\n else\n if name = (\n (Domain >= model and ex.params[:canonical_namespace].presence) or\n (Application >= model and ex.params[:canonical_name].presence) or\n (ComponentInstance >= model and ex.params[:cartridge_name].presence) or\n (CartridgeInstance >= model and ex.params[:name].presence) or\n (CartridgeType >= model and ex.params[:name].presence) or\n (Alias >= model and ex.params[:fqdn].presence) or\n (CloudUser >= model and ex.params[:login].presence) or\n (CloudUser >= model and ex.params[:_id].presence) or\n (SshKey >= model and ex.params[:name].presence)\n )\n \"#{target} '#{name}' not found.\"\n else\n \"The requested #{target.downcase} was not found.\"\n end\n end\n error_code =\n if Cartridge >= model then 129\n elsif ComponentInstance >= model then 129\n elsif SshKey >= model then 118\n elsif GroupInstance >= model then 101\n elsif Authorization >= model then 129\n elsif Domain >= model then 127\n elsif Alias >= model then 173\n elsif Application >= model then 101\n else error_code\n end\n internal_error = false\n\n when OpenShift::UserException\n status = ex.response_code || :unprocessable_entity\n error_code, node_message, messages = extract_node_messages(ex, error_code, message, field)\n message = node_message || \"Unable to complete the requested operation. \\nReference ID: #{request.uuid}\"\n messages.push(Message.new(:error, message, error_code, field))\n return render_error(status, message, error_code, field, nil, messages, false)\n\n when OpenShift::AccessDeniedException\n status = :forbidden\n internal_error = false\n\n when OpenShift::AuthServiceException\n status = :internal_server_error\n message = \"Unable to authenticate the user. Please try again and contact support if the issue persists. \\nReference ID: #{request.uuid}\"\n\n when OpenShift::DNSException, OpenShift::DNSLoginException\n status = :internal_server_error\n\n when OpenShift::LockUnavailableException\n status = :internal_server_error\n message ||= \"Another operation is already in progress. Please try again in a minute.\"\n internal_error = false\n\n when OpenShift::NodeUnavailableException\n Rails.logger.error \"Got Node Unavailable Exception\"\n status = :internal_server_error\n message = \"\"\n if ex.resultIO\n error_code = ex.resultIO.exitcode\n message = ex.resultIO.errorIO.string.strip + \"\\n\" unless ex.resultIO.errorIO.string.empty?\n Rail.logger.error \"message: #{message}\"\n end\n message ||= \"\"\n message += \"Unable to complete the requested operation due to: #{ex.message}. Please try again and contact support if the issue persists. \\nReference ID: #{request.uuid}\"\n\n when OpenShift::ApplicationOperationFailed\n status = :internal_server_error\n error_code, node_message, messages = extract_node_messages(ex, error_code, message, field)\n messages.push(Message.new(:error, node_message, error_code, field)) unless node_message.blank?\n message = \"#{message}\\nReference ID: #{request.uuid}\"\n return render_error(status, message, error_code, field, nil, messages, internal_error)\n\n when OpenShift::NodeException, OpenShift::OOException\n status = :internal_server_error\n error_code, message, messages = extract_node_messages(ex, error_code, message, field)\n message ||= \"unknown error\"\n message = \"Unable to complete the requested operation due to: #{message}\\nReference ID: #{request.uuid}\"\n\n # just trying to make sure that the error message is the last one to be added\n messages.push(Message.new(:error, message, error_code, field))\n\n return render_error(status, message, error_code, field, nil, messages, internal_error)\n else\n status = :internal_server_error\n message = \"Unable to complete the requested operation due to: #{message}\\nReference ID: #{request.uuid}\"\n end\n\n Rails.logger.error \"Reference ID: #{request.uuid} - #{ex.message}\\n #{ex.backtrace.join(\"\\n \")}\" if internal_error\n\n render_error(status, message, error_code, field, nil, nil, internal_error)\n end", "def exception_class; end", "def throwable_params\n params[:throwable]\n end", "def step_0_exceptions\n @step_0_exceptions ||= load_settings(\"step_0_exceptions\")\n end", "def test_exception_notification_delivery\n 1 / 0\n end", "def default_exception_renderer=(_arg0); end", "def test_defaults_via\n assert_nothing_raised(ActionController::RoutingError) do\n @rs_defaults_via.generate :controller => :bug\n end\n end", "def bypass_rescue\n if ::Rails::VERSION::STRING >= '2.2'\n def controller.rescue_action(exception)\n raise exception\n end\n else\n def controller.rescue_action_with_handler(exception)\n raise exception\n end\n end\n end", "def default()\n fail_todo\n end", "def catch_exceptions; end", "def user_not_authorized(exception)\n case exception.query\n when 'approve?',\n 'can_add_attachment?',\n /^add_response_to_flagged_case/,\n 'upload_responses?',\n 'update_closure?'\n super(exception, case_path(@case))\n else\n super\n end\n end", "def rescue_action_in_public_with_notifier(exception) #:doc:\n response_code = response_code_for_rescue(exception)\n status = interpret_status(response_code)[0,3]\n respond_to do |format|\n # Personalize rescue rules for backend\n if controller_path =~ /^backend\\//\n # Usually when we made a post we submit the form\n # to a target iframe, so we need to respond to the parent.\n if request.post?\n responds_to_parent do\n render :update do |page|\n page.unmask\n page.ext_alert I18n.t(\"lipsiadmin.exceptions.#{status}.title\"), I18n.t(\"lipsiadmin.exceptions.#{status}.description\")\n end\n end\n else\n # We can't use status, because Backend.app.load don't permit load 500, 404 pages\n format.html { render :template => \"/exceptions/#{status}\" }\n format.js do\n render :update do |page|\n page.unmask\n page.ext_alert I18n.t(\"lipsiadmin.exceptions.#{status}.title\"), I18n.t(\"lipsiadmin.exceptions.#{status}.description\")\n end\n end\n format.all { render :nothing => true, :status => status }\n end\n else\n format.html { render :template => \"/exceptions/#{status}\", :status => status }\n format.all { render :nothing => true, :status => status }\n end\n end\n rescue Exception => e\n logger.error e.message\n erase_results\n rescue_action_in_public_without_notifier(exception)\n ensure\n if response_code != :not_found && Lipsiadmin::Mailer::ExceptionNotifier.send_mail\n Lipsiadmin::Mailer::ExceptionNotifier.deliver_exception(exception, self, request)\n end\n end", "def unavailable! redirect = root_path\n raise Exceptional::NotAllowed.new(\"Sorry, I was unable to perform the action you requested!\")\n end", "def missing_params(e)\n \trender json: { message: e.message }, status: :unprocessable_entity\n end", "def default_values\n if self.new_record?\n self.email_at_notices ||= Errbit::Config.email_at_notices\n end\n end", "def initialize(*args)\n super\n @supports = { report: true, exception: true }\nend", "def respond_with_param_missing(exception = nil)\n msg = exception ? exception.message : \"Parameter missing\"\n render partial: \"api/error\", locals: { message: msg, error_code: \"param_missing\" }, status: 400\n return false\n end", "def wrapped_causes; end", "def expect_unprocessable_status\n is_expected.to respond_with 422\n end", "def exception_handler; end", "def is_exception?; end", "def test_sg_client_handles_unsupported_input\n RestClient.stubs(:post).returns(exp_msg)\n ENV.stubs(:[]).returns('AN ENV VAR')\n\n assert_equal bad_req_code, SendgridClient.send_email(nil)\n assert_equal bad_req_code, SendgridClient.send_email('')\n assert_equal bad_req_code, SendgridClient.send_email(123)\n assert_equal bad_req_code, SendgridClient.send_email({})\n assert_equal bad_req_code, SendgridClient.send_email([])\n end", "def user_exceptions\n rightsMetadata.individuals.map {|k, v| k if v == 'exceptions'}.compact \n end", "def expects_exception?; self.class.expects_exception; end", "def protect_parameter_missing\n yield\n rescue ActionController::ParameterMissing => e\n render_error(:bad_request, e)\n end", "def step_1_exceptions\n @step_1_exceptions ||= load_settings(\"step_1_exceptions\")\n end", "def exception_renderer; end", "def failure_message_when_negated; end", "def failure_message_when_negated; end", "def failure_message_when_negated; end", "def test_does_not_consider_unknown_errors\n ig = ScoutApm::ErrorService::IgnoredExceptions.new(context, [\"ThisDoesNotExist\", \"IgnoredExceptionsTest::FakeError\"])\n assert ig.ignored?(FakeError.new(\"ignore this one\"))\n end", "def resource_not_found_for(env)\n raise case env[:url].path\n when /\\A\\/_api\\/document/ then Ashikawa::Core::DocumentNotFoundException\n when /\\A\\/_api\\/collection/ then Ashikawa::Core::CollectionNotFoundException\n when /\\A\\/_api\\/index/ then Ashikawa::Core::IndexNotFoundException\n else Ashikawa::Core::ResourceNotFound\n end\n end", "def not_found\n raise ActionController::RoutingError, 'Not Found'\n end", "def mock_error_type\n _undefined\n end", "def intakes_controller_params\n ActionController::Parameters.new(\n rating_issue_reference_id: contestable_issue&.rating_issue_reference_id,\n rating_issue_diagnostic_code: contestable_issue&.rating_issue_diagnostic_code,\n rating_decision_reference_id: contestable_issue&.rating_decision_reference_id,\n decision_text: contestable_issue&.description,\n is_unidentified: unidentified?,\n decision_date: contestable_issue&.approx_decision_date,\n benefit_type: @benefit_type,\n ramp_claim_id: contestable_issue&.ramp_claim_id,\n contested_decision_issue_id: contestable_issue&.decision_issue&.id\n )\n end", "def exceptions\n @values['exceptions']\n end", "def wrapped_exception; end", "def use_exceptions\n stack Orange::Middleware::ShowExceptions unless ENV['RACK_ENV'] == 'production'\n end", "def not_found\n respond_with 404\n end", "def not_found\n respond_not_found\n end", "def not_found\n respond_with 404\n end", "def default_message\n \"Invalid Derelict instance\"\n end", "def render_figgy_404 # rubocop:disable Naming/VariableNumber\n respond_to do |format|\n format.html { render \"errors/not_found\", status: :not_found }\n format.json { head :not_found }\n end\n end", "def config\n Wrangler::ExceptionHandler.config\n end", "def index\n @throwables = Throwable.all\n end", "def mock_undetermined_vehicle_compliance\n allow(ComplianceCheckerApi).to receive(:vehicle_compliance)\n .and_raise(BaseApi::Error422Exception.new(422, '', {}))\n end", "def invalid_factories; end", "def missing_data_params\n default_params\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n end", "def err_params=(val)\n unless val.nil?\n raise NotImplementedError,\n \"Specifying `err_params` is not supported\"\n end\n end", "def not_found\n raise ActionController::RoutingError.new 'Not found'\n end", "def severity_producer\n p = super\n\n # Configure each issue that should **not** be an error\n #\n # Validate as per the current runtime configuration\n p[Issues::RT_NO_STORECONFIGS_EXPORT] = Puppet[:storeconfigs] ? :ignore : :warning\n p[Issues::RT_NO_STORECONFIGS] = Puppet[:storeconfigs] ? :ignore : :warning\n\n p[Issues::FUTURE_RESERVED_WORD] = :deprecation\n\n p[Issues::DUPLICATE_KEY] = Puppet[:strict] == :off ? :ignore : Puppet[:strict]\n p[Issues::NAME_WITH_HYPHEN] = :error\n p[Issues::EMPTY_RESOURCE_SPECIALIZATION] = :ignore\n p[Issues::CLASS_NOT_VIRTUALIZABLE] = :error\n p\n end", "def not_found\n raise ActionController::RoutingError.new 'Not Found'\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n end", "def index\n set_excuses\n end", "def rescue_action_in_public_with_errornot(exception)\n unless errornot_ignore_user_agent?\n ErrornotNotifier.notify_or_ignore(exception, errornot_request_data)\n end\n rescue_action_in_public_without_errornot(exception)\n end", "def rescue_not_found\n render nothing: true, status: 404\n end", "def optional_issue_property(fallback = '')\n yield\n rescue\n fallback\n end", "def expect_forbidden_status\n is_expected.to respond_with 403\n end", "def method_missing(*args)\n rescue_404\n end", "def miss_reason; end", "def exception_handler\n @exception_handler ||= {}\n end", "def render_parameter_missing_response(exception)\n render json: {error: exception.message}, status: 422\n end", "def exceptions=(value)\n @values['exceptions'] = value\n end", "def message\n configuration.default_message || @exception.message\n end", "def test_exception_notification\n raise 'Testing, 1 2 3.'\n end", "def before_server_error(exception); end", "def default_values\n self.communication_email ||= self.email\n end", "def check_defaults\n raise AvailableAttemptsNotInitialized unless self.class.available_attempts\n raise WaitTimeNotInitialized unless self.class.wait_time\n end", "def render_params_missing_error\n render :json => { error: I18n.t('api.errors.parameters') },\n :status => :bad_request\n end", "def test_log_entry_http_request_field_when_nil\n verify_subfields_when_nil(DEFAULT_HTTP_REQUEST_KEY)\n end", "def failure\n super\n end", "def original_exception; end", "def should_block_access\n should_respond_with :missing\n should_render_template \"404\"\n should_not_set_the_flash\n end", "def raise_deprecations; end", "def default?\n severity == :DEFAULT\n end", "def test_email_client_all_client_handles_exception\n MailgunClient.stubs(:send_email).raises(StandardError)\n SendgridClient.stubs(:send_email).raises(StandardError)\n\n input_val = EmailObject.new\n response = ClientResponse.new input_val\n response.set_internal_err\n\n assert_equal response, EmailClient.send_email(input_val)\n end", "def unpermitted_parameters\n fail 'Define me!'\n end", "def fallback\n logger.info ap params\n head :ok\n end" ]
[ "0.58751726", "0.58636385", "0.58636385", "0.5789949", "0.5653128", "0.55968535", "0.5573087", "0.54218596", "0.54075843", "0.5399033", "0.5399033", "0.5371232", "0.5369816", "0.5360617", "0.5350108", "0.5319065", "0.5276399", "0.52698547", "0.52653503", "0.5264609", "0.52560043", "0.52535325", "0.52492595", "0.5238268", "0.52217", "0.52153945", "0.5214385", "0.5210589", "0.5206009", "0.5194862", "0.5189054", "0.518418", "0.5181974", "0.5139779", "0.5109897", "0.5078147", "0.50780094", "0.5077613", "0.50766635", "0.50747323", "0.50664145", "0.50651616", "0.5040301", "0.50400364", "0.50400364", "0.50400364", "0.50295144", "0.5029457", "0.5021603", "0.5019778", "0.5015708", "0.50145787", "0.5011821", "0.50113255", "0.5007051", "0.50037235", "0.50000733", "0.49996316", "0.49948785", "0.49933642", "0.4985959", "0.49845174", "0.49838108", "0.49830848", "0.4980241", "0.49763647", "0.497629", "0.49759057", "0.49704355", "0.49587473", "0.49587473", "0.49587473", "0.49587473", "0.49587473", "0.49587473", "0.49586535", "0.4956659", "0.49540758", "0.49522266", "0.4943596", "0.49416465", "0.49347702", "0.4929831", "0.49289942", "0.4925984", "0.49170744", "0.4909265", "0.4907589", "0.49033067", "0.49026126", "0.4898609", "0.4892396", "0.48859453", "0.4883981", "0.48787984", "0.48777428", "0.48745054", "0.48732242", "0.48667118", "0.4865891" ]
0.49508914
79
Generate a link to an image in the S3 bucket
def getLogoData(data) data && data['asset_id'] && data['width'] && data['height'] or return nil return { url: "/assets/#{data['asset_id']}", width: data['width'], height: data['height'] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imgurl\n return url unless fake_url?\n # The more complicated case: we have an IR with image data, but no URL.\n # So we lookup the corresponding URL on AWS. If it exists, we return that;\n # Otherwise, we CREATE it on AWS first, then return it.\n #\n # Does the resource exist? If so, we just return the link\n path = \"uploads/reference/#{id}.png\"\n obj = S3_BUCKET.objects[path]\n unless obj.exists?\n puts 'Creating AWS file ' + path\n # The nut of the problem: take the image in the thumbdata, upload it to aws, and return the link\n b64 = thumbdata.sub 'data:image/png;base64,', ''\n img = Magick::Image.read_inline(b64).first\n S3_BUCKET.objects[path].write img.to_blob, {:acl => :public_read}\n end\n obj.public_url.to_s\n end", "def generate_url(bucket, file)\n\n connect_to_s3()\n signer = Aws::S3::Presigner.new\n url = signer.presigned_url(:get_object, bucket: bucket, key: file)\n\nend", "def get_image_url\n image_url = Storage.get_file_url(ENV['AWS_S3_DIR_PAGES'], self.issue_id, self.filename )\n return image_url\n end", "def public_url(bucket_name:, key:)\n \"https://#{bucket_name}.s3.amazonaws.com/#{key}\"\n end", "def url\n if @attributes[:filename] =~ /^http:\\/\\//\n @attributes[:filename]\n elsif $cloudfront && $cloudfront[s3_bucket]\n \"#{$cloudfront[s3_bucket]}/#{s3_key}\"\n else\n \"http://#{s3_bucket}.s3.amazonaws.com/#{s3_key}\"\n end\n end", "def download_link\n s3 = Aws::S3::Client.new\n signer = Aws::S3::Presigner.new(client: s3)\n signer.presigned_url(\n :get_object,\n bucket: ENV['SEATSHARE_S3_BUCKET'],\n key: path,\n expires_in: 86_400\n )\n end", "def url\n @url ||= s3_bucket.object(key_path).presigned_url(:get,\n expires_in: 7.days.to_i,\n response_content_disposition: ApplicationHelper.encoding_safe_content_disposition(\n ImageServiceHelper.download_name(@model.work_presenter, suffix: @suffix)\n )\n )\n end", "def generate_url(folder, file)\n\n bucket = \"prototype-jv\"\n s3_file_path = \"#{folder}/#{file}\"\n\n connect_to_s3()\n signer = Aws::S3::Presigner.new\n url = signer.presigned_url(:get_object, bucket: bucket, key: s3_file_path)\n\nend", "def url_for(software)\n \"http://#{Config.s3_bucket}.s3.amazonaws.com/#{S3Cache.key_for(software)}\"\n end", "def getImage\n image=AWS::S3::S3Object.url_for('testing.png','tradeDev')\n render :json => {:image=>image}\n end", "def url\n doomsday = Time.mktime(2038, 1, 18).to_i\n\n unless self.filename.nil?\n AWS::S3::S3Object.url_for(image_file_name, 'xposers_interieurs', :expires => doomsday)\n else\n names = image_file_name.split(\".\")\n extension = names.pop\n file = \"#{self.id}_#{names.join(\".\")}_normal.#{extension}\"\n AWS::S3::S3Object.url_for(file, 'xposers_interieurs', :expires => doomsday)\n end\n end", "def aws_S3_bucket_url_get(opts)\n if opts[:method] == :write\n opts[:obj].url_for(opts[:method], expires: 30.days, content_type: 'text/plain')\n else\n opts[:obj].url_for(opts[:method], expires: 30.days)\n end\n end", "def get_presigned_url(bucket, object_key)\n url = bucket.object(object_key).presigned_url(:put)\n puts \"Created presigned URL: #{url}\"\n URI(url)\nrescue Aws::Errors::ServiceError => e\n puts \"Couldn't create presigned URL for #{bucket.name}:#{object_key}. Here's why: #{e.message}\"\nend", "def s3_url(thumbnail = nil)\n if attachment_options[:cname]\n [\"#{s3_protocol}#{bucket.name}\", full_filename(thumbnail)].join(\"/\")\n else\n [\"#{s3_protocol}#{s3_hostname}#{bucket.path_prefix}\", full_filename(thumbnail)].join(\"/\")\n end\n end", "def s3_url\n establish_s3_connection\n bucket = self.datastreams[\"s3\"].bucket_values.first\n key = self.datastreams[\"s3\"].key_values.first\n AWS::S3::S3Object.url_for(key, bucket, :expires_in => 60 * 60 * 1.5)\n end", "def s3_url\n establish_s3_connection\n bucket = s3keys[\"bucket\"]\n key = self.datastreams[\"s3\"].key_values.first\n s3 = AWS::S3.new\n s3.buckets[bucket].objects[key].url_for(:read, :expires => 60 * 60 * 1.5)\n end", "def download_url\n s3 = AWS::S3.new\n bucket = s3.buckets[ENV[\"S3_BUCKET\"]]\n object = bucket.objects[self.aws_root_to_self_path]\n object.url_for(:get, { \n expires: 10.minutes,\n response_content_disposition: 'attachment;'\n }).to_s\n end", "def public_url(bucket_name:, key:)\n \"https://storage.googleapis.com/#{bucket_name}/#{key}\"\n end", "def aws_post_url\n \"#{AWS_S3_ACCESS_URL}/#{self.class.media_bucket}\"\n end", "def get_og_image_url\n og_image_filename = self.filename.split('.')[0] + \"_open-graph.jpg\"\n og_image_url = Storage.get_file_url(ENV['AWS_S3_DIR_PAGES'], self.issue_id, og_image_filename )\n return og_image_url\n end", "def url_for(attachment, thumbnail = nil, options = nil)\n options = options ? @options.merge(options) : @options\n if options.key?(:expires_in) || options.key?(:auth) || options.key?(:authenticated)\n S3Object.url_for(attachment.s3.path(thumbnail), options[:bucket_name], options.slice(:expires_in, :use_ssl))\n else\n File.join(protocol(options) + hostname(options) + port_string(options), bucket_name(options), attachment.s3.path(thumbnail))\n end\n end", "def public_url(options = {})\n url = URI.parse(bucket.url(options))\n url.path += '/' unless url.path[-1] == '/'\n url.path += key.gsub(/[^\\/]+/) { |s| Seahorse::Util.uri_escape(s) }\n url.to_s\n end", "def image_url\n rails_blob_url(object.image)\n # This helper gets the URL from the file we pass to it\n end", "def aws_instance_S3_object_create(bucket, name, attribute, url_method)\n name = aws_S3_object_name(name)\n log \"AWS: creating S3 Object '#{name}'\"\n obj = aws_call('aws_S3_obj_create', bucket: bucket, name: name)\n \n log \"AWS: getting S3Object url for '#{obj.key}'\"\n url = aws_call('aws_S3_bucket_url_get', obj: obj, method: url_method)\n self.update_attribute(attribute, url.to_s)\n\n obj\n end", "def get_url(s3_path)\n return nil unless s3_path.present?\n s3_manager_obj.get_signed_url_for(GlobalConstant::Aws::Common.kyc_bucket, s3_path,\n {expires_in: IMAGES_URL_EXPIRY_TIMESTAMP_INTERVAL})\n end", "def public_filename(thumbnail = nil, expires_in=1.hour)\n thumb = thumbnail.to_s if thumbnail\n self.authenticated_s3_url(thumb, :expires_in => expires_in)\n end", "def get_image_link(url)\n return not_found_link unless valid?(params)\n\n # Hash the params to get the filename and the key for redis.\n name = Digest::MD5.hexdigest(\n \"#{params['website']}_#{params['width']}_#{params['height']}\"\n )\n\n # Try to lookup the hash to see if this image has been created before\n link = $redis.with { |conn| conn.get(name) }\n unless link\n begin\n # keep super slow sites from taking forever.\n Timeout.timeout(20) do\n # Generate the image.\n img = generate_image(url)\n # Store the image on s3.\n send_to_s3(img, name)\n end\n\n # Create the link url.\n link = \"#{ENV['IMAGO_BASE_LINK_URL']}#{name}.jpg\"\n save_to_redis(name, link)\n # return a 'not found' link if something goes wrong.\n rescue StandardError => e\n logger.error \"Rescued Error Creating and Uploading Image: #{e}\"\n link = not_found_link\n save_to_redis(name, link, 300)\n end\n end\n\n link\nend", "def image_url(i, thumb = false)\n native_url = thumb ? i.image.px350.url : i.image.url\n native_url.gsub(IMAGE_HOST_S3, IMAGE_HOST_CDN)\n end", "def download_url(style = nil, expires_in = 90.minutes)\n \n s3 = Aws::S3::Resource.new\n\n secure_url = self.mp3\n \n unless Rails.env.test?\n begin\n if self.mp3.include?(\"https://s3-us-west-1.amazonaws.com/digiramp/\")\n secure_url = self.mp3.gsub('https://s3-us-west-1.amazonaws.com/digiramp/', '')\n else\n secure_url = self.mp3.gsub('https://digiramp.s3.amazonaws.com/', '')\n end\n \n bucket = s3.bucket(Rails.application.secrets.aws_s3_bucket)\n s3_obj = bucket.object(secure_url)\n secure_url = s3_obj.presigned_url(:get, expires_in: 600)\n rescue => e\n\n secure_url = self.mp3\n end\n end\n secure_url\n end", "def write_webcam_image_to_s3(bucket)\n # Create random name for image\n image_name = SecureRandom.hex(32) + \".jpg\";\n\n # Take picture and store it as image_name\n cli_cmd = $camera_command + \" \" + image_name\n `#{cli_cmd}`\n\n # Open Image file & upload it to StorageGRID\n image_file = File.open(image_name, \"r+\")\n $client.put_object(bucket: bucket, key: image_name,\n metadata: { 'foo' => 'bar' },\n body: image_file.read,\n server_side_encryption: 'AES256'\n )\n image_file.close\n\n # Delete temporary image file from disk\n File.delete(image_file)\n\n # return full URL of image\n $endpoint + \"/\" + bucket + \"/\" + image_name\nend", "def s3_url\n \"https://s3.amazonaws.com/#{ENV['S3_BUCKET']}\"\n end", "def presigned_url(bucket_name:, key:, expires_in:, response_content_type:)\n signer = Aws::S3::Presigner.new(client: @s3_client)\n signer.presigned_url(:get_object, {\n bucket: bucket_name,\n key: key,\n expires_in: expires_in,\n response_content_type: response_content_type\n })\n end", "def cdn_url(opts={})\n S3Buckets::MediaBucket.url(s3_key, opts) if s3_key\n end", "def aws_url_for(path, expires=nil)\n UploadHelper.aws_url_for(path, expires)\n end", "def s3_url\n return self.authenticated_s3_url(:expires_in => 24.hours, :use_ssl => true)\n end", "def do_bucket_key(bucket_name, object_name, options)\n access_key_id, secret_access_key, security_token = if ENV.has_key? \"AWS_SESSION_TOKEN\"\n get_temporary_keys_from_environment\n else\n get_temporary_keys_via_sts\n end\n\n expiration = options[:expires].to_i\n\n string_to_sign = \"GET\\n\\n\\n#{expiration}\\nx-amz-security-token:#{security_token}\\n/#{bucket_name}/#{object_name}\"\n\n signature = CGI.escape(\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest.new('sha1'),\n secret_access_key,\n string_to_sign,\n )\n ).gsub(\"\\n\",\"\")\n )\n\n object_url = if options[:path_style]\n \"https://s3.amazonaws.com/#{bucket_name}/#{object_name}\"\n elsif options[:insecure]\n \"http://#{bucket_name}.s3.amazonaws.com/#{object_name}\"\n else\n \"https://#{bucket_name}.s3.amazonaws.com/#{object_name}\"\n end\n\n url = object_url + \"?AWSAccessKeyId=#{access_key_id}&Expires=#{expiration}&Signature=#{signature}&x-amz-security-token=#{CGI.escape(security_token)}\"\n\n puts url\nend", "def uribase\n \"http://#{ENV['S3_BUCKET']}.#{ENV[\"S3_HOST\"]}/\"\n end", "def s3_url\n return self.authenticated_s3_url(:expires_in => current_user.admin? ? 1.week : 24.hours, :use_ssl => true)\n end", "def get_s3_url(image)\n http = `curl -X POST -d url=#{image} https://www.filepicker.io/api/store/S3?key=#{filepicker_api_key}`\n response = JSON(http)\n @key = response['key']\n return @key\n end", "def url(protocol = \"https\")\n if protocol.present?\n \"#{protocol}:#{S3.base_uri}/#{s3_key}\"\n else\n \"#{S3.base_uri}/#{s3_key}\"\n end\n end", "def presigned_url(key)\n bucket = ENV['DEFAULT_BUCKET']\n signer = Aws::S3::Presigner.new(client: @s3_client)\n signer.presigned_url(:get_object, bucket: bucket, key: key)\n end", "def direct_s3_presigned_url\n Stash::Aws::S3.presigned_download_url(s3_key: \"#{resource.s3_dir_name(type: 'supplemental')}/#{upload_file_name}\")\n end", "def generate_url(method, bucket=\"\", key=\"\", path_args={}, headers={})\n expires = 0\n if not @expires_in.nil?\n expires = Time.now.to_i + @expires_in\n elsif not @expires.nil?\n expires = @expires\n else\n raise \"invalid expires state\"\n end\n\n canonical_string =\n S3::canonical_string(method, bucket, key, path_args, headers, expires)\n encoded_canonical =\n S3::encode(@aws_secret_access_key, canonical_string)\n \n url = CallingFormat.build_url_base(@protocol, @server, @port, bucket, @calling_format)\n \n path_args[\"Signature\"] = encoded_canonical.to_s\n path_args[\"Expires\"] = expires.to_s\n path_args[\"AWSAccessKeyId\"] = @aws_access_key_id.to_s\n arg_string = S3.path_args_hash_to_string(path_args) \n\n return \"#{url}/#{key}?#{arg_string}\"\n end", "def get_signed_put_url(upload, duration)\n # use Fog config\n storage = Fog::Storage.new(Rails.configuration.x.fog_configuration)\n \n # set request attributes\n headers = { \"Content-Type\" => upload.content_type }\n options = { \"path_style\" => \"true\" }\n \n # generate signed url\n return storage.put_object_url(\n ENV['S3_BUCKET_NAME'],\n upload.path,\n duration.from_now.to_time.to_i,\n headers,\n options\n )\n end", "def aws_bucket_url\n UploadHelper.aws_bucket_url\n end", "def get_thumbnail_url\n thumb_filename = self.filename.split('.')[0] + \"_thumb_300.jpg\"\n thumbnail_url = Storage.get_file_url(ENV['AWS_S3_DIR_PAGES'], self.issue_id, thumb_filename )\n return thumbnail_url\n end", "def url(options = {})\n self.class.url_for(key, bucket.name, options)\n end", "def s3_uri\n File.join(settings[:bucket] =~ %r{^s3://}i ? settings[:bucket].to_s : \"s3://#{settings[:bucket]}\", \"\") # always use a traling '/' with s3cmd\n end", "def shelby_avatar_url(size)\n avatar_size = case size\n when \"small\"\n \"sq48x48\"\n when \"large\"\n \"sq192x192\"\n when \"original\"\n \"original\"\n end\n\n begin\n updated_time_string = Time.parse(avatar_updated_at).strftime('%s')\n rescue\n updated_time_string = Time.new.strftime('%s')\n end\n\n \"http://s3.amazonaws.com/#{Settings::Paperclip.user_avatar_bucket}/#{avatar_size}/#{id.to_s}?#{updated_time_string}\" if has_shelby_avatar\n end", "def public_uri\n URI.parse(s3obj.url(:expires_in => self.class.url_lifetime))\n end", "def send_to_s3(img, name)\n s3_directory.files.create({\n key: \"#{name}.jpg\",\n body: img,\n public: true\n })\nend", "def url(style=nil, use_timestamp = true)\n if self.class.s3_storage?\n asset.url(style,use_timestamp).gsub('//s3', '//fairleads.s3').gsub('/fairleads/', '/')\n else\n asset.url(style,use_timestamp)\n end\n end", "def update_image_src img, options = {}\n if FedenaSetting.s3_enabled? #and options[:s3].present? and options[:s3]) \n image_url = options[:style].present? ? img.url(options[:style].to_sym,false):img.url(:original,false)\n image_url = image_url.gsub('&amp;','&') if image_url.present? \n image_url\n # return (verify_http_https_file image_url) ? (image_tag image_url).gsub('&amp;','&') : ''\n else\n image_path = img.path\n return \"file://#{Rails.root.join(image_path)}\"\n # return image_tag \"file://#{Rails.root.join(image_path)}\", options\n end\n end", "def save_file_to_s3_bucket(bucket, file)\n\n image_path = \"./public/tmp/#{file}\"\n connect_to_s3()\n s3 = Aws::S3::Resource.new(region: ENV['AWS_REGION'])\n obj = s3.bucket(bucket).object(file)\n\n if obj.exists?\n cleanup_tmp_file(file)\n puts \"File #{file} already exists in the bucket.\"\n url = generate_url(bucket, file)\n else\n obj.upload_file(image_path)\n cleanup_tmp_file(file)\n puts \"Uploaded file (#{file}) to bucket (#{bucket}).\"\n url = generate_url(bucket, file)\n end\n\nend", "def get_presigned_put_url_for(s3_name, bucket, content_type)\n params = {\n bucket: bucket,\n key: s3_name\n }\n\n options={\n content_type: content_type,\n server_side_encryption: 'aws:kms',\n ssekms_key_id: key_id\n }\n\n presigner = Aws::S3::Presigner.new({client: client})\n u = presigner.presigned_url(:put_object, params.merge(options))\n # uri = URI.parse(u)\n # uri\n # r = Net::HTTP.start(uri.host, :use_ssl => true) do |http|\n # http.send_request(\"PUT\", uri.request_uri, File.read(file_path), {\n # # This is required, or Net::HTTP will add a default unsigned content-type.\n # \"content-type\" => content_type\n # })\n #\n # end\n end", "def s3_url\n if $current_user.present?\n object.get_s3_secure_url\n else\n nil\n end\n end", "def upload(file)\n # Upload the given file\n AWS::S3::S3Object.store( file,\n open( file ),\n BUCKET,\n :access => :public_read )\n\n # display the URL of the file just uploaded\n puts AWS::S3::S3Object.url_for((file), BUCKET)[/[^?]+/]\nend", "def url(opts = {})\n if bucket.mode == :private\n bucket.private_get_url(@path, opts)\n else\n bucket.path_to_url(@path, opts)\n end\n end", "def url(id, **options)\n if options.key? :expires\n signed_url = storage.signed_url(@bucket, object_name(id), **options)\n signed_url.gsub!(/storage.googleapis.com\\/#{@bucket}/, @host) if @host\n signed_url\n else\n host = @host || \"storage.googleapis.com/#{@bucket}\"\n \"https://#{host}/#{Addressable::URI.encode_component(object_name(id), Addressable::URI::CharacterClasses::PATH)}\"\n end\n end", "def url(size = default_style)\n image_id = instance.send(\"#{name}_#{:file_name}\")\n\n return @url_generator.for(size, {}) if image_id.nil? || image_id.empty? # Show Paperclip's default missing image path\n\n Imgurapi::Image.new(id: image_id).url(size: size, use_ssl: imgur_session.use_ssl?)\n end", "def create\n @s3image = S3image.new(s3image_params)\n s3 = AWS::S3.new\n bucket = s3.buckets['mailmagezineimage']\n\n file = s3image_params[:file]\n fileName = file.original_filename\n\n object = bucket.objects[fileName]\n object.write(file, :acl => :public_read)\n imageUrl = \"https://s3-ap-northeast-1.amazonaws.com/mailmagezineimage/#{fileName}\"\n\n render :json => {'imageUrl' => imageUrl}\n end", "def s3_presigned_url(template_output_path)\n template_path = template_output_path.sub('output/templates/','')\n key = \"#{@prefix}/#{template_path}\"\n s3_presigner.presigned_url(:get_object, bucket: s3_bucket, key: key)\n end", "def get_signed_url_for(bucket, s3_path, options = {})\n signer = Aws::S3::Presigner.new({client: client})\n params = {\n bucket: bucket,\n key: s3_path\n }\n\n signer.presigned_url(\n :get_object,\n params.merge(options)\n )\n end", "def avatar_url(size)\n self.avatar.url(size)\n # .gsub('s3.amazonaws.com/', 's3-us-west-2.amazonaws.com/')\n end", "def signed_link(params = {}, host = nil)\n account = @client.account\n\n url = URI(host || account[:settings]['images_service'])\n url.path = '/image/' + self[:sid] + '/'\n\n params = params.to_json\n url_params = Base64.urlsafe_encode64(params).delete('=')\n\n url.path += sign_params(params, account[:id]) + '.' + url_params\n\n url\n end", "def download_s3_file(image_info, *sightings_count)\n\n folder = image_info[0]\n filename = image_info[1]\n bucket = \"prototype-jv\"\n s3_file_path = \"#{folder}/#{filename}\"\n\n if sightings_count\n sightings_count = sightings_count[0]\n subdirectory = folder.split(\"/\")[1]\n sightings_dir = create_directory(subdirectory, sightings_count)\n swap_file = \"#{sightings_dir}/#{filename}\"\n else\n swap_file = \"./public/swap/#{filename}\" # use when running via app.rb\n # swap_file = \"../public/swap/#{file}\" # use when running locally from /lib/s3_bucket.rb\n end\n\n s3 = connect_to_s3()\n file = File.new(swap_file, 'wb')\n s3.get_object({ bucket:bucket, key:s3_file_path }, target: swap_file)\n file.close if file\n\nend", "def generate_url(method, domain, bucket, key, expires_in, headers)\n path = \"/#{bucket}/#{key}\"\n expires = expires_in.nil? ? 0 : Time.now.to_i + expires_in.to_i\n canonical_string = canonical_string(method, path, headers, expires)\n encoded_canonical = encode(canonical_string)\n\n arg_sep = key.index('?') ? '&' : '?'\n return \"/#{bucket}/#{key}\" + arg_sep + \"Signature=#{encoded_canonical}&\" + \n \"Expires=#{expires}&AWSAccessKeyId=#{@aws_access_key_id}\"\n end", "def temporary_url(expires_at=(Time.new.to_i+3600))\n\n sig = S3::Signature.generate_temporary_url_signature(:bucket => self.bucket,\n :resource => path_prefix,\n :expires_on => expires_at,\n :secret_access_key => self.bucket.service.secret_access_key)\n\n\n URI.escape(\"#{protocol}#{host}/#{path_prefix}#{key}&Signature=#{sig}&Expires=#{expires_at}\")\n end", "def url(options = {})\n if options[:virtual_host]\n scheme = options.fetch(:secure, true) ? 'https' : 'http'\n \"#{scheme}://#{name}\"\n else\n # Taken from Aws::S3::Endpoints module\n unless client.config.regional_endpoint\n endpoint = client.config.endpoint.to_s\n end\n params = Aws::S3::EndpointParameters.new(\n bucket: name,\n region: client.config.region,\n use_fips: client.config.use_fips_endpoint,\n use_dual_stack: client.config.use_dualstack_endpoint,\n endpoint: endpoint,\n force_path_style: client.config.force_path_style,\n accelerate: client.config.use_accelerate_endpoint,\n use_global_endpoint: client.config.s3_us_east_1_regional_endpoint == 'legacy',\n use_object_lambda_endpoint: nil,\n disable_access_points: nil,\n disable_multi_region_access_points: client.config.s3_disable_multiregion_access_points,\n use_arn_region: client.config.s3_use_arn_region,\n )\n endpoint = Aws::S3::EndpointProvider.new.resolve_endpoint(params)\n endpoint.url\n end\n end", "def store_on_s3(options)\n # Deleting :url from options because we don't want it in the options that we pass to s3\n # and removing some characters that aren't allowed in urls\n url = options.delete(:url).gsub(/ /, '%20').gsub(/\\^/, '%5E')\n file = open(url)\n \n key = options.delete(:key)\n\n AWS::S3::S3Object.store(key, file, @bucket, options)\n\n # Return location on s3\n \"http://s3.amazonaws.com/\" + @bucket + \"/\" + key\n end", "def url\n File.join(\"https://#{service}.#{region}.amazonaws.com\", path)\n end", "def image_url\n # It's just stored in public/data/slug.jpg or whatever the relevant file\n # extension is\n image = Dir[\"public/data/#{slug}.*\"].first.split(\"/\").last\n # That's accessed publicly over the website as /data/slug.jpg or whatever\n \"/data/#{image}\"\n end", "def default_url\n \"https://s3.amazonaws.com/whisprdev/uploads/default_avatar.png\"\n end", "def url(key, expires_in:, disposition:, filename:, content_type:)\n instrument :url, key: key do |payload|\n image = image_for(key)\n\n image.link.tap do |url|\n payload[:url] = url\n end\n end\n end", "def img\n source = Tinify.from_file(params[:file].tempfile.path)\n if source.store(\n service: 's3',\n aws_access_key_id: ENV['AWS_Access_Key_ID'],\n aws_secret_access_key: ENV['AWS_Secret_Access_Key'],\n region: 'us-west-1',\n path: 'gkbimages//client/'+params[:file].original_filename\n )\n render :json => {status: 0, data: 'https://s3-us-west-1.amazonaws.com/gkbimages//client/'+params[:file].original_filename}\n else \n render :json => {status: 404, data: \"Something went wrong with image upload\"}\n end\n end", "def image_url\n object.image_url\n end", "def gs_url filename\n \"gs://#{storage_bucket_name}/#{filename}\"\nend", "def put(bucket, key, object=nil, headers={})\n object = S3Object.new(object) if not object.instance_of? S3Object\n return generate_url('PUT', bucket, CGI::escape(key), {}, merge_meta(headers, object))\n end", "def url(style=nil, use_timestamp=false)\n if self.class.s3_storage?\n super.gsub('//s3', '//fairleads.s3').gsub('/fairleads/', '/')\n else\n super\n end\n end", "def image_url\n self.filename.url \n end", "def presigned_link_uri(object, version, file)\n url_for controller: :file,\n action: :presign,\n object: object,\n version: version,\n file: file\n end", "def s3(s3_bucket, artifact_path)\n @url = \"https://s3.amazonaws.com/#{s3_bucket}/#{artifact_path}\"\n parse_url\n self\n end", "def url\n url = \"http://#{country_imghost}/images/P/#{asin}\"\n url << \".\" << country_imgcode << \".\"\n \n url << \"_\" << @transforms.join(\"_\") << \"_\" << \".jpg\"\n end", "def create_resultfile_link(report, job)\n \"http://s3.amazonaws.com/#{report[:bucket_name]}/resultfiles/#{job.resultfile_name}.zip\"\n end", "def public_url(style = default_style)\n @fog.public_url(style)\n end", "def image_url\n image_uri\n end", "def image_url\n return unless image.attached?\n\n url_for(image)\n end", "def save(file_path, bucket_name, key=SecureRandom.uuid)\n uri = \"urn:openhbx:terms:v1:file_storage:s3:bucket:<#{bucket_name}>##{key}\"\n begin\n object = get_object(bucket_name, key)\n if object.upload_file(file_path)\n uri\n else\n nil\n end\n rescue Exception => e\n nil\n end\n end", "def do_manual_signing(bucket_name, object_name, options)\n sts = AWS::STS.new\n\n policy = AWS::STS::Policy.new\n policy.allow(:actions => [\"s3:GetObject\"], :resources => \"arn:aws:s3:::#{bucket_name}/#{object_name}\")\n duration = options[:expires] - Time.now\n session = sts.new_federated_session(\"TemporaryUser\", :policy => policy, :duration => duration.to_i)\n\n access_key_id=session.credentials[:access_key_id]\n secret_access_key = session.credentials[:secret_access_key]\n security_token = session.credentials[:session_token]\n expiration = options[:expires].to_i\n\n string_to_sign = \"GET\\n\\n\\n#{expiration}\\nx-amz-security-token:#{security_token}\\n/#{bucket_name}/#{object_name}\"\n\n signature = CGI.escape(\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n secret_access_key, string_to_sign)).gsub(\"\\n\",\"\"))\n\n scheme = if options[:secure] == false\n \"http\"\n else\n \"https\"\n end\n\n url = \"https://s3.amazonaws.com/#{bucket_name}/#{object_name}?AWSAccessKeyId=#{access_key_id}&Expires=#{expiration}&Signature=#{signature}&x-amz-security-token=#{CGI.escape(security_token)}\"\n url = \"#{scheme}://#{bucket_name}.s3.amazonaws.com/#{object_name}?AWSAccessKeyId=#{access_key_id}&Expires=#{expiration}&Signature=#{signature}&x-amz-security-token=#{CGI.escape(security_token)}\"\n puts url\nend", "def cover_url\n #rails_blob_path(image, disposition: 'attachment', only_path: true)\n end", "def link\n @link ||= \"#{IMAGE_URL}#{id}.#{IMAGE_EXTENSION}\"\n end", "def url_for(name, bucket = nil, options = {})\n connection.url_for(path!(bucket, name, options), options) # Do not normalize options\n end", "def image_url\n image.url\n end", "def object_image_url(size: :medium)\n image = object_data[:image] if object_available?\n\n if image.respond_to?(:attached?) && image.attached?\n url_helpers.url_for(image.representation(Integral.image_transformation_options.merge!(resize_to_limit: Integral.image_sizes[size])))\n elsif image.present?\n image\n else\n fallback_image_url\n end\n end", "def image_url(style='original')\n ENV[\"domain\"] + self.picture.image.url(:original) if self.picture.present?\n end", "def image\n return unless object.image.attached?\n\n # object.image.blob.attributes\n # .slice('filename', 'byte_size')\n # .merge(url: image_url)\n # .tap { |attrs| attrs['name'] = attrs.delete('filename') }\n object.image.service_url\n \n end", "def thumbnail_url\n company.image.url(:thumbnail)\n end", "def generate_html()\n html = \"\"\n \n puts \"Generating HTML ...\"\n \n s3 = RightAws::S3.new(S3_ID, S3_KEY)\n bucket = s3.bucket(S3_BUCKET)\n \n thumb = ''\n original = ''\n large = ''\n bucket.keys.each do |key|\n if key.full_name.include?(IMG_DIR)\n if key.full_name.include?(IMG_THUMB)\n thumb = S3_PUBLIC + key.full_name \n elsif key.full_name.include?(IMG_FINAL)\n large = S3_PUBLIC + key.full_name\n else\n original = S3_PUBLIC + key.full_name\n end \n \n if thumb != '' && large != '' && original != ''\n html += HTML_ITEM_PREFIX \n html += '<img class=\"thumbnail\" src=\"' + thumb + '\" rev=\"' + original + '\" rel=\"' + large + '\" />' \n html += HTML_TOGGLE + HTML_ITEM_SUFFIX \n thumb = ''\n original = ''\n large = '' \n end\n end\n end\n \n File.open(HTML_FILE, 'a') { |f| f.write(html) } \nend", "def public_url(style = default_style)\n @alt_storage.public_url(style)\n end", "def connect_to_s3\n config = {\n provider: 'AWS',\n aws_access_key_id: ENV['IMAGO_S3_KEY'],\n aws_secret_access_key: ENV['IMAGO_S3_SECRET'],\n path_style: true\n }\n Fog::Storage.new(config)\nend", "def avatar_url\n attachment = @object.avatar_attachment\n return if attachment.nil?\n\n Rails.application.routes.url_helpers.rails_blob_url(attachment, only_path: true)\n end" ]
[ "0.82557416", "0.7796186", "0.740115", "0.7377623", "0.72793156", "0.72579455", "0.7239507", "0.7205346", "0.7171922", "0.7152218", "0.7107362", "0.7063616", "0.70591897", "0.7052005", "0.70423025", "0.7026606", "0.6943128", "0.6928842", "0.6893491", "0.6866286", "0.68516576", "0.6841293", "0.6804462", "0.6803864", "0.6782883", "0.6765123", "0.67588085", "0.67541754", "0.67394334", "0.67096436", "0.66987574", "0.66861826", "0.66614103", "0.66562915", "0.663787", "0.6621532", "0.6586911", "0.65541077", "0.65100336", "0.65028316", "0.6497492", "0.649468", "0.6472283", "0.6470969", "0.6466065", "0.6460665", "0.6452501", "0.64105654", "0.6410068", "0.64042974", "0.6370326", "0.63569313", "0.6356915", "0.63454294", "0.6320838", "0.6314461", "0.63131136", "0.6307136", "0.63033974", "0.62990016", "0.629462", "0.6293213", "0.628507", "0.6283291", "0.62605613", "0.6255135", "0.62444055", "0.622411", "0.6223827", "0.6215891", "0.621559", "0.6212273", "0.61973345", "0.6194545", "0.6175985", "0.617107", "0.616949", "0.6161595", "0.6147612", "0.6145843", "0.614132", "0.6121146", "0.6109561", "0.61011255", "0.6098615", "0.60948145", "0.6079242", "0.60711163", "0.6065337", "0.6065109", "0.60613", "0.60529464", "0.6021216", "0.6021172", "0.6006907", "0.59979093", "0.599687", "0.5988748", "0.59787554", "0.5972595", "0.5966113" ]
0.0
-1
Add a URL to each nav bar item
def getNavBar(unitID, pageName, navItems) if navItems navItems.each { |navItem| if navItem['slug'] navItem['url'] = "/uc/#{unitID}#{navItem['slug']=="" ? "" : "/"+navItem['slug']}" end } navItems.unshift({ id: 0, type: "home", name: "Unit Home", url: "/uc/#{unitID}" }) return navItems end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nav_items\n [\n {\n url: root_path,\n title: \"Home\"\n },\n {\n url: about_me_path,\n title: \"About Me\"\n },\n {\n url: contact_path,\n title: \"Contact\"\n },\n {\n url: tech_news_path,\n title: \"Rails News\"\n },\n {\n url: blogs_path,\n title: \"Blog\"\n },\n {\n url: portfolios_path,\n title: \"Portfolio\"\n }\n ]\n end", "def navigation_item(item, url = {}, separate = false, &block)\n if block_given?\n return unless yield\n end\n path = (url.empty? ? self.send(\"#{item}_path\".to_sym) : url)\n item_class = (separate ? 'separate' : '')\n out = \"<li id=\\\"#{item}_nav\\\" class=\\\"#{item_class}\\\">\" \n out << link_to(\"#{item.to_s.split('_').collect{|e| e.capitalize}.join(' ')}\", \n path, :class => (@active == \"#{item}\" ? 'active' : ''))\n out << \"</li>\"\n end", "def output_nav(items)\n html = Array.new\n items.each do |text, path|\n item_path = Rails.application.routes.recognize_path(path)\n current_path = {:action => params[:action], :controller => params[:controller]}\n class_name = text.downcase\n if item_path[:controller] == current_path[:controller] && item_path[:action] == current_path[:action]\n class_name << \" active\"\n end\n html << content_tag(:li, link_to(text, path), :class => class_name)\n end\n html.join(\"\\n\").html_safe\n end", "def click_through_link\n\t\treturn '/items/' + self.items.first.slug if !self.items.first.blank?\n\t\treturn '/blog/' + self.blogs.first.slug if !self.blogs.first.blank?\n\t\treturn \"#\"\n\tend", "def new_nav_helper style, tag_type\n nav_links = ''\n\n nav_items.each do |item|\n nav_links << \"<#{tag_type}><a href='#{item[:url]}' class='#{style} #{active? item[:url]}'>#{item[:title]}</a></#{tag_type}>\"\n end\n\n nav_links.html_safe \n end", "def navbar_element(title, page_path, method=\"\")\n content_tag :li, link_to(title, page_path, method: method), class: active_navbar_class(page_path)\n end", "def navlistbar_hubs_link\n $tracer.trace(__method__)\n return GINavbarHubsListLinks.new(li.className(\"magazine\").div.className(\"subnav\").a, __method__)\n end", "def navBarLink(url,text, img_name, link_option)\n ### <%= link_to raw('<button type=\"button\" class=\"btn-img btn btn-default navbar-btn\">'+image_tag(\"list16x16.png\",{:title =>\"Ir al Listado\", :alt=>\"Listar\", :border => \"0\"})+\" Listado</button>\"), cargos_path %>\n\n link_to raw('<button type=\"button\" class=\"btn-img btn btn-default navbar-btn\">'+image_tag(img_name,{:border=>\"0\", :alt=>\"\"})+\" \"+text+\"</button>\"), url, link_option\n end", "def html_list_item(item)\n tag :li, yield, :id => \"nav_#{item.name}\",\n :title => item.title(@inject[item.name]),\n :class => @current == item ? 'active' : ''\n end", "def topnav_items(info={:object_id => 0, :object_name => nil})\n # Set up hashes of links\n if info[:object_name].blank?\n name = controller.controller_name.gsub('_', ' ')\n else\n name = info[:object_name].pluralize\n end\n index_link = {:name => name.capitalize + \" index\",\n :target => {:controller => controller.controller_name}}\n list_link = {:name => \"List \" + name,\n :target => {:controller => controller.controller_name, :action => 'list'}}\n new_link = {:name => \"Add new \" + ActiveSupport::Inflector.singularize(name),\n :target => {:controller => controller.controller_name, :action => 'new'}}\n edit_link = {:name => \"Edit \" + ActiveSupport::Inflector.singularize(name),\n :target => {:controller => controller.controller_name, :action => 'edit',\n :id => info[:object_id]}}\n show_link = {:name => \"View \" + ActiveSupport::Inflector.singularize(name),\n :target => {:controller => controller.controller_name, :action => 'show',\n :id => info[:object_id]}}\n main_link = {:name => \"Main\", :target => {:controller => 'main'}}\n cp_link = {:name => \"Control Panel\", :target => {:controller => 'cp'}}\n # Create an array to hold the links in order\n link_array = []\n case params[:action]\n when \"index\", \"\"\n link_array[0] = list_link\n link_array[1] = new_link\n when \"list\", \"list_deactivated\"\n link_array[0] = index_link\n link_array[1] = new_link\n when \"new\", \"create\"\n link_array[0] = index_link\n link_array[1] = list_link\n when \"show\"\n link_array[0] = edit_link\n link_array[1] = index_link\n link_array[2] = list_link\n when \"edit\"\n link_array[0] = show_link\n link_array[1] = index_link\n link_array[2] = list_link\n when \"search\"\n link_array[0] = index_link\n link_array[1] = new_link\n end\n # Adding a special case for :fqdn\n if params[:fqdn]\n link_array[0] = edit_link\n link_array[1] = index_link\n link_array[2] = list_link\n end\n link_array << main_link << cp_link\n html = ''\n link_array.each do |link|\n html += \"<li>\" + link_to(link[:name], link[:target]) + \"</li>\"\n end\n return html\n end", "def nav_link(*args)\n class_names = \"button\"\n class_names = \"#{class_names} #{args[2][:class]}\" if args.length >= 3\n content_tag(:li, active_link_to(args[0] , args[1] , :title => args[0]), :class => class_names)\n end", "def links\n construct_html(self.items)\n end", "def bsh_navbar_item(display, url, active: true)\n is_active = active && request.path == url\n\n raw <<-HTML.chomp!\n <li class='#{is_active ? 'active' : ''}'><a href='#{url}'>#{display}</a></li>\n HTML\n end", "def link(content = nil, options = {}, html_options = nil, &block)\n if block\n content[:nav_type] = type\n content[:nav_tags] = nav_tags\n else\n options[:nav_type] = type\n options[:nav_tags] = nav_tags\n end\n @items << NavLink.new(content, options, html_options, &block)\n end", "def item title, link\n unless current_page? link\n content_tag :li, link_to(title, link)\n else\n content_tag(:li, :class => :active){\n content_tag :strong, title\n }\n end\n end", "def navigation_list_link_to(name, options = {}, html_options = {})\n content_tag(\"li\", navigation_link_to(name, options, html_options))\n end", "def site_page_navigation_item(text, path, link_html_opts={}, li_html_opts={})\n li_class = current_page?(path) ? \"active\" : \"\"\n content_tag :li, li_html_opts.merge(:class=>li_class) do\n link_to text.html_safe, path, link_html_opts\n end\n end", "def nav(name, url, pages = nil, active = false)\n content_tag :li, link_to(name, url), :class => (active || (pages && active_page?(pages)) ? 'act' : nil)\n end", "def nav_link(text, route)\n content_tag(:li, class: current_page?(route) ? \"active\" : \"\") do\n link_to text, route\n end\n end", "def navigation_link(nav,text=nil)\n text ||= nav\n \"<li id=\\\"#{nav.split(\"/\").last.downcase}_tab\\\">#{link_to(text, :controller => \"/#{nav.downcase}\")}</li>\"\n end", "def nav(name=\"\", path=root_path, active='')\n active_class = active == controller.controller_name ? 'activelink' : ''\n markaby do #=> Markaby template.\n li :class => active_class do\n link_to(name, path)\n end\n end\n end", "def link_4menu(item) #:nodoc:\n html = ''\n link = item.link\n link = \"/#{@site.route_name}/#{item.page_id}\" #if link.blank?\n# \n html << @parent.link_to(item.picture, link) unless item.picture.blank?\n html << if !item.caption.blank?\n # TODO Translation\n @parent.link_to(item.caption, link)\n end\nend", "def navigation\n [IndexHtmlUnit.new.link] + ModelHtmlUnitCollection.links_by_make(make)\n end", "def setup_nav_items\n dir = Rails.root.join('app', 'views', 'reports', 'categories').to_s\n @nav_items = {}\n cats = %W(\n the_churches\n developing_localities\n cities_we_are_burdened_for\n various_works\n building_projects\n archives\n )\n cats.each do |cat|\n @nav_items[cat] = Dir.glob(\"#{dir}/#{cat}/*\").map do |path|\n next unless path['.slim']\n path.remove(\".slim\").split(\"/\").last\n end.compact.sort\n end\n @current_page = request.env['PATH_INFO']\n end", "def webSiteBuildLinkListForPages(pages, label, baseDir)\n html = \"<ul data-role=\\\"listview\\\" data-inset=\\\"true\\\">\\n\"\n html += \"<li data-role=\\\"list-divider\\\">#{label}</li>\\n\"\n pages.each do |page|\n title = pageGetTitleFromTargetFile(page)\n target = pageTargetFile(page) + \"/index.html\"\n url = target.split(baseDir)[1]\n html += \"<li><a data-ajax=\\\"false\\\" href=\\\"#{url}\\\">#{title}</a></li>\\n\"\n end\n html += \"</ul>\\n\"\n html\nend", "def link\n h.content_tag :li do\n h.link_to h.content_tag(:i, '' , class: object.icon ) , object.url , target: \"_blank\" , title: object.name\n end\n end", "def index\n if current_user\n @links = current_user.links \n @bottom_bar_header = \"My Links\"\n end\n end", "def nav_bar\n path_array = self.current_page.split(\"/\").drop(1)\n path_count = path_array.count\n params = self.request_params_display\n \n if URI.unescape(self.current_page) == \"/\"\n nav_bar = \"Index of /\"\n else\n nav_bar = \"Index of <a href=\\'/#{params}'>/</a>\"\n end\n \n previous_path = \"\"\n 0.upto(path_array.count - 1) do |a|\n \n ##\n # Get escaped versions of this path and previous path\n \n escaped_path = path_array[a].gsub(\" \", \"%20\").gsub(\"'\", \"%27\")\n escaped_previous = previous_path.gsub(\" \", \"%20\").gsub(\"'\", \"%27\")\n \n ##\n # If this is the last directory in the path, it shouldn't have a link\n \n if a == path_array.count - 1\n href = \"\"\n else\n href = \"<a href=\\'/#{escaped_previous}#{escaped_path}#{params}\\'>\"\n end\n \n ##\n # If this is the first directory above the root, don't prepend a slash\n \n if a == 0 \n nav_bar << \" #{href}#{path_array[a]}</a>\"\n else\n nav_bar << \" / #{href}#{path_array[a]}</a>\"\n end\n \n previous_path << path_array[a] + \"/\"\n end\n \n @nav_bar = nav_bar\n \n end", "def nav_link(link_text, link_path)\n class_name = current_page?(link_path) ? 'current' : ''\n\n # Playlists and Tags routes should also trigger highlighting of the Watch Ignite Videos menu item\n current_uri = request.env['PATH_INFO']\n if ['/tags','/playlists'].include? current_uri and link_path == '/videos'\n class_name = 'current'\n end\n\n content_tag(:li, :class => class_name) do\n link_to link_text, link_path\n end\n end", "def top_nav_item(link_text, link_opts, html_opts={})\n css_class = html_opts[:class] || \"\"\n css_class = (css_class.split(/\\s+/)+[\"active\"]).join(\" \") if current_page?(link_opts)\n html_opts[:class] = css_class\n content_tag :li, html_opts do\n link_to(link_text, link_opts)\n end\n end", "def menu_item_link(m)\n options = {}\n if m.new_page\n options = {:target => \"_blank\"}\n end\n link_to m.title, m.url, options\n end", "def admin_links_for_navigation_bar\n unless current_user.nil?\n if current_user.admin?\n content_tag(:li, class: 'nav-item active') do\n link_to admin_path, class: 'nav-link' do\n icon('clipboard-data') + ' Admin Dashboard'\n end\n end\n end\n end\n end", "def html_link(item)\n tag :a, yield, :href => item.url\n end", "def navigation_items\n unless @io\n @io = []\n \n if can?( :index, PhoneBookEntry )\n @io << { :url => phone_book_entries_path , :title => t('phone_book_entries.index.page_title' ) }\n end\n \n # This could be a link to VoiceMails.\n #\n # if can?( :index, Object )\n # @io << { :url => \"#\" , :title => t('voice_mail') }\n # end\n \n end\n @io\n end", "def navigation_item(content = false, &block)\n cls = 'navigation-item'\n cls << ' active' if content\n\n tag('li', content, class: cls, &block)\n end", "def admin_nav\n items = {'Home' => admin_root_path, \n 'Users' => admin_users_path,\n 'Submissions' => admin_submissions_path}\n output_nav(items)\n end", "def nav\n add_property('nav')\n end", "def menu_link_to(name,path,options={})\n style = \"page_item\"\n style = \"current_page_item\" if current_page?(path)\n options.merge!( { :class => \"#{style} btn btn-small\" } )\n link_to( name, path, options )\n end", "def backstage_navigation_item(id, href, controllers = [])\n if controllers.empty? then controllers = [ id.to_s ] end\n\n selected = controllers.any? { |c| c == controller_name } && ' selected'\n\n title = t :\"backstage.navigation.#{id}.title\"\n name = t :\"backstage.navigation.#{id}.name\"\n\n <<-HTML.html_safe\n <li class=\"#{ h id }#{ selected or '' }\">\n <a href=\"#{ href }\" title=\"#{ h title }\">\n <span class=\"icon\">#{ h name }</span>\n </a>\n </li>\n HTML\n end", "def nav_mobile_menu(items)\n nav_mobile = link_to raw('<i class=\"material-icons\">menu</i>'), \"#\", data: {activates: \"mobile-nav\"}, class: \"button-collapse\"\n nav_mobile += content_tag :ul, class: \"right hide-on-med-and-down\" do\n items.collect {\n |item| \n concat( nav_link( item[:text], item[:path]) ) \n }\n end\n nav_mobile += content_tag :ul, class: \"side-nav\", id: 'mobile-nav' do\n items.collect {\n |item| \n concat( nav_link( item[:text], item[:path]) ) \n }\n end \n end", "def navigationUrl\n @url\n end", "def nav(content = nil, options = {}, html_options = nil, &block)\n @items << UiBibz::Ui::Core::Component.new(Nav.new(content, options).tap(&block).render, {}, html_options)\n end", "def main_menu_link; MAIN_MENU_LINK; end", "def nav_link(text, *paths)\n attrs = paths.any? { |p| current_page?(p) } ? { :class => \"active\" } : {}\n content_tag(:li, attrs) { link_to text, paths.first }\n end", "def navlistbar_podcasts_link\n $tracer.trace(__method__)\n return ToolTag.new(li.className(\"/explore/\").div.className(\"/subnav/\").ul.className(\"/dropdown/\").a(\"/Podcasts/\"), __method__)\n end", "def navlistbar_blogs_link\n $tracer.trace(__method__)\n return ToolTag.new(li.className(\"/take-part/\").div.className(\"/subnav/\").ul.className(\"/dropdown/\").a(\"/Blogs/\"), __method__)\n end", "def create_link(item_nr)\n \"<a href=\\'/item/#{item_nr}\\'>#{self}</a>\"\n end", "def navigation_menu(i18n_path, controller_paths, link_to_path, options={})\n code = '<li class=\"'\n code += 'active ' if is_menu_active? controller_paths\n code += 'first ' if options[:first]\n code += \"\\\">\\n\"\n code += link_to(I18n::t(i18n_path), link_to_path) + \"\\n\"\n code += \"</li>\\n\"\n\n code\n end", "def navigation\n [IndexHtmlUnit.new.link, MakeHtmlUnitCollection.link_by_make(make)]\n end", "def get_items_links(uri_arr)\n\t\tlinks = []\n\t\t(1..get_max_page(uri_arr) ).each do |x|\n\t\t links.concat P.get_css_list P.build_uri(uri_arr), '.isolux-thumbnail-name a' \n\t\tend\n\t\t\n\t\tlinks\n\tend", "def navigation_helper style, tag\nnav_links = <<NAV\n <#{tag}><a href=\"#{root_path}\" class=\"#{style} #{active? root_path}\">Home</a></#{tag}>\n <#{tag}><a href=\"#{about_path}\" class=\"#{style} #{active? about_path}\">About</a></#{tag}>\n <#{tag}><a href=\"#{contact_path}\" class=\"#{style} #{active? contact_path}\">Contact</a></#{tag}>\n <#{tag}><a href=\"#{blogs_path}\" class=\"#{style} #{active? blogs_path}\">Blog</a></#{tag}>\n <#{tag}><a href=\"#{content_news_path}\" class=\"#{style} #{active? content_news_path}\">Twitter</a></#{tag}>\n <#{tag}><a href=\"#{folios_path}\" class=\"#{style} #{active? folios_path}\">Folio</a></#{tag}>\nNAV\n nav_links.html_safe\n end", "def menu_link_to(text, url, options={}, current=nil)\n content_tag :li, link_to(text, url, options), :class => (current.nil? ? part_of_current_url?(url) : current) ? 'current' : nil\n end", "def nav(options = {}, &block)\n @nav_link = true\n nav = content_tag :ul, nav_options(options), &block\n nav.tap{ @nav_link = false }\n end", "def navigation_link_to(txt, url)\n\t\tpage_index = request[\"path\"].gsub(\"index.html\",\"\")\n\t\t\n\t\tif url == \"/#{page_index}\"\n\t\t\treturn link_to(txt, url, :class => \"active\")\n\t\tend\n\t\tlink_to(txt,url)\n\tend", "def nav_bar_links\n curr_path = request.path\n base_path = curr_path.sub(%r{^(/[^/]*)/.*$}, '\\1')\n curr_prm = url_parameters.except(:limit)\n curr_path += '?' + url_query(curr_prm) if curr_prm.present?\n html_div(class: 'links') do\n first = true\n NAV_BAR_CONTROLLERS.map do |controller|\n if controller == :home\n # Special entry for the dashboard/welcome screen.\n path = dashboard_path\n base = (base_path == '/account')\n label = DASHBOARD_CONFIG[:label]\n tip = DASHBOARD_CONFIG[:tooltip]\n hidden = !current_user\n else\n # Entry for the main page of the given controller.\n path = get_path_for(controller)\n base = (base_path == path)\n label = CONTROLLER_LABEL[controller]\n tip = CONTROLLER_TOOLTIP[controller]\n hidden = (controller == :org) && !current_user\n end\n\n primary = PRIMARY_CONTROLLERS.include?(controller)\n if primary && production_deployment?\n primary &&= !UNRELEASED_CONTROLLERS.include?(controller)\n end\n\n current = (path == curr_path)\n active = current || base\n disabled = current\n\n classes = []\n classes << 'secondary' unless primary\n classes << 'active' if active\n classes << 'disabled' if disabled\n classes << 'hidden' if hidden\n\n # The separator preceding the link.\n sep_css = %w[separator]\n sep_css << 'hidden' if first\n separator = html_span('|', class: css_classes(*classes, *sep_css))\n\n # The link (inactive if already on the associated page).\n tip &&= \"#{tip}\\n\" if disabled\n tip += '(Current_page)' if disabled # TODO: I18n\n opt = { class: css_classes(*classes), title: tip }\n link = disabled ? html_span(label, opt) : link_to(label, path, opt)\n first = false unless hidden\n\n separator << link\n end\n end\n end", "def nav_link(section, href, content)\n attributes = {\n :class => ['nav-link'],\n :href => site_url(href),\n }\n attributes[:class].push('active') if (attr 'site-section') == section\n html_tag('a', attributes, content)\n end", "def navi(rel_pos=\"/~kunolab/\")\n puts \"<ul class='menuBar'>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/MiniWorkshop/2nd/index.html\\\">Mini-Workshop</a>\"\n puts \"<li><a href=\\\"https://calendar.google.com/calendar/embed?src=kunogroup%40gmail.com&ctz=Asia%2FTokyo\\\">久野研カレンダー(KunoLabCalendar)</a>\"\n puts \"<li><a href=\\\"/~kunolab/seminar/ronbun/2018/index.html\\\">論文紹介(Paper Presentation)</a>\"\n puts \"<li><a href=\\\"/~kunolab/seminar/kenkyu/2018/index.html\\\">研究紹介(Research Presentation)</a>\"\n puts \"<li><a href='#'>ゼミ(Seminar) <image src=\\\"image/sita3.png\\\" class=\\\"headImg\\\"></a>\"\n puts \"<ul>\"\n puts \"<li><a href=\\\"/~kunolab/seminar/Lepton_2017/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Leptonゼミ(2017)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Modern_2016/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Thomsonゼミ(2016)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Modern_2015/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Thomsonゼミ(2015)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Perkins_2015/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Perkinsゼミ(2015)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Mann_2014/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Mannゼミ(2014)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Mann/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Mannゼミ(2013)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Elementary_2013/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> 素粒子物理学ゼミ(2013)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Leo_2012/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Leoゼミ(2012)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Perkins_2012/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Perkinsゼミ(2012)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Elementary/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> 素粒子物理学ゼミ(2012)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Knoll/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Knollゼミ(2011)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Knoll_en/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Knoll(en)ゼミ(2011)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Roe/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Roeゼミ(2011)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Leo/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Leoゼミ(2010)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Perkins_en/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Perkins(en)ゼミ(2010)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Leo_en/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Leo(en)ゼミ(2010)</a></li>\"\n puts \"</ul>\"\n puts \"</ul>\"\nend", "def link_class(url)\n return 'nav-item' unless current_page?(url)\n\n 'nav-item current'\n end", "def nav_link(text, path)\n if current_page? path\n content_tag :li, class: 'active' do\n\n # <span class=\"sr-only\">(current)</span> required for Screen Readers\n link_to path do\n concat text\n concat content_tag :span, '(current)', class: 'sr-only'\n end\n end\n else\n content_tag :li do\n link_to text, path\n end\n end\n end", "def nav_link(text, link)\n recognized = Rails.application.routes.recognize_path(link)\n if recognized[:controller] == params[:controller] && recognized[:action] == params[:action]\n content_tag(:li, :class => \"active\") { link_to( text, link ) }\n else\n content_tag(:li) { link_to( text, link ) }\n end\n end", "def set_menu_links\n @menu_link = [{\n link_name: 'Главная',\n link_path: root_path,\n link_class: 'home-class'\n }, {\n link_name: 'QR коды',\n link_path: qr_codes_path\n }, {\n link_name: 'Наши контакты',\n link_path: contacts_path\n }, {\n link_name: 'О нас',\n link_path: about_path\n }]\n\n @users_link = []\n if current_user\n @users_link.push({\n link_name: 'Выход',\n link_path: logout_path,\n link_method: :delete\n })\n else\n @users_link.push({\n link_name: 'Регистрация',\n link_path: new_user_path\n })\n @users_link.push({\n link_name: 'Войти',\n link_path: login_path\n })\n end\n end", "def nav_link(text, link, options = {})\n #controller, action=\"index\", show_link=true , css_class='')\n options.reverse_merge! :li_class => '', :show_link => true, :a_class => ''\n if current_page?(link)\n if options[:show_link]\n \"<li class=\\\"current #{options[:li_class]}\\\">#{link_to text, link, :class => options[:a_class]}</li>\"\n else\n \"<li class=\\\"current #{options[:li_class]}\\\">#{text}</li>\"\n end\n else\n \"<li class=\\\"#{options[:li_class]}\\\">#{link_to text, link, :class => options[:a_class]}</li>\"\n end\n end", "def activable_li_tag_with_link(title, *url)\n activable_li_tag *url do\n link_to(title, url.first)\n end\n end", "def nav_link(link_text, icon_text, link_path)\n\t\tclass_name = current_page?(link_path) ? 'current' : ''\n\n\t\tcontent_tag(:li, :class => class_name) do\n\t\t\tlink_to \"#{icon(icon_text)} <span>#{link_text}</span>\".html_safe, link_path\n\t\tend\n\tend", "def link_to_nav(name, url)\n path = request.path\n current = false\n\n # path - url\n # docs/index.html - /docs/index.html\n # docs/index.html - /docs\n # docs/quickstart/dashboard - /docs\n\n # Strip leading / from the url\n testUrl = url[1..-1]\n\n\n if testUrl == path\n # Exact match\n current = true\n elsif path.start_with? testUrl\n # starts with match\n current = true\n end\n\n if current\n link_to name, url, :class => \"active\"\n else\n link_to name, url\n end\n end", "def nav_link(text, path, link_args={})\n if path.kind_of? Array\n current = path.any? do |p|\n current_page?(p)\n end\n path = path[0]\n else\n current = current_page?(path)\n end\n\n link_args[:class] = \"#{current ? 'active' : ''} nav-link #{link_args[:class] || ''}\"\n\n content_tag(:li, link_to(text, path, link_args), class: \"nav-item\")\n end", "def tab_to(*args)\n name = args[0]\n url_options = args[1] || {}\n html_options = args[2]\n url = url_for(url_options)\n\n link = link_to(name, url, html_options)\n\n if request.path == url\n raw \"<li class ='selected'>\" + link + \"</li>\"\n else\n raw \"<li>\" + link + \"</li>\"\n end\n end", "def links_for_item(item)\n links = super(item)\n\n links.push({\n 'rel' => 'status',\n 'type' => api_media_type(:g5kitemjson),\n 'href' => uri_to(File.join(resource_path(item['uid']), 'status'))\n })\n links\n end", "def item_url(item)\n item.url\n end", "def item_url(item)\n item.url\n end", "def nav_link_to(link, url, opts={})\n if current_resource.url == url_for(url)\n opts[:class] << \" active\"\n end\n link_to(link, url, opts)\n end", "def navigation title = nil, title_tag = :h6, &block\n output = String.new()\n output << content_tag( title_tag, title ) unless title.nil?\n output << content_tag(:ul) do\n capture(&block)\n end\n concat output\n end", "def posts_nav_link( sep = '', prelabel = '', nxtlabel = '' )\n args = { sep: sep, prelabel: prelabel, nxtlabel: nxtlabel } # TODO array_filter\n get_posts_nav_link( args )\n end", "def navlistbar_digimag_link\n $tracer.trace(__method__)\n return ToolTag.new(li.className(\"/take part/\").div.className(\"/subnav/\").ul.className(\"/dropdown/\").a(\"/Read Current Issue/\"), __method__)\n end", "def navbar_links\n links = {}\n\n if PerDistrict.new.enabled_class_lists? && PerDistrict.new.show_link_for_class_lists? && ClassListQueries.new(@educator).is_relevant_for_educator?\n links[:classlists] = '/classlists'\n end\n\n if PerDistrict.new.enabled_high_school_levels? && @educator.labels.include?('should_show_levels_shs_link')\n links[:levels_shs] = '/levels/shs'\n end\n\n if PerDistrict.new.enabled_counselor_meetings? && @educator.labels.include?('enable_counselor_meetings_page')\n links[:counselor_meetings] = '/counselors/meetings'\n end\n\n if @educator.districtwide_access?\n links[:district] = '/district'\n end\n\n if @educator.school.present? && (@educator.schoolwide_access? || @educator.has_access_to_grade_levels?) && !@educator.districtwide_access?\n links[:school] = url_helpers.school_path(@educator.school)\n end\n\n if @educator.school.present? && @educator.schoolwide_access? && !@educator.districtwide_access?\n links[:absences] = url_helpers.absences_school_path(@educator.school)\n links[:tardies] = url_helpers.tardies_school_path(@educator.school)\n links[:discipline] = url_helpers.discipline_school_path(@educator.school)\n end\n\n if include_sections_link?(@educator)\n links[:section] = url_helpers.educators_my_sections_path\n end\n\n if @educator.homeroom.present? && !@educator.homeroom.school.is_high_school? && @educator.homeroom.students.active.size > 0\n links[:homeroom] = url_helpers.homeroom_path(@educator.homeroom.id) # explicitly use id, not slug. see Homeroom.rb for more\n end\n\n links\n end", "def nav_link(text, controller, action=\"index\")\n content_tag(:div, \"#{img} #{link}\", :id => \"nav_row\") do\n image_tag(\"red_arrow.jpg\") + link_to_unless_current(text, :id => nil, :action => action, :controller => controller)\n end\n end", "def menu_item(name, path, *link_hashes)\n content_tag :li do\n link = link_to(name, path) if permit_path?(path)\n sub = menu_list_if_permitted(*link_hashes) unless link_hashes.empty?\n link.to_s + sub.to_s\n end\n end", "def user_links_for_navigation_bar\n content_tag(:div, class: 'ml-auto') do\n content_tag(:ul, class: 'navbar-nav ml-auto') do\n # User is not signed in.\n if current_user.nil?\n concat(content_tag(:li, class: 'nav-item active') do\n link_to new_user_session_path, class: 'nav-link' do\n icon('person-check') + ' Log In'\n end\n end)\n concat(content_tag(:li, class: 'nav-item active') do\n link_to new_user_registration_path, class: 'nav-link' do\n icon('person-plus') + ' Sign Up'\n end\n end)\n # User is signed in.\n else\n concat(content_tag(:li, class: 'nav-item active') do\n link_to edit_user_registration_path, class: 'nav-link' do\n icon('gear') + ' Edit Profile'\n end\n end)\n concat(content_tag(:li, class: 'nav-item active') do\n link_to destroy_user_session_path, method: :delete, class: 'nav-link' do\n icon('person-dash') + ' Logout'\n end\n end)\n end\n end\n end\n end", "def index\n\t\t@nav_items = NavItem.all\n\tend", "def nav_link(link_text, link_path)\n class_name = current_page?(link_path) ? 'active' : ''\n\n content_tag(:li, :class => class_name) do\n link_to link_text, link_path\n end\n end", "def index\n @nav_buttons.push('my_projects')\n setup_instance_variables\n end", "def tab(name, options = {})\ns = \"<li\"\ns << \"class = 'current'\" if @current_tab == options[:name] || name.downcase\ns << '>'\ns << link_to(lang, options[:url] || send(\"#{name.downcase}_path\") )\ns << '</li>'\nend", "def nav_menu_item(menu_label, &block)\n \n icon = case menu_label\n when 'category' ; \"<i class='icon-tag'></i>\"\n when 'user' ; \"<i class='icon-user'></i>\"\n when 'post' ; \"<i class='icon-font'></i>\"\n when 'comment' ; \"<i class='icon-comment'></i>\"\n when 'archive' ; \"<i class='icon-upload'></i>\"\n end \n\n menu_label = t(\"activerecord.models.#{menu_label}\")\n content_tag(:li, :class => 'dropdown') do \n link_to(\"#{icon} #{menu_label} <b class='caret'></b>\".html_safe, '#', :class => 'dropdown-toggle', :data => { :toggle => 'dropdown' }) +\n content_tag(:ul, :class => 'dropdown-menu') do \n capture(&block)#yield\n end\n end\n end", "def navlistbar_forums_link\n $tracer.trace(__method__)\n return ToolTag.new(li.className(\"/take-part/\").div.className(\"/subnav/\").ul.className(\"/dropdown/\").a(\"/Forums/\"), __method__)\n end", "def admin_nav_link(controller, url = false, selected_url = false)\n controller_name = controller.gsub(/ /, \"_\").downcase.pluralize\n url = \"/admin/#{controller_name}\" unless url\n\n css = nil\n if selected_url && request.env['REQUEST_URI'] =~ /#{selected_url}/\n css = \"active\"\n elsif request.env['REQUEST_URI'] =~ /#{url}/\n css = \"active\"\n end\n content_tag(:li, link_to(controller, url), class: css, id: \"admin-nav-#{controller_name.dasherize}\")\n end", "def my_links\n end", "def site_page_navigation_menu(pages, menu_html={}, item_html={})\n content_tag :ul, menu_html do\n pages.each do |page|\n site_page_navigation_item(page.name, page_path(page), item_html)\n end\n end\n end", "def nav_link_to(label, path, opts = {})\n if @_nav_mode == :dropdown # We insert dropdown-items\n return link_to(label, path, merge_class_key(opts, 'dropdown-item'))\n end\n\n strict = opts.delete(:strict)\n active = (strict ? (request.fullpath == path) : request.fullpath.include?(path))\n\n # Regular nav link item\n content_tag(:li, class: (active ? 'nav-item active' : 'nav-item')) do\n link_to(label, path, merge_class_key(opts, 'nav-link'))\n end\n end", "def url\n item_path(object)\n end", "def index\n @navitems = Navitem.all\n end", "def url_for_index; end", "def url_for_index; end", "def set_nav_item\n\t\t@nav_item = NavItem.find(params[:id])\n\tend", "def main_menu(identifier)\n find('nav.navbar a', text: identifier)\n end", "def user_nav\n if @current_user\n items = {'Home' => root_path, 'My Account' => account_path, 'My Submissions' => current_user_submissions_path}\n else\n if ApplicationSettings.config['user_registration']\n end\n items = {'Home' => root_path, 'Signup' => signup_path}\n end\n output_nav(items)\n end", "def nav\n [\n {:label => '1. Introduction', :content => '1-introduction.html', :nav => []},\n {:label => '2. Understanding Sphinx', :content => '2-understanding-sphinx.html', :nav => []},\n {:label => '3. Installation', :content => '3-sphinx-installation.html', :nav => []},\n {:label => '4. Address Book Example', :content => '4-address-book-example.html', :nav => []},\n {:label => '5. References', :content => '5-reference.html', :nav => []},\n {:label => '6. Resources', :content => '6-resources.html', :nav => []},\n ]\n end", "def nav_html\n if article?\n article = chapters.first\n nav_list = section_names_and_ids(article).map do |name, id|\n %(<li> <a href=\"#{xhtml(article.fragment_name)}##{id}\">#{name}</a></li>)\n end\n else\n nav_list = manifest.chapters.map do |chapter|\n element = preview? ? chapter.title : nav_link(chapter)\n %(<li>#{element}</li>)\n end\n end\n nav_html_template(manifest.html_title, nav_list)\n end", "def set_navitem\n @navitem = Navitem.find(params[:id])\n end", "def subpage_navigation(page)\n l = \"<ul>\\n\"\n page.pages.each do |page|\n l << page_navigation_helper(page)\n end\n l << \"</ul>\"\n end", "def nav_link_to(text, url, options = {})\n is_active = url_for(url.split(\"#\")[0], relative: false) ==\n url_for(current_page.url, relative: false)\n options[:class] ||= \"\"\n options[:class] << \" active\" if is_active\n link_to(text, url, options)\n end" ]
[ "0.7061633", "0.6789654", "0.6443296", "0.6431617", "0.63335776", "0.62810594", "0.62396413", "0.62377983", "0.6231396", "0.62284994", "0.62132555", "0.62034315", "0.6189186", "0.6165258", "0.61300206", "0.60662365", "0.6043991", "0.60309684", "0.6029809", "0.59971374", "0.59628713", "0.5954509", "0.5947825", "0.5935062", "0.5915667", "0.59026265", "0.59001046", "0.58730155", "0.5869042", "0.5854617", "0.5848494", "0.58479744", "0.5840435", "0.5839968", "0.58345145", "0.5833269", "0.5812275", "0.5797708", "0.579615", "0.57917064", "0.5787572", "0.57847005", "0.57802796", "0.5769155", "0.5752939", "0.5745706", "0.57392067", "0.5738505", "0.57175684", "0.570809", "0.570451", "0.5699626", "0.5694902", "0.56940913", "0.5692223", "0.5689794", "0.56873316", "0.56826675", "0.56687015", "0.5664163", "0.5651641", "0.5643652", "0.56398755", "0.5635944", "0.5635804", "0.56350076", "0.56281567", "0.5623737", "0.56167537", "0.56167537", "0.560011", "0.5591062", "0.5584267", "0.55815995", "0.557748", "0.5574658", "0.5569437", "0.55607116", "0.55336845", "0.5517429", "0.5511931", "0.55053014", "0.5499697", "0.54916227", "0.5491071", "0.5486551", "0.5485579", "0.5475944", "0.5472404", "0.54717624", "0.54673773", "0.54673773", "0.5435118", "0.54327065", "0.5429195", "0.5427201", "0.5420127", "0.54174185", "0.5416007", "0.54155177" ]
0.6479925
2
Generate the last part of the breadcrumb for a static page within a unit
def getPageBreadcrumb(unit, pageName) (!pageName || pageName == "home" || pageName == "campus_landing") and return [] pageName == "search" and return [{ name: "Search", id: unit.id + ":" + pageName}] pageName == "profile" and return [{ name: "Profile", id: unit.id + ":" + pageName}] pageName == "sidebar" and return [{ name: "Sidebars", id: unit.id + ":" + pageName}] p = Page.where(unit_id: unit.id, slug: pageName).first p or halt(404, "Unknown page #{pageName} in #{unit.id}") return [{ name: p[:name], id: unit.id + ":" + pageName, url: "/#{unit.id}/#{pageName}" }] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_breadcrumb\n end", "def breadcrumbs\n breadcrumbs = link_to this_webapp.webapp_name, root_path, :class => 'first-breadcrumb'\n unless @breadcrumb.nil?\n breadcrumbs += content_tag(:label, \" > \")\n if @breadcrumb.kind_of? Picture\n picture = @breadcrumb\n @breadcrumb = @breadcrumb.gallery\n end\n breadcrumbs += parent_breadcrumbs_gallery(@breadcrumb)\n\n unless picture.nil?\n breadcrumbs += content_tag(:label, \" > \")\n breadcrumbs += content_tag(:label, picture.title, :class => 'end-breadcrumb')\n end\n end\n if @finish_breadcrumb\n breadcrumbs + \" > \" + @finish_breadcrumb\n else\n breadcrumbs\n end\n end", "def the_breadcrumb(add_post_type = true)\n generate_breadcrumb(add_post_type)\n h.breadcrumb_draw\n end", "def hardcoded_breadcrumbs\n [\n {\n title: \"Home\",\n url: \"/\",\n },\n {\n title: subtopic.parent.title,\n url: subtopic.parent.base_path,\n },\n {\n title: subtopic.title,\n url: subtopic.base_path,\n },\n ]\n end", "def individual_breadcrumb\n add_breadcrumb \"Clients\", clients_path, :title => \"Clients\" \n add_breadcrumb \"Power Of Attorney\", '', :title => \"Power Of Attorney\" \n add_breadcrumb \"Principal Create\", '', :title => \"Principal Create\"\n end", "def breadcrumb_name\n title\n end", "def breadcrumb(page_slug)\n page_slug.split('/')\n .map { |dir_or_page| WikiPage.unhyphenize(dir_or_page).capitalize }\n .join(' / ')\n end", "def breadcrumb(page_slug)\n page_slug.split('/')\n .map { |dir_or_page| WikiPage.unhyphenize(dir_or_page).capitalize }\n .join(' / ')\n end", "def breadcrumbs() [] end", "def breadcrumbs_for_business_directory_theme \n breadcrumbs = \"\"\n if @text.present?\n breadcrumbs = \"You searched for #{truncate(@text, :length => 30)}\"\n breadcrumbs += \" in #{@postal_code}\" if @postal_code.present?\n elsif @postal_code.present? \n breadcrumbs = \"ZIP: #{@postal_code}\"\n end\n if @category\n if @text.present?\n breadcrumbs += \" in \"\n else\n options = {\n :category_id => nil,\n :iframe_width => params[:iframe_width],\n :iframe_height => params[:iframe_height],\n :layout => @layout,\n :page_size => params[:page_size]\n }\n breadcrumbs += link_to( \"Coupons: \", options )\n end\n if @category.parent \n breadcrumbs += \"#{link_to( h(@category.parent.name), pagination_link_params(@page).merge!( :category_id => @category.parent.to_param) )}: \"\n end\n breadcrumbs += link_to( h(@category.name), pagination_link_params(@page) )\n end\n breadcrumbs = \"&nbsp;\" if breadcrumbs.blank?\n content_tag( :div, breadcrumbs, :class => 'breadcrumbs' )\n end", "def build_breadcrumbs\n @breadcrumbs = [\n { :title => I18n.t(\"admin.sections.#{resource_collection_name}\"), :url => collection_path }\n ]\n @breadcrumbs << { :title => params[:action] } unless params[:action] == 'index'\n end", "def member_breadcrumbs\n add_breadcrumb(@period.name, url_for(@period), true, 'Coaching Period')\n end", "def add_breadcrumb_modulo\n add_breadcrumb pluralize_model(TbAvaliacao), gerente_tb_avaliacoes_path\n end", "def add_breadcrumb_modulo\n add_breadcrumb breadcrumb('administracao.avaliacao.base')\n add_breadcrumb pluralize_model(TbPergunta), administracao_tb_perguntas_path\n end", "def breadcrumb_with_autohier(*args)\n # This method only deals with wiki pages; send the rest to the old method.\n if not @page then\n return breadcrumb_without_autohier args \n end\n elements = args.flatten\n elements.any? ? content_tag('p', args.join('&gt;')+'&gt;'+@page.short_title, :class=>'breadcrumb') : nil\n end", "def home_breadcrumbs(action=\"\")\n crumbs = []\n\n crumbs.push({ \"text\": t(\"defaults.home\"), \"link\": root_path })\n\n case action\n when \"api\"\n crumbs.push({ \"text\": \"API\" })\n\n when \"conferences\"\n crumbs.push({ \"text\": t(\"views.conference.list\") })\n end\n\n render \"partials/breadcrumbs\", crumbs: crumbs\n end", "def breadcrumbs\n @breadcrumbs\n end", "def breadcrumbs\n @breadcrumbs\n end", "def index\n @breadcrumbs = [[t(:units)]]\n @units = @units.order(:name).page(params[:page])\n end", "def page_breadcrumbs(page)\n page.ancestors.reverse.map { |p| link_to(p.name, p.path) }\n end", "def to_breadcrumb\n self.title\n end", "def fetch_categories_crumb(category, link_last_one = true)\n return \"\" unless category\n ancestors = category.ancestors\n last = link_last_one ? \"#{link_to(category.name, category_path(category))}\" : \"#{category.name}\"\n return last if ancestors.empty?\n links = ancestors.inject(\"\") do |acc, elem|\n acc += \"#{link_to(elem.name, category_path(elem))} /\"\n end + last\n end", "def get_text_breadcrumb\r\n bread_crumb_text.text\r\n end", "def root_breadcrumb\n breadcrumb \"Outpost\", outpost_root_path\n end", "def breadcrumbs\n content_tag :ol, class: 'breadcrumb' do\n split_path = request.path.split('/').drop(1)\n concat content_tag :li, (link_to 'Home', '/')\n split_path.each_with_index do |p, i|\n concat content_tag :li, (link_to p.capitalize_each('-'), '/' + split_path.take(i+1).join('/'))\n end\n end\n end", "def parent_breadcrumb(options = {})\n render(options)[-2]\n end", "def get_breadcrumbs\n current = @product || @brand || @category || @page\n # BreadcrumbsMaker.build current, params\n make_breadcrumbs current\n end", "def goldberg_breadcrumbs\n render :file => \"#{RAILS_ROOT}/vendor/plugins/goldberg/app/views/goldberg/menu_items/_breadcrumbs.rhtml\", :use_full_path => false, :locals => {:crumbs => Goldberg.menu.crumbs}\n end", "def breadcrumbs\n home = link_to(image_tag('home.png', :class => 'home'), '/', :title => t('app.home'))\n breadcrumbs = [home] + crumbs.split(Breadcrumb.instance.delimiter)\n content_tag(:ul, breadcrumbs.map { |trail| content_tag(:li, trail) }, :id => 'breadcrumb')\n end", "def f_places_breadcrumb\n ancestor_list = @feature.nil? ? nil : @feature.closest_ancestors_by_perspective(current_perspective).drop(1)\n f_breadcrumb(ancestor_list)\n end", "def render_breadcrumb(options={})\n default_options = {\n :seperator => %(<span class=\"seperator\">></span>),\n :page => current_page,\n :without => nil\n }\n options = default_options.merge(options)\n bc = \"\"\n pages = breadcrumb(options[:page])\n pages.delete(Page.root)\n unless options[:without].nil?\n unless options[:without].class == Array\n pages.delete(options[:without])\n else\n pages = pages - options[:without]\n end\n end\n pages.each do |page|\n if page.name == current_page.name\n css_class = \"active\"\n elsif page == pages.last\n css_class = \"last\"\n elsif page == pages.first\n css_class = \"first\"\n end\n if (page == Page.language_root(session[:language]))\n if configuration(:redirect_index)\n url = show_page_url(:urlname => page.urlname)\n else\n url = index_url\n end\n else\n url = show_page_url(:urlname => page.urlname)\n end\n bc << link_to( h(page.name), url, :class => css_class, :title => page.title )\n unless page == pages.last\n bc << options[:seperator]\n end\n end\n bc\n end", "def add_breadcrumbs\n breadcrumb_for \"index\" # base\n\n if action_name != \"index\"\n breadcrumb_for action_name\n end\n end", "def breadcrumb\n Array(@breadcrumb)\n\tend", "def breadcrumb(object, level = 0)\n path = (\"../\" * level) + object.name + \".html\"\n link = link_to(object.name, path)\n\n if object.parent.kind_of?(RDoc::TopLevel)\n link\n else\n breadcrumb(object.parent, level+1) + \"&nbsp; > &nbsp;\" + link\n end\n end", "def member_breadcrumbs\n add_breadcrumb(@assignment.period.name, url_for(@assignment.period), @assignment.period.can_view?(current_user), 'Coaching Period')\n if @assignment.group \n add_breadcrumb(@assignment.group.display_name, url_for(@assignment.group), @assignment.group.can_view?(current_user), 'Coaching Group')\n elsif @assignment.team\n add_breadcrumb(@assignment.team.display_name, url_for(@assignment.team), @assignment.team.can_view?(current_user), 'Team')\n end\n add_breadcrumb(@assignment.user.display_name, url_for(@assignment), true, 'Assignment')\n end", "def create_crumb_link(uri,text,end_of_trail)\n link = \"\"\n if end_of_trail\n #link = link_to(text.to_s, uri.to_s, :style=>\"font-weight: bold\")\n link = render :inline=>\"<strong>#{text}</strong>\"\n else\n link = link_to(shrink_text(text.to_s), uri.to_s)\n end\n return link\n end", "def breadcrumb\n add_breadcrumb \"Users\", persons_path if @rider.book\n add_breadcrumb \"Master book\", master_riders_path if @rider.is_master?\n\n add_breadcrumb @rider.book.person.first_name, person_path(@rider.book.person) if @rider.book\n add_breadcrumb @rider.book.number, person_book_path(@rider.book.person, @rider.book) if @rider.book\n if @rider.is_master?\n add_breadcrumb @rider.book.number, master_book_path(@rider.book) \n else\n add_breadcrumb @rider.book.number, book_rider_path(@rider.book, @rider)\n end\n add_breadcrumb @rider.name, book_rider_path(@rider.book, @rider) if @rider\n end", "def assert_last_page\n assert_no_link NEXT_LABEL\n end", "def breadcrumbs(separator=\" / \")\n crumbs = env[\"PATH_INFO\"].split(\"/\").map {|path| { :path => path, :name => path } }\n crumbs[0] = { :path => \"/\", :name => \"projects\" }\n crumbs = crumbs[0..-2].inject([]) do |crumbs_so_far, current|\n crumbs_so_far << %(<a href=\"#{current[:path]}\">#{current[:name]}</a>)\n end << crumbs.last[:name]\n crumbs.join(separator)\n end", "def index\n @breadcrumbs = [[\"#{t(:accounting_plans)}\"]]\n init\n end", "def breadcrumbs(pages)\n klass = ->(total, index) {\n total == index ? 'is-active' : 'u-underline-on-hover is-hidden-mobile'\n }\n\n max_index = pages.length - 1\n\n pages.map.with_index do |(page, link), index|\n content_tag('li', class: klass.call(max_index, index)) do\n link_to(page, link)\n end\n end.join('').html_safe\n end", "def pickup_breadcrumbs\n @bcname = request.path.inspect\n case\n when request.path == \"/\"\n @bcname = Bcrmb.find_by_bckey(\"home\").name\n when request.path =~ /(\\/as\\w\\w\\/)(\\w+)/\n token2in_path = $2\n if (mybc = Bcrmb.find_by_bckey(token2in_path))\n @bcname = mybc.send(:name)\n else\n @bcname = Bcrmb.find_by_bckey(\"allbc\").name\n end # if\n else\n @bcname = Bcrmb.find_by_bckey(\"allbc\").name\n end # case\n\n end", "def breadcrumbs\n configuration.breadcrumbs\n end", "def index\n @breadcrumbs = nil\n end", "def last_folder\n return content_path unless request.params.has_key?(\"page\")\n path = request.params[\"page\"].split('/')\n File.join(content_path, path[0..-2])\n end", "def last_folder\n return content_path unless request.params.has_key?(\"page\")\n path = request.params[\"page\"].split('/')\n File.join(content_path, path[0..-2])\n end", "def breadcrumbs\n\t\trender :breadcrumbs\n\tend", "def type_and_parent_types_breadcrumbs(type)\n types = type.type_and_parent_types.reverse\n add_breadcrumb(types.first.full_name, aircraft_family_path(types.first.slug))\n types[1..-1].each do |t|\n add_breadcrumb(t.name, aircraft_family_path(t.slug))\n end\n end", "def get_bread_crumbs(url,sep)\n begin\n retVal = \"\"\n url.gsub!(/\\?.*$/,\"\")\n unless url.split(/\\//).length <= 3\n elements = url.split('/')\n project_id = \"\"\n project_title = \"\"\n study_id = \"\"\n study_title = \"\"\n no_match = false\n is_end_of_trail = false\n\n # the string to return\n retVal = image_tag(\"Computer-silk.png\", :style=> \"border: 0px; vertical-align: top\", :alt => \"computer\") + \" \"\n retVal = retVal + link_to(\"My Work\", \"/\") + \" \"\n\n # remove the https://www.srdr.com bit from the array\n elements = elements[3..elements.length-1]\n\n i = 0\n elements.each do |element|\n if i == elements.length - 1\n is_end_of_trail = true\n end\n\n retVal = retVal + image_tag(\"Silk_arrow_right_gray.png\", :style=>\"border: 0px; vertical-align:top;\", :alt => \"arrow\") + \" \"\n case element\n when \"extraction_forms\"\n if project_id.to_s.empty?\n efid = elements[i+1]\n ef = ExtractionForm.find(efid,:select=>[\"project_id\"])\n unless ef.nil?\n project_id = ef.project_id\n end\n session[:project_id] = project_id\n end\n extraction_form_uri=\"/projects/#{project_id.to_s}/extractionforms\"\n retVal = retVal + image_tag(\"Table-silk.png\", :style=> \"border: 0px; vertical-align: top;\", :alt => \"table\") + \" \" + create_crumb_link(extraction_form_uri,\" Extraction Forms\",is_end_of_trail)\n when \"projects\"\n project_uri\t= \"/projects/\"\n retVal = retVal + image_tag('Folder-silk.png', :style=> \"border: 0px; vertical-align: top;\", :alt => \"folder\") + \" \" + create_crumb_link(project_uri, \"My Projects\", is_end_of_trail)\n #print \"In the projects block and retVal is now #{retVal}...\\n\\n\"\n\n when \"studies\"\n study_uri = \"/projects/#{project_id.to_s}/studies\"\n retVal = retVal + image_tag(\"Book-silk.png\", :style=> \"border: 0px; vertical-align: top;\", :alt=>\"book\") + \" \" + create_crumb_link(study_uri,\"Studies\", is_end_of_trail)\n\n when \"home\"\n retVal.gsub!(/\\>\\s$/,\"\")\n\n when \"account\"\n retVal = retVal + image_tag(\"User.png\", :style=> \"border: 0px; vertical-align: top;\", :alt => \"user\") + \" \" + create_crumb_link('/account/','Account',true) + \" \"\n\n when \"search\"\n retVal = retVal + image_tag(\"Zoom.png\", :style=> \"border: 0px; vertical-align: top;\", :alt => \"search\") + \" \" + create_crumb_link('/search/','Search',true) + \" \"\n retVal.gsub!(/\\>$/,\"\")\n\n when \"demo1\"\n retVal = retVal + image_tag(\"film.png\", :style=> \"border: 0px; vertical-align: top;\") + \" \" + create_crumb_link('/home/demo1/','Demo 1: Viewing and Creating Projects',true) + \" \"\n retVal.gsub!(/\\>$/,\"\")\n\n when \"demo2\"\n retVal = retVal + image_tag(\"film.png\", :style=> \"border: 0px; vertical-align: top;\") + \" \" + create_crumb_link('/home/demo2/','Demo 2: Creating and Editing Extraction Form Templates',true) + \" \"\n retVal.gsub!(/\\>$/,\"\")\n\n when \"demo3\"\n retVal = retVal + image_tag(\"film.png\", :style=> \"border: 0px; vertical-align: top;\") + \" \" + create_crumb_link('/home/demo3/','Demo 3: Viewing, Editing and Creating Study Records ',true) + \" \"\n retVal.gsub!(/\\>$/,\"\")\n\n when /^\\d+/\n\n previous = elements[i-1]\n if previous == \"projects\"\n project_id = element.to_i\n project_title = Project.find(project_id,:select=>\"title\")\n unless project_title.nil?\n project_title = project_title.title\n else\n project_title = \"New Project\"\n end\n project_uri = \"/projects/#{project_id.to_s}/edit\"\n retVal = retVal + image_tag(\"Folder_edit.png\", :style=> \"border: 0px; vertical-align: top;\") + \" \" + create_crumb_link(project_uri, project_title, is_end_of_trail)\n\n elsif previous == \"studies\"\n study_id = element.to_i\n study_title = PrimaryPublication.find(:first,:conditions=>[\"study_id=?\",study_id],:select=>\"title\")\n unless study_title.nil?\n study_title = study_title.title\n else\n study_title=\"New Study\"\n end\n study_uri = \"/projects/#{project_id.to_s}/studies/#{study_id.to_s}\"\n retVal = retVal + image_tag(\"Book_edit.png\", :style=> \"border: 0px; vertical-align: top;\") + \" \" + create_crumb_link(study_uri, study_title, is_end_of_trail)\n\n elsif previous == \"extraction_forms\"\n extraction_form_id = element.to_i\n extraction_form_title = ExtractionForm.find(extraction_form_id)\n unless extraction_form_title.nil?\n extraction_form_title = extraction_form_title.title\n else\n extraction_form_title = \"Untitled\"\n end\n extraction_form_uri = \"/projects/#{project_id.to_s}/extraction_forms/#{extraction_form_id.to_s}/edit\"\n retVal = retVal + image_tag(\"Table_edit.png\", :style=> \"border: 0px; vertical-align: top;\") + \" \" + create_crumb_link(extraction_form_uri,extraction_form_title,is_end_of_trail)\n else\n # fill this in for other types of urls\n end\n when /^\\w+/\n text = case element\n # these should be consistent now\n when \"extractionforms\" then \"Manage Extraction Forms\"\n when \"questions\" then \"Key Questions\"\n when \"publications\" then \"Publications\"\n when \"arms\" then \"Arms\"\n when \"design\" then \"Design Details\"\n when \"baselines\" then \"Baseline Characteristics\"\n when \"outcomes\" then \"Outcomes\"\n when \"results\" then \"Outcome Data\"\n when \"adverse\" then \"Adverse Events\"\n when \"quality\" then \"Study Quality\"\n else element.to_s.capitalize\n end\n\n edits_arr = [\"Key Questions\", \"Publications\", \"Study Arms\", \"Study Design\", \"Baseline Characteristics\", \"Outcomes\", \"Results Entry\", \"Adverse Events\", \"Study Quality\"]\n\n #print \"Found #{element.to_s}\\n\\n\"\n if text == \"Edit\"\n retVal = retVal + image_tag(\"Pencil.png\", :style=> \"border: 0px; vertical-align: top\") + \" \"\n elsif edits_arr.include?(text)\n retVal = retVal + image_tag(\"Pencil.png\", :style=> \"border: 0px; vertical-align: top\") + \" \" + create_crumb_link(\"\",text,is_end_of_trail)\n else\n retVal = retVal + create_crumb_link(\"\",text,is_end_of_trail)\n end\n retVal.gsub!(/\\>\\s$/,\"\")\n else\n # get rid of the trailing characters\n # is doing two chops more efficient?\n retVal.gsub!(/\\>\\s$/,\"\")\n no_match = true\n end\n retVal = retVal + \" \"\n i = i+1\n end\n end #ending the unless statement at the top\n return retVal\n\n rescue\n return \"Error in breadcrumbs: \" + elements[elements.length-1]\n end\n end", "def f_breadcrumb(feature)\n # content_tag :div, acts_as_family_tree_breadcrumb(feature, breadcrumb_separator) {|r| f_link(r, feature_path(r.fid), {}, {:s => true})}, :class => \"breadcrumbs\"\n content_tag :div, feature.closest_ancestors_by_perspective(current_perspective).collect{|r| f_link(r, feature_path(r.fid), {}, {:s => true})}.join(breadcrumb_separator).html_safe, :class => \"breadcrumbs\"\n end", "def auto_set_breadcrumb\n ariane.add(\"Home\", root_path, 1) if ariane.crumbs.empty? \n \n if self.action_name == \"index\"\n name = controller_name.titleize\n level = get_level || 2\n else\n name = \"#{action_name.titleize} #{controller_name.singularize.titleize}\"\n level = get_level || 3\n end\n\n ariane.add(name, request.fullpath, level)\n end", "def make_crumb(crumb)\n return ['Home', '/'] if crumb.empty?\n if crumb.instance_of? String\n break_off_crumbs(crumb)\n elsif crumb.instance_of? Array\n return crumb if crumb.size > 1\n return ['Home', '/'] if crumb[0].empty?\n title = crumb[0].split('/').last.split(/_|\\s/).each { |word| word.capitalize! }.join(' ') unless crumb[0].nil?\n [title, crumb[0]]\n end\n end", "def regular_compact_breadcrumbs(document)\n breadcrumb_links = []\n breadcrumb_links << add_campus_link(document) unless document.campus.nil?\n breadcrumb_links << add_parent_campus_link(document) unless document.parent_campus.nil? && !document.campus.nil?\n breadcrumb_links << build_repository_link(document)\n\n parents = document_parents(document)\n breadcrumb_links << parents[0, 1].map do |parent|\n link_to parent.label, solr_document_path(parent.global_id)\n end\n\n breadcrumb_links << '&hellip;'.html_safe if parents.length > 1\n\n safe_join(\n breadcrumb_links,\n aria_hidden_breadcrumb_separator\n )\n end", "def back_link(levels_up=1)\n # TODO: factor this out a bit between parent_dir_name\n if levels_up.is_a?(Integer) && levels_up > 0 && levels_up < path.split('/').size\n dir_name = path.split('/')[(levels_up + 1) * -1]\n dir_name = 'index' if dir_name.empty?\n (['..'] * (levels_up)).join('/') + \"/#{dir_name}.html\"\n else\n # Give the root index if we're confused\n root? ? '' : (['..'] * (path.split('/').size)).join('/') + '/index.html'\n end\n end", "def add_breadcrumb_coupon\n add_breadcrumb @coupon.name.truncate(45)\n end", "def add_breadcrumb name, url = ''\n @breadcrumbs ||= []\n url = eval(url) if url =~ /_path|_url|@/\n @breadcrumbs << [name, url]\n end", "def show\n breadcrumb\n end", "def add_breadcrumb name, url = ''\n\t\t@breadcrumbs ||= []\n\t\t url = eval(url) if url =~ /_path|_url|@/\n\t\t@breadcrumbs << [name, url]\n\tend", "def bobcat_breadcrumb_base_url\n get_institution_or_default(:bobcat_url)\n end", "def new\n build_breadcrumbs\n end", "def new\n build_breadcrumbs\n end", "def breadcrumb action = @action, acc = []\n begin\n (parent_actions ||= []) << action\n end while action.breadcrumb_parent && (action = action(*action.breadcrumb_parent))\n\n content_tag(:ul, :class => \"breadcrumb\", :id => \"breadcrumb\") do\n parent_actions.map do |a|\n am = a.send(:eval, 'bindings[:abstract_model]')\n o = a.send(:eval, 'bindings[:object]')\n content_tag(:li, :class => current_action?(a, am, o) && \"active\") do\n crumb = if a.http_methods.include?(:get)\n current_action?(a, am, o) ? aclass = 'pjax tip-bottom current' : aclass = 'pjax tip-bottom'\n if a.action_name == :dashboard\n adata = t('admin.menu.Gohome')\n else\n adata = t('admin.menu.Gosection')\n end\n link_to locale_url_for(:action => a.action_name, :controller => 'rails_admin/main', :model_name => am.try(:to_param), :id => (o.try(:persisted?) && o.try(:id) || nil)), \"data-original-title\" => adata, :class => aclass do\n if a.action_name == :dashboard\n icon = content_tag(:i, '', :class => 'icon-home')\n else\n icon = ''\n end\n icon + wording_for(:breadcrumb, a, am, o)\n end\n else\n content_tag(:span, wording_for(:breadcrumb, a, am, o))\n end\n #crumb+= content_tag(:span, '/', :class => 'divider') unless current_action?(a, am, o)\n crumb+= content_tag(:span, '') unless current_action?(a, am, o)\n crumb\n end\n end.reverse.join().html_safe\n end\n end", "def breadcrumb_remove\n temp = @breadcrumb.split( @separator )\n temp.pop()\n @element_name = temp[-1]\n @breadcrumb = temp.join( @separator )\n end", "def render_breadcrumb ( menu , options )\n links = []\n item = current_item(menu)\n if item != nil\n links << render_breadcrumb_node(item, options)\n while item.parent != nil do\n if item.parent.is_a? Symbol\n links << link_to( 'Home', '/' , {:class=>options[:link_class]} ).html_safe + ' > '.html_safe\n break\n else\n links << render_breadcrumb_node(item.parent, options).html_safe + ' > '.html_safe\n item = item.parent\n end\n end\n end\n links = links.reverse\n links.empty? ? '' : content_tag('div', links.join(\"\\n\") , :class=>options[:div_class]).html_safe\n end", "def subpage_navigation(page)\n l = \"<ul>\\n\"\n page.pages.each do |page|\n l << page_navigation_helper(page)\n end\n l << \"</ul>\"\n end", "def set_root_breadcrumb\n add_breadcrumb '<span class=\"fa fa-lg\">&#xf015</span><span class=\"sr-only\">Top</span>'.html_safe, root_path\n end", "def documentation_breadcrumb_for(page, options = {})\n options[:root_link] = options[:root_link].nil? ? t('documentation.helpers.documentation_breadcrumb_for.default_root_link') : options[:root_link]\n options[:class] ||= 'breadcrumb'\n\n String.new.tap do |s|\n s << \"<nav class='#{options[:class]}'><ul>\"\n\n if options[:root_link]\n s << \"<li><a href='#{documentation_doc_root.blank? ? '/' : documentation_doc_root}'>#{options[:root_link]}</a></li>\"\n end\n\n if page.is_a?(::Documentation::Page)\n page.breadcrumb.each do |child|\n s << \"<li><a href='#{documentation_doc_root}/#{child.full_permalink}'>#{child.title}</a></li>\"\n end\n end\n\n s << \"</ul></nav>\"\n end.html_safe\n end", "def generate_breadcrumb(folder, arr = [])\n if folder.folder_id.nil?\n arr.unshift(folder)\n else\n # we add current id in first position\n arr.unshift(folder)\n # we get the parent folder\n parent_folder = Folder.find(folder.folder_id)\n # we call the function with parent folder\n generate_breadcrumb(parent_folder, arr)\n end\n end", "def fetch_product_crumb(product)\n return \"\" unless product\n \"#{fetch_categories_crumb(product.category)} / #{[product.name]}\"\n end", "def show\n @breadcrumbs = [[\"Home\", root_url], [@facility.citizen,\"/citizens/#{@facility.citizen.id}?tab=facilities\"], [@facility, \"/facilities/#{@facility.id}\"]]\n end", "def assert_not_first_page\n assert_link PREV_LABEL\n end", "def add_resource_breadcrumb(resource)\n ancestor_nodes(resource).each do |node|\n @breadcrumbs << { name: node, url: url_for( action: :edit, id: node.id ) }\n end\n super\n end", "def breadcrumbs\n migajas_env[\"app.breadcrumbs\"] ||= Trail.new(migajas_env)\n end", "def render_breadcrumb(options = {})\n options = {\n separator: \">\",\n page: @page,\n restricted_only: false,\n reverse: false,\n link_active_page: false\n }.merge(options)\n\n pages = options[:page]\n .self_and_ancestors.contentpages\n .published\n\n if options.delete(:restricted_only)\n pages = pages.restricted\n end\n\n if options.delete(:reverse)\n pages = pages.reorder(\"lft DESC\")\n end\n\n if options[:without].present?\n without = options.delete(:without)\n pages = pages.where.not(id: without.try(:collect, &:id) || without.id)\n end\n\n render \"alchemy/breadcrumb/wrapper\", pages: pages, options: options\n end", "def assign_breadcrumb\n if page.present?\n self.page.breadcrumb ||= page.title\n end\n end", "def assign_breadcrumb\n if page.present?\n self.page.breadcrumb ||= page.title\n end\n end", "def quicklinks_bottom\n 'En apprendre encore plus sur l’atelier Icare ?'.in_h3 +\n menu_links_overview.in_ul(class: 'tdm_bottom_page')\n end", "def manageable_breadcrumbs(options = {})\n items = Helpers::NavigationBuilder.new\n yield items if block_given?\n\n options[:class] ||= \"\"\n options[:class] << \" breadcrumb\"\n options[:class].strip!\n\n content_tag(\"div\", options) do\n content_tag(\"ul\") do\n items.collect { |item|\n content_tag(\"li\", :class => item[:class]) do\n if item[:active]\n item[:label]\n else\n link_to(item[:label], item[:href])\n end\n end\n }.join(\"\").html_safe\n end\n end\n end", "def more_rest\n add_breadcrumb \"Waktu Kerja dan Lembur\", \"#absences\"\n add_breadcrumb \"Istirahat Lebih\", \"#more_rest\"\n render :layout => false\n end", "def nav_bar\n path_array = self.current_page.split(\"/\").drop(1)\n path_count = path_array.count\n params = self.request_params_display\n \n if URI.unescape(self.current_page) == \"/\"\n nav_bar = \"Index of /\"\n else\n nav_bar = \"Index of <a href=\\'/#{params}'>/</a>\"\n end\n \n previous_path = \"\"\n 0.upto(path_array.count - 1) do |a|\n \n ##\n # Get escaped versions of this path and previous path\n \n escaped_path = path_array[a].gsub(\" \", \"%20\").gsub(\"'\", \"%27\")\n escaped_previous = previous_path.gsub(\" \", \"%20\").gsub(\"'\", \"%27\")\n \n ##\n # If this is the last directory in the path, it shouldn't have a link\n \n if a == path_array.count - 1\n href = \"\"\n else\n href = \"<a href=\\'/#{escaped_previous}#{escaped_path}#{params}\\'>\"\n end\n \n ##\n # If this is the first directory above the root, don't prepend a slash\n \n if a == 0 \n nav_bar << \" #{href}#{path_array[a]}</a>\"\n else\n nav_bar << \" / #{href}#{path_array[a]}</a>\"\n end\n \n previous_path << path_array[a] + \"/\"\n end\n \n @nav_bar = nav_bar\n \n end", "def fname_breadcrumb(feature_name)\n acts_as_family_tree_breadcrumb(feature_name) {|r| fname_label(r)}\n\tend", "def breadcrumbs_for(category_leaf: nil, concept: nil, dataset: nil)\n # start with the root\n breadcrumb 'home', categories_path, match: :exact\n\n # basic breadcrumbs for dataset\n breadcrumb (dataset.name || ''), dataset_path(dataset) if dataset.present?\n\n return if category_leaf.nil?\n\n # build the breadcrumbs for the category's parent-tree\n category_leaf.ancestors.each do |category|\n breadcrumb (category.name || ''), category_path(category)\n end\n\n # ancestors doesn't include the leaf category (just it's parents)\n breadcrumb (category_leaf.name || ''), category_path(category_leaf)\n\n # finally, add the concept if it's there\n breadcrumb (concept.name || ''), concept_path(concept) if concept.present?\n end", "def r_breadcrumbs(&block)\n content_tag(\"div\", &block)\n end", "def breadcrumb_add element_name\n @breadcrumb = @breadcrumb + @separator + element_name\n end", "def set_breadcrumbs\n @breadcrumbs = []\n add_breadcrumb \"Home\", root_path\n end", "def set_breadcrumbs\n @breadcrumbs = []\n add_breadcrumb \"Home\", root_path\n end", "def last\n goto(last_page_index())\n end", "def breadcrumbs_label(text = nil)\n $tracer.trace(__method__)\n tag = div.className(\"/results_header/\")\n if(text.nil?)\n return ToolTag.new(tag.find.div, __method__)\n else\n return ToolTag.new(tag.find.div(text), __method__)\n end\n end", "def getUnitHeader(unit, pageName=nil, attrs=nil)\n if !attrs then attrs = JSON.parse(unit[:attrs]) end\n r = UnitHier.where(unit_id: unit.id).where(ancestor_unit: $activeCampuses.keys).first\n campusID = (unit.type=='campus') ? unit.id : r ? r.ancestor_unit : 'root'\n header = {\n :campusID => campusID,\n :campusName => $unitsHash[campusID].name,\n :campuses => $activeCampuses.values.map { |c| {id: c.id, name: c.name} }.unshift({id: \"\", name: \"eScholarship at...\"}),\n :logo => getLogoData(attrs['logo']),\n :nav_bar => getNavBar(unit.id, pageName, attrs['nav_bar']),\n :social => {\n :facebook => attrs['facebook'],\n :twitter => attrs['twitter'],\n :rss => attrs['rss']\n },\n :breadcrumb => (unit.type!='campus') ?\n traverseHierarchyUp([{name: unit.name, id: unit.id, url: \"/uc/\" + unit.id}]) + getPageBreadcrumb(unit, pageName)\n : getPageBreadcrumb(unit, pageName)\n }\n\n # if this unit doesn't have a nav_bar, get the next unit up the hierarchy's nav_bar\n if !header[:nav_bar] and unit.type != 'campus'\n ancestor = $hierByUnit[unit.id][0].ancestor\n until header[:nav_bar] || ancestor.id == 'root'\n header[:nav_bar] = JSON.parse(ancestor[:attrs])['nav_bar']\n ancestor = $hierByUnit[ancestor.id][0].ancestor\n end\n end\n\n return header\nend", "def fname_breadcrumb(feature_name)\n acts_as_family_tree_breadcrumb(feature_name) {|r| fname_label(r)}\n end", "def assert_first_page\n assert_no_link PREV_LABEL\n end", "def index \n add_breadcrumb \"Administrar\", :sections_path\n add_breadcrumb \"Recursos\", :resources_path \n end", "def page_title\n if content_for?(:page_title)\n \"#{content_for(:page_title)} - \"\n elsif !breadcrumb_names.empty?\n \"#{breadcrumb_names.reverse.join(' - ')} - \"\n else\n ''\n end +\n t('layout.coursemology')\n end", "def create_navigation_links(actual_page, total_pages, system, sort_by)\n links = \"\"\n if total_pages.to_i > 7\n if actual_page > 1\n links << create_nav_link(\"<<\", 1, system, sort_by, false)\n links << create_nav_link(\"<\", actual_page.to_i - 1, system, sort_by, false)\n if actual_page > 4\n links << \"...\"\n end\n end\n # decide where the actual page is to display\n i=actual_page.to_i - 3 if actual_page.to_i > 3 && actual_page.to_i < total_pages.to_i - 2\n i=actual_page.to_i - 2 if actual_page.to_i == 3\n i=actual_page.to_i - 1 if actual_page.to_i == 2\n i=actual_page.to_i if actual_page.to_i == 1\n i=actual_page.to_i - 4 if actual_page.to_i == total_pages.to_i - 2\n i=actual_page.to_i - 5 if actual_page.to_i == total_pages.to_i - 1\n i=actual_page.to_i - 6 if actual_page.to_i == total_pages.to_i\n 7.times do\n links << create_nav_link(i, i, system, sort_by, i== actual_page.to_i)\n i += 1\n end\n if actual_page < total_pages\n if actual_page < total_pages -3\n links << \"...\"\n end\n if actual_page < total_pages.to_i\n links << create_nav_link(\">\", actual_page + 1, system, sort_by, false)\n links << create_nav_link(\">>\", total_pages, system, sort_by, false)\n end\n end\n else\n i = 1\n total_pages.to_i.times do\n links << create_nav_link(i, i, system, sort_by, i == actual_page.to_i)\n i += 1\n end\n end\n links \n end", "def add_breadcrumb title, link = nil\n if link.nil?\n @breadcrumbs << { :title => title }\n else\n @breadcrumbs << { :title => title, :link => link }\n end\n end", "def add_breadcrumb title, link = nil\n if link.nil?\n @breadcrumbs << { :title => title }\n else\n @breadcrumbs << { :title => title, :link => link }\n end\n end", "def break_off_crumbs(uri)\n crumbs = []\n split_uri = uri.split('/')\n split_uri.each_with_index do |crumb, i|\n crumbs << make_crumb([split_uri[0..i].join('/')])\n end\n crumbs\n end", "def breadcrumbs(links)\n bcs = []\n\n position = 1\n links.each do |link|\n bcs << single(position: position, **symbolize_keys(link))\n position += 1\n end\n\n return %(<ol class=\"breadcrumbs\" vocab=\"http://schema.org/\" typeof=\"BreadcrumbList\">#{bcs.join(@divider)}</ol>)\n end", "def wizard_page_template(main_wizard_model) \n# \"#{main_wizard_model.class.to_s.underscore}_wizard_pages/#{main_wizard_model.current_template}\" \n path = @controller.class.controller_path\n\n \"#{path}/sub_pages/#{main_wizard_model.current_template}\" \n end", "def assert_not_last_page\n assert_link NEXT_LABEL\n end" ]
[ "0.64884925", "0.64713144", "0.6470853", "0.640594", "0.640171", "0.6315557", "0.6289883", "0.6289883", "0.62805516", "0.62773037", "0.62586904", "0.6146591", "0.61463636", "0.604957", "0.6041256", "0.6034665", "0.60077864", "0.60077864", "0.599243", "0.5989021", "0.59852535", "0.59613305", "0.59517473", "0.59494394", "0.593467", "0.5929374", "0.5887128", "0.58807844", "0.5864844", "0.5860732", "0.58560646", "0.58458465", "0.58376986", "0.5812345", "0.5808172", "0.57958615", "0.5788549", "0.5768239", "0.5762405", "0.57601535", "0.57442665", "0.5741922", "0.5720049", "0.57074845", "0.5707203", "0.5707203", "0.570288", "0.57013583", "0.57002026", "0.5689857", "0.568091", "0.5678405", "0.5639056", "0.56082994", "0.56071544", "0.55835885", "0.55744606", "0.55708957", "0.55573404", "0.5553264", "0.5553264", "0.55467296", "0.5543651", "0.55410767", "0.55351067", "0.5534317", "0.55305433", "0.5524681", "0.5517086", "0.5513362", "0.54997647", "0.5496011", "0.5486705", "0.54685915", "0.54670215", "0.54670215", "0.5440322", "0.54180354", "0.5409532", "0.5390373", "0.53846353", "0.5380111", "0.53599066", "0.5354278", "0.5351115", "0.5351115", "0.53474", "0.53415966", "0.53403217", "0.53388923", "0.53371966", "0.53315794", "0.53158504", "0.53084916", "0.5283736", "0.5283736", "0.5265248", "0.5261589", "0.5259422", "0.5259323" ]
0.6657726
0
Generate breadcrumb and header content for Unitbranded pages
def getUnitHeader(unit, pageName=nil, attrs=nil) if !attrs then attrs = JSON.parse(unit[:attrs]) end r = UnitHier.where(unit_id: unit.id).where(ancestor_unit: $activeCampuses.keys).first campusID = (unit.type=='campus') ? unit.id : r ? r.ancestor_unit : 'root' header = { :campusID => campusID, :campusName => $unitsHash[campusID].name, :campuses => $activeCampuses.values.map { |c| {id: c.id, name: c.name} }.unshift({id: "", name: "eScholarship at..."}), :logo => getLogoData(attrs['logo']), :nav_bar => getNavBar(unit.id, pageName, attrs['nav_bar']), :social => { :facebook => attrs['facebook'], :twitter => attrs['twitter'], :rss => attrs['rss'] }, :breadcrumb => (unit.type!='campus') ? traverseHierarchyUp([{name: unit.name, id: unit.id, url: "/uc/" + unit.id}]) + getPageBreadcrumb(unit, pageName) : getPageBreadcrumb(unit, pageName) } # if this unit doesn't have a nav_bar, get the next unit up the hierarchy's nav_bar if !header[:nav_bar] and unit.type != 'campus' ancestor = $hierByUnit[unit.id][0].ancestor until header[:nav_bar] || ancestor.id == 'root' header[:nav_bar] = JSON.parse(ancestor[:attrs])['nav_bar'] ancestor = $hierByUnit[ancestor.id][0].ancestor end end return header end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def individual_breadcrumb\n add_breadcrumb \"Clients\", clients_path, :title => \"Clients\" \n add_breadcrumb \"Power Of Attorney\", '', :title => \"Power Of Attorney\" \n add_breadcrumb \"Principal Create\", '', :title => \"Principal Create\"\n end", "def breadcrumb_with_autohier(*args)\n # This method only deals with wiki pages; send the rest to the old method.\n if not @page then\n return breadcrumb_without_autohier args \n end\n elements = args.flatten\n elements.any? ? content_tag('p', args.join('&gt;')+'&gt;'+@page.short_title, :class=>'breadcrumb') : nil\n end", "def breadcrumbs\n breadcrumbs = link_to this_webapp.webapp_name, root_path, :class => 'first-breadcrumb'\n unless @breadcrumb.nil?\n breadcrumbs += content_tag(:label, \" > \")\n if @breadcrumb.kind_of? Picture\n picture = @breadcrumb\n @breadcrumb = @breadcrumb.gallery\n end\n breadcrumbs += parent_breadcrumbs_gallery(@breadcrumb)\n\n unless picture.nil?\n breadcrumbs += content_tag(:label, \" > \")\n breadcrumbs += content_tag(:label, picture.title, :class => 'end-breadcrumb')\n end\n end\n if @finish_breadcrumb\n breadcrumbs + \" > \" + @finish_breadcrumb\n else\n breadcrumbs\n end\n end", "def the_breadcrumb(add_post_type = true)\n generate_breadcrumb(add_post_type)\n h.breadcrumb_draw\n end", "def breadcrumb\n add_breadcrumb \"Users\", persons_path if @rider.book\n add_breadcrumb \"Master book\", master_riders_path if @rider.is_master?\n\n add_breadcrumb @rider.book.person.first_name, person_path(@rider.book.person) if @rider.book\n add_breadcrumb @rider.book.number, person_book_path(@rider.book.person, @rider.book) if @rider.book\n if @rider.is_master?\n add_breadcrumb @rider.book.number, master_book_path(@rider.book) \n else\n add_breadcrumb @rider.book.number, book_rider_path(@rider.book, @rider)\n end\n add_breadcrumb @rider.name, book_rider_path(@rider.book, @rider) if @rider\n end", "def breadcrumbs_for_business_directory_theme \n breadcrumbs = \"\"\n if @text.present?\n breadcrumbs = \"You searched for #{truncate(@text, :length => 30)}\"\n breadcrumbs += \" in #{@postal_code}\" if @postal_code.present?\n elsif @postal_code.present? \n breadcrumbs = \"ZIP: #{@postal_code}\"\n end\n if @category\n if @text.present?\n breadcrumbs += \" in \"\n else\n options = {\n :category_id => nil,\n :iframe_width => params[:iframe_width],\n :iframe_height => params[:iframe_height],\n :layout => @layout,\n :page_size => params[:page_size]\n }\n breadcrumbs += link_to( \"Coupons: \", options )\n end\n if @category.parent \n breadcrumbs += \"#{link_to( h(@category.parent.name), pagination_link_params(@page).merge!( :category_id => @category.parent.to_param) )}: \"\n end\n breadcrumbs += link_to( h(@category.name), pagination_link_params(@page) )\n end\n breadcrumbs = \"&nbsp;\" if breadcrumbs.blank?\n content_tag( :div, breadcrumbs, :class => 'breadcrumbs' )\n end", "def breadcrumbs\n content_tag :ol, class: 'breadcrumb' do\n split_path = request.path.split('/').drop(1)\n concat content_tag :li, (link_to 'Home', '/')\n split_path.each_with_index do |p, i|\n concat content_tag :li, (link_to p.capitalize_each('-'), '/' + split_path.take(i+1).join('/'))\n end\n end\n end", "def index\n @headers = Header.all\n add_breadcrumb @headers.first.header_lang(current_user), 'headers'\n end", "def breadcrumbs\n home = link_to(image_tag('home.png', :class => 'home'), '/', :title => t('app.home'))\n breadcrumbs = [home] + crumbs.split(Breadcrumb.instance.delimiter)\n content_tag(:ul, breadcrumbs.map { |trail| content_tag(:li, trail) }, :id => 'breadcrumb')\n end", "def breadcrumbs\n\t\trender :breadcrumbs\n\tend", "def goldberg_breadcrumbs\n render :file => \"#{RAILS_ROOT}/vendor/plugins/goldberg/app/views/goldberg/menu_items/_breadcrumbs.rhtml\", :use_full_path => false, :locals => {:crumbs => Goldberg.menu.crumbs}\n end", "def extract_breadcrumb\n end", "def getPageBreadcrumb(unit, pageName)\n (!pageName || pageName == \"home\" || pageName == \"campus_landing\") and return []\n pageName == \"search\" and return [{ name: \"Search\", id: unit.id + \":\" + pageName}]\n pageName == \"profile\" and return [{ name: \"Profile\", id: unit.id + \":\" + pageName}]\n pageName == \"sidebar\" and return [{ name: \"Sidebars\", id: unit.id + \":\" + pageName}]\n p = Page.where(unit_id: unit.id, slug: pageName).first\n p or halt(404, \"Unknown page #{pageName} in #{unit.id}\")\n return [{ name: p[:name], id: unit.id + \":\" + pageName, url: \"/#{unit.id}/#{pageName}\" }]\nend", "def manageable_breadcrumbs(options = {})\n items = Helpers::NavigationBuilder.new\n yield items if block_given?\n\n options[:class] ||= \"\"\n options[:class] << \" breadcrumb\"\n options[:class].strip!\n\n content_tag(\"div\", options) do\n content_tag(\"ul\") do\n items.collect { |item|\n content_tag(\"li\", :class => item[:class]) do\n if item[:active]\n item[:label]\n else\n link_to(item[:label], item[:href])\n end\n end\n }.join(\"\").html_safe\n end\n end\n end", "def build_breadcrumbs\n @breadcrumbs = [\n { :title => I18n.t(\"admin.sections.#{resource_collection_name}\"), :url => collection_path }\n ]\n @breadcrumbs << { :title => params[:action] } unless params[:action] == 'index'\n end", "def render_breadcrumb(options={})\n default_options = {\n :seperator => %(<span class=\"seperator\">></span>),\n :page => current_page,\n :without => nil\n }\n options = default_options.merge(options)\n bc = \"\"\n pages = breadcrumb(options[:page])\n pages.delete(Page.root)\n unless options[:without].nil?\n unless options[:without].class == Array\n pages.delete(options[:without])\n else\n pages = pages - options[:without]\n end\n end\n pages.each do |page|\n if page.name == current_page.name\n css_class = \"active\"\n elsif page == pages.last\n css_class = \"last\"\n elsif page == pages.first\n css_class = \"first\"\n end\n if (page == Page.language_root(session[:language]))\n if configuration(:redirect_index)\n url = show_page_url(:urlname => page.urlname)\n else\n url = index_url\n end\n else\n url = show_page_url(:urlname => page.urlname)\n end\n bc << link_to( h(page.name), url, :class => css_class, :title => page.title )\n unless page == pages.last\n bc << options[:seperator]\n end\n end\n bc\n end", "def breadcrumbs() [] end", "def breadcrumb(object, level = 0)\n path = (\"../\" * level) + object.name + \".html\"\n link = link_to(object.name, path)\n\n if object.parent.kind_of?(RDoc::TopLevel)\n link\n else\n breadcrumb(object.parent, level+1) + \"&nbsp; > &nbsp;\" + link\n end\n end", "def index \n add_breadcrumb \"Administrar\", :sections_path\n add_breadcrumb \"Recursos\", :resources_path \n end", "def index\n @breadcrumbs = nil\n end", "def render_breadcrumb ( menu , options )\n links = []\n item = current_item(menu)\n if item != nil\n links << render_breadcrumb_node(item, options)\n while item.parent != nil do\n if item.parent.is_a? Symbol\n links << link_to( 'Home', '/' , {:class=>options[:link_class]} ).html_safe + ' > '.html_safe\n break\n else\n links << render_breadcrumb_node(item.parent, options).html_safe + ' > '.html_safe\n item = item.parent\n end\n end\n end\n links = links.reverse\n links.empty? ? '' : content_tag('div', links.join(\"\\n\") , :class=>options[:div_class]).html_safe\n end", "def add_breadcrumbs\n breadcrumb_for \"index\" # base\n\n if action_name != \"index\"\n breadcrumb_for action_name\n end\n end", "def index\n @breadcrumbs = [[\"#{t(:accounting_plans)}\"]]\n init\n end", "def render_breadcrumb(options = {})\n options = {\n separator: \">\",\n page: @page,\n restricted_only: false,\n reverse: false,\n link_active_page: false\n }.merge(options)\n\n pages = options[:page]\n .self_and_ancestors.contentpages\n .published\n\n if options.delete(:restricted_only)\n pages = pages.restricted\n end\n\n if options.delete(:reverse)\n pages = pages.reorder(\"lft DESC\")\n end\n\n if options[:without].present?\n without = options.delete(:without)\n pages = pages.where.not(id: without.try(:collect, &:id) || without.id)\n end\n\n render \"alchemy/breadcrumb/wrapper\", pages: pages, options: options\n end", "def hardcoded_breadcrumbs\n [\n {\n title: \"Home\",\n url: \"/\",\n },\n {\n title: subtopic.parent.title,\n url: subtopic.parent.base_path,\n },\n {\n title: subtopic.title,\n url: subtopic.base_path,\n },\n ]\n end", "def subpage_navigation(page)\n l = \"<ul>\\n\"\n page.pages.each do |page|\n l << page_navigation_helper(page)\n end\n l << \"</ul>\"\n end", "def r_breadcrumbs(&block)\n content_tag(\"div\", &block)\n end", "def home_breadcrumbs(action=\"\")\n crumbs = []\n\n crumbs.push({ \"text\": t(\"defaults.home\"), \"link\": root_path })\n\n case action\n when \"api\"\n crumbs.push({ \"text\": \"API\" })\n\n when \"conferences\"\n crumbs.push({ \"text\": t(\"views.conference.list\") })\n end\n\n render \"partials/breadcrumbs\", crumbs: crumbs\n end", "def page_header(site_config, page_count)\n # start common page region\n page = %(<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <!-- The above 3 meta tags *must* come first in the head;\n any other head content must come *after* these tags -->\n <title>#{site_config['title']}</title>)\n page += add_icons\n page += %(\n <meta name=\"description\" content=\"#{site_config['description']}\">\n <meta name=\"theme-color\" content=\"##{site_config['theme_color']}\">\n <link rel=\"stylesheet\" href=\"assets/bootstrap/css/bootstrap.min.css\">\n <link rel=\"stylesheet\" href=\"assets/bootstrap/css/bootstrap-theme.min.css\">\n <style>\n .container-fluid { padding: 0px; }\n .navbar, .navbar-default { margin-bottom: 0; padding: 5pt; background-color: ##{site_config['theme_color']}; font-size: 12pt; }\n .navbar, .navbar-default li a { color: ##{site_config['text_color']} !important; }\n .navbar-default .navbar-brand { margin-left: 20px !important; color: ##{site_config['logo_text_color']}; font-size: 18pt; font-weight: bold; }\n .navbar-brand:hover { background-color: #{site_config['nav_hover_color']} !important; }\n div[id^=\"d3pie_chart_div_\"], canvas { margin-bottom: 100px; }\n footer { background-color: ##{site_config['theme_color']}; min-height: 200px;}\n footer ul a { color: ##{site_config['text_color']} !important; font-size: 13pt; }\n footer .container { margin-left: 15px; }\n .built { text-decoration: none !important; }\n .selected { background-color: #{site_config['nav_selected_color']}; font-weight: bold; }\n .navbar-default li:hover a { background-color: #{site_config['nav_hover_color']} !important; }\n h1 { text-align: center; background-color: ##{site_config['theme_color']}; padding: 14px; color: ##{site_config['text_color']}; }\n pre { white-space: pre-wrap; word-wrap: break-word; }\n .homepage { padding: 5px 30px 5px 30px; }\n .logo { float: left; }\n .oll { padding-left: 1em; }\n h2#other { text-align: center; }\n .plotlypie { height: 625px; }\n </style>\n </head>\n <body>\n <!-- Static navbar -->\n <nav class=\"navbar navbar-default\" id=\"head1\">\n <div class=\"container-fluid\">\n <div class=\"navbar-header\">\n <a href=\"index.html\"><img src=\"assets/images/logo.png\" alt=\"Ruby Powered\" class=\"logo\"></a>\n <button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar\" aria-expanded=\"false\" aria-controls=\"navbar\">\n <span class=\"sr-only\">Toggle navigation</span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n </button>\n <a class=\"navbar-brand\" href=\"index.html\">#{site_config['nav_heading']}</a>\n </div>\n <div id=\"navbar\" class=\"navbar-collapse collapse\">\n <ul class=\"nav navbar-nav\">)\n page += add_links(page_count)\n page += %(\n </ul>\n </div>\n </div>\n </nav>\n <div class=\"container-fluid\">)\n (0..page_count).map do |i|\n instance_variable_set(\"@page#{ii(i)}\", page)\n end\nend", "def breadcrumbs(content)\n content_for(:breadcrumbs, content) if content\n end", "def member_breadcrumbs\n add_breadcrumb(@period.name, url_for(@period), true, 'Coaching Period')\n end", "def bootstrap_nav(*args, &block)\n levels = { :primary => 1, :secondary => 2, :tertiary => 3 }\n options = args.extract_options!\n level = levels[options[:level]] || (options[:level] || 1).to_i\n\n\n # If there are no arguments, use the current page\n args.unshift page if args.empty? && !page.nil?\n \n current_page = page\n \n contents = \"\".tap do |str|\n\n page = current_page # TODO: Can't call page within tap, so we've passed it as a variable. Can we do this better?\n\n # Opening HTML for Twitter Bootstrap Navigation\n if level == 1\n str << '<ul class=\"nav\">'\n else\n str << '<ul class=\"dropdown-menu\">'\n end\n \n pages = args.map do |arg|\n if arg.root?\n arg.children.first\n else \n case arg\n when Breeze::Content::NavigationItem then arg\n else Breeze::Content::NavigationItem.where(:permalink => arg.to_s).first\n end\n end\n end.flatten.compact\n \n ancestry = pages.first ? pages.first.self_and_ancestors.to_a : [ page ]\n\n # If page is undefined, there's no active page\n # This is used for example on the Breeze Commerce Cart and Checkout pages\n # In the longer term, this should be removed, in favour of making the cart a proper page, with checkout as a view\n page ||= nil\n \n active = page ? (page.root? ? [page] : ancestry.dup) : []\n ancestry << ancestry.last.children.first if ancestry.last\n ancestry.compact!\n \n if level <= ancestry.length && ancestry[level].present?\n siblings = ancestry[level].self_and_siblings.to_a.select(&:show_in_navigation?) \n # siblings = page.self_and_siblings.to_a.select(&:show_in_navigation?) \n siblings.unshift ancestry[level - 1] if options[:home] || (level == 1 && options[:home] != false)\n siblings.each_with_index do |p, i|\n page_title = if (options[:home] && options[:home] != true) && (p.level < level || p.root?)\n options[:home]\n case options[:home]\n when true then p.title\n when Symbol then p.send options[:home]\n when Proc then options[:home].call(p)\n else options[:home].to_s\n end\n else\n p.title\n end\n page_title = p.title if page_title.blank?\n \n link_options = ({}).tap do |o|\n o[:class] = [ p.root? ? \"home\" : p.slug ].tap do |classes|\n classes << \"active\" if p == page || (active.index(p).to_i > 0 && p.level == level)\n classes << \"first\" if i == 0\n classes << \"last\" if i == siblings.length - 1\n end.join(\" \")\n end\n \n link = if block_given?\n capture p, link_options, &block\n else\n permalink = p.class.name == \"Breeze::Content::Placeholder\" ? 'javascript:void(0)' : p.permalink\n link_to content_tag(:span, \"#{page_title}\".html_safe), permalink, link_options\n end\n \n recurse = case options[:recurse]\n when true then 3\n when :active then ancestry.include?(p) ? 1 : 0\n when Numeric, /^\\d+$/ then options[:recurse].to_i\n else 0\n end\n \n if recurse > 0 && p.level == level && !p.root?\n unless (child = p.children.first).nil?\n link << bootstrap_nav(child, options.merge(:level => level + 1, :recurse => recurse - 1), &block)\n end\n end\n \n # if options[:full] && p.children\n # p.children.each do |child|\n # link << navigation_bootstrap(child, options.merge(:full => true), &block)\n # end\n # end\n\n li_options = ({}).tap do |o|\n o[:class] = [ p.root? ? \"home\" : p.slug ].tap do |classes|\n classes << \"active\" if p == page || (active.index(p).to_i > 0 && p.level == level)\n classes << \"first\" if i == 0\n classes << \"last\" if i == siblings.length - 1\n classes << \"dropdown\" if p.children.length > 0\n classes << 'level-' + level.to_s\n end.join(\" \")\n end\n \n str << content_tag(:li, link.html_safe, li_options)\n end\n end\n \n # Opening HTML for Twitter Bootstrap Navigation\n str << '</ul>'\n \n end\n # content_tag :div, contents.html_safe, options.except(:level, :recurse).reverse_merge(:class => \"#{levels.invert[level] || \"level-#{level}\"} navigation\")\n contents.html_safe\n \n end", "def documentation_breadcrumb_for(page, options = {})\n options[:root_link] = options[:root_link].nil? ? t('documentation.helpers.documentation_breadcrumb_for.default_root_link') : options[:root_link]\n options[:class] ||= 'breadcrumb'\n\n String.new.tap do |s|\n s << \"<nav class='#{options[:class]}'><ul>\"\n\n if options[:root_link]\n s << \"<li><a href='#{documentation_doc_root.blank? ? '/' : documentation_doc_root}'>#{options[:root_link]}</a></li>\"\n end\n\n if page.is_a?(::Documentation::Page)\n page.breadcrumb.each do |child|\n s << \"<li><a href='#{documentation_doc_root}/#{child.full_permalink}'>#{child.title}</a></li>\"\n end\n end\n\n s << \"</ul></nav>\"\n end.html_safe\n end", "def get_bread_crumbs(url,sep)\n begin\n retVal = \"\"\n url.gsub!(/\\?.*$/,\"\")\n unless url.split(/\\//).length <= 3\n elements = url.split('/')\n project_id = \"\"\n project_title = \"\"\n study_id = \"\"\n study_title = \"\"\n no_match = false\n is_end_of_trail = false\n\n # the string to return\n retVal = image_tag(\"Computer-silk.png\", :style=> \"border: 0px; vertical-align: top\", :alt => \"computer\") + \" \"\n retVal = retVal + link_to(\"My Work\", \"/\") + \" \"\n\n # remove the https://www.srdr.com bit from the array\n elements = elements[3..elements.length-1]\n\n i = 0\n elements.each do |element|\n if i == elements.length - 1\n is_end_of_trail = true\n end\n\n retVal = retVal + image_tag(\"Silk_arrow_right_gray.png\", :style=>\"border: 0px; vertical-align:top;\", :alt => \"arrow\") + \" \"\n case element\n when \"extraction_forms\"\n if project_id.to_s.empty?\n efid = elements[i+1]\n ef = ExtractionForm.find(efid,:select=>[\"project_id\"])\n unless ef.nil?\n project_id = ef.project_id\n end\n session[:project_id] = project_id\n end\n extraction_form_uri=\"/projects/#{project_id.to_s}/extractionforms\"\n retVal = retVal + image_tag(\"Table-silk.png\", :style=> \"border: 0px; vertical-align: top;\", :alt => \"table\") + \" \" + create_crumb_link(extraction_form_uri,\" Extraction Forms\",is_end_of_trail)\n when \"projects\"\n project_uri\t= \"/projects/\"\n retVal = retVal + image_tag('Folder-silk.png', :style=> \"border: 0px; vertical-align: top;\", :alt => \"folder\") + \" \" + create_crumb_link(project_uri, \"My Projects\", is_end_of_trail)\n #print \"In the projects block and retVal is now #{retVal}...\\n\\n\"\n\n when \"studies\"\n study_uri = \"/projects/#{project_id.to_s}/studies\"\n retVal = retVal + image_tag(\"Book-silk.png\", :style=> \"border: 0px; vertical-align: top;\", :alt=>\"book\") + \" \" + create_crumb_link(study_uri,\"Studies\", is_end_of_trail)\n\n when \"home\"\n retVal.gsub!(/\\>\\s$/,\"\")\n\n when \"account\"\n retVal = retVal + image_tag(\"User.png\", :style=> \"border: 0px; vertical-align: top;\", :alt => \"user\") + \" \" + create_crumb_link('/account/','Account',true) + \" \"\n\n when \"search\"\n retVal = retVal + image_tag(\"Zoom.png\", :style=> \"border: 0px; vertical-align: top;\", :alt => \"search\") + \" \" + create_crumb_link('/search/','Search',true) + \" \"\n retVal.gsub!(/\\>$/,\"\")\n\n when \"demo1\"\n retVal = retVal + image_tag(\"film.png\", :style=> \"border: 0px; vertical-align: top;\") + \" \" + create_crumb_link('/home/demo1/','Demo 1: Viewing and Creating Projects',true) + \" \"\n retVal.gsub!(/\\>$/,\"\")\n\n when \"demo2\"\n retVal = retVal + image_tag(\"film.png\", :style=> \"border: 0px; vertical-align: top;\") + \" \" + create_crumb_link('/home/demo2/','Demo 2: Creating and Editing Extraction Form Templates',true) + \" \"\n retVal.gsub!(/\\>$/,\"\")\n\n when \"demo3\"\n retVal = retVal + image_tag(\"film.png\", :style=> \"border: 0px; vertical-align: top;\") + \" \" + create_crumb_link('/home/demo3/','Demo 3: Viewing, Editing and Creating Study Records ',true) + \" \"\n retVal.gsub!(/\\>$/,\"\")\n\n when /^\\d+/\n\n previous = elements[i-1]\n if previous == \"projects\"\n project_id = element.to_i\n project_title = Project.find(project_id,:select=>\"title\")\n unless project_title.nil?\n project_title = project_title.title\n else\n project_title = \"New Project\"\n end\n project_uri = \"/projects/#{project_id.to_s}/edit\"\n retVal = retVal + image_tag(\"Folder_edit.png\", :style=> \"border: 0px; vertical-align: top;\") + \" \" + create_crumb_link(project_uri, project_title, is_end_of_trail)\n\n elsif previous == \"studies\"\n study_id = element.to_i\n study_title = PrimaryPublication.find(:first,:conditions=>[\"study_id=?\",study_id],:select=>\"title\")\n unless study_title.nil?\n study_title = study_title.title\n else\n study_title=\"New Study\"\n end\n study_uri = \"/projects/#{project_id.to_s}/studies/#{study_id.to_s}\"\n retVal = retVal + image_tag(\"Book_edit.png\", :style=> \"border: 0px; vertical-align: top;\") + \" \" + create_crumb_link(study_uri, study_title, is_end_of_trail)\n\n elsif previous == \"extraction_forms\"\n extraction_form_id = element.to_i\n extraction_form_title = ExtractionForm.find(extraction_form_id)\n unless extraction_form_title.nil?\n extraction_form_title = extraction_form_title.title\n else\n extraction_form_title = \"Untitled\"\n end\n extraction_form_uri = \"/projects/#{project_id.to_s}/extraction_forms/#{extraction_form_id.to_s}/edit\"\n retVal = retVal + image_tag(\"Table_edit.png\", :style=> \"border: 0px; vertical-align: top;\") + \" \" + create_crumb_link(extraction_form_uri,extraction_form_title,is_end_of_trail)\n else\n # fill this in for other types of urls\n end\n when /^\\w+/\n text = case element\n # these should be consistent now\n when \"extractionforms\" then \"Manage Extraction Forms\"\n when \"questions\" then \"Key Questions\"\n when \"publications\" then \"Publications\"\n when \"arms\" then \"Arms\"\n when \"design\" then \"Design Details\"\n when \"baselines\" then \"Baseline Characteristics\"\n when \"outcomes\" then \"Outcomes\"\n when \"results\" then \"Outcome Data\"\n when \"adverse\" then \"Adverse Events\"\n when \"quality\" then \"Study Quality\"\n else element.to_s.capitalize\n end\n\n edits_arr = [\"Key Questions\", \"Publications\", \"Study Arms\", \"Study Design\", \"Baseline Characteristics\", \"Outcomes\", \"Results Entry\", \"Adverse Events\", \"Study Quality\"]\n\n #print \"Found #{element.to_s}\\n\\n\"\n if text == \"Edit\"\n retVal = retVal + image_tag(\"Pencil.png\", :style=> \"border: 0px; vertical-align: top\") + \" \"\n elsif edits_arr.include?(text)\n retVal = retVal + image_tag(\"Pencil.png\", :style=> \"border: 0px; vertical-align: top\") + \" \" + create_crumb_link(\"\",text,is_end_of_trail)\n else\n retVal = retVal + create_crumb_link(\"\",text,is_end_of_trail)\n end\n retVal.gsub!(/\\>\\s$/,\"\")\n else\n # get rid of the trailing characters\n # is doing two chops more efficient?\n retVal.gsub!(/\\>\\s$/,\"\")\n no_match = true\n end\n retVal = retVal + \" \"\n i = i+1\n end\n end #ending the unless statement at the top\n return retVal\n\n rescue\n return \"Error in breadcrumbs: \" + elements[elements.length-1]\n end\n end", "def block_view(context, block_name)\n \n app = context[:app]\n \n result = case block_name\n \n when 'site_breadcrumb_public'\n\n preffixes = Plugins::Plugin.plugin_invoke_all('ignore_path_prefix_breadcrumb', {:app => self})\n\n if app.request.path_info.empty? or app.request.path_info.start_with?(*preffixes)\n bc = ''\n else\n path = app.request.path_info\n if path.match /\\/page\\/\\d+/\n path.sub!(/\\/page\\/\\d+/,'')\n end\n home_page_path = SystemConfiguration::Variable.get_value('site.anonymous_front_page', nil)\n bc = app.t.breadcrumb.home\n\n if home_page_path != path\n path_array = path.split('/')\n result = \"\"\n summary = \"\\\\\"\n bc = path_array.slice(0, path_array.size-1).inject(\"\") do |result, item| \n if item.empty?\n result << \"<a href=\\\"/\\\">#{app.t.breadcrumb.home}</a>\"\n result\n else \n result << \"<span class=\\\"breadcrumb_separator\\\"> &gt; </span> \" unless result.empty?\n result << \"<a href=\\\"#{summary}#{item}\\\">#{item.capitalize.gsub(/-/,' ')}</a>\"\n summary << \"#{item}\\\\\" \n result\n end\n end\n if path_array.size > 1\n bc << \" <span class=\\\"breadcrumb_separator\\\"> &gt; </span> <span class=\\\"breadcrumb_last\\\">#{path_array.last.capitalize.gsub(/-/,' ')}</span>\"\n end\n end\n end \n\n bc == app.t.breadcrumb.home ? '' : bc\n\n\n when 'site_breadcrumb'\n preffixes = Plugins::Plugin.plugin_invoke_all('ignore_path_prefix_breadcrumb', {:app => self})\n \n if app.request.path_info.empty? or app.request.path_info.start_with?(*preffixes)\n bc = ''\n else\n breadcrumb = Site::BreadcrumbBuilder.build(app.request.path_info, context) \n bc_render = SiteRenders::BreadcrumbRender.new(breadcrumb, context)\n bc = bc_render.render \n end \n\n bc\n\n\n when 'site_adminmenu'\n \n if app.user and app.user.is_superuser?\n \n # Retrieve the admin menu options\n admin_menu = {:name => 'admin_menu', :title => 'Admin menu', :description => 'Administration menu'}\n admin_menu_items = Plugins::Plugin.plugin_invoke_all('menu', context)\n \n menu = Site::Menu.build(admin_menu, admin_menu_items)\n menu.language_in_routes = false\n SiteRenders::MenuRender.new(menu, context).render\n \n end\n \n when /^menu_/\n \n menu_name = block_name.match(/^menu_(.+)/)[1]\n \n if menu = Site::Menu.get(menu_name)\n menu_render = SiteRenders::MenuRender.new(menu, context)\n menu_render.render\n else\n ''\n end\n \n when /^view_/ \n\n view_name = block_name.sub(/view_/,'')\n \n if view = ContentManagerSystem::View.get(view_name)\n arguments = \"\"\n if app.request.path_info and app.request.path_info.split('/').length > 2\n arguments = (x=app.request.path_info.split('/')).slice(2,x.length).join('/')\n end\n ::CMSRenders::ViewRender.new(view, app).render(1, arguments) \n else\n ''\n end\n \n when /^content_/\n \n content_id = block_name.sub(/content_/,'')\n if content = ContentManagerSystem::Content.get(content_id.to_i)\n CMSRenders::ContentRender.new(content, app).render\n else\n ''\n end \n\n\n end\n\n return result\n \n \n end", "def breadcrumb_name\n title\n end", "def member_breadcrumbs\n add_breadcrumb(@assignment.period.name, url_for(@assignment.period), @assignment.period.can_view?(current_user), 'Coaching Period')\n if @assignment.group \n add_breadcrumb(@assignment.group.display_name, url_for(@assignment.group), @assignment.group.can_view?(current_user), 'Coaching Group')\n elsif @assignment.team\n add_breadcrumb(@assignment.team.display_name, url_for(@assignment.team), @assignment.team.can_view?(current_user), 'Team')\n end\n add_breadcrumb(@assignment.user.display_name, url_for(@assignment), true, 'Assignment')\n end", "def set_breadcrumbs\n @breadcrumbs = []\n add_breadcrumb \"Home\", root_path\n end", "def set_breadcrumbs\n @breadcrumbs = []\n add_breadcrumb \"Home\", root_path\n end", "def render_headings\n\t\tpage_count.times do |i|\n\t\t\tpage=i+1\n\t\t\tgo_to_page(page)\n\t\t \n\t\t\theadings_box do\n\t\t\t\tfont_size(@header_size) do\n\t\t\t\t\tyield page\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def add_page_header\n tenant = MnoEnterprise::Tenant.show\n title = Settings.dashboard.payment.enabled ? \"#{t(:monthly_invoice)} - \" : \"#{t(:account_statement)} - \"\n @pdf.repeat :all do\n @pdf.bounding_box([0, @pdf.bounds.top+@format[:header_size]], width: 540, height: @format[:footer_size]) do\n @pdf.float do\n @pdf.image main_logo_white_bg_path(true), fit: [135, (@format[:footer_size])]\n end\n @pdf.text tenant.name, align: :right, inline_format: true\n if tenant.main_address.present?\n tenant_address = \"#{tenant.main_address.dig('street')}\\n#{tenant.main_address.dig('city')}\\n#{ISO3166::Country.new(tenant.main_address.dig('country_code')).name}\"\n @pdf.move_down 5\n @pdf.text \"<color rgb='999999'>#{tenant_address}</color>\", align: :right, inline_format: true, style: :italic, size: 9\n end\n if contact_details = Settings.dashboard&.organization_management&.billing&.invoice_contact_details.presence\n @pdf.move_down 5\n @pdf.font_size(10) { @pdf.text contact_details, align: :right }\n end\n @pdf.move_down 10\n @pdf.font_size(20) { @pdf.text \"#{title} #{@data[:period_month]}\", style: :bold, align: :right }\n end\n end\n end", "def regular_compact_breadcrumbs(document)\n breadcrumb_links = []\n breadcrumb_links << add_campus_link(document) unless document.campus.nil?\n breadcrumb_links << add_parent_campus_link(document) unless document.parent_campus.nil? && !document.campus.nil?\n breadcrumb_links << build_repository_link(document)\n\n parents = document_parents(document)\n breadcrumb_links << parents[0, 1].map do |parent|\n link_to parent.label, solr_document_path(parent.global_id)\n end\n\n breadcrumb_links << '&hellip;'.html_safe if parents.length > 1\n\n safe_join(\n breadcrumb_links,\n aria_hidden_breadcrumb_separator\n )\n end", "def show\n breadcrumb\n end", "def add_breadcrumb_modulo\n add_breadcrumb pluralize_model(TbAvaliacao), gerente_tb_avaliacoes_path\n end", "def page_breadcrumbs(page)\n page.ancestors.reverse.map { |p| link_to(p.name, p.path) }\n end", "def index\n add_breadcrumb \"Inicio\", :root_path\n add_breadcrumb \"#{@course_user.course.name} \", student_course_path(@course_user.course)\n end", "def getHeaderElements(breadcrumb, topItem)\n campuses = topItem ? getCampusesAsMenu(topItem) : getCampusesAsMenu\n return {\n :campuses => campuses,\n :breadcrumb => breadcrumb ? Hierarchy_Manual.new(breadcrumb).generateCrumb : nil\n }\nend", "def root_breadcrumb\n breadcrumb \"Outpost\", outpost_root_path\n end", "def index\n @structures = Structure.all\n add_breadcrumb 'partenaires', structures_path\n end", "def show\n @breadcrumbs = [[\"Home\", root_url], [@bond.citizen,\"/citizens/#{@bond.citizen.id}?tab=finances\"], [@bond, \"/bonds/#{@bond.id}\"]]\n end", "def generate_titles( action = nil, content = nil )\n\n action = ( action.nil? ? action_name : action.to_s )\n content ||= @content unless @content.nil? || ( action === 'index' )\n\n # if we’re in something that has an additional segment, show that\n unless content.nil? or action == 'new'\n\n @breadcrumb << {\n title: breadcrumb_t( @model_class, :show, { title: content.to_s } ),\n url: ( path_for( content, :show ) rescue nil )\n }\n\n end\n\n # put the current location on the breadcrumb, + generate the title\n @breadcrumb << breadcrumb_t( @model_class, action, { title: content.to_s }) unless ( action == 'index' )\n @page_title = title_t( @model_class, action, { title: content.to_s })\n\n end", "def breadcrumb\n Array(@breadcrumb)\n\tend", "def breadcrumb(&block)\n config.breadcrumb = block\n end", "def add_breadcrumb_modulo\n add_breadcrumb breadcrumb('administracao.avaliacao.base')\n add_breadcrumb pluralize_model(TbPergunta), administracao_tb_perguntas_path\n end", "def generate_html\n # the individual descriptions for files and classes\n gen_into(@files)\n gen_into(@classes)\n # and the index files\n gen_file_index\n gen_class_index\n gen_method_index\n gen_main_index\n\n # this method is defined in the template file\n write_extra_pages if defined? write_extra_pages\n end", "def index\n @breadcrumbs = [['Tax codes']]\n @tax_codes = current_organization.tax_codes.order(:code)\n @tax_codes = @tax_codes.page(params[:page])\n end", "def pages; end", "def table_links_page(hierarchy, current_level, select = '', where = '', group = '')\n res,more = data(select, where, group)\n\n html_title = 'data'\n #request.path\n page_title = '<h1>Well Finder</h1>' + (more ? '<h2>(there\\'s more than this...)</h2>' : '')\n if(res.length > 1)\n table = '<table><tr>%s</tr>%s</table>'\n headers = res[0]\n header_html = '<th>' + headers.join('</th><th>') + '</th>' #TODO put in explanations of what these are/units\n #header_html = headers.inject('<th>')\n \n link = headers.collect{|o| hierarchy.include?(o.to_sym) && (current_level + hierarchy.index(o.to_sym)) < hierarchy.length * 2 - 1 } #everything but the last one\n path = request.path_info.split('/')\n rows = res[1..-1].collect do |row|\n #only want base urls for high-heirarchy levels\n #don't want links on the lowest level of the hierarhcy levels\n #TODO pass the query params of the url onto the next one\n ret = '<td>'\n (0..row.length).each do |i| \n if(link[i]) \n url = path[0..hierarchy.index(headers[i].to_sym)+1].collect{|o| !o.empty? && o.to_sym == :':all' ? row[i-1] : o }\n #grab the path for where we are in the row\n ret += \"<a href=\\\"#{url.join('/') + \"/#{row[i]}\"}\\\">#{row[i]}</a>\"\n else\n ret += row[i].to_s\n end\n ret += '</td><td>'\n end\n ret += '</td>'\n ret\n end\n row_html = \"\\n<tr>#{rows.join(\"</tr>\\n<tr>\")}</tr>\\n\"\n \n body = page_title + \"<p class=\\\"headnote\\\"><a href=\\\"#{path[0..1].join('/')}\\\">Top summary level</a></p>\\n\" + table % [header_html, row_html]\n else\n body = '<p>Couldn\\'t find anything with that designation.</p>' #TODO this or do 404?\n end\n \n PREFIX + (HEAD % html_title) + (BODY % body) + SUFFIX\n end", "def breadcrumbs(pages)\n klass = ->(total, index) {\n total == index ? 'is-active' : 'u-underline-on-hover is-hidden-mobile'\n }\n\n max_index = pages.length - 1\n\n pages.map.with_index do |(page, link), index|\n content_tag('li', class: klass.call(max_index, index)) do\n link_to(page, link)\n end\n end.join('').html_safe\n end", "def breadcrumb(*args)\n @breadcrumbs ||= []\n\n args.each_slice(2).map do |pair|\n crumb = Outpost::Breadcrumb.new\n crumb.title = pair[0]\n crumb.link = pair[1]\n\n @breadcrumbs.push crumb\n end\n end", "def assign_breadcrumb\n if page.present?\n self.page.breadcrumb ||= page.title\n end\n end", "def assign_breadcrumb\n if page.present?\n self.page.breadcrumb ||= page.title\n end\n end", "def set_root_breadcrumb\n add_breadcrumb '<span class=\"fa fa-lg\">&#xf015</span><span class=\"sr-only\">Top</span>'.html_safe, root_path\n end", "def generate_header(title, path = nil)\n version = Version::VERSION\n\n vars = {\n 'title' => escape_html(title),\n 'favicon' => escape_html(asset_url('favicon.ico')),\n 'style' => escape_html(asset_url('sabredav.css')),\n 'iconstyle' => escape_html(asset_url('openiconic/open-iconic.css')),\n 'logo' => escape_html(asset_url('sabredav.png')),\n 'baseUrl' => @server.base_uri\n }\n\n html = <<HTML\n<!DOCTYPE html>\n<html>\n<head>\n <title>#{vars['title']} - tilia/dav #{version}</title>\n <link rel=\"shortcut icon\" href=\"#{vars['favicon']}\" type=\"image/vnd.microsoft.icon\" />\n <link rel=\"stylesheet\" href=\"#{vars['style']}\" type=\"text/css\" />\n <link rel=\"stylesheet\" href=\"#{vars['iconstyle']}\" type=\"text/css\" />\n</head>\n<body>\n <header>\n <div class=\"logo\">\n <a href=\"#{vars['baseUrl']}\"><img src=\"#{vars['logo']}\" alt=\"tilia/dav\" /> #{vars['title']}</a>\n </div>\n </header>\n <nav>\nHTML\n\n # If the path is empty, there's no parent.\n if !path.blank?\n parent_uri = Http::UrlUtil.split_path(path).first\n full_path = @server.base_uri + Http::UrlUtil.encode_path(parent_uri)\n html << \"<a href=\\\"#{full_path}\\\" class=\\\"btn\\\">⇤ Go to parent</a>\"\n else\n html << '<span class=\"btn disabled\">⇤ Go to parent</span>'\n end\n\n html << ' <a href=\"?sabreAction=plugins\" class=\"btn\"><span class=\"oi\" data-glyph=\"puzzle-piece\"></span> Plugins</a>'\n html << '</nav>'\n\n html\n end", "def new\n build_breadcrumbs\n end", "def new\n build_breadcrumbs\n end", "def index\n @breadcrumbs = [[t(:units)]]\n @units = @units.order(:name).page(params[:page])\n end", "def f_breadcrumb(feature)\n # content_tag :div, acts_as_family_tree_breadcrumb(feature, breadcrumb_separator) {|r| f_link(r, feature_path(r.fid), {}, {:s => true})}, :class => \"breadcrumbs\"\n content_tag :div, feature.closest_ancestors_by_perspective(current_perspective).collect{|r| f_link(r, feature_path(r.fid), {}, {:s => true})}.join(breadcrumb_separator).html_safe, :class => \"breadcrumbs\"\n end", "def prepare_project_header_and_footer\n @header_text = @project.templets.find_by_name('PAGE_HEADER').render( @project )\n @footer_text = @project.templets.find_by_name('PAGE_FOOTER').render( @project )\n end", "def r_breadcrumbs_nav(&block)\n content_tag(\"nav\", class: \"hidden sm:flex items-center text-sm leading-5 font-medium\", &block)\n end", "def add_template_pages; end", "def breadcrumbs(separator=\" / \")\n crumbs = env[\"PATH_INFO\"].split(\"/\").map {|path| { :path => path, :name => path } }\n crumbs[0] = { :path => \"/\", :name => \"projects\" }\n crumbs = crumbs[0..-2].inject([]) do |crumbs_so_far, current|\n crumbs_so_far << %(<a href=\"#{current[:path]}\">#{current[:name]}</a>)\n end << crumbs.last[:name]\n crumbs.join(separator)\n end", "def auto_set_breadcrumb\n ariane.add(\"Home\", root_path, 1) if ariane.crumbs.empty? \n \n if self.action_name == \"index\"\n name = controller_name.titleize\n level = get_level || 2\n else\n name = \"#{action_name.titleize} #{controller_name.singularize.titleize}\"\n level = get_level || 3\n end\n\n ariane.add(name, request.fullpath, level)\n end", "def breadcrumbs(options = {})\n gretel_renderer.render(options)\n end", "def breadcrumb(page_slug)\n page_slug.split('/')\n .map { |dir_or_page| WikiPage.unhyphenize(dir_or_page).capitalize }\n .join(' / ')\n end", "def breadcrumb(page_slug)\n page_slug.split('/')\n .map { |dir_or_page| WikiPage.unhyphenize(dir_or_page).capitalize }\n .join(' / ')\n end", "def generate_nav\n generate_xml do\n if @target.epub_version >= 3\n generate_xhtml_content\n else\n generate_ncx_content\n end\n end\n end", "def breadcrumbs(links)\n bcs = []\n\n position = 1\n links.each do |link|\n bcs << single(position: position, **symbolize_keys(link))\n position += 1\n end\n\n return %(<ol class=\"breadcrumbs\" vocab=\"http://schema.org/\" typeof=\"BreadcrumbList\">#{bcs.join(@divider)}</ol>)\n end", "def more_rest\n add_breadcrumb \"Waktu Kerja dan Lembur\", \"#absences\"\n add_breadcrumb \"Istirahat Lebih\", \"#more_rest\"\n render :layout => false\n end", "def breadcrumbs\n configuration.breadcrumbs\n end", "def render_umlaut_head_content\n render_opensearch_link + render_meta_refresh\n end", "def breadcrumbs\n migajas_env[\"app.breadcrumbs\"] ||= Trail.new(migajas_env)\n end", "def breadcrumbs\n @breadcrumbs\n end", "def breadcrumbs\n @breadcrumbs\n end", "def create_navigation_links(actual_page, total_pages, system, sort_by)\n links = \"\"\n if total_pages.to_i > 7\n if actual_page > 1\n links << create_nav_link(\"<<\", 1, system, sort_by, false)\n links << create_nav_link(\"<\", actual_page.to_i - 1, system, sort_by, false)\n if actual_page > 4\n links << \"...\"\n end\n end\n # decide where the actual page is to display\n i=actual_page.to_i - 3 if actual_page.to_i > 3 && actual_page.to_i < total_pages.to_i - 2\n i=actual_page.to_i - 2 if actual_page.to_i == 3\n i=actual_page.to_i - 1 if actual_page.to_i == 2\n i=actual_page.to_i if actual_page.to_i == 1\n i=actual_page.to_i - 4 if actual_page.to_i == total_pages.to_i - 2\n i=actual_page.to_i - 5 if actual_page.to_i == total_pages.to_i - 1\n i=actual_page.to_i - 6 if actual_page.to_i == total_pages.to_i\n 7.times do\n links << create_nav_link(i, i, system, sort_by, i== actual_page.to_i)\n i += 1\n end\n if actual_page < total_pages\n if actual_page < total_pages -3\n links << \"...\"\n end\n if actual_page < total_pages.to_i\n links << create_nav_link(\">\", actual_page + 1, system, sort_by, false)\n links << create_nav_link(\">>\", total_pages, system, sort_by, false)\n end\n end\n else\n i = 1\n total_pages.to_i.times do\n links << create_nav_link(i, i, system, sort_by, i == actual_page.to_i)\n i += 1\n end\n end\n links \n end", "def index\n add_crumb 'Users', users_path\n add_crumb @user.name, user_path(@user)\n add_crumb 'Projects', user_projects_path(@user)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end", "def pickup_breadcrumbs\n @bcname = request.path.inspect\n case\n when request.path == \"/\"\n @bcname = Bcrmb.find_by_bckey(\"home\").name\n when request.path =~ /(\\/as\\w\\w\\/)(\\w+)/\n token2in_path = $2\n if (mybc = Bcrmb.find_by_bckey(token2in_path))\n @bcname = mybc.send(:name)\n else\n @bcname = Bcrmb.find_by_bckey(\"allbc\").name\n end # if\n else\n @bcname = Bcrmb.find_by_bckey(\"allbc\").name\n end # case\n\n end", "def breadcrumb action = @action, acc = []\n begin\n (parent_actions ||= []) << action\n end while action.breadcrumb_parent && (action = action(*action.breadcrumb_parent))\n\n content_tag(:ul, :class => \"breadcrumb\", :id => \"breadcrumb\") do\n parent_actions.map do |a|\n am = a.send(:eval, 'bindings[:abstract_model]')\n o = a.send(:eval, 'bindings[:object]')\n content_tag(:li, :class => current_action?(a, am, o) && \"active\") do\n crumb = if a.http_methods.include?(:get)\n current_action?(a, am, o) ? aclass = 'pjax tip-bottom current' : aclass = 'pjax tip-bottom'\n if a.action_name == :dashboard\n adata = t('admin.menu.Gohome')\n else\n adata = t('admin.menu.Gosection')\n end\n link_to locale_url_for(:action => a.action_name, :controller => 'rails_admin/main', :model_name => am.try(:to_param), :id => (o.try(:persisted?) && o.try(:id) || nil)), \"data-original-title\" => adata, :class => aclass do\n if a.action_name == :dashboard\n icon = content_tag(:i, '', :class => 'icon-home')\n else\n icon = ''\n end\n icon + wording_for(:breadcrumb, a, am, o)\n end\n else\n content_tag(:span, wording_for(:breadcrumb, a, am, o))\n end\n #crumb+= content_tag(:span, '/', :class => 'divider') unless current_action?(a, am, o)\n crumb+= content_tag(:span, '') unless current_action?(a, am, o)\n crumb\n end\n end.reverse.join().html_safe\n end\n end", "def index\n build_breadcrumbs\n @news = collection\n end", "def bp_directory_index\n tree_hash = BP.same_level_views(\"/base_project#{request.env['PATH_INFO']}\")\n\n p tree_hash\n\n out = \"<ul>\"\n\n tree_hash.keys.each do |tree_hash_key|\n thk = tree_hash_key.gsub(\".html.erb\", \"\")\n thk = thk.gsub(\"/mocks\", \"\")\n\n out += content_tag :li, thk.gsub(\"/\", \"\")\n\n out += \"<ul>\"\n tree_hash[tree_hash_key].each do |tree_hash_value|\n thv = tree_hash_value.gsub(\".html.erb\", \"\")\n if thv != \"index\"\n out += content_tag :li, link_to(\"#{thv}\", \"/mocks?t=#{thk}/#{thv}\")\n end\n\n end\n out += \"</ul>\"\n\n out += \"</li>\"\n end\n out += \"</ul>\"\n\n out.html_safe\nend", "def add_resource_breadcrumb(resource)\n ancestor_nodes(resource).each do |node|\n @breadcrumbs << { name: node, url: url_for( action: :edit, id: node.id ) }\n end\n super\n end", "def less_rest\n add_breadcrumb \"Waktu Kerja dan Lembur\", \"#absences\"\n add_breadcrumb \"Istirahat Kurang\", \"#lest_rest\"\n render :layout => false\n end", "def page_title\n if content_for?(:page_title)\n \"#{content_for(:page_title)} - \"\n elsif !breadcrumb_names.empty?\n \"#{breadcrumb_names.reverse.join(' - ')} - \"\n else\n ''\n end +\n t('layout.coursemology')\n end", "def to_breadcrumb\n self.title\n end", "def _brands_header\n\t$report_file.puts \" _ _ \"\n\t$report_file.puts \"| | | | \"\n\t$report_file.puts \"| |__ _ __ __ _ _ __ __| |___ \"\n\t$report_file.puts \"| '_ \\\\| '__/ _` | '_ \\\\ / _` / __|\"\n\t$report_file.puts \"| |_) | | | (_| | | | | (_| \\\\__ \\\\\"\n\t$report_file.puts \"|_.__/|_| \\\\__,_|_| |_|\\\\__,_|___/\"\n\t$report_file.puts\n\t$report_file.puts \"--------------------------------------------------------------------\"\n\t$report_file.puts\nend", "def show\n add_breadcrumb \"Subjects Design\", subjects_path, :title => \"Back to the Index\"\n add_breadcrumb \"Subjects Allocation\", subject_allocations_path\n add_breadcrumb \"Details\"\n end", "def show\n @breadcrumbs = [[\"Home\", root_url], [@facility.citizen,\"/citizens/#{@facility.citizen.id}?tab=facilities\"], [@facility, \"/facilities/#{@facility.id}\"]]\n end", "def show\n @title = 'My Account'\n add_breadcrumb t('my_account')\n end", "def get_breadcrumbs\n current = @product || @brand || @category || @page\n # BreadcrumbsMaker.build current, params\n make_breadcrumbs current\n end", "def show\n add_breadcrumb 'Transaction'\n end", "def header(text, level)\n h = headers.add(text, level += 1)\n navigation.append(text, h.name) if level == 2\n nest h\n h.render\n end" ]
[ "0.6806732", "0.66057044", "0.65819997", "0.6553603", "0.6511547", "0.6495453", "0.6456045", "0.64555365", "0.6412341", "0.6397377", "0.6390433", "0.6385055", "0.63629675", "0.63593864", "0.6289404", "0.624614", "0.6236997", "0.6199193", "0.6192281", "0.6146599", "0.6112809", "0.6111939", "0.6103021", "0.6089598", "0.60218555", "0.6019893", "0.60126185", "0.5993747", "0.5980089", "0.5959279", "0.594391", "0.5908217", "0.59075224", "0.58943975", "0.5893138", "0.58895206", "0.58664185", "0.5856187", "0.5856187", "0.5855733", "0.5842662", "0.5834995", "0.5832479", "0.5822308", "0.5821565", "0.5812947", "0.5810715", "0.5799229", "0.57915515", "0.57867354", "0.57844186", "0.5774854", "0.57738817", "0.5772641", "0.5769181", "0.575699", "0.57526314", "0.574446", "0.5741945", "0.5734238", "0.57232594", "0.57232594", "0.57192904", "0.5700685", "0.5698756", "0.5698756", "0.5691591", "0.56903005", "0.5689505", "0.56867087", "0.56763005", "0.567595", "0.56714064", "0.5669396", "0.5648576", "0.5648576", "0.5645139", "0.56398094", "0.5631624", "0.5615726", "0.5601573", "0.560032", "0.55910206", "0.55910206", "0.558992", "0.55750465", "0.5571785", "0.5567785", "0.5564388", "0.5563071", "0.55623275", "0.55560124", "0.5533676", "0.55273914", "0.551935", "0.5519303", "0.5518055", "0.5513443", "0.55066085", "0.5491487", "0.54852986" ]
0.0
-1
Get ORUspecific data for Department Landing Page
def getORULandingPageData(id) # addPage() children = $hierByAncestor[id] return { :series => children ? children.select { |u| u.unit.type == 'series' }.map { |u| seriesPreview(u) } : [], :journals => children ? children.select { |u| u.unit.type == 'journal' }.map { |u| {unit_id: u.unit_id, name: u.unit.name} } : [], :related_orus => children ? children.select { |u| u.unit.type != 'series' && u.unit.type != 'journal' }.map { |u| {unit_id: u.unit_id, name: u.unit.name} } : [] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def department\n @department ||= @data[:cmudepartment].last\n end", "def get_department_outype\n path = \"/d2l/api/lp/#{$lp_ver}/outypes/department\"\n _get(path)\n # returns OrgUnitType JSON data block\nend", "def organisation_data_for_show_method\n @location = @user.location\n @country = @location.country # personal country name\n @state = @location.state # personal state name\n @organisation = @user.organisation\n @organisation_country = @organisation.country\n @organisation_state = @organisation.state\n end", "def query_depts\n { 'respDepartment' => Newspilot.configuration.departments }\n end", "def for_department(department_name); end", "def show\n @department = Department.within_organization(@organization).find(params[:id])\n @title = @department.name\n end", "def display_department\n single_value(:umbcprimarydepartment, single_value(:umbcdisplaydepartment, hr_department))\n end", "def department\n fetch('company.department')\n end", "def department\n ::HubEdos::Common::Reference::Descriptor.new(@data['department']) if @data['department']\n end", "def get_department\n begin\n @company = Company.find(params[:company_id])\n @department = @company.departments.find(params[:id])\n rescue\n redirect_to departments_path\n end\n end", "def get_department(page)\n page.css(WebScraper::JOB_INFO_SELECTOR)[WebScraper::JOB_DEPT_POS].content.strip\n end", "def show\n\n #Get department\n @workin = if @personnel.workin.nil? then \"\" else @personnel.workin.name end\n @manage = if @personnel.manage.nil? then \"\" else @personnel.manage.name end\n\n\t\trespond_to do |format|\n\t\t\tformat.html { render :show }\n\t\t\tformat.json { render json: Oj.dump(@personnel) }\n\t\tend\n end", "def department_names; end", "def get_department_admin\n @agency,@dept = Agency.find(params[:agency]), Department.find(params[:dept]) \n role = @dept.role_memberships.where(:role_id=>2)\n @dept_admin = User.find(role[0].user_id) if !role.blank?\n render :layout => false\n end", "def department\n response = create_request(API_ENDPOINT, DEPARTMENTS_URI)\n arrange_response(response)\n end", "def departments\n render json: Department.all.order(:name).includes(:regional_name).map{|x| {id: x.id, name: x.rgnl_name}}\n end", "def department; end", "def department; end", "def department; end", "def government_map\n @departments = @city.departments.government\n render action: :department_map\n end", "def extract_department(dept_uri, vivo_loc, username, password)\n client = VivoWebApi::Client.new(vivo_loc)\n client.authenticate(username, password)\n\n person_construct = <<-EOH\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX foaf: <http://xmlns.com/foaf/0.1/>\nPREFIX core: <http://vivoweb.org/ontology/core#>\n\nconstruct { \n ?person core:personInPosition ?pos .\n ?person foaf:firstName ?firstName .\n ?person foaf:lastName ?lastName .\n ?person core:authorInAuthorship ?authorship .\n ?person rdf:type ?type .\n ?person rdfs:label ?label \n}\nwhere {\n <#{dept_uri}> core:organizationForPosition ?pos .\n ?person core:personInPosition ?pos .\n\n ?person foaf:firstName ?firstName .\n ?person foaf:lastName ?lastName .\n ?person rdf:type ?type .\n ?person rdfs:label ?label .\n\n optional { ?person core:authorInAuthorship ?authorship }\n}\n EOH\n\n authorship_construct = <<-EOH\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX core: <http://vivoweb.org/ontology/core#>\n\nconstruct { \n ?authorship core:linkedAuthor ?person .\n ?authorship core:authorRank ?authorRank .\n ?authorship core:linkedInformationResource ?publication .\n\n ?authorship rdf:type ?type .\n ?authorship rdfs:label ?label \n}\nwhere {\n <#{dept_uri}> core:organizationForPosition ?pos .\n ?person core:personInPosition ?pos .\n\n ?authorship core:linkedAuthor ?person .\n ?authorship core:linkedInformationResource ?publication .\n\n ?authorship rdf:type ?type .\n optional { ?authorship rdfs:label ?label }\n optional { ?authorship core:authorRank ?authorRank }\n}\n EOH\n\n publication_construct = <<-EOH\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX core: <http://vivoweb.org/ontology/core#>\nPREFIX bibo: <http://purl.org/ontology/bibo/>\n\nconstruct {\n ?publication rdf:type ?type .\n ?publication rdfs:label ?label . \n\n ?authorship core:linkedInformationResource ?publication .\n ?publication core:informationResourceInAuthorship ?authorship .\n ?publication bibo:pageStart ?pageStart .\n ?publication bibo:pageEnd ?pageEnd .\n ?publication bibo:volume ?volume .\n ?publication bibo:issue ?issue .\n ?publication core:yearMonth ?yearMonth .\n ?publication core:doi ?doi\n}\nwhere {\n <#{dept_uri}> core:organizationForPosition ?pos .\n ?person core:personInPosition ?pos .\n ?person core:authorInAuthorship ?authorship .\n ?authorship core:linkedInformationResource ?publication .\n\n ?publication rdf:type ?type .\n ?publication rdfs:label ?label . \n\n ?authorship core:linkedInformationResource ?publication .\n ?publication core:informationResourceInAuthorship ?authorship .\n optional { ?publication bibo:pageStart ?pageStart }\n optional { ?publication bibo:pageEnd ?pageEnd }\n optional { ?publication bibo:volume ?volume }\n optional { ?publication bibo:issue ?issue }\n optional { ?publication core:yearMonth ?yearMonth }\n optional { ?publication core:doi ?doi }\n}\n EOH\n\n person_results = client.execute_sparql_construct(username, password, \n person_construct)\n authorship_results = client.execute_sparql_construct(username, password, \n authorship_construct)\n publication_results = client.execute_sparql_construct(username, password, \n publication_construct)\n\n results = []\n person_results.each do |statement| \n results << statement\n end\n\n authorship_results.each do |statement| \n results << statement\n end\n\n publication_results.each do |statement| \n results << statement\n end\n\n return results\nend", "def get_organization_info\n path = \"/d2l/api/lp/#{$lp_ver}/organization/info\"\n _get(path)\n # return: Organization JSON block\nend", "def index\n opts = {\n parent_id: params[:college_id]\n }.delete_if { |key, value| value.blank?}\n opts[:title] = /.*#{params[:key]}.*/ unless params[:key].blank?\n\n @departments = paginate(Department.includes(:college).where(opts))\n end", "def show\n @department = Department.all \n end", "def show\n @departments = MemberDepartment.where(member_id: @member.id).joins(:department).map { |d| d.department.name }.join(', ')\n @home_address = Address.find_by_id(@member.home_address_id)\n @work_address = Address.find_by_id(@member.work_address_id)\n @emergency_contact = EmergencyContact.find_by_id(@member.emergency_contact_id)\n @emergency_contact_address = Address.find_by_id(@emergency_contact.address_id)\n end", "def user_departments(user=current_user)\n if user.role? :superadmin\n @departments = Department.active\n else\n @departments = @department || user.department\n end\n end", "def about\n @department = Department.find_by name: 'Municipal Planning and Development Office'\n @city = City.first\n end", "def show\n @departments = Department.all\n @assemblies = Assembly.all\n @items = Item.all\n @location_departments = LocationDepartment.find_all_by_location_id(@order.location_id)\n end", "def get_department\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "def show\n @educations = @city.educations\n @number_of_educations = @city.educations.count\n @pagy, @educations = pagy(@city.educations, items: 30)\n @page_title = @city.name\n end", "def index\n if current_user.user_type_id == 1 #SUPER USER\n @reservations = Agenda::Reservation.search(params[:search]).order(\"#{sort_column} #{sort_direction}\").paginate(per_page: 15, page: params[:page])\n else\n @reservations = Agenda::Reservation.my_department(current_user.department_id).search(params[:search]).order(\"#{sort_column} #{sort_direction}\").paginate(per_page: 15, page: params[:page])\n end\n end", "def ppos_list\n @department = Department.find(params[:department_id])\n @degree_programs = DegreeProgram.search(params[:search], params[:page],params[:department_id])\n\n respond_to do |format|\n format.html # ppos_list.html.erb\n format.xml { render :xml => @degree_programs }\n end\n end", "def index\n @departmentlessons = Departmentlesson.all\n if(params.has_key?(:department))\n @department=Department.find(params[:department])\n @departmentlicenses=@department.departmentlicenses\n end\n end", "def department\n self.root\n end", "def set_department\n @department = current_ou.departments.find(params[:id])\n end", "def show\n @departmentlist = Departmentlist.find(params[:id])\n\tend", "def department_map\n @departments = @city.departments.all\n @government_departments = @city.departments.government # Setups up an instance variable for all government departments.\n @school_departments = @city.departments.schools # Setups up an instance variable for all school departments.\n @park_departments = @city.departments.parks # Setups up an instance variable for all parks departments.\n end", "def department\n self\n end", "def show\n distritos = Ubigeo.where('ug_id = ?', @request.ubigeo_id)\n @distrito = distritos.first\n provincias = Ubigeo.where('ug_id = ?', @distrito.parent_id)\n @provincia = provincias.first\n departamentos = Ubigeo.where('ug_id = ?', @provincia.parent_id)\n @departamento = departamentos.first\n render layout: 'ultra-empty'\n end", "def show\n @department = Department.find(params[:id])\n end", "def show\n redirect_to :controller => \"department_members\", :action => \"show\",:department_id=>params[:id]\n # @department = Department.find(params[:id])\n #\n # respond_to do |format|\n # format.html {\n # @members_count = @department.department_members.count\n # @members_pages = Paginator.new self, @members_count, per_page_option, params['page']\n # @members = @department.department_members.all(\n # :limit => @members_pages.items_per_page,\n # :offset => @members_pages.current.offset)\n #\n # #@members = @department.department_members\n # render :action => 'show', :layout => !request.xhr?\n # }\n # end\n end", "def district_info_get\n @body_class = 'district'\n @admin = current_admin_user # TODO auth\n @district = @admin.district\n\n @saved = false\n return render 'district_info'\n end", "def get_lead_stages\n if params[:page].present?\n @page = params[:page]\n else\n @page = \"lead_listing\"\n end\n @lead = @current_organization.deals.find(params[:id])\n render partial: \"get_stages\"\n end", "def show\n @employees = @department.employees\n end", "def department\n @_department ||= ActiveRecord::Department.\n where(name: self.value).first!\n end", "def index\n @departments = Department.paginate(:page => params[:page], :per_page => 30)\n end", "def organization\n self.data_response.organization\n end", "def get_department_pages\n return [Nokogiri::HTML(open('https://www.sis.hawaii.edu/uhdad/avail.classes?i=MAN&t=201430&s=ICS')).css(\".listOfClasses\").to_s,\n Nokogiri::HTML(open('https://www.sis.hawaii.edu/uhdad/avail.classes?i=MAN&t=201430&s=MATH')).css(\".listOfClasses\").to_s,\n Nokogiri::HTML(open('https://www.sis.hawaii.edu/uhdad/avail.classes?i=MAN&t=201430&s=PSY')).css(\".listOfClasses\").to_s]\n end", "def index\n @employee_departments = EmployeeDepartment.all\n end", "def index\n @department = Department.find(params[:department_id])\n @degree_programs = DegreeProgram.search(params[:search], params[:page],params[:department_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @degree_programs }\n end\n end", "def show\n @page_title = @department.name\n respond_to do |format|\n format.html\n format.atom\n if authorized?(@department) || (current_user && current_user.editor?(@department))\n format.csv do\n data = cache(['departments/csv', @department]) do\n logger.debug { \"Generating csv for department #{@department.name}\" }\n @department.to_csv\n end\n send_csv data, @department \n end\n end\n end\n end", "def set_department\n @department = current_store.departments.friendly.find(params[:id])\n end", "def index\n if @department.present?\n @documents = @department.documents.all\n else\n @documents = Document.all\n end\n end", "def get_units\n @agency, @depts = params[:agency], params[:dept]\n render :layout => false\n end", "def index\n if current_devise_user.user_type_id == 1\n @catalogs_headquarters = Catalogs::Headquarter.search(params[:search]).order(\"#{sort_column} #{sort_direction}\").paginate(per_page: 15, page: params[:page])\n else\n @catalogs_headquarters = Catalogs::Headquarter.where(department_id: [0, current_devise_user.department_id]).search(params[:search]).order(\"#{sort_column} #{sort_direction}\").paginate(per_page: 15, page: params[:page])\n end\n end", "def government \n if params[:sort_by] == \"score\"\n @departments = @city.departments.government.order('score DESC')\n render action: :index\n elsif params[:sort_by] == \"name\"\n @departments = @city.departments.government.order('name')\n render action: :index\n elsif params[:sort_by] == \"reviews\"\n @departments = @city.departments.government.joins(:reviews).group('departments.id, department_id').order('COUNT(reviews.id) DESC') \n render action: :index\n elsif params[:sort_by] == \"trending\"\n @departments = @city.departments.government.joins(:punches).group('departments.id').order('COUNT(punches.id) DESC')\n render action: :index\n else \n @departments = @city.departments.government.joins(:punches).group('departments.id').order('COUNT(punches.id) DESC')\n render action: :index\n end \n end", "def show\n @departments = Department.order(:id)\n end", "def index\r\n params[:per_page] ||= current_admin.admin_settings.find_or_create_by_key('per_page').value\r\n params[:per_page] ||= 15\r\n #@departments = Department.paginate :page => params[:page], :per_page => params[:per_page], :order => \"#{params[:sort_by]} #{params[:sort_order]}\"\r\n @departments = Department.search(params, current_admin.id)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @departments }\r\n end\r\n end", "def show\n @dept = Dept.find(params[:id])\n @dept_address = DeptAddress.where(:dept_id => params[:id])\n @dept_telephones = DeptTelephone.where(\"dept_id = ?\", params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @dept }\n end\n end", "def index\n if(current_user.phase1 == false && current_user.phase2 == false && current_user.phase3 == false)\n x= current_user.id\n @user_profile = UserProfile.all.where(\"user_id = ?\",x)\n @user_profile =@user_profile[0]\n #puts(@user_profile[0].department)\n\n @pstaff = Pstaff.where(\"user_profile_id = ?\",@user_profile.id)\n\n else\n redirect_to new_user_session_path\n end\n end", "def index\n @user = User.find(current_user.id)\n if @user.present? && @user.first_name != 'Administrator'\n fdp_locations = Location.find_by(id: @user.location_id).descendants.where( location_type: :woreda).map { |d| d.id}\n @fdps = Fdp.where( location_id: fdp_locations).all\n else\n @fdps = Fdp.all \n end\n\n\n \n end", "def show\n render json: @department\n end", "def index\n @readonly_admins = ReadonlyAdministrator.scoped\n if params.keys.include? \"department_id\"\n respond_with @readonly_admins.where(:department_id => params[:department_id])\n else\n respond_with @readonly_admins\n end\n end", "def index\n @doctor=Doctor.find(params[:doctor_id])\n @departments = @doctor.departments\n end", "def set_departments\n @dptos=Department.where(enterprise_id: current_emp.id)\n end", "def departments_mapping(status = :confirmed, academic_department = false)\n OFFERINGS_CACHE.fetch(\"departments_mapping_#{id}_#{status.to_s.underscore}\", :expires_in => 24.hours) do\n @apps = application_for_offerings.with_status(status)\n departments = {}\n for iapp in @apps\n dept = academic_department==true ? iapp.primary_mentor.academic_department : iapp.mentor_department \n dept.each{|d| departments[d] = (departments[d].nil? ? [iapp.id] : departments[d] << iapp.id) } unless dept.blank? \n end\n departments\n end\n end", "def show\n @employee_department = EmployeeDepartment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employee_department }\n end\n end", "def get_allowed_data_objects\n return @department.data_objects if current_user.is_admin_of?(@department)\n unless (@loc_groups = current_user.loc_groups_to_admin(@department)).empty?\n @loc_groups.map{|lg| DataObject.by_location_group(lg)}.flatten \n else\n flash[:error] = \"You do not have the permissions necessary to view any\n data objects.\"\n redirect_to access_denied_path\n end\n end", "def index\n @current_user = User.find(session[:user_id])\n user = params[:user]\n department = params[:department]\n if user\n render json: Booking.where('user_id = ?', session[:user_id]).joins(:department)\n .includes(:department)\n .select('departments.name AS department')\n .order(timeStamp: :desc)\n\n elsif department\n @department = Department.find(department)\n render json: @department.bookings.joins(:department)\n .includes(:department)\n .select('departments.name AS department_name')\n else\n render json: Booking.all\n .joins(:department)\n .includes(:department)\n .select('departments.name AS department_name')\n end\n end", "def office_district\n self.dig_for_string(\"agentSummary\", \"office\", \"officeAddress\", \"district\")\n end", "def mentor_department\n return read_attribute(:mentor_department) unless read_attribute(:mentor_department).blank?\n primary_mentor.department.try(:strip) if primary_mentor\n end", "def show\n @department = @speciality.department\n @courses = @speciality.courses\n end", "def show\n render json: @department, status: :found\n end", "def show\n #@departamento = Ubigeo.find_by_sql(\"where idDepartamento=\"+@estacionamiento.departamento.to_s)\n @serv_adicinales = ServAdicinale.all\n @departamento = Ubigeo.where(:idDepartamento => @estacionamiento.departamento).first\n @provincia = Ubigeo.where(:idProvincia => @estacionamiento.provincia).first\n @distrito = Ubigeo.where(:idDistrito => @estacionamiento.distrito).first\n @lista_departamentos = Ubigeo.find_by_sql(\"select distinct idDepartamento, Departamento from ubigeos\")\n @lista_provincias = Ubigeo.find_by_sql(\"select distinct idProvincia, Provincia from ubigeos\")\n @lista_distritos = Ubigeo.find_by_sql(\"select distinct idDistrito, Distrito from ubigeos\")\n \n end", "def get_course_page(department)\n puts Nokogiri::HTML(open(department[1])).css('table.listOfClasses')\n return Nokogiri::HTML(open(department[1])).css('table.listOfClasses')\n end", "def set_department\n @department = current_company.departments.find(params[:id])\n end", "def index\n @catalogs_departments = Catalogs::Department.search(params[:search]).order(\"#{sort_column} #{sort_direction}\").paginate(per_page: 15, page: params[:page])\n end", "def index\n\t\t@s = params[:search]\n\t\t@loc = params[:department_area_id]\n\n\t\t@problems = find_items(params)\n\t\t@locations = DepartmentArea.all.group_by(&:department_id)\n\tend", "def show\n @tab_idx = params[:tab_idx] || 0\n @fdn_organization = Fdn::Organization.find(params[:id])\n #@pprs = Prs::PropertyRight.by_ent_id(@fdn_organization.resource_id)\n #if @fdn_organization.org_type_code == 'ENT'\n # @investors = Fdn::EntInvestor.where('org_id = ?', @fdn_organization.id).order(\"percentage DESC\")\n #end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @fdn_organization }\n end\n end", "def department\n @departments = @company.departments\n respond_to do |format|\n format.json { render json: @departments}\n end\n end", "def organisation_details\n return blank_value unless organisation\n\n organisation.partnership? ? partner_names : organisation.name\n end", "def faculty\n department.faculty\n end", "def auth_user_managed_departments(user_id)\n u = User.find(user_id)\n# arr_depts = u.employe.manageddepartments\n# u.employe.manageddepartments.each do |node|\n# node.progenies(node, arr_depts)\n# end\n arr_depts = Department.find(:all, :conditions => \"incode like '\" + u.employe.department.incode + \"%'\")\n return arr_depts.collect{|rec| rec.id}\n end", "def index\n @departments = Department.all\n end", "def index\n @departments = Department.all\n end", "def index\n @departments = Department.all\n end", "def index\n @personnels = Personnel.all\n @departments = Department.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html { render :index }\n\t\t\tformat.json { render json: Oj.dump(@personnels.select([:id, :first_name, :last_name, :email, :gender])) }\n\t\tend\n end", "def organizational_unit\n self[:OU]\n end", "def set_department\n @department = Department.friendly.find(params[:id])\n end", "def set_department\n @department = Department.friendly.find(params[:id])\n end", "def get_departments\n @type = params[:value] \n render :layout => false \n end", "def index\n @departments = Department.paginate( :page => params[:page], :per_page => 10, :order => \"DepartmentID DESC\" );\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @departments }\n end\n end", "def organization\n Department.where(:tag_name => self.tags.all_private.map(&:name)).first\n end", "def index\n @department_members = DepartmentMember.all\n end", "def show\n @user = @department.users.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def index\n @institute_admins = case current_user.rc\n when 'EA'\n InstituteAdmin.includes(:profile).page(params[:page])\n when 'IA'\n InstituteAdmin.includes(:profile).where(:id=>current_user.institute_admin).page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @institute_admins }\n end\n end", "def departments_search\n render 'activities/departments/departments_search'\n end", "def show\n @degree_program = DegreeProgram.find(params[:id])\n @department = Department.find(@degree_program.department.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @degree_program }\n end\n end", "def default_department\n default_department ||= current_user.role_memberships.where(:default_dept => true).first.department.id\n end", "def index\n @charities=current_user.organization.charities.paginate(page: params[:page],per_page:6)\n end" ]
[ "0.6351933", "0.634018", "0.6282584", "0.6263901", "0.6243959", "0.62017155", "0.61891556", "0.6154866", "0.61155283", "0.6108637", "0.60769665", "0.6044919", "0.60250187", "0.60056245", "0.5984907", "0.5926598", "0.5917869", "0.5917869", "0.5917869", "0.5900851", "0.5875386", "0.57771385", "0.5758266", "0.575489", "0.5747847", "0.5706957", "0.56984377", "0.5696877", "0.5688242", "0.5685348", "0.5680467", "0.56538343", "0.56470585", "0.56014305", "0.56005895", "0.55777013", "0.55719376", "0.55390686", "0.5532201", "0.55117524", "0.5511172", "0.54883575", "0.5484623", "0.5479813", "0.54782283", "0.54692584", "0.54643166", "0.54625833", "0.54619133", "0.5457733", "0.54513603", "0.5441284", "0.5431649", "0.5429001", "0.5407867", "0.5404451", "0.53985304", "0.53975534", "0.5384452", "0.5375231", "0.5368975", "0.5368232", "0.53617775", "0.5353493", "0.5345755", "0.5341765", "0.5336446", "0.5336006", "0.53356576", "0.53296417", "0.5328577", "0.5319934", "0.52992034", "0.52989346", "0.5293721", "0.5292946", "0.5287167", "0.52842104", "0.5283693", "0.5281914", "0.52813053", "0.5277245", "0.5271348", "0.5257151", "0.5257151", "0.5257151", "0.5239598", "0.52340454", "0.5231901", "0.5231901", "0.5228725", "0.5221092", "0.5220232", "0.52153724", "0.5212132", "0.5210265", "0.52048856", "0.51915914", "0.51888335", "0.5182888" ]
0.58189183
21
Get data for Campus Landing Page
def getCampusLandingPageData(unit, attrs) return { :pub_count => ($statsCampusPubs.keys.include? unit.id) ? $statsCampusPubs[unit.id] : 0, :view_count => 0, :opened_count => 0, :journal_count => ($statsCampusJournals.keys.include? unit.id) ? $statsCampusJournals[unit.id] : 0, :unit_count => ($statsCampusOrus.keys.include? unit.id) ? $statsCampusOrus[unit.id] : 0 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @campuses = Campus.all\n end", "def index\n @campsites = Campsite.all\n end", "def index\n @campsites = Campsite.all\n end", "def index\n @campingsites = Campingsite.all\n end", "def index\n @camps = Camp.active.chronological.paginate(page: params[:page]).per_page(10)\n @upcomingCamps = Camp.active.upcoming.chronological.paginate(page: params[:page]).per_page(10)\n @pastCamps = Camp.active.past.chronological.paginate(page: params[:page]).per_page(10)\n @inactiveCamps = Camp.inactive.chronological.paginate(page: params[:page]).per_page(10)\n @user = current_user\n end", "def index\n @campania = Campanium.all\n end", "def show\n @campus_detail = CampusDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campus_detail }\n end\n end", "def index\n # Get all rows in the campsites table\n # (as an array of Campsite objects)\n @campsites = Campsite.all\n end", "def index\n authorize! :index, Campus, :message => 'Acceso denegado.'\n @campuses = @university.campuses\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campuses }\n end\n end", "def index\n @campanhas = Campanha.all\n end", "def show\n # Gets us one row, and returns it as an object\n # (an instance of the Campsite model class)\n @campsite = Campsite.find params[:id]\n end", "def show\n @camp = Camp.find(params[:id])\n @students = Student.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @camp }\n end\n end", "def index\n @world_cities = PhillyCrime.paginate(page: params[:page])\n end", "def index\n @club_team = ClubTeam.general_pages.first\n render :show\n end", "def show\n if current_user.type != 'Administrator'\t\n check_privilege(@institution)\n end\n @campus = Campu.where(institution_id: @institution.id).find_each\n @campu = Campu.new\n end", "def index\n @pages = @club.all_pages\n \n @page_title = \"Page Listing\"\n @site_section = \"clubs\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end \n end", "def organisation_data_for_show_method\n @location = @user.location\n @country = @location.country # personal country name\n @state = @location.state # personal state name\n @organisation = @user.organisation\n @organisation_country = @organisation.country\n @organisation_state = @organisation.state\n end", "def show\n camp_applications = current_family.application.camps\n render json: camp_applications.as_json\n end", "def set_campus\n @campus = FortyTwo::Campus.find(params[:id])\n end", "def index\n @campanas = Campana.page(params[:page]).per(10) #.all \n end", "def index\n @campanhas = Campanha.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campanhas }\n end\n end", "def show\n @missions = Mission.all\n show_clams = Clam.where(\"mission_id IS ?\", nil)\n show_clams = show_clams.search(params[:search]) if params[:search]\n show_clams = show_clams.narrow_by_reuseinfo if params[:narrow]\n @clams = @mission ? @mission.clams : show_clams.order(\"date desc\")\n @clams = @clams.page(params[:page]).per(100)\n\n if request.xhr?\n tbody_elements = render_to_string(partial: 'clam_table', locals: {clams: @clams})\n link_to_next_page = view_context.link_to_next_page(@clams, 'Next', remote: true, class: 'next-page')\n render json: {tbody_elements: tbody_elements, link_to_next_page: link_to_next_page}\n end\n end", "def set_campus\n @campus = Campus.find(params[:id])\n end", "def set_campus\n @campus = Campus.find(params[:id])\n end", "def show\n @recuritment = CampusRecuritment.find(params[:id])\n end", "def index\n if current_relief_camp_admin.present?\n @camp_requests = current_relief_camp_admin.relief_camp.camp_requests\n else\n @camp_requests = CampRequest.all\n end\n end", "def index\n @lat_crimes = LatCrime.paginate(page: params[:page])\n end", "def show\n @cities = @state.cities\n @number_of_cities = @state.cities.count\n @pagy, @cities = pagy(@state.cities, items: 30)\n @page_title = @state.name\n end", "def index\n @camps = Camp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @camps }\n end\n end", "def show\n @user = User.find_by_email(@listing.host_email)\n @activity_service = ActivityService.new\n @major_cities = MajorCity.none\n end", "def show\n @educations = @city.educations\n @number_of_educations = @city.educations.count\n @pagy, @educations = pagy(@city.educations, items: 30)\n @page_title = @city.name\n end", "def show\n @page = @club.pages.find(params[:id])\n @page_title = @page.title\n @site_section = \"clubs\"\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @page }\n end\n end", "def show\n @campanha = Campanha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campanha }\n end\n end", "def show\n set_location\n @courses = @location.courses\n end", "def index\n @admin_city_hall_stories = City.find(session[:current_city_id]).commonplace.city_hall_story\n end", "def index\n @campu_types = CampuType.all\n end", "def show\r\n @new_page = Page.new({project: @project, name: generate_new_page_name})\r\n @new_data_source = DataSource.new({project: @project})\r\n @pages_list = @project.pages.map {|i| [i.id, i.name]}\r\n @data_sources = @project.data_sources.includes(:data_source_type)\r\n end", "def index\n params[:page] ||= 1\n @municipal_id = (params[:municipal] and !params[:municipal][:id].blank?) ? params[:municipal][:id] : \"\"\n @province_id = (params[:province] and !params[:province][:id].blank?) ? params[:province][:id] : \"\"\n\n # Retrieve info for dropdown\n @nationwide = Location.get_nationwide\n @provinces = Location.provinces.where('id != ?', @nationwide.id).collect {|p| [p.name.capitalize, p.id]}.insert(0, [@nationwide.name.capitalize, @nationwide.id])\n @municipals = Location.municipality(@province_id)\n\n # get Politicians based on their current career\n # -- we split these into two variables, one for pagination, one for looping thru\n # all the records. This is necessary because all pagination gems gets confused\n # if the query has groups/LEFT JOINs\n @careers = Career.current\n .select_title_heirarchy\n .with_loc_and_pol\n .search(params[:search])\n .in_municipal(@municipal_id)\n .in_province(@province_id)\n .page(params[:page])\n\n @careers_with_comments = @careers\n .order(sort_column + \" \" + sort_direction + \", politicians.id\")\n .with_comments\n\n end", "def index\n @companies_info = Company.display_information\n end", "def show\n @campanium = Campanium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campanium }\n end\n end", "def index\n @member_of_parliaments = MemberOfParliament.all\n end", "def index\n\n setup_for_index(active_data(:semester_id), active_data(:campus_id))\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @prcs }\n end\n end", "def show\n @bootcamp = Bootcamp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bootcamp }\n end\n end", "def index\n @clinics = Clinic.joins(:entities).where(\"entities.id = ?\", current_user.entity.id)\n\n if request.xhr?\n render partial: 'clinics', locals: { clinics: @clinics}\n end\n \n end", "def index\n @medical_camps = MedicalCamp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @medical_camps }\n end\n end", "def show\n @camp = Camp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @camp }\n end\n end", "def show\n @campus = @university.campuses.includes(:pors).find(params[:id])\n authorize! :show, @campus, :message => 'Acceso denegado.'\n @buildings = @campus.buildings.order(:name)#.paginate(:per_page => 3, :page => params[:buildings_page])\n @pors = @campus.pors.order(:name)#.paginate(:per_page => 3, :page => params[:pors_page])\n @pois = @campus.pois.order(:name)#.paginate(:per_page => 3, :page => params[:pois_page])\n @events= @campus.events.order(:name)\n #se declaran las opciones para la seleccion de búsqueda\n @options = [['Edificio', 0], ['Punto de interés', 1], ['Punto de reciclaje', 2], \n['Evento', 3]]\n @object_filtered=[] \n if params[:search]\n search=params[:search]\n @class_search=params[:option][:option_id]\n if @class_search==='0'\n @object_filtered=get_items('Building',search,params[:id])\n elsif @class_search=='2'\n @object_filtered=get_items('Por',search,params[:id])\n elsif @class_search=='1'\n @object_filtered=get_items('Poi',search,params[:id])\n elsif @class_search=='3'\n @object_filtered=get_items('Event',search,params[:id])\n end\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campus }\n format.js\n end\n end", "def index\n @schools = @city.schools\n end", "def show\n @breadcrumbs = [[\"Home\", root_url], [@citizen.to_s, \"/citizens/#{@citizen.id}\"]]\n @projects = Project.for_citizen(@citizen)\n @facilities = Facility.for_citizen(@citizen)\n end", "def show\n @medical_camp = MedicalCamp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medical_camp }\n end\n end", "def index\n @companies = Company.all.where(user_id: current_user.id).order(\"name\")\n @path = 'locations'\n @pagetitle = \"Locations\"\n end", "def set_campsite\n @campsite = Campsite.find(params[:id])\n end", "def index\n @companies = Company.find(:all, :conditions => {:user_id => getUserId()}, :order => \"name\")\n @path = 'divisions'\n @pagetitle = \"Divisions\"\n end", "def index\n if params[:major]\n @admin_profiles = City.find(session[:current_city_id]).commonplace.major\n else\n @admin_profiles = City.find(session[:current_city_id]).commonplace.city_councils_with_vice_major.page(params[:page])\n end\n\n end", "def index\n @ingreso_campanas = IngresoCampana.all\n end", "def show\n cf_get(path: \"/organizations/#{org_id}\")\n end", "def index\n if params[:search].present?\n @campings = Camping.near(params[:search], 10, :order => :distance).page(params[:page]).per(14)\n else\n @campings = Camping.all\n #Avec la Pagination\n #@campings = Camping.all.page(params[:page]).per(14)\n end\n\n #Systeme de Geocode avec marker permet d'encoder les adresse en GEOTAG\n @hash = Gmaps4rails.build_markers(@campings) do |camping, marker|\n marker.lat camping.latitude\n marker.lng camping.longitude\n marker.infowindow \"\n <h3><a href='#{camping_path(camping.id)}' class='nice-link info-link'class='btn-primary' role='button'>#{camping.name}</a> </h3>\n <p>Camping <b>#{camping.etoile} à #{camping.commune}</b></p>\"\n marker.picture ({\n \"url\" => \"http://avantjetaisriche.com/map-pin.png\",\n \"width\" => 29,\n \"height\" => 32})\n end\n end", "def index\n @campaigns = current_organization.campaigns\n render :index\n end", "def show\n @condolence = Condolence.find(params[:id])\n @orbituarysite = current_user.orbituarysites.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condolence }\n end\n end", "def show\n @department = @speciality.department\n @courses = @speciality.courses\n end", "def list_divisions\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Divisions\"\n \n if(@company.can_view(getUser()))\n @divisions = Division.find(:all, :conditions => {:company_id => @company.id}, :order => \"name\")\n else\n errPerms()\n end\n end", "def index\n @plants = @project.plants\n end", "def show\n redirect_to \"index\", alert: \"Debes introducir una ciudad\" if params[:query].blank?\n find_results\n\n # FIXME: no se visualiza, test falla\n redirect_to \"index\", alert: \"No se han encontrado centros\" if @schools.nil?\n end", "def index\n @landing_pages = LandingPage.all.includes(:database)\n end", "def show\n @gastos = Gasto.all\n @company = Company.find(1)\n @locations = @company.get_locations()\n @divisions = @company.get_divisions()\n @documents = @company.get_documents()\n @cajas = Caja.all \n @employees = @company.get_employees \n @tipomov = Tipomov.all \n end", "def index\n redirect_to home_company_path(@company)\n # @company_job_opportunities = @company.job_opportunities\n end", "def show\n @college = College.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @college }\n end\n end", "def show\n @colleges = College.order(:name)\n @college = College.find params[:id]\n end", "def show\n @camp = Camp.find(params[:id])\n @camp.time_slot == \"am\" ? @timeSlot = \"Morning\" : @timeSlot = \"Afternoon\"\n @location = @camp.location\n @registrations = @camp.registrations.by_student.paginate(page: params[:page]).per_page(10)\n @instructors = @camp.instructors.alphabetical.paginate(page: params[:page]).per_page(4)\n @dates = \"#{@camp.start_date.strftime(\"%m/%d/%y\")} - #{@camp.end_date.strftime(\"%m/%d/%y\")}\"\n @camp.active ? @status = \"Active\" : @status = \"Inactive\"\n @registrationSize = @camp.registrations.count\n @eligableStudents = []\n Student.active.alphabetical.each do |student|\n if student.rating >= @camp.curriculum.min_rating && student.rating <= @camp.curriculum.max_rating\n @eligableStudents << student\n end\n end\n @registration = Registration.new\n end", "def index\n @landing_page_configs = LandingPageConfig.all\n end", "def show\n render template: 'pages/404', status: 404 and return if @organisation.nil?\n organisations = Organisation.where(id: @organisation.id)\n if current_user\n @pending_org_admin = current_user.pending_org_admin? @organisation\n @editable = current_user.can_edit?(@organisation)\n @deletable = current_user.can_delete?(@organisation)\n @can_create_volunteer_op = current_user.can_create_volunteer_ops?(@organisation)\n @grabbable = current_user.can_request_org_admin?(@organisation)\n else\n @grabbable = true\n end\n add_breadcrumb @organisation.name, :organisation_path\n @can_propose_edits = current_user.present? && !@editable\n @markers = build_map_markers(organisations)\n @cat_name_ids = Category.name_and_id_for_what_who_and_how\n end", "def index\n @cities = current_user.cities\n \n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def list_locations\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Locations\"\n \n if(@company.can_view(current_user))\n @locations = Location.where(company_id: @company.id).order(\"name\")\n else\n errPerms()\n end\n end", "def index\n \t_projects = Property.show_all_visible\n \tproj = _projects.collect{|p| p.name }.join(', ')\n \t\n \t@page_title = \"CebuCondoListings | Cebu Condominium Listings - #{proj}\" \n if logged_in?\n @properties = Property.show_all\n else\n @properties = Property.show_all_visible \n end\n end", "def show\n @admin_agency = Admin::Agency.where(:id => params[:id]).includes(:pages)[0]\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_agency }\n end\n end", "def show\n # turn ruby database into json\n # route to the project 3 page with this json\n # id = 1\n end", "def cities\n CS.get :us, :ca\n end", "def show\n @location = Location.find(params[:id])\n @courses = @location.courses\n end", "def index\n @cms_pages = current_portal.pages\n end", "def new\n @campus_detail = CampusDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @campus_detail }\n end\n end", "def set_campsite\n @campsite = Campsite.find(params[:id])\n end", "def index\n @company = Company.all\n if session[:group] == \"admin\"\n if params[:fillter]\n @tourguides = Tourguide.search(params[:fillter]).order(\"created_at DESC\").page(params[:page])\n else\n @tourguides = Tourguide.order(:name).page(params[:page])\n end\n else\n @company = Company.where(id:session[:company_id])\n if params[:fillter]\n @tourguides = Tourguide.search(params[:fillter],session[:company_id]).order(\"created_at DESC\").page(params[:page])\n else\n @tourguides = Tourguide.where(company_id:session[:company_id]).order(:name).page(params[:page])\n end\n end\n # if params[:search]\n # @tourguides = Tourguide.search(params[:search]).order(\"created_at DESC\").page(params[:page])\n # else\n # @tourguides = Tourguide.order(:name).page(params[:page])\n # end\n end", "def index\n @landings = Landing.all\n end", "def index\n @landings = Landing.all\n end", "def index\n projects = Project.where(company_id:current_user.company_id)\n @field_data = FieldDatum.where(project: projects)\n end", "def show\n @company = Company.find(params[:id]) if params[:id].present?\n @company_notes = Note.notes_of_company @company if @company.present?\n @active_campaigns = @company.active_campaigns if @company.present?\n session[:page_title] = \"Company Profile\"\n session[:tab_title] = \"Company Overview\"\n end", "def index\n authorize! :index, Por, :message => 'Acceso denegado.'\n @pors = @campus.pors.paginate(:per_page => 3, :page => params[:page])\n\t\t@points = @pors\n\t\t@point_name = \"por\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render \"points/index.json.erb\" } # index.json.erb\n end\n end", "def landing\n \t@user = User.find(params[:id])\n @course = User.joins(:course).select(\"users.*,courses.*\").find(params[:id])\n end", "def index\n @companies = Company.page(params[:page])\n @log = ParsingLog.running_parser\n\n render partial: \"companies_list\" if request.xhr? \n end", "def index\r\n if current_user.admin?\r\n @dashboard_disciplines = Discipline.includes(\"materials\")\r\n .paginate(:page => params[:page], :per_page => 10) \r\n else\r\n @dashboard_disciplines = current_user.disciplines \r\n .includes(\"materials\")\r\n .paginate(:page => params[:page], :per_page => 10) \r\n end\r\n end", "def index\n return redirect_to(request.env['REQUEST_URI'].include?(\"colleges\") ? college_path(params[:id]) : location_path(params[:id])) if params[:id]\n @locations = Location.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end", "def show\n @postcode = flash[:postcode]\n\n @constituency, @seat_incumbencies, @party = Parliament::Utils::Helpers::FilterHelper.filter(@request, 'ConstituencyGroup', 'SeatIncumbency', 'Party')\n # Instance variable for single MP pages\n @single_mp = true\n @constituency = @constituency.first\n @seat_incumbencies = @seat_incumbencies.reverse_sort_by(:start_date)\n\n @current_incumbency = @seat_incumbencies.shift if !@seat_incumbencies.empty? && @seat_incumbencies.first.current?\n\n @json_location = constituency_map_path(@constituency.graph_id, format: 'json')\n\n @current_party = @current_incumbency.member.current_party if @current_incumbency\n\n @party = @current_party ? @current_party : @party.first\n\n return if @postcode.nil?\n\n begin\n response = Parliament::Utils::Helpers::PostcodeHelper.lookup(@postcode)\n @postcode_constituency = response.filter(Parliament::Utils::Helpers::RequestHelper.namespace_uri_schema_path('ConstituencyGroup')).first\n postcode_correct = @postcode_constituency.graph_id == @constituency.graph_id\n @postcode_constituency.correct = postcode_correct\n rescue Parliament::Utils::Helpers::PostcodeHelper::PostcodeError => error\n flash[:error] = error.message\n @postcode = nil\n end\n end", "def show\n if(!params[:name])\n respond_to do |format|\n format.html { redirect_to fullregion_path(:name=>@region.name.strip.gsub(/[^A-Za-z0-9_ ]/,\"\").gsub(\" \",\"_\")) }\n end\n return\n # render :search\n # return\n end\n @meets = @region.events.all\n @meets = @meets.where(\"advanceddata is not null\")\n if(ActiveRecord::Base.connection.adapter_name == 'Mysql2' )\n @meets = @meets.order( 'STR_TO_DATE(date, \"%m/%d/%Y\") DESC, name ASC' ).paginate(:page => params[:page], :per_page => 15)\n else\n @meets = @meets.order( 'to_date(date,\\'MM/DD/YYYY\\') DESC, name ASC' ).paginate(:page => params[:page], :per_page => 15)\n end\n\n if @region.name\n @website = @region.name.strip\n spl = @region.name.strip.split(\" \")\n if spl[-1].upcase == spl[-1]\n @website = spl[0..spl.length-2].join(\" \")\n end\n @website = \"http://ftcstats.org/\" + @website.gsub(\" \",\"_\").downcase + \".html\"\n end\n end", "def get_information_all_companies()\n\t\tpage = 275\n\t\tbegin\n\t\t\turl = create_url(\"organizations\",\"\",page)\n\t\t\tputs \"Reading #{url}\"\n\t\t\tresult = read_url(url)\n\t\t\t#save_json(result, [\"organizations\"])\n\n\t\t\tadd_organization_info(result,\"name\")\n\t\t\tadd_organization_info(result,\"path\")\n\t\t\t\n\t\t\tnext_url = result['data']['paging']['next_page_url']\n\t\t\tpage = page + 1\n\t\tend while next_url != nil\n\t\tcreate_permalink(@paths)\n\t\tsave_json(\"\", [\"names\", \"paths\", \"permalinks\"])\n\tend", "def index\n @people = current_organization.people.all\n end", "def index\n @companies = Company.all.page params[:page]\n end", "def index\n @colaboradors = current_user.empresa.colaboradors.all\n end", "def org_show_data\n org = Organization.find(params[:org])\n\n @data = {\n name: org.name,\n website: org.website,\n logo_link: org.logo_link,\n users: user_names_and_emails_from_org(org)\n }\n\n render json: @data\n end", "def index\n @code_club_schools = CodeClubSchool.all\n end", "def index\n @charities=current_user.organization.charities.paginate(page: params[:page],per_page:6)\n end" ]
[ "0.69561905", "0.6953235", "0.6953235", "0.6789851", "0.6709516", "0.66408324", "0.6597581", "0.64995944", "0.6490238", "0.64849406", "0.64630735", "0.63775855", "0.6285137", "0.61803836", "0.6129322", "0.612639", "0.61263204", "0.6125091", "0.6103626", "0.6067645", "0.6059493", "0.60545176", "0.60292846", "0.60292846", "0.6015696", "0.6005345", "0.6000019", "0.5988515", "0.5978518", "0.5976044", "0.594167", "0.5938667", "0.5902264", "0.5881766", "0.58683646", "0.58483106", "0.58474886", "0.5845467", "0.5834671", "0.5824712", "0.582457", "0.5818061", "0.580968", "0.58095133", "0.58090323", "0.57928073", "0.57756984", "0.5767335", "0.5756933", "0.57553434", "0.57505596", "0.5749841", "0.57390624", "0.5732886", "0.5725517", "0.5717472", "0.5715406", "0.5710695", "0.57056564", "0.5699654", "0.56875044", "0.5683849", "0.5674334", "0.56718034", "0.56682205", "0.5667988", "0.5665966", "0.5659946", "0.5657847", "0.5657776", "0.5655794", "0.56520426", "0.5644508", "0.5644026", "0.5643539", "0.5639283", "0.5636855", "0.5636217", "0.5629956", "0.56293803", "0.56260675", "0.56211734", "0.5618392", "0.5618392", "0.56155354", "0.56033564", "0.5598429", "0.5597396", "0.55960226", "0.55959845", "0.55932474", "0.55843294", "0.5575566", "0.5574597", "0.5570262", "0.55702066", "0.55678266", "0.55624866", "0.5562445", "0.5562293" ]
0.65293777
7
Preview of Series for a Department Landing Page
def seriesPreview(u) items = UnitItem.filter(:unit_id => u.unit_id, :is_direct => true) count = items.count preview = items.limit(3).map(:item_id) itemData = readItemData(preview) { :unit_id => u.unit_id, :name => u.unit.name, :count => count, :items => itemResultData(preview, itemData) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submission_preview\n # load a random study, or use selected study\n @studies = Study.where(public: true).pluck(:name, :id)\n end", "def show\n @serial_works = @series.serial_works.find(:all, :include => :work, :conditions => ['works.posted = ?', true], :order => :position).select{|sw| sw.work.visible(User.current_user)}\n # sets the page title with the data for the series\n @page_title = \"\"\n if logged_in? && !current_user.preference.work_title_format.blank?\n @page_title = current_user.preference.work_title_format\n @page_title.gsub!(/FANDOM/, @series.allfandoms.collect(&:name).join(', '))\n @page_title.gsub!(/AUTHOR/, @series.allpseuds.collect(&:byline).join(', '))\n @page_title.gsub!(/TITLE/, @series.title)\n else\n @page_title = @series.title + \" - \" + @series.allpseuds.collect(&:byline).join(', ') + \" - \" + @series.allfandoms.collect(&:name).join(', ')\n end\n @page_title += \" [#{ArchiveConfig.APP_NAME}]\"\n end", "def previews\n @session_user = User.find(session[:user_id])\n @page = @session_user.page\n panels = Array.new\n for panel in @page.panels.order(:created_at)\n fields = get_panel_preview(panel) \n panels.push(fields)\n end\n render json: panels\n end", "def preview\n get_filtered_dataset false, 10\n end", "def show\n @enabled = @study_plan.schedules.present? ? true : false\n @schedule = @study_plan.schedules.last if @enabled #to get latest schedule\n if params[:pdf].present? and params[:pdf]=='1'\n @is_pdf = true\n render :pdf => \"Study Plan #{@study_plan.id}\"\n end\n end", "def show\n @reform = Reform.active.with_color.friendly.find(@reform_survey.reform_id)\n\n @methodology_government = PageContent.find_by(name: 'methodology_government')\n @methodology_stakeholder = PageContent.find_by(name: 'methodology_stakeholder')\n @news = News.by_reform_quarter(@quarter.id, @reform.id)\n\n gon.chart_download_icon = highchart_download_icon\n gon.change_icons = view_context.change_icons\n\n quarter_ids = Quarter.with_reform(@reform.id).recent.pluck(:id)\n\n government_time_series = Quarter.reform_survey_data_for_charting(\n @reform.id,\n type: 'government',\n id: 'reform-government-history',\n is_published: false,\n quarter_ids: quarter_ids\n )\n\n stakeholder_time_series = Quarter.reform_survey_data_for_charting(\n @reform.id,\n type: 'stakeholder',\n id: 'reform-stakeholder-history',\n is_published: false,\n quarter_ids: quarter_ids\n )\n\n gon.charts = [\n government_time_series,\n stakeholder_time_series\n ]\n\n if @reform_survey.present?\n [\n {\n id: 'reform-government-overall',\n color: government_time_series[:color],\n title: I18n.t('shared.categories.overall'),\n score: @reform_survey.government_overall_score.to_f,\n change: @reform_survey.government_overall_change\n }, {\n id: 'reform-government-institutional-setup',\n title: I18n.t('shared.categories.initial_setup'),\n score: @reform_survey.government_category1_score.to_f,\n change: @reform_survey.government_category1_change\n }, {\n id: 'reform-government-capacity-building',\n title: I18n.t('shared.categories.capacity_building'),\n score: @reform_survey.government_category2_score.to_f,\n change: @reform_survey.government_category2_change\n }, {\n id: 'reform-government-infrastructure-budgeting',\n title: I18n.t('shared.categories.infastructure_budgeting'),\n score: @reform_survey.government_category3_score.to_f,\n change: @reform_survey.government_category3_change\n }, {\n id: 'reform-government-legislation-regulations',\n title: I18n.t('shared.categories.legislation_regulation'),\n score: @reform_survey.government_category4_score.to_f,\n change: @reform_survey.government_category4_change\n }, {\n id: 'reform-stakeholder-overall',\n color: government_time_series[:color],\n title: t('shared.categories.overall'),\n score: @reform_survey.stakeholder_overall_score.to_f,\n change: @reform_survey.stakeholder_overall_change\n }, {\n id: 'reform-stakeholder-performance',\n color: government_time_series[:color],\n title: t('shared.categories.performance'),\n score: @reform_survey.stakeholder_category1_score.to_f,\n change: @reform_survey.stakeholder_category1_change\n }, {\n id: 'reform-stakeholder-goals',\n color: government_time_series[:color],\n title: t('shared.categories.goals'),\n score: @reform_survey.stakeholder_category2_score.to_f,\n change: @reform_survey.stakeholder_category2_change\n }, {\n id: 'reform-stakeholder-progress',\n color: government_time_series[:color],\n title: t('shared.categories.progress'),\n score: @reform_survey.stakeholder_category3_score.to_f,\n change: @reform_survey.stakeholder_category3_change\n }\n ].each { |chart| gon.charts << chart }\n end\n\n @external_indicators = @reform.external_indicators.published.sorted.map do |ext_ind|\n ext_ind.format_for_charting\n end\n\n gon.charts += @external_indicators\n end", "def preview\n end", "def preview\n end", "def get_preview\n get_filtered_dataset false, 10\n end", "def index\n\t\t@demographics = Demographic.all\n\tend", "def show\n @views_chart = get_views(@episode)\n @change_chart = get_differences(@episode)\n end", "def show\n @note = Note.new\n @slidedecks = Slidedeck.all\n\n end", "def index\n @demographic_datas = DemographicData.all\n end", "def show\n @contents = @slide.contents\n end", "def show\n @preview_page_1=@member.preview_page_1\n @preview_page_2=@member.preview_page_2\n end", "def preview\n redirect_to preview_url\n end", "def show\n @series = Series.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @series }\n end\n end", "def preview\n frm.button(:value=>\"Preview\").click\n AssignmentsPreview.new(@browser)\n end", "def preview\n frm.button(:value=>\"Preview\").click\n AssignmentsPreview.new(@browser)\n end", "def show\n @department = Department.all \n end", "def show\n \t@season_list = @title.season_list\n \t@episode_list = @title.episodes_for_season(params[:season_choice]||\"All\")\n \tif @episode_list.count == 0\n \t\tparams[:season_choice] = \"All\"\n\t\t\t@episode_list = @title.episodes_for_season(params[:season_choice]||\"All\")\n\t\tend\n \tlogger.debug @episode_list\n end", "def show\n @page_title = @festival.title\n if @festival.image.present?\n @image_meta_url = \"https://westcornwallevents.co.uk\"\n @image_meta_url << @festival.image.to_s\n end\n @page_meta_description = @festival.meta_description\n end", "def show\n @articles = @curriculum.articles\n end", "def show\n @page_title = @department.name\n respond_to do |format|\n format.html\n format.atom\n if authorized?(@department) || (current_user && current_user.editor?(@department))\n format.csv do\n data = cache(['departments/csv', @department]) do\n logger.debug { \"Generating csv for department #{@department.name}\" }\n @department.to_csv\n end\n send_csv data, @department \n end\n end\n end\n end", "def show\n @series = Series.find(params[:id])\n @artworks = @series.artworks\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @series }\n end\n end", "def show\n @evaluation = Evaluation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluation }\n format.pdf { render :layout=>false }\n end\n end", "def explore\n add_time_series_nav_options(show_title: false)\n\n gon.explore_time_series = true\n gon.explore_time_series_ajax_path = explore_time_series_path(:format => :js)\n gon.embed_ids = @time_series.highlights.embed_ids\n gon.private_user = Base64.urlsafe_encode64(current_user.id.to_s)\n\n # need css for tabbed translations for entering highlight description\n @css.push('tabbed_translation_form.css')\n\n # this method is in application_controller\n # and gets all of the required information\n # and responds appropriately to html or js\n explore_time_series_generator(@time_series)\n\n end", "def show\n @diagnosed_disorders = @patient.get_selected_disorders \n @detected_disorders = @patient.get_detected_disorders \n @gene = @patient.pedia.limit(10).order(\"pedia_score DESC\") \n @causing_muts = @patient.disease_causing_mutations\n result_link = @patient.result_figures.take\n if !result_link.nil?\n @result_link = result_link.link.split('/')[-1]\n end\n end", "def show\n if @employee.type.nil?\n @evaluations = @employee.evaluations.paginate(page: params[:page]).order(date: :asc).per_page(10)\n end\n end", "def show\n @series = Series.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @series }\n end\n end", "def show\n @dataset = Dataset.find(params[:id])\n \n @title = @dataset.name + \" : \" + @title\n respond_to do |format|\n format.html # show.html.erb\n # format.xml { render :xml => @dataset.to_xml (:include => [:format_urls, :format_types] ) }\n format.xml { render }\n end\n end", "def show\n @slides =@lecture.slides(params[:urlpage])\n \n end", "def preview_doc\n @tpl = Template.find(params[\"template_id\"]) \n output = @tpl.render_by_model_id(params[:id], 'print', 'www.freightoperations.com:8080')\n render(:text => output, :layout => false) \n end", "def preview\n mixpanel_tab_event(\"View Item\", \"Get Preview URL\")\n begin\n embed_url = user_client.embed_url(params[:id])\n redirect_to embed_url\n rescue\n redirect_to no_support_url\n end\n\n end", "def preview\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_extra_page-#{@extra_page.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.extra_page @extra_page.id\n render \"previews/preview\"\n end", "def show\n add_time_series_nav_options\n\n # if the language parameter exists and it is valid, use it instead of the default current_locale\n if params[:language].present? && @time_series.languages.include?(params[:language])\n @time_series.current_locale = params[:language]\n end\n\n @datasets = Dataset.in(id: @time_series.datasets.dataset_ids)\n\n @highlights = Highlight.by_time_series(@time_series.id)\n gon.highlight_ids = @highlights.map{|x| x.id}.shuffle if @highlights.present?\n gon.highlight_show_title = false\n gon.highlight_show_links = false\n gon.highlight_admin_link = true\n load_highlight_assets(@highlights.map{|x| x.embed_id}, @time_series.current_locale) if @highlights.present?\n\n @show_title = false\n\n @css.push('bootstrap-select.min.css', 'list.css', \"dashboard.css\", 'highlights.css', 'boxic.css', 'tabs.css', 'explore.css')\n @js.push('bootstrap-select.min.js', \"live_search.js\", 'highlights.js', 'explore.js')\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def show\n @event = Event.find params[:id]\n @slides = @event.slides.page(params[:page]).per(10)\n end", "def index\n @demographic_questions = DemographicQuestion.all\n end", "def show\n if @serial.poster.nil?\n series_search = Serial.search_poster(@serial.name)\n unless(series_search[0].nil?)\n @poster = series_search[0]['images']['poster']\n @serial.poster = @poster\n @serial.save\n end\n end\n end", "def show\n @educations = @city.educations\n @number_of_educations = @city.educations.count\n @pagy, @educations = pagy(@city.educations, items: 30)\n @page_title = @city.name\n end", "def preview_title_and_toc\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_title_toc-#{current_cookbook.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.title_and_toc\n render \"previews/preview\"\n end", "def show\n @series = Series.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @series }\n end\n end", "def index\n @festivals = Festival.all.order('date ASC')\n @page_title = \"Annual festivals and events accross West Cornwall\"\n end", "def show\n @series = Series.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @series }\n end\n end", "def show\n \n \n end", "def show\r\n\r\n end", "def show\r\n\r\n end", "def show\r\n\r\n end", "def index\n @page_title = \"VDW Datasets\"\n @datasets = Dataset.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datasets }\n format.pdf\n end\n end", "def show\n skyfarer_chart\n show_captain_skyfarers\n show_captain_weapons\n end", "def show\n if cookies[:message_shown].nil? && request.env['HTTP_USER_AGENT'] =~ /Firefox/\n flash.now[:notice] = \"To view the high-quality images for this item in Firefox, you'll need to change some browser settings\"\n end\n deprecated_response, @document = search_service.fetch(solr_id)\n @response = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(deprecated_response, 'The @response instance variable is deprecated; use @document.response instead.')\n respond_to do |format|\n format.html { @search_context = setup_next_and_previous_documents }\n format.json\n additional_export_formats(@document, format)\n end\n if @document[:has_model_ssim][0] == 'Collection'\n facet_member_of_collections = blacklight_config.facet_fields['member_of_collections_ssim']\n if facet_member_of_collections\n @response_collection = search_service.facet_field_response(facet_member_of_collections.key, \"f.member_of_collections_ssim.facet.contains\" => @document[:title_tesim][0])\n @display_facet = @response_collection.aggregations[facet_member_of_collections.field]\n if @display_facet&.items && @display_facet.items.first\n @collection_count = @display_facet.items.first.hits\n end\n end\n end\n end", "def series_details\n @series_description\n end", "def show\n if params[:show_id] \n @show = Show.find_by(id: params[:show_id]) || Show.find_by(slug: params[:show_id])\n end\n \n @product = Product.find_by(id: params[:id])\n if (@product.outfits.any?) && (@product.outfits.first.episodes.any?)\n @episode = @product.outfits.first.episodes.first\n @episodenumber = @episode.episode_number\n end\n respond_to do |format|\n format.html\n format.js\n end\n end", "def show \r\n end", "def charting\n check_state_and_update\n @titles = Title.build_horizontal_collection(@task.id,current_user.id)\n \n respond_to do |format| \n format.html \n end\n end", "def static_page_preview_for role\n StaticPageHelper.preview_for(role)\n end", "def show\n timeline\n end", "def show\n number_of_days = 6\n data_table = GoogleVisualr::DataTable.new\n data_table.new_column('string', 'Year')\n data_table.new_column('number', 'Visits')\n data_table.add_rows(number_of_days+1)\n number_of_days.downto(0) do |i|\n day = Time.now - i.days\n column = number_of_days-i\n activities = @restroom.activities.on_date(day)\n data_table.set_cell(column, 0, day.strftime(\"%-m/%-d\"))\n data_table.set_cell(column, 1, activities.size)\n end\n\n opts = { :width => 800, :height => 480, :title => \"#{@restroom.name} Daily Visits\", :hAxis => { :title => 'Date', :titleTextStyle => {:color => 'red'}} }\n @chart = GoogleVisualr::Interactive::ColumnChart.new(data_table, opts)\n end", "def show\n @design_detail_data_point = DesignDetailDataPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @design_detail_data_point }\n end\n end", "def show\n @medium = Medium.find(params[:id]) \n @tab_options ||= {}\n @tab_options[:entity] = @medium\n respond_to do |format|\n format.html do # show.rhtml\n @pictures = Picture.all.order('RAND()').limit(Medium::COLS * Medium::PREVIEW_ROWS)\n @videos = Video.all.order('RAND()').limit(1)\n @documents = Document.all.order('RAND()').limit(1)\n @titles = { :picture => ts(:daily, :what => Picture.model_name.human(:count => :many).titleize), :video => ts(:daily, :what => Video.model_name.human(:count => :many).titleize), :document => ts(:daily, :what => Document.model_name.human(:count => :many).titleize) }\n @more = { :type => '' }\n end\n format.js\n format.xml #{ render :xml => @medium.to_xml }\n format.json { render :json => Hash.from_xml(render_to_string(:action => 'show.xml.builder')) }\n end\n end", "def show_previews\n session[:solution] == nil && generate\n load_sections(nil, true)\n end", "def show\n\t\t@extractor = Extractor.find(params[:id])\n\t\t@latest_revision = @extractor.revisions.first(:order => \"created_at DESC\")\n\t\tif(@latest_revision) \n\t\t\t@latest_scraped_values = ScrapedValue.find_all_by_revision_id(\n\t\t\t\t@latest_revision.id,\n\t\t\t\t:include => [:annotation]\n\t\t\t)\n\t\tend\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.rss { render :layout => false }\n\t\tend\n\tend", "def show\n @section_preview = SectionPreview.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @section_preview.to_xml }\n end\n end", "def demos\n get_records \"demo\", \"/demos\"\n end", "def show\n\n \n end", "def show\n @pacient = Pacient.find(params[:pacient_id])\n @retetum = Retetum.find(params[:id])\n respond_to do |format|\n format.html\n #format.pdf do\n #send_data Raport.new.reteta(@retetum, @pacient), :filename => 'reteta.pdf',\n #:type => \"application/pdf\", :page_size => \"A4\"\n #end\n end\n end", "def show\n \n \n end", "def show\n \n \n end", "def show\n \n \n end", "def show\n \n \n end", "def show\n @series_description = SeriesDescription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @series_description }\n end\n end", "def preview\n @search = params[:search] || 114651808548129 # Coldplay\n\n if !params[:search]\n render 'artists/preview_form'\n return\n end\n\n graph = Koala::Facebook::API.new(session[\"facebook_access_token\"][\"credentials\"][\"token\"])\n fb_data = graph.api(\"/#{params[:search]}?fields=name,general_manager,booking_agent,record_label,genre,hometown,website,bio,picture,likes\")\n \n puts \"Creating new artist scraper object\"\n artist_scraper = ArtistScraper.new :facebook_info => fb_data\n\n if artist_scraper.errors? :preview_mode => true\n render 'artists/preview_form', :notice => \"This artist triggered an error\"\n return\n end\n\n puts \"Importing artist's information\"\n @artist = artist_scraper.import_info\n @image_url = artist_scraper.image_url\n\n @release_tracks, @timeline, @timeline_images = [], [], []\n\n release_scraper = ReleaseScraper.new @artist, :preview_mode => true\n puts \"Starting 7Digital Release Import\"\n release_scraper.sdigital_import #:limit => 10\n puts \"Starting iTunes Release Import\"\n release_scraper.itunes_import #:limit => 10\n puts \"Compiling release results\"\n @timeline = release_scraper.releases\n @timeline_images = release_scraper.new_releases_images\n\n end", "def preview\n #for debug\n params[:d] = 'www.rubyecommerce.com'\n \n the_website=the_menu=the_layout=the_theme = nil\n the_website = Website.find_by_url(params[:d])\n if params[:c]\n the_menu = Menu.find_by_id(params[:c])\n else\n the_menu = Menu.find_by_id(the_website.index_page) \n end\n the_theme = TemplateTheme.find(the_menu.find_theme_id(is_preview=true))\n do_preview(the_theme.id, the_theme.layout_id, the_menu.id)\n render :text => File.read(\"#{Rails.public_path}/shops/#{the_theme.file_name('html')}\")\n end", "def preview\n frm.button(:value=>\"Preview\").click\n @@file_number=0\n AssignmentStudentPreview.new(@browser)\n end", "def preview\n frm.button(:value=>\"Preview\").click\n @@file_number=0\n AssignmentStudentPreview.new(@browser)\n end", "def show\n @curriculums = Curriculum.all\n @experiencias = Experience.all\n end", "def show\n @object = @story\n @title = @story.name\n respond_to do |format|\n format.html { render :show }\n format.pdf do\n render pdf: 'export',\n disposition: 'attachment',\n header: { right: '[page] of [topage]' },\n outline: { outline: false,\n outline_depth: 2 },\n toc: {\n disable_dotted_lines: true,\n disable_toc_links: true,\n level_indentation: 4,\n header_text: @story.name,\n text_size_shrink: 0.5\n }\n end\n end\n end", "def show\n @lablocational = Lablocational.all\n# respond_to do |format|\n# format.html # show.html.erb\n# format.xml { render :xml => @lablocational }\n# end\n\tprawnto :filename => 'Report-LocationalLab.pdf', :inline => false\n\n end", "def show\n @response, @document = fetch params[:id]\n\n @children = @document.children(limit: 100).select { |child| child.published? }\n\n # assets ordered by label, excludes preservation only files\n @assets = @document.assets(ordered: true)\n\n @presenter = DRI::ObjectInCatalogPresenter.new(@document, view_context)\n\n supported_licences\n\n @reader_group = governing_reader_group(@document.collection_id) unless @document.collection?\n\n if @document.published?\n Gabba::Gabba.new(GA.tracker, request.host).event(@document.root_collection_id, \"View\", @document.id, 1, true)\n end\n\n respond_to do |format|\n format.html { setup_next_and_previous_documents }\n format.json do\n options = {}\n options[:with_assets] = true if can?(:read, @document)\n formatter = DRI::Formatters::Json.new(@document, options)\n render json: formatter.format(func: :as_json)\n end\n format.ttl do\n options = {}\n options[:with_assets] = true if can?(:read, @document)\n formatter = DRI::Formatters::Rdf.new(@document, options)\n render text: formatter.format({format: :ttl})\n end\n format.rdf do\n options = {}\n options[:with_assets] = true if can?(:read, @document)\n formatter = DRI::Formatters::Rdf.new(@document, options)\n render text: formatter.format({format: :xml})\n end\n format.js { render layout: false }\n\n additional_export_formats(@document, format)\n end\n end", "def show\n \n end", "def show\n \n end", "def show\n @contents = DataTable.all\n\n \n end", "def preview_index\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_index-#{current_cookbook.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.index\n render \"previews/preview\"\n end", "def index\n @exercicio_series = ExercicioSerie.all\n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n @patients = Patient.all\n @branch_offices = BranchOffice.all\n @event_categories = EventCategory.all\n @events = Event.all \n @ae_drugs = AeDrug.all\n end", "def preview\n contents = Plan.filter!(params[:contents])\n render :text => contents, :content_type => 'text/html'\n end", "def show\n @subcategory = Subcategory.all\n# respond_to do |format|\n# format.html # show.html.erb\n# format.xml { render :xml => @subcategory }\n# end\n\tprawnto :filename => 'Report-SubCategories.pdf', :inline => false\n end", "def index\n @tv_series = TvSerie.all\n end", "def show\n @events = @artist.next_events\n @products = @artist.products\n end", "def preview\n frm.button(:value=>\"Preview\").click\n PreviewAnnouncements.new(@browser)\n end", "def preview\n render :template => \"preview\", :layout => false\n end" ]
[ "0.64027655", "0.62493", "0.60682404", "0.5959332", "0.5928181", "0.5914645", "0.5910541", "0.5910541", "0.5910071", "0.5883508", "0.58300704", "0.58155763", "0.57527316", "0.5736098", "0.5725417", "0.57236314", "0.57035094", "0.5684713", "0.5684713", "0.5666853", "0.5663574", "0.5643913", "0.5639622", "0.56378603", "0.56293666", "0.56221926", "0.56202275", "0.561658", "0.56143314", "0.5612015", "0.5601058", "0.56004196", "0.5600248", "0.5599278", "0.5586465", "0.55812526", "0.5580783", "0.55803025", "0.55793136", "0.55767447", "0.5571859", "0.5569823", "0.5566175", "0.5562661", "0.5562655", "0.55491066", "0.55491066", "0.55491066", "0.55437344", "0.55413574", "0.5536003", "0.55218905", "0.5519134", "0.5515364", "0.5513867", "0.55121225", "0.55113554", "0.55047673", "0.5504663", "0.5499627", "0.549932", "0.54987144", "0.5495646", "0.54912275", "0.54855436", "0.5484876", "0.54828775", "0.54828775", "0.54828775", "0.54828775", "0.5482775", "0.54719085", "0.54688287", "0.54620904", "0.54620904", "0.54554605", "0.5454445", "0.5454433", "0.5439601", "0.5438027", "0.5438027", "0.5434402", "0.54226416", "0.54217535", "0.5420099", "0.5420099", "0.5420099", "0.5420099", "0.5420099", "0.5420099", "0.5420099", "0.5420099", "0.5420099", "0.54177994", "0.54168814", "0.54145855", "0.54141086", "0.5412865", "0.5407729", "0.54063326" ]
0.6201234
2
Get recent items (with author info) for a unit, by most recent eschol_date
def getRecentItems(unit) items = Item.join(:unit_items, :item_id => :id).where(unit_id: unit.id) .where(Sequel.lit("attrs->\"$.suppress_content\" is null")) .reverse(:eschol_date).limit(5) return items.map { |item| { id: item.id, title: item.title, authors: getItemAuthors(item.id) } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_recent_recipe\n recipes.sort_by do |i| \n i.date\n end.last\n end", "def authors_top\n\t\t\t@db.js('musicthoughts.top_authors($1)', [20])\n\t\tend", "def recent_item\n raise MsdApi::Exception::InvalidParameter.new(_('errors.missing_param', key: :date)) unless params[:date]\n\n begin\n data = MsdApi::RedisRecentAnalytics.hgetall(epoch_date)\n @item = OpenStruct.new(data)\n rescue Exception => e\n render_error_json(_('errors.invalid_date'))\n end\n end", "def last_summary\n\t\t@db[:gold_summary].reverse_order(:summary_date).get(:created_date)\n\tend", "def most_recent_recipe\n recipe_cards.sort_by { |card| card.date}.reverse.first.recipe\n end", "def latest\n @latest = apiQuery(\"items(first:1, order:UPDATED_DESC, include:[PUBLISHED,EMBARGOED]) { nodes { updated } }\").\n dig(\"items\", \"nodes\", 0, \"updated\")\n end", "def get_most_recently_visited_topics(org_unit_id) # GET\n query_string = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/content/recent\"\n _get(query_string)\n # Returns: a JSON array of Topic ToC entries.\nend", "def most_recent_recipe\n self.recipe_cards.max_by {|recipecard| recipecard.date}\nend", "def by_mixed_authors\n my_stories = @user ? StorySearch.new( @user, :author, { :time_span => 24.hours.to_i, :per_page => 13 } ).results : []\n top_author_stories_count = ( 20 - my_stories.size )\n conditions = params[:language_id].blank? ? {} : { :language_id => params[:language_id] }\n pagination_options = { :page => 1, :per_page => top_author_stories_count }\n skip_ids = my_stories.collect( &:id )\n @stories = Story.by_top_authors.skip_ids( skip_ids ).paginate( pagination_options.merge( :conditions => conditions, :include => [ :authors, :source ] ) )\n my_stories.inject( @stories ){ |s,x| s.push( x ) }\n @stories.sort!{ |a,b| b.created_at <=> a.created_at }\n @stories.total_entries = @stories.size\n rxml_stories\n end", "def most_recent_recipe\n self.find_user_recipe_cards.sort_by{|rcard| rcard.date}[-1]\n end", "def authors\n\t\t\t@db.js('musicthoughts.top_authors(NULL)')\n\t\tend", "def get_recent_dub_list\n #to be scraped\n @asc_date_list = CliDub::User.get_recent_dub_list\n end", "def most_recent_recipe\n self.user_recipe_cards.sort_by do |card|\n card.date\n end.last\n end", "def latest_dosage\n dosages.order(date_given: :desc).first\n end", "def outdated_list(sort_order: { created_at: :desc })\n outdated.order(sort_order)\n end", "def index\n @expenses = Expense.includes(:author).where('author_id = ?',\n current_user.id).joins(:groups_expenses).most_recent\n end", "def newest\n params[:sort] = 'ACTIVATED_AT DESC'\n params[:school_id] = auth_user.current_school_id\n index\n end", "def last_commit_month es\n es.map {|e| e.date.month_start }.sort.last\nend", "def recent\n result = http_get(\"/services/data/v#{self.version}/recent\")\n collection_from(result.body)\n end", "def last_story_date\n self.stories.select {|story| story.completion_date}.sort_by(&:completion_date).last.completion_date.to_s rescue nil\n end", "def fetch_changelogs\n @changelogs = @spkg.changelogs\n .includes(:maintainer)\n .order(at: :desc, evr: :desc, created_at: :desc)\n end", "def getLatest()\n return Gesellschafter.get(self.Mnr)\n end", "def most_recent_recipe\n my_recipes = self.recipe_cards\n my_recipes.sort_by do |rec_card|\n [\n rec_card.date.split(\"/\")[0].to_i,\n rec_card.date.split(\"/\")[1].to_i\n ]\n end[-1]\n end", "def recent\n self.order('created_at DESC')\n end", "def latest_interviews\n self.interviews.order(\"DATE DESC\").where(:status=>1)\n end", "def index\n @articles = Article.desc_by_date\n end", "def recent_feed_items(limit = 100)\n feed_items.order('created_at DESC').limit(limit)\n end", "def most_recent_recipe\n self.recipecards.max_by{|recipecard| recipecard.date}.recipe\n end", "def most_recent_recipe\n self.find_recipe_card_by_user.sort_by {|v| v.date}.last.recipe.name\n end", "def get_top_artists( params )\n LastFM.get( \"chart.getTopArtists\", params )\n end", "def fetch_changelogs\n @changelogs = @spkg.changelogs\n .includes(:maintainer)\n .order(at: :desc, evr: :desc, created_at: :desc)\n end", "def most_recent_recipe\n most_recent_recipe = RecipeCard.all.select {|atr| atr.user.name == self.name}\n most_recent_recipe.sort_by {|atr| atr.date}.reverse[0]\n end", "def sorted_articles\n require 'time'\n articles.sort_by do |a|\n attribute_to_time(a[:created_at])\n end.reverse\n end", "def recent_events\n Event.includes(:user).where(group_id: self.id).limit(50).order(created_at: :desc).reverse\n end", "def find_recent_songs\n songs_with_date_modified_pair = self.lib.songs.reject do |song|\n (!song.metadata.has_key?('date_modified')) or (song.metadata['date_modified'] == nil)\n end\n\n songs_by_date_modified = songs_with_date_modified_pair.sort do |a, b| \n b.metadata['date_modified'] <=> a.metadata['date_modified']\n end\n\n songs_first = songs_by_date_modified.first(3)\n song_names = songs_first.collect {|song| song.metadata['name']} \n end", "def searchLists(author = '', title = '', publisher = '')\n url = \"https://api.nytimes.com/svc/books/v3/lists/best-sellers/history.json\"\n params = {\n author: author,\n title: title,\n publisher: publisher\n }\n \n self.request(url, params)\n end", "def latest_news(m)\n news = News.order(:date).last\n\n author = reveal_author(news.author)\n date = I18n.localize(news.date, :full)\n\n m.reply I18n.news_fetcher.latest_news(date, author, news.title)\n m.reply I18n.news_fetcher.read_post(news.link)\n end", "def most_recent_recipe\n self.recipe_cards.sort do |recipe_card|\n recipe_card.date\n end.first\n end", "def latest_and_greatest\n\tlatest = []\n\txml = Paper.new.openxml(feedurl)\n\t# Nature\n\tif feedurl == \"http://feeds.nature.com/NatureLatestResearch\"\n\t\txml.css('item').each do |article|\n\t\t\ta = {}\n\t\t\ta[:title] = article.css('title').text\n\t\t\ta[:doi] = article.attribute('about').text[18..-1]\n\t\t\ta[:abstract] = article.css('description').text\n\t\t\ta[:authors] = []\n\t\t\tif !article.xpath(\"a:creator\", {\"a\" => \"http://purl.org/dc/elements/1.1/\"}).empty?\n\t\t\t\tarticle.xpath(\"a:creator\", {\"a\" => \"http://purl.org/dc/elements/1.1/\"}).each do |author|\n\t\t\t\t\ta[:authors] << author.text\n\t\t\t\tend\n\t\t\tend\n\t\t\ta[:pubdate] = article.xpath(\"a:date\", {\"a\" => \"http://purl.org/dc/elements/1.1/\"}).text.to_time\n\t\t\tlatest << a\n\t\tend\n\tend\n\t\n\n\tlatest\n end", "def contributors_top\n\t\t\t@db.js('musicthoughts.top_contributors($1)', [20])\n\t\tend", "def last_editorial\n iss = Issue.find_by_id(id).date\n #debugger\n Article.find(:first, :joins => 'inner join issues on articles.issue_id = issues.id',\n :conditions => ['issues.date <= ? AND priority = 6', iss], :order => 'issues.date DESC, priority')\n end", "def most_recent_recipe\n\t\trecipes.sort { |recipe| recipe.date }.first\n\tend", "def latest\n return self.transactions.first(:order => [:date.desc])\n end", "def topMostCard\n object.cards.mostRecentlyUpdated.one[0]\n end", "def index\n @items = Item.all.order(\"release_date DESC\")\n end", "def get_last_news(options = {})\n count = options[:count] || 5\n language = options[:language] || @item[:language]\n articles_hash = sorted_articles.group_by {|item| item[:canonical_identifier]}\n articles = []\n articles_hash.each do |ident, items|\n if !ident.blank?\n articles << translated_identifier(ident, language)\n else\n articles.concat(items)\n end\n end\n articles.sort! {|a, b| b.attributes[:created_at] <=> a.attributes[:created_at]}\n return articles[0, count]\nend", "def recent\n num_recent = 5\n entries = @@ledgers.find(\"owner\" => @sender).first['entries']\n\n if(entries.length < num_recent)\n num_recent = entries.length\n end\n\n reply = [\"Most recent ledger entries:\"]\n \n for n in 1..num_recent\n entry = entries[-n]\n reply.push(\"#{entry['action']}, #{entry['description']}, #{entry['value']}\")\n end\n\n @t.say(reply.join(\"\\n\"))\nend", "def get_recent_vitals\n earliest = 2.years.ago\n vital_signs.timelimit(earliest).desc(:time)\n end", "def latest_change\n Change.joins(:versions).where('versions.item_id = ? AND versions.item_type = ?', id, 'Taxon').last\n end", "def documents_by_updated\n Document.find(:all, :conditions => {:category_id => self.id}, :order => 'updated_at DESC')\n end", "def author\n [author_developer.name_and_email, author_date, author_date_gmt_offset]\n end", "def sorted_articles\n require 'time'\n articles.sort_by do |a|\n time = a[:created_at]\n time.is_a?(String) ? Time.parse(time) : time\n end.reverse\n end", "def last_read\n id = self.id\n book = Book.where(\"author_id = ?\", id).order(\"read_date desc\").first\n if book\n book.read_date\n end\n end", "def latest_orders\n @latest_orders ||= OrderDecorator.decorate_collection(\n object.\n orders.\n includes(:order_items).\n order('created_at DESC').\n limit(3))\n end", "def index\n @informations = Information.order('created_at desc')\n @information_sort_date = @informations.group_by{|info|info.created_at }\n end", "def renter_with_highest_rent\n units.map {|unit| unit.values[1]}\n end", "def latest_ust\n self.delta_pack[\"latestUST\"]\n end", "def most_recent\n self.stats.first\n end", "def latest_articles(limit = 10)\n articles[0..limit]\n end", "def latest_model_date(model,brevity = false)\n return nil unless model.present?\n unsorted_models = self.send(model.to_s.pluralize)\n return nil unless unsorted_models.present?\n model = unsorted_models.order(created_at: :desc).first\n return model.created_at.strftime(\"%b %e, %Y\") unless brevity\n return model.created_at.strftime(\"%-m/%-d/%y\")\n end", "def index\n @offers = Offer.newer_first\n end", "def get_latest_for(changeable)\n my_id = changeable.id\n self.send(\"find_by_#{self.changeable_fk}\", my_id, {:order => 'updated_at DESC', :limit => 1})\n end", "def get_user_overdue_items(user_id, org_unit_ids_CSV = nil) # GET\n query_string = \"/d2l/api/le/#{$le_ver}/overdueItems/\"\n query_string += \"?userId=#{user_id}\"\n query_string += \"&orgUnitIdsCSV=#{org_unit_ids_CSV}\" unless org_unit_ids_CSV.nil?\n _get(query_string)\n # Returns: An ObjectListPage JSON block containing a list of OverdueItem.\nend", "def fetch_newest_album!\n req = @fetcher.call('get', 'https://pupper.bandcamp.com/album/' + @@album_slug)\n doc = Nokogiri::HTML(req.body)\n\n @@album_id = album_id_from_doc(doc)\n @@album_date = date_published_from_doc(doc)\n end", "def books\n Book.joins(:serie)\n .order(\"series.books_count DESC, tome DESC\")\n .group_by { |s| s.serie_id }\n .map(&:last)\n end", "def time_units_ordered_by_date\n order_array = ['time_units.calendar_id ASC'] + %w[rabjung_id year season_id month day hour minute].collect{|field| \"complex_dates.#{field} DESC\"}\n self.time_units.order(order_array.join(', ')).includes([:date, :end_date]).references([:date, :end_date])\n end", "def ukextremes_latest_observations\n query('txt/wxobs/ukextremes/json/latest')\n end", "def feed\n feed_items.desc(:created_at).limit(10).to_a\n end", "def latest_by_section\n unless @latest_articles_for_sections\n @latest_articles_for_sections = {}\n for article in latest_articles_for_sections\n if @latest_articles_for_sections[article.section]\n @latest_articles_for_sections[article.section] << article\n else\n @latest_articles_for_sections[article.section] = [article]\n end\n end\n end\n @latest_articles_for_sections\n end", "def marc_sortable_author\n lambda do |record, accumulator|\n accumulator << Marc21Semantics.get_sortable_author(record)\n end\n end", "def recent(n)\n\t \tin_order.endmost(n)\n\t end", "def sub_units\n SubUnit.where(id: sub_unit_ids).order(:name)\n end", "def find_last_updated_mir\n @team.meeting_individual_results.exists? ? @team.meeting_individual_results.sort_by_updated_at('DESC').first.updated_at : 0\n end", "def recent(u, params)\n Argument.publics.all(:conditions => {:debate_id => Debate.public.without_practice_debate.collect(&:id)},\n :order => 'arguments.id DESC').select{|a| a.visible_to?(u)}.paginate :page => params[:page], :per_page => 50\n end", "def index\n @openrecs = Openrec.all.order(created_at: :desc)\n end", "def fetch_open_stories\n stories = OpenStory.all.order('faved_at DESC')\n\n if params[:last_id]\n last_faved_at = Cequel.uuid(params[:last_id]).to_time\n stories = stories.where(\n 'faved_at < ?',\n last_faved_at - 1.second\n )\n end\n\n stories\n end", "def last_inspection_two\n sorted = self.inspections.sort{|a,b| a.created_at <=> b.created_at}\n sorted.last\n end", "def latest\n revisions.latest\n end", "def ultimos_articulos\n puts \"\\nObteniendo ultimos articulos de la base...\"\n @uarticulos = Articulo.limit(3).order(created_at: :desc)\n end", "def finished_items(sort_by=\"priority\")\n raise ArgumentError(\"Attempt to sort finished items by invalid field.\") unless ITEM_FIELDS_WHICH_ALLOW_SORTING.include?(sort_by)\n items.find(:all, :conditions => [\"closed_at is null and finished_at is null\"], :order => [\"#{sort_by}, updated_at\"])\n end", "def sort_by_date(items)\n in_progress = items.select { |item| item[:date].nil? }\n .sort_by { |item| item[:name].downcase }\n done = items - in_progress\n done = done.sort do |item_a, item_b|\n case item_a[:date] <=> item_b[:date]\n when -1 then 1\n when 1 then -1\n else\n item_a[:name].downcase <=> item_b[:name].downcase\n end\n end\n in_progress + done\n end", "def top_artists\n \n artists=[]\n spotify_artists = JSON.parse(api_call(\"https://api.spotify.com/\",\"v1/me/top/artists\"))\n\n spotify_artists['items'].each do |item|\n new_artist = Artist.find_or_create_by(name: item['name'], spotify_id: item['id'])\n new_artist.update(genre_list: item['genres'])\n artists << new_artist\n end\n\n artists\n\n end", "def index\n @recent_objects = AssertedDistribution.recent_from_project_id($project_id).order(updated_at: :desc).limit(10)\n end", "def recent\n page = params[:page] || 1\n\n # we don't expect the api to ask for recent, so we'll load\n # things based on current employee, or we'll just load all\n # lots regardless of country\n country_id_desired = current_employee.present? ? current_employee.operating_country_id : nil\n\n # desired facility or nil (which is any facility)\n facility_desired = params[:facility_filter_id] || cookies[:facility_filter_id]\n\n # desired seller or nil (which is any seller)\n seller_desired = params[:seller_filter_id] || cookies[:seller_filter_id]\n\n # any column not defined in our model is equivalent to \"id ASC\"\n sort_desired = params[:column_as_string] || cookies[:lot_sort_by_column] || \"\"\n\n # the order is ASC unless this parameter specifies \"desc\"\n sort_order = params[:sort_order] || cookies[:lot_sort_by_order] || \"\"\n\n # update sort desired and order if it's empty as this page has\n # its own default\n if sort_desired.blank?\n sort_desired = \"updated_at\"\n sort_order = Vehicle::SORT_DESCENDING\n end\n\n # the yard id\n yard_id_desired = params[:yard_filter_id]\n\n @vehicles = Vehicle.edited_by_employee(current_employee)\n .not_canceled\n .not_closed\n .where(\"vehicles.updated_at >= ?\", Time.zone.now - 90.days)\n .seller(seller_desired)\n .facility(facility_desired)\n .yard(yard_id_desired)\n .country(country_id_desired)\n .ordered_by(sort_desired, sort_order, false)\n .includes([:api_error, {model: :make}, :vehicle_type, :seller])\n .page(page)\n\n # We always want these\n gon.vehicles = @vehicles.as_json(include_basic: \"yes\", \n include_api_error: 'yes',\n exclude_unwanted_keys: \"yes\", \n include_facility_basic: \"yes\",\n include_seller_compact: \"yes\", \n include_vehicle_type: \"yes\")\n\n gon.parameters = { \"column_as_string\" => sort_desired,\n \"facility_filter_id\" => facility_desired,\n \"seller_filter_id\" => seller_desired, \n \"sort_order\" => sort_order,\n \"yard_filter_id\" => yard_id_desired }\n\n gon.pagination = { current_page: @vehicles.current_page,\n default_per_page: @vehicles.default_per_page,\n per_page: (@vehicles.total_count % @vehicles.default_per_page),\n total_pages: @vehicles.total_pages,\n total_count: @vehicles.total_count }\n\n gon.httpSlug = \"/recent\" # To allow for dynamic http path building in vehicles.js.coffee\n\n # Only get these when loading the html page\n if request.format.html?\n create_country_specific_gon_variables\n\n gon.sortOptionAscending = Vehicle::SORT_ASCENDING\n gon.sortOptionDescending = Vehicle::SORT_DESCENDING\n gon.showCsvButton = true\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: { vehicles: gon.vehicles,\n parameters: gon.parameters,\n pagination: gon.pagination } }\n end\n end", "def fetch_by_issn(issn)\r\n xml = fetch_xml(issn)\r\n\r\n\r\n results = BentoSearch::Results.new.concat(\r\n xml.xpath(\"./rdf:RDF/rss:item\", xml_ns).collect do |node|\r\n item = BentoSearch::ResultItem.new\r\n\r\n item.format = \"Article\"\r\n\r\n item.issn = issn # one we searched with, we know that!\r\n\r\n item.title = xml_text(node, \"rss:title\")\r\n item.link = xml_text(node, \"rss:link\")\r\n\r\n item.publisher = xml_text(node, \"prism:publisher\") || xml_text(node, \"dc:publisher\")\r\n item.source_title = xml_text(node, \"prism:PublicationName\")\r\n item.volume = xml_text(node, \"prism:volume\")\r\n item.issue = xml_text(node, \"prism:number\")\r\n item.start_page = xml_text(node, \"prism:startingPage\")\r\n item.end_page = xml_text(node, \"prism:endingPage\")\r\n\r\n # Look for something that looks like a DOI in dc:identifier\r\n node.xpath(\"dc:identifier\").each do |id_node|\r\n if id_node.text =~ /\\ADOI (.*)\\Z/\r\n item.doi = $1\r\n # doi's seem to often have garbage after a \"; \", especially\r\n # from highwire. heuristically fix, sorry, a real DOI with \"; \"\r\n # will get corrupted.\r\n if (parts = item.doi.split(\"; \")).length > 1\r\n item.doi = parts.first\r\n end\r\n\r\n break\r\n end\r\n end\r\n\r\n # authors?\r\n node.xpath(\"dc:creator\", xml_ns).each do |creator_node|\r\n name = creator_node.text\r\n name.strip!\r\n\r\n # author names in RSS seem to often have HTML entities,\r\n # un-encode them to literals.\r\n name = HTMLEntities.new.decode(name)\r\n\r\n\r\n item.authors << BentoSearch::Author.new(:display => name)\r\n end\r\n\r\n # Date is weird and various formatted, we do our best to\r\n # look for yyyy-mm-dd at the beginning of either prism:coverDate or\r\n # dc:date or prism:publicationDate\r\n date_node = xml_text(node, \"prism:coverDate\") || xml_text(node, \"dc:date\") || xml_text(node, \"prism:publicationDate\")\r\n if date_node && date_node =~ /\\A(\\d\\d\\d\\d-\\d\\d-\\d\\d)/\r\n item.publication_date = Date.strptime( $1, \"%Y-%m-%d\")\r\n elsif date_node\r\n # Let's try a random parse, they give us all kinds of things I'm afraid\r\n item.publication_date = Date.parse(date_node) rescue ArgumentError\r\n end\r\n\r\n # abstract, we need to strip possible HTML tags (sometimes they're\r\n # there, sometimes not), and also decode HTML entities. \r\n item.abstract = xml_text(node, \"rss:description\").try do |text| \r\n HTMLEntities.new.decode(strip_tags(text))\r\n end\r\n\r\n item\r\n end\r\n )\r\n\r\n # Items seem to come back in arbitrary order, we want to sort\r\n # by date reverse if we can\r\n if results.all? {|i| i.publication_date.present? }\r\n results.sort_by! {|i| i.publication_date}.reverse!\r\n end\r\n\r\n fill_in_search_metadata_for(results)\r\n\r\n return results\r\n end", "def sorted_posts_by_date\n @items.select do |i|\n ! ( REGEXP_DATE_ISO.match(i.identifier).nil? )\n end.sort do |a,b|\n a.identifier <=> b.identifier\n end.reverse\nend", "def hestory\n @orders = current_user.orders.all.order(created_at: :desc)\n end", "def getRecentDocs\n\tlastId = REDIS.zcard \"docs\"\n\trecentDocs = []\n\tREDIS.zrangebyscore(\"docs\", lastId-RECENT_DOCS+1, lastId).reverse.each_with_index do |doc, i|\n\t\trecentDocs << {\n\t\t\tid: (lastId-i).b(BASE_62),\n\t\t\tdoc: getTitle(doc)\n\t\t}\n\tend\n\trecentDocs\nend", "def find_latest_ticket(end_user_id)\n end_user = client.user.find(id: end_user_id)\n end_user.requested_tickets(sort_by: :updated_at, sort_order: :desc).first\n end", "def most_recent_recipe\n date = \"0000-01-01\"\n binding.pry\n recipe = nil\n self.find_recipe_cards.each do |recipe_card|\n if Date.parse(recipe_card.date) > date\n Date.parse(date) = Date.parse(recipe_card.date)\n recipe = recipe_card\n end\n end\n recipe\n date\n end", "def index\n @estadia = Estadia.all.order(updated_at: :desc)\n end", "def recent_list(items)\n html = StringIO.new\n year = month = day = 0\n items.each do |item|\n item_year = item.created_at.year\n item_month = item.created_at.month\n item_day = item.created_at.day\n if item_year != year || item_month != month || item_day != day\n html << \"<hr>\" if year > 0\n html << \"<h3>\"\n html << item.created_at.strftime(\"%A, %B %-d\")\n html << \"</h3>\"\n end\n year = item_year\n month = item_month\n day = item_day\n html << resource_list_row(item) # ApplicationHelper\n end\n raw(html.string)\n end", "def index\n @articles = Article.all.by_publish_date.by_display_order\n end", "def index\n @items = Item.all\n @items = @items.select {|item| item.owner_id != current_user.id}\n @top = @items.max(3) {|item1, item2| item1.purchased <=> item2.purchased}\n @sale = @items.select {|item| item.on_sale }\n\n end", "def getLatest()\r\n return OzbKonto.get(self.KtoNr)\r\n end", "def getLatest()\r\n return EeKonto.get(self.KtoNr)\r\n end", "def items\n authors\n end", "def index\n @albumsevens = Albumseven.all.order(\"created_at DESC\")\n end", "def foreach_recent_badge\n CollectionWrapper.new(current_group.badges.desc(:created_at).page(params[:badges_page]).per(25), BadgeWrapper, view_context)\n end", "def get_latest_news(start=0,count=LatestNewsPerPage)\n numitems = $r.zcard(\"news.cron\")\n news_ids = $r.zrevrange(\"news.cron\",start,start+(count-1))\n return get_news_by_id(news_ids,:update_rank => true),numitems\nend" ]
[ "0.56707156", "0.56666803", "0.55680346", "0.5535638", "0.549315", "0.54838085", "0.5454201", "0.545385", "0.54419273", "0.5429123", "0.5428824", "0.54213077", "0.5343198", "0.52986926", "0.52909523", "0.52649343", "0.526475", "0.5253439", "0.5236696", "0.5236447", "0.5220996", "0.52201194", "0.5216548", "0.5205166", "0.51800406", "0.51689464", "0.5153834", "0.513988", "0.5136328", "0.5125258", "0.51225847", "0.5118424", "0.5112062", "0.51074696", "0.5106729", "0.5091698", "0.50867134", "0.5086421", "0.50829625", "0.50603783", "0.5055054", "0.50309455", "0.5015061", "0.50146544", "0.50119483", "0.49984747", "0.49932685", "0.49632746", "0.49461177", "0.4936113", "0.49352804", "0.49345705", "0.4928484", "0.49240887", "0.49162653", "0.49130803", "0.49066147", "0.48908994", "0.4886589", "0.48851994", "0.4874887", "0.48689342", "0.48604155", "0.48449877", "0.48420116", "0.48417202", "0.48379597", "0.4832776", "0.48283845", "0.48259512", "0.48134592", "0.48110032", "0.48055074", "0.48032418", "0.48019183", "0.48001236", "0.47938207", "0.4789574", "0.4789531", "0.47884458", "0.47866648", "0.47841737", "0.47825003", "0.47777933", "0.4776386", "0.4774292", "0.47715908", "0.47645092", "0.47619772", "0.47617036", "0.47568476", "0.47520146", "0.47423705", "0.47416338", "0.47412995", "0.4726483", "0.47219166", "0.4720685", "0.4719351", "0.4719328" ]
0.69658273
0
Traverse the nav bar, including subfolders, yielding each item in turn to the supplied block.
def travNav(navBar, &block) navBar.each { |nav| block.yield(nav) if nav['type'] == 'folder' travNav(nav['sub_nav'], &block) end } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bootstrap_nav(*args, &block)\n levels = { :primary => 1, :secondary => 2, :tertiary => 3 }\n options = args.extract_options!\n level = levels[options[:level]] || (options[:level] || 1).to_i\n\n\n # If there are no arguments, use the current page\n args.unshift page if args.empty? && !page.nil?\n \n current_page = page\n \n contents = \"\".tap do |str|\n\n page = current_page # TODO: Can't call page within tap, so we've passed it as a variable. Can we do this better?\n\n # Opening HTML for Twitter Bootstrap Navigation\n if level == 1\n str << '<ul class=\"nav\">'\n else\n str << '<ul class=\"dropdown-menu\">'\n end\n \n pages = args.map do |arg|\n if arg.root?\n arg.children.first\n else \n case arg\n when Breeze::Content::NavigationItem then arg\n else Breeze::Content::NavigationItem.where(:permalink => arg.to_s).first\n end\n end\n end.flatten.compact\n \n ancestry = pages.first ? pages.first.self_and_ancestors.to_a : [ page ]\n\n # If page is undefined, there's no active page\n # This is used for example on the Breeze Commerce Cart and Checkout pages\n # In the longer term, this should be removed, in favour of making the cart a proper page, with checkout as a view\n page ||= nil\n \n active = page ? (page.root? ? [page] : ancestry.dup) : []\n ancestry << ancestry.last.children.first if ancestry.last\n ancestry.compact!\n \n if level <= ancestry.length && ancestry[level].present?\n siblings = ancestry[level].self_and_siblings.to_a.select(&:show_in_navigation?) \n # siblings = page.self_and_siblings.to_a.select(&:show_in_navigation?) \n siblings.unshift ancestry[level - 1] if options[:home] || (level == 1 && options[:home] != false)\n siblings.each_with_index do |p, i|\n page_title = if (options[:home] && options[:home] != true) && (p.level < level || p.root?)\n options[:home]\n case options[:home]\n when true then p.title\n when Symbol then p.send options[:home]\n when Proc then options[:home].call(p)\n else options[:home].to_s\n end\n else\n p.title\n end\n page_title = p.title if page_title.blank?\n \n link_options = ({}).tap do |o|\n o[:class] = [ p.root? ? \"home\" : p.slug ].tap do |classes|\n classes << \"active\" if p == page || (active.index(p).to_i > 0 && p.level == level)\n classes << \"first\" if i == 0\n classes << \"last\" if i == siblings.length - 1\n end.join(\" \")\n end\n \n link = if block_given?\n capture p, link_options, &block\n else\n permalink = p.class.name == \"Breeze::Content::Placeholder\" ? 'javascript:void(0)' : p.permalink\n link_to content_tag(:span, \"#{page_title}\".html_safe), permalink, link_options\n end\n \n recurse = case options[:recurse]\n when true then 3\n when :active then ancestry.include?(p) ? 1 : 0\n when Numeric, /^\\d+$/ then options[:recurse].to_i\n else 0\n end\n \n if recurse > 0 && p.level == level && !p.root?\n unless (child = p.children.first).nil?\n link << bootstrap_nav(child, options.merge(:level => level + 1, :recurse => recurse - 1), &block)\n end\n end\n \n # if options[:full] && p.children\n # p.children.each do |child|\n # link << navigation_bootstrap(child, options.merge(:full => true), &block)\n # end\n # end\n\n li_options = ({}).tap do |o|\n o[:class] = [ p.root? ? \"home\" : p.slug ].tap do |classes|\n classes << \"active\" if p == page || (active.index(p).to_i > 0 && p.level == level)\n classes << \"first\" if i == 0\n classes << \"last\" if i == siblings.length - 1\n classes << \"dropdown\" if p.children.length > 0\n classes << 'level-' + level.to_s\n end.join(\" \")\n end\n \n str << content_tag(:li, link.html_safe, li_options)\n end\n end\n \n # Opening HTML for Twitter Bootstrap Navigation\n str << '</ul>'\n \n end\n # content_tag :div, contents.html_safe, options.except(:level, :recurse).reverse_merge(:class => \"#{levels.invert[level] || \"level-#{level}\"} navigation\")\n contents.html_safe\n \n end", "def traverse_nav_markdown(node)\n\t\n\t\t# traverse subfolders, go deep\n\t\tif node_has_children(node)\n\t\t\t node.children.items.each_with_index do |child|\n\n\t\t\t\t items = traverse_nav_markdown(child)\n\t\t\t\t child.children = Map.new unless child.children?\n\t\t\t\t child.children.count = 0 unless child.children.count?\n\t\t\t\t child.children.items = [] unless child.children.items?\n\t\t \n\t\t\t\t child.children.count = items.size\n\t\t\t\t child.children.items = items\t\t\t\t\n\n\t\t\t end\n\t\tend\n\t\n\t\tnode_list = nil\n\t\tif node.children? and node.children.items?\n\t\t\tnode_list = node.children.items\n\t\tend\n\t\n\t\tmarkdowns = Dir.glob(\"#{node.source_path}/*.markdown\")\n\t\n\t\t# if we are at the root node (content source), don't process markdowns here (home.markdown handled separately, special)\n\t\tmarkdowns = [] if node.nav_level == 0\n\t\n\n\t\tif markdowns.size > 0 and node.nav_level > 0\n\n\t\t\t#puts\n\t\t\t#puts \"#{node.source} - #{node.children?}\"\n\t\t\tnode.children = Map.new unless node.children?\n\t\t\tnode.children.count = 0 unless node.children.count?\n\t\t\tnode.children.items = [] unless node.children.items?\n\t\t\t#puts \"#{node.source} - #{node.children?} - #{node.children.count?}\"\n\t\t\n\t\t\tnode_list = node.children.items\n\t\t\t\n\t\t\tmarkdowns.each do |md|\t\t\t\t\t\t\n\t\t\t\tsource = md.gsub(/#{node.source_path}\\//, \"\").gsub(/.markdown/, \"\")\n\t\t\t\n\t\t\t\tis_cbdoc_special_file = source.start_with? \"aaab-\"\n\t\t\t\n\t\t\t\tunless is_cbdoc_special_file\t\t\t\t\n\t\t\t\t\n\t\t\t\t\tif node.link?\n\t\t\t\t\t\tlink = node.link + \"/\" + source \n\t\t\t\t\telse\t\t \n\t\t\t\t\t\tnode.link = \"undefined\"\n\t\t\t\t\t\tputs node.nav_type\n\t\t\t\t\t\texit\n\t\t\t\t\tend\n\t\t\t\t\n\t\t\t\t\tsource_path = node.source_path + \"/\" + source\t\t\t \n\n\t\t\t\t\tis_markdown_and_folder = (File.exist?(\"#{source_path}\") && File.directory?(\"#{source_path}\"))\n\t\t\t\n\t\t\t\t\tunless is_markdown_and_folder\t\t \n\t\t\t\t\t\n\t\t\t\t\t\tfull_link = (node.link.start_with?(\"/#{CONTENT_LINK_PREFIX}/\") ?\tlink : \"/#{CONTENT_LINK_PREFIX}/\" + link )\n\t\t\t\t\t\tparent_path = node.source_path\n\t\t\t\t\t\tparent_full_link = (node.link.start_with?(\"/#{CONTENT_LINK_PREFIX}/\") ?\t node.link : \"/#{CONTENT_LINK_PREFIX}/\" + node.link )\n\t\t\t\t\n\t\t\t\t\t\titem = Map.new({\n\t\t\t\t\t\t\tdoctype: \"nav\",\n\t\t\t\t\t\t\tsubtype: \"nav_\" + (node.nav_level + 1).to_s,\n\t\t\t\t\t\t\tnav_type: \"markdown\",\n\t\t\t\t\t\t\tnav_level: node.nav_level + 1,\t\t\t\t\n\t\t\t\t\t\t\tnav_order: 9000,\n\t\t\t\t\t\t\tnav_title: process_navigation_name(source),\n\t\t\t\t\t\t\tsource: source,\n\t\t\t\t\t\t\tlink: link,\n\t\t\t\t\t\t\tfull_link: full_link,\n\t\t\t\t\t\t\tparent: node.source,\n\t\t\t\t\t\t\tparent_nav_title: node.nav_title,\n\t\t\t\t\t\t\tparent_link: node.link,\n\t\t\t\t\t\t\tparent_full_link: parent_full_link,\n\t\t\t\t\t\t\tparent_path: parent_path,\n\t\t\t\t\t\t\tsource_path: source_path,\n\t\t\t\t\t\t\tancestors: [],\n\t\t\t\t\t\t\tancestors_links: [],\n\t\t\t\t\t\t\tsiblings: [],\n\t\t\t\t\t\t\tsiblings_links: [],\n\t\t\t\t\t\t\tdescendants: [],\n\t\t\t\t\t\t\tdescendants_links: []\t\t\t\t \n\t\t\t\t\t\t})\n\t\t\t\t\t\n\t\t\t\t\t\tnode_list << item \n\t\t\t\t\tend\t\t \n\t\t\t\tend\n\t\t\tend\t\t \n\t\tend\n\t\n\t\t#ap node_list\n\t\n\t\tnode_list\n\tend", "def nav_menu(nav_class = 'nav', &block)\n content_tag(:ul, :class => nav_class) do \n capture(&block) #yield\n end\n end", "def navbar name_uniq = :root , &block\n result = \"\"\n section = Section.find_by_name_uniq(name_uniq.to_s)\n ([section] + section.children).each do |item|\n result += capture(item.name,item.path,&block)\n end if section \n concat result\n end", "def render_nav( current_user, params, nav ) \n # nav blocks is array of blocks' navigation element (without the divider yet)\n nav_blocks = []\n nav_blocks_string = \"\"\n @is_nav_active = false \n \n nav[:blocks].each do |nav_block|\n # nav block has_many nav elements \n puts \"the nav[:header] = #{nav[:header]}, gonna render nav block\"\n result = render_nav_block( current_user, params, nav_block) \n nav_blocks << result if not result.nil? and not result.length == 0\n end\n \n return nil if nav_blocks.length == 0 \n \n \n nav_blocks_count = nav_blocks.length \n counter = 0\n \n nav_blocks.each do |nav_block|\n nav_blocks_string << nav_block\n if counter != nav_blocks_count - 1 \n nav_blocks_string << draw_block_divider \n end\n counter += 1 \n end\n \n \n # <li class=\"dropdown active\">\n nav_blocks_string = draw_nav( nav_blocks_string, @is_nav_active , nav)\n \n return nav_blocks_string \n \n end", "def setup_nav_items\n dir = Rails.root.join('app', 'views', 'reports', 'categories').to_s\n @nav_items = {}\n cats = %W(\n the_churches\n developing_localities\n cities_we_are_burdened_for\n various_works\n building_projects\n archives\n )\n cats.each do |cat|\n @nav_items[cat] = Dir.glob(\"#{dir}/#{cat}/*\").map do |path|\n next unless path['.slim']\n path.remove(\".slim\").split(\"/\").last\n end.compact.sort\n end\n @current_page = request.env['PATH_INFO']\n end", "def traverse_folders(nav_level, parent, parent_link, parent_full_link, node_folder_path) \n\n\t\tnode_list = []\n\t\n\t\t#puts \"traverse_folders(#{nav_level.to_s}, #{parent}, #{node_folder_path})\"\n\t\n\t\tsubfolders = nil\n\t\tbegin\n\t\t\tsubfolders = Dir.entries(node_folder_path).select {|entry| File.directory? File.join(node_folder_path, entry) and !(entry == '.' || entry == '..' || entry == 'assets' || entry == 'images') }\n\t\trescue Errno::ENOENT\n\t\t\tputs \"ERROR: No File or Directory [#{node_folder}]\"\n\t\t\tputs puts\n\t\t\texit\n\t\tend\t \n\t\t\n\t\tsubfolders.each do |folder|\n\t\t\tnode = Map.new\n\n\t\t\tsub_path = node_folder_path + \"/\" + folder\n\t\t\n\t\t\tlink = (parent_link.length == 0 ? \"\" : parent_link + \"/\" ) + folder\n\t\t\tfull_link =\t (parent_full_link.length == 0 ? \"/\" : parent_full_link + \"/\" ) + folder\n\t\t\t\t\n\t\t\tnode = Map.new({\n\t\t\t\tdoctype: \"nav\",\n\t\t\t\tsubtype: \"nav_\" + nav_level.to_s,\n\t\t\t\tnav_type: (File.exist?(\"#{sub_path}/../#{folder}.markdown\") ? \"folder+markdown\" : \"folder\"),\n\t\t\t\tnav_level: nav_level,\n\t\t\t\tnav_order: 9000,\n\t\t\t\tnav_title: process_navigation_name(folder),\t\t\t \n\t\t\t\tsource: folder,\n\t\t\t\tlink: link,\n\t\t\t\tfull_link: full_link,\n\t\t\t\tparent: parent,\n\t\t\t\tparent_nav_title: process_navigation_name(parent_link),\n\t\t\t\tparent_link: parent_link,\n\t\t\t\tparent_full_link: parent_full_link,\n\t\t\t\tparent_path: node_folder_path,\n\t\t\t\tsource_path: sub_path,\n\t\t\t\tancestors: [],\n\t\t\t\tancestors_links: [],\n\t\t\t\tsiblings: [],\n\t\t\t\tsiblings_links: [],\n\t\t\t\tdescendants: [],\n\t\t\t\tdescendants_links: [],\n\t\t\t\tnavigation_yml: (File.exists? (sub_path + \"/aaaa-navigation.yml\")),\n\t\t\t\tindex_erb: (File.exists? (sub_path + \"/index.erb\"))\n\t\t\t})\n\t\t\t\t\n\t\t\titems = traverse_folders(nav_level + 1, folder, link, full_link, sub_path)\n\t\t\n\t\t\tif items.size > 0\n\t\t\t\t node.children = {}\n\t\t\t\t node.children.count = items.size\n\t\t\t\t node.children.items = items\n\t\t\tend\n\t\t\n\t\t\tnode_list << node\n\t\tend\n\t\n\t\tnode_list\n\t \n\tend", "def r_breadcrumbs_nav(&block)\n content_tag(\"nav\", class: \"hidden sm:flex items-center text-sm leading-5 font-medium\", &block)\n end", "def navigation_for( nav_name, options = {}, &block )\n raise ArgumentError, \"Missing block\" unless block_given?\n\n builder = options[:builder] || ActionView::Base.default_navigation_builder\n\n options.reverse_merge!(\n :wrapper_tag => :ul,\n :nav_item_tag => :li,\n :selected_class => 'selected',\n :html => {}\n )\n\n start_tag( options ) if navigation_has_wrapper?( options )\n body_content( builder, nav_name, options, &block )\n close_tag( options ) if navigation_has_wrapper?( options )\n\n # Mark the navigation block has having been rendered\n navigation_builder[nav_name] = true\n end", "def output_nav(items)\n html = Array.new\n items.each do |text, path|\n item_path = Rails.application.routes.recognize_path(path)\n current_path = {:action => params[:action], :controller => params[:controller]}\n class_name = text.downcase\n if item_path[:controller] == current_path[:controller] && item_path[:action] == current_path[:action]\n class_name << \" active\"\n end\n html << content_tag(:li, link_to(text, path), :class => class_name)\n end\n html.join(\"\\n\").html_safe\n end", "def main_menu(include_children=true,&block)\n menu_items = []\n \n if (root_menus=SiteMenu.roots).any?\n # load menu from database\n root_menus.each do |menu|\n menu_items << yield(menu.name, \n render( 'home/menu/with_children', \n :menu => menu, \n :recursive=>include_children,\n :force => true\n )\n ) if menu && (menu.role_needed||0) <= current_role\n end\n else\n # Use default menu\n \n # home\n menu_items = [ ]\n \n # Top pages\n menu_items << top_pages.map { |page|\n yield( page.id.to_s.to_sym, menu_link_to( page.short_title, \"/p/#{page.link_to_title}\" ))\n } if can? :read, Page\n \n # Blogs, Userlist, Comments\n menu_items << yield(:blogs, menu_link_to( t(:blogs), blogs_path )) if can? :read, Blog\n menu_items << yield(:userlist, menu_link_to( t(\"menu.userlist\"), registrations_path)) if can? :read, Page\n menu_items << yield(:comments, menu_link_to( t(\"menu.comments\"), comments_path)) if can? :read, Comment.new\n end\n \n menu_items\n end", "def sidebar_menu(title, &block)\n content_tag :ul, class: 'sidebar-menu tree', data: { widget: 'tree' } do\n concat(content_tag(:li, title, class: 'header'))\n concat(yield(block))\n end\n end", "def navigation_item(item, url = {}, separate = false, &block)\n if block_given?\n return unless yield\n end\n path = (url.empty? ? self.send(\"#{item}_path\".to_sym) : url)\n item_class = (separate ? 'separate' : '')\n out = \"<li id=\\\"#{item}_nav\\\" class=\\\"#{item_class}\\\">\" \n out << link_to(\"#{item.to_s.split('_').collect{|e| e.capitalize}.join(' ')}\", \n path, :class => (@active == \"#{item}\" ? 'active' : ''))\n out << \"</li>\"\n end", "def traverse(&block)\n\t\ttraverse(@current_node, &block)\n\tend", "def bp_directory_index\n tree_hash = BP.same_level_views(\"/base_project#{request.env['PATH_INFO']}\")\n\n p tree_hash\n\n out = \"<ul>\"\n\n tree_hash.keys.each do |tree_hash_key|\n thk = tree_hash_key.gsub(\".html.erb\", \"\")\n thk = thk.gsub(\"/mocks\", \"\")\n\n out += content_tag :li, thk.gsub(\"/\", \"\")\n\n out += \"<ul>\"\n tree_hash[tree_hash_key].each do |tree_hash_value|\n thv = tree_hash_value.gsub(\".html.erb\", \"\")\n if thv != \"index\"\n out += content_tag :li, link_to(\"#{thv}\", \"/mocks?t=#{thk}/#{thv}\")\n end\n\n end\n out += \"</ul>\"\n\n out += \"</li>\"\n end\n out += \"</ul>\"\n\n out.html_safe\nend", "def generate_navigation_yml(node, force = true)\n\n\t\t# traverse subfolders, go deep\n\t\tif node_has_children(node)\n\t\t\t node.children.items.each_with_index do |child|\n\t\t\t\t generate_navigation_yml(child, force)\n\t\t\t end\n\t\tend\t \n\t\t\n\t\tif force or !File.exists?(\"#{node.source_path}/aaaa-navigation.yml\")\n\t\t\n\t\t\tnaml = Map.new({ \n\t\t\t\tcommon_metadata: {\n\t\t\t\t\ttags: [ \"couchbase\" ]\n\t\t\t\t},\n\t\t\t\tnav_items: [] \n\t\t\t})\n\n\t\t\tsubfolders = nil\n\t\t\tif node.source_path?\t\t\n\t\t\t\tsubfolders = Dir.entries(node.source_path).select {|entry| File.directory? File.join(node.source_path, entry) and !(entry == '.' || entry == '..' || entry == 'assets' || entry == 'images') }\n\t\t\telse\n\t\t\t\t ap node\n\t\t\t\t puts \"ERROR: Missing \\\"source_path\\\" in node\"\n\t\t\t\t exit\n\t\t\tend\t\t\t \n\t\t\n\t\t\tmarkdowns = Dir.glob(\"#{node.source_path}/*.markdown\")\n\t\t\n\t\t\t# add each markdown to the collection\n\t\t\tmarkdowns.each do |md|\n\t\t\t\n\t\t\t\tsource = md.gsub(/#{node.source_path}\\//, \"\").gsub(/.markdown/, \"\")\n\t\t\t\n\t\t\t\titem = Map.new({\n\t\t\t\t\tsource: source,\n\t\t\t\t\ttype: \"markdown\",\n\t\t\t\t\tnav_title: process_navigation_name(source),\n\t\t\t\t\tcontent_footers: nil\n\t\t\t\t})\n\t\t\t\tnaml.nav_items << item unless md.start_with? \"aaab-\"\n\t\t\tend\n\t\t\n\t\t\t# add each folder to the collection\n\t\t\tsubfolders.each do |sf|\n\t\t\t\titem = Map.new({\n\t\t\t\t\tsource: sf,\n\t\t\t\t\ttype: \"folder\",\n\t\t\t\t\tnav_title: process_navigation_name(sf),\n\t\t\t\t\tcontent_footers: nil\n\t\t\t\t})\n\t\t\t\tnaml.nav_items << item \n\t\t\tend\t\t \n\t\t\n\t\t\tnaml_yaml = naml.to_yaml.gsub(/^(- )/, \"\\n- \")\n\t\t\n\t\t\t# write out navigation.yml file...\n\t\t\tFile.open(\"#{node.source_path}/aaaa-navigation.yml\", 'w') { |file| file.write(naml_yaml) }\n\t\t\n\t\t\t#ap naml\n\t\tend\n\tend", "def each_directory(&block)\n @directories.each(&block)\n end", "def each(&block)\n files.each(&block)\n\n directories.each do |subdirectory|\n block.call(subdirectory)\n\n subdirectory.each(&block)\n end\n end", "def subnav title = nil, &block\n concat content_tag(:li) {\n output = String.new()\n output << content_tag( :span, title ) unless title.nil?\n output << navigation(&block)\n }\n end", "def subpage_navigation(page)\n l = \"<ul>\\n\"\n page.pages.each do |page|\n l << page_navigation_helper(page)\n end\n l << \"</ul>\"\n end", "def sub_nav(&blk)\n content_tag(:ul, :id => \"subnav\", :class => \"nav nav-pills\", &blk)\n end", "def align_navigation_yaml_with_index_erb(node)\n\t\t\t\t\n\t\t\t# traverse subfolders, go deep\n\t\t\tif node_has_children(node)\n\t\t\t\t node.children.items.each_with_index do |child|\n\t\t\t\t\t align_navigation_yaml_with_index_erb(child)\n\t\t\t\t end\n\t\t\tend\n\t\t\n\t\t\thas_index_erb = File.exist?(\"#{node.source_path}/index.erb\")\n\t\t\thas_navig_yml = File.exist?(\"#{node.source_path}/aaaa-navigation.yml\")\n\t\t\n\t\t\t# load aaaa-navigation.yml\n\t\t\tnaml = Map.new(YAML.load_file(\"#{node.source_path}/aaaa-navigation.yml\"))\n\t\t\n\t\t\terb_markdowns = []\n\t\t\n\t\t\t# load index.erb\n\t\t\tif has_index_erb\n\t\t\t \n\t\t\t\tf = File.readlines(\"#{node.source_path}/index.erb\")\t \n\t\t\t\tf.delete_if { |line| !line.start_with?(\"<%= include_item\") }\t\n\t\t\t \n\t\t\t\terb_markdowns = []\n\t\t\t \n\t\t\t\tf.each_with_index do |item, i|\n\t\t\t\t\tsource_path = nil\t\t \n\t\t\t\t\tif match = item.match(/([\\'])([\\w\\-\\/.]+)([\\'])/)\n\t\t\t\t\t x, source, y = match.captures\n\t\t\t\t\telse\n\t\t\t\t\t #puts \"NO MATCH - [#{item}]\"\n\t\t\t\t\tend\n\n\t\t\t\t\thierarchy = source.split(\"/\")\n\n\t\t\t\t\tsnav = Map.new({\t\t\t\t\t\t\n\t\t\t\t\t source: hierarchy.last,\n\t\t\t\t\t parents: (hierarchy.pop;hierarchy),\n\t\t\t\t\t nav_order: i\n\t\t\t\t\t})\t\n\n\t\t\t\t\terb_markdowns << snav\n\t\t\t\tend\n\t\t\n\t\t\t\t# iterate and re-order navigation.yml\n\t\t\t\tsort_nav_items = naml.dup.nav_items\n\t\t\n\t\t\t\tsort_nav_items.each_with_index do |n, i| \n\t\t\t\t\tn.nav_order = i + 1000\n\t\t\t\tend\n\t\t\n\t\t\t\terb_markdowns.each_with_index do |erb, i|\n\t\t\t\t\tsort_nav_items.each do |n| \n\t\t\t\t\t\tn.nav_order = i if erb.source == n.source\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\n\t\t\t\tsort_nav_items.sort! { |x, y| x.nav_order <=> y.nav_order }\n\t\t\n\t\t\t\tsort_nav_items.each_with_index do |n, i| \n\t\t\t\t\tn.nav_order = i + 1\n\t\t\t\tend \n\t\t\t\n\t\t\t\t# copy re-ordered nav_items back\n\t\t\t\tnaml.nav_items = sort_nav_items\n\t\t\n\t\t\t\t# write the changes to disk\n\t\t\t\tnaml_yaml = naml.to_yaml.gsub(/^(- )/, \"\\n- \")\n\t\t\n\t\t\t\t# write out navigation.yml file...\n\t\t\t\tFile.open(\"#{node.source_path}/aaaa-navigation.yml\", 'w') { |file| file.write(naml_yaml) }\n\t\tend\n\tend", "def main_navigation\n nodes_stack = RailsAdmin::Config.visible_models(:controller => self.controller)\n node_model_names = nodes_stack.map{ |c| c.abstract_model.model_name }\n\n nodes_stack.group_by(&:navigation_label).map do |navigation_label, nodes|\n\n nodes = nodes.select{ |n| n.parent.nil? || !n.parent.to_s.in?(node_model_names) }\n li_stack = navigation nodes_stack, nodes\n\n li_a_home = link_to localizing_path(dashboard_path), class: 'pjax' do\n content_tag(:i, '', class: 'icon icon-home') + content_tag(:span, t('admin.actions.dashboard.menu'))\n end\n %{<li class=\"homelink\">#{li_a_home}</li>#{li_stack}} if li_stack.present?\n end.join.html_safe\n end", "def path_nav(obj, path = '', delimiter = '.', &block)\n case obj\n when Hash\n if obj.empty?\n yield path, obj\n else\n obj.each do |k, v|\n path_nav(\n v,\n (path ? [path, k.to_s.gsub(delimiter, \"\\\\#{delimiter}\")].join(delimiter) : k.to_s.gsub(delimiter, \"\\\\#{delimiter}\")).to_s,\n delimiter,\n &block\n )\n end\n end\n when Array\n if obj.empty?\n yield path, obj\n else\n obj.each_with_index do |ob, index|\n path_nav(\n ob,\n (path ? [path, \"[#{index}]\"].join(delimiter) : \"[#{index}]\").to_s,\n delimiter,\n &block\n )\n end\n end\n else\n yield path, obj\n end\n end", "def navigation(txt, path, attrs = {}, options = {}, &block)\n options.reverse_merge!(:container => :ol, :wrapper => :li) \n navigation_content = content_tag(options[:container], capture(&block))\n wrapper_attrs = attrs.delete(:wrapper)\n parent_link = nav_link_to(txt, path, attrs, false)\n content_tag(options[:wrapper], \"#{parent_link}\\n#{navigation_content}\".html_safe, (wrapper_attrs || {})) \n end", "def ascend(&block)\n paths = ascendants\n paths.each(&block) if block\n paths\n end", "def menu_for(*controllers) #:yields:\n hash= {}\n controllers.each do |c|\n hash[c.mount_path] = block_given? ? yield(c) : c.name.gsub(/Controller/,'')\n end\n menu_from_hash(hash)\n end", "def nav(options = {}, &block)\n @nav_link = true\n nav = content_tag :ul, nav_options(options), &block\n nav.tap{ @nav_link = false }\n end", "def navigation title = nil, title_tag = :h6, &block\n output = String.new()\n output << content_tag( title_tag, title ) unless title.nil?\n output << content_tag(:ul) do\n capture(&block)\n end\n concat output\n end", "def documentation_navigation_tree_for(page, options = {})\n active_page_type = nil\n items = String.new.tap do |s|\n if page.is_a?(::Documentation::Page)\n\n pages = page.navigation.select { |p,c| documentation_authorizer.can_view_page?(p) }\n\n pages.each do |p, children|\n s << \"<li>\"\n s << \"<a #{page == p ? \"class='active'\" : ''} href='#{documentation_doc_root}/#{p.full_permalink}'>#{p.title}</a>\"\n active_page_type = :root if page == p\n unless children.empty?\n s << \"<ul>\"\n children.select { |c| documentation_authorizer.can_view_page?(c) }.each do |p|\n s << \"<li><a #{page == p ? \"class='active'\" : ''} href='#{documentation_doc_root}/#{p.full_permalink}'>#{p.title}</a></li>\"\n active_page_type = :child if page == p\n end\n s << \"</ul>\"\n end\n s << \"</li>\"\n end\n else\n ::Documentation::Page.roots.select { |p| documentation_authorizer.can_view_page?(p) }.each do |page|\n s << \"<li><a href='#{documentation_doc_root}/#{page.full_permalink}'>#{page.title}</a></li>\"\n end\n end\n end\n\n String.new.tap do |output|\n output << \"<ul>\"\n if options[:include_back] && page && page.breadcrumb.size > 1\n if active_page_type == :root && page.has_children?\n back_page = page.breadcrumb[-2]\n elsif active_page_type == :child && !page.has_children?\n back_page = page.breadcrumb[-3]\n else\n back_page = nil\n end\n\n if back_page\n output << \"<li class='back'><a href='#{documentation_doc_root}/#{back_page.full_permalink}'>&larr; Back to #{back_page.title}</a></li>\"\n end\n end\n output << items\n output << \"</ul>\"\n end.html_safe\n end", "def nav_items\n [\n {\n url: root_path,\n title: \"Home\"\n },\n {\n url: about_me_path,\n title: \"About Me\"\n },\n {\n url: contact_path,\n title: \"Contact\"\n },\n {\n url: tech_news_path,\n title: \"Rails News\"\n },\n {\n url: blogs_path,\n title: \"Blog\"\n },\n {\n url: portfolios_path,\n title: \"Portfolio\"\n }\n ]\n end", "def nav_menu_item(menu_label, &block)\n \n icon = case menu_label\n when 'category' ; \"<i class='icon-tag'></i>\"\n when 'user' ; \"<i class='icon-user'></i>\"\n when 'post' ; \"<i class='icon-font'></i>\"\n when 'comment' ; \"<i class='icon-comment'></i>\"\n when 'archive' ; \"<i class='icon-upload'></i>\"\n end \n\n menu_label = t(\"activerecord.models.#{menu_label}\")\n content_tag(:li, :class => 'dropdown') do \n link_to(\"#{icon} #{menu_label} <b class='caret'></b>\".html_safe, '#', :class => 'dropdown-toggle', :data => { :toggle => 'dropdown' }) +\n content_tag(:ul, :class => 'dropdown-menu') do \n capture(&block)#yield\n end\n end\n end", "def render_list(&block)\n view.capture_haml do\n view.haml_tag :ul, class: \"breadcrumb\" do\n yield\n end\n end\n end", "def traverse_sort_and_add_nav_order_to_nodes(node)\n\t\n\t\t# traverse subfolders, go deep\n\t\tif node_has_children(node)\n\t\t\n\t\t\t node.children.items.each_with_index do |child|\n\t\t\t\t if child.nav_type == \"folder\" || child.nav_type == \"folder+markdown\"\n\t\t\t\t\t items = traverse_sort_and_add_nav_order_to_nodes(child)\n\t\t\t\t\t child.children.items = items if items and items.size > 0\n\t\t\t\t end\n\t\t\t end\n\t\t \n\t\tend\t \n\t\n\t\thas_navig_yml = File.exist?(\"#{node.source_path}/aaaa-navigation.yml\")\n\t\n\t\tif has_navig_yml and node.children and node.children.items?\n\t\n\t\telse\n\t\t\treturn nil\t\t\n\t\tend \n\t\n\t\tsorted_nav_items = nil\n\t\n\t\tif node.children? and node.children.items?\n\t\t\tsorted_nav_items = node.children.items\n\t\tend\n\t\n\t\tif File.exists?(\"#{node.source_path}/aaaa-navigation.yml\")\n\t\t\t# load aaaa-navigation.yml\n\t\t\tnaml = Map.new(YAML.load_file(\"#{node.source_path}/aaaa-navigation.yml\"))\t\t\n\t\n\t\t\t# iterate and re-order navigation.yml\n\t\t\tsorted_nav_items = node.children.items\n\n\t\t\tsorted_nav_items.each_with_index do |sni, i| \n\t\t\t\tsni.nav_order = i + 1000\n\t\t\tend\n\n\t\t\tnaml.nav_items.each_with_index do |naml_item, i|\n\t\t\t\tsorted_nav_items.each do |sni| \n\t\t\t\t\tsni.nav_order = i if sni.source == naml_item.source\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tsorted_nav_items.sort! { |x, y| x.nav_order <=> y.nav_order }\n\n\t\t\tsorted_nav_items.each_with_index do |sni, i| \n\t\t\t\tsni.nav_order = i + 1\n\t\t\tend\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n\t\tend\n\t\n\t\tsorted_nav_items\n\tend", "def menu(items, path, level = 0, maxlevel = 1000)\n return '' unless items # No items, nothing to display\n return '' if level >= maxlevel + 1 || level >= items.size # We've gone too deep or there aren't this many levels\n \n val = \"<ul>\";\n # Go through each item on this level and render them as list items\n items[level].each {|item|\n # We're viewing a nav item in the active path, mark it active and show it's children recursively\n if(path && path[level] && item.id == path[level].id)\n val = val + '<li class=\"active\">' + link_to(item.title, item.realpath) + menu(items, path, level+1, maxlevel)\n else\n val = val + '<li>' + link_to(item.title, item.realpath)\n end\n val = val + '</li>'\n }\n return val + \"</ul>\"\n end", "def admin_nav\n items = {'Home' => admin_root_path, \n 'Users' => admin_users_path,\n 'Submissions' => admin_submissions_path}\n output_nav(items)\n end", "def bp_mock_directory_index\n\n tree_hash = BP.same_level_views(\"/mocks\")\n\n out = \"<ul>\"\n\n tree_hash.keys.each do |tree_hash_key|\n thk = tree_hash_key.gsub(\".html.erb\", \"\")\n thk = thk.gsub(\"/mocks\", \"\")\n\n out += content_tag :li, thk.gsub(\"/\", \"\")\n\n out += \"<ul>\"\n tree_hash[tree_hash_key].each do |tree_hash_value|\n thv = tree_hash_value.gsub(\".html.erb\", \"\")\n if thv != \"index\"\n out += content_tag :li, link_to(\"#{thv}\", \"/mocks/no_layout?t=#{thk}/#{thv}\")\n end\n\n end\n out += \"</ul>\"\n\n out += \"</li>\"\n end\n out += \"</ul>\"\n\n out.html_safe\nend", "def navigation_for(identifier, options={})\n # Get root item for which we need to draw the navigation\n root = @items.find { |i| i.identifier == identifier }\n\n # Do not render if there is no child\n return nil unless root.children\n\n # Find all sections, and render them\n sections = find_item_tree(root, options)\n render_menu(sections, options)\n end", "def navtree_build(ret, item, el, el_type = \"\")\n module_name = item[:classnames][2] ? item[:classnames][2] : item[:classnames][1];\n page_name = item[:crumb]\n\n if !ret[module_name]\n ret[module_name] = {:id => module_name, :children => Hash.new}\n #if item[:deprecated] ret[module_name][:deprecated] = true\n end\n\n if !ret[module_name][:children][page_name]\n ret[module_name][:children][page_name] = {\n :id => page_name,\n :path => item.identifier,\n :children => Hash.new\n }\n #if item[:deprecated] ret[module_name][:deprecated] = true\n end\n\n el_name = el.respond_to?(:name) ? el.name : el\n ret[module_name][:children][page_name][:children][el_name] = {\n :signature => el.respond_to?(:sass_signature) ? el.sass_signature(:none) : el,\n :el_type => el_type\n }\n\n ret\nend", "def navigation(options = {})\n options.reverse_merge!( page: @page, depth: 1 )\n page = options[:page]\n children = page.home? ? page.navigable_children : page.parent.navigable_children\n html = (is_home_and_shown_in_nav?(page) ? nav_link(Page.home) : '').html_safe\n html << list_items(children, options[:depth])\n content_tag(:ul, html, options.slice(:id, :class))\n end", "def root sub_nav=nil\n raise 'Does not accept blocks' if block_given?\n sub_nav ? ('%s/%s' % [@path.first, sub_nav]) : @path.first\n end", "def nav_bar\n path_array = self.current_page.split(\"/\").drop(1)\n path_count = path_array.count\n params = self.request_params_display\n \n if URI.unescape(self.current_page) == \"/\"\n nav_bar = \"Index of /\"\n else\n nav_bar = \"Index of <a href=\\'/#{params}'>/</a>\"\n end\n \n previous_path = \"\"\n 0.upto(path_array.count - 1) do |a|\n \n ##\n # Get escaped versions of this path and previous path\n \n escaped_path = path_array[a].gsub(\" \", \"%20\").gsub(\"'\", \"%27\")\n escaped_previous = previous_path.gsub(\" \", \"%20\").gsub(\"'\", \"%27\")\n \n ##\n # If this is the last directory in the path, it shouldn't have a link\n \n if a == path_array.count - 1\n href = \"\"\n else\n href = \"<a href=\\'/#{escaped_previous}#{escaped_path}#{params}\\'>\"\n end\n \n ##\n # If this is the first directory above the root, don't prepend a slash\n \n if a == 0 \n nav_bar << \" #{href}#{path_array[a]}</a>\"\n else\n nav_bar << \" / #{href}#{path_array[a]}</a>\"\n end\n \n previous_path << path_array[a] + \"/\"\n end\n \n @nav_bar = nav_bar\n \n end", "def build_items(item, limit, index, hierarchical = false, root_path = \"\")\n return \"\" if index > limit || !item.children.present?\n\n html = \"<ul class='#{index == 1 ? \"menu\" : \"sub-menu\"}'>\"\n item.children.order_default.each do |i|\n if i.visible && i.active\n html << \"<li class='#{\"menu-item-has-children\" if i.children.present?} #{\"active\" if i.slug == params[:menu_id] || i.slug == request.original_fullpath.match(/(\\D+\\/{1}|\\D+)/)[0].gsub('/', '')}'>\"\n\n if i.external_link.blank?\n if hierarchical\n html << \"<a href='#{root_path}/#{i.slug}'>#{i.name}</a>\"\n else\n html << \"<a href='/#{i.slug}'>#{i.name}</a>\"\n end\n else\n html << \"<a href='#{i.external_link}' rel='#{(i.follow || i.follow.nil?) ? \"follow\" : \"nofollow\"}' target='#{i.target.blank? ? '_self' : i.target}'>#{i.name}</a>\"\n end\n\n html << build_items(i, limit, index + 1, hierarchical, root_path + \"/#{i.slug}\")\n html << \"</li>\"\n end\n end\n html << \"</ul>\"\n html.html_safe\n end", "def traverse(&block)\n\t\t\t\treturn to_enum(:traverse) unless block_given?\n\t\t\t\t\n\t\t\t\ttraverse_recurse(@order-1, 0, 0, self.origin, self.size, &block)\n\t\t\tend", "def traverse(&block)\n children.each{|j| j.traverse(&block) }\n block.call(self)\n end", "def getNavBar(unitID, pageName, navItems)\n if navItems\n navItems.each { |navItem|\n if navItem['slug']\n navItem['url'] = \"/uc/#{unitID}#{navItem['slug']==\"\" ? \"\" : \"/\"+navItem['slug']}\"\n end\n }\n navItems.unshift({ id: 0, type: \"home\", name: \"Unit Home\", url: \"/uc/#{unitID}\" })\n return navItems\n end\n return nil\nend", "def doc_nav(item)\n\t\tkey = @item[:docs_key]\n\t\tif (key == nil)\n\t\t\treturn nil\n\t\tend\n\n\t\tstr = \"<div class='nav'>\"\n\t\tindex = @item[:docs_index].to_i\n\t\tarr = @config[:docs][key]\n\n\t\tif (index > 1)\n\t\t\t# loop to find previous\n\t\t\tindexPrev = index - 1\n\t\t\twhile (arr[indexPrev] == nil && indexPrev > 1)\n\t\t\t\tindexPrev = indexPrev - 1\n\t\t\tend\n\t\t\tprev = arr[indexPrev]\n\n\t\t\tstr += \"<a class='nav-prev' href='\" + prev[:site_path] + \"'>\"\n\t\t\tstr += \"<i class='fa fa-chevron-circle-left'></i>&nbsp;Previous: \" + prev[:title]\n\t\t\tstr += \"</a>\"\n\t\tend\n\n\t\tif (index < arr.length - 1)\n\t\t\t# loop to find the next\n\t\t\tindexNext = index + 1\n\t\t\twhile (arr[indexNext] == nil && indexNext < arr.length - 1)\n\t\t\t\tindexNext = indexNext + 1\n\t\t\tend\n\t\t\tnextt = arr[indexNext]\n\n\t\t\tstr += \"<a class='nav-next' href='\" + nextt[:site_path] + \"'>\"\n\t\t\tstr += \"Next: \" + nextt[:title] + \"&nbsp;<i class='fa fa-chevron-circle-right'></i>\"\n\t\t\tstr += \"</a>\"\n\t\tend\n\n\t\tstr + \"</div>\"\n\tend", "def tag_for(item, level)\n level = level || false\n\n # Get simple-navigation options\n link_options = options_for(item)\n link_options[:data] ||= {}\n\n # Store toggle options\n toggle_options = {}\n toggle_options[:data] ||= {}\n toggle_options[:class] ||= \"\"\n toggle_options[:title] = \"Open menu\"\n\n if accessible\n toggle_options[:data][:navigation_level] = level\n link_options[:data][:navigation_level] = level\n end\n\n if level && level > 1 && accessible\n link_options[:data][:navigation_item] = \"\"\n toggle_options[:data][:navigation_item] = \"\"\n end\n\n # Add navigation data attributes for navigation.js \n # accessibility\n if include_sub_navigation?(item) && accessible\n link_options[:data][:navigation_parent] = \"\"\n toggle_options[:data][:navigation_parent] = \"\"\n end\n\n item_content = item.name\n\n # Add description to link item\n if has_descriptions\n description = item.html_options[:description]\n show_description = has_descriptions.eql?(true) || has_descriptions.include?(level)\n if has_toggles && show_description && description.present?\n item_content = \"<span>#{item_content}<span class='#{get_class(\"--item-description\")}'>#{description}</span></span>\"\n else\n link_options[\"data-description\"] = description\n end\n end\n\n # Parent links\n if include_sub_navigation?(item)\n \n # Add data-toggle attributes\n if has_toggles\n toggle_options[:data][:toggle_anchor] = build_item_key(item)\n toggle_options[:data][:toggle_timing] = \"100\"\n toggle_options[:data][:toggle_temporary_anchor] = \"\" if has_temporary_toggles\n toggle_options[:class] += \"active\" if has_toggle_default_open(item)\n end\n\n if has_icons && !has_split_toggles\n item_content = \"#{item_content} #{get_icons()}\"\n end\n\n # Split parents have a link + button\n if has_split_toggles\n content_tag(:div, (\n link_to(content_tag(:span, item_content), item.url, link_options) +\n content_tag('button', get_icons(), toggle_options)\n ), class: get_class(\"--split-parent\"))\n\n # Non-split parents have just a button\n elsif has_toggles\n content_tag('button', content_tag(:span, item_content), link_options.merge(toggle_options))\n else\n link_to(content_tag(:span, item_content), item.url, link_options)\n end\n\n # Non-parents get either just a span (for no link) or a link\n else\n if suppress_link?(item)\n content_tag('span', item_content, link_options)\n else\n link_to(content_tag(:span, item_content), item.url, link_options)\n end\n end\n end", "def nav(opts = {}, &block)\n opts[:class] = (opts[:class] || '') << \" nav-#{@type}\"\n opts[:data] = (opts[:data] || {}).merge(toggle: 'tab')\n opts[:child] = {\n data: {\n toggle: 'tab'\n }\n }\n\n Nav.new(@template, opts, &block)\n end", "def descend(&block)\n paths = descendants\n paths.each(&block) if block\n paths\n end", "def navigation_item(content = false, &block)\n cls = 'navigation-item'\n cls << ' active' if content\n\n tag('li', content, class: cls, &block)\n end", "def render_navbar(&block)\n action_link = get_action_link\n if !action_link\n action_link = CONFIG[:title_short]\n end\n html = content_tag(:div, id: 'navbar') do\n content_tag(:div, class: 'navbar-inner') do\n if current_lines_user\n content_tag(:span, class: 'buttons', &block) + \"<div class='btn-menu'><div class='stripes'></div></div>\".html_safe +\n \"<div class='submenu'>\n <div class='submenu-inner'>\n <ul>\n <li>#{link_to(\"Dashboard\", admin_articles_path)}</li>\n <li>#{link_to(t('activerecord.models.lines/author', count: 1).html_safe, admin_authors_path)}</li>\n </ul>\n <ul>\n <li class='small'>#{t('lines.logged_in_as').html_safe} #{current_lines_user.email}</li>\n <li>#{link_to(t('lines.buttons.logout').html_safe, logout_path)}</li>\n </ul>\n <ul>\n <li>#{link_to(t('lines.buttons.formating_help').html_safe, \"#\", class: \"btn-cheatsheet\")}</li>\n <li>#{link_to(t('lines.buttons.about').html_safe, \"http://lines.opoloo.com\")}</li>\n </ul>\n </div>\n </div>\".html_safe\n else\n content_tag(:span, link_to('', root_path), class: 'backlink') + content_tag(:span, action_link, class: 'actionlink')\n end\n end\n end\n html\n end", "def menu_group(options = {}, &block)\n pull_class = \"navbar-#{options[:pull]}\" if options[:pull].present?\n content_tag(:ul, class: \"nav navbar-nav #{pull_class}\", &block)\n end", "def navigation\n \tmenuSign = true\n links_data = []\n\n # checking best case scenario when navigation is in HTML5 nav tag\n if menuSign == true\n # getting nav nodes\n menu = @@doc.xpath(\"//nav\")\n \n unless menu.size == 0\n links_data = rate_navigation(menu) \n menuSign = false unless links_data == nil\n end\n end\n\n # if no nav tags were found\n if menuSign == true \n \t# getting divs where id contains any substring 'menu' or 'nav'\n menu2 = @@doc.xpath(\"//div[contains(@id, 'menu') or\n contains(@id, 'Menu') or\n contains(@id, 'nav') or\n contains(@id, 'Nav') or \n contains(@class, 'menu') or \n contains(@class, 'Menu') or \n contains(@class, 'nav') or \n contains(@class, 'Nav')]\") \n\n unless menu2.size == 0\n links_data = rate_navigation(menu2) \n menuSign = false unless links_data == nil\n end\n end\n\n # if no divs with id 'menu' or 'nav' were found\n if menuSign == true \n # getting ul,ol structures in which might be navigation \n menu3 = @@doc.xpath(\"//ul\")\n menu3 += @@doc.xpath(\"//ol\")\n\n unless menu3.size == 0\n links_data = rate_navigation(menu3) \n menuSign = false unless links_data == nil\n end\n end\n\n # chceking the worst case scenario when page might be built using tables\n if menuSign == true\n # getting tables in which might be navigation\n menu4 = @@doc.xpath(\"//table\")\n menu4 += @@doc.xpath(\"//tbody\")\n\n unless menu4.size == 0\n links_data = rate_navigation(menu4) \n menuSign = false unless links_data == nil\n end\n end\n # filling menu in template\n links_data\n end", "def top_menu(name, &block)\n content = capture(&block) \n content_tag(:li, class: \"dropdown\") do\n (\"<a href='#' class='dropdown-toggle' data-toggle='dropdown'>#{name}<b class='caret'></b></a>\" +\n content_tag(:ul, content, class: \"dropdown-menu\")).html_safe\n end\n end", "def traverse(parent, &block)\n\n end", "def nav(name=\"\", path=root_path, active='')\n active_class = active == controller.controller_name ? 'activelink' : ''\n markaby do #=> Markaby template.\n li :class => active_class do\n link_to(name, path)\n end\n end\n end", "def each_directory_in_tree(include_self: true)\n self.directories_in_tree(include_self: include_self).find_each do |directory|\n yield directory\n end\n end", "def nav\n [\n {:label => '1. Introduction', :content => '1-introduction.html', :nav => []},\n {:label => '2. Understanding Sphinx', :content => '2-understanding-sphinx.html', :nav => []},\n {:label => '3. Installation', :content => '3-sphinx-installation.html', :nav => []},\n {:label => '4. Address Book Example', :content => '4-address-book-example.html', :nav => []},\n {:label => '5. References', :content => '5-reference.html', :nav => []},\n {:label => '6. Resources', :content => '6-resources.html', :nav => []},\n ]\n end", "def traverse(&block); end", "def traverse(&block); end", "def user_nav\n if @current_user\n items = {'Home' => root_path, 'My Account' => account_path, 'My Submissions' => current_user_submissions_path}\n else\n if ApplicationSettings.config['user_registration']\n end\n items = {'Home' => root_path, 'Signup' => signup_path}\n end\n output_nav(items)\n end", "def traverse(&block)\n children.each { |j| j.traverse(&block) }\n block.call(self)\n end", "def visit_tree(files, &block)\n case files\n when Array\n files.each { | f| visit_tree(f,&block)}\n when String\n yield(:file, files) if block_given?\n when Hash\n files.each do |k,v|\n yield(:directory, k) if block_given?\n Dir.chdir(k) {visit_tree(v, &block) }\n end\n else\n throw \"Bad directory structure #{files}\"\n end\n end", "def main_menu_nav(main_menu_item)\n main_menu_items.each do |item|\n if item.text == main_menu_item\n item.click\n break\n end\n end\n end", "def traverse_nav_tree_and_convert_to_xml(node)\n \n # traverse subfolders, go deep\n if node_has_children(node)\n node.children.items.each do |child|\n traverse_nav_tree_and_convert_to_xml(child)\n end\n end\n \n return if node.nav_level == 0\n \n mod = node.dup\n\n link = node.link\n full_link = node.full_link\n \n mod.parent_link = parent_link = node.link[0..(link.rindex(\"/\") - 1)] if node.nav_level > 1\n \n if CONTENT_LINK_PREFIX && CONTENT_LINK_PREFIX.length > 0\n full_link = mod.full_link = \"/\" + CONTENT_LINK_PREFIX + node.full_link unless node.full_link.start_with?(\"/#{CONTENT_LINK_PREFIX}\")\n end\n\n \n mod.delete :source_path\n mod.delete :parent_path\n mod.delete :children\n\n\n #puts \"storing [#{mod.nav_level}][#{mod.nav_order}][#{mod.nav_type}] - #{mod.nav_title}\"\n case mod.nav_type \n \n when \"folder\"\n\t\t# do nothing for these\n when \"markdown\"\n metadata, markdown = parse_markdown_file(node.source_path)\n\t\t\n\t\tfilepath_markdown = node.source_path.dup\t\t\n\t\tfilepath_markdown += \".markdown\"\tunless filepath_markdown.end_with? (\".markdown\")\t\t\n\t\tmod.updated_at = Chronic.parse(File.mtime(filepath_markdown).to_s).utc.to_i\n\t\t\n mod.metadata = metadata if metadata\n mod.markdown = markdown\n \n\t\thtml = MarkdownRender::render(mod.markdown)\n\t\tdoc = Nokogiri::HTML(html) \n\t\txml = doc.css('body')[0].serialize #(save_with: 0)\n\t\txml.gsub!(/^<p><img /, \"<img \")\n\t\txml = Nokogiri::XML(xml)\n\t\tb = xml.at_css \"body\"\n\t\tb.name = \"doc\"\n\t\t\n File.open(\"#{filepath_markdown.gsub(/.markdown/, \".xml\")}\", 'w') { |f| xml.write_xml_to f }\n\n when \"folder+markdown\"\n metadata, markdown = parse_markdown_file(node.source_path)\n\t\t\n\t\tfilepath_markdown = node.source_path.dup\t\t\n\t\tfilepath_markdown += \".markdown\"\tunless filepath_markdown.end_with? (\".markdown\")\t\t\n\t\tmod.updated_at = Chronic.parse(File.mtime(filepath_markdown).to_s).utc.to_i\n\t\t\n mod.metadata = metadata if metadata\n mod.markdown = markdown\n\n\t\thtml = MarkdownRender::render(mod.markdown)\n\t\tdoc = Nokogiri::HTML(html)\n\t\txml = doc.css('body')[0].serialize #(save_with: 0)\n\t\txml.gsub!(/^<p><img /, \"<img \")\n\t\txml = Nokogiri::XML(xml)\n\n img_sizes = {\n \"40%\" => \"min\",\n \"50%\" => \"small\",\n \"65%\" => \"medium\",\n \"100%\" => \"full\",\n \"600px\" => \"large\"\n }\n \n img_sizes.each do |size,name|\n img = xml.at_css \"img[width=\\\"#{size}\\\"]\"\n img['size'] = name if img\n puts img.inspect if img\n end\n\n\t\tb = xml.at_css \"body\"\n\t\tb.name = \"doc\"\n\t\t\n File.open(\"#{filepath_markdown.gsub(/.markdown/, \".xml\")}\", 'w') { |f| xml.write_xml_to f }\n end\n \nend", "def each(&block)\n each_node([], @root, block)\n end", "def index\n block_pagination\n respond_to do |format|\n format.html {\n @action_nav = CW::ActionNav::Controller::Base.new.section('Change') {|s|\n s.link 'add show episode ordering', { :action => 'new', :type => 'HomePageBlockShowDl' }, { :title => 'Add a Show DL Episode ordered block to the home page' }\n s.link 'add show filtered ordering', { :action => 'new', :type => 'HomePageBlockFiltered' }, { :title => 'Add a block filtered by show id and order to the home page' }\n }\n render :action => 'index'\n }\n end\n end", "def sticky_subnav(&block)\n content_for :subnav do\n div_tag id: 'subnav', class: 'sticky-subnav' do\n div_tag id: 'subnav-contents' do\n capture(&block)\n end\n end\n end\n end", "def categories_in_path(&block)\n list = []\n current_node = self\n while current_node && current_node.name != 'Categories'\n yield current_node if block_given?\n list.insert(0, current_node)\n current_node = current_node.parent\n end\n list\n end", "def visit_all(&block)\n visit &block\n children.each {|c| c.visit_all &block}\n end", "def each(&block)\n sorted_children.each do |name, child|\n yield(name, child)\n end\n end", "def each_item(&block)\n root_group = get(@root['mainGroup'].to_s, Xcode::PBXGroup)\n root_group.each_item(&block)\n end", "def render_menu_block(menu_block, *args, &link_func)\n if menu_block.is_a?(String)\n menu_block = Spree::MenuBlock.find_by_name(menu_block)\n end\n\n # TODO: log an error\n return if menu_block.nil?\n\n defaults = {\n depth: 0,\n wrapper_el: 'ul',\n submenu_wrapper_el: 'ul',\n item_wrapper_el: 'li',\n wrapper_class: \"cms-menu\",\n item_wrapper_class: nil,\n wrapper_id: nil,\n show_parent: false,\n cache: true,\n }\n options = defaults.merge(args.extract_options!)\n\n cache_if options.delete(:cache), [\n menu_block,\n menu_block.fragment_cache_options(request.fullpath, options)\n ] do\n path = Spree::CmsRoutes.remove_spree_mount_point(request.fullpath)\n\n mi = nil\n if menu_block.sets_active_tree? || menu_block.follows_current?\n # find_by_id to avoid ActiveRecord error\n mi = Spree::MenuItem.find_by_id(Spree::MenuItem.id_from_cached_slug(path))\n end\n\n if menu_block.follows_current?\n # attempt to find the current menu\n if mi\n # set the root id\n root_id = case menu_block.menu_block_type\n when MenuBlock::TYPES.assoc('Show children of \"current\" menu item').last\n mi.id # children\n when MenuBlock::TYPES.assoc('Show children or siblings of \"current\" menu item').last\n if mi.children.where(is_published: true, is_visible_in_menu: true).any?\n mi.id # children\n else\n mi.parent_id # siblings\n end\n else\n mi.parent_id # siblings\n end\n safe_concat(render_menu_tree(\n mi.menu,\n options.merge({\n only_visible: true,\n root_id: root_id,\n path_ids: mi.path_ids,\n }),\n &link_func\n ))\n end\n else\n safe_concat(\n render_menu_tree(\n menu_block.menu,\n options.merge({\n only_visible: true,\n root_id: menu_block.spree_menu_item_id,\n path_ids: (mi ? mi.path_ids : []),\n }),\n &link_func\n )\n )\n end\n end\n\n end", "def traverse\n link = @remaining_links.first\n if link\n @remaining_links.shift\n yield link\n @links[link]\n else\n @father\n end\n end", "def display_segment( node )\n html = \"<li>\".html_safe\n node_class = \"folder\"\n if node.class == Venue\n node_class = \"file\"\n end\n if node.class == Organisation\n node_class = \"web-browser\"\n end\n if node == nil then\n html << \"<span class=\\\"#{node_class}\\\"> <a href=\\\"/location_tree/NIL\\\">Found NIL</a> </span>\".html_safe\n html << \"<ul id=\\\"children_of_NIL\\\">\".html_safe\n\n else\n html << \"<span class=\\\"#{node_class}\\\"> <a href=\\\"/location_tree/#{node.id}\\\">#{node.to_s}</a> </span>\".html_safe\n html << \"<ul id=\\\"children_of_#{node.id}\\\">\".html_safe\n node.children.each{|child_node|\n html << display_segment( child_node )}\n end\n html << \"</ul></li>\".html_safe\n end", "def navigation nodes_stack, nodes, level=0\n nodes.map do |node|\n model_param = node.abstract_model.to_param\n url = locale_url_for(:action => :index, :controller => 'rails_admin/main', :model_name => model_param)\n level_class = \" nav-level-#{level}\" if level > 0\n\n li = content_tag :li, \"data-model\"=>model_param do\n #content_tag(:i, '', class: \"icon icon-#{model_param}\")\n #link_to(node.label_plural, url, :class => \"pjax#{level_class}\")\n adata = t('admin.menu.tip.'\"#{model_param}\")\n link_to url, class: \"tip-right pjax#{level_class}\", 'data-original-title' => adata do\n content_tag(:i, '', class: \"icon icon-#{model_param}\") + content_tag(:span, node.label_plural )\n end\n end\n li + navigation(nodes_stack, nodes_stack.select{ |n| n.parent.to_s == node.abstract_model.model_name}, level+1)\n end.join.html_safe\n end", "def print_subnav\n sidebar_list = subnav\n if sidebar_list.any?\n haml_tag :div, :class => \"subnav\" do\n haml_tag :ul do\n sidebar_list.each do |item|\n if item.is_a? Hash\n item = render(item)\n end\n haml_concat item\n end\n end\n end\n end\n end", "def tbs_nav_tabs\n\t\tcontent_tag(:ul, class: 'nav nav-tabs') do\n\t\t\tyield\n\t\tend\n\tend", "def traverse(dir, base=dir, &block)\n return unless File.directory?(dir)\n Dir.new(dir).each do |file|\n next if file == '.' or file == '..'\n path = File.join(dir, file)\n if File.directory?(path)\n traverse(path, base, &block)\n else\n block.call(path.sub(base+'/',''))\n end\n end\n end", "def navi(rel_pos=\"/~kunolab/\")\n puts \"<ul class='menuBar'>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/MiniWorkshop/2nd/index.html\\\">Mini-Workshop</a>\"\n puts \"<li><a href=\\\"https://calendar.google.com/calendar/embed?src=kunogroup%40gmail.com&ctz=Asia%2FTokyo\\\">久野研カレンダー(KunoLabCalendar)</a>\"\n puts \"<li><a href=\\\"/~kunolab/seminar/ronbun/2018/index.html\\\">論文紹介(Paper Presentation)</a>\"\n puts \"<li><a href=\\\"/~kunolab/seminar/kenkyu/2018/index.html\\\">研究紹介(Research Presentation)</a>\"\n puts \"<li><a href='#'>ゼミ(Seminar) <image src=\\\"image/sita3.png\\\" class=\\\"headImg\\\"></a>\"\n puts \"<ul>\"\n puts \"<li><a href=\\\"/~kunolab/seminar/Lepton_2017/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Leptonゼミ(2017)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Modern_2016/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Thomsonゼミ(2016)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Modern_2015/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Thomsonゼミ(2015)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Perkins_2015/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Perkinsゼミ(2015)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Mann_2014/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Mannゼミ(2014)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Mann/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Mannゼミ(2013)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Elementary_2013/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> 素粒子物理学ゼミ(2013)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Leo_2012/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Leoゼミ(2012)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Perkins_2012/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Perkinsゼミ(2012)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Elementary/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> 素粒子物理学ゼミ(2012)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Knoll/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Knollゼミ(2011)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Knoll_en/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Knoll(en)ゼミ(2011)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Roe/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Roeゼミ(2011)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Leo/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Leoゼミ(2010)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Perkins_en/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Perkins(en)ゼミ(2010)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Leo_en/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Leo(en)ゼミ(2010)</a></li>\"\n puts \"</ul>\"\n puts \"</ul>\"\nend", "def each &block\n collection = self.collection\n if prefix = prefix_with_delim\n collection = collection.with_prefix(prefix)\n end\n collection.each(:delimiter => delimiter) do |member|\n case\n when member.respond_to?(:key)\n yield LeafNode.new(parent, member)\n when member.respond_to?(:prefix)\n yield BranchNode.new(parent, member,\n :delimiter => delimiter,\n :append => append?)\n end\n end\n nil\n end", "def each_with_level &block\n # @todo A bit of a hack that I would like to fix one day...\n @root.children.each do |element|\n recursive_each_with_level element, 1, block\n end\n end", "def process_self_and_descendants\n yield self\n descendants.each { |item| yield(item) }\n end", "def process_descendants_and_self\n descendants.reverse.each { |item| yield(item) }\n yield self\n end", "def each\n self.traverse_down { |node| yield(node) }\n end", "def each(&block)\n tree.each(&block)\n end", "def nestable_list_recursive(items, block)\n content_tag(:ol, class: 'dd-list') do\n tags = items.map do |item|\n content_tag(:li, class: 'dd-item', data: { id: item.to_param }) do\n content = capture_with_haml { block.call(item) }\n recurse = if item.children.empty?\n ''.html_safe\n else\n nestable_list_recursive(item.children, block)\n end\n\n content.html_safe + recurse\n end\n end\n\n tags.join.html_safe\n end\n end", "def recurse_otml_dirs(&block)\n return unless self.has_otmls\n yield(self)\n self.children.each do |child|\n child.recurse_otml_dirs(&block)\n end\nend", "def manageable_breadcrumbs(options = {})\n items = Helpers::NavigationBuilder.new\n yield items if block_given?\n\n options[:class] ||= \"\"\n options[:class] << \" breadcrumb\"\n options[:class].strip!\n\n content_tag(\"div\", options) do\n content_tag(\"ul\") do\n items.collect { |item|\n content_tag(\"li\", :class => item[:class]) do\n if item[:active]\n item[:label]\n else\n link_to(item[:label], item[:href])\n end\n end\n }.join(\"\").html_safe\n end\n end\n end", "def main_menu\n ctrlr = request.parameters['controller'].split('/').last\n dashboard_class = (ctrlr == 'dashboard' ? 'current' : '')\n assets_class = (ctrlr == 'assets' ? 'current' : '')\n design_class = ((ctrlr == 'themes' || ctrlr == 'resources') ? 'current' : '')\n contacts_class = (ctrlr == 'contacts' ? 'current' : '')\n settings_class = (ctrlr == 'settings' ? 'current' : '')\n content_class = ((ctrlr == 'home' || ctrlr == 'links' || ctrlr == 'news_items' || ctrlr == 'portfolios' || ctrlr == 'assigned_assets' || ctrlr == 'resume_sections' || ctrlr == 'resume_items' || ctrlr == 'galleries') ? 'current' : '')\n admin_class = ((ctrlr == 'users' || ctrlr == 'sites' || ctrlr == 'memberships') ? 'current' : '')\n \n result = content_tag('li', link_to('Dashboard', admin_dashboard_path, :class => dashboard_class))\n result << content_tag('li', link_to('Content', edit_admin_home_path, :class => content_class))\n result << content_tag('li', link_to(assets_name, admin_assets_path, :class => assets_class))\n result << content_tag('li', link_to('Design', admin_themes_path, :class => design_class))\n result << content_tag('li', link_to('Contacts', admin_contacts_path, :class => contacts_class))\n result << content_tag('li', link_to('Settings', edit_admin_settings_path, :class => settings_class))\n if admin?\n result << content_tag('li', link_to('Admin', admin_users_path, :class => admin_class))\n end\n result\n end", "def render_breadcrumb ( menu , options )\n links = []\n item = current_item(menu)\n if item != nil\n links << render_breadcrumb_node(item, options)\n while item.parent != nil do\n if item.parent.is_a? Symbol\n links << link_to( 'Home', '/' , {:class=>options[:link_class]} ).html_safe + ' > '.html_safe\n break\n else\n links << render_breadcrumb_node(item.parent, options).html_safe + ' > '.html_safe\n item = item.parent\n end\n end\n end\n links = links.reverse\n links.empty? ? '' : content_tag('div', links.join(\"\\n\") , :class=>options[:div_class]).html_safe\n end", "def each(&block)\n @current_page += 1\n fetch_current_page if !@fetched_current_page\n @items.each { |i| block.call i } \n @fetched_current_page = false\n end", "def build(&block)\n raise 'build must be called with a block' if !block_given?\n\n root = menu_items.build(:title => 'Home', :url => '/', :lft => 1, :rgt => 2)\n root.parent = true\n instance_exec(&block) # A call to dropdown or item\n root.rgt = menu_items.map(&:rgt).max\n self\n end", "def walk(&blk)\n yield self\n self.each_child do |child|\n child.walk(&blk)\n end\n end", "def walk &blk\n self.children.each do |child|\n yield child\n end\n self.children.each do |child|\n child.walk &blk\n end\n end", "def foreach(&block)\n ::Dir.foreach(path, &block)\n end", "def navigation_tag(options = {}, &block)\n b = NavigationBuilder.new(self, options)\n yield b\n concat(b.to_html) unless b.empty?\n nil\n end", "def traverse_down(&block)\n block.call(self)\n if(!children.nil?)\n children.each{ |child| child.traverse_down(&block) }\n end\n end", "def traverse\n nodes = [self]\n until nodes.empty?\n node = nodes.pop\n yield node\n nodes += node.children.reverse unless node.children.empty?\n end\n end" ]
[ "0.6650002", "0.6526568", "0.65144163", "0.6413888", "0.6250708", "0.6249965", "0.61853987", "0.60712755", "0.5941075", "0.592345", "0.59190845", "0.58274376", "0.5810377", "0.580561", "0.5765988", "0.57558376", "0.57232195", "0.5702313", "0.5700346", "0.5696164", "0.5694098", "0.5682521", "0.56643707", "0.5644229", "0.5642893", "0.56121045", "0.56070954", "0.5600134", "0.55924344", "0.55834067", "0.55653834", "0.55527294", "0.5550609", "0.5536835", "0.5527572", "0.55169344", "0.5470901", "0.54558885", "0.54530543", "0.5443035", "0.54229206", "0.54174596", "0.5401114", "0.5384126", "0.53818333", "0.5376243", "0.537354", "0.53694767", "0.53643334", "0.5348912", "0.5342658", "0.53352183", "0.5332097", "0.5328919", "0.5328172", "0.53241736", "0.53145105", "0.53131574", "0.53114533", "0.53034097", "0.53034097", "0.52939", "0.5293493", "0.5286389", "0.528215", "0.52610725", "0.5256079", "0.52531093", "0.5247988", "0.524193", "0.52406317", "0.5240487", "0.5239981", "0.5228725", "0.5216445", "0.5212374", "0.5209035", "0.52075523", "0.52036464", "0.5200913", "0.5182834", "0.51827437", "0.5181972", "0.5166694", "0.51645964", "0.5161393", "0.515422", "0.51541734", "0.5149465", "0.51467085", "0.51416034", "0.513906", "0.51374936", "0.51358485", "0.51342046", "0.51238704", "0.5118854", "0.51122195", "0.5104487", "0.50983965" ]
0.78703076
0
Possible EC2 states: states = %w( pending running shuttingdown terminated stopping stopped )
def insync?(is) # an empty array is analogous to no should values return true if @should.empty? # only support a single should should = @should.first # use Symbol to match should is = "shuttingdown" if is == "shutting-down" is = is.to_sym stop_state = [:stopped, :stopping, :shuttingdown] case should when :present return is != :terminated when :running return stop_state.include?(is) ? false : true when :stopped return stop_state.include?(is) ? true : false end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def states\n [\n ['0', 'EMERGENCY_SHUTDOWN',\n 'State machine has a bug, cannot be trusted']\n ]\n end", "def vm_state(state)\n case state\n when 'poweredOn'\n 'RUNNING'\n when 'suspended'\n 'POWEROFF'\n when 'poweredOff'\n 'POWEROFF'\n else\n 'UNKNOWN'\n end\n end", "def available_states\n states = []\n states << :passive if passive?\n states << :pending if passive? || pending?\n states << :active\n states << :suspended unless deleted?\n states << :deleted\n states\n end", "def states\n [\n 'CREATE_IN_PROGRESS',\n 'CREATE_IN_PROGRESS',\n 'CREATE_FAILED',\n 'CREATE_COMPLETE',\n 'ROLLBACK_IN_PROGRESS',\n 'ROLLBACK_FAILED',\n 'ROLLBACK_COMPLETE',\n 'DELETE_IN_PROGRESS',\n 'DELETE_FAILED',\n 'DELETE_COMPLETE',\n 'UPDATE_IN_PROGRESS',\n 'UPDATE_COMPLETE_CLEANUP_IN_PROGRESS',\n 'UPDATE_COMPLETE',\n 'UPDATE_ROLLBACK_IN_PROGRESS',\n 'UPDATE_ROLLBACK_FAILED',\n 'UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS',\n 'UPDATE_ROLLBACK_COMPLETE',\n 'REVIEW_IN_PROGRESS'\n ]\n end", "def state\n running_vms = vboxmanage('list', 'runningvms')\n state = 'poweroff'\n if running_vms.kind_of?(Array)\n running_vms.each do |vm|\n if vm.include? resource[:name]\n state = 'running'\n end\n end\n else\n \tif running_vms.include? resource[:name]\n \t state = 'running'\n \tend\n end\n state\n end", "def states\n\t[:shelf,:in_use,:borrowed,:misplaced,:lost]\nend", "def start_terminating! options={}\n return true if away?\n return :wait if terminating? || busy?\n Log.info \"Terminating #{self}\"\n response = Wucluster.ec2.terminate_instances options.merge(:instance_id => [self.id])\n new_state = response.instancesSet.item.first.currentState.name rescue nil\n Log.warn \"Request returned funky status: #{new_state}\" unless (['shutting-down', 'terminated'].include? new_state)\n self.status = new_state.gsub(/-/,'_').to_sym\n dirty!\n response\n end", "def get_ok_states\n self.statemap['on_running'].map{|_, new_states| new_states['ok']}\n end", "def state\n %w{ OFF ON }[params.valve.cmd]\n end", "def get_pending_states\n self.statemap['on_pending'].map{|state, _| state}\n end", "def states; end", "def get_instance_state_message\n @status ||= 0\n @status %= 4\n {\n \"0\" => \"H\", \n \"1\" => \"O\", \n \"2\" => \"L\", \n \"3\" => \"A\"\n }[ ((@status+=1)-1).to_s ]\n end", "def status\n state = (active_instance.nil? ? 999 : active_instance.status)\n case state\n when 0 \n 'missing'\n when 1 \n 'none'\n when 2 \n 'pending'\n when 3 \n 'unready'\n when 4 \n 'failed'\n when 5 \n 'ready'\n when 666 \n 'deleted'\n when 999\n 'inactive'\n else \n 'hold'\n end\n end", "def friendly_state\r\n return '' if current_state == 'unstarted'\r\n return 'in progress' if current_state == 'started'\r\n current_state\r\n end", "def wait_for_state!(states, timeout = default_timeout)\n states = [states] unless states.is_a?(Array)\n raise \"[ #{@node}/#{@environment} ] - Instance fails to be in a state among (#{states.join(', ')}) with timeout #{timeout}. Currently in state #{state}\" unless wait_for_state(states, timeout)\n end", "def wait_state(state, deploy_id)\n ready = (state == 'stopped') || (state == 'pending') || (state == 'running') || (state == 'terminated')\n raise \"Waiting for an invalid state\" if !ready\n t_init = Time.now\n begin\n wstate = get_instance(deploy_id).state.name rescue nil\n raise \"Ended in invalid state\" if Time.now - t_init > @state_change_timeout\n sleep 3\n end while wstate != state\n end", "def state\n status[\"state\"]\n end", "def state\n status.state name\n end", "def actions(state)\n if state == :stop || terminii.member?(state)\n [:stop]\n else\n MOVES.keys\n end\n end", "def instances_status\n @instances.each do |i_id, meta|\n status = AWS::CLI_Interface.ec2_instance_status(i_id)\n output = \"#{meta['name']} (#{i_id})\".colorize(color: :white, background: :blue) +\n \" : \".colorize(:yellow) +\n \"#{status[:label]}\".colorize(color: :white, background: status[:color])\n\n if meta.has_key? 'timeout'\n output += \" : \".colorize(:yellow)\n output += \"Timeout: #{meta['timeout']}\".colorize(color: :black, background: :light_yellow)\n end\n\n Logging.log output\n end\n end", "def get_error_states\n self.statemap['on_running'].map{|_, new_states| new_states['error']}\n end", "def state\n return \"not created\" unless self.exists?\n\n return \"suspend\" if self.suspended?\n\n return \"running\" if self.running?\n\n return \"not running\"\n end", "def aws_instance_status(opts)\n opts[:instance].status\n end", "def status_allowed(state)\n allowed_states = case status\n when 'legacy'\n ['deleted']\n when 'provisional'\n ['pending', 'approved', 'deleted']\n when 'pending'\n ['approved', 'deleted']\n when 'approved'\n ['interred', 'deleted']\n when 'interred'\n ['completed', 'deleted']\n when 'completed'\n ['deleted']\n else\n []\n end\n \n allowed_states << status if self.class.valid_states.include?(state)\n allowed_states.include? state\n end", "def states\n []\n end", "def states\n []\n end", "def in_service_instances\n instances([{name: :lifecycle_state, value: \"InService\"}])\n end", "def select_from_instances_on_status(status=/running/, list=[])\n list.select {|a| a[:status] =~ status}\n end", "def stopped!\n self.update_attribute(:status, States::STOPPED)\n end", "def orderStates\n @states = Hash.new\n @states[0] = \"Processing\"\n @states[1] = \"Shipped\"\n @states[2] = \"Delivered\"\n @states[3] = \"Cancelled\"\n end", "def success_states\n [\n 'CREATE_COMPLETE',\n 'DELETE_COMPLETE',\n 'UPDATE_COMPLETE'\n ]\n end", "def states_events\n states_events_config.map { |se| [ se[:to_state], se[:event], se[:event_description] || '' ] }\n end", "def state\n case pipeline.status\n when 'scheduled', 'created', 'pending', 'preparing', 'waiting_for_resource' then 'pending'\n when 'running' then 'in_progress'\n when 'success' then 'successful'\n when 'failed' then 'failed'\n when 'canceled', 'skipped' then 'cancelled'\n else\n 'unknown'\n end\n end", "def echo_state(state)\n if String.disable_colorization\n case state\n when 'running' then '+ ' \n when 'stopped' then '- '\n when 'terminated' then 'X '\n when 'pending' then 'O '\n when 'shutting-down' then '\\\\_'\n when 'stopping' then '~-'\n else '??'\n end\n else\n case state\n when 'running' then '✅ ' \n when 'stopped' then '❙❙'\n when 'terminated' then '⚫ '\n when 'pending' then '⚪ '\n when 'shutting-down' then '♺ '\n when 'stopping' then '⌛ '\n else '??'\n end\n end\nend", "def state\n catch_aws_errors do\n instance&.state&.name\n end\n end", "def state\n # Determine the ID of the state here.\n state_id = nil\n state_id = :not_created if !@driver.uuid\n state_id = @driver.read_state if !state_id\n state_id = :unknown if !state_id\n\n # Translate into short/long descriptions\n short = state_id.to_s.gsub('_', ' ')\n long = I18n.t(\"vagrant_parallels.commands.status.#{state_id}\")\n\n # If machine is not created, then specify the special ID flag\n if state_id == :not_created\n state_id = Vagrant::MachineState::NOT_CREATED_ID\n end\n\n # Return the state\n Vagrant::MachineState.new(state_id, short, long)\n end", "def known_states; end", "def known_states; end", "def known_states; end", "def state\n return :finished if finished?\n return :yet unless started?\n return :terminated if (Time.now - latest_modified_time > @alive_time)\n return :started \n end", "def states *args, &block\n valid_unless_nested()\n each_state_or_event 'state', *args, &block\n end", "def name_of(state)\n state = state.to_i\n return case state\n when -2 then \"DISCARDED\"\n when -1 then \"INIT\"\n when 0 then \"SUCCEEDED\"\n when 1 then \"WAIT\"\n when 2 then \"RUNNING\"\n when 3 then \"SUSPEND\"\n when 4 then \"FAILED\"\n else raise \"unknown state #{state}\"\n end\n end", "def state_string()\n ss = 'UNKNOWN'\n case @state\n when STARTING\n ss = 'STARTING'\n when STOPPED\n ss = 'STOPPED'\n when RUNNING\n ss = 'RUNNING'\n when CLOSING\n ss = 'CLOSING'\n when BLOCKED\n ss = 'BLOCKED'\n when STEP\n ss = 'STEP'\n end\n ss\n end", "def state\n running_response = running?\n return running_response unless running_response.successful?\n\n response = Response.new :code => 0, :data => 'not running'\n\n if running_response.data\n response.data = 'running'\n else\n suspended_response = suspended?\n return suspended_response unless suspended_response.successful?\n\n response.data = 'suspended' if suspended_response.data\n end\n\n response\n end", "def state\n running_response = running?\n return running_response unless running_response.successful?\n\n response = Response.new :code => 0, :data => 'not running'\n\n if running_response.data\n response.data = 'running'\n else\n suspended_response = suspended?\n return suspended_response unless suspended_response.successful?\n\n response.data = 'suspended' if suspended_response.data\n end\n\n response\n end", "def all_state\n result = {:cook_state => RightScale::CookState, :chef_state => RightScale::ChefState}\n end", "def waiting_state?(state)\n [:wait_in_queue, :wait_queue_pos, :wait_stable_build].include? state\nend", "def attrs_for_states\n state_sym = state.to_sym\n\n case state_sym\n when :claimed\n validate_actor_and_timestamp_exist :claim\n when :missed\n validate_timestamp_exists :miss\n when :connected\n unless origin_connected?\n errors.add(:origin_status, \"must be '#{CONNECTED_STATUS}' when #{self.class.name} is #{state}\")\n end\n unless destination_connected?\n errors.add(:destination_connected, \"must be '#{CONNECTED_STATUS}' when #{self.class.name} is #{state}\")\n end\n when :disconnected\n if origin_connected? && destination_connected?\n errors.add(:base, \"Both origin and destination can't be '#{CONNECTED_STATUS}' when #{self.class.name} is #{state}\")\n end\n when :ended\n validate_actor_and_timestamp_exist :end\n when :merged\n if merged_into_phone_call_id.nil?\n errors.add(:merged_into_phone_call_id, \"must specify a phone call when #{self.class.name} is #{state}\")\n end\n end\n end", "def _reservation_state(base)\n\t\t\t\t\t\n\t\t\t\t\t# Now\n\t\t\t\t\tnow = Time.current\n\t\t\t\t\t\n\t\t\t\t\t# States\n\t\t\t\t\treservation_states = config(:reservation_states)\n\n\t\t\t\t\t# Break times\n\t\t\t\t\tif config(:reservation_state_policy) == \"time_fixed\"\n\t\t\t\t\t\tbreak_times = []\n\t\t\t\t\t\treservation_states.reverse_each_with_index do |reservation_state_spec, index|\n\t\t\t\t\t\t\tif index != 0 # Do not consider first state\n\t\t\t\t\t\t\t\treservation_state_name = reservation_state_spec[:name]\n\t\t\t\t\t\t\t\ttime_fixed = self.send(\"time_fixed_#{reservation_state_name}\")\n\t\t\t\t\t\t\t\tif time_fixed\n\t\t\t\t\t\t\t\t\tbreak_times << time_fixed\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\tbreak_times << break_times.last\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tbreak_times = [base]\n\t\t\t\t\t\treservation_states.reverse_each_with_index do |reservation_state_spec, index|\n\t\t\t\t\t\t\tif index != 0 && index != (reservation_states.length - 1) # Do not consider first and last reservation_state\n\t\t\t\t\t\t\t\treservation_state_name = reservation_state_spec[:name]\n\t\t\t\t\t\t\t\ttime_window = self.send(\"time_window_#{reservation_state_name}\")\n\t\t\t\t\t\t\t\tif time_window\n\t\t\t\t\t\t\t\t\tbreak_times << (break_times.last - time_window.days_since_new_year.days - time_window.seconds_since_midnight.seconds)\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\tbreak_times << break_times.last\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\t# State recognititon\n\t\t\t\t\tresult_reservation_state = nil\n\t\t\t\t\tresult_reservation_state_behavior = nil\n\t\t\t\t\treservation_states.each_with_index do |reservation_state_spec, index|\n\t\t\t\t\t\tif index < reservation_states.length - 1\n\t\t\t\t\t\t\tif !break_times[reservation_states.length - 2 - index].nil? && now < break_times[reservation_states.length - 2 - index]\n\t\t\t\t\t\t\t\tresult_reservation_state = reservation_state_spec[:name].to_sym\n\t\t\t\t\t\t\t\tresult_reservation_state_behavior = reservation_state_spec[:behavior].to_sym\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse # Last fallback state\n\t\t\t\t\t\t\tresult_reservation_state = reservation_state_spec[:name].to_sym\n\t\t\t\t\t\t\tresult_reservation_state_behavior = reservation_state_spec[:behavior].to_sym\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\treturn [result_reservation_state, result_reservation_state_behavior]\n\t\t\t\tend", "def running?; state == 'running'; end", "def running?; state == 'running'; end", "def available_transitions\n status_available = respond_to?(:status) && status!=nil\n return {:allow => []} unless status_available\n self.class.states[self.status.to_sym] || {:allow => []}\n end", "def wait_for_state(state)\n current_state = 'unknown'\n while current_state != state\n sleep(10)\n begin\n current_state = get_state_description\n rescue StandardError\n current_state = 'unknown'\n end\n end\n end", "def read_state\n read_vm_option('status').strip.to_sym\n end", "def to_status\n time = Time.now.to_i\n last = @db.execute(\"SELECT value from #{@settings} where key = 'LAST_SYNC'\").flatten[0].to_i\n\n sync_state = last == 0 || time > (last + @conf[:sync].to_i)\n\n status_str = ''\n monitor_ids = []\n\n if sync_state then\n status_str = \"SYNC_STATE=yes\\nMISSING_STATE=#{@conf[:missing_state]}\\n\"\n \n @db.execute(\"REPLACE INTO #{@settings} VALUES ('LAST_SYNC', #{time.to_s})\")\n end\n\n vms = DomainList.state_info(@host, @host_id)\n\n # ----------------------------------------------------------------------\n # report state changes in vms\n # ----------------------------------------------------------------------\n vms.each do |uuid, vm|\n next if vm[:ignore] == true\n\n if vm[:id] == -1\n filter = \"WHERE uuid = '#{uuid}'\"\n else\n # in ec2 id could first be -1 but later added, check also uuid\n filter = \"WHERE id = '#{vm[:id]}' OR uuid = '#{uuid}'\"\n end\n\n vm_db = @db.execute(\"SELECT * FROM #{@dataset} #{filter}\").first\n\n monitor_ids << uuid\n\n if vm_db.nil?\n @db.execute(\n \"INSERT INTO #{@dataset} VALUES (?, ?, ?, ?, ?, ?, ?, ?)\",\n [uuid,\n vm[:id].to_i,\n vm[:name],\n vm[:deploy_id],\n time,\n 0,\n vm[:state],\n @conf[:hyperv]]\n )\n\n status_str << vm_to_status(vm)\n \n next\n end\n\n # Updates timestamp and uuid/deploy_id (e.g. VM recreated in KVM)\n @db.execute(\n \"UPDATE #{@dataset} SET \" \\\n \"state = '#{vm[:state]}', \" \\\n 'missing = 0, ' \\\n \"timestamp = #{time}, \" \\\n \"uuid = '#{uuid}', \" \\\n \"deploy_id = '#{vm[:deploy_id]}' \"\\\n \"#{filter}\"\n )\n\n if sync_state || vm_db[col_name_to_idx('state')] != vm[:state]\n status_str << vm_to_status(vm)\n end\n end\n\n # ----------------------------------------------------------------------\n # check missing VMs\n # ----------------------------------------------------------------------\n uuids = @db.execute(\"SELECT uuid FROM #{@dataset}\").flatten!\n uuids ||= []\n\n (uuids - monitor_ids).each do |uuid|\n vm_db = @db.execute(\n \"SELECT * FROM #{@dataset} WHERE uuid = '#{uuid}'\"\n ).first\n\n next if vm_db.nil?\n\n miss = vm_db[col_name_to_idx('missing')]\n\n if miss >= @conf[:times_missing]\n status_str << vm_db_to_status(vm_db, @conf[:missing_state])\n\n @db.execute(\"DELETE FROM #{@dataset} WHERE uuid = \\\"#{uuid}\\\"\")\n else\n status_str << vm_db_to_status(vm_db) if sync_state\n \n @db.execute(\n \"UPDATE #{@dataset} SET \" \\\n \"timestamp = #{time}, \" \\\n \"missing = #{miss + 1} \" \\\n \"WHERE uuid = '#{uuid}'\"\n )\n end\n end\n\n status_str\n end", "def state_to_c(state)\n case state\n when 'poweredOn'\n VM_STATE[:active]\n when 'suspended'\n VM_STATE[:paused]\n when 'poweredOff'\n VM_STATE[:deleted]\n else\n VM_STATE[:unknown]\n end\n end", "def state_to_c(state)\n case state\n when 'poweredOn'\n VM_STATE[:active]\n when 'suspended'\n VM_STATE[:paused]\n when 'poweredOff'\n VM_STATE[:deleted]\n else\n VM_STATE[:unknown]\n end\n end", "def statecolor(state)\n\t\tif state == \"running\"\n\t\t\t\"color: green;\".html_safe\n\t\telsif state == \"poweroff\"\n\t\t\t\"color: gray;\".html_safe\n\t\telse\n\t\t\t\"color: yellow;\".html_safe\n\t\tend\n\tend", "def states\n @states ||= {}\n end", "def state(vm_name)\n `VBoxManage showvminfo #{vm_name}` =~ /^State:\\s+(.*)$/ ? $1 : 'unknown'\n end", "def status\n running? ? :running : :down\n end", "def status(*options)\n # TODO: this is *not* how it's supposed to work. This will only give the\n # status of all *running* instances. There is no way to define what is\n # /supposed/ to be running ATM, though.\n statuses = []\n self.instances.each {|instance| statuses << instance.to_s}\n \n return statuses\n end", "def device_states_list\n get \"deviceStates\"\n end", "def status_final_state\n return unless status_changed?\n return unless %w(denied missed returned archived).include?(status_was)\n errors.add(:base, \"Cannot change status of #{status_was}\"\\\n \" reservation.\\n\")\n end", "def vm_state(state)\n STATE_MAP[state] || 'UNKNOWN'\n end", "def states\n [\n ['0', 'TEST_ACTION_LOADED', 'Test state been loaded into DB']\n ]\n end", "def states\n raise \"You must override the states method.\"\n end", "def statuses\n statuses = {\n \"Not started\" => 1,\n \"In Progress\" => 2,\n \"Finished\" => 3\n }\n return statuses\n end", "def set_state(state)\n stop if state == :error and [:initializing, :ready, :running_sm].include? resource_status\n record.set_state(state)\n end", "def states\n [\n ['0', 'HOSTS_LOADED', 'Hosts table has been populated with host data']\n ]\n end", "def state=(state)\n validator = EnumAttributeValidator.new('String', [\"ACTIVE\", \"SUSPENDED\", \"TERMINATED\", \"UNSUPPORTED\", \"UNACTIVATED\"])\n unless validator.valid?(state)\n fail ArgumentError, \"invalid value for \\\"state\\\", must be one of #{validator.allowable_values}.\"\n end\n @state = state\n end", "def status\n s = {}\n # any node that's error or unknown will cause the whole state to be in the other state \n my_nodes.each { |n| s[n.id] = n.status unless n.state == 0 }\n return s\n end", "def description\n case @status\n when \"running\"\n \"#{@number}: INSTANCE: #{name} - #{@ip} - #{@instance_id} - #{@launching_time}\"\n when \"shutting-down\"\n \"(terminating) INSTANCE: #{name} - #{@ip} - #{@instance_id} - #{@launching_time}\"\n when \"pending\"\n \"(booting) INSTANCE: #{name} - #{@ip} - #{@instance_id} - #{@launching_time}\"\n end\n end", "def state\n if completed?\n :complete\n elsif started\n :in_progress\n else\n :not_started\n end\n end", "def valid_states\n aasm.states.map(&:name).map(&:to_s)\n end", "def status(*status)\n @states = status\n self\n end", "def wait_for_state(states, timeout = default_timeout)\n states = [states] unless states.is_a?(Array)\n log_debug \"[ #{@node}/#{@environment} ] - Wait for instance to be in state #{states.join(', ')} (timeout #{timeout})...\"\n current_state = nil\n remaining_timeout = timeout\n until states.include?(current_state)\n start_time = Time.now\n current_state = state\n sleep 1 unless states.include?(current_state)\n remaining_timeout -= Time.now - start_time\n break if remaining_timeout <= 0\n end\n log_debug \"[ #{@node}/#{@environment} ] - Instance is in state #{current_state}\"\n states.include?(current_state)\n end", "def wait(*desired_states)\n Timeout.timeout(60) do\n loop do\n states = self.service_states\n break if desired_states.include?(states[:current]) && states[:next].nil?\n Kernel.sleep(1)\n end\n end\n rescue Timeout::Error\n raise Puppet::Error.new(\"Timed out waiting for #{@resource[:name]} to transition states\")\n end", "def exit_state\n end", "def status\n short_state_str=SHORT_VM_STATES[state_str]\n\n if short_state_str=='actv'\n short_state_str=SHORT_LCM_STATES[lcm_state_str]\n end\n\n short_state_str\n end", "def status\n short_state_str=SHORT_VM_STATES[state_str]\n\n if short_state_str==\"actv\"\n short_state_str=SHORT_LCM_STATES[lcm_state_str]\n end\n\n short_state_str\n end", "def set_status\n @kill = '' #kill response will eventually tell node to kill it's ruby process \n h = JSON.parse(params[:message])\n EventLog.info \"Setting state for instance #{h['instance_id']}\" \n @instance = Instance.find_by_instance_id(h['instance_id'])\n unless @instance.nil? then\n \n @instance.state = h['state'] if h['state']\n @instance.ruby_cpu_usage = h['ruby_cpu_usage'].to_f if h['ruby_cpu_usage']\n @instance.system_cpu_usage = h['system_cpu_usage'].to_f if h['system_cpu_usage']\n @instance.ruby_mem_usage = h['ruby_mem_usage'] if h['ruby_mem_usage']\n @instance.system_mem_usage = h['system_mem_usage'] if h['system_mem_usage']\n @instance.top_pid = h['top_pid'] if h['top_pid']\n @instance.ruby_pid_status = h['ruby_pid_status'] if h['ruby_pid_status']\n @instance.state_changed_at = DateTime.parse(h['timestamp']) if h['timestamp']\n @instance.executable = h['executable'] if h['executable']\n @instance.ruby_pid = h['ruby_pid'] if h['ruby_pid']\n @instance.child_procs = h['child_procs'] if h['child_procs']\n \n @instance.status_updated_at = DateTime.now\n \n #reset cycle count if idle:\n @instance.ruby_cycle_count = 0 if h['state'] && h['state'].eql?('idle')\n \n @instance.save\n \n #now check for error state\n \n if @instance.state.eql?('error')\n logger.error \"Instance #{@instance.instance_id} reported following error: #{h['error_message']}\"\n EventLog.error \"Instance #{@instance.instance_id} reported following error: #{h['error_message']}\"\n # EventLog.info \"Shutting down instance #{@instance.farm.ami_id} -- #{@instance.instance_id} because of error...\" unless @instance.farm.farm_type.eql?('admin')\n # @instance.terminate unless @instance.farm.farm_type.eql?('admin')\n else\n \n #but now we decide if the process needs to be killed because of process timeout\n if h['timeout']\n d = DateTime.parse(h['timestamp'])\n t = (Time.now - (h['timeout'].to_i * 60))\n \n if ((t <=> d) > 0) && @instance.state.eql?('busy') then\n \n #shut her down!\n logger.info \"Shutting down instance #{@instance.farm.ami_id} -- #{@instance.instance_id} because it was busy for too long.\"\n EventLog.info \"Shutting down instance #{@instance.farm.ami_id} -- #{@instance.instance_id} because it was busy for too long.\"\n @instance.terminate\n @instance.save\n \n \n # first we check cycle counts. if ruby_cycle_count < max then cycle ruby.\n \n # if @instance.ruby_cycle_count < RUBY_CYCLE_MAX\n # cycle ruby\n # @kill = 'KILL' \n # logger.info \"Sending KILL notice for: Instance: #{h['instance_id']} PID: #{h['ruby_pid']}\"\n # EventLog.info \"Sending KILL notice for: Instance: #{h['instance_id']} PID: #{h['ruby_pid']}\"\n # @instance.ruby_cycle_count += 1\n # @instance.save\n \n #else\n # recycle instance entirely, unless maxed out\n # if @instance.cycle_count < NODE_CYCLE_MAX\n # logger.info \"Recycling instance #{@instance.farm.ami_id} -- #{@instance.instance_id}...\"\n # EventLog.info \"Recycling instance #{@instance.farm.ami_id} -- #{@instance.instance_id}...\"\n # @instance.send_later( :recycle )\n # else\n # logger.info \"Shutting down instance #{@instance.farm.ami_id} -- #{@instance.instance_id} because it was unresponsive and exceeded max recycle tries.\"\n # EventLog.info \"Shutting down instance #{@instance.farm.ami_id} -- #{@instance.instance_id} because it was unresponsive and exceeded max recycle tries.\"\n # @instance.terminate\n # @instance.save\n # end\n \n \n # end\n \n end\n \n \n end\n \n end\n \n end\n \n render :layout=>false\n end", "def state\n s = self[:saved_state].to_sym\n if s == :running\n stop ? :cancelling : :running\n else\n s\n end\n end", "def state=(state)\n validator = EnumAttributeValidator.new('String', ['WAITING', 'RUNNING', 'FINISHED'])\n unless validator.valid?(state)\n fail ArgumentError, 'invalid value for \"state\", must be one of #{validator.allowable_values}.'\n end\n @state = state\n end", "def state_str\n HOST_STATES[state]\n end", "def instances_for_filter(filter_name, filter_value, state = \"running\")\n ec2.describe_instances(\n filters: [\n { name: filter_name, values: [filter_value] },\n { name: \"tag:environment\", values: [name] },\n { name: \"instance-state-name\", values: [state] }\n ])[:reservations]\n end", "def ec2_instance_ready?(instance)\n instance.exists? && instance.status.eql?(:running) && systems_ok(instance)\n end", "def determine_state(order)\n return 'pending' if self.inventory_units.any? { |unit| unit.backordered? }\n return 'shipped' if state == 'shipped'\n return 'delivered' if state == 'delivered'\n # Original, that resulted in emails being delivered several times:\n # order.payment_state == 'balance_due' ? 'pending' : 'ready'\n # Updated version that should prevent that from happening:\n order.payment_state == 'balance_due' ? 'pending' : 'ready'\n \n end", "def state(*args)\n result = self.info(\"--state\", *args).collect{ |str| str.scan(REGEX_STATE) }\n result.flatten!.compact!\n\n result.first.strip.downcase.to_sym\n end", "def state\n end", "def status(state, body = nil)\n raise Halcyon::Exceptions.const_get(state.to_s.camel_case.to_sym).new(body)\n rescue NameError => e\n self.logger.error \"Invalid status #{state.inspect} specified.\"\n self.logger.error \"Backtrace:\\n\" << e.backtrace.join(\"\\n\\t\")\n raise Halcyon::Exceptions::ServiceUnavailable.new\n end", "def states(*args, &block)\n args.each do |arg|\n [arg].flatten.each do |name|\n state name, &block\n end\n end\n end", "def read_state\n output = execute(\"showvminfo\", @uuid, \"--machinereadable\")\n if output =~ /^name=\"<inaccessible>\"$/\n return :inaccessible\n elsif output =~ /^VMState=\"(.+?)\"$/\n return $1.to_sym\n end\n\n nil\n end", "def failed_states\n old_states = @states\n @states = {}\n\n new_states = Admiral.etcd.get(STATE_KEY).children\n new_states.each do |service_state|\n service_key = service_state.key.split('/').last\n service_data = JSON.parse(service_state.value)\n was_ok = old_states[service_key]['subState'] != 'failed' rescue true\n is_failed = service_data['subState'] == 'failed'\n\n yield service_key, service_data if was_ok && is_failed\n\n @states[service_key] = service_data \n end\n end", "def state_color\n case state\n when 'rejected'\n \"red\"\n when 'approved'\n \"green\"\n when 'new'\n \"orange\"\n end\n end", "def current_state(states)\n active_states = states.select { |_, v| v['status'] == 'active' }.keys\n states_depth = active_states.map { |state| state.split('/').length }\n active_states[states_depth.index(states_depth.max)]\n end", "def current_state\n\t # Started and not finished\n\t if running? \n\t\tif respond_to?(\"state_machine\")\n # state_machine.status # => String\n # state_machine.status_name # => Symbol\n\t\t return state_machine.status_name\n\t\telse\n\t\t return :running\n\t\tend\n\t end\n\t\n\t # True, when task has never been started\n\t if pending? \n\t\treturn :pending \n elsif failed_to_start? \n\t\treturn :failed_to_start\n elsif starting?\n\t return :starting\n\t # True, when terminal event is pending\n elsif finishing? \n\t return :finishing\n\t # Terminated with success or failure\n elsif success? \n\t return :succeeded\n elsif failed? \n\t return :failed \n\t end\n\tend", "def state()\n info[:state]\n end", "def Main()\r\n puts \"thanks for turning me on\"\r\n ec2 = SetupEC2Instance()\r\n data = GetInstanceInfo(ec2)\r\n #data = \"data_not_accurate\"\r\n ChangeEC2State(data, ec2)\r\n puts \"i hope you are satisfied\"\r\nend", "def state_names\n @names = Set.new\n @names.merge machine.states\n @names.merge [ANY_STATE, ANY_STATE_HOOK]\n end", "def state_list(states)\n ul(states.map { |s| state_short s })\n end" ]
[ "0.7332059", "0.67412794", "0.64987713", "0.6453575", "0.6450251", "0.6374322", "0.6136548", "0.60620064", "0.60194343", "0.6011941", "0.6006354", "0.60026526", "0.59875304", "0.5925065", "0.5924569", "0.5916143", "0.58931345", "0.5889349", "0.584709", "0.58040965", "0.57757294", "0.57502824", "0.5739641", "0.573896", "0.5735823", "0.5735823", "0.5734449", "0.5730451", "0.57257587", "0.57253075", "0.5725189", "0.5710186", "0.57035047", "0.5688742", "0.5688478", "0.5680195", "0.56772125", "0.56772125", "0.56772125", "0.5671753", "0.56709594", "0.5668791", "0.5655743", "0.5642304", "0.5642304", "0.5636695", "0.5628926", "0.561408", "0.5611607", "0.5599653", "0.5599653", "0.5598044", "0.5577226", "0.5575533", "0.556419", "0.55616385", "0.55616385", "0.55564725", "0.5545835", "0.55355763", "0.55329174", "0.55214113", "0.5517961", "0.55177414", "0.55168885", "0.55104464", "0.5504608", "0.54983205", "0.5480743", "0.5479567", "0.54630095", "0.54439044", "0.5438218", "0.5425173", "0.5421015", "0.54118466", "0.5410275", "0.5408792", "0.5406363", "0.5386107", "0.5385365", "0.5383104", "0.53774345", "0.53735596", "0.5372357", "0.5365689", "0.53603613", "0.5355358", "0.53446203", "0.53380185", "0.5336089", "0.5330481", "0.5328856", "0.53288114", "0.5327647", "0.53181124", "0.53138846", "0.53060544", "0.5304523", "0.5299899", "0.52984357" ]
0.0
-1
Downcases Username/Emails Provided by Params to Prevent Repeat Usernames Due to Caps
def username params[:username].downcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def downcase!\n self.username.downcase!\n self.email.downcase!\n end", "def downcase_email_username\n self.email = email.downcase\n self.username = username.downcase\n end", "def format_username\n \t_email_base = self.email[/[^@]+/]\n \tself.username ||= _email_base.camelize.underscore.gsub(/\\./,\"_\") unless _email_base.nil?\n\n end", "def downcase_email\n \t email.downcase!\n \t end", "def downcase_fields\n self.email.downcase!\n end", "def downcase_fields\n self.email.downcase!\n end", "def ensure_username\n return unless username.blank?\n\n self.username = email.gsub(/@.*$/, '')\n end", "def fallback_name\n users_data['email'].split('@').first.parameterize.titleize\n end", "def normalize_fields\n self.email.downcase!\n end", "def downcase_username\n self.username.downcase!\n end", "def downcase_email\n email.downcase!\n end", "def downcase_email\n email.downcase!\n end", "def downcase_email\n email.downcase!\n end", "def downcase_email\n email.downcase!\n end", "def lower_email\n self.email.downcase!\n self.name.downcase!\n end", "def generate_username2 (fir, las)\n\tfir.gsub(/[\\W\\d]/, \"\").downcase[0] + las.gsub(/[\\W\\d]/, \"\").downcase unless\n\tfir === \"\" || las === \"\"\nend", "def downcase_email\n self.email = self.email.delete(' ').downcase\n end", "def downcase_email_and_name\n self.email = email.to_s.downcase\n self.name = name.to_s.downcase\n end", "def downcase_email\n email.downcase if email\n end", "def downcase_username\n self.username = self.username.downcase if self.username?\n end", "def downcase_username\n self.username = username.downcase\n end", "def scrub_email_address\n self.email_address.downcase\n end", "def normalize_fields\n self.email.downcase!\n end", "def normalize_fields\n self.email.downcase!\n end", "def normalize_fields\n self.email.downcase!\n end", "def normalize_fields\n self.email.downcase!\n end", "def normalize_fields\n self.email.downcase!\n end", "def normalize_fields\n self.email.downcase!\n end", "def normalize_user_name\n\t\tself.user_name = user_name.downcase\n\tend", "def create_username() #t\n email_username = self.email.gsub(/(\\A([\\w\\.\\-\\+]+))@((?:[-a-z0-9]+\\.)+[a-z]{2,})\\z/i, \"\\\\1\")\n email_username = email_username.gsub(/\\W/, \"\")\n username_try = email_username\n \n i = 1\n found_unique_username = false\n while(!found_unique_username)\n if User.unique_username?(nil, username_try)\n found_unique_username = true\n else\n username_try = email_username + i.to_s\n end\n i += 1\n end\n \n self.username = username_try\n end", "def normalize_fields\n\t\tself.email.downcase!\n\tend", "def downcase_email\n #self.email = email.downcase\n email.downcase!\n end", "def ensure_username\n if self.username != \"\"\n self.username \n else\n self.username = \"user#{((self.email).hash).to_s[0,6]}\"\n end\n end", "def lowercase_email\n email.downcase! if email.present?\n end", "def username_format\n return if self.username.nil?\n self.username.gsub!(/[^0-9a-z\\- ]/i, '_')\n self.username.gsub!(/\\s+/, '-')\n self.username = self.username.downcase\n self.username = self.username.byteslice(0, 24) #substring 24\n end", "def clean_username(username)\n\n my_username = username\n #remove all non- alphanumeric character (expect dashes '-')\n my_username = my_username.gsub(/[^0-9a-z -]/i, '')\n\n #remplace dashes() for empty space because if the user add dash mean that it want separate the username\n my_username = my_username.gsub(/[-]/i, ' ')\n\n #remplace the empty space for one dash by word\n my_username.downcase!\n my_username.strip!\n username_split = my_username.split(' ').join('-')\n\n end", "def downcase_email\n\t email.downcase!\n\t end", "def downcase_email\n # self.email = email.downcase\n email.downcase!\n end", "def downcase_email\n email.downcase!\n end", "def downcase_email\n email.downcase!\n end", "def downcase_email\n email.downcase!\n end", "def downcase_email\n email.downcase!\n end", "def format_email\n email.downcase!.strip!\n end", "def downcase_email\n return if email.present?\n\n email.downcase\n end", "def downcase_email\n self.email = email.downcase if self.email\n end", "def downcase_email\n self.user_email = user_email.downcase\n end", "def downcase_username()\n self.username = username.downcase\n end", "def downcase_email\n self.email.downcase!\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_username\n return unless username_changed?\n\n self.username = username.downcase\n end", "def downcase_email\n email.downcase!\n end", "def downcase_email\n self.email=email.downcase\n end", "def prepare_email\n self.email = email.downcase.strip if email\n end", "def downcase_email\n email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = self.email.downcase\n end", "def downcase_email\n self.email = self.email.downcase if self.email\n nil\n end", "def downcase_email\r\n self.email = email.downcase\r\n end", "def downcase_email\n unless self.email == nil\n self.email = email.downcase\n end\n end", "def username\n params[:username].downcase\n end", "def downcase_email\n\t\tself.email.downcase!\n\tend", "def set_username\n return if username?\n return unless email?\n\n base = email.partition('@').first.tr('.', '_')\n\n self.username = generate_username(base)\n end", "def prepare_params\n self.email = self.email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def normalize\n @normalized_email = email.downcase\n normalized_email\n end", "def uniquify\n email = email_address ||= self.login_name || return\n self.login_name = self.email_address = uniquify_value(email[/[^@]+/]) + '@test.com'\n end", "def downcase_email\n\t\t\t# self.email = email.downcase\n\t\t\temail.downcase!\n\t\tend", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email.downcase!\n end", "def downcase_email\n self.email.downcase!\n end", "def downcase_email\n self.email.downcase!\n end", "def sanitize_user\r\n self.first_name = Sanitize.clean(self.first_name).gsub('&amp;','&').gsub('&gt;', '>') unless self.first_name.blank?\r\n end", "def username(fname, lname)\n [fname, lname].join('.').downcase\n end", "def username \n #The code below will return the users email however, the split will seperate the email based on the parameters entered into the brackets. The code below will split the email at the @ symbol, resulting in the email changing from example@example.com to example @ example.com. The [0] after the brackets is used to determine the index value of the email that should be displayed. When the email is split each section is provided with an index value, starting at 0. The first part of the email (example) will be given the index of 0. This will result in the code displaying example. The capitalize at the end of the statement is used to caplitalise the first letter of the email address.\n return self.email.split('@')[0].capitalize\n end", "def normalize_email_address email_address\n email_address.downcase.sub(/swan\\.ac\\.uk/,'swansea.ac.uk')\nend", "def format_name(first, last)\n return nil if first.empty? || last.empty?\n f = first.delete(\" \")\n l = last.delete(\" \")\n username = f[0]\n username << l\n user = username.downcase\n user.gsub(/[\\W]/, '') # this is meant to remove special characters, but it doesn't work!\nend", "def username=(value)\n if value\n value.downcase!\n value.squish!\n end\n super(value)\n end" ]
[ "0.72925663", "0.7233208", "0.71101785", "0.70375264", "0.7037082", "0.7037082", "0.6908436", "0.69041234", "0.68614", "0.67897636", "0.67662686", "0.67662686", "0.67662686", "0.67662686", "0.67568505", "0.67487293", "0.6746017", "0.6741996", "0.67381763", "0.6730172", "0.6726617", "0.67250824", "0.6716979", "0.6716979", "0.6716979", "0.6716979", "0.6716979", "0.6716979", "0.6712205", "0.66998607", "0.6695453", "0.6686103", "0.66774446", "0.66261756", "0.66140497", "0.66074497", "0.6599149", "0.65960443", "0.6569639", "0.6569639", "0.6569639", "0.6569639", "0.655479", "0.6551687", "0.6550765", "0.65422523", "0.65413916", "0.65398496", "0.6510698", "0.6509718", "0.64959323", "0.6480676", "0.6448737", "0.6439875", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64284223", "0.64087176", "0.64067966", "0.63927996", "0.638047", "0.63789797", "0.6371558", "0.636235", "0.6338616", "0.6332917", "0.6332917", "0.6332917", "0.6332917", "0.63305557", "0.6329473", "0.6328054", "0.6320369", "0.62987393", "0.62987393", "0.62987393", "0.62976384", "0.6270052", "0.62552077", "0.62546504", "0.62542945", "0.62528795" ]
0.66892046
31
For Displaying all The Shop Profiles
def index @shops = current_user.shop_profiles end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @shop_profiles = ShopProfile.all\n end", "def index\n @professional_profiles = ProfessionalProfile.all\n end", "def index\n @promotions = current_shop_owner.promotions.all\n end", "def index\n @proccs = Procc.all\n end", "def index\n @profanes = Profane.all\n end", "def show\n\t\t@shop_profile = ShopProfile.find(params[:id])\n\t\t@items = @shop_profile.shop_products.where(shop_profile_id: @shop_profile.id)\n\t\t.paginate(page: params[:page], per_page: 6).search(params[:search])\n\t\tif !params[:category_id].nil?\n\t\t\t@items = @shop_profile.shop_products.where(category_id: params[:category_id])\n\t\t\t.paginate(page: params[:page], per_page: 6)\n\t\tend\n\tend", "def index\n @general_profiles = GeneralProfile.all\n end", "def index\n @gear_profiles = GearProfile.all\n end", "def index\n @progs = Prog.all\n end", "def index\n @produits = Produit.all\n end", "def index\n @profils = Profil.all\n end", "def index\r\n @profesores = Profesore.all\r\n end", "def fetch_profiles\n UI.message \"Fetching profiles...#{Sigh.config[:app_identifier]}\"\n results = profile_type.find_by_bundle_id(Sigh.config[:app_identifier])\n\n #Take the provisioning profile name into account\n #if Sigh.config[:provisioning_name].to_s.length > 0\n #filtered = results.select { |p| p.name.strip == Sigh.config[:provisioning_name].strip }\n #if Sigh.config[:ignore_profiles_with_different_name]\n #results = filtered\n #else\n #results = filtered if (filtered || []).count > 0\n #end\n #end\n\n if results \n return [results]\n else\n return []\n end\n \n\n\n #return results if Sigh.config[:skip_certificate_verification]\n\n #return results.find_all do |a|\n ## Also make sure we have the certificate installed on the local machine\n #installed = false\n #a.certificates.each do |cert|\n #file = Tempfile.new('cert')\n #file.write(cert.download_raw)\n #file.close\n #installed = true if FastlaneCore::CertChecker.installed?(file.path)\n #end\n #installed\n #end\n end", "def index\n @propperties = Propperty.all\n end", "def index\n @pro_entries = ProEntry.all\n end", "def index\n @provincials = Provincial.all\n end", "def index\n @user_profs = UserProf.all\n end", "def profile_setting_list\n\t\t# find the home address\n\t\t@home_addresses = @profile_setting.addresses.where(address_type: \"home\")\n\tend", "def index\n @profiles = current_user.profiles\n end", "def index\n @profiles = current_user.profiles\n end", "def index\n @profilsekolahs = Profilsekolah.all\n end", "def index\n @shopper_accounts = ShopperAccount.all\n end", "def index\n @professional_infos = ProfessionalInfo.all\n end", "def index\n @probandos = Probando.all\n end", "def index\n @proyectominero2s = Proyectominero2.all\n end", "def index\n @admin_profiles = Admin::Profile.all\n end", "def index\n @project_profiles = ProjectProfile.all\n end", "def index\n @cpanel_promotions = Cpanel::Promotion.all\n end", "def index\n @prospies = Prospie.all\n end", "def show\n\t\t\n\t\t#Show total items and prices\n\t\tputs \"\\nShopping list: \"\n @list_products.each {|key, val| print val, \" \", key, \" \",productsMarket[key], \"$\\n\"} \n\tend", "def index\n @provincia = Provincium.all\n end", "def show\n @service_prov_types = ServiceProvType.all.paginate(:page => params[:page], :per_page => 5).order('id desc')\n end", "def index\n @proverbes = Proverbe.all\n end", "def index\n @provins = Provin.all\n end", "def index\n @prod_cotis = ProdCoti.all\n end", "def index\n @profesia = Profesium.all\n end", "def profiles; end", "def index\n @prod_categories = ProdCategory.all\n end", "def index\n @product_option_typeships = ProductOptionTypeship.all\n end", "def index\r\n @profiles = Profile.all\r\n end", "def index\r\n @profiles = Profile.all\r\n end", "def show\n @profiles_all = current_user.profiles.order('lastname ASC')\n if current_user.business\n @business = current_user.business.name\n end\n @profile = current_user.profiles.find(params[:id])\n @profile_tickets = Ticket.where(:user => @user).order('date_opened DESC')\n .paginate(page: params[:page])\n @profile_assets = Asset.where(:owner => @user).order('serial ASC')\n .paginate(page: params[:page])\n end", "def index\n @partner_profiles = PartnerProfile.all\n end", "def show\n @categories = []\n if usr_contact_signed_in?\n @current_merchant = UsrContactVendor.find_by_usr_contact_id(current_usr_contact.id)\n else\n @current_merchant = FALSE\n end\n\n @vendor = UsrVendorProperty.find(params[:id])\n @items = @vendor.prd_items\n if !@items.empty?\n @items.each do |item|\n type_id = item.prd_type_id\n unless type_id.empty?\n sub_category_id = PrdType.find(type_id).prd_sub_category_id\n category_id = PrdSubCategory.find( sub_category_id).prd_categories_id\n @categories << PrdCategory.find(category_id).name\n end\n end\n end\n\n end", "def products_list\n @products = Haiwet::Product.list\n @products.each.with_index(1) do |prod, i|\n puts \"#{i}- #{prod.name}\"\n end\n end", "def index\n @profile_items = current_user.profile_items\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def profiles\n Management::Profile.all(self)\n end", "def show\n @procedures = @property.procedures\n end", "def index\n @usr_buyer_properties = UsrBuyerProperty.all\n end", "def index\n @profile_general_details = ProfileGeneralDetail.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @produtors = Produtor.all\n end", "def listProducts\n @@products.each_with_index { |p, i|\n puts \"#{i + 1}. #{p.name}\"\n }\n end", "def index\n @profiles = Profile.all\n\n end", "def show\n @profiles = @grab.profiles\n end", "def index\n @prosumer_categories = ProsumerCategory.all\n end", "def show\n @cart = current_user.cart\n @all_items = @cart.items\n end", "def product_list\n current_user.products.order('name').collect {|p| [ p.name, p.ticket_project_id, p.id ]}\n end", "def show\n #binding pry\n @shopping_carts = ShoppingCart.find(params[:id])\n \n end", "def index \n @profiles = Profile.all\n end", "def show_user_profile\n\t\t# find the home address\n\t\t@home_addresses = @profile_setting.addresses.where(address_type: \"home\")\n\tend", "def index\n @prod_almas = ProdAlma.all\n end", "def index\n @type_produits = TypeProduit.all\n end", "def show\n\t\t# @procategories = active_procategories_follow_ddc_level(@procategory.level)\n\t\t# @procategories = paginate(@procategory.cousin)\n @procategories = @procategory.cousin\n end", "def shop_products\n products.shop_products\n end", "def index\n @propriedades = Propriedade.all\n end", "def index\n @product_skus = ProductSku.all\n end", "def index\n @projs = Proj.all\n end", "def index\n @professionals = Professional.all\n end", "def index\n @unterprodukts = Unterprodukt.all\n end", "def index\n @proyects = Proyect.all\n end", "def index\n @proyects = Proyect.all\n end", "def display_products\n\n puts \"Welcome to our store! We have following products in our store:\"\n @products.each do |product|\n puts \"Reference Number: #{product[:reference_number]}, Product: #{product[:name]}, Price: #{product[:price]}\"\n end\nend", "def index\n @client_profiles = ClientProfile.all\n end", "def index\n @talent_profiles = TalentProfile.all\n end", "def profiles\n ####\n #puts self.to_xml\n #puts self.to_xml\n @profs ||= long_function\n return @profs\n end", "def show\n\t\t@cart = current_cart\n\t\t\n\t\t# para mostrar a listagem de produtos na barra lateral (partial)\n\t\t@products = Product.all\n\tend", "def show_the_cart\n @cart_items = Nacho.find(cart)\n end", "def index\n @prod_subtypes = ProdSubtype.all\n end", "def index\n \t_projects = Property.show_all_visible\n \tproj = _projects.collect{|p| p.name }.join(', ')\n \t\n \t@page_title = \"CebuCondoListings | Cebu Condominium Listings - #{proj}\" \n if logged_in?\n @properties = Property.show_all\n else\n @properties = Property.show_all_visible \n end\n end", "def index\n @userprofiles = Userprofile.all\n end", "def index\n @proyectos_users = ProyectosUser.all\n end", "def show\r\n # @provider_masters = ProvierMaster.all\r\n end", "def print_cart\n\t\tputs \"----- #{@user}'s Shopping Cart -----\"\n\t\tif @cart.length > 0\n\t\t\t@cart.each do |item|\n\t\t\t\tputs \"> #{item}\"\n\t\t\tend\n\t\telse\n\t\t\tputs \"Your shopping list is empty.\"\n\t\tend\n\t\tputs \"--------------------------------\"\n\tend" ]
[ "0.70421696", "0.65438896", "0.643277", "0.6274076", "0.6222612", "0.6157539", "0.61419964", "0.6141957", "0.6112224", "0.6061302", "0.6055706", "0.60032475", "0.59595627", "0.5955043", "0.5943252", "0.59336287", "0.5824984", "0.5816122", "0.57842875", "0.57842875", "0.57777756", "0.57753986", "0.5768495", "0.5767711", "0.5742787", "0.5741973", "0.5733917", "0.5733795", "0.57308763", "0.5713939", "0.5710827", "0.57094073", "0.57070357", "0.56887466", "0.5686125", "0.56475073", "0.56451374", "0.56086624", "0.5599264", "0.55969214", "0.55969214", "0.5588897", "0.55871356", "0.55833393", "0.55802274", "0.5577883", "0.55765516", "0.55765516", "0.55765516", "0.55765516", "0.55765516", "0.55765516", "0.55765516", "0.55765516", "0.55765516", "0.55765516", "0.55765516", "0.55765516", "0.55765516", "0.55765516", "0.55765516", "0.55765516", "0.5571269", "0.55705976", "0.5568817", "0.5565868", "0.55646956", "0.55549467", "0.5550245", "0.554954", "0.55463856", "0.55380255", "0.55342925", "0.55327547", "0.5530188", "0.55220866", "0.55184823", "0.5515226", "0.5507391", "0.5502443", "0.549444", "0.5485196", "0.5484227", "0.54835093", "0.54820555", "0.5478853", "0.54758537", "0.54758537", "0.54716474", "0.54706234", "0.5469244", "0.5469092", "0.54626286", "0.54613924", "0.5460513", "0.545057", "0.5449079", "0.54488623", "0.54468954", "0.54458046" ]
0.69859815
1
For Displaying all the Shop Products for a particular Shop Profile
def show @shop_profile = ShopProfile.find(params[:id]) @items = @shop_profile.shop_products.where(shop_profile_id: @shop_profile.id) .paginate(page: params[:page], per_page: 6).search(params[:search]) if !params[:category_id].nil? @items = @shop_profile.shop_products.where(category_id: params[:category_id]) .paginate(page: params[:page], per_page: 6) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @shop_profiles = ShopProfile.all\n end", "def index\n\t\t@shops = current_user.shop_profiles\n\tend", "def shop_products\n products.shop_products\n end", "def index\n @products = current_user.products.all\n end", "def index\n @products = current_user.products\n end", "def index\n Shop.set_store_session\n @products = ShopifyAPI::Product.all\n end", "def products_list\n\t\t@view.products_list\n\t\tproducts = @store.products\n\t\tproducts.each do |product|\n\t\t\tputs \"Name: #{product.name} ---> Price: #{product.price}\"\n\t\tend\n\t\t@view.second_view(@current_user, @current_user.actions)\n\tend", "def show\n @product_images = @product.product_images.all\n @product_colors = @product.colorProducts\n @product_sizes = @product.sizeProducts\n end", "def index\n @professional_profiles = ProfessionalProfile.all\n end", "def index\n @products = current_seller.product.all\n end", "def set_shop_profile\n @shop_profile = ShopProfile.find(params[:id])\n end", "def index\n @products = @co.products\n end", "def index\n @so_products = SoProduct.all\n end", "def public_productable\n @productable = model_name.find(params[:profile_id])\n end", "def index\n @product_skus = ProductSku.all\n end", "def show\n @products = Product.search(params).paginate(:page => params[:page], :per_page => 10)\n end", "def show\n\t\t@cart = current_cart\n\t\t\n\t\t# para mostrar a listagem de produtos na barra lateral (partial)\n\t\t@products = Product.all\n\tend", "def show\n @user = User.find(params[:user_id])\n @shop = Shop.find(params[:id])\n redirect_to user_shop_products_path(:user_id => @user, :shop_id => @shop)\n end", "def show\n @products = @vendor.products\n end", "def index\n @promotions = current_shop_owner.promotions.all\n end", "def show\n @product = Product.find(params[:id])\n @photos = @product.photos\n\t@related_products = Product.where(\"category_id = ? and manufacturer_id = ? and id <> ?\", @product.category, @product.manufacturer,@product.id ).limit(6)\n @reviews = @product.reviews.paginate(:page => params[:page], :per_page => 10)\n @manufacturer_products = @product.manufacturer.products.where(\"id <> ?\",@product.id).limit(5) unless @product.manufacturer.nil?\n if (current_user != nil)\n @cart = User.find(session[:user_id]).cart\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n # friendly id\n @shop = Shop.friendly.find(params[:id])\n\n # sort products\n @shopProducts = Product.where(shop_id: @shop.id)\n if params[:filter].present?\n if params[:filter] == 'name'\n @shopProducts = @shopProducts.order('name ASC')\n elsif params[:filter] == 'date'\n @shopProducts = @shopProducts.order('updated_at DESC')\n elsif params[:filter] == 'price'\n @shopProducts = @shopProducts.order('price DESC')\n elsif params[:filter] == 'priceA'\n @shopProducts = @shopProducts.order('price ASC')\n end\n else\n @shopProducts = @shopProducts.order('updated_at DESC')\n end\n\n @shopProducts = @shopProducts.page(params[:page]).per(15)\n\n # create View\n if current_user\n @view = View.find_or_initialize_by(\n shop_id: @shop.id,\n user_id: current_user.id\n )\n @view.updated_at = Time.now\n @view.save\n end\n\n end", "def show\n session[:user_settings] ||= Hash.new()\n @user_settings = session[:user_settings]\n\n @shop_section = ShopSection.find_by_short_url(\"brands\")\n\n @user_settings.delete(\"shop_section\")\n\n @brand = Brand.find(params[:id])\n @user_settings[\"brand\"] = @brand.id\n\n @section = :brands\n\n condition = \"products.brand_id = #{@brand.id}\"\n\n unless @user_settings[\"sex\"].nil?\n condition += \" and products.sex_id = #{@user_settings[\"sex\"]}\"\n end\n\n unless @user_settings[\"career\"].nil?\n condition += \" and products.career_id = #{@user_settings[\"career\"]}\"\n end\n\n @page = (params[:page] || 1).to_i\n\n @products = Product.where(condition).valid_products.order(\"products.updated_at DESC\").paginate(:page => @page)\n @more_products = Product.where(condition).valid_products.all.size() - Product.per_page * @page\n @more_products = nil if @more_products <= 0\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brand }\n end\n end", "def index\n if current_user.stripe_account_id.blank? && !current_user.merchant_rep?\n redirect_to admin_stripe_accounts_new_stripe_account_path\n else\n\n # Retrieve the root categories to display in the caterogy filter dropdown\n @all_categories = Category.order(:name)\n\n # Check to see if a user has selected a specific view type\n if params[:product_admin_view]\n # A view was selected, set it in the session\n session[:product_admin_view] = params[:product_admin_view]\n else\n session[:product_admin_view] = 'detailed'\n end\n\n # check to see if rep has selected a merchant\n if params[:merchant_selected]\n # A merchant was selected, set it in the session\n session[:merchant_selected] = params[:merchant_selected]\n end\n\n # Check the session to see if a view type was selected, if not, load the detailed view by default\n if session[:product_admin_view]\n # A session value exists, load the correct view\n if session[:product_admin_view] == \"list\"\n @page_view = 'list'\n # Retrieve all of the producs that belong to the current user\n # filter products for rep based on merchant selected\n if !session[:merchant_selected].blank? && current_user.merchant_rep?\n user = User.find(session[:merchant_selected])\n @merchant_name = user.merchant_name\n @products = user.products.order(\"updated_at DESC\")\n else\n @merchant_name = current_user.merchant_name\n @products = current_user.products.order(\"updated_at DESC\")\n end\n\n # Check to see if we have a query parameter. This is used for the product search bar\n if params[:query]\n @products = @products.search(params[:query])\n end\n\n # Check to see if we have a category id. This is used for the category dropdown filter\n if params[:category_id]\n @products = @products.category_specific(Category.find(params[:category_id]).descendents)\n end\n\n else\n @page_view = 'detailed'\n\n # Retrieve all of the producs that belong to the current user\n # filter products for rep based on merchant selected\n if !session[:merchant_selected].blank? && current_user.merchant_rep?\n # find user with param passed in\n user = User.find(session[:merchant_selected])\n #set the merchants name\n @merchant_name = user.merchant_name\n # paginate the products for detailed view\n @products = user.products.order(\"updated_at DESC\").paginate(:page => params[:page],:per_page => 5)\n else\n # if rep hasn't selected a merchant, display the rep's name\n @merchant_name = current_user.merchant_name\n # if rep hasn't selected a merchant, display the rep's products\n @products = current_user.products.order(\"updated_at DESC\").paginate(:page => params[:page],:per_page => 5)\n end\n\n # Check to see if we have a category id. This is used for the category dropdown filter\n if params[:category_id]\n @products = @products.category_specific(Category.find(params[:category_id]).descendents)\n end\n\n # Check to see if we have a query parameter. This is used for the product search bar on list view\n if params[:query]\n @products = @products.search(params[:query])\n end\n\n end\n else\n # A session value does not exist, load the default detailed view\n @page_view = 'list'\n\n # filter products for rep based on merchant selected\n if !session[:merchant_selected].blank? && current_user.merchant_rep?\n # select the user based on rep's selection\n user = User.find(session[:merchant_selected])\n # set the merchant name selected by the rep\n @merchant_name = user.merchant_name\n # list the products belonging to the selected merchant in list form\n @products = user.products.order(\"updated_at DESC\")\n else\n # set merchant name to current user's name\n @merchant_name = current_user.merchant_name\n # list all the products for the current user, merchant or rep\n @products = current_user.products.order(\"updated_at DESC\")\n end\n\n # Check to see if we have a query parameter. This is used for the product search bar\n if params[:query]\n @products = @products.search(params[:query])\n end\n\n # Check to see if we have a category id. This is used for the category dropdown filter\n if params[:category_id]\n @products = @products.category_specific(Category.find(params[:category_id]).descendents)\n end\n\n end\n end\n end", "def shoes\n\t@user=User.find(session[:id])\n\t@products=Product.all\nend", "def products(opts= {})\n current_limit = limit = opts[:limit] || 5\n products = []\n\n @profiles.each do |profile|\n products += filtered_list_for_profile(profile, opts).first(current_limit)\n current_limit = limit - products.size\n break if products.size == limit\n end\n products.uniq\n end", "def show\n @products = Product.where({contry_id: params[:id]}).paginate(page: params[:page], per_page: 30)\n\n end", "def index\n @products = Product.find_products_for_sale\n end", "def index\n @products = @site.products.all\n end", "def show\n @user = User.find(@shop.user_id)\n @shed = Shed.find(@shop.shed_id)\n @category = Category.find(@shop.category_id)\n end", "def index\n @member = Member.find(params[:member_id])\n @products = @member.products\n end", "def index\n @store_products = StoreProduct.all\n end", "def index\n @subproducts = Subproduct.all(:include => [:product_subproducts => :product]).paginate :page => params[:page], :per_page => 20\n end", "def index\n @products = Product.where(:store_id => current_merchant.store_name)\n end", "def show\n redirect_to edit_profile_url if @profile.nil?\n\n @no_trade_owned_products = @profile.user.listings.where(category_id: 'products', status: 'owned', item_type: 'no-trade')\n @no_trade_owned_skills = @profile.user.listings.where(category_id: 'skills', status: 'owned', item_type: 'no-trade')\n @trade_owned_products_or_skills = @profile.user.listings.where(category_id: ['skills', 'products'], status: 'owned', item_type: 'trade')\n @trade_wanted_skills = @profile.user.listings.where(category_id: 'skills', status: 'wanted')\n @trade_wanted_products = @profile.user.listings.where(category_id: 'products', status: 'wanted')\n\n end", "def products\n run(:get,\"/school_products\", [200])\n end", "def index\n @info_products = InfoProduct.all\n end", "def index\n \n if params[:comapny_id].present? \n @products = @user.products.paginate(:page => params[:page], :per_page => 10)\n else\n @products = current_user.products.paginate(:page => params[:page], :per_page => 10) \n end\n \n \n end", "def index\n @shops = if params[:user_id] || user_signed_in?\n Shop.where(user_id: params[:user_id] || current_user.id).page(params[:page])\n else\n Shop.all.page(params[:page])\n end\n end", "def show\n @products = @category.products\n end", "def show\n @products = Product.all\n @stores = Store.all\n end", "def index\n \tif current_user.is_provider\n\t\t @products = current_user.provider.products\n else\n @products = Product.all\n end\n if not params[:q].blank?\n @products = @products.old_search(params[:q])\n end\n if not params[:search].blank?\n @products = @products.old_search(params[:search])\n end\n @products = @products.product_type_filter(params[:product_type_filter]).store_front_filter(params[:store_option_type])\n @products = @products.paginate(:page => params[:page], :per_page => 25)\n respond_to do |format|\n if params.key?(:template)\n if params[:template] == 'false'\n format.html { render partial: 'table.html', locals: { products: @products } }\n else\n format.html\n end\n else\n format.html\n end\n format.html\n format.json { render json: @products }\n end\n end", "def show\n #binding pry\n @shopping_carts = ShoppingCart.find(params[:id])\n \n end", "def show\n cat = @producto.categorias.first.id\n @related_products = @producto.get_related_products(cat)\n\n end", "def index\n @products = Product.featured.available.paginate(\n :per_page =>\n (CartConfig.get(:products_per_page, :store) || 15),\n :page => (params[:page] || 1).to_i,\n :readonly => true,\n :order =>'updated_at desc'\n )\n end", "def products\n end", "def index\n @sales_upsale_products = SalesUpsaleProduct.all\n end", "def shop_index\n\t\tauthorize ShopProfile\n\t\trespond_to do |format|\n format.html\n format.json {render json: ShopProfileDatatable.new(view_context)}\n end\n\tend", "def profile\n @shop = Shop.find(1)\n render :template => 'facebook/profile.erb', :layout => false\n return\n end", "def list_fg_products\n\treturn if authorise_for_web('fg_product','read') == false \n\n \tif params[:page]!= nil \n\n \t\tsession[:fg_products_page] = params['page']\n\n\t\t render_list_fg_products\n\n\t\t return \n\telse\n\t\tsession[:fg_products_page] = nil\n\tend\n\n\tlist_query = \"@fg_product_pages = Paginator.new self, FgProduct.count, @@page_size,@current_page\n\t @fg_products = FgProduct.find(:all,\n\t\t\t\t :limit => @fg_product_pages.items_per_page,\n\t\t\t\t :order => 'fg_product_code',\n\t\t\t\t :offset => @fg_product_pages.current.offset)\"\n\tsession[:query] = list_query\n\trender_list_fg_products\nend", "def show\n @tags = @product.product_tags\n @products = @tags.map { |tag| tag.product if tag.product.id == @product.id }.take(4)\n end", "def index\n case @role\n when ADMIN\n \n when COMPANY\n @product_details = current_user.product_details.paginate(:page => params[:page], :per_page => 100)\n\n end\n \n end", "def show\n @product = Product.all\n end", "def show_cart_detail\n @products = Product.find(session[:cart])\n end", "def index\n @sub_products = if current_manager\n SubProduct.where(organization_id: current_manager.organization_id).newest_first.per_page(params[:page])\n else\n SubProduct.newest_first.per_page(:page)\n end\n @sub_products = @sub_products.by_barcode(params[:barcode]) if params[:barcode]\n @sub_products = @sub_products.by_shop(params[:shop_id]) if params[:shop_id]\n end", "def index\n @shopdetails = Shopdetail.all\n end", "def products\n pages = page.children.all(\n :conditions => { :class_name => 'ShopProductPage' },\n :order => 'pages.position ASC'\n ).map(&:shop_product)\n end", "def view_cart\n @products\n end", "def index\n before_filter { |c| c.include_stylesheet 'admin/extensions/shop/products/products' }\n before_filter { |c| c.include_javascript 'admin/pagefactory' }\n @shop_products = ShopProduct.search(params[:query])\n \n unless @shop_products.empty?\n @radiant_layout = Radiant::Config['shop.category_layout']\n\n respond_to do |format|\n format.html { render }\n format.js { render :partial => '/shop/products/products', :collection => @shop_products }\n format.xml { render :xml => @shop_products.to_xml(attr_hash) }\n format.json { render :json => @shop_products.to_json(attr_hash) }\n end\n else\n render :template => 'site/not_found', :status => 404\n end\n end", "def index\n @own_products = OwnProduct.all\n end", "def show\n @shopping_list = ProductShoppingList.where(shopping_list_id: params[:id])\n end", "def goods\n @shop_goods\n end", "def index\n @cart_products = if current_user.cart.present?\n current_user.cart.carts_products.includes(:product).all\n else\n []\n end\n render formats: :json\n end", "def products_list\n @products = Haiwet::Product.list\n @products.each.with_index(1) do |prod, i|\n puts \"#{i}- #{prod.name}\"\n end\n end", "def show\n @profiles_all = current_user.profiles.order('lastname ASC')\n if current_user.business\n @business = current_user.business.name\n end\n @profile = current_user.profiles.find(params[:id])\n @profile_tickets = Ticket.where(:user => @user).order('date_opened DESC')\n .paginate(page: params[:page])\n @profile_assets = Asset.where(:owner => @user).order('serial ASC')\n .paginate(page: params[:page])\n end", "def index\n @sections = Section.all.order(:name)\n @brands = Brand.all.order(:name)\n @products_promo = Product.promotion.paginate(page: params[:page]).order(:title)\n \n @products = Product.order(:title).paginate(page: params[:page])\n \n if params[:tag].present?\n session[:tag_filter] ||= []\n session[:tag_filter] = params[:tag]\n else\n params[:tag] = session[:tag_filter] if session[:tag_filter]\n end\n \n if params[:brand].present?\n session[:brand_filter] ||= []\n session[:brand_filter] = params[:brand]\n else\n params[:brand] = session[:brand_filter] if session[:brand_filter]\n end\n \n if params[:search].present?\n session[:search_filter] ||= []\n session[:search_filter] = params[:search]\n else\n params[:search] = session[:search_filter] if session[:search_filter]\n end\n \n\n \n @products = @products.tagged_with(params[:tag]).paginate(page: params[:page]) if params[:tag].present?\n @products = @products.brandname(params[:brand]).paginate(page: params[:page]) if params[:brand].present?\n @products = @products.search(params[:search]).paginate(page: params[:page]) if params[:search].present?\n \n end", "def index\n @sub_products = SubProduct.all\n end", "def show\n if params[:id]\n @user = User.find(params[:id])\n elsif params[:username]\n @user = User.find_by_username(params[:username])\n end\n @product = @user.products\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end", "def show\n @stores = @biz.stores\n @products = Product.by_biz_id(@biz, params[:page])\n end", "def show\n Recent.append(current_user,@product) if user_signed_in?\n end", "def index\n @cart_products = current_customer.cart_products\n end", "def index\n\t\t@cart_items = current_user.shoppingkarts \n\t\t#Shoppingkart.find(current_user)\n\tend", "def show\n @category = Category.find(params[:id])\n @category_products = @category.products.paginate(page: params[:page], per_page:5).order(\"name\")\n end", "def index\n @profile_items = current_user.profile_items\n end", "def product_list\n current_user.products.order('name').collect {|p| [ p.name, p.ticket_project_id, p.id ]}\n end", "def index\n @products = Product.all\n if params[:search]\n if params[:search]\n @products = Product.includes(:user).search(params[:search]).paginate(:page => params[:page], :per_page => 6)\n end\n end\n end", "def home\n @products = Product.all\n end", "def index\n @prod_categories = ProdCategory.all\n end", "def listProducts\n @@products.each_with_index { |p, i|\n puts \"#{i + 1}. #{p.name}\"\n }\n end", "def show\n @product_images = @product.product_images.all\n end", "def index\n if current_user.admin?\n @products = Product.all\n else\n if current_user.private?\n @products = Product.where(owner_id: current_user.private_id)\n elsif current_user.business?\n @products = Product.where(owner_id: current_user.business_id)\n end\n\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def show\n @products = Product.find(params[:id])\n end", "def show\n @online_store = OnlineStore.find(params[:id])\n @products = @online_store.products\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_store }\n end\n end", "def show\n # is_my_resource(params[:id])\n\n # prossumerProductsIds = Prossumer.find(params[:id]).products.ids\n render json: ProductAuth.where({product_id: params[:id], group_id: params[:group_id]}).first.as_json(:include => :product)\n end", "def show\n @products = @merk_lensa.products.order(\"created_at ASC\").paginate(:page => params[:page], :per_page => 9)\n end", "def show\n @products = @portfolio.products.includes(:groups).order(\"products.name\", \"groups.name\").uniq.paginate(:page => params[:products_page], \n :per_page => session[:results_per_page])\n @total_allocation = @portfolio.get_total_allocation(@year, @allocation_precision)\n @groups = Group.includes(:product_group_portfolios => :product).where(:product_group_portfolios => {:portfolio_id => @portfolio.id}).order(\"groups.name\", \"products.name\").uniq\n end", "def index\n @os_products = OsProduct.all\n end", "def index\n params[:page] ||= 1\n params[:perPage] ||= 10\n @page = params[:page].to_i\n @item_per_page = params[:perPage].to_i\n @item_count = current_user.shops.find_by_uuid(params[:shop_id]).products.count\n @products = current_user.shops.find_by_uuid(params[:shop_id]).products.eager_loading\n .limit(@item_per_page).offset(@item_per_page*(@page-1)).order(:position)\n json_options = {:include => {:product_variants => {:include => [:option_types,:pictures]}, :shipping_category => {}}, :methods => [:taxon_ids]}\n unless params[:promotionStart].blank?\n start_date = params[:promotionStart].to_datetime\n end_date = params[:promotionEnd].blank? ? nil : params[:promotionEnd].to_datetime\n json_options = json_options.merge({promotionStartDate: start_date, promotionEndDate: end_date})\n end\n respond_to do |format|\n format.html\n format.json { render json: {\n :products => @products.as_json(json_options),\n :page => @page,\n :total => @item_count,\n :perPage => @item_per_page\n }\n }\n end\n end", "def user_products\n @products = current_user.products\n\n respond_to do |format|\n format.html\n format.json { render json: @products }\n end\n end", "def index\n #get the profile with id \n @profile = Profile.find(params[:profile_id])\n @orders = Order.all\n end", "def show\n @order = @product.orders.new(user_id: current_user.id) if user_signed_in?\n @img = img_medium(@product)\n\n # Related products bar\n filtering_params = {category: @product.category}\n @products = Product.filter(filtering_params).limit(4)\n @products = @products.order(\"updated_at DESC\").paginate(page: params[:page], per_page: 4)\n \n # Review section\n if current_user.present?\n @reviews = @product.reviews.order(\"updated_at DESC\").paginate(page: params[:page], per_page: 8)\n @review = @product.reviews.new(user_id: current_user.id) \n end\n @average = @product.average_rating\n\n respond_to do |format|\n format.html\n format.js\n end\n end", "def show_cart\n render json: User.find(params[:id]).cart_products\n end", "def index\n @sub_products = if current_employee\n Shop.find(current_employee.shop_id).sub_products.newest_first.per_page(params[:page])\n elsif current_manager\n SubProduct.where(organization_id: current_manager.organization_id).newest_first.per_page(params[:page])\n else\n SubProduct.newest_first.per_page(params[:page])\n end\n @sub_product = @sub_products.by_barcode(params[:barcode]) if params[:barcode]\n # Get sub_products attached with main products and exclude the one already selected\n excluded_id = @sub_product.id\n @related_products = @sub_product.product.sub_products.where.not(id: excluded_id)\n end", "def show\n #@shops = Shop.all\n @questions = @shop.questions.includes(:user)\n end", "def show\n @cart = current_user.cart\n @all_items = @cart.items\n end", "def index\n @cart_products = CartProduct.all\n end", "def index\n @shopper_accounts = ShopperAccount.all\n end", "def show\n @motives_profile = MotiveProfile.where(profile_id: params[:id]).order(\"created_at DESC\") \n @role_profiles = Security::RoleProfile.where(security_profile_id: params[:id])\n end", "def show\n @skus = @tb_product.skus\n end", "def index\n @general_profiles = GeneralProfile.all\n end" ]
[ "0.760567", "0.7407571", "0.6582207", "0.65487456", "0.65304255", "0.6521858", "0.6498808", "0.647377", "0.6451767", "0.64466614", "0.64156866", "0.64089644", "0.6393801", "0.6338596", "0.6328616", "0.6328505", "0.63187605", "0.631062", "0.62999624", "0.62958145", "0.6264457", "0.6243303", "0.62351596", "0.6235032", "0.6209667", "0.6202964", "0.62009984", "0.61908394", "0.6184006", "0.6180111", "0.6177844", "0.6175771", "0.6169567", "0.6158345", "0.61574906", "0.61346215", "0.6132704", "0.6128615", "0.6124839", "0.6122646", "0.6110482", "0.6105952", "0.6095789", "0.6089957", "0.6087131", "0.6079565", "0.60735893", "0.6071347", "0.60678697", "0.6060688", "0.6047666", "0.6039255", "0.6032367", "0.6030534", "0.602532", "0.6019644", "0.6019554", "0.6009058", "0.6005689", "0.6003264", "0.5997463", "0.5995025", "0.59939224", "0.59916836", "0.5990198", "0.59884596", "0.598695", "0.598529", "0.5979184", "0.59741825", "0.5965415", "0.5932311", "0.5916252", "0.59052974", "0.5904864", "0.589701", "0.5893969", "0.58931863", "0.58924115", "0.5892294", "0.58921874", "0.5886827", "0.58787435", "0.5878649", "0.5876662", "0.58729047", "0.58633405", "0.5856114", "0.58519775", "0.5850961", "0.5849795", "0.58442295", "0.5841064", "0.58346057", "0.5824092", "0.5823592", "0.5822649", "0.58201027", "0.5820014", "0.5817696" ]
0.8070445
0
For Creating a New Shop Profile for a Shopkeeper
def create authorize ShopProfile @shop = ShopProfile.new(shop_params) @shop.build_address(address_params_shopkeeper) if @shop.valid? and ! current_user.user_profile.nil? current_user.shop_profiles << @shop flash[:success] = 'Shop Details added' redirect_to root_path elsif current_user.user_profile.nil? flash[:danger] = 'Please enter Personal Details before adding a Shop' redirect_to new_user_profile_path else flash[:error] = 'Shop Details not added' render 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @profile = current_user.profile || Profile.new\n @profile.user_id = current_user.id\n @profile.status = :start\n @profile.save(validate: false)\n session[:profile_id] = @profile.id\n redirect_to vendor_setup_store_index_path\n end", "def create_profile!\n bundle_id = Sigh.config[:app_identifier]\n name = Sigh.config[:provisioning_name]\n if !name\n name = Sigh.config[:app_identifier].gsub '.' ,''\n end\n\n UI.important \"Creating new provisioning profile for '#{Sigh.config[:app_identifier]}' with name '#{name}'\"\n profile = profile_type.create!(name: name,\n bundle_id: bundle_id)\n profile\n end", "def create\n logger.info(\"CREATE PROFILE #{params[:profile].inspect}\")\n @profile = Profile.new(params[:profile])\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_profile\n new_profile = Profile.new\n new_profile.user_id = self.id\n new_profile.save!\n end", "def create\n @profile = Profile.new(params[:profile])\n @profile.profile_id = UUIDTools::UUID.timestamp_create().to_s\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_created) }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_profile\n Profile.create(user_id: self.id)\n end", "def create\n @profile = current_user.build_profile(pro_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { redirect_to new_profile_path, alert: 'Please fill all fields' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n @profile.save\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_DB_profile\n \n @profile = ProfileId.new\n @profile.user_name = params[:user_name]\n @profile.profile_id = @parsed[\"profileId\"]\n @profile.save\n end", "def set_shop_profile\n @shop_profile = ShopProfile.find(params[:id])\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n @profile.site_identifier = params[:profile][:site_identifier]\n\n respond_to do |format|\n if @profile.save\n# current_user.default_profile = @profile\n set_banner\n format.html do\n redirect_to profile_home_path(@profile.site_identifier), notice: 'Profile was successfully created.'\n end\n format.json { render action: 'show', status: :created, location: profile_home_path(@profile.site_identifier) }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.create({\n name: params['profile']['name'],\n speciality: params['profile']['speciality'],\n city: params['profile']['city'],\n user_id: current_user['id']\n })\n @profile.save\n respond_with(@profile)\n end", "def create\n @profile = current_user.profiles.build(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @security_profile = Security::Profile.new(security_profile_params)\n @security_profile.user_created_id = current_user.id\n respond_to do |format|\n if @security_profile.save\n format.html { redirect_to security_profiles_path, notice: I18n.t('profiles.controller.create')}\n format.json { render :show, status: :created, location: @security_profile }\n else\n format.html { render :new }\n format.json { render json: @security_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n profile = Payments::Profile.new(profile_params)\n profile.user = current_user\n\n respond_to do |format|\n if profile.save\n format.html {redirect_to payments_profiles_path}\n else\n format.html {redirect_to :back, flash: {error: \"Error saving payment profile\"}}\n end\n end\n end", "def create\n # Buidles a profile in association witht eh user\n @user = User.find(current_user.id)\n @profile = @user.build_profile(params[:user])\n @profile.update_attributes(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_profile\n profile = Profile.new\n profile.user_group = UserGroup.first\n profile.library = Library.real.first\n profile.locale = I18n.default_locale.to_s\n profile.full_name = 'System'\n profile\nend", "def create\n\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shop = Shop.new(shop_params)\n @shopkeeper = current_user.shopkeeper\n @shop.shopkeeper_id = @shopkeeper.id\n\n if @shop.save\n render json: @shop, status: :created, location: @shop\n else\n render json: @shop.errors, status: :unprocessable_entity\n end\n end", "def create\n @profile = current_user.build_profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to manage_profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = @account.build_profile(profile_attributes)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Анкета успешно сохранена. Ваш магазин добавлен в очередь на оптимизацию.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n respond_to do |format|\n if @profile.save\n format.html do\n redirect_to @profile, notice:\n \"Profile was successfully created.\"\n end\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json do\n render json: @profile.errors,\n status: :unprocessable_entity\n end\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_profile = Profile.new(admin_profile_params)\n @commonplace_id = City.find(session[:current_city_id]).commonplace.id\n @is_major = @admin_profile.is_major\n redirect_path = session['previous_url'] || (@admin_profile.is_major ? admin_profiles_url(major:true) : admin_profiles_url)\n name_alias = @is_major ? 'Sindaco' : 'Giunta Comunale'\n respond_to do |format|\n if @admin_profile.save\n format.html { redirect_to redirect_path, notice: \"#{name_alias} è stato creato con successo.\" }\n format.json { render :show, status: :created, location: @admin_profile }\n else\n format.html { render :new }\n format.json { render json: @admin_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if current_user.profile.nil?\n profile = Profile.new(profile_params)\n profile.user = current_user\n if profile.save\n redirect_to profiles_path\n return\n end\n end\n redirect_to profiles_path\n end", "def create\n @professional_profile = ProfessionalProfile.new(professional_profile_params)\n @professional_profile.user = current_user\n\n respond_to do |format|\n if @professional_profile.save\n format.html { redirect_to @professional_profile, notice: 'Professional profile was successfully created.' }\n format.json { render :show, status: :created, location: @professional_profile }\n else\n format.html { render :new }\n format.json { render json: @professional_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def shop_profile_params\n params.require(:shop_profile).permit(:user_id, :about, :location, :contact_number, :business_name)\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t# Creating the profile for particular surgeon\n\t\tsurgeon_profile = devise_current_user.setting.build_profile(profile_params) \n\t\t# Condition checking the profile is saved or not\n\t\tif surgeon_profile.save\n\t\t\t# If Profile is save then that's take it into the profile show page\n\t\t\tredirect_to profile_path(surgeon_profile)\n\t\telse\n\t\t\t# If Profile is not save then that's take in into the same page \n\t\t\tredirect_to :back\n\t\tend #Condition End\n\tend", "def create\r\n @profile = Profile.new(profile_params)\r\n\r\n respond_to do |format|\r\n if @profile.save\r\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\r\n format.json { render :show, status: :created, location: @profile }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n # state 0 means shop is invaliable\n @shop = current_user.shops.new(shop_params.merge state: 0)\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to uppics_shop_url(@shop), notice: 'Shop was successfully created.' }\n format.json { render :show, status: :created, location: @shop }\n else\n format.html { render :new }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user=current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to '/', notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: t('controller.profiles.create.success') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n\t\tbegin\n\t\t\tuser_profile = self.profile\n\t\t\tUser.create(\n\t\t\t\t:user_id => id,\n\t\t\t\t:login_name => username,\n\t\t\t\t:email => email,\n\t\t\t\t:join_tsz => created,\n\t\t\t\t:transaction_buy_count => user_profile.transaction_buy_count,\n\t\t\t\t:transaction_sold_count => user_profile.transaction_sold_count,\n\t\t\t\t:is_seller => user_profile.is_seller,\n\t\t\t\t:location => user_profile.lon ? [user_profile.lon, user_profile.lat] : nil,\n\t\t\t\t:image_url => user_profile.image,\n\t\t\t\t:country_id => user_profile.country_id,\n\t\t\t\t:gender => user_profile.gender,\n\t\t\t\t:oauth_token => nil,\n\t\t\t\t:oauth_token_secret => nil,\n\t\t\t\t:authenticated => false,\n\t\t\t\t:shop_id => @shop_id\n\t\t\t)\n\t\trescue NoMethodError\n\t\t\t# fairly rare at this point.\n\t\t\tputs \"associated_profile bug\"\n\t\tend\n\tend", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n \n \n @profile.artist = find_preferred_artist_id\n @profile.advisor = find_preferred_advisor_id\n\n respond_to do |format|\n if @profile.save\n current_user.update(clientstatus: \"free\")\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n if @profile.save\n render json: @profile, status: :created\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end", "def create\r\n parameters = profile_params\r\n parameters[\"user\"] = current_user\r\n current_user.is_active = true\r\n UserRole.create(role_id:1, user_id:current_user.id)\r\n current_user.update(is_active:true)\r\n @profile = Profile.create(parameters)\r\n redirect_to root_path\r\n end", "def create\n @profiles = current_user.profiles.new(profile_params)\n\n if @profiles.save\n redirect_to profiles_path, notice: 'Profile was successfully created.'\n else\n render :new\n end\n end", "def create_profile\n Profile.create!(member_id:self.id) if self.profile.nil?\n end", "def create\n @pay_profile = PayProfile.new(params[:pay_profile])\n\n respond_to do |format|\n if @pay_profile.save\n format.html { redirect_to @pay_profile, notice: 'Pay profile was successfully created.' }\n format.json { render json: @pay_profile, status: :created, location: @pay_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pay_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gear_profile = GearProfile.new(gear_profile_params)\n\n respond_to do |format|\n if @gear_profile.save\n format.html { redirect_to @gear_profile, notice: 'Gear profile was successfully created.' }\n format.json { render :show, status: :created, location: @gear_profile }\n else\n format.html { render :new }\n format.json { render json: @gear_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n if @profile.save\n begin\n response_bank = Pagarme::CreateBankAccountService.new(profile: @profile).call\n rescue\n return redirect_to new_client_profile_path, notice: 'Houve um problema para salvar o perfil.'\n end\n if response_bank.id.present?\n @profile.update(bank_id: response_bank.id)\n response_recipient = Pagarme::CreateRecipientService.new(profile: @profile).call\n if response_recipient.id.present?\n @profile.update(recipient_id: response_recipient.id)\n return redirect_to edit_client_profile_path(@profile), notice: 'Perfil salvo com sucesso.'\n end\n end\n redirect_to new_client_profile_path, notice: 'Houve um problema para salvar o perfil.' \n else\n redirect_to new_client_profile_path, notice: 'Houve um problema para salvar o perfil.'\n end\n end", "def edit\n if current_user.shop_profile.nil?\n @shop_profile = ShopProfile.create(user: current_user)\n else\n @shop_profile = current_user.shop_profile\n end\n end", "def sendMeHomeAndCreateProfile user \n if user.type == \"Applicant\"\n Profile.create(applicant_id: user.id)\n redirect_to \"/applicant\"\n else\n redirect_to \"/recruiter\"\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n if @profile.save!\n redirect_to profile_path(@profile.id)\n else\n render :new\n end\n end", "def create\n\t\t@user = User.find( params[:user_id] )\n\t\t@profile = @user.build_profile( profile_params )\n\t\tif @profile.save\n\t\t\tflash[:success] = \"You've created your dealership profile. Good selling!\"\n\t\t\tredirect_to user_path( params[:user_id] )\n\t\telse\n\t\t\trender action: :new\n\t\tend\n\tend", "def create\n @profile = Profile.new(profile_params)\n authorize @profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to quit_user_profile_path, notice: \"Profile: #{I18n.t('helpers.saved')}\" }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shop_request = current_user.profile.shop_requests.build shop_request_params\n\n respond_to do |format|\n if @shop_request.save\n format.html { redirect_to @shop_request, notice: 'Shop request was successfully created.' }\n format.json { render action: 'index', status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @shop_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new profile_params\n unless current_user.profile\n @profile.user = current_user\n end\n\n respond_to do |format|\n if @profile.save\n if current_user.profile\n AclEntry.set current_user, @profile, :edit\n end\n FeedSubscription.add current_user.profile, @profile\n\n format.html { redirect_to session_path }\n format.xml { render xml: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n current_user.profile = Profile.new(params[:profile])\n @profile = current_user.profile\n\n if !@profile.valid?\n flash[:error_created] = @profile.errors.full_messages.join(\"<br>\").html_safe\n redirect_to new_user_profile_path(current_user)\n else\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_profile_path(current_user), notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end \n end\n end", "def create\n respond_to do |format|\n @profile = current_user.create_profile(params[:profile])\n if @profile \n format.html { redirect_to(profile_url(@profile.user_id), :notice => 'Profile was successfully created.') }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n @profile.user_id = current_user.id\n authorize! :create, @profile\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vendor_profile = VendorProfile.new(vendor_profile_params)\n\n respond_to do |format|\n if @vendor_profile.save\n format.html { redirect_to @vendor_profile, notice: 'Vendor profile was successfully created.' }\n format.json { render :show, status: :created, location: @vendor_profile }\n else\n format.html { render :new }\n format.json { render json: @vendor_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_profile( profile_name )\n response = Faraday.post do |req|\n req.url \"#{@base_url}/services/conf/brokerConfigurations/newBroker\"\n req.body = \"inputNewName=#{profile_name}&nameBrokerCopy=%20\"\n req.headers = @authorization_headers.merge({'enctype' => 'multipart/form-data',:content_type => 'application/x-www-form-urlencoded'})\n end\n\n profile_id = response.body\n return profile_id\n end", "def create_profile(profile, options = {})\n options = @@create_profile_option_defaults.merge(options)\n @type = Type::CIM_CREATE_PROFILE\n @fields.merge!(profile.to_hash)\n set_fields(:validation_mode => options[:validation_mode])\n make_request\n end", "def create\n super\n @instructor.create_profile(profile_params)\n\n @instructor.update_attributes(\n plan_id: @instructor.id,\n product_id: @instructor.id\n )\n end", "def create\n @user = User.new(params[:user])\n # Create Cart objects only for the Shoppers\n if @user.status==User.STATUS_SHOPPER\n cart = @user.build_cart\n end\n\n if @user.save\n redirect_to root_url, :notice=> \"Signed up!\"\n else\n render \"new\"\n end\n end", "def create\n user = AuthenticationManager.new(\n params.slice(%i[email first_name last_name password]).merge(is_profile_owner: true, password_confirmation: params[:password], tos_accepted: params.bool(:tos_accepted))\n ).register\n\n session_manager.login(user.email, params[:password])\n json_redirect create_profile_path\n end", "def add_profile(userinput)\n profile = Profile.create(name:userinput)\n profile.user_id = self.id\n profile.save\n profile\n end", "def create\n @cleaners_profile = Cleaners::Profile.new(cleaners_profile_params)\n\n respond_to do |format|\n if @cleaners_profile.save\n format.html { redirect_to after_signup_path(:preference) }\n format.json { render action: 'show', status: :created, location: @cleaners_profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @cleaners_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @current_object = Profile.new(params[:profile])\n respond_to do |format|\n if @current_object.save\n \n @current_object.create_profile_workspace\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to admin_profile_path(@current_object.id) }\n format.xml { render :xml => @current_object, :status => :created, :location => @current_object }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @current_object.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n build_identity\n save_identity || render(template: 'profiles/show')\n end", "def create\n @shopper_account = ShopperAccount.new(shopper_account_params)\n\n respond_to do |format|\n if @shopper_account.save\n format.html { redirect_to @shopper_account, notice: 'Shopper account was successfully created.' }\n format.json { render action: 'show', status: :created, location: @shopper_account }\n else\n format.html { render action: 'new' }\n format.json { render json: @shopper_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_profile\n profile = Profile.new\n profile.user_group = UserGroup.first\n profile.library = Library.real.first\n profile.locale = I18n.default_locale.to_s\n profile\nend", "def create\n params[:profile][:tag_list] = params[:profile][:tag_list]\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n # Store friendly profile URI\n current_user.profile_uri = getUniqueURI(current_user) \n current_user.save\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_profile\n build_emp_perfil\n end", "def create\n @profile_user = ProfileUser.new(profile_user_params)\n\n respond_to do |format|\n if @profile_user.save\n format.html { redirect_to @profile_user, notice: 'Profile user was successfully created.' }\n format.json { render :show, status: :created, location: @profile_user }\n else\n format.html { render :new }\n format.json { render json: @profile_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def build_profile\n Profile.create(user: self)\n end", "def create\n # Ensure that we have the right user\n @user = User.find( params[:user_id] )\n # Create profile linked to this specific user\n @profile = @user.build_profile( profile_params )\n @profile.save\n if @profile.save\n flash[:success] = \"Profile updated!\"\n # TODO: Redirect to profile page, once there is one. \n redirect_to user_path(params[:user_id])\n else\n # TODO: don't dump the user's inputs if save to database fails. \n render action: :new\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to profile_url(@profile) }\n format.xml { head :created, :location => profile_url(@profile) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors.to_xml }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.74843675", "0.72974294", "0.69844735", "0.6946472", "0.6910242", "0.6909806", "0.68356186", "0.68322736", "0.6830035", "0.6820872", "0.68167704", "0.6811026", "0.68055683", "0.6772831", "0.6762305", "0.67601204", "0.6744072", "0.67392904", "0.6732139", "0.67272365", "0.67151046", "0.6714445", "0.6710654", "0.6708586", "0.6708586", "0.6708586", "0.66912663", "0.6687079", "0.6682158", "0.668184", "0.6680303", "0.6680303", "0.6680303", "0.6680303", "0.6680303", "0.6680303", "0.6680303", "0.6680303", "0.667971", "0.6674177", "0.66732925", "0.66612184", "0.6660902", "0.6659849", "0.6659849", "0.6659849", "0.6659849", "0.6659849", "0.6659849", "0.6659849", "0.6656841", "0.66550094", "0.6648485", "0.6632464", "0.6632464", "0.6630276", "0.66281205", "0.6626278", "0.6624196", "0.6622432", "0.6618832", "0.6614832", "0.6600915", "0.6597371", "0.6595862", "0.65926963", "0.6588651", "0.65874714", "0.65734184", "0.65529954", "0.6547171", "0.65422565", "0.6519588", "0.6518982", "0.6518041", "0.65162575", "0.6508516", "0.65035444", "0.6498769", "0.6491891", "0.64912194", "0.64870864", "0.64865553", "0.64841956", "0.6458888", "0.64491165", "0.6434548", "0.6422216", "0.64187056", "0.641842", "0.6410378", "0.6409065", "0.64037853", "0.64024484", "0.6396144", "0.63863176", "0.63847554", "0.63746446", "0.63746446", "0.63746446" ]
0.78790224
0
For Updating a Shop Profile Details
def update @shop = current_user.shop_profiles.find(params[:id]) authorize @shop if @shop.update_attributes(shop_params) and @shop.address.update_attributes(address_params_shopkeeper) flash[:success] = 'Updated Successfully' redirect_to shop_profiles_path else flash[:danger] = 'Shop Details not Updated' render 'edit' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\t\t# Updating the details according the that particular profile\n\t\t@profile.update_attributes(profile_params)\n\t\t# Redirect to the particular surgeon profile show page\n\t\tredirect_to profile_path(@profile)\n\tend", "def update_profile\n @profile = @account.employee\n \n if params[:profile].present?\n @profile.assign_attributes(profile_params)\n @profile.save\n redirect_to gns_core.my_profile_backend_accounts_path, flash: {success: 'Profile has been updated successfully.'}\n else\n redirect_to gns_core.my_profile_backend_accounts_path, flash: {error: 'Profile update failed. Please try again!'}\n end\n end", "def edit\n if current_user.shop_profile.nil?\n @shop_profile = ShopProfile.create(user: current_user)\n else\n @shop_profile = current_user.shop_profile\n end\n end", "def set_shop_profile\n @shop_profile = ShopProfile.find(params[:id])\n end", "def update_profile(params)\n post('/account/update_profile.json', params)\n end", "def update\n respond_to do |format|\n # byebug\n if @profile.update(profile_params)\n format.html { redirect_to vendor_path(current_user.username), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n current_user.profile.update_attributes(profile_params)\n redirect_to '/profiles'\n end", "def update\n @profile = current_user.profile\n assign_params_to_attributes\n if @profile.update_attributes(params[:profile])\n if params[:profile][:zip].present?\n current_user.update_attribute(:zip, params[:profile][:zip])\n end\n flash[:notice] = I18n.t('profile.update.notice')\n # redirect_to user_path(current_user)\n redirect_to edit_user_profile_path(current_user, @profile)\n else\n @user = current_user\n assing_attributes_to_params\n flash.now[:error] = I18n.t('profile.update.error')\n render :action => \"edit\"\n end\n end", "def update_profession\n @general_info = GeneralInfo.find_by(userKey: session[:current_user_key])\n \n if @general_info.update_attribute(specific_profile_id, :specific_profile_id)\n redirect_to '/show_profile'\n else\n render :action => 'edit_profession'\n end\n end", "def update_profile(params)\n post 'account/update_profile', :post => params\n end", "def update\n respond_to do |format|\n if @profile.update(pro_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@user = current_user\n\t\t@profile = @user.profile\n\t\t@profile.update_columns(profile_params)\n\t\trespond_with @profile \n\tend", "def update_profile(options = {}) \n # query profile info\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(URI_PROFILES, :params => { 'filter[name]' => options[:name] })\n if response.status.success?\n responseObj = JSON.parse(response.body)\n queried_profile_list = responseObj[\"data\"]\n if queried_profile_list.length() > 0\n profile = queried_profile_list[0]\n end\n else\n Asca::Tools::Log.error(response.body)\n return\n end\n \n if !profile\n Asca::Tools::Log.error(\"No profile named #{options[:name]} found\")\n return\n end\n # create new profile\n profile_type = profile[\"attributes\"][\"profileType\"]\n \n # get bundle id\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"bundleId\"][\"links\"][\"self\"])\n bundle_id = JSON.parse(response.body)[\"data\"][\"id\"]\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"certificates\"][\"links\"][\"self\"])\n certificate_ids = JSON.parse(response.body)[\"data\"].map { |cer| cer[\"id\"] }\n \n # get all device ids\n device_ids = Asca::REST::Provisioning::Devices.list_devices.map { |device|\n device[\"id\"]\n }\n \n # delete old prifile\n delete_profile :name => options[:name]\n \n if profile_type.include? 'APP_STORE'\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :certificate_ids => certificate_ids\n else\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :device_ids => device_ids, :certificate_ids => certificate_ids\n end\n \n return true\n end", "def profile\r\n if request.post?\r\n @customer.update_attributes :email => params[:customer][:email], :phone => params[:customer][:phone]\r\n @store_user.my_account_log(@customer,\"Update Profile Email: #{@customer.email} Phone: #{@customer.phone}\")\r\n @customer.update_ax\r\n end\r\n end", "def update_profile\n @profile = Profile.find(params[:id])\n @profile.update_attribute(:field_name,params[:field_name])\n @profile.update_attribute(:field_type,params[:field_type])\n redirect_to(\"/profiles/create_profile/#{@profile.structure_component_id}\")\n end", "def profile_update(profile,user)\n @profile=profile\n @user=user\n mail to: @user.email, subject: \"Profile updated (Socail Trip App)\", from:'test@example.com'\n end", "def updated_profile\n \n @user = User.find_by_id(session[:user_id])\n \n @user.name = params[:user][:name]\n @user.email = params[:user][:email]\n @user.address = params[:user][:address]\n @user.city = params[:user][:city]\n @user.pincode = params[:user][:pincode]\n @user.state = params[:user][:state]\n @user.contact_no = params[:user][:contact_no]\n\n if @user.save\n flash[:notice] = \"Changes Updated Successfully\"\n redirect_to :action => \"admin_profile\"\n else\n flash[:notice] = \"Changes are not updated\"\n end # if @user.save\n\n end", "def update_profile_info\n info = provider_class.profile_info\n self.update_attributes(info)\n end", "def update\n respond_to do |format|\n # This must be update_attributes, to do validations\n if @profile.update(profile_params)\n format.html { redirect_to profile_home_path(@profile.site_identifier), notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if conditionally_update\n handle_successful_update\n redirect_to hyrax.dashboard_profile_path(@user.to_param), notice: \"Your profile has been updated\"\n else\n redirect_to hyrax.edit_dashboard_profile_path(@user.to_param), alert: @user.errors.full_messages\n end\n end", "def update_user_profile(profile_form)\n isUpdateProfile = UserService.updateProfile(profile_form)\n if isUpdateProfile\n redirect_to users_path\n else\n asdasd\n render :edit_profile\n end\n end", "def update_profile(body)\n post(\"user/#{user_id}/profile.json\", body)\n end", "def update\n userprofile = Userprofile.find_by(\"id\" => params[\"id\"])\n userprofile.update(\"name\" => params[\"full_name\"], \"photo_url\" => params[\"url\"])\n redirect_to \"/userprofiles\"\n end", "def update\n @user = User.find(current_user.id)\n @profile = @user.profile\n \n if @profile = params[:profile]\n redirect_to user_profile_path(current_user.name)\n else\n redirect_to edit_user_profile_path\n end\n end", "def update\n @user = User.find( params[:user_id] ) #establish which user profile we are editing \n @profile = @user.profile #store user profile data in @profile variable \n if @profile.update_attributes(profile_params) # checking in db if data is updated\n flash[:success] = \"Profile Updated!\"\n redirect_to user_path( params[:user_id] ) # display the edited profile\n else\n render action: :edit #redirecting user to edit page\n end\nend", "def update\n\t\t# Updating the details according the that particular profile\n\t\tif @profile.update_attributes(speciality_name: params[:speciality_name],sub_speciality_name:params[:sub_speciality_name],:medical_school=>params[:medical_school],:residency=>params[:residency],:spe_training=>params[:spe_training],:my_favourite=>params[:my_favourite],:my_hobby=>params[:my_hobby],:more_about=>params[:more_about],:cover_image=>params[:cover_image],:profile_image=>params[:profile_image])\n\t\t# response to the JSON\n\t\t\trender json: { success: true,message: \"Profile Successfully Updated.\", response: ProfileSerializer.new(@profile).as_json(root: false) },:status=>200\n\t else\n\t render :json=> { success: false, message: @profile.errors },:status=> 203\n\t end\n\tend", "def update_profile(profile)\n @type = Type::CIM_UPDATE_PROFILE\n @fields.merge!(profile.to_hash)\n make_request\n end", "def update\n respond_to do |format|\n if @profile.update_attributes params[:profile]\n @profile.user.index!\n format.html { redirect_to get_stored_location, :notice => t('profile.profile_updated') }\n else\n format.html { render :action => :edit }\n end\n end\n end", "def update\n respond_to do |format|\n if @professional_profile.update(professional_profile_params)\n format.html { redirect_to @professional_profile, notice: 'Professional profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @professional_profile }\n else\n format.html { render :edit }\n format.json { render json: @professional_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_profile\n user = @current_user\n user.first_name = params[:first_name]\n user.phone_no = params[:phone_no]\n user.email = params[:email]\n user.save!\n if (user.role == \"user\")\n redirect_to categories_path\n elsif (user.role == \"clerk\")\n redirect_to clerks_path\n else\n redirect_to \"/dashboard\"\n end\n end", "def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, :notice => 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_profile! (data = {})\n check_auth :update\n \n response = connection.put do |req|\n req.url '/user/update'\n req.body = { :format => @format }.merge(data)\n end\n response\n end", "def update\n @profile = Profile.find(params[:id])\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to(show_user_path(current_user.username)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def updateProfile\r\n errors ||= Array.new\r\n\t\tdataHash = {\r\n user_id: params[:user].id,\r\n asset_id: params[:asset_id],\r\n\t\t\tfname: params[:fname],\r\n\t\t\tlname: params[:lname],\r\n\t\t\tgender: params[:gender],\r\n\t\t\tbio: params[:bio],\r\n\t\t\tfamilyStatus: params[:familyStatus],\r\n\t\t\tbdate: params[:bdate]\r\n\t\t}\r\n\t\terrors = Api::Init.MembersControl.checkProfileParams(dataHash)\r\n\t\tif errors.count != 0 \r\n\t\t\trender :json => Api::Init.ShowErrorJson(API_CODE_ERRORS['Services']['Global']['profile_errors'],I18n.t(\"errors.messages.users.profile_errors\"), errors).to_json\r\n else\r\n \tuserProfileObject = UsersProfile.byUser(params[:user].id).first\r\n userProfileObject.updateProfile(dataHash)\t\r\n self.default_response\r\n end\r\n\tend", "def update\n\t\t@shop = ShopProfile.find(params[:shop_profile_id])\n\t\t@shipping_charge = ShippingCharge.find(params[:id])\n\t\tauthorize @shipping_charge\n\t\tif @shipping_charge.update_attributes(shipping_charge_params)\n\t\t\tflash[:success] = 'Updated Successfully'\n\t\t\tredirect_to request.referer || root_path\n\t\telse\n\t\t\tflash[:danger] = 'It is not Updated'\n\t\t\tredirect_to request.referer || root_path\n\t\tend\n\n\tend", "def update\n @profile = Profile.find(params[:id])\n\n if @profile.update_attributes(params[:profile])\n redirect_to @profile, notice: 'Profile was successfully updated.'\n else\n render action: \"edit\"\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to vanity_profile_path(:id => @profile.user.name), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to (user_profile_path(current_user)), notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_profile(options={})\n perform_post(\"account/update_profile.#{Twitter.format}\", options)\n end", "def user_update\n \t saveupdateProfile = UsersService.updateProfile(user_profile_params)\n \t if saveupdateProfile \n \t \tredirect_to users_path, notice: \"Successfully Updated!!!.\"\n \t else\n flash[:error] = \"Something wrong in User Update Please Check again.\"\n \t \trender :edit_profile\n \t end\n end", "def update\n @profiles = current_user.profiles.find(params[:id])\n\n respond_to do |format|\n if @profiles.update(profile_params)\n format.html { redirect_to profiles_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profiles }\n else\n format.html { render :edit }\n format.json { render json: @profiles.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = \"Ваш профиль успешно обновлён\"\n format.html { redirect_to(profile_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find_by_user_id(current_user.id)\n\n if @profile.update_attributes(params[:profile])\n flash[:notice] = \"Personal info saved sucessfuly\"\n else\n error_messages(@profile)\n end\n\n redirect_to edit_profile_path\n end", "def shop_profile_params\n params.require(:shop_profile).permit(:user_id, :about, :location, :contact_number, :business_name)\n end", "def update\n\t\t@user = current_user\n\t\t@user.name = params[:name]\n\t\t@user.phone = params[:phone]\n\t\t@user.phone_operator = params[:phone_operator]\n\t\tif @user.save\n\t\t\tsession[:user_id] = @user.id\n\t\t\tflash[:notice] = \"Details Updated.\"\n\t\t\tredirect_to(dashboard_path)\n\t\telse\n\t\t\tflash[:alert] = \"Unable to update profile\"\n\t\t\trender \"edit\", layout: \"application_inside\"\n\t\tend\n\tend", "def update\n @profile = Profile.find_by_user_id params[:user_id]\n\n if @profile.update_attributes(params[:profile])\n redirect_to user_profile_path(params[:user_id])\n else\n flash[:alert] = @profile.errors.full_messages.join(\",\")\n render :template => \"profiles/edit\"\n end\n\n end", "def update\n @profile = self.current_member.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to [self.current_member, @profile] }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors.to_xml }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n current_user.admin? ? true : params[:profile][:id] = current_user.id\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n current_user.admin? ? true : params[:profile][:id] = current_user.id\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @title = \"Edit Profile\"\n @user = current_user\n @user.profile ||= Profile.new\n @profile = @user.profile\n if param_posted?(:profile)\n if @user.profile.update_attributes(params[:profile])\n flash[:notice] = \"Changes saved.\"\n # redirect_to :controller => \"profile\", :action => \"index\"\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n work_name\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to(@profile, :notice => 'Profile ha sido modificado.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @profile.update(profile_params)\r\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @profile }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n if @profile.update_attributes(profile_params)\n redirect_to @profile, notice: \"Your profile has been updated\"\n else\n render :edit\n end\n end", "def update\n @profile = current_user.profile\n respond_to do |format|\n if @profile\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to(@profile, :notice => 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n else\n format.html { render :text => \"You currently do not have a profile.\" }\n end\n end\n end", "def update_profile(body={})\n perform_post(\"/account/update_profile.json\", :body => body)\nend", "def update\n # render :text => \"<pre>#{params.to_yaml}</pre>\" and return\n @profile = Profile.find(params[:id])\n # @profile = Profile.find_or_create_by_user_id(@user.id)\n unless params.empty?\n @profile.update_attributes(params[:profile])\n @profile.user.update_attributes(params[:user])\n end\n respond_to do |format|\n if @profile.errors.empty? && @profile.user.errors.empty?\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to(@profile) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors + @profile.user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(current_user.id)\n @profile.update_attributes(params[:profile])\n respond_with @profile\n end", "def update\n #@profile = UsersDisciplines.find(params[:id])\n @profile = Profile.find_by_user_id(current_user.id)\n \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @profile.update(profile_params)\n redirect_to @profile\n else\n render :edit\n end\n end", "def update\n if user_signed_in?\n if @profile.update(profile_params)\n render json: @profile, status: :ok\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update_attributes(profile_params)\n format.html {\n flash[:notice] = t('Profile was successfully update.')\n redirect_to home_path\n }\n format.json { render json: {ok: true}, status: :ok }\n else\n format.html { redirect_to profile_edit_url, notice: t('Profile not saved !') }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def update\n\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n #format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n #format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # Retrieve user from the database\n @user = User.find(params[:user_id])\n # Assign user profile to an instance variable\n @profile = @user.profile\n # Mass assign edited profile attributes and save. \n if @profile.update_attributes(profile_params)\n flash[:success] = \"Profile updated!\"\n # Redirect to profile page. \n redirect_to user_path(id: params[:user_id])\n else\n # TODO: don't dump the user's inputs if save to database fails. \n render action: :edit\n end\n end", "def update\n respond_to do |format|\n if @vendor_profile.update(vendor_profile_params)\n format.html { redirect_to @vendor_profile, notice: 'Vendor profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @vendor_profile }\n else\n format.html { render :edit }\n format.json { render json: @vendor_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # FIXME There's probably a better way to manage STI.\n profile_params = (@profile.type == DeveloperProfile.to_s ? params[:developer_profile] : params[:contractor_profile])\n profile_params[:project_type_ids] ||= []\n\n respond_to do |format|\n if @profile.update_attributes(profile_params)\n format.html { redirect_to(profile_path(@profile), :notice => 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @profile = @user.profile \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = t('profiles.new.success')\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to root_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @full_profile.update(social_profile_params)\n format.html { redirect_to @current_user, notice: 'Social profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @current_user }\n else\n format.html { render :edit }\n format.json { render json: @full_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n Rails.logger.info(\"PARAMS: #{profile_params}\")\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = User.find(params[:id])\n \n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to profile_path(@profile) }\n else\n flash[:alert] = \"unable to update. Please check the data.\"\n format.html { render 'edit' }\n end\n end\n end", "def update\n @profile = Account.find(params[:id])\n\t if @profile.update_attributes!(update_params)\n\t if @profile.save\n redirect_to profile_index_path, notice: \"Account was successfully saved.\"\n end\n else\n flash[:alert] = \"Account failed to save\"\n redirect_to profile_index_path\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to edit_profile_path(), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to edit_profile_path(current_user.profile), notice: t('controller.profiles.update.success') }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @gear_profile.update(gear_profile_params)\n format.html { redirect_to @gear_profile, notice: 'Gear profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @gear_profile }\n else\n format.html { render :edit }\n format.json { render json: @gear_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_specialist\n\t\tif !params[:profile_setting].present?\n\t\t\tredirect_to user_profile_data_profile_path \n\t\telse\n\t\t\t# update the profile update images like cover photo and profile photo\n\t\t \t@profile_specialist = @user.update_attributes(profile_setting_specialist_params)\n\t\t \t# redirect to the user profile app page\n\t\t \tredirect_to user_profile_data_profile_path\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html do\n redirect_to @profile,\n notice: \"Profile was successfully updated.\"\n end\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json do\n render json: @profile.errors,\n status: :unprocessable_entity\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @general_profile.update(general_profile_params)\n format.html { redirect_to @general_profile, notice: 'General profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @general_profile }\n else\n format.html { render :edit }\n format.json { render json: @general_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_profile\n end", "def update\n @profile = Profile.find(params[:id])\n logger.debug(\"UPDATE PROFILE @profile = #{@profile.inspect}\")\n logger.debug(\"UPDATE PROFILE params = #{params[:profile].inspect}\")\n logger.debug(\"UPDATE PROFILE update_attributes #{@profile.update_attributes(params[:profile]).inspect}\")\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to profile_path(@profile.user_id) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to '/', notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @security_profile.user_updated_id = current_user.id\n respond_to do |format|\n if @security_profile.update(security_profile_params)\n format.html { redirect_to security_profiles_path, notice: I18n.t('profiles.controller.update') }\n format.json { render :show, status: :ok, location: @security_profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_profile_store_owner\n @status_update = false;\n user_info ={}\n error_type = \"\"\n org_name = params[\"business_name\"]\n user_info[\"first_name\"] = params[\"first_name\"]\n user_info[\"last_name\"] = params[\"last_name\"]\n user_info[\"email\"] = params[\"email\"]\n user_info[\"password\"] = params[\"password\"] unless params[\"password\"].blank?\n @existed_user = User.find_by_id(params[\"hidden_user_id\"])\n if @existed_user.id == current_user.id\n @status_update = @existed_user.update_attributes(user_info)\n @existed_user.organization.update_attributes(:name =>params[\"business_name\"])\n sign_in(@existed_user,:bypass => true)\n @full_name = @existed_user.first_name + \" \" + @existed_user.last_name \n end\n respond_to do |format|\n format.js\n end\n #render :js => \"update_success(#{@status_update}, #{@full_name})\"\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html {redirect_to payments_profiles_path}\n else\n format.html {redirect_to :back, flash: {error: \"Error saving payment profile\"}}\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to user_path, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7538919", "0.75251615", "0.7493007", "0.7369756", "0.7299349", "0.7240679", "0.71428186", "0.7133239", "0.7107589", "0.70974326", "0.7091699", "0.70606875", "0.7047986", "0.7009914", "0.7000479", "0.6980883", "0.6963947", "0.6961477", "0.69480884", "0.6916052", "0.69102186", "0.69053984", "0.68986696", "0.6892039", "0.6886558", "0.6884164", "0.68835914", "0.68808794", "0.68764526", "0.6873933", "0.6856483", "0.6853891", "0.68445915", "0.68420297", "0.6831949", "0.6825386", "0.68225026", "0.6814142", "0.6809756", "0.680523", "0.6804162", "0.680276", "0.68003994", "0.68003136", "0.6797873", "0.67940164", "0.67939794", "0.67914337", "0.67914337", "0.67887783", "0.67867166", "0.6786286", "0.67855334", "0.67772585", "0.6776155", "0.67719215", "0.67646694", "0.6758483", "0.6757498", "0.6755606", "0.67553777", "0.67553777", "0.67553777", "0.67553777", "0.67553777", "0.67553777", "0.67553777", "0.67553777", "0.67553777", "0.67553777", "0.67553777", "0.67553777", "0.67553777", "0.67553777", "0.67553777", "0.6754414", "0.6751467", "0.67507577", "0.6749999", "0.67375505", "0.6732651", "0.6731102", "0.67186046", "0.6717689", "0.67150486", "0.66977495", "0.6696417", "0.6687298", "0.66830397", "0.668152", "0.6676551", "0.6662767", "0.66597587", "0.6655894", "0.66527003", "0.66488516", "0.6644976", "0.6634155", "0.6632209", "0.6630369" ]
0.7961084
0
For Displaying all the Shop Profiles of all Shopkeepers for Admin
def shop_index authorize ShopProfile respond_to do |format| format.html format.json {render json: ShopProfileDatatable.new(view_context)} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t@shops = current_user.shop_profiles\n\tend", "def index\n @shop_profiles = ShopProfile.all\n end", "def index\n @promotions = current_shop_owner.promotions.all\n end", "def index\n @professional_profiles = ProfessionalProfile.all\n end", "def index\n @shop_admins = ShopAdmin.all\n end", "def index\n @admin_profiles = Admin::Profile.all\n end", "def admin_list\n @products = Product.find(:all)\n end", "def index\n @shopper_accounts = ShopperAccount.all\n end", "def index\n @gear_profiles = GearProfile.all\n end", "def index\n @profanes = Profane.all\n end", "def show\n\t\t@shop_profile = ShopProfile.find(params[:id])\n\t\t@items = @shop_profile.shop_products.where(shop_profile_id: @shop_profile.id)\n\t\t.paginate(page: params[:page], per_page: 6).search(params[:search])\n\t\tif !params[:category_id].nil?\n\t\t\t@items = @shop_profile.shop_products.where(category_id: params[:category_id])\n\t\t\t.paginate(page: params[:page], per_page: 6)\n\t\tend\n\tend", "def admin_view\n @products = Product.all\n end", "def index\n @shop_owners = ShopOwner.all\n end", "def index\n @progs = Prog.all\n end", "def shop_products\n products.shop_products\n end", "def index\n @cpanel_promotions = Cpanel::Promotion.all\n end", "def index\n @admin_produtos = Admin::Produto.all\n end", "def index\n @admin_products = Admin::Product.all\n end", "def index\n @general_profiles = GeneralProfile.all\n end", "def index\n @products = current_seller.product.all\n end", "def index\r\n @profesores = Profesore.all\r\n end", "def index\n @proverbes = Proverbe.all\n end", "def index\n @admin_stores = Store.all\n end", "def index\n if current_user.stripe_account_id.blank? && !current_user.merchant_rep?\n redirect_to admin_stripe_accounts_new_stripe_account_path\n else\n\n # Retrieve the root categories to display in the caterogy filter dropdown\n @all_categories = Category.order(:name)\n\n # Check to see if a user has selected a specific view type\n if params[:product_admin_view]\n # A view was selected, set it in the session\n session[:product_admin_view] = params[:product_admin_view]\n else\n session[:product_admin_view] = 'detailed'\n end\n\n # check to see if rep has selected a merchant\n if params[:merchant_selected]\n # A merchant was selected, set it in the session\n session[:merchant_selected] = params[:merchant_selected]\n end\n\n # Check the session to see if a view type was selected, if not, load the detailed view by default\n if session[:product_admin_view]\n # A session value exists, load the correct view\n if session[:product_admin_view] == \"list\"\n @page_view = 'list'\n # Retrieve all of the producs that belong to the current user\n # filter products for rep based on merchant selected\n if !session[:merchant_selected].blank? && current_user.merchant_rep?\n user = User.find(session[:merchant_selected])\n @merchant_name = user.merchant_name\n @products = user.products.order(\"updated_at DESC\")\n else\n @merchant_name = current_user.merchant_name\n @products = current_user.products.order(\"updated_at DESC\")\n end\n\n # Check to see if we have a query parameter. This is used for the product search bar\n if params[:query]\n @products = @products.search(params[:query])\n end\n\n # Check to see if we have a category id. This is used for the category dropdown filter\n if params[:category_id]\n @products = @products.category_specific(Category.find(params[:category_id]).descendents)\n end\n\n else\n @page_view = 'detailed'\n\n # Retrieve all of the producs that belong to the current user\n # filter products for rep based on merchant selected\n if !session[:merchant_selected].blank? && current_user.merchant_rep?\n # find user with param passed in\n user = User.find(session[:merchant_selected])\n #set the merchants name\n @merchant_name = user.merchant_name\n # paginate the products for detailed view\n @products = user.products.order(\"updated_at DESC\").paginate(:page => params[:page],:per_page => 5)\n else\n # if rep hasn't selected a merchant, display the rep's name\n @merchant_name = current_user.merchant_name\n # if rep hasn't selected a merchant, display the rep's products\n @products = current_user.products.order(\"updated_at DESC\").paginate(:page => params[:page],:per_page => 5)\n end\n\n # Check to see if we have a category id. This is used for the category dropdown filter\n if params[:category_id]\n @products = @products.category_specific(Category.find(params[:category_id]).descendents)\n end\n\n # Check to see if we have a query parameter. This is used for the product search bar on list view\n if params[:query]\n @products = @products.search(params[:query])\n end\n\n end\n else\n # A session value does not exist, load the default detailed view\n @page_view = 'list'\n\n # filter products for rep based on merchant selected\n if !session[:merchant_selected].blank? && current_user.merchant_rep?\n # select the user based on rep's selection\n user = User.find(session[:merchant_selected])\n # set the merchant name selected by the rep\n @merchant_name = user.merchant_name\n # list the products belonging to the selected merchant in list form\n @products = user.products.order(\"updated_at DESC\")\n else\n # set merchant name to current user's name\n @merchant_name = current_user.merchant_name\n # list all the products for the current user, merchant or rep\n @products = current_user.products.order(\"updated_at DESC\")\n end\n\n # Check to see if we have a query parameter. This is used for the product search bar\n if params[:query]\n @products = @products.search(params[:query])\n end\n\n # Check to see if we have a category id. This is used for the category dropdown filter\n if params[:category_id]\n @products = @products.category_specific(Category.find(params[:category_id]).descendents)\n end\n\n end\n end\n end", "def index\n @proccs = Procc.all\n end", "def index\n @propperties = Propperty.all\n end", "def index\n @stores = @commerce.stores\n end", "def index\n @professional_infos = ProfessionalInfo.all\n end", "def profiles\n Management::Profile.all(self)\n end", "def index\n @proyectominero2s = Proyectominero2.all\n end", "def index\n if current_user.role == 'admin'\n\t@shoppinglists = Shoppinglist.all\n else\n\t@shoppinglists = Shoppinglist.select{|l| l.user == current_user}\n end\n end", "def index\n Shop.set_store_session\n @products = ShopifyAPI::Product.all\n end", "def index\n @pro_entries = ProEntry.all\n end", "def index\n @produits = Produit.all\n end", "def index\n if current_admin.has_role? :merchant_admin\n @admin_promos = Promo.where('merchant_id in (?)', Merchant.where(admin_id: current_admin.id).map(&:id)).page(params[:page]).per(10)\n else\n @admin_promos = City.find(session[:current_city_id]).promos.order('created_at DESC').page(params[:page]).per(10)\n end\n\n end", "def index\n @products = current_user.products.all\n end", "def index\n @products_grupos = ProductsGrupo.all\n end", "def show\n @products = Product.all\n @stores = Store.all\n end", "def products_list\n\t\t@view.products_list\n\t\tproducts = @store.products\n\t\tproducts.each do |product|\n\t\t\tputs \"Name: #{product.name} ---> Price: #{product.price}\"\n\t\tend\n\t\t@view.second_view(@current_user, @current_user.actions)\n\tend", "def index\n @provins = Provin.all\n end", "def index\n @admin_especies_catalogos = Admin::EspecieCatalogo.all\n end", "def index\n @produtors = Produtor.all\n end", "def index\n @prosumer_categories = ProsumerCategory.all\n end", "def show\r\n # @provider_masters = ProvierMaster.all\r\n end", "def index\n @usr_buyer_properties = UsrBuyerProperty.all\n end", "def index\n @profils = Profil.all\n end", "def profile_setting_list\n\t\t# find the home address\n\t\t@home_addresses = @profile_setting.addresses.where(address_type: \"home\")\n\tend", "def index\n @prod_categories = ProdCategory.all\n end", "def index\n @user_profs = UserProf.all\n end", "def index\n @shoppings = Shopping.all\n end", "def index\n if current_user.has_role? :admin\n @profiles = Profile.all\n else\n redirect_to root_path\n end\n end", "def index\n @volunteer_profiles = VolunteerProfile.all\n end", "def index\n if not ( paziente_signed_in? or administrator_signed_in?)\n redirect_to root_path and return\n end\n @profilopazientis = Profilopazienti.all\n end", "def index\n @admin_pay_programs = Admin::PayProgram.all\n end", "def index\n @provincials = Provincial.all\n end", "def index\n\t\t@cart_items = current_user.shoppingkarts \n\t\t#Shoppingkart.find(current_user)\n\tend", "def index\n @probandos = Probando.all\n end", "def index\n @prod_almas = ProdAlma.all\n end", "def index\n @profilsekolahs = Profilsekolah.all\n end", "def index\n @prodingrediants = Prodingrediant.all\n end", "def index\n @admin_vendors = Vendor.all\n end", "def index\n @products = @co.products\n end", "def index\n @products = @site.products.all\n end", "def index\n @admin_product_codes = ProductCode.all\n end", "def index\n @admin_product_details = ProductDetail.all\n end", "def index\n page = params[:page].to_i\n @admin_products = Product.page(page).per(10)\n end", "def index\n @products = Product.where(:store_id => current_merchant.store_name)\n end", "def index\n @proyectos_users = ProyectosUser.all\n end", "def index\n @shops = Shop.all\n end", "def index\n @shops = Shop.all\n end", "def index\n @shops = Shop.all\n end", "def index\n @shops = Shop.all\n end", "def index\n @shops = Shop.all\n end", "def index\n @admin_product_categories = ProductCategory.all\n end", "def index\n @men_shop_collections = MenShopCollection.all\n end", "def index\n @profiles = current_user.profiles\n end", "def index\n @profiles = current_user.profiles\n end", "def index\n @cleaners_profiles = Cleaners::Profile.all\n end", "def index\n @prod_cotis = ProdCoti.all\n end", "def index\n @store_products = StoreProduct.all\n end", "def show\n @products = @vendor.products\n end", "def index\n @pools = current_user.pools.all\n end", "def index\n if params[:major]\n @admin_profiles = City.find(session[:current_city_id]).commonplace.major\n else\n @admin_profiles = City.find(session[:current_city_id]).commonplace.city_councils_with_vice_major.page(params[:page])\n end\n\n end", "def index\n @products = current_user.products\n end", "def index\n @product_skus = ProductSku.all\n end", "def index\n @shopping_cart_entries = ShoppingCartEntry.where(user: current_user)\n end", "def index\n @professionals = Professional.all\n end", "def index\n @services = current_professional_user.services\n end", "def index\n \t_projects = Property.show_all_visible\n \tproj = _projects.collect{|p| p.name }.join(', ')\n \t\n \t@page_title = \"CebuCondoListings | Cebu Condominium Listings - #{proj}\" \n if logged_in?\n @properties = Property.show_all\n else\n @properties = Property.show_all_visible \n end\n end", "def index\n @product_configurations = ProductConfiguration.all\n end", "def index\n @partner_profiles = PartnerProfile.all\n end", "def index\n @product_option_typeships = ProductOptionTypeship.all\n end", "def products_list\n @products = Haiwet::Product.list\n @products.each.with_index(1) do |prod, i|\n puts \"#{i}- #{prod.name}\"\n end\n end", "def index\n @provisors = Provisor.all\n end", "def admin_store\n\t\t@store = current_store\n\t\t@stores = Store.all.page(params[:page]).per(10)\n\t\trender :layout => 'store_application'\n\tend", "def index\n @admintreatmentprocesstypes = Admintreatmentprocesstype.all\n end", "def index\n @donor_profiles = DonorProfile.all\n end", "def index\n @organizations = Spree::Organization.all\n end", "def index\n @prospies = Prospie.all\n end", "def index\n @provincia = Provincium.all\n end" ]
[ "0.7175174", "0.7106073", "0.67872", "0.6508945", "0.65019244", "0.64320713", "0.6283395", "0.6249125", "0.6203545", "0.61802864", "0.61369646", "0.61181664", "0.61077285", "0.61004853", "0.60818034", "0.60370815", "0.59947675", "0.59621936", "0.5961465", "0.5948527", "0.59406847", "0.59293866", "0.59015316", "0.58912873", "0.58629197", "0.5859578", "0.58525264", "0.5846025", "0.5831685", "0.5831305", "0.5813026", "0.57987475", "0.5793568", "0.57878876", "0.57857996", "0.57849544", "0.57810676", "0.5770927", "0.57658136", "0.576183", "0.5753859", "0.5723122", "0.57225144", "0.5715368", "0.5713718", "0.57085806", "0.5707399", "0.5698994", "0.5692697", "0.5692076", "0.56889224", "0.56834126", "0.5680897", "0.567944", "0.567157", "0.56705487", "0.56672037", "0.56656826", "0.56654084", "0.5664636", "0.566268", "0.56600565", "0.5658995", "0.56568503", "0.56513596", "0.5642485", "0.56379783", "0.56377846", "0.5635969", "0.5635969", "0.5635969", "0.5635969", "0.5635969", "0.56352365", "0.5633643", "0.56316805", "0.56316805", "0.5630887", "0.5628022", "0.561914", "0.56117713", "0.56104064", "0.5608278", "0.5605174", "0.56037503", "0.5595753", "0.5589541", "0.5588264", "0.5583916", "0.55832905", "0.5583268", "0.55783314", "0.557753", "0.55727404", "0.5565742", "0.5560638", "0.555822", "0.5557652", "0.55500674", "0.55495584" ]
0.5663388
60
Changing Status of a Shop Profile to Approved or Disapproved
def change_status authorize ShopProfile @shop = ShopProfile.find(params[:shop_profile_id]) #Calling method approve_shop from Model ShopProfile.approve_shop(@shop, flash) redirect_to request.referrer || root_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def approve\n @profile.approved = true\n @profile.save!\n redirect_to profiles_path(status: 'prohibited')\n end", "def approve!\n self.update_attribute(:status, ConfigCenter::User::APPROVED)\n end", "def prohibit\n @profile.approved = false\n @profile.save!\n redirect_to profiles_path(status: 'approved')\n end", "def approve_me\n self.update!(status: 'APPROVED')\n end", "def approve\n self.update(status: \"APPROVED\")\n end", "def approve!\n self.update_attribute(:status, APPROVED)\n self.registration.update_attribute(:status, Registration::VERIFIED) if self.registration\n end", "def approve\n #get profile, and profile owner\n presenter = find_presenter\n profile = presenter.presenter_profile\n \n #check status of profile\n #if waiting for admin approval\n if profile.status == \"pending_admin\"\n #check if logged in user is an admin\n if current_user.user_type == \"admin\"\n if profile.approve\n flash[:info] = \"This profile has been approved\"\n Notification.send_message(presenter.user, \"Your profile changes have been approved.\", presenter_profile_path(presenter), :system)\n redirect_to presenter_profile_path(presenter)\n else\n flash[:danger] = \"Something went wrong\"\n redirect_to presenter_profile_path(presenter)\n end\n \n else #Incorrect user\n flash[:info] = \"Profile changes are waiting for approval from admin.\"\n redirect_to root_url\n end\n\n #if waiting for profile owner approval\n elsif profile.status == \"pending_presenter\"\n #check if logged in presenter is profile owner\n if presenter == current_user.presenter\n if profile.approve\n flash[:info] = \"Your profile has been approved\"\n redirect_to presenter_profile_path(presenter)\n else\n flash[:danger] = \"Something went wrong\"\n redirect_to presenter_profile_path(presenter)\n end\n else #incorrect user\n flash[:info] = \"Profile changes are waiting approval from presenter\"\n redirect_to presenter_profile_path(presenter)\n end\n\n else #profile is already approved\n flash[:warning] = \"Profile is already approved\"\n redirect_to root_url\n end\n end", "def approve!\n update_attribute(:active, true)\n end", "def status\n @review = Review.find(params[:id])\n @review.update_attribute(:approved_id, current_user.id)\n flash[:info] = \"Review is approved!\"\n redirect_to admin_home_path\n end", "def update_payment_purchase_status\n if self.purchase.present?\n if self.status == 'confirmed'\n self.purchase.update(status: 'paid')\n elsif self.status == 'paid partially' && self.amount != self.purchase.grand_total\n self.purchase.update(status: 'paid partially')\n elsif self.status == 'paid partially' && self.amount == self.purchase.grand_total\n self.purchase.update(status: 'paid off (paid partially)')\n elsif self.status == 'pending'\n self.purchase.update(status: 'pending')\n elsif self.status == 'cancel'\n self.purchase.update(status: 'cancel')\n end\n end\n end", "def set_status\n if status.blank?\n if (consulted_legal) && (consulted_marketing)\n status = \"Pending Approval\"\n elsif (consulted_legal) && (!consulted_marketing)\n status = \"Awaiting Marketing Approval\"\n elsif (!consulted_legal) && (consulted_marketing)\n status = \"Awaiting Legal Approval\"\n elsif (!consulted_legal) && (!consulted_marketing)\n status = \"Awaiting Marketing & Legal Approval\"\n end\n end\n true # Needs to return true for the update to go through \n end", "def update\n if profile_params[:status] == \"Approved\" || profile_params[:status] == \"Rejected\"\n @profile.approved_by = \"#{current_user.first_name} #{current_user.last_name}\"\n else\n @profile.approved_by = \"\"\n end\n\n if profile_params[:status] == \"Pending\" # This condition sends an email if profile status is set to pending\n NotificationMailer.new_pending(@profile).deliver_now\n end\n\n respond_to do |format|\n if @profile.update(profile_params)\n if profile_params[:status] == \"Approved\"\n format.html { redirect_to profiles_url, notice: '*Profile was successfully approved.' }\n elsif profile_params[:status] == \"Rejected\"\n format.html { redirect_to profiles_url, notice: '*Profile was rejected.' }\n else\n format.html { redirect_to @profile, notice: '*Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n end\n if profile_params[:status] == \"Approved\" || profile_params[:status] == \"Rejected\"\n NotificationMailer.new_response(@profile).deliver_now\n end\n else\n @sections = Section.all\n @projects = Project.where(user_id: current_user.id)\n @employment = Employment.where(user_id: current_user.id)\n @education = Education.where(user_id: current_user.id)\n @certifications = Certification.where(user_id: current_user.id)\n @customs = Custom.where(user_id: current_user.id)\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def status\n \"approved\"\n end", "def approve!\n\t\tif self.status == \"active\"\n\t\t\traise \"ERROR in approving an already active member\"\n\t\telsif self.status == \"rejected\"\n\t\t\traise \"ERROR cannot approve rejected member\"\n\t\telse\n\t\t\tself.update!(status: \"active\")\n\t\tend\n\tend", "def approval_status\n self.approved? ? 'Approved ' : 'Pending '\n end", "def approve()\n if update_attributes({:level => Membership::LEVELS[:regular]})\n true\n else\n reload\n false\n end\n end", "def update_status!(stripe_account, new_status)\n stripe_account.reload\n stripe_account.status = new_status if stripe_account.status != \"active\"\n stripe_account.save!\n end", "def update!(**args)\n @approved = args[:approved] if args.key?(:approved)\n end", "def set_approval\n self.sanctuary? ? self.approved = false : self.approved = true\n end", "def success\n @listing = Listing.find(params[:listingId])\n @user = User.find(params[:userId])\n\n enum_change = Listing.find(params[:listingId])\n enum_change.update(sold: 'yes')\n enum_change.save\n end", "def disapprove\n self.approved = false\n end", "def admin_approve_user\n @user.update(approved: true)\n redirect_to admin_path, notice: \"User Approved\"\n end", "def change_status\n\t\tif status.include?(\"available\")\n\t\t\tstatus = \"checked_out\"\n\t\telsif status.include?(\"checked_out\")\n\t\t\tstatus = \"available\"\n\t\tend\n\tend", "def accept \n order = Order.find(params[:orderid])\n order.status = \"Accepted\"\n order.save!\n if order.artwork.sold == false\n order.artwork.toggle!(:sold)\n end\n Order.find_all_by_artwork_id(order.artwork.id).each do |f|\n if f.status != \"Accepted\"\n f.status = \"Declined\"\n f.save!\n end\n end\n redirect_to [:admin, User.find(params[:id])]\n end", "def approve_user\n # set the enabled flag to true for the user\n # send out approval notification\n end", "def approved?\n (status == APPROVED)\n end", "def approval_of_admin\n status = params[:status]\n @order = Order.find(params[:id])\n @order.update_attributes!(:status => status)\n @order_email = Order.find(params[:id])\n if status == \"5\"\n @reviewer = @order.reviews.last.user\n OrderMailer.admin_review_approved(@order_email, @reviewer).deliver_now\n elsif status == \"6\"\n @reviewer = @order.reviews.last.user\n OrderMailer.admin_review_rejected(@order_email,@reviewer).deliver_now\n user = User.find(@order.user_id)\n user_orders_count = user.orders.count\n if user_orders_count == 1\n @order.update_attributes!(:status => 7)\n end\n end\n redirect_to admin_reviewed_by_reviewer_path , :notice => \"Order successfully updated.\"\n end", "def update_status\n @user = User.find(params[:id])\n if params[:status]==\"Activate\"\n @user.update_attribute(:status,\"Active\")\n elsif params[:status]==\"Deactivate\"\n @user.update_attribute(:status,\"Deactive\")\n end\n department_id= !params[:department_id].blank? || !params[:department_id].nil? ? params[:department_id] : nil\n redirect_to(users_path(:department_id=>department_id), :notice => 'User Status has been successfully changed.')\n end", "def approve!\n self.approved = true\n self.save\n end", "def auto_approve\n user=photo.user or return nil\n if user.admin?\n photo.approver_id=user.id\n photo.status = Photo::STATUS_APPROVED\n end\n end", "def apply_approve\n \t# condition for check the cancelled flag then update flag as false else update only apply approve\n @product.cancelled ? @product.update(apply_approve: true,cancelled: false) : @product.update(apply_approve: true)\n @product.update(apply_approve: true)\n respond_to do |format|\n format.html { redirect_to publish_product_url(@product)}\n format.json { head :no_content }\n end\n end", "def approve\n @user.state = User::ENABLED\n @user.save\n \n respond_to do |format|\n format.html { redirect_to(registrations_users_path, :notice => \"User registration was successfully approved.\") }\n format.xml { head :ok }\n end\n end", "def approved?\n (status == ConfigCenter::User::APPROVED)\n end", "def inactivate\n self.status = \"Inactive\"\n end", "def update_payment_invoice_status\n if self.invoice.present?\n if self.status == 'confirmed'\n self.invoice.update(status: 'paid')\n elsif self.status == 'paid partially' && self.amount != self.invoice.grand_total\n self.invoice.update(status: 'paid partially')\n elsif self.status == 'paid partially' && self.amount == self.invoice.grand_total\n self.invoice.update(status: 'paid off (paid partially)')\n elsif self.status == 'pending'\n self.invoice.update(status: 'pending')\n elsif self.status == 'cancel'\n self.invoice.update(status: 'cancel')\n end\n end\n end", "def toggle_default_statuses\n @organization = Organization.find(status_params[:organization_id])\n if @organization.update_attributes(use_default_statuses: status_params[:checked])\n flash[:success] = \"Organization updated successfully.\"\n else\n flash[:alert] = \"Error updating organization.\"\n end\n\n set_status_variables\n end", "def auto_update_status \n if self.status == \"To Be Published\"\n self.status = \"Published\"\n end \n end", "def update_review_status(status, user)\n \n if status && status.id != self.review_status_id &&\n (self.review_status.name == 'Review On-Hold' ||\n self.review_status.name == 'In Review')\n\n self.record_update('Review Status', \n self.review_status.name, \n status.name,\n user)\n\n if self.review_status.name == 'Review On-Hold'\n self.remove_from_hold(status.id)\n elsif self.review_status.name == 'In Review'\n self.place_on_hold\n end\n self.save\n \n true\n else\n false\n end \n \n end", "def save\n self.approved = true\n super\n end", "def partially_verified\n update_attributes(:status => STATUS[:partially_verified])\n end", "def set_status\n @current_product.aasm_state = params[:status]\n\n if @current_product.save\n @product_status = @current_product.aasm_state\n else\n @object = \"Product\"\n render \"api/v1/errors/404\", status: 404\n end\n end", "def set_status\n @id=params[:id]\n @client = User.find(@id)\n @status = @client.status\n if @status == true\n @client.update_attributes(status: 'false')\n flash[:success] = \"Status upadated In-Active\"\n else\n @client.update_attributes(status: 'true')\n flash[:success] = \"Status updated Active\"\n end\n redirect_to clients_path\n end", "def changestatus\n @stud = Student.find(params[:stid])\n if @stud.status == \"Active\"\n @stud.status= \"Inactive\"\n @stud.save\n redirect_to root_path\n else\n @stud.status= \"Active\"\n @stud.save\n redirect_to root_path\n end\n end", "def inactivate!\n self.update_attribute(:status, \"Inactive\")\n end", "def pending!\n self.update_attribute(:status, ConfigCenter::User::PENDING)\n end", "def update\n @user = current_user\n @user.status = params[:user][:status]\n @user.save\n redirect_to :root\n end", "def toggle_status\n respond_to do |format|\n status = @invoice.pending? ? Invoice.statuses[:paid] : Invoice.statuses[:pending]\n if @invoice.update(status: status)\n format.html { render partial: 'invoices/invoice_actions', layout: false }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def setstatus!(status)\n if status == \"admin\"\n self.userstatus_id = 1\n elsif status == \"pro\"\n self.userstatus_id = 2\n elsif status == \"full\"\n self.userstatus_id = 3\n else\n self.userstatus_id = 4\n end\n end", "def set_status\n @id=params[:id]\n\t @country = Country.find(@id)\n\t @status = @country.status\n if @status == true\n \t@country.update_attributes(status: 'false')\n flash[:success] = \"Status upadated In-Active\"\n else\n @country.update_attributes(status: 'true')\n flash[:success] = \"Status update Active\"\n end\n redirect_to countries_path\n end", "def verified\n update_attributes(:status => STATUS[:verified])\n end", "def activate\n self.status = 'current'\n self.save\n end", "def status\n @post = Post.find(params[:id])\n @post.update_attribute(:approved_id, current_user.id)\n flash[:info] = \"Advertisement is approved!\"\n redirect_to admin_home_path\n end", "def toggle_status\n desired_status = @user.published? ? User::STATUS[:unpublished] : User::STATUS[:published]\n @page = params[:page] || 1\n if @user.toggle_status\n redirect_to(users_url(:page => @page), :notice => t(\"users.#{desired_status}_successfully\"))\n else\n redirect_to(users_url(:page => @page), :alert => t(\"users.cannot_#{desired_status}\"))\n end\n end", "def change_status\n\t\t@restaurant = Restaurant.find(params[:id])\n\t\t\n\t\tif params[:activate]\n\t\t\tactive = true\n\t\telsif params[:deactivate]\n\t\t\tactive = false\n\t\tend\n\t\t\n\t\tif @restaurant.update_attributes(active: active)\n\t\t\tflash[:success] = \"Restaurant status has been changed!\"\n\t\t\tredirect_to edit_restaurant_path(params[:id])\n\t\telse\n\t\t\tflash[:danger] = \"Unable to save changes.\"\n\t\t\tredirect_to edit_restaurant_path(params[:id])\n\t\tend\n\tend", "def is_approve\n order = current_user.customer.orders.find(params[:id])\n if order.status == \"Approved\"\n render json: {is_approve: true}\n elsif order.status == \"Declined\"\n render json: {is_approve: false}\n else\n render json: {is_approve: nil}\n end\n end", "def update\n\t\t@shop = current_user.shop_profiles.find(params[:id])\n\t\tauthorize @shop\n\t\tif @shop.update_attributes(shop_params) and @shop.address.update_attributes(address_params_shopkeeper) \n\t\t\tflash[:success] = 'Updated Successfully'\n\t\t\tredirect_to shop_profiles_path\n\t\telse\n\t\t\tflash[:danger] = 'Shop Details not Updated'\n\t\t\trender 'edit'\n\t\tend\n\tend", "def set_status\n\t @id=params[:id]\n\t @state = State.find(@id)\n\t @status = @state.status\n if @status == true\n @state.update_attributes(status: 'false')\n flash[:success] = \"Status upadated In-Active\"\n else\n @state.update_attributes(status: 'true')\n flash[:success] = \"Status updated Active\"\n end\n redirect_to states_path\n end", "def update_profile_complete(status)\n update_column(:profile_complete, status)\n end", "def activate_user(user)\n user.status_id=0\n user.save\n end", "def approve\n if self.status == \"pending_presenter\" || self.status == \"pending_admin\"\n \n #move edit columns to permanent columns\n self.bio = self.bio_edit\n if self.picture_edit_stored?\n self.picture = self.picture_edit\n end\n\n #clear edit columns\n self.bio_edit = ''\n self.picture_edit = nil\n \n #update status to approved\n self.status = :approved\n return self.save\n else\n return false\n end\n end", "def set_admin_promo\n @admin_promo = Admin::Promo.find(params[:id])\n @admin_promo.update(approval: false) unless @admin_promo.is_expired\n end", "def approve!\n raise 'not pending' unless self.status == 'PENDING'\n\n transaction do\n self.status = 'APPROVED'\n self.save!\n overlapping_pending_requests.update_all(status: 'DENIED')\n end\n end", "def activate!\n update_attribute(:status, STATUS[:active])\n end", "def approval_status\n if object.approval\n \"Zaakceptowane\"\n elsif object.approval == nil\n \"Oczekujące\"\n else\n \"Odrzucone\"\n end\n end", "def confirm\n approval = Approval.find_by(id: params[:id])\n approval.approval = true\n approval.save\n redirect_to users_path\n end", "def can_update?\n if [\"approved\"].include? state\n false\n else\n true\n end\n end", "def active!\n self.update_attribute(:status, ACTIVE)\n end", "def activate!\n self.update_attribute(:status, \"Active\")\n end", "def update\n @user = current_user\n\n ## Update other fields\n %w(billing_cycle billing_cycle_start_date is_profile_complete is_verified_email approval_status).each do |f|\n params[:user].delete(f)\n end\n\n @user.is_profile_complete = 'yes'\n if @user.update_attributes(params[:user])\n sign_in @user, :bypass => true\n respond_to do |format|\n format.json { render :json => {\"user\" => @user.as_json}, :status => :created }\n end\n else ## error when save\n respond_to do |format|\n format.json { render json: @user.errors.full_messages, :status => :bad_request }\n end\n end\n end", "def set_to_approved\n if self.rating > 3\n self.update_attribute('approved', true)\n end\n @project = Project.find(self.project_id)\n @project.update_attribute('has_reviewed_contractor', true)\n end", "def approve\n order = current_user.restaurant.orders.find(params[:id])\n order.update(status: 1)\n render json: {is_success: true}, status: :ok\n end", "def edit_req_usecase\n @user=find_user\n if !@user.nil?\n\n status=@use_case.status\n if ((status!=\"Approved\" and params[:use_case][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Read/Write/Approve\" or @user.privilige==\"Approve\")) or (status!=\"Approved\" and params[:use_case][:status]!=\"Approved\" and (@user.privilige!=\"Read\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:use_case][:status]==\"Approved\" and !params[:use_case][:delivered].empty? and @user.privilige!=\"Read\"))\n @use_case.update_attributes(params[:use_case])\n\n if !params[:use_case][:status].nil?\n if (status!=\"Approved\" and params[:use_case][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(@user.id)\n UseCase.notification_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status!=\"For Review\" and params[:use_case][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_reviewed(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_reviewed(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status==\"Approved\" and params[:use_case][:status]!=\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_no_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_no_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n end\n end\n respond_to do |format|\n assign_project_use\n @attr=Attribute.find_by_project_id(session[:project_id])\n @requirement=Requirement.find(session[:req_id])\n if !@requirement.nil?\n format.html { redirect_to show_usecases_url(@requirement.id) }\n else\n format.html { redirect_to requirements_path }\n end\n end\n\n else\n assign_project_use\n @attr=Attribute.find_by_project_id(session[:project_id])\n flash[:notice]= t(:use_case_no_approve)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end", "def update_appeal_state_on_status_change\n update_appeal_state_when_ihp_cancelled\n update_appeal_state_when_ihp_completed\n update_appeal_state_when_privacy_act_cancelled\n update_appeal_state_when_privacy_act_complete\n update_appeal_state_when_appeal_cancelled\n end", "def update\n @request = Request.find(params[:id])\n\n if params['approved']\n @request.status = Request.statuses[:approved]\n elsif params['denied']\n @request.status = Request.statuses[:denied]\n end\n\n if @request.update_attributes(update_params)\n Mailer.mail_status(@request).deliver_later\n redirect_to employee_requests_path\n else\n render 'show'\n end\n end", "def auto_approve\n if !self.auto_approved && self.approval_status.nil?\n UserMailer.auto_approved_email(self).deliver\n self.auto_approved = true\n self.approval_status = true\n self.save\n end\n end", "def toggle_status\n @offer.toggle_status\n\n respond_to do |format|\n format.html { redirect_to admin_offers_url,\n notice: 'Offer status was updated.' }\n format.json { render :show, status: :ok, location: @offer }\n end\n end", "def update_user_status\n @user = User.find params[:id]\n @user.update(user_status: params[:status])\n end", "def mark_as(status)\n self.status = status\n self.save\n end", "def approved?\n status == STATUS_APPROVED\n end", "def edit_tracker_usecase\n @user=find_user\n if @user.nil?\n status=@use_case.status\n if ((status!=\"Approved\" and params[:use_case][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Read/Write/Approve\" or @user.privilige==\"Approve\")) or (status!=\"Approved\" and params[:use_case][:status]!=\"Approved\" and (@user.privilige!=\"Read\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:use_case][:status]==\"Approved\" and !params[:use_case][:delivered].empty? and @user.privilige!=\"Read\"))\n @use_case.update_attributes(params[:use_case])\n\n if !params[:use_case][:status].nil?\n if (status!=\"Approved\" and params[:use_case][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status!=\"For Review\" and params[:use_case][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_reviewed(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_reviewed(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status==\"Approved\" and params[:use_case][:status]!=\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_no_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_no_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n end\n end\n respond_to do |format|\n @attr=Attribute.find_by_project_id(session[:project_id])\n if !session[:tracker_id].nil?\n @tracker=Tracker.find(session[:tracker_id])\n format.html { redirect_to show_tracker_use_url(@tracker.id) }\n else\n format.html { redirect_to trackers_path }\n end\n end\n\n else\n @attr=Attribute.find_by_project_id(session[:project_id])\n flash[:notice]= t(:use_case_no_approve)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end", "def activate\n if @user.inactive? && @user.created_by_admin?\n if @user.is_regular? && @user.profile.penultimate_step_complete?\n @user.activate!\n @user.save_profinda_profile\n render json: { status: 'active' }\n elsif @user.is_external? && @user.profile.first_step_completed?\n @user.activate!\n render json: { status: 'active' }\n else\n render json: { status: 'user can\\'t be activate' }\n end\n else\n render json: { status: 'user is active' }\n end\n end", "def update_status\n do_load_resource\n do_authorize_instance\n\n update_status_user_check\n end", "def check_status(cart)\n if cart.verify == 0\n 'Pending'\n elsif cart.verify == 1\n 'Accept'\n elsif cart.verify == 2\n 'Decline'\n end\nend", "def approve_org\n @organization = Organization.find(params[:id])\n if admin_user_signed_in?\n @organization.approved = true\n if @organization.save\n flash[:notice] = \"#{@organization.name} approved\"\n else \n \n end\n redirect_to '/admin'\n end\n end", "def update_profile_photo_and_photo_id_status\n self.profile_photo_status = SadhakProfile.profile_photo_statuses.pp_pending\n self.photo_id_status = SadhakProfile.photo_id_statuses.pi_pending\n end", "def approve\n transition_to :approved\n end", "def toggle_status\n @judge = Judge.find(params[:id])\n authorize @judge\n\n if @judge.active?\n @judge.update_attribute(:status, \"removed\")\n else\n @judge.update_attribute(:status, \"active\")\n end\n redirect_back(fallback_location: result_competition_path(@judge.competition))\n end", "def zenodoupdate\n authorize @user\n respond_to do |format|\n if @user.update(user_zenodo_param)\n @user.create_activity :update, owner: current_user\n ztchoice = params[:user][:profile_attributes][:zenodotokenchoice]\n puts \"ztchoice\", ztchoice\n if ztchoice=='1'\n ztchoice = true\n else\n ztchoice = false\n end \n @user.profile.zenodotokenchoice = ztchoice\n @user.save \n format.html { redirect_to @user, notice: 'Profile zenodo choice was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n format.js { head :ok, location: @user }\n else\n format.html { render :zenodoedit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n format.js { head :unprocessable_entity }\n end\n end\n end", "def change_is_enabled\n member = Member.find params[:id]\n user = User.find(member.user_id)\n Member.change_student_status(member)\n if member.is_enabled == true\n redirect_to users_url, :flash => { :success => \"#{user.first_name} #{user.last_name} has been enabled.\" }\n else\n redirect_to users_url, :flash => { :success => \"#{user.first_name} #{user.last_name} has been disabled.\" }\n end\n end", "def approve!\n self.approved_at = Time.now\n registration.approve\n save!\n end", "def change_status\n @user = User.find(params[:data])\n\n respond_to do |format|\n if @user.update_attributes(status: params[:status])\n format.json { render json: @user }\n else\n format.json { render json: @user.errors.messages, status: :unprocessable_entity }\n end\n end\n end", "def is_approved?\n self.approved == 'approved'\n end", "def status\n if params[:deactivate_id]\n User.update(params[:deactivate_id],:status=>\"Deactive\")\n @user=User.all\n render :update do |page|\n page.replace_html 'userlist', :partial => 'home/status_change', :object=>@user, :layout => false\n end\n else\n User.update(params[:activate_id],:status=>\"Active\")\n @user=User.all\n render :update do |page|\n page.replace_html 'userlist', :partial => 'home/status_change', :object=>@user, :layout => false\n end\n end\n end", "def success?\n @status == \"APPROVED\"\n end", "def toggle_notification\n if params[:status].present?\n @user.update(notification_status: params[:status])\n if @user.errors.any?\n render json: user.errors.messages, status: 400\n else\n render json: { message: 'Notification status updated successfully!' }, status: 200\n end\n else\n render json: { message: 'Please set status' }, status: 400\n end\n end", "def update_status\n case @part.status\n when 'Unstarted'\n @part.status = 'Started'\n @part.user = current_user\n @part.bitbucket.post_user(current_user.email) if @part.name == 'Prototype'\n @part.create_activity key: 'part.started', owner: current_user\n @part.start_rep_points\n when 'Started'\n @part.status = 'Finished'\n @part.create_activity key: 'part.finished', owner: current_user\n when 'Finished' \n @part.status = 'In Review'\n @part.create_activity key: 'part.in_review', owner: current_user\n when 'In Review'\n @part.status = 'Accepted'\n @part.accepted_rep_points\n @part.create_activity key: 'part.accepted', owner: current_user\n end\n @part.save\n redirect_to :back\n end", "def pro?\n status?(UserStatuses::PRO) || status?(UserStatuses::PREMIUM)\n end", "def change_status(object, status)\n object.update_attribute :status, status\n end", "def toggled_status\n @users = User.find(params[:id])\n @users.status = !@users.status?\n @users.update_column(:status,@users.status)\n @users.update_column(:updated_at,Time.zone.now)\n # Update Nominee status as well \n @nominee = Nominee.find_by_user_id(params[:id])\n unless @nominee.nil?\n @nominee.status = @users.status\n @nominee.updated_at = Time.zone.now\n @nominee.save\n end\n redirect_to :back\n UserMailer.user_status_mail(@users).deliver \n end", "def change_status_to_in_progress\n user = User.find_by(id: params[:user_id])\n user.send_issue_assigned_email\n issue = Issue.find_by(id: params[:id])\n expert = User.find_by(id: params[:expert_id])\n issue.update_attributes(status: \"inprogress\", expert_id: expert.id)\n flash[:success] = \"Issue status changed to in progress! Assigned to #{expert.username}\"\n redirect_to issues_path\n end" ]
[ "0.73740405", "0.71982944", "0.7121713", "0.70578563", "0.6901096", "0.6889874", "0.67824244", "0.67653364", "0.6623727", "0.6538617", "0.6535128", "0.6463564", "0.6462462", "0.64054704", "0.63577175", "0.634895", "0.6343886", "0.6298567", "0.6297889", "0.62971133", "0.62943745", "0.6258346", "0.62575203", "0.6238735", "0.6204132", "0.61979485", "0.6169783", "0.6145647", "0.6142421", "0.61350566", "0.6127619", "0.61236495", "0.6109805", "0.6092079", "0.60838574", "0.6077852", "0.6069468", "0.60605496", "0.60600936", "0.605971", "0.60562414", "0.6055749", "0.6053305", "0.60491574", "0.60462195", "0.6034524", "0.60312295", "0.60252714", "0.6013746", "0.60082585", "0.6002099", "0.59865445", "0.5976877", "0.59559643", "0.5937661", "0.5937441", "0.593672", "0.5928898", "0.5914605", "0.5913532", "0.59116495", "0.5909944", "0.59090245", "0.5906115", "0.5902847", "0.59025073", "0.5899974", "0.5891727", "0.5890206", "0.5864432", "0.58542204", "0.58498365", "0.58492815", "0.5845128", "0.5844041", "0.5838221", "0.58339816", "0.58282566", "0.5822213", "0.5820597", "0.58137536", "0.5811611", "0.58115613", "0.580788", "0.58014154", "0.57998407", "0.5798026", "0.579548", "0.5793405", "0.57930225", "0.57906926", "0.57850975", "0.578311", "0.57826024", "0.5779813", "0.57670456", "0.57665324", "0.5763478", "0.5760105", "0.57548004" ]
0.7957978
0
returns next wednesday from current date
def next_wednesday date = self while !date.wednesday? date = date.next end date end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_weekday(weekday = 2)\n date = Date.today\n unless date.strftime(\"%w\") == weekday.to_s\n date += 1 + ((weekday -1 -date.wday) % 7)\n end\n date\n end", "def next_weekday\n if next_day.on_weekend?\n next_week(:monday, same_time: true)\n else\n next_day\n end\n end", "def next_weekday\n if next_day.on_weekend?\n next_week(:monday, same_time: true)\n else\n next_day\n end\n end", "def get_next_date_for_next_weekday(week_day)\n DateTime.now + days_to_add(week_day)\nend", "def wednesday\n day(:wednesday)\n end", "def next_week(day = :monday)\n days_into_week = { :monday => 0, :tuesday => 1, :wednesday => 2,\n :thursday => 3, :friday => 4, :saturday => 5,\n :sunday => 6 }\n since(1.week).beginning_of_week.since(days_into_week[day].day).change(:hour => 0)\n end", "def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n date + delta\n Chronic.parse(\"0 next #{day}\").to_datetime\n end", "def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n date + delta\n end", "def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n\n return date + delta\n end", "def find_next_week\n if @schedule.days == 0\n date = @date + ((@schedule.start_date.wday - @date.wday) % 7) + (7 * ((@schedule.start_date - @date) % @schedule.period_num))\n return date\n else\n date = @date + find_next_in_bitmask(@schedule.days, @date.wday, 7)\n\n if @date.wday >= bitmask(@schedule.days).length\n date += periods_to_add * 7\n end\n\n return date\n end\n end", "def date_of_next(day)\n\t day_required = DateTime.parse(day)\n\t delta = day_required > DateTime.now ? 0 : 7\n\t (day_required + delta)\n\tend", "def next_day\r\n if @next_day.nil?\r\n @next_day = convert_day_to_date(current_day).tomorrow.strftime('%Y%m%d')\r\n end\r\n @next_day\r\n end", "def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n date + delta\nend", "def get_next_monday(time)\n time + (7 - time.get_int_wday) * 60 * 60 * 24\n end", "def next_occurring(day_of_week)\n from_now = DAYS_INTO_WEEK.fetch(day_of_week) - wday\n from_now += 7 unless from_now > 0\n advance(days: from_now)\n end", "def date_of_next(day)\r\n date = Date.parse(day)\r\n delta = date > Date.today ? 0 : 7\r\n date + delta\r\nend", "def first_wday; (wday - day + 1) % 7 end", "def next_working_date(date)\n cwday = date.cwday\n days = 0\n while non_working_week_days.include?(((cwday + days - 1) % 7) + 1)\n days += 1\n end\n date + days\n end", "def next(day)\n x_weeks_from_day(1, day)\n end", "def find_next_day\n day = @date.to_date + ((@schedule.start_date - @date.to_date) % @schedule.period_num)\n return day\n end", "def nth_wday_day(w,d)\n 1 + (d - (wday - day + 1)) % 7 + w * 7\n end", "def next_weekday(date, weekdays)\n [weekdays].flatten.map{|wd| \n nwd = date - date.cwday + Date::WEEKDAYS.index(wd) + 1\n nwd += 7 if nwd <= date\n nwd\n }.sort[0]\n end", "def next_day(date, number_of_day)\n date += 1 + (((number_of_day-1)-date.wday) % 7)\n end", "def next_sunday(due_to_date)\n\t\t\tright_now = Time.zone.now\n\t\t\tright_now += 6.days if right_now <= due_to_date # approximation should be fine, ignore edge cases for now\n return right_now + (7 - right_now.wday).days + (22 - right_now.hour).hours + (0 - right_now.min).minutes + (0 - right_now.sec).second\n\t end", "def get_week_day(date)\n # If date is in the future, use today's date\n date_to_use = date\n if date_to_use > Date.today\n date_to_use = Date.today\n end\n\n # If date is on weekend, get previous Friday\n offset = 0\n if date_to_use.wday == 0\n offset = 2\n end\n if date_to_use.wday == 6\n offset = 1\n end\n date_to_use - offset\n end", "def next_week_in weeks\n Week.find_by(initial_day: initial_day+( weeks * 7.days))\n end", "def next_weekday(direction, abbreviated_weekday)\n count = direction.downcase == 'n' ? 1 : -1\n\n weekday = WEEKDAYS[abbreviated_weekday.downcase]\n raise \"No valid weekday: #{abbreviated_weekday}\" if weekday.nil?\n\n offset = @now.send(\"#{weekday[1]}?\") ? count * 7 : 0\n @now + (weekday[0] - @now.wday + 7) % (count * 7) + offset\n end", "def each_wednesday(n=1, offset=0, dur=1); each_wdays(self.Wed,n,offset,dur); end", "def next_game_date(dt, wday)\n dt += 1 until (wday == dt.wday && !@exclude_dates.include?(dt)) || @include_dates.include?(dt)\n dt\n end", "def timezone_next_friday(timezone_name)\n tz = TZInfo::Timezone.get(timezone_name)\n today = trim_to_start_of_day(tz.now.to_datetime)\n offset = 5 - today.cwday\n offset += 7 if offset < 0 # role to next week\n return today + offset\n end", "def nth_wday; (day - 1) / 7 end", "def wday() end", "def wday() @m_date.wday end", "def thiscoming(day) # day is an index\n if dayindex < day\n x_weeks_from_day(0, day)\n else\n x_weeks_from_day(1,day) # the day is next week\n end\n end", "def next_game_date(date_time, wday)\n date_time += 1 until (wday == date_time.wday &&\n !@exclude_dates.include?(date_time)) || @include_dates.include?(date_time)\n date_time\n end", "def next_day(date)\n date + (60 * 60 * 24)\n end", "def next_week(given_day_in_next_week = Date.beginning_of_week, same_time: false)\n result = first_hour(weeks_since(1).beginning_of_week.days_since(days_span(given_day_in_next_week)))\n same_time ? copy_time_to(result) : result\n end", "def next_week(given_day_in_next_week = Date.beginning_of_week, same_time: false)\n result = first_hour(weeks_since(1).beginning_of_week.days_since(days_span(given_day_in_next_week)))\n same_time ? copy_time_to(result) : result\n end", "def getMonday(date)\n\t\tunless date.nil?\n\t\t\t#the day of calendar week (1-7, Monday is 1)\n\t\t\tday1_diff = date.cwday%7 - 1\n\t\t\t#date -= day1_diff if day1_diff != 0\n\t\t\tdate -= day1_diff == -1 ? 6 : day1_diff\n\t\tend\n\t\tdate\n\tend", "def get_next_date\n today_wday = Date.today.wday\n wday_s = get_weekday(limit_weekday_start)\n wday_e = get_weekday(limit_weekday_end)\n if(wday_s < wday_e)\n if(today_wday > wday_e or today_wday < wday_s or(today_wday == wday_s and Time.now.hour < limit_time_start) or (today_wday == wday_e and Time.now.hour > limit_time_end))\n need_day = (wday_s + 7 - today_wday)%7\n return Time.parse(limit_time_start.to_s + \":00\", Time.now + need_day.day), true\n else\n need_day = wday_e - today_wday\n return Time.parse(limit_time_end.to_s + \":00\", Time.now + need_day.day), false\n end\n else\n if((wday_e < today_wday and today_wday < wday_s) or (today_wday == wday_s and Time.now.hour < limit_time_start) or (today_wday == wday_e and Time.now.hour > limit_time_end))\n need_day = wday_s - today_wday\n return Time.parse(limit_time_start.to_s + \":00\", Time.now + need_day.day), true\n else\n need_day = (wday_e + 7 - today_wday)%7\n return Time.parse(limit_time_end.to_s + \":00\", Time.now + need_day.day), false\n end\n end\n end", "def day_of_week\n dnum = day\n dnum -= 10 if dnum > 20\n dnum -= 10 if dnum > 10\n dnum -= 1\n dnum\n end", "def next_day_at_midnight\n Time.parse(self.strftime('%Y-%m-%d')) + (24*60*60)\n end", "def day_of_week(date)\n 7 - date.cwday\n end", "def thursday\n day(:thursday)\n end", "def next_day\n advance(days: 1)\n end", "def next_week\n if self.class == Date\n self + 7\n elsif self.class == Time\n self + (60 * 60 * 24 * 7)\n end\n end", "def next_week\n if self.class == Date\n self + 7\n elsif self.class == Time\n self + (60 * 60 * 24 * 7)\n end\n end", "def day_of_week\n # Zellers: 0 = Saturday, 1 = Sunday, 2 = Monday, ..., 6 = Friday\n # day_of_week: 1 = Sunday, 7 = Saturday\n (zellers_congruence + 6) % 7\n end", "def cwday() \n _wday = @m_date.wday\n return 7 if _wday == 0\n \n return _wday\n end", "def test_start_of_week(p_date)\n if p_date.wday == 0 #sundays count as end of week for vehicle app\n return p_date - 6\n else\n (p_date - p_date.wday.days) + 1 #start on monday\n end\n end", "def next_demo_day\n DemoDay.where(['day > ?', self.day]).order('day ASC').first\n end", "def week_from_now\n current_time = Time.now\n beginning_of_hour = current_time.change(:hour => current_time.hour)\n beginning_of_next_hour = beginning_of_hour - 4.hours # Include offset for EST -0500\n beginning_of_next_hour + 1.week\n end", "def week(date = Date.today)\n day = monday(date)\n (day..day + 6)\n end", "def next_day(days = 1)\n advance(days: days)\n end", "def get_start_of_week(d)\n d -= DAY until d.monday?\n d\n end", "def next_working_day(date_time)\n date_time = date_time + 1\n while !working_day?(date_time)\n date_time = date_time + 1\n end\n date_time\n end", "def day_after day\r\n return convert_day_to_date(day).tomorrow.strftime('%Y%m%d')\r\n end", "def monday(date = Date.today)\n today = date\n day = today.wday\n diff = case day\n when 0\n 6\n when 1..6\n day - 1\n end\n today - diff\n end", "def to_weekday_if_weekend(date)\n date += 1 if date.wday == 0\n date -= 1 if date.wday == 6\n date\n end", "def day_to_wdiw( day )\n\t\tk = offset( first_day.cwday )\n\t\td = day + k - 1\n\t\tw = d / DPW\n\t\tdiw = d % DPW\n\n\t\t[ w, diw ]\n end", "def next_day(time, day, future: true)\n time.is_a?(String) && time = ::Time.zone.parse(time)\n from = ::Date::DAYS_INTO_WEEK[day_name] * SECONDS\n days = ::Date::DAYS_INTO_WEEK[day.to_sym]\n to = (future && days.zero? ? 7 : days) * SECONDS\n\n ::Time.zone.today.beginning_of_day\n .advance(seconds: (to - from) + time.seconds_since_midnight)\n end", "def day_of_week\n\tif @current_time.wday == 0 || @current_time.wday == 6\n\t\tweek_period = \"Weekends\"\n\telse\n\t\tweek_period = \"Weekdays\"\n\tend\nend", "def first_weekday_after_date(desired_weekday, date)\n offset = offset_of_first_weekday_after_weekday(desired_weekday, day_of_week(date))\n date + offset\nend", "def nwday_day(n)\n w = n % 7\n 1 + (w - (wday - day + 1)) % 7 + n - w\n end", "def get_next_date(current_date,date)\n date = date.gsub(\",\",\"\")\n date = date.gsub(\" \",\"-\")\n arr = date.split(\"-\")\n if !((current_date.mday == 31 && (current_date.mon == 1 || current_date.mon == 3 || current_date.mon == 5 || current_date.mon == 7 || current_date.mon == 8 || current_date.mon == 10 || current_date.mon == 12)) || (current_date.mday == 30 && (current_date.mon == 4 || current_date.mon == 6 || current_date.mon == 9 || current_date.mon == 11)) || (current_date.mday == 28 && current_date.mon == 2))\n newDay = arr[2].to_i + 1\n if newDay < 10\n newDay = \"0\" + newDay.to_s()\n end\n newDate = arr[1] + \"-\" + newDay.to_s() + \"-\" + arr[3]\n else\n newDate = arr[1] + \"-\" + arr[2]+ \"-\" + arr[3]\n end\n end", "def date_of_next_week_count(find_week)\n current = Time.current\n week_count = find_week_count(current)\n while week_count != 1\n current += 1.week\n week_count = find_week_count(current)\n end\n\n while week_count != find_week\n current += 1.week\n week_count = find_week_count(current)\n end\n\n current.strftime('%Y-%V')\n end", "def next_week(x = 1)\n\t\tself + (604800 * x)\n\tend", "def next_date\n if(!@previous_date)\n @previous_date = @start_date\n return @previous_date\n end\n \n previous = @previous_date>>1\n last_week_start = Time::CommonYearMonthDays[next_date.month] - 7\n case @frequency\n when \"first\"\n next_date = Date.new(d=1, y=next_date.year, m=next_date.month)\n when \"second\"\n next_date = Date.new(d=7, y=next_date.year, m=next_date.month)\n when \"third\"\n next_date = Date.new(d=14, y=next_date.year, m=next_date.month)\n when \"last\"\n next_date = Date.new(d=last_week_start, y=next_date.year, m=next_date.month)\n else\n return (previous_date>>1)\n end\n \n next_date.step(next_date+7, 1) do |date|\n return date if days_of_the_week.any(date.day)\n end\n end", "def wday\n @date_time_value.wday\n end", "def nth_wday_of_month(w, d)\n self + (nth_wday_day(w, d) - day).days\n end", "def end_of_week; self + (6 - wday).days end", "def wday\n return self.to_a[IDX_WDAY]\n end", "def find_monday date\n date.monday? ? date : find_monday(date - 1)\n end", "def day_of_week(date)\n date.cwday # cwday returns the day of calendar week (1-7, Monday is 1).\nend", "def wday\n components.weekday - 1\n end", "def getSunday(date)\n\t\tunless date.nil?\n\t\t\tday7_diff = 7 - date.cwday%7\n\t\t\tdate += day7_diff == 7 ? 0 : day7_diff\n\t\tend\n\t\tdate\n\tend", "def first_wday\n @first_dow ||= 7\n end", "def tomorrow()\n \n self.day(Time.now + 1.days)\n \n end", "def each_thursday( n=1, offset=0, dur=1); each_wdays(self.Thu,n,offset,dur); end", "def weekday(weekday)\n case weekday\n when 'tod'\n @now\n when 'tom'\n @now + 1\n when 'y'\n @now - 1\n end\n end", "def start_of_this_week\n now = Date.today\n sunday = now - now.wday\nend", "def date_tomorrow\n tomorrow = Date.today + 1\n tomorrow.strftime('%A, %b %d')\nend", "def select_week_of date\n monday = date - date.wday + 1\n friday = monday + 4\n select_range(monday, friday)\n end", "def days_to_add(desired)\n # c is current day of week, d is desired next day of week\n # f( c, d ) = g( c, d ) mod 7, g( c, d ) > 7\n # = g( c, d ), g( c, d ) <= 7\n # g( c, d ) = [7 - (c - d)] = 7 - c + d\n # where 0 <= c < 7 and 0 <= d < 7\n n = (7 - DateTime.now.wday + desired);\n (n > 7) ? n % 7 : n\nend", "def addDays(date)\n\n #puts 'in addDays'\n #puts date\n if date.saturday? then\n #puts \"sat\"\n date1 = date.next_day(7)\n return date1\n elsif date.sunday? then\n #puts \"sun\"\n date1 = date.next_day(8)\n return date1\n else\n #puts 'other'\n date1 = date.next_day(7)\n end\n return date1\n end", "def day_of_week\n Date::DAYNAMES.fetch(recurring_event.day).downcase.to_sym\n end", "def first_weekday_at_or_after_date(desired_weekday, date)\n offset = offset_of_first_weekday_at_or_after_weekday(desired_weekday, day_of_week(date))\n date + offset\nend", "def beginning_of_week\n (self - self.wday.days).midnight + 1.day\n end", "def next_opens\n opening_time.advance(weeks: 1)\n end", "def offset_of_first_weekday_at_or_after_weekday(desired_weekday, current_weekday)\n (desired_weekday - current_weekday + 7) % 7\nend", "def start_of_week; self - wday.days end", "def working_days_from_date(date)\r\n date = date + 1.day if date.cwday == 6\r\n day_of_the_week = date.cwday == 7 ? 0 : date.cwday\r\n calendar_days, business_days = self, self\r\n result_date = day_of_the_week + business_days\r\n if (result_date >= 6)\r\n business_days -= (6 - day_of_the_week)\r\n calendar_days += 2\r\n weeks = business_days / 5\r\n calendar_days += (weeks * 2)\r\n end\r\n date + calendar_days.days\r\n end", "def day_of_week\n # Date.wday returns 0-6 for Sunday,...Saturday\n return @day.wday\n end", "def next_weekday_in(weekday_abbreviation, direction, count, distance)\n count = direction.downcase == 'b' ? -count.to_i : count.to_i\n weekday = WEEKDAYS[weekday_abbreviation.downcase]\n\n case distance.downcase\n when \"d\"\n when \"w\"\n (@now + count * 7) + weekday[0] - @now.wday \n when \"m\"\n future = @now >> count\n future + weekday[0] - future.wday\n when \"y\"\n future = @now >> count * 12\n future + weekday[0] - future.wday\n end\n end", "def previous_dow(dow, date = Date.today)\n target_day = Date::DAYNAMES.index(dow.to_s.capitalize)\n\n raise ArgumentError, \"Bad DOW: #{dow}\" if target_day.nil? \n raose ArgumentError, \"Bad DATE: #{date.class}\" unless date.is_a? Date\n\n result = date.prev_day\n result = result.prev_day until result.wday == target_day\n\n result\nend", "def tomorrow\n advance(days: 1)\n end", "def next\n week = Week.where('number > ? AND setup_id = ?', self.number, self.setup_id).order(number: :asc).first\n week && week.is_visible? ? week : nil\n end", "def to_weekday_if_boxing_weekend(date)\n if date.wday == 6 || date.wday == 0\n date += 2\n elsif date.wday == 1\n date += 1\n end\n\n date\n end", "def prev_occurring(day_of_week)\n ago = wday - DAYS_INTO_WEEK.fetch(day_of_week)\n ago += 7 unless ago > 0\n advance(days: -ago)\n end", "def wday\n to_g.wday\n end" ]
[ "0.787096", "0.78274405", "0.78274405", "0.77540743", "0.7439524", "0.73969996", "0.73674405", "0.7300648", "0.7283888", "0.72757596", "0.72629964", "0.7194018", "0.71866417", "0.7171831", "0.7162202", "0.7143157", "0.70982337", "0.7096239", "0.7072825", "0.7052127", "0.70347893", "0.70157194", "0.70044583", "0.6945233", "0.6920446", "0.6893537", "0.68217456", "0.67942125", "0.6787724", "0.67820317", "0.67808235", "0.6749665", "0.67348623", "0.6693925", "0.66924113", "0.6686385", "0.6676545", "0.6676545", "0.66525626", "0.66419744", "0.6636652", "0.66160154", "0.65843856", "0.6554951", "0.6552069", "0.6521977", "0.6521977", "0.65191424", "0.64997315", "0.6430356", "0.64187086", "0.6416509", "0.6413162", "0.63661116", "0.63658506", "0.6346413", "0.6328121", "0.6325782", "0.62995714", "0.6296802", "0.62966317", "0.6293903", "0.6288537", "0.6279155", "0.62599796", "0.6251826", "0.6240532", "0.62398386", "0.62357664", "0.6232256", "0.6231096", "0.62228495", "0.62226874", "0.6221352", "0.62181693", "0.61983997", "0.6181223", "0.61772203", "0.61720026", "0.61704487", "0.6170435", "0.6153456", "0.6142129", "0.6133042", "0.61329424", "0.6129988", "0.61296415", "0.6106514", "0.60963225", "0.6090762", "0.60904765", "0.6086129", "0.6079673", "0.6071026", "0.6062577", "0.60485256", "0.6039829", "0.6019975", "0.60185146", "0.6015261" ]
0.8511923
0
This method is there to ensure minimal requirements are met (directories are accessible, table exists, connected to server, ...)
def prepare namespace = @config[:namespace] || 'merb-cache' host = @config[:host] || '127.0.0.1:11211' @memcache = MemCache.new(host, {:namespace => namespace}) @tracking_key = "_#{namespace}_keys" unless @config[:no_tracking] raise NotReady unless @memcache.active? true rescue NameError raise NotDefined end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_physical_databases!\n @ensure_physical_databases ||= create_physical_databases\n end", "def verify_required_data_files!\n unless File.exists?(\"#{@working_directory}/drupal-filesystem.tar.gz\") && File.exists?(\"#{@working_directory}/drupal-db.sql.gz\")\n raise StandardError.new(\"Cannot locate both 'drupal-filesystem.tar.gz' and 'drupal-db.sql.gz' in directory '#{@working_directory}'.\")\n end\n end", "def check\n unless check_tables\n puts \"CBAC: not properly initialized: one or more tables are missing. Did you install it correctly? (run generate)\"\n return false\n end\n\n return true\n end", "def supports_create_table_if_not_exists?\n server_version >= 90100\n end", "def validate_database\n db = @database_path\n raise \"bad mode of #{db}\" unless File.world_readable?(db).nil?\n end", "def check_metadata\n version = @db[:schema_info].first\n unless version[:magic] == Bitcoin.network[:magic_head].hth\n name = Bitcoin::NETWORKS.find{|n,d| d[:magic_head].hth == version[:magic]}[0]\n raise \"Error: DB #{@db.url} was created for '#{name}' network!\"\n end\n unless version[:backend] == backend_name\n if version[:backend] == \"sequel\" && backend_name == \"utxo\"\n log.warn { \"Note: The 'utxo' store is now the default backend.\n To keep using the full storage, change the configuration to use storage: 'sequel::#{@db.url}'.\n To use the new storage backend, delete or move #{@db.url}, or specify a different database path in the config.\" }\n end\n raise \"Error: DB #{@db.url} was created for '#{version[:backend]}' backend!\"\n end\n end", "def exist_tables?\n @db.tables.sort == [:mirrors, :users, :user_tokens, :products, :products_users, :versions, :dependencies, :access_keys].sort\n end", "def test_non_existing_tables\r\n assert_raise(NoMethodError) { @slice.not_existing_tables }\r\n end", "def test_database_checks()\n\t\tcurrentmode = File.stat(@databasefile).mode\n\t\tCfruby::FileOps.chmod(@databasefile, 0700)\n\t\tassert_not_equal(currentmode, File.stat(@databasefile).mode)\n\t\tassert_raise(Cfruby::Checksum::ChecksumPermissionError) {\n\t\t\t@checksum.update_all\n\t\t}\n\t\tCfruby::FileOps.chmod(@databasefile, 0600)\n\t\t\n\t\tif(Process.euid() == 0)\n\t\t\tassert_raise(Cfruby::Checksum::ChecksumOwnershipError) {\n\t\t\t\tCfruby::FileOps.chown(@databasefile, 200, 200)\n\t\t\t\t@checksum.update_all\n\t\t\t}\n\t\tend\n\tend", "def table_or_view_ready?\n Admin::MigrationGenerator.table_or_view_exists?(table_name)\n rescue StandardError => e\n @extra_error = e\n false\n end", "def validate_directory_structure\n return false unless File.exists? @root\n Find.find(@root) do |path|\n stat = File::Stat.new path\n return false unless stat.uid == OWNER and stat.gid == GROUP\n if File.directory? path\n return false unless stat.mode == DIRMODE\n else\n return false unless stat.mode == FILEMODE\n end\n end\n true\n end", "def check_filesystem\n Dir.mkdir(Titan::TITAN_DIRECTORY) unless File.directory?(Titan::TITAN_DIRECTORY)\n end", "def check_metadata\n version = @db[:schema_info].first\n unless version[:magic] == Bitcoin.network[:magic_head].hth\n name = Bitcoin::NETWORKS.find{|n,d| d[:magic_head].hth == version[:magic]}[0]\n raise \"Error: DB #{@db.url} was created for '#{name}' network!\"\n end\n unless version[:backend] == backend_name\n # rename \"sequel\" to \"archive\" when old db is opened\n if version[:backend] == \"sequel\" && backend_name == \"archive\"\n @db[:schema_info].update(backend: \"archive\")\n else\n raise \"Error: DB #{@db.url} was created for '#{version[:backend]}' backend!\"\n end\n end\n end", "def exists?\n validate_directory_structure\n end", "def ensure_data_folder\n return if File.directory? DATA_DIR\n Dir.mkdir DATA_DIR\nend", "def searchdb_link_verify(searchdb_file,book_final_path)\n puts \"Validating searchDB.sql\"\n if !File.exists?(searchdb_file)\n puts \"searchDB.sql missing in \"+book_final_path\n end\n db = SQLite3::Database.new(searchdb_file)\n query= \"select name from sqlite_master where type='table'\"\n tables_list = db.execute( query ) do |table|\n query=\"PRAGMA table_info(#{table[0]})\"\n columns_list = db.execute( query ) do |column|\n if(column[1]=='url')\n query= \"select url from #{table[0]}\"\n db.execute( query ) do |url|\n url[0]=url[0].split(\"#\").first\n if File.exists?(book_final_path+url[0])\n puts book_final_path+url[0]+\" -- ok\"\n else \n puts \"Page not found -\"+book_final_path+url[0]\n exit\n end\n end\n end\n end\n end\nend", "def check_required_disk_space\n old_data_dir_size = Du.du(old_data_dir)\n # new_data_dir might not exist at the point of making this check.\n # In that case check the first existing directory above it.\n new_dir = dir_or_existing_parent(new_data_dir)\n free_disk_space = Statfs.new(new_dir).free_space\n\n if old_data_dir_size < (free_disk_space * 0.90)\n Chef::Log.info(\"!!!!!!!!!!!!! Old data dir size: #{old_data_dir_size}\")\n Chef::Log.info(\"Free disk space: #{free_disk_space}\")\n Chef::Log.info('Free space is sufficient to start upgrade')\n true\n else\n Chef::Log.fatal('Insufficient free space on disk to complete upgrade.')\n Chef::Log.fatal(\"The current postgresql data directory contains #{old_data_dir_size} KB of data but only #{free_disk_space} KB is available on disk.\")\n Chef::Log.fatal(\"The upgrade process requires at least #{old_data_dir_size / 0.90} KB.\")\n raise 'Insufficient Disk Space to Upgrade'\n end\n end", "def sanity_check\n if resource_exists?(\"nodes/#{node_name}\")\n ui.confirm(\"Node #{node_name} exists, overwrite it\")\n rest.delete(\"nodes/#{node_name}\")\n end\n if resource_exists?(\"clients/#{node_name}\")\n ui.confirm(\"Client #{node_name} exists, overwrite it\")\n rest.delete(\"clients/#{node_name}\")\n end\n end", "def ensure_database\n unless File.exist?(\"./items.csv\")\n puts \"Restoring items database.\"\n update_database\n end\n end", "def table_exists?\n true\n end", "def check_required_disk_space\n old_data_dir_size = Du.du(old_data_dir)\n # new_data_dir might not exist at the point of making this check.\n # In that case check the first existing directory above it.\n new_dir = dir_or_existing_parent(new_data_dir)\n free_disk_space = Statfs.new(new_dir).free_space\n\n if old_data_dir_size < (free_disk_space * 0.90)\n Chef::Log.debug(\"Old data dir size: #{old_data_dir_size}\")\n Chef::Log.debug(\" Free disk space: #{free_disk_space}\")\n Chef::Log.debug('Free space is sufficient to start upgrade')\n true\n else\n Chef::Log.fatal('Insufficient free space on disk to complete upgrade.')\n Chef::Log.fatal(\"The current postgresql data directory contains #{old_data_dir_size} KB of data but only #{free_disk_space} KB is available on disk.\")\n Chef::Log.fatal(\"The upgrade process requires at least #{old_data_dir_size / 0.90} KB.\")\n raise 'Insufficient Disk Space to Upgrade'\n end\n end", "def not_exist(name)\n raise TableError, \"Table #{name} doesn't exist.\" unless File.exist?(\"app/services/db/tables/#{name}.json\")\n end", "def table_exists?(table='test_ruby') \n begin\n res = @db.query(\"select * from #{table} where 1=0\")\n return true\n rescue\n return false\n end\n end", "def test_DB_initialization\n @fdb = setup\n assert(@fdb.size > 0, \"Database entries not correctly read in\")\n end", "def validnn?()\n return dir_exists?(\"/\") ? true : false\n end", "def searchdb_link_verify(searchdb_file,book_final_path)\n puts \"Validating searchDB.sql\"\n db = SQLite3::Database.new(searchdb_file)\n query= \"select name from sqlite_master where type='table'\"\n tables_list = db.execute( query ) do |table|\n query=\"PRAGMA table_info(#{table[0]})\"\n columns_list = db.execute( query ) do |column|\n if(column[1]=='url')\n query= \"select url from #{table[0]}\"\n db.execute( query ) do |url|\n url[0]=url[0].split(\"#\").first\n if File.exists?(book_final_path+url[0])\n puts url[0]+\" -- ok\"\n else \n puts \"Page not found -\"+url[0]\n exit\n end\n end\n end\n end\n end\nend", "def ensure_table\n # Check if table exists\n if !@db.tables || !@db.tables.include?(table_name)\n log(\"Creating Table #{table_name}\")\n adaptor_name = @adaptor.adaptor_name\n @db.create_table(table_name) do\n # guid id\n column :id, String, :unique => true, :null => false, :primary_key => true\n\n # When using underscore notation on a field that does not exist, the\n # data will be stored in extra.\n if adaptor_name == 'postgres'\n # Use jsonb\n column :extra, 'json'\n else\n column :extra, String\n end\n end\n # TODO: there's some issue with @db.schema and no clue why, but I\n # have to run this again to get .schema to work later.\n @db.tables\n end\n end", "def run_checks\n # check that mysql tmpdir is custom setup on all servers\n query = \"show variables like 'tmpdir'\"\n query_command = \"echo -e \\\"#{query}\\\"| mysql\"\n @servers.each do |server|\n server.spot_check(query_command) { |result| raise \"Failure: tmpdir was unset#{result}\" unless result.include?(\"/mnt/mysqltmp\") }\n end\n end", "def verify_physicalpath\n if @resource[:physicalpath].nil? || @resource[:physicalpath].empty?\n raise('physicalpath is a required parameter')\n end\n if is_local_path(@resource[:physicalpath])\n unless File.exist?(@resource[:physicalpath])\n raise(\"physicalpath doesn't exist: #{@resource[:physicalpath]}\")\n end\n end\nend", "def supports_create_table_if_not_exists?\n true\n end", "def db_setup\n log_debug\n db_file = find_db\n db_tmp = '/tmp/plex_missing_tmp.db'\n @db = ''\n \n # cp to tmp as the db is locked if being used\n `cp \"#{db_file}\" #{db_tmp}`\n \n # not too sure why but i was having a problem where a 0 byte file was cp'd\n # def a local issue i assume but the check was needed\n if test ?s, db_tmp\n @db = SQLite3::Database.new db_tmp\n else \n puts \"error-> can not open #{db_tmp} for reasing\"\n exit 2\n end\n end", "def supports_create_table_if_not_exists?\n false\n end", "def setup_dir_structure\n # insure that database dir exists so that a new db can be created if necessary\n if $config[\"database\"][\"adapter\"] == \"sqlite3\"\n FileUtils.mkpath(File.dirname($config[\"database\"][\"database\"]))\n end\n # ensure that log dirs exists and last $config[\"clamscan_log\"] is cleared before use\n FileUtils.mkpath(File.dirname($config[\"run_log\"]))\n FileUtils.mkpath(File.dirname($config[\"clamscan_log\"]))\nend", "def has_database?\n paths.path(:shared_config, 'database.yml').exist? &&\n !paths.path(:shared_config, 'nodatabase.yml').exist?\n end", "def make_sure_exists dir\n FileUtils.mkdir_p(dir) unless Dir.respond_to?(:exists?) && Dir.exists?(dir)\n end", "def may_exist?\n\t\t\t\texist? or symlink?\n\t\t\tend", "def exist?\n\t\t\tClient.head @root\n\t\tend", "def env_check\n unless Position.count.zero?\n $stderr.puts \"Position table is not empty! (needs to be truncated first)\"\n exit(5)\n end\n end", "def env_check\n unless Position.count.zero?\n $stderr.puts \"Position table is not empty! (needs to be truncated first)\"\n exit(5)\n end\n end", "def check_database_consistency(*args)\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\t#LOG.debug(fname) {\"args=#{args}\"}\n\t\tret = nil\n\t\tif Datafile.host.nil?\n\t\t\t# \"Host not defined, define it in Type object property/sites/SITE_CENTRAL=xxx\"\n\t\t\tret = t(:host_not_defined)\n\t\tend\n\t\tret\n\tend", "def ensure_that_we_have_table_and_column_families! # :nodoc:\n #\n # TODO: Can we skip checking if it exists at all, and instead, rescue it if it does not?\n #\n hbase_create_table! unless klass.table.exists?\n raise ColumnFamiliesMissingError.new(klass, calculate_missing_family_names) if calculate_missing_family_names.any?\n end", "def check_disk\n super\n end", "def verify_mount_count\n @mounted_partitions.length\n end", "def sanity_check\n # Check iptables FILTER table for our chef chain\n begin\n shell_out!('iptables -nL Promethean')\n rescue Mixlib::ShellOut::ShellCommandFailed\n\tinfo(\"Defining Promethean chain\")\n shell_out!('iptables -N Promethean')\n end\n\n # Check iptables FILTER INPUT chain for a jump to our chef chain\n unless shell_out!('iptables -nL INPUT').stdout.lines.find { |line| line =~ /^Promethean[ ]*all/ }\n\tinfo(\"Adding Promethean chain to input table\")\n shell_out!('iptables -A INPUT -j Promethean')\n end\n\n # Check the header of our file\n # If it's not there, blast the file and rewrite the header\n res = @new_resource\n saved_header = nil\n if ::File.exist?(res.script_path) and ::File.size(res.script_path) > 0\n saved_header = ::File.open(res.script_path) { |f| f.readline.chomp }\n end\n header = 'iptables -F Promethean'\n if saved_header.nil? || saved_header != header\n info(\"No header in #{res.script_path}, writing #{header}\")\n\t::File.open(res.script_path, 'w') do |f|\n f.puts header\n end\n return true\n end\n\n false\nend", "def check_directories\n if File.exist?(source_dir)\n @source_dir = source_dir\n else\n raise DirectoryNotExist, \"Directory not exist\" \n end\n if File.exist?(destination_dir)\n @destination_dir = destination_dir\n else\n raise DirectoryNotExist, \"Directory not exist\" \n end \n end", "def tenant_database_must_exist\n begin\n Apartment::Tenant.process(tenant_name)\n true\n rescue Apartment::DatabaseNotFound => e\n errors.add :base, \"Tenant database must exist before Customer record is created.\"\n end\n end", "def table_exists?\n db.table_exists?(table_name)\n end", "def check_server(server_path)\n\t#check to make sure the directory exists\n\tputs 'Checking server directories and files...'\n\n\t#path has to be passed in as \"~/public/html/ggt\" for production version\n\n\tpath = File.expand_path server_path\n\n\t#Check LOCAL directories\n\treturn false unless check_local_directories './ggt'\n\treturn false unless check_local_directories './ggt/sheets'\n\treturn false unless check_local_directories './ggt/framework'\n\t\n\tunless File.exist?('./ggt/sheets/ggt_handler.php')\n\t\tputs 'FATAL ERROR: the ggt server is no longer present at \"/ggt/sheets/ggt_handler.php.\"'\n\t\treturn false;\t\n\tend\n\n\t#Check SERVER directories\n\tunless File.directory? path\n\t\tputs 'Main Directory does not exist'\n\t\tcreate_folder path\n\tend\n\n\tunless File.directory? path + '/sheets'\n\t\tputs 'Sheets Directory does not exist'\n\t\tcreate_folder path + '/sheets'\n\tend\n\n\t## check the framework directory and size \n\tunless File.directory? path + '/framework'\n\t\tputs 'Framework Directory does not exist'\n\t\tcreate_folder path + '/framework'\n\t\tFileUtils.cp_r('./ggt/framework', path)\n\tend\n\n=begin\n\tif File.size('./ggt/framework') != File.size(path + '/framework')\n\t\tputs 'Framework has been modified, cleaning directory...'\n\n\t\tFileUtils.remove(path + '/framework')\n\t\tcreate_folder path + '/framework'\n\t\tFileUtils.copy_entry('./ggt/framework', path + '/ggt/framework')\n\n\t\tputs 'done'\n\tend\n=end\n\n\t#check server presence and size\n\tunless File.exist?(path + '/sheets/ggt_handler.php')\n\t\tputs 'Server does not exist'\n\t\tputs 'Copying server...'\n\t\tFileUtils.copy_file('./ggt/sheets/ggt_handler.php', path + '/sheets/ggt_handler.php')\n\t\tputs 'done'\n\tend\n\n\tif File.size(path + '/sheets/ggt_handler.php') != File.size('./ggt/sheets/ggt_handler.php')\n\t\tputs 'Server has been modified, replacing...'\n\n\t\tFileUtils.remove(path + '/sheets/ggt_handler.php')\n\t\tFileUtils.copy_file('./ggt/sheets/ggt_handler.php', path + '/sheets/ggt_handler.php')\n\n\t\tputs 'done'\n\tend\n\n\tputs 'done'\n\treturn true\nend", "def usable_with?(db)\n true\n end", "def check_table (db, log)\n conn = db.get_prod_conn();\n q = \"SELECT COUNT(*) AS c FROM holdings_htitem_htmember_jn_dev\";\n log.d(q);\n conn.query(q) do |res|\n log.d(res[:c]);\n end\n conn.close();\nend", "def cluster_initialized?(data_dir)\n ::File.exist?(version_file_for(data_dir))\n end", "def prepare\n unless File.readable?(@config[:cache_directory]) &&\n File.writable?(@config[:cache_directory])\n raise NotAccessible, @config[:cache_directory]\n end\n true\n end", "def test_configuration_ensure_data_dir\n ENV['VW_TIMECLOCK_DATA_DIR'] = './Test-user-dir'\n assert(! File.exists?('./Test-user-dir'))\n Configuration.ensure_data_dir\n assert(File.exists?('./Test-user-dir'))\n assert(File.exists?('./Test-user-dir/user-data'))\n assert(File.exists?('./Test-user-dir/logs'))\n\n # No problem if it already exists\n Configuration.ensure_data_dir\n assert(File.exists?('./Test-user-dir'))\n assert(File.exists?('./Test-user-dir/user-data'))\n assert(File.exists?('./Test-user-dir/logs'))\n end", "def folder_reachable?\n Dir.exists? folder_path\n end", "def existent; end", "def table_exists? (table_name)\r\n if !get_tables.include? (table_name)\r\n puts \"the current database doesn't include a table called \\\"#{table_name}\\\"\"\r\n return false\r\n end\r\n true\r\n end", "def ensure_present!(create_if_needed)\n return unless @low_card_model.table_exists?\n\n current_name = current_unique_all_columns_index_name\n return true if current_name\n\n if create_if_needed\n create_unique_index!\n true\n else\n message = %{You said that the table '#{low_card_model.table_name}' is a low-card table.\nHowever, it currently does not seem to have a unique index on all its columns. For the\nlow-card system to work properly, this is *required* -- although the low-card system\ntries very hard to lock tables and otherwise ensure that it never will create duplicate\nrows, this is important enough that we really want the database to enforce it.\n\nWe're looking for an index on the following columns:\n\n #{value_column_names.sort.join(\", \")}\n\n...and we have the following unique indexes:\n\n}\n current_unique_indexes.each do |unique_index|\n message << \" '#{unique_index.name}': #{unique_index.columns.sort.join(\", \")}\\n\"\n end\n message << \"\\n\"\n\n raise LowCardTables::Errors::LowCardNoUniqueIndexError, message\n end\n end", "def checkpermissions()\n unless File.stat('/etc/hosts').writable?\n # We found it, log error and exit successfully\n @log.error('Can not write to /etc, missing required permissions.')\n abort('Can not write to /etc, are you root?')\n end\n end", "def initialized?\r\n if ENV[\"RAILS_ENV\"] == \"test\" || !User.table_exists? || $setup_disabled \r\n return false\r\n else \r\n $tmp_env = ENV[\"RAILS_ENV\"] || \"development\"\r\n return true\r\n end \r\n end", "def test_for_empty_DB\n\t\tputs \"TEST 1\"\n\t\tassert( @db.empty? , \"DB is not empty\")\n\tend", "def should_run_synchronously?\n cartodbfied_tables = fetch_cartodbfied_tables\n\n dropped_and_stale_tables = find_dropped_tables(cartodbfied_tables) + find_stale_tables(cartodbfied_tables)\n total_tables_to_be_linked = dropped_and_stale_tables + find_new_tables(cartodbfied_tables)\n\n dropped_and_stale_tables.count != 0 && total_tables_to_be_linked.count < MAX_TABLES_FOR_SYNC_RUN\n end", "def test_listedpath\n server = nil\n assert_nothing_raised {\n\n server = Puppet::Network::Handler.fileserver.new(\n\n :Local => true,\n\n :Config => false\n )\n }\n\n\n # create a deep dir\n basedir = tempfile\n testdir = \"#{basedir}/with/some/sub/directories/for/testing\"\n oldfile = File.join(testdir, \"oldfile\")\n assert_nothing_raised {\n system(\"mkdir -p #{testdir}\")\n File.open(oldfile, \"w\") { |f|\n 3.times { f.puts rand(100) }\n }\n @@tmpfiles << basedir\n }\n\n # mounty mounty\n assert_nothing_raised {\n server.mount(basedir, \"localhost\")\n }\n\n list = nil\n # and then check a few dirs\n assert_nothing_raised {\n list = server.list(\"/localhost/with\", :manage, false, false)\n }\n\n assert(list !~ /with/)\n\n assert_nothing_raised {\n list = server.list(\"/localhost/with/some/sub\", :manage, true, false)\n }\n\n assert(list !~ /sub/)\n end", "def has_database?\n paths.shared_config.join('database.yml').exist? &&\n !paths.shared_config.join('nodatabase.yml').exist?\n end", "def check_exists\n raise GlusterFS::Error, \"File does not exist: #{@path}\" unless exists?\n end", "def cluster_initialized?(data_dir)\n ::File.exist?(version_file_for(data_dir))\n end", "def exists?\n hba\n end", "def create_database_dir_if_necessary\n dirname = File.dirname(self.database_path)\n if !Dir.exists?(dirname)\n FileUtils.mkpath(dirname)\n end\n end", "def check\n mark_message \"Schema is #{'not ' unless is_current?}up to date\"\n rescue ConnectionFailed => e\n mark_failure\n mark_message \"Error: '#{e}'\"\n end", "def would_require?(path); end", "def initialize( path )\n @db = SQLite3::Database.new( path )\n @count_hits = false\n @busy_retries = 100\n\n # Wait up to 10 seconds to access locked database\n @db.busy_handler do |resource,retries|\n sleep 0.1\n retries<@busy_retries\n end\n \n # Create the table, if it doesn't exist\n if @db.table_info(TABLE_NAME).empty?\n @db.execute( %Q{\n CREATE TABLE #{TABLE_NAME} (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n key TEXT,\n value TEXT,\n hits INTEGER DEFAULT 0,\n created_at INTEGER,\n updated_at INTEGER\n );\n } )\n @db.execute( %Q{ CREATE UNIQUE INDEX key_index ON #{TABLE_NAME} (key) } )\n end\n end", "def exist_and_supported()\n case session.platform\n when 'linux'\n user = session.shell_command(\"whoami\")\n print_status(\"Current user is #{user}\")\n\n if (user =~ /root/)\n user_base = \"/root/\"\n else\n user_base = \"/home/#{user}/\"\n end\n\n dbvis_file = \"#{user_base}.dbvis/config70/dbvis.xml\"\n when 'windows'\n user_profile = session.sys.config.getenv('USERPROFILE')\n dbvis_file = \"#{user_profile}\\\\.dbvis\\\\config70\\\\dbvis.xml\"\n end\n\n unless file?(dbvis_file)\n #File not found, we next try with the old config path\n print_status(\"File not found: #{dbvis_file}\")\n print_status(\"This could be an older version of dbvis, trying old path\")\n\n case session.platform\n when 'linux'\n dbvis_file = \"#{user_base}.dbvis/config/dbvis.xml\"\n when 'windows'\n dbvis_file = \"#{user_profile }\\\\.dbvis\\\\config\\\\dbvis.xml\"\n end\n\n unless file?(dbvis_file)\n print_error(\"File not found: #{dbvis_file}\")\n return\n end\n\n old_version = true\n end\n\n print_status(\"Reading : #{dbvis_file}\" )\n raw_xml = \"\"\n begin\n raw_xml = read_file(dbvis_file)\n rescue EOFError\n # If there's nothing in the file, we hit EOFError\n print_error(\"Nothing read from file: #{dbvis_file}, file may be empty\")\n return\n end\n\n db_found = false\n alias_found = false\n db_type = nil\n db_type_ok = false\n\n # fetch config file\n raw_xml.each_line do |line|\n\n if line =~ /<Database id=/\n db_found = true\n elsif line =~ /<\\/Database>/\n db_found = false\n end\n\n if db_found == true\n\n # checkthe alias\n if (line =~ /<Alias>([\\S+\\s+]+)<\\/Alias>/i)\n if datastore['DBALIAS'] == $1\n alias_found = true\n print_good(\"Alias #{datastore['DBALIAS']} found in dbvis.xml\")\n end\n end\n\n if (line =~ /<Userid>([\\S+\\s+]+)<\\/Userid>/i)\n if alias_found\n print_good(\"Username for this connection : #{$1}\")\n end\n end\n\n # check the type\n if (line =~ /<Type>([\\S+\\s+]+)<\\/Type>/i)\n if alias_found\n db_type = $1\n alias_found = false\n end\n end\n end\n end\n if db_type.blank?\n print_error(\"Database alias not found in dbvis.xml\")\n end\n return db_type # That is empty if DB is not supported\n end", "def outside_configured_directory?(dir); end", "def db_setup\n path_to_db = File.join(File.dirname(__FILE__), \"temp_humidity.db\")\n SQLite3::Database.open(path_to_db).tap do | db |\n # Do anything here before we begin\n end\nend", "def check_presence_on_table\n if !self.on_table\n throw(:abort)\n end\n end", "def table_exist?(table_name)\n res = run_single_result(\"SELECT COUNT(*) FROM X$File\n WHERE Xf$Name = '#{table_name}'\")\n res == 1\n end", "def db_exists? db_name\n File.exists? db_name\n end", "def directory?(path)\n\t\t@connection.directory?(path)\n\tend", "def data_exist?\n\t\tlocal? || File.exist?(self.data_path)\n\tend", "def test_db_creates_table\n db = ::SQLite3::Database.new(self.class::DATABASE_NAME)\n assert_equal(db.table_info('reports'), [])\n\n db = ::WeatherReport::Database.db(database_name: self.class::DATABASE_NAME)\n assert !db.table_info('reports').empty?\n end", "def database_exists?\n exists = File.file?(@database_path)\n raise \"Database does not exist: #{@database_path}\" unless exists\n\n exists\n end", "def create_in_empty_directory?\n is_empty_directory?(@path)\n end", "def test_01_precondition_for_sanity()\n\t\t\n\t\tputs \"---------------------- START OF SANITY PRE-CONDITION ----------------------\"\n\t\tcreateRazooAccount(\"Normal\", \"User\", \"normaluser@aol.com\", \"123456\")\n\t\tlogout()\t\n\t\tcreateRazooAccount(\"OrgAdmin\", \"User\", \"orgadmin@aol.com\", \"123456\")\n\t\tlogout()\n\t\tlogin(\"srajkumar.here@gmail.com\", \"razoo1\")\n\t\tgrantOrgAdminRights(\"/admin\", \"orgadmin@aol.com\", \"410832480\")\n\t\tlogout()\n\t\tputs \"---------------------- END OF SANITY PRE-CONDITION ----------------------\"\n\tend", "def executeNoArgs\n db =Rho::Database.new(Rho::Application.databaseFilePath('local'), \"local\");\n \n tableName = Library.getRandomName\n puts \"Table Name #{tableName}\"\n \n db.executeSql(\"CREATE TABLE #{tableName}(x INTEGER, y TEXT)\") \n data = db.isTableExist(tableName)\n \n puts \"#{data}\"\n data\nend", "def resource_exists?\n path_exists? install_dir\nend", "def create_physical_databases\n FileUtils.rm_rf File.expand_path('../fixtures/basics/test.db', __FILE__)\n FileUtils.rm_rf File.expand_path('../fixtures/basics/robust.db', __FILE__)\n require 'readline'\n puts \"#################################################################################\"\n puts \"ATTENTION: This task will create physical test databases on your computer\"\n puts \" A password will probably be asked as this task relies on 'sudo'.\"\n puts \" Please provide the root password\"\n puts \"#################################################################################\"\n Readline.readline(\"Press enter to start\")\n puts \"Creating the physical postgresql database ...\"\n puts `sudo su postgres -c 'dropdb dbagile_test'`\n puts `sudo su postgres -c 'dropuser dbagile'`\n puts `sudo su postgres -c 'createuser --no-superuser --no-createrole --createdb dbagile'`\n puts `sudo su postgres -c 'createdb --encoding=utf8 --owner=dbagile dbagile_test'`\n puts \n puts \"#################################################################################\"\n puts \"Done.\"\n puts \"Please run 'rake fixtures'\"\n puts \"#################################################################################\"\n true\n end", "def check_dependents \r\n self.class.send(:dependent_tables).each{|sym_dependent_table|\r\n raise LookupItemInUseException.new if self.send(sym_dependent_table).size > 0\r\n }\r\n end", "def already_initialized\n response = ActiveRecord::Base.connection_pool.with_connection { |con| con.exec_query \"SELECT name FROM sqlite_master WHERE type='table'\" }\n response.rows.flatten.member?('code_files')\n rescue ExceptionName\n false\n end", "def valid_root_cache?\n return true\n (! options[:purge_cache]) && File.directory?(options[:cache_dir])\n end", "def storage_exists?(storage_name)\n statement = <<-SQL.compress_lines\n SELECT COUNT(*)\n FROM \"information_schema\".\"tables\"\n WHERE \"table_type\" = 'BASE TABLE'\n AND \"table_schema\" = ?\n AND \"table_name\" = ?\n SQL\n\n query(statement, schema_name, storage_name).first > 0\n end", "def perform\n check_directories\n end", "def initialize(host,user,pass,dbname)\n @mHost = host\n @mUser = user\n @mPassword = pass\n @mDBName = dbname\n\n @mResource = Mysql.new(@mHostname,@mUser,@mPassword,@mDBName)\n puts \"DB Connection Successful. \" \n \n # See if table which insertions occurs exist \n checkifexists\n end", "def check\n if !File.directory? \"dat\" then FileUtils.mkdir 'dat' end\n if !File.exists? \"dat/name.dat.txt\" then download('names') end\n if !File.exists? \"dat/surnames.dat.txt\" then download('surnames') end\n if !File.exists? \"dat/words.dat.txt\" then download('words') end\n end", "def dir_exists?(path)\n begin\n @meta_data = @client.stat(path)\n if (@meta_data[\"type\"] == \"DIRECTORY\")\n return true\n else\n return false\n end\n rescue\n return false\n end \n end", "def test_insert_table_online\n request_document = File.open(File.join(local_test_folder, local_file))\n request_table = TableInsert.new({:ColumnsCount => 5, :RowsCount => 4})\n request = InsertTableOnlineRequest.new(document: request_document, table: request_table, node_path: '')\n\n result = @words_api.insert_table_online(request)\n assert_equal false, result.nil?\n end", "def table_exists?(table_name)\n sql = 'select count(*) as table_exists from pg_tables where tablename = $1::varchar'\n result = conn.exec_params(sql, [table_name])\n result[0]['table_exists'] == 0 ? false : true\n end", "def viable_directory?(dir)\n ::File.directory?(dir) && ::File.readable?(dir)\n end", "def db_setup\n path_to_db = \"/tmp/temp_humidity.db\"\n SQLite3::Database.open(path_to_db).tap do | db |\n # Do anything here before we begin\n end\nend", "def set_database\n # Test auf Lesbarkeit von X$-Tabellen\n def x_memory_table_accessible?(table_name_suffix, msg)\n begin\n sql_select_all \"SELECT /* Panorama Tool Ramm */ * FROM X$#{table_name_suffix} WHERE RowNum < 1\"\n return true\n rescue Exception => e\n msg << \"<div>#{t(:env_set_database_xmem_line1, :user=>get_current_database[:user], :table_name_suffix=>table_name_suffix, :default=>'DB-User %{user} has no right to read on X$%{table_name_suffix} ! Therefore a very small number of functions of Panorama is not usable!')}<br/>\"\n msg << \"<a href='#' onclick=\\\"jQuery('#xbh_workaround').show(); return false;\\\">#{t(:moeglicher, :default=>'possible')} workaround:</a><br/>\"\n msg << \"<div id='xbh_workaround' style='display:none; background-color: lightyellow; padding: 20px;'>\"\n msg << \"#{t(:env_set_database_xmem_line2, :default=>'Alternative 1: Connect with role SYSDABA')}<br/>\"\n msg << \"#{t(:env_set_database_xmem_line3, :default=>'Alternative 2: Execute as user SYS')}<br/>\"\n msg << \"> create view X_$#{table_name_suffix} as select * from X$#{table_name_suffix};<br/>\"\n msg << \"> create public synonym X$#{table_name_suffix} for sys.X_$#{table_name_suffix};<br/>\"\n msg << t(:env_set_database_xmem_line4, :table_name_suffix=>table_name_suffix, :default=>'This way X$%{table_name_suffix} becomes available with role SELECT ANY DICTIONARY')\n msg << \"</div>\"\n msg << \"</div>\"\n return false\n end\n end\n\n def select_any_dictionary?(msg)\n if sql_select_one(\"SELECT COUNT(*) FROM Session_Privs WHERE Privilege = 'SELECT ANY DICTIONARY'\") == 0\n msg << t(:env_set_database_select_any_dictionary_msg, :user=>get_current_database[:user], :default=>\"DB-User %{user} doesn't have the grant 'SELECT ANY DICTIONARY'! Many functions of Panorama may be not usable!<br>\")\n false\n else\n true\n end\n end\n\n write_to_client_info_store(:last_used_menu_controller, \"env\")\n write_to_client_info_store(:last_used_menu_action, \"set_database\")\n write_to_client_info_store(:last_used_menu_caption, \"Login\")\n write_to_client_info_store(:last_used_menu_hint, t(:menu_env_set_database_hint, :default=>\"Start of application after connect to database\"))\n\n current_database = params[:database].symbolize_keys # Puffern in lokaler Variable, bevor in client_info-Cache geschrieben wird\n\n if params[:database][:modus] == 'tns' # TNS-Alias auswerten\n tns_records = read_tnsnames # Hash mit Attributen aus tnsnames.ora für gesuchte DB\n tns_record = tns_records[current_database[:tns]]\n unless tns_record\n respond_to do |format|\n format.js {render :js => \"$('#content_for_layout').html('#{j \"Entry for DB '#{current_database[:tns]}' not found in tnsnames.ora\"}'); $('#login_dialog').effect('shake', { times:3 }, 100);\"}\n end\n set_dummy_db_connection\n return\n end\n current_database[:host] = tns_record[:hostName] # Erweitern um Attribute aus tnsnames.ora\n current_database[:port] = tns_record[:port] # Erweitern um Attribute aus tnsnames.ora\n current_database[:sid] = tns_record[:sidName] # Erweitern um Attribute aus tnsnames.ora\n current_database[:sid_usage] = tns_record[:sidUsage] # :SID oder :SERVICE_NAME\n else # Host, Port, SID auswerten\n current_database[:sid_usage] = :SID unless current_database[:sid_usage] # Erst mit SID versuchen, zweiter Versuch dann als ServiceName\n current_database[:tns] = \"#{current_database[:host]}:#{current_database[:port]}:#{current_database[:sid]}\" # Evtl. existierenden TNS-String mit Angaben von Host etc. ueberschreiben\n end\n\n # Temporaerer Schutz des Produktionszuganges bis zur Implementierung LDAP-Autorisierung \n if current_database[:host].upcase.rindex(\"DM03-SCAN\") && current_database[:sid].upcase.rindex(\"NOADB\")\n if params[:database][:authorization]== nil || params[:database][:authorization]==\"\"\n respond_to do |format|\n format.js {render :js => \"$('#content_for_layout').html('#{j \"zusätzliche Autorisierung erforderlich fuer NOA-Produktionssystem\"}'); $('#login_dialog_authorization').show(); $('#login_dialog').effect('shake', { times:3 }, 100);\"}\n end\n set_dummy_db_connection\n return\n end\n if params[:database][:authorization]== nil || params[:database][:authorization]!=\"meyer\"\n respond_to do |format|\n format.js {render :js => \"$('#content_for_layout').html('#{j \"Autorisierung '#{params[:database][:authorization]}' ungueltig fuer NOA-Produktionssystem\"}'); $('#login_dialog').effect('shake', { times:3 }, 100);\"}\n end\n set_dummy_db_connection\n return\n end\n end\n\n set_current_database(current_database) # Persistieren im Cache\n current_database = nil # Diese Variable nicht mehr verwenden ab jetzt, statt dessen get_current_database verwenden\n\n # First SQL execution opens Oracle-Connection\n\n # Test der Connection und ruecksetzen auf vorherige wenn fehlschlaegt\n begin\n # Test auf Funktionieren der Connection\n begin\n sql_select_one \"SELECT /* Panorama Tool Ramm */ SYSDATE FROM DUAL\"\n rescue Exception => e # 2. Versuch mit alternativer SID-Deutung\n Rails.logger.error \"Error connecting to database: URL='#{jdbc_thin_url}' TNSName='#{get_current_database[:tns]}' User='#{get_current_database[:user]}'\"\n Rails.logger.error e.message\n Rails.logger.error 'Switching between SID and SERVICE_NAME'\n\n database_helper_switch_sid_usage\n begin\n # Oracle-Connection aufbauen mit Wechsel zwischen SID und ServiceName\n sql_select_one(\"SELECT /* Panorama Tool Ramm */ SYSDATE FROM DUAL\") # Ruft implizit open_oracle_connection\n\n rescue Exception => e # 3. Versuch mit alternativer SID-Deutung\n Rails.logger.error \"Error connecting to database: URL='#{jdbc_thin_url}' TNSName='#{get_current_database[:tns]}' User='#{get_current_database[:user]}'\"\n Rails.logger.error e.message\n Rails.logger.error 'Error persists, switching back between SID and SERVICE_NAME'\n database_helper_switch_sid_usage\n # Oracle-Connection aufbauen mit Wechsel zurück zwischen SID und ServiceName, sql_select_all ruft implizit open_oracle_connection\n sql_select_all \"SELECT /* Panorama Tool Ramm */ SYSDATE FROM DUAL\" # Provozieren der ursprünglichen Fehlermeldung wenn auch zweiter Versuch fehlschlägt\n end\n end\n rescue Exception => e\n set_dummy_db_connection\n respond_to do |format|\n format.js {render :js => \"$('#content_for_layout').html('#{j \"Fehler bei Anmeldung an DB: <br>\n #{e.message}<br>\n URL: '#{jdbc_thin_url}'<br>\n Host: #{get_current_database[:host]}<br>\n Port: #{get_current_database[:port]}<br>\n SID: #{get_current_database[:sid]}\"\n }');\n $('#login_dialog').effect('shake', { times:3 }, 100);\n \"\n }\n end\n return # Fehler-Ausgang\n end\n\n set_current_database(get_current_database.merge({:database_name => ConnectionHolder.current_database_name})) # Merken interner DB-Name ohne erneuten DB-Zugriff\n\n @dictionary_access_msg = \"\" # wird additiv belegt in Folge\n @dictionary_access_problem = false # Default, keine Fehler bei Zugriff auf Dictionary\n begin\n @banners = [] # Vorbelegung,damit bei Exception trotzdem valider Wert in Variable\n @instance_data = [] # Vorbelegung,damit bei Exception trotzdem valider Wert in Variable\n @dbids = [] # Vorbelegung,damit bei Exception trotzdem valider Wert in Variable\n @platform_name = \"\" # Vorbelegung,damit bei Exception trotzdem valider Wert in Variable\n # Einlesen der DBID der Database, gleichzeitig Test auf Zugriffsrecht auf DataDictionary\n read_initial_db_values\n @banners = sql_select_all \"SELECT /* Panorama Tool Ramm */ Banner FROM V$Version\"\n @instance_data = sql_select_all [\"SELECT /* Panorama Tool Ramm */ gi.*, i.Instance_Number Instance_Connected,\n (SELECT n.Value FROM gv$NLS_Parameters n WHERE n.Inst_ID = gi.Inst_ID AND n.Parameter='NLS_CHARACTERSET') NLS_CharacterSet,\n (SELECT n.Value FROM gv$NLS_Parameters n WHERE n.Inst_ID = gi.Inst_ID AND n.Parameter='NLS_NCHAR_CHARACTERSET') NLS_NChar_CharacterSet,\n (SELECT p.Value FROM GV$Parameter p WHERE p.Inst_ID = gi.Inst_ID AND LOWER(p.Name) = 'cpu_count') CPU_Count,\n d.Open_Mode, d.Protection_Mode, d.Protection_Level, d.Switchover_Status, d.Dataguard_Broker, d.Force_Logging,\n ws.Snap_Interval_Minutes, ws.Snap_Retention_Days\n FROM GV$Instance gi\n JOIN v$Database d ON 1=1\n LEFT OUTER JOIN v$Instance i ON i.Instance_Number = gi.Instance_Number\n LEFT OUTER JOIN (SELECT DBID, MIN(EXTRACT(HOUR FROM Snap_Interval))*60 + MIN(EXTRACT(MINUTE FROM Snap_Interval)) Snap_Interval_Minutes, MIN(EXTRACT(DAY FROM Retention)) Snap_Retention_Days FROM DBA_Hist_WR_Control GROUP BY DBID) ws ON ws.DBID = ?\n \", get_dbid ]\n\n @control_management_pack_access = sql_select_one \"SELECT Value FROM V$Parameter WHERE name='control_management_pack_access'\" # ab Oracle 11 belegt\n\n @instance_data.each do |i|\n if i.instance_connected\n @instance_name = i.instance_name\n @host_name = i.host_name\n end\n end\n @dbids = sql_select_all [\"SELECT s.DBID, MIN(Begin_Interval_Time) Min_TS, MAX(End_Interval_Time) Max_TS,\n (SELECT MIN(DB_Name) FROM DBA_Hist_Database_Instance i WHERE i.DBID=s.DBID) DB_Name,\n (SELECT COUNT(DISTINCT Instance_Number) FROM DBA_Hist_Database_Instance i WHERE i.DBID=s.DBID) Instances,\n MIN(EXTRACT(MINUTE FROM w.Snap_Interval)) Snap_Interval_Minutes,\n MIN(EXTRACT(DAY FROM w.Retention)) Snap_Retention_Days\n FROM DBA_Hist_Snapshot s\n LEFT OUTER JOIN DBA_Hist_WR_Control w ON w.DBID = s.DBID\n GROUP BY s.DBID\n ORDER BY MIN(Begin_Interval_Time)\"]\n @platform_name = sql_select_one \"SELECT /* Panorama Tool Ramm */ Platform_name FROM v$Database\" # Zugriff ueber Hash, da die Spalte nur in Oracle-Version > 9 existiert\n rescue Exception => e\n @dictionary_access_problem = true # Fehler bei Zugriff auf Dictionary\n @dictionary_access_msg << \"<div> User '#{get_current_database[:user]}' has no right for read on data dictionary!<br/>#{e.message}<br/>Functions of Panorama will not or not completely be usable<br/>\n </div>\"\n end\n\n @dictionary_access_problem = true unless select_any_dictionary?(@dictionary_access_msg)\n @dictionary_access_problem = true unless x_memory_table_accessible?(\"BH\", @dictionary_access_msg )\n\n write_connection_to_last_logins\n\n initialize_unique_area_id # Zaehler für eindeutige IDs ruecksetzen\n\n timepicker_regional = \"\"\n if get_locale == \"de\" # Deutsche Texte für DateTimePicker\n timepicker_regional = \"prevText: '<zurück',\n nextText: 'Vor>',\n monthNames: ['Januar','Februar','März','April','Mai','Juni', 'Juli','August','September','Oktober','November','Dezember'],\n dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],\n timeText: 'Zeit',\n hourText: 'Stunde',\n minuteText: 'Minute',\n currentText: 'Jetzt',\n closeText: 'Auswählen',\"\n end\n respond_to do |format|\n format.js {render :js => \"$('#current_tns').html('#{j \"<span title='TNS=#{get_current_database[:tns]},Host=#{get_current_database[:host]},Port=#{get_current_database[:port]},#{get_current_database[:sid_usage]}=#{get_current_database[:sid]}, User=#{get_current_database[:user]}'>#{get_current_database[:user]}@#{get_current_database[:tns]}</span>\"}');\n $('#main_menu').html('#{j render_to_string :partial =>\"build_main_menu\" }');\n $.timepicker.regional = { #{timepicker_regional}\n ampm: false,\n firstDay: 1,\n dateFormat: '#{timepicker_dateformat }'\n };\n $.timepicker.setDefaults($.timepicker.regional);\n numeric_decimal_separator = '#{numeric_decimal_separator}';\n var session_locale = '#{get_locale}';\n $('#content_for_layout').html('#{j render_to_string :partial=> \"env/set_database\"}');\n $('#login_dialog').dialog('close');\n \"\n }\n end\n rescue Exception=>e\n set_dummy_db_connection # Rückstellen auf neutrale DB\n raise e\n end", "def ensure_meta_info_dir_exists!\n FileUtils.mkdir_p(RubyFileReader::Reader.meta_info_dir_pathname)\n end", "def table_does_not_exist\n table = sandbox.datasets.find_by_name(to_table)\n errors.add(:base, :table_exists, {:table_name => to_table}) if table\n end", "def tables\n sanity_check\n @handle.tables\n end" ]
[ "0.6237331", "0.61747175", "0.6008947", "0.5968245", "0.5923211", "0.5805888", "0.5781957", "0.5766757", "0.574381", "0.5735627", "0.56539434", "0.5649535", "0.5649384", "0.564261", "0.563672", "0.56263757", "0.5620631", "0.5614224", "0.560949", "0.5598401", "0.5588257", "0.55758077", "0.5572037", "0.55678236", "0.5564845", "0.55527604", "0.55449647", "0.5486883", "0.54767054", "0.54717374", "0.54641765", "0.5460429", "0.545181", "0.54423916", "0.541065", "0.5365568", "0.5354718", "0.5344575", "0.5344575", "0.5334134", "0.5332576", "0.5332028", "0.5325398", "0.5324775", "0.53165215", "0.5309027", "0.53087264", "0.5306189", "0.5299939", "0.52996224", "0.52976763", "0.528773", "0.52831775", "0.52812207", "0.5278907", "0.52716583", "0.5257687", "0.52548563", "0.52529246", "0.52512866", "0.52500725", "0.5244206", "0.52333915", "0.52247566", "0.5222815", "0.52183557", "0.52163273", "0.5209925", "0.5199339", "0.5197897", "0.5196658", "0.51759523", "0.5175142", "0.51698756", "0.51689595", "0.51681924", "0.5158491", "0.5152594", "0.5148329", "0.5146227", "0.5140448", "0.51328605", "0.51274425", "0.5112371", "0.51114935", "0.5110633", "0.5110235", "0.50934124", "0.50929785", "0.50917274", "0.5085349", "0.5082658", "0.5082542", "0.5078942", "0.5077139", "0.50622547", "0.50597596", "0.5059216", "0.5051207", "0.504888", "0.5044907" ]
0.0
-1
Checks whether a cache entry exists ==== Parameter key:: The key identifying the cache entry ==== Returns true if the cache entry exists, false otherwise
def cached?(key) not @memcache.get(key).nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_key?(key)\n @cache.has_key?(key)\n end", "def exist?(key)\n File.exist?(cache_path(key))\n end", "def exist(key)\n check_return_code(\n Lib.memcached_exist(@struct, key),\n key\n )\n end", "def include?(key)\n File.exist?(cache_path(key))\n end", "def exists(key)\n mon_synchronize do\n perform [\"exists\", key], proc: T_BOOL\n end\n end", "def exists(key)\n mon_synchronize do\n perform [\"exists\", key], :proc => T_BOOL\n end\n end", "def is_key_exist(key)\r\n (@redis.exists key) ? true : false \r\n end", "def exist?(key, options = nil)\n Rails.cache.exist?(key, options)\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: exists?: K: #{key.inspect}. M: #{exc.message}, I: #{exc.inspect}\" }\n nil\n end", "def exists?(key)\n @redis.exists(prefix(key))\n end", "def exist?(key)\n with_client do |client|\n !client.exists(build_key(key)).zero?\n end\n end", "def exists(key)\n call(key, [:exists, key], transform: Redis::Boolify, read: true)\n end", "def exists?(key)\n # Use recommended binary-returning method create [with this redis-rb commit](https://github.com/redis/redis-rb/commit/bf42fc9e0db4a1719d9b1ecc65aeb20425d44427).\n return Lit.redis.exists?(key) if Lit.redis.respond_to?(:exists?)\n\n # Fall back with older gem\n Lit.redis.exists(key)\n end", "def exists?(key)\n key.present? && manager.key?(key)\n end", "def exist?(key)\n !@store.select { |i| i[:key] == build_key(key) }.empty?\n end", "def exists?(cache_key)\n @pg.exec_prepared(@exists_statement_name, [object_to_cache_key(cache_key)]).ntuples.eql?(1)\n end", "def exist?(key)\n !find(key).nil?\n end", "def exists?(key)\n unimplemented\n end", "def exists?\n retrieve\n true\n rescue Error::NoSuchKey\n false\n end", "def cache_exist?\n File.exist?(@cache_file)\n end", "def has_key?(key)\n return self.fetch(key) ? true : false\n end", "def exist?(key)\n jiak.client.exist?(jiak.bucket,key)\n end", "def include?(entry)\n @cache.has_key?(key_for(entry))\n end", "def cache_exists?\n File.exist?(cached_file)\n end", "def exist? _key\n store.transaction(:read_only) do |s|\n s.roots.any? { |r| r.to_sym == _key.to_sym }\n end\n end", "def has_key? key\n @lock.read_sync{ @data.has_key? key }\n end", "def has_key?(key)\n !!fetch(key)\n rescue ContextMiss\n false\n end", "def exist?(key)\n store.key?(key)\n end", "def has_key?(key)\n @stored[key] && !@stored[key].empty? ? true : false\n end", "def has_key?(key)\n @table.get(key) != nil\n end", "def has key, expire_time = nil\n return false unless CACHE.has_key? key\n return true unless expire_time\n return false if Time.at(CACHE[key][1]) < (Time.now - expire_time)\n true\n end", "def exist?(key)\n\n end", "def zexists(key)\n mon_synchronize do\n perform [\"zexists\", key], proc: T_BOOL\n end\n end", "def img_exists?(key)\n lock(:img) do\n @cache[:img].has_key?(key)\n end\n end", "def cached?(key)\n false\n end", "def has_key?(key)\n !get(key).nil?\n end", "def has_key?(key)\n !get(key).nil?\n end", "def has?(key)\n [cache, values].any? { |store| store.keys.include?(key.to_sym) }\n end", "def has_key?(key)\n !find_node(key).nil?\n end", "def has_key?(key)\n @hash.has_key?(key)\n end", "def has_key?(key); end", "def has_key?(key); end", "def zexists(key)\n mon_synchronize do\n perform [\"zexists\", key], :proc => T_BOOL\n end\n end", "def exists?(key)\n @data.has_key?(key) && @data[key].valid?(self)\n end", "def exists(key)\n\n # FIXME: insert code that connects to the backend and affects the exists\n # operation\n #\n # - Convert any exceptions into a failed status result with a meaningful\n # error message.\n #\n\n { :result => nil, :err_msg => 'FIXME: not implemented' }\n end", "def exist?(key, options = {})\n exist(key)\n true\n rescue NotFound\n false\n rescue Error => e\n log_exception e\n end", "def exists?(key)\n raise \"Method not implemented. Called abstract class.\"\n end", "def cached?(key)\n if @cache.key?(key)\n _data, _expire = *cache_read(key)\n return true if _expire.nil? || Time.now < _expire\n expire(key)\n end\n false\n end", "def exist?(key)\n instrument :exist, key: key do |payload|\n id = map_key_to_id(key)\n answer = id.present?\n\n payload[:exist] = answer\n answer\n end\n end", "def cached? *key\n @cache.has_key? key\n end", "def exists?(namespace, key)\n exists = File.exist?(make_path(namespace, key))\n settings.logger.info(\"Queried #{make_key(namespace, key)}, found: #{exists}\")\n exists\n end", "def has_key?(key)\n @db.each_key do\n\t|k|\n\treturn true if k == key\n end\n end", "def exists?(key, bucket = nil)\n about(key, bucket)\n true\n rescue NoSuchKey\n false\n end", "def file_exists?(key)\n result = http.head([200,404], luwak, escape(key))\n result[:code] == 200\n end", "def contains?(key)\n @semaphore.synchronize {\n @key_data.has_key?(key)\n }\n end", "def has_key?(key)\n return to_h().has_key?(key)\n end", "def key?(key)\n timeout_retry(3, 3){\n write \"EXISTS #{key}\\r\\n\"\n integer_reply == 1\n }\n end", "def contains?(key)\n @key_data.has_key?(key)\n end", "def exists_file?(key)\n # sanitize the name\n key = safe_file_name(key)\n key = add_namespace(key)\n\n boolify(redis.exists?(key))\n end", "def exist?(key)\n raise NotImplementedError\n end", "def include?(key)\n # Ensure a Ruby true is returned\n item_exists(key) == true\n end", "def exists?(type, key)\n if directory(type, key)&.files&.head(key_component(type, key))\n true\n else\n false\n end\n end", "def get(key = '')\n if key != '' && ::File.exists?(@cache_dir+key)\n # Is the File older than a day?\n if file_age(@cache_dir+key) > 1\n # Delete and return a cache miss\n File.delete(@cache_dir+key)\n return false\n end\n\n puts \"Reading from cache with key: #{key}\" if ENV['DEBUG']\n data = ::File.read(@cache_dir+key)\n return (data.length > 0) ? data : false\n end\n\n return false\n end", "def meterpreter_registry_key_exist?(key)\n begin\n root_key, base_key = session.sys.registry.splitkey(key)\n rescue ArgumentError\n return false\n end\n\n begin\n check = session.sys.registry.check_key_exists(root_key, base_key)\n rescue Rex::Post::Meterpreter::RequestError, TimesoutError\n return false\n end\n\n check\n end", "def has_key?( key )\n key = UniMap.str_to_key( key ) unless key.is_a?( Key )\n key && contains_key( key )\n end", "def exists?(key)\n s3_object(key).exists?\n end", "def key?(key)\n @mutex.synchronize do\n if @entries.key?(key) && (@entries[key].nil? || @entries[key].expired?)\n @entries.delete(key)\n end\n @entries.key?(key)\n end\n end", "def has_key?(key)\n any? {|mod| mod.name == key}\n end", "def shell_registry_key_exist?(key)\n begin\n key = normalize_key(key)\n rescue ArgumentError\n return false\n end\n\n results = shell_registry_cmd(\"query \\\"#{key}\\\"\")\n if results =~ /ERROR: /i\n return false\n else\n return true\n end\n end", "def exist?(key, options = {})\n invoke(:exist?, key) do |store|\n store.exists(namespaced_key(key, merged_options(options)))\n end\n end", "def cached?(key)\n cache_file = @config[:cache_directory] / \"#{key}.cache\"\n _data = _expire = nil\n if File.file?(cache_file)\n _data, _expire = Marshal.load(cache_read(cache_file))\n return true if _expire.nil? || Time.now < _expire\n FileUtils.rm_f(cache_file)\n end\n false\n end", "def has_key?(key)\n keys.include?(key)\n end", "def has_key? key; key? key; end", "def exists?(path)\n return unless @cache_base\n\n File.exists?(@cache_base + path)\n end", "def contains?(key)\n not get(key).nil?\n end", "def cache?(key)\n auth_objects_cache.key? key\n end", "def page_cache_exists?(url)\n File.exists? page_cache_test_file(url)\n end", "def has?(key)\n node = _get(@root, key)\n !node.nil? && !node.undefined?\n end", "def check_key_exist url_key\n @url_generators = UrlGenerator.all\n @url_generators.each do |url_generator|\n if url_generator.key == url_key\n return true\n end\n end\n return false\n end", "def exists(key, options = nil)\n policy = create_policy(options, Policy, default_read_policy)\n command = ExistsCommand.new(@cluster, policy, key)\n execute_command(command)\n command.exists\n end", "def exists?(key, dirty: false)\n rec = @hash[key]\n if expired?(key) && !dirty && !@dirty\n @hash.delete(key)\n rec = nil\n end\n !rec.nil?\n end", "def has_key?(key)\n\t\tmust_be_in_synchronize_block\n\t\treturn @collection.has_key?(key)\n\tend", "def has_key?(key)\n dummy = Pair.new(key,nil)\n return @tree.get(dummy)\n end", "def lut_cache_exists?(name)\n !lut_read_cache_item(name, 0).nil?\n end", "def include?(key)\n has_key?(key)\n end", "def key?(key, options = {})\n if @backend.exists(key)\n update_expires(key, options, nil)\n true\n else\n false\n end\n end", "def has_key?(key)\n @h.has_key?(key.to_sym)\n end", "def include?(key = nil)\n key ||= BasicCache.caller_name\n key = key.to_sym\n @store.include?(key) && Time.now - @store[key].stamp < @lifetime\n end", "def has_key(hash, key)\n\thash.has_key? key\nend", "def include?(key)\n @dao.count(selector(key)) > 0\n end", "def include?(key)\n key = key.to_sym\n cache.keys.include?(key) || values.keys.include?(key)\n end", "def key?(key)\n @semaphore.synchronize do\n return @hashed_storage.key? key\n end\n end", "def is_cache_expired?(key)\n time_stamp_position = 1;\n fname = _find_file_key(key)\n return true if fname.nil?\n\n fname_a = fname.split('-')\n if Time.now.to_i > fname_a[time_stamp_position].to_i\n return true\n end\n\n return false;\n end", "def plist_key_exists?(key, file, opts={})\n plist_read(key, file, opts) != nil\n end", "def file_exists?(bucket_name:, key:)\n !!get_bucket!(bucket_name).file(key)\n end", "def exists?(type, key)\n require_layers!\n layers.each do |layer|\n return true if layer.exists?(type, key)\n end\n false\n end", "def cached?\n cache_path.exist?\n end", "def exists?\n stats.key? @resource[:name]\n end", "def document_exists?(key)\n return nil unless key\n CouchbaseDocStore.document_exists?(key)\n end", "def include?(key)\n key = key.to_sym\n cache.keys.include?(key) || values.keys.include?(key)\n end", "def member? key\n fetch(key, nil) && true\n end" ]
[ "0.84940356", "0.8457097", "0.8288326", "0.7914319", "0.778418", "0.76788914", "0.7676091", "0.7578737", "0.75765264", "0.7541226", "0.7532098", "0.750672", "0.74855816", "0.74125814", "0.7369414", "0.7360646", "0.7345717", "0.7333525", "0.73078674", "0.7284089", "0.7272287", "0.7242617", "0.72370386", "0.72107357", "0.7206749", "0.72052616", "0.71853256", "0.71746194", "0.7171198", "0.71622694", "0.71492845", "0.7135249", "0.71333003", "0.7110072", "0.71071535", "0.71071535", "0.71005857", "0.70967394", "0.70957553", "0.7087658", "0.7087658", "0.7077063", "0.7059207", "0.70558685", "0.7055364", "0.70547444", "0.70404434", "0.7030748", "0.70175886", "0.70054966", "0.7003584", "0.6992566", "0.69718957", "0.6962698", "0.6955767", "0.6934556", "0.69192404", "0.6918725", "0.69174045", "0.6909453", "0.6884611", "0.6871074", "0.6863482", "0.6861654", "0.68367916", "0.6835553", "0.6832631", "0.683244", "0.68301237", "0.6817226", "0.6812621", "0.68088096", "0.679959", "0.67552847", "0.6741845", "0.671358", "0.6705589", "0.6700687", "0.6687788", "0.6671942", "0.66537815", "0.6640109", "0.66363454", "0.66332525", "0.6631901", "0.662843", "0.66132987", "0.6554511", "0.6538534", "0.6528298", "0.65231055", "0.64928305", "0.64885736", "0.6468713", "0.64404726", "0.6435017", "0.64334315", "0.64265543", "0.64245415", "0.64236933" ]
0.74226606
13
Store data to memcache using the specified key ==== Parameters key:: The key identifying the cache entry data:: The data to be put in cache from_now:: The number of minutes (from now) the cache should persist
def cache_set(key, data, from_now = nil) _expire = from_now ? from_now.minutes.from_now.to_i : 0 @memcache.set(key, data, _expire) cache_start_tracking(key) Merb.logger.info("cache: set (#{key})") true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_set(key, data, from_now = nil)\n cache_file = @config[:cache_directory] / \"#{key}.cache\"\n cache_directory = File.dirname(cache_file)\n FileUtils.mkdir_p(cache_directory)\n _expire = from_now ? from_now.minutes.from_now : nil\n cache_write(cache_file, Marshal.dump([data, _expire]))\n Merb.logger.info(\"cache: set (#{key})\")\n true\n end", "def cache_set(key, data, from_now = nil)\n _expire = from_now ? from_now.minutes.from_now : nil\n cache_write(key, [data, _expire])\n Merb.logger.info(\"cache: set (#{key})\")\n true\n end", "def cache_set(key, data, from_now = nil)\n true\n end", "def write(key, value, expires_in: nil)\n @cache[key] = value\n @expires[key] = Faulty.current_time + expires_in unless expires_in.nil?\n end", "def set(key, value, expires_in = 0)\n remove(key)\n expires = nil\n if expires_in > 0\n expires = Time.now.utc + expires_in\n end\n @store.push({ key: build_key(key), value: value, expires: expires})\n end", "def cache_write(key, data)\n @mutex.synchronize do\n @cache[key] = data\n end\n end", "def set_data(key, value, expire_at: nil)\n key = key.to_sym\n ts = expire_at ? expire_at.to_i : nil\n\n (@data[key] = [value, ts]).first\n end", "def store(key, value, options = {})\n # todo What's the best way to run these two calls at once, given that it's very much one-at-a-time\n exp = options[:expires_in] ? (Time.now + options[:expires_in]) : nil\n @mongo_collection.update({ '_id' => key }, { '_id' => key, 'data' => value, 'expires' => exp }, { :upsert => true }) # upsert is the best technical term ever.\n \n unless options.has_key?(:bypass_memcache)\n args = [key, value, options[:expires_in] || @options[:memcache_default_expire]].compact\n @memcache.set(*args)\n end\n \n value\n end", "def save(key, data)\n self.ready\n \n unless @validId.nil?\n\t\t\t\traise SwapDmi::CacheSaveError.new(key) unless self.instance_exec(key, &@validId)\n end\n \n self.evict(key) if @evictWhen[:save]\n self.instance_exec(key, data, &@save)\n self\n end", "def cache_store(key, value, options = {})\n options[:expires] = options.delete(:ttl) || @options[:expires_in]\n @moneta.store(key, value, options)\n end", "def cache_write(value, key: cache_key, **)\n Rails.cache.write(key, value, namespace: namespace) if validate_key(key)\n end", "def set(key, value, mtime)\n @cache[key] = {\n value: value,\n mtime: mtime\n }\n end", "def set(key, value, expires_in = 0)\n\n end", "def store(value, *key)\n @cache[key] = value\n end", "def put(namespace, key, entry)\n @lock.synchronize do\n now = Time.now.utc.to_i\n prune_expired(now)\n @entries[full_key(namespace, key)] = entry\n prune_size\n end\n end", "def cache_store(key, value, options = {})\n key = namespaced(key)\n ttl = options[:ttl] rescue nil\n expires = Time.now + ttl if !ttl.nil?\n record = @store[:key => key]\n\n # Figure out if the record is new or already exists\n if !record\n record = @store.create(:key => key, :value => value, :expires => expires)\n record.value\n else\n record = record.update(:value => value, :expires => expires)\n record.value\n end\n end", "def cache(key = nil)\n key ||= BasicCache.caller_name\n key = key.to_sym\n if include? key\n @store[key].value\n else\n value = yield\n @store[key] = TimeCacheItem.new Time.now, value\n value\n end\n end", "def put(key, value)\n if @table[key].nil?\n insert_into_cache(key, value)\n else\n update_cache(key, value)\n end\n end", "def set key, value, expiration\n backend.set key.to_s, serialize(value), expiration rescue nil\n end", "def expire_cache(key)\n end", "def put(key = '', data = '')\n if key != '' && data != ''\n puts \"Writing into cache with key: #{key}\" if ENV['DEBUG']\n return ::File.write(@cache_dir+key, data)\n end\n\n return false\n end", "def set_keycache(key,encoded_key,expires = 3600)\n @keycache = {\n :expires => Time.now.to_i + expires,\n :key => key,\n :encoded_key => encoded_key\n }\n write_settings\n end", "def save_data(key, data, expire_in = nil)\n expire_in = 3600 if expire_in.nil? # 3600 seconds = 1 hour\n expire_in += Time.now.to_i\n\n _create_cache_directory_if_needed\n expire_cache!(key)\n\n filename = \"#{key}-#{expire_in}-json.cache\"\n\n begin\n File.open(@cache_dir + filename, 'w') {|f| f.write( Marshal.dump(data) ) }\n rescue\n return 'Unable to write to file'\n end\n\n return true \n end", "def set key, data\n\t\t@data_base[ key ] = data\n\t\tupdate_database\n\tend", "def save(key, value)\n return if @capacity <= 0\n\n @cache_mutex.synchronize do\n @map.delete(key) if @map.key?(key)\n\n @map[key] = CacheElement.new(value)\n\n @map.delete(@map.first[0]) if @map.size > @capacity\n nil\n end\n end", "def save_data(key, data, expire_on = nil)\n raise 'The save_data method must be implemented'\n end", "def write(key, value)\n @cache[key] = value\n end", "def cache(key)\n @cache ||= {}\n timestamp, data = @cache[key]\n if timestamp && data && Time.now - timestamp < 1\n puts 'CACHE HIT'\n data\n else\n data = yield\n @cache[key] = [Time.now, data]\n data\n end\n end", "def put(token, expires_in, data={})\n @store.write(key_for(token), data, expires_in: expires_in)\n end", "def test_set_key_value\n result = @cache.set('Key', 'Data', 0, Time.now.to_i + 60)\n cache = @cache.get('Key').args\n\n assert_true result.success\n assert_equal 'STORED', result.message.chomp.split(\"\\s\")[0]\n assert_equal 'Data', cache.data\n end", "def store(key, value, opts = {})\n opts = {:ttl => opts} if opts.is_a?(Integer)\n @cache[\"#{@cache_name}:#{key}\"] = {\n :expires => opts[:ttl] ? Time.now + opts[:ttl].to_i : nil,\n :value => value\n }\n value\n end", "def persist(key); end", "def persist(key); end", "def store(key, contents)\n raise NotImplementedError.new 'Implement store(key, contents) in your CacheManager'\n end", "def write(key, value, ttl = 0, marshaling = true)\n Rails.cache.write(key, value, {expires_in: get_ttl(ttl), raw: !marshaling})\n nil\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: write: K: #{key}. M: #{exc.message}, I: #{exc.inspect}\" }\n nil\n end", "def put(key, value, expiry = 0)\n if servers?\n unless value.blank?\n if @cache.get(key_in_ns(key), true)\n @cache.set(key_in_ns(key), value, expiry, false)\n else\n @cache.add(key_in_ns(key), value, expiry, false)\n end\n else\n @cache.delete(key_in_ns(key)) if @cache.get(key_in_ns(key), true)\n end\n end\n value\n end", "def store(calling_node, key, value)\n @router.touch(calling_node)\n return false unless key.class == DataKey\n @values[key.to_bin] = value\n return true\n end", "def set(key, value, timestamp)\n \n end", "def set(key, value, expiry = adapter.configuration.retrieve(:default_expiry, 0))\n do_with_logging(:set, key) do\n expiry = calculate_expiry_time(expiry)\n adapter.set(key.to_s, marshall(value), expiry.to_i)\n logger.info('', '', :expiry, cache_name, key, expiry.to_i)\n value\n end\n end", "def put(key, value, timeout = @default_timeout)\n @store.synchronize do\n @store.put(key, value, timeout) unless value.nil?\n end\n end", "def write(key, value, options = nil)\r\n super\r\n method = (options && options[:unless_exist]) ? :add : :set\r\n @cache.send(method, valid_key(key), value, expires_in(options), marshal?(options))\r\n true\r\n rescue Memcached::Error => e\r\n log_error(e)\r\n false\r\n end", "def set key, value\n begin\n write_cache_file( key, Marshal::dump(value) )\n flush_expired if gc_auto\n return true\n rescue\n flush_expired if gc_auto\n return false\n end\n end", "def cache_store(key, value, options = {})\n nkey = namespaced(key)\n\n # Get the time after which the cache should be expired\n if options[:ttl]\n ttl = options[:ttl]\n else\n ttl = Ramaze::Cache::Sequel.options[:ttl]\n end\n \n expires = Time.now + ttl if ttl\n \n # The row already exists, update it.\n if @dataset.filter(:key => nkey).count == 1\n serialized_value = serialize(value)\n\n if serialized_value\n @dataset.update(:value => serialize(value), :expires => expires)\n end\n # The row doesn't exist yet.\n else\n serialized_value = serialize(value)\n\n if serialized_value\n @dataset.insert(:key => nkey, :value => serialize(value), :expires => expires)\n end\n end\n\n # Try to deserialize the value. If this fails we'll return a different value\n deserialized = deserialize(@dataset.select(:value).filter(:key => nkey)\n .limit(1).first[:value])\n\n if deserialized\n return deserialized\n else\n return value\n end\n end", "def set(key, value, expires_in = DEFAULT_TTL)\n k = build_key(key)\n\n v = if value.nil? || (value.is_a?(String) && value.strip.empty?)\n nil\n else\n serialize(value)\n end\n\n expiry_int = Integer(expires_in)\n expire_value = expiry_int.positive? ? expiry_int : Integer(DEFAULT_TTL)\n\n with_client do |client|\n client.multi do\n client.set(k, v)\n\n client.expire(k, expire_value)\n end\n end\n end", "def expire_cached(key:)\n Stockpile::CachedValueExpirer.expire_cached(key: key)\n end", "def add_datapoint(key)\n @redis.sadd \"datapoints\", key\n end", "def expire_cache!(key)\n raise 'The expire_cache method must be implemented'\n end", "def cache(named_key, ttl, object)\n @mutex.synchronize {\n self[named_key] = object\n @timestamps[named_key][:ttl] = ttl\n @timestamps[named_key][:expire_type] = :created\n @timestamps[named_key][:is_cache] = true\n } \n end", "def store(key, value, options = {})\n expiration = options[:expire_after] || @default_expiration\n value = Marshal.dump(value)\n redis_key = prefix(key)\n if expiration > 0\n @redis.setex(redis_key, expiration, value)\n else\n @redis.set(redis_key, value)\n end\n value\n end", "def cache_store(key, message)\n @messages[key] = [] if @messages[key].nil?\n @messages[key].shift if @messages[key].length == 10\n @messages[key] << message\n end", "def put(key, value)\n # logger.debug \"put #{key} data\"\n db.put(key, value)\n end", "def cache_store(key, value, options = {})\n nkey = namespaced(key)\n\n # Get the time after which the cache should be expired\n if options[:ttl]\n ttl = options[:ttl]\n else\n ttl = Ramaze::Cache::Sequel.options[:ttl]\n end\n\n expires = Time.now + ttl if ttl\n\n # The row already exists, update it.\n if @dataset.filter(:key => nkey).count == 1\n serialized_value = serialize(value)\n\n if serialized_value\n @dataset.filter(:key => nkey) \\\n .update(:value => serialize(value), :expires => expires)\n end\n # The row doesn't exist yet.\n else\n serialized_value = serialize(value)\n\n if serialized_value\n @dataset.insert(\n :key => nkey, :value => serialize(value), :expires => expires\n )\n end\n end\n\n # Try to deserialize the value. If this fails we'll return a different\n # value\n deserialized = deserialize(@dataset.select(:value) \\\n .filter(:key => nkey) \\\n .limit(1).first[:value])\n\n if deserialized\n return deserialized\n else\n return value\n end\n end", "def cached_set(key, value)\n return unless h = self[:cache]\n Sequel.synchronize{h[key] = value}\n end", "def []=(key, value)\n v = TimedObject.new(value, Time.now + timeout)\n @store[key] = v\n end", "def write(key, value, opts = {})\n _key = Digest::SHA1.hexdigest key\n ttl = opts[:ttl] || @default_ttl\n \n # We don't want to cache errors\n return if value.is_a?(Faraday::Response) && !value.success?\n\n if (value.is_a?(Faraday::Response) && !value.headers['expires'].nil?)\n resp_ttl = DateTime.parse(value.headers['expires']).to_time.to_i - Time.now.to_i\n ttl = resp_ttl if resp_ttl > 0\n end\n\n _value = Marshal.dump value\n\n @memory_store[_key] = value\n $LOG.debug \"Writing to JDG cache hashed #{_key} for #{key}\"\n @conn.put do |req|\n req.url \"/rest/jbossdeveloper/#{@profile}_#{_key}\"\n req.headers['Content-Type'] = opts[:content_type] || 'application/ruby+object'\n req.headers['timeToLiveSeconds'] = ttl.to_s # need to see if we're actually a request and full from that\n req.body = _value\n end\n end", "def set(key, value, timestamp)\n if @store[key].nil?\n @store[key] = [{ 'value' => value, 'timestamp' => timestamp }]\n else\n @store[key] << { 'value' => value, 'timestamp' => timestamp }\n end\n nil\n end", "def set(key, data)\n raise ArgumentError, 'Data must be a hash' unless data.is_a? Hash\n\n val = data[:val]\n exptime = data[:exptime]\n flags = data[:flags]\n\n # First we have to clean up the cache\n evict\n\n @mutex.synchronize do\n # If the key is not in the cache already, initialize it\n unless @data.key?(key)\n @data[key] = {\n flags: 0,\n exptime: 0\n }\n end\n\n # Deleting and storing a key agains moves the key to the last position\n # in the Hash, doing it every time a key is updated ends up with the\n # least used keys in the beggining of the hash.\n @data[key] = @data.delete(key)\n\n # Since the key is being updated the cas has to be updated\n @cas_val[key] = (@cas_accumulator += 1)\n\n # If a flag was given, update it\n @data[key][:flags] = flags if flags\n\n # If an exptime was given, update it and try to update next evict too\n if exptime\n @data[key][:exptime] = exptime\n update_next_evict(exptime)\n end\n\n if val\n @key_size[key] = val.to_s.bytes.length\n raise NoMemoryError,\"The given value's size(#{@key_size[key]}) is bigger than the maximum allowed(#{@max_key_size})\" if @key_size[key] > @max_key_size\n\n @data[key][:val] = val.to_s\n\n verify_used_bytes\n\n end\n end\n end", "def expire_cached(db: :default, key:)\n Stockpile::CachedValueExpirer.expire_cached(db: db, key: key)\n end", "def _store(*key_elements, value)\n cache.put(_key(*key_elements), value)\n end", "def write_entry(key, value, options) # :nodoc:\n method = if options[:unless_exists] || options[:unless_exist]\n :add\n else\n :set\n end\n if ttl = options.delete(:expires_in)\n options[:ttl] ||= ttl\n end\n @data.send(method, key, value, options)\n rescue ::Couchbase::Error::Base => e\n logger.error(\"#{e.class}: #{e.message}\") if logger\n raise if @raise_errors\n false\n end", "def write(key, value)\n key.freeze if key.is_a? String\n\n @memory_store[key] = value\n @file_store.transaction do\n @file_store[key] = value\n end\n end", "def set(key, value)\n self.data ||= {}\n self.data[key.to_s] = value\n self.save!\n end", "def set(key, value, opts = nil)\n value = parser.encode(value)\n @backend.set(key, value, get_expiry(opts))\n rescue ::Memcached::Error\n nil\n end", "def cache_store(key, value, options = {})\n ttl = options[:ttl] || @options[:expires_in]\n\n @client.setex(key, ttl, ::Marshal.dump(value))\n\n return value\n end", "def cached(cache_key)\n begin\n result = yield\n $memcache.set(cache_key, result, 7200)\n warn \"Component #{cache_key} Set Successfully\" \n result\n rescue\n {}\n end\n end", "def add(key, value, ttl=nil, options=nil)\n set(key, value, ttl, options) unless @store.has_key?(key)\n end", "def put(key, value)\n return if @capacity.zero?\n @cache.delete(key)\n @cache.shift while @cache.size >= @capacity\n @cache[key] = value\n end", "def put key, value\n # append value to open file\n # write new keydict value\n @keydict[key] = write_data_entry key, value\n\n # sync\n\n if @data_file.size > MAX_FILE_SIZE\n fname = @data_file.path\n @data_file.close\n @data_file = open_new_data_file\n @old_data_files[fname] = File.open(fname, \"rb\")\n end\n end", "def store_data key, value\n init_data\n\n Bot::DB[my_name][key] = value\n end", "def store_data key, value\n init_data\n\n Bot::DB[my_name][key] = value\n end", "def set(key, value, expiry_time = nil)\n do_with_logging(:set, key) do\n retryable do\n self.adapter.set(key, adapter.marshal(value), calculate_expiry_time(expiry_time))\n end\n end\n end", "def set(key, value, ttl = 0)\n stats[:set] += 1\n handler.set key, value, ttl\n end", "def put(key, object, ttl = nil)\n @cache[key] = CacheEntry.new(object, ttl) unless key.nil? || object.nil?\n end", "def put(key, data)\n queue = queues(key)\n return nil unless queue\n\n @stats[:current_bytes] += data.size\n @stats[:total_items] += 1\n\n queue.push(data)\n\n return true\n end", "def save_to_redis(key, value, time=1209600)\n $redis.with do |conn|\n conn.set key, value\n conn.expire key, time\n end\nend", "def expire_time(key)\n @store[key].expires_at\n end", "def set(key, value)\n path = File.join(@root, \"#{key}.cache\")\n\n # Ensure directory exists\n FileUtils.mkdir_p File.dirname(path)\n\n # Check if cache exists before writing\n exists = File.exist?(path)\n\n # Serialize value\n marshaled = Marshal.dump(value)\n\n # Compress if larger than 4KB\n if marshaled.bytesize > 4 * 1024\n deflater = Zlib::Deflate.new(\n Zlib::BEST_COMPRESSION,\n Zlib::MAX_WBITS,\n Zlib::MAX_MEM_LEVEL,\n Zlib::DEFAULT_STRATEGY\n )\n deflater << marshaled\n raw = deflater.finish\n else\n raw = marshaled\n end\n\n # Write data\n PathUtils.atomic_write(path) do |f|\n f.write(raw)\n @size = size + f.size unless exists\n end\n\n # GC if necessary\n gc! if size > @max_size\n\n value\n end", "def store_value(timestamp, key, value)\n # Prepend the timestamp so we always have unique values\n @redis.zadd(key, timestamp, \"#{timestamp}:#{value}\")\n end", "def set(key, value, ttl: ShopifyClient.config.cache_ttl)\n raise NotImplementedError\n end", "def []=(key, content)\n temp_file = File.join(root, ['tmp', $$, Thread.current.object_id].join('-'))\n File.open(temp_file, 'wb') do |dest|\n if content.respond_to? :to_str\n dest.write(content.to_str)\n else\n content.each {|s| dest.write(s) }\n end\n end\n\n path = cache_path(key)\n File.unlink path if File.exist?(path)\n FileUtils.mkdir_p File.dirname(path), :mode => 0755\n FileUtils.mv temp_file, path\n rescue\n File.unlink temp_file rescue nil\n ensure\n content\n end", "def put(key, value, lifetime: 2**32)\n synchronized do\n @hash[key] = {\n value: value,\n start: Time.now,\n lifetime: lifetime\n }\n end\n end", "def store( key, value )\n key = key.to_s.strip unless key.nil?\n raise \"Invalid key\" if key.nil? or key == ''\n \n @db.execute( %Q{\n INSERT INTO #{TABLE_NAME}\n (key,value,created_at)\n VALUES (?,?,?)\n },\n key,\n value.to_yaml,\n Time.now.to_i\n )\n \n return value\n end", "def set(key, value = nil, lifetime = nil)\n\t\t\tlifetime = Picombo::Config.get('cache.'+@@group+'.lifetime').to_i if lifetime == nil\n\t\t\tunless key.is_a? Hash\n\t\t\t\tkey = {key => value}\n\t\t\tend\n\n\t\t\t@@driver.set(key, lifetime)\n\t\tend", "def expire(key)\n @memcache.delete(key)\n cache_stop_tracking(key)\n Merb.logger.info(\"cache: expired (#{key})\")\n true\n end", "def write_entry(key, entry, options) # :nodoc:\n method = options && options[:unless_exist] ? :add : :set\n value = options[:raw] ? entry.value.to_s : entry\n expires_in = options[:expires_in].to_i\n if expires_in > 0 && !options[:raw]\n # Set the memcache expire a few minutes in the future to support race condition ttls on read\n expires_in += 5.minutes\n end\n @client.send(method, key, value, expires_in, options)\n rescue Spymemcached::Error => e\n logger.error(\"Spymemcached::Error (#{e}): #{e.message}\") if logger\n false\n end", "def write(key, value, options = nil)\n super\n method = options && options[:unless_exist] ? :add : :set\n # memcache-client will break the connection if you send it an integer\n # in raw mode, so we convert it to a string to be sure it continues working.\n value = value.to_s if raw?(options)\n response = @data.send(method, key, value, expires_in(options), raw?(options))\n response == Response::STORED\n rescue MemCache::MemCacheError => e\n logger.error(\"MemCacheError (#{e}): #{e.message}\")\n false\n end", "def _write(key, value, options = nil)\n method = options && options[:unless_exist] ? :add : :set\n response = @data.send(method, key, value, expires_in(options), raw?(options))\n return true if response.nil?\n response == Response::STORED\n rescue MemCache::MemCacheError => e\n logger.error(\"MemCacheError (#{e}): #{e.message}\")\n false\n end", "def set(key, value)\n self.data[key] = { value: value, timestamp: Time.now.to_i }\n self.data[key][:value]\n end", "def store(from, path = nil)\n return unless @cache_base\n\n path ||= from\n clear path\n copy from, (@cache_base + path)\n end", "def cached(key:, ttl: 5.minutes)\n redis = CertManager::Configuration.redis_client\n redis_key = \"User_#{id}_#{key}\"\n value = redis.get(redis_key)\n value = JSON.parse(value) if value\n unless value\n value = yield\n redis.setex(redis_key, ttl, value.to_json)\n end\n value\n end", "def pexpire(key, milliseconds, **kwarg); end", "def persist(key)\n node_for(key).persist(key)\n end", "def save(key, value)\n storage.transaction {storage[key] = value}\n end", "def write(key, content)\n temp_file = File.join(root, ['tmp', $$, Thread.current.unique_id].join('-'))\n File.open(temp_file, 'wb') do |dest|\n if content.respond_to? :to_str\n dest.write(content.to_str)\n else\n content.each {|s| dest.write(s) }\n end\n end\n\n path = cache_path(key)\n if File.exist?(path)\n File.unlink temp_file\n else\n FileUtils.mkdir_p File.dirname(path), :mode => 0755\n FileUtils.mv temp_file, path\n end\n true\n rescue\n File.unlink temp_file rescue false\n false\n end", "def append(key, time)\n Sidekiq.redis do |conn|\n conn.lpush(namespace_key(key), time.to_i)\n end\n end", "def cache(key, value)\n @cache[key] = value\n end", "def promote(keyspace, last_known_key:, timestamp:)\n @storage.set(keyspace.last_known_key_key, last_known_key)\n @storage.set(last_modified_time_key, self.format(timestamp))\n end", "def set(key, value)\n @cache[key] = value\n end", "def cache( name, value, created_on )\n meter = Meter.new( :name => name, :value => value, :created_on => created_on, :created_at => Time.now )\n store( name, meter )\n end", "def put(key, value, expiry=0, replace=1, gen_count=0) \n return Nvmkv::kv_put(@kv_id, @pool_id, key, value, expiry, replace, gen_count)\n end" ]
[ "0.7734826", "0.7644012", "0.72194594", "0.679156", "0.67078197", "0.6538201", "0.65369654", "0.649038", "0.64066094", "0.6400164", "0.64001536", "0.6334162", "0.6283211", "0.6273677", "0.6272086", "0.6251098", "0.6229982", "0.62237704", "0.62216747", "0.62216306", "0.6197455", "0.61643606", "0.6161748", "0.61567247", "0.61212796", "0.6094899", "0.60744137", "0.60628533", "0.6057483", "0.602779", "0.6024879", "0.60077256", "0.60077256", "0.5993653", "0.5987136", "0.5984659", "0.5961718", "0.5947691", "0.59413975", "0.594093", "0.593132", "0.5920848", "0.59128374", "0.59090835", "0.5871945", "0.5870016", "0.5859553", "0.5855308", "0.5852413", "0.5852282", "0.5846947", "0.583168", "0.58143157", "0.58135194", "0.5811859", "0.578302", "0.57796663", "0.57691216", "0.576294", "0.57574064", "0.5744511", "0.57413054", "0.5738125", "0.57262427", "0.5703038", "0.56927174", "0.5689825", "0.5685576", "0.56845915", "0.56845915", "0.56785464", "0.56713843", "0.5669511", "0.5665509", "0.5643775", "0.56424904", "0.5637187", "0.56250834", "0.5623332", "0.56172323", "0.5612937", "0.5604628", "0.56007236", "0.5587984", "0.55869144", "0.55826694", "0.5580908", "0.5577863", "0.5575541", "0.5573928", "0.5573756", "0.5573448", "0.5563297", "0.5553641", "0.55518985", "0.5543943", "0.5536089", "0.552537", "0.55105484", "0.54924333" ]
0.7843338
0
Fetch data from memcache using the specified key The entry is deleted if it has expired ==== Parameter key:: The key identifying the cache entry ==== Returns data:: nil is returned whether the entry expired or was not found
def cache_get(key) data = @memcache.get(key) Merb.logger.info("cache: #{data.nil? ? "miss" : "hit"} (#{key})") data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_get(key)\n if @cache.key?(key)\n _data, _expire = *cache_read(key)\n if _expire.nil? || Time.now < _expire\n Merb.logger.info(\"cache: hit (#{key})\")\n return _data\n end\n @mutex.synchronize do @cache.delete(key) end\n end\n Merb.logger.info(\"cache: miss (#{key})\")\n nil\n end", "def get(key)\n # Return nothing if not in the cache or it has expired.\n return if key.nil?\n\n entry = @cache[key]\n return unless entry\n return if entry.expired?\n\n # Otherwise return the cached object.\n # We don't delete the cached entry because we might need to force its use if its expired and offline\n entry.object\n end", "def cache_get(key)\n cache_file = @config[:cache_directory] / \"#{key}.cache\"\n if File.file?(cache_file)\n _data, _expire = Marshal.load(cache_read(cache_file))\n if _expire.nil? || Time.now < _expire\n Merb.logger.info(\"cache: hit (#{key})\")\n return _data\n end\n FileUtils.rm_f(cache_file)\n end\n Merb.logger.info(\"cache: miss (#{key})\")\n nil\n end", "def read(key)\n return if @expires[key] && @expires[key] < Faulty.current_time\n\n @cache[key]\n end", "def get(key, mtime)\n return nil unless @cache.key?(key)\n\n if @cache[key][:mtime] >= mtime\n @cache[key][:value]\n else\n delete(key)\n nil\n end\n end", "def cache_fetch(key, default = nil)\n nkey = namespaced(key)\n\n # Delete expired rows\n @dataset.select.filter(:key => nkey) do\n expires < Time.now\n end.delete\n\n # Get remaining row (if any)\n result = @dataset.select(:value).filter(:key => nkey).limit(1)\n\n if result.empty?\n return default\n else\n return deserialize(result.first[:value])\n end\n end", "def cache_fetch(key, default = nil)\n nkey = namespaced(key)\n\n # Delete expired rows\n @dataset.select.filter(:key => nkey) do\n expires < Time.now\n end.delete\n\n # Get remaining row (if any)\n result = @dataset.select(:value).filter(:key => nkey).limit(1)\n\n if result.empty?\n return default\n else\n return deserialize(result.first[:value])\n end\n end", "def force_get(key)\n # Return nothing if not in the cache or it has expired.\n return if key.nil?\n\n entry = @cache[key]\n return unless entry\n entry.object\n end", "def cache_fetch(key, expires_in:, &block)\n if ret = mload(key)\n ret\n else\n val = block.call\n mdump(key, val)\n expire(key, expires_in)\n val\n end\n end", "def data_cache(key, time=30.minutes)\n\n return yield if caching_disabled?\n output = Rails.cache.fetch(key, {expires_in: time}) do\n\n yield\n end\n\n return output\n rescue\n # Execute the block if any error with Memcache\n\n return yield\n end", "def get(key = '')\n if key != '' && ::File.exists?(@cache_dir+key)\n # Is the File older than a day?\n if file_age(@cache_dir+key) > 1\n # Delete and return a cache miss\n File.delete(@cache_dir+key)\n return false\n end\n\n puts \"Reading from cache with key: #{key}\" if ENV['DEBUG']\n data = ::File.read(@cache_dir+key)\n return (data.length > 0) ? data : false\n end\n\n return false\n end", "def cached_fetch(key)\n fetch(key) do\n return yield unless h = self[:cache]\n Sequel.synchronize{return h[key] if h.has_key?(key)}\n value = yield\n Sequel.synchronize{h[key] = value}\n end\n end", "def cache_fetch(key, default = nil)\n # Retrieve the data and return it\n record = @store[:key => namespaced(key)]\n record.value rescue default\n end", "def fetch(key, default = nil)\n return default unless entry = @cache[\"#{@cache_name}:#{key}\"]\n return entry[:value] if entry[:expires].nil? || entry[:expires] > Time.now\n @cache.delete(\"#{@cache_name}:#{key}\")\n default\n end", "def fetch(key)\n now = Time.now.public_send(_kind)\n value = get(key, now)\n\n if value.nil?\n clear_all(key)\n value = set(key, now, set_nil(yield))\n end\n\n unset_nil(value)\n end", "def retrieve(key)\n raise NotImplementedError.new 'Implement retrieve(key) in your CacheManager'\n end", "def get(namespace, key)\n @lock.synchronize do\n prune_expired(Time.now.utc.to_i)\n @entries[full_key(namespace, key)]\n end\n end", "def cache_get(key)\n nil\n end", "def get(key, expires_in = 0, &block)\n\n #look for the cache item in the store\n items = @store.select { |i| i[:key] == build_key(key) }\n item = if !items.empty? then items[0] else nil end\n #check if a valid item was found in the store\n if item == nil || (item[:expires] != nil && item[:expires] <= Time.now.utc)\n #a valid item wasn't found so check if a hydration block was specified.\n if block_given?\n #create the item from the block\n value = yield\n #put the item in the store\n set(build_key(key), value, expires_in)\n return value\n else\n #no hydration block was specified\n\n #check if an expired item was found\n if item != nil\n #remove the expired item from the store\n remove(build_key(key))\n end\n return nil\n end\n end\n\n #return the item\n return item[:value]\n end", "def fetch( key )\n key = key.to_s.strip unless key.nil?\n raise \"Invalid key\" if key.nil? or key == ''\n\n id,value,hits = @db.get_first_row(\n \"SELECT id,value,hits \"+\n \"FROM #{TABLE_NAME} \"+\n \"WHERE key=?\",\n key.to_s.strip\n )\n\n # Return nil if there is cache MISS.\n return nil if value.nil?\n \n # Increment the number of hits\n if @count_hits\n @db.execute(\n \"UPDATE #{TABLE_NAME} SET hits=?, updated_at=? WHERE id=?\",\n hits.to_i+1, Time.now.to_i, id\n )\n end\n\n # Otherwise if there is a HIT, parse the YAML into an object\n return YAML::load(value)\n end", "def get(key, lifetime: 2**32, dirty: false, &block)\n if block_given?\n return @hash[key][:value] if (dirty || @dirty) && locked? && expired?(key) && @hash.key?(key)\n synchronized { calc(key, lifetime, &block) }\n else\n rec = @hash[key]\n if expired?(key)\n return rec[:value] if dirty || @dirty\n @hash.delete(key)\n rec = nil\n end\n raise 'The key is absent in the cache' if rec.nil?\n rec[:value]\n end\n end", "def get(key)\n return -1 unless @cache.key?(key)\n val = @cache[key]\n @cache.delete(key)\n @cache[key] = val\n val\n end", "def fetch(key, options = nil) \n if caching_enabled\n result = Rails.cache.fetch(key, options) do\n yield\n end\n Rails.cache.delete(key) unless result\n else\n result = yield\n end\n result\n end", "def cache_read(key)\n @mutex.synchronize do\n @cache[key]\n end\n end", "def read(key, _marshaling = true)\n Rails.cache.read(key)\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: read: K: #{key}. M: #{exc.message}, I: #{exc.inspect}\" }\n nil\n end", "def read(key, _marshaling = true)\n Rails.cache.read(key)\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: read: K: #{key}. M: #{exc.message}, I: #{exc.inspect}\" }\n nil\n end", "def fetch(key, &block)\n result = cache.read(key) if should_cache?\n\n if result.nil?\n if block_given?\n ActiveRecord::Base.connection.with_master do\n result = yield\n end\n result = map_cached_nil_for(result)\n\n if should_cache?\n cache.write(key, result)\n end\n end\n logger.debug \"[IdentityCache] cache miss for #{key}\"\n else\n logger.debug \"[IdentityCache] cache hit for #{key}\"\n end\n\n unmap_cached_nil_for(result)\n end", "def cache(key)\n @cache ||= {}\n timestamp, data = @cache[key]\n if timestamp && data && Time.now - timestamp < 1\n puts 'CACHE HIT'\n data\n else\n data = yield\n @cache[key] = [Time.now, data]\n data\n end\n end", "def cache key\n begin\n if expired?(key)\n content = Proc.new { yield }.call\n set( key, content )\n end\n content ||= get( key )\n return content\n rescue LocalJumpError\n return nil\n end\n end", "def get key\n if key.is_a? Array\n ret = {}\n key.each do |k|\n ret[k] = Marshal::load(read_cache_file(k)) unless expired?(k)\n end\n\n raise if ret.empty?\n return ret\n end\n\n raise if expired?(key)\n\n return Marshal::load(read_cache_file(key))\n rescue\n raise Diskcached::NotFound\n ensure\n flush_expired if gc_auto\n end", "def get_data(key) \n filename = _find_file_key(key)\n return nil if filename.nil?\n file = File.open(@cache_dir + filename, \"rb\")\n contents = file.read\n return Marshal.load(contents)\n end", "def get(key)\n @cache[key]\n end", "def get(key)\n @cache[key]\n end", "def delete(key)\n value = self[key]\n\n @memcached.delete key\n\n value\n end", "def get_cached(cache_key, proc, expiry_time = 5.minute)\n @data = Rails.cache.fetch(cache_key) || proc.call\n @data && Rails.cache.write(cache_key, @data, expires_in: expiry_time)\n\n @data\n end", "def do_cached( key, &block )\n \n # have a look in the cache\n value = fetch( key )\n\n # Cache HIT?\n return value unless value.nil?\n\n # Cache MISS : execute the block\n value = block.call( key )\n\n # Store value in the cache\n return store( key, value )\n end", "def read(key)\n @cache[key]\n end", "def expire_cache(key)\n end", "def [](key)\n File.read(cache_path(key))\n rescue Errno::ENOENT\n nil\n end", "def lookup(key)\n return nil if @capacity <= 0\n\n @cache_mutex.synchronize do\n return nil unless @map.include?(key)\n\n element = @map.delete(key)\n return nil if element.stale?(@timeout)\n\n @map[key] = element\n\n element.value\n end\n end", "def delete(key)\n ref = @cache.delete(key)\n ref.__getobj__ rescue nil\n end", "def cache_delete(key)\n @cache_store.delete(key)\n nil\n end", "def fetch(key)\n result.fetch(key)\n end", "def read_entry(key, options) # :nodoc:\n deserialize_entry(@data.get(key))\n rescue => e\n logger.error(\"Error reading cache entry from redis: #{e}\") if logger\n nil\n end", "def fetch(key, ttl = nil, req_options = nil)\n req_options = req_options.nil? ? CACHE_NILS : req_options.merge(CACHE_NILS) if cache_nils\n val = get(key, req_options)\n return val unless block_given? && not_found?(val)\n\n new_val = yield\n add(key, new_val, ttl_or_default(ttl), req_options)\n new_val\n end", "def cache_read(key: cache_key, **)\n Rails.cache.read(key, namespace: namespace) if validate_key(key)\n end", "def get_set_memcached(key, ttl = 0, marshaling = true)\n raise 'block not given to get_set_memcached' unless block_given?\n\n Rails.cache.fetch(key, {expires_in: get_ttl(ttl), raw: !marshaling}) do\n yield\n end\n\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: fetch: K: #{key.inspect}. M: #{exc.message}, I: #{exc.inspect}\" }\n nil\n end", "def get_set_memcached(key, ttl = 0, marshaling = true)\n raise 'block not given to get_set_memcached' unless block_given?\n\n Rails.cache.fetch(key, {expires_in: get_ttl(ttl), raw: !marshaling}) do\n yield\n end\n\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: fetch: K: #{key.inspect}. M: #{exc.message}, I: #{exc.inspect}\" }\n nil\n end", "def cache key, opts = {}\n if opts[:ttl]\n # cache globaly if ttl provided\n Lux.cache.fetch(key, opts) { yield }\n else\n data = @var[:cache] ||= {}\n data = @var[:cache][key]\n return data if data\n @var[:cache][key] = yield\n end\n end", "def cached(key:, ttl: 5.minutes)\n redis = CertManager::Configuration.redis_client\n redis_key = \"User_#{id}_#{key}\"\n value = redis.get(redis_key)\n value = JSON.parse(value) if value\n unless value\n value = yield\n redis.setex(redis_key, ttl, value.to_json)\n end\n value\n end", "def cache_fetch(key, default = nil)\n value = @store[key]\n value.nil? ? default : value\n rescue ::MemCache::MemCacheError => e\n Log.error(e)\n nil\n end", "def call(key, ttl: TTL)\n key = namespaced_key(key)\n\n fetch(key) || cache(key, yield, ttl)\n end", "def delete(key)\n @monitor.synchronize do\n entry = @stash.delete(key)\n if entry\n @expires_at.delete(entry)\n entry.value\n else\n nil\n end\n end\n end", "def [](key)\n data = @cache.get key\n Marshal.load Base64.decode64(data) if data\n end", "def fetch(key, &block)\n store.compute_if_absent(key, &block)\n end", "def delete(key)\n @backend.delete(key)\n rescue ::Memcached::Error\n nil\n end", "def fetch(key, cache_fetcher_options = {})\n if should_use_cache?\n unmap_cached_nil_for(cache.fetch(key, cache_fetcher_options) do\n map_cached_nil_for(yield)\n end)\n else\n yield\n end\n end", "def expire_cached(key:)\n Stockpile::CachedValueExpirer.expire_cached(key: key)\n end", "def fetch(key, options = {})\n value = $redis.get(key)\n value = JSON(value) if value\n\n unless value\n value = yield\n # TODO: why not setex\n $redis.pipelined do\n $redis.set(key, value.to_json) if value.present?\n $redis.expire(key, options[:ttl] || 600)\n end\n end\n value\n end", "def cache_fetch(key, default = nil)\n @moneta.fetch(key, default)\n end", "def [](key)\n val = @store[key]\n \n if val\n if val.expired?\n prune\n nil\n else\n val.value\n end\n else\n nil\n end\n end", "def fetch(*key)\n @cache[key] ||= yield\n end", "def read_entry(key, options) # :nodoc:\n entry = with { |c| c.get(key, options) }\n # NB Backwards data compatibility, to be removed at some point\n entry.is_a?(ActiveSupport::Cache::Entry) ? entry.value : entry\n rescue Dalli::DalliError => e\n log_dalli_error(e)\n instrument_error(e) if instrument_errors?\n raise if raise_errors?\n nil\n end", "def get(key)\n unless @store[key].present?\n path = path_for_key(key)\n if File.exists?(path)\n begin\n data = File.open(path, 'r') { |f| Marshal.load(f) }\n @store[key] = data\n rescue Exception => e\n Honeybadger.notify(\"Something went wrong reading RSSCache file from disk: #{path} #{e}\")\n end\n end\n end\n @store[key]\n end", "def read(key, options = nil)\n key = key.join(':') if key.is_a?(Array)\n super\n @data.get(key, raw?(options))\n rescue MemCache::MemCacheError => e\n logger.error(\"MemCacheError (#{e}): #{e.message}\")\n nil\n end", "def read(key)\n File.read(cache_path(key))\n rescue Errno::ENOENT\n nil\n end", "def get(key)\n code = @backend.get(key)\n return nil unless code\n parser.decode(code)\n rescue ::Memcached::Error\n nil\n end", "def smart_fetch_from_cache(opts={}, &block)\n id = opts[:id]\n key = cache_key id\n force_write = opts[:force_write]\n expiration = self.expires_in\n Rails.logger.debug \"#{self.name} cache_key will be #{key}, expiration #{expiration}\"\n unless force_write\n entry = Rails.cache.read key\n if entry\n Rails.logger.debug \"#{self.name} Entry is already in cache: #{key}\"\n return (entry == NilClass) ? nil : entry\n end\n end\n wrapped_response = handling_exceptions(key, opts, &block)\n response = wrapped_response[:response]\n if wrapped_response[:exception]\n Rails.logger.debug \"#{self.name} Error occurred; writing entry to cache with short lifespan: #{key}\"\n expiration = Settings.cache.expiration.failure\n else\n Rails.logger.debug \"#{self.name} Writing entry to cache: #{key}\"\n end\n response = process_response_before_caching(response, opts)\n cached_entry = (response.nil?) ? NilClass : response\n Rails.cache.write(key,\n cached_entry,\n :expires_in => expiration,\n :force => true)\n response\n end", "def get(key, expires_in = 0, &block)\n\n end", "def cached?(key)\n if @cache.key?(key)\n _data, _expire = *cache_read(key)\n return true if _expire.nil? || Time.now < _expire\n expire(key)\n end\n false\n end", "def get_cache(key)\n treecache.fetch(key)\n end", "def read_cache_mtime key\n return nil unless File.exists?(cache_file(key))\n File.mtime( cache_file(key) )\n end", "def expire(key)\n @memcache.delete(key)\n cache_stop_tracking(key)\n Merb.logger.info(\"cache: expired (#{key})\")\n true\n end", "def get(key)\n @manager.retrieve(key)\n end", "def get!(key)\n record = object(key)\n return nil unless record\n record.rewrite_cache\n record.value\n end", "def get(key)\n path = File.join(@root, \"#{key}.cache\")\n\n value = safe_open(path) do |f|\n begin\n EncodingUtils.unmarshaled_deflated(f.read, Zlib::MAX_WBITS)\n rescue Exception => e\n @logger.error do\n \"#{self.class}[#{path}] could not be unmarshaled: \" +\n \"#{e.class}: #{e.message}\"\n end\n nil\n end\n end\n\n if value\n FileUtils.touch(path)\n value\n end\n end", "def fetch(key); end", "def fetch_from_cache(id=nil, force_write=false)\n key = cache_key id\n expiration = self.expires_in\n Rails.logger.debug \"#{self.name} cache_key will be #{key}, expiration #{expiration}, forced: #{force_write}\"\n value = Rails.cache.fetch(\n key,\n :expires_in => expiration,\n :force => force_write\n ) do\n if block_given?\n response = yield\n response = process_response_before_caching(response, {id: id, force_write: force_write})\n cached_entry = response.nil? ? NilClass : response\n cached_entry\n end\n end\n (value == NilClass) ? nil : value\n end", "def expire(key)\n @mutex.synchronize do\n @cache.delete(key)\n end\n Merb.logger.info(\"cache: expired (#{key})\")\n true\n end", "def get(key)\n if @memory[key]\n if @memory[key].isAlive(currentTime: Time.now)\n @memory[key]\n else\n @memory.delete(key)\n false\n end\n else\n false\n end\n end", "def get(key, ttl=60)\n if !enabled?\n return (block_given? ? yield : nil)\n end\n k = namespaced key\n cached = @r[k]\n return JSON.parse(cached) if cached\n if block_given?\n val = yield\n put(key, val, ttl)\n val\n else\n nil\n end\n end", "def fetch(key)\n @monitor.synchronize do\n found, value = get(key)\n found ? value : store(key, yield)\n end\n end", "def cache_get(key)\n @messages[key] if @messages.has_key?(key)\n end", "def cached?(key)\n not @memcache.get(key).nil?\n end", "def [](key)\n object = @bucket.get_or_new sanitize_key(key)\n object.data if object.data\n end", "def get_data(key) \n return @data[key]\n end", "def read_entry(key, options) # :nodoc:\n @data.get(key, options)\n rescue ::Couchbase::Error::Base => e\n logger.error(\"#{e.class}: #{e.message}\") if logger\n raise if @raise_errors\n nil\n end", "def cache_fetch(key, default = nil)\n value = @client.get(key)\n value.nil? ? default : ::Marshal.load(value)\n end", "def cached(key)\n return nil unless cache?(key)\n auth_objects_cache[key]\n end", "def read(cache_method, expired_fn: self.class.default_expired_fn, on_miss: F.identity)\n if cache.send(cache_method) && !expired_fn.(cache, cache_method) #not_expired?(cache_method)\n log_cache_hit\n get(cache_method)\n else\n log_cache_failure\n write(cache_method, on_miss.(get(cache_method)))\n end\n end", "def retrieve_from_cache\n retrieved = false\n return retrieved if @_cache_key.nil?\n\n data = Taupe::Cache.get(@_cache_key) || nil\n unless data.nil? || data.empty?\n @_values = data\n retrieved = true\n end\n\n retrieved\n end", "def get_data(key=nil)\n @data ||= {}\n @data[key]\n end", "def fetch(keyspace, options={}, &blk)\n key = @timestamp_manager.current_key(keyspace)\n tags = [\"cache_keyspace:#{keyspace.root}\"]\n\n # happy path: see if the value is there in the key we expect\n value = @storage.read(key, options) if key.present?\n if !value.nil?\n metrics(:increment, 'read.present', tags: tags)\n log(:debug, \"Read value from key: '#{key}'\")\n return value\n end\n\n metrics(:increment, 'read.not-present', tags: tags)\n log(:debug, \"Cache key `#{key}` not present.\")\n\n # try to generate a new value if another process already isn't\n if block_given?\n new_value = generate_and_store(keyspace, options, tags, &blk)\n return new_value unless new_value.nil?\n end\n\n # attempt to fall back to the last known value\n value = last_known_value(keyspace, options, tags)\n return value if value.present?\n\n # wait for the other process if a last known value isn't there\n if key.present?\n return time('wait.run', tags: tags) do\n wait_for_new_value(keyspace, options, tags)\n end\n end\n\n # At this point, there's no key, value, last known key, or last known value.\n # A block wasn't given or couldn't create a non-nil value making it\n # impossible to do anything else, so bail\n if !key.present?\n metrics(:increment, 'no-key.give-up')\n log(:warn, \"Giving up fetching cache keyspace for root `#{keyspace.root}`. No key could be generated.\")\n end\n nil\n end", "def delete(key)\n raise NotImplementedError.new 'Implement delete(key) in your CacheManager'\n end", "def key?(key)\n @mutex.synchronize do\n if @entries.key?(key) && (@entries[key].nil? || @entries[key].expired?)\n @entries.delete(key)\n end\n @entries.key?(key)\n end\n end", "def peek(key)\n return nil if @capacity <= 0\n\n @cache_mutex.synchronize { @map[key]&.value }\n end", "def expire_cache!(key)\n raise 'The expire_cache method must be implemented'\n end", "def find_cached_entry(key, name, options)\n instrument(:read, name, options) do |payload|\n payload[:super_operation] = :fetch if payload\n res = read_entry(key, options)\n payload[:hit] = !!res if payload\n res\n end\n end", "def fetch(*key)\n if block_given?\n @cache[key] ||= yield\n else\n @cache[key]\n end\n end", "def fetch_data(key)\n map { |om| om.fetch_data(key) }.flatten.compact\n end" ]
[ "0.7940819", "0.77572185", "0.7600439", "0.730381", "0.727864", "0.7180364", "0.7180364", "0.71039504", "0.70910084", "0.69935817", "0.6896069", "0.6851046", "0.6850593", "0.68477136", "0.6779603", "0.6746968", "0.6730111", "0.6697182", "0.66674095", "0.66514593", "0.66059864", "0.65847063", "0.6581769", "0.6565864", "0.65565795", "0.65565795", "0.65343094", "0.6533743", "0.65136945", "0.651077", "0.65055114", "0.646771", "0.6451123", "0.63822055", "0.6375546", "0.6352908", "0.63274914", "0.6308442", "0.6305901", "0.630083", "0.62824667", "0.62702394", "0.62679386", "0.62516826", "0.62093675", "0.6205568", "0.6188562", "0.6188562", "0.61746466", "0.6142881", "0.6133001", "0.61145324", "0.6108336", "0.61077595", "0.60998213", "0.6095542", "0.60928917", "0.6085486", "0.6084971", "0.6078077", "0.6077419", "0.60769004", "0.60704476", "0.6067884", "0.606497", "0.6049863", "0.6014608", "0.6011081", "0.6009807", "0.6009624", "0.59893036", "0.5983357", "0.5982092", "0.5975853", "0.59595376", "0.5956993", "0.5955124", "0.59537005", "0.5951445", "0.5944659", "0.59355074", "0.5934193", "0.5933114", "0.5922567", "0.59162956", "0.5911641", "0.5910857", "0.5889847", "0.58705807", "0.58602333", "0.5851493", "0.58512306", "0.5843002", "0.5834647", "0.5831841", "0.58301425", "0.58173305", "0.581581", "0.5815708", "0.5812253" ]
0.75299907
3
Expire the cache entry identified by the given key ==== Parameter key:: The key identifying the cache entry
def expire(key) @memcache.delete(key) cache_stop_tracking(key) Merb.logger.info("cache: expired (#{key})") true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expire_cache(key)\n end", "def expire_cache!(key)\n raise 'The expire_cache method must be implemented'\n end", "def expire_cached(key:)\n Stockpile::CachedValueExpirer.expire_cached(key: key)\n end", "def expire(key)\n @mutex.synchronize do\n @cache.delete(key)\n end\n Merb.logger.info(\"cache: expired (#{key})\")\n true\n end", "def expire(key)\n FileUtils.rm_f(@config[:cache_directory] / \"#{key}.cache\")\n Merb.logger.info(\"cache: expired (#{key})\")\n true\n end", "def expire_action_by_key(key)\n Rails.cache.delete(action_cache_key(key.to_s))\n end", "def invalidate(key)\n full_key = namespaced(key)\n announce_cache_invalidate(full_key)\n\n storage.delete(full_key)\n end", "def expire_cached(db: :default, key:)\n Stockpile::CachedValueExpirer.expire_cached(db: db, key: key)\n end", "def expire(key)\n true\n end", "def expire_match(key)\n @mutex.synchronize do\n @cache.delete_if do |k,v| k.match(/#{key}/) end\n end\n Merb.logger.info(\"cache: expired matching (#{key})\")\n true\n end", "def delete(key)\n @monitor.synchronize do\n entry = @stash.delete(key)\n if entry\n @expires_at.delete(entry)\n entry.value\n else\n nil\n end\n end\n end", "def expire(key, seconds)\n # no-op\n end", "def del(key)\n log(\"remove :Cache, #{key}\")\n connection.remove(:Cache, key)\n end", "def expire(key, seconds, **kwargs); end", "def evict(key)\n @cache.delete(key) unless key.nil?\n end", "def remove(key)\n File.unlink cache_path(key)\n rescue Errno::ENOENT\n end", "def cache_delete(key)\n @cache_store.delete(key)\n nil\n end", "def delete key\n File.delete( cache_file(key) ) if File.exists?( cache_file(key) )\n end", "def delete(key)\n File.unlink cache_path(key)\n rescue Errno::ENOENT\n end", "def expire_time(key)\n @store[key].expires_at\n end", "def delete(key)\n raise NotImplementedError.new 'Implement delete(key) in your CacheManager'\n end", "def remove(*key)\n @cache.delete(key)\n end", "def expire(key, seconds, **kwargs)\n node_for(key).expire(key, seconds, **kwargs)\n end", "def access(key)\n @accesses.delete(key)\n @accesses.unshift(key)\n expired_key = @accesses.delete_at(1000)\n self.delete(expired_key) if expired_key != nil\n return key\n end", "def delete(key)\n value = self[key]\n\n @memcached.delete key\n\n value\n end", "def expire_cache_keys *keys\r\n keys.each { |k| @cache.delete k.to_sym }\r\n end", "def cache_delete(key: cache_key, **)\n Rails.cache.delete(key, namespace: namespace) if validate_key(key)\n end", "def delete(key)\n id = @cache[key]\n @cache.delete(key)\n @index.delete(id) if id\n end", "def expire_match(key)\n #files = Dir.glob(@config[:cache_directory] / \"#{key}*.cache\")\n files = Dir.glob(@config[:cache_directory] / \"#{key}*\")\n FileUtils.rm_rf(files)\n Merb.logger.info(\"cache: expired matching (#{key})\")\n true\n end", "def expire\n Rails.cache.delete(CACHE_KEY)\n end", "def delete(key)\n ref = @cache.delete(key)\n ref.__getobj__ rescue nil\n end", "def expire(key, seconds)\n call(key, [:expire, key, seconds], transform: Redis::Boolify)\n end", "def _expire_cache(*keys)\n Rails.cache.delete( _cache_key(keys) )\n end", "def expireat(key, unix_time, **kwargs); end", "def invalidate(key, time = Time.now)\n filename = filename_from_url(key)\n File.delete(filename) if File.stat(filename).mtime < time\n rescue Errno::ENOENT\n false\n end", "def expire_match(key)\n if @tracking_key\n for _key in get_tracked_keys\n expire(_key) if /#{key}/ =~ _key\n end\n else\n Merb.logger.info(\"cache: expire_match is not supported with memcache (set :no_tracking => false in your config\")\n end\n true\n end", "def expire_match(key)\n true\n end", "def decr(key); end", "def decr(key); end", "def dirty_cache(key=nil)\n if(key.nil?)\n @elephant_cache.clear\n else\n @elephant_cache.delete(key)\n end\n end", "def clear_key(key)\n @redis.del(key)\n end", "def key?(key)\n @mutex.synchronize do\n if @entries.key?(key) && (@entries[key].nil? || @entries[key].expired?)\n @entries.delete(key)\n end\n @entries.key?(key)\n end\n end", "def pexpire(key, milliseconds, **kwarg); end", "def expire(key, expires_in)\n namespace(key) { |key| super(key, expires_in) }\n end", "def decr(key)\n node_for(key).decr(key)\n end", "def delete(key)\n @redis.delete(key)\n end", "def pexpire(key, milliseconds)\n call(key, [:pexpire, key, milliseconds], transform: Redis::Boolify)\n end", "def expire(key, seconds, nx: T.unsafe(nil), xx: T.unsafe(nil), gt: T.unsafe(nil), lt: T.unsafe(nil)); end", "def expire(url)\n if url == :all\n if store.respond_to?(:keys)\n urls.each{ |u| expire(u) }\n else\n raise(NoMethodError, \"The Geocoder cache store must implement `#keys` for `expire(:all)` to work\")\n end\n else\n expire_single_url(url)\n end\n end", "def delete(resource, key)\n @cache[resource].delete(key)\n end", "def pexpire(key, milliseconds, **kwarg)\n node_for(key).pexpire(key, milliseconds, **kwarg)\n end", "def process_expire(command)\n key = command[0]\n seconds = command[1]\n options = {:expiration => seconds }\n @connection.touch(as_key(key), options)? 0 : 1 # return 1 when result is OK = 0\n rescue ::Aerospike::Exceptions::Aerospike => e\n if (e.result_code == ::Aerospike::ResultCode::KEY_NOT_FOUND_ERROR)\n return 0\n else\n raise\n end\n end", "def expire_cache_key?\n true\n end", "def delete key\n @internal_hash[key].clear\n end", "def clear_by_key(key)\n delete(key)\n end", "def expire(widget, options = {})\n Rails.logger.debug \"-- cache EXPIRATION --\"\n begin\n model_key = calculate_key(widget, options.slice(:scope, :policy_context))\n delete(model_key) if model_key\n\n with_instance_content(widget, options) do |instance_key|\n keys = retrieve(instance_key)[:keys] rescue []\n keys.each{|key| delete(key)}\n delete(instance_key)\n end\n rescue CacheNotAvailable\n end\n end", "def read(key)\n return if @expires[key] && @expires[key] < Faulty.current_time\n\n @cache[key]\n end", "def expireat(key, unix_time, **kwargs)\n node_for(key).expireat(key, unix_time, **kwargs)\n end", "def delete(key)\n data.delete(key)\n @deleted_hash[key] = nil\n end", "def delete(key)\n @internal_hash.delete(key)\n end", "def expire=(_); end", "def expire!(exp = 0)\n self.data.select{|a,b| b[:timestamp] <= Time.now.to_i - exp }.keys.map{ |key| self.data.delete(key) }\n end", "def delete_key(key)\n end", "def delete(key)\n transaction do |y|\n y.delete(key)\n end\n end", "def delete(key)\n check_return_code(\n Lib.memcached_delete(@struct, key, IGNORED),\n key\n )\n rescue => e\n tries ||= 0\n raise unless tries < options[:exception_retry_limit] && should_retry(e)\n tries += 1\n retry\n end", "def delete(key)\n perform_delete(:delete, key)\n end", "def expire_cache!\n @snapshot = nil\n end", "def delete(key)\n if item = super\n lru_delete(item)\n end\n end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def unlock!(key)\n ::DatabaseEntryLock.destroy_by(lock_key: key)\n end", "def write(key, value, expires_in: nil)\n @cache[key] = value\n @expires[key] = Faulty.current_time + expires_in unless expires_in.nil?\n end", "def expire!\n\t\tself.expires = Time.at(0)\n\tend", "def delete(key)\n @hash.delete key\n @key_hash.delete key\n end", "def cache_stop_tracking(key)\n return unless @tracking_key\n keys = get_tracked_keys\n keys.delete(key)\n set_tracked_keys(keys)\n end", "def ttl(key)\n send_command([:ttl, key])\n end", "def delete(key, options = {})\n old_key_present = key_exists?(key)\n value = @data[key]\n @data.delete(key)\n @key_access_store.delete(key)\n @cache_size -= compute_value_size(value) if @cache_size > 0 && old_key_present\n end", "def autoexpire\n redis.expire(key, timespan)\n end", "def delete(key)\n raise ArgumentError, \"+key+ is not an Array, but was #{key.class}\" unless Array === key\n\n @second_level_cache.delete(key) if @second_level_cache\n @cache.delete(key)\n end", "def expireat(key, unix_time, nx: T.unsafe(nil), xx: T.unsafe(nil), gt: T.unsafe(nil), lt: T.unsafe(nil)); end", "def destroy_image(key)\n return unless key.is_a?(String) && !key.empty?\n name, ext = key.split('.')\n self.transaction do\n record = find_by_name name\n # do nothing if not found\n return unless record\n if record.refcount > 1\n record.refcount -= 1\n record.save\n else\n if record.keep_till && record.keep_till > Time.now\n record.refcount = 0\n record.save\n else\n record.purge_image_data\n record.delete\n end\n end\n end\n cleanup_temporary_image\n end", "def clear!(key = nil)\n resp = super\n resp.instance_of?(TimeCacheItem) ? resp.value : resp\n end", "def destroy_key(key_id)\n destroy_resource :key, key_id\n end", "def delete(key)\n @backend.delete(key)\n rescue ::Memcached::Error\n nil\n end", "def delete(key, options = nil)\n Rails.cache.delete(key, options)\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: delete: K: #{key.inspect}. M: #{exc.message}, I: #{exc.inspect}\" }\n nil\n end", "def delete(key, options = nil)\n Rails.cache.delete(key, options)\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: delete: K: #{key.inspect}. M: #{exc.message}, I: #{exc.inspect}\" }\n nil\n end", "def invalidate_cache\n accessor.cache_manager.invalidate(resource.uri)\n end", "def delete_key(key)\n @keys.delete(key)\n @passwords.each_key { |id| set_password(id, get_password(id)) }\n @otp_keys.each_key { |id| set_otp_key(id, get_otp_key(id)) }\n end", "def delete(key)\n pop if change_key(key, nil, true)\n end", "def has key, expire_time = nil\n return false unless CACHE.has_key? key\n return true unless expire_time\n return false if Time.at(CACHE[key][1]) < (Time.now - expire_time)\n true\n end", "def ttl(key)\n key = add_namespace(key)\n @redis.ttl(key)\n end", "def remove(key)\n a_hash[key] = nil\n end", "def delete key\n write_data_entry key, nil, true\n @keydict[key] = nil\n\n sync\n end", "def delete(key)\n storage.transaction {storage.delete(key)}\n end", "def remove(key); end", "def pexpireat(key, ms_unix_time, **kwarg)\n node_for(key).pexpireat(key, ms_unix_time, **kwarg)\n end", "def expire\n post(\"/orders/#{order_id}/order_items/#{id}/expire\")\n end" ]
[ "0.8650605", "0.81345445", "0.8124842", "0.7945606", "0.78019726", "0.77956474", "0.767175", "0.76361096", "0.74848175", "0.73043", "0.7248697", "0.72268957", "0.71131635", "0.70753336", "0.7050648", "0.70168084", "0.699746", "0.69944173", "0.6994411", "0.6937676", "0.6841984", "0.68136334", "0.6779581", "0.6754844", "0.6754473", "0.67461497", "0.67401874", "0.6688783", "0.6675839", "0.6645354", "0.66173255", "0.6610071", "0.6543273", "0.65406543", "0.64996755", "0.64961827", "0.64602476", "0.6458374", "0.6458374", "0.6455892", "0.64450866", "0.6443854", "0.64413506", "0.64246607", "0.6364587", "0.6350276", "0.63283324", "0.6323117", "0.63190264", "0.6296826", "0.6284391", "0.6264024", "0.6252963", "0.6250936", "0.62484026", "0.61844516", "0.6168091", "0.61602277", "0.61589575", "0.61469865", "0.6138276", "0.6123392", "0.6092599", "0.6088461", "0.6072352", "0.6039155", "0.6036562", "0.60310715", "0.60071117", "0.60071117", "0.60071117", "0.60071117", "0.60071117", "0.59917", "0.59914595", "0.5983267", "0.5976954", "0.5968069", "0.5952443", "0.59453803", "0.5943568", "0.5938978", "0.5936037", "0.5933533", "0.59269875", "0.59257597", "0.5919673", "0.59117776", "0.59109217", "0.59011316", "0.589101", "0.58882064", "0.58857757", "0.5885405", "0.58774596", "0.58713657", "0.5867663", "0.58672243", "0.5861736", "0.585601" ]
0.7805009
4
Expire the cache entries matching the given key ==== Parameter key:: The key matching the cache entries ==== Additional info In memcache this requires to keep track of all keys (on by default). If you don't need this, set :no_tracking => true in the config.
def expire_match(key) if @tracking_key for _key in get_tracked_keys expire(_key) if /#{key}/ =~ _key end else Merb.logger.info("cache: expire_match is not supported with memcache (set :no_tracking => false in your config") end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expire_cache(key)\n end", "def expire_cached(key:)\n Stockpile::CachedValueExpirer.expire_cached(key: key)\n end", "def expire_cache!(key)\n raise 'The expire_cache method must be implemented'\n end", "def expire(key)\n @memcache.delete(key)\n cache_stop_tracking(key)\n Merb.logger.info(\"cache: expired (#{key})\")\n true\n end", "def expire(key)\n FileUtils.rm_f(@config[:cache_directory] / \"#{key}.cache\")\n Merb.logger.info(\"cache: expired (#{key})\")\n true\n end", "def expire(key)\n @mutex.synchronize do\n @cache.delete(key)\n end\n Merb.logger.info(\"cache: expired (#{key})\")\n true\n end", "def cache_stop_tracking(key)\n return unless @tracking_key\n keys = get_tracked_keys\n keys.delete(key)\n set_tracked_keys(keys)\n end", "def expire_cached(db: :default, key:)\n Stockpile::CachedValueExpirer.expire_cached(db: db, key: key)\n end", "def expire_action_by_key(key)\n Rails.cache.delete(action_cache_key(key.to_s))\n end", "def expire_match(key)\n @mutex.synchronize do\n @cache.delete_if do |k,v| k.match(/#{key}/) end\n end\n Merb.logger.info(\"cache: expired matching (#{key})\")\n true\n end", "def expire_cache_keys *keys\r\n keys.each { |k| @cache.delete k.to_sym }\r\n end", "def invalidate(key)\n full_key = namespaced(key)\n announce_cache_invalidate(full_key)\n\n storage.delete(full_key)\n end", "def expire_match(key)\n #files = Dir.glob(@config[:cache_directory] / \"#{key}*.cache\")\n files = Dir.glob(@config[:cache_directory] / \"#{key}*\")\n FileUtils.rm_rf(files)\n Merb.logger.info(\"cache: expired matching (#{key})\")\n true\n end", "def _expire_cache(*keys)\n Rails.cache.delete( _cache_key(keys) )\n end", "def expire_all\n @memcache.flush_all\n stop_tracking_keys\n Merb.logger.info(\"cache: expired all\")\n true\n end", "def expire(key)\n true\n end", "def remove(*key)\n @cache.delete(key)\n end", "def expire\n Rails.cache.delete(CACHE_KEY)\n end", "def del(key)\n log(\"remove :Cache, #{key}\")\n connection.remove(:Cache, key)\n end", "def cache_delete(key: cache_key, **)\n Rails.cache.delete(key, namespace: namespace) if validate_key(key)\n end", "def expire_all\n adapter.expire_all\n logger.info('', '', :expired, cache_name)\n end", "def delete key\n File.delete( cache_file(key) ) if File.exists?( cache_file(key) )\n end", "def dirty_cache(key=nil)\n if(key.nil?)\n @elephant_cache.clear\n else\n @elephant_cache.delete(key)\n end\n end", "def expire!(exp = 0)\n self.data.select{|a,b| b[:timestamp] <= Time.now.to_i - exp }.keys.map{ |key| self.data.delete(key) }\n end", "def expire(key, seconds)\n # no-op\n end", "def cache_delete(key)\n @cache_store.delete(key)\n nil\n end", "def stop_tracking_keys\n @memcache.delete(@tracking_key) if @tracking_key\n end", "def expire(url)\n if url == :all\n if store.respond_to?(:keys)\n urls.each{ |u| expire(u) }\n else\n raise(NoMethodError, \"The Geocoder cache store must implement `#keys` for `expire(:all)` to work\")\n end\n else\n expire_single_url(url)\n end\n end", "def evict(key)\n @cache.delete(key) unless key.nil?\n end", "def delete(key)\n @monitor.synchronize do\n entry = @stash.delete(key)\n if entry\n @expires_at.delete(entry)\n entry.value\n else\n nil\n end\n end\n end", "def delete(key)\n raise NotImplementedError.new 'Implement delete(key) in your CacheManager'\n end", "def expire_match(key)\n true\n end", "def expire(key, seconds, **kwargs); end", "def delete(key)\n id = @cache[key]\n @cache.delete(key)\n @index.delete(id) if id\n end", "def expire_time(key)\n @store[key].expires_at\n end", "def expire_all\n @mutex.synchronize do\n @cache.clear\n end\n Merb.logger.info(\"cache: expired all\")\n true\n end", "def delete(key)\n File.unlink cache_path(key)\n rescue Errno::ENOENT\n end", "def remove(key)\n File.unlink cache_path(key)\n rescue Errno::ENOENT\n end", "def clear_cache! *keys\n clear_cache *keys\n ipcm_trigger :clear_cache, *keys\n end", "def delete(key)\n value = self[key]\n\n @memcached.delete key\n\n value\n end", "def expire(widget, options = {})\n Rails.logger.debug \"-- cache EXPIRATION --\"\n begin\n model_key = calculate_key(widget, options.slice(:scope, :policy_context))\n delete(model_key) if model_key\n\n with_instance_content(widget, options) do |instance_key|\n keys = retrieve(instance_key)[:keys] rescue []\n keys.each{|key| delete(key)}\n delete(instance_key)\n end\n rescue CacheNotAvailable\n end\n end", "def invalidate_cache! now\n end", "def expire_cache_key?\n true\n end", "def key?(key)\n @mutex.synchronize do\n if @entries.key?(key) && (@entries[key].nil? || @entries[key].expired?)\n @entries.delete(key)\n end\n @entries.key?(key)\n end\n end", "def clear_cache_like! *keys\n clear_cache_like *keys\n ipcm_trigger :clear_cache_like, *keys\n end", "def invalidate(key, time = Time.now)\n filename = filename_from_url(key)\n File.delete(filename) if File.stat(filename).mtime < time\n rescue Errno::ENOENT\n false\n end", "def cache_delete(*keys)\n if keys\n keys.each do |key|\n record = @store[:key => namespaced(key)]\n record.delete if record \n end\n end\n end", "def expire_cache!\n @snapshot = nil\n end", "def expire\n post(\"/orders/#{order_id}/order_items/#{id}/expire\")\n end", "def cache_delete(key, *keys)\n # Remove a single key\n if keys.empty?\n nkey = namespaced(key)\n result = @dataset.select(:value).filter(:key => nkey).limit(1)\n\n # Ramaze expects nil values\n if result.empty?\n result = nil\n else\n result = deserialize(result.first[:value])\n end\n\n @dataset.filter(:key => nkey).delete\n # Remove multiple keys\n else\n nkeys = [key, keys].flatten.map! { |n| namespaced(n) }\n result = dataset.select(:value).filter(:key => nkeys)\n\n result.map! do |row|\n deserialize(row[:value])\n end\n\n @dataset.filter(:key => nkeys).delete\n end\n\n return result\n end", "def cache_delete(key, *keys)\n # Remove a single key\n if keys.empty?\n nkey = namespaced(key)\n result = @dataset.select(:value).filter(:key => nkey).limit(1)\n\n # Ramaze expects nil values\n if result.empty?\n result = nil\n else\n result = deserialize(result.first[:value])\n end\n\n @dataset.filter(:key => nkey).delete\n # Remove multiple keys\n else\n nkeys = [key, keys].flatten.map! { |nkey| namespaced(nkey) }\n result = dataset.select(:value).filter(:key => nkeys)\n\n result.map! do |row|\n deserialize(row[:value])\n end\n\n @dataset.filter(:key => nkeys).delete\n end\n \n return result\n end", "def expire_cache_for(record)\n case record\n when Page\n expire_page_caches(record.id)\n when Comment\n expire_page(:controller => 'pages', :action => 'index', :page_id => record.page_id, :on => \"comments_count\")\n expire_page(:controller => 'pages', :action => 'index', :page_id => record.page_id, :on => \"comments_list\")\n end\n end", "def expireat(key, unix_time, **kwargs); end", "def gc!\n delete_if { |key, s| s.expired? }\n end", "def expire(key, expires_in)\n namespace(key) { |key| super(key, expires_in) }\n end", "def cache_delete(*keys)\n @client.del(*keys)\n end", "def remove_expired_keys\n self.user_key.each do |user_key|\n if user_key.expired?\n self.remove_user_key(user_key)\n user_key.delete\n end\n end\n end", "def clear_key(key)\n @redis.del(key)\n end", "def delete_from_cache(*keys, **opts)\n base_key = self.base_redis_key opts\n keys.each do |key|\n Cachable::redis.del \"#{base_key}_#{key}\"\n end\n end", "def delete(key)\n raise ArgumentError, \"+key+ is not an Array, but was #{key.class}\" unless Array === key\n\n @second_level_cache.delete(key) if @second_level_cache\n @cache.delete(key)\n end", "def expire_all\n FileUtils.rm_rf(Dir.glob(\"#{@config[:cache_directory]}/*\"))\n Merb.logger.info(\"cache: expired all\")\n true\n end", "def pexpire(key, milliseconds, **kwarg); end", "def clear!(key = nil)\n resp = super\n resp.instance_of?(TimeCacheItem) ? resp.value : resp\n end", "def invalidate_cache!\n @cache_valid_from = Time.now\n end", "def delete key\n @internal_hash[key].clear\n end", "def delete(key)\n ref = @cache.delete(key)\n ref.__getobj__ rescue nil\n end", "def refill\n now = Time.now.to_i\n cache_set.each {|rec|\n ttl = rec[:end_ts].to_i - now\n cache_write( rec[:key], rec[:value], ttl ) if ttl > 0 \\\n if rec[:value] and rec[:value].length > MAX_OBJ_SIZE and ttl > 0\n }\n end", "def cache_delete(*keys)\n keys.each {|key| @moneta.delete(key) }\n end", "def expire(key, seconds, **kwargs)\n node_for(key).expire(key, seconds, **kwargs)\n end", "def access(key)\n @accesses.delete(key)\n @accesses.unshift(key)\n expired_key = @accesses.delete_at(1000)\n self.delete(expired_key) if expired_key != nil\n return key\n end", "def expire_car_all_cache\n\t Rails.cache.delete(\"Car.all\")\n\t Rails.cache.delete(\"car.build_cost.#{self.id}\")\n\t Rails.cache.delete(\"car.number_pics.#{self.id}\")\n\tend", "def after_update(entry)\n expire_cache_for(entry)\n end", "def autoexpire\n redis.expire(key, timespan)\n end", "def cache_delete\n model.send(:cache_delete, cache_key)\n end", "def keep(key, *args)\n @report[key] ||= {}\n @report[key][args[0]] ||= {}\n @report[key][args[0]][args[1]] = args[2..-1]\n end", "def clear_by_key(key)\n delete(key)\n end", "def clean\n synchronized { @hash.delete_if { |_key, value| expired?(value) } }\n end", "def expire_cached_pages_by_reference(record, method = nil)\n expire_pages CachedPage.find_by_reference(record, method)\n end", "def clear_all(key)\n _mutex.synchronize do\n _store[key] = {}\n end\n end", "def deleteExpiredKeys(currentTime: Time.now)\n memory.delete_if { |key, item| item.isAlive(currentTime) }\n end", "def expire(key, seconds)\n call(key, [:expire, key, seconds], transform: Redis::Boolify)\n end", "def expire_for_request(info_request)\n # Clear out cached entries - use low level expire_fragment, even though\n # we are clearing results from caches_action, for several reasons:\n # * We can't use expire_action here, as doesn't seem to be\n # compatible with the :only_path we used in the caches_action\n # call. \n # * expire_fragment lets us use a regular expression which is\n # simpler than having to get all the parameters right for the\n # path, and calling for HTML version vs. raw attachment version.\n # * Regular expression means we cope properly with filenames\n # changed by censor rules, which change the URL.\n # * It's also possible to load a file with any name by changing\n # the URL, the regular expression makes sure the cache is\n # cleared even if someone did that.\n expire_fragment /views\\/request\\/#{info_request.id}.*/\n # also force a search reindexing (so changed text reflected in search)\n info_request.reindex_request_events\n end", "def delete(key)\n @internal_hash.delete(key)\n end", "def purge_expired_keys\n Thread.new do\n loop do\n sleep PURGE_EXPIRED_KEYS_FREQUENCY_SECS\n puts 'Purging expired keys...'\n @cache_handler.purge_expired_keys\n end\n end\n end", "def delete(key)\n if item = super\n lru_delete(item)\n end\n end", "def expire_cache_control\n @response[PRAGMA] = 'no-cache'\n expires EPOCH, :no_cache, :no_store, :must_revalidate, :max_age => 0\n end", "def expire_cache_for(class_name)\n self.class.reflections.each do |name, reflection|\n if reflection.options[:cached] and reflection.class_name == class_name\n cache_delete(reflection)\n end\n end\n end", "def cleanup\n @keys.each { |key, time|\n if expired_kalive?(key, 300)\n delete_key(key)\n end\n\n if expired_unlocked?(key, 60)\n unblock_key(key)\n end\n }\n \n end", "def delete(key, options = nil)\n Rails.cache.delete(key, options)\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: delete: K: #{key.inspect}. M: #{exc.message}, I: #{exc.inspect}\" }\n nil\n end", "def delete(key, options = nil)\n Rails.cache.delete(key, options)\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: delete: K: #{key.inspect}. M: #{exc.message}, I: #{exc.inspect}\" }\n nil\n end", "def expire(name=nil, *args)\n return if Rails.env == 'development'\n \n name = name.to_sym\n cache = Cacheable.cache[self]\n time = Time.at(0)\n if name.nil?\n cache.values.each do |method_args|\n method_args.values.each do |params|\n params[:time] = time\n end\n end\n elsif args.nil? || args.empty?\n cache[name].values.each do |params|\n params[:time] = time\n end\n else\n cache[name][args][:time] = time\n end\n end", "def has key, expire_time = nil\n return false unless CACHE.has_key? key\n return true unless expire_time\n return false if Time.at(CACHE[key][1]) < (Time.now - expire_time)\n true\n end", "def clear\n @redis.delete_matched(\"#{@key}:*\")\n end", "def expire!\n expire_faults!\n expire_perfs!\n end", "def pexpire(key, milliseconds)\n call(key, [:pexpire, key, milliseconds], transform: Redis::Boolify)\n end", "def clear_cache\n Rails.cache.delete(self.class.cache_key(self.key))\n end", "def expire_cache(page_name)\n expire_pages(ContentPage.find_all_by_page_name(page_name))\n end", "def expire!\n\t\tself.expires = Time.at(0)\n\tend", "def expired?(key)\n rec = @hash[key]\n !rec.nil? && rec[:start] < Time.now - rec[:lifetime]\n end", "def keep(key=nil)\n if key\n @next[key] = @now[key]\n else\n @next.merge!(@now)\n end\n end" ]
[ "0.7690933", "0.743312", "0.7368731", "0.73639005", "0.71412426", "0.7056961", "0.7027988", "0.69537395", "0.6872803", "0.68672925", "0.68589056", "0.6831445", "0.6762894", "0.6760081", "0.64866287", "0.6430128", "0.63304", "0.63207585", "0.62576133", "0.62451077", "0.6230127", "0.6199565", "0.61908215", "0.6187623", "0.61711", "0.6165978", "0.61565405", "0.6098934", "0.6052247", "0.60280824", "0.6004306", "0.5958839", "0.59339327", "0.59318215", "0.5927379", "0.5837805", "0.5830864", "0.5825975", "0.5787049", "0.5776407", "0.5758238", "0.5715944", "0.57001173", "0.5693976", "0.56651837", "0.5652095", "0.56353265", "0.56331253", "0.56095225", "0.56060904", "0.55960745", "0.55909216", "0.55884206", "0.55702174", "0.55546397", "0.5543552", "0.55403405", "0.55397505", "0.55380464", "0.55378044", "0.55267316", "0.5507881", "0.55064356", "0.55063194", "0.5501318", "0.54714835", "0.54637194", "0.5459928", "0.5447536", "0.5444993", "0.5443228", "0.544204", "0.5432303", "0.54302084", "0.5429398", "0.54246646", "0.5424321", "0.5406267", "0.54052913", "0.5402023", "0.5381981", "0.5373375", "0.5369238", "0.53656197", "0.53549165", "0.53530896", "0.53522485", "0.53436726", "0.5338481", "0.53376967", "0.53252834", "0.53105503", "0.5308572", "0.53083795", "0.5307977", "0.53077036", "0.53070474", "0.5306878", "0.5305631", "0.52962345" ]
0.751995
1
Expire all the cache entries
def expire_all @memcache.flush_all stop_tracking_keys Merb.logger.info("cache: expired all") true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expire_all\n adapter.expire_all\n logger.info('', '', :expired, cache_name)\n end", "def _expire_cache(*keys)\n Rails.cache.delete( _cache_key(keys) )\n end", "def expire_all\n @mutex.synchronize do\n @cache.clear\n end\n Merb.logger.info(\"cache: expired all\")\n true\n end", "def expire_cache(key)\n end", "def expire_all\n FileUtils.rm_rf(Dir.glob(\"#{@config[:cache_directory]}/*\"))\n Merb.logger.info(\"cache: expired all\")\n true\n end", "def expire\n Rails.cache.delete(CACHE_KEY)\n end", "def expire_cache_keys *keys\r\n keys.each { |k| @cache.delete k.to_sym }\r\n end", "def expire!\n expire_faults!\n expire_perfs!\n end", "def expire_cache!\n @snapshot = nil\n end", "def expire_cached(key:)\n Stockpile::CachedValueExpirer.expire_cached(key: key)\n end", "def expire_all\n true\n end", "def expire_cache\n cache_dir = ActionController::Base.page_cache_directory\n dirs = [\"articles\", \"tags\"]\n files = [\"index.html\", \"about.html\", \"contact.html\", \"articles.html\", \"tags.html\", \"articles.rss\", \"comments.rss\"]\n (files + dirs).each {|f| FileUtils.rm_r(Dir.glob(cache_dir + \"/#{f}\")) rescue Errno::ENOENT }\n RAILS_DEFAULT_LOGGER.info(\"Cache directory '#{cache_dir}' fully sweeped.\")\n end", "def expire_cache!(key)\n raise 'The expire_cache method must be implemented'\n end", "def expire_cached(db: :default, key:)\n Stockpile::CachedValueExpirer.expire_cached(db: db, key: key)\n end", "def mark_expired\n all.each do |u|\n u.expire! if u.expired? && u.expired_at.nil?\n end\n end", "def invalidate_all!\n FileUtils.rm_r(@cache_path, force: true, secure: true)\n end", "def flush_expired!\n Dir[ File.join( store, \"*.cache\" ) ].each do |f|\n if (File.mtime(f)+timeout) <= Time.now\n File.delete(f)\n end\n end\n @gc_last = Time.now\n end", "def invalidate_cache! now\n end", "def expire_cache\n expired_parent_caches = expire_parent_caches\n expired_attribute_indexes = expire_attribute_indexes\n\n expired_parent_caches && expired_attribute_indexes\n end", "def expire_all\n do_with_logging(:expire_all, nil) do\n retryable do\n self.adapter.expire_all\n nil\n end\n end\n end", "def after_destroy(entry)\n expire_cache_for(entry)\n end", "def refill\n now = Time.now.to_i\n cache_set.each {|rec|\n ttl = rec[:end_ts].to_i - now\n cache_write( rec[:key], rec[:value], ttl ) if ttl > 0 \\\n if rec[:value] and rec[:value].length > MAX_OBJ_SIZE and ttl > 0\n }\n end", "def expire!(exp = 0)\n self.data.select{|a,b| b[:timestamp] <= Time.now.to_i - exp }.keys.map{ |key| self.data.delete(key) }\n end", "def expire_car_all_cache\n\t Rails.cache.delete(\"Car.all\")\n\t Rails.cache.delete(\"car.build_cost.#{self.id}\")\n\t Rails.cache.delete(\"car.number_pics.#{self.id}\")\n\tend", "def remove_articles_cache\n Article.find(:all).each do |article|\n expire_article(article)\n end\n end", "def expire_cache_for(class_name)\n self.class.reflections.each do |name, reflection|\n if reflection.options[:cached] and reflection.class_name == class_name\n cache_delete(reflection)\n end\n end\n end", "def expire_cache_for(*args)\n args = args.collect {|a| a.respond_to?(:id) ? a.id : a}.flatten\n # the caches we need to clear are:\n # - the object cache\n # - any collection caches which included this object\n args.each do |id|\n object_cache_key = \"#{cache_key_base}/#{id}\"\n object_collections = Georeferencer.configuration.cache.read(\"#{object_cache_key}/collection_hashes\")\n if object_collections.present?\n # this object has a list of collection hashes, each of which we need to remove\n object_collections.each do |hash|\n Georeferencer.configuration.cache.delete(\"#{cache_key_base}/collection_query/#{hash}\")\n end\n # by implication, the cached object should also be present; clear that too, along with any of its child keys\n begin\n Georeferencer.configuration.cache.delete_matched(\"#{object_cache_key}*\")\n rescue NotImplementedError\n # rescue to removing the whole cache if delete_matched isn't supported\n Georeferencer.configuration.cache.clear\n end\n\n else\n # the object isn't in any collections; unfortunately we can't be sure whether this is because the object is old\n # and uncached, or new and therefore needs to be in collections which currently exist for this class.\n # Because of that, we'll aggressively remove caches for collections\n begin\n Georeferencer.configuration.cache.delete_matched(\"#{cache_key_base}/collection_query*\")\n rescue NotImplementedError\n Georeferencer.configuration.cache.clear # rescue to cache.clear for caching methods where delete_matched isn't supported\n end\n end\n # Always remove the object's cache. There's no risk of doing this for nonexistent things.\n Georeferencer.configuration.cache.delete(object_cache_key)\n\n\n end\n end", "def invalidate_cache!\n elements.each do |element|\n element.invalidate_cache!\n end\n\n self\n end", "def expire_caches\n expired_cache = \"expired_cache.#{Time.now.to_f}\"\n Dir.chdir(\"#{Rails.root}/tmp\") do\n FileUtils.mv('cache', expired_cache, :force => true)\n FileUtils.rm_rf(expired_cache)\n end\n end", "def gc!\n delete_if { |key, s| s.expired? }\n end", "def purge_expired_keys\n Thread.new do\n loop do\n sleep PURGE_EXPIRED_KEYS_FREQUENCY_SECS\n puts 'Purging expired keys...'\n @cache_handler.purge_expired_keys\n end\n end\n end", "def expire_cache(page_name)\n expire_pages(ContentPage.find_all_by_page_name(page_name))\n end", "def clear_expired(request)\n entries_for(request)\n .where {|t| t.created_at < Time.now - ttl }\n .delete\n end", "def invalidate_cache\n accessor.cache_manager.invalidate(resource.uri)\n end", "def expire(url)\n if url == :all\n if store.respond_to?(:keys)\n urls.each{ |u| expire(u) }\n else\n raise(NoMethodError, \"The Geocoder cache store must implement `#keys` for `expire(:all)` to work\")\n end\n else\n expire_single_url(url)\n end\n end", "def expire(key)\n @memcache.delete(key)\n cache_stop_tracking(key)\n Merb.logger.info(\"cache: expired (#{key})\")\n true\n end", "def clear_cache; end", "def expire(key)\n FileUtils.rm_f(@config[:cache_directory] / \"#{key}.cache\")\n Merb.logger.info(\"cache: expired (#{key})\")\n true\n end", "def after_destroy(list)\n expire_cache_for(list)\n end", "def expire(widget, options = {})\n Rails.logger.debug \"-- cache EXPIRATION --\"\n begin\n model_key = calculate_key(widget, options.slice(:scope, :policy_context))\n delete(model_key) if model_key\n\n with_instance_content(widget, options) do |instance_key|\n keys = retrieve(instance_key)[:keys] rescue []\n keys.each{|key| delete(key)}\n delete(instance_key)\n end\n rescue CacheNotAvailable\n end\n end", "def cache_clear\n @client.flushall\n end", "def invalidate\n @cache_version ||= 0\n @cache_version += 1\n end", "def purge()\n time = Time.now\n @data.each do |key, item|\n if item.expiration < time\n @data.delete(key)\n puts \"DELETE #{item.value}\"\n end\n end\n end", "def after_update(entry)\n expire_cache_for(entry)\n end", "def cleanup\n @keys.each { |key, time|\n if expired_kalive?(key, 300)\n delete_key(key)\n end\n\n if expired_unlocked?(key, 60)\n unblock_key(key)\n end\n }\n \n end", "def after_update(list)\n expire_cache_for(list)\n end", "def cache_clear\n @moneta.clear\n end", "def expire_cache_for(record)\n case record\n when Page\n expire_page_caches(record.id)\n when Comment\n expire_page(:controller => 'pages', :action => 'index', :page_id => record.page_id, :on => \"comments_count\")\n expire_page(:controller => 'pages', :action => 'index', :page_id => record.page_id, :on => \"comments_list\")\n end\n end", "def expire_match(key)\n #files = Dir.glob(@config[:cache_directory] / \"#{key}*.cache\")\n files = Dir.glob(@config[:cache_directory] / \"#{key}*\")\n FileUtils.rm_rf(files)\n Merb.logger.info(\"cache: expired matching (#{key})\")\n true\n end", "def clear_cache() @cache = {}; end", "def invalidate_cache!\n @cache_valid_from = Time.now\n end", "def after_save(object)\n expire_cache_for_all\n end", "def clear\r\n @cache.flush\r\n end", "def cache_clear\n @store.flush_all\n rescue ::MemCache::MemCacheError => e\n Log.error(e)\n nil\n end", "def clear\n cache.clear\n end", "def expire(key)\n @mutex.synchronize do\n @cache.delete(key)\n end\n Merb.logger.info(\"cache: expired (#{key})\")\n true\n end", "def remove_expired_keys\n self.user_key.each do |user_key|\n if user_key.expired?\n self.remove_user_key(user_key)\n user_key.delete\n end\n end\n end", "def reap_expired_sessions\n @timestamps.each do |session_id,stamp|\n delete_session(session_id) if (stamp + @session_ttl) < Time.now \n end\n GC.start\n end", "def expire_faults!\n now = Time.now\n faults.each_pair do |stack, fault|\n if (now - fault.timestamp) >= expiration\n faults.delete( stack )\n end\n end\n end", "def clear_cache\n @cache = {}\n end", "def clear\n @cache.clear\n end", "def simulate_expire; end", "def reset\n hash.clear\n expire_cache!\n self\n end", "def invalidate_cache(request)\n metastore.invalidate(request, entitystore)\n end", "def cache_delete(*keys)\n keys.each {|key| @moneta.delete(key) }\n end", "def clear_cache! *keys\n clear_cache *keys\n ipcm_trigger :clear_cache, *keys\n end", "def flush_expired\n if gc_last && gc_time && gc_last+gc_time <= Time.now\n flush_expired!\n end\n end", "def expire_perfs!\n now = Time.now.utc\n perfs.each_pair do |path, perf|\n if (now - perf.timestamp) >= expiration\n perfs.delete( path )\n end\n end\n end", "def expire_all\n if allowed_request\n expire_non_species_caches\n render text: \"Non-species page caches expired.\", layout: false\n else\n redirect_to root_url, status: :moved_permanently\n end\n end", "def clear_all!\n @cache = Cache.new\n end", "def after_update(resume) \n expire_cache_for(resume) \n end", "def server_cron\n start_timestamp = Time.now\n keys_fetched = 0\n \n @data_expiration.each do |key, _|\n if @data_expiration[key] < Time.now\n @logger.debug \"Evicting #{ key }\"\n @data_expiration.delete(key)\n @data.delete(key)\n # purging_key_notice = \"deleting key with name: \"\n # purging_key_notice += key\n # puts purging_key_notice\n end\n \n keys_fetched += 1\n if keys_fetched >= MAX_EXPIRATION_CHECKS_PER_CYCLE\n break\n end\n end\n \n end_timestamp = Time.now\n @logger.debug do\n sprintf(\n \"Processed %i keys in %.3f ms\", keys_fetched, (end_timestamp - start_timestamp) * 1000)\n end\n \n 1000 / DEFAULT_CRON_FREQUENCY\n end", "def invalidateCache()\n begin\n return @db.execute(\"DELETE FROM cache WHERE key LIKE '/%'\")\n rescue => error\n puts error\n end\n end", "def after_destroy(resume) \n expire_cache_for(resume) \n end", "def delete_all_expired_for(time)\n expired_for(time).delete_all\n end", "def clear_cache\n @all = nil\n end", "def clear\n @cache.clear\n entries.clear\n self\n end", "def clear_cache!\n @cache = {}\n end", "def clear_cache!\n @cache = {}\n end", "def reset\n @entry_cache.clear\n end", "def cleanup_cache\n\t\t\tputs \"Cleaning up cache\"\n\t\t\texpire_older_than = ((Time.now.to_f - MiniProfiler::EXPIRE_TIMER_CACHE) * 1000).to_i\n\t\t\t@timer_struct_lock.synchronize {\n\t\t\t\t@timer_struct_cache.delete_if { |k, v| v['Root']['StartMilliseconds'] < expire_older_than }\n\t\t\t}\n\t\tend", "def after_destroy(bite)\n expire_cache_for(bite)\n end", "def expire!\n\t\tself.expires = Time.at(0)\n\tend", "def after_destroy(data_set)\n expire_cache_for(data_set)\n end", "def expire_all\n if allowed_request\n expire_non_species_caches\n render :text => \"Non-species page caches expired.\", :layout => false\n else\n redirect_to root_url\n end\n end", "def after_update(data_set)\n expire_cache_for(data_set)\n end", "def delete_cache_files; end", "def delete_cache_files; end", "def cache_delete(*keys)\n if keys\n keys.each do |key|\n record = @store[:key => namespaced(key)]\n record.delete if record \n end\n end\n end", "def autoexpire\n redis.expire(key, timespan)\n end", "def expire(key, seconds, **kwargs); end", "def reset\r\n @cache.reset\r\n end", "def expire_caches_for(record)\n key = \"/ajax/tags/#{record.class.name.downcase.pluralize}\"\n\n I18n.available_locales.each do |locale|\n expire_fragment(\"#{locale}#{key}\")\n expire_fragment(\"#{locale}#{key}.json\")\n end\n end", "def invalidate!\n @changelog = nil\n @manifest = nil\n \n invalidate_tag_cache!\n invalidate_branch_cache!\n end", "def cache_clear\n @store.clear\n end", "def expire(name=nil, *args)\n return if Rails.env == 'development'\n \n name = name.to_sym\n cache = Cacheable.cache[self]\n time = Time.at(0)\n if name.nil?\n cache.values.each do |method_args|\n method_args.values.each do |params|\n params[:time] = time\n end\n end\n elsif args.nil? || args.empty?\n cache[name].values.each do |params|\n params[:time] = time\n end\n else\n cache[name][args][:time] = time\n end\n end", "def flush_cache; end", "def clear_cache\n ccs.each(&:clear_cache)\n end", "def expire\n self.expires_on = DateTime.current\n self\n end", "def invalidate_users_cache\n users.reload.map(&:touch)\n end" ]
[ "0.8378065", "0.8030422", "0.79589206", "0.78239626", "0.7619838", "0.7587595", "0.75658965", "0.7474238", "0.7286092", "0.727475", "0.72594327", "0.7259049", "0.72533965", "0.72397685", "0.7165339", "0.7160963", "0.71405685", "0.71076477", "0.7081477", "0.70809096", "0.7073698", "0.7038341", "0.7026323", "0.70230037", "0.7018482", "0.6965712", "0.69564813", "0.6952339", "0.69309634", "0.6909842", "0.69080156", "0.68798995", "0.6858178", "0.6837603", "0.6836713", "0.6831617", "0.6822221", "0.6816584", "0.6806214", "0.6798686", "0.6790215", "0.677991", "0.67542034", "0.67281973", "0.6723387", "0.67092866", "0.67079544", "0.67025936", "0.66893506", "0.66851276", "0.66688865", "0.66668653", "0.6648106", "0.661779", "0.66051", "0.65879077", "0.6585881", "0.6583222", "0.65830296", "0.65810454", "0.6575367", "0.6566581", "0.65580237", "0.6552001", "0.65490687", "0.654823", "0.65472424", "0.65366787", "0.6533032", "0.6524263", "0.6521235", "0.65207916", "0.6515861", "0.65068907", "0.6502268", "0.65009767", "0.64987034", "0.64921147", "0.64921147", "0.6489469", "0.6480174", "0.64760715", "0.64727116", "0.6469822", "0.6468735", "0.64667934", "0.6465074", "0.6465074", "0.64617056", "0.64584434", "0.6453698", "0.6445484", "0.6436106", "0.6430416", "0.64297336", "0.6429085", "0.64280015", "0.64231104", "0.6418908", "0.64109594" ]
0.7906578
3
Gives info on the current cache store ==== Returns The type of the current cache store
def cache_store_type "memcache" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type\n @config[:caching][:type]\n end", "def cache_store_type\n \"dummy\"\n end", "def retrieve_store_class(store)\n # require_relative cannot be used here because the class might be\n # provided by another gem, like redis-activesupport for example.\n require \"active_support/cache/#{store}\"\n rescue LoadError => e\n raise \"Could not find cache store adapter for #{store} (#{e})\"\n else\n ActiveSupport::Cache.const_get(store.to_s.camelize)\n end", "def cache_store_type\n \"memory\"\n end", "def store_information\n get('store')\n end", "def type\n memoized_info[:type]\n end", "def cache_store_type\n \"file\"\n end", "def new_store\n Cache.new\n end", "def store\n @cache.compute_if_absent(current_store_id) { new_store }\n end", "def storage_type\n data[:storage_type]\n end", "def storage_type\n data[:storage_type]\n end", "def storage_type\n @dbi.storage_type\n end", "def storage_type\n @dbi.storage_type\n end", "def current_store_id\n Thread.current[REQUEST_STORE_ID]\n end", "def store_info\n si = Nvmkv::kv_get_store_info(@kv_id)\n if si != nil then\n NVMKVStoreInfo.new(si)\n else\n nil\n end\n end", "def store_key; @store.to_sym; end", "def cache_store\n {\n redis: @redis,\n ttl: @ttl,\n cached: @cached,\n }\n end", "def current_store\n @current_store = session[:store_id].nil? ? Sap::Store.first : Sap::Store.find(session[:store_id])\n end", "def session_store_type\n \"cookie\"\n end", "def in(store)\n store_class = if store.is_a? Symbol\n MobileStores::STORES[store]\n elsif store.is_a? String\n Object.const_get(store) rescue nil\n elsif store.is_a? Class\n store\n end\n\n raise NotImplementedError, \"#{ store } is not implemented yet.\" if store.nil?\n\n store_class.new\n end", "def cache_store\n @@cache_store ||= begin\n # if config.search_cache_store was not previously set, a no method error would be raised\n config = Rails.application.config.redmine_search_cache_store rescue :memory_store\n if config\n ActiveSupport::Cache.lookup_store config\n end\n end\n end", "def initialize_cache( type=nil )\n case type\n when /memcache/\n servers = [\"localhost\"]\n opts = { :namespace => \"martsearch\", :no_reply => true }\n \n if self.config[\"cache\"][\"servers\"]\n servers = self.config[\"cache\"][\"servers\"]\n end\n \n if self.config[\"cache\"][\"namespace\"]\n opts[:namespace] = self.config[\"cache\"][\"namespace\"]\n end\n \n return ActiveSupport::Cache::MemCacheStore.new( servers, opts )\n when /file/\n file_store = \"#{File.dirname(__FILE__)}/../tmp/cache\"\n if self.config[\"cache\"][\"file_store\"]\n file_store = self.config[\"cache\"][\"file_store\"]\n end\n return ActiveSupport::Cache::FileStore.new( file_store )\n else\n return ActiveSupport::Cache::MemoryStore.new()\n end\n end", "def cache_store\n return nil if _cache.nil?\n return _cache if _cache.class != ActiveSupport::Cache::NullStore\n if ActiveModelSerializers.config.cache_store\n self._cache = ActiveModelSerializers.config.cache_store\n else\n nil\n end\n end", "def cache_store\n return nil if _cache.nil?\n return _cache if _cache.class != ActiveSupport::Cache::NullStore\n if ActiveModelSerializers.config.cache_store\n self._cache = ActiveModelSerializers.config.cache_store\n else\n nil\n end\n end", "def local_store\n @stores[\"sc-chi\"]\n end", "def cache_store\n return nil if context.environment.cache.nil?\n\n CacheStore.new context.environment\n end", "def cache_store\n\t\t\t\treturn nil if context.environment.cache.nil?\n\n\t\t\t\tif defined?(Sprockets::SassCacheStore)\n\t\t\t\t\tSprockets::SassCacheStore.new context.environment\n\t\t\t\telse\n\t\t\t\t\tCacheStore.new context.environment\n\t\t\t\tend\n\t\t\tend", "def store\r\n return @store\r\n end", "def simple_cache\n @@cache_store\n end", "def store\n @@store ||= Store.get_store(0)\n end", "def metastore\n uri = options['rack-cache.metastore']\n storage.resolve_metastore_uri(uri)\n end", "def backend_name\n self.class.name.split(\"::\")[-1].split(\"Store\")[0].downcase\n end", "def cache_store; end", "def cache_store; end", "def current_store\n user = current_user\n return nil unless user\n return nil unless session[:store_id]\n user.stores.get(session[:store_id])\nend", "def cache\n if self.cache_store\n self.cache_store\n else\n self.cache_store = :file_store, root.join(\"tmp\").to_s\n self.cache_store\n end\n end", "def key\n :cache\n end", "def storage \n Trole::Storage::BaseOne\n end", "def current_storage\n @attributes[:current_storage]\n end", "def current_type\n @type\n end", "def cache_key; @cache.to_sym; end", "def get_storage_class\n return @m_storage_class\n end", "def get_store (store_name)\n each_store do |regex, s_name, store|\n return store if s_name == store_name\n end\n nil\n end", "def store\n return self.class.store\n end", "def find_class_or_module name\n @store.find_class_or_module name\n end", "def type\n return @type if @type != \"unknown\"\n info\n @type\n end", "def type\n self_class.to_s.to_sym\n end", "def get_store\n ActiveRecord::MemoryStore.new\n end", "def cache\n @@_cache[self.class.name]\n end", "def current_pstore\n @current_pstore ||= begin\n ps = param('current_pstore').to_s.strip\n ps = nil if ps == \"\"\n ps\n end\n end", "def type\r\n\t\t\t`#{BITS::BITSADMIN} /gettype {#{@id}}`\r\n\t\tend", "def fetch_store\n @store ||= self.store || create_store!\n end", "def lookup_storage(key)\n { memory: Storage::Memory, redis: Storage::Redis }[key]\n end", "def klass\n @klass ||= if self.cached && self.cached.is_a?(AridCache::CacheProxy::Result)\n self.cached.klass\n else\n object_base_class\n end\n end", "def site_cache(cache_type, &blk)\n site_content_cache_key = [cache_key, cache_type]\n Rails.cache.fetch(site_content_cache_key, expires_in: 4.weeks.from_now, &blk)\n end", "def simpledb_type\n model.storage_name(DataMapper.repository.name)\n end", "def primary_model\n NfsStore::Manage::Container\n end", "def key\n store_as.to_s\n end", "def initialize_store\n if (type = @store).is_a?(Symbol)\n params = []\n options = @store_options&.dup || {}\n case type\n when :file_store\n @cache_dir ||= File.join(FARADAY_CACHE_DIR, @namespace)\n @cache_dir ||= FARADAY_CACHE_DIR\n params << @cache_dir\n when :redis_cache_store\n options.merge!(RAILS_CONFIG)\n options.merge!(namespace: @namespace)\n end\n params << options\n @store = ActiveSupport::Cache.lookup_store(type, *params)\n end\n unless @store.is_a?(ActiveSupport::Cache::Store)\n raise \"expected Symbol, got #{@store.class} #{@store.inspect}\"\n end\n end", "def store\n _store_id = store_id\n ::Spree::User.logger.debug \"| ByParameters: store_id #{_store_id}\"\n store = _store_id ? ::Spree::Store.where(id: _store_id).first : nil\n store || Spree::Store.new\n end", "def type\n types.first\n end", "def lookup_store(store = nil, *parameters)\n case store\n when Symbol\n options = parameters.extract_options!\n # clean this up once Ruby 2.7 support is dropped\n # see https://github.com/rails/rails/pull/41522#discussion_r581186602\n if options.empty?\n retrieve_store_class(store).new(*parameters)\n else\n retrieve_store_class(store).new(*parameters, **options)\n end\n when Array\n lookup_store(*store)\n when nil\n ActiveSupport::Cache::MemoryStore.new\n else\n store\n end\n end", "def cache_store_and_namespace_to_strip\n store = cache.store\n # Store can be a ActiveSupport::Cache::RedisCacheStore, a Redis::Store object, or a Redis object.\n # If it is a ActiveSupport::Cache::RedisCacheStore, then we need to get the redis object in\n # order to get keys from it.\n store = store.redis if store.respond_to?(:redis)\n if store.respond_to?(:data) # Redis::Store already stripped namespaced\n store = store.data\n [store, nil]\n else\n # Redis object (which is all we have available in the case of a\n # ActiveSupport::Cache::RedisCacheStore) unfortunately returns keys with namespace prefix in\n # each key, so we need to strip this out (Redis::Store does this already; see store.data.keys above)\n [store, cache_namespace]\n end\n end", "def store\n @store ||= storage.new self\n end", "def cached_location\n dlt = (download_type) ? download_type : 'default'\n Drupid.cache_path + self.class.to_s.split(/::/).last + extended_name + dlt + name\n end", "def catalog_type\n return @catalog_type\n end", "def type_to_form_ready_hash_configstore\n {\n type: resource[:configstoretype],\n connectionString: resource[:configdir],\n move: true,\n runAsync: false,\n }\n end", "def lookup_store(store, options)\n if @logger\n @logger.warn \"Passing a Symbol as the 'store' is deprecated, please pass the cache store instead.\"\n end\n\n begin\n require 'active_support/cache'\n ActiveSupport::Cache.lookup_store(store, options)\n rescue LoadError => e\n puts \"You're missing the 'activesupport' gem. Add it to your Gemfile, bundle it and try again\"\n raise e\n end\n end", "def get_type\n\n end", "def type\n TYPES[@type_id]\n end", "def type\n types.first\n end", "def current_merchant_store\n\t\t@current_merchant_store ||= session[:current_merchant_store_id] &&\n \t\tMerchantStore.find_by_id(session[:current_merchant_store_id])\n\tend", "def type\n return @type\n end", "def type\n return @type\n end", "def type\n return @type\n end", "def type\n return @type\n end", "def type\n return @type\n end", "def type\n return @type\n end", "def type\n return @type\n end", "def stores\n [\n checksum_store,\n compiled_content_cache,\n @dependency_store,\n rule_memory_store,\n @outdatedness_store,\n ]\n end", "def info_key\n [\"cache\", cache_name, cache_id].join(\":\")\n end", "def type\n return @type\n end", "def stores\n [\n checksum_store,\n compiled_content_cache,\n @dependency_store,\n rule_memory_store,\n ]\n end", "def store\n @store\n end", "def store\n @store\n end", "def type\n\t\tself.class.type\n\tend", "def type\n\t\tself.class.type\n\tend", "def query_cache_store(key)\n raise NotImplementedError\n end", "def type\n\t\t@type\n\tend", "def store\n @store ||= Globot::Plugins.store.proxy_for(self)\n end", "def type ; metadata[:type] ; end", "def current\n return {} unless device && node[:filesystem] && node[:filesystem][ device ]\n curr = Mash.new(node[:filesystem][ device ].to_hash)\n curr['fstype'] ||= curr['fs_type']\n curr\n end", "def type\n object.class.name\n end", "def type\n object.class.name\n end", "def type\n object.class.name\n end", "def storage_class\n @storage_class || storage_loader.storage_class\n end", "def type\n @@type\n end", "def type\n @@type\n end", "def show\n\t@store = current_account.stores.find(params[:id])\n end", "def store\n @store ||= {}\n end" ]
[ "0.7330008", "0.7032524", "0.69761693", "0.6729079", "0.66565555", "0.6566218", "0.6535954", "0.6385915", "0.635425", "0.6250811", "0.6250811", "0.6225362", "0.6225362", "0.620501", "0.61576974", "0.6132443", "0.6070084", "0.6056202", "0.6039879", "0.6037328", "0.6023099", "0.6010525", "0.59914005", "0.59914005", "0.59870803", "0.5960576", "0.5946902", "0.59459084", "0.5943512", "0.5907045", "0.5872662", "0.5864719", "0.5854695", "0.5854695", "0.5852718", "0.5815481", "0.57988733", "0.57898515", "0.5789811", "0.57838905", "0.57814234", "0.5780223", "0.57466847", "0.5743398", "0.5741816", "0.57310814", "0.5721057", "0.57181895", "0.57137656", "0.5698004", "0.56960875", "0.5688574", "0.56840086", "0.5670338", "0.56624687", "0.5655904", "0.5655269", "0.5648205", "0.5646505", "0.56422925", "0.56378925", "0.56364197", "0.5614158", "0.5610069", "0.5600771", "0.5589836", "0.5572112", "0.5564738", "0.55449575", "0.55419964", "0.5537654", "0.5530983", "0.55255526", "0.55255526", "0.55255526", "0.55255526", "0.55255526", "0.55255526", "0.55255526", "0.55243766", "0.55215025", "0.549925", "0.5489338", "0.5466609", "0.5466609", "0.5466154", "0.5466154", "0.5461313", "0.54559594", "0.54482734", "0.54395443", "0.54394126", "0.543571", "0.5434833", "0.5434833", "0.5433978", "0.5431095", "0.5431095", "0.542255", "0.54202914" ]
0.73608345
0
Store the tracked keys in memcache (used by expire_match) ==== Parameter keys:: The keys to keep track of
def set_tracked_keys(keys) @memcache.set(@tracking_key, keys) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expire_cache_keys *keys\r\n keys.each { |k| @cache.delete k.to_sym }\r\n end", "def _expire_cache(*keys)\n Rails.cache.delete( _cache_key(keys) )\n end", "def cache_delete(*keys)\n if keys\n keys.each do |key|\n record = @store[:key => namespaced(key)]\n record.delete if record \n end\n end\n end", "def _store(*key_elements, value)\n cache.put(_key(*key_elements), value)\n end", "def save(value, *keys)\n unless keys.length == @num_keys\n arg_count = keys.length\n fail \"Opscode::Rackspace::Monitoring::CMCache.save: Key count mismatch (#{@num_keys}:#{arg_count})\"\n end\n\n unless defined?(@cache)\n @cache = {}\n end\n\n eval_str = '@cache'\n (0...@num_keys).each do |i|\n key = keys[i]\n if key.nil?\n fail \"Opscode::Rackspace::Monitoring::CMCache.save: Nil key at index #{i})\"\n end\n\n cval = eval(eval_str)\n unless cval.key?(key.to_s)\n eval(\"#{eval_str}[\\\"#{key}\\\"] = {}\")\n end\n\n eval_str += \"[\\\"#{key}\\\"]\"\n end\n\n Chef::Log.debug(\"Opscode::Rackspace::Monitoring::CMCache.save: Saving #{value} to #{eval_str}\")\n eval(\"#{eval_str} = value\")\n\n # Re-enable eval checks\n # rubocop:enable Eval\n end", "def add *keys\n keys.each{|key|\n klass = Global.cache_alternative.fetch(key, Global.cache)\n add_on(key, klass)\n }\n Log.dev(\"Added caches for: #{keys.join(', ')}\")\n end", "def hydrate_store(keys, iss)\n keys.each do |key|\n store.set(\n iss, key['kid'],\n JSON::JWK.new(\n kty: key['kty'],\n e: key['e'],\n n: key['n'],\n kid: key['kid']\n )\n )\n end\n end", "def sinterstore(destination, *keys); end", "def sinterstore(destination, *keys); end", "def _cache(*keys, &block)\n key = _cache_key(keys)\n unless cached = Rails.cache.read( key )\n if block_given?\n cached = yield(block)\n Rails.cache.write(key, cached)\n end\n end\n cached\n end", "def update_key_list(keys)\n key_list = get_key_list\n type = keys.first.to_sym\n key_list[type] = key_list[type] || Set.new\n key_chain = keys[1..-1].join('.')\n unless key_list[type].include?(key_chain)\n key_list[type].add key_chain\n _write(Common::KEY, key_list)\n end\n end", "def session_keys=(keys) #:nodoc:\n @@session_keys=keys\n end", "def fetch_multi(*keys, &block)\n return {} if keys.size == 0\n result = {}\n result = cache.read_multi(*keys) if should_cache?\n\n missed_keys = keys - result.select {|key, value| value.present? }.keys\n\n if missed_keys.size > 0\n if block_given?\n replacement_results = nil\n ActiveRecord::Base.connection.with_master do\n replacement_results = yield missed_keys\n end\n missed_keys.zip(replacement_results) do |(key, replacement_result)|\n if should_cache?\n replacement_result = map_cached_nil_for(replacement_result )\n cache.write(key, replacement_result)\n logger.debug \"[IdentityCache] cache miss for #{key} (multi)\"\n end\n result[key] = replacement_result\n end\n end\n else\n result.keys.each do |key|\n logger.debug \"[IdentityCache] cache hit for #{key} (multi)\"\n end\n end\n\n result.keys.each do |key|\n result[key] = unmap_cached_nil_for(result[key])\n end\n\n result\n end", "def cache_delete(*keys)\n keys.each {|key| @moneta.delete(key) }\n end", "def set_inter_store(destkey, *keys)\n timeout_retry(3, 3){\n write \"SINTERSTORE #{destkey} #{keys.join(' ')}\\r\\n\"\n status_code_reply\n }\n end", "def sinterstore!(*other_keys)\n redis_client.sinterstore(key, *other_keys)\n end", "def store_paths_to_visit(paths)\n return if paths.empty?\n redis.sadd paths_to_visit_key, paths\n end", "def store(value, *key)\n @cache[key] = value\n end", "def import_by_using_cached_keys\n CommitKeyCreator.update_key_associations @blob.keys.to_a, @commit\n end", "def cache_on_keys(*key_arr)\n # normalize arguments\n if key_arr.class == Array\n key_arr.flatten!\n key = key_arr.join(\"_\")\n elsif key_arr.class == String || key_arr.class == Symbol\n key = key_arr.to_s\n key_arr = [key_arr]\n else\n raise ArgumentError, \"passed argument(s), must be a string/symbol or an array of strings/symbols\"\n end \n arg_list = key_arr.map{|k| (k.to_s + \"_arg\")} \n tests = []\n key_arr.each_with_index do |val, index|\n tests << \"rec.#{val} == #{arg_list[index]}\"\n end \n \n # build the methods\n class_eval %{\n def self.find_on_#{key}(#{arg_list.join(\", \")})\n @cache_#{key} ||= {}\n @cache_#{key}[ #{ arg_list.collect{|a| a + '.to_s' }.join(\" + '_'+ \")} ] ||= all.select{|rec| #{tests.join(\" && \")}}\n end \n \n # register this cache as something that needs to be deleted when the cache expires\n register_cache('cache_#{key}') \n }\n end", "def delete_from_cache(*keys, **opts)\n base_key = self.base_redis_key opts\n keys.each do |key|\n Cachable::redis.del \"#{base_key}_#{key}\"\n end\n end", "def set_keycache(key,encoded_key,expires = 3600)\n @keycache = {\n :expires => Time.now.to_i + expires,\n :key => key,\n :encoded_key => encoded_key\n }\n write_settings\n end", "def store_for_aggregations(retentions, key, values)\n retentions.each_with_index do |t, index|\n next if index.zero?\n @redis.lpush \"acc-#{key}:#{t}\", values\n @redis.expire \"acc-#{key}:#{t}\", t.to_i * 2\n end\n end", "def cache_store(*args)\n super { |key, value| @store[key] = value }\n end", "def get_set_memcached_multi(keys, ttl = 0, marshaling = true)\n raise 'block not given to get_set_memcached' unless block_given?\n\n Rails.cache.fetch_multi(*keys, {expires_in: get_ttl(ttl), raw: !marshaling}) do\n yield\n end\n\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: fetch_multi: K: #{keys.inspect}. M: #{exc.message}, I: #{exc.inspect}\" }\n nil\n end", "def zinterstore(destination, *keys, **options); end", "def set_id_to_cache_key_map\n @ids.each do |id|\n @id_to_cache_key_map[id] = {\n kit: get_kit_cache_key(id),\n saas: get_saas_cache_key(id)\n }\n end\n end", "def write(keys, value, options = {})\n # Symbolize all the keys in options\n options.symbolize_keys!\n # We store the keys as strings\n if keys.is_a?(Symbol) || (keys.is_a?(Array) && keys.length == 1)\n key_name = keys.to_s\n end\n # super just logs to logger\n super\n # Add the keys we want to be able to delete with delete_type\n if options[:delete_type]\n raise \"delete_type only possible with an array key and the array needs to be bigger than 1\" if !keys.is_a?(Array) && keys.length >= 1\n # add the key to the key list\n update_key_list(keys)\n key_chain = generate_key(keys.first, keys[1..-1].join('.'))\n else\n key_chain = keys\n end\n # Do the original write to memcached\n _write(key_chain, value, options)\n end", "def _smart_cache(expires_in, *keys, &block)\n key = _cache_key(keys)\n unless cached = Rails.cache.read( key )\n cached = yield(block) \n Rails.cache.write(key, cached, expires_in: expires_in) \n end\n cached\n end", "def get(keys)\n log(\"get :Cache, #{keys.inspect}\")\n connection.multi_get(:Cache, Array(keys)).values.map { |v| v['blob'] }\n end", "def populate_keys(node, keys, size)\n f = IO.popen(\"redis-cli -h #{node[:host]} -p #{node[:port]} -n #{node[:db]} --pipe\", IO::RDWR)\n\n keys.each do |key|\n size.times.map do |x| \n f << to_redis_proto('SADD', key, ::Digest::MD5.hexdigest('f' + x.to_s))\n end\n end\n\n f.close\n end", "def cache_delete(*keys)\n @client.del(*keys)\n end", "def store(keys, val)\n keys = Array(keys).map(&:to_sym)\n\n keys.each do |key|\n @aliases[key] = keys.first\n end\n\n @data[keys.first] = val\n end", "def store(key, contents)\n raise NotImplementedError.new 'Implement store(key, contents) in your CacheManager'\n end", "def persist(key); end", "def persist(key); end", "def hmset(key, *attrs); end", "def hmset(key, *attrs); end", "def []=(key, value)\n invalidate_caches\n @keys[key.to_sym] = value\n end", "def cache_set(key, data, from_now = nil)\n _expire = from_now ? from_now.minutes.from_now.to_i : 0\n @memcache.set(key, data, _expire)\n cache_start_tracking(key)\n Merb.logger.info(\"cache: set (#{key})\")\n true\n end", "def initialize(keys, expires_in)\n @value = keys\n @expires_in = expires_in\n @expires_at = Time.now.utc.to_i + @expires_in\n end", "def add_key(*keys, key, value)\n\t\t\t\ti=self\n\t\t\t\tkeys.each do |k|\n\t\t\t\t\ti.key?(k) or i[k]={}\n\t\t\t\t\ti=i[k]\n\t\t\t\tend\n\t\t\t\ti.key?(key) or i[key]=value\n\t\t\t\t# self\n\t\t\t\ti[key]\n\t\t\tend", "def update!(**args)\n @keys = args[:keys] if args.key?(:keys)\n end", "def update!(**args)\n @keys = args[:keys] if args.key?(:keys)\n end", "def put(surveys)\n return if surveys.empty?\n\n keys = keys_for(surveys)\n data = keys.zip(surveys.map(&:to_json))\n\n redis.pipelined do\n redis.mset(*data)\n set_expiration(keys)\n end\n end", "def save_keys\n key_file = File.open(key_file_path, 'w')\n\n key_file.write(YAML::dump(@@keys))\n\n key_file.close\n end", "def tag_processed(hash, keys) \n # Generate a flat md5 of the keys in question\n md5 = generate_md5(hash, keys)\n $logger.info \"MD5 Generated: #{md5}\"\n previous = redis.getset(md5, 1).to_i\n $logger.info \"Previous Redis Value: #{previous}\"\n # Set the TTL on the key\n redis.expire(md5, @ttl)\n previous\n end", "def prefetch_multiple_keys(cache_keys)\n if controller.should_refresh_cache or !Rails.configuration.action_controller.perform_caching\n {}\n else\n Rails.cache.read_multi(cache_keys.collect { |key| timestamp_key(key[0],key[1]) })\n end\n end", "def key_writer *keys\n keys.each do |method|\n key = method.to_s\n define_method \"#{method}=\" do |value|\n self[key] = value\n end\n end\n end", "def get_tracked_keys\n @memcache.get(@tracking_key) || []\n end", "def sdiffstore(destination, *keys); end", "def sdiffstore(destination, *keys); end", "def cache_set(key, data, from_now = nil)\n cache_file = @config[:cache_directory] / \"#{key}.cache\"\n cache_directory = File.dirname(cache_file)\n FileUtils.mkdir_p(cache_directory)\n _expire = from_now ? from_now.minutes.from_now : nil\n cache_write(cache_file, Marshal.dump([data, _expire]))\n Merb.logger.info(\"cache: set (#{key})\")\n true\n end", "def cache_key(*ids)\n ids.join(':')\n end", "def get(*keys)\n unless keys.length == @num_keys\n arg_count = keys.length\n fail \"Opscode::Rackspace::Monitoring::CMCache.get: Key count mismatch (#{@num_keys}:#{arg_count})\"\n end\n\n unless defined?(@cache)\n return nil\n end\n\n eval_str = '@cache'\n (0...@num_keys).each do |i|\n key = keys[i]\n cval = eval(eval_str)\n unless cval.key?(key.to_s)\n return nil\n end\n\n eval_str += \"[\\\"#{key}\\\"]\"\n end\n\n Chef::Log.debug(\"Opscode::Rackspace::Monitoring::CMCache.get: Returning cached value from #{eval_str}\")\n return eval(eval_str)\n end", "def mget(*keys); end", "def save_messages(*keys)\n session[:messages].merge(keys)\n end", "def attribute_keys=(keys)\n @attribute_keys = keys\n attr_accessor *keys\n end", "def export(*keys)\n h = {}\n keys.each{|key|h[key] = self.delete(key)}\n h\n end", "def expire_table_cache(table_names)\n return if @memcache.nil?\n\n table_names.each do |table_name|\n key = \"#{@cache_prefix}-\"+table_name+\"-version\"\n version = @memcache.get(key)\n if version.nil?\n @memcache.set(key,1,nil,{:raw=>true}) \n else\n @memcache.incr(key, 1, nil)\n end\n end\n\n true\n end", "def mget(*keys, &blk); end", "def raw_send_keys(*keys)\n invalidate_cache!\n keys.each { |key| vim.type(key) }\n end", "def key_store\n @key_store ||= begin\n store = {}\n CSV.foreach(@file_name) do |line|\n old_key, new_key = line\n\n store[old_key] = new_key\n end\n store\n end\n end", "def update!(**args)\n @keys = args[:keys] unless args[:keys].nil?\n end", "def exchange_keys; end", "def exchange_keys; end", "def store_new_key_and_values(ip, numbers)\n @hash_of_merged_data.store(ip, numbers)\n end", "def cache_start_tracking(key)\n return unless @tracking_key\n keys = get_tracked_keys\n keys.push(key)\n set_tracked_keys(keys)\n end", "def del(keys)\n keys.each { |key| _data.delete(key) }\n _save\n end", "def add_entitlements(id, entitlement_keys, entitlement_values, scope = SilverSpoon.default_scope)\n SilverSpoon.redis.hmset(silver_spoon_key(id, SilverSpoon.namespace, scope), *entitlement_keys.zip(entitlement_values).flatten!)\n end", "def keys(*keys)\n if keys.empty?\n rows.map{|r| r.key}\n else\n raise \"View#keys cannot by used when key or startkey/endkey have been set\" unless query[:key].nil? && query[:startkey].nil? && query[:endkey].nil?\n update_query(:keys => keys.first)\n end\n end", "def set_cache(cache_data)\n cache_data.each do |id, data|\n Memcache.write(@id_to_cache_key_map[id][:kit], data, get_cache_expiry)\n end\n end", "def dataset_observe_set(*keys)\n graph[:observe_log] ||= []\n # @observe_set_keys ||= []\n # @observe_set_keys += keys.flatten.map(&:to_sym)\n @observe_set = true\n end", "def cache_addresses(key, addresses, expires_in = ADDRESS_CACHE_EXPIRE_SECONDS)\n Rails.logger.debug \"PlaceSearchingController CACHE put for key #{get_cache_key(@traveler, key)}\"\n Rails.cache.write(get_cache_key(@traveler, key), addresses, :expires_in => expires_in)\n end", "def perform(keys)\n raise NotImplementedError\n end", "def perform(keys)\n raise NotImplementedError\n end", "def cache_store(key, message)\n @messages[key] = [] if @messages[key].nil?\n @messages[key].shift if @messages[key].length == 10\n @messages[key] << message\n end", "def cache_set(key, data, from_now = nil)\n _expire = from_now ? from_now.minutes.from_now : nil\n cache_write(key, [data, _expire])\n Merb.logger.info(\"cache: set (#{key})\")\n true\n end", "def zinterstore(destination, *keys, **options)\n keys.flatten!(1)\n ensure_same_node(:zinterstore, [destination].concat(keys)) do |node|\n node.zinterstore(destination, keys, **options)\n end\n end", "def keys=(keys_array)\n\t\t\tif keys_array.is_a?(Array)\n\t\t\t\t@lookup = []\n\t\t\t\tdial!(*keys_array)\n\t\t\telse\n\t\t\t\traise ArgumentError, 'Key list must be set to an array.'\n\t\t\tend\n\t\tend", "def store\n @by_cache.each{|cache, tags| cache[:tags] = tags }\n end", "def set_keys\n self.auth = gen_key('auth') if auth.blank?\n self.mkey = gen_key('mkey') if mkey.blank?\n end", "def sinterstore(destination, *keys)\n keys.flatten!(1)\n ensure_same_node(:sinterstore, [destination].concat(keys)) do |node|\n node.sinterstore(destination, keys)\n end\n end", "def set(key, value, expires_in = 0)\n remove(key)\n expires = nil\n if expires_in > 0\n expires = Time.now.utc + expires_in\n end\n @store.push({ key: build_key(key), value: value, expires: expires})\n end", "def hmset(key, values, timeout = nil)\n begin\n @redis.hmset(key, *values.to_a.flatten)\n @redis.expire(key, timeout) unless timeout.nil?\n rescue Redis::CannotConnectError => e\n $logger.error \"[Redis]Cannot set key #{key}\"\n $logger.error \"[Redis]Cannot connect to Redis: #{e.message}\"\n return false\n end\n end", "def add_keys(*keys)\n @rye_opts[:keys] ||= []\n @rye_opts[:keys] += keys.flatten.compact\n @rye_opts[:keys].uniq!\n self # MUST RETURN self\n end", "def new_by_key(key)\n args = RedisModelExtension::Database.redis {|r| r.hgetall(key) }\n return nil unless args && args.any?\n args.symbolize_keys!\n\n new_instance = new(args)\n new_instance.store_keys\n\n return new_instance\n end", "def store(prefs)\n prefs.each do |key, value|\n self[key] = value\n end if prefs.respond_to?(:each)\n end", "def cache_set(key, data, from_now = nil)\n true\n end", "def save_keys\n #TODO: add worker id to filename\n filename = \"#{@key_prefix}_pages.#{Time.now.getutc.to_s.gsub(/\\s/,'').gsub(/:/,\"-\") }.jsons.gz\"\n Zlib::GzipWriter.open(filename) do |gz|\n keys.each do |k| \n gz.write @pages[k]\n gz.write \"\\n\"\n end\n end\n\n return keys, filename\n\n end", "def add_to_cache\n redis.hset 'identifiers', self.typed_id, item.typed_id\n redis.sadd 'identifier:' + item.typed_id, self.typed_id\n end", "def key_accessor *keys\n key_writer *keys\n key_reader *keys\n end", "def expire_cache(key)\n end", "def initialize(keys, data)\n @keys = {}\n keys.each_with_index { |x, i| @keys[x.to_sym] = i }\n @data = data\n end", "def cache_store(key, value, options = {})\n key = namespaced(key)\n ttl = options[:ttl] rescue nil\n expires = Time.now + ttl if !ttl.nil?\n record = @store[:key => key]\n\n # Figure out if the record is new or already exists\n if !record\n record = @store.create(:key => key, :value => value, :expires => expires)\n record.value\n else\n record = record.update(:value => value, :expires => expires)\n record.value\n end\n end", "def upgrade_file_keys(*keys)\n cname = self.collection_name\n\n self.find_each do |object|\n keys.each do |key|\n object.upgrade_file_key(key, false)\n end\n\n object.save(:validate => false)\n end\n\n self.database.drop_collection(cname+\".files\")\n self.database.drop_collection(cname+\".chunks\")\n end", "def set key, force=nil, &block\n return if (!force) && cache.include?(key)\n cache_val, store_val = block.call()\n return unless cache_val\n cache.set_nr key, cache_val # update cache\n store << store_val # save value\n self.misses += 1 # track the cache miss\n store_val\n end", "def sdiffstore!(*other_keys)\n redis_client.sdiffstore(key, *other_keys)\n end", "def cache_store(key, value, options = {})\n options[:expires] = options.delete(:ttl) || @options[:expires_in]\n @moneta.store(key, value, options)\n end", "def cache_objects_keys\n @object_data[].keys\n end" ]
[ "0.67881894", "0.6468192", "0.6461815", "0.645246", "0.64341456", "0.6167566", "0.5959207", "0.5951273", "0.5951273", "0.5942901", "0.5911913", "0.5887257", "0.5858332", "0.58387387", "0.58237934", "0.5716165", "0.56794083", "0.5675588", "0.56434715", "0.56392115", "0.554742", "0.5540622", "0.553349", "0.5504498", "0.5472305", "0.5471194", "0.5454455", "0.545204", "0.54497963", "0.54497504", "0.5418322", "0.54138577", "0.54130393", "0.5370652", "0.53602636", "0.53602636", "0.5335134", "0.5335134", "0.53324455", "0.5328217", "0.5307415", "0.5298684", "0.5258005", "0.5258005", "0.5255992", "0.52516073", "0.52415967", "0.5219234", "0.52170295", "0.52160543", "0.51991653", "0.51991653", "0.51983225", "0.51968694", "0.51934975", "0.5191421", "0.51859266", "0.5185919", "0.5168511", "0.51553", "0.5146068", "0.5139812", "0.51345736", "0.5123872", "0.51229525", "0.51229525", "0.5106602", "0.50983435", "0.50983214", "0.5081539", "0.5078174", "0.5075123", "0.50744945", "0.50530785", "0.50470394", "0.50470394", "0.5045595", "0.50428224", "0.5040614", "0.50339067", "0.5024884", "0.50180954", "0.5015488", "0.4996334", "0.49956465", "0.49845788", "0.49789056", "0.49754083", "0.49721032", "0.49690014", "0.49676338", "0.4964886", "0.49627513", "0.4961509", "0.49560595", "0.49535152", "0.4951637", "0.4945815", "0.4945297", "0.49439412" ]
0.81636864
0
Retrieve tracked keys from memcache ==== Returns keys:: The tracked keys
def get_tracked_keys @memcache.get(@tracking_key) || [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_objects_keys\n @object_data[].keys\n end", "def key_ids\n @keys.keys\n end", "def keys\n @monitor.synchronize { @stash.keys }\n end", "def keys\n\t\t\treturn @storage.keys\n\t\tend", "def keys\n @hash.keys\n end", "def keys\n @hash.keys\n end", "def keys\n @hash.keys\n end", "def keys\n @hash.keys\n end", "def keys\n @hash.keys\n end", "def keys\n storage_hash.keys\n rescue\n nil\n end", "def keys\n @store.keys\n end", "def list_keys\n @keydict.keys\n end", "def keys\n db.keys\n end", "def list_keys\n @keys.keys\n end", "def keys\n return self.keySet.to_a\n end", "def entries\n @redis.keys('*')\n end", "def keys\n list = []\n each_key{|key| list << key}\n list\n end", "def keys\n entries.keys\n end", "def keys(arg = nil)\n if arg.nil?\n storage.keys\n else\n with_interest(arg).map { |key, _, _| key }\n end\n end", "def list\n @keychain.keys\n end", "def keys\n @navigable_map.key_set.to_a\n end", "def keys\n IbmCloudRest.get \"#{@uri}/keys\"\n end", "def keys\n return []\n end", "def keys\n list.keys\n end", "def keys\n memoize(:keys) do\n reversed = structures.reverse_each\n\n final_keyset = reversed.each_with_object({}) do |container, keyset|\n not_deleted = container.keys.reject { |k| keyset.deleted?(k) }\n not_deleted.each do |k|\n keyset[k] = container.deleted?(k) ? Utils::DeletedMarker : true\n end\n end\n\n final_keyset.keys.reject { |key| final_keyset[key].equal?(Utils::DeletedMarker) }\n end\n end", "def get_memcache_key_object\n MemcacheKey.new('aml.all_aml_match')\n end", "def list_keys()\n # TODO\n end", "def keys\n return [], []\n end", "def keys\n map(&:key)\n end", "def keys\n @map.keys\n end", "def keys\n jiak.client.keys(jiak.bucket)\n end", "def keys\n candy.keys\n end", "def current_keys\n @current_keys ||= []\n end", "def keys\n map { |line| line.key }\n end", "def get_key_list\n read(Common::KEY) || Hash.new\n end", "def keys\n Results::KeyOccurrences.merge_keys collect_results.flatten(1)\n end", "def keys\n @redis.keys(@list + '*').reject { |s| s.end_with? '_MD5' }\n end", "def get_keys()\n\t\t\treturn @config.keys\n\t\tend", "def get_keys(user=nil) \n\t\tuser = Account.current_account if !user\n\t\tKey.all(:account_id => user.id, :project_id => self.id)\n\tend", "def keys\n keys = []\n each_pair {|k,v| keys << k}\n keys\n end", "def keys\n @key\n end", "def keys\n items.keys\n end", "def keys\n ::M2X::Client::Key.list(@client, params.merge(device: self[\"id\"]))\n end", "def to_ary\n @keys\n end", "def keys\n\n self.to_h.keys\n end", "def keys\n @map.keys\n end", "def keys\n @ledger.keys\n end", "def unused_keys\n keys - fetched_keys\n end", "def keys\n in_transaction\n @table.keys\n end", "def keys\n\n clib.tcmapiterinit(pointer_or_raise)\n a = []\n\n klen = FFI::MemoryPointer.new(:int)\n\n loop do\n k = clib.tcmapiternext(@pointer, klen)\n break if k.address == 0\n a << k.get_bytes(0, klen.get_int(0))\n end\n\n return a\n\n ensure\n\n klen.free\n end", "def keys\n @data.keys\n end", "def keys\n @data.keys\n end", "def find_keys(key, redis=nil)\n redis ||= DulyNoted.redis\n keys = []\n keys += redis.keys(\"#{key}:*\")\n keys += redis.keys(\"#{key}\")\n keys -= redis.keys(\"#{key}:*:meta\")\n keys -= redis.keys(\"#{key}:ref:*\")\n keys -= redis.keys(\"#{key}:*fields\")\n end", "def keys; @records.keys; end", "def keys\n (@hash.keys + @converted.keys)\n end", "def keys\n store.keys.select { |k| k.match(/^#{prefix}/) and self[k] }\n end", "def sorted_keys\n keys=nil\n transaction{\n keys=@@global_state.keys.sort\n }\n return keys\n end", "def keys\n store.keys.select{ |k| k.match(/^#{prefix}/) and self[k] }\n end", "def ids\n @keys ||= []\n end", "def deleted_keys\n @deleted_keys ||= []\n end", "def deleted_keys\n @deleted_keys ||= []\n end", "def keys\n DoesKeyValue::State.instance.keys[self.to_s]\n end", "def find_all_redis_keys\n redis.connection do |c|\n c.keys(\"#{self.REDIS_KEY_NAMESPACE}:*\")\n end\n end", "def keys\n map(&:key).uniq\n end", "def get_memcache_key_object\n MemcacheKey.new('aml.aml_search')\n end", "def find_all_cached_entries(query)\n logger.verbose(\"Searching cache for tokens by keys: #{query.keys}.\")\n @token_cache.find do |entry|\n query.map do |k, v|\n (entry.respond_to? k.to_sym) && (v == entry.send(k.to_sym))\n end.reduce(:&)\n end\n end", "def keys\n deprecate # 07/31/2012\n doc = xml get('/user/keys').to_s\n doc.elements.to_a('//keys/key').map do |key|\n key.elements['contents'].text\n end\n end", "def primary_keys\n cached_fetch(:primary_keys){Array(primary_key)}\n end", "def keys\n @disk.keys\n end", "def all\n @keys\n end", "def keys\n lock { @blurbs.keys }\n end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def get_stored_paths\n redis.smembers stored_paths_key\n end", "def keys() end", "def claimed_keys\n [key]\n end", "def hkeys\r\n self.class.hkeys\r\n end", "def keys\n\t\tdoc = xml get('/user/keys')\n\t\tdoc.elements.to_a('//keys/key').map do |key|\n\t\t\tkey.elements['contents'].text\n\t\tend\n\tend", "def keys\n\t\tdoc = xml get('/user/keys')\n\t\tdoc.elements.to_a('//keys/key').map do |key|\n\t\t\tkey.elements['contents'].text\n\t\tend\n\tend", "def get(keys)\n log(\"get :Cache, #{keys.inspect}\")\n connection.multi_get(:Cache, Array(keys)).values.map { |v| v['blob'] }\n end", "def stored_key_associations\n associations.values.select(&:stored_key?)\n end", "def keys\n raise \"Must implement #{self.class.name}#keys method to return lookup key\"\n end", "def get_paths_visited\n redis.smembers paths_visited_key\n end", "def keys\n messages.keys\n end", "def keys\n messages.keys\n end", "def to_a\n @hash.keys\n end", "def to_a\n @hash.keys\n end", "def array_of_keys(key)\n n = query(@connection, key)\n if n.nil?\n []\n else\n a = []\n n.each do |value|\n a.push(value.key.gsub(key, ''))\n end\n a\n end\n end", "def hkeys\n self.class.hkeys\n end", "def hkeys(key); end", "def hkeys(key); end", "def ids\n storage.keys\n end", "def entries\n @data.keys\n end" ]
[ "0.7004097", "0.6902772", "0.68922305", "0.6824827", "0.6816982", "0.6816982", "0.6816982", "0.67646813", "0.67646813", "0.6726424", "0.6712907", "0.6700374", "0.6668381", "0.6648168", "0.6617792", "0.65991104", "0.6525515", "0.6477177", "0.64321655", "0.64056975", "0.6398333", "0.6360555", "0.6328118", "0.63124627", "0.6303228", "0.630199", "0.6289326", "0.6287002", "0.62809616", "0.62573075", "0.6254477", "0.6245477", "0.62361306", "0.6229045", "0.6220014", "0.6206913", "0.61857593", "0.6183988", "0.6182714", "0.6181187", "0.6180776", "0.61743903", "0.61686397", "0.61591226", "0.61513954", "0.6145789", "0.61384547", "0.6133083", "0.6115175", "0.61137056", "0.61075085", "0.61075085", "0.61040014", "0.60983276", "0.60789406", "0.6075341", "0.6072278", "0.6071933", "0.6064708", "0.60578704", "0.60578704", "0.60520947", "0.6051566", "0.60339475", "0.6030773", "0.6029945", "0.6004412", "0.60005176", "0.598515", "0.59850645", "0.59787726", "0.59631974", "0.59631974", "0.59631974", "0.59631974", "0.59631974", "0.59631974", "0.59631974", "0.59631974", "0.59631974", "0.5959435", "0.59565496", "0.5919885", "0.5910438", "0.59023154", "0.59023154", "0.58949757", "0.589416", "0.5887182", "0.58798486", "0.58688295", "0.58688295", "0.58534884", "0.58534884", "0.58504844", "0.5842095", "0.58420396", "0.58420396", "0.5839587", "0.5829174" ]
0.82069546
0
Remove all tracked keys
def stop_tracking_keys @memcache.delete(@tracking_key) if @tracking_key end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_all\n synchronized { @hash = {} }\n end", "def remove_all_keys\n\t\tdelete(\"/user/keys\")\n\tend", "def remove_all_keys\n\t\tdelete(\"/user/keys\")\n\tend", "def clear\n heroku.remove_all_keys\n display \"All keys removed.\"\n end", "def clear\n heroku.remove_all_keys\n display \"All keys removed.\"\n end", "def clear!\n @key_files = []\n @known_identities = nil\n self\n end", "def delete_all\n store.delete(KEY)\n self\n end", "def delete_all\n self.store.delete_keys(find_keys)\n end", "def remove_all\n store = @store\n @store = {}\n store.values.map(&:last)\n end", "def remove_all_keys\n deprecate # 07/31/2012\n delete(\"/user/keys\").to_s\n end", "def remove_all_keys\n delete(\"/api/v1/ssh_keys\").to_s\n end", "def delete_all\n Nvmkv.kv_delete_all(@kv_id)\n end", "def clear_all(key)\n _mutex.synchronize do\n _store[key] = {}\n end\n end", "def clear_assigned_keys\n @assigned_keys = {}\n end", "def clear!\n @key_registry = {}\n self\n end", "def removed_keys\n @removed_keys ||= []\n end", "def cleanup\n keys = redis.keys(raw_data_key('*')) + redis.keys(data_key('*'))\n multi do\n keys.each{|key| redis.del(key)}\n end\n super\n end", "def clear\n all_keys = keys\n return 0 if all_keys.empty?\n\n # Delete all keys\n del(*all_keys)\n end", "def clear\n keys.each do |k|\n Jeapie.instance_variable_set(\"@#{k}\", nil)\n end\n end", "def clear\n if warning?\n warn(\"This operation can run for a very long time if the namespace contains lots of keys! \" +\n \"It should be used in tests, or when the namespace is small enough \" +\n \"and you are sure you know what you are doing.\")\n end\n\n batch_size = 1000\n\n if supports_scan?\n cursor = \"0\"\n begin\n cursor, keys = scan(cursor, count: batch_size)\n del(*keys) unless keys.empty?\n end until cursor == \"0\"\n else\n all_keys = keys(\"*\")\n all_keys.each_slice(batch_size) do |keys|\n del(*keys)\n end\n end\n end", "def cleanup\n @keys.each { |key, time|\n if expired_kalive?(key, 300)\n delete_key(key)\n end\n\n if expired_unlocked?(key, 60)\n unblock_key(key)\n end\n }\n \n end", "def clear\n with(keys: EMPTY_ARRAY)\n end", "def remove_expired_keys\n self.user_key.each do |user_key|\n if user_key.expired?\n self.remove_user_key(user_key)\n user_key.delete\n end\n end\n end", "def clear(opts = {}) \n save(setup_commit_options({:message => \"all clear\"}.merge(opts))) do |index|\n if tree = index.current_tree\n tree.contents.each do |entry|\n index.delete(key_for(entry.name))\n end\n end\n end\n end", "def clear(opts = {}) \n save(setup_commit_options({:message => \"all clear\"}.merge(opts))) do |index|\n if tree = index.current_tree\n tree.contents.each do |entry|\n index.delete(key_for(entry.name))\n end\n end\n end\n end", "def clean!\n if @keys.size > Cache.max_size\n @keys = @keys[(Cache.max_size/2)...@keys.size]\n reject! { |key, value| !@keys.include?(key) }\n end\n end", "def sweep\n @accessed_keys.each { |k| @values.delete k }\n @accessed_keys = []\n end", "def purge!\n @map = {}\n end", "def purge!\n redis.keys(scope + \"*\").each do |key|\n redis.del key\n end\n end", "def clear\n hashed.clear\n list.clear\n end", "def clear\n validate_arguments!\n\n action(\"Removing all SSH keys\") do\n api.delete_keys\n end\n end", "def remove_keys(*keys)\n @rye_opts[:keys] ||= []\n @rye_opts[:keys] -= keys.flatten.compact\n @rye_opts[:keys].uniq!\n self # MUST RETURN self\n end", "def clear\n @hash.del\n @index.del\n end", "def remove_all()\n @items.clear()\n end", "def clear_training_data\n keys = @redis.keys(base_key.join(':') + '*')\n\n keys.each do |key|\n @redis.del key\n end\n end", "def clear!\n Goalkeeper.redis.del(key)\n end", "def clear\n @entity_list = {}\n @context_list = {}\n @last_unique_id = 0\n @entity_names = {} # Internal cache of context names for quick key retrieval\n end", "def clear!\n BULK_APIS.keys\n .each { |key| redis.del(redis_key(key)) }\n end", "def purge_cache\n return unless self.respond_to? :tracked_cache_keys\n\n self.delete_from_cache(*self.tracked_cache_keys, after_commit: true)\n end", "def clear_changes!\n remove_instance_variable(:@original_hash) if defined?(@original_hash)\n end", "def clear\n @data = {}\n @next_keys = {}\n end", "def remove_all\n @registry = []\n sync\n end", "def clear\n @redis.delete_matched(\"#{@key}:*\")\n end", "def unlink(*keys); end", "def clear_by_key(key)\n delete(key)\n end", "def clear\n @lock.synchronize do\n @values.clear\n @references_to_keys_map.clear\n end\n end", "def clear\n set_hash.each { |regexp, hash| hash.clear }\n end", "def remove_all\n @list.each_key do |key|\n @list[key].each do |o|\n if o\n o.sprite.remove\n @list[key].delete(o)\n end\n end\n @list.delete(key)\n end\n end", "def clear\n @lock.synchronize do\n @references.clear\n @references_to_keys_map.clear\n end\n end", "def remove(key); end", "def delete key\n @internal_hash[key].clear\n end", "def delete_keys!(*keys)\r\n\t\tkeys.each do |k| \r\n\t\t\tself.delete(k)\r\n\t\tend \r\n\t\tself\r\n\tend", "def cleanup!\n self.reject! { |k, v| v.empty? }\n end", "def cleanup\n @agent_file_history.each { |af| FileUtils.rm_f(af) }\n @key_file_history.each { |kf| FileUtils.rm_f(kf) }\n end", "def delete_keys! list\n if list.is_a? Array\n list.map{|k| self.delete k}\n else\n self.delete list\n end\n self\n end", "def del(*keys); end", "def clear_all!\n @events = {}\n end", "def delete_all\n # delete individual objects one by one, making sure to delete all accessors as well\n returns = {}\n @_componentable_container.each do |key, val|\n delete!(key)\n returns[key] = val\n end\n returns\n end", "def delete_key(key)\n end", "def unset key\n storage.delete key\n end", "def clear!\n @tracking.drop\n @user_data.drop\n create_indices\n end", "def delete_all\n records.clear\n end", "def purge!\n\n fetch_all({}).each { |hwi| @context.storage.delete(hwi) }\n end", "def deleted_keys\n @deleted_keys ||= []\n end", "def deleted_keys\n @deleted_keys ||= []\n end", "def gc!\n delete_if { |key, s| s.expired? }\n end", "def clear\n @hash.clear\n self\n end", "def remove(key)\n\n end", "def clean_keys\n self.validator_key = clean_key(validator_key)\n self.client_key = clean_key(client_key)\n self.databag_key = clean_key(databag_key)\n end", "def clear\n synchronize_block do\n @data.clear\n @key_access_store.clear\n end\n end", "def clear_cache_like! *keys\n clear_cache_like *keys\n ipcm_trigger :clear_cache_like, *keys\n end", "def del(keys)\n keys.each { |key| _data.delete(key) }\n _save\n end", "def clean\n synchronized { @hash.delete_if { |_key, value| expired?(value) } }\n end", "def clear_temporary\n @temporary_objects.each_key do |key|\n @temporary_objects[key].remove\n @temporary_objects.delete(key)\n end\n end", "def remove(key)\n a_hash[key] = nil\n end", "def delete_all\n target.clear\n end", "def clear\n @stash.clear\n end", "def clear\n if namespace\n keys.each do |key|\n delete(key)\n end\n delete(KEYS_ADDRESS)\n else\n database.clear\n end\n end", "def redis_cleanup\n keys = redis.keys\n redis.del(keys) unless keys.empty?\nend", "def pop\n delete @data.keys.pop\n end", "def delete_multiple(keys = [])\n verify_connection_url\n\n keys.each { |key| delete key }\n end", "def remove(key)\n @store.delete_if { |i| i[:key] == build_key(key) }\n end", "def clear_session_keys() #:nodoc:\n @@session_keys.clear\n end", "def discard! *keys\n keys.each {|k| delete k }\n self\n end", "def delete_all(key)\n raise ArgumentError if key.blank?\n\n count = 0\n @redis.keys(\"#{key}*\").each do |k|\n count += @redis.del k\n end\n\n count.positive?\n end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def remove_by\n synchronized do\n @hash.each_key do |k|\n @hash.delete(k) if yield(k)\n end\n end\n end", "def clear_stored_results\n paths = get_stored_paths\n redis.pipelined do\n paths.each do |path|\n [stored_paths_key, paths_visited_key, paths_to_visit_key].each do |key|\n redis.del key\n end\n\n clear_path_results(path)\n end\n end\n end", "def clear\n @by_id.values.each{|x| x.clear }\n end", "def clear\n @hash_tags.clear\n end", "def clean_dirty_attributes!\n @dirty_attribute_keys = []\n end", "def clear!\n @all = Set.new\n end", "def clear_path_results(path)\n [path_assets_key(path), path_links_to_key(path), path_linked_to_from_key(path)].each do |key|\n redis.del key\n end\n end", "def destroy\n @key.destroy\n end", "def clean_track_keys track_keys\n track_keys.map do |key|\n /t\\d+/.match(key)[0]\n end\n end", "def clear\n @known = []\n end" ]
[ "0.7781697", "0.7711293", "0.7711293", "0.7637387", "0.7637387", "0.7496556", "0.7451442", "0.7438645", "0.73214936", "0.7292554", "0.7275242", "0.72710973", "0.7216195", "0.7192658", "0.7187513", "0.71715724", "0.7083836", "0.6997382", "0.69505566", "0.69397974", "0.68809354", "0.6822263", "0.68169516", "0.67988354", "0.67988354", "0.6767196", "0.6741947", "0.66949624", "0.66650856", "0.66172224", "0.6612644", "0.6608764", "0.6608474", "0.6581895", "0.65764165", "0.65665245", "0.65579474", "0.65428424", "0.6541224", "0.65337795", "0.6528932", "0.6527665", "0.6502656", "0.6494274", "0.64931834", "0.6473708", "0.64698756", "0.64577353", "0.6440455", "0.6439256", "0.6432787", "0.64288455", "0.6422746", "0.6390875", "0.63706493", "0.6359258", "0.63574004", "0.635281", "0.635215", "0.634919", "0.6346347", "0.63405114", "0.63334435", "0.6331951", "0.6331951", "0.63285244", "0.6328106", "0.63158584", "0.6310181", "0.6309608", "0.6304475", "0.6300948", "0.6298736", "0.6287204", "0.6284189", "0.628161", "0.6279312", "0.6272303", "0.62720007", "0.62716097", "0.62703264", "0.6265546", "0.62642616", "0.6249642", "0.62466604", "0.6246371", "0.6246371", "0.6246371", "0.6246371", "0.6246371", "0.62449133", "0.62340015", "0.6211309", "0.6209903", "0.6207815", "0.6194633", "0.6189127", "0.61847645", "0.6183386", "0.61830986" ]
0.69491965
19
Add a key in the array of tracked keys (used by expire_match) ==== Parameter key:: the key to add
def cache_start_tracking(key) return unless @tracking_key keys = get_tracked_keys keys.push(key) set_tracked_keys(keys) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_key(key)\n keys.add(key)\n end", "def add(key)\n @internal_hash[key] = true\n end", "def add( key_file )\n @key_files.push( key_file ).uniq!\n self\n end", "def add(key, value)\n update_array(key, value, :add)\n end", "def insert(key)\n @keys << key\n swim(@keys.length - 1)\n end", "def add_key(key)\n numkeys = @worksheet_obj.list.keys.length\n @worksheet_obj[1, numkeys+1] = key\n @worksheet_obj.save\n end", "def add_ssh_key(key)\n if persisted?\n pending_op = PendingUserOps.new(op_type: :add_ssh_key, arguments: key.attributes.dup, state: :init, on_domain_ids: self.domains.map{|d|d._id.to_s}, created_at: Time.new)\n CloudUser.where(_id: self.id).update_all({ \"$push\" => { pending_ops: pending_op.serializable_hash_with_timestamp , ssh_keys: key.serializable_hash }})\n reload.run_jobs\n else\n ssh_keys << key\n end\n end", "def new_key(list, key, value)\n\tlist[key] = value\nend", "def add_key(user_name, key)\n\tabort \"Cannot add key, user not found!\" unless users(:return => :array).include?(user_name)\n\t@ssh_keys << {:user_name => user_name, :key => key}\n end", "def add(key, value)\n end", "def set_tracked_keys(keys)\n @memcache.set(@tracking_key, keys)\n end", "def add(key, value); end", "def key=(new_key)\n @key = new_key\n end", "def add_key_data(key_data_); end", "def add(key_file); end", "def add(key, value)\n change(:add, key, value)\n end", "def add_host_key( key_file )\n @host_key_files.push( key_file ).uniq!\n self\n end", "def add(key, value)\n\t\t\t\tself[key] = value\n\t\t\tend", "def add(key, value)\n @hash[key] = value\n self\n end", "def add_key(key)\n post(\"/api/v1/ssh_keys\", :key => key).to_s\n end", "def append(key, value); end", "def append(key, value); end", "def add_key(key)\n begin\n file = Tempfile.new('key')\n file.puts(key)\n file.close\n\n add_keyfile(file.path)\n ensure\n file.close(true) unless file.nil?\n end\n end", "def add_tags(key, *params)\n taggable.add(key, *params)\n end", "def add_key(key)\n if File.exist?(key)\n data = File.open(key).read\n key_import = GPGME::Key.import(data, armor: true)\n key = GPGME::Key.get(key_import.imports[0].fpr).uids[0].email\n else\n data = GPGME::Key.export(key, armor: true).read\n end\n\n raise I18n.t('error.export_key') if data.to_s.empty?\n\n @keys[key] = data\n @passwords.each_key { |id| set_password(id, get_password(id)) }\n @otp_keys.each_key { |id| set_otp_key(id, get_otp_key(id)) }\n end", "def add_key_path(key_name, *path)\n fields.merge!({ key_name => path })\n end", "def write_key(*key); end", "def add_key(*keys, key, value)\n\t\t\t\ti=self\n\t\t\t\tkeys.each do |k|\n\t\t\t\t\ti.key?(k) or i[k]={}\n\t\t\t\t\ti=i[k]\n\t\t\t\tend\n\t\t\t\ti.key?(key) or i[key]=value\n\t\t\t\t# self\n\t\t\t\ti[key]\n\t\t\tend", "def inc(key)\n \n end", "def add_key(key)\n\t\tpost(\"/user/keys\", key, { 'Content-Type' => 'text/ssh-authkey' })\n\tend", "def add_key(key)\n\t\tpost(\"/user/keys\", key, { 'Content-Type' => 'text/ssh-authkey' })\n\tend", "def add(host, key); end", "def incr(key); end", "def incr(key); end", "def updateKey; @key = getKey; self end", "def add_key(key)\n deprecate # 07/31/2012\n post(\"/user/keys\", key, { 'Content-Type' => 'text/ssh-authkey' }).to_s\n end", "def add_key(key)\n post(\"/users/ssh_keys\", {:key => key}, :accept => 'json').to_s\n end", "def append(key, time)\n Sidekiq.redis do |conn|\n conn.lpush(namespace_key(key), time.to_i)\n end\n end", "def append!(key, value); end", "def append!(key, value); end", "def +(key)\n\t\t\treturn dial!(*key)\n\t\tend", "def add(keyvalue)\n if keyvalue.is_a? String\n @hash[keyvalue] = nil\n else\n keyvalue.each do |key, value|\n @hash[key] = value #create key-value pair in @hash\n end\n end\n end", "def add_keys(*keys)\n @rye_opts[:keys] ||= []\n @rye_opts[:keys] += keys.flatten.compact\n @rye_opts[:keys].uniq!\n self # MUST RETURN self\n end", "def add_key(key,value) \n\t\tSCHOOL[key]=[value]\n\tend", "def add_key(options = {})\n post \"/user/keys\", options\n end", "def << key\n @table[key]\n end", "def update_key_list(keys)\n key_list = get_key_list\n type = keys.first.to_sym\n key_list[type] = key_list[type] || Set.new\n key_chain = keys[1..-1].join('.')\n unless key_list[type].include?(key_chain)\n key_list[type].add key_chain\n _write(Common::KEY, key_list)\n end\n end", "def increment(key)\n @counter[key] += 1\n end", "def insert(key)\n end", "def add(key, value)\n @hash[key] = value\n @reverse[value] ||= []\n @reverse[value] << key\n end", "def insert(key, value)\n i = index(key)\n buckets[i] = [key, value]\n end", "def sadd(key, *members); end", "def add_key(key_id, key_content)\n system(\"#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys add-key #{key_id} \\\"#{key_content}\\\"\")\n end", "def context_key(key)\n context_keys.push key\n end", "def key=(key); end", "def add_key(arg)\n \"key=#{arg.to_json}\"\n end", "def append(key, value)\n send_command([:append, key, value])\n end", "def add_trusted_key(k)\n @trusted_keys.add(k)\n end", "def add(key)\n cmd = \"input keyevent #{map_key(key)};\"\n @sequence == \"\" ? @sequence = cmd : @sequence = @sequence + cmd\n end", "def add_column_key(key)\n\t\tself.google_doc.restart_session_if_necessary #TODO do we actually need to do these?\n\t\treset_worksheet_obj if @worksheet_obj == nil\n\t\t@worksheet_obj[1, num_keys+1] = key\n\t\t@worksheet_obj.save\n\tend", "def add_content_key content_key\n return unless content_key\n self.transaction do\n content_key = content_key.versions.latest if ContentKey === content_key\n raise ArgumentError, \"Expected ContentKey or ContentKey::Version\" unless ContentKey::Version === content_key\n\n save! unless self.id\n\n # Dont add if it's already been added.\n return if content_key_versions.find(:first, :conditions => [ 'content_key_id = ?', content_key ])\n\n connection.\n execute(\"DELETE FROM revision_list_content_keys \n WHERE revision_list_id = #{self.id}\n AND content_key_version_id IN\n (SELECT id FROM content_key_versions WHERE content_key_id = #{content_key.content_key.id})\"\n )\n revision_list_content_keys.create!(:content_key_version => content_key)\n\n # Invalidate association caches.\n revision_list_content_keys.reset\n content_key_versions.reset\n end\n self\n end", "def search_new_key(key)\n _key = key\n if get_file(key).present?\n (1..999).each do |i|\n _key = key.cama_add_postfix_file_name(\"_#{i}\")\n break unless get_file(_key).present?\n end\n end\n _key\n end", "def []= key, value\n @internal_hash[key].push value\n value\n end", "def add(key, value)\n context.add(key, value)\n end", "def reserve_key(key); end", "def lpush(key, value); end", "def lpush(key, value); end", "def add_keyfile(file)\n ProcessWatcher.watch(\"ssh-add\", [file], nil, -1, 10)\n end", "def append(key, value)\n perform(:append, key, value.to_s)\n end", "def set_add(key, value)\n perform_update(:set_add, key, value.to_s)\n end", "def append(key, value)\n node_for(key).append(key, value)\n end", "def add(k, v)\n\t\titem = Item.new(k, v)\n\t\t@h.add(item)\n\t\treturn\n\tend", "def add_datapoint(key)\n @redis.sadd \"datapoints\", key\n end", "def add_key(klass, key_name, opts={})\n DoesKeyValue.log(\"State: Add key #{key_name} to class #{klass.to_s} with opts:#{opts.inspect}\")\n @keys ||= Hash.new\n @keys[klass.to_s] ||= Array.new\n @keys[klass.to_s] << {name:key_name, options:opts}\n end", "def add_extra(key, value)\n @extras[key] = value\n end", "def push_into_hash(hash, key, data)\n if hash[key.to_sym].nil?\n hash[key.to_sym] = [data]\n else # existing key\n hash[key.to_sym].push(data)\n end\n end", "def key_down key\n @keys.push key\n end", "def incr(key)\n send_command([:incr, key])\n end", "def new_by_key(key)\n args = RedisModelExtension::Database.redis {|r| r.hgetall(key) }\n return nil unless args && args.any?\n args.symbolize_keys!\n\n new_instance = new(args)\n new_instance.store_keys\n\n return new_instance\n end", "def <<(key)\n key_to_hashes(key).each { |hash| filter.set!(hash) }\n self\n end", "def add(key, value, placer = AppendPlacer.new)\n element = placer.new_element(self)\n element[:key] = key\n element[:value] = value\n element[:operation] = :add\n end", "def put(key, value)\n \txk = key % 10001 \n xk = (xk + 1) % 10001 while @arr[xk].first != nil && @arr[xk].first != key \n @arr[xk] = [key, value] \n end", "def add_deploy_key(repo, title, key, options = {})\n post \"#{Repository.path repo}/keys\", options.merge(:title => title, :key => key)\n end", "def add_method(key)\n self.class.send(:define_method, key) do\n @hash[key]\n end\n end", "def add_item(list, key, quantity)\n list[\"#{key}\"] = quantity\n list\nend", "def lpush(key, value)\n node_for(key).lpush(key, value)\n end", "def handle_key_append(key, value, cfg_dir, list_keys, path_keys, cfg)\n this_value = handle_key(key, value, cfg_dir, list_keys, path_keys, cfg)\n cfg[key] = [] unless cfg.has_key?(key)\n\n begin\n cfg[key].concat(this_value).uniq!\n rescue NoMethodError\n end\n end", "def zadd(key, *args)\n node_for(key).zadd(key, *args)\n end", "def put(key, value)\n idx, bucket = find_bucket_and_index(key)\n if idx\n bucket[idx] = [key, value]\n else\n bucket << [key, value]\n end\n end", "def key=(value)\n @key = value\n end", "def key=(value)\n @key = value\n end", "def shell_registry_createkey(key, view)\n key = normalize_key(key)\n # REG ADD KeyName [/v ValueName | /ve] [/t Type] [/s Separator] [/d Data] [/f]\n shell_registry_cmd_result(\"add /f \\\"#{key}\\\"\", view)\n end", "def _addElement( key, value )\n @token.addElement( key, value )\n end", "def add_key_value_pair_to_pocket_money (a_key, a_value)\n @pocket_money[a_key] = a_value\nend", "def addkey(key, value, school)\n school[key] = value\nend", "def add_key(key, value, school)\t\t\t\t\t\t\t\t\t\t\t\t\t#di. create method to add keys & values\n\tschool[key] = value\nend", "def add?(key)\n hashes = key_to_hashes(key).reject { |hash| filter.set?(hash) }\n hashes.each { |hash| filter.set!(hash) }\n hashes.any?\n end", "def initialize( key )\n @key = Kernel.Array(key)\n end", "def setl(key, *value)\n namespaced_redis.rpush(key, value.map(&:to_json))\n end", "def add_authorized_key(key)\n queries = password_hash\n case key\n when String\n if File.exist?(key)\n key = File.open(key, \"r\")\n content = key.read.strip\n key.close\n else\n content = key\n end\n when File\n content = key.read.strip\n key.close\n end\n\n queries[:query][:authorized_key] = content\n post \"/setup/api/settings/authorized-keys\", queries\n end" ]
[ "0.8169", "0.704668", "0.6907145", "0.6874536", "0.68710005", "0.6612582", "0.656328", "0.6506404", "0.6465425", "0.6456198", "0.640189", "0.63858557", "0.6362564", "0.6356876", "0.6323165", "0.63218915", "0.63056874", "0.6292981", "0.62851053", "0.62638396", "0.6240793", "0.6240793", "0.6239632", "0.62083465", "0.620259", "0.6196026", "0.61818916", "0.61813945", "0.6180718", "0.6170911", "0.6170911", "0.6165168", "0.6115221", "0.6115221", "0.60984075", "0.60843986", "0.60432696", "0.6029693", "0.60039055", "0.60039055", "0.5978205", "0.5967352", "0.59620154", "0.59523755", "0.59454", "0.59266615", "0.59196585", "0.5909261", "0.5901365", "0.58902454", "0.587037", "0.5854038", "0.5853567", "0.5851725", "0.5841897", "0.58296615", "0.5799652", "0.5793663", "0.5790554", "0.5781946", "0.5778422", "0.5774945", "0.5774712", "0.5760066", "0.57573164", "0.57544637", "0.57544637", "0.57490855", "0.5741521", "0.57408845", "0.5731808", "0.57240427", "0.5703938", "0.5701257", "0.5694455", "0.5686928", "0.56819755", "0.56758255", "0.5675688", "0.5669946", "0.5663778", "0.5660496", "0.5646921", "0.56309044", "0.5623687", "0.5622912", "0.56114846", "0.5610471", "0.5609568", "0.56094956", "0.56094956", "0.5607728", "0.5599299", "0.55992424", "0.55929273", "0.5587894", "0.55487645", "0.5543466", "0.55400914", "0.55391186" ]
0.6475322
8
Remove a key from the array of tracked keys (used by expire_match) ==== Parameter key:: the key to remove
def cache_stop_tracking(key) return unless @tracking_key keys = get_tracked_keys keys.delete(key) set_tracked_keys(keys) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(key); end", "def remove(key)\n @store.delete_if { |i| i[:key] == build_key(key) }\n end", "def remove(key)\n\n if include?(key)\n self[key].delete(key)\n @count -= 1\n end\n\n end", "def remove(key)\n\n end", "def remove(key)\n a_hash[key] = nil\n end", "def delete_key(key)\n end", "def remove(key)\n Lib.remove @path, @no_follow, key.to_s\n end", "def remove(key)\n @map.delete(key)\n end", "def delete(key)\n pop if change_key(key, nil, true)\n end", "def remove(*key)\n @cache.delete(key)\n end", "def delete key\n @internal_hash[key].clear\n end", "def remove(key)\n @map.each { |pair| @map.delete(pair) if pair.first == key }\n end", "def remove(key)\n with_client do |client|\n client.del(build_key(key))\n end\n end", "def clear_by_key(key)\n delete(key)\n end", "def delete(key)\n @hash.delete key\n @key_hash.delete key\n end", "def remove( key )\n key = UniMap.str_to_key( key ) unless key.is_a?( Key )\n key && HTMapHelper.remove_map( self, key )\n end", "def remove(key)\n row = key >> 10\n column = @a[row].index{|(i,v)| i == key}\n if column\n @a[row].delete_at(column)\n end\n end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def erase(key)\n if !contains?(key)\n return\n end\n\n erase_internal(key)\n end", "def delete(key)\n raise ArgumentError, \"+key+ is not an Array, but was #{key.class}\" unless Array === key\n\n @second_level_cache.delete(key) if @second_level_cache\n @cache.delete(key)\n end", "def del(key)\n @first.del(key)\n end", "def remove(key)\n idx, bucket = find_bucket_and_index(key)\n return unless idx\n\n bucket.delete_at(idx)\n end", "def delete(key)\n @hash.delete(key.to_s)\n end", "def delete_key(key)\n @keys.delete(key)\n @passwords.each_key { |id| set_password(id, get_password(id)) }\n @otp_keys.each_key { |id| set_otp_key(id, get_otp_key(id)) }\n end", "def unset_value(key)\n database.delete(key)\n removed_keys << key\n end", "def remove(key)\n unless get(key) == -1\n @count -= 1\n bucket = @map[key.hash % @size]\n bucket.reject! {|k, v| k == key}\n end\n end", "def remove_key(key)\n\t\tdelete(\"/user/keys/#{escape(key)}\")\n\tend", "def remove_key(key)\n\t\tdelete(\"/user/keys/#{escape(key)}\")\n\tend", "def delete(key)\n @internal_hash.delete(key)\n end", "def delete(key)\n index = self.keys.index(key) unless @array.empty?\n @array.delete_at(index) if index\n end", "def remove_key_from_hash_of_arrays!(hash,key)\n hash.each do |name,arr|\n arr.each do |record|\n record.delete(key)\n end\n end\n hash\n end", "def remove_key(key)\n deprecate # 07/31/2012\n delete(\"/user/keys/#{escape(key)}\").to_s\n end", "def remove(key)\n \txk = key % 10001 \n xk = (xk + 1) % 10001 while @arr[xk].first != nil && @arr[xk].first != key \n @arr[xk] = [nil, -1] if @arr[xk].first == key\n end", "def delete(key)\n @succ.delete key\n end", "def delete(key)\n\n end", "def delete key\n write_data_entry key, nil, true\n @keydict[key] = nil\n\n sync\n end", "def unregister(key)\n update_data { |h| h.dup.tap { |j| j.delete(key) } }\n self\n end", "def remove(key)\n @dao.collection.remove(selector(key))\n end", "def delete(key)\n transaction do |y|\n y.delete(key)\n end\n end", "def unregister(key)\n @data.update { |h| h.dup.tap { |j| j.delete(key) } }\n self\n end", "def decr(key); end", "def decr(key); end", "def delete(key)\n @ivar.each_with_index do |ele, i|\n if ele[0] == key\n @ivar.delete_at(i)\n end\n end\n end", "def del(key)\n response = db.delete_item(@table_name, {'HashKeyElement' => {'S' => key}})\n true\n end", "def delete(key)\n return unless in?(key)\n\n hash_index = hasher(key, @keys.size)\n\n if @keys[hash_index] == key\n @keys[hash_index] = nil\n @values[hash_index] = nil\n else\n next_key_index = rehash(hash_index, @keys.size)\n\n while @keys[next_key_index] != nil and @keys[next_key_index] != key\n next_key_index = rehash(next_key_index, @keys.size)\n end\n\n @keys[next_key_index] = nil\n @values[next_key_index] = nil\n end\n end", "def remove_key(key)\n delete(\"/users/ssh_keys/#{escape(key)}\").to_s\n end", "def remove(key)\n synchronized { @hash.delete(key) { yield if block_given? } }\n end", "def delete(key)\n hashed_key = key.hash\n bucket_index = hashed_key % num_buckets\n return nil if !@store[bucket_index].include?(key)\n @count -=1\n @store[bucket_index].remove(key)\n end", "def remove(itemkey)\n # :nocov:\n raise \"Forgotten implementation\"\n # :nocov:\n end", "def releaseKey(key)\n\t\t@keysPressed.delete(key)\n\tend", "def delete(key)\n perform_delete(:delete, key)\n end", "def delete(key)\n data.delete(key)\n @deleted_hash[key] = nil\n end", "def delete(key)\n position = search(key)\n return if (key <=> @keys[position]) != 0\n @keys.delete_at(position)\n @values.delete_at(position)\n end", "def delete(key)\n @data.delete(key)\n @key_size.delete(key)\n end", "def delete(key)\n responsible_clients(key).each do |v|\n with_retries { v.logical.delete(wrap_key(key)) }\n end\n end", "def remove\n key = shift_argument\n if key.nil? || key.empty?\n error(\"Usage: heroku keys:remove KEY\\nMust specify KEY to remove.\")\n end\n validate_arguments!\n\n action(\"Removing #{key} SSH key\") do\n api.delete_key(key)\n end\n end", "def delete _key\n store.transaction() { |s| s.delete(prepare_key(_key)) }\n end", "def remove\n heroku.remove_key(args.first)\n display \"Key #{args.first} removed.\"\n end", "def remove\n heroku.remove_key(args.first)\n display \"Key #{args.first} removed.\"\n end", "def clear_key(key)\n @redis.del(key)\n end", "def delete(key)\n result = @rarray.get(key)\n if result\n @rarray.delete(result)\n store\n else\n raise ArgumentError,'Cannot delete - no matching id', caller \n end\n end", "def delete(key)\n @store.delete(key)\n end", "def del(key)\n @meta.delete(key.to_sym) if key\n end", "def delete_with_key(key)\n real_key = @original_properties.keys.find { |k| k.to_s == key.to_s }\n @original_properties.delete(real_key)\n end", "def remove_item(list, key_name)\r\n\tlist.delete(key_name)\r\n\treturn list\r\nend", "def delete(key)\n unimplemented\n end", "def delete(key)\n @monitor.synchronize do\n entry = @stash.delete(key)\n if entry\n @expires_at.delete(entry)\n entry.value\n else\n nil\n end\n end\n end", "def delete(key)\n key = alternate_key(key) unless has_key?(key)\n super\n end", "def getdel(key); end", "def getdel(key); end", "def xdel(key, *ids); end", "def delete(key)\n @lock.synchronize do\n rkey = ref_key(key)\n if rkey\n @references_to_keys_map.delete(rkey)\n @values.delete(rkey)\n else\n nil\n end\n end\n end", "def delete(key)\n attribute = key.to_sym\n details.delete(attribute)\n messages.delete(attribute)\n end", "def delete(key)\n @store.delete(key)\n end", "def unset key\n storage.delete key\n end", "def remove_key(key_id)\n delete(\"/api/v1/ssh_keys/#{key_id}\").to_s\n end", "def del(key)\n ensure_connected\n num = redis_handler.del(key.to_s)\n fail ArgumentError, \"Unknown key, cannot delete\" if num == 0\n end", "def delete(key)\n key = key.key if key.respond_to?(:key)\n\n unless (idx = @indicies[key]).nil?\n @indicies.delete(key)\n @indicies.each { |k,v| @indicies[k] = v -= 1 if v > idx }\n @lines.delete_at(idx)\n end\n end", "def delete(key)\n raise NotImplementedError\n end", "def delete(key)\n raise NotImplementedError\n end", "def delete(key)\n if value = @hash[key]\n @reverse[value].delete(key)\n @reverse.delete value if @reverse[value].empty?\n @hash.delete key\n end\n end", "def erase(key)\n if !contains?(key)\n return\n end\n\n @semaphore.synchronize {\n erase_internal_locked(key)\n }\n end", "def unlink(*keys); end", "def remove_keys(*keys)\n @rye_opts[:keys] ||= []\n @rye_opts[:keys] -= keys.flatten.compact\n @rye_opts[:keys].uniq!\n self # MUST RETURN self\n end", "def del(*keys); end", "def delete(key)\n messages.delete(key)\n end", "def delete(key)\n messages.delete(key)\n end", "def delete(key)\r\n\t\t# If key does not exist then return nil otherwise delete node from list\r\n\t\t# and decrease total number of items in Hashmap by 1\r\n\t\treturn nil if key == nil || !get(key)\r\n\t\tindex = key.hash % @size\r\n\t\t@total -= 1\r\n\t\treturn @arr[index].delete(key)\r\n\tend", "def delete(key)\n\t\t\t\t[self, self, false]\n\t\t\tend", "def delete(key)\n messages.delete(key)\n end", "def remove_from_index(name, key); end", "def del(key)\n position = find(key)\n if position != nil\n # delete\n value = @values[position]\n @slots[position] = nil\n @values[position] = nil\n value\n else\n nil\n end\n end", "def delete(*key_list)\n first_keys, last_key = split_keys(key_list)\n data = fetch_data(first_keys)\n data.__delete__(last_key) if data.__key__?(last_key)\n end", "def delete(key)\n @mutex.synchronize do\n x = anchor\n level = node_level(x)\n update = Array.new(level)\n x = find_with_update(x, level, key, update)\n \n # remove existing key\n \t if node_compare(x, key) == 0\n \t level = node_level(x)\n \t while level > 0\n \t level -= 1\n \t node_delete_after!(x, update[level], level)\n end\n \t end\n end\n \tself\n \tend", "def remove(key)\n slot = key % BUCKET_MOD\n head = @buckets[slot]\n return unless head\n if head.key == key\n @buckets[slot] = head.next\n else\n head = head.next while head.next && head.next.key != key\n if head.next && head.next.key == key\n head.next = head.next.next\n end\n end\n end", "def delete(key)\n key = to_key key\n @group.delete key if @group.key? key\n end" ]
[ "0.77511764", "0.764434", "0.7594666", "0.7500757", "0.7339274", "0.73385334", "0.7308718", "0.72621405", "0.7230989", "0.7210839", "0.71979815", "0.71966237", "0.71826476", "0.71803576", "0.71578467", "0.7098925", "0.70959204", "0.70691776", "0.70691776", "0.70691776", "0.70691776", "0.70691776", "0.7063085", "0.70255953", "0.70083225", "0.69867337", "0.697667", "0.6976181", "0.69586873", "0.6948458", "0.6933293", "0.6933293", "0.69092125", "0.68399876", "0.6832794", "0.6821715", "0.68076855", "0.6742589", "0.6718848", "0.67173016", "0.67126524", "0.6709455", "0.6689746", "0.6676545", "0.6670799", "0.6670799", "0.66696805", "0.6663965", "0.66265184", "0.662035", "0.6618133", "0.6606586", "0.6568124", "0.6567441", "0.65622735", "0.65588427", "0.6543075", "0.65355164", "0.6531587", "0.6528346", "0.65216476", "0.65197945", "0.65197945", "0.65189815", "0.650363", "0.6434367", "0.6429131", "0.64267683", "0.641766", "0.6411588", "0.64047647", "0.64025104", "0.64020336", "0.64020336", "0.638729", "0.63753957", "0.6352993", "0.63516355", "0.6349727", "0.6337146", "0.6317641", "0.6314205", "0.6312759", "0.6312759", "0.6307307", "0.63038796", "0.62998325", "0.6298813", "0.628989", "0.62889415", "0.62889415", "0.6277727", "0.6276152", "0.6271701", "0.62615204", "0.62552303", "0.6250728", "0.6243889", "0.624386", "0.623896" ]
0.63374525
79
Tell why the geometry is not valid, `nil` means it is valid.
def invalid_reason if defined?(super) == "super" raise Error::RGeoError, "ValidityCheck MUST be loaded before " \ "definition of #{self.class}##{__method__}." end raise Error::UnsupportedOperation, "Method #{self.class}##{__method__} not defined." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_reason\n FFIGeos.GEOSisValidReason_r(Geos.current_handle_pointer, ptr)\n end", "def validate_geometry(geometry)\n geometry.tap do |g|\n total = g.width + g.height\n raise ScaleDown::InvalidGeometry if total == 0\n raise ScaleDown::InvalidGeometry if g.width > ScaleDown.max_dimensions[0] || g.height > ScaleDown.max_dimensions[1]\n end\n end", "def valid_point\n not (@point.time.nil? or @point.latitude.nil? or @point.longitude.nil?)\n end", "def printout_invalid_errors\n @non_convex_polygons.each do |shape|\n puts \"\\\"#{shape.id}\\\" is not a polygon\"\n end\n end", "def is_valid?\n raise Exception\n end", "def validation\n self.nation ||= region.nation\n unless !@x || !@y || @x == '' || @y == ''\n self.geom = Point.from_x_y(@x.to_f, @y.to_f)\n end\n end", "def geo_json_valid?\n geo_data = RGeo::GeoJSON.decode(params.to_json)\n if !geo_data.blank?\n return true\n else\n json_response(nil, :unprocessable_entity, :invalid_geojson_type)\n return false\n end\n end", "def valid?\n return false if @height.nil?\n return false if @height < 0\n return false if @width.nil?\n return false if @width < 0\n return false if @x.nil?\n return false if @x < 0\n return false if @y.nil?\n return false if @y < 0\n true\n end", "def geo_object\n begin\n if r = geo_object_type # rubocop:disable Lint/AssignmentInCondition\n send(r)\n else\n false\n end\n rescue RGeo::Error::InvalidGeometry\n return nil # TODO: we need to render proper error for this!\n end\n end", "def valid?\n @error.nil?\n end", "def valid?\n !@lat.nil? && !@lon.nil? && @lat.to_f.abs < 90 && @lon.to_f.abs < 90\n end", "def valid_geometry?(solr_geom)\n return false unless solr_geom.present?\n\n # :solr_geom => \"ENVELOPE(#{w}, #{e}, #{n}, #{s})\",\n # Solr docs say: \"minX, maxX, maxY, minY order\"\n # maximum boundary: (minX=-180.0,maxX=180.0,minY=-90.0,maxY=90.0)\n match = solr_geom.match(/ENVELOPE\\(([\\d\\.\\-]+)[\\ \\,]*([\\d\\.\\-]+)[\\ \\,]*([\\d\\.\\-]+)[\\ \\,]*([\\d\\.\\-]+)\\)/)\n\n # Not parsable ENVELOPE() syntax?\n return false unless match.present?\n\n minX, maxX, maxY, minY = match.captures\n return false if minX.to_f < -180 ||\n maxX.to_f > 180 ||\n maxY.to_f > 90 ||\n minY.to_f < -90\n\n return true\nend", "def valid?\n return false if @height.nil?\n return false if @id.nil?\n return false if @name.nil?\n return false if @width.nil?\n true\n end", "def valid?\n false\n end", "def valid?\n false\n end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?\r\n self.error.nil?\r\n end", "def valid?\n width.present? && height.present?\n end", "def valid?\n false\n end", "def invalid?\n @invalid\n end", "def valid?\n lat && lng\n end", "def valid?\n lat && lng\n end", "def is_valid?\n return is_closed? && (@polygon_points.length >= 3)\n end", "def is_valid?\n return is_closed? && (@polygon_points.length >= 3)\n end", "def invalid\n @invalid\n end", "def validate\n validate_params\n validate_coordinates\n validate_colour\n validate_dimension\n end", "def schema_valid_error(schema, message, trace)\n xprint(\"\\n** INVALID SCHEMA ** #{message}: #{schema.inspect}\\n\")\n false\n end", "def valid?(options = {})\n @error =\n if blank?\n \"source_data is blank\"\n elsif !valid_mime_type?\n \"source_data mime-type is invalid - #{mime_type}\"\n elsif one_pixel?\n \"source_data is a 1x1 image\"\n elsif size_too_big?\n \"source_data file size too big\"\n end\n @error.nil?\n end", "def valid?\n raise_error(@resource['error']) if ok? || error?\n end", "def is_empty?\n raise Error::UnsupportedOperation, \"Method Geometry#is_empty? not defined.\"\n end", "def invalid?\r\n return @invalid\r\n end", "def validate\n validate_params\n validate_colour\n validate_coordinates\n validate_dimension\n end", "def valid?\n true\n end", "def valid?\n valid_format? @format\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end" ]
[ "0.696121", "0.6626763", "0.6435146", "0.6326332", "0.6312135", "0.62558997", "0.6205111", "0.6161946", "0.6153711", "0.61103314", "0.6073514", "0.6057115", "0.60427356", "0.60351163", "0.60351163", "0.6033082", "0.6033082", "0.6033082", "0.6033082", "0.6033082", "0.60253626", "0.60206634", "0.5978318", "0.5940281", "0.59199196", "0.59199196", "0.58966357", "0.58966357", "0.5893957", "0.58561385", "0.5848172", "0.58292437", "0.5810556", "0.5802074", "0.5800017", "0.5797831", "0.5793786", "0.5793648", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025", "0.57936025" ]
0.0
-1
Try and make the geometry valid, this may change its shape. Returns a valid copy of the geometry.
def make_valid if defined?(super) == "super" raise Error::RGeoError, "ValidityCheck MUST be loaded before " \ "definition of #{self.class}##{__method__}." end raise Error::UnsupportedOperation, "Method #{self.class}##{__method__} not defined." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_geometry(geometry)\n geometry.tap do |g|\n total = g.width + g.height\n raise ScaleDown::InvalidGeometry if total == 0\n raise ScaleDown::InvalidGeometry if g.width > ScaleDown.max_dimensions[0] || g.height > ScaleDown.max_dimensions[1]\n end\n end", "def geometry\n @geometry ||= _geometry\n end", "def original_geometry\n @original_geometry ||= Paperclip::Geometry.new(original_width, original_height)\n end", "def validation\n self.nation ||= region.nation\n unless !@x || !@y || @x == '' || @y == ''\n self.geom = Point.from_x_y(@x.to_f, @y.to_f)\n end\n end", "def geo_object\n begin\n if r = geo_object_type # rubocop:disable Lint/AssignmentInCondition\n send(r)\n else\n false\n end\n rescue RGeo::Error::InvalidGeometry\n return nil # TODO: we need to render proper error for this!\n end\n end", "def geometry(style_name='original')\n # These calculations are all memoised.\n @geometry ||= {}\n begin\n @geometry[style_name] ||= if style_name.to_s == 'original'\n # If no style name is given, or it is 'original', we return the original discovered dimensions.\n original_geometry\n else\n # Otherwise, we apply a mock transformation to see what dimensions would result.\n style = self.file.styles[style_name.to_sym]\n original_geometry.transformed_by(style.geometry)\n end\n rescue Paperclip::TransformationError => e\n # In case of explosion, we always return the original dimensions so that action can continue.\n original_geometry\n end\n end", "def validation\n self.country ||= province.country\n unless !@x || !@y || @x == \"\" || @y == \"\"\n self.geom = Point.from_x_y(@x.to_f, @y.to_f)\n end\n end", "def valid_geometry?(solr_geom)\n return false unless solr_geom.present?\n\n # :solr_geom => \"ENVELOPE(#{w}, #{e}, #{n}, #{s})\",\n # Solr docs say: \"minX, maxX, maxY, minY order\"\n # maximum boundary: (minX=-180.0,maxX=180.0,minY=-90.0,maxY=90.0)\n match = solr_geom.match(/ENVELOPE\\(([\\d\\.\\-]+)[\\ \\,]*([\\d\\.\\-]+)[\\ \\,]*([\\d\\.\\-]+)[\\ \\,]*([\\d\\.\\-]+)\\)/)\n\n # Not parsable ENVELOPE() syntax?\n return false unless match.present?\n\n minX, maxX, maxY, minY = match.captures\n return false if minX.to_f < -180 ||\n maxX.to_f > 180 ||\n maxY.to_f > 90 ||\n minY.to_f < -90\n\n return true\nend", "def build_geom(feature)\n if make_valid?\n geom = ActiveRecord::Base.connection.select_value(\"SELECT ST_CollectionExtract(ST_MakeValid(ST_Force_2D(ST_GeomFromKML('#{feature}'))),3)\")\n else\n geom = ActiveRecord::Base.connection.select_value(\"SELECT ST_Force_2D(ST_GeomFromKML('#{feature}'))\")\n end\n end", "def create\n @geometry = Geometry.new(geometry_params)\n\n respond_to do |format|\n if @geometry.save\n format.html { redirect_to @geometry, notice: 'Geometry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @geometry }\n else\n format.html { render action: 'new' }\n format.json { render json: @geometry.errors, status: :unprocessable_entity }\n end\n end\n end", "def geometry(style_name='original')\n if style_name == 'original'\n Paperclip::Geometry.parse(\"#{original_width}x#{original_height}\")\n else\n Paperclip::Geometry.parse(style_dimensions(style_name))\n end\n end", "def is_valid?\n return is_closed? && (@polygon_points.length >= 3)\n end", "def is_valid?\n return is_closed? && (@polygon_points.length >= 3)\n end", "def is_empty?\n raise Error::UnsupportedOperation, \"Method Geometry#is_empty? not defined.\"\n end", "def geometry\n return unless data['geometry']\n\n symbol_hash data['geometry']\n end", "def valid?\n return false if @height.nil?\n return false if @id.nil?\n return false if @name.nil?\n return false if @width.nil?\n true\n end", "def use_hidden_geometry?\n end", "def valid_reason\n FFIGeos.GEOSisValidReason_r(Geos.current_handle_pointer, ptr)\n end", "def validate\n validate_params\n validate_coordinates\n validate_colour\n validate_dimension\n end", "def valid?\n return false if @height.nil?\n return false if @height < 0\n return false if @width.nil?\n return false if @width < 0\n return false if @x.nil?\n return false if @x < 0\n return false if @y.nil?\n return false if @y < 0\n true\n end", "def fill_geometry(vips, geometry)\n if geometry[:width]\n geometry[:height] ||= (geometry[:width] * vips.height.to_f / vips.width.to_f).ceil\n elsif geometry[:height]\n geometry[:width] ||= (geometry[:height] * vips.width.to_f / vips.height.to_f).ceil\n end\n \n if geometry[:modifier] == '*'\n output_width = (geometry[:height] * vips.width.to_f / vips.height.to_f).round\n if output_width < geometry[:width]\n geometry[:height] = (geometry[:width] * vips.height.to_f / vips.width.to_f).ceil\n end\n output_height = (geometry[:width] * vips.height.to_f / vips.width.to_f).round\n if output_height < geometry[:height]\n geometry[:width] = (geometry[:height] * vips.width.to_f / vips.height.to_f).ceil\n end\n end\n end", "def is_simple?\n raise Error::UnsupportedOperation, \"Method Geometry#is_simple? not defined.\"\n end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def detect_invalid \n @shapes.each do |shape|\n if shape.is_polygon\n @convex_polygons << shape\n else\n @non_convex_polygons << shape\n end\n end \n end", "def validate\n validate_params\n validate_colour\n validate_coordinates\n validate_dimension\n end", "def validate_position\n @shape.body.p = CP::Vec2.new(@shape.body.p.x % @window.width, @shape.body.p.y % @window.height)\n end", "def validate_position\n @shape.body.p = CP::Vec2.new(@shape.body.p.x % @window.width, @shape.body.p.y % @window.height)\n end", "def geometry\n @geometry\n end", "def valid?\n validate_triangle\n true\n end", "def valid?\n return false if @current_value.nil?\n return false if @incremental_change.nil?\n return false if @is_horizontal.nil?\n return false if @max.nil?\n return false if @min.nil?\n return false if @page_change.nil?\n return false if @shadow.nil?\n return false if @name.nil?\n return false if @mso_drawing_type.nil?\n return false if @auto_shape_type.nil?\n return false if @placement.nil?\n return false if @upper_left_row.nil?\n return false if @top.nil?\n return false if @upper_left_column.nil?\n return false if @left.nil?\n return false if @lower_right_row.nil?\n return false if @bottom.nil?\n return false if @lower_right_column.nil?\n return false if @right.nil?\n return false if @width.nil?\n return false if @height.nil?\n return false if @x.nil?\n return false if @y.nil?\n return false if @rotation_angle.nil?\n return false if @html_text.nil?\n return false if @text.nil?\n return false if @alternative_text.nil?\n return false if @text_horizontal_alignment.nil?\n return false if @text_horizontal_overflow.nil?\n return false if @text_orientation_type.nil?\n return false if @text_vertical_alignment.nil?\n return false if @text_vertical_overflow.nil?\n return false if @is_group.nil?\n return false if @is_hidden.nil?\n return false if @is_lock_aspect_ratio.nil?\n return false if @is_locked.nil?\n return false if @is_printable.nil?\n return false if @is_text_wrapped.nil?\n return false if @is_word_art.nil?\n return false if @linked_cell.nil?\n return false if @z_order_position.nil?\n return false if @font.nil?\n return false if @hyperlink.nil?\n return false if @link.nil?\n return true\n end", "def geometry_params\n params.require(:geometry).permit(:room_id, :geometry)\n end", "def create\n @computer_geometry = ComputerGeometry.new(computer_geometry_params)\n\n respond_to do |format|\n if @computer_geometry.save\n format.html { redirect_to @computer_geometry, notice: 'Computer geometry was successfully created.' }\n format.json { render :show, status: :created, location: @computer_geometry }\n else\n format.html { render :new }\n format.json { render json: @computer_geometry.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_geom( geom, max_area_km2: nil, max_observation_count: nil, **other_attrs )\n if geom.is_a?( GeoRuby::SimpleFeatures::Geometry )\n georuby_geom = geom\n geom = RGeo::WKRep::WKBParser.new.parse( georuby_geom.as_wkb ) rescue nil\n end\n\n return unless validate_with_geom( geom, max_area_km2: max_area_km2, max_observation_count: max_observation_count )\n\n build_place_geometry unless place_geometry\n begin\n if place_geometry.update( other_attrs.merge( geom: geom ) )\n update( points_from_geom( geom ).merge( updating_bbox: true ) )\n end\n rescue ActiveRecord::StatementInvalid, ActiveRecord::RecordInvalid => e\n Rails.logger.error \"[ERROR] \\tCouldn't save #{self.place_geometry}: #{e.message[0..200]}\"\n if e.message =~ /TopologyException/\n add_custom_error( :base, e.message[/TopologyException: (.+)/, 1] )\n else\n add_custom_error( :base, \"Boundary did not save: #{e.message[0..200]}\" )\n end\n end\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def test_clear_already_empty\n assert_nothing_raised do \n bbox = Geom::BoundingBox.new\n bbox.clear\n end\n end", "def square?(style_name='original')\n geometry(style_name).square?\n end", "def is_valid?\n raise Exception\n end", "def geo_json_valid?\n geo_data = RGeo::GeoJSON.decode(params.to_json)\n if !geo_data.blank?\n return true\n else\n json_response(nil, :unprocessable_entity, :invalid_geojson_type)\n return false\n end\n end", "def validate!\n [x, y, z].each { |c| return false if c == '' or c.nil? }\n sorted = [x.abs, y.abs, z.abs].sort\n if EXTRA_VALIDATION\n if x.abs >= 100 or y.abs >= 100 or z.abs >= 100\n self.problems << \"Invalid coordinate: at least one dimension >= 100.\"\n end\n if sorted[0] == 0 and sorted[1] == 0\n self.problems << \"At least two dimensions have value == 0; coordinate may not be real.\"\n end\n elsif x.abs >= 100 or y.abs >= 100 or z.abs >= 100 or sorted[0] == 0 and sorted[1] == 0\n return false\n end\n self\n end", "def valid?\n !!recompose rescue false\n end", "def valid?\n !@lat.nil? && !@lon.nil? && @lat.to_f.abs < 90 && @lon.to_f.abs < 90\n end", "def valid?\n raise NotImplementedError\n end", "def geometry_from_file\n file = File.join(Photo::PHOTOS_PATH, version(:original, :relative))\n geometry = begin\n Paperclip.run(\"identify\", %Q[-format \"%wx%h\" \"#{file}\"])\n rescue => err\n logger.info \"No he podido coger las dimensiones de #{self.id}: #{err}\"\n \"\"\n end\n if match = (geometry.match(/\\b(\\d*)x?(\\d*)\\b([\\>\\<\\#\\@\\%^!])?/))\n match.to_a[1,2]\n else\n logger.info \"No he podido coger las dimensiones de #{self.id}: #{geometry}\"\n \"\"\n end\n # parse(geometry) ||\n # raise(NotIdentifiedByImageMagickError.new(\"#{file} is not recognized by the 'identify' command.\"))\n end", "def valid?\n false\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def update\n respond_to do |format|\n if @geometry.update(geometry_params)\n format.html { redirect_to @geometry, notice: 'Geometry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @geometry.errors, status: :unprocessable_entity }\n end\n end\n end", "def _update!\n self.class.repository_or_fail.createPolygon self\n end", "def test_min_edgecases\n point = nil\n assert_nothing_raised do\n bbox = Geom::BoundingBox.new\n bbox.add [0,0,0]\n bbox.add [100,100,100]\n point = bbox.min\n end\n expected_point = Geom::Point3d.new 0,0,0\n assert_equal(expected_point, point,\n 'Failed in test_min_edgecases: positive point' )\n\n assert_nothing_raised do\n bbox = Geom::BoundingBox.new\n bbox.add [-10,-10,-10]\n bbox.add [-100,-100,-100]\n point = bbox.min\n end\n expected_point = Geom::Point3d.new -100,-100,-100\n assert_equal(expected_point, point,\n 'Failed in test_min_edgecases: negative point' )\n \n assert_nothing_raised do\n bbox = Geom::BoundingBox.new\n point = bbox.min\n end\n # Empty boxes should return very large positive numbers\n x_very_small = point.x > 1000000000000000000000000\n y_very_small = point.y > 1000000000000000000000000\n z_very_small = point.z > 1000000000000000000000000\n assert_equal(true, x_very_small,\n 'Failed in test_min_edgecases: empty bb x' )\n assert_equal(true, y_very_small,\n 'Failed in test_min_edgecases: empty bb y' )\n assert_equal(true, z_very_small,\n 'Failed in test_min_edgecases: empty bb z' )\n end", "def valid?\n raise NotImplementedError\n end", "def valid?\n width.present? && height.present?\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end" ]
[ "0.6137213", "0.6025622", "0.5874996", "0.5766039", "0.57558864", "0.56415963", "0.534868", "0.53351253", "0.5247452", "0.5243225", "0.5230586", "0.5191058", "0.5191058", "0.5165842", "0.51457846", "0.5099582", "0.50561446", "0.50388336", "0.50222486", "0.5011283", "0.5011035", "0.49980894", "0.49739832", "0.49739832", "0.49739832", "0.49739832", "0.49739832", "0.49568394", "0.4939755", "0.4927138", "0.4927138", "0.48933592", "0.48226374", "0.4796514", "0.47891545", "0.47873157", "0.4784929", "0.4784086", "0.4784086", "0.4784086", "0.4784086", "0.4784086", "0.47768486", "0.4761029", "0.47549936", "0.47394338", "0.47385216", "0.47347072", "0.4727648", "0.47199205", "0.4710826", "0.47095698", "0.47061872", "0.47061872", "0.47061872", "0.47061872", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.47021577", "0.4696516", "0.46903318", "0.46762154", "0.46684086", "0.4660976", "0.46596894", "0.46596894", "0.46596894", "0.46596894", "0.46596894", "0.46596894", "0.46596894", "0.46596894", "0.46596894", "0.46596894", "0.46596894" ]
0.0
-1
Get an image file object by passing in the filename
def image(filename) if not File.file?(File.join(Rails.root, 'db', 'seed', 'images', filename)) abort("Error: please ensure the file named #{filename} exists") end File.new(File.join(Rails.root, 'db', 'seed', 'images', filename)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image\n MiniMagick::Image.open(filename)\n rescue MiniMagick::Invalid\n # Proceed as if this is not an image\n nil\n end", "def read_image(filename)\n if filename\n image = Magick::Image.read(filename).first\n return image\n end\n end", "def image\n @image ||= MiniMagick::Image.open(source_path)\n end", "def read_file(filename)\n raise \"File not found: #{filename}\" unless File.exist?(filename)\n file = @j_file.new(filename)\n @image = @j_imageio.read(file)\n end", "def image\n assert_file!\n @image ||= ChunkyPNG::Image.from_file(@path)\n end", "def load_image(params)\n if params[:file]\n filnamn = params[:file][:filename].split(\".\")\n filnamn[0] = SecureRandom.hex(10)\n @filename = \"#{filnamn[0]}\" + \".\" + \"#{filnamn[1]}\"\n file = params[:file][:tempfile]\n File.open(\"./public/img/#{@filename}\", 'wb') do |f|\n f.write(file.read)\n end\n else\n @filename = nil\n end\n return @filename\n end", "def open_image id, filename, target_dpi=nil\n m_begin \"open_image\"\n# Read in the file as an imagelist. The new image will be in the first position of the array.\n img = ImageList.new(filename)\n img = img[0]\n put_image(id, img)\n if !target_dpi.nil?\n img = resample id, target_dpi\n end\n m_end \"open_image\"\n end", "def image_file\n return @image_file\n end", "def getImageFromFile(file)\n @device.getImageFromFile(file) ;\n end", "def get_image\n source_file = Item.new(Path.new(params[:source]+\".\"+params[:type]))\n begin\n send_file source_file.path, :filename => source_file.path.basename.to_s, :type => \"image/#{params[:type]}\"\n rescue \n not_found\n end\n end", "def open(image_path)\n File.open(image_path, \"rb\") do |f|\n self.from_blob(f.read, File.extname(image_path))\n end\n end", "def _get_file(name)\n File.read(\"%s/%s\" % [uri, name])\n end", "def fetch_local_image(filename)\r\n filename = ProductImport.settings[:product_image_path] + filename\r\n unless File.exists?(filename) && File.readable?(filename)\r\n log(\"Image #{filename} was not found on the server, so this image was not imported.\", :warn)\r\n return nil\r\n else\r\n return File.open(filename, 'rb')\r\n end\r\n end", "def file(filename)\n check_file! filename\n\n File.new(filename)\n end", "def image_for(filename, auto_colorkey=true, auto_convert=true)\n return nil unless filename\n unless @images.has_key?(filename)\n begin\n fullpath = path_for(filename)\n if fullpath\n img = Rubygame::Surface.load_image(fullpath)\n else\n @logger.fatal(\"Fullpath for #{filename} not found!\")\n exit\n end\n rescue Rubygame::SDLError\n @logger.fatal(\"Error loading '#{filename}': #{$!}\")\n end\n img = img.convert if auto_convert\n @images[filename] = img\n if auto_colorkey\n img.set_colorkey( img.get_at( [0,0] ))\n end\n end\n return @images[filename]\n end", "def file\n FileFactory.new(self)\n end", "def create_image(filename)\n fixture = file_fixture(filename)\n Image.create(filename: filename,\n size: fixture.size,\n mime_type: MimeMagic.by_path(fixture),\n data: fixture.read)\n end", "def load_image_from_file_data(filename, file_data, image_class)\n bitmap_data = file_data.read_data(filename.downcase)\n bitmap = image_class.new(bitmap_data, true) if bitmap_data\n bitmap\n end", "def file( name )\n\t\t\t\tKesh::ArgTest::type( \"name\", name, String )\n\t\t\t\tKesh::ArgTest::stringLength( \"name\", name, 1 )\t\t\t\n\t\t\t\treturn Kesh::Loader::FileInfo.new( self, name )\n\t\t\tend", "def image( name )\n @images[name]\n end", "def file_by_url(url)\n return file_by_id(url_to_id(url))\n end", "def fetch_remote_image(filename)\r\n begin\r\n io = open(URI.parse(filename))\r\n def io.original_filename; base_uri.path.split('/').last; end\r\n return io\r\n rescue OpenURI::HTTPError => error\r\n log(\"Image #{filename} retrival returned #{error.message}, so this image was not imported\")\r\n rescue => error\r\n log(\"Image #{filename} could not be downloaded, so was not imported. #{error.message}\")\r\n end\r\n end", "def source_image(basename, ext)\n @source_image ||= SourceImageStub.new(base_name: basename,\n name: File.join(TEST_DIR, 'image_files', \"#{basename}.#{ext}\"),\n missing: false,\n digest: 'r' * 6,\n ext: ext)\n end", "def get_file(path)\n return File.new(path)\n end", "def reference_image(filename)\n\tpath = \"features/reference/#{iOSVersion}/#{device_str}/#{filename}\"\n\timg = Magick::Image::read(path).first\nend", "def load_image(path)\n end", "def image_from_url\n io = open(URI.parse(image_url))\n def io.original_filename; base_uri.path.split('/').last; end\n self.image = io.original_filename.blank? ? nil : io\n rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...) \n end", "def fetch_image_from_local_disk(file)\n image = Spotlight::FeaturedImage.new\n image.image.store!(File.open(file))\n image\n end", "def file(filename)\n File.stat(filename)\n raise(TypeError, \"filename must not be nil\") if filename.nil?\n FFI::Libmagic.magic_file(_cookie, filename)\n end", "def file(name)\n return CottaFile.new(factory, @path.join(name))\n end", "def open_photo(name)\n File.open(Rails.root.join(\"db\", \"restaurant-images\", name))\nend", "def file\n @file ||= Operations::FileFactory.new(self)\n end", "def load_image\n Magick::Image.from_blob(data).first\n end", "def image\n Pathname.new(\"#{PATH}#{self.path}\").open{|file|\n return Base64.strict_encode64(file.read)\n }\n end", "def to_image(version=nil)\n img = if file.kind_of?(CarrierWave::SanitizedFile)\n # puts \"using storage file\"\n Magick::Image.read(current_path)\n else\n # fog file?\n p = model.send(\"#{mounted_as}_url\", version)\n puts \"p= #{p}\"\n #puts \"#{model.class.name}[#{model.id}] for #{mounted_as} version=>#{version} #{p}\"\n #puts \"#{model.class.name}[#{model.id}] for #{mounted_as} version=>#{version} #{p}\"\n raise \"#{model.class.name} for #{mounted_as} using amazon file#{p}\" if p.blank?\n Magick::Image.read(p)\n end\n img.first\n end", "def getFile(file)\n return fileByName.fetch(file, nil)\n end", "def get_file(filename, options={})\n end", "def load(file)\r\n begin\r\n @image = Image.read(file).first\r\n rescue => error\r\n puts \"File #{file} doesn't exists. Using random image.\"\r\n initRandomData\r\n end\r\n end", "def get_image(image_id)\n return @rm.get(image_id)\n end", "def uploaded_file(filename, content_type = \"image/png\")\n t = Tempfile.new(filename)\n t.binmode\n path = File.join(RAILS_ROOT, \"spec\", \"images\", filename)\n FileUtils.copy_file(path, t.path)\n (class << t; self; end).class_eval do\n alias local_path path\n define_method(:original_filename) {filename}\n define_method(:content_type) {content_type}\n end\n return t\n end", "def file_name\n \"images/#{@name}.msf\"\n end", "def image\n TmdbImage.new(@imdb_id.gsub(/^tt/, ''), @api_key, @logger, @filespec) rescue nil\n end", "def decode_image(f)\r\n base = File.basename f\r\n base = base.split('.')\r\n return base[0], base[1]\r\n end", "def read_image(image_name)\n tempfile = Tempfile.new(image_name)\n tempfile.write @docx_archive.get_input_stream(\"word/media/#{image_name}\").read\n tempfile.close\n tempfile\n end", "def gv_make_image(name=nil)\n return unless gv_object\n name = gv_object.name unless name\n file = \"#{name}.png\"\n gv_object.output(:png => file)\n file\n end", "def get_image(file, max_width, max_height)\n max_width_pixels = max_width * 300\n max_height_pixels = max_height * 300\n magick = MiniMagick::Image.read(file.download)\n magick.auto_orient\n magick.resize(\"#{max_width_pixels}x#{max_height_pixels}\") if magick.height > max_height_pixels || magick.width > max_width_pixels\n temp_path = \"#{Dir.tmpdir}/#{SecureRandom.alphanumeric(50)}\"\n magick.write(temp_path)\n return { path: temp_path, height: magick.height / 300.0, width: magick.width / 300.0 }\n end", "def load_image(image)\n @image = Magick::Image.read(image).first\n end", "def image(id, nsfw = false)\n img = get url: \"images/#{id}\", nsfw: nsfw\n img['image'] if img\n end", "def file_get fnum\n\t\tds = Sdb[:file_info].filter(:fnum => fnum)\n\t\tunless ds.empty?\n\t\t\tsend_file Spath[:upload_dir] + ds.get(:path).to_s, :type => ds.get(:type).split('/').last.to_sym\n\t\telse\n\t\t\tmodule_name = \"view\"\n\t\t\tpath = \"#{Smods[module_name]}#{Spath[:assets]}images/default.jpg\"\n\t\t\tsend_file path, :type => :jpeg\n\t\tend\n\tend", "def picture(filename, _hue = 0)\n load_image(@picture_cache, filename, Pictures_Path, @picture_data)\n end", "def image\n @image ||= ImageDrop.new(:page => page, :context => @context)\n @image if @image.path\n end", "def set_image_file\n @image_file = ImageFile.find(params[:id])\n end", "def set_image_file\n @image_file = ImageFile.find(params[:id])\n end", "def file\n @file ||= (file_from_path || file_from_uploaded_file!)\n end", "def imageName()\n if (@imageName.nil?)\n if (File.exists?(IMAGE_NAME_FILE))\n File.open(IMAGE_NAME_FILE) { |f|\n @imageName = f.read.chomp\n }\n else\n @imageName = 'unknown'\n MObject.warn(\"Can't find '#{IMAGE_NAME_FILE}'\")\n end\n end\n @imageName\n end", "def set_image_file\n @image_file = ImageFile.find_by_id(params[:id])\n end", "def get_image(id)\n OpenStack::Compute::Image.new(self,id)\n end", "def get_image(id)\n OpenStack::Compute::Image.new(self,id)\n end", "def get_image(id)\n OpenStack::Compute::Image.new(self,id)\n end", "def picture_from_url(url) \n self.photo = open(url) \n end", "def image\n @image ||= Image.find(params[:id])\n end", "def get_file\n\t\t{\n\t\t\tfile_name: File.basename(file.path.to_s),\n\t\t\turl: file.url\n\t\t}\n\tend", "def getimage\n @trek = Trek.find params[:id]\n if @trek == nil\n redirect_to treks_path, :alert => \"Trek not found.\"\n end\n filename = params[:name] + \".\" + params[:format]\n send_file @trek.get_img_path(filename),\n :type => \"image/jpeg\",\n :disposition => \"inline\"\n end", "def file(key)\n ivar_cache(\"file_#{key}\") do\n Mack::Request::UploadedFile.new(params(key))\n end\n end", "def file(fname)\n @file_list[fname]\n end", "def fetch name,params=nil\n\n fetch_original = !params || !params[:width] && !params[:height]\n use_not_found = (self.use_not_found ||\n params && !params[:not_found].nil?)\n nf_image = (params && params.has_key?(:not_found) ?\n params[:not_found] : self.not_found_image)\n\n if name.nil?\n return nil unless use_not_found\n name = nf_image\n end\n\n o = absolute(name) # Original\n\n # Fetch original image:\n\n if fetch_original\n if params && params[:absolute]\n return o if File.exists?(o)\n return absolute(nf_image) if use_not_found && !nf_image.nil?\n return nil\n else\n return resolve(name) if File.exists?(o)\n return resolve(nf_image) if use_not_found && !nf_image.nil?\n return nil\n end\n end\n \n # Fetch sized image:\n\n s = absolute(name,params)\n\n if File.exists?(o) # original exists\n\n if File.exists?(s)\n create_size(o,s,params) if params[:resize]==true\n return s if params[:absolute]\n return resolve(name,params)\n\n else # sized image doesn't exist\n if params[:resize]==false\n if use_not_found\n return nil if nf_image.nil?\n n = absolute(nf_image)\n ns = absolute(nf_image,params)\n create_size(n,ns,params.merge(:not_found => true))\n # This may return nil if 'a' doesn't exist.\n # Regardless, we return the location.\n return ns if params[:absolute]\n return resolve(nf_image,params)\n else\n return nil\n end\n end\n # Generate sized image:\n create_size(o,s,params.merge(:autogenerated => true))\n return s if params[:absolute]\n return resolve(name,params)\n end\n\n\n else # original doesn't exist\n if use_not_found\n return nil if nf_image.nil?\n n = absolute(nf_image)\n ns = absolute(nf_image,params)\n create_size(n,ns,params.merge(:not_found => true))\n # This may return nil if 'a' doesn't exist.\n # Regardless, we return the location.\n return ns if params[:absolute]\n return resolve(nf_image,params)\n else\n return nil\n end\n end\n\n\n\n end", "def image_creation(image_name)\n image_path = Rails.root.join('public', 'images', image_name).to_s\n uploader = Dragonfly[:images]\n uploaded_image = uploader.fetch_file(image_path)\n image = Image.create image: uploaded_image\n\n rescue Error => e\n print \"Error creating image: \" + e\nend", "def file(key)\n ivar_cache(\"file_#{key}\") do\n Mack::Request::UploadedFile.new(params[key] ||= {})\n end\n end", "def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end", "def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end", "def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end", "def file(name, version = 'master')\n @file_class.new(self).find(name, version)\n end", "def image\n images.first\n end", "def retrieve!(identifier)\n File.new(uploader, self, uploader.store_path(identifier))\n end", "def path_to_image(source, options = T.unsafe(nil)); end", "def thumb\n filename = params[:filename]\n @photo = @album.photos.find(:first, :conditions => [ \"image_file_name = ?\", filename ], :order => 'created_at DESC')\n end", "def get_image(id)\n CloudServers::Image.new(self,id)\n end", "def thumbnail_file(attribute)\n doc = scribd_document_for(attribute)\n\n if doc && doc.thumbnail_url\n open(doc.thumbnail_url).read\n else\n send(attribute).to_file(:thumb).open { |f| f.read }\n end\n rescue Errno::ENOENT, NoMethodError # file not found or nil thumb file\n nil\n end", "def get_file(id)\n id = self.to_id(id)\n self.grid.get(id).read\n end", "def get_filename(name)\n $file = \"images/\" << Time.now.strftime('%Y-%m-%d-%H-%M-%S-') << \"#{name}.jpg\"\nend", "def image(name)\n File.expand_path(\"tex/#{name}\", File.dirname(__FILE__))\nend", "def image_jpg\r\n directory = File.expand_path File.dirname(__FILE__)\r\n specific_filename = directory + \"/\" + \"Media/1.jpg\"\r\nend", "def img\n Magick::Image::read(self.image).first\n end", "def image_path\n \"#{PATH}/#{image_filename}\"\n end", "def selectFile filepath, user, group\n path = \"#{user}/#{group}/#{filepath}\"\n file = Modeles::File.find_by_path path\n FileInfos.new file if file\n end", "def image\n @path\n end", "def file(id)\n Box::File.new(@api, nil, :id => id)\n end", "def get_file(file_id)\n raise ArgumentError, \"Only one file id allowed for this method\" if file_id.is_a?(Array)\n get_files(file_id).first\n end", "def file\n files.first\n end", "def file\n files.first\n end", "def image_file=(value)\n @image_file = value\n end", "def image(image_id)\n images(:image_ids => [image_id])[0]\n end", "def pbBitmap(name)\n begin\n dir = name.split(\"/\")[0...-1].join(\"/\") + \"/\"\n file = name.split(\"/\")[-1]\n bmp = RPG::Cache.load_bitmap(dir, file)\n bmp.storedPath = name\n rescue\n Env.log.warn(\"Image located at '#{name}' was not found!\")\n bmp = Bitmap.new(2,2)\n end\n return bmp\nend", "def file\n f = nil\n if self.asset_clone_id.present?\n x = self.asset_clone\n f = x.asset if x.present?\n else\n f = self.asset\n end\n return f\n end", "def load_image(path)\n begin\n return Gosu::Image.new(path)\n rescue\n return Gosu::Image.new(\"images/error.png\") rescue nil\n end\nend", "def file(*args)\n if args.empty?\n return @file\n else\n @file = args[0]\n return self\n end\n end", "def file\n project.objects[fileRef]\n end", "def get_single_image(file,new_image_base_name)\r\n File.basename(file).split('.').first =~ /#{new_image_base_name}[a-z][a-z][a-z]/\r\n end", "def image_url\n self.filename.url \n end", "def filename\n return Pathname.new(file_object.io.path) if file_object.io.respond_to?(:path) && File.exist?(file_object.io.path)\n end" ]
[ "0.717793", "0.71555066", "0.6728952", "0.66683", "0.6604901", "0.65894127", "0.65659946", "0.65235114", "0.650377", "0.64938456", "0.6469755", "0.64651465", "0.64166987", "0.63764024", "0.6373741", "0.63514626", "0.63309115", "0.62961555", "0.62886626", "0.62775785", "0.62548953", "0.6202515", "0.61969674", "0.61849976", "0.6184615", "0.61836135", "0.6177781", "0.61575836", "0.61145526", "0.60970324", "0.60600483", "0.604555", "0.6032344", "0.6027296", "0.6023647", "0.60112315", "0.60051644", "0.5943061", "0.5923942", "0.59215486", "0.5921047", "0.59193146", "0.5916007", "0.58904964", "0.5884907", "0.58841586", "0.58825177", "0.5881114", "0.5877009", "0.58755046", "0.5872183", "0.58712256", "0.58712256", "0.5870193", "0.5862298", "0.585713", "0.5846938", "0.5846938", "0.5836015", "0.58117026", "0.58098596", "0.58028966", "0.5798361", "0.57936835", "0.57903934", "0.5774497", "0.57720315", "0.5767961", "0.5754976", "0.5754976", "0.5754976", "0.57337314", "0.5725352", "0.5717003", "0.57169986", "0.5712954", "0.5707774", "0.57043505", "0.57023954", "0.57011545", "0.5689512", "0.56589955", "0.56473625", "0.56464463", "0.5644994", "0.5643749", "0.56407994", "0.5631149", "0.5628365", "0.5628365", "0.5626858", "0.5624449", "0.56195617", "0.56182194", "0.56157595", "0.5611895", "0.5603337", "0.55981207", "0.55978173", "0.559778" ]
0.6076532
30
Seed an image by passing its file name, imageable type (e.g. Banner, Product) and imageable id (the id of the object being the image belongs to)
def seed_image(filename, imageable_type, imageable_id) Picture.create!( :id => $image_id, :image => image(filename), :imageable_type => imageable_type, :imageable_id => imageable_id ) $image_id += 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_image(title, description, parent_id, mime_type, file_name)\n\t insert_file(title, description, parent_id, 'application/vnd.google-apps.photo', file_name)\n\tend", "def create_image(image)\n self.images.create(image: image) if image.present?\n end", "def image(filename)\n if not File.file?(File.join(Rails.root, 'db', 'seed', 'images', filename))\n abort(\"Error: please ensure the file named #{filename} exists\")\n end\n\n File.new(File.join(Rails.root, 'db', 'seed', 'images', filename))\nend", "def create_image(name, options = {})\n ImageCollection.new(:config => config).\n create(options.merge(:instance_id => id,\n :name => name))\n end", "def create_image(filename)\n fixture = file_fixture(filename)\n Image.create(filename: filename,\n size: fixture.size,\n mime_type: MimeMagic.by_path(fixture),\n data: fixture.read)\n end", "def load_imageable\n klass = [Entree, Review].detect { |c| params[\"#{c.name.underscore}_id\"] }\n @imageable = klass.find(params[\"#{klass.name.underscore}_id\"])\n end", "def set_id\n @image = Image.find(params[:id])\n end", "def set_generated_image\n @generated_image = GeneratedImage.find(params[:id])\n end", "def create_image(title, description, parent_id, mime_type, file_name)\n\t insert_file(title, description, parent_id, 'application/vnd.google-apps.video', file_name)\n\tend", "def set_image\n @image = Image.find(params[:id]).decorate\n end", "def create_image(klass, attachment_path, viewable_record = nil, options = {})\n \n has_attached_file = options[:has_attached_file_name] || :attachment\n \n alt = if(options[:alt])\n options[:alt]\n else\n (viewable_record and viewable_record.respond_to? :name) ? viewable_record.name : \"\"\n end\n \n position = (viewable_record and viewable_record.respond_to?(:images)) ? viewable_record.images.length : 0\n \n file = get_file(attachment_path)\n\n begin\n \n image = klass.new( \n {has_attached_file.to_sym => file, :viewable => viewable_record, :alt => alt, :position => position},\n :without_protection => true\n ) \n \n #image.attachment.reprocess! not sure this is required anymore\n \n puts image.save ? \"Success: Created Image: #{image.id} : #{image.attachment_file_name}\" : \"ERROR : Problem saving to DB Image: #{image.inspect}\"\n rescue => e\n puts \"PaperClip error - Problem creating an Image from : #{attachment_path}\"\n puts e.inspect, e.backtrace\n end\n end", "def create_images(product)\n self.image_labels.each_with_index do |label, position|\n\n self.image_file_extensions.each do |extension|\n file_name = self.image_path + value('image') + '_' + label + extension\n next unless File.exist?(file_name)\n\n types = []\n\n unless self.image_types[position].nil?\n types = product_attribute_set.asset_types.where(code: self.image_types[position].split(',').map(&:strip))\n end\n\n image = Asset.new\n image.product = product\n image.store = self.store\n image.position = position\n image.label = label\n image.set_file(File.open(file_name))\n\n types.each do |type|\n image.asset_types << type\n end\n\n # save without sync to format with paperclip\n image.sync_needed = false\n image.save\n\n # save with sync to push to magento\n image.sync_needed = true\n image.save\n end\n end\n end", "def test_should_associate_images\n a_product = items(:lightsaber)\n assert_equal a_product.images.count, 3\n\n lightsabers_image = substruct_fixture_file(\"lightsabers.jpg\")\n\n an_image = Image.new\n an_image.upload = lightsabers_image\n assert an_image.save\n \n a_product.images << an_image\n assert_equal a_product.images.count, 4\n \n # We must erase the record and its files by hand, just calling destroy.\n assert an_image.destroy\n end", "def create_weapons \n weapon = Weapon.create(name: 'Steel Sword', damage: 8, cost: 0, :merchant_id => self.id)\n # weapon.picture.attach(io: File.open('app/assets/images/weapons/steel sword.PNG'),\n # filename: 'steel sword.PNG')\n\n weapon1 = Weapon.create(name: 'Orcish Sword', damage: 15, cost: 15, :merchant_id => self.id )\n # weapon1.picture.attach(io: File.open('app/assets/images/weapons/orcish sword.PNG'),\n # filename: 'orcish sword.PNG')\n\n weapon2 = Weapon.create(name: 'Dawnbreaker', damage: 25, cost: 30, :merchant_id => self.id )\n # weapon2.picture.attach(io: File.open('app/assets/images/weapons/dawnbreaker.PNG'),\n # filename: 'dawnbreaker.PNG')\n end", "def create\n @image = Image.create(image_params)\n @image.save\n\n end", "def create_image_with_local(name, type, container_uuid, path)\n @logger.debug(\"Creating image from file path #{path}\")\n container_id = JSON.parse(\n @client.get('v2.0', \"storage_containers/#{container_uuid}\")\n )['id'].split('::').last\n @logger.debug(\"Container ID is #{container_id}\")\n spec = { name: name, image_type: type, annotation: name }\n @logger.debug(\"Image creation specs => #{spec}\")\n task = JSON.parse(@client.post('v2.0', 'images', spec.to_json))\n task_uuid = task['task_uuid']\n image_uuid = TaskManager.wait_on_task(task_uuid, @client, @logger)\n task = JSON.parse(\n @client.put('v0.8', \"images/#{image_uuid}/upload\",\n File.open(path), nil,\n { 'X-Nutanix-Destination-Container' => container_id })\n )\n task_uuid = task['task_uuid']\n # Timeout is set to 60 minutes as image upload may take time\n TaskManager.wait_on_task(task_uuid, @client, @logger, 60 * 60)\n image_uuid\n rescue => e\n raise e\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def create options = {}\n resp = case\n when options[:instance_id]\n client.create_image(options)\n when options[:image_location] || options[:root_device_name]\n if kernel = options.delete(:kernel)\n options[:kernel_id] = kernel.id\n end\n if ramdisk = options.delete(:ramdisk)\n options[:ramdisk_id] = ramdisk.id\n end\n options[:block_device_mappings] =\n translate_block_device_mappings(options[:block_device_mappings]) if\n options[:block_device_mappings]\n client.register_image(options)\n else\n raise(ArgumentError,\n \"expected instance_id, image_location, \" +\n \"or root_device_name\")\n end\n Image.new(resp.image_id, :config => config)\n end", "def image_creation(image_name)\n image_path = Rails.root.join('public', 'images', image_name).to_s\n uploader = Dragonfly[:images]\n uploaded_image = uploader.fetch_file(image_path)\n image = Image.create image: uploaded_image\n\n rescue Error => e\n print \"Error creating image: \" + e\nend", "def set_image_file\n @image_file = ImageFile.find_by_id(params[:id])\n end", "def create\n @image = Image.new(name: image_params[\"name\"], picture: image_params[\"picture\"], image_file_name:image_params[\"image_file_name\"], user_id: current_user.id)\n if @image.save\n redirect_to images_path\n else\n render 'new'\n end\n end", "def create_nested_image\n issue_image = Image.create!(image_params)\n issue_image.imageable = @issue\n end", "def set_animal_image\n @animal_image = AnimalImage.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def set_image\r\n @image = Image.find(params[:id])\r\n end", "def set_image_file\n @image_file = ImageFile.find(params[:id])\n end", "def set_image_file\n @image_file = ImageFile.find(params[:id])\n end", "def image_for(id, size=:source)\n image_tag \"https://spoonacular.com/recipeImages/#{id}-#{IMAGE_SIZES[size]}\"\n end", "def set_Image\n @image = Image.find(params[:id])\n end", "def test_should_create_image\n lightsabers_image = substruct_fixture_file(\"lightsabers.jpg\")\n\n an_image = Image.new\n an_image.upload = lightsabers_image\n assert an_image.save\n \n # We must erase the record and its files by hand, just calling destroy.\n assert an_image.destroy\n end", "def set_image\n @image = Image.find(params[:id])\n end", "def test_should_associate_images\n a_product = items(:lightsaber)\n assert_equal a_product.images.count, 3\n\n lightsabers_image = fixture_file_upload(\"/files/lightsabers.jpg\", 'image/jpeg')\n\n an_image = Image.new\n an_image.uploaded_data = lightsabers_image\n assert an_image.save\n \n a_product.images << an_image\n assert_equal a_product.images.count, 4\n \n # We must erase the record and its files by hand, just calling destroy.\n assert an_image.destroy\n end", "def test_should_associate_images\n a_product = items(:lightsaber)\n assert_equal a_product.images.count, 3\n\n lightsabers_image = fixture_file_upload(\"/files/lightsabers.jpg\", 'image/jpeg')\n\n an_image = Image.new\n an_image.uploaded_data = lightsabers_image\n assert an_image.save\n \n a_product.images << an_image\n assert_equal a_product.images.count, 4\n \n # We must erase the record and its files by hand, just calling destroy.\n assert an_image.destroy\n end", "def create_image_object\n user = get_session_user!\n image_args = params[:image]\n\n original_name = image_args[:original_name].to_s\n original_name = \"\" if user && user.keep_filenames == :toss\n\n img_when = Date.new(image_args[:when][(\"1i\")].to_i,\n image_args[:when][(\"2i\")].to_i,\n image_args[:when][(\"3i\")].to_i)\n\n errors = []\n begin\n # TODO: handle invalid date\n image = Image.new(\n created_at: Time.now,\n user: user,\n when: img_when,\n license_id: image_args[:license].to_i,\n notes: image_args[:notes],\n copyright_holder: image_args[:copyright_holder],\n original_name: original_name\n )\n\n if image_args[:url].blank?\n image.image = image_args[:upload]\n else\n image.upload_from_url(image_args[:url])\n end\n\n if !image.save || !image.process_image\n errors += image.formatted_errors\n end\n rescue => e\n errors << e.to_s\n end\n\n if errors.any?\n name = original_name\n name = \"##{image.id}\" if name.empty?\n errors.unshift(:runtime_no_upload_image.t(name: name))\n logger.error(\"UPLOAD_FAILED: #{errors.inspect}\")\n render(text: errors.join(\"\\n\").strip_html, status: 500, layout: false)\n else\n name = original_name\n name = \"##{image.id}\" if name.empty?\n flash_notice(:runtime_image_uploaded.t(name: name))\n render(json: image)\n end\n ensure\n image.try(&:clean_up)\n end", "def create\n @image = Image.new(params[:image])\n\t\t\n\t\tif (params[:image][:filename])\n \t#function in manage_images.rb\n \tprocess_image(tmp = params[:image][:filename].tempfile)\n\t\tend\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render json: @image, status: :created, location: @image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def image_params\n params.require(:image).permit(:url, :imageable_id, :imageable_type, :title, :description)\n end", "def set_img\n @img = Img.find(params[:id])\n end", "def create_image_object\n @user = session_user!\n args = params[:image]\n image = create_and_upload_image(args)\n render_image(image, args)\n rescue StandardError => e\n render_errors(e.to_s, args)\n end", "def create\r\n @image = Image.new(image_params)\r\n if params[:family_id] \r\n @image.family = Family.find(params[:family_id]) \r\n elsif params[:member_id]\r\n @image.member = Member.find(params[:member_id])\r\n puts('*'*50)\r\n puts('*'*50)\r\n puts(params)\r\n puts('*'*50)\r\n puts('*'*50)\r\n elsif params[:event_id]\r\n @image.event = Event.find(params[:event_id])\r\n end\r\n @image.generate_filename\r\n @uploaded_io = params[:image][:uploaded_file]\r\n\r\n File.open(Rails.root.join('public', 'images', @image.filename), 'wb') do |file|\r\n file.write(@uploaded_io.read)\r\n end\r\n respond_to do |format|\r\n if @image.save\r\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\r\n format.json { render :show, status: :created, location: @image }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @image.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create_images\n problem_image = self.images.build\n File.open('./public/projects/problem_default.jpg') do |f|\n problem_image.image = f\n end\n\n solution_image = self.images.build\n File.open('./public/projects/solution_default.jpg') do |f|\n solution_image.image = f\n end\n\n team_image = self.images.build\n File.open('./public/projects/team_default.png') do |f|\n team_image.image = f\n end\n end", "def create_listing_image(params)\n image = self.listing_images.create!(params)\n image.update_attributes(publicly_visible: false, category: 'home', caption: '')\n\n image\n end", "def create_image(instance_id, create_opts={})\n create_resource :image, { :instance_id => instance_id }.merge(create_opts)\n end", "def create_image(instance_id, create_opts={})\n create_resource :image, { :instance_id => instance_id }.merge(create_opts)\n end", "def seed_file_fixture(file_path)\n content_type = \"image/#{File.extname(file_path).sub('.', '')}\"\n fixture_file_upload(Rails.root.join(\"db/seeds/files/#{file_path}\"), content_type)\n end", "def upload_image!(filename)\n client.post_image(\"categories/#{id}/image\", filename)\n end", "def create_temp_with_image\n image, filename, content_type = create_image\n temp = TempImage.new\n temp.transaction do\n temp.image.attach(io: image, filename: filename, content_type: content_type) if temp.save\n end\n temp\n end", "def set_image_to_sample\n @image_to_sample = ImageToSample.find(params[:id])\n end", "def create_user\n user = User.new(\n first_name: Faker::Name.first_name,\n last_name: Faker::Name.last_name,\n email: Faker::Internet.unique.email,\n password: 'secret',\n description: \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\",\n birthday: rand(52.years.ago .. 20.years.ago)\n )\n file = URI.open(\"https://source.unsplash.com/featured/?portrait\")\n user.photo.attach(io: file, filename: \"#{user.first_name}_#{user.last_name}.png\", content_type: 'image/png')\n user.save\n return user\nend", "def update_db_record\n img_file = file.to_file\n img = ::Magick::Image::read(img_file).first\n model.height = img.rows\n model.width = img.columns\n \n new_filename = model.imageable.filename( file.extension )\n new_file = file.copy_to(type_dir + new_filename)\n model.url = access_dir + new_filename\n model.save\n end", "def save_image_types type_of_image, job_image\n @image_type = ImageType.new\n @image_type.image_type = type_of_image\n @image_type.images_for_job_id = job_image.id\n @image_type.image_page_number = job_image.image_number\n @image_type.save\n end" ]
[ "0.67103827", "0.6587216", "0.64055264", "0.634066", "0.6290271", "0.62429047", "0.6206341", "0.6201628", "0.6168619", "0.6123131", "0.61099833", "0.609694", "0.6067298", "0.60596555", "0.60488516", "0.6036508", "0.6034444", "0.6034444", "0.6034444", "0.6034444", "0.6034444", "0.6034444", "0.6034444", "0.6034444", "0.6034444", "0.6034444", "0.6034444", "0.6034444", "0.60295445", "0.6028623", "0.601413", "0.60064995", "0.6006476", "0.60064566", "0.60027206", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.6002267", "0.600207", "0.5992813", "0.598056", "0.5976695", "0.5976695", "0.59640837", "0.59617215", "0.59440374", "0.5907929", "0.59076875", "0.59076875", "0.5898532", "0.5887616", "0.5886004", "0.5874074", "0.58603364", "0.5849488", "0.58411545", "0.5839064", "0.58292854", "0.58292854", "0.5826527", "0.58178675", "0.58147", "0.5799644", "0.57965314", "0.57792187", "0.5773013" ]
0.83658993
0
recipient (string) sms recipient in general format; e.g. '+886912345678' message (string) message content options (hash) optional config options.ignore_cert (boolean) Ignore SSL certificate or not options.insecure (boolean) Use plain HTTP or HTTPS options.mode (string) delivery mode 'bit' instant delivery (default) 'bulk' bulk delivery
def deliver(recipient, message, options={}) protocol = options[:insecure] ? "http" : "https" uri = URI.parse "#{protocol}://#{API_HOST}" uri.path = case (options[:mode].to_sym rescue nil) when nil, :bit SMS_ENDPOINT when :bulk BULK_SMS_ENDPOINT else raise StandardError.new "Bad delivering mode!" end uri.query = URI.encode_www_form({ username: @username, password: @password, dstaddr: recipient, smbody: Iconv.new("big5", "utf-8").iconv(message), dlvtime: (options[:dlvtime] rescue 0), vldtime: (options[:vldtime] rescue nil), response: (options[:response] rescue nil) }) response = Net::HTTP.start(uri.host, use_ssl: uri.scheme == 'https') do |http| http.verify_mode = OpenSSL::SSL::VERIFY_NONE if options[:ignore_cert] req = Net::HTTP::Get.new uri http.request(req) end parse_response(response.body)["kmsgid"].to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deliver_sms(params)\n#puts \"**** Message#deliver_sms; params=#{params}\"\n sms_gateway = params[:sms_gateway]\n phone_number_array = @contact_info.map {|c| c[:phone]}.compact.uniq\n phone_numbers = phone_number_array.join(',')\n assemble_sms()\n#puts \"**** sms_gateway.deliver #{sms_gateway} w #{phone_numbers}: #{sms_only}\"\n #******* CONNECT TO GATEWAY AND DELIVER MESSAGES \n gateway_reply = \n sms_gateway.deliver(phone_numbers, sms_only)\n#puts \"**** gateway_reply=#{gateway_reply}\"\n #******* PROCESS GATEWAY REPLY (INITIAL STATUSES OF SENT MESSAGES) \n gtw_msg_id = nil\n if phone_number_array.size == 1\n # SINGLE PHONE NUMBER \n if gateway_reply =~ /ID: (\\w+)/\n gtw_msg_id = $1\n gtw_msg_id = gateway_reply[4..99] # Temporary workaround as $1 doesn't work on Heroku\n msg_status = MessagesHelper::MsgSentToGateway\n else\n gtw_msg_id = gateway_reply # Will include error message\n msg_status = MessagesHelper::MsgError\n end\n # Mark the message to this member as being sent\n self.sent_messages[0].update_attributes(:gateway_message_id => gtw_msg_id, \n :msg_status => msg_status)\n else\n # MULTIPLE PHONE NUMBERS\n # Get the Clickatell reply and parse into array of hash like {:id=>'asebi9xxke...', :phone => '2345552228372'}\n#puts \"**** gateway_reply=#{gateway_reply}\"\n msg_statuses = gateway_reply.split(\"\\n\").map do |s|\n if s =~ /ID:\\s+(\\w+)\\s+To:\\s+([0-9]+)/\n {:id => $1, :phone => $2} \n else\n {:id => nil, :phone => nil, :error => s}\n end\n end\n # Make array to associate members with their numbers\n @member_phones = self.members.map {|m| {:phone => m.primary_phone, :member => m} }\n # Update the sent_message records to indicate which have been accepted at Gateway \n msg_statuses.each do |s|\n#puts \"**** s[:id]=#{s[:id]}, s[:phone]=#{s[:phone]}\"\n if s[:id] && s[:phone]\n # Find the right member by matching phone numbers\n member = @member_phones.find{|m| m[:phone]==s[:phone]}[:member]\n # Find the right sent_message by matching member & message\n sent_message = SentMessage.where(:member_id=>member.id, :message_id=>self.id).first\n # Update the sent_message\n sent_message.update_attributes(\n :gateway_message_id => s[:id], \n :msg_status=> MessagesHelper::MsgSentToGateway\n )\n end\n end\n # Any sent_messages not now marked with gateway_message_id and msg_status must have errors\n sent_messages.each do |m| \n m.update_attributes(:msg_status=> MessagesHelper::MsgError) if m.msg_status.nil?\n end\n end\n end", "def deliver(message, _options = {})\n raise ArgumentError, \"too many recipients, max. is #{MAX_RECIPIENT}\" if message.to.length > MAX_RECIPIENT\n\n # perform request\n @obh_client.send_sms(post_params(message))\n message.to\n end", "def recipient; end", "def deliver(message, options = {})\n options = options.reverse_merge default_options\n to = recipient.respond_to?(:call) ? recipient.call(message) : recipient\n message.body message.body.encode(options[:charset]) if options[:charset].presence\n ActionMailerSMSMailer.forward_sms(to, message, options.compact).deliver_now\n message.to\n end", "def send(txt, to, options = {})\n options.default = nil\n api_request(\"sendSms.php\", {\n txt: txt,\n to: to,\n idGroup: options[:idGroup],\n source: options[:source],\n flash: options[:flash],\n dateTimeSend: options[:dateTimeSend],\n onlydelivery: options[:onlydelivery],\n use_alfasource: options[:use_alfasource],\n discountID: options[:discountID],\n channel: options[:channel]\n })\n end", "def deliver(numbers=@numbers, body=@body, message_id=nil, log=nil)\n # NB: message#deliver_sms currently sends numbers as a string, not an array.\n#puts \"**** Delivering Twilio with @background=#{@background}, numbers=#{numbers}\"\n if numbers.is_a? String\n @numbers = numbers.gsub(\"+\",\"\").split(/,\\s*/) # Convert to array so we can do \"each\"\n else\n @numbers = numbers\n end\n @body = body # ...\n raise('No phone numbers given') unless @numbers\n raise('No message body') unless @body\n # Use delivery system based on the parameter @background [i.e. background processing type]\n case @background\n when /iron/i\n @numbers.count > 1 ? deliver_ironworker : deliver_direct(message_id)\n when /dj|delay.*job/i\n @numbers.count > 1 ? deliver_delayed_job(message_id) : deliver_direct(message_id)\n else\n deliver_direct(message_id)\n end\n AppLog.create(:code => \"SMS.deliver.#{@gateway_name}\", :description=>\"background=#{@background || 'none'}, count = #{@numbers.count} messages\")\n super\n end", "def deliver_message_via_carrier(text, to, from)\n SMS_CARRIER.deliver_message(text, to, from)\nend", "def recipient_contact\n @recipient_contact ||= SimpleShipping::Contact.new(\n :person_name => \"John Recipient Smith\",\n :phone_number => \"1234567890\"\n )\n end", "def recipient=(value)\n @recipient = value\n end", "def security_notification(user, sender, options={})\n @sender = sender\n redmine_headers 'Sender' => sender.login\n @message =\n l(options[:message],\n field: (options[:field] && l(options[:field])),\n value: options[:value])\n @title = options[:title] && l(options[:title])\n @remote_ip = options[:remote_ip] || @sender.remote_ip\n @url = options[:url] && (options[:url].is_a?(Hash) ? url_for(options[:url]) : options[:url])\n redmine_headers 'Url' => @url\n mail :to => [user, *options[:recipients]].uniq,\n :subject => \"[#{Setting.app_title}] #{l(:mail_subject_security_notification)}\"\n end", "def recipient\n @recipient ||= SimpleShipping::Party.new(\n :address => recipient_address,\n :contact => recipient_contact\n )\n end", "def deliver(message, options = {})\n raise ArgumentError, \"too many recipients, max. is #{MAX_RECIPIENT} (current: #{message.to.length})\" if message.to.length > MAX_RECIPIENT\n\n # Prepare request\n options = prepare_options options\n http = http_client options\n request = http_request post_params(message, options)\n\n # Log as `curl` request\n self.class.logger.debug \"curl -X#{request.method} '#{endpoint}' -d '#{request.body}'\"\n\n # Perform request\n resp = http.request(request)\n\n # Handle errors\n raise ServiceError, \"endpoint did respond with #{resp.code}\" unless resp.code.to_i == 200\n raise ServiceError, \"unable to deliver message to all recipients (CAUSE: #{resp.body.strip})\" unless resp.body.split(\"\\n\").all? { |l| l =~ /Result_code: 00/ }\n\n # extract Nth-SmsIds\n resp['X-Nth-SmsId'].split(',')\n end", "def set_recipient\n end", "def mail params = {}, &block\n\n raise ArgumentError.new( \"sender required\" ) unless params[ :from ].present?\n raise ArgumentError.new( \":to needs to be an array\" ) unless params[ :to ].present? && params[ :to ].is_a?( Array )\n raise ArgumentError.new( \"at least one recipient required\" ) unless params[ :to ].size > 0\n\n # binding.pry\n\n super.tap do |message|\n\n ensure_substitutions_match_recipients! params\n\n # Setting the headers on the Mailer class rather than on the Mail message as\n # per the documentation of ActionMailer::Base\n # http://api.rubyonrails.org/classes/ActionMailer/Base.html#method-i-headers\n self.headers['X-SMTPAPI'] = headers_as_json_for_sendgrid message\n\n end\n\n end", "def send_sms_message(text, to, from)\n deliver_message_via_carrier(text, to, from)\nend", "def set_recipient_data\n return if recipient_data\n return unless recipient_user_ids&.present?\n\n self.recipient_data = if email?\n recipient_users_email\n elsif sms?\n recipient_users_sms\n end\n end", "def calculate(message, phone)\n \n puts message.to\n end", "def sms_action documents\n to = \"#{params[:to].gsub(/[^\\d]/, '')}@#{params[:carrier]}\"\n mail = RecordMailer.sms_record(documents, { to: to, config: blacklight_config }, url_options)\n if mail.respond_to? :deliver_now\n mail.deliver_now\n else\n mail.deliver\n end\n end", "def recipient=(value)\n @recipient = value\n end", "def process_and_send_for_one (recipient)\n mail_payload = MailPayload.new(\n :subject => subject(recipient),\n :body => message(recipient),\n :recipient_record => recipient,\n :recipient_type => (recipient_type == 'parent' ? 'guardian' : recipient_type),\n :sender => User.find_by_id(sender_id),\n :hostname => Fedena.hostname,\n :mail_type => :alert,\n :alert_name => alert_name,\n :mail_logger => mail_logger\n )\n mail_payload.send_mail # TODO: handle response\n recipient\n end", "def send_now(mnobj = nil, recipient_sms_numbers: nil, generated_text: nil, importance: nil, logger: nil)\n logger ||= Rails.logger\n\n importance ||= self.class.importance\n\n resp = []\n if recipient_sms_numbers\n logger.info 'Sending sms to a defined set of recipients'\n elsif mnobj\n logger.info \"Sending sms for #{mnobj.id}\"\n else\n raise FphsException, 'No message notification or recipient list set for SMS send'\n end\n\n recipient_sms_numbers ||= mnobj.recipient_sms_numbers\n generated_text ||= mnobj.generated_text\n\n raise FphsException, 'No recipients to SMS' unless recipient_sms_numbers&.present?\n\n recipient_sms_numbers.each do |sms_number|\n val = PhoneValidation.validate_sms_number_format sms_number, no_exception: true\n\n if val\n res = send_sms sms_number, generated_text, importance\n resp << { aws_sns_sms_message_id: res.message_id } if res\n else\n resp << { error: BadFormatMsg }\n end\n end\n\n resp.to_json\n end", "def recipient_address\n @recipient_address ||= SimpleShipping::Address.new(\n :country_code => 'US',\n :state_code => 'MN',\n :city => 'Minneapolis',\n :street_line => 'Nightmare Avenue 13',\n :postal_code => '55411'\n )\n end", "def recipient_params\n params.require(:recipient).permit(:name, :phone_number, :got_yaa_id, :email, :message_sent, :has_responded)\n end", "def message (recipient)\n message_variables = alert_variables[:message].dup\n message_variables.merge!(recipient_details(recipient))\n message = \"#{I18n.t(\"#{recipient_type.to_s}_#{alert_name.to_s}\", message_variables)}\"\n message = process_message_hyperlinks(message)\n message\n end", "def deliver_message(options)\n self.sms_service_provider||= default_service_provider\n\n # set the actual message if it differs; not a before_save to reduce the\n # overhead of checking for all commits\n self.actual_message = substituted_draft_message\n\n result = (self.sms_service_provider).send_sms(self)\n self.unique_id = result[:unique_id] if result.is_a?(Hash)\n \n result\n end", "def receive_sms\n @view = \"sms\"\n @body = params[\"Body\"]\n @phone_number = params[\"From\"]\n set_user_create_message_parse_and_point\n end", "def deliver(params={})\n puts \"**** Message#deliver\" if params[:verbose]\n#puts \"**** Message#deliver response_time_limit=#{self.response_time_limit}\"\n save! if self.new_record?\n deliver_email() if send_email\n deliver_sms(:sms_gateway=>params[:sms_gateway] || default_sms_gateway) if send_sms\n end", "def text(options, params, object_name, format=\"\")\n body = \"\"\n if format.empty?\n outgoing_text_option = @account.outgoing_text_options.where(:name => object_name).first\n # Find the format string from fields that were passed.\n body = outgoing_text_option.build_text(object_name, params)\n else\n body = format\n end\n\n from_phone_number = options[:from_phone_number]\n phone_number = options[:phone_number]\n\n begin\n twilio_account.sms.messages.create(:from => from_phone_number, :to => phone_number, :body => body)\n rescue\n Rails.logger.error \"Unable to send SMS...: #{$!.message}\"\n Rails.logger.error $!.backtrace.join(\"\\n\")\n raise\n end\n ::SmsExtension::Message.create(:from => from_phone_number, :to => phone_number, :body => body)\n end", "def deliver(message, _options = {})\n raise ArgumentError, \"too many recipients, max. is #{MAX_RECIPIENT}\" if message.to.length > MAX_RECIPIENT\n\n from = message.from.present? ? message.from.to_s : from_number.to_s\n\n raise ArgumentError, 'no from number given on new message or the transport given' if from.empty?\n\n client = Twilio::REST::Client.new(account_sid, auth_token)\n messages = prepare_numbers(message.to).map do |n|\n client.messages.create(\n from: from,\n to: n,\n body: message.body\n )\n end\n numbers = messages.map do |result|\n result.try(:to)\n end\n NumberList.new.push numbers.compact\n end", "def perform (msg, to_phone, from_phone=ENV['ST_MAIN_NO'], type=SMS, next_sequence={})\n if type == MMS\n # send MMS to user\n begin\n mms(msg, to_phone, from_phone, next_sequence)\n\n rescue Twilio::REST::RequestError => e\n puts \"we've encountered a Twilio error.\"\n # TODO: describe the ramifications\n email_admins(\"Twilio Error\", \"Status: #{Time.now.to_s}\\nFailed MMS send, #{e.inspect}, \\nphone_number: #{to_phone}.\")\n Sidekiq.logger.warn e\n end\n else # SMS\n begin\n sms(msg, to_phone, from_phone, next_sequence)\n\n rescue Twilio::REST::RequestError => e\n puts \"we've encountered a Twilio error.\"\n # TODO: describe the ramifications\n email_admins(\"Twilio Error\", \"Status: #{Time.now.to_s}\\nFailed SMS send, #{e.inspect}, \\nphone_number: #{to_phone}.\")\n Sidekiq.logger.warn e\n end\n end\n end", "def deliver(numbers=@numbers, body=@body)\n # NB: message#deliver_sms currently sends numbers as a string, not an array.\n if numbers.is_a? String\n @numbers = numbers.gsub(\"+\",\"\").split(/,\\s*/) # Convert to array so we can do \"each\"\n else\n @numbers = numbers\n end\n @body = body # ...\n raise('No phone numbers given') unless @numbers\n raise('No message body') unless @body\n iron_worker_client ||= IronWorkerNG::Client.new\n @numbers.each do |number|\n#puts \"****Delivering to number=#{number}\"\n begin\n iron_worker_client.tasks.create(\"twilio_worker\",\n {:sid => @account_sid,\n :token => @auth_token,\n :from => @phone_number,\n :to => number.with_plus,\n :message => @body\n }\n )\n end \n end\n AppLog.create(:code => \"SMS.sent.#{@gateway_name}\", :description=>\"Queued #{@numbers.count} messages.\")\n @gateway_reply = nil\n super\n end", "def send_message\n Pony.mail({\n :from => params[:email], \n :to => 'info_the_lodge@gmail.com',\n :subject => params[:email] + \" has contacted you - Phone: \" + params[:phone], \n :body => params[:email] + params[:message],\n :via => :smtp,\n :via_options => {\n :address => 'smtp.gmail.com', \n :port => '587', \n :enable_starttls_auto => true,\n :user_name => 'info_the_lodge',\n :password => 'secret',\n :authentication => :plain,\n :domain => 'localhost.localdomain'\n }}) \n end", "def send_by_sms\n\t\t# ActionMailer deliverya\n\t\trecipeintNumberRaw = params[:mobile_number].gsub!(/[^0-9]/,'')\n\t\trecipeintNumberFormatted = params[:mobile_number]\n\t\t@listing = Listing.find(params[:listing_id])\n\n\t\tsms_message = 'Click to view the listing on ' + @listing.address_1 + ' ' + @listing.address_2 + ' ' + @listing.city + ' ' + @listing.state + ' ' + listing_url(@listing)\n\n\t\tsms_fu = SMSFu::Client.configure(:delivery => :action_mailer)\n\t\tsms_fu.deliver(recipeintNumberRaw, params[:carrier][0] , sms_message, :from => 'alert@fsbolisting.com')\n\t\treturn_response = { \"status\" => \"ok\", \"number\" => recipeintNumberFormatted }\n\t\trender :json => return_response.to_json, :callback => params[:callback]\n\n\tend", "def message_type\n 'sms'\n end", "def create_outgoing_message(phone_number, body, message_id = nil, outgoing_count = nil)\n if phone_number.can_receive_email? && allow_email_gateway? &&\n (! allow_commercial_gateway? || prefer_email? )\n to = \"#{phone_number.number}@#{phone_number.provider_email}\"\n from = \"#{name}@mmptext.info\"\n elsif allow_commercial_gateway? && phone_number.can_receive_gateway? && incoming_phone_number.present?\n to = phone_number.number\n from = incoming_phone_number.phone_number\n else\n raise \"List & subscriber settings make sending message impossible for number #{phone_number.number} [list: #{name}].\"\n end\n\n Resque.enqueue(OutgoingMessageJob, id, to, from, body, message_id, outgoing_count)\n end", "def send_sms(to_phone_number, message)\n # message = {to:, from:, body: \"Hello\\n\\nWorld\"}\n # binding.pry\n @@client.messages.create(\n from: @@from,\n to: to_phone_number,\n body: message\n )\n end", "def formatted_to\n \"#{to}@#{Base.gateways[@provider][:sms]}\" rescue raise \"Invalid provider\"\n end", "def send phone_number\n account = CLIENT.account \n message = account.sms.messages.create({from: TAKEAWAY_NUMBER , to: phone_number, body: \"Thanks for your order! It shall arrive no later than #{@delivery_time.strftime(\"%H\")}:#{@delivery_time.strftime(\"%M\")}.\"})\n message.body\n end", "def live_send(destinations,body,clientmessagereference,options = {})\n @options[:method] = 'sendsms'\n @options[:destinations] = to_csv(destinations) \n @options[:clientmessagereference] = clientmessagereference\n @options[:body] = body\n @options.merge(options)\n response = ta_response(send_params)\n return response\n end", "def send_raw(to, msg, dlr_url='')\n raise \"To should not be a user in send_raw\" if to.instance_of?(User)\n\n log_an_event(\"send_raw\",\"#{to} #{msg} #{dlr_url}\")\n\n gateway_status = nil\n gateway_string = nil\n\n # could limit message here\n # msg = msg[0..MSG_MAX_LEN]\n\n # todo: ensure the page has valid characters\n # todo: ensure the to is only numbers\n url = \"http://#{@server}:#{@port}/cgi-bin/sendsms?\"+\n \"username=#{@username}&password=#{@password}\"\n wait_for_response = false\n if (@dlr_mask && @dlr_mask.to_i>0 && @dlr_url && dlr_url)\n url = url + \"&dlr-mask=#{@dlr_mask}&dlr-url=#{URI::escape(dlr_url)}\"\n wait_for_response = true\n end\n url = url + \"&to=#{URI::escape(to)}&text=#{URI::escape(msg)}\"\n log_an_event \"send_raw url\", url\n open(url) do |f|\n # status will give us a message\n # read the status as well\n\n # it could fail here\n # but it cannot succeed immediately since this is just queued\n # from Kannel user guide, return codes are:\n #200: 0: Accepted for delivery\n #202: 0: Accepted for delivery\n #The message has been accepted and is delivered onward to a SMSC driver.\n #Note that this status does not ensure that the intended recipient receives the message.\n #202\t3: Queued for later delivery\n #4xx\t(varies)\n #503\tTemporal failure, try again later.\n # it returns an array [\"202\",\"Accepted\"]\n f_status_code = f.status\n f_status_code = f.status[0] if f.status.is_a?(Array)\n if not [\"200\", \"202\"].member?(f.status[0])\n gateway_status = STATUS_FAILED\n gateway_string = f.status.to_s\n log_an_error(\"send_raw\", \"FAILED to send #{url}\\n#{f.status.inspect}\")\n else\n gateway_string = f.read\n\n # 2 modes for the kannel server\n # either we wait for a delivery receipt, or we just send it to the server and assume this has been sent\n if wait_for_response\n gateway_status = STATUS_PENDING\n else\n gateway_status = STATUS_DELIVERED\n end\n log_an_event(\"send_page\", \"SUCCESS #{url} #{gateway_string}\")\n end\n end\n [wait_for_response, gateway_status, gateway_string]\n end", "def receive(email)\n if email && email.from && email.from.first\n @dest_address=email.to.first.to_s\n logger.info @dest_address\n if @dest_address.include?(\"#{APP_CONFIG[:project_email]}\")\n new_post_create_via_mail(email)\n elsif @dest_address.include?(\"#{APP_CONFIG[:message_email]}\")\n new_message_create_via_mail(email)\n elsif @dest_address.downcase.include?(\"ctzm\")\n comment_for_message_via_mail(email)\n end\n end\n end", "def sms_recieved(contactnumber,storecode,usermessage,category,sydreferencenume)\n @contactnumber_controller = contactnumber\n @storecode_controller = storecode\n @usermessage_controller=usermessage\n @category_controller = category\n @syd_refnum_controller = sydreferencenume\n date= Time.now()\n @date_controller = date.strftime(\"%d-%m-%Y\")\n subject_controller = \"#{@category_controller}:#{@storecode_controller}\"\n mail to: 'santosh.ar@shoutout.co.in',:subject => subject_controller\n\n end", "def send_sms!(msg)\n return false unless sms_alerts and phone_number_is_valid? and not mobile_carrier.blank?\n PersonMailer.send_sms(self, msg).deliver\n end", "def test(recipient)\n subject 'This is a test mail for you.'\n recipients recipient\n from 'Project Bordeaux No-Reply <no-reply@appfactory.us>'\n sent_on Time.now\n body :email => recipient, :url => FB_APP_HOME_URL\n end", "def ask_for_recipient\n\n end", "def sms(options = {})\r\n return @_message if @_sms_was_called && options.blank?\r\n\r\n m = @_message\r\n\r\n # Call all the procs (if any)\r\n default_values = {}\r\n self.class.default.each do |k,v|\r\n default_values[k] = v.is_a?(Proc) ? instance_eval(&v) : v\r\n end\r\n\r\n # Handle defaults\r\n options = options.reverse_merge(default_values)\r\n\r\n # Set configure delivery behavior\r\n wrap_delivery_behavior!(options.delete(:delivery_method), options.delete(:delivery_method_options))\r\n\r\n # Assign all options except body, template_name, and template_path\r\n assignable = options.except(:body, :template_name, :template_path)\r\n assignable.each { |k, v| m[k] = v }\r\n\r\n # Render the templates and blocks\r\n m.body = response(options)\r\n @_sms_was_called = true\r\n\r\n m\r\n end", "def send_message(recipient, message_text, opts={})\n valid_options = opts.only(:from)\n valid_options.merge!(:req_feat => '48') if valid_options[:from]\n response = execute_command('sendmsg',\n {:to => recipient, :text => message_text}.merge(valid_options)\n ) \n parse_response(response)['ID']\n end", "def sms\n @response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])\n if request.post?\n url_gen_params = {:host => request.host_with_port, :protocol => request.protocol}\n tinyPass = request.protocol + request.host_with_port + catalog_path(params['id'])\n tiny = tiny_url(tinyPass)\n if params[:to]\n phone_num = params[:to].gsub(/[^\\d]/, '')\n unless params[:carrier].blank?\n if phone_num.length != 10\n flash[:error] = I18n.t('blacklight.sms.errors.to.invalid', :to => params[:to])\n else\n email = RecordMailer.sms_record(@documents, {:to => phone_num, :carrier => params[:carrier], :callnumber => params[:callnumber], :location => params[:location], :tiny => tiny}, url_gen_params)\n end\n\n else\n flash[:error] = I18n.t('blacklight.sms.errors.carrier.blank')\n end\n else\n flash[:error] = I18n.t('blacklight.sms.errors.to.blank')\n end\n\n unless flash[:error]\n email.deliver\n flash[:success] = \"Text sent\"\n redirect_to catalog_path(params['id']) unless request.xhr?\n end\n end\n unless !request.xhr? && flash[:success]\n respond_to do |format|\n format.js { render :layout => false }\n format.html\n end\n end\n end", "def dm(message)\n raise \"Could not send message because of invalid options #{options}\" unless NOTIFICARE_SETTINGS\n recipients = NOTIFICARE_SETTINGS[\"recipients\"].split(/\\s*,\\s*/)\n username = NOTIFICARE_SETTINGS[\"username\"]\n password = NOTIFICARE_SETTINGS[\"password\"]\n recipients.each do |recipient|\n uri = \"http://#{username}:#{password}@twitter.com/direct_messages/new.json\"\n yell \"Sending #{recipient}: #{message}\"\n Net::HTTP.post_form(URI.parse(uri), {'user' => recipient, 'text' => message})\n end \nend", "def recipient(current_user)\n \tself.sender_id == current_user.id ? self.receiver : self.sender\n \tend", "def send_sms(number, subject, carrier, message)\n SMSMailer.sms_mailer(number, subject, carrier, message).deliver_now\n end", "def contact_message\n @contact_message = params[:contact_message]\n mail to: self.class.admin_emails\n end", "def send_twilio_mms\n # Get your Account Sid and Auth Token from twilio.com/user/account\n\n account_sid = 'add your account sid'\n auth_token = 'add your auth token'\n\n # set up a client to talk to the Twilio REST API\n client = Twilio::REST::Client.new account_sid, auth_token\n\n\n mms_message_body = \"name:#{self.contact.name}\"\n mms_message_body += \"\" #quick way to create spacing inbetween txt lines\n mms_message_body += \"phone: #{self.contact.phone_number}\"\n mms_message_body += \"\" #quick way to create spacing inbetween txt lines\n mms_message_body += \"#{self.message}\"\n end", "def initialize(recipient, contents=nil, status=nil, tracking_url=nil, \n shipping_charges=nil, net_amount=nil, tax=nil, \n gross_amount=nil, id=nil, dispatched_at=nil,\n token=nil)\n @recipient = recipient.serialize_to_hash\n @status = status\n @tracking_url = tracking_url\n @shipping_charges = shipping_charges\n @net_amount = net_amount\n @tax = tax\n @gross_amount = gross_amount\n @contents = contents\n @id = id\n @dispatched_at = dispatched_at\n @token = token.nil? ? token : Token.serialize_to_Token(token)\n \n end", "def send_sms(sms, options={})\n send_to_phone(sms.phone_number, sms.actual_message, options)\n end", "def setup_delivery\n method = @config.delivery['method'] || :smtp\n options = @config.delivery['options'] || {}\n\n options.keys.each do |key|\n options[(key.to_sym rescue key) || key] = options.delete(key)\n end\n\n options = Idid::Configuration::SMTP_DEFAULTS.merge options if method == :smtp\n options = Idid::Configuration::EXIM_DEFAULTS.merge options if method == :exim\n\n mail_defaults_for method, options\n end", "def my_recipients\n @my_recipients ||= if @@my_settings[:recipients].is_a? Symbol\n \"Targets::#{@@my_settings[:recipients].to_s.camelize}\".constantize.get\n else\n @@my_settings[:recipients]\n end\n end", "def send_mail_from_raw_mime(params)\n begin\n raw_message = \"From: #{params[:sender_email]}\\nTo: #{params[:recipient]}\\nSubject: #{params[:subject].to_s}\\n\\n #{params[:content].to_s}\"\n\n from_email = params[:sender_email]#\"sender@example.com\"\n from_name = \"From Name\"\n to = params[:recipient]#[\"recipient.email@example.com\"]\n async = false\n ip_pool = \"Main Pool\"\n send_at = params[:send_at].presence || Time.now#\"example send_at\"\n return_path_domain = nil\n result = @mandrill.messages.send_raw raw_message, from_email, from_name, to, async, ip_pool, send_at, return_path_domain\n # [{\"reject_reason\"=>\"hard-bounce\",\n # \"email\"=>\"recipient.email@example.com\",\n # \"_id\"=>\"abc123abc123abc123abc123\",\n # \"status\"=>\"sent\"}]\n\n rescue Mandrill::Error => e\n # Mandrill errors are thrown as exceptions\n puts \"A mandrill error occurred: #{e.class} - #{e.message}\"\n # A mandrill error occurred: Mandrill::UnknownSubaccountError - No subaccount exists with the id 'customer-123'\n raise\n end\n end", "def contact_email(message)\n @message = message\n if @message.inquiry_type == 'client'\n @dest_email = 'calblueprint@gmail.com' # should be Kenneth's email\n elsif @message.inquiry_type == 'member'\n @dest_email = 'calblueprint@gmail.com' # should be KGong's email\n else\n @dest_email = 'calblueprint@gmail.com' # should be Jay's email\n end\n\n mail(:to => @dest_email, :from => @message.email, :subject => @message.subject)\n\n end", "def recipient_params\n params.require(:recipient).permit(:name, :email, :phone)\n end", "def delivery_options(address, port, domain, user_name, password,\n authentication, enable_starttls_auto)\n @mail.delivery_method :smtp, address: address,\n port: port,\n domain: domain,\n user_name: user_name,\n password: password,\n authentication: authentication,\n enable_starttls_auto: enable_starttls_auto\n end", "def send_one!(recipient)\n message_data = message_data([recipient])\n @mandrill.messages.send_template(template, recipient.custom_html_data, message_data)\n end", "def deliver_email\n\t\treturn not_validated_error unless EmailValidator.new(content: content).validated?\n\t\tformatted_content = EmailFormatter.new(content: content, service: service).format\n\n\t\tif service == \"mandrill\"\n\t\t\tself.class.base_uri \"https://mandrillapp.com/api/1.0\"\n\t\t\tresponse = self.class.post(\"/messages/send.json\", body: {\"key\" => ENV.fetch(\"MANDRILL_API_KEY\"), \"message\" => formatted_content})\n\t\t\tif response[\"status\"] == \"sent\"\n\t\t\t\t\"Yay! Your email is on it's way!!\"\n\t\t\telse\n\t\t\t\t\"Oh no. That email couldn't be delivered\"\n\t\t\tend\n\n\t\telsif service == \"mailgun\"\n\t\t\tself.class.base_uri \"https://api.mailgun.net/v3/sandboxaebea391c02a4a0494ab285e2adf8170.mailgun.org\"\n\t\t\tself.class.basic_auth 'api', ENV.fetch(\"MAILGUN_API_KEY\")\n\t\t\tresponse = self.class.post(\"/messages\", body: formatted_content)\n\t\t\tif response[\"message\"] == \"Queued. Thank you.\"\n\t\t\t\t\"Yay! Your email is on it's way!!\"\n\t\t\telse\n\t\t\t\t\"Oh no. That email couldn't be delivered\"\n\t\t\tend\n\t\tend\n\tend", "def recipient\n Recipient.find(payment_params[:recipient_id])\n end", "def deliver(sms)\n new.deliver!(sms)\n end", "def sms\n account_sid = params[:AccountSid]\n body = params[:Body]\n from = params[:From]\n from_zip = params[:FromZip]\n if from && body && # account_sid == TWILIO_ACCOUNT_SID \n sms = TwilioNet.new()\n sms.send_sms('2146680255', truncate(\"FROM:#{from} BODY:#{body}\", :length => 159) )\n render :layout => 'empty', :template => 'public/sms' \n else\n raise error \n end \n rescue\n render :text => \"Invalid Params #{params.inspect}\"\n end", "def recipient\n return @recipient\n end", "def receive_sms\n uninitialize_sms\n body = params[:Body]\n phone_number = normalize_phone params[:From].strip\n @problem_text = body.split\n action = sms_parsing(body).downcase\n if action == \"join\"\n sms_create_account\n return\n elsif Account.find_by_phone_number(phone_number) == nil\n sms_send(params[:From], \"Please first create an account by texting the word 'join'.\")\n return\n end\n if !@sms_error\n case action\n when /^add$/,/^insert$/\n sms_create\n when /^accept$/\n sms_accept_problem\n when /^get$/\n @offset = false\n sms_get(0)\n when /^edit$/\n sms_edit\n when /^delete$/, /^destroy$/\n sms_delete\n when /^next$/\n offset = session[\"offset\"]\n if offset == nil\n sms_error(\"Sorry, there is no saved session right now. Please first text \\\"GET\\\" with @location !skill %number of texts you want to allow.\")\n else\n @offset = true\n sms_get(offset)\n end\n when /^detail$/, /^details$/, /^describe$/\n sms_detail\n when /^account$/\n forgot_acc\n when /^change$/\n sms_change_password\n when /^password$/\n forgot_password\n# when /^skill$/, /^skills$/\n# sms_skill\n when /^keywords$/, /^key$/, /^keys$/, /^help$/\n sms_keywords\n when /^explain$/\n sms_explain\n else\n if is_num?(action)\n session[:received_confirmation] = action\n sms_confirm_acc\n else\n sms_wrong_keyword\n end\n end\n end\n render :nothing => true\n end", "def send_mail_with opts\n # Remove cc duplicates\n opts[:cc].uniq!\n # don't allow :to value in :cc array\n opts[:cc].delete(opts[:to])\n opts = development_filter(opts)\n # Send email\n mail(:to=>opts[:to],\n :cc=>opts[:cc],\n :attachments=>opts[:attachments],\n :subject=>opts[:subject],\n :from=>opts[:from]\n )\n end", "def build_message\n\n # Get user\n user = User.find(params[\"user_id\"])\n\n # User Info\n user_info = user[\"name\"]+\" \"+user[\"last_name\"]+\" (\"+user[\"email\"]+\"), \"+user[\"jobtitle\"]+\n \", perteneciente al centro de costos \"+user[\"deptname\"]+\", a cursado una solicitud para \"\n\n # Transfer line\n if params[\"request\"] == \"transfer line\"\n ms = user_info+params[\"transfer_line_type\"]+\" su linea de teléfono con número telefónico: +56 9 \"+\n params[\"phone_number\"]\n\n # Smartphone\n elsif params[\"item\"] == \"smartphone\"\n lost = \"\"\n motive = \"\"\n\n #if not technical service\n if params[\"request\"] != \"technical service\"\n # Get smartphone info\n if params[\"want_all\"] == '0'\n params[\"model\"] = get_smartphone(params[\"model_one\"])\n params[\"price\"] = params[\"model\"][\"price\"]\n motive = \"\"\n else\n params[\"model\"] = get_smartphone(params[\"model_all\"])\n motive = \" El modelo smartphone elegido no corresponde al cargo que tiene el trabajador.\n El motivo de la elección que ha dado el trabajador es: \"+params[\"comment\"]+\".\"\n end\n end\n\n # New\n if params[\"request\"] == \"new\"\n ms = user_info+\" un nuevo smartphone modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n if params[\"want_sim\"] == \"true\"\n ms+= \"El smartphone debe traer tarjeta Sim y el número de teléfono asociado a él \"\n if params[\"want_new_number\"] == \"true\"\n ms+= \"debe ser nuevo.\"\n else\n ms+= \"será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n end\n else\n ms+= \"El smartphone no debe traer tarjeta Sim.\"\n end\n\n # Renew, stolen/lost\n elsif params[\"request\"] == \"renew\" || params[\"request\"] == \"stolen/lost\"\n ms = user_info+\" renovar su smartphone, eligiendo el modelo \"+params[\"model\"][\"model\"]+\n \", con un valor referencial de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n if params[\"request\"] == \"stolen/lost\"\n ms = user_info+\" un nuevo smartphone modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n lost = \" Esta solicitud fue cursada por la pérdido o robo del smartphone que el trabajador tenia asignado anteriormente.\"\n end\n\n if params[\"want_sim\"] == \"true\"\n ms+= \"El smartphone debe traer tarjeta Sim y el número de teléfono asociado a él \"\n if params[\"number_type\"] == \"new\"\n ms+= \"debe ser nuevo.\"\n params[\"want_new_number\"] = true\n elsif params[\"number_type\"] == \"same\"\n ms+= \"será el mismo que tiene asignado actualmente el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"same_number\"]+\".\"\n params[\"want_new_number\"] = false\n params[\"phone_number\"] = params[\"same_number\"]\n else\n ms+= \"será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n params[\"want_new_number\"] = false\n end\n else\n ms+= \"El smartphone no debe traer tarjeta Sim\"\n end\n\n # technical service\n elsif params[\"request\"] == \"technical service\"\n\n #If user want replacement\n if params[\"want_replacement\"] == \"true\"\n replace= \"El trabajador va a necesitar un dispositivo de reemplazo durante el periodo en que el smartphone es enviado al servicio técnico\"\n else\n replace= \"El trabajador no necesita un dispositivo de reemplazo durante el periodo en que el smartphone es enviado al servicio técnico\"\n end\n\n #message\n ms = user_info+\" enviar al servicio técnico su smartphone modelo \"+\n params[\"model\"]+\", IMEI \"+params[\"imei\"]+\", con número telefónico +56 9 \"+\n params[\"phone_number\"]+\". El desperfecto que presenta el smartphone es \"+\n params[\"comment\"]+\". \"+replace\n\n ms+= motive+lost\n end\n\n # Bam\n elsif params[\"item\"] == \"bam\"\n\n if params[\"request\"] != \"technical service\"\n # Get bam model's info\n params[\"model\"] = get_bam(params[\"model\"])\n # Get bam plan's info\n params[\"plan\"] = get_plan(params[\"plan\"])\n end\n\n # New, stolen/lost\n if params[\"request\"] == \"new\" || params[\"request\"] == \"stolen/lost\"\n # Message\n ms = user_info+\" un nuevo dispositivo Bam modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\n \", asociado al plan \"+params[\"plan\"][\"name\"]+\", el cual tiene un valor de $\"+\n params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n if params[\"request\"] == \"stolen/lost\"\n ms+= \" Esta solicitud fue cursada por la pérdido o robo del dispositivo Bam que el trabajador tenia asignado anteriormente.\"\n end\n\n # Renew\n elsif params[\"request\"] == \"renew\"\n # Message\n ms = user_info+\" renovar su dispositivo Bam, eligiendo el modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\n \". El usuario mantendrá el mismo plan, el cual tiene un valor de $\"+\n params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n # Technical service\n elsif params[\"request\"] == \"technical service\"\n #If user want replacement\n if params[\"want_replacement\"] == \"true\"\n replace= \"El trabajador va a necesitar un dispositivo de reemplazo durante el periodo en que el dispositivo Bam es enviado al servicio técnico\"\n else\n replace= \"El trabajador no necesita un dispositivo de reemplazo durante el periodo en que el dispositivo Bam es enviado al servicio técnico\"\n end\n #message\n ms = user_info+\" enviar al servicio técnico su dispositivo Bam modelo \"+\n params[\"model\"]+\", IMEI \"+params[\"imei\"]+\". El desperfecto que presenta el Bam es \"+\n params[\"comment\"]+\". \"+replace\n end\n\n # Sim\n elsif params[\"item\"] == \"sim\"\n # Message\n ms = user_info+\" una nueva Sim y el número de teléfono asociado a él\"\n\n if params[\"request\"] == \"stolen/lost\"\n ms+= \" debe ser el número telefónico: +56 9 \"+params[\"phone_number\"]+\n \". Esta solicitud fue cursada por la pérdida o robo de la Sim que el trabajador tenia asignado anteriormente.\"\n elsif params[\"want_new_number\"] == \"true\"\n ms+= \" debe ser nuevo.\"\n else\n # Message\n ms+= \" será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n end\n\n # Roaming\n elsif params[\"item\"] == \"roaming\"\n # Get Roaming plan's info\n params[\"plan\"] = get_plan(params[\"plan\"])\n # Modify date\n date_split = params[\"start_date\"].split(\"-\")\n params[\"start_date\"] = Date.parse(date_split[2]+\"/\"+date_split[1]+\"/\"+date_split[0])\n\n date_split = params[\"end_date\"].split(\"-\")\n params[\"end_date\"] = Date.parse(date_split[2]+\"/\"+date_split[1]+\"/\"+date_split[0])\n # Message\n ms = user_info+\" el servicio Roaming, con el plan: \"+params[\"plan\"][\"name\"]+\n \", el cual tiene un valor de $\"+params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". El servicio\n se solicita ya que el trabajador viaja al extranjero debido a: \"+params[\"comment\"]+\n \", entre las fechas: \"+params[\"start_date\"].strftime('%d/%m/%Y')+\" y \"+params[\"end_date\"].strftime('%d/%m/%Y')+\".\"\n end\n\n return ms\n end", "def receive_success me,member\n @by_member = member\n @amount = me.amount\n @currency = me.account.currency\n @me = me\n subjects = \"You have been sent some money\"\n mail to: me.receiver.email, subject: subjects\n #when receiver has account\n end", "def send_sms phone, message\n message = URI.escape message\n response = RestClient.get \"#{sender_base_url}/?from=#{@from}&to=#{phone}&text=#{message}&pass=#{@application_pass}\"\n @response = Response.new response\n end", "def send_message(recipients, msg, sanitize_text=true, message_timestamp = Time.now)\n\n message = Alerter::MessageBuilder.new({\n :sender => self,\n :recipients => recipients,\n :msg => msg,\n :created_at => message_timestamp,\n :updated_at => message_timestamp\n }).build\n\n message.deliver false, sanitize_text\n end", "def deliver(message:, to:, country_code:, otp: nil)\n if Telephony.config.pinpoint.sms_configs.empty?\n return PinpointHelper.handle_config_failure(:sms)\n end\n\n response = nil\n sender_id = Telephony.config.country_sender_ids[country_code.to_s]\n Telephony.config.pinpoint.sms_configs.each do |sms_config|\n start = Time.zone.now\n CLIENT_POOL[sms_config].with do |client|\n sender_config = build_sender_config(country_code, sms_config, sender_id)\n\n pinpoint_response = client.send_messages(\n application_id: sms_config.application_id,\n message_request: {\n addresses: {\n to => {\n channel_type: 'SMS',\n },\n },\n message_configuration: {\n sms_message: {\n body: message,\n message_type: 'TRANSACTIONAL',\n }.merge(sender_config),\n },\n },\n )\n finish = Time.zone.now\n response = build_response(pinpoint_response, start: start, finish: finish)\n if response.success? ||\n response.error.is_a?(OptOutError) ||\n response.error.is_a?(PermanentFailureError)\n return response\n end\n PinpointHelper.notify_pinpoint_failover(\n error: response.error,\n region: sms_config.region,\n channel: :sms,\n extra: response.extra,\n )\n rescue Aws::Pinpoint::Errors::ServiceError,\n Seahorse::Client::NetworkingError => e\n finish = Time.zone.now\n response = handle_pinpoint_error(e)\n PinpointHelper.notify_pinpoint_failover(\n error: e,\n region: sms_config.region,\n channel: :sms,\n extra: {\n duration_ms: Util.duration_ms(start: start, finish: finish),\n },\n )\n end\n end\n response || PinpointHelper.handle_config_failure(:sms)\n end", "def send_an_email(message, subject, to)\n message_params = {}\n message_params[:from] = 'QuikSort Bot <***@quiksort.in>'\n message_params[:to] = to\n message_params[:subject] = subject\n message_params[:text] = message\n logger.info $MG_CLIENT.send_message 'quiksort.in', message_params\nend", "def receive_recipient rcpt\n true\n end", "def receive_recipient rcpt\n true\n end", "def receive_recipient rcpt\n true\n end", "def preview_to(recipient)\n @newsletter = build_newsletter\n mail = build_mail\n mail.to = recipient.email\n replace_and_send_mail_safely(mail, recipient)\n end", "def send_text(message, site_id)\n s1 = Caboose::Setting.where(:site_id => site_id, :name => \"twilio_account_sid\").first\n account_sid = s1 ? s1.value : nil\n s2 = Caboose::Setting.where(:site_id => site_id, :name => \"twilio_auth_token\").first\n auth_token = s2 ? s2.value : nil\n s3 = Caboose::Setting.where(:site_id => site_id, :name => \"twilio_from_number\").first\n twilio_number = s3 ? s3.value : nil\n send_to = self.cell_phone.blank? ? (self.direct_work_phone.blank? ? self.other_phone : self.direct_work_phone) : self.cell_phone\n send_to = '205-657-0937' if Rails.env.development? # Billy's cell\n if account_sid && auth_token && twilio_number && !send_to.blank? && !message.blank?\n @client = Twilio::REST::Client.new account_sid, auth_token\n begin\n message = @client.messages.create(\n body: message,\n to: \"+1#{send_to.gsub(/[(\\- )]/, '')}\",\n from: \"#{twilio_number}\"\n )\n rescue\n Caboose.log(\"invalid phone number\")\n end\n end\n end", "def deliver(params)\n return false unless is_configured? && valid_params?(params)\n\n # If :recipient is incoming, we'll use that, otherwise, we'll use\n # what was set in the configure block\n params = { recipient: recipient }.merge!(params)\n\n if response = client.post(:message => params)\n response.code == 200\n end\n end", "def phone_number\n\t\t\trecipient.phone_number\n\t\tend", "def sms(number, message, sec=SMS_SEND_TIMEOUT)\n @logger.log(\"Sending message.\")\n\n msg = ATPhone::SMS::Message.new(message, number)\n \n # Turn on text mode\n send(\"AT+CMGF=1\")\n # Specify number\n raw_send(\"AT+CMGS=\\\"#{msg.number}\\\"\\r\")\n # send message\n raw_send(msg.text + EOM, sec)\n end", "def recruit_email(recipient, interaction, email)\n @interaction = interaction\n\n full_body = email.templated_body_for(recipient, :raw => true)\n reply_to = \"#{email.from.email_from} <#{email.from.email}>\"\n from = \"#{email.from.email_from} <athletics@scoutforce.com>\"\n\n mail(\n :to => recipient.email,\n :from => from,\n :reply_to => reply_to,\n :cc => email.cc,\n :bcc => email.bcc,\n :subject => email.subject,\n :'X-Mailgun-Variables' => %({\"recipient_id\" : \"#{recipient.id}\", \"email_id\" : \"#{email.id}\", \"interaction_id\" : \"#{interaction.id}\" })\n ) do |format|\n format.text\n format.html do\n render :text => full_body, :layout => true\n end\n end\n end", "def recipient\n return @recipient\n end", "def correspond_mail(user, recipient, message, body_session, title_session)\n @recipient = recipient\n @sender = user\n @message = message\n @body_session = body_session\n @title_session = title_session\n\n mail(:to =>recipient.email, :subject => message.subject)\n\n end", "def send_sms(sender, numbers, text, **params)\n # Create the send XMLmarkup\n estimate_cost = estimate_cost(numbers, text)\n return -1 if estimate_cost == -1\n\n if estimate_cost < get_balance\n identity = \"#{Time.now.to_i}#{rand(1000000000..9999999999)}\"\n batchID = @company + \"+\" + identity\n is_persian_text = is_persian(text)\n msgClass = params[\"flash\"] ? \"0\" : \"1\"\n dcs = is_persian_text ? \"8\" : \"0\"\n binary = is_persian_text ? \"true\" : \"false\"\n text = text.to_h if is_persian_text\n\n builder = Builder::XmlMarkup.new()\n builder.instruct! :xml, version: \"1.0\", encoding: \"UTF-8\"\n builder.declare! :DOCTYPE, :smsBatch, :PUBLIC, \"-//PERVASIVE//DTD CPAS 1.0//EN\", \"http://www.ubicomp.ir/dtd/Cpas.dtd\"\n builder.smsBatch(company: @company, batchID: batchID) do |b|\n b.sms(msgClass: msgClass, binary: binary, dcs: dcs) do |t|\n numbers.each do |number|\n t.destAddr() do |f|\n f.declare! \"[CDATA[%s]]\" % number\n end\n end\n t.origAddr() do |f|\n f.declare! \"[CDATA[%s]]\" % sender\n end\n t.message() do |f|\n f.declare! \"[CDATA[#{text}]]\"\n end\n end\n end\n\n out_xml = builder.target!\n\n result = send_xml(out_xml)\n\n source = XML::Parser.string(result)\n content = source.parse\n\n if content.find_first('ok')\n if content.find_first('ok').content.include? 'CHECK_OK'\n @errors = nil\n batchID\n else\n @errors = \"Something going wrong\"\n nil\n end\n else\n @errors = content.find_first('message').content.strip\n nil\n end\n else\n @errors = 'Not enough balance'\n nil\n end\n end", "def contact(contact)\n @recipients = App[:recipients]\n @body[:contact] = contact\n @from = App[:from]\n @subject =\"咨询\"+ contact.name\n @sent_on = Time.now\n end", "def send_email\n return true unless RunLevel.is_normal?\n\n log_msg = \"SEND #{flavor} \" \\\n \"from=#{user&.login || \"nil\"} \" \\\n \"to=#{to_user&.login || \"nil\"} \" +\n queued_email_integers.map { |x|\n \"#{x.key}=#{x.value}\"\n }.join(\" \") +\n queued_email_strings.map do |x|\n \"#{x.key}=\\\"#{x.value}\\\"\"\n end.join(\" \")\n self.class.debug_log(log_msg)\n current_locale = I18n.locale\n result = false\n if user.present? && user == to_user\n unless Rails.env.test?\n raise(\"Skipping email with same sender and recipient: #{user.email}\\n\")\n end\n else\n result = deliver_email\n end\n I18n.locale = current_locale\n result\n rescue StandardError => e\n warn(\"ERROR CREATING EMAIL\")\n warn(log_msg)\n warn(e)\n warn(e.backtrace)\n I18n.locale = current_locale\n false\n end", "def recevied(order)\n @order = order\n\n mail to: \"tariq.sulehir@khaleef.com\", subject: \"Rails Store Order Conformation..\"\n end", "def deliverForm data\n @fromContact = data['fromContact']\n @data = data\n tomail = data['toEmail'].length > 0 ? data['toEmail'] : 'saisagarkache@gmail.com'\n\n mail(to: tomail, subject: data['fromContact'] || 'Want to be a Partner')\n end", "def send(user, number, message, phone=nil)\n phone = Behaviour.select_phone(number, user['behaviour']) if phone.nil?\n if phone #se fizer match com os existentes\n `gammu-smsd-inject -c ~/.sms/gammu-smsdrc-#{phone} TEXT #{number} -text \"#{message}\"` # send to daemon\n #LOGIT que foi para a fila\n else \n #LOGIT que alguem tentou mas nao foi para a fila\n end\n end", "def send_message(from, recipients)\n self.sent = true\n self.read = true\n \n if recipients == :all\n self.peer = \"All\"\n else\n if recipients.class.to_s != \"Array\"\n recipients = [recipients]\n end\n self.peer = recipients.join(\", \")\n end \n \n if from == :system\n self.user_id = 0\n else\n sender = User.find_by_username(from)\n if sender\n self.user_id = sender.id\n else\n return\n end \n end\n if self.save\n async_send_message(self.id, recipients)\n end\n end", "def send_to_phone(phone_obj, message, options={})\n\n if options[:skip_validation]\n phone_text = phone_obj.is_a?(ActiveRecord::Base) ? format_phone_number(phone_number) : phone_obj\n return send_message(phone_text, message, options)\n end\n\n phone_number = phone_obj.is_a?(ActiveRecord::Base) ? phone_obj :\n find_or_create_phone_number(phone_obj, options)\n\n assert_message_options!(phone_number, message, options)\n send_message(format_phone_number(phone_number), message, options)\n end", "def sms(body, to: nil, from: nil, method: nil, action: nil, status_callback: nil, **keyword_args)\n append(Sms.new(\n body,\n to: to,\n from: from,\n method: method,\n action: action,\n status_callback: status_callback,\n **keyword_args\n ))\n end", "def deliver\n #inform_interceptors\n if delivery_handler\n delivery_handler.deliver_sms(self) { do_delivery }\n else\n do_delivery\n end\n inform_observers\n self\n end", "def huzzah\n # ===========================================================================\n # 6. Send an SMS Message to 415-555-1212\n # uses a HTTP POST, and a new variable t for the information (because it needs \"Body\")\n \n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)\n \n t = {\n 'From' => CALLER_ID,\n 'To' => phone,\n 'Body' => message\n }\n resp = account.request(\"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages\",\n \"POST\", t)\n end", "def sms_perform(object_instance, options={})\n account = ::SmsExtension::Account.first\n consumer = AP::SmsExtension::Sms::Consumer.new(account)\n options = HashWithIndifferentAccess.new(options)\n options[:phone_number] ||= account.phone_number\n options[:outgoing_message_format] ||= account.outgoing_message_format\n options[:from_phone_number] ||= (!account.from_phone_number.blank? ? account.from_phone_number : ENV['SMS_EXTENSION_TWILIO_FROM_SMS_NUMBER'])\n\n consumer.text(options, object_instance.attributes, object_instance.class.name, options[:outgoing_message_format])\n end", "def help_csv(params)\n @body = params[:body]\n path = params[:contacts].tempfile.path\n filename = params[:contacts].original_filename\n attachments[filename] = File.read(path)\n\n #sender_email = ActiveSupport::JSON.decode( params[:sender_email] )\n\n mail to: params[:sender_email]\n #binding.pry\n end", "def sms_email_address\n carrier.sms_email_address(self) if carrier\n end" ]
[ "0.6247631", "0.6133201", "0.5962416", "0.5926002", "0.5901603", "0.5879868", "0.58379805", "0.58018184", "0.58001703", "0.5750512", "0.5749427", "0.5743206", "0.57254726", "0.5708531", "0.5705451", "0.5702569", "0.5699854", "0.5676836", "0.5674442", "0.56590253", "0.56587434", "0.5644023", "0.563904", "0.5616377", "0.56039304", "0.5595284", "0.5560694", "0.5503588", "0.5500595", "0.5500574", "0.54922813", "0.5492214", "0.54740363", "0.54719365", "0.5464862", "0.5453527", "0.54405737", "0.54108644", "0.5408975", "0.5400614", "0.53977203", "0.5391548", "0.53836817", "0.5378208", "0.53672093", "0.5366437", "0.5365956", "0.5363199", "0.5362587", "0.5359189", "0.5357668", "0.5357274", "0.5356899", "0.53552586", "0.53549415", "0.5351553", "0.5343036", "0.534109", "0.5335339", "0.5329282", "0.5328543", "0.5317618", "0.5302713", "0.529708", "0.5291329", "0.528613", "0.52652746", "0.5261167", "0.52398455", "0.5238449", "0.5233518", "0.5232229", "0.5232195", "0.52260685", "0.52229255", "0.52173656", "0.52173656", "0.52173656", "0.5214936", "0.5214598", "0.5212298", "0.5207477", "0.5205322", "0.52041364", "0.5200983", "0.52009743", "0.5200333", "0.51915234", "0.5190931", "0.5187282", "0.5184781", "0.51846033", "0.5178439", "0.51772815", "0.51707476", "0.51686746", "0.5165876", "0.51654285", "0.51631576", "0.51564246" ]
0.63261914
0
Returns content for palindrome testing.
def processed_content to_s.scan(/[a-z\d]/i).join.downcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def palindrome?\n processed_content = self.content.downcase\n processed_content == processed_content.reverse\n end", "def palindrome?\n #can also be written as processed_content = @content.downcase\n processed_content == processed_content.reverse\n end", "def palindrome?\n if processed_content.length < 1\n return false\n else\n processed_content == processed_content.reverse\n end\n end", "def palindrome?\n processed_content = self.content.downcase\n #can also be written as processed_content = @content.downcase\n #you can even omit self. and just make this content.downcase in Ruby\n processed_content == processed_content.reverse\n end", "def palindrome?\n if processed_content.empty?\n false\n else\n processed_content == processed_content.reverse\n end\n end", "def palindrome?\n if processed_content.empty?\n false\n else\n processed_content == processed_content.reverse\n end\n end", "def palindrome?(txt)\n txt == txt.reverse\nend", "def palindrome(str)\nend", "def palindrome(word)\n\treturn word == word.reverse #true\nend", "def check_palindrome(s)\n\n if s == nil\n return false\n end\n\n result = \"\"\n\n (s.length-1).downto(0).each do |l|\n result << s[l]\n end\n p result\n\n return result == s\n\nend", "def palindrome\r\n docarry = []\r\n answer = ''\r\n file='D:\\Dev\\Ruby\\codequizzes\\names.txt'\r\n content = File.readlines(file, \"r\")\r\n text = content.join\r\n text.each_line do |line|\r\n docarry << line\r\n end\r\n x = 0\r\n while x < docarry.length\r\n a = docarry[x].to_s\r\n b = a.reverse\r\n a = a.split\r\n b = b.split\r\n\r\n answer = a if a == b && b == a\r\n x += 1\r\n end\r\n return answer\r\nend", "def palindrome (input_string)\n input_string == input_string.reverse\nend", "def palindromo(text)\n if text.downcase == text.downcase.reverse\n \"palindrome\"\n else\n \"no palindrome\"\n end\nend", "def palindrome(words)\n words == words.reverse\nend", "def palindrome\n txt = 'ssiiss'\n length = txt.length\n i = 0\n j = length - 1\n flag = true\n while flag && i<=j do\n flag = txt[i] == txt[j] ? true : false\n i = i + 1\n j = j - 1\n end\n puts \"palindrome is #{flag}\"\nend", "def palindrome_verify(word)\n if word.reverse == word #Check if string same when reversed \n return \"#{ word } es palindromo.\"\n else # If string is not the same when reversed\n return \"#{ word } no es un palindromo\"\n end\n end", "def palindrome?\n str = self.to_s\n len = str.size\n\n if len.odd?\n str[0, len/2] == str[len/2 + 1, len/2].reverse\n else\n str[0, len/2] == str[len/2, len/2].reverse\n end\n end", "def palindrome string\n if string == string.reverse\n \"#{string} is a palindrome!\"\n else \n \"#{string} is not a palindrome\"\n end \nend", "def valid_palindrome(s)\n \nend", "def palindrome?(input)\n input.to_s == input.to_s.reverse\nend", "def palindrome(sentence)\n line = sentence.downcase.split.join # same as line = sentence.downcase.gsub(\" \", \"\")\n if line = line.reverse\n # p line\n return true\n else\n return false\n end\n \n \nend", "def palindrome(str)\n str == str.reverse\nend", "def is_palindrome?(n)\n n.to_s == n.to_s.reverse!\nend", "def Palindrome(str)\n str.gsub!(/\\s+/, \"\")\n str == str.reverse\nend", "def Palindrome(str)\n str = str.gsub(\" \", \"\")\n front = 0\n back = str.length - 1\n \n while front < back\n if str[front] != str[back]\n return \"false\"\n end\n front += 1\n back -= 1\n end\n \n return \"true\"\nend", "def palindrome?\n formatted_word = @word.gsub(/[^a-z]/, \"\")\n formatted_word == formatted_word.reverse\n end", "def is_palindrome?(x)\n x.to_s == x.to_s.reverse ? true : false\nend", "def palindrome_substrings(string)\n\nend", "def isPalindrome(word)\n\nend", "def palindrome?(sentence)\n sentence == sentence.reverse\nend", "def palindrome?(n)\n n.to_s == n.to_s.reverse\nend", "def palindrome?\n string = self.downcase.gsub(/[\\W\\d]+/,\"\")\n string.reverse.eql?(string)\n end", "def is_palindrome(input)\n\tinput_as_string = input.to_s\n\treturn input_as_string == input_as_string.reverse\nend", "def palindrome?(word)\n word == word.reverse\nend", "def palindrome?(word)\n word.reverse == word\nend", "def test(string)\n reverse_string = string.reverse\n if string == reverse_string\n puts \"#{string} is a palindrome\"\n else\n puts \"#{string} is not a palindrome\"\n end\nend", "def palindrome_tester(s)\n if s == s.reverse\n puts \"It's a palindrome!\"\n else\n puts \"It's not a palindrome.\"\n end\nend", "def real_palindrome?(string)\n string.downcase!\n if string == string.reverse\n p true\n else\n p false\n end\nend", "def is_palindrome(word)\nforwards = \"\"\nbackwards = \"\"\n \n i = 0\n while i < word.length\n char = word[i]\n forwards = forwards + char\n backwards = char + backwards\n\n i += 1\n end\n \n if forwards == backwards\n return \"true\"\n else\n return \"false\"\n end\nend", "def is_palindrome(word)\n word == word.reverse ? true : false\nend", "def palindrome (string)\n\n if string.reverse == string\n return true\n else\n return false\n end\n \nend", "def palindrome? x\n # convert into string\n y = x.to_s\n look = y.length / 2\n y[0..(look-1)] == y[-look..-1].reverse\nend", "def isPalindrome(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\n\nend", "def puf_syndrome\n \n end", "def is_palindrome?(value)\n value.downcase!\n\n reversed = \"\"\n count = value.lentgth\n\nwhile count > 0\n count -= 1\n reversed += value[count]\nend\n\n if value == reversed\n return \"#{value} is a palindrome\"\n else\n return \"#{value} is not a palindrome\"\n end\nend", "def is_palindrome(str)\n str.to_s == str.to_s.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def is_palindrome(n)\n string = n.to_s\n string == string.reverse\nend", "def is_palindrome(number)\n number.to_s.reverse == number.to_s\nend", "def is_palindrome? string\n string == string.reverse\nend", "def is_palindrome? string\n string == string.reverse\nend", "def palindrome?(string)\r\n string.reverse == string\r\nend", "def palindrome?(string)\r\n string.reverse == string\r\nend", "def palindrome?(string)\r\n string.reverse == string\r\nend", "def palindromes(str)\n evaluated_words = substrings(str)\n evaluated_words.select { |char| char.size > 1 && char == char.reverse }\nend", "def isPalindrome(string)\n return string.reverse == string\nend", "def palindrome('')\n if string == string.reverse\n return true\n else\n puts \"String is not a palindrome\"\n end\nend", "def palindrome?(werd)\n werd == werd.reverse\nend", "def is_palindrome(s)\n return true if s.empty?\n return false if s[0] != s[-1]\n return is_palindrome(s[1...-1])\n \n # To do this without creating new strings, make a helper method\n # that accepts additional parameters for left_char and right_char and increments\n # them inward each time, like I did for reverse_in_place with helper_reverse\nend", "def is_palindrome?(word)\n if word == word.reverse\n return true\n else\n return false\n end\nend", "def palindrome?( num )\n num.to_s == num.to_s.reverse\nend", "def is_palindrome = 'racecar'", "def palindrome?(string)\n\nend", "def palindrome?(string)\n\nend", "def is_palindrome?(n)\n n.to_s == n.to_s.reverse\n end", "def palindrome?(input)\n input == input.reverse\nend", "def palindrome?(input)\n input == input.reverse\nend", "def palindrome?(input)\n input == input.reverse\nend", "def palindrome?(input)\n input == input.reverse\nend", "def real_palindrome?(string)\n # clean_string = string.downcase.delete(\"^a-z0-9\")\n clean_string = string.downcase.gsub(/[^a-z0-9]/, '')\n puts clean_string\n clean_string == clean_string.reverse\nend", "def palindrome?(str)\n str == str.reverse \nend", "def palindrome? (a)\n\ts = a.to_s\n\ts == s.reverse\nend", "def is_palindrome(x)\n result = x.to_s.split(\"\")\n\n left = 0\n right = result.length - 1\n return true if left == right\n while left < right\n if result[left] == result[right]\n left += 1\n right -= 1\n else\n return false\n end\n end\n return true\nend", "def is_a_palindrome?(string)\n if string == string.reverse\n return true #can be also return string, in that case we will get the string printed\n else\n p \"This string is not a palindrome.\"\n end\nend", "def palindrome?(string)\n array = string.chars\n string.chars == array.reverse\nend", "def palindrome string\n if string.downcase == string.downcase.reverse\n \"#{string} is a palindrome\"\n else\n \"#{string} is not a palindrome\"\n end\nend", "def isPalindrome (s)\n return s.gsub(/\\s+/, \"\") == s.gsub(/\\s+/, \"\").reverse\nend", "def is_palindrome?(number)\n number.to_s == number.to_s.reverse\nend", "def palindrome?(word)\n counter = 0\n total = []\n word.size.times do\n result = word[counter] == word[-(counter + 1)]\n total << result if result == true\n end\n total.size == word.size ? true : false\nend", "def palindrome(str)\n if str.reverse == str\n puts true\n else\n puts 'not palindrome'\n end\nend", "def palindrome?(str)\r\n str == str.reverse\r\nend", "def palindromic?(x)\n x.to_s == x.to_s.reverse\nend", "def palindrome_tester(s)\n result = false\n if s == s.reverse\n result = true\n return result\n else\n result = false\n return result\n end\n end", "def palindrome?\n self == self.reverse\n end", "def palindrome?(string)\n newRevString = \"\"\n idx = string.length-1\n while idx >= 0\n newRevString = newRevString + string[idx]\n idx = idx - 1\n end\n return newRevString==string\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string == string.reverse\nend", "def palindrome?(string)\n string.reverse == string\nend", "def palindrome?(string)\n string.reverse == string\nend", "def palindrome?(string)\n string.reverse == string\nend", "def is_palindrome(str)\n return str == str.reverse\nend" ]
[ "0.78215855", "0.77056116", "0.74646527", "0.74529034", "0.73807824", "0.73807824", "0.69562006", "0.677419", "0.6742182", "0.67274034", "0.6726408", "0.6698095", "0.66943634", "0.6660575", "0.6643621", "0.6636674", "0.66109383", "0.65968305", "0.65919346", "0.6576927", "0.65575063", "0.65105885", "0.65068114", "0.6476891", "0.64710164", "0.6465161", "0.6464512", "0.6456959", "0.64503425", "0.64473295", "0.64349234", "0.64347374", "0.64338833", "0.64255935", "0.64230335", "0.6422892", "0.6410301", "0.6404383", "0.64022917", "0.6396903", "0.63939106", "0.6384098", "0.63831294", "0.6379075", "0.6372615", "0.63724804", "0.63704026", "0.63665795", "0.6362729", "0.63601935", "0.63504094", "0.63504094", "0.6334447", "0.6334447", "0.6334447", "0.6322521", "0.63207185", "0.6310027", "0.63085216", "0.6304455", "0.63043046", "0.6303204", "0.6300799", "0.6292099", "0.6292099", "0.6290997", "0.62897605", "0.62897605", "0.62897605", "0.62897605", "0.62853307", "0.62834823", "0.62827075", "0.62796277", "0.626486", "0.62604076", "0.6260175", "0.6257983", "0.6256258", "0.6253529", "0.62531364", "0.6251848", "0.62482625", "0.6245567", "0.6245064", "0.6236129", "0.6234599", "0.6234599", "0.6234599", "0.6234599", "0.6234599", "0.6234599", "0.6234599", "0.6234599", "0.6234599", "0.6234599", "0.6234599", "0.6230052", "0.6230052", "0.6230052", "0.62206846" ]
0.0
-1
POST Modifies the starting location. Used for Kiosk mode.
def origin unless params[:origin].blank? params[:origin].slice!(0) if params[:origin][0].upcase == "R" # Remove proceeding R if present origin = params[:origin].to_s.rjust(4, '0').prepend("R") # Add zero padding and Prepend R session[:start] = origin cookies.permanent[:origin] = origin.upcase cookies.delete :start_location notice = "Origin successfully updated to: #{cookies[:origin]}" else cookies.delete :origin notice = "Origin successfully cleared" end respond_to do |format| format.json { render :json => { origin: cookies[:origin], notice: notice } } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start\n unless params[:location].blank? or cookies[:origin].present?\n params[:location].slice!(0) if params[:location][0].upcase == \"R\" # Remove proceeding R if present\n start_location = params[:location].to_s.rjust(4, '0').prepend(\"R\") # Add zero padding and Prepend R\n cookies.permanent[:start_location] = start_location.upcase\n end\n\n redirect_to root_path\n end", "def start\n unless params[:origin].blank?\n params[:origin].slice!(0) if params[:origin][0].upcase == \"R\" # Remove proceeding R if present\n origin = params[:origin].to_s.rjust(4, '0').prepend(\"R\") # Add zero padding and Prepend R\n session[:start] = origin.upcase\n end\n\n redirect_to \"/map\"\n end", "def store_location!\n session[\"return_to\"] = request.env[\"warden.options\"][:attempted_path] if request.get?\n end", "def update_pref\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n desktop = Desktop.get_for(@login_user, true)\n\n params[:desktop].delete(:user_id)\n\n desktop.update_attributes(params.require(:desktop).permit(Desktop::PERMIT_BASE))\n\n params.delete(:desktop)\n\n show\n render(:action => 'show')\n end", "def create_curr_location \n if @@form_step == nil \n redirect_to root_path \n end\n if @@form_step == 1 \n @latitude = params[:latitude] \n @longitude = params[:longitude] \n @loc = params[:loc]\n @@request.lat_curr = @latitude \n @@request.long_curr= @longitude \n @@request.currentLoc= @loc\n redirect_to url_for(:controller => \"requests\", :action => \"home\")\n else \n @latitude = params[:latitude] \n @longitude = params[:longitude] \n @destination = params[:loc]\n @@request.lat_destination = @latitude \n @@request.long_destination= @longitude \n @@request.destination= @destination\n unless (@@request.long_curr == nil)\n @@request.distance = distance(@@request.long_curr,@@request.lat_curr,@@request.long_destination,@@request.lat_destination)\n end\n redirect_to url_for(:controller => \"requests\", :action => \"create_route\") \n\n end \n end", "def set_home_location_lat\n unless [:post, :put].include?(request.method) then\n return render(:text => 'Method not allowed', :status => 405)\n end\n @current_project.home_location_lat = params[:value]\n @current_project.save!\n render :text => CGI::escapeHTML(@current_project.home_location_lat.to_s)\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n #request.get? prevents saving patch\n #e.g. user deletes cookies and submits edit post\n end", "def set_Location(value)\n set_input(\"Location\", value)\n end", "def home \n\n if @@form_step == nil \n redirect_to root_path and return \n end\n @@request.user_id = current_user.id \n @@form_step = @@form_step + 1 \n\n end", "def store_location\n\t\t\tsession[:return_to] = request.fullpath\n\t\tend", "def set_boot_location(opts)\n opts = check_params(opts,[:location])\n super(opts)\n end", "def store_location\n\t\tsession[:return_to] = request.fullpath\n\tend", "def store_location\n\t\tsession[:return_to] = request.fullpath\n\tend", "def store_location\n\t\t\tsession[:return_to] = request.fullpath\n\t end", "def set_login_waypoint\n session[:login_waypoint] = params[:url]\n render :text => 'true'\n end", "def create\n current_user.update(location_params)\n\n if current_user.save\n render action: 'show', status: :ok, location: current_user\n else\n render json: current_user.errors, status: :unprocessable_entity\n end\n end", "def create\n @location = Location.new(params[:location])\n \n @location.location = current_location\n @location.location_type = \"shelf\"\n \n respond_to do |format|\n if @location.save\n format.html { redirect_to current_location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def start_post\n request_file_path\n ipa_file_path = get_file_path\n request_notes\n release_notes = get_notes\n distribution_list = get_distribution_list #calls the fetch && confirm methods\n post_app(get_conf('end_point'), get_conf('api_key'), get_conf('team_key'), ipa_file_path, release_notes, distribution_list)\n end", "def store_location\n\t\t#Store target location (only if request=get). (For example, if user request a page but\n\t\t# it's not signed in. It remembers the request)\n\t\tsession[:return_to] = request.url if request.get?\n\tend", "def set_location\n\t current_user.update_location(params[:longitude], params[:latitude])\n respond_to do |format|\n format.js {render :nothing => true }\n end\n end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end" ]
[ "0.6110914", "0.5793921", "0.5705552", "0.5650262", "0.55903393", "0.5515551", "0.53945667", "0.53575295", "0.53048974", "0.5268503", "0.52399457", "0.521427", "0.521427", "0.51967525", "0.51783925", "0.5168158", "0.5166256", "0.5159487", "0.5148909", "0.5127986", "0.5120559", "0.5120559", "0.5120559", "0.5120559", "0.5120559", "0.5120559", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886", "0.511886" ]
0.0
-1
GET Modifies the starting location passed via URL (QR Codes) Passes starting location as the room number Redirects immediately to Map
def start unless params[:origin].blank? params[:origin].slice!(0) if params[:origin][0].upcase == "R" # Remove proceeding R if present origin = params[:origin].to_s.rjust(4, '0').prepend("R") # Add zero padding and Prepend R session[:start] = origin.upcase end redirect_to "/map" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @mapURL = map_url(@location.address)\n render :show\n end", "def location\n @client.get(\"#{path}/location\")\n end", "def get_by_location\n \tlat = params[:lat]\n \tlng = params[:lng]\n \tnext_start = params[:next_start]\n \tshops = Hotpepper.search_location(lat, lng, next_start);\n \tset_to_results(shops);\n end", "def show_map(lat, long, path)\n map_params = {\n :settings => {:map_type => \"standard\",:region => [lat, long, 0.2, 0.2],\n :zoom_enabled => true,:scroll_enabled => true,:shows_user_location => false,\n :api_key => GOOGLE_MAPS_API_KEY},\n \n :annotations => [{\n :latitude => lat, \n :longitude => long, \n :title => Localization::Request[:address], \n :subtitle => \"I am here\",\n :url => url_for(:action => :request_rental)\n }]\n }\n MapView.create map_params\n WebView.navigate url_for :action => :request\n end", "def start\n unless params[:location].blank? or cookies[:origin].present?\n params[:location].slice!(0) if params[:location][0].upcase == \"R\" # Remove proceeding R if present\n start_location = params[:location].to_s.rjust(4, '0').prepend(\"R\") # Add zero padding and Prepend R\n cookies.permanent[:start_location] = start_location.upcase\n end\n\n redirect_to root_path\n end", "def get_room_stuff(pos)\r\n my_port = 8083\r\n room_map_message = \"/maps/#{$roomnumber}/#{pos}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{room_map_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n if my_json[\"east\"]\r\n return my_json[\"east\"]\r\n \r\n elsif my_json[\"west\"]\r\n return my_json[\"west\"]\r\n\r\n elsif my_json[\"north\"]\r\n return my_json[\"north\"]\r\n\r\n elsif my_json[\"contents\"]\r\n return my_json[\"contents\"]\r\n\r\n elsif my_json[\"south\"]\r\n return my_json[\"south\"]\r\n\r\n elsif my_json[\"down\"]\r\n return my_json[\"down\"]\r\n\r\n elsif my_json[\"up\"]\r\n return my_json[\"up\"] \r\n end\r\nend", "def viewMap(address, to_lat, to_lng, callback)\n puts \"viewMap(address:#{address}, to_lat:#{to_lat}, to_lng:#{to_lng}, callback:#{callback}\"\n\n if GeoLocation.known_position?\n from_lat = GeoLocation.latitude\n from_lng = GeoLocation.longitude\n else\n from_lat = 34.3932857\n from_lng = 132.4705439\n from_lat = 34.4893270\n from_lng = 133.3614320\n from_lat = 35.005018\n from_lng = 135.889155\n end\n\n if callback\n #GeoLocation.set_notification(url_for(:action => :geo_callback), \"\")\n GeoLocation.set_notification(callback, \"\")\n end\n\n puts \"from:#{from_lat},#{from_lng} => to:#{to_lat},#{to_lng}\"\n puts \"distance: #{GeoLocation.haversine_distance(from_lat,from_lng,to_lat,to_lng)}\"\n\n #region = [@params['latitude'], @params['longitude'], 1/69.0, 1/69.0] #miles\n #region = [@params['latitude'], @params['longitude'], 1/111.0, 1/111.0] #km\n region = [(to_lat + from_lat) / 2, (to_lng + from_lng) / 2,\n (to_lat - from_lat).abs, (to_lng - from_lng).abs]\n\n url = \"http://maps.google.jp/maps/api/directions/json?\" +\n \"origin=#{from_lat},#{from_lng}&\" +\n \"destination=#{to_lat},#{to_lng}&\" +\n \"mode=walking&\" +\n \"language=ja&\" +\n \"sensor=true\"\n #puts url\n\n res2 = Rho::AsyncHttp.get(\n :url => url,\n #:headers => {\"Cookie\" => cookie},\n )\n #puts res2.inspect\n #puts res2[\"status\"]\n\n# if res2[\"status\"] == \"ok\"\n# end\n\n myannotations = []\n\n #puts res2[\"body\"].inspect\n #puts res2[\"body\"][\"status\"]\n #puts res2[\"body\"][\"routes\"].size\n #puts res2[\"body\"][\"routes\"][0][\"legs\"].size\n #puts res2[\"body\"][\"routes\"][0][\"legs\"][0][\"steps\"].size\n\n res2[\"body\"][\"routes\"][0][\"legs\"][0][\"steps\"].each do |step|\n #puts step.inspect\n\n title = step[\"html_instructions\"]\n title = title.gsub(/\\<\\/?[bB]\\>/, \"\")\n #puts title\n\n myannotations << {\n :latitude => step[\"start_location\"][\"lat\"],\n :longitude => step[\"start_location\"][\"lng\"],\n :title => title,\n :subtitle => step[\"distance\"][\"text\"],\n #:url => \"/app/GeoLocation/show?city=Original Location\",\n #:image => '/public/images/marker_blue.png', :image_x_offset => 8, :image_y_offset => 32\n }\n end\n\n myannotations << {\n :latitude => to_lat,\n :longitude => to_lng,\n :title => address,\n #:subtitle => @params['map']['address'],\n #:url => \"/app/GeoLocation/show?city=Original Location\"\n }\n\n map_params = {\n #:provider => \"Google\",\n :provider => \"ESRI\",\n :settings => {\n #:map_type => \"roadmap\",\n :map_type => \"standard\",\n :region => region,\n :zoom_enabled => true, :scroll_enabled => true, :shows_user_location => true,\n #:api_key => '0jDNua8T4Teq0RHDk6_C708_Iiv45ys9ZL6bEhw'\n },\n :annotations => myannotations\n }\n\n #puts map_params.inspect\n puts \"-------------------------\"\n MapView.create map_params\n end", "def get_some_room_stuff(roomnumberone,pos)\r\n my_port = 8083\r\n room_map_message = \"/maps/#{roomnumberone}/#{pos}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{room_map_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n if my_json[\"east\"]\r\n return my_json[\"east\"]\r\n \r\n elsif my_json[\"west\"]\r\n return my_json[\"west\"]\r\n\r\n elsif my_json[\"north\"]\r\n return my_json[\"north\"]\r\n\r\n elsif my_json[\"contents\"]\r\n return my_json[\"contents\"]\r\n\r\n elsif my_json[\"south\"]\r\n return my_json[\"south\"]\r\n\r\n elsif my_json[\"down\"]\r\n return my_json[\"down\"]\r\n\r\n elsif my_json[\"up\"]\r\n return my_json[\"up\"] \r\n end\r\nend", "def get_location\n\n end", "def show\n Project.hit 4\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location, callback: params[:callback] }\n format.xml { render xml: @location }\n end\n end", "def show_next_pass(latitude, longitude)\n result = call_api(\"/iss-pass.json?lat=#{latitude}&long=#{longitude}\")\n puts(\"The next ISS pass for #{result['request']['latitude']} #{result['request']['longitude']} is #{result['response'][0]['risetime']} for #{result['response'][0]['duration']} seconds\")\nend", "def nearby_geo_callback1\n\t\twebview_navigate_for_type(:index) if @params[\"known_position\"].to_i != 0 && @params[\"status\"] == \"ok\"\n \t# Try again if the first call failed, seems to be needed on the simulator...\n \tif @params[\"known_position\"].to_i == 0 || @params[\"status\"] != \"ok\" \n\t\t\tGeoLocation.set_notification( url_for_type(:action => :nearby_geo_callback2), default_query_hash_str, GeoTimeout) \n\t\t\tredirect_for_type :action => :wait, :query => { :message => \"Finding location...\" }\n\t\tend\n\tend", "def send_request\n if latitude && longitude\n response = RestClient::Request.execute(\n method: :get,\n url: \"http://climateapi.scottpinkelman.com/api/v1/location/#{latitude}/#{longitude}\"\n )\n parsed = JSON.parse(response)\n self.climate_zone = parsed[\"return_values\"][0][\"koppen_geiger_zone\"]\n else\n p \"Unable to get geocoding location\"\n end\n end", "def full_location; end", "def requests_on_map\n params[:listing_type] = \"request\"\n @to_render = {:action => :index}\n @listings = Listing.open.order(\"created_at DESC\").find_with(params, @current_user, @current_community)\n @listing_style = \"map\"\n load\n end", "def viewMapByAddress(address, callback)\n puts \"viewMapByAddress(address:#{address}, callback:#{callback}\"\n\n url = \"http://maps.google.com/maps/api/geocode/json?\" +\n \"address=#{address}&\" +\n \"sensor=true\"\n #puts url\n\n res = Rho::AsyncHttp.get(\n :url => url,\n #:headers => {\"Cookie\" => cookie},\n )\n #puts res.inspect\n\n if res[\"status\"] == \"ok\" # && res[\"body\"][\"status\"] == \"OK\"\n #puts res[\"body\"].inspect\n #puts res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n #puts res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\n to_lat = res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n to_lng = res[\"body\"][\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n else\n to_lat = '34.4893270'\n to_lng = '133.3614320'\n end\n\n viewMap address, to_lat, to_lng, callback\n end", "def partner_location\n @partner = Partner.find(@params['id'])\n \n #Using Open Source Maps (This is used by MapQuest)\n map_params = {\n :provider => 'OSM', \n :settings => {:map_type => \"roadmap\", :region => [@partner.lat,@partner.long, 0.2, 0.2],\n :zoom_enabled => true, :scroll_enabled => true, :shows_user_location => false}, \n :annotations => [{:latitude => @partner.lat, :longitude => @partner.long, :title => \"PRELOAD MARKER\"}]\n }\n \n #Using Google Static API maps\n #map_params = {\n # :provider => 'RhoGoogle', \n # :settings => {:map_type => \"roadmap\", :region => [40.994705,-77.604546, 0.2, 0.2],\n # :zoom_enabled => true, :scroll_enabled => true, :shows_user_location => true}, \n # :annotations => [{:latitude => 40.994705, :longitude => -77.604546, :title => \"PRELOAD MARKER\"}]\n #}\n MapView.create map_params\n \n render :back => url_for( :action => :index)\n end", "def show\n slug = params[:id]\n @location = Location.find_by_slug(slug)\n\n unless @location\n slug_redirect = SlugRedirect.find_by_slug(slug)\n\n if slug_redirect\n redirect_to location_path(slug_redirect.location.slug), :status => :moved_permanently and return\n end\n\n raise ActiveRecord::RecordNotFound.new(\"No such club: #{params[:id]}\")\n end\n\n respond_to do |format|\n format.html do\n @title = @location.name\n\n @map = create_map(@location)\n\n pushpin_for_club(@location, :show_info_window => true) if @map\n end\n format.xml { render :xml => @location }\n end\n end", "def geocoder\n begin\n render(:json => open(\"#{GEOCODER_URL}&#{request.query_string}\"){|f| f.read})\n rescue SocketError\n render(:text => $!.to_s, :status => 500)\n end\n end", "def coordinates_url latitude, longitude\n \"https://www.google.com/maps/search/?api=1&query=#{latitude}%2C#{longitude}\"\n end", "def show\n @location_url_map = LocationUrlMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_url_map }\n end\n end", "def event_get_location_details\n @loc = Apis::HereApi.new(\"\").get_location_details(params[:locationid])\n render json: @loc\n end", "def locations(place)\n get :loc => place\n end", "def httpget_geo_callback\n if @params['body']['results'] && @params['body']['results'].length > 0\n address = @params['body']['results'][0]['formatted_address'] \n accuracy = @params['accuracy'].to_i.to_s\n WebView.execute_js('setFieldValue(\"location\",\"'+address+' \\n('+Localization::Request[:accuracy]+' = '+accuracy+' '+Localization::Request[:meter]+')\");')\n Alert.hide_popup \n elsif @params['body']['status']\n WebView.execute_js('setFieldValue(\"location\",\"'+@params['body']['status']+' accuracy = '+@params['accuracy']+'\");')\n Alert.hide_popup \n else\n WebView.execute_js('setFieldValue(\"location\",\"'+@params['body'].to_s+'\");')\n Alert.hide_popup \n end\n end", "def locate(latitude,longitude)\n get escape(\"lat=#{latitude}&lon=#{longitude}\")\n end", "def locate(address)\n get :location => address\n end", "def getLocation\n loc = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/geocode/json\",\n :query_values => {:address => \"160+Folsom,+San+Francisco,+CA\",\n :sensor => \"false\"}).to_s\n\n location_request = RestClient.get(loc)\n parsed_location_request = JSON.parse(location_request)\n\n lat = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lat\"].to_s\n lng = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lng\"].to_s\n\n [lat,lng]\nend", "def show\n Project.hit 31\n @location = IphoneLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n format.xml { render xml: @location }\n end\n end", "def locationManager manager, didUpdateToLocation: new, fromLocation: old\n coordinate = new.coordinate\n size = @webView.bounds.size\n\n params = {\n markers: 'color:blue|%s,%s' % [coordinate.latitude, coordinate.longitude],\n zoom: 14,\n size: '%dx%d' % [size.width, size.height],\n sensor: 'false'\n }\n\n url = \"http://maps.googleapis.com/maps/api/staticmap?#{encodeParams params}\"\n\n loadUrl url\n end", "def show\n @location = Location.find_by_slug(params[:id])\n\n respond_to do |format|\n format.html do\n @title = @location.name\n\n @map = GMap.new(\"map_div\")\n @map.control_init(:large_map => true,:map_type => true)\n if(@location.precision == :address)\n @map.center_zoom_init([@location.lat,@location.lng],15)\n else\n @map.center_zoom_init([@location.lat,@location.lng],12)\n end\n\n info_window = render_to_string :partial => \"gmap_info_window\",\n :locals => {:location => @location}\n info_window.gsub!(/\\n/, '')\n\n club = GMarker.new([@location.lat,@location.lng],\n :info_window => info_window)\n @map.record_global_init(club.declare(\"club\"))\n @map.overlay_init(club)\n @map.record_init(\"club.openInfoWindowHtml(\\\"#{club.info_window}\\\");\\n\")\n end\n format.xml { render :xml => @location }\n end\n end", "def location_bar\n\tresult = Geocoder.search(\"#{params['latitude']},#{params['longitude']}\")\n\taddress = result.first.data[\"formatted_address\"]\n\trender html: address\nend", "def slurl\n position = JSON.parse(self.position)\n href = \"https://maps.secondlife.com/secondlife/#{region}/#{position['x'].round}/\" \\\n \"#{position['y'].round}/#{position['z'].round}/\"\n text = \"#{region} (#{position['x'].round}, \" \\\n \"#{position['y'].round}, #{position['z'].round})\"\n h.link_to(text, href)\n end", "def full_url\n mini_url = MiniUrl.find_by(url_code: params[:url_code])\n # raise not found exception for url code not present in db\n unless mini_url\n raise Exceptions::EmptyObjectError.new('Unable to find url for redirection.')\n end\n render location: mini_url.url, status: 307\n # increase redirect count and update after responding with actual url\n mini_url.redirect_count += 1\n unless mini_url.update\n logger.error \"Some error in updating redirect count for mini url - #{mini_url.url_code}\"\n end\n rescue Exceptions::EmptyObjectError => e\n render json: {error: e}, status: 404\n end", "def get( lat, long )\n @curl.http_post(\n Curl::PostField.content( 'appid', YahooGeo::api_key ),\n Curl::PostField.content( 'autoDisambiguate', 'true' ),\n Curl::PostField.content( 'outputType', 'xml' ),\n Curl::PostField.content( 'documentType', 'text/html' ),\n Curl::PostField.content( 'documentContent', \"<meta name=\\\"ICBM\\\" content=\\\"#{lat}, #{long}\\\">\" )\n )\n\n if @curl.response_code != 200 then\n # there must be a better way to get the response message\n h = @curl.header_str.split(/\\r\\n/)[0].split\n msg = h[2..h.length].join( ' ' )\n parse_error( @curl.response_code, msg )\n else\n @curl.body_str\n end\n end", "def locationManager manager, didUpdateToLocation: new, fromLocation: old\n coordinate = new.coordinate\n size = webView.bounds.size\n\n params = {\n markers: 'color:blue|%s,%s' % [coordinate.latitude, coordinate.longitude],\n zoom: 14,\n size: '%dx%d' % [size.width, size.height],\n sensor: 'false'\n }\n\n url = \"http://maps.googleapis.com/maps/api/staticmap?#{encodeParams params}\"\n\n loadUrl url\n end", "def show\n #@place = Place.find(params[:id])\n # get the current location from incming parameters\n if is_iphone_request? \n \n current_lat = params[:current_lat].to_f\n current_lng = params[:current_lng].to_f\n # caculate the boundary of rectangle \n lat_NE = current_lat + 5/111.0\n lng_NE = current_lng + 5/111.0\n lat_SW = current_lat - 5/111.0\n lng_SW = current_lng - 5/111.0\n \n # run query from place database \n @place = Place.find(:all, \n :conditions => [\"longtitude BETWEEN ? and ? and latitue BETWEEN ? and ?\",lng_SW, lng_NE,lat_SW, lat_NE])\n \n #\"and (places.longtitude between lng_NE and lng_SW)\"\n \n else\n \n current_lat = params[:current_lat].to_f\n current_lng = params[:current_lng].to_f\n \n #run query to see if can find the matched places \n @place = Place.find(:all, \n :conditions => [\"longtitude = ? and latitue = ?\", current_lng, current_lat])\n \n end \n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place }\n format.js\n format.json { render :layout => false,\n :json =>@place.to_json}\n end\n end", "def show\n @qrcode = Qrcode.find(params[:id])\n params[:quest_id]\n if @qrcode.imgloc == nil\n @qrcode.imgloc = request.protocol+request.host_with_port+request.fullpath+\".png\"\n @qrcode.save\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qrcode }\n format.png { render :qrcode => @qrcode.ref }\n end\n end", "def url\n map_datum.url.split(\"?\").first\n end", "def location_history(params = {})\n @client.get(\"#{path}/location/waypoints\", params)\n end", "def get_me_home(lat, lon)\n # hit trimet trip planner to get home\n # https://developer.trimet.org/ws/V1/trips/tripplanner\n fromCoord = \"#{lon},#{lat}\"\n toCoord = \"#{@home[1]},#{@home[0]}\"\n uri = URI.parse( \"#{@@trimet_planner_url}?fromCoord=#{fromCoord}&toCoord=#{toCoord}&min=X&appID=#{@trimet_api_key}\" )\n response = Net::HTTP.get_response(uri)\n do_some_stuff_with_trimet_response response.body\n end", "def index\n if params[:address].present?\n @q = Restroom.near(params[:address], 60, order: :distance).search(params[:q])\n @restrooms = @q.result(distinct: true).page(params[:page]).per(5)\n @search_coordinates = Geocoder.coordinates(params[:address])\n @is_search = true\n else\n @q = Restroom.near(request.remote_ip, 60, order: :distance).search(params[:q])\n @restrooms = @q.result(distinct: true).page(params[:page]).per(5)\n @search_coordinates = Geocoder.coordinates(request.remote_ip)\n @is_search = false\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restrooms }\n end\n end", "def show\n begin\n \n @location = Location.find(params[:id])\n @person = @location.person\n @nodes = Node.find(:all, :conditions => [\"location_id=?\", params[:id]] )\n @nets = Nets.find(:all, :conditions => [\"location_id=?\", params[:id]] )\n @googlemap = 'https://karte.graz.funkfeuer.at/?'\n @googlemap += \"lng=#{@location.lon}\"\n @googlemap += \"&lat=#{@location.lat}\"\n @googlemap += \"&res=17\"\n @googlemap += \"&marker=all\"\n\n rescue ActiveRecord::RecordNotFound\n flash[:notice] = \"Error, Location with ID #{params[:id]} not found!\"\n redirect_to :action => 'list'\n end\n end", "def get_print_url()\n points = self.arrOfPoints \n #coordinates of the retailer hardcoded at [30.199,31.002]\n url = \"http://maps.google.com/maps?f=d&source=s_d&saddr=30.199,31.002\" \n len = points.size\n len.times do |i|\n if i == 0\n url << \"&daddr=\"\n end\n url << arrOfPoints[i]*\",\".sub( \" \", \"+\" )\n if i != (len - 1) \n url << \"+to:\" \n end\n end\n url << \"+to:30.199,31.002&ie=UTF8&z=10&pw=2&hl=en\" \n return url\n end", "def location\n\t\t@location\n\tend", "def show\n if can?(:>=, \"5\")\n @location = Kitting::Location.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n else\n redirect_to main_app.unauthorized_url\n end\n end", "def goto_url(url)\n response = Net::HTTP.get_response(URI.parse(url))\n status = response.code.to_i\n \n if status >= 300 and status < 400\n url = response['Location']\n # TODO - put general url beggining instead\n url = \"http://magiccards.info\" + url unless url.start_with?('http://')\n goto_url(url)\n else\n return url, response.body\n end\n end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end" ]
[ "0.6155691", "0.585538", "0.5851553", "0.58069074", "0.57812464", "0.5770744", "0.57235765", "0.57201725", "0.5680059", "0.55999684", "0.55897725", "0.5575051", "0.5547962", "0.55264217", "0.5519914", "0.5516726", "0.54907876", "0.5490285", "0.54848766", "0.5468661", "0.5456708", "0.54478693", "0.54303235", "0.5421991", "0.5417887", "0.5384981", "0.53732455", "0.53706783", "0.5364506", "0.5358554", "0.5346246", "0.5333845", "0.53292894", "0.5328806", "0.5315544", "0.5312599", "0.53097826", "0.53022194", "0.53004014", "0.52963996", "0.5288769", "0.52794904", "0.5271418", "0.5270655", "0.52611065", "0.5247559", "0.52396184", "0.52396184", "0.52396184", "0.52396184", "0.52396184", "0.52396184", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222", "0.5239222" ]
0.66142786
0
POST /logvisitor Logs a visitor. Called from redirect.js, which redirects to home after 2 minutes of inactivity. Logs a visitor after one minute of inactivity.
def logvisitor @visitor.end = DateTime.current @visitor.save render :nothing => true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_visit\n session_id = request.session_options[:id]\n client = DeviceDetector.new(request.env[\"HTTP_USER_AGENT\"])\n client_os = client.os_name\n if !VisitorLog.find_by_session_id(session_id)\n VisitorLog.create(:session_id => session_id, :logged_in => false, :device_type => client_os)\n end\n\n if VisitorLog.find_by_session_id(session_id)\n log = VisitorLog.find_by_session_id(session_id)\n if !log.logged_in && logged_in?\n log.update_attribute(\"logged_in\", true)\n log.save\n end\n\n if logged_in? && current_user.department_id.present? && log.department_id.nil?\n log.update_attribute(\"department_id\", current_user.department_id)\n log.save\n end\n end\n\n end", "def logVisit record=nil, rateable=false\n return if !valid_browser?(request.user_agent) or valid_robot?(request.user_agent)\n\n user_id = user_signed_in? ? current_user.id : nil\n record_class = record_id = nil\n record_class = record.class.to_s unless record.nil?\n record_id = record.id unless record.nil?\n LogVisitWorker.perform_async(request.user_agent, request.remote_ip, user_id, Time.now, record_class, record_id, rateable)\n \n# Thread.new do\n# #Wait 10 seconds to allow the request to be returned before starting. This saves the request some time.\n# #On development using Webrick, if we wait too long and another thread gets created this one gets killed.\n# #Should be good on production.\n# sleep 10\n\n# ip_address = logIpAddress #First log IpAddress\n \n# record.register_visit_by(ip_address)\n\n# return unless rateable\n# #If the user is not the author then record statistics about how much they viewed the record\n# if user_signed_in? && record.user != current_user\n#\trecord.register_view_by(current_user)\n# end\n# end\n end", "def log_visit\n if !session[:logged_visit] && session[:logged_visit]=true\n behavior = behavior_cookie\n\n if !defined?(behavior[\"visits\"]) || !(behavior[\"visits\"].is_a? Integer)\n behavior[\"visits\"] = 1\n else\n behavior[\"visits\"] += 1\n end\n\n cookies.permanent[:behavior] = behavior.to_json\n end\n end", "def track_visitor\n visitor_cookie_name = \"teaser.#{@teaser.id}.visitor\"\n if cookies[visitor_cookie_name].blank? || (@visitor = @teaser.visitors.find_by_cookie(cookies[visitor_cookie_name])).nil?\n @visitor = @teaser.visitors.create!\n install_persistent_cookie(visitor_cookie_name, @visitor.cookie)\n end\n \n if recent_visit = @visitor.visits.last(:conditions => ['visited_at > ?', 1.hour.ago])\n recent_visit.update_attribute(:visited_at, Time.now)\n else\n @visitor.visits.create!\n end\n end", "def register_visit\r\n if @debug\r\n puts \"REQUEST IN REGISTER VISIT: #{request}\"\r\n puts \"BODY REQUEST: #{request.body}\"\r\n puts \"AUTH REQUEST: #{request.authorization}\"\r\n puts \"LENGTH REQUEST: #{request.content_length}\"\r\n puts \"FORM DATA REQUEST: #{request.form_data?}\"\r\n puts \"FULLPATH REQUEST: #{request.fullpath}\"\r\n puts \"HEADERS REQUEST: #{request.headers}\"\r\n puts \"IP REQUEST: #{request.ip}\"\r\n puts \"REQUEST IP ADDRESS: #{request['ip_address']}\"\r\n puts \"REQUEST REMOTE IP: #{request['remote_ip']}\"\r\n end\r\n response = @mints_pub.register_visit(request)\r\n if @debug\r\n puts \"RESPONSE IN REGISTER VISIT: #{response}\"\r\n end\r\n @contact_token = response['contact_token'] ? response['contact_token'] : response['user_token']\r\n @visit_id = response['visit_id']\r\n if @debug\r\n puts \"VISIT ID: #{@visit_id}\"\r\n end\r\n cookies.permanent[:mints_contact_id] = { value: @contact_token, secure: true, httponly: true }\r\n cookies.permanent[:mints_visit_id] = { value: @visit_id, secure: true, httponly: true }\r\n end", "def perform(user_agent, remote_ip, user_id, timestamp, record_class, record_id)\n logForemVisit(user_agent, remote_ip, user_id, timestamp, record_class, record_id)\n end", "def visit!\n self.duration = [(Time.now - self.updated_at).to_i, 15 * 30].min # if user stay on page more than 15 min\n self.visits += 1\n self.save!\n end", "def record_login(user)\n self.current_site_visitor = GreenFlag::SiteVisitor.for_user!(user, current_site_visitor)\n end", "def establish_session(request)\n #puts \"Request for: #{request.url} - running before...\"\n if ((session[:ip_address] != request.ip) or\n (session[:created_at] < (Time.now() - 60 * 20))) # Session older than 20 minutes?\n #puts \"This looks like a new user!\"\n session[:ip_address] = request.ip\n session[:created_at] = Time.now()\n user_id = DB[:users].insert(:ip_address => request.ip,\n :referrer => request.referrer,\n :created_at => session[:created_at])\n session[:user_id] = user_id\n redirect \"/survey/step/1\", 302\n end\nend", "def log_funnel_page_visit\n log_funnel_event(:view_page)\n end", "def visit\n self.update(last_visit: DateTime.now);\n self.update(visit_count: (self.visit_count + 1));\n end", "def log_view(url, manual_expiration: false)\n record = {}\n\n # 0 - standard user view\n # 1 - manual expiration\n record[:kind] = manual_expiration ? 1 : 0\n\n record[:user_id] = current_user.id if user_signed_in?\n record[:ip] = request.env['HTTP_X_FORWARDED_FOR'].nil? ? request.env['REMOTE_ADDR'] : request.env['HTTP_X_FORWARDED_FOR']\n\n # Limit retrieved values to 256 characters\n record[:user_agent] = request.env['HTTP_USER_AGENT'].to_s[0, 255]\n record[:referrer] = request.env['HTTP_REFERER'].to_s[0, 255]\n\n record[:successful] = url.expired ? false : true\n\n url.views.create(record)\n url\n end", "def create\n @visitor = Analytics::Visitor.new(params[:visitor])\n\n respond_to do |format|\n if @visitor.save\n flash[:notice] = 'Analytics::Visitor was successfully created.'\n format.html { redirect_to(@visitor) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def log_request(activity=nil)\n return if ! @logged.nil?\n @logged=true \n if current_user_model.blank? or current_user_model.id.blank? then\n the_id = -1\n else\n the_id = current_user_model.id\n end\n log_entry = Log.create( \n :investigator_id => the_id,\n :activity => activity || self.controller_name + \":\" + self.action_name,\n :controller_name => self.controller_name,\n :action_name => self.action_name,\n :created_ip => request.remote_ip,\n :params => params.inspect)\n log_entry.save\n end", "def activity_logger_end\n # Don't care about logging activity if the user is not registered\n# return if !session[:user]\n\n puts \"In: Logger End\"\n\n # In case the request is of type '2' = AJAX (dynamic), store 'session' information for content storage between\n # AJAX pages but don't record a database activity (making the transition faster)\n if Activity::activities[params[:action]] && Activity::activities[params[:action]][3] == 2\n \n # Store the AJAX data in the 'session' object under the general key ':params' with the 'page' being the 2nd 'key'\n# session[:params][params[:action]] = params\n end\n \n # If the current action & controller match the previous activity (i.e. the user has refreshed and clicked on a link\n # that takes them to the same page, the previous Activity will be updated with the 'updated_at' field ONLY\n if (session[:last_activity_o]) && \n (session[:last_activity_o].action == params[:action] && session[:last_activity_o].controller == params[:controller])\n session[:last_activity_o].touch\n return\n end\n \n # If current activity is of type 'secondary'\n \n # 1. Maintain 5 last links in the session object\n session[:last_5_urls] = Array.new(5) if !session[:last_5_urls]\n session[:last_5_urls].unshift(request.env[\"REQUEST_URI\"])\n session[:last_5_urls].pop if session[:last_5_urls].length > 5\n \n @activity = Activity::create_o(params, @friendly_names_h, session[:user])\n \n begin\n \n# @activity.save(false)\n \n # If current activity is of type 'primary', store it as primary\n # This will be used as a 'return_to' link when exiting a 'secondary' view\n if Activity::activities[params[:action]] && Activity::activities[params[:action]][3] == 1\n session[:last_primary_activity_o] = @activity\n \n # 2. In case current page is secondary (e.g Feedback, Contact Us etc) and there is no 'last_primary_activity' object in memory\n # E.g. user bookmarked the 'Provide Feedback' page and 2nd time opening the browser, using cookie login, they access this page directly\n elsif !session[:last_primary_activity_o] &&\n (Activity::activities[params[:action]] && Activity::activities[params[:action]][3] == 0)\n \n # 3. If the current action is not defined regardless if it's a primary or secondary (as we can't tell at this stage)\n # Set the 'last_primary_activity' to 'home'\n elsif !Activity::activities[params[:action]] \n session[:last_primary_activity_o] = Activity::create_o(\n {:action => \"home\", :controller => \"application\"}, nil, session[:user])\n \n # Let the admin know an action was used that doesn't have\n raise 'ERROR #2' if !send_message(nil, {:missing_action => params[:action]}, false, 3, 4) \n end \n \n # Set the current activity to be the last in the session\n session[:last_activity_o] = @activity\n \n rescue Exception => exc\n \n flash[:error] = 'Activity could not be saved due to a validation error = ' + exc.clean_backtrace.join( \"\\n\" )\n \n end # rescue\n \n end", "def set_site_visitor\n ensure_code_cookie\n record_login(current_user) if current_user\n end", "def register_funnel_visitor\n @current_visitor = FunnelCake.engine.visitor_class.create(\n :ip=>request.remote_ip.to_s\n )\n @current_visitor.user_id = current_user.id if logged_in?\n @current_visitor.save\n cookies[self.class.read_inheritable_attribute(:cookie_name)] = {\n :value => @current_visitor.id,\n :expires => 1.year.from_now\n }\n end", "def track\n # Log an event\n params.reject{|k,v| ['action', 'controller'].include? k}.each do |event_type, event_detail|\n Event.create :name => event_type, :description => event_detail,\n :ip => request.remote_ip, :useragent => request.headers['user-agent']\n end\n render :nothing => true\n end", "def log_request(request)\n access = Access.new\n access.host = request.ip\n access.referrer = request.referer\n access.timestamp = DateTime.now\n\n access.method = request.request_method\n \n (request.get? ? request.GET : request.POST).each_pair do |key, value|\n pair = FormDataPair.new\n pair.name = key\n pair.value = value\n access.form_data_pairs << pair\n end\n\n access.save\n\n status 404\n 'No one here but us chickens.'\nend", "def record_visit\n unless (visit_key = cookies[:id])\n visit_key = SecureRandom.urlsafe_base64(16)\n cookies.permanent[:id] = visit_key\n end\n VisitCounter.record(visit_key)\n end", "def login\n @no_loginout = true # don't display loginout div\n @title = 'Login'\n if request.post?\n @user = User.authenticate( params[:user][:email], params[:user][:password] )\n if !@user.nil?\n session[:user_id] = @user.id\n flash[:message] = \"Successfully logged in as #{@user.name}\"\n @user.last_login = Time.now.utc\n @user.save(false)\n update_session_expiration\n # Log an event\n Event.create :name => 'Login', :description => 'Success', :useragent => request.headers['user-agent'],\n :referer => request.headers['referer'], :ip => request.remote_ip\n redirect_to '/'\n else\n flash[:warning] = \"Login failed. Please check the email and password.\"\n # Log an event\n Event.create :name => 'Login', :description => 'Fail', :useragent => request.headers['user-agent'],\n :referer => request.headers['referer'], :ip => request.remote_ip\n end\n else\n # Log an event\n Event.create :name => 'PageView', :description => request.url, :useragent => request.headers['user-agent'],\n :referer => request.headers['referer'], :ip => request.remote_ip\n render :layout => 'khf_no_tabs'\n end\n end", "def create\n @visitor = Visitor.new(params[:visitor])\n @visitor.request = request\n if @visitor.deliver\n flash.now[:error] = nil\n flash[:notice] = 'Thank you for your message!'\n redirect_to contact_path\n else\n flash[:error] = 'Cannot send message.'\n redirect_to contact_path\n end\n end", "def create\n @tour_visitor = TourVisitor.find(params[:tour_visitor_id])\n @time_visitor = @tour_visitor.time_visitors.create(params[:time_visitor])\n \n redirect_to @tour_visitor\n end", "def visitor\n @visitor ||= user_signed_in? ? current_user : UserAnon.new(session)\n end", "def track_pageview\n\n # Get these from the keen.io website:\n project_id = \"4f5775ad163d666a6100000e\"\n auth_token = \"a5d4eaf432914823a94ecd7e0cb547b9\"\n\n # First you must setup the client:\n keen = Keen::Client.new(project_id, auth_token, :storage_mode => :redis)\n\n # Log the event with Keen:\n keen.add_event(\"pageviews\", {\n :params => params,\n :url => request.url,\n })\n\n end", "def log_submission_access(request)\n request_headers = request.headers.env.select do |k, _|\n k.in?(ActionDispatch::Http::Headers::CGI_VARIABLES) || k =~ /^HTTP_/\n end\n\n request_headers['USER_SESSION_ID'] = current_authentication_token\n request_headers['SUBMISSION_SESSION_ID'] = @submission.session_id\n\n @submission.logs.create(request: request_headers)\n end", "def log_registration\n if request.post? # === POST: ===\n log_action(\n \"new User signed-up!\",\n \"Params: #{remove_passwords( params ).inspect}\\r\\n\\r\\nUpdated users total: #{User.count}\\r\\n\\r\\nCurrent user instance: #{current_user.inspect}\"\n )\n elsif request.delete? # === DELETE: ===\n log_action(\n \"existing User deleted!\",\n \"Params: #{remove_passwords( params ).inspect}\\r\\n\\r\\nUpdated users total: #{User.count}\\r\\n\\r\\nCurrent user instance: #{current_user.inspect}\"\n )\n end\n end", "def request_log(request); end", "def track_visitor\n return if ignore_funnel_tracking?\n register_funnel_visitor unless visitor_registered?\n end", "def visitor_params\n params.require(:visitor).permit(:event_type, :event_time)\n end", "def track_page_view()\n time_stamp = Time.now.to_s\n domain_name = ENV[\"SERVER_NAME\"]\n domain_name ||= \"\"\n\n #Get the referrer from the utmr parameter, this is the referrer to the\n #page that contains the tracking pixel, not the referrer for tracking\n #pixel.\n document_referer = $cgi[\"utmr\"]\n if document_referer != \"\" && document_referer != \"0\"\n document_referer = \"-\"\n else\n document_referer = CGI.unescape(document_referer)\n end\n\n document_path = $cgi[\"utmp\"]\n document_path ||= \"\"\n document_path = CGI.unescape(document_path)\n\n account = $cgi[\"utmac\"]\n user_agent = ENV[\"HTTP_USER_AGENT\"]\n user_agent ||= \"\"\n\n #Try and get visitor cookie from the request.\n cookie = $cgi.cookies[COOKIE_NAME]\n\n guid_header = ENV[\"HTTP_X_DCMGUID\"]\n guid_header ||= ENV[\"HTTP_X_UP_SUBNO\"]\n guid_header ||= ENV[\"HTTP_X_JPHONE_UID\"]\n guid_header ||= ENV[\"HTTP_X_EM_UID\"]\n\n visitor_id = get_visitor_id(guid_header, account, user_agent, cookie)\n\n utm_gif_location = \"http://www.google-analytics.com/__utm.gif\"\n\n #Construct the gif hit url.\n utm_url = utm_gif_location + \"?\" +\n \"utmwv=\" + GA_VERSION +\n \"&utmn=\" + get_random_number +\n \"&utmhn=\" + CGI::escape(domain_name) +\n \"&utmr=\" + CGI::escape(document_referer) +\n \"&utmp=\" + CGI::escape(document_path) +\n \"&utmac=\" + account +\n \"&utmcc=__utma%3D999.999.999.999.999.1%3B\" +\n \"&utmvid=\" + visitor_id +\n \"&utmip=\" + get_ip(ENV[\"REMOTE_ADDR\"])\n\n send_request_to_google_analytics(utm_url)\n\n #Finally write the gif data to the response.\n write_gif_data(utm_url, time_stamp, visitor_id)\nend", "def set_tracking\n # set ad campaign stats if a source is in the url\n if cookies[:visitor_token].nil?\n begin\n visitor_token = SecureRandom.urlsafe_base64\n end while Applicant.exists?(:visitor_token => visitor_token)\n cookies[:visitor_token] = { value: visitor_token, expires: 30.days.from_now }\n end\n\n \tif !params[:src].nil?\n session[:src] = params[:src] \n session[:camp] = params[:camp]\n session[:adgrp] = params[:adg]\n session[:kw] = params[:kw]\n session[:ad] = params[:ad]\n session[:plc] = params[:plc]\n end\n\n # set site tracking stats\n if session[:page_views].nil?\n session[:page_views] = 1 \n #for direct visitors session[:referer_uri] is nil\n session[:referer_uri] = request.env[\"HTTP_REFERER\"]\n session[:device] = set_device\n session[:entry_page] = request.fullpath\n session[:entry_time] = Time.now\n else\n session[:page_views] += 1\n end\n end", "def log_history\n logger.info('[]' + request.method + \"\\t\" + request.fullpath + \"\\t\" + request.remote_ip + \"\\t\" + Time.now.strftime('%Y-%m-%d %H:%M:%S'))\n end", "def create\n super\n if current_visit\n current_visit.started_at = Time.now\n current_visit.usuario_id = current_usuario.id\n current_visit.save\n end\n \n Ahoy.user_method = :current_usuario\n ahoy.authenticate(current_usuario)\n set_login_token\n end", "def create\n @daily_visitor = DailyVisitor.new(daily_visitor_params)\n @daily_visitor.id = DailyVisitor.last.id + 1 \n respond_to do |format|\n if @daily_visitor.save\n format.html { redirect_to @daily_visitor, notice: 'Daily visitor was successfully created.' }\n format.json { render :show, status: :created, location: @daily_visitor }\n else\n format.html { render :new }\n format.json { render json: @daily_visitor.errors, status: :unprocessable_entity }\n end\n end\n end", "def log_request\n \"#{request.ip} - #{session[:login] ? session[:login].name : '-'} [#{Time.now.strftime('%d/%m/%Y:%H:%M:%S %z')}] \\\"#{request.request_method} #{request.path} HTTP\\\" #{response.status} #{response.content_length} #{timer.stop(request.object_id).round(3)}\"\n end", "def log_event(info = nil)\n if current_user\n action = \"#{controller_name}/#{action_name}\"\n log = ActivityLog.new(user: current_user, action: action, info: info)\n log.save\n end\n end", "def create\n @visitor = Visitor.new(visitor_params)\n\n respond_to do |format|\n if @visitor.save\n format.html { redirect_to @visitor, notice: 'Visitor was successfully created.' }\n format.json { render :show, status: :created, location: @visitor }\n else\n format.html { render :new }\n format.json { render json: @visitor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @visitor = Visitor.new(visitor_params)\n\n respond_to do |format|\n if @visitor.save\n format.html { redirect_to @visitor, notice: 'Visitor was successfully created.' }\n format.json { render :show, status: :created, location: @visitor }\n else\n format.html { render :new }\n format.json { render json: @visitor.errors, status: :unprocessable_entity }\n end\n end\n end", "def log_transition(from, to, event, data, opts)\n self.events << Analytics::Event.create({\n :from=>from.to_s, :to=>to.to_s,\n :url=>data[:url],\n :referer=>data[:referer],\n :user_agent=>data[:user_agent],\n :name=>event.to_s\n })\n self.save\n end", "def add_visit\n self.visits += 1\n self.date_last_visit = DateTime.now\n end", "def register_visit_by(ip_address)\r\n return unless ip_address\r\n\r\n visit = visits.where(ip_address_id: ip_address.id).first_or_create\r\n visit.increment!(\"count\")\r\n\r\n # update current visited at if more than 15 minutes ago\r\n if visit.current_visited_at.nil?\r\n\tvisit.past_visited_at = visit.current_visited_at = Time.now\r\n end\r\n\r\n if visit.current_visited_at < 15.minutes.ago\r\n\tvisit.past_visited_at = visit.current_visited_at\r\n\tvisit.current_visited_at = Time.now\r\n\tvisit.save\r\n end\r\n end", "def log_request\n # REQUEST_LOG.info( {\n # time: Time.now.to_s,\n # ip: request.remote_ip,\n # path: request.path,\n # site: request.host,\n # user_agent: request.user_agent,\n # params: (request.request_parameters.blank? ? request.query_parameters : request.request_parameters),\n # device: sub_group_type,\n # referer_header: referer,\n # current_page_header: current_page,\n # landing_url_header: land_url,\n # visitor_id_header: request.env['HTTP_VISITOR_ID'],\n # session_id_header: request.env['HTTP_SESSION_ID'],\n # visitor_id: visitor_id,\n # session_id: session_id,\n # params: params\n # } )\n end", "def log_session\n return render_error(404, \"must include a user id\") unless params[:id]\n sessions_platform = params[:platform] || \"web\"\n if User.find(params[:id]) == current_user\n\n # Go get any new videos from facebook explicity\n facebook_auth = current_user.authentications.select { |a| a.provider == 'facebook' }.first\n GT::PredatorManager.update_video_processing(current_user, facebook_auth) if facebook_auth\n\n case sessions_platform\n when \"ios\"\n current_user.increment(:ios_session_count => 1)\n when \"web\"\n current_user.increment(:session_count => 1)\n ShelbyGT_EM.next_tick {\n StatsManager::GoogleAnalytics.track_nth_session(current_user, 1)\n StatsManager::GoogleAnalytics.track_nth_session(current_user, 3)\n StatsManager::GoogleAnalytics.track_nth_session(current_user, 6)\n StatsManager::GoogleAnalytics.track_nth_session(current_user, 10)\n }\n else\n return render_error(404, \"invalid platform. only ios and web supported.\")\n end\n @status = 200\n else\n render_error(404, \"could not update the current users session\")\n end\n end", "def user_activity\n current_user.touch(:last_response_at) if signed_in?\n end", "def add_visitor(id, activity, time)\n\t\tvisitor = self.visitors.find{|v| v.id == id }\n\t\tif visitor\n\t\t\tvisitor.update(activity, time)\n\t\telse\n\t\t\tvisitor = Visitor.new(id)\n\t\t\tvisitor.update(activity, time)\n\t\t\tself.visitors << visitor\n\t\tend\n\tend", "def log_transition(from, to, event, data, opts)\n update_statistics(data) if events.empty? # if this is the first event, update the global statistics\n\n self.events << Analytics::Event.create({\n :from=>from.to_s, :to=>to.to_s,\n :url=>data[:url],\n :referer=>data[:referer],\n :user_agent=>data[:user_agent],\n :name=>event.to_s\n })\n self.save\n end", "def create\n @visit = Visit.new(visit_params)\n time = DateTime.parse(params[:visit_start])\n @visit.start = DateTime.new(params[:date][:year].to_i, params[:date][:month].to_i, params[:date][:day].to_i, time.strftime('%H').to_i, time.strftime('%M').to_i)\n @visit.finish = @visit.start + 30.minutes\n @visit.patient = current_user.patient\n @visit.confirmed = false\n\n respond_to do |format|\n if @visit.save\n format.html { redirect_to @visit, notice: 'Visit was successfully created.' }\n format.json { render :show, status: :created, location: @visit }\n else\n set_before_not_valid\n format.html { render :new }\n format.json { render json: @visit.errors, status: :unprocessable_entity }\n end\n end\n end", "def log_activity(user_id)\n $redis.zadd(activity_key, Time.now.to_i, user_id)\n end", "def log_funnel_event(event, data={})\n return if ignore_funnel_tracking?\n register_funnel_visitor if current_visitor.nil?\n unless current_visitor.nil?\n data.reverse_merge!({\n :url=>request.request_uri,\n :referer=>request.referer,\n :user_agent=>request.env[\"HTTP_USER_AGENT\"].to_s\n })\n current_visitor.log_funnel_event(event, data)\n return\n end\n logger.info \"Couldn't Log FunnelCake Event: #{event} No Analytics::Visitor found!\"\n end", "def sync_funnel_visitor\n return unless FunnelCake.enabled?\n\n if not logged_in?\n logger.info \"Couldn't sync Analytics::Visitor to nil User\"\n return\n end\n if current_visitor.nil?\n logger.info \"Couldn't sync nil Analytics::Visitor to current User: #{current_user.inspect}\"\n return\n end\n current_visitor.user_id = current_user.id\n current_visitor.save\n end", "def log()\n if user_signed_in?\n else\n \tredirect_to \"http://localhost:3000/users/sign_in\"\n end\n end", "def log\n # When someone actually picks up the call\n if params[:DialAction] == 'answer'\n user_number = UserNumber.find_by_sip_endpoint(params[:DialBLegTo])\n @call.update! user_number: user_number\n # When the call is over, we log the call duration and the time it took to\n # pick up the call\n elsif params[:DialAction] == 'hangup' &&\n params[:DialBLegHangupCause] == 'NORMAL_CLEARING'\n pickup_time = params[:AnswerTime].to_time - params[:StartTime].to_time\n @call.update! duration: params[:DialBLegDuration], pickup_time: pickup_time\n end\n render nothing: true\n end", "def track_devices\n # The device's location, as reported by its permanent cookies\n location = cookies[\"origin\"] || cookies[\"start_location\"] || ''\n location = location[1..-1] if !location[0].blank? && location[0].upcase == \"R\"\n\n data = {\n :ip => (IPAddr.new(request.remote_ip)).to_s,\n :kiosk => !!cookies[\"origin\"], # Kiosks have origin cookies\n :room => Room.find_by_room_number(location)\n }\n\n @device = Device.where(data).first\n (@device.touch if @device) or @device = Device.new(data)\n\n @device.save\n\n # Possibilities for current device's visitor state:\n # 1. The kiosk is waiting for a new visitor. Neither start nor end are set.\n # See #3.\n # 2. The kiosk is currently being used by a visitor. Start is set, but not\n # end. Don't need to do anything.\n # 3. The kiosk just finished being used by a visitor. End is set (start is,\n # too). Create a new visitor. Start will be set when someone clicks on\n # something (i.e., there was no request for logvisitor recently)\n\n @visitor = Visitor.where(:device_id => @device.id).order(updated_at: :desc).first\n if @visitor.nil? || ! @visitor.end.blank?\n @visitor = Visitor.new(:device_id => @device.id)\n elsif @visitor.start.blank?\n @visitor.start = DateTime.current\n end\n \n @visitor.save\n end", "def log_request\n ServerRequestLog.create! default_log_hash\n end", "def log_activity_now(activity)\n log_activity(activity, prev_end_time, current_time)\nend", "def create\n set_cors_headers\n @site = Site.find(params[:site_id])\n if params[:base_url] == @site.base_url\n @visit = @site.visits.create(:url => params[:url], :duration => params[:duration])\n end\n\n respond_to do |format|\n if @visit.save\n format.html { redirect_to site_visit_path(@site, @visit), notice: 'Visit was successfully created.' }\n format.json { render json: @visit, status: :created, location: @visit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @visit.errors, status: :unprocessable_entity }\n end\n end\n end", "def welcome( user )\n session[:user] = user\n session[:last_login] = Time.now.strftime(\"%m-%d-%Y %H:%M:%S\") \n redirect \"/\"\n end", "def update_activity_time\n session[:expires_at] = DateTime.now + 30.minutes\n end", "def log_request\n logger.info \"HTTP request received => #{request.fullpath} , params => #{params} \"\n end", "def log_user_recent_route\n @sessions_current_user.add_page_to_recent(request.fullpath) if @sessions_current_user\n end", "def create\n \n @user = User.find_by_name(params[:user_track_log][:user_name])\n if @user.blank?\n redirect_to root_url, notice: 'Invalid User Name.' \n return\n end\n \n user_logged_in = UserTrackLog.where('DATE(arrival_time) = ? and user_name = ?', Date.today,params[:user_track_log][:user_name])\n unless user_logged_in.blank?\n redirect_to root_url, notice: 'You have Already Signed in'\n return\n end\n @user_track_log = UserTrackLog.new(user_track_log_params)\n @user_track_log.arrival_time = Time.now \n @user_track_log.is_late = (Time.now > Time.now.beginning_of_day + 10.hours) ? 1 : 0\n @user_track_log.user_id = @user.id\n\n\n if (@user_track_log.is_late == 1)\n message = \"Hello #{params[:user_track_log][:user_name]} you are late today please sing in before 10 AM\"\n else\n message = \"Hello #{params[:user_track_log][:user_name]} you have singned in successfully\"\n end\n respond_to do |format|\n if @user_track_log.save\n format.html { redirect_to root_url, notice: \"#{message}\" }\n format.json { render :show, status: :created, location: @user_track_log }\n else\n format.html { render :new }\n format.json { render json: @user_track_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def log_request\n expiring_timestamp = current_timestamp + expires_in\n client.zadd(cache_key, expiring_timestamp, current_timestamp)\n end", "def log(env, status, response_headers, began_at, body)\n data = {\n :method => env[\"REQUEST_METHOD\"],\n :path => env[\"PATH_INFO\"],\n :query_string => env[\"QUERY_STRING\"],\n :host => Socket.gethostname,\n :status => status.to_i,\n :duration => (Time.now - began_at),\n :remote_addr => env['REMOTE_ADDR'],\n :request => request_line(env),\n :\"X-Forwarded-For\" => response_headers['X-Forwarded-For']\n\n }\n\n # Added calling for the proc and merge the data if it exists\n\n if @proc\n begin\n new_hash = @proc.call(env)\n data = data.merge new_hash if new_hash.class == Hash\n rescue Exception => e\n STDERR.puts \"Exception in your proc : #{e.message}.\"\n end\n end\n\n # This just works for all body types (magic?)... see http://www.rubydoc.info/github/rack/rack/Rack/BodyProxy\n body.each{|x| data[:body] = x[0..@options[:body_len]] }\n @options[:request_headers].each { |header, log_key| env_key = \"HTTP_#{header.upcase.gsub('-', '_')}\" ; data[log_key] = env[env_key] if env[env_key]} if !@options[:request_headers].nil?\n @options[:response_headers].each { |header, log_key| data[log_key] = response_headers[header] if response_headers[header] } if !@options[:response_headers].nil?\n\n data[:error_msg] = env[\"sinatra.error\"] if env.has_key?(\"sinatra.error\")\n\n\n\n @options[:body_regex].each { |k,v| data[k] = data[:body].to_s.match(/#{v}/).captures[0].gsub(\"\\\\\",\"\").gsub(\"\\\"\",\"\") rescue data[k]= \"\" } if !@options[:body_regex].nil?\n\n severity = \"DEBUG\"\n case status\n when 300..399 then severity = \"WARN\"\n when 400..599 then severity = \"ERROR\"\n end\n event = {:severity => severity}.merge data\n # TODO to include this lines\n begin\n device.puts( event.to_json )\n rescue Exception => e\n STDERR.puts \"Error : Failed to write log to : #{@options[:url]}, #{e.message}.\"\n @device = nil\n end\n end", "def new\n @visitor = Analytics::Visitor.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n\tif user_signed_in?\n\t\t@eventlog = Eventlog.new\n\n\t\trespond_to do |format|\n\t\t format.html # new.html.erb\n\t\t format.json { render json: @eventlog }\n\t\tend\n\telse\n\t\tflash[:notice] = \"You don't have access to do that\"\n\t\tredirect_to :controller=>'home', :action => 'index'\n\tend\n end", "def loggin_opc(puser, pcontroller, paction, pcomment)\n #para que no haga logging de clicks de navegacion\n if pcontroller == 'home'\n\t\treturn\n else\n\t logmodel = Logeclubapi.new\n\t logmodel.login = puser.login\n\t logmodel.username = puser.name\n\t logmodel.log_option = pcontroller\n\t logmodel.log_action = paction[0..9]\n\t logmodel.log_comment = pcomment\n\t logmodel.origin = 'W' #origen web\n\t #logmodel.save\n end\n end", "def new_visit\n visit = Visit.find_by(vis_type: 'TV')\n UserMailer.new_visit(visit)\n end", "def create\n\tif user_signed_in?\n\t\t@eventlog = Eventlog.new(params[:eventlog])\n\t\t@eventlog.ename = @eventlog.event.title\n\t\t@eventlog.vname = @eventlog.visitor.fname\n\t\t@eventlog.status = \"not approved\"\n\t\trespond_to do |format|\n\t\t if @eventlog.save\n\t\t\tformat.html { redirect_to @eventlog, notice: 'Eventlog was successfully created.' }\n\t\t\tformat.json { render json: @eventlog, status: :created, location: @eventlog }\n\t\t else\n\t\t\tformat.html { render action: \"new\" }\n\t\t\tformat.json { render json: @eventlog.errors, status: :unprocessable_entity }\n\t\t end\n\t\tend\n\telse\n\t\tflash[:notice] = \"You don't have access to do that\"\n\t\tredirect_to :controller=>'eventlogs', :action => 'index'\n\tend\n end", "def note_failed_signin\n flash[:error] = \"Не возможно войти как '#{params['/session'][:login]}'\"\n logger.warn \"Ошибка входа в систему пользователем '#{params['/session'][:login]}' IP: #{request.remote_ip} время: #{Time.now.utc}\"\n l=Loggs.new\n l.username=\"#{params['/session'][:login]}\"\n remote_ip = client_ip\n l.message=\"Ошибка входа в систему IP: #{remote_ip}\"\n l.event='LOGERR'\n l.created_at=Time.now\n l.logg_date=Date.today\n l.save\n end", "def create\n @called_from = params[:called_from] || 'user'\n respond_to do |format|\n if @online_retailer_user.save\n format.html { redirect_to([:admin, @online_retailer_user], notice: 'User was successfully created.') }\n format.xml { render xml: @online_retailer_user, status: :created, location: @online_retailer_user }\n format.js\n website.add_log(user: current_user, action: \"Created #{@online_retailer_user.online_retailer.name} user: #{@online_retailer_user.user.name}\")\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @online_retailer_user.errors, status: :unprocessable_entity }\n format.js { render plain: \"Error\"}\n end\n end\n end", "def log_event(params)\n puts \"Log Details:\"\n puts \"<====================>\"\n puts \"Event Type: #{params['event']}\"\n puts \"Recepient: #{params['recipient']}\"\n puts \"City: #{params['city']}\"\n puts \"Country: #{params['country']}\"\n puts \"Client Type: #{params['client-type']}\"\n puts \"Client Name: #{params['client-name']}\"\n puts \"Device Type: #{params['device-type']}\"\n puts \"Client OS: #{params['client-os']}\"\n puts \"Url Clicked: #{params['url']}\" if params['event'] == \"clicked\"\n puts \"Logged at: #{Time.at(params['timestamp'].to_i).utc.to_datetime}\"\n puts \"<====================>\"\n end", "def update_activity_time\n session[:expires_at] = 15.minutes.from_now\n end", "def sign_in_local\n __log_activity\n __debug_route\n end", "def create\n @guest_visit = GuestVisit.new(guest_visit_params)\n\n respond_to do |format|\n if @guest_visit.save\n format.html { redirect_to @guest_visit, notice: 'Guest visit was successfully created.' }\n format.json { render :show, status: :created, location: @guest_visit }\n else\n format.html { render :new }\n format.json { render json: @guest_visit.errors, status: :unprocessable_entity }\n end\n end\n end", "def log_activity(at, action = nil)\n unless activity_log\n update_attributes(:activity_log => ActivityLog.create(:user => self))\n end\n activity_log.add(at, action)\n end", "def track!(*args)\n begin\n opts = args.extract_options!\n data = { v: 1, tid: Setting.google_analytics, cid: opts[:session] || SecureRandom.uuid[0,32], t: :pageview, dp: \"/#{self.code}\", dh: \"mycolor.today\", dt: self.title }\n data[:dr] = opts[:referrer] if opts[:referrer].present?\n data[:uid] = opts[:user] if opts[:user].present?\n resp = RestClient.post( 'http://www.google-analytics.com/collect', data )\n rescue\n nil\n end\n end", "def visitor_params\n params[:visitor]\n end", "def log_activity\n\n BgJob.enqueue(\n UserActivityLogJob,\n {\n client_id: @client.id,\n user_id: @edit_kyc_request.user_id,\n admin_id: @edit_kyc_request.admin_id,\n action: GlobalConstant::UserActivityLog.open_case,\n action_timestamp: Time.now.to_i,\n extra_data: {\n case_id: @edit_kyc_request.case_id\n }\n }\n )\n\n end", "def doctors_visit(patient_id)\n patient = Patient.find(patient_id)\n patient.update(last_visited_on: DateTime.now)\nend", "def index\n @visits = @patient.visits\n if @visits.blank?\n redirect_to new_patient_visit_path(@patient) and return\n end\n end", "def show\n @link = Link.find_by_token(params[:token]) \n if @link.nil?\n flash[:error] = \"Invalid Token\"\n redirect_to root_path\n else \n @ip = request.remote_ip #Fetch ip address of user\n Visitor.update_visitors_count(@link, @ip) #Increase visited user count\n redirect_to @link.original_url\n end \n end", "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "def view(visitor, options={})\n build_or_create_visit(visitor, {:unique => !visited_by?(visitor)}.merge(options))\n end", "def create\n @visit = Visit.new(params[:visit])\n\n respond_to do |format|\n if @visit.save\n format.html { redirect_to @visit, notice: 'Visit was successfully created.' }\n format.json { render json: @visit, status: :created, location: @visit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @visit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n flash[:notice] = \"Visit was successfully created.\" if visit.save\n respond_with(visit)\n end", "def send_request_info_to_dashboard(app_id, timestamp, request_rate)\n Djinn.log_debug(\"Sending a log with request rate #{app_id}, timestamp \" +\n \"#{timestamp}, request rate #{request_rate}\")\n encoded_request_info = JSON.dump({\n 'timestamp' => timestamp,\n 'request_rate' => request_rate\n })\n\n begin\n url = URI.parse(\"https://#{get_login.public_ip}:\" +\n \"#{AppDashboard::LISTEN_SSL_PORT}/apps/json/#{app_id}\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n response = http.post(url.path, encoded_request_info,\n {'Content-Type'=>'application/json'})\n return true\n rescue OpenSSL::SSL::SSLError, NotImplementedError, Errno::EPIPE,\n Errno::ECONNRESET\n retry\n rescue Exception\n # Don't crash the AppController because we weren't able to send over\n # the request info - just inform the caller that we couldn't send it.\n Djinn.log_info(\"Couldn't send request info for app #{app_id} to #{url}\")\n return false\n end\n end", "def show\n if @invite.first_viewed_at < Time.now - 1.year && @invite.created_at < Time.now - 1.hour\n @invite.first_viewed_at = Time.now\n end\n @invite.most_recently_viewed_at = Time.now\n @invite.save\n \n cookies[:user_url] = @invite.url\n end", "def new\n @tour_visitor = TourVisitor.find(params[:tour_visitor_id])\n @time_visitor = TimeVisitor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_visitor }\n end\n end", "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "def create\n @visit = Visit.new(params[:visit])\n\n respond_to do |format|\n if @visit.save\n flash[:notice] = 'visit was successfully created.'\n format.html { redirect_to(@visit) }\n format.xml { render :xml => @visit, :status => :created, :location => @visit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @visit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def log_http_call(payload); end", "def log_http_call(payload); end", "def log_access(user)\n if @access_log_field\n eval(\"user.#{@access_log_field} = Time.now\")\n user.save\n end\n end", "def fresh_visit?(visit = nil)\n visit ||= current_visit\n visit && visit.updated_at + Const::VISIT_STALE_AFTER > Time.now\n end", "def create\n new_vurl.ip_address = request.remote_ip\n new_vurl.user = current_user\n\n if suspected_spam_user?\n flash[:error] = \"We've flagged this IP for suspicious activity and will not allow creation of Vurls. Contact Veezus if you feel this is an error\"\n redirect_to root_path and return\n end\n\n respond_to do |format|\n if new_vurl.save\n flash[:notice] = 'Vurl was successfully created.'\n format.html { redirect_to stats_path(new_vurl.slug) }\n format.xml { render :xml => new_vurl, :status => :created, :location => new_vurl }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => new_vurl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def log(data)\n t = Thread.new do\n uri = URI(\"http://logs-01.loggly.com/inputs/.../tag/ost/\")\n req = Net::HTTP::Post.new(uri)\n req['content-type'] = \"content-type:application/x-www-form-urlencoded\"\n req.body = data.to_json\n res = Net::HTTP.start(uri.hostname, uri.port) {|http|\n http.request(req)\n }\n end\nend" ]
[ "0.67755216", "0.65221065", "0.6351727", "0.61986196", "0.60083514", "0.6008046", "0.5907962", "0.5881883", "0.5810546", "0.5589945", "0.5542837", "0.55297786", "0.5526256", "0.5517241", "0.54993564", "0.54477334", "0.5386828", "0.5366683", "0.5328699", "0.5314285", "0.5307284", "0.53057396", "0.5298004", "0.5287141", "0.5284981", "0.52813053", "0.5281029", "0.52431595", "0.52382654", "0.5236959", "0.5217372", "0.5203219", "0.5198477", "0.51748866", "0.5173964", "0.516579", "0.5160895", "0.51454616", "0.51454616", "0.51395875", "0.513861", "0.5138219", "0.51349974", "0.51023805", "0.5096659", "0.5084567", "0.50791156", "0.5065689", "0.50535834", "0.50514114", "0.5049609", "0.50446856", "0.503355", "0.5029951", "0.50259936", "0.5012488", "0.49941847", "0.49899825", "0.49855462", "0.49846715", "0.49776408", "0.4973305", "0.49598226", "0.49576774", "0.49567184", "0.49531868", "0.49509624", "0.49422744", "0.49379495", "0.4922854", "0.49085945", "0.49027514", "0.49014473", "0.48830068", "0.4874779", "0.48707414", "0.4863563", "0.48568824", "0.4839655", "0.48281333", "0.48273063", "0.4823176", "0.4818718", "0.4818718", "0.48143518", "0.47777092", "0.47728977", "0.47701165", "0.47641274", "0.47606996", "0.4755168", "0.4755168", "0.4755168", "0.4753644", "0.47488824", "0.47488824", "0.47488618", "0.47441632", "0.47334895", "0.4719967" ]
0.747792
0
Not sure if this method is used anywhere. May be safe to remove (and its associated test).
def department_location room_number = params[:department_room_number] id = params[:department_id] room = Room.where(room_number: room_number).first_or_create department = Department.find(id) department.room = room respond_to do |format| if department.save && room_number.present? format.json {render json: { notice: "Department location saved successfully" } } else format.json {render json: { error: "Error saving department location" } } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def teardown\n # No-op\n end", "def teardown; end", "def teardown; end", "def teardown\r\n end", "def teardown\n end", "def teardown\n end", "def remove; end", "def remove; end", "def remove; end", "def remove; end", "def teardown\n # Empty\n end", "def teardown\n # Empty\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n\t\t\t\t# Do nothing\n\t\tend", "def teardown\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def teardown\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def teardown\n # if necessary\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n\t\t# Do nothing\n\tend", "def teardown\n\t\t# Do nothing\n\tend", "def teardown\n\t\t# Do nothing\n\tend", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def teardown\r\n # Do nothing\r\n end", "def teardown\n # empty\n end", "def teardown\n @bu = nil\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n\n end", "def teardown\n # Do nothing\n end", "def remove_via_api!\n QA::Runtime::Logger.debug(\"#{self.class.name} - deferring removal until after suite\")\n end", "def teardown\n # Do nothing.\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end", "def teardown\n # Do nothing\n end" ]
[ "0.6982562", "0.6964223", "0.6964223", "0.68784964", "0.68616194", "0.68616194", "0.68571436", "0.68571436", "0.68571436", "0.68571436", "0.6855948", "0.6855948", "0.68421805", "0.68421805", "0.6838619", "0.6830802", "0.6830802", "0.6826895", "0.6820012", "0.6820012", "0.6820012", "0.6820012", "0.6820012", "0.6820012", "0.6820012", "0.6820012", "0.68050754", "0.67639613", "0.67639613", "0.67639613", "0.67639613", "0.67639613", "0.67639613", "0.67639613", "0.67639613", "0.67639613", "0.67639613", "0.67639613", "0.67639613", "0.67639613", "0.67268354", "0.67268354", "0.67268354", "0.67211604", "0.67211604", "0.67211604", "0.67211604", "0.67211604", "0.67211604", "0.67211604", "0.67211604", "0.67211604", "0.67211604", "0.6705658", "0.668387", "0.66433585", "0.66433585", "0.66433585", "0.66433585", "0.66433585", "0.66433585", "0.66433585", "0.66433585", "0.66433585", "0.66433585", "0.66433585", "0.66433585", "0.66433585", "0.66433585", "0.66433585", "0.66433585", "0.66433585", "0.66412896", "0.6625159", "0.6623316", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355", "0.6620355" ]
0.0
-1
POST Import a CSV file
def csv require 'csv' unless params[:uploaded_csv].blank? csv_path = params[:uploaded_csv].path # Wipe database on csv load, will need to be modified when event RSS feeds are fixed data_validated = false begin CSV.foreach(csv_path, :headers => true) do |row| csv_building = row[1] csv_room_number = row[3] csv_room_name = row[4] csv_department = row[7] csv_person_name = row[9] #can be general purpose name like 'general graduate student' csv_last_name, csv_first_name = csv_person_name.split(',').map(&:strip) csv_person_department = row[11] # appears to be less relevant to our needs csv_organization = row[12] csv_org_code, csv_person_organization = csv_organization.split(' ', 2) # Use this for department csv_phone = row[13] csv_email = row[14] # Destroy data only if the first row was parsed successfully unless data_validated Rails.logger.debug "[[[[[[ Data validated, wiping db!!! ]]]]]]" Person.destroy_all Department.destroy_all DirectoryObject.where(type: "Room").delete_all data_validated = true end # Don't bother with this row if a room number doesn't exist if csv_room_number != "" # Parse Rooms results = Room.where(room_number: csv_room_number) # Found new room? if results.empty? room = Room.new room.room_number = csv_room_number room.save else room = results.first end # Ensure custom data has not already been set # if room.name.blank? # room.name = csv_room_name # room.save # end # Parse Department # Don't bother with department/person parsing, something is wrong with this row unless csv_organization.include?("Identity Purged") department = nil results = Department.where(title: csv_person_organization.downcase).first if results.blank? department = Department.new if csv_person_organization.present? department.title = (csv_person_organization).downcase department.save else logger.info "entry was missing an organization" end else department = results end # Parsing Person results = Person.where(email: csv_email) # Found new person? if results.empty? person = Person.new # Found existing person? else person = results.first end # Ensure room is associated if room.present? if not person.rooms.include?(room) person.rooms << room end end # Ensure department is associated # Currently assumes each person has one department, seems to be the case from the data if person.department.blank? if department.present? person.department = department end end person.email = csv_email person.phone = csv_phone person.first = csv_first_name person.last = csv_last_name person.save end end end notice = "CSV was successfully parsed" rescue error = "CSV file contains invalid data" end else error = "Error uploading file" end # unless csv_path.blank? respond_to do |format| format.html { redirect_to action: "index", error: error, notice: notice } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import\n if (params[:file].nil?)\n redirect_to upload_posts_path, notice: Messages::POST_UPLOAD_FILE_VALIDATION\n elsif !File.extname(params[:file]).eql?(\".csv\")\n redirect_to upload_posts_path, notice: Messages::POST_UPLOAD_CSV_FORMAT_ERROR\n else\n error_messages = PostsHelper.check_header(Constants::POST_CSV_HEADER,params[:file])\n if error_messages.present?\n redirect_to upload_posts_path, notice: error_messages\n else\n Post.import(params[:file],current_user.id)\n redirect_to root_path, notice: Messages::POST_UPLOAD_SUCCESS\n end\n end\n end", "def import_csv\n if current_admin.present? \n updated_user_id = current_admin.id\n create_user_id = current_admin.id\n else\n updated_user_id = current_user.id\n create_user_id = current_user.id\n end\n if (params[:file].nil?)\n redirect_to upload_csv_posts_path, notice: Messages::REQUIRE_FILE_VALIDATION \n elsif !File.extname(params[:file]).eql?(\".csv\")\n redirect_to upload_csv_posts_path, notice: Messages::WRONG_FILE_TYPE \n else\n error_msg = PostsHelper.check_header(Constants::HEADER,params[:file])\n if error_msg.present?\n redirect_to upload_csv_posts_path, notice: error_msg\n else \n Post.import(params[:file],create_user_id,updated_user_id)\n redirect_to posts_path, notice: Messages::UPLOAD_SUCCESSFUL\n end\n end\n end", "def import\n pp params\n\n uploaded = params[:csv]\n count = Device.import uploaded\n redirect_to '/devices', notice: \"#{count} devices imported\"\n end", "def csv_import_params\n params.require(:csv_import).permit(:filename, :imported)\n end", "def post_csv(path, csv)\n file = Tempfile.new(['dotmailer-contacts', '.csv'])\n file.write csv\n file.rewind\n\n post path, :csv => file\n end", "def upload_csv\n datafile = params['csv-file']\n begin\n response = Request.post_request(URL_QUESTION, {\n questions: parse_json(datafile['tempfile'])\n })\n rescue\n redirect '/upload-csv'\n end\n @questions = []\n if response.success?\n data = Request.manage_response(response)\n data.each do |question|\n @questions << Question.new(question)\n end\n erb :table, layout: :session\n end\nend", "def import\n \tbegin #This might fail if input is incorrect. So put it in the begin block\n \t\tProduct.import(params[:file]) #Refer to the import method defined in the product model\n \t\tredirect_to root_url, notice: \"Products imported successfully\" #Give a success flash message if import is successful.\n rescue #Catch the failure here by displaying the suitable error message.\n \tredirect_to root_url, notice: \"Please upload valid csv\" #Give a failure message if import is unsuccessful\n \tend\n end", "def csv_import_params\n params.require(:csv_import).permit(:file, :processor)\n end", "def upload\n ActivityLogSeeder.import!(params[:csv_file].tempfile) # background it for large files\n render json: { message: 'Uploaded successfully' }\n end", "def import\n file = params[:file]\n if file.present?\n case File.extname(file.try(:tempfile))\n when '.csv'\n\n Rails.logger.silence do\n options = {:chunk_size => ImportCsvJob::CHUNK_SIZE}\n uploader = CsvFileUploader.new\n uploader.store!(file)\n @import_job = Delayed::Job.enqueue(ImportCsvJob.new(file.original_filename))\n end\n else\n flash.now[:error] = I18n.t('operations.import.wrong_format')\n end\n else\n flash.now[:error] = I18n.t('operations.import.wrong_format')\n end\n end", "def import_csv(csv_file)\n data, header = parse_csv(csv_file)\n validate_header(header)\n return if @rollback\n process_data(data, header)\n end", "def import_statement\n if params[:file_upload] && params[:file_upload][:file]\n csv_text = params[:file_upload][:file].read\n file_name = params[:file_upload][:file].original_filename\n StatementImportHelper.process_statement(current_user, @ledger_account, csv_text, file_name)\n flash[:notice] = \"File has been uploaded successfully\"\n end\n respond_with @ledger_account\n end", "def import\n @imported = false\n\n if (!params[:attachment].blank?)\n flash.now[:notice] = \"File uploaded\"\n\n import_batch = ImportBatch.create\n\n CSV.parse(params[:attachment].read).each do |row|\n entry = Entry.new(\n :date => Date.strptime(row[0], '%m/%d/%Y'),\n :raw_name => row[2],\n :amount => row[7],\n :account_id => params[:account_id],\n :import_batch_id => import_batch.id)\n entry.save\n end\n end\n end", "def barclay_csv_import\n respond_to :html\n\n if params[:file]\n new_expense_claim = BarclayCardImporter.run(params[:file], current_user)\n redirect_to new_expense_claim, notice: 'Expenses from Barclay Card imported!'\n else\n redirect_to(root_url, 'Please upload a CSV file')\n end\n end", "def import\n uploaded_file = params[:file]\n begin \n dataset = CSV.read(uploaded_file.path, headers: true)\n UserService.new.import_users(dataset)\n redirect_to action: 'index'\n rescue\n flash[:error] = 'The file is invalid.'\n redirect_back fallback_location: root_url\n end\n end", "def create\n @csv_import = current_shop.csv_imports.build(csv_import_params)\n respond_to do |format|\n if @csv_import.save && @csv_import.process\n format.html { redirect_to return_path, notice: \"CSV was uploaded & is being imported.\" }\n format.json { render :show, status: :created, location: @csv_import }\n else\n Rails.logger.debug { \"errors: #{@csv_import.errors.full_messages.join(\", \")}\" }\n format.html { redirect_to return_path, flash: {error: @csv_import.errors.full_messages.join(\", \")} }\n format.json { render json: @csv_import.errors, status: :unprocessable_entity }\n end\n end\n end", "def import_csv_full\n \n end", "def create\n @csv_import = CsvImport.new(csv_import_params)\n\n respond_to do |format|\n if @csv_import.save\n format.html { redirect_to @csv_import, notice: 'Csv import was successfully created.' }\n format.json { render :show, status: :created, location: @csv_import }\n else\n format.html { render :new }\n format.json { render json: @csv_import.errors, status: :unprocessable_entity }\n end\n end\n end", "def import_schwab_csv\n csv = params[:upload].read()\n\n if (csv)\n sp = SchwabParser.new\n trans_data = sp.parse(csv)\n \n # Create a hash of action names and ids\n actions = Action.all\n\n trans_data.each do |trans|\n trans[:user_id] = current_user.id\n trans[:action] = nil\n\n # Convert action description to action object\n actions.each do |a|\n if trans[:act] != nil and trans[:act].match(/#{a.name.singularize}/i)\n trans[:action] = a\n else\n logger.debug \"Transaction Parameters: #{trans}\\n\"\n end\n end\n\n # Remove the act entry, otherwise Ruby will be confused\n trans.delete(:act)\n trans[:symbol] = trans[:symbol].upcase.strip\n\n t = Transaction.new(trans)\n if not t.save\n flash[:warn] = \"Could not save transaction #{trans.to_s}\"\n end\n end\n\n flash[:success] = \"Successfully imported transactions!\"\n redirect_to transactions_url\n else\n flash[:error] = \"Unable to read uploaded CSV file\"\n render action: import\n end\n end", "def import_files\n\t\tif(params[:file].present?)\n begin\n\t\t\t\tNcQuestion.build_from_import(params[:file], current_company)\n redirect_to new_audit_nc_question_path, :flash => { :notice => MESSAGES[\"nc_question\"][\"csv_upload\"][\"success\"]}\n rescue\n redirect_to new_audit_nc_question_path, :flash => { :error => MESSAGES[\"csv_upload\"][\"error\"]}\n end\n else\n redirect_to new_audit_nc_question_path , :flash => { :notice => MESSAGES[\"csv_upload\"][\"presence\"]}\n end\n end", "def import\n MoviesImportService.new(csv_file, current_user).call\n redirect_to metrics_movies_url, notice: 'Movies were successfully imported.'\n end", "def import(file = nil)\n # A Hash containthe returning messages (one message for each row)\n # The values are Arrays containing the importing results for each row\n msg = {success: [], info: []} \n\n # If file is nil or blank (nil != blank)\n if file.nil? or file == \"\"\n msg[:success] << false \n msg[:info] << \"File name is nil or blank!\" \n return msg\n end\n\n # If the file is non-existant ...\n if file.instance_of?(String) and !(File.file?(file)) \n msg[:success] << false \n msg[:info] << \"File doesn't exist!\" \n return msg\n end\n\n # ??File submitted through html file doesn't exist!\n # http://guides.rubyonrails.org/form_helpers.html#uploading-files\n # 5.1 What Gets Uploaded\n # The object in the params hash is an instance of a subclass of IO.\n # Depending on the size of the uploaded file it may in fact be a StringIO\n # or an instance of File backed by a temporary file.\n if file.instance_of?(StringIO)\n msg[:success] << true \n msg[:info] << \"File is an instance of StringIO!\" \n elsif file.instance_of?(File) \n msg[:success] << true \n msg[:info] << \"File is an instance of File!\" \n else # ActionDispatch::Http::UploadedFile by html form \n msg[:success] << true \n msg[:info] << \"Must be the ActionDispatch::Http::UploadedFile type?\" \\\n \" #{file.class}\" \n end\n\n # Gets the file path\n file_path = file\n file_path = file.path unless file.instance_of?(String)\n #puts \"file_path = #{file_path}\"\n\n # TODO: Checks to see if the headers are correct\n # Imports row after row\n # CSV::Row is part Array & part Hash\n CSV.foreach(file_path, headers: true) do |row|\n vhash = row.to_hash # temporary VLAN record hash\n\n # Find FK lan_id\n # Note: Do not use Symbol :lan_name, Or it will not be found. Very weird!\n # Hence, use String instead of Symbol as the Hash key where necessary\n lan_id = find_lan_id(vhash[\"lan_name\"])\n \n # Go to the next row if an invalid lan_id was found \n unless lan_id > 0\n msg[:success] << false \n msg[:info] << \"Cannot find FK lan_id\" \n next\n end\n\n # Remove lan_name field from the row as it's not a field of table vlans\n vhash.delete(\"lan_name\")\n # and appends the FK lan_id\n vhash[\"lan_id\"] = lan_id\n #puts vhash\n \n # TODO: Need to feedback the result to the user in the future release\n s1 = \"lan_id: \" << lan_id.to_s # a temporary string\n tv = Vlan.new(vhash) # temporary VLAN record\n if tv.invalid? # invalid? triggers the model validation\n msg[:success] << false\n s1 << \", invalid Vlan\"\n else\n msg[:success] << true\n s1 << \", saved\"\n tv.save\n end\n\n msg[:info] << s1\n end\n return msg\n end", "def import\n authorize(@vocabulary)\n if request.method == \"POST\"\n tempfile = Tempfile.new(\"vocabulary_#{@vocabulary.id}_import.csv\")\n begin\n # The finalizer would otherwise delete it as it gets GCed.\n ObjectSpace.undefine_finalizer(tempfile)\n csv = params[:csv].read.force_encoding(\"UTF-8\")\n tempfile.write(csv)\n tempfile.close\n ImportVocabularyTermsJob.perform_later(vocabulary: @vocabulary,\n pathname: tempfile.path,\n user: current_user)\n rescue => e\n tempfile.close\n tempfile.unlink\n render partial: \"shared/validation_messages\",\n locals: { object: e },\n status: :bad_request\n else\n toast!(title: \"Importing file\",\n message: \"Vocabulary terms are importing in the background, \"\\\n \"and should be available in a moment.\")\n render \"shared/reload\"\n end\n else\n render partial: \"vocabulary_terms/import_form\",\n locals: { vocabulary: @vocabulary }\n end\n end", "def upload_csv\n\t\t@shortened_url = ShortenedUrl.new\n\t\t@url = parse_csv_shorten_urls_path\n\tend", "def import\n filename = CsvUploadService.call(file: file, user: current_user)\n correlation_id = SecureRandom.uuid\n job_name = RegisterCheckerApi.register_job(filename, correlation_id)\n save_details_to_session(job_name, filename, correlation_id)\n redirect_to processing_upload_index_path\n end", "def import\n #throws error if importing csv file fails\n begin\n Category.import\n notice = \"Import Complete\"\n rescue\n notice = \"There was an error whilst importing!\"\n ensure\n redirect_to start_path, notice: notice\n end\n end", "def import_from_csv\n puts 'Which file would you like to import?'\n file_path = gets.chomp\n CsvImporter.new(@database, file_path).import\n puts 'Import complete.'\n rescue FileNotFoundError\n puts 'The specified file was not found.'\n rescue CsvInvalidError => e\n puts e.message\n end", "def file_upload\n return if request.get?\n\n file = params[:file]\n @results = []\n @error = nil\n\n if (file.nil?)\n @error = \"Looks like there's no file for us to process :(\"\n return\n end\n\n begin\n @results = handle_csv_data(file)\n rescue CSV::MalformedCSVError => e\n @error = e\n end\n end", "def import_csv_smart\n \n end", "def handle_import\n set_csv\n if check_csv_ok?\n success, alert = Participant.import(@csv, params[:project_id])\n unless alert.empty?\n flash[:danger] = alert\n end\n unless success.empty?\n flash[:success] = \"Imported participants: <br/>\" + success\n end\n end\n end", "def csv_params\n params.require(:import_database).permit(:csv, :csv_cache)\n end", "def import\n CSV.new(open(uri), headers: :first_row).each_with_index do |csv_row, i|\n begin\n create_departure(csv_row: csv_row)\n rescue => e\n # this is a catch all for all the types of parsing errors that could\n # occur above\n csv_logger.info(\n I18n.t('import_exception', scope: LOCALE, row_number: i)\n )\n csv_logger.error(e)\n end\n end\n end", "def create\n imported_file = params[:csv_file][:file]\n @csv_file = CsvFile.new(params[:csv_file])\n @csv_file.name = params[:csv_file][:file].original_filename rescue nil\n\n respond_to do |format|\n if @csv_file.save\n format.html { redirect_to @csv_file, notice: 'Csv file was successfully created.' }\n format.json { render json: @csv_file, status: :created, location: @csv_file }\n else\n format.html { render action: \"new\" }\n format.json { render json: @csv_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def import_from_csv(file_name)\r\n #implementation goes here\r\n csv_text = File.read(file_name)\r\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\r\n # #8 iterate over table rows, create hash for each, then convert to Entry using 'add_entry' method\r\n csv.each do |row|\r\n row_hash = row.to_hash\r\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\r\n end #end csv.each loop\r\n end", "def import_from_csv(file)\n entries = Keybox::Convert::CSV.from_file(file)\n entries.each do |entry|\n @db << entry\n end\n hsay \"Imported #{entries.size} records from #{file}.\", :information\n end", "def upload_csv\n if !params[:sheet].blank?\n tmp = params[:sheet][:sheet_name].tempfile\n file = File.join(\"public\", params[:sheet][:sheet_name].original_filename)\n FileUtils.cp tmp.path, file\n report_file = File.open(\"#{Rails.root}/#{file}\", \"r\")\n csv = CSV.parse(report_file, :headers => true)\n csv.each do |row|\n row = row.to_hash.with_indifferent_access\n Sheet.create(row.to_hash.symbolize_keys)\n end\n end\n redirect_to :back\n end", "def csv_import\n @parsed_file=CSV::Reader.parse(params[:dump][:file], \";\")\n n=0\n @parsed_file.each do |row|\n c=Peca.new\n c.produto_id=row[0]\n c.codigo=row[1]\n c.descr=row[2]\n c.acab=row[3]\n c.larg=row[4]\n c.alt=row[5]\n c.prof=row[6]\n c.qtde=row[7]\n c.total=row[8]\n c.custo=row[9]\n c.fita=row[10]\n c.pino=row[11]\n c.embal=row[12]\n c.mdf=row[13]\n c.mdf2=row[14]\n c.ferr=row[15]\n c.ferr2=row[16]\n if c.save\n n=n+1\n GC.start if n%50==0\n end\n flash.now[:message]=\"Arquivo de peças importado com sucesso, #{n} registros adicionados à tabela.\"\n end\n end", "def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n # #8 iterate over the CSV::Table rows then create a hash for each row, convert each row_hash\n #to an Entry by using the add_entry method\n csv.each do |row|\n row_hash = row.to_hash\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n end", "def csv_import\n #n = 0\n CSV.foreach(params[:dump][:file].tempfile,:col_sep => ';', :encoding => 'ISO-8859-1') do |row|\n c = Ticket.new( :ano => row[0],\n :mes => row[1],\n :processo_numero => row[2],\n :solicitacao_data => row[3],\n :solicitacao_hora => row[4],\n :solicitacao_descricao => row[5],\n :solicitacao_regional => row[6],\n :solicitacao_bairro => row[7],\n :solicitacao_localidade => row[8],\n :solicitacao_endereco => row[9],\n :solicitacao_roteiro => row[10],\n :rpa_codigo => row[11],\n :rpa_nome => row[12],\n :solicitacao_microrregiao => row[13],\n :solicitacao_plantao => row[14],\n :solicitacao_origem_chamado => row[15],\n :latitude => row[16],\n :longitude => row[17],\n :solicitacao_vitimas => row[18],\n :solicitacao_vitimas_fatais => row[19],\n :processo_tipo => row[20],\n :processo_origem => row[21],\n :processo_localizacao => row[22],\n :processo_status => row[23],\n :processo_data_conclusao => row[24])\n c.save\n end\n redirect_to :action => \"index\" and return\n end", "def contacts_upload\n #checking for csv file or not\n if params[:file].content_type == \"text/csv\"\n\n #read contents from csv file\n contacts = []\n\n CSV.foreach(params[:file].tempfile) { |row|\n row = row.first.split(\",\") if row.count == 1\n \n contact_data = {}\n contact_data[\"first_name\"] = row[0]\n contact_data[\"last_name\"] = row[1]\n contact_data[\"email\"] = row[2]\n contact_data[\"org\"] = row[3]\n contact_data[\"events\"] = row[4]\n contact_data[\"interests\"] = row[5]\n contacts << contact_data\n }\n\n #remove first row with column name and make a new array with contacts\n contacts = contacts[1..contacts.length]\n contacts.each do |contact|\n @contact = Contact.new\n @contact.first_name=contact[\"first_name\"]\n @contact.last_name=contact[\"last_name\"]\n @contact.email=contact[\"email\"]\n @contact.org=contact[\"org\"]\n @contact.events=contact[\"events\"]\n @contact.interests=contact[\"interests\"]\n @contact.save\n end\n\n else\n puts \"----->>>>> Error found due to wrong file format <<<<<-----\"\n end\n\n contacts_list\n end", "def postEntityBulkCsv( filedata)\n params = Hash.new\n params['filedata'] = filedata\n return doCurl(\"post\",\"/entity/bulk/csv\",params)\n end", "def import_csv\n @records = CSV.read(@filename, :headers => true, :row_sep => :auto)\n unless @records.blank?\n @linenum = 0\n if @filename.index('att') || @filename.index('Att')\n @school_year = Time.parse(@records[0][\"AbsenceDate\"]).year\n end\n @records.each { |rec |\n @linenum += 1\n @record = rec\n next unless check_record(@record)\n seed_record(@record)\n process_record(@record, rec2attrs(@record)) if rec2attrs(@record) != false\n }\n end \n end", "def import\n ExportImport::Csv::Product.new.import(params[:file])\n redirect_to refinery.ironman_admin_products_path, notice: \"Products imported.\"\n rescue => e\n redirect_to refinery.ironman_admin_products_path, alert: \"There was an error while importing products: #{e.message}.\"\n end", "def productimport_params\n params.require(:productimport).permit(:action, :csv)\n end", "def import\n begin\n Mapspace.import(params[:file])\n redirect_to mapspaces_path, notice: \"Mapspace Data Loaded.\"\n rescue\n redirect_to mapspaces_path, notice: \"Invalid CSV file format.\"\n end\n end", "def import!\n log \"Importing #{csv_file.split('/').last.sub('.csv', '')}\"\n\n @errors_count = 0\n\n before_import()\n with_each_row { process_row }\n after_import()\n\n log \"Import complete (#{@errors_count} errors in #{@has_header_row ? @current_row_number-1 : @current_row_number} rows)\"\n end", "def csv_uploader(infile, organisationid)\n require 'csv'\n require 'timeout'\n# counter = 1\n begin \n CSV.parse(infile).drop(1).each do |row| \n# puts \"************************************\"\n# puts \"Started reading #{counter} row and inserting row in the table\"\n Customer.customer_build_from_csv(row, organisationid) \n# puts \"Ended the process of inserting #{counter} row in the table\"\n# puts \"************************************\"\n# counter += 1 \n end \n rescue\n retry\n# puts \"*****************************************\"\n# puts \"Anup got timeout error\"\n# puts \"*****************************************\" \n end\n end", "def import\n csv = CSV.parse(file, headers: true)\n ActiveRecord::Base.transaction do\n csv.each do |product|\n begin\n category = Category.find_or_create_by(title: product[1])\n product_obj = Product.find_or_create_by(pid: product[0])\n product_obj.update(name: product[2], price: product[3].to_i, category_id: category.id)\n rescue => e\n Rails.logger.error \"Error: Error in creating following products - #{product.inspect} - #{e.message} - #{e.backtrace.join(\"\\n\")}\"\n end\n end\n end\n end", "def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n # Iterate over the CSV::Table object's rows. Then create a has for each row.\n # Convert each row_hash to an entry by using add_entry method.\n csv.each do |row|\n row_hash = row.to_hash\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n end", "def set_csv_import\n @csv_import = CsvImport.find(params[:id])\n end", "def import_button(**opt)\n opt[:accept] = 'text/csv,text/comma-separated-values'\n form_button(:import, **opt, type: :file)\n end", "def import_csv\n\n step_names = [_('Import_CDR'), _('File_upload'), _('Column_assignment'), _('Column_confirmation'), _('Select_details'), _('Analysis'), _('Fix_clis'), _('Create_clis'), _('Assign_clis'), _('Import_CDR')]\n params[:step] ? @step = params[:step].to_i : @step = 0\n @step = 0 if @step > step_names.size or @step < 0\n @step_name = step_names[@step]\n\n @page_title = _('Import_CSV') + \"&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;\" + _('Step') + \": \" + @step.to_s + \"&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;\" + @step_name.to_s\n @page_icon = 'excel.png';\n\n @sep, @dec = nice_action_session_csv\n\n if @step == 0\n my_debug_time \"**********import CDR ************************\"\n my_debug_time \"step 0\"\n session[:cdr_import_csv] = nil\n session[:temp_cdr_import_csv] = nil\n session[:import_csv_cdr_import_csv_options] = nil\n session[:file_lines] = 0\n session[:cdrs_import] = nil\n end\n\n if @step == 1\n my_debug_time \"step 1\"\n session[:temp_cdr_import_csv] = nil\n session[:cdr_import_csv] = nil\n session[:cdrs_import] = nil\n if params[:file]\n @file = params[:file]\n if @file.size > 0\n if !@file.respond_to?(:original_filename) or !@file.respond_to?(:read) or !@file.respond_to?(:rewind)\n flash[:notice] = _('Please_select_file')\n redirect_to :action => :import_csv, :step => 0 and return false\n end\n if get_file_ext(@file.original_filename, \"csv\") == false\n @file.original_filename\n flash[:notice] = _('Please_select_CSV_file')\n redirect_to :action => :import_csv, :step => 0 and return false\n end\n @file.rewind\n ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')\n file = ic.iconv(@file.read)\n session[:cdr_file_size] = file.size\n session[:temp_cdr_import_csv] = CsvImportDb.save_file(\"_crd_\", file)\n flash[:status] = _('File_downloaded')\n redirect_to :action => :import_csv, :step => 2 and return false\n else\n session[:temp_cdr_import_csv] = nil\n flash[:notice] = _('Please_select_file')\n redirect_to :action => :import_csv, :step => 0 and return false\n end\n else\n session[:temp_cdr_import_csv] = nil\n flash[:notice] = _('Please_upload_file')\n redirect_to :action => :import_csv, :step => 0 and return false\n end\n end\n\n\n if @step == 2\n my_debug_time \"step 2\"\n my_debug_time \"use : #{session[:temp_cdr_import_csv]}\"\n if session[:temp_cdr_import_csv]\n file = CsvImportDb.head_of_file(\"/tmp/#{session[:temp_cdr_import_csv]}.csv\", 20).join(\"\").to_s\n session[:file] = file\n a = check_csv_file_seperators(file, 2, 2, {:line => 0})\n if a\n @fl = CsvImportDb.head_of_file(\"/tmp/#{session[:temp_cdr_import_csv]}.csv\", 1).join(\"\").to_s.split(@sep)\n begin\n colums ={}\n colums[:colums] = [{:name => \"f_error\", :type => \"INT(4)\", :default => 0}, {:name => \"nice_error\", :type => \"INT(4)\", :default => 0}, {:name => \"do_not_import\", :type => \"INT(4)\", :default => 0}, {:name => \"changed\", :type => \"INT(4)\", :default => 0}, {:name => \"not_found_in_db\", :type => \"INT(4)\", :default => 0}, {:name => \"id\", :type => 'INT(11)', :inscrement => ' NOT NULL auto_increment '}]\n session[:cdr_import_csv] = CsvImportDb.load_csv_into_db(session[:temp_cdr_import_csv], @sep, @dec, @fl, nil, colums)\n session[:file_lines] = ActiveRecord::Base.connection.select_value(\"SELECT COUNT(*) FROM #{session[:temp_cdr_import_csv]}\")\n rescue Exception => e\n MorLog.log_exception(e, Time.now.to_i, params[:controller], params[:action])\n session[:import_csv_cdr_import_csv_options] = {}\n session[:import_csv_cdr_import_csv_options][:sep] = @sep\n session[:import_csv_cdr_import_csv_options][:dec] = @dec\n session[:file] = File.open(\"/tmp/#{session[:temp_cdr_import_csv]}.csv\", \"rb\").read\n CsvImportDb.clean_after_import(session[:temp_cdr_import_csv])\n session[:temp_cdr_import_csv] = nil\n redirect_to :action => \"import_csv\", :step => 2 and return false\n end\n flash[:status] = _('File_uploaded') if !flash[:notice]\n end\n else\n session[:cdr_import_csv] = nil\n flash[:notice] = _('Please_upload_file')\n redirect_to :action => :import_csv, :step => 1 and return false\n end\n\n end\n\n if @step > 2\n\n unless ActiveRecord::Base.connection.tables.include?(session[:temp_cdr_import_csv])\n flash[:notice] = _('Please_upload_file')\n redirect_to :action => :import_csv, :step => 0 and return false\n end\n\n if session[:cdr_import_csv]\n\n if @step == 3\n my_debug_time \"step 3\"\n if params[:calldate_id] and params[:billsec_id] and params[:calldate_id].to_i >= 0 and params[:billsec_id].to_i >= 0\n @options = {}\n\n @options[:imp_calldate] = return_correct_select_value(params[:calldate_id])\n @options[:imp_date] = -1 #params[:date_id].to_i\n @options[:imp_time] = -1 #params[:time_id].to_i\n @options[:imp_clid] = return_correct_select_value(params[:clid_id])\n @options[:imp_src_name] = return_correct_select_value(params[:src_name_id])\n @options[:imp_src_number] = return_correct_select_value(params[:src_number_id])\n @options[:imp_dst] = return_correct_select_value(params[:dst_id])\n @options[:imp_duration] = return_correct_select_value(params[:duration_id])\n @options[:imp_billsec] = return_correct_select_value(params[:billsec_id])\n @options[:imp_disposition] = return_correct_select_value(params[:disposition_id])\n @options[:imp_accountcode] = return_correct_select_value(params[:accountcode_id])\n @options[:imp_provider_id] = return_correct_select_value(params[:provider_id])\n @options[:sep] = @sep\n @options[:dec] = @dec\n\n @options[:file]= session[:file]\n @options[:file_lines] = ActiveRecord::Base.connection.select_value(\"SELECT COUNT(*) FROM #{session[:temp_cdr_import_csv]}\")\n session[:cdr_import_csv2] = @options\n flash[:status] = _('Columns_assigned')\n else\n flash[:notice] = _('Please_Select_Columns')\n redirect_to :action => :import_csv, :step => 2 and return false\n end\n end\n\n if session[:cdr_import_csv2] and session[:cdr_import_csv2][:imp_calldate] and session[:cdr_import_csv2][:imp_billsec]\n\n\n if @step == 4\n my_debug_time \"step 4\"\n @users = User.select(\"users.*, #{SqlExport.nice_user_sql}\").joins(\"LEFT JOIN devices ON (users.id = devices.user_id)\").where(\"hidden = 0 AND owner_id = #{correct_owner_id}\").order(\"nice_user ASC\").group('users.id').all\n @providers = current_user.load_providers(:all, :conditions => 'hidden=0')\n if !@providers or @providers.size.to_i < 1\n flash[:notice] = _('No_Providers')\n redirect_to :action => :import_csv, :step => 0 and return false\n end\n end\n\n #check how many destinations and should we create new ones?\n if @step == 5\n my_debug_time \"step 5\"\n @new_step = 6\n session[:cdr_import_csv2][:import_type] = params[:import_type].to_i\n params[:provider] = session[:cdr_import_csv2][:imp_provider_id] if session[:cdr_import_csv2][:imp_provider_id].to_i > -1\n session[:cdr_import_csv2][:import_provider] = params[:provider].to_i\n unless params[:provider]\n flash[:notice] = _('Please_select_Provider')\n redirect_to :action => :import_csv, :step => 4 and return false\n end\n if session[:cdr_import_csv2][:import_type].to_i == 0\n session[:cdr_import_csv2][:import_user] = params[:user].to_i\n session[:cdr_import_csv2][:import_device] = params[:device_id].to_i\n if User.where(:id => params[:user]).first and Device.where(:id => params[:device_id]).first\n @cdr_analize = Call.analize_cdr_import(session[:temp_cdr_import_csv], session[:cdr_import_csv2])\n @new_step = 9\n @cdr_analize[:file_lines] = session[:cdr_import_csv2][:file_lines]\n session[:cdr_analize] = @cdr_analize\n else\n flash[:notice] = _('User_and_Device_is_bad')\n redirect_to :action => :import_csv, :step => 4 and return false\n end\n else\n if session[:cdr_import_csv2][:imp_clid].to_i == -1\n flash[:notice] = _('Please_select_CLID_column')\n redirect_to :action => :import_csv, :step => 2 and return false\n end\n session[:cdr_import_csv2][:create_callerid] = params[:create_callerid].to_i\n @cdr_analize = Call.analize_cdr_import(session[:temp_cdr_import_csv], session[:cdr_import_csv2])\n @new_step = 9 if @cdr_analize[:bad_clis].to_i == 0 and @cdr_analize[:new_clis_to_create].to_i == 0\n flash[:status] = _('Analysis_completed')\n @cdr_analize[:file_lines] = session[:cdr_import_csv2][:file_lines]\n session[:cdr_analize] = @cdr_analize\n end\n end\n\n # fix bad cdrs\n if @step == 6\n my_debug_time \"step 6\"\n @cdr_analize = session[:cdr_analize]\n @cdr_analize[:file_lines] = session[:cdr_import_csv2][:file_lines]\n @options = {}\n session[:cdrs_import] ? @options = session[:cdrs_import] : @options = {}\n # search\n params[:page] ? @options[:page] = params[:page].to_i : (@options[:page] = 1 if !@options[:page])\n params[:hide_error] ? @options[:hide] = params[:hide_error].to_i : (@options[:hide] = 0 if !@options[:hide])\n\n cond = \"\"\n if @options[:hide].to_i > 0\n cond = \" AND nice_error != 2\"\n end\n\n @providers = current_user.load_providers(:all, :conditions => 'hidden=0')\n fpage, @total_pages, @options = pages_validator(@options, ActiveRecord::Base.connection.select_value(\"SELECT COUNT(*) FROM #{session[:temp_cdr_import_csv]} WHERE f_error = 1 #{cond }\").to_d, params[:page])\n @import_cdrs = ActiveRecord::Base.connection.select_all(\"SELECT * FROM #{session[:temp_cdr_import_csv]} WHERE f_error = 1 #{cond } LIMIT #{fpage}, #{session[:items_per_page]}\")\n @next_step = session[:cdr_import_csv2][:create_callerid].to_i == 0 ? 9 : 7\n end\n\n if session[:cdr_import_csv2][:create_callerid].to_i == 1 and @step == 7 or @step == 8\n # create clis\n if @step == 7\n my_debug_time \"step 7\"\n @cdr_analize = Call.analize_cdr_import(session[:temp_cdr_import_csv], session[:cdr_import_csv2])\n @cdr_analize[:file_lines] = session[:cdr_import_csv2][:file_lines]\n cclid = Callerid.create_from_csv(session[:temp_cdr_import_csv], session[:cdr_import_csv2])\n flash[:status] = _('Create_clis') + \": #{cclid.to_i}\"\n end\n\n # assigne clis\n if @step == 8\n my_debug_time \"step 8\"\n session[:cdr_import_csv2][:step] = 8\n session[:cdrs_import2] ? @options = session[:cdrs_import2] : @options = {}\n # search\n params[:page] ? @options[:page] = params[:page].to_i : (@options[:page] = 1 if !@options[:page])\n\n\n @cdr_analize = Call.analize_cdr_import(session[:temp_cdr_import_csv], session[:cdr_import_csv2])\n @cdr_analize[:file_lines] = session[:cdr_import_csv2][:file_lines]\n\n fpage, @total_pages, @options = pages_validator(@options, Callerid.count(:all, :conditions => {:device_id => -1}).to_d, params[:page])\n @clis = Callerid.find(:all, :conditions => {:device_id => -1}, :offset => fpage, :limit => session[:items_per_page])\n\n @users = User.select(\"users.*, #{SqlExport.nice_user_sql}\").joins(\"JOIN devices ON (users.id = devices.user_id)\").where(\"hidden = 0 and devices.id > 0 AND owner_id = #{correct_owner_id}\").order(\"nice_user ASC\").group('users.id')\n end\n else\n if @step == 7 or @step == 8\n dont_be_so_smart\n redirect_to :action => :import_csv, :step => 6 and return false\n end\n end\n\n # create cdrs with user and device\n if @step == 9\n my_debug_time \"step 9\"\n start_time = Time.now\n @cdr_analize = Call.analize_cdr_import(session[:temp_cdr_import_csv], session[:cdr_import_csv2])\n @cdr_analize[:file_lines] = session[:cdr_import_csv2][:file_lines]\n begin\n @total_cdrs, @errors = Call.insert_cdrs_from_csv(session[:temp_cdr_import_csv], session[:cdr_import_csv2])\n flash[:status] = _('Import_completed')\n session[:temp_cdr_import_csv] = nil\n @run_time = Time.now - start_time\n MorLog.my_debug Time.now - start_time\n rescue Exception => e\n flash[:notice] = _('Error')\n MorLog.log_exception(e, Time.now, 'CDR', 'csv_import')\n end\n end\n else\n flash[:notice] = _('Please_Select_Columns')\n redirect_to :action => :import_csv, :step => \"2\" and return false\n end\n else\n flash[:notice] = _('Zero_file')\n redirect_to :controller => \"tariffs\", :action => \"list\" and return false\n end\n end\n end", "def import\n begin\n file = params[:file]\n if params[:user_id]\n user = User.find_by_id(params[:user_id])\n else\n user = current_user\n end\n CSV.foreach(file.path, headers: true) do |row|\n Product.create!(\n :brand => row['brand'],\n :name => row['model'],\n :description => row['description'],\n :status => false,\n :user_id => user.id,\n :size_details => row['size_details'],\n :product_return_policy => row['return_policy'],\n :usd_price => row['usd_price'].to_i,\n :cad_price => row['cad_price'].to_i,\n :factory_sku => row['sku'],\n :cad_domestic_shipping => user.cad_domestic_shipping,\n :cad_foreign_shipping => user.cad_foreign_shipping,\n :usd_domestic_shipping => user.usd_domestic_shipping,\n :usd_foreign_shipping => user.usd_foreign_shipping)\n end # end CSV.foreach\n redirect_to admin_products_url, notice: \"Products successfully imported.\"\n rescue\n redirect_to admin_products_new_import_url, alert: \"There was an error. Check your file and try again.\"\n end\n end", "def import_learners_from_csv\n assessment_id = params[:user][:assessment_id]\n unless params[:import][:excel].nil? or params[:import][:excel].blank? then\n @import = Import.new(params[:import])\n mime = (MIME::Types.type_for(@import.excel.path)[0])\n unless mime.nil? or mime.blank? then\n mime_obj = mime.extensions[0]\n #dont process further if the uploaded file is other than xls,xls,csv\n if (!mime_obj.nil? and !mime_obj.blank?) and (mime_obj.include? \"xls\" or mime_obj.include? \"xlsx\" or mime_obj.include? \"ods\" or mime_obj.include? \"csv\" ) then\n if @import.save!\n #check for virus\n if no_virus(@import.excel.path) then\n #If mime_obj is not csv only then create roo_instace\n unless mime_obj.include? \"csv\" then\n @roo = create_roo_instance(@import.excel.path,mime_obj)\n else\n #so, its a csv format\n @roo = \"csv format\"\n end\n #if the uploaded\n unless @roo == \"Upload correct excel format.\" then\n if @roo == \"csv format\" then\n lines = parse_csv_file(@import.excel.path)\n else\n lines = parse_excel_file_roo(@roo)\n end\n \n if lines.size > 0\n @import.processed = lines.size\n i = 1\n failed_to_upload = Array.new\n lines.each do |line|\n if valid_assign(params[:id])\n if valid_learners_excel_upload(line)\n else\n failed_to_upload << i\n end\n else\n flash[:learner_limit_exceeds] = \"You cannot assign more learners\"\n end\n i = i + 1\n end\n @import.save\n\n delete_csv(@import.excel.path)\n\n @import.destroy\n if params.include? 'from_assign_learners_page' then\n redirect_to(\"/assessments/assign_learners/\" + assessment_id.to_s)\n else\n total_failed_to_upload = failed_to_upload.join(\",\")\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}?failed_to_upload=#{total_failed_to_upload}\")\n end\n else\n flash[:error] = \"CSV data processing failed.\"\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:virus_error] = \"The file is Infected with virus.\"\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:error] = 'CSV data import failed.'\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}\")\n end\n else\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}\")\n end\n end", "def upload\n\t\tif request.post?\n\t\t\tif params[:file].present?\n\t\t\t\tif params[:file].content_type == \"text/csv\" || params[:file].content_type == \"text/plain\"\n\t\t\t\t\tstart = Time.now\n\t\t\t\t msg = Datum.build_from_csv(params[:file], params[:delete_records].nil? ? nil : true)\n\t\t if msg.nil? || msg.empty?\n\t\t # no errors, success!\n\t\t\t\t\t\tmsg = I18n.t('app.msgs.upload.success', :file_name => params[:file].original_filename)\n\t\t\t\t\t\tflash[:success] = msg\n\t\t\t\t\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg), Time.now-start)\n\t\t\t\t redirect_to upload_admin_data_path #GET\n\t\t else\n\t\t # errors\n\t\t\t\t\t\tflash[:error] = I18n.t('app.msgs.upload.error', :file_name => params[:file].original_filename, :msg => msg)\n\t\t\t\t redirect_to upload_admin_data_path #GET\n\t\t end\n\t\t\t\telse\n\t\t\t\t\tflash[:error] = I18n.t('app.msgs.upload.wrong_format', :file_name => params[:file].original_filename)\n\t\t redirect_to upload_admin_data_path #GET\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tflash[:error] = I18n.t('app.msgs.upload.no_file')\n\t redirect_to upload_admin_data_path #GET\n\t\t\tend\n\t\tend\n end", "def perform(list, file)\n list.import_csv(file)\n end", "def import\n @imported_count = 0\n\n # Reject if the file attribute is nil or empty.\n if file.blank?\n errors.add(:base, \"No file is specified\") and return\n end\n\n CSV.foreach(file.path, headers: true, header_converters: :symbol) do |row|\n # Crete a user in memory.\n user = User.assign_from_row(row)\n\n # Try to save it in the database.\n if user.save\n @imported_count += 1\n else\n # The magic variable $. keeps track of the last line read in a file.\n errors.add(:base, \"Line #{$.} - #{user.errors.full_messages.join(', ')}\")\n end\n end\n end", "def do_user_status_csv_import\n if params[:import].nil?\n flash[:message] = 'Please upload a csv file'\n redirect_to admin_user_status_csv_import_path\n return\n end\n file = CSV.parse(params[:import][:csv].read)\n @failures = []\n file.each do |row|\n user_id = row[0]\n # If the user id isn't actually a number, skip this row\n # because that means it is probably a header or a blank line\n # http://stackoverflow.com/questions/10577783/ruby-checking-if-a-string-can-be-converted-to-an-integer\n begin\n user_id = Integer user_id\n rescue\n next\n end\n\n begin\n user = User.find(user_id)\n user.exclude_from_reporting = row[1]\n user.relationship_manager = row[2]\n user.associated_program = row[3]\n user.active_status = row[4]\n user.save!\n rescue\n @failures << user_id\n end\n end\n end", "def upload_file\n if params[:upload].nil?\n upload_fehler(\"Bitte eine Datei auswählen.\")\n else \n uploaded_io = params[:upload]\n @file_path = Rails.root.join('public', 'uploads', uploaded_io.original_filename)\n File.open(@file_path, 'wb') do |file|\n file.write(uploaded_io.read)\n end\n session[:csv_trennzeichen] = params[:trennzeichen]\n begin \n @headers = read_headers_from_csv(@file_path)\n @headers_with_nil = [\"Nicht vorhanden\"]\n @headers_with_nil.concat(@headers)\n if @headers.nil? || @headers.empty?\n upload_fehler(\"Dateiformat nicht korrekt, konnte keine Überschriften finden.\")\n elsif @headers.count == 1\n upload_fehler(\"Nur eine Spalte - falsches Trennzeichen?\")\n else\n render \"upload_file\"\n end\n rescue \n upload_fehler(\"Dateiformat nicht korrekt.\")\n end\n end\n end", "def perform(bulk_action_id, params)\n super\n csv = CSV.parse(params[:csv_file], headers: true)\n with_csv_items(csv, name: \"Import descriptive metadata\", filename: params[:csv_filename]) do |cocina_object, csv_row, success, failure|\n next failure.call(\"Not authorized\") unless ability.can?(:update, cocina_object)\n\n DescriptionImport.import(csv_row:)\n .bind { |description| validate_input(cocina_object, description) }\n .bind { |description| validate_changed(cocina_object, description) }\n .bind { |description| open_version(cocina_object, description) }\n .bind { |description, new_cocina_object| save(new_cocina_object, description) }\n .bind { |new_cocina_object| close_version(new_cocina_object) }\n .either(\n ->(_updated) { success.call(\"Successfully updated\") },\n ->(messages) { failure.call(messages.to_sentence) }\n )\n end\n end", "def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n # Iterate over the CSV::Table object's rows, create a string for each row, and convert each row to a Client by using the create_client method.\n csv.each do |row|\n name, facebook_id, twitter_handle = row.to_s.split(\",\").map(&:chomp)\n create_client(name, facebook_id, twitter_handle)\n end\n end", "def import\n CSV.foreach(@file.path, :converters => :all, :return_headers => false, :headers => :first_row) do |row|\n source, first_name, last_name, _, company, phone, *address = *row.to_hash.values\n\n street, city, state, zip, _ = *address\n address = Address.new(:street1 => street, :city => city, :state => state, :zipcode => zip)\n\n lead = Lead.new(:source => source, :first_name => first_name, :last_name => last_name,\n :company => company, :phone => phone)\n\n lead.first_name = \"FILL ME\" if lead.first_name.blank?\n lead.last_name = \"FILL ME\" if lead.last_name.blank?\n lead.access = \"Private\"\n lead.addresses << address\n\n lead.assignee = @assigned if @assigned.present?\n\n lead.save!\n end\n end", "def create\n\n @csv_upload = CsvUpload.new\n @csv_upload.Type = params[:Type]\n\n if params[:csv_upload][:csv_file].present? \n @csv_upload.uploadCSVFile(params[:csv_upload][:csv_file]) \n @csv_upload.filename = params[:csv_upload][:csv_file].original_filename\n end\n\n if not params[:csv_upload][:company_id].nil?\n @company = Company.find(params[:csv_upload][:company_id])\n @csv_upload.company = @company\n end\n\n respond_to do |format|\n if @csv_upload.save\n format.html { redirect_to edit_csv_upload_path(@csv_upload)}\n format.json { render json: @csv_upload, status: :created, location: @csv_upload }\n else\n format.html { render action: \"new\" }\n format.json { render json: @csv_upload.errors, status: :unprocessable_entity }\n end\n end\n end", "def process_licenses_csv_upload\n publisherId = current_user.id\n if params[:csv_file]\n begin\n n = 0\n CSV.parse(params[:csv_file].read) do |row|\n n += 1\n next if n == 1 or row.join.blank?\n power_chip = PowerChip.build_from_csv(row)\n power_chip.publisher_id = publisherId\n power_chip.status = 'added'\n power_chip.save\n end\n respond_to do |format|\n format.html { redirect_to publisher_licenses_path, notice: \"License Keys Uploaded Successfully\" }\n end\n rescue Exception => e\n logger.debug(e.message)\n flash[:error] = \"Something went wrong.Please check the CSV file.\"\n redirect_to :back\n end\n end\n end", "def parse_csv\n\t\tbegin\n\t\t\tif params[:shortened_url][:csv_file].present?\n\t\t\t\t@shortened_urls = []\n\t\t\t\tCSV.parse(params[:shortened_url][:csv_file].read, :headers => true).each do |row|\n\t\t\t\t\tresponse = ShortenedUrl.generate_short_url(row['URL'])\n\t\t\t\t\t@shortened_urls << {original_url: row['URL'], short_url: response[:short_url]}\n\t\t\t\tend\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.html {render 'csv_data.html.erb'}\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tredirect_to upload_csv_shorten_urls_path\n\t\t\tend\n\t\trescue\n\t\t\tredirect_to :back\n\t\tend\n\tend", "def import_from_csv(file_name)\n # implementation\n csv_text = File.read(file_name)\n # the variable 'csv' is a table type object\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n \n # \n csv.each do |row|\n # create a hash type variable 'row_hash'\n row_hash = row.to_hash\n # use 'add_entry' to change 'row_hash' into 'Entry', also add the new Entry into AddressBook's entries\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n end", "def create\n @csv = Csv.new(params[:csv])\n\n send_data @csv.csv_from_xml, filename: \"import.csv\", type: 'text/csv', disposition: \"attachment\" and return\n #send_data @csv.csv_from_html, filename: \"import.csv\", type: 'text/csv', disposition: \"attachment\" and return\n\n\n\n #respond_to do |format|\n #if @csv.save\n # format.csv { send_data @csv_from_html, filename: \"import.csv\", type: 'text/csv', disposition: \"attachment\" }\n # format.html { redirect_to root_url, notice: 'CSV was successfully created.' }\n #format.json { render json: @csv, status: :created, location: @csv }\n #else\n # format.html { render action: \"new\" }\n # format.json { render json: @csv.errors, status: :unprocessable_entity }\n #end\n #end\n end", "def import_course_learners_from_csv\n assessment_id = params[:user][:course_id]\n unless params[:import][:excel].nil? or params[:import][:excel].blank? then\n @import = Import.new(params[:import])\n mime = (MIME::Types.type_for(@import.excel.path)[0])\n unless mime.nil? or mime.blank? then\n mime_obj = mime.extensions[0]\n #dont process further if the uploaded file is other than xls,xls,csv\n if (!mime_obj.nil? and !mime_obj.blank?) and (mime_obj.include? \"xls\" or mime_obj.include? \"xlsx\" or mime_obj.include? \"ods\" or mime_obj.include? \"csv\" ) then\n if @import.save!\n #check for virus\n if no_virus(@import.excel.path) then\n #If mime_obj is not csv only then create roo_instace\n unless mime_obj.include? \"csv\" then\n @roo = create_roo_instance(@import.excel.path,mime_obj)\n else\n #so, its a csv format\n @roo = \"csv format\"\n end\n #if the uploaded\n unless @roo == \"Upload correct excel format.\" then\n if @roo == \"csv format\" then\n lines = parse_csv_file(@import.excel.path)\n else\n lines = parse_excel_file_roo(@roo)\n end\n\n if lines.size > 0\n @import.processed = lines.size\n i = 1\n failed_to_upload = Array.new\n lines.each do |line|\n if valid_assign(params[:id])\n if valid_learners_excel_upload(line)\n else\n failed_to_upload << i\n end\n else\n flash[:learner_limit_exceeds] = \"You cannot assign more learners\"\n end\n i = i + 1\n end\n @import.save\n\n delete_csv(@import.excel.path)\n\n @import.destroy\n if params.include? 'from_assign_learners_page' then\n redirect_to(\"/courses/assign_learners/\" + assessment_id.to_s)\n else\n total_failed_to_upload = failed_to_upload.join(\",\")\n redirect_to(\"/courses/manage_learners/#{assessment_id.to_s}?failed_to_upload=#{total_failed_to_upload}\")\n end\n else\n flash[:error] = \"CSV data processing failed.\"\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/courses/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:virus_error] = \"The file is Infected with virus.\"\n redirect_to(\"/courses/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:error] = 'CSV data import failed.'\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/courses/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/courses/manage_learners/#{assessment_id.to_s}\")\n end\n else\n redirect_to(\"/courses/manage_learners/#{assessment_id.to_s}\")\n end\n end", "def upload_csv\n @title=\"Import Users\"\n if request.post?\n CSV.parse(params[:file].read, :encoding=>\"UTF-8\") do |row|\n row = row.collect(&:to_s).collect(&:strip).collect{|s| s.gsub(\"\\\"\", \"\")}\n # row = row[0].to_s.split(\"\\t\").collect(&:strip)\n\n\t Businessnew.create({:address=>row[3], :category=>row[10], :city=>row[4], :id=>row[0],\n :latitude=>row[9], :longitude=>row[8], :name=>row[1], :phone=>row[7],\n :postal_code=>row[6].split(\" \").join(''), :state=>row[5], :url=>row[2]}) if Businessnew.present?\n\n#force_encoding(\"UTF-8\")\n#.encode(\"ISO-8859-1\")\n#.force_encoding(\"ISO-8859-1\").encode(\"UTF-8\")\n#force_encoding(\"BINARY\")\n\n # CsvBusiness.create({\n # :address=>row[5],\n #:city=>row[6],\n #:company_name=>row[4],\n #:contact_name=>row[9],\n #:employee=>row[12],\n #:fax_number=>row[15],\n #:gender=>row[10],\n # :major_division_description=>row[0],\n # :phone_number=>row[14],\n # :province=>row[7],\n # :sales=>row[13],\n # :sic_2_code_description=>row[1],\n # :sic_4_code=>row[2],\n # :sic_4_code_description=>row[3],\n #:title=>row[11],\n #:zip_code=>row[8]\n # })\n\n=begin\n#20130615051307\n\t\tStoreTiming.create({:id=>row[0], :business_id=>row[1], :mon_from=>row[2], :mon_to=>row[3], :tue_from=>row[4], :tue_to=>row[5], :wed_from=>row[6], :wed_to=>row[7], :thur_from=>row[8], :thur_to=>row[9],\n :fri_from=>row[10], :fri_to=>row[11], :sat_from=>row[12], :sat_to=>row[13],\n :sun_from=>row[14], :sun_to=>row[15]})\n=end\n end\n\n flash[:notice] = \"Uploading completed.\"\n redirect_to root_path\n else\n render :layout => false\n end\n\n end", "def create\n @import = Import.new(import_type: import_params[:import_type], filename: import_params[:file].original_filename)\n if @import.valid_file_type?(import_params)\n @import.save\n @export_json = @import.handle_import_file(@import.import_type, import_params[:file])\n else\n #Handle error message response\n @export_json = 'File format must be a csv'\n end\n respond_to do |format|\n # format.html { redirect_to imports_path(@export_json) }\n format.json {render json: @export_json }\n end\n end", "def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true)\n # Iterate over the table object's rows\n csv.each do |row|\n # Create a hash for each row\n row_hash = row.to_hash\n # Convert each row_hash to an Entry by using add_entry method\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n\n # Get the number of items parsed by calling the count method\n return csv.count\n end", "def csv_upload_grader_mapping\n if !request.post? || params[:grader_mapping].nil?\n flash[:error] = 'You must supply a CSV file for group to grader mapping'\n redirect_to action: 'manage', id: params[:id]\n return\n end\n\n invalid_lines = Grouping.assign_tas_by_csv(params[:grader_mapping].read, params[:id])\n if invalid_lines.size > 0\n flash[:invalid_lines] = invalid_lines\n end\n redirect_to action: 'manage', id: params[:id]\n end", "def import\n Item.import( params[:file])\n redirect_to '/items', notice: 'Items Imported.'\n end", "def delegate_import\n if Rails.env == 'development'\n # use local file path on development\n csv = open(self.import.import_file.products.path)\n else\n # use s3 file on production\n csv = open_tmp_file(self.import.import_file.products.url)\n end\n\n\n # Send file to fnz module using import api\n response = RestClient.post Fnz::HOST + '/api/v0/imports',\n app_key: Fnz::API_KEY,\n import: {\n object: 'Product',\n padma_id: self.import.account.name,\n upload: csv\n }\n if response.code == 201\n # If import was created successfully create a product importer\n #that will show the status of this import\n remote_import_id = JSON.parse(response.body)['id']\n self.update_attributes(status_url: Fnz::HOST + '/api/v0/imports/' + remote_import_id.to_s)\n end\n end", "def import_csv\n step_names = [\n _('Import_cards'), _('File_upload'), _('Column_assignment'), _('Column_confirmation'), _('Analysis'),\n _('Create_cards')\n ]\n @step = params[:step] ? params[:step].to_i : 0\n\n if @step <= 0 || @step > step_names.size\n flash[:notice] = _('Please_upload_file')\n redirect_to action: :new, cg: @cg.id\n end\n\n @step_name = step_names[@step]\n @page_title = _('Import_CSV') + '&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;' + _('Step') + ': ' + @step.to_s +\n '&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;' + @step_name.to_s\n @page_icon = 'excel.png'\n\n @sep, @dec = Application.nice_action_session_csv(params, session, correct_owner_id)\n\n if @step == 1\n my_debug_time 'step 1'\n session[:temp_card_import_csv] = nil\n session[:card_import_csv] = nil\n\n if params[:file]\n @file = params[:file]\n\n if @file.present?\n if !@file.respond_to?(:original_filename) || !@file.respond_to?(:read) || !@file.respond_to?(:rewind)\n flash[:notice] = _('Please_select_file')\n redirect_to(action: :new, cg: @cg.id) && (return false)\n end\n\n unless get_file_ext(@file.original_filename, 'csv')\n @file.original_filename\n flash[:notice] = _('Please_select_CSV_file')\n redirect_to(action: :new, cg: @cg.id) && (return false)\n end\n\n @file.rewind\n file = @file.read\n session[:card_file_size] = file.size\n session[:temp_card_import_csv] = CsvImportDb.save_file('_crd_', file)\n flash[:status] = _('File_downloaded')\n redirect_to(action: :import_csv, step: 2, cg: @cg.id) && (return false)\n else\n session[:temp_card_import_csv] = nil\n flash[:notice] = _('Please_select_file')\n redirect_to(action: :new, cg: @cg.id) && (return false)\n end\n else\n session[:temp_card_import_csv] = nil\n flash[:notice] = _('Please_upload_file')\n redirect_to(action: :new, cg: @cg.id) && (return false)\n end\n end\n\n if @step == 2\n my_debug_time \"step 2\\nuse : #{session[:temp_card_import_csv]}\"\n\n if session[:temp_card_import_csv]\n file = CsvImportDb.head_of_file(\"/tmp/#{session[:temp_card_import_csv]}.csv\", 20).join('')\n session[:file] = file\n\n if check_csv_file_seperators(file, 2, 2, {cg: @cg, line: 0})\n @fl = CsvImportDb.head_of_file(\"/tmp/#{session[:temp_card_import_csv]}.csv\", 1).join('').split(@sep)\n begin\n colums = {\n colums: [\n {name: 'f_error', type: 'INT(4)', default: 0},\n {name: 'nice_error', type: 'INT(4)', default: 0},\n {name: 'do_not_import', type: 'INT(4)', default: 0},\n {name: 'changed', type: 'INT(4)', default: 0},\n {name: 'not_found_in_db', type: 'INT(4)', default: 0},\n {name: 'id', type: 'INT(11)', inscrement: ' NOT NULL auto_increment '}\n ]\n }\n session[:card_import_csv] =\n CsvImportDb.load_csv_into_db(session[:temp_card_import_csv], @sep, @dec, @fl, nil, colums, false)\n @lines_number =\n ActiveRecord::Base.connection.select_value(\"SELECT COUNT(*) FROM #{session[:card_import_csv]}\")\n rescue => e\n MorLog.log_exception(e, Time.now.to_i, params[:controller], params[:action])\n session[:import_csv_card_import_csv_options] = {\n sep: @sep,\n dec: @dec\n }\n session[:file] = File.open(\"/tmp/#{session[:temp_card_import_csv]}.csv\", 'rb').read\n CsvImportDb.clean_after_import(session[:temp_card_import_csv])\n session[:temp_card_import_csv] = nil\n redirect_to(action: :import_csv, step: 2, cg: @cg.id) && (return false)\n end\n\n flash[:status] = _('File_uploaded') unless flash[:notice]\n end\n else\n session[:card_import_csv] = nil\n flash[:notice] = _('Please_upload_file')\n redirect_to(action: :import_csv, step: 1, cg: @cg.id) && (return false)\n end\n end\n\n if @step > 2\n unless ActiveRecord::Base.connection.tables.include?(session[:temp_card_import_csv])\n flash[:notice] = _('Please_upload_file')\n redirect_to(action: :new, cg: @cg.id) && (return false)\n end\n\n if session[:card_import_csv]\n if @step == 3\n my_debug_time 'step 3'\n\n if params[:number_id] && params[:pin_id] && params[:number_id].to_i >= 0 && params[:pin_id].to_i >= 0\n @options = {\n imp_number: params[:number_id].to_i,\n imp_pin: params[:pin_id].to_i,\n imp_balance: params[:balance_id].to_i,\n imp_language: params[:language_id].to_i,\n sep: @sep, dec: @dec,\n file: session[:file],\n file_lines: ActiveRecord::Base.connection.select_value(\"SELECT COUNT(*) FROM #{session[:card_import_csv]}\")\n }\n\n @lines_number = @options[:file_lines]\n\n session[:card_import_csv2] = @options\n flash[:status] = _('Columns_assigned')\n else\n flash[:notice] = _('Please_Select_Columns')\n redirect_to(action: :import_csv, step: 2, cg: @cg.id) && (return false)\n end\n end\n\n if session[:card_import_csv2] && session[:card_import_csv2][:imp_pin] && session[:card_import_csv2][:imp_number]\n if @step == 4\n my_debug_time 'step 4'\n @card_analize = @cg.analize_card_import(session[:temp_card_import_csv], session[:card_import_csv2])\n session[:card_analize] = @card_analize\n\n # If calling card addon is not active than there is a limmit of 10 cards.\n unless cc_active?\n cards_to_import = 10 - Card.where(cardgroup_id: @cg.id).size\n session[:card_import_csv2][:limit] = (cards_to_import < 0) ? 0 : cards_to_import\n session[:card_analize][:cards_number] = cards_to_import\n end\n end\n\n if @step == 5\n my_debug_time 'step 5'\n start_time = Time.now\n @card_analize = session[:card_analize]\n @run_time = 0\n\n begin\n @total_cards, @errors =\n @cg.create_from_csv(current_user, session[:temp_card_import_csv], session[:card_import_csv2])\n flash[:status] = _('Import_completed')\n session[:temp_card_import_csv] = nil\n @run_time = Time.now - start_time\n rescue => e\n flash[:notice] = _('Error')\n MorLog.log_exception(e, Time.now, 'Cards', 'csv_import')\n end\n end\n else\n flash[:notice] = _('Please_Select_Columns')\n redirect_to(action: :import_csv, step: 2, cg: @cg.id) && (return false)\n end\n else\n flash[:notice] = _('Zero_file')\n redirect_to(controller: :cards, action: :list, cg: @cg.id) && (return false)\n end\n end\n end", "def import\n Schedule.import(params[:file])\n redirect_to schedules_path, notice: \"Schedules imported successfully\"\n end", "def import\n CSV.foreach(@file.path, :converters => :all, :return_headers => false, :headers => :first_row) do |row|\n campaign_id, source, tag, created_at, first_name, last_name,\n email, phone, company, title, status, background_info, comments,\n street1, street2, city, state, zip, country = *row.to_hash.values\n\n #TODO: implement smarter_csv and/or resque\n # https://github.com/tilo/smarter_csv\n # https://github.com/resque/resque\n\n # Rails.logger.info \"XXXXXXXX created_at#{created_at}\"\n\n if @make_contact\n # Don't Allow Duplicates\n contact = Contact.find_or_initialize_by_first_name_and_last_name_and_email(\n first_name,\n last_name,\n email\n ).tap do |contact|\n contact.user_id = @assigned.id,\n contact.source = source,\n contact.first_name = first_name,\n contact.last_name = last_name,\n contact.email = email,\n contact.phone = phone,\n # contact.company = company,\n contact.title = title,\n # contact.status = status,\n contact.background_info = process_bg_info(contact.background_info, background_info),\n contact.created_at = created_at.to_time rescue Time.current\n end\n contact.save!\n\n contact.first_name = \"INCOMPLETE\" if contact.first_name.blank?\n contact.last_name = \"INCOMPLETE\" if contact.last_name.blank?\n # contact.access? = \"Private | Public\"\n contact.access = Setting.default_access\n contact.assignee = @assigned if @assigned.present?\n contact.tag_list.add(tag)\n contact.add_comment_by_user(comments, @assigned)\n\n contact.save!\n\n #TODO: Better validation on address fields.\n if zip\n contact.business_address = Address.new(:street1 => street1, :street2 => street2, :city => city, :state => state, :zipcode => zip, :country => country, :address_type => \"Business\")\n else\n puts \"INCOMPLETE ADDRESS\"\n end\n contact.save!\n\n #\n if contact.account_contact.nil?\n\n if company\n account_name = company\n else\n account_name = contact.first_name + ' ' + contact.last_name + ' (Individual)'\n end\n\n #TODO: rails 4 Account.find_or_initialize_by(name: account_name)\n account = Account.find_or_initialize_by_name(account_name).tap do |account|\n account.user_id = @assigned.id\n account.assignee = @assigned if @assigned.present?\n account.access = contact.access\n account.category = 'customer'\n end\n account.save!\n\n contact.account_contact = AccountContact.new(:account => account, :contact => contact)\n\n # Rails.logger.info \"XXXXXXXX ACCOUNT CONTACT CREATED! #{contact.account_contact.inspect}\"\n\n # contact_account = { account: { id: account.id }, access: contact.access }\n # @account, @opportunity, @contact = contact.promote(contact_account)\n # contact = Contact.find(@contact)\n end\n\n # Rails.logger.info \"XXXXXXXX CONTACT CREATED! #{contact.inspect}\"\n\n else\n\n # Allow Duplicates\n # lead = Lead.new(\n # :user_id => @assigned.id,\n # :campaign_id => campaign_id.to_i,\n # :source => source,\n # :first_name => first_name,\n # :last_name => last_name,\n # :email => email,\n # :phone => phone,\n # :company => company,\n # :title => title, :status => status,\n # :background_info => background_info,\n # :created_at => created_at.to_time\n # )\n\n\n #TODO: rails 4 Lead.find_or_initialize_by(email: email) without tap\n # Don't Allow Duplicates\n lead = Lead.find_or_initialize_by_first_name_and_last_name_and_email(\n first_name,\n last_name,\n email\n ).tap do |lead|\n lead.user_id = @assigned.id,\n lead.campaign_id = campaign_id.to_i,\n lead.source = source,\n lead.first_name = first_name,\n lead.last_name = last_name,\n lead.email = email,\n lead.phone = phone,\n lead.company = company,\n lead.title = title,\n lead.status = status,\n lead.background_info = process_bg_info(lead.background_info, background_info),\n lead.created_at = created_at.to_time rescue Time.current\n end\n lead.save!\n\n lead.first_name = \"INCOMPLETE\" if lead.first_name.blank?\n lead.last_name = \"INCOMPLETE\" if lead.last_name.blank?\n\n # lead.access? = \"Private | Public\"\n lead.access = Setting.default_access\n lead.assignee = @assigned if @assigned.present?\n lead.tag_list.add(tag)\n lead.add_comment_by_user(comments, @assigned)\n lead.save!\n\n #TODO: Better validation on address fields.\n if zip\n lead.business_address = Address.new(:street1 => street1, :street2 => street2, :city => city, :state => state, :zipcode => zip, :country => country, :address_type => \"Business\")\n else\n puts \"INCOMPLETE ADDRESS\"\n end\n lead.save!\n\n end\n end\n\n\n end", "def upload # be ready for when we can accept an actual file directly uploaded instead of copy/paste\n array_of_hashes = Contact.parse_tab_delimited(params[:import])\n \n respond_to do |format|\n if Contact.import(array_of_hashes, @group)\n format.html { redirect_to [@hub, @group], :notice => 'Contacts were successfully imported.' }\n format.json { render :json => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"import\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def import \n NewBiosensor.import(params[:file])\n redirect_to root_url, notice: \"Biosensors imported\" \n end", "def import_package_learners_from_csv\n assessment_id = params[:user][:package_id]\n unless params[:import][:excel].nil? or params[:import][:excel].blank? then\n @import = Import.new(params[:import])\n mime = (MIME::Types.type_for(@import.excel.path)[0])\n unless mime.nil? or mime.blank? then\n mime_obj = mime.extensions[0]\n #dont process further if the uploaded file is other than xls,xls,csv\n if (!mime_obj.nil? and !mime_obj.blank?) and (mime_obj.include? \"xls\" or mime_obj.include? \"xlsx\" or mime_obj.include? \"ods\" or mime_obj.include? \"csv\" ) then\n if @import.save!\n #check for virus\n if no_virus(@import.excel.path) then\n #If mime_obj is not csv only then create roo_instace\n unless mime_obj.include? \"csv\" then\n @roo = create_roo_instance(@import.excel.path,mime_obj)\n else\n #so, its a csv format\n @roo = \"csv format\"\n end\n #if the uploaded\n unless @roo == \"Upload correct excel format.\" then\n if @roo == \"csv format\" then\n lines = parse_csv_file(@import.excel.path)\n else\n lines = parse_excel_file_roo(@roo)\n end\n\n if lines.size > 0\n @import.processed = lines.size\n i = 1\n failed_to_upload = Array.new\n lines.each do |line|\n if valid_assign(params[:id])\n if valid_learners_excel_upload(line)\n else\n failed_to_upload << i\n end\n else\n flash[:learner_limit_exceeds] = \"You cannot assign more learners\"\n end\n i = i + 1\n end\n @import.save\n\n delete_csv(@import.excel.path)\n\n @import.destroy\n if params.include? 'from_assign_learners_page' then\n redirect_to(\"/packages/assign_learners/\" + assessment_id.to_s)\n else\n total_failed_to_upload = failed_to_upload.join(\",\")\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}?failed_to_upload=#{total_failed_to_upload}\")\n end\n else\n flash[:error] = \"CSV data processing failed.\"\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:virus_error] = \"The file is Infected with virus.\"\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:error] = 'CSV data import failed.'\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}\")\n end\n else\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}\")\n end\n end", "def create_from_csv\n CSV.parse(csv_params[:csv]) do |row|\n @tarot.cards << Card.new(name: row[0], text: row[1], description: row[2])\n end\n\n respond_to do |format|\n if @tarot.save\n format.html { redirect_to tarot_cards_path(@tarot), notice: 'Card was successfully created.' }\n format.json { render action: 'show', status: :created, location: @card }\n else\n format.html { render action: 'new' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "def bulkGrade\n return unless request.post?\n\n # part 1: submitting a CSV for processing and returning errors in CSV\n if params[:upload]\n # get data type\n @data_type = params[:upload][:data_type].to_sym\n unless @data_type == :scores || @data_type == :feedback\n flash[:error] = \"bulkGrade: invalid data_type received from client\"\n redirect_to :controller => :home, :action => :error and return\n end\n\n # get CSV\n csv_file = params[:upload][:file]\n if csv_file\n @csv = csv_file.read\n else\n flash[:error] = \"You need to choose a CSV file to upload.\"\n redirect_to :action => :bulkGrade and return\n end\n\n # process CSV\n success, entries = parse_csv @csv, @data_type\n if success\n @entries = entries\n @valid_entries = valid_entries? entries\n else\n redirect_to :action => :bulkGrade and return\n end\n end\n end", "def import\n respond_to do |format|\n begin\n # process upload file, must be xls/xlsx(better, 'cause xls only can upload 65000 rows)\n @asset_categorization = AssetCategorization.import(params[:file])\n format.html { render action: \"new\" }\n rescue => e\n format.html { redirect_to upload_asset_categorizations_url, flash: { error: e.message } } \n end\n end\n end", "def csv_import\n if can?(:>, \"4\")\n name = params[:kit_bom_bulk_operation][:file].original_filename\n file_status = Kitting::KitBomBulkOperation.find_by_file_path( name )\n repeat = 0\n until file_status.nil? do\n repeat = 1 if repeat == 0\n file_status = Kitting::KitBomBulkOperation.find_by_file_path(\"#{name}(#{repeat})\")\n repeat +=1\n end\n @part_cup_count_upload = current_customer.kit_bom_bulk_operations.create(:operation_type => \"PART CUP COUNT\",:file_path => name,:status => \"UPLOADING\")\n directory = APP_CONFIG[\"csv_import_path\"]\n file_path = repeat == 0 ? name : \"#{name}(#{repeat-1})\"\n if @part_cup_count_upload.update_attributes(:file_path => file_path,:status => \"UPLOADED\")\n path = File.join(directory, file_path)\n @file_status = File.open(path, \"wb\") { |f| f.write(params[:kit_bom_bulk_operation][:file].read) }\n if File.exists?(File.join(directory,@part_cup_count_upload.file_path))\n # Check if Header present and is in correct format\n csv_text = File.read(File.join(directory,@part_cup_count_upload.file_path))\n header = CSV.parse_line(csv_text)\n if header == [\"PART NUMBER\", \"LARGE CUP COUNT\", \"MEDIUM CUP COUNT\", \"SMALL CUP COUNT\"]\n flash[:success] = \"File Uploaded and will be processed Shortly.\"\n redirect_to upload_parts_path\n else\n flash[:error] = \"INVALID HEADERS/DOWNLOAD SAMPLE CSV FOR HEADER FORMAT.\"\n FileUtils.rm_rf File.join(directory,@part_cup_count_upload.file_path)\n @part_cup_count_upload.destroy\n redirect_to upload_parts_path\n end\n else\n flash[:error] = \"INVALID FILE FORMAT.\"\n @part_cup_count_upload.destroy\n redirect_to upload_parts_path\n end\n else\n flash[:error] = \"INVALID FILE FORMAT.\"\n @part_cup_count_upload.destroy\n redirect_to upload_parts_path\n end\n else\n redirect_to main_app.unauthorized_url\n end\n end", "def import\n User.import(params[:file])\n redirect_to users_path\n end", "def upload\n @grade_entry_form = record\n begin\n data = process_file_upload\n rescue Psych::SyntaxError => e\n flash_message(:error, t('upload_errors.syntax_error', error: e.to_s))\n rescue StandardError => e\n flash_message(:error, e.message)\n else\n if data[:type] == '.csv'\n overwrite = params[:overwrite]\n grades_file = data[:file]\n result = @grade_entry_form.from_csv(grades_file.read, overwrite)\n flash_message(:error, result[:invalid_lines]) unless result[:invalid_lines].empty?\n flash_message(:success, result[:valid_lines]) unless result[:valid_lines].empty?\n end\n end\n redirect_to action: 'grades', id: @grade_entry_form.id\n end", "def import\n Student.import(params[:file], params[:course][:id])\n @course = Course.find_by_id(params[:course][:id])\n @students = @course.students\n # redirect_to show_students_url, notice: \"Students imported successfully.\"\n end", "def batch_import_params\n params.permit(:file)\n end", "def valid_csv_file\n if params[:file].nil?\n flash[:notice] = \"No File Uploaded!\"\n redirect_to people_url\n elsif params[:file].content_type != 'text/csv'\n flash[:notice] = \"File type must be csv: #{params[:file].original_filename}\"\n redirect_to people_url\n end\n end", "def import_traits\n if request.post?\n if Rails.env.production?\n @file = CSV.parse(params[:file].read)\n else\n @file = FasterCSV.parse(params[:file].read)\n end\n \n @file.each do |row|\n\n next unless row.present? and row[5].present?\n next if row[0] == 'action' # for the top header row\n \n trait = Trait.find_or_initialize_by_token(row[6])\n parent_trait = Trait.find_by_token(row[8]) rescue nil\n parent_trait_id = parent_trait.id if parent_trait\n trait.attributes = {:verb => row[1],\n :noun => row[2],\n :do_name => row[3],\n :dont_name => row[4],\n :answer_type => row[5],\n :primary_pack_token => row[7],\n :parent_trait_id => parent_trait_id,\n :setup_required => row[9],\n :daily_question => row[10],\n :article => row[11],\n :past_template => row[12],\n :hashtag => row[13]}\n\n if row[0].present? and row[0] == 'delete'\n PackTrait.destroy_all(:trait_id => trait.id)\n trait.destroy\n else \n if trait.save and trait.primary_pack_token.present?\n logger.warn \"SUCCESS TRAIT: #{trait.inspect}\"\n pack = Pack.find_or_create_by_token(trait.primary_pack_token)\n unless pack.traits.include?(trait)\n pack.pack_traits.create({:trait_id => trait.id})\n end\n else\n logger.warn \"FAIL TRAIT: #{trait.inspect}\" \n end\n end\n end \n end\n redirect_to :action => :index\n end", "def create\n @portfolio = Portfolio.new(portfolio_params)\n\n if params[:portfolio][:google].present?\n # Check if file was selected\n csv_file = params[:portfolio][:google].read\n @portfolio.import_csv(csv_file, current_user)\n end\n respond_to do |format|\n if @portfolio.save\n format.html { redirect_to portfolios_path, notice: 'Portfolio was successfully created.' }\n format.json { render action: 'show', status: :created, location: @portfolio }\n else\n format.html { render action: 'new' }\n format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n end\n end\n end", "def import\n Project.import(params[:file])\n redirect_to students_path, notice: \"Projects imported.\"\n end", "def import\n @parsed_file=CSV::Reader.parse(params[:dump][:file])\n n=0\n @parsed_file.each do |row|\n c=Ad.new\n c.name=row[1]\n c.phone=row[2]\n c.company=row[3]\n c.business_item=row[4]\n c.copy1=row[5]\n c.copy2=row[6]\n c.phone2=row[7]\n c.fax=row[8]\n c.www=row[9]\n c.hp=row[10]\n c.kind=row[11]\n c.size=row[12]\n c.template=row[13]\n end\n if c.save\n n=n+1\n GC.start if n%50==0\n end\n flash.now[:message]=\"CSV Import Successful, #{n} new records added to data base\"\n \n end", "def import\n Category.import(params[:file])\n flash[:success] = 'Emails were successfully imported'\n redirect_to digest_emails_admin_path \n end", "def import\n DispensarySourceProduct.import(params[:file])\n flash[:success] = 'Dispensary Source Products were successfully imported'\n redirect_to dispensary_source_products_admin_path \n end", "def save_csv\n if params[:upload_csv].blank?\n flash[:error] = 'Please upload file'\n else\n errors = User.upload_csv(params[:upload_csv][:csv])\n errors.blank? ? (flash[:notice] = 'New users invited successfully') : flash[:error] = errors\n end\n redirect_to admin_users_path\n end", "def upload\n @grade_entry_form = GradeEntryForm.find(params[:id])\n begin\n data = process_file_upload\n rescue Psych::SyntaxError => e\n flash_message(:error, t('upload_errors.syntax_error', error: e.to_s))\n rescue StandardError => e\n flash_message(:error, e.message)\n else\n if data[:type] == '.csv'\n overwrite = params[:overwrite]\n grades_file = data[:file]\n result = @grade_entry_form.from_csv(grades_file.read, overwrite)\n flash_message(:error, result[:invalid_lines]) unless result[:invalid_lines].empty?\n flash_message(:success, result[:valid_lines]) unless result[:valid_lines].empty?\n end\n end\n redirect_to action: 'grades', id: @grade_entry_form.id\n end", "def delegate_import\n if Rails.env == 'development'\n # use local file path on development\n csv = open(self.import.import_file.time_slots.path)\n else\n # use s3 file on production\n csv = open_tmp_file(self.import.import_file.time_slots.url)\n end\n\n\n # Send file to attendance module using import api\n # The last two headers are: vacancy (it doesn't matter) and school_id (already imported)\n response = RestClient.post Attendance::HOST + '/api/v0/imports',\n app_key: Attendance::API_KEY,\n account_name: self.import.account.name,\n import: {\n object: 'TimeSlot',\n csv_file: csv,\n headers: headers\n }\n if response.code == 201\n # If import was created successfully create a time_slot importer\n #that will show the status of this import\n remote_import_id = JSON.parse(response.body)['id']\n self.update_attributes(status_url: Attendance::HOST + '/api/v0/imports/' + remote_import_id.to_s)\n end\n end", "def import_csv\n before_count = BgMeasurement.where(:user_id => current_user.id).count\n BgMeasurement.import_csv(params[:file], current_user)\n after_count = BgMeasurement.where(:user_id => current_user.id).count\n redirect_to bg_measurements_path, :notice => \"#{(after_count-before_count)} readings successfully uploaded into database\"\n end", "def parse_csv\n if self.csv_file.present?\n csv_text = Paperclip.io_adapters.for(self.csv_file).read\n csv = CSV.parse(csv_text, :headers => false)\n\n csv_columns = ['l', 'r', 'units']\n\n csv_to_save = {}\n\n csv.each_with_index do |row, i|\n if i == 0\n csv_to_save['weight'] = row[1].split(':')[1] # string is like Weight:201, only want the number\n csv_to_save['shoe_size'] = row[2].split(':')[1] # string is like Shoe Size:9\n elsif i >= 3\n row.each_with_index do |field, j|\n if j >= 1 and !field.blank?\n csv_to_save[generate_csv_row_key(csv_columns, row, i, j)] = field\n end\n end\n end\n end\n\n # Check to see if any of the fields are nil, then we must have not received the correct file\n is_clean = true\n csv_to_save.each do |key, val|\n if val.nil?\n is_clean = false\n break\n end\n end\n\n CsvFile.create!(csv_to_save) if is_clean\n end\n end", "def import_data path, file_type\n if file_type == :csv\n csv_parse(path).each { |params| Product.new(params).save }\n elsif file_type == :xls\n #xls_parse(path)\n end\nend" ]
[ "0.76166224", "0.7596468", "0.73232114", "0.7321852", "0.73090726", "0.7177098", "0.7153369", "0.71468693", "0.7121341", "0.71149886", "0.70809525", "0.7061352", "0.7048606", "0.70431477", "0.70223266", "0.6974748", "0.69640493", "0.6879288", "0.68585986", "0.6842251", "0.68315387", "0.68101937", "0.67991513", "0.67820686", "0.6772066", "0.67360395", "0.6730169", "0.672366", "0.6718379", "0.6696799", "0.66935855", "0.66841745", "0.6658281", "0.6656465", "0.66351765", "0.66177696", "0.6607205", "0.6587985", "0.6569457", "0.65457916", "0.6542021", "0.653457", "0.652808", "0.651791", "0.6511798", "0.65058726", "0.64781487", "0.64767575", "0.64380914", "0.6435653", "0.643416", "0.63862807", "0.6373039", "0.6369843", "0.6366558", "0.63521814", "0.6347326", "0.6338281", "0.6329404", "0.63284373", "0.63113475", "0.63010037", "0.6297047", "0.629581", "0.62888074", "0.62857366", "0.6282125", "0.62467027", "0.624057", "0.6238922", "0.62371844", "0.6233278", "0.6215425", "0.62044483", "0.61960334", "0.6193722", "0.61900043", "0.61851716", "0.61827326", "0.61785907", "0.61616635", "0.61333674", "0.61318004", "0.61113274", "0.6100136", "0.60985136", "0.6092123", "0.60911185", "0.6085853", "0.6082057", "0.6073501", "0.60633796", "0.60548556", "0.6051832", "0.6051301", "0.6044154", "0.60370725", "0.6036591", "0.6025785", "0.6019581", "0.6012757" ]
0.0
-1
POST Upload an SVG map
def map_upload unless params[:uploaded_map].blank? require 'fileutils' # Ensure public/maps exists FileUtils::mkdir_p "public/maps" directory = "public/maps.tmp" # Ensure a blank maps.tmp directory exists FileUtils.rm_rf directory FileUtils::mkdir_p directory # Copy the existing maps into that directory # (to support the case where the user is updating maps and doesn't specify # all of the existing maps.) FileUtils.cp_r 'public/maps/.', directory # Copy uploaded files to maps.tmp, overriding any old maps that were # just copied in the line above. params[:uploaded_map].each do |map| path = File.join(directory, "floor" + map[0].to_s + ".svg") File.open(path, "wb") { |f| f.write(map[1].read) } end notice = "Maps were successfully uploaded." $MAP_DATE = Time.now.to_i else error = "Error uploading SVG map" end # unless uploaded_map.blank? respond_to do |format| format.html { redirect_to action: "index", error: error, notice: notice } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_modified_svg(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, 'File')\n end", "def create\n @svgpost = Svgpost.new(params[:svgpost])\n\n respond_to do |format|\n if @svgpost.save\n format.html { redirect_to @svgpost, notice: 'Svgpost was successfully created.' }\n format.json { render json: @svgpost, status: :created, location: @svgpost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @svgpost.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @svg_file = Cmtool::SvgFile.new(svg_file_params)\n\n respond_to do |format|\n if @svg_file.save\n format.html { redirect_to(cmtool.svg_files_path, :notice => I18n.t('cmtool.action.create.successful', :model => Cmtool::SvgFile.model_name.human)) }\n format.xml { render :xml => @svg_file, :status => :created, :location => @svg_file }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @svg_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "def modify_svg(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'File')\n end", "def create\n #@map = Map.new(params[:map])\n if !params[:type].nil?\n #update the map info: height and width\n @map = Map.find(params[:map_id])\n height_scale = (params[:height]).to_f/@map.height\n width_scale = (params[:width]).to_f/@map.width\n respond_to do |format|\n if @map.update_attributes(height: params[:height], width: params[:width])\n format.html { redirect_to @map, notice: 'Node was successfull y updated.' }\n format.json { render json: @map, status: :created, location: @map }\n #update the node info when the map info changed...\n @map.nodes.each do |node|\n new_x = node.x * width_scale\n new_y = node.y * height_scale\n node.update_attributes(x: new_x, y:new_y)\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n else\n @map = Map.new(params[:map])\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render json: @map, status: :created, location: @map }\n else\n format.html { render action: \"new\" }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @map = Map.new(map_params)\n @file = @map.meta_data\n # binding.pry\n\n @meta_data = []\n @kind = @map.kind\n fips_to_hc_key\n @map.meta_data = @meta_data\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render :show, status: :created, location: @map }\n else\n format.html { render :new }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end", "def example(request,response2)\n `rsvg-convert /tmp/chart.svg -o /tmp/chart.png`### Conversion of charts from .svg format provided by GerbilCharts to .png format\n file=File.read(\"/tmp/chart.png\")\n response2[\"Content-Type\"] = \"image/png\"\n response2.write(file)\n response2.finish\n end", "def to_svg\n if (@fullscreen or @layout.fullscreenmap)\n #then we can skip the subscreen rendering with tempfiles and dump the map's svg\n funkygps.map.to_svg\n else\n out = %{<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\\n}\n out << %{<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\\n}\n out << %{<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"#{width}px\" height=\"#{height}px\">\\n}\n @layout.subscreens.each do |subscreen|\n out << add_svg(x: @layout.x(of:subscreen), y: @layout.y(of:subscreen), width: @layout.width(of:subscreen), height: @layout.height(of: subscreen), svg: funkygps.instance_variable_get(subscreen).to_svg) if @layout.is_visible(screen: subscreen)\n end\n out << %{</svg>}\n out\n end\n end", "def upload_gpx\n upload_file(params[:gpx_file]) if params[:gpx_file]\n end", "def map_params\n params.require(:map).permit(:title, :subtitle, :meta_data, :file, :state, :kind)\n end", "def new\n @svgpost = Svgpost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @svgpost }\n end\n end", "def put_pdf_in_request_to_svg_with_http_info(out_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.put_pdf_in_request_to_svg ...\"\n end\n # verify the required parameter 'out_path' is set\n if @api_client.config.client_side_validation && out_path.nil?\n fail ArgumentError, \"Missing the required parameter 'out_path' when calling PdfApi.put_pdf_in_request_to_svg\"\n end\n # resource path\n local_var_path = \"/pdf/convert/svg\"\n\n # query parameters\n query_params = {}\n query_params[:'outPath'] = out_path\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n post_body = opts[:'file'] if !opts[:'file'].nil?\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/octet-stream'])\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AsposeResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#put_pdf_in_request_to_svg\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def put_svg_in_storage_to_pdf_with_http_info(name, src_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.put_svg_in_storage_to_pdf ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.put_svg_in_storage_to_pdf\"\n end\n # verify the required parameter 'src_path' is set\n if @api_client.config.client_side_validation && src_path.nil?\n fail ArgumentError, \"Missing the required parameter 'src_path' when calling PdfApi.put_svg_in_storage_to_pdf\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/create/svg\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'srcPath'] = src_path\n query_params[:'adjustPageSize'] = opts[:'adjust_page_size'] if !opts[:'adjust_page_size'].nil?\n query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?\n query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?\n query_params[:'isLandscape'] = opts[:'is_landscape'] if !opts[:'is_landscape'].nil?\n query_params[:'marginLeft'] = opts[:'margin_left'] if !opts[:'margin_left'].nil?\n query_params[:'marginBottom'] = opts[:'margin_bottom'] if !opts[:'margin_bottom'].nil?\n query_params[:'marginRight'] = opts[:'margin_right'] if !opts[:'margin_right'].nil?\n query_params[:'marginTop'] = opts[:'margin_top'] if !opts[:'margin_top'].nil?\n query_params[:'dstFolder'] = opts[:'dst_folder'] if !opts[:'dst_folder'].nil?\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AsposeResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#put_svg_in_storage_to_pdf\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n data = []\n trace_params.each do |p|\n hash = {\n latitude: p[\"latitude\"],\n longitude: p[\"longitude\"]\n }\n data << hash\n end\n\n if Trace.upload_data(data)\n render json: {status: 'OK'}\n else\n render json: @trace.errors, status: :unprocessable_entity\n end\n end", "def create\n @gmap = Gmap.new(params[:gmap])\n\n respond_to do |format|\n if @gmap.save\n format.html { redirect_to @gmap, notice: 'Gmap was successfully created.' }\n format.json { render json: @gmap, status: :created, location: @gmap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gmap.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_svg(filename)\n File.open(\"#{filename}.svg\", 'w') { |f| f.write(to_svg) }\n end", "def create\n @artwork_image_map = ArtworkImageMap.new(artwork_image_map_params)\n\n respond_to do |format|\n if @artwork_image_map.save\n format.html { redirect_to @artwork_image_map, notice: 'Artwork image map was successfully created.' }\n format.json { render :show, status: :created, location: @artwork_image_map }\n else\n format.html { render :new }\n format.json { render json: @artwork_image_map.errors, status: :unprocessable_entity }\n end\n end\n end", "def asigna_pixi_geojson\n file = File.read(Rails.root.join('public', 'topojson', \"#{tipo.estandariza}.geojson\"))\n json = JSON.parse(file)\n json[region_id.to_s]\n end", "def create\n @gmap = Gmap.new(gmap_params)\n\n respond_to do |format|\n if @gmap.save\n format.html { redirect_to @gmap, notice: 'Gmap was successfully created.' }\n format.json { render :show, status: :created, location: @gmap }\n else\n format.html { render :new }\n format.json { render json: @gmap.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @map_image = MapImage.new(params[:map_image])\n\n respond_to do |format|\n if @map_image.save\n format.html { redirect_to(@map_image, :notice => 'Map image was successfully created.') }\n format.xml { render :xml => @map_image, :status => :created, :location => @map_image }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @map_image.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @map = Map.new(map_params)\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n else\n format.html { redirect_to maps_url }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_svg(x:, y:, width:, height:, svg:)\n %{<image x=\"#{x}\" y=\"#{y}\" width=\"#{width}\" height=\"#{height}\" xlink:href='#{embed_svg(svg: svg)}' />\\n}\n end", "def create\n @map = Map.new(params[:map])\n @map.user = current_user\n\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to request.env[\"HTTP_REFERER\"] || @map.mapable, notice: 'Map added!' }\n format.json { render json: @map, status: :created, location: @map }\n else\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if current_user && current_user.role == \"admin\" \n saved,@node,@revision = DrupalNode.new_node({\n :uid => current_user.uid,\n :title => params[:title],\n :body => params[:body],\n :type => \"map\",\n :main_image => params[:main_image]\n })\n\n if saved\n if params[:tags]\n params[:tags].split(',').each do |tagname|\n @node.add_tag(tagname,current_user)\n end\n end\n \n # save main image\n if params[:main_image] && params[:main_image] != \"\"\n img = Image.find params[:main_image]\n unless img.nil?\n img.nid = @node.id\n img.save\n end\n end\n\n @node.add_tag('lat:'+params[:lat],current_user)\n @node.add_tag('lon:'+params[:lon],current_user)\n \n map = DrupalContentTypeMap.new\n map.nid = @node.nid\n map.vid = @node.nid\n\n map.field_publication_date_value = params[:map][:field_publication_date_value]\n map.field_capture_date_value = params[:map][:field_capture_date_value]\n map.field_geotiff_url_value = params[:map][:field_geotiff_url_value]\n map.field_google_maps_url_value = params[:map][:field_google_maps_url_value]\n map.field_openlayers_url_value = params[:map][:field_openlayers_url_value]\n map.field_tms_url_value = params[:map][:field_tms_url_value]\n map.field_jpg_url_value = params[:map][:field_jpg_url_value]\n map.field_license_value = params[:map][:field_license_value]\n map.field_raw_images_value = params[:map][:field_raw_images_value]\n map.field_cartographer_notes_value = params[:map][:field_cartographer_notes_value]\n map.field_notes_value = params[:map][:field_notes_value]\n map.field_mbtiles_url_value = params[:map][:field_mbtiles_url_value]\n map.field_zoom_min_value = params[:map][:field_zoom_min_value]\n map.field_zoom_min_value ||= 17\n map.field_ground_resolution_value = params[:map][:field_ground_resolution_value]\n map.field_geotiff_filesize_value = params[:map][:field_geotiff_filesize_value]\n map.field_jpg_filesize_value = params[:map][:field_jpg_filesize_value]\n map.field_raw_images_filesize_value = params[:map][:field_raw_images_filesize_value]\n map.field_tms_tile_type_value = params[:map][:field_tms_tile_type_value]\n map.field_zoom_max_value = params[:map][:field_zoom_max_value]\n\n # need to create/delete these. Maybe best just make a new field, no need to store individual records\n #@node.drupal_content_field_map_editor\n #@node.drupal_content_field_mappers.collect(&:field_mappers_value).uniq.join(', ')\n \n ActiveRecord::Base.transaction do # in case only part of this completes\n if @node.save && @revision.save && map.save\n flash[:notice] = \"Edits saved.\"\n redirect_to @node.path\n else\n flash[:error] = \"Your edit could not be saved.\"\n render :action => :edit\n end\n end\n else\n flash[:error] = \"Your edit could not be saved.\"\n render :template => \"map/edit\"\n end\n else\n prompt_login \"Only admins can publish maps at this time.\"\n end\n end", "def create\n map = Map.new;\n map.user_id = session[:user]['id']\n map.name = params['name']\n map.map_json = params['map_json']\n\n if map.save\n render json: {save: true, message: 'zapisano poprawnie mapę', callback: 'map'}\n else\n render json: {save: false, message: 'błąd podczas zapisu mapy', callback: 'map'}\n end\n end", "def postMultipackMap_pin( multipack_id, filedata, mapPinOffsetX, mapPinOffsetY)\n params = Hash.new\n params['multipack_id'] = multipack_id\n params['filedata'] = filedata\n params['mapPinOffsetX'] = mapPinOffsetX\n params['mapPinOffsetY'] = mapPinOffsetY\n return doCurl(\"post\",\"/multipack/map_pin\",params)\n end", "def create\n @mapimage = Mapimage.new(mapimage_params)\n\n respond_to do |format|\n if @mapimage.save\n format.html { redirect_to @mapimage, notice: 'Mapimage was successfully created.' }\n format.json { render :show, status: :created, location: @mapimage }\n else\n format.html { render :new }\n format.json { render json: @mapimage.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload_weathermap_image(upload, current_user_guid, org_token, options={})\n return if upload.length==0\n self.init_uploaded_file(upload, 'WeatherMap Image', current_user_guid,\n options)\n\n oi = XmlSaving.store_original_file(@file_path, self.guid, @input_category, @mime_type) if is_file_upload\n oi = XmlSaving.store_original_input(upload, self.guid, @input_category, @mime_type) if !is_file_upload\n\n # Store the WeatherMap Images record\n WeatherMapImage.create(organization_token: org_token, image_id: oi.id)\n\n self.status = ActionStatus::SUCCEEDED\n self.save\n IngestUtilities.cleanup(self, @file_path)\n rescue Exception => e\n IngestUtilities.add_error(self, \"#{e.backtrace.first}: #{e.message} (#{e.class})\")\n ExceptionLogger.debug(\"exception: #{e}, message: #{e.message}, backtrace: #{e.backtrace}\")\n self.save\n IngestUtilities.cleanup(self, @file_path)\n end", "def create\n #FIXME check\n @map = Map.new(params[:map])\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to(@map, :notice => 'Map was successfully created.') }\n format.xml { render :xml => @map, :status => :created, :location => @map }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @map.errors, :status => :unprocessable_entity }\n end\n end\n end", "def mapimage_params\n params.require(:mapimage).permit(:map_id, :mapimage, :width, :height)\n end", "def update\n @svgpost = Svgpost.find(params[:id])\n\n respond_to do |format|\n if @svgpost.update_attributes(params[:svgpost])\n format.html { redirect_to @svgpost, notice: 'Svgpost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @svgpost.errors, status: :unprocessable_entity }\n end\n end\n end", "def write_png_from_svg(input, output, width, height)\n success = true\n begin\n Magick::Image.read(input).first.resize(width, height).write(output)\n rescue\n success = false\n end\n success\nend", "def put_pdf_in_request_to_svg(out_path, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = put_pdf_in_request_to_svg_with_http_info(out_path, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = put_pdf_in_request_to_svg_with_http_info(out_path, opts)\n else\n raise\n end\n return data\n end", "def map_params\n params.require(:map).permit(:latitude, :longitude, :name, :formatted_address, :formatted_phone_number, :rating, :url, :website, :map_ref, :photos_url)\n end", "def import_map_type_file(uploaded_file, options = {})\n path = \"#{base_uri}/import/file\"\n map_type_body = map_type_import_body(uploaded_file)\n request(path, options.merge(method: :post_multipart), map_type_body, false, MULTIPLE_MAPPINGS_UPLOAD_TIMEOUT).to_s\n end", "def map_params\n params.permit(:user_id, :image, :name)\n end", "def create\n @smallmap = Smallmap.new(params[:smallmap])\n\n respond_to do |format|\n if @smallmap.save\n format.html { redirect_to @smallmap, notice: 'Smallmap was successfully created.' }\n format.json { render json: @smallmap, status: :created, location: @smallmap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @smallmap.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_svg_in_storage_to_pdf(name, src_path, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = put_svg_in_storage_to_pdf_with_http_info(name, src_path, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = put_svg_in_storage_to_pdf_with_http_info(name, src_path, opts)\n else\n raise\n end\n return data\n end", "def create\n @map = Map.new(params[:map])\n @map.user = current_user\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render json: @map, status: :created, location: @map }\n else\n format.html { render action: \"new\" }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_regions\n shapefile = create_shapefile\n shapefile_job = ShapefileJob.new(shapefile.data.path, shapefile.id)\n shapefile_job.perform\n Region.all\nend", "def map\n build_request do |xml|\n xml.GetMapFromSession('Version' => 1) {\n xml.SessionID @session_id\n set_display_state xml\n authenticate xml\n }\n end\n \n remote_call(:map, :image)\n \n @response\n end", "def put_pdf_in_storage_to_svg_with_http_info(name, out_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.put_pdf_in_storage_to_svg ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.put_pdf_in_storage_to_svg\"\n end\n # verify the required parameter 'out_path' is set\n if @api_client.config.client_side_validation && out_path.nil?\n fail ArgumentError, \"Missing the required parameter 'out_path' when calling PdfApi.put_pdf_in_storage_to_svg\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/convert/svg\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'outPath'] = out_path\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AsposeResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#put_pdf_in_storage_to_svg\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @svg_file = Cmtool::SvgFile.find(params[:id])\n\n respond_to do |format|\n if @svg_file.update_attributes(svg_file_params)\n format.html { redirect_to(cmtool.svg_files_path, :notice => I18n.t('cmtool.action.update.successful', :model => Cmtool::SvgFile.model_name.human)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @svg_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @map = Map.new(map_params)\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render :show, status: :created, location: @map }\n else\n format.html { render :new }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end", "def svg(s)\n convert(s, mime: 'image/svg+xml')\n end", "def svg_path\n name = @options[:comune] || '\\1'\n @dataset_file_path.gsub(/(.+)\\.geojson$/, \"#{name}.svg\")\n end", "def convert_to_shp(uploaded_file)\n\n\n current_format = File.extname(self.file.file)\n if self.version_name\n\n\n content_type = self.file.content_type.match(/gpx|json|kml/)[0]\n puts content_type\n\n\n puts \"Breakpoint ********* 76\"\n puts current_format\n puts self.file.file\n puts self.file\n\n\n src = self.file.file\n\n directory = File.dirname(self.file.file)\n\n tmpfile_name = \"tempfile.#{content_type}\"\n tmpfile = File.join(directory, tmpfile_name)\n sf = self.file.copy_to(tmpfile)\n\n\n basename = File.basename(src , current_format)\n #unless basename.match(target_layer)\n tmpdir = Dir.mktmpdir(\"out\")\n\n dst = \"#{tmpdir}/#{basename}.shp\"\n parameters = []\n\n case content_type\n when \"gpx\"\n parameters << \"--config\"\n parameters << \"GPX_SHORT_NAMES YES\"\n parameters << \"-fieldTypeToString Datetime\"\n parameters << \"-overwrite\"\n parameters << \"-f\"\n parameters << '\"ESRI Shapefile\"'\n parameters << \"#{dst}\"\n parameters << \"#{tmpfile}\"\n parameters << \"tracks\"\n parameters = parameters.flatten.compact.join(\" \").strip.squeeze(\" \")\n puts `ogr2ogr #{parameters}`\n when \"kml\"\n parameters << '-WHERE \"OGR_GEOMETRY=\\\"LineString\\\"\"'\n parameters << \"-f\"\n parameters << '\"ESRI Shapefile\"'\n parameters << '-lco ENCODING=UTF-8'\n parameters << '-nlt LINESTRING'\n parameters << \"#{dst}\"\n parameters << \"#{tmpfile}\"\n parameters = parameters.flatten.compact.join(\" \").strip.squeeze(\" \")\n puts parameters\n puts `ogr2ogr #{parameters}`\n\n when \"json\"\n\n parameters << \"-f\"\n parameters << '\"ESRI Shapefile\"'\n parameters << \"#{dst}\"\n parameters << \"#{tmpfile}\"\n parameters << \"OGRGeoJSON\"\n parameters = parameters.flatten.compact.join(\" \").strip.squeeze(\" \")\n puts `ogr2ogr #{parameters}`\n\n end\n\n Dir.glob(\"#{tmpdir}/shp*\") do |filename|\n if filename.match(\"^*.shp$\")\n\n real_shp_file = File.open(filename)\n File.write(src , File.read(real_shp_file))\n real_shp_file.close\n File.unlink(real_shp_file)\n else\n FileUtils.cp(filename , directory)\n end\n end\n File.unlink(tmpfile)\n FileUtils.rmdir(\"#{directory}/out\")\n\n\n end\n end", "def create\n @tinymap = Tinymap.new(params[:tinymap])\n\n respond_to do |format|\n if @tinymap.save\n format.html { redirect_to @tinymap, notice: 'Tinymap was successfully created.' }\n format.json { render json: @tinymap, status: :created, location: @tinymap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tinymap.errors, status: :unprocessable_entity }\n end\n end\n end", "def gmap_params\n params.require(:bank).permit(:latitude, :longitude, :address)\n end", "def create\n @sasmap = Sasmap.new(params[:sasmap])\n\n respond_to do |format|\n if @sasmap.save\n format.html { redirect_to @sasmap, notice: 'Sasmap was successfully created.' }\n format.json { render json: @sasmap, status: :created, location: @sasmap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sasmap.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_svg\n\t expires_in(1.hours, :private => false, :public => true)\n\t source_fedora_object = Multiresimage.find(params[:id])\n\t authorize! :show, source_fedora_object\n\t @svg = source_fedora_object.DELIV_OPS.content()\n gon.url = DIL_CONFIG['dil_js_url']\n respond_to do |wants|\n wants.xml { render :xml => @svg }\n end\n end", "def get_svg\n\t expires_in(1.hours, :private => false, :public => true)\n\t source_fedora_object = Multiresimage.find(params[:id])\n\t authorize! :show, source_fedora_object\n\t @svg = source_fedora_object.DELIV_OPS.content()\n gon.url = DIL_CONFIG['dil_js_url']\n respond_to do |wants|\n wants.xml { render :xml => @svg }\n end\n end", "def create\n @process_map = ProcessMap.new(process_map_params)\n\n respond_to do |format|\n if @process_map.save\n format.html { redirect_to process_maps_path, notice: 'Process map was successfully created.' }\n format.json { render :show, status: :created, location: @process_map }\n else\n format.html { render :new }\n format.json { render json: @process_map.errors, status: :unprocessable_entity }\n end\n end\n end", "def process_note_svg(svg, image_id)\n root = svg.root\n raise \"#{image_id} is not an SVG image\" unless root.name == 'svg'\n \n # Strip all attributes except for viewBox.\n raise \"#{image_id} does not have a viewBox\" unless root['viewBox']\n sizes = root['viewBox'].strip.split.map(&:to_f)\n raise \"#{image_id} has a poorly formatted viewBox\" unless sizes.length == 4\n unless sizes[0] == 0 && sizes[1] == 0\n raise \"#{image_id} has a viewBox that doesn't start at 0 0\"\n end\n\n {\n :width => sizes[2], :height => sizes[3],\n :svg => root.inner_html.strip\n }\n end", "def upload\n to_png_file do |png_path|\n File.open(png_path, 'rb') do |file|\n S3.put_object bucket: Giffy::Configuration.aws.bucket, key: key, body: file\n end\n S3.put_object_acl acl: 'public-read', bucket: Giffy::Configuration.aws.bucket, key: key\n end\n end", "def upload\n to_png_file do |png_path|\n File.open(png_path, 'rb') do |file|\n S3.put_object bucket: Giffy::Configuration.aws.bucket, key: key, body: file\n end\n S3.put_object_acl acl: 'public-read', bucket: Giffy::Configuration.aws.bucket, key: key\n end\n end", "def put_pdf_in_storage_to_svg(name, out_path, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = put_pdf_in_storage_to_svg_with_http_info(name, out_path, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = put_pdf_in_storage_to_svg_with_http_info(name, out_path, opts)\n else\n raise\n end\n return data\n end", "def create\n @map = Map.new(map_params)\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render action: 'show', status: :created, location: @map }\n else\n format.html { render action: 'new' }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n \n #@reports_translation = ReportsTranslation.new\n @reports_translation = current_user.reports_translations.new\n @current_user = current_user\n 3.times do \n \t@reports_translation.images.build\n end\n coordinates = [13.83333,100.522413]\n @map = GMap.new(\"map\")\n @map.control_init(:large_map => true, :map_type => true)\n @map.center_zoom_init(coordinates,15)\n @gmarker = GMarker.new(coordinates,:title => \"Drag to Select Station\", :info_window => \"Drag to Select\", :draggable => true)\n @map.overlay_global_init(@gmarker, \"gmarker\")\n @map.overlay_init(@gmarker)\n\n @map.event_init(@gmarker, :dragend, \"function(){\n var latlng = gmarker.getLatLng().toUrlValue();\n var tmp = latlng.split(',');\n var px = tmp[0];\n var py = tmp[1];\n jQuery('#reports_translation_latitude').val(px);\n jQuery('#reports_translation_longtitude').val(py);\n }\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reports_translation }\n end\n end", "def create\n @map = Map.new(params[:map])\n @map.name = \"Map Created #{Time.now.strftime('at %I:%M%p')}\" if @map.name.blank?\n @map.description = \"No Description Provided\" if @map.description.blank?\n if points = params['markers']\n points.each do |marker_identifier, point|\n @map.points.build(:lat => point['lat'].to_f,:lng => point['lng'].to_f,:description =>point['description'], :marker_identifier => marker_identifier)\n end\n end\n respond_to do |format|\n if @map.save\n format.html { redirect_to(@map, :notice => 'Map was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def map_params\n params.require(:map).permit(:engineer_id, :instrument_id, :operation_id, :status_id)\n end", "def map_coordinates\n loc = find_or_create_geolocation(params)\n respond_to do |format|\n @geolocation_boxes = GeolocationBox.only_geo_bbox(resource.id)\n @geolocation_box = loc.geolocation_box\n format.js { render template: 'stash_datacite/geolocation_boxes/create.js.erb' }\n end\n end", "def create\n @indication_generic_map = IndicationGenericMap.new(indication_generic_map_params)\n\n respond_to do |format|\n if @indication_generic_map.save\n format.html { redirect_to @indication_generic_map, notice: 'Indication generic map was successfully created.' }\n format.json { render :show, status: :created, location: @indication_generic_map }\n else\n format.html { render :new }\n format.json { render json: @indication_generic_map.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @map = current_user.maps.new(params[:map])\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render json: @map, status: :created, location: @map }\n else\n format.html { render action: \"new\" }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @map_node = Map::Node.new(params[:map_node])\n\n respond_to do |format|\n if @map_node.save\n format.html { redirect_to @map_node, notice: 'Node was successfully created.' }\n format.json { render json: @map_node, status: :created, location: @map_node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @map_node.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_marker\n #new Ajax.Request('/projects/32/figure/_update_markers/3424', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\n @figure = Figure.find(params[:figure_id], :include => [:figure_markers, :image])\n\n if @figure.update_attributes(params[:figure])\n render :update do |page|\n\n # page.call \"foo\"\n # debugger\n # remove all possible markers\n # rjs_remove_markers(@figure)\n\n # @figure.figure_markers.each do |fm|\n # # this needs to hit all child classes\n # page.call 'remove_element' \"marker_{fm.id}\"\n # end\n\n # @figure.figure_markers.each do |fm|\n # fm.element_array do |e|\n # page.call \"add#{e.element_type}\" e.element_attributes_for_js\n # end\n # end\n\n # page.call 'createSvgRoot', 'body', 'myroot', 500, 500 \n # page.call 'addPath', 'fooid', 'mypath', 'M45.146,545.833c277.083-12.5,529.167-237.5,277.083-12.5', '#000000', 'red', 3\n\n # page.call 'removeElement', 'mypath'\n # str2 = '<svg xmlns=\"http://www.w3.org/2000/svg\" id=\"myRect8\" width=\"100\" height=\"100\"><rect x=\"5\" y=\"5\" id=\"myRect4\" rx=\"3\" ry=\"10\" width=\"15\" height=\"15\" fill=\"purple\" stroke=\"yellow\" stroke-width=\"2\"/></svg>'\n # page.call 'createSvgObjRoot', 'body', 'myroot2', str2, 500, 500\n\n # str3 = '<svg xmlns=\"http://www.w3.org/2000/svg\" id=\"myRect8\" width=\"100\" height=\"100\"><rect x=\"0\" y=\"5\" id=\"myRect4\" rx=\"3\" ry=\"10\" width=\"15\" height=\"15\" fill=\"green\" stroke=\"red\" stroke-width=\"8\"/></svg>'\n\n page.call 'updateSvgObjRoot', 'myroot2', @figure.svg \n\n # str = '<rect x=\"15\" y=\"15\" id=\"myRect2\" rx=\"3\" ry=\"10\" width=\"150\" height=\"150\" fill=\"green\" stroke=\"yellow\" stroke-width=\"8\"/>'\n # page.call 'blorf', str \n # str2 = '<svg xmlns=\"http://www.w3.org/2000/svg\" id=\"myRect8\" width=\"100\" height=\"100\"><rect x=\"5\" y=\"5\" id=\"myRect4\" rx=\"3\" ry=\"10\" width=\"15\" height=\"15\" fill=\"purple\" stroke=\"yellow\" stroke-width=\"2\"/></svg>'\n\n # page.replace_html \"figure_#{@figure.id}_img\", :partial => 'figure/svg', :locals => {:fig => @figure}\n # flash.discard\n end and return \n else\n render :update do |page|\n page.visual_effect :shake, \"annotations\" \n flash.discard\n end and return \n end \n end", "def create\n @moretinymap = Moretinymap.new(params[:moretinymap])\n\n respond_to do |format|\n if @moretinymap.save\n format.html { redirect_to @moretinymap, notice: 'Moretinymap was successfully created.' }\n format.json { render json: @moretinymap, status: :created, location: @moretinymap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @moretinymap.errors, status: :unprocessable_entity }\n end\n end\n end", "def mesh_params\n params.require(:mesh).permit(:origin, :destination, :map_name, :distance)\n end", "def preview\n @map = Map.new mapParams\n @map.name = \"preview\"\n image = @map.to_wms_query_string(type: 'image/jpeg', ext: '.jpg')\n \n render :json => {success: true, cachedImage: image, width: @map.width, height: @map.height}, :layout => false\n end", "def create\n @raw_data_file = RawDataFile.create rdf_params\n if @raw_data_file.leg_maps.count == 0\n # temp until edit form is fixed\n legmap = LegMap.create! :leg => 0, :voltchan => 0, :ampchan => 1,\n :raw_data_file_id => @raw_data_file\n legmap = LegMap.create! :leg => 1, :voltchan => 0, :ampchan => 2,\n :raw_data_file_id => @raw_data_file\n end\n\n respond_to do |format|\n if @raw_data_file.save\n flash[:notice] = 'RawDataFile was successfully created.'\n format.html { redirect_to(@raw_data_file) }\n format.xml { render :xml => @raw_data_file, :status => :created, :location => @raw_data_file }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @raw_data_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n\n @node = Node.new(params[:node])\n @node.user_id = current_user[:id]\n @json = Node.where(:user_id => current_user[:id]).to_gmaps4rails\n current_user[:optimized] = false\n\n if @node.save\n @nodes = Node.where(:user_id => current_user[:id])\n @nodes.each do |node|\n node.jobnumber = nil\n node.vehicle_id = nil\n node.servicetime = nil\n node.tour_id = nil\n node.save\n end\n project = Project.where(:user_id => current_user[:id]).first\n project.optimized = false\n project.loading = false\n project.save\n end\n\n\n\n respond_to do |format|\n if @node.save\n format.html { redirect_to(nodes_path, :notice => 'Node was successfully created.') }\n format.xml { render :xml => @node, :status => :created, :location => @node }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end", "def embed_svg(svg:)\n t = Tempfile.new(['embed','.svg'])\n t.write svg\n t.close\n t.path\n end", "def process_map_params\n params.require(:process_map).permit(:file, :admin_user, :user_id, :version)\n end", "def new\n @svg_file = Cmtool::SvgFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @svg_file }\n end\n end", "def dot_params\n params.require(:dot).permit(:map_id, :user_id, :name, :x, :y)\n end", "def poi_params\n params.require(:poi).permit(:title, :description, :longitude, :latitude, :image, :image_delete)\n end", "def to_svg\n draw\n invert_coords\n \n polygon = @coords.values.map { |c| c.join(',') }.join(' ')\n labels = ''\n \n t.each { |v| labels << vertex_label(v) << vertex_arc(v) << vertex_value(v) }\n t.each { |v| labels << edge_label(v) } # Needs to be drawn last in order to make ImageMagick render it correctly.\n \n <<-EOT\n<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"#{canvas_size}\" height=\"#{canvas_size}\">\n<polygon fill=\"#f5eae5\" stroke=\"#993300\" stroke-width=\"1\" points=\"#{polygon}\"/>\n#{labels}</svg>\nEOT\n end", "def geographic_item_params\n params.require(:geographic_item).permit(:point, :line_string, :polygon, :multi_point, :multi_line_string, :multi_polygon, :geometry_collection, :created_by_id, :updated_by_id)\n end", "def show_svg(path)\n File.open(\"app/assets/images/svg_img/#{path}\", \"rb\") do |file|\n raw file.read\n end\n end", "def map_params\n params.require(:map).permit(:address, :latitude, :longitude, :kanzume_id)\n end", "def get_svg_in_storage_to_pdf_with_http_info(src_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_svg_in_storage_to_pdf ...\"\n end\n # verify the required parameter 'src_path' is set\n if @api_client.config.client_side_validation && src_path.nil?\n fail ArgumentError, \"Missing the required parameter 'src_path' when calling PdfApi.get_svg_in_storage_to_pdf\"\n end\n # resource path\n local_var_path = \"/pdf/create/svg\"\n\n # query parameters\n query_params = {}\n query_params[:'srcPath'] = src_path\n query_params[:'adjustPageSize'] = opts[:'adjust_page_size'] if !opts[:'adjust_page_size'].nil?\n query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?\n query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?\n query_params[:'isLandscape'] = opts[:'is_landscape'] if !opts[:'is_landscape'].nil?\n query_params[:'marginLeft'] = opts[:'margin_left'] if !opts[:'margin_left'].nil?\n query_params[:'marginBottom'] = opts[:'margin_bottom'] if !opts[:'margin_bottom'].nil?\n query_params[:'marginRight'] = opts[:'margin_right'] if !opts[:'margin_right'].nil?\n query_params[:'marginTop'] = opts[:'margin_top'] if !opts[:'margin_top'].nil?\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'File')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_svg_in_storage_to_pdf\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\r\n\r\n name = params[:upload].original_filename\r\n directory = Rails.root.join('app','assets','locations');\r\n\r\n path = File.join(directory, name)\r\n File.open(path, 'wb') { |f| f.write(params[:upload].read) }\r\n @location = Location.new(:title => params[:location][:title], :image => name)\r\n mv = MapsVersion.first\r\n mv.version = mv.version+1\r\n mv.save\r\n respond_to do |format|\r\n if @location.save\r\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\r\n format.json { render json: @location, status: :created, location: @location }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @location.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def svg_image(image)\n raw image.data\n rescue Dragonfly::Job::Fetch::NotFound\n \"Image missing\"\n end", "def svg_image(image)\n raw image.data\n rescue Dragonfly::Job::Fetch::NotFound\n \"Image missing\"\n end", "def create\n params[:visualization][:user_id] = current_user.id\n\n # Remove any piggybacking updates\n if params[:visualization].try(:[], :tn_file_key)\n params[:visualization].delete :tn_file_key\n end\n if params[:visualization].try(:[], :tn_src)\n params[:visualization].delete :tn_src\n end\n\n # Try to make a thumbnail\n mo = nil\n\n if params[:visualization].try(:[], :svg)\n begin\n mo = MediaObject.new\n mo.media_type = 'image'\n mo.name = 'image.png'\n mo.file = 'image.png'\n mo.user_id = current_user.id\n mo.check_store!\n\n image = MiniMagick::Image.read(params[:visualization][:svg], '.svg')\n image.format 'png'\n image.resize '512x512'\n\n File.open(mo.file_name, 'wb') do |ff|\n ff.write(image.to_blob)\n end\n\n mo.add_tn\n rescue MiniMagick::Invalid => err\n mo = nil\n logger.info \"Failed to create thumbnail (#{err}).\"\n end\n\n params[:visualization].delete :svg\n end\n\n @visualization = Visualization.new(visualization_params)\n\n respond_to do |format|\n if @visualization.save\n unless mo.nil?\n mo.visualization_id = @visualization.id\n mo.save!\n @visualization.thumb_id = mo.id\n @visualization.save!\n end\n\n flash[:notice] = 'Visualization was successfully created.'\n format.html { redirect_to @visualization }\n format.json { render json: @visualization.to_hash(false), status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @visualization.errors, status: :unprocessable_entity }\n end\n end\n end", "def draw\n @map.draw\n end", "def render(svg, options = {})\n setup_variables(options)\n coords = generate_coordinates(options)\n \n draw(svg, coords, options)\n end", "def update\n @file = @map.meta_data\n # binding.pry\n\n @meta_data = []\n @kind = @map.kind\n fips_to_hc_key\n @map.meta_data = @meta_data\n\n respond_to do |format|\n if @map.update(map_params)\n format.html { redirect_to @map, notice: 'Map was successfully updated.' }\n format.json { render :show, status: :ok, location: @map }\n else\n format.html { render :edit }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end", "def import_shapes_from_svg(name, slide_index, image = nil, x = nil, y = nil, width = nil, height = nil, shapes = nil, group = nil, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = import_shapes_from_svg_with_http_info(name, slide_index, image, x, y, width, height, shapes, group, password, folder, storage)\n data\n end", "def import_shapes_from_svg_with_http_info(name, slide_index, image = nil, x = nil, y = nil, width = nil, height = nil, shapes = nil, group = nil, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.import_shapes_from_svg ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.import_shapes_from_svg\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.import_shapes_from_svg\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}/shapes/fromSvg'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n\n # query parameters\n query_params = {}\n query_params[:'x'] = @api_client.prepare_for_query(x) unless x.nil?\n query_params[:'y'] = @api_client.prepare_for_query(y) unless y.nil?\n query_params[:'width'] = @api_client.prepare_for_query(width) unless width.nil?\n query_params[:'height'] = @api_client.prepare_for_query(height) unless height.nil?\n query_params[:'shapes'] = @api_client.prepare_for_query(shapes) unless shapes.nil?\n query_params[:'group'] = @api_client.prepare_for_query(group) unless group.nil?\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n if image\n post_files = post_files.push(image)\n end\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Shapes')\n return data, status_code, headers\n end", "def create\n\n @drawing = Drawing.new(form_params)\n @drawing.picture = PictureAttachmentHelper.convert_data_uri_to_upload(params[\"picture\"])\n @drawing.save\n redirect_to root_path\n end", "def to_image()\n embed_svg(svg: to_svg)\n end", "def path\n shapefile_path\n end", "def map\n @data = {}\n\n sheet = Sheet.where(:map_id => params[:map_id]).first\n\n if sheet != nil\n @data[:sheet] = sheet\n @data[:layer] = sheet.layer\n polys = sheet.polygons\n @data[:polygons] = polys.count\n @data[:addresses] = Consensuspolygon.find_all_by_flaggable_id_and_flaggable_type_and_task(polys, \"Polygon\", \"address\").count\n @data[:colors] = Consensuspolygon.find_all_by_flaggable_id_and_flaggable_type_and_task(polys, \"Polygon\", \"color\").count\n @data[:fixes] = Consensuspolygon.find_all_by_flaggable_id_and_flaggable_type_and_task(polys, \"Polygon\", \"polygonfix\").count\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {\n render json: @data\n }\n end\n end", "def import\n Map.import(params[:file])\n end", "def create\n @usermap = Usermap.new(usermap_params)\n\n respond_to do |format|\n if @usermap.save\n format.html { redirect_to @usermap, notice: 'Usermap was successfully created.' }\n format.json { render :show, status: :created, location: @usermap }\n else\n format.html { render :new }\n format.json { render json: @usermap.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dimgeom = Dimgeom.new(params[:dimgeom])\n\n respond_to do |format|\n if @dimgeom.save\n format.html { redirect_to @dimgeom, notice: 'Dimgeom was successfully created.' }\n format.json { render json: @dimgeom, status: :created, location: @dimgeom }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dimgeom.errors, status: :unprocessable_entity }\n end\n end\n end", "def process_gpx!\n trail_gpx_processor = TrailGPXProcessor.new(@trail)\n trail_gpx_processor.process_route!(TrailsController::GPX, upload_gpx)\n end", "def postFlatpackSitemap( flatpack_id, filedata)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n params['filedata'] = filedata\n return doCurl(\"post\",\"/flatpack/sitemap\",params)\n end", "def create\n @google_map = GoogleMap.new(params[:google_map])\n\n respond_to do |format|\n if @google_map.save\n format.html { redirect_to(@google_map, :notice => 'Google map was successfully created.') }\n format.xml { render :xml => @google_map, :status => :created, :location => @google_map }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @google_map.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.6345288", "0.60454863", "0.5910406", "0.5904281", "0.57501334", "0.5699276", "0.55295473", "0.55014163", "0.53606075", "0.5318381", "0.53156465", "0.5296549", "0.5285719", "0.5275586", "0.5257626", "0.5251734", "0.5231633", "0.52070206", "0.5196743", "0.5192396", "0.51766074", "0.5161689", "0.51525235", "0.51524764", "0.5148851", "0.5124206", "0.5119693", "0.5116937", "0.51072437", "0.50978875", "0.5084394", "0.5077954", "0.507234", "0.5065569", "0.50626504", "0.5034311", "0.49944127", "0.49857867", "0.49799263", "0.4976381", "0.4975647", "0.49704176", "0.49682277", "0.49672854", "0.4947186", "0.4946481", "0.4943108", "0.4916643", "0.49069843", "0.49052542", "0.4900581", "0.4900581", "0.4895302", "0.48936585", "0.48877925", "0.48877925", "0.48877513", "0.48865825", "0.48852384", "0.48778486", "0.48666334", "0.48505268", "0.48443624", "0.48441398", "0.48423228", "0.48372114", "0.48339143", "0.48260024", "0.48145506", "0.48083487", "0.48081112", "0.48044735", "0.4802028", "0.47947475", "0.47916996", "0.47906557", "0.47891375", "0.4786587", "0.4778868", "0.47629046", "0.47615868", "0.4759716", "0.47596428", "0.47596428", "0.47158104", "0.4709313", "0.47008145", "0.46938857", "0.46917638", "0.46897995", "0.46896422", "0.46875662", "0.46825254", "0.46680677", "0.46664578", "0.46506235", "0.46497697", "0.46420044", "0.4640714", "0.46309713" ]
0.7257759
0
, :except => [ :list, :index, :show ]
def admin_access if current_user.access? :admin return true elsif current_user flash[:notice] = "Du har ikke adgang til denne side" redirect_to nationalities_path else flash[:notice] = "Du har ikke adgang til denne side" redirect_to login_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n prevent_non_admin\n end", "def index # Only view\n end", "def exclude; end", "def skip_actions; end", "def index\n @unwanteds = Unwanted.all\n end", "def excluded; end", "def show\n skip_authorization\n end", "def index\n super\n end", "def index\n\t\trender :nothing => true\n\tend", "def index\n \n respond_to do |format|\n format.html #\n format.xml {disable_action}\n end\n end", "def show\n @except = Except.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @except }\n end\n end", "def exclude\n all - methods\n end", "def index\n # Never show a hacker list.\n redirect_to entries_path\n end", "def index(model, instance = nil)\n # do nothing\n true\n end", "def index\n index_filter\n end", "def index\n raise \"not supported\"\n end", "def forbidden\n head :forbidden\n end", "def index\n @item_not_includeds = ItemNotIncluded.all\n end", "def index\n @ignores = Analytics::Ignore.all\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end", "def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end", "def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end", "def index\n\n \n end", "def show\n admin_only\n end", "def show\n admin_only\n end", "def show\n admin_only\n end", "def index\n redirect_to not_found_path\n end", "def actions\n [only].flatten.map(&:to_sym) - [except].flatten.map(&:to_sym)\n end", "def list_resource\n resource_class.all_but_other\n end", "def cannot_edit_All\n if @page.name == Rails.application.config.ALL_PAGE\n redirect_to show_all_path\n end\n end", "def index\n # I want all usrs except Guest:\n @usrs = Usr.where(\"id > 1\").order(:name).page params[:page]\n end", "def index \n \n end", "def index \n \n end", "def index_view\n 'list'\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index?\n false\n end", "def index\n head :no_content\n end", "def controller_actions_should_fail_if_not_logged_in(cont, opts={})\n except= opts[:except] || []\n actions_to_test= get_all_actions(cont).reject{ |a| except.include?(a) }\n actions_to_test += opts[:include] if opts[:include]\n actions_to_test.each do |a|\n get a\n response.should_not be_success\n response.should redirect_to('http://test.host/')\n end\n end", "def actions\n ['index', 'show', 'new', 'create', 'edit', 'update', 'destroy']\n end", "def index?; end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end" ]
[ "0.6920027", "0.69064814", "0.6796341", "0.6749889", "0.67018455", "0.6641809", "0.6630838", "0.6596641", "0.65870297", "0.6580645", "0.6422456", "0.64153963", "0.6361794", "0.63441455", "0.63201255", "0.63158643", "0.6274175", "0.6261968", "0.62484145", "0.6238501", "0.6238501", "0.6238501", "0.6234543", "0.6227749", "0.6227749", "0.6227749", "0.62239116", "0.6203696", "0.62014663", "0.61919606", "0.61826396", "0.6176962", "0.6176962", "0.61721176", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.6160847", "0.61607087", "0.6150149", "0.61339855", "0.61244833", "0.6119021", "0.6115072", "0.6115072", "0.6115072", "0.6115072", "0.6115072", "0.6115072", "0.6115072", "0.6115072", "0.6115072", "0.6115072", "0.6115072", "0.6115072", "0.6115072", "0.6115072", "0.6115072", "0.6115072", "0.6115072", "0.6115072", "0.6115072" ]
0.0
-1
currently a noop method. If a format other than mongo query format is used for prefilters, this method would do the appropriate conversion
def convert_filter_to_mongo_query(filter) filter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cast_value\n value.mongoize\n end", "def queryAndConvert() \n\t\tres = self.query()\n\t\treturn res.convert()\n end", "def convert(obj)\n ret = convert_proc.call(obj)\n filters.execute(ret)\n end", "def post_conversion(converted_query)\n return unless (converted_query && converted_query.q && converted_query.format)\n @conversions = {} unless @conversions\n return if @conversions.has_key?(converted_query.format.to_sym)\n puts \"store: #{self.format} -> #{converted_query.format.to_sym} = #{self.q} -> #{converted_query.q}\" if Barometer::debug?\n @conversions[converted_query.format.to_sym] = converted_query.q\nend", "def mongoize(object)\n return if object.blank?\n if Mongoid.map_big_decimal_to_decimal128\n if object.is_a?(BSON::Decimal128)\n object\n elsif object.is_a?(BigDecimal)\n BSON::Decimal128.new(object)\n elsif object.numeric?\n BSON::Decimal128.new(object.to_s)\n elsif !object.is_a?(String)\n object.try(:to_d)\n end\n else\n if object.is_a?(BSON::Decimal128) || object.numeric?\n object.to_s\n elsif !object.is_a?(String)\n object.try(:to_d)&.to_s\n end\n end\n end", "def convert!(preferred_formats=nil)\n raise ArgumentError unless (preferred_formats && preferred_formats.size > 0)\n\n # why convert if we are already there?\n # (except in the case that the serivce excepts coordinates and we have a\n # a geocode ... the google geocode results are superior)\n #\n skip_conversion = false\n unless (@format.to_sym == Query::Format::Geocode.format) &&\n preferred_formats.include?(Query::Format::Coordinates.format)\n if preferred_formats.include?(@format.to_sym)\n skip_conversion = true\n converted_query = self.dup\n end\n end\n\n unless skip_conversion\n # go through each acceptable format and try to convert to that\n converted = false\n converted_query = Barometer::Query.new\n preferred_formats.each do |preferred_format|\n klass = FORMAT_MAP[preferred_format.to_sym]\n # if we discover that the format we have is the preferred format, return it\n if preferred_format == @format\n converted = true\n converted_query = Barometer::Query.new(@q)\n end\n unless converted\n unless converted_query = get_conversion(preferred_format)\n converted_query = Query::Format.const_get(klass.to_s).to(self)\n end\n converted = true if converted_query\n end\n if converted\n converted_query.country_code ||= Query::Format.const_get(klass.to_s).country_code(converted_query.q)\n post_conversion(converted_query)\n break\n end\n end\n end\n\n # force geocode?, unless we already did\n #\n if Barometer.force_geocode && !@geo\n if converted_query && converted_query.geo\n @geo = converted_query.geo\n elsif converted_query\n puts \"enhance geocode: #{converted_query.q}\" if Barometer::debug?\n geo_query = Query::Format::Coordinates.to(converted_query)\n @geo = geo_query.geo if (geo_query && geo_query.geo)\n converted_query.geo = @geo.dup\n end\n end\n\n converted_query\n end", "def type_cast_for_solr(value, dest_type = nil)\n return nil if value.nil?\n return coder.dump(value) if encoded?\n\n case (dest_type || type)\n when :boolean then value ? 'true' : 'false'\n when :date, :time, :datetime, :timestamp then value.to_time.utc.strftime(Format::SOLR_TIME_FORMAT)\n when :list, :set then list_to_solr_value(value)\n when :map then map_to_solr_value(value)\n when :uuid, :timeuuid then value.to_s\n else value\n end\n end", "def objectified_param_value\n @objectified_param_value ||= case @filter.type\n when :date\n format = I18n.t(\"date.formats.#{QueryReport.config.date_format}\")\n param_value.kind_of?(String) ? (Date.strptime(param_value, format) rescue param_value) : param_value\n when :datetime\n param_value.kind_of?(String) ? Time.zone.parse(param_value) : param_value\n when :boolean\n param_value.to_boolean\n else\n param_value\n end\n end", "def force_convert_to_params\n build_nested_query(to_hash)\n end", "def converters; end", "def converters; end", "def converters; end", "def mongoize(object)\n object.mongoize\n end", "def mongoize(object)\n case\n when object.is_a?(Mongoid::Snappy) then object.mongoize\n when object.is_a?(String) then Mongoid::Snappy.new(object).mongoize\n else object\n end\n end", "def transform(parsed_query)\n parsed_query.inject({}) do |all, (key, value)|\n if node = MAP[key]\n field = node[:field]\n all[field] = convert(value, node[:type])\n end\n all\n end\n end", "def mongoize(object)\n case object\n when TimeOfDay then object.mongoize\n else object\n end\n end", "def _process_format(format); end", "def _process_format(format); end", "def get_field_deserializers()\n return {\n \"criteria1\" => lambda {|n| @criteria1 = n.get_string_value() },\n \"criteria2\" => lambda {|n| @criteria2 = n.get_string_value() },\n \"oper\" => lambda {|n| @oper = n.get_string_value() },\n }\n end", "def raw_cast(value)\n # We can strip value here but we do not want to squish it unless for number\n value = value.to_s.strip\n return nil if value.empty?\n\n case data_type\n when 'number'\n BigDecimal(remove_decimal_mark(value.squish))\n when 'date'\n # date_format likely will be '%m/%d/%Y', but if we got '19/8/2014',\n # then `strptime` will raise invalid date error\n # Sometimes we can get '27/11 /1981' also :(\n begin\n Date.strptime(value, @resultset.date_format)\n rescue StandardError\n # We could be getting back these date:\n # '17.12.95', '19/05/99', '27/11 /1981'\n # '1959-07-03' will be beyond us, so consider returning exact value\n value = value.gsub(/-|\\./, '/')\n split = value.split('/').map(&:strip)\n split[2] = \"19#{split[2]}\" if split[2].size == 2\n value = split.join('/')\n\n Date.strptime(\n Date.parse(value)\n .strftime(@resultset.date_format), @resultset.date_format\n )\n end\n when 'time'\n DateTime.strptime(\"1/1/-4712 #{value}\", @resultset.timestamp_format)\n when 'timestamp'\n DateTime.strptime(value, @resultset.timestamp_format)\n when 'container'\n # container may return value that include URI scheme already\n return URI.parse(value) if value.start_with?('http')\n URI.parse(\"#{@resultset.server.url}#{value}\")\n else\n value\n end\n rescue StandardError => e\n warn \"Could not coerce #{name}: #{value} due to #{e.message.force_encoding(\"UTF-8\")}\"\n value\n end", "def normalize_query(query, filters)\n filter = normalize_filters filters\n query ||= {match_all: {}}\n return query unless filter\n {filtered: {\n query: query,\n filter: filter,\n }}\n end", "def shouldConvert()\n\t\tfalse\n\tend", "def convert() \n raise \"Unimplemented.\"\n\n#\t\tct = self.response.info()[\"content-type\"]\n#\t\tif True in [ct.find(q) != -1 for q in _SPARQL_XML] :\n#\t\t\treturn self._convertXML()\n#\t\telif True in [ct.find(q) != -1 for q in _SPARQL_JSON] :\n#\t\t\treturn self._convertJSON()\n#\t\telif True in [ct.find(q) != -1 for q in _RDF_XML] :\n#\t\t\treturn self._convertRDF()\n#\t\telif True in [ct.find(q) != -1 for q in _RDF_N3] :\n#\t\t\treturn self._convertN3()\n#\t\telse :\n#\t\t\t# this should cover, well, the rest of the cases...\n#\t\t\treturn self.response\n#\n end", "def converters=(_arg0); end", "def mongoize(object)\n case object\n when RussianPhone::Number then object.mongoize\n when String then RussianPhone::Number.new(object, @options).mongoize\n else object\n end\n end", "def mongoize\n return if values.blank?\n values.map { |value| value.mongoize }\n end", "def to_json_query \n # Body of main function\n\n json_query = ''\n field_ops = Array.new\n outfields = Array.new\n \n json_query += self.to_json_query_filter\n\n self.fields.each do |field|\n if field.respond_to?(:operator)\n field_ops << case field.operator\n when :count then\n if field.target.is_a?(DataMapper::Property)\n \"[?#{field.target.field}!=undefined].length\"\n else # field.target is all.\n \".length\"\n end\n when :min\n if field.target.kind_of?(DataMapper::Property::DateTime) || \n field.target.kind_of?(DataMapper::Property::Time) || \n field.target.kind_of?(DataMapper::Property::Date)\n \"[=#{field.target.field}]\"\n else\n \".min(?#{field.target.field})\"\n end\n when :max\n if field.target.kind_of?(DataMapper::Property::DateTime) || \n field.target.kind_of?(DataMapper::Property::Time) || \n field.target.kind_of?(DataMapper::Property::Date)\n \"[=#{field.target.field}]\"\n else\n \".max(?#{field.target.field})\"\n end\n when :sum\n \".sum(?#{field.target.field})\"\n when :avg\n \"[=#{field.target.field}]\"\n end\n else\n outfields << \"'#{field.field}':#{field.field}\"\n end\n end\n\n json_query += field_ops.join(\"\")\n\n json_query += self.to_json_query_ordering\n\n json_query += \"[={\" + outfields.join(',') + \"}]\" unless outfields.empty?\n\n\n # puts json_query, headers\n return json_query, self.json_query_headers\n end", "def mongoize(object)\n case object\n when nil then nil\n when QDM::Code then object.mongoize\n when Hash\n object = object.symbolize_keys\n QDM::Code.new(object[:code], object[:system], object[:display], object[:version]).mongoize\n else object\n end\n end", "def validate_query_filters\n super\n\n or_filters.each_key do |field|\n if values_for(field)\n case type_for(field)\n when :integer\n add_filter_error(field, :invalid, true) if or_values_for(field).detect {|v| v.present? && !v.match(/\\A[+-]?\\d+(,[+-]?\\d+)*\\z/) }\n when :float\n add_filter_error(field, :invalid, true) if or_values_for(field).detect {|v| v.present? && !v.match(/\\A[+-]?\\d+(\\.\\d*)?\\z/) }\n when :date, :date_past\n case or_operator_for(field)\n when \"=\", \">=\", \"<=\", \"><\"\n add_filter_error(field, :invalid, true) if or_values_for(field).detect {|v|\n v.present? && (!v.match(/\\A\\d{4}-\\d{2}-\\d{2}(T\\d{2}((:)?\\d{2}){0,2}(Z|\\d{2}:?\\d{2})?)?\\z/) || parse_date(v).nil?)\n }\n when \">t-\", \"<t-\", \"t-\", \">t+\", \"<t+\", \"t+\", \"><t+\", \"><t-\"\n add_filter_error(field, :invalid, true) if or_values_for(field).detect {|v| v.present? && !v.match(/^\\d+$/) }\n end\n end\n end\n\n add_filter_error(field, :blank, true) unless\n # filter requires one or more values\n (or_values_for(field) and !or_values_for(field).first.blank?) or\n # filter doesn't require any value\n [\"o\", \"c\", \"!*\", \"*\", \"t\", \"ld\", \"w\", \"lw\", \"l2w\", \"m\", \"lm\", \"y\", \"*o\", \"!o\"].include? or_operator_for(field)\n end if or_filters && or_filters.respond_to?(:each_key)\n end", "def shouldConvert\n false\n end", "def convert_date\n params[:search][:date_lte] = params[:search]['date_lte(1i)'].to_s + \"-\" + params[:search]['date_lte(2i)'].to_s + \"-\" + params[:search]['date_lte(3i)'].to_s\n params[:search][:date_gte] = params[:search]['date_gte(1i)'].to_s + \"-\" + params[:search]['date_gte(2i)'].to_s + \"-\" + params[:search]['date_gte(3i)'].to_s\n ['date_lte(1i)', 'date_lte(2i)', 'date_lte(3i)', 'date_gte(1i)', 'date_gte(2i)', 'date_gte(3i)'].each do |d|\n params[:search].delete(d)\n end \n end", "def convert\n end", "def convert\n end", "def mongoize(object)\n case object\n when Money then object.mongoize\n when Hash then Money.new(object[:cents].to_i, object[:currency]).mongoize\n else object\n end\n end", "def filters_must_be_formatted\n if filters\n begin\n formatted = JSON.parse(filters)\n formatted.each do |f|\n unless f.is_a?(Hash)\n errors.add(:filters, 'Incorrect format')\n else\n if f['name'].blank?\n errors.add(:filters, 'No field defined')\n else\n if f['values'].blank? && (f['to'].blank? || f['from'].blank?)\n errors.add(:filters, \"Column #{f['name']} has incorrect values\")\n end\n end\n end\n end\n rescue\n errors.add(:filters, 'Error parsing the filters')\n end\n end\n end", "def process_query(query)\n # Nothing in default\n end", "def convert!; end", "def query_normalization\n uri = Addressable::URI.parse(@url)\n tmp_q = (uri.query_values || {}).merge(@query)\n\n return tmp_q if tmp_q.empty? && tmp_q.values.all? { |v| v.encode == @encoding }\n tmp_q.each_key { |k| tmp_q[k].encode! @encoding }\n tmp_q\n end", "def analyze!\n return unless @q\n FORMATS.each do |format|\n if Query::Format.const_get(format.to_s).is?(@q)\n @format = Query::Format.const_get(format.to_s).format\n @country_code = Query::Format.const_get(format.to_s).country_code(@q)\n break\n end\n end\n end", "def normalize_params(params)\n # filters\n conditions = params[:filter] && convert_filters(params[:filter])\n \n normalized_conditions = {}\n conditions && conditions.each_pair do |k, v|\n normalized_conditions.merge!(k.gsub(\"__\", \"_\") => v)\n end\n \n {:conditions => normalized_conditions}\n end", "def mongoize(raw = nil)\n result = {\n :cents => cents,\n :currency_iso => currency.iso_code\n }\n result[:raw] = raw unless raw.nil?\n result\n end", "def apply_filters(query)\n query\n end", "def filters_must_be_formatted\n return unless filters\n\n begin\n formatted = JSON.parse(filters)\n formatted.each do |f|\n if !f.is_a?(Hash)\n errors.add(:filters, 'Incorrect format')\n elsif f['name'].blank?\n errors.add(:filters, 'No field defined')\n elsif f['values'].blank? && (f['to'].blank? || f['from'].blank?)\n errors.add(:filters, \"Column #{f['name']} has incorrect values\")\n end\n end\n rescue\n errors.add(:filters, 'Error parsing the filters')\n end\n end", "def apply_narrowing_filters\n @filters[:narrowing].each do |filter|\n @query = @query.where(filter => @options[filter])\n end\n @query\n end", "def converter; end", "def create_filter(filter)\n return nil,nil if filter.nil?\n\n db_adapter = MongoDBConv.new(@current_var, true) #do push 'or'\n\n db_expr,hop_expr = filter.db_conv(@parent, db_adapter) \n end", "def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"query\" => lambda {|n| @query = n.get_string_value() },\n \"queryRoot\" => lambda {|n| @query_root = n.get_string_value() },\n \"queryType\" => lambda {|n| @query_type = n.get_string_value() },\n }\n end", "def format_query_condition(condition)\n case condition\n when nil\n \"=\" # Search for empty field\n when Range\n format_range_condition(condition)\n when *FmRest::V1.datetime_classes\n FmRest::V1.convert_datetime_timezone(condition.to_datetime, klass.fmrest_config.timezone)\n .strftime(FmRest::V1::Dates::FM_DATETIME_FORMAT)\n when *FmRest::V1.date_classes\n condition.strftime(FmRest::V1::Dates::FM_DATE_FORMAT)\n else\n condition\n end\n end", "def to_filter\n to_hash.to_filter\n end", "def change_format(queries)\n\t\text_queries = [ ]\n\t\tqueries.each do |q, offsets|\n\t\t\toffsets.each do |offset|\n\t\t\t\text_queries << get_formatted_query(q, q, offset, 1.0)\n\t\t\tend\n\t\tend\n\n # [{:requested_query => \"q\", :original_query => \"q\", :offset => 1, :sim => 1.0}] \n\t\text_queries\n\tend", "def typus_fields_for(filter); end", "def normalize(field)\n case field\n when \"true\" then true\n when \"false\" then false\n when \"\" then nil\n when \"null\" then nil\n else field\n end \n end", "def normalize(field)\n case field\n when \"true\" then true\n when \"false\" then false\n when \"\" then nil\n when \"null\" then nil\n else field\n end \n end", "def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"queryString\" => lambda {|n| @query_string = n.get_string_value() },\n \"queryTemplate\" => lambda {|n| @query_template = n.get_string_value() },\n }\n end", "def mongoize(object)\n case object\n when Point\n object.mongoize\n when Array, Hash\n new(object).mongoize\n else\n object\n end\n end", "def mongoize(object)\n return nil if object.nil?\n case object\n when self\n object.mongoize\n else\n object\n end\n end", "def strict_filters; end", "def mongoize(object)\n case\n when object.is_a?(Money) then object.mongoize(object)\n when object.is_a?(Hash) then\n object.symbolize_keys! if object.respond_to?(:symbolize_keys!)\n value = ::Money.new(object[:cents], object[:currency_iso] || Money.default_currency.iso_code)\n value.mongoize(object)\n when object.respond_to?(:to_money) then\n return if object.is_a?(String) && object.blank?\n object.to_money.mongoize(object)\n else object\n end\n end", "def mongoize(object)\n return nil if object.nil?\n case object\n when self\n object.mongoize\n when Hash\n demongoize(object).mongoize\n else\n object\n end\n end", "def mongoize\n ::Date.mongoize(self)\n end", "def parse_query(query); end", "def parse_query(query); end", "def convert(val)\r\n\t\t\t# clean up strings and return nil for \r\n\t\t\tif val.class == String\r\n\t\t\t\tval.strip!()\r\n\t\t\t\tif [\"?\", \"unknown\"].member?(val.downcase())\r\n\t\t\t\t\treturn nil\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\treturn val\r\n\t\tend", "def convert(val)\r\n\t\t\t# clean up strings and return nil for \r\n\t\t\tif val.class == String\r\n\t\t\t\tval.strip!()\r\n\t\t\t\tif [\"?\", \"unknown\"].member?(val.downcase())\r\n\t\t\t\t\treturn nil\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\treturn val\r\n\t\tend", "def convert(val)\r\n\t\t\t# clean up strings and return nil for \r\n\t\t\tif val.class == String\r\n\t\t\t\tval.strip!()\r\n\t\t\t\tif [\"?\", \"unknown\"].member?(val.downcase())\r\n\t\t\t\t\treturn nil\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\treturn val\r\n\t\tend", "def normalize(field)\n case field\n when \"true\" then true\n when \"false\" then false\n when \"\" then nil\n when \"null\" then nil\n else field\n end\n end", "def parse_format request\n (request.query['format'] or \"xml\") #breaks without the extra parens\n end", "def prepare_nested_query(value)\n if value.respond_to?(:iso8601)\n value.iso8601\n else\n case value\n when Array\n value.map { |v| prepare_nested_query(v) }\n when Hash\n value.inject({}) do |memo, (k, v)|\n memo[k] = prepare_nested_query(v)\n memo\n end\n when Integer, TrueClass, FalseClass, NilClass\n value\n else\n value.to_s\n end\n end\n end", "def mongoize(object)\n case object\n when Expert then object.mongoize\n when Hash then Expert.new(object[:name], object[:quote], object[:image_url]).mongoize\n else object\n end\n end", "def stringToQuery (val)\n\t\t\n\tend", "def _process_format(format) # :nodoc:\n end", "def formatted_for_db?(found_converter, value)\n return false unless found_converter.respond_to?(:db_type)\n found_converter.respond_to?(:converted?) ? found_converter.converted?(value) : value.is_a?(found_converter.db_type)\n end", "def convert(*filters)\n block_given? ? dup.convert!(*filters, &Proc.new) : dup.convert!(*filters)\n end", "def serialize_for_query(value)\n return value if value.nil?\n return value if value =~ /^==|=\\*/\n return value if value =~ /(\\.\\.\\.)/\n\n @type.__filemaker_serialize_for_query(value)\n rescue StandardError => e\n warn \"[#{e.message}] Could not serialize for query: #{name}=#{value}\"\n value\n end", "def serialize_for_query(value)\n return value if value.nil?\n str_val = value.to_s\n return value if str_val =~ /^==|=\\*/\n return value if str_val =~ /(\\.\\.\\.)/\n return value if str_val =~ /\\A(<|<=|>|>=)/\n\n @type.__filemaker_serialize_for_query(value)\n rescue StandardError => e\n warn \"[#{e.message}] Could not serialize for query: #{name}=#{value}\"\n value\n end", "def clean_filter(value)\n value = @filters[value] if value.is_a? Symbol\n ActiveRecord::Type::Boolean.new.cast(value)\n end", "def mongoize(object)\n return nil if object.nil?\n case object\n when self\n object.mongoize\n else\n object\n end\n end", "def mongoize(object)\n return nil if object.nil?\n case object\n when self\n object.mongoize\n else\n object\n end\n end", "def evolve(object)\n case object\n when Mongoid::Snappy then object.mongoize\n when String then Mongoid::Snappy.new(object).mongoize\n else object\n end\n end", "def mongoize(object)\n case object\n when Interval then object.mongoize\n when Hash then Interval.new(object).mongoize\n else object\n end\n end", "def evolve(object)\n case object\n when RussianPhone::Number then object.mongoize\n else object\n end\n end", "def cast_value(value, opts = {})\n case value\n when Array\n value.map { |v| cast_value(v, opts) }\n when String\n cast_uri = RDF::URI.new(value)\n cast_uri.valid? ? cast_uri : RDF::Literal.new(value, opts)\n when Time\n # Cast DateTimes with 00:00:00 or Date stored as Times in Mongoid to xsd:date\n # FIXME: this should NOT be applied for fields that are typed as Time\n value.midnight == value ? RDF::Literal.new(value.to_date) : RDF::Literal.new(value.to_datetime)\n else\n RDF::Literal.new(value, opts)\n end\n end", "def mongoize(object)\n case object\n when self\n object.mongoize\n when Hash\n h = object.deep_stringify_keys\n return self.new.mongoize if h[\"loc\"].blank?\n\n h[\"loc\"] = Map::Extensions::Loc.mongoize(h[\"loc\"])\n if h[\"zoom_level\"].present?\n h[\"zoom_level\"] = Integer(h[\"zoom_level\"]) rescue nil\n end\n ret = self.new\n ret.merge!(h)\n ret.mongoize\n else object\n end\n end", "def converter\n end", "def prepare_orm_filters\n filters = [[]]\n date_format = I18n.t(:\"date.formats.default\", {:locale => I18n.locale })\n self.data_grid.columns.each_with_index do |col, col_index|\n if col.filter and !col.filter_value.blank?\n case col.filter\n when :boolean\n filters[0] << \"#{col.filter_by} = ?\"\n filters << (col.filter_value == '1') ? true : false\n when :auto\n filters[0] << \"#{col.filter_by} = ?\"\n filters << col.filter_value\n when :text\n filters[0] << \"#{col.filter_by} #{ActiveRecord::Base.connection.adapter_name.downcase.to_sym == :postgresql ? 'ILIKE' : 'LIKE'} ?\"\n filters << \"%#{col.filter_value}%\"\n when :number\n filters[0] << \"#{col.filter_by} = ?\"\n filters << col.filter_value.to_i\n when :range\n range = col.filter_value.split(DataGrid.range_separator)\n\n if !range[0].blank? and !range[1].blank?\n begin\n range[0] < 2\n rescue\n range[0] = range[0].to_f\n range[1] = range[1].to_f\n end\n filters[0] << \"#{col.filter_by} >= ? AND #{col.filter_by} <= ?\"\n filters << range[0]\n filters << range[1]\n elsif range[0].blank? and !range[1].blank?\n begin\n range[1] < 2\n rescue\n range[1] = range[1].to_f\n end\n filters[0] << \"#{col.filter_by} <= ?\"\n filters << range[1]\n elsif range[1].blank? and !range[0].blank?\n begin\n range[0] < 2\n rescue\n range[0] = range[0].to_f\n end\n filters[0] << \"#{col.filter_by} >= ?\"\n filters << range[0]\n end\n\n when :date\n range = col.filter_value.split(DataGrid.range_separator)\n\n if !range[0].blank? and !range[1].blank?\n begin\n range[0] < 2\n rescue\n range[0] = DateTime.strptime(range[0], date_format)\n range[1] = DateTime.strptime(range[1], date_format)\n end\n filters[0] << \"#{col.filter_by} >= ? AND #{col.filter_by} <= ?\"\n filters << range[0]\n filters << range[1]\n elsif range[0].blank? and !range[1].blank?\n begin\n range[1] < 2\n rescue\n range[1] = DateTime.strptime(range[1], date_format)\n end\n filters[0] << \"#{col.filter_by} <= ?\"\n filters << range[1]\n elsif range[1].blank? and !range[0].blank?\n begin\n range[0] < 2\n rescue\n range[0] = DateTime.strptime(range[0], date_format)\n end\n filters[0] << \"#{col.filter_by} >= ?\"\n filters << range[0]\n end\n end\n end\n end\n \n filters[0] = filters[0].join(' AND ')\n filters\n end", "def call(s)\n convert(convert_format(convert_columns(Splitter.new(s).parse)))\n end", "def data\n apply_query case format\n when :xml\n require 'active_support/core_ext/hash/conversions'\n Hash.from_xml(to_s)\n when :json\n require 'yajl/json_gem'\n JSON.parse to_s\n when :yaml\n require 'yaml'\n YAML.load to_s\n when :email\n self.class.headers_from_mail to_mail\n when :ruby\n eval to_s # TODO: sandbox\n when :url\n require 'rack/utils'\n Rack::Utils.parse_nested_query(to_s.strip)\n else\n raise ArgumentError, \"don't know how to decode #{format}\"\n end\n end", "def value_converters\n [YEAR_NORMALIZER, :float]\n end", "def unconverted_fields?() @unconverted_fields end", "def evolve(object)\n case object\n when QDM::Date then object.mongoize\n else object\n end\n end", "def mongoize(object)\n case object\n when Quantity\n object.mongoize\n when Numeric\n self.new(object).mongoize\n else\n object\n end\n end", "def solrize_date(date)\n date.strftime('%Y-%m-%dT00:00:00Z')\n end", "def mongoize(object)\n case object\n when self then object.mongoize\n when Symbol then new(object).mongoize\n else object\n end\n end", "def normalize_result(result)\n end", "def formatConvertor(inputFormat)\n\n inputFormat.sub! 'DD', '%d'\n inputFormat.sub! 'YYYY', '%Y'\n inputFormat.sub! 'YY', '%Y'\n inputFormat.sub! 'MM', '%m'\n inputFormat.sub! 'hh', '%H'\n inputFormat.sub! 'mm', '%M'\n inputFormat.sub! 'ss', '%S'\n inputFormat.sub! 'HH', '%I' # HH - for hour of the clock (12 hour)\n inputFormat.sub! 'A/P', '%p'\n inputFormat.sub! 'MON', '%b' # Jan/Feb etc\n #inputFormat.sub! 'TZ', '%z' # TimeZone\n\n\nend", "def converter\n\n end", "def conv_itype(itype)\n case itype\n when 'concept' : itype\n when 'query_doctrack' : 'query'\n else 'document'\n end\nend", "def convert(value) value end", "def mongoize(object)\n { ::I18n.locale.to_s => type.mongoize(object) }\n end", "def raw_filter(param, sql:, query_param: nil, required: false, format_value: nil, array: false)\n param = param.to_sym\n raise ArgumentError, \"filter with param #{param} already defined\" if filters.key?(param)\n\n query_param ||= param.to_s.underscore\n format_value ||= ->(value, _opts) { value }\n filters[param] = Filter.new(param:, sql:, query_param:, required:, format_value:, array:)\n end" ]
[ "0.61837065", "0.6159584", "0.5950193", "0.58030474", "0.578086", "0.5766119", "0.5676294", "0.5637948", "0.5543535", "0.5540873", "0.5540873", "0.5540873", "0.54870456", "0.54727894", "0.54264444", "0.53915036", "0.5389541", "0.5389541", "0.53628594", "0.5360193", "0.53451073", "0.5329249", "0.5321381", "0.53068256", "0.5259637", "0.5252564", "0.52459294", "0.5244596", "0.5242833", "0.52260303", "0.5220122", "0.52000946", "0.52000946", "0.51862985", "0.5181927", "0.5175085", "0.51551175", "0.51518345", "0.51420873", "0.51401776", "0.5113232", "0.5110702", "0.5104967", "0.50814486", "0.5081226", "0.5077388", "0.50751126", "0.50664914", "0.50621974", "0.50563794", "0.5047768", "0.5046625", "0.5046625", "0.50444424", "0.50439066", "0.5043751", "0.50397176", "0.5024317", "0.50222534", "0.5016757", "0.50129044", "0.50129044", "0.5010714", "0.5010714", "0.5010714", "0.49942112", "0.499241", "0.49912313", "0.4990097", "0.4988924", "0.4986048", "0.4985471", "0.49705353", "0.49666044", "0.49570432", "0.49529332", "0.49478334", "0.49478334", "0.49410993", "0.49396202", "0.49376553", "0.49326366", "0.49211276", "0.4918357", "0.48965997", "0.48961005", "0.48847014", "0.48838702", "0.48811224", "0.48766834", "0.48744228", "0.4874171", "0.48729876", "0.4868744", "0.48658776", "0.48647022", "0.48593745", "0.48588225", "0.48529348", "0.48486763" ]
0.6503161
0
Taken from No, I don't understand it. I'm so very glad someone else had written the function in Ruby already. I have cleaned it up a little, mind you.
def lower_bound return 0 if total == 0 ( phat + dist_sq/(2*total) - dist * Math.sqrt((phat*(1-phat)+dist_sq/(4*total))/total) ) / ( 1+dist_sq/total ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anchored; end", "def probers; end", "def rassoc(p0) end", "def private; end", "def terpene; end", "def stderrs; end", "def NL43_locator(seq=\"\",temp_dir=File.dirname($0))\n hxb2_ref = \"TGGAAGGGCTAATTTGGTCCCAAAAAAGACAAGAGATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTGGCAGAACTACACACCAGGGCCAGGGATCAGATATCCACTGACCTTTGGATGGTGCTTCAAGTTAGTACCAGTTGAACCAGAGCAAGTAGAAGAGGCCAAATAAGGAGAGAAGAACAGCTTGTTACACCCTATGAGCCAGCATGGGATGGAGGACCCGGAGGGAGAAGTATTAGTGTGGAAGTTTGACAGCCTCCTAGCATTTCGTCACATGGCCCGAGAGCTGCATCCGGAGTACTACAAAGACTGCTGACATCGAGCTTTCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGTGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATGCTACATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTCAAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCAGTGGCGCCCGAACAGGGACTTGAAAGCGAAAGTAAAGCCAGAGGAGATCTCTCGACGCAGGACTCGGCTTGCTGAAGCGCGCACGGCAAGAGGCGAGGGGCGGCGACTGGTGAGTACGCCAAAAATTTTGACTAGCGGAGGCTAGAAGGAGAGAGATGGGTGCGAGAGCGTCGGTATTAAGCGGGGGAGAATTAGATAAATGGGAAAAAATTCGGTTAAGGCCAGGGGGAAAGAAACAATATAAACTAAAACATATAGTATGGGCAAGCAGGGAGCTAGAACGATTCGCAGTTAATCCTGGCCTTTTAGAGACATCAGAAGGCTGTAGACAAATACTGGGACAGCTACAACCATCCCTTCAGACAGGATCAGAAGAACTTAGATCATTATATAATACAATAGCAGTCCTCTATTGTGTGCATCAAAGGATAGATGTAAAAGACACCAAGGAAGCCTTAGATAAGATAGAGGAAGAGCAAAACAAAAGTAAGAAAAAGGCACAGCAAGCAGCAGCTGACACAGGAAACAACAGCCAGGTCAGCCAAAATTACCCTATAGTGCAGAACCTCCAGGGGCAAATGGTACATCAGGCCATATCACCTAGAACTTTAAATGCATGGGTAAAAGTAGTAGAAGAGAAGGCTTTCAGCCCAGAAGTAATACCCATGTTTTCAGCATTATCAGAAGGAGCCACCCCACAAGATTTAAATACCATGCTAAACACAGTGGGGGGACATCAAGCAGCCATGCAAATGTTAAAAGAGACCATCAATGAGGAAGCTGCAGAATGGGATAGATTGCATCCAGTGCATGCAGGGCCTATTGCACCAGGCCAGATGAGAGAACCAAGGGGAAGTGACATAGCAGGAACTACTAGTACCCTTCAGGAACAAATAGGATGGATGACACATAATCCACCTATCCCAGTAGGAGAAATCTATAAAAGATGGATAATCCTGGGATTAAATAAAATAGTAAGAATGTATAGCCCTACCAGCATTCTGGACATAAGACAAGGACCAAAGGAACCCTTTAGAGACTATGTAGACCGATTCTATAAAACTCTAAGAGCCGAGCAAGCTTCACAAGAGGTAAAAAATTGGATGACAGAAACCTTGTTGGTCCAAAATGCGAACCCAGATTGTAAGACTATTTTAAAAGCATTGGGACCAGGAGCGACACTAGAAGAAATGATGACAGCATGTCAGGGAGTGGGGGGACCCGGCCATAAAGCAAGAGTTTTGGCTGAAGCAATGAGCCAAGTAACAAATCCAGCTACCATAATGATACAGAAAGGCAATTTTAGGAACCAAAGAAAGACTGTTAAGTGTTTCAATTGTGGCAAAGAAGGGCACATAGCCAAAAATTGCAGGGCCCCTAGGAAAAAGGGCTGTTGGAAATGTGGAAAGGAAGGACACCAAATGAAAGATTGTACTGAGAGACAGGCTAATTTTTTAGGGAAGATCTGGCCTTCCCACAAGGGAAGGCCAGGGAATTTTCTTCAGAGCAGACCAGAGCCAACAGCCCCACCAGAAGAGAGCTTCAGGTTTGGGGAAGAGACAACAACTCCCTCTCAGAAGCAGGAGCCGATAGACAAGGAACTGTATCCTTTAGCTTCCCTCAGATCACTCTTTGGCAGCGACCCCTCGTCACAATAAAGATAGGGGGGCAATTAAAGGAAGCTCTATTAGATACAGGAGCAGATGATACAGTATTAGAAGAAATGAATTTGCCAGGAAGATGGAAACCAAAAATGATAGGGGGAATTGGAGGTTTTATCAAAGTAAGACAGTATGATCAGATACTCATAGAAATCTGCGGACATAAAGCTATAGGTACAGTATTAGTAGGACCTACACCTGTCAACATAATTGGAAGAAATCTGTTGACTCAGATTGGCTGCACTTTAAATTTTCCCATTAGTCCTATTGAGACTGTACCAGTAAAATTAAAGCCAGGAATGGATGGCCCAAAAGTTAAACAATGGCCATTGACAGAAGAAAAAATAAAAGCATTAGTAGAAATTTGTACAGAAATGGAAAAGGAAGGAAAAATTTCAAAAATTGGGCCTGAAAATCCATACAATACTCCAGTATTTGCCATAAAGAAAAAAGACAGTACTAAATGGAGAAAATTAGTAGATTTCAGAGAACTTAATAAGAGAACTCAAGATTTCTGGGAAGTTCAATTAGGAATACCACATCCTGCAGGGTTAAAACAGAAAAAATCAGTAACAGTACTGGATGTGGGCGATGCATATTTTTCAGTTCCCTTAGATAAAGACTTCAGGAAGTATACTGCATTTACCATACCTAGTATAAACAATGAGACACCAGGGATTAGATATCAGTACAATGTGCTTCCACAGGGATGGAAAGGATCACCAGCAATATTCCAGTGTAGCATGACAAAAATCTTAGAGCCTTTTAGAAAACAAAATCCAGACATAGTCATCTATCAATACATGGATGATTTGTATGTAGGATCTGACTTAGAAATAGGGCAGCATAGAACAAAAATAGAGGAACTGAGACAACATCTGTTGAGGTGGGGATTTACCACACCAGACAAAAAACATCAGAAAGAACCTCCATTCCTTTGGATGGGTTATGAACTCCATCCTGATAAATGGACAGTACAGCCTATAGTGCTGCCAGAAAAGGACAGCTGGACTGTCAATGACATACAGAAATTAGTGGGAAAATTGAATTGGGCAAGTCAGATTTATGCAGGGATTAAAGTAAGGCAATTATGTAAACTTCTTAGGGGAACCAAAGCACTAACAGAAGTAGTACCACTAACAGAAGAAGCAGAGCTAGAACTGGCAGAAAACAGGGAGATTCTAAAAGAACCGGTACATGGAGTGTATTATGACCCATCAAAAGACTTAATAGCAGAAATACAGAAGCAGGGGCAAGGCCAATGGACATATCAAATTTATCAAGAGCCATTTAAAAATCTGAAAACAGGAAAATATGCAAGAATGAAGGGTGCCCACACTAATGATGTGAAACAATTAACAGAGGCAGTACAAAAAATAGCCACAGAAAGCATAGTAATATGGGGAAAGACTCCTAAATTTAAATTACCCATACAAAAGGAAACATGGGAAGCATGGTGGACAGAGTATTGGCAAGCCACCTGGATTCCTGAGTGGGAGTTTGTCAATACCCCTCCCTTAGTGAAGTTATGGTACCAGTTAGAGAAAGAACCCATAATAGGAGCAGAAACTTTCTATGTAGATGGGGCAGCCAATAGGGAAACTAAATTAGGAAAAGCAGGATATGTAACTGACAGAGGAAGACAAAAAGTTGTCCCCCTAACGGACACAACAAATCAGAAGACTGAGTTACAAGCAATTCATCTAGCTTTGCAGGATTCGGGATTAGAAGTAAACATAGTGACAGACTCACAATATGCATTGGGAATCATTCAAGCACAACCAGATAAGAGTGAATCAGAGTTAGTCAGTCAAATAATAGAGCAGTTAATAAAAAAGGAAAAAGTCTACCTGGCATGGGTACCAGCACACAAAGGAATTGGAGGAAATGAACAAGTAGATGGGTTGGTCAGTGCTGGAATCAGGAAAGTACTATTTTTAGATGGAATAGATAAGGCCCAAGAAGAACATGAGAAATATCACAGTAATTGGAGAGCAATGGCTAGTGATTTTAACCTACCACCTGTAGTAGCAAAAGAAATAGTAGCCAGCTGTGATAAATGTCAGCTAAAAGGGGAAGCCATGCATGGACAAGTAGACTGTAGCCCAGGAATATGGCAGCTAGATTGTACACATTTAGAAGGAAAAGTTATCTTGGTAGCAGTTCATGTAGCCAGTGGATATATAGAAGCAGAAGTAATTCCAGCAGAGACAGGGCAAGAAACAGCATACTTCCTCTTAAAATTAGCAGGAAGATGGCCAGTAAAAACAGTACATACAGACAATGGCAGCAATTTCACCAGTACTACAGTTAAGGCCGCCTGTTGGTGGGCGGGGATCAAGCAGGAATTTGGCATTCCCTACAATCCCCAAAGTCAAGGAGTAATAGAATCTATGAATAAAGAATTAAAGAAAATTATAGGACAGGTAAGAGATCAGGCTGAACATCTTAAGACAGCAGTACAAATGGCAGTATTCATCCACAATTTTAAAAGAAAAGGGGGGATTGGGGGGTACAGTGCAGGGGAAAGAATAGTAGACATAATAGCAACAGACATACAAACTAAAGAATTACAAAAACAAATTACAAAAATTCAAAATTTTCGGGTTTATTACAGGGACAGCAGAGATCCAGTTTGGAAAGGACCAGCAAAGCTCCTCTGGAAAGGTGAAGGGGCAGTAGTAATACAAGATAATAGTGACATAAAAGTAGTGCCAAGAAGAAAAGCAAAGATCATCAGGGATTATGGAAAACAGATGGCAGGTGATGATTGTGTGGCAAGTAGACAGGATGAGGATTAACACATGGAAAAGATTAGTAAAACACCATATGTATATTTCAAGGAAAGCTAAGGACTGGTTTTATAGACATCACTATGAAAGTACTAATCCAAAAATAAGTTCAGAAGTACACATCCCACTAGGGGATGCTAAATTAGTAATAACAACATATTGGGGTCTGCATACAGGAGAAAGAGACTGGCATTTGGGTCAGGGAGTCTCCATAGAATGGAGGAAAAAGAGATATAGCACACAAGTAGACCCTGACCTAGCAGACCAACTAATTCATCTGCACTATTTTGATTGTTTTTCAGAATCTGCTATAAGAAATACCATATTAGGACGTATAGTTAGTCCTAGGTGTGAATATCAAGCAGGACATAACAAGGTAGGATCTCTACAGTACTTGGCACTAGCAGCATTAATAAAACCAAAACAGATAAAGCCACCTTTGCCTAGTGTTAGGAAACTGACAGAGGACAGATGGAACAAGCCCCAGAAGACCAAGGGCCACAGAGGGAGCCATACAATGAATGGACACTAGAGCTTTTAGAGGAACTTAAGAGTGAAGCTGTTAGACATTTTCCTAGGATATGGCTCCATAACTTAGGACAACATATCTATGAAACTTACGGGGATACTTGGGCAGGAGTGGAAGCCATAATAAGAATTCTGCAACAACTGCTGTTTATCCATTTCAGAATTGGGTGTCGACATAGCAGAATAGGCGTTACTCGACAGAGGAGAGCAAGAAATGGAGCCAGTAGATCCTAGACTAGAGCCCTGGAAGCATCCAGGAAGTCAGCCTAAAACTGCTTGTACCAATTGCTATTGTAAAAAGTGTTGCTTTCATTGCCAAGTTTGTTTCATGACAAAAGCCTTAGGCATCTCCTATGGCAGGAAGAAGCGGAGACAGCGACGAAGAGCTCATCAGAACAGTCAGACTCATCAAGCTTCTCTATCAAAGCAGTAAGTAGTACATGTAATGCAACCTATAATAGTAGCAATAGTAGCATTAGTAGTAGCAATAATAATAGCAATAGTTGTGTGGTCCATAGTAATCATAGAATATAGGAAAATATTAAGACAAAGAAAAATAGACAGGTTAATTGATAGACTAATAGAAAGAGCAGAAGACAGTGGCAATGAGAGTGAAGGAGAAGTATCAGCACTTGTGGAGATGGGGGTGGAAATGGGGCACCATGCTCCTTGGGATATTGATGATCTGTAGTGCTACAGAAAAATTGTGGGTCACAGTCTATTATGGGGTACCTGTGTGGAAGGAAGCAACCACCACTCTATTTTGTGCATCAGATGCTAAAGCATATGATACAGAGGTACATAATGTTTGGGCCACACATGCCTGTGTACCCACAGACCCCAACCCACAAGAAGTAGTATTGGTAAATGTGACAGAAAATTTTAACATGTGGAAAAATGACATGGTAGAACAGATGCATGAGGATATAATCAGTTTATGGGATCAAAGCCTAAAGCCATGTGTAAAATTAACCCCACTCTGTGTTAGTTTAAAGTGCACTGATTTGAAGAATGATACTAATACCAATAGTAGTAGCGGGAGAATGATAATGGAGAAAGGAGAGATAAAAAACTGCTCTTTCAATATCAGCACAAGCATAAGAGATAAGGTGCAGAAAGAATATGCATTCTTTTATAAACTTGATATAGTACCAATAGATAATACCAGCTATAGGTTGATAAGTTGTAACACCTCAGTCATTACACAGGCCTGTCCAAAGGTATCCTTTGAGCCAATTCCCATACATTATTGTGCCCCGGCTGGTTTTGCGATTCTAAAATGTAATAATAAGACGTTCAATGGAACAGGACCATGTACAAATGTCAGCACAGTACAATGTACACATGGAATCAGGCCAGTAGTATCAACTCAACTGCTGTTAAATGGCAGTCTAGCAGAAGAAGATGTAGTAATTAGATCTGCCAATTTCACAGACAATGCTAAAACCATAATAGTACAGCTGAACACATCTGTAGAAATTAATTGTACAAGACCCAACAACAATACAAGAAAAAGTATCCGTATCCAGAGGGGACCAGGGAGAGCATTTGTTACAATAGGAAAAATAGGAAATATGAGACAAGCACATTGTAACATTAGTAGAGCAAAATGGAATGCCACTTTAAAACAGATAGCTAGCAAATTAAGAGAACAATTTGGAAATAATAAAACAATAATCTTTAAGCAATCCTCAGGAGGGGACCCAGAAATTGTAACGCACAGTTTTAATTGTGGAGGGGAATTTTTCTACTGTAATTCAACACAACTGTTTAATAGTACTTGGTTTAATAGTACTTGGAGTACTGAAGGGTCAAATAACACTGAAGGAAGTGACACAATCACACTCCCATGCAGAATAAAACAATTTATAAACATGTGGCAGGAAGTAGGAAAAGCAATGTATGCCCCTCCCATCAGTGGACAAATTAGATGTTCATCAAATATTACTGGGCTGCTATTAACAAGAGATGGTGGTAATAACAACAATGGGTCCGAGATCTTCAGACCTGGAGGAGGCGATATGAGGGACAATTGGAGAAGTGAATTATATAAATATAAAGTAGTAAAAATTGAACCATTAGGAGTAGCACCCACCAAGGCAAAGAGAAGAGTGGTGCAGAGAGAAAAAAGAGCAGTGGGAATAGGAGCTTTGTTCCTTGGGTTCTTGGGAGCAGCAGGAAGCACTATGGGCTGCACGTCAATGACGCTGACGGTACAGGCCAGACAATTATTGTCTGATATAGTGCAGCAGCAGAACAATTTGCTGAGGGCTATTGAGGCGCAACAGCATCTGTTGCAACTCACAGTCTGGGGCATCAAACAGCTCCAGGCAAGAATCCTGGCTGTGGAAAGATACCTAAAGGATCAACAGCTCCTGGGGATTTGGGGTTGCTCTGGAAAACTCATTTGCACCACTGCTGTGCCTTGGAATGCTAGTTGGAGTAATAAATCTCTGGAACAGATTTGGAATAACATGACCTGGATGGAGTGGGACAGAGAAATTAACAATTACACAAGCTTAATACACTCCTTAATTGAAGAATCGCAAAACCAGCAAGAAAAGAATGAACAAGAATTATTGGAATTAGATAAATGGGCAAGTTTGTGGAATTGGTTTAACATAACAAATTGGCTGTGGTATATAAAATTATTCATAATGATAGTAGGAGGCTTGGTAGGTTTAAGAATAGTTTTTGCTGTACTTTCTATAGTGAATAGAGTTAGGCAGGGATATTCACCATTATCGTTTCAGACCCACCTCCCAATCCCGAGGGGACCCGACAGGCCCGAAGGAATAGAAGAAGAAGGTGGAGAGAGAGACAGAGACAGATCCATTCGATTAGTGAACGGATCCTTAGCACTTATCTGGGACGATCTGCGGAGCCTGTGCCTCTTCAGCTACCACCGCTTGAGAGACTTACTCTTGATTGTAACGAGGATTGTGGAACTTCTGGGACGCAGGGGGTGGGAAGCCCTCAAATATTGGTGGAATCTCCTACAGTATTGGAGTCAGGAACTAAAGAATAGTGCTGTTAACTTGCTCAATGCCACAGCCATAGCAGTAGCTGAGGGGACAGATAGGGTTATAGAAGTATTACAAGCAGCTTATAGAGCTATTCGCCACATACCTAGAAGAATAAGACAGGGCTTGGAAAGGATTTTGCTATAAGATGGGTGGCAAGTGGTCAAAAAGTAGTGTGATTGGATGGCCTGCTGTAAGGGAAAGAATGAGACGAGCTGAGCCAGCAGCAGATGGGGTGGGAGCAGTATCTCGAGACCTAGAAAAACATGGAGCAATCACAAGTAGCAATACAGCAGCTAACAATGCTGCTTGTGCCTGGCTAGAAGCACAAGAGGAGGAAGAGGTGGGTTTTCCAGTCACACCTCAGGTACCTTTAAGACCAATGACTTACAAGGCAGCTGTAGATCTTAGCCACTTTTTAAAAGAAAAGGGGGGACTGGAAGGGCTAATTCACTCCCAAAGAAGACAAGATATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTGGCAGAACTACACACCAGGGCCAGGGGTCAGATATCCACTGACCTTTGGATGGTGCTACAAGCTAGTACCAGTTGAGCCAGATAAGGTAGAAGAGGCCAATAAAGGAGAGAACACCAGCTTGTTACACCCTGTGAGCCTGCATGGAATGGATGACCCTGAGAGAGAAGTGTTAGAGTGGAGGTTTGACAGCCGCCTAGCATTTCATCACGTGGCCCGAGAGCTGCATCCGGAGTACTTCAAGAACTGCTGACATCGAGCTTGCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGCGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATGCTGCATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTTCAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCACCCAGGAGGTAGAGGTTGCAGTGAGCCAAGATCGCGCCACTGCATTCCAGCCTGGGCAAGAAAACAAGACTGTCTAAAATAATAATAATAAGTTAAGGGTATTAAATATATTTATACATGGAGGTCATAAAAATATATATATTTGGGCTGGGCGCAGTGGCTCACACCTGCGCCCGGCCCTTTGGGAGGCCGAGGCAGGTGGATCACCTGAGTTTGGGAGTTCCAGACCAGCCTGACCAACATGGAGAAACCCCTTCTCTGTGTATTTTTAGTAGATTTTATTTTATGTGTATTTTATTCACAGGTATTTCTGGAAAACTGAAACTGTTTTTCCTCTACTCTGATACCACAAGAATCATCAGCACAGAGGAAGACTTCTGTGATCAAATGTGGTGGGAGAGGGAGGTTTTCACCAGCACATGAGCAGTCAGTTCTGCCGCAGACTCGGCGGGTGTCCTTCGGTTCAGTTCCAACACCGCCTGCCTGGAGAGAGGTCAGACCACAGGGTGAGGGCTCAGTCCCCAAGACATAAACACCCAAGACATAAACACCCAACAGGTCCACCCCGCCTGCTGCCCAGGCAGAGCCGATTCACCAAGACGGGAATTAGGATAGAGAAAGAGTAAGTCACACAGAGCCGGCTGTGCGGGAGAACGGAGTTCTATTATGACTCAAATCAGTCTCCCCAAGCATTCGGGGATCAGAGTTTTTAAGGATAACTTAGTGTGTAGGGGGCCAGTGAGTTGGAGATGAAAGCGTAGGGAGTCGAAGGTGTCCTTTTGCGCCGAGTCAGTTCCTGGGTGGGGGCCACAAGATCGGATGAGCCAGTTTATCAATCCGGGGGTGCCAGCTGATCCATGGAGTGCAGGGTCTGCAAAATATCTCAAGCACTGATTGATCTTAGGTTTTACAATAGTGATGTTACCCCAGGAACAATTTGGGGAAGGTCAGAATCTTGTAGCCTGTAGCTGCATGACTCCTAAACCATAATTTCTTTTTTGTTTTTTTTTTTTTATTTTTGAGACAGGGTCTCACTCTGTCACCTAGGCTGGAGTGCAGTGGTGCAATCACAGCTCACTGCAGCCTCAACGTCGTAAGCTCAAGCGATCCTCCCACCTCAGCCTGCCTGGTAGCTGAGACTACAAGCGACGCCCCAGTTAATTTTTGTATTTTTGGTAGAGGCAGCGTTTTGCCGTGTGGCCCTGGCTGGTCTCGAACTCCTGGGCTCAAGTGATCCAGCCTCAGCCTCCCAAAGTGCTGGGACAACCGGGCCCAGTCACTGCACCTGGCCCTAAACCATAATTTCTAATCTTTTGGCTAATTTGTTAGTCCTACAAAGGCAGTCTAGTCCCCAGCAAAAAGGGGGTTTGTTTCGGGAAAGGGCTGTTACTGTCTTTGTTTCAAACTATAAACTAAGTTCCTCCTAAACTTAGTTCGGCCTACACCCAGGAATGAACAAGGAGAGCTTGGAGGTTAGAAGCACGATGGAATTGGTTAGGTCAGATCTCTTTCACTGTCTGAGTTATAATTTTGCAATGGTGGTTCAAAGACTGCCCGCTTCTGACACCAGTCGCTGCATTAATGAATCGGCCAACGCGCGGGGAGAGGCGGTTTGCGTATTGGGCGCTCTTCCGCTTCCTCGCTCACTGACTCGCTGCGCTCGGTCGTTCGGCTGCGGCGAGCGGTATCAGCTCACTCAAAGGCGGTAATACGGTTATCCACAGAATCAGGGGATAACGCAGGAAAGAACATGTGAGCAAAAGGCCAGCAAAAGGCCAGGAACCGTAAAAAGGCCGCGTTGCTGGCGTTTTTCCATAGGCTCCGCCCCCCTGACGAGCATCACAAAAATCGACGCTCAAGTCAGAGGTGGCGAAACCCGACAGGACTATAAAGATACCAGGCGTTTCCCCCTGGAAGCTCCCTCGTGCGCTCTCCTGTTCCGACCCTGCCGCTTACCGGATACCTGTCCGCCTTTCTCCCTTCGGGAAGCGTGGCGCTTTCTCATAGCTCACGCTGTAGGTATCTCAGTTCGGTGTAGGTCGTTCGCTCCAAGCTGGGCTGTGTGCACGAACCCCCCGTTCAGCCCGACCGCTGCGCCTTATCCGGTAACTATCGTCTTGAGTCCAACCCGGTAAGACACGACTTATCGCCACTGGCAGCAGCCACTGGTAACAGGATTAGCAGAGCGAGGTATGTAGGCGGTGCTACAGAGTTCTTGAAGTGGTGGCCTAACTACGGCTACACTAGAAGGACAGTATTTGGTATCTGCGCTCTGCTGAAGCCAGTTACCTTCGGAAAAAGAGTTGGTAGCTCTTGATCCGGCAAACAAACCACCGCTGGTAGCGGTGGTTTTTTTGTTTGCAAGCAGCAGATTACGCGCAGAAAAAAAGGATCTCAAGAAGATCCTTTGATCTTTTCTACGGGGTCTGACGCTCAGTGGAACGAAAACTCACGTTAAGGGATTTTGGTCATGAGATTATCAAAAAGGATCTTCACCTAGATCCTTTTAAATTAAAAATGAAGTTTTAAATCAATCTAAAGTATATATGAGTAAACTTGGTCTGACAGTTACCAATGCTTAATCAGTGAGGCACCTATCTCAGCGATCTGTCTATTTCGTTCATCCATAGTTGCCTGACTCCCCGTCGTGTAGATAACTACGATACGGGAGGGCTTACCATCTGGCCCCAGTGCTGCAATGATACCGCGAGACCCACGCTCACCGGCTCCAGATTTATCAGCAATAAACCAGCCAGCCGGAAGGGCCGAGCGCAGAAGTGGTCCTGCAACTTTATCCGCCTCCATCCAGTCTATTAATTGTTGCCGGGAAGCTAGAGTAAGTAGTTCGCCAGTTAATAGTTTGCGCAACGTTGTTGCCATTGCTACAGGCATCGTGGTGTCACGCTCGTCGTTTGGTATGGCTTCATTCAGCTCCGGTTCCCAACGATCAAGGCGAGTTACATGATCCCCCATGTTGTGCAAAAAAGCGGTTAGCTCCTTCGGTCCTCCGATCGTTGTCAGAAGTAAGTTGGCCGCAGTGTTATCACTCATGGTTATGGCAGCACTGCATAATTCTCTTACTGTCATGCCATCCGTAAGATGCTTTTCTGTGACTGGTGAGTACTCAACCAAGTCATTCTGAGAATAGTGTATGCGGCGACCGAGTTGCTCTTGCCCGGCGTCAATACGGGATAATACCGCGCCACATAGCAGAACTTTAAAAGTGCTCATCATTGGAAAACGTTCTTCGGGGCGAAAACTCTCAAGGATCTTACCGCTGTTGAGATCCAGTTCGATGTAACCCACTCGTGCACCCAACTGATCTTCAGCATCTTTTACTTTCACCAGCGTTTCTGGGTGAGCAAAAACAGGAAGGCAAAATGCCGCAAAAAAGGGAATAAGGGCGACACGGAAATGTTGAATACTCATACTCTTCCTTTTTCAATATTATTGAAGCATTTATCAGGGTTATTGTCTCATGAGCGGATACATATTTGAATGTATTTAGAAAAATAAACAAATAGGGGTTCCGCGCACATTTCCCCGAAAAGTGCCACCTGACGTCTAAGAAACCATTATTATCATGACATTAACCTATAAAAATAGGCGTATCACGAGGCCCTTTCGTCTCGCGCGTTTCGGTGATGACGGTGAAAACCTCTGACACATGCAGCTCCCGGAGACGGTCACAGCTTGTCTGTAAGCGGATGCCGGGAGCAGACAAGCCCGTCAGGGCGCGTCAGCGGGTGTTGGCGGGTGTCGGGGCTGGCTTAACTATGCGGCATCAGAGCAGATTGTACTGAGAGTGCACCATATGCGGTGTGAAATACCGCACAGATGCGTAAGGAGAAAATACCGCATCAGGCGCCATTCGCCATTCAGGCTGCGCAACTGTTGGGAAGGGCGATCGGTGCGGGCCTCTTCGCTATTACGCCAGGGGAGGCAGAGATTGCAGTAAGCTGAGATCGCAGCACTGCACTCCAGCCTGGGCGACAGAGTAAGACTCTGTCTCAAAAATAAAATAAATAAATCAATCAGATATTCCAATCTTTTCCTTTATTTATTTATTTATTTTCTATTTTGGAAACACAGTCCTTCCTTATTCCAGAATTACACATATATTCTATTTTTCTTTATATGCTCCAGTTTTTTTTAGACCTTCACCTGAAATGTGTGTATACAAAATCTAGGCCAGTCCAGCAGAGCCTAAAGGTAAAAAATAAAATAATAAAAAATAAATAAAATCTAGCTCACTCCTTCACATCAAAATGGAGATACAGCTGTTAGCATTAAATACCAAATAACCCATCTTGTCCTCAATAATTTTAAGCGCCTCTCTCCACCACATCTAACTCCTGTCAAAGGCATGTGCCCCTTCCGGGCGCTCTGCTGTGCTGCCAACCAACTGGCATGTGGACTCTGCAGGGTCCCTAACTGCCAAGCCCCACAGTGTGCCCTGAGGCTGCCCCTTCCTTCTAGCGGCTGCCCCCACTCGGCTTTGCTTTCCCTAGTTTCAGTTACTTGCGTTCAGCCAAGGTCTGAAACTAGGTGCGCACAGAGCGGTAAGACTGCGAGAGAAAGAGACCAGCTTTACAGGGGGTTTATCACAGTGCACCCTGACAGTCGTCAGCCTCACAGGGGGTTTATCACATTGCACCCTGACAGTCGTCAGCCTCACAGGGGGTTTATCACAGTGCACCCTTACAATCATTCCATTTGATTCACAATTTTTTTAGTCTCTACTGTGCCTAACTTGTAAGTTAAATTTGATCAGAGGTGTGTTCCCAGAGGGGAAAACAGTATATACAGGGTTCAGTACTATCGCATTTCAGGCCTCCACCTGGGTCTTGGAATGTGTCCCCCGAGGGGTGATGACTACCTCAGTTGGATCTCCACAGGTCACAGTGACACAAGATAACCAAGACACCTCCCAAGGCTACCACAATGGGCCGCCCTCCACGTGCACATGGCCGGAGGAACTGCCATGTCGGAGGTGCAAGCACACCTGCGCATCAGAGTCCTTGGTGTGGAGGGAGGGACCAGCGCAGCTTCCAGCCATCCACCTGATGAACAGAACCTAGGGAAAGCCCCAGTTCTACTTACACCAGGAAAGGC\"\n hxb2_l = hxb2_ref.size\n head = \"\"\n 8.times {head << (65 + rand(25)).chr}\n temp_file = temp_dir + \"/temp\"\n temp_aln = temp_dir + \"/temp_aln\"\n\n l1 = 0\n l2 = 0\n name = \">test\"\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts hxb2_ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n if ref_size > 1.3*(seq.size)\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n max_seq = aln_test2.scan(/[ACGT]+/).max_by(&:length)\n aln_test2 =~ /#{max_seq}/\n before_aln_seq = $`\n before_aln = $`.size\n post_aln_seq = $'\n post_aln = $'.size\n before_aln_seq_size = before_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b1 = (1.3 * before_aln_seq_size).to_i\n post_aln_seq_size = post_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b2 = (1.3 * post_aln_seq_size).to_i\n if (before_aln > seq.size) and (post_aln <= seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1)]\n l1 = l1 + (before_aln - b1)\n elsif (post_aln > seq.size) and (before_aln <= seq.size)\n ref = ref[before_aln..(ref_size - post_aln - 1 + b2)]\n l2 = l2 + post_aln - b2\n elsif (post_aln > seq.size) and (before_aln > seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1 + b2)]\n l1 = l1 + (before_aln - b1)\n l2 = l2 + (post_aln - b2)\n end\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n end\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n\n if g1 == g2 and (s1 + g1 + s2) == ref.size\n if s1 > s2 and g2 > 2*s2\n ref = ref[0..(-g2-1)]\n repeat = 1\n l2 = l2 + g2\n elsif s1 < s2 and g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n else\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n\n while repeat == 1\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n #refine alignment\n\n if ref =~ /^(\\-+)/\n l1 = l1 - $1.size\n elsif ref =~ /(\\-+)$/\n l2 = l2 + $1.size\n end\n l1 = 0 if l1 < 0\n if (hxb2_l - l2 - 1) >= l1\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n ref_size = ref.size\n sim_count = 0\n (0..(ref_size-1)).each do |n|\n ref_base = ref[n]\n test_base = aln_test[n]\n sim_count += 1 if ref_base == test_base\n end\n similarity = (sim_count/ref_size.to_f*100).round(1)\n print `rm -f #{temp_file}`\n print `rm -f #{temp_aln}`\n loc_p1 = l1 + 1\n loc_p2 = hxb2_l - l2\n if seq.size != (loc_p2 - loc_p1 + 1)\n indel = true\n elsif aln_test.include?(\"-\")\n indel = true\n end\n return [loc_p1,loc_p2,similarity,indel,aln_test,ref]\n else\n return [0,0,0,0,0,0,0]\n end\nrescue\n return [0,0,0,0,\"N\",\"N\"]\nend", "def schubert; end", "def offences_by; end", "def formation; end", "def berlioz; end", "def slow_build_pattern_prefix_function(pattern)\n prefix_fnc_array = []\n prefix_fnc_array[0] = -1\n prefix_fnc_array[1] = 0\n padded_pattern = \" \" + pattern # padded so that index 1 will point to the start of the pattern\n \n (2..pattern.size ).each do |q|\n k = 0\n (1..q-1).each do |index|\n #puts \"#{q} #{index} #{padded_pattern[1..index]} #{padded_pattern[ q - index + 1 .. q]} \"\n if padded_pattern[1..index] == padded_pattern[ q - index + 1 .. q] \n k = index \n end\n end\n prefix_fnc_array[q] = k\n \n end\n\n return prefix_fnc_array\nend", "def malts; end", "def jack_handey; end", "def off_line_minimum(strArr)\n \nend", "def sequence_locator(seq=\"\",temp_dir=File.dirname($0))\n hxb2_ref = \"TGGAAGGGCTAATTCACTCCCAACGAAGACAAGATATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTAGCAGAACTACACACCAGGGCCAGGGATCAGATATCCACTGACCTTTGGATGGTGCTACAAGCTAGTACCAGTTGAGCCAGAGAAGTTAGAAGAAGCCAACAAAGGAGAGAACACCAGCTTGTTACACCCTGTGAGCCTGCATGGAATGGATGACCCGGAGAGAGAAGTGTTAGAGTGGAGGTTTGACAGCCGCCTAGCATTTCATCACATGGCCCGAGAGCTGCATCCGGAGTACTTCAAGAACTGCTGACATCGAGCTTGCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGCGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATCCTGCATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTTCAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCAGTGGCGCCCGAACAGGGACCTGAAAGCGAAAGGGAAACCAGAGGAGCTCTCTCGACGCAGGACTCGGCTTGCTGAAGCGCGCACGGCAAGAGGCGAGGGGCGGCGACTGGTGAGTACGCCAAAAATTTTGACTAGCGGAGGCTAGAAGGAGAGAGATGGGTGCGAGAGCGTCAGTATTAAGCGGGGGAGAATTAGATCGATGGGAAAAAATTCGGTTAAGGCCAGGGGGAAAGAAAAAATATAAATTAAAACATATAGTATGGGCAAGCAGGGAGCTAGAACGATTCGCAGTTAATCCTGGCCTGTTAGAAACATCAGAAGGCTGTAGACAAATACTGGGACAGCTACAACCATCCCTTCAGACAGGATCAGAAGAACTTAGATCATTATATAATACAGTAGCAACCCTCTATTGTGTGCATCAAAGGATAGAGATAAAAGACACCAAGGAAGCTTTAGACAAGATAGAGGAAGAGCAAAACAAAAGTAAGAAAAAAGCACAGCAAGCAGCAGCTGACACAGGACACAGCAATCAGGTCAGCCAAAATTACCCTATAGTGCAGAACATCCAGGGGCAAATGGTACATCAGGCCATATCACCTAGAACTTTAAATGCATGGGTAAAAGTAGTAGAAGAGAAGGCTTTCAGCCCAGAAGTGATACCCATGTTTTCAGCATTATCAGAAGGAGCCACCCCACAAGATTTAAACACCATGCTAAACACAGTGGGGGGACATCAAGCAGCCATGCAAATGTTAAAAGAGACCATCAATGAGGAAGCTGCAGAATGGGATAGAGTGCATCCAGTGCATGCAGGGCCTATTGCACCAGGCCAGATGAGAGAACCAAGGGGAAGTGACATAGCAGGAACTACTAGTACCCTTCAGGAACAAATAGGATGGATGACAAATAATCCACCTATCCCAGTAGGAGAAATTTATAAAAGATGGATAATCCTGGGATTAAATAAAATAGTAAGAATGTATAGCCCTACCAGCATTCTGGACATAAGACAAGGACCAAAGGAACCCTTTAGAGACTATGTAGACCGGTTCTATAAAACTCTAAGAGCCGAGCAAGCTTCACAGGAGGTAAAAAATTGGATGACAGAAACCTTGTTGGTCCAAAATGCGAACCCAGATTGTAAGACTATTTTAAAAGCATTGGGACCAGCGGCTACACTAGAAGAAATGATGACAGCATGTCAGGGAGTAGGAGGACCCGGCCATAAGGCAAGAGTTTTGGCTGAAGCAATGAGCCAAGTAACAAATTCAGCTACCATAATGATGCAGAGAGGCAATTTTAGGAACCAAAGAAAGATTGTTAAGTGTTTCAATTGTGGCAAAGAAGGGCACACAGCCAGAAATTGCAGGGCCCCTAGGAAAAAGGGCTGTTGGAAATGTGGAAAGGAAGGACACCAAATGAAAGATTGTACTGAGAGACAGGCTAATTTTTTAGGGAAGATCTGGCCTTCCTACAAGGGAAGGCCAGGGAATTTTCTTCAGAGCAGACCAGAGCCAACAGCCCCACCAGAAGAGAGCTTCAGGTCTGGGGTAGAGACAACAACTCCCCCTCAGAAGCAGGAGCCGATAGACAAGGAACTGTATCCTTTAACTTCCCTCAGGTCACTCTTTGGCAACGACCCCTCGTCACAATAAAGATAGGGGGGCAACTAAAGGAAGCTCTATTAGATACAGGAGCAGATGATACAGTATTAGAAGAAATGAGTTTGCCAGGAAGATGGAAACCAAAAATGATAGGGGGAATTGGAGGTTTTATCAAAGTAAGACAGTATGATCAGATACTCATAGAAATCTGTGGACATAAAGCTATAGGTACAGTATTAGTAGGACCTACACCTGTCAACATAATTGGAAGAAATCTGTTGACTCAGATTGGTTGCACTTTAAATTTTCCCATTAGCCCTATTGAGACTGTACCAGTAAAATTAAAGCCAGGAATGGATGGCCCAAAAGTTAAACAATGGCCATTGACAGAAGAAAAAATAAAAGCATTAGTAGAAATTTGTACAGAGATGGAAAAGGAAGGGAAAATTTCAAAAATTGGGCCTGAAAATCCATACAATACTCCAGTATTTGCCATAAAGAAAAAAGACAGTACTAAATGGAGAAAATTAGTAGATTTCAGAGAACTTAATAAGAGAACTCAAGACTTCTGGGAAGTTCAATTAGGAATACCACATCCCGCAGGGTTAAAAAAGAAAAAATCAGTAACAGTACTGGATGTGGGTGATGCATATTTTTCAGTTCCCTTAGATGAAGACTTCAGGAAGTATACTGCATTTACCATACCTAGTATAAACAATGAGACACCAGGGATTAGATATCAGTACAATGTGCTTCCACAGGGATGGAAAGGATCACCAGCAATATTCCAAAGTAGCATGACAAAAATCTTAGAGCCTTTTAGAAAACAAAATCCAGACATAGTTATCTATCAATACATGGATGATTTGTATGTAGGATCTGACTTAGAAATAGGGCAGCATAGAACAAAAATAGAGGAGCTGAGACAACATCTGTTGAGGTGGGGACTTACCACACCAGACAAAAAACATCAGAAAGAACCTCCATTCCTTTGGATGGGTTATGAACTCCATCCTGATAAATGGACAGTACAGCCTATAGTGCTGCCAGAAAAAGACAGCTGGACTGTCAATGACATACAGAAGTTAGTGGGGAAATTGAATTGGGCAAGTCAGATTTACCCAGGGATTAAAGTAAGGCAATTATGTAAACTCCTTAGAGGAACCAAAGCACTAACAGAAGTAATACCACTAACAGAAGAAGCAGAGCTAGAACTGGCAGAAAACAGAGAGATTCTAAAAGAACCAGTACATGGAGTGTATTATGACCCATCAAAAGACTTAATAGCAGAAATACAGAAGCAGGGGCAAGGCCAATGGACATATCAAATTTATCAAGAGCCATTTAAAAATCTGAAAACAGGAAAATATGCAAGAATGAGGGGTGCCCACACTAATGATGTAAAACAATTAACAGAGGCAGTGCAAAAAATAACCACAGAAAGCATAGTAATATGGGGAAAGACTCCTAAATTTAAACTGCCCATACAAAAGGAAACATGGGAAACATGGTGGACAGAGTATTGGCAAGCCACCTGGATTCCTGAGTGGGAGTTTGTTAATACCCCTCCCTTAGTGAAATTATGGTACCAGTTAGAGAAAGAACCCATAGTAGGAGCAGAAACCTTCTATGTAGATGGGGCAGCTAACAGGGAGACTAAATTAGGAAAAGCAGGATATGTTACTAATAGAGGAAGACAAAAAGTTGTCACCCTAACTGACACAACAAATCAGAAGACTGAGTTACAAGCAATTTATCTAGCTTTGCAGGATTCGGGATTAGAAGTAAACATAGTAACAGACTCACAATATGCATTAGGAATCATTCAAGCACAACCAGATCAAAGTGAATCAGAGTTAGTCAATCAAATAATAGAGCAGTTAATAAAAAAGGAAAAGGTCTATCTGGCATGGGTACCAGCACACAAAGGAATTGGAGGAAATGAACAAGTAGATAAATTAGTCAGTGCTGGAATCAGGAAAGTACTATTTTTAGATGGAATAGATAAGGCCCAAGATGAACATGAGAAATATCACAGTAATTGGAGAGCAATGGCTAGTGATTTTAACCTGCCACCTGTAGTAGCAAAAGAAATAGTAGCCAGCTGTGATAAATGTCAGCTAAAAGGAGAAGCCATGCATGGACAAGTAGACTGTAGTCCAGGAATATGGCAACTAGATTGTACACATTTAGAAGGAAAAGTTATCCTGGTAGCAGTTCATGTAGCCAGTGGATATATAGAAGCAGAAGTTATTCCAGCAGAAACAGGGCAGGAAACAGCATATTTTCTTTTAAAATTAGCAGGAAGATGGCCAGTAAAAACAATACATACTGACAATGGCAGCAATTTCACCGGTGCTACGGTTAGGGCCGCCTGTTGGTGGGCGGGAATCAAGCAGGAATTTGGAATTCCCTACAATCCCCAAAGTCAAGGAGTAGTAGAATCTATGAATAAAGAATTAAAGAAAATTATAGGACAGGTAAGAGATCAGGCTGAACATCTTAAGACAGCAGTACAAATGGCAGTATTCATCCACAATTTTAAAAGAAAAGGGGGGATTGGGGGGTACAGTGCAGGGGAAAGAATAGTAGACATAATAGCAACAGACATACAAACTAAAGAATTACAAAAACAAATTACAAAAATTCAAAATTTTCGGGTTTATTACAGGGACAGCAGAAATCCACTTTGGAAAGGACCAGCAAAGCTCCTCTGGAAAGGTGAAGGGGCAGTAGTAATACAAGATAATAGTGACATAAAAGTAGTGCCAAGAAGAAAAGCAAAGATCATTAGGGATTATGGAAAACAGATGGCAGGTGATGATTGTGTGGCAAGTAGACAGGATGAGGATTAGAACATGGAAAAGTTTAGTAAAACACCATATGTATGTTTCAGGGAAAGCTAGGGGATGGTTTTATAGACATCACTATGAAAGCCCTCATCCAAGAATAAGTTCAGAAGTACACATCCCACTAGGGGATGCTAGATTGGTAATAACAACATATTGGGGTCTGCATACAGGAGAAAGAGACTGGCATTTGGGTCAGGGAGTCTCCATAGAATGGAGGAAAAAGAGATATAGCACACAAGTAGACCCTGAACTAGCAGACCAACTAATTCATCTGTATTACTTTGACTGTTTTTCAGACTCTGCTATAAGAAAGGCCTTATTAGGACACATAGTTAGCCCTAGGTGTGAATATCAAGCAGGACATAACAAGGTAGGATCTCTACAATACTTGGCACTAGCAGCATTAATAACACCAAAAAAGATAAAGCCACCTTTGCCTAGTGTTACGAAACTGACAGAGGATAGATGGAACAAGCCCCAGAAGACCAAGGGCCACAGAGGGAGCCACACAATGAATGGACACTAGAGCTTTTAGAGGAGCTTAAGAATGAAGCTGTTAGACATTTTCCTAGGATTTGGCTCCATGGCTTAGGGCAACATATCTATGAAACTTATGGGGATACTTGGGCAGGAGTGGAAGCCATAATAAGAATTCTGCAACAACTGCTGTTTATCCATTTTCAGAATTGGGTGTCGACATAGCAGAATAGGCGTTACTCGACAGAGGAGAGCAAGAAATGGAGCCAGTAGATCCTAGACTAGAGCCCTGGAAGCATCCAGGAAGTCAGCCTAAAACTGCTTGTACCAATTGCTATTGTAAAAAGTGTTGCTTTCATTGCCAAGTTTGTTTCATAACAAAAGCCTTAGGCATCTCCTATGGCAGGAAGAAGCGGAGACAGCGACGAAGAGCTCATCAGAACAGTCAGACTCATCAAGCTTCTCTATCAAAGCAGTAAGTAGTACATGTAACGCAACCTATACCAATAGTAGCAATAGTAGCATTAGTAGTAGCAATAATAATAGCAATAGTTGTGTGGTCCATAGTAATCATAGAATATAGGAAAATATTAAGACAAAGAAAAATAGACAGGTTAATTGATAGACTAATAGAAAGAGCAGAAGACAGTGGCAATGAGAGTGAAGGAGAAATATCAGCACTTGTGGAGATGGGGGTGGAGATGGGGCACCATGCTCCTTGGGATGTTGATGATCTGTAGTGCTACAGAAAAATTGTGGGTCACAGTCTATTATGGGGTACCTGTGTGGAAGGAAGCAACCACCACTCTATTTTGTGCATCAGATGCTAAAGCATATGATACAGAGGTACATAATGTTTGGGCCACACATGCCTGTGTACCCACAGACCCCAACCCACAAGAAGTAGTATTGGTAAATGTGACAGAAAATTTTAACATGTGGAAAAATGACATGGTAGAACAGATGCATGAGGATATAATCAGTTTATGGGATCAAAGCCTAAAGCCATGTGTAAAATTAACCCCACTCTGTGTTAGTTTAAAGTGCACTGATTTGAAGAATGATACTAATACCAATAGTAGTAGCGGGAGAATGATAATGGAGAAAGGAGAGATAAAAAACTGCTCTTTCAATATCAGCACAAGCATAAGAGGTAAGGTGCAGAAAGAATATGCATTTTTTTATAAACTTGATATAATACCAATAGATAATGATACTACCAGCTATAAGTTGACAAGTTGTAACACCTCAGTCATTACACAGGCCTGTCCAAAGGTATCCTTTGAGCCAATTCCCATACATTATTGTGCCCCGGCTGGTTTTGCGATTCTAAAATGTAATAATAAGACGTTCAATGGAACAGGACCATGTACAAATGTCAGCACAGTACAATGTACACATGGAATTAGGCCAGTAGTATCAACTCAACTGCTGTTAAATGGCAGTCTAGCAGAAGAAGAGGTAGTAATTAGATCTGTCAATTTCACGGACAATGCTAAAACCATAATAGTACAGCTGAACACATCTGTAGAAATTAATTGTACAAGACCCAACAACAATACAAGAAAAAGAATCCGTATCCAGAGAGGACCAGGGAGAGCATTTGTTACAATAGGAAAAATAGGAAATATGAGACAAGCACATTGTAACATTAGTAGAGCAAAATGGAATAACACTTTAAAACAGATAGCTAGCAAATTAAGAGAACAATTTGGAAATAATAAAACAATAATCTTTAAGCAATCCTCAGGAGGGGACCCAGAAATTGTAACGCACAGTTTTAATTGTGGAGGGGAATTTTTCTACTGTAATTCAACACAACTGTTTAATAGTACTTGGTTTAATAGTACTTGGAGTACTGAAGGGTCAAATAACACTGAAGGAAGTGACACAATCACCCTCCCATGCAGAATAAAACAAATTATAAACATGTGGCAGAAAGTAGGAAAAGCAATGTATGCCCCTCCCATCAGTGGACAAATTAGATGTTCATCAAATATTACAGGGCTGCTATTAACAAGAGATGGTGGTAATAGCAACAATGAGTCCGAGATCTTCAGACCTGGAGGAGGAGATATGAGGGACAATTGGAGAAGTGAATTATATAAATATAAAGTAGTAAAAATTGAACCATTAGGAGTAGCACCCACCAAGGCAAAGAGAAGAGTGGTGCAGAGAGAAAAAAGAGCAGTGGGAATAGGAGCTTTGTTCCTTGGGTTCTTGGGAGCAGCAGGAAGCACTATGGGCGCAGCCTCAATGACGCTGACGGTACAGGCCAGACAATTATTGTCTGGTATAGTGCAGCAGCAGAACAATTTGCTGAGGGCTATTGAGGCGCAACAGCATCTGTTGCAACTCACAGTCTGGGGCATCAAGCAGCTCCAGGCAAGAATCCTGGCTGTGGAAAGATACCTAAAGGATCAACAGCTCCTGGGGATTTGGGGTTGCTCTGGAAAACTCATTTGCACCACTGCTGTGCCTTGGAATGCTAGTTGGAGTAATAAATCTCTGGAACAGATTTGGAATCACACGACCTGGATGGAGTGGGACAGAGAAATTAACAATTACACAAGCTTAATACACTCCTTAATTGAAGAATCGCAAAACCAGCAAGAAAAGAATGAACAAGAATTATTGGAATTAGATAAATGGGCAAGTTTGTGGAATTGGTTTAACATAACAAATTGGCTGTGGTATATAAAATTATTCATAATGATAGTAGGAGGCTTGGTAGGTTTAAGAATAGTTTTTGCTGTACTTTCTATAGTGAATAGAGTTAGGCAGGGATATTCACCATTATCGTTTCAGACCCACCTCCCAACCCCGAGGGGACCCGACAGGCCCGAAGGAATAGAAGAAGAAGGTGGAGAGAGAGACAGAGACAGATCCATTCGATTAGTGAACGGATCCTTGGCACTTATCTGGGACGATCTGCGGAGCCTGTGCCTCTTCAGCTACCACCGCTTGAGAGACTTACTCTTGATTGTAACGAGGATTGTGGAACTTCTGGGACGCAGGGGGTGGGAAGCCCTCAAATATTGGTGGAATCTCCTACAGTATTGGAGTCAGGAACTAAAGAATAGTGCTGTTAGCTTGCTCAATGCCACAGCCATAGCAGTAGCTGAGGGGACAGATAGGGTTATAGAAGTAGTACAAGGAGCTTGTAGAGCTATTCGCCACATACCTAGAAGAATAAGACAGGGCTTGGAAAGGATTTTGCTATAAGATGGGTGGCAAGTGGTCAAAAAGTAGTGTGATTGGATGGCCTACTGTAAGGGAAAGAATGAGACGAGCTGAGCCAGCAGCAGATAGGGTGGGAGCAGCATCTCGAGACCTGGAAAAACATGGAGCAATCACAAGTAGCAATACAGCAGCTACCAATGCTGCTTGTGCCTGGCTAGAAGCACAAGAGGAGGAGGAGGTGGGTTTTCCAGTCACACCTCAGGTACCTTTAAGACCAATGACTTACAAGGCAGCTGTAGATCTTAGCCACTTTTTAAAAGAAAAGGGGGGACTGGAAGGGCTAATTCACTCCCAAAGAAGACAAGATATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTAGCAGAACTACACACCAGGGCCAGGGGTCAGATATCCACTGACCTTTGGATGGTGCTACAAGCTAGTACCAGTTGAGCCAGATAAGATAGAAGAGGCCAATAAAGGAGAGAACACCAGCTTGTTACACCCTGTGAGCCTGCATGGGATGGATGACCCGGAGAGAGAAGTGTTAGAGTGGAGGTTTGACAGCCGCCTAGCATTTCATCACGTGGCCCGAGAGCTGCATCCGGAGTACTTCAAGAACTGCTGACATCGAGCTTGCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGCGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATCCTGCATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTTCAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCA\"\n hxb2_l = hxb2_ref.size\n head = \"\"\n 8.times {head << (65 + rand(25)).chr}\n temp_file = temp_dir + \"/\" + head + \"_temp\"\n temp_aln = temp_dir + \"/\" + head + \"_temp_aln\"\n\n l1 = 0\n l2 = 0\n name = \">test\"\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts hxb2_ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n\n begin\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n if ref_size > 1.3*(seq.size)\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n max_seq = aln_test2.scan(/[ACGT]+/).max_by(&:length)\n aln_test2 =~ /#{max_seq}/\n before_aln_seq = $`\n before_aln = $`.size\n post_aln_seq = $'\n post_aln = $'.size\n before_aln_seq_size = before_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b1 = (1.3 * before_aln_seq_size).to_i\n post_aln_seq_size = post_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b2 = (1.3 * post_aln_seq_size).to_i\n if (before_aln > seq.size) and (post_aln <= seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1)]\n l1 = l1 + (before_aln - b1)\n elsif (post_aln > seq.size) and (before_aln <= seq.size)\n ref = ref[before_aln..(ref_size - post_aln - 1 + b2)]\n l2 = l2 + post_aln - b2\n elsif (post_aln > seq.size) and (before_aln > seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1 + b2)]\n l1 = l1 + (before_aln - b1)\n l2 = l2 + (post_aln - b2)\n end\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n end\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n\n if g1 == g2 and (s1 + g1 + s2) == ref.size\n if s1 > s2 and g2 > 2*s2\n ref = ref[0..(-g2-1)]\n repeat = 1\n l2 = l2 + g2\n elsif s1 < s2 and g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n else\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n\n while repeat == 1\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n #refine alignment\n\n if ref =~ /^(\\-+)/\n l1 = l1 - $1.size\n elsif ref =~ /(\\-+)$/\n l2 = l2 + $1.size\n end\n\n if (hxb2_l - l2 - 1) >= l1\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n ref_size = ref.size\n sim_count = 0\n (0..(ref_size-1)).each do |n|\n ref_base = ref[n]\n test_base = aln_test[n]\n sim_count += 1 if ref_base == test_base\n end\n similarity = (sim_count/ref_size.to_f*100).round(1)\n print `rm -f #{temp_file}`\n print `rm -f #{temp_aln}`\n loc_p1 = l1 + 1\n loc_p2 = hxb2_l - l2\n if seq.size != (loc_p2 - loc_p1 + 1)\n indel = true\n elsif aln_test.include?(\"-\")\n indel = true\n else\n indel = false\n end\n return [loc_p1,loc_p2,similarity,indel,aln_test,ref]\n else\n return [0,0,0,0,0,0,0]\n end\n rescue\n print `rm -f #{temp_file}`\n print `rm -f #{temp_aln}`\n return [0,0,0,0,0,0,0]\n end\nend", "def genStr strLen\nsortedAlphabet = @alphabet.sort\nresultStrs = [ ]\ntestStrings = [ ]\ntestStrings[0] = []\ntestStrings[0].push \"\"\n1.upto(strLen.to_i) { |x|\ntestStrings[x] = []\ntestStrings[x-1].each { |s|\nsortedAlphabet.each { |c|\ntestStrings[x].push s+c\n}\n}\n}\ntestStrings.flatten.each { |s|\nresultStrs.push s if accept? s, @start\n}\nresult = \"\"\nresultStrs.each { |x| result.concat '\"'+x+'\" ' }\nresult\nend", "def longest_prefix(strings)\n\n # Assign relevant variables\n winning_ticket = \"\"\n i = 0 \n fastest_furthest = strings[0][i]\n\n # Account for non-nil values and return method result \n while fastest_furthest != nil\n strings.each do |string|\n unless string[i] == fastest_furthest\n return winning_ticket\n end \n end \n winning_ticket += fastest_furthest\n i += 1\n fastest_furthest = strings[0][i]\n end\n return winning_ticket\nend", "def bmAltGoodSuffixTable(pattern)\n pattern = pattern.unpack('U*')\n goodSuffix = []\n pattern.length.times do |i| \n value=0 \n while (value < pattern.length && !suffixmatch(pattern, i, value)) do \n value+=1 \n end \n goodSuffix[pattern.length-i-1] = value \n end \n return goodSuffix\nend", "def genome(liszt)\n=begin\n[samopen] SAM header is present: 2 sequences\n7621912 reads; of these:\n 4009241 (52.60%) were paired; of these:\n 1983557 (49.47%) aligned concordantly 0 times\n 1818685 (45.36%) aligned concordantly exactly 1 time\n 206999 (5.16%) aligned concordantly >1 times\n ----\n 1983557 pairs aligned concordantly 0 times; of these:\n 409503 (20.64%) aligned discordantly 1 time\n ----\n 1574054 pairs aligned 0 times concordantly or discordantly; of these:\n 3148108 mates make up the pairs; of these:\n 1009275 (32.06%) aligned 0 times\n 35392 (1.12%) aligned exactly 1 time\n 2103441 (66.82%) aligned >1 times\n 3612671 (47.40%) were unpaired; of these:\n 498719 (13.80%) aligned 0 times\n 2246121 (62.17%) aligned exactly 1 time\n 867831 (24.02%) aligned >1 times\n=end\n #puts(liszt);exit\n dict={}; liszt.shift\n dict[\"total\"]=liszt.shift.split[0]; #liszt.shift\n dict[\"paired\"]=liszt.shift.split[0]; liszt.shift #conc 0\n dict[\"conc_once\"]=liszt.shift.split[0]\n dict[\"conc_mult\"]=liszt.shift.split[0]\n liszt.shift(2); dict[\"disc_once\"]=\"\"; dict[\"disc_mult\"]=\"\"\n line=liszt.shift\n line.include?(\">1 times\") ? dict[\"disc_mult\"]=line.split[0] : dict[\"disc_once\"]=line.split[0]\n liszt.shift\n dict[\"unaligned_pairs\"]=liszt.shift.split[0]\n liszt.shift\n dict[\"unmates\"]=liszt.shift.split[0] #unaligned mates\n dict[\"mate_once\"]=liszt.shift.split[0]\n dict[\"mate_mult\"]=liszt.shift.split[0]\n dict[\"unpaired\"]=liszt.shift.split[0]\n dict[\"unpair_unaligned\"]=liszt.shift.split[0]\n dict[\"unpair_once\"]=liszt.shift.split[0]\n dict[\"unpair_mult\"]=liszt.shift.split[0]\n dict\nend", "def sdrm_int(aa_array,start_aa=1)\n out_hash = {}\n sdrm = {}\n sdrm[66] = ['T',['A','I','K']]\n # sdrm[68] = ['L',['V']] not included any more\n sdrm[74] = ['L',['M']]\n sdrm[92] = ['E',['Q']]\n sdrm[95] = ['Q',['K']]\n sdrm[97] = ['T',['A']]\n sdrm[121] = ['F',['Y']]\n sdrm[140] = ['G',['A','S','C']]\n sdrm[143] = [\"Y\",[\"C\",\"H\",\"R\"]]\n sdrm[147] = ['S',['G']]\n sdrm[148] = ['Q',['H','K','R']]\n sdrm[155] = ['N',['S','H']]\n aa_length = aa_array.size\n end_aa = start_aa + aa_length - 1\n (start_aa..end_aa).each do |position|\n array_position = position - start_aa\n if sdrm.keys.include?(position)\n wt_aa = sdrm[position][0]\n test_aa = aa_array[array_position]\n if test_aa.size == 1\n unless wt_aa == test_aa\n if sdrm[position][1].include?(test_aa)\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n else\n test_aa_array = test_aa.split(\"/\")\n if (test_aa_array & sdrm[position][1])\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n\n end\n end\n return out_hash\nend", "def detective(incoming)\n#Declare an empty string to find ordinal number of the given string and return it at the end\n\tincoming_ord = 0\n# If the incoming is not empty run the following code:\n\tif incoming.length!=0\n# using .ord find ordinal number of given string\n\t\t for i in 0...incoming.length \n\t\t incoming_ord+= incoming[i].ord \n\t\t end\n\tputs incoming.swapcase\n\tputs incoming.prepend(\"Hi \")\n\tputs incoming.chop!\n\tputs incoming.delete(\"aeiou\")\n\tputs incoming.count(\"a\")\n\tp incoming.squeeze\n\tputs incoming.upcase\n\tp incoming.center(40,\" \" )\n puts incoming.replace(\"Johny\")\n\n #if the incoming is empty print the following code\n else \n\tputs\"It's an empty string\"\n end \n\treturn puts\" The ordinal number for the original string is #{incoming_ord}\"\nend", "def schumann; end", "def expand(s)\n\n# change <> diamond bracket and -\nif s =~ /<(\\d+)-(\\d+)>/\ns.gsub!(\"<\",\"{\")\ns.gsub!(\">\",\"}\")\ns.gsub!(\"-\",\"..\")\nelse\nend\n\n# change ?,?,? (numbers) to ?..?\nif s =~ /(,\\d+)+(?=(,\\d+))/ \n s.gsub!(/(,\\d+)+(?=(,\\d+))/,\"..\")\n \n if s =~ /,(\\d+)/\n s.gsub!(/,/,\"\")\n\n else\n end\n else\n end\n\n STDERR.puts s + \"second\"\n\n # change 16,17 to 16..17\n if s =~ /\\{(\\d+),(\\d+)\\}/\n s.gsub!(/\\{(\\d+),(\\d+)\\}/,\"{\"+$1+\"..\"+$2+\"}\")\n else\n end\n\n STDERR.puts s + \"third\"\n STDERR.puts \"START EXPANSION\"\n # start doing the expansion\n s.gsub!(/{(-?\\w+)..(-?\\w+)(..(\\d+))?}/){x,y=$1,$2;a,b,c=[x,y,$4].map &:to_i\n $1[/\\d/]?0:(a,b=x,y)\n k=a<b ?[*a..b]:[*b..a].reverse\n ?{+0.step(k.size-1,$4?c:1).map{|i|k[i]}*?,+?}}\n r=1\n t=->x{x[0].gsub(/^{(.*)}$/){$1}.scan(/(({(\\g<1>|,)*}|[^,{}]|(?<=,|^)(?=,|$))+)/).map{|i|i=i[0];i[?{]?r[i]:i}.flatten}\n r=->x{i=x.scan(/({(\\g<1>)*}|[^{} ]+)/).map(&t)\n i.shift.product(*i).map &:join}\n\n STDERR.puts \"split array\"\n arr = s.split.map(&r).flatten\n STDERR.puts \"print array\"\n STDERR.puts arr\n\n\n STDERR.puts \"check the last case\"\n # deal with the last case\n\n if s=~ /({.+}){3,}/\n #arr1 = arr.select{|str| str.include?(\"i\")} \n #arr2 = arr.select{|str| str.include?(\"j\")}\n #arr3 = arr.select{|str| str.include?(\"k\")}\n STDERR.puts \"inside\"\n #ending = [arr1,arr2,arr3].reduce([], :concat)\n\n ALPHABET = \"abcdefghijklmnopqrstuvwxyz\"\n\n arr.sort_by! do |word|\n word.split('').map do |letter|\n ALPHABET.index(letter)\n end\n end\n\n STDERR.puts \"after sorting\"\n STDERR.puts arr\n else\n end\n\n STDERR.puts \"final array\"\n #STDERR.puts ending\n return arr\n\n\n\n end", "def find_params(fonts)\n 1.upto(9) do |d|\n 2.times do\n 1.upto(999) do |u|\n 1.upto(999) do |v|\n if fonts.all? {|f| solve_identity(u, v, f + d) }\n table = fonts.map do |f|\n solve_identity(u, v, f + d).reverse\n end.transpose.flatten.map {|c| c.chr }.join\n return u, v, d, table\n end\n end\n end\n d = -d\n end\n end\n puts \"Not found.\"\n exit\nend", "def rest_positionals; end", "def trd; end", "def deco_pos; end", "def collection_order(items) #nicer collection method - the unnecessary loops and arrays. (task 6)\n\n item_indexes = []\n collection_order = []\n\n for item in items\n item_indexes << find_index_at_value(item)\n end\n\n sorted_indexes = item_indexes.sort\n\n for index in sorted_indexes\n collection_order = collection_order << WAREHOUSE[index].keys[0].to_s\n end\n\nreturn collection_order\n\nend", "def create_ordered_output_from_format_string(f,u,c,i)\n found = Hash.new\n found[\"u\"] = f.index(/(%[\\-\\.0-9]*u[0-9]*)/)\n found[\"c\"] = f.index(/(%[\\-\\.0-9]*c[0-9]*)/)\n found[\"i\"] = f.index(/(%[\\-\\.0-9]*i[0-9]*)/)\n positions = Array.new\t\n positions[f.index(/(%[\\-\\.0-9]*u[0-9]*)/)] = u if !found[\"u\"].nil?\n positions[f.index(/(%[\\-\\.0-9]*c[0-9]*)/)] = c if !found[\"c\"].nil?\n positions[f.index(/(%[\\-\\.0-9]*i[0-9]*)/)] = i if !found[\"i\"].nil?\n positions.compact!\n positions\nend", "def gounod; end", "def romeo_and_juliet; end", "def build_new_string(a, count)\n g_value = lambda {|h| [h.keys[0]][0]}\n high_char = find_higher(a)\n low_char = find_low(a * 1, high_char)\n\n result = []\n k = 1\n\n while k <= count.reduce(&:+) #a.any?{|values| a.values[0] != 0}\n if k.odd?\n result.push(high_char.keys[0])\n high_char[g_value.call(high_char)] = high_char.values[0] - 1\n else\n result.push(low_char.keys[0])\n low_char[g_value.call(low_char)] = low_char.values[0] - 1\n end\n\n high_char = find_higher(a) if high_char.values[0] == 0\n low_char = find_low(a * 1, high_char) if low_char.values[0] == 0\n\n k += 1\n end\n\n result\nend", "def verdi; end", "def ismn; end", "def pos() end", "def pos() end", "def pos() end", "def pos() end", "def king_richard_iii; end", "def movingShift(s, shift)\nres = ''\n s.chars.each do |x|\n ord = x.ord\n if x.ord > 64 && x.ord < 91\n ord = ((ord - 65 + shift) % 26) + 65\n else\n if x.ord > 96 && x.ord < 123\n ord = ((ord - 97 + shift) % 26) + 97\n end\n end\n shift+=1\n res += ord.chr\n end\n l = (res.length/5.0).ceil\nputs l\nputs res\n [res[0..l-1], res[l..2*len-1],res[2*l..3*l-1],res[3*l..4*len-1],res[4*l..-1]]\nend", "def identify; end", "def sdrm_nrti(aa_array,start_aa=1)\n out_hash = {}\n sdrm = {}\n sdrm[41] = ['M',['L']]\n sdrm[65] = ['K',['R']]\n sdrm[67] = ['D',['N','G','E']]\n sdrm[69] = ['T',['D']]\n sdrm[70] = ['K',['R','E']]\n sdrm[74] = ['L',['V','I']]\n sdrm[75] = ['V',['M','T','A','S']]\n sdrm[77] = ['F',['L']]\n sdrm[115] = ['Y',['F']]\n sdrm[116] = ['F',['Y']]\n sdrm[151] = ['Q',['M']]\n sdrm[184] = ['M',['V','I']]\n sdrm[210] = ['L',['W']]\n sdrm[215] = [\"T\",[\"Y\",\"F\",\"I\",\"C\",\"D\",\"V\",\"E\",\"S\"]]\n sdrm[219] = [\"K\",[\"Q\",\"E\",\"N\",\"R\"]]\n aa_length = aa_array.size\n end_aa = start_aa + aa_length - 1\n (start_aa..end_aa).each do |position|\n array_position = position - start_aa\n if sdrm.keys.include?(position)\n wt_aa = sdrm[position][0]\n test_aa = aa_array[array_position]\n if test_aa.size == 1\n unless wt_aa == test_aa\n if sdrm[position][1].include?(test_aa)\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n else\n test_aa_array = test_aa.split(\"/\")\n if (test_aa_array & sdrm[position][1])\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n\n end\n end\n return out_hash\nend", "def lcts(array)\nend", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def diff2; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def translate(a)\n\tvoyel = [\"a\",\"e\",\"i\",\"o\",\"u\"]\ncheck = 0\nn = 0\nx = a \n words = a.split(/\\W+/)\n words.each do |a|\n\tok = voyel.include?(a[0])\n\tif ok == true \n\t\ta = a + \"ay\"\n\t\treturn a \n\tend\n while check <= 4\n\tb = a.slice(0..check)\n\n\tcheck = check + 1\n \n\tok = voyel.include?(x[check])\n\ttest1 = \"qu\".include?(x[check])\n\tif test1 == true \n\t\tif check == 1\n\t\t\tb = a.slice(0..check)\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[2..-1]\n\t elsif check == 2\n\t \tb = a.slice(1..check)\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[4..-1]\n\t end\n\tend\n\n\tif ok == true \n\t\tif check == 1\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[1..-1]\n\t elsif check == 2\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[2..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t end\n\tend\nend\nend\nend", "def gettrys(tcoords)\n # Indexa coordenadas de las lineas con menor incognitas\n p \"hmiss............\"\n p tcoords[:hmiss]\n hlower_c = lowerabsent(tcoords[:hmiss]) # [{:hindex=>x, :coords=> [[]]\n vlower_c = lowerabsent(tcoords[:vmiss],\"v\") # [{:vindex=>x, :coords=>[[]]\n slower_c = lowerabsent(tcoords[:smiss],\"s\") # [{:sindex=>x, :coords=>[[]]\n\n # combierte las coordenadas en numeros -> contiene menor incognitas\n hlower_n = hlower_c.collect {|line| missto_n(line[:hindex])} # [{:hindex=>0, :numbers=>[3, 4]}, x]\n vlower_n = vlower_c.collect {|line| missto_n(line[:vindex],tcoords[:vwhole], \"v\")} # [{:vindex=>0, :numbers=>[3, 4]}, x]\n #slower_n = slower_c.collect {|line| missto_n(line[:sindex], tcoords[:swhole], \"s\")} # [{:sindex=>2, :numbers=>[4, 6, 8]}, x]\n p \"****** H vs V *******\"\n p hlower_c.length < vlower_c.length ? \"h < v\" : \"h > v\"\n # cantidad de incognitas decide si se usa h o v\n p lower_c = hlower_c.length < vlower_c.length ? hlower_c : vlower_c\n lower_n = lower_c[0].keys[0][0] == \"h\" ? hlower_n : vlower_n\n # le pone cuadro a cada coord y separa coordenadas, una por linea\n hvindex_sindex_coords = locatecoord_onsquere(lower_c, tcoords[:swhole])\n sqr_n = hvindex_sindex_coords.collect {|item| missto_n(item[:sindex], tcoords[:swhole],\"s\")}\n # buscar que sqr tiene menos coincidencias\n hvindex_sindex_coords.collect { |main|\n main[:sqr_options] = sqr_n.collect {|numbers| numbers[:numbers] if main[:sindex] == numbers[:sindex] }.compact.flatten\n main[:options] = lower_n.collect {|numbers| numbers[:numbers] if main[main.keys[0]] == numbers[numbers.keys[0]] }.compact.flatten\n main[:reduce] = main[:options] - ([1,2,3,4,5,6,7,8,9] - main[:sqr_options])\n\n }\n # numbers[:numbers] if main[main.keys[0]] == numbers[numbers.keys[0]]\n result = hvindex_sindex_coords.group_by {|g| g[:reduce].length}\n\n p \"*******start Result\"\n reduce_index = result.collect {|x,y| x }.min\n result[reduce_index].map {|e| p e} # inspect\n result[reduce_index].map do |item|\n\n case item.keys[0][0]\n when \"h\"\n if item[:reduce].length == 1\n x = item[:coord][0]\n y = item[:coord][1]\n @tbls[:notformated][x][y] = item[:reduce][0]\n @tbls[:formated][x][y] = formato(@tbls[:notformated][x][y].to_s,:red, :yellow)\n elsif item[:reduce].length > 1\n # Pregunta en linea vertical\n end\n when \"v\"\n p \"################## - caso vertical pendiente - ###################\"; exit\n end\n\n end\n\n end", "def num_decodings(s)\n\n decode = ('A'..'Z').to_a\n number_of_prev_ended_singly = 1\n\n ways_count = 1\n number_of_prev_ended_singly = 1\n\n s.chars[1..-1].each_with_index do |ch, idx|\n if s[idx - 1].to_i == 1 ||\n s[idx - 1] == 2.to_i && ch.to_i.between?(1,6)\n\n numbers_added_this_time = ways_count - number_of_prev_ended_singly\n ways_count += numbers_added_this_time\n number_of_prev_ended_singly = numbers_added_this_time\n else\n number_of_prev_ended_singly = 0\n end\n end\n\n ways_count\n\nend", "def required_positionals; end", "def alias_creator (str)\n# downcase all characters incase the name had initial caps.\nstr = str.downcase\t\n\n# create vowel string for cross checking each character (I ADDED 3 REPEATING VOWEL SEGMENTS TO PREVENT EDGE CASE FROM BREAKING WHEN ENCODING A VOEWEL AT THE END OF THE STRING LIKE U in \"AEIOU\") \nvowels = \"aeiouaeiouaeiou\"\n# create consonant string for cross checking each character\nconsonants = \"bcdfghjklmnpqrstvwxz\"\n# create empty strings that encoded first and last names will be stored in.\nname_alias = \"\"\n# create empty string to create an encoded full name \nspy_alias = \"\"\n=begin encoding names \n 1.taking the first name string and iterate through each character \n 2. check if vowels string includes current character in first name string\n 3. if it does access the letter in vowels string by its index, increment that index by one\n add that new letter to the alias string. \n 4. if the current character is a consonant it will go through the same process but using the consonants string\n 5. if the current character is a space a space will be added to the encoded string. \n=end\n \n str.each_char do |char| \n \tif char == \" \"\n name_alias+= \" \"\n\n \telsif vowels.include?(char)\n \t\tname_alias += vowels[vowels.index(char).next]\n \n elsif consonants.include?(char)\n \tname_alias += consonants[consonants.index(char).next]\n\n \n\n end \n \t\n end\n # check if the string that was encoded was a full name or just a first or last name\n # if it is a full name. sperate the first and last name and reverse the order (Lastname Firstname)\n \n if name_alias.include?(\" \")\n swap_name = name_alias.split(\" \")\n spy_alias = swap_name[1] + \" \" +swap_name[0]\n else spy_alias = name_alias\n end \n \n \n return spy_alias\n\n\nend", "def find_small_set_of_string_in_large_string( large_string, small_string_set)\n \n #create and array of size L,\n small_string_size = small_string_set[0].size\n window_array = []\n \n (0..small_string_size-1).each do |index|\n window_array[index] = {}\n end\n \n #build dthe window array as we look a all the small string in a set\n small_string_set.each do |str|\n (0..str.size - 1).each do |index|\n if !window_array[index].has_key? str[index] \n #create new hash\n window_array[index][str[index]]={}\n end\n window_array[index][str[index]][str] = str\n end\n end\n\n all_found = []\n (0..large_string.size - small_string_size).each do |window_start|\n found_set = []\n first_set = true\n qualified_length = 0\n\n (window_start..window_start + small_string_size -1 ).each do |index|\n \n #puts \"String start at index #{window_start} '#{\"\"<<large_string[window_start]}'\"\n \n if window_array[ index - window_start ].has_key? large_string[index ]\n if first_set \n window_array[ index - window_start ][large_string[index]].each do |key, val|\n found_set.push(key)\n end\n first_set = false\n else\n window_array[ index - window_start ][large_string[index]].each do |key, val|\n if !found_set.include? key\n found_set.delete(key)\n end\n end\n end\n qualified_length += 1 if !found_set.empty? #suvire from the delete, increase the qualified lenghth\n elsif first_set == false and found_set.empty?\n #puts \"stop examing 1\"\n break\n else\n #puts \"stop examing 2 -- #{window_start.to_s} #{index.to_s}\"\n break\n end\n end #end of exampling each slow of the window\n #only print and save qualify string\n #p qualified_length , window_array.size\n if qualified_length == window_array.size\n all_found = all_found | found_set\n \n #puts \"Found:\" + found_set.join(\",\")\n end\n \n end\n #p window_array\n return all_found\nend", "def find_missing_letter(range)\nsplit_range = []\nsplit_range = range.split(//)\narray = []\n\nrange_two = (split_range[0]..split_range[-1]).to_a\narray << range_two - split_range\n\n if array.length > 0\n p array.join\n else\n p nil\n end\nend", "def tr_s(p0, p1) end", "def user_os_complex\r\n end", "def pirates_say_arrrrrrrrr(string)\nz = \"\"\nstring.split(\"\").each_index{|x| z << string[x+1] if string.downcase[x] == \"r\" && string[x+1] != nil }\nz\nend", "def silly_adjective; end", "def Text2Words(txt, len, where, offset)\n txt.each do |words|\n print \" { { \" \n words.each do |word|\n if word==\"ET\" then\n pos = where.index(\"TERTAUQ\")\n else\n pos = where.index(word.reverse) || where.index(word) \n end\n print \" { %3d, %2d }, \" % [pos+offset, word.length ]\n end\n (len - words.length).times do\n print \" { %3d, %2d }, \" % [0, 0 ]\n end\n puts \" } }, // \" + words.join(\" \")\n end\nend", "def transformations; end", "def too_complex; end", "def num_decodings(s)\n i1, i2 = 1\n count = 0\n (1..s.size).each do |i|\n# s[i-1, 1] i- 1 is position & 1 is how many ele's you want \n count = s[i-1,1] != '0' ? i1 : 0 # if previous was not 0 set to i1\n count += i2 if s[i - 2, 2].between?('10', '26') && i > 1\n i2 = i1\n i1 = count\n end\n count\nend", "def parslet; end", "def parslet; end", "def parslet; end", "def parslet; end", "def hiss; end", "def transform; end", "def banana(name)\n\n# For names that start with vowels\nif name.downcase.start_with?('a','e','i','o','u')\n mod_name = name.downcase\n# For names that begin with a 2-letter consonant cluster\nelsif name.downcase.start_with?('bl', 'br', 'cl', 'cr', 'dr', 'fl', 'fr', 'gl', 'gr', 'pl', 'pr', 'sc', 'sk', 'sl', 'sm', 'sn', 'sp', 'st', 'sw', 'th', 'tr', 'ch')\n mod_name = name.slice(2..-1)\n# For names that begin with a 3-letter consonant cluster\nelsif name.downcase.start_with?('chr', 'thr', 'sch', 'scl', 'scr', 'shr', 'spl', 'spr', 'str', 'squ')\n mod_name = name.slice(3..-1)\n# For all other names\nelse\n mod_name = name.downcase.slice(1..-1)\nend\n\nif name.downcase == \"orange\"\n\tputs \"Nothing rhymes with orange.\"\nelse\nputs name.capitalize + \", \" + name.capitalize + \", bo-\" + (name.downcase.start_with?('b') ? mod_name.downcase.slice(0..-1) : \"b\"+mod_name) + \" \\r\\n\" + \n\"Banana-fana fo-\" + (name.downcase.start_with?('f') ? mod_name.downcase.slice(0..-1) : \"f\"+mod_name) + \" \\r\\n\" + \n\"Fee-Fi-mo-\" + (name.downcase.start_with?('m') ? mod_name.downcase.slice(0..-1) : \"m\"+mod_name) + \" \\r\\n\" + \nname.upcase + \"!\"\nend\n\nend", "def ConvertSplits( l, r )\n if( l == r )\n return ?A.ord + l\n else\n s = $splitPositions[ l ][ r ]\n iL = $gcds[ l ][ l + s ] / $gcds[ l ][ r ]\n iR = $gcds[ l + s + 1 ][ r ] / $gcds[ l ][ r ]\n\n # Don't display 1 to reduce confusion\n if( iL == 1 )\n iL = \"\"\n end\n if( iR == 1 )\n iR = \"\"\n end\n\n return \"(#{iL}\" << ConvertSplits( l, l + s ) << \")(#{iR}\" << ConvertSplits( l + s + 1, r ) << \")\"\n end\nend", "def parts; end", "def parts; end", "def parts; end", "def tryContent(tryArray, dominosArray) \n top = \"\"\n bottom = \"\"\n i=1\n while (tryArray[i] != nil)\n top += dominosArray[ (tryArray[i]) ][0]\n bottom += dominosArray[ (tryArray[i]) ][1]\n i += 1\n end\n if(top == bottom)\n puts \"String Match:\"\n puts \"#{top} #{bottom}\"\n print \"Combination: \"\n tryArray.each {|x| print x, \",\" if (x!=0) }\n $found -= 1\n return\n end\n \nend", "def commonChild(s1, s2)\n arr_s1 = s1.split(//)\n arr_s2 = s2.split(//)\n common = arr_s1 & arr_s2\n if common.length != 0\n s1_com = []\n s2_com = []\n arr_s1.each do |s1|\n if common.include?(s1)\n s1_com << s1\n end\n end\n arr_s2.each do |s2|\n if common.include?(s2)\n s2_com << s2\n end\n end\n row = [0]*(s2_com.size+1)\n for i in 1..s1_com.size\n column = [0]\n for j in 1..s2_com.size\n column.push s1_com[i-1] == s2_com[j-1] ? row[j-1]+1 : [column[j-1], row[j]].max\n end\n row = column\n end\n return row[-1]\n else\n return 0\n end\n # create first liine\n # row = [0]*(s1.size+1)\n # for i in 1..s1.size\n # column = [0]\n # for j in 1..s2.size\n # column.push s1[i-1] == s2[j-1] ? row[j-1]+1 : [column[j-1], row[j]].max\n # end\n # row = column\n # end\n # return row[-1]\n # # arr_s1 = s1.split(//)\n # # arr_s2 = s2.split(//)\n # common = arr_s1 & arr_s2\n # if common.length != 0\n # s1_com = []\n # s2_com = []\n # arr_s1.each do |s1|\n # if common.include?(s1)\n # s1_com << s1\n # end\n # end\n # arr_s2.each do |s2|\n # if common.include?(s2)\n # s2_com << s2\n # end\n # end\n # com_length = Array.new(s1_com.length, Array.new(s2_com.length, 0))\n # p com_length\n # com_length[0][1] = 'A'\n # com_length[1][1] = 'C'\n # com_length[1][0] = 'B'\n # p com_length[1][1]\n # s1_com.each_with_index do |s1,i|\n # s2_com.each_with_index do |s2, j|\n # if i == 0\n # if s1 == s2\n # com_length[i][j] = 1\n # else\n # if j != 0\n # if com_length[i][j-1] != 0\n # com_length[i][j] = com_length[i][j-1]\n # end\n # end\n # end\n # else\n # if j == 0\n # if s1 == s2\n # com_length[i][1] = 1\n # end\n # else\n # if s1 == s2\n # com_length[i][j] = com_length[i-1][j-1] + 1\n # else\n # if com_length[i-1][j] != 0 && com_length[i][j-1] != 0\n # com_length[i][j] = [com_length[i-1][j], com_length[i][j-1]].max\n # elsif com_length[i-1][j] != 0\n # com_length[i][j] = com_length[i-1][j]\n # elsif com_length[i][j-1] != 0\n # com_length[i][j] = com_length[i][j-1]\n # end\n # end\n # end\n # end\n # end\n # end\n # rs = 0\n # p com_length\n # com_length.each do |r|\n # if r.max > rs\n # rs = r.max\n # end\n # end\n # return rs\n # else\n # return 0\n # end\nend", "def sluggish_octopus(fishes) \n fishes.each_with_index do |fish1, i1|\n max_length = true\n fishes.each_with_index do |fish2, i2|\n next if i1 == i2\n # puts \"#{fish1} --- #{fish2}\"\n max_length = false if fish1.length < fish2.length\n end\n\n return fish1 if max_length == true\n end\nend", "def magic_numbers(count)\nend", "def ignores; end", "def suivre; end", "def getPep (cds, seq)\n\nend", "def minimumBribes(q)\n cont = 0\n for i in (q.size-1).downto(2)\n #p \" (#{i}) ==> #{q}\"\n if !v(q,i)\n cont = \"Too chaotic\"\n break\n elsif q[i]-1 != i\n if q[i-1]-1 == i \n aux = q[i]\n q[i] = q[i-1]\n q[i-1] = aux\n else\n aux = q[i]\n q[i] = q[i-2]\n q[i-2] = q[i-1]\n q[i-1] = aux\n cont += 1 \n end\n cont += 1 \n end\n end\n printf \"%s\\n\", q[0] != 1 && cont != \"Too chaotic\" ? cont+1 : cont\nend", "def guess(span, mode = T.unsafe(nil)); end", "def match(p0) end", "def match(p0) end", "def find_smallest_subsequence(text, pattern)\n puts \"text= #{text}; pattern= #{pattern}\"\n beginPtr, minBeginPtr, endPtr, minEndPtr = 0, 0, text.length-1, -1\n hasFound = Hash.new(0)\n needToFind = Hash.new(0)\n counter, windowLen, minWindowLen = 0,0,-1\n\n pattern.chars.each { |c| needToFind[c] += 1 }\n\n text.chars.each_with_index do |c, idx| \n endPtr = idx\n # puts \"looking at text char #{c}; beginPtr= #{beginPtr}; endPtr=#{endPtr}\"\n\n if needToFind.has_key?(c)\n hasFound[c] += 1\n if hasFound[c] <= needToFind[c]\n counter += 1 \n end\n\n ch = text.chars[beginPtr] \n if counter == pattern.length \n\n # puts \"hasFound= #{hasFound.inspect}\"\n # puts \"ch= #{ch}; beginPtr= #{beginPtr}; endPtr=#{endPtr}\"\n\n while hasFound[ch] > needToFind[ch] || needToFind[ch] == 0\n # puts \"hasFound[#{ch}] = #{hasFound[ch]}; needToFind[#{ch}] = #{needToFind[ch]}\"\n\n unless needToFind[ch] == 0\n hasFound[ch] -= 1 if hasFound.has_key?(ch)\n # puts \"changing ptrs; beginPtr= #{beginPtr}; endPtr=#{endPtr}; hasFound= #{hasFound.inspect}\"\n end\n beginPtr = beginPtr + 1 \n ch = text.chars[beginPtr] \n end\n windowLen = endPtr - beginPtr + 1\n # print \"Found the current minWindow ==> beginPtr= #{beginPtr}; endPtr=#{endPtr}; windowLen= #{windowLen}; minWindowLen= #{minWindowLen}\"\n if minWindowLen == -1 || windowLen < minWindowLen\n minWindowLen = windowLen \n minBeginPtr = beginPtr\n minEndPtr = endPtr\n end\n # print \" was changed to minWindowLen= #{minWindowLen}\"\n # puts \"\\n\\n\"\n end\n\n end\n end\n return ['none', 'none', 'none'] if minEndPtr == -1\n return [minBeginPtr, minEndPtr, text[minBeginPtr..minEndPtr]]\nend", "def preProcess(s)\n n = s.length().to_i\n if n==0\n return \"^$\"\n end\n ret = \"^\"\n (0..n-1).each do |re|\n ret += ('#' + s[re].to_s)\n end\n ret += '#$'\n return ret\nend", "def extractFunctionMeta(line)\n res = \"\"\n numret = 0\n if line.include? '('\n mindex = line.index('(')\n sindex = line.index(')')\n res = line[3..(mindex - 1)]\n numret = line[(mindex - 1)..(sindex - 1)].length\n else\n spindex = (line.strip[3..line.length]).strip.index(' ')\n if spindex != nil\n res = line[3..spindex]\n numret = 2\n else\n res = line[3..line.length]\n numret = 0\n end\n end\n return res.strip, numret\nend", "def villian; end", "def find_missing_letter(arr)\n #your code here\n result = 0\n base_arr = arr.join().codepoints\n base_arr.each_with_index do |item,index|\n if base_arr[index+1] != item + 1\n result = item + 1\n break\n end\n end\n result.chr\nend", "def spy_alias2 full_name\n alphabet = {\n vowels: ['a','e','i','o','u'],\n consonants: ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n }\n alias_name = full_name.downcase.split(' ').reverse!.join(' ').split(//)\n alias_name.map! do |letter|\n next_letter=letter\n if alphabet[:vowels].include?(letter)\n index=alphabet[:vowels].index(letter)\n if letter==alphabet[:vowels][-1]\n next_letter=alphabet[:vowels][0]\n else\n next_letter=alphabet[:vowels][index+1]\n end\n elsif alphabet[:consonants].include?(letter)\n index = alphabet[:consonants].index(letter)\n if letter==alphabet[:consonants][-1]\n next_letter=alphabet[:consonants][0]\n else\n next_letter=alphabet[:consonants][index+1]\n end\n end\n next_letter\n end\n alias_name=alias_name.join('').split(' ').map! {|name| name.capitalize}.join(' ')\nend", "def names_two(names)\n\t\tnames.map{ |i| %Q('#{i}') }.join(',')\n\t\tnames = names.map(&:capitalize)\n\t\tlittle_array = []\n\t\tsets = names.shuffle\n\tif names.length % 2 == 0\n\t\ta = names.length/2\n\t\ta.times do \n\t\tsets_1 = sets.pop(2).to_a\n\t\tlittle_array << sets_1\n\t\tset_1 = 0\n\tend\n\n\telse \n\t\textra = sets.pop\n\t\tb = names.length/2\n\t\tb.times do \n\t\tsets_1 = sets.pop(2).to_a\n\t\tlittle_array << sets_1\n\t\tset_1 = 0\n\tend\n\tlittle_array[0] << extra\nend\nclean_array = clean(little_array)\np clean_array\nend", "def cutinfo(string)\n inf=/\\024/=~string1\n inf=inf+2\n trans=string1[inf..-1]\nend", "def nonstriker_perimartium(pronunciation_crotched)\n end" ]
[ "0.55222267", "0.5253322", "0.5247037", "0.5245344", "0.52333957", "0.5209013", "0.5171067", "0.5133766", "0.50971305", "0.5078304", "0.5058504", "0.5055896", "0.50149393", "0.49791473", "0.4974453", "0.49652758", "0.4925356", "0.4924265", "0.491668", "0.49029976", "0.48938602", "0.48864517", "0.48821414", "0.4878203", "0.48741654", "0.48692366", "0.48640674", "0.48618868", "0.48464325", "0.48390716", "0.48340738", "0.4827998", "0.48278454", "0.48209706", "0.48145518", "0.48142993", "0.48142993", "0.48142993", "0.48142993", "0.48078957", "0.47966805", "0.47840872", "0.4782139", "0.47811368", "0.4780565", "0.4780565", "0.4780565", "0.4780565", "0.4780565", "0.4780565", "0.47748414", "0.4771201", "0.4771201", "0.4771201", "0.4771201", "0.47666892", "0.47619852", "0.4751885", "0.4749005", "0.47464824", "0.4740964", "0.4729987", "0.470993", "0.4706441", "0.47004545", "0.46971777", "0.46958402", "0.46948066", "0.46917558", "0.4687196", "0.46852112", "0.46852112", "0.46852112", "0.46852112", "0.4683217", "0.46770933", "0.467185", "0.466978", "0.46666792", "0.46666792", "0.46666792", "0.4662645", "0.46623302", "0.46587485", "0.46562007", "0.4653997", "0.46532997", "0.4651353", "0.46492702", "0.46465504", "0.46427134", "0.46427134", "0.4642249", "0.46416488", "0.46396708", "0.46282378", "0.46215385", "0.4618487", "0.46154803", "0.46141034", "0.4612931" ]
0.0
-1
Named as in p with a ^ (hat). Not phat as in fat.
def phat @phat ||= 1.0 * positive/total end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ^(p0) end", "def ^(p0) end", "def ^(p0) end", "def ^(p0) end", "def ^(p0) end", "def ^(arg0)\n end", "def ^(arg0)\n end", "def ^(arg0)\n end", "def |(p0) end", "def |(p0) end", "def |(p0) end", "def |(p0) end", "def |(p0) end", "def |(p0) end", "def prefix!( *pf )\r\n clone.prefix(*pf)\r\n end", "def symbol; end", "def symbol; end", "def symbol; end", "def symbol; end", "def symbol; end", "def symbol; end", "def sym(name)\n #This is a stub, used for indexing\n end", "def ^ other\n (self.to_s ^ other).to_sym\n end", "def ^(pow)\r\n\t\tpower(pow)\r\n\tend", "def use(sym); end", "def public(*syms) end", "def symbol\n \n end", "def name(*) end", "def name(*) end", "def private(*syms) end", "def tr!(p0, p1) end", "def sym\n @sym\n end", "def alias_of; end", "def hello; :hello; end", "def |(parslet); end", "def |(parslet); end", "def ingverb; end", "def fed\n ( p p )\n p?a a?p\n\n q= p q =p\n p %%.....%% q\n dne end", "def %(p0) end", "def %(p0) end", "def slop!; end", "def slop!; end", "def prefix=(_); end", "def boring_parrot(thing)\n thing\nend", "def pword\n end", "def sym(name)\n SymEngine::Symbol.new(name)\nend", "def hat!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 7 )\n\n type = HAT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 128:7: '^'\n match( 0x5e )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 7 )\n\n end", "def dot\n end", "def hamlet_quote; end", "def print_alias(*) end", "def _here_\n 'here'\nend", "def sk! ; k! ; s! ; end", "def |(arg0)\n end", "def |(arg0)\n end", "def |(arg0)\n end", "def symbol\n @symbol\n end", "def prefixo\n return ' ~> '\n end", "def indefinite_reflexive_pronoun\n return \"itself\"\n end", "def ~\n end", "def bin_sym\n @underscored_name ||= name.split('::').last.gsub(/([a-z\\d])([A-Z])/, '\\1_\\2').downcase.to_sym\n end", "def puncture\n end", "def prefix\n \"=> \"\n end", "def buzzword; end", "def buzzword; end", "def /(p0) end", "def termsig(*) end", "def **(p0) end", "def methods_accepting_symbol; end", "def modifier; end", "def indefinite_possessive_pronoun\n return \"its\"\n end", "def tr(p0, p1) end", "def defp &p\r\n $p = p\r\n g2 &p # this is ok\r\nend", "def aliased_name; end", "def alias_method(sym1,sym2) end", "def ^(f)\n return self.class::new( @val ^ f )\n end", "def alt; end", "def term; end", "def start_symbol\n @start_symbol\n end", "def fullsym(sep=' ', skip_pair=false)\n (skip_pair and @source.start_with? '(') ? @sym : \n \"#{@sym}#{sep}#{@source}\"\n end", "def do_something (arg1, arg2, arg3)\n\n\targ1^arg2^arg3\nend", "def protected(*syms) end", "def to_sym\n `return $opal.Y(self);`\n end", "def &(p0) end", "def &(p0) end", "def specialty; end", "def symbol! sym\n initialize\n s0 = new_state\n s1 = new_state\n set_start(s0)\n set_final(s1, true)\n add_transition(s0, s1, sym)\n end", "def symbol! sym\n initialize\n s0 = new_state\n s1 = new_state\n set_start(s0)\n set_final(s1, true)\n add_transition(s0, s1, sym)\n end", "def symbol\n sub_str = @sub ? \"b\" : \"\"\n chord_str = @@chord_symbols[@mode][@step]\n modifiers_str = @modifiers.empty? ? \"\" : \"-#{@modifiers * \"-\"}\"\n inversion_str = @inversion > 1 ? \"_#{@inversion}\" : \"\"\n \n \"#{sub_str}#{chord_str}#{modifiers_str}#{inversion_str}\".intern\n end", "def lex_en_leading_dot=(_arg0); end", "def lex_en_leading_dot=(_arg0); end", "def lex_en_leading_dot=(_arg0); end", "def *(p0) end", "def *(p0) end", "def *(p0) end", "def handle_special_CROSSREF(special)\n name = special.text\n\n return @seen[name] if @seen.include? name\n\n if name[0,1] == '#' then\n lookup = name[1..-1]\n name = lookup unless @show_hash\n else\n lookup = name\n end\n\n # Find class, module, or method in class or module.\n if /([A-Z]\\w*)[.\\#](\\w+[!?=]?)/ =~ lookup then\n container = $1\n method = $2\n ref = @context.find_symbol container, method\n elsif /([A-Za-z]\\w*)[.\\#](\\w+(\\([\\.\\w+\\*\\/\\+\\-\\=\\<\\>]+\\))?)/ =~ lookup then\n container = $1\n method = $2\n ref = @context.find_symbol container, method\n else\n ref = @context.find_symbol lookup\n end\n\n out = if lookup =~ /^\\\\/ then\n $'\n elsif ref and ref.document_self then\n \"<a href=\\\"#{ref.as_href(@from_path)}\\\">#{name}</a>\"\n else\n name\n end\n\n @seen[name] = out\n\n out\n end", "def syntax\n :less\n end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end" ]
[ "0.6600134", "0.6600134", "0.6600134", "0.6600134", "0.6600134", "0.6059679", "0.6059679", "0.6059679", "0.5816411", "0.5816411", "0.5816411", "0.5816411", "0.5816411", "0.5816411", "0.5789358", "0.56973857", "0.56973857", "0.56973857", "0.56973857", "0.56973857", "0.56973857", "0.5692567", "0.5687671", "0.54280376", "0.537721", "0.53489405", "0.5316598", "0.5292047", "0.5292047", "0.52874064", "0.5282528", "0.5259131", "0.52361757", "0.51892346", "0.51891375", "0.51891375", "0.5151098", "0.51250845", "0.51216793", "0.51216793", "0.51082337", "0.51082337", "0.5100249", "0.50872916", "0.5079286", "0.50686556", "0.5066437", "0.50601983", "0.50489026", "0.5028276", "0.5024288", "0.5021528", "0.5017677", "0.5017677", "0.5017677", "0.5017196", "0.50072646", "0.5002195", "0.498529", "0.49781156", "0.49729347", "0.49685806", "0.49646053", "0.49646053", "0.49637482", "0.49613795", "0.49384427", "0.49336615", "0.49300638", "0.4927166", "0.49202555", "0.49179408", "0.49167705", "0.49161327", "0.4915276", "0.49116406", "0.4908315", "0.49070993", "0.49061316", "0.49050972", "0.48953193", "0.48919034", "0.48853993", "0.48853993", "0.4884207", "0.48815188", "0.48815188", "0.488096", "0.48601463", "0.48601463", "0.48601463", "0.48595327", "0.48588973", "0.48588973", "0.4856396", "0.48543996", "0.48527443", "0.48527443", "0.48527443", "0.48527443", "0.48527443" ]
0.0
-1
Retrieves the git channel for the specific IRC channel
def git_channel(channel) return @channels[channel] if @channels[channel] @channels[channel] = Git::Channel.new(@config[channel.server.name][channel.nname]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_channel_by_name(client, channel_name)\n channel_data = client.channels_info(channel: \"#\" + channel_name.to_s)\n channel_data.channel.id\nend", "def channel\n Channel.get(@name)\n end", "def channel\n @channels[BASE_PATH]\n end", "def channel_name\n @channel_name ||= SlackUtils::SingletonClient.instance.find_channel_name(@channel_id)\n end", "def channel\n return @channel\n end", "def get_channel(bone, channel)\n channel_data_for(bone).get_channel(channel)\n end", "def channel\n metadata&.dig('event', 'channel')\n end", "def get_channel hash, to\n if config.recipient then\n make_channel config.recipient\n elsif to then\n make_channel to\n elsif hash[:channel]\n make_channel hash[:channel]\n else\n raise CollinsNotify::ConfigurationError.new \"No slack.channel or config.recipient specified\"\n end\n end", "def find_channel\n debug 'Looking for channel...'\n _response = self.signed_request'/api/v1/channels.list.joined', 'GET'\n _channels = _response['channels']\n\n _channels.each { |ch|\n if ch['name'] == $config.get_channel\n @channel_id = ch['_id']\n break\n end\n }\n\n if @channel_id\n debug \"Channel found! Channel ID is #{@channel_id}\"\n else\n puts \"Channel not found. Check if channel ##{$config.get_channel} exists and bot user is added to the channel.\"\n exit 1\n end\n end", "def channel_name\r\n return for_context(false) { |c| c.channel_name } \r\n end", "def channel_name\n client_channel.present? ? self.client_channel.channel_name : \"\"\n end", "def channel\n params['channel'].gsub('/','')\n end", "def slack_channel\n return ENV['SLACK_CHANNEL'] if ENV['SLACK_CHANNEL'][0] == '#'\n '#' + ENV['SLACK_CHANNEL']\n end", "def channel id = nil\n id ||= \"#{current_user.organisation_id}#{env[\"REQUEST_PATH\"].gsub(/\\/ws/,\"\")}\"\n Pubs.channels[id]\n end", "def get_channel(name)\n channel = @channels[name]\n return channel unless channel.nil?\n # If not exists, create it\n logger.debug \"Created channel #{name}\"\n stat_channel_created name # Stats and log\n @channels[name] = Neighborparrot::Channel.new(name, @app_info)\n end", "def get_channel(name, create)\n channel = @channels[name]\n if not channel and create\n channel = Channel.new(name)\n @channels[name] = channel\n @logger.debug(\"Created channel #{name}\")\n end\n channel\n end", "def channel\n request.path\n end", "def find_channel(name)\n if name.include? '/'\n sid, cid = name.split('/')\n\n server = discord.servers[sid.to_i]\n server ||= (discord.servers.find { |_i, s| s.name.downcase.tr(' ', '~') == sid.downcase } || [])[1]\n return unless server\n\n chan = server.channels.find { |c| [c.id.to_s, c.name].include? cid }\n return unless chan\n\n DiscordChannelShim.new chan\n else\n chans = channel_list.select { |c| c.name == name }\n if chans.count == 1\n chans.first\n elsif chans.count > 1\n chans\n end\n end\n end", "def find_channel(name)\n if name.include? '/'\n sid, cid = name.split('/')\n\n server = discord.servers[sid.to_i]\n server ||= (discord.servers.find { |_i, s| s.name.downcase.tr(' ', '~') == sid.downcase } || [])[1]\n return unless server\n\n chan = server.channels.find { |c| [c.id.to_s, c.name].include? cid }\n return unless chan\n\n DiscordChannelShim.new chan\n else\n chans = channel_list.select { |c| c.name == name }\n if chans.count == 1\n chans.first\n elsif chans.count > 1\n chans\n end\n end\n end", "def [](channel_name)\r\n return @channels[channel_name.downcase]\r\n end", "def get_channel()\n return(get_cmd('MC;',0.1,0.5,3).gsub(/^MC/,'').gsub(/;$/,'').to_i)\nend", "def channel_name(num)\n\t\tregexp = /^CHANNEL#{num}=\"(.*)\"\\s*/\n\t\t@input_ary.each { |e| \n\t\t\treturn $1.to_s.gsub(/\\s+/,\"_\").strip if e =~ regexp\n\t\t}\n\t\traise DTA_ReaderErr, \"Cannot find channel #{num} name\"\n\tend", "def get_facebook_channel(project_id, query_id)\n get \"projects/#{project_id}/facebookchannels/#{query_id}\"\n end", "def channel(token, channel_id)\n request(\n __method__,\n :get,\n \"#{api_base}/channels/#{channel_id}\",\n Authorization: token\n )\n end", "def channel_index\n return @channel_index\n end", "def get_channel_for(level, user = nil)\n if user\n # \"answers\" are in the channel so instead of doing\n # set_level_source to load answers when looking at another user,\n # we have to load the channel here.\n user_storage_id = storage_id_for_user_id(user.id)\n channel_token = ChannelToken.find_channel_token(level, user_storage_id)\n else\n user_storage_id = storage_id('user')\n channel_token = ChannelToken.find_or_create_channel_token(\n level,\n request.ip,\n user_storage_id,\n {\n hidden: true,\n }\n )\n end\n\n channel_token.try :channel\n end", "def channel\n # Create new channel if closed\n if @channel.nil? || @channel.closed?\n @channel = connection.create_channel\n end\n @channel\n end", "def get_channel_id(con,channel)\n\tsql=\"SELECT id FROM irc_channel WHERE channel='#{channel}';\"\n\t\n\t#check if channel exists in db\n \tres=con.query(sql)\n\tif res.num_rows == 0\n\t\tinsert_channel(con,channel)\n end \n\t\n\tres=con.query(sql)\n\tchannel_id=\"defined\"\t\n res.each_hash do |row|\n \t\tchannel_id=row['id']\n \tend\n\treturn channel_id\nend", "def find_channel(id: nil, name: nil, server_id: nil, server_name: nil)\n server = find_server(id: server_id, name: server_name)\n if server\n find_channel_in_server(id: id, name: name, server: server)\n else\n $bot.servers.each{ |_, s|\n channel = find_channel_in_server(id: id, name: name, server: s)\n return channel if !channel.nil?\n }\n nil\n end\nrescue\n nil\nend", "def channel\n \"market-coin-#{market_coin.id}\"\n end", "def channel\n @channel ||= Proletariat.connection.create_channel\n end", "def channel\n @channel ||= Proletariat.connection.create_channel\n end", "def public_channel(ns)\n # [\"chat\", \"rumor\", \"wldh\", \"tianshi\", \"bwxy\", \"bh\"]\n get_client(ns).public_channel\n end", "def channel_for(maildir)\n @channel ||= {}\n @channel[maildir.to_sym] ||= begin\n channel = config.channels.max_by do |channel|\n localstore_path = channel.localstore.path_of[channel.label.to_sym]\n maildir.slice(localstore_path) ? localstore_path.intersection(maildir).length : 0\n end\n\n localstore_path = channel.localstore.path_of[channel.label.to_sym]\n\n folder = maildir.sub(%r{#{localstore_path}/?}, '')\n .gsub(channel.localstore.flatten.unescape,\n (channel.remotestore.pathdelimiter || '/'))\n\n channel.label + (folder.empty? ? '' : \":#{folder}\")\n end\n end", "def channel(name, channel)\n @network = Network.first(:name => name)\n if not @network\n raise NotFound\n end\n @channel = @network.channels.first(:name => channel.gsub(/\\+/, \"#\"))\n if not @channel\n raise NotFound\n end\n @quotes = @channel.quotes.all(:limit => 10, :order => [:posted.desc])\n page_title \"#{@channel.name} (#{@network.name})\"\n display @quotes\n end", "def connection_for nick\n @connection_cache[nick]\n end", "def get_by_channel(channel, cookie_or_cookies = nil)\n add_cookie_to_http_header(cookie_or_cookies)\n return @client.get(\"#{@resource_uri}/channel/#{channel}\")\n end", "def get_channel(id, cached: true)\n return @channel_cache.fetch(id) { p id; super(id) } if cached\n\n channel = super(id)\n @channel_cache.cache(id, channel)\n end", "def find_channel(channel_name, server_name = nil, type: nil)\n results = []\n\n if /<#(?<id>\\d+)>?/ =~ channel_name\n # Check for channel mentions separately\n return [channel(id)]\n end\n\n @servers.each_value do |server|\n server.channels.each do |channel|\n results << channel if channel.name == channel_name && (server_name || server.name) == server.name && (!type || (channel.type == type))\n end\n end\n\n results\n end", "def redis_channel_name\n\t\t\t@redis_channel_name ||= \"#{File.basename($0, '.*')}_Redis_Channel\"\n\t\tend", "def channel_obj\r\n Channel.select(:channel, :service).where(id: object.channel_id).last || Channel.new(service: \"Not Found\", channel: \"Not Found\")\r\n end", "def uri\n @uri ||= File.join(self.class.base_uri, channel)\n end", "def channels \n debug [query[\"channels\"], \" are registered channels\"]\n @channels ||= query[\"channels\"].collect(&:strip).reject(&:empty?) \n @channels[0] ||= nil # Every user should have at last one channel\n @channels\n end", "def channel\n \"private-job-#{id}\"\n end", "def channel\n params.detect { |param| param.start_with?(\"#\") }&.delete(\"#\")\n end", "def irc_send_join(channel)\n # We send an IRC message that joins a channel\n irc_send(\"JOIN #{channel}\")\nend", "def channel(name)\n arn = self.fetch(name)\n region = arn.split(':')[3]\n notifier_builder.new(region: region).topics[arn]\n end", "def get_slack_integration_channel(account_name, channel_name, opts = {})\n data, _status_code, _headers = get_slack_integration_channel_with_http_info(account_name, channel_name, opts)\n data\n end", "def repo_name\n return unless @url\n @repo_name ||= Octokit::Repository.from_url(@url).to_s.chomp('.git')\n end", "def git_project_name\n Pkg::Util.in_project_root do\n stdout, _, _ = Pkg::Util::Execution.capture3(\"#{GIT} config --get remote.origin.url\")\n stdout.split('/')[-1].chomp(\".git\").chomp\n end\n end", "def channel_node\n if @channel_node.nil? && self.root_node != nil\n @channel_node = FeedTools::XmlHelper.try_xpaths(self.root_node, [\n \"channel\",\n \"CHANNEL\",\n \"feedinfo\",\n \"news\"\n ])\n if @channel_node == nil\n @channel_node = self.root_node\n end\n end\n return @channel_node\n end", "def channel_id_to_name(data)\n channel = nil\n if @@channel_list\n channel = @@channel_list.select {|channel| channel.id == data.channel}.first\n end\n channel_name = channel != nil ? channel.name : \"nil\"\n end", "def channel(user)\n if user.is_a? String\n user\n else\n user.send(:push_id)\n end\n end", "def component_repo(cmp)\n component(cmp).fetch('repo', \"#{CONF_DEFAULT_BASE_REPO}/#{cmp}.git\")\nend", "def component_repo(cmp)\n component(cmp).fetch('repo', \"#{CONF_DEFAULT_BASE_REPO}/#{cmp}.git\")\nend", "def channel\n\n Thread.current['_boss_amqp_channel'] ||= amqp_connect.create_channel\n end", "def getGitRepo config\n\tworkingDir = config[\"workingDir\"]\n\tbranch = config[\"git\"][\"branch\"]\n\trepository = config[\"git\"][\"repository\"]\n\t\n\t# when working directory does not exist, create it and clone the repository\n\t# otherwise just pull changes\n\tif not Dir.exists? workingDir then\n\t\tDir.mkdir workingDir\n\t\tg = Git.clone(repository, branch, :path => workingDir)\n\t\tlatestCommit = g.log.last\n\telse\n\t\tg = Git.open(workingDir + \"/\" + branch)\n\t\tg.pull\n\t\tlatestCommit = g.log.last\n\tend\n\t\n\treturn latestCommit\nend", "def show\n @gitHubRepo = GitHubRepo.where(:id => @git_hub_issue.repo_id).first.repo\n end", "def branch\n %x[cd #{repo_path};git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'}].chomp\n end", "def getNotificationChannel(channel_id)\n cid = CGI.escape(channel_id)\n url = \"#{@fqdn}#{NOTIFICATION_RESOURCE}/#{cid}\"\n\n begin\n r = self.get(url)\n rescue RestClient::Exception => e\n raise(ServiceException, e.response || e.message, e.backtrace)\n end\n Model::NotificationChannel.from_response(r)\n end", "def target_channel\n name = case self.command\n when :invite then self.params[1]\n when RPL_NAMREPLY then self.params[2]\n when ERR_USERNOTINCHANNEL then self.params[2]\n when ERR_USERONCHANNEL then self.params[2]\n when ERR_UNKNOWNMODE then self.trail[/\\S+$/]\n else self.params.fetch(numeric? ? 1 : 0, \"\")\n end\n\n if name.start_with?('&', '#', '+', '!')\n return name\n end\n\n return nil\n end", "def git\n @git ||= Git::Repo.new \"git@#{hostname}:hoboku.git\"\n end", "def channel\n return @channel if @channel && !@channel.closed?\n @channel = connect.create_channel\n rescue Bunny::ChannelAlreadyClosed => e\n reconnect\n end", "def get_channel(channel_id, opts = {})\n data, _status_code, _headers = get_channel_with_http_info(channel_id, opts)\n data\n end", "def find_session_channel(sid)\n\t\tsession_channels[sid.to_i]\n\tend", "def inspect\n \"<Channel name=#{@name} id=#{@id} topic=\\\"#{@topic}\\\" type=#{@type} position=#{@position} server=#{@server || @server_id}>\"\n end", "def channels\r\n return @chanlist\r\n end", "def getchaninfo(chan_id)\n stub.get_chan_info(\n Lnrpc::ChanInfoRequest.new(\n chan_id: chan_id\n )\n )\n end", "def channel=(name)\n @channel = name\n end", "def getProjectName()\n\tcurl = 'git config --local remote.origin.url|sed -n \"s#.*/\\([^.]*\\)\\.git#\\1#p\"'\n\tresult = `#{curl}`\n\treturn result.strip()\nend", "def get_all_channels\n user_id = current_user.id\n user_channels=Chatbox.uniq.where(:user_id => user_id).pluck(:channel)\n return user_channels \n end", "def get(cookie_hash)\n begin\n commit = Commit.find(:user => @user, :repo => @repo_name, :sha => cookie_hash)\n return commit.message\n rescue Octopi::NotFound\n puts \"Requested cookie does not exist.\"\n return nil\n end\n end", "def get_channel_id key\n\tchannel = 'PewDiePie'\n\tchannels = Youtube.get('/search?part=snippet&q=' + channel + '&maxResults=1&type=channel&key=' + key)\n\t\t#channels.each do |channel|\n\tname = channels.parsed_response['items'][0]['snippet']['title']\n\tid = channels.parsed_response['items'][0]['id']['channelId']\n\n\tp name + ': ' + id\n\t#end\n\tget_channel_vidios key\nend", "def make_channel chan\n @logger.debug \"In make_channel, got #{chan}\"\n # If we are DMing a user (chan looks like @username), do nothing\n # otherwise, make sure chan starts with a '#', if it doesn't already\n\n # channel names must be lowercase, and not contain spaces or periods\n # I'm going to assume that usernames need the same requirements\n chan.sub(/^(?!#|@)/,'#').downcase.gsub(/ |\\./, '_')\n end", "def nick\r\n return for_context(nil, false) { |c| c.nick }\r\n end", "def channel_type(channel)\n type = server_type.channel_prefix[channel[0,1]]\n type ? type : :unknown\n end", "def get_repo(project)\n return 'https://github.com/NuCivic/' + project\n end", "def get_gitlab_ref(git_url)\n return 'TBD' if ENV['GITLAB_ACCESS_TOKEN'].nil?\n proj_name = File.basename(git_url, '.git')\n\n gitlab_ref = nil\n begin\n proj = gitlab_client.project(\"#{GITLAB_ORG}/#{proj_name}\")\n commits = gitlab_client.repo_commits(proj.id, page: 1)\n if commits\n gitlab_ref = commits[0].to_hash['id']\n end\n rescue =>e\n # can happen if a GitLab project for the component does not exist\n msg = \"Unable to get GitLab ref for #{proj_name}:\\n #{e.message}\"\n warning(msg)\n end\n gitlab_ref\n end", "def git_repo_name\n path = File.expand_path(File.dirname(__FILE__))\n # the path looks like /repos/bender.git/hooks\n path.split(%r{/})[-2]\nend", "def client_channel\n \"#{access_key}-client\"\n end", "def channels(auth, server_id)\n MijDiscord::Core::API.request(\n :guilds_sid_channels,\n server_id,\n :get,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/channels\",\n Authorization: auth\n )\n end", "def private_channel\n \"private-#{id}\"\n end", "def getMatchGitBranch(org_id)\n conf = loadIOSConfigFile(org_id)\n return conf['match_git_branch']\nend", "def cmd_channel(*args)\n\t\tif (args.length == 0)\n\t\t\targs.unshift(\"-h\")\n\t\tend\n\n\t\tmode = nil\n\n\t\t# Parse options\n\t\t@@channel_opts.parse(args) { |opt, idx, val|\n\t\t\tcase opt\n\t\t\t\twhen \"-h\"\n\t\t\t\t\tprint(\n\t\t\t\t\t\t\"Usage: channel [options]\\n\\n\" +\n\t\t\t\t\t\t\"Displays information about active channels.\\n\" +\n\t\t\t\t\t\t@@channel_opts.usage)\n\t\t\t\t\treturn true\n\t\t\t\twhen \"-l\"\n\t\t\t\t\tmode = 'list'\n\t\t\tend\n\t\t}\n\n\t\t# No mode, no service.\n\t\tif (mode == nil)\n\t\t\treturn true\n\t\telsif (mode == 'list')\n\t\t\ttbl = Rex::Ui::Text::Table.new(\n\t\t\t\t'Indent' => 4,\n\t\t\t\t'Columns' =>\n\t\t\t\t\t[\n\t\t\t\t\t\t'Id',\n\t\t\t\t\t\t'Class',\n\t\t\t\t\t\t'Type'\n\t\t\t\t\t])\n\t\t\titems = 0\n\n\t\t\tclient.channels.each_pair { |cid, channel|\n\t\t\t\ttbl << [ cid, channel.class.cls, channel.type ]\n\t\t\t\titems += 1\n\t\t\t}\n\n\t\t\tif (items == 0)\n\t\t\t\tprint_line(\"No active channels.\")\n\t\t\telse\n\t\t\t\tprint(\"\\n\" + tbl.to_s + \"\\n\")\n\t\t\tend\n\t\tend\n\tend", "def get_level_channel(level, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:path]['Level'] = level\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/level_channels/[Level]'\n\t\targs[:query]['Action'] = 'GetLevelChannel'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend", "def channel(val = nil)\n val.nil? ? @state.channel : @state.channel = val\n end", "def git\n # log \"Thread.current[:repo] nil? \" + Thread.current[:repo].nil?.to_s\n Thread.current[:repo] ||= clone(ARGV[0], ARGV[1])\n Thread.current[:repo]\n end", "def ask_for_branch(git,message)\n branch = git_branches(git)\n return branch[0] if branch.size == 1\n ask_for_item(message,branch)\n end", "def channels_list\n get \"channels\"\n end", "def get_info(channel_name)\n uri = create_api_uri(@@base_uri, channel_name, 'getInfo')\n return get(uri)\n end", "def get_current_branch_from_git\n %x{ git rev-parse --abbrev-ref HEAD }.chomp\nend", "def branch\n case @vcs\n when 'github'\n if @data.key? 'ref'\n @data['ref'].sub('refs/heads/', '')\n else\n @data['repository']['default_branch']\n end\n when 'gitlab'\n @data['ref'].sub('refs/heads/', '')\n when 'bitbucket-server'\n @data['changes'][0]['refId'].sub('refs/heads/', '')\n when 'bitbucket'\n return @data['push']['changes'][0]['new']['name'] unless deleted?\n\n @data['push']['changes'][0]['old']['name']\n when 'stash'\n @data['refChanges'][0]['refId'].sub('refs/heads/', '')\n when 'tfs'\n @data['resource']['refUpdates'][0]['name'].sub('refs/heads/', '')\n end\n end", "def channel(channel_command, *command_args)\n channel_hash = Hash.new\n command_args = command_args.join(\" \")\n case channel_command\n when \"authcap\"\n raise ArgumentError, \"Authcap requires a channel number and privilege\" if command_args.empty?\n channel_output = run_command(this_method_name, \"#{channel_command} #{command_args.join(' ')}\")\n return channel_hash = split_output(channel_output, ':')\n when \"getaccess\"\n raise ArgumentError, \"Authcap requires a channel number and uid\" if command_args.empty?\n user_hash = user(\"list\", command_args[0])\n raise ArgumentError, \"Invalid user specified\" unless user_hash.has_key?(\"uid#{command_args[1]}\".to_sym)\n channel_output = run_command(this_method_name, \"#{channel_command} #{command_args.join(' ')}\")\n channel_hash = split_output(channel_output, ':')\n when \"setaccess\"\n raise ArgumentError, \"Authcap requires a channel number, uid, and privilege level\" if command_args.empty?\n user_hash = user(\"list\", command_args[0])\n raise ArgumentError, \"Invalid user specified\" unless user_hash.has_key?(\"uid#{command_args[1]}\".to_sym)\n command_args[2] = \"privilege=#{command_args[2]}\"\n run_command(this_method_name, \"#{channel_command} #{command_args.join(' ')}\")\n when \"info\"\n raise ArgumentError, \"Info requires a channel number\" if command_args.empty?\n channel_output = run_command(this_method_name, \"#{channel_command} #{command_args}\")\n channel_output = channel_output.grep(/:/).each { |line| line.strip! }.delete_if { |line| line =~ /:$/ }\n return channel_hash = split_output(channel_output, ':')\n when \"getciphers\"\n raise ArgumentError, \"Info requires a protocol and channel number\" if command_args.empty?\n channel_output = run_command(this_method_name, \"#{channel_command} #{command_args.join(' ')}\").grep(/^[0-9]/)\n channel_output.each { |c| channel_hash[\"id#{c.split[0]}\".to_sym] = c.split[1..-1] }\n return channel_hash\n else\n raise ArgumentError, \"Invalid Channel Command\"\n end\n end", "def git_level\n # Assumes PWD is a valid git repo\n return nil unless File.exists? \".git/current_cmvc_level\"\n return File.read(\".git/current_cmvc_level\").chomp\nend", "def system_channel(ns)\n get_client(ns).system_channel\n end", "def get_repo(repo)\n\t\treturn self.fetch(\"repos/#{repo}\")\n\tend", "def open_channel\n @@game_channels.delete(@event.channel)\n nil\n end", "def set_slack_channel\n @slack_channel = SlackChannel.find(params[:id])\n end", "def current_branch\n Dir.chdir @root do\n cmd = \"git rev-parse --abbrev-ref HEAD\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n case stderr\n when /unknown revision/\n raise Error, \"could not determine branch of repo with no commits\"\n when /Not a git repository/\n raise NotARepositoryError\n else\n raise Error, stderr\n end\n end\n return stdout.strip\n end\n end", "def set_channel\n @channel = ::Channel.find(params[:id])\n end" ]
[ "0.6916028", "0.69111717", "0.6870902", "0.65356845", "0.64999634", "0.6493034", "0.64337313", "0.6372567", "0.635321", "0.6327158", "0.6298036", "0.6194856", "0.618641", "0.61220217", "0.6047776", "0.6002146", "0.59374535", "0.59219605", "0.59219605", "0.5915711", "0.59081376", "0.5875705", "0.5875028", "0.5851026", "0.5834449", "0.58256626", "0.57972455", "0.5781751", "0.5725012", "0.56780535", "0.56097496", "0.56097496", "0.5559856", "0.55361885", "0.55358344", "0.5534539", "0.5532253", "0.5517222", "0.55032736", "0.55017525", "0.5473471", "0.5465397", "0.5456784", "0.5446792", "0.54307294", "0.5430288", "0.54171443", "0.5394501", "0.53738445", "0.5353148", "0.53529835", "0.53459644", "0.5343034", "0.53333706", "0.53333706", "0.533018", "0.5329317", "0.5321714", "0.53165805", "0.53147465", "0.5312585", "0.53064686", "0.5301617", "0.5266308", "0.52465993", "0.5238429", "0.5232671", "0.5232478", "0.522313", "0.52227896", "0.52185935", "0.52135426", "0.52124333", "0.5194074", "0.51832736", "0.5179555", "0.51769453", "0.5170154", "0.51593053", "0.51443934", "0.5124364", "0.512151", "0.5119785", "0.5103963", "0.510297", "0.5102412", "0.50984114", "0.509139", "0.5085579", "0.50831217", "0.5082492", "0.5078656", "0.5076547", "0.5068247", "0.50662327", "0.5055506", "0.5051348", "0.5049578", "0.5034209", "0.503088" ]
0.7265467
0